@kaizen/tailwind 1.3.9 → 1.3.11
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 +5 -5
- package/src/_docs/pages/backgrounds/background-color.stories.tsx +13 -20
- package/src/_docs/pages/borders/border-color.stories.tsx +14 -20
- package/src/_docs/pages/borders/border-radius.stories.tsx +18 -22
- package/src/_docs/pages/borders/border-spacing.stories.tsx +15 -19
- package/src/_docs/pages/borders/border-width.stories.tsx +18 -22
- package/src/_docs/pages/effects/shadow.stories.tsx +17 -19
- package/src/_docs/pages/modifiers/media-queries.stories.tsx +14 -24
- package/src/_docs/pages/modifiers/pseudo-states.stories.tsx +10 -16
- package/src/_docs/pages/spacing/margin.stories.tsx +17 -22
- package/src/_docs/pages/spacing/padding.stories.tsx +17 -24
- package/src/_docs/pages/typography/font-family.stories.tsx +15 -19
- package/src/_docs/pages/typography/font-size.stories.tsx +11 -12
- package/src/_docs/pages/typography/font-weight.stories.tsx +15 -19
- package/src/_docs/pages/typography/line-height.stories.tsx +17 -23
- package/src/_docs/pages/typography/max-text-width.stories.tsx +25 -29
- package/src/_docs/pages/typography/text-color.stories.tsx +16 -17
- 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,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 = 'leading-'
|
|
9
|
+
const classEntries: { utilityClassName: string; cssProperty: string }[] = Object.entries(
|
|
10
|
+
kaizenTailwindTheme.lineHeight ?? [],
|
|
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/Typography/Line Height',
|
|
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,17 +27,12 @@ export default {
|
|
|
28
27
|
},
|
|
29
28
|
} satisfies Meta
|
|
30
29
|
|
|
31
|
-
export const LineHeight: StoryFn
|
|
32
|
-
isReversed,
|
|
33
|
-
}) => (
|
|
30
|
+
export const LineHeight: StoryFn = () => (
|
|
34
31
|
<TailwindStoryTemplate
|
|
35
32
|
compiledCssPropertyName="line-height"
|
|
36
33
|
classKeyValues={classEntries}
|
|
37
34
|
renderExampleComponent={(utilityClass): React.ReactElement => (
|
|
38
|
-
<p className={classnames(
|
|
39
|
-
Tutant Meenage Neetle Teetles
|
|
40
|
-
</p>
|
|
35
|
+
<p className={classnames('w-0', utilityClass)}>Tutant Meenage Neetle Teetles</p>
|
|
41
36
|
)}
|
|
42
|
-
isReversed={isReversed}
|
|
43
37
|
/>
|
|
44
38
|
)
|
|
@@ -1,23 +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 = Object.entries(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const prefix = 'max-w-'
|
|
8
|
+
const classEntries = Object.entries(kaizenTailwindTheme.extend.maxWidth || []).map(
|
|
9
|
+
([suffix, cssPropertyArr]) => ({
|
|
10
|
+
utilityClassName: `${prefix}${suffix}`,
|
|
11
|
+
cssProperty: cssPropertyArr as string,
|
|
12
|
+
}),
|
|
13
|
+
)
|
|
14
14
|
|
|
15
15
|
export default {
|
|
16
|
-
title:
|
|
16
|
+
title: 'Guides/Tailwind/Utility Class References/Typography/Max Text Width',
|
|
17
17
|
parameters: {
|
|
18
18
|
a11y: { disable: true },
|
|
19
19
|
chromatic: { disable: false },
|
|
20
|
-
docsLayout:
|
|
20
|
+
docsLayout: 'fullPage',
|
|
21
21
|
docs: {
|
|
22
22
|
description: {
|
|
23
23
|
component: utilityDescription(prefix, classEntries[0].utilityClassName),
|
|
@@ -27,34 +27,30 @@ export default {
|
|
|
27
27
|
} satisfies Meta
|
|
28
28
|
|
|
29
29
|
const fontClasses = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
34
|
}
|
|
35
35
|
|
|
36
36
|
const getFontClass = (utilityClass: string): string =>
|
|
37
|
-
fontClasses[utilityClass as keyof typeof fontClasses] ||
|
|
37
|
+
fontClasses[utilityClass as keyof typeof fontClasses] || ''
|
|
38
38
|
|
|
39
|
-
export const MaxTextWidth: StoryFn
|
|
40
|
-
isReversed,
|
|
41
|
-
}) => (
|
|
39
|
+
export const MaxTextWidth: StoryFn = () => (
|
|
42
40
|
<TailwindStoryTemplate
|
|
43
41
|
compiledCssPropertyName="max-width"
|
|
44
42
|
classKeyValues={classEntries}
|
|
45
43
|
renderExampleComponent={(utilityClass): React.ReactElement => (
|
|
46
44
|
<>
|
|
47
|
-
<p className={[utilityClass, getFontClass(utilityClass)].join(
|
|
48
|
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Iusto, optio
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{[utilityClass, getFontClass(utilityClass)].join(" ")})
|
|
45
|
+
<p className={[utilityClass, getFontClass(utilityClass)].join(' ')}>
|
|
46
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Iusto, optio incidunt explicabo
|
|
47
|
+
facilis ipsam, porro magni vero libero itaque rerum deserunt quo molestiae expedita dolor?
|
|
48
|
+
Alias iusto ad maiores odit! ({[utilityClass, getFontClass(utilityClass)].join(' ')})
|
|
52
49
|
</p>
|
|
53
50
|
<code className="text-paragraph-sm bg-gray-300 py-4 px-8">
|
|
54
|
-
{[utilityClass, getFontClass(utilityClass)].join(
|
|
51
|
+
{[utilityClass, getFontClass(utilityClass)].join(' ')}
|
|
55
52
|
</code>
|
|
56
53
|
</>
|
|
57
54
|
)}
|
|
58
|
-
isReversed={isReversed}
|
|
59
55
|
/>
|
|
60
56
|
)
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { StoryFn } from
|
|
3
|
-
import classnames from
|
|
4
|
-
import { TailwindStoryTemplate } from
|
|
5
|
-
import { flattenEntries } from
|
|
6
|
-
import { utilityDescription } from
|
|
7
|
-
import { kaizenTailwindTheme } from
|
|
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
8
|
|
|
9
|
-
const prefix =
|
|
10
|
-
const classEntries = flattenEntries(prefix, kaizenTailwindTheme.colors
|
|
9
|
+
const prefix = 'text-'
|
|
10
|
+
const classEntries = flattenEntries(prefix, kaizenTailwindTheme.colors ?? {})
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
|
-
title:
|
|
13
|
+
title: 'Guides/Tailwind/Utility Class References/Typography/Text Color',
|
|
14
14
|
parameters: {
|
|
15
15
|
a11y: { disable: true },
|
|
16
16
|
chromatic: { disable: false },
|
|
17
|
-
docsLayout:
|
|
17
|
+
docsLayout: 'fullPage',
|
|
18
18
|
docs: {
|
|
19
19
|
description: {
|
|
20
20
|
component: utilityDescription(prefix, classEntries[0].utilityClassName),
|
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
},
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export const TextColor: StoryFn
|
|
26
|
+
export const TextColor: StoryFn = () => (
|
|
27
27
|
<TailwindStoryTemplate
|
|
28
28
|
compiledCssPropertyName="color"
|
|
29
29
|
classKeyValues={classEntries}
|
|
@@ -31,22 +31,21 @@ export const TextColor: StoryFn<{ isReversed: boolean }> = ({ isReversed }) => (
|
|
|
31
31
|
<div className="flex items-center h-100">
|
|
32
32
|
<p
|
|
33
33
|
className={classnames(
|
|
34
|
-
|
|
35
|
-
utilityClass
|
|
34
|
+
'font-family-paragraph p-8 rounded font-weight-display text-heading-3 m-0 mr-16',
|
|
35
|
+
utilityClass,
|
|
36
36
|
)}
|
|
37
37
|
>
|
|
38
38
|
Light bg
|
|
39
39
|
</p>
|
|
40
40
|
<p
|
|
41
41
|
className={classnames(
|
|
42
|
-
|
|
43
|
-
utilityClass
|
|
42
|
+
'font-family-paragraph p-8 bg-[black] rounded font-weight-display text-heading-3 m-0',
|
|
43
|
+
utilityClass,
|
|
44
44
|
)}
|
|
45
45
|
>
|
|
46
46
|
Dark bg
|
|
47
47
|
</p>
|
|
48
48
|
</div>
|
|
49
49
|
)}
|
|
50
|
-
isReversed={isReversed}
|
|
51
50
|
/>
|
|
52
51
|
)
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { StoryFn } from
|
|
3
|
-
import { Card } from
|
|
4
|
-
import { Heading } from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from
|
|
9
|
-
import { Skirt } from "~components/Skirt"
|
|
10
|
-
import { Button } from "~components/__actions__/v2"
|
|
11
|
-
import { TailwindStoryTemplate } from "../utils/TailwindStoryTemplate"
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StoryFn } from '@storybook/react'
|
|
3
|
+
import { Card } from '~components/Card'
|
|
4
|
+
import { Heading } from '~components/Heading'
|
|
5
|
+
import { CustomSurvey, CustomUnattributedSurvey } from '~components/Illustration'
|
|
6
|
+
import { Skirt } from '~components/Skirt'
|
|
7
|
+
import { Button } from '~components/__actions__/v2'
|
|
8
|
+
import { TailwindStoryTemplate } from '../utils/TailwindStoryTemplate'
|
|
12
9
|
|
|
13
10
|
export default {
|
|
14
|
-
title:
|
|
11
|
+
title: 'Guides/Tailwind/Working with Tailwind',
|
|
15
12
|
}
|
|
16
13
|
|
|
17
14
|
export const TailwindExampleSpacingAndLayouts: StoryFn = () => (
|
|
@@ -47,12 +44,8 @@ export const TailwindExampleSpacingAndLayoutsComplex: StoryFn = () => (
|
|
|
47
44
|
</p>
|
|
48
45
|
{/* Adds margin-top, flex, and a height of 200px */}
|
|
49
46
|
<div className="mt-64 flex h-[200px]">
|
|
50
|
-
{[0, 1, 2, 3].map(index => (
|
|
51
|
-
<Card
|
|
52
|
-
key={index}
|
|
53
|
-
variant="informative"
|
|
54
|
-
classNameOverride="mr-24 last:mr-0 w-full"
|
|
55
|
-
>
|
|
47
|
+
{[0, 1, 2, 3].map((index) => (
|
|
48
|
+
<Card key={index} variant="informative" classNameOverride="mr-24 last:mr-0 w-full">
|
|
56
49
|
{/* Adds height and width of 100% */}
|
|
57
50
|
<div className="w-full h-100" />
|
|
58
51
|
</Card>
|
|
@@ -75,9 +68,7 @@ export const TailwindExampleClassNameOverrideMargin: StoryFn = () => (
|
|
|
75
68
|
<Card>
|
|
76
69
|
<TailwindStoryTemplate.CardContent
|
|
77
70
|
title="Card 2"
|
|
78
|
-
illustration={
|
|
79
|
-
<CustomUnattributedSurvey alt="custom-unattributed-survey" />
|
|
80
|
-
}
|
|
71
|
+
illustration={<CustomUnattributedSurvey alt="custom-unattributed-survey" />}
|
|
81
72
|
/>
|
|
82
73
|
</Card>
|
|
83
74
|
</div>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { CardContent } from
|
|
5
|
-
import { CodeSnippet } from
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Heading } from '~components/Heading'
|
|
3
|
+
import { InlineNotification } from '~components/Notification'
|
|
4
|
+
import { CardContent } from './components/CardContent'
|
|
5
|
+
import { CodeSnippet } from './components/CodeSnippet'
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
8
8
|
compiledCssPropertyName: string
|
|
9
|
-
classKeyValues:
|
|
9
|
+
classKeyValues: { utilityClassName: string; cssProperty: string }[]
|
|
10
10
|
renderExampleComponent: (utilityClass: string) => React.ReactElement
|
|
11
11
|
isReversed?: boolean
|
|
12
12
|
}
|
|
@@ -15,48 +15,58 @@ export const TailwindStoryTemplate = ({
|
|
|
15
15
|
compiledCssPropertyName,
|
|
16
16
|
classKeyValues,
|
|
17
17
|
renderExampleComponent,
|
|
18
|
-
isReversed = false,
|
|
19
18
|
}: Props): React.ReactElement => {
|
|
20
19
|
const [copiedText, setCopiedText] = useState<null | string>(null)
|
|
21
20
|
|
|
22
21
|
return (
|
|
23
22
|
<div className="w-full">
|
|
24
|
-
<
|
|
25
|
-
className="
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
<table className="border-collapse w-full font-family-paragraph">
|
|
24
|
+
<thead className="text-left">
|
|
25
|
+
<tr className="border-b border-gray-400">
|
|
26
|
+
<th className="p-12">
|
|
27
|
+
<Heading variant="heading-5" tag="span">
|
|
28
|
+
Utility Class
|
|
29
|
+
</Heading>
|
|
30
|
+
</th>
|
|
31
|
+
<th className="p-12">
|
|
32
|
+
<Heading variant="heading-5" tag="span">
|
|
33
|
+
Compiled CSS
|
|
34
|
+
</Heading>
|
|
35
|
+
</th>
|
|
36
|
+
<th className="p-12">
|
|
37
|
+
<Heading variant="heading-5" tag="span">
|
|
38
|
+
Example
|
|
39
|
+
</Heading>
|
|
40
|
+
</th>
|
|
41
|
+
</tr>
|
|
42
|
+
</thead>
|
|
43
|
+
<tbody>
|
|
44
|
+
{classKeyValues.map((presetData, index) => {
|
|
36
45
|
const { utilityClassName, cssProperty } = presetData
|
|
37
46
|
return (
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</
|
|
52
|
-
<
|
|
53
|
-
{renderExampleComponent(utilityClassName)}
|
|
54
|
-
</
|
|
55
|
-
</
|
|
47
|
+
<tr key={index} className="border-b-1 border-gray-400">
|
|
48
|
+
<td className="p-12">
|
|
49
|
+
<div className="mr-32 min-w-max max-w-[300px]">
|
|
50
|
+
<CodeSnippet
|
|
51
|
+
text={utilityClassName.replace('-DEFAULT', '')}
|
|
52
|
+
onCopy={(text: string): void => setCopiedText(text)}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</td>
|
|
56
|
+
<td className="p-12">
|
|
57
|
+
<p className="mr-32 w-max">
|
|
58
|
+
{compiledCssPropertyName}: {cssProperty}
|
|
59
|
+
</p>
|
|
60
|
+
</td>
|
|
61
|
+
<td className="p-12">
|
|
62
|
+
<div>{renderExampleComponent(utilityClassName)}</div>
|
|
63
|
+
</td>
|
|
64
|
+
</tr>
|
|
56
65
|
)
|
|
57
66
|
})}
|
|
58
|
-
</
|
|
59
|
-
</
|
|
67
|
+
</tbody>
|
|
68
|
+
</table>
|
|
69
|
+
|
|
60
70
|
<div className="fixed top-[10px] left-[10px]">
|
|
61
71
|
{copiedText && (
|
|
62
72
|
<InlineNotification
|
|
@@ -64,8 +74,8 @@ export const TailwindStoryTemplate = ({
|
|
|
64
74
|
hideCloseIcon
|
|
65
75
|
onHide={(): void => setCopiedText(null)}
|
|
66
76
|
headingProps={{
|
|
67
|
-
children:
|
|
68
|
-
variant:
|
|
77
|
+
children: 'Copied to clipboard: ',
|
|
78
|
+
variant: 'heading-6',
|
|
69
79
|
}}
|
|
70
80
|
>
|
|
71
81
|
{copiedText}
|
|
@@ -78,4 +88,4 @@ export const TailwindStoryTemplate = ({
|
|
|
78
88
|
|
|
79
89
|
TailwindStoryTemplate.CardContent = CardContent
|
|
80
90
|
|
|
81
|
-
TailwindStoryTemplate.displayName =
|
|
91
|
+
TailwindStoryTemplate.displayName = 'TailwindStoryTemplate'
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Heading } from
|
|
3
|
-
import { Button } from
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Heading } from '~components/Heading'
|
|
3
|
+
import { Button } from '~components/__actions__/v2'
|
|
4
4
|
|
|
5
5
|
type CardContentProps = {
|
|
6
6
|
title: string
|
|
7
7
|
illustration: React.ReactElement
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const CardContent = ({
|
|
11
|
-
title,
|
|
12
|
-
illustration,
|
|
13
|
-
}: CardContentProps): React.ReactElement => (
|
|
10
|
+
export const CardContent = ({ title, illustration }: CardContentProps): React.ReactElement => (
|
|
14
11
|
<div className="flex w-[400px] flex-col items-center p-24 pt-48">
|
|
15
12
|
<Heading variant="heading-3">{title}</Heading>
|
|
16
13
|
<p className="pt-12 pb-24 text-center font-family-paragraph text-heading-6 font-weight-paragraph text-purple-800">
|
|
@@ -23,4 +20,4 @@ export const CardContent = ({
|
|
|
23
20
|
</div>
|
|
24
21
|
)
|
|
25
22
|
|
|
26
|
-
CardContent.displayName =
|
|
23
|
+
CardContent.displayName = 'CardContent'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './CardContent'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { Icon } from
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Icon } from '~components/__future__'
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
5
|
text: string
|
|
@@ -11,7 +11,7 @@ export const CodeSnippet = ({ text, onCopy }: Props): React.ReactElement => {
|
|
|
11
11
|
const handleCopy = (utilityClassNameName: string): void => {
|
|
12
12
|
navigator.clipboard.writeText(text)
|
|
13
13
|
setCopyIconIsChecked(true)
|
|
14
|
-
onCopy
|
|
14
|
+
onCopy?.(utilityClassNameName)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
return (
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './CodeSnippet'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './TailwindStoryTemplate'
|
|
@@ -6,30 +6,29 @@ type ResolvableTo<T> = T | ((utils: any) => T)
|
|
|
6
6
|
|
|
7
7
|
export const flattenEntries = (
|
|
8
8
|
prefix: string,
|
|
9
|
-
themeObj: ResolvableTo<RecursiveKeyValuePair<string, string
|
|
10
|
-
):
|
|
9
|
+
themeObj: ResolvableTo<RecursiveKeyValuePair<string, string>>,
|
|
10
|
+
): {
|
|
11
11
|
utilityClassName: string
|
|
12
12
|
cssProperty: string
|
|
13
|
-
}
|
|
13
|
+
}[] => {
|
|
14
14
|
const classKeyVal: string[][] = Object.entries(themeObj || [])
|
|
15
|
-
const flattenedEntries:
|
|
15
|
+
const flattenedEntries: {
|
|
16
16
|
utilityClassName: string
|
|
17
17
|
cssProperty: string
|
|
18
|
-
}
|
|
19
|
-
classKeyVal.forEach(colorGroup => {
|
|
18
|
+
}[] = []
|
|
19
|
+
classKeyVal.forEach((colorGroup) => {
|
|
20
20
|
const [classModifier, cssProperty] = colorGroup
|
|
21
|
-
if (typeof cssProperty ===
|
|
21
|
+
if (typeof cssProperty === 'string') {
|
|
22
22
|
flattenedEntries.push({
|
|
23
23
|
utilityClassName: `${prefix}${classModifier}`,
|
|
24
24
|
cssProperty,
|
|
25
25
|
})
|
|
26
26
|
} else {
|
|
27
|
-
Object.entries(cssProperty as Record<string, string>).forEach(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
})
|
|
27
|
+
Object.entries(cssProperty as Record<string, string>).forEach((classNamePair) =>
|
|
28
|
+
flattenedEntries.push({
|
|
29
|
+
utilityClassName: `${prefix}${classModifier}-${classNamePair[0]}`,
|
|
30
|
+
cssProperty: classNamePair[1],
|
|
31
|
+
}),
|
|
33
32
|
)
|
|
34
33
|
}
|
|
35
34
|
})
|
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './tailwind-presets'
|
package/src/kz-height.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export const kzHeight = {
|
|
2
|
-
0:
|
|
3
|
-
25:
|
|
4
|
-
33:
|
|
5
|
-
50:
|
|
6
|
-
75:
|
|
7
|
-
100:
|
|
8
|
-
auto:
|
|
9
|
-
min:
|
|
10
|
-
max:
|
|
11
|
-
fit:
|
|
2
|
+
0: '0',
|
|
3
|
+
25: '25%',
|
|
4
|
+
33: '33.333333%',
|
|
5
|
+
50: '50%',
|
|
6
|
+
75: '75%',
|
|
7
|
+
100: '100%',
|
|
8
|
+
auto: 'auto',
|
|
9
|
+
min: 'min-content',
|
|
10
|
+
max: 'max-content',
|
|
11
|
+
fit: 'fit-content',
|
|
12
12
|
}
|
package/src/kz-spacing.spec.ts
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { filterDenyListValues } from
|
|
1
|
+
import { filterDenyListValues } from './kz-spacing'
|
|
2
2
|
|
|
3
|
-
describe(
|
|
4
|
-
it(
|
|
3
|
+
describe('filterDenyListValues', () => {
|
|
4
|
+
it('Keeps all numeric keys', () => {
|
|
5
5
|
const result = filterDenyListValues({
|
|
6
|
-
0:
|
|
7
|
-
xs:
|
|
8
|
-
1:
|
|
9
|
-
sm:
|
|
10
|
-
2:
|
|
6
|
+
0: '0',
|
|
7
|
+
xs: '0.375rem',
|
|
8
|
+
1: '.0625rem',
|
|
9
|
+
sm: '0.75rem',
|
|
10
|
+
2: '.125rem',
|
|
11
11
|
})
|
|
12
12
|
|
|
13
13
|
expect(result).toEqual({
|
|
14
|
-
0:
|
|
15
|
-
1:
|
|
16
|
-
2:
|
|
14
|
+
0: '0',
|
|
15
|
+
1: '.0625rem',
|
|
16
|
+
2: '.125rem',
|
|
17
17
|
})
|
|
18
18
|
})
|
|
19
|
-
it(
|
|
19
|
+
it('Keeps valid tailwind defaults', () => {
|
|
20
20
|
const result = filterDenyListValues({
|
|
21
|
-
0:
|
|
22
|
-
xs:
|
|
23
|
-
1:
|
|
24
|
-
sm:
|
|
25
|
-
2:
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
0: '0',
|
|
22
|
+
'xs': '0.375rem',
|
|
23
|
+
1: '.0625rem',
|
|
24
|
+
'sm': '0.75rem',
|
|
25
|
+
2: '.125rem',
|
|
26
|
+
'w-1/2': '50%',
|
|
27
|
+
'w-full': '100%',
|
|
28
28
|
})
|
|
29
29
|
|
|
30
30
|
expect(result).toEqual({
|
|
31
|
-
0:
|
|
32
|
-
1:
|
|
33
|
-
2:
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
0: '0',
|
|
32
|
+
1: '.0625rem',
|
|
33
|
+
2: '.125rem',
|
|
34
|
+
'w-1/2': '50%',
|
|
35
|
+
'w-full': '100%',
|
|
36
36
|
})
|
|
37
37
|
})
|
|
38
38
|
})
|