From f88f0f23d7e58436707021d66b886288bfa019d8 Mon Sep 17 00:00:00 2001 From: supakornnetsuwan Date: Wed, 15 Oct 2025 10:19:14 +0700 Subject: [PATCH 1/7] migrate: `link` component --- .changeset/three-dogs-carry.md | 6 ++++++ .../views/login/login.client.tsx | 6 +++--- .../react/components/compound/collection-card.tsx | 6 +++--- .../react/components/primitives/breadcrumbs.tsx | 4 ++-- .../src/react/components/primitives/link.tsx | 15 +++++++++++---- packages/react/src/react/pages/401.tsx | 6 +++--- packages/react/src/react/pages/403.tsx | 6 +++--- packages/react/src/react/pages/404.tsx | 6 +++--- 8 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 .changeset/three-dogs-carry.md diff --git a/.changeset/three-dogs-carry.md b/.changeset/three-dogs-carry.md new file mode 100644 index 00000000..2068ef9a --- /dev/null +++ b/.changeset/three-dogs-carry.md @@ -0,0 +1,6 @@ +--- +'@genseki/react': patch +'@example/erp': patch +--- + +- Migrate `link` component diff --git a/packages/react/src/auth/plugins/email-and-password/views/login/login.client.tsx b/packages/react/src/auth/plugins/email-and-password/views/login/login.client.tsx index 0b76e1df..97ae66a2 100644 --- a/packages/react/src/auth/plugins/email-and-password/views/login/login.client.tsx +++ b/packages/react/src/auth/plugins/email-and-password/views/login/login.client.tsx @@ -15,7 +15,7 @@ import { FormItem, FormMessage, } from '../../../../../react/components/primitives/form' -import { Link } from '../../../../../react/components/primitives/link' +import { AriaLink } from '../../../../../react/components/primitives/link' import { AriaTextField } from '../../../../../react/components/primitives/text-field' import { useNavigation } from '../../../../../react/providers/navigation' import { useServerFunction } from '../../../../../react/providers/root' @@ -125,9 +125,9 @@ export function LoginClientForm() { )} /> - + Forgot Password? - + Login diff --git a/packages/react/src/react/components/compound/collection-card.tsx b/packages/react/src/react/components/compound/collection-card.tsx index 6b964879..9b1c427e 100644 --- a/packages/react/src/react/components/compound/collection-card.tsx +++ b/packages/react/src/react/components/compound/collection-card.tsx @@ -2,7 +2,7 @@ import { CaretRightIcon, CubeIcon, FolderIcon } from '@phosphor-icons/react/dist import { Badge } from '../../icons/badge' import { BaseIcon } from '../primitives/base-icon' -import { Link } from '../primitives/link' +import { AriaLink } from '../primitives/link' import { Typography } from '../primitives/typography' interface CollectionCardProps { @@ -51,7 +51,7 @@ export const CollectionCard = ({ {description} - @@ -64,7 +64,7 @@ export const CollectionCard = ({ weight="regular" className="transition-transform group-hover:translate-x-2" /> - + ) } diff --git a/packages/react/src/react/components/primitives/breadcrumbs.tsx b/packages/react/src/react/components/primitives/breadcrumbs.tsx index 50b5a425..4ff25216 100644 --- a/packages/react/src/react/components/primitives/breadcrumbs.tsx +++ b/packages/react/src/react/components/primitives/breadcrumbs.tsx @@ -6,7 +6,7 @@ import { Breadcrumb, Breadcrumbs as BreadcrumbsPrimitive } from 'react-aria-comp import { IconChevronLgRight } from '@intentui/icons' import { twMerge } from 'tailwind-merge' -import { Link } from './link' +import { AriaLink } from './link' import { composeTailwindRenderProps } from './primitive' interface BreadcrumbsContextProps { @@ -54,7 +54,7 @@ const BreadcrumbsItem = ({ > {({ isCurrent }) => ( <> - + {trailing} {!isCurrent && separator !== false && } diff --git a/packages/react/src/react/components/primitives/link.tsx b/packages/react/src/react/components/primitives/link.tsx index 2012b709..ec29eae5 100644 --- a/packages/react/src/react/components/primitives/link.tsx +++ b/packages/react/src/react/components/primitives/link.tsx @@ -6,12 +6,19 @@ import { twJoin } from 'tailwind-merge' import { composeTailwindRenderProps } from './primitive' -interface LinkProps extends LinkPrimitiveProps { +/** + * @deprecated + */ +interface AriaLinkProps extends LinkPrimitiveProps { intent?: 'primary' | 'secondary' | 'unstyled' ref?: React.RefObject } -const Link = ({ className, ref, intent = 'unstyled', ...props }: LinkProps) => { +/** + * @deprecated + * Use anchor tag instead + */ +const AriaLink = ({ className, ref, intent = 'unstyled', ...props }: AriaLinkProps) => { return ( { ) } -export type { LinkProps } -export { Link } +export type { AriaLinkProps } +export { AriaLink } diff --git a/packages/react/src/react/pages/401.tsx b/packages/react/src/react/pages/401.tsx index e1ed848a..d20c4c8f 100644 --- a/packages/react/src/react/pages/401.tsx +++ b/packages/react/src/react/pages/401.tsx @@ -2,7 +2,7 @@ import React from 'react' import { ArrowLeftIcon } from '@phosphor-icons/react/dist/ssr' -import { Link } from '../components' +import { AriaLink } from '../components' import { BaseIcon } from '../components/primitives/base-icon' import { Typography } from '../components/primitives/typography' @@ -45,10 +45,10 @@ export const NotAuthorizedPage = ({ {description}
- + {redirectSentence} - +
) } diff --git a/packages/react/src/react/pages/403.tsx b/packages/react/src/react/pages/403.tsx index cb9f1b09..ba0de1a3 100644 --- a/packages/react/src/react/pages/403.tsx +++ b/packages/react/src/react/pages/403.tsx @@ -1,6 +1,6 @@ import { ArrowRightIcon, LockKeyIcon } from '@phosphor-icons/react/dist/ssr' -import { Link } from '../components' +import { AriaLink } from '../components' import { BaseIcon } from '../components/primitives/base-icon' import { Typography } from '../components/primitives/typography' @@ -22,10 +22,10 @@ export const UnauthorizedPage = () => { You are not authorized to access this page. Please check your permission and try again.
- + Back to home - +
) } diff --git a/packages/react/src/react/pages/404.tsx b/packages/react/src/react/pages/404.tsx index c5450b5e..f1d57c24 100644 --- a/packages/react/src/react/pages/404.tsx +++ b/packages/react/src/react/pages/404.tsx @@ -2,7 +2,7 @@ import React from 'react' import { ArrowLeftIcon } from '@phosphor-icons/react/dist/ssr' -import { Link } from '../components' +import { AriaLink } from '../components' import { BaseIcon } from '../components/primitives/base-icon' import { Typography } from '../components/primitives/typography' @@ -45,10 +45,10 @@ export const NotfoundPage = ({ {description}
- + {redirectSentence} - +
) } From c9db707123350c64d75c22a7c67bc12343d0ecfd Mon Sep 17 00:00:00 2001 From: supakornnetsuwan Date: Wed, 15 Oct 2025 10:27:43 +0700 Subject: [PATCH 2/7] fix: incorrect imported component --- examples/ui-playground/src/app/playground/page.tsx | 6 +++--- examples/ui-playground/src/app/playground/shadcn/page.tsx | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/ui-playground/src/app/playground/page.tsx b/examples/ui-playground/src/app/playground/page.tsx index 1b2cd894..699b0740 100644 --- a/examples/ui-playground/src/app/playground/page.tsx +++ b/examples/ui-playground/src/app/playground/page.tsx @@ -27,6 +27,7 @@ import { AriaButton, AriaButtonGroup, AriaButtonGroupItem, + AriaLink, AriaModal, AriaModalBody, AriaModalClose, @@ -50,7 +51,6 @@ import { Breadcrumbs, BreadcrumbsItem, Card, - Link, PageSizeSelect, Pagination, ProgressBar, @@ -772,9 +772,9 @@ export default function UIPlayground() { />
Remember me - + Forgot password? - +
Date: Wed, 15 Oct 2025 14:25:02 +0700 Subject: [PATCH 3/7] fix: `color-tokens`, `button` variants --- .../app/playground/shadcn/button-section.tsx | 52 +++++++-- .../playground/shadcn/combobox-section.tsx | 2 +- .../app/playground/shadcn/input-section.tsx | 2 +- .../react/components/primitives/button.tsx | 21 ++-- .../react/components/primitives/combobox.tsx | 5 +- packages/react/src/react/styles/tailwind.css | 110 ++++++++---------- 6 files changed, 108 insertions(+), 84 deletions(-) diff --git a/examples/ui-playground/src/app/playground/shadcn/button-section.tsx b/examples/ui-playground/src/app/playground/shadcn/button-section.tsx index 30ed4ed0..79b7957a 100644 --- a/examples/ui-playground/src/app/playground/shadcn/button-section.tsx +++ b/examples/ui-playground/src/app/playground/shadcn/button-section.tsx @@ -28,13 +28,43 @@ import { PlaygroundCard } from '~/src/components/card' // Basic Button Variants function ButtonVariants() { return ( -
- - - - - - +
+
+ + + + + + + + +
+
+ + + + + + + + +
) } @@ -137,7 +167,9 @@ function ButtonGroupBasic() { return ( + + ) @@ -229,12 +261,10 @@ function ButtonGroupVariants() { return (
- + + - - - diff --git a/examples/ui-playground/src/app/playground/shadcn/combobox-section.tsx b/examples/ui-playground/src/app/playground/shadcn/combobox-section.tsx index ee2a6aca..ea1b3175 100644 --- a/examples/ui-playground/src/app/playground/shadcn/combobox-section.tsx +++ b/examples/ui-playground/src/app/playground/shadcn/combobox-section.tsx @@ -256,7 +256,7 @@ function CustomTriggerComboboxSingle() { {(selectedItem) => ( - -
-
) diff --git a/examples/ui-playground/src/app/playground/shadcn/link-section.tsx b/examples/ui-playground/src/app/playground/shadcn/link-section.tsx new file mode 100644 index 00000000..0614c4d6 --- /dev/null +++ b/examples/ui-playground/src/app/playground/shadcn/link-section.tsx @@ -0,0 +1,27 @@ +import React from 'react' + +import Link from 'next/link' + +import { Typography } from '@genseki/react' + +import { PlaygroundCard } from '../../../components/card' + +export const LinkSection = () => { + return ( +
+ + + A simple Link component examples + +
+ + Link + +
+
+
+ ) +} diff --git a/examples/ui-playground/src/app/playground/shadcn/page.tsx b/examples/ui-playground/src/app/playground/shadcn/page.tsx index c819144c..27dcfeb3 100644 --- a/examples/ui-playground/src/app/playground/shadcn/page.tsx +++ b/examples/ui-playground/src/app/playground/shadcn/page.tsx @@ -8,6 +8,7 @@ import { Typography } from '@genseki/react' import { ButtonSection } from './button-section' import { ComboboxSection } from './combobox-section' import { InputSection } from './input-section' +import { LinkSection } from './link-section' export default function ComboboxPage() { return ( @@ -31,6 +32,11 @@ export default function ComboboxPage() { Input + + + Link + +
@@ -40,6 +46,8 @@ export default function ComboboxPage() { {'>'} Combobox
{'>'} Input +
+ {'>'} Link
diff --git a/packages/react/src/react/components/primitives/button.tsx b/packages/react/src/react/components/primitives/button.tsx index 33047904..c60192c5 100644 --- a/packages/react/src/react/components/primitives/button.tsx +++ b/packages/react/src/react/components/primitives/button.tsx @@ -222,7 +222,6 @@ const buttonVariants = cva( ' bg-surface-button-ghost hover:bg-surface-button-ghost-hover active:bg-surface-button-ghost text-text-secondary hover:text-accent-foreground dark:hover:bg-accent/50', destructive: 'bg-destructive text-white hover:bg-destructive/90 active:bg-destructive focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60', - link: 'text-primary underline-offset-4 hover:underline hover:border-0', }, size: { default: 'h-18 px-8 py-4 has-[>svg]:px-6', From cdd7d0534f6e3fdea944c10429ebde9d08068464 Mon Sep 17 00:00:00 2001 From: supakornnetsuwan Date: Wed, 15 Oct 2025 14:59:22 +0700 Subject: [PATCH 5/7] fix: move `link` to `cva` variant --- .../app/playground/shadcn/link-section.tsx | 12 ++++++------ .../ui-playground/src/components/card.tsx | 5 ++--- .../src/react/components/primitives/link.tsx | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/examples/ui-playground/src/app/playground/shadcn/link-section.tsx b/examples/ui-playground/src/app/playground/shadcn/link-section.tsx index 0614c4d6..ade3be8d 100644 --- a/examples/ui-playground/src/app/playground/shadcn/link-section.tsx +++ b/examples/ui-playground/src/app/playground/shadcn/link-section.tsx @@ -2,7 +2,7 @@ import React from 'react' import Link from 'next/link' -import { Typography } from '@genseki/react' +import { linkVariants, Typography } from '@genseki/react' import { PlaygroundCard } from '../../../components/card' @@ -13,11 +13,11 @@ export const LinkSection = () => { A simple Link component examples -
- +
+ + Link + + Link
diff --git a/examples/ui-playground/src/components/card.tsx b/examples/ui-playground/src/components/card.tsx index 2a8c6f41..72fc9fd3 100644 --- a/examples/ui-playground/src/components/card.tsx +++ b/examples/ui-playground/src/components/card.tsx @@ -1,6 +1,5 @@ import { StarIcon } from '@phosphor-icons/react/dist/ssr' -import { BaseIcon } from '@genseki/react' import { Typography } from '@genseki/react' type PlaygroundCardProps = React.PropsWithChildren<{ @@ -14,11 +13,11 @@ export const PlaygroundCard = ({ children, }: PlaygroundCardProps) => { return ( -
+
- +
{categoryTitle} diff --git a/packages/react/src/react/components/primitives/link.tsx b/packages/react/src/react/components/primitives/link.tsx index ec29eae5..7422599e 100644 --- a/packages/react/src/react/components/primitives/link.tsx +++ b/packages/react/src/react/components/primitives/link.tsx @@ -2,6 +2,7 @@ import { Link as LinkPrimitive, type LinkProps as LinkPrimitiveProps } from 'react-aria-components' +import { cva } from 'class-variance-authority' import { twJoin } from 'tailwind-merge' import { composeTailwindRenderProps } from './primitive' @@ -43,3 +44,21 @@ const AriaLink = ({ className, ref, intent = 'unstyled', ...props }: AriaLinkPro export type { AriaLinkProps } export { AriaLink } + +export const linkVariants = cva('text-sm font-medium text-primary', { + variants: { + variant: { + plain: null, + underline: 'underline-offset-4 hover:underline hover:border-0', + }, + size: { + sm: 'text-sm', + md: 'text-base', + lg: 'text-lg', + }, + }, + defaultVariants: { + variant: 'underline', + size: 'sm', + }, +}) From ed6e8038ec2928f166fa4af373d9a7c096e2a9b5 Mon Sep 17 00:00:00 2001 From: supakornnetsuwan Date: Wed, 15 Oct 2025 15:10:27 +0700 Subject: [PATCH 6/7] feat: make multi value combobox item removable from chip press --- .../app/playground/shadcn/combobox-section.tsx | 2 +- .../src/react/components/primitives/combobox.tsx | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/examples/ui-playground/src/app/playground/shadcn/combobox-section.tsx b/examples/ui-playground/src/app/playground/shadcn/combobox-section.tsx index ea1b3175..8e33f641 100644 --- a/examples/ui-playground/src/app/playground/shadcn/combobox-section.tsx +++ b/examples/ui-playground/src/app/playground/shadcn/combobox-section.tsx @@ -292,7 +292,7 @@ export function ComboboxSection() {
- A simple combobox with default styling and behavior. + A simple combobox with default styling and mbehavior.
diff --git a/packages/react/src/react/components/primitives/combobox.tsx b/packages/react/src/react/components/primitives/combobox.tsx index 677e1e4d..24840f9e 100644 --- a/packages/react/src/react/components/primitives/combobox.tsx +++ b/packages/react/src/react/components/primitives/combobox.tsx @@ -9,6 +9,7 @@ import { MagnifyingGlassIcon, SpinnerIcon, XCircleIcon, + XIcon, } from '@phosphor-icons/react' import { useControllableState } from '@radix-ui/react-use-controllable-state' import { tv } from 'tailwind-variants' @@ -533,8 +534,20 @@ function ComboboxTriggerMultiValue(props: { return ( {selectedItems.map((selectedItem) => ( - + { + e.stopPropagation() + ctx.onValueChange((prevItems) => + prevItems.filter((prevItem) => prevItem !== selectedItem.value) + ) + }} + shape="square" + intent="gray" + key={selectedItem.value} + className="flex " + > {selectedItem.label} + ))} From 01605e10086b3813540a4660ac12c37f99e33fad Mon Sep 17 00:00:00 2001 From: supakornnetsuwan Date: Wed, 15 Oct 2025 15:21:29 +0700 Subject: [PATCH 7/7] fix: remove `secondary` button variant shadow --- packages/react/src/react/components/primitives/button.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/src/react/components/primitives/button.tsx b/packages/react/src/react/components/primitives/button.tsx index c60192c5..43f2a1ba 100644 --- a/packages/react/src/react/components/primitives/button.tsx +++ b/packages/react/src/react/components/primitives/button.tsx @@ -211,7 +211,7 @@ const buttonVariants = cva( primary: ' bg-surface-button-primary shadow-[inset_0px_-12px_12px_-6px_var(--color-surface-button-primary-hover)] text-text-inverse hover:bg-surface-button-primary-hover active:bg-surface-button-primary disabled:bg-surface-button-primary-disabled disabled:shadow-none disabled:text-text-disabled disabled:border disabled:border-border-button-primary-disabled', secondary: - ' bg-surface-button-secondary ring-offset-0 text-text-brand hover:bg-surface-button-secondary-hover active:bg-surface-button-secondary disabled:bg-surface-button-secondary-disabled disabled:shadow-none disabled:text-text-disabled', + ' bg-surface-button-secondary text-text-brand hover:bg-surface-button-secondary-hover active:bg-surface-button-secondary disabled:bg-surface-button-secondary-disabled disabled:shadow-none disabled:text-text-disabled', tertiary: ' bg-surface-button-tertiary border border-border-button-tertiary text-text-brand hover:bg-surface-button-tertiary-hover active:bg-surface-button-tertiary hover:border-border-button-tertiary-hover disabled:bg-surface-button-tertiary-disabled disabled:border-border-button-tertiary-disabled disabled:text-text-disabled', naked: