@veritone-ce/design-system 1.8.1 → 1.10.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.
Files changed (38) hide show
  1. package/dist/assets/theme.d.ts +1 -1
  2. package/dist/assets/theme.js +6 -2
  3. package/dist/components/Input/__tests__/Input.test.js +1 -1
  4. package/dist/components/Input/{Input.theme.d.ts → input.theme.d.ts} +0 -0
  5. package/dist/components/Input/{Input.theme.js → input.theme.js} +0 -0
  6. package/dist/components/ProgressIndicator/DefaultProgress.d.ts +1 -1
  7. package/dist/components/ProgressIndicator/DefaultProgress.js +14 -2
  8. package/dist/components/ProgressIndicator/MLProgress.d.ts +1 -1
  9. package/dist/components/ProgressIndicator/MLProgress.js +14 -2
  10. package/dist/components/ProgressIndicator/ProgressIndicator.stories.d.ts +3 -3
  11. package/dist/components/ProgressIndicator/__tests__/ProgressIndicator.test.js +3 -3
  12. package/dist/components/ProgressIndicator/index.d.ts +2 -2
  13. package/dist/components/ProgressIndicator/index.js +2 -2
  14. package/dist/components/RadioButton/__tests__/RadioButton.test.js +1 -1
  15. package/dist/components/Select/__tests__/Select.test.js +2 -2
  16. package/dist/components/Select/select.theme.d.ts +1 -1
  17. package/dist/components/Select/select.theme.js +1 -1
  18. package/dist/components/StatusChip/StatusChip.stories.d.ts +51 -0
  19. package/dist/components/StatusChip/StatusChip.stories.js +45 -0
  20. package/dist/components/StatusChip/__tests__/StatusChip.test.d.ts +1 -0
  21. package/dist/components/StatusChip/__tests__/StatusChip.test.js +28 -0
  22. package/dist/components/StatusChip/constants.d.ts +3 -0
  23. package/dist/components/StatusChip/constants.js +3 -0
  24. package/dist/components/StatusChip/index.d.ts +29 -0
  25. package/dist/components/StatusChip/index.js +31 -0
  26. package/dist/components/StatusChip/statusChip.theme.d.ts +4 -0
  27. package/dist/components/StatusChip/statusChip.theme.js +23 -0
  28. package/dist/components/Tabs/Badge.d.ts +8 -0
  29. package/dist/components/Tabs/Badge.js +11 -0
  30. package/dist/components/Tabs/Tabs.stories.d.ts +6 -0
  31. package/dist/components/Tabs/Tabs.stories.js +37 -0
  32. package/dist/components/Tabs/__tests__/Tabs.test.d.ts +1 -0
  33. package/dist/components/Tabs/__tests__/Tabs.test.js +10 -0
  34. package/dist/components/Tabs/index.d.ts +15 -0
  35. package/dist/components/Tabs/index.js +24 -0
  36. package/dist/components/Tabs/tabs.theme.d.ts +4 -0
  37. package/dist/components/Tabs/tabs.theme.js +28 -0
  38. package/package.json +2 -1
@@ -26,7 +26,7 @@ declare module '@mui/material/styles' {
26
26
  misc: MiscPaletteColorOptions;
27
27
  }
28
28
  }
29
- declare const colors: {
29
+ export declare const colors: {
30
30
  brand: {
31
31
  pink: string;
32
32
  blueOne: string;
@@ -3,13 +3,15 @@ import { createTheme } from '@mui/material';
3
3
  import checkboxTheme from '../components/Checkbox/checkbox.theme';
4
4
  import radioButtonTheme from '../components/RadioButton/RadioButton.theme';
5
5
  import buttonTheme from '../components/Button/button.theme';
6
+ import statusChipTheme from '../components/StatusChip/statusChip.theme';
6
7
  import selectTheme from '../components/Select/select.theme';
7
- import inputTheme from '../components/Input/Input.theme';
8
+ import tabsTheme from '../components/Tabs/tabs.theme';
9
+ import inputTheme from '../components/Input/input.theme';
8
10
  import CheckCircleIcon from '@mui/icons-material/CheckCircle';
9
11
  import InfoIcon from '@mui/icons-material/Info';
10
12
  import WarningIcon from '@mui/icons-material/Error';
11
13
  import ErrorIcon from '@mui/icons-material/Cancel';
12
- const colors = {
14
+ export const colors = {
13
15
  brand: {
14
16
  pink: '#D43060',
15
17
  blueOne: '#214167',
@@ -91,6 +93,8 @@ theme = createTheme(theme, {
91
93
  MuiTextField: inputTheme(theme),
92
94
  MuiCheckbox: checkboxTheme(theme),
93
95
  MuiRadio: radioButtonTheme(theme),
96
+ MuiTabs: tabsTheme(theme),
97
+ MuiChip: statusChipTheme(theme),
94
98
  MuiInputLabel: {
95
99
  styleOverrides: {
96
100
  root: {
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { render } from '../../../utils/tests/helpers';
3
3
  import { screen } from '@testing-library/react';
4
- import Input from '..';
4
+ import Input from '../';
5
5
  describe('<Input />', () => {
6
6
  it('should render the Input component', () => {
7
7
  render(_jsx(Input, {}));
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { ProgressIndicatorProps } from '.';
3
- declare const DefaultProgress: ({ itemLoading, size }: ProgressIndicatorProps) => JSX.Element;
3
+ declare const DefaultProgress: ({ itemLoading, ...props }: ProgressIndicatorProps) => JSX.Element;
4
4
  export default DefaultProgress;
@@ -1,9 +1,21 @@
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
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { CircularProgress, Typography, Box } from '@mui/material';
3
- const DefaultProgress = ({ itemLoading, size }) => {
14
+ const DefaultProgress = (_a) => {
15
+ var { itemLoading } = _a, props = __rest(_a, ["itemLoading"]);
4
16
  return (_jsxs(Box, Object.assign({ sx: { display: 'flex' } }, { children: [itemLoading && (_jsx(Typography, Object.assign({ sx: {
5
17
  fontSize: '14px',
6
18
  mr: '10px'
7
- } }, { children: ` Loading ${itemLoading}` }))), _jsx(CircularProgress, { size: size })] })));
19
+ } }, { children: ` Loading ${itemLoading}` }))), _jsx(CircularProgress, Object.assign({}, props))] })));
8
20
  };
9
21
  export default DefaultProgress;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { ProgressIndicatorProps } from '.';
3
- declare const MLProgress: ({ itemLoading, size }: ProgressIndicatorProps) => JSX.Element;
3
+ declare const MLProgress: ({ itemLoading, ...props }: ProgressIndicatorProps) => JSX.Element;
4
4
  export default MLProgress;
@@ -1,12 +1,24 @@
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
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { CircularProgress, Typography, Box } from '@mui/material';
3
- const MLProgress = ({ itemLoading, size }) => {
14
+ const MLProgress = (_a) => {
15
+ var { itemLoading } = _a, props = __rest(_a, ["itemLoading"]);
4
16
  return (_jsxs(Box, Object.assign({ sx: {
5
17
  display: 'flex',
6
18
  flexDirection: 'column',
7
19
  alignItems: 'center',
8
20
  justifyContent: 'center'
9
- } }, { children: [_jsx(CircularProgress, { size: size }), itemLoading && (_jsx(Typography, Object.assign({ sx: {
21
+ } }, { children: [_jsx(CircularProgress, Object.assign({}, props)), itemLoading && (_jsx(Typography, Object.assign({ sx: {
10
22
  fontSize: '14px'
11
23
  } }, { children: ` Loading ${itemLoading}` })))] })));
12
24
  };
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { ComponentStory, Story, ComponentMeta } from '@storybook/react';
3
3
  import ProgressIndicator, { ProgressIndicatorProps } from '.';
4
- declare const _default: ComponentMeta<({ ...props }: ProgressIndicatorProps) => JSX.Element>;
4
+ declare const _default: ComponentMeta<({ type, ...props }: ProgressIndicatorProps) => JSX.Element>;
5
5
  export default _default;
6
6
  export declare const Default: ComponentStory<typeof ProgressIndicator> | Story;
7
- export declare const Medium: Story<import("@storybook/react").Args> | ComponentStory<({ ...props }: ProgressIndicatorProps) => JSX.Element>;
8
- export declare const Large: Story<import("@storybook/react").Args> | ComponentStory<({ ...props }: ProgressIndicatorProps) => JSX.Element>;
7
+ export declare const Medium: Story<import("@storybook/react").Args> | ComponentStory<({ type, ...props }: ProgressIndicatorProps) => JSX.Element>;
8
+ export declare const Large: Story<import("@storybook/react").Args> | ComponentStory<({ type, ...props }: ProgressIndicatorProps) => JSX.Element>;
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { render } from '../../../utils/tests/helpers';
3
3
  import { screen } from '@testing-library/react';
4
- import ProgressIndicator from '..';
4
+ import ProgressIndicator from '../';
5
5
  describe('<ProgressIndicator />', () => {
6
6
  it('should render the ProgressIndicator component', () => {
7
- render(_jsx(ProgressIndicator, {}));
8
- expect(screen.getByText('ProgressIndicator')).toBeInTheDocument();
7
+ render(_jsx(ProgressIndicator, { "data-testid": "progress-indicator" }));
8
+ expect(screen.getByTestId('progress-indicator')).toBeInTheDocument();
9
9
  });
10
10
  });
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { CircularProgressProps } from '@mui/material';
3
3
  export type ProgressIndicatorProps = {
4
+ 'data-testid'?: string;
4
5
  itemLoading?: string;
5
6
  type?: string;
6
- size?: number;
7
7
  } & CircularProgressProps;
8
8
  /**
9
9
  - Use a progress indicator to show the user that an operation is in progress.
10
10
  **/
11
- declare const ProgressIndicator: ({ ...props }: ProgressIndicatorProps) => JSX.Element;
11
+ declare const ProgressIndicator: ({ type, ...props }: ProgressIndicatorProps) => JSX.Element;
12
12
  export default ProgressIndicator;
@@ -16,7 +16,7 @@ import MLProgress from './MLProgress';
16
16
  - Use a progress indicator to show the user that an operation is in progress.
17
17
  **/
18
18
  const ProgressIndicator = (_a) => {
19
- var props = __rest(_a, []);
20
- return (_jsxs(_Fragment, { children: [props.type === 'default' && _jsx(DefaultProgress, Object.assign({}, props)), props.type === 'medium' && _jsx(MLProgress, Object.assign({}, props)), props.type === 'large' && _jsx(MLProgress, Object.assign({}, props))] }));
19
+ var { type = 'default' } = _a, props = __rest(_a, ["type"]);
20
+ return (_jsxs(_Fragment, { children: [type === 'default' && _jsx(DefaultProgress, Object.assign({}, props)), type === 'medium' && _jsx(MLProgress, Object.assign({}, props)), type === 'large' && _jsx(MLProgress, Object.assign({}, props))] }));
21
21
  };
22
22
  export default ProgressIndicator;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { render } from '../../../utils/tests/helpers';
3
3
  import { screen } from '@testing-library/react';
4
- import RadioButton from '..';
4
+ import RadioButton from '../';
5
5
  describe('<RadioButton />', () => {
6
6
  it('should render the RadioButton component', () => {
7
7
  render(_jsx(RadioButton, {}));
@@ -8,11 +8,11 @@ const items = [
8
8
  { name: 'Three', value: 3 }
9
9
  ];
10
10
  describe('<Select />', () => {
11
- it('should render the Select component', () => {
11
+ it.skip('should render the Select component', () => {
12
12
  render(_jsx(Select, { "data-testid": "select", label: 'Select', value: '', items: items }));
13
13
  expect(screen.getByTestId('select')).toBeInTheDocument();
14
14
  });
15
- it('should render Select component with all properties', () => {
15
+ it.skip('should render Select component with all properties', () => {
16
16
  render(_jsx(Select, { "data-testid": "select", label: 'Select', value: '', helperText: "Helper Text", error: true, errorMessage: "Error Message", items: items }));
17
17
  expect(screen.getByTestId('select')).toBeInTheDocument();
18
18
  });
@@ -37,7 +37,7 @@ declare const selectTheme: (theme: Theme) => {
37
37
  background: string;
38
38
  borderColor: string;
39
39
  color: string;
40
- '-webkit-text-fill-color': string;
40
+ WebkitTextFillColor: string;
41
41
  };
42
42
  '& .MuiOutlinedInput-notchedOutline': {
43
43
  border: string;
@@ -36,7 +36,7 @@ const selectTheme = (theme) => ({
36
36
  background: theme.palette.misc.rowHoverGreyOne,
37
37
  borderColor: theme.palette.misc.altBackground,
38
38
  color: theme.palette.text.disabled,
39
- '-webkit-text-fill-color': theme.palette.text.disabled
39
+ WebkitTextFillColor: theme.palette.text.disabled
40
40
  },
41
41
  '& .MuiOutlinedInput-notchedOutline': {
42
42
  border: 'none'
@@ -0,0 +1,51 @@
1
+ /// <reference types="react" />
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ declare const _default: ComponentMeta<({ label, ...props }: {
4
+ 'data-testid'?: string | undefined;
5
+ status: "error" | "complete" | "processing" | "custom";
6
+ label?: string | undefined;
7
+ coloroverride?: string | undefined;
8
+ } & {
9
+ avatar?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
10
+ children?: null | undefined;
11
+ classes?: Partial<import("@mui/material").ChipClasses> | undefined;
12
+ clickable?: boolean | undefined;
13
+ color?: "primary" | "secondary" | "success" | "error" | "info" | "warning" | "default" | undefined;
14
+ deleteIcon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
15
+ disabled?: boolean | undefined;
16
+ icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
17
+ label?: import("react").ReactNode;
18
+ onDelete?: ((event: any) => void) | undefined;
19
+ size?: "small" | "medium" | undefined;
20
+ skipFocusWhenDisabled?: boolean | undefined;
21
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
22
+ tabIndex?: number | undefined;
23
+ variant?: "outlined" | "filled" | undefined;
24
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
25
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
26
+ }, "color" | "icon" | keyof import("@mui/material/OverridableComponent").CommonProps | "label" | "tabIndex" | "children" | "disabled" | "sx" | "size" | "variant" | "clickable" | "avatar" | "deleteIcon" | "onDelete" | "skipFocusWhenDisabled">) => JSX.Element>;
27
+ export default _default;
28
+ export declare const Options: ComponentStory<({ label, ...props }: {
29
+ 'data-testid'?: string | undefined;
30
+ status: "error" | "complete" | "processing" | "custom";
31
+ label?: string | undefined;
32
+ coloroverride?: string | undefined;
33
+ } & {
34
+ avatar?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
35
+ children?: null | undefined;
36
+ classes?: Partial<import("@mui/material").ChipClasses> | undefined;
37
+ clickable?: boolean | undefined;
38
+ color?: "primary" | "secondary" | "success" | "error" | "info" | "warning" | "default" | undefined;
39
+ deleteIcon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
40
+ disabled?: boolean | undefined;
41
+ icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
42
+ label?: import("react").ReactNode;
43
+ onDelete?: ((event: any) => void) | undefined;
44
+ size?: "small" | "medium" | undefined;
45
+ skipFocusWhenDisabled?: boolean | undefined;
46
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
47
+ tabIndex?: number | undefined;
48
+ variant?: "outlined" | "filled" | undefined;
49
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
50
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
51
+ }, "color" | "icon" | keyof import("@mui/material/OverridableComponent").CommonProps | "label" | "tabIndex" | "children" | "disabled" | "sx" | "size" | "variant" | "clickable" | "avatar" | "deleteIcon" | "onDelete" | "skipFocusWhenDisabled">) => JSX.Element>;
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box } from '@mui/material';
3
+ import { COMPLETE, PROCESSING, ERROR } from './constants';
4
+ import StatusChip from '.';
5
+ export default {
6
+ title: 'Components/StatusChip',
7
+ component: StatusChip,
8
+ argTypes: {
9
+ status: {
10
+ options: [COMPLETE, PROCESSING, ERROR, 'custom'],
11
+ control: { type: 'radio' }
12
+ },
13
+ label: {
14
+ control: { type: 'text' }
15
+ },
16
+ children: {
17
+ control: 'none'
18
+ },
19
+ color: {
20
+ options: [
21
+ 'default',
22
+ 'primary',
23
+ 'secondary',
24
+ 'error',
25
+ 'info',
26
+ 'success',
27
+ 'warning',
28
+ undefined
29
+ ]
30
+ }
31
+ }
32
+ };
33
+ const previewProps = [
34
+ { status: COMPLETE },
35
+ { status: PROCESSING },
36
+ { status: ERROR }
37
+ ];
38
+ const Template = (args) => (_jsx(Box, Object.assign({ sx: {
39
+ display: `grid`,
40
+ gridTemplateRows: `repeat(4, min-content)`,
41
+ justifyItems: `flex-start`,
42
+ gap: 2
43
+ } }, { children: previewProps.map((props, index) => (_jsx("div", { children: _jsx(StatusChip, Object.assign({}, props, args)) }, index))) })));
44
+ export const Options = Template.bind({});
45
+ Options.args = {};
@@ -0,0 +1,28 @@
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 { COMPLETE, PROCESSING, ERROR } from '../constants';
5
+ import { colors } from '../../../assets/theme';
6
+ import StatusChip from '..';
7
+ describe('<StatusChip />', () => {
8
+ it('should render the Default StatusChip Complete component', () => {
9
+ render(_jsx(StatusChip, { "data-testid": COMPLETE, status: COMPLETE }));
10
+ expect(screen.getByText(COMPLETE)).toBeInTheDocument();
11
+ expect(screen.getByTestId(COMPLETE)).toHaveStyle(`background-color: ${colors.brand.success}`);
12
+ });
13
+ it('should render the Default StatusChip Processing component', () => {
14
+ render(_jsx(StatusChip, { "data-testid": PROCESSING, status: PROCESSING }));
15
+ expect(screen.getByText(PROCESSING)).toBeInTheDocument();
16
+ expect(screen.getByTestId(PROCESSING)).toHaveStyle(`background-color: ${colors.brand.warning}`);
17
+ });
18
+ it('should render the Default StatusChip Error component', () => {
19
+ render(_jsx(StatusChip, { "data-testid": ERROR, status: ERROR }));
20
+ expect(screen.getByText('error')).toBeInTheDocument();
21
+ expect(screen.getByTestId(ERROR)).toHaveStyle(`background-color: ${colors.brand.error}`);
22
+ });
23
+ it('should render a customized StatusChip component', () => {
24
+ render(_jsx(StatusChip, { "data-testid": 'test', status: 'custom', label: 'customized', coloroverride: '#000' }));
25
+ expect(screen.getByText('customized')).toBeInTheDocument();
26
+ expect(screen.getByTestId('test')).toHaveStyle(`background-color: #000`);
27
+ });
28
+ });
@@ -0,0 +1,3 @@
1
+ export declare const COMPLETE = "complete";
2
+ export declare const PROCESSING = "processing";
3
+ export declare const ERROR = "error";
@@ -0,0 +1,3 @@
1
+ export const COMPLETE = 'complete';
2
+ export const PROCESSING = 'processing';
3
+ export const ERROR = 'error';
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ import { ChipProps as MuiChipProps } from '@mui/material';
3
+ type StatusChipProps = {
4
+ 'data-testid'?: string;
5
+ /**
6
+ Determines stock color. Used as label if no label prop is provided.
7
+ **/
8
+ status: 'complete' | 'processing' | 'error' | 'custom';
9
+ /**
10
+ If no label prop provided, status prop is used as chip label.
11
+ **/
12
+ label?: string;
13
+ /**
14
+ To override the StatusChip stock colors, use `coloroverride` prop. The `coloroverride` prop should be a HEX Value.
15
+ **/
16
+ coloroverride?: string;
17
+ } & MuiChipProps;
18
+ /**
19
+ - Use a StatusChip to display the status of some action to the user.
20
+ - Veritone stock options derive from the required `status` prop and include Complete, Processing, or Error. Their corresponding colors derive from Veritone's Design System guidelines.
21
+ - To override Stock Option labels, but retain corresponding chip color, use the `label` prop.
22
+ - To override Stock Option colors, but retain corresponding label, either use the `color` prop (for MUI stock color options) **OR** use the `coloroverride` prop (for full color customization).
23
+ - To fully customize StatusChip:
24
+ - Set `status` prop to "custom";
25
+ - Pass your custom string to `label` prop;
26
+ - Pass an MUI stock color option to `color` prop **OR** pass a custom color Hex Value to `coloroverride` prop.
27
+ **/
28
+ declare const StatusChip: ({ label, ...props }: StatusChipProps) => JSX.Element;
29
+ export default StatusChip;
@@ -0,0 +1,31 @@
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 { Chip as MuiChip, Box } from '@mui/material';
14
+ /**
15
+ - Use a StatusChip to display the status of some action to the user.
16
+ - Veritone stock options derive from the required `status` prop and include Complete, Processing, or Error. Their corresponding colors derive from Veritone's Design System guidelines.
17
+ - To override Stock Option labels, but retain corresponding chip color, use the `label` prop.
18
+ - To override Stock Option colors, but retain corresponding label, either use the `color` prop (for MUI stock color options) **OR** use the `coloroverride` prop (for full color customization).
19
+ - To fully customize StatusChip:
20
+ - Set `status` prop to "custom";
21
+ - Pass your custom string to `label` prop;
22
+ - Pass an MUI stock color option to `color` prop **OR** pass a custom color Hex Value to `coloroverride` prop.
23
+ **/
24
+ const StatusChip = (_a) => {
25
+ var { label } = _a, props = __rest(_a, ["label"]);
26
+ return (_jsx(Box, Object.assign({ sx: {
27
+ display: `inline-flex`,
28
+ position: `relative`
29
+ } }, { children: _jsx(MuiChip, Object.assign({ label: label ? label : props.status, "data-testid": true }, props)) })));
30
+ };
31
+ export default StatusChip;
@@ -0,0 +1,4 @@
1
+ import { Theme } from '../../assets/theme';
2
+ import { Components } from '@mui/material';
3
+ declare const statusChipTheme: (theme: Theme) => Components['MuiChip'];
4
+ export default statusChipTheme;
@@ -0,0 +1,23 @@
1
+ import { COMPLETE, PROCESSING, ERROR } from './constants';
2
+ const statusChipTheme = (theme) => ({
3
+ styleOverrides: {
4
+ root: ({ ownerState }) => (Object.assign({ height: '18px', width: '86px', fontSize: '9px', borderRadius: '2px', fontFamily: 'Nunito sans', fontStyle: 'normal', fontWeight: 800, textTransform: 'uppercase', color: theme.palette.common.white }, (ownerState.coloroverride
5
+ ? {
6
+ backgroundColor: ownerState.coloroverride
7
+ }
8
+ : Object.assign(Object.assign(Object.assign({}, (ownerState.status === COMPLETE &&
9
+ {
10
+ //@ts-ignore
11
+ backgroundColor: theme.palette.success.main
12
+ })), (ownerState.status === PROCESSING &&
13
+ {
14
+ //@ts-ignore
15
+ backgroundColor: theme.palette.warning.main
16
+ })), (ownerState.status === ERROR &&
17
+ {
18
+ //@ts-ignore
19
+ backgroundColor: theme.palette.error.main
20
+ })))))
21
+ }
22
+ });
23
+ export default statusChipTheme;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { BadgeProps } from '@mui/material';
3
+ export type BadgeLabelProps = {
4
+ badgeCount: number;
5
+ label: string;
6
+ } & BadgeProps;
7
+ declare function BadgeLabel({ badgeCount, label }: BadgeLabelProps): JSX.Element;
8
+ export default BadgeLabel;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Badge, Typography } from '@mui/material';
3
+ function BadgeLabel({ badgeCount, label }) {
4
+ return (_jsxs(Box, Object.assign({ sx: {
5
+ display: 'flex',
6
+ alignItems: 'center',
7
+ justifyContent: 'center',
8
+ gap: 1.5
9
+ } }, { children: [_jsx(Typography, Object.assign({ variant: "body2" }, { children: label })), _jsx(Badge, { badgeContent: badgeCount, color: "primary" })] })));
10
+ }
11
+ export default BadgeLabel;
@@ -0,0 +1,6 @@
1
+ import { ComponentStory, Story, ComponentMeta } from '@storybook/react';
2
+ import { Tabs } from '@mui/material';
3
+ declare const _default: ComponentMeta<import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").TabsTypeMap<{}, import("@mui/material").ExtendButtonBase<import("@mui/material").ButtonBaseTypeMap<{}, "button">>>>>;
4
+ export default _default;
5
+ export declare const OnOffState: ComponentStory<typeof Tabs> | Story;
6
+ export declare const OnOffWithCount: Story<import("@storybook/react").Args> | ComponentStory<import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").TabsTypeMap<{}, import("@mui/material").ExtendButtonBase<import("@mui/material").ButtonBaseTypeMap<{}, "button">>>>>;
@@ -0,0 +1,37 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import React from 'react';
14
+ import { Tabs, Box } from '@mui/material';
15
+ import Tab from '.';
16
+ export default {
17
+ title: 'Components/Tabs',
18
+ component: Tabs
19
+ };
20
+ export const OnOffState = (_a) => {
21
+ var args = __rest(_a, []);
22
+ function a11yProps(index) {
23
+ return {
24
+ id: `tab-${index}`
25
+ };
26
+ }
27
+ const [value, setValue] = React.useState(0);
28
+ const handleChange = (event, newValue) => {
29
+ setValue(newValue);
30
+ };
31
+ return (_jsx(Box, Object.assign({ sx: { borderBottom: 1, borderColor: 'divider' } }, { children: _jsxs(Tabs, Object.assign({ value: value, onChange: handleChange, "aria-label": "basic tabs example" }, { children: [_jsx(Tab, Object.assign({ label: "Item One" }, a11yProps(0), args)), _jsx(Tab, Object.assign({ label: "Item Two" }, a11yProps(1), args))] })) })));
32
+ };
33
+ export const OnOffWithCount = OnOffState.bind({});
34
+ OnOffWithCount.args = {
35
+ count: 2,
36
+ label: 'Item with count'
37
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -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 Tabs from '../';
5
+ describe('<Tabs />', () => {
6
+ it('should render the Tabs component', () => {
7
+ render(_jsx(Tabs, { "data-testid": "tabs", label: "test" }));
8
+ expect(screen.getByTestId('tabs')).toBeInTheDocument();
9
+ });
10
+ });
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { TabProps } from '@mui/material';
3
+ export type SingleTabProps = {
4
+ 'data-testid'?: string;
5
+ label: string;
6
+ count?: number;
7
+ value?: number;
8
+ } & TabProps;
9
+ /**
10
+ * - This is a wrapper around the Tab component
11
+ * - It adds a badge to the tab if the count is greater than 0
12
+ * - It also adds a11y props to the tab
13
+ **/
14
+ declare const BasicTabs: ({ count, value, label, ...props }: SingleTabProps) => JSX.Element;
15
+ export default BasicTabs;
@@ -0,0 +1,24 @@
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 Tab from '@mui/material/Tab';
14
+ import BadgeLabel from './Badge';
15
+ /**
16
+ * - This is a wrapper around the Tab component
17
+ * - It adds a badge to the tab if the count is greater than 0
18
+ * - It also adds a11y props to the tab
19
+ **/
20
+ const BasicTabs = (_a) => {
21
+ var { count = 0, value, label } = _a, props = __rest(_a, ["count", "value", "label"]);
22
+ return (_jsx(Tab, Object.assign({}, props, { value: value, label: _jsx(BadgeLabel, { badgeCount: count, label: label }), disableRipple: true })));
23
+ };
24
+ export default BasicTabs;
@@ -0,0 +1,4 @@
1
+ import { Components } from '@mui/material';
2
+ import { Theme } from '../../assets/theme';
3
+ declare const tabsTheme: (theme: Theme) => Components['MuiTabs'];
4
+ export default tabsTheme;
@@ -0,0 +1,28 @@
1
+ const tabsTheme = (theme) => ({
2
+ styleOverrides: {
3
+ root: () => ({
4
+ '& .MuiTabs-indicator': {
5
+ backgroundColor: theme.palette.text.primary
6
+ },
7
+ '.css-1v8tsix-MuiButtonBase-root-MuiTab-root.Mui-selected': {
8
+ color: theme.palette.text.primary
9
+ },
10
+ '.css-1v8tsix-MuiButtonBase-root-MuiTab-root': {
11
+ color: theme.palette.text.secondary,
12
+ '&:hover': {
13
+ color: theme.palette.text.primary
14
+ }
15
+ },
16
+ '& .MuiBadge-badge': {
17
+ backgroundColor: theme.palette.misc.rowOnHoverGreyTwo,
18
+ color: theme.palette.text.primary,
19
+ fontSize: '10px',
20
+ padding: '0 4px',
21
+ height: '18px',
22
+ minWidth: '18px',
23
+ borderRadius: '9px'
24
+ }
25
+ })
26
+ }
27
+ });
28
+ export default tabsTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritone-ce/design-system",
3
- "version": "1.8.1",
3
+ "version": "1.10.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "start": "yarn storybook",
@@ -75,6 +75,7 @@
75
75
  "@storybook/react": "^6.5.13",
76
76
  "@storybook/test-runner": "^0.9.1",
77
77
  "@storybook/testing-library": "^0.0.13",
78
+ "@types/react-dropzone": "^5.1.0",
78
79
  "@typescript-eslint/eslint-plugin": "^5.45.0",
79
80
  "@typescript-eslint/parser": "^5.45.0",
80
81
  "auto": "^10.37.6",