@pingux/astro 1.27.0-alpha.0 → 1.27.0-alpha.10
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/lib/cjs/components/ArrayField/ArrayField.stories.js +6 -6
- package/lib/cjs/components/FileInputField/FileInputField.js +8 -5
- package/lib/cjs/components/LinkSelectField/LinkSelectField.js +1 -1
- package/lib/cjs/components/ListBox/Option.js +4 -1
- package/lib/cjs/components/MenuItem/MenuItem.js +2 -1
- package/lib/cjs/components/Messages/Message.js +2 -1
- package/lib/cjs/components/PageHeader/PageHeader.js +7 -1
- package/lib/cjs/components/SelectField/SelectField.js +1 -1
- package/lib/cjs/components/Tab/Tab.js +15 -4
- package/lib/cjs/components/TabPicker/TabPicker.js +2 -2
- package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.test.js +3 -2
- package/lib/cjs/hooks/useSelectField/useSelectField.js +9 -1
- package/lib/cjs/recipes/CountryPicker.stories.js +25 -12
- package/lib/cjs/recipes/EditableInput.stories.js +55 -46
- package/lib/cjs/recipes/ListAndPanel.stories.js +102 -87
- package/lib/cjs/recipes/PageHeader.stories.js +73 -0
- package/lib/components/ArrayField/ArrayField.stories.js +6 -6
- package/lib/components/FileInputField/FileInputField.js +8 -5
- package/lib/components/LinkSelectField/LinkSelectField.js +1 -1
- package/lib/components/ListBox/Option.js +4 -1
- package/lib/components/MenuItem/MenuItem.js +2 -1
- package/lib/components/Messages/Message.js +2 -1
- package/lib/components/PageHeader/PageHeader.js +8 -1
- package/lib/components/SelectField/SelectField.js +1 -1
- package/lib/components/Tab/Tab.js +15 -4
- package/lib/components/TabPicker/TabPicker.js +2 -2
- package/lib/hooks/useOverlayPanelState/useOverlayPanelState.test.js +3 -2
- package/lib/hooks/useSelectField/useSelectField.js +9 -1
- package/lib/recipes/CountryPicker.stories.js +24 -12
- package/lib/recipes/EditableInput.stories.js +55 -46
- package/lib/recipes/ListAndPanel.stories.js +102 -87
- package/lib/recipes/PageHeader.stories.js +53 -0
- package/package.json +3 -2
@@ -128,44 +128,106 @@ var items = [{
|
|
128
128
|
avatar: _AccountIcon["default"],
|
129
129
|
hasSeparator: false
|
130
130
|
}];
|
131
|
+
var sx = {
|
132
|
+
wrapper: {
|
133
|
+
px: 'lg',
|
134
|
+
py: 'lg',
|
135
|
+
bg: 'accent.99',
|
136
|
+
height: '900px',
|
137
|
+
overflowY: 'scroll'
|
138
|
+
},
|
139
|
+
searchField: {
|
140
|
+
position: 'fixed',
|
141
|
+
mb: 'sm',
|
142
|
+
width: '400px'
|
143
|
+
},
|
144
|
+
listElementWrapper: {
|
145
|
+
px: 'md',
|
146
|
+
bg: 'accent.99',
|
147
|
+
justifyContent: 'center'
|
148
|
+
},
|
149
|
+
separator: {
|
150
|
+
bg: 'accent.90'
|
151
|
+
},
|
152
|
+
tabsWrapper: {
|
153
|
+
px: 'lg',
|
154
|
+
pt: 'xs'
|
155
|
+
},
|
156
|
+
iconButton: {
|
157
|
+
position: 'absolute',
|
158
|
+
top: 0,
|
159
|
+
right: 0
|
160
|
+
},
|
161
|
+
itemLabel: {
|
162
|
+
fontSize: 'sm',
|
163
|
+
fontWeight: 3,
|
164
|
+
lineHeight: '16px',
|
165
|
+
mb: 'xs'
|
166
|
+
},
|
167
|
+
itemValue: {
|
168
|
+
fontWeight: 0,
|
169
|
+
lineHeight: '18px',
|
170
|
+
variant: 'base',
|
171
|
+
mb: 'md'
|
172
|
+
},
|
173
|
+
listElement: {
|
174
|
+
wrapper: {
|
175
|
+
minHeight: '60px'
|
176
|
+
},
|
177
|
+
iconWrapper: {
|
178
|
+
mr: 'auto',
|
179
|
+
alignItems: 'center'
|
180
|
+
},
|
181
|
+
icon: {
|
182
|
+
mr: 'sm',
|
183
|
+
alignSelf: 'center',
|
184
|
+
color: 'accent.40'
|
185
|
+
},
|
186
|
+
avatar: {
|
187
|
+
width: '25px',
|
188
|
+
height: '25px',
|
189
|
+
mr: 'md'
|
190
|
+
},
|
191
|
+
title: {
|
192
|
+
alignSelf: 'start'
|
193
|
+
},
|
194
|
+
subtitle: {
|
195
|
+
fontSize: 'sm',
|
196
|
+
my: '1px',
|
197
|
+
lineHeight: '16px',
|
198
|
+
alignSelf: 'start'
|
199
|
+
},
|
200
|
+
menuWrapper: {
|
201
|
+
alignSelf: 'center'
|
202
|
+
}
|
203
|
+
}
|
204
|
+
};
|
131
205
|
|
132
206
|
var ListElement = function ListElement(_ref) {
|
133
207
|
var item = _ref.item,
|
134
208
|
onClosePanel = _ref.onClosePanel;
|
135
209
|
return (0, _react2.jsx)(_index.Box, {
|
136
210
|
isRow: true,
|
137
|
-
|
211
|
+
sx: sx.listElement.wrapper
|
138
212
|
}, (0, _react2.jsx)(_index.Box, {
|
139
213
|
isRow: true,
|
140
|
-
|
141
|
-
alignItems: "center"
|
214
|
+
sx: sx.listElement.iconWrapper
|
142
215
|
}, item.hasIcon ? (0, _react2.jsx)(_index.Icon, {
|
143
216
|
icon: item.avatar,
|
144
|
-
alignSelf: "center",
|
145
217
|
size: 24,
|
146
|
-
|
147
|
-
color: "accent.40"
|
218
|
+
sx: sx.listElement.icon
|
148
219
|
}) : (0, _react2.jsx)(_index.Avatar, {
|
149
|
-
|
150
|
-
sx: {
|
151
|
-
width: '25px',
|
152
|
-
height: '25px'
|
153
|
-
},
|
220
|
+
sx: sx.listElement.avatar,
|
154
221
|
src: item.avatar
|
155
222
|
}), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Text, {
|
156
223
|
variant: "bodyStrong",
|
157
|
-
|
224
|
+
sx: sx.listElement.title
|
158
225
|
}, item.lastName, ", ", item.firstName), (0, _react2.jsx)(_index.Text, {
|
159
|
-
sx: {
|
160
|
-
fontSize: 'sm',
|
161
|
-
my: '1px',
|
162
|
-
lineHeight: '16px'
|
163
|
-
},
|
164
226
|
variant: "subtitle",
|
165
|
-
|
227
|
+
sx: sx.listElement.subtitle
|
166
228
|
}, item.email))), (0, _react2.jsx)(_index.Box, {
|
167
229
|
isRow: true,
|
168
|
-
|
230
|
+
sx: sx.listElement.menuWrapper
|
169
231
|
}, (0, _react2.jsx)(_index.SwitchField, {
|
170
232
|
"aria-label": "active user",
|
171
233
|
isDefaultSelected: true,
|
@@ -222,11 +284,7 @@ var Default = function Default() {
|
|
222
284
|
};
|
223
285
|
|
224
286
|
return (0, _react2.jsx)(_index.Box, {
|
225
|
-
|
226
|
-
py: "lg",
|
227
|
-
bg: "accent.99",
|
228
|
-
height: "900px",
|
229
|
-
overflowY: "scroll"
|
287
|
+
sx: sx.wrapper
|
230
288
|
}, (0, _react2.jsx)(_index.SearchField, {
|
231
289
|
position: "fixed",
|
232
290
|
mb: "sm",
|
@@ -260,18 +318,15 @@ var Default = function Default() {
|
|
260
318
|
restoreFocus: true,
|
261
319
|
autoFocus: true
|
262
320
|
}, (0, _react2.jsx)(_index.Box, {
|
263
|
-
|
264
|
-
bg: "accent.99",
|
265
|
-
justifyContent: "center"
|
321
|
+
sx: sx.listElementWrapper
|
266
322
|
}, (0, _react2.jsx)(ListElement, {
|
267
323
|
item: selectedItemId >= 0 ? items[selectedItemId] : [],
|
268
324
|
onClosePanel: closePanelHandler
|
269
325
|
})), (0, _react2.jsx)(_index.Separator, {
|
270
326
|
margin: 0,
|
271
|
-
|
327
|
+
sx: sx.separator
|
272
328
|
}), (0, _react2.jsx)(_index.Box, {
|
273
|
-
|
274
|
-
pt: "xs"
|
329
|
+
sx: sx.tabsWrapper
|
275
330
|
}, (0, _react2.jsx)(_index.Tabs, {
|
276
331
|
tabListProps: {
|
277
332
|
justifyContent: 'center'
|
@@ -285,73 +340,33 @@ var Default = function Default() {
|
|
285
340
|
title: "Profile"
|
286
341
|
}, selectedItemId >= 0 && (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.IconButton, {
|
287
342
|
variant: "inverted",
|
288
|
-
sx:
|
289
|
-
position: 'absolute',
|
290
|
-
top: 0,
|
291
|
-
right: 0
|
292
|
-
}
|
343
|
+
sx: sx.iconButton
|
293
344
|
}, (0, _react2.jsx)(_PencilIcon["default"], {
|
294
345
|
size: 20
|
295
346
|
})), (0, _react2.jsx)(_index.Text, {
|
296
|
-
sx:
|
297
|
-
|
298
|
-
fontWeight: 3,
|
299
|
-
lineHeight: '16px'
|
300
|
-
},
|
301
|
-
variant: "base",
|
302
|
-
mb: "xs"
|
347
|
+
sx: sx.itemLabel,
|
348
|
+
variant: "base"
|
303
349
|
}, "Full Name"), (0, _react2.jsx)(_index.Text, {
|
304
|
-
sx:
|
305
|
-
|
306
|
-
lineHeight: '18px'
|
307
|
-
},
|
308
|
-
variant: "base",
|
309
|
-
mb: "md"
|
350
|
+
sx: sx.itemValue,
|
351
|
+
variant: "base"
|
310
352
|
}, items[selectedItemId].firstName, " ", items[selectedItemId].lastName), (0, _react2.jsx)(_index.Text, {
|
311
|
-
sx:
|
312
|
-
|
313
|
-
fontWeight: 3,
|
314
|
-
lineHeight: '16px'
|
315
|
-
},
|
316
|
-
variant: "base",
|
317
|
-
mb: "xs"
|
353
|
+
sx: sx.itemLabel,
|
354
|
+
variant: "base"
|
318
355
|
}, "First Name"), (0, _react2.jsx)(_index.Text, {
|
319
|
-
sx:
|
320
|
-
|
321
|
-
lineHeight: '18px'
|
322
|
-
},
|
323
|
-
variant: "base",
|
324
|
-
mb: "md"
|
356
|
+
sx: sx.itemValue,
|
357
|
+
variant: "base"
|
325
358
|
}, items[selectedItemId].firstName), (0, _react2.jsx)(_index.Text, {
|
326
|
-
sx:
|
327
|
-
|
328
|
-
fontWeight: 3,
|
329
|
-
lineHeight: '16px'
|
330
|
-
},
|
331
|
-
variant: "base",
|
332
|
-
mb: "xs"
|
359
|
+
sx: sx.itemLabel,
|
360
|
+
variant: "base"
|
333
361
|
}, "Last Name"), (0, _react2.jsx)(_index.Text, {
|
334
|
-
sx:
|
335
|
-
|
336
|
-
lineHeight: '18px'
|
337
|
-
},
|
338
|
-
variant: "base",
|
339
|
-
mb: "md"
|
362
|
+
sx: sx.itemValue,
|
363
|
+
variant: "base"
|
340
364
|
}, items[selectedItemId].lastName), (0, _react2.jsx)(_index.Text, {
|
341
|
-
sx:
|
342
|
-
|
343
|
-
fontWeight: 3,
|
344
|
-
lineHeight: '16px'
|
345
|
-
},
|
346
|
-
variant: "base",
|
347
|
-
mb: "xs"
|
365
|
+
sx: sx.itemLabel,
|
366
|
+
variant: "base"
|
348
367
|
}, "Email"), (0, _react2.jsx)(_index.Text, {
|
349
|
-
sx:
|
350
|
-
|
351
|
-
lineHeight: '18px'
|
352
|
-
},
|
353
|
-
variant: "base",
|
354
|
-
mb: "md"
|
368
|
+
sx: sx.itemValue,
|
369
|
+
variant: "base"
|
355
370
|
}, items[selectedItemId].email))), (0, _react2.jsx)(_index.Tab, {
|
356
371
|
title: "Group Memberships"
|
357
372
|
}, (0, _react2.jsx)(_index.Text, null, "Group Memberships")), (0, _react2.jsx)(_index.Tab, {
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
6
|
+
|
7
|
+
_Object$defineProperty(exports, "__esModule", {
|
8
|
+
value: true
|
9
|
+
});
|
10
|
+
|
11
|
+
exports["default"] = exports.Default = void 0;
|
12
|
+
|
13
|
+
var _react = _interopRequireDefault(require("react"));
|
14
|
+
|
15
|
+
var _PlusIcon = _interopRequireDefault(require("mdi-react/PlusIcon"));
|
16
|
+
|
17
|
+
var _index = require("../index");
|
18
|
+
|
19
|
+
var _react2 = require("@emotion/react");
|
20
|
+
|
21
|
+
var _default = {
|
22
|
+
title: 'Recipes/Page Header'
|
23
|
+
};
|
24
|
+
exports["default"] = _default;
|
25
|
+
|
26
|
+
var Default = function Default() {
|
27
|
+
var heading = 'Title of the Page';
|
28
|
+
var description = 'The description of the page. The description of the page. The description of the page. The description of the page. The description of the page. The description of the page. The description of the page. The description of the page. The description of the page.';
|
29
|
+
return (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Box, {
|
30
|
+
align: "center",
|
31
|
+
isRow: true,
|
32
|
+
mb: "xs",
|
33
|
+
role: "heading",
|
34
|
+
"aria-level": "1"
|
35
|
+
}, (0, _react2.jsx)(_index.Text, {
|
36
|
+
variant: "title",
|
37
|
+
fontWeight: 3
|
38
|
+
}, heading), (0, _react2.jsx)(_index.Button, {
|
39
|
+
variant: "inlinePrimary",
|
40
|
+
ml: "sm"
|
41
|
+
}, (0, _react2.jsx)(_index.Icon, {
|
42
|
+
icon: _PlusIcon["default"],
|
43
|
+
color: "white",
|
44
|
+
size: 13,
|
45
|
+
mr: "4px"
|
46
|
+
}), "\xA0", "Add")), (0, _react2.jsx)(_index.Text, {
|
47
|
+
variant: "bodyWeak"
|
48
|
+
}, description)), (0, _react2.jsx)(_index.Box, {
|
49
|
+
mt: "xl"
|
50
|
+
}, (0, _react2.jsx)(_index.Box, {
|
51
|
+
align: "center",
|
52
|
+
isRow: true,
|
53
|
+
mb: "xs",
|
54
|
+
role: "heading",
|
55
|
+
"aria-level": "1"
|
56
|
+
}, (0, _react2.jsx)(_index.Text, {
|
57
|
+
variant: "title",
|
58
|
+
fontWeight: 3
|
59
|
+
}, heading), (0, _react2.jsx)(_index.IconButton, {
|
60
|
+
"aria-label": "icon button",
|
61
|
+
ml: "sm",
|
62
|
+
mt: "3px",
|
63
|
+
variant: "inverted"
|
64
|
+
}, (0, _react2.jsx)(_index.Icon, {
|
65
|
+
icon: _PlusIcon["default"],
|
66
|
+
color: "white",
|
67
|
+
size: 13
|
68
|
+
}))), (0, _react2.jsx)(_index.Text, {
|
69
|
+
variant: "bodyWeak"
|
70
|
+
}, description)));
|
71
|
+
};
|
72
|
+
|
73
|
+
exports.Default = Default;
|
@@ -182,26 +182,26 @@ export var Controlled = function Controlled() {
|
|
182
182
|
fieldValues = _React$useState2[0],
|
183
183
|
setFieldValues = _React$useState2[1];
|
184
184
|
|
185
|
-
function handleOnChange(values) {
|
185
|
+
var handleOnChange = function handleOnChange(values) {
|
186
186
|
setFieldValues(values);
|
187
|
-
}
|
187
|
+
};
|
188
188
|
|
189
|
-
function handleOnAdd() {
|
189
|
+
var handleOnAdd = function handleOnAdd() {
|
190
190
|
setFieldValues(function (oldValues) {
|
191
191
|
var _context;
|
192
192
|
|
193
193
|
return _concatInstanceProperty(_context = []).call(_context, oldValues, [defaultEmptyField]);
|
194
194
|
});
|
195
|
-
}
|
195
|
+
};
|
196
196
|
|
197
|
-
function handleOnDelete(fieldId) {
|
197
|
+
var handleOnDelete = function handleOnDelete(fieldId) {
|
198
198
|
setFieldValues(function (oldValues) {
|
199
199
|
return _filterInstanceProperty(oldValues).call(oldValues, function (_ref2) {
|
200
200
|
var id = _ref2.id;
|
201
201
|
return id !== fieldId;
|
202
202
|
});
|
203
203
|
});
|
204
|
-
}
|
204
|
+
};
|
205
205
|
|
206
206
|
return ___EmotionJSX(ArrayField, {
|
207
207
|
value: fieldValues,
|
@@ -180,7 +180,10 @@ var FileInputField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
180
180
|
variant: "boxes.fileInputFieldWrapper"
|
181
181
|
}, mergeProps(fieldContainerProps, others), {
|
182
182
|
className: classNames
|
183
|
-
}, getRootProps()
|
183
|
+
}, getRootProps(), {
|
184
|
+
// to pass accessibility test, this removes focusable dependents
|
185
|
+
role: "none"
|
186
|
+
}), ___EmotionJSX(Input, _extends({}, mergeProps(visuallyHiddenProps, fieldControlProps, getInputProps()), {
|
184
187
|
"aria-label": "File Input",
|
185
188
|
multiple: isMultiple,
|
186
189
|
onChange: handleOnChange,
|
@@ -244,8 +247,8 @@ FileInputField.propTypes = {
|
|
244
247
|
* */
|
245
248
|
fileList: PropTypes.arrayOf(PropTypes.shape({
|
246
249
|
fileObj: PropTypes.shape({}),
|
247
|
-
id: PropTypes.string.
|
248
|
-
name: PropTypes.string.
|
250
|
+
id: PropTypes.string.isRequired,
|
251
|
+
name: PropTypes.string.isRequired,
|
249
252
|
downloadLink: PropTypes.string,
|
250
253
|
status: PropTypes.oneOf(_Object$values(statuses))
|
251
254
|
})),
|
@@ -253,8 +256,8 @@ FileInputField.propTypes = {
|
|
253
256
|
/** Default array of objects for uploaded files. */
|
254
257
|
defaultFileList: PropTypes.arrayOf(PropTypes.shape({
|
255
258
|
fileObj: PropTypes.shape({}),
|
256
|
-
id: PropTypes.string.
|
257
|
-
name: PropTypes.string.
|
259
|
+
id: PropTypes.string.isRequired,
|
260
|
+
name: PropTypes.string.isRequired,
|
258
261
|
downloadLink: PropTypes.string,
|
259
262
|
status: PropTypes.oneOf(_Object$values(statuses))
|
260
263
|
})),
|
@@ -131,7 +131,7 @@ LinkSelectField.propTypes = {
|
|
131
131
|
* *For performance reasons, use this prop instead of Array.map when iteratively rendering Items*.
|
132
132
|
* For use with [dynamic collections](https://react-spectrum.adobe.com/react-stately/collections.html#dynamic-collections).
|
133
133
|
*/
|
134
|
-
items: PropTypes.arrayOf(PropTypes.
|
134
|
+
items: PropTypes.arrayOf(PropTypes.shape({})),
|
135
135
|
|
136
136
|
/** The label for the select element. */
|
137
137
|
label: PropTypes.node,
|
@@ -86,7 +86,10 @@ Option.propTypes = {
|
|
86
86
|
hasVirtualFocus: PropTypes.bool,
|
87
87
|
item: PropTypes.shape({
|
88
88
|
key: PropTypes.string,
|
89
|
-
props: PropTypes.shape({
|
89
|
+
props: PropTypes.shape({
|
90
|
+
'data-id': PropTypes.string,
|
91
|
+
isSeparator: PropTypes.bool
|
92
|
+
}),
|
90
93
|
rendered: PropTypes.node
|
91
94
|
}),
|
92
95
|
state: PropTypes.shape({
|
@@ -141,7 +141,8 @@ MenuItem.propTypes = {
|
|
141
141
|
key: PropTypes.string,
|
142
142
|
props: PropTypes.shape({
|
143
143
|
'data-id': PropTypes.string,
|
144
|
-
isSeparator: PropTypes.bool
|
144
|
+
isSeparator: PropTypes.bool,
|
145
|
+
isPressed: PropTypes.bool
|
145
146
|
}),
|
146
147
|
rendered: PropTypes.node,
|
147
148
|
isDisabled: PropTypes.bool
|
@@ -6,13 +6,20 @@ import PropTypes from 'prop-types';
|
|
6
6
|
import Text from '../Text/Text';
|
7
7
|
import Box from '../Box/Box';
|
8
8
|
import { useDeprecationWarning } from '../../hooks';
|
9
|
+
/**
|
10
|
+
* A `Page Header` is a composed component using text and icon button.
|
11
|
+
* The component is separated from the body and appears at the top.
|
12
|
+
* For customization,
|
13
|
+
* please see [Page Header](./?path=/story/recipes-page-header--default) recipe docs.
|
14
|
+
*/
|
15
|
+
|
9
16
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
17
|
var PageHeader = /*#__PURE__*/forwardRef(function (props, ref) {
|
11
18
|
var title = props.title,
|
12
19
|
children = props.children,
|
13
20
|
others = _objectWithoutProperties(props, _excluded);
|
14
21
|
|
15
|
-
useDeprecationWarning('The Page Header component will be deprecated in Astro-UI 2.0.0.');
|
22
|
+
useDeprecationWarning('The Page Header component will be deprecated in Astro-UI 2.0.0. Use Page Header recipe instead.');
|
16
23
|
return ___EmotionJSX(Box, _extends({
|
17
24
|
isRow: true,
|
18
25
|
justifyContent: "space-between",
|
@@ -75,7 +75,7 @@ SelectField.propTypes = {
|
|
75
75
|
* *For performance reasons, use this prop instead of Array.map when iteratively rendering Items*.
|
76
76
|
* For use with [dynamic collections](https://react-spectrum.adobe.com/react-stately/collections.html#dynamic-collections).
|
77
77
|
*/
|
78
|
-
items: PropTypes.arrayOf(PropTypes.
|
78
|
+
items: PropTypes.arrayOf(PropTypes.shape({})),
|
79
79
|
|
80
80
|
/** The label for the select element. */
|
81
81
|
label: PropTypes.node,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
3
|
-
var _excluded = ["icon", "isDisabled", "separator", "tabLabelProps", "tabLineProps", "content", "titleAttr"];
|
3
|
+
var _excluded = ["icon", "isDisabled", "separator", "tabLabelProps", "tabLineProps", "content", "titleAttr", "title"];
|
4
4
|
import React, { forwardRef, useContext, useImperativeHandle, useRef } from 'react';
|
5
5
|
import PropTypes from 'prop-types';
|
6
6
|
import { useTab } from '@react-aria/tabs';
|
@@ -38,6 +38,7 @@ export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
38
38
|
tabLineProps = itemProps.tabLineProps,
|
39
39
|
content = itemProps.content,
|
40
40
|
titleAttr = itemProps.titleAttr,
|
41
|
+
title = itemProps.title,
|
41
42
|
otherItemProps = _objectWithoutProperties(itemProps, _excluded);
|
42
43
|
|
43
44
|
var state = useContext(TabsContext);
|
@@ -113,9 +114,19 @@ CollectionTab.propTypes = {
|
|
113
114
|
isDisabled: PropTypes.bool,
|
114
115
|
item: PropTypes.shape({
|
115
116
|
key: PropTypes.string,
|
116
|
-
props: PropTypes.shape({
|
117
|
-
|
118
|
-
|
117
|
+
props: PropTypes.shape({
|
118
|
+
icon: PropTypes.shape({}),
|
119
|
+
isDisabled: PropTypes.bool,
|
120
|
+
textValue: PropTypes.string,
|
121
|
+
tabLineProps: PropTypes.shape({}),
|
122
|
+
tabLabelProps: PropTypes.shape({}),
|
123
|
+
content: PropTypes.shape({}),
|
124
|
+
titleAttr: PropTypes.string,
|
125
|
+
title: PropTypes.oneOfType([PropTypes.element, PropTypes.string, PropTypes.object]),
|
126
|
+
separator: PropTypes.oneOfType([PropTypes.element, PropTypes.bool]),
|
127
|
+
list: PropTypes.arrayOf(PropTypes.shape({}))
|
128
|
+
}),
|
129
|
+
rendered: PropTypes.node
|
119
130
|
}),
|
120
131
|
mode: PropTypes.oneOf(['default', 'tooltip', 'list']),
|
121
132
|
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
@@ -207,10 +207,10 @@ TabPicker.propTypes = {
|
|
207
207
|
state: PropTypes.shape({
|
208
208
|
collection: PropTypes.shape({}),
|
209
209
|
selectedKey: PropTypes.string,
|
210
|
-
setSelectedKey: PropTypes
|
210
|
+
setSelectedKey: PropTypes.func,
|
211
211
|
selectionManager: PropTypes.shape({
|
212
212
|
focusedKey: PropTypes.string,
|
213
|
-
setFocusedKey: PropTypes
|
213
|
+
setFocusedKey: PropTypes.func
|
214
214
|
})
|
215
215
|
})
|
216
216
|
};
|
@@ -6,7 +6,7 @@ test('default useOverlayPanelState', function () {
|
|
6
6
|
}),
|
7
7
|
result = _renderHook.result;
|
8
8
|
|
9
|
-
|
9
|
+
var obj = {
|
10
10
|
state: {
|
11
11
|
open: expect.any(Function),
|
12
12
|
close: expect.any(Function),
|
@@ -14,5 +14,6 @@ test('default useOverlayPanelState', function () {
|
|
14
14
|
isOpen: expect.any(Boolean)
|
15
15
|
},
|
16
16
|
onClose: expect.any(Function)
|
17
|
-
}
|
17
|
+
};
|
18
|
+
expect(result.current).toEqual(obj);
|
18
19
|
});
|
@@ -103,7 +103,15 @@ var useSelectField = function useSelectField(props, ref) {
|
|
103
103
|
labelProps = _useSelect.labelProps,
|
104
104
|
triggerProps = _useSelect.triggerProps,
|
105
105
|
valueProps = _useSelect.valueProps,
|
106
|
-
menuProps = _useSelect.menuProps;
|
106
|
+
menuProps = _useSelect.menuProps; // The following props are being passed into multiple
|
107
|
+
// DOM elements that leads to multiple test failures
|
108
|
+
// and these props are never used in any components
|
109
|
+
// that depend on useSelectField
|
110
|
+
|
111
|
+
|
112
|
+
delete menuProps.shouldSelectOnPressUp;
|
113
|
+
delete menuProps.shouldFocusOnHover;
|
114
|
+
delete menuProps.disallowEmptySelection;
|
107
115
|
|
108
116
|
var _useField = useField(_objectSpread(_objectSpread({}, props), {}, {
|
109
117
|
placeholder: props.labelMode === modes.FLOAT ? '' : placeholder,
|
@@ -17,6 +17,27 @@ var validatePhoneNumber = function validatePhoneNumber(str) {
|
|
17
17
|
return reg.test(str);
|
18
18
|
};
|
19
19
|
|
20
|
+
var sx = {
|
21
|
+
wrapperBox: {
|
22
|
+
width: '100%',
|
23
|
+
maxWidth: 500,
|
24
|
+
position: 'relative'
|
25
|
+
},
|
26
|
+
comboBoxFieldWrapperOpen: {
|
27
|
+
position: 'absolute',
|
28
|
+
transition: '0.2s width ease',
|
29
|
+
width: '100%'
|
30
|
+
},
|
31
|
+
comboBoxFieldWrapperClose: {
|
32
|
+
position: 'absolute',
|
33
|
+
transition: '0.2s width ease',
|
34
|
+
width: '110px'
|
35
|
+
},
|
36
|
+
inputWrapper: {
|
37
|
+
width: '100%',
|
38
|
+
marginLeft: '110px'
|
39
|
+
}
|
40
|
+
};
|
20
41
|
export var Default = function Default() {
|
21
42
|
var _useState = useState(false),
|
22
43
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -84,22 +105,14 @@ export var Default = function Default() {
|
|
84
105
|
|
85
106
|
return ___EmotionJSX(Box, {
|
86
107
|
isRow: true,
|
87
|
-
sx:
|
88
|
-
width: '100%',
|
89
|
-
maxWidth: 500,
|
90
|
-
position: 'relative'
|
91
|
-
}
|
108
|
+
sx: sx.wrapperBox
|
92
109
|
}, ___EmotionJSX(ComboBoxField, {
|
93
110
|
mt: -5,
|
94
111
|
width: "100%",
|
95
112
|
isOpen: isOpen,
|
96
113
|
onOpenChange: setIsOpen,
|
97
114
|
wrapperProps: {
|
98
|
-
sx:
|
99
|
-
position: 'absolute',
|
100
|
-
transition: '0.2s width ease',
|
101
|
-
width: isOpen ? '100%' : 110
|
102
|
-
}
|
115
|
+
sx: isOpen ? sx.comboBoxFieldWrapperOpen : sx.comboBoxFieldWrapperClose
|
103
116
|
},
|
104
117
|
controlProps: {
|
105
118
|
'aria-label': 'Country Picker'
|
@@ -118,8 +131,7 @@ export var Default = function Default() {
|
|
118
131
|
key: item[0]
|
119
132
|
}, _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "".concat(item[1].name)).call(_context2, item[1].name !== item[1]["native"] ? " (".concat(item[1]["native"], ")") : '', " +")).call(_context, item[1].phone.split(',')[0]));
|
120
133
|
}), ___EmotionJSX(Box, {
|
121
|
-
|
122
|
-
ml: 110
|
134
|
+
sx: sx.inputWrapper
|
123
135
|
}, ___EmotionJSX(Input, {
|
124
136
|
placeholder: "Phone number...",
|
125
137
|
onChange: onPhoneNumberValueChange,
|