diginet-core-ui 1.4.1-beta.3 → 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
@@ -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.3",
3
+ "version": "1.4.1-beta.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "license": "UNLICENSED",