@storybook/preact 7.6.0-alpha.6 → 7.6.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/preact",
3
- "version": "7.6.0-alpha.6",
3
+ "version": "7.6.0-beta.0",
4
4
  "description": "Storybook Preact renderer",
5
5
  "keywords": [
6
6
  "storybook"
@@ -43,14 +43,14 @@
43
43
  "!src/**/*"
44
44
  ],
45
45
  "scripts": {
46
- "check": "../../../scripts/prepare/check.ts",
47
- "prep": "../../../scripts/prepare/bundle.ts"
46
+ "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts",
47
+ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts"
48
48
  },
49
49
  "dependencies": {
50
- "@storybook/core-client": "7.6.0-alpha.6",
50
+ "@storybook/core-client": "7.6.0-beta.0",
51
51
  "@storybook/global": "^5.0.0",
52
- "@storybook/preview-api": "7.6.0-alpha.6",
53
- "@storybook/types": "7.6.0-alpha.6",
52
+ "@storybook/preview-api": "7.6.0-beta.0",
53
+ "@storybook/types": "7.6.0-beta.0",
54
54
  "ts-dedent": "^2.0.0"
55
55
  },
56
56
  "devDependencies": {
@@ -1,10 +1,21 @@
1
- import PropTypes from 'prop-types';
2
1
  import './button.css';
3
2
 
4
3
  /**
5
4
  * Primary UI component for user interaction
5
+ * @param {object} props
6
+ * @param {string} [props.primary=false]
7
+ * @param {string} [props.backgroundColor]
8
+ * @param {('small' | 'medium' | 'large')} [props.size='medium']
9
+ * @param {string} props.label
10
+ * @param {function} props.onClick
6
11
  */
7
- export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
12
+ export const Button = ({
13
+ primary = false,
14
+ backgroundColor = null,
15
+ size = 'medium',
16
+ label,
17
+ ...props
18
+ }) => {
8
19
  const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
9
20
  return (
10
21
  <button
@@ -17,33 +28,3 @@ export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
17
28
  </button>
18
29
  );
19
30
  };
20
-
21
- Button.propTypes = {
22
- /**
23
- * Is this the principal call to action on the page?
24
- */
25
- primary: PropTypes.bool,
26
- /**
27
- * What background color to use
28
- */
29
- backgroundColor: PropTypes.string,
30
- /**
31
- * How large should the button be?
32
- */
33
- size: PropTypes.oneOf(['small', 'medium', 'large']),
34
- /**
35
- * Button contents
36
- */
37
- label: PropTypes.string.isRequired,
38
- /**
39
- * Optional click handler
40
- */
41
- onClick: PropTypes.func,
42
- };
43
-
44
- Button.defaultProps = {
45
- backgroundColor: null,
46
- primary: false,
47
- size: 'medium',
48
- onClick: undefined,
49
- };
@@ -1,9 +1,16 @@
1
- import PropTypes from 'prop-types';
2
-
3
1
  import { Button } from './Button';
4
2
  import './header.css';
5
3
 
6
- export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (
4
+ /**
5
+ * Header component
6
+ * @param {object} props
7
+ * @param {object} [props.user]
8
+ * @param {string} props.user.name
9
+ * @param {function} props.onLogin
10
+ * @param {function} props.onLogout
11
+ * @param {function} props.onCreateAccount
12
+ */
13
+ export const Header = ({ user = null, onLogin, onLogout, onCreateAccount }) => (
7
14
  <header>
8
15
  <div className="storybook-header">
9
16
  <div>
@@ -43,16 +50,3 @@ export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (
43
50
  </div>
44
51
  </header>
45
52
  );
46
-
47
- Header.propTypes = {
48
- user: PropTypes.shape({
49
- name: PropTypes.string.isRequired,
50
- }),
51
- onLogin: PropTypes.func.isRequired,
52
- onLogout: PropTypes.func.isRequired,
53
- onCreateAccount: PropTypes.func.isRequired,
54
- };
55
-
56
- Header.defaultProps = {
57
- user: null,
58
- };
@@ -2,6 +2,9 @@ import { useState } from 'preact/hooks';
2
2
  import { Header } from './Header';
3
3
  import './page.css';
4
4
 
5
+ /**
6
+ * Simple page component
7
+ */
5
8
  export const Page = () => {
6
9
  const [user, setUser] = useState();
7
10
 
@@ -1,8 +1,11 @@
1
1
  // eslint-disable-next-line import/no-extraneous-dependencies
2
2
  import React from 'react';
3
- // eslint-disable-next-line import/no-extraneous-dependencies
4
- import PropTypes from 'prop-types';
5
3
 
4
+ /**
5
+ * ReactFunctionalComponent component
6
+ * @param {object} props
7
+ * @param {string} props.label
8
+ */
6
9
  export const ReactFunctionalComponent = ({ label }) => {
7
10
  const [clicks, setValue] = React.useState(0);
8
11
  return (
@@ -19,10 +22,11 @@ export const ReactFunctionalComponent = ({ label }) => {
19
22
  );
20
23
  };
21
24
 
22
- ReactFunctionalComponent.propTypes = {
23
- label: PropTypes.string.isRequired,
24
- };
25
-
25
+ /**
26
+ * ReactClassComponent component
27
+ * @param {object} props
28
+ * @param {string} props.label
29
+ */
26
30
  export class ReactClassComponent extends React.Component {
27
31
  state = {
28
32
  clicks: 0,
@@ -45,7 +49,3 @@ export class ReactClassComponent extends React.Component {
45
49
  );
46
50
  }
47
51
  }
48
-
49
- ReactClassComponent.propTypes = {
50
- label: PropTypes.string.isRequired,
51
- };
@@ -1,4 +1,3 @@
1
- /* eslint-disable react/react-in-jsx-scope */
2
1
  import { ReactFunctionalComponent, ReactClassComponent } from './React';
3
2
 
4
3
  export default {