@toptal/picasso-avatar 2.0.7-alpha-fx-null-fix-button-e862ee8b7.0 → 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.
Files changed (80) hide show
  1. package/dist-package/src/Avatar/Avatar.d.ts.map +1 -1
  2. package/dist-package/src/Avatar/Avatar.js +2 -7
  3. package/dist-package/src/Avatar/Avatar.js.map +1 -1
  4. package/dist-package/src/Avatar/AvatarEditContainer/AvatarEditContainer.d.ts +2 -1
  5. package/dist-package/src/Avatar/AvatarEditContainer/AvatarEditContainer.d.ts.map +1 -1
  6. package/dist-package/src/Avatar/AvatarEditContainer/AvatarEditContainer.js +7 -14
  7. package/dist-package/src/Avatar/AvatarEditContainer/AvatarEditContainer.js.map +1 -1
  8. package/dist-package/src/Avatar/AvatarEditContainer/styles.d.ts +3 -3
  9. package/dist-package/src/Avatar/AvatarEditContainer/styles.d.ts.map +1 -1
  10. package/dist-package/src/Avatar/AvatarEditContainer/styles.js +13 -78
  11. package/dist-package/src/Avatar/AvatarEditContainer/styles.js.map +1 -1
  12. package/dist-package/src/Avatar/AvatarWrapper/AvatarWrapper.d.ts +4 -2
  13. package/dist-package/src/Avatar/AvatarWrapper/AvatarWrapper.d.ts.map +1 -1
  14. package/dist-package/src/Avatar/AvatarWrapper/AvatarWrapper.js +3 -10
  15. package/dist-package/src/Avatar/AvatarWrapper/AvatarWrapper.js.map +1 -1
  16. package/dist-package/src/Avatar/AvatarWrapper/styles.d.ts +3 -6
  17. package/dist-package/src/Avatar/AvatarWrapper/styles.d.ts.map +1 -1
  18. package/dist-package/src/Avatar/AvatarWrapper/styles.js +22 -50
  19. package/dist-package/src/Avatar/AvatarWrapper/styles.js.map +1 -1
  20. package/dist-package/src/Avatar/IconAvatar/IconAvatar.d.ts +1 -0
  21. package/dist-package/src/Avatar/IconAvatar/IconAvatar.d.ts.map +1 -1
  22. package/dist-package/src/Avatar/IconAvatar/IconAvatar.js +3 -8
  23. package/dist-package/src/Avatar/IconAvatar/IconAvatar.js.map +1 -1
  24. package/dist-package/src/Avatar/IconAvatar/styles.d.ts +2 -2
  25. package/dist-package/src/Avatar/IconAvatar/styles.d.ts.map +1 -1
  26. package/dist-package/src/Avatar/IconAvatar/styles.js +7 -14
  27. package/dist-package/src/Avatar/IconAvatar/styles.js.map +1 -1
  28. package/dist-package/src/Avatar/ImageAvatar/ImageAvatar.d.ts +2 -1
  29. package/dist-package/src/Avatar/ImageAvatar/ImageAvatar.d.ts.map +1 -1
  30. package/dist-package/src/Avatar/ImageAvatar/ImageAvatar.js +6 -12
  31. package/dist-package/src/Avatar/ImageAvatar/ImageAvatar.js.map +1 -1
  32. package/dist-package/src/Avatar/TextAvatar/TextAvatar.d.ts +4 -2
  33. package/dist-package/src/Avatar/TextAvatar/TextAvatar.d.ts.map +1 -1
  34. package/dist-package/src/Avatar/TextAvatar/TextAvatar.js +4 -19
  35. package/dist-package/src/Avatar/TextAvatar/TextAvatar.js.map +1 -1
  36. package/dist-package/src/Avatar/TextAvatar/styles.d.ts +3 -2
  37. package/dist-package/src/Avatar/TextAvatar/styles.d.ts.map +1 -1
  38. package/dist-package/src/Avatar/TextAvatar/styles.js +11 -21
  39. package/dist-package/src/Avatar/TextAvatar/styles.js.map +1 -1
  40. package/dist-package/src/AvatarDropzoneSvg/AvatarDropzoneSvg.d.ts +1 -0
  41. package/dist-package/src/AvatarDropzoneSvg/AvatarDropzoneSvg.d.ts.map +1 -1
  42. package/dist-package/src/AvatarDropzoneSvg/AvatarDropzoneSvg.js +7 -25
  43. package/dist-package/src/AvatarDropzoneSvg/AvatarDropzoneSvg.js.map +1 -1
  44. package/dist-package/src/AvatarDropzoneSvg/styles.d.ts +5 -3
  45. package/dist-package/src/AvatarDropzoneSvg/styles.d.ts.map +1 -1
  46. package/dist-package/src/AvatarDropzoneSvg/styles.js +34 -99
  47. package/dist-package/src/AvatarDropzoneSvg/styles.js.map +1 -1
  48. package/dist-package/src/AvatarGroup/AvatarGroup.d.ts.map +1 -1
  49. package/dist-package/src/AvatarGroup/AvatarGroup.js +2 -8
  50. package/dist-package/src/AvatarGroup/AvatarGroup.js.map +1 -1
  51. package/package.json +13 -14
  52. package/src/Avatar/Avatar.tsx +3 -10
  53. package/src/Avatar/AvatarEditContainer/AvatarEditContainer.tsx +17 -18
  54. package/src/Avatar/AvatarEditContainer/styles.ts +15 -86
  55. package/src/Avatar/AvatarWrapper/AvatarWrapper.tsx +13 -19
  56. package/src/Avatar/AvatarWrapper/styles.ts +28 -80
  57. package/src/Avatar/IconAvatar/IconAvatar.tsx +9 -11
  58. package/src/Avatar/IconAvatar/styles.ts +8 -15
  59. package/src/Avatar/ImageAvatar/ImageAvatar.tsx +14 -18
  60. package/src/Avatar/TextAvatar/TextAvatar.tsx +29 -35
  61. package/src/Avatar/TextAvatar/styles.ts +12 -23
  62. package/src/AvatarDropzoneSvg/AvatarDropzoneSvg.tsx +28 -28
  63. package/src/AvatarDropzoneSvg/styles.ts +40 -104
  64. package/src/AvatarGroup/AvatarGroup.tsx +2 -11
  65. package/LICENSE +0 -20
  66. package/dist-package/src/Avatar/ImageAvatar/styles.d.ts +0 -3
  67. package/dist-package/src/Avatar/ImageAvatar/styles.d.ts.map +0 -1
  68. package/dist-package/src/Avatar/ImageAvatar/styles.js +0 -25
  69. package/dist-package/src/Avatar/ImageAvatar/styles.js.map +0 -1
  70. package/dist-package/src/Avatar/styles.d.ts +0 -3
  71. package/dist-package/src/Avatar/styles.d.ts.map +0 -1
  72. package/dist-package/src/Avatar/styles.js +0 -9
  73. package/dist-package/src/Avatar/styles.js.map +0 -1
  74. package/dist-package/src/AvatarGroup/styles.d.ts +0 -3
  75. package/dist-package/src/AvatarGroup/styles.d.ts.map +0 -1
  76. package/dist-package/src/AvatarGroup/styles.js +0 -8
  77. package/dist-package/src/AvatarGroup/styles.js.map +0 -1
  78. package/src/Avatar/ImageAvatar/styles.ts +0 -26
  79. package/src/Avatar/styles.ts +0 -9
  80. package/src/AvatarGroup/styles.ts +0 -9
@@ -1,113 +1,49 @@
1
- import type { Theme } from '@material-ui/core/styles'
2
- import { createStyles } from '@material-ui/core/styles'
3
- import { alpha } from '@toptal/picasso-shared'
4
-
5
- export default ({ palette, transitions }: Theme) => {
6
- const dragActiveColor = alpha(palette.blue.main, 0.24)
7
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8
- const hoverBackgroundColor = alpha(palette.blue.lighter!, 0.84)
9
- const hoverBorderColor = alpha(palette.blue.main, 0.84)
10
-
11
- return createStyles({
12
- root: {
13
- pointerEvents: 'unset',
14
- position: 'relative',
15
- background: 'transparent',
16
- },
17
- rootXxsmall: {
18
- width: '32px',
19
- height: '32px',
20
- },
21
- rootXsmall: {
22
- width: '40px',
23
- height: '40px',
24
- },
25
- rootSmall: {
26
- width: '80px',
27
- height: '80px',
28
- },
29
- rootMedium: {
30
- width: '120px',
31
- height: '120px',
32
- },
33
- rootLarge: {
34
- width: '160px',
35
- height: '160px',
36
- },
37
-
38
- svg: {
39
- margin: '-3px', // to center the svg
40
- },
41
- svgXxsmall: {
42
- width: '38px', // +6px for outline
43
- height: '38px', // +6px for outline
44
- },
45
- svgXsmall: {
46
- width: '46px', // +6px for outline
47
- height: '46px', // +6px for outline
48
- },
49
- svgSmall: {
50
- width: '86px', // +6px for outline
51
- height: '86px', // +6px for outline
52
- },
53
- svgMedium: {
54
- width: '126px', // +6px for outline
55
- height: '126px', // +6px for outline
56
- },
57
- svgLarge: {
58
- width: '166px', // +6px for outline
59
- height: '166px', // +6px for outline
60
- },
61
-
62
- background: {
63
- fill: palette.blue.lighter,
64
- transition: `all ${transitions.duration.short}ms ${transitions.easing.easeOut}`,
65
- transitionProperty: 'fill',
1
+ import type { Props, Size } from './AvatarDropzoneSvg'
2
+
3
+ export const rootClassBySize: Record<Size, string> = {
4
+ xxsmall: 'w-[32px] h-[32px]',
5
+ xsmall: 'w-[40px] h-[40px]',
6
+ small: 'w-[80px] h-[80px]',
7
+ medium: 'w-[120px] h-[120px]',
8
+ large: 'w-[160px] h-[160px]',
9
+ }
66
10
 
67
- '&$hovered': {
68
- fill: hoverBackgroundColor,
69
- },
11
+ export const svgClassBySize: Record<Size, string> = {
12
+ xxsmall: 'w-[39px] h-[38px]',
13
+ xsmall: 'w-[46px] h-[46px]',
14
+ small: 'w-[86px] h-[86px]',
15
+ medium: 'w-[126px] h-[126px]',
16
+ large: 'w-[166px] h-[166px]',
17
+ }
70
18
 
71
- '&$dragActive,&:active': {
72
- fill: dragActiveColor,
73
- },
19
+ export const getBackgroundFillClass = ({
20
+ hovered,
21
+ isDragActive,
22
+ disabled,
23
+ }: Props) => {
24
+ if (disabled) {
25
+ return 'fill-gray-100'
26
+ }
74
27
 
75
- '&$disabled': {
76
- fill: palette.grey.lighter,
77
- '&$hovered': {
78
- fill: palette.grey.light2,
79
- },
80
- },
81
- },
82
- border: {
83
- stroke: palette.blue.main,
84
- transition: `stroke ${transitions.duration.short}ms`,
28
+ if (isDragActive) {
29
+ return 'fill-blue-500/[0.24]'
30
+ }
85
31
 
86
- '&$hovered': {
87
- stroke: hoverBorderColor,
88
- },
32
+ if (hovered) {
33
+ return 'fill-blue-100/[0.84]'
34
+ }
89
35
 
90
- '&$error': {
91
- stroke: palette.red.main,
92
- },
93
- },
94
- outline: {
95
- display: 'none',
96
- stroke: palette.blue.main,
36
+ return 'fill-blue-100'
37
+ }
97
38
 
98
- '&$focused:not($dragActive)': {
99
- display: 'initial',
100
- },
39
+ export const getBordersStrokeClass = ({ hovered, error }: Props) => {
40
+ if (error) {
41
+ return 'stroke-red-500'
42
+ }
101
43
 
102
- '&$error': {
103
- stroke: palette.red.main,
104
- },
105
- },
44
+ if (hovered) {
45
+ return 'stroke-blue-500/[0.84]'
46
+ }
106
47
 
107
- dragActive: {},
108
- disabled: {},
109
- error: {},
110
- focused: {},
111
- hovered: {},
112
- })
48
+ return 'stroke-blue-500'
113
49
  }
@@ -1,14 +1,11 @@
1
1
  import type { BaseProps, SizeType } from '@toptal/picasso-shared'
2
2
  import React, { useMemo } from 'react'
3
- import cx from 'classnames'
4
- import type { Theme } from '@material-ui/core/styles'
5
- import { makeStyles } from '@material-ui/core/styles'
6
3
  import { Container } from '@toptal/picasso-container'
4
+ import { twMerge } from '@toptal/picasso-tailwind-merge'
7
5
 
8
6
  import { Avatar } from '../Avatar'
9
7
  import AvatarWrapper from '../Avatar/AvatarWrapper/AvatarWrapper'
10
8
  import TextAvatar from '../Avatar/TextAvatar/TextAvatar'
11
- import styles from './styles'
12
9
 
13
10
  type ItemType = {
14
11
  alt?: string
@@ -31,10 +28,6 @@ export interface Props extends Omit<BaseProps, 'data-testid'> {
31
28
  }
32
29
  }
33
30
 
34
- const useStyles = makeStyles<Theme>(styles, {
35
- name: 'PicassoAvatarGroup',
36
- })
37
-
38
31
  const AvatarGroup = ({
39
32
  className,
40
33
  style,
@@ -43,8 +36,6 @@ const AvatarGroup = ({
43
36
  limit,
44
37
  size,
45
38
  }: Props) => {
46
- const classes = useStyles()
47
-
48
39
  /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
49
40
  const isOverLimit = items.length > limit!
50
41
  // we need to add +1 for the last item that is going to be transformed to numbered Avatar
@@ -63,7 +54,7 @@ const AvatarGroup = ({
63
54
 
64
55
  return (
65
56
  <Container
66
- className={cx(classes.root, className)}
57
+ className={twMerge('max-w-full overflow-x-auto', className)}
67
58
  data-testid={testIds?.container}
68
59
  flex
69
60
  gap='xsmall'
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,3 +0,0 @@
1
- declare const _default: () => import("@material-ui/styles").StyleRules<{}, "image" | "logoContainer" | "logo">;
2
- export default _default;
3
- //# sourceMappingURL=styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/Avatar/ImageAvatar/styles.ts"],"names":[],"mappings":";AAGA,wBAsBI"}
@@ -1,25 +0,0 @@
1
- import { rem } from '@toptal/picasso-shared';
2
- import { createStyles } from '@material-ui/core/styles';
3
- export default () => createStyles({
4
- image: {
5
- objectFit: 'cover',
6
- width: '100%',
7
- height: '100%',
8
- position: 'absolute',
9
- left: 0,
10
- top: 0,
11
- /* Required to prevent image blur on downscale */
12
- imageRendering: '-webkit-optimize-contrast',
13
- },
14
- logoContainer: {
15
- display: 'flex',
16
- position: 'absolute',
17
- bottom: '1rem',
18
- left: '1rem',
19
- },
20
- logo: {
21
- width: rem('17px'),
22
- height: rem('24px'),
23
- },
24
- });
25
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/Avatar/ImageAvatar/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,eAAe,GAAG,EAAE,CAClB,YAAY,CAAC;IACX,KAAK,EAAE;QACL,SAAS,EAAE,OAAO;QAClB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,CAAC;QACP,GAAG,EAAE,CAAC;QACN,iDAAiD;QACjD,cAAc,EAAE,2BAA2B;KAC5C;IACD,aAAa,EAAE;QACb,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,MAAM;KACb;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC;QAClB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC;KACpB;CACF,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- declare const _default: () => import("@material-ui/styles").StyleRules<{}, "editableAvatarContainer">;
2
- export default _default;
3
- //# sourceMappingURL=styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/Avatar/styles.ts"],"names":[],"mappings":";AAEA,wBAMC"}
@@ -1,9 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles';
2
- export default () => {
3
- return createStyles({
4
- editableAvatarContainer: {
5
- position: 'relative',
6
- },
7
- });
8
- };
9
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/Avatar/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,eAAe,GAAG,EAAE;IAClB,OAAO,YAAY,CAAC;QAClB,uBAAuB,EAAE;YACvB,QAAQ,EAAE,UAAU;SACrB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- declare const _default: () => import("@material-ui/styles").StyleRules<{}, "root">;
2
- export default _default;
3
- //# sourceMappingURL=styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/AvatarGroup/styles.ts"],"names":[],"mappings":";AAEA,wBAMI"}
@@ -1,8 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles';
2
- export default () => createStyles({
3
- root: {
4
- maxWidth: '100%',
5
- overflowX: 'auto',
6
- },
7
- });
8
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/AvatarGroup/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,eAAe,GAAG,EAAE,CAClB,YAAY,CAAC;IACX,IAAI,EAAE;QACJ,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,MAAM;KAClB;CACF,CAAC,CAAA"}
@@ -1,26 +0,0 @@
1
- import { rem } from '@toptal/picasso-shared'
2
- import { createStyles } from '@material-ui/core/styles'
3
-
4
- export default () =>
5
- createStyles({
6
- image: {
7
- objectFit: 'cover',
8
- width: '100%',
9
- height: '100%',
10
- position: 'absolute',
11
- left: 0,
12
- top: 0,
13
- /* Required to prevent image blur on downscale */
14
- imageRendering: '-webkit-optimize-contrast',
15
- },
16
- logoContainer: {
17
- display: 'flex',
18
- position: 'absolute',
19
- bottom: '1rem',
20
- left: '1rem',
21
- },
22
- logo: {
23
- width: rem('17px'),
24
- height: rem('24px'),
25
- },
26
- })
@@ -1,9 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles'
2
-
3
- export default () => {
4
- return createStyles({
5
- editableAvatarContainer: {
6
- position: 'relative',
7
- },
8
- })
9
- }
@@ -1,9 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles'
2
-
3
- export default () =>
4
- createStyles({
5
- root: {
6
- maxWidth: '100%',
7
- overflowX: 'auto',
8
- },
9
- })