@happeouikit/form-elements 2.2.1 → 2.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.3.0
4
+
5
+ - [Added] Typeahead component
6
+
3
7
  ## 2.2.1
4
8
 
5
9
  - [Fixed] build dist
package/dist/Badge.js CHANGED
@@ -25,7 +25,7 @@ var Badge = function Badge(_ref) {
25
25
 
26
26
  var Wrapper = styled.span.withConfig({
27
27
  displayName: "Badge__Wrapper",
28
- componentId: "sc-xyqvne-0"
28
+ componentId: "xyqvne-0"
29
29
  })(["display:inline-block;background:", ";padding:4px 8px;border-radius:100px;"], function (_ref2) {
30
30
  var color = _ref2.color,
31
31
  isFilled = _ref2.isFilled;
package/dist/Checkbox.js CHANGED
@@ -1,12 +1,11 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["label", "background"];
4
3
 
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
6
5
 
7
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
7
 
9
- import React from "react";
8
+ import React, { useRef } from "react";
10
9
  import styled from "styled-components";
11
10
  import PropTypes from "prop-types";
12
11
  import { white, active, gray01, gray06, gray08 } from "@happeouikit/colors";
@@ -18,14 +17,32 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
18
17
  var Checkbox = function Checkbox(_ref) {
19
18
  var label = _ref.label,
20
19
  background = _ref.background,
21
- props = _objectWithoutProperties(_ref, _excluded);
20
+ props = _objectWithoutProperties(_ref, ["label", "background"]);
21
+
22
+ var checkboxRef = useRef();
23
+
24
+ var onKeyDown = function onKeyDown(event) {
25
+ if (event.key.match(/enter|spacebar|\W{1}/i)) {
26
+ event.preventDefault();
27
+ checkboxRef.current.checked = !checkboxRef.current.checked;
28
+
29
+ if (typeof props.onChange === "function") {
30
+ props.onChange(event);
31
+ }
32
+ }
33
+ };
22
34
 
23
35
  return /*#__PURE__*/_jsxs(CheckboxWrapper, {
24
36
  background: background,
25
37
  disabled: props.disabled,
26
38
  children: [/*#__PURE__*/_jsx("input", _objectSpread({
27
- type: "checkbox"
28
- }, props)), /*#__PURE__*/_jsx(StyledCheckbox, _objectSpread(_objectSpread({}, props), {}, {
39
+ ref: checkboxRef,
40
+ type: "checkbox",
41
+ tabIndex: "-1"
42
+ }, props)), /*#__PURE__*/_jsx(StyledCheckbox, _objectSpread({
43
+ onKeyDown: onKeyDown,
44
+ tabIndex: 0
45
+ }, props, {
29
46
  children: /*#__PURE__*/_jsx(Checkmark, {})
30
47
  })), label && /*#__PURE__*/_jsx(Label, {
31
48
  children: label
@@ -45,16 +62,16 @@ Checkbox.defaultProps = {
45
62
  };
46
63
  var StyledCheckbox = styled.span.withConfig({
47
64
  displayName: "Checkbox__StyledCheckbox",
48
- componentId: "sc-tc08iy-0"
49
- })(["cursor:pointer;position:absolute;height:18px;width:18px;border-radius:3px;background-color:", ";border:2px solid ", ";box-sizing:content-box !important;"], white, gray06);
65
+ componentId: "tc08iy-0"
66
+ })(["cursor:pointer;position:absolute;height:18px;width:18px;border-radius:3px;background-color:", ";border:2px solid ", ";box-sizing:content-box !important;&:focus-visible{outline:0;box-shadow:0 0 0 1px ", ";}"], white, gray06, active);
50
67
  var Checkmark = styled(IconCheck).withConfig({
51
68
  displayName: "Checkbox__Checkmark",
52
- componentId: "sc-tc08iy-1"
69
+ componentId: "tc08iy-1"
53
70
  })(["position:absolute;display:none;fill:", ";width:18px;height:16px;top:50%;transform:translateY(-50%);"], white);
54
71
  var CheckboxWrapper = styled.label.withConfig({
55
72
  displayName: "Checkbox__CheckboxWrapper",
56
- componentId: "sc-tc08iy-2"
57
- })(["display:flex;align-items:center;position:relative;cursor:", ";user-select:none;padding:4px 0;input{display:none;}input:checked + ", "{background:", ";border:", ";}input:checked + ", " > svg{display:block;}input:disabled + ", "{cursor:not-allowed;background:", ";border:2px solid ", ";}input:disabled ~ p{color:", ";}"], function (_ref2) {
73
+ componentId: "tc08iy-2"
74
+ })(["display:flex;align-items:center;position:relative;cursor:", ";user-select:none;padding:4px 0;input{opacity:0;width:0;height:0;}input:checked + ", "{background:", ";border:", ";}input:checked + ", " > svg{display:block;}input:disabled + ", "{cursor:not-allowed;background:", ";border:2px solid ", ";}input:disabled ~ p{color:", ";}"], function (_ref2) {
58
75
  var disabled = _ref2.disabled;
59
76
  return disabled ? "not-allowed" : " pointer";
60
77
  }, StyledCheckbox, function (_ref3) {
@@ -66,6 +83,6 @@ var CheckboxWrapper = styled.label.withConfig({
66
83
  }, StyledCheckbox, StyledCheckbox, gray08, gray08, gray06);
67
84
  var Label = styled(TextZeta).withConfig({
68
85
  displayName: "Checkbox__Label",
69
- componentId: "sc-tc08iy-3"
86
+ componentId: "tc08iy-3"
70
87
  })(["display:inline-block;position:relative;margin-left:30px;color:", ";"], gray01);
71
88
  export default Checkbox;
@@ -1,10 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _excluded = ["label", "locale", "width", "date", "type", "fromMonth", "disabledDays", "value", "pickerRef"],
5
- _excluded2 = ["children"];
6
4
 
7
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
8
6
 
9
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
10
8
 
@@ -70,7 +68,7 @@ var DatePicker = function DatePicker(_ref) {
70
68
  disabledDays = _ref.disabledDays,
71
69
  value = _ref.value,
72
70
  pickerRef = _ref.pickerRef,
73
- props = _objectWithoutProperties(_ref, _excluded);
71
+ props = _objectWithoutProperties(_ref, ["label", "locale", "width", "date", "type", "fromMonth", "disabledDays", "value", "pickerRef"]);
74
72
 
75
73
  var _useState = useState(fromMonth),
76
74
  _useState2 = _slicedToArray(_useState, 2),
@@ -285,7 +283,7 @@ var MonthPicker = function MonthPicker(_ref4) {
285
283
 
286
284
  var DropdownYearOption = function DropdownYearOption(_ref6) {
287
285
  var children = _ref6.children,
288
- props = _objectWithoutProperties(_ref6, _excluded2);
286
+ props = _objectWithoutProperties(_ref6, ["children"]);
289
287
 
290
288
  return components.Option && /*#__PURE__*/_jsx("div", {
291
289
  onMouseDown: function onMouseDown(e) {
@@ -294,7 +292,7 @@ var MonthPicker = function MonthPicker(_ref4) {
294
292
  role: "option",
295
293
  "aria-selected": true,
296
294
  tabIndex: "0",
297
- children: /*#__PURE__*/_jsx(components.Option, _objectSpread(_objectSpread({}, props), {}, {
295
+ children: /*#__PURE__*/_jsx(components.Option, _objectSpread({}, props, {
298
296
  children: children
299
297
  }))
300
298
  });
@@ -353,23 +351,23 @@ var MonthPicker = function MonthPicker(_ref4) {
353
351
 
354
352
  var YearMonthSelectContainer = styled.div.withConfig({
355
353
  displayName: "DatePicker__YearMonthSelectContainer",
356
- componentId: "sc-ce3xgi-0"
354
+ componentId: "ce3xgi-0"
357
355
  })(["position:absolute;z-index:1;top:0;bottom:0;left:0;right:0;background-color:", ";padding:", ";"], white, padding300);
358
356
  var ActionList = styled.div.withConfig({
359
357
  displayName: "DatePicker__ActionList",
360
- componentId: "sc-ce3xgi-1"
358
+ componentId: "ce3xgi-1"
361
359
  })(["display:flex;align-items:center;justify-content:flex-end;margin-top:", ";"], padding300);
362
360
  var YearSelectContainer = styled.div.withConfig({
363
361
  displayName: "DatePicker__YearSelectContainer",
364
- componentId: "sc-ce3xgi-2"
362
+ componentId: "ce3xgi-2"
365
363
  })(["align-items:center;justify-content:center;margin-bottom:", ";> div{width:100%;}"], margin200);
366
364
  var MonthUl = styled.ul.withConfig({
367
365
  displayName: "DatePicker__MonthUl",
368
- componentId: "sc-ce3xgi-3"
366
+ componentId: "ce3xgi-3"
369
367
  })(["display:grid;grid-template-columns:1fr 1fr 1fr 1fr;grid-gap:8px;width:100%;margin:", " 0 0 0;padding:0;list-style:none;li{width:100%;}"], padding300);
370
368
  var MonthSelectButton2 = styled(ButtonSecondary).withConfig({
371
369
  displayName: "DatePicker__MonthSelectButton2",
372
- componentId: "sc-ce3xgi-4"
370
+ componentId: "ce3xgi-4"
373
371
  })(["padding:8px;", ""], function (_ref7) {
374
372
  var $isActive = _ref7.$isActive;
375
373
  return $isActive && css(["background-color:", ";p{color:", ";font-weight:bold;}"], lighten(active, 0.9), active);
@@ -377,7 +375,7 @@ var MonthSelectButton2 = styled(ButtonSecondary).withConfig({
377
375
  var borderRadius = "100px";
378
376
  var Wrapper = styled.div.withConfig({
379
377
  displayName: "DatePicker__Wrapper",
380
- componentId: "sc-ce3xgi-5"
378
+ componentId: "ce3xgi-5"
381
379
  })(["display:flex;flex-direction:column;width:", ";.DayPickerInput-Overlay{margin-top:8px;box-shadow:", ";border-radius:", ";}.DayPickerInput{.Range{.DayPicker-Day{min-width:21px;:focus{outline:none;}&.DayPicker-Day--selected:not(.DayPicker-Day--before):not(.DayPicker-Day--after){", "}&.DayPicker-Day--selected{background-color:", ";color:", ";}&.DayPicker-Day--before{position:relative;", "}&.DayPicker-Day--after{position:relative;", "}&.DayPicker-Day--today:not(.DayPicker-Day--selected){color:", ";}&.DayPicker-Day--outside{&.DayPicker-Day--before,&.DayPicker-Day--after{color:", ";}}}}input{font-family:", ";width:100%;border-radius:4px;border:solid 1px ", ";box-sizing:border-box;box-shadow:none;font-size:14px;padding:9px 12px 9px 38px;font-weight:normal;font-style:normal;font-stretch:normal;line-height:1.43;letter-spacing:0.3px;color:", ";:hover{border-color:", ";}:active{outline:none;box-shadow:none;border-color:", ";}:focus{outline:none;border-color:", ";}}.DayPicker-wrapper{font-family:", ";color:", ";letter-spacing:-0.3px;font-size:14px;font-weight:normal;}.DayPicker-Week{", " .DayPicker-Day--selected{&:first-child{&.DayPicker-Day--after{::before{content:none;}}}&:last-child{&.DayPicker-Day--before{::before{content:none;}}}}}.DayPicker-Caption{display:none;}}"], function (_ref8) {
382
380
  var width = _ref8.width;
383
381
  return width || "200px";
@@ -396,6 +394,6 @@ var Wrapper = styled.div.withConfig({
396
394
  });
397
395
  var NavBarContainer = styled.div.withConfig({
398
396
  displayName: "DatePicker__NavBarContainer",
399
- componentId: "sc-ce3xgi-6"
397
+ componentId: "ce3xgi-6"
400
398
  })(["display:flex;align-items:center;justify-content:space-between;padding:16px 14px 0px 14px;"]);
401
399
  export default DatePicker;
@@ -1,5 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import React, { useState } from "react";
2
+
3
+ /* eslint-disable radix */
4
+ import React, { useState, useCallback } from "react";
3
5
  import styled from "styled-components";
4
6
  import moment from "moment";
5
7
  import debounce from "lodash.debounce";
@@ -33,8 +35,8 @@ var DateTimePicker = function DateTimePicker(_ref) {
33
35
 
34
36
  var _useState5 = useState(inputMode),
35
37
  _useState6 = _slicedToArray(_useState5, 2),
36
- mode = _useState6[0],
37
- setMode = _useState6[1];
38
+ selectedMode = _useState6[0],
39
+ setSelectedMode = _useState6[1];
38
40
 
39
41
  var _useState7 = useState(DEFAULT_INPUT_STATE),
40
42
  _useState8 = _slicedToArray(_useState7, 2),
@@ -51,25 +53,11 @@ var DateTimePicker = function DateTimePicker(_ref) {
51
53
  timeValue = _useState12[0],
52
54
  setTimeValue = _useState12[1];
53
55
 
54
- var handleDateSelected = function handleDateSelected(date) {
55
- setSelectedDate(date);
56
- setDateTime();
57
- };
58
-
59
- var handleTimeSelected = function handleTimeSelected(time) {
60
- if (time.length !== 2) {
61
- setTimeInputState("error");
62
- setTimeInputErrorMessage(intl.formatMessage(messages.wrongFormat));
63
- return;
64
- }
65
-
66
- setSelectedTime(time);
67
- setDateTime();
68
- };
69
-
70
- var validateTime = function validateTime(time) {
56
+ var validateTime = useCallback(function (_ref2) {
57
+ var time = _ref2.time,
58
+ mode = _ref2.mode;
71
59
  var hour = parseInt(time[0]);
72
- var minute = parseInt(time[1]);
60
+ var minute = parseInt(time[1]); // eslint-disable-next-line no-restricted-globals
73
61
 
74
62
  if (isNaN(hour) || isNaN(minute)) {
75
63
  setTimeInputState("error");
@@ -77,7 +65,10 @@ var DateTimePicker = function DateTimePicker(_ref) {
77
65
  return false;
78
66
  }
79
67
 
80
- if (mode !== "24h" && hour > 12 || hour > 23 || minute > 59) {
68
+ var regex = new RegExp(mode === "24h" ? "([0-1][0-9]{1}|[2][0-3]{1}):([0-5]{1}[0-9]{1})" : "([0][1-9]|[1][0-2]{1}):([0-5]{1}[0-9]{1})");
69
+ var timeValue = hour < 10 ? "0".concat(hour, ":").concat(time[1]) : "".concat(hour, ":").concat(time[1]);
70
+
71
+ if (!regex.test(timeValue)) {
81
72
  setTimeInputState("error");
82
73
  setTimeInputErrorMessage(intl.formatMessage(messages.invalidTime));
83
74
  return false;
@@ -85,36 +76,20 @@ var DateTimePicker = function DateTimePicker(_ref) {
85
76
 
86
77
  setTimeInputState(DEFAULT_INPUT_STATE);
87
78
  return true;
88
- };
89
-
90
- var onChangeMode = function onChangeMode(_ref2) {
91
- var value = _ref2.value;
92
- setMode(value);
93
- setDateTime();
94
- };
95
-
96
- var handleTimeSelectedDebounced = debounce(handleTimeSelected, 500);
97
-
98
- var onChangeTime = function onChangeTime(event) {
99
- var timeString = event.target.value;
100
- var newTime = timeString;
101
- setTimeInputState(DEFAULT_INPUT_STATE);
102
-
103
- if (timeString.match(TIME_REGEX)) {
104
- newTime = "".concat(timeString.slice(0, 2), ":").concat(timeString.slice(2));
105
- }
106
-
107
- setTimeValue(newTime);
108
- handleTimeSelectedDebounced(newTime.split(":"));
109
- };
110
-
111
- var setDateTime = function setDateTime() {
112
- if (!selectedTime || !mode) return;
113
- if (!validateTime(selectedTime)) return;
114
- if (!selectedDate) return;
115
- var hour = parseInt(selectedTime[0]);
116
- var minute = parseInt(selectedTime[1]);
117
- var selectedDateTime = moment(selectedDate);
79
+ }, [intl]);
80
+ var setDateTime = useCallback(function (_ref3) {
81
+ var date = _ref3.date,
82
+ time = _ref3.time,
83
+ mode = _ref3.mode;
84
+ if (!time || !mode) return;
85
+ if (!validateTime({
86
+ time: time,
87
+ mode: mode
88
+ })) return;
89
+ if (!date) return;
90
+ var hour = parseInt(time[0]);
91
+ var minute = parseInt(time[1]);
92
+ var selectedDateTime = moment(date);
118
93
 
119
94
  if (mode === "am" && hour === 12) {
120
95
  selectedDateTime.hour(0);
@@ -128,8 +103,56 @@ var DateTimePicker = function DateTimePicker(_ref) {
128
103
 
129
104
  selectedDateTime.minute(minute);
130
105
  if (onChange) onChange(selectedDateTime.toDate());
131
- };
106
+ }, [onChange, validateTime]);
107
+ var handleDateSelected = useCallback(function (date) {
108
+ setSelectedDate(date);
109
+ setDateTime({
110
+ date: date,
111
+ time: selectedTime,
112
+ mode: selectedMode
113
+ });
114
+ }, [selectedMode, selectedTime, setDateTime]);
115
+ var handleOnKeyPress = useCallback(function (event) {
116
+ if (event.charCode < 48 || event.charCode > 58) {
117
+ event.preventDefault();
118
+ }
119
+ }, []);
120
+ var handleTimeSelected = useCallback(function (time) {
121
+ if (time.length !== 2) {
122
+ setTimeInputState("error");
123
+ setTimeInputErrorMessage(intl.formatMessage(messages.wrongFormat));
124
+ return;
125
+ }
132
126
 
127
+ setSelectedTime(time);
128
+ setDateTime({
129
+ date: selectedDate,
130
+ time: time,
131
+ mode: selectedMode
132
+ });
133
+ }, [intl, selectedDate, selectedMode, setDateTime]);
134
+ var onChangeMode = useCallback(function (_ref4) {
135
+ var value = _ref4.value;
136
+ setSelectedMode(value);
137
+ setDateTime({
138
+ date: selectedDate,
139
+ time: selectedTime,
140
+ mode: value
141
+ });
142
+ }, [selectedDate, selectedTime, setDateTime]);
143
+ var handleTimeSelectedDebounced = debounce(handleTimeSelected, 500);
144
+ var onChangeTime = useCallback(function (event) {
145
+ var timeString = event.target.value;
146
+ var newTime = timeString;
147
+ setTimeInputState(DEFAULT_INPUT_STATE);
148
+
149
+ if (timeString.match(TIME_REGEX)) {
150
+ newTime = "".concat(timeString.slice(0, 2), ":").concat(timeString.slice(2));
151
+ }
152
+
153
+ setTimeValue(newTime);
154
+ handleTimeSelectedDebounced(newTime.split(":"));
155
+ }, [handleTimeSelectedDebounced]);
133
156
  return /*#__PURE__*/_jsxs(Wrapper, {
134
157
  children: [/*#__PURE__*/_jsx(DatePicker, {
135
158
  width: "100%",
@@ -142,7 +165,8 @@ var DateTimePicker = function DateTimePicker(_ref) {
142
165
  onChange: onChangeTime,
143
166
  state: timeInputState,
144
167
  errorMessage: timeInputErrorMessage,
145
- value: timeValue
168
+ value: timeValue,
169
+ onKeyPress: handleOnKeyPress
146
170
  }), /*#__PURE__*/_jsx("div", {
147
171
  style: {
148
172
  paddingTop: "28px"
@@ -170,14 +194,15 @@ var DateTimePicker = function DateTimePicker(_ref) {
170
194
 
171
195
  var Wrapper = styled.div.withConfig({
172
196
  displayName: "DateTimePicker__Wrapper",
173
- componentId: "sc-sdui13-0"
197
+ componentId: "sdui13-0"
174
198
  })(["display:grid;grid-template-columns:180px 90px 90px;column-gap:8px;"]);
175
199
  DateTimePicker.propTypes = {
176
200
  onChange: PropTypes.func.isRequired,
177
201
  label: PropTypes.string,
178
- mode: PropTypes.oneOf(["am", "pm", "24h"])
202
+ inputMode: PropTypes.oneOf(["am", "pm", "24h"])
179
203
  };
180
204
  DateTimePicker.defaultProps = {
181
- inputMode: "am"
205
+ inputMode: "am",
206
+ label: undefined
182
207
  };
183
208
  export default DateTimePicker;
package/dist/Dropdown.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["label"];
4
3
 
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
6
5
 
7
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
7
 
@@ -18,7 +17,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
18
17
 
19
18
  var Dropdown = function Dropdown(_ref, ref) {
20
19
  var label = _ref.label,
21
- props = _objectWithoutProperties(_ref, _excluded);
20
+ props = _objectWithoutProperties(_ref, ["label"]);
22
21
 
23
22
  var dropdownRef = useRef();
24
23
  useImperativeHandle(ref, function () {
@@ -47,7 +46,7 @@ var Dropdown = function Dropdown(_ref, ref) {
47
46
  };
48
47
 
49
48
  var DropdownIndicator = function DropdownIndicator(props) {
50
- return components.DropdownIndicator && /*#__PURE__*/_jsx(components.DropdownIndicator, _objectSpread(_objectSpread({}, props), {}, {
49
+ return components.DropdownIndicator && /*#__PURE__*/_jsx(components.DropdownIndicator, _objectSpread({}, props, {
51
50
  children: /*#__PURE__*/_jsx(IconArrowDropDown, {
52
51
  width: "24px",
53
52
  height: "24px",
@@ -62,10 +61,10 @@ export var dropdownStyles = css(["min-width:200px;width:auto;font-family:", ";le
62
61
  });
63
62
  var StyledDropdown = styled(Select).withConfig({
64
63
  displayName: "Dropdown__StyledDropdown",
65
- componentId: "sc-pcee56-0"
64
+ componentId: "pcee56-0"
66
65
  })(["", ""], dropdownStyles);
67
66
  var Label = styled.div.withConfig({
68
67
  displayName: "Dropdown__Label",
69
- componentId: "sc-pcee56-1"
68
+ componentId: "pcee56-1"
70
69
  })(["margin:4px 0;"]);
71
70
  export default /*#__PURE__*/forwardRef(Dropdown);
package/dist/Input.js CHANGED
@@ -1,9 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["label", "icon", "iconProps", "state", "errorMessage"],
4
- _excluded2 = ["label"];
5
3
 
6
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
7
5
 
8
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
9
7
 
@@ -30,7 +28,7 @@ export var Input = function Input(_ref) {
30
28
  iconProps = _ref.iconProps,
31
29
  state = _ref.state,
32
30
  errorMessage = _ref.errorMessage,
33
- rest = _objectWithoutProperties(_ref, _excluded);
31
+ rest = _objectWithoutProperties(_ref, ["label", "icon", "iconProps", "state", "errorMessage"]);
34
32
 
35
33
  return /*#__PURE__*/_jsxs(Container, {
36
34
  children: [!!label && /*#__PURE__*/_jsx(InputLabel, {
@@ -69,7 +67,7 @@ function iconWrapper(IconComponent, iconProps) {
69
67
  var props = Object.assign({}, iconDefaults, iconProps);
70
68
  return function () {
71
69
  return /*#__PURE__*/_jsx(InputIconWrapper, {
72
- children: /*#__PURE__*/_jsx(IconComponent, _objectSpread(_objectSpread({}, props), {}, {
70
+ children: /*#__PURE__*/_jsx(IconComponent, _objectSpread({}, props, {
73
71
  style: style
74
72
  }))
75
73
  });
@@ -134,10 +132,10 @@ var InputIconWrapper = styled.span.withConfig({
134
132
 
135
133
  export var InputNumber = function InputNumber(_ref8) {
136
134
  var label = _ref8.label,
137
- props = _objectWithoutProperties(_ref8, _excluded2);
135
+ props = _objectWithoutProperties(_ref8, ["label"]);
138
136
 
139
137
  return /*#__PURE__*/_jsxs(InputNumberContainer, {
140
- children: [/*#__PURE__*/_jsx(StyledInputNumber, _objectSpread(_objectSpread({}, props), {}, {
138
+ children: [/*#__PURE__*/_jsx(StyledInputNumber, _objectSpread({}, props, {
141
139
  type: "number"
142
140
  })), label && /*#__PURE__*/_jsx(InputNumberLabel, {
143
141
  children: label
package/dist/Link.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
 
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4
4
 
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
6
 
@@ -11,26 +11,26 @@ import { BodyUI } from "@happeouikit/typography";
11
11
  import { active } from "@happeouikit/colors";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  export var Link = /*#__PURE__*/React.forwardRef(function (props, ref) {
14
- return /*#__PURE__*/_jsx(StyledLink, _objectSpread(_objectSpread({
14
+ return /*#__PURE__*/_jsx(StyledLink, _objectSpread({
15
15
  ref: ref,
16
16
  as: "a"
17
- }, props), {}, {
17
+ }, props, {
18
18
  children: props.children
19
19
  }));
20
20
  });
21
21
  export var LinkExternal = /*#__PURE__*/React.forwardRef(function (props, ref) {
22
- return /*#__PURE__*/_jsx(StyledLink, _objectSpread(_objectSpread({
22
+ return /*#__PURE__*/_jsx(StyledLink, _objectSpread({
23
23
  ref: ref,
24
24
  as: "a",
25
25
  target: "_blank",
26
26
  rel: "nofollow noopener"
27
- }, props), {}, {
27
+ }, props, {
28
28
  children: props.children
29
29
  }));
30
30
  });
31
31
  var StyledLink = styled(BodyUI).withConfig({
32
32
  displayName: "Link__StyledLink",
33
- componentId: "sc-jezurh-0"
33
+ componentId: "jezurh-0"
34
34
  })(["text-decoration:", ";color:", ";:hover{color:", ";text-decoration:underline;}"], function (_ref) {
35
35
  var underline = _ref.underline;
36
36
  return underline ? "underline" : "none";
@@ -1,8 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["label"];
4
3
 
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
6
5
 
7
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
7
 
@@ -16,7 +15,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
16
15
 
17
16
  var RadioButton = function RadioButton(_ref) {
18
17
  var label = _ref.label,
19
- props = _objectWithoutProperties(_ref, _excluded);
18
+ props = _objectWithoutProperties(_ref, ["label"]);
20
19
 
21
20
  return /*#__PURE__*/_jsxs(RadioButtonWrapper, {
22
21
  children: [/*#__PURE__*/_jsx("input", _objectSpread({
package/dist/Switch.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["label", "tabIndex"];
4
3
 
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
6
5
 
7
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
7
 
@@ -17,7 +16,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
17
16
  var Switch = function Switch(_ref) {
18
17
  var label = _ref.label,
19
18
  tabIndex = _ref.tabIndex,
20
- props = _objectWithoutProperties(_ref, _excluded);
19
+ props = _objectWithoutProperties(_ref, ["label", "tabIndex"]);
21
20
 
22
21
  var checkboxRef = useRef();
23
22
 
@@ -30,10 +29,10 @@ var Switch = function Switch(_ref) {
30
29
  };
31
30
 
32
31
  return /*#__PURE__*/_jsxs(ToggleSwitchWrapper, {
33
- children: [/*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({
32
+ children: [/*#__PURE__*/_jsx("input", _objectSpread({
34
33
  ref: checkboxRef,
35
34
  type: "checkbox"
36
- }, props), {}, {
35
+ }, props, {
37
36
  tabIndex: -1
38
37
  })), /*#__PURE__*/_jsx(StyledSwitch, _objectSpread({
39
38
  onKeyDown: onKeyDown,
package/dist/Tag.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["text", "closeCallback", "isUppercase"];
5
4
 
6
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
7
6
 
8
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
9
8
 
@@ -20,7 +19,7 @@ var Tag = function Tag(_ref) {
20
19
  var text = _ref.text,
21
20
  closeCallback = _ref.closeCallback,
22
21
  isUppercase = _ref.isUppercase,
23
- props = _objectWithoutProperties(_ref, _excluded);
22
+ props = _objectWithoutProperties(_ref, ["text", "closeCallback", "isUppercase"]);
24
23
 
25
24
  var _useState = useState(true),
26
25
  _useState2 = _slicedToArray(_useState, 2),
@@ -32,7 +31,7 @@ var Tag = function Tag(_ref) {
32
31
  closeCallback && closeCallback();
33
32
  };
34
33
 
35
- return show && /*#__PURE__*/_jsxs(TagWrapper, _objectSpread(_objectSpread({}, props), {}, {
34
+ return show && /*#__PURE__*/_jsxs(TagWrapper, _objectSpread({}, props, {
36
35
  children: [/*#__PURE__*/_jsx(Text, {
37
36
  bold: true,
38
37
  uppercase: isUppercase,
package/dist/Textarea.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["cols", "rows", "label"];
4
3
 
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
6
5
 
7
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
7
 
@@ -18,7 +17,7 @@ var Textarea = function Textarea(_ref) {
18
17
  var cols = _ref.cols,
19
18
  rows = _ref.rows,
20
19
  label = _ref.label,
21
- props = _objectWithoutProperties(_ref, _excluded);
20
+ props = _objectWithoutProperties(_ref, ["cols", "rows", "label"]);
22
21
 
23
22
  return /*#__PURE__*/_jsxs(Fragment, {
24
23
  children: [!!label && /*#__PURE__*/_jsx(Label, {
@@ -0,0 +1,234 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useState, useEffect, useRef } from "react";
3
+ import PropTypes from "prop-types";
4
+ import { IconSearch } from "@happeouikit/icons";
5
+ import styled from "styled-components";
6
+ import { hooks } from "@happeo/react-core";
7
+ import { Input } from "../Input";
8
+ import TypeaheadList from "./TypeaheadList";
9
+ import TypeaheadDropdown from "./TypeaheadDropdown";
10
+ import TypeaheadError from "./TypeaheadError";
11
+ import TypeaheadNoResults from "./TypeaheadNoResults";
12
+ import TypeaheadLoading from "./TypeaheadLoading";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+
16
+ var Typeahead = function Typeahead(_ref) {
17
+ var onQuery = _ref.onQuery,
18
+ loading = _ref.loading,
19
+ results = _ref.results,
20
+ afterSelect = _ref.afterSelect,
21
+ keepResult = _ref.keepResult,
22
+ placeholder = _ref.placeholder,
23
+ errorMessage = _ref.errorMessage,
24
+ queryError = _ref.queryError,
25
+ dropdownMaxHeight = _ref.dropdownMaxHeight;
26
+
27
+ // Need to store query as object to support change detection when debouncing from query to the same query
28
+ var _useState = useState({
29
+ q: ""
30
+ }),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ query = _useState2[0],
33
+ setQuery = _useState2[1];
34
+
35
+ var debouncedQuery = hooks.useDebounce(query, 300);
36
+
37
+ var _useState3 = useState(null),
38
+ _useState4 = _slicedToArray(_useState3, 2),
39
+ focusedResultIndex = _useState4[0],
40
+ setFocusedResultIndex = _useState4[1];
41
+
42
+ var _useState5 = useState(true),
43
+ _useState6 = _slicedToArray(_useState5, 2),
44
+ allowDropdown = _useState6[0],
45
+ setAllowDropdown = _useState6[1];
46
+
47
+ var _useState7 = useState(null),
48
+ _useState8 = _slicedToArray(_useState7, 2),
49
+ selectedResult = _useState8[0],
50
+ setSelectedResult = _useState8[1];
51
+
52
+ var selfRef = useRef(null);
53
+ var selectedRef = useRef(null);
54
+ var userIsTyping = query !== debouncedQuery;
55
+ var showDropDown = query.q.length > 1 && !selectedResult && allowDropdown; // The parent may want to keep the result visible until some further user interaction
56
+ // Then keepResult may be toggled OFF to clear the input for next query and set back ON at onQuery
57
+
58
+ useEffect(function () {
59
+ if (!keepResult) setQuery({
60
+ q: ""
61
+ });
62
+ }, [keepResult]);
63
+ useEffect(function () {
64
+ // Debouncing timer might still be running after result is selected, so ignore false triggers
65
+ if (selectedResult) return;
66
+ var q = debouncedQuery.q;
67
+ if (q.length < 2) return;
68
+ onQuery(q);
69
+ }, [onQuery, debouncedQuery, selectedResult]);
70
+ useEffect(function () {
71
+ if (results.length === 0) {
72
+ setFocusedResultIndex(null);
73
+ }
74
+
75
+ if (results.length > 0) {
76
+ setFocusedResultIndex(0);
77
+ }
78
+ }, [results]);
79
+
80
+ var focusNextResult = function focusNextResult() {
81
+ return focusedResultIndex < results.length - 1 ? focusedResultIndex + 1 : focusedResultIndex;
82
+ };
83
+
84
+ var focusPrevResult = function focusPrevResult() {
85
+ return focusedResultIndex > 0 ? focusedResultIndex - 1 : focusedResultIndex;
86
+ };
87
+
88
+ var selectResult = function selectResult(result) {
89
+ if (keepResult && result.text) {
90
+ setQuery({
91
+ q: result.text
92
+ });
93
+ } else {
94
+ setQuery({
95
+ q: ""
96
+ });
97
+ }
98
+
99
+ setSelectedResult(result);
100
+ afterSelect(result);
101
+ setFocusedResultIndex(null);
102
+ };
103
+
104
+ var valueChangeHandler = function valueChangeHandler(event) {
105
+ var value = event.target.value;
106
+ setQuery({
107
+ q: value
108
+ });
109
+ setAllowDropdown(true);
110
+ setSelectedResult(null);
111
+ setFocusedResultIndex(null); // notify parent that selection was erased
112
+
113
+ if (selectedResult) {
114
+ afterSelect(null);
115
+ }
116
+ };
117
+
118
+ useEffect(function () {
119
+ if (!selectedRef.current) return;
120
+ selectedRef.current.scrollIntoView({
121
+ block: "nearest"
122
+ });
123
+ }, [focusedResultIndex]);
124
+
125
+ var keyDownHandler = function keyDownHandler(event) {
126
+ if (!showDropDown) return;
127
+ if (queryError || userIsTyping || loading) return;
128
+
129
+ if (event.key === "ArrowUp") {
130
+ setFocusedResultIndex(focusPrevResult());
131
+ event.preventDefault();
132
+ } else if (event.key === "ArrowDown") {
133
+ setFocusedResultIndex(focusNextResult());
134
+ event.preventDefault();
135
+ } else if (event.key === "Enter") {
136
+ if (focusedResultIndex != null) {
137
+ selectResult(results[focusedResultIndex]);
138
+ event.preventDefault();
139
+ }
140
+ }
141
+ };
142
+
143
+ var resultClickHandler = function resultClickHandler(result) {
144
+ selectResult(result);
145
+ };
146
+
147
+ useEffect(function () {
148
+ var handleWindowClick = function handleWindowClick(event) {
149
+ if (selfRef.current && !selfRef.current.contains(event.target)) {
150
+ setAllowDropdown(false);
151
+ } else {
152
+ setAllowDropdown(true);
153
+ }
154
+ };
155
+
156
+ document.addEventListener("pointerdown", handleWindowClick);
157
+ return function cleanup() {
158
+ document.removeEventListener("pointerdown", handleWindowClick);
159
+ };
160
+ }, [selfRef]);
161
+
162
+ var renderDropdownContent = function renderDropdownContent() {
163
+ if (queryError) {
164
+ return /*#__PURE__*/_jsx(TypeaheadError, {});
165
+ }
166
+
167
+ if (userIsTyping || loading) {
168
+ return /*#__PURE__*/_jsx(TypeaheadLoading, {
169
+ query: query.q
170
+ });
171
+ }
172
+
173
+ if (results.length > 0) {
174
+ return /*#__PURE__*/_jsx(TypeaheadList, {
175
+ results: results,
176
+ focusedResultIndex: focusedResultIndex,
177
+ onResultClick: resultClickHandler,
178
+ ref: selectedRef
179
+ });
180
+ }
181
+
182
+ return /*#__PURE__*/_jsx(TypeaheadNoResults, {
183
+ query: query.q
184
+ });
185
+ };
186
+
187
+ return /*#__PURE__*/_jsxs(Wrapper, {
188
+ ref: selfRef,
189
+ children: [/*#__PURE__*/_jsx(Input, {
190
+ placeholder: placeholder,
191
+ icon: IconSearch,
192
+ value: query.q,
193
+ name: "inputValue",
194
+ onChange: valueChangeHandler,
195
+ onKeyDown: keyDownHandler,
196
+ state: errorMessage ? "error" : "default",
197
+ errorMessage: errorMessage,
198
+ autoComplete: "off"
199
+ }), showDropDown && /*#__PURE__*/_jsx(TypeaheadDropdown, {
200
+ maxHeight: dropdownMaxHeight,
201
+ children: renderDropdownContent()
202
+ })]
203
+ });
204
+ };
205
+
206
+ var Wrapper = styled.div.withConfig({
207
+ displayName: "Typeahead__Wrapper",
208
+ componentId: "sc-16j2d25-0"
209
+ })(["width:100%;"]);
210
+ Typeahead.propTypes = {
211
+ onQuery: PropTypes.func.isRequired,
212
+ loading: PropTypes.bool.isRequired,
213
+ results: PropTypes.arrayOf(PropTypes.shape({
214
+ text: PropTypes.string,
215
+ // This is used in association with keepResult
216
+ component: PropTypes.element.isRequired,
217
+ data: PropTypes.shape // You may add any data related to the result, so you can use it on afterSelect
218
+
219
+ })).isRequired,
220
+ afterSelect: PropTypes.func.isRequired,
221
+ keepResult: PropTypes.bool,
222
+ placeholder: PropTypes.string,
223
+ errorMessage: PropTypes.string,
224
+ queryError: PropTypes.bool,
225
+ dropdownMaxHeight: PropTypes.string
226
+ };
227
+ Typeahead.defaultProps = {
228
+ keepResult: false,
229
+ placeholder: "",
230
+ errorMessage: null,
231
+ queryError: false,
232
+ dropdownMaxHeight: "350px"
233
+ };
234
+ export default Typeahead;
@@ -0,0 +1,27 @@
1
+ import styled from "styled-components";
2
+ import { shadow400 } from "@happeouikit/theme";
3
+ import { white } from "@happeouikit/colors";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+
6
+ var TypeaheadDropdown = function TypeaheadDropdown(_ref) {
7
+ var maxHeight = _ref.maxHeight,
8
+ children = _ref.children;
9
+ return /*#__PURE__*/_jsx(Dropdown, {
10
+ children: /*#__PURE__*/_jsx(DropdownContent, {
11
+ maxHeight: maxHeight,
12
+ children: children
13
+ })
14
+ });
15
+ };
16
+
17
+ var Dropdown = styled.div.withConfig({
18
+ displayName: "TypeaheadDropdown__Dropdown",
19
+ componentId: "c2clla-0"
20
+ })(["position:relative;display:block;width:100%;z-index:1000;"]);
21
+ var DropdownContent = styled.div.withConfig({
22
+ displayName: "TypeaheadDropdown__DropdownContent",
23
+ componentId: "c2clla-1"
24
+ })(["position:absolute;display:block;width:100%;background:", ";margin-top:8px;padding-top:8px;padding-bottom:8px;box-shadow:", ";border-radius:4px;max-height:", ";overflow-y:auto;"], white, shadow400, function (props) {
25
+ return props.maxHeight;
26
+ });
27
+ export default TypeaheadDropdown;
@@ -0,0 +1,16 @@
1
+ import { IconError } from "@happeouikit/icons";
2
+ import { useIntl } from "react-intl";
3
+ import messages from "./messages";
4
+ import TypeaheadMessage from "./TypeaheadMessage";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+
7
+ var TypeaheadError = function TypeaheadError() {
8
+ var intl = useIntl();
9
+ return /*#__PURE__*/_jsx(TypeaheadMessage, {
10
+ icon: IconError,
11
+ title: intl.formatMessage(messages.typeaheadServerError),
12
+ details: intl.formatMessage(messages.typeaheadServerErrorDetails)
13
+ });
14
+ };
15
+
16
+ export default TypeaheadError;
@@ -0,0 +1,37 @@
1
+ import React, { Fragment } from "react";
2
+ import styled from "styled-components";
3
+ import { active, toBgLight, lighten40 } from "@happeouikit/colors";
4
+ import { radius400 } from "@happeouikit/theme";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ var FocusStyle = {
7
+ border: "solid 1px ".concat(lighten40(active)),
8
+ borderRadius: radius400
9
+ };
10
+ var TypeaheadList = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
11
+ var results = _ref.results,
12
+ focusedResultIndex = _ref.focusedResultIndex,
13
+ onResultClick = _ref.onResultClick;
14
+ return /*#__PURE__*/_jsx(Container, {
15
+ children: results.map(function (result, index) {
16
+ return /*#__PURE__*/_jsx(Fragment, {
17
+ children: /*#__PURE__*/_jsx(Row, {
18
+ onClick: function onClick() {
19
+ return onResultClick(result);
20
+ },
21
+ style: index === focusedResultIndex ? FocusStyle : {},
22
+ ref: index === focusedResultIndex ? ref : null,
23
+ children: result.component
24
+ })
25
+ }, result.text || index);
26
+ })
27
+ });
28
+ });
29
+ var Container = styled.ul.withConfig({
30
+ displayName: "TypeaheadList__Container",
31
+ componentId: "ce1llk-0"
32
+ })(["padding:0px;margin:0px;"]);
33
+ var Row = styled.li.withConfig({
34
+ displayName: "TypeaheadList__Row",
35
+ componentId: "ce1llk-1"
36
+ })(["padding:9px 15px 9px 15px;border:solid 1px transparent;list-style-type:none;&:hover{background:", ";}"], toBgLight(active));
37
+ export default TypeaheadList;
@@ -0,0 +1,26 @@
1
+ import { Loader } from "@happeouikit/loaders";
2
+ import { useIntl } from "react-intl";
3
+ import messages from "./messages";
4
+ import TypeaheadMessage, { ICON_SIZE } from "./TypeaheadMessage";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+
7
+ var FixedSizeLoader = function FixedSizeLoader() {
8
+ return /*#__PURE__*/_jsx(Loader, {
9
+ containerWidth: ICON_SIZE,
10
+ containerHeight: ICON_SIZE
11
+ });
12
+ };
13
+
14
+ var TypeaheadLoading = function TypeaheadLoading(_ref) {
15
+ var query = _ref.query;
16
+ var intl = useIntl();
17
+ return /*#__PURE__*/_jsx(TypeaheadMessage, {
18
+ icon: FixedSizeLoader,
19
+ title: intl.formatMessage(messages.typeaheadSearching),
20
+ details: intl.formatMessage(messages.typeaheadSearchingDetails, {
21
+ query: query
22
+ })
23
+ });
24
+ };
25
+
26
+ export default TypeaheadLoading;
@@ -0,0 +1,41 @@
1
+ import styled from "styled-components";
2
+ import { TextEpsilon, BodyUI } from "@happeouikit/typography";
3
+ import { gray07, gray04 } from "@happeouikit/colors";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ export var ICON_SIZE = "48px";
7
+ var IconStyle = {
8
+ width: ICON_SIZE,
9
+ height: ICON_SIZE,
10
+ fill: gray07
11
+ };
12
+
13
+ var TypeaheadMessage = function TypeaheadMessage(_ref) {
14
+ var icon = _ref.icon,
15
+ title = _ref.title,
16
+ details = _ref.details;
17
+ var Icon = icon;
18
+ return /*#__PURE__*/_jsxs(Flexbox, {
19
+ children: [/*#__PURE__*/_jsx(Icon, {
20
+ style: IconStyle
21
+ }), /*#__PURE__*/_jsx(Title, {
22
+ children: title
23
+ }), /*#__PURE__*/_jsx(Details, {
24
+ children: details
25
+ })]
26
+ });
27
+ };
28
+
29
+ var Title = styled(TextEpsilon).withConfig({
30
+ displayName: "TypeaheadMessage__Title",
31
+ componentId: "sc-1yxn5eq-0"
32
+ })(["text-align:center;margin-bottom:8px;"]);
33
+ var Details = styled(BodyUI).withConfig({
34
+ displayName: "TypeaheadMessage__Details",
35
+ componentId: "sc-1yxn5eq-1"
36
+ })(["text-align:center;color:", ";"], gray04);
37
+ var Flexbox = styled.div.withConfig({
38
+ displayName: "TypeaheadMessage__Flexbox",
39
+ componentId: "sc-1yxn5eq-2"
40
+ })(["display:flex;flex-direction:column;align-items:center;padding:24px;"]);
41
+ export default TypeaheadMessage;
@@ -0,0 +1,19 @@
1
+ import { useIntl } from "react-intl";
2
+ import { IconSearch } from "@happeouikit/icons";
3
+ import messages from "./messages";
4
+ import TypeaheadMessage from "./TypeaheadMessage";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+
7
+ var TypeaheadNoResults = function TypeaheadNoResults(_ref) {
8
+ var query = _ref.query;
9
+ var intl = useIntl();
10
+ return /*#__PURE__*/_jsx(TypeaheadMessage, {
11
+ icon: IconSearch,
12
+ title: intl.formatMessage(messages.typeaheadNoResults),
13
+ details: intl.formatMessage(messages.typeaheadNoResultsDetails, {
14
+ query: query
15
+ })
16
+ });
17
+ };
18
+
19
+ export default TypeaheadNoResults;
@@ -0,0 +1,29 @@
1
+ import { defineMessages } from "react-intl";
2
+ export default defineMessages({
3
+ typeaheadNoResults: {
4
+ id: "typeahead.noResults",
5
+ defaultMessage: "No results found"
6
+ },
7
+ typeaheadNoResultsDetails: {
8
+ id: "typeahead.noResultsDetails",
9
+ // eslint-disable-next-line quotes
10
+ defaultMessage: 'We found no results for "{query}"'
11
+ },
12
+ typeaheadServerError: {
13
+ id: "typeahead.serverError",
14
+ defaultMessage: "Server Error"
15
+ },
16
+ typeaheadServerErrorDetails: {
17
+ id: "typeahead.serverErrorDetails",
18
+ defaultMessage: "Oh no, there seems to be an issue with our servers. Please try again later"
19
+ },
20
+ typeaheadSearching: {
21
+ id: "typeahead.searching",
22
+ defaultMessage: "Searching..."
23
+ },
24
+ typeaheadSearchingDetails: {
25
+ id: "typeahead.searchingDetails",
26
+ // eslint-disable-next-line quotes
27
+ defaultMessage: 'Please wait as we try to find "{query}"'
28
+ }
29
+ });
package/dist/index.js CHANGED
@@ -10,4 +10,5 @@ export { default as Tag } from "./Tag";
10
10
  export { default as Badge } from "./Badge";
11
11
  export { default as DatePicker } from "./DatePicker";
12
12
  export * from "./utils";
13
- export { default as DateTimePicker } from "./DateTimePicker";
13
+ export { default as DateTimePicker } from "./DateTimePicker";
14
+ export { default as Typeahead } from "./Typeahead/Typeahead";
package/dist/utils.js CHANGED
@@ -7,7 +7,7 @@ export var toCamelCase = function toCamelCase(str) {
7
7
  var HASHTAG_MAX_LENGTH = 64;
8
8
  export var sanitiseHashtag = function sanitiseHashtag(hashtag) {
9
9
  if (hashtag && typeof hashtag === "string") {
10
- var regex = new RegExp(/(?:(?![#0-9A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06E1-\u06E8\u06DF-\u06E4\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u0870-\u0887\u0889-\u088E\u0898-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0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u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1715\u171F-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ACE\u1B00-\u1B4C\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u24B6-\u24E9\u2C00-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA672\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA827\uA82C\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-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uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDE80-\uDEA9\uDEAB\uDEAC\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDF70-\uDF85\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC75\uDC7F-\uDCBA\uDCC2\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD47\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDCE-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E-\uDC61\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39\uDF40-\uDF46]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9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-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD30-\uDD49\uDD50-\uDD69\uDD70-\uDD89]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]|\uDB40[\uDD00-\uDDEF])[\s\S])/);
10
+ var regex = new RegExp(/(?:[\0-"\$-\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08BE-\u08D2\u08E2\u0964\u0965\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u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1ABF-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u200B\u200E-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31BB-\u31EF\u3200-\u33FF\u4DB6-\u4DFF\u9FF0-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7C7-\uA7F6\uA828-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB68-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-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\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD869[\uDED7-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/);
11
11
  var withoutConsecutiveUnderscores = hashtag.replace(/_+/g, "_");
12
12
  var match = withoutConsecutiveUnderscores.match(regex);
13
13
  var firstDisallowedCharIndex = match && match.index || withoutConsecutiveUnderscores.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happeouikit/form-elements",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",
@@ -15,10 +15,12 @@
15
15
  "author": "Happeo Oy",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
+ "@happeo/react-core": "^0.9.0",
18
19
  "@happeouikit/buttons": "^1.0.15",
19
20
  "@happeouikit/colors": "^1.0.4",
20
- "@happeouikit/icons": "^2.0.1",
21
+ "@happeouikit/icons": "^2.0.5",
21
22
  "@happeouikit/layout": "^1.1.11",
23
+ "@happeouikit/loaders": "^1.0.4",
22
24
  "@happeouikit/theme": "^1.0.4",
23
25
  "@happeouikit/tooltip": "^1.0.11",
24
26
  "@happeouikit/typography": "^1.0.10",