diginet-core-ui 1.4.1-beta.2 → 1.4.1-beta.4

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,14 +5,8 @@ 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, gap, inset, itemsCenter, justifyBetween, mg, mgt, parseHeight, parseMaxWidth, parseMinWidth, parseWidth, parseWidthHeight, pd, pointerEventsNone, positionAbsolute, positionRelative, textCenter, textColor, userSelectNone } from "../../../styles/general";
9
- import { useTheme } from "../../../theme";
10
- import { date as moment } from "../../../utils";
11
- const {
12
- boxShadows: {
13
- large: boxShadowsLarge
14
- }
15
- } = useTheme();
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, shadowLarge, shadowNone, textCenter, textColor, userSelectNone } from "../../../styles/general";
9
+ import { classNames, date as moment } from "../../../utils";
16
10
 
17
11
  /**
18
12
  * START STYLE
@@ -33,7 +27,7 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
33
27
  ${bgColor('system/white')};
34
28
  ${parseWidth('100%')};
35
29
  ${parseMaxWidth(400)};
36
- box-shadow: ${boxShadow ? boxShadowsLarge : 'none'};
30
+ ${boxShadow ? shadowLarge : shadowNone};
37
31
  .${unique.navigator.navigator} {
38
32
  ${displayFlex};
39
33
  ${flexRow};
@@ -351,7 +345,7 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
351
345
  tableData.push(jsx("td", {
352
346
  key: `previous_month-${prevDate - i + 1}`,
353
347
  "data-time": Date.parse(day) - 1 /*(displayAnotherMonth ? 0 : 1)*/,
354
- className: `${[className.table.data, 'previous_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isBetween(day, active[0], active[1], className.day)].join(' ')}`
348
+ className: classNames(className.table.data, 'previous_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isBetween(day, active[0], active[1], className.day))
355
349
  }, jsx(Typography, {
356
350
  ...typographyProps(className.day.day)
357
351
  }, '')));
@@ -364,7 +358,7 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
364
358
  tableData.push(jsx("td", {
365
359
  key: `this_month-${i + 1}`,
366
360
  "data-time": Date.parse(day),
367
- className: `${[className.table.data, 'this_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit), isBetween(day, active[0], active[1], className.day)].join(' ')}`,
361
+ className: classNames(className.table.data, 'this_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit), isBetween(day, active[0], active[1], className.day)),
368
362
  onClick: onTableDataClick
369
363
  }, jsx(Typography, {
370
364
  ...typographyProps(className.day.day)
@@ -380,7 +374,7 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
380
374
  tableData.push(jsx("td", {
381
375
  key: `next_month-${i + 1}`,
382
376
  "data-time": Date.parse(day) + 1 /*(displayAnotherMonth ? 0 : 1)*/,
383
- className: `${[className.table.data, 'next_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isBetween(day, active[0], active[1], className.day)].join(' ')}`
377
+ className: classNames(className.table.data, 'next_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isBetween(day, active[0], active[1], className.day))
384
378
  }, jsx(Typography, {
385
379
  ...typographyProps(className.day.day)
386
380
  }, '')));
@@ -394,7 +388,7 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
394
388
  tableData.push(jsx("td", {
395
389
  key: `previous_month-${prevDate - i + 1}`,
396
390
  "data-time": Date.parse(day) - (displayAnotherMonth ? 0 : 1),
397
- className: `${[className.table.data, 'previous_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit)].join(' ')}`,
391
+ className: classNames(className.table.data, 'previous_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit)),
398
392
  onClick: onTableDataClick
399
393
  }, jsx(Typography, {
400
394
  ...typographyProps(className.day.day)
@@ -408,7 +402,7 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
408
402
  tableData.push(jsx("td", {
409
403
  key: `this_month-${i + 1}`,
410
404
  "data-time": Date.parse(day),
411
- className: `${[className.table.data, 'this_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit)].join(' ')}`,
405
+ className: classNames(className.table.data, 'this_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit)),
412
406
  onClick: onTableDataClick
413
407
  }, jsx(Typography, {
414
408
  ...typographyProps(className.day.day)
@@ -422,7 +416,7 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
422
416
  tableData.push(jsx("td", {
423
417
  key: `next_month-${i + 1}`,
424
418
  "data-time": Date.parse(day) + (displayAnotherMonth ? 0 : 1),
425
- className: `${[className.table.data, 'next_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit)].join(' ')}`,
419
+ className: classNames(className.table.data, 'next_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit)),
426
420
  onClick: onTableDataClick
427
421
  }, jsx(Typography, {
428
422
  ...typographyProps(className.day.day)
@@ -3,7 +3,7 @@
3
3
  import { jsx } from '@emotion/core';
4
4
  import PropTypes from 'prop-types';
5
5
  import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
6
- import { date as moment } from "../../../utils";
6
+ import { classNames, date as moment } from "../../../utils";
7
7
  import { generateCalendarCSS, isAfterLimit, isBeforeLimit, isValidDate, onUpdateCalendar, renderHeader, renderNavigator } from "./function";
8
8
  const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
9
9
  actions,
@@ -206,7 +206,7 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
206
206
  */
207
207
  return jsx("div", {
208
208
  ...props,
209
- className: [unique.container, className].join(' ').trim().replace(/\s+/g, ' '),
209
+ className: classNames(unique.container, className),
210
210
  css: generateCalendarCSS(unique),
211
211
  ref: ref
212
212
  }, renderNavigator(unique, navigatorRefs, setPrevYear, setPrevMonth, setNextMonth, setNextYear), tableMemo, actions);
@@ -9,7 +9,7 @@ import locale from "../../../../locale";
9
9
  import theme from "../../../../theme/settings";
10
10
  import { date as moment } from "../../../../utils";
11
11
  import { typography } from "../../../../styles/typography";
12
- import { itemsCenter, border, boxBorder, borderRadius4px, bgColor, cursorPointer, flexCol, flexRow, displayInlineFlex, justifyBetween, pointerEventsNone, positionAbsolute, positionRelative, parseMinHeight, textCenter, textColor, userSelectNone, pd } from "../../../../styles/general";
12
+ import { itemsCenter, border, boxBorder, borderRadius4px, bgColor, cursorPointer, flexCol, flexRow, displayInlineFlex, justifyBetween, pointerEventsNone, positionAbsolute, positionRelative, parseMinHeight, textCenter, textColor, userSelectNone } from "../../../../styles/general";
13
13
  const {
14
14
  paragraph2,
15
15
  heading6
@@ -7,15 +7,12 @@ import locale from "../../../locale";
7
7
  import PropTypes from 'prop-types';
8
8
  import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
9
9
  import { render } from 'react-dom';
10
- import { bgColor, borderRadius4px, cursorPointer, displayBlock, displayFlex, displayNone, flexCol, flexRow, invisible, justifyEnd, left, mg, parseHeight, parseMaxWidth, parseMinWidth, pd, pointerEventsNone, positionFixed, textCenter, top, userSelectNone, whiteSpaceNoWrap, z } from "../../../styles/general";
10
+ import { bgColor, borderRadius4px, cursorPointer, displayBlock, displayFlex, displayNone, flexCol, flexRow, invisible, justifyEnd, left, mg, parseHeight, parseMaxWidth, parseMinWidth, pd, pointerEventsNone, positionFixed, shadowLarge, textCenter, top, userSelectNone, whiteSpaceNoWrap, z } from "../../../styles/general";
11
11
  import { useTheme } from "../../../theme";
12
- import { capitalizeSentenceCase, classNames, date as moment, isEqual, randomString, updatePosition } from "../../../utils";
12
+ import { capitalizeSentenceCase, classNames, isEqual, date as moment, randomString, updatePosition } from "../../../utils";
13
13
  import { generateCalendarCSS, onUpdateNavigator, renderHeader, renderNavigator } from "../calendar/function";
14
14
  import ControlComp from "../control";
15
15
  const {
16
- boxShadows: {
17
- large: boxShadowsLarge
18
- },
19
16
  spacing,
20
17
  zIndex: zIndexCORE
21
18
  } = useTheme();
@@ -103,7 +100,9 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
103
100
  viewType,
104
101
  ...props
105
102
  }, reference) => {
103
+ var _placeholder;
106
104
  if (!reference) reference = useRef(null);
105
+ placeholder = (_placeholder = placeholder) !== null && _placeholder !== void 0 ? _placeholder : `${displayFormat} - ${displayFormat}`;
107
106
  const footerRef = useRef(null);
108
107
  const iconRef = useRef(null);
109
108
  const ipConRef = useRef(null);
@@ -1030,7 +1029,7 @@ const pickerCSS = {
1030
1029
  ${flexCol};
1031
1030
  ${borderRadius4px};
1032
1031
  ${bgColor('system/white')};
1033
- box-shadow: ${boxShadowsLarge};
1032
+ ${shadowLarge};
1034
1033
  .${unique.wrapper} {
1035
1034
  ${displayFlex};
1036
1035
  ${flexRow};
@@ -11,6 +11,7 @@ import { typography } from "../../../../styles/typography";
11
11
  import { date, classNames } from "../../../../utils";
12
12
  const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
13
13
  action = {},
14
+ actionIconAt,
14
15
  className,
15
16
  disabled,
16
17
  displayFormat,
@@ -30,7 +31,6 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
30
31
  style,
31
32
  value,
32
33
  viewType,
33
- endIcon,
34
34
  returnFormat,
35
35
  readOnly,
36
36
  required,
@@ -446,6 +446,14 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
446
446
  setMinValue(min);
447
447
  setMaxValue(max);
448
448
  }, [min, max]);
449
+ const iconComp = jsx(ButtonIcon, {
450
+ disabled: disabled || readOnly,
451
+ viewType: 'ghost',
452
+ viewBox: true,
453
+ name: 'clock'
454
+ });
455
+ const endIcon = actionIconAt === 'end' && iconComp;
456
+ const startIcon = actionIconAt === 'start' && iconComp;
449
457
  return useMemo(() => {
450
458
  return jsx("div", {
451
459
  ref: ref,
@@ -471,6 +479,7 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
471
479
  },
472
480
  value: displayTime,
473
481
  endIcon: endIcon,
482
+ startIcon: startIcon,
474
483
  onKeyDown: e => e.preventDefault(),
475
484
  status: error ? 'danger' : 'default',
476
485
  readOnly: true
@@ -604,7 +613,7 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
604
613
  },
605
614
  disabled: disabled
606
615
  }, error));
607
- }, [className, currentInputFocus, disabled, displayTime, displayFormat, error, errorProps, id, inputProps, inputStyle, endIcon, placeholder, onChange, mode12h, minValue, maxValue, label, labelProps, style, minuteStep, timeValue, value, viewType, required, returnFormat, readOnly]);
616
+ }, [actionIconAt, className, currentInputFocus, disabled, displayTime, displayFormat, error, errorProps, id, inputProps, inputStyle, placeholder, onChange, mode12h, minValue, maxValue, label, labelProps, style, minuteStep, timeValue, value, viewType, required, returnFormat, readOnly]);
608
617
  }));
609
618
  const TimePickerCSS = css`
610
619
  ${mgt([1])};
@@ -690,16 +699,16 @@ const TimePickerAMPMCSS = currentText => css`
690
699
  }
691
700
  `;
692
701
  TimePicker.defaultProps = {
702
+ actionIconAt: 'end',
693
703
  className: '',
694
704
  disabled: false,
695
705
  displayFormat: 'HH:mm:ss',
696
706
  mode12h: false,
697
- placeholder: '',
707
+ placeholder: 'HH:mm:ss',
698
708
  readOnly: false,
699
709
  required: false,
700
710
  returnFormat: 'HH:mm:ss',
701
711
  error: '',
702
- endIcon: 'clock',
703
712
  minuteStep: 1,
704
713
  min: '',
705
714
  max: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.4.1-beta.2",
3
+ "version": "1.4.1-beta.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "license": "UNLICENSED",
package/styles/general.js CHANGED
@@ -417,9 +417,15 @@ const selfEnd = css`
417
417
  const selfStart = css`
418
418
  align-self: flex-start;
419
419
  `;
420
+ const shadowLarge = css`
421
+ box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);
422
+ `;
420
423
  const shadowNone = css`
421
424
  box-shadow: none;
422
425
  `;
426
+ const shadowSmall = css`
427
+ box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.25);
428
+ `;
423
429
  const textCapitalize = css`
424
430
  text-transform: capitalize;
425
431
  `;
@@ -487,4 +493,4 @@ const whiteSpacePreWrap = css`
487
493
  const z = vl => css`
488
494
  z-index: ${zIndex(vl)};
489
495
  `;
490
- export { animation, aspectSquare, bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderDashed, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, borderRight, borderTop, borderTopColor, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorInitial, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, listNone, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, overflowXHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textSentence, textUnderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
496
+ export { animation, aspectSquare, bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderDashed, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, borderRight, borderTop, borderTopColor, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorInitial, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, listNone, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, overflowXHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowLarge, shadowNone, shadowSmall, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textSentence, textUnderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };