@happeouikit/form-elements 2.3.6 → 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 CHANGED
@@ -1,5 +1,10 @@
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
+
3
8
  ## 2.3.6
4
9
 
5
10
  - [Added] Added data-testids for datepicker components
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, { Fragment } from "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
- return /*#__PURE__*/_jsxs(Fragment, {
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.6",
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
  }