@kaizen/tailwind 1.2.14 → 1.3.1

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.
Files changed (77) hide show
  1. package/dist/cjs/index.cjs +5 -0
  2. package/dist/cjs/kz-spacing.cjs +21 -0
  3. package/dist/cjs/tailwind-presets.cjs +112 -0
  4. package/dist/esm/index.mjs +1 -0
  5. package/dist/esm/kz-spacing.mjs +18 -0
  6. package/dist/esm/tailwind-presets.mjs +109 -0
  7. package/dist/{index.d.ts → types/index.d.ts} +0 -1
  8. package/dist/{kz-height.d.ts → types/kz-height.d.ts} +0 -1
  9. package/dist/{kz-spacing.d.ts → types/kz-spacing.d.ts} +0 -1
  10. package/dist/{tailwind-presets.d.ts → types/tailwind-presets.d.ts} +0 -1
  11. package/package.json +17 -6
  12. package/src/_docs/assets/copy-utility-class.gif +0 -0
  13. package/src/_docs/assets/css-generation.png +0 -0
  14. package/src/_docs/assets/inline-fold.gif +0 -0
  15. package/src/_docs/assets/tailwind-play.gif +0 -0
  16. package/src/_docs/assets/tw-anatomy.png +0 -0
  17. package/src/_docs/assets/utility-search-result.png +0 -0
  18. package/src/_docs/pages/backgrounds/background-color.mdx +10 -0
  19. package/src/_docs/pages/backgrounds/background-color.stories.tsx +43 -0
  20. package/src/_docs/pages/borders/border-color.mdx +10 -0
  21. package/src/_docs/pages/borders/border-color.stories.tsx +45 -0
  22. package/src/_docs/pages/borders/border-radius.mdx +10 -0
  23. package/src/_docs/pages/borders/border-radius.stories.tsx +47 -0
  24. package/src/_docs/pages/borders/border-spacing.mdx +10 -0
  25. package/src/_docs/pages/borders/border-spacing.stories.tsx +52 -0
  26. package/src/_docs/pages/borders/border-width.mdx +28 -0
  27. package/src/_docs/pages/borders/border-width.stories.tsx +47 -0
  28. package/src/_docs/pages/configuration.mdx +78 -0
  29. package/src/_docs/pages/contributing.mdx +38 -0
  30. package/src/_docs/pages/effects/shadow.mdx +10 -0
  31. package/src/_docs/pages/effects/shadow.stories.tsx +40 -0
  32. package/src/_docs/pages/getting-started.mdx +125 -0
  33. package/src/_docs/pages/modifiers/media-queries.mdx +16 -0
  34. package/src/_docs/pages/modifiers/media-queries.stories.tsx +81 -0
  35. package/src/_docs/pages/modifiers/pseudo-states.mdx +26 -0
  36. package/src/_docs/pages/modifiers/pseudo-states.stories.tsx +49 -0
  37. package/src/_docs/pages/overview.mdx +26 -0
  38. package/src/_docs/pages/spacing/margin.mdx +27 -0
  39. package/src/_docs/pages/spacing/margin.stories.tsx +49 -0
  40. package/src/_docs/pages/spacing/padding.mdx +27 -0
  41. package/src/_docs/pages/spacing/padding.stories.tsx +47 -0
  42. package/src/_docs/pages/typography/font-family.mdx +10 -0
  43. package/src/_docs/pages/typography/font-family.stories.tsx +41 -0
  44. package/src/_docs/pages/typography/font-size.mdx +10 -0
  45. package/src/_docs/pages/typography/font-size.stories.tsx +38 -0
  46. package/src/_docs/pages/typography/font-weight.mdx +10 -0
  47. package/src/_docs/pages/typography/font-weight.stories.tsx +41 -0
  48. package/src/_docs/pages/typography/line-height.mdx +10 -0
  49. package/src/_docs/pages/typography/line-height.stories.tsx +44 -0
  50. package/src/_docs/pages/typography/max-text-width.mdx +12 -0
  51. package/src/_docs/pages/typography/max-text-width.stories.tsx +60 -0
  52. package/src/_docs/pages/typography/text-color.mdx +10 -0
  53. package/src/_docs/pages/typography/text-color.stories.tsx +52 -0
  54. package/src/_docs/pages/utility-class-helpers-overview.mdx +95 -0
  55. package/src/_docs/pages/working-with-tailwind.mdx +85 -0
  56. package/src/_docs/pages/working-with-tailwind.stories.tsx +100 -0
  57. package/src/_docs/utils/TailwindStoryTemplate/TailwindStoryTemplate.tsx +81 -0
  58. package/src/_docs/utils/TailwindStoryTemplate/components/CardContent/CardContent.tsx +26 -0
  59. package/src/_docs/utils/TailwindStoryTemplate/components/CardContent/index.ts +1 -0
  60. package/src/_docs/utils/TailwindStoryTemplate/components/CodeSnippet/CodeSnippet.tsx +36 -0
  61. package/src/_docs/utils/TailwindStoryTemplate/components/CodeSnippet/index.ts +1 -0
  62. package/src/_docs/utils/TailwindStoryTemplate/index.ts +1 -0
  63. package/src/_docs/utils/flattenEntries.ts +37 -0
  64. package/src/_docs/utils/utilityDescription.ts +5 -0
  65. package/src/tailwind-presets.ts +53 -53
  66. package/dist/index.d.ts.map +0 -1
  67. package/dist/index.js +0 -18
  68. package/dist/index.js.map +0 -1
  69. package/dist/kz-height.d.ts.map +0 -1
  70. package/dist/kz-height.js +0 -16
  71. package/dist/kz-height.js.map +0 -1
  72. package/dist/kz-spacing.d.ts.map +0 -1
  73. package/dist/kz-spacing.js +0 -41
  74. package/dist/kz-spacing.js.map +0 -1
  75. package/dist/tailwind-presets.d.ts.map +0 -1
  76. package/dist/tailwind-presets.js +0 -112
  77. package/dist/tailwind-presets.js.map +0 -1
@@ -0,0 +1,47 @@
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
+
8
+ const prefix = "p-"
9
+ const classEntries: Array<{ utilityClassName: string; cssProperty: string }> =
10
+ Object.entries(kaizenTailwindTheme.spacing || []).map(
11
+ ([suffix, cssProperty]) => ({
12
+ utilityClassName: `${prefix}${suffix}`,
13
+ cssProperty,
14
+ })
15
+ )
16
+
17
+ export default {
18
+ title: "Guides/Tailwind/Utility Class References/Spacing/Padding",
19
+ parameters: {
20
+ a11y: { disable: true },
21
+ chromatic: { disable: false },
22
+ docsLayout: "fullPage",
23
+ docs: {
24
+ description: {
25
+ component: utilityDescription(prefix, classEntries[0].utilityClassName),
26
+ },
27
+ },
28
+ },
29
+ } satisfies Meta
30
+
31
+ export const Padding: StoryFn<{ isReversed: boolean }> = ({ isReversed }) => (
32
+ <TailwindStoryTemplate
33
+ compiledCssPropertyName="padding"
34
+ classKeyValues={classEntries}
35
+ renderExampleComponent={(utilityClass): React.ReactElement => (
36
+ <p
37
+ className={classnames(
38
+ "border border-purple-100 w-min rounded bg-blue-100",
39
+ utilityClass
40
+ )}
41
+ >
42
+ Padding
43
+ </p>
44
+ )}
45
+ isReversed={isReversed}
46
+ />
47
+ )
@@ -0,0 +1,10 @@
1
+ import { Description, Meta, Story } from "@storybook/blocks"
2
+ import * as Examples from "./font-family.stories"
3
+
4
+ <Meta of={Examples} />
5
+
6
+ # Font Family
7
+
8
+ <Description />
9
+
10
+ <Story of={Examples.FontFamily} />
@@ -0,0 +1,41 @@
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
+
7
+ const prefix = "font-"
8
+ const classEntries: Array<{ utilityClassName: string; cssProperty: string }> =
9
+ Object.entries(kaizenTailwindTheme.fontFamily || []).map(
10
+ ([suffix, cssPropertyArr]) => ({
11
+ utilityClassName: `${prefix}${suffix}`,
12
+ cssProperty: cssPropertyArr[0],
13
+ })
14
+ )
15
+
16
+ export default {
17
+ title: "Guides/Tailwind/Utility Class References/Typography/Font Family",
18
+ parameters: {
19
+ a11y: { disable: true },
20
+ chromatic: { disable: false },
21
+ docsLayout: "fullPage",
22
+ docs: {
23
+ description: {
24
+ component: utilityDescription(prefix, classEntries[0].utilityClassName),
25
+ },
26
+ },
27
+ },
28
+ } satisfies Meta
29
+
30
+ export const FontFamily: StoryFn<{ isReversed: boolean }> = ({
31
+ isReversed,
32
+ }) => (
33
+ <TailwindStoryTemplate
34
+ compiledCssPropertyName="font-family"
35
+ classKeyValues={classEntries}
36
+ renderExampleComponent={(utilityClass): React.ReactElement => (
37
+ <p className={utilityClass}>Aa</p>
38
+ )}
39
+ isReversed={isReversed}
40
+ />
41
+ )
@@ -0,0 +1,10 @@
1
+ import { Description, Meta, Story } from "@storybook/blocks"
2
+ import * as Examples from "./font-size.stories"
3
+
4
+ <Meta of={Examples} />
5
+
6
+ # Font Size
7
+
8
+ <Description />
9
+
10
+ <Story of={Examples.FontSize} />
@@ -0,0 +1,38 @@
1
+ import React from "react"
2
+ import { 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
+
7
+ const prefix = "text-"
8
+ const classEntries = Object.entries(kaizenTailwindTheme.fontSize || []).map(
9
+ ([suffix, cssProperty]) => ({
10
+ utilityClassName: `${prefix}${suffix}`,
11
+ cssProperty,
12
+ })
13
+ )
14
+
15
+ export default {
16
+ title: "Guides/Tailwind/Utility Class References/Typography/Font Size",
17
+ parameters: {
18
+ a11y: { disable: true },
19
+ chromatic: { disable: false },
20
+ docsLayout: "fullPage",
21
+ docs: {
22
+ description: {
23
+ component: utilityDescription(prefix, classEntries[0].utilityClassName),
24
+ },
25
+ },
26
+ },
27
+ }
28
+
29
+ export const FontSize: StoryFn<{ isReversed: boolean }> = ({ isReversed }) => (
30
+ <TailwindStoryTemplate
31
+ compiledCssPropertyName="font-size"
32
+ classKeyValues={classEntries}
33
+ renderExampleComponent={(utilityClass): React.ReactElement => (
34
+ <p className={utilityClass}>Aa</p>
35
+ )}
36
+ isReversed={isReversed}
37
+ />
38
+ )
@@ -0,0 +1,10 @@
1
+ import { Description, Meta, Story } from "@storybook/blocks"
2
+ import * as Examples from "./font-weight.stories"
3
+
4
+ <Meta of={Examples} />
5
+
6
+ # Font Weight
7
+
8
+ <Description />
9
+
10
+ <Story of={Examples.FontWeight} />
@@ -0,0 +1,41 @@
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
+
7
+ const prefix = "font-"
8
+ const classEntries: Array<{ utilityClassName: string; cssProperty: string }> =
9
+ Object.entries(kaizenTailwindTheme.fontWeight || []).map(
10
+ ([suffix, cssProperty]) => ({
11
+ utilityClassName: `${prefix}${suffix}`,
12
+ cssProperty,
13
+ })
14
+ )
15
+
16
+ export default {
17
+ title: "Guides/Tailwind/Utility Class References/Typography/Font Weight",
18
+ parameters: {
19
+ a11y: { disable: true },
20
+ chromatic: { disable: false },
21
+ docsLayout: "fullPage",
22
+ docs: {
23
+ description: {
24
+ component: utilityDescription(prefix, classEntries[0].utilityClassName),
25
+ },
26
+ },
27
+ },
28
+ } satisfies Meta
29
+
30
+ export const FontWeight: StoryFn<{ isReversed: boolean }> = ({
31
+ isReversed,
32
+ }) => (
33
+ <TailwindStoryTemplate
34
+ compiledCssPropertyName="font-weight"
35
+ classKeyValues={classEntries}
36
+ renderExampleComponent={(utilityClass): React.ReactElement => (
37
+ <p className={utilityClass}>Aa</p>
38
+ )}
39
+ isReversed={isReversed}
40
+ />
41
+ )
@@ -0,0 +1,10 @@
1
+ import { Description, Meta, Story } from "@storybook/blocks"
2
+ import * as Examples from "./line-height.stories"
3
+
4
+ <Meta of={Examples} />
5
+
6
+ # Line Height
7
+
8
+ <Description />
9
+
10
+ <Story of={Examples.LineHeight} />
@@ -0,0 +1,44 @@
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
+
8
+ const prefix = "leading-"
9
+ const classEntries: Array<{ utilityClassName: string; cssProperty: string }> =
10
+ Object.entries(kaizenTailwindTheme.lineHeight || []).map(
11
+ ([suffix, cssProperty]) => ({
12
+ utilityClassName: `${prefix}${suffix}`,
13
+ cssProperty,
14
+ })
15
+ )
16
+
17
+ export default {
18
+ title: "Guides/Tailwind/Utility Class References/Typography/Line Height",
19
+ parameters: {
20
+ a11y: { disable: true },
21
+ chromatic: { disable: false },
22
+ docsLayout: "fullPage",
23
+ docs: {
24
+ description: {
25
+ component: utilityDescription(prefix, classEntries[0].utilityClassName),
26
+ },
27
+ },
28
+ },
29
+ } satisfies Meta
30
+
31
+ export const LineHeight: StoryFn<{ isReversed: boolean }> = ({
32
+ isReversed,
33
+ }) => (
34
+ <TailwindStoryTemplate
35
+ compiledCssPropertyName="line-height"
36
+ classKeyValues={classEntries}
37
+ renderExampleComponent={(utilityClass): React.ReactElement => (
38
+ <p className={classnames("w-0", utilityClass)}>
39
+ Tutant Meenage Neetle Teetles
40
+ </p>
41
+ )}
42
+ isReversed={isReversed}
43
+ />
44
+ )
@@ -0,0 +1,12 @@
1
+ import { Description, Meta, Story } from "@storybook/blocks"
2
+ import * as Examples from "./max-text-width.stories"
3
+
4
+ <Meta of={Examples} />
5
+
6
+ # Max width of text elements
7
+
8
+ Each of our paragraph text sizes has a suggested max width for optimal reading. Following the same naming conventions as for font size ("text-...") and line height ("leading-..."), you can use the appropriate max width class ("max-w-...").
9
+
10
+ <Description />
11
+
12
+ <Story of={Examples.MaxTextWidth} />
@@ -0,0 +1,60 @@
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
+
7
+ const prefix = "max-w-"
8
+ const classEntries = Object.entries(
9
+ kaizenTailwindTheme.extend.maxWidth || []
10
+ ).map(([suffix, cssPropertyArr]) => ({
11
+ utilityClassName: `${prefix}${suffix}`,
12
+ cssProperty: cssPropertyArr as string,
13
+ }))
14
+
15
+ export default {
16
+ title: "Guides/Tailwind/Utility Class References/Typography/Max Text Width",
17
+ parameters: {
18
+ a11y: { disable: true },
19
+ chromatic: { disable: false },
20
+ docsLayout: "fullPage",
21
+ docs: {
22
+ description: {
23
+ component: utilityDescription(prefix, classEntries[0].utilityClassName),
24
+ },
25
+ },
26
+ },
27
+ } satisfies Meta
28
+
29
+ const fontClasses = {
30
+ "max-w-paragraph-lede": "text-paragraph-lede leading-paragraph-lede",
31
+ "max-w-paragraph": "text-paragraph leading-paragraph",
32
+ "max-w-paragraph-sm": "text-paragraph-sm leading-paragraph-sm",
33
+ "max-w-paragraph-xs": "text-paragraph-xs leading-paragraph-xs",
34
+ }
35
+
36
+ const getFontClass = (utilityClass: string): string =>
37
+ fontClasses[utilityClass as keyof typeof fontClasses] || ""
38
+
39
+ export const MaxTextWidth: StoryFn<{ isReversed: boolean }> = ({
40
+ isReversed,
41
+ }) => (
42
+ <TailwindStoryTemplate
43
+ compiledCssPropertyName="max-width"
44
+ classKeyValues={classEntries}
45
+ renderExampleComponent={(utilityClass): React.ReactElement => (
46
+ <>
47
+ <p className={[utilityClass, getFontClass(utilityClass)].join(" ")}>
48
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Iusto, optio
49
+ incidunt explicabo facilis ipsam, porro magni vero libero itaque rerum
50
+ deserunt quo molestiae expedita dolor? Alias iusto ad maiores odit! (
51
+ {[utilityClass, getFontClass(utilityClass)].join(" ")})
52
+ </p>
53
+ <code className="text-paragraph-sm bg-gray-300 py-4 px-8">
54
+ {[utilityClass, getFontClass(utilityClass)].join(" ")}
55
+ </code>
56
+ </>
57
+ )}
58
+ isReversed={isReversed}
59
+ />
60
+ )
@@ -0,0 +1,10 @@
1
+ import { Description, Meta, Story } from "@storybook/blocks"
2
+ import * as Examples from "./text-color.stories"
3
+
4
+ <Meta of={Examples} />
5
+
6
+ # Text Color
7
+
8
+ <Description />
9
+
10
+ <Story of={Examples.TextColor} />
@@ -0,0 +1,52 @@
1
+ import React from "react"
2
+ import { StoryFn } from "@storybook/react"
3
+ import classnames from "classnames"
4
+ import { TailwindStoryTemplate } from "~tailwind/_docs/utils/TailwindStoryTemplate"
5
+ import { flattenEntries } from "~tailwind/_docs/utils/flattenEntries"
6
+ import { utilityDescription } from "~tailwind/_docs/utils/utilityDescription"
7
+ import { kaizenTailwindTheme } from "~tailwind/tailwind-presets"
8
+
9
+ const prefix = "text-"
10
+ const classEntries = flattenEntries(prefix, kaizenTailwindTheme.colors || {})
11
+
12
+ export default {
13
+ title: "Guides/Tailwind/Utility Class References/Typography/Text Color",
14
+ parameters: {
15
+ a11y: { disable: true },
16
+ chromatic: { disable: false },
17
+ docsLayout: "fullPage",
18
+ docs: {
19
+ description: {
20
+ component: utilityDescription(prefix, classEntries[0].utilityClassName),
21
+ },
22
+ },
23
+ },
24
+ }
25
+
26
+ export const TextColor: StoryFn<{ isReversed: boolean }> = ({ isReversed }) => (
27
+ <TailwindStoryTemplate
28
+ compiledCssPropertyName="color"
29
+ classKeyValues={classEntries}
30
+ renderExampleComponent={(utilityClass): React.ReactElement => (
31
+ <div className="flex items-center h-100">
32
+ <p
33
+ className={classnames(
34
+ "font-family-paragraph p-8 rounded font-weight-display text-heading-3 m-0 mr-16",
35
+ utilityClass
36
+ )}
37
+ >
38
+ Light bg
39
+ </p>
40
+ <p
41
+ className={classnames(
42
+ "font-family-paragraph p-8 bg-[black] rounded font-weight-display text-heading-3 m-0",
43
+ utilityClass
44
+ )}
45
+ >
46
+ Dark bg
47
+ </p>
48
+ </div>
49
+ )}
50
+ isReversed={isReversed}
51
+ />
52
+ )
@@ -0,0 +1,95 @@
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
+
7
+ <Meta title="Guides/Tailwind/Utility Class References/Overview" />
8
+
9
+ # Utility Class References
10
+
11
+ The Utility Class References section provides a list of utilities made available through the `@kaizen/tailwind` preset.
12
+ For more information on the preset itself, see <LinkTo pageId="systems-tailwind-overview">here</LinkTo>.
13
+
14
+ Note that this section only provides references for Kaizen's _custom_ utilities.
15
+ In other words, if you can't find a utility class here, it's probably because it's unchanged from the Tailwind default.
16
+ As an example, `borderColor` is listed in this section because we have a custom preset for it. `width` is _not_ here however, because it's unchanged from the Tailwind Default, and you can search for it in their [docs](https://tailwindcss.com/docs/width).
17
+
18
+ - [Structure](#structure)
19
+ - [Example usage](#example-usage)
20
+
21
+ <br/>
22
+
23
+ ## Structure
24
+
25
+ The references provide the following structure for each utility class:
26
+
27
+ <Unstyled>
28
+ <div className="w-100">
29
+ <TailwindStoryTemplate
30
+ compiledCssPropertyName="width"
31
+ classKeyValues={[{utilityClassName: "text-heading-1", cssProperty: "2.125rem"}]}
32
+ renderExampleComponent={cssProperty => (
33
+ <p style={{ fontSize: cssProperty }}>Aa</p>
34
+ )}
35
+ />
36
+ </div>
37
+ </Unstyled>
38
+
39
+ <br/>
40
+ <br/>
41
+
42
+ ### Utility Class
43
+
44
+ This is the name of the utility class itself. This is the string that you pass to `class` or `className`.
45
+
46
+ ### Compiled CSS
47
+
48
+ Represents the CSS property that Tailwind will compile for you when it recognizes the corresponding utility class.
49
+
50
+ ### Example
51
+
52
+ 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
+
54
+ <br/>
55
+
56
+ ## Example usage
57
+
58
+ **Goal:** Add our default border radius (`7px`) to the following component.
59
+
60
+ ```html
61
+ <div className="border-solid w-max border-blue-500 bg-blue-100 px-12">
62
+ <p className="font-family-paragraph text-blue-700">Example</p>
63
+ </div>
64
+ ```
65
+
66
+ ### 1. Locate the Border Radius docs
67
+
68
+ <div className="max-w-[600px]">
69
+ <img src={UtilitySearchResult} alt="Utility class search result" />
70
+ </div>
71
+
72
+ <p>Can&apos;t find it here? That means we don&apos;t have a custom preset for it, and the utility class you need will be unchanged from the Tailwind Default.</p>
73
+ <p>Search in the [Tailwind docs](https://tailwindcss.com/docs/installation) instead.</p>
74
+
75
+ <br/>
76
+ <br/>
77
+
78
+ ### 2. Find the utility class that compiles to the desired CSS, and copy it
79
+
80
+ <img src={CopyUtilityClass} alt="Copy utility class" />
81
+
82
+ <br/>
83
+ <br/>
84
+
85
+ ### 3. Add the utility class to the element
86
+
87
+ ```tsx
88
+ <div className="rounded ...">...</div>
89
+ ```
90
+
91
+ ```html
92
+ <div className="rounded border-solid w-max border-blue-500 bg-blue-100 px-12">
93
+ <p className="font-family-paragraph text-blue-700">Example</p>
94
+ </div>
95
+ ```
@@ -0,0 +1,85 @@
1
+ import { Canvas, Meta } from "@storybook/blocks"
2
+ import * as Examples from "./working-with-tailwind.stories"
3
+
4
+ <Meta of={Examples} />
5
+
6
+ # Working with Tailwind
7
+
8
+ This page describes and demonstrates the main intended use cases for this package, as well as our recommended escape hatch.
9
+
10
+ - [Spacing and layouts](#spacing-and-layouts)
11
+ - [Altering Kaizen components with classnameOverride](#altering-kaizen-components-with-classnameoverride)
12
+ - [Creating bespoke components](#creating-bespoke-components)
13
+ - [Recommended escape hatch](#recommended-escape-hatch)
14
+
15
+ <br/>
16
+
17
+ ## Spacing and layouts
18
+
19
+ For information about Cultureamp's spacing and layout system in general, see [here](/story/systems-layout-and-spacing--page)
20
+
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
+
23
+ Here, Tailwind has been used to center a Kaizen button within a div.
24
+
25
+ <Canvas of={Examples.TailwindExampleSpacingAndLayouts} />
26
+
27
+ - `flex`: Adds `display: flex`
28
+ - `justify-center`: Adds `justify-content: center`
29
+ - `border-solid`: Adds `border-style: solid`
30
+ - `p-16`: Adds `padding: 1rem` (`16px` = `1rem` - see the [layout and spacing docs](/story/systems-layout-and-spacing--page) for more on this)
31
+
32
+ Here's a more complex example, where some `<Card>` components and text have been spaced and laid out with Tailwind:
33
+
34
+ <Canvas of={Examples.TailwindExampleSpacingAndLayoutsComplex} />
35
+
36
+ <br/>
37
+
38
+ ## Altering Kaizen components with classNameOverride
39
+
40
+ If a Kaizen component supports classNameOverride, Tailwind classes can also be used.
41
+ This is particularly useful for adding margins to Kaizen components. In this example, our preset is being used to add `margin-right: 1.5rem` to Kaizen's `<Card/>` component, without the need to wrap it in a div.
42
+
43
+ <Canvas of={Examples.TailwindExampleClassNameOverrideMargin} />
44
+
45
+ In this example, a Tailwind css rule is being applied to a Kaizen `<Heading />` component to ensure that the first letter is capitalized.
46
+
47
+ <Canvas of={Examples.TailwindExampleClassNameOverrideHeading} />
48
+
49
+ - first-letter:capitalize: Adds text-transform: capitalize on the first-letter pseudo selector
50
+
51
+ <br/>
52
+
53
+ ## Creating bespoke components
54
+ 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
+ Here is an example of our TW package being used to create a bespoke, non-Kaizen component:
57
+
58
+ <Canvas of={Examples.TailwindExampleSnowflake} />
59
+
60
+ <br/>
61
+
62
+ ### The container div
63
+ - `w-[250px]`: Adds `width: 250px`. This is an example of an arbitrary value being used to inject a custom suffix
64
+ - `rounded`: Adds `border-radius: 7px`. This is one of our custom preset values
65
+ - `border-dashed`: Adds `border-style: dashed`
66
+ - `border-red-500`: Adds `border-color: #c93b55` (our red-500 design token)
67
+ - `bg-blue-100`: Adds `background: #e6f6ff` (our blue-100 design token)
68
+ - `text-center`: Adds `text-align: center`
69
+
70
+ ### The p tag
71
+ - `m-0`: Adds `margin: 0`
72
+ - `p-12`: Adds `padding: .75rem` (12px = 0.75rem)
73
+ - `pl-16`: Adds `padding-left: 1rem` (16px = 1rem)
74
+ - `font-family-paragraph`: Adds `font-family: "Inter", "Noto Sans", ...`
75
+ - `text-blue-500`: Adds `color: #0168b3` (our blue-500 design token)
76
+
77
+ <br/>
78
+
79
+ ## Recommended Escape Hatch
80
+
81
+ 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
+
83
+ ### Why not SCSS?
84
+ - SCSS is currently a contained option, so writing new SCSS in our codebases is discouraged.
85
+ - 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).