@payfit/unity-themes 0.0.0-alpha.9 → 1.0.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/README.md +70 -54
- package/dist/css/unity.css +749 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/scripts/actions/append-animations.d.ts +3 -0
- package/dist/esm/scripts/build.d.ts +1 -0
- package/dist/esm/scripts/file-headers/unity.d.ts +2 -0
- package/dist/esm/scripts/formats/generators/header-generator.d.ts +2 -0
- package/dist/esm/scripts/formats/processors/grid-processor.d.ts +2 -0
- package/dist/esm/scripts/formats/processors/typography-processor.d.ts +2 -0
- package/dist/esm/scripts/formats/unity-theme.d.ts +3 -0
- package/dist/esm/scripts/formats/utils.d.ts +3 -0
- package/dist/esm/scripts/transforms/oklch.d.ts +4 -0
- package/dist/esm/scripts/transforms/tailwind-animation-token.d.ts +6 -0
- package/dist/esm/scripts/transforms/tailwind-color-token.d.ts +6 -0
- package/dist/esm/scripts/transforms/tailwind-grid-token.d.ts +6 -0
- package/dist/esm/scripts/transforms/tailwind-spacing-token.d.ts +4 -0
- package/dist/esm/scripts/transforms/tailwind-text-token.d.ts +4 -0
- package/dist/esm/scripts/transforms/tailwind-typography-token.d.ts +6 -0
- package/dist/esm/scripts/types.d.ts +21 -0
- package/dist/esm/utils/tailwind-merge.d.ts +1 -0
- package/dist/esm/utils/tailwind-merge.js +32 -0
- package/package.json +51 -38
- package/{dist/esm/tailwind-preset.mjs → src/generated/tailwind-preset.js} +1166 -714
- package/src/index.ts +1 -0
- package/src/scripts/actions/append-animations.ts +73 -0
- package/src/scripts/build.ts +150 -0
- package/src/scripts/file-headers/unity.ts +31 -0
- package/src/scripts/formats/generators/header-generator.ts +31 -0
- package/src/scripts/formats/processors/grid-processor.test.ts +378 -0
- package/src/scripts/formats/processors/grid-processor.ts +64 -0
- package/src/scripts/formats/processors/typography-processor.test.ts +111 -0
- package/src/scripts/formats/processors/typography-processor.ts +48 -0
- package/src/scripts/formats/unity-theme.test.ts +400 -0
- package/src/scripts/formats/unity-theme.ts +91 -0
- package/src/scripts/formats/utils.test.ts +264 -0
- package/src/scripts/formats/utils.ts +15 -0
- package/src/scripts/transforms/oklch.test.ts +166 -0
- package/src/scripts/transforms/oklch.ts +19 -0
- package/src/scripts/transforms/tailwind-animation-token.test.ts +108 -0
- package/src/scripts/transforms/tailwind-animation-token.ts +51 -0
- package/src/scripts/transforms/tailwind-color-token.test.ts +286 -0
- package/src/scripts/transforms/tailwind-color-token.ts +13 -0
- package/src/scripts/transforms/tailwind-grid-token.test.ts +92 -0
- package/src/scripts/transforms/tailwind-grid-token.ts +23 -0
- package/src/scripts/transforms/tailwind-spacing-token.test.ts +306 -0
- package/src/scripts/transforms/tailwind-spacing-token.ts +11 -0
- package/src/scripts/transforms/tailwind-text-token.test.ts +310 -0
- package/src/scripts/transforms/tailwind-text-token.ts +17 -0
- package/src/scripts/transforms/tailwind-typography-token.test.ts +49 -0
- package/src/scripts/transforms/tailwind-typography-token.ts +16 -0
- package/src/scripts/types.ts +30 -0
- package/src/utils/tailwind-merge.test.ts +64 -0
- package/src/utils/tailwind-merge.ts +34 -0
- package/tokens/animations.json +86 -0
- package/tokens/colors.json +1207 -0
- package/tokens/layout.json +51 -0
- package/tokens/radii.json +63 -0
- package/tokens/shadows.json +45 -0
- package/tokens/sizes.json +26 -0
- package/tokens/spacings.json +80 -0
- package/tokens/text.json +70 -0
- package/tokens/typography.json +311 -0
- package/dist/cjs/tailwind-preset.d.ts +0 -2
- package/dist/cjs/tailwind-preset.js +0 -1
- package/dist/esm/tailwind-preset.d.mts +0 -2
- package/dist/images/PayFit-Logo.svg +0 -4
- package/dist/images/breakpoints.png +0 -0
- package/dist/images/colors.gif +0 -0
- package/dist/images/elevation.gif +0 -0
- package/dist/images/layout.png +0 -0
- package/dist/images/radii.gif +0 -0
- package/dist/images/remote-work.png +0 -0
- package/dist/images/sizing.gif +0 -0
- package/dist/images/spacing.png +0 -0
- package/dist/images/typography.gif +0 -0
- package/dist/images/unity-themes-cover.jpg +0 -0
- package/dist/images/unity-themes-diagram.png +0 -0
package/README.md
CHANGED
|
@@ -1,101 +1,117 @@
|
|
|
1
1
|
# Unity Themes
|
|
2
2
|
|
|
3
|
-
The Unity themes package
|
|
3
|
+
The Unity themes package provides a comprehensive design system using TailwindCSS 4, converting all the design tokens of the Unity design system into TailwindCSS utility classes. This is the foundational part of the unity design system and is heavily used by the components package and other unity packages.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> **Note**: This is version 1.x of Unity Themes, built for TailwindCSS 4. If you're migrating from v0.x, see [MIGRATIONS.md](./docs/files/MIGRATIONS.md). For legacy documentation, see [README-v0.md](./docs/files/README-v0.md).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
6
8
|
|
|
7
9
|
Install and configure this package by following these steps:
|
|
8
10
|
|
|
9
|
-
1. Install the package
|
|
11
|
+
1. **Install the package and dependencies**
|
|
10
12
|
|
|
11
13
|
```bash
|
|
14
|
+
yarn add tailwindcss @fontsource/{inter,source-serif-4}
|
|
12
15
|
yarn add @payfit/unity-themes
|
|
13
16
|
```
|
|
14
17
|
|
|
15
|
-
2.
|
|
18
|
+
2. **Set up TailwindCSS in your project**
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
const unityPreset = require('@payfit/unity-themes')
|
|
20
|
+
You need to configure TailwindCSS 4 in your project. This can be done using either the Vite plugin or PostCSS plugin:
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
```
|
|
22
|
+
- [Install TailwindCSS v4 in a Vite Project](https://tailwindcss.com/docs/installation/using-vite)
|
|
23
|
+
- [Install TailwindCSS v4 using PostCSS](https://tailwindcss.com/docs/installation/using-postcss)
|
|
24
24
|
|
|
25
|
-
3.
|
|
25
|
+
3. **Import Unity Themes in your main CSS file**
|
|
26
26
|
|
|
27
|
-
```
|
|
27
|
+
```css
|
|
28
28
|
/* /path/to/your/main/styles.css */
|
|
29
|
-
@import '@
|
|
30
|
-
@import '@fontsource/inter/500.css';
|
|
31
|
-
@import '@fontsource/inter/600.css';
|
|
32
|
-
@import '@fontsource/inter/700.css';
|
|
33
|
-
@import '@fontsource/source-serif-4';
|
|
34
|
-
@import '@fontsource/source-serif-4/500.css';
|
|
35
|
-
@import '@fontsource/source-serif-4/600.css';
|
|
36
|
-
@import '@fontsource/source-serif-4/700.css';
|
|
37
|
-
@tailwind base;
|
|
38
|
-
@tailwind components;
|
|
39
|
-
@tailwind utilities;
|
|
29
|
+
@import '@payfit/unity-themes/css/unity.css';
|
|
40
30
|
```
|
|
41
31
|
|
|
42
|
-
|
|
32
|
+
That's it! The Unity CSS file includes all font imports and TailwindCSS configuration.
|
|
33
|
+
|
|
34
|
+
4. **Use the utility classes in your elements**
|
|
43
35
|
|
|
44
36
|
```html
|
|
45
|
-
<button class="uy
|
|
37
|
+
<button class="uy:bg-surface-primary uy:text-surface-inverted">
|
|
46
38
|
hello!
|
|
47
39
|
</button>
|
|
48
40
|
```
|
|
49
41
|
|
|
50
|
-
|
|
42
|
+
## JavaScript Utilities
|
|
51
43
|
|
|
52
|
-
|
|
44
|
+
If you need to use JavaScript utilities (like `uyMerge` for class merging), import them normally:
|
|
53
45
|
|
|
54
|
-
|
|
46
|
+
```javascript
|
|
47
|
+
import { uyMerge } from '@payfit/unity-themes'
|
|
55
48
|
|
|
56
|
-
|
|
49
|
+
const className = uyMerge('uy:bg-red-l1', 'uy:bg-blue-l2') // 'uy:bg-blue-500'
|
|
50
|
+
```
|
|
57
51
|
|
|
58
|
-
|
|
52
|
+
## Usage
|
|
59
53
|
|
|
60
|
-
|
|
54
|
+
Use Unity utility classes with the `uy:` prefix:
|
|
61
55
|
|
|
62
|
-
```
|
|
63
|
-
|
|
56
|
+
```html
|
|
57
|
+
<button
|
|
58
|
+
class="uy:bg-surface-primary uy:text-surface-inverted uy:hover:bg-surface-secondary"
|
|
59
|
+
>
|
|
60
|
+
Hello Unity!
|
|
61
|
+
</button>
|
|
64
62
|
```
|
|
65
63
|
|
|
66
|
-
|
|
64
|
+
### Class Syntax
|
|
67
65
|
|
|
68
|
-
|
|
66
|
+
Unity classes use the `uy:` prefix and the prefix goes before any modifiers:
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
```html
|
|
69
|
+
<div class="uy:bg-red-l1 uy:hover:bg-red-l2 uy:md:text-lg"></div>
|
|
70
|
+
```
|
|
73
71
|
|
|
74
|
-
###
|
|
72
|
+
### CSS properties
|
|
75
73
|
|
|
76
|
-
|
|
74
|
+
Access design tokens directly via CSS custom properties:
|
|
77
75
|
|
|
78
|
-
```
|
|
79
|
-
|
|
76
|
+
```jsx
|
|
77
|
+
const MyComponent = ({ isHighlighted }) => {
|
|
78
|
+
const bgColor = isHighlighted ? 'var(--color-grayscale-l9)' : 'transparent'
|
|
79
|
+
return (
|
|
80
|
+
<div className="uy:transition-colors" style={{ backgroundColor: bgColor }}>
|
|
81
|
+
Custom styling with design tokens
|
|
82
|
+
</div>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
80
85
|
```
|
|
81
86
|
|
|
82
|
-
|
|
87
|
+
## Documentation
|
|
83
88
|
|
|
84
|
-
|
|
89
|
+
- **[Architecture](./docs/files/ARCHITECTURE.md)**: Technical details, build process, and internal structure
|
|
90
|
+
- **[Migrations](./docs/files/MIGRATIONS.md)**: Complete guide for migrating from v0.x to v1.x
|
|
91
|
+
- **[Legacy v0.x](./docs/files/README-v0.md)**: Documentation for the previous version
|
|
85
92
|
|
|
86
|
-
|
|
93
|
+
## Design Tokens
|
|
94
|
+
|
|
95
|
+
Design tokens are sourced from [Unity's Figma design system](https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library?node-id=0-1&t=rSxQTgD4jTGskNmh-1) and organized in the `tokens/` directory:
|
|
87
96
|
|
|
88
97
|
```shell
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
tokens/
|
|
99
|
+
├── colors.json # Color palette and semantic colors
|
|
100
|
+
├── typography.json # Font families, sizes, and text styles
|
|
101
|
+
├── spacings.json # Spacing scale and layout values
|
|
102
|
+
├── shadows.json # Box shadow definitions
|
|
103
|
+
├── radii.json # Border radius values
|
|
104
|
+
├── layout.json # Grid and container sizes
|
|
105
|
+
├── sizes.json # Component and element sizes
|
|
106
|
+
└── text.json # Text-specific tokens
|
|
95
107
|
```
|
|
96
108
|
|
|
97
|
-
|
|
109
|
+
## Development
|
|
98
110
|
|
|
99
|
-
|
|
111
|
+
```bash
|
|
112
|
+
# Build the package
|
|
113
|
+
yarn nx run unity-themes:build
|
|
100
114
|
|
|
101
|
-
|
|
115
|
+
# Run tests
|
|
116
|
+
yarn nx run unity-themes:test
|
|
117
|
+
```
|