@veritone-ce/design-system 1.4.0 → 1.5.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 checkboxTheme from '../components/Checkbox/checkbox.theme';
3
4
  import radioButtonTheme from '../components/RadioButton/RadioButton.theme';
4
5
  import buttonTheme from '../components/Button/button.theme';
5
6
  import sx from '@mui/system/sx';
@@ -84,6 +85,7 @@ let theme = createTheme({
84
85
  });
85
86
  theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
86
87
  MuiButton: buttonTheme(theme),
88
+ MuiCheckbox: checkboxTheme(theme),
87
89
  MuiRadio: radioButtonTheme(theme),
88
90
  MuiInputLabel: {
89
91
  styleOverrides: {
@@ -95,6 +97,18 @@ theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
95
97
  })
96
98
  }
97
99
  },
100
+ MuiFormControlLabel: {
101
+ styleOverrides: {
102
+ root: sx({
103
+ '& .MuiFormControlLabel-label': {
104
+ color: theme.palette.text.secondary
105
+ },
106
+ '& .MuiFormControlLabel-label.Mui-disabled': {
107
+ color: theme.palette.text.disabled
108
+ }
109
+ })
110
+ }
111
+ },
98
112
  MuiFormHelperText: {
99
113
  styleOverrides: {
100
114
  root: sx({
@@ -0,0 +1,5 @@
1
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
2
+ declare const _default: ComponentMeta<({ label, ...props }: import(".").CheckboxProps) => JSX.Element>;
3
+ export default _default;
4
+ export declare const Default: ComponentStory<({ label, ...props }: import(".").CheckboxProps) => JSX.Element>;
5
+ export declare const WithoutLabel: ComponentStory<({ label, ...props }: import(".").CheckboxProps) => JSX.Element>;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box } from '@mui/material';
3
+ import React from 'react';
4
+ import Checkbox from '.';
5
+ export default {
6
+ title: 'Components/Checkbox',
7
+ component: Checkbox
8
+ };
9
+ const Template = (args) => (_jsx(Box, Object.assign({ sx: {
10
+ display: `grid`,
11
+ gridTemplateRows: `repeat(5, min-content)`,
12
+ gap: 2
13
+ } }, { children: _jsxs(React.Fragment, { children: [_jsx(Checkbox, Object.assign({}, args)), _jsx(Checkbox, Object.assign({}, args, { checked: true })), _jsx(Checkbox, Object.assign({}, args, { indeterminate: true })), _jsx(Checkbox, Object.assign({}, args, { disabled: true })), _jsx(Checkbox, Object.assign({}, args, { disabled: true, checked: true }))] }) })));
14
+ export const Default = Template.bind({});
15
+ Default.args = {
16
+ label: 'Label'
17
+ };
18
+ export const WithoutLabel = Template.bind({});
19
+ WithoutLabel.args = {};
@@ -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 Checkbox from '..';
5
+ describe('<Checkbox />', () => {
6
+ it('should render the Checkbox component', () => {
7
+ render(_jsx(Checkbox, { "data-testid": "checkbox" }));
8
+ expect(screen.getByTestId('checkbox')).toBeInTheDocument();
9
+ });
10
+ });
@@ -0,0 +1,18 @@
1
+ import { Theme } from '../../assets/theme';
2
+ declare const checkboxTheme: (theme: Theme) => {
3
+ styleOverrides: {
4
+ root: () => {
5
+ marginRight: string;
6
+ '&.MuiCheckbox-root': {
7
+ color: string;
8
+ };
9
+ '&.Mui-checked, &.MuiCheckbox-indeterminate': {
10
+ color: string;
11
+ };
12
+ '&.Mui-disabled': {
13
+ color: string;
14
+ };
15
+ };
16
+ };
17
+ };
18
+ export default checkboxTheme;
@@ -0,0 +1,17 @@
1
+ const checkboxTheme = (theme) => ({
2
+ styleOverrides: {
3
+ root: () => ({
4
+ marginRight: '8px',
5
+ '&.MuiCheckbox-root': {
6
+ color: theme.palette.text.secondary
7
+ },
8
+ '&.Mui-checked, &.MuiCheckbox-indeterminate': {
9
+ color: theme.palette.button.main
10
+ },
11
+ '&.Mui-disabled': {
12
+ color: theme.palette.text.disabled
13
+ }
14
+ })
15
+ }
16
+ });
17
+ export default checkboxTheme;
@@ -0,0 +1,7 @@
1
+ import { CheckboxProps as MuiCheckboxProps } from '@mui/material';
2
+ export declare type CheckboxProps = {
3
+ 'data-testid'?: string;
4
+ label?: string | undefined;
5
+ } & MuiCheckboxProps;
6
+ declare const Checkbox: ({ label, ...props }: CheckboxProps) => JSX.Element;
7
+ export default Checkbox;
@@ -0,0 +1,18 @@
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, Checkbox as MuiCheckbox } from '@mui/material';
14
+ const Checkbox = (_a) => {
15
+ var { label } = _a, props = __rest(_a, ["label"]);
16
+ return _jsx(FormControlLabel, { label: label, control: _jsx(MuiCheckbox, Object.assign({}, props)) });
17
+ };
18
+ export default Checkbox;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritone-ce/design-system",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "start": "yarn storybook",