@uncinc/uncinc-react-kitchen-sink 2.4.0 → 2.4.2
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.
- package/dist/Context/KitchenSinkComponentMapperContext.js +11 -3
- package/dist/Context/ViewportContext.js +27 -14
- package/dist/Context/withMapping.js +26 -15
- package/dist/components/AbbreviationAnnotation/index.js +49 -27
- package/dist/components/AbbreviationAnnotation/stories.js +37 -22
- package/dist/components/Accordion/AccordionItem/index.js +55 -36
- package/dist/components/Accordion/AccordionItemVariant/index.js +47 -25
- package/dist/components/Accordion/index.js +17 -10
- package/dist/components/Accordion/stories.js +38 -24
- package/dist/components/ApiAutocomplete/index.js +79 -51
- package/dist/components/ApiAutocomplete/stories.js +18 -9
- package/dist/components/Button/index.js +48 -33
- package/dist/components/Button/stories.js +31 -49
- package/dist/components/Button/stories.scss +7 -5
- package/dist/components/Cookie/Checkbox/index.js +23 -16
- package/dist/components/Cookie/index.js +146 -115
- package/dist/components/Cookie/stories.js +90 -40
- package/dist/components/Dialog/index.d.ts +38 -0
- package/dist/components/Dialog/index.js +63 -56
- package/dist/components/Dialog/stories.js +35 -18
- package/dist/components/FontSizeSwitcher/index.js +58 -32
- package/dist/components/FontSizeSwitcher/stories.js +23 -9
- package/dist/components/Form/Checkbox/index.js +43 -37
- package/dist/components/Form/Checkbox/stories.js +20 -11
- package/dist/components/Form/Checkboxes/index.js +62 -57
- package/dist/components/Form/Checkboxes/index.test.js +113 -62
- package/dist/components/Form/Checkboxes/stories.js +23 -12
- package/dist/components/Form/Date/index.js +13 -5
- package/dist/components/Form/Date/stories.js +18 -9
- package/dist/components/Form/DatePicker/index.js +40 -33
- package/dist/components/Form/DatePicker/stories.js +18 -9
- package/dist/components/Form/DateSelect/index.js +99 -62
- package/dist/components/Form/DateSelect/stories.js +32 -11
- package/dist/components/Form/Email/index.js +13 -5
- package/dist/components/Form/Email/stories.js +18 -9
- package/dist/components/Form/FormikWrapper/index.js +52 -45
- package/dist/components/Form/GenericFormElement/index.js +39 -34
- package/dist/components/Form/Number/index.js +23 -18
- package/dist/components/Form/Number/stories.js +18 -9
- package/dist/components/Form/RadioButtons/index.js +53 -49
- package/dist/components/Form/RadioButtons/index.test.js +106 -57
- package/dist/components/Form/RadioButtons/stories.js +23 -12
- package/dist/components/Form/SearchField/index.js +37 -30
- package/dist/components/Form/Select/Input/index.js +56 -49
- package/dist/components/Form/Select/index.js +33 -24
- package/dist/components/Form/Select/stories.js +25 -15
- package/dist/components/Form/TextField/index.js +39 -33
- package/dist/components/Form/TextField/index.test.js +104 -56
- package/dist/components/Form/TextField/stories.js +22 -11
- package/dist/components/Form/Textarea/index.js +35 -27
- package/dist/components/Form/Textarea/stories.js +18 -9
- package/dist/components/Hamburger/index.js +30 -19
- package/dist/components/Hamburger/stories.js +42 -16
- package/dist/components/Header/index.js +67 -39
- package/dist/components/Header/stories.js +48 -28
- package/dist/components/Image/Background/index.js +36 -21
- package/dist/components/Image/LazyLoadWrapper/index.js +101 -64
- package/dist/components/Image/Picture/index.js +83 -65
- package/dist/components/Image/index.js +21 -15
- package/dist/components/Image/stories.js +87 -64
- package/dist/components/InlineMenu/index.js +60 -38
- package/dist/components/InlineMenu/stories.js +66 -55
- package/dist/components/Layout/Container/index.js +29 -21
- package/dist/components/Layout/Container/stories.js +94 -84
- package/dist/components/Layout/QuickLayout/Auto/index.js +19 -12
- package/dist/components/Layout/QuickLayout/Center/index.js +17 -10
- package/dist/components/Layout/QuickLayout/Clamp/index.js +20 -13
- package/dist/components/Layout/QuickLayout/Sidebar/index.js +20 -13
- package/dist/components/Layout/QuickLayout/SpaceBetween/index.js +20 -13
- package/dist/components/Layout/QuickLayout/Stack/index.js +21 -11
- package/dist/components/Layout/QuickLayout/Wrap/index.js +21 -14
- package/dist/components/Layout/QuickLayout/index.js +31 -21
- package/dist/components/Layout/QuickLayout/stories.js +102 -70
- package/dist/components/Lottie/LottieAnimation/index.js +55 -56
- package/dist/components/Lottie/LottieAnimationWithMousePosition.js +31 -18
- package/dist/components/Lottie/index.js +47 -35
- package/dist/components/Lottie/stories.js +56 -31
- package/dist/components/MagicLine/index.js +50 -27
- package/dist/components/MagicLine/stories.js +60 -46
- package/dist/components/NavigationScroll/index.js +71 -49
- package/dist/components/NavigationScroll/stories.js +19 -8
- package/dist/components/Pagination/index.js +49 -41
- package/dist/components/Pagination/stories.js +46 -17
- package/dist/components/SearchKit/Facets/ChipFacet/index.js +24 -16
- package/dist/components/SearchKit/Facets/ListFacet/index.js +23 -15
- package/dist/components/SearchKit/Facets/SelectFacet/index.js +39 -30
- package/dist/components/SearchKit/Query/index.js +41 -23
- package/dist/components/SearchKit/SearchFacets/index.js +36 -23
- package/dist/components/SearchKit/SearchField/index.js +49 -25
- package/dist/components/SearchKit/SearchLoadMore/index.js +22 -15
- package/dist/components/SearchKit/SearchPage/index.js +22 -14
- package/dist/components/SearchKit/SearchPagination/index.js +17 -10
- package/dist/components/SearchKit/SearchReset/index.js +25 -16
- package/dist/components/SearchKit/SearchResults/index.js +108 -59
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/CustomValue/index.js +17 -10
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/DateRange/index.js +18 -11
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/NumericRange/index.js +18 -11
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/Value/index.js +22 -12
- package/dist/components/SearchKit/SearchSelectedFilters/index.js +34 -28
- package/dist/components/SearchKit/SearchSorting/index.js +29 -19
- package/dist/components/SearchKit/index.js +72 -53
- package/dist/components/SearchKit/stories.js +144 -187
- package/dist/components/Share/index.js +48 -40
- package/dist/components/Share/stories.js +16 -5
- package/dist/components/Sliders/SliderRelated/index.js +32 -25
- package/dist/components/Sliders/SliderRelated/stories.js +75 -57
- package/dist/components/Webform/WebformActions/index.js +19 -13
- package/dist/components/Webform/WebformCheckbox/index.js +32 -24
- package/dist/components/Webform/WebformCheckboxes/index.js +37 -29
- package/dist/components/Webform/WebformContainer/index.js +17 -11
- package/dist/components/Webform/WebformDate/index.js +76 -48
- package/dist/components/Webform/WebformMapper/index.js +53 -38
- package/dist/components/Webform/WebformNumber/index.js +31 -22
- package/dist/components/Webform/WebformRadioButtons/index.js +37 -29
- package/dist/components/Webform/WebformSelect/index.js +37 -29
- package/dist/components/Webform/WebformTextField/index.js +34 -26
- package/dist/components/Webform/WebformTextarea/index.js +32 -24
- package/dist/components/Webform/WebformWizardPage/index.js +56 -43
- package/dist/components/Webform/index.js +42 -20
- package/dist/components/Webform/stories.actions.js +19 -8
- package/dist/components/Webform/stories.checkboxes.js +19 -8
- package/dist/components/Webform/stories.checked.js +20 -9
- package/dist/components/Webform/stories.container.js +19 -8
- package/dist/components/Webform/stories.date.js +19 -8
- package/dist/components/Webform/stories.filled.js +20 -9
- package/dist/components/Webform/stories.number.js +19 -8
- package/dist/components/Webform/stories.radiobuttons.js +19 -8
- package/dist/components/Webform/stories.select.js +19 -8
- package/dist/components/Webform/stories.textarea.js +19 -8
- package/dist/components/Webform/stories.textfield.js +19 -8
- package/dist/components/Webform/stories.wizard.js +19 -8
- package/dist/components/Webform/withStates.js +49 -28
- package/dist/components/WysiwygField/index.js +30 -20
- package/dist/components/WysiwygField/stories.js +39 -29
- package/dist/components/index.js +111 -15
- package/dist/config/constants.js +38 -18
- package/dist/config/i18next/index.js +19 -11
- package/dist/helpers/date.js +25 -5
- package/dist/helpers/gtm.js +27 -17
- package/dist/helpers/link.js +15 -6
- package/dist/helpers/useValueForCurrentViewPort.js +27 -10
- package/dist/hooks/useBoolean.d.ts +8 -0
- package/dist/hooks/useBoolean.js +38 -0
- package/dist/hooks/useClickOutside.d.ts +8 -0
- package/dist/hooks/useClickOutside.js +35 -0
- package/dist/hooks/useDialog.d.ts +10 -0
- package/dist/hooks/useDialog.js +39 -0
- package/dist/hooks/useDialogHelpers.d.ts +20 -0
- package/dist/hooks/{useDialogHelpers.ts → useDialogHelpers.js} +33 -43
- package/dist/hooks/useEscape.d.ts +6 -0
- package/dist/hooks/useEscape.js +24 -0
- package/dist/hooks/useOnScreen.js +27 -6
- package/dist/hooks/usePrevious.js +10 -4
- package/dist/hooks/useScrollPosition.js +25 -7
- package/dist/hooks/useTrapFocus.d.ts +10 -0
- package/dist/hooks/useTrapFocus.js +63 -0
- package/dist/hooks/useWindowDimensions.js +27 -11
- package/dist/index.js +398 -56
- package/dist/setupTests.js +9 -5
- package/dist/styles/assets/_base.scss +0 -3
- package/dist/styles/assets/_fonts.scss +17 -17
- package/dist/styles/assets/_icons.scss +2 -2
- package/package.json +6 -3
- package/dist/hooks/useBoolean.ts +0 -20
- package/dist/hooks/useClickOutside.ts +0 -38
- package/dist/hooks/useDialog.ts +0 -29
- package/dist/hooks/useEscape.ts +0 -26
- package/dist/hooks/useTrapFocus.ts +0 -80
|
@@ -1,91 +1,119 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactAutosuggest = _interopRequireDefault(require("react-autosuggest"));
|
|
9
|
+
require("./style.scss");
|
|
10
|
+
var _excluded = ["endpoint", "placeholder", "renderItem", "defaultValue", "onSelectItem", "queryParameter", "getSuggestionValue", "requestOptions"];
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
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); }
|
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
+
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."); }
|
|
17
|
+
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); }
|
|
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
|
+
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; } }
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
27
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
28
|
function abortableFetch(request, opts) {
|
|
5
|
-
|
|
6
|
-
|
|
29
|
+
var controller = new AbortController();
|
|
30
|
+
var signal = controller.signal;
|
|
7
31
|
return {
|
|
8
|
-
abort:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
32
|
+
abort: function abort() {
|
|
33
|
+
return controller.abort();
|
|
34
|
+
},
|
|
35
|
+
ready: fetch(request, _objectSpread(_objectSpread({}, opts), {}, {
|
|
36
|
+
signal: signal
|
|
37
|
+
}))
|
|
13
38
|
};
|
|
14
39
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
endpoint,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
var currentFetch = null;
|
|
41
|
+
var ApiAutocomplete = function ApiAutocomplete(_ref) {
|
|
42
|
+
var endpoint = _ref.endpoint,
|
|
43
|
+
placeholder = _ref.placeholder,
|
|
44
|
+
renderItem = _ref.renderItem,
|
|
45
|
+
defaultValue = _ref.defaultValue,
|
|
46
|
+
onSelectItem = _ref.onSelectItem,
|
|
47
|
+
_ref$queryParameter = _ref.queryParameter,
|
|
48
|
+
queryParameter = _ref$queryParameter === void 0 ? 'q' : _ref$queryParameter,
|
|
49
|
+
getSuggestionValue = _ref.getSuggestionValue,
|
|
50
|
+
requestOptions = _ref.requestOptions,
|
|
51
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
52
|
+
var _useState = (0, _react.useState)(defaultValue || ''),
|
|
53
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
54
|
+
queryInput = _useState2[0],
|
|
55
|
+
setQuery = _useState2[1];
|
|
56
|
+
var _useState3 = (0, _react.useState)([]),
|
|
57
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
58
|
+
results = _useState4[0],
|
|
59
|
+
setResults = _useState4[1];
|
|
60
|
+
var getSuggestions = function getSuggestions(query) {
|
|
61
|
+
var url = "".concat(endpoint, "?").concat(queryParameter, "=").concat(query);
|
|
31
62
|
if (currentFetch) {
|
|
32
63
|
currentFetch.abort();
|
|
33
64
|
}
|
|
34
65
|
currentFetch = abortableFetch(url, requestOptions);
|
|
35
|
-
currentFetch.ready.then(response
|
|
66
|
+
currentFetch.ready.then(function (response) {
|
|
36
67
|
return response.json();
|
|
37
|
-
}).then(response
|
|
38
|
-
|
|
68
|
+
}).then(function (response) {
|
|
69
|
+
var ajaxResults = response.map(function (item, index) {
|
|
39
70
|
item.value = index;
|
|
40
71
|
return item;
|
|
41
72
|
});
|
|
42
73
|
setResults(ajaxResults);
|
|
43
|
-
}).catch(e
|
|
74
|
+
}).catch(function (e) {
|
|
44
75
|
// Catch the error so the browser does not output errors.
|
|
45
76
|
});
|
|
46
77
|
};
|
|
47
|
-
return /*#__PURE__*/
|
|
78
|
+
return /*#__PURE__*/_react.default.createElement(_reactAutosuggest.default, {
|
|
48
79
|
suggestions: results,
|
|
49
|
-
onSuggestionsFetchRequested: ({
|
|
50
|
-
value,
|
|
51
|
-
|
|
52
|
-
}) => {
|
|
80
|
+
onSuggestionsFetchRequested: function onSuggestionsFetchRequested(_ref2) {
|
|
81
|
+
var value = _ref2.value,
|
|
82
|
+
reason = _ref2.reason;
|
|
53
83
|
getSuggestions(value);
|
|
54
84
|
},
|
|
55
|
-
onSuggestionsClearRequested: ()
|
|
85
|
+
onSuggestionsClearRequested: function onSuggestionsClearRequested() {
|
|
56
86
|
setResults([]);
|
|
57
87
|
},
|
|
58
88
|
getSuggestionValue: getSuggestionValue,
|
|
59
|
-
renderSuggestion: (item, attributes)
|
|
89
|
+
renderSuggestion: function renderSuggestion(item, attributes) {
|
|
60
90
|
return renderItem(item, attributes.isHighlighted);
|
|
61
91
|
},
|
|
62
|
-
onSuggestionSelected: (event, {
|
|
63
|
-
suggestion
|
|
64
|
-
}) => {
|
|
92
|
+
onSuggestionSelected: function onSuggestionSelected(event, _ref3) {
|
|
93
|
+
var suggestion = _ref3.suggestion;
|
|
65
94
|
onSelectItem(suggestion);
|
|
66
95
|
},
|
|
67
|
-
inputProps: {
|
|
68
|
-
|
|
69
|
-
placeholder,
|
|
96
|
+
inputProps: _objectSpread(_objectSpread({}, props), {}, {
|
|
97
|
+
placeholder: placeholder,
|
|
70
98
|
value: queryInput,
|
|
71
|
-
onBlur: event
|
|
72
|
-
|
|
99
|
+
onBlur: function onBlur(event) {
|
|
100
|
+
var value = event.target.value;
|
|
73
101
|
if (!value || value.length === 0) {
|
|
74
102
|
onSelectItem('');
|
|
75
103
|
}
|
|
76
104
|
},
|
|
77
|
-
onChange: (event, {
|
|
78
|
-
newValue
|
|
79
|
-
}) => {
|
|
105
|
+
onChange: function onChange(event, _ref4) {
|
|
106
|
+
var newValue = _ref4.newValue;
|
|
80
107
|
setQuery(newValue);
|
|
81
108
|
}
|
|
82
|
-
}
|
|
109
|
+
})
|
|
83
110
|
});
|
|
84
111
|
};
|
|
85
112
|
ApiAutocomplete.defaultProps = {
|
|
86
|
-
getSuggestionValue: item
|
|
113
|
+
getSuggestionValue: function getSuggestionValue(item) {
|
|
87
114
|
return item.name;
|
|
88
115
|
},
|
|
89
116
|
requestOptions: {}
|
|
90
117
|
};
|
|
91
|
-
|
|
118
|
+
var _default = ApiAutocomplete;
|
|
119
|
+
exports.default = _default;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _ = _interopRequireDefault(require("."));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
var _default = {
|
|
4
11
|
title: 'Organisms/Autocomplete'
|
|
5
12
|
};
|
|
6
|
-
|
|
7
|
-
|
|
13
|
+
exports.default = _default;
|
|
14
|
+
var Default = function Default() {
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
8
16
|
endpoint: "http://nldoet.devinc.eu/autocomplete/json",
|
|
9
|
-
renderItem: item
|
|
17
|
+
renderItem: function renderItem(item) {
|
|
10
18
|
console.log(item);
|
|
11
|
-
return /*#__PURE__*/
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement("div", null, item.name);
|
|
12
20
|
},
|
|
13
|
-
onSelectItem: item
|
|
21
|
+
onSelectItem: function onSelectItem(item) {
|
|
14
22
|
console.log('Selected', item);
|
|
15
23
|
},
|
|
16
24
|
inputProps: {
|
|
17
25
|
label: 'test'
|
|
18
26
|
}
|
|
19
27
|
});
|
|
20
|
-
};
|
|
28
|
+
};
|
|
29
|
+
exports.Default = Default;
|
|
@@ -1,37 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Button = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactRouterDom = require("react-router-dom");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _gtm = _interopRequireDefault(require("../../helpers/gtm"));
|
|
12
|
+
var _link = require("../../helpers/link");
|
|
13
|
+
var _withMapping = _interopRequireDefault(require("../../Context/withMapping"));
|
|
14
|
+
require("./style.scss");
|
|
15
|
+
var _excluded = ["href", "dispatch", "className", "children", "primary", "inverted", "language", "enableLoader", "loading", "htmlType"];
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
17
|
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); }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
language,
|
|
18
|
-
enableLoader,
|
|
19
|
-
loading,
|
|
20
|
-
htmlType,
|
|
21
|
-
...props
|
|
22
|
-
}) => {
|
|
23
|
-
const classes = classNames('Button', className, {
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
var Button = function Button(_ref) {
|
|
21
|
+
var href = _ref.href,
|
|
22
|
+
dispatch = _ref.dispatch,
|
|
23
|
+
className = _ref.className,
|
|
24
|
+
children = _ref.children,
|
|
25
|
+
primary = _ref.primary,
|
|
26
|
+
inverted = _ref.inverted,
|
|
27
|
+
language = _ref.language,
|
|
28
|
+
enableLoader = _ref.enableLoader,
|
|
29
|
+
loading = _ref.loading,
|
|
30
|
+
htmlType = _ref.htmlType,
|
|
31
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
var classes = (0, _classnames.default)('Button', className, {
|
|
24
33
|
'Button--primary': primary,
|
|
25
34
|
'Button--inverted': inverted,
|
|
26
35
|
'is-loading': loading
|
|
27
36
|
});
|
|
28
|
-
|
|
37
|
+
var onClick = function onClick(event) {
|
|
29
38
|
if (loading) return;
|
|
30
39
|
|
|
31
40
|
// Using element.innerText gives us purely the text of the element which is
|
|
32
41
|
// perfect for the tracking event. We don't want a string containing HTML.
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
var text = event.target ? event.target.innerText : 'Unknown';
|
|
43
|
+
_gtm.default.trackUserEvent('button', 'click', text, href);
|
|
35
44
|
if (props.onClick) {
|
|
36
45
|
props.onClick(event);
|
|
37
46
|
}
|
|
@@ -40,7 +49,7 @@ const Button = ({
|
|
|
40
49
|
return (
|
|
41
50
|
/*#__PURE__*/
|
|
42
51
|
// eslint-disable-next-line react/button-has-type
|
|
43
|
-
|
|
52
|
+
_react.default.createElement("button", _extends({
|
|
44
53
|
type: htmlType,
|
|
45
54
|
className: classes,
|
|
46
55
|
href: href
|
|
@@ -49,30 +58,36 @@ const Button = ({
|
|
|
49
58
|
}), children)
|
|
50
59
|
);
|
|
51
60
|
}
|
|
52
|
-
return isExternalLink(href) ? /*#__PURE__*/
|
|
61
|
+
return (0, _link.isExternalLink)(href) ? /*#__PURE__*/_react.default.createElement("a", _extends({
|
|
53
62
|
className: classes,
|
|
54
63
|
href: href,
|
|
55
64
|
target: "_blank",
|
|
56
65
|
rel: "noreferrer noopener"
|
|
57
66
|
}, props, {
|
|
58
67
|
onClick: onClick
|
|
59
|
-
}), children) : /*#__PURE__*/
|
|
68
|
+
}), children) : /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, _extends({
|
|
60
69
|
to: href,
|
|
61
70
|
className: classes
|
|
62
71
|
}, props, {
|
|
63
72
|
onClick: onClick
|
|
64
73
|
}), children);
|
|
65
74
|
};
|
|
75
|
+
exports.Button = Button;
|
|
66
76
|
Button.defaultProps = {
|
|
67
77
|
primary: true,
|
|
68
78
|
inverted: false,
|
|
79
|
+
disabled: false,
|
|
80
|
+
href: null,
|
|
69
81
|
enableLoader: false,
|
|
70
82
|
htmlType: 'button'
|
|
71
83
|
};
|
|
72
84
|
Button.propTypes = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
href: _propTypes.default.string,
|
|
86
|
+
primary: _propTypes.default.bool,
|
|
87
|
+
disabled: _propTypes.default.bool,
|
|
88
|
+
inverted: _propTypes.default.bool,
|
|
89
|
+
enableLoader: _propTypes.default.bool,
|
|
90
|
+
htmlType: _propTypes.default.oneOf(['button', 'submit', 'reset'])
|
|
77
91
|
};
|
|
78
|
-
|
|
92
|
+
var _default = (0, _withMapping.default)(Button);
|
|
93
|
+
exports.default = _default;
|
|
@@ -1,54 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WithIcon = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _ = require(".");
|
|
9
|
+
require("./stories.scss");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
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); }
|
|
12
|
+
var _default = {
|
|
13
|
+
component: _.Button,
|
|
5
14
|
title: 'Atoms/Button'
|
|
6
15
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
href: "/"
|
|
15
|
-
}, "Test", /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
exports.default = _default;
|
|
17
|
+
var Default = function Default(args) {
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_.Button, args);
|
|
19
|
+
};
|
|
20
|
+
exports.Default = Default;
|
|
21
|
+
var WithIcon = function WithIcon(args) {
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_.Button, args, args.children, /*#__PURE__*/_react.default.createElement("div", {
|
|
16
23
|
className: "icon icon-arrow icon-variant-1"
|
|
17
|
-
})), /*#__PURE__*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
primary: true,
|
|
23
|
-
className: "icon-after icon-arrow icon-variant-1",
|
|
24
|
-
href: "/"
|
|
25
|
-
}, "Test"));
|
|
24
|
+
})), /*#__PURE__*/_react.default.createElement(_.Button, _extends({
|
|
25
|
+
className: "icon-before icon-arrow icon-variant-1"
|
|
26
|
+
}, args)), /*#__PURE__*/_react.default.createElement(_.Button, _extends({
|
|
27
|
+
className: "icon-after icon-arrow icon-variant-1"
|
|
28
|
+
}, args)));
|
|
26
29
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export const Inverted = () => /*#__PURE__*/React.createElement(Button, {
|
|
32
|
-
inverted: true,
|
|
33
|
-
href: "/"
|
|
34
|
-
}, "Test");
|
|
35
|
-
export const InvertedWithIcon = () => {
|
|
36
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
37
|
-
inverted: true,
|
|
38
|
-
href: "/"
|
|
39
|
-
}, "Test", /*#__PURE__*/React.createElement("div", {
|
|
40
|
-
className: "icon icon-arrow"
|
|
41
|
-
})), /*#__PURE__*/React.createElement(Button, {
|
|
42
|
-
inverted: true,
|
|
43
|
-
className: "icon-before icon-arrow",
|
|
44
|
-
href: "/"
|
|
45
|
-
}, "Test"), /*#__PURE__*/React.createElement(Button, {
|
|
46
|
-
inverted: true,
|
|
47
|
-
className: "icon-after icon-arrow",
|
|
48
|
-
href: "/"
|
|
49
|
-
}, "Test"));
|
|
30
|
+
exports.WithIcon = WithIcon;
|
|
31
|
+
var defaultArgs = {
|
|
32
|
+
children: 'Test',
|
|
33
|
+
primary: true
|
|
50
34
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
disabled: true
|
|
54
|
-
}, "Test");
|
|
35
|
+
Default.args = defaultArgs;
|
|
36
|
+
WithIcon.args = defaultArgs;
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
&--primary {
|
|
11
11
|
font-size: 21px;
|
|
12
|
-
background-color:
|
|
13
|
-
color: #
|
|
12
|
+
background-color: #000;
|
|
13
|
+
color: #fff;
|
|
14
14
|
font-weight: 600;
|
|
15
15
|
line-height: 1.14;
|
|
16
16
|
padding: 19px 30px;
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
&:hover {
|
|
19
19
|
background-color: #434343;
|
|
20
20
|
}
|
|
21
|
+
|
|
21
22
|
&:disabled {
|
|
22
23
|
font-family: inherit;
|
|
23
24
|
background-color: rgba(0, 0, 0, 0.3);
|
|
@@ -25,16 +26,17 @@
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
&--inverted {
|
|
28
|
-
border: solid 1px #
|
|
29
|
-
background-color: #
|
|
29
|
+
border: solid 1px #888;
|
|
30
|
+
background-color: #fff;
|
|
30
31
|
padding: 18px 34.5px;
|
|
31
32
|
font-size: 18px;
|
|
32
33
|
font-weight: 600;
|
|
33
|
-
color: #
|
|
34
|
+
color: #000;
|
|
34
35
|
|
|
35
36
|
&:hover {
|
|
36
37
|
background-color: #f1f1f1;
|
|
37
38
|
}
|
|
39
|
+
|
|
38
40
|
&:disabled {
|
|
39
41
|
font-family: inherit;
|
|
40
42
|
opacity: .5;
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
+
require("./style.scss");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
var CheckboxAndRadio = function CheckboxAndRadio(_ref) {
|
|
11
|
+
var name = _ref.name,
|
|
12
|
+
id = _ref.id,
|
|
13
|
+
value = _ref.value,
|
|
14
|
+
label = _ref.label,
|
|
15
|
+
checked = _ref.checked,
|
|
16
|
+
onChange = _ref.onChange,
|
|
17
|
+
disabled = _ref.disabled,
|
|
18
|
+
type = _ref.type;
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
14
20
|
className: "Checkbox"
|
|
15
|
-
}, /*#__PURE__*/
|
|
21
|
+
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
16
22
|
type: type || 'checkbox',
|
|
17
23
|
className: "Checkbox__input",
|
|
18
24
|
name: name,
|
|
@@ -21,9 +27,10 @@ const CheckboxAndRadio = ({
|
|
|
21
27
|
checked: checked,
|
|
22
28
|
onChange: onChange,
|
|
23
29
|
disabled: disabled
|
|
24
|
-
}), /*#__PURE__*/
|
|
30
|
+
}), /*#__PURE__*/_react.default.createElement("label", {
|
|
25
31
|
htmlFor: id,
|
|
26
32
|
className: "icon-before icon-checkmark"
|
|
27
33
|
}, label));
|
|
28
34
|
};
|
|
29
|
-
|
|
35
|
+
var _default = CheckboxAndRadio;
|
|
36
|
+
exports.default = _default;
|