fulldev-ui 0.25.2 → 0.25.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +4 -5
- package/liquid/assets/ui-manifest.json +4 -4
- package/liquid/assets/ui-typography.css +6 -0
- package/liquid/snippets/ui-alert.liquid +2 -1
- package/liquid/snippets/ui-badge.liquid +6 -0
- package/liquid/snippets/ui-button.liquid +8 -2
- package/package.json +10 -10
- package/public/r/liquid/alert.json +1 -1
- package/public/r/liquid/badge.json +1 -1
- package/public/r/liquid/button.json +1 -1
- package/public/r/liquid/components.json +1 -1
- package/public/r/liquid/typography.json +1 -1
- package/public/r/react/styles/base-luma/typography.json +1 -1
- package/public/r/react/styles/base-lyra/typography.json +1 -1
- package/public/r/react/styles/base-maia/typography.json +1 -1
- package/public/r/react/styles/base-mira/typography.json +1 -1
- package/public/r/react/styles/base-nova/typography.json +1 -1
- package/public/r/react/styles/base-rhea/typography.json +1 -1
- package/public/r/react/styles/base-sera/typography.json +1 -1
- package/public/r/react/styles/base-vega/typography.json +1 -1
- package/public/r/styles/base-luma/alert.json +1 -1
- package/public/r/styles/base-luma/attachment-examples.json +1 -1
- package/public/r/styles/base-luma/attachment.json +2 -2
- package/public/r/styles/base-luma/badge.json +1 -1
- package/public/r/styles/base-luma/button.json +1 -1
- package/public/r/styles/base-luma/typography.json +1 -1
- package/public/r/styles/base-lyra/alert.json +1 -1
- package/public/r/styles/base-lyra/attachment-examples.json +1 -1
- package/public/r/styles/base-lyra/attachment.json +2 -2
- package/public/r/styles/base-lyra/badge.json +1 -1
- package/public/r/styles/base-lyra/button.json +1 -1
- package/public/r/styles/base-lyra/typography.json +1 -1
- package/public/r/styles/base-maia/alert.json +1 -1
- package/public/r/styles/base-maia/attachment-examples.json +1 -1
- package/public/r/styles/base-maia/attachment.json +2 -2
- package/public/r/styles/base-maia/badge.json +1 -1
- package/public/r/styles/base-maia/button.json +1 -1
- package/public/r/styles/base-maia/typography.json +1 -1
- package/public/r/styles/base-mira/alert.json +1 -1
- package/public/r/styles/base-mira/attachment-examples.json +1 -1
- package/public/r/styles/base-mira/attachment.json +2 -2
- package/public/r/styles/base-mira/badge.json +1 -1
- package/public/r/styles/base-mira/button.json +1 -1
- package/public/r/styles/base-mira/typography.json +1 -1
- package/public/r/styles/base-nova/alert.json +1 -1
- package/public/r/styles/base-nova/attachment-examples.json +1 -1
- package/public/r/styles/base-nova/attachment.json +2 -2
- package/public/r/styles/base-nova/badge.json +1 -1
- package/public/r/styles/base-nova/button.json +1 -1
- package/public/r/styles/base-nova/typography.json +1 -1
- package/public/r/styles/base-rhea/alert.json +1 -1
- package/public/r/styles/base-rhea/attachment-examples.json +1 -1
- package/public/r/styles/base-rhea/attachment.json +2 -2
- package/public/r/styles/base-rhea/badge.json +1 -1
- package/public/r/styles/base-rhea/button.json +1 -1
- package/public/r/styles/base-rhea/typography.json +1 -1
- package/public/r/styles/base-sera/alert.json +1 -1
- package/public/r/styles/base-sera/attachment-examples.json +1 -1
- package/public/r/styles/base-sera/attachment.json +2 -2
- package/public/r/styles/base-sera/badge.json +1 -1
- package/public/r/styles/base-sera/button.json +1 -1
- package/public/r/styles/base-sera/typography.json +1 -1
- package/public/r/styles/base-vega/alert.json +1 -1
- package/public/r/styles/base-vega/attachment-examples.json +1 -1
- package/public/r/styles/base-vega/attachment.json +2 -2
- package/public/r/styles/base-vega/badge.json +1 -1
- package/public/r/styles/base-vega/button.json +1 -1
- package/public/r/styles/base-vega/typography.json +1 -1
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
{
|
|
12
12
|
"path": "src/components/ui/typography.tsx",
|
|
13
|
-
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n \"font-medium text-primary underline underline-offset-4\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded-none bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-none border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
13
|
+
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n // shadcn/ui's typography link uses text-primary, below 4.5:1 in dark\n // mode with most theme colors. There a lighter step of the primary\n // keeps 4.5:1, as in the Astro Button's link variant.\n \"font-medium text-(--fd-link,var(--primary)) underline underline-offset-4 dark:supports-[color:oklch(from_red_l_c_h)]:[--fd-link:oklch(from_var(--primary)_max(l,0.7)_calc(c*1.2)_h)]\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded-none bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-none border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
14
14
|
"type": "registry:ui"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
{
|
|
12
12
|
"path": "src/components/ui/typography.tsx",
|
|
13
|
-
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n \"font-medium text-primary underline underline-offset-4\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded-md bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-2xl border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
13
|
+
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n // shadcn/ui's typography link uses text-primary, below 4.5:1 in dark\n // mode with most theme colors. There a lighter step of the primary\n // keeps 4.5:1, as in the Astro Button's link variant.\n \"font-medium text-(--fd-link,var(--primary)) underline underline-offset-4 dark:supports-[color:oklch(from_red_l_c_h)]:[--fd-link:oklch(from_var(--primary)_max(l,0.7)_calc(c*1.2)_h)]\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded-md bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-2xl border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
14
14
|
"type": "registry:ui"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
{
|
|
12
12
|
"path": "src/components/ui/typography.tsx",
|
|
13
|
-
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n \"font-medium text-primary underline underline-offset-4\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-lg border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
13
|
+
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n // shadcn/ui's typography link uses text-primary, below 4.5:1 in dark\n // mode with most theme colors. There a lighter step of the primary\n // keeps 4.5:1, as in the Astro Button's link variant.\n \"font-medium text-(--fd-link,var(--primary)) underline underline-offset-4 dark:supports-[color:oklch(from_red_l_c_h)]:[--fd-link:oklch(from_var(--primary)_max(l,0.7)_calc(c*1.2)_h)]\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-lg border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
14
14
|
"type": "registry:ui"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
{
|
|
12
12
|
"path": "src/components/ui/typography.tsx",
|
|
13
|
-
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n \"font-medium text-primary underline underline-offset-4\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-xl border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
13
|
+
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n // shadcn/ui's typography link uses text-primary, below 4.5:1 in dark\n // mode with most theme colors. There a lighter step of the primary\n // keeps 4.5:1, as in the Astro Button's link variant.\n \"font-medium text-(--fd-link,var(--primary)) underline underline-offset-4 dark:supports-[color:oklch(from_red_l_c_h)]:[--fd-link:oklch(from_var(--primary)_max(l,0.7)_calc(c*1.2)_h)]\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-xl border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
14
14
|
"type": "registry:ui"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
{
|
|
12
12
|
"path": "src/components/ui/typography.tsx",
|
|
13
|
-
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n \"font-medium text-primary underline underline-offset-4\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded-md bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-2xl border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
13
|
+
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-medium tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n // shadcn/ui's typography link uses text-primary, below 4.5:1 in dark\n // mode with most theme colors. There a lighter step of the primary\n // keeps 4.5:1, as in the Astro Button's link variant.\n \"font-medium text-(--fd-link,var(--primary)) underline underline-offset-4 dark:supports-[color:oklch(from_red_l_c_h)]:[--fd-link:oklch(from_var(--primary)_max(l,0.7)_calc(c*1.2)_h)]\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded-md bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-2xl border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
14
14
|
"type": "registry:ui"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
{
|
|
12
12
|
"path": "src/components/ui/typography.tsx",
|
|
13
|
-
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-wider uppercase scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-wider uppercase scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n \"font-medium text-primary underline underline-offset-4\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded-none bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-none border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
13
|
+
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-wider uppercase scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-wider uppercase scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n // shadcn/ui's typography link uses text-primary, below 4.5:1 in dark\n // mode with most theme colors. There a lighter step of the primary\n // keeps 4.5:1, as in the Astro Button's link variant.\n \"font-medium text-(--fd-link,var(--primary)) underline underline-offset-4 dark:supports-[color:oklch(from_red_l_c_h)]:[--fd-link:oklch(from_var(--primary)_max(l,0.7)_calc(c*1.2)_h)]\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded-none bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-none border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
14
14
|
"type": "registry:ui"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
{
|
|
12
12
|
"path": "src/components/ui/typography.tsx",
|
|
13
|
-
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n \"font-medium text-primary underline underline-offset-4\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-xl border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
13
|
+
"content": "import * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cn } from \"cn\"\n\nimport \"./typeset.css\"\n\ntype TypographySize = \"sm\" | \"default\" | \"lg\"\n\nconst sizes = (sm: string, md: string, lg: string) => ({\n sm,\n default: md,\n lg,\n})\n\nfunction Typography({\n className,\n size = \"default\",\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & { size?: TypographySize }) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"typeset\",\n sizes(\n \"[--typeset-flow:1.125em] [--typeset-leading:1.7] [--typeset-size:0.875rem]\",\n \"[--typeset-flow:1.25em] [--typeset-leading:1.75] [--typeset-size:1rem]\",\n \"[--typeset-flow:1.5em] [--typeset-leading:1.8] [--typeset-size:1.125rem]\"\n )[size],\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"typography\",\n size,\n },\n })\n}\n\nconst typographyH1Sizes = sizes(\"text-3xl\", \"text-4xl\", \"text-5xl\")\n\nfunction TypographyH1({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h1\"> & { size?: TypographySize }) {\n return (\n <h1\n data-slot=\"typography-h1\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading text-balance\",\n typographyH1Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH2Sizes = sizes(\"text-2xl\", \"text-3xl\", \"text-4xl\")\n\nfunction TypographyH2({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h2\"> & { size?: TypographySize }) {\n return (\n <h2\n data-slot=\"typography-h2\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading first:mt-0\",\n typographyH2Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH3Sizes = sizes(\"text-xl\", \"text-2xl\", \"text-3xl\")\n\nfunction TypographyH3({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h3\"> & { size?: TypographySize }) {\n return (\n <h3\n data-slot=\"typography-h3\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading\",\n typographyH3Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyH4Sizes = sizes(\"text-lg\", \"text-xl\", \"text-2xl\")\n\nfunction TypographyH4({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"h4\"> & { size?: TypographySize }) {\n return (\n <h4\n data-slot=\"typography-h4\"\n data-size={size}\n className={cn(\n \"font-semibold tracking-tight scroll-m-20 font-heading\",\n typographyH4Sizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyPSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyP({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-p\"\n data-size={size}\n className={cn(\n \"leading-7 [&:not(:first-child)]:mt-6\",\n typographyPSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyLeadSizes = sizes(\"text-base\", \"text-lg\", \"text-xl\")\n\nfunction TypographyLead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"p\"> & { size?: TypographySize }) {\n return (\n <p\n data-slot=\"typography-lead\"\n data-size={size}\n className={cn(\n \"text-muted-foreground\",\n typographyLeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyASizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyA({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"a\"> & { size?: TypographySize }) {\n return (\n <a\n data-slot=\"typography-a\"\n data-size={size}\n className={cn(\n // shadcn/ui's typography link uses text-primary, below 4.5:1 in dark\n // mode with most theme colors. There a lighter step of the primary\n // keeps 4.5:1, as in the Astro Button's link variant.\n \"font-medium text-(--fd-link,var(--primary)) underline underline-offset-4 dark:supports-[color:oklch(from_red_l_c_h)]:[--fd-link:oklch(from_var(--primary)_max(l,0.7)_calc(c*1.2)_h)]\",\n typographyASizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyBlockquoteSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyBlockquote({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"blockquote\"> & { size?: TypographySize }) {\n return (\n <blockquote\n data-slot=\"typography-blockquote\"\n data-size={size}\n className={cn(\n \"mt-6 border-s-2 ps-6 italic\",\n typographyBlockquoteSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyInlineCodeSizes = sizes(\"text-xs\", \"text-sm\", \"text-base\")\n\nfunction TypographyInlineCode({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"code\"> & { size?: TypographySize }) {\n return (\n <code\n data-slot=\"typography-inline-code\"\n data-size={size}\n className={cn(\n \"rounded bg-muted font-mono font-semibold relative px-[0.3rem] py-[0.2rem]\",\n typographyInlineCodeSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListItemSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyListItem({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"li\"> & { size?: TypographySize }) {\n return (\n <li\n data-slot=\"typography-list-item\"\n data-size={size}\n className={cn(\"mt-2\", typographyListItemSizes[size], className)}\n {...props}\n />\n )\n}\n\nconst typographyTableRowSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableRow({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"tr\"> & { size?: TypographySize }) {\n return (\n <tr\n data-slot=\"typography-table-row\"\n data-size={size}\n className={cn(\n \"m-0 border-t p-0 even:bg-muted\",\n typographyTableRowSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableHeadSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableHead({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"th\"> & { size?: TypographySize }) {\n return (\n <th\n data-slot=\"typography-table-head\"\n data-size={size}\n className={cn(\n \"border-b border-border px-4 py-3 text-start font-semibold [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableHeadSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableCellSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTableCell({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"td\"> & { size?: TypographySize }) {\n return (\n <td\n data-slot=\"typography-table-cell\"\n data-size={size}\n className={cn(\n \"border-t border-border px-4 py-3 text-start align-middle [&[align=center]]:text-center [&[align=left]]:text-left [&[align=right]]:text-right\",\n typographyTableCellSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyListSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\n// The list type changes its markers, so it is a prop instead of a render.\nfunction TypographyList({\n className,\n as = \"ul\",\n size = \"default\",\n ...props\n}: React.ComponentProps<\"ol\"> & {\n as?: \"ul\" | \"ol\"\n size?: TypographySize\n}) {\n // A <ul> takes the attributes of an <ol> except start and reversed.\n const Tag = as as \"ol\"\n return (\n <Tag\n data-slot=\"typography-list\"\n data-size={size}\n data-ordered={as === \"ol\" ? \"\" : undefined}\n className={cn(\n \"my-6 ms-6\",\n as === \"ol\" ? \"list-decimal\" : \"list-disc\",\n typographyListSizes[size],\n className\n )}\n {...props}\n />\n )\n}\n\nconst typographyTableSizes = sizes(\"text-sm\", \"text-base\", \"text-lg\")\n\nfunction TypographyTable({\n className,\n containerClassName,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"table\"> & {\n containerClassName?: string\n size?: TypographySize\n}) {\n return (\n <div\n data-slot=\"typography-table-container\"\n data-size={size}\n className={cn(\n \"rounded-xl border border-border my-6 w-full overflow-x-auto\",\n containerClassName\n )}\n >\n <table\n data-slot=\"typography-table\"\n data-size={size}\n className={cn(\n \"w-full border-collapse\",\n typographyTableSizes[size],\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nexport {\n Typography,\n TypographyA,\n TypographyBlockquote,\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyInlineCode,\n TypographyLead,\n TypographyList,\n TypographyListItem,\n TypographyP,\n TypographyTable,\n TypographyTableCell,\n TypographyTableHead,\n TypographyTableRow,\n}\n",
|
|
14
14
|
"type": "registry:ui"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"files": [
|
|
7
7
|
{
|
|
8
8
|
"path": "src/components/ui/alert/alert.astro",
|
|
9
|
-
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = VariantProps<typeof variants> & HTMLAttributes<\"div\">\n\nconst variants = cva(\"grid gap-0.5 rounded-2xl border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 group/alert relative w-full\", {\n variants: {\n variant: {\n default: \"bg-card text-card-foreground\",\n destructive: \"text-destructive bg-card *:data-[slot=alert-description]:text-destructive
|
|
9
|
+
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = VariantProps<typeof variants> & HTMLAttributes<\"div\">\n\nconst variants = cva(\"grid gap-0.5 rounded-2xl border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 group/alert relative w-full\", {\n variants: {\n variant: {\n default: \"bg-card text-card-foreground\",\n // shadcn/ui shows the description at text-destructive/90. Like its\n // FieldError, this uses the full destructive color, for 4.5:1 contrast.\n destructive: \"text-destructive bg-card *:data-[slot=alert-description]:text-destructive *:[svg]:text-current\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n})\n\nconst { class: className, variant, ...props } = Astro.props\n---\n\n<div\n data-slot=\"alert\"\n role=\"alert\"\n class={cn(variants({ variant }), className)}\n {...props}\n>\n <slot />\n</div>\n",
|
|
10
10
|
"type": "registry:ui"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
{
|
|
16
16
|
"path": "src/components/examples/attachment/attachment-demo.astro",
|
|
17
|
-
"content": "---\nimport FileCodeIcon from \"@lucide/astro/icons/file-code\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport {\n Attachment,\n AttachmentAction,\n AttachmentActions,\n AttachmentContent,\n AttachmentDescription,\n AttachmentGroup,\n AttachmentMedia,\n AttachmentTitle,\n} from \"@/components/ui/attachment\"\nimport { Spinner } from \"@/components/ui/spinner\"\n\nconst images = [\n {\n name: \"workspace.png\",\n meta: \"PNG · 820 KB\",\n src: \"https://images.unsplash.com/photo-1497366754035-f200968a6e72?w=900&auto=format&fit=crop&q=80\",\n alt: \"Workspace\",\n },\n {\n name: \"desk-reference.jpg\",\n meta: \"JPG · 1.1 MB\",\n src: \"https://images.unsplash.com/photo-1497215728101-856f4ea42174?w=900&auto=format&fit=crop&q=80\",\n alt: \"Desk\",\n },\n {\n name: \"office-reference.jpg\",\n meta: \"JPG · 940 KB\",\n src: \"https://images.unsplash.com/photo-1497366811353-6870744d04b2?w=900&auto=format&fit=crop&q=80\",\n alt: \"Office\",\n },\n]\n---\n\n<div class=\"mx-auto flex w-full max-w-sm flex-col gap-3 py-12\">\n <AttachmentGroup>\n {images.map((image) => (\n <Attachment orientation=\"vertical\">\n <AttachmentMedia variant=\"image\">\n <img src={image.src} alt={image.alt} />\n </AttachmentMedia>\n <AttachmentContent>\n <AttachmentTitle>{image.name}</AttachmentTitle>\n <AttachmentDescription>{image.meta}</AttachmentDescription>\n </AttachmentContent>\n </Attachment>\n ))}\n </AttachmentGroup>\n <Attachment state=\"uploading\" class=\"w-full\">\n <AttachmentMedia>\n <Spinner />\n </AttachmentMedia>\n <AttachmentContent>\n <AttachmentTitle>sales-dashboard.pdf</AttachmentTitle>\n <AttachmentDescription>Uploading · 64%</AttachmentDescription>\n </AttachmentContent>\n <AttachmentActions>\n <AttachmentAction aria-label=\"Cancel upload\">\n <XIcon />\n </AttachmentAction>\n </AttachmentActions>\n </Attachment>\n <Attachment class=\"w-full\">\n <AttachmentMedia>\n <FileCodeIcon />\n </AttachmentMedia>\n <AttachmentContent>\n <AttachmentTitle>message-renderer.tsx</AttachmentTitle>\n <AttachmentDescription>TypeScript · 12 KB</AttachmentDescription>\n </AttachmentContent>\n <AttachmentActions>\n <AttachmentAction aria-label=\"Remove message-renderer.tsx\">\n <XIcon />\n </AttachmentAction>\n </AttachmentActions>\n </Attachment>\n</div>\n",
|
|
17
|
+
"content": "---\nimport FileCodeIcon from \"@lucide/astro/icons/file-code\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport {\n Attachment,\n AttachmentAction,\n AttachmentActions,\n AttachmentContent,\n AttachmentDescription,\n AttachmentGroup,\n AttachmentMedia,\n AttachmentTitle,\n} from \"@/components/ui/attachment\"\nimport { Spinner } from \"@/components/ui/spinner\"\n\nconst images = [\n {\n name: \"workspace.png\",\n meta: \"PNG · 820 KB\",\n src: \"https://images.unsplash.com/photo-1497366754035-f200968a6e72?w=900&auto=format&fit=crop&q=80\",\n alt: \"Workspace\",\n },\n {\n name: \"desk-reference.jpg\",\n meta: \"JPG · 1.1 MB\",\n src: \"https://images.unsplash.com/photo-1497215728101-856f4ea42174?w=900&auto=format&fit=crop&q=80\",\n alt: \"Desk\",\n },\n {\n name: \"office-reference.jpg\",\n meta: \"JPG · 940 KB\",\n src: \"https://images.unsplash.com/photo-1497366811353-6870744d04b2?w=900&auto=format&fit=crop&q=80\",\n alt: \"Office\",\n },\n]\n---\n\n<div class=\"mx-auto flex w-full max-w-sm flex-col gap-3 py-12\">\n {/* Unlike shadcn/ui's demo, the group takes focus: its attachments have no\n controls, so a keyboard could not scroll it otherwise. */}\n <AttachmentGroup tabindex=\"0\">\n {images.map((image) => (\n <Attachment orientation=\"vertical\">\n <AttachmentMedia variant=\"image\">\n <img src={image.src} alt={image.alt} />\n </AttachmentMedia>\n <AttachmentContent>\n <AttachmentTitle>{image.name}</AttachmentTitle>\n <AttachmentDescription>{image.meta}</AttachmentDescription>\n </AttachmentContent>\n </Attachment>\n ))}\n </AttachmentGroup>\n <Attachment state=\"uploading\" class=\"w-full\">\n <AttachmentMedia>\n <Spinner />\n </AttachmentMedia>\n <AttachmentContent>\n <AttachmentTitle>sales-dashboard.pdf</AttachmentTitle>\n <AttachmentDescription>Uploading · 64%</AttachmentDescription>\n </AttachmentContent>\n <AttachmentActions>\n <AttachmentAction aria-label=\"Cancel upload\">\n <XIcon />\n </AttachmentAction>\n </AttachmentActions>\n </Attachment>\n <Attachment class=\"w-full\">\n <AttachmentMedia>\n <FileCodeIcon />\n </AttachmentMedia>\n <AttachmentContent>\n <AttachmentTitle>message-renderer.tsx</AttachmentTitle>\n <AttachmentDescription>TypeScript · 12 KB</AttachmentDescription>\n </AttachmentContent>\n <AttachmentActions>\n <AttachmentAction aria-label=\"Remove message-renderer.tsx\">\n <XIcon />\n </AttachmentAction>\n </AttachmentActions>\n </Attachment>\n</div>\n",
|
|
18
18
|
"type": "registry:component"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"path": "src/components/ui/attachment/attachment-description.astro",
|
|
27
|
-
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = HTMLAttributes<\"span\">\n\nconst { class: className, ...props } = Astro.props\n---\n\n<span\n data-slot=\"attachment-description\"\n class={cn(\n \"mt-0.5 text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive
|
|
27
|
+
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = HTMLAttributes<\"span\">\n\nconst { class: className, ...props } = Astro.props\n// shadcn/ui uses text-destructive/80 for the error description. Like its\n// FieldError, this uses the full destructive color, so the small text keeps a\n// 4.5:1 contrast.\n---\n\n<span\n data-slot=\"attachment-description\"\n class={cn(\n \"mt-0.5 text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive block max-w-full min-w-0 truncate\",\n className\n )}\n {...props}\n>\n <slot />\n</span>\n",
|
|
28
28
|
"type": "registry:ui"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
"path": "src/components/ui/attachment/attachment-title.astro",
|
|
42
|
-
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = HTMLAttributes<\"span\">\n\nconst { class: className, ...props } = Astro.props\n---\n\n<span\n data-slot=\"attachment-title\"\n class={cn(\n \"font-medium block max-w-full min-w-0 truncate group-data-[state=processing]/attachment:
|
|
42
|
+
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = HTMLAttributes<\"span\">\n\nconst { class: className, ...props } = Astro.props\n---\n\n<span\n data-slot=\"attachment-title\"\n class={cn(\n \"font-medium block max-w-full min-w-0 truncate group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer\",\n className\n )}\n {...props}\n>\n <slot />\n</span>\n",
|
|
43
43
|
"type": "registry:ui"
|
|
44
44
|
},
|
|
45
45
|
{
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"files": [
|
|
7
7
|
{
|
|
8
8
|
"path": "src/components/ui/badge/badge-variants.ts",
|
|
9
|
-
"content": "import { cva, type VariantProps } from \"class-variance-authority\"\n\nexport const badgeVariants = cva(\n \"h-5 gap-1 rounded-3xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground [a]:hover:bg-primary/80\",\n secondary: \"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80\",\n destructive: \"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20\",\n outline: \"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground\",\n ghost: \"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nexport type BadgeVariantProps = VariantProps<typeof badgeVariants>\n",
|
|
9
|
+
"content": "import { cva, type VariantProps } from \"class-variance-authority\"\n\nexport const badgeVariants = cva(\n \"h-5 gap-1 rounded-3xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground [a]:hover:bg-primary/80\",\n secondary: \"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80\",\n destructive: \"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20\",\n outline: \"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground\",\n ghost: \"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50\",\n // shadcn/ui uses text-primary, below 4.5:1 in dark mode with most theme\n // colors. A lighter step of the primary keeps 4.5:1 there.\n link: \"text-(--fd-link,var(--primary)) dark:supports-[color:oklch(from_red_l_c_h)]:[--fd-link:oklch(from_var(--primary)_max(l,0.7)_calc(c*1.2)_h)] underline-offset-4 hover:underline\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nexport type BadgeVariantProps = VariantProps<typeof badgeVariants>\n",
|
|
10
10
|
"type": "registry:ui"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"files": [
|
|
7
7
|
{
|
|
8
8
|
"path": "src/components/ui/button/button-variants.ts",
|
|
9
|
-
"content": "import { cva, type VariantProps } from \"class-variance-authority\"\n\nexport const buttonVariants = cva(\n \"focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-4xl border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 active:not-aria-[haspopup]:translate-y-px [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n outline: \"border-border bg-background dark:bg-transparent hover:bg-muted hover:text-foreground dark:hover:bg-input/30 aria-expanded:bg-muted aria-expanded:text-foreground\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n ghost: \"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground\",\n destructive: \"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5\",\n xs: \"h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3\",\n sm: \"h-8 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n lg: \"h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3\",\n icon: \"size-9\",\n \"icon-xs\": \"size-6 [&_svg:not([class*='size-'])]:size-3\",\n \"icon-sm\": \"size-8\",\n \"icon-lg\": \"size-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nexport type ButtonVariantProps = VariantProps<typeof buttonVariants>\n",
|
|
9
|
+
"content": "import { cva, type VariantProps } from \"class-variance-authority\"\n\nexport const buttonVariants = cva(\n \"focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-4xl border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 active:not-aria-[haspopup]:translate-y-px [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n outline: \"border-border bg-background dark:bg-transparent hover:bg-muted hover:text-foreground dark:hover:bg-input/30 aria-expanded:bg-muted aria-expanded:text-foreground\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n ghost: \"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground\",\n // shadcn/ui uses text-destructive, about 4:1 on the button's tint.\n // Mixing in a fifth of the foreground keeps 4.5:1, as the native Liquid\n // button does.\n destructive: \"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-[color-mix(in_oklab,var(--destructive)_80%,var(--foreground))] focus-visible:border-destructive/40 dark:hover:bg-destructive/30\",\n // shadcn/ui uses text-primary, below 4.5:1 in dark mode with most theme\n // colors. A lighter step of the primary keeps 4.5:1 there.\n link: \"text-(--fd-link,var(--primary)) dark:supports-[color:oklch(from_red_l_c_h)]:[--fd-link:oklch(from_var(--primary)_max(l,0.7)_calc(c*1.2)_h)] underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5\",\n xs: \"h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3\",\n sm: \"h-8 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n lg: \"h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3\",\n icon: \"size-9\",\n \"icon-xs\": \"size-6 [&_svg:not([class*='size-'])]:size-3\",\n \"icon-sm\": \"size-8\",\n \"icon-lg\": \"size-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nexport type ButtonVariantProps = VariantProps<typeof buttonVariants>\n",
|
|
10
10
|
"type": "registry:ui"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"path": "src/components/ui/typography/typography-a.astro",
|
|
14
|
-
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Size = \"sm\" | \"default\" | \"lg\"\ntype Props = HTMLAttributes<\"a\"> & {\n size?: Size\n}\n\nconst { class: className, size = \"default\", ...props } = Astro.props\n\nconst sizeClass =\n size === \"sm\" ? \"text-sm\" : size === \"lg\" ? \"text-lg\" : \"text-base\"\n---\n\n<a\n data-slot=\"typography-a\"\n data-size={size}\n class={cn(\n \"text-primary font-medium underline underline-offset-4\",\n sizeClass,\n className\n )}\n {...props}\n>\n <slot />\n</a>\n",
|
|
14
|
+
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Size = \"sm\" | \"default\" | \"lg\"\ntype Props = HTMLAttributes<\"a\"> & {\n size?: Size\n}\n\nconst { class: className, size = \"default\", ...props } = Astro.props\n\nconst sizeClass =\n size === \"sm\" ? \"text-sm\" : size === \"lg\" ? \"text-lg\" : \"text-base\"\n// shadcn/ui's typography link uses text-primary, below 4.5:1 in dark mode with\n// most theme colors. There a lighter step of the primary keeps 4.5:1, as in\n// Button's link variant.\n---\n\n<a\n data-slot=\"typography-a\"\n data-size={size}\n class={cn(\n \"text-(--fd-link,var(--primary)) font-medium underline underline-offset-4 dark:supports-[color:oklch(from_red_l_c_h)]:[--fd-link:oklch(from_var(--primary)_max(l,0.7)_calc(c*1.2)_h)]\",\n sizeClass,\n className\n )}\n {...props}\n>\n <slot />\n</a>\n",
|
|
15
15
|
"type": "registry:ui"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"files": [
|
|
7
7
|
{
|
|
8
8
|
"path": "src/components/ui/alert/alert.astro",
|
|
9
|
-
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = VariantProps<typeof variants> & HTMLAttributes<\"div\">\n\nconst variants = cva(\"grid gap-0.5 rounded-none border px-2.5 py-2 text-left text-xs has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 group/alert relative w-full\", {\n variants: {\n variant: {\n default: \"bg-card text-card-foreground\",\n destructive: \"text-destructive bg-card *:data-[slot=alert-description]:text-destructive
|
|
9
|
+
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype Props = VariantProps<typeof variants> & HTMLAttributes<\"div\">\n\nconst variants = cva(\"grid gap-0.5 rounded-none border px-2.5 py-2 text-left text-xs has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 group/alert relative w-full\", {\n variants: {\n variant: {\n default: \"bg-card text-card-foreground\",\n // shadcn/ui shows the description at text-destructive/90. Like its\n // FieldError, this uses the full destructive color, for 4.5:1 contrast.\n destructive: \"text-destructive bg-card *:data-[slot=alert-description]:text-destructive *:[svg]:text-current\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n})\n\nconst { class: className, variant, ...props } = Astro.props\n---\n\n<div\n data-slot=\"alert\"\n role=\"alert\"\n class={cn(variants({ variant }), className)}\n {...props}\n>\n <slot />\n</div>\n",
|
|
10
10
|
"type": "registry:ui"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
{
|
|
16
16
|
"path": "src/components/examples/attachment/attachment-demo.astro",
|
|
17
|
-
"content": "---\nimport FileCodeIcon from \"@lucide/astro/icons/file-code\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport {\n Attachment,\n AttachmentAction,\n AttachmentActions,\n AttachmentContent,\n AttachmentDescription,\n AttachmentGroup,\n AttachmentMedia,\n AttachmentTitle,\n} from \"@/components/ui/attachment\"\nimport { Spinner } from \"@/components/ui/spinner\"\n\nconst images = [\n {\n name: \"workspace.png\",\n meta: \"PNG · 820 KB\",\n src: \"https://images.unsplash.com/photo-1497366754035-f200968a6e72?w=900&auto=format&fit=crop&q=80\",\n alt: \"Workspace\",\n },\n {\n name: \"desk-reference.jpg\",\n meta: \"JPG · 1.1 MB\",\n src: \"https://images.unsplash.com/photo-1497215728101-856f4ea42174?w=900&auto=format&fit=crop&q=80\",\n alt: \"Desk\",\n },\n {\n name: \"office-reference.jpg\",\n meta: \"JPG · 940 KB\",\n src: \"https://images.unsplash.com/photo-1497366811353-6870744d04b2?w=900&auto=format&fit=crop&q=80\",\n alt: \"Office\",\n },\n]\n---\n\n<div class=\"mx-auto flex w-full max-w-sm flex-col gap-3 py-12\">\n <AttachmentGroup>\n {images.map((image) => (\n <Attachment orientation=\"vertical\">\n <AttachmentMedia variant=\"image\">\n <img src={image.src} alt={image.alt} />\n </AttachmentMedia>\n <AttachmentContent>\n <AttachmentTitle>{image.name}</AttachmentTitle>\n <AttachmentDescription>{image.meta}</AttachmentDescription>\n </AttachmentContent>\n </Attachment>\n ))}\n </AttachmentGroup>\n <Attachment state=\"uploading\" class=\"w-full\">\n <AttachmentMedia>\n <Spinner />\n </AttachmentMedia>\n <AttachmentContent>\n <AttachmentTitle>sales-dashboard.pdf</AttachmentTitle>\n <AttachmentDescription>Uploading · 64%</AttachmentDescription>\n </AttachmentContent>\n <AttachmentActions>\n <AttachmentAction aria-label=\"Cancel upload\">\n <XIcon />\n </AttachmentAction>\n </AttachmentActions>\n </Attachment>\n <Attachment class=\"w-full\">\n <AttachmentMedia>\n <FileCodeIcon />\n </AttachmentMedia>\n <AttachmentContent>\n <AttachmentTitle>message-renderer.tsx</AttachmentTitle>\n <AttachmentDescription>TypeScript · 12 KB</AttachmentDescription>\n </AttachmentContent>\n <AttachmentActions>\n <AttachmentAction aria-label=\"Remove message-renderer.tsx\">\n <XIcon />\n </AttachmentAction>\n </AttachmentActions>\n </Attachment>\n</div>\n",
|
|
17
|
+
"content": "---\nimport FileCodeIcon from \"@lucide/astro/icons/file-code\"\nimport XIcon from \"@lucide/astro/icons/x\"\n\nimport {\n Attachment,\n AttachmentAction,\n AttachmentActions,\n AttachmentContent,\n AttachmentDescription,\n AttachmentGroup,\n AttachmentMedia,\n AttachmentTitle,\n} from \"@/components/ui/attachment\"\nimport { Spinner } from \"@/components/ui/spinner\"\n\nconst images = [\n {\n name: \"workspace.png\",\n meta: \"PNG · 820 KB\",\n src: \"https://images.unsplash.com/photo-1497366754035-f200968a6e72?w=900&auto=format&fit=crop&q=80\",\n alt: \"Workspace\",\n },\n {\n name: \"desk-reference.jpg\",\n meta: \"JPG · 1.1 MB\",\n src: \"https://images.unsplash.com/photo-1497215728101-856f4ea42174?w=900&auto=format&fit=crop&q=80\",\n alt: \"Desk\",\n },\n {\n name: \"office-reference.jpg\",\n meta: \"JPG · 940 KB\",\n src: \"https://images.unsplash.com/photo-1497366811353-6870744d04b2?w=900&auto=format&fit=crop&q=80\",\n alt: \"Office\",\n },\n]\n---\n\n<div class=\"mx-auto flex w-full max-w-sm flex-col gap-3 py-12\">\n {/* Unlike shadcn/ui's demo, the group takes focus: its attachments have no\n controls, so a keyboard could not scroll it otherwise. */}\n <AttachmentGroup tabindex=\"0\">\n {images.map((image) => (\n <Attachment orientation=\"vertical\">\n <AttachmentMedia variant=\"image\">\n <img src={image.src} alt={image.alt} />\n </AttachmentMedia>\n <AttachmentContent>\n <AttachmentTitle>{image.name}</AttachmentTitle>\n <AttachmentDescription>{image.meta}</AttachmentDescription>\n </AttachmentContent>\n </Attachment>\n ))}\n </AttachmentGroup>\n <Attachment state=\"uploading\" class=\"w-full\">\n <AttachmentMedia>\n <Spinner />\n </AttachmentMedia>\n <AttachmentContent>\n <AttachmentTitle>sales-dashboard.pdf</AttachmentTitle>\n <AttachmentDescription>Uploading · 64%</AttachmentDescription>\n </AttachmentContent>\n <AttachmentActions>\n <AttachmentAction aria-label=\"Cancel upload\">\n <XIcon />\n </AttachmentAction>\n </AttachmentActions>\n </Attachment>\n <Attachment class=\"w-full\">\n <AttachmentMedia>\n <FileCodeIcon />\n </AttachmentMedia>\n <AttachmentContent>\n <AttachmentTitle>message-renderer.tsx</AttachmentTitle>\n <AttachmentDescription>TypeScript · 12 KB</AttachmentDescription>\n </AttachmentContent>\n <AttachmentActions>\n <AttachmentAction aria-label=\"Remove message-renderer.tsx\">\n <XIcon />\n </AttachmentAction>\n </AttachmentActions>\n </Attachment>\n</div>\n",
|
|
18
18
|
"type": "registry:component"
|
|
19
19
|
},
|
|
20
20
|
{
|