@kaizen/tailwind 1.4.1 → 1.5.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.
- package/dist/cjs/kz-spacing.cjs +2 -2
- package/dist/esm/kz-spacing.mjs +2 -2
- package/package.json +9 -5
- package/src/_docs/pages/configuration.mdx +1 -1
- package/src/_docs/pages/contributing.mdx +1 -1
- package/src/_docs/pages/getting-started.mdx +1 -1
- package/src/_docs/pages/overview.mdx +1 -1
- package/src/_docs/pages/working-with-tailwind.mdx +2 -2
- package/src/_docs/pages/working-with-tailwind.stories.tsx +14 -11
- package/src/_docs/utils/TailwindStoryTemplate/TailwindStoryTemplate.tsx +1 -1
- package/src/_docs/utils/TailwindStoryTemplate/components/CardContent/CardContent.tsx +1 -1
- package/src/_docs/utils/TailwindStoryTemplate/components/CodeSnippet/CodeSnippet.tsx +1 -1
- package/src/kz-spacing.ts +2 -2
package/dist/cjs/kz-spacing.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var js = require('@kaizen/design-tokens/js');
|
|
4
4
|
var tokenDenyList = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl', 'xxxl', 'xxxxl', 'xxxxxl', 'xs-id', 'sm-id', 'md-id', 'lg-id', 'xl-id', 'xxl-id', 'xxxl-id', 'xxxxl-id', 'xxxxxl-id'];
|
|
5
5
|
/**
|
|
6
6
|
* checks if a key from design tokens should be filtered from tailwind
|
|
@@ -16,6 +16,6 @@ var filterDenyListValues = function (spacingTokensObject) {
|
|
|
16
16
|
return isValidToken(key);
|
|
17
17
|
}));
|
|
18
18
|
};
|
|
19
|
-
var kzSpacing = filterDenyListValues(
|
|
19
|
+
var kzSpacing = filterDenyListValues(js.tokens.spacing);
|
|
20
20
|
exports.filterDenyListValues = filterDenyListValues;
|
|
21
21
|
exports.kzSpacing = kzSpacing;
|
package/dist/esm/kz-spacing.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { tokens } from '@kaizen/design-tokens/js';
|
|
2
2
|
var tokenDenyList = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl', 'xxxl', 'xxxxl', 'xxxxxl', 'xs-id', 'sm-id', 'md-id', 'lg-id', 'xl-id', 'xxl-id', 'xxxl-id', 'xxxxl-id', 'xxxxxl-id'];
|
|
3
3
|
/**
|
|
4
4
|
* checks if a key from design tokens should be filtered from tailwind
|
|
@@ -14,5 +14,5 @@ var filterDenyListValues = function (spacingTokensObject) {
|
|
|
14
14
|
return isValidToken(key);
|
|
15
15
|
}));
|
|
16
16
|
};
|
|
17
|
-
var kzSpacing = filterDenyListValues(
|
|
17
|
+
var kzSpacing = filterDenyListValues(tokens.spacing);
|
|
18
18
|
export { filterDenyListValues, kzSpacing };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/tailwind",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Kaizen Tailwind presets",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,17 +22,21 @@
|
|
|
22
22
|
"private": false,
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@kaizen/design-tokens": "
|
|
25
|
+
"@kaizen/design-tokens": "11.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@cultureamp/package-bundler": "^2.3.
|
|
28
|
+
"@cultureamp/package-bundler": "^2.3.2",
|
|
29
29
|
"classnames": "^2.5.1",
|
|
30
|
-
"rollup": "^4.
|
|
30
|
+
"rollup": "^4.46.2",
|
|
31
|
+
"react": "^19.1.0",
|
|
32
|
+
"react-dom": "^19.1.0",
|
|
31
33
|
"tailwindcss": "^3.4.17",
|
|
32
34
|
"tslib": "^2.8.1"
|
|
33
35
|
},
|
|
34
36
|
"peerDependencies": {
|
|
35
|
-
"tailwindcss": ">=3.4.7"
|
|
37
|
+
"tailwindcss": ">=3.4.7",
|
|
38
|
+
"react": "^18.3.1 || ^19.0.0",
|
|
39
|
+
"react-dom": "^18.3.1 || ^19.0.0"
|
|
36
40
|
},
|
|
37
41
|
"scripts": {
|
|
38
42
|
"build": "pnpm package-bundler build",
|
|
@@ -59,7 +59,7 @@ If this is changed or you are not using the [Frontend Template](https://github.c
|
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
<Unstyled>
|
|
62
|
-
<InlineNotification persistent
|
|
62
|
+
<InlineNotification persistent variant="cautionary" style="inline" title="Changing the selector">
|
|
63
63
|
{
|
|
64
64
|
<>
|
|
65
65
|
We advise using an <code>id</code> with <code>"#root"</code> as the default
|
|
@@ -19,7 +19,7 @@ You may also need to reload the window for these to be picked up with TW Intelli
|
|
|
19
19
|
|
|
20
20
|
**Intellisense not working within the class attributes**
|
|
21
21
|
|
|
22
|
-
For configuring IntelliSense refer to the [
|
|
22
|
+
For configuring IntelliSense refer to the [Getting Started guide](/docs/guides-tailwind-getting-started--docs#tailwind-css-vscode-intellisense-plugin)
|
|
23
23
|
|
|
24
24
|
Check the output in your terminal output for TailwindCSS IntelliSense.
|
|
25
25
|
|
|
@@ -50,7 +50,7 @@ module.exports = {
|
|
|
50
50
|
}
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
For preset configuration options, see our [configuration docs](/
|
|
53
|
+
For preset configuration options, see our [configuration docs](/docs/guides-tailwind-configuration--docs).
|
|
54
54
|
|
|
55
55
|
## 3. Add the Tailwind Directives
|
|
56
56
|
|
|
@@ -10,7 +10,7 @@ import AnatomyDiagram from '../assets/tw-anatomy.png'
|
|
|
10
10
|
## What our package does
|
|
11
11
|
|
|
12
12
|
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.
|
|
13
|
-
To see a list of utilities generated by our preset, see our [Utility Class Reference Docs](/
|
|
13
|
+
To see a list of utilities generated by our preset, see our [Utility Class Reference Docs](/docs/guides-tailwind-utility-class-references-overview--docs).
|
|
14
14
|
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.
|
|
15
15
|
|
|
16
16
|
<img src={AnatomyDiagram} alt="Tailwind utility class anatomy" />
|
|
@@ -16,7 +16,7 @@ This page describes and demonstrates the main intended use cases for this packag
|
|
|
16
16
|
|
|
17
17
|
## Spacing and layouts
|
|
18
18
|
|
|
19
|
-
For information about Cultureamp's spacing and layout system in general, see [here](/
|
|
19
|
+
For information about Cultureamp's spacing and layout system in general, see [here](/docs/guides-layout-and-spacing--docs).
|
|
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
|
|
|
@@ -27,7 +27,7 @@ Here, Tailwind has been used to center a Kaizen button within a div.
|
|
|
27
27
|
- `flex`: Adds `display: flex`
|
|
28
28
|
- `justify-center`: Adds `justify-content: center`
|
|
29
29
|
- `border-solid`: Adds `border-style: solid`
|
|
30
|
-
- `p-16`: Adds `padding: 1rem` (`16px` = `1rem` - see the [layout and spacing docs](/
|
|
30
|
+
- `p-16`: Adds `padding: 1rem` (`16px` = `1rem` - see the [layout and spacing docs](/docs/guides-layout-and-spacing--docs) for more on this)
|
|
31
31
|
|
|
32
32
|
Here's a more complex example, where some `<Card>` components and text have been spaced and laid out with Tailwind:
|
|
33
33
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { type StoryFn } from '@storybook/react'
|
|
3
|
-
import { Button } from '~components/
|
|
3
|
+
import { Button } from '~components/ButtonV1'
|
|
4
4
|
import { Card } from '~components/Card'
|
|
5
|
+
import { Container } from '~components/Container'
|
|
6
|
+
import { Content } from '~components/Content'
|
|
5
7
|
import { Heading } from '~components/Heading'
|
|
6
8
|
import { CustomSurvey, CustomUnattributedSurvey } from '~components/Illustration'
|
|
7
|
-
import { Skirt } from '~components/Skirt'
|
|
8
9
|
import { TailwindStoryTemplate } from '../utils/TailwindStoryTemplate'
|
|
9
10
|
|
|
10
11
|
export default {
|
|
@@ -19,14 +20,16 @@ export const TailwindExampleSpacingAndLayouts: StoryFn = () => (
|
|
|
19
20
|
|
|
20
21
|
export const TailwindExampleSpacingAndLayoutsComplex: StoryFn = () => (
|
|
21
22
|
<>
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
<Container>
|
|
24
|
+
<Content>
|
|
25
|
+
<Heading variant="heading-2" color="dark" classNameOverride="pt-24">
|
|
26
|
+
Laid out with Tailwind
|
|
27
|
+
</Heading>
|
|
28
|
+
<Card color="blue" classNameOverride="mt-24">
|
|
29
|
+
<div className="h-[300px]" />
|
|
30
|
+
</Card>
|
|
31
|
+
</Content>
|
|
32
|
+
</Container>
|
|
30
33
|
{/* Adds flex, makes the width 100% and centers content */}
|
|
31
34
|
<div className="flex w-full justify-center">
|
|
32
35
|
{/* Adds margins, width, and max width */}
|
|
@@ -45,7 +48,7 @@ export const TailwindExampleSpacingAndLayoutsComplex: StoryFn = () => (
|
|
|
45
48
|
{/* Adds margin-top, flex, and a height of 200px */}
|
|
46
49
|
<div className="mt-64 flex h-[200px]">
|
|
47
50
|
{[0, 1, 2, 3].map((index) => (
|
|
48
|
-
<Card key={index}
|
|
51
|
+
<Card key={index} color="blue" classNameOverride="mr-24 last:mr-0 w-full">
|
|
49
52
|
{/* Adds height and width of 100% */}
|
|
50
53
|
<div className="w-full h-100" />
|
|
51
54
|
</Card>
|
package/src/kz-spacing.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { tokens } from '@kaizen/design-tokens/js'
|
|
2
2
|
|
|
3
3
|
const tokenDenyList: string[] = [
|
|
4
4
|
'xs',
|
|
@@ -35,4 +35,4 @@ export const filterDenyListValues = (
|
|
|
35
35
|
return Object.fromEntries(keyValuePairs.filter(([key]) => isValidToken(key)))
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export const kzSpacing = filterDenyListValues(
|
|
38
|
+
export const kzSpacing = filterDenyListValues(tokens.spacing)
|