@automattic/vip-design-system 0.26.1 → 0.26.3
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/.storybook/preview.js +6 -0
- package/build/system/Accordion/Accordion.js +36 -25
- package/build/system/Form/Checkbox.stories.js +85 -0
- package/build/system/Form/Input.js +55 -31
- package/build/system/Form/Input.stories.js +34 -4
- package/build/system/Form/MultiSelect.js +38 -0
- package/build/system/Form/Radio.stories.js +95 -0
- package/build/system/Form/Select.stories.js +1 -1
- package/build/system/Form/Textarea.js +14 -53
- package/build/system/Form/Textarea.stories.js +67 -0
- package/build/system/Form/Validation.js +17 -10
- package/build/system/NewConfirmationDialog/NewConfirmationDialog.stories.js +1 -1
- package/build/system/NewDialog/NewDialog.stories.js +1 -1
- package/build/system/NewForm/index.js +12 -0
- package/build/system/NewTabs/Tabs.stories.js +11 -5
- package/build/system/NewTabs/TabsList.js +1 -1
- package/build/system/ResourceList/ResourceList.js +1 -1
- package/build/system/Tabs/Tabs.stories.js +1 -1
- package/build/system/UsageChart/UsageChart.js +60 -0
- package/build/system/UsageChart/index.js +7 -0
- package/build/system/theme/index.js +7 -0
- package/package.json +1 -1
- package/src/system/Accordion/Accordion.js +8 -5
- package/src/system/Form/Checkbox.stories.jsx +54 -0
- package/src/system/Form/Input.js +44 -27
- package/src/system/Form/Input.stories.jsx +29 -4
- package/src/system/Form/Radio.stories.jsx +66 -0
- package/src/system/Form/Select.stories.jsx +1 -1
- package/src/system/Form/Textarea.js +4 -49
- package/src/system/Form/Textarea.stories.jsx +40 -0
- package/src/system/Form/Validation.js +14 -8
- package/src/system/NewConfirmationDialog/NewConfirmationDialog.stories.jsx +1 -1
- package/src/system/NewDialog/NewDialog.stories.jsx +1 -1
- package/src/system/NewForm/index.js +4 -1
- package/src/system/NewTabs/Tabs.stories.jsx +7 -3
- package/src/system/NewTabs/TabsList.js +1 -1
- package/src/system/Tabs/Tabs.stories.jsx +1 -1
- package/src/system/theme/index.js +8 -0
package/.storybook/preview.js
CHANGED
|
@@ -110,29 +110,40 @@ var Trigger = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, forward
|
|
|
110
110
|
fontWeight: 600,
|
|
111
111
|
textTransform: 'uppercase',
|
|
112
112
|
'&[data-state="closed"]': {
|
|
113
|
-
backgroundColor:
|
|
113
|
+
backgroundColor: function backgroundColor(_ref3) {
|
|
114
|
+
var accordion = _ref3.accordion;
|
|
115
|
+
return accordion.background.closed;
|
|
116
|
+
}
|
|
114
117
|
},
|
|
115
118
|
'&[data-state="open"]': {
|
|
116
|
-
backgroundColor:
|
|
117
|
-
|
|
118
|
-
return
|
|
119
|
+
backgroundColor: function backgroundColor(_ref4) {
|
|
120
|
+
var accordion = _ref4.accordion;
|
|
121
|
+
return accordion.background.open;
|
|
122
|
+
},
|
|
123
|
+
borderBottom: function borderBottom(_ref5) {
|
|
124
|
+
var colors = _ref5.colors;
|
|
125
|
+
return "1px solid " + colors.border;
|
|
126
|
+
},
|
|
127
|
+
'.vip-accordion-trigger-indicator': {
|
|
128
|
+
transform: 'rotate(270deg)'
|
|
119
129
|
}
|
|
120
130
|
},
|
|
121
131
|
'&:hover': {
|
|
122
|
-
backgroundColor:
|
|
132
|
+
backgroundColor: function backgroundColor(_ref6) {
|
|
133
|
+
var accordion = _ref6.accordion;
|
|
134
|
+
return accordion.background.hover;
|
|
135
|
+
}
|
|
123
136
|
}
|
|
124
137
|
}
|
|
125
138
|
}, props, {
|
|
126
139
|
ref: forwardedRef,
|
|
127
140
|
children: [children, (0, _jsxRuntime.jsx)(_md.MdChevronRight, {
|
|
141
|
+
className: "vip-accordion-trigger-indicator",
|
|
128
142
|
sx: {
|
|
129
143
|
fontSize: 3,
|
|
130
144
|
color: 'text',
|
|
131
145
|
transform: 'rotate(90deg)',
|
|
132
|
-
transition: 'transform 300ms cubic-bezier(0.87, 0, 0.13, 1)'
|
|
133
|
-
'[data-state=open] &': {
|
|
134
|
-
transform: 'rotate(270deg)'
|
|
135
|
-
}
|
|
146
|
+
transition: 'transform 300ms cubic-bezier(0.87, 0, 0.13, 1)'
|
|
136
147
|
},
|
|
137
148
|
"aria-hidden": true
|
|
138
149
|
})]
|
|
@@ -147,10 +158,10 @@ Trigger.propTypes = {
|
|
|
147
158
|
headingVariant: _propTypes["default"].string
|
|
148
159
|
};
|
|
149
160
|
|
|
150
|
-
var TriggerWithIcon = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
151
|
-
var children =
|
|
152
|
-
icon =
|
|
153
|
-
props = (0, _objectWithoutPropertiesLoose2["default"])(
|
|
161
|
+
var TriggerWithIcon = /*#__PURE__*/_react["default"].forwardRef(function (_ref7, forwardedRef) {
|
|
162
|
+
var children = _ref7.children,
|
|
163
|
+
icon = _ref7.icon,
|
|
164
|
+
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref7, _excluded3);
|
|
154
165
|
return (0, _jsxRuntime.jsxs)(Trigger, (0, _extends2["default"])({}, props, {
|
|
155
166
|
ref: forwardedRef,
|
|
156
167
|
children: [(0, _jsxRuntime.jsx)("span", {
|
|
@@ -178,11 +189,11 @@ TriggerWithIcon.propTypes = {
|
|
|
178
189
|
icon: _propTypes["default"].node.isRequired
|
|
179
190
|
};
|
|
180
191
|
|
|
181
|
-
var Content = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
182
|
-
var children =
|
|
183
|
-
|
|
184
|
-
sx =
|
|
185
|
-
props = (0, _objectWithoutPropertiesLoose2["default"])(
|
|
192
|
+
var Content = /*#__PURE__*/_react["default"].forwardRef(function (_ref8, forwardedRef) {
|
|
193
|
+
var children = _ref8.children,
|
|
194
|
+
_ref8$sx = _ref8.sx,
|
|
195
|
+
sx = _ref8$sx === void 0 ? {} : _ref8$sx,
|
|
196
|
+
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref8, _excluded4);
|
|
186
197
|
return (0, _jsxRuntime.jsx)(AccordionPrimitive.Content, (0, _extends2["default"])({
|
|
187
198
|
sx: (0, _extends2["default"])({
|
|
188
199
|
backgroundColor: 'transparent',
|
|
@@ -215,13 +226,13 @@ Content.propTypes = {
|
|
|
215
226
|
sx: _propTypes["default"].object
|
|
216
227
|
};
|
|
217
228
|
|
|
218
|
-
var Root = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
219
|
-
var
|
|
220
|
-
sx =
|
|
221
|
-
defaultValue =
|
|
222
|
-
type =
|
|
223
|
-
children =
|
|
224
|
-
className =
|
|
229
|
+
var Root = /*#__PURE__*/_react["default"].forwardRef(function (_ref9, forwardRef) {
|
|
230
|
+
var _ref9$sx = _ref9.sx,
|
|
231
|
+
sx = _ref9$sx === void 0 ? {} : _ref9$sx,
|
|
232
|
+
defaultValue = _ref9.defaultValue,
|
|
233
|
+
type = _ref9.type,
|
|
234
|
+
children = _ref9.children,
|
|
235
|
+
className = _ref9.className;
|
|
225
236
|
return (0, _jsxRuntime.jsx)(AccordionPrimitive.Root, {
|
|
226
237
|
className: (0, _classnames["default"])('vip-accordion-component', className),
|
|
227
238
|
collapsible: true,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.Default = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = require("react");
|
|
7
|
+
|
|
8
|
+
var _ = require("..");
|
|
9
|
+
|
|
10
|
+
var _Checkbox = require("./Checkbox");
|
|
11
|
+
|
|
12
|
+
var _Label = require("./Label");
|
|
13
|
+
|
|
14
|
+
var _Flex = require("../Flex");
|
|
15
|
+
|
|
16
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* External dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
var _default = {
|
|
26
|
+
title: 'Form/Checkbox',
|
|
27
|
+
component: _Checkbox.Checkbox
|
|
28
|
+
};
|
|
29
|
+
exports["default"] = _default;
|
|
30
|
+
|
|
31
|
+
var Default = function Default() {
|
|
32
|
+
var _useState = (0, _react.useState)(true),
|
|
33
|
+
checked = _useState[0],
|
|
34
|
+
setChecked = _useState[1];
|
|
35
|
+
|
|
36
|
+
var _useState2 = (0, _react.useState)(false),
|
|
37
|
+
checked2 = _useState2[0],
|
|
38
|
+
setChecked2 = _useState2[1];
|
|
39
|
+
|
|
40
|
+
return (0, _jsxRuntime.jsx)(_.Form.Root, {
|
|
41
|
+
children: (0, _jsxRuntime.jsxs)("fieldset", {
|
|
42
|
+
children: [(0, _jsxRuntime.jsx)("legend", {
|
|
43
|
+
children: "Tell me your prefereces"
|
|
44
|
+
}), (0, _jsxRuntime.jsxs)(_Flex.Flex, {
|
|
45
|
+
sx: {
|
|
46
|
+
alignItems: 'center'
|
|
47
|
+
},
|
|
48
|
+
children: [(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, {
|
|
49
|
+
id: "check1",
|
|
50
|
+
checked: checked,
|
|
51
|
+
"aria-labelledby": "label-check1",
|
|
52
|
+
onCheckedChange: setChecked
|
|
53
|
+
}), (0, _jsxRuntime.jsx)(_Label.Label, {
|
|
54
|
+
sx: {
|
|
55
|
+
m: 0,
|
|
56
|
+
ml: 2
|
|
57
|
+
},
|
|
58
|
+
htmlFor: "check1",
|
|
59
|
+
id: "label-check1",
|
|
60
|
+
children: "This option"
|
|
61
|
+
})]
|
|
62
|
+
}), (0, _jsxRuntime.jsxs)(_Flex.Flex, {
|
|
63
|
+
sx: {
|
|
64
|
+
alignItems: 'center'
|
|
65
|
+
},
|
|
66
|
+
children: [(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, {
|
|
67
|
+
id: "check2",
|
|
68
|
+
checked: checked2,
|
|
69
|
+
"aria-labelledby": "label-check2",
|
|
70
|
+
onCheckedChange: setChecked2
|
|
71
|
+
}), (0, _jsxRuntime.jsx)(_Label.Label, {
|
|
72
|
+
sx: {
|
|
73
|
+
m: 0,
|
|
74
|
+
ml: 2
|
|
75
|
+
},
|
|
76
|
+
htmlFor: "check2",
|
|
77
|
+
id: "label-check2",
|
|
78
|
+
children: "This option too"
|
|
79
|
+
})]
|
|
80
|
+
})]
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
exports.Default = Default;
|
|
@@ -15,9 +15,51 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
15
15
|
|
|
16
16
|
var _ = require("../");
|
|
17
17
|
|
|
18
|
+
var _themeUi = require("theme-ui");
|
|
19
|
+
|
|
18
20
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
19
21
|
|
|
20
|
-
var _excluded = ["variant", "label", "forLabel", "hasError", "required", "errorMessage"];
|
|
22
|
+
var _excluded = ["variant", "label", "forLabel", "hasError", "required", "sx", "errorMessage"];
|
|
23
|
+
|
|
24
|
+
var RequiredLabel = function RequiredLabel() {
|
|
25
|
+
return (0, _jsxRuntime.jsx)("span", {
|
|
26
|
+
sx: {
|
|
27
|
+
color: 'error',
|
|
28
|
+
display: 'inline-block',
|
|
29
|
+
ml: 2,
|
|
30
|
+
fontSize: 1
|
|
31
|
+
},
|
|
32
|
+
children: "(Required)"
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var inputStyles = {
|
|
37
|
+
unset: 'all',
|
|
38
|
+
border: '1px solid',
|
|
39
|
+
borderColor: 'border',
|
|
40
|
+
backgroundColor: 'card',
|
|
41
|
+
borderRadius: 1,
|
|
42
|
+
lineHeight: 'inherit',
|
|
43
|
+
px: 3,
|
|
44
|
+
py: 2,
|
|
45
|
+
fontSize: 2,
|
|
46
|
+
mb: 2,
|
|
47
|
+
color: 'text',
|
|
48
|
+
display: 'block',
|
|
49
|
+
width: '100%',
|
|
50
|
+
'&:focus': function focus(theme) {
|
|
51
|
+
return theme.outline;
|
|
52
|
+
},
|
|
53
|
+
'&:focus-visible': function focusVisible(theme) {
|
|
54
|
+
return theme.outline;
|
|
55
|
+
},
|
|
56
|
+
'&:disabled': {
|
|
57
|
+
bg: 'backgroundSecondary'
|
|
58
|
+
},
|
|
59
|
+
'&::placeholder': {
|
|
60
|
+
color: 'placeholder'
|
|
61
|
+
}
|
|
62
|
+
};
|
|
21
63
|
|
|
22
64
|
var Input = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
23
65
|
var variant = _ref.variant,
|
|
@@ -25,43 +67,24 @@ var Input = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
25
67
|
forLabel = _ref.forLabel,
|
|
26
68
|
hasError = _ref.hasError,
|
|
27
69
|
required = _ref.required,
|
|
70
|
+
_ref$sx = _ref.sx,
|
|
71
|
+
sx = _ref$sx === void 0 ? {} : _ref$sx,
|
|
28
72
|
errorMessage = _ref.errorMessage,
|
|
29
73
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
30
74
|
return (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
|
|
31
75
|
children: [label && (0, _jsxRuntime.jsxs)(_.Label, {
|
|
32
76
|
htmlFor: forLabel,
|
|
33
|
-
children: [label, required &&
|
|
34
|
-
}), (0, _jsxRuntime.jsx)(
|
|
77
|
+
children: [label, required && (0, _jsxRuntime.jsx)(RequiredLabel, {})]
|
|
78
|
+
}), (0, _jsxRuntime.jsx)(_themeUi.Input, (0, _extends2["default"])({
|
|
35
79
|
ref: ref,
|
|
36
80
|
id: forLabel,
|
|
37
81
|
required: required,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
px: 3,
|
|
45
|
-
py: 2,
|
|
46
|
-
fontSize: 2,
|
|
47
|
-
mb: 2,
|
|
48
|
-
color: 'text',
|
|
49
|
-
display: 'block',
|
|
50
|
-
width: '100%',
|
|
51
|
-
'&:focus': function focus(theme) {
|
|
52
|
-
return theme.outline;
|
|
53
|
-
},
|
|
54
|
-
'&:focus-visible': function focusVisible(theme) {
|
|
55
|
-
return theme.outline;
|
|
56
|
-
},
|
|
57
|
-
'&:disabled': {
|
|
58
|
-
bg: 'backgroundSecondary'
|
|
59
|
-
},
|
|
60
|
-
'&::placeholder': {
|
|
61
|
-
color: 'placeholder'
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
})), hasError && errorMessage && (0, _jsxRuntime.jsx)(_.Validation, {
|
|
82
|
+
noValidate: true,
|
|
83
|
+
"aria-describedby": hasError ? "describe-" + forLabel + "-validation" : undefined,
|
|
84
|
+
sx: (0, _extends2["default"])({}, inputStyles, sx)
|
|
85
|
+
}, props)), hasError && errorMessage && (0, _jsxRuntime.jsx)(_.Validation, {
|
|
86
|
+
isValid: false,
|
|
87
|
+
describedId: forLabel,
|
|
65
88
|
children: errorMessage
|
|
66
89
|
})]
|
|
67
90
|
});
|
|
@@ -74,6 +97,7 @@ Input.propTypes = {
|
|
|
74
97
|
hasError: _propTypes["default"].bool,
|
|
75
98
|
required: _propTypes["default"].bool,
|
|
76
99
|
forLabel: _propTypes["default"].string,
|
|
77
|
-
errorMessage: _propTypes["default"].string
|
|
100
|
+
errorMessage: _propTypes["default"].string,
|
|
101
|
+
sx: _propTypes["default"].object
|
|
78
102
|
};
|
|
79
103
|
Input.displayName = 'Input';
|
|
@@ -13,14 +13,44 @@ var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
var _default = {
|
|
16
|
-
title: 'Input'
|
|
17
|
-
component: _.Input
|
|
16
|
+
title: 'Form/Input'
|
|
18
17
|
};
|
|
19
18
|
exports["default"] = _default;
|
|
20
19
|
|
|
21
20
|
var Default = function Default() {
|
|
22
|
-
return (0, _jsxRuntime.
|
|
23
|
-
|
|
21
|
+
return (0, _jsxRuntime.jsxs)(_.Form.Root, {
|
|
22
|
+
children: [(0, _jsxRuntime.jsx)(_.Form.Input, {
|
|
23
|
+
placeholder: "Your input here...",
|
|
24
|
+
label: "Always add a label to inputs",
|
|
25
|
+
forLabel: "input-simple"
|
|
26
|
+
}), (0, _jsxRuntime.jsx)("hr", {
|
|
27
|
+
sx: {
|
|
28
|
+
my: 4
|
|
29
|
+
}
|
|
30
|
+
}), (0, _jsxRuntime.jsx)(_.Form.Input, {
|
|
31
|
+
forLabel: "input-with-error",
|
|
32
|
+
label: "Error Input",
|
|
33
|
+
errorMessage: "Please type numeric characters only",
|
|
34
|
+
hasError: true
|
|
35
|
+
}), (0, _jsxRuntime.jsx)("hr", {
|
|
36
|
+
sx: {
|
|
37
|
+
my: 4
|
|
38
|
+
}
|
|
39
|
+
}), (0, _jsxRuntime.jsx)(_.Form.Input, {
|
|
40
|
+
forLabel: "input-with-required",
|
|
41
|
+
label: "Required",
|
|
42
|
+
required: true
|
|
43
|
+
}), (0, _jsxRuntime.jsx)("hr", {
|
|
44
|
+
sx: {
|
|
45
|
+
my: 4
|
|
46
|
+
}
|
|
47
|
+
}), (0, _jsxRuntime.jsx)(_.Form.Label, {
|
|
48
|
+
htmlFor: "input-with-custom-label",
|
|
49
|
+
children: "Custom Label outside the Input"
|
|
50
|
+
}), (0, _jsxRuntime.jsx)(_.Form.Input, {
|
|
51
|
+
forLabel: "input-with-custom-label",
|
|
52
|
+
required: true
|
|
53
|
+
})]
|
|
24
54
|
});
|
|
25
55
|
};
|
|
26
56
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.MultiSelect = void 0;
|
|
5
|
+
|
|
6
|
+
var _reactSelect = _interopRequireDefault(require("react-select"));
|
|
7
|
+
|
|
8
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
|
+
|
|
14
|
+
var vipGold = '#c29c69'; // hardcoding for now
|
|
15
|
+
|
|
16
|
+
var vipGrey2 = '#d7dee2';
|
|
17
|
+
var customStyles = {
|
|
18
|
+
control: function control(styles) {
|
|
19
|
+
return _extends({}, styles, {
|
|
20
|
+
border: "1px solid " + vipGrey2,
|
|
21
|
+
boxShadow: 'none',
|
|
22
|
+
'&:hover': {
|
|
23
|
+
border: "1px solid " + vipGold
|
|
24
|
+
},
|
|
25
|
+
'&:focus': {
|
|
26
|
+
border: "1px solid " + vipGold
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var MultiSelect = function MultiSelect(props) {
|
|
33
|
+
return (0, _jsxRuntime.jsx)(_reactSelect["default"], _extends({}, props, {
|
|
34
|
+
styles: customStyles
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.MultiSelect = MultiSelect;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.Default = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = require("react");
|
|
7
|
+
|
|
8
|
+
var _ = require("..");
|
|
9
|
+
|
|
10
|
+
var _Radio = require("./Radio");
|
|
11
|
+
|
|
12
|
+
var _Label = require("./Label");
|
|
13
|
+
|
|
14
|
+
var _Flex = require("../Flex");
|
|
15
|
+
|
|
16
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* External dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
var _default = {
|
|
26
|
+
title: 'Form/Radio',
|
|
27
|
+
component: _Radio.Radio
|
|
28
|
+
};
|
|
29
|
+
exports["default"] = _default;
|
|
30
|
+
|
|
31
|
+
var Default = function Default() {
|
|
32
|
+
var _useState = (0, _react.useState)('a'),
|
|
33
|
+
checked = _useState[0],
|
|
34
|
+
setChecked = _useState[1];
|
|
35
|
+
|
|
36
|
+
return (0, _jsxRuntime.jsxs)(_.Form.Root, {
|
|
37
|
+
children: [(0, _jsxRuntime.jsxs)("p", {
|
|
38
|
+
children: ["Per recommendation, if you have a Radio button, use a Fieldset with a legend as wrapper to your options.", ' ', (0, _jsxRuntime.jsx)("a", {
|
|
39
|
+
href: "https://a11y-collective.github.io/demos/en/accessible-code/form-fieldsets.html",
|
|
40
|
+
children: "Reference to Form fieldsets"
|
|
41
|
+
})]
|
|
42
|
+
}), (0, _jsxRuntime.jsxs)("fieldset", {
|
|
43
|
+
children: [(0, _jsxRuntime.jsx)("legend", {
|
|
44
|
+
sx: {
|
|
45
|
+
mb: 0,
|
|
46
|
+
fontSize: 2,
|
|
47
|
+
fontWeight: 'bold'
|
|
48
|
+
},
|
|
49
|
+
children: "Apply the policy to these domains"
|
|
50
|
+
}), (0, _jsxRuntime.jsxs)(_Flex.Flex, {
|
|
51
|
+
sx: {
|
|
52
|
+
alignItems: 'center'
|
|
53
|
+
},
|
|
54
|
+
children: [(0, _jsxRuntime.jsx)(_Radio.Radio, {
|
|
55
|
+
name: "includeSubdomains",
|
|
56
|
+
id: "include-all-domains-opt",
|
|
57
|
+
onChange: function onChange() {
|
|
58
|
+
return setChecked('a');
|
|
59
|
+
},
|
|
60
|
+
value: 'a',
|
|
61
|
+
checked: checked === 'a'
|
|
62
|
+
}), (0, _jsxRuntime.jsx)(_Label.Label, {
|
|
63
|
+
htmlFor: "include-all-domains-opt",
|
|
64
|
+
sx: {
|
|
65
|
+
mb: 0
|
|
66
|
+
},
|
|
67
|
+
children: "All domains listed on this environment, and all subdomains"
|
|
68
|
+
})]
|
|
69
|
+
}), (0, _jsxRuntime.jsxs)(_Flex.Flex, {
|
|
70
|
+
sx: {
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
mb: 1
|
|
73
|
+
},
|
|
74
|
+
children: [(0, _jsxRuntime.jsx)(_Radio.Radio, {
|
|
75
|
+
name: "includeSubdomains",
|
|
76
|
+
id: "include-subdomains-opt",
|
|
77
|
+
onChange: function onChange() {
|
|
78
|
+
return setChecked('b');
|
|
79
|
+
},
|
|
80
|
+
checked: checked === 'b',
|
|
81
|
+
value: 'b'
|
|
82
|
+
}), (0, _jsxRuntime.jsx)(_Label.Label, {
|
|
83
|
+
id: "exclude-subdomains",
|
|
84
|
+
htmlFor: "include-subdomains-opt",
|
|
85
|
+
sx: {
|
|
86
|
+
mb: 0
|
|
87
|
+
},
|
|
88
|
+
children: "All domains listed on this environment"
|
|
89
|
+
})]
|
|
90
|
+
})]
|
|
91
|
+
})]
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.Default = Default;
|
|
@@ -7,66 +7,27 @@ exports.Textarea = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
|
|
10
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
-
|
|
12
10
|
var _react = _interopRequireDefault(require("react"));
|
|
13
11
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var _ = require("../");
|
|
12
|
+
var _Input = require("./Input");
|
|
17
13
|
|
|
18
14
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
/** @jsxImportSource theme-ui */
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* External dependencies
|
|
20
|
+
*/
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
|
|
31
|
-
children: [label && (0, _jsxRuntime.jsxs)(_.Label, {
|
|
32
|
-
htmlFor: forLabel,
|
|
33
|
-
children: [label, required && '*']
|
|
34
|
-
}), (0, _jsxRuntime.jsx)("textarea", (0, _extends2["default"])({}, props, {
|
|
35
|
-
ref: ref,
|
|
36
|
-
sx: {
|
|
37
|
-
border: '1px solid',
|
|
38
|
-
borderColor: 'border',
|
|
39
|
-
backgroundColor: 'card',
|
|
40
|
-
borderRadius: 1,
|
|
41
|
-
lineHeight: 'inherit',
|
|
42
|
-
px: 3,
|
|
43
|
-
py: 2,
|
|
44
|
-
fontSize: 2,
|
|
45
|
-
mb: 2,
|
|
46
|
-
color: 'text',
|
|
47
|
-
display: 'block',
|
|
48
|
-
width: '100%',
|
|
49
|
-
'&:focus': {
|
|
50
|
-
borderColor: 'brand.60',
|
|
51
|
-
outline: 'none'
|
|
52
|
-
},
|
|
53
|
-
'&:disabled': {
|
|
54
|
-
backgroundColor: 'background'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
})), hasError && errorMessage && (0, _jsxRuntime.jsx)(_.Validation, {
|
|
58
|
-
children: errorMessage
|
|
59
|
-
})]
|
|
60
|
-
});
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
var Textarea = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
26
|
+
return (0, _jsxRuntime.jsx)(_Input.Input, (0, _extends2["default"])({
|
|
27
|
+
ref: ref,
|
|
28
|
+
as: "textarea"
|
|
29
|
+
}, props));
|
|
61
30
|
});
|
|
62
31
|
|
|
63
32
|
exports.Textarea = Textarea;
|
|
64
|
-
Textarea.propTypes = {
|
|
65
|
-
variant: _propTypes["default"].string,
|
|
66
|
-
label: _propTypes["default"].string,
|
|
67
|
-
hasError: _propTypes["default"].bool,
|
|
68
|
-
required: _propTypes["default"].bool,
|
|
69
|
-
forLabel: _propTypes["default"].string,
|
|
70
|
-
errorMessage: _propTypes["default"].string
|
|
71
|
-
};
|
|
72
33
|
Textarea.displayName = 'Textarea';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.Default = void 0;
|
|
5
|
+
|
|
6
|
+
var Form = _interopRequireWildcard(require("../NewForm"));
|
|
7
|
+
|
|
8
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
|
+
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
|
|
14
|
+
/** @jsxImportSource theme-ui */
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
var _default = {
|
|
20
|
+
title: 'Form/Textarea',
|
|
21
|
+
argTypes: {
|
|
22
|
+
placeholder: {
|
|
23
|
+
type: {
|
|
24
|
+
name: 'string',
|
|
25
|
+
required: false
|
|
26
|
+
},
|
|
27
|
+
control: {
|
|
28
|
+
type: 'text'
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
label: {
|
|
32
|
+
type: {
|
|
33
|
+
name: 'string',
|
|
34
|
+
required: false
|
|
35
|
+
},
|
|
36
|
+
control: {
|
|
37
|
+
type: 'text'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports["default"] = _default;
|
|
43
|
+
|
|
44
|
+
var DefaultComponent = function DefaultComponent() {
|
|
45
|
+
return (0, _jsxRuntime.jsxs)(Form.Root, {
|
|
46
|
+
children: [(0, _jsxRuntime.jsx)(Form.Textarea, {
|
|
47
|
+
forLabel: "my-text-area",
|
|
48
|
+
rows: "5",
|
|
49
|
+
label: "Regular textarea"
|
|
50
|
+
}), (0, _jsxRuntime.jsx)("hr", {
|
|
51
|
+
sx: {
|
|
52
|
+
my: 4
|
|
53
|
+
}
|
|
54
|
+
}), (0, _jsxRuntime.jsx)(Form.Textarea, {
|
|
55
|
+
forLabel: "my-text-area-error",
|
|
56
|
+
rows: "5",
|
|
57
|
+
label: "Error textarea",
|
|
58
|
+
errorMessage: "Please type numeric characters only",
|
|
59
|
+
required: true,
|
|
60
|
+
hasError: true
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var Default = DefaultComponent.bind({});
|
|
66
|
+
exports.Default = Default;
|
|
67
|
+
Default.args = {};
|