@uncinc/uncinc-react-kitchen-sink 2.7.11 → 2.7.12

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.
@@ -20,9 +20,15 @@ var Radio = function Radio(props) {
20
20
  var classes = c('WebformRadios__radio__input', {
21
21
  'icon-before': true,
22
22
  'icon-radio': true,
23
- 'icon-variant-0': !(field.value && field.value === props.value),
24
- 'icon-variant-1': field.value && field.value === props.value
23
+ // These double equals instead of triple equals are on purpose.
24
+ // JavaScript object keys are always strings even though they may be
25
+ // represented as numbers.
26
+ /* eslint-disable */
27
+ 'icon-variant-0': !(field.value && field.value == props.value),
28
+ 'icon-variant-1': field.value && field.value == props.value
29
+ /* eslint-enable */
25
30
  });
31
+
26
32
  if (props.value === '__other__') {
27
33
  var inputClasses = c({
28
34
  hidden: field.value !== '__other__'
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
- export interface TitleWithTextProps {
1
+ import React, { HTMLAttributes } from 'react';
2
+ export interface TitleWithTextProps extends React.HTMLProps<HTMLAttributes<HTMLDivElement>> {
3
3
  title?: string;
4
4
  titleProps?: React.ComponentPropsWithoutRef<'h2'>;
5
5
  text?: string;
6
- textProps?: React.HTMLProps<HTMLDivElement>;
7
6
  className?: string;
8
7
  }
9
8
  declare const TitleWithText: React.FC<TitleWithTextProps>;
@@ -1,4 +1,7 @@
1
+ var _excluded = ["title", "titleProps", "text", "className"];
1
2
  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); }
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
2
5
  import React from 'react';
3
6
  import c from 'classnames';
4
7
  import WysiwygField from '../WysiwygField';
@@ -6,8 +9,8 @@ var TitleWithText = function TitleWithText(_ref) {
6
9
  var title = _ref.title,
7
10
  titleProps = _ref.titleProps,
8
11
  text = _ref.text,
9
- textProps = _ref.textProps,
10
- className = _ref.className;
12
+ className = _ref.className,
13
+ props = _objectWithoutProperties(_ref, _excluded);
11
14
  var classes = c('TitleWithText', className);
12
15
  return /*#__PURE__*/React.createElement("div", {
13
16
  className: classes
@@ -16,7 +19,7 @@ var TitleWithText = function TitleWithText(_ref) {
16
19
  }, titleProps), title), text && /*#__PURE__*/React.createElement(WysiwygField, _extends({
17
20
  className: "TitleWithText__text",
18
21
  property: "schema:text"
19
- }, textProps, {
22
+ }, props, {
20
23
  html: text
21
24
  })));
22
25
  };
@@ -27,7 +27,7 @@ var Quote = function Quote(_ref) {
27
27
  className: "Quote__quotewrapper"
28
28
  }, /*#__PURE__*/React.createElement("span", {
29
29
  className: "Quote__icon icon icon-".concat(icon)
30
- }), /*#__PURE__*/React.createElement("h3", {
30
+ }), /*#__PURE__*/React.createElement("blockquote", {
31
31
  className: "Quote__quote"
32
32
  }, quote), writer && /*#__PURE__*/React.createElement("div", {
33
33
  className: "Quote__writer"
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
- export interface TextProps {
1
+ import React, { HTMLAttributes } from 'react';
2
+ export interface TextProps extends React.HTMLProps<HTMLAttributes<HTMLDivElement>> {
3
3
  title?: string;
4
4
  titleProps?: React.ComponentProps<'h2'>;
5
5
  text: string;
6
- textProps?: React.HTMLProps<HTMLDivElement>;
7
6
  readMore?: string;
8
7
  duration?: number;
9
8
  easing?: string;
@@ -14,6 +13,10 @@ export interface TextProps {
14
13
  secondaryLink?: string;
15
14
  secondaryLinkText?: string;
16
15
  secondaryTarget?: string;
16
+ buttonClassName?: string;
17
+ buttonPrimary?: boolean;
18
+ secondaryButtonClassName?: string;
19
+ secondaryButtonPrimary?: boolean;
17
20
  className?: string;
18
21
  }
19
22
  declare const Text: React.FC<TextProps>;
@@ -1,9 +1,13 @@
1
+ var _excluded = ["title", "titleProps", "text", "readMore", "duration", "easing", "readMoreHeight", "link", "linkText", "target", "secondaryLink", "secondaryLinkText", "secondaryTarget", "buttonClassName", "buttonPrimary", "secondaryButtonPrimary", "secondaryButtonClassName", "className"];
2
+ 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); }
1
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
5
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
7
  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
8
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
11
  import React, { useState } from 'react';
8
12
  import { useTranslation } from 'react-i18next';
9
13
  import AnimateHeight from 'react-animate-height';
@@ -14,7 +18,6 @@ var Text = function Text(_ref) {
14
18
  var title = _ref.title,
15
19
  titleProps = _ref.titleProps,
16
20
  text = _ref.text,
17
- textProps = _ref.textProps,
18
21
  readMore = _ref.readMore,
19
22
  _ref$duration = _ref.duration,
20
23
  duration = _ref$duration === void 0 ? 333 : _ref$duration,
@@ -30,7 +33,14 @@ var Text = function Text(_ref) {
30
33
  secondaryLinkText = _ref.secondaryLinkText,
31
34
  _ref$secondaryTarget = _ref.secondaryTarget,
32
35
  secondaryTarget = _ref$secondaryTarget === void 0 ? '_self' : _ref$secondaryTarget,
33
- className = _ref.className;
36
+ buttonClassName = _ref.buttonClassName,
37
+ _ref$buttonPrimary = _ref.buttonPrimary,
38
+ buttonPrimary = _ref$buttonPrimary === void 0 ? true : _ref$buttonPrimary,
39
+ _ref$secondaryButtonP = _ref.secondaryButtonPrimary,
40
+ secondaryButtonPrimary = _ref$secondaryButtonP === void 0 ? true : _ref$secondaryButtonP,
41
+ secondaryButtonClassName = _ref.secondaryButtonClassName,
42
+ className = _ref.className,
43
+ props = _objectWithoutProperties(_ref, _excluded);
34
44
  var _useState = useState(false),
35
45
  _useState2 = _slicedToArray(_useState, 2),
36
46
  readMoreOpened = _useState2[0],
@@ -41,14 +51,15 @@ var Text = function Text(_ref) {
41
51
  var readMoreClasses = c('Text__read_more', {
42
52
  'Text__read_more--open': readMoreOpened
43
53
  });
54
+ var buttonClasses = c('Text__link', buttonClassName);
55
+ var secondaryButtonClasses = c('Text__link__secondary', secondaryButtonClassName);
44
56
  return /*#__PURE__*/React.createElement("div", {
45
57
  className: classes
46
- }, /*#__PURE__*/React.createElement(TitleWithText, {
58
+ }, /*#__PURE__*/React.createElement(TitleWithText, _extends({
47
59
  title: title,
48
60
  text: text,
49
- titleProps: titleProps,
50
- textProps: textProps
51
- }), readMore && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
61
+ titleProps: titleProps
62
+ }, props)), readMore && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
52
63
  className: readMoreClasses
53
64
  }, /*#__PURE__*/React.createElement(AnimateHeight, {
54
65
  duration: duration,
@@ -65,16 +76,18 @@ var Text = function Text(_ref) {
65
76
  }, readMoreOpened ? t('organisms.text.read_less') : t('organisms.text.read_more'))), (link || secondaryLink) && /*#__PURE__*/React.createElement("div", {
66
77
  className: "Text__links"
67
78
  }, link && /*#__PURE__*/React.createElement(Button, {
68
- className: "Text__link",
79
+ className: buttonClasses,
69
80
  href: link,
70
81
  target: target,
71
- rel: "noreferrer"
72
- }, linkText), secondaryLink && /*#__PURE__*/React.createElement(Button, {
73
- className: "Text__link__secondary",
82
+ rel: "noreferrer",
83
+ primary: buttonPrimary
84
+ }, /*#__PURE__*/React.createElement("span", null, linkText)), secondaryLink && /*#__PURE__*/React.createElement(Button, {
85
+ className: secondaryButtonClasses,
74
86
  href: secondaryLink,
75
87
  target: secondaryTarget,
88
+ primary: secondaryButtonPrimary,
76
89
  inverted: true,
77
90
  rel: "noreferrer"
78
- }, secondaryLinkText)));
91
+ }, /*#__PURE__*/React.createElement("span", null, secondaryLinkText))));
79
92
  };
80
93
  export default Text;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uncinc/uncinc-react-kitchen-sink",
3
- "version": "2.7.11",
3
+ "version": "2.7.12",
4
4
  "description": "Default React components that are easily extended.",
5
5
  "author": "uncinc",
6
6
  "license": "MIT",