@atlaskit/ds-explorations 1.2.0 → 1.2.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/CHANGELOG.md +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/version.json +1 -1
- package/examples/01-box.tsx +20 -16
- package/examples/02-text.tsx +3 -9
- package/package.json +3 -3
- package/report.api.md +7 -7
- package/scripts/utils.tsx +16 -7
- package/src/components/box.partial.tsx +1 -1
- package/src/components/surface-provider.tsx +2 -3
package/CHANGELOG.md
CHANGED
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/version.json
CHANGED
package/examples/01-box.tsx
CHANGED
|
@@ -66,14 +66,16 @@ export default () => {
|
|
|
66
66
|
<Stack gap="scale.200" testId="box-with-backgroundColor">
|
|
67
67
|
<Heading level="h600">backgroundColor</Heading>
|
|
68
68
|
<Inline gap="scale.200" alignItems="center">
|
|
69
|
-
{(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
{(
|
|
70
|
+
[
|
|
71
|
+
'discovery.bold',
|
|
72
|
+
'success.bold',
|
|
73
|
+
'warning.bold',
|
|
74
|
+
'danger.bold',
|
|
75
|
+
'information.bold',
|
|
76
|
+
'brand.bold',
|
|
77
|
+
] as const
|
|
78
|
+
).map((bgColor) => (
|
|
77
79
|
<Box key={bgColor} backgroundColor={bgColor} padding="scale.400">
|
|
78
80
|
<Box justifyContent="center">
|
|
79
81
|
<Text>{bgColor}</Text>
|
|
@@ -86,14 +88,16 @@ export default () => {
|
|
|
86
88
|
<Stack gap="scale.200" testId="box-with-borderColor">
|
|
87
89
|
<Heading level="h600">borderColor</Heading>
|
|
88
90
|
<Inline gap="scale.200" alignItems="center">
|
|
89
|
-
{(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
{(
|
|
92
|
+
[
|
|
93
|
+
'discovery',
|
|
94
|
+
'success',
|
|
95
|
+
'warning',
|
|
96
|
+
'danger',
|
|
97
|
+
'information',
|
|
98
|
+
'brand',
|
|
99
|
+
] as const
|
|
100
|
+
).map((borderColor) => (
|
|
97
101
|
<Box
|
|
98
102
|
key={borderColor}
|
|
99
103
|
backgroundColor="neutral"
|
package/examples/02-text.tsx
CHANGED
|
@@ -43,15 +43,9 @@ export default () => {
|
|
|
43
43
|
Line height
|
|
44
44
|
</Heading>
|
|
45
45
|
<Inline gap="scale.200" testId="line-heights" alignItems="center">
|
|
46
|
-
{(
|
|
47
|
-
'12px',
|
|
48
|
-
|
|
49
|
-
'20px',
|
|
50
|
-
'24px',
|
|
51
|
-
'28px',
|
|
52
|
-
'32px',
|
|
53
|
-
'40px',
|
|
54
|
-
] as const).map((lineHeight) => (
|
|
46
|
+
{(
|
|
47
|
+
['12px', '16px', '20px', '24px', '28px', '32px', '40px'] as const
|
|
48
|
+
).map((lineHeight) => (
|
|
55
49
|
<Box
|
|
56
50
|
key={lineHeight}
|
|
57
51
|
display="inlineFlex"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/ds-explorations",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "An experimental package for exploration and validation of spacing / typography foundations.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"atlassian": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"./inline": "./src/components/inline.partial.tsx"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@atlaskit/tokens": "^0.
|
|
42
|
+
"@atlaskit/tokens": "^0.11.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"@emotion/react": "^11.7.1",
|
|
45
45
|
"tiny-invariant": "^1.2.0"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
67
67
|
"@testing-library/react": "^12.1.5",
|
|
68
68
|
"fs-extra": "^4.0.2",
|
|
69
|
-
"prettier": "^2.
|
|
69
|
+
"prettier": "^2.7.0",
|
|
70
70
|
"react-dom": "^16.8.0",
|
|
71
71
|
"ts-node": "^10.9.1",
|
|
72
72
|
"typescript": "4.5.5",
|
package/report.api.md
CHANGED
|
@@ -151,7 +151,7 @@ const borderWidthMap: {
|
|
|
151
151
|
|
|
152
152
|
// @public (undocumented)
|
|
153
153
|
type BoxComponent<T extends ElementType = 'div'> = (<
|
|
154
|
-
T extends ElementType = 'div'
|
|
154
|
+
T extends ElementType = 'div',
|
|
155
155
|
>(
|
|
156
156
|
props: UNSAFE_BoxProps<T>,
|
|
157
157
|
) => ReactElement | null) &
|
|
@@ -540,9 +540,9 @@ export type UNSAFE_BoxProps<T extends ElementType = 'div'> = Omit<
|
|
|
540
540
|
BoxPropsBase<T>;
|
|
541
541
|
|
|
542
542
|
// @public
|
|
543
|
-
export const UNSAFE_Inline: MemoExoticComponent<
|
|
544
|
-
InlineProps & RefAttributes<HTMLDivElement
|
|
545
|
-
|
|
543
|
+
export const UNSAFE_Inline: MemoExoticComponent<
|
|
544
|
+
ForwardRefExoticComponent<InlineProps & RefAttributes<HTMLDivElement>>
|
|
545
|
+
>;
|
|
546
546
|
|
|
547
547
|
// @public (undocumented)
|
|
548
548
|
export const UNSAFE_InteractionSurface: ({
|
|
@@ -552,9 +552,9 @@ export const UNSAFE_InteractionSurface: ({
|
|
|
552
552
|
}: InteractionSurfaceProps) => jsx.JSX.Element;
|
|
553
553
|
|
|
554
554
|
// @public
|
|
555
|
-
export const UNSAFE_Stack: MemoExoticComponent<
|
|
556
|
-
StackProps & RefAttributes<HTMLDivElement
|
|
557
|
-
|
|
555
|
+
export const UNSAFE_Stack: MemoExoticComponent<
|
|
556
|
+
ForwardRefExoticComponent<StackProps & RefAttributes<HTMLDivElement>>
|
|
557
|
+
>;
|
|
558
558
|
|
|
559
559
|
// @internal
|
|
560
560
|
export const UNSAFE_Text: FC<UNSAFE_TextProps>;
|
package/scripts/utils.tsx
CHANGED
|
@@ -10,15 +10,24 @@ export const tokenToStyle = (
|
|
|
10
10
|
|
|
11
11
|
type BooleanCallback<T> = (args: T) => boolean;
|
|
12
12
|
|
|
13
|
-
export const compose =
|
|
14
|
-
fns
|
|
15
|
-
|
|
13
|
+
export const compose =
|
|
14
|
+
(...fns: ((...any: any[]) => any)[]) =>
|
|
15
|
+
(x: any) =>
|
|
16
|
+
fns.reduce((res, fn) => fn(res), x);
|
|
17
|
+
export const pick =
|
|
18
|
+
<T extends any>(key: keyof T) =>
|
|
19
|
+
(obj: T) =>
|
|
20
|
+
obj[key];
|
|
16
21
|
export const isAccent = (str: string) => str.includes('accent');
|
|
17
22
|
export const isPressed = (str: string) => str.includes('pressed');
|
|
18
23
|
export const isHovered = (str: string) => str.includes('hovered');
|
|
19
|
-
export const not =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
export const not =
|
|
25
|
+
<T extends any>(cb: BooleanCallback<T>) =>
|
|
26
|
+
(val: T) =>
|
|
27
|
+
!cb(val);
|
|
28
|
+
export const or =
|
|
29
|
+
<T extends any>(...fns: BooleanCallback<T>[]) =>
|
|
30
|
+
(val: T) =>
|
|
31
|
+
fns.some((fn) => fn(val));
|
|
23
32
|
export const capitalize = (str: string) =>
|
|
24
33
|
str.charAt(0).toUpperCase() + str.slice(1);
|
|
@@ -118,7 +118,7 @@ type BoxPropsBase<T extends ElementType> = {
|
|
|
118
118
|
|
|
119
119
|
// Without this type annotation on Box we don't get autocomplete for props due to forwardRef types
|
|
120
120
|
type BoxComponent<T extends ElementType = 'div'> = (<
|
|
121
|
-
T extends ElementType = 'div'
|
|
121
|
+
T extends ElementType = 'div',
|
|
122
122
|
>(
|
|
123
123
|
props: BoxProps<T>,
|
|
124
124
|
) => ReactElement | null) &
|
|
@@ -7,9 +7,8 @@ import type { BackgroundColor } from './box.partial';
|
|
|
7
7
|
*
|
|
8
8
|
* A surface context provides context information on the current background (if set).
|
|
9
9
|
*/
|
|
10
|
-
export const SurfaceContext =
|
|
11
|
-
'elevation.surface'
|
|
12
|
-
);
|
|
10
|
+
export const SurfaceContext =
|
|
11
|
+
createContext<BackgroundColor>('elevation.surface');
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* __useSurface__
|