@toptal/picasso-checkbox 2.0.7-alpha-fx-5525-container-4ebd3caa7.47 → 3.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/dist-package/src/CheckboxGroup/CheckboxGroup.d.ts +2 -3
- package/dist-package/src/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
- package/dist-package/src/CheckboxGroup/CheckboxGroup.js +5 -13
- package/dist-package/src/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/package.json +14 -14
- package/src/Checkbox/__snapshots__/test.tsx.snap +7 -7
- package/src/CheckboxGroup/CheckboxGroup.tsx +13 -20
- package/LICENSE +0 -20
- package/dist-package/src/CheckboxGroup/styles.d.ts +0 -3
- package/dist-package/src/CheckboxGroup/styles.d.ts.map +0 -1
- package/dist-package/src/CheckboxGroup/styles.js +0 -11
- package/dist-package/src/CheckboxGroup/styles.js.map +0 -1
- package/src/CheckboxGroup/styles.ts +0 -13
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import type { FormGroupProps } from '@material-ui/core';
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
3
2
|
import type { GridSizeProps, GridProps } from '@toptal/picasso-grid';
|
|
4
3
|
declare type GridSpacing = GridProps['spacing'];
|
|
5
|
-
export interface Props extends
|
|
4
|
+
export interface Props extends HTMLAttributes<HTMLDivElement>, GridSizeProps {
|
|
6
5
|
/** Align checkboxes horizontally */
|
|
7
6
|
horizontal?: boolean;
|
|
8
7
|
/** Defines amount of space between checkbox components (in px) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../../../src/CheckboxGroup/CheckboxGroup.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../../../src/CheckboxGroup/CheckboxGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAIpE,aAAK,WAAW,GAAG,SAAS,CAAC,SAAS,CAAC,CAAA;AAEvC,MAAM,WAAW,KAAM,SAAQ,cAAc,CAAC,cAAc,CAAC,EAAE,aAAa;IAC1E,qCAAqC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,kEAAkE;IAClE,OAAO,CAAC,EAAE,WAAW,CAAA;CACtB;AAID,QAAA,MAAM,aAAa;YAAW,KAAK;;;;CAsClC,CAAA;AAMD,eAAe,aAAa,CAAA"}
|
|
@@ -9,25 +9,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
/* eslint-disable react/no-array-index-key */
|
|
13
12
|
import React from 'react';
|
|
14
|
-
import { FormGroup } from '@material-ui/core';
|
|
15
|
-
import { makeStyles, useTheme } from '@material-ui/core/styles';
|
|
16
|
-
import cx from 'classnames';
|
|
17
13
|
import { GridCompound as Grid } from '@toptal/picasso-grid';
|
|
18
|
-
import
|
|
19
|
-
const
|
|
20
|
-
name: 'PicassoCheckboxGroup',
|
|
21
|
-
});
|
|
14
|
+
import { twMerge } from '@toptal/picasso-tailwind-merge';
|
|
15
|
+
const HORIZONTAL_SPACING = 16;
|
|
22
16
|
const CheckboxGroup = (props) => {
|
|
23
17
|
const { horizontal, spacing, xs, sm, md, lg, xl, className } = props, rest = __rest(props, ["horizontal", "spacing", "xs", "sm", "md", "lg", "xl", "className"]);
|
|
24
|
-
const classes = useStyles();
|
|
25
|
-
const { spacing: themeSpacing } = useTheme();
|
|
26
18
|
const direction = horizontal ? 'row' : 'column';
|
|
27
|
-
const gridSpacing = (spacing !== null && spacing !== void 0 ? spacing : horizontal) ?
|
|
19
|
+
const gridSpacing = (spacing !== null && spacing !== void 0 ? spacing : horizontal) ? HORIZONTAL_SPACING : 0;
|
|
28
20
|
const children = React.Children.toArray(rest.children);
|
|
29
|
-
return (React.createElement(
|
|
30
|
-
React.createElement(Grid, { direction: direction, spacing: gridSpacing, className: 'mt-0 mb-0' }, children.map((child, index) => (React.createElement(Grid.Item, { key: index, className: 'leading-none
|
|
21
|
+
return (React.createElement("div", Object.assign({}, rest, { className: twMerge('flex flex-col flex-wrap -mr-[0.5em] -mb-[0.5em]', horizontal && 'flex-row', className) }),
|
|
22
|
+
React.createElement(Grid, { direction: direction, spacing: gridSpacing, className: 'mt-0 mb-0' }, children.map((child, index) => (React.createElement(Grid.Item, { key: index, className: 'leading-none pt-0 pb-0 [&>.picasso-checkbox]:mb-[0.5em]', xs: xs, sm: sm, md: md, lg: lg, xl: xl }, child))))));
|
|
31
23
|
};
|
|
32
24
|
CheckboxGroup.defaultProps = {
|
|
33
25
|
horizontal: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.js","sourceRoot":"","sources":["../../../src/CheckboxGroup/CheckboxGroup.tsx"],"names":[],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.js","sourceRoot":"","sources":["../../../src/CheckboxGroup/CheckboxGroup.tsx"],"names":[],"mappings":";;;;;;;;;;;AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,YAAY,IAAI,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAWxD,MAAM,kBAAkB,GAAG,EAAE,CAAA;AAE7B,MAAM,aAAa,GAAG,CAAC,KAAY,EAAE,EAAE;IACrC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAAvE,oEAA+D,CAAQ,CAAA;IAE7E,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAA;IAC/C,MAAM,WAAW,GAAG,CAAA,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,UAAU,EAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAA;IAElE,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAEtD,OAAO,CACL,6CACM,IAAI,IACR,SAAS,EAAE,OAAO,CAChB,iDAAiD,EACjD,UAAU,IAAI,UAAU,EACxB,SAAS,CACV;QAED,oBAAC,IAAI,IACH,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,WAA0B,EACnC,SAAS,EAAC,WAAW,IAEpB,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9B,oBAAC,IAAI,CAAC,IAAI,IACR,GAAG,EAAE,KAAK,EACV,SAAS,EAAC,yDAAyD,EACnE,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,IAEL,KAAK,CACI,CACb,CAAC,CACG,CACH,CACP,CAAA;AACH,CAAC,CAAA;AAED,aAAa,CAAC,YAAY,GAAG;IAC3B,UAAU,EAAE,KAAK;CAClB,CAAA;AAED,eAAe,aAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/picasso-checkbox",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Toptal UI components library - Checkbox",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,14 +22,13 @@
|
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@toptal/picasso-container": "
|
|
26
|
-
"@toptal/picasso-form": "
|
|
27
|
-
"@toptal/picasso-grid": "
|
|
28
|
-
"@toptal/picasso-shared": "15.0.
|
|
29
|
-
"@toptal/picasso-utils": "1.0.
|
|
25
|
+
"@toptal/picasso-container": "2.0.0",
|
|
26
|
+
"@toptal/picasso-form": "4.0.0",
|
|
27
|
+
"@toptal/picasso-grid": "4.0.0",
|
|
28
|
+
"@toptal/picasso-shared": "15.0.0",
|
|
29
|
+
"@toptal/picasso-utils": "1.0.3",
|
|
30
30
|
"ap-style-title-case": "^1.1.2",
|
|
31
|
-
"classnames": "^2.5.1"
|
|
32
|
-
"tailwind-merge": "^2.2.2"
|
|
31
|
+
"classnames": "^2.5.1"
|
|
33
32
|
},
|
|
34
33
|
"sideEffects": [
|
|
35
34
|
"**/styles.ts",
|
|
@@ -38,12 +37,14 @@
|
|
|
38
37
|
"peerDependencies": {
|
|
39
38
|
"@material-ui/core": "4.12.4",
|
|
40
39
|
"@toptal/picasso-provider": "*",
|
|
41
|
-
"@toptal/picasso-tailwind": "
|
|
42
|
-
"react": ">=16.12.0 < 19.0.0"
|
|
40
|
+
"@toptal/picasso-tailwind-merge": "^1.0.1",
|
|
41
|
+
"react": ">=16.12.0 < 19.0.0",
|
|
42
|
+
"@toptal/picasso-tailwind": ">=2.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@toptal/picasso-provider": "
|
|
46
|
-
"@toptal/picasso-
|
|
45
|
+
"@toptal/picasso-provider": "5.0.0",
|
|
46
|
+
"@toptal/picasso-tailwind-merge": "1.2.0",
|
|
47
|
+
"@toptal/picasso-test-utils": "1.1.1",
|
|
47
48
|
"styled-components": "^6.1.1"
|
|
48
49
|
},
|
|
49
50
|
"exports": {
|
|
@@ -53,6 +54,5 @@
|
|
|
53
54
|
"dist-package/**",
|
|
54
55
|
"!dist-package/tsconfig.tsbuildinfo",
|
|
55
56
|
"src"
|
|
56
|
-
]
|
|
57
|
-
"gitHead": "4ebd3caa763220e28d7bfe67e6a63a05ea37599a"
|
|
57
|
+
]
|
|
58
58
|
}
|
|
@@ -6,13 +6,13 @@ exports[`Checkbox Checkbox.Group renders checkbox in a grid group 1`] = `
|
|
|
6
6
|
class="Picasso-root"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
|
-
class="
|
|
9
|
+
class="flex flex-wrap -mr -mb flex-row"
|
|
10
10
|
>
|
|
11
11
|
<div
|
|
12
12
|
class="box-border flex flex-row flex-wrap items-start justify-start w-[calc(100%+16px)] -m mt-0 mb-0"
|
|
13
13
|
>
|
|
14
14
|
<div
|
|
15
|
-
class="box-border m-0 p-[8px] sm:basis-4/12 sm:max-w leading-none
|
|
15
|
+
class="box-border m-0 p-[8px] sm:basis-4/12 sm:max-w leading-none pt-0 pb-0 [&>.picasso-checkbox]:mb-[0.5em]"
|
|
16
16
|
>
|
|
17
17
|
<label
|
|
18
18
|
class="PicassoFormControlLabel-root PicassoCheckbox-root picasso-checkbox"
|
|
@@ -51,7 +51,7 @@ exports[`Checkbox Checkbox.Group renders checkbox in a grid group 1`] = `
|
|
|
51
51
|
</label>
|
|
52
52
|
</div>
|
|
53
53
|
<div
|
|
54
|
-
class="box-border m-0 p-[8px] sm:basis-4/12 sm:max-w leading-none
|
|
54
|
+
class="box-border m-0 p-[8px] sm:basis-4/12 sm:max-w leading-none pt-0 pb-0 [&>.picasso-checkbox]:mb-[0.5em]"
|
|
55
55
|
>
|
|
56
56
|
<label
|
|
57
57
|
class="PicassoFormControlLabel-root PicassoCheckbox-root picasso-checkbox"
|
|
@@ -90,7 +90,7 @@ exports[`Checkbox Checkbox.Group renders checkbox in a grid group 1`] = `
|
|
|
90
90
|
</label>
|
|
91
91
|
</div>
|
|
92
92
|
<div
|
|
93
|
-
class="box-border m-0 p-[8px] sm:basis-4/12 sm:max-w leading-none
|
|
93
|
+
class="box-border m-0 p-[8px] sm:basis-4/12 sm:max-w leading-none pt-0 pb-0 [&>.picasso-checkbox]:mb-[0.5em]"
|
|
94
94
|
>
|
|
95
95
|
<label
|
|
96
96
|
class="PicassoFormControlLabel-root PicassoCheckbox-root picasso-checkbox"
|
|
@@ -129,7 +129,7 @@ exports[`Checkbox Checkbox.Group renders checkbox in a grid group 1`] = `
|
|
|
129
129
|
</label>
|
|
130
130
|
</div>
|
|
131
131
|
<div
|
|
132
|
-
class="box-border m-0 p-[8px] sm:basis-4/12 sm:max-w leading-none
|
|
132
|
+
class="box-border m-0 p-[8px] sm:basis-4/12 sm:max-w leading-none pt-0 pb-0 [&>.picasso-checkbox]:mb-[0.5em]"
|
|
133
133
|
>
|
|
134
134
|
<label
|
|
135
135
|
class="PicassoFormControlLabel-root PicassoCheckbox-root picasso-checkbox"
|
|
@@ -168,7 +168,7 @@ exports[`Checkbox Checkbox.Group renders checkbox in a grid group 1`] = `
|
|
|
168
168
|
</label>
|
|
169
169
|
</div>
|
|
170
170
|
<div
|
|
171
|
-
class="box-border m-0 p-[8px] sm:basis-4/12 sm:max-w leading-none
|
|
171
|
+
class="box-border m-0 p-[8px] sm:basis-4/12 sm:max-w leading-none pt-0 pb-0 [&>.picasso-checkbox]:mb-[0.5em]"
|
|
172
172
|
>
|
|
173
173
|
<label
|
|
174
174
|
class="PicassoFormControlLabel-root PicassoCheckbox-root picasso-checkbox"
|
|
@@ -207,7 +207,7 @@ exports[`Checkbox Checkbox.Group renders checkbox in a grid group 1`] = `
|
|
|
207
207
|
</label>
|
|
208
208
|
</div>
|
|
209
209
|
<div
|
|
210
|
-
class="box-border m-0 p-[8px] sm:basis-4/12 sm:max-w leading-none
|
|
210
|
+
class="box-border m-0 p-[8px] sm:basis-4/12 sm:max-w leading-none pt-0 pb-0 [&>.picasso-checkbox]:mb-[0.5em]"
|
|
211
211
|
>
|
|
212
212
|
<label
|
|
213
213
|
class="PicassoFormControlLabel-root PicassoCheckbox-root picasso-checkbox"
|
|
@@ -1,44 +1,37 @@
|
|
|
1
1
|
/* eslint-disable react/no-array-index-key */
|
|
2
|
+
import type { HTMLAttributes } from 'react'
|
|
2
3
|
import React from 'react'
|
|
3
|
-
import type { FormGroupProps } from '@material-ui/core'
|
|
4
|
-
import { FormGroup } from '@material-ui/core'
|
|
5
|
-
import type { Theme } from '@material-ui/core/styles'
|
|
6
|
-
import { makeStyles, useTheme } from '@material-ui/core/styles'
|
|
7
|
-
import cx from 'classnames'
|
|
8
4
|
import type { GridSizeProps, GridProps } from '@toptal/picasso-grid'
|
|
9
5
|
import { GridCompound as Grid } from '@toptal/picasso-grid'
|
|
10
|
-
|
|
11
|
-
import styles from './styles'
|
|
6
|
+
import { twMerge } from '@toptal/picasso-tailwind-merge'
|
|
12
7
|
|
|
13
8
|
type GridSpacing = GridProps['spacing']
|
|
14
9
|
|
|
15
|
-
export interface Props extends
|
|
10
|
+
export interface Props extends HTMLAttributes<HTMLDivElement>, GridSizeProps {
|
|
16
11
|
/** Align checkboxes horizontally */
|
|
17
12
|
horizontal?: boolean
|
|
18
13
|
/** Defines amount of space between checkbox components (in px) */
|
|
19
14
|
spacing?: GridSpacing
|
|
20
15
|
}
|
|
21
16
|
|
|
22
|
-
const
|
|
23
|
-
name: 'PicassoCheckboxGroup',
|
|
24
|
-
})
|
|
17
|
+
const HORIZONTAL_SPACING = 16
|
|
25
18
|
|
|
26
19
|
const CheckboxGroup = (props: Props) => {
|
|
27
20
|
const { horizontal, spacing, xs, sm, md, lg, xl, className, ...rest } = props
|
|
28
21
|
|
|
29
|
-
const classes = useStyles()
|
|
30
|
-
const { spacing: themeSpacing } = useTheme()
|
|
31
|
-
|
|
32
22
|
const direction = horizontal ? 'row' : 'column'
|
|
33
|
-
const gridSpacing = spacing ?? horizontal ?
|
|
23
|
+
const gridSpacing = spacing ?? horizontal ? HORIZONTAL_SPACING : 0
|
|
34
24
|
|
|
35
25
|
const children = React.Children.toArray(rest.children)
|
|
36
26
|
|
|
37
27
|
return (
|
|
38
|
-
<
|
|
28
|
+
<div
|
|
39
29
|
{...rest}
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
className={twMerge(
|
|
31
|
+
'flex flex-col flex-wrap -mr-[0.5em] -mb-[0.5em]',
|
|
32
|
+
horizontal && 'flex-row',
|
|
33
|
+
className
|
|
34
|
+
)}
|
|
42
35
|
>
|
|
43
36
|
<Grid
|
|
44
37
|
direction={direction}
|
|
@@ -48,7 +41,7 @@ const CheckboxGroup = (props: Props) => {
|
|
|
48
41
|
{children.map((child, index) => (
|
|
49
42
|
<Grid.Item
|
|
50
43
|
key={index}
|
|
51
|
-
className='leading-none
|
|
44
|
+
className='leading-none pt-0 pb-0 [&>.picasso-checkbox]:mb-[0.5em]'
|
|
52
45
|
xs={xs}
|
|
53
46
|
sm={sm}
|
|
54
47
|
md={md}
|
|
@@ -59,7 +52,7 @@ const CheckboxGroup = (props: Props) => {
|
|
|
59
52
|
</Grid.Item>
|
|
60
53
|
))}
|
|
61
54
|
</Grid>
|
|
62
|
-
</
|
|
55
|
+
</div>
|
|
63
56
|
)
|
|
64
57
|
}
|
|
65
58
|
|
package/LICENSE
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021-2022 Toptal, LLC
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the “Software”), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
-
subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/CheckboxGroup/styles.ts"],"names":[],"mappings":";AAEA,wBAUI"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createStyles } from '@material-ui/core/styles';
|
|
2
|
-
export default () => createStyles({
|
|
3
|
-
root: {
|
|
4
|
-
marginRight: '-0.5em',
|
|
5
|
-
marginBottom: '-0.5em',
|
|
6
|
-
'& .picasso-checkbox': {
|
|
7
|
-
marginBottom: '0.5em',
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
});
|
|
11
|
-
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/CheckboxGroup/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,eAAe,GAAG,EAAE,CAClB,YAAY,CAAC;IACX,IAAI,EAAE;QACJ,WAAW,EAAE,QAAQ;QACrB,YAAY,EAAE,QAAQ;QAEtB,qBAAqB,EAAE;YACrB,YAAY,EAAE,OAAO;SACtB;KACF;CACF,CAAC,CAAA"}
|