@atlaskit/primitives 7.0.0 → 7.0.2

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 (76) hide show
  1. package/.eslintrc.js +1 -1
  2. package/CHANGELOG.md +19 -1
  3. package/LICENSE.md +6 -8
  4. package/constellation/anchor/code.mdx +3 -3
  5. package/constellation/anchor/examples.mdx +33 -39
  6. package/constellation/anchor/usage.mdx +60 -30
  7. package/constellation/bleed/code.mdx +3 -3
  8. package/constellation/bleed/examples.mdx +17 -13
  9. package/constellation/box/code.mdx +3 -3
  10. package/constellation/box/examples.mdx +25 -19
  11. package/constellation/box/usage.mdx +15 -5
  12. package/constellation/flex/code.mdx +3 -3
  13. package/constellation/flex/examples.mdx +12 -11
  14. package/constellation/grid/code.mdx +3 -3
  15. package/constellation/grid/examples.mdx +15 -10
  16. package/constellation/inline/code.mdx +3 -3
  17. package/constellation/inline/examples.mdx +32 -38
  18. package/constellation/inline/usage.mdx +15 -6
  19. package/constellation/overview/index.mdx +29 -27
  20. package/constellation/pressable/code.mdx +5 -4
  21. package/constellation/pressable/examples.mdx +41 -55
  22. package/constellation/pressable/usage.mdx +59 -36
  23. package/constellation/responsive/01-show/code.mdx +3 -3
  24. package/constellation/responsive/01-show/examples.mdx +9 -13
  25. package/constellation/responsive/02-hide/code.mdx +3 -3
  26. package/constellation/responsive/02-hide/examples.mdx +9 -13
  27. package/constellation/responsive/03-breakpoints/examples.mdx +3 -3
  28. package/constellation/responsive/examples.mdx +10 -10
  29. package/constellation/responsive/usage.mdx +23 -15
  30. package/constellation/stack/code.mdx +3 -3
  31. package/constellation/stack/examples.mdx +26 -20
  32. package/constellation/stack/usage.mdx +13 -5
  33. package/constellation/text/code.mdx +3 -3
  34. package/constellation/text/examples.mdx +29 -15
  35. package/constellation/text/usage.mdx +6 -3
  36. package/constellation/xcss/examples.mdx +7 -5
  37. package/constellation/xcss/migration.mdx +32 -25
  38. package/constellation/xcss/usage.mdx +72 -60
  39. package/dist/cjs/components/anchor.js +4 -4
  40. package/dist/cjs/components/pressable.js +1 -1
  41. package/dist/cjs/xcss/style-maps.partial.js +13 -13
  42. package/dist/es2019/components/anchor.js +4 -4
  43. package/dist/es2019/components/pressable.js +1 -1
  44. package/dist/es2019/xcss/style-maps.partial.js +13 -13
  45. package/dist/esm/components/anchor.js +4 -4
  46. package/dist/esm/components/pressable.js +1 -1
  47. package/dist/esm/xcss/style-maps.partial.js +13 -13
  48. package/dist/types/components/anchor.d.ts +4 -4
  49. package/dist/types/responsive/index.d.ts +2 -2
  50. package/dist/types/xcss/style-maps.partial.d.ts +13 -13
  51. package/dist/types-ts4.5/components/anchor.d.ts +4 -4
  52. package/dist/types-ts4.5/responsive/index.d.ts +2 -2
  53. package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +13 -13
  54. package/extract-react-types/anchor-props.tsx +108 -116
  55. package/extract-react-types/bleed-props.tsx +17 -22
  56. package/extract-react-types/box-props.tsx +67 -70
  57. package/extract-react-types/flex-props.tsx +61 -61
  58. package/extract-react-types/grid-props.tsx +92 -92
  59. package/extract-react-types/hide-props.tsx +35 -35
  60. package/extract-react-types/inline-props.tsx +68 -68
  61. package/extract-react-types/pressable-props.tsx +101 -107
  62. package/extract-react-types/show-props.tsx +35 -35
  63. package/extract-react-types/stack-props.tsx +55 -55
  64. package/package.json +2 -2
  65. package/report.api.md +940 -965
  66. package/scripts/border-codegen-template.tsx +40 -47
  67. package/scripts/codegen-file-templates/dimensions.tsx +8 -8
  68. package/scripts/codegen-file-templates/layer.tsx +9 -9
  69. package/scripts/codegen-styles.tsx +97 -103
  70. package/scripts/color-codegen-template.tsx +61 -73
  71. package/scripts/elevation-codegen-template.tsx +50 -62
  72. package/scripts/inverse-color-map-template.tsx +26 -31
  73. package/scripts/misc-codegen-template.tsx +4 -9
  74. package/scripts/spacing-codegen-template.tsx +25 -31
  75. package/scripts/typography-codegen-template.tsx +59 -65
  76. package/scripts/utils.tsx +36 -43
@@ -1,86 +1,74 @@
1
1
  import format from '@af/formatting/sync';
2
2
  import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
3
- import {
4
- legacyLightTokens as legacyTokens,
5
- light as tokens,
6
- } from '@atlaskit/tokens/tokens-raw';
3
+ import { legacyLightTokens as legacyTokens, light as tokens } from '@atlaskit/tokens/tokens-raw';
7
4
 
8
- import {
9
- capitalize,
10
- constructTokenFunctionCall,
11
- type ShadowDefinition,
12
- } from './utils';
5
+ import { capitalize, constructTokenFunctionCall, type ShadowDefinition } from './utils';
13
6
 
14
7
  type Token = {
15
- token: string;
16
- fallback: string | ShadowDefinition;
17
- isDeprecated: boolean;
8
+ token: string;
9
+ fallback: string | ShadowDefinition;
10
+ isDeprecated: boolean;
18
11
  };
19
12
 
20
13
  // NB: Fallback CSS variables can be deleted when tokens are no longer behind a feature flag
21
14
  const tokenStyles = {
22
- opacity: {
23
- objectName: 'opacity',
24
- prefix: 'opacity.',
25
- cssProperty: 'opacity',
26
- filterFn: <T extends Token>(t: T) =>
27
- t.token.startsWith(tokenStyles.opacity.prefix),
28
- },
29
- shadow: {
30
- objectName: 'shadow',
31
- prefix: 'elevation.shadow.',
32
- cssProperty: 'boxShadow',
33
- filterFn: <T extends Token>(t: T) =>
34
- t.token.startsWith(tokenStyles.shadow.prefix),
35
- },
36
- surface: {
37
- objectName: 'surfaceColor',
38
- prefix: 'elevation.surface.',
39
- cssProperty: CURRENT_SURFACE_CSS_VAR,
40
- filterFn: <T extends Token>(t: T) =>
41
- t.token.startsWith(tokenStyles.surface.prefix),
42
- },
15
+ opacity: {
16
+ objectName: 'opacity',
17
+ prefix: 'opacity.',
18
+ cssProperty: 'opacity',
19
+ filterFn: <T extends Token>(t: T) => t.token.startsWith(tokenStyles.opacity.prefix),
20
+ },
21
+ shadow: {
22
+ objectName: 'shadow',
23
+ prefix: 'elevation.shadow.',
24
+ cssProperty: 'boxShadow',
25
+ filterFn: <T extends Token>(t: T) => t.token.startsWith(tokenStyles.shadow.prefix),
26
+ },
27
+ surface: {
28
+ objectName: 'surfaceColor',
29
+ prefix: 'elevation.surface.',
30
+ cssProperty: CURRENT_SURFACE_CSS_VAR,
31
+ filterFn: <T extends Token>(t: T) => t.token.startsWith(tokenStyles.surface.prefix),
32
+ },
43
33
  } as const;
44
34
 
45
35
  const bothTokens = tokens.map((t, i) => [t, legacyTokens[i]]);
46
36
 
47
37
  const activeTokens = bothTokens
48
- .filter(([t]) => t.attributes.state !== 'deleted')
49
- .map(t => t)
50
- .map(
51
- ([t, legacy]): Token => ({
52
- token: t.name,
53
- fallback: legacy.value as string | ShadowDefinition,
54
- isDeprecated: t.attributes.state === 'deprecated',
55
- }),
56
- );
38
+ .filter(([t]) => t.attributes.state !== 'deleted')
39
+ .map((t) => t)
40
+ .map(
41
+ ([t, legacy]): Token => ({
42
+ token: t.name,
43
+ fallback: legacy.value as string | ShadowDefinition,
44
+ isDeprecated: t.attributes.state === 'deprecated',
45
+ }),
46
+ );
57
47
 
58
- export const createElevationStylesFromTemplate = (
59
- property: keyof typeof tokenStyles,
60
- ) => {
61
- if (!tokenStyles[property]) {
62
- throw new Error(`[codegen] Unknown option found "${property}"`);
63
- }
48
+ export const createElevationStylesFromTemplate = (property: keyof typeof tokenStyles) => {
49
+ if (!tokenStyles[property]) {
50
+ throw new Error(`[codegen] Unknown option found "${property}"`);
51
+ }
64
52
 
65
- const { filterFn, objectName } = tokenStyles[property];
53
+ const { filterFn, objectName } = tokenStyles[property];
66
54
 
67
- return (format(
68
- `
55
+ return (
56
+ format(
57
+ `
69
58
  export const ${objectName}Map = {
70
59
  ${activeTokens
71
- .filter(filterFn)
72
- // @ts-ignore
73
- .map(t => ({ ...t, token: t.token.replaceAll('.[default]', '') }))
74
- .map(t => {
75
- return `
60
+ .filter(filterFn)
61
+ // @ts-ignore
62
+ .map((t) => ({ ...t, token: t.token.replaceAll('.[default]', '') }))
63
+ .map((t) => {
64
+ return `
76
65
  ${t.isDeprecated ? '// @deprecated' : ''}
77
66
  '${t.token}': ${constructTokenFunctionCall(t.token, t.fallback)}
78
67
  `.trim();
79
- })
80
- .join(',\n\t')}
68
+ })
69
+ .join(',\n\t')}
81
70
  } as const;`,
82
- 'typescript',
83
- ) +
84
- `\nexport type ${capitalize(objectName)} = keyof typeof ${objectName}Map;\n`
85
- );
71
+ 'typescript',
72
+ ) + `\nexport type ${capitalize(objectName)} = keyof typeof ${objectName}Map;\n`
73
+ );
86
74
  };
@@ -4,43 +4,38 @@ import { light as tokens } from '@atlaskit/tokens/tokens-raw';
4
4
  import { compose, isAccent, not, pick } from './utils';
5
5
 
6
6
  type Token = {
7
- token: string;
8
- fallback: string;
7
+ token: string;
8
+ fallback: string;
9
9
  };
10
10
 
11
11
  const activeTokens = tokens
12
- .filter(
13
- t =>
14
- t.attributes.state !== 'deleted' && t.attributes.state !== 'deprecated',
15
- )
16
- .map(
17
- (t): Token => ({
18
- token: t.name,
19
- fallback: t.value as string,
20
- }),
21
- )
22
- .filter(compose(pick('token'), not(isAccent)))
23
- .filter(t => t.token.includes('background'))
24
- .filter(t => t.token.includes('bold'))
25
- // @ts-ignore
26
- .map(t => ({ ...t, token: t.token.replaceAll('.[default]', '') }));
12
+ .filter((t) => t.attributes.state !== 'deleted' && t.attributes.state !== 'deprecated')
13
+ .map(
14
+ (t): Token => ({
15
+ token: t.name,
16
+ fallback: t.value as string,
17
+ }),
18
+ )
19
+ .filter(compose(pick('token'), not(isAccent)))
20
+ .filter((t) => t.token.includes('background'))
21
+ .filter((t) => t.token.includes('bold'))
22
+ // @ts-ignore
23
+ .map((t) => ({ ...t, token: t.token.replaceAll('.[default]', '') }));
27
24
 
28
25
  export const createInverseColorMapTemplate = () => {
29
- return format(
30
- `
26
+ return format(
27
+ `
31
28
  export const inverseColorMap = {
32
29
  ${activeTokens
33
- .map(t => {
34
- // handle the default case eg color.border or color.text
35
- const propName = t.token;
36
- return `'${propName}': '${
37
- propName.includes('warning')
38
- ? 'color.text.warning.inverse'
39
- : 'color.text.inverse'
40
- }'`;
41
- })
42
- .join(',\n\t')}
30
+ .map((t) => {
31
+ // handle the default case eg color.border or color.text
32
+ const propName = t.token;
33
+ return `'${propName}': '${
34
+ propName.includes('warning') ? 'color.text.warning.inverse' : 'color.text.inverse'
35
+ }'`;
36
+ })
37
+ .join(',\n\t')}
43
38
  } as const;`,
44
- 'typescript',
45
- );
39
+ 'typescript',
40
+ );
46
41
  };
@@ -2,14 +2,9 @@ import { readFileSync } from 'fs';
2
2
  import { join } from 'path';
3
3
 
4
4
  export const createStylesFromFileTemplate = (
5
- property:
6
- | 'border-color'
7
- | 'border-radius'
8
- | 'border-width'
9
- | 'dimensions'
10
- | 'layer',
5
+ property: 'border-color' | 'border-radius' | 'border-width' | 'dimensions' | 'layer',
11
6
  ) => {
12
- const path = join(__dirname, './codegen-file-templates', `${property}.tsx`);
13
- const source = readFileSync(path);
14
- return source;
7
+ const path = join(__dirname, './codegen-file-templates', `${property}.tsx`);
8
+ const source = readFileSync(path);
9
+ return source;
15
10
  };
@@ -6,40 +6,34 @@ import { constructTokenFunctionCall } from './utils';
6
6
  const spacingTokenPrefix = 'space.';
7
7
  const negativeSuffix = '.negative';
8
8
  const positiveSpaceTokens = tokens
9
- .filter(token => token.name.startsWith(spacingTokenPrefix))
10
- .filter(token => !token.name.includes(negativeSuffix))
11
- .map(t => ({
12
- name: t.cleanName, // Need to use cleanName to avoid getting '[default]' in the token names
13
- fallback: t.value,
14
- }));
9
+ .filter((token) => token.name.startsWith(spacingTokenPrefix))
10
+ .filter((token) => !token.name.includes(negativeSuffix))
11
+ .map((t) => ({
12
+ name: t.cleanName, // Need to use cleanName to avoid getting '[default]' in the token names
13
+ fallback: t.value,
14
+ }));
15
15
 
16
16
  const negativeSpaceTokens = tokens
17
- .filter(token => token.name.startsWith(spacingTokenPrefix))
18
- .filter(token => token.name.includes(negativeSuffix))
19
- .map(t => ({
20
- name: t.cleanName,
21
- fallback: t.value,
22
- }));
17
+ .filter((token) => token.name.startsWith(spacingTokenPrefix))
18
+ .filter((token) => token.name.includes(negativeSuffix))
19
+ .map((t) => ({
20
+ name: t.cleanName,
21
+ fallback: t.value,
22
+ }));
23
23
 
24
24
  export const createSpacingStylesFromTemplate = () => {
25
- const output = [
26
- `export const positiveSpaceMap = {\n${positiveSpaceTokens
27
- .map(
28
- ({ name, fallback }) =>
29
- `'${name}': ${constructTokenFunctionCall(name, fallback)},`,
30
- )
31
- .join('\n')}}`,
32
- `export type Space = keyof typeof positiveSpaceMap;\n`,
33
- `export const negativeSpaceMap = {\n${negativeSpaceTokens
34
- .map(
35
- ({ name, fallback }) =>
36
- `'${name}': ${constructTokenFunctionCall(name, fallback)},`,
37
- )
38
- .join('\n')}}`,
39
- `export type NegativeSpace = keyof typeof negativeSpaceMap;\n`,
40
- `export const allSpaceMap = { ...positiveSpaceMap, ...negativeSpaceMap };\n`,
41
- `export type AllSpace = keyof typeof allSpaceMap;\n`,
42
- ].join('\n');
25
+ const output = [
26
+ `export const positiveSpaceMap = {\n${positiveSpaceTokens
27
+ .map(({ name, fallback }) => `'${name}': ${constructTokenFunctionCall(name, fallback)},`)
28
+ .join('\n')}}`,
29
+ `export type Space = keyof typeof positiveSpaceMap;\n`,
30
+ `export const negativeSpaceMap = {\n${negativeSpaceTokens
31
+ .map(({ name, fallback }) => `'${name}': ${constructTokenFunctionCall(name, fallback)},`)
32
+ .join('\n')}}`,
33
+ `export type NegativeSpace = keyof typeof negativeSpaceMap;\n`,
34
+ `export const allSpaceMap = { ...positiveSpaceMap, ...negativeSpaceMap };\n`,
35
+ `export type AllSpace = keyof typeof allSpaceMap;\n`,
36
+ ].join('\n');
43
37
 
44
- return format(output, 'typescript');
38
+ return format(output, 'typescript');
45
39
  };
@@ -4,90 +4,84 @@ import { typographyAdg3 as tokens } from '@atlaskit/tokens/tokens-raw';
4
4
  import { capitalize, constructTokenFunctionCall } from './utils';
5
5
 
6
6
  type Token = {
7
- name: string;
8
- fallback: string;
7
+ name: string;
8
+ fallback: string;
9
9
  };
10
10
 
11
11
  const activeTokens: Token[] = tokens
12
- .filter(t => t.attributes.state === 'active')
13
- .map(t => ({
14
- name: t.name,
15
- fallback: t.value,
16
- }));
12
+ .filter((t) => t.attributes.state === 'active')
13
+ .map((t) => ({
14
+ name: t.name,
15
+ fallback: t.value,
16
+ }));
17
17
 
18
18
  const typographyProperties = [
19
- {
20
- objectName: 'fontSize',
21
- cssProperty: 'font',
22
- prefix: 'font.body',
23
- filterFn: <T extends Token>(t: T) => t.name.startsWith('font.body'),
24
- },
25
- {
26
- objectName: 'fontWeight',
27
- cssProperty: 'fontWeight',
28
- prefix: 'font.weight.',
29
- filterFn: <T extends Token>(t: T) => t.name.startsWith('font.weight'),
30
- },
31
- {
32
- objectName: 'fontFamily',
33
- cssProperty: 'fontFamily',
34
- prefix: 'font.family.',
35
- filterFn: <T extends Token>(t: T) => t.name.startsWith('font.family'),
36
- },
19
+ {
20
+ objectName: 'fontSize',
21
+ cssProperty: 'font',
22
+ prefix: 'font.body',
23
+ filterFn: <T extends Token>(t: T) => t.name.startsWith('font.body'),
24
+ },
25
+ {
26
+ objectName: 'fontWeight',
27
+ cssProperty: 'fontWeight',
28
+ prefix: 'font.weight.',
29
+ filterFn: <T extends Token>(t: T) => t.name.startsWith('font.weight'),
30
+ },
31
+ {
32
+ objectName: 'fontFamily',
33
+ cssProperty: 'fontFamily',
34
+ prefix: 'font.family.',
35
+ filterFn: <T extends Token>(t: T) => t.name.startsWith('font.family'),
36
+ },
37
37
  ] as const;
38
38
 
39
39
  const bodySizeMap = {
40
- 'body.small': 'small',
41
- 'body.UNSAFE_small': 'UNSAFE_small',
42
- body: 'medium',
43
- 'body.large': 'large',
40
+ 'body.small': 'small',
41
+ 'body.UNSAFE_small': 'UNSAFE_small',
42
+ body: 'medium',
43
+ 'body.large': 'large',
44
44
  };
45
45
 
46
46
  const removeVerbosity = (name: string): string => {
47
- const partialRemove = ['font.body'];
48
- if (partialRemove.some(s => name.includes(s))) {
49
- // @ts-expect-error Indexing bodySizeMap
50
- return bodySizeMap[name.replace('font.', '')];
51
- }
47
+ const partialRemove = ['font.body'];
48
+ if (partialRemove.some((s) => name.includes(s))) {
49
+ // @ts-expect-error Indexing bodySizeMap
50
+ return bodySizeMap[name.replace('font.', '')];
51
+ }
52
52
 
53
- const fullRemove = ['font.weight'];
54
- const removeIndex = fullRemove.findIndex(s => name.includes(s));
55
- if (removeIndex > -1) {
56
- return name.replace(`${fullRemove[removeIndex]}.`, '');
57
- }
53
+ const fullRemove = ['font.weight'];
54
+ const removeIndex = fullRemove.findIndex((s) => name.includes(s));
55
+ if (removeIndex > -1) {
56
+ return name.replace(`${fullRemove[removeIndex]}.`, '');
57
+ }
58
58
 
59
- return name;
59
+ return name;
60
60
  };
61
61
 
62
62
  export const createTypographyStylesFromTemplate = () => {
63
- return typographyProperties
64
- .map(typographyProperty => {
65
- const { filterFn, objectName } = typographyProperty;
63
+ return typographyProperties
64
+ .map((typographyProperty) => {
65
+ const { filterFn, objectName } = typographyProperty;
66
66
 
67
- return (
68
- format(
69
- `
67
+ return (
68
+ format(
69
+ `
70
70
  export const ${objectName}Map = {
71
71
  ${activeTokens
72
- .filter(filterFn)
73
- .map(t => ({ ...t, name: t.name.replace(/\.\[default\]/g, '') }))
74
- .sort((a, b) => (a.name < b.name ? -1 : 1))
75
- .map(token => {
76
- return `
77
- '${removeVerbosity(token.name)}': ${constructTokenFunctionCall(
78
- token.name,
79
- token.fallback,
80
- )}
72
+ .filter(filterFn)
73
+ .map((t) => ({ ...t, name: t.name.replace(/\.\[default\]/g, '') }))
74
+ .sort((a, b) => (a.name < b.name ? -1 : 1))
75
+ .map((token) => {
76
+ return `
77
+ '${removeVerbosity(token.name)}': ${constructTokenFunctionCall(token.name, token.fallback)}
81
78
  `.trim();
82
- })
83
- .join(',\n\t')}
79
+ })
80
+ .join(',\n\t')}
84
81
  };`,
85
- 'typescript',
86
- ) +
87
- `\nexport type ${capitalize(
88
- objectName,
89
- )} = keyof typeof ${objectName}Map;\n`
90
- );
91
- })
92
- .join('\n');
82
+ 'typescript',
83
+ ) + `\nexport type ${capitalize(objectName)} = keyof typeof ${objectName}Map;\n`
84
+ );
85
+ })
86
+ .join('\n');
93
87
  };
package/scripts/utils.tsx CHANGED
@@ -1,69 +1,62 @@
1
1
  import type { CSSProperties } from 'react';
2
2
 
3
3
  export const tokenCall = (token: string, fallback: string | ShadowDefinition) =>
4
- `token('${token}', '${fallback}')`;
4
+ `token('${token}', '${fallback}')`;
5
5
 
6
6
  export const tokenToStyle = (
7
- prop: keyof CSSProperties,
8
- token: string,
9
- fallback: string | ShadowDefinition,
7
+ prop: keyof CSSProperties,
8
+ token: string,
9
+ fallback: string | ShadowDefinition,
10
10
  ) => {
11
- if (Array.isArray(fallback)) {
12
- fallback = constructShadow(fallback);
13
- }
14
- return `css({\n\t${prop}: ${tokenCall(token, fallback)}\n})`;
11
+ if (Array.isArray(fallback)) {
12
+ fallback = constructShadow(fallback);
13
+ }
14
+ return `css({\n\t${prop}: ${tokenCall(token, fallback)}\n})`;
15
15
  };
16
16
 
17
- export const constructTokenFunctionCall = (
18
- token: string,
19
- fallback: string | ShadowDefinition,
20
- ) => {
21
- if (Array.isArray(fallback)) {
22
- fallback = constructShadow(fallback);
23
- }
17
+ export const constructTokenFunctionCall = (token: string, fallback: string | ShadowDefinition) => {
18
+ if (Array.isArray(fallback)) {
19
+ fallback = constructShadow(fallback);
20
+ }
24
21
 
25
- return `token('${token}', '${fallback}')`;
22
+ return `token('${token}', '${fallback}')`;
26
23
  };
27
24
 
28
25
  export type ShadowDefinition = Array<{
29
- radius: number;
30
- offset: {
31
- x: number;
32
- y: number;
33
- };
34
- color: string;
35
- opacity: number;
26
+ radius: number;
27
+ offset: {
28
+ x: number;
29
+ y: number;
30
+ };
31
+ color: string;
32
+ opacity: number;
36
33
  }>;
37
34
 
38
35
  const constructShadow = (shadowObject: ShadowDefinition) => {
39
- return shadowObject
40
- .map(
41
- shadow =>
42
- `${shadow.offset.x}px ${shadow.offset.y}px ${shadow.radius}px ${shadow.color}`,
43
- )
44
- .join(', ');
36
+ return shadowObject
37
+ .map((shadow) => `${shadow.offset.x}px ${shadow.offset.y}px ${shadow.radius}px ${shadow.color}`)
38
+ .join(', ');
45
39
  };
46
40
 
47
41
  type BooleanCallback<T> = (args: T) => boolean;
48
42
 
49
43
  export const compose =
50
- (...fns: ((...any: any[]) => any)[]) =>
51
- (x: any) =>
52
- fns.reduce((res, fn) => fn(res), x);
44
+ (...fns: ((...any: any[]) => any)[]) =>
45
+ (x: any) =>
46
+ fns.reduce((res, fn) => fn(res), x);
53
47
  export const pick =
54
- <T extends any>(key: keyof T) =>
55
- (obj: T) =>
56
- obj[key];
48
+ <T extends any>(key: keyof T) =>
49
+ (obj: T) =>
50
+ obj[key];
57
51
  export const isAccent = (str: string) => str.includes('accent');
58
52
  export const isPressed = (str: string) => str.includes('pressed');
59
53
  export const isHovered = (str: string) => str.includes('hovered');
60
54
  export const not =
61
- <T extends any>(cb: BooleanCallback<T>) =>
62
- (val: T) =>
63
- !cb(val);
55
+ <T extends any>(cb: BooleanCallback<T>) =>
56
+ (val: T) =>
57
+ !cb(val);
64
58
  export const or =
65
- <T extends any>(...fns: BooleanCallback<T>[]) =>
66
- (val: T) =>
67
- fns.some(fn => fn(val));
68
- export const capitalize = (str: string) =>
69
- str.charAt(0).toUpperCase() + str.slice(1);
59
+ <T extends any>(...fns: BooleanCallback<T>[]) =>
60
+ (val: T) =>
61
+ fns.some((fn) => fn(val));
62
+ export const capitalize = (str: string) => str.charAt(0).toUpperCase() + str.slice(1);