orcs-design-system 3.2.4 → 3.2.6

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 (96) hide show
  1. package/es/GlobalStyles.js +1 -31
  2. package/es/SystemThemeProvider.js +11 -5
  3. package/es/assets/Colour/Colour.stories.js +211 -0
  4. package/es/assets/Colour/index.js +3 -3
  5. package/es/components/ActionsMenu/ActionsMenu.stories.js +260 -233
  6. package/es/components/ActionsMenu/index.js +144 -229
  7. package/es/components/Avatar/Avatar.stories.js +212 -196
  8. package/es/components/Avatar/index.js +280 -307
  9. package/es/components/Badge/Badge.stories.js +71 -46
  10. package/es/components/Badge/index.js +71 -74
  11. package/es/components/Box/Box.stories.js +51 -35
  12. package/es/components/Box/index.js +33 -34
  13. package/es/components/Button/Button.stories.js +161 -145
  14. package/es/components/Button/ButtonLink.stories.js +152 -139
  15. package/es/components/Button/index.js +79 -99
  16. package/es/components/ButtonGroup/ButtonGroup.stories.js +43 -42
  17. package/es/components/ButtonGroup/ButtonGroupItem.stories.js +11 -13
  18. package/es/components/ButtonGroup/index.js +103 -99
  19. package/es/components/Card/Card.stories.js +94 -62
  20. package/es/components/Card/index.js +50 -71
  21. package/es/components/Checkbox/Checkbox.stories.js +37 -43
  22. package/es/components/Checkbox/index.js +61 -76
  23. package/es/components/DatePicker/DatePicker.stories.js +86 -118
  24. package/es/components/DatePicker/index.js +71 -187
  25. package/es/components/Divider/Divider.stories.js +39 -42
  26. package/es/components/Divider/index.js +21 -27
  27. package/es/components/Expandable/Expandable.stories.js +46 -36
  28. package/es/components/Expandable/index.js +55 -82
  29. package/es/components/Flex/Flex.stories.js +19 -5
  30. package/es/components/Flex/FlexItem.stories.js +10 -9
  31. package/es/components/Flex/index.js +34 -27
  32. package/es/components/Grid/Grid.stories.js +129 -55
  33. package/es/components/Grid/index.js +25 -24
  34. package/es/components/Header/Header.stories.js +101 -92
  35. package/es/components/Header/index.js +433 -436
  36. package/es/components/HeaderSimple/HeaderSimple.stories.js +23 -27
  37. package/es/components/HeaderSimple/index.js +73 -68
  38. package/es/components/Icon/Icon.stories.js +58 -57
  39. package/es/components/Icon/index.js +48 -46
  40. package/es/components/Loading/Loading.stories.js +32 -39
  41. package/es/components/Loading/index.js +44 -51
  42. package/es/components/Modal/Modal.stories.js +172 -153
  43. package/es/components/Modal/index.js +126 -134
  44. package/es/components/Notification/Notification.stories.js +59 -58
  45. package/es/components/Notification/index.js +123 -133
  46. package/es/components/Popover/Popover.stories.js +134 -102
  47. package/es/components/Popover/index.js +65 -111
  48. package/es/components/ProgressBar/ProgressBar.stories.js +36 -39
  49. package/es/components/ProgressBar/index.js +29 -34
  50. package/es/components/RadioButton/RadioButton.stories.js +32 -37
  51. package/es/components/RadioButton/index.js +170 -184
  52. package/es/components/Range/Range.stories.js +19 -19
  53. package/es/components/Range/index.js +35 -45
  54. package/es/components/Select/Select.stories.js +107 -128
  55. package/es/components/Select/index.js +324 -336
  56. package/es/components/SideNav/NavItem.js +112 -122
  57. package/es/components/SideNav/SideNav.stories.js +84 -57
  58. package/es/components/SideNav/index.js +161 -185
  59. package/es/components/Sidebar/Sidebar.stories.js +50 -33
  60. package/es/components/Sidebar/index.js +152 -155
  61. package/es/components/Spacer/Spacer.stories.js +35 -32
  62. package/es/components/Spacer/index.js +20 -20
  63. package/es/components/StatusDot/StatusDot.stories.js +103 -90
  64. package/es/components/StatusDot/index.js +36 -38
  65. package/es/components/StyledLink/StyledLink.stories.js +68 -69
  66. package/es/components/StyledLink/index.js +47 -48
  67. package/es/components/Table/Table.stories.js +118 -112
  68. package/es/components/Table/getExpandColumnConfig.js +67 -62
  69. package/es/components/Table/index.js +24 -27
  70. package/es/components/Table/muiStyleOverrides.js +10 -8
  71. package/es/components/Tabs/Tab.stories.js +55 -38
  72. package/es/components/Tabs/TabsContainer.stories.js +30 -22
  73. package/es/components/Tabs/index.js +95 -92
  74. package/es/components/Tag/Tag.stories.js +250 -220
  75. package/es/components/Tag/index.js +118 -190
  76. package/es/components/TextArea/TextArea.stories.js +76 -89
  77. package/es/components/TextArea/index.js +117 -115
  78. package/es/components/TextInput/TextInput.stories.js +41 -61
  79. package/es/components/TextInput/index.js +127 -171
  80. package/es/components/Toggle/Toggle.stories.js +63 -62
  81. package/es/components/Toggle/index.js +43 -77
  82. package/es/components/TreeNav/TreeNav.stories.js +7 -8
  83. package/es/components/TreeNav/index.js +72 -69
  84. package/es/components/Typography/Typography.stories.js +174 -0
  85. package/es/components/Typography/index.js +252 -308
  86. package/es/components.test.js +1 -1
  87. package/es/hooks/isVisible.js +6 -10
  88. package/es/hooks/keepInView.js +27 -32
  89. package/es/hooks/keypress.js +14 -14
  90. package/es/hooks/useInputFocus.js +5 -5
  91. package/es/hooks/usePrevious.js +3 -3
  92. package/es/systemThemeCollapsed.js +53 -53
  93. package/es/systemtheme.js +53 -53
  94. package/es/utils/selectUtil.js +1 -1
  95. package/es/utils/selectUtil.test.js +6 -6
  96. package/package.json +29 -38
@@ -1,8 +1,3 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
- import _extends from "@babel/runtime/helpers/extends";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
- var _excluded = ["numberProps"];
6
1
  import React, { useMemo } from "react";
7
2
  import { NumericFormat } from "react-number-format";
8
3
  import PropTypes from "prop-types";
@@ -13,192 +8,153 @@ import { createShouldForwardProp, props } from "@styled-system/should-forward-pr
13
8
  import Icon from "../Icon";
14
9
  import { themeGet } from "@styled-system/theme-get";
15
10
  import useInputFocus from "../../hooks/useInputFocus";
16
- var InputStyles = compose(space, layout);
17
- var shouldForwardProp = createShouldForwardProp([].concat(_toConsumableArray(props), ["type", "placeholder", "defaultValue", "disabled", "maxLength", "pattern", "required", "autocomplete", "autofocus", "step", "readonly"]));
18
- var Group = styled("div").withConfig({
19
- shouldForwardProp: shouldForwardProp,
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ const InputStyles = compose(space, layout);
13
+ const shouldForwardProp = createShouldForwardProp([...props, "type", "placeholder", "defaultValue", "disabled", "maxLength", "pattern", "required", "autocomplete", "autofocus", "step", "readonly"]);
14
+ const Group = styled("div").withConfig({
15
+ shouldForwardProp,
20
16
  displayName: "TextInput__Group",
21
17
  componentId: "sc-shde0o-0"
22
- })(function (props) {
23
- return sscss({
24
- position: "relative",
25
- width: props.fullWidth ? "100%" : "auto"
26
- });
27
- }, InputStyles);
28
- var IconWrapper = styled.label.withConfig({
18
+ })(props => sscss({
19
+ position: "relative",
20
+ width: props.fullWidth ? "100%" : "auto"
21
+ }), InputStyles);
22
+ const IconWrapper = styled.label.withConfig({
29
23
  displayName: "TextInput__IconWrapper",
30
24
  componentId: "sc-shde0o-1"
31
- })(["display:flex;align-items:center;position:relative;svg{opacity:0.4;position:absolute;}", ";"], function (props) {
32
- return props.iconLeft && !props.floating ? css(["svg{bottom:", ";left:12px;}"], function (props) {
33
- var inputHeight = themeGet("appScale.inputHeightDefault")(props);
34
- return "calc(".concat(inputHeight, " / 3 - 1px)");
35
- }) : props.iconLeft && props.floating ? css(["svg{bottom:", ";left:12px;}"], function (props) {
36
- var inputHeight = themeGet("appScale.inputHeightDefault")(props);
37
- return "calc(".concat(inputHeight, " / 2 + 3px)");
38
- }) : props.iconRight && !props.floating ? css(["svg{bottom:", ";right:12px;}"], function (props) {
39
- var inputHeight = themeGet("appScale.inputHeightDefault")(props);
40
- return "calc(".concat(inputHeight, " / 3 - 1px)");
41
- }) : props.iconRight && props.floating ? css(["svg{bottom:", ";right:12px;}"], function (props) {
42
- var inputHeight = themeGet("appScale.inputHeightDefault")(props);
43
- return "calc(".concat(inputHeight, " / 2 + 3px)");
44
- }) : css([""]);
45
- });
46
- var InputStyle = css(["display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;box-shadow:none;font-size:", ";z-index:1;border-radius:", ";transition:", ";background:", ";color:", ";width:", ";height:", ";padding:", ";border:1px solid ", ";", " &:hover{border:1px solid ", ";}&:focus{outline:0;box-shadow:", ";border:1px solid ", ";", ";}"], function (props) {
47
- return themeGet("fontSizes.2")(props);
48
- }, function (props) {
49
- return themeGet("radii.2")(props);
50
- }, function (props) {
51
- return themeGet("transition.transitionDefault")(props);
52
- }, function (props) {
53
- return props.disabled ? themeGet("colors.greyLightest")(props) : themeGet("colors.white")(props);
54
- }, function (props) {
55
- return props.disabled ? themeGet("colors.grey")(props) : themeGet("colors.greyDarkest")(props);
56
- }, function (props) {
57
- return props.fullWidth ? "100%" : "auto";
58
- }, function (props) {
59
- return props.height ? props.height : props.floating ? themeGet("appScale.inputHeightLarge")(props) : themeGet("appScale.inputHeightDefault")(props);
60
- }, function (props) {
61
- var left = props.iconLeft ? 36 : 10;
62
- var right = props.iconRight ? 36 : 10;
63
- var top = props.floating ? 25 : 5;
64
- var bottom = 6;
25
+ })(["display:flex;align-items:center;position:relative;svg{opacity:0.4;position:absolute;}", ";"], props => props.iconLeft && !props.floating ? css(["svg{bottom:", ";left:12px;}"], props => {
26
+ let inputHeight = themeGet("appScale.inputHeightDefault")(props);
27
+ return "calc(".concat(inputHeight, " / 3 - 1px)");
28
+ }) : props.iconLeft && props.floating ? css(["svg{bottom:", ";left:12px;}"], props => {
29
+ let inputHeight = themeGet("appScale.inputHeightDefault")(props);
30
+ return "calc(".concat(inputHeight, " / 2 + 3px)");
31
+ }) : props.iconRight && !props.floating ? css(["svg{bottom:", ";right:12px;}"], props => {
32
+ let inputHeight = themeGet("appScale.inputHeightDefault")(props);
33
+ return "calc(".concat(inputHeight, " / 3 - 1px)");
34
+ }) : props.iconRight && props.floating ? css(["svg{bottom:", ";right:12px;}"], props => {
35
+ let inputHeight = themeGet("appScale.inputHeightDefault")(props);
36
+ return "calc(".concat(inputHeight, " / 2 + 3px)");
37
+ }) : css([""]));
38
+ const InputStyle = css(["display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;box-shadow:none;font-size:", ";z-index:1;border-radius:", ";transition:", ";background:", ";color:", ";width:", ";height:", ";padding:", ";border:1px solid ", ";", " &:hover{border:1px solid ", ";}&:focus{outline:0;box-shadow:", ";border:1px solid ", ";", ";}"], props => themeGet("fontSizes.2")(props), props => themeGet("radii.2")(props), props => themeGet("transition.transitionDefault")(props), props => props.disabled ? themeGet("colors.greyLightest")(props) : themeGet("colors.white")(props), props => props.disabled ? themeGet("colors.grey")(props) : themeGet("colors.greyDarkest")(props), props => props.fullWidth ? "100%" : "auto", props => props.height ? props.height : props.floating ? themeGet("appScale.inputHeightLarge")(props) : themeGet("appScale.inputHeightDefault")(props), props => {
39
+ let left = props.iconLeft ? 36 : 10;
40
+ let right = props.iconRight ? 36 : 10;
41
+ let top = props.floating ? 25 : 5;
42
+ let bottom = 6;
65
43
  return "".concat(top, "px ").concat(right, "px ").concat(bottom, "px ").concat(left, "px");
66
- }, function (props) {
67
- return props.invalid ? themeGet("colors.danger")(props) : props.valid ? themeGet("colors.success")(props) : themeGet("colors.black30")(props);
68
- }, function (props) {
69
- return props.floating ? css(["&::placeholder{color:transparent;}&:not(:placeholder-shown){~ label{transform:translateY(-10px);font-size:", ";}}&:-ms-input-placeholder:not(:focus){~ label{transform:translateY(-10px);font-size:", ";}}&:not(:-ms-input-placeholder){~ label{transform:translateY(-10px);font-size:", ";}}"], themeGet("fontSizes.0")(props), themeGet("fontSizes.0")(props), themeGet("fontSizes.0")(props)) : css(["&::placeholder{color:", ";}"], themeGet("colors.grey")(props));
70
- }, function (props) {
71
- return props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.primary")(props);
72
- }, function (props) {
73
- return props.invalid ? themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.danger30")(props) : props.valid ? themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.success30")(props) : themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.primary30")(props);
74
- }, function (props) {
75
- return props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.primary")(props);
76
- }, function (props) {
77
- return props.floating ? css(["&::placeholder{color:", ";}~ label{transform:translateY(-10px);font-size:", ";color:", ";}"], themeGet("colors.greyLight")(props), themeGet("fontSizes.0")(props), function (props) {
78
- return props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.primary")(props);
79
- }) : css([""]);
80
- });
81
- var Input = styled("input").attrs(function (props) {
82
- return {
83
- "data-testid": props["data-testid"] ? props["data-testid"] : null
84
- };
85
- }).withConfig({
44
+ }, props => props.invalid ? themeGet("colors.danger")(props) : props.valid ? themeGet("colors.success")(props) : themeGet("colors.black30")(props), props => props.floating ? css(["&::placeholder{color:transparent;}&:not(:placeholder-shown){~ label{transform:translateY(-10px);font-size:", ";}}&:-ms-input-placeholder:not(:focus){~ label{transform:translateY(-10px);font-size:", ";}}&:not(:-ms-input-placeholder){~ label{transform:translateY(-10px);font-size:", ";}}"], themeGet("fontSizes.0")(props), themeGet("fontSizes.0")(props), themeGet("fontSizes.0")(props)) : css(["&::placeholder{color:", ";}"], themeGet("colors.grey")(props)), props => props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.primary")(props), props => props.invalid ? themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.danger30")(props) : props.valid ? themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.success30")(props) : themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.primary30")(props), props => props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.primary")(props), props => props.floating ? css(["&::placeholder{color:", ";}~ label{transform:translateY(-10px);font-size:", ";color:", ";}"], themeGet("colors.greyLight")(props), themeGet("fontSizes.0")(props), props => props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.primary")(props)) : css([""]));
45
+ const Input = styled("input").attrs(props => ({
46
+ "data-testid": props["data-testid"] ? props["data-testid"] : null
47
+ })).withConfig({
86
48
  displayName: "TextInput__Input",
87
49
  componentId: "sc-shde0o-2"
88
50
  })(["", ""], InputStyle);
89
- var NumberInput = styled(NumericFormat).attrs(function (props) {
90
- return {
91
- "data-testid": props["data-testid"] ? props["data-testid"] : null
92
- };
93
- }).withConfig({
51
+ const NumberInput = styled(NumericFormat).attrs(props => ({
52
+ "data-testid": props["data-testid"] ? props["data-testid"] : null
53
+ })).withConfig({
94
54
  displayName: "TextInput__NumberInput",
95
55
  componentId: "sc-shde0o-3"
96
56
  })(["", ""], InputStyle);
97
- var Label = styled.label.withConfig({
57
+ const Label = styled.label.withConfig({
98
58
  displayName: "TextInput__Label",
99
59
  componentId: "sc-shde0o-4"
100
- })(["display:block;z-index:2;text-align:left;font-size:", ";font-weight:", ";transition:", ";padding-right:", ";margin-bottom:", ";color:", ";", ";", ";"], function (props) {
101
- return themeGet("fontSizes.1")(props);
102
- }, function (props) {
103
- return props.bold ? themeGet("fontWeights.2")(props) : themeGet("fontWeights.1")(props);
104
- }, function (props) {
105
- return themeGet("transition.transitionDefault")(props);
106
- }, function (props) {
107
- return props.floating && props.iconRight ? "40px" : "12px";
108
- }, function (props) {
109
- return props.floating ? 0 : themeGet("space.xs")(props);
110
- }, function (props) {
111
- return props.inverted ? themeGet("colors.white")(props) : props.valid ? themeGet("colors.successDark")(props) : props.invalid ? themeGet("colors.dangerDark")(props) : themeGet("colors.greyDarkest")(props);
112
- }, function (props) {
113
- return props.floating ? css(["padding-left:", ";cursor:text;position:absolute;top:", ";color:", ";"], function (props) {
114
- return props.iconLeft ? "37px" : "11px";
115
- }, function (props) {
116
- var inputHeight = themeGet("appScale.inputHeightLarge")(props);
117
- return "calc(".concat(inputHeight, " / 3)");
118
- }, function (props) {
119
- return props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.greyDark")(props);
120
- }) : css([""]);
121
- }, function (props) {
122
- return props.mandatory ? css(["&:after{content:\" *\";color:", ";}"], themeGet("colors.danger")(props)) : css([""]);
123
- });
124
- var TextInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
125
- var inverted = props.inverted,
126
- floating = props.floating,
127
- id = props.id,
128
- bold = props.bold,
129
- invalid = props.invalid,
130
- valid = props.valid,
131
- fullWidth = props.fullWidth,
132
- mandatory = props.mandatory,
133
- iconLeft = props.iconLeft,
134
- iconRight = props.iconRight,
135
- InputStyles = props.InputStyles,
136
- height = props.height,
137
- focus = props.focus,
138
- ariaLabel = props.ariaLabel;
139
- var inputRef = useInputFocus(ref, focus);
140
- var numberProps = props.numberProps,
141
- rest = _objectWithoutProperties(props, _excluded);
142
- var getNumberInputRef = null;
60
+ })(["display:block;z-index:2;text-align:left;font-size:", ";font-weight:", ";transition:", ";padding-right:", ";margin-bottom:", ";color:", ";", ";", ";"], props => themeGet("fontSizes.1")(props), props => props.bold ? themeGet("fontWeights.2")(props) : themeGet("fontWeights.1")(props), props => themeGet("transition.transitionDefault")(props), props => props.floating && props.iconRight ? "40px" : "12px", props => props.floating ? 0 : themeGet("space.xs")(props), props => props.inverted ? themeGet("colors.white")(props) : props.valid ? themeGet("colors.successDark")(props) : props.invalid ? themeGet("colors.dangerDark")(props) : themeGet("colors.greyDarkest")(props), props => props.floating ? css(["padding-left:", ";cursor:text;position:absolute;top:", ";color:", ";"], props => props.iconLeft ? "37px" : "11px", props => {
61
+ let inputHeight = themeGet("appScale.inputHeightLarge")(props);
62
+ return "calc(".concat(inputHeight, " / 3)");
63
+ }, props => props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.greyDark")(props)) : css([""]), props => props.mandatory ? css(["&:after{content:\" *\";color:", ";}"], themeGet("colors.danger")(props)) : css([""]));
64
+ const TextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
65
+ const {
66
+ inverted,
67
+ floating,
68
+ id,
69
+ bold,
70
+ invalid,
71
+ valid,
72
+ fullWidth,
73
+ mandatory,
74
+ iconLeft,
75
+ iconRight,
76
+ InputStyles,
77
+ height,
78
+ focus,
79
+ ariaLabel
80
+ } = props;
81
+ const inputRef = useInputFocus(ref, focus);
82
+ const {
83
+ numberProps,
84
+ ...rest
85
+ } = props;
86
+ let getNumberInputRef = null;
143
87
  if (numberProps && inputRef) {
144
- getNumberInputRef = function getNumberInputRef(node) {
88
+ getNumberInputRef = node => {
145
89
  inputRef.current = node;
146
90
  };
147
91
  }
148
- var label = useMemo(function () {
92
+ const label = useMemo(() => {
149
93
  if (numberProps && numberProps.prefix) {
150
94
  return "".concat(props.label, " ").concat(numberProps.prefix);
151
95
  }
152
96
  return props.label;
153
97
  }, [props.label, numberProps]);
154
- return /*#__PURE__*/React.createElement(Group, _extends({
155
- fullWidth: fullWidth
156
- }, InputStyles), label && !floating ? /*#__PURE__*/React.createElement(Label, {
157
- inverted: inverted,
158
- invalid: invalid,
159
- valid: valid,
160
- bold: bold,
161
- htmlFor: id,
162
- mandatory: mandatory
163
- }, label) : null, numberProps ? /*#__PURE__*/React.createElement(NumberInput, _extends({
164
- getInputRef: getNumberInputRef,
165
- "data-testid": props["data-testid"],
166
- id: id,
167
- "aria-label": ariaLabel
168
- }, rest, {
169
- height: height
170
- }, numberProps)) : /*#__PURE__*/React.createElement(Input, _extends({
171
- "data-testid": props["data-testid"],
172
- height: height,
173
- ref: inputRef,
174
- id: id,
175
- "aria-label": ariaLabel
176
- }, rest)), label && floating ? /*#__PURE__*/React.createElement(Label, {
177
- floating: floating,
178
- invalid: invalid,
179
- valid: valid,
180
- bold: bold,
181
- htmlFor: id,
182
- mandatory: mandatory,
183
- iconRight: iconRight,
184
- iconLeft: iconLeft
185
- }, label) : null, iconLeft ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconWrapper, {
186
- htmlFor: id,
187
- iconLeft: iconLeft,
188
- floating: floating
189
- }, /*#__PURE__*/React.createElement(Icon, {
190
- icon: iconLeft,
191
- htmlFor: id,
192
- color: "black"
193
- }))) : null, iconRight ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconWrapper, {
194
- htmlFor: id,
195
- iconRight: iconRight,
196
- floating: floating
197
- }, /*#__PURE__*/React.createElement(Icon, {
198
- icon: iconRight,
199
- htmlFor: id,
200
- color: "#black"
201
- }))) : null);
98
+ return /*#__PURE__*/_jsxs(Group, {
99
+ fullWidth: fullWidth,
100
+ ...InputStyles,
101
+ children: [label && !floating ? /*#__PURE__*/_jsx(Label, {
102
+ inverted: inverted,
103
+ invalid: invalid,
104
+ valid: valid,
105
+ bold: bold,
106
+ htmlFor: id,
107
+ mandatory: mandatory,
108
+ children: label
109
+ }) : null, numberProps ? /*#__PURE__*/_jsx(NumberInput, {
110
+ getInputRef: getNumberInputRef,
111
+ "data-testid": props["data-testid"],
112
+ id: id,
113
+ "aria-label": ariaLabel,
114
+ ...rest,
115
+ height: height,
116
+ ...numberProps
117
+ }) : /*#__PURE__*/_jsx(Input, {
118
+ "data-testid": props["data-testid"],
119
+ height: height,
120
+ ref: inputRef,
121
+ id: id,
122
+ "aria-label": ariaLabel,
123
+ ...rest
124
+ }), label && floating ? /*#__PURE__*/_jsx(Label, {
125
+ floating: floating,
126
+ invalid: invalid,
127
+ valid: valid,
128
+ bold: bold,
129
+ htmlFor: id,
130
+ mandatory: mandatory,
131
+ iconRight: iconRight,
132
+ iconLeft: iconLeft,
133
+ children: label
134
+ }) : null, iconLeft ? /*#__PURE__*/_jsx("div", {
135
+ children: /*#__PURE__*/_jsx(IconWrapper, {
136
+ htmlFor: id,
137
+ iconLeft: iconLeft,
138
+ floating: floating,
139
+ children: /*#__PURE__*/_jsx(Icon, {
140
+ icon: iconLeft,
141
+ htmlFor: id,
142
+ color: "black"
143
+ })
144
+ })
145
+ }) : null, iconRight ? /*#__PURE__*/_jsx("div", {
146
+ children: /*#__PURE__*/_jsx(IconWrapper, {
147
+ htmlFor: id,
148
+ iconRight: iconRight,
149
+ floating: floating,
150
+ children: /*#__PURE__*/_jsx(Icon, {
151
+ icon: iconRight,
152
+ htmlFor: id,
153
+ color: "#black"
154
+ })
155
+ })
156
+ }) : null]
157
+ });
202
158
  });
203
159
  TextInput.propTypes = {
204
160
  /** Must be used to specify a unique ID. */
@@ -208,12 +164,12 @@ TextInput.propTypes = {
208
164
  /** Specifies the text for the label. */
209
165
  label: PropTypes.string,
210
166
  /** Specifies aria-label for TextArea. This is only required if not using the label prop.*/
211
- ariaLabel: function ariaLabel(props, propName) {
167
+ ariaLabel: (props, propName) => {
212
168
  if (!props.label && (props[propName] == null || props[propName] === "")) {
213
169
  return new Error("Missing prop `".concat(propName, "` not specified for TextInput component. When `label` is not provided, `").concat(propName, "` is required."));
214
170
  }
215
171
  if (props[propName] && typeof props[propName] !== "string") {
216
- return new Error("Invalid propType `".concat(propName, "` supplied to TextInput component. Expected `string`, received `").concat(_typeof(props[propName]), "`."));
172
+ return new Error("Invalid propType `".concat(propName, "` supplied to TextInput component. Expected `string`, received `").concat(typeof props[propName], "`."));
217
173
  }
218
174
  return null;
219
175
  },
@@ -2,75 +2,76 @@ import React from "react";
2
2
  import Toggle from ".";
3
3
  import Box from "../Box";
4
4
  import Spacer from "../Spacer";
5
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
5
6
  export default {
6
7
  title: "Components/Toggle",
7
8
  component: Toggle
8
9
  };
9
- export var defaultToggle = function defaultToggle() {
10
- return /*#__PURE__*/React.createElement(Toggle, {
11
- id: "autosave",
12
- label: "Auto save"
13
- });
14
- };
10
+ export const defaultToggle = () => /*#__PURE__*/_jsx(Toggle, {
11
+ id: "autosave",
12
+ label: "Auto save"
13
+ });
15
14
  defaultToggle.storyName = "Default";
16
- export var small = function small() {
17
- return /*#__PURE__*/React.createElement(Toggle, {
18
- id: "autosave2",
19
- label: "Auto save",
20
- small: true
21
- });
22
- };
23
- export var inverted = function inverted() {
24
- return /*#__PURE__*/React.createElement(Box, {
15
+ export const small = () => /*#__PURE__*/_jsx(Toggle, {
16
+ id: "autosave2",
17
+ label: "Auto save",
18
+ small: true
19
+ });
20
+ export const inverted = () => /*#__PURE__*/_jsx(Box, {
21
+ p: "r",
22
+ bg: "greyDarkest",
23
+ children: /*#__PURE__*/_jsxs(Spacer, {
24
+ my: "r",
25
+ children: [/*#__PURE__*/_jsx(Toggle, {
26
+ id: "autosave3",
27
+ label: "Auto save",
28
+ inverted: true,
29
+ small: true
30
+ }), /*#__PURE__*/_jsx(Toggle, {
31
+ id: "autosave4",
32
+ label: "Auto save",
33
+ inverted: true
34
+ })]
35
+ })
36
+ });
37
+ export const disabled = () => /*#__PURE__*/_jsxs(_Fragment, {
38
+ children: [/*#__PURE__*/_jsx(Box, {
25
39
  p: "r",
26
- bg: "greyDarkest"
27
- }, /*#__PURE__*/React.createElement(Spacer, {
28
- my: "r"
29
- }, /*#__PURE__*/React.createElement(Toggle, {
30
- id: "autosave3",
31
- label: "Auto save",
32
- inverted: true,
33
- small: true
34
- }), /*#__PURE__*/React.createElement(Toggle, {
35
- id: "autosave4",
36
- label: "Auto save",
37
- inverted: true
38
- })));
39
- };
40
- export var disabled = function disabled() {
41
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
42
- p: "r"
43
- }, /*#__PURE__*/React.createElement(Spacer, {
44
- my: "r"
45
- }, /*#__PURE__*/React.createElement(Toggle, {
46
- id: "autosave5",
47
- label: "Auto save",
48
- small: true,
49
- disabled: true
50
- }), /*#__PURE__*/React.createElement(Toggle, {
51
- id: "autosave6",
52
- label: "Auto save",
53
- checked: true,
54
- disabled: true
55
- }))), /*#__PURE__*/React.createElement(Box, {
40
+ children: /*#__PURE__*/_jsxs(Spacer, {
41
+ my: "r",
42
+ children: [/*#__PURE__*/_jsx(Toggle, {
43
+ id: "autosave5",
44
+ label: "Auto save",
45
+ small: true,
46
+ disabled: true
47
+ }), /*#__PURE__*/_jsx(Toggle, {
48
+ id: "autosave6",
49
+ label: "Auto save",
50
+ checked: true,
51
+ disabled: true
52
+ })]
53
+ })
54
+ }), /*#__PURE__*/_jsx(Box, {
56
55
  p: "r",
57
- bg: "greyDarkest"
58
- }, /*#__PURE__*/React.createElement(Spacer, {
59
- my: "r"
60
- }, /*#__PURE__*/React.createElement(Toggle, {
61
- id: "autosave7",
62
- label: "Auto save",
63
- inverted: true,
64
- small: true,
65
- disabled: true
66
- }), /*#__PURE__*/React.createElement(Toggle, {
67
- id: "autosave8",
68
- label: "Auto save",
69
- checked: true,
70
- inverted: true,
71
- disabled: true
72
- }))));
73
- };
56
+ bg: "greyDarkest",
57
+ children: /*#__PURE__*/_jsxs(Spacer, {
58
+ my: "r",
59
+ children: [/*#__PURE__*/_jsx(Toggle, {
60
+ id: "autosave7",
61
+ label: "Auto save",
62
+ inverted: true,
63
+ small: true,
64
+ disabled: true
65
+ }), /*#__PURE__*/_jsx(Toggle, {
66
+ id: "autosave8",
67
+ label: "Auto save",
68
+ checked: true,
69
+ inverted: true,
70
+ disabled: true
71
+ })]
72
+ })
73
+ })]
74
+ });
74
75
  defaultToggle.__docgenInfo = {
75
76
  "description": "",
76
77
  "methods": [],