@pingux/astro 1.25.1-alpha.1 → 1.25.1-alpha.4
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/MultivaluesField/MultivaluesField.js +28 -6
- package/lib/cjs/components/MultivaluesField/MultivaluesField.stories.js +46 -2
- package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +14 -0
- package/lib/cjs/recipes/OneWayToBidirectionalArrow.stories.js +125 -30
- package/lib/cjs/styles/theme.js +3 -1
- package/lib/cjs/styles/variants/bidirectionalIconButton.js +54 -0
- package/lib/cjs/styles/variants/index.js +10 -0
- package/lib/components/MultivaluesField/MultivaluesField.js +26 -7
- package/lib/components/MultivaluesField/MultivaluesField.stories.js +40 -0
- package/lib/components/MultivaluesField/MultivaluesField.test.js +11 -0
- package/lib/recipes/OneWayToBidirectionalArrow.stories.js +124 -30
- package/lib/styles/theme.js +4 -2
- package/lib/styles/variants/bidirectionalIconButton.js +34 -0
- package/lib/styles/variants/index.js +1 -0
- package/package.json +1 -1
@@ -28,6 +28,8 @@ _Object$defineProperty(exports, "__esModule", {
|
|
28
28
|
|
29
29
|
exports["default"] = void 0;
|
30
30
|
|
31
|
+
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
32
|
+
|
31
33
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
32
34
|
|
33
35
|
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
@@ -70,6 +72,10 @@ var _isIterable = require("../../utils/devUtils/props/isIterable");
|
|
70
72
|
|
71
73
|
var _hooks = require("../../hooks");
|
72
74
|
|
75
|
+
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
76
|
+
|
77
|
+
var _FieldHelperText = _interopRequireDefault(require("../FieldHelperText"));
|
78
|
+
|
73
79
|
var _react2 = require("@emotion/react");
|
74
80
|
|
75
81
|
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); }
|
@@ -96,8 +102,10 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
96
102
|
direction = props.direction,
|
97
103
|
_props$disabledKeys = props.disabledKeys,
|
98
104
|
disabledKeys = _props$disabledKeys === void 0 ? [] : _props$disabledKeys,
|
105
|
+
containerProps = props.containerProps,
|
99
106
|
hasAutoFocus = props.hasAutoFocus,
|
100
107
|
hasNoStatusIndicator = props.hasNoStatusIndicator,
|
108
|
+
helperText = props.helperText,
|
101
109
|
customInputProps = props.inputProps,
|
102
110
|
isDisabled = props.isDisabled,
|
103
111
|
isNotFlippable = props.isNotFlippable,
|
@@ -117,7 +125,8 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
117
125
|
_props$readOnlyKeys = props.readOnlyKeys,
|
118
126
|
readOnlyKeys = _props$readOnlyKeys === void 0 ? [] : _props$readOnlyKeys,
|
119
127
|
selectedKeys = props.selectedKeys,
|
120
|
-
scrollBoxProps = props.scrollBoxProps
|
128
|
+
scrollBoxProps = props.scrollBoxProps,
|
129
|
+
status = props.status;
|
121
130
|
var hasCustomValue = mode === 'non-restrictive';
|
122
131
|
(0, _hooks.usePropWarning)(props, 'disabled', 'isDisabled');
|
123
132
|
|
@@ -395,10 +404,11 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
395
404
|
wrapperProps: {
|
396
405
|
ref: inputRef,
|
397
406
|
variant: 'forms.input.multivaluesWrapper'
|
398
|
-
}
|
407
|
+
},
|
408
|
+
status: status
|
399
409
|
});
|
400
410
|
|
401
|
-
return (0, _react2.jsx)(
|
411
|
+
return (0, _react2.jsx)(_.Box, containerProps, (0, _react2.jsx)(_.TextField, (0, _extends2["default"])({
|
402
412
|
onBlur: function onBlur(e) {
|
403
413
|
setIsOpen(false);
|
404
414
|
if (_onBlur) _onBlur(e.nativeEvent);
|
@@ -420,7 +430,9 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
420
430
|
beforeInput: (0, _react2.jsx)(_react["default"].Fragment, null, readOnlyItems, " ", selectedItems)
|
421
431
|
},
|
422
432
|
value: filterString
|
423
|
-
}, inputProps)), (0, _react2.jsx)(
|
433
|
+
}, inputProps)), helperText && (0, _react2.jsx)(_FieldHelperText["default"], {
|
434
|
+
status: status
|
435
|
+
}, helperText), (0, _react2.jsx)(_.PopoverContainer, {
|
424
436
|
ref: popoverRef,
|
425
437
|
hasNoArrow: true,
|
426
438
|
isNonModal: true,
|
@@ -430,6 +442,9 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
430
442
|
}, listbox));
|
431
443
|
});
|
432
444
|
MultivaluesField.propTypes = {
|
445
|
+
/** Props object that is spread directly into the root (top-level) Box component. */
|
446
|
+
containerProps: _propTypes["default"].shape({}),
|
447
|
+
|
433
448
|
/** The initial selected keys in the collection (uncontrolled). */
|
434
449
|
defaultSelectedKeys: _isIterable.isIterableProp,
|
435
450
|
|
@@ -447,6 +462,9 @@ MultivaluesField.propTypes = {
|
|
447
462
|
/** Whether the field has a status indicator. */
|
448
463
|
hasNoStatusIndicator: _propTypes["default"].bool,
|
449
464
|
|
465
|
+
/** Text rendered below the input. */
|
466
|
+
helperText: _propTypes["default"].node,
|
467
|
+
|
450
468
|
/**
|
451
469
|
* Props that get passed as-is to the underlying TextField element
|
452
470
|
*/
|
@@ -545,14 +563,18 @@ MultivaluesField.propTypes = {
|
|
545
563
|
/** @ignore */
|
546
564
|
scrollBoxProps: _propTypes["default"].shape({
|
547
565
|
maxHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object, _propTypes["default"].number])
|
548
|
-
})
|
566
|
+
}),
|
567
|
+
|
568
|
+
/** Determines the input status indicator and helper text styling. */
|
569
|
+
status: _propTypes["default"].oneOf((0, _values["default"])(_statuses["default"]))
|
549
570
|
};
|
550
571
|
MultivaluesField.defaultProps = {
|
551
572
|
direction: 'bottom',
|
552
573
|
mode: 'restrictive',
|
553
574
|
scrollBoxProps: {
|
554
575
|
maxHeight: 300
|
555
|
-
}
|
576
|
+
},
|
577
|
+
status: _statuses["default"].DEFAULT
|
556
578
|
};
|
557
579
|
var _default = MultivaluesField;
|
558
580
|
exports["default"] = _default;
|
@@ -14,7 +14,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
14
14
|
value: true
|
15
15
|
});
|
16
16
|
|
17
|
-
exports["default"] = exports.WithReadOnlyValues = exports.WithDisabledKeys = exports.WithCustomValues = exports.WithCustomSize = exports.Uncontrolled = exports.Default = exports.Controlled = void 0;
|
17
|
+
exports["default"] = exports.WithReadOnlyValues = exports.WithDisabledKeys = exports.WithCustomValues = exports.WithCustomSize = exports.Uncontrolled = exports.Error = exports.Default = exports.Controlled = void 0;
|
18
18
|
|
19
19
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
20
20
|
|
@@ -24,6 +24,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
24
24
|
|
25
25
|
var _ = require("../..");
|
26
26
|
|
27
|
+
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
28
|
+
|
27
29
|
var _react2 = require("@emotion/react");
|
28
30
|
|
29
31
|
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); }
|
@@ -67,6 +69,18 @@ var _default = {
|
|
67
69
|
control: {
|
68
70
|
type: 'none'
|
69
71
|
}
|
72
|
+
},
|
73
|
+
status: {
|
74
|
+
control: {
|
75
|
+
type: 'select',
|
76
|
+
options: _statuses["default"]
|
77
|
+
},
|
78
|
+
defaultValue: _statuses["default"].DEFAULT
|
79
|
+
},
|
80
|
+
helperText: {
|
81
|
+
control: {
|
82
|
+
type: 'text'
|
83
|
+
}
|
70
84
|
}
|
71
85
|
},
|
72
86
|
parameters: {
|
@@ -354,4 +368,34 @@ var WithReadOnlyValues = function WithReadOnlyValues(args) {
|
|
354
368
|
}));
|
355
369
|
};
|
356
370
|
|
357
|
-
exports.WithReadOnlyValues = WithReadOnlyValues;
|
371
|
+
exports.WithReadOnlyValues = WithReadOnlyValues;
|
372
|
+
|
373
|
+
var Error = function Error(args) {
|
374
|
+
var _useState17 = (0, _react.useState)(false),
|
375
|
+
_useState18 = (0, _slicedToArray2["default"])(_useState17, 2),
|
376
|
+
isOpen = _useState18[0],
|
377
|
+
setIsOpen = _useState18[1];
|
378
|
+
|
379
|
+
var direction = args.direction;
|
380
|
+
|
381
|
+
var onOpenChange = function onOpenChange() {
|
382
|
+
setIsOpen(true);
|
383
|
+
};
|
384
|
+
|
385
|
+
return (0, _react2.jsx)(_.OverlayProvider // note: spacing for demo purpose only so that the select list renders in the correct place
|
386
|
+
, {
|
387
|
+
style: setOverlayStyle(direction, isOpen, '50%', '50%', '20%')
|
388
|
+
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({}, args, {
|
389
|
+
items: items,
|
390
|
+
helperText: "Here is some helpful text...",
|
391
|
+
status: "error",
|
392
|
+
onOpenChange: onOpenChange
|
393
|
+
}), function (item) {
|
394
|
+
return (0, _react2.jsx)(_.Item, {
|
395
|
+
key: item.key,
|
396
|
+
"data-id": item.name
|
397
|
+
}, item.name);
|
398
|
+
}));
|
399
|
+
};
|
400
|
+
|
401
|
+
exports.Error = Error;
|
@@ -18,6 +18,8 @@ var _index = require("../../index");
|
|
18
18
|
|
19
19
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
20
20
|
|
21
|
+
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
22
|
+
|
21
23
|
var _react2 = require("@emotion/react");
|
22
24
|
|
23
25
|
var items = [{
|
@@ -479,4 +481,16 @@ test('read only keys', function () {
|
|
479
481
|
expect(secondChip).toBeInTheDocument();
|
480
482
|
var deleteButton2 = firstChip.nextSibling;
|
481
483
|
expect(deleteButton2).toBeNull();
|
484
|
+
});
|
485
|
+
test(' multivalue field with helper text', function () {
|
486
|
+
var helperText = 'helper text';
|
487
|
+
getComponent({
|
488
|
+
helperText: helperText,
|
489
|
+
status: _statuses["default"].ERROR
|
490
|
+
});
|
491
|
+
|
492
|
+
var helper = _testWrapper.screen.getByText(helperText);
|
493
|
+
|
494
|
+
expect(helper).toBeInTheDocument();
|
495
|
+
expect(helper).toHaveClass("is-".concat(_statuses["default"].ERROR));
|
482
496
|
});
|
@@ -10,6 +10,8 @@ _Object$defineProperty(exports, "__esModule", {
|
|
10
10
|
|
11
11
|
exports["default"] = exports.Default = void 0;
|
12
12
|
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
14
|
+
|
13
15
|
var _react = _interopRequireDefault(require("react"));
|
14
16
|
|
15
17
|
var _DragVerticalIcon = _interopRequireDefault(require("mdi-react/DragVerticalIcon"));
|
@@ -40,42 +42,52 @@ var items = [{
|
|
40
42
|
}];
|
41
43
|
|
42
44
|
var Default = function Default() {
|
43
|
-
var CustomOnSvg = function CustomOnSvg() {
|
44
|
-
return (0, _react2.jsx)("svg", {
|
45
|
-
width: "
|
46
|
-
height: "
|
47
|
-
viewBox: "0 0
|
45
|
+
var CustomOnSvg = function CustomOnSvg(props) {
|
46
|
+
return (0, _react2.jsx)("svg", (0, _extends2["default"])({
|
47
|
+
width: "16",
|
48
|
+
height: "16",
|
49
|
+
viewBox: "0 0 16 16",
|
48
50
|
fill: "none",
|
49
51
|
xmlns: "http://www.w3.org/2000/svg"
|
50
|
-
}, (0, _react2.jsx)("path", {
|
51
|
-
d: "
|
52
|
-
fill: "
|
53
|
-
}), (0, _react2.jsx)("path", {
|
54
|
-
d: "M9.83325 10.6251V6.37511H15.4999V2.94678L21.0533 8.50011L15.4999 14.0534V10.6251H9.83325Z",
|
55
|
-
fill: "#4462ED"
|
52
|
+
}, props), (0, _react2.jsx)("path", {
|
53
|
+
d: "M5.33325 6.66666V8.66666H9.33325V12H5.33325V14L1.33325 10.3333L5.33325 6.66666Z",
|
54
|
+
fill: "currentColor"
|
56
55
|
}), (0, _react2.jsx)("path", {
|
57
|
-
d: "
|
58
|
-
fill: "
|
56
|
+
d: "M14.6666 5.66667L10.6666 2V4H6.66658V7.33333H10.6666V9.33333L14.6666 5.66667Z",
|
57
|
+
fill: "currentColor"
|
59
58
|
}));
|
60
59
|
};
|
61
60
|
|
62
|
-
var CustomOffSvg = function CustomOffSvg() {
|
63
|
-
return (0, _react2.jsx)("svg", {
|
64
|
-
width: "
|
65
|
-
height: "
|
66
|
-
viewBox: "0 0
|
61
|
+
var CustomOffSvg = function CustomOffSvg(props) {
|
62
|
+
return (0, _react2.jsx)("svg", (0, _extends2["default"])({
|
63
|
+
width: "16",
|
64
|
+
height: "16",
|
65
|
+
viewBox: "0 0 16 16",
|
67
66
|
fill: "none",
|
68
67
|
xmlns: "http://www.w3.org/2000/svg"
|
69
|
-
}, (0, _react2.jsx)("path", {
|
70
|
-
d: "
|
68
|
+
}, props), (0, _react2.jsx)("path", {
|
69
|
+
d: "M5.33325 6.66667V8.66667H9.33325V12H5.33325V14L1.33325 10.3333L5.33325 6.66667Z",
|
71
70
|
fill: "#CACED3"
|
72
71
|
}), (0, _react2.jsx)("path", {
|
73
|
-
d: "
|
74
|
-
fill: "
|
72
|
+
d: "M14.6666 5.66667L10.6666 2V4H6.66658V7.33333H10.6666V9.33333L14.6666 5.66667Z",
|
73
|
+
fill: "currentColor"
|
74
|
+
}));
|
75
|
+
};
|
76
|
+
|
77
|
+
var CustomRightSvg = function CustomRightSvg(props) {
|
78
|
+
return (0, _react2.jsx)("svg", (0, _extends2["default"])({
|
79
|
+
width: "8",
|
80
|
+
height: "8",
|
81
|
+
viewBox: "0 0 8 8",
|
82
|
+
fill: "none",
|
83
|
+
xmlns: "http://www.w3.org/2000/svg"
|
84
|
+
}, props), (0, _react2.jsx)("path", {
|
85
|
+
d: "M8 4L4 0V2.18182H0V5.81818H4V8L8 4Z",
|
86
|
+
fill: "currentColor"
|
75
87
|
}));
|
76
88
|
};
|
77
89
|
|
78
|
-
return (0, _react2.jsx)(_Box["default"], {
|
90
|
+
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_Box["default"], {
|
79
91
|
sx: {
|
80
92
|
alignItems: 'center'
|
81
93
|
},
|
@@ -104,8 +116,7 @@ var Default = function Default() {
|
|
104
116
|
}, item.name);
|
105
117
|
}), (0, _react2.jsx)(_Box["default"], {
|
106
118
|
sx: {
|
107
|
-
|
108
|
-
mr: '5px',
|
119
|
+
mx: 'sm',
|
109
120
|
flexShrink: 0
|
110
121
|
}
|
111
122
|
}, (0, _react2.jsx)(_index.IconButtonToggle, {
|
@@ -113,10 +124,10 @@ var Default = function Default() {
|
|
113
124
|
defaultIcon: CustomOffSvg,
|
114
125
|
title: "Bidirectional/ Outbound toggle",
|
115
126
|
iconProps: {
|
116
|
-
size:
|
127
|
+
size: 16
|
117
128
|
},
|
118
129
|
buttonProps: {
|
119
|
-
variant: '
|
130
|
+
variant: 'bidirectionalIconButton'
|
120
131
|
}
|
121
132
|
})), (0, _react2.jsx)(_index.ComboBoxField, {
|
122
133
|
items: items,
|
@@ -142,19 +153,103 @@ var Default = function Default() {
|
|
142
153
|
marginLeft: '12px',
|
143
154
|
marginRight: '12px'
|
144
155
|
}
|
145
|
-
}, (0, _react2.jsx)(_index.IconButton,
|
156
|
+
}, (0, _react2.jsx)(_index.IconButton, {
|
157
|
+
"aria-label": "Edit"
|
158
|
+
}, (0, _react2.jsx)(_index.Icon, {
|
159
|
+
icon: _CogsIcon["default"],
|
160
|
+
color: "neutral.30",
|
161
|
+
size: 20,
|
162
|
+
title: "edit icon"
|
163
|
+
})), (0, _react2.jsx)(_index.IconButton, {
|
164
|
+
ml: "5px",
|
165
|
+
"aria-label": "Delete"
|
166
|
+
}, (0, _react2.jsx)(_index.Icon, {
|
167
|
+
icon: _DeleteIcon["default"],
|
168
|
+
color: "neutral.30",
|
169
|
+
size: 20,
|
170
|
+
title: "delete icon"
|
171
|
+
})))), (0, _react2.jsx)(_Box["default"], {
|
172
|
+
sx: {
|
173
|
+
alignItems: 'center'
|
174
|
+
},
|
175
|
+
isRow: true
|
176
|
+
}, (0, _react2.jsx)(_index.Icon, {
|
177
|
+
icon: _DragVerticalIcon["default"],
|
178
|
+
size: 25,
|
179
|
+
color: "neutral.50"
|
180
|
+
}), (0, _react2.jsx)(_index.ComboBoxField, {
|
181
|
+
items: items,
|
182
|
+
defaultSelectedKey: "Last Name",
|
183
|
+
containerProps: {
|
184
|
+
width: '275px'
|
185
|
+
},
|
186
|
+
labelProps: {
|
187
|
+
mb: 0
|
188
|
+
},
|
189
|
+
"aria-label": "Row one value",
|
190
|
+
controlProps: {
|
191
|
+
'aria-label': 'test'
|
192
|
+
}
|
193
|
+
}, function (item) {
|
194
|
+
return (0, _react2.jsx)(_index.Item, {
|
195
|
+
key: item.name,
|
196
|
+
"data-id": item.name
|
197
|
+
}, item.name);
|
198
|
+
}), (0, _react2.jsx)(_Box["default"], {
|
199
|
+
sx: {
|
200
|
+
mx: 'sm',
|
201
|
+
flexShrink: 0
|
202
|
+
}
|
203
|
+
}, (0, _react2.jsx)(_index.IconButtonToggle, {
|
204
|
+
toggledIcon: CustomRightSvg,
|
205
|
+
defaultIcon: CustomRightSvg,
|
206
|
+
title: "This attribute does not support write-back.",
|
207
|
+
iconProps: {
|
208
|
+
size: 8
|
209
|
+
},
|
210
|
+
buttonProps: {
|
211
|
+
variant: 'bidirectionalIconButton'
|
212
|
+
}
|
213
|
+
})), (0, _react2.jsx)(_index.ComboBoxField, {
|
214
|
+
items: items,
|
215
|
+
defaultSelectedKey: "First Name",
|
216
|
+
containerProps: {
|
217
|
+
width: '275px'
|
218
|
+
},
|
219
|
+
labelProps: {
|
220
|
+
mb: 0
|
221
|
+
},
|
222
|
+
controlProps: {
|
223
|
+
'aria-label': 'Row one Pingone value'
|
224
|
+
}
|
225
|
+
}, function (item) {
|
226
|
+
return (0, _react2.jsx)(_index.Item, {
|
227
|
+
key: item.name,
|
228
|
+
"data-id": item.name
|
229
|
+
}, item.name);
|
230
|
+
}), (0, _react2.jsx)(_Box["default"], {
|
231
|
+
isRow: true,
|
232
|
+
alignItems: "center",
|
233
|
+
sx: {
|
234
|
+
marginLeft: '12px',
|
235
|
+
marginRight: '12px'
|
236
|
+
}
|
237
|
+
}, (0, _react2.jsx)(_index.IconButton, {
|
238
|
+
"aria-label": "Edit"
|
239
|
+
}, (0, _react2.jsx)(_index.Icon, {
|
146
240
|
icon: _CogsIcon["default"],
|
147
241
|
color: "neutral.30",
|
148
242
|
size: 20,
|
149
243
|
title: "edit icon"
|
150
244
|
})), (0, _react2.jsx)(_index.IconButton, {
|
151
|
-
ml: "5px"
|
245
|
+
ml: "5px",
|
246
|
+
"aria-label": "Delete"
|
152
247
|
}, (0, _react2.jsx)(_index.Icon, {
|
153
248
|
icon: _DeleteIcon["default"],
|
154
249
|
color: "neutral.30",
|
155
250
|
size: 20,
|
156
251
|
title: "delete icon"
|
157
|
-
}))));
|
252
|
+
})))));
|
158
253
|
};
|
159
254
|
|
160
255
|
exports.Default = Default;
|
package/lib/cjs/styles/theme.js
CHANGED
@@ -84,7 +84,9 @@ var _default = {
|
|
84
84
|
forms: _forms["default"],
|
85
85
|
text: _variants.text,
|
86
86
|
images: _variants.images,
|
87
|
-
buttons: _variants.buttons,
|
87
|
+
buttons: _objectSpread(_objectSpread({}, _variants.buttons), {}, {
|
88
|
+
bidirectionalIconButton: _variants.bidirectionalIconButton
|
89
|
+
}),
|
88
90
|
textColors: _text.textColors,
|
89
91
|
links: _variants.links,
|
90
92
|
variants: _variants.variants
|
@@ -0,0 +1,54 @@
|
|
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
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
8
|
+
|
9
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
10
|
+
|
11
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
12
|
+
|
13
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
14
|
+
|
15
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
16
|
+
|
17
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
18
|
+
|
19
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
20
|
+
|
21
|
+
_Object$defineProperty(exports, "__esModule", {
|
22
|
+
value: true
|
23
|
+
});
|
24
|
+
|
25
|
+
exports["default"] = void 0;
|
26
|
+
|
27
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
28
|
+
|
29
|
+
var _buttons = require("./buttons");
|
30
|
+
|
31
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
32
|
+
|
33
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
34
|
+
|
35
|
+
var bidirectionalIconButton = {
|
36
|
+
border: '1px solid',
|
37
|
+
outline: 'none',
|
38
|
+
height: '24px',
|
39
|
+
width: '24px',
|
40
|
+
color: 'active',
|
41
|
+
borderRadius: '12px',
|
42
|
+
borderColor: 'active',
|
43
|
+
'&.is-hovered': {
|
44
|
+
color: 'accent.40',
|
45
|
+
borderColor: 'accent.40'
|
46
|
+
},
|
47
|
+
'&.is-pressed': {
|
48
|
+
color: 'accent.20',
|
49
|
+
borderColor: 'accent.20'
|
50
|
+
},
|
51
|
+
'&.is-focused': _objectSpread({}, _buttons.defaultFocus)
|
52
|
+
};
|
53
|
+
var _default = bidirectionalIconButton;
|
54
|
+
exports["default"] = _default;
|
@@ -17,10 +17,18 @@ _Object$defineProperty(exports, "__esModule", {
|
|
17
17
|
var _exportNames = {
|
18
18
|
variants: true,
|
19
19
|
buttons: true,
|
20
|
+
bidirectionalIconButton: true,
|
20
21
|
images: true,
|
21
22
|
links: true
|
22
23
|
};
|
23
24
|
|
25
|
+
_Object$defineProperty(exports, "bidirectionalIconButton", {
|
26
|
+
enumerable: true,
|
27
|
+
get: function get() {
|
28
|
+
return _bidirectionalIconButton["default"];
|
29
|
+
}
|
30
|
+
});
|
31
|
+
|
24
32
|
_Object$defineProperty(exports, "buttons", {
|
25
33
|
enumerable: true,
|
26
34
|
get: function get() {
|
@@ -53,6 +61,8 @@ var _variants = _interopRequireDefault(require("./variants"));
|
|
53
61
|
|
54
62
|
var _buttons = _interopRequireDefault(require("./buttons"));
|
55
63
|
|
64
|
+
var _bidirectionalIconButton = _interopRequireDefault(require("./bidirectionalIconButton"));
|
65
|
+
|
56
66
|
var _images = _interopRequireDefault(require("./images"));
|
57
67
|
|
58
68
|
var _links = _interopRequireDefault(require("./links"));
|
@@ -5,6 +5,7 @@ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
|
|
5
5
|
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
6
6
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
7
7
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
8
|
+
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
8
9
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
9
10
|
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
10
11
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
@@ -27,10 +28,12 @@ import { FocusScope } from '@react-aria/focus';
|
|
27
28
|
import { useListState } from '@react-stately/list';
|
28
29
|
import { DismissButton, useOverlayPosition } from '@react-aria/overlays';
|
29
30
|
import { useLayoutEffect, useResizeObserver } from '@react-aria/utils';
|
30
|
-
import { Chip, Icon, IconButton, PopoverContainer, ScrollBox, TextField } from '../..';
|
31
|
+
import { Box, Chip, Icon, IconButton, PopoverContainer, ScrollBox, TextField } from '../..';
|
31
32
|
import ListBox from '../ListBox';
|
32
33
|
import { isIterableProp } from '../../utils/devUtils/props/isIterable';
|
33
34
|
import { usePropWarning } from '../../hooks';
|
35
|
+
import statuses from '../../utils/devUtils/constants/statuses';
|
36
|
+
import FieldHelperText from '../FieldHelperText';
|
34
37
|
/**
|
35
38
|
* Complex control that lets you choose several tags from the dropdown list.
|
36
39
|
* Or to add your own values in non-restrictive mode.
|
@@ -49,8 +52,10 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
49
52
|
direction = props.direction,
|
50
53
|
_props$disabledKeys = props.disabledKeys,
|
51
54
|
disabledKeys = _props$disabledKeys === void 0 ? [] : _props$disabledKeys,
|
55
|
+
containerProps = props.containerProps,
|
52
56
|
hasAutoFocus = props.hasAutoFocus,
|
53
57
|
hasNoStatusIndicator = props.hasNoStatusIndicator,
|
58
|
+
helperText = props.helperText,
|
54
59
|
customInputProps = props.inputProps,
|
55
60
|
isDisabled = props.isDisabled,
|
56
61
|
isNotFlippable = props.isNotFlippable,
|
@@ -70,7 +75,8 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
70
75
|
_props$readOnlyKeys = props.readOnlyKeys,
|
71
76
|
readOnlyKeys = _props$readOnlyKeys === void 0 ? [] : _props$readOnlyKeys,
|
72
77
|
selectedKeys = props.selectedKeys,
|
73
|
-
scrollBoxProps = props.scrollBoxProps
|
78
|
+
scrollBoxProps = props.scrollBoxProps,
|
79
|
+
status = props.status;
|
74
80
|
var hasCustomValue = mode === 'non-restrictive';
|
75
81
|
usePropWarning(props, 'disabled', 'isDisabled');
|
76
82
|
|
@@ -350,10 +356,11 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
350
356
|
wrapperProps: {
|
351
357
|
ref: inputRef,
|
352
358
|
variant: 'forms.input.multivaluesWrapper'
|
353
|
-
}
|
359
|
+
},
|
360
|
+
status: status
|
354
361
|
});
|
355
362
|
|
356
|
-
return ___EmotionJSX(
|
363
|
+
return ___EmotionJSX(Box, containerProps, ___EmotionJSX(TextField, _extends({
|
357
364
|
onBlur: function onBlur(e) {
|
358
365
|
setIsOpen(false);
|
359
366
|
if (_onBlur) _onBlur(e.nativeEvent);
|
@@ -375,7 +382,9 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
375
382
|
beforeInput: ___EmotionJSX(React.Fragment, null, readOnlyItems, " ", selectedItems)
|
376
383
|
},
|
377
384
|
value: filterString
|
378
|
-
}, inputProps)), ___EmotionJSX(
|
385
|
+
}, inputProps)), helperText && ___EmotionJSX(FieldHelperText, {
|
386
|
+
status: status
|
387
|
+
}, helperText), ___EmotionJSX(PopoverContainer, {
|
379
388
|
ref: popoverRef,
|
380
389
|
hasNoArrow: true,
|
381
390
|
isNonModal: true,
|
@@ -385,6 +394,9 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
385
394
|
}, listbox));
|
386
395
|
});
|
387
396
|
MultivaluesField.propTypes = {
|
397
|
+
/** Props object that is spread directly into the root (top-level) Box component. */
|
398
|
+
containerProps: PropTypes.shape({}),
|
399
|
+
|
388
400
|
/** The initial selected keys in the collection (uncontrolled). */
|
389
401
|
defaultSelectedKeys: isIterableProp,
|
390
402
|
|
@@ -402,6 +414,9 @@ MultivaluesField.propTypes = {
|
|
402
414
|
/** Whether the field has a status indicator. */
|
403
415
|
hasNoStatusIndicator: PropTypes.bool,
|
404
416
|
|
417
|
+
/** Text rendered below the input. */
|
418
|
+
helperText: PropTypes.node,
|
419
|
+
|
405
420
|
/**
|
406
421
|
* Props that get passed as-is to the underlying TextField element
|
407
422
|
*/
|
@@ -500,13 +515,17 @@ MultivaluesField.propTypes = {
|
|
500
515
|
/** @ignore */
|
501
516
|
scrollBoxProps: PropTypes.shape({
|
502
517
|
maxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.number])
|
503
|
-
})
|
518
|
+
}),
|
519
|
+
|
520
|
+
/** Determines the input status indicator and helper text styling. */
|
521
|
+
status: PropTypes.oneOf(_Object$values(statuses))
|
504
522
|
};
|
505
523
|
MultivaluesField.defaultProps = {
|
506
524
|
direction: 'bottom',
|
507
525
|
mode: 'restrictive',
|
508
526
|
scrollBoxProps: {
|
509
527
|
maxHeight: 300
|
510
|
-
}
|
528
|
+
},
|
529
|
+
status: statuses.DEFAULT
|
511
530
|
};
|
512
531
|
export default MultivaluesField;
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
3
3
|
import React, { useState } from 'react';
|
4
4
|
import { Box, Item, MultivaluesField, OverlayProvider } from '../..';
|
5
|
+
import statuses from '../../utils/devUtils/constants/statuses';
|
5
6
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
6
7
|
export default {
|
7
8
|
title: 'Form/MultivaluesField',
|
@@ -40,6 +41,18 @@ export default {
|
|
40
41
|
control: {
|
41
42
|
type: 'none'
|
42
43
|
}
|
44
|
+
},
|
45
|
+
status: {
|
46
|
+
control: {
|
47
|
+
type: 'select',
|
48
|
+
options: statuses
|
49
|
+
},
|
50
|
+
defaultValue: statuses.DEFAULT
|
51
|
+
},
|
52
|
+
helperText: {
|
53
|
+
control: {
|
54
|
+
type: 'text'
|
55
|
+
}
|
43
56
|
}
|
44
57
|
},
|
45
58
|
parameters: {
|
@@ -306,4 +319,31 @@ export var WithReadOnlyValues = function WithReadOnlyValues(args) {
|
|
306
319
|
"data-id": item.name
|
307
320
|
}, item.name);
|
308
321
|
}));
|
322
|
+
};
|
323
|
+
export var Error = function Error(args) {
|
324
|
+
var _useState17 = useState(false),
|
325
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
326
|
+
isOpen = _useState18[0],
|
327
|
+
setIsOpen = _useState18[1];
|
328
|
+
|
329
|
+
var direction = args.direction;
|
330
|
+
|
331
|
+
var onOpenChange = function onOpenChange() {
|
332
|
+
setIsOpen(true);
|
333
|
+
};
|
334
|
+
|
335
|
+
return ___EmotionJSX(OverlayProvider // note: spacing for demo purpose only so that the select list renders in the correct place
|
336
|
+
, {
|
337
|
+
style: setOverlayStyle(direction, isOpen, '50%', '50%', '20%')
|
338
|
+
}, ___EmotionJSX(MultivaluesField, _extends({}, args, {
|
339
|
+
items: items,
|
340
|
+
helperText: "Here is some helpful text...",
|
341
|
+
status: "error",
|
342
|
+
onOpenChange: onOpenChange
|
343
|
+
}), function (item) {
|
344
|
+
return ___EmotionJSX(Item, {
|
345
|
+
key: item.key,
|
346
|
+
"data-id": item.name
|
347
|
+
}, item.name);
|
348
|
+
}));
|
309
349
|
};
|
@@ -6,6 +6,7 @@ import userEvent from '@testing-library/user-event';
|
|
6
6
|
import { axe } from 'jest-axe';
|
7
7
|
import { Item, MultivaluesField, OverlayProvider } from '../../index';
|
8
8
|
import { render, screen, within } from '../../utils/testUtils/testWrapper';
|
9
|
+
import statuses from '../../utils/devUtils/constants/statuses';
|
9
10
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
11
|
var items = [{
|
11
12
|
id: 1,
|
@@ -357,4 +358,14 @@ test('read only keys', function () {
|
|
357
358
|
expect(secondChip).toBeInTheDocument();
|
358
359
|
var deleteButton2 = firstChip.nextSibling;
|
359
360
|
expect(deleteButton2).toBeNull();
|
361
|
+
});
|
362
|
+
test(' multivalue field with helper text', function () {
|
363
|
+
var helperText = 'helper text';
|
364
|
+
getComponent({
|
365
|
+
helperText: helperText,
|
366
|
+
status: statuses.ERROR
|
367
|
+
});
|
368
|
+
var helper = screen.getByText(helperText);
|
369
|
+
expect(helper).toBeInTheDocument();
|
370
|
+
expect(helper).toHaveClass("is-".concat(statuses.ERROR));
|
360
371
|
});
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
1
2
|
import React from 'react';
|
2
3
|
import DragVerticalIcon from 'mdi-react/DragVerticalIcon';
|
3
4
|
import DeleteIcon from 'mdi-react/DeleteIcon';
|
@@ -19,42 +20,52 @@ var items = [{
|
|
19
20
|
id: '3'
|
20
21
|
}];
|
21
22
|
export var Default = function Default() {
|
22
|
-
var CustomOnSvg = function CustomOnSvg() {
|
23
|
-
return ___EmotionJSX("svg", {
|
24
|
-
width: "
|
25
|
-
height: "
|
26
|
-
viewBox: "0 0
|
23
|
+
var CustomOnSvg = function CustomOnSvg(props) {
|
24
|
+
return ___EmotionJSX("svg", _extends({
|
25
|
+
width: "16",
|
26
|
+
height: "16",
|
27
|
+
viewBox: "0 0 16 16",
|
27
28
|
fill: "none",
|
28
29
|
xmlns: "http://www.w3.org/2000/svg"
|
29
|
-
}, ___EmotionJSX("path", {
|
30
|
-
d: "
|
31
|
-
fill: "
|
32
|
-
}), ___EmotionJSX("path", {
|
33
|
-
d: "M9.83325 10.6251V6.37511H15.4999V2.94678L21.0533 8.50011L15.4999 14.0534V10.6251H9.83325Z",
|
34
|
-
fill: "#4462ED"
|
30
|
+
}, props), ___EmotionJSX("path", {
|
31
|
+
d: "M5.33325 6.66666V8.66666H9.33325V12H5.33325V14L1.33325 10.3333L5.33325 6.66666Z",
|
32
|
+
fill: "currentColor"
|
35
33
|
}), ___EmotionJSX("path", {
|
36
|
-
d: "
|
37
|
-
fill: "
|
34
|
+
d: "M14.6666 5.66667L10.6666 2V4H6.66658V7.33333H10.6666V9.33333L14.6666 5.66667Z",
|
35
|
+
fill: "currentColor"
|
38
36
|
}));
|
39
37
|
};
|
40
38
|
|
41
|
-
var CustomOffSvg = function CustomOffSvg() {
|
42
|
-
return ___EmotionJSX("svg", {
|
43
|
-
width: "
|
44
|
-
height: "
|
45
|
-
viewBox: "0 0
|
39
|
+
var CustomOffSvg = function CustomOffSvg(props) {
|
40
|
+
return ___EmotionJSX("svg", _extends({
|
41
|
+
width: "16",
|
42
|
+
height: "16",
|
43
|
+
viewBox: "0 0 16 16",
|
46
44
|
fill: "none",
|
47
45
|
xmlns: "http://www.w3.org/2000/svg"
|
48
|
-
}, ___EmotionJSX("path", {
|
49
|
-
d: "
|
46
|
+
}, props), ___EmotionJSX("path", {
|
47
|
+
d: "M5.33325 6.66667V8.66667H9.33325V12H5.33325V14L1.33325 10.3333L5.33325 6.66667Z",
|
50
48
|
fill: "#CACED3"
|
51
49
|
}), ___EmotionJSX("path", {
|
52
|
-
d: "
|
53
|
-
fill: "
|
50
|
+
d: "M14.6666 5.66667L10.6666 2V4H6.66658V7.33333H10.6666V9.33333L14.6666 5.66667Z",
|
51
|
+
fill: "currentColor"
|
52
|
+
}));
|
53
|
+
};
|
54
|
+
|
55
|
+
var CustomRightSvg = function CustomRightSvg(props) {
|
56
|
+
return ___EmotionJSX("svg", _extends({
|
57
|
+
width: "8",
|
58
|
+
height: "8",
|
59
|
+
viewBox: "0 0 8 8",
|
60
|
+
fill: "none",
|
61
|
+
xmlns: "http://www.w3.org/2000/svg"
|
62
|
+
}, props), ___EmotionJSX("path", {
|
63
|
+
d: "M8 4L4 0V2.18182H0V5.81818H4V8L8 4Z",
|
64
|
+
fill: "currentColor"
|
54
65
|
}));
|
55
66
|
};
|
56
67
|
|
57
|
-
return ___EmotionJSX(Box, {
|
68
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, {
|
58
69
|
sx: {
|
59
70
|
alignItems: 'center'
|
60
71
|
},
|
@@ -83,8 +94,7 @@ export var Default = function Default() {
|
|
83
94
|
}, item.name);
|
84
95
|
}), ___EmotionJSX(Box, {
|
85
96
|
sx: {
|
86
|
-
|
87
|
-
mr: '5px',
|
97
|
+
mx: 'sm',
|
88
98
|
flexShrink: 0
|
89
99
|
}
|
90
100
|
}, ___EmotionJSX(IconButtonToggle, {
|
@@ -92,10 +102,91 @@ export var Default = function Default() {
|
|
92
102
|
defaultIcon: CustomOffSvg,
|
93
103
|
title: "Bidirectional/ Outbound toggle",
|
94
104
|
iconProps: {
|
95
|
-
size:
|
105
|
+
size: 16
|
106
|
+
},
|
107
|
+
buttonProps: {
|
108
|
+
variant: 'bidirectionalIconButton'
|
109
|
+
}
|
110
|
+
})), ___EmotionJSX(ComboBoxField, {
|
111
|
+
items: items,
|
112
|
+
defaultSelectedKey: "First Name",
|
113
|
+
containerProps: {
|
114
|
+
width: '275px'
|
115
|
+
},
|
116
|
+
labelProps: {
|
117
|
+
mb: 0
|
118
|
+
},
|
119
|
+
controlProps: {
|
120
|
+
'aria-label': 'Row one Pingone value'
|
121
|
+
}
|
122
|
+
}, function (item) {
|
123
|
+
return ___EmotionJSX(Item, {
|
124
|
+
key: item.name,
|
125
|
+
"data-id": item.name
|
126
|
+
}, item.name);
|
127
|
+
}), ___EmotionJSX(Box, {
|
128
|
+
isRow: true,
|
129
|
+
alignItems: "center",
|
130
|
+
sx: {
|
131
|
+
marginLeft: '12px',
|
132
|
+
marginRight: '12px'
|
133
|
+
}
|
134
|
+
}, ___EmotionJSX(IconButton, {
|
135
|
+
"aria-label": "Edit"
|
136
|
+
}, ___EmotionJSX(Icon, {
|
137
|
+
icon: CogsIcon,
|
138
|
+
color: "neutral.30",
|
139
|
+
size: 20,
|
140
|
+
title: "edit icon"
|
141
|
+
})), ___EmotionJSX(IconButton, {
|
142
|
+
ml: "5px",
|
143
|
+
"aria-label": "Delete"
|
144
|
+
}, ___EmotionJSX(Icon, {
|
145
|
+
icon: DeleteIcon,
|
146
|
+
color: "neutral.30",
|
147
|
+
size: 20,
|
148
|
+
title: "delete icon"
|
149
|
+
})))), ___EmotionJSX(Box, {
|
150
|
+
sx: {
|
151
|
+
alignItems: 'center'
|
152
|
+
},
|
153
|
+
isRow: true
|
154
|
+
}, ___EmotionJSX(Icon, {
|
155
|
+
icon: DragVerticalIcon,
|
156
|
+
size: 25,
|
157
|
+
color: "neutral.50"
|
158
|
+
}), ___EmotionJSX(ComboBoxField, {
|
159
|
+
items: items,
|
160
|
+
defaultSelectedKey: "Last Name",
|
161
|
+
containerProps: {
|
162
|
+
width: '275px'
|
163
|
+
},
|
164
|
+
labelProps: {
|
165
|
+
mb: 0
|
166
|
+
},
|
167
|
+
"aria-label": "Row one value",
|
168
|
+
controlProps: {
|
169
|
+
'aria-label': 'test'
|
170
|
+
}
|
171
|
+
}, function (item) {
|
172
|
+
return ___EmotionJSX(Item, {
|
173
|
+
key: item.name,
|
174
|
+
"data-id": item.name
|
175
|
+
}, item.name);
|
176
|
+
}), ___EmotionJSX(Box, {
|
177
|
+
sx: {
|
178
|
+
mx: 'sm',
|
179
|
+
flexShrink: 0
|
180
|
+
}
|
181
|
+
}, ___EmotionJSX(IconButtonToggle, {
|
182
|
+
toggledIcon: CustomRightSvg,
|
183
|
+
defaultIcon: CustomRightSvg,
|
184
|
+
title: "This attribute does not support write-back.",
|
185
|
+
iconProps: {
|
186
|
+
size: 8
|
96
187
|
},
|
97
188
|
buttonProps: {
|
98
|
-
variant: '
|
189
|
+
variant: 'bidirectionalIconButton'
|
99
190
|
}
|
100
191
|
})), ___EmotionJSX(ComboBoxField, {
|
101
192
|
items: items,
|
@@ -121,17 +212,20 @@ export var Default = function Default() {
|
|
121
212
|
marginLeft: '12px',
|
122
213
|
marginRight: '12px'
|
123
214
|
}
|
124
|
-
}, ___EmotionJSX(IconButton,
|
215
|
+
}, ___EmotionJSX(IconButton, {
|
216
|
+
"aria-label": "Edit"
|
217
|
+
}, ___EmotionJSX(Icon, {
|
125
218
|
icon: CogsIcon,
|
126
219
|
color: "neutral.30",
|
127
220
|
size: 20,
|
128
221
|
title: "edit icon"
|
129
222
|
})), ___EmotionJSX(IconButton, {
|
130
|
-
ml: "5px"
|
223
|
+
ml: "5px",
|
224
|
+
"aria-label": "Delete"
|
131
225
|
}, ___EmotionJSX(Icon, {
|
132
226
|
icon: DeleteIcon,
|
133
227
|
color: "neutral.30",
|
134
228
|
size: 20,
|
135
229
|
title: "delete icon"
|
136
|
-
}))));
|
230
|
+
})))));
|
137
231
|
};
|
package/lib/styles/theme.js
CHANGED
@@ -17,7 +17,7 @@ import colors, { accent, line, shadow, focus } from './colors';
|
|
17
17
|
import { fontSizes, fontWeights, textColors } from './text';
|
18
18
|
import breakpoints from './breakpoints';
|
19
19
|
import forms from './forms';
|
20
|
-
import { variants, buttons, text, images, links } from './variants';
|
20
|
+
import { variants, buttons, text, images, links, bidirectionalIconButton } from './variants';
|
21
21
|
export default {
|
22
22
|
name: 'Astro',
|
23
23
|
space: spacing,
|
@@ -52,7 +52,9 @@ export default {
|
|
52
52
|
forms: forms,
|
53
53
|
text: text,
|
54
54
|
images: images,
|
55
|
-
buttons: buttons,
|
55
|
+
buttons: _objectSpread(_objectSpread({}, buttons), {}, {
|
56
|
+
bidirectionalIconButton: bidirectionalIconButton
|
57
|
+
}),
|
56
58
|
textColors: textColors,
|
57
59
|
links: links,
|
58
60
|
variants: variants
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
2
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
3
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
4
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
5
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
6
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
7
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
8
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
10
|
+
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
12
|
+
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
14
|
+
|
15
|
+
import { defaultFocus } from './buttons';
|
16
|
+
var bidirectionalIconButton = {
|
17
|
+
border: '1px solid',
|
18
|
+
outline: 'none',
|
19
|
+
height: '24px',
|
20
|
+
width: '24px',
|
21
|
+
color: 'active',
|
22
|
+
borderRadius: '12px',
|
23
|
+
borderColor: 'active',
|
24
|
+
'&.is-hovered': {
|
25
|
+
color: 'accent.40',
|
26
|
+
borderColor: 'accent.40'
|
27
|
+
},
|
28
|
+
'&.is-pressed': {
|
29
|
+
color: 'accent.20',
|
30
|
+
borderColor: 'accent.20'
|
31
|
+
},
|
32
|
+
'&.is-focused': _objectSpread({}, defaultFocus)
|
33
|
+
};
|
34
|
+
export default bidirectionalIconButton;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
export { default as variants } from './variants';
|
2
2
|
export { default as buttons } from './buttons';
|
3
|
+
export { default as bidirectionalIconButton } from './bidirectionalIconButton';
|
3
4
|
export { default as images } from './images';
|
4
5
|
export { default as links } from './links';
|
5
6
|
export * from './text';
|