@gv-tech/design-system 0.8.0

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.
Files changed (88) hide show
  1. package/.github/CODEOWNERS +2 -0
  2. package/.github/CONTRIBUTING.md +38 -0
  3. package/.github/FUNDING.yml +4 -0
  4. package/.github/PULL_REQUEST_TEMPLATE/build.md +5 -0
  5. package/.github/PULL_REQUEST_TEMPLATE/standard.md +3 -0
  6. package/.github/RELEASING.md +37 -0
  7. package/.github/copilot-instructions.md +93 -0
  8. package/.github/workflows/ci.yml +82 -0
  9. package/.github/workflows/codeql-analysis.yml +34 -0
  10. package/.github/workflows/release-please.yml +53 -0
  11. package/.husky/pre-commit +1 -0
  12. package/.nvmrc +1 -0
  13. package/.prettierignore +1 -0
  14. package/.storybook/.preview-head.html +1 -0
  15. package/.storybook/main.ts +38 -0
  16. package/.storybook/preview.tsx +30 -0
  17. package/.tool-versions +1 -0
  18. package/.vscode/launch.json +22 -0
  19. package/.vscode/settings.json +30 -0
  20. package/.yarn/releases/yarn-4.12.0.cjs +942 -0
  21. package/.yarnrc.yml +7 -0
  22. package/CHANGELOG.md +490 -0
  23. package/LICENSE +21 -0
  24. package/README.md +116 -0
  25. package/SECURITY.md +9 -0
  26. package/babel.config.js +3 -0
  27. package/dist/favicon.ico +0 -0
  28. package/dist/index.demo.html +40 -0
  29. package/dist/index.js +647 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/index.mjs +1053 -0
  32. package/dist/index.mjs.map +1 -0
  33. package/dist/logo192.png +0 -0
  34. package/dist/logo512.png +0 -0
  35. package/dist/manifest.json +25 -0
  36. package/dist/robots.txt +2 -0
  37. package/dist/vendor-DXgJBoQh.mjs +265 -0
  38. package/dist/vendor-DXgJBoQh.mjs.map +1 -0
  39. package/dist/vendor-nZSsnGb7.js +7 -0
  40. package/dist/vendor-nZSsnGb7.js.map +1 -0
  41. package/docs/MIGRATE_TO_GVTECH_SCOPE.md +74 -0
  42. package/eslint.config.mjs +95 -0
  43. package/netlify.toml +6 -0
  44. package/package.json +130 -0
  45. package/public/favicon.ico +0 -0
  46. package/public/index.demo.html +40 -0
  47. package/public/logo192.png +0 -0
  48. package/public/logo512.png +0 -0
  49. package/public/manifest.json +25 -0
  50. package/public/robots.txt +2 -0
  51. package/scripts/validate.js +56 -0
  52. package/serve.json +4 -0
  53. package/src/Avatar.stories.tsx +67 -0
  54. package/src/Avatar.tsx +174 -0
  55. package/src/Badge.stories.tsx +87 -0
  56. package/src/Badge.tsx +76 -0
  57. package/src/Button.stories.tsx +244 -0
  58. package/src/Button.tsx +384 -0
  59. package/src/Icon.stories.tsx +101 -0
  60. package/src/Icon.tsx +64 -0
  61. package/src/Intro.stories.tsx +20 -0
  62. package/src/Link.stories.tsx +69 -0
  63. package/src/Link.tsx +252 -0
  64. package/src/StoryLinkWrapper.d.ts +1 -0
  65. package/src/StoryLinkWrapper.tsx +33 -0
  66. package/src/__tests__/Avatar.test.tsx +28 -0
  67. package/src/__tests__/Badge.test.tsx +25 -0
  68. package/src/__tests__/Button.test.tsx +38 -0
  69. package/src/__tests__/Icon.test.tsx +26 -0
  70. package/src/__tests__/Link.test.tsx +31 -0
  71. package/src/index.ts +13 -0
  72. package/src/mdx.d.ts +5 -0
  73. package/src/setupTests.ts +1 -0
  74. package/src/shared/animation.d.ts +18 -0
  75. package/src/shared/animation.js +60 -0
  76. package/src/shared/global.d.ts +12 -0
  77. package/src/shared/global.js +120 -0
  78. package/src/shared/icons.d.ts +34 -0
  79. package/src/shared/icons.js +282 -0
  80. package/src/shared/styles.d.ts +86 -0
  81. package/src/shared/styles.js +98 -0
  82. package/src/test-utils/axe.ts +25 -0
  83. package/src/types.ts +316 -0
  84. package/tsconfig.build.json +12 -0
  85. package/tsconfig.json +20 -0
  86. package/tsconfig.node.json +10 -0
  87. package/vite.config.ts +35 -0
  88. package/vitest.config.ts +13 -0
@@ -0,0 +1,2 @@
1
+ .github/CODEOWNERS @eng618
2
+ * @eng618
@@ -0,0 +1,38 @@
1
+ # Contributing Guidelines
2
+
3
+ This project uses **Vite** for development and builds and **Storybook** for component documentation.
4
+
5
+ ## Available Scripts
6
+
7
+ In the project directory, you can run:
8
+
9
+ ### `yarn dev`
10
+
11
+ Runs the Vite development server for local development.<br />
12
+ Open [http://localhost:5173](http://localhost:5173) (or the port Vite shows) to view it in the browser.
13
+
14
+ The page will reload if you make edits, and HMR will update components instantly. You will also see any lint errors in the console.
15
+
16
+ ### `yarn test`
17
+
18
+ Runs the test suite using **Vitest** (configured in `vitest.config.ts`). For interactive watch mode run `yarn test` locally; for CI the project uses `yarn test:ci`.
19
+
20
+ See the Vitest docs for more information: https://vitest.dev/guide/.
21
+
22
+ ### `yarn build`
23
+
24
+ Builds the library or production bundle using Vite (`yarn build`).
25
+
26
+ For Storybook docs and component builds, run `yarn build-storybook` to generate Storybook static output.
27
+
28
+ ### Build configuration
29
+
30
+ This project uses Vite for development and builds. If you need to customize build behavior, edit `vite.config.ts` or add Vite plugins. This project does not use `react-scripts` or `eject`.
31
+
32
+ ## Learn More
33
+
34
+ - Vite docs: https://vitejs.dev/ (build, config and plugins)
35
+ - Vitest docs: https://vitest.dev/ (testing guide)
36
+ - Storybook docs: https://storybook.js.org/docs/react/get-started/introduction (component docs and addons)
37
+
38
+ To customize build behavior edit `vite.config.ts` or add Vite plugins. For component docs and testing examples check the Storybook setup in `.storybook` and `src` stories.
@@ -0,0 +1,4 @@
1
+ # Funding
2
+
3
+ github: [eng618]
4
+ custom: ["https://www.paypal.me/garciaericn"]
@@ -0,0 +1,5 @@
1
+ <!-- This PR is used for build and dependency changes -->
2
+
3
+ # Build updates
4
+
5
+ <!-- Describe what dependency changes are made, and how you have tested them. -->
@@ -0,0 +1,3 @@
1
+ # Description
2
+
3
+ <!-- Describe the contents of this PR in more detail here: -->
@@ -0,0 +1,37 @@
1
+ # Releasing & Publishing 🔁
2
+
3
+ This document explains how releases and publishing are handled for this repository and how to test or modify the release flow.
4
+
5
+ ## Release Please (automated Release PRs)
6
+
7
+ **Overview**
8
+
9
+ - We use `googleapis/release-please-action` to create Release PRs and tags based on Conventional Commits.
10
+
11
+ **One-time setup**
12
+
13
+ 1. Create a **Personal Access Token (PAT)** with `repo` (write) permissions and a short expiration.
14
+ 2. Add the PAT as a repository secret named `RELEASE_PLEASE_TOKEN` (Repository → Settings → Secrets and variables → Actions → New repository secret).
15
+ 3. Confirm branch protection rules allow the PAT or the actor to create tags/releases, or allow the bot account to bypass restrictions where necessary.
16
+
17
+ **Testing**
18
+
19
+ - Trigger the action manually: GitHub → Actions → _Release Please_ → _Run workflow_ → choose `main` and run.
20
+ - A Release PR (usually titled `chore(release): release X.Y.Z`) should be created. Review the changelog and changes in the PR.
21
+ - Merge the PR into `main` to create a tag/release. If using a PAT (not `GITHUB_TOKEN`), downstream workflows triggered by `release` events should run normally.
22
+
23
+ **Notes**
24
+
25
+ - Make sure your commits follow **Conventional Commits** to get meaningful changelogs and correct SemVer bumps.
26
+ - If release PRs are not being created, confirm that the `RELEASE_PLEASE_TOKEN` is present and has proper repository permissions.
27
+
28
+ ## Publishing to npm (current process)
29
+
30
+ - The CI publish step currently expects `NPM_TOKEN` as a repository secret (Stored in repository secrets as `NPM_TOKEN`).
31
+ - Publishing will continue unchanged for now. In a later phase we will migrate to either OIDC or scoped automation tokens and switch the package name to `@gvtech/*` as part of the migration.
32
+
33
+ ## Troubleshooting & Tips
34
+
35
+ - **Release PR not generated**: Confirm commits use Conventional Commit messages, check action logs, and ensure the PAT is set.
36
+ - **Downstream workflows not running on release**: Ensure releases/tags are created with a PAT (not `GITHUB_TOKEN`), otherwise they won't trigger other workflows.
37
+ - **Scoped package publishing**: If you plan to publish to a scope (e.g., `@gvtech`), update `package.json.name` and set `publishConfig.access` to `public` for public scoped packages.
@@ -0,0 +1,93 @@
1
+ # GVTech Design System - AI Coding Guidelines
2
+
3
+ ## Architecture Overview
4
+
5
+ This is a React component library built with TypeScript, styled-components, and Vite. It provides reusable UI components (Avatar, Badge, Button, Icon, Link) for Garcia Ventures applications.
6
+
7
+ **Key Structure:**
8
+
9
+ - `src/` - Components and shared utilities
10
+ - `src/shared/` - Design tokens (colors, typography, spacing), global styles, animations, icons
11
+ - Components follow a pattern: `{Component}.tsx` + `{Component}.stories.tsx` for Storybook docs
12
+
13
+ **Build System:**
14
+
15
+ - Vite library build outputs ES modules and CommonJS
16
+ - Externalizes React, styled-components, polished, prop-types
17
+ - Use `yarn build` for production builds
18
+
19
+ ## Component Patterns
20
+
21
+ **Styling:** Use styled-components with design tokens from `src/shared/styles.js`
22
+
23
+ ```tsx
24
+ import styled from 'styled-components';
25
+ import { color, typography } from './shared/styles';
26
+
27
+ const StyledComponent = styled.div`
28
+ color: ${color.primary};
29
+ font-size: ${typography.size.s2}px;
30
+ `;
31
+ ```
32
+
33
+ **Props & Types:**
34
+
35
+ - Define interfaces in `src/types.ts` using branded types for safety
36
+ - Extend common HTML attributes: `interface ComponentProps extends HTMLAttributes<HTMLDivElement>`
37
+ - Use constants like `BUTTON_APPEARANCES`, `BUTTON_SIZES` from types
38
+
39
+ **Example Component Structure:**
40
+
41
+ ```tsx
42
+ import React from 'react';
43
+ import styled from 'styled-components';
44
+ import { ComponentProps } from './types';
45
+
46
+ interface MyComponentProps extends ComponentProps {
47
+ variant?: 'primary' | 'secondary';
48
+ }
49
+
50
+ const StyledDiv = styled.div<StyledDivProps>``;
51
+
52
+ export const MyComponent: React.FC<MyComponentProps> = ({ variant, ...props }) => (
53
+ <StyledDiv variant={variant} {...props} />
54
+ );
55
+ ```
56
+
57
+ ## Development Workflow
58
+
59
+ - **Local dev:** `yarn storybook` (runs Storybook on port 9009)
60
+ - **Build lib:** `yarn build` (outputs to `dist/`)
61
+ - **Test:** `yarn test` (Vitest with jsdom, watch mode)
62
+ - **Lint:** `yarn lint` (ESLint with TypeScript, auto-fix with `yarn lint:fix`)
63
+ - **Format:** `yarn format` (Prettier)
64
+
65
+ **Testing Setup:**
66
+
67
+ - Uses `@testing-library/react` and `@testing-library/jest-dom`
68
+ - Auto-imports via `src/setupTests.ts`
69
+ - Run `yarn test:ci` for CI (non-interactive)
70
+
71
+ ## Key Conventions
72
+
73
+ - **Imports:** Group external libs, then internal shared, then types
74
+ - **Naming:** PascalCase for components, camelCase for props
75
+ - **Styling:** Prefer design tokens over hardcoded values
76
+ - **Type Safety:** Use branded types (e.g., `IconName`, `CSSColor`) for runtime validation
77
+ - **Stories:** Write comprehensive Storybook stories with controls and interactions
78
+
79
+ **Shared Utilities:**
80
+
81
+ - `styles` - Colors, spacing, typography
82
+ - `global` - Global CSS resets
83
+ - `animation` - Easing functions, keyframes
84
+ - `icons` - Icon components and names
85
+
86
+ ## Integration Points
87
+
88
+ - **Storybook:** Used for component development and documentation
89
+ - **Vite:** Handles build, dev server, and library bundling
90
+ - **ESLint + Prettier:** Code quality with custom configs
91
+ - **Husky:** Git hooks for pre-commit checks
92
+
93
+ Reference `src/Button.tsx` and `src/types.ts` for implementation examples.
@@ -0,0 +1,82 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ fossa-scan:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - name: "Checkout Code"
10
+ uses: actions/checkout@v6
11
+
12
+ - name: "Run FOSSA Scan"
13
+ uses: fossas/fossa-action@main # Use a specific version if locking is preferred
14
+ with:
15
+ api-key: ${{ secrets.FOSSA_API_KEY }}
16
+
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ node: ["20", "22", "24"]
22
+ steps:
23
+ - uses: actions/checkout@v6
24
+ - name: Use Node.js ${{ matrix.node }}
25
+ uses: actions/setup-node@v6
26
+ with:
27
+ node-version: ${{ matrix.node }}
28
+ cache: "yarn"
29
+
30
+ - name: Cache Yarn (optional extra)
31
+ uses: actions/cache@v4
32
+ with:
33
+ path: |
34
+ .yarn/cache
35
+ .yarn/unplugged
36
+ .yarn/build-state.yml
37
+ .yarn/install-state.gz
38
+ key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
39
+ restore-keys: |
40
+ ${{ runner.os }}-yarn-
41
+
42
+ - name: Install dependencies
43
+ run: yarn install
44
+
45
+ - name: Format
46
+ run: yarn format:ci
47
+
48
+ - name: Lint
49
+ run: yarn lint
50
+
51
+ - name: Run Tests
52
+ run: yarn test:ci
53
+
54
+ build:
55
+ runs-on: ubuntu-latest
56
+ needs: [test]
57
+ steps:
58
+ - uses: actions/checkout@v6
59
+
60
+ - name: Use Node.js 24
61
+ uses: actions/setup-node@v6
62
+ with:
63
+ node-version: 24
64
+ cache: "yarn"
65
+
66
+ - name: Install dependencies
67
+ run: yarn install --immutable
68
+
69
+ - name: Build
70
+ run: yarn build
71
+
72
+ - name: Build Storybook
73
+ run: yarn build-storybook
74
+
75
+ - name: Build Storybook Docs
76
+ run: yarn build-storybook-docs
77
+
78
+ - name: Install Playwright Browsers
79
+ run: npx playwright install --with-deps
80
+
81
+ - name: Run Storybook Tests
82
+ run: yarn test-storybook:ci
@@ -0,0 +1,34 @@
1
+ name: "CodeQL"
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ schedule:
9
+ - cron: "34 7 * * 4"
10
+
11
+ jobs:
12
+ analyze:
13
+ name: Analyze
14
+ runs-on: ubuntu-latest
15
+
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ language: ["javascript"]
20
+
21
+ steps:
22
+ - name: Checkout repository
23
+ uses: actions/checkout@v4
24
+
25
+ - name: Initialize CodeQL
26
+ uses: github/codeql-action/init@v2
27
+ with:
28
+ languages: ${{ matrix.language }}
29
+
30
+ - name: Autobuild
31
+ uses: github/codeql-action/autobuild@v2
32
+
33
+ - name: Perform CodeQL Analysis
34
+ uses: github/codeql-action/analyze@v2
@@ -0,0 +1,53 @@
1
+ name: Release Please
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ id-token: write # For OIDC trusted publishing
10
+ contents: write # For tags and releases
11
+ pull-requests: write # For creating release PRs
12
+
13
+ jobs:
14
+ release:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v6
19
+
20
+ - name: Run release-please
21
+ id: release
22
+ uses: googleapis/release-please-action@v4.4
23
+ with:
24
+ release-type: node
25
+ # Use a PAT with repo scopes; set as repository secret `RELEASE_PLEASE_TOKEN`
26
+ token: ${{ secrets.GITHUB_TOKEN }}
27
+
28
+ - name: Show notice
29
+ run: echo "If a release PR is created, review and merge it to create a tag/release."
30
+
31
+ - name: Checkout Code
32
+ if: ${{ steps.release.outputs.release_created }}
33
+ uses: actions/checkout@v6
34
+
35
+ - name: Use Node.js 24
36
+ if: ${{ steps.release.outputs.release_created }}
37
+ uses: actions/setup-node@v6
38
+ with:
39
+ node-version: 24
40
+ registry-url: 'https://registry.npmjs.org'
41
+ cache: 'yarn'
42
+
43
+ - name: Install dependencies
44
+ if: ${{ steps.release.outputs.release_created }}
45
+ run: yarn install --immutable
46
+
47
+ - name: Build
48
+ if: ${{ steps.release.outputs.release_created }}
49
+ run: yarn build
50
+
51
+ - name: Publish to npm
52
+ if: ${{ steps.release.outputs.release_created }}
53
+ run: npm publish --provenance
@@ -0,0 +1 @@
1
+ npx lint-staged
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 24
@@ -0,0 +1 @@
1
+ CHANGELOG.md
@@ -0,0 +1 @@
1
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito+Sans:400,700,800,900" />
@@ -0,0 +1,38 @@
1
+ import type { UserConfig } from 'vite';
2
+ import type { StorybookConfig } from '@storybook/react-vite';
3
+
4
+ export default {
5
+ stories: ['../src/Intro.stories.tsx', '../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
6
+ staticDirs: [{ from: '../public', to: '/public' }],
7
+ addons: ['@storybook/addon-links', '@storybook/addon-a11y', '@storybook/addon-docs'],
8
+
9
+ framework: {
10
+ name: '@storybook/react-vite',
11
+ options: {
12
+ typescript: {
13
+ check: true,
14
+ // Use react-docgen-typescript for TypeScript prop documentation in Vite-based Storybook
15
+ // This leverages Storybook's built-in integration instead of the webpack-only plugin
16
+ reactDocgen: 'react-docgen-typescript',
17
+ reactDocgenTypescriptOptions: {
18
+ shouldExtractLiteralValuesFromEnum: true,
19
+ shouldRemoveUndefinedFromOptional: true,
20
+ propFilter: (prop: unknown) => {
21
+ const p = prop as { parent?: { fileName?: string } } | undefined;
22
+ return p?.parent ? !/node_modules/.test(p.parent.fileName || '') : true;
23
+ },
24
+ },
25
+ },
26
+ },
27
+ },
28
+
29
+ features: {
30
+ interactionsDebugger: true,
31
+ },
32
+
33
+ async viteFinal(config: UserConfig) {
34
+ // Use the project's Vite config as-is to avoid duplicating or re-injecting runtime plugins
35
+ // (adding the project's `react()` plugin here previously caused duplicate injections)
36
+ return config;
37
+ },
38
+ } as StorybookConfig;
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import type { StoryFn, Preview, StoryContext } from '@storybook/react';
3
+ import { GlobalStyle } from '../src/shared/global';
4
+
5
+ export const decorators: Preview['decorators'] = [
6
+ (Story: StoryFn, context: StoryContext) => (
7
+ <>
8
+ <GlobalStyle />
9
+ {Story(context.args, context)}
10
+ </>
11
+ ),
12
+ ];
13
+
14
+ export const parameters: Preview['parameters'] = {
15
+ actions: { argTypesRegex: '^on[A-Z].*' },
16
+ controls: {
17
+ matchers: {
18
+ color: /(background|color)$/i,
19
+ date: /Date$/,
20
+ },
21
+ },
22
+ docs: {
23
+ codePanel: true,
24
+ },
25
+ a11y: {
26
+ config: {},
27
+ options: {},
28
+ },
29
+ };
30
+ export const tags: string[] = ['autodocs'];
package/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ nodejs 22.21.1
@@ -0,0 +1,22 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "type": "chrome",
9
+ "request": "launch",
10
+ "name": "React app",
11
+ "url": "http://localhost:3000",
12
+ "webRoot": "${workspaceFolder}"
13
+ },
14
+ {
15
+ "type": "chrome",
16
+ "request": "launch",
17
+ "name": "Storybook",
18
+ "url": "http://localhost:6006",
19
+ "webRoot": "${workspaceFolder}"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "workbench.colorCustomizations": {
3
+ "activityBar.background": "#696969",
4
+ "activityBar.activeBorder": "#40bf40",
5
+ "activityBar.foreground": "#e7e7e7",
6
+ "activityBar.inactiveForeground": "#e7e7e799",
7
+ "activityBarBadge.background": "#40bf40",
8
+ "activityBarBadge.foreground": "#15202b",
9
+ "titleBar.activeBackground": "#505050",
10
+ "titleBar.inactiveBackground": "#50505099",
11
+ "titleBar.activeForeground": "#e7e7e7",
12
+ "titleBar.inactiveForeground": "#e7e7e799",
13
+ "statusBar.background": "#505050",
14
+ "statusBarItem.hoverBackground": "#696969",
15
+ "statusBar.foreground": "#e7e7e7",
16
+ "activityBar.activeBackground": "#696969",
17
+ "sash.hoverBorder": "#696969",
18
+ "statusBarItem.remoteBackground": "#505050",
19
+ "statusBarItem.remoteForeground": "#e7e7e7",
20
+ "commandCenter.border": "#e7e7e799"
21
+ },
22
+ "peacock.color": "#505050",
23
+ "spellright.language": ["en"],
24
+ "spellright.documentTypes": ["markdown", "latex", "plaintext", "json", "jsonc", "mdx", "javascript", "html"],
25
+ "spellright.parserByClass": {
26
+ "mdx": {
27
+ "parser": "plain"
28
+ }
29
+ }
30
+ }