@zohodesk/components 1.4.21 → 1.4.22
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/README.md +29 -0
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +15 -0
- package/assets/Appearance/light/mode/Component_LightMode.module.css +15 -0
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +15 -0
- package/es/ColorSelect/ColorMultiSelect.js +38 -0
- package/es/ColorSelect/ColorSelect.module.css +3 -0
- package/es/ColorSelect/ColorSingleSelect.js +83 -0
- package/es/ColorSelect/__tests__/ColorMultiSelect.spec.js +71 -0
- package/es/ColorSelect/__tests__/ColorSingleSelect.spec.js +80 -0
- package/es/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +536 -0
- package/es/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +422 -0
- package/es/ColorSelect/_shared/ColorIndicator/ColorIndicator.js +33 -0
- package/es/ColorSelect/_shared/ColorIndicator/ColorIndicator.module.css +19 -0
- package/es/ColorSelect/_shared/ColorIndicator/__tests__/ColorIndicator.spec.js +79 -0
- package/es/ColorSelect/_shared/ColorIndicator/__tests__/__snapshots__/ColorIndicator.spec.js.snap +106 -0
- package/es/ColorSelect/_shared/ColorIndicator/props/defaultProps.js +8 -0
- package/es/ColorSelect/_shared/ColorIndicator/props/propTypes.js +10 -0
- package/es/ColorSelect/_shared/ColoredTag/ColoredTag.js +33 -0
- package/es/ColorSelect/_shared/ColoredTag/__tests__/ColoredTag.spec.js +50 -0
- package/es/ColorSelect/_shared/ColoredTag/__tests__/__snapshots__/ColoredTag.spec.js.snap +101 -0
- package/es/ColorSelect/_shared/ColoredTag/props/propTypes.js +10 -0
- package/es/ColorSelect/_shared/helpers/renderHelpers.js +43 -0
- package/es/ColorSelect/props/defaultProps.js +12 -0
- package/es/ColorSelect/props/propTypes.js +17 -0
- package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +3 -18
- package/es/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +1 -6
- package/es/DateTime/__tests__/__snapshots__/Time.spec.js.snap +3 -18
- package/es/ListItem/ListItem.js +6 -1
- package/es/ListItem/ListItem.module.css +6 -0
- package/es/ListItem/__tests__/ListItem.spec.js +8 -0
- package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +47 -0
- package/es/ListItem/props/propTypes.js +1 -0
- package/es/MultiSelect/MultiSelect.js +11 -5
- package/es/MultiSelect/SelectedOptions.js +24 -1
- package/es/MultiSelect/Suggestions.js +4 -1
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +38 -0
- package/es/MultiSelect/__tests__/SelectedOptions.spec.js +13 -0
- package/es/MultiSelect/__tests__/Suggestions.spec.js +12 -0
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +1 -3
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +3 -9
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +91 -12
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +1 -3
- package/es/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +15 -0
- package/es/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +66 -0
- package/es/MultiSelect/props/propTypes.js +6 -0
- package/es/Select/Select.js +67 -5
- package/es/Select/__tests__/Select.spec.js +10 -0
- package/es/Select/__tests__/__snapshots__/GroupSelect.spec.js.snap +1 -6
- package/es/Select/__tests__/__snapshots__/Select.spec.js.snap +111 -441
- package/es/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +1 -6
- package/es/Select/props/defaultProps.js +2 -1
- package/es/Select/props/propTypes.js +3 -1
- package/es/TextBox/__tests__/TextBox.spec.js +1 -1
- package/es/TextBoxIcon/TextBoxIcon.js +17 -12
- package/es/TextBoxIcon/TextBoxIcon.module.css +3 -38
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +9 -2
- package/es/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +78 -224
- package/es/TextBoxIcon/props/propTypes.js +1 -2
- package/es/shared/ArrowIcon/ArrowIcon.js +51 -0
- package/es/shared/ArrowIcon/ArrowIcon.module.css +43 -0
- package/es/shared/ArrowIcon/__tests__/ArrowIcon.spec.js +100 -0
- package/es/shared/ArrowIcon/__tests__/__snapshots__/ArrowIcon.spec.js.snap +221 -0
- package/es/shared/ArrowIcon/props/defaultProps.js +11 -0
- package/es/shared/ArrowIcon/props/propTypes.js +17 -0
- package/es/shared/InputFieldLine/InputFieldLine.js +45 -0
- package/es/shared/InputFieldLine/InputFieldLine.module.css +88 -0
- package/es/shared/InputFieldLine/__tests__/InputFieldLine.spec.js +114 -0
- package/es/shared/InputFieldLine/__tests__/__snapshots__/InputFieldLine.spec.js.snap +194 -0
- package/es/shared/InputFieldLine/props/defaultProps.js +16 -0
- package/es/shared/InputFieldLine/props/propTypes.js +22 -0
- package/es/utils/Common.js +3 -2
- package/es/utils/dropDownUtils.js +7 -1
- package/lib/ColorSelect/ColorMultiSelect.js +71 -0
- package/lib/ColorSelect/ColorSelect.module.css +3 -0
- package/lib/ColorSelect/ColorSingleSelect.js +111 -0
- package/lib/ColorSelect/__tests__/ColorMultiSelect.spec.js +82 -0
- package/lib/ColorSelect/__tests__/ColorSingleSelect.spec.js +91 -0
- package/lib/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +536 -0
- package/lib/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +422 -0
- package/lib/ColorSelect/_shared/ColorIndicator/ColorIndicator.js +47 -0
- package/lib/ColorSelect/_shared/ColorIndicator/ColorIndicator.module.css +19 -0
- package/lib/ColorSelect/_shared/ColorIndicator/__tests__/ColorIndicator.spec.js +86 -0
- package/lib/ColorSelect/_shared/ColorIndicator/__tests__/__snapshots__/ColorIndicator.spec.js.snap +106 -0
- package/lib/ColorSelect/_shared/ColorIndicator/props/defaultProps.js +15 -0
- package/lib/ColorSelect/_shared/ColorIndicator/props/propTypes.js +21 -0
- package/lib/ColorSelect/_shared/ColoredTag/ColoredTag.js +69 -0
- package/lib/ColorSelect/_shared/ColoredTag/__tests__/ColoredTag.spec.js +58 -0
- package/lib/ColorSelect/_shared/ColoredTag/__tests__/__snapshots__/ColoredTag.spec.js.snap +101 -0
- package/lib/ColorSelect/_shared/ColoredTag/props/propTypes.js +29 -0
- package/lib/ColorSelect/_shared/helpers/renderHelpers.js +63 -0
- package/lib/ColorSelect/props/defaultProps.js +32 -0
- package/lib/ColorSelect/props/propTypes.js +39 -0
- package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +3 -18
- package/lib/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +1 -6
- package/lib/DateTime/__tests__/__snapshots__/Time.spec.js.snap +3 -18
- package/lib/ListItem/ListItem.js +6 -1
- package/lib/ListItem/ListItem.module.css +6 -0
- package/lib/ListItem/__tests__/ListItem.spec.js +12 -4
- package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +47 -0
- package/lib/ListItem/props/propTypes.js +1 -0
- package/lib/MultiSelect/MultiSelect.js +11 -5
- package/lib/MultiSelect/SelectedOptions.js +24 -1
- package/lib/MultiSelect/Suggestions.js +5 -1
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +42 -2
- package/lib/MultiSelect/__tests__/SelectedOptions.spec.js +15 -0
- package/lib/MultiSelect/__tests__/Suggestions.spec.js +16 -2
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +1 -3
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +3 -9
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +91 -12
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +1 -3
- package/lib/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +15 -0
- package/lib/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +66 -0
- package/lib/MultiSelect/props/propTypes.js +6 -0
- package/lib/Select/Select.js +67 -4
- package/lib/Select/__tests__/Select.spec.js +12 -0
- package/lib/Select/__tests__/__snapshots__/GroupSelect.spec.js.snap +1 -6
- package/lib/Select/__tests__/__snapshots__/Select.spec.js.snap +111 -441
- package/lib/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +1 -6
- package/lib/Select/props/defaultProps.js +2 -1
- package/lib/Select/props/propTypes.js +3 -1
- package/lib/TextBox/__tests__/TextBox.spec.js +36 -36
- package/lib/TextBoxIcon/TextBoxIcon.js +18 -13
- package/lib/TextBoxIcon/TextBoxIcon.module.css +3 -38
- package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +9 -2
- package/lib/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +78 -224
- package/lib/TextBoxIcon/props/propTypes.js +1 -2
- package/lib/shared/ArrowIcon/ArrowIcon.js +65 -0
- package/lib/shared/ArrowIcon/ArrowIcon.module.css +43 -0
- package/lib/shared/ArrowIcon/__tests__/ArrowIcon.spec.js +107 -0
- package/lib/shared/ArrowIcon/__tests__/__snapshots__/ArrowIcon.spec.js.snap +221 -0
- package/lib/shared/ArrowIcon/props/defaultProps.js +18 -0
- package/lib/shared/ArrowIcon/props/propTypes.js +28 -0
- package/lib/shared/InputFieldLine/InputFieldLine.js +57 -0
- package/lib/shared/InputFieldLine/InputFieldLine.module.css +88 -0
- package/lib/shared/InputFieldLine/__tests__/InputFieldLine.spec.js +122 -0
- package/lib/shared/InputFieldLine/__tests__/__snapshots__/InputFieldLine.spec.js.snap +194 -0
- package/lib/shared/InputFieldLine/props/defaultProps.js +23 -0
- package/lib/shared/InputFieldLine/props/propTypes.js +39 -0
- package/lib/utils/Common.js +8 -4
- package/lib/utils/dropDownUtils.js +10 -1
- package/package.json +9 -7
|
@@ -40,8 +40,7 @@ export const propTypes = { ...TextBox_propTypes,
|
|
|
40
40
|
customClass: PropTypes.shape({
|
|
41
41
|
customTBoxWrap: PropTypes.string,
|
|
42
42
|
customTextBox: PropTypes.string,
|
|
43
|
-
customTBoxIcon: PropTypes.string
|
|
44
|
-
customTBoxLine: PropTypes.string
|
|
43
|
+
customTBoxIcon: PropTypes.string
|
|
45
44
|
}),
|
|
46
45
|
iconOnHover: PropTypes.bool,
|
|
47
46
|
isFocus: PropTypes.bool,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Container } from "../../Layout";
|
|
3
|
+
import Icon from '@zohodesk/icons/es/Icon';
|
|
4
|
+
import { renderNode, isRenderable } from '@zohodesk/utils';
|
|
5
|
+
import defaultProps from "./props/defaultProps";
|
|
6
|
+
import propTypes from "./props/propTypes";
|
|
7
|
+
import style from "./ArrowIcon.module.css";
|
|
8
|
+
|
|
9
|
+
const ArrowIcon = props => {
|
|
10
|
+
const {
|
|
11
|
+
dataId,
|
|
12
|
+
isRotated,
|
|
13
|
+
isActive,
|
|
14
|
+
customClass,
|
|
15
|
+
customProps,
|
|
16
|
+
tagAttributes,
|
|
17
|
+
a11yAttributes,
|
|
18
|
+
iconSize,
|
|
19
|
+
isDisabled,
|
|
20
|
+
isReadOnly,
|
|
21
|
+
renderCustomToggleIndicator
|
|
22
|
+
} = props;
|
|
23
|
+
const {
|
|
24
|
+
iconClass = '',
|
|
25
|
+
containerClass = ''
|
|
26
|
+
} = customClass;
|
|
27
|
+
return isRenderable(renderCustomToggleIndicator) ? renderNode(renderCustomToggleIndicator, {
|
|
28
|
+
isRotated,
|
|
29
|
+
isActive,
|
|
30
|
+
isReadOnly,
|
|
31
|
+
isDisabled
|
|
32
|
+
}) : /*#__PURE__*/React.createElement(Container, {
|
|
33
|
+
isInline: true,
|
|
34
|
+
isCover: false,
|
|
35
|
+
align: "both",
|
|
36
|
+
"aria-hidden": true,
|
|
37
|
+
...tagAttributes,
|
|
38
|
+
...a11yAttributes,
|
|
39
|
+
...customProps,
|
|
40
|
+
dataId: `${dataId}_downIcon`,
|
|
41
|
+
className: `${style.arrowIcon} ${isRotated ? style.rotated : ''} ${isActive ? style.active : ''} ${isDisabled ? style.disabled : ''} ${isReadOnly ? style.readonly : ''} ${containerClass}`
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
43
|
+
name: "ZD-down",
|
|
44
|
+
size: iconSize,
|
|
45
|
+
iconClass: iconClass
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
ArrowIcon.defaultProps = defaultProps;
|
|
50
|
+
ArrowIcon.propTypes = propTypes;
|
|
51
|
+
export default ArrowIcon;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.varClass {
|
|
2
|
+
--local-arrowIcon-color: var(--zdt_arrowicon_default_icon);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.arrowIcon {
|
|
6
|
+
composes: varClass;
|
|
7
|
+
color: var(--local-arrowIcon-color);
|
|
8
|
+
transition: transform var(--zd_transition3);
|
|
9
|
+
margin: 0 var(--zd_size5) ;
|
|
10
|
+
}
|
|
11
|
+
.transparentContainer .arrowIcon {
|
|
12
|
+
opacity: 0;
|
|
13
|
+
visibility: hidden;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.transparentContainer .rotated,
|
|
17
|
+
.transparentContainer:hover .arrowIcon {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
visibility: visible;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[dir=ltr] .rotated {
|
|
23
|
+
transform: rotateZ(-180deg);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[dir=rtl] .rotated {
|
|
27
|
+
transform: rotateZ(180deg);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.rotated,
|
|
31
|
+
.active,
|
|
32
|
+
.arrowContainer:hover .arrowIcon,
|
|
33
|
+
.transparentContainer:hover .arrowIcon {
|
|
34
|
+
--local-arrowIcon-color: var(--zdt_arrowicon_hover_icon);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.disabled {
|
|
38
|
+
composes: disabled from '../../common/common.module.css';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.readonly {
|
|
42
|
+
composes: curdefault from '../../common/common.module.css';
|
|
43
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import ArrowIcon from "../ArrowIcon";
|
|
4
|
+
describe('ArrowIcon', () => {
|
|
5
|
+
test('rendering the defult props', () => {
|
|
6
|
+
const {
|
|
7
|
+
asFragment
|
|
8
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, null));
|
|
9
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
test('Should be render with dataId', () => {
|
|
12
|
+
const {
|
|
13
|
+
asFragment
|
|
14
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
15
|
+
dataId: "ArrowIcon-test-dataId"
|
|
16
|
+
}));
|
|
17
|
+
expect(asFragment()).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
test('Should be render isRotated is true', () => {
|
|
20
|
+
const {
|
|
21
|
+
asFragment
|
|
22
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
23
|
+
isRotated: true
|
|
24
|
+
}));
|
|
25
|
+
expect(asFragment()).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
test('Should be render isActive is true', () => {
|
|
28
|
+
const {
|
|
29
|
+
asFragment
|
|
30
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
31
|
+
isActive: true
|
|
32
|
+
}));
|
|
33
|
+
expect(asFragment()).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
test('Should be render isDisabled is true', () => {
|
|
36
|
+
const {
|
|
37
|
+
asFragment
|
|
38
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
39
|
+
isDisabled: true
|
|
40
|
+
}));
|
|
41
|
+
expect(asFragment()).toMatchSnapshot();
|
|
42
|
+
});
|
|
43
|
+
test('Should be render isReadOnly is true', () => {
|
|
44
|
+
const {
|
|
45
|
+
asFragment
|
|
46
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
47
|
+
isReadOnly: true
|
|
48
|
+
}));
|
|
49
|
+
expect(asFragment()).toMatchSnapshot();
|
|
50
|
+
});
|
|
51
|
+
test('Should be render with customClass', () => {
|
|
52
|
+
const {
|
|
53
|
+
asFragment
|
|
54
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
55
|
+
customClass: {
|
|
56
|
+
iconClass: 'arrowIcon_iconClass',
|
|
57
|
+
containerClass: 'arrowIcon_containerClass'
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
60
|
+
expect(asFragment()).toMatchSnapshot();
|
|
61
|
+
});
|
|
62
|
+
test('Should be render with a11yAttributes', () => {
|
|
63
|
+
const {
|
|
64
|
+
asFragment
|
|
65
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
66
|
+
a11yAttributes: {
|
|
67
|
+
'data-a11y-focus': true
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
expect(asFragment()).toMatchSnapshot();
|
|
71
|
+
});
|
|
72
|
+
test('Should be render with tagAttributes', () => {
|
|
73
|
+
const {
|
|
74
|
+
asFragment
|
|
75
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
76
|
+
tagAttributes: {
|
|
77
|
+
title: 'hello here is title'
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
expect(asFragment()).toMatchSnapshot();
|
|
81
|
+
});
|
|
82
|
+
test('Should be render with customProps', () => {
|
|
83
|
+
const {
|
|
84
|
+
asFragment
|
|
85
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
86
|
+
customProps: {
|
|
87
|
+
testId: 'hereIsTestId'
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
90
|
+
expect(asFragment()).toMatchSnapshot();
|
|
91
|
+
});
|
|
92
|
+
test('Should be render with renderCustomToggleIndicator', () => {
|
|
93
|
+
const {
|
|
94
|
+
asFragment
|
|
95
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
96
|
+
renderCustomToggleIndicator: /*#__PURE__*/React.createElement("div", null, "Indicator")
|
|
97
|
+
}));
|
|
98
|
+
expect(asFragment()).toMatchSnapshot();
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`ArrowIcon Should be render isActive is true 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
aria-hidden="true"
|
|
7
|
+
class="arrowIcon active inflex coldir both"
|
|
8
|
+
data-id="undefined_downIcon"
|
|
9
|
+
data-selector-id="container"
|
|
10
|
+
data-test-id="undefined_downIcon"
|
|
11
|
+
>
|
|
12
|
+
<i
|
|
13
|
+
aria-hidden="true"
|
|
14
|
+
class="zd_font_icons basic icon-down "
|
|
15
|
+
data-id="fontIcon"
|
|
16
|
+
data-selector-id="fontIcon"
|
|
17
|
+
data-test-id="fontIcon"
|
|
18
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</DocumentFragment>
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
exports[`ArrowIcon Should be render isDisabled is true 1`] = `
|
|
25
|
+
<DocumentFragment>
|
|
26
|
+
<div
|
|
27
|
+
aria-hidden="true"
|
|
28
|
+
class="arrowIcon disabled inflex coldir both"
|
|
29
|
+
data-id="undefined_downIcon"
|
|
30
|
+
data-selector-id="container"
|
|
31
|
+
data-test-id="undefined_downIcon"
|
|
32
|
+
>
|
|
33
|
+
<i
|
|
34
|
+
aria-hidden="true"
|
|
35
|
+
class="zd_font_icons basic icon-down "
|
|
36
|
+
data-id="fontIcon"
|
|
37
|
+
data-selector-id="fontIcon"
|
|
38
|
+
data-test-id="fontIcon"
|
|
39
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
</DocumentFragment>
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
exports[`ArrowIcon Should be render isReadOnly is true 1`] = `
|
|
46
|
+
<DocumentFragment>
|
|
47
|
+
<div
|
|
48
|
+
aria-hidden="true"
|
|
49
|
+
class="arrowIcon readonly inflex coldir both"
|
|
50
|
+
data-id="undefined_downIcon"
|
|
51
|
+
data-selector-id="container"
|
|
52
|
+
data-test-id="undefined_downIcon"
|
|
53
|
+
>
|
|
54
|
+
<i
|
|
55
|
+
aria-hidden="true"
|
|
56
|
+
class="zd_font_icons basic icon-down "
|
|
57
|
+
data-id="fontIcon"
|
|
58
|
+
data-selector-id="fontIcon"
|
|
59
|
+
data-test-id="fontIcon"
|
|
60
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</DocumentFragment>
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
exports[`ArrowIcon Should be render isRotated is true 1`] = `
|
|
67
|
+
<DocumentFragment>
|
|
68
|
+
<div
|
|
69
|
+
aria-hidden="true"
|
|
70
|
+
class="arrowIcon rotated inflex coldir both"
|
|
71
|
+
data-id="undefined_downIcon"
|
|
72
|
+
data-selector-id="container"
|
|
73
|
+
data-test-id="undefined_downIcon"
|
|
74
|
+
>
|
|
75
|
+
<i
|
|
76
|
+
aria-hidden="true"
|
|
77
|
+
class="zd_font_icons basic icon-down "
|
|
78
|
+
data-id="fontIcon"
|
|
79
|
+
data-selector-id="fontIcon"
|
|
80
|
+
data-test-id="fontIcon"
|
|
81
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
</DocumentFragment>
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
exports[`ArrowIcon Should be render with a11yAttributes 1`] = `
|
|
88
|
+
<DocumentFragment>
|
|
89
|
+
<div
|
|
90
|
+
aria-hidden="true"
|
|
91
|
+
class="arrowIcon inflex coldir both"
|
|
92
|
+
data-a11y-focus="true"
|
|
93
|
+
data-id="undefined_downIcon"
|
|
94
|
+
data-selector-id="container"
|
|
95
|
+
data-test-id="undefined_downIcon"
|
|
96
|
+
>
|
|
97
|
+
<i
|
|
98
|
+
aria-hidden="true"
|
|
99
|
+
class="zd_font_icons basic icon-down "
|
|
100
|
+
data-id="fontIcon"
|
|
101
|
+
data-selector-id="fontIcon"
|
|
102
|
+
data-test-id="fontIcon"
|
|
103
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
</DocumentFragment>
|
|
107
|
+
`;
|
|
108
|
+
|
|
109
|
+
exports[`ArrowIcon Should be render with customClass 1`] = `
|
|
110
|
+
<DocumentFragment>
|
|
111
|
+
<div
|
|
112
|
+
aria-hidden="true"
|
|
113
|
+
class="arrowIcon arrowIcon_containerClass inflex coldir both"
|
|
114
|
+
data-id="undefined_downIcon"
|
|
115
|
+
data-selector-id="container"
|
|
116
|
+
data-test-id="undefined_downIcon"
|
|
117
|
+
>
|
|
118
|
+
<i
|
|
119
|
+
aria-hidden="true"
|
|
120
|
+
class="zd_font_icons basic icon-down arrowIcon_iconClass "
|
|
121
|
+
data-id="fontIcon"
|
|
122
|
+
data-selector-id="fontIcon"
|
|
123
|
+
data-test-id="fontIcon"
|
|
124
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
</DocumentFragment>
|
|
128
|
+
`;
|
|
129
|
+
|
|
130
|
+
exports[`ArrowIcon Should be render with customProps 1`] = `
|
|
131
|
+
<DocumentFragment>
|
|
132
|
+
<div
|
|
133
|
+
aria-hidden="true"
|
|
134
|
+
class="arrowIcon inflex coldir both"
|
|
135
|
+
data-id="undefined_downIcon"
|
|
136
|
+
data-selector-id="container"
|
|
137
|
+
data-test-id="hereIsTestId"
|
|
138
|
+
>
|
|
139
|
+
<i
|
|
140
|
+
aria-hidden="true"
|
|
141
|
+
class="zd_font_icons basic icon-down "
|
|
142
|
+
data-id="fontIcon"
|
|
143
|
+
data-selector-id="fontIcon"
|
|
144
|
+
data-test-id="fontIcon"
|
|
145
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
</DocumentFragment>
|
|
149
|
+
`;
|
|
150
|
+
|
|
151
|
+
exports[`ArrowIcon Should be render with dataId 1`] = `
|
|
152
|
+
<DocumentFragment>
|
|
153
|
+
<div
|
|
154
|
+
aria-hidden="true"
|
|
155
|
+
class="arrowIcon inflex coldir both"
|
|
156
|
+
data-id="ArrowIcon-test-dataId_downIcon"
|
|
157
|
+
data-selector-id="container"
|
|
158
|
+
data-test-id="ArrowIcon-test-dataId_downIcon"
|
|
159
|
+
>
|
|
160
|
+
<i
|
|
161
|
+
aria-hidden="true"
|
|
162
|
+
class="zd_font_icons basic icon-down "
|
|
163
|
+
data-id="fontIcon"
|
|
164
|
+
data-selector-id="fontIcon"
|
|
165
|
+
data-test-id="fontIcon"
|
|
166
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
167
|
+
/>
|
|
168
|
+
</div>
|
|
169
|
+
</DocumentFragment>
|
|
170
|
+
`;
|
|
171
|
+
|
|
172
|
+
exports[`ArrowIcon Should be render with renderCustomToggleIndicator 1`] = `
|
|
173
|
+
<DocumentFragment>
|
|
174
|
+
<div>
|
|
175
|
+
Indicator
|
|
176
|
+
</div>
|
|
177
|
+
</DocumentFragment>
|
|
178
|
+
`;
|
|
179
|
+
|
|
180
|
+
exports[`ArrowIcon Should be render with tagAttributes 1`] = `
|
|
181
|
+
<DocumentFragment>
|
|
182
|
+
<div
|
|
183
|
+
aria-hidden="true"
|
|
184
|
+
class="arrowIcon inflex coldir both"
|
|
185
|
+
data-id="undefined_downIcon"
|
|
186
|
+
data-selector-id="container"
|
|
187
|
+
data-test-id="undefined_downIcon"
|
|
188
|
+
title="hello here is title"
|
|
189
|
+
>
|
|
190
|
+
<i
|
|
191
|
+
aria-hidden="true"
|
|
192
|
+
class="zd_font_icons basic icon-down "
|
|
193
|
+
data-id="fontIcon"
|
|
194
|
+
data-selector-id="fontIcon"
|
|
195
|
+
data-test-id="fontIcon"
|
|
196
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
197
|
+
/>
|
|
198
|
+
</div>
|
|
199
|
+
</DocumentFragment>
|
|
200
|
+
`;
|
|
201
|
+
|
|
202
|
+
exports[`ArrowIcon rendering the defult props 1`] = `
|
|
203
|
+
<DocumentFragment>
|
|
204
|
+
<div
|
|
205
|
+
aria-hidden="true"
|
|
206
|
+
class="arrowIcon inflex coldir both"
|
|
207
|
+
data-id="undefined_downIcon"
|
|
208
|
+
data-selector-id="container"
|
|
209
|
+
data-test-id="undefined_downIcon"
|
|
210
|
+
>
|
|
211
|
+
<i
|
|
212
|
+
aria-hidden="true"
|
|
213
|
+
class="zd_font_icons basic icon-down "
|
|
214
|
+
data-id="fontIcon"
|
|
215
|
+
data-selector-id="fontIcon"
|
|
216
|
+
data-test-id="fontIcon"
|
|
217
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
218
|
+
/>
|
|
219
|
+
</div>
|
|
220
|
+
</DocumentFragment>
|
|
221
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
export default {
|
|
3
|
+
dataId: PropTypes.string,
|
|
4
|
+
isRotated: PropTypes.bool,
|
|
5
|
+
customClass: PropTypes.shape({
|
|
6
|
+
iconClass: PropTypes.string,
|
|
7
|
+
containerClass: PropTypes.string
|
|
8
|
+
}),
|
|
9
|
+
customProps: PropTypes.object,
|
|
10
|
+
tagAttributes: PropTypes.object,
|
|
11
|
+
a11yAttributes: PropTypes.object,
|
|
12
|
+
renderCustomToggleIndicator: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
13
|
+
isDisabled: PropTypes.bool,
|
|
14
|
+
isReadOnly: PropTypes.bool,
|
|
15
|
+
isActive: PropTypes.bool,
|
|
16
|
+
iconSize: PropTypes.string
|
|
17
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import propTypes from "./props/propTypes";
|
|
3
|
+
import defaultProps from "./props/defaultProps";
|
|
4
|
+
import Container from "../../Layout/Container";
|
|
5
|
+
import style from "./InputFieldLine.module.css";
|
|
6
|
+
|
|
7
|
+
function InputFieldLine(props) {
|
|
8
|
+
const {
|
|
9
|
+
isDisabled,
|
|
10
|
+
isReadOnly,
|
|
11
|
+
hasPadding,
|
|
12
|
+
hasEffect,
|
|
13
|
+
title,
|
|
14
|
+
isActive,
|
|
15
|
+
size,
|
|
16
|
+
border,
|
|
17
|
+
borderColor,
|
|
18
|
+
dataId,
|
|
19
|
+
onClick,
|
|
20
|
+
customProps,
|
|
21
|
+
customClass,
|
|
22
|
+
children,
|
|
23
|
+
onKeyDown,
|
|
24
|
+
a11yAttributes,
|
|
25
|
+
tagAttributes
|
|
26
|
+
} = props;
|
|
27
|
+
const borderClass = style[`border_${border}`] || '';
|
|
28
|
+
const borderColorClass = style[`borderColor_${borderColor}`] || '';
|
|
29
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
30
|
+
alignBox: "row",
|
|
31
|
+
isCover: false,
|
|
32
|
+
...tagAttributes,
|
|
33
|
+
...a11yAttributes,
|
|
34
|
+
...customProps,
|
|
35
|
+
"data-title": title,
|
|
36
|
+
dataId: dataId,
|
|
37
|
+
onClick: onClick,
|
|
38
|
+
onKeyDown: onKeyDown,
|
|
39
|
+
className: `${style.varClass} ${style.customContainer} ${hasPadding ? style[size] : ''} ${borderClass} ${isDisabled ? style.disabled : isReadOnly ? hasEffect ? style.effect : style.readonly : style.effect} ${border !== 'none' ? `${borderColorClass} ${style.hasBorder}` : ''} ${isActive && !(isDisabled || isReadOnly) ? style.active : ''} ${customClass}`
|
|
40
|
+
}, children);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
InputFieldLine.propTypes = propTypes;
|
|
44
|
+
InputFieldLine.defaultProps = defaultProps;
|
|
45
|
+
export default InputFieldLine;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
.varClass {
|
|
2
|
+
--local_inputFieldLine_border_color: var(--zdt_inputField_default_border);
|
|
3
|
+
--local_inputFieldLine_border_width: 1px;
|
|
4
|
+
--local_padding: var(--zd_size0);
|
|
5
|
+
--local_cursor: pointer;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.customContainer {
|
|
9
|
+
composes: oflowy from '../../common/common.module.css';
|
|
10
|
+
cursor: var(--local_cursor);
|
|
11
|
+
border-color: var(--local_inputFieldLine_border_color);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.disabled,.readonly {
|
|
15
|
+
--local_cursor: not-allowed;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.borderColor_default {
|
|
19
|
+
--local_inputFieldLine_border_color: var(--zdt_inputField_default_border);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.borderColor_transparent {
|
|
23
|
+
--local_inputFieldLine_border_color: var(--dot_mirror);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.borderColor_dark {
|
|
27
|
+
--local_inputFieldLine_border_color: var(--zdt_inputField_dark_border);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.borderColor_error,
|
|
31
|
+
.effect.borderColor_error:hover {
|
|
32
|
+
--local_inputFieldLine_border_color: var(--zdt_inputField_error_border);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.effect.borderColor_transparent:hover,
|
|
36
|
+
.effect.borderColor_default:hover {
|
|
37
|
+
--local_inputFieldLine_border_color: var(--zdt_inputField_hover_border);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.active.borderColor_dark,
|
|
41
|
+
.active.borderColor_dark:hover,
|
|
42
|
+
.effect.borderColor_dark:hover {
|
|
43
|
+
--local_inputFieldLine_border_color: var(--zdt_inputField_dark_active_border);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.active.borderColor_error,
|
|
47
|
+
.active.borderColor_error:hover,
|
|
48
|
+
.active.borderColor_default,
|
|
49
|
+
.active.borderColor_default:hover,
|
|
50
|
+
.active.borderColor_transparent,
|
|
51
|
+
.active.borderColor_transparent:hover {
|
|
52
|
+
--local_inputFieldLine_border_color: var(--zdt_inputField_focus_border);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.hasBorder {
|
|
56
|
+
transition: border var(--zd_transition2) linear 0s;
|
|
57
|
+
border-style: solid;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.xmedium {
|
|
61
|
+
min-height: var(--zd_size30) ;
|
|
62
|
+
--local_padding: var(--zd_size3);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.small {
|
|
66
|
+
max-height: var(--zd_size200) ;
|
|
67
|
+
--local_padding: var(--zd_size3);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.medium {
|
|
71
|
+
max-height: var(--zd_size350) ;
|
|
72
|
+
--local_padding: var(--zd_size8);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.large {
|
|
76
|
+
max-height: var(--zd_size400) ;
|
|
77
|
+
--local_padding: var(--zd_size8);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.border_bottom {
|
|
81
|
+
border-width: 0 0 var(--local_inputFieldLine_border_width) 0;
|
|
82
|
+
padding-bottom: var(--local_padding);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.border_all {
|
|
86
|
+
border-width: var(--local_inputFieldLine_border_width);
|
|
87
|
+
padding: var(--local_padding);
|
|
88
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import InputFieldLine from "../InputFieldLine";
|
|
4
|
+
describe('InputFieldLine', () => {
|
|
5
|
+
test('rendering the defult props', () => {
|
|
6
|
+
const {
|
|
7
|
+
asFragment
|
|
8
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, null));
|
|
9
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
test('Should be render with title', () => {
|
|
12
|
+
const {
|
|
13
|
+
asFragment
|
|
14
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, {
|
|
15
|
+
title: "InputFieldLine Test Title"
|
|
16
|
+
}));
|
|
17
|
+
expect(asFragment()).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
test('Should be render isActive is true', () => {
|
|
20
|
+
const {
|
|
21
|
+
asFragment
|
|
22
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, {
|
|
23
|
+
isActive: true
|
|
24
|
+
}));
|
|
25
|
+
expect(asFragment()).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
test('Should be render isDisabled is true', () => {
|
|
28
|
+
const {
|
|
29
|
+
asFragment
|
|
30
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, {
|
|
31
|
+
isDisabled: true
|
|
32
|
+
}));
|
|
33
|
+
expect(asFragment()).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
test('Should be render isReadOnly is true', () => {
|
|
36
|
+
const {
|
|
37
|
+
asFragment
|
|
38
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, {
|
|
39
|
+
isReadOnly: true
|
|
40
|
+
}));
|
|
41
|
+
expect(asFragment()).toMatchSnapshot();
|
|
42
|
+
});
|
|
43
|
+
test('Should be render hasPadding is true', () => {
|
|
44
|
+
const {
|
|
45
|
+
asFragment
|
|
46
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, {
|
|
47
|
+
hasPadding: true
|
|
48
|
+
}));
|
|
49
|
+
expect(asFragment()).toMatchSnapshot();
|
|
50
|
+
});
|
|
51
|
+
test('Should be render hasEffect is false', () => {
|
|
52
|
+
const {
|
|
53
|
+
asFragment
|
|
54
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, {
|
|
55
|
+
hasEffect: false
|
|
56
|
+
}));
|
|
57
|
+
expect(asFragment()).toMatchSnapshot();
|
|
58
|
+
});
|
|
59
|
+
const size = ['medium', 'xmedium'];
|
|
60
|
+
test.each(size)('Should render size - %s', size => {
|
|
61
|
+
const {
|
|
62
|
+
asFragment
|
|
63
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, {
|
|
64
|
+
hasPadding: true,
|
|
65
|
+
size: size
|
|
66
|
+
}));
|
|
67
|
+
expect(asFragment()).toMatchSnapshot();
|
|
68
|
+
});
|
|
69
|
+
const border = ['bottom', 'all', 'none'];
|
|
70
|
+
test.each(border)('Should render border - %s', border => {
|
|
71
|
+
const {
|
|
72
|
+
asFragment
|
|
73
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, {
|
|
74
|
+
border: border
|
|
75
|
+
}));
|
|
76
|
+
expect(asFragment()).toMatchSnapshot();
|
|
77
|
+
});
|
|
78
|
+
const borderColor = ['default', 'dark', 'error', 'transparent'];
|
|
79
|
+
test.each(borderColor)('Should render borderColor - %s', borderColor => {
|
|
80
|
+
const {
|
|
81
|
+
asFragment
|
|
82
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, {
|
|
83
|
+
borderColor: borderColor
|
|
84
|
+
}));
|
|
85
|
+
expect(asFragment()).toMatchSnapshot();
|
|
86
|
+
});
|
|
87
|
+
test('Should render customProps', () => {
|
|
88
|
+
const customProps = {
|
|
89
|
+
'data-test': 'inputFieldLine-test'
|
|
90
|
+
};
|
|
91
|
+
const {
|
|
92
|
+
asFragment
|
|
93
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, {
|
|
94
|
+
customProps: customProps
|
|
95
|
+
}));
|
|
96
|
+
expect(asFragment()).toMatchSnapshot();
|
|
97
|
+
});
|
|
98
|
+
test('Should render customClass', () => {
|
|
99
|
+
const {
|
|
100
|
+
asFragment
|
|
101
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, {
|
|
102
|
+
customClass: "inputFieldLine-custom-class"
|
|
103
|
+
}));
|
|
104
|
+
expect(asFragment()).toMatchSnapshot();
|
|
105
|
+
});
|
|
106
|
+
test('Should render dataId', () => {
|
|
107
|
+
const {
|
|
108
|
+
asFragment
|
|
109
|
+
} = render( /*#__PURE__*/React.createElement(InputFieldLine, {
|
|
110
|
+
dataId: "inputFieldLine-test-id"
|
|
111
|
+
}));
|
|
112
|
+
expect(asFragment()).toMatchSnapshot();
|
|
113
|
+
});
|
|
114
|
+
});
|