Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
irsyadadl committed Jul 29, 2024
1 parent a3bc8a7 commit c7d4ae8
Show file tree
Hide file tree
Showing 14 changed files with 572 additions and 581 deletions.
Binary file modified bun.lockb
Binary file not shown.
80 changes: 40 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build && vite build --ssr",
"preview": "tsc && vite build && vite build --ssr",
"format": "npx prettier --write ."
},
"devDependencies": {
"@inertiajs/react": "^1.2.0",
"@tailwindcss/forms": "^0.5.7",
"@types/node": "^18.19.42",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.19",
"axios": "^1.7.2",
"laravel-vite-plugin": "^1.0.5",
"postcss": "^8.4.40",
"prettier": "^3.3.3",
"prettier-plugin-organize-imports": "^4.0.0",
"prettier-plugin-tailwindcss": "^0.6.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwindcss": "^3.4.7",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"vite-plugin-watch": "^0.3.1"
},
"dependencies": {
"@irsyadadl/paranoid": "^1.4.2",
"clsx": "^2.1.1",
"framer-motion": "^11.3.17",
"react-aria-components": "^1.3.1",
"sonner": "^1.5.0",
"tailwind-merge": "^2.4.0",
"tailwind-variants": "^0.2.1",
"tailwindcss-animate": "^1.0.7",
"tailwindcss-react-aria-components": "^1.1.4"
}
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build && vite build --ssr",
"preview": "tsc && vite build && vite build --ssr",
"format": "npx prettier --write ."
},
"devDependencies": {
"@inertiajs/react": "^1.2.0",
"@tailwindcss/forms": "^0.5.7",
"@types/node": "^18.19.42",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.19",
"axios": "^1.7.2",
"laravel-vite-plugin": "^1.0.5",
"postcss": "^8.4.40",
"prettier": "^3.3.3",
"prettier-plugin-organize-imports": "^4.0.0",
"prettier-plugin-tailwindcss": "^0.6.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwindcss": "^3.4.7",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"vite-plugin-watch": "^0.3.1"
},
"dependencies": {
"@irsyadadl/paranoid": "^1.4.8",
"clsx": "^2.1.1",
"framer-motion": "^11.3.19",
"react-aria-components": "^1.3.1",
"sonner": "^1.5.0",
"tailwind-merge": "^2.4.0",
"tailwind-variants": "^0.2.1",
"tailwindcss-animate": "^1.0.7",
"tailwindcss-react-aria-components": "^1.1.4"
}
}
2 changes: 1 addition & 1 deletion resources/js/components/theme-toggle.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTheme } from '@/components/theme-provider'
import { Button } from '@/components/ui/button'
import { cn } from '@/lib/utils'
import { IconDeviceDesktop, IconMoon, IconSun } from '@irsyadadl/paranoid'
import { Button } from 'ui'

export function ThemeToggle() {
const { theme, setTheme } = useTheme()
Expand Down
36 changes: 17 additions & 19 deletions resources/js/components/ui/card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


import * as React from 'react'

import type { HeadingProps, TextProps } from 'react-aria-components'
Expand All @@ -9,43 +7,43 @@ import { tv } from 'tailwind-variants'
import { Description } from './field'

const card = tv({
slots: {
root: [
'xrkr rounded-lg xkd2 [&:has(table)_.ccvgs8x]:border-t border bg-card text-fg shadow-sm [&:has(.larhy3):not(:has(.yahnba))>.ccvgs8x]:pt-6 [&:has(.larhy3)]:overflow-hidden [&_table]:overflow-hidden'
],
header: 'flex xlw32 flex-col space-y-1.5 px-6 py-5',
title: 'text-lg klda font-semibold leading-none tracking-tight',
description: 'text-base dl2 text-muted-fg sm:text-sm',
content:
'yahnba px-6 pb-6 has-[.t-hea]:bg-secondary/40 has-[table]:p-0 [&:has(table)+.ccvgs8x]:py-5 [&:has(table)]:border-t [&_.t-cel]:px-6 [&_.t-col]:px-6',
footer: 'ccvgs8x flex items-center p-6 pt-0'
}
slots: {
root: [
'xrkr rounded-lg xkd2 [&:has(table)_.ccvgs8x]:border-t border bg-card text-fg shadow-sm [&:has(.larhy3):not(:has(.yahnba))>.ccvgs8x]:pt-6 [&:has(.larhy3)]:overflow-hidden [&_table]:overflow-hidden'
],
header: 'flex xlw32 flex-col space-y-1.5 px-6 py-5',
title: 'text-lg klda font-semibold leading-none tracking-tight',
description: 'text-base dl2 text-muted-fg sm:text-sm',
content:
'yahnba px-6 pb-6 has-[.t-hea]:bg-secondary/40 has-[table]:p-0 [&:has(table)+.ccvgs8x]:py-5 [&:has(table)]:border-t [&_.t-cel]:px-6 [&_.t-col]:px-6',
footer: 'ccvgs8x flex items-center p-6 pt-0'
}
})

const { root, header, title, description, content, footer } = card()

const Card = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => {
return <div className={root({ className })} {...props} />
return <div className={root({ className })} {...props} />
}

const CardHeader = ({ className, ...props }: React.ComponentProps<typeof Header>) => (
<Header className={header({ className })} {...props} />
<Header className={header({ className })} {...props} />
)

const CardTitle = ({ className, ...props }: HeadingProps) => {
return <Heading slot="title" className={title({ className })} {...props} />
return <Heading slot="title" className={title({ className })} {...props} />
}

const CardDescription = (props: TextProps) => {
return <Description className={description({ className: props.className })} {...props} />
return <Description className={description({ className: props.className })} {...props} />
}

const CardContent = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => {
return <div className={content({ className })} {...props} />
return <div className={content({ className })} {...props} />
}

const CardFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => {
return <div className={footer({ className })} {...props} />
return <div className={footer({ className })} {...props} />
}

export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle }
2 changes: 1 addition & 1 deletion resources/js/components/ui/checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { type ReactNode } from 'react'

import {
Checkbox as CheckboxPrimitive,
CheckboxGroup as CheckboxGroupPrimitive,
type CheckboxGroupProps as CheckboxGroupPrimitiveProps,
Checkbox as CheckboxPrimitive,
type CheckboxProps as CheckboxPrimitiveProps,
composeRenderProps,
type ValidationResult
Expand Down
152 changes: 75 additions & 77 deletions resources/js/components/ui/dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,101 +1,99 @@


import { IconCheck } from '@irsyadadl/paranoid'
import {
Collection,
composeRenderProps,
Header,
ListBoxItem as ListBoxItemPrimitive,
type ListBoxItemProps,
Section,
type SectionProps,
Text,
type TextProps
Collection,
composeRenderProps,
Header,
ListBoxItem as ListBoxItemPrimitive,
type ListBoxItemProps,
Section,
type SectionProps,
Text,
type TextProps
} from 'react-aria-components'
import { tv } from 'tailwind-variants'

const dropdownItemStyles = tv({
base: [
'group flex cursor-default select-none items-center gap-x-1.5 rounded-md py-2 pl-2.5 pr-1 text-base outline outline-0 forced-color-adjust-none lg:text-sm',
'[&_[data-slot=avatar]]:-mr-0.5 [&_[data-slot=avatar]]:size-6 sm:[&_[data-slot=avatar]]:size-5',
'[&:focus_.text-muted-fg]:text-primary-fg/80',
'[&_[data-slot=icon]]:size-4',
'has-submenu:open:data-[danger=true]:bg-danger/20 has-submenu:open:data-[danger=true]:text-danger',
'has-submenu:open:bg-primary has-submenu:open:text-primary-fg'
],
variants: {
isDisabled: {
false: 'text-fg',
true: 'text-muted-fg forced-colors:text-[GrayText]'
base: [
'group flex cursor-default select-none items-center gap-x-1.5 rounded-md py-2 pl-2.5 pr-1 text-base outline outline-0 forced-color-adjust-none lg:text-sm',
'[&_[data-slot=avatar]]:-mr-0.5 [&_[data-slot=avatar]]:size-6 sm:[&_[data-slot=avatar]]:size-5',
'[&:focus_.text-muted-fg]:text-primary-fg/80',
'[&_[data-slot=icon]]:size-4',
'has-submenu:open:data-[danger=true]:bg-danger/20 has-submenu:open:data-[danger=true]:text-danger',
'has-submenu:open:bg-primary has-submenu:open:text-primary-fg'
],
variants: {
isDisabled: {
false: 'text-fg',
true: 'text-muted-fg forced-colors:text-[GrayText]'
},
isFocused: {
false: 'data-[danger=true]:text-danger',
true: [
'bg-primary text-primary-fg forced-colors:bg-[Highlight] forced-colors:text-[HighlightText]',
'data-[danger=true]:bg-danger data-[danger=true]:text-danger-fg'
]
}
},
isFocused: {
false: 'data-[danger=true]:text-danger',
true: [
'bg-primary text-primary-fg forced-colors:bg-[Highlight] forced-colors:text-[HighlightText]',
'data-[danger=true]:bg-danger data-[danger=true]:text-danger-fg'
]
}
},
compoundVariants: [
{
isFocused: false,
isOpen: true,
className: 'bg-zinc-100 dark:bg-zinc-700/60'
}
]
compoundVariants: [
{
isFocused: false,
isOpen: true,
className: 'bg-zinc-100 dark:bg-zinc-700/60'
}
]
})

interface DropdownSectionProps<T> extends SectionProps<T> {
title?: string
title?: string
}

const DropdownSection = <T extends object>(props: DropdownSectionProps<T>) => {
return (
<Section className="after:block after:h-[5px] after:content-[''] first:-mt-[5px]">
<Header className="dsh mb-0.5 px-2 text-sm text-muted-fg">{props.title}</Header>
<Collection items={props.items}>{props.children}</Collection>
</Section>
)
return (
<Section className="after:block after:h-[5px] after:content-[''] first:-mt-[5px]">
<Header className="dsh mb-0.5 px-2 text-sm text-muted-fg">{props.title}</Header>
<Collection items={props.items}>{props.children}</Collection>
</Section>
)
}

const DropdownItem = ({ className, ...props }: ListBoxItemProps) => {
const textValue = props.textValue || (typeof props.children === 'string' ? props.children : undefined)
return (
<ListBoxItemPrimitive
textValue={textValue}
className={composeRenderProps(className, (className, renderProps) =>
dropdownItemStyles({ ...renderProps, className })
)}
{...props}
>
{composeRenderProps(props.children, (children, { isSelected }) => (
<>
<span className="flex flex-1 items-center gap-2 truncate font-normal group-selected:font-semibold">
{children}
</span>
<span className="flex w-5 items-center">{isSelected && <IconCheck className="h-4 w-4" />}</span>
</>
))}
</ListBoxItemPrimitive>
)
const textValue = props.textValue || (typeof props.children === 'string' ? props.children : undefined)
return (
<ListBoxItemPrimitive
textValue={textValue}
className={composeRenderProps(className, (className, renderProps) =>
dropdownItemStyles({ ...renderProps, className })
)}
{...props}
>
{composeRenderProps(props.children, (children, { isSelected }) => (
<>
<span className="flex flex-1 items-center gap-2 truncate font-normal group-selected:font-semibold">
{children}
</span>
<span className="flex w-5 items-center">{isSelected && <IconCheck className="h-4 w-4" />}</span>
</>
))}
</ListBoxItemPrimitive>
)
}

interface DropdownItemSlot extends TextProps {
label?: TextProps['children']
description?: TextProps['children']
label?: TextProps['children']
description?: TextProps['children']
}
const DropdownItemDetails = ({ label, description, ...props }: DropdownItemSlot) => {
return (
<div className="flex flex-col gap-1">
<Text slot="label" className="font-medium lg:text-sm" {...props}>
{label}
</Text>
<Text slot="description" className="text-muted-fg text-xs" {...props}>
{description}
</Text>
</div>
)
return (
<div className="flex flex-col gap-1">
<Text slot="label" className="font-medium lg:text-sm" {...props}>
{label}
</Text>
<Text slot="description" className="text-muted-fg text-xs" {...props}>
{description}
</Text>
</div>
)
}

// Note: This is not exposed component, but it's used in other components to render dropdowns.
export { DropdownItem, dropdownItemStyles, DropdownItemDetails, DropdownSection, type DropdownSectionProps }
export { DropdownItem, DropdownItemDetails, dropdownItemStyles, DropdownSection, type DropdownSectionProps }
2 changes: 1 addition & 1 deletion resources/js/components/ui/grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,4 @@ const GridItem = ({

const GridCollection = Collection

export { Grid, GridItem, GridCollection, gridStyles, gridItemStyles }
export { Grid, GridCollection, GridItem, gridItemStyles, gridStyles }
2 changes: 1 addition & 1 deletion resources/js/components/ui/list-box.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IconHamburger } from '@irsyadadl/paranoid'
import {
ListBox as ListBoxPrimitive,
ListBoxItem as ListBoxItemPrimitive,
ListBox as ListBoxPrimitive,
type ListBoxItemProps,
type ListBoxProps as ListBoxPrimitiveProps
} from 'react-aria-components'
Expand Down
Loading

0 comments on commit c7d4ae8

Please sign in to comment.