@zohodesk/dot 1.0.0-temp-229.2 → 1.0.0-temp-230.1

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 (33) hide show
  1. package/README.md +7 -5
  2. package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +0 -3
  3. package/assets/Appearance/light/mode/Dot_LightMode.module.css +0 -3
  4. package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +0 -3
  5. package/es/AttachmentViewer/AttachmentViewer.js +115 -23
  6. package/es/AttachmentViewer/AttachmentViewer.module.css +1 -1
  7. package/es/AttachmentViewer/props/defaultProps.js +2 -1
  8. package/es/AttachmentViewer/props/propTypes.js +3 -1
  9. package/es/Link/Link.js +4 -3
  10. package/es/Link/props/propTypes.js +1 -0
  11. package/es/common/dot_boxShadow.module.css +0 -2
  12. package/es/form/fields/SelectField/SelectField.js +2 -4
  13. package/es/form/fields/SelectField/props/defaultProps.js +0 -1
  14. package/es/form/fields/SelectField/props/propTypes.js +0 -1
  15. package/es/list/status/StatusDropdown/StatusDropdown.js +79 -121
  16. package/es/list/status/StatusDropdown/StatusDropdown.module.css +7 -54
  17. package/es/list/status/StatusDropdown/props/defaultProps.js +1 -2
  18. package/es/list/status/StatusDropdown/props/propTypes.js +1 -2
  19. package/lib/AttachmentViewer/AttachmentViewer.js +177 -80
  20. package/lib/AttachmentViewer/AttachmentViewer.module.css +1 -1
  21. package/lib/AttachmentViewer/props/defaultProps.js +2 -1
  22. package/lib/AttachmentViewer/props/propTypes.js +3 -1
  23. package/lib/Link/Link.js +4 -3
  24. package/lib/Link/props/propTypes.js +1 -0
  25. package/lib/common/dot_boxShadow.module.css +0 -2
  26. package/lib/form/fields/SelectField/SelectField.js +2 -4
  27. package/lib/form/fields/SelectField/props/defaultProps.js +0 -1
  28. package/lib/form/fields/SelectField/props/propTypes.js +0 -1
  29. package/lib/list/status/StatusDropdown/StatusDropdown.js +81 -133
  30. package/lib/list/status/StatusDropdown/StatusDropdown.module.css +7 -54
  31. package/lib/list/status/StatusDropdown/props/defaultProps.js +1 -2
  32. package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
  33. package/package.json +4 -4
package/README.md CHANGED
@@ -4,12 +4,13 @@ In this Library, we Provide Some Basic Components to Build Your Application
4
4
 
5
5
  # 1.9.13
6
6
 
7
- - **StatusDropdown**
8
- - Added `renderCustomDropBoxHeader` prop to render a custom node (e.g. suggested status, banner, info message) at the top of the dropdown, above the options list.
9
- - Added `customDropBoxHeader` key under the `customClass` prop to style the custom header wrapper.
7
+ - **AttachmentViewer**
8
+ - Added support for updating existing attachment list items.
9
+ - Increased header bar height.
10
+ - Added support for `showCount`, `renderCustomIcons`, annotation URL re-rendering, and `downloadName`.
10
11
 
11
- - **SelectField**
12
- - Added `renderCustomDropBoxHeader` prop, forwarded to the underlying `Select` component to render a custom node at the top of the dropdown.
12
+ - **Link**
13
+ - Added `downloadName` prop for custom file download names.
13
14
 
14
15
  # 1.9.12
15
16
 
@@ -35,6 +36,7 @@ In this Library, we Provide Some Basic Components to Build Your Application
35
36
 
36
37
  - PX to variable conversion was not applied due to the CBT migration. The issue has now been fixed.
37
38
 
39
+
38
40
  # 1.9.8
39
41
 
40
42
  - **DotProvider** - Variables package handled and separated the component & variable import files
@@ -259,9 +259,6 @@
259
259
 
260
260
  /* status dropdown */
261
261
  --zdt_statusdropdown_line_border:var(--zdt_cta_grey_15_border);
262
- --zdt_statusdropdown_wrapper_container_border:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(100.00% + var(--zdc_default_inverse_low)), calc( 0.2 + var(--zdc_alpha_low)));
263
- --zdt_statusdropdown_wrapper_container_bg:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), 100.00%, 0.03);
264
- --zdt_statusdropdown_wrapper_dropdown_bg:hsla(217, calc(var(--zd-saturation, 1) * 23.08%), calc(17.84% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
265
262
 
266
263
  /* status listitem */
267
264
  --zdt_statuslistitem_list_text:hsla(210, calc(var(--zd-saturation, 1) * 7.41%), calc(89.41% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
@@ -259,9 +259,6 @@
259
259
 
260
260
  /* status dropdown */
261
261
  --zdt_statusdropdown_line_border:var(--zdt_cta_grey_15_border);
262
- --zdt_statusdropdown_wrapper_container_border:hsla(218, calc(var(--zd-saturation, 1) * 42.22%), calc(91.18% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
263
- --zdt_statusdropdown_wrapper_container_bg:hsla(216, calc(var(--zd-saturation, 1) * 38.46%), 97.45%, 1);
264
- --zdt_statusdropdown_wrapper_dropdown_bg:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(100.00% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
265
262
 
266
263
  /* status listitem */
267
264
  --zdt_statuslistitem_list_text:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(0.00% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
@@ -259,9 +259,6 @@
259
259
 
260
260
  /* status dropdown */
261
261
  --zdt_statusdropdown_line_border:var(--zdt_cta_grey_15_border);
262
- --zdt_statusdropdown_wrapper_container_border:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(100.00% + var(--zdc_default_inverse_low)), calc( 0.2 + var(--zdc_alpha_low)));
263
- --zdt_statusdropdown_wrapper_container_bg:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), 100.00%, 0.03);
264
- --zdt_statusdropdown_wrapper_dropdown_bg:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(12.94% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
265
262
 
266
263
  /* status listitem */
267
264
  --zdt_statuslistitem_list_text:hsla(210, calc(var(--zd-saturation, 1) * 7.41%), calc(89.41% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
@@ -47,8 +47,35 @@ export default class AttachmentViewer extends Component {
47
47
  this.zoomMaintain = this.zoomMaintain.bind(this);
48
48
  this.handleMenuValidation = this.handleMenuValidation.bind(this);
49
49
  this.getPreviewIconData = this.getPreviewIconData.bind(this);
50
- this.renderIframe = this.renderIframe.bind(this);
51
- }
50
+ this.renderIframe = this.renderIframe.bind(this); // this.updateItem = this.updateItem.bind(this);
51
+ } // updateItem(idOrIndex, changes) {
52
+ // if (!changes || typeof changes !== 'object') {
53
+ // return false;
54
+ // }
55
+ // const { data } = this.state;
56
+ // const targetIdx = typeof idOrIndex === 'number'
57
+ // ? idOrIndex
58
+ // : data.findIndex((item) => item && item.id === idOrIndex);
59
+ // if (targetIdx < 0 || targetIdx >= data.length) {
60
+ // return false;
61
+ // }
62
+ // this.setState((prevState) => {
63
+ // const nextData = prevState.data.slice();
64
+ // nextData[targetIdx] = { ...nextData[targetIdx], ...changes };
65
+ // let nextDataList = prevState.dataList;
66
+ // if (targetIdx < prevState.dataList.length) {
67
+ // nextDataList = prevState.dataList.slice();
68
+ // nextDataList[targetIdx] = { ...nextDataList[targetIdx], ...changes };
69
+ // }
70
+ // return { data: nextData, dataList: nextDataList };
71
+ // }, () => {
72
+ // if (this.state.selectedIndex === targetIdx) {
73
+ // this.handleMenuValidation();
74
+ // }
75
+ // });
76
+ // return true;
77
+ // }
78
+
52
79
 
53
80
  isImageFileType(fileName) {
54
81
  const extension = (getExtensionFromFileName(fileName) || '').toLowerCase();
@@ -80,8 +107,9 @@ export default class AttachmentViewer extends Component {
80
107
  selectedIndex
81
108
  } = this.state;
82
109
  let indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
110
+ const attachmentPreviewUrlChanged = previewObj.previewData[0]?.viewUrl !== prevState.data[0]?.viewUrl; // Triggers an update if the previewed attachment is edited by the Attachment Annotator.
83
111
 
84
- if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
112
+ if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged || attachmentPreviewUrlChanged) {
85
113
  let objChanged = previewObj.previewData.some((value, index) => {
86
114
  return shallowDiff(value, prevProps.previewObj[index]);
87
115
  });
@@ -100,7 +128,7 @@ export default class AttachmentViewer extends Component {
100
128
  }
101
129
  }
102
130
 
103
- if (prevState.selectedIndex != selectedIndex) {
131
+ if (prevState.selectedIndex != selectedIndex || attachmentPreviewUrlChanged) {
104
132
  this.handleMenuValidation();
105
133
  }
106
134
  }
@@ -308,6 +336,73 @@ export default class AttachmentViewer extends Component {
308
336
  }, this.props.customProps.iframeProps));
309
337
  }
310
338
 
339
+ getRenderImageFrameCustomClass(_ref3) {
340
+ let {
341
+ canZoom,
342
+ retainZoom,
343
+ isZoomed,
344
+ customImageClass,
345
+ customChildrenClass
346
+ } = _ref3;
347
+ return {
348
+ customImageClass: `${style.img} ${style.altText} ${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
349
+ customChildrenClass
350
+ };
351
+ }
352
+
353
+ renderImageFrame(data, i) {
354
+ const {
355
+ selectedIndex,
356
+ isZoomed,
357
+ canZoom,
358
+ isPreviewAttachmentValid
359
+ } = this.state;
360
+ const {
361
+ maintainZoom,
362
+ renderCustomImagePreviewElement
363
+ } = this.props;
364
+ const {
365
+ viewUrl,
366
+ name,
367
+ children,
368
+ dataId = 'attachViewer',
369
+ customClass = {},
370
+ customProps = {}
371
+ } = data;
372
+ const {
373
+ imageProps = {}
374
+ } = customProps;
375
+ const {
376
+ customImageClass = '',
377
+ customChildrenClass = ''
378
+ } = customClass;
379
+ const retainZoom = canZoom && selectedIndex == i && maintainZoom;
380
+ const handleZoomOut = isPreviewAttachmentValid && isZoomed ? this.zoomOut.bind(this, i) : undefined;
381
+ const handleZoomIn = isPreviewAttachmentValid && !isZoomed ? e => this.zoomIn(e, i, true) : undefined;
382
+ const handleImageClick = isPreviewAttachmentValid ? isZoomed ? handleZoomOut : handleZoomIn : undefined;
383
+ const imageFrameCustomClass = this.getRenderImageFrameCustomClass({
384
+ canZoom,
385
+ retainZoom,
386
+ isZoomed,
387
+ customImageClass,
388
+ customChildrenClass
389
+ });
390
+ const img = /*#__PURE__*/React.createElement(AttachmentImage, _extends({
391
+ customClass: imageFrameCustomClass,
392
+ src: viewUrl,
393
+ onClick: handleImageClick,
394
+ alt: name,
395
+ dataId: dataId,
396
+ id: `img${i}`,
397
+ isCover: false
398
+ }, imageProps), children);
399
+ return typeof renderCustomImagePreviewElement === 'function' ? renderCustomImagePreviewElement({
400
+ defaultView: img,
401
+ data,
402
+ index: i
403
+ }) : img;
404
+ }
405
+
311
406
  imgPreviewView(downloadUrl) {
312
407
  var _this = this;
313
408
 
@@ -404,18 +499,7 @@ export default class AttachmentViewer extends Component {
404
499
  }, videoProps), /*#__PURE__*/React.createElement("source", {
405
500
  src: viewUrl,
406
501
  type: `video/${extension}`
407
- })) : _this.isImageFileType(name) || children ? /*#__PURE__*/React.createElement(AttachmentImage, _extends({
408
- customClass: {
409
- customImageClass: `${style.img} ${style.altText} ${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
410
- customChildrenClass
411
- },
412
- src: viewUrl,
413
- onClick: isPreviewAttachmentValid ? isZoomed ? _this.zoomOut.bind(_this, i) : e => _this.zoomIn(e, i, true) : undefined,
414
- alt: name,
415
- dataId: dataId,
416
- id: `img${i}`,
417
- isCover: false
418
- }, imageProps), children) : type === "document" && previewurl != null ? _this.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/React.createElement("div", {
502
+ })) : _this.isImageFileType(name) || children ? _this.renderImageFrame(data, i) : type === "document" && previewurl != null ? _this.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/React.createElement("div", {
419
503
  className: style.previewNone
420
504
  }, /*#__PURE__*/React.createElement("div", {
421
505
  className: style.fileTypeImg
@@ -424,9 +508,10 @@ export default class AttachmentViewer extends Component {
424
508
  $ui_weight: "semibold"
425
509
  }, previewUnsupportedText), downloadUrl ? /*#__PURE__*/React.createElement(Link, {
426
510
  href: downloadUrl,
511
+ download: true,
512
+ downloadName: name,
427
513
  className: style.downloadLink,
428
- hasReload: true,
429
- download: true
514
+ hasReload: true
430
515
  }, /*#__PURE__*/React.createElement(Button, {
431
516
  palette: "primaryFilled",
432
517
  text: downloadText
@@ -449,7 +534,9 @@ export default class AttachmentViewer extends Component {
449
534
  i18nKeys,
450
535
  isActive,
451
536
  dataId,
452
- customProps
537
+ customProps,
538
+ showCount,
539
+ renderCustomIcons
453
540
  } = this.props;
454
541
  const {
455
542
  avatarProps = {}
@@ -477,10 +564,10 @@ export default class AttachmentViewer extends Component {
477
564
  }, /*#__PURE__*/React.createElement(ResponsiveReceiver, {
478
565
  responsiveId: responsiveId,
479
566
  query: this.responsiveFunc
480
- }, _ref3 => {
567
+ }, _ref4 => {
481
568
  let {
482
569
  uptoTablet
483
- } = _ref3;
570
+ } = _ref4;
484
571
  return /*#__PURE__*/React.createElement(Container, {
485
572
  scroll: "none",
486
573
  "data-scroll-palette": "dark"
@@ -495,7 +582,7 @@ export default class AttachmentViewer extends Component {
495
582
  "data-title": selectedAttachment.name,
496
583
  dataId: "attachName",
497
584
  id: ariaId
498
- }, selectedAttachment.name), /*#__PURE__*/React.createElement(Box, {
585
+ }, selectedAttachment.name), showCount && /*#__PURE__*/React.createElement(Box, {
499
586
  flexible: true,
500
587
  className: style.count,
501
588
  dataId: "attachCountContainer"
@@ -507,7 +594,11 @@ export default class AttachmentViewer extends Component {
507
594
  align: uptoTablet ? 'bottom' : 'center',
508
595
  wrap: "wrap",
509
596
  isCover: false
510
- }, canZoom ? isZoomed ? /*#__PURE__*/React.createElement("div", {
597
+ }, typeof renderCustomIcons === 'function' && renderCustomIcons({
598
+ selectedAttachment,
599
+ selectedIndex,
600
+ totalLen
601
+ }), canZoom ? isZoomed ? /*#__PURE__*/React.createElement("div", {
511
602
  className: uptoTablet ? style.mobileMenu : style.menu,
512
603
  onClick: this.zoomOut.bind(this, selectedIndex),
513
604
  "data-id": "zoomOut",
@@ -555,6 +646,7 @@ export default class AttachmentViewer extends Component {
555
646
  className: uptoTablet ? style.mobileMenu : style.menu
556
647
  }, /*#__PURE__*/React.createElement(Link, {
557
648
  href: downloadUrl,
649
+ downloadName: selectedAttachment.name,
558
650
  target: "_parent",
559
651
  hasReload: true,
560
652
  download: true,
@@ -1,5 +1,5 @@
1
1
  .header {
2
- height: var(--zd_size40) ;
2
+ height: var(--zd_size48) ;
3
3
  position: relative;
4
4
  z-index: 1;
5
5
  padding-block:0 ;
@@ -12,5 +12,6 @@ export const AttachmentViewer_defaultProps = {
12
12
  isActive: false,
13
13
  dataId: 'AttachmentViewer',
14
14
  i18nKeys: {},
15
- customProps: {}
15
+ customProps: {},
16
+ showCount: true
16
17
  };
@@ -44,5 +44,7 @@ export const AttachmentViewer_propTypes = {
44
44
  renderUnSupportedElement: PropTypes.func,
45
45
  customProps: PropTypes.shape({
46
46
  avatarProps: PropTypes.exact(AvatarProps)
47
- })
47
+ }),
48
+ showCount: PropTypes.bool,
49
+ renderCustomIcons: PropTypes.func
48
50
  };
package/es/Link/Link.js CHANGED
@@ -61,7 +61,8 @@ export default class Link extends React.Component {
61
61
  rel,
62
62
  dataId,
63
63
  customProps,
64
- ariaLabel
64
+ ariaLabel,
65
+ downloadName
65
66
  } = this.props;
66
67
  let {
67
68
  isLink,
@@ -71,10 +72,10 @@ export default class Link extends React.Component {
71
72
  let option = {};
72
73
 
73
74
  if (download) {
74
- option.download = true;
75
+ option.download = downloadName || true;
75
76
  }
76
77
 
77
- let ignoreKeys = ['children', 'href', 'target', 'urlData', 'urlName', 'className', 'title', 'download', 'rel', 'dataId', 'hasReload', 'customProps', 'option', 'ariaLabel'];
78
+ let ignoreKeys = ['children', 'href', 'target', 'urlData', 'urlName', 'className', 'title', 'download', 'downloadName', 'rel', 'dataId', 'hasReload', 'customProps', 'option', 'ariaLabel'];
78
79
  let others = Object.keys(this.props).filter(key => ignoreKeys.indexOf(key) == -1).reduce((res, key) => {
79
80
  res[key] = this.props[key];
80
81
  return res;
@@ -13,6 +13,7 @@ export const propTypes = {
13
13
  customProps: PropTypes.object,
14
14
  onClick: PropTypes.func,
15
15
  download: PropTypes.bool,
16
+ downloadName: PropTypes.string,
16
17
  ariaLabel: PropTypes.string,
17
18
  key: PropTypes.string
18
19
  };
@@ -40,6 +40,4 @@
40
40
  --zd_bs_onboarding_close_icon: var(--zd_bs_contrast_outline, 0px 2px 15px var(--zd-shadow-saturation, rgba(0, 0, 0, 0.09)));
41
41
  --zd_bs_onboarding_gradient: var(--zd_bs_contrast_outline, 0px 20px 30px 0px var(--zdt_onboarding_bg_box_shadow));
42
42
  --zd_bs_onboarding_primary_button: var(--zd_bs_contrast_outline, 0px 4px 20px 0px var(--zdt_onboarding_primary_button_shadow));
43
- /* status dropdown */
44
- --zd_bs_statusdropdown_wrapper_container: var(--zd_bs_contrast_outline, 3px 3px 26px 0 var(--zdt_texteditor_menu_after_box_shadow));
45
43
  }
@@ -97,8 +97,7 @@ export default class SelectField extends PureComponent {
97
97
  onFocus,
98
98
  iconOnHover,
99
99
  customProps,
100
- renderLabelProps,
101
- renderCustomDropBoxHeader
100
+ renderLabelProps
102
101
  } = this.props;
103
102
  const {
104
103
  LabelProps = {},
@@ -168,8 +167,7 @@ export default class SelectField extends PureComponent {
168
167
  iconOnHover: iconOnHover,
169
168
  title: title
170
169
  }, SelectProps, {
171
- ariaLabelledby: uniqueId,
172
- renderCustomDropBoxHeader: renderCustomDropBoxHeader
170
+ ariaLabelledby: uniqueId
173
171
  }), children ? children : null)), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
174
172
  text: validationMessage,
175
173
  palette: validationPalette,
@@ -13,7 +13,6 @@ export const defaultProps = {
13
13
  isDefaultSelectValue: true,
14
14
  placeHolder: '',
15
15
  customProps: {},
16
- renderCustomDropBoxHeader: null,
17
16
  dataSelectorId: 'selectField',
18
17
  ...FieldCommonDefaultProps()
19
18
  };
@@ -45,7 +45,6 @@ export const propTypes = {
45
45
  ValidationMessageProps1: PropTypes.object,
46
46
  ValidationMessageProps2: PropTypes.object
47
47
  }),
48
- renderCustomDropBoxHeader: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
49
48
  htmlId: PropTypes.string,
50
49
  ...FieldCommonPropTypes
51
50
  };
@@ -13,7 +13,6 @@ import StatusListItem from "../StatusListItem/StatusListItem";
13
13
  import commonStyle from '@zohodesk/components/es/common/common.module.css';
14
14
  import ResponsiveDropBox from '@zohodesk/components/es/ResponsiveDropBox/ResponsiveDropBox';
15
15
  import { ResponsiveReceiver } from '@zohodesk/components/es/Responsive/CustomResponsive';
16
- import Flex from '@zohodesk/layout/es/Flex/Flex';
17
16
  import { getUniqueId } from '@zohodesk/components/es/Provider/IdProvider';
18
17
  import btnStyle from '@zohodesk/components/es/semantic/Button/semanticButton.module.css';
19
18
  import style from "./StatusDropdown.module.css";
@@ -31,11 +30,6 @@ export class StatusDropdown extends React.Component {
31
30
  this.searchList = this.searchList.bind(this);
32
31
  this.handleScroll = this.handleScroll.bind(this);
33
32
  this.emptySearchSVG = this.emptySearchSVG.bind(this);
34
- this.getSearchA11y = this.getSearchA11y.bind(this);
35
- this.getHeadingA11y = this.getHeadingA11y.bind(this);
36
- this.getListItemA11y = this.getListItemA11y.bind(this);
37
- this.getTextBoxIconCustomProps = this.getTextBoxIconCustomProps.bind(this);
38
- this.handleListItemClick = this.handleListItemClick.bind(this);
39
33
  this.getAriaId = getUniqueId(this);
40
34
  }
41
35
 
@@ -130,44 +124,6 @@ export class StatusDropdown extends React.Component {
130
124
  };
131
125
  }
132
126
 
133
- getSearchA11y() {
134
- return {
135
- ariaHaspopup: this.props.isSearch ? 'listbox' : 'menu',
136
- ariaExpanded: this.props.isPopupReady,
137
- role: 'combobox',
138
- ariaActivedescendant: this.props.isPopupReady ? this.props.value : '',
139
- ariaOwns: this.getAriaId()
140
- };
141
- }
142
-
143
- getHeadingA11y() {
144
- return {
145
- role: 'heading'
146
- };
147
- }
148
-
149
- getListItemA11y(isActive, listItemText) {
150
- return {
151
- role: this.props.isSearch ? 'option' : 'menuitem',
152
- ariaSelected: isActive,
153
- ariaLabel: listItemText
154
- };
155
- }
156
-
157
- getTextBoxIconCustomProps() {
158
- return {
159
- TextBoxProps: {
160
- 'data-a11y-autofocus': true
161
- }
162
- };
163
- }
164
-
165
- handleListItemClick(item) {
166
- return e => {
167
- this.onSelect(item, e);
168
- };
169
- }
170
-
171
127
  render() {
172
128
  let {
173
129
  options
@@ -223,12 +179,10 @@ export class StatusDropdown extends React.Component {
223
179
  renderTargetElement,
224
180
  renderFooterElement,
225
181
  a11y = {},
226
- customClass,
227
- renderCustomDropBoxHeader
182
+ customClass
228
183
  } = this.props;
229
184
  const {
230
- dropBoxClass = '',
231
- customDropBoxHeader = ''
185
+ dropBoxClass = ''
232
186
  } = customClass;
233
187
  const {
234
188
  tabIndex = 0,
@@ -241,9 +195,6 @@ export class StatusDropdown extends React.Component {
241
195
  } = this.state;
242
196
  let containerClass = `${className ? className : ''} ${isPopupReady ? activeStyle ? activeStyle : '' : showIconOnHover ? style.hoverIcon : ''} ${isDisabled ? commonStyle.disabled : isReadOnly ? style.readOnly : !isEditable ? style.cursorDefault : !showOnHover ? `${style.cursor} ${hoverStyle ? hoverStyle : ''}` : `${hoverStyle ? hoverStyle : ''} ${style.cursorDefault}`}`;
243
197
  let ariaTitleId = this.getAriaId();
244
- let textBoxA11y = this.getSearchA11y();
245
- let headingA11y = this.getHeadingA11y();
246
- let textBoxIconCustomProps = this.getTextBoxIconCustomProps();
247
198
  return /*#__PURE__*/React.createElement("div", {
248
199
  className: style.posRel,
249
200
  onMouseEnter: showOnHover && !isDisabled && !isReadOnly && isEditable ? this.handleTogglePopup : undefined,
@@ -300,8 +251,8 @@ export class StatusDropdown extends React.Component {
300
251
  isAnimate: true,
301
252
  getRef: getContainerRef,
302
253
  customClass: {
303
- customDropBoxWrap: `${style.dropBoxContainer} `,
304
- customDropBox: `${dropBoxClass} ${renderCustomDropBoxHeader ? style.dropBoxWithCustomHeader : ''}`
254
+ customDropBoxWrap: style.dropBoxContainer,
255
+ customDropBox: dropBoxClass
305
256
  },
306
257
  needResponsive: needResponsive,
307
258
  isResponsivePadding: true,
@@ -319,74 +270,81 @@ export class StatusDropdown extends React.Component {
319
270
  isFetchingOptions: isFetchingOptions
320
271
  }
321
272
  }
322
- }, (() => {
323
- const dropdownContent = /*#__PURE__*/React.createElement(React.Fragment, null, isSearch ? /*#__PURE__*/React.createElement(Box, {
324
- className: style.search
325
- }, /*#__PURE__*/React.createElement(TextBoxIcon, {
326
- placeHolder: placeHolderText,
327
- onChange: this.handleChange,
328
- value: searchString,
329
- onClear: this.onSearchClear,
330
- size: searchBoxSize,
331
- customProps: textBoxIconCustomProps,
332
- a11y: textBoxA11y,
333
- dataId: `${dataId}_search`
334
- })) : null, title && options.length != 0 && /*#__PURE__*/React.createElement(Box, {
335
- className: style.title
336
- }, /*#__PURE__*/React.createElement(DropDownHeading, {
337
- htmlId: ariaTitleId,
338
- text: title,
339
- a11y: headingA11y
340
- })), /*#__PURE__*/React.createElement(Box, {
341
- scroll: "vertical",
342
- flexible: true,
343
- shrink: true,
344
- dataId: `${dataId}_list`,
345
- preventParentScroll: "vertical",
346
- className: `${tabletMode ? style.responsivemaxHgt : style.maxHgt}`,
347
- onScroll: this.handleScroll,
348
- role: isSearch ? 'listbox' : 'menu',
349
- tabindex: "-1",
350
- isScrollAttribute: true
351
- }, options.length != 0 && isDataLoaded ? /*#__PURE__*/React.createElement(React.Fragment, null, options.map((item, i) => {
352
- const listItemText = item[keyName];
353
- const isActive = value === listItemText;
354
- return /*#__PURE__*/React.createElement(StatusListItem, {
355
- key: item[idName] || i,
356
- dataId: `dataid_${i}`,
357
- value: listItemText,
358
- id: item[idName],
359
- active: isActive,
360
- onClick: this.handleListItemClick(item),
361
- index: i,
362
- needTick: needTick,
363
- needBorder: false,
364
- bulletColor: item[statusColor],
365
- title: listItemText,
366
- needMultiLineText: needMultiLineText,
367
- autoHover: true,
368
- a11y: this.getListItemA11y(isActive, listItemText)
369
- });
370
- }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
371
- isCover: false,
372
- align: "both"
373
- }, /*#__PURE__*/React.createElement(Loader, null))) : isDataLoaded ? /*#__PURE__*/React.createElement(CommonEmptyState, {
374
- className: style.svgWrapper,
375
- title: searchErrorText || 'No results',
376
- description: searchEmptyHint,
377
- size: "small",
378
- getEmptyState: this.emptySearchSVG
379
- }) : /*#__PURE__*/React.createElement("div", {
380
- className: style.loader
381
- }, /*#__PURE__*/React.createElement(Loader, null))), renderFooterElement ? renderFooterElement : null);
382
- return renderCustomDropBoxHeader ? /*#__PURE__*/React.createElement("div", {
383
- className: style.dropBoxListContainer
384
- }, /*#__PURE__*/React.createElement(Flex, {
385
- $ui_className: `${customDropBoxHeader} ${style.customDropBoxHeaderContainer}`
386
- }, renderCustomDropBoxHeader), /*#__PURE__*/React.createElement("div", {
387
- className: style.dropdownOptions
388
- }, dropdownContent)) : dropdownContent;
389
- })());
273
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, isSearch ? /*#__PURE__*/React.createElement(Box, {
274
+ className: style.search
275
+ }, /*#__PURE__*/React.createElement(TextBoxIcon, {
276
+ placeHolder: placeHolderText,
277
+ onChange: this.handleChange,
278
+ value: searchString,
279
+ onClear: this.onSearchClear,
280
+ size: searchBoxSize,
281
+ customProps: {
282
+ TextBoxProps: {
283
+ 'data-a11y-autofocus': true
284
+ }
285
+ },
286
+ a11y: {
287
+ ariaHaspopup: isSearch ? 'listbox' : 'menu',
288
+ ariaExpanded: isPopupReady,
289
+ role: 'combobox',
290
+ ariaActivedescendant: isPopupReady ? value : '',
291
+ ariaOwns: ariaTitleId
292
+ },
293
+ dataId: `${dataId}_search`
294
+ })) : null, title && options.length != 0 && /*#__PURE__*/React.createElement(Box, {
295
+ className: style.title
296
+ }, /*#__PURE__*/React.createElement(DropDownHeading, {
297
+ htmlId: ariaTitleId,
298
+ text: title,
299
+ a11y: {
300
+ role: 'heading'
301
+ }
302
+ })), /*#__PURE__*/React.createElement(Box, {
303
+ scroll: "vertical",
304
+ flexible: true,
305
+ shrink: true,
306
+ dataId: `${dataId}_list`,
307
+ preventParentScroll: "vertical",
308
+ className: `${tabletMode ? style.responsivemaxHgt : style.maxHgt}`,
309
+ onScroll: this.handleScroll,
310
+ role: isSearch ? 'listbox' : 'menu',
311
+ tabindex: "-1",
312
+ isScrollAttribute: true
313
+ }, options.length != 0 && isDataLoaded ? /*#__PURE__*/React.createElement(React.Fragment, null, options.map((item, i) => {
314
+ const listItemText = item[keyName];
315
+ const isActive = value === listItemText;
316
+ return /*#__PURE__*/React.createElement(StatusListItem, {
317
+ key: i,
318
+ dataId: `dataid_${i}`,
319
+ value: listItemText,
320
+ id: item[idName],
321
+ active: isActive,
322
+ onClick: this.onSelect.bind(this, item),
323
+ index: i,
324
+ needTick: needTick,
325
+ needBorder: false,
326
+ bulletColor: item[statusColor],
327
+ title: listItemText,
328
+ needMultiLineText: needMultiLineText,
329
+ autoHover: true,
330
+ a11y: {
331
+ role: isSearch ? 'option' : 'menuitem',
332
+ ariaSelected: isActive,
333
+ ariaLabel: listItemText
334
+ }
335
+ });
336
+ }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
337
+ isCover: false,
338
+ align: "both"
339
+ }, /*#__PURE__*/React.createElement(Loader, null))) : isDataLoaded ? /*#__PURE__*/React.createElement(CommonEmptyState, {
340
+ className: style.svgWrapper,
341
+ title: searchErrorText || 'No results',
342
+ description: searchEmptyHint,
343
+ size: "small",
344
+ getEmptyState: this.emptySearchSVG
345
+ }) : /*#__PURE__*/React.createElement("div", {
346
+ className: style.loader
347
+ }, /*#__PURE__*/React.createElement(Loader, null))), renderFooterElement ? renderFooterElement : null));
390
348
  }) : null);
391
349
  }
392
350