Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: project tailwind #694

Draft
wants to merge 54 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
6a9cbf9
feat: add tailwind plugin
mogusbi-motech Feb 16, 2023
7e418d8
feat: add storybook lint plugin
mogusbi-motech Feb 16, 2023
3b1fe49
feat: alert component
mogusbi-motech Feb 16, 2023
75e070c
feat: allow prop spreading for html elements
mogusbi-motech Feb 17, 2023
85050ed
ci: add todo message to remove flag
mogusbi-motech Feb 17, 2023
0d0461e
feat: logo component
mogusbi-motech Feb 17, 2023
f2a2e0e
feat: avatar component
mogusbi-motech Feb 17, 2023
19a179a
feat: button component
mogusbi-motech Feb 17, 2023
8b0615e
refactor: remove space
mogusbi-motech Feb 17, 2023
3dab38c
feat: link component
mogusbi-motech Feb 17, 2023
b7f16ed
feat: typography component
mogusbi-motech Feb 17, 2023
9696407
feat: title component
mogusbi-motech Feb 17, 2023
97430ad
feat: card component
mogusbi-motech Feb 18, 2023
e9e5f4c
fix: update prop spread rule to allow use in tests and with polymorph…
mogusbi-motech Feb 18, 2023
70f27b7
refactor: remove eslint disable comments after updating of rules
mogusbi-motech Feb 18, 2023
2f646fd
refactor: update test descriptions to remove duplicate should statements
mogusbi-motech Feb 18, 2023
847f7d2
fix: correct button text colours
mogusbi-motech Feb 18, 2023
b258b7a
refactor: remove duplicate should statements
mogusbi-motech Feb 18, 2023
87d5dae
feat: toolbar component
mogusbi-motech Feb 18, 2023
61d7fe0
feat: tooltip component
mogusbi-motech Feb 20, 2023
4022e43
feat: add onVisibilityChange callback to tooltip component
mogusbi-motech Feb 24, 2023
6866c08
feat: textInput component
mogusbi-motech Feb 24, 2023
771cbb1
feat: textarea component
mogusbi-motech Feb 27, 2023
89cabad
refactor: use new test utility and user events library
mogusbi-motech Feb 27, 2023
ef936c2
feat: upload component
mogusbi-motech Apr 14, 2023
6eb2bae
chore: migrate to swc
mogusbi-motech Apr 14, 2023
db85ffe
chore: exclude css files from rollup type generation
mogusbi-motech Apr 14, 2023
04aa081
feat: radio component
mogusbi-motech Apr 16, 2023
87a99aa
revert: filename
mogusbi-motech May 14, 2023
f9fb0be
chore: delete file
mogusbi-motech May 14, 2023
04872ef
style: sort out indents
mogusbi-motech May 14, 2023
96e77e2
ci: disable qa for project tailwind
mogusbi-motech May 31, 2023
a08f1d9
chore(deps): update deps
mogusbi-motech May 31, 2023
28e8249
refactor: update stories to no longer use deprecated types
mogusbi-motech Jun 1, 2023
7787a67
feat: select component
mogusbi-motech Jun 2, 2023
274dcb3
feat: forwardRef components
mogusbi-motech Jun 3, 2023
2db7a04
refactor: replace polymorphic components with asChild prop
mogusbi-motech Jun 4, 2023
cd58b67
refactor: remove box
mogusbi-motech Jun 5, 2023
45b8d25
chore: document box component
mogusbi-motech Jun 5, 2023
8deb7ea
chore: remove polymorphic box package
mogusbi-motech Jun 5, 2023
3eef3cf
fix: slottable component and documentation
mogusbi-motech Jun 6, 2023
72bff82
ci: revert changes
mogusbi-motech Jun 6, 2023
9117d7a
fix: rollup config
mogusbi-motech Jun 6, 2023
afcfa7e
chore: update deps
mogusbi Sep 16, 2024
af64e9f
fix(deps): re-add missing rollup plugin
mogusbi Sep 16, 2024
860727d
feat: update input and remove box
mogusbi-motech Sep 16, 2024
b036259
fix(deps): update headless ui
mogusbi-motech Sep 16, 2024
88995c9
test: fix broken test
mogusbi-motech Sep 16, 2024
c342f06
fix(deps): update react slot
mogusbi-motech Sep 16, 2024
e4139f1
fix(deps): update clsx
mogusbi-motech Sep 16, 2024
a394c34
fix(deps): update storybook
mogusbi-motech Sep 17, 2024
96791d3
fix: tailwind nesting config
mogusbi-motech Sep 17, 2024
0d1555d
chore: missing type
mogusbi-motech Sep 18, 2024
2ec7f4c
chore: remove storybook deployer
mogusbi-motech Sep 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions packages/eslint-config-motech-react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:react/jsx-runtime',
'plugin:storybook/recommended',
'prettier',
],
files: ['*.ts', '*.tsx'],
Expand Down Expand Up @@ -38,6 +39,7 @@ module.exports = {
rules: {
'@typescript-eslint/unbound-method': 'off',
'import/no-extraneous-dependencies': 'off',
'react/jsx-props-no-spreading': 'off',
},
},
{
Expand All @@ -50,6 +52,8 @@ module.exports = {
],
rules: {
'import/no-extraneous-dependencies': 'off',
'react/function-component-definition': 'off',
'react/jsx-props-no-spreading': 'off',
},
},
],
Expand All @@ -66,6 +70,15 @@ module.exports = {
allowExpressions: true,
},
],
'react/jsx-props-no-spreading': [
'error',
{
custom: 'enforce',
exceptions: ['Box', 'Comp'],
explicitSpread: 'ignore',
html: 'ignore',
},
],
'react/require-default-props': 'off',
},
},
Expand All @@ -75,6 +88,7 @@ module.exports = {
'airbnb',
'airbnb/hooks',
'plugin:react/jsx-runtime',
'plugin:storybook/recommended',
'prettier',
],
files: ['*.{js,jsx,mjs}'],
Expand All @@ -93,6 +107,7 @@ module.exports = {
plugins: ['jest'],
rules: {
'import/no-extraneous-dependencies': 'off',
'react/jsx-props-no-spreading': 'off',
},
},
{
Expand All @@ -103,6 +118,8 @@ module.exports = {
],
rules: {
'import/no-extraneous-dependencies': 'off',
'react/function-component-definition': 'off',
'react/jsx-props-no-spreading': 'off',
},
},
],
Expand All @@ -115,6 +132,15 @@ module.exports = {
allowExpressions: true,
},
],
'react/jsx-props-no-spreading': [
'error',
{
custom: 'enforce',
exceptions: ['Box', 'Comp'],
explicitSpread: 'ignore',
html: 'ignore',
},
],
},
},
],
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-config-motech-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"eslint-plugin-jsx-a11y": "6.9.0",
"eslint-plugin-react": "7.35.0",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-simple-import-sort": "12.1.1"
"eslint-plugin-simple-import-sort": "12.1.1",
"eslint-plugin-storybook": "0.6.10"
},
"devDependencies": {
"@motech-development/prettier-motech-config": "workspace:*",
Expand Down
14 changes: 14 additions & 0 deletions packages/project-tailwind/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "@motech-development/eslint-config-motech-react",
"rules": {
"jsx-a11y/label-has-associated-control": [
2,
{
"labelComponents": ["Label"],
"labelAttributes": ["label"],
"controlComponents": ["TextInput"],
"depth": 3
}
]
}
}
1 change: 1 addition & 0 deletions packages/project-tailwind/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@motech-development/prettier-motech-config"
3 changes: 3 additions & 0 deletions packages/project-tailwind/.releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@motech-development/semantic-release/package"
}
30 changes: 30 additions & 0 deletions packages/project-tailwind/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { dirname, join } from 'node:path';
import { StorybookConfig } from '@storybook/react-vite';

/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string) {
return dirname(require.resolve(join(value, 'package.json')));
}

const config: StorybookConfig = {
addons: [
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@storybook/addon-interactions'),
getAbsolutePath('@chromatic-com/storybook'),
],
docs: {},
framework: {
name: getAbsolutePath('@storybook/react-vite'),
options: {},
},
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
typescript: {
reactDocgen: 'react-docgen-typescript',
},
};

export default config;
4 changes: 4 additions & 0 deletions packages/project-tailwind/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<link
href="https://fonts.googleapis.com/css?family=Cabin:400,600&display=swap"
rel="stylesheet"
/>
18 changes: 18 additions & 0 deletions packages/project-tailwind/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Preview } from '@storybook/react';
import '../src/styles/tailwind.css';

export const tags = ['autodocs'];

const preview: Preview = {
parameters: {
controls: {
expanded: true,
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};

export default preview;
13 changes: 13 additions & 0 deletions packages/project-tailwind/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true
},
"transform": {
"react": {
"runtime": "automatic"
}
}
}
}
139 changes: 139 additions & 0 deletions packages/project-tailwind/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"name": "@motech-development/project-tailwind",
"version": "0.0.0-development",
"description": "Breeze UI component library",
"author": "Mo Gusbi <mo.gusbi@motechdevelopment.co.uk> (https://motechdevelopment.co.uk)",
"license": "ISC",
"publishConfig": {
"access": "public"
},
"files": [
"lib"
],
"main": "lib/index.cjs.js",
"module": "lib/index.esm.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "run prebuild && rollup -c",
"deploy": "storybook build",
"lint": "eslint './src/**/*.{ts,tsx}'",
"package": "run build",
"prebuild": "rimraf ./lib",
"start": "storybook dev -p 6006",
"test": "jest --watch",
"test-ci": "jest --coverage --runInBand"
},
"dependencies": {
"@floating-ui/react": "0.24.2",
"@headlessui/react": "2.1.8",
"@heroicons/react": "2.0.18",
"@radix-ui/react-slot": "1.1.0",
"clsx": "2.1.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-number-format": "5.4.1",
"react-textarea-autosize": "8.4.0"
},
"devDependencies": {
"@chromatic-com/storybook": "1.9.0",
"@mdx-js/react": "1.6.22",
"@motech-development/eslint-config-motech-base": "workspace:*",
"@motech-development/eslint-config-motech-react": "workspace:*",
"@motech-development/prettier-motech-config": "workspace:*",
"@motech-development/semantic-release": "workspace:*",
"@rollup/plugin-commonjs": "26.0.1",
"@rollup/plugin-node-resolve": "15.2.3",
"@storybook/addon-actions": "8.3.1",
"@storybook/addon-docs": "8.3.1",
"@storybook/addon-essentials": "8.3.1",
"@storybook/addon-interactions": "8.3.1",
"@storybook/addon-links": "8.3.1",
"@storybook/react": "8.3.1",
"@storybook/react-vite": "8.3.1",
"@storybook/test": "8.3.1",
"@swc/core": "1.7.22",
"@swc/jest": "0.2.36",
"@tailwindcss/forms": "0.5.3",
"@testing-library/jest-dom": "6.5.0",
"@testing-library/react": "16.0.1",
"@testing-library/user-event": "14.5.2",
"@types/jest": "29.5.12",
"@types/react": "18.3.5",
"@types/react-dom": "18.3.0",
"@types/react-textarea-autosize": "8.0.0",
"@typescript-eslint/eslint-plugin": "6.2.1",
"@typescript-eslint/parser": "6.2.1",
"@vitejs/plugin-react-swc": "3.7.0",
"autoprefixer": "10.4.14",
"eslint": "8.57.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "18.0.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-cypress": "3.5.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jest": "28.8.1",
"eslint-plugin-jsx-a11y": "6.9.0",
"eslint-plugin-react": "7.35.0",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-simple-import-sort": "12.1.1",
"jest": "29.7.0",
"jest-date-mock": "1.0.10",
"jest-environment-jsdom": "29.7.0",
"jest-watch-typeahead": "2.2.2",
"jsdom-testing-mocks": "1.7.0",
"postcss": "8.4.21",
"postcss-import": "16.1.0",
"postcss-loader": "7.2.4",
"prettier": "3.2.5",
"rimraf": "6.0.1",
"rollup": "4.21.2",
"rollup-plugin-dts": "6.1.1",
"rollup-plugin-exclude-dependencies-from-bundle": "1.1.23",
"rollup-plugin-postcss": "4.0.2",
"rollup-plugin-swc3": "0.11.2",
"snapshot-diff": "0.10.0",
"storybook": "8.3.1",
"tailwindcss": "3.3.2",
"typescript": "5.5.4",
"vite": "4.5.3"
},
"peerDependencies": {
"react": "18.3.1",
"react-dom": "18.3.1"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{ts,tsx}",
"!src/**/*.stories.{ts,tsx}"
],
"setupFiles": [
"jest-date-mock"
],
"setupFilesAfterEnv": [
"<rootDir>/src/setupTests.ts"
],
"testEnvironment": "jsdom",
"transform": {
"^.+\\.(t|j)sx?$": [
"@swc/jest",
{
"jsc": {
"transform": {
"react": {
"runtime": "automatic"
}
}
}
}
]
},
"watchPlugins": [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
]
},
"lint-staged": {
"*": "prettier --ignore-unknown --write",
"src/**/*.{ts,tsx}": "eslint --fix"
}
}
9 changes: 9 additions & 0 deletions packages/project-tailwind/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable sort-keys */
module.exports = {
plugins: {
'postcss-import': {},
'tailwindcss/nesting': {},
tailwindcss: {},
autoprefixer: {},
},
};
56 changes: 56 additions & 0 deletions packages/project-tailwind/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import dts from 'rollup-plugin-dts';
import external from 'rollup-plugin-exclude-dependencies-from-bundle';
import postcss from 'rollup-plugin-postcss';
import { swc } from 'rollup-plugin-swc3';
import pkg from './package.json' assert { type: 'json' };

export default [
{
external: [/\.css$/],
input: 'src/index.ts',
output: [
{
file: pkg.types,
format: 'es',
},
],
plugins: [dts()],
},
{
input: 'src/index.ts',
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true,
},
{
file: pkg.module,
format: 'es',
sourcemap: true,
},
],
plugins: [
external(),
postcss({
config: {
path: 'postcss.config.js',
},
extensions: ['.css'],
inject: {
insertAt: 'top',
},
minimize: true,
}),
resolve({
extensions: ['.js', '.jsx', '.ts', '.tsx'],
}),
commonjs(),
swc({
sourceMaps: true,
}),
],
},
];
Loading