@toptal/picasso-page 2.2.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 (57) hide show
  1. package/dist-package/src/PageSidebar/PageSidebar.d.ts.map +1 -1
  2. package/dist-package/src/PageSidebar/PageSidebar.js +2 -2
  3. package/dist-package/src/PageSidebar/PageSidebar.js.map +1 -1
  4. package/dist-package/src/PageTopBar/PageTopBar.d.ts.map +1 -1
  5. package/dist-package/src/PageTopBar/PageTopBar.js +1 -1
  6. package/dist-package/src/PageTopBar/PageTopBar.js.map +1 -1
  7. package/dist-package/src/SidebarItem/SidebarItemHeader.d.ts.map +1 -1
  8. package/dist-package/src/SidebarItem/SidebarItemHeader.js +58 -15
  9. package/dist-package/src/SidebarItem/SidebarItemHeader.js.map +1 -1
  10. package/dist-package/src/SidebarItem/styles.d.ts +1 -1
  11. package/dist-package/src/SidebarItem/styles.d.ts.map +1 -1
  12. package/dist-package/src/SidebarItem/styles.js +1 -69
  13. package/dist-package/src/SidebarItem/styles.js.map +1 -1
  14. package/dist-package/src/SidebarLogo/SidebarLogo.d.ts.map +1 -1
  15. package/dist-package/src/SidebarLogo/SidebarLogo.js +1 -1
  16. package/dist-package/src/SidebarLogo/SidebarLogo.js.map +1 -1
  17. package/dist-package/src/SidebarMenu/SidebarMenu.d.ts.map +1 -1
  18. package/dist-package/src/SidebarMenu/SidebarMenu.js +3 -9
  19. package/dist-package/src/SidebarMenu/SidebarMenu.js.map +1 -1
  20. package/dist-package/src/TopBarItem/TopBarItem.d.ts.map +1 -1
  21. package/dist-package/src/TopBarItem/TopBarItem.js +15 -9
  22. package/dist-package/src/TopBarItem/TopBarItem.js.map +1 -1
  23. package/dist-package/src/TopBarMenu/TopBarMenu.d.ts.map +1 -1
  24. package/dist-package/src/TopBarMenu/TopBarMenu.js +4 -6
  25. package/dist-package/src/TopBarMenu/TopBarMenu.js.map +1 -1
  26. package/package.json +19 -18
  27. package/src/PageAutocomplete/__snapshots__/test.tsx.snap +5 -19
  28. package/src/PageSidebar/PageSidebar.tsx +1 -3
  29. package/src/PageSidebar/__snapshots__/test.tsx.snap +9 -9
  30. package/src/PageTopBar/PageTopBar.tsx +1 -5
  31. package/src/PageTopBar/__snapshots__/test.tsx.snap +13 -13
  32. package/src/PageTopBarMenu/__snapshots__/test.tsx.snap +3 -3
  33. package/src/PageTopBarMenu/test.tsx +3 -3
  34. package/src/SidebarItem/SidebarItemHeader.tsx +90 -26
  35. package/src/SidebarItem/__snapshots__/test.tsx.snap +79 -79
  36. package/src/SidebarItem/styles.ts +1 -69
  37. package/src/SidebarLogo/SidebarLogo.tsx +0 -2
  38. package/src/SidebarLogo/__snapshots__/test.tsx.snap +1 -1
  39. package/src/SidebarMenu/SidebarMenu.tsx +3 -12
  40. package/src/SidebarMenu/__snapshots__/test.tsx.snap +2 -2
  41. package/src/TopBarItem/TopBarItem.tsx +25 -10
  42. package/src/TopBarMenu/TopBarMenu.tsx +1 -7
  43. package/dist-package/src/SidebarMenu/styles.d.ts +0 -3
  44. package/dist-package/src/SidebarMenu/styles.d.ts.map +0 -1
  45. package/dist-package/src/SidebarMenu/styles.js +0 -20
  46. package/dist-package/src/SidebarMenu/styles.js.map +0 -1
  47. package/dist-package/src/TopBarItem/styles.d.ts +0 -4
  48. package/dist-package/src/TopBarItem/styles.d.ts.map +0 -1
  49. package/dist-package/src/TopBarItem/styles.js +0 -46
  50. package/dist-package/src/TopBarItem/styles.js.map +0 -1
  51. package/dist-package/src/TopBarMenu/styles.d.ts +0 -3
  52. package/dist-package/src/TopBarMenu/styles.d.ts.map +0 -1
  53. package/dist-package/src/TopBarMenu/styles.js +0 -11
  54. package/dist-package/src/TopBarMenu/styles.js.map +0 -1
  55. package/src/SidebarMenu/styles.ts +0 -21
  56. package/src/TopBarItem/styles.ts +0 -49
  57. package/src/TopBarMenu/styles.ts +0 -13
@@ -6,7 +6,7 @@ exports[`SidebarMenu renders 1`] = `
6
6
  class="Picasso-root"
7
7
  >
8
8
  <ul
9
- class="MuiList-root PicassoMenu-root PicassoSidebarMenu-root"
9
+ class="relative list-none outline-none py-2 px-0 m-0 rounded-sm shadow-0 order-1 [&_&]:flex-1 flex-grow flex-shrink max-w"
10
10
  role="menu"
11
11
  tabindex="-1"
12
12
  />
@@ -20,7 +20,7 @@ exports[`SidebarMenu with bottom 1`] = `
20
20
  class="Picasso-root"
21
21
  >
22
22
  <ul
23
- class="MuiList-root PicassoMenu-root PicassoSidebarMenu-root PicassoSidebarMenu-bottom"
23
+ class="relative list-none outline-none py-2 px-0 m-0 rounded-sm shadow-0 [&_&]:flex-1 flex-grow flex-shrink max-w order-[99]"
24
24
  role="menu"
25
25
  tabindex="-1"
26
26
  />
@@ -6,13 +6,10 @@ import type {
6
6
  import type { ElementType, ReactElement } from 'react'
7
7
  import React, { forwardRef, memo } from 'react'
8
8
  import type { MenuItemProps } from '@material-ui/core/MenuItem'
9
- import type { Theme } from '@material-ui/core/styles'
10
- import { makeStyles } from '@material-ui/core/styles'
11
- import cx from 'classnames'
9
+ import { twMerge } from '@toptal/picasso-tailwind-merge'
12
10
  import { noop } from '@toptal/picasso-utils'
13
11
 
14
12
  import { SidebarItem } from '../SidebarItem'
15
- import styles from './styles'
16
13
 
17
14
  export interface Props extends BaseProps, TextLabelProps {
18
15
  /** Pass icon to be used as part of item */
@@ -27,20 +24,38 @@ export interface Props extends BaseProps, TextLabelProps {
27
24
  onMouseEnter?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void
28
25
  }
29
26
 
30
- const useStyles = makeStyles<Theme>(styles, { name: 'PicassoTopBarMenuItem' })
27
+ const rootClasses = [
28
+ 'min-[1280px]:text-gray-600 min-[1280px]:p-0 min-[1280px]:h-auto',
29
+ 'min-[1280px]:w-auto min-[1280px]:m-0 min-[1280px]:flex-auto',
30
+ 'min-[1280px]:[&_p]:text-sm',
31
+ ]
32
+ const separatorClasses = [
33
+ 'min-[1280px]:before:[&:not(:first-child)]:content-[""]',
34
+ 'min-[1280px]:before:bg-gray-600 min-[1280px]:before:inline-block',
35
+ 'min-[1280px]:before:h-2 min-[1280px]:before:mx-2 min-[1280px]:before:w-[1px]',
36
+ ]
37
+ const bgClasses =
38
+ 'min-[1280px]:hover:bg-transparent min-[1280px]:focus:bg-transparent'
39
+ const textColorClasses =
40
+ 'min-[1280px]:hover:text-gray-400 min-[1280px]:hover:text-white'
31
41
 
32
42
  export const TopBarItem: OverridableComponent<Props> = memo(
33
43
  forwardRef<HTMLElement, Props>(function TopBarItem(props, ref) {
34
44
  const { className, icon } = props
35
- const classes = useStyles()
36
45
 
37
46
  return (
38
47
  <SidebarItem
39
48
  {...props}
40
- className={cx(classes.root, className, {
41
- [classes.selected]: props.selected,
42
- [classes.icon]: icon,
43
- })}
49
+ className={twMerge(
50
+ rootClasses,
51
+ separatorClasses,
52
+ bgClasses,
53
+ textColorClasses,
54
+ icon && 'min-[1280px]:[&_svg]:w-[1em]',
55
+ props.selected &&
56
+ 'min-[1280px]:bg-transparent min-[1280px]:text-white',
57
+ className
58
+ )}
44
59
  ref={ref}
45
60
  />
46
61
  )
@@ -1,24 +1,18 @@
1
1
  import type { BaseProps } from '@toptal/picasso-shared'
2
2
  import type { HTMLAttributes, ReactNode } from 'react'
3
3
  import React, { forwardRef } from 'react'
4
- import type { Theme } from '@material-ui/core/styles'
5
- import { makeStyles } from '@material-ui/core/styles'
6
4
  import { Menu } from '@toptal/picasso-menu'
7
5
 
8
6
  import { useRegisterMenu } from '../PageHamburger'
9
- import styles from './styles'
10
7
 
11
8
  export interface Props extends BaseProps, HTMLAttributes<HTMLUListElement> {
12
9
  /** Menu content */
13
10
  children: ReactNode
14
11
  }
15
12
 
16
- const useStyles = makeStyles<Theme>(styles, { name: 'PicassoTopBarMenu' })
17
-
18
13
  export const TopBarMenu = forwardRef<HTMLUListElement, Props>(
19
14
  function TopBarMenu(props, ref) {
20
15
  const { children, ...rest } = props
21
- const classes = useStyles()
22
16
 
23
17
  // not more than 6 menu items are allowed by BASE design
24
18
  const items = React.Children.toArray(children).slice(0, 6)
@@ -30,7 +24,7 @@ export const TopBarMenu = forwardRef<HTMLUListElement, Props>(
30
24
  {...rest}
31
25
  allowNestedNavigation={false}
32
26
  ref={ref}
33
- className={classes.root}
27
+ className='block min-[1280px]:flex shadow-0'
34
28
  >
35
29
  {items}
36
30
  </Menu>
@@ -1,3 +0,0 @@
1
- declare const _default: () => import("@material-ui/styles").StyleRules<{}, "root" | "bottom" | "compactParent">;
2
- export default _default;
3
- //# sourceMappingURL=styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/SidebarMenu/styles.ts"],"names":[],"mappings":";AAEA,wBAkBI"}
@@ -1,20 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles';
2
- export default () => createStyles({
3
- root: {
4
- flex: 0,
5
- boxShadow: 'none',
6
- order: 1,
7
- '& &': {
8
- flex: 1,
9
- },
10
- // to cover text overflow in the sub-menu items
11
- maxWidth: '100%',
12
- },
13
- compactParent: {
14
- padding: '0.5em',
15
- },
16
- bottom: {
17
- order: 99,
18
- },
19
- });
20
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/SidebarMenu/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,eAAe,GAAG,EAAE,CAClB,YAAY,CAAC;IACX,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC;QACP,SAAS,EAAE,MAAM;QACjB,KAAK,EAAE,CAAC;QACR,KAAK,EAAE;YACL,IAAI,EAAE,CAAC;SACR;QACD,+CAA+C;QAC/C,QAAQ,EAAE,MAAM;KACjB;IACD,aAAa,EAAE;QACb,OAAO,EAAE,OAAO;KACjB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;KACV;CACF,CAAC,CAAA"}
@@ -1,4 +0,0 @@
1
- import type { Theme } from '@material-ui/core/styles';
2
- declare const _default: ({ spacing, palette, typography }: Theme) => import("@material-ui/styles").StyleRules<{}, "root" | "icon" | "selected">;
3
- export default _default;
4
- //# sourceMappingURL=styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/TopBarItem/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;2DAKH,KAAK;AAAvD,wBA2CC"}
@@ -1,46 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles';
2
- import { headerBreakingPointXL } from '../PageTopBar/constants';
3
- export default ({ spacing, palette, typography }) => {
4
- const itemSpacing = spacing(1);
5
- return createStyles({
6
- root: {
7
- [headerBreakingPointXL]: {
8
- color: palette.grey.main2,
9
- padding: 0,
10
- height: 'auto',
11
- width: 'auto',
12
- margin: 0,
13
- flex: '1 1 auto',
14
- '& + &:before': {
15
- backgroundColor: palette.grey.main2,
16
- content: '""',
17
- display: 'inline-block',
18
- height: itemSpacing,
19
- marginLeft: itemSpacing,
20
- marginRight: itemSpacing,
21
- width: 1,
22
- },
23
- '&:hover': {
24
- backgroundColor: 'transparent',
25
- color: palette.grey.light2,
26
- },
27
- '&:focus, &$selected': {
28
- backgroundColor: 'transparent',
29
- color: palette.common.white,
30
- },
31
- '& p': {
32
- fontSize: typography.fontSizes.small,
33
- },
34
- },
35
- },
36
- icon: {
37
- [headerBreakingPointXL]: {
38
- '& svg': {
39
- width: '1em',
40
- },
41
- },
42
- },
43
- selected: {},
44
- });
45
- };
46
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/TopBarItem/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,eAAe,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAS,EAAE,EAAE;IACzD,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IAE9B,OAAO,YAAY,CAAC;QAClB,IAAI,EAAE;YACJ,CAAC,qBAAqB,CAAC,EAAE;gBACvB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;gBACzB,OAAO,EAAE,CAAC;gBACV,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,CAAC;gBACT,IAAI,EAAE,UAAU;gBAChB,cAAc,EAAE;oBACd,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;oBACnC,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,cAAc;oBACvB,MAAM,EAAE,WAAW;oBACnB,UAAU,EAAE,WAAW;oBACvB,WAAW,EAAE,WAAW;oBACxB,KAAK,EAAE,CAAC;iBACT;gBACD,SAAS,EAAE;oBACT,eAAe,EAAE,aAAa;oBAC9B,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM;iBAC3B;gBACD,qBAAqB,EAAE;oBACrB,eAAe,EAAE,aAAa;oBAC9B,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK;iBAC5B;gBACD,KAAK,EAAE;oBACL,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK;iBACrC;aACF;SACF;QACD,IAAI,EAAE;YACJ,CAAC,qBAAqB,CAAC,EAAE;gBACvB,OAAO,EAAE;oBACP,KAAK,EAAE,KAAK;iBACb;aACF;SACF;QACD,QAAQ,EAAE,EAAE;KACb,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/TopBarMenu/styles.ts"],"names":[],"mappings":";AAIA,wBAQI"}
@@ -1,11 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles';
2
- import { headerBreakingPointXL } from '../PageTopBar/constants';
3
- export default () => createStyles({
4
- root: {
5
- display: 'block',
6
- [headerBreakingPointXL]: {
7
- display: 'flex',
8
- },
9
- },
10
- });
11
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/TopBarMenu/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,eAAe,GAAG,EAAE,CAClB,YAAY,CAAC;IACX,IAAI,EAAE;QACJ,OAAO,EAAE,OAAO;QAChB,CAAC,qBAAqB,CAAC,EAAE;YACvB,OAAO,EAAE,MAAM;SAChB;KACF;CACF,CAAC,CAAA"}
@@ -1,21 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles'
2
-
3
- export default () =>
4
- createStyles({
5
- root: {
6
- flex: 0,
7
- boxShadow: 'none',
8
- order: 1,
9
- '& &': {
10
- flex: 1,
11
- },
12
- // to cover text overflow in the sub-menu items
13
- maxWidth: '100%',
14
- },
15
- compactParent: {
16
- padding: '0.5em',
17
- },
18
- bottom: {
19
- order: 99,
20
- },
21
- })
@@ -1,49 +0,0 @@
1
- import type { Theme } from '@material-ui/core/styles'
2
- import { createStyles } from '@material-ui/core/styles'
3
-
4
- import { headerBreakingPointXL } from '../PageTopBar/constants'
5
-
6
- export default ({ spacing, palette, typography }: Theme) => {
7
- const itemSpacing = spacing(1)
8
-
9
- return createStyles({
10
- root: {
11
- [headerBreakingPointXL]: {
12
- color: palette.grey.main2,
13
- padding: 0,
14
- height: 'auto',
15
- width: 'auto',
16
- margin: 0,
17
- flex: '1 1 auto',
18
- '& + &:before': {
19
- backgroundColor: palette.grey.main2,
20
- content: '""',
21
- display: 'inline-block',
22
- height: itemSpacing,
23
- marginLeft: itemSpacing,
24
- marginRight: itemSpacing,
25
- width: 1,
26
- },
27
- '&:hover': {
28
- backgroundColor: 'transparent',
29
- color: palette.grey.light2,
30
- },
31
- '&:focus, &$selected': {
32
- backgroundColor: 'transparent',
33
- color: palette.common.white,
34
- },
35
- '& p': {
36
- fontSize: typography.fontSizes.small,
37
- },
38
- },
39
- },
40
- icon: {
41
- [headerBreakingPointXL]: {
42
- '& svg': {
43
- width: '1em',
44
- },
45
- },
46
- },
47
- selected: {},
48
- })
49
- }
@@ -1,13 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles'
2
-
3
- import { headerBreakingPointXL } from '../PageTopBar/constants'
4
-
5
- export default () =>
6
- createStyles({
7
- root: {
8
- display: 'block',
9
- [headerBreakingPointXL]: {
10
- display: 'flex',
11
- },
12
- },
13
- })