@atlaskit/ds-explorations 1.2.0 → 1.2.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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/components/inline.partial.js +9 -10
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/inline.partial.js +9 -8
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/inline.partial.js +9 -8
- 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/inline.partial.tsx +16 -10
- package/src/components/surface-provider.tsx +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/ds-explorations
|
|
2
2
|
|
|
3
|
+
## 1.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1dec7b39f7b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1dec7b39f7b) - - Children are only iterated over when divider prop is passed. There should be no behaviour change.
|
|
8
|
+
- Add `user-select: none;` to divider.
|
|
9
|
+
|
|
10
|
+
## 1.2.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 1.2.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -60,7 +60,8 @@ var baseStyles = (0, _react2.css)({
|
|
|
60
60
|
var dividerStyles = (0, _react2.css)({
|
|
61
61
|
margin: '0 -2px',
|
|
62
62
|
color: "var(--ds-text-subtle, #42526E)",
|
|
63
|
-
pointerEvents: 'none'
|
|
63
|
+
pointerEvents: 'none',
|
|
64
|
+
userSelect: 'none'
|
|
64
65
|
});
|
|
65
66
|
|
|
66
67
|
var Divider = function Divider(_ref) {
|
|
@@ -94,22 +95,20 @@ var Inline = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
94
95
|
flexWrap = _ref2.flexWrap,
|
|
95
96
|
divider = _ref2.divider,
|
|
96
97
|
UNSAFE_style = _ref2.UNSAFE_style,
|
|
97
|
-
|
|
98
|
+
rawChildren = _ref2.children,
|
|
98
99
|
testId = _ref2.testId;
|
|
99
100
|
var dividerComponent = typeof divider === 'string' ? (0, _react2.jsx)(Divider, null, divider) : divider;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
var children = divider ? _react.Children.toArray(rawChildren).filter(Boolean).map(function (child, index) {
|
|
102
|
+
return (0, _react2.jsx)(_react.Fragment, {
|
|
103
|
+
key: index
|
|
104
|
+
}, divider && index > 0 ? dividerComponent : null, child);
|
|
105
|
+
}) : rawChildren;
|
|
103
106
|
return (0, _react2.jsx)("div", {
|
|
104
107
|
style: UNSAFE_style,
|
|
105
108
|
css: [baseStyles, gap && columnGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
|
|
106
109
|
"data-testid": testId,
|
|
107
110
|
ref: ref
|
|
108
|
-
},
|
|
109
|
-
return (0, _react2.jsx)(_react.Fragment, {
|
|
110
|
-
key: index
|
|
111
|
-
}, divider && index > 0 ? dividerComponent : null, child);
|
|
112
|
-
}));
|
|
111
|
+
}, children);
|
|
113
112
|
}));
|
|
114
113
|
Inline.displayName = 'Inline';
|
|
115
114
|
var _default = Inline;
|
package/dist/cjs/version.json
CHANGED
|
@@ -51,7 +51,8 @@ const baseStyles = css({
|
|
|
51
51
|
const dividerStyles = css({
|
|
52
52
|
margin: '0 -2px',
|
|
53
53
|
color: "var(--ds-text-subtle, #42526E)",
|
|
54
|
-
pointerEvents: 'none'
|
|
54
|
+
pointerEvents: 'none',
|
|
55
|
+
userSelect: 'none'
|
|
55
56
|
});
|
|
56
57
|
|
|
57
58
|
const Divider = ({
|
|
@@ -84,21 +85,21 @@ const Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
84
85
|
flexWrap,
|
|
85
86
|
divider,
|
|
86
87
|
UNSAFE_style,
|
|
87
|
-
children,
|
|
88
|
+
children: rawChildren,
|
|
88
89
|
testId
|
|
89
90
|
}, ref) => {
|
|
90
91
|
const dividerComponent = typeof divider === 'string' ? jsx(Divider, null, divider) : divider;
|
|
91
|
-
const
|
|
92
|
+
const children = divider ? Children.toArray(rawChildren).filter(Boolean).map((child, index) => {
|
|
93
|
+
return jsx(Fragment, {
|
|
94
|
+
key: index
|
|
95
|
+
}, divider && index > 0 ? dividerComponent : null, child);
|
|
96
|
+
}) : rawChildren;
|
|
92
97
|
return jsx("div", {
|
|
93
98
|
style: UNSAFE_style,
|
|
94
99
|
css: [baseStyles, gap && columnGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
|
|
95
100
|
"data-testid": testId,
|
|
96
101
|
ref: ref
|
|
97
|
-
},
|
|
98
|
-
return jsx(Fragment, {
|
|
99
|
-
key: index
|
|
100
|
-
}, divider && index > 0 ? dividerComponent : null, child);
|
|
101
|
-
}));
|
|
102
|
+
}, children);
|
|
102
103
|
}));
|
|
103
104
|
Inline.displayName = 'Inline';
|
|
104
105
|
export default Inline;
|
package/dist/es2019/version.json
CHANGED
|
@@ -51,7 +51,8 @@ var baseStyles = css({
|
|
|
51
51
|
var dividerStyles = css({
|
|
52
52
|
margin: '0 -2px',
|
|
53
53
|
color: "var(--ds-text-subtle, #42526E)",
|
|
54
|
-
pointerEvents: 'none'
|
|
54
|
+
pointerEvents: 'none',
|
|
55
|
+
userSelect: 'none'
|
|
55
56
|
});
|
|
56
57
|
|
|
57
58
|
var Divider = function Divider(_ref) {
|
|
@@ -85,20 +86,20 @@ var Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
85
86
|
flexWrap = _ref2.flexWrap,
|
|
86
87
|
divider = _ref2.divider,
|
|
87
88
|
UNSAFE_style = _ref2.UNSAFE_style,
|
|
88
|
-
|
|
89
|
+
rawChildren = _ref2.children,
|
|
89
90
|
testId = _ref2.testId;
|
|
90
91
|
var dividerComponent = typeof divider === 'string' ? jsx(Divider, null, divider) : divider;
|
|
91
|
-
var
|
|
92
|
+
var children = divider ? Children.toArray(rawChildren).filter(Boolean).map(function (child, index) {
|
|
93
|
+
return jsx(Fragment, {
|
|
94
|
+
key: index
|
|
95
|
+
}, divider && index > 0 ? dividerComponent : null, child);
|
|
96
|
+
}) : rawChildren;
|
|
92
97
|
return jsx("div", {
|
|
93
98
|
style: UNSAFE_style,
|
|
94
99
|
css: [baseStyles, gap && columnGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
|
|
95
100
|
"data-testid": testId,
|
|
96
101
|
ref: ref
|
|
97
|
-
},
|
|
98
|
-
return jsx(Fragment, {
|
|
99
|
-
key: index
|
|
100
|
-
}, divider && index > 0 ? dividerComponent : null, child);
|
|
101
|
-
}));
|
|
102
|
+
}, children);
|
|
102
103
|
}));
|
|
103
104
|
Inline.displayName = 'Inline';
|
|
104
105
|
export default Inline;
|
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.2",
|
|
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) &
|
|
@@ -69,6 +69,7 @@ const dividerStyles = css({
|
|
|
69
69
|
margin: '0 -2px',
|
|
70
70
|
color: token('color.text.subtle', '#42526E'),
|
|
71
71
|
pointerEvents: 'none',
|
|
72
|
+
userSelect: 'none',
|
|
72
73
|
});
|
|
73
74
|
|
|
74
75
|
const Divider: FC = ({ children }) => (
|
|
@@ -101,14 +102,26 @@ const Inline = memo(
|
|
|
101
102
|
flexWrap,
|
|
102
103
|
divider,
|
|
103
104
|
UNSAFE_style,
|
|
104
|
-
children,
|
|
105
|
+
children: rawChildren,
|
|
105
106
|
testId,
|
|
106
107
|
},
|
|
107
108
|
ref,
|
|
108
109
|
) => {
|
|
109
110
|
const dividerComponent =
|
|
110
111
|
typeof divider === 'string' ? <Divider>{divider}</Divider> : divider;
|
|
111
|
-
|
|
112
|
+
|
|
113
|
+
const children = divider
|
|
114
|
+
? Children.toArray(rawChildren)
|
|
115
|
+
.filter(Boolean)
|
|
116
|
+
.map((child, index) => {
|
|
117
|
+
return (
|
|
118
|
+
<Fragment key={index}>
|
|
119
|
+
{divider && index > 0 ? dividerComponent : null}
|
|
120
|
+
{child}
|
|
121
|
+
</Fragment>
|
|
122
|
+
);
|
|
123
|
+
})
|
|
124
|
+
: rawChildren;
|
|
112
125
|
|
|
113
126
|
return (
|
|
114
127
|
<div
|
|
@@ -123,14 +136,7 @@ const Inline = memo(
|
|
|
123
136
|
data-testid={testId}
|
|
124
137
|
ref={ref}
|
|
125
138
|
>
|
|
126
|
-
{
|
|
127
|
-
return (
|
|
128
|
-
<Fragment key={index}>
|
|
129
|
-
{divider && index > 0 ? dividerComponent : null}
|
|
130
|
-
{child}
|
|
131
|
-
</Fragment>
|
|
132
|
-
);
|
|
133
|
-
})}
|
|
139
|
+
{children}
|
|
134
140
|
</div>
|
|
135
141
|
);
|
|
136
142
|
},
|
|
@@ -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__
|