@storybook/addon-controls 6.4.0-beta.20 → 6.4.0-beta.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-controls",
3
- "version": "6.4.0-beta.20",
3
+ "version": "6.4.0-beta.24",
4
4
  "description": "Interact with component inputs dynamically in the Storybook UI",
5
5
  "keywords": [
6
6
  "addon",
@@ -45,15 +45,15 @@
45
45
  "prepare": "node ../../scripts/prepare.js"
46
46
  },
47
47
  "dependencies": {
48
- "@storybook/addons": "6.4.0-beta.20",
49
- "@storybook/api": "6.4.0-beta.20",
50
- "@storybook/client-logger": "6.4.0-beta.20",
51
- "@storybook/components": "6.4.0-beta.20",
52
- "@storybook/core-common": "6.4.0-beta.20",
48
+ "@storybook/addons": "6.4.0-beta.24",
49
+ "@storybook/api": "6.4.0-beta.24",
50
+ "@storybook/client-logger": "6.4.0-beta.24",
51
+ "@storybook/components": "6.4.0-beta.24",
52
+ "@storybook/core-common": "6.4.0-beta.24",
53
53
  "@storybook/csf": "0.0.2--canary.87bc651.0",
54
- "@storybook/node-logger": "6.4.0-beta.20",
55
- "@storybook/store": "6.4.0-beta.20",
56
- "@storybook/theming": "6.4.0-beta.20",
54
+ "@storybook/node-logger": "6.4.0-beta.24",
55
+ "@storybook/store": "6.4.0-beta.24",
56
+ "@storybook/theming": "6.4.0-beta.24",
57
57
  "core-js": "^3.8.2",
58
58
  "lodash": "^4.17.20",
59
59
  "ts-dedent": "^2.0.0"
@@ -73,7 +73,7 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "1a9315fd39f7e4abcdf3eb839dc29aedce346e01",
76
+ "gitHead": "f53ba4d7210b5c4809d57c74d7a42314172aa63e",
77
77
  "sbmodern": "dist/modern/register.js",
78
78
  "storybook": {
79
79
  "displayName": "Controls",
@@ -1,107 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.symbol.js");
4
-
5
- require("core-js/modules/es.symbol.description.js");
6
-
7
- require("core-js/modules/es.object.to-string.js");
8
-
9
- require("core-js/modules/es.symbol.iterator.js");
10
-
11
- require("core-js/modules/es.string.iterator.js");
12
-
13
- require("core-js/modules/es.array.iterator.js");
14
-
15
- require("core-js/modules/web.dom-collections.iterator.js");
16
-
17
- require("core-js/modules/es.array.slice.js");
18
-
19
- require("core-js/modules/es.function.name.js");
20
-
21
- require("core-js/modules/es.array.from.js");
22
-
23
- Object.defineProperty(exports, "__esModule", {
24
- value: true
25
- });
26
- exports.ControlsPanel = void 0;
27
-
28
- require("core-js/modules/es.object.values.js");
29
-
30
- require("core-js/modules/es.object.entries.js");
31
-
32
- require("core-js/modules/es.object.assign.js");
33
-
34
- var _react = _interopRequireDefault(require("react"));
35
-
36
- var _api = require("@storybook/api");
37
-
38
- var _components = require("@storybook/components");
39
-
40
- var _constants = require("./constants");
41
-
42
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
-
44
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
45
-
46
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
47
-
48
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
49
-
50
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
51
-
52
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
53
-
54
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
55
-
56
- var ControlsPanel = function ControlsPanel() {
57
- var _useArgs = (0, _api.useArgs)(),
58
- _useArgs2 = _slicedToArray(_useArgs, 3),
59
- args = _useArgs2[0],
60
- updateArgs = _useArgs2[1],
61
- resetArgs = _useArgs2[2];
62
-
63
- var rows = (0, _api.useArgTypes)();
64
- var isArgsStory = (0, _api.useParameter)('__isArgsStory', false);
65
-
66
- var _useParameter = (0, _api.useParameter)(_constants.PARAM_KEY, {}),
67
- expanded = _useParameter.expanded,
68
- sort = _useParameter.sort,
69
- presetColors = _useParameter.presetColors,
70
- _useParameter$hideNoC = _useParameter.hideNoControlsWarning,
71
- hideNoControlsWarning = _useParameter$hideNoC === void 0 ? false : _useParameter$hideNoC;
72
-
73
- var _useStorybookState = (0, _api.useStorybookState)(),
74
- path = _useStorybookState.path;
75
-
76
- var hasControls = Object.values(rows).some(function (arg) {
77
- return arg === null || arg === void 0 ? void 0 : arg.control;
78
- });
79
- var showWarning = !(hasControls && isArgsStory) && !hideNoControlsWarning;
80
- var withPresetColors = Object.entries(rows).reduce(function (acc, _ref) {
81
- var _arg$control, _arg$control2;
82
-
83
- var _ref2 = _slicedToArray(_ref, 2),
84
- key = _ref2[0],
85
- arg = _ref2[1];
86
-
87
- if ((arg === null || arg === void 0 ? void 0 : (_arg$control = arg.control) === null || _arg$control === void 0 ? void 0 : _arg$control.type) !== 'color' || arg !== null && arg !== void 0 && (_arg$control2 = arg.control) !== null && _arg$control2 !== void 0 && _arg$control2.presetColors) acc[key] = arg;else acc[key] = Object.assign({}, arg, {
88
- control: Object.assign({}, arg.control, {
89
- presetColors: presetColors
90
- })
91
- });
92
- return acc;
93
- }, {});
94
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showWarning && /*#__PURE__*/_react.default.createElement(_components.NoControlsWarning, null), /*#__PURE__*/_react.default.createElement(_components.ArgsTable, {
95
- key: path,
96
- // resets state when switching stories
97
- compact: !expanded && hasControls,
98
- rows: withPresetColors,
99
- args: args,
100
- updateArgs: updateArgs,
101
- resetArgs: resetArgs,
102
- inAddonPanel: true,
103
- sort: sort
104
- }));
105
- };
106
-
107
- exports.ControlsPanel = ControlsPanel;
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PARAM_KEY = exports.ADDON_ID = void 0;
7
- var ADDON_ID = 'addon-controls';
8
- exports.ADDON_ID = ADDON_ID;
9
- var PARAM_KEY = 'controls';
10
- exports.PARAM_KEY = PARAM_KEY;
package/dist/cjs/index.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "PARAM_KEY", {
7
- enumerable: true,
8
- get: function get() {
9
- return _constants.PARAM_KEY;
10
- }
11
- });
12
-
13
- var _constants = require("./constants");
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
- require("core-js/modules/es.weak-map.js");
6
-
7
- require("core-js/modules/es.string.iterator.js");
8
-
9
- require("core-js/modules/es.array.iterator.js");
10
-
11
- require("core-js/modules/web.dom-collections.iterator.js");
12
-
13
- require("core-js/modules/es.object.get-own-property-descriptor.js");
14
-
15
- require("core-js/modules/es.symbol.js");
16
-
17
- require("core-js/modules/es.symbol.description.js");
18
-
19
- require("core-js/modules/es.symbol.iterator.js");
20
-
21
- Object.defineProperty(exports, "__esModule", {
22
- value: true
23
- });
24
- exports.checkDocsLoaded = void 0;
25
-
26
- require("core-js/modules/es.array.join.js");
27
-
28
- require("core-js/modules/es.promise.js");
29
-
30
- require("core-js/modules/es.object.to-string.js");
31
-
32
- var _coreCommon = require("@storybook/core-common");
33
-
34
- var _path = _interopRequireDefault(require("path"));
35
-
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
-
38
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
39
-
40
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
-
42
- var checkDocsLoaded = function checkDocsLoaded(configDir) {
43
- (0, _coreCommon.checkAddonOrder)({
44
- before: {
45
- name: '@storybook/addon-docs',
46
- inEssentials: true
47
- },
48
- after: {
49
- name: '@storybook/addon-controls',
50
- inEssentials: true
51
- },
52
- configFile: _path.default.isAbsolute(configDir) ? _path.default.join(configDir, 'main') : _path.default.join(process.cwd(), configDir, 'main'),
53
- getConfig: function getConfig(configFile) {
54
- return Promise.resolve("".concat(configFile)).then(function (s) {
55
- return _interopRequireWildcard(require(s));
56
- });
57
- }
58
- });
59
- };
60
-
61
- exports.checkDocsLoaded = checkDocsLoaded;
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.array.filter.js");
4
-
5
- require("core-js/modules/es.object.values.js");
6
-
7
- var _react = _interopRequireDefault(require("react"));
8
-
9
- var _addons = require("@storybook/addons");
10
-
11
- var _components = require("@storybook/components");
12
-
13
- var _api = require("@storybook/api");
14
-
15
- var _ControlsPanel = require("./ControlsPanel");
16
-
17
- var _constants = require("./constants");
18
-
19
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
-
21
- _addons.addons.register(_constants.ADDON_ID, function (api) {
22
- _addons.addons.addPanel(_constants.ADDON_ID, {
23
- title: function title() {
24
- var rows = (0, _api.useArgTypes)();
25
- var controlsCount = Object.values(rows).filter(function (argType) {
26
- return argType === null || argType === void 0 ? void 0 : argType.control;
27
- }).length;
28
- var suffix = controlsCount === 0 ? '' : " (".concat(controlsCount, ")");
29
- return "Controls".concat(suffix);
30
- },
31
- type: _addons.types.PANEL,
32
- paramKey: _constants.PARAM_KEY,
33
- render: function render(_ref) {
34
- var key = _ref.key,
35
- active = _ref.active;
36
-
37
- if (!active || !api.getCurrentStoryData()) {
38
- return null;
39
- }
40
-
41
- return /*#__PURE__*/_react.default.createElement(_components.AddonPanel, {
42
- key: key,
43
- active: active
44
- }, /*#__PURE__*/_react.default.createElement(_ControlsPanel.ControlsPanel, null));
45
- }
46
- });
47
- });
@@ -1,80 +0,0 @@
1
- import "core-js/modules/es.object.values.js";
2
- import "core-js/modules/es.object.entries.js";
3
- import "core-js/modules/es.object.assign.js";
4
- import "core-js/modules/es.symbol.js";
5
- import "core-js/modules/es.symbol.description.js";
6
- import "core-js/modules/es.object.to-string.js";
7
- import "core-js/modules/es.symbol.iterator.js";
8
- import "core-js/modules/es.string.iterator.js";
9
- import "core-js/modules/es.array.iterator.js";
10
- import "core-js/modules/web.dom-collections.iterator.js";
11
- import "core-js/modules/es.array.slice.js";
12
- import "core-js/modules/es.function.name.js";
13
- import "core-js/modules/es.array.from.js";
14
-
15
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
-
17
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
18
-
19
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
20
-
21
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
22
-
23
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
24
-
25
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
-
27
- import React from 'react';
28
- import { useArgs, useArgTypes, useParameter, useStorybookState } from '@storybook/api';
29
- import { ArgsTable, NoControlsWarning } from '@storybook/components';
30
- import { PARAM_KEY } from './constants';
31
- export var ControlsPanel = function ControlsPanel() {
32
- var _useArgs = useArgs(),
33
- _useArgs2 = _slicedToArray(_useArgs, 3),
34
- args = _useArgs2[0],
35
- updateArgs = _useArgs2[1],
36
- resetArgs = _useArgs2[2];
37
-
38
- var rows = useArgTypes();
39
- var isArgsStory = useParameter('__isArgsStory', false);
40
-
41
- var _useParameter = useParameter(PARAM_KEY, {}),
42
- expanded = _useParameter.expanded,
43
- sort = _useParameter.sort,
44
- presetColors = _useParameter.presetColors,
45
- _useParameter$hideNoC = _useParameter.hideNoControlsWarning,
46
- hideNoControlsWarning = _useParameter$hideNoC === void 0 ? false : _useParameter$hideNoC;
47
-
48
- var _useStorybookState = useStorybookState(),
49
- path = _useStorybookState.path;
50
-
51
- var hasControls = Object.values(rows).some(function (arg) {
52
- return arg === null || arg === void 0 ? void 0 : arg.control;
53
- });
54
- var showWarning = !(hasControls && isArgsStory) && !hideNoControlsWarning;
55
- var withPresetColors = Object.entries(rows).reduce(function (acc, _ref) {
56
- var _arg$control, _arg$control2;
57
-
58
- var _ref2 = _slicedToArray(_ref, 2),
59
- key = _ref2[0],
60
- arg = _ref2[1];
61
-
62
- if ((arg === null || arg === void 0 ? void 0 : (_arg$control = arg.control) === null || _arg$control === void 0 ? void 0 : _arg$control.type) !== 'color' || arg !== null && arg !== void 0 && (_arg$control2 = arg.control) !== null && _arg$control2 !== void 0 && _arg$control2.presetColors) acc[key] = arg;else acc[key] = Object.assign({}, arg, {
63
- control: Object.assign({}, arg.control, {
64
- presetColors: presetColors
65
- })
66
- });
67
- return acc;
68
- }, {});
69
- return /*#__PURE__*/React.createElement(React.Fragment, null, showWarning && /*#__PURE__*/React.createElement(NoControlsWarning, null), /*#__PURE__*/React.createElement(ArgsTable, {
70
- key: path,
71
- // resets state when switching stories
72
- compact: !expanded && hasControls,
73
- rows: withPresetColors,
74
- args: args,
75
- updateArgs: updateArgs,
76
- resetArgs: resetArgs,
77
- inAddonPanel: true,
78
- sort: sort
79
- }));
80
- };
@@ -1,2 +0,0 @@
1
- export var ADDON_ID = 'addon-controls';
2
- export var PARAM_KEY = 'controls';
package/dist/esm/index.js DELETED
@@ -1 +0,0 @@
1
- export { PARAM_KEY } from './constants';
@@ -1,21 +0,0 @@
1
- import "core-js/modules/es.array.join.js";
2
- import "core-js/modules/es.promise.js";
3
- import "core-js/modules/es.object.to-string.js";
4
- import { checkAddonOrder } from '@storybook/core-common';
5
- import path from 'path';
6
- export var checkDocsLoaded = function checkDocsLoaded(configDir) {
7
- checkAddonOrder({
8
- before: {
9
- name: '@storybook/addon-docs',
10
- inEssentials: true
11
- },
12
- after: {
13
- name: '@storybook/addon-controls',
14
- inEssentials: true
15
- },
16
- configFile: path.isAbsolute(configDir) ? path.join(configDir, 'main') : path.join(process.cwd(), configDir, 'main'),
17
- getConfig: function getConfig(configFile) {
18
- return import(configFile);
19
- }
20
- });
21
- };
@@ -1,35 +0,0 @@
1
- import "core-js/modules/es.array.filter.js";
2
- import "core-js/modules/es.object.values.js";
3
- import React from 'react';
4
- import { addons, types } from '@storybook/addons';
5
- import { AddonPanel } from '@storybook/components';
6
- import { useArgTypes } from '@storybook/api';
7
- import { ControlsPanel } from './ControlsPanel';
8
- import { ADDON_ID, PARAM_KEY } from './constants';
9
- addons.register(ADDON_ID, function (api) {
10
- addons.addPanel(ADDON_ID, {
11
- title: function title() {
12
- var rows = useArgTypes();
13
- var controlsCount = Object.values(rows).filter(function (argType) {
14
- return argType === null || argType === void 0 ? void 0 : argType.control;
15
- }).length;
16
- var suffix = controlsCount === 0 ? '' : " (".concat(controlsCount, ")");
17
- return "Controls".concat(suffix);
18
- },
19
- type: types.PANEL,
20
- paramKey: PARAM_KEY,
21
- render: function render(_ref) {
22
- var key = _ref.key,
23
- active = _ref.active;
24
-
25
- if (!active || !api.getCurrentStoryData()) {
26
- return null;
27
- }
28
-
29
- return /*#__PURE__*/React.createElement(AddonPanel, {
30
- key: key,
31
- active: active
32
- }, /*#__PURE__*/React.createElement(ControlsPanel, null));
33
- }
34
- });
35
- });
@@ -1,42 +0,0 @@
1
- import "core-js/modules/es.array.reduce.js";
2
- import React from 'react';
3
- import { useArgs, useArgTypes, useParameter, useStorybookState } from '@storybook/api';
4
- import { ArgsTable, NoControlsWarning } from '@storybook/components';
5
- import { PARAM_KEY } from './constants';
6
- export const ControlsPanel = () => {
7
- const [args, updateArgs, resetArgs] = useArgs();
8
- const rows = useArgTypes();
9
- const isArgsStory = useParameter('__isArgsStory', false);
10
- const {
11
- expanded,
12
- sort,
13
- presetColors,
14
- hideNoControlsWarning = false
15
- } = useParameter(PARAM_KEY, {});
16
- const {
17
- path
18
- } = useStorybookState();
19
- const hasControls = Object.values(rows).some(arg => arg === null || arg === void 0 ? void 0 : arg.control);
20
- const showWarning = !(hasControls && isArgsStory) && !hideNoControlsWarning;
21
- const withPresetColors = Object.entries(rows).reduce((acc, [key, arg]) => {
22
- var _arg$control, _arg$control2;
23
-
24
- if ((arg === null || arg === void 0 ? void 0 : (_arg$control = arg.control) === null || _arg$control === void 0 ? void 0 : _arg$control.type) !== 'color' || arg !== null && arg !== void 0 && (_arg$control2 = arg.control) !== null && _arg$control2 !== void 0 && _arg$control2.presetColors) acc[key] = arg;else acc[key] = Object.assign({}, arg, {
25
- control: Object.assign({}, arg.control, {
26
- presetColors
27
- })
28
- });
29
- return acc;
30
- }, {});
31
- return /*#__PURE__*/React.createElement(React.Fragment, null, showWarning && /*#__PURE__*/React.createElement(NoControlsWarning, null), /*#__PURE__*/React.createElement(ArgsTable, {
32
- key: path,
33
- // resets state when switching stories
34
- compact: !expanded && hasControls,
35
- rows: withPresetColors,
36
- args,
37
- updateArgs,
38
- resetArgs,
39
- inAddonPanel: true,
40
- sort
41
- }));
42
- };
@@ -1,2 +0,0 @@
1
- export const ADDON_ID = 'addon-controls';
2
- export const PARAM_KEY = 'controls';
@@ -1 +0,0 @@
1
- export { PARAM_KEY } from './constants';
@@ -1,16 +0,0 @@
1
- import { checkAddonOrder } from '@storybook/core-common';
2
- import path from 'path';
3
- export const checkDocsLoaded = configDir => {
4
- checkAddonOrder({
5
- before: {
6
- name: '@storybook/addon-docs',
7
- inEssentials: true
8
- },
9
- after: {
10
- name: '@storybook/addon-controls',
11
- inEssentials: true
12
- },
13
- configFile: path.isAbsolute(configDir) ? path.join(configDir, 'main') : path.join(process.cwd(), configDir, 'main'),
14
- getConfig: configFile => import(configFile)
15
- });
16
- };
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
- import { addons, types } from '@storybook/addons';
3
- import { AddonPanel } from '@storybook/components';
4
- import { useArgTypes } from '@storybook/api';
5
- import { ControlsPanel } from './ControlsPanel';
6
- import { ADDON_ID, PARAM_KEY } from './constants';
7
- addons.register(ADDON_ID, api => {
8
- addons.addPanel(ADDON_ID, {
9
- title() {
10
- const rows = useArgTypes();
11
- const controlsCount = Object.values(rows).filter(argType => argType === null || argType === void 0 ? void 0 : argType.control).length;
12
- const suffix = controlsCount === 0 ? '' : ` (${controlsCount})`;
13
- return `Controls${suffix}`;
14
- },
15
-
16
- type: types.PANEL,
17
- paramKey: PARAM_KEY,
18
- render: ({
19
- key,
20
- active
21
- }) => {
22
- if (!active || !api.getCurrentStoryData()) {
23
- return null;
24
- }
25
-
26
- return /*#__PURE__*/React.createElement(AddonPanel, {
27
- key: key,
28
- active: active
29
- }, /*#__PURE__*/React.createElement(ControlsPanel, null));
30
- }
31
- });
32
- });
@@ -1,2 +0,0 @@
1
- import { FC } from 'react';
2
- export declare const ControlsPanel: FC;
@@ -1,2 +0,0 @@
1
- export declare const ADDON_ID: "addon-controls";
2
- export declare const PARAM_KEY: "controls";
@@ -1 +0,0 @@
1
- export { PARAM_KEY } from './constants';
@@ -1 +0,0 @@
1
- export declare const checkDocsLoaded: (configDir: string) => void;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { FC } from 'react';
2
- export declare const ControlsPanel: FC;
@@ -1,2 +0,0 @@
1
- export declare const ADDON_ID: "addon-controls";
2
- export declare const PARAM_KEY: "controls";
@@ -1 +0,0 @@
1
- export { PARAM_KEY } from './constants';
@@ -1 +0,0 @@
1
- export declare const checkDocsLoaded: (configDir: string) => void;
@@ -1 +0,0 @@
1
- export {};