@tokenami/ds 0.0.62
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/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/index.cjs +2403 -0
- package/dist/index.d.cts +3840 -0
- package/dist/index.d.ts +3840 -0
- package/dist/index.js +2401 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 @jjenzz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @tokenami/ds
|
|
2
|
+
|
|
3
|
+
The official design system for Tokenami. You can use it as a starting point for your project or as a reference for building your own.
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
Install using your package manager of choice:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @tokenami/ds
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then include the design system config in your `tokenami.config.js` file:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import designSystemConfig from '@tokenami/ds';
|
|
17
|
+
import { createConfig } from '@tokenami/css';
|
|
18
|
+
|
|
19
|
+
export default createConfig({
|
|
20
|
+
...designSystemConfig,
|
|
21
|
+
include: ['./app/**/*.{ts,tsx}'],
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The design system includes custom aliases for common properties, such as `--p` for `padding` and `--px` for `padding-left` and `padding-right`. Please follow the [aliases guide](https://github.com/tokenami/tokenami?tab=readme-ov-file#aliases) on [configuring the `css` utility](https://github.com/tokenami/tokenami?tab=readme-ov-file#configure-utility) to ensure the aliases merge correctly across component boundaries.
|
|
26
|
+
|
|
27
|
+
## Theme selector
|
|
28
|
+
|
|
29
|
+
Use a `data-theme` attribute to apply the appropriate light or dark theme to your elements. Otherwise, it will apply the `light` theme by default to the `:root` selector.
|
|
30
|
+
|
|
31
|
+
## Grid
|
|
32
|
+
|
|
33
|
+
Spacing is based on a 4px grid using `rem` units. The `rem` value is calculated based on a `16px` base font size.
|
|
34
|
+
|
|
35
|
+
Using numeric values for grid properties such as `padding` and `margin` will result in multiples of this grid being applied. For instance, `--padding: 2` will add `8px` (`0.5rem`) padding to your element.
|
|
36
|
+
|
|
37
|
+
## Fluid spacing and font sizes
|
|
38
|
+
|
|
39
|
+
Use the fluid spacing and font size tokens to create responsive designs without micromanaging breakpoints. The [utopia guide](https://utopia.fyi/) is a great resource for understanding the concepts behind these tokens.
|
|
40
|
+
|
|
41
|
+
### Spacing
|
|
42
|
+
|
|
43
|
+
The following example will apply `8px` (`0.5rem`) padding to your element at the smallest breakpoint, and `16px` (`1rem`) padding at the largest breakpoint.
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
css({ '--padding': 'var(--fluid-p_min-max)', '--fluid-p-min': 2, '--fluid-p-max': 4 });
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
You can adjust the breakpoints the fluid spacings apply to by changing the `--padding` property:
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
css({ '--padding': 'var(--fluid-p_sm-md)' /* ... */ });
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This will clamp the minimum padding at the small breakpoint, and the maximum padding at the medium breakpoint.
|
|
56
|
+
|
|
57
|
+
### Font sizes
|
|
58
|
+
|
|
59
|
+
Fluid font sizes are multiples of the base font size. For instance, a `--text-size-min` of `2` will result in a font size of `32px` (`2rem`).
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
css({
|
|
63
|
+
'--font-size': 'var(--fluid-text-size_min-max)',
|
|
64
|
+
'--fluid-text-size-min': 2,
|
|
65
|
+
'--fluid-text-size-max': 4,
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This will mean a font size that scales between `32px` (`2rem`) and `64px` (`4rem`) from smallest to largest breakpoints.
|
|
70
|
+
|
|
71
|
+
## Radix UI Colours
|
|
72
|
+
|
|
73
|
+
The design system uses [Radix UI colours](https://www.radix-ui.com/colors). A powerful feature of this palette is dark mode by default when applying the appropriate steps in the scale to each use case.
|
|
74
|
+
|
|
75
|
+
Find out more about [how to use the Radix palette](https://www.radix-ui.com/colors/docs/palette-composition/understanding-the-scale) on their website.
|
|
76
|
+
|
|
77
|
+
## Right-to-left support
|
|
78
|
+
|
|
79
|
+
The design system includes right-to-left support out of the box. This means that directional properties like `padding-left` become `padding-inline-start`, and `padding-right` becomes `padding-inline-end`. If you'd like to disable this, remove the respective aliases from your config.
|