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.
Files changed (209) hide show
  1. package/components/accordion/details.js +2 -6
  2. package/components/accordion/group.js +2 -9
  3. package/components/accordion/index.js +2 -15
  4. package/components/accordion/summary.js +4 -27
  5. package/components/alert/index.js +98 -137
  6. package/components/alert/notify.js +97 -166
  7. package/components/avatar/index.js +4 -63
  8. package/components/badge/index.js +7 -34
  9. package/components/button/icon.js +120 -186
  10. package/components/button/index.js +136 -205
  11. package/components/button/more.js +0 -12
  12. package/components/button/ripple-effect.js +46 -44
  13. package/components/card/body.js +2 -7
  14. package/components/card/extra.js +2 -7
  15. package/components/card/footer.js +2 -7
  16. package/components/card/header.js +2 -7
  17. package/components/card/index.js +2 -22
  18. package/components/chart/Pie/Circle.js +0 -1
  19. package/components/chart/Pie/Sector.js +0 -17
  20. package/components/chart/Pie/Sectors.js +0 -10
  21. package/components/chart/Pie/index.js +4 -36
  22. package/components/chart/Pie-v2/Circle.js +0 -1
  23. package/components/chart/Pie-v2/Sector.js +0 -13
  24. package/components/chart/Pie-v2/Sectors.js +0 -20
  25. package/components/chart/Pie-v2/index.js +11 -38
  26. package/components/chart/bar/Axis.js +0 -12
  27. package/components/chart/bar/Bar.js +13 -35
  28. package/components/chart/bar/Grid.js +0 -18
  29. package/components/chart/bar/Labels.js +0 -18
  30. package/components/chart/bar/Points.js +0 -17
  31. package/components/chart/bar/index.js +6 -26
  32. package/components/chart/bar-v2/Axis.js +0 -12
  33. package/components/chart/bar-v2/Bar.js +15 -36
  34. package/components/chart/bar-v2/Grid.js +0 -18
  35. package/components/chart/bar-v2/Labels.js +0 -18
  36. package/components/chart/bar-v2/Points.js +0 -17
  37. package/components/chart/bar-v2/index.js +6 -26
  38. package/components/chart/line/Axis.js +4 -16
  39. package/components/chart/line/Grid.js +2 -19
  40. package/components/chart/line/Labels.js +0 -18
  41. package/components/chart/line/Path.js +23 -33
  42. package/components/chart/line/Point.js +6 -40
  43. package/components/chart/line/Title.js +0 -3
  44. package/components/chart/line/index.js +12 -35
  45. package/components/chart/line-v2/Axis.js +0 -13
  46. package/components/chart/line-v2/Grid.js +0 -18
  47. package/components/chart/line-v2/Labels.js +0 -18
  48. package/components/chart/line-v2/Path.js +23 -33
  49. package/components/chart/line-v2/Point.js +6 -35
  50. package/components/chart/line-v2/Title.js +0 -3
  51. package/components/chart/line-v2/index.js +12 -30
  52. package/components/check-text/index.js +0 -8
  53. package/components/check-text/interview-confirmation.js +0 -7
  54. package/components/check-text/interview-status.js +0 -7
  55. package/components/chip/attach.js +4 -17
  56. package/components/chip/index.js +6 -33
  57. package/components/collapse/index.js +0 -13
  58. package/components/divider/index.js +0 -8
  59. package/components/form-control/attachment/index.js +24 -202
  60. package/components/form-control/calendar/function.js +40 -94
  61. package/components/form-control/calendar/index.js +5 -30
  62. package/components/form-control/calendar/range.js +11 -28
  63. package/components/form-control/checkbox/index.js +4 -37
  64. package/components/form-control/control/index.js +3 -13
  65. package/components/form-control/date-picker/index-old.js +18 -0
  66. package/components/form-control/date-picker/index.js +23 -99
  67. package/components/form-control/date-range-picker/index.js +86 -221
  68. package/components/form-control/dropdown/index.js +72 -289
  69. package/components/form-control/dropdown-box/index.js +6 -35
  70. package/components/form-control/form/index.js +0 -2
  71. package/components/form-control/form-group/index.js +1 -6
  72. package/components/form-control/helper-text/index.js +2 -9
  73. package/components/form-control/input-base/index.js +218 -399
  74. package/components/form-control/label/index.js +2 -12
  75. package/components/form-control/money-input/index.js +43 -132
  76. package/components/form-control/number-input/index.js +15 -113
  77. package/components/form-control/number-input/index2.js +78 -119
  78. package/components/form-control/phone-input/index.js +16 -78
  79. package/components/form-control/radio/index.js +4 -23
  80. package/components/form-control/text-input/index.js +33 -256
  81. package/components/form-control/time-picker/index.js +14 -71
  82. package/components/form-control/time-picker/swiper.js +21 -73
  83. package/components/form-control/toggle/index.js +4 -19
  84. package/components/form-view/helper-text.js +2 -2
  85. package/components/form-view/index.js +0 -14
  86. package/components/form-view/input.js +2 -13
  87. package/components/form-view/label.js +0 -2
  88. package/components/grid/Col.js +2 -15
  89. package/components/grid/Container.js +2 -21
  90. package/components/grid/Row.js +2 -21
  91. package/components/grid/index.js +2 -43
  92. package/components/image/index.js +2 -22
  93. package/components/index.js +62 -31
  94. package/components/list/list-item-action.js +0 -9
  95. package/components/list/list-item-icon.js +0 -9
  96. package/components/list/list-item-text.js +0 -5
  97. package/components/list/list-item.js +0 -11
  98. package/components/list/list.js +0 -13
  99. package/components/list/sub-header.js +0 -4
  100. package/components/modal/body.js +2 -6
  101. package/components/modal/footer.js +2 -11
  102. package/components/modal/header.js +2 -12
  103. package/components/modal/index.js +2 -10
  104. package/components/modal/modal.js +11 -52
  105. package/components/others/extra/index.js +3 -10
  106. package/components/others/import/index.js +0 -7
  107. package/components/others/option-wrapper/index.js +4 -7
  108. package/components/others/scrollbar/index.js +0 -3
  109. package/components/paging/page-info.js +39 -101
  110. package/components/paging/page-selector.js +7 -35
  111. package/components/paging/page-selector2.js +35 -74
  112. package/components/paper/index.js +0 -11
  113. package/components/popover/body.js +2 -6
  114. package/components/popover/footer.js +2 -11
  115. package/components/popover/header.js +2 -7
  116. package/components/popover/index.js +39 -123
  117. package/components/popup/danger_popup.js +0 -19
  118. package/components/popup/index.js +2 -48
  119. package/components/popup/proposals_popup.js +10 -49
  120. package/components/popup/v2/index.js +0 -31
  121. package/components/progress/circular.js +19 -81
  122. package/components/progress/linear.js +4 -20
  123. package/components/rating/index.js +0 -24
  124. package/components/slider/slider-container.js +3 -40
  125. package/components/slider/slider-item.js +10 -25
  126. package/components/status/index.js +2 -16
  127. package/components/tab/tab-container.js +2 -16
  128. package/components/tab/tab-header.js +4 -24
  129. package/components/tab/tab-panel.js +4 -16
  130. package/components/tab/tab.js +4 -28
  131. package/components/tooltip/index.js +12 -97
  132. package/components/tooltip/portal.js +0 -2
  133. package/components/transfer/index.js +22 -67
  134. package/components/tree-view/index.js +62 -202
  135. package/components/typography/index.js +3 -31
  136. package/global/index.js +0 -8
  137. package/icons/basic.js +0 -48
  138. package/icons/effect.js +17 -29
  139. package/icons/general/clock/clock.js +0 -2
  140. package/icons/general/color-handler/background.js +0 -2
  141. package/icons/general/color-handler/text.js +0 -2
  142. package/icons/general/emoji/emoji.js +0 -2
  143. package/icons/general/font-properties/bold.js +0 -2
  144. package/icons/general/font-properties/font-family.js +0 -2
  145. package/icons/general/font-properties/font-size.js +0 -2
  146. package/icons/general/font-properties/italic.js +0 -2
  147. package/icons/general/font-properties/underline.js +0 -2
  148. package/icons/general/hyperlink/hyperlink.js +0 -2
  149. package/icons/general/indent/decrease.js +0 -2
  150. package/icons/general/indent/increase.js +0 -2
  151. package/icons/general/list/bullets.js +0 -2
  152. package/icons/general/list/numbering.js +0 -2
  153. package/icons/general/picture/picture.js +0 -2
  154. package/icons/general/steps/redo.js +0 -2
  155. package/icons/general/steps/undo.js +0 -2
  156. package/icons/general/text-align/center.js +0 -2
  157. package/icons/general/text-align/justify.js +0 -2
  158. package/icons/general/text-align/left.js +0 -2
  159. package/icons/general/text-align/right.js +0 -2
  160. package/icons/menu/dhr.js +2 -1
  161. package/icons/menu/index.js +2 -2
  162. package/icons/menu/v2/index.js +0 -10
  163. package/package.json +1 -1
  164. package/readme.md +11 -1
  165. package/styles/animation.js +15 -58
  166. package/styles/color-helper.js +24 -54
  167. package/styles/colors.js +17 -9
  168. package/styles/general.js +6 -2
  169. package/styles/typography.js +4 -4
  170. package/styles/utils.js +2 -2
  171. package/theme/createBreakpoints.js +7 -18
  172. package/theme/make-styles.js +2 -5
  173. package/theme/set-theme.js +3 -6
  174. package/theme/settings.js +3 -2
  175. package/theme/theme-provider.js +0 -1
  176. package/utils/array/array.js +14 -23
  177. package/utils/classNames.js +0 -5
  178. package/utils/console.js +0 -6
  179. package/utils/date.js +13 -82
  180. package/utils/error/error.js +1 -9
  181. package/utils/error/errors.js +1 -48
  182. package/utils/getFileType.js +0 -9
  183. package/utils/handleBreakpoints.js +0 -5
  184. package/utils/intersectionObserver.js +0 -5
  185. package/utils/iterator.js +0 -9
  186. package/utils/map-parent.js +3 -10
  187. package/utils/object/extend.js +0 -10
  188. package/utils/object/object.js +12 -11
  189. package/utils/parseHTML.js +0 -1
  190. package/utils/promisify.js +0 -5
  191. package/utils/randomString.js +0 -7
  192. package/utils/remove-unicode.js +0 -1
  193. package/utils/render-portal.js +1 -9
  194. package/utils/renderHTML.js +4 -6
  195. package/utils/renderIcon.js +4 -14
  196. package/utils/sb-template.js +6 -5
  197. package/utils/string/capitalize.js +0 -1
  198. package/utils/string/capitalizeSentenceCase.js +0 -2
  199. package/utils/string/string.js +0 -13
  200. package/utils/type.js +0 -21
  201. package/utils/updatePosition.js +4 -5
  202. package/utils/useDelayUnmount.js +0 -4
  203. package/utils/useElementSize.js +9 -3
  204. package/utils/useEventListener.js +12 -6
  205. package/utils/useInput.js +0 -6
  206. package/utils/useMediaQuery.js +8 -10
  207. package/utils/useOnClickOutside.js +0 -2
  208. package/utils/usePortal.js +3 -10
  209. package/utils/validate.js +6 -20
@@ -1,7 +1,5 @@
1
1
  /* eslint-disable no-unused-vars */
2
-
3
2
  /** @jsxRuntime classic */
4
-
5
3
  /** @jsx jsx */
6
4
  import { css, jsx, keyframes } from '@emotion/core';
7
5
  import PropTypes from 'prop-types';
@@ -25,15 +23,12 @@ const {
25
23
  paragraph3
26
24
  }
27
25
  } = useTheme();
28
-
29
26
  const validatePercent = percent => {
30
27
  let per = +percent.toString().replace('%', '');
31
28
  return Math.max(Math.min(per, 100), 0);
32
29
  };
33
-
34
30
  const getDimension = size => {
35
31
  let rect, strokeWidth, labelStyle;
36
-
37
32
  switch (size) {
38
33
  case 'xl':
39
34
  case 'extraLarge':
@@ -41,76 +36,62 @@ const getDimension = size => {
41
36
  rect = 120;
42
37
  strokeWidth = 16;
43
38
  break;
44
-
45
39
  case 'lg':
46
40
  case 'large':
47
41
  labelStyle = heading2;
48
42
  rect = 80;
49
43
  strokeWidth = 12;
50
44
  break;
51
-
52
45
  case 'md':
53
46
  case 'medium':
54
47
  labelStyle = paragraph1;
55
48
  rect = 60;
56
49
  strokeWidth = 8;
57
50
  break;
58
-
59
51
  case 'sm':
60
52
  case 'small':
61
53
  labelStyle = paragraph2;
62
54
  rect = 40;
63
55
  strokeWidth = 6;
64
56
  break;
65
-
66
57
  case 'xs':
67
58
  case 'extraSmall':
68
59
  labelStyle = paragraph3;
69
60
  rect = 20;
70
61
  strokeWidth = 4;
71
62
  break;
72
-
73
63
  default:
74
64
  labelStyle = heading2;
75
65
  rect = 80;
76
66
  strokeWidth = 8;
77
67
  }
78
-
79
68
  return {
80
69
  labelStyle,
81
70
  rect,
82
71
  strokeWidth
83
72
  };
84
73
  };
85
-
86
74
  const getDirection = direction => {
87
75
  let angle;
88
-
89
76
  switch (direction) {
90
77
  case 'right':
91
78
  angle = 0;
92
79
  break;
93
-
94
80
  case 'left':
95
81
  angle = -180;
96
82
  break;
97
-
98
83
  case 'bottom':
99
84
  angle = 90;
100
85
  break;
101
-
102
86
  case 'top':
103
87
  angle = -90;
104
88
  break;
105
89
  }
106
-
107
90
  return angle;
108
91
  };
109
-
110
92
  const keyframeRotate = keyframes`
111
93
  100%{ transform: rotate(360deg);}
112
94
  `;
113
-
114
95
  const keyframeDash = r => keyframes`
115
96
  0%{
116
97
  stroke-dasharray: 1, ${r};
@@ -125,18 +106,15 @@ const keyframeDash = r => keyframes`
125
106
  stroke-dashoffset: -${r * 124 / 200};
126
107
  }
127
108
  `;
128
-
129
109
  const ContainerCSS = containerW => css`
130
110
  ${parseWidthHeight(containerW)};
131
111
  ${overflowHidden};
132
112
  ${positionRelative};
133
113
  ${borderRadius50};
134
114
  `;
135
-
136
115
  const AnimationRotateCSS = css`
137
116
  animation: ${keyframeRotate} 2s linear infinite;
138
117
  `;
139
-
140
118
  const CircleBackgroundCSS = (background, circleStrokeW, isIndeterminate) => css`
141
119
  ${overflowHidden};
142
120
  ${borderRadius50};
@@ -145,7 +123,6 @@ const CircleBackgroundCSS = (background, circleStrokeW, isIndeterminate) => css`
145
123
  stroke-width: ${circleStrokeW}px;
146
124
  ${isIndeterminate && 'stroke-linecap: round'};
147
125
  `;
148
-
149
126
  const CircleMainCSS = (color, circleStrokeW) => css`
150
127
  ${overflowHidden};
151
128
  ${borderRadius50};
@@ -154,7 +131,6 @@ const CircleMainCSS = (color, circleStrokeW) => css`
154
131
  stroke-linecap: round;
155
132
  stroke-width: ${circleStrokeW}px;
156
133
  `;
157
-
158
134
  const CircleMainDeterminateCSS = (circumference, percent, direction, duration) => css`
159
135
  stroke-dasharray: ${`${circumference} ${circumference}`};
160
136
  stroke-dashoffset: ${circumference - validatePercent(percent) / 100 * circumference};
@@ -162,24 +138,21 @@ const CircleMainDeterminateCSS = (circumference, percent, direction, duration) =
162
138
  transform-origin: 50% 50%;
163
139
  transition: stroke-dashoffset ${duration}s cubic-bezier(0.77, 0, 0.175, 1); /* easeInOutQuart */
164
140
  `;
165
-
166
141
  const CircleMainIndeterminateCSS = radiusX10 => css`
167
142
  stroke-dasharray: 10, ${radiusX10};
168
143
  stroke-dashoffset: 0;
169
144
  animation: ${keyframeDash(radiusX10)} 2s ease-in-out infinite;
170
145
  `;
171
-
172
146
  const TextCSS = (percentColor, color, dimension) => css`
173
147
  ${userSelectNone};
174
148
  fill: ${percentColor ? percentColor : color};
175
149
  ${dimension.labelStyle}
176
150
  text-anchor: middle;
177
151
  `;
178
- /**
179
- * Determinate circular progress
180
- */
181
-
182
152
 
153
+ /**
154
+ * Determinate circular progress
155
+ */
183
156
  const Determinate = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
184
157
  action = {},
185
158
  background,
@@ -202,25 +175,18 @@ const Determinate = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
202
175
  const circleStrokeW = strokeWidth ? Math.max(2, strokeWidth) : dimension.strokeWidth;
203
176
  const radius = containerW / 2 - circleStrokeW;
204
177
  const circumference = radius * 2 * Math.PI;
205
-
206
178
  const _ContainerCSS = ContainerCSS(containerW);
207
-
208
179
  const _CircleBackgroundCSS = CircleBackgroundCSS(background, circleStrokeW);
209
-
210
180
  const _CircleMainCSS = CircleMainCSS(color, circleStrokeW);
211
-
212
181
  const _CircleMainDeterminateCSS = CircleMainDeterminateCSS(circumference, percent, direction, duration);
213
-
214
182
  const _TextCSS = TextCSS(percentColor, color, dimension);
215
-
216
183
  useImperativeHandle(reference, () => {
217
184
  const currentRef = ref.current || {};
218
185
  currentRef.element = ref.current;
219
- const _instance = { ...action
186
+ const _instance = {
187
+ ...action
220
188
  }; // methods
221
-
222
189
  _instance.__proto__ = {}; // hidden methods
223
-
224
190
  currentRef.instance = _instance;
225
191
  return currentRef;
226
192
  });
@@ -243,7 +209,8 @@ const Determinate = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
243
209
  x: containerW / 2,
244
210
  y: containerW / 2 + containerW / 80
245
211
  }, validatePercent(percent), "%"), [color, percentColor, percent, size, strokeWidth, showValue, width]);
246
- return jsx("svg", { ...props,
212
+ return jsx("svg", {
213
+ ...props,
247
214
  css: _ContainerCSS,
248
215
  ref: ref
249
216
  }, CircleBackgroundMemo, CircleMainMemo, PercentTextMemo);
@@ -260,39 +227,30 @@ Determinate.defaultProps = {
260
227
  Determinate.propTypes = {
261
228
  /** Color for background stroke of the circular progress. */
262
229
  background: PropTypes.string,
263
-
264
230
  /** Color for main stroke of the circular progress. */
265
231
  color: PropTypes.string,
266
-
267
232
  /** Direction of the start point. */
268
233
  direction: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
269
-
270
234
  /** Time to processing. */
271
235
  duration: PropTypes.number,
272
-
273
236
  /** The percent of the progress. */
274
237
  percent: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
275
-
276
238
  /** Color percent-label of the progress. */
277
239
  percentColor: PropTypes.string,
278
-
279
240
  /** It's boolean to show the percent-label. */
280
241
  showValue: PropTypes.bool,
281
-
282
242
  /** Static dimensions default. */
283
243
  size: PropTypes.oneOf(['xl', 'lg', 'md', 'sm', 'xs', 'extraLarge', 'large', 'medium', 'small', 'extraSmall']),
284
-
285
244
  /** Dynamic width dimensions of the progress circle. */
286
245
  strokeWidth: PropTypes.number,
287
-
288
246
  /** Dynamic width and height dimensions of the container. */
289
247
  width: PropTypes.number
290
248
  };
291
249
  export const DeterminateCircularProgress = Determinate;
292
- /**
293
- * Indeterminate circular progress
294
- */
295
250
 
251
+ /**
252
+ * Indeterminate circular progress
253
+ */
296
254
  const Indeterminate = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
297
255
  action = {},
298
256
  background,
@@ -310,23 +268,17 @@ const Indeterminate = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
310
268
  const circleStrokeW = strokeWidth ? Math.max(2, strokeWidth) : dimension.strokeWidth;
311
269
  const radius = containerW / 2 - circleStrokeW;
312
270
  const radiusX10 = radius * 10;
313
-
314
271
  const _ContainerCSS = ContainerCSS(containerW);
315
-
316
272
  const _CircleBackgroundCSS = CircleBackgroundCSS(background, circleStrokeW, true);
317
-
318
273
  const _CircleMainCSS = CircleMainCSS(color, circleStrokeW);
319
-
320
274
  const _CircleMainIndeterminateCSS = CircleMainIndeterminateCSS(radiusX10);
321
-
322
275
  useImperativeHandle(reference, () => {
323
276
  const currentRef = ref.current || {};
324
277
  currentRef.element = ref.current;
325
- const _instance = { ...action
278
+ const _instance = {
279
+ ...action
326
280
  }; // methods
327
-
328
281
  _instance.__proto__ = {}; // hidden methods
329
-
330
282
  currentRef.instance = _instance;
331
283
  return currentRef;
332
284
  });
@@ -343,7 +295,8 @@ const Indeterminate = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
343
295
  r: radius,
344
296
  ref: circleRef
345
297
  }), [color, size, strokeWidth, width]);
346
- return jsx("svg", { ...props,
298
+ return jsx("svg", {
299
+ ...props,
347
300
  css: [_ContainerCSS, AnimationRotateCSS],
348
301
  ref: ref
349
302
  }, CircleBackgroundMemo, CircleMainMemo);
@@ -356,24 +309,20 @@ Indeterminate.defaultProps = {
356
309
  Indeterminate.propTypes = {
357
310
  /** Color for background stroke of the circular progress. */
358
311
  background: PropTypes.string,
359
-
360
312
  /** Color for main stroke of the circular progress. */
361
313
  color: PropTypes.string,
362
-
363
314
  /** Static dimensions default. */
364
315
  size: PropTypes.oneOf(['xl', 'lg', 'md', 'sm', 'xs', 'extraLarge', 'large', 'medium', 'small', 'extraSmall']),
365
-
366
316
  /** Dynamic width dimensions of the progress circle. */
367
317
  strokeWidth: PropTypes.number,
368
-
369
318
  /** Dynamic width and height dimensions of the container. */
370
319
  width: PropTypes.number
371
320
  };
372
321
  export const IndeterminateCircularProgress = Indeterminate;
373
- /**
374
- * Circular progress
375
- */
376
322
 
323
+ /**
324
+ * Circular progress
325
+ */
377
326
  const CircularProgress = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
378
327
  action = {},
379
328
  determinate,
@@ -391,11 +340,10 @@ const CircularProgress = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
391
340
  useImperativeHandle(reference, () => {
392
341
  const currentRef = ref.current || {};
393
342
  currentRef.element = ref.current;
394
- const _instance = { ...action
343
+ const _instance = {
344
+ ...action
395
345
  }; // methods
396
-
397
346
  _instance.__proto__ = {}; // hidden methods
398
-
399
347
  currentRef.instance = _instance;
400
348
  return currentRef;
401
349
  });
@@ -428,34 +376,24 @@ CircularProgress.defaultProps = {
428
376
  CircularProgress.propTypes = {
429
377
  /** Color for background stroke of the circular progress. */
430
378
  background: PropTypes.string,
431
-
432
379
  /** Color for main stroke of the circular progress. */
433
380
  color: PropTypes.string,
434
-
435
381
  /** Determinate or Indeterminate. */
436
382
  determinate: PropTypes.bool,
437
-
438
383
  /** Direction of the start point. */
439
384
  direction: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
440
-
441
385
  /** Time to processing. */
442
386
  duration: PropTypes.number,
443
-
444
387
  /** The percent of the determinate progress. */
445
388
  percent: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
446
-
447
389
  /** Color percent-label of the progress. */
448
390
  percentColor: PropTypes.string,
449
-
450
391
  /** It's boolean to show the percent-label. */
451
392
  showValue: PropTypes.bool,
452
-
453
393
  /** Static dimensions default. */
454
394
  size: PropTypes.oneOf(['xl', 'lg', 'md', 'sm', 'xs', 'extraLarge', 'large', 'medium', 'small', 'extraSmall']),
455
-
456
395
  /** Dynamic width dimensions of the progress circle. */
457
396
  strokeWidth: PropTypes.number,
458
-
459
397
  /** Dynamic width and height dimensions of the container. */
460
398
  width: PropTypes.number
461
399
  };
@@ -1,21 +1,17 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { jsx, css, keyframes } from '@emotion/core';
5
4
  import PropTypes from 'prop-types';
6
5
  import { forwardRef, memo, useEffect, useMemo, useRef } from 'react';
7
6
  import theme from '../../theme/settings';
8
7
  import { Typography } from '../';
9
-
10
8
  const cutPX = x => {
11
9
  return isNaN(x) ? x : x + 'px';
12
10
  };
13
-
14
11
  const validatePercent = p => {
15
12
  let per = +p.toString().replace('%', '');
16
13
  return Math.max(Math.min(per, 100), 0);
17
14
  };
18
-
19
15
  const Indeterminate = /*#__PURE__*/forwardRef(({
20
16
  background,
21
17
  className,
@@ -96,7 +92,8 @@ const Indeterminate = /*#__PURE__*/forwardRef(({
96
92
  className: unique.secondBar,
97
93
  ref: secondBarRef
98
94
  }), [color]);
99
- return jsx("div", { ...props,
95
+ return jsx("div", {
96
+ ...props,
100
97
  className: [unique.container, className].join(' ').trimEnd(),
101
98
  css: containerCSS,
102
99
  ref: ref
@@ -175,11 +172,9 @@ const Determinate = /*#__PURE__*/forwardRef(({
175
172
  ${valuePosition === 'bottom' ? 'top: 100%;' : 'bottom: 100%;'};
176
173
  }
177
174
  `;
178
-
179
175
  const updateValuePosition = value => {
180
176
  valueRef.current.firstChild.innerText = value + '%';
181
177
  const valHalfWidth = valueRef.current.getBoundingClientRect().width / 2;
182
-
183
178
  if (value > 90) {
184
179
  valueRef.current.style.left = `calc(${value + '%'} - ${valHalfWidth}px)`;
185
180
  } else if (value < 10) {
@@ -188,7 +183,6 @@ const Determinate = /*#__PURE__*/forwardRef(({
188
183
  valueRef.current.style.left = value + '%';
189
184
  }
190
185
  };
191
-
192
186
  const Bar = useMemo(() => jsx("div", {
193
187
  className: unique.bar,
194
188
  ref: barRef
@@ -206,12 +200,12 @@ const Determinate = /*#__PURE__*/forwardRef(({
206
200
  useEffect(() => {
207
201
  const value = validatePercent(percent);
208
202
  barRef.current.style.width = value + '%';
209
-
210
203
  if (showValue) {
211
204
  updateValuePosition(value);
212
205
  }
213
206
  }, [percent, showValue]);
214
- return jsx("div", { ...props,
207
+ return jsx("div", {
208
+ ...props,
215
209
  className: [unique.container, className].join(' ').trim(),
216
210
  css: containerCSS,
217
211
  ref: ref
@@ -291,34 +285,24 @@ LinearProgress.defaultProps = {
291
285
  LinearProgress.propTypes = {
292
286
  /** Color for background stroke of the linear progress. */
293
287
  background: PropTypes.string,
294
-
295
288
  /** className use in linear progress. */
296
289
  className: PropTypes.string,
297
-
298
290
  /** color of liner progress. */
299
291
  color: PropTypes.string,
300
-
301
292
  /** Determinate or Indeterminate. */
302
293
  determinate: PropTypes.bool,
303
-
304
294
  /** Time to processing. */
305
295
  duration: PropTypes.number,
306
-
307
296
  /** Dynamic height dimensions of the container. */
308
297
  height: PropTypes.number,
309
-
310
298
  /** The percent of the determinate progress. */
311
299
  percent: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
312
-
313
300
  /** Color percent-label of the progress. */
314
301
  percentColor: PropTypes.string,
315
-
316
302
  /** It's boolean to show the percent-label. */
317
303
  showValue: PropTypes.bool,
318
-
319
304
  /** Dynamic position of the progress value. */
320
305
  valuePosition: PropTypes.oneOf(['bottom', 'top']),
321
-
322
306
  /** Dynamic width dimensions of the container. */
323
307
  width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
324
308
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useMemo, useRef, useState, useEffect, forwardRef, Fragment, useImperativeHandle } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -52,13 +51,9 @@ const Rating = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
52
51
  allowNumber: false
53
52
  }));
54
53
  const [valueState, setValueState] = useState(value || defaultValue);
55
-
56
54
  const _color = colors[color] || color;
57
-
58
55
  const _RatingItemHaftCSS = RatingItemHaftCSS(_color);
59
-
60
56
  const _RatingItemCSS = RatingItemCSS(_RatingItemHaftCSS.name, _color, half);
61
-
62
57
  const onSelectValue = e => {
63
58
  if (disabled || readOnly) return;
64
59
  const newValue = +e.target.value;
@@ -66,22 +61,18 @@ const Rating = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
66
61
  setValueState(newValue);
67
62
  !!onRating && onRating(e, newValue);
68
63
  };
69
-
70
64
  const _onRating = (e, value, isHalf = false) => {
71
65
  if (disabled || readOnly || half && !isHalf) return;
72
66
  setValueState(value);
73
67
  !!onRating && onRating(e, value);
74
68
  };
75
-
76
69
  useEffect(() => {
77
70
  setValueState(value);
78
71
  }, [value]);
79
72
  useImperativeHandle(reference, () => {
80
73
  const currentRef = ref.current || {};
81
74
  const _instance = {}; // methods
82
-
83
75
  _instance.__proto__ = {}; // hidden methods
84
-
85
76
  currentRef.instance = _instance;
86
77
  return currentRef;
87
78
  });
@@ -167,7 +158,6 @@ const RatingSelectCSS = css`
167
158
  background-color: ${white};
168
159
  }
169
160
  `;
170
-
171
161
  const RatingItemHaftCSS = color => css`
172
162
  ${flexRow};
173
163
  ${positionAbsolute};
@@ -197,7 +187,6 @@ const RatingItemHaftCSS = color => css`
197
187
  }
198
188
  }
199
189
  `;
200
-
201
190
  const RatingItemCSS = (RatingItemHaftCSSName, color, half) => css`
202
191
  ${inlineFlex};
203
192
  ${positionRelative};
@@ -219,7 +208,6 @@ const RatingItemCSS = (RatingItemHaftCSSName, color, half) => css`
219
208
  }
220
209
  }
221
210
  `;
222
-
223
211
  Rating.defaultProps = {
224
212
  disabled: false,
225
213
  readOnly: false,
@@ -234,40 +222,28 @@ Rating.defaultProps = {
234
222
  Rating.propTypes = {
235
223
  /** If true, the component is disabled. */
236
224
  disabled: PropTypes.bool,
237
-
238
225
  /** Removes all hover effects and pointer events. */
239
226
  readOnly: PropTypes.bool,
240
-
241
227
  /** Allows rating with an odd number of stars. */
242
228
  half: PropTypes.bool,
243
-
244
229
  /** Display select box to select by number. */
245
230
  selector: PropTypes.bool,
246
-
247
231
  /** The default number of stars is selected. */
248
232
  defaultValue: PropTypes.number,
249
-
250
233
  /** The number of stars is selected. */
251
234
  value: PropTypes.number,
252
-
253
235
  /** The maximum number of stars allowed to rate. */
254
236
  quantity: PropTypes.number,
255
-
256
237
  /** Width of star icon. */
257
238
  width: PropTypes.number,
258
-
259
239
  /** Height of star icon. */
260
240
  height: PropTypes.number,
261
-
262
241
  /** Color of stars, ['primary', 'info', 'success', 'warning', 'danger', #hex, rgb(#, #, #)]. */
263
242
  color: PropTypes.string,
264
-
265
243
  /** Class for component. */
266
244
  className: PropTypes.string,
267
-
268
245
  /** Style inline of component. */
269
246
  style: PropTypes.object,
270
-
271
247
  /**
272
248
  * Callback fired when the value changes.
273
249
  *