qpp-style 9.20.6 → 9.21.1

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.
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import MenuButton from './MenuButton';
3
3
  import Menu from './Menu';
4
4
  import MenuItem from './MenuItem';
5
+ import MenuItemLink from './MenuItemLink';
5
6
  import { useMenuState } from 'ariakit/menu';
6
7
  import Download from '@material-design-icons/svg/outlined/file_download.svg';
7
8
 
@@ -11,7 +12,7 @@ export default {
11
12
  };
12
13
 
13
14
  export function BasicExample() {
14
- const menu = useMenuState({ gutter: 8 });
15
+ const menu = useMenuState({ gutter: 0 });
15
16
  const basicEx = ['option 1', 'Name of Option 2'];
16
17
 
17
18
  return (
@@ -19,7 +20,28 @@ export function BasicExample() {
19
20
  <MenuButton state={menu}>Test</MenuButton>
20
21
  <Menu state={menu}>
21
22
  {basicEx.map((item, i) => (
22
- <MenuItem key={i}>{item}</MenuItem>
23
+ <MenuItem key={i}>
24
+ <span>{item}</span>
25
+ </MenuItem>
26
+ ))}
27
+ </Menu>
28
+ </div>
29
+ );
30
+ }
31
+
32
+ export function LinkExample() {
33
+ const menu = useMenuState({ gutter: 0 });
34
+ const basicEx = ['link 1', 'link 2'];
35
+
36
+ return (
37
+ <div className="qpp-u-padding--48">
38
+ <MenuButton state={menu}>Test</MenuButton>
39
+ <Menu state={menu}>
40
+ {basicEx.map((item, i) => (
41
+ <MenuItemLink key={i} href="#">
42
+ {/* if using react-router, you can use `<MenuItemLink as={Link} to={path} ...>` insead} */}
43
+ <span>{item}</span>
44
+ </MenuItemLink>
23
45
  ))}
24
46
  </Menu>
25
47
  </div>
@@ -27,7 +49,7 @@ export function BasicExample() {
27
49
  }
28
50
 
29
51
  export function MaxHeight() {
30
- const menu = useMenuState({ gutter: 8 });
52
+ const menu = useMenuState({ gutter: 0 });
31
53
  const maxHeightEx = [
32
54
  'option 1',
33
55
  'option 2',
@@ -46,7 +68,9 @@ export function MaxHeight() {
46
68
  <MenuButton state={menu}>Test</MenuButton>
47
69
  <Menu state={menu}>
48
70
  {maxHeightEx.map((item, i) => (
49
- <MenuItem key={i}>{item}</MenuItem>
71
+ <MenuItem key={i}>
72
+ <span>{item}</span>
73
+ </MenuItem>
50
74
  ))}
51
75
  </Menu>
52
76
  </div>
@@ -54,19 +78,20 @@ export function MaxHeight() {
54
78
  }
55
79
 
56
80
  export function MaxWidth() {
57
- const menu = useMenuState({ gutter: 8 });
81
+ const menu = useMenuState({ gutter: 0 });
58
82
  const maxWidthtEx = [
59
83
  'option 1',
60
84
  'very long item text 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24',
61
85
  ];
62
- const maxContentLength = 57;
63
86
 
64
87
  return (
65
88
  <div className="qpp-u-padding--48">
66
89
  <MenuButton state={menu}>Test</MenuButton>
67
90
  <Menu state={menu}>
68
91
  {maxWidthtEx.map((item, i) => (
69
- <MenuItem key={i}>{`${item.slice(0, maxContentLength)}...`}</MenuItem>
92
+ <MenuItem key={i}>
93
+ <span>{item}</span>
94
+ </MenuItem>
70
95
  ))}
71
96
  </Menu>
72
97
  </div>
@@ -74,22 +99,26 @@ export function MaxWidth() {
74
99
  }
75
100
 
76
101
  export function ItemsWithIcons() {
77
- const menu = useMenuState({ gutter: 8 });
102
+ const menu = useMenuState({ gutter: 0 });
78
103
  const maxWidthtEx = [
79
104
  'option 1',
80
105
  'very long item text 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24',
81
106
  ];
82
107
 
83
- const maxContentLengthWithIcon = 53;
84
-
85
108
  return (
86
109
  <div className="qpp-u-padding--48">
87
110
  <MenuButton state={menu}>Test</MenuButton>
88
111
  <Menu state={menu}>
89
112
  {maxWidthtEx.map((item, i) => (
90
113
  <MenuItem key={i}>
91
- <Download />
92
- {`${item.slice(0, maxContentLengthWithIcon)}...`}
114
+ <div className="qpp-c-dropdown-menu__icon">
115
+ <Download
116
+ className="qpp-icon-mat qpp-icon-inline--lg"
117
+ focusable="false"
118
+ aria-hidden="true"
119
+ />
120
+ </div>
121
+ <span>{item}</span>
93
122
  </MenuItem>
94
123
  ))}
95
124
  </Menu>
@@ -4,15 +4,8 @@ import { Menu as AriaKitMenu } from 'ariakit/menu';
4
4
 
5
5
  function Menu({ state, className, children, ...props }) {
6
6
  return (
7
- <AriaKitMenu state={state} className={className} {...props}>
8
- <div className="qpp-c-dropdown-menu__box">
9
- <ul
10
- className="qpp-c-dropdown-menu__list"
11
- style={{ maxHeight: '264px', maxWidth: '400px' }} // temp. => to Sass
12
- >
13
- {children}
14
- </ul>
15
- </div>
7
+ <AriaKitMenu as="ul" state={state} className={className} {...props}>
8
+ {children}
16
9
  </AriaKitMenu>
17
10
  );
18
11
  }
@@ -24,7 +17,8 @@ Menu.propTypes = {
24
17
  };
25
18
 
26
19
  Menu.defaultProps = {
27
- className: 'qpp-c-dropdown-menu',
20
+ className:
21
+ 'qpp-c-dropdown-menu qpp-c-dropdown-menu__box qpp-c-dropdown-menu__list',
28
22
  children: null,
29
23
  };
30
24
 
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { MenuItem as AriaKitMenuItem } from 'ariakit/menu';
4
+
5
+ function MenuItemLink({ as, className, children, ...props }) {
6
+ return (
7
+ <li role="none">
8
+ <AriaKitMenuItem as={as} className={className} {...props}>
9
+ {children}
10
+ </AriaKitMenuItem>
11
+ </li>
12
+ );
13
+ }
14
+
15
+ MenuItemLink.propTypes = {
16
+ as: PropTypes.string,
17
+ className: PropTypes.string,
18
+ children: PropTypes.node,
19
+ };
20
+
21
+ MenuItemLink.defaultProps = {
22
+ as: 'a',
23
+ className: 'qpp-c-dropdown-menu__item',
24
+ children: null,
25
+ };
26
+
27
+ export default MenuItemLink;
@@ -83,7 +83,7 @@ const getIcon = (url, linkLabel) => {
83
83
  '/reviewer/exception': HardshipIcon,
84
84
  '/reviewer/targeted-review': TargetIcon,
85
85
  '/self-nomination': IndividualReporting,
86
- '/cases/needs-review': FacilityBasedPreviewIcon,
86
+ '/case-management': FacilityBasedPreviewIcon,
87
87
  [contentMgrDashboardUrl]: AccountHomeIcon,
88
88
  'Manage Documents': ManageDocumentsIcon,
89
89
  'Author Content': AuthorContentIcon,