@happeouikit/form-elements 2.3.16 → 2.3.18
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 +8 -0
- package/dist/Textarea.js +40 -4
- package/dist/{Typeahead → TypeAhead}/Typeahead.js +6 -6
- package/dist/{Typeahead → TypeAhead}/TypeaheadDropdown.js +2 -2
- package/dist/{Typeahead → TypeAhead}/TypeaheadError.js +0 -0
- package/dist/{Typeahead → TypeAhead}/TypeaheadList.js +2 -2
- package/dist/{Typeahead → TypeAhead}/TypeaheadLoading.js +0 -0
- package/dist/{Typeahead → TypeAhead}/TypeaheadMessage.js +3 -3
- package/dist/{Typeahead → TypeAhead}/TypeaheadNoResults.js +0 -0
- package/dist/{Typeahead → TypeAhead}/messages.js +0 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.3.18
|
|
4
|
+
|
|
5
|
+
- [Renamed] Typeahead prop `afterSelect` to `onSelect`
|
|
6
|
+
|
|
7
|
+
## 2.3.17
|
|
8
|
+
|
|
9
|
+
- [Added] Add `autoHeight` and `maxHeight` properties to textarea.
|
|
10
|
+
|
|
3
11
|
## 2.3.16
|
|
4
12
|
|
|
5
13
|
- [Added] Only disable a day or month if the disabledDays prop is present. Otherwise, treat as enabled
|
package/dist/Textarea.js
CHANGED
|
@@ -6,7 +6,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
6
|
|
|
7
7
|
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; }
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/* eslint-disable react/require-default-props */
|
|
10
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
10
11
|
import styled from "styled-components";
|
|
11
12
|
import { active, gray01, gray04, gray06 } from "@happeouikit/colors";
|
|
12
13
|
import PropTypes from "prop-types";
|
|
@@ -26,6 +27,30 @@ var Textarea = function Textarea(_ref) {
|
|
|
26
27
|
var accessibility = label ? {
|
|
27
28
|
"aria-labelledby": id
|
|
28
29
|
} : {};
|
|
30
|
+
var textareaRef = useRef(null);
|
|
31
|
+
useEffect(function () {
|
|
32
|
+
var textarea = textareaRef.current;
|
|
33
|
+
|
|
34
|
+
if (textarea) {
|
|
35
|
+
textarea.style.height = "".concat(Math.min(textarea.scrollHeight, props.maxHeight), "px");
|
|
36
|
+
}
|
|
37
|
+
}, [props.maxHeight]);
|
|
38
|
+
|
|
39
|
+
var onChange = function onChange(event) {
|
|
40
|
+
// Handle auto height
|
|
41
|
+
if (props.autoHeight) {
|
|
42
|
+
var target = event.target; // First set height to inherit to allow textarea to contract
|
|
43
|
+
|
|
44
|
+
target.style.height = "inherit";
|
|
45
|
+
target.style.height = "".concat(target.scrollHeight, "px");
|
|
46
|
+
} // call props.onChange if exists
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
if (typeof props.onChange === "function") {
|
|
50
|
+
props.onChange(event);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
29
54
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
30
55
|
children: [!!label && /*#__PURE__*/_jsx(Label, {
|
|
31
56
|
id: id,
|
|
@@ -33,16 +58,27 @@ var Textarea = function Textarea(_ref) {
|
|
|
33
58
|
color: gray01,
|
|
34
59
|
children: label
|
|
35
60
|
})
|
|
36
|
-
}), /*#__PURE__*/_jsx(StyledTextarea, _objectSpread(_objectSpread({
|
|
61
|
+
}), /*#__PURE__*/_jsx(StyledTextarea, _objectSpread(_objectSpread(_objectSpread({
|
|
62
|
+
ref: textareaRef,
|
|
37
63
|
cols: cols,
|
|
38
64
|
rows: rows
|
|
39
|
-
}, accessibility), props)
|
|
65
|
+
}, accessibility), props), {}, {
|
|
66
|
+
style: _objectSpread(_objectSpread({}, props.style), {}, {
|
|
67
|
+
maxHeight: props.maxHeight
|
|
68
|
+
}),
|
|
69
|
+
onChange: onChange
|
|
70
|
+
}))]
|
|
40
71
|
});
|
|
41
72
|
};
|
|
42
73
|
|
|
43
74
|
Textarea.propTypes = {
|
|
44
75
|
rows: PropTypes.number,
|
|
45
|
-
cols: PropTypes.number
|
|
76
|
+
cols: PropTypes.number,
|
|
77
|
+
autoHeight: PropTypes.bool,
|
|
78
|
+
maxHeight: PropTypes.number
|
|
79
|
+
};
|
|
80
|
+
Textarea.defaultProps = {
|
|
81
|
+
maxHeight: 9999
|
|
46
82
|
};
|
|
47
83
|
var StyledTextarea = styled.textarea.withConfig({
|
|
48
84
|
displayName: "Textarea__StyledTextarea",
|
|
@@ -17,7 +17,7 @@ var Typeahead = function Typeahead(_ref) {
|
|
|
17
17
|
var onQuery = _ref.onQuery,
|
|
18
18
|
loading = _ref.loading,
|
|
19
19
|
results = _ref.results,
|
|
20
|
-
|
|
20
|
+
onSelect = _ref.onSelect,
|
|
21
21
|
keepResult = _ref.keepResult,
|
|
22
22
|
placeholder = _ref.placeholder,
|
|
23
23
|
errorMessage = _ref.errorMessage,
|
|
@@ -97,7 +97,7 @@ var Typeahead = function Typeahead(_ref) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
setSelectedResult(result);
|
|
100
|
-
|
|
100
|
+
onSelect(result);
|
|
101
101
|
setFocusedResultIndex(null);
|
|
102
102
|
};
|
|
103
103
|
|
|
@@ -111,7 +111,7 @@ var Typeahead = function Typeahead(_ref) {
|
|
|
111
111
|
setFocusedResultIndex(null); // notify parent that selection was erased
|
|
112
112
|
|
|
113
113
|
if (selectedResult) {
|
|
114
|
-
|
|
114
|
+
onSelect(null);
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
|
|
@@ -205,7 +205,7 @@ var Typeahead = function Typeahead(_ref) {
|
|
|
205
205
|
|
|
206
206
|
var Wrapper = styled.div.withConfig({
|
|
207
207
|
displayName: "Typeahead__Wrapper",
|
|
208
|
-
componentId: "sc-
|
|
208
|
+
componentId: "sc-1ltsx56-0"
|
|
209
209
|
})(["width:100%;"]);
|
|
210
210
|
Typeahead.propTypes = {
|
|
211
211
|
onQuery: PropTypes.func.isRequired,
|
|
@@ -214,10 +214,10 @@ Typeahead.propTypes = {
|
|
|
214
214
|
text: PropTypes.string,
|
|
215
215
|
// This is used in association with keepResult
|
|
216
216
|
component: PropTypes.element.isRequired,
|
|
217
|
-
data: PropTypes.shape // You may add any data related to the result, so you can use it on
|
|
217
|
+
data: PropTypes.shape // You may add any data related to the result, so you can use it on onSelect
|
|
218
218
|
|
|
219
219
|
})).isRequired,
|
|
220
|
-
|
|
220
|
+
onSelect: PropTypes.func.isRequired,
|
|
221
221
|
keepResult: PropTypes.bool,
|
|
222
222
|
placeholder: PropTypes.string,
|
|
223
223
|
errorMessage: PropTypes.string,
|
|
@@ -16,11 +16,11 @@ var TypeaheadDropdown = function TypeaheadDropdown(_ref) {
|
|
|
16
16
|
|
|
17
17
|
var Dropdown = styled.div.withConfig({
|
|
18
18
|
displayName: "TypeaheadDropdown__Dropdown",
|
|
19
|
-
componentId: "sc-
|
|
19
|
+
componentId: "sc-1ycqak5-0"
|
|
20
20
|
})(["position:relative;display:block;width:100%;z-index:1000;"]);
|
|
21
21
|
var DropdownContent = styled.div.withConfig({
|
|
22
22
|
displayName: "TypeaheadDropdown__DropdownContent",
|
|
23
|
-
componentId: "sc-
|
|
23
|
+
componentId: "sc-1ycqak5-1"
|
|
24
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
25
|
return props.maxHeight;
|
|
26
26
|
});
|
|
File without changes
|
|
@@ -28,10 +28,10 @@ var TypeaheadList = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
28
28
|
});
|
|
29
29
|
var Container = styled.ul.withConfig({
|
|
30
30
|
displayName: "TypeaheadList__Container",
|
|
31
|
-
componentId: "sc-
|
|
31
|
+
componentId: "sc-1awb4an-0"
|
|
32
32
|
})(["padding:0px;margin:0px;"]);
|
|
33
33
|
var Row = styled.li.withConfig({
|
|
34
34
|
displayName: "TypeaheadList__Row",
|
|
35
|
-
componentId: "sc-
|
|
35
|
+
componentId: "sc-1awb4an-1"
|
|
36
36
|
})(["padding:9px 15px 9px 15px;border:solid 1px transparent;list-style-type:none;&:hover{background:", ";}"], toBgLight(active));
|
|
37
37
|
export default TypeaheadList;
|
|
File without changes
|
|
@@ -28,14 +28,14 @@ var TypeaheadMessage = function TypeaheadMessage(_ref) {
|
|
|
28
28
|
|
|
29
29
|
var Title = styled(TextEpsilon).withConfig({
|
|
30
30
|
displayName: "TypeaheadMessage__Title",
|
|
31
|
-
componentId: "sc-
|
|
31
|
+
componentId: "sc-1p8oq0t-0"
|
|
32
32
|
})(["text-align:center;margin-bottom:8px;"]);
|
|
33
33
|
var Details = styled(BodyUI).withConfig({
|
|
34
34
|
displayName: "TypeaheadMessage__Details",
|
|
35
|
-
componentId: "sc-
|
|
35
|
+
componentId: "sc-1p8oq0t-1"
|
|
36
36
|
})(["text-align:center;color:", ";"], gray04);
|
|
37
37
|
var Flexbox = styled.div.withConfig({
|
|
38
38
|
displayName: "TypeaheadMessage__Flexbox",
|
|
39
|
-
componentId: "sc-
|
|
39
|
+
componentId: "sc-1p8oq0t-2"
|
|
40
40
|
})(["display:flex;flex-direction:column;align-items:center;padding:24px;"]);
|
|
41
41
|
export default TypeaheadMessage;
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happeouikit/form-elements",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -44,5 +44,6 @@
|
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
|
-
}
|
|
47
|
+
},
|
|
48
|
+
"gitHead": "6ee9b04c42f0015770de88715a8079abddfc3599"
|
|
48
49
|
}
|