@homecode/ui 4.22.15 → 4.22.17

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.
@@ -1,7 +1,9 @@
1
1
  function dateToString(date) {
2
- return `${date.year}-${date.month}-${date.day}`;
2
+ const month = String(date.month).padStart(2, '0');
3
+ const day = String(date.day).padStart(2, '0');
4
+ return `${date.year}-${month}-${day}`;
3
5
  }
4
- function strigToDate(dateString) {
6
+ function stringToDate(dateString) {
5
7
  const [year, month, day] = dateString.split('-');
6
8
  return {
7
9
  year: Number(year),
@@ -28,4 +30,4 @@ function isDateBetween(date, startDate, endDate) {
28
30
  return isDateAfter(date, startDate) && isDateBefore(date, endDate);
29
31
  }
30
32
 
31
- export { dateToString, isDateAfter, isDateBefore, isDateBetween, isDateEqual, strigToDate };
33
+ export { dateToString, isDateAfter, isDateBefore, isDateBetween, isDateEqual, stringToDate };
@@ -3,7 +3,7 @@ import { useState, useCallback, createElement } from 'react';
3
3
  import cn from 'classnames';
4
4
  import { Calendar } from '../Calendar/Calendar.js';
5
5
  import { Button } from '../Button/Button.js';
6
- import { dateToString, isDateAfter, strigToDate, isDateBetween, isDateEqual } from './DatePicker.helpers.js';
6
+ import { dateToString, isDateAfter, stringToDate, isDateBetween, isDateEqual } from './DatePicker.helpers.js';
7
7
  import S from './DatePicker.styl.js';
8
8
 
9
9
  function DatePicker(props) {
@@ -21,7 +21,7 @@ function DatePicker(props) {
21
21
  const valStr = dateToString(val);
22
22
  if (isRange && isPicking) {
23
23
  props.onPointerOver = () => {
24
- const newVal = isDateAfter(strigToDate(value[0]), val)
24
+ const newVal = isDateAfter(stringToDate(value[0]), val)
25
25
  ? [valStr, value[0]]
26
26
  : [value[0], valStr];
27
27
  onChange(newVal);
@@ -29,8 +29,8 @@ function DatePicker(props) {
29
29
  }
30
30
  const classes = [className, S.day];
31
31
  if (isRange) {
32
- const from = strigToDate(value[0]);
33
- const to = strigToDate(value[1]);
32
+ const from = stringToDate(value[0]);
33
+ const to = stringToDate(value[1]);
34
34
  if (isDateBetween(val, from, to))
35
35
  classes.push(S.between);
36
36
  if (isDateEqual(val, from))
@@ -41,7 +41,7 @@ function DatePicker(props) {
41
41
  return (createElement(Button, { ...props, variant: "clear", className: cn(classes), size: size, key: `${year}-${month}-${day}` }, day));
42
42
  }, [size, isPicking, isRange, value, onChange]);
43
43
  calendarProps.className = cn(calendarProps.className, S.calendar);
44
- return (jsxs("div", { className: cn(S.root, doubleCalendar && S.doubleCalendar, props.className), onPointerDown: onPointerDown, onPointerUp: onPointerUp, children: [jsx(Calendar, { size: size, hideOtherMonthDays: isRange, ...calendarProps, renderDay: renderDay, value: strigToDate(isRange ? value[0] : value), onDayPointerDown: onFirstDateChange, onDayPointerUp: undefined }), isRange && doubleCalendar && (jsx(Calendar, { size: size, hideOtherMonthDays: isRange, ...calendarProps, renderDay: renderDay, value: strigToDate(value[1]), onDayPointerDown: val => onChange([value[0], dateToString(val)]), onDayPointerUp: val => onChange([value[0], dateToString(val)]) }))] }));
44
+ return (jsxs("div", { className: cn(S.root, doubleCalendar && S.doubleCalendar, props.className), onPointerDown: onPointerDown, onPointerUp: onPointerUp, children: [jsx(Calendar, { size: size, hideOtherMonthDays: isRange, ...calendarProps, renderDay: renderDay, value: stringToDate(isRange ? value[0] : value), onDayPointerDown: onFirstDateChange, onDayPointerUp: undefined }), isRange && doubleCalendar && (jsx(Calendar, { size: size, hideOtherMonthDays: isRange, ...calendarProps, renderDay: renderDay, value: stringToDate(value[1]), onDayPointerDown: val => onChange([value[0], dateToString(val)]), onDayPointerUp: val => onChange([value[0], dateToString(val)]) }))] }));
45
45
  }
46
46
 
47
47
  export { DatePicker };
@@ -70,6 +70,7 @@ var ICONS = {
70
70
  syncArrows: () => import('./syncArrows.svg.js'),
71
71
  table: () => import('./table.svg.js'),
72
72
  telegram: () => import('./telegram.svg.js'),
73
+ trafficLight: () => import('./trafficLight.svg.js'),
73
74
  };
74
75
 
75
76
  export { ICONS as default };
@@ -0,0 +1,49 @@
1
+ import * as React from 'react';
2
+
3
+ var _path;
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
+ var SvgTrafficLight = function SvgTrafficLight(props) {
6
+ return /*#__PURE__*/React.createElement("svg", _extends({
7
+ xmlns: "http://www.w3.org/2000/svg",
8
+ viewBox: "0 0 24 24"
9
+ }, props), /*#__PURE__*/React.createElement("g", {
10
+ transform: "matrix(.13313 0 0 -.13313 -.035 223.653)"
11
+ }, _path || (_path = /*#__PURE__*/React.createElement("path", {
12
+ d: "M60.026 1675.113c-21.216-3.065-23.3-5.886-25.508-34.705-1.962-26.121-1.962-75.911 0-102.032 2.207-29.187 4.047-31.517 27.225-34.829 24.772-3.433 64.383-1.226 73.458 4.047 6.99 4.047 8.339 8.462 10.056 30.782 1.962 26.12 2.085 75.91.123 102.032-2.208 29.187-4.047 31.517-27.225 34.828-15.943 2.207-42.31 2.207-58.13-.123m38.752-9.688c6.132-2.575 8.83-5.15 11.528-11.037 4.047-8.707 1.84-20.848-4.537-26.612-6.378-5.64-16.801-7.358-24.65-4.047-6.132 2.576-8.83 5.151-11.528 11.038-3.801 8.216-2.33 19.008 3.557 25.63 5.518 6.132 17.291 8.462 25.63 5.028m0-55.185c6.132-2.576 8.83-5.151 11.528-11.038 4.047-8.707 1.84-20.847-4.537-26.611-6.378-5.641-16.801-7.358-24.65-4.047-6.132 2.575-8.83 5.15-11.528 11.037-3.801 8.217-2.33 19.008 3.557 25.63 5.518 6.132 17.291 8.462 25.63 5.029m0-55.186c6.132-2.575 8.83-5.15 11.528-11.037 4.047-8.707 1.84-20.848-4.537-26.612-6.378-5.641-16.801-7.358-24.65-4.047-6.132 2.576-8.83 5.15-11.528 11.037-3.801 8.217-2.33 19.009 3.557 25.631 5.518 6.132 17.291 8.462 25.63 5.028"
13
+ })), /*#__PURE__*/React.createElement("circle", {
14
+ cx: 89.992,
15
+ cy: -1644.533,
16
+ r: 23.827,
17
+ style: {
18
+ fill: "#e02020",
19
+ fillOpacity: 0.751445,
20
+ strokeWidth: 0.976535,
21
+ strokeLinecap: "round"
22
+ },
23
+ transform: "scale(1 -1)"
24
+ }), /*#__PURE__*/React.createElement("circle", {
25
+ cx: 90.023,
26
+ cy: -1589.156,
27
+ r: 23.827,
28
+ style: {
29
+ fill: "#e0dd20",
30
+ fillOpacity: 0.751445,
31
+ strokeWidth: 0.976535,
32
+ strokeLinecap: "round"
33
+ },
34
+ transform: "scale(1 -1)"
35
+ }), /*#__PURE__*/React.createElement("circle", {
36
+ cx: 89.745,
37
+ cy: -1534.207,
38
+ r: 23.827,
39
+ style: {
40
+ fill: "#20e020",
41
+ fillOpacity: 0.751445,
42
+ strokeWidth: 0.976535,
43
+ strokeLinecap: "round"
44
+ },
45
+ transform: "scale(1 -1)"
46
+ })));
47
+ };
48
+
49
+ export { SvgTrafficLight as default };
@@ -1,6 +1,6 @@
1
1
  import type { Date } from 'uilib/types';
2
2
  export declare function dateToString(date: Date): string;
3
- export declare function strigToDate(dateString: string): {
3
+ export declare function stringToDate(dateString: string): {
4
4
  year: number;
5
5
  month: number;
6
6
  day: number;
@@ -70,5 +70,6 @@ declare const _default: {
70
70
  syncArrows: () => Promise<any>;
71
71
  table: () => Promise<any>;
72
72
  telegram: () => Promise<any>;
73
+ trafficLight: () => Promise<any>;
73
74
  };
74
75
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homecode/ui",
3
- "version": "4.22.15",
3
+ "version": "4.22.17",
4
4
  "description": "React UI components library",
5
5
  "scripts": {
6
6
  "test": "jest",