diginet-core-ui 1.3.35 → 1.3.36

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 CHANGED
@@ -38,6 +38,17 @@ npm test
38
38
  ```
39
39
 
40
40
  ## Changelog
41
+ ## 1.3.36
42
+ \[Added\]: MenuIcon - W05F0013N0000, MHRP39N0017, MHRM09N0005, MHRM13N0001
43
+ \[Changed\]: Attachment - Add prop domain, isStripDomain
44
+ \[Changed\]: Tooltip - Add className
45
+ \[Changed\]: Avatar - Add Add lazyLoading
46
+ \[Changed\]: Popover - Change transition; Add prop direction; Add description on storybook
47
+ \[Changed\]: TECH - Hide unused components on storybook
48
+ \[Changed\]: Typography - Add prop showTooltip to show tooltip when content is clamped
49
+ \[Changed\]: DropdownBox - Add endIcon
50
+ \[Fixed\]: Tooltip - Fix bug not show tooltip; Optimize code
51
+
41
52
  ## 1.3.35
42
53
  - \[Added\]: Icon - AssignmentTurnedIn, DGNProducts
43
54
  - \[Added\]: MenuIcon - MHRP09N0032
package/styles/general.js CHANGED
@@ -2,6 +2,27 @@ import { css, jsx } from '@emotion/core';
2
2
  import { color } from './colors';
3
3
  import { parseToPixel } from './utils';
4
4
  export const rootSpacing = 4;
5
+ export const rootZIndex = 100;
6
+ /**
7
+ * get value zIndex with rootZIndex
8
+ * @param number
9
+ * @return {number}
10
+ */
11
+
12
+ export const zIndex = number => {
13
+ number = Number(number || 0);
14
+ if (isNaN(number)) return rootZIndex;
15
+ return rootZIndex + number;
16
+ };
17
+ /**
18
+ * get value spacing with rooSpacing
19
+ * @param vl - default 1
20
+ * @returns {number}
21
+ */
22
+
23
+ export const getSpacing = (vl = 1) => {
24
+ return Number(vl) * rootSpacing;
25
+ };
5
26
  export const flexRow = css`
6
27
  display: flex;
7
28
  `;
package/theme/settings.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as colors from '../styles/colors';
2
2
  import { font } from '../styles/font';
3
3
  import { color } from '../styles/colors';
4
- import { rootSpacing } from '../styles/general';
4
+ import { getSpacing, zIndex } from '../styles/general';
5
5
  const {
6
6
  fontSize,
7
7
  fontFamily,
@@ -41,13 +41,13 @@ const settings = {
41
41
  fontFamilyBold,
42
42
  fontSize,
43
43
  label: {
44
- fontSize: 12,
44
+ fontSize: '12px',
45
45
  fontFamily,
46
46
  fontWeight: '500',
47
47
  lineHeight: '16px'
48
48
  },
49
49
  helperText: {
50
- fontSize: 12,
50
+ fontSize: '12px',
51
51
  fontFamily,
52
52
  fontWeight: 'normal',
53
53
  lineHeight: '16px'
@@ -55,27 +55,18 @@ const settings = {
55
55
  },
56
56
  breakpoints: {
57
57
  values: {
58
- xs: 0,
59
- sm: 600,
60
- md: 960,
61
- lg: 1280,
62
- xl: 1920
58
+ xs: 600,
59
+ sm: 960,
60
+ md: 1280,
61
+ lg: 1920
63
62
  },
64
63
  down: value => getMedia(value, 'max'),
65
64
  up: value => getMedia(value, 'min'),
66
65
  only: value => getMedia(value, 'min', value),
67
66
  between: (start, end) => getMedia(start, 'min', end)
68
67
  },
69
- spacing: vl => getSpacing(vl)
70
- };
71
- /**
72
- * get value spacing with rooSpacing
73
- * @param vl - default 1
74
- * @returns {number}
75
- */
76
-
77
- const getSpacing = (vl = 1) => {
78
- return Number(vl) * rootSpacing;
68
+ spacing: vl => getSpacing(vl),
69
+ zIndex: vl => zIndex(vl)
79
70
  };
80
71
 
81
72
  const getMedia = (value, type, value2 = '') => {
@@ -0,0 +1,41 @@
1
+ import { useEffect } from 'react';
2
+ let listenerCallbacks = new WeakMap();
3
+ let observer;
4
+
5
+ const handleIntersections = entries => {
6
+ entries.forEach(entry => {
7
+ if (listenerCallbacks.has(entry.target)) {
8
+ let cb = listenerCallbacks.get(entry.target);
9
+
10
+ if (entry.isIntersecting || entry.intersectionRatio > 0) {
11
+ observer.unobserve(entry.target);
12
+ listenerCallbacks.delete(entry.target);
13
+ cb();
14
+ }
15
+ }
16
+ });
17
+ };
18
+
19
+ const getIntersectionObserver = () => {
20
+ if (observer === undefined) {
21
+ observer = new IntersectionObserver(handleIntersections, {
22
+ rootMargin: '100px',
23
+ threshold: '0.15'
24
+ });
25
+ }
26
+
27
+ return observer;
28
+ };
29
+
30
+ export const useIntersection = (elem, callback) => {
31
+ useEffect(() => {
32
+ let target = elem.current;
33
+ let observer = getIntersectionObserver();
34
+ listenerCallbacks.set(target, callback);
35
+ observer.observe(target);
36
+ return () => {
37
+ listenerCallbacks.delete(target);
38
+ observer.unobserve(target);
39
+ };
40
+ }, []);
41
+ };
package/utils/number.js CHANGED
@@ -1,7 +1,7 @@
1
- /**
2
- *
3
- * @param {String} value
4
- * @param {String} format
1
+ /**
2
+ *
3
+ * @param {String} value
4
+ * @param {String} format
5
5
  */
6
6
  export default function numberFormat(value, format) {
7
7
  let hashCount = 0;
@@ -44,8 +44,8 @@ export default function numberFormat(value, format) {
44
44
  //For case like +1 (911) 911 91 91 having pattern +1 (###) ### ## ##
45
45
 
46
46
  const index = i === ln ? value.length : value.indexOf(part, start);
47
- /* in any case if we don't find the pattern part in the value assume the val as numeric string
48
- This will be also in case if user has started typing, in any other case it will not be -1
47
+ /* in any case if we don't find the pattern part in the value assume the val as numeric string
48
+ This will be also in case if user has started typing, in any other case it will not be -1
49
49
  unless wrong prop value is provided */
50
50
 
51
51
  if (index === -1) {