@pingux/astro 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/lib/cjs/components/CheckboxField/CheckboxField.js +4 -1
- package/lib/cjs/components/Input/Input.js +3 -11
- package/lib/cjs/components/Input/Input.test.js +14 -2
- package/lib/cjs/components/MultivaluesField/MultivaluesField.js +10 -2
- package/lib/cjs/components/NumberField/NumberField.js +30 -10
- package/lib/cjs/components/NumberField/NumberField.test.js +7 -0
- package/lib/cjs/components/PageHeader/PageHeader.js +3 -0
- package/lib/cjs/components/PageHeader/PageHeader.stories.js +6 -1
- package/lib/cjs/components/RadioGroupField/RadioGroupField.js +9 -5
- package/lib/cjs/components/SelectField/SelectField.stories.js +3 -55
- package/lib/cjs/components/Tabs/Tabs.stories.js +1 -15
- package/lib/cjs/hooks/useField/useField.js +2 -2
- package/lib/cjs/styles/forms/checkbox.js +0 -1
- package/lib/cjs/styles/forms/input.js +1 -1
- package/lib/cjs/styles/forms/label.js +3 -0
- package/lib/cjs/styles/forms/radio.js +1 -1
- package/lib/cjs/styles/forms/switch.js +3 -1
- package/lib/cjs/styles/variants/boxes.js +4 -1
- package/lib/components/CheckboxField/CheckboxField.js +4 -1
- package/lib/components/Input/Input.js +2 -10
- package/lib/components/Input/Input.test.js +11 -2
- package/lib/components/MultivaluesField/MultivaluesField.js +9 -2
- package/lib/components/NumberField/NumberField.js +32 -12
- package/lib/components/NumberField/NumberField.test.js +5 -0
- package/lib/components/PageHeader/PageHeader.js +2 -0
- package/lib/components/PageHeader/PageHeader.stories.js +5 -1
- package/lib/components/RadioGroupField/RadioGroupField.js +9 -5
- package/lib/components/SelectField/SelectField.stories.js +2 -50
- package/lib/components/Tabs/Tabs.stories.js +0 -11
- package/lib/hooks/useField/useField.js +2 -2
- package/lib/styles/forms/checkbox.js +0 -1
- package/lib/styles/forms/input.js +1 -1
- package/lib/styles/forms/label.js +3 -0
- package/lib/styles/forms/radio.js +1 -1
- package/lib/styles/forms/switch.js +3 -1
- package/lib/styles/variants/boxes.js +4 -1
- package/package.json +1 -1
- package/lib/cjs/layouts/ListLayout.stories.js +0 -895
- package/lib/cjs/layouts/SchemaFormLayout.stories.js +0 -139
- package/lib/layouts/ListLayout.stories.js +0 -866
- package/lib/layouts/SchemaFormLayout.stories.js +0 -107
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,23 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.3.1](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.3.0...@pingux/astro@1.3.1) (2022-03-01)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-5110] Remove ListLayout and SchemaLayout stories ([e0ac22b](https://gitlab.corp.pingidentity.com/ux/pingux/commit/e0ac22b4b0d9134edd4dd7c76e92926b33d62962))
|
12
|
+
* [UIP-5152] Deprecate page header component ([a7cf8d6](https://gitlab.corp.pingidentity.com/ux/pingux/commit/a7cf8d6a507805e54a5c3c6bcf047102d2b3813d))
|
13
|
+
* [UIP-5178] NumberField - Spec Update ([0e6a2b7](https://gitlab.corp.pingidentity.com/ux/pingux/commit/0e6a2b79799edf4e9b52bf580ca45043c1b810dc))
|
14
|
+
* [UIP-5212] RadioField and CheckboxField Spacing Update ([b6e8cb4](https://gitlab.corp.pingidentity.com/ux/pingux/commit/b6e8cb47e783c52caff04eb61518e5db15b4479f))
|
15
|
+
* [UIP-5226] MultivaluesField allow props to be spread into TextField ([8806276](https://gitlab.corp.pingidentity.com/ux/pingux/commit/8806276c62bf4ea9cf5d4454fb57a61ec313e375))
|
16
|
+
* [UIP-5241] Switch Label Text and Spacing Updates ([d79f7a4](https://gitlab.corp.pingidentity.com/ux/pingux/commit/d79f7a415b109b9d407677e15614464a34e6fdf8))
|
17
|
+
* [UIP-5244] SelectField Storybook Updates ([a0391ea](https://gitlab.corp.pingidentity.com/ux/pingux/commit/a0391ea2b17ed9c8d0fd7f21ab535d5305f6e233))
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
6
23
|
# [1.3.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.2.1...@pingux/astro@1.3.0) (2022-02-23)
|
7
24
|
|
8
25
|
|
@@ -105,7 +105,10 @@ var CheckboxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
105
105
|
}, fieldLabelProps), (0, _react2.jsx)(_Checkbox["default"], (0, _extends2["default"])({
|
106
106
|
ref: checkboxRef
|
107
107
|
}, fieldControlProps)), label), helperText && (0, _react2.jsx)(_FieldHelperText["default"], {
|
108
|
-
status: status
|
108
|
+
status: status,
|
109
|
+
sx: {
|
110
|
+
pt: 7
|
111
|
+
}
|
109
112
|
}, helperText));
|
110
113
|
});
|
111
114
|
CheckboxField.propTypes = {
|
@@ -14,6 +14,8 @@ exports["default"] = void 0;
|
|
14
14
|
|
15
15
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
16
16
|
|
17
|
+
var _isInteger = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/number/is-integer"));
|
18
|
+
|
17
19
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
18
20
|
|
19
21
|
var _react = _interopRequireWildcard(require("react"));
|
@@ -22,8 +24,6 @@ var _themeUi = require("theme-ui");
|
|
22
24
|
|
23
25
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
24
26
|
|
25
|
-
var _hooks = require("../../hooks");
|
26
|
-
|
27
27
|
var _isValidPositiveInt = _interopRequireDefault(require("../../utils/devUtils/props/isValidPositiveInt"));
|
28
28
|
|
29
29
|
var _react2 = require("@emotion/react");
|
@@ -41,19 +41,11 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
41
41
|
placeholder = props.placeholder,
|
42
42
|
maxLength = props.maxLength,
|
43
43
|
others = (0, _objectWithoutProperties2["default"])(props, ["name", "placeholder", "maxLength"]);
|
44
|
-
var ariaLabel = props['aria-label'] || name;
|
45
|
-
(0, _hooks.useAriaLabelWarning)('Input', ariaLabel || placeholder);
|
46
|
-
|
47
|
-
if (!ariaLabel && !placeholder) {
|
48
|
-
ariaLabel = 'Input';
|
49
|
-
}
|
50
|
-
|
51
44
|
return (0, _react2.jsx)(_themeUi.Input, (0, _extends2["default"])({
|
52
|
-
"aria-label": ariaLabel,
|
53
45
|
ref: ref,
|
54
46
|
name: name,
|
55
47
|
placeholder: placeholder,
|
56
|
-
maxLength: maxLength
|
48
|
+
maxLength: (0, _isInteger["default"])(maxLength) && maxLength > 0 ? maxLength : undefined
|
57
49
|
}, others));
|
58
50
|
});
|
59
51
|
Input.displayName = 'Input';
|
@@ -18,7 +18,8 @@ var _react3 = require("@emotion/react");
|
|
18
18
|
|
19
19
|
var testId = 'test-input';
|
20
20
|
var defaultProps = {
|
21
|
-
'data-testid': testId
|
21
|
+
'data-testid': testId,
|
22
|
+
'aria-label': 'My Input'
|
22
23
|
};
|
23
24
|
|
24
25
|
var getComponent = function getComponent() {
|
@@ -56,7 +57,7 @@ test('maxlength field with a set maxlength', function () {
|
|
56
57
|
|
57
58
|
expect(input.value.length).toBe(3);
|
58
59
|
});
|
59
|
-
test('maxlength field set as
|
60
|
+
test('maxlength field is not set as null', function () {
|
60
61
|
getComponent({
|
61
62
|
maxLength: null
|
62
63
|
});
|
@@ -65,5 +66,16 @@ test('maxlength field set as a negative number or zero', function () {
|
|
65
66
|
|
66
67
|
_userEvent["default"].type(input, 'banana');
|
67
68
|
|
69
|
+
expect(input.value.length).toBe(6);
|
70
|
+
});
|
71
|
+
test('maxlength field is not set as zero', function () {
|
72
|
+
getComponent({
|
73
|
+
maxLength: 0
|
74
|
+
});
|
75
|
+
|
76
|
+
var input = _react2.screen.getByTestId(testId);
|
77
|
+
|
78
|
+
_userEvent["default"].type(input, 'banana');
|
79
|
+
|
68
80
|
expect(input.value.length).toBe(6);
|
69
81
|
});
|
@@ -94,6 +94,7 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
94
94
|
disabledKeys = _props$disabledKeys === void 0 ? [] : _props$disabledKeys,
|
95
95
|
hasAutoFocus = props.hasAutoFocus,
|
96
96
|
hasNoStatusIndicator = props.hasNoStatusIndicator,
|
97
|
+
customInputProps = props.inputProps,
|
97
98
|
isDisabled = props.isDisabled,
|
98
99
|
isNotFlippable = props.isNotFlippable,
|
99
100
|
isReadOnly = props.isReadOnly,
|
@@ -359,7 +360,8 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
359
360
|
})), (0, _react2.jsx)(_overlays.DismissButton, {
|
360
361
|
onDismiss: close
|
361
362
|
}));
|
362
|
-
|
363
|
+
|
364
|
+
var inputProps = _objectSpread(_objectSpread({}, customInputProps), {}, {
|
363
365
|
controlProps: {
|
364
366
|
'aria-expanded': isOpen,
|
365
367
|
role: 'combobox'
|
@@ -375,7 +377,8 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
375
377
|
ref: inputRef,
|
376
378
|
variant: 'forms.input.multivaluesWrapper'
|
377
379
|
}
|
378
|
-
};
|
380
|
+
});
|
381
|
+
|
379
382
|
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_.TextField, (0, _extends2["default"])({
|
380
383
|
onBlur: function onBlur(e) {
|
381
384
|
setIsOpen(false);
|
@@ -425,6 +428,11 @@ MultivaluesField.propTypes = {
|
|
425
428
|
/** Whether the field has a status indicator. */
|
426
429
|
hasNoStatusIndicator: _propTypes["default"].bool,
|
427
430
|
|
431
|
+
/**
|
432
|
+
* Props that get passed as-is to the underlying TextField element
|
433
|
+
*/
|
434
|
+
inputProps: _propTypes["default"].shape({}),
|
435
|
+
|
428
436
|
/** Whether the input is disabled. */
|
429
437
|
isDisabled: _propTypes["default"].bool,
|
430
438
|
|
@@ -38,9 +38,9 @@ var _react = _interopRequireWildcard(require("react"));
|
|
38
38
|
|
39
39
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
40
40
|
|
41
|
-
var
|
41
|
+
var _MenuUpIcon = _interopRequireDefault(require("mdi-react/MenuUpIcon"));
|
42
42
|
|
43
|
-
var
|
43
|
+
var _MenuDownIcon = _interopRequireDefault(require("mdi-react/MenuDownIcon"));
|
44
44
|
|
45
45
|
var _numberfield = require("@react-aria/numberfield");
|
46
46
|
|
@@ -111,17 +111,37 @@ var NumberField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
111
111
|
variant: "numberField.arrows"
|
112
112
|
}, (0, _react2.jsx)(_index.IconButton, (0, _extends2["default"])({}, incrementButtonProps, {
|
113
113
|
ref: decRef,
|
114
|
-
tabIndex: "-1"
|
114
|
+
tabIndex: "-1",
|
115
|
+
p: 0
|
115
116
|
}), (0, _react2.jsx)(_index.Icon, {
|
116
|
-
icon:
|
117
|
-
size:
|
117
|
+
icon: _MenuUpIcon["default"],
|
118
|
+
size: 18
|
118
119
|
})), (0, _react2.jsx)(_index.IconButton, (0, _extends2["default"])({}, decrementButtonProps, {
|
119
120
|
ref: incrRef,
|
120
|
-
tabIndex: "-1"
|
121
|
+
tabIndex: "-1",
|
122
|
+
p: 0
|
121
123
|
}), (0, _react2.jsx)(_index.Icon, {
|
122
|
-
icon:
|
123
|
-
size:
|
124
|
-
})));
|
124
|
+
icon: _MenuDownIcon["default"],
|
125
|
+
size: 18
|
126
|
+
}))); // this needed to remove console warning in React 16
|
127
|
+
// I believe once we update to 17 - we can remove this
|
128
|
+
|
129
|
+
var onInputFocus = (0, _react.useCallback)(function (e) {
|
130
|
+
e.persist();
|
131
|
+
fieldControlProps.onFocus(e);
|
132
|
+
inputProps.onFocus(e);
|
133
|
+
}, [fieldControlProps, inputProps]);
|
134
|
+
var onInputBlur = (0, _react.useCallback)(function (e) {
|
135
|
+
e.persist();
|
136
|
+
fieldControlProps.onBlur(e);
|
137
|
+
inputProps.onBlur(e);
|
138
|
+
}, [fieldControlProps, inputProps]);
|
139
|
+
var updatedFieldControlProps = (0, _react.useMemo)(function () {
|
140
|
+
return _objectSpread(_objectSpread({}, fieldControlProps), {}, {
|
141
|
+
onFocus: onInputFocus,
|
142
|
+
onBlur: onInputBlur
|
143
|
+
});
|
144
|
+
}, [fieldControlProps, onInputBlur, onInputFocus]);
|
125
145
|
return (0, _react2.jsx)(_index.Box, fieldContainerProps, (0, _react2.jsx)(_index.Label, (0, _utils.mergeProps)(fieldLabelProps, labelProps)), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
126
146
|
variant: "numberField.noDefaultArrows"
|
127
147
|
}, groupProps), (0, _react2.jsx)(_index.Box, {
|
@@ -132,7 +152,7 @@ var NumberField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
132
152
|
ref: inputRef // we don't want to merge this props, we want to
|
133
153
|
// overwrite them like defaultValue, value, ect.
|
134
154
|
|
135
|
-
},
|
155
|
+
}, updatedFieldControlProps, (0, _omit["default"])(inputProps, ['name', 'onFocus', 'onBlur']))), ControlArrows), helperText && (0, _react2.jsx)(_index.FieldHelperText, {
|
136
156
|
status: status
|
137
157
|
}, helperText)));
|
138
158
|
});
|
@@ -176,4 +176,11 @@ test('number field input receiving name attribute', function () {
|
|
176
176
|
name: testName
|
177
177
|
});
|
178
178
|
expect(_testWrapper.screen.getByLabelText(testLabel)).toHaveAttribute('name', testName);
|
179
|
+
});
|
180
|
+
test('number field can be focused', function () {
|
181
|
+
getComponent();
|
182
|
+
|
183
|
+
_userEvent["default"].tab();
|
184
|
+
|
185
|
+
expect(_testWrapper.screen.getByLabelText(testLabel)).toHaveClass('is-focused');
|
179
186
|
});
|
@@ -24,12 +24,15 @@ var _Text = _interopRequireDefault(require("../Text/Text"));
|
|
24
24
|
|
25
25
|
var _Box = _interopRequireDefault(require("../Box/Box"));
|
26
26
|
|
27
|
+
var _hooks = require("../../hooks");
|
28
|
+
|
27
29
|
var _react2 = require("@emotion/react");
|
28
30
|
|
29
31
|
var PageHeader = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
30
32
|
var title = props.title,
|
31
33
|
children = props.children,
|
32
34
|
others = (0, _objectWithoutProperties2["default"])(props, ["title", "children"]);
|
35
|
+
(0, _hooks.useDeprecationWarning)('The Page Header component will be deprecated in Astro-UI 2.0.0.');
|
33
36
|
return (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
34
37
|
isRow: true,
|
35
38
|
justifyContent: "space-between",
|
@@ -18,11 +18,16 @@ var _PageHeader = _interopRequireDefault(require("../PageHeader/PageHeader"));
|
|
18
18
|
|
19
19
|
var _Button = _interopRequireDefault(require("../Button/Button"));
|
20
20
|
|
21
|
+
var _withDeprecationWarning = _interopRequireDefault(require("../../utils/devUtils/decorators/withDeprecationWarning"));
|
22
|
+
|
21
23
|
var _react2 = require("@emotion/react");
|
22
24
|
|
23
25
|
var _default = {
|
24
|
-
title: 'PageHeader',
|
26
|
+
title: 'Deprecated/PageHeader',
|
25
27
|
component: _PageHeader["default"],
|
28
|
+
decorators: [function (Story, context) {
|
29
|
+
return (0, _withDeprecationWarning["default"])(Story, context, 'The `PageHeader` component will be deprecated in Astro-UI 2.0.0.');
|
30
|
+
}],
|
26
31
|
argTypes: {
|
27
32
|
title: {
|
28
33
|
control: {
|
@@ -98,17 +98,21 @@ var RadioGroupField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
98
98
|
}, radioGroupProps), (0, _react2.jsx)(_Label["default"], (0, _extends2["default"])({
|
99
99
|
isDisabled: isDisabled,
|
100
100
|
hintText: hintText,
|
101
|
-
isRequired: isRequired
|
102
|
-
|
103
|
-
|
104
|
-
}, helperText), (0, _react2.jsx)(_Box["default"], {
|
101
|
+
isRequired: isRequired,
|
102
|
+
variant: "forms.label.radioGroup"
|
103
|
+
}, labelProps), label), (0, _react2.jsx)(_Box["default"], {
|
105
104
|
variant: "forms.radioGroupWrapper",
|
106
105
|
isRow: orientation === _orientation["default"].HORIZONTAL
|
107
106
|
}, (0, _react2.jsx)(_RadioField.RadioContext.Provider, {
|
108
107
|
value: _objectSpread({
|
109
108
|
isDisabled: isDisabled
|
110
109
|
}, state)
|
111
|
-
}, children)))
|
110
|
+
}, children)), helperText && (0, _react2.jsx)(_FieldHelperText["default"], {
|
111
|
+
status: status,
|
112
|
+
sx: {
|
113
|
+
pt: 'xs'
|
114
|
+
}
|
115
|
+
}, helperText));
|
112
116
|
});
|
113
117
|
RadioGroupField.propTypes = {
|
114
118
|
/** The name of the RadioGroupField, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name_and_radio_buttons). */
|
@@ -10,7 +10,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
10
10
|
value: true
|
11
11
|
});
|
12
12
|
|
13
|
-
exports.WithoutStatusIndicator = exports.AsyncLoading = exports.DynamicItems = exports.HelperText = exports.NoOptionsAvailable = exports.DisabledOptions = exports.DisabledField = exports.WithNoneOption = exports.Controlled = exports.
|
13
|
+
exports.WithoutStatusIndicator = exports.AsyncLoading = exports.DynamicItems = exports.HelperText = exports.NoOptionsAvailable = exports.DisabledOptions = exports.DisabledField = exports.WithNoneOption = exports.Controlled = exports.FloatLabel = exports.WithCustomHeight = exports.WithSections = exports.Default = exports["default"] = void 0;
|
14
14
|
|
15
15
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
16
16
|
|
@@ -42,8 +42,6 @@ var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/s
|
|
42
42
|
|
43
43
|
var _constants = require("../Label/constants");
|
44
44
|
|
45
|
-
var _Box = _interopRequireDefault(require("../Box"));
|
46
|
-
|
47
45
|
var _react2 = require("@emotion/react");
|
48
46
|
|
49
47
|
var _context, _context2;
|
@@ -239,55 +237,6 @@ var FloatLabel = function FloatLabel() {
|
|
239
237
|
|
240
238
|
exports.FloatLabel = FloatLabel;
|
241
239
|
|
242
|
-
var LeftLabel = function LeftLabel() {
|
243
|
-
return (0, _react2.jsx)(_Box["default"], {
|
244
|
-
gap: "xl",
|
245
|
-
width: "100%"
|
246
|
-
}, (0, _react2.jsx)(_index.SelectField, {
|
247
|
-
helperText: "Here is some helpful text...",
|
248
|
-
label: "Example Label",
|
249
|
-
labelMode: "left"
|
250
|
-
}, (0, _react2.jsx)(_index.Item, {
|
251
|
-
key: "red"
|
252
|
-
}, "Red"), (0, _react2.jsx)(_index.Item, {
|
253
|
-
key: "blue"
|
254
|
-
}, "Blue"), (0, _react2.jsx)(_index.Item, {
|
255
|
-
key: "yellow"
|
256
|
-
}, "Yellow")), (0, _react2.jsx)(_index.SelectField, {
|
257
|
-
label: "Example Label that is much longer than the previous one",
|
258
|
-
labelMode: "left"
|
259
|
-
}, (0, _react2.jsx)(_index.Item, {
|
260
|
-
key: "red"
|
261
|
-
}, "Red"), (0, _react2.jsx)(_index.Item, {
|
262
|
-
key: "blue"
|
263
|
-
}, "Blue"), (0, _react2.jsx)(_index.Item, {
|
264
|
-
key: "yellow"
|
265
|
-
}, "Yellow")), (0, _react2.jsx)(_index.SelectField, {
|
266
|
-
label: "Example label with set width",
|
267
|
-
labelMode: "left",
|
268
|
-
containerProps: {
|
269
|
-
sx: {
|
270
|
-
gridTemplateColumns: '120px auto'
|
271
|
-
}
|
272
|
-
}
|
273
|
-
}, (0, _react2.jsx)(_index.Item, {
|
274
|
-
key: "red"
|
275
|
-
}, "Red"), (0, _react2.jsx)(_index.Item, {
|
276
|
-
key: "blue"
|
277
|
-
}, "Blue"), (0, _react2.jsx)(_index.Item, {
|
278
|
-
key: "yellow"
|
279
|
-
}, "Yellow")));
|
280
|
-
};
|
281
|
-
|
282
|
-
exports.LeftLabel = LeftLabel;
|
283
|
-
LeftLabel.parameters = {
|
284
|
-
docs: {
|
285
|
-
description: {
|
286
|
-
story: 'Users are able to override the default 40% column width when using left label by providing a new gridTemplatesColumn value, as shown in the example below.'
|
287
|
-
}
|
288
|
-
}
|
289
|
-
};
|
290
|
-
|
291
240
|
var Controlled = function Controlled() {
|
292
241
|
var _useState = (0, _react.useState)('yellow'),
|
293
242
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
@@ -355,7 +304,7 @@ var DisabledOptions = function DisabledOptions() {
|
|
355
304
|
key: "red"
|
356
305
|
}, "Red"), (0, _react2.jsx)(_index.Item, {
|
357
306
|
key: "blue"
|
358
|
-
}, "Blue
|
307
|
+
}, "Blue"), (0, _react2.jsx)(_index.Item, {
|
359
308
|
key: "yellow"
|
360
309
|
}, "Yellow"));
|
361
310
|
};
|
@@ -365,8 +314,7 @@ exports.DisabledOptions = DisabledOptions;
|
|
365
314
|
var NoOptionsAvailable = function NoOptionsAvailable() {
|
366
315
|
return (0, _react2.jsx)(_index.SelectField, {
|
367
316
|
label: "Select an option...",
|
368
|
-
|
369
|
-
defaultText: "No options available"
|
317
|
+
placeholder: "No options available"
|
370
318
|
});
|
371
319
|
};
|
372
320
|
|
@@ -10,7 +10,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
10
10
|
value: true
|
11
11
|
});
|
12
12
|
|
13
|
-
exports.ContentSlots = exports.TabPanelProps = exports.
|
13
|
+
exports.ContentSlots = exports.TabPanelProps = exports.CustomTabLine = exports.DisabledAllTabs = exports.DisabledSingleTab = exports.Centered = exports.WithTooltips = exports.WithIcon = exports.Controlled = exports.Uncontrolled = exports["default"] = void 0;
|
14
14
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
16
16
|
|
@@ -212,20 +212,6 @@ var CustomTabLine = function CustomTabLine() {
|
|
212
212
|
|
213
213
|
exports.CustomTabLine = CustomTabLine;
|
214
214
|
|
215
|
-
var Orientation = function Orientation() {
|
216
|
-
return (0, _react2.jsx)(_Tabs["default"], {
|
217
|
-
orientation: "vertical",
|
218
|
-
items: tabs
|
219
|
-
}, function (item) {
|
220
|
-
return (0, _react2.jsx)(_Tab["default"], {
|
221
|
-
key: item.name,
|
222
|
-
title: item.name
|
223
|
-
}, item.children);
|
224
|
-
});
|
225
|
-
};
|
226
|
-
|
227
|
-
exports.Orientation = Orientation;
|
228
|
-
|
229
215
|
var TabPanelProps = function TabPanelProps() {
|
230
216
|
return (0, _react2.jsx)(_Tabs["default"], {
|
231
217
|
tabPanelProps: {
|
@@ -186,8 +186,8 @@ var useField = function useField() {
|
|
186
186
|
}),
|
187
187
|
focusWithinProps = _useFocusWithin.focusWithinProps;
|
188
188
|
|
189
|
-
var isFloatLabel = labelMode === _constants.modes.FLOAT;
|
190
|
-
var isLeftLabel = labelMode === _constants.modes.LEFT;
|
189
|
+
var isFloatLabel = labelMode === _constants.modes.FLOAT || (labelProps === null || labelProps === void 0 ? void 0 : labelProps.labelMode) === _constants.modes.FLOAT;
|
190
|
+
var isLeftLabel = labelMode === _constants.modes.LEFT || (labelProps === null || labelProps === void 0 ? void 0 : labelProps.labelMode) === _constants.modes.LEFT;
|
191
191
|
var isFloatLabelActive = isFloatLabel && (hasValue || hasFocusWithin || (containerProps === null || containerProps === void 0 ? void 0 : containerProps.isFloatLabelActive));
|
192
192
|
|
193
193
|
var _useStatusClasses2 = (0, _hooks.useStatusClasses)(containerProps === null || containerProps === void 0 ? void 0 : containerProps.className, {
|
@@ -8,7 +8,9 @@ _Object$defineProperty(exports, "__esModule", {
|
|
8
8
|
|
9
9
|
exports.thumb = exports.thumbContainer = exports.container = exports.label = void 0;
|
10
10
|
var label = {
|
11
|
-
alignItems: 'center'
|
11
|
+
alignItems: 'center',
|
12
|
+
fontSize: 'md',
|
13
|
+
color: 'text.primary'
|
12
14
|
};
|
13
15
|
exports.label = label;
|
14
16
|
var container = {
|
@@ -55,7 +55,10 @@ var radioContainer = {
|
|
55
55
|
}; // Used to add spacing for content shown when a radio is checked
|
56
56
|
|
57
57
|
var radioCheckedContent = {
|
58
|
-
|
58
|
+
pb: 'sm',
|
59
|
+
pl: 'lg',
|
60
|
+
color: 'text.secondary',
|
61
|
+
fontSize: 'md'
|
59
62
|
};
|
60
63
|
|
61
64
|
var listItem = _objectSpread(_objectSpread({}, base), {}, {
|
@@ -71,7 +71,10 @@ var CheckboxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
71
71
|
}, fieldLabelProps), ___EmotionJSX(Checkbox, _extends({
|
72
72
|
ref: checkboxRef
|
73
73
|
}, fieldControlProps)), label), helperText && ___EmotionJSX(FieldHelperText, {
|
74
|
-
status: status
|
74
|
+
status: status,
|
75
|
+
sx: {
|
76
|
+
pt: 7
|
77
|
+
}
|
75
78
|
}, helperText));
|
76
79
|
});
|
77
80
|
CheckboxField.propTypes = {
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import _Number$isInteger from "@babel/runtime-corejs3/core-js-stable/number/is-integer";
|
2
3
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
3
4
|
import React, { forwardRef } from 'react';
|
4
5
|
import { Input as ThemeUIInput } from 'theme-ui';
|
5
6
|
import PropTypes from 'prop-types';
|
6
|
-
import { useAriaLabelWarning } from '../../hooks';
|
7
7
|
import isValidPositiveInt from '../../utils/devUtils/props/isValidPositiveInt';
|
8
8
|
/**
|
9
9
|
* Base input component.
|
@@ -21,19 +21,11 @@ var Input = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
21
21
|
maxLength = props.maxLength,
|
22
22
|
others = _objectWithoutProperties(props, ["name", "placeholder", "maxLength"]);
|
23
23
|
|
24
|
-
var ariaLabel = props['aria-label'] || name;
|
25
|
-
useAriaLabelWarning('Input', ariaLabel || placeholder);
|
26
|
-
|
27
|
-
if (!ariaLabel && !placeholder) {
|
28
|
-
ariaLabel = 'Input';
|
29
|
-
}
|
30
|
-
|
31
24
|
return ___EmotionJSX(ThemeUIInput, _extends({
|
32
|
-
"aria-label": ariaLabel,
|
33
25
|
ref: ref,
|
34
26
|
name: name,
|
35
27
|
placeholder: placeholder,
|
36
|
-
maxLength: maxLength
|
28
|
+
maxLength: _Number$isInteger(maxLength) && maxLength > 0 ? maxLength : undefined
|
37
29
|
}, others));
|
38
30
|
});
|
39
31
|
Input.displayName = 'Input';
|
@@ -7,7 +7,8 @@ import axeTest from '../../utils/testUtils/testAxe';
|
|
7
7
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
8
|
var testId = 'test-input';
|
9
9
|
var defaultProps = {
|
10
|
-
'data-testid': testId
|
10
|
+
'data-testid': testId,
|
11
|
+
'aria-label': 'My Input'
|
11
12
|
};
|
12
13
|
|
13
14
|
var getComponent = function getComponent() {
|
@@ -38,11 +39,19 @@ test('maxlength field with a set maxlength', function () {
|
|
38
39
|
userEvent.type(input, 'banana');
|
39
40
|
expect(input.value.length).toBe(3);
|
40
41
|
});
|
41
|
-
test('maxlength field set as
|
42
|
+
test('maxlength field is not set as null', function () {
|
42
43
|
getComponent({
|
43
44
|
maxLength: null
|
44
45
|
});
|
45
46
|
var input = screen.getByTestId(testId);
|
46
47
|
userEvent.type(input, 'banana');
|
47
48
|
expect(input.value.length).toBe(6);
|
49
|
+
});
|
50
|
+
test('maxlength field is not set as zero', function () {
|
51
|
+
getComponent({
|
52
|
+
maxLength: 0
|
53
|
+
});
|
54
|
+
var input = screen.getByTestId(testId);
|
55
|
+
userEvent.type(input, 'banana');
|
56
|
+
expect(input.value.length).toBe(6);
|
48
57
|
});
|
@@ -52,6 +52,7 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
52
52
|
disabledKeys = _props$disabledKeys === void 0 ? [] : _props$disabledKeys,
|
53
53
|
hasAutoFocus = props.hasAutoFocus,
|
54
54
|
hasNoStatusIndicator = props.hasNoStatusIndicator,
|
55
|
+
customInputProps = props.inputProps,
|
55
56
|
isDisabled = props.isDisabled,
|
56
57
|
isNotFlippable = props.isNotFlippable,
|
57
58
|
isReadOnly = props.isReadOnly,
|
@@ -319,7 +320,7 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
319
320
|
onDismiss: close
|
320
321
|
}));
|
321
322
|
|
322
|
-
var inputProps = {
|
323
|
+
var inputProps = _objectSpread(_objectSpread({}, customInputProps), {}, {
|
323
324
|
controlProps: {
|
324
325
|
'aria-expanded': isOpen,
|
325
326
|
role: 'combobox'
|
@@ -335,7 +336,8 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
335
336
|
ref: inputRef,
|
336
337
|
variant: 'forms.input.multivaluesWrapper'
|
337
338
|
}
|
338
|
-
};
|
339
|
+
});
|
340
|
+
|
339
341
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(TextField, _extends({
|
340
342
|
onBlur: function onBlur(e) {
|
341
343
|
setIsOpen(false);
|
@@ -385,6 +387,11 @@ MultivaluesField.propTypes = {
|
|
385
387
|
/** Whether the field has a status indicator. */
|
386
388
|
hasNoStatusIndicator: PropTypes.bool,
|
387
389
|
|
390
|
+
/**
|
391
|
+
* Props that get passed as-is to the underlying TextField element
|
392
|
+
*/
|
393
|
+
inputProps: PropTypes.shape({}),
|
394
|
+
|
388
395
|
/** Whether the input is disabled. */
|
389
396
|
isDisabled: PropTypes.bool,
|
390
397
|
|