react-tab-set 2.0.0 → 2.0.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/README.md CHANGED
@@ -47,7 +47,7 @@ Content can be declared either as children or as the return of a function assign
47
47
 
48
48
  If your component extends `PureComponent` or is presentational, you might prefer to declare content as children.
49
49
 
50
- Otherwise, you might prefer to assign a function to the `render` prop, so that rendering is deferred until the tab is selected.
50
+ Otherwise, you can assign a function to the `render` prop, so that rendering is deferred until the tab is selected.
51
51
 
52
52
  ### Content as children
53
53
 
@@ -99,7 +99,7 @@ Similarly, they can be declared in any combination.
99
99
 
100
100
  ## Demonstrating _react-tab-set_
101
101
 
102
- [Example `Storybooks` are available on GitHub](https://github.com/sequencemedia/react-tab-set).
102
+ [Example `Storybooks` are available](https://github.com/sequencemedia/react-tab-set).
103
103
 
104
104
  Clone the repository, then:
105
105
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "react-tab-set",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "A React Tab Set component",
5
5
  "main": "./src/index.mjs",
6
6
  "type": "module",
7
7
  "author": {
8
8
  "name": "Jonathan Perry for Sequence Media Limited",
9
9
  "email": "sequencemedia@sequencemedia.net",
10
- "url": "http://www.sequencemedia.net"
10
+ "url": "https://www.sequencemedia.net"
11
11
  },
12
12
  "license": "MIT",
13
13
  "engines": {
@@ -39,18 +39,19 @@
39
39
  "@babel/register": "^7.22.15",
40
40
  "@sequencemedia/hooks": "^1.0.454",
41
41
  "@storybook/addon-essentials": "^7.4.4",
42
+ "@storybook/addon-links": "^7.4.4",
42
43
  "@storybook/react": "^7.4.4",
43
44
  "@storybook/react-webpack5": "^7.4.4",
44
45
  "@types/debug": "^4.1.9",
45
46
  "@types/react": "^18.2.22",
46
47
  "@types/uuid": "^9.0.4",
47
- "@typescript-eslint/eslint-plugin": "5.61.0",
48
- "@typescript-eslint/parser": "5.61.0",
48
+ "@typescript-eslint/eslint-plugin": "^6.7.2",
49
+ "@typescript-eslint/parser": "^6.7.2",
49
50
  "core-js": "^3.32.2",
50
51
  "cross-env": "^7.0.3",
51
52
  "eslint": "^8.50.0",
52
53
  "eslint-config-standard": "^17.1.0",
53
- "eslint-config-standard-with-typescript": "35.0.0",
54
+ "eslint-config-standard-with-typescript": "^39.1.0",
54
55
  "eslint-plugin-react": "^7.33.2",
55
56
  "eslint-plugin-storybook": "^0.6.14",
56
57
  "husky": "^8.0.3",
@@ -23,7 +23,8 @@ export interface TabSetProps {
23
23
  function mapChildren (
24
24
  children: JSX.Element | JSX.Element[],
25
25
  selectedTab: string,
26
- onTabSelect: (value: React.SetStateAction<string>) => void): JSX.Element[] {
26
+ onTabSelect: (value: React.SetStateAction<string>) => void
27
+ ): JSX.Element[] {
27
28
  return Children.map(children, (child) => {
28
29
  const { type } = child
29
30
 
@@ -2,6 +2,9 @@ import React, {
2
2
  Children,
3
3
  cloneElement
4
4
  } from 'react'
5
+ import {
6
+ v4
7
+ } from 'uuid'
5
8
 
6
9
  import isTab from './is-tab.mts'
7
10
 
@@ -11,7 +14,11 @@ export interface TabGroupProps {
11
14
  onTabSelect: (value: React.SetStateAction<string>) => void
12
15
  }
13
16
 
14
- function mapChildren (children: JSX.Element | JSX.Element[], selectedTab: string, onTabSelect: (value: React.SetStateAction<string>) => void): JSX.Element[] {
17
+ function mapChildren (
18
+ children: JSX.Element | JSX.Element[],
19
+ selectedTab: string,
20
+ onTabSelect: (value: React.SetStateAction<string>) => void
21
+ ): JSX.Element[] {
15
22
  return Children.map(children, (child) => {
16
23
  const { type } = child
17
24
 
@@ -61,3 +68,8 @@ export default function TabGroup (props: TabGroupProps): JSX.Element {
61
68
  </ul>
62
69
  )
63
70
  }
71
+
72
+ TabGroup.defaultProps = {
73
+ selectedTab: v4(),
74
+ onTabSelect () { }
75
+ }
@@ -1,4 +1,7 @@
1
1
  import React from 'react'
2
+ import {
3
+ v4
4
+ } from 'uuid'
2
5
 
3
6
  export interface TabProps {
4
7
  children: JSX.Element | JSX.Element[] | string | number | boolean
@@ -29,3 +32,8 @@ export default function Tab (props: TabProps): JSX.Element {
29
32
  </li>
30
33
  )
31
34
  }
35
+
36
+ Tab.defaultProps = {
37
+ selectedTab: v4(),
38
+ onTabSelect () { }
39
+ }
@@ -1,4 +1,7 @@
1
1
  import React from 'react'
2
+ import {
3
+ v4
4
+ } from 'uuid'
2
5
 
3
6
  export interface TabPanelProps {
4
7
  children?: JSX.Element | JSX.Element[] | string | number | boolean | undefined | null
@@ -30,3 +33,7 @@ export default function TabPanel (props: TabPanelProps): JSX.Element | null {
30
33
 
31
34
  return null
32
35
  }
36
+
37
+ TabPanel.defaultProps = {
38
+ selectedTab: v4()
39
+ }