@kaizen/tailwind 1.3.10 → 1.3.12
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/cjs/kz-spacing.cjs +2 -2
- package/dist/cjs/tailwind-presets.cjs +65 -65
- package/dist/esm/kz-spacing.mjs +2 -2
- package/dist/esm/tailwind-presets.mjs +65 -65
- package/dist/types/index.d.ts +1 -1
- 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 +13 -20
- package/src/_docs/pages/borders/border-color.mdx +2 -2
- package/src/_docs/pages/borders/border-color.stories.tsx +14 -20
- package/src/_docs/pages/borders/border-radius.mdx +2 -2
- package/src/_docs/pages/borders/border-radius.stories.tsx +18 -22
- package/src/_docs/pages/borders/border-spacing.mdx +2 -2
- package/src/_docs/pages/borders/border-spacing.stories.tsx +15 -19
- package/src/_docs/pages/borders/border-width.mdx +8 -9
- package/src/_docs/pages/borders/border-width.stories.tsx +18 -22
- package/src/_docs/pages/configuration.mdx +18 -22
- 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 +17 -19
- package/src/_docs/pages/getting-started.mdx +9 -9
- package/src/_docs/pages/modifiers/media-queries.mdx +2 -2
- package/src/_docs/pages/modifiers/media-queries.stories.tsx +14 -24
- package/src/_docs/pages/modifiers/pseudo-states.mdx +5 -5
- package/src/_docs/pages/modifiers/pseudo-states.stories.tsx +10 -16
- 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 +17 -22
- package/src/_docs/pages/spacing/padding.mdx +7 -7
- package/src/_docs/pages/spacing/padding.stories.tsx +17 -24
- package/src/_docs/pages/typography/font-family.mdx +2 -2
- package/src/_docs/pages/typography/font-family.stories.tsx +15 -19
- package/src/_docs/pages/typography/font-size.mdx +2 -2
- package/src/_docs/pages/typography/font-size.stories.tsx +11 -12
- package/src/_docs/pages/typography/font-weight.mdx +2 -2
- package/src/_docs/pages/typography/font-weight.stories.tsx +15 -19
- package/src/_docs/pages/typography/line-height.mdx +2 -2
- package/src/_docs/pages/typography/line-height.stories.tsx +17 -23
- package/src/_docs/pages/typography/max-text-width.mdx +2 -2
- package/src/_docs/pages/typography/max-text-width.stories.tsx +25 -29
- package/src/_docs/pages/typography/text-color.mdx +2 -2
- package/src/_docs/pages/typography/text-color.stories.tsx +16 -17
- package/src/_docs/pages/utility-class-helpers-overview.mdx +24 -23
- package/src/_docs/pages/working-with-tailwind.mdx +11 -7
- package/src/_docs/pages/working-with-tailwind.stories.tsx +12 -21
- package/src/_docs/utils/TailwindStoryTemplate/TailwindStoryTemplate.tsx +52 -42
- package/src/_docs/utils/TailwindStoryTemplate/components/CardContent/CardContent.tsx +5 -8
- package/src/_docs/utils/TailwindStoryTemplate/components/CardContent/index.ts +1 -1
- package/src/_docs/utils/TailwindStoryTemplate/components/CodeSnippet/CodeSnippet.tsx +3 -3
- package/src/_docs/utils/TailwindStoryTemplate/components/CodeSnippet/index.ts +1 -1
- package/src/_docs/utils/TailwindStoryTemplate/index.ts +1 -1
- package/src/_docs/utils/flattenEntries.ts +12 -13
- package/src/_docs/utils/utilityDescription.ts +1 -4
- package/src/index.ts +1 -1
- package/src/kz-height.ts +10 -10
- package/src/kz-spacing.spec.ts +24 -24
- package/src/kz-spacing.ts +21 -22
- package/src/tailwind-presets.ts +68 -68
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Meta, StoryFn } from
|
|
3
|
-
import { TailwindStoryTemplate } from
|
|
4
|
-
import { utilityDescription } from
|
|
5
|
-
import { kaizenTailwindTheme } from
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react'
|
|
3
|
+
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
4
|
+
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
5
|
+
import { kaizenTailwindTheme } from '~tailwind/tailwind-presets'
|
|
6
6
|
|
|
7
|
-
const prefix =
|
|
8
|
-
const classEntries:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
)
|
|
7
|
+
const prefix = 'border-spacing-'
|
|
8
|
+
const classEntries: { utilityClassName: string; cssProperty: string }[] = Object.entries(
|
|
9
|
+
kaizenTailwindTheme.spacing ?? [],
|
|
10
|
+
).map(([suffix, cssProperty]) => ({
|
|
11
|
+
utilityClassName: `${prefix}${suffix}`,
|
|
12
|
+
cssProperty,
|
|
13
|
+
}))
|
|
15
14
|
|
|
16
15
|
export default {
|
|
17
|
-
title:
|
|
16
|
+
title: 'Guides/Tailwind/Utility Class References/Borders/Border Spacing',
|
|
18
17
|
parameters: {
|
|
19
18
|
a11y: { disable: true },
|
|
20
19
|
chromatic: { disable: false },
|
|
21
|
-
docsLayout:
|
|
20
|
+
docsLayout: 'fullPage',
|
|
22
21
|
docs: {
|
|
23
22
|
description: {
|
|
24
23
|
component: utilityDescription(prefix, classEntries[0].utilityClassName),
|
|
@@ -27,9 +26,7 @@ export default {
|
|
|
27
26
|
},
|
|
28
27
|
} satisfies Meta
|
|
29
28
|
|
|
30
|
-
export const BorderSpacing: StoryFn
|
|
31
|
-
isReversed,
|
|
32
|
-
}) => (
|
|
29
|
+
export const BorderSpacing: StoryFn = () => (
|
|
33
30
|
<TailwindStoryTemplate
|
|
34
31
|
compiledCssPropertyName="border-spacing"
|
|
35
32
|
classKeyValues={classEntries}
|
|
@@ -47,6 +44,5 @@ export const BorderSpacing: StoryFn<{ isReversed: boolean }> = ({
|
|
|
47
44
|
</tbody>
|
|
48
45
|
</table>
|
|
49
46
|
)}
|
|
50
|
-
isReversed={isReversed}
|
|
51
47
|
/>
|
|
52
48
|
)
|
|
@@ -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,25 +1,24 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Meta, StoryFn } from
|
|
3
|
-
import classnames from
|
|
4
|
-
import { TailwindStoryTemplate } from
|
|
5
|
-
import { utilityDescription } from
|
|
6
|
-
import { kaizenTailwindTheme } from
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react'
|
|
3
|
+
import classnames from 'classnames'
|
|
4
|
+
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
5
|
+
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
6
|
+
import { kaizenTailwindTheme } from '~tailwind/tailwind-presets'
|
|
7
7
|
|
|
8
|
-
const prefix =
|
|
9
|
-
const classEntries:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
)
|
|
8
|
+
const prefix = 'border-'
|
|
9
|
+
const classEntries: { utilityClassName: string; cssProperty: string }[] = Object.entries(
|
|
10
|
+
kaizenTailwindTheme.borderWidth ?? [],
|
|
11
|
+
).map(([suffix, cssProperty]) => ({
|
|
12
|
+
utilityClassName: `${prefix}${suffix}`,
|
|
13
|
+
cssProperty,
|
|
14
|
+
}))
|
|
16
15
|
|
|
17
16
|
export default {
|
|
18
|
-
title:
|
|
17
|
+
title: 'Guides/Tailwind/Utility Class References/Borders/Border Width',
|
|
19
18
|
parameters: {
|
|
20
19
|
a11y: { disable: true },
|
|
21
20
|
chromatic: { disable: false },
|
|
22
|
-
docsLayout:
|
|
21
|
+
docsLayout: 'fullPage',
|
|
23
22
|
docs: {
|
|
24
23
|
description: {
|
|
25
24
|
component: utilityDescription(prefix, classEntries[1].utilityClassName),
|
|
@@ -28,20 +27,17 @@ export default {
|
|
|
28
27
|
},
|
|
29
28
|
} satisfies Meta
|
|
30
29
|
|
|
31
|
-
export const BorderWidth: StoryFn
|
|
32
|
-
isReversed,
|
|
33
|
-
}) => (
|
|
30
|
+
export const BorderWidth: StoryFn = () => (
|
|
34
31
|
<TailwindStoryTemplate
|
|
35
32
|
compiledCssPropertyName="border-width"
|
|
36
33
|
classKeyValues={classEntries}
|
|
37
34
|
renderExampleComponent={(utilityClass): React.ReactElement => (
|
|
38
35
|
<div
|
|
39
36
|
className={classnames(
|
|
40
|
-
|
|
41
|
-
!utilityClass.includes(
|
|
37
|
+
'w-[100px] h-[100px] border rounded',
|
|
38
|
+
!utilityClass.includes('-DEFAULT') && utilityClass,
|
|
42
39
|
)}
|
|
43
40
|
/>
|
|
44
41
|
)}
|
|
45
|
-
isReversed={isReversed}
|
|
46
42
|
/>
|
|
47
43
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta } from
|
|
2
|
-
import { InlineNotification } from
|
|
1
|
+
import { Meta } 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,21 @@ 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
|
-
<InlineNotification
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
title="Changing the selector"
|
|
68
|
-
>
|
|
69
|
-
We advise using an <code>id</code> with <code>"#root"</code> as the default selector. Using different id's, classes or HTML elements like <code>body</code> as the selector could result in:
|
|
61
|
+
<InlineNotification persistent type="cautionary" style="inline" title="Changing the selector">
|
|
62
|
+
We advise using an <code>id</code> with <code>"#root"</code> as the default selector.
|
|
63
|
+
Using different id's, classes or HTML elements like <code>body</code> as the selector could
|
|
64
|
+
result in:
|
|
70
65
|
<ul>
|
|
71
66
|
<li>
|
|
72
67
|
Utility classes not superseding Kaizen defaults when using <code>classNameOverride</code>
|
|
73
68
|
</li>
|
|
74
69
|
<li>
|
|
75
|
-
Duplication of utillity classes in your CSS bundle caused by consuming components with
|
|
70
|
+
Duplication of utillity classes in your CSS bundle caused by consuming components with
|
|
71
|
+
different <code>important</code> selectors
|
|
76
72
|
</li>
|
|
77
73
|
</ul>
|
|
78
74
|
</InlineNotification>
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Meta, StoryFn } from
|
|
3
|
-
import classnames from
|
|
4
|
-
import { TailwindStoryTemplate } from
|
|
5
|
-
import { utilityDescription } from
|
|
6
|
-
import { kaizenTailwindTheme } from
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react'
|
|
3
|
+
import classnames from 'classnames'
|
|
4
|
+
import { TailwindStoryTemplate } from '~tailwind/_docs/utils/TailwindStoryTemplate'
|
|
5
|
+
import { utilityDescription } from '~tailwind/_docs/utils/utilityDescription'
|
|
6
|
+
import { kaizenTailwindTheme } from '~tailwind/tailwind-presets'
|
|
7
7
|
|
|
8
|
-
const prefix =
|
|
9
|
-
const classEntries:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
)
|
|
8
|
+
const prefix = 'shadow-'
|
|
9
|
+
const classEntries: { utilityClassName: string; cssProperty: string }[] = Object.entries(
|
|
10
|
+
kaizenTailwindTheme.boxShadow ?? [],
|
|
11
|
+
).map(([suffix, cssProperty]) => ({
|
|
12
|
+
utilityClassName: `${prefix}${suffix}`,
|
|
13
|
+
cssProperty,
|
|
14
|
+
}))
|
|
16
15
|
|
|
17
16
|
export default {
|
|
18
|
-
title:
|
|
17
|
+
title: 'Guides/Tailwind/Utility Class References/Effects/Box Shadow',
|
|
19
18
|
parameters: {
|
|
20
19
|
a11y: { disable: true },
|
|
21
20
|
chromatic: { disable: false },
|
|
22
|
-
docsLayout:
|
|
21
|
+
docsLayout: 'fullPage',
|
|
23
22
|
docs: {
|
|
24
23
|
description: {
|
|
25
24
|
component: utilityDescription(prefix, classEntries[0].utilityClassName),
|
|
@@ -28,13 +27,12 @@ export default {
|
|
|
28
27
|
},
|
|
29
28
|
} satisfies Meta
|
|
30
29
|
|
|
31
|
-
export const BoxShadow: StoryFn
|
|
30
|
+
export const BoxShadow: StoryFn = () => (
|
|
32
31
|
<TailwindStoryTemplate
|
|
33
32
|
compiledCssPropertyName="box-shadow"
|
|
34
33
|
classKeyValues={classEntries}
|
|
35
34
|
renderExampleComponent={(utilityClass): React.ReactElement => (
|
|
36
|
-
<div className={classnames(
|
|
35
|
+
<div className={classnames('w-[100px] h-[100px]', utilityClass)} />
|
|
37
36
|
)}
|
|
38
|
-
isReversed={isReversed}
|
|
39
37
|
/>
|
|
40
38
|
)
|
|
@@ -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,7 +18,7 @@ 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
|
|
|
@@ -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,
|
|
@@ -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>
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Meta, StoryFn } from
|
|
3
|
-
import { Heading } from
|
|
4
|
-
import { Text } from
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react'
|
|
3
|
+
import { Heading } from '~components/Heading'
|
|
4
|
+
import { Text } from '~components/Text'
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
title:
|
|
7
|
+
title: 'Guides/Tailwind/Utility Class References/Modifiers/Media Queries',
|
|
8
8
|
parameters: {
|
|
9
|
-
docsLayout:
|
|
9
|
+
docsLayout: 'fullPage',
|
|
10
10
|
docs: {
|
|
11
11
|
a11y: { disable: true },
|
|
12
12
|
description: {
|
|
13
|
-
component:
|
|
14
|
-
"Require @kaizen/tailwind and add it into your tailwind config",
|
|
13
|
+
component: 'Require @kaizen/tailwind and add it into your tailwind config',
|
|
15
14
|
},
|
|
16
15
|
},
|
|
17
16
|
},
|
|
@@ -22,11 +21,7 @@ type QueryInfoProps = {
|
|
|
22
21
|
selectorValue: string
|
|
23
22
|
children: React.ReactElement
|
|
24
23
|
}
|
|
25
|
-
const QueryInfo = ({
|
|
26
|
-
selector,
|
|
27
|
-
selectorValue,
|
|
28
|
-
children,
|
|
29
|
-
}: QueryInfoProps): React.ReactElement => (
|
|
24
|
+
const QueryInfo = ({ selector, selectorValue, children }: QueryInfoProps): React.ReactElement => (
|
|
30
25
|
<div className="my-12">
|
|
31
26
|
<Text variant="intro-lede">Pseudo selector: {selector}</Text>
|
|
32
27
|
<Text variant="body">Breakpoint: {selectorValue}</Text>
|
|
@@ -39,8 +34,8 @@ const QueryInfo = ({
|
|
|
39
34
|
export const MediaQueries: StoryFn = () => (
|
|
40
35
|
<div className="py-32">
|
|
41
36
|
<Heading tag="p" variant="heading-4" classNameOverride="text-center">
|
|
42
|
-
These breakpoints activate <em>over</em> a certain screen width. Meaning
|
|
43
|
-
|
|
37
|
+
These breakpoints activate <em>over</em> a certain screen width. Meaning that bg-blue-400 will
|
|
38
|
+
be applied when the screen gets <em>wider</em>.
|
|
44
39
|
</Heading>
|
|
45
40
|
<QueryInfo selector="md" selectorValue="768px">
|
|
46
41
|
<div className="border-solid md:bg-blue-400 h-[50px] w-full rounded" />
|
|
@@ -54,26 +49,21 @@ export const MediaQueries: StoryFn = () => (
|
|
|
54
49
|
export const ArbitraryMediaQueries: StoryFn = () => (
|
|
55
50
|
<div className="py-32">
|
|
56
51
|
<Heading tag="p" variant="heading-4" classNameOverride="text-center">
|
|
57
|
-
Bespoke, one-off media queries can be created with arbitrary values. See
|
|
58
|
-
|
|
59
|
-
<a href="https://tailwindcss.com/docs/responsive-design#arbitrary-values">
|
|
60
|
-
Tailwind docs
|
|
61
|
-
</a>{" "}
|
|
52
|
+
Bespoke, one-off media queries can be created with arbitrary values. See the{' '}
|
|
53
|
+
<a href="https://tailwindcss.com/docs/responsive-design#arbitrary-values">Tailwind docs</a>{' '}
|
|
62
54
|
for more info.
|
|
63
55
|
</Heading>
|
|
64
56
|
|
|
65
57
|
<div className="py-32">
|
|
66
58
|
<Text variant="body">
|
|
67
|
-
<strong>Min-width breakpoint</strong> (applied when the screen gets
|
|
68
|
-
<em>wider</em>)
|
|
59
|
+
<strong>Min-width breakpoint</strong> (applied when the screen gets <em>wider</em>)
|
|
69
60
|
</Text>
|
|
70
61
|
<Text variant="body">In this example: min-[500px]:bg-blue-400</Text>
|
|
71
62
|
<div className="border-solid min-[500px]:bg-blue-400 h-[50px] w-full rounded-default" />
|
|
72
63
|
</div>
|
|
73
64
|
|
|
74
65
|
<Text variant="body">
|
|
75
|
-
<strong>Max-width breakpoint</strong> (applied when the screen gets
|
|
76
|
-
<em>slimmer</em>)
|
|
66
|
+
<strong>Max-width breakpoint</strong> (applied when the screen gets <em>slimmer</em>)
|
|
77
67
|
</Text>
|
|
78
68
|
<Text variant="body">In this example: max-[500px]:bg-blue-400</Text>
|
|
79
69
|
<div className="border-solid max-[500px]:bg-blue-400 h-[50px] w-full rounded-default" />
|
|
@@ -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,30 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { StickerSheet } from "~storybook/components/StickerSheet"
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react'
|
|
3
|
+
import { StickerSheet } from '~storybook/components/StickerSheet'
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
|
-
title:
|
|
6
|
+
title: 'Guides/Tailwind/Utility Class References/Modifiers/Pseudo Selectors',
|
|
8
7
|
parameters: {
|
|
9
8
|
a11y: { disable: true },
|
|
10
|
-
docsLayout:
|
|
9
|
+
docsLayout: 'fullPage',
|
|
11
10
|
docs: {
|
|
12
11
|
description: {
|
|
13
12
|
component:
|
|
14
|
-
|
|
13
|
+
'Add a modifier before a standard tailwind utility class to have it apply in certain states. For example, hover:text-blue-500 will set the font color to blue-500 on hover.',
|
|
15
14
|
},
|
|
16
15
|
},
|
|
17
16
|
},
|
|
18
17
|
} satisfies Meta
|
|
19
18
|
|
|
20
|
-
export const PseudoSelectors: StoryFn
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<StickerSheet isReversed={isReversed}>
|
|
24
|
-
<StickerSheet.Header
|
|
25
|
-
headings={["Utility Class", "Compiled CSS", "Example"]}
|
|
26
|
-
/>
|
|
27
|
-
<StickerSheet.Row rowTitle="hover">
|
|
19
|
+
export const PseudoSelectors: StoryFn = () => (
|
|
20
|
+
<StickerSheet headers={['Utility Class', 'Compiled CSS', 'Example']}>
|
|
21
|
+
<StickerSheet.Row header="hover">
|
|
28
22
|
<p className="font-family-paragraph">hover:bg-blue-200</p>
|
|
29
23
|
<p className="font-family-paragraph">background-color: #bde2f5</p>
|
|
30
24
|
<button
|
|
@@ -34,7 +28,7 @@ export const PseudoSelectors: StoryFn<{ isReversed: boolean }> = ({
|
|
|
34
28
|
Hover me
|
|
35
29
|
</button>
|
|
36
30
|
</StickerSheet.Row>
|
|
37
|
-
<StickerSheet.Row
|
|
31
|
+
<StickerSheet.Row header="focus">
|
|
38
32
|
<p className="font-family-paragraph">focus:bg-blue-200</p>
|
|
39
33
|
<p className="font-family-paragraph">background-color: #bde2f5</p>
|
|
40
34
|
<button
|
|
@@ -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>
|