@atlaskit/storybook-addon-design-system 0.5.2 → 0.7.0
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 +31 -16
- package/constellation/images/storybook-addon.png +0 -0
- package/constellation/index/props.mdx +55 -0
- package/constellation/index/usage.mdx +10 -2
- package/dist/cjs/tokens/components/tool.js +14 -16
- package/dist/cjs/tokens/constants.js +5 -10
- package/dist/cjs/tokens/decorator.js +17 -10
- package/dist/cjs/tokens/types.js +1 -5
- package/dist/es2019/tokens/components/tool.js +16 -19
- package/dist/es2019/tokens/decorator.js +14 -4
- package/dist/es2019/tokens/types.js +0 -1
- package/dist/esm/tokens/components/tool.js +11 -12
- package/dist/esm/tokens/decorator.js +14 -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 +8 -9
- package/constellation/index/examples.mdx +0 -5
- package/dist/cjs/version.json +0 -5
- package/dist/es2019/version.json +0 -5
- package/dist/esm/version.json +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,32 +1,47 @@
|
|
|
1
1
|
# @atlaskit/storybook-addon-design-system
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
|
|
9
|
+
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).
|
|
10
|
+
|
|
11
|
+
## 0.6.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#77691](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77691) [`14d18ea34852`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/14d18ea34852) - - Enables new `typography` and `shape` themes
|
|
16
|
+
- Sets the color theme to `auto` by default
|
|
17
|
+
|
|
3
18
|
## 0.5.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
6
21
|
|
|
7
|
-
- [`b1bdec7cce2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b1bdec7cce2) - Internal change to enforce token usage for spacing properties. There is no expected visual or behaviour change.
|
|
22
|
+
- [#32935](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32935) [`b1bdec7cce2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b1bdec7cce2) - Internal change to enforce token usage for spacing properties. There is no expected visual or behaviour change.
|
|
8
23
|
|
|
9
24
|
## 0.5.1
|
|
10
25
|
|
|
11
26
|
### Patch Changes
|
|
12
27
|
|
|
13
|
-
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
28
|
+
- [#33793](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33793) [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
14
29
|
|
|
15
30
|
## 0.5.0
|
|
16
31
|
|
|
17
32
|
### Minor Changes
|
|
18
33
|
|
|
19
|
-
- [`389ab86b2a3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/389ab86b2a3) - Adding spacing tokens to storybook addon so that users spacing tokens appear in storybook
|
|
34
|
+
- [#33632](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33632) [`389ab86b2a3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/389ab86b2a3) - Adding spacing tokens to storybook addon so that users spacing tokens appear in storybook
|
|
20
35
|
|
|
21
36
|
### Patch Changes
|
|
22
37
|
|
|
23
|
-
- [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
38
|
+
- [#33649](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33649) [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
24
39
|
|
|
25
40
|
## 0.4.0
|
|
26
41
|
|
|
27
42
|
### Minor Changes
|
|
28
43
|
|
|
29
|
-
- [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
44
|
+
- [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258) [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
30
45
|
|
|
31
46
|
### Patch Changes
|
|
32
47
|
|
|
@@ -36,7 +51,7 @@
|
|
|
36
51
|
|
|
37
52
|
### Patch Changes
|
|
38
53
|
|
|
39
|
-
- [`718d5ad3044`](https://bitbucket.org/atlassian/atlassian-frontend/commits/718d5ad3044) - Updates to support the new `@atlaskit/tokens` theming API.
|
|
54
|
+
- [#27634](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/27634) [`718d5ad3044`](https://bitbucket.org/atlassian/atlassian-frontend/commits/718d5ad3044) - Updates to support the new `@atlaskit/tokens` theming API.
|
|
40
55
|
- Updated dependencies
|
|
41
56
|
|
|
42
57
|
## 0.3.8
|
|
@@ -55,7 +70,7 @@
|
|
|
55
70
|
|
|
56
71
|
### Patch Changes
|
|
57
72
|
|
|
58
|
-
- [`f824dcfff6e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f824dcfff6e) - Internal changes to satisfy various lint warnings & errors
|
|
73
|
+
- [#27629](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/27629) [`f824dcfff6e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f824dcfff6e) - Internal changes to satisfy various lint warnings & errors
|
|
59
74
|
|
|
60
75
|
## 0.3.5
|
|
61
76
|
|
|
@@ -67,31 +82,31 @@
|
|
|
67
82
|
|
|
68
83
|
### Patch Changes
|
|
69
84
|
|
|
70
|
-
- [`43464a5fb17`](https://bitbucket.org/atlassian/atlassian-frontend/commits/43464a5fb17) - Update split and stack theme settings to use tilde selectors
|
|
85
|
+
- [#26467](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/26467) [`43464a5fb17`](https://bitbucket.org/atlassian/atlassian-frontend/commits/43464a5fb17) - Update split and stack theme settings to use tilde selectors
|
|
71
86
|
|
|
72
87
|
## 0.3.3
|
|
73
88
|
|
|
74
89
|
### Patch Changes
|
|
75
90
|
|
|
76
|
-
- [`9827dcb82b8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9827dcb82b8) - No-op change to introduce spacing tokens to design system components.
|
|
91
|
+
- [#26303](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/26303) [`9827dcb82b8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9827dcb82b8) - No-op change to introduce spacing tokens to design system components.
|
|
77
92
|
|
|
78
93
|
## 0.3.2
|
|
79
94
|
|
|
80
95
|
### Patch Changes
|
|
81
96
|
|
|
82
|
-
- [`d4be43fdc44`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d4be43fdc44) - Set the innerText in our hack correctly - oops!
|
|
97
|
+
- [#24660](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24660) [`d4be43fdc44`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d4be43fdc44) - Set the innerText in our hack correctly - oops!
|
|
83
98
|
|
|
84
99
|
## 0.3.1
|
|
85
100
|
|
|
86
101
|
### Patch Changes
|
|
87
102
|
|
|
88
|
-
- [`6dd7050ad7a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6dd7050ad7a) - Reimplement the style tag hack required for enabling split & stack view in the Storybook addon
|
|
103
|
+
- [#24626](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24626) [`6dd7050ad7a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6dd7050ad7a) - Reimplement the style tag hack required for enabling split & stack view in the Storybook addon
|
|
89
104
|
|
|
90
105
|
## 0.3.0
|
|
91
106
|
|
|
92
107
|
### Minor Changes
|
|
93
108
|
|
|
94
|
-
- [`6c65a3147c1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6c65a3147c1) - Removes root selector hack from lightmode, this is no longer necessary since the default theme no longer enables tokens by default
|
|
109
|
+
- [#21484](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/21484) [`6c65a3147c1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6c65a3147c1) - Removes root selector hack from lightmode, this is no longer necessary since the default theme no longer enables tokens by default
|
|
95
110
|
|
|
96
111
|
### Patch Changes
|
|
97
112
|
|
|
@@ -101,7 +116,7 @@
|
|
|
101
116
|
|
|
102
117
|
### Patch Changes
|
|
103
118
|
|
|
104
|
-
- [`4942487a9f6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4942487a9f6) - Fixes internal representation of CSS entrypoints for themes. This is an internal change only and does not effect public APIs.
|
|
119
|
+
- [#21487](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/21487) [`4942487a9f6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4942487a9f6) - Fixes internal representation of CSS entrypoints for themes. This is an internal change only and does not effect public APIs.
|
|
105
120
|
|
|
106
121
|
## 0.2.5
|
|
107
122
|
|
|
@@ -137,16 +152,16 @@
|
|
|
137
152
|
|
|
138
153
|
### Minor Changes
|
|
139
154
|
|
|
140
|
-
- [`068c9a0b770`](https://bitbucket.org/atlassian/atlassian-frontend/commits/068c9a0b770) - Refactors the storybook addon into a "tool addon"
|
|
155
|
+
- [#18080](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/18080) [`068c9a0b770`](https://bitbucket.org/atlassian/atlassian-frontend/commits/068c9a0b770) - Refactors the storybook addon into a "tool addon"
|
|
141
156
|
|
|
142
157
|
## 0.1.1
|
|
143
158
|
|
|
144
159
|
### Patch Changes
|
|
145
160
|
|
|
146
|
-
- [`32f8832d6c5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/32f8832d6c5) - Temporarily disable css imports to side-step recent changes to the monorepo which trigged a bug
|
|
161
|
+
- [#18020](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/18020) [`32f8832d6c5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/32f8832d6c5) - Temporarily disable css imports to side-step recent changes to the monorepo which trigged a bug
|
|
147
162
|
|
|
148
163
|
## 0.1.0
|
|
149
164
|
|
|
150
165
|
### Minor Changes
|
|
151
166
|
|
|
152
|
-
- [`ddbec37a16c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ddbec37a16c) - Initial release of the design system storybook addon package. Intended to be a generic package for all storybook releated DS tooling
|
|
167
|
+
- [#17460](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/17460) [`ddbec37a16c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ddbec37a16c) - Initial release of the design system storybook addon package. Intended to be a generic package for all storybook releated DS tooling
|
|
Binary file
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
After installing the package, register the addon with your Storybook configuration in the `.storybook/main.js` file.
|
|
2
|
+
|
|
3
|
+
```diff
|
|
4
|
+
module.exports = {
|
|
5
|
+
addons: [
|
|
6
|
+
+ '@atlaskit/storybook-addon-design-system'
|
|
7
|
+
]
|
|
8
|
+
};
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Storybook v6 and below
|
|
12
|
+
|
|
13
|
+
Add the decorator to `.storybook/preview.js`, which is responsible for applying the logic which has the ability to modify the DOM of your stories.
|
|
14
|
+
|
|
15
|
+
```diff
|
|
16
|
+
+ import { withDesignTokens } from '@atlaskit/storybook-addon-design-system';
|
|
17
|
+
|
|
18
|
+
const { addDecorator } = require('@storybook/react');
|
|
19
|
+
|
|
20
|
+
+ addDecorator(withDesignTokens);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Storybook v7 and above
|
|
24
|
+
|
|
25
|
+
For Storybook version 7, the following changes are necessary:
|
|
26
|
+
|
|
27
|
+
1. Initialising the `globalTypes.adsTheme` property in the global context
|
|
28
|
+
2. Disable the [built in `backgrounds` add on](https://storybook.js.org/docs/essentials/backgrounds#disable-backgrounds), as it conflicts with the ADS theming
|
|
29
|
+
|
|
30
|
+
Both of these can be done in [the `preview` file](https://storybook.js.org/docs/configure#configure-story-rendering):
|
|
31
|
+
|
|
32
|
+
```diff
|
|
33
|
+
+ import { withDesignTokens } from '@atlaskit/storybook-addon-design-system';
|
|
34
|
+
|
|
35
|
+
const preview = {
|
|
36
|
+
globalTypes: {
|
|
37
|
+
+ adsTheme: {
|
|
38
|
+
+ description: 'Atlassian Design System theming options',
|
|
39
|
+
+ defaultValue: 'light',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
decorators: [
|
|
43
|
+
+ withDesignTokens
|
|
44
|
+
],
|
|
45
|
+
parameters: {
|
|
46
|
+
+ /**
|
|
47
|
+
+ * Disabling the builtin backgrounds addon so it doesn't override the ADS theming
|
|
48
|
+
+ * See: https://storybook.js.org/docs/essentials/backgrounds#disable-backgrounds
|
|
49
|
+
+ */
|
|
50
|
+
+ backgrounds: { disable: true },
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default preview;
|
|
55
|
+
```
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
order:
|
|
2
|
+
order: 0
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The Design System Storybook Addon allows you to test your UI components in various themes, directly in Storybook.
|
|
6
|
+
It allows you to visualize and compare component appearances across different themes, ensuring correct and consistent design token application.
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **Theme Testing:** Test UI components in multiple themes to ensure they look good across various styles and branding choices.
|
|
13
|
+
- **Split View:** The split view functionality allows you compare components side-by-side in different themes.
|
|
@@ -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();
|
|
@@ -101,5 +100,4 @@ var Tool = function Tool() {
|
|
|
101
100
|
})) === null || _themeOptions$find === void 0 ? void 0 : _themeOptions$find.icon) || 'circlehollow'
|
|
102
101
|
}), '\xa0ADS Theme'));
|
|
103
102
|
};
|
|
104
|
-
var _default = Tool;
|
|
105
|
-
exports.default = _default;
|
|
103
|
+
var _default = exports.default = Tool;
|
|
@@ -4,13 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TOOL_ID = exports.TITLE = exports.DECORATOR_PARAM = exports.DECORATOR_ID = exports.ADDON_ID = void 0;
|
|
7
|
-
var ADDON_ID = 'ads-tokens';
|
|
8
|
-
exports.
|
|
9
|
-
var
|
|
10
|
-
exports.
|
|
11
|
-
var
|
|
12
|
-
exports.TITLE = TITLE;
|
|
13
|
-
var DECORATOR_ID = 'withDesignTokens';
|
|
14
|
-
exports.DECORATOR_ID = DECORATOR_ID;
|
|
15
|
-
var DECORATOR_PARAM = 'DesignTokens';
|
|
16
|
-
exports.DECORATOR_PARAM = DECORATOR_PARAM;
|
|
7
|
+
var ADDON_ID = exports.ADDON_ID = 'ads-tokens';
|
|
8
|
+
var TOOL_ID = exports.TOOL_ID = "".concat(ADDON_ID, "/tool");
|
|
9
|
+
var TITLE = exports.TITLE = 'Design Tokens';
|
|
10
|
+
var DECORATOR_ID = exports.DECORATOR_ID = 'withDesignTokens';
|
|
11
|
+
var DECORATOR_PARAM = exports.DECORATOR_PARAM = 'DesignTokens';
|
|
@@ -13,10 +13,10 @@ 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(
|
|
18
|
-
function ownKeys(
|
|
19
|
-
function _objectSpread(
|
|
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
|
+
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
|
+
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 = {
|
|
21
21
|
position: 'absolute',
|
|
22
22
|
boxSizing: 'border-box',
|
|
@@ -41,7 +41,7 @@ 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 () {
|
|
@@ -56,7 +56,9 @@ var withDesignTokens = (0, _addons.makeDecorator)({
|
|
|
56
56
|
_context.next = 5;
|
|
57
57
|
return (0, _tokens.setGlobalTheme)({
|
|
58
58
|
colorMode: theme,
|
|
59
|
-
spacing: 'spacing'
|
|
59
|
+
spacing: 'spacing',
|
|
60
|
+
shape: 'shape',
|
|
61
|
+
typography: 'typography-minor3'
|
|
60
62
|
});
|
|
61
63
|
case 5:
|
|
62
64
|
return _context.abrupt("break", 15);
|
|
@@ -64,7 +66,9 @@ var withDesignTokens = (0, _addons.makeDecorator)({
|
|
|
64
66
|
_context.next = 8;
|
|
65
67
|
return (0, _tokens.setGlobalTheme)({
|
|
66
68
|
colorMode: 'light',
|
|
67
|
-
spacing: 'spacing'
|
|
69
|
+
spacing: 'spacing',
|
|
70
|
+
shape: 'shape',
|
|
71
|
+
typography: 'typography-minor3'
|
|
68
72
|
});
|
|
69
73
|
case 8:
|
|
70
74
|
document.documentElement.querySelectorAll('style[data-theme]').forEach(function (el) {
|
|
@@ -92,7 +96,11 @@ var withDesignTokens = (0, _addons.makeDecorator)({
|
|
|
92
96
|
}))();
|
|
93
97
|
}, [context.id, theme]);
|
|
94
98
|
function renderStory() {
|
|
95
|
-
var story = storyFn(context)
|
|
99
|
+
var story = storyFn(_objectSpread(_objectSpread({}, context), {}, {
|
|
100
|
+
globals: _objectSpread(_objectSpread({}, context.globals), {}, {
|
|
101
|
+
adsTheme: theme
|
|
102
|
+
})
|
|
103
|
+
}));
|
|
96
104
|
if (theme === 'split' || theme === 'stack') {
|
|
97
105
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
98
106
|
"data-theme": "light:light",
|
|
@@ -117,5 +125,4 @@ var withDesignTokens = (0, _addons.makeDecorator)({
|
|
|
117
125
|
return renderStory();
|
|
118
126
|
}
|
|
119
127
|
});
|
|
120
|
-
var _default = withDesignTokens;
|
|
121
|
-
exports.default = _default;
|
|
128
|
+
var _default = exports.default = withDesignTokens;
|
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,
|
|
@@ -26,7 +26,7 @@ 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(() => {
|
|
@@ -37,14 +37,18 @@ const withDesignTokens = makeDecorator({
|
|
|
37
37
|
case 'auto':
|
|
38
38
|
await setGlobalTheme({
|
|
39
39
|
colorMode: theme,
|
|
40
|
-
spacing: 'spacing'
|
|
40
|
+
spacing: 'spacing',
|
|
41
|
+
shape: 'shape',
|
|
42
|
+
typography: 'typography-minor3'
|
|
41
43
|
});
|
|
42
44
|
break;
|
|
43
45
|
case 'split':
|
|
44
46
|
case 'stack':
|
|
45
47
|
await setGlobalTheme({
|
|
46
48
|
colorMode: 'light',
|
|
47
|
-
spacing: 'spacing'
|
|
49
|
+
spacing: 'spacing',
|
|
50
|
+
shape: 'shape',
|
|
51
|
+
typography: 'typography-minor3'
|
|
48
52
|
});
|
|
49
53
|
document.documentElement.querySelectorAll('style[data-theme]').forEach(el => {
|
|
50
54
|
const clone = el.cloneNode(true);
|
|
@@ -65,7 +69,13 @@ const withDesignTokens = makeDecorator({
|
|
|
65
69
|
})();
|
|
66
70
|
}, [context.id, theme]);
|
|
67
71
|
function renderStory() {
|
|
68
|
-
const story = storyFn(
|
|
72
|
+
const story = storyFn({
|
|
73
|
+
...context,
|
|
74
|
+
globals: {
|
|
75
|
+
...context.globals,
|
|
76
|
+
adsTheme: theme
|
|
77
|
+
}
|
|
78
|
+
});
|
|
69
79
|
if (theme === 'split' || theme === 'stack') {
|
|
70
80
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
71
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();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
function ownKeys(
|
|
4
|
-
function _objectSpread(
|
|
3
|
+
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; }
|
|
4
|
+
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) { _defineProperty(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; }
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
import React, { Fragment } from 'react';
|
|
7
7
|
import { makeDecorator, useEffect } from '@storybook/addons';
|
|
@@ -31,7 +31,7 @@ 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 () {
|
|
@@ -46,7 +46,9 @@ var withDesignTokens = makeDecorator({
|
|
|
46
46
|
_context.next = 5;
|
|
47
47
|
return setGlobalTheme({
|
|
48
48
|
colorMode: theme,
|
|
49
|
-
spacing: 'spacing'
|
|
49
|
+
spacing: 'spacing',
|
|
50
|
+
shape: 'shape',
|
|
51
|
+
typography: 'typography-minor3'
|
|
50
52
|
});
|
|
51
53
|
case 5:
|
|
52
54
|
return _context.abrupt("break", 15);
|
|
@@ -54,7 +56,9 @@ var withDesignTokens = makeDecorator({
|
|
|
54
56
|
_context.next = 8;
|
|
55
57
|
return setGlobalTheme({
|
|
56
58
|
colorMode: 'light',
|
|
57
|
-
spacing: 'spacing'
|
|
59
|
+
spacing: 'spacing',
|
|
60
|
+
shape: 'shape',
|
|
61
|
+
typography: 'typography-minor3'
|
|
58
62
|
});
|
|
59
63
|
case 8:
|
|
60
64
|
document.documentElement.querySelectorAll('style[data-theme]').forEach(function (el) {
|
|
@@ -82,7 +86,11 @@ var withDesignTokens = makeDecorator({
|
|
|
82
86
|
}))();
|
|
83
87
|
}, [context.id, theme]);
|
|
84
88
|
function renderStory() {
|
|
85
|
-
var story = storyFn(context)
|
|
89
|
+
var story = storyFn(_objectSpread(_objectSpread({}, context), {}, {
|
|
90
|
+
globals: _objectSpread(_objectSpread({}, context.globals), {}, {
|
|
91
|
+
adsTheme: theme
|
|
92
|
+
})
|
|
93
|
+
}));
|
|
86
94
|
if (theme === 'split' || theme === 'stack') {
|
|
87
95
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
88
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.0",
|
|
4
4
|
"description": "Design token storybook addon",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
@@ -8,13 +8,10 @@
|
|
|
8
8
|
},
|
|
9
9
|
"atlassian": {
|
|
10
10
|
"team": "Design System Team",
|
|
11
|
-
"releaseModel": "
|
|
11
|
+
"releaseModel": "continuous",
|
|
12
12
|
"website": {
|
|
13
13
|
"name": "Storybook addon",
|
|
14
|
-
"category": "Tooling"
|
|
15
|
-
"status": {
|
|
16
|
-
"type": "alpha"
|
|
17
|
-
}
|
|
14
|
+
"category": "Tooling"
|
|
18
15
|
}
|
|
19
16
|
},
|
|
20
17
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
@@ -36,7 +33,7 @@
|
|
|
36
33
|
".": "./src/index.tsx"
|
|
37
34
|
},
|
|
38
35
|
"dependencies": {
|
|
39
|
-
"@atlaskit/tokens": "^1.
|
|
36
|
+
"@atlaskit/tokens": "^1.43.0",
|
|
40
37
|
"@babel/runtime": "^7.0.0",
|
|
41
38
|
"@storybook/addons": "^6.4.0",
|
|
42
39
|
"@storybook/api": "^6.4.0",
|
|
@@ -60,9 +57,11 @@
|
|
|
60
57
|
"spacing"
|
|
61
58
|
],
|
|
62
59
|
"deprecation": "no-deprecated-imports",
|
|
63
|
-
"styling":
|
|
60
|
+
"styling": [
|
|
61
|
+
"emotion"
|
|
62
|
+
]
|
|
64
63
|
}
|
|
65
64
|
},
|
|
66
65
|
"homepage": "https://atlassian.design/components/storybook-addon-design-system",
|
|
67
66
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
68
|
-
}
|
|
67
|
+
}
|
package/dist/cjs/version.json
DELETED
package/dist/es2019/version.json
DELETED