@uncinc/uncinc-react-kitchen-sink 2.4.1 → 2.5.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 (48) hide show
  1. package/dist/components/AbbreviationAnnotation/stories.js +12 -8
  2. package/dist/components/Button/index.js +6 -1
  3. package/dist/components/Button/stories.js +20 -60
  4. package/dist/components/Button/stories.scss +7 -5
  5. package/dist/components/Cookie/stories.js +40 -8
  6. package/dist/components/Dialog/index.js +1 -1
  7. package/dist/components/Dialog/stories.js +7 -4
  8. package/dist/components/Form/DatePicker/index.js +1 -0
  9. package/dist/components/Form/Select/Input/index.js +1 -0
  10. package/dist/components/Form/Select/index.js +1 -0
  11. package/dist/components/Form/TextField/index.js +1 -0
  12. package/dist/components/Form/Textarea/index.js +1 -0
  13. package/dist/components/Layout/Container/stories.js +6 -17
  14. package/dist/components/Lottie/stories.js +18 -16
  15. package/dist/components/Pagination/index.js +2 -1
  16. package/dist/components/Pagination/stories.js +39 -33
  17. package/dist/components/SearchKit/stories.js +15 -13
  18. package/dist/helpers/date.js +14 -2
  19. package/dist/styles/assets/_base.scss +0 -3
  20. package/dist/styles/assets/_fonts.scss +17 -17
  21. package/dist/styles/assets/_icons.scss +2 -2
  22. package/package.json +1 -1
  23. package/dist/components/Webform/WebformActions/index.js +0 -25
  24. package/dist/components/Webform/WebformCheckbox/index.js +0 -51
  25. package/dist/components/Webform/WebformCheckboxes/index.js +0 -62
  26. package/dist/components/Webform/WebformContainer/index.js +0 -30
  27. package/dist/components/Webform/WebformDate/index.js +0 -159
  28. package/dist/components/Webform/WebformMapper/index.js +0 -145
  29. package/dist/components/Webform/WebformNumber/index.js +0 -48
  30. package/dist/components/Webform/WebformRadioButtons/index.js +0 -62
  31. package/dist/components/Webform/WebformSelect/index.js +0 -62
  32. package/dist/components/Webform/WebformTextField/index.js +0 -52
  33. package/dist/components/Webform/WebformTextarea/index.js +0 -51
  34. package/dist/components/Webform/WebformWizardPage/index.js +0 -96
  35. package/dist/components/Webform/index.js +0 -71
  36. package/dist/components/Webform/stories.actions.js +0 -39
  37. package/dist/components/Webform/stories.checkboxes.js +0 -45
  38. package/dist/components/Webform/stories.checked.js +0 -61
  39. package/dist/components/Webform/stories.container.js +0 -52
  40. package/dist/components/Webform/stories.date.js +0 -39
  41. package/dist/components/Webform/stories.filled.js +0 -61
  42. package/dist/components/Webform/stories.number.js +0 -40
  43. package/dist/components/Webform/stories.radiobuttons.js +0 -45
  44. package/dist/components/Webform/stories.select.js +0 -45
  45. package/dist/components/Webform/stories.textarea.js +0 -38
  46. package/dist/components/Webform/stories.textfield.js +0 -30
  47. package/dist/components/Webform/stories.wizard.js +0 -146
  48. package/dist/components/Webform/withStates.js +0 -93
@@ -1,93 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
- 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."); }
11
- 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; } }
12
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
14
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
- 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); }
16
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
17
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
18
- 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; }
19
- var determineVisibility = function determineVisibility(entity, values) {
20
- var visible = true;
21
- if (entity.hasIn(['#states', 'visible'])) {
22
- visible = entity.getIn(['#states', 'visible']).keySeq().every(function (component) {
23
- var condition = entity.getIn(['#states', 'visible', component]);
24
- var fieldName = component.match(/input\[name="(.+)"\]/)[1];
25
-
26
- // Determine the type of condition.
27
- if (condition.get('filled')) {
28
- if (values[fieldName]) {
29
- return true;
30
- }
31
- } else if (condition.get('empty')) {
32
- if (!values[fieldName]) {
33
- return true;
34
- }
35
- } else if (condition.get('value')) {
36
- var value = condition.get('value');
37
- // Check for subfield.
38
- var matches = _toConsumableArray(fieldName.matchAll(/(.*)\[(.*)\]/g));
39
- if (matches && matches.length > 0) {
40
- var _matches$ = _slicedToArray(matches[0], 2),
41
- field = _matches$[1];
42
- if (values[field]) {
43
- if (values[field].includes(value)) {
44
- return true;
45
- }
46
- }
47
- }
48
- if (values[fieldName] === value) {
49
- return true;
50
- }
51
- } else if (condition.get('checked')) {
52
- // Check for subfield.
53
- var _matches = _toConsumableArray(fieldName.matchAll(/(.*)\[(.*)\]/g));
54
- if (_matches && _matches.length > 0) {
55
- var _matches$2 = _slicedToArray(_matches[0], 3),
56
- _field = _matches$2[1],
57
- subField = _matches$2[2];
58
- if (values[_field]) {
59
- if (values[_field].includes(subField)) {
60
- return true;
61
- }
62
- }
63
- }
64
- if (values[fieldName] === true) {
65
- return true;
66
- }
67
- } else {
68
- console.log('Condition not yet supported:', condition);
69
- }
70
-
71
- // By default, states will make a field invisible.
72
- return false;
73
- });
74
- }
75
- return visible;
76
- };
77
- var withStates = function withStates(BaseComponent) {
78
- return function (props) {
79
- var entity = props.entity,
80
- values = props.values;
81
- var states = entity.get('#states');
82
- if (states) {
83
- var visible = entity.get('#visible', true);
84
- var visibility = determineVisibility(entity, values);
85
- if (!visible || !visibility) {
86
- return null;
87
- }
88
- }
89
- return /*#__PURE__*/_react.default.createElement(BaseComponent, props, props.children);
90
- };
91
- };
92
- var _default = withStates;
93
- exports.default = _default;