@pushwoosh/dumb-components 1.1.28 → 1.1.29

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.
@@ -25,9 +25,11 @@ export function DatePickerField({
25
25
  if (!showPicker) {
26
26
  return;
27
27
  }
28
- const handleClickListener = e => {
29
- var _refs$floating$curren;
30
- if (!((_refs$floating$curren = refs.floating.current) !== null && _refs$floating$curren !== void 0 && _refs$floating$curren.contains(e.target)) && !refs.reference.current.contains(e.target)) {
28
+ const handleClickListener = event => {
29
+ const path = event.composedPath();
30
+ const isInsideFloating = refs.floating.current && path.includes(refs.floating.current);
31
+ const isInsideReference = refs.reference.current && path.includes(refs.reference.current);
32
+ if (!isInsideFloating && !isInsideReference) {
31
33
  setShowPicker(false);
32
34
  }
33
35
  };
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { Spacing } from '@pushwoosh/kit-constants';
3
2
  import { Collapse, Horizontal } from '@pushwoosh/kit-helpers';
4
3
  import { format, createUTCDate } from '../../helpers';
5
4
  import { DatePicker } from '../DatePicker';
@@ -35,7 +34,7 @@ export function DateTimePicker(props) {
35
34
  slotAfterMonth: () => React.createElement(Collapse, {
36
35
  expanded: !!value
37
36
  }, React.createElement(Horizontal, {
38
- "$padding": `0 ${Spacing.S5}`,
37
+ "$padding": "0 16px",
39
38
  "$gap": 8
40
39
  }, React.createElement(NumberPicker, {
41
40
  placeholder: "00",
@@ -1,6 +1,5 @@
1
1
  import { useFloating, offset, autoPlacement } from '@floating-ui/react-dom';
2
2
  import React, { useState, useEffect } from 'react';
3
- import { Spacing } from '@pushwoosh/kit-constants';
4
3
  import { CalendarIcon } from '@pushwoosh/kit-icons';
5
4
  import { useUTCDate } from './helpers';
6
5
  import { InputFrame } from '../../styles';
@@ -26,9 +25,11 @@ export function DateTimePickerField({
26
25
  if (!showPicker) {
27
26
  return;
28
27
  }
29
- const handleClickListener = e => {
30
- var _refs$floating$curren;
31
- if (!((_refs$floating$curren = refs.floating.current) !== null && _refs$floating$curren !== void 0 && _refs$floating$curren.contains(e.target)) && !refs.reference.current.contains(e.target)) {
28
+ const handleClickListener = event => {
29
+ const path = event.composedPath();
30
+ const isInsideFloating = refs.floating.current && path.includes(refs.floating.current);
31
+ const isInsideReference = refs.reference.current && path.includes(refs.reference.current);
32
+ if (!isInsideFloating && !isInsideReference) {
32
33
  setShowPicker(false);
33
34
  }
34
35
  };
@@ -52,9 +53,9 @@ export function DateTimePickerField({
52
53
  } = useUTCDate(value);
53
54
  return React.createElement(React.Fragment, null, React.createElement(InputFrame, {
54
55
  ref: refs.setReference,
55
- "$gap": Spacing.S3,
56
56
  "$empty": !value,
57
57
  "$error": error,
58
+ "$gap": 8,
58
59
  onClick: () => setShowPicker(!showPicker)
59
60
  }, React.createElement(CalendarIcon, {
60
61
  size: "medium",
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { Spacing } from '@pushwoosh/kit-constants';
3
2
  import { Columns } from '@pushwoosh/kit-helpers';
4
3
  import { format, parseStringToArray, addPeriod, setPeriod } from '../../helpers';
5
4
  import { CellBox } from '../../styles';
@@ -19,7 +18,7 @@ export function DecadeView(props) {
19
18
  onNext: () => onChange(format(addPeriod(value, 'year', 12), 'year'))
20
19
  }, React.createElement(Columns, {
21
20
  "$sizes": 4,
22
- "$gap": Spacing.S1
21
+ "$gap": 4
23
22
  }, Array.from({
24
23
  length: 12
25
24
  }).map((_, i) => {
@@ -1,6 +1,6 @@
1
1
  import styled from 'styled-components';
2
- import { Color, Spacing } from '@pushwoosh/kit-constants';
2
+ import { Color } from '@pushwoosh/kit-constants';
3
3
  export const Hint = styled.div.withConfig({
4
4
  displayName: "Hint",
5
5
  componentId: "sc-170ev2t-0"
6
- })(["display:flex;align-items:center;font-size:100%;line-height:initial;padding-right:", ";color:", ";pointer-events:none;"], Spacing.S3, Color.PHANTOM);
6
+ })(["display:flex;align-items:center;font-size:100%;line-height:initial;padding-right:8px;color:", ";pointer-events:none;"], Color.PHANTOM);
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { Spacing } from '@pushwoosh/kit-constants';
3
2
  import { Vertical, Horizontal } from '@pushwoosh/kit-helpers';
4
3
  import { Arrow } from './styles';
5
4
  export function PickerPlate(props) {
@@ -10,11 +9,11 @@ export function PickerPlate(props) {
10
9
  onNext
11
10
  } = props;
12
11
  return React.createElement(Vertical, {
13
- "$gap": Spacing.S5
12
+ "$gap": 16
14
13
  }, React.createElement(Horizontal, {
15
14
  "$justifyContent": "space-between"
16
15
  }, slot, React.createElement(Horizontal, {
17
- "$gap": Spacing.S1
16
+ "$gap": 4
18
17
  }, React.createElement(Arrow, {
19
18
  direction: "left",
20
19
  onClick: onPrev
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { Spacing } from '@pushwoosh/kit-constants';
3
2
  import { Columns } from '@pushwoosh/kit-helpers';
4
3
  import { format, addPeriod, setPeriod, monthName, isSamePeriod } from '../../helpers';
5
4
  import { CellBox, DateInfo } from '../../styles';
@@ -17,7 +16,7 @@ export function YearView(props) {
17
16
  slot: React.createElement(DateInfo, null, year)
18
17
  }, React.createElement(Columns, {
19
18
  "$sizes": 4,
20
- "$gap": Spacing.S1,
19
+ "$gap": 4,
21
20
  "$justifyContent": "space-between"
22
21
  }, Array.from({
23
22
  length: 12
@@ -1,5 +1,5 @@
1
1
  import styled, { css } from 'styled-components';
2
- import { Color, Spacing, ShapeRadius, FontSize, FontWeight, LineHeight, Shadow } from '@pushwoosh/kit-constants';
2
+ import { Color, ShapeRadius, FontSize, FontWeight, LineHeight, Shadow } from '@pushwoosh/kit-constants';
3
3
  import { Horizontal } from '@pushwoosh/kit-helpers';
4
4
  const disabled = css(["border:1px solid ", ";background:linear-gradient( to top left,rgba(0,0,0,0) 0%,rgba(0,0,0,0) calc(50% - 0.8px),", " 50%,rgba(0,0,0,0) calc(50% + 0.8px),rgba(0,0,0,0) 100% );opacity:0.8;pointer-events:none;"], Color.FORM, Color.FORM);
5
5
  const CalendarCellBaseStyled = styled.div.withConfig({
@@ -32,7 +32,7 @@ export const DayHeader = styled(CalendarCellBaseStyled).withConfig({
32
32
  export const DateInfo = styled.div.withConfig({
33
33
  displayName: "DateInfo",
34
34
  componentId: "sc-t3ruuk-3"
35
- })(["display:flex;align-items:center;height:24px;color:", ";background:", ";padding:", " ", ";font-weight:", ";font-size:", ";line-height:", ";border-radius:", ";cursor:pointer;"], Color.MAIN, Color.SOFT_LIGHT, Spacing.S0, Spacing.S3, FontWeight.MEDIUM, FontSize.SMALL, LineHeight.SMALL, ShapeRadius.CONTROL);
35
+ })(["display:flex;align-items:center;height:24px;color:", ";background:", ";padding:2px 8px;font-weight:", ";font-size:", ";line-height:", ";border-radius:", ";cursor:pointer;"], Color.MAIN, Color.SOFT_LIGHT, FontWeight.MEDIUM, FontSize.SMALL, LineHeight.SMALL, ShapeRadius.CONTROL);
36
36
  export const RoundedBlock = styled(Horizontal).attrs({
37
37
  $alignItems: 'center',
38
38
  $padding: '0 12px'
@@ -61,4 +61,4 @@ export const SingleInputFrame = styled(InputFrame).withConfig({
61
61
  export const CalendarBox = styled.div.withConfig({
62
62
  displayName: "CalendarBox",
63
63
  componentId: "sc-t3ruuk-7"
64
- })(["width:282px;background-color:", ";padding:", ";border:1px solid ", ";border-radius:", ";box-shadow:", ";box-sizing:border-box;z-index:1;"], Color.CLEAR, Spacing.S5, Color.FORM, ShapeRadius.CONTROL, Shadow.REGULAR);
64
+ })(["width:282px;background-color:", ";padding:16px;border:1px solid ", ";border-radius:", ";box-shadow:", ";box-sizing:border-box;z-index:1;"], Color.CLEAR, Color.FORM, ShapeRadius.CONTROL, Shadow.REGULAR);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.1.28",
3
+ "version": "1.1.29",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",