@happeouikit/form-elements 2.3.4 → 2.3.7
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 +13 -0
- package/dist/DatePicker.js +16 -8
- package/dist/Textarea.js +10 -3
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.3.7
|
|
4
|
+
|
|
5
|
+
- [Added] Textarea. Added id autogeneration to the label and aria-labelledby to the textarea. Accessibility issue.
|
|
6
|
+
- [Added] Textarea. Added a label to the documentation textarea example.
|
|
7
|
+
|
|
8
|
+
## 2.3.6
|
|
9
|
+
|
|
10
|
+
- [Added] Added data-testids for datepicker components
|
|
11
|
+
|
|
12
|
+
## 2.3.5
|
|
13
|
+
|
|
14
|
+
- [Added] Added the option to pass dayPickerProps
|
|
15
|
+
|
|
3
16
|
## 2.3.4
|
|
4
17
|
|
|
5
18
|
- [Fixed] DatePicker. Added htmlFor to the label and input ID autogeneration. Accessibility issue.
|
package/dist/DatePicker.js
CHANGED
|
@@ -70,7 +70,9 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
70
70
|
pickerRef = _ref.pickerRef,
|
|
71
71
|
_ref$inputProps = _ref.inputProps,
|
|
72
72
|
inputProps = _ref$inputProps === void 0 ? {} : _ref$inputProps,
|
|
73
|
-
|
|
73
|
+
_ref$dayPickerProps = _ref.dayPickerProps,
|
|
74
|
+
dayPickerProps = _ref$dayPickerProps === void 0 ? {} : _ref$dayPickerProps,
|
|
75
|
+
props = _objectWithoutProperties(_ref, ["label", "locale", "width", "date", "type", "fromMonth", "disabledDays", "value", "pickerRef", "inputProps", "dayPickerProps"]);
|
|
74
76
|
|
|
75
77
|
// Stores the ID of the input field. If "id" isn't provided, it will be generated
|
|
76
78
|
// to improve accessibility by linking label to the input field.
|
|
@@ -114,7 +116,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
114
116
|
formatDate: formatDate,
|
|
115
117
|
parseDate: parseDate,
|
|
116
118
|
placeholder: formatValue(new Date(), locale),
|
|
117
|
-
dayPickerProps: {
|
|
119
|
+
dayPickerProps: _objectSpread({
|
|
118
120
|
locale: locale,
|
|
119
121
|
localeUtils: MomentLocaleUtils,
|
|
120
122
|
className: "Range",
|
|
@@ -135,7 +137,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
135
137
|
}),
|
|
136
138
|
showOutsideDays: true,
|
|
137
139
|
month: month
|
|
138
|
-
},
|
|
140
|
+
}, dayPickerProps),
|
|
139
141
|
ref: pickerRef,
|
|
140
142
|
inputProps: _objectSpread({
|
|
141
143
|
id: datePickerId
|
|
@@ -146,7 +148,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
146
148
|
|
|
147
149
|
DatePicker.defaultProps = {
|
|
148
150
|
type: "to",
|
|
149
|
-
fromMonth: new Date(),
|
|
151
|
+
fromMonth: new Date() || "",
|
|
150
152
|
date: {
|
|
151
153
|
from: "",
|
|
152
154
|
to: ""
|
|
@@ -159,7 +161,7 @@ DatePicker.defaultProps = {
|
|
|
159
161
|
disabledDays: []
|
|
160
162
|
};
|
|
161
163
|
DatePicker.propTypes = {
|
|
162
|
-
fromMonth: PropTypes.instanceOf(Date),
|
|
164
|
+
fromMonth: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
|
163
165
|
label: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
164
166
|
locale: PropTypes.string,
|
|
165
167
|
width: PropTypes.string,
|
|
@@ -216,7 +218,8 @@ var CustomNavbar = function CustomNavbar(_ref3) {
|
|
|
216
218
|
},
|
|
217
219
|
"aria-label": intl.formatMessage(messages.pickerPrevMonth),
|
|
218
220
|
"data-tip": true,
|
|
219
|
-
"data-for": "datepicker-prev-month"
|
|
221
|
+
"data-for": "datepicker-prev-month",
|
|
222
|
+
"data-testid": "datepicker-select-prev-month"
|
|
220
223
|
}), /*#__PURE__*/_jsx(ButtonSecondary, {
|
|
221
224
|
onClick: function onClick() {
|
|
222
225
|
return setShowYearMonthPicker(true);
|
|
@@ -224,6 +227,7 @@ var CustomNavbar = function CustomNavbar(_ref3) {
|
|
|
224
227
|
"aria-label": intl.formatMessage(messages.pickerSelectYear),
|
|
225
228
|
"data-tip": true,
|
|
226
229
|
"data-for": "datepicker-select-year",
|
|
230
|
+
"data-testid": "datepicker-select-year",
|
|
227
231
|
text: moment(month).format("MMMM YYYY")
|
|
228
232
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
229
233
|
icon: IconChevronRight,
|
|
@@ -233,7 +237,8 @@ var CustomNavbar = function CustomNavbar(_ref3) {
|
|
|
233
237
|
},
|
|
234
238
|
"aria-label": intl.formatMessage(messages.pickerNextMonth),
|
|
235
239
|
"data-tip": true,
|
|
236
|
-
"data-for": "datepicker-next-month"
|
|
240
|
+
"data-for": "datepicker-next-month",
|
|
241
|
+
"data-testid": "datepicker-select-next-month"
|
|
237
242
|
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
238
243
|
id: "datepicker-prev-month",
|
|
239
244
|
content: intl.formatMessage(messages.pickerPrevMonth)
|
|
@@ -313,6 +318,7 @@ var MonthPicker = function MonthPicker(_ref4) {
|
|
|
313
318
|
|
|
314
319
|
return /*#__PURE__*/_jsxs(YearMonthSelectContainer, {
|
|
315
320
|
children: [/*#__PURE__*/_jsx(YearSelectContainer, {
|
|
321
|
+
"data-testid": "yearmonth-dropdown-select",
|
|
316
322
|
children: /*#__PURE__*/_jsx(Dropdown, {
|
|
317
323
|
"aria-label": intl.formatMessage(messages.selectYearDropdown),
|
|
318
324
|
options: getYears(),
|
|
@@ -332,6 +338,7 @@ var MonthPicker = function MonthPicker(_ref4) {
|
|
|
332
338
|
return /*#__PURE__*/_jsx("li", {
|
|
333
339
|
value: i,
|
|
334
340
|
children: /*#__PURE__*/_jsx(MonthSelectButton2, {
|
|
341
|
+
"data-testid": "select-month-".concat(month),
|
|
335
342
|
"data-for": "datepicker-select-month-button",
|
|
336
343
|
$isActive: i === selectedMonth,
|
|
337
344
|
onClick: function onClick() {
|
|
@@ -353,7 +360,8 @@ var MonthPicker = function MonthPicker(_ref4) {
|
|
|
353
360
|
});
|
|
354
361
|
},
|
|
355
362
|
"data-tip": true,
|
|
356
|
-
"data-for": "datepicker-year-month-done"
|
|
363
|
+
"data-for": "datepicker-year-month-done",
|
|
364
|
+
"data-testid": "datepicker-year-month-done"
|
|
357
365
|
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
358
366
|
id: "datepicker-year-month-done",
|
|
359
367
|
content: intl.formatMessage(messages.closeYearMonthPicker)
|
package/dist/Textarea.js
CHANGED
|
@@ -5,12 +5,14 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
5
5
|
|
|
6
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; }
|
|
7
7
|
|
|
8
|
-
import React, {
|
|
8
|
+
import React, { useState } from "react";
|
|
9
9
|
import styled from "styled-components";
|
|
10
10
|
import { active, gray01, gray04, gray06 } from "@happeouikit/colors";
|
|
11
11
|
import PropTypes from "prop-types";
|
|
12
12
|
import { BodyUI, sansFamily } from "@happeouikit/typography";
|
|
13
|
+
import { uuidv4 } from "./utils";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
17
|
|
|
16
18
|
var Textarea = function Textarea(_ref) {
|
|
@@ -19,8 +21,13 @@ var Textarea = function Textarea(_ref) {
|
|
|
19
21
|
label = _ref.label,
|
|
20
22
|
props = _objectWithoutProperties(_ref, ["cols", "rows", "label"]);
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
var id = useState(uuidv4)[0];
|
|
25
|
+
var accessibility = label ? {
|
|
26
|
+
"aria-labelledby": id
|
|
27
|
+
} : {};
|
|
28
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
23
29
|
children: [!!label && /*#__PURE__*/_jsx(Label, {
|
|
30
|
+
id: id,
|
|
24
31
|
children: /*#__PURE__*/_jsx(BodyUI, {
|
|
25
32
|
color: gray01,
|
|
26
33
|
children: label
|
|
@@ -28,7 +35,7 @@ var Textarea = function Textarea(_ref) {
|
|
|
28
35
|
}), /*#__PURE__*/_jsx(StyledTextarea, _objectSpread({
|
|
29
36
|
cols: cols,
|
|
30
37
|
rows: rows
|
|
31
|
-
}, props))]
|
|
38
|
+
}, accessibility, {}, props))]
|
|
32
39
|
});
|
|
33
40
|
};
|
|
34
41
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happeouikit/form-elements",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.7",
|
|
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": "274c77c141f32e13d4e40582fa9cad372a40b46f"
|
|
48
49
|
}
|