@atlaskit/storybook-addon-design-system 0.6.0 → 0.7.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 +14 -0
- package/dist/cjs/tokens/components/tool.js +13 -14
- package/dist/cjs/tokens/decorator.js +12 -8
- package/dist/cjs/tokens/types.js +1 -5
- package/dist/es2019/tokens/components/tool.js +16 -19
- package/dist/es2019/tokens/decorator.js +12 -6
- package/dist/es2019/tokens/types.js +0 -1
- package/dist/esm/tokens/components/tool.js +11 -12
- package/dist/esm/tokens/decorator.js +10 -6
- package/dist/esm/tokens/types.js +0 -1
- package/dist/types/tokens/constants.d.ts +1 -1
- package/dist/types-ts4.5/tokens/constants.d.ts +1 -1
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/storybook-addon-design-system
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#93943](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/93943) [`611f5e98470c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/611f5e98470c) - Removes fallback colors from styles
|
|
8
|
+
|
|
9
|
+
## 0.7.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#94436](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94436) [`c652e1c27a4d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c652e1c27a4d) - Updates the default theme to 'auto' to ensure tokens are always applied. "Unthemed" or "No theme" is now considered an unsafe appearance.
|
|
14
|
+
|
|
15
|
+
If you prefer to use a different theme, you can still override the default theme by setting the `adeTheme.defaultValue: 'none'` as mentioned in [the documentation](https://staging.atlassian.design/components/storybook-addon-design-system/code#storybook-v7-and-above).
|
|
16
|
+
|
|
3
17
|
## 0.6.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -11,16 +11,12 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _api = require("@storybook/api");
|
|
12
12
|
var _components = require("@storybook/components");
|
|
13
13
|
var _constants = require("../constants");
|
|
14
|
-
function _getRequireWildcardCache(
|
|
15
|
-
function _interopRequireWildcard(
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
var themeOptions = [{
|
|
17
|
-
id: 'none',
|
|
18
|
-
title: 'Disable',
|
|
19
|
-
icon: 'cross'
|
|
20
|
-
}, {
|
|
21
17
|
id: 'auto',
|
|
22
18
|
title: 'Same as system',
|
|
23
|
-
icon: '
|
|
19
|
+
icon: 'mirror'
|
|
24
20
|
}, {
|
|
25
21
|
id: 'light',
|
|
26
22
|
title: 'Light theme',
|
|
@@ -37,6 +33,10 @@ var themeOptions = [{
|
|
|
37
33
|
id: 'stack',
|
|
38
34
|
title: 'Stacked',
|
|
39
35
|
icon: 'bottombar'
|
|
36
|
+
}, {
|
|
37
|
+
id: 'none',
|
|
38
|
+
title: 'Disable (Unsafe)',
|
|
39
|
+
icon: 'cross'
|
|
40
40
|
}];
|
|
41
41
|
|
|
42
42
|
/**
|
|
@@ -71,17 +71,16 @@ var Tool = function Tool() {
|
|
|
71
71
|
var id = _ref2.id,
|
|
72
72
|
title = _ref2.title,
|
|
73
73
|
icon = _ref2.icon;
|
|
74
|
-
var Icon = /*#__PURE__*/_react.default.createElement(_components.Icons, {
|
|
75
|
-
style: {
|
|
76
|
-
opacity: 1
|
|
77
|
-
},
|
|
78
|
-
icon: icon
|
|
79
|
-
});
|
|
80
74
|
return {
|
|
81
75
|
id: id,
|
|
82
76
|
title: title,
|
|
83
77
|
active: adsTheme === id,
|
|
84
|
-
right:
|
|
78
|
+
right: /*#__PURE__*/_react.default.createElement(_components.Icons, {
|
|
79
|
+
style: {
|
|
80
|
+
opacity: 1
|
|
81
|
+
},
|
|
82
|
+
icon: icon
|
|
83
|
+
}),
|
|
85
84
|
onClick: function onClick() {
|
|
86
85
|
setTheme(id);
|
|
87
86
|
onHide();
|
|
@@ -13,8 +13,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _addons = require("@storybook/addons");
|
|
14
14
|
var _tokens = require("@atlaskit/tokens");
|
|
15
15
|
var _constants = require("./constants");
|
|
16
|
-
function _getRequireWildcardCache(
|
|
17
|
-
function _interopRequireWildcard(
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
20
|
var splitColumnStyles = {
|
|
@@ -24,8 +24,8 @@ var splitColumnStyles = {
|
|
|
24
24
|
height: '100vh',
|
|
25
25
|
overflow: 'auto',
|
|
26
26
|
padding: '10px',
|
|
27
|
-
background: (0, _tokens.token)('elevation.surface'
|
|
28
|
-
color: (0, _tokens.token)('color.text'
|
|
27
|
+
background: (0, _tokens.token)('elevation.surface'),
|
|
28
|
+
color: (0, _tokens.token)('color.text')
|
|
29
29
|
};
|
|
30
30
|
var stackColumnStyles = {
|
|
31
31
|
position: 'absolute',
|
|
@@ -34,14 +34,14 @@ var stackColumnStyles = {
|
|
|
34
34
|
height: '50%',
|
|
35
35
|
overflow: 'auto',
|
|
36
36
|
padding: '10px',
|
|
37
|
-
background: (0, _tokens.token)('elevation.surface'
|
|
38
|
-
color: (0, _tokens.token)('color.text'
|
|
37
|
+
background: (0, _tokens.token)('elevation.surface'),
|
|
38
|
+
color: (0, _tokens.token)('color.text')
|
|
39
39
|
};
|
|
40
40
|
var withDesignTokens = (0, _addons.makeDecorator)({
|
|
41
41
|
name: _constants.DECORATOR_ID,
|
|
42
42
|
parameterName: _constants.DECORATOR_PARAM,
|
|
43
43
|
wrapper: function wrapper(storyFn, context) {
|
|
44
|
-
var theme = context.globals.adsTheme;
|
|
44
|
+
var theme = context.globals.adsTheme || 'auto';
|
|
45
45
|
|
|
46
46
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
47
47
|
(0, _addons.useEffect)(function () {
|
|
@@ -96,7 +96,11 @@ var withDesignTokens = (0, _addons.makeDecorator)({
|
|
|
96
96
|
}))();
|
|
97
97
|
}, [context.id, theme]);
|
|
98
98
|
function renderStory() {
|
|
99
|
-
var story = storyFn(context)
|
|
99
|
+
var story = storyFn(_objectSpread(_objectSpread({}, context), {}, {
|
|
100
|
+
globals: _objectSpread(_objectSpread({}, context.globals), {}, {
|
|
101
|
+
adsTheme: theme
|
|
102
|
+
})
|
|
103
|
+
}));
|
|
100
104
|
if (theme === 'split' || theme === 'stack') {
|
|
101
105
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
102
106
|
"data-theme": "light:light",
|
package/dist/cjs/tokens/types.js
CHANGED
|
@@ -3,13 +3,9 @@ import { useGlobals } from '@storybook/api';
|
|
|
3
3
|
import { IconButton, Icons, TooltipLinkList, WithTooltip } from '@storybook/components';
|
|
4
4
|
import { TOOL_ID } from '../constants';
|
|
5
5
|
const themeOptions = [{
|
|
6
|
-
id: 'none',
|
|
7
|
-
title: 'Disable',
|
|
8
|
-
icon: 'cross'
|
|
9
|
-
}, {
|
|
10
6
|
id: 'auto',
|
|
11
7
|
title: 'Same as system',
|
|
12
|
-
icon: '
|
|
8
|
+
icon: 'mirror'
|
|
13
9
|
}, {
|
|
14
10
|
id: 'light',
|
|
15
11
|
title: 'Light theme',
|
|
@@ -26,6 +22,10 @@ const themeOptions = [{
|
|
|
26
22
|
id: 'stack',
|
|
27
23
|
title: 'Stacked',
|
|
28
24
|
icon: 'bottombar'
|
|
25
|
+
}, {
|
|
26
|
+
id: 'none',
|
|
27
|
+
title: 'Disable (Unsafe)',
|
|
28
|
+
icon: 'cross'
|
|
29
29
|
}];
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -54,24 +54,21 @@ const Tool = () => {
|
|
|
54
54
|
id,
|
|
55
55
|
title,
|
|
56
56
|
icon
|
|
57
|
-
}) => {
|
|
58
|
-
|
|
57
|
+
}) => ({
|
|
58
|
+
id,
|
|
59
|
+
title,
|
|
60
|
+
active: adsTheme === id,
|
|
61
|
+
right: /*#__PURE__*/React.createElement(Icons, {
|
|
59
62
|
style: {
|
|
60
63
|
opacity: 1
|
|
61
64
|
},
|
|
62
65
|
icon: icon
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
id
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
onClick: () => {
|
|
70
|
-
setTheme(id);
|
|
71
|
-
onHide();
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
})
|
|
66
|
+
}),
|
|
67
|
+
onClick: () => {
|
|
68
|
+
setTheme(id);
|
|
69
|
+
onHide();
|
|
70
|
+
}
|
|
71
|
+
}))
|
|
75
72
|
})
|
|
76
73
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
77
74
|
key: TOOL_ID,
|
|
@@ -9,8 +9,8 @@ const splitColumnStyles = {
|
|
|
9
9
|
height: '100vh',
|
|
10
10
|
overflow: 'auto',
|
|
11
11
|
padding: '10px',
|
|
12
|
-
background: token('elevation.surface'
|
|
13
|
-
color: token('color.text'
|
|
12
|
+
background: token('elevation.surface'),
|
|
13
|
+
color: token('color.text')
|
|
14
14
|
};
|
|
15
15
|
const stackColumnStyles = {
|
|
16
16
|
position: 'absolute',
|
|
@@ -19,14 +19,14 @@ const stackColumnStyles = {
|
|
|
19
19
|
height: '50%',
|
|
20
20
|
overflow: 'auto',
|
|
21
21
|
padding: '10px',
|
|
22
|
-
background: token('elevation.surface'
|
|
23
|
-
color: token('color.text'
|
|
22
|
+
background: token('elevation.surface'),
|
|
23
|
+
color: token('color.text')
|
|
24
24
|
};
|
|
25
25
|
const withDesignTokens = makeDecorator({
|
|
26
26
|
name: DECORATOR_ID,
|
|
27
27
|
parameterName: DECORATOR_PARAM,
|
|
28
28
|
wrapper: (storyFn, context) => {
|
|
29
|
-
const theme = context.globals.adsTheme;
|
|
29
|
+
const theme = context.globals.adsTheme || 'auto';
|
|
30
30
|
|
|
31
31
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
32
32
|
useEffect(() => {
|
|
@@ -69,7 +69,13 @@ const withDesignTokens = makeDecorator({
|
|
|
69
69
|
})();
|
|
70
70
|
}, [context.id, theme]);
|
|
71
71
|
function renderStory() {
|
|
72
|
-
const story = storyFn(
|
|
72
|
+
const story = storyFn({
|
|
73
|
+
...context,
|
|
74
|
+
globals: {
|
|
75
|
+
...context.globals,
|
|
76
|
+
adsTheme: theme
|
|
77
|
+
}
|
|
78
|
+
});
|
|
73
79
|
if (theme === 'split' || theme === 'stack') {
|
|
74
80
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
75
81
|
"data-theme": "light:light",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -4,13 +4,9 @@ import { useGlobals } from '@storybook/api';
|
|
|
4
4
|
import { IconButton, Icons, TooltipLinkList, WithTooltip } from '@storybook/components';
|
|
5
5
|
import { TOOL_ID } from '../constants';
|
|
6
6
|
var themeOptions = [{
|
|
7
|
-
id: 'none',
|
|
8
|
-
title: 'Disable',
|
|
9
|
-
icon: 'cross'
|
|
10
|
-
}, {
|
|
11
7
|
id: 'auto',
|
|
12
8
|
title: 'Same as system',
|
|
13
|
-
icon: '
|
|
9
|
+
icon: 'mirror'
|
|
14
10
|
}, {
|
|
15
11
|
id: 'light',
|
|
16
12
|
title: 'Light theme',
|
|
@@ -27,6 +23,10 @@ var themeOptions = [{
|
|
|
27
23
|
id: 'stack',
|
|
28
24
|
title: 'Stacked',
|
|
29
25
|
icon: 'bottombar'
|
|
26
|
+
}, {
|
|
27
|
+
id: 'none',
|
|
28
|
+
title: 'Disable (Unsafe)',
|
|
29
|
+
icon: 'cross'
|
|
30
30
|
}];
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -61,17 +61,16 @@ var Tool = function Tool() {
|
|
|
61
61
|
var id = _ref2.id,
|
|
62
62
|
title = _ref2.title,
|
|
63
63
|
icon = _ref2.icon;
|
|
64
|
-
var Icon = /*#__PURE__*/React.createElement(Icons, {
|
|
65
|
-
style: {
|
|
66
|
-
opacity: 1
|
|
67
|
-
},
|
|
68
|
-
icon: icon
|
|
69
|
-
});
|
|
70
64
|
return {
|
|
71
65
|
id: id,
|
|
72
66
|
title: title,
|
|
73
67
|
active: adsTheme === id,
|
|
74
|
-
right:
|
|
68
|
+
right: /*#__PURE__*/React.createElement(Icons, {
|
|
69
|
+
style: {
|
|
70
|
+
opacity: 1
|
|
71
|
+
},
|
|
72
|
+
icon: icon
|
|
73
|
+
}),
|
|
75
74
|
onClick: function onClick() {
|
|
76
75
|
setTheme(id);
|
|
77
76
|
onHide();
|
|
@@ -14,8 +14,8 @@ var splitColumnStyles = {
|
|
|
14
14
|
height: '100vh',
|
|
15
15
|
overflow: 'auto',
|
|
16
16
|
padding: '10px',
|
|
17
|
-
background: token('elevation.surface'
|
|
18
|
-
color: token('color.text'
|
|
17
|
+
background: token('elevation.surface'),
|
|
18
|
+
color: token('color.text')
|
|
19
19
|
};
|
|
20
20
|
var stackColumnStyles = {
|
|
21
21
|
position: 'absolute',
|
|
@@ -24,14 +24,14 @@ var stackColumnStyles = {
|
|
|
24
24
|
height: '50%',
|
|
25
25
|
overflow: 'auto',
|
|
26
26
|
padding: '10px',
|
|
27
|
-
background: token('elevation.surface'
|
|
28
|
-
color: token('color.text'
|
|
27
|
+
background: token('elevation.surface'),
|
|
28
|
+
color: token('color.text')
|
|
29
29
|
};
|
|
30
30
|
var withDesignTokens = makeDecorator({
|
|
31
31
|
name: DECORATOR_ID,
|
|
32
32
|
parameterName: DECORATOR_PARAM,
|
|
33
33
|
wrapper: function wrapper(storyFn, context) {
|
|
34
|
-
var theme = context.globals.adsTheme;
|
|
34
|
+
var theme = context.globals.adsTheme || 'auto';
|
|
35
35
|
|
|
36
36
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
37
37
|
useEffect(function () {
|
|
@@ -86,7 +86,11 @@ var withDesignTokens = makeDecorator({
|
|
|
86
86
|
}))();
|
|
87
87
|
}, [context.id, theme]);
|
|
88
88
|
function renderStory() {
|
|
89
|
-
var story = storyFn(context)
|
|
89
|
+
var story = storyFn(_objectSpread(_objectSpread({}, context), {}, {
|
|
90
|
+
globals: _objectSpread(_objectSpread({}, context.globals), {}, {
|
|
91
|
+
adsTheme: theme
|
|
92
|
+
})
|
|
93
|
+
}));
|
|
90
94
|
if (theme === 'split' || theme === 'stack') {
|
|
91
95
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
92
96
|
"data-theme": "light:light",
|
package/dist/esm/tokens/types.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const ADDON_ID = "ads-tokens";
|
|
2
|
-
export declare const TOOL_ID
|
|
2
|
+
export declare const TOOL_ID = "ads-tokens/tool";
|
|
3
3
|
export declare const TITLE = "Design Tokens";
|
|
4
4
|
export declare const DECORATOR_ID = "withDesignTokens";
|
|
5
5
|
export declare const DECORATOR_PARAM = "DesignTokens";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const ADDON_ID = "ads-tokens";
|
|
2
|
-
export declare const TOOL_ID
|
|
2
|
+
export declare const TOOL_ID = "ads-tokens/tool";
|
|
3
3
|
export declare const TITLE = "Design Tokens";
|
|
4
4
|
export declare const DECORATOR_ID = "withDesignTokens";
|
|
5
5
|
export declare const DECORATOR_PARAM = "DesignTokens";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/storybook-addon-design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Design token storybook addon",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
".": "./src/index.tsx"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/tokens": "^1.
|
|
36
|
+
"@atlaskit/tokens": "^1.43.0",
|
|
37
37
|
"@babel/runtime": "^7.0.0",
|
|
38
38
|
"@storybook/addons": "^6.4.0",
|
|
39
39
|
"@storybook/api": "^6.4.0",
|
|
@@ -57,9 +57,11 @@
|
|
|
57
57
|
"spacing"
|
|
58
58
|
],
|
|
59
59
|
"deprecation": "no-deprecated-imports",
|
|
60
|
-
"styling":
|
|
60
|
+
"styling": [
|
|
61
|
+
"emotion"
|
|
62
|
+
]
|
|
61
63
|
}
|
|
62
64
|
},
|
|
63
65
|
"homepage": "https://atlassian.design/components/storybook-addon-design-system",
|
|
64
66
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
65
|
-
}
|
|
67
|
+
}
|