@zohodesk/dot 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +555 -0
- package/assets/Appearance/dark/themes/blue/blue_DotTheme_DarkTheme.module.css +16 -0
- package/assets/Appearance/dark/themes/green/green_DotTheme_DarkTheme.module.css +16 -0
- package/assets/Appearance/dark/themes/orange/orange_DotTheme_DarkTheme.module.css +16 -0
- package/assets/Appearance/dark/themes/red/red_DotTheme_DarkTheme.module.css +16 -0
- package/assets/Appearance/dark/themes/yellow/yellow_DotTheme_DarkTheme.module.css +16 -0
- package/assets/Appearance/light/mode/Dot_LightMode.module.css +555 -0
- package/assets/Appearance/light/themes/blue/blue_DotTheme_LightTheme.module.css +16 -0
- package/assets/Appearance/light/themes/green/green_DotTheme_LightTheme.module.css +16 -0
- package/assets/Appearance/light/themes/orange/orange_DotTheme_LightTheme.module.css +16 -0
- package/assets/Appearance/light/themes/red/red_DotTheme_LightTheme.module.css +16 -0
- package/assets/Appearance/light/themes/yellow/yellow_DotTheme_LightTheme.module.css +16 -0
- package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +555 -0
- package/assets/Appearance/pureDark/themes/blue/blue_DotTheme_PureDarkTheme.module.css +16 -0
- package/assets/Appearance/pureDark/themes/green/green_DotTheme_PureDarkTheme.module.css +16 -0
- package/assets/Appearance/pureDark/themes/orange/orange_DotTheme_PureDarkTheme.module.css +16 -0
- package/assets/Appearance/pureDark/themes/red/red_DotTheme_PureDarkTheme.module.css +16 -0
- package/assets/Appearance/pureDark/themes/yellow/yellow_DotTheme_PureDarkTheme.module.css +16 -0
- package/coverage/ExternalLink/ExternalLink.js.html +229 -0
- package/coverage/ExternalLink/ExternalLink.module.css.html +94 -0
- package/coverage/ExternalLink/index.html +131 -0
- package/coverage/ExternalLink/props/defaultProps.js.html +100 -0
- package/coverage/ExternalLink/props/index.html +131 -0
- package/coverage/ExternalLink/props/propTypes.js.html +124 -0
- package/coverage/Image/Image.js.html +184 -0
- package/coverage/Image/Image.module.css.html +118 -0
- package/coverage/Image/index.html +131 -0
- package/coverage/Image/props/defaultProps.js.html +97 -0
- package/coverage/Image/props/index.html +131 -0
- package/coverage/Image/props/propTypes.js.html +127 -0
- package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.js.html +448 -0
- package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.module.css.html +133 -0
- package/coverage/avatar/AvatarWithTeam/index.html +131 -0
- package/coverage/avatar/AvatarWithTeam/props/defaultProps.js.html +112 -0
- package/coverage/avatar/AvatarWithTeam/props/index.html +131 -0
- package/coverage/avatar/AvatarWithTeam/props/propTypes.js.html +163 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/coverage-final.json +13 -0
- package/coverage/coverage-summary.json +14 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +191 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/es/FreezeLayer/FreezeLayer.js +1 -1
- package/es/FreezeLayer/css/cssJSLogic.js +1 -1
- package/es/Image/__tests__/Image.spec.js +70 -0
- package/es/Image/__tests__/__snapshots__/Image.spec.js.snap +74 -0
- package/es/Loader/Loader.js +1 -5
- package/es/alert/AlertHeader/props/propTypes.js +1 -1
- package/es/v1/ActionButton/ActionButton.js +137 -0
- package/es/v1/AlphabeticList/AlphabeticList.js +90 -0
- package/es/v1/Drawer/Drawer.js +271 -0
- package/es/v1/FlipCard/FlipCard.js +130 -0
- package/es/v1/FormAction/FormAction.js +75 -0
- package/es/v1/IconButton/IconButton.js +113 -0
- package/es/v1/ImportantNotes/ImportantNotes.js +41 -0
- package/es/v1/Link/Link.js +95 -0
- package/es/v1/MessageBanner/MessageBanner.js +58 -0
- package/es/v1/TagWithIcon/TagWithIcon.js +39 -0
- package/es/v1/alert/AlertHeader/AlertHeader.js +70 -0
- package/es/v1/alert/AlertLookup/AlertLookup.js +104 -0
- package/es/v1/emptystate/CommonEmptyState/CommonEmptyState.js +63 -0
- package/es/v1/emptystate/EditionPage/EditionPage.js +51 -0
- package/es/v1/lookup/Lookup/Lookup.js +105 -0
- package/es/v1/setup/table/Table/Table.js +22 -0
- package/es/v1/setup/table/TableBody/TableBody.js +26 -0
- package/es/v1/setup/table/TableData/TableData.js +31 -0
- package/es/v1/setup/table/TableHead/TableHead.js +31 -0
- package/es/v1/setup/table/TableRow/TableRow.js +36 -0
- package/es/v1/setup/table/Text/Text.js +50 -0
- package/es/v1/version2/AlertClose/AlertClose.js +43 -0
- package/es/v1/version2/GlobalNotification/GlobalNotification.js +111 -0
- package/es/v1/version2/alertIcons/AlarmAlertIcon.js +65 -0
- package/es/v1/version2/alertIcons/AlertIcons.js +57 -0
- package/es/v1/version2/alertIcons/DangerAlertIcon.js +65 -0
- package/es/v1/version2/alertIcons/ErrorAlertIcon.js +70 -0
- package/es/v1/version2/alertIcons/InfoAlertIcon.js +74 -0
- package/es/v1/version2/alertIcons/NotificationAlertIcon.js +70 -0
- package/es/v1/version2/alertIcons/SuccessAlertIcon.js +65 -0
- package/es/v1/version2/alertIcons/WarningAlertIcon.js +65 -0
- package/es/v1/version2/errorstate/Inconvenience/Inconvenience.js +63 -0
- package/es/v1/version2/errorstate/OopsSomethingMiss/OopsSomethingMiss.js +64 -0
- package/es/v1/version2/errorstate/UnableToProcessRequest/UnableToProcessRequest.js +63 -0
- package/es/v1/version2/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +65 -0
- package/es/v1/version2/errorstate/UrlNotFound/UrlNotFound.js +63 -0
- package/es/v1/version2/errorstate/WillBeRightBack/WillBeRightBack.js +63 -0
- package/es/v1/version2/lookup/AlertLookup/AlertLookup.js +152 -0
- package/es/v1/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.js +54 -0
- package/es/version2/GlobalNotification/GlobalNotification.js +1 -1
- package/es/version2/lookup/AlertHeader/AlertHeader.js +1 -1
- package/es/version2/lookup/AlertHeader/css/cssJSLogic.js +1 -1
- package/lib/FreezeLayer/FreezeLayer.js +1 -1
- package/lib/FreezeLayer/css/cssJSLogic.js +1 -1
- package/lib/Image/__tests__/Image.spec.js +77 -0
- package/lib/Image/__tests__/__snapshots__/Image.spec.js.snap +74 -0
- package/lib/Loader/Loader.js +1 -6
- package/lib/alert/AlertHeader/props/propTypes.js +1 -1
- package/lib/v1/ActionButton/ActionButton.js +156 -0
- package/lib/v1/AlphabeticList/AlphabeticList.js +111 -0
- package/lib/v1/Drawer/Drawer.js +302 -0
- package/lib/v1/FlipCard/FlipCard.js +149 -0
- package/lib/v1/FormAction/FormAction.js +102 -0
- package/lib/v1/IconButton/IconButton.js +149 -0
- package/lib/v1/ImportantNotes/ImportantNotes.js +55 -0
- package/lib/v1/Link/Link.js +116 -0
- package/lib/v1/MessageBanner/MessageBanner.js +73 -0
- package/lib/v1/TagWithIcon/TagWithIcon.js +53 -0
- package/lib/v1/alert/AlertHeader/AlertHeader.js +86 -0
- package/lib/v1/alert/AlertLookup/AlertLookup.js +118 -0
- package/lib/v1/emptystate/CommonEmptyState/CommonEmptyState.js +76 -0
- package/lib/v1/emptystate/EditionPage/EditionPage.js +64 -0
- package/lib/v1/lookup/Lookup/Lookup.js +130 -0
- package/lib/v1/setup/table/Table/Table.js +34 -0
- package/lib/v1/setup/table/TableBody/TableBody.js +39 -0
- package/lib/v1/setup/table/TableData/TableData.js +44 -0
- package/lib/v1/setup/table/TableHead/TableHead.js +44 -0
- package/lib/v1/setup/table/TableRow/TableRow.js +49 -0
- package/lib/v1/setup/table/Text/Text.js +64 -0
- package/lib/v1/version2/AlertClose/AlertClose.js +62 -0
- package/lib/v1/version2/GlobalNotification/GlobalNotification.js +134 -0
- package/lib/v1/version2/alertIcons/AlarmAlertIcon.js +77 -0
- package/lib/v1/version2/alertIcons/AlertIcons.js +78 -0
- package/lib/v1/version2/alertIcons/DangerAlertIcon.js +77 -0
- package/lib/v1/version2/alertIcons/ErrorAlertIcon.js +82 -0
- package/lib/v1/version2/alertIcons/InfoAlertIcon.js +86 -0
- package/lib/v1/version2/alertIcons/NotificationAlertIcon.js +82 -0
- package/lib/v1/version2/alertIcons/SuccessAlertIcon.js +77 -0
- package/lib/v1/version2/alertIcons/WarningAlertIcon.js +77 -0
- package/lib/v1/version2/errorstate/Inconvenience/Inconvenience.js +79 -0
- package/lib/v1/version2/errorstate/OopsSomethingMiss/OopsSomethingMiss.js +80 -0
- package/lib/v1/version2/errorstate/UnableToProcessRequest/UnableToProcessRequest.js +79 -0
- package/lib/v1/version2/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +81 -0
- package/lib/v1/version2/errorstate/UrlNotFound/UrlNotFound.js +79 -0
- package/lib/v1/version2/errorstate/WillBeRightBack/WillBeRightBack.js +79 -0
- package/lib/v1/version2/lookup/AlertLookup/AlertLookup.js +173 -0
- package/lib/v1/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.js +76 -0
- package/lib/version2/GlobalNotification/GlobalNotification.js +2 -2
- package/lib/version2/lookup/AlertHeader/AlertHeader.js +1 -1
- package/lib/version2/lookup/AlertHeader/css/cssJSLogic.js +1 -1
- package/package.json +22 -47
- package/react-cli.config.js +24 -0
- package/result.json +1 -0
- package/unittest/index.html +37 -0
- package/assets/Appearance/dark/mode/dotDarkMode.module.css +0 -555
- package/assets/Appearance/dark/themes/blue/blueDarkDotTheme.module.css +0 -16
- package/assets/Appearance/dark/themes/green/greenDarkDotTheme.module.css +0 -16
- package/assets/Appearance/dark/themes/orange/orangeDarkDotTheme.module.css +0 -16
- package/assets/Appearance/dark/themes/red/redDarkDotTheme.module.css +0 -16
- package/assets/Appearance/dark/themes/yellow/yellowDarkDotTheme.module.css +0 -16
- package/assets/Appearance/default/mode/dotDefaultMode.module.css +0 -555
- package/assets/Appearance/default/themes/blue/blueDefaultDotTheme.module.css +0 -16
- package/assets/Appearance/default/themes/green/greenDefaultDotTheme.module.css +0 -16
- package/assets/Appearance/default/themes/orange/orangeDefaultDotTheme.module.css +0 -16
- package/assets/Appearance/default/themes/red/redDefaultDotTheme.module.css +0 -16
- package/assets/Appearance/default/themes/yellow/yellowDefaultDotTheme.module.css +0 -16
- package/assets/Appearance/pureDark/mode/dotPureDarkMode.module.css +0 -555
- package/assets/Appearance/pureDark/themes/blue/bluePureDarkDotTheme.module.css +0 -16
- package/assets/Appearance/pureDark/themes/green/greenPureDarkDotTheme.module.css +0 -16
- package/assets/Appearance/pureDark/themes/orange/orangePureDarkDotTheme.module.css +0 -16
- package/assets/Appearance/pureDark/themes/red/redPureDarkDotTheme.module.css +0 -16
- package/assets/Appearance/pureDark/themes/yellow/yellowPureDarkDotTheme.module.css +0 -16
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
var addSorting = (function() {
|
|
3
|
+
'use strict';
|
|
4
|
+
var cols,
|
|
5
|
+
currentSort = {
|
|
6
|
+
index: 0,
|
|
7
|
+
desc: false
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// returns the summary table element
|
|
11
|
+
function getTable() {
|
|
12
|
+
return document.querySelector('.coverage-summary');
|
|
13
|
+
}
|
|
14
|
+
// returns the thead element of the summary table
|
|
15
|
+
function getTableHeader() {
|
|
16
|
+
return getTable().querySelector('thead tr');
|
|
17
|
+
}
|
|
18
|
+
// returns the tbody element of the summary table
|
|
19
|
+
function getTableBody() {
|
|
20
|
+
return getTable().querySelector('tbody');
|
|
21
|
+
}
|
|
22
|
+
// returns the th element for nth column
|
|
23
|
+
function getNthColumn(n) {
|
|
24
|
+
return getTableHeader().querySelectorAll('th')[n];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function onFilterInput() {
|
|
28
|
+
const searchValue = document.getElementById('fileSearch').value;
|
|
29
|
+
const rows = document.getElementsByTagName('tbody')[0].children;
|
|
30
|
+
for (let i = 0; i < rows.length; i++) {
|
|
31
|
+
const row = rows[i];
|
|
32
|
+
if (
|
|
33
|
+
row.textContent
|
|
34
|
+
.toLowerCase()
|
|
35
|
+
.includes(searchValue.toLowerCase())
|
|
36
|
+
) {
|
|
37
|
+
row.style.display = '';
|
|
38
|
+
} else {
|
|
39
|
+
row.style.display = 'none';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// loads the search box
|
|
45
|
+
function addSearchBox() {
|
|
46
|
+
var template = document.getElementById('filterTemplate');
|
|
47
|
+
var templateClone = template.content.cloneNode(true);
|
|
48
|
+
templateClone.getElementById('fileSearch').oninput = onFilterInput;
|
|
49
|
+
template.parentElement.appendChild(templateClone);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// loads all columns
|
|
53
|
+
function loadColumns() {
|
|
54
|
+
var colNodes = getTableHeader().querySelectorAll('th'),
|
|
55
|
+
colNode,
|
|
56
|
+
cols = [],
|
|
57
|
+
col,
|
|
58
|
+
i;
|
|
59
|
+
|
|
60
|
+
for (i = 0; i < colNodes.length; i += 1) {
|
|
61
|
+
colNode = colNodes[i];
|
|
62
|
+
col = {
|
|
63
|
+
key: colNode.getAttribute('data-col'),
|
|
64
|
+
sortable: !colNode.getAttribute('data-nosort'),
|
|
65
|
+
type: colNode.getAttribute('data-type') || 'string'
|
|
66
|
+
};
|
|
67
|
+
cols.push(col);
|
|
68
|
+
if (col.sortable) {
|
|
69
|
+
col.defaultDescSort = col.type === 'number';
|
|
70
|
+
colNode.innerHTML =
|
|
71
|
+
colNode.innerHTML + '<span class="sorter"></span>';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return cols;
|
|
75
|
+
}
|
|
76
|
+
// attaches a data attribute to every tr element with an object
|
|
77
|
+
// of data values keyed by column name
|
|
78
|
+
function loadRowData(tableRow) {
|
|
79
|
+
var tableCols = tableRow.querySelectorAll('td'),
|
|
80
|
+
colNode,
|
|
81
|
+
col,
|
|
82
|
+
data = {},
|
|
83
|
+
i,
|
|
84
|
+
val;
|
|
85
|
+
for (i = 0; i < tableCols.length; i += 1) {
|
|
86
|
+
colNode = tableCols[i];
|
|
87
|
+
col = cols[i];
|
|
88
|
+
val = colNode.getAttribute('data-value');
|
|
89
|
+
if (col.type === 'number') {
|
|
90
|
+
val = Number(val);
|
|
91
|
+
}
|
|
92
|
+
data[col.key] = val;
|
|
93
|
+
}
|
|
94
|
+
return data;
|
|
95
|
+
}
|
|
96
|
+
// loads all row data
|
|
97
|
+
function loadData() {
|
|
98
|
+
var rows = getTableBody().querySelectorAll('tr'),
|
|
99
|
+
i;
|
|
100
|
+
|
|
101
|
+
for (i = 0; i < rows.length; i += 1) {
|
|
102
|
+
rows[i].data = loadRowData(rows[i]);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// sorts the table using the data for the ith column
|
|
106
|
+
function sortByIndex(index, desc) {
|
|
107
|
+
var key = cols[index].key,
|
|
108
|
+
sorter = function(a, b) {
|
|
109
|
+
a = a.data[key];
|
|
110
|
+
b = b.data[key];
|
|
111
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
112
|
+
},
|
|
113
|
+
finalSorter = sorter,
|
|
114
|
+
tableBody = document.querySelector('.coverage-summary tbody'),
|
|
115
|
+
rowNodes = tableBody.querySelectorAll('tr'),
|
|
116
|
+
rows = [],
|
|
117
|
+
i;
|
|
118
|
+
|
|
119
|
+
if (desc) {
|
|
120
|
+
finalSorter = function(a, b) {
|
|
121
|
+
return -1 * sorter(a, b);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
for (i = 0; i < rowNodes.length; i += 1) {
|
|
126
|
+
rows.push(rowNodes[i]);
|
|
127
|
+
tableBody.removeChild(rowNodes[i]);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
rows.sort(finalSorter);
|
|
131
|
+
|
|
132
|
+
for (i = 0; i < rows.length; i += 1) {
|
|
133
|
+
tableBody.appendChild(rows[i]);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// removes sort indicators for current column being sorted
|
|
137
|
+
function removeSortIndicators() {
|
|
138
|
+
var col = getNthColumn(currentSort.index),
|
|
139
|
+
cls = col.className;
|
|
140
|
+
|
|
141
|
+
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
|
142
|
+
col.className = cls;
|
|
143
|
+
}
|
|
144
|
+
// adds sort indicators for current column being sorted
|
|
145
|
+
function addSortIndicators() {
|
|
146
|
+
getNthColumn(currentSort.index).className += currentSort.desc
|
|
147
|
+
? ' sorted-desc'
|
|
148
|
+
: ' sorted';
|
|
149
|
+
}
|
|
150
|
+
// adds event listeners for all sorter widgets
|
|
151
|
+
function enableUI() {
|
|
152
|
+
var i,
|
|
153
|
+
el,
|
|
154
|
+
ithSorter = function ithSorter(i) {
|
|
155
|
+
var col = cols[i];
|
|
156
|
+
|
|
157
|
+
return function() {
|
|
158
|
+
var desc = col.defaultDescSort;
|
|
159
|
+
|
|
160
|
+
if (currentSort.index === i) {
|
|
161
|
+
desc = !currentSort.desc;
|
|
162
|
+
}
|
|
163
|
+
sortByIndex(i, desc);
|
|
164
|
+
removeSortIndicators();
|
|
165
|
+
currentSort.index = i;
|
|
166
|
+
currentSort.desc = desc;
|
|
167
|
+
addSortIndicators();
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
for (i = 0; i < cols.length; i += 1) {
|
|
171
|
+
if (cols[i].sortable) {
|
|
172
|
+
// add the click event handler on the th so users
|
|
173
|
+
// dont have to click on those tiny arrows
|
|
174
|
+
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
|
175
|
+
if (el.addEventListener) {
|
|
176
|
+
el.addEventListener('click', ithSorter(i));
|
|
177
|
+
} else {
|
|
178
|
+
el.attachEvent('onclick', ithSorter(i));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// adds sorting functionality to the UI
|
|
184
|
+
return function() {
|
|
185
|
+
if (!getTable()) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
cols = loadColumns();
|
|
189
|
+
loadData();
|
|
190
|
+
addSearchBox();
|
|
191
|
+
addSortIndicators();
|
|
192
|
+
enableUI();
|
|
193
|
+
};
|
|
194
|
+
})();
|
|
195
|
+
|
|
196
|
+
window.addEventListener('load', addSorting);
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { defaultProps } from './props/defaultProps';
|
|
3
3
|
import { propTypes } from './props/propTypes';
|
|
4
4
|
import { Container } from '@zohodesk/components/lib/Layout';
|
|
5
|
-
import { mergeStyle } from '@zohodesk/
|
|
5
|
+
import { mergeStyle } from '@zohodesk/utils';
|
|
6
6
|
import VelocityAnimationGroup from '@zohodesk/components/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup';
|
|
7
7
|
import { useZIndex } from '@zohodesk/components/lib/Provider/ZindexProvider';
|
|
8
8
|
import cssJSLogic from './css/cssJSLogic';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import Image from '../Image.js';
|
|
4
|
+
describe('Image - ', () => {
|
|
5
|
+
test('rendering the default props', () => {
|
|
6
|
+
const {
|
|
7
|
+
asFragment
|
|
8
|
+
} = render( /*#__PURE__*/React.createElement(Image, null));
|
|
9
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
test('checking "isCover" is false', () => {
|
|
12
|
+
const {
|
|
13
|
+
asFragment
|
|
14
|
+
} = render( /*#__PURE__*/React.createElement(Image, {
|
|
15
|
+
src: "https://www.w3schools.com/images/lamp.jpg",
|
|
16
|
+
alt: "Lamp",
|
|
17
|
+
isCover: true
|
|
18
|
+
}));
|
|
19
|
+
expect(asFragment()).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
test('rendering "alt" and "src" value ', () => {
|
|
22
|
+
const {
|
|
23
|
+
asFragment
|
|
24
|
+
} = render( /*#__PURE__*/React.createElement(Image, {
|
|
25
|
+
src: "https://www.w3schools.com/images/lamp.jpg",
|
|
26
|
+
alt: "Lamp"
|
|
27
|
+
}));
|
|
28
|
+
expect(asFragment()).toMatchSnapshot();
|
|
29
|
+
});
|
|
30
|
+
test('rendering "dataid" value', () => {
|
|
31
|
+
const {
|
|
32
|
+
asFragment
|
|
33
|
+
} = render( /*#__PURE__*/React.createElement(Image, {
|
|
34
|
+
src: "https://www.w3schools.com/images/lamp.jpg",
|
|
35
|
+
alt: "Lamp",
|
|
36
|
+
dataId: "imageData"
|
|
37
|
+
}));
|
|
38
|
+
expect(asFragment()).toMatchSnapshot();
|
|
39
|
+
});
|
|
40
|
+
test('rendering "Original" value', () => {
|
|
41
|
+
const {
|
|
42
|
+
asFragment
|
|
43
|
+
} = render( /*#__PURE__*/React.createElement(Image, {
|
|
44
|
+
src: "https://www.w3schools.com/images/lamp.jpg",
|
|
45
|
+
alt: "Lamp",
|
|
46
|
+
original: "https://www.w3schools.com/images/lamp.jpg"
|
|
47
|
+
}));
|
|
48
|
+
expect(asFragment()).toMatchSnapshot();
|
|
49
|
+
});
|
|
50
|
+
test('rendering "Id" value', () => {
|
|
51
|
+
const {
|
|
52
|
+
asFragment
|
|
53
|
+
} = render( /*#__PURE__*/React.createElement(Image, {
|
|
54
|
+
src: "https://www.w3schools.com/images/lamp.jpg",
|
|
55
|
+
alt: "Lamp",
|
|
56
|
+
htmlId: "test"
|
|
57
|
+
}));
|
|
58
|
+
expect(asFragment()).toMatchSnapshot();
|
|
59
|
+
});
|
|
60
|
+
test('rendering "title" value', () => {
|
|
61
|
+
const {
|
|
62
|
+
asFragment
|
|
63
|
+
} = render( /*#__PURE__*/React.createElement(Image, {
|
|
64
|
+
src: "https://www.w3schools.com/images/lamp.jpg",
|
|
65
|
+
alt: "Lamp",
|
|
66
|
+
title: "ImageTest Value"
|
|
67
|
+
}));
|
|
68
|
+
expect(asFragment()).toMatchSnapshot();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Image - checking "isCover" is false 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<img
|
|
6
|
+
alt="Lamp"
|
|
7
|
+
class=" imgFullSize "
|
|
8
|
+
src="https://www.w3schools.com/images/lamp.jpg"
|
|
9
|
+
/>
|
|
10
|
+
</DocumentFragment>
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
exports[`Image - rendering "dataid" value 1`] = `
|
|
14
|
+
<DocumentFragment>
|
|
15
|
+
<img
|
|
16
|
+
alt="Lamp"
|
|
17
|
+
class=" imgMaxFullSize "
|
|
18
|
+
data-id="imageData"
|
|
19
|
+
data-test-id="imageData"
|
|
20
|
+
src="https://www.w3schools.com/images/lamp.jpg"
|
|
21
|
+
/>
|
|
22
|
+
</DocumentFragment>
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
exports[`Image - rendering "Id" value 1`] = `
|
|
26
|
+
<DocumentFragment>
|
|
27
|
+
<img
|
|
28
|
+
alt="Lamp"
|
|
29
|
+
class=" imgMaxFullSize "
|
|
30
|
+
id="test"
|
|
31
|
+
src="https://www.w3schools.com/images/lamp.jpg"
|
|
32
|
+
/>
|
|
33
|
+
</DocumentFragment>
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
exports[`Image - rendering "Original" value 1`] = `
|
|
37
|
+
<DocumentFragment>
|
|
38
|
+
<img
|
|
39
|
+
alt="Lamp"
|
|
40
|
+
class=" imgMaxFullSize "
|
|
41
|
+
data-original="https://www.w3schools.com/images/lamp.jpg"
|
|
42
|
+
src="https://www.w3schools.com/images/lamp.jpg"
|
|
43
|
+
/>
|
|
44
|
+
</DocumentFragment>
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
exports[`Image - rendering "alt" and "src" value 1`] = `
|
|
48
|
+
<DocumentFragment>
|
|
49
|
+
<img
|
|
50
|
+
alt="Lamp"
|
|
51
|
+
class=" imgMaxFullSize "
|
|
52
|
+
src="https://www.w3schools.com/images/lamp.jpg"
|
|
53
|
+
/>
|
|
54
|
+
</DocumentFragment>
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
exports[`Image - rendering "title" value 1`] = `
|
|
58
|
+
<DocumentFragment>
|
|
59
|
+
<img
|
|
60
|
+
alt="Lamp"
|
|
61
|
+
class=" imgMaxFullSize "
|
|
62
|
+
data-title="ImageTest Value"
|
|
63
|
+
src="https://www.w3schools.com/images/lamp.jpg"
|
|
64
|
+
/>
|
|
65
|
+
</DocumentFragment>
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
exports[`Image - rendering the default props 1`] = `
|
|
69
|
+
<DocumentFragment>
|
|
70
|
+
<img
|
|
71
|
+
class=" imgMaxFullSize "
|
|
72
|
+
/>
|
|
73
|
+
</DocumentFragment>
|
|
74
|
+
`;
|
package/es/Loader/Loader.js
CHANGED
|
@@ -6,7 +6,7 @@ export const propTypes = {
|
|
|
6
6
|
dataId: PropTypes.string,
|
|
7
7
|
iconClass: PropTypes.string,
|
|
8
8
|
iconName: PropTypes.string,
|
|
9
|
-
iconSize: PropTypes.
|
|
9
|
+
iconSize: PropTypes.string,
|
|
10
10
|
iconType: PropTypes.oneOf(['delete', 'alert', 'remoteAssist', 'splitTicket', 'update']),
|
|
11
11
|
needIcon: PropTypes.bool,
|
|
12
12
|
onClose: PropTypes.func,
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { defaultProps } from '../../ActionButton/props/defaultProps';
|
|
3
|
+
import { propTypes } from '../../ActionButton/props/propTypes';
|
|
4
|
+
import Popup from '@zohodesk/components/lib/Popup/Popup';
|
|
5
|
+
import { Icon } from '@zohodesk/icons';
|
|
6
|
+
import Button from '@zohodesk/components/lib/Button/Button';
|
|
7
|
+
import { Container, Box } from '@zohodesk/components/lib/Layout';
|
|
8
|
+
import ResponsiveDropBox from '@zohodesk/components/lib/ResponsiveDropBox/ResponsiveDropBox';
|
|
9
|
+
import CssProvider from '@zohodesk/components/lib/Provider/CssProvider';
|
|
10
|
+
import btnStyle from '@zohodesk/components/lib/semantic/Button/semanticButton.module.css';
|
|
11
|
+
import style from '../../ActionButton/ActionButton.module.css';
|
|
12
|
+
|
|
13
|
+
function ActionButton(props) {
|
|
14
|
+
let {
|
|
15
|
+
isLoading,
|
|
16
|
+
onClick,
|
|
17
|
+
size,
|
|
18
|
+
dataId,
|
|
19
|
+
dataSelectorId,
|
|
20
|
+
isArrow,
|
|
21
|
+
text,
|
|
22
|
+
subText,
|
|
23
|
+
arrowBoxSize,
|
|
24
|
+
palette,
|
|
25
|
+
onHover,
|
|
26
|
+
position,
|
|
27
|
+
className,
|
|
28
|
+
iconName,
|
|
29
|
+
iconSize,
|
|
30
|
+
dataTitle,
|
|
31
|
+
isDisabled,
|
|
32
|
+
isPopupOpen,
|
|
33
|
+
removeClose,
|
|
34
|
+
children,
|
|
35
|
+
dropBoxClass,
|
|
36
|
+
isBoxPaddingNeed,
|
|
37
|
+
getContainerRef,
|
|
38
|
+
getTargetRef,
|
|
39
|
+
removeChildrenTooltip,
|
|
40
|
+
innerClassName,
|
|
41
|
+
popupGroup,
|
|
42
|
+
togglePopup,
|
|
43
|
+
defaultPosition
|
|
44
|
+
} = props;
|
|
45
|
+
|
|
46
|
+
const handleTogglePopup = e => {
|
|
47
|
+
togglePopup(e, defaultPosition);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
51
|
+
alignBox: "row",
|
|
52
|
+
isCover: false,
|
|
53
|
+
className: ` ${style.container} ${style[palette + 'Box']} ${style[size]} ${className} ${isDisabled ? CssProvider('isDisabled') : ''} ${!onClick ? style.wholeDiv : ''} `,
|
|
54
|
+
onClick: onHover ? removeClose : !onClick ? handleTogglePopup : undefined,
|
|
55
|
+
onMouseEnter: !onClick ? onHover && handleTogglePopup : undefined,
|
|
56
|
+
onMouseLeave: !onClick ? onHover && handleTogglePopup : undefined,
|
|
57
|
+
eleRef: getTargetRef,
|
|
58
|
+
dataSelectorId: dataSelectorId
|
|
59
|
+
}, isLoading ? /*#__PURE__*/React.createElement(Box, {
|
|
60
|
+
flexible: true
|
|
61
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
62
|
+
status: "loading",
|
|
63
|
+
palette: palette,
|
|
64
|
+
size: "medium",
|
|
65
|
+
customClass: {
|
|
66
|
+
customButton: style.btn
|
|
67
|
+
},
|
|
68
|
+
text: text
|
|
69
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
|
|
70
|
+
flexible: true,
|
|
71
|
+
onClick: onClick,
|
|
72
|
+
dataId: dataId,
|
|
73
|
+
className: `${btnStyle.buttonReset} ${style.contentBox} ${style[palette + 'Btn']} ${style[size + '_btnBox']} ${children ? style.contentBoxBdr : style.contentBoxBdrRds} ${style.clickable} ${innerClassName} `,
|
|
74
|
+
"data-title": dataTitle,
|
|
75
|
+
tagName: "button",
|
|
76
|
+
tabIndex: "0"
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Container, {
|
|
78
|
+
align: "both"
|
|
79
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
80
|
+
className: style.contentwrapper
|
|
81
|
+
}, /*#__PURE__*/React.createElement(Container, {
|
|
82
|
+
isCover: false,
|
|
83
|
+
alignBox: "row",
|
|
84
|
+
align: "vertical"
|
|
85
|
+
}, iconName ? /*#__PURE__*/React.createElement(Icon, {
|
|
86
|
+
name: iconName,
|
|
87
|
+
size: iconSize,
|
|
88
|
+
iconClass: `${style.iconClr} ${text ? style.iconMrgn : ''}`
|
|
89
|
+
}) : null, text ? /*#__PURE__*/React.createElement(Box, {
|
|
90
|
+
shrink: true,
|
|
91
|
+
className: style.txt,
|
|
92
|
+
"data-title": removeChildrenTooltip ? null : text
|
|
93
|
+
}, text) : null)), subText ? /*#__PURE__*/React.createElement(Box, {
|
|
94
|
+
"data-title": removeChildrenTooltip ? null : subText,
|
|
95
|
+
className: style.subTxt
|
|
96
|
+
}, subText) : null)), children ? /*#__PURE__*/React.createElement(Box, {
|
|
97
|
+
onClick: onClick ? !onHover && handleTogglePopup : undefined,
|
|
98
|
+
onMouseEnter: onClick ? onHover && handleTogglePopup : undefined,
|
|
99
|
+
onMouseLeave: onClick ? onHover && handleTogglePopup : undefined,
|
|
100
|
+
className: `${btnStyle.buttonReset} ${style[arrowBoxSize + '_arrowBox']} ${style[palette + 'Arw']} ${style.arrowWrapper} ${isPopupOpen ? style.arrowActive : ''}`,
|
|
101
|
+
dataId: `${dataId}_arrowButton`,
|
|
102
|
+
tabIndex: "0",
|
|
103
|
+
tagName: "button",
|
|
104
|
+
dataSelectorId: `${dataSelectorId}_arrowButton`
|
|
105
|
+
}, /*#__PURE__*/React.createElement(Container, {
|
|
106
|
+
align: "both"
|
|
107
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
108
|
+
name: "ZD-down",
|
|
109
|
+
size: "6",
|
|
110
|
+
iconClass: style.arrow
|
|
111
|
+
})), isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveDropBox, {
|
|
112
|
+
size: "small",
|
|
113
|
+
isActive: isPopupOpen,
|
|
114
|
+
boxPosition: position,
|
|
115
|
+
isAnimate: true,
|
|
116
|
+
isArrow: isArrow,
|
|
117
|
+
customClass: {
|
|
118
|
+
customDropBoxWrap: dropBoxClass
|
|
119
|
+
},
|
|
120
|
+
isBoxPaddingNeed: isBoxPaddingNeed,
|
|
121
|
+
getRef: getContainerRef,
|
|
122
|
+
popupGroup: popupGroup,
|
|
123
|
+
needFocusScope: true,
|
|
124
|
+
onClose: handleTogglePopup
|
|
125
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
126
|
+
flexible: true,
|
|
127
|
+
shrink: true,
|
|
128
|
+
scroll: "vertical"
|
|
129
|
+
}, children)) : null) : null));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
ActionButton.defaultProps = defaultProps;
|
|
133
|
+
ActionButton.propTypes = propTypes; // ActionButton.docs = {
|
|
134
|
+
// componentGroup: 'Atom'
|
|
135
|
+
// };
|
|
136
|
+
|
|
137
|
+
export default Popup(ActionButton);
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*** Libraries ***/
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
|
+
import { AlphabeticList_defaultProps, AlphabeticListItem_defaultProps } from '../../AlphabeticList/props/defaultProps';
|
|
4
|
+
import { AlphabeticList_propTypes, AlphabeticListItem_propTypes, AlphabeticCharacters, NumberList, AlphabeticCharactersWithHash } from '../../AlphabeticList/props/propTypes';
|
|
5
|
+
import { Container, Box } from '@zohodesk/components/lib/Layout';
|
|
6
|
+
/*** CSS ***/
|
|
7
|
+
|
|
8
|
+
import style from '../../AlphabeticList/AlphabeticList.module.css';
|
|
9
|
+
const AlphabeticListItemMemo = /*#__PURE__*/memo(AlphabeticListItem);
|
|
10
|
+
|
|
11
|
+
function AlphabeticList(props) {
|
|
12
|
+
let {
|
|
13
|
+
onSelect,
|
|
14
|
+
selectedCharacter,
|
|
15
|
+
align,
|
|
16
|
+
type,
|
|
17
|
+
i18nKeys,
|
|
18
|
+
dataId,
|
|
19
|
+
dataSelectorId
|
|
20
|
+
} = props;
|
|
21
|
+
let {
|
|
22
|
+
allText = 'All',
|
|
23
|
+
allTitle = 'All'
|
|
24
|
+
} = i18nKeys;
|
|
25
|
+
let alignType = align === 'vertical' ? style.column : style.row;
|
|
26
|
+
let letters = type == 'alphabeticalwithhash' ? AlphabeticCharactersWithHash : type == 'alphabetical' ? AlphabeticCharacters : NumberList;
|
|
27
|
+
|
|
28
|
+
const handleSelectAll = () => {
|
|
29
|
+
onSelect && selectedCharacter != 'ALL' && onSelect('ALL');
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const handleSelect = id => {
|
|
33
|
+
onSelect && selectedCharacter !== id && onSelect(id);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
37
|
+
tagName: "ul",
|
|
38
|
+
isCover: false,
|
|
39
|
+
alignBox: align === 'vertical' ? 'column' : 'row',
|
|
40
|
+
className: `${style.container} ${alignType} ${type != 'alphabetical' ? style.numbers : ''}`,
|
|
41
|
+
dataId: "navigationDiv",
|
|
42
|
+
dataSelectorId: dataSelectorId
|
|
43
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
44
|
+
tagName: "li",
|
|
45
|
+
className: `${style.list} ${style.title} ${selectedCharacter === 'ALL' ? style.selected : ''}`,
|
|
46
|
+
dataId: `All_${dataId}`
|
|
47
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
48
|
+
onClick: handleSelectAll,
|
|
49
|
+
className: `${style.heading} ${style.letter}`,
|
|
50
|
+
"data-title": allTitle
|
|
51
|
+
}, allText)), letters.map(letter => /*#__PURE__*/React.createElement(AlphabeticListItemMemo, {
|
|
52
|
+
id: letter,
|
|
53
|
+
isActive: letter === selectedCharacter,
|
|
54
|
+
onClick: handleSelect,
|
|
55
|
+
text: letter,
|
|
56
|
+
key: letter,
|
|
57
|
+
dataId: dataId
|
|
58
|
+
})));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
AlphabeticList.propTypes = AlphabeticList_propTypes;
|
|
62
|
+
AlphabeticList.defaultProps = AlphabeticList_defaultProps;
|
|
63
|
+
|
|
64
|
+
function AlphabeticListItem(props) {
|
|
65
|
+
let {
|
|
66
|
+
isActive,
|
|
67
|
+
text,
|
|
68
|
+
dataId,
|
|
69
|
+
onClick,
|
|
70
|
+
id
|
|
71
|
+
} = props;
|
|
72
|
+
|
|
73
|
+
const handleClick = () => {
|
|
74
|
+
onClick && onClick(id);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
78
|
+
flexible: true,
|
|
79
|
+
tagName: "li",
|
|
80
|
+
className: `${style.list} ${isActive ? style.selected : ''}`,
|
|
81
|
+
onClick: handleClick,
|
|
82
|
+
dataId: `${text}_${dataId}`
|
|
83
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
84
|
+
className: style.letter
|
|
85
|
+
}, text));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
AlphabeticListItem.propTypes = AlphabeticListItem_propTypes;
|
|
89
|
+
AlphabeticListItem.defaultProps = AlphabeticListItem_defaultProps;
|
|
90
|
+
export default /*#__PURE__*/memo(AlphabeticList);
|