Package Tansy UI as @openkhalix/tansy-ui in a monorepo (v0.4.0)
Restructure the repo into npm workspaces so the component kit publishes as its own package, like MUI and shadcn/ui: - packages/ui: @openkhalix/tansy-ui (published), with components, stories, tests, tokens and the library build - packages/brand: private logo and catalogue data shared by both apps - apps/site: the landing page - apps/docs: Storybook The package: - MIT licence (copyright OpenKhalix) - per-component ES modules and type declarations - "use client" on component modules so they import into Next.js Server Components; helpers stay server-safe - tokens.css for Tailwind v4 apps, and a prebuilt styles.css for apps without Tailwind - lucide-react 1.x, whose types compile against current React 19 types The apps resolve the package through a "source" export condition, so they hot-reload component edits, while outside users get dist/. scripts/test-package.mjs packs the package and installs the tarball into Vite + Tailwind (strict types), plain React and Next.js apps; each must build and render correctly. Gitea workflows run CI on push and publish to npm when a vX.Y.Z tag matching the package version is pushed.
This commit is contained in:
1 parent
23e67006d3
commit
9255b255a6
214 files changed
+1521
-389
No files matched your search
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "@tansy/brand",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"description": "Tansy UI logo and catalogue data, shared by the landing page and Storybook. Not published.",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./public/*": "./public/*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^19.0.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" role="img" aria-labelledby="t">
|
||||
<title id="t">Tansy UI</title>
|
||||
<rect width="32" height="32" rx="8" fill="#12151c"/>
|
||||
<g transform="translate(16 16) scale(.9) translate(-16 -16)">
|
||||
<circle cx="16.00" cy="16.00" r="3.6" fill="#f5b40b"/>
|
||||
<circle cx="16.00" cy="16.00" r="1.45" fill="#fde68a"/>
|
||||
<circle cx="24.20" cy="16.00" r="3.6" fill="#5b87f5"/>
|
||||
<circle cx="24.20" cy="16.00" r="1.45" fill="#dbe7ff"/>
|
||||
<circle cx="20.10" cy="23.10" r="3.6" fill="#5b87f5"/>
|
||||
<circle cx="20.10" cy="23.10" r="1.45" fill="#dbe7ff"/>
|
||||
<circle cx="11.90" cy="23.10" r="3.6" fill="#5b87f5"/>
|
||||
<circle cx="11.90" cy="23.10" r="1.45" fill="#dbe7ff"/>
|
||||
<circle cx="7.80" cy="16.00" r="3.6" fill="#5b87f5"/>
|
||||
<circle cx="7.80" cy="16.00" r="1.45" fill="#dbe7ff"/>
|
||||
<circle cx="11.90" cy="8.90" r="3.6" fill="#5b87f5"/>
|
||||
<circle cx="11.90" cy="8.90" r="1.45" fill="#dbe7ff"/>
|
||||
<circle cx="20.10" cy="8.90" r="3.6" fill="#5b87f5"/>
|
||||
<circle cx="20.10" cy="8.90" r="1.45" fill="#dbe7ff"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,17 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" role="img" aria-labelledby="t">
|
||||
<title id="t">Tansy UI</title>
|
||||
<circle cx="16.00" cy="16.00" r="3.6" fill="#f5b40b"/>
|
||||
<circle cx="16.00" cy="16.00" r="1.45" fill="#fde68a"/>
|
||||
<circle cx="24.20" cy="16.00" r="3.6" fill="#305ddd"/>
|
||||
<circle cx="24.20" cy="16.00" r="1.45" fill="#bfdbfe"/>
|
||||
<circle cx="20.10" cy="23.10" r="3.6" fill="#305ddd"/>
|
||||
<circle cx="20.10" cy="23.10" r="1.45" fill="#bfdbfe"/>
|
||||
<circle cx="11.90" cy="23.10" r="3.6" fill="#305ddd"/>
|
||||
<circle cx="11.90" cy="23.10" r="1.45" fill="#bfdbfe"/>
|
||||
<circle cx="7.80" cy="16.00" r="3.6" fill="#305ddd"/>
|
||||
<circle cx="7.80" cy="16.00" r="1.45" fill="#bfdbfe"/>
|
||||
<circle cx="11.90" cy="8.90" r="3.6" fill="#305ddd"/>
|
||||
<circle cx="11.90" cy="8.90" r="1.45" fill="#bfdbfe"/>
|
||||
<circle cx="20.10" cy="8.90" r="3.6" fill="#305ddd"/>
|
||||
<circle cx="20.10" cy="8.90" r="1.45" fill="#bfdbfe"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 931 B |
@@ -0,0 +1,35 @@
|
||||
import type { SVGAttributes } from 'react'
|
||||
|
||||
export type TansyMarkProps = SVGAttributes<SVGSVGElement> & {
|
||||
size?: number
|
||||
}
|
||||
|
||||
/** Head centres: one in the middle, six on a hex ring. Shared with `public/tansy-mark.svg`. */
|
||||
const HEADS = [
|
||||
[16, 16],
|
||||
[24.2, 16],
|
||||
[20.1, 23.1],
|
||||
[11.9, 23.1],
|
||||
[7.8, 16],
|
||||
[11.9, 8.9],
|
||||
[20.1, 8.9],
|
||||
] as const
|
||||
|
||||
/**
|
||||
* The Tansy mark: a tansy flowerhead, the plant folk-named "golden buttons".
|
||||
* The outer heads draw from the palette's primary ramp so the mark re-themes
|
||||
* with whatever palette is in scope; the gold centre is the fixed brand colour.
|
||||
* `public/tansy-mark.svg` is the Classic Blue copy for favicons and Storybook.
|
||||
*/
|
||||
export function TansyMark({ size = 32, ...props }: TansyMarkProps) {
|
||||
return (
|
||||
<svg aria-hidden="true" width={size} height={size} viewBox="0 0 32 32" {...props}>
|
||||
{HEADS.map(([cx, cy], index) => (
|
||||
<g key={index}>
|
||||
<circle cx={cx} cy={cy} r={3.6} fill={index === 0 ? '#f5b40b' : 'var(--color-primary-500)'} />
|
||||
<circle cx={cx} cy={cy} r={1.45} fill={index === 0 ? '#fde68a' : 'var(--color-primary-200)'} />
|
||||
</g>
|
||||
))}
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
/**
|
||||
* The component catalogue shown on the landing page.
|
||||
*
|
||||
* `documentation` and `storyCounts` are regenerated from the built Storybook
|
||||
* index by `scripts/gen_catalogue.py --patch`; edit the generator's tables,
|
||||
* not these blocks. `featuredNames` is hand-picked and left alone.
|
||||
*/
|
||||
|
||||
export type CatalogueEntry = {
|
||||
number: string
|
||||
group: string
|
||||
name: string
|
||||
detail: string
|
||||
href: string
|
||||
}
|
||||
|
||||
export const documentation: CatalogueEntry[] = [
|
||||
{
|
||||
number: '01',
|
||||
group: 'Actions',
|
||||
name: 'Button',
|
||||
detail: 'Variants · colours · loading · icons',
|
||||
href: '/docs/?path=/docs/actions-button--documentation',
|
||||
},
|
||||
{
|
||||
number: '02',
|
||||
group: 'Actions',
|
||||
name: 'ToggleGroup',
|
||||
detail: 'Segmented · multiple · icon-only',
|
||||
href: '/docs/?path=/docs/actions-togglegroup--documentation',
|
||||
},
|
||||
{
|
||||
number: '03',
|
||||
group: 'Forms',
|
||||
name: 'Checkbox',
|
||||
detail: 'Indeterminate · colours · sizes',
|
||||
href: '/docs/?path=/docs/forms-checkbox--documentation',
|
||||
},
|
||||
{
|
||||
number: '04',
|
||||
group: 'Forms',
|
||||
name: 'CheckboxGroup',
|
||||
detail: 'Select all · horizontal',
|
||||
href: '/docs/?path=/docs/forms-checkboxgroup--documentation',
|
||||
},
|
||||
{
|
||||
number: '05',
|
||||
group: 'Forms',
|
||||
name: 'Combobox',
|
||||
detail: 'Search · chips · async',
|
||||
href: '/docs/?path=/docs/forms-combobox--documentation',
|
||||
},
|
||||
{
|
||||
number: '06',
|
||||
group: 'Forms',
|
||||
name: 'FeaturedInput',
|
||||
detail: 'Floating label · password · clearable',
|
||||
href: '/docs/?path=/docs/forms-featuredinput--documentation',
|
||||
},
|
||||
{
|
||||
number: '07',
|
||||
group: 'Forms',
|
||||
name: 'FeaturedSelect',
|
||||
detail: 'Floating label · searchable · actions',
|
||||
href: '/docs/?path=/docs/forms-featuredselect--documentation',
|
||||
},
|
||||
{
|
||||
number: '08',
|
||||
group: 'Forms',
|
||||
name: 'FeaturedTextArea',
|
||||
detail: 'Floating label · auto-resize',
|
||||
href: '/docs/?path=/docs/forms-featuredtextarea--documentation',
|
||||
},
|
||||
{
|
||||
number: '09',
|
||||
group: 'Forms',
|
||||
name: 'Field',
|
||||
detail: 'Label · description · error wiring',
|
||||
href: '/docs/?path=/docs/forms-field--documentation',
|
||||
},
|
||||
{
|
||||
number: '10',
|
||||
group: 'Forms',
|
||||
name: 'Input',
|
||||
detail: 'Addons · icons · filled · underline',
|
||||
href: '/docs/?path=/docs/forms-input--documentation',
|
||||
},
|
||||
{
|
||||
number: '11',
|
||||
group: 'Forms',
|
||||
name: 'NativeSelect',
|
||||
detail: 'Native menu · groups',
|
||||
href: '/docs/?path=/docs/forms-nativeselect--documentation',
|
||||
},
|
||||
{
|
||||
number: '12',
|
||||
group: 'Forms',
|
||||
name: 'NumberInput',
|
||||
detail: 'Steppers · currency · min/max',
|
||||
href: '/docs/?path=/docs/forms-numberinput--documentation',
|
||||
},
|
||||
{
|
||||
number: '13',
|
||||
group: 'Forms',
|
||||
name: 'Radio',
|
||||
detail: 'Cards · horizontal · descriptions',
|
||||
href: '/docs/?path=/docs/forms-radio--documentation',
|
||||
},
|
||||
{
|
||||
number: '14',
|
||||
group: 'Forms',
|
||||
name: 'Select',
|
||||
detail: 'Single · multiple · grouped · clearable',
|
||||
href: '/docs/?path=/docs/forms-select--documentation',
|
||||
},
|
||||
{
|
||||
number: '15',
|
||||
group: 'Forms',
|
||||
name: 'Slider',
|
||||
detail: 'Range · marks · formatted',
|
||||
href: '/docs/?path=/docs/forms-slider--documentation',
|
||||
},
|
||||
{
|
||||
number: '16',
|
||||
group: 'Forms',
|
||||
name: 'Switch',
|
||||
detail: 'Icons · label position · colours',
|
||||
href: '/docs/?path=/docs/forms-switch--documentation',
|
||||
},
|
||||
{
|
||||
number: '17',
|
||||
group: 'Forms',
|
||||
name: 'TextArea',
|
||||
detail: 'Auto-resize · character count',
|
||||
href: '/docs/?path=/docs/forms-textarea--documentation',
|
||||
},
|
||||
{
|
||||
number: '18',
|
||||
group: 'Overlays',
|
||||
name: 'AlertDialog',
|
||||
detail: 'Destructive · async confirm',
|
||||
href: '/docs/?path=/docs/overlays-alertdialog--documentation',
|
||||
},
|
||||
{
|
||||
number: '19',
|
||||
group: 'Overlays',
|
||||
name: 'Dialog',
|
||||
detail: 'Sizes · scrolling body · forms',
|
||||
href: '/docs/?path=/docs/overlays-dialog--documentation',
|
||||
},
|
||||
{
|
||||
number: '20',
|
||||
group: 'Overlays',
|
||||
name: 'Drawer',
|
||||
detail: 'Four sides · sizes',
|
||||
href: '/docs/?path=/docs/overlays-drawer--documentation',
|
||||
},
|
||||
{
|
||||
number: '21',
|
||||
group: 'Overlays',
|
||||
name: 'DropdownMenu',
|
||||
detail: 'Shortcuts · submenus · checkable',
|
||||
href: '/docs/?path=/docs/overlays-dropdownmenu--documentation',
|
||||
},
|
||||
{
|
||||
number: '22',
|
||||
group: 'Overlays',
|
||||
name: 'Popover',
|
||||
detail: 'Sides · arrow · rich content',
|
||||
href: '/docs/?path=/docs/overlays-popover--documentation',
|
||||
},
|
||||
{
|
||||
number: '23',
|
||||
group: 'Overlays',
|
||||
name: 'Tooltip',
|
||||
detail: 'Sides · colours · InfoTip',
|
||||
href: '/docs/?path=/docs/overlays-tooltip--documentation',
|
||||
},
|
||||
{
|
||||
number: '24',
|
||||
group: 'Navigation',
|
||||
name: 'Accordion',
|
||||
detail: 'Multiple · variants · heading level',
|
||||
href: '/docs/?path=/docs/navigation-accordion--documentation',
|
||||
},
|
||||
{
|
||||
number: '25',
|
||||
group: 'Navigation',
|
||||
name: 'Breadcrumb',
|
||||
detail: 'Collapse · icons',
|
||||
href: '/docs/?path=/docs/navigation-breadcrumb--documentation',
|
||||
},
|
||||
{
|
||||
number: '26',
|
||||
group: 'Navigation',
|
||||
name: 'Pagination',
|
||||
detail: 'Siblings · boundaries · sizes',
|
||||
href: '/docs/?path=/docs/navigation-pagination--documentation',
|
||||
},
|
||||
{
|
||||
number: '27',
|
||||
group: 'Navigation',
|
||||
name: 'Tabs',
|
||||
detail: 'Underline · pills · vertical',
|
||||
href: '/docs/?path=/docs/navigation-tabs--documentation',
|
||||
},
|
||||
{
|
||||
number: '28',
|
||||
group: 'Feedback',
|
||||
name: 'Alert',
|
||||
detail: 'Soft · solid · outline · dismissible',
|
||||
href: '/docs/?path=/docs/feedback-alert--documentation',
|
||||
},
|
||||
{
|
||||
number: '29',
|
||||
group: 'Feedback',
|
||||
name: 'Progress',
|
||||
detail: 'Indeterminate · meter · formatted',
|
||||
href: '/docs/?path=/docs/feedback-progress--documentation',
|
||||
},
|
||||
{
|
||||
number: '30',
|
||||
group: 'Feedback',
|
||||
name: 'Skeleton',
|
||||
detail: 'Text · circle · card loading',
|
||||
href: '/docs/?path=/docs/feedback-skeleton--documentation',
|
||||
},
|
||||
{
|
||||
number: '31',
|
||||
group: 'Feedback',
|
||||
name: 'Spinner',
|
||||
detail: 'Sizes · colours',
|
||||
href: '/docs/?path=/docs/feedback-spinner--documentation',
|
||||
},
|
||||
{
|
||||
number: '32',
|
||||
group: 'Feedback',
|
||||
name: 'Toast',
|
||||
detail: 'Promise · actions · placement',
|
||||
href: '/docs/?path=/docs/feedback-toast--documentation',
|
||||
},
|
||||
{
|
||||
number: '33',
|
||||
group: 'Display',
|
||||
name: 'Avatar',
|
||||
detail: 'Initials · status · groups',
|
||||
href: '/docs/?path=/docs/display-avatar--documentation',
|
||||
},
|
||||
{
|
||||
number: '34',
|
||||
group: 'Display',
|
||||
name: 'Badge',
|
||||
detail: 'Colours · dot · removable · count',
|
||||
href: '/docs/?path=/docs/display-badge--documentation',
|
||||
},
|
||||
{
|
||||
number: '35',
|
||||
group: 'Display',
|
||||
name: 'Kbd',
|
||||
detail: 'Key combinations',
|
||||
href: '/docs/?path=/docs/display-kbd--documentation',
|
||||
},
|
||||
{
|
||||
number: '36',
|
||||
group: 'Display',
|
||||
name: 'Table',
|
||||
detail: 'Sortable · striped · sticky header',
|
||||
href: '/docs/?path=/docs/display-table--documentation',
|
||||
},
|
||||
{
|
||||
number: '37',
|
||||
group: 'Layout',
|
||||
name: 'Card',
|
||||
detail: 'Outline · elevated · media · link',
|
||||
href: '/docs/?path=/docs/layout-card--documentation',
|
||||
},
|
||||
{
|
||||
number: '38',
|
||||
group: 'Layout',
|
||||
name: 'Separator',
|
||||
detail: 'Labelled · dashed · vertical',
|
||||
href: '/docs/?path=/docs/layout-separator--documentation',
|
||||
},
|
||||
]
|
||||
|
||||
export const storyCounts: Record<string, number> = {
|
||||
Button: 11,
|
||||
ToggleGroup: 15,
|
||||
Checkbox: 14,
|
||||
CheckboxGroup: 12,
|
||||
Combobox: 22,
|
||||
FeaturedInput: 17,
|
||||
FeaturedSelect: 23,
|
||||
FeaturedTextArea: 13,
|
||||
Field: 6,
|
||||
Input: 11,
|
||||
NativeSelect: 14,
|
||||
NumberInput: 13,
|
||||
Radio: 18,
|
||||
Select: 23,
|
||||
Slider: 16,
|
||||
Switch: 15,
|
||||
TextArea: 14,
|
||||
AlertDialog: 7,
|
||||
Dialog: 12,
|
||||
Drawer: 9,
|
||||
DropdownMenu: 7,
|
||||
Popover: 6,
|
||||
Tooltip: 14,
|
||||
Accordion: 7,
|
||||
Breadcrumb: 5,
|
||||
Pagination: 9,
|
||||
Tabs: 10,
|
||||
Alert: 9,
|
||||
Progress: 9,
|
||||
Skeleton: 5,
|
||||
Spinner: 4,
|
||||
Toast: 5,
|
||||
Avatar: 8,
|
||||
Badge: 13,
|
||||
Kbd: 5,
|
||||
Table: 9,
|
||||
Card: 8,
|
||||
Separator: 5,
|
||||
}
|
||||
|
||||
export const totalStories = Object.values(storyCounts).reduce((sum, n) => sum + n, 0)
|
||||
|
||||
/** The five parts the hero shows. Each has a live preview in App.tsx. */
|
||||
export const featuredNames = ['Button', 'Switch', 'Checkbox', 'Badge', 'Tooltip'] as const
|
||||
|
||||
export type FeaturedName = (typeof featuredNames)[number]
|
||||
|
||||
export const featured = featuredNames.map((name) => {
|
||||
const entry = documentation.find((item) => item.name === name)
|
||||
if (!entry) throw new Error(`Featured component "${name}" is missing from the catalogue`)
|
||||
return { ...entry, name, stories: storyCounts[name] ?? 0 }
|
||||
})
|
||||
@@ -0,0 +1,10 @@
|
||||
export { TansyMark, type TansyMarkProps } from './TansyMark'
|
||||
export {
|
||||
documentation,
|
||||
featured,
|
||||
featuredNames,
|
||||
storyCounts,
|
||||
totalStories,
|
||||
type CatalogueEntry,
|
||||
type FeaturedName,
|
||||
} from './catalogue'
|
||||
Reference in new issue
Block a user