@veritone-ce/design-system 1.3.0 → 1.4.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.
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createTheme } from '@mui/material';
3
+ import radioButtonTheme from '../components/RadioButton/RadioButton.theme';
3
4
  import buttonTheme from '../components/Button/button.theme';
4
5
  import sx from '@mui/system/sx';
5
6
  import CheckCircleIcon from '@mui/icons-material/CheckCircle';
@@ -83,6 +84,7 @@ let theme = createTheme({
83
84
  });
84
85
  theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
85
86
  MuiButton: buttonTheme(theme),
87
+ MuiRadio: radioButtonTheme(theme),
86
88
  MuiInputLabel: {
87
89
  styleOverrides: {
88
90
  root: sx({
@@ -8,10 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
11
12
  import { render } from '../../../utils/tests/helpers';
12
13
  import { fireEvent, screen, act, waitFor } from '@testing-library/react';
13
14
  import * as axios from 'axios';
14
- // import * as uploadFile from '../useUploadFile'
15
15
  import FileUploader from '..';
16
16
  jest.mock('axios');
17
17
  const mockedAxios = axios;
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
- /* eslint-disable @typescript-eslint/ban-ts-comment */
14
13
  import { useCallback, useEffect, useState } from 'react';
15
14
  import { Box } from '@mui/system';
16
15
  import { IconButton, Typography } from '@mui/material';
@@ -0,0 +1,10 @@
1
+ import { ComponentStory, Story, ComponentMeta } from '@storybook/react';
2
+ import RadioButton from '.';
3
+ declare const _default: ComponentMeta<({ label, ...props }: {
4
+ 'data-testid'?: string | undefined;
5
+ label?: string | undefined;
6
+ } & import("@mui/material").RadioProps) => JSX.Element>;
7
+ export default _default;
8
+ export declare const Default: ComponentStory<typeof RadioButton> | Story;
9
+ export declare const Checked: ComponentStory<typeof RadioButton> | Story;
10
+ export declare const Disabled: ComponentStory<typeof RadioButton> | Story;
@@ -0,0 +1,29 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import RadioButton from '.';
14
+ export default {
15
+ title: 'Components/RadioButton',
16
+ component: RadioButton
17
+ };
18
+ export const Default = (_a) => {
19
+ var args = __rest(_a, []);
20
+ return _jsx(RadioButton, Object.assign({ label: "Label" }, args));
21
+ };
22
+ export const Checked = (_a) => {
23
+ var args = __rest(_a, []);
24
+ return _jsx(RadioButton, Object.assign({ label: "Label", checked: true }, args));
25
+ };
26
+ export const Disabled = (_a) => {
27
+ var args = __rest(_a, []);
28
+ return _jsx(RadioButton, Object.assign({ label: "Label", disabled: true }, args));
29
+ };
@@ -0,0 +1,4 @@
1
+ import { Components } from '@mui/material';
2
+ import { Theme } from '../../assets/theme';
3
+ declare const radioButtonTheme: (theme: Theme) => Components['MuiRadio'];
4
+ export default radioButtonTheme;
@@ -0,0 +1,53 @@
1
+ const radioButtonTheme = (theme) => ({
2
+ defaultProps: {
3
+ disableFocusRipple: true,
4
+ disableTouchRipple: true,
5
+ disableRipple: true
6
+ },
7
+ styleOverrides: {
8
+ root: () => ({
9
+ display: 'flex',
10
+ width: 'fit-content',
11
+ height: 'fit-content',
12
+ padding: '8px',
13
+ '&:hover': {
14
+ backgroundColor: 'transparent'
15
+ },
16
+ '& .MuiSvgIcon-root': {
17
+ boxSizing: 'border-box',
18
+ borderRadius: '50%'
19
+ },
20
+ '&.Mui-checked': {
21
+ '& .MuiSvgIcon-root:nth-of-type(1)': {
22
+ border: `1px solid ${theme.palette.button.main}`
23
+ }
24
+ },
25
+ '& .MuiSvgIcon-root:nth-of-type(1)': {
26
+ boxSizing: 'border-box',
27
+ fontSize: 18,
28
+ color: 'transparent',
29
+ border: `1px solid ${theme.palette.text.secondary}`,
30
+ transition: 'border-color 0.2s'
31
+ },
32
+ '& .MuiSvgIcon-root:nth-of-type(2)': {
33
+ boxSizing: 'border-box',
34
+ width: 'auto',
35
+ height: 'auto',
36
+ color: 'transparent',
37
+ background: theme.palette.button.main,
38
+ margin: '3.37px 3.38px',
39
+ transition: 'background 0.2s'
40
+ },
41
+ '&.Mui-disabled': {
42
+ '& .MuiSvgIcon-root:nth-of-type(1)': {
43
+ border: `1px solid ${theme.palette.text.disabled}`
44
+ },
45
+ '& .MuiSvgIcon-root:nth-of-type(2)': {
46
+ transform: 'scale(1)',
47
+ background: theme.palette.text.disabled
48
+ }
49
+ }
50
+ })
51
+ }
52
+ });
53
+ export default radioButtonTheme;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '../../../utils/tests/helpers';
3
+ import { screen } from '@testing-library/react';
4
+ import RadioButton from '..';
5
+ describe('<RadioButton />', () => {
6
+ it('should render the RadioButton component', () => {
7
+ render(_jsx(RadioButton, {}));
8
+ expect(screen.getByTestId('radio-button')).toBeInTheDocument();
9
+ });
10
+ });
@@ -0,0 +1,7 @@
1
+ import { RadioProps } from '@mui/material';
2
+ declare type RadioButtonProps = {
3
+ 'data-testid'?: string;
4
+ label?: string;
5
+ } & RadioProps;
6
+ declare const RadioButton: ({ label, ...props }: RadioButtonProps) => JSX.Element;
7
+ export default RadioButton;
@@ -0,0 +1,30 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { FormControlLabel, Radio } from '@mui/material';
14
+ const RadioButton = (_a) => {
15
+ var { label } = _a, props = __rest(_a, ["label"]);
16
+ return (_jsx(FormControlLabel, { label: label, sx: {
17
+ margin: 0,
18
+ height: '36px',
19
+ color: (theme) => theme.palette.text.secondary,
20
+ '& .MuiTypography-root': {
21
+ lineHeight: '24px'
22
+ },
23
+ '&.Mui-disabled': {
24
+ '& .MuiTypography-root': {
25
+ color: (theme) => theme.palette.text.disabled
26
+ }
27
+ }
28
+ }, control: _jsx(Radio, Object.assign({ "data-testid": "radio-button" }, props)) }));
29
+ };
30
+ export default RadioButton;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import '@fontsource/nunito-sans';
2
- import '@fontsource/dosis';
3
1
  export { default as Button } from './components/Button';
4
2
  export { default as ThemeProvider } from './components/ThemeProvider';
5
3
  export { default as theme } from './assets/theme';
package/dist/index.js CHANGED
@@ -1,5 +1,3 @@
1
- import '@fontsource/nunito-sans';
2
- import '@fontsource/dosis';
3
1
  export { default as Button } from './components/Button';
4
2
  export { default as ThemeProvider } from './components/ThemeProvider';
5
3
  export { default as theme } from './assets/theme';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritone-ce/design-system",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "start": "yarn storybook",