qpp-style 9.25.2-beta.1 → 9.25.2-beta.2
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/components/Footer/FooterUI.jsx +2 -3
- package/components/Header/ImpersonatorBanner.jsx +1 -2
- package/components/Infotip/Infotip.jsx +3 -7
- package/components/Infotip/InfotipContent.jsx +46 -0
- package/components/Search/index.js +2 -2
- package/components/Tabs/TabPanel.js +2 -38
- package/components/Tabs/Tabs.js +73 -0
- package/components/index.js +3 -5
- package/dist/browser.js +1 -1
- package/dist/browser.js.LICENSE.txt +0 -39
- package/dist/browser.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +0 -39
- package/dist/index.js.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.LICENSE.txt +8 -50
- package/dist/react/index.js.map +1 -1
- package/lib/SvgComponents.jsx +120 -0
- package/package.json +5 -9
- package/styles/qppds/components/_footer.scss +2 -2
- package/test/components/HeaderUI.test.js +1 -1
- package/test/components/Infotip.test.js +17 -11
- package/components/Accordion/Accordion.stories.js +0 -20
- package/components/Alert/Alert.stories.js +0 -61
- package/components/Details/Details.stories.js +0 -63
- package/components/DropdownButton/DropdownButton.stories.js +0 -127
- package/components/Tabs/Tab.js +0 -26
- package/components/Tabs/index.js +0 -100
- package/components/Tooltip/Tooltip.jsx +0 -88
- package/components/Tooltip/Tooltip.stories.js +0 -80
- package/components/Tooltip/index.js +0 -3
- package/components/Tooltip/position.js +0 -68
- package/test/components/Tooltip.test.js +0 -147
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import OpenInNewIcon from '@material-ui/icons/OpenInNew';
|
|
3
|
-
|
|
4
2
|
import InfoTip from '../Infotip/Infotip';
|
|
5
3
|
import Subscribe from './Subscribe';
|
|
6
4
|
import SocialLinks from './SocialLinks';
|
|
7
5
|
import pjson from '../../package.json';
|
|
6
|
+
import { OpenInNewIcon } from '../../lib/SvgComponents';
|
|
8
7
|
|
|
9
8
|
const infoTipLabel =
|
|
10
9
|
'When dialing 711, you will automatically be connected to a TRS Communications Assistant who will relay your conversation to the help desk agent with strict confidentiality.';
|
|
@@ -126,7 +125,7 @@ const FooterUI = () => (
|
|
|
126
125
|
rel="noopener noreferrer"
|
|
127
126
|
>
|
|
128
127
|
<strong>Create or Track a QPP Service Center Ticket</strong>
|
|
129
|
-
<OpenInNewIcon
|
|
128
|
+
<OpenInNewIcon className="ccsq-link-icon" />
|
|
130
129
|
</a>
|
|
131
130
|
</h3>
|
|
132
131
|
</div>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cookie from 'cookie';
|
|
3
3
|
import axios from 'axios';
|
|
4
|
-
import CloseIcon from '
|
|
5
|
-
|
|
4
|
+
import { CloseIcon } from '../../lib/SvgComponents';
|
|
6
5
|
import { TextButton } from '../Button';
|
|
7
6
|
import {
|
|
8
7
|
deleteImpersonatedUser,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import InfotipContent from './InfotipContent';
|
|
4
4
|
import InfotipIcon from './InfotipIcon';
|
|
5
5
|
|
|
6
6
|
const BUTTON_SIZE = '16px';
|
|
@@ -16,10 +16,6 @@ const buttonStyle = {
|
|
|
16
16
|
userSelect: 'none',
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
// Use basic touch handlers for mobile "tap-to-open" ui. Mobile touch
|
|
20
|
-
// is currently not supported by @reach/tooltip; this may change in future.
|
|
21
|
-
// Leverages @reach/tooltip "focus" behavior to open tooltip on tap,
|
|
22
|
-
// and close tooltip on second tap or loss of focus.
|
|
23
19
|
// TODO: We may want to improve this by tracking touch positions to ensure
|
|
24
20
|
// that a 'touchend' event must be reasonably close to the tooltip target.
|
|
25
21
|
const touchHandlers = {
|
|
@@ -41,7 +37,7 @@ const touchHandlers = {
|
|
|
41
37
|
* Tooltip with styled information icon
|
|
42
38
|
*/
|
|
43
39
|
const Infotip = ({ ariaLabel, label, lightIcon, ...props }) => (
|
|
44
|
-
<
|
|
40
|
+
<InfotipContent label={label} {...props}>
|
|
45
41
|
<button
|
|
46
42
|
type="button"
|
|
47
43
|
aria-label={ariaLabel}
|
|
@@ -56,7 +52,7 @@ const Infotip = ({ ariaLabel, label, lightIcon, ...props }) => (
|
|
|
56
52
|
style={{ float: 'left' }}
|
|
57
53
|
/>
|
|
58
54
|
</button>
|
|
59
|
-
</
|
|
55
|
+
</InfotipContent>
|
|
60
56
|
);
|
|
61
57
|
|
|
62
58
|
Infotip.propTypes = {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import {
|
|
4
|
+
Tooltip as TooltipAriaKit,
|
|
5
|
+
TooltipAnchor,
|
|
6
|
+
TooltipArrow,
|
|
7
|
+
useTooltipState,
|
|
8
|
+
} from 'ariakit/tooltip';
|
|
9
|
+
|
|
10
|
+
const TEXT_COLOR = '#FFF';
|
|
11
|
+
const BACKGROUND_COLOR = '#333';
|
|
12
|
+
|
|
13
|
+
const InfotipContent = ({ children, label }) => {
|
|
14
|
+
const tooltip = useTooltipState();
|
|
15
|
+
|
|
16
|
+
const cssStyles = {
|
|
17
|
+
maxWidth: '300px',
|
|
18
|
+
padding: '8px',
|
|
19
|
+
borderRadius: '4px',
|
|
20
|
+
fontSize: '0.9rem',
|
|
21
|
+
backgroundColor: BACKGROUND_COLOR,
|
|
22
|
+
color: TEXT_COLOR,
|
|
23
|
+
};
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<TooltipAnchor as={'span'} state={tooltip} className="tooltip-anchor">
|
|
27
|
+
{children}
|
|
28
|
+
</TooltipAnchor>
|
|
29
|
+
<TooltipAriaKit
|
|
30
|
+
state={tooltip}
|
|
31
|
+
className="tooltip-content"
|
|
32
|
+
style={cssStyles}
|
|
33
|
+
>
|
|
34
|
+
{label}
|
|
35
|
+
<TooltipArrow />
|
|
36
|
+
</TooltipAriaKit>
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
InfotipContent.propTypes = {
|
|
42
|
+
children: PropTypes.node.isRequired,
|
|
43
|
+
label: PropTypes.node.isRequired,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default InfotipContent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import SearchIcon from '
|
|
3
|
+
import { SearchIcon } from '../../lib/SvgComponents';
|
|
4
4
|
|
|
5
5
|
const Search = ({
|
|
6
6
|
id,
|
|
@@ -55,7 +55,7 @@ const Search = ({
|
|
|
55
55
|
className="qpp-c-search__submit qpp-c-button qpp-c-button--text"
|
|
56
56
|
>
|
|
57
57
|
<span className="qpp-u-visually-hidden">Search</span>
|
|
58
|
-
<SearchIcon
|
|
58
|
+
<SearchIcon viewBox="0 0 45 50" />
|
|
59
59
|
</button>
|
|
60
60
|
</div>
|
|
61
61
|
</form>
|
|
@@ -1,41 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const TabPanel = ({
|
|
5
|
-
children,
|
|
6
|
-
value,
|
|
7
|
-
id,
|
|
8
|
-
index,
|
|
9
|
-
className,
|
|
10
|
-
disabled,
|
|
11
|
-
}) => {
|
|
12
|
-
const classes = ['qpp-c-tabs__panel', className].filter(Boolean).join(' ');
|
|
13
|
-
return (
|
|
14
|
-
<div
|
|
15
|
-
role="tabpanel"
|
|
16
|
-
id={id}
|
|
17
|
-
aria-hidden={value !== index}
|
|
18
|
-
aria-labelledby={`qpp-c-tabs__item--${id}`}
|
|
19
|
-
aria-disabled={disabled}
|
|
20
|
-
className={classes}
|
|
21
|
-
>
|
|
22
|
-
{value === index && children}
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
TabPanel.propTypes = {
|
|
28
|
-
children: PropTypes.node,
|
|
29
|
-
className: PropTypes.string,
|
|
30
|
-
index: PropTypes.number.isRequired,
|
|
31
|
-
id: PropTypes.string,
|
|
32
|
-
value: PropTypes.number.isRequired,
|
|
33
|
-
disabled: PropTypes.bool,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
TabPanel.defaultProps = {
|
|
37
|
-
index: 0,
|
|
38
|
-
value: 0,
|
|
1
|
+
const TabPanel = ({ children }) => {
|
|
2
|
+
return children;
|
|
39
3
|
};
|
|
40
4
|
|
|
41
5
|
export default TabPanel;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React, { Children } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { TabList, Tab, TabPanel, useTabState } from 'ariakit/tab';
|
|
4
|
+
|
|
5
|
+
function Tabs({ defaultSelectedId, children, onChange, selected }) {
|
|
6
|
+
const tab = useTabState({
|
|
7
|
+
defaultSelectedId: selected ?? defaultSelectedId,
|
|
8
|
+
selectOnMove: false,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const onTabClick = (tabHref, id) => {
|
|
12
|
+
if (tabHref) {
|
|
13
|
+
const currentUrl = new URL(window.location.href);
|
|
14
|
+
const newParams = new URLSearchParams(tabHref);
|
|
15
|
+
newParams.forEach((value, key) => {
|
|
16
|
+
currentUrl.searchParams.set(key, value);
|
|
17
|
+
});
|
|
18
|
+
window.history.replaceState(null, '', currentUrl);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (onChange) {
|
|
22
|
+
onChange(id);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<div className="qpp-c-tabs qpp-c-tabs--mui">
|
|
29
|
+
<TabList state={tab} aria-label="qpp tabs">
|
|
30
|
+
{Children.map(children, (child) => (
|
|
31
|
+
<Tab
|
|
32
|
+
key={child.props.id}
|
|
33
|
+
id={child.props.id}
|
|
34
|
+
className="qpp-c-tabs__item"
|
|
35
|
+
disabled={child.props.disabled}
|
|
36
|
+
onClick={() => onTabClick(child.props.tabHref, child.props.id)}
|
|
37
|
+
>
|
|
38
|
+
{child.props.tab}
|
|
39
|
+
</Tab>
|
|
40
|
+
))}
|
|
41
|
+
</TabList>
|
|
42
|
+
</div>
|
|
43
|
+
<div className="qpp-c-tabs__panel">
|
|
44
|
+
{Children.map(children, (child) => (
|
|
45
|
+
<TabPanel
|
|
46
|
+
key={child.props.id}
|
|
47
|
+
state={tab}
|
|
48
|
+
tabId={child.props.id}
|
|
49
|
+
className={child.props.className}
|
|
50
|
+
disabled={child.props.disabled}
|
|
51
|
+
>
|
|
52
|
+
{child.props.children}
|
|
53
|
+
</TabPanel>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
Tabs.propTypes = {
|
|
61
|
+
defaultSelectedId: PropTypes.string,
|
|
62
|
+
children: PropTypes.node.isRequired,
|
|
63
|
+
onChange: PropTypes.func,
|
|
64
|
+
selected: PropTypes.string,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
Tabs.defaultProps = {
|
|
68
|
+
defaultSelectedId: undefined,
|
|
69
|
+
onChange: undefined,
|
|
70
|
+
selected: undefined,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default Tabs;
|
package/components/index.js
CHANGED
|
@@ -9,14 +9,13 @@ import Footer from './Footer/FooterUI';
|
|
|
9
9
|
import Header from './Header/HeaderUI';
|
|
10
10
|
import Modal from './Modal';
|
|
11
11
|
import SideNav from './SideNav/UI/SideNavUI';
|
|
12
|
+
import Tabs from './Tabs/Tabs';
|
|
12
13
|
import TabPanel from './Tabs/TabPanel';
|
|
13
|
-
import Tabs from './Tabs/index';
|
|
14
|
-
import Tooltip from './Tooltip';
|
|
15
14
|
import Infotip from './Infotip';
|
|
16
15
|
import Search from './Search';
|
|
17
16
|
import TextInput from './TextInput';
|
|
18
17
|
import Dropdown from './Dropdown';
|
|
19
|
-
import Details from './Details';
|
|
18
|
+
import Details from './Details/index';
|
|
20
19
|
import DSLink from './Link';
|
|
21
20
|
import {
|
|
22
21
|
MyApplicationsIcon,
|
|
@@ -117,12 +116,11 @@ export {
|
|
|
117
116
|
Modal,
|
|
118
117
|
Search,
|
|
119
118
|
SideNav,
|
|
120
|
-
TabPanel,
|
|
121
119
|
Tabs,
|
|
120
|
+
TabPanel,
|
|
122
121
|
TextButton,
|
|
123
122
|
TextInput,
|
|
124
123
|
Dropdown,
|
|
125
124
|
Details,
|
|
126
|
-
Tooltip,
|
|
127
125
|
DSLink,
|
|
128
126
|
};
|