@uncinc/uncinc-react-kitchen-sink 2.8.52 → 2.10.0

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.
Files changed (34) hide show
  1. package/dist/components/ApiAutocomplete/index.js +41 -44
  2. package/dist/components/Button/index.d.ts +7 -1
  3. package/dist/components/Button/index.js +11 -3
  4. package/dist/components/Form/Checkbox/index.js +10 -2
  5. package/dist/components/Form/Checkboxes/index.js +20 -6
  6. package/dist/components/Form/DatePicker/index.js +9 -2
  7. package/dist/components/Form/DatePickerRange/Picker/index.js +4 -2
  8. package/dist/components/Form/DatePickerRange/index.js +8 -2
  9. package/dist/components/Form/DateSelect/index.js +8 -2
  10. package/dist/components/Form/GenericFormElement/index.js +11 -2
  11. package/dist/components/Form/GenericFormElement/style.scss +8 -0
  12. package/dist/components/Form/RadioButtons/index.js +19 -5
  13. package/dist/components/Form/Select/Input/index.js +9 -4
  14. package/dist/components/Form/Select/index.js +12 -3
  15. package/dist/components/Form/TextField/index.js +26 -4
  16. package/dist/components/Form/Textarea/index.js +9 -2
  17. package/dist/components/GoogleConsentCookieBanner/index.js +7 -4
  18. package/dist/components/GoogleConsentCookieBanner/types.d.ts +1 -0
  19. package/dist/components/Icon/style.scss +47 -0
  20. package/dist/components/Image/AdaptivePicture/index.js +25 -3
  21. package/dist/components/Image/AdaptivePicture/style.scss +1 -0
  22. package/dist/components/Image/helpers/index.js +1 -1
  23. package/dist/components/Share/CopyToClipboard/index.js +48 -11
  24. package/dist/components/Share/index.js +1 -2
  25. package/dist/components/Tag/style.scss +18 -3
  26. package/dist/components/WysiwygField/index.d.ts +9 -1
  27. package/dist/components/WysiwygField/index.js +15 -4
  28. package/dist/helpers/apiAutoComplete.d.ts +1 -0
  29. package/dist/helpers/apiAutoComplete.js +55 -0
  30. package/dist/helpers/utm.d.ts +16 -0
  31. package/dist/helpers/utm.js +47 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +3 -1
  34. package/package.json +3 -2
@@ -1,3 +1,7 @@
1
+ var _excluded = ["fieldName", "id", "validation", "defaultValue", "onChange", "options", "placeholder", "disabled", "className", "wrapperClassName", "isClearable", "isSearchable", "multiple", "size", "required"];
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; }
1
5
  import React from 'react';
2
6
  import SelectStyled from 'react-select';
3
7
  import c from 'classnames';
@@ -34,7 +38,8 @@ var SelectInput = function SelectInput(props) {
34
38
  _props$multiple = props.multiple,
35
39
  multiple = _props$multiple === void 0 ? false : _props$multiple,
36
40
  size = props.size,
37
- required = props.required;
41
+ required = props.required,
42
+ restProps = _objectWithoutProperties(props, _excluded);
38
43
  var selectedOption = props.selectedOption;
39
44
  var _useExtendedFormikCon = useExtendedFormikContext(),
40
45
  values = _useExtendedFormikCon.values,
@@ -64,7 +69,7 @@ var SelectInput = function SelectInput(props) {
64
69
  });
65
70
  } else {
66
71
  var _value2 = value !== undefined ? value : defaultValue || '';
67
- selectedOption = optionsTransformed.find(function (option) {
72
+ selectedOption = optionsTransformed.filter(function (option) {
68
73
  return option.value === _value2;
69
74
  });
70
75
  }
@@ -83,7 +88,7 @@ var SelectInput = function SelectInput(props) {
83
88
  value: value,
84
89
  validate: handleValidation
85
90
  }, function () {
86
- return /*#__PURE__*/React.createElement(SelectStyled, {
91
+ return /*#__PURE__*/React.createElement(SelectStyled, _extends({}, restProps, {
87
92
  id: id,
88
93
  inputId: fieldName,
89
94
  className: c('Select__select', className),
@@ -146,7 +151,7 @@ var SelectInput = function SelectInput(props) {
146
151
  primary75: 'hsla(0,0%,0%, 0)'
147
152
  }
148
153
  }
149
- });
154
+ }));
150
155
  });
151
156
  };
152
157
  export default SelectInput;
@@ -20,13 +20,16 @@ var Select = function Select(props) {
20
20
  isSearchable = _props$isSearchable === void 0 ? true : _props$isSearchable,
21
21
  _props$isClearable = props.isClearable,
22
22
  isClearable = _props$isClearable === void 0 ? true : _props$isClearable,
23
- validation = props.validation;
23
+ validation = props.validation,
24
+ includeFieldSet = props.includeFieldSet;
24
25
  var _useExtendedFormikCon = useExtendedFormikContext(),
25
26
  errors = _useExtendedFormikCon.errors,
26
27
  touched = _useExtendedFormikCon.touched,
27
28
  displayRequiredIndicator = _useExtendedFormikCon.displayRequiredIndicator;
28
29
  var error = errors[fieldName];
29
30
  var isTouched = touched[fieldName];
31
+ var errorId = "".concat(props.fieldName, "--error");
32
+ var descriptionId = "".concat(props.fieldName, "--description");
30
33
  return /*#__PURE__*/React.createElement(GenericFormElement, {
31
34
  className: c('Select', wrapperClassName),
32
35
  title: title,
@@ -35,7 +38,10 @@ var Select = function Select(props) {
35
38
  fieldName: fieldName,
36
39
  touched: isTouched,
37
40
  error: error,
38
- displayRequiredIndicator: displayRequiredIndicator
41
+ displayRequiredIndicator: displayRequiredIndicator,
42
+ errorId: errorId,
43
+ descriptionId: descriptionId,
44
+ includeFieldSet: includeFieldSet
39
45
  }, /*#__PURE__*/React.createElement(SelectInput, _extends({}, props, {
40
46
  fieldName: fieldName,
41
47
  className: c(className, {
@@ -45,8 +51,11 @@ var Select = function Select(props) {
45
51
  multiple: multiple,
46
52
  isSearchable: isSearchable,
47
53
  isClearable: isClearable,
54
+ isTouched: isTouched,
48
55
  required: required,
49
- validate: validation
56
+ validate: validation,
57
+ error: error,
58
+ errorId: errorId
50
59
  })));
51
60
  };
52
61
  export default Select;
@@ -48,9 +48,26 @@ export var TextField = function TextField(props) {
48
48
  errors = _useExtendedFormikCon.errors,
49
49
  touched = _useExtendedFormikCon.touched,
50
50
  displayRequiredIndicator = _useExtendedFormikCon.displayRequiredIndicator;
51
- var isTouched = touched[fieldName];
52
- var value = values[fieldName];
53
- var error = errors[fieldName];
51
+
52
+ // https://www.drupal.org/project/webform_rest/issues/3093890
53
+
54
+ // Some Webform Fields (e.g. webform_address, webform_name) consist of composite fields, which are objects.
55
+ // drupal/webform_rest does not handle that yet. Keys and values are stringified, like so: 'address][address'
56
+ //
57
+ // So for errorhandling on composite webform fields, we need some extra logic.
58
+
59
+ var nestedFieldname = fieldName.split('][');
60
+ var isTouched;
61
+ if (Object.keys(touched).length && touched[nestedFieldname[0]]) {
62
+ isTouched = nestedFieldname[1] ? touched[nestedFieldname[0]][nestedFieldname[1]] : touched[fieldName];
63
+ }
64
+ var error;
65
+ if (Object.keys(errors).length && errors[nestedFieldname[0]]) {
66
+ error = nestedFieldname[1] ? errors[nestedFieldname[0]][nestedFieldname[1]] : errors[fieldName];
67
+ }
68
+ var value = nestedFieldname[1] ? values[nestedFieldname[0]][nestedFieldname[1]] : values[fieldName];
69
+ var errorId = "".concat(props.fieldName, "--error");
70
+ var descriptionId = "".concat(props.fieldName, "--description");
54
71
  return /*#__PURE__*/React.createElement(GenericFormElement, {
55
72
  className: c('TextField', wrapperClassName),
56
73
  title: title,
@@ -59,6 +76,8 @@ export var TextField = function TextField(props) {
59
76
  fieldName: fieldName,
60
77
  touched: isTouched,
61
78
  error: error,
79
+ errorId: errorId,
80
+ descriptionId: descriptionId,
62
81
  displayRequiredIndicator: displayRequiredIndicator
63
82
  }, /*#__PURE__*/React.createElement(Field, _extends({}, restProps, {
64
83
  className: c(className, {
@@ -71,7 +90,10 @@ export var TextField = function TextField(props) {
71
90
  placeholder: placeholder,
72
91
  validate: handleValidation,
73
92
  onKeyUp: handleChange,
74
- disabled: disabled
93
+ disabled: disabled,
94
+ required: required,
95
+ "aria-describedby": "".concat(errorId, " ").concat(descriptionId),
96
+ "aria-invalid": Boolean(error && isTouched)
75
97
  })));
76
98
  };
77
99
  export default withMapping(TextField);
@@ -33,6 +33,8 @@ var Textarea = function Textarea(props) {
33
33
  var isTouched = touched[fieldName];
34
34
  var value = values[fieldName];
35
35
  var error = errors[fieldName];
36
+ var errorId = "".concat(props.fieldName, "--error");
37
+ var descriptionId = "".concat(props.fieldName, "--description");
36
38
  var handleValidation = function handleValidation(value) {
37
39
  if (validation) {
38
40
  return validation(value);
@@ -49,7 +51,9 @@ var Textarea = function Textarea(props) {
49
51
  fieldName: fieldName,
50
52
  touched: isTouched,
51
53
  error: error,
52
- displayRequiredIndicator: displayRequiredIndicator
54
+ displayRequiredIndicator: displayRequiredIndicator,
55
+ errorId: errorId,
56
+ descriptionId: descriptionId
53
57
  }, /*#__PURE__*/React.createElement(Field, _extends({}, restProps, {
54
58
  className: c(className, {
55
59
  'error': error && isTouched
@@ -58,6 +62,7 @@ var Textarea = function Textarea(props) {
58
62
  name: fieldName,
59
63
  component: "textarea",
60
64
  value: value,
65
+ required: required,
61
66
  placeholder: placeholder,
62
67
  rows: rows,
63
68
  validate: handleValidation,
@@ -66,7 +71,9 @@ var Textarea = function Textarea(props) {
66
71
  if (onChange) {
67
72
  onChange(event);
68
73
  }
69
- }
74
+ },
75
+ "aria-describedby": "".concat(errorId, " ").concat(descriptionId),
76
+ "aria-invalid": Boolean(error && isTouched)
70
77
  })));
71
78
  };
72
79
  export default Textarea;
@@ -95,13 +95,16 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
95
95
  _props$manualHeader = props.manualHeader,
96
96
  manualHeader = _props$manualHeader === void 0 ? '' : _props$manualHeader,
97
97
  _props$manualButtonCl = props.manualButtonClassname,
98
- manualButtonClassname = _props$manualButtonCl === void 0 ? 'Button' : _props$manualButtonCl;
98
+ manualButtonClassname = _props$manualButtonCl === void 0 ? 'Button' : _props$manualButtonCl,
99
+ _props$necessaryButto = props.necessaryButtonInverted,
100
+ necessaryButtonInverted = _props$necessaryButto === void 0 ? true : _props$necessaryButto;
99
101
  if (!window.dataLayer) {
100
102
  window.dataLayer = window.dataLayer || [];
101
103
  }
102
104
  if (!window.gtag) {
105
+ // eslint-disable-next-line prefer-rest-params
103
106
  window.gtag = function () {
104
- window.dataLayer.push(arguments.length <= 0 ? undefined : arguments[0]);
107
+ window.dataLayer.push(arguments);
105
108
  };
106
109
  }
107
110
 
@@ -309,7 +312,7 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
309
312
  }, acceptAllText), showAcceptOnlyNeeded && /*#__PURE__*/React.createElement(Button, {
310
313
  id: "only-necessary-agree",
311
314
  className: "Button--cta",
312
- inverted: true,
315
+ inverted: necessaryButtonInverted,
313
316
  onClick: onConsent(true)
314
317
  }, onlyNecessaryText), /*#__PURE__*/React.createElement("button", {
315
318
  type: "button",
@@ -331,7 +334,7 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
331
334
  onClick: onConsent(false)
332
335
  }, acceptSelectionText), /*#__PURE__*/React.createElement(Button, {
333
336
  className: "Button--cta",
334
- inverted: true,
337
+ inverted: necessaryButtonInverted,
335
338
  onClick: onConsentAll
336
339
  }, acceptAllText))))));
337
340
  };
@@ -59,6 +59,7 @@ export interface CookieCompliancePopupProps {
59
59
  onAgree?: Function;
60
60
  showAcceptOnlyNeeded?: boolean;
61
61
  manualButtonClassname?: string;
62
+ necessaryButtonInverted?: boolean;
62
63
  cookieLevels?: Array<CookieLevel>;
63
64
  defaultValues?: CategoryDefaultValues;
64
65
  cookieDomain?: string;
@@ -98,3 +98,50 @@ $material-icon-styles: (
98
98
  width: 1em;
99
99
  @include icon-color(#000000);
100
100
  }
101
+
102
+
103
+ /// gridIconToMaterialIcon
104
+ ///
105
+ /// Mixin to overwrite old icon-implementations.
106
+ ///
107
+ /// @param {String} $icon-name - name of the icon.
108
+ /// Needs to correspond with the file name of the icon.
109
+ ///
110
+ /// @param {String} $style - Material Icon style
111
+ ///
112
+ /// @param {Boolean} $custom - Are we overwwriting with a
113
+ /// custom icon?
114
+ ///
115
+ /// @example scss
116
+ /// .icon-arrow {
117
+ /// @include gridIconToMaterialIcon('download');
118
+ /// }
119
+ ///
120
+ /// @example scss
121
+ /// .icon-download {
122
+ /// @include gridIconToMaterialIcon($icon-name: 'custom_download', $custom: true);
123
+ /// }
124
+ ///
125
+ @mixin gridIconToMaterialIcon(
126
+ $icon-name: null,
127
+ $style: 'outlined',
128
+ $custom: false,
129
+ ) {
130
+ @if not $icon-name {
131
+ @error 'an icon name is required'
132
+ }
133
+
134
+ @if not $custom {
135
+ background: url('~@material-design-icons/svg/#{$style}/#{$icon-name}.svg');
136
+ } @else {
137
+ background: url('#{$custom-icon-path}/#{$icon-name}.svg');
138
+ }
139
+
140
+ display: block;
141
+ width: 1em;
142
+ height: 1em;
143
+ background-color: transparent;
144
+ background-repeat: no-repeat;
145
+ background-position: 0 0;
146
+ background-size: 1em;
147
+ }
@@ -6,8 +6,9 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import React from 'react';
8
8
  import c from 'classnames';
9
- import './style.scss';
9
+ import urlParse from 'url';
10
10
  import { isValidImage, useImageLoader, calculateTargetSrc } from '../helpers';
11
+ import './style.scss';
11
12
 
12
13
  // extend html img props
13
14
 
@@ -44,19 +45,30 @@ var AdaptivePicture = function AdaptivePicture(_ref) {
44
45
  if (!container) return;
45
46
  var resizeObserver = new ResizeObserver(function (entries) {
46
47
  var widthAfterResize = entries[0].contentRect.width;
48
+ var newSrcRequired = false;
47
49
  if (image.width < widthAfterResize) {
48
50
  var newTargetSrc = calculateTargetSrc(image.width, validatedSources, fallbackImage);
49
51
  if (targetSrc !== newTargetSrc) {
50
52
  setTargetSrc(newTargetSrc);
53
+ newSrcRequired = true;
51
54
  }
52
55
  } else {
53
56
  var _newTargetSrc = calculateTargetSrc(widthAfterResize, validatedSources, fallbackImage);
54
57
  if (targetSrc !== _newTargetSrc) {
55
58
  setTargetSrc(_newTargetSrc);
59
+ newSrcRequired = true;
56
60
  }
57
61
  }
58
62
  if (status === 'PENDING') {
59
63
  setStatus('INITIAL_BREAKPOINT_CALCULATED');
64
+
65
+ // We always load the smallest source. If that's also the source we need
66
+ // set INITIAL_LOADED directly.
67
+ // With caching turned on, the onLoad function on the img would only trigger once
68
+ // and thus never unblur the smallest
69
+ if (!newSrcRequired) {
70
+ setStatus('INITIAL_LOADED');
71
+ }
60
72
  }
61
73
  });
62
74
  resizeObserver.observe(container);
@@ -68,7 +80,13 @@ var AdaptivePicture = function AdaptivePicture(_ref) {
68
80
  }, [fallbackImage, status, targetSrc, validatedSources]);
69
81
  var loadedUrl = useImageLoader(fallbackImage, targetSrc, imageRef);
70
82
  function onErrorFallback(e) {
71
- if (e.target.src !== fallbackImage) {
83
+ // Make sure that both URLs are absolute URLs, so we can compare them.
84
+ // Otherwise this error callback will constantly be thrown.
85
+ var link = document.createElement('a');
86
+ link.href = e.target.src;
87
+ var link2 = document.createElement('a');
88
+ link2.href = fallbackImage;
89
+ if (link.href !== link2.href) {
72
90
  e.target.src = fallbackImage;
73
91
  }
74
92
  }
@@ -86,7 +104,11 @@ var AdaptivePicture = function AdaptivePicture(_ref) {
86
104
  if (_onLoad) {
87
105
  _onLoad(e);
88
106
  }
89
- if (status === 'INITIAL_BREAKPOINT_CALCULATED' && e.target.src === targetSrc) {
107
+
108
+ // To handle relative URLs
109
+ var current = urlParse.parse(e.target.src);
110
+ var target = urlParse.parse(targetSrc);
111
+ if (status === 'INITIAL_BREAKPOINT_CALCULATED' && current.pathname === target.pathname) {
90
112
  setStatus('INITIAL_LOADED');
91
113
  }
92
114
  },
@@ -1,4 +1,5 @@
1
1
  .AdaptivePicture {
2
+ display: block;
2
3
  width: 100%;
3
4
  }
4
5
 
@@ -6,7 +6,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import path from 'path';
8
8
  import { useEffect, useState } from 'react';
9
- var breakpoints = [0, 256, 512, 1024, 2048];
9
+ var breakpoints = [256, 512, 1024, 2048];
10
10
  var mimeTypes = {
11
11
  '.gif': 'image/gif',
12
12
  '.png': 'image/png',
@@ -1,15 +1,56 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
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."); }
7
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); }
8
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; }
9
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; } }
10
8
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import React, { useState } from 'react';
9
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
10
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
11
+ import React, { useEffect, useState } from 'react';
12
12
  import PropTypes from 'prop-types';
13
+ function testCopyPermission() {
14
+ return _testCopyPermission.apply(this, arguments);
15
+ }
16
+ function _testCopyPermission() {
17
+ _testCopyPermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
18
+ var _navigator;
19
+ var result;
20
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
21
+ while (1) switch (_context2.prev = _context2.next) {
22
+ case 0:
23
+ if (!(typeof ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.permissions) !== 'undefined')) {
24
+ _context2.next = 13;
25
+ break;
26
+ }
27
+ _context2.prev = 1;
28
+ _context2.next = 4;
29
+ return navigator.permissions.query({
30
+ name: 'clipboard-write'
31
+ });
32
+ case 4:
33
+ result = _context2.sent;
34
+ return _context2.abrupt("return", (result === null || result === void 0 ? void 0 : result.state) && ['granted', 'prompt'].includes(result.state));
35
+ case 8:
36
+ _context2.prev = 8;
37
+ _context2.t0 = _context2["catch"](1);
38
+ console.warn('Copy to clipboard not supported: ', _context2.t0);
39
+ case 11:
40
+ _context2.next = 14;
41
+ break;
42
+ case 13:
43
+ console.warn('Navigator or Permissions API is undefined.');
44
+ case 14:
45
+ return _context2.abrupt("return", false);
46
+ case 15:
47
+ case "end":
48
+ return _context2.stop();
49
+ }
50
+ }, _callee2, null, [[1, 8]]);
51
+ }));
52
+ return _testCopyPermission.apply(this, arguments);
53
+ }
13
54
  var CopyToClipboard = function CopyToClipboard(_ref) {
14
55
  var text = _ref.text,
15
56
  copyResetTimeout = _ref.copyResetTimeout,
@@ -26,14 +67,10 @@ var CopyToClipboard = function CopyToClipboard(_ref) {
26
67
  setCopyPermission = _useState4[1];
27
68
 
28
69
  // Only render the element if permission is granted
29
- navigator.permissions.query({
30
- name: 'clipboard-write'
31
- }).then(function (result) {
32
- if (result.state === 'granted' || result.state === 'prompt') {
33
- setCopyPermission(true);
34
- }
35
- }).catch(function (err) {
36
- return console.log('Copy to clipboard not supported: ', err);
70
+ useEffect(function () {
71
+ testCopyPermission().then(function (result) {
72
+ setCopyPermission(result);
73
+ });
37
74
  });
38
75
  var copyContent = /*#__PURE__*/function () {
39
76
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -63,8 +63,7 @@ var Share = function Share(_ref2) {
63
63
  }, /*#__PURE__*/React.createElement("div", {
64
64
  className: "Share__wrapper"
65
65
  }, /*#__PURE__*/React.createElement("div", {
66
- className: "Share__title",
67
- tabIndex: "0"
66
+ className: "Share__title"
68
67
  }, title), /*#__PURE__*/React.createElement("div", {
69
68
  className: "Share__buttons"
70
69
  }, buttons)));
@@ -6,16 +6,31 @@
6
6
  flex-wrap: nowrap;
7
7
  align-items: center;
8
8
 
9
+ &__link,
10
+ &__link:hover,
11
+ &__link:active,
12
+ &__link:focus {
13
+ text-decoration: inherit;
14
+ color: inherit;
15
+ }
16
+
17
+ &__button,
18
+ &__delete-button {
19
+ padding: 0;
20
+ border: 0;
21
+ background-color: transparent;
22
+ cursor: pointer;
23
+ }
24
+
9
25
  &__delete-button {
10
26
  // Expanding the clickable area by adding padding,
11
27
  // and compensating this, using negative margin.
12
28
  margin: -10px;
13
- border: 0;
14
29
  padding: 10px;
15
- background-color: transparent;
16
- cursor: pointer;
17
30
  }
18
31
 
32
+ &--stretch-clickable-area .Tag__link,
33
+ &--stretch-clickable-area .Tag__button,
19
34
  &--stretch-clickable-area .Tag__delete-button {
20
35
  margin: 0;
21
36
  padding: 0;
@@ -1,17 +1,25 @@
1
1
  export default WysiwygField;
2
- declare function WysiwygField({ html, customElementHandler, ...props }: {
2
+ declare function WysiwygField({ html, id, customElementHandler, className, ...props }: {
3
3
  [x: string]: any;
4
4
  html: any;
5
+ id?: string | undefined;
5
6
  customElementHandler?: (() => void) | undefined;
7
+ className?: string | undefined;
6
8
  }): React.JSX.Element;
7
9
  declare namespace WysiwygField {
8
10
  namespace propTypes {
9
11
  let html: PropTypes.Validator<string>;
10
12
  let customElementHandler: PropTypes.Requireable<(...args: any[]) => any>;
13
+ let className: PropTypes.Requireable<string>;
14
+ let id: PropTypes.Requireable<string>;
11
15
  }
12
16
  namespace defaultProps {
13
17
  export function customElementHandler_1(): void;
14
18
  export { customElementHandler_1 as customElementHandler };
19
+ let className_1: string;
20
+ export { className_1 as className };
21
+ let id_1: string;
22
+ export { id_1 as id };
15
23
  }
16
24
  }
17
25
  import React from 'react';
@@ -1,16 +1,22 @@
1
- var _excluded = ["html", "customElementHandler"];
1
+ var _excluded = ["html", "id", "customElementHandler", "className"];
2
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
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
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; }
5
5
  import React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import ReactHtmlParser from 'react-html-parser';
8
+ import c from 'classnames';
8
9
  import Button from '../Button';
9
10
  var WysiwygField = function WysiwygField(_ref) {
10
11
  var html = _ref.html,
12
+ _ref$id = _ref.id,
13
+ id = _ref$id === void 0 ? '' : _ref$id,
11
14
  _ref$customElementHan = _ref.customElementHandler,
12
15
  customElementHandler = _ref$customElementHan === void 0 ? function () {} : _ref$customElementHan,
16
+ _ref$className = _ref.className,
17
+ className = _ref$className === void 0 ? '' : _ref$className,
13
18
  props = _objectWithoutProperties(_ref, _excluded);
19
+ var classes = c('WysiwygField', className);
14
20
  var parsedHtml = ReactHtmlParser(html, {
15
21
  transform: function transform(node) {
16
22
  var customHandler = customElementHandler(node);
@@ -42,14 +48,19 @@ var WysiwygField = function WysiwygField(_ref) {
42
48
  }
43
49
  });
44
50
  return /*#__PURE__*/React.createElement("div", _extends({
45
- className: "WysiwygField"
51
+ id: id,
52
+ className: classes
46
53
  }, props), parsedHtml);
47
54
  };
48
55
  WysiwygField.propTypes = {
49
56
  html: PropTypes.string.isRequired,
50
- customElementHandler: PropTypes.func
57
+ customElementHandler: PropTypes.func,
58
+ className: PropTypes.string,
59
+ id: PropTypes.string
51
60
  };
52
61
  WysiwygField.defaultProps = {
53
- customElementHandler: function customElementHandler() {}
62
+ customElementHandler: function customElementHandler() {},
63
+ className: '',
64
+ id: ''
54
65
  };
55
66
  export default WysiwygField;
@@ -0,0 +1 @@
1
+ export function getApiAutoCompleteSuggestions(endpoint: any, queryParameter: any, query: any, requestOptions: any, currentFetch: any): Promise<any>;