@newhighsco/chipset 6.27.3 → 7.0.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,7 +1,7 @@
1
1
  {
2
2
  "name": "@newhighsco/chipset",
3
3
  "description": "Shareable, theme-able component library by New High Score",
4
- "version": "6.27.3",
4
+ "version": "7.0.0",
5
5
  "author": "New High Score",
6
6
  "license": "ISC",
7
7
  "repository": {
@@ -12,6 +12,7 @@
12
12
  "bugs": {
13
13
  "url": "https://github.com/newhighsco/chipset/issues"
14
14
  },
15
+ "packageManager": "yarn@4.12.0",
15
16
  "main": "src/index.js",
16
17
  "files": [
17
18
  "src",
@@ -22,22 +23,23 @@
22
23
  },
23
24
  "scripts": {
24
25
  "prepare": "husky",
25
- "start": "storybook dev --port 49928 --docs",
26
+ "start": "storybook dev --port 49928",
26
27
  "build": "storybook build --output-dir build --docs --quiet --webpack-stats-json",
27
28
  "pretest": "yarn lint",
28
29
  "test": "jest --runInBand",
29
30
  "test:list": "jest --listTests",
30
31
  "snapshot": "chromatic --storybook-build-dir build --auto-accept-changes main --exit-once-uploaded --only-changed",
31
32
  "analyze": "omlet analyze",
32
- "lint": "concurrently yarn:lint:*",
33
+ "lint": "concurrently 'yarn:lint:*'",
33
34
  "lint:js": "eslint --cache .",
34
35
  "lint:css": "stylelint --cache --ignore-path .gitignore '**/*.?(s)css'",
35
- "format": "concurrently yarn:format:*",
36
+ "format": "concurrently 'yarn:format:*'",
36
37
  "format:js": "yarn lint:js --fix",
37
38
  "format:css": "yarn lint:css --fix"
38
39
  },
39
40
  "dependencies": {
40
41
  "@dr.pogodin/react-themes": "1.10.3",
42
+ "@iconify/react": "6.0.2",
41
43
  "classnames": "2.5.1",
42
44
  "react-device-detect": "2.2.3"
43
45
  },
@@ -45,26 +47,26 @@
45
47
  "@babel/core": "7.29.0",
46
48
  "@babel/preset-env": "7.29.0",
47
49
  "@babel/preset-react": "7.28.5",
48
- "@commitlint/cli": "20.4.1",
50
+ "@commitlint/cli": "20.4.2",
49
51
  "@newhighsco/browserslist-config": "2.0.0",
50
52
  "@newhighsco/commitlint-config": "1.1.48",
51
53
  "@newhighsco/editor-config": "1.2.0",
52
- "@newhighsco/eslint-config": "6.0.17",
53
- "@newhighsco/postcss-config": "4.0.19",
54
+ "@newhighsco/eslint-config": "7.0.10",
55
+ "@newhighsco/postcss-config": "4.0.20",
54
56
  "@newhighsco/prettier-config": "2.3.3",
55
- "@newhighsco/release-config": "1.4.24",
56
- "@newhighsco/storybook-preset": "10.2.3",
57
- "@newhighsco/stylelint-config": "4.0.24",
57
+ "@newhighsco/release-config": "1.4.25",
58
+ "@newhighsco/storybook-preset": "10.2.9",
59
+ "@newhighsco/stylelint-config": "4.0.27",
58
60
  "@newhighsco/svgr-config": "1.0.0",
59
61
  "@omlet/cli": "2.0.0",
60
- "@storybook/react-webpack5": "10.2.7",
62
+ "@storybook/react-webpack5": "10.2.10",
61
63
  "@testing-library/dom": "10.4.1",
62
64
  "@testing-library/jest-dom": "6.9.1",
63
65
  "@testing-library/react": "16.3.2",
64
66
  "babel-loader": "10.0.0",
65
- "chromatic": "15.0.0",
67
+ "chromatic": "15.1.1",
66
68
  "concurrently": "9.2.1",
67
- "eslint": "9.39.2",
69
+ "eslint": "10.0.0",
68
70
  "husky": "9.1.7",
69
71
  "identity-obj-proxy": "3.0.0",
70
72
  "jest": "30.2.0",
@@ -76,9 +78,9 @@
76
78
  "react-dom": "19.2.4",
77
79
  "sass-true": "10.1.0",
78
80
  "semantic-release": "25.0.3",
79
- "storybook": "10.2.7",
80
- "stylelint": "17.1.1",
81
- "webpack": "5.105.0"
81
+ "storybook": "10.2.10",
82
+ "stylelint": "17.3.0",
83
+ "webpack": "5.105.2"
82
84
  },
83
85
  "peerDependencies": {
84
86
  "react": "19.2.4",
@@ -1,5 +1,6 @@
1
+ import { Icon as IconifyIcon } from '@iconify/react'
1
2
  import { node, number, object, oneOfType, shape, string } from 'prop-types'
2
- import { Children, cloneElement } from 'react'
3
+ import React, { Children, cloneElement } from 'react'
3
4
 
4
5
  import { classNames } from '../../utils'
5
6
 
@@ -7,8 +8,9 @@ import { classNames } from '../../utils'
7
8
  * Use `Icon` to wrap SVGs
8
9
  */
9
10
  const Icon = ({
11
+ name,
10
12
  width,
11
- height,
13
+ height = width,
12
14
  alt,
13
15
  children,
14
16
  theme,
@@ -16,19 +18,27 @@ const Icon = ({
16
18
  style,
17
19
  ...rest
18
20
  }) => {
19
- if (!children) return null
21
+ if (!name && !children) return null
20
22
 
21
- return cloneElement(Children.only(children), {
23
+ const props = {
24
+ 'aria-hidden': alt ? null : true,
25
+ 'aria-label': alt,
22
26
  className: classNames(theme?.root, className),
23
- ...(alt && { role: 'img', title: alt }),
24
- ...(!alt && { 'aria-hidden': true }),
27
+ role: alt ? 'img' : null,
25
28
  style: { ...style, width, height },
26
29
  ...rest
27
- })
30
+ }
31
+
32
+ if (children) {
33
+ return cloneElement(Children.only(children), props)
34
+ }
35
+
36
+ return <IconifyIcon icon={name} fallback={<span {...props} />} {...props} />
28
37
  }
29
38
 
30
39
  Icon.displayName = 'Icon'
31
40
  Icon.propTypes = {
41
+ name: string,
32
42
  height: oneOfType([number, string]),
33
43
  width: oneOfType([number, string]),
34
44
  alt: string,
@@ -3,6 +3,7 @@
3
3
  fill: currentColor;
4
4
  font-style: normal;
5
5
  height: auto;
6
+ min-height: 1em;
6
7
  vertical-align: middle;
7
8
  width: 1em;
8
9
  }
@@ -38,7 +38,6 @@ const LiveStream = ({
38
38
  }
39
39
 
40
40
  loadUrls()
41
- // eslint-disable-next-line react-hooks/exhaustive-deps
42
41
  }, [])
43
42
 
44
43
  if (loading) return <VisuallyHidden>Loading live stream</VisuallyHidden>
@@ -6,12 +6,8 @@ import { classNames } from '../../utils'
6
6
  import Button from '../Button'
7
7
  import Icon from '../Icon'
8
8
  import List from '../List'
9
- import { ReactComponent as ArrowDownSvg } from './images/arrow-down.svg'
10
- import { ReactComponent as ArrowUpSvg } from './images/arrow-up.svg'
11
- import { ReactComponent as CloseSvg } from './images/close.svg'
12
- import { ReactComponent as MenuSvg } from './images/menu.svg'
13
9
 
14
- const ICONS = { true: <CloseSvg />, false: <MenuSvg /> }
10
+ const ICONS = { false: 'material-symbols:menu', true: 'material-symbols:close' }
15
11
  const LABELS = { false: 'Show', true: 'Hide' }
16
12
 
17
13
  const Menubar = ({
@@ -25,7 +21,7 @@ const Menubar = ({
25
21
  theme
26
22
  }) => {
27
23
  const [visible, setVisibility] = useToggle(!toggle)
28
- const [listId, iconId] = useIds(['list', 'icon'])
24
+ const id = useIds()
29
25
 
30
26
  if (!links.length) return null
31
27
 
@@ -41,25 +37,19 @@ const Menubar = ({
41
37
  {toggle && (
42
38
  <Button
43
39
  active={visible}
44
- aria-controls={listId}
40
+ aria-controls={id}
45
41
  aria-expanded={visible}
46
- aria-labelledby={iconId}
42
+ aria-label={`${LABELS[visible]} ${title}`}
47
43
  aria-haspopup
48
44
  onClick={toggleVisibility}
49
45
  theme={{ root: theme?.toggle, active: theme?.toggleActive }}
50
46
  >
51
47
  {toggle.children}
52
- <Icon
53
- id={iconId}
54
- theme={{ root: theme?.toggleIcon }}
55
- alt={`${LABELS[visible]} ${title}`}
56
- >
57
- {icons[visible]}
58
- </Icon>
48
+ <Icon theme={{ root: theme?.toggleIcon }} name={icons[visible]} />
59
49
  </Button>
60
50
  )}
61
51
  <List
62
- id={listId}
52
+ id={id}
63
53
  role={role}
64
54
  unstyled
65
55
  inline={inline}
@@ -83,7 +73,10 @@ const Menubar = ({
83
73
  role="menu"
84
74
  links={links}
85
75
  toggle={{
86
- icons: { true: <ArrowUpSvg />, false: <ArrowDownSvg /> },
76
+ icons: {
77
+ false: 'material-symbols:arrow-drop-down',
78
+ true: 'material-symbols:arrow-drop-up'
79
+ },
87
80
  ...props
88
81
  }}
89
82
  theme={{ ...theme, toggle: theme?.link }}
@@ -1,6 +1,7 @@
1
1
  import { shape, string } from 'prop-types'
2
- import React, { useId } from 'react'
2
+ import React from 'react'
3
3
 
4
+ import { useIds } from '../../hooks'
4
5
  import { classNames } from '../../utils'
5
6
  import Menubar from '../Menubar'
6
7
  import SmartLink from '../SmartLink'
@@ -16,7 +17,7 @@ const Navigation = ({
16
17
  theme,
17
18
  className
18
19
  }) => {
19
- const id = useId()
20
+ const id = useIds()
20
21
 
21
22
  if (!links.length) return null
22
23
 
@@ -39,7 +39,6 @@ const SmartLink = ({
39
39
  const { role = 'link' } = rest
40
40
 
41
41
  return (
42
- // eslint-disable-next-line jsx-a11y/anchor-is-valid
43
42
  <a ref={setRef} className={className} role={role} aria-disabled="true">
44
43
  {children}
45
44
  </a>
@@ -1,7 +1,7 @@
1
1
  import { bool, node, oneOf, shape, string } from 'prop-types'
2
- import React, { useId } from 'react'
2
+ import React from 'react'
3
3
 
4
- import { useToggle } from '../../hooks'
4
+ import { useIds, useToggle } from '../../hooks'
5
5
  import { classNames } from '../../utils'
6
6
  import SmartLink from '../SmartLink'
7
7
 
@@ -24,7 +24,7 @@ const Tooltip = ({
24
24
  className
25
25
  }) => {
26
26
  const [visible, setVisibility] = useToggle(!hidden)
27
- const id = useId()
27
+ const id = useIds()
28
28
 
29
29
  if (!heading && !children) return null
30
30
 
@@ -1,7 +1,9 @@
1
1
  import { useId } from 'react'
2
2
 
3
- export const useIds = (elements = []) => {
3
+ export const useIds = (...elements) => {
4
4
  const id = useId()
5
5
 
6
+ if (!elements.length) return id
7
+
6
8
  return elements.map(element => [id, element].join('-'))
7
9
  }
@@ -1,7 +1,6 @@
1
1
  import { func, node } from 'prop-types'
2
2
  import React, { createContext, useContext } from 'react'
3
3
 
4
- // eslint-disable-next-line jsx-a11y/alt-text
5
4
  const ImageContext = createContext(props => <img {...props} />)
6
5
 
7
6
  export const useImage = () => {
@@ -1,7 +1,6 @@
1
1
  import { func, node } from 'prop-types'
2
2
  import React, { createContext, useContext } from 'react'
3
3
 
4
- // eslint-disable-next-line jsx-a11y/anchor-has-content
5
4
  const LinkContext = createContext(props => <a {...props} />)
6
5
 
7
6
  export const useLink = () => {
@@ -1 +0,0 @@
1
- <svg viewBox="0 0 24 24"><path d="M7 10l5 5 5-5H7z"/></svg>
@@ -1 +0,0 @@
1
- <svg viewBox="0 0 24 24"><path d="M7 14l5-5 5 5H7z"/></svg>
@@ -1 +0,0 @@
1
- <svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
@@ -1 +0,0 @@
1
- <svg viewBox="0 0 24 24"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>