diginet-core-ui 1.3.99-beta.2 → 1.3.99-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.
@@ -5,7 +5,7 @@ import { Button, ButtonIcon, Typography } from "../..";
5
5
  import { getGlobal } from "../../../global";
6
6
  import locale from "../../../locale";
7
7
  import { render } from 'react-dom';
8
- import { bgColor, border, borderRadius, boxBorder, cursorDefault, cursorPointer, displayFlex, flexCol, flexRow, inset, itemsCenter, justifyBetween, mg, mgt, parseHeight, parseMaxWidth, parseMinWidth, parseWidth, parseWidthHeight, pd, pointerEventsNone, positionAbsolute, positionRelative, textCenter, textColor, userSelectNone } from "../../../styles/general";
8
+ import { bgColor, border, borderRadius, boxBorder, cursorDefault, cursorPointer, displayFlex, flexCol, flexRow, gap, inset, itemsCenter, justifyBetween, mg, mgt, parseHeight, parseMaxWidth, parseMinWidth, parseWidth, parseWidthHeight, pd, pointerEventsNone, positionAbsolute, positionRelative, textCenter, textColor, userSelectNone } from "../../../styles/general";
9
9
  import { useTheme } from "../../../theme";
10
10
  import { date as moment } from "../../../utils";
11
11
  const {
@@ -41,23 +41,33 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
41
41
  ${itemsCenter};
42
42
  ${parseMaxWidth(400)};
43
43
  ${mg([4, 4, 0])};
44
+ ${gap(8)};
44
45
  .${unique.navigator.around} {
45
46
  ${displayFlex};
46
47
  ${flexRow};
47
48
  }
48
49
  .${unique.navigator.center} {
50
+ ${displayFlex};
49
51
  ${parseWidth('100%')};
52
+ button {
53
+ &:hover {
54
+ ${borderRadius(20)};
55
+ ${bgColor('fill/hover')};
56
+ }
57
+ &:active {
58
+ ${bgColor('fill/pressed')};
59
+ }
60
+ }
50
61
  }
51
62
  }
52
63
  .${unique.table.container} {
53
64
  ${displayFlex};
54
65
  ${flexRow};
55
- ${mg([2, 0])};
66
+ ${mg([2, 0, 4])};
56
67
  }
57
68
  .${unique.table.table} {
58
69
  ${mg([0, 4])};
59
- ${pd(0)};
60
- ${parseWidth('calc(100% - 32px)')};
70
+ ${parseWidth('100%')};
61
71
  border-collapse: separate;
62
72
  table-layout: fixed;
63
73
  .${unique.table.data} {
@@ -68,15 +78,15 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
68
78
  ${userSelectNone};
69
79
  ${textColor('text/main')};
70
80
  &:nth-of-type(7n - 1) {
71
- ${textColor('info8')};
81
+ ${textColor('semantic/info')};
72
82
  }
73
83
  &:nth-of-type(7n) {
74
- ${textColor('danger8')};
84
+ ${textColor('semantic/danger')};
75
85
  }
76
86
  &.next_month,
77
87
  &.previous_month,
78
88
  &.${unique.day.limit} {
79
- opacity: 0.25;
89
+ ${textColor('system/disabled')};
80
90
  }
81
91
  &.${unique.day.limit} {
82
92
  ${pointerEventsNone};
@@ -142,10 +152,10 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
142
152
  ${parseHeight(24)};
143
153
  ${textColor('text/normal_label')};
144
154
  &:nth-of-type(6) {
145
- ${textColor('info8')};
155
+ ${textColor('semantic/info')};
146
156
  }
147
157
  &:nth-of-type(7) {
148
- ${textColor('danger8')};
158
+ ${textColor('semantic/danger')};
149
159
  }
150
160
  }
151
161
  }
@@ -207,7 +217,7 @@ const typographyProps = className => {
207
217
  transition: 'background-color 150ms linear',
208
218
  width: 24
209
219
  },
210
- type: 'h6'
220
+ type: 'p2'
211
221
  };
212
222
  };
213
223
  /**
@@ -220,26 +230,7 @@ const buttonIconProps = className => {
220
230
  return {
221
231
  className,
222
232
  circular: true,
223
- viewType: 'text',
224
- size: 'small'
225
- };
226
- };
227
- /**
228
- *
229
- * @description return props of the button icon.
230
- * @param {Function} fn
231
- * @returns {Object} props of the button text
232
- */
233
- const buttonTextProps = fn => {
234
- return {
235
- onClick: fn,
236
- color: 'primary',
237
- size: 'small',
238
- style: {
239
- borderRadius: 20,
240
- textTransform: 'initial',
241
- width: '100%'
242
- }
233
+ viewType: 'ghost'
243
234
  };
244
235
  };
245
236
 
@@ -464,7 +455,7 @@ const renderHeader = className => {
464
455
  className: className.table.header
465
456
  }, jsx(Typography, {
466
457
  color: 'inherit',
467
- type: 'h6'
458
+ type: 'p2'
468
459
  }, weekdays[i])));
469
460
  }
470
461
  return jsx("thead", null, jsx("tr", {
@@ -499,11 +490,15 @@ const renderNavigator = (className, refs, dbLeftFn, leftFn, rightFn, dbRightFn,
499
490
  })), jsx("div", {
500
491
  className: className.navigator.center
501
492
  }, jsx(Button, {
502
- ...buttonTextProps(fn)
493
+ css: [borderRadius(20), parseWidth('100%'), pd(0)],
494
+ colorHover: 'fill/hover',
495
+ size: 'tiny',
496
+ onClick: fn
503
497
  }, jsx(Typography, {
504
498
  color: 'primary',
505
499
  type: 'h3',
506
- ref: refs.content
500
+ ref: refs.content,
501
+ format: ['lowercase']
507
502
  }))), jsx("div", {
508
503
  className: className.navigator.around
509
504
  }, jsx(ButtonIcon, {
@@ -1,11 +1,10 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
-
4
3
  import { jsx } from '@emotion/core';
5
4
  import PropTypes from 'prop-types';
6
5
  import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
7
6
  import { date as moment } from "../../../utils";
8
- import { isAfterLimit, isBeforeLimit, onUpdateCalendar, renderHeader, renderNavigator, isValidDate, generateCalendarCSS } from "./function";
7
+ import { generateCalendarCSS, isAfterLimit, isBeforeLimit, isValidDate, onUpdateCalendar, renderHeader, renderNavigator } from "./function";
9
8
  const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
10
9
  actions,
11
10
  className,
@@ -17,6 +16,7 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
17
16
  value,
18
17
  ...props
19
18
  }, reference) => {
19
+ if (!reference) reference = useRef(null);
20
20
  // const [id] = useState(randomString(6, { allowSymbol: false }));
21
21
  const unique = {
22
22
  container: 'DGN-UI-Calendar',
@@ -49,7 +49,6 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
49
49
  const tableRef = useRef(null);
50
50
  const activeValue = useRef(null);
51
51
  const navigatorValue = useRef(null);
52
- useImperativeHandle(reference, () => ref.current);
53
52
  const [, setActiveValue] = useState(Date.now());
54
53
  const [, setNavigatorValue] = useState(Date.now());
55
54
  const navigatorRefs = {
@@ -61,6 +60,14 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
61
60
  };
62
61
  const firstDayOfMax = new Date(new Date(max).setDate(1)).setHours(0, 0, 0, 0);
63
62
  const firstDayOfMin = new Date(new Date(min).setDate(1)).setHours(0, 0, 0, 0);
63
+ useImperativeHandle(reference, () => {
64
+ const currentRef = ref.current || {};
65
+ currentRef.element = ref.current;
66
+ const _instance = {}; // methods
67
+ _instance.__proto__ = {}; // hidden methods
68
+ currentRef.instance = _instance;
69
+ return currentRef;
70
+ });
64
71
  /**
65
72
  * END REFERENCE
66
73
  */