qpp-style 9.6.13 → 9.7.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/components/Dropdown/Dropdown.stories.js +94 -0
- package/components/Dropdown/index.js +85 -0
- package/components/index.js +2 -0
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components/_footer.scss +593 -0
- package/styles/components/_header.scss +890 -0
- package/styles/components/_sidebar.scss +8 -0
- package/styles/components/sidebar/_animations.scss +38 -0
- package/styles/components/sidebar/_cms.scss +61 -0
- package/styles/components/sidebar/_details.scss +58 -0
- package/styles/components/sidebar/_links.scss +415 -0
- package/styles/components/sidebar/_sidebar-animation.scss +121 -0
- package/styles/components/sidebar/_sidebar-tooltip.scss +33 -0
- package/styles/components/sidebar/_sidebar.scss +141 -0
- package/styles/components/sidebar/project-specific/_wi.scss +42 -0
- package/styles/qppds/components/_dropdown.scss +4 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Dropdown from './index';
|
|
3
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Dropdown',
|
|
7
|
+
component: Dropdown,
|
|
8
|
+
decorators: [withKnobs],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const DropdownField = () => (
|
|
12
|
+
<Dropdown
|
|
13
|
+
id="id-example"
|
|
14
|
+
value="value-example"
|
|
15
|
+
name="name-example"
|
|
16
|
+
ariaLabel="arial label example"
|
|
17
|
+
options={[
|
|
18
|
+
{ name: 'Name 1', value: 'Value 1' },
|
|
19
|
+
{ name: 'Name 2', value: 'Value 2' },
|
|
20
|
+
{ name: 'Name 3', value: 'Value 3' },
|
|
21
|
+
]}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const DropdownFieldAutoWidth = () => (
|
|
26
|
+
<Dropdown
|
|
27
|
+
id="id-example"
|
|
28
|
+
value="value-example"
|
|
29
|
+
name="name-example"
|
|
30
|
+
ariaLabel="arial label example"
|
|
31
|
+
className="qpp-u-width--auto"
|
|
32
|
+
options={[
|
|
33
|
+
{ name: 'Name 1', value: 'Value 1' },
|
|
34
|
+
{ name: 'Name 2', value: 'Value 2' },
|
|
35
|
+
{ name: 'Name 3', value: 'Value 3' },
|
|
36
|
+
]}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export const DisabledDropdown = () => (
|
|
41
|
+
<Dropdown
|
|
42
|
+
disabled
|
|
43
|
+
id="id-example"
|
|
44
|
+
value="value-example"
|
|
45
|
+
name="name-example"
|
|
46
|
+
ariaLabel="arial label example"
|
|
47
|
+
options={[
|
|
48
|
+
{ name: 'Name 1', value: 'Value 1' },
|
|
49
|
+
{ name: 'Name 2', value: 'Value 2' },
|
|
50
|
+
{ name: 'Name 3', value: 'Value 3' },
|
|
51
|
+
]}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
export const DropdownBigVariant = () => (
|
|
56
|
+
<Dropdown
|
|
57
|
+
id="id-example"
|
|
58
|
+
value="value-example"
|
|
59
|
+
name="name-example"
|
|
60
|
+
ariaLabel="arial label example"
|
|
61
|
+
size="big"
|
|
62
|
+
options={[
|
|
63
|
+
{ name: 'Name 1', value: 'Value 1' },
|
|
64
|
+
{ name: 'Name 2', value: 'Value 2' },
|
|
65
|
+
{ name: 'Name 3', value: 'Value 3' },
|
|
66
|
+
]}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
export const DropdownWithDisabledOption = () => (
|
|
71
|
+
<Dropdown
|
|
72
|
+
id="id-example"
|
|
73
|
+
value="value-example"
|
|
74
|
+
name="name-example"
|
|
75
|
+
ariaLabel="arial label example"
|
|
76
|
+
options={[
|
|
77
|
+
{ disabled: true, name: 'Select Category', value: 'default' },
|
|
78
|
+
{ name: 'Name 1', value: 'Value 1' },
|
|
79
|
+
{ name: 'Name 2', value: 'Value 2' },
|
|
80
|
+
]}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
export const DropdownUsingChildrenProp = () => (
|
|
85
|
+
<Dropdown
|
|
86
|
+
id="id-example"
|
|
87
|
+
value="value-example"
|
|
88
|
+
name="name-example"
|
|
89
|
+
ariaLabel="arial label example"
|
|
90
|
+
>
|
|
91
|
+
<option value="Value 1">Name 1</option>
|
|
92
|
+
<option value="Value 2">Name 2</option>
|
|
93
|
+
</Dropdown>
|
|
94
|
+
);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
const Dropdown = ({
|
|
5
|
+
className,
|
|
6
|
+
id,
|
|
7
|
+
ariaLabelledBy,
|
|
8
|
+
ariaLabel,
|
|
9
|
+
onChange,
|
|
10
|
+
dataTestId,
|
|
11
|
+
name,
|
|
12
|
+
dataType,
|
|
13
|
+
disabled,
|
|
14
|
+
size,
|
|
15
|
+
options,
|
|
16
|
+
children,
|
|
17
|
+
parentElement,
|
|
18
|
+
...rest
|
|
19
|
+
}) => {
|
|
20
|
+
const dropdownClass = [
|
|
21
|
+
'qpp-c-dropdown',
|
|
22
|
+
size === 'big' && 'qpp-c-dropdown--big',
|
|
23
|
+
className,
|
|
24
|
+
]
|
|
25
|
+
.filter(Boolean)
|
|
26
|
+
.join(' ');
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<select
|
|
30
|
+
id={id}
|
|
31
|
+
aria-labelledby={ariaLabelledBy}
|
|
32
|
+
aria-label={ariaLabel}
|
|
33
|
+
className={dropdownClass || ''}
|
|
34
|
+
onChange={onChange}
|
|
35
|
+
data-testid={dataTestId}
|
|
36
|
+
name={name}
|
|
37
|
+
disabled={disabled}
|
|
38
|
+
data-type={dataType}
|
|
39
|
+
{...rest}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
{options.map(({ disabled, name, value }) => (
|
|
43
|
+
<option disabled={disabled} key={value} value={value}>
|
|
44
|
+
{name}
|
|
45
|
+
</option>
|
|
46
|
+
))}
|
|
47
|
+
</select>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
Dropdown.propTypes = {
|
|
52
|
+
children: PropTypes.node,
|
|
53
|
+
className: PropTypes.string,
|
|
54
|
+
id: PropTypes.string,
|
|
55
|
+
ariaLabelledBy: PropTypes.string,
|
|
56
|
+
ariaLabel: PropTypes.string,
|
|
57
|
+
onChange: PropTypes.func,
|
|
58
|
+
value: PropTypes.string,
|
|
59
|
+
defaultValue: PropTypes.string,
|
|
60
|
+
dataTestId: PropTypes.string,
|
|
61
|
+
name: PropTypes.string,
|
|
62
|
+
dataType: PropTypes.string,
|
|
63
|
+
disabled: PropTypes.bool,
|
|
64
|
+
size: PropTypes.oneOf(['big']),
|
|
65
|
+
options: PropTypes.array,
|
|
66
|
+
parentElement: PropTypes.string,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
Dropdown.defaultProps = {
|
|
70
|
+
children: false,
|
|
71
|
+
className: 'qpp-u-width--100',
|
|
72
|
+
id: null,
|
|
73
|
+
ariaLabelledBy: null,
|
|
74
|
+
ariaLabel: null,
|
|
75
|
+
onChange: () => null,
|
|
76
|
+
dataTestId: null,
|
|
77
|
+
name: null,
|
|
78
|
+
dataType: null,
|
|
79
|
+
disabled: false,
|
|
80
|
+
size: null,
|
|
81
|
+
options: [],
|
|
82
|
+
parentElement: 'span',
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default Dropdown;
|
package/components/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import Tooltip from './Tooltip';
|
|
|
16
16
|
import Infotip from './Infotip';
|
|
17
17
|
import Search from './Search';
|
|
18
18
|
import TextInput from './TextInput';
|
|
19
|
+
import Dropdown from './Dropdown';
|
|
19
20
|
import {
|
|
20
21
|
MyApplicationsIcon,
|
|
21
22
|
UserSignInIcon,
|
|
@@ -118,5 +119,6 @@ export {
|
|
|
118
119
|
Tabs,
|
|
119
120
|
TextButton,
|
|
120
121
|
TextInput,
|
|
122
|
+
Dropdown,
|
|
121
123
|
Tooltip,
|
|
122
124
|
};
|