Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump dependency #1254

Merged
merged 10 commits into from
Aug 28, 2024
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"everything-else"
]}
],
"react/prop-types": "off",
"jsx-a11y/click-events-have-key-events": 0,
"jsx-a11y/no-static-element-interactions": 1,
"jsx-a11y/label-has-associated-control": ["error", {
Expand Down
1,420 changes: 537 additions & 883 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
},
"devDependencies": {
"@babel/cli": "~7.24.8",
"@babel/core": "~7.24.9",
"@babel/eslint-parser": "~7.24.8",
"@babel/preset-env": "~7.24.8",
"@babel/core": "~7.25.2",
"@babel/eslint-parser": "~7.25.1",
"@babel/preset-env": "~7.25.4",
"@babel/preset-react": "~7.24.7",
"@babel/preset-typescript": "~7.24.7",
"@rollup/plugin-babel": "~6.0.4",
Expand All @@ -55,18 +55,18 @@
"@rollup/plugin-replace": "~5.0.7",
"@rollup/plugin-terser": "~0.4.4",
"@rollup/plugin-typescript": "~11.1.6",
"@storybook/addon-links": "~8.1.11",
"@storybook/addon-links": "~8.2.9",
"@storybook/addon-webpack5-compiler-babel": "~3.0.3",
"@storybook/react": "~8.2.9",
"@storybook/react-webpack5": "~8.2.9",
"@svgr/rollup": "~8.1.0",
"@svgr/webpack": "~8.1.0",
"@testing-library/dom": "~10.3.2",
"@testing-library/dom": "~10.4.0",
"@testing-library/jest-dom": "~6.5.0",
"@testing-library/react": "~16.0.0",
"@testing-library/user-event": "~14.5.2",
"@types/jest": "~29.5.12",
"@types/react": "^18.3.3",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"babel-jest": "~29.7.0",
"babel-loader": "~9.1.3",
Expand All @@ -79,9 +79,9 @@
"eslint-config-prettier": "~9.1.0",
"eslint-plugin-import": "~2.29.1",
"eslint-plugin-jsx-a11y": "~6.9.0",
"eslint-plugin-prettier": "~5.1.3",
"eslint-plugin-prettier": "~5.2.1",
"eslint-plugin-react": "~7.35.0",
"eslint-webpack-plugin": "~4.1.0",
"eslint-webpack-plugin": "~4.2.0",
"file-loader": "~6.2.0",
"husky": "~9.1.5",
"jest": "~29.7.0",
Expand All @@ -91,19 +91,19 @@
"postcss": "~8.4.41",
"prettier": "^3.3.3",
"prop-types": "~15.8.1",
"react": "~18.2.0",
"react-dom": "~18.2.0",
"react": "~18.3.1",
"react-dom": "~18.3.1",
"rollup": "~4.21.1",
"rollup-plugin-scss": "~4.0.0",
"sass-loader": "~14.2.1",
"storybook": "~8.2.6",
"sass-loader": "~16.0.1",
"storybook": "~8.2.9",
"style-loader": "~4.0.0",
"stylelint": "~16.8.2",
"stylelint": "~16.9.0",
"stylelint-config-standard-scss": "~13.1.0",
"ts-jest": "~29.2.5",
"typescript": "~5.5.4",
"typescript-eslint": "~7.16.1",
"webpack": "~5.92.1",
"typescript-eslint": "~8.3.0",
"webpack": "~5.94.0",
"webpack-cli": "~5.1.4"
},
"dependencies": {
Expand Down
12 changes: 3 additions & 9 deletions src/components/Accordion/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const Accordion = ({
children,
className,
header,
openByDefault,
openByDefault = false,
subHeader,
tabIndex,
tabIndex = 0,
withoutBorders,
onToggle,
onToggle = () => {},
}) => {
const [isOpen, toggleOpen] = useState(openByDefault)
const firstUpdate = useRef(true)
Expand Down Expand Up @@ -45,12 +45,6 @@ const Accordion = ({
)
}

Accordion.defaultProps = {
openByDefault: false,
tabIndex: 0,
onToggle: () => {},
}

Accordion.propTypes = {
id: PropTypes.string,
children: PropTypes.node,
Expand Down
27 changes: 15 additions & 12 deletions src/components/Button/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@ import React, { forwardRef } from 'react'
import PropTypes from 'prop-types'

const Button = forwardRef(
({ children, className, disabled, icon, negative, onClick, primary, type, ariaLabel, onKeyDown }, ref) => (
(
{
children,
className,
disabled = false,
icon,
negative = false,
onClick = () => {},
primary = false,
type = 'button',
ariaLabel,
onKeyDown = () => {},
},
ref
) => (
<button
type={type}
ref={ref}
Expand All @@ -20,17 +34,6 @@ const Button = forwardRef(

Button.displayName = 'Button'

Button.defaultProps = {
className: '',
disabled: false,
negative: false,
onClick: () => {},
onKeyDown: () => {},
primary: false,
type: 'button',
ariaLabel: '',
}

Button.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string,
Expand Down
21 changes: 6 additions & 15 deletions src/components/ButtonTertiary/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const ButtonTertiary = ({
children,
className,
header,
openByDefault,
tabIndex,
accordion,
disabled,
negative,
onClick,
openByDefault = false,
tabIndex = 0,
accordion = true,
disabled = false,
negative = false,
onClick = () => {},
}) => {
const [isOpen, toggleOpen] = useState(openByDefault)
const classNames = `ssb-btn-tertiary${negative ? ' negative' : ''}${className ? ` ${className}` : ''}`
Expand Down Expand Up @@ -50,15 +50,6 @@ const ButtonTertiary = ({
)
}

ButtonTertiary.defaultProps = {
openByDefault: false,
tabIndex: 0,
accordion: true,
disabled: false,
negative: false,
onClick: () => {},
}

ButtonTertiary.propTypes = {
id: PropTypes.string,
children: PropTypes.node,
Expand Down
12 changes: 3 additions & 9 deletions src/components/Card/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ const Card = ({
children,
className,
external,
downloadText,
downloadText = 'Last ned',
fileLocation,
href,
hrefText,
icon,
image,
imagePlacement,
profiled,
imagePlacement = 'top',
profiled = false,
subTitle,
title,
}) => (
Expand Down Expand Up @@ -88,12 +88,6 @@ const Card = ({
</div>
)

Card.defaultProps = {
downloadText: 'Last ned',
imagePlacement: 'top',
profiled: false,
}

Card.propTypes = {
ariaLabel: PropTypes.string,
children: PropTypes.node.isRequired,
Expand Down
4 changes: 0 additions & 4 deletions src/components/CategoryLink/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ const CategoryLink = ({ ariaLabel, titleText, subText, className, href, tabIndex
)
}

CategoryLink.defaultProps = {
className: '',
}

CategoryLink.propTypes = {
ariaLabel: PropTypes.string,
titleText: PropTypes.string,
Expand Down
7 changes: 1 addition & 6 deletions src/components/Checkbox/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'

const Checkbox = ({ callback, children, className, disabled, selected, tabIndex, value }) => (
const Checkbox = ({ callback = () => {}, children, className, disabled, selected, tabIndex = 0, value }) => (
<div className={`ssb-checkbox${className ? ` ${className}` : ''}`}>
<input
tabIndex={tabIndex}
Expand All @@ -18,11 +18,6 @@ const Checkbox = ({ callback, children, className, disabled, selected, tabIndex,
</div>
)

Checkbox.defaultProps = {
callback: () => {},
tabIndex: 0,
}

Checkbox.propTypes = {
callback: PropTypes.func,
children: PropTypes.node,
Expand Down
15 changes: 8 additions & 7 deletions src/components/CheckboxGroup/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import React, { useEffect, useState } from 'react'
import PropTypes from 'prop-types'
import Checkbox from '../Checkbox'

const CheckboxGroup = ({ className, header, items, onChange, orientation, selectedValues }) => {
const CheckboxGroup = ({
className,
header,
items,
onChange = () => {},
orientation = 'column',
selectedValues = [''],
}) => {
const [selected, updateSelected] = useState(selectedValues)

useEffect(() => {
Expand Down Expand Up @@ -40,12 +47,6 @@ const CheckboxGroup = ({ className, header, items, onChange, orientation, select
)
}

CheckboxGroup.defaultProps = {
onChange: () => {},
orientation: 'column',
selectedValues: [''],
}

CheckboxGroup.propTypes = {
className: PropTypes.string,
header: PropTypes.string,
Expand Down
7 changes: 1 addition & 6 deletions src/components/Dialog/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import { AlertTriangle, Info } from 'react-feather'

const Dialog = ({ children, className, title, type }) => (
const Dialog = ({ children, className, title, type = 'info' }) => (
<div className={`ssb-dialog ${type}${className ? ` ${className}` : ''}`}>
<div className='icon-panel'>
{type === 'warning' && <AlertTriangle size={45} className='icon' />}
Expand All @@ -15,11 +15,6 @@ const Dialog = ({ children, className, title, type }) => (
</div>
)

Dialog.defaultProps = {
className: '',
type: 'info',
}

Dialog.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string,
Expand Down
8 changes: 1 addition & 7 deletions src/components/Divider/index.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import React from 'react'
import PropTypes from 'prop-types'

const Divider = ({ className, dark, light }) => (
const Divider = ({ className, dark = false, light = false }) => (
<hr
className={`ssb-divider${className ? ` ${className}` : ''}${dark ? ' type-dark' : ''}${light ? ' type-light' : ''}`}
aria-hidden='true'
/>
)

Divider.defaultProps = {
className: '',
dark: false,
light: false,
}

Divider.propTypes = {
className: PropTypes.string,
dark: PropTypes.bool,
Expand Down
21 changes: 6 additions & 15 deletions src/components/Dropdown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { useId } from '../../utils/useId'

const Dropdown = ({
className,
header,
header = '',
icon,
items,
onSelect,
open,
placeholder,
searchable,
items = [{ id: '', title: '' }],
onSelect = () => {},
open = false,
placeholder = '-- Select --',
searchable = false,
selectedItem,
tabIndex,
error,
Expand Down Expand Up @@ -292,15 +292,6 @@ const Dropdown = ({
)
}

Dropdown.defaultProps = {
header: '',
items: [{ id: '', title: '' }],
onSelect: () => {},
open: false,
searchable: false,
placeholder: '-- Select --',
}

Dropdown.propTypes = {
ariaLabel: PropTypes.string,
className: PropTypes.string,
Expand Down
7 changes: 1 addition & 6 deletions src/components/FactBox/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ import Accordion from '../Accordion'

console.warn('Warning: FactBox is deprecated and will be removed in a future release. Please use ExpansionBox instead.')

const FactBox = ({ className, header, openByDefault, text }) => (
const FactBox = ({ className, header, openByDefault = false, text }) => (
<div className={`ssb-fact-box${className ? ` ${className}` : ''}`}>
<Accordion header={header} openByDefault={openByDefault} withoutBorders>
{text}
</Accordion>
</div>
)

FactBox.defaultProps = {
className: '',
openByDefault: false,
}

FactBox.propTypes = {
className: PropTypes.string,
header: PropTypes.string.isRequired,
Expand Down
2 changes: 0 additions & 2 deletions src/components/Footer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const Footer = ({ children, className }) => (
<div className={`ssb-footer-wrapper${className ? ` ${className}` : ''}`}>{children}</div>
)

Footer.defaultProps = {}

Footer.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
Expand Down
Loading