Skip to content

UI #1055

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

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open

UI #1055

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
40012b9
feat(ui): add background color to outline button and input
tszhong0411 Apr 12, 2025
4bf22e3
feat: remove ui and utils packages
tszhong0411 Apr 14, 2025
4af4957
chore: remove an unused release
tszhong0411 Apr 14, 2025
bef0d38
feat: ui
tszhong0411 Apr 15, 2025
a644754
feat(docs): remove blur fade
tszhong0411 Apr 16, 2025
0e259d4
refactor: remove blur image from ui
tszhong0411 Apr 16, 2025
ac390ce
feat: callout -> alert
tszhong0411 Apr 16, 2025
a64d91e
refactor: classes sort
tszhong0411 Apr 17, 2025
57f3851
fix(docs): correct cn path
tszhong0411 Apr 17, 2025
6284ef2
refactor: misc
tszhong0411 Apr 17, 2025
18812e7
feat(docs): remove ark references
tszhong0411 Apr 17, 2025
91a419a
feat(docs): intro
tszhong0411 Apr 17, 2025
1b8b297
feat(docs): ark ui badge
tszhong0411 Apr 17, 2025
4c6ecbc
feat(docs): update intro
tszhong0411 Apr 17, 2025
b03b543
feat(docs): add calendar and chart, add registry, fix generators
tszhong0411 Apr 17, 2025
20330ca
feat(docs): prepare for registry
tszhong0411 Apr 17, 2025
fadd9a7
refactor(docs): shorter classes
tszhong0411 Apr 18, 2025
94ba2f7
feat(docs): ark ui badges
tszhong0411 Apr 18, 2025
a3fa2d2
feat(ui): add back ui for cli
tszhong0411 Apr 18, 2025
3e76548
feat(docs): manually installation
tszhong0411 Apr 18, 2025
0625141
fix(docs): set max width to demos
tszhong0411 Apr 18, 2025
c345309
feat(docs): add info icon to alert component
tszhong0411 Apr 18, 2025
c4202d0
feat(docs): change the image of aspect ratio demo
tszhong0411 Apr 18, 2025
fafc3a9
feat(docs): update keyboard input element
tszhong0411 Apr 18, 2025
b61105e
feat(docs): add installation
tszhong0411 Apr 18, 2025
7ac9afc
fix: export link variants
tszhong0411 Apr 18, 2025
216b8ac
fix(web): isPending prop is no longer available on Button
tszhong0411 Apr 18, 2025
e6aaaad
feat(docs): data table
tszhong0411 Apr 18, 2025
5554cef
feat: ui package approach
tszhong0411 Apr 18, 2025
2af0b85
chore: move get-abbr to utils
tszhong0411 Apr 18, 2025
481630c
chore: check diff
tszhong0411 Apr 18, 2025
ff4aa9d
chore: see diff
tszhong0411 Apr 18, 2025
d8f1d01
feat(docs): remove installation
tszhong0411 Apr 18, 2025
c478824
fix(docs): correct alert usage
tszhong0411 Apr 18, 2025
f222a38
chore: see diff
tszhong0411 Apr 18, 2025
f7eb93c
chore: see diff
tszhong0411 Apr 18, 2025
6a51711
chore: see diff
tszhong0411 Apr 18, 2025
dc75be0
chore: update pnpm lock
tszhong0411 Apr 18, 2025
62f0ee9
refactor: remove unused files, unnecessary size-4
tszhong0411 Apr 18, 2025
0b9f901
feat(ui): re-export constants from input one time password
tszhong0411 Apr 18, 2025
60b8c86
style: &&
tszhong0411 Apr 18, 2025
b7019de
chore: update knip config
tszhong0411 Apr 18, 2025
ec23d1c
refactor(web): remove unnecessary inline in theme
tszhong0411 Apr 18, 2025
63598b8
refactor(web): should import range function from utils package
tszhong0411 Apr 18, 2025
fa978c6
refactor(docs): remove unnecessary use client directive
tszhong0411 Apr 18, 2025
102f7fb
fix(ui): add back the `useTheme()` in sonner
tszhong0411 Apr 18, 2025
fa43ac9
refactor(ui): update variable names
tszhong0411 Apr 18, 2025
39694bf
refactor(ui): shorter destructure
tszhong0411 Apr 18, 2025
4a7b4aa
refactor(ui): export link variants at the bottom
tszhong0411 Apr 18, 2025
4b5947a
chore: move /ui/components to /ui
tszhong0411 Apr 18, 2025
5fb87ca
feat(docs): add new utilities section with links for various utility …
tszhong0411 Apr 18, 2025
4be3b3f
feat(ui): add html and css icons in code block
tszhong0411 Apr 18, 2025
fa2986b
feat(docs): add a guide for UI
tszhong0411 Apr 18, 2025
87a8de1
feat(docs): docs for peer dependencies
tszhong0411 Apr 19, 2025
92e363e
feat(ui): react-textarea-autosize
tszhong0411 Apr 19, 2025
f5f990a
chore: changeset
tszhong0411 Apr 19, 2025
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
25 changes: 25 additions & 0 deletions .changeset/lemon-yaks-show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
'@tszhong0411/utils': minor
'@tszhong0411/ui': minor
---

- Updated the image in aspect ratio demo
- Updated to latest styles of shadcn/ui
- Updated to `cva` beta
- Updated introduction in docs
- Updated code style from `? <component /> : null` to `&& <component />`
- Updated to use oklch colors.
- Updated to divide long tailwindcss classes into multiple lines
- Added `oklab` and `oklch` to known word list.
- Added Ark UI badges
- Added `Chart`, `Calendar`
- Replaced `<Callout />` with `<Alert />`
- Replaced `<VisuallyHidden />` with `sr-only`
- Removed `<BlurFade />` and `<BlurImage />`
- Removed unnecessary `size-4` classes.
- Removed `<Progress />` which is using `@ark-ui/react`
- Removed `<Slider />` which is using `@ark-ui/react`
- Removed `<Combobox />` which is using `@ark-ui/react`
- Removed `<CommandFooter />`
- Renamed `toaster` to `sonner`
- Renamed `getAvatarAbbreviation()` to `getAbbreviation()`
3 changes: 3 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"aceternity",
"airpods",
"anishde",
"beamer",
"benoit",
"bentogrids",
"bradlc",
Expand Down Expand Up @@ -60,6 +61,8 @@
"nums",
"nuqs",
"nuxt",
"oklab",
"oklch",
"oliveira",
"orbstack",
"paralleldrive",
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ const config: NextConfig = {
async redirects() {
return [
{
source: '/ui/components',
destination: '/ui/components/accordion',
source: '/ui',
destination: '/ui/accordion',
permanent: true
}
]
Expand Down
5 changes: 3 additions & 2 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@
},
"dependencies": {
"@hookform/resolvers": "^5.0.1",
"@tanstack/react-table": "^8.21.2",
"@tszhong0411/ui": "workspace:*",
"@tszhong0411/utils": "workspace:*",
"class-variance-authority": "^0.7.1",
"cva": "^1.0.0-beta.3",
"date-fns": "^4.1.0",
"geist": "^1.3.1",
"hast-util-to-jsx-runtime": "^2.3.6",
"lucide-react": "^0.487.0",
"next": "^15.3.0",
"next-themes": "^0.4.6",
"react": "^19.1.0",
"react-day-picker": "8.10.1",
"react-dom": "^19.1.0",
"react-hook-form": "^7.55.0",
"recharts": "^2.15.2",
Expand Down
8 changes: 4 additions & 4 deletions apps/docs/src/app/(main)/[[...slug]]/link-badges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ const LinkBadges = (props: Doc['link'] = {}) => {

return (
<div className='flex items-center gap-2 pt-4'>
{doc ? (
{doc && (
<Link href={doc} className={cn(badgeVariants({ variant: 'secondary' }), 'gap-1')}>
Docs
<ExternalLinkIcon className='size-3' />
</Link>
) : null}
{api ? (
)}
{api && (
<Link href={api} className={cn(badgeVariants({ variant: 'secondary' }), 'gap-1')}>
API Reference
<ExternalLinkIcon className='size-3' />
</Link>
) : null}
)}
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/app/(main)/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const Page = async (props: PageProps) => {
<div className='space-y-4'>
<h1 className='relative text-3xl font-extrabold tracking-tight md:text-4xl'>{title}</h1>
<p className='text-muted-foreground'>{description}</p>
{hasLinks ? <LinkBadges {...link} /> : null}
{hasLinks && <LinkBadges {...link} />}
</div>
<Mdx className='my-12' code={code} />
<EditOnGitHub filePath={_meta.filePath} />
Expand Down
14 changes: 14 additions & 0 deletions apps/docs/src/components/demos/alert/alert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Alert, AlertDescription, AlertTitle } from '@tszhong0411/ui'
import { CheckCircle2Icon } from 'lucide-react'

const AlertDemo = () => {
return (
<Alert className='max-w-md'>
<CheckCircle2Icon />
<AlertTitle>Success! Your changes have been saved</AlertTitle>
<AlertDescription>This is an alert with icon, title and description.</AlertDescription>
</Alert>
)
}

export default AlertDemo
14 changes: 14 additions & 0 deletions apps/docs/src/components/demos/alert/destructive.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Alert, AlertDescription, AlertTitle } from '@tszhong0411/ui'
import { AlertCircleIcon } from 'lucide-react'

const AlertDestructiveDemo = () => {
return (
<Alert variant='destructive' className='max-w-md'>
<AlertCircleIcon />
<AlertTitle>Something went wrong!</AlertTitle>
<AlertDescription>Your session has expired. Please log in again.</AlertDescription>
</Alert>
)
}

export default AlertDestructiveDemo
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const AspectRatioDemo = () => {
return (
<AspectRatio ratio={16 / 9}>
<Image
src='https://images.unsplash.com/photo-1717765911288-5512eba79b41?q=80&w=3270'
src='https://images.unsplash.com/photo-1588345921523-c2dcdb7f1dcd?w=800&dpr=2&q=80'
alt='A smooth, minimalist white background with subtle diagonal light-gray gradients by Drew Beamer'
fill
alt='A grassy field with trees and a mountain in the background, by Benjamin Ashton'
className='rounded-lg object-cover'
/>
</AspectRatio>
Expand Down
12 changes: 0 additions & 12 deletions apps/docs/src/components/demos/blur-fade/blur-fade.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions apps/docs/src/components/demos/blur-image/blur-image.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/docs/src/components/demos/breadcrumb/breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const BreadcrumbDemo = () => {
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink href='/ui/components'>Components</BreadcrumbLink>
<BreadcrumbLink href='/ui'>Components</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/components/demos/button/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CopyIcon } from 'lucide-react'
const ButtonIconDemo = () => {
return (
<Button variant='outline' size='icon' aria-label='Copy'>
<CopyIcon className='size-4' />
<CopyIcon />
</Button>
)
}
Expand Down
8 changes: 7 additions & 1 deletion apps/docs/src/components/demos/button/pending.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { Button } from '@tszhong0411/ui'
import { LoaderIcon } from 'lucide-react'

const ButtonPendingDemo = () => {
return <Button isPending>Pending</Button>
return (
<Button>
<LoaderIcon className='animate-spin' />
Pending
</Button>
)
}

export default ButtonPendingDemo
19 changes: 19 additions & 0 deletions apps/docs/src/components/demos/calendar/calendar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use client'

import { Calendar } from '@tszhong0411/ui'
import { useState } from 'react'

const CalendarDemo = () => {
const [date, setDate] = useState<Date | undefined>(() => new Date())

return (
<Calendar
mode='single'
selected={date}
onSelect={setDate}
className='rounded-md border shadow-sm'
/>
)
}

export default CalendarDemo
42 changes: 42 additions & 0 deletions apps/docs/src/components/demos/calendar/range.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
'use client'

import type { DateRange } from 'react-day-picker'

import { Calendar } from '@tszhong0411/ui'
import { addDays } from 'date-fns'
import { useState } from 'react'

const CalendarRangeDemo = () => {
const [dateRange, setDateRange] = useState<DateRange | undefined>(() => ({
from: new Date(new Date().getFullYear(), 0, 12),
to: addDays(new Date(new Date().getFullYear(), 0, 12), 30)
}))
const [range, setRange] = useState<DateRange | undefined>(() => ({
from: new Date(new Date().getFullYear(), 0, 12),
to: addDays(new Date(new Date().getFullYear(), 0, 12), 50)
}))

return (
<div>
<Calendar
mode='range'
defaultMonth={dateRange?.from}
selected={dateRange}
onSelect={setDateRange}
numberOfMonths={2}
disabled={(d) => d > new Date() || d < new Date('1900-01-01')}
className='rounded-md border shadow-sm'
/>
<Calendar
mode='range'
defaultMonth={range?.from}
selected={range}
onSelect={setRange}
numberOfMonths={3}
className='@4xl:flex hidden rounded-md border shadow-sm [&>div]:gap-5'
/>
</div>
)
}

export default CalendarRangeDemo
11 changes: 0 additions & 11 deletions apps/docs/src/components/demos/callout/callout.tsx

This file was deleted.

11 changes: 0 additions & 11 deletions apps/docs/src/components/demos/callout/error.tsx

This file was deleted.

11 changes: 0 additions & 11 deletions apps/docs/src/components/demos/callout/warning.tsx

This file was deleted.

88 changes: 88 additions & 0 deletions apps/docs/src/components/demos/chart/chart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
'use client'

import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle
} from '@tszhong0411/ui'
import {
type ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent
} from '@tszhong0411/ui'
import { TrendingUpIcon } from 'lucide-react'
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'

const chartData = [
{ month: 'January', desktop: 186 },
{ month: 'February', desktop: 305 },
{ month: 'March', desktop: 237 },
{ month: 'April', desktop: 73 },
{ month: 'May', desktop: 209 },
{ month: 'June', desktop: 214 }
]

const chartConfig = {
desktop: {
label: 'Desktop',
color: 'var(--chart-1)'
}
} satisfies ChartConfig

const ChartDemo = () => {
return (
<Card className='w-full max-w-md'>
<CardHeader>
<CardTitle>Area Chart</CardTitle>
<CardDescription>Showing total visitors for the last 6 months</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: 12,
right: 12
}}
>
<CartesianGrid vertical={false} />
<XAxis
dataKey='month'
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value: string) => value.slice(0, 3)}
/>
<ChartTooltip cursor={false} content={<ChartTooltipContent indicator='line' />} />
<Area
dataKey='desktop'
type='natural'
fill='var(--color-desktop)'
fillOpacity={0.4}
stroke='var(--color-desktop)'
/>
</AreaChart>
</ChartContainer>
</CardContent>
<CardFooter>
<div className='flex w-full items-start gap-2 text-sm'>
<div className='grid gap-2'>
<div className='flex items-center gap-2 font-medium leading-none'>
Trending up by 5.2% this month <TrendingUpIcon className='size-4' />
</div>
<div className='text-muted-foreground flex items-center gap-2 leading-none'>
January - June 2024
</div>
</div>
</div>
</CardFooter>
</Card>
)
}

export default ChartDemo
Loading
Loading