@happeouikit/form-elements 2.3.28 → 2.3.29

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.
Files changed (52) hide show
  1. package/dist/Badge.d.ts +21 -0
  2. package/dist/Checkbox.d.ts +27 -0
  3. package/dist/CheckboxGroup.d.ts +90 -0
  4. package/dist/DatePicker.d.ts +54 -0
  5. package/dist/DateTimePicker.d.ts +21 -0
  6. package/dist/Dropdown.d.ts +7 -0
  7. package/dist/Input.d.ts +13 -0
  8. package/dist/Input.types.d.ts +18 -0
  9. package/dist/Link.d.ts +3 -0
  10. package/dist/RadioButton.d.ts +19 -0
  11. package/dist/Switch.d.ts +19 -0
  12. package/dist/Tag.d.ts +15 -0
  13. package/dist/Textarea.d.ts +20 -0
  14. package/dist/Typeahead/Typeahead.d.ts +46 -0
  15. package/dist/Typeahead/TypeaheadDropdown.d.ts +5 -0
  16. package/dist/Typeahead/TypeaheadError.d.ts +2 -0
  17. package/dist/Typeahead/TypeaheadList.d.ts +3 -0
  18. package/dist/Typeahead/TypeaheadLoading.d.ts +4 -0
  19. package/dist/Typeahead/TypeaheadMessage.d.ts +7 -0
  20. package/dist/Typeahead/TypeaheadNoResults.d.ts +4 -0
  21. package/dist/Typeahead/messages.d.ts +37 -0
  22. package/dist/index.cjs.js +780 -0
  23. package/dist/index.cjs.js.map +1 -0
  24. package/dist/{index.js → index.d.ts} +1 -1
  25. package/dist/index.es.js +12478 -0
  26. package/dist/index.es.js.map +1 -0
  27. package/dist/messages.d.ts +91 -0
  28. package/dist/style.css +1 -0
  29. package/dist/utils.d.ts +8 -0
  30. package/package.json +18 -15
  31. package/dist/Badge.js +0 -41
  32. package/dist/Checkbox.js +0 -107
  33. package/dist/CheckboxGroup.js +0 -134
  34. package/dist/DatePicker.js +0 -445
  35. package/dist/DateTimePicker.js +0 -191
  36. package/dist/Dropdown.js +0 -65
  37. package/dist/Input.js +0 -151
  38. package/dist/Link.js +0 -51
  39. package/dist/RadioButton.js +0 -84
  40. package/dist/Switch.js +0 -70
  41. package/dist/Tag.js +0 -59
  42. package/dist/Textarea.js +0 -88
  43. package/dist/Typeahead/Typeahead.js +0 -214
  44. package/dist/Typeahead/TypeaheadDropdown.js +0 -25
  45. package/dist/Typeahead/TypeaheadError.js +0 -14
  46. package/dist/Typeahead/TypeaheadList.js +0 -37
  47. package/dist/Typeahead/TypeaheadLoading.js +0 -23
  48. package/dist/Typeahead/TypeaheadMessage.js +0 -39
  49. package/dist/Typeahead/TypeaheadNoResults.js +0 -17
  50. package/dist/Typeahead/messages.js +0 -29
  51. package/dist/messages.js +0 -63
  52. package/dist/utils.js +0 -51
package/dist/Dropdown.js DELETED
@@ -1,65 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["label"];
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- import React, { Fragment, forwardRef, useRef, useImperativeHandle } from "react";
7
- import styled, { css } from "styled-components";
8
- import Select, { components } from "react-select";
9
- import { IconArrowDropDown } from "@happeouikit/icons";
10
- import { active, gray01, gray06, gray05, toBgLight, gray04 } from "@happeouikit/colors";
11
- import { BodyUI, sansFamily } from "@happeouikit/typography";
12
- import { screen } from "@happeouikit/theme";
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import { jsxs as _jsxs } from "react/jsx-runtime";
15
- var Dropdown = function Dropdown(_ref, ref) {
16
- var label = _ref.label,
17
- props = _objectWithoutProperties(_ref, _excluded);
18
- var dropdownRef = useRef();
19
- useImperativeHandle(ref, function () {
20
- return {
21
- setValue: function setValue(value) {
22
- return dropdownRef.current.select.setValue(value);
23
- }
24
- };
25
- });
26
- return /*#__PURE__*/_jsxs(Fragment, {
27
- children: [!!label && /*#__PURE__*/_jsx(Label, {
28
- children: /*#__PURE__*/_jsx(BodyUI, {
29
- bold: true,
30
- color: gray01,
31
- children: label
32
- })
33
- }), /*#__PURE__*/_jsx(StyledDropdown, _objectSpread({
34
- "data-for": "datepicker-year-dropdown",
35
- classNamePrefix: "dropdown",
36
- components: _objectSpread({
37
- DropdownIndicator: DropdownIndicator
38
- }, props.components),
39
- hideOnMobile: props.hideOnMobile,
40
- ref: dropdownRef
41
- }, props))]
42
- });
43
- };
44
- var DropdownIndicator = function DropdownIndicator(props) {
45
- return components.DropdownIndicator && /*#__PURE__*/_jsx(components.DropdownIndicator, _objectSpread(_objectSpread({}, props), {}, {
46
- children: /*#__PURE__*/_jsx(IconArrowDropDown, {
47
- width: "24px",
48
- height: "24px",
49
- fill: gray06
50
- })
51
- }));
52
- };
53
- export var dropdownStyles = css(["min-width:200px;width:auto;font-family:", ";letter-spacing:-0.3px;font-size:14px;font-weight:normal;:hover{cursor:pointer;}.dropdown{&__indicator-separator{display:none;}&__indicator{padding:7px 8px;}&__control{border:1px solid ", ";box-shadow:none;:hover{border-color:", ";}:active{outline:none;border-color:", ";}:focus{outline:none;border-color:", ";}&--is-focused,&--is-focused:active{outline:none !important;border:1px solid ", " !important;box-shadow:none;}}&__input{input{box-shadow:none !important;}}&__menu{.dropdown__option--is-focused:not(.dropdown__option--is-selected){background:", ";}}&__placeholder{font-family:", ";color:", ";letter-spacing:-0.3px;font-size:14px;font-weight:normal;}}@media ", "{", ";}"], sansFamily, gray06, gray04, active, active, active, toBgLight(active), sansFamily, gray05, screen.onlyXs, function (_ref2) {
54
- var hideOnMobile = _ref2.hideOnMobile;
55
- return hideOnMobile && " display: none;";
56
- });
57
- var StyledDropdown = styled(Select).withConfig({
58
- displayName: "Dropdown__StyledDropdown",
59
- componentId: "sc-1i6nt19-0"
60
- })(["", ""], dropdownStyles);
61
- var Label = styled.div.withConfig({
62
- displayName: "Dropdown__Label",
63
- componentId: "sc-1i6nt19-1"
64
- })(["margin:4px 0;"]);
65
- export default /*#__PURE__*/forwardRef(Dropdown);
package/dist/Input.js DELETED
@@ -1,151 +0,0 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- var _excluded = ["label", "icon", "iconProps", "state", "errorMessage"],
4
- _excluded2 = ["label"];
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- import React from "react";
8
- import styled from "styled-components";
9
- import { gray01, gray04, gray08, gray05, gray06, active, black, success, alert } from "@happeouikit/colors";
10
- import { TinyText, sansFamily, BodyUI } from "@happeouikit/typography";
11
- import { uuidv4 } from "./utils";
12
-
13
- /**
14
- * Map input states to colors
15
- * @type {{default: string, success: string, error: string}}
16
- */
17
- import { jsx as _jsx } from "react/jsx-runtime";
18
- import { jsxs as _jsxs } from "react/jsx-runtime";
19
- var inputStates = {
20
- success: success,
21
- error: alert,
22
- "default": gray06
23
- };
24
-
25
- /**
26
- * HOC for customizing Icon components for input
27
- * @param IconComponent
28
- * @param iconProps
29
- * @returns {function(): *}
30
- */
31
- var IconWrapper = function IconWrapper(IconComponent, iconProps) {
32
- var iconDefaults = {
33
- width: "20px",
34
- height: "20px",
35
- fill: black
36
- };
37
- var style = {
38
- position: "absolute",
39
- top: "10px",
40
- left: "10px",
41
- fontSize: "18px"
42
- };
43
- var props = _objectSpread(_objectSpread({}, iconDefaults), iconProps);
44
- return function () {
45
- return /*#__PURE__*/_jsx(InputIconWrapper, {
46
- children: /*#__PURE__*/_jsx(IconComponent, _objectSpread(_objectSpread({}, props), {}, {
47
- style: style
48
- }))
49
- });
50
- };
51
- };
52
- export var Input = function Input(_ref) {
53
- var label = _ref.label,
54
- icon = _ref.icon,
55
- iconProps = _ref.iconProps,
56
- state = _ref.state,
57
- errorMessage = _ref.errorMessage,
58
- rest = _objectWithoutProperties(_ref, _excluded);
59
- var id = React.useMemo(uuidv4, []);
60
- var accessibility = label ? {
61
- "aria-labelledby": id
62
- } : {};
63
- return /*#__PURE__*/_jsxs(Container, {
64
- children: [!!label && /*#__PURE__*/_jsx(InputLabel, {
65
- id: id,
66
- children: /*#__PURE__*/_jsx(BodyUI, {
67
- bold: true,
68
- color: gray01,
69
- children: label
70
- })
71
- }), icon && IconWrapper(icon, iconProps)(), /*#__PURE__*/_jsx(StyledInput, _objectSpread(_objectSpread({
72
- title: label || "Styled input",
73
- hasIcon: (icon || "").toString(),
74
- state: state || "default"
75
- }, accessibility), rest)), state === "error" && errorMessage && /*#__PURE__*/_jsx(ErrorMessage, {
76
- color: alert,
77
- children: errorMessage
78
- })]
79
- });
80
- };
81
- var ErrorMessage = styled(TinyText).withConfig({
82
- displayName: "Input__ErrorMessage",
83
- componentId: "sc-igrift-0"
84
- })(["margin:8px 0;"]);
85
- var Container = styled.div.withConfig({
86
- displayName: "Input__Container",
87
- componentId: "sc-igrift-1"
88
- })(["display:flex;flex-direction:column;position:relative;width:100%;"]);
89
- var InputLabel = styled.div.withConfig({
90
- displayName: "Input__InputLabel",
91
- componentId: "sc-igrift-2"
92
- })(["margin:4px 0;"]);
93
- export var StyledInput = styled.input.attrs(function (_ref2) {
94
- var type = _ref2.type;
95
- return {
96
- type: type || "text"
97
- };
98
- }).withConfig({
99
- displayName: "Input__StyledInput",
100
- componentId: "sc-igrift-3"
101
- })(["::placeholder{font-family:sansFamily;color:gray05;letter-spacing:-0.3px;font-size:14px;font-weight:normal;}font-family:", ";width:100%;height:40px;border-radius:4px;border:solid 1px ", ";box-sizing:border-box;box-shadow:none;font-size:14px;padding:", ";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:", " !important;}:disabled{border:solid 1px ", ";color:", ";::placeholder{color:gray05;}}border-color:", ";"], sansFamily, gray06, function (_ref3) {
102
- var hasIcon = _ref3.hasIcon;
103
- return hasIcon ? "10px 12px 10px 38px" : "10px 12px";
104
- }, black, function (_ref4) {
105
- var _ref4$state = _ref4.state,
106
- state = _ref4$state === void 0 ? "default" : _ref4$state;
107
- return state === "default" ? gray04 : inputStates[state];
108
- }, function (_ref5) {
109
- var _ref5$state = _ref5.state,
110
- state = _ref5$state === void 0 ? "default" : _ref5$state;
111
- return state === "default" ? active : inputStates[state];
112
- }, function (_ref6) {
113
- var _ref6$state = _ref6.state,
114
- state = _ref6$state === void 0 ? "default" : _ref6$state;
115
- return state === "default" ? active : inputStates[state];
116
- }, gray08, gray05, function (_ref7) {
117
- var _ref7$state = _ref7.state,
118
- state = _ref7$state === void 0 ? "default" : _ref7$state;
119
- return inputStates[state];
120
- });
121
- var InputIconWrapper = styled.span.withConfig({
122
- displayName: "Input__InputIconWrapper",
123
- componentId: "sc-igrift-4"
124
- })(["position:relative;"]);
125
-
126
- /**
127
- * Number Input
128
- */
129
- export var InputNumber = function InputNumber(_ref8) {
130
- var label = _ref8.label,
131
- props = _objectWithoutProperties(_ref8, _excluded2);
132
- return /*#__PURE__*/_jsxs(InputNumberContainer, {
133
- children: [/*#__PURE__*/_jsx(StyledInputNumber, _objectSpread(_objectSpread({}, props), {}, {
134
- type: "number"
135
- })), label && /*#__PURE__*/_jsx(InputNumberLabel, {
136
- children: label
137
- })]
138
- });
139
- };
140
- var StyledInputNumber = styled(Input).withConfig({
141
- displayName: "Input__StyledInputNumber",
142
- componentId: "sc-igrift-5"
143
- })(["width:60px;text-align:center;font-size:14px;"]);
144
- var InputNumberContainer = styled.div.withConfig({
145
- displayName: "Input__InputNumberContainer",
146
- componentId: "sc-igrift-6"
147
- })(["display:flex;align-items:center;", "{width:auto;}"], Container);
148
- var InputNumberLabel = styled(BodyUI).withConfig({
149
- displayName: "Input__InputNumberLabel",
150
- componentId: "sc-igrift-7"
151
- })(["color:", ";margin-left:10px;"], gray01);
package/dist/Link.js DELETED
@@ -1,51 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import React from "react";
5
- import PropTypes from "prop-types";
6
- import styled from "styled-components";
7
- import { BodyUI } from "@happeouikit/typography";
8
- import { active } from "@happeouikit/colors";
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- export var Link = /*#__PURE__*/React.forwardRef(function (props, ref) {
11
- return /*#__PURE__*/_jsx(StyledLink, _objectSpread(_objectSpread({
12
- ref: ref,
13
- as: "a"
14
- }, props), {}, {
15
- children: props.children
16
- }));
17
- });
18
- export var LinkExternal = /*#__PURE__*/React.forwardRef(function (props, ref) {
19
- return /*#__PURE__*/_jsx(StyledLink, _objectSpread(_objectSpread({
20
- ref: ref,
21
- as: "a",
22
- target: "_blank",
23
- rel: "nofollow noopener"
24
- }, props), {}, {
25
- children: props.children
26
- }));
27
- });
28
- var StyledLink = styled(BodyUI).withConfig({
29
- displayName: "Link__StyledLink",
30
- componentId: "sc-11s0n25-0"
31
- })(["text-decoration:", ";color:", ";:hover{color:", ";text-decoration:underline;}"], function (_ref) {
32
- var underline = _ref.underline;
33
- return underline ? "underline" : "none";
34
- }, function (_ref2) {
35
- var color = _ref2.color;
36
- return color || active;
37
- }, function (_ref3) {
38
- var hoverColor = _ref3.hoverColor;
39
- return hoverColor || active;
40
- });
41
- Link.propTypes = {
42
- color: PropTypes.string,
43
- hoverColor: PropTypes.string,
44
- underline: PropTypes.bool,
45
- children: PropTypes.node
46
- };
47
- Link.defaultProps = {
48
- color: active,
49
- hoverColor: active,
50
- underline: false
51
- };
@@ -1,84 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["label", "subtitle", "description"];
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- import React, { useState } from "react";
8
- import styled from "styled-components";
9
- import PropTypes from "prop-types";
10
- import { BodyUI } from "@happeouikit/typography";
11
- import { uuidv4 } from "./utils";
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { jsxs as _jsxs } from "react/jsx-runtime";
14
- var RadioButton = function RadioButton(_ref) {
15
- var label = _ref.label,
16
- subtitle = _ref.subtitle,
17
- description = _ref.description,
18
- props = _objectWithoutProperties(_ref, _excluded);
19
- var _useState = useState(function () {
20
- return props.id || "radio_".concat(uuidv4());
21
- }),
22
- _useState2 = _slicedToArray(_useState, 1),
23
- id = _useState2[0];
24
- return /*#__PURE__*/_jsxs(RadioButtonWrapper, {
25
- children: [/*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({
26
- type: "radio",
27
- "aria-describedby": description ? "".concat(id, "_description") : null
28
- }, props), {}, {
29
- id: id
30
- })), /*#__PURE__*/_jsx(StyledRadioButton, {}), label && /*#__PURE__*/_jsxs(TextContainer, {
31
- children: [/*#__PURE__*/_jsxs(LabelRow, {
32
- children: [label && /*#__PURE__*/_jsx(Label, {
33
- bold: true,
34
- htmlFor: id,
35
- "data-tip": props["data-tip"],
36
- "data-tip-disable": props["data-tip-disable"],
37
- children: label
38
- }), subtitle && /*#__PURE__*/_jsx(Subtitle, {
39
- children: subtitle
40
- })]
41
- }), description && /*#__PURE__*/_jsx(Description, {
42
- id: "".concat(id, "_description"),
43
- children: description
44
- })]
45
- })]
46
- });
47
- };
48
- RadioButton.propTypes = {
49
- label: PropTypes.node,
50
- subtitle: PropTypes.node,
51
- description: PropTypes.node
52
- };
53
- RadioButton.defaultProps = {
54
- label: null
55
- };
56
- var StyledRadioButton = styled.span.withConfig({
57
- displayName: "RadioButton__StyledRadioButton",
58
- componentId: "sc-gwa7wx-0"
59
- })(["position:relative;height:20px;width:20px;background-color:var(--color-surface,#ffffff);border:2px solid var(--color-stroke,#ffffff);border-radius:var(--radius-circle,50%);flex-shrink:0;input:focus + &{:before{content:\"\";position:absolute;top:-4px;left:-4px;right:-4px;bottom:-4px;border-radius:var(--radius-circle,50%);border:1px solid var(--color-focus-indicator,#0075db);}}"]);
60
- var TextContainer = styled.div.withConfig({
61
- displayName: "RadioButton__TextContainer",
62
- componentId: "sc-gwa7wx-1"
63
- })(["display:flex;flex-direction:column;gap:var(--space-xxs,2px);"]);
64
- var LabelRow = styled.div.withConfig({
65
- displayName: "RadioButton__LabelRow",
66
- componentId: "sc-gwa7wx-2"
67
- })(["display:flex;gap:var(--space-sm,8px);"]);
68
- var Subtitle = styled(BodyUI).withConfig({
69
- displayName: "RadioButton__Subtitle",
70
- componentId: "sc-gwa7wx-3"
71
- })(["color:var(--color-secondary-text-on-light,#2b313b);font-size:12px;"]);
72
- var Description = styled(BodyUI).withConfig({
73
- displayName: "RadioButton__Description",
74
- componentId: "sc-gwa7wx-4"
75
- })(["color:var(--color-primary-text-on-light,#2b313b);"]);
76
- var Label = styled(BodyUI).withConfig({
77
- displayName: "RadioButton__Label",
78
- componentId: "sc-gwa7wx-5"
79
- })(["color:var(--color-primary-text-on-light,#2b313b);"]);
80
- var RadioButtonWrapper = styled.label.withConfig({
81
- displayName: "RadioButton__RadioButtonWrapper",
82
- componentId: "sc-gwa7wx-6"
83
- })(["display:flex;align-items:flex-start;position:relative;cursor:pointer;user-select:none;gap:var(--space-sm,8px);input{position:absolute;opacity:0;z-index:-1;}:hover{input:not(:disabled) + ", "{border-color:var(--color-stroke-darken,#596578);}input:checked + ", "{border-color:var(--color-active-primary,#0075db);}}input:checked + ", "{border-color:var(--color-active-primary,#0075db);:after{content:\"\";position:absolute;top:3px;left:3px;right:3px;bottom:3px;border-radius:var(--radius-circle,50%);background-color:var(--color-active-primary,#0075db);}}input:disabled + ", "{cursor:not-allowed;opacity:0.3;border-color:var(--color-stroke-darken,#596578) !important;:after{background-color:var(--color-stroke-darken,#596578) !important;}}input:disabled ~ ", "{color:var(--color-gray600,#596578);cursor:not-allowed;}"], StyledRadioButton, StyledRadioButton, StyledRadioButton, StyledRadioButton, Label);
84
- export default RadioButton;
package/dist/Switch.js DELETED
@@ -1,70 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["label", "tabIndex"];
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- import React, { useRef } from "react";
7
- import styled from "styled-components";
8
- import PropTypes from "prop-types";
9
- import { active, gray08, gray01 } from "@happeouikit/colors";
10
- import { BodyUI } from "@happeouikit/typography";
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- import { jsxs as _jsxs } from "react/jsx-runtime";
13
- var Switch = function Switch(_ref) {
14
- var label = _ref.label,
15
- tabIndex = _ref.tabIndex,
16
- props = _objectWithoutProperties(_ref, _excluded);
17
- var checkboxRef = useRef();
18
- var onClick = function onClick(event) {
19
- event.preventDefault();
20
- // Since this component can be used as controlled or uncontrolled
21
- // it should have the ability to change aria-label based on its state
22
- // eslint-disable-next-line no-param-reassign
23
- event.currentTarget.ariaChecked = !checkboxRef.current.checked;
24
- checkboxRef.current.checked = !checkboxRef.current.checked;
25
- props.onChange(event);
26
- };
27
- var onKeyDown = function onKeyDown(event) {
28
- if (typeof props.onChange === "function" && event.key.match(/enter|spacebar|\W{1}/i)) {
29
- onClick(event);
30
- }
31
- };
32
- return /*#__PURE__*/_jsxs(ToggleSwitchWrapper, {
33
- children: [/*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({
34
- ref: checkboxRef,
35
- type: "checkbox"
36
- }, props), {}, {
37
- tabIndex: -1
38
- })), /*#__PURE__*/_jsx(StyledSwitch, _objectSpread({
39
- type: "button",
40
- onKeyDown: onKeyDown,
41
- onClick: onClick,
42
- tabIndex: tabIndex,
43
- role: "switch",
44
- "aria-checked": props.checked || props.defaultChecked
45
- }, props)), label && /*#__PURE__*/_jsx(Label, {
46
- children: label
47
- })]
48
- });
49
- };
50
- Switch.propTypes = {
51
- label: PropTypes.node,
52
- tabIndex: PropTypes.number
53
- };
54
- Switch.defaultProps = {
55
- label: undefined,
56
- tabIndex: 0
57
- };
58
- var StyledSwitch = styled.button.withConfig({
59
- displayName: "Switch__StyledSwitch",
60
- componentId: "sc-1v8j4x4-0"
61
- })(["all:unset;position:relative;top:0;left:0;right:0;bottom:0;box-sizing:content-box;width:40px;height:20px;background-color:white;border:2px solid ", ";border-radius:13px;transition:0.4s;:before{position:absolute;content:\"\";height:14px;width:14px;left:3px;bottom:3px;border-radius:50%;background-color:", ";transition:0.4s;}&:focus-visible{outline:0;box-shadow:0 0 0 1px ", ";}&:hover{background-color:transparent;}&:active{background-color:transparent;transform:none;box-shadow:none;}"], gray08, gray08, active);
62
- var ToggleSwitchWrapper = styled.label.withConfig({
63
- displayName: "Switch__ToggleSwitchWrapper",
64
- componentId: "sc-1v8j4x4-1"
65
- })(["display:flex;align-items:center;position:relative;cursor:pointer;line-height:33px;padding:8px 0;input{opacity:0;width:0;height:0;}input:checked + ", "{border:2px solid ", ";}input:checked + ", ":before{transform:translateX(20px);background:", ";}input:disabled + ", "{border-color:", ";&:before{background:", ";}}"], StyledSwitch, active, StyledSwitch, active, StyledSwitch, gray08, gray08);
66
- var Label = styled(BodyUI).withConfig({
67
- displayName: "Switch__Label",
68
- componentId: "sc-1v8j4x4-2"
69
- })(["margin-left:8px;color:", ";"], gray01);
70
- export default Switch;
package/dist/Tag.js DELETED
@@ -1,59 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["text", "closeCallback", "isUppercase"];
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- import React, { useState } from "react";
8
- import styled from "styled-components";
9
- import PropTypes from "prop-types";
10
- import { white, active } from "@happeouikit/colors";
11
- import { IconClose } from "@happeouikit/icons";
12
- import { BodyUI } from "@happeouikit/typography";
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import { jsxs as _jsxs } from "react/jsx-runtime";
15
- var Tag = function Tag(_ref) {
16
- var text = _ref.text,
17
- closeCallback = _ref.closeCallback,
18
- isUppercase = _ref.isUppercase,
19
- props = _objectWithoutProperties(_ref, _excluded);
20
- var _useState = useState(true),
21
- _useState2 = _slicedToArray(_useState, 2),
22
- show = _useState2[0],
23
- setShow = _useState2[1];
24
- var onClick = function onClick() {
25
- setShow(false);
26
- closeCallback && closeCallback();
27
- };
28
- return show && /*#__PURE__*/_jsxs(TagWrapper, _objectSpread(_objectSpread({}, props), {}, {
29
- children: [/*#__PURE__*/_jsx(Text, {
30
- bold: true,
31
- uppercase: isUppercase,
32
- children: text
33
- }), /*#__PURE__*/_jsx(IconWrapper, {
34
- onClick: onClick,
35
- children: /*#__PURE__*/_jsx(IconClose, {
36
- width: "16px",
37
- height: "16px"
38
- })
39
- })]
40
- }));
41
- };
42
- Tag.propTypes = {
43
- text: PropTypes.node.isRequired,
44
- closeCallback: PropTypes.func,
45
- isUppercase: PropTypes.bool
46
- };
47
- var TagWrapper = styled.div.withConfig({
48
- displayName: "Tag__TagWrapper",
49
- componentId: "sc-1b21q6r-0"
50
- })(["display:inline;background:", ";height:24px;width:auto;border-radius:100px;"], active);
51
- var IconWrapper = styled.span.withConfig({
52
- displayName: "Tag__IconWrapper",
53
- componentId: "sc-1b21q6r-1"
54
- })(["display:inline-block;position:relative;right:5px;fill:", ";cursor:pointer;padding-right:10px;"], white);
55
- var Text = styled(BodyUI).withConfig({
56
- displayName: "Tag__Text",
57
- componentId: "sc-1b21q6r-2"
58
- })(["display:inline-block;position:relative;padding:2px 11.6px 2px 10px;bottom:3px;color:", ";"], white);
59
- export default Tag;
package/dist/Textarea.js DELETED
@@ -1,88 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["cols", "rows", "label"];
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- /* eslint-disable react/require-default-props */
7
- import React, { useEffect, useRef, useState } from "react";
8
- import styled from "styled-components";
9
- import { active, gray01, gray04, gray06 } from "@happeouikit/colors";
10
- import PropTypes from "prop-types";
11
- import { BodyUI, sansFamily } from "@happeouikit/typography";
12
- import { uuidv4 } from "./utils";
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import { Fragment as _Fragment } from "react/jsx-runtime";
15
- import { jsxs as _jsxs } from "react/jsx-runtime";
16
- var Textarea = function Textarea(_ref) {
17
- var cols = _ref.cols,
18
- rows = _ref.rows,
19
- label = _ref.label,
20
- props = _objectWithoutProperties(_ref, _excluded);
21
- var id = useState(uuidv4)[0];
22
- var accessibility = label ? {
23
- "aria-labelledby": id
24
- } : {};
25
- var textareaRef = useRef(null);
26
- useEffect(function () {
27
- var textarea = textareaRef.current;
28
- if (textarea) {
29
- textarea.style.height = "".concat(Math.min(textarea.scrollHeight, props.maxHeight), "px");
30
- }
31
- }, [props.maxHeight]);
32
- var onChange = function onChange(event) {
33
- // Handle auto height
34
- if (props.autoHeight) {
35
- var target = event.target;
36
-
37
- // First set height to inherit to allow textarea to contract
38
- target.style.height = "inherit";
39
- target.style.height = "".concat(target.scrollHeight, "px");
40
- }
41
-
42
- // call props.onChange if exists
43
- if (typeof props.onChange === "function") {
44
- props.onChange(event);
45
- }
46
- };
47
- return /*#__PURE__*/_jsxs(_Fragment, {
48
- children: [!!label && /*#__PURE__*/_jsx(Label, {
49
- id: id,
50
- children: /*#__PURE__*/_jsx(BodyUI, {
51
- bold: true,
52
- color: gray01,
53
- children: label
54
- })
55
- }), /*#__PURE__*/_jsx(StyledTextarea, _objectSpread(_objectSpread(_objectSpread({
56
- ref: textareaRef,
57
- cols: cols,
58
- rows: rows
59
- }, accessibility), props), {}, {
60
- style: _objectSpread(_objectSpread({}, props.style), {}, {
61
- maxHeight: props.maxHeight
62
- }),
63
- onChange: onChange
64
- }))]
65
- });
66
- };
67
- Textarea.propTypes = {
68
- rows: PropTypes.number,
69
- cols: PropTypes.number,
70
- autoHeight: PropTypes.bool,
71
- maxHeight: PropTypes.number
72
- };
73
- Textarea.defaultProps = {
74
- maxHeight: 9999
75
- };
76
- var StyledTextarea = styled.textarea.withConfig({
77
- displayName: "Textarea__StyledTextarea",
78
- componentId: "sc-15109nt-0"
79
- })(["font-family:", ";border-radius:4px;", ";", ";padding:10px 12px;border:solid 1px ", ";box-sizing:border-box;box-shadow:none;font-size:14px;:hover{border-color:", ";}:active{outline:none;border-color:", ";}:focus{outline:none;border-color:", ";}"], sansFamily, function (props) {
80
- return props.cols ? "" : "width: 100%;";
81
- }, function (props) {
82
- return props.rows ? "" : "height: 100%;";
83
- }, gray06, gray04, active, active);
84
- var Label = styled.div.withConfig({
85
- displayName: "Textarea__Label",
86
- componentId: "sc-15109nt-1"
87
- })(["margin:4px 0;"]);
88
- export default Textarea;