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.
- package/es/GlobalStyles.js +1 -31
- package/es/SystemThemeProvider.js +11 -5
- package/es/assets/Colour/Colour.stories.js +211 -0
- package/es/assets/Colour/index.js +3 -3
- package/es/components/ActionsMenu/ActionsMenu.stories.js +260 -233
- package/es/components/ActionsMenu/index.js +144 -229
- package/es/components/Avatar/Avatar.stories.js +212 -196
- package/es/components/Avatar/index.js +280 -307
- package/es/components/Badge/Badge.stories.js +71 -46
- package/es/components/Badge/index.js +71 -74
- package/es/components/Box/Box.stories.js +51 -35
- package/es/components/Box/index.js +33 -34
- package/es/components/Button/Button.stories.js +161 -145
- package/es/components/Button/ButtonLink.stories.js +152 -139
- package/es/components/Button/index.js +79 -99
- package/es/components/ButtonGroup/ButtonGroup.stories.js +43 -42
- package/es/components/ButtonGroup/ButtonGroupItem.stories.js +11 -13
- package/es/components/ButtonGroup/index.js +103 -99
- package/es/components/Card/Card.stories.js +94 -62
- package/es/components/Card/index.js +50 -71
- package/es/components/Checkbox/Checkbox.stories.js +37 -43
- package/es/components/Checkbox/index.js +61 -76
- package/es/components/DatePicker/DatePicker.stories.js +86 -118
- package/es/components/DatePicker/index.js +71 -187
- package/es/components/Divider/Divider.stories.js +39 -42
- package/es/components/Divider/index.js +21 -27
- package/es/components/Expandable/Expandable.stories.js +46 -36
- package/es/components/Expandable/index.js +55 -82
- package/es/components/Flex/Flex.stories.js +19 -5
- package/es/components/Flex/FlexItem.stories.js +10 -9
- package/es/components/Flex/index.js +34 -27
- package/es/components/Grid/Grid.stories.js +129 -55
- package/es/components/Grid/index.js +25 -24
- package/es/components/Header/Header.stories.js +101 -92
- package/es/components/Header/index.js +433 -436
- package/es/components/HeaderSimple/HeaderSimple.stories.js +23 -27
- package/es/components/HeaderSimple/index.js +73 -68
- package/es/components/Icon/Icon.stories.js +58 -57
- package/es/components/Icon/index.js +48 -46
- package/es/components/Loading/Loading.stories.js +32 -39
- package/es/components/Loading/index.js +44 -51
- package/es/components/Modal/Modal.stories.js +172 -153
- package/es/components/Modal/index.js +126 -134
- package/es/components/Notification/Notification.stories.js +59 -58
- package/es/components/Notification/index.js +123 -133
- package/es/components/Popover/Popover.stories.js +134 -102
- package/es/components/Popover/index.js +65 -111
- package/es/components/ProgressBar/ProgressBar.stories.js +36 -39
- package/es/components/ProgressBar/index.js +29 -34
- package/es/components/RadioButton/RadioButton.stories.js +32 -37
- package/es/components/RadioButton/index.js +170 -184
- package/es/components/Range/Range.stories.js +19 -19
- package/es/components/Range/index.js +35 -45
- package/es/components/Select/Select.stories.js +107 -128
- package/es/components/Select/index.js +324 -336
- package/es/components/SideNav/NavItem.js +112 -122
- package/es/components/SideNav/SideNav.stories.js +84 -57
- package/es/components/SideNav/index.js +161 -185
- package/es/components/Sidebar/Sidebar.stories.js +50 -33
- package/es/components/Sidebar/index.js +152 -155
- package/es/components/Spacer/Spacer.stories.js +35 -32
- package/es/components/Spacer/index.js +20 -20
- package/es/components/StatusDot/StatusDot.stories.js +103 -90
- package/es/components/StatusDot/index.js +36 -38
- package/es/components/StyledLink/StyledLink.stories.js +68 -69
- package/es/components/StyledLink/index.js +47 -48
- package/es/components/Table/Table.stories.js +118 -112
- package/es/components/Table/getExpandColumnConfig.js +67 -62
- package/es/components/Table/index.js +24 -27
- package/es/components/Table/muiStyleOverrides.js +10 -8
- package/es/components/Tabs/Tab.stories.js +55 -38
- package/es/components/Tabs/TabsContainer.stories.js +30 -22
- package/es/components/Tabs/index.js +95 -92
- package/es/components/Tag/Tag.stories.js +250 -220
- package/es/components/Tag/index.js +118 -190
- package/es/components/TextArea/TextArea.stories.js +76 -89
- package/es/components/TextArea/index.js +117 -115
- package/es/components/TextInput/TextInput.stories.js +41 -61
- package/es/components/TextInput/index.js +127 -171
- package/es/components/Toggle/Toggle.stories.js +63 -62
- package/es/components/Toggle/index.js +43 -77
- package/es/components/TreeNav/TreeNav.stories.js +7 -8
- package/es/components/TreeNav/index.js +72 -69
- package/es/components/Typography/Typography.stories.js +174 -0
- package/es/components/Typography/index.js +252 -308
- package/es/components.test.js +1 -1
- package/es/hooks/isVisible.js +6 -10
- package/es/hooks/keepInView.js +27 -32
- package/es/hooks/keypress.js +14 -14
- package/es/hooks/useInputFocus.js +5 -5
- package/es/hooks/usePrevious.js +3 -3
- package/es/systemThemeCollapsed.js +53 -53
- package/es/systemtheme.js +53 -53
- package/es/utils/selectUtil.js +1 -1
- package/es/utils/selectUtil.test.js +6 -6
- 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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
})(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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;}", ";"],
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
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:", ";", ";", ";"],
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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 =
|
|
88
|
+
getNumberInputRef = node => {
|
|
145
89
|
inputRef.current = node;
|
|
146
90
|
};
|
|
147
91
|
}
|
|
148
|
-
|
|
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__*/
|
|
155
|
-
fullWidth: fullWidth
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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:
|
|
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(
|
|
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
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
};
|
|
10
|
+
export const defaultToggle = () => /*#__PURE__*/_jsx(Toggle, {
|
|
11
|
+
id: "autosave",
|
|
12
|
+
label: "Auto save"
|
|
13
|
+
});
|
|
15
14
|
defaultToggle.storyName = "Default";
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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": [],
|