diginet-core-ui 1.4.14-beta.2 → 1.4.14-beta.3

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 (128) hide show
  1. package/components/accordion/details.js +36 -25
  2. package/components/accordion/group.js +33 -18
  3. package/components/accordion/index.js +42 -28
  4. package/components/accordion/summary.js +60 -52
  5. package/components/alert/index.js +84 -75
  6. package/components/alert/notify.js +53 -41
  7. package/components/avatar/index.js +97 -94
  8. package/components/badge/index.js +80 -78
  9. package/components/breadcrumb/index.js +62 -44
  10. package/components/button/icon.js +90 -70
  11. package/components/button/index.js +110 -88
  12. package/components/button/more.js +60 -39
  13. package/components/button/ripple-effect.js +1 -1
  14. package/components/card/body.js +38 -28
  15. package/components/card/extra.js +38 -28
  16. package/components/card/footer.js +38 -28
  17. package/components/card/header.js +39 -28
  18. package/components/card/index.js +79 -70
  19. package/components/chart/bar/Labels.js +14 -8
  20. package/components/chart/bar-v2/Labels.js +14 -8
  21. package/components/chart/line/Labels.js +14 -8
  22. package/components/chart/line/Path.js +3 -3
  23. package/components/chart/line/Point.js +12 -11
  24. package/components/chart/line-v2/Labels.js +14 -8
  25. package/components/check-text/index.js +21 -16
  26. package/components/check-text/interview-confirmation.js +21 -15
  27. package/components/check-text/interview-status.js +21 -15
  28. package/components/chip/attach.js +11 -7
  29. package/components/chip/index.js +83 -82
  30. package/components/collapse/index.js +1 -1
  31. package/components/dialogs/colors.js +13 -11
  32. package/components/divider/index.js +40 -22
  33. package/components/form-control/attachment/index.js +94 -57
  34. package/components/form-control/calendar/function.js +173 -169
  35. package/components/form-control/calendar/index.js +48 -36
  36. package/components/form-control/calendar/range.js +38 -22
  37. package/components/form-control/checkbox/index.js +87 -63
  38. package/components/form-control/control/index.js +9 -10
  39. package/components/form-control/date-picker/index.js +81 -64
  40. package/components/form-control/date-range-picker/index.js +98 -81
  41. package/components/form-control/dropdown/index.js +240 -215
  42. package/components/form-control/dropdown-box/index.js +56 -43
  43. package/components/form-control/form-group/index.js +7 -6
  44. package/components/form-control/helper-text/index.js +45 -41
  45. package/components/form-control/input-base/index.js +165 -133
  46. package/components/form-control/label/index.js +48 -41
  47. package/components/form-control/money-input/index.js +87 -79
  48. package/components/form-control/number-input/index.js +579 -521
  49. package/components/form-control/number-input/index2.js +107 -87
  50. package/components/form-control/password-input/index.js +71 -63
  51. package/components/form-control/radio/index.js +90 -74
  52. package/components/form-control/text-input/index.js +83 -74
  53. package/components/form-control/time-picker/index.js +79 -56
  54. package/components/form-control/time-picker/v2/index.js +90 -84
  55. package/components/form-control/toggle/index.js +144 -133
  56. package/components/form-view/helper-text.js +2 -2
  57. package/components/form-view/index.js +34 -31
  58. package/components/form-view/input.js +70 -69
  59. package/components/form-view/label.js +14 -9
  60. package/components/grid/Col.js +48 -39
  61. package/components/grid/Container.js +31 -38
  62. package/components/grid/Row.js +28 -32
  63. package/components/grid/index.js +66 -54
  64. package/components/image/index.js +37 -27
  65. package/components/list/list-item-action.js +36 -26
  66. package/components/list/list-item-icon.js +34 -29
  67. package/components/list/list-item-text.js +27 -22
  68. package/components/list/list-item.js +42 -36
  69. package/components/list/list.js +46 -38
  70. package/components/list/sub-header.js +33 -26
  71. package/components/modal/body.js +24 -14
  72. package/components/modal/footer.js +23 -13
  73. package/components/modal/header.js +39 -28
  74. package/components/modal/index.js +3 -3
  75. package/components/modal/modal.js +60 -49
  76. package/components/others/extra/index.js +31 -30
  77. package/components/others/import/index.js +2 -2
  78. package/components/others/scrollbar/index.js +32 -26
  79. package/components/paging/page-info.js +67 -68
  80. package/components/paging/page-selector.js +49 -49
  81. package/components/paper/index.js +32 -28
  82. package/components/popover/body.js +14 -8
  83. package/components/popover/footer.js +13 -8
  84. package/components/popover/header.js +17 -15
  85. package/components/popover/index.js +103 -92
  86. package/components/popup/danger_popup.js +17 -16
  87. package/components/popup/index.js +16 -17
  88. package/components/popup/v2/index.js +41 -54
  89. package/components/progress/circular.js +65 -80
  90. package/components/progress/linear.js +73 -58
  91. package/components/rating/index.js +49 -63
  92. package/components/slider/slider-container.js +49 -57
  93. package/components/slider/slider-item.js +30 -29
  94. package/components/status/index.js +23 -34
  95. package/components/tab/tab-header.js +20 -11
  96. package/components/tab/tab-panel.js +12 -7
  97. package/components/tab/tab.js +35 -22
  98. package/components/tooltip/index.js +24 -35
  99. package/components/transfer/index.js +105 -106
  100. package/components/tree-view/index.js +133 -115
  101. package/components/typography/index.js +72 -55
  102. package/global/index.js +2 -17
  103. package/icons/basic.js +975 -972
  104. package/icons/effect.js +21 -20
  105. package/package.json +3 -1
  106. package/styles/color-helper.js +105 -105
  107. package/styles/colors.js +168 -30
  108. package/styles/general.js +84 -16
  109. package/styles/sx/index.js +7 -4
  110. package/styles/utils.js +20 -19
  111. package/theme/createSpacing.js +10 -0
  112. package/theme/createTheme.js +26 -0
  113. package/theme/createZIndex.js +9 -0
  114. package/theme/index.js +13 -2
  115. package/theme/make-styles.js +2 -1
  116. package/theme/settings.js +699 -8
  117. package/theme/theme-provider.js +32 -15
  118. package/theme/theme.js +57 -56
  119. package/theme/use-classes.js +15 -0
  120. package/theme/utils/getThemeProps.js +12 -0
  121. package/theme/utils/resolveProps.js +17 -0
  122. package/theme/utils/useThemeProps.js +14 -0
  123. package/utils/handleBreakpoints.js +2 -2
  124. package/utils/hexToRGBA/index.js +7 -7
  125. package/utils/object/deepmerge.js +104 -0
  126. package/utils/object/object.js +7 -12
  127. package/utils/render-portal.js +4 -3
  128. package/theme/set-theme.js +0 -38
@@ -1,18 +1,26 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
- import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
4
- import PropTypes from 'prop-types';
5
3
  import { jsx } from '@emotion/core';
6
4
  import OptionWrapper from "../others/option-wrapper";
5
+ import PropTypes from 'prop-types';
6
+ import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
7
+ import useThemeProps from "../../theme/utils/useThemeProps";
7
8
  import { classNames, refType as ref } from "../../utils";
8
- const CardFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
9
- action = {},
10
- children,
11
- className,
12
- id,
13
- style,
14
- title
15
- }, reference) => {
9
+ const CardFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
10
+ if (!reference) reference = useRef(null);
11
+
12
+ // props priority: `inProps` > `themeDefaultProps`
13
+ const props = useThemeProps({
14
+ props: inProps,
15
+ name: 'CardFooter'
16
+ });
17
+ const {
18
+ action = {},
19
+ children,
20
+ className,
21
+ id,
22
+ style
23
+ } = props;
16
24
  const ref = useRef(null);
17
25
  useImperativeHandle(reference, () => {
18
26
  const currentRef = ref.current || {};
@@ -31,12 +39,14 @@ const CardFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
31
39
  style: style,
32
40
  className: classNames(`DGN-UI-Card-Footer`, className)
33
41
  }, children);
34
- }, [children, className, id, style, title]);
42
+ }, [children, className, id, style]);
35
43
  }));
36
- CardFooter.defaultProps = {
37
- className: '',
38
- style: {}
39
- };
44
+
45
+ // CardFooter.defaultProps = {
46
+ // className: '',
47
+ // style: {},
48
+ // };
49
+
40
50
  CardFooter.propTypes = {
41
51
  /** The content of the component. */
42
52
  children: PropTypes.node,
@@ -46,19 +56,19 @@ CardFooter.propTypes = {
46
56
  style: PropTypes.object,
47
57
  /** The title of the component's header. */
48
58
  title: PropTypes.string,
49
- /**
50
- * ref methods (ref.current.instance.*method*)
51
- *
52
- * * option(): Gets all UI component properties
53
- * * Returns value - object
54
- * * option(optionName): Gets the value of a single property
55
- * * @param {optionName} - string
56
- * * Returns value - any
57
- * * option(optionName, optionValue): Updates the value of a single property
58
- * * @param {optionName} - string
59
- * * @param {optionValue} - any
60
- * * option(options): Updates the values of several properties
61
- * * @param {options} - object
59
+ /**
60
+ * ref methods (ref.current.instance.*method*)
61
+ *
62
+ * * option(): Gets all UI component properties
63
+ * * Returns value - object
64
+ * * option(optionName): Gets the value of a single property
65
+ * * @param {optionName} - string
66
+ * * Returns value - any
67
+ * * option(optionName, optionValue): Updates the value of a single property
68
+ * * @param {optionName} - string
69
+ * * @param {optionValue} - any
70
+ * * option(options): Updates the values of several properties
71
+ * * @param {options} - object
62
72
  */
63
73
  ref: ref
64
74
  };
@@ -1,19 +1,28 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
- import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
4
- import PropTypes from 'prop-types';
5
3
  import { jsx } from '@emotion/core';
4
+ import { Typography } from "./..";
6
5
  import OptionWrapper from "../others/option-wrapper";
7
- import Typography from "../typography";
6
+ import PropTypes from 'prop-types';
7
+ import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
8
+ import useThemeProps from "../../theme/utils/useThemeProps";
8
9
  import { classNames, refType as ref } from "../../utils";
9
- const CardHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
10
- action = {},
11
- children,
12
- className,
13
- id,
14
- style,
15
- title
16
- }, reference) => {
10
+ const CardHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
11
+ if (!reference) reference = useRef(null);
12
+
13
+ // props priority: `inProps` > `themeDefaultProps`
14
+ const props = useThemeProps({
15
+ props: inProps,
16
+ name: 'CardHeader'
17
+ });
18
+ const {
19
+ action = {},
20
+ children,
21
+ className,
22
+ id,
23
+ style,
24
+ title
25
+ } = props;
17
26
  const ref = useRef(null);
18
27
  useImperativeHandle(reference, () => {
19
28
  const currentRef = ref.current || {};
@@ -36,10 +45,12 @@ const CardHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
36
45
  }, title));
37
46
  }, [children, className, id, style, title]);
38
47
  }));
39
- CardHeader.defaultProps = {
40
- className: '',
41
- style: {}
42
- };
48
+
49
+ // CardHeader.defaultProps = {
50
+ // className: '',
51
+ // style: {},
52
+ // };
53
+
43
54
  CardHeader.propTypes = {
44
55
  /** The content of the component. */
45
56
  children: PropTypes.node,
@@ -49,19 +60,19 @@ CardHeader.propTypes = {
49
60
  style: PropTypes.object,
50
61
  /** The title of the component's header. */
51
62
  title: PropTypes.string,
52
- /**
53
- * ref methods (ref.current.instance.*method*)
54
- *
55
- * * option(): Gets all UI component properties
56
- * * Returns value - object
57
- * * option(optionName): Gets the value of a single property
58
- * * @param {optionName} - string
59
- * * Returns value - any
60
- * * option(optionName, optionValue): Updates the value of a single property
61
- * * @param {optionName} - string
62
- * * @param {optionValue} - any
63
- * * option(options): Updates the values of several properties
64
- * * @param {options} - object
63
+ /**
64
+ * ref methods (ref.current.instance.*method*)
65
+ *
66
+ * * option(): Gets all UI component properties
67
+ * * Returns value - object
68
+ * * option(optionName): Gets the value of a single property
69
+ * * @param {optionName} - string
70
+ * * Returns value - any
71
+ * * option(optionName, optionValue): Updates the value of a single property
72
+ * * @param {optionName} - string
73
+ * * @param {optionValue} - any
74
+ * * option(options): Updates the values of several properties
75
+ * * @param {options} - object
65
76
  */
66
77
  ref: ref
67
78
  };
@@ -1,49 +1,51 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
- import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
4
- import PropTypes from 'prop-types';
5
- import { jsx, css } from '@emotion/core';
3
+ import { css, jsx } from '@emotion/core';
6
4
  import OptionWrapper from "../others/option-wrapper";
7
- import theme from "../../theme/settings";
8
- import { boxBorder, borderRadius4px, flexCol, flexRow, justifyEnd, overflowHidden, parseWidth, parseWidthHeight, positionAbsolute, positionRelative } from "../../styles/general";
9
- import CardHeader from "./header";
10
- import { CardFooter } from "./footer";
11
- import { CardBody } from "./body";
5
+ import PropTypes from 'prop-types';
6
+ import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
7
+ import { bgColor, borderRadius4px, boxBorder, flexCol, flexRow, justifyEnd, overflowHidden, parseWidth, parseWidthHeight, positionAbsolute, positionRelative } from "../../styles/general";
12
8
  import { getColor } from "../../styles/utils";
13
- import { classNames, refType as ref } from "../../utils";
14
- const {
15
- colors: {
16
- system: {
17
- white
18
- },
19
- line: {
20
- category
21
- }
22
- },
23
- spacing
24
- } = theme;
25
- const Card = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
26
- action = {},
27
- body: bodyProp,
28
- bodyStyle,
29
- children,
30
- className,
31
- dividerColor,
32
- direction,
33
- footer,
34
- footerDivider,
35
- footerStyle,
36
- header,
37
- headerDivider,
38
- headerStyle,
39
- height,
40
- id,
41
- style,
42
- title,
43
- width
44
- }, reference) => {
9
+ import { useTheme } from "../../theme";
10
+ import { classNames, getProp, refType as ref } from "../../utils";
11
+ import { CardBody } from "./body";
12
+ import { CardFooter } from "./footer";
13
+ import CardHeader from "./header";
14
+ import useThemeProps from "../../theme/utils/useThemeProps";
15
+ const Card = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
16
+ if (!reference) reference = useRef(null);
17
+ const theme = useTheme();
18
+ const {
19
+ colors
20
+ } = theme;
21
+
22
+ // props priority: `inProps` > `themeDefaultProps`
23
+ const props = useThemeProps({
24
+ props: inProps,
25
+ name: 'Card'
26
+ });
27
+ const {
28
+ action = {},
29
+ body: bodyProp,
30
+ bodyStyle,
31
+ children,
32
+ className,
33
+ dividerColor,
34
+ direction,
35
+ footer,
36
+ footerDivider,
37
+ footerStyle,
38
+ header,
39
+ headerDivider,
40
+ headerStyle,
41
+ height,
42
+ id,
43
+ style,
44
+ title,
45
+ width
46
+ } = props;
45
47
  const ref = useRef(null);
46
- const _CardCSS = CardCSS(width, height, headerDivider, footerDivider, dividerColor, direction);
48
+ const _CardCSS = CardCSS(width, height, headerDivider, footerDivider, getProp(colors, dividerColor, dividerColor), direction, theme);
47
49
  useImperativeHandle(reference, () => {
48
50
  const currentRef = ref.current || {};
49
51
  currentRef.element = ref.current;
@@ -77,15 +79,18 @@ const Card = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
77
79
  }, head, body || children, foot);
78
80
  }, [bodyProp, bodyStyle, children, className, dividerColor, direction, footer, footerDivider, footerStyle, header, headerDivider, headerStyle, height, id, style, title, width]);
79
81
  }));
80
- const CardCSS = (width, height, headerDivider, footerDivider, dividerColor, direction) => css`
82
+ const CardCSS = (width, height, headerDivider, footerDivider, dividerColor, direction, {
83
+ colors,
84
+ spacing
85
+ }) => css`
81
86
  ${direction === 'vertical' ? flexCol : flexRow};
82
87
  ${positionRelative};
83
88
  ${boxBorder};
84
89
  ${borderRadius4px};
85
90
  ${overflowHidden}
86
- ${parseWidthHeight(width || spacing([64.5]), height || 'max-content')};
91
+ ${parseWidthHeight(width, height)};
87
92
  ${parseWidth(width)};
88
- background: ${white};
93
+ ${bgColor(getProp(colors, 'system/standard'))};
89
94
  .DGN-UI-Card-Header {
90
95
  ${flexRow};
91
96
  ${positionRelative};
@@ -107,7 +112,7 @@ const CardCSS = (width, height, headerDivider, footerDivider, dividerColor, dire
107
112
  ${positionRelative};
108
113
  ${boxBorder};
109
114
  order: 2;
110
- padding: ${headerDivider ? spacing([4]) : spacing([0, 4, 4])};
115
+ padding: ${spacing(headerDivider ? [4] : [0, 4, 4])};
111
116
  }
112
117
  .DGN-UI-Card-Footer {
113
118
  ${flexRow};
@@ -115,7 +120,7 @@ const CardCSS = (width, height, headerDivider, footerDivider, dividerColor, dire
115
120
  ${positionRelative};
116
121
  ${boxBorder};
117
122
  order: 3;
118
- padding: ${footerDivider ? spacing([4]) : spacing([0, 4, 4])};
123
+ padding: ${spacing(footerDivider ? [4] : [0, 4, 4])};
119
124
  &:before {
120
125
  ${positionAbsolute};
121
126
  content: '';
@@ -132,17 +137,21 @@ const CardCSS = (width, height, headerDivider, footerDivider, dividerColor, dire
132
137
  ${boxBorder};
133
138
  }
134
139
  `;
135
- Card.defaultProps = {
136
- bodyStyle: {},
137
- className: '',
138
- dividerColor: category,
139
- direction: 'vertical',
140
- footerDivider: false,
141
- footerStyle: {},
142
- headerDivider: true,
143
- headerStyle: {},
144
- style: {}
145
- };
140
+
141
+ // Card.defaultProps = {
142
+ // bodyStyle: {},
143
+ // className: '',
144
+ // dividerColor: 'line/category',
145
+ // direction: 'vertical',
146
+ // footerDivider: false,
147
+ // footerStyle: {},
148
+ // headerDivider: true,
149
+ // headerStyle: {},
150
+ // style: {},
151
+ // width: 258,
152
+ // height: 'max-content',
153
+ // };
154
+
146
155
  Card.propTypes = {
147
156
  /** The content of the component's body. */
148
157
  body: PropTypes.node,
@@ -174,19 +183,19 @@ Card.propTypes = {
174
183
  title: PropTypes.string,
175
184
  /** Width of the component. */
176
185
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
177
- /**
178
- * ref methods (ref.current.instance.*method*)
179
- *
180
- * * option(): Gets all UI component properties
181
- * * Returns value - object
182
- * * option(optionName): Gets the value of a single property
183
- * * @param {optionName} - string
184
- * * Returns value - any
185
- * * option(optionName, optionValue): Updates the value of a single property
186
- * * @param {optionName} - string
187
- * * @param {optionValue} - any
188
- * * option(options): Updates the values of several properties
189
- * * @param {options} - object
186
+ /**
187
+ * ref methods (ref.current.instance.*method*)
188
+ *
189
+ * * option(): Gets all UI component properties
190
+ * * Returns value - object
191
+ * * option(optionName): Gets the value of a single property
192
+ * * @param {optionName} - string
193
+ * * Returns value - any
194
+ * * option(optionName, optionValue): Updates the value of a single property
195
+ * * @param {optionName} - string
196
+ * * @param {optionValue} - any
197
+ * * option(options): Updates the values of several properties
198
+ * * @param {options} - object
190
199
  */
191
200
  ref: ref
192
201
  };
@@ -1,15 +1,15 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  /** @jsxRuntime classic */
3
3
  /** @jsx jsx */
4
+ import { css, jsx } from '@emotion/core';
4
5
  import PropTypes from 'prop-types';
5
- import { jsx, css } from '@emotion/core';
6
- import theme from "../../../theme/settings";
7
- import { typography } from "../../../styles/typography";
6
+ import { useTheme } from "../../../theme";
7
+ import { getProp } from "../../../utils";
8
8
  const Labels = ({
9
9
  getX,
10
10
  getY,
11
11
  data,
12
- labelsColor,
12
+ labelsColor: labelsColorProp,
13
13
  labelsCountY,
14
14
  labelsFormatX,
15
15
  viewBoxWidth,
@@ -23,6 +23,12 @@ const Labels = ({
23
23
  minX,
24
24
  unitWidth
25
25
  }) => {
26
+ const theme = useTheme();
27
+ const {
28
+ colors,
29
+ typography
30
+ } = theme;
31
+ const labelsColor = getProp(colors, labelsColorProp, labelsColorProp);
26
32
  const labelContainerCSS = css`
27
33
  transform: translate(0, ${labelsOffsetX}px);
28
34
  `;
@@ -32,7 +38,7 @@ const Labels = ({
32
38
  text-align: center;
33
39
  `;
34
40
  const LabelCSS = labelStyle === 'italic' ? css`
35
- fill: ${theme.colors.system.rest};
41
+ fill: ${getProp(colors, 'system/rest')};
36
42
  text-anchor: start;
37
43
  ${typography.paragraph3};
38
44
  text-transform: capitalize;
@@ -41,7 +47,7 @@ const Labels = ({
41
47
  transform-box: fill-box;
42
48
  transform: rotateZ(45deg);
43
49
  ` : css`
44
- color: ${theme.colors.system.rest};
50
+ color: ${getProp(colors, 'system/rest')};
45
51
  text-anchor: middle;
46
52
  ${typography.paragraph3};
47
53
  text-transform: capitalize;
@@ -51,7 +57,7 @@ const Labels = ({
51
57
  `;
52
58
  const TextCSS = css`
53
59
  ${typography.paragraph3};
54
- fill: ${theme.colors.system.rest};
60
+ fill: ${getProp(colors, 'system/rest')};
55
61
  cursor: 'pointer';
56
62
  `;
57
63
  if (labelsVisible) {
@@ -112,7 +118,7 @@ Labels.defaultProps = {
112
118
  getX: x => x,
113
119
  getY: quantity => quantity,
114
120
  labelsCharacterWidth: 10,
115
- labelsColor: theme.colors.system.rest,
121
+ labelsColor: 'system/rest',
116
122
  labelsCountY: 5,
117
123
  labelsFormatX: label => label,
118
124
  labelsFormatY: quantity => quantity,
@@ -1,15 +1,15 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  /** @jsxRuntime classic */
3
3
  /** @jsx jsx */
4
+ import { css, jsx } from '@emotion/core';
4
5
  import PropTypes from 'prop-types';
5
- import { jsx, css } from '@emotion/core';
6
- import theme from "../../../theme/settings";
7
- import { typography } from "../../../styles/typography";
6
+ import { useTheme } from "../../../theme";
7
+ import { getProp } from "../../../utils";
8
8
  const Labels = ({
9
9
  getX,
10
10
  getY,
11
11
  data,
12
- labelsColor,
12
+ labelsColor: labelsColorProp,
13
13
  labelsCountY,
14
14
  labelsFormatX,
15
15
  viewBoxWidth,
@@ -23,6 +23,12 @@ const Labels = ({
23
23
  minX,
24
24
  unitWidth
25
25
  }) => {
26
+ const theme = useTheme();
27
+ const {
28
+ colors,
29
+ typography
30
+ } = theme;
31
+ const labelsColor = getProp(colors, labelsColorProp, labelsColorProp);
26
32
  const labelContainerCSS = css`
27
33
  transform: translate(0, ${labelsOffsetX}px);
28
34
  `;
@@ -32,7 +38,7 @@ const Labels = ({
32
38
  text-align: center;
33
39
  `;
34
40
  const LabelCSS = labelStyle === 'italic' ? css`
35
- fill: ${theme.colors.system.rest};
41
+ fill: ${getProp(colors, 'system/rest')};
36
42
  text-anchor: start;
37
43
  ${typography.paragraph3};
38
44
  text-transform: capitalize;
@@ -41,7 +47,7 @@ const Labels = ({
41
47
  transform-box: fill-box;
42
48
  transform: rotateZ(45deg);
43
49
  ` : css`
44
- color: ${theme.colors.system.rest};
50
+ color: ${getProp(colors, 'system/rest')};
45
51
  text-anchor: middle;
46
52
  ${typography.paragraph3};
47
53
  text-transform: capitalize;
@@ -51,7 +57,7 @@ const Labels = ({
51
57
  `;
52
58
  const TextCSS = css`
53
59
  ${typography.paragraph3};
54
- fill: ${theme.colors.system.rest};
60
+ fill: ${getProp(colors, 'system/rest')};
55
61
  cursor: 'pointer';
56
62
  `;
57
63
  if (labelsVisible) {
@@ -112,7 +118,7 @@ Labels.defaultProps = {
112
118
  getX: x => x,
113
119
  getY: quantity => quantity,
114
120
  labelsCharacterWidth: 10,
115
- labelsColor: theme.colors.system.rest,
121
+ labelsColor: 'system/rest',
116
122
  labelsCountY: 5,
117
123
  labelsFormatX: label => label,
118
124
  labelsFormatY: quantity => quantity,
@@ -1,15 +1,15 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  /** @jsxRuntime classic */
3
3
  /** @jsx jsx */
4
+ import { css, jsx } from '@emotion/core';
4
5
  import PropTypes from 'prop-types';
5
- import { jsx, css } from '@emotion/core';
6
- import theme from "../../../theme/settings";
7
- import { typography } from "../../../styles/typography";
6
+ import { useTheme } from "../../../theme";
7
+ import { getProp } from "../../../utils";
8
8
  const Labels = ({
9
9
  getX,
10
10
  getY,
11
11
  data,
12
- labelsColor,
12
+ labelsColor: labelsColorProp,
13
13
  labelsCountY,
14
14
  labelsFormatX,
15
15
  labelsFormatY,
@@ -22,6 +22,12 @@ const Labels = ({
22
22
  minX,
23
23
  unitWidth
24
24
  }) => {
25
+ const theme = useTheme();
26
+ const {
27
+ colors,
28
+ typography
29
+ } = theme;
30
+ const labelsColor = getProp(colors, labelsColorProp, labelsColorProp);
25
31
  const labelContainerCSS = css`
26
32
  transform: translate(0, ${labelsOffsetX}px);
27
33
  `;
@@ -31,7 +37,7 @@ const Labels = ({
31
37
  text-align: center;
32
38
  `;
33
39
  const LabelCSS = labelStyle === 'italic' ? css`
34
- fill: ${theme.colors.system.rest};
40
+ fill: ${getProp(colors, 'system/rest')};
35
41
  text-anchor: start;
36
42
  ${typography.paragraph3};
37
43
  text-transform: capitalize;
@@ -40,7 +46,7 @@ const Labels = ({
40
46
  transform-box: fill-box;
41
47
  transform: rotateZ(45deg);
42
48
  ` : css`
43
- color: ${theme.colors.system.rest};
49
+ color: ${getProp(colors, 'system/rest')};
44
50
  text-anchor: middle;
45
51
  ${typography.paragraph3};
46
52
  text-transform: capitalize;
@@ -49,7 +55,7 @@ const Labels = ({
49
55
  `;
50
56
  const TextCSS = css`
51
57
  ${typography.paragraph3};
52
- fill: ${theme.colors.system.rest};
58
+ fill: ${getProp(colors, 'system/rest')};
53
59
  `;
54
60
  if (labelsVisible) {
55
61
  let xLabels;
@@ -110,7 +116,7 @@ Labels.defaultProps = {
110
116
  getX: x => x,
111
117
  getY: quantity => quantity,
112
118
  labelsCharacterWidth: 10,
113
- labelsColor: theme.colors.system.rest,
119
+ labelsColor: 'system/rest',
114
120
  labelsCountY: 5,
115
121
  labelsFormatX: label => label,
116
122
  labelsFormatY: quantity => quantity,
@@ -3,7 +3,7 @@
3
3
  /** @jsx jsx */
4
4
  import PropTypes from 'prop-types';
5
5
  import { jsx, css } from '@emotion/core';
6
- import { useColor as colors } from "../../../theme";
6
+ import { getColor } from "../../../styles/utils";
7
7
  const Path = ({
8
8
  data,
9
9
  getX,
@@ -27,13 +27,13 @@ const Path = ({
27
27
  // });
28
28
 
29
29
  const PathCSS = css`
30
- stroke: ${colors[pathColor] || pathColor};
30
+ stroke: ${getColor(pathColor)};
31
31
  stroke-width: ${STROKE};
32
32
  stroke-linecap: round;
33
33
  stroke-linejoin: round;
34
34
  /* &:hover {
35
35
  cursor: pointer;
36
- stroke: ${colors[pathColor] || pathColor};
36
+ stroke: ${getColor(pathColor)};
37
37
  stroke-linecap: round;
38
38
  stroke-linejoin: round;
39
39
  stroke-width: ${STROKEHover};
@@ -4,7 +4,8 @@
4
4
  import PropTypes from 'prop-types';
5
5
  import { jsx, css } from '@emotion/core';
6
6
  import { typography } from "../../../styles/typography";
7
- import { useColor as colors } from "../../../theme";
7
+ import { fill } from "../../../styles/general";
8
+ import { getColor } from "../../../styles/utils";
8
9
  const Points = ({
9
10
  data,
10
11
  getX,
@@ -27,13 +28,13 @@ const Points = ({
27
28
  pointHoverAlignment
28
29
  }) => {
29
30
  const PointCSS = css`
30
- fill: ${colors[pointsColor] || pointsColor};
31
+ ${fill(pointsColor)};
31
32
  stroke: ${pointsStrokeColor};
32
33
  stroke-width: ${strokeWidth};
33
34
  &:hover {
34
35
  cursor: pointer;
35
36
  fill: #fff;
36
- stroke: ${colors[pointsColor] || pointsColor};
37
+ stroke: ${getColor(pointsColor)};
37
38
  stroke-width: ${pointsStrokeHover};
38
39
  }
39
40
  `;
@@ -170,8 +171,8 @@ const Points = ({
170
171
  transform: `translate(${getX(point.x + unitWidth / 1.5) + 4}, ${getY(point.quantity)})`
171
172
  }, jsx("path", {
172
173
  d: rightTooltipPath(Width, 20, 6, 4),
173
- fill: colors[pointsColor] || pointsColor,
174
- stroke: colors[pointsColor] || pointsColor,
174
+ fill: getColor(pointsColor),
175
+ stroke: getColor(pointsColor),
175
176
  style: {
176
177
  filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.15))'
177
178
  }
@@ -191,8 +192,8 @@ const Points = ({
191
192
  transform: `translate(${getX(point.x + unitWidth / 1.5) - 4}, ${getY(point.quantity)})`
192
193
  }, jsx("path", {
193
194
  d: leftTooltipPath(Width, 20, 6, 4),
194
- fill: colors[pointsColor] || pointsColor,
195
- stroke: colors[pointsColor] || pointsColor,
195
+ fill: getColor(pointsColor),
196
+ stroke: getColor(pointsColor),
196
197
  style: {
197
198
  filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.15))'
198
199
  }
@@ -212,8 +213,8 @@ const Points = ({
212
213
  transform: `translate(${getX(point.x + unitWidth / 1.5)}, ${getY(point.quantity) - 4})`
213
214
  }, jsx("path", {
214
215
  d: topTooltipPath(Width, 20, 6, 4),
215
- fill: colors[pointsColor] || pointsColor,
216
- stroke: colors[pointsColor] || pointsColor,
216
+ fill: getColor(pointsColor),
217
+ stroke: getColor(pointsColor),
217
218
  style: {
218
219
  filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.15))'
219
220
  }
@@ -232,8 +233,8 @@ const Points = ({
232
233
  transform: `translate(${getX(point.x + unitWidth / 1.5)}, ${getY(point.quantity) + 4})`
233
234
  }, jsx("path", {
234
235
  d: bottomTooltipPath(Width, 20, 6, 4),
235
- fill: colors[pointsColor] || pointsColor,
236
- stroke: colors[pointsColor] || pointsColor,
236
+ fill: getColor(pointsColor),
237
+ stroke: getColor(pointsColor),
237
238
  style: {
238
239
  filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.15))'
239
240
  }