@zohodesk/components 1.0.0-alpha-253 → 1.0.0-alpha-255

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 (46) hide show
  1. package/README.md +14 -0
  2. package/assets/Appearance/dark/themes/blue/blueDarkComponentTheme.module.css +3 -0
  3. package/assets/Appearance/dark/themes/green/greenDarkComponentTheme.module.css +3 -0
  4. package/assets/Appearance/dark/themes/orange/orangeDarkComponentTheme.module.css +3 -0
  5. package/assets/Appearance/dark/themes/red/redDarkComponentTheme.module.css +3 -0
  6. package/assets/Appearance/dark/themes/yellow/yellowDarkComponentTheme.module.css +3 -0
  7. package/assets/Appearance/default/themes/blue/blueDefaultComponentTheme.module.css +3 -0
  8. package/assets/Appearance/default/themes/green/greenDefaultComponentTheme.module.css +3 -0
  9. package/assets/Appearance/default/themes/orange/orangeDefaultComponentTheme.module.css +3 -0
  10. package/assets/Appearance/default/themes/red/redDefaultComponentTheme.module.css +3 -0
  11. package/assets/Appearance/default/themes/yellow/yellowDefaultComponentTheme.module.css +3 -0
  12. package/assets/Appearance/pureDark/themes/blue/bluePureDarkComponentTheme.module.css +3 -0
  13. package/assets/Appearance/pureDark/themes/green/greenPureDarkComponentTheme.module.css +3 -0
  14. package/assets/Appearance/pureDark/themes/orange/orangePureDarkComponentTheme.module.css +3 -0
  15. package/assets/Appearance/pureDark/themes/red/redPureDarkComponentTheme.module.css +3 -0
  16. package/assets/Appearance/pureDark/themes/yellow/yellowPureDarkComponentTheme.module.css +3 -0
  17. package/css_error.log +0 -0
  18. package/es/AppContainer/AppContainer.js +1 -0
  19. package/es/Button/Button.js +5 -3
  20. package/es/DateTime/CalendarView.js +23 -11
  21. package/es/DateTime/DateTime.js +1 -1
  22. package/es/DateTime/DateTime.module.css +10 -8
  23. package/es/DropBox/DropBox.js +24 -4
  24. package/es/DropBox/props/defaultProps.js +2 -1
  25. package/es/DropBox/props/propTypes.js +1 -0
  26. package/es/ListItem/ListContainer.js +1 -0
  27. package/es/Switch/Switch.js +7 -5
  28. package/es/Tab/Tab.js +1 -1
  29. package/es/Tab/TabContent.js +1 -1
  30. package/es/Tab/Tabs.js +3 -1
  31. package/es/common/a11y.module.css +4 -0
  32. package/lib/AppContainer/AppContainer.js +1 -0
  33. package/lib/Button/Button.js +5 -3
  34. package/lib/DateTime/CalendarView.js +23 -11
  35. package/lib/DateTime/DateTime.js +1 -1
  36. package/lib/DateTime/DateTime.module.css +10 -8
  37. package/lib/DropBox/DropBox.js +24 -4
  38. package/lib/DropBox/props/defaultProps.js +2 -1
  39. package/lib/DropBox/props/propTypes.js +1 -0
  40. package/lib/ListItem/ListContainer.js +1 -0
  41. package/lib/Switch/Switch.js +7 -5
  42. package/lib/Tab/Tab.js +1 -1
  43. package/lib/Tab/TabContent.js +1 -1
  44. package/lib/Tab/Tabs.js +3 -1
  45. package/lib/common/a11y.module.css +4 -0
  46. package/package.json +5 -3
package/README.md CHANGED
@@ -32,6 +32,20 @@ In this Package, we Provide Some Basic Components to Build Web App
32
32
  - TextBoxIcon
33
33
  - Tooltip
34
34
 
35
+ # 1.0.0-alpha-255
36
+
37
+ - **CalenderView, DateTime** - Today and selected date issue fix.
38
+
39
+ - `Accesssility`- Screen Reader fix.
40
+
41
+ # 1.0.0-alpha-254
42
+
43
+ - **AppContainer** - accessibility theme css has been added.
44
+
45
+ - **Button** - `customProps` support.
46
+
47
+ - **DropBox** - Focus scope navigation support.
48
+
35
49
  # 1.0.0-alpha-253
36
50
 
37
51
  - **Tabs, Tooltip** - If condition check added to reduce murphy error logs.
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: var(--dot_cadetblue);
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: var(--dot_butterflyblue);
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: var(--dot_cadetblue);
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: #45a159;
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: var(--dot_cadetblue);
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: #ff801f;
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: var(--dot_cadetblue);
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: #e94f4f;
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: var(--dot_cadetblue);
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: #d79835;
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: var(--dot_white);
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: var(--dot_primary);
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: var(--dot_white);
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: #26a942;
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: var(--dot_white);
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: #e57717;
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: var(--dot_white);
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: var(--dot_brightRed);
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: var(--dot_white);
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: #e8b923;
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: #999;
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: var(--dot_butterflyblue);
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: #999;
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: #45a159;
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: #999;
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: #ff801f;
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: #999;
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: #e94f4f;
42
45
  }
@@ -39,4 +39,7 @@
39
39
 
40
40
  /* dropdown */
41
41
  --zdt_dropdown_darkheading_text: #999;
42
+
43
+ /* focusscope */
44
+ --zdt_a11y_focusScope_focus_border: #d79835;
42
45
  }
package/css_error.log ADDED
File without changes
@@ -12,6 +12,7 @@ import '@zohodesk/variables/assets/fontsizeVariables.module.css';
12
12
  import '@zohodesk/variables/lib/fontFamilyVariables.module.css';
13
13
  import '@zohodesk/variables/assets/transitionVariables.module.css';
14
14
  import '@zohodesk/variables/assets/no_transitionVariables.module.css';
15
+ import '../common/a11y.module.css';
15
16
  import style from './AppContainer.module.css';
16
17
  import { getLibraryConfig, setLibraryConfig } from '../Provider/Config';
17
18
  export default class AppContainer extends React.Component {
@@ -1,3 +1,4 @@
1
+ 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); }
1
2
  import React from 'react';
2
3
  import { defaultProps } from './props/defaultProps';
3
4
  import { propTypes } from './props/propTypes';
@@ -24,7 +25,8 @@ export default class Button extends React.Component {
24
25
  needAppearance,
25
26
  getRef,
26
27
  title,
27
- customClass
28
+ customClass,
29
+ customProps
28
30
  } = this.props;
29
31
  let {
30
32
  customButton = '',
@@ -35,7 +37,7 @@ export default class Button extends React.Component {
35
37
  let statusLower = status.toLowerCase();
36
38
  let classList = needAppearance ? `${style[paletteLower]} ${rounded ? style.rounded : ''} ${!children ? style[size.toLowerCase()] : `${style[`${size}Btn`]}
37
39
  ${rounded ? style[`${size}Btn${paletteLower}`] : ''}`} ${statusLower !== 'none' ? style.loader : ''}` : `${style.default}`;
38
- return /*#__PURE__*/React.createElement("button", {
40
+ return /*#__PURE__*/React.createElement("button", _extends({
39
41
  className: `${customButton} ${classList} ${isBold ? style.bold : ''} `,
40
42
  "data-id": disabled ? `${dataId}_disabled` : dataId,
41
43
  disabled: disabled || statusLower === 'loading',
@@ -43,7 +45,7 @@ export default class Button extends React.Component {
43
45
  "data-title": title,
44
46
  type: "button",
45
47
  ref: getRef
46
- }, children ? children : text, statusLower !== 'none' && needAppearance && /*#__PURE__*/React.createElement("div", {
48
+ }, customProps), children ? children : text, statusLower !== 'none' && needAppearance && /*#__PURE__*/React.createElement("div", {
47
49
  className: style.overlay
48
50
  }, /*#__PURE__*/React.createElement("div", {
49
51
  className: `${customStatusSize} ${statusLower === 'loading' ? `${style.loading} ${style[`${size}loading`] ? style[`${size}loading`] : ''}` : style.success}`
@@ -64,10 +64,11 @@ export default class CalendarView extends React.PureComponent {
64
64
  tdclass += ` ${style.sunday}`;
65
65
  }
66
66
  if (incremleti >= userSeeDay && incremday <= monthEnd) {
67
- if (incremday === parseInt(date) && parseInt(month) === userSeeMonth && parseInt(year) === userSeeYear) {
67
+ if (parseInt(date) === incremday && parseInt(month) === userSeeMonth && parseInt(year) === userSeeYear) {
68
68
  isSelectedDay = true;
69
69
  } else if (todayDate === incremday && todayMonth === userSeeMonth && todayYear === userSeeYear) {
70
70
  isToday = true;
71
+ isSelectedDay = false;
71
72
  } else {
72
73
  isSelectedDay = false;
73
74
  isToday = false;
@@ -93,17 +94,22 @@ export default class CalendarView extends React.PureComponent {
93
94
  }
94
95
  const prevMonthEnd = getMonthEnd(prevMonth, prevYear);
95
96
  const prevDate = prevMonthEnd - (userSeeDay - 1) + incremleti;
96
- isSelectedDay = prevDate === parseInt(date) && parseInt(month) === prevMonth && parseInt(year) === prevYear ? true : false;
97
+
98
+ // isSelectedDay =
99
+ prevDate === parseInt(date) && parseInt(month) === prevMonth && parseInt(year) === prevYear ? true : false;
100
+ // isToday = prevDate === incremday && todayMonth === userSeeMonth && todayYear === userSeeYear ? true : false;
101
+
97
102
  output = /*#__PURE__*/React.createElement(Span, {
98
- i: i,
99
- isActive: isSelectedDay,
103
+ i: i
104
+ //isActive={isSelectedDay}
105
+ ,
100
106
  tdclass: `${tdclass} ${style.invalidDate}`,
101
107
  handleSelect: this.handleSelect,
102
108
  incremday: prevDate,
103
109
  userSeeMonth: prevMonth,
104
110
  userSeeYear: prevYear,
105
- dataId: isSelectedDay ? `${dataId}_dateSelected` : `${dataId}_invalidDate`,
106
- isToday: isToday
111
+ dataId: isSelectedDay ? `${dataId}_dateSelected` : `${dataId}_invalidDate`
112
+ // isToday={isToday}
107
113
  });
108
114
  } else if (incremleti > monthEnd) {
109
115
  let nextMonth = userSeeMonth + 1;
@@ -113,17 +119,23 @@ export default class CalendarView extends React.PureComponent {
113
119
  nextYear = userSeeYear + 1;
114
120
  }
115
121
  const nextDate = incremleti - (userSeeDay - 1) - monthEnd;
116
- isSelectedDay = nextDate === parseInt(date) && parseInt(month) === nextMonth && parseInt(year) === nextYear ? true : false;
122
+
123
+ // isSelectedDay =
124
+ nextDate === parseInt(date) && parseInt(month) === nextMonth && parseInt(year) === nextYear ? true : false;
125
+
126
+ // isToday = nextDate === incremday && todayMonth === userSeeMonth && todayYear === userSeeYear ? true : false;
127
+
117
128
  output = /*#__PURE__*/React.createElement(Span, {
118
- i: i,
119
- isActive: isSelectedDay,
129
+ i: i
130
+ // isActive={isSelectedDay}
131
+ ,
120
132
  tdclass: `${tdclass} ${style.invalidDate}`,
121
133
  handleSelect: this.handleSelect,
122
134
  incremday: nextDate,
123
135
  userSeeMonth: nextMonth,
124
136
  userSeeYear: nextYear,
125
- dataId: isSelectedDay ? `${dataId}_dateSelected` : `${dataId}_invalidDate`,
126
- isToday: isToday
137
+ dataId: isSelectedDay ? `${dataId}_dateSelected` : `${dataId}_invalidDate`
138
+ //isToday={isToday}
127
139
  });
128
140
  } else {
129
141
  output = /*#__PURE__*/React.createElement(Box, {
@@ -134,7 +134,7 @@ export default class DateTime extends React.PureComponent {
134
134
  defaultHour = parseInt(defaultHour);
135
135
  defaultMin = parseInt(defaultMin);
136
136
  }
137
- const dateObj = isDateTimeField ? datetime.toDate(datetime.tz.utcToTz(value, timeZone)) : value ? datetime.toDate(value) : new Date();
137
+ const dateObj = isDateTimeField ? datetime.toDate(datetime.tz.utcToTz(value, timeZone)) : value ? datetime.toDate(value) : todayObj;
138
138
  date = dateObj.getDate();
139
139
  month = dateObj.getMonth();
140
140
  year = dateObj.getFullYear();
@@ -124,6 +124,16 @@
124
124
  color: var(--zdt_datetime_invaliddate_text);
125
125
  }
126
126
 
127
+ .today {
128
+ border: 1px solid var(--zdt_datetime_today_border);
129
+ border-radius: 50%;
130
+ }
131
+
132
+ .today:hover {
133
+ border: 1px solid var(--zdt_datetime_today_border);
134
+ background-color: var(--zdt_datetime_datestr_hover_bg);
135
+ }
136
+
127
137
  .active,
128
138
  .active:hover,
129
139
  .active.today,
@@ -136,15 +146,7 @@
136
146
  border-radius: 50%;
137
147
  }
138
148
 
139
- .today {
140
- border: 1px solid var(--zdt_datetime_today_border);
141
- border-radius: 50%;
142
- }
143
149
 
144
- .today:hover {
145
- border: 1px solid var(--zdt_datetime_today_border);
146
- background-color: var(--zdt_datetime_datestr_hover_bg);
147
- }
148
150
 
149
151
  .timesection {
150
152
  padding-top: var(--zd_size5);
@@ -9,6 +9,7 @@ import { positionMapping } from './DropBoxPositionMapping.json';
9
9
  import { getZIndex } from '../Provider/ZindexProvider';
10
10
  import { getLibraryConfig } from '../Provider/Config';
11
11
  import LibraryContext from '../Provider/LibraryContextInit';
12
+ import FocusScope from '@zohodesk/a11y/es/FocusScope/FocusScope';
12
13
  export class DropBoxElement extends React.Component {
13
14
  constructor(props) {
14
15
  super(props);
@@ -59,7 +60,8 @@ export class DropBoxElement extends React.Component {
59
60
  positionsOffset,
60
61
  targetOffset,
61
62
  zIndexStyle,
62
- customStyle
63
+ customStyle,
64
+ subContainerRef
63
65
  } = this.props;
64
66
  let {
65
67
  isReducedMotion
@@ -146,9 +148,11 @@ export class DropBoxElement extends React.Component {
146
148
  "aria-labelledby": ariaLabelledby,
147
149
  tabIndex: tabIndex
148
150
  }, /*#__PURE__*/React.createElement("div", {
151
+ tabIndex: "-1",
149
152
  className: `${subContainerClass} ${style[`${palette}Palette`]}`,
150
153
  onClick: onClick,
151
- "data-id": `${dataId}_subcontainer`
154
+ "data-id": `${dataId}_subcontainer`,
155
+ ref: subContainerRef
152
156
  }, isModel ? /*#__PURE__*/React.createElement("div", {
153
157
  className: style.closeBar
154
158
  }) : null, isArrow && !isModel && /*#__PURE__*/React.createElement("div", {
@@ -165,6 +169,7 @@ export default class DropBox extends React.Component {
165
169
  super(props);
166
170
  this.getNextIndex = getZIndex(this);
167
171
  this.onFreezeClick = this.onFreezeClick.bind(this);
172
+ this.createRef = /*#__PURE__*/React.createRef();
168
173
  }
169
174
  onFreezeClick(e) {
170
175
  e && e.stopPropagation();
@@ -176,7 +181,9 @@ export default class DropBox extends React.Component {
176
181
  isActive,
177
182
  isAbsolutePositioningNeeded,
178
183
  needAutoZindex,
179
- isRestrictScroll
184
+ isRestrictScroll,
185
+ needFocusScope,
186
+ onClose
180
187
  } = this.props;
181
188
  let windowWidth,
182
189
  mobileWidth = getLibraryConfig('mobileWidth'),
@@ -193,7 +200,20 @@ export default class DropBox extends React.Component {
193
200
  const {
194
201
  direction
195
202
  } = this.context || {};
196
- const dropBoxEle = /*#__PURE__*/React.createElement(DropBoxElement, _extends({
203
+ const dropBoxEle = needFocusScope ? /*#__PURE__*/React.createElement(FocusScope, {
204
+ focusClose: onClose,
205
+ elementRef: this.createRef,
206
+ autoFocus: true,
207
+ restoreFocus: true,
208
+ focusArrowLoop: true,
209
+ enableEnterAction: true
210
+ }, /*#__PURE__*/React.createElement(DropBoxElement, _extends({
211
+ isModel: isModel,
212
+ direction: direction
213
+ }, this.props, {
214
+ zIndexStyle: zIndexStyle,
215
+ subContainerRef: this.createRef
216
+ }))) : /*#__PURE__*/React.createElement(DropBoxElement, _extends({
197
217
  isModel: isModel,
198
218
  direction: direction
199
219
  }, this.props, {
@@ -16,5 +16,6 @@ export const defaultProps = {
16
16
  palette: 'default',
17
17
  needAutoZindex: true,
18
18
  portalId: 'portal1',
19
- isRestrictScroll: false
19
+ isRestrictScroll: false,
20
+ needFocusScope: false
20
21
  };
@@ -22,6 +22,7 @@ export const propTypes = {
22
22
  left: PropTypes.number,
23
23
  needResponsive: PropTypes.bool,
24
24
  onClick: PropTypes.func,
25
+ needFocusScope: PropTypes.bool,
25
26
  right: PropTypes.number,
26
27
  size: PropTypes.oneOf(['mini', 'xmini', 'xsmall', 'small', 'medium', 'large', 'mlarge', 'xlarge', 'xxlarge', 'default']),
27
28
  top: PropTypes.number,
@@ -66,6 +66,7 @@ const ListContainer = props => {
66
66
  }
67
67
  return /*#__PURE__*/React.createElement(Container, _extends({
68
68
  role: role,
69
+ "data-a11y-inside-focus": true,
69
70
  "aria-selected": ariaSelected,
70
71
  "aria-label": ariaLabel,
71
72
  isCover: false,
@@ -55,7 +55,8 @@ export default class Switch extends React.Component {
55
55
  "data-title": disabled ? disableTitle : title,
56
56
  "aria-checked": checked,
57
57
  role: "switch",
58
- tabIndex: isReadOnly || disabled ? '-1' : '0'
58
+ tabIndex: isReadOnly || disabled ? '-1' : '0',
59
+ onClick: !disabled || !isReadOnly ? this.onChange : null
59
60
  }, SwitchProps), /*#__PURE__*/React.createElement(Box, {
60
61
  className: `${style[size]} ${customSwitchSize}`
61
62
  }, /*#__PURE__*/React.createElement("input", {
@@ -66,8 +67,8 @@ export default class Switch extends React.Component {
66
67
  value: value,
67
68
  checked: checked,
68
69
  disabled: disabled,
69
- readOnly: isReadOnly,
70
- onClick: !disabled || !isReadOnly ? this.onChange : null
70
+ readOnly: isReadOnly
71
+ // onClick={!disabled || !isReadOnly ? this.onChange : null}
71
72
  }), /*#__PURE__*/React.createElement("label", {
72
73
  htmlFor: id,
73
74
  "data-id": dataId,
@@ -77,8 +78,9 @@ export default class Switch extends React.Component {
77
78
  palette: labelPalette,
78
79
  id: id,
79
80
  size: labelSize,
80
- type: "subtitle",
81
- onClick: !disabled || !isReadOnly ? this.onChange : null,
81
+ type: "subtitle"
82
+ // onClick={!disabled || !isReadOnly ? this.onChange : null}
83
+ ,
82
84
  customClass: customLabel
83
85
  }, LabelProps)));
84
86
  }
package/es/Tab/Tab.js CHANGED
@@ -83,7 +83,7 @@ export default function Tab(_ref) {
83
83
  role: "tab",
84
84
  "aria-controls": id,
85
85
  "aria-selected": isActive ? true : false,
86
- tabIndex: isLink ? undefined : isActive && !isDisabled ? '0' : '-1',
86
+ tabIndex: isLink ? undefined : isActive && !isDisabled ? '0' : '0',
87
87
  "aria-label": text ? text : null
88
88
  }, customProps), /*#__PURE__*/React.createElement(Container, {
89
89
  alignBox: "row",
@@ -18,7 +18,7 @@ const TabContent = _ref => {
18
18
  dataId: `${dataId}_TabContent`,
19
19
  isScrollAttribute: true,
20
20
  "aria-labelledby": id,
21
- tabindex: "0",
21
+ tabindex: "-1",
22
22
  role: "tabpanel"
23
23
  }, children);
24
24
  };
package/es/Tab/Tabs.js CHANGED
@@ -456,7 +456,9 @@ class Tabs extends React.Component {
456
456
  isBoxPaddingNeed: true,
457
457
  isArrow: false
458
458
  }, DropBoxProps, {
459
- isResponsivePadding: true
459
+ isResponsivePadding: true,
460
+ needFocusScope: true,
461
+ onClose: this.togglePopup
460
462
  }), getCustomDropBoxHeaderPlaceHolder && getCustomDropBoxHeaderPlaceHolder(this.props), /*#__PURE__*/React.createElement(Box, {
461
463
  flexible: true,
462
464
  shrink: true,
@@ -0,0 +1,4 @@
1
+ :root {
2
+ --lib_a11y_focusScope_focus_border:var(--zdt_a11y_focusScope_focus_border);
3
+ --lib_a11y_focusScope_focus_bg:var(--zdt_listitem_highlight_bg);
4
+ }
@@ -18,6 +18,7 @@ require("@zohodesk/variables/assets/fontsizeVariables.module.css");
18
18
  require("@zohodesk/variables/lib/fontFamilyVariables.module.css");
19
19
  require("@zohodesk/variables/assets/transitionVariables.module.css");
20
20
  require("@zohodesk/variables/assets/no_transitionVariables.module.css");
21
+ require("../common/a11y.module.css");
21
22
  var _AppContainerModule = _interopRequireDefault(require("./AppContainer.module.css"));
22
23
  var _Config = require("../Provider/Config");
23
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -10,6 +10,7 @@ var _defaultProps = require("./props/defaultProps");
10
10
  var _propTypes = require("./props/propTypes");
11
11
  var _ButtonModule = _interopRequireDefault(require("./Button.module.css"));
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
+ 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); }
13
14
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
15
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
15
16
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -50,7 +51,8 @@ var Button = /*#__PURE__*/function (_React$Component) {
50
51
  needAppearance = _this$props.needAppearance,
51
52
  getRef = _this$props.getRef,
52
53
  title = _this$props.title,
53
- customClass = _this$props.customClass;
54
+ customClass = _this$props.customClass,
55
+ customProps = _this$props.customProps;
54
56
  var _customClass$customBu = customClass.customButton,
55
57
  customButton = _customClass$customBu === void 0 ? '' : _customClass$customBu,
56
58
  _customClass$customSt = customClass.customStatus,
@@ -60,7 +62,7 @@ var Button = /*#__PURE__*/function (_React$Component) {
60
62
  var paletteLower = palette.toLowerCase();
61
63
  var statusLower = status.toLowerCase();
62
64
  var classList = needAppearance ? "".concat(_ButtonModule["default"][paletteLower], " ").concat(rounded ? _ButtonModule["default"].rounded : '', " ").concat(!children ? _ButtonModule["default"][size.toLowerCase()] : "".concat(_ButtonModule["default"]["".concat(size, "Btn")], " \n ").concat(rounded ? _ButtonModule["default"]["".concat(size, "Btn").concat(paletteLower)] : ''), " ").concat(statusLower !== 'none' ? _ButtonModule["default"].loader : '') : "".concat(_ButtonModule["default"]["default"]);
63
- return /*#__PURE__*/_react["default"].createElement("button", {
65
+ return /*#__PURE__*/_react["default"].createElement("button", _extends({
64
66
  className: "".concat(customButton, " ").concat(classList, " ").concat(isBold ? _ButtonModule["default"].bold : '', " "),
65
67
  "data-id": disabled ? "".concat(dataId, "_disabled") : dataId,
66
68
  disabled: disabled || statusLower === 'loading',
@@ -68,7 +70,7 @@ var Button = /*#__PURE__*/function (_React$Component) {
68
70
  "data-title": title,
69
71
  type: "button",
70
72
  ref: getRef
71
- }, children ? children : text, statusLower !== 'none' && needAppearance && /*#__PURE__*/_react["default"].createElement("div", {
73
+ }, customProps), children ? children : text, statusLower !== 'none' && needAppearance && /*#__PURE__*/_react["default"].createElement("div", {
72
74
  className: _ButtonModule["default"].overlay
73
75
  }, /*#__PURE__*/_react["default"].createElement("div", {
74
76
  className: "".concat(customStatusSize, " ").concat(statusLower === 'loading' ? "".concat(_ButtonModule["default"].loading, " ").concat(_ButtonModule["default"]["".concat(size, "loading")] ? _ButtonModule["default"]["".concat(size, "loading")] : '') : _ButtonModule["default"].success)
@@ -87,10 +87,11 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
87
87
  tdclass += " ".concat(_DateTimeModule["default"].sunday);
88
88
  }
89
89
  if (incremleti >= userSeeDay && incremday <= monthEnd) {
90
- if (incremday === parseInt(date) && parseInt(month) === userSeeMonth && parseInt(year) === userSeeYear) {
90
+ if (parseInt(date) === incremday && parseInt(month) === userSeeMonth && parseInt(year) === userSeeYear) {
91
91
  isSelectedDay = true;
92
92
  } else if (todayDate === incremday && todayMonth === userSeeMonth && todayYear === userSeeYear) {
93
93
  isToday = true;
94
+ isSelectedDay = false;
94
95
  } else {
95
96
  isSelectedDay = false;
96
97
  isToday = false;
@@ -116,17 +117,22 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
116
117
  }
117
118
  var prevMonthEnd = (0, _common.getMonthEnd)(prevMonth, prevYear);
118
119
  var prevDate = prevMonthEnd - (userSeeDay - 1) + incremleti;
119
- isSelectedDay = prevDate === parseInt(date) && parseInt(month) === prevMonth && parseInt(year) === prevYear ? true : false;
120
+
121
+ // isSelectedDay =
122
+ prevDate === parseInt(date) && parseInt(month) === prevMonth && parseInt(year) === prevYear ? true : false;
123
+ // isToday = prevDate === incremday && todayMonth === userSeeMonth && todayYear === userSeeYear ? true : false;
124
+
120
125
  output = /*#__PURE__*/_react["default"].createElement(Span, {
121
- i: i,
122
- isActive: isSelectedDay,
126
+ i: i
127
+ //isActive={isSelectedDay}
128
+ ,
123
129
  tdclass: "".concat(tdclass, " ").concat(_DateTimeModule["default"].invalidDate),
124
130
  handleSelect: _this2.handleSelect,
125
131
  incremday: prevDate,
126
132
  userSeeMonth: prevMonth,
127
133
  userSeeYear: prevYear,
128
- dataId: isSelectedDay ? "".concat(dataId, "_dateSelected") : "".concat(dataId, "_invalidDate"),
129
- isToday: isToday
134
+ dataId: isSelectedDay ? "".concat(dataId, "_dateSelected") : "".concat(dataId, "_invalidDate")
135
+ // isToday={isToday}
130
136
  });
131
137
  } else if (incremleti > monthEnd) {
132
138
  var nextMonth = userSeeMonth + 1;
@@ -136,17 +142,23 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
136
142
  nextYear = userSeeYear + 1;
137
143
  }
138
144
  var nextDate = incremleti - (userSeeDay - 1) - monthEnd;
139
- isSelectedDay = nextDate === parseInt(date) && parseInt(month) === nextMonth && parseInt(year) === nextYear ? true : false;
145
+
146
+ // isSelectedDay =
147
+ nextDate === parseInt(date) && parseInt(month) === nextMonth && parseInt(year) === nextYear ? true : false;
148
+
149
+ // isToday = nextDate === incremday && todayMonth === userSeeMonth && todayYear === userSeeYear ? true : false;
150
+
140
151
  output = /*#__PURE__*/_react["default"].createElement(Span, {
141
- i: i,
142
- isActive: isSelectedDay,
152
+ i: i
153
+ // isActive={isSelectedDay}
154
+ ,
143
155
  tdclass: "".concat(tdclass, " ").concat(_DateTimeModule["default"].invalidDate),
144
156
  handleSelect: _this2.handleSelect,
145
157
  incremday: nextDate,
146
158
  userSeeMonth: nextMonth,
147
159
  userSeeYear: nextYear,
148
- dataId: isSelectedDay ? "".concat(dataId, "_dateSelected") : "".concat(dataId, "_invalidDate"),
149
- isToday: isToday
160
+ dataId: isSelectedDay ? "".concat(dataId, "_dateSelected") : "".concat(dataId, "_invalidDate")
161
+ //isToday={isToday}
150
162
  });
151
163
  } else {
152
164
  output = /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
@@ -167,7 +167,7 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
167
167
  defaultHour = parseInt(defaultHour);
168
168
  defaultMin = parseInt(defaultMin);
169
169
  }
170
- var dateObj = isDateTimeField ? _datetimejs["default"].toDate(_datetimejs["default"].tz.utcToTz(value, timeZone)) : value ? _datetimejs["default"].toDate(value) : new Date();
170
+ var dateObj = isDateTimeField ? _datetimejs["default"].toDate(_datetimejs["default"].tz.utcToTz(value, timeZone)) : value ? _datetimejs["default"].toDate(value) : todayObj;
171
171
  date = dateObj.getDate();
172
172
  month = dateObj.getMonth();
173
173
  year = dateObj.getFullYear();
@@ -124,6 +124,16 @@
124
124
  color: var(--zdt_datetime_invaliddate_text);
125
125
  }
126
126
 
127
+ .today {
128
+ border: 1px solid var(--zdt_datetime_today_border);
129
+ border-radius: 50%;
130
+ }
131
+
132
+ .today:hover {
133
+ border: 1px solid var(--zdt_datetime_today_border);
134
+ background-color: var(--zdt_datetime_datestr_hover_bg);
135
+ }
136
+
127
137
  .active,
128
138
  .active:hover,
129
139
  .active.today,
@@ -136,15 +146,7 @@
136
146
  border-radius: 50%;
137
147
  }
138
148
 
139
- .today {
140
- border: 1px solid var(--zdt_datetime_today_border);
141
- border-radius: 50%;
142
- }
143
149
 
144
- .today:hover {
145
- border: 1px solid var(--zdt_datetime_today_border);
146
- background-color: var(--zdt_datetime_datestr_hover_bg);
147
- }
148
150
 
149
151
  .timesection {
150
152
  padding-top: var(--zd_size5);
@@ -15,6 +15,7 @@ var _DropBoxPositionMapping = require("./DropBoxPositionMapping.json");
15
15
  var _ZindexProvider = require("../Provider/ZindexProvider");
16
16
  var _Config = require("../Provider/Config");
17
17
  var _LibraryContextInit = _interopRequireDefault(require("../Provider/LibraryContextInit"));
18
+ var _FocusScope = _interopRequireDefault(require("@zohodesk/a11y/es/FocusScope/FocusScope"));
18
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
20
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
21
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -87,7 +88,8 @@ var DropBoxElement = /*#__PURE__*/function (_React$Component) {
87
88
  positionsOffset = _this$props2.positionsOffset,
88
89
  targetOffset = _this$props2.targetOffset,
89
90
  zIndexStyle = _this$props2.zIndexStyle,
90
- customStyle = _this$props2.customStyle;
91
+ customStyle = _this$props2.customStyle,
92
+ subContainerRef = _this$props2.subContainerRef;
91
93
  var _ref = this.context || {},
92
94
  isReducedMotion = _ref.isReducedMotion;
93
95
  if (!isAbsolutePositioningNeeded && size === 'default' && !isActive) {
@@ -172,9 +174,11 @@ var DropBoxElement = /*#__PURE__*/function (_React$Component) {
172
174
  "aria-labelledby": ariaLabelledby,
173
175
  tabIndex: tabIndex
174
176
  }, /*#__PURE__*/_react["default"].createElement("div", {
177
+ tabIndex: "-1",
175
178
  className: "".concat(subContainerClass, " ").concat(_DropBoxModule["default"]["".concat(palette, "Palette")]),
176
179
  onClick: onClick,
177
- "data-id": "".concat(dataId, "_subcontainer")
180
+ "data-id": "".concat(dataId, "_subcontainer"),
181
+ ref: subContainerRef
178
182
  }, isModel ? /*#__PURE__*/_react["default"].createElement("div", {
179
183
  className: _DropBoxModule["default"].closeBar
180
184
  }) : null, isArrow && !isModel && /*#__PURE__*/_react["default"].createElement("div", {
@@ -198,6 +202,7 @@ var DropBox = /*#__PURE__*/function (_React$Component2) {
198
202
  _this2 = _super2.call(this, props);
199
203
  _this2.getNextIndex = (0, _ZindexProvider.getZIndex)(_assertThisInitialized(_this2));
200
204
  _this2.onFreezeClick = _this2.onFreezeClick.bind(_assertThisInitialized(_this2));
205
+ _this2.createRef = /*#__PURE__*/_react["default"].createRef();
201
206
  return _this2;
202
207
  }
203
208
  _createClass(DropBox, [{
@@ -214,7 +219,9 @@ var DropBox = /*#__PURE__*/function (_React$Component2) {
214
219
  isActive = _this$props3.isActive,
215
220
  isAbsolutePositioningNeeded = _this$props3.isAbsolutePositioningNeeded,
216
221
  needAutoZindex = _this$props3.needAutoZindex,
217
- isRestrictScroll = _this$props3.isRestrictScroll;
222
+ isRestrictScroll = _this$props3.isRestrictScroll,
223
+ needFocusScope = _this$props3.needFocusScope,
224
+ onClose = _this$props3.onClose;
218
225
  var windowWidth,
219
226
  mobileWidth = (0, _Config.getLibraryConfig)('mobileWidth'),
220
227
  isModel = false;
@@ -229,7 +236,20 @@ var DropBox = /*#__PURE__*/function (_React$Component2) {
229
236
  } : {};
230
237
  var _ref2 = this.context || {},
231
238
  direction = _ref2.direction;
232
- var dropBoxEle = /*#__PURE__*/_react["default"].createElement(DropBoxElement, _extends({
239
+ var dropBoxEle = needFocusScope ? /*#__PURE__*/_react["default"].createElement(_FocusScope["default"], {
240
+ focusClose: onClose,
241
+ elementRef: this.createRef,
242
+ autoFocus: true,
243
+ restoreFocus: true,
244
+ focusArrowLoop: true,
245
+ enableEnterAction: true
246
+ }, /*#__PURE__*/_react["default"].createElement(DropBoxElement, _extends({
247
+ isModel: isModel,
248
+ direction: direction
249
+ }, this.props, {
250
+ zIndexStyle: zIndexStyle,
251
+ subContainerRef: this.createRef
252
+ }))) : /*#__PURE__*/_react["default"].createElement(DropBoxElement, _extends({
233
253
  isModel: isModel,
234
254
  direction: direction
235
255
  }, this.props, {
@@ -22,6 +22,7 @@ var defaultProps = {
22
22
  palette: 'default',
23
23
  needAutoZindex: true,
24
24
  portalId: 'portal1',
25
- isRestrictScroll: false
25
+ isRestrictScroll: false,
26
+ needFocusScope: false
26
27
  };
27
28
  exports.defaultProps = defaultProps;
@@ -29,6 +29,7 @@ var propTypes = {
29
29
  left: _propTypes["default"].number,
30
30
  needResponsive: _propTypes["default"].bool,
31
31
  onClick: _propTypes["default"].func,
32
+ needFocusScope: _propTypes["default"].bool,
32
33
  right: _propTypes["default"].number,
33
34
  size: _propTypes["default"].oneOf(['mini', 'xmini', 'xsmall', 'small', 'medium', 'large', 'mlarge', 'xlarge', 'xxlarge', 'default']),
34
35
  top: _propTypes["default"].number,
@@ -68,6 +68,7 @@ var ListContainer = function ListContainer(props) {
68
68
  }
69
69
  return /*#__PURE__*/_react["default"].createElement(_Layout.Container, _extends({
70
70
  role: role,
71
+ "data-a11y-inside-focus": true,
71
72
  "aria-selected": ariaSelected,
72
73
  "aria-label": ariaLabel,
73
74
  isCover: false,
@@ -82,7 +82,8 @@ var Switch = /*#__PURE__*/function (_React$Component) {
82
82
  "data-title": disabled ? disableTitle : title,
83
83
  "aria-checked": checked,
84
84
  role: "switch",
85
- tabIndex: isReadOnly || disabled ? '-1' : '0'
85
+ tabIndex: isReadOnly || disabled ? '-1' : '0',
86
+ onClick: !disabled || !isReadOnly ? this.onChange : null
86
87
  }, SwitchProps), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
87
88
  className: "".concat(_SwitchModule["default"][size], " ").concat(customSwitchSize)
88
89
  }, /*#__PURE__*/_react["default"].createElement("input", {
@@ -93,8 +94,8 @@ var Switch = /*#__PURE__*/function (_React$Component) {
93
94
  value: value,
94
95
  checked: checked,
95
96
  disabled: disabled,
96
- readOnly: isReadOnly,
97
- onClick: !disabled || !isReadOnly ? this.onChange : null
97
+ readOnly: isReadOnly
98
+ // onClick={!disabled || !isReadOnly ? this.onChange : null}
98
99
  }), /*#__PURE__*/_react["default"].createElement("label", {
99
100
  htmlFor: id,
100
101
  "data-id": dataId,
@@ -104,8 +105,9 @@ var Switch = /*#__PURE__*/function (_React$Component) {
104
105
  palette: labelPalette,
105
106
  id: id,
106
107
  size: labelSize,
107
- type: "subtitle",
108
- onClick: !disabled || !isReadOnly ? this.onChange : null,
108
+ type: "subtitle"
109
+ // onClick={!disabled || !isReadOnly ? this.onChange : null}
110
+ ,
109
111
  customClass: customLabel
110
112
  }, LabelProps)));
111
113
  }
package/lib/Tab/Tab.js CHANGED
@@ -92,7 +92,7 @@ function Tab(_ref) {
92
92
  role: "tab",
93
93
  "aria-controls": id,
94
94
  "aria-selected": isActive ? true : false,
95
- tabIndex: isLink ? undefined : isActive && !isDisabled ? '0' : '-1',
95
+ tabIndex: isLink ? undefined : isActive && !isDisabled ? '0' : '0',
96
96
  "aria-label": text ? text : null
97
97
  }, customProps), /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
98
98
  alignBox: "row",
@@ -23,7 +23,7 @@ var TabContent = function TabContent(_ref) {
23
23
  dataId: "".concat(dataId, "_TabContent"),
24
24
  isScrollAttribute: true,
25
25
  "aria-labelledby": id,
26
- tabindex: "0",
26
+ tabindex: "-1",
27
27
  role: "tabpanel"
28
28
  }, children);
29
29
  };
package/lib/Tab/Tabs.js CHANGED
@@ -489,7 +489,9 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
489
489
  isBoxPaddingNeed: true,
490
490
  isArrow: false
491
491
  }, DropBoxProps, {
492
- isResponsivePadding: true
492
+ isResponsivePadding: true,
493
+ needFocusScope: true,
494
+ onClose: _this8.togglePopup
493
495
  }), getCustomDropBoxHeaderPlaceHolder && getCustomDropBoxHeaderPlaceHolder(_this8.props), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
494
496
  flexible: true,
495
497
  shrink: true,
@@ -0,0 +1,4 @@
1
+ :root {
2
+ --lib_a11y_focusScope_focus_border:var(--zdt_a11y_focusScope_focus_border);
3
+ --lib_a11y_focusScope_focus_bg:var(--zdt_listitem_highlight_bg);
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.0.0-alpha-253",
3
+ "version": "1.0.0-alpha-255",
4
4
  "main": "es/index.js",
5
5
  "module": "es/index.js",
6
6
  "private": false,
@@ -47,7 +47,8 @@
47
47
  "@zohodesk/virtualizer": "1.0.3",
48
48
  "velocity-react": "1.4.3",
49
49
  "react-sortable-hoc": "^0.8.3",
50
- "@zohodesk/svg": "1.0.0-beta.48"
50
+ "@zohodesk/svg": "1.0.0-beta.48",
51
+ "@zohodesk/a11y": "1.3.4"
51
52
  },
52
53
  "dependencies": {
53
54
  "hoist-non-react-statics": "3.0.1",
@@ -61,7 +62,8 @@
61
62
  "@zohodesk/svg": "1.0.0-beta.49",
62
63
  "@zohodesk/virtualizer": "1.0.3",
63
64
  "velocity-react": "1.4.3",
64
- "react-sortable-hoc": "^0.8.3"
65
+ "react-sortable-hoc": "^0.8.3",
66
+ "@zohodesk/a11y": "1.3.4"
65
67
  },
66
68
  "react-cli": {
67
69
  "preprocess": {