@mcnivendev/design-system 1.0.6 → 1.1.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.
package/package.json CHANGED
@@ -1,15 +1,36 @@
1
1
  {
2
2
  "name": "@mcnivendev/design-system",
3
- "version": "1.0.6",
4
- "private": false,
5
- "publishConfig": {
6
- "access": "public"
7
- },
3
+ "version": "1.1.0",
8
4
  "type": "module",
5
+ "description": "Tailwind 4 design system with React components and precompiled CSS",
6
+ "main": "tailwind/index.js",
9
7
  "exports": {
10
- "./tailwind": "./tailwind/index.js"
8
+ "./tailwind": "./tailwind/index.js",
9
+ "./react": "./react/index.ts",
10
+ "./css": "./dist/tailwind.css"
11
+ },
12
+ "scripts": {
13
+ "build:css": "npx tailwindcss -i ./src/tailwind.css -o ./dist/tailwind.css --minify"
11
14
  },
12
15
  "peerDependencies": {
16
+ "react": "^18.0.0",
17
+ "react-dom": "^18.0.0",
13
18
  "tailwindcss": "^4.0.0"
14
- }
19
+ },
20
+ "devDependencies": {
21
+ "tailwindcss": "^4.1.18",
22
+ "typescript": "^5.1.0"
23
+ },
24
+ "files": [
25
+ "tailwind",
26
+ "react",
27
+ "dist"
28
+ ],
29
+ "keywords": [
30
+ "tailwind",
31
+ "design-system",
32
+ "react",
33
+ "wordpress"
34
+ ],
35
+ "license": "MIT"
15
36
  }
package/react/Btn.tsx ADDED
@@ -0,0 +1,12 @@
1
+ import React from 'react'
2
+
3
+ interface BtnProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4
+ variant?: 'primary' | 'default'
5
+ }
6
+
7
+ export const Btn: React.FC<BtnProps> = ({ variant = 'default', ...props }) => {
8
+ // Only allow preset classes, no className override
9
+ const baseClass = 'btn'
10
+ const variantClass = variant === 'primary' ? 'btn-primary' : ''
11
+ return <button className={`${baseClass} ${variantClass}`} {...props} />
12
+ }
package/react/Card.tsx ADDED
@@ -0,0 +1,8 @@
1
+ import React from 'react'
2
+
3
+ interface CardProps extends React.HTMLAttributes<HTMLDivElement> {}
4
+
5
+ export const Card: React.FC<CardProps> = ({ children, ...props }) => {
6
+ // Only the design system class
7
+ return <div className="card" {...props}>{children}</div>
8
+ }
package/react/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { Btn } from './Btn'
2
+ export { Card } from './Card'
package/tailwind/index.js CHANGED
@@ -1,25 +1,39 @@
1
1
  import plugin from 'tailwindcss/plugin'
2
2
 
3
3
  export default plugin(
4
- ({ addBase, addComponents}) => {
5
- /* ---------- Base tokens (optional) ---------- */
4
+ ({ addBase, addComponents, theme }) => {
5
+ // Optional CSS variables
6
6
  addBase({
7
7
  ':root': {
8
- '--color-brand-primary': '#00bc42',
8
+ '--color-brand-main': theme('colors.brand.main'),
9
+ '--color-brand-light': theme('colors.brand.light'),
10
+ '--color-brand-dark': theme('colors.brand.dark'),
9
11
  },
10
12
  }),
13
+ // Components
11
14
  addComponents({
12
- '.btn': {
13
- '@apply inline-flex items-center justify-center font-medium transition rounded-md': {},
14
- },
15
- '.btn-primary': {
16
- '@apply btn bg-brand-primary text-white hover:bg-brand-primary/90': {},
17
- },
18
- '.card': {
19
- '@apply bg-white rounded-lg shadow-md p-6': {},
15
+ '.btn': {
16
+ '@apply inline-flex items-center justify-center font-medium transition rounded-md': {},
17
+ },
18
+ '.btn-primary': {
19
+ '@apply btn bg-brand-main text-white px-12 py-12 hover:bg-brand-main/90': {},
20
+ },
21
+ '.test': {
22
+ '@apply bg-brand-main py-12': {},
23
+ }
24
+ })
25
+ },
26
+ {
27
+ theme: {
28
+ extend: {
29
+ colors: {
30
+ brand: {
31
+ main: '#da4697',
32
+ light: '#3e9f65',
33
+ dark: '#1d4ed8',
34
+ },
35
+ },
36
+ },
20
37
  },
21
- })
22
-
23
-
24
38
  }
25
39
  )