Skip to content

Commit

Permalink
remove touch-target
Browse files Browse the repository at this point in the history
  • Loading branch information
irsyadadl committed Oct 13, 2024
1 parent 485ab25 commit c2c4364
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 84 deletions.
5 changes: 1 addition & 4 deletions components/ui/aside.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { tv } from "tailwind-variants"
import { Button, ButtonPrimitive } from "./button"
import { cr, useMediaQuery } from "./primitive"
import { Sheet } from "./sheet"
import { TouchTarget } from "./touch-target"

const aside = tv({
slots: {
Expand Down Expand Up @@ -162,9 +161,7 @@ const Item = ({ isCurrent, children, className, icon: Icon, ...props }: ItemProp
<>
{Icon && <Icon data-slot="icon" />}
<span className="col-start-2">
<TouchTarget>
{typeof children === "function" ? children(values) : children}
</TouchTarget>
{typeof children === "function" ? children(values) : children}
{props.badge && (
<div className="bdx h-[1.30rem] px-1 rounded-md text-muted-fg text-xs font-medium ring-1 ring-fg/20 grid place-content-center w-auto inset-y-1/2 -translate-y-1/2 absolute right-1.5 bg-fg/[0.02] dark:bg-fg/10">
{props.badge}
Expand Down
5 changes: 1 addition & 4 deletions components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import { tv } from "tailwind-variants"

import { cr, focusButtonStyles } from "./primitive"
import { TouchTarget } from "./touch-target"

const buttonStyles = tv(
{
Expand Down Expand Up @@ -119,9 +118,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
)}
>
{(values) => (
<TouchTarget>
{typeof props.children === "function" ? props.children(values) : props.children}
</TouchTarget>
<>{typeof props.children === "function" ? props.children(values) : props.children}</>
)}
</ButtonPrimitive>
)
Expand Down
5 changes: 1 addition & 4 deletions components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { tv } from "tailwind-variants"

import { Button, type ButtonProps } from "./button"
import { useMediaQuery } from "./primitive"
import { TouchTarget } from "./touch-target"

const dialogStyles = tv({
slots: {
Expand Down Expand Up @@ -53,9 +52,7 @@ type DialogHeaderProps = React.HTMLAttributes<HTMLDivElement> & {
const Trigger = (props: ButtonPrimitiveProps) => (
<ButtonPrimitive {...props}>
{(values) => (
<TouchTarget>
{typeof props.children === "function" ? props.children(values) : props.children}
</TouchTarget>
<>{typeof props.children === "function" ? props.children(values) : props.children}</>
)}
</ButtonPrimitive>
)
Expand Down
5 changes: 2 additions & 3 deletions components/ui/disclosure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
import { tv } from "tailwind-variants"

import { cn, cr, tm } from "./primitive"
import { TouchTarget } from "./touch-target"

interface DisclosureGroupProps extends DisclosureGroupPrimitiveProps {
hideBorder?: boolean
Expand Down Expand Up @@ -128,7 +127,7 @@ const Trigger = ({ className, ...props }: ButtonProps) => {
)}
>
{(values) => (
<TouchTarget>
<>
{typeof props.children === "function" ? props.children(values) : props.children}
{!hideIndicator && (
<IconChevronLeft
Expand All @@ -137,7 +136,7 @@ const Trigger = ({ className, ...props }: ButtonProps) => {
)}
/>
)}
</TouchTarget>
</>
)}
</Button>
)
Expand Down
1 change: 0 additions & 1 deletion components/ui/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './primitive';
export * from './progress-circle';
export * from './touch-target';
export * from './aside';
export * from './tree';
export * from './chart';
Expand Down
5 changes: 1 addition & 4 deletions components/ui/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Link as LinkPrimitive, type LinkProps as LinkPrimitiveProps } from "rea
import { tv } from "tailwind-variants"

import { cr } from "./primitive"
import { TouchTarget } from "./touch-target"

const linkStyles = tv({
base: "forced-colors:outline-[Highlight] relative focus-visible:outline-2 outline outline-offset-2 disabled:focus-visible:outline-0 outline-0 outline-primary rounded disabled:opacity-60 forced-colors:disabled:text-[GrayText] border-transparent transition-colors disabled:cursor-default",
Expand Down Expand Up @@ -38,9 +37,7 @@ const Link = ({ className, ...props }: LinkProps) => {
)}
>
{(values) => (
<TouchTarget>
{typeof props.children === "function" ? props.children(values) : props.children}
</TouchTarget>
<>{typeof props.children === "function" ? props.children(values) : props.children}</>
)}
</LinkPrimitive>
)
Expand Down
5 changes: 1 addition & 4 deletions components/ui/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { DropdownItemDetails, dropdownItemStyles, DropdownSection } from "./drop
import { Keyboard } from "./keyboard"
import { Popover } from "./popover"
import { cn, cr, tm } from "./primitive"
import { TouchTarget } from "./touch-target"

interface MenuContextProps {
respectScreen: boolean
Expand Down Expand Up @@ -72,9 +71,7 @@ interface MenuTriggerProps extends ButtonProps {
const Trigger = ({ className, ...props }: MenuTriggerProps) => (
<Button className={trigger({ className })} {...props}>
{(values) => (
<TouchTarget>
{typeof props.children === "function" ? props.children(values) : props.children}
</TouchTarget>
<>{typeof props.children === "function" ? props.children(values) : props.children}</>
)}
</Button>
)
Expand Down
3 changes: 1 addition & 2 deletions components/ui/show-more.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { tv } from "tailwind-variants"

import { buttonStyles } from "./button"
import { cr } from "./primitive"
import { TouchTarget } from "./touch-target"

const showMoreStyles = tv({
base: "text-sm leading-6 after:border-muted before:border-muted",
Expand Down Expand Up @@ -55,7 +54,7 @@ const ShowMore = ({
className={buttonStyles({ shape: "circle", appearance: "outline", size: "small" })}
>
{cr(props.children, (children) => (
<TouchTarget>{children}</TouchTarget>
<>{children}</>
))}
</ToggleButton>
) : (
Expand Down
9 changes: 4 additions & 5 deletions components/ui/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { tv } from "tailwind-variants"

import { Checkbox } from "./checkbox"
import { cn, cr } from "./primitive"
import { TouchTarget } from "./touch-target"

const table = tv({
slots: {
Expand Down Expand Up @@ -143,13 +142,13 @@ const TableColumn = ({ children, isResizable = false, className, ...props }: Tab
<>
{children}
{allowsSorting && (
<TouchTarget>
<>
<span className={cellIcon({ className: isHovered ? "bg-secondary-fg/10" : "" })}>
<IconChevronLgDown
className={sortDirection === "ascending" ? "rotate-180" : ""}
/>
</span>
</TouchTarget>
</>
)}
{isResizable && <ColumnResizer />}
</>
Expand Down Expand Up @@ -204,9 +203,9 @@ const TableRow = <T extends object>({
className="relative bg-transparent pl-3.5 py-1.5 text-muted-fg pressed:text-fg"
slot="drag"
>
<TouchTarget>
<>
<IconHamburger />
</TouchTarget>
</>
</Button>
</Cell>
)}
Expand Down
5 changes: 2 additions & 3 deletions components/ui/text-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import type { FieldProps } from "./field"
import { Description, FieldError, FieldGroup, fieldGroupPrefixStyles, Input, Label } from "./field"
import { ctr } from "./primitive"
import { TouchTarget } from "./touch-target"

type InputType = Exclude<TextInputDOMProps["type"], "password">

Expand Down Expand Up @@ -80,13 +79,13 @@ const TextField = ({
onPress={handleTogglePasswordVisibility}
className="atrs relative isSfx x2e2 [&_[data-slot=icon]]:text-muted-fg focus:outline-none focus-visible:ring-1 focus-visible:ring-primary rounded"
>
<TouchTarget>
<>
{isPasswordVisible ? (
<IconEyeClosed className="transition animate-in" />
) : (
<IconEye className="transition animate-in" />
)}
</TouchTarget>
</>
</ButtonPrimitive>
) : isLoading && indicatorPlace === "suffix" ? (
<IconLoader className="animate-spin isSfx" />
Expand Down
3 changes: 1 addition & 2 deletions components/ui/toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { ToggleButton as ToggleButtonPrimitive, ToggleButtonProps } from "react-
import { tv, VariantProps } from "tailwind-variants"

import { cr, focusButtonStyles } from "./primitive"
import { TouchTarget } from "./touch-target"

const toggleStyles = tv({
extend: focusButtonStyles,
Expand Down Expand Up @@ -59,7 +58,7 @@ const Toggle = ({ className, ...props }: ToggleProps) => {
)}
>
{cr(props.children, (children) => (
<TouchTarget>{children}</TouchTarget>
<>{children}</>
))}
</ToggleButtonPrimitive>
)
Expand Down
15 changes: 0 additions & 15 deletions components/ui/touch-target.tsx

This file was deleted.

5 changes: 2 additions & 3 deletions components/ui/tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { tv } from "tailwind-variants"

import { Checkbox } from "./checkbox"
import { cr } from "./primitive"
import { TouchTarget } from "./touch-target"

const treeStyles = tv({
base: "flex border max-h-96 min-w-72 [&::-webkit-scrollbar]:size-0.5 [scrollbar-width:thin] py-2 rounded-lg bg-bg cursor-default lg:text-sm flex-col overflow-auto forced-color-adjust-none outline-none",
Expand Down Expand Up @@ -90,9 +89,9 @@ const ItemContent = (props: React.ComponentProps<typeof TreeItemContent>) => {
const Indicator = () => {
return (
<Button className="shrink-0 relative" slot="chevron">
<TouchTarget>
<>
<IconChevronRight className="size-5" />
</TouchTarget>
</>
</Button>
)
}
Expand Down
3 changes: 0 additions & 3 deletions resources/content/docs/components/buttons/button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ A button lets peeps do stuff with clicks, presses, taps, and keystrokes.
## Installation
<Installation options={{isComponent: true}} items={['button']}/>

## Composed Components
<Composed components={['touch-target']}/>

## Manual Installation

<Installation options={{isManual: true}} items={['react-aria-components']}/>
Expand Down
3 changes: 0 additions & 3 deletions resources/content/docs/components/buttons/toggle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ A toggle button lets folks flip a choice on or off, like switching between two v
## Installation
<Installation options={{isComponent: true}} items={['toggle']}/>

## Composed Components
<Composed components={['touch-target']}/>

## Manual Installation
<Installation options={{isManual: true}} items={['react-aria-components']}/>

Expand Down
23 changes: 0 additions & 23 deletions resources/content/docs/components/buttons/touch-target.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion resources/content/docs/components/collections/tree.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A tree is a hierarchical list of items, allowing users to navigate through neste
<Installation options={{ isComponent: true }} items={['tree']}/>

## Composed Components
<Composed components={['checkbox', 'touch-target']}/>
<Composed components={['checkbox']}/>

## Manual Installation
<Installation options={{ isManual: true }} items={['react-aria-components', 'justd-icons']} />
Expand Down
2 changes: 2 additions & 0 deletions resources/content/docs/prologue/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ This all changes are made on the 2024 release.
- Remove border from Badge
- Remove light dan dark from Badge
- Fix color on Badge
- Touch Target is now removed from components since it's not needed anymore
- Table now have resize props [Table](/docs/components/collections/table)

## 10 October
- Sidebar now can be collapse [Aside](/docs/components/layouts/aside)
Expand Down

0 comments on commit c2c4364

Please sign in to comment.