@kaizen/tailwind 1.3.11 → 1.3.13
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/dist/types/tailwind-presets.d.ts +1 -1
- package/package.json +6 -6
- package/src/_docs/pages/backgrounds/background-color.mdx +2 -2
- package/src/_docs/pages/backgrounds/background-color.stories.tsx +1 -1
- package/src/_docs/pages/borders/border-color.mdx +2 -2
- package/src/_docs/pages/borders/border-color.stories.tsx +1 -1
- package/src/_docs/pages/borders/border-radius.mdx +2 -2
- package/src/_docs/pages/borders/border-radius.stories.tsx +1 -1
- package/src/_docs/pages/borders/border-spacing.mdx +2 -2
- package/src/_docs/pages/borders/border-spacing.stories.tsx +1 -1
- package/src/_docs/pages/borders/border-width.mdx +8 -9
- package/src/_docs/pages/borders/border-width.stories.tsx +1 -1
- package/src/_docs/pages/configuration.mdx +33 -30
- package/src/_docs/pages/contributing.mdx +2 -2
- package/src/_docs/pages/effects/shadow.mdx +2 -2
- package/src/_docs/pages/effects/shadow.stories.tsx +1 -1
- package/src/_docs/pages/getting-started.mdx +14 -14
- package/src/_docs/pages/modifiers/media-queries.mdx +2 -2
- package/src/_docs/pages/modifiers/media-queries.stories.tsx +1 -1
- package/src/_docs/pages/modifiers/pseudo-states.mdx +5 -5
- package/src/_docs/pages/modifiers/pseudo-states.stories.tsx +1 -1
- package/src/_docs/pages/overview.mdx +6 -5
- package/src/_docs/pages/spacing/margin.mdx +7 -7
- package/src/_docs/pages/spacing/margin.stories.tsx +1 -1
- package/src/_docs/pages/spacing/padding.mdx +7 -7
- package/src/_docs/pages/spacing/padding.stories.tsx +1 -1
- package/src/_docs/pages/typography/font-family.mdx +2 -2
- package/src/_docs/pages/typography/font-family.stories.tsx +1 -1
- package/src/_docs/pages/typography/font-size.mdx +2 -2
- package/src/_docs/pages/typography/font-size.stories.tsx +1 -1
- package/src/_docs/pages/typography/font-weight.mdx +2 -2
- package/src/_docs/pages/typography/font-weight.stories.tsx +1 -1
- package/src/_docs/pages/typography/line-height.mdx +2 -2
- package/src/_docs/pages/typography/line-height.stories.tsx +1 -1
- package/src/_docs/pages/typography/max-text-width.mdx +2 -2
- package/src/_docs/pages/typography/max-text-width.stories.tsx +1 -1
- package/src/_docs/pages/typography/text-color.mdx +2 -2
- package/src/_docs/pages/typography/text-color.stories.tsx +1 -1
- package/src/_docs/pages/utility-class-helpers-overview.mdx +24 -23
- package/src/_docs/pages/working-with-tailwind.mdx +13 -9
- package/src/_docs/pages/working-with-tailwind.stories.tsx +2 -2
- package/src/_docs/utils/TailwindStoryTemplate/components/CardContent/CardContent.tsx +1 -1
- package/src/_docs/utils/TailwindStoryTemplate/components/CodeSnippet/CodeSnippet.tsx +1 -1
- package/src/tailwind-presets.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/tailwind",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.13",
|
|
4
4
|
"description": "Kaizen Tailwind presets",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"private": false,
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@kaizen/design-tokens": "10.8.
|
|
25
|
+
"@kaizen/design-tokens": "10.8.7"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"classnames": "^2.5.1",
|
|
29
|
-
"rollup": "^4.
|
|
30
|
-
"tailwindcss": "^3.4.
|
|
31
|
-
"tslib": "^2.8.
|
|
32
|
-
"@kaizen/package-bundler": "2.0.
|
|
29
|
+
"rollup": "^4.30.1",
|
|
30
|
+
"tailwindcss": "^3.4.17",
|
|
31
|
+
"tslib": "^2.8.1",
|
|
32
|
+
"@kaizen/package-bundler": "2.0.4"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"tailwindcss": ">=3.4.7"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { type Meta, type StoryFn } from '@storybook/react'
|
|
3
3
|
import classnames from 'classnames'
|
|
4
4
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
5
5
|
import { flattenEntries } from '~tailwind/_docs/utils/flattenEntries'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { type Meta, type StoryFn } from '@storybook/react'
|
|
3
3
|
import classnames from 'classnames'
|
|
4
4
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
5
5
|
import { flattenEntries } from '~tailwind/_docs/utils/flattenEntries'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { type Meta, type StoryFn } from '@storybook/react'
|
|
3
3
|
import classnames from 'classnames'
|
|
4
4
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
5
5
|
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { type Meta, type StoryFn } from '@storybook/react'
|
|
3
3
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
4
4
|
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
5
5
|
import { kaizenTailwindTheme } from '~tailwind/tailwind-presets'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Description, Meta, Story, Unstyled } from
|
|
2
|
-
import { Card } from
|
|
3
|
-
import * as Examples from
|
|
1
|
+
import { Description, Meta, Story, Unstyled } from '@storybook/blocks'
|
|
2
|
+
import { Card } from '~components/Card'
|
|
3
|
+
import * as Examples from './border-width.stories'
|
|
4
4
|
|
|
5
5
|
<Meta of={Examples} />
|
|
6
6
|
|
|
@@ -12,14 +12,13 @@ import * as Examples from "./border-width.stories"
|
|
|
12
12
|
<Card variant="informative" classNameOverride="w-fit mb-24">
|
|
13
13
|
<div className="p-24 font-family-paragraph">
|
|
14
14
|
<p>
|
|
15
|
-
This document demonstrates the list of border-width suffixes available
|
|
16
|
-
|
|
17
|
-
'border-' prefix.
|
|
15
|
+
This document demonstrates the list of border-width suffixes available from the Kaizen
|
|
16
|
+
preset, by showing what they look like on the 'border-' prefix.
|
|
18
17
|
</p>
|
|
19
18
|
<p>
|
|
20
|
-
Note that there are other border-width prefixes (such as `border-l-`
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
Note that there are other border-width prefixes (such as `border-l-` for
|
|
20
|
+
`border-left-width`) that can be used instead. Available border-width prefixes can be
|
|
21
|
+
referenced <a href="https://tailwindcss.com/docs/border-width">here</a>.
|
|
23
22
|
</p>
|
|
24
23
|
</div>
|
|
25
24
|
</Card>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { type Meta, type StoryFn } from '@storybook/react'
|
|
3
3
|
import classnames from 'classnames'
|
|
4
4
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
5
5
|
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta } from
|
|
2
|
-
import { InlineNotification } from
|
|
1
|
+
import { Meta, Unstyled } from '@storybook/blocks'
|
|
2
|
+
import { InlineNotification } from '~components/Notification'
|
|
3
3
|
|
|
4
4
|
<Meta title="Guides/Tailwind/Configuration" />
|
|
5
5
|
|
|
@@ -10,7 +10,7 @@ This page provides guidance on potential configuration options and how they work
|
|
|
10
10
|
- [Extending the Kaizen preset](#extending-the-kaizen-preset)
|
|
11
11
|
- [Customising the important selector](#customising-the-important-selector)
|
|
12
12
|
|
|
13
|
-
<br/>
|
|
13
|
+
<br />
|
|
14
14
|
|
|
15
15
|
## Extending the Kaizen preset
|
|
16
16
|
|
|
@@ -20,18 +20,18 @@ This page provides guidance on potential configuration options and how they work
|
|
|
20
20
|
To extend upon the preset with values specific to your project, we recommend passing a theme object to `theme.extend`.
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
|
-
const { Preset } = require(
|
|
23
|
+
const { Preset } = require('@kaizen/tailwind')
|
|
24
24
|
|
|
25
25
|
module.exports = {
|
|
26
26
|
presets: [Preset],
|
|
27
27
|
theme: {
|
|
28
28
|
extend: {
|
|
29
29
|
colors: {
|
|
30
|
-
myCoolNewColor:
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
30
|
+
'myCoolNewColor': '#ffffff',
|
|
31
|
+
'purple-100': 'lime',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
35
|
}
|
|
36
36
|
```
|
|
37
37
|
|
|
@@ -46,7 +46,7 @@ Be careful though! While adding in a _new_ field to `colors` won't overwrite any
|
|
|
46
46
|
|
|
47
47
|
`<p className="text-purple-200">` ✅ Value from `Preset` not overwritten
|
|
48
48
|
|
|
49
|
-
<br/>
|
|
49
|
+
<br />
|
|
50
50
|
|
|
51
51
|
## Customising the important selector
|
|
52
52
|
|
|
@@ -54,25 +54,28 @@ If the `"#root"` id selector is incompatible with your application wrapper or yo
|
|
|
54
54
|
|
|
55
55
|
If this is changed or you are not using the [Frontend Template](https://github.com/cultureamp/frontend-template), be sure that the `important` selector matches to an `id`, `class`, or `HTML Element` within your application, ie:
|
|
56
56
|
|
|
57
|
-
```
|
|
58
|
-
<div id="#root">
|
|
59
|
-
{/* Application code */}
|
|
60
|
-
</div>
|
|
57
|
+
```tsx
|
|
58
|
+
<div id="#root">{/* Application code */}</div>
|
|
61
59
|
```
|
|
62
60
|
|
|
63
|
-
<
|
|
64
|
-
persistent
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
</
|
|
61
|
+
<Unstyled>
|
|
62
|
+
<InlineNotification persistent type="cautionary" style="inline" title="Changing the selector">
|
|
63
|
+
{
|
|
64
|
+
<>
|
|
65
|
+
We advise using an <code>id</code> with <code>"#root"</code> as the default
|
|
66
|
+
selector. Using different id's, classes or HTML elements like <code>body</code> as the
|
|
67
|
+
selector could result in:
|
|
68
|
+
<ul>
|
|
69
|
+
<li>
|
|
70
|
+
Utility classes not superseding Kaizen defaults when using{' '}
|
|
71
|
+
<code>classNameOverride</code>
|
|
72
|
+
</li>
|
|
73
|
+
<li>
|
|
74
|
+
Duplication of utillity classes in your CSS bundle caused by consuming components with
|
|
75
|
+
different <code>important</code> selectors
|
|
76
|
+
</li>
|
|
77
|
+
</ul>
|
|
78
|
+
</>
|
|
79
|
+
}
|
|
80
|
+
</InlineNotification>
|
|
81
|
+
</Unstyled>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { type Meta, type StoryFn } from '@storybook/react'
|
|
3
3
|
import classnames from 'classnames'
|
|
4
4
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
5
5
|
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Meta } from
|
|
2
|
-
import CssGeneration from
|
|
3
|
-
import InlineFold from
|
|
4
|
-
import TailwindPlay from
|
|
1
|
+
import { Meta } from '@storybook/blocks'
|
|
2
|
+
import CssGeneration from '../assets/css-generation.png'
|
|
3
|
+
import InlineFold from '../assets/inline-fold.gif'
|
|
4
|
+
import TailwindPlay from '../assets/tailwind-play.gif'
|
|
5
5
|
|
|
6
6
|
<Meta title="Guides/Tailwind/Getting Started" />
|
|
7
7
|
|
|
@@ -18,12 +18,12 @@ If your project was created from this template, you should only need to do [Step
|
|
|
18
18
|
- [3. Add the Tailwind directives](#3-add-the-tailwind-directives)
|
|
19
19
|
- [4. Useful tools](#4-useful-tools)
|
|
20
20
|
|
|
21
|
-
<br/>
|
|
21
|
+
<br />
|
|
22
22
|
|
|
23
23
|
## 1. Install the preset
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
|
|
26
|
+
pnpm add -D @kaizen/tailwind
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
## 2. Implement the Preset
|
|
@@ -34,15 +34,15 @@ This will override the default Tailwind preset, and make ours available for use.
|
|
|
34
34
|
```js
|
|
35
35
|
// tailwind.config.js
|
|
36
36
|
|
|
37
|
-
const { Preset } = require(
|
|
37
|
+
const { Preset } = require('@kaizen/tailwind')
|
|
38
38
|
|
|
39
39
|
module.exports = {
|
|
40
40
|
// Glob pattern to match files containing TW classes. May be different for your project.
|
|
41
|
-
content: [
|
|
41
|
+
content: ['./**/*.{ts,tsx}'],
|
|
42
42
|
// Override the default Tailwind preset with the Kaizen one.
|
|
43
43
|
presets: [Preset],
|
|
44
44
|
// This should be a selector that wraps your app. It ensures that your Tailwind classes supersede component styles, by increasing their specificity with the chosen selector.
|
|
45
|
-
important:
|
|
45
|
+
important: '#root',
|
|
46
46
|
// Preflight is a heavy-handed css reset. We recommend disabling it in your project.
|
|
47
47
|
corePlugins: {
|
|
48
48
|
preflight: false,
|
|
@@ -50,7 +50,7 @@ module.exports = {
|
|
|
50
50
|
}
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
For preset configuration options, see our [configuration docs](/story/systems-tailwind-configuration--page)
|
|
53
|
+
For preset configuration options, see our [configuration docs](/story/systems-tailwind-configuration--page).
|
|
54
54
|
|
|
55
55
|
## 3. Add the Tailwind Directives
|
|
56
56
|
|
|
@@ -71,11 +71,11 @@ For more information, see [here](https://tailwindcss.com/docs/functions-and-dire
|
|
|
71
71
|
|
|
72
72
|
Tailwind Play is an online code sandbox with Tailwind set up out of the box. The Kaizen Team has created an instance with the Kaizen Preset values [here](https://play.tailwindcss.com/OUogvUgXQR)
|
|
73
73
|
|
|
74
|
-
Use this playground to get familiar with our preset, test out new config extensions, create a quick proof of concept, or share code examples with other engineers. Feel free to hit
|
|
74
|
+
Use this playground to get familiar with our preset, test out new config extensions, create a quick proof of concept, or share code examples with other engineers. Feel free to hit 'Share' - it'll create a new url without overriding the one provided here.
|
|
75
75
|
|
|
76
76
|
<img src={TailwindPlay} alt="Tailwind Play" />
|
|
77
77
|
|
|
78
|
-
The playground also has a great “Generated CSS” feature that let
|
|
78
|
+
The playground also has a great “Generated CSS” feature that let's you see which css classes are generated by your preset when you implement tailwind utilities. It's a great way to see what Tailwind is doing under the hood.
|
|
79
79
|
|
|
80
80
|
<div className="flex justify-center">
|
|
81
81
|
<img src={CssGeneration} alt="CSS Generation" />
|
|
@@ -109,12 +109,12 @@ Ideally you only add the pattern that is used in your repo.
|
|
|
109
109
|
Calling out that this is still an experimental feature for the VSCode plugin.
|
|
110
110
|
|
|
111
111
|
### Inline fold VSCode extension
|
|
112
|
+
|
|
112
113
|
Using tailwind often results in long class names, that can even span over multiple lines.
|
|
113
114
|
Inline fold is a great extension that hides/ shows long class strings.
|
|
114
115
|
|
|
115
116
|
Check it out [here](https://marketplace.visualstudio.com/items?itemName=moalamri.inline-fold):
|
|
116
117
|
|
|
117
|
-
|
|
118
118
|
<div className="flex justify-center">
|
|
119
119
|
<img src={InlineFold} alt="Inline fold VSCode extension" />
|
|
120
120
|
</div>
|
|
@@ -122,4 +122,4 @@ Check it out [here](https://marketplace.visualstudio.com/items?itemName=moalamri
|
|
|
122
122
|
### Prettier plugin
|
|
123
123
|
|
|
124
124
|
Tailwind now has prettier support! 🎉 This [prettier plugin](https://github.com/tailwindlabs/prettier-plugin-tailwindcss) will order your classnames for you.
|
|
125
|
-
We
|
|
125
|
+
We'd highly recommend it for the sake of consistency. The Tailwind docs even have a guide [here](https://tailwindcss.com/blog/automatic-class-sorting-with-prettier).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Description, Meta, Story, Unstyled } from
|
|
2
|
-
import { Card } from
|
|
3
|
-
import * as Examples from
|
|
1
|
+
import { Description, Meta, Story, Unstyled } from '@storybook/blocks'
|
|
2
|
+
import { Card } from '~components/Card'
|
|
3
|
+
import * as Examples from './pseudo-states.stories'
|
|
4
4
|
|
|
5
5
|
<Meta of={Examples} />
|
|
6
6
|
|
|
@@ -12,8 +12,8 @@ import * as Examples from "./pseudo-states.stories"
|
|
|
12
12
|
<Card variant="informative" classNameOverride="w-fit mb-24">
|
|
13
13
|
<div className="font-family-paragraph p-24">
|
|
14
14
|
<p>
|
|
15
|
-
Pseudo selectors can be used to apply standard Tailwind utility
|
|
16
|
-
|
|
15
|
+
Pseudo selectors can be used to apply standard Tailwind utility classes under certain pseudo
|
|
16
|
+
states, such as on hover or focus.
|
|
17
17
|
</p>
|
|
18
18
|
<p>
|
|
19
19
|
Read more on Tailwind's pseudo selectors
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { Meta } from
|
|
2
|
-
import AnatomyDiagram from
|
|
1
|
+
import { Meta } from '@storybook/blocks'
|
|
2
|
+
import AnatomyDiagram from '../assets/tw-anatomy.png'
|
|
3
3
|
|
|
4
4
|
<Meta title="Guides/Tailwind/Overview" />
|
|
5
5
|
|
|
6
6
|
# Overview
|
|
7
7
|
|
|
8
|
-
<br/>
|
|
8
|
+
<br />
|
|
9
9
|
|
|
10
10
|
## Caveat before use
|
|
11
|
+
|
|
11
12
|
This is an early release of the Kaizen Tailwind Preset - the API may change and evolve as we receive feedback from our teams. We will endeavour to assist where possible if classes or utilities are updated in the future.
|
|
12
13
|
|
|
13
14
|
## What our package does
|
|
15
|
+
|
|
14
16
|
The `@kaizen/tailwind` package is essentially a custom Tailwind preset. For more information about Tailwind presets, see their docs [here](https://tailwindcss.com/docs/presets). This package does not change how Tailwind works; it only defines the suffixes that can be applied when constructing utility classes.
|
|
15
17
|
To see a list of utilities generated by our preset, see our [Utility Class Reference Docs](/story/systems-tailwind-utility-class-references-utility-class-references--page).
|
|
16
18
|
The following diagram shows the construction of a utility class that adds a background of `blue-400` on hover. The modifier `hover:` and the prefix `bg-` are part of Tailwind by default. The suffix `gray-400` is defined by our preset, and represents one of our color design tokens.
|
|
17
19
|
|
|
18
|
-
|
|
19
20
|
<img src={AnatomyDiagram} alt="Tailwind utility class anatomy" />
|
|
20
21
|
|
|
21
22
|
```css
|
|
22
23
|
.hover\:bg-blue-400:hover {
|
|
23
24
|
--tw-bg-opacity: 1;
|
|
24
|
-
background-color: rgb(0 139 214 / var(--tw-bg-opacity))
|
|
25
|
+
background-color: rgb(0 139 214 / var(--tw-bg-opacity));
|
|
25
26
|
}
|
|
26
27
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Description, Meta, Story, Unstyled } from
|
|
2
|
-
import { Card } from
|
|
3
|
-
import * as Examples from
|
|
1
|
+
import { Description, Meta, Story, Unstyled } from '@storybook/blocks'
|
|
2
|
+
import { Card } from '~components/Card'
|
|
3
|
+
import * as Examples from './margin.stories'
|
|
4
4
|
|
|
5
5
|
<Meta of={Examples} />
|
|
6
6
|
|
|
@@ -12,12 +12,12 @@ import * as Examples from "./margin.stories"
|
|
|
12
12
|
<Card variant="informative" classNameOverride="w-fit mb-24">
|
|
13
13
|
<div className="font-family-paragraph p-24">
|
|
14
14
|
<p>
|
|
15
|
-
The padding prefix 'm-' has been used in the examples in this
|
|
16
|
-
|
|
15
|
+
The padding prefix 'm-' has been used in the examples in this document, which
|
|
16
|
+
compiles to the `margin` property in CSS.
|
|
17
17
|
</p>
|
|
18
18
|
<p>
|
|
19
|
-
Note that there are other prefixes (such as `ml-` for `margin-left`)
|
|
20
|
-
|
|
19
|
+
Note that there are other prefixes (such as `ml-` for `margin-left`) that can be used
|
|
20
|
+
instead. Available padding prefixes can be referenced
|
|
21
21
|
<a href="https://tailwindcss.com/docs/margin#basic-usage">here</a>.
|
|
22
22
|
</p>
|
|
23
23
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { type Meta, type StoryFn } from '@storybook/react'
|
|
3
3
|
import classnames from 'classnames'
|
|
4
4
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
5
5
|
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Description, Meta, Story, Unstyled } from
|
|
2
|
-
import { Card } from
|
|
3
|
-
import * as Examples from
|
|
1
|
+
import { Description, Meta, Story, Unstyled } from '@storybook/blocks'
|
|
2
|
+
import { Card } from '~components/Card'
|
|
3
|
+
import * as Examples from './padding.stories'
|
|
4
4
|
|
|
5
5
|
<Meta of={Examples} />
|
|
6
6
|
|
|
@@ -12,12 +12,12 @@ import * as Examples from "./padding.stories"
|
|
|
12
12
|
<Card variant="informative" classNameOverride="w-fit mb-24">
|
|
13
13
|
<div className="font-family-paragraph p-24">
|
|
14
14
|
<p>
|
|
15
|
-
The padding prefix 'p-' has been used in the examples in this
|
|
16
|
-
|
|
15
|
+
The padding prefix 'p-' has been used in the examples in this document, which
|
|
16
|
+
compiles to the `padding` property in CSS.
|
|
17
17
|
</p>
|
|
18
18
|
<p>
|
|
19
|
-
Note that there are other prefixes (such as `pl-` for `padding-left`)
|
|
20
|
-
|
|
19
|
+
Note that there are other prefixes (such as `pl-` for `padding-left`) that can be used
|
|
20
|
+
instead. Available padding prefixes can be referenced
|
|
21
21
|
<a href="https://tailwindcss.com/docs/padding#basic-usage">here</a>.
|
|
22
22
|
</p>
|
|
23
23
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { type Meta, type StoryFn } from '@storybook/react'
|
|
3
3
|
import classnames from 'classnames'
|
|
4
4
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
5
5
|
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { type Meta, type StoryFn } from '@storybook/react'
|
|
3
3
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
4
4
|
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
5
5
|
import { kaizenTailwindTheme } from '~tailwind/tailwind-presets'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { StoryFn } from '@storybook/react'
|
|
2
|
+
import { type StoryFn } from '@storybook/react'
|
|
3
3
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
4
4
|
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
5
5
|
import { kaizenTailwindTheme } from '~tailwind/tailwind-presets'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { type Meta, type StoryFn } from '@storybook/react'
|
|
3
3
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
4
4
|
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
5
5
|
import { kaizenTailwindTheme } from '~tailwind/tailwind-presets'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { type Meta, type StoryFn } from '@storybook/react'
|
|
3
3
|
import classnames from 'classnames'
|
|
4
4
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
5
5
|
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { type Meta, type StoryFn } from '@storybook/react'
|
|
3
3
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
4
4
|
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
5
5
|
import { kaizenTailwindTheme } from '~tailwind/tailwind-presets'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { StoryFn } from '@storybook/react'
|
|
2
|
+
import { type StoryFn } from '@storybook/react'
|
|
3
3
|
import classnames from 'classnames'
|
|
4
4
|
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
5
5
|
import { flattenEntries } from '~tailwind/_docs/utils/flattenEntries'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Meta, Unstyled } from
|
|
2
|
-
import { LinkTo } from
|
|
3
|
-
import CopyUtilityClass from
|
|
4
|
-
import UtilitySearchResult from
|
|
5
|
-
import { TailwindStoryTemplate } from
|
|
1
|
+
import { Meta, Unstyled } from '@storybook/blocks'
|
|
2
|
+
import { LinkTo } from '~storybook/components/LinkTo'
|
|
3
|
+
import CopyUtilityClass from '~tailwind/_docs/assets/copy-utility-class.gif?url'
|
|
4
|
+
import UtilitySearchResult from '~tailwind/_docs/assets/utility-search-result.png?url'
|
|
5
|
+
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
6
6
|
|
|
7
7
|
<Meta title="Guides/Tailwind/Utility Class References/Overview" />
|
|
8
8
|
|
|
@@ -18,26 +18,24 @@ As an example, `borderColor` is listed in this section because we have a custom
|
|
|
18
18
|
- [Structure](#structure)
|
|
19
19
|
- [Example usage](#example-usage)
|
|
20
20
|
|
|
21
|
-
<br/>
|
|
21
|
+
<br />
|
|
22
22
|
|
|
23
23
|
## Structure
|
|
24
24
|
|
|
25
25
|
The references provide the following structure for each utility class:
|
|
26
26
|
|
|
27
27
|
<Unstyled>
|
|
28
|
-
<div className="w-100">
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/>
|
|
36
|
-
</div>
|
|
28
|
+
<div className="w-100">
|
|
29
|
+
<TailwindStoryTemplate
|
|
30
|
+
compiledCssPropertyName="width"
|
|
31
|
+
classKeyValues={[{ utilityClassName: 'text-heading-1', cssProperty: '2.125rem' }]}
|
|
32
|
+
renderExampleComponent={(cssProperty) => <p style={{ fontSize: cssProperty }}>Aa</p>}
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
37
35
|
</Unstyled>
|
|
38
36
|
|
|
39
|
-
<br/>
|
|
40
|
-
<br/>
|
|
37
|
+
<br />
|
|
38
|
+
<br />
|
|
41
39
|
|
|
42
40
|
### Utility Class
|
|
43
41
|
|
|
@@ -51,7 +49,7 @@ Represents the CSS property that Tailwind will compile for you when it recognize
|
|
|
51
49
|
|
|
52
50
|
A visual representation of the CSS generated by the utility class. You can inspect this element in the DOM to see the utility class in action.
|
|
53
51
|
|
|
54
|
-
<br/>
|
|
52
|
+
<br />
|
|
55
53
|
|
|
56
54
|
## Example usage
|
|
57
55
|
|
|
@@ -69,18 +67,21 @@ A visual representation of the CSS generated by the utility class. You can inspe
|
|
|
69
67
|
<img src={UtilitySearchResult} alt="Utility class search result" />
|
|
70
68
|
</div>
|
|
71
69
|
|
|
72
|
-
<p>
|
|
70
|
+
<p>
|
|
71
|
+
Can't find it here? That means we don't have a custom preset for it, and the utility
|
|
72
|
+
class you need will be unchanged from the Tailwind Default.
|
|
73
|
+
</p>
|
|
73
74
|
<p>Search in the [Tailwind docs](https://tailwindcss.com/docs/installation) instead.</p>
|
|
74
75
|
|
|
75
|
-
<br/>
|
|
76
|
-
<br/>
|
|
76
|
+
<br />
|
|
77
|
+
<br />
|
|
77
78
|
|
|
78
79
|
### 2. Find the utility class that compiles to the desired CSS, and copy it
|
|
79
80
|
|
|
80
81
|
<img src={CopyUtilityClass} alt="Copy utility class" />
|
|
81
82
|
|
|
82
|
-
<br/>
|
|
83
|
-
<br/>
|
|
83
|
+
<br />
|
|
84
|
+
<br />
|
|
84
85
|
|
|
85
86
|
### 3. Add the utility class to the element
|
|
86
87
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Canvas, Meta } from
|
|
2
|
-
import * as Examples from
|
|
1
|
+
import { Canvas, Meta } from '@storybook/blocks'
|
|
2
|
+
import * as Examples from './working-with-tailwind.stories'
|
|
3
3
|
|
|
4
4
|
<Meta of={Examples} />
|
|
5
5
|
|
|
@@ -12,11 +12,11 @@ This page describes and demonstrates the main intended use cases for this packag
|
|
|
12
12
|
- [Creating bespoke components](#creating-bespoke-components)
|
|
13
13
|
- [Recommended escape hatch](#recommended-escape-hatch)
|
|
14
14
|
|
|
15
|
-
<br/>
|
|
15
|
+
<br />
|
|
16
16
|
|
|
17
17
|
## Spacing and layouts
|
|
18
18
|
|
|
19
|
-
For information about Cultureamp's spacing and layout system in general, see [here](/story/systems-layout-and-spacing--page)
|
|
19
|
+
For information about Cultureamp's spacing and layout system in general, see [here](/story/systems-layout-and-spacing--page).
|
|
20
20
|
|
|
21
21
|
When building a page, ideally [Kaizen](https://github.com/cultureamp/kaizen-design-system) components should be used as much as possible, with the front-end engineer responsible for the spacing between them. In these cases, our Tailwind preset makes it easy by adding our spacing tokens to Tailwind's core spacing modules.
|
|
22
22
|
|
|
@@ -33,7 +33,7 @@ Here's a more complex example, where some `<Card>` components and text have been
|
|
|
33
33
|
|
|
34
34
|
<Canvas of={Examples.TailwindExampleSpacingAndLayoutsComplex} />
|
|
35
35
|
|
|
36
|
-
<br/>
|
|
36
|
+
<br />
|
|
37
37
|
|
|
38
38
|
## Altering Kaizen components with classNameOverride
|
|
39
39
|
|
|
@@ -46,20 +46,22 @@ In this example, a Tailwind css rule is being applied to a Kaizen `<Heading />`
|
|
|
46
46
|
|
|
47
47
|
<Canvas of={Examples.TailwindExampleClassNameOverrideHeading} />
|
|
48
48
|
|
|
49
|
-
- first-letter:capitalize
|
|
49
|
+
- `first-letter:capitalize`: Adds text-transform: capitalize on the first-letter pseudo selector
|
|
50
50
|
|
|
51
|
-
<br/>
|
|
51
|
+
<br />
|
|
52
52
|
|
|
53
53
|
## Creating bespoke components
|
|
54
|
+
|
|
54
55
|
Occasionally snowflakes need to be created. This package provides common utilities based on our design tokens, such as color, border-radius, and font-family. Ideally, as much styling of bespoke components should be handled with Tailwind, but keep in mind that scss can still be used when necessary.
|
|
55
56
|
|
|
56
57
|
Here is an example of our TW package being used to create a bespoke, non-Kaizen component:
|
|
57
58
|
|
|
58
59
|
<Canvas of={Examples.TailwindExampleSnowflake} />
|
|
59
60
|
|
|
60
|
-
<br/>
|
|
61
|
+
<br />
|
|
61
62
|
|
|
62
63
|
### The container div
|
|
64
|
+
|
|
63
65
|
- `w-[250px]`: Adds `width: 250px`. This is an example of an arbitrary value being used to inject a custom suffix
|
|
64
66
|
- `rounded`: Adds `border-radius: 7px`. This is one of our custom preset values
|
|
65
67
|
- `border-dashed`: Adds `border-style: dashed`
|
|
@@ -68,18 +70,20 @@ Here is an example of our TW package being used to create a bespoke, non-Kaizen
|
|
|
68
70
|
- `text-center`: Adds `text-align: center`
|
|
69
71
|
|
|
70
72
|
### The p tag
|
|
73
|
+
|
|
71
74
|
- `m-0`: Adds `margin: 0`
|
|
72
75
|
- `p-12`: Adds `padding: .75rem` (12px = 0.75rem)
|
|
73
76
|
- `pl-16`: Adds `padding-left: 1rem` (16px = 1rem)
|
|
74
77
|
- `font-family-paragraph`: Adds `font-family: "Inter", "Noto Sans", ...`
|
|
75
78
|
- `text-blue-500`: Adds `color: #0168b3` (our blue-500 design token)
|
|
76
79
|
|
|
77
|
-
<br/>
|
|
80
|
+
<br />
|
|
78
81
|
|
|
79
82
|
## Recommended Escape Hatch
|
|
80
83
|
|
|
81
84
|
If you find yourself needing to add styles in a way that is unsupported or otherwise difficult in Tailwind, the recommended alternative is CSS. CSS classes can be added alongside Tailwind utility classes without trouble, and the Tailwind docs recommend some useful post-css plugins [here](https://tailwindcss.com/docs/using-with-preprocessors#using-sass-less-or-stylus).
|
|
82
85
|
|
|
83
86
|
### Why not SCSS?
|
|
87
|
+
|
|
84
88
|
- SCSS is currently a contained option, so writing new SCSS in our codebases is discouraged.
|
|
85
89
|
- The Tailwind docs explicitly recommend <em>not</em> using Tailwind with preprocessors, as it leads to all sorts of quirks and work-arounds. Read more [here](https://tailwindcss.com/docs/using-with-preprocessors#using-sass-less-or-stylus).
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { StoryFn } from '@storybook/react'
|
|
2
|
+
import { type StoryFn } from '@storybook/react'
|
|
3
|
+
import { Button } from '~components/Button'
|
|
3
4
|
import { Card } from '~components/Card'
|
|
4
5
|
import { Heading } from '~components/Heading'
|
|
5
6
|
import { CustomSurvey, CustomUnattributedSurvey } from '~components/Illustration'
|
|
6
7
|
import { Skirt } from '~components/Skirt'
|
|
7
|
-
import { Button } from '~components/__actions__/v2'
|
|
8
8
|
import { TailwindStoryTemplate } from '../utils/TailwindStoryTemplate'
|
|
9
9
|
|
|
10
10
|
export default {
|
package/src/tailwind-presets.ts
CHANGED