@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
@@ -14,10 +14,10 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
14
14
|
|
15
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
16
16
|
|
17
|
-
import React, { forwardRef, useImperativeHandle } from 'react';
|
17
|
+
import React, { forwardRef, useCallback, useImperativeHandle, useMemo } from 'react';
|
18
18
|
import PropTypes from 'prop-types';
|
19
|
-
import
|
20
|
-
import
|
19
|
+
import MenuUp from 'mdi-react/MenuUpIcon';
|
20
|
+
import MenuDown from 'mdi-react/MenuDownIcon';
|
21
21
|
import { useNumberField } from '@react-aria/numberfield';
|
22
22
|
import { useNumberFieldState } from '@react-stately/numberfield';
|
23
23
|
import { useLocale } from '@react-aria/i18n';
|
@@ -73,18 +73,38 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
73
73
|
variant: "numberField.arrows"
|
74
74
|
}, ___EmotionJSX(IconButton, _extends({}, incrementButtonProps, {
|
75
75
|
ref: decRef,
|
76
|
-
tabIndex: "-1"
|
76
|
+
tabIndex: "-1",
|
77
|
+
p: 0
|
77
78
|
}), ___EmotionJSX(Icon, {
|
78
|
-
icon:
|
79
|
-
size:
|
79
|
+
icon: MenuUp,
|
80
|
+
size: 18
|
80
81
|
})), ___EmotionJSX(IconButton, _extends({}, decrementButtonProps, {
|
81
82
|
ref: incrRef,
|
82
|
-
tabIndex: "-1"
|
83
|
+
tabIndex: "-1",
|
84
|
+
p: 0
|
83
85
|
}), ___EmotionJSX(Icon, {
|
84
|
-
icon:
|
85
|
-
size:
|
86
|
-
})));
|
87
|
-
|
86
|
+
icon: MenuDown,
|
87
|
+
size: 18
|
88
|
+
}))); // this needed to remove console warning in React 16
|
89
|
+
// I believe once we update to 17 - we can remove this
|
90
|
+
|
91
|
+
|
92
|
+
var onInputFocus = useCallback(function (e) {
|
93
|
+
e.persist();
|
94
|
+
fieldControlProps.onFocus(e);
|
95
|
+
inputProps.onFocus(e);
|
96
|
+
}, [fieldControlProps, inputProps]);
|
97
|
+
var onInputBlur = useCallback(function (e) {
|
98
|
+
e.persist();
|
99
|
+
fieldControlProps.onBlur(e);
|
100
|
+
inputProps.onBlur(e);
|
101
|
+
}, [fieldControlProps, inputProps]);
|
102
|
+
var updatedFieldControlProps = useMemo(function () {
|
103
|
+
return _objectSpread(_objectSpread({}, fieldControlProps), {}, {
|
104
|
+
onFocus: onInputFocus,
|
105
|
+
onBlur: onInputBlur
|
106
|
+
});
|
107
|
+
}, [fieldControlProps, onInputBlur, onInputFocus]);
|
88
108
|
return ___EmotionJSX(Box, fieldContainerProps, ___EmotionJSX(Label, mergeProps(fieldLabelProps, labelProps)), ___EmotionJSX(Box, _extends({
|
89
109
|
variant: "numberField.noDefaultArrows"
|
90
110
|
}, groupProps), ___EmotionJSX(Box, {
|
@@ -95,7 +115,7 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
95
115
|
ref: inputRef // we don't want to merge this props, we want to
|
96
116
|
// overwrite them like defaultValue, value, ect.
|
97
117
|
|
98
|
-
},
|
118
|
+
}, updatedFieldControlProps, omit(inputProps, ['name', 'onFocus', 'onBlur']))), ControlArrows), helperText && ___EmotionJSX(FieldHelperText, {
|
99
119
|
status: status
|
100
120
|
}, helperText)));
|
101
121
|
});
|
@@ -135,4 +135,9 @@ test('number field input receiving name attribute', function () {
|
|
135
135
|
name: testName
|
136
136
|
});
|
137
137
|
expect(screen.getByLabelText(testLabel)).toHaveAttribute('name', testName);
|
138
|
+
});
|
139
|
+
test('number field can be focused', function () {
|
140
|
+
getComponent();
|
141
|
+
userEvent.tab();
|
142
|
+
expect(screen.getByLabelText(testLabel)).toHaveClass('is-focused');
|
138
143
|
});
|
@@ -4,12 +4,14 @@ import React, { forwardRef } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
5
5
|
import Text from '../Text/Text';
|
6
6
|
import Box from '../Box/Box';
|
7
|
+
import { useDeprecationWarning } from '../../hooks';
|
7
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
9
|
var PageHeader = /*#__PURE__*/forwardRef(function (props, ref) {
|
9
10
|
var title = props.title,
|
10
11
|
children = props.children,
|
11
12
|
others = _objectWithoutProperties(props, ["title", "children"]);
|
12
13
|
|
14
|
+
useDeprecationWarning('The Page Header component will be deprecated in Astro-UI 2.0.0.');
|
13
15
|
return ___EmotionJSX(Box, _extends({
|
14
16
|
isRow: true,
|
15
17
|
justifyContent: "space-between",
|
@@ -2,10 +2,14 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
2
|
import React from 'react';
|
3
3
|
import PageHeader from '../PageHeader/PageHeader';
|
4
4
|
import Button from '../Button/Button';
|
5
|
+
import withDeprecationWarning from '../../utils/devUtils/decorators/withDeprecationWarning';
|
5
6
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
6
7
|
export default {
|
7
|
-
title: 'PageHeader',
|
8
|
+
title: 'Deprecated/PageHeader',
|
8
9
|
component: PageHeader,
|
10
|
+
decorators: [function (Story, context) {
|
11
|
+
return withDeprecationWarning(Story, context, 'The `PageHeader` component will be deprecated in Astro-UI 2.0.0.');
|
12
|
+
}],
|
9
13
|
argTypes: {
|
10
14
|
title: {
|
11
15
|
control: {
|
@@ -63,17 +63,21 @@ var RadioGroupField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
63
63
|
}, radioGroupProps), ___EmotionJSX(Label, _extends({
|
64
64
|
isDisabled: isDisabled,
|
65
65
|
hintText: hintText,
|
66
|
-
isRequired: isRequired
|
67
|
-
|
68
|
-
|
69
|
-
}, helperText), ___EmotionJSX(Box, {
|
66
|
+
isRequired: isRequired,
|
67
|
+
variant: "forms.label.radioGroup"
|
68
|
+
}, labelProps), label), ___EmotionJSX(Box, {
|
70
69
|
variant: "forms.radioGroupWrapper",
|
71
70
|
isRow: orientation === ORIENTATION.HORIZONTAL
|
72
71
|
}, ___EmotionJSX(RadioContext.Provider, {
|
73
72
|
value: _objectSpread({
|
74
73
|
isDisabled: isDisabled
|
75
74
|
}, state)
|
76
|
-
}, children))
|
75
|
+
}, children)), helperText && ___EmotionJSX(FieldHelperText, {
|
76
|
+
status: status,
|
77
|
+
sx: {
|
78
|
+
pt: 'xs'
|
79
|
+
}
|
80
|
+
}, helperText));
|
77
81
|
});
|
78
82
|
RadioGroupField.propTypes = {
|
79
83
|
/** 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). */
|
@@ -16,7 +16,6 @@ import { useAsyncList } from '@react-stately/data';
|
|
16
16
|
import { SelectField, Item, Separator, Section } from '../../index';
|
17
17
|
import statuses from '../../utils/devUtils/constants/statuses';
|
18
18
|
import { modes as labelModes } from '../Label/constants';
|
19
|
-
import Box from '../Box';
|
20
19
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
21
20
|
var animals = [{
|
22
21
|
name: 'Aardvark',
|
@@ -195,52 +194,6 @@ export var FloatLabel = function FloatLabel() {
|
|
195
194
|
key: "yellow"
|
196
195
|
}, "Yellow"));
|
197
196
|
};
|
198
|
-
export var LeftLabel = function LeftLabel() {
|
199
|
-
return ___EmotionJSX(Box, {
|
200
|
-
gap: "xl",
|
201
|
-
width: "100%"
|
202
|
-
}, ___EmotionJSX(SelectField, {
|
203
|
-
helperText: "Here is some helpful text...",
|
204
|
-
label: "Example Label",
|
205
|
-
labelMode: "left"
|
206
|
-
}, ___EmotionJSX(Item, {
|
207
|
-
key: "red"
|
208
|
-
}, "Red"), ___EmotionJSX(Item, {
|
209
|
-
key: "blue"
|
210
|
-
}, "Blue"), ___EmotionJSX(Item, {
|
211
|
-
key: "yellow"
|
212
|
-
}, "Yellow")), ___EmotionJSX(SelectField, {
|
213
|
-
label: "Example Label that is much longer than the previous one",
|
214
|
-
labelMode: "left"
|
215
|
-
}, ___EmotionJSX(Item, {
|
216
|
-
key: "red"
|
217
|
-
}, "Red"), ___EmotionJSX(Item, {
|
218
|
-
key: "blue"
|
219
|
-
}, "Blue"), ___EmotionJSX(Item, {
|
220
|
-
key: "yellow"
|
221
|
-
}, "Yellow")), ___EmotionJSX(SelectField, {
|
222
|
-
label: "Example label with set width",
|
223
|
-
labelMode: "left",
|
224
|
-
containerProps: {
|
225
|
-
sx: {
|
226
|
-
gridTemplateColumns: '120px auto'
|
227
|
-
}
|
228
|
-
}
|
229
|
-
}, ___EmotionJSX(Item, {
|
230
|
-
key: "red"
|
231
|
-
}, "Red"), ___EmotionJSX(Item, {
|
232
|
-
key: "blue"
|
233
|
-
}, "Blue"), ___EmotionJSX(Item, {
|
234
|
-
key: "yellow"
|
235
|
-
}, "Yellow")));
|
236
|
-
};
|
237
|
-
LeftLabel.parameters = {
|
238
|
-
docs: {
|
239
|
-
description: {
|
240
|
-
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.'
|
241
|
-
}
|
242
|
-
}
|
243
|
-
};
|
244
197
|
export var Controlled = function Controlled() {
|
245
198
|
var _useState = useState('yellow'),
|
246
199
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -299,15 +252,14 @@ export var DisabledOptions = function DisabledOptions() {
|
|
299
252
|
key: "red"
|
300
253
|
}, "Red"), ___EmotionJSX(Item, {
|
301
254
|
key: "blue"
|
302
|
-
}, "Blue
|
255
|
+
}, "Blue"), ___EmotionJSX(Item, {
|
303
256
|
key: "yellow"
|
304
257
|
}, "Yellow"));
|
305
258
|
};
|
306
259
|
export var NoOptionsAvailable = function NoOptionsAvailable() {
|
307
260
|
return ___EmotionJSX(SelectField, {
|
308
261
|
label: "Select an option...",
|
309
|
-
|
310
|
-
defaultText: "No options available"
|
262
|
+
placeholder: "No options available"
|
311
263
|
});
|
312
264
|
};
|
313
265
|
export var HelperText = function HelperText() {
|
@@ -161,17 +161,6 @@ export var CustomTabLine = function CustomTabLine() {
|
|
161
161
|
}, item.children);
|
162
162
|
});
|
163
163
|
};
|
164
|
-
export var Orientation = function Orientation() {
|
165
|
-
return ___EmotionJSX(Tabs, {
|
166
|
-
orientation: "vertical",
|
167
|
-
items: tabs
|
168
|
-
}, function (item) {
|
169
|
-
return ___EmotionJSX(Tab, {
|
170
|
-
key: item.name,
|
171
|
-
title: item.name
|
172
|
-
}, item.children);
|
173
|
-
});
|
174
|
-
};
|
175
164
|
export var TabPanelProps = function TabPanelProps() {
|
176
165
|
return ___EmotionJSX(Tabs, {
|
177
166
|
tabPanelProps: {
|
@@ -156,8 +156,8 @@ var useField = function useField() {
|
|
156
156
|
}),
|
157
157
|
focusWithinProps = _useFocusWithin.focusWithinProps;
|
158
158
|
|
159
|
-
var isFloatLabel = labelMode === labelModes.FLOAT;
|
160
|
-
var isLeftLabel = labelMode === labelModes.LEFT;
|
159
|
+
var isFloatLabel = labelMode === labelModes.FLOAT || (labelProps === null || labelProps === void 0 ? void 0 : labelProps.labelMode) === labelModes.FLOAT;
|
160
|
+
var isLeftLabel = labelMode === labelModes.LEFT || (labelProps === null || labelProps === void 0 ? void 0 : labelProps.labelMode) === labelModes.LEFT;
|
161
161
|
var isFloatLabelActive = isFloatLabel && (hasValue || hasFocusWithin || (containerProps === null || containerProps === void 0 ? void 0 : containerProps.isFloatLabelActive));
|
162
162
|
|
163
163
|
var _useStatusClasses2 = useStatusClasses(containerProps === null || containerProps === void 0 ? void 0 : containerProps.className, {
|
@@ -34,7 +34,10 @@ var radioContainer = {
|
|
34
34
|
}; // Used to add spacing for content shown when a radio is checked
|
35
35
|
|
36
36
|
var radioCheckedContent = {
|
37
|
-
|
37
|
+
pb: 'sm',
|
38
|
+
pl: 'lg',
|
39
|
+
color: 'text.secondary',
|
40
|
+
fontSize: 'md'
|
38
41
|
};
|
39
42
|
|
40
43
|
var listItem = _objectSpread(_objectSpread({}, base), {}, {
|