@uncinc/uncinc-react-kitchen-sink 2.10.1 → 2.10.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.
@@ -1,9 +1,34 @@
1
1
  export function Checkbox(props: any): React.JSX.Element;
2
2
  export namespace Checkbox {
3
3
  namespace defaultProps {
4
+ let required: boolean;
5
+ let description: undefined;
6
+ let validation: undefined;
4
7
  function onChange(): void;
8
+ let className: undefined;
9
+ let wrapperClassName: undefined;
10
+ let disabled: boolean;
11
+ }
12
+ namespace propTypes {
13
+ export let title: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
14
+ let required_1: PropTypes.Requireable<boolean>;
15
+ export { required_1 as required };
16
+ let description_1: PropTypes.Requireable<string>;
17
+ export { description_1 as description };
18
+ export let fieldName: PropTypes.Validator<string>;
19
+ let validation_1: PropTypes.Requireable<(...args: any[]) => any>;
20
+ export { validation_1 as validation };
21
+ let onChange_1: PropTypes.Requireable<(...args: any[]) => any>;
22
+ export { onChange_1 as onChange };
23
+ let className_1: PropTypes.Requireable<string>;
24
+ export { className_1 as className };
25
+ let wrapperClassName_1: PropTypes.Requireable<string>;
26
+ export { wrapperClassName_1 as wrapperClassName };
27
+ let disabled_1: PropTypes.Requireable<boolean>;
28
+ export { disabled_1 as disabled };
5
29
  }
6
30
  }
7
31
  declare const _default: (props: any) => React.JSX.Element;
8
32
  export default _default;
9
33
  import React from 'react';
34
+ import PropTypes from 'prop-types';
@@ -2,6 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
  import React from 'react';
3
3
  import { Field } from 'formik';
4
4
  import c from 'classnames';
5
+ import PropTypes from 'prop-types';
5
6
  import { useTranslation } from 'react-i18next';
6
7
  import ReactHtmlParser from 'react-html-parser';
7
8
  import GenericFormElement from '../GenericFormElement';
@@ -17,8 +18,7 @@ export var Checkbox = function Checkbox(props) {
17
18
  _onChange = props.onChange,
18
19
  className = props.className,
19
20
  wrapperClassName = props.wrapperClassName,
20
- _props$disabled = props.disabled,
21
- disabled = _props$disabled === void 0 ? false : _props$disabled;
21
+ disabled = props.disabled;
22
22
  var _useExtendedFormikCon = useExtendedFormikContext(),
23
23
  values = _useExtendedFormikCon.values,
24
24
  errors = _useExtendedFormikCon.errors,
@@ -81,10 +81,27 @@ export var Checkbox = function Checkbox(props) {
81
81
  required: required,
82
82
  "aria-describedby": "".concat(errorId, " ").concat(descriptionId),
83
83
  "aria-invalid": Boolean(error)
84
- })), ReactHtmlParser(title));
84
+ })), typeof title === 'string' ? ReactHtmlParser(title) : title);
85
85
  }));
86
86
  };
87
87
  Checkbox.defaultProps = {
88
- onChange: function onChange() {}
88
+ required: false,
89
+ description: undefined,
90
+ validation: undefined,
91
+ onChange: function onChange() {},
92
+ className: undefined,
93
+ wrapperClassName: undefined,
94
+ disabled: false
95
+ };
96
+ Checkbox.propTypes = {
97
+ title: PropTypes.node.isRequired,
98
+ required: PropTypes.bool,
99
+ description: PropTypes.string,
100
+ fieldName: PropTypes.string.isRequired,
101
+ validation: PropTypes.func,
102
+ onChange: PropTypes.func,
103
+ className: PropTypes.string,
104
+ wrapperClassName: PropTypes.string,
105
+ disabled: PropTypes.bool
89
106
  };
90
107
  export default withMapping(Checkbox);
@@ -24,34 +24,12 @@ $material-icon-styles: (
24
24
  two-tone
25
25
  );
26
26
 
27
- @mixin icon-color($color: #000000, $opacity: 1) {
28
- $r: calc(color.red($color) / 255);
29
- $g: calc(color.green($color) / 255);
30
- $b: calc(color.blue($color) / 255);
31
- $a: $opacity;
32
-
33
- // grayscale fallback if SVG from data url is not supported
34
- $lightness: color.lightness($color);
35
- filter: saturate(0%) brightness(0%) invert($lightness) opacity($opacity);
36
-
37
- // color filter
38
- $svg-filter-id: "recolor";
39
- filter: url('data:image/svg+xml;utf8,\
40
- <svg xmlns="http://www.w3.org/2000/svg">\
41
- <filter id="#{$svg-filter-id}" color-interpolation-filters="sRGB">\
42
- <feColorMatrix type="matrix" values="\
43
- 0 0 0 0 #{$r}\
44
- 0 0 0 0 #{$g}\
45
- 0 0 0 0 #{$b}\
46
- 0 0 0 #{$a} 0\
47
- "/>\
48
- </filter>\
49
- </svg>\
50
- ##{$svg-filter-id}');
27
+ @mixin icon-color($color: #000000) {
28
+ background-color: $color;
51
29
  }
52
30
 
53
31
  @mixin unset-icon-color() {
54
- filter: none;
32
+ background-color: none;
55
33
  }
56
34
 
57
35
  @mixin generateMaterialIconClasses() {
@@ -62,7 +40,9 @@ $material-icon-styles: (
62
40
  $name: list.nth($material-icon-names, $nameIndex);
63
41
 
64
42
  .Icon-#{$style}-#{$name} {
65
- background: url('~@material-design-icons/svg/#{$style}/#{$name}.svg');
43
+ mask-image: url('~@material-design-icons/svg/#{$style}/#{$name}.svg');
44
+ mask-repeat: no-repeat;
45
+ mask-size: contain;
66
46
  font-size: 100%;
67
47
  vertical-align: middle;
68
48
  text-indent: -9999px;
@@ -80,7 +60,9 @@ $material-icon-styles: (
80
60
  $name: list.nth($custom-icon-names, $nameIndex);
81
61
 
82
62
  .Icon-#{$name} {
83
- background: url('#{$custom-icon-path}/#{$name}.svg');
63
+ mask-image: url('#{$custom-icon-path}/#{$name}.svg');
64
+ mask-repeat: no-repeat;
65
+ mask-size: contain;
84
66
  font-size: 100%;
85
67
  vertical-align: middle;
86
68
  text-indent: -9999px;
@@ -132,9 +114,9 @@ $material-icon-styles: (
132
114
  }
133
115
 
134
116
  @if not $custom {
135
- background: url('~@material-design-icons/svg/#{$style}/#{$icon-name}.svg');
117
+ mask-image: url('~@material-design-icons/svg/#{$style}/#{$icon-name}.svg');
136
118
  } @else {
137
- background: url('#{$custom-icon-path}/#{$icon-name}.svg');
119
+ mask-image: url('#{$custom-icon-path}/#{$icon-name}.svg');
138
120
  }
139
121
 
140
122
  display: block;
@@ -1,2 +1,2 @@
1
1
  import { MutableRefObject } from 'react';
2
- export default function useOnScreen(ref: MutableRefObject<HTMLElement>): boolean;
2
+ export default function useOnScreen(ref: MutableRefObject<HTMLElement>, options?: IntersectionObserverInit): boolean;
@@ -5,7 +5,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
5
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { useEffect, useState } from 'react';
8
- export default function useOnScreen(ref) {
8
+ export default function useOnScreen(ref, options) {
9
9
  var _useState = useState(false),
10
10
  _useState2 = _slicedToArray(_useState, 2),
11
11
  isIntersecting = _useState2[0],
@@ -15,12 +15,18 @@ export default function useOnScreen(ref) {
15
15
  var _ref2 = _slicedToArray(_ref, 1),
16
16
  entry = _ref2[0];
17
17
  return setIntersecting(entry.isIntersecting);
18
- });
19
- observer.observe(ref.current);
18
+ }, options);
19
+ var currentRef = ref.current;
20
+ if (currentRef) {
21
+ observer.observe(currentRef);
22
+ }
23
+
20
24
  // Remove the observer as soon as the component is unmounted
21
25
  return function () {
22
- return observer.disconnect();
26
+ if (currentRef) {
27
+ observer.disconnect();
28
+ }
23
29
  };
24
- }, [ref]);
30
+ }, [options, ref]);
25
31
  return isIntersecting;
26
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uncinc/uncinc-react-kitchen-sink",
3
- "version": "2.10.1",
3
+ "version": "2.10.3",
4
4
  "description": "Default React components that are easily extended.",
5
5
  "author": "uncinc",
6
6
  "license": "MIT",