@zohodesk/components 1.6.27 → 1.6.29

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 (142) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/es/Avatar/Avatar.module.css +5 -11
  3. package/es/AvatarTeam/AvatarTeam.module.css +1 -3
  4. package/es/Button/css/Button.module.css +7 -9
  5. package/es/Card/Card.module.css +2 -2
  6. package/es/CheckBox/CheckBox.module.css +2 -4
  7. package/es/DateTime/DateTime.module.css +13 -20
  8. package/es/DateTime/DateWidget.module.css +7 -5
  9. package/es/DateTime/YearView.module.css +6 -9
  10. package/es/DividerLine/DividerLine.js +40 -0
  11. package/es/DividerLine/__tests__/DividerLine.spec.js +81 -0
  12. package/es/DividerLine/__tests__/__snapshots__/DividerLine.spec.js.snap +131 -0
  13. package/es/DividerLine/constants/index.js +29 -0
  14. package/es/DividerLine/css/DividerLine.module.css +52 -0
  15. package/es/DividerLine/css/cssJSLogic.js +1 -0
  16. package/es/DividerLine/css/dividerLine.cva.js +42 -0
  17. package/es/DividerLine/props/defaultProps.js +11 -0
  18. package/es/DividerLine/props/propTypes.js +19 -0
  19. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +6 -7
  20. package/es/DropBox/css/DropBox.module.css +3 -3
  21. package/es/DropDown/DropDownHeading.module.css +1 -1
  22. package/es/DropDown/DropDownItem.module.css +3 -7
  23. package/es/DropDown/DropDownSeparator.js +9 -4
  24. package/es/DropDown/DropDownSeparator.module.css +0 -4
  25. package/es/DropDown/__tests__/DropDownSeparator.spec.js +8 -0
  26. package/es/DropDown/__tests__/__snapshots__/DropDownSeparator.spec.js.snap +12 -2
  27. package/es/Label/Label.module.css +3 -3
  28. package/es/ListItem/ListItem.module.css +9 -12
  29. package/es/MultiSelect/AdvancedGroupMultiSelect.js +1 -0
  30. package/es/MultiSelect/AdvancedMultiSelect.js +1 -0
  31. package/es/MultiSelect/MobileHeader/MobileHeader.module.css +1 -1
  32. package/es/MultiSelect/MultiSelect.module.css +13 -20
  33. package/es/MultiSelect/SelectedOptions.js +3 -3
  34. package/es/MultiSelect/SelectedOptions.module.css +1 -1
  35. package/es/MultiSelect/__tests__/AdvancedGroupMultiSelect.spec.js +42 -0
  36. package/es/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +10 -0
  37. package/es/MultiSelect/__tests__/MultiSelect.spec.js +10 -0
  38. package/es/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +121 -0
  39. package/es/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +97 -0
  40. package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +157 -0
  41. package/es/PopOver/PopOver.module.css +2 -2
  42. package/es/Radio/Radio.module.css +7 -7
  43. package/es/Ribbon/Ribbon.module.css +12 -19
  44. package/es/RippleEffect/RippleEffect.module.css +2 -2
  45. package/es/Select/Select.module.css +4 -4
  46. package/es/Select/SelectWithAvatar.js +14 -3
  47. package/es/Select/SelectWithIcon.js +23 -1
  48. package/es/Select/__tests__/SelectWithAvatar.spec.js +17 -0
  49. package/es/Select/__tests__/SelectWithIcon.spec.js +18 -0
  50. package/es/Select/__tests__/__snapshots__/SelectWithAvatar.spec.js.snap +47 -0
  51. package/es/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +19 -0
  52. package/es/Select/props/propTypes.js +1 -0
  53. package/es/Switch/Switch.module.css +4 -7
  54. package/es/Tab/Tab.module.css +5 -7
  55. package/es/Tab/TabContent.module.css +1 -1
  56. package/es/Tab/Tabs.module.css +8 -9
  57. package/es/Tag/Tag.module.css +4 -7
  58. package/es/TextBoxIcon/TextBoxIcon.module.css +1 -1
  59. package/es/Textarea/Textarea.module.css +3 -4
  60. package/es/Tooltip/Tooltip.js +4 -1
  61. package/es/Tooltip/Tooltip.module.css +2 -5
  62. package/es/Typography/css/Typography.module.css +24 -32
  63. package/es/common/animation.module.css +8 -8
  64. package/es/common/common.module.css +79 -147
  65. package/es/semantic/Button/semanticButton.module.css +1 -4
  66. package/es/shared/InputFieldLine/InputFieldLine.module.css +1 -1
  67. package/es/v1/Button/css/Button_v1.module.css +2 -2
  68. package/es/v1/Label/css/Label_v1.module.css +1 -1
  69. package/es/v1/Switch/css/Switch_v1.module.css +4 -7
  70. package/es/v1/shared/Spinner/Spinner_v1.module.css +3 -5
  71. package/es/v1/shared/SuccessTick/SuccessTick_v1.module.css +1 -2
  72. package/lib/Avatar/Avatar.module.css +5 -11
  73. package/lib/AvatarTeam/AvatarTeam.module.css +1 -3
  74. package/lib/Button/css/Button.module.css +7 -9
  75. package/lib/Card/Card.module.css +2 -2
  76. package/lib/CheckBox/CheckBox.module.css +2 -4
  77. package/lib/DateTime/DateTime.module.css +13 -20
  78. package/lib/DateTime/DateWidget.module.css +7 -5
  79. package/lib/DateTime/YearView.module.css +6 -9
  80. package/lib/DividerLine/DividerLine.js +50 -0
  81. package/lib/DividerLine/__tests__/DividerLine.spec.js +88 -0
  82. package/lib/DividerLine/__tests__/__snapshots__/DividerLine.spec.js.snap +131 -0
  83. package/lib/DividerLine/constants/index.js +39 -0
  84. package/lib/DividerLine/css/DividerLine.module.css +52 -0
  85. package/lib/DividerLine/css/cssJSLogic.js +13 -0
  86. package/lib/DividerLine/css/dividerLine.cva.js +57 -0
  87. package/lib/DividerLine/props/defaultProps.js +21 -0
  88. package/lib/DividerLine/props/propTypes.js +31 -0
  89. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +6 -7
  90. package/lib/DropBox/css/DropBox.module.css +3 -3
  91. package/lib/DropDown/DropDownHeading.module.css +1 -1
  92. package/lib/DropDown/DropDownItem.module.css +3 -7
  93. package/lib/DropDown/DropDownSeparator.js +9 -4
  94. package/lib/DropDown/DropDownSeparator.module.css +0 -4
  95. package/lib/DropDown/__tests__/DropDownSeparator.spec.js +8 -0
  96. package/lib/DropDown/__tests__/__snapshots__/DropDownSeparator.spec.js.snap +12 -2
  97. package/lib/Label/Label.module.css +3 -3
  98. package/lib/ListItem/ListItem.module.css +9 -12
  99. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +1 -0
  100. package/lib/MultiSelect/AdvancedMultiSelect.js +1 -0
  101. package/lib/MultiSelect/MobileHeader/MobileHeader.module.css +1 -1
  102. package/lib/MultiSelect/MultiSelect.module.css +13 -20
  103. package/lib/MultiSelect/SelectedOptions.js +3 -3
  104. package/lib/MultiSelect/SelectedOptions.module.css +1 -1
  105. package/lib/MultiSelect/__tests__/AdvancedGroupMultiSelect.spec.js +42 -0
  106. package/lib/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +10 -0
  107. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +10 -0
  108. package/lib/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +121 -0
  109. package/lib/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +97 -0
  110. package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +157 -0
  111. package/lib/PopOver/PopOver.module.css +2 -2
  112. package/lib/Radio/Radio.module.css +7 -7
  113. package/lib/Ribbon/Ribbon.module.css +12 -19
  114. package/lib/RippleEffect/RippleEffect.module.css +2 -2
  115. package/lib/Select/Select.module.css +4 -4
  116. package/lib/Select/SelectWithAvatar.js +15 -3
  117. package/lib/Select/SelectWithIcon.js +26 -1
  118. package/lib/Select/__tests__/SelectWithAvatar.spec.js +20 -0
  119. package/lib/Select/__tests__/SelectWithIcon.spec.js +21 -0
  120. package/lib/Select/__tests__/__snapshots__/SelectWithAvatar.spec.js.snap +47 -0
  121. package/lib/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +19 -0
  122. package/lib/Select/props/propTypes.js +1 -0
  123. package/lib/Switch/Switch.module.css +4 -7
  124. package/lib/Tab/Tab.module.css +5 -7
  125. package/lib/Tab/TabContent.module.css +1 -1
  126. package/lib/Tab/Tabs.module.css +8 -9
  127. package/lib/Tag/Tag.module.css +4 -7
  128. package/lib/TextBoxIcon/TextBoxIcon.module.css +1 -1
  129. package/lib/Textarea/Textarea.module.css +3 -4
  130. package/lib/Tooltip/Tooltip.js +6 -1
  131. package/lib/Tooltip/Tooltip.module.css +2 -5
  132. package/lib/Typography/css/Typography.module.css +24 -32
  133. package/lib/common/animation.module.css +8 -8
  134. package/lib/common/common.module.css +79 -147
  135. package/lib/semantic/Button/semanticButton.module.css +1 -4
  136. package/lib/shared/InputFieldLine/InputFieldLine.module.css +1 -1
  137. package/lib/v1/Button/css/Button_v1.module.css +2 -2
  138. package/lib/v1/Label/css/Label_v1.module.css +1 -1
  139. package/lib/v1/Switch/css/Switch_v1.module.css +4 -7
  140. package/lib/v1/shared/Spinner/Spinner_v1.module.css +3 -5
  141. package/lib/v1/shared/SuccessTick/SuccessTick_v1.module.css +1 -2
  142. package/package.json +10 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.29
4
+
5
+ - Static CSS utility classes have been adopted across all CSS files using global composes.
6
+
7
+ ## 1.6.28
8
+
9
+ - **DividerLine** - New component introduced
10
+ - **DropDownSeparator** - Adopted `DividerLine` component
11
+ - **SelectWithAvatar, SelectWithIcon** - `renderCustomSelectedValue` prop supported
12
+ - **AdvancedMultiSelect, AdvancedGroupMultiSelect, SelectedOptions** - Fixed an issue where the remove option was displayed for selected values when disabled
13
+ - **Tooltip** - Corrected the fallback behavior for nearby `data-title` attributes by ignoring empty values
14
+
3
15
  ## 1.6.27
4
16
 
5
17
  - **DateWidget** - RTL support: Date and time render order now correctly reversed in RTL direction for proper text flow alignment.
@@ -14,9 +14,8 @@
14
14
 
15
15
  .avatar {
16
16
  composes: varClass;
17
- position: relative;
18
17
  composes: dInflex alignVertical alignHorizontal from '../common/common.module.css';
19
- vertical-align: middle;
18
+ composes: d-relative d-align-middle from global;
20
19
  font-size: var(--avatar_font_size);
21
20
  color: var(--avatar_text_color);
22
21
  border-width: var(--avatar_border_width);
@@ -36,11 +35,8 @@
36
35
  }
37
36
 
38
37
  .shadow {
39
- position: absolute;
40
- height: 100% ;
41
- width: 100% ;
38
+ composes: d-absolute d-size-full d-pointer-events-none from global;
42
39
  top: 0 ;
43
- pointer-events: none;
44
40
  border-radius: var(--avatar_border_radius);
45
41
  }
46
42
 
@@ -69,9 +65,7 @@
69
65
  }
70
66
 
71
67
  .image {
72
- width: 100% ;
73
- height: 100% ;
74
- position: absolute;
68
+ composes: d-absolute d-size-full from global;
75
69
  top: 0 ;
76
70
  z-index: 0;
77
71
  border-radius: var(--avatar_border_radius);
@@ -120,7 +114,7 @@
120
114
  }
121
115
 
122
116
  .none {
123
- display: none;
117
+ composes: d-hidden from global;
124
118
  }
125
119
 
126
120
  .default {
@@ -136,8 +130,8 @@
136
130
  }
137
131
 
138
132
  .initial {
133
+ composes: d-inline-block from global;
139
134
  text-transform: var(--avatar_text_transform);
140
- display: inline-block;
141
135
  }
142
136
 
143
137
  .xxsmall {
@@ -16,10 +16,8 @@
16
16
  --avatarteam_top_top: var(--zd_size1);
17
17
  }
18
18
  .container {
19
- position: relative;
20
- display: inline-block;
19
+ composes: d-inline-block d-relative d-align-middle from global;
21
20
  font-size: 0 ;
22
- vertical-align: middle;
23
21
  }
24
22
  .team {
25
23
  composes: varClass;
@@ -46,7 +46,7 @@
46
46
  .container {
47
47
  composes: native;
48
48
  composes: dotted from '../../common/common.module.css';
49
- position: relative;
49
+ composes: d-relative from global;
50
50
  font-size: var(--button_font_size);
51
51
  color: var(--button_text_color);
52
52
  font-weight: var(--button_font_weight);
@@ -94,17 +94,17 @@
94
94
  }
95
95
 
96
96
  .mediumBtn {
97
+ composes: d-text-center from global;
97
98
  --button_height: var(--zd_size42);
98
99
  --button_min_width: var(--zd_size42);
99
100
  --button_font_size: var(--zd_font_size10);
100
- text-align: center;
101
101
  }
102
102
 
103
103
  .smallBtn {
104
+ composes: d-text-center from global;
104
105
  --button_height: var(--zd_size22);
105
106
  --button_min_width: var(--zd_size22);
106
107
  --button_font_size: var(--zd_font_size13);
107
- text-align: center;
108
108
  }
109
109
 
110
110
  .smallBtnprimary,
@@ -272,10 +272,10 @@
272
272
  }
273
273
 
274
274
  .overlay {
275
- position: absolute;
275
+ composes: d-absolute from global;
276
276
  top: 0 ;
277
277
  bottom: 0 ;
278
- background: inherit;
278
+ background-color: inherit;
279
279
  border-radius: inherit;
280
280
  }
281
281
 
@@ -290,7 +290,7 @@
290
290
  }
291
291
 
292
292
  .loading {
293
- position: absolute;
293
+ composes: d-absolute from global;
294
294
  top: 50% ;
295
295
  width: var(--zd_size20) ;
296
296
  height: var(--zd_size20) ;
@@ -311,12 +311,10 @@
311
311
  }
312
312
 
313
313
  .loadingelement {
314
+ composes: d-inline-block d-relative d-origin-center from global;
314
315
  height: inherit ;
315
316
  width: inherit ;
316
- position: relative;
317
- display: inline-block;
318
317
  border-radius: 50%;
319
- transform-origin: 50%;
320
318
  }
321
319
 
322
320
  [dir=ltr] .loadingelement {
@@ -1,9 +1,9 @@
1
1
  .notScroll {
2
- position: relative;
2
+ composes: d-relative from global;
3
3
  }
4
4
 
5
5
  .scroll {
6
- /* background: var(--dot_white);
6
+ /* background-color: var(--dot_white);
7
7
  position: relative; */
8
8
  }
9
9
 
@@ -23,10 +23,9 @@
23
23
  --checkbox_cursor: default;
24
24
  }
25
25
  .cbBox {
26
- fill: none;
26
+ composes: d-fill-none d-stroke-inherit from global;
27
27
  stroke-width: var(--checkbox_stroke_width);
28
28
  stroke-linecap: round;
29
- stroke: inherit;
30
29
  }
31
30
  .tickPath {
32
31
  composes: cbBox;
@@ -50,9 +49,8 @@
50
49
  }
51
50
 
52
51
  .checkbox {
53
- position: relative;
52
+ composes: d-block d-relative from global;
54
53
  font-size: 0 ;
55
- display: block;
56
54
  }
57
55
  .tick {
58
56
  position: absolute;
@@ -16,7 +16,7 @@
16
16
  .header {
17
17
  min-height: var(--zd_size36) ;
18
18
  composes: boxPadding;
19
- text-align: center;
19
+ composes: d-text-center from global;
20
20
  background-color: var(--zdt_datetime_header_bg);
21
21
  border-radius: 0 0 2px 2px;
22
22
  border-bottom: 1px solid var(--zdt_datetime_header_border);
@@ -27,10 +27,10 @@
27
27
  }
28
28
 
29
29
  .grid {
30
+ composes: d-text-center from global;
30
31
  width: var(--zd_size28) ;
31
32
  height: var(--zd_size28) ;
32
33
  line-height: 1.3846;
33
- text-align: center;
34
34
  padding: var(--zd_size4) 0 ;
35
35
  border-radius: 50%;
36
36
  border: 1px solid transparent;
@@ -38,21 +38,18 @@
38
38
 
39
39
  .thArrow,
40
40
  .datesStr {
41
+ composes: d-cursor-pointer from global;
41
42
  font-size: var(--zd_font_size13) ;
42
43
  color: var(--zdt_datetime_datestr_text);
43
44
  }
44
45
 
45
- .thArrow, .datesStr {
46
- cursor: pointer;
47
- }
48
-
49
46
  .thArrow:hover,
50
47
  .datesStr:hover {
51
48
  color: var(--zdt_datetime_datestr_text);
52
49
  }
53
50
 
54
51
  .thArrow:hover, .datesStr:hover {
55
- background: var(--zdt_datetime_datestr_hover_bg);
52
+ background-color: var(--zdt_datetime_datestr_hover_bg);
56
53
  }
57
54
 
58
55
  .navigation {
@@ -89,8 +86,8 @@
89
86
  composes: dotted from '../common/common.module.css';
90
87
  font-size: var(--zd_font_size10) ;
91
88
  color: var(--zdt_datetime_daystr_text);
92
- text-transform: uppercase;
93
89
  composes: semibold;
90
+ composes: d-uppercase from global;
94
91
  width: var(--zd_size31) ;
95
92
  }
96
93
 
@@ -143,8 +140,8 @@
143
140
  }
144
141
 
145
142
  .inActiveDate {
143
+ composes: d-cursor-no-drop from global;
146
144
  color: var(--zdt_datetime_invalid_text);
147
- cursor: no-drop;
148
145
  }
149
146
 
150
147
  .inActiveDate:hover {
@@ -167,11 +164,10 @@
167
164
  }
168
165
 
169
166
  .dropDown {
167
+ composes: d-inline-block d-relative from global;
170
168
  width: var(--zd_size60) ;
171
- display: inline-block;
172
169
  margin-inline: var(--zd_size4) ;
173
170
  margin-block:0 ;
174
- position: relative;
175
171
  }
176
172
 
177
173
  .footer {
@@ -185,7 +181,7 @@
185
181
  }
186
182
 
187
183
  .space {
188
- display: inline-block;
184
+ composes: d-inline-block from global;
189
185
  width: var(--zd_size15) ;
190
186
  }
191
187
 
@@ -195,7 +191,7 @@
195
191
  }
196
192
 
197
193
  .dateText {
198
- cursor: pointer;
194
+ composes: d-cursor-pointer from global;
199
195
  }
200
196
 
201
197
  .dateText:hover .downArrow {
@@ -205,18 +201,15 @@
205
201
  .text {
206
202
  composes: boxPadding;
207
203
  font-size: var(--zd_font_size11) ;
208
- text-transform: uppercase;
209
204
  color: var(--zdt_datetime_text);
210
205
  margin-block-start: var(--zd_size14) ;
211
206
  composes: semibold;
212
- display: block;
207
+ composes: d-block d-uppercase from global;
213
208
  }
214
209
 
215
210
  .yearContainer {
216
- position: absolute;
211
+ composes: d-absolute d-size-full from global;
217
212
  top: 0 ;
218
- width: 100% ;
219
- height: 100% ;
220
213
  }
221
214
 
222
215
  [dir=ltr] .yearContainer {
@@ -228,11 +221,11 @@
228
221
  }
229
222
 
230
223
  .subContainer {
231
- position: relative;
224
+ composes: d-relative from global;
232
225
  }
233
226
 
234
227
  .dropBox {
235
- width: 100% ;
228
+ composes: d-w-full from global;
236
229
  border-radius: 3px;
237
230
  box-shadow: var(--zd_bs_dropbox_bottom);
238
231
  background-color: var(--zdt_dropbox_default_bg);
@@ -1,20 +1,22 @@
1
1
  /* $Id */
2
2
  .container {
3
- position: relative;
4
3
  composes: offSelection from '../common/common.module.css';
4
+ composes: d-relative from global;
5
+ }
6
+ .datePickIcon {
7
+ composes: d-h-full from global;
5
8
  }
6
- .datePickIcon{height:100% }
7
9
  .readOnly, .readOnly > input, .disabled {
8
10
  cursor: not-allowed;
9
11
  }
10
12
  .enabled {
11
- cursor: pointer;
13
+ composes: d-cursor-pointer from global;
12
14
  }
13
15
  .textBox {
14
- position: relative;
16
+ composes: d-relative from global;
15
17
  }
16
18
  .inputLine {
17
- position: absolute;
19
+ composes: d-absolute from global;
18
20
  bottom: 0 ;
19
21
  transition: border var(--zd_transition2) linear 0s;
20
22
  border-bottom: 1px solid var(--zdt_datewidget_input_border);
@@ -3,6 +3,7 @@
3
3
  }
4
4
 
5
5
  .month {
6
+ composes: d-text-center d-cursor-pointer from global;
6
7
  width: 30.333%;
7
8
  margin-block:0 var(--zd_size1) ;
8
9
  margin-inline:0 ;
@@ -10,8 +11,6 @@
10
11
  line-height: 2.1667;
11
12
  height: var(--zd_size26) ;
12
13
  color: var(--zdt_yearview_month_text);
13
- text-align: center;
14
- cursor: pointer;
15
14
  background-color: var(--zdt_yearview_month_bg);
16
15
  border-radius: 20px;
17
16
  }
@@ -34,9 +33,9 @@
34
33
  }
35
34
 
36
35
  .year {
36
+ composes: d-cursor-pointer from global;
37
37
  padding-block: var(--zd_size7) ;
38
38
  padding-inline:0 ;
39
- cursor: pointer;
40
39
  }
41
40
 
42
41
  .year:hover .yearText,
@@ -55,7 +54,7 @@
55
54
  }
56
55
 
57
56
  .isActive {
58
- cursor: default;
57
+ composes: d-cursor-default from global;
59
58
  }
60
59
 
61
60
  .isActive .yearText {
@@ -77,21 +76,19 @@
77
76
  }
78
77
 
79
78
  .container {
80
- height: 100% ;
81
- overflow-y: auto;
82
- overflow-x: hidden;
83
79
  composes: boxPadding;
80
+ composes: d-overflow-x-hidden d-overflow-y-auto d-h-full from global;
84
81
  background-color: var(--zdt_yearview_default_bg);
85
82
  }
86
83
 
87
84
  .yearContainer {
85
+ composes: d-overflow-hidden from global;
88
86
  height: var(--zd_size135) ;
89
- overflow: hidden;
90
87
  transition: height var(--zd_transition1);
91
88
  padding-block-end: var(--zd_size5) ;
92
89
  }
93
90
 
94
91
  .toggleYear {
92
+ composes: d-p-0 from global;
95
93
  height: 0 ;
96
- padding: 0 ;
97
94
  }
@@ -0,0 +1,40 @@
1
+ import { cn } from "@dot-system/css-utility";
2
+
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+
5
+ import React from 'react';
6
+ import cssJSLogic from "./css/cssJSLogic";
7
+ import defaultProps from "./props/defaultProps";
8
+ import propTypes from "./props/propTypes";
9
+ const DividerLine = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const {
11
+ customId,
12
+ testId,
13
+ orientation,
14
+ customAttributes,
15
+ a11yAttributes
16
+ } = props;
17
+ const {
18
+ wrapperClass
19
+ } = cssJSLogic({
20
+ props
21
+ });
22
+ const {
23
+ wrapper: wrapperTagAttrs
24
+ } = customAttributes;
25
+ const {
26
+ wrapper: wrapperA11yAttrs
27
+ } = a11yAttributes;
28
+ return /*#__PURE__*/React.createElement("hr", _extends({}, wrapperTagAttrs, {
29
+ "aria-orientation": orientation
30
+ }, wrapperA11yAttrs, {
31
+ ref: ref,
32
+ className: cn(wrapperClass),
33
+ "data-id": customId,
34
+ "data-test-id": testId
35
+ }));
36
+ });
37
+ DividerLine.displayName = 'DividerLine';
38
+ DividerLine.defaultProps = defaultProps;
39
+ DividerLine.propTypes = propTypes;
40
+ export default DividerLine;
@@ -0,0 +1,81 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import DividerLine from "../DividerLine";
4
+ describe('DividerLine - Snapshot', () => {
5
+ afterEach(() => {
6
+ cleanup();
7
+ });
8
+ test('Render with default props', () => {
9
+ const {
10
+ asFragment
11
+ } = render( /*#__PURE__*/React.createElement(DividerLine, null));
12
+ expect(asFragment()).toMatchSnapshot();
13
+ });
14
+ test.each(['horizontal', 'vertical'])('Render with orientation as %s', orientation => {
15
+ const {
16
+ asFragment
17
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
18
+ orientation: orientation
19
+ }));
20
+ expect(asFragment()).toMatchSnapshot();
21
+ });
22
+ test.each(['solid', 'dashed', 'dotted'])('Render with lineStyle as %s', lineStyle => {
23
+ const {
24
+ asFragment
25
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
26
+ lineStyle: lineStyle
27
+ }));
28
+ expect(asFragment()).toMatchSnapshot();
29
+ });
30
+ test.each(['default', 'secondary', 'tertiary', 'brand'])('Render with color as %s', color => {
31
+ const {
32
+ asFragment
33
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
34
+ color: color
35
+ }));
36
+ expect(asFragment()).toMatchSnapshot();
37
+ });
38
+ test('Render with customId and testId', () => {
39
+ const {
40
+ asFragment
41
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
42
+ customId: "divider-line-customId",
43
+ testId: "divider-line-testId"
44
+ }));
45
+ expect(asFragment()).toMatchSnapshot();
46
+ });
47
+ test('Render with customAttributes', () => {
48
+ const {
49
+ asFragment
50
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
51
+ customAttributes: {
52
+ wrapper: {
53
+ 'data-custom-attr': 'true'
54
+ }
55
+ }
56
+ }));
57
+ expect(asFragment()).toMatchSnapshot();
58
+ });
59
+ test('Render with a11yAttributes', () => {
60
+ const {
61
+ asFragment
62
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
63
+ a11yAttributes: {
64
+ wrapper: {
65
+ 'aria-label': 'Section divider'
66
+ }
67
+ }
68
+ }));
69
+ expect(asFragment()).toMatchSnapshot();
70
+ });
71
+ test('Render with customClass', () => {
72
+ const {
73
+ asFragment
74
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
75
+ customClass: {
76
+ wrapper: 'my-divider-line'
77
+ }
78
+ }));
79
+ expect(asFragment()).toMatchSnapshot();
80
+ });
81
+ });
@@ -0,0 +1,131 @@
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
+
3
+ exports[`DividerLine - Snapshot Render with a11yAttributes 1`] = `
4
+ <DocumentFragment>
5
+ <hr
6
+ aria-label="Section divider"
7
+ aria-orientation="horizontal"
8
+ class="wrapper horizontal solid colorDefault"
9
+ />
10
+ </DocumentFragment>
11
+ `;
12
+
13
+ exports[`DividerLine - Snapshot Render with color as brand 1`] = `
14
+ <DocumentFragment>
15
+ <hr
16
+ aria-orientation="horizontal"
17
+ class="wrapper horizontal solid colorBrand"
18
+ />
19
+ </DocumentFragment>
20
+ `;
21
+
22
+ exports[`DividerLine - Snapshot Render with color as default 1`] = `
23
+ <DocumentFragment>
24
+ <hr
25
+ aria-orientation="horizontal"
26
+ class="wrapper horizontal solid colorDefault"
27
+ />
28
+ </DocumentFragment>
29
+ `;
30
+
31
+ exports[`DividerLine - Snapshot Render with color as secondary 1`] = `
32
+ <DocumentFragment>
33
+ <hr
34
+ aria-orientation="horizontal"
35
+ class="wrapper horizontal solid colorSecondary"
36
+ />
37
+ </DocumentFragment>
38
+ `;
39
+
40
+ exports[`DividerLine - Snapshot Render with color as tertiary 1`] = `
41
+ <DocumentFragment>
42
+ <hr
43
+ aria-orientation="horizontal"
44
+ class="wrapper horizontal solid colorTertiary"
45
+ />
46
+ </DocumentFragment>
47
+ `;
48
+
49
+ exports[`DividerLine - Snapshot Render with customAttributes 1`] = `
50
+ <DocumentFragment>
51
+ <hr
52
+ aria-orientation="horizontal"
53
+ class="wrapper horizontal solid colorDefault"
54
+ data-custom-attr="true"
55
+ />
56
+ </DocumentFragment>
57
+ `;
58
+
59
+ exports[`DividerLine - Snapshot Render with customClass 1`] = `
60
+ <DocumentFragment>
61
+ <hr
62
+ aria-orientation="horizontal"
63
+ class="wrapper horizontal solid colorDefault my-divider-line"
64
+ />
65
+ </DocumentFragment>
66
+ `;
67
+
68
+ exports[`DividerLine - Snapshot Render with customId and testId 1`] = `
69
+ <DocumentFragment>
70
+ <hr
71
+ aria-orientation="horizontal"
72
+ class="wrapper horizontal solid colorDefault"
73
+ data-id="divider-line-customId"
74
+ data-test-id="divider-line-testId"
75
+ />
76
+ </DocumentFragment>
77
+ `;
78
+
79
+ exports[`DividerLine - Snapshot Render with default props 1`] = `
80
+ <DocumentFragment>
81
+ <hr
82
+ aria-orientation="horizontal"
83
+ class="wrapper horizontal solid colorDefault"
84
+ />
85
+ </DocumentFragment>
86
+ `;
87
+
88
+ exports[`DividerLine - Snapshot Render with lineStyle as dashed 1`] = `
89
+ <DocumentFragment>
90
+ <hr
91
+ aria-orientation="horizontal"
92
+ class="wrapper horizontal dashed colorDefault"
93
+ />
94
+ </DocumentFragment>
95
+ `;
96
+
97
+ exports[`DividerLine - Snapshot Render with lineStyle as dotted 1`] = `
98
+ <DocumentFragment>
99
+ <hr
100
+ aria-orientation="horizontal"
101
+ class="wrapper horizontal dotted colorDefault"
102
+ />
103
+ </DocumentFragment>
104
+ `;
105
+
106
+ exports[`DividerLine - Snapshot Render with lineStyle as solid 1`] = `
107
+ <DocumentFragment>
108
+ <hr
109
+ aria-orientation="horizontal"
110
+ class="wrapper horizontal solid colorDefault"
111
+ />
112
+ </DocumentFragment>
113
+ `;
114
+
115
+ exports[`DividerLine - Snapshot Render with orientation as horizontal 1`] = `
116
+ <DocumentFragment>
117
+ <hr
118
+ aria-orientation="horizontal"
119
+ class="wrapper horizontal solid colorDefault"
120
+ />
121
+ </DocumentFragment>
122
+ `;
123
+
124
+ exports[`DividerLine - Snapshot Render with orientation as vertical 1`] = `
125
+ <DocumentFragment>
126
+ <hr
127
+ aria-orientation="vertical"
128
+ class="wrapper vertical solid colorDefault"
129
+ />
130
+ </DocumentFragment>
131
+ `;
@@ -0,0 +1,29 @@
1
+ export const ORIENTATION = {
2
+ HORIZONTAL: 'horizontal',
3
+ VERTICAL: 'vertical'
4
+ };
5
+ export const LINE_STYLE = {
6
+ SOLID: 'solid',
7
+ DASHED: 'dashed',
8
+ DOTTED: 'dotted'
9
+ };
10
+ export const LINE_STYLE_CLASS_MAP = {
11
+ [LINE_STYLE.SOLID]: 'solid',
12
+ [LINE_STYLE.DASHED]: 'dashed',
13
+ [LINE_STYLE.DOTTED]: 'dotted'
14
+ };
15
+ export const COLOR = {
16
+ DEFAULT: 'default',
17
+ SECONDARY: 'secondary',
18
+ TERTIARY: 'tertiary',
19
+ BRAND: 'brand'
20
+ };
21
+ export const COLOR_CLASS_MAP = {
22
+ [COLOR.DEFAULT]: 'colorDefault',
23
+ [COLOR.SECONDARY]: 'colorSecondary',
24
+ [COLOR.TERTIARY]: 'colorTertiary',
25
+ [COLOR.BRAND]: 'colorBrand'
26
+ };
27
+ export const DEFAULT_ORIENTATION = ORIENTATION.HORIZONTAL;
28
+ export const DEFAULT_LINE_STYLE = LINE_STYLE.SOLID;
29
+ export const DEFAULT_COLOR = COLOR.DEFAULT;