diginet-core-ui 1.3.78 → 1.3.79
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/components/accordion/details.js +2 -6
- package/components/accordion/group.js +2 -9
- package/components/accordion/index.js +2 -15
- package/components/accordion/summary.js +4 -27
- package/components/alert/index.js +98 -137
- package/components/alert/notify.js +97 -166
- package/components/avatar/index.js +4 -63
- package/components/badge/index.js +7 -34
- package/components/button/icon.js +120 -186
- package/components/button/index.js +136 -205
- package/components/button/more.js +0 -12
- package/components/button/ripple-effect.js +46 -44
- package/components/card/body.js +2 -7
- package/components/card/extra.js +2 -7
- package/components/card/footer.js +2 -7
- package/components/card/header.js +2 -7
- package/components/card/index.js +2 -22
- package/components/chart/Pie/Circle.js +0 -1
- package/components/chart/Pie/Sector.js +0 -17
- package/components/chart/Pie/Sectors.js +0 -10
- package/components/chart/Pie/index.js +4 -36
- package/components/chart/Pie-v2/Circle.js +0 -1
- package/components/chart/Pie-v2/Sector.js +0 -13
- package/components/chart/Pie-v2/Sectors.js +0 -20
- package/components/chart/Pie-v2/index.js +11 -38
- package/components/chart/bar/Axis.js +0 -12
- package/components/chart/bar/Bar.js +13 -35
- package/components/chart/bar/Grid.js +0 -18
- package/components/chart/bar/Labels.js +0 -18
- package/components/chart/bar/Points.js +0 -17
- package/components/chart/bar/index.js +6 -26
- package/components/chart/bar-v2/Axis.js +0 -12
- package/components/chart/bar-v2/Bar.js +15 -36
- package/components/chart/bar-v2/Grid.js +0 -18
- package/components/chart/bar-v2/Labels.js +0 -18
- package/components/chart/bar-v2/Points.js +0 -17
- package/components/chart/bar-v2/index.js +6 -26
- package/components/chart/line/Axis.js +4 -16
- package/components/chart/line/Grid.js +2 -19
- package/components/chart/line/Labels.js +0 -18
- package/components/chart/line/Path.js +23 -33
- package/components/chart/line/Point.js +6 -40
- package/components/chart/line/Title.js +0 -3
- package/components/chart/line/index.js +12 -35
- package/components/chart/line-v2/Axis.js +0 -13
- package/components/chart/line-v2/Grid.js +0 -18
- package/components/chart/line-v2/Labels.js +0 -18
- package/components/chart/line-v2/Path.js +23 -33
- package/components/chart/line-v2/Point.js +6 -35
- package/components/chart/line-v2/Title.js +0 -3
- package/components/chart/line-v2/index.js +12 -30
- package/components/check-text/index.js +0 -8
- package/components/check-text/interview-confirmation.js +0 -7
- package/components/check-text/interview-status.js +0 -7
- package/components/chip/attach.js +4 -17
- package/components/chip/index.js +6 -33
- package/components/collapse/index.js +0 -13
- package/components/divider/index.js +0 -8
- package/components/form-control/attachment/index.js +24 -202
- package/components/form-control/calendar/function.js +40 -94
- package/components/form-control/calendar/index.js +5 -30
- package/components/form-control/calendar/range.js +11 -28
- package/components/form-control/checkbox/index.js +4 -37
- package/components/form-control/control/index.js +3 -13
- package/components/form-control/date-picker/index-old.js +18 -0
- package/components/form-control/date-picker/index.js +23 -99
- package/components/form-control/date-range-picker/index.js +86 -221
- package/components/form-control/dropdown/index.js +72 -289
- package/components/form-control/dropdown-box/index.js +6 -35
- package/components/form-control/form/index.js +0 -2
- package/components/form-control/form-group/index.js +1 -6
- package/components/form-control/helper-text/index.js +2 -9
- package/components/form-control/input-base/index.js +218 -399
- package/components/form-control/label/index.js +2 -12
- package/components/form-control/money-input/index.js +43 -132
- package/components/form-control/number-input/index.js +15 -113
- package/components/form-control/number-input/index2.js +78 -119
- package/components/form-control/phone-input/index.js +16 -78
- package/components/form-control/radio/index.js +4 -23
- package/components/form-control/text-input/index.js +33 -256
- package/components/form-control/time-picker/index.js +14 -71
- package/components/form-control/time-picker/swiper.js +21 -73
- package/components/form-control/toggle/index.js +4 -19
- package/components/form-view/helper-text.js +2 -2
- package/components/form-view/index.js +0 -14
- package/components/form-view/input.js +2 -13
- package/components/form-view/label.js +0 -2
- package/components/grid/Col.js +2 -15
- package/components/grid/Container.js +2 -21
- package/components/grid/Row.js +2 -21
- package/components/grid/index.js +2 -43
- package/components/image/index.js +2 -22
- package/components/index.js +62 -31
- package/components/list/list-item-action.js +0 -9
- package/components/list/list-item-icon.js +0 -9
- package/components/list/list-item-text.js +0 -5
- package/components/list/list-item.js +0 -11
- package/components/list/list.js +0 -13
- package/components/list/sub-header.js +0 -4
- package/components/modal/body.js +2 -6
- package/components/modal/footer.js +2 -11
- package/components/modal/header.js +2 -12
- package/components/modal/index.js +2 -10
- package/components/modal/modal.js +11 -52
- package/components/others/extra/index.js +3 -10
- package/components/others/import/index.js +0 -7
- package/components/others/option-wrapper/index.js +4 -7
- package/components/others/scrollbar/index.js +0 -3
- package/components/paging/page-info.js +39 -101
- package/components/paging/page-selector.js +7 -35
- package/components/paging/page-selector2.js +35 -74
- package/components/paper/index.js +0 -11
- package/components/popover/body.js +2 -6
- package/components/popover/footer.js +2 -11
- package/components/popover/header.js +2 -7
- package/components/popover/index.js +39 -123
- package/components/popup/danger_popup.js +0 -19
- package/components/popup/index.js +2 -48
- package/components/popup/proposals_popup.js +10 -49
- package/components/popup/v2/index.js +0 -31
- package/components/progress/circular.js +19 -81
- package/components/progress/linear.js +4 -20
- package/components/rating/index.js +0 -24
- package/components/slider/slider-container.js +3 -40
- package/components/slider/slider-item.js +10 -25
- package/components/status/index.js +2 -16
- package/components/tab/tab-container.js +2 -16
- package/components/tab/tab-header.js +4 -24
- package/components/tab/tab-panel.js +4 -16
- package/components/tab/tab.js +4 -28
- package/components/tooltip/index.js +12 -97
- package/components/tooltip/portal.js +0 -2
- package/components/transfer/index.js +22 -67
- package/components/tree-view/index.js +62 -202
- package/components/typography/index.js +3 -31
- package/global/index.js +0 -8
- package/icons/basic.js +0 -48
- package/icons/effect.js +17 -29
- package/icons/general/clock/clock.js +0 -2
- package/icons/general/color-handler/background.js +0 -2
- package/icons/general/color-handler/text.js +0 -2
- package/icons/general/emoji/emoji.js +0 -2
- package/icons/general/font-properties/bold.js +0 -2
- package/icons/general/font-properties/font-family.js +0 -2
- package/icons/general/font-properties/font-size.js +0 -2
- package/icons/general/font-properties/italic.js +0 -2
- package/icons/general/font-properties/underline.js +0 -2
- package/icons/general/hyperlink/hyperlink.js +0 -2
- package/icons/general/indent/decrease.js +0 -2
- package/icons/general/indent/increase.js +0 -2
- package/icons/general/list/bullets.js +0 -2
- package/icons/general/list/numbering.js +0 -2
- package/icons/general/picture/picture.js +0 -2
- package/icons/general/steps/redo.js +0 -2
- package/icons/general/steps/undo.js +0 -2
- package/icons/general/text-align/center.js +0 -2
- package/icons/general/text-align/justify.js +0 -2
- package/icons/general/text-align/left.js +0 -2
- package/icons/general/text-align/right.js +0 -2
- package/icons/menu/dhr.js +2 -1
- package/icons/menu/index.js +2 -2
- package/icons/menu/v2/index.js +0 -10
- package/package.json +1 -1
- package/readme.md +11 -1
- package/styles/animation.js +15 -58
- package/styles/color-helper.js +24 -54
- package/styles/colors.js +17 -9
- package/styles/general.js +6 -2
- package/styles/typography.js +4 -4
- package/styles/utils.js +2 -2
- package/theme/createBreakpoints.js +7 -18
- package/theme/make-styles.js +2 -5
- package/theme/set-theme.js +3 -6
- package/theme/settings.js +3 -2
- package/theme/theme-provider.js +0 -1
- package/utils/array/array.js +14 -23
- package/utils/classNames.js +0 -5
- package/utils/console.js +0 -6
- package/utils/date.js +13 -82
- package/utils/error/error.js +1 -9
- package/utils/error/errors.js +1 -48
- package/utils/getFileType.js +0 -9
- package/utils/handleBreakpoints.js +0 -5
- package/utils/intersectionObserver.js +0 -5
- package/utils/iterator.js +0 -9
- package/utils/map-parent.js +3 -10
- package/utils/object/extend.js +0 -10
- package/utils/object/object.js +12 -11
- package/utils/parseHTML.js +0 -1
- package/utils/promisify.js +0 -5
- package/utils/randomString.js +0 -7
- package/utils/remove-unicode.js +0 -1
- package/utils/render-portal.js +1 -9
- package/utils/renderHTML.js +4 -6
- package/utils/renderIcon.js +4 -14
- package/utils/sb-template.js +6 -5
- package/utils/string/capitalize.js +0 -1
- package/utils/string/capitalizeSentenceCase.js +0 -2
- package/utils/string/string.js +0 -13
- package/utils/type.js +0 -21
- package/utils/updatePosition.js +4 -5
- package/utils/useDelayUnmount.js +0 -4
- package/utils/useElementSize.js +9 -3
- package/utils/useEventListener.js +12 -6
- package/utils/useInput.js +0 -6
- package/utils/useMediaQuery.js +8 -10
- package/utils/useOnClickOutside.js +0 -2
- package/utils/usePortal.js +3 -10
- package/utils/validate.js +6 -20
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { css, jsx } from '@emotion/core';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
@@ -65,18 +64,14 @@ const SliderContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
65
64
|
const navigationListRef = useRef(null);
|
|
66
65
|
const iconLeftRef = useRef(null);
|
|
67
66
|
const iconRightRef = useRef(null);
|
|
68
|
-
|
|
69
67
|
const _containerCSS = containerCSS(IDs);
|
|
70
|
-
|
|
71
68
|
const _navigationListCSS = navigationListCSS(IDs);
|
|
72
|
-
|
|
73
69
|
const removeClass = (className, selector) => {
|
|
74
70
|
const array = document.querySelectorAll(`.${selector}`) || document.querySelectorAll(selector);
|
|
75
71
|
array.forEach(a => {
|
|
76
72
|
a.classList.remove(className);
|
|
77
73
|
});
|
|
78
74
|
};
|
|
79
|
-
|
|
80
75
|
const onChangeActiveItem = (childNodeList, e, i) => {
|
|
81
76
|
removeClass('item-focused', IDs.navigationItem);
|
|
82
77
|
e.classList.add('item-focused');
|
|
@@ -86,43 +81,34 @@ const SliderContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
86
81
|
childNodeList[i].style.display = 'block';
|
|
87
82
|
currentItemIndex = i;
|
|
88
83
|
};
|
|
89
|
-
|
|
90
84
|
const onNextItem = childNodeList => {
|
|
91
85
|
if (childNodeList.length > 1 && autoChangeTime && autoChangeTime > 0) {
|
|
92
86
|
clearInterval(autoChange);
|
|
93
87
|
autoChange = setInterval(() => onNextItem(childNodeList), autoChangeTime * 1000);
|
|
94
88
|
}
|
|
95
|
-
|
|
96
89
|
childNodeList[currentItemIndex].style.display = 'none';
|
|
97
|
-
|
|
98
90
|
if (currentItemIndex === childNodeList.length - 1) {
|
|
99
91
|
currentItemIndex = 0;
|
|
100
92
|
} else {
|
|
101
93
|
currentItemIndex += 1;
|
|
102
94
|
}
|
|
103
|
-
|
|
104
95
|
childNodeList[currentItemIndex].style.display = 'block';
|
|
105
96
|
onChangeActiveItem(childNodeList, navigationListRef.current.childNodes[currentItemIndex], currentItemIndex);
|
|
106
97
|
};
|
|
107
|
-
|
|
108
98
|
const onPrevItem = childNodeList => {
|
|
109
99
|
if (childNodeList.length > 1 && autoChangeTime && autoChangeTime > 0) {
|
|
110
100
|
clearInterval(autoChange);
|
|
111
101
|
autoChange = setInterval(() => onNextItem(childNodeList), autoChangeTime * 1000);
|
|
112
102
|
}
|
|
113
|
-
|
|
114
103
|
childNodeList[currentItemIndex].style.display = 'none';
|
|
115
|
-
|
|
116
104
|
if (currentItemIndex === 0) {
|
|
117
105
|
currentItemIndex = childNodeList.length - 1;
|
|
118
106
|
} else {
|
|
119
107
|
currentItemIndex -= 1;
|
|
120
108
|
}
|
|
121
|
-
|
|
122
109
|
childNodeList[currentItemIndex].style.display = 'block';
|
|
123
110
|
onChangeActiveItem(childNodeList, navigationListRef.current.childNodes[currentItemIndex], currentItemIndex);
|
|
124
111
|
};
|
|
125
|
-
|
|
126
112
|
const findActiveItem = childNodeList => {
|
|
127
113
|
for (let i = 0; i < childNodeList.length; i++) {
|
|
128
114
|
if (childNodeList[i].classList.contains('active')) {
|
|
@@ -131,21 +117,17 @@ const SliderContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
131
117
|
return i;
|
|
132
118
|
}
|
|
133
119
|
}
|
|
134
|
-
|
|
135
120
|
childNodeList[0].style.display = 'block';
|
|
136
121
|
currentItemIndex = 0;
|
|
137
122
|
return 0;
|
|
138
123
|
};
|
|
139
|
-
|
|
140
124
|
const renderNavigationItem = childNodeList => {
|
|
141
125
|
const list = navigationListRef.current;
|
|
142
126
|
const activeItem = findActiveItem(childNodeList);
|
|
143
127
|
let items = '';
|
|
144
|
-
|
|
145
128
|
for (let i = 0; i < childNodeList.length; i++) {
|
|
146
129
|
items += `<span class='${i === activeItem ? IDs.navigationItem + ' ' + 'item-focused' : IDs.navigationItem}' id='${IDs.navigationItem}-${i}'></span>`;
|
|
147
130
|
}
|
|
148
|
-
|
|
149
131
|
list.innerHTML = items;
|
|
150
132
|
navigationListRef.current.querySelectorAll(`.${IDs.navigationItem}`).forEach((item, i) => {
|
|
151
133
|
item.addEventListener('click', e => {
|
|
@@ -153,15 +135,13 @@ const SliderContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
153
135
|
});
|
|
154
136
|
});
|
|
155
137
|
};
|
|
156
|
-
|
|
157
138
|
useEffect(() => {
|
|
158
139
|
if (!slideContainerRef.current || !navigationRef.current || !iconLeftRef.current || !iconRightRef.current) return;
|
|
159
140
|
const childNodeList = slideContainerRef.current.childNodes,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
141
|
+
navigation = navigationRef.current,
|
|
142
|
+
iconLeft = iconLeftRef.current,
|
|
143
|
+
iconRight = iconRightRef.current;
|
|
163
144
|
renderNavigationItem(childNodeList);
|
|
164
|
-
|
|
165
145
|
if (childNodeList.length > 1) {
|
|
166
146
|
navigation.style.display = onShowNavigation ? 'block' : 'none';
|
|
167
147
|
iconLeft.style.display = 'block';
|
|
@@ -173,12 +153,10 @@ const SliderContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
173
153
|
iconLeft.style.display = 'none';
|
|
174
154
|
iconRight.style.display = 'none';
|
|
175
155
|
}
|
|
176
|
-
|
|
177
156
|
return () => {
|
|
178
157
|
childNodeList.forEach(node => {
|
|
179
158
|
node.style.display = 'none';
|
|
180
159
|
});
|
|
181
|
-
|
|
182
160
|
if (childNodeList.length > 1) {
|
|
183
161
|
iconRight.removeEventListener('click', () => onNextItem(childNodeList));
|
|
184
162
|
iconLeft.removeEventListener('click', () => onPrevItem(childNodeList));
|
|
@@ -188,11 +166,9 @@ const SliderContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
188
166
|
useEffect(() => {
|
|
189
167
|
if (!slideContainerRef.current) return;
|
|
190
168
|
const childNodeList = slideContainerRef.current.childNodes;
|
|
191
|
-
|
|
192
169
|
if (childNodeList.length > 1 && autoChangeTime && autoChangeTime > 0) {
|
|
193
170
|
autoChange = setInterval(() => onNextItem(childNodeList), autoChangeTime * 1000);
|
|
194
171
|
}
|
|
195
|
-
|
|
196
172
|
return () => {
|
|
197
173
|
if (childNodeList.length > 1 && autoChangeTime && autoChangeTime > 0) {
|
|
198
174
|
clearInterval(autoChange);
|
|
@@ -202,9 +178,7 @@ const SliderContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
202
178
|
useImperativeHandle(reference, () => {
|
|
203
179
|
const currentRef = ref.current || {};
|
|
204
180
|
const _instance = {}; // methods
|
|
205
|
-
|
|
206
181
|
_instance.__proto__ = {}; // hidden methods
|
|
207
|
-
|
|
208
182
|
currentRef.instance = _instance;
|
|
209
183
|
return currentRef;
|
|
210
184
|
});
|
|
@@ -262,7 +236,6 @@ const SliderContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
262
236
|
ref: ref
|
|
263
237
|
}, Slider, IconLeft, IconRight, Navigation);
|
|
264
238
|
}));
|
|
265
|
-
|
|
266
239
|
const containerCSS = IDs => css`
|
|
267
240
|
* {
|
|
268
241
|
${borderBox};
|
|
@@ -313,7 +286,6 @@ const containerCSS = IDs => css`
|
|
|
313
286
|
}
|
|
314
287
|
}
|
|
315
288
|
`;
|
|
316
|
-
|
|
317
289
|
const navigationCSS = css`
|
|
318
290
|
${displayNone};
|
|
319
291
|
${positionRelative};
|
|
@@ -324,7 +296,6 @@ const navigationCSS = css`
|
|
|
324
296
|
${displayNone};
|
|
325
297
|
}
|
|
326
298
|
`;
|
|
327
|
-
|
|
328
299
|
const navigationListCSS = IDs => css`
|
|
329
300
|
${flexRow};
|
|
330
301
|
${positionAbsolute};
|
|
@@ -347,7 +318,6 @@ const navigationListCSS = IDs => css`
|
|
|
347
318
|
}
|
|
348
319
|
}
|
|
349
320
|
`;
|
|
350
|
-
|
|
351
321
|
SliderContainer.defaultProps = {
|
|
352
322
|
animation: true,
|
|
353
323
|
autoChangeTime: 0,
|
|
@@ -360,25 +330,18 @@ SliderContainer.defaultProps = {
|
|
|
360
330
|
SliderContainer.propTypes = {
|
|
361
331
|
/** Index of the active item. */
|
|
362
332
|
active: PropTypes.number,
|
|
363
|
-
|
|
364
333
|
/** Enable/disable the animation when change active item. */
|
|
365
334
|
animation: PropTypes.bool,
|
|
366
|
-
|
|
367
335
|
/** Time to slider auto change (s). */
|
|
368
336
|
autoChangeTime: PropTypes.number,
|
|
369
|
-
|
|
370
337
|
/** Element or node to display on slider without data. */
|
|
371
338
|
children: PropTypes.oneOfType([PropTypes.element, PropTypes.node]),
|
|
372
|
-
|
|
373
339
|
/** Class for component. */
|
|
374
340
|
className: PropTypes.string,
|
|
375
|
-
|
|
376
341
|
/** Data to display on slider. */
|
|
377
342
|
data: PropTypes.array,
|
|
378
|
-
|
|
379
343
|
/** Show/hide the navigation bar. */
|
|
380
344
|
onShowNavigation: PropTypes.bool,
|
|
381
|
-
|
|
382
345
|
/** Style inline of component. */
|
|
383
346
|
style: PropTypes.object
|
|
384
347
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { forwardRef, memo, useEffect, useState, useRef, useImperativeHandle } from 'react';
|
|
5
4
|
import { jsx, css } from '@emotion/core';
|
|
@@ -12,24 +11,19 @@ const fadeIn = animations.fadeIn;
|
|
|
12
11
|
const regex = /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)/g;
|
|
13
12
|
const googleDriveRegex = /(http(s)?:\/\/.)?(drive\.google\.com\/file\/d\/)/;
|
|
14
13
|
const googleDocsRegex = /(http(s)?:\/\/.)?(docs\.google\.com\/fileview\?)/;
|
|
15
|
-
|
|
16
14
|
const checkURL = link => {
|
|
17
15
|
const res = regex.test(link);
|
|
18
|
-
|
|
19
16
|
if (res) {
|
|
20
17
|
if (googleDriveRegex.test(link)) {
|
|
21
18
|
const id = link.split('/')[0] === 'drive.google.com' ? link.split('/')[3] : link.split('/')[5];
|
|
22
19
|
return `https://docs.google.com/viewer?srcid=${id}&pid=explorer&efh=false&a=v&chrome=false&embedded=true`;
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
if (googleDocsRegex.test(link)) {
|
|
26
22
|
return `https://docs.google.com/viewer?srcid=${link.split('=')[1]}&pid=explorer&efh=false&a=v&chrome=false&embedded=true`;
|
|
27
23
|
}
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
return link;
|
|
31
26
|
};
|
|
32
|
-
|
|
33
27
|
const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
34
28
|
active,
|
|
35
29
|
animation,
|
|
@@ -50,23 +44,23 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
50
44
|
const ref = useRef(null);
|
|
51
45
|
const iframeRef = useRef(null);
|
|
52
46
|
const [iframeTimeoutId, setIframeTimeoutId] = useState(null);
|
|
53
|
-
|
|
54
47
|
const getViewer = (filePath, fileType) => {
|
|
55
48
|
switch (fileType) {
|
|
56
49
|
case 'image':
|
|
57
50
|
{
|
|
58
|
-
return jsx("img", {
|
|
51
|
+
return jsx("img", {
|
|
52
|
+
...props,
|
|
59
53
|
className: IDs.image,
|
|
60
54
|
css: imageCSS,
|
|
61
55
|
src: filePath,
|
|
62
56
|
alt: ''
|
|
63
57
|
});
|
|
64
58
|
}
|
|
65
|
-
|
|
66
59
|
case 'word':
|
|
67
60
|
case 'sheet':
|
|
68
61
|
{
|
|
69
|
-
return jsx("iframe", {
|
|
62
|
+
return jsx("iframe", {
|
|
63
|
+
...props,
|
|
70
64
|
className: IDs.frame,
|
|
71
65
|
css: frameCSS,
|
|
72
66
|
frameBorder: 0,
|
|
@@ -74,10 +68,10 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
74
68
|
title: fileName
|
|
75
69
|
});
|
|
76
70
|
}
|
|
77
|
-
|
|
78
71
|
case 'pdf':
|
|
79
72
|
{
|
|
80
|
-
return jsx("iframe", {
|
|
73
|
+
return jsx("iframe", {
|
|
74
|
+
...props,
|
|
81
75
|
ref: iframeRef,
|
|
82
76
|
className: IDs.frame,
|
|
83
77
|
css: frameCSS,
|
|
@@ -88,7 +82,6 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
88
82
|
onError: updateIframeSrc
|
|
89
83
|
});
|
|
90
84
|
}
|
|
91
|
-
|
|
92
85
|
case 'mp4':
|
|
93
86
|
{
|
|
94
87
|
return jsx("video", {
|
|
@@ -102,10 +95,10 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
102
95
|
type: "video/mp4"
|
|
103
96
|
}));
|
|
104
97
|
}
|
|
105
|
-
|
|
106
98
|
case 'another':
|
|
107
99
|
{
|
|
108
|
-
return jsx("iframe", {
|
|
100
|
+
return jsx("iframe", {
|
|
101
|
+
...props,
|
|
109
102
|
className: IDs.frame,
|
|
110
103
|
css: frameCSS,
|
|
111
104
|
frameBorder: 0,
|
|
@@ -113,10 +106,10 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
113
106
|
title: fileName
|
|
114
107
|
});
|
|
115
108
|
}
|
|
116
|
-
|
|
117
109
|
default:
|
|
118
110
|
{
|
|
119
|
-
return jsx("iframe", {
|
|
111
|
+
return jsx("iframe", {
|
|
112
|
+
...props,
|
|
120
113
|
className: IDs.frame,
|
|
121
114
|
css: frameCSS,
|
|
122
115
|
frameBorder: 0,
|
|
@@ -126,37 +119,29 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
126
119
|
}
|
|
127
120
|
}
|
|
128
121
|
};
|
|
129
|
-
|
|
130
122
|
useEffect(() => {
|
|
131
123
|
const fileType = getFileType(url, undefined, false);
|
|
132
|
-
|
|
133
124
|
if (fileType === 'pdf') {
|
|
134
125
|
const intervalId = setInterval(updateIframeSrc, 2000);
|
|
135
126
|
setIframeTimeoutId(intervalId);
|
|
136
127
|
}
|
|
137
128
|
}, []);
|
|
138
|
-
|
|
139
129
|
const iframeLoaded = () => {
|
|
140
130
|
clearInterval(iframeTimeoutId);
|
|
141
131
|
setIframeTimeoutId(null);
|
|
142
132
|
};
|
|
143
|
-
|
|
144
133
|
const getIframeLink = () => {
|
|
145
134
|
return `https://docs.google.com/gview?url=${url}&embedded=true`;
|
|
146
135
|
};
|
|
147
|
-
|
|
148
136
|
const updateIframeSrc = () => {
|
|
149
137
|
if (iframeRef.current) {
|
|
150
138
|
iframeRef.current.src = getIframeLink();
|
|
151
139
|
}
|
|
152
140
|
};
|
|
153
|
-
|
|
154
141
|
useImperativeHandle(reference, () => {
|
|
155
142
|
const currentRef = ref.current || {};
|
|
156
143
|
const _instance = {}; // methods
|
|
157
|
-
|
|
158
144
|
_instance.__proto__ = {}; // hidden methods
|
|
159
|
-
|
|
160
145
|
currentRef.instance = _instance;
|
|
161
146
|
return currentRef;
|
|
162
147
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { css, jsx } from '@emotion/core';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
@@ -43,22 +42,17 @@ const Status = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
43
42
|
}, reference) => {
|
|
44
43
|
const ref = useRef(null);
|
|
45
44
|
const outlinedPaddingSize = filledPaddingSizeMap.get(size);
|
|
46
|
-
|
|
47
45
|
const _color = colorMap.get(color) || color || rest;
|
|
48
|
-
|
|
49
46
|
const iconSize = iconSizeMap.get(size);
|
|
50
47
|
const typographySize = typographySizeMap.get(size);
|
|
51
|
-
|
|
52
48
|
const _StatusRoot = StatusRoot(iconSize, _color, size, outlinedPaddingSize);
|
|
53
|
-
|
|
54
49
|
useImperativeHandle(reference, () => {
|
|
55
50
|
const currentRef = ref.current || {};
|
|
56
51
|
currentRef.element = ref.current;
|
|
57
|
-
const _instance = {
|
|
52
|
+
const _instance = {
|
|
53
|
+
...action
|
|
58
54
|
}; // methods
|
|
59
|
-
|
|
60
55
|
_instance.__proto__ = {}; // hidden methods
|
|
61
|
-
|
|
62
56
|
currentRef.instance = _instance;
|
|
63
57
|
return currentRef;
|
|
64
58
|
});
|
|
@@ -84,7 +78,6 @@ const Status = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
84
78
|
}, StatusIcon, StatusText);
|
|
85
79
|
}, [className, color, icon, size, text, viewType, id, style]);
|
|
86
80
|
}));
|
|
87
|
-
|
|
88
81
|
const StatusRoot = (iconSize, color, size, outlinedPaddingSize) => css`
|
|
89
82
|
${flexRow};
|
|
90
83
|
${alignCenter};
|
|
@@ -102,7 +95,6 @@ const StatusRoot = (iconSize, color, size, outlinedPaddingSize) => css`
|
|
|
102
95
|
}
|
|
103
96
|
}
|
|
104
97
|
`;
|
|
105
|
-
|
|
106
98
|
const TextCSS = css`
|
|
107
99
|
white-space: nowrap;
|
|
108
100
|
`;
|
|
@@ -117,22 +109,16 @@ Status.defaultProps = {
|
|
|
117
109
|
Status.propTypes = {
|
|
118
110
|
/** Class for component. */
|
|
119
111
|
className: PropTypes.string,
|
|
120
|
-
|
|
121
112
|
/** The color of the component. */
|
|
122
113
|
color: PropTypes.string,
|
|
123
|
-
|
|
124
114
|
/** [Icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic--basic) or element placed before the content. */
|
|
125
115
|
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
126
|
-
|
|
127
116
|
/** The size of the component. */
|
|
128
117
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
129
|
-
|
|
130
118
|
/** The content of the component. */
|
|
131
119
|
text: PropTypes.string,
|
|
132
|
-
|
|
133
120
|
/** The variant to use. */
|
|
134
121
|
viewType: PropTypes.oneOf(['filled', 'default', 'ghost']),
|
|
135
|
-
|
|
136
122
|
/** Style inline of component. */
|
|
137
123
|
style: PropTypes.object
|
|
138
124
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import React, { forwardRef, useState, memo, useEffect, useRef, useImperativeHandle, useMemo } from 'react';
|
|
5
4
|
import { jsx, css } from '@emotion/core';
|
|
@@ -30,20 +29,17 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
30
29
|
}));
|
|
31
30
|
if (level === 'level1') level = 'h3';
|
|
32
31
|
if (level === 'level2') level = 'p1';
|
|
33
|
-
|
|
34
32
|
const _TabContainerCSS = TabContainerCSS(direction, width);
|
|
35
|
-
|
|
36
33
|
useEffect(() => {
|
|
37
34
|
if (isNumeric(value)) setTabIndexState(value);else setTabIndexState(tabIndex);
|
|
38
35
|
}, [value, tabIndex]);
|
|
39
36
|
useImperativeHandle(reference, () => {
|
|
40
37
|
const currentRef = ref.current || {};
|
|
41
38
|
currentRef.element = ref.current;
|
|
42
|
-
const _instance = {
|
|
39
|
+
const _instance = {
|
|
40
|
+
...action
|
|
43
41
|
}; // methods
|
|
44
|
-
|
|
45
42
|
_instance.__proto__ = {}; // hidden methods
|
|
46
|
-
|
|
47
43
|
currentRef.instance = _instance;
|
|
48
44
|
return currentRef;
|
|
49
45
|
});
|
|
@@ -66,13 +62,11 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
66
62
|
}))));
|
|
67
63
|
}, [children, className, direction, level, props, style, tabIndex, width, tabIndexState, value]);
|
|
68
64
|
}));
|
|
69
|
-
|
|
70
65
|
const TabContainerCSS = (direction, width) => css`
|
|
71
66
|
${direction === 'vertical' ? flexRow : flexCol};
|
|
72
67
|
${positionRelative};
|
|
73
68
|
${parseWidth(width)};
|
|
74
69
|
`;
|
|
75
|
-
|
|
76
70
|
TabContainer.defaultProps = {
|
|
77
71
|
className: '',
|
|
78
72
|
direction: 'horizontal',
|
|
@@ -84,28 +78,20 @@ TabContainer.defaultProps = {
|
|
|
84
78
|
TabContainer.propTypes = {
|
|
85
79
|
/** The content of the component. */
|
|
86
80
|
children: PropTypes.node,
|
|
87
|
-
|
|
88
81
|
/** Class for component */
|
|
89
82
|
className: PropTypes.string,
|
|
90
|
-
|
|
91
83
|
/** Direction change the position of Tabs. */
|
|
92
84
|
direction: PropTypes.oneOf(['vertical', 'horizontal']),
|
|
93
|
-
|
|
94
85
|
/** Direction change the size typography of Tab (typesTypography is types of Typography - exp: h1, h2, h3, p1 ...). */
|
|
95
86
|
level: PropTypes.oneOfType([PropTypes.oneOf(['level1', 'level2', ...typographyTypes])]),
|
|
96
|
-
|
|
97
87
|
/** Style inline of component. */
|
|
98
88
|
style: PropTypes.object,
|
|
99
|
-
|
|
100
89
|
/** The value of the currently selected Tab. */
|
|
101
90
|
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
102
|
-
|
|
103
91
|
/** Width of component. */
|
|
104
92
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
105
|
-
|
|
106
93
|
/** Any props else. */
|
|
107
94
|
props: PropTypes.any,
|
|
108
|
-
|
|
109
95
|
/**
|
|
110
96
|
* Ref methods.
|
|
111
97
|
*/
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import React, { memo, forwardRef, useContext, useRef, useState, useImperativeHandle, useMemo } from 'react';
|
|
5
4
|
import { jsx, css } from '@emotion/core';
|
|
@@ -24,7 +23,6 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
24
23
|
...props
|
|
25
24
|
}, reference) => {
|
|
26
25
|
var _ref$current, _ref$current2;
|
|
27
|
-
|
|
28
26
|
const {
|
|
29
27
|
direction
|
|
30
28
|
} = useContext(TabContext);
|
|
@@ -33,28 +31,22 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
33
31
|
const isVertical = direction === 'vertical';
|
|
34
32
|
let showScrollLeftButton = !isVertical && scrollLeft > 0;
|
|
35
33
|
let showScrollRightButton = !isVertical && (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.offsetWidth) + scrollLeft < (ref === null || ref === void 0 ? void 0 : (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.scrollWidth);
|
|
36
|
-
|
|
37
34
|
const _ContainerCSS = ContainerCSS(centered, isVertical, width);
|
|
38
|
-
|
|
39
35
|
const _TabHeaderCSS = TabHeaderCSS(isVertical, width);
|
|
40
|
-
|
|
41
36
|
const scrollLeftButtonCSS = scrollButtonCSS(true, showScrollLeftButton, showScrollRightButton);
|
|
42
37
|
const scrollRightButtonCSS = scrollButtonCSS(false, showScrollLeftButton, showScrollRightButton);
|
|
43
|
-
|
|
44
38
|
const _onClickScrollButton = scrollPrevious => {
|
|
45
39
|
let scrollValue = scrollPrevious ? ref.current.scrollLeft - (ref.current.offsetWidth + 30) : ref.current.scrollLeft + (ref.current.offsetWidth + 30);
|
|
46
40
|
ref.current.scrollLeft = scrollValue;
|
|
47
41
|
setScrollLeft(scrollValue);
|
|
48
42
|
};
|
|
49
|
-
|
|
50
43
|
useImperativeHandle(reference, () => {
|
|
51
44
|
const currentRef = ref.current || {};
|
|
52
45
|
currentRef.element = ref.current;
|
|
53
|
-
const _instance = {
|
|
46
|
+
const _instance = {
|
|
47
|
+
...action
|
|
54
48
|
}; // methods
|
|
55
|
-
|
|
56
49
|
_instance.__proto__ = {}; // hidden methods
|
|
57
|
-
|
|
58
50
|
currentRef.instance = _instance;
|
|
59
51
|
return currentRef;
|
|
60
52
|
});
|
|
@@ -79,7 +71,6 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
79
71
|
ref: ref,
|
|
80
72
|
onScroll: e => {
|
|
81
73
|
var _e$target;
|
|
82
|
-
|
|
83
74
|
return scrollButtons && setScrollLeft((e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.scrollLeft) || 0);
|
|
84
75
|
}
|
|
85
76
|
}, React.Children.map(children, child => child && /*#__PURE__*/React.cloneElement(child, {
|
|
@@ -95,7 +86,6 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
95
86
|
}));
|
|
96
87
|
}, [centered, children, className, level, props, scrollButtons, style, width, direction, isVertical, scrollLeft]);
|
|
97
88
|
}));
|
|
98
|
-
|
|
99
89
|
const ContainerCSS = (centered, isVertical, width) => css`
|
|
100
90
|
${flexRow};
|
|
101
91
|
${overflowHidden};
|
|
@@ -107,7 +97,6 @@ const ContainerCSS = (centered, isVertical, width) => css`
|
|
|
107
97
|
max-width: ${isVertical ? 'max-content' : '100%'};
|
|
108
98
|
padding: 0;
|
|
109
99
|
`;
|
|
110
|
-
|
|
111
100
|
const TabHeaderCSS = (isVertical, width) => isVertical ? css`
|
|
112
101
|
${flexCol};
|
|
113
102
|
${parseWidth(width)};
|
|
@@ -126,7 +115,6 @@ const TabHeaderCSS = (isVertical, width) => isVertical ? css`
|
|
|
126
115
|
${displayNone};
|
|
127
116
|
}
|
|
128
117
|
`;
|
|
129
|
-
|
|
130
118
|
const scrollButtonCSS = (scrollPrevious, showScrollLeftButton, showScrollRightButton) => css`
|
|
131
119
|
${parseWidthHeight(24, 24)};
|
|
132
120
|
overflow: initial;
|
|
@@ -139,7 +127,6 @@ const scrollButtonCSS = (scrollPrevious, showScrollLeftButton, showScrollRightBu
|
|
|
139
127
|
}
|
|
140
128
|
}
|
|
141
129
|
`;
|
|
142
|
-
|
|
143
130
|
TabHeader.defaultProps = {
|
|
144
131
|
centered: false,
|
|
145
132
|
className: '',
|
|
@@ -150,27 +137,20 @@ TabHeader.defaultProps = {
|
|
|
150
137
|
TabHeader.propTypes = {
|
|
151
138
|
/** If true, the tabs are centered. */
|
|
152
139
|
centered: PropTypes.bool,
|
|
153
|
-
|
|
154
140
|
/** Element to display in Tab header. */
|
|
155
141
|
children: PropTypes.array,
|
|
156
|
-
|
|
157
142
|
/** Class for component. */
|
|
158
143
|
className: PropTypes.string,
|
|
159
|
-
|
|
160
144
|
/** If true, show scroll buttons. */
|
|
161
145
|
scrollButtons: PropTypes.bool,
|
|
162
|
-
|
|
163
146
|
/** Style inline of component. */
|
|
164
147
|
style: PropTypes.object,
|
|
165
|
-
|
|
166
148
|
/** Width of component. */
|
|
167
149
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
168
|
-
|
|
169
150
|
/** Any props else. */
|
|
170
151
|
props: PropTypes.any,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
* Ref methods.
|
|
152
|
+
/**
|
|
153
|
+
* Ref methods.
|
|
174
154
|
*/
|
|
175
155
|
reference: ref
|
|
176
156
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { memo, forwardRef, useContext, useRef, useEffect, useState, useImperativeHandle, useMemo } from 'react';
|
|
5
4
|
import { jsx, css } from '@emotion/core';
|
|
@@ -33,20 +32,17 @@ const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
33
32
|
const ref = useRef(null);
|
|
34
33
|
const isVertical = direction === 'vertical';
|
|
35
34
|
const isActive = index === tabIndexState;
|
|
36
|
-
|
|
37
35
|
const _TabPanelCSS = TabPanelCSS(isVertical, isActive);
|
|
38
|
-
|
|
39
36
|
useEffect(() => {
|
|
40
37
|
if (isRendered) return;else if (index === tabIndexState) setIsRendered(true);
|
|
41
38
|
}, [tabIndexState]);
|
|
42
39
|
useImperativeHandle(reference, () => {
|
|
43
40
|
const currentRef = ref.current || {};
|
|
44
41
|
currentRef.element = ref.current;
|
|
45
|
-
const _instance = {
|
|
42
|
+
const _instance = {
|
|
43
|
+
...action
|
|
46
44
|
}; // methods
|
|
47
|
-
|
|
48
45
|
_instance.__proto__ = {}; // hidden methods
|
|
49
|
-
|
|
50
46
|
currentRef.instance = _instance;
|
|
51
47
|
return currentRef;
|
|
52
48
|
});
|
|
@@ -63,7 +59,6 @@ const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
63
59
|
}, isActive || !lazyLoading || isRendered ? children : null);
|
|
64
60
|
}, [children, className, index, lazyLoading, props, style, isActive, isRendered, tabIndexState]);
|
|
65
61
|
}));
|
|
66
|
-
|
|
67
62
|
const TabPanelCSS = (isVertical, isActive) => css`
|
|
68
63
|
${flexCol};
|
|
69
64
|
${borderBox};
|
|
@@ -73,7 +68,6 @@ const TabPanelCSS = (isVertical, isActive) => css`
|
|
|
73
68
|
color: ${main};
|
|
74
69
|
padding: ${spacing([0, isVertical ? 3 : 2.5])};
|
|
75
70
|
`;
|
|
76
|
-
|
|
77
71
|
TabPanel.defaultProps = {
|
|
78
72
|
className: '',
|
|
79
73
|
lazyLoading: false,
|
|
@@ -82,24 +76,18 @@ TabPanel.defaultProps = {
|
|
|
82
76
|
TabPanel.propTypes = {
|
|
83
77
|
/** The content of the component. */
|
|
84
78
|
children: PropTypes.node,
|
|
85
|
-
|
|
86
79
|
/** Class for component. */
|
|
87
80
|
className: PropTypes.string,
|
|
88
|
-
|
|
89
81
|
/** Index received in position of TabHeaderButton. */
|
|
90
82
|
index: PropTypes.number,
|
|
91
|
-
|
|
92
83
|
/** Lazy loading mode. */
|
|
93
84
|
lazyLoading: PropTypes.bool,
|
|
94
|
-
|
|
95
85
|
/** Style inline of component. */
|
|
96
86
|
style: PropTypes.object,
|
|
97
|
-
|
|
98
87
|
/** Any props else. */
|
|
99
88
|
props: PropTypes.any,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
* Ref methods.
|
|
89
|
+
/**
|
|
90
|
+
* Ref methods.
|
|
103
91
|
*/
|
|
104
92
|
reference: ref
|
|
105
93
|
};
|