@pingux/astro 1.26.1-alpha.5 → 1.27.0-alpha.0
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 +50 -11
- package/lib/cjs/components/MultivaluesField/MultivaluesField.stories.js +32 -2
- package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +34 -0
- package/lib/cjs/recipes/ApplicationSearchDropdown.stories.js +44 -35
- package/lib/cjs/recipes/CollapsiblePanel.stories.js +30 -25
- package/lib/cjs/recipes/ConditionalFilter.stories.js +36 -55
- package/lib/cjs/styles/forms/input.js +2 -0
- package/lib/cjs/styles/variants/boxes.js +1 -1
- package/lib/components/MultivaluesField/MultivaluesField.js +52 -12
- package/lib/components/MultivaluesField/MultivaluesField.stories.js +27 -0
- package/lib/components/MultivaluesField/MultivaluesField.test.js +26 -0
- package/lib/recipes/ApplicationSearchDropdown.stories.js +44 -35
- package/lib/recipes/CollapsiblePanel.stories.js +30 -25
- package/lib/recipes/ConditionalFilter.stories.js +35 -54
- package/lib/styles/forms/input.js +2 -0
- package/lib/styles/variants/boxes.js +1 -1
- package/package.json +1 -1
@@ -84,7 +84,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
84
84
|
|
85
85
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
86
86
|
|
87
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
87
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context9, _context10; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context9 = ownKeys(Object(source), !0)).call(_context9, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context10 = ownKeys(Object(source))).call(_context10, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
88
88
|
|
89
89
|
/**
|
90
90
|
* Complex control that lets you choose several tags from the dropdown list.
|
@@ -96,7 +96,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
96
96
|
* Stately.
|
97
97
|
*/
|
98
98
|
var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
99
|
-
var
|
99
|
+
var _context6;
|
100
100
|
|
101
101
|
var defaultSelectedKeys = props.defaultSelectedKeys,
|
102
102
|
direction = props.direction,
|
@@ -231,7 +231,7 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
231
231
|
var onResize = (0, _react.useCallback)(function () {
|
232
232
|
/* istanbul ignore next */
|
233
233
|
if (inputRef.current) {
|
234
|
-
setMenuWidth(inputRef.current.offsetWidth);
|
234
|
+
setMenuWidth("".concat(inputRef.current.offsetWidth + 2, "px"));
|
235
235
|
}
|
236
236
|
}, [inputRef, isOpen, setMenuWidth]);
|
237
237
|
(0, _utils.useResizeObserver)({
|
@@ -323,7 +323,39 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
323
323
|
selectionManager.toggleSelection(key);
|
324
324
|
};
|
325
325
|
|
326
|
-
var
|
326
|
+
var readOnlyTextItem = function readOnlyTextItem(key, name) {
|
327
|
+
return (0, _react2.jsx)(_.Text, {
|
328
|
+
key: key,
|
329
|
+
role: "presentation",
|
330
|
+
label: name,
|
331
|
+
variant: "bodyStrong",
|
332
|
+
sx: {
|
333
|
+
bg: 'accent.95',
|
334
|
+
fontSize: 'sm',
|
335
|
+
alignSelf: 'center',
|
336
|
+
':not(:last-of-type):after': {
|
337
|
+
content: "\",\xA0\""
|
338
|
+
}
|
339
|
+
}
|
340
|
+
}, name);
|
341
|
+
};
|
342
|
+
|
343
|
+
var readOnlyInputEntry = (0, _react2.jsx)(_react["default"].Fragment, null, isReadOnly && (readOnlyKeys.length ? (0, _map["default"])(readOnlyKeys).call(readOnlyKeys, function (key) {
|
344
|
+
var _context4, _context5;
|
345
|
+
|
346
|
+
var item = (0, _find["default"])(_context4 = (0, _concat["default"])(_context5 = []).call(_context5, initialItems, customItems)).call(_context4, function (el) {
|
347
|
+
return el.key === key;
|
348
|
+
});
|
349
|
+
|
350
|
+
if (item) {
|
351
|
+
return readOnlyTextItem(item.key, item.name);
|
352
|
+
}
|
353
|
+
|
354
|
+
return null;
|
355
|
+
}) : (0, _map["default"])(initialItems).call(initialItems, function (item) {
|
356
|
+
return readOnlyTextItem(item.key, item.name);
|
357
|
+
})));
|
358
|
+
var readOnlyItems = (0, _react2.jsx)(_react["default"].Fragment, null, !isReadOnly && (0, _map["default"])(readOnlyKeys).call(readOnlyKeys, function (key) {
|
327
359
|
var item = (0, _find["default"])(initialItems).call(initialItems, function (el) {
|
328
360
|
return el.key === key;
|
329
361
|
});
|
@@ -345,10 +377,10 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
345
377
|
|
346
378
|
return null;
|
347
379
|
}));
|
348
|
-
var selectedItems = (0, _react2.jsx)(_react["default"].Fragment, null, (0, _map["default"])(
|
349
|
-
var
|
380
|
+
var selectedItems = (0, _react2.jsx)(_react["default"].Fragment, null, (0, _map["default"])(_context6 = (0, _from["default"])(selectionManager.selectedKeys)).call(_context6, function (key) {
|
381
|
+
var _context7, _context8;
|
350
382
|
|
351
|
-
var item = (0, _find["default"])(
|
383
|
+
var item = (0, _find["default"])(_context7 = (0, _concat["default"])(_context8 = []).call(_context8, initialItems, customItems)).call(_context7, function (el) {
|
352
384
|
return el.key === key;
|
353
385
|
});
|
354
386
|
|
@@ -403,7 +435,11 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
403
435
|
placeholder: placeholder,
|
404
436
|
wrapperProps: {
|
405
437
|
ref: inputRef,
|
406
|
-
variant: 'forms.input.multivaluesWrapper'
|
438
|
+
variant: 'forms.input.multivaluesWrapper',
|
439
|
+
sx: isReadOnly && {
|
440
|
+
boxShadow: 'inset 0 0 0 100px #e5e9f8',
|
441
|
+
border: 'none'
|
442
|
+
}
|
407
443
|
},
|
408
444
|
status: status
|
409
445
|
});
|
@@ -414,12 +450,14 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
414
450
|
if (_onBlur) _onBlur(e.nativeEvent);
|
415
451
|
},
|
416
452
|
onChange: function onChange(e) {
|
417
|
-
setIsOpen(true);
|
418
453
|
setFilterString(e.target.value);
|
419
454
|
if (onInputChange) onInputChange(e.target.value);
|
420
455
|
},
|
421
456
|
onFocus: function onFocus(e) {
|
422
|
-
|
457
|
+
if (!isReadOnly) {
|
458
|
+
setIsOpen(true);
|
459
|
+
}
|
460
|
+
|
423
461
|
if (_onFocus) _onFocus(e.nativeEvent);
|
424
462
|
},
|
425
463
|
onKeyDown: keyDown,
|
@@ -427,7 +465,7 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
427
465
|
return _onKeyUp && _onKeyUp(e.nativeEvent);
|
428
466
|
},
|
429
467
|
slots: {
|
430
|
-
beforeInput: (0, _react2.jsx)(_react["default"].Fragment, null, readOnlyItems, " ", selectedItems)
|
468
|
+
beforeInput: (0, _react2.jsx)(_react["default"].Fragment, null, readOnlyItems, " ", selectedItems, readOnlyInputEntry)
|
431
469
|
},
|
432
470
|
value: filterString
|
433
471
|
}, inputProps)), helperText && (0, _react2.jsx)(_FieldHelperText["default"], {
|
@@ -570,6 +608,7 @@ MultivaluesField.propTypes = {
|
|
570
608
|
};
|
571
609
|
MultivaluesField.defaultProps = {
|
572
610
|
direction: 'bottom',
|
611
|
+
isReadOnly: false,
|
573
612
|
mode: 'restrictive',
|
574
613
|
scrollBoxProps: {
|
575
614
|
maxHeight: 300
|
@@ -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.Error = exports.Default = exports.Controlled = void 0;
|
17
|
+
exports["default"] = exports.WithReadOnlyValues = exports.WithDisabledKeys = exports.WithCustomValues = exports.WithCustomSize = exports.Uncontrolled = exports.ReadOnlyField = exports.Error = exports.Default = exports.Controlled = void 0;
|
18
18
|
|
19
19
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
20
20
|
|
@@ -398,4 +398,34 @@ var Error = function Error(args) {
|
|
398
398
|
}));
|
399
399
|
};
|
400
400
|
|
401
|
-
exports.Error = Error;
|
401
|
+
exports.Error = Error;
|
402
|
+
|
403
|
+
var ReadOnlyField = function ReadOnlyField(args) {
|
404
|
+
var _useState19 = (0, _react.useState)(false),
|
405
|
+
_useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
|
406
|
+
isOpen = _useState20[0],
|
407
|
+
setIsOpen = _useState20[1];
|
408
|
+
|
409
|
+
var direction = args.direction;
|
410
|
+
|
411
|
+
var onOpenChange = function onOpenChange() {
|
412
|
+
setIsOpen(true);
|
413
|
+
};
|
414
|
+
|
415
|
+
return (0, _react2.jsx)(_.OverlayProvider // note: spacing for demo purpose only so that the select list renders in the correct place
|
416
|
+
, {
|
417
|
+
style: setOverlayStyle(direction, isOpen, '50%', '50%', '20%')
|
418
|
+
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({
|
419
|
+
items: items
|
420
|
+
}, args, {
|
421
|
+
isReadOnly: true,
|
422
|
+
onOpenChange: onOpenChange
|
423
|
+
}), function (item) {
|
424
|
+
return (0, _react2.jsx)(_.Item, {
|
425
|
+
key: item.key,
|
426
|
+
"data-id": item.name
|
427
|
+
}, item.name);
|
428
|
+
}));
|
429
|
+
};
|
430
|
+
|
431
|
+
exports.ReadOnlyField = ReadOnlyField;
|
@@ -493,4 +493,38 @@ test(' multivalue field with helper text', function () {
|
|
493
493
|
|
494
494
|
expect(helper).toBeInTheDocument();
|
495
495
|
expect(helper).toHaveClass("is-".concat(_statuses["default"].ERROR));
|
496
|
+
});
|
497
|
+
test('read only field', function () {
|
498
|
+
var isReadOnly = true;
|
499
|
+
getComponent({
|
500
|
+
isReadOnly: isReadOnly
|
501
|
+
});
|
502
|
+
|
503
|
+
var chip = _testWrapper.screen.queryAllByRole('presentation');
|
504
|
+
|
505
|
+
expect(chip[0]).toHaveAttribute('label', items[0].name);
|
506
|
+
expect(chip[1]).toHaveAttribute('label', items[1].name);
|
507
|
+
expect(chip[2]).toHaveAttribute('label', items[2].name);
|
508
|
+
|
509
|
+
var textArea = _testWrapper.screen.getByLabelText(defaultProps.label);
|
510
|
+
|
511
|
+
expect(textArea).toHaveClass('is-read-only');
|
512
|
+
expect(_testWrapper.screen.queryByRole('option')).not.toBeInTheDocument();
|
513
|
+
});
|
514
|
+
test('read only keys with read only field', function () {
|
515
|
+
var isReadOnly = true;
|
516
|
+
getComponent({
|
517
|
+
isReadOnly: isReadOnly,
|
518
|
+
readOnlyKeys: [items[1].key, items[2].key]
|
519
|
+
});
|
520
|
+
|
521
|
+
var chip = _testWrapper.screen.queryAllByRole('presentation');
|
522
|
+
|
523
|
+
expect(chip[0]).toHaveAttribute('label', items[1].name);
|
524
|
+
expect(chip[1]).toHaveAttribute('label', items[2].name);
|
525
|
+
|
526
|
+
var textArea = _testWrapper.screen.getByLabelText(defaultProps.label);
|
527
|
+
|
528
|
+
expect(textArea).toHaveClass('is-read-only');
|
529
|
+
expect(_testWrapper.screen.queryByRole('option')).not.toBeInTheDocument();
|
496
530
|
});
|
@@ -117,6 +117,44 @@ var items = [{
|
|
117
117
|
logo: _EmailIcon["default"],
|
118
118
|
id: '8'
|
119
119
|
}];
|
120
|
+
var sx = {
|
121
|
+
appBox: {
|
122
|
+
alignSelf: 'center',
|
123
|
+
maxWidth: '260px'
|
124
|
+
},
|
125
|
+
appTitle: {
|
126
|
+
alignSelf: 'center',
|
127
|
+
fontWeight: '700',
|
128
|
+
mr: 'auto'
|
129
|
+
},
|
130
|
+
appDesc: {
|
131
|
+
alignSelf: 'center',
|
132
|
+
fontSize: '15px',
|
133
|
+
mr: 'auto'
|
134
|
+
},
|
135
|
+
pinIconBox: {
|
136
|
+
alignSelf: 'center',
|
137
|
+
ml: 'md',
|
138
|
+
'&.is-hovered': {
|
139
|
+
bg: 'transparent'
|
140
|
+
},
|
141
|
+
'&.is-pressed': {
|
142
|
+
'path': {
|
143
|
+
fill: 'active'
|
144
|
+
}
|
145
|
+
}
|
146
|
+
},
|
147
|
+
listViewRow: {
|
148
|
+
bg: 'red',
|
149
|
+
padding: '-4px'
|
150
|
+
},
|
151
|
+
listViewItem: {
|
152
|
+
bg: 'white',
|
153
|
+
'&.is-hovered': {
|
154
|
+
bg: 'accent.99'
|
155
|
+
}
|
156
|
+
}
|
157
|
+
};
|
120
158
|
|
121
159
|
var Default = function Default() {
|
122
160
|
var buttonRef = (0, _react.useRef)();
|
@@ -197,42 +235,21 @@ var Default = function Default() {
|
|
197
235
|
ml: "-10px"
|
198
236
|
}), (0, _react2.jsx)(_index.Box, {
|
199
237
|
alignSelf: "center",
|
200
|
-
sx:
|
201
|
-
maxWidth: '260px'
|
202
|
-
}
|
238
|
+
sx: sx.appBox
|
203
239
|
}, (0, _react2.jsx)(_index.Text, {
|
204
240
|
variant: "itemTitle",
|
205
|
-
|
206
|
-
mr: "auto",
|
207
|
-
sx: {
|
208
|
-
fontWeight: '700'
|
209
|
-
}
|
241
|
+
sx: sx.appTitle
|
210
242
|
}, item.application), (0, _react2.jsx)(_index.Text, {
|
211
243
|
variant: "itemSubtitle",
|
212
|
-
|
213
|
-
mr: "auto",
|
214
|
-
sx: {
|
215
|
-
fontSize: '15px'
|
216
|
-
}
|
244
|
+
sx: sx.appDesc
|
217
245
|
}, item.description)), (0, _react2.jsx)(_index.Box, {
|
218
246
|
alignSelf: "center"
|
219
247
|
}, (0, _react2.jsx)(_index.IconButton, {
|
220
248
|
"aria-label": "Pin ".concat(item.application),
|
221
|
-
ml: "md",
|
222
|
-
alignSelf: "center",
|
223
249
|
onPress: function onPress() {
|
224
250
|
return onPinPress();
|
225
251
|
},
|
226
|
-
sx:
|
227
|
-
'&.is-hovered': {
|
228
|
-
bg: 'transparent'
|
229
|
-
},
|
230
|
-
'&.is-pressed': {
|
231
|
-
'path': {
|
232
|
-
fill: 'active'
|
233
|
-
}
|
234
|
-
}
|
235
|
-
}
|
252
|
+
sx: sx.pinIconBox
|
236
253
|
}, (0, _react2.jsx)(_index.Icon, {
|
237
254
|
icon: _PinIcon["default"],
|
238
255
|
sx: {
|
@@ -287,10 +304,7 @@ var Default = function Default() {
|
|
287
304
|
return setIsOpen(!isOpen);
|
288
305
|
},
|
289
306
|
rowProps: {
|
290
|
-
sx:
|
291
|
-
bg: 'red',
|
292
|
-
padding: '-4px'
|
293
|
-
}
|
307
|
+
sx: sx.listViewRow
|
294
308
|
},
|
295
309
|
padding: "-4px"
|
296
310
|
}, function (item) {
|
@@ -300,12 +314,7 @@ var Default = function Default() {
|
|
300
314
|
"data-id": item.key,
|
301
315
|
hasSeparator: false,
|
302
316
|
listItemProps: {
|
303
|
-
sx:
|
304
|
-
bg: 'white',
|
305
|
-
'&.is-hovered': {
|
306
|
-
bg: 'accent.99'
|
307
|
-
}
|
308
|
-
}
|
317
|
+
sx: sx.listViewItem
|
309
318
|
}
|
310
319
|
}, (0, _react2.jsx)(InnerHtml, {
|
311
320
|
item: item
|
@@ -138,6 +138,33 @@ var data = [{
|
|
138
138
|
subtitle: '',
|
139
139
|
chipValue: '29'
|
140
140
|
}];
|
141
|
+
var sx = {
|
142
|
+
listViewItem: {
|
143
|
+
bg: 'white',
|
144
|
+
width: '100%',
|
145
|
+
justifyContent: 'space-between',
|
146
|
+
alignItems: 'center',
|
147
|
+
'&.is-hovered': {
|
148
|
+
bg: 'accent.99'
|
149
|
+
}
|
150
|
+
},
|
151
|
+
defaultSelectedBox: {
|
152
|
+
border: '1px solid',
|
153
|
+
borderColor: 'neutral.80',
|
154
|
+
borderRadius: 5,
|
155
|
+
minHeight: 22,
|
156
|
+
justifyContent: 'center',
|
157
|
+
alignItems: 'center',
|
158
|
+
p: 'xs',
|
159
|
+
maxWidth: '50%'
|
160
|
+
},
|
161
|
+
defaultSelectedTitle: {
|
162
|
+
fontSize: 'sm',
|
163
|
+
pl: 'xs',
|
164
|
+
maxHeight: 32,
|
165
|
+
overflow: 'hidden'
|
166
|
+
}
|
167
|
+
};
|
141
168
|
|
142
169
|
var Default = function Default() {
|
143
170
|
var _useState = (0, _react.useState)(data),
|
@@ -257,15 +284,7 @@ var Default = function Default() {
|
|
257
284
|
"data-id": item.key,
|
258
285
|
listItemProps: {
|
259
286
|
isRow: true,
|
260
|
-
sx:
|
261
|
-
bg: 'white',
|
262
|
-
width: '100%',
|
263
|
-
justifyContent: 'space-between',
|
264
|
-
alignItems: 'center',
|
265
|
-
'&.is-hovered': {
|
266
|
-
bg: 'accent.99'
|
267
|
-
}
|
268
|
-
}
|
287
|
+
sx: sx.listViewItem
|
269
288
|
}
|
270
289
|
}, (0, _react2.jsx)(_.Box, {
|
271
290
|
isRow: true
|
@@ -293,16 +312,7 @@ var Default = function Default() {
|
|
293
312
|
variant: "listSubtitle"
|
294
313
|
}, item.subtitle))), item.isDefaultSelected ? (0, _react2.jsx)(_.Box, {
|
295
314
|
isRow: true,
|
296
|
-
sx:
|
297
|
-
border: '1px solid',
|
298
|
-
borderColor: 'neutral.80',
|
299
|
-
borderRadius: 5,
|
300
|
-
minHeight: 22,
|
301
|
-
justifyContent: 'center',
|
302
|
-
alignItems: 'center',
|
303
|
-
p: 'xs',
|
304
|
-
maxWidth: '50%'
|
305
|
-
}
|
315
|
+
sx: sx.defaultSelectedBox
|
306
316
|
}, (0, _react2.jsx)(_.Icon, {
|
307
317
|
icon: _CheckIcon["default"],
|
308
318
|
color: "neutral.20",
|
@@ -311,12 +321,7 @@ var Default = function Default() {
|
|
311
321
|
flexShrink: 0
|
312
322
|
}
|
313
323
|
}), (0, _react2.jsx)(_.Text, {
|
314
|
-
sx:
|
315
|
-
fontSize: 'sm',
|
316
|
-
pl: 'xs',
|
317
|
-
maxHeight: 32,
|
318
|
-
overflow: 'hidden'
|
319
|
-
}
|
324
|
+
sx: sx.defaultSelectedTitle
|
320
325
|
}, "Added by Filter")) : (0, _react2.jsx)(_.CheckboxField, {
|
321
326
|
controlProps: {
|
322
327
|
color: 'neutral.10',
|
@@ -32,25 +32,42 @@ var _default = {
|
|
32
32
|
title: 'Recipes/ConditionalFilter'
|
33
33
|
};
|
34
34
|
exports["default"] = _default;
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
var sx = {
|
36
|
+
customChipStyles: {
|
37
|
+
marginRight: 'sm',
|
38
38
|
'& > span': {
|
39
39
|
textTransform: 'none',
|
40
40
|
fontWeight: '500'
|
41
41
|
},
|
42
42
|
minWidth: '65px',
|
43
43
|
'z-index': '1'
|
44
|
-
}
|
45
|
-
|
44
|
+
},
|
45
|
+
borderedBoxStyles: {
|
46
46
|
'&::after': {
|
47
47
|
bg: 'decorative.7'
|
48
48
|
},
|
49
49
|
borderWidth: 1,
|
50
50
|
borderStyle: 'solid',
|
51
51
|
borderColor: 'neutral.80',
|
52
|
-
borderRadius: '4px'
|
53
|
-
|
52
|
+
borderRadius: '4px',
|
53
|
+
padding: 'sm',
|
54
|
+
width: '100%'
|
55
|
+
},
|
56
|
+
allConditionsBox: {
|
57
|
+
'&::after': {
|
58
|
+
bg: 'decorative.7'
|
59
|
+
},
|
60
|
+
alignItems: 'center',
|
61
|
+
borderRadius: '4px',
|
62
|
+
marginTop: 'md'
|
63
|
+
},
|
64
|
+
defaultText: {
|
65
|
+
textTransform: 'none',
|
66
|
+
color: 'inherit'
|
67
|
+
}
|
68
|
+
};
|
69
|
+
|
70
|
+
var Default = function Default() {
|
54
71
|
var allConditions = [{
|
55
72
|
field1: 'Family Name',
|
56
73
|
field3: 'John',
|
@@ -122,8 +139,7 @@ var Default = function Default() {
|
|
122
139
|
}, (0, _react2.jsx)(_index.Chip, {
|
123
140
|
label: "All",
|
124
141
|
bg: "decorative.7",
|
125
|
-
|
126
|
-
sx: customChipStyles
|
142
|
+
sx: sx.customChipStyles
|
127
143
|
}), (0, _react2.jsx)(_index.Text, null, " of the conditions are true")), (0, _map["default"])(allConditions).call(allConditions, function (item) {
|
128
144
|
return (0, _react2.jsx)(_index.Box, {
|
129
145
|
isRow: true,
|
@@ -135,14 +151,7 @@ var Default = function Default() {
|
|
135
151
|
variant: "forms.input.container",
|
136
152
|
bg: "white",
|
137
153
|
isRow: true,
|
138
|
-
|
139
|
-
borderRadius: "4px",
|
140
|
-
sx: {
|
141
|
-
'&::after': {
|
142
|
-
bg: 'decorative.7'
|
143
|
-
}
|
144
|
-
},
|
145
|
-
mt: "15px"
|
154
|
+
sx: sx.allConditionsBox
|
146
155
|
}, (0, _react2.jsx)(_index.Text, {
|
147
156
|
pl: "md",
|
148
157
|
pr: "sm"
|
@@ -150,8 +159,7 @@ var Default = function Default() {
|
|
150
159
|
label: "Equals",
|
151
160
|
bg: "accent.90",
|
152
161
|
textColor: "neutral.10",
|
153
|
-
sx: customChipStyles,
|
154
|
-
mr: "sm",
|
162
|
+
sx: sx.customChipStyles,
|
155
163
|
alignSelf: "center"
|
156
164
|
}), (0, _react2.jsx)(_index.Text, null, item.field3))));
|
157
165
|
}), (0, _react2.jsx)(_index.Box, {
|
@@ -160,18 +168,14 @@ var Default = function Default() {
|
|
160
168
|
isLast: true
|
161
169
|
}), (0, _react2.jsx)(_index.Box, {
|
162
170
|
variant: "forms.input.container",
|
163
|
-
borderRadius: "4px",
|
164
|
-
p: "sm",
|
165
171
|
mt: "md",
|
166
|
-
sx: borderedBoxStyles
|
167
|
-
width: "100%"
|
172
|
+
sx: sx.borderedBoxStyles
|
168
173
|
}, (0, _react2.jsx)(_index.Box, {
|
169
174
|
isRow: true
|
170
175
|
}, (0, _react2.jsx)(_index.Chip, {
|
171
176
|
label: "Any",
|
172
177
|
bg: "decorative.4",
|
173
|
-
|
174
|
-
sx: customChipStyles,
|
178
|
+
sx: sx.customChipStyles,
|
175
179
|
alignSelf: "center"
|
176
180
|
}), (0, _react2.jsx)(_index.Text, null, " of the conditions are true")), (0, _react2.jsx)(_index.Box, {
|
177
181
|
ml: "sm"
|
@@ -186,14 +190,8 @@ var Default = function Default() {
|
|
186
190
|
variant: "forms.input.container",
|
187
191
|
bg: "white",
|
188
192
|
isRow: true,
|
189
|
-
alignItems: "center",
|
190
|
-
borderRadius: "4px",
|
191
193
|
width: "100%",
|
192
|
-
sx:
|
193
|
-
'&::after': {
|
194
|
-
bg: 'decorative.4'
|
195
|
-
}
|
196
|
-
}
|
194
|
+
sx: sx.allConditionsBox
|
197
195
|
}, (0, _react2.jsx)(_index.Text, {
|
198
196
|
pl: "md",
|
199
197
|
pr: "sm"
|
@@ -201,8 +199,7 @@ var Default = function Default() {
|
|
201
199
|
label: "Equals",
|
202
200
|
bg: "accent.90",
|
203
201
|
textColor: "neutral.10",
|
204
|
-
sx: customChipStyles,
|
205
|
-
mr: "sm",
|
202
|
+
sx: sx.customChipStyles,
|
206
203
|
alignSelf: "center"
|
207
204
|
}), (0, _react2.jsx)(_index.Text, null, item.field3)));
|
208
205
|
})))))), (0, _react2.jsx)(_index.Button, {
|
@@ -235,10 +232,7 @@ var Default = function Default() {
|
|
235
232
|
},
|
236
233
|
"aria-label": "temp-label"
|
237
234
|
}, (0, _react2.jsx)(_index.Text, {
|
238
|
-
sx:
|
239
|
-
textTransform: 'none',
|
240
|
-
color: 'inherit'
|
241
|
-
}
|
235
|
+
sx: sx.defaultText
|
242
236
|
}, "Any")), (0, _react2.jsx)(_index.RockerButton, {
|
243
237
|
name: "all",
|
244
238
|
key: "all",
|
@@ -247,10 +241,7 @@ var Default = function Default() {
|
|
247
241
|
},
|
248
242
|
"aria-label": "temp-label"
|
249
243
|
}, (0, _react2.jsx)(_index.Text, {
|
250
|
-
sx:
|
251
|
-
textTransform: 'none',
|
252
|
-
color: 'inherit'
|
253
|
-
}
|
244
|
+
sx: sx.defaultText
|
254
245
|
}, "All"))), (0, _react2.jsx)(_index.Text, null, " of the conditions are true"), (0, _react2.jsx)(_index.Button, {
|
255
246
|
variant: "inline",
|
256
247
|
width: "fit-content",
|
@@ -310,11 +301,7 @@ var Default = function Default() {
|
|
310
301
|
mr: "sm"
|
311
302
|
}), (0, _react2.jsx)(_index.Box, {
|
312
303
|
variant: "forms.input.container",
|
313
|
-
|
314
|
-
p: "sm",
|
315
|
-
width: "100%",
|
316
|
-
sx: borderedBoxStyles,
|
317
|
-
mr: "xs"
|
304
|
+
sx: sx.borderedBoxStyles
|
318
305
|
}, (0, _react2.jsx)(_index.Box, {
|
319
306
|
isRow: true,
|
320
307
|
alignItems: "center",
|
@@ -330,10 +317,7 @@ var Default = function Default() {
|
|
330
317
|
},
|
331
318
|
"aria-label": "any"
|
332
319
|
}, (0, _react2.jsx)(_index.Text, {
|
333
|
-
sx:
|
334
|
-
textTransform: 'none',
|
335
|
-
color: 'inherit'
|
336
|
-
}
|
320
|
+
sx: sx.defaultText
|
337
321
|
}, "Any")), (0, _react2.jsx)(_index.RockerButton, {
|
338
322
|
name: "all",
|
339
323
|
key: "all",
|
@@ -342,10 +326,7 @@ var Default = function Default() {
|
|
342
326
|
},
|
343
327
|
"aria-label": "all"
|
344
328
|
}, (0, _react2.jsx)(_index.Text, {
|
345
|
-
sx:
|
346
|
-
textTransform: 'none',
|
347
|
-
color: 'inherit'
|
348
|
-
}
|
329
|
+
sx: sx.defaultText
|
349
330
|
}, "All"))), (0, _react2.jsx)(_index.Text, null, " of the conditions are true"), (0, _react2.jsx)(_index.Button, {
|
350
331
|
variant: "inline",
|
351
332
|
width: "fit-content",
|
@@ -173,7 +173,7 @@ var selectedItemChip = _objectSpread(_objectSpread({}, multivaluesChip), {}, {
|
|
173
173
|
});
|
174
174
|
|
175
175
|
var readOnlyChip = _objectSpread(_objectSpread({}, multivaluesChip), {}, {
|
176
|
-
p:
|
176
|
+
p: 2.54,
|
177
177
|
border: '1px solid',
|
178
178
|
borderColor: 'neutral.80'
|
179
179
|
});
|
@@ -18,7 +18,7 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
18
18
|
|
19
19
|
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; }
|
20
20
|
|
21
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context9, _context10; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context9 = ownKeys(Object(source), !0)).call(_context9, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context10 = ownKeys(Object(source))).call(_context10, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
22
22
|
|
23
23
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
24
24
|
import PropTypes from 'prop-types';
|
@@ -28,7 +28,7 @@ import { FocusScope } from '@react-aria/focus';
|
|
28
28
|
import { useListState } from '@react-stately/list';
|
29
29
|
import { DismissButton, useOverlayPosition } from '@react-aria/overlays';
|
30
30
|
import { useLayoutEffect, useResizeObserver } from '@react-aria/utils';
|
31
|
-
import { Box, Chip, Icon, IconButton, PopoverContainer, ScrollBox, TextField } from '../..';
|
31
|
+
import { Box, Chip, Icon, IconButton, PopoverContainer, ScrollBox, Text, TextField } from '../..';
|
32
32
|
import ListBox from '../ListBox';
|
33
33
|
import { isIterableProp } from '../../utils/devUtils/props/isIterable';
|
34
34
|
import { usePropWarning } from '../../hooks';
|
@@ -46,7 +46,7 @@ import FieldHelperText from '../FieldHelperText';
|
|
46
46
|
|
47
47
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
48
48
|
var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
49
|
-
var
|
49
|
+
var _context6;
|
50
50
|
|
51
51
|
var defaultSelectedKeys = props.defaultSelectedKeys,
|
52
52
|
direction = props.direction,
|
@@ -181,7 +181,7 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
181
181
|
var onResize = useCallback(function () {
|
182
182
|
/* istanbul ignore next */
|
183
183
|
if (inputRef.current) {
|
184
|
-
setMenuWidth(inputRef.current.offsetWidth);
|
184
|
+
setMenuWidth("".concat(inputRef.current.offsetWidth + 2, "px"));
|
185
185
|
}
|
186
186
|
}, [inputRef, isOpen, setMenuWidth]);
|
187
187
|
useResizeObserver({
|
@@ -273,7 +273,40 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
273
273
|
selectionManager.toggleSelection(key);
|
274
274
|
};
|
275
275
|
|
276
|
-
var
|
276
|
+
var readOnlyTextItem = function readOnlyTextItem(key, name) {
|
277
|
+
return ___EmotionJSX(Text, {
|
278
|
+
key: key,
|
279
|
+
role: "presentation",
|
280
|
+
label: name,
|
281
|
+
variant: "bodyStrong",
|
282
|
+
sx: {
|
283
|
+
bg: 'accent.95',
|
284
|
+
fontSize: 'sm',
|
285
|
+
alignSelf: 'center',
|
286
|
+
':not(:last-of-type):after': {
|
287
|
+
content: "\",\xA0\""
|
288
|
+
}
|
289
|
+
}
|
290
|
+
}, name);
|
291
|
+
};
|
292
|
+
|
293
|
+
var readOnlyInputEntry = ___EmotionJSX(React.Fragment, null, isReadOnly && (readOnlyKeys.length ? _mapInstanceProperty(readOnlyKeys).call(readOnlyKeys, function (key) {
|
294
|
+
var _context4, _context5;
|
295
|
+
|
296
|
+
var item = _findInstanceProperty(_context4 = _concatInstanceProperty(_context5 = []).call(_context5, initialItems, customItems)).call(_context4, function (el) {
|
297
|
+
return el.key === key;
|
298
|
+
});
|
299
|
+
|
300
|
+
if (item) {
|
301
|
+
return readOnlyTextItem(item.key, item.name);
|
302
|
+
}
|
303
|
+
|
304
|
+
return null;
|
305
|
+
}) : _mapInstanceProperty(initialItems).call(initialItems, function (item) {
|
306
|
+
return readOnlyTextItem(item.key, item.name);
|
307
|
+
})));
|
308
|
+
|
309
|
+
var readOnlyItems = ___EmotionJSX(React.Fragment, null, !isReadOnly && _mapInstanceProperty(readOnlyKeys).call(readOnlyKeys, function (key) {
|
277
310
|
var item = _findInstanceProperty(initialItems).call(initialItems, function (el) {
|
278
311
|
return el.key === key;
|
279
312
|
});
|
@@ -296,10 +329,10 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
296
329
|
return null;
|
297
330
|
}));
|
298
331
|
|
299
|
-
var selectedItems = ___EmotionJSX(React.Fragment, null, _mapInstanceProperty(
|
300
|
-
var
|
332
|
+
var selectedItems = ___EmotionJSX(React.Fragment, null, _mapInstanceProperty(_context6 = _Array$from(selectionManager.selectedKeys)).call(_context6, function (key) {
|
333
|
+
var _context7, _context8;
|
301
334
|
|
302
|
-
var item = _findInstanceProperty(
|
335
|
+
var item = _findInstanceProperty(_context7 = _concatInstanceProperty(_context8 = []).call(_context8, initialItems, customItems)).call(_context7, function (el) {
|
303
336
|
return el.key === key;
|
304
337
|
});
|
305
338
|
|
@@ -355,7 +388,11 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
355
388
|
placeholder: placeholder,
|
356
389
|
wrapperProps: {
|
357
390
|
ref: inputRef,
|
358
|
-
variant: 'forms.input.multivaluesWrapper'
|
391
|
+
variant: 'forms.input.multivaluesWrapper',
|
392
|
+
sx: isReadOnly && {
|
393
|
+
boxShadow: 'inset 0 0 0 100px #e5e9f8',
|
394
|
+
border: 'none'
|
395
|
+
}
|
359
396
|
},
|
360
397
|
status: status
|
361
398
|
});
|
@@ -366,12 +403,14 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
366
403
|
if (_onBlur) _onBlur(e.nativeEvent);
|
367
404
|
},
|
368
405
|
onChange: function onChange(e) {
|
369
|
-
setIsOpen(true);
|
370
406
|
setFilterString(e.target.value);
|
371
407
|
if (onInputChange) onInputChange(e.target.value);
|
372
408
|
},
|
373
409
|
onFocus: function onFocus(e) {
|
374
|
-
|
410
|
+
if (!isReadOnly) {
|
411
|
+
setIsOpen(true);
|
412
|
+
}
|
413
|
+
|
375
414
|
if (_onFocus) _onFocus(e.nativeEvent);
|
376
415
|
},
|
377
416
|
onKeyDown: keyDown,
|
@@ -379,7 +418,7 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
379
418
|
return _onKeyUp && _onKeyUp(e.nativeEvent);
|
380
419
|
},
|
381
420
|
slots: {
|
382
|
-
beforeInput: ___EmotionJSX(React.Fragment, null, readOnlyItems, " ", selectedItems)
|
421
|
+
beforeInput: ___EmotionJSX(React.Fragment, null, readOnlyItems, " ", selectedItems, readOnlyInputEntry)
|
383
422
|
},
|
384
423
|
value: filterString
|
385
424
|
}, inputProps)), helperText && ___EmotionJSX(FieldHelperText, {
|
@@ -522,6 +561,7 @@ MultivaluesField.propTypes = {
|
|
522
561
|
};
|
523
562
|
MultivaluesField.defaultProps = {
|
524
563
|
direction: 'bottom',
|
564
|
+
isReadOnly: false,
|
525
565
|
mode: 'restrictive',
|
526
566
|
scrollBoxProps: {
|
527
567
|
maxHeight: 300
|
@@ -346,4 +346,31 @@ export var Error = function Error(args) {
|
|
346
346
|
"data-id": item.name
|
347
347
|
}, item.name);
|
348
348
|
}));
|
349
|
+
};
|
350
|
+
export var ReadOnlyField = function ReadOnlyField(args) {
|
351
|
+
var _useState19 = useState(false),
|
352
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
353
|
+
isOpen = _useState20[0],
|
354
|
+
setIsOpen = _useState20[1];
|
355
|
+
|
356
|
+
var direction = args.direction;
|
357
|
+
|
358
|
+
var onOpenChange = function onOpenChange() {
|
359
|
+
setIsOpen(true);
|
360
|
+
};
|
361
|
+
|
362
|
+
return ___EmotionJSX(OverlayProvider // note: spacing for demo purpose only so that the select list renders in the correct place
|
363
|
+
, {
|
364
|
+
style: setOverlayStyle(direction, isOpen, '50%', '50%', '20%')
|
365
|
+
}, ___EmotionJSX(MultivaluesField, _extends({
|
366
|
+
items: items
|
367
|
+
}, args, {
|
368
|
+
isReadOnly: true,
|
369
|
+
onOpenChange: onOpenChange
|
370
|
+
}), function (item) {
|
371
|
+
return ___EmotionJSX(Item, {
|
372
|
+
key: item.key,
|
373
|
+
"data-id": item.name
|
374
|
+
}, item.name);
|
375
|
+
}));
|
349
376
|
};
|
@@ -368,4 +368,30 @@ test(' multivalue field with helper text', function () {
|
|
368
368
|
var helper = screen.getByText(helperText);
|
369
369
|
expect(helper).toBeInTheDocument();
|
370
370
|
expect(helper).toHaveClass("is-".concat(statuses.ERROR));
|
371
|
+
});
|
372
|
+
test('read only field', function () {
|
373
|
+
var isReadOnly = true;
|
374
|
+
getComponent({
|
375
|
+
isReadOnly: isReadOnly
|
376
|
+
});
|
377
|
+
var chip = screen.queryAllByRole('presentation');
|
378
|
+
expect(chip[0]).toHaveAttribute('label', items[0].name);
|
379
|
+
expect(chip[1]).toHaveAttribute('label', items[1].name);
|
380
|
+
expect(chip[2]).toHaveAttribute('label', items[2].name);
|
381
|
+
var textArea = screen.getByLabelText(defaultProps.label);
|
382
|
+
expect(textArea).toHaveClass('is-read-only');
|
383
|
+
expect(screen.queryByRole('option')).not.toBeInTheDocument();
|
384
|
+
});
|
385
|
+
test('read only keys with read only field', function () {
|
386
|
+
var isReadOnly = true;
|
387
|
+
getComponent({
|
388
|
+
isReadOnly: isReadOnly,
|
389
|
+
readOnlyKeys: [items[1].key, items[2].key]
|
390
|
+
});
|
391
|
+
var chip = screen.queryAllByRole('presentation');
|
392
|
+
expect(chip[0]).toHaveAttribute('label', items[1].name);
|
393
|
+
expect(chip[1]).toHaveAttribute('label', items[2].name);
|
394
|
+
var textArea = screen.getByLabelText(defaultProps.label);
|
395
|
+
expect(textArea).toHaveClass('is-read-only');
|
396
|
+
expect(screen.queryByRole('option')).not.toBeInTheDocument();
|
371
397
|
});
|
@@ -76,6 +76,44 @@ var items = [{
|
|
76
76
|
logo: Email,
|
77
77
|
id: '8'
|
78
78
|
}];
|
79
|
+
var sx = {
|
80
|
+
appBox: {
|
81
|
+
alignSelf: 'center',
|
82
|
+
maxWidth: '260px'
|
83
|
+
},
|
84
|
+
appTitle: {
|
85
|
+
alignSelf: 'center',
|
86
|
+
fontWeight: '700',
|
87
|
+
mr: 'auto'
|
88
|
+
},
|
89
|
+
appDesc: {
|
90
|
+
alignSelf: 'center',
|
91
|
+
fontSize: '15px',
|
92
|
+
mr: 'auto'
|
93
|
+
},
|
94
|
+
pinIconBox: {
|
95
|
+
alignSelf: 'center',
|
96
|
+
ml: 'md',
|
97
|
+
'&.is-hovered': {
|
98
|
+
bg: 'transparent'
|
99
|
+
},
|
100
|
+
'&.is-pressed': {
|
101
|
+
'path': {
|
102
|
+
fill: 'active'
|
103
|
+
}
|
104
|
+
}
|
105
|
+
},
|
106
|
+
listViewRow: {
|
107
|
+
bg: 'red',
|
108
|
+
padding: '-4px'
|
109
|
+
},
|
110
|
+
listViewItem: {
|
111
|
+
bg: 'white',
|
112
|
+
'&.is-hovered': {
|
113
|
+
bg: 'accent.99'
|
114
|
+
}
|
115
|
+
}
|
116
|
+
};
|
79
117
|
export var Default = function Default() {
|
80
118
|
var buttonRef = useRef();
|
81
119
|
var popoverRef = useRef();
|
@@ -155,42 +193,21 @@ export var Default = function Default() {
|
|
155
193
|
ml: "-10px"
|
156
194
|
}), ___EmotionJSX(Box, {
|
157
195
|
alignSelf: "center",
|
158
|
-
sx:
|
159
|
-
maxWidth: '260px'
|
160
|
-
}
|
196
|
+
sx: sx.appBox
|
161
197
|
}, ___EmotionJSX(Text, {
|
162
198
|
variant: "itemTitle",
|
163
|
-
|
164
|
-
mr: "auto",
|
165
|
-
sx: {
|
166
|
-
fontWeight: '700'
|
167
|
-
}
|
199
|
+
sx: sx.appTitle
|
168
200
|
}, item.application), ___EmotionJSX(Text, {
|
169
201
|
variant: "itemSubtitle",
|
170
|
-
|
171
|
-
mr: "auto",
|
172
|
-
sx: {
|
173
|
-
fontSize: '15px'
|
174
|
-
}
|
202
|
+
sx: sx.appDesc
|
175
203
|
}, item.description)), ___EmotionJSX(Box, {
|
176
204
|
alignSelf: "center"
|
177
205
|
}, ___EmotionJSX(IconButton, {
|
178
206
|
"aria-label": "Pin ".concat(item.application),
|
179
|
-
ml: "md",
|
180
|
-
alignSelf: "center",
|
181
207
|
onPress: function onPress() {
|
182
208
|
return onPinPress();
|
183
209
|
},
|
184
|
-
sx:
|
185
|
-
'&.is-hovered': {
|
186
|
-
bg: 'transparent'
|
187
|
-
},
|
188
|
-
'&.is-pressed': {
|
189
|
-
'path': {
|
190
|
-
fill: 'active'
|
191
|
-
}
|
192
|
-
}
|
193
|
-
}
|
210
|
+
sx: sx.pinIconBox
|
194
211
|
}, ___EmotionJSX(Icon, {
|
195
212
|
icon: Pin,
|
196
213
|
sx: {
|
@@ -245,10 +262,7 @@ export var Default = function Default() {
|
|
245
262
|
return setIsOpen(!isOpen);
|
246
263
|
},
|
247
264
|
rowProps: {
|
248
|
-
sx:
|
249
|
-
bg: 'red',
|
250
|
-
padding: '-4px'
|
251
|
-
}
|
265
|
+
sx: sx.listViewRow
|
252
266
|
},
|
253
267
|
padding: "-4px"
|
254
268
|
}, function (item) {
|
@@ -258,12 +272,7 @@ export var Default = function Default() {
|
|
258
272
|
"data-id": item.key,
|
259
273
|
hasSeparator: false,
|
260
274
|
listItemProps: {
|
261
|
-
sx:
|
262
|
-
bg: 'white',
|
263
|
-
'&.is-hovered': {
|
264
|
-
bg: 'accent.99'
|
265
|
-
}
|
266
|
-
}
|
275
|
+
sx: sx.listViewItem
|
267
276
|
}
|
268
277
|
}, ___EmotionJSX(InnerHtml, {
|
269
278
|
item: item
|
@@ -95,6 +95,33 @@ var data = [{
|
|
95
95
|
subtitle: '',
|
96
96
|
chipValue: '29'
|
97
97
|
}];
|
98
|
+
var sx = {
|
99
|
+
listViewItem: {
|
100
|
+
bg: 'white',
|
101
|
+
width: '100%',
|
102
|
+
justifyContent: 'space-between',
|
103
|
+
alignItems: 'center',
|
104
|
+
'&.is-hovered': {
|
105
|
+
bg: 'accent.99'
|
106
|
+
}
|
107
|
+
},
|
108
|
+
defaultSelectedBox: {
|
109
|
+
border: '1px solid',
|
110
|
+
borderColor: 'neutral.80',
|
111
|
+
borderRadius: 5,
|
112
|
+
minHeight: 22,
|
113
|
+
justifyContent: 'center',
|
114
|
+
alignItems: 'center',
|
115
|
+
p: 'xs',
|
116
|
+
maxWidth: '50%'
|
117
|
+
},
|
118
|
+
defaultSelectedTitle: {
|
119
|
+
fontSize: 'sm',
|
120
|
+
pl: 'xs',
|
121
|
+
maxHeight: 32,
|
122
|
+
overflow: 'hidden'
|
123
|
+
}
|
124
|
+
};
|
98
125
|
export var Default = function Default() {
|
99
126
|
var _useState = useState(data),
|
100
127
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -213,15 +240,7 @@ export var Default = function Default() {
|
|
213
240
|
"data-id": item.key,
|
214
241
|
listItemProps: {
|
215
242
|
isRow: true,
|
216
|
-
sx:
|
217
|
-
bg: 'white',
|
218
|
-
width: '100%',
|
219
|
-
justifyContent: 'space-between',
|
220
|
-
alignItems: 'center',
|
221
|
-
'&.is-hovered': {
|
222
|
-
bg: 'accent.99'
|
223
|
-
}
|
224
|
-
}
|
243
|
+
sx: sx.listViewItem
|
225
244
|
}
|
226
245
|
}, ___EmotionJSX(Box, {
|
227
246
|
isRow: true
|
@@ -249,16 +268,7 @@ export var Default = function Default() {
|
|
249
268
|
variant: "listSubtitle"
|
250
269
|
}, item.subtitle))), item.isDefaultSelected ? ___EmotionJSX(Box, {
|
251
270
|
isRow: true,
|
252
|
-
sx:
|
253
|
-
border: '1px solid',
|
254
|
-
borderColor: 'neutral.80',
|
255
|
-
borderRadius: 5,
|
256
|
-
minHeight: 22,
|
257
|
-
justifyContent: 'center',
|
258
|
-
alignItems: 'center',
|
259
|
-
p: 'xs',
|
260
|
-
maxWidth: '50%'
|
261
|
-
}
|
271
|
+
sx: sx.defaultSelectedBox
|
262
272
|
}, ___EmotionJSX(Icon, {
|
263
273
|
icon: CheckIcon,
|
264
274
|
color: "neutral.20",
|
@@ -267,12 +277,7 @@ export var Default = function Default() {
|
|
267
277
|
flexShrink: 0
|
268
278
|
}
|
269
279
|
}), ___EmotionJSX(Text, {
|
270
|
-
sx:
|
271
|
-
fontSize: 'sm',
|
272
|
-
pl: 'xs',
|
273
|
-
maxHeight: 32,
|
274
|
-
overflow: 'hidden'
|
275
|
-
}
|
280
|
+
sx: sx.defaultSelectedTitle
|
276
281
|
}, "Added by Filter")) : ___EmotionJSX(CheckboxField, {
|
277
282
|
controlProps: {
|
278
283
|
color: 'neutral.10',
|
@@ -10,24 +10,41 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
10
10
|
export default {
|
11
11
|
title: 'Recipes/ConditionalFilter'
|
12
12
|
};
|
13
|
-
|
14
|
-
|
13
|
+
var sx = {
|
14
|
+
customChipStyles: {
|
15
|
+
marginRight: 'sm',
|
15
16
|
'& > span': {
|
16
17
|
textTransform: 'none',
|
17
18
|
fontWeight: '500'
|
18
19
|
},
|
19
20
|
minWidth: '65px',
|
20
21
|
'z-index': '1'
|
21
|
-
}
|
22
|
-
|
22
|
+
},
|
23
|
+
borderedBoxStyles: {
|
23
24
|
'&::after': {
|
24
25
|
bg: 'decorative.7'
|
25
26
|
},
|
26
27
|
borderWidth: 1,
|
27
28
|
borderStyle: 'solid',
|
28
29
|
borderColor: 'neutral.80',
|
29
|
-
borderRadius: '4px'
|
30
|
-
|
30
|
+
borderRadius: '4px',
|
31
|
+
padding: 'sm',
|
32
|
+
width: '100%'
|
33
|
+
},
|
34
|
+
allConditionsBox: {
|
35
|
+
'&::after': {
|
36
|
+
bg: 'decorative.7'
|
37
|
+
},
|
38
|
+
alignItems: 'center',
|
39
|
+
borderRadius: '4px',
|
40
|
+
marginTop: 'md'
|
41
|
+
},
|
42
|
+
defaultText: {
|
43
|
+
textTransform: 'none',
|
44
|
+
color: 'inherit'
|
45
|
+
}
|
46
|
+
};
|
47
|
+
export var Default = function Default() {
|
31
48
|
var allConditions = [{
|
32
49
|
field1: 'Family Name',
|
33
50
|
field3: 'John',
|
@@ -100,8 +117,7 @@ export var Default = function Default() {
|
|
100
117
|
}, ___EmotionJSX(Chip, {
|
101
118
|
label: "All",
|
102
119
|
bg: "decorative.7",
|
103
|
-
|
104
|
-
sx: customChipStyles
|
120
|
+
sx: sx.customChipStyles
|
105
121
|
}), ___EmotionJSX(Text, null, " of the conditions are true")), _mapInstanceProperty(allConditions).call(allConditions, function (item) {
|
106
122
|
return ___EmotionJSX(Box, {
|
107
123
|
isRow: true,
|
@@ -113,14 +129,7 @@ export var Default = function Default() {
|
|
113
129
|
variant: "forms.input.container",
|
114
130
|
bg: "white",
|
115
131
|
isRow: true,
|
116
|
-
|
117
|
-
borderRadius: "4px",
|
118
|
-
sx: {
|
119
|
-
'&::after': {
|
120
|
-
bg: 'decorative.7'
|
121
|
-
}
|
122
|
-
},
|
123
|
-
mt: "15px"
|
132
|
+
sx: sx.allConditionsBox
|
124
133
|
}, ___EmotionJSX(Text, {
|
125
134
|
pl: "md",
|
126
135
|
pr: "sm"
|
@@ -128,8 +137,7 @@ export var Default = function Default() {
|
|
128
137
|
label: "Equals",
|
129
138
|
bg: "accent.90",
|
130
139
|
textColor: "neutral.10",
|
131
|
-
sx: customChipStyles,
|
132
|
-
mr: "sm",
|
140
|
+
sx: sx.customChipStyles,
|
133
141
|
alignSelf: "center"
|
134
142
|
}), ___EmotionJSX(Text, null, item.field3))));
|
135
143
|
}), ___EmotionJSX(Box, {
|
@@ -138,18 +146,14 @@ export var Default = function Default() {
|
|
138
146
|
isLast: true
|
139
147
|
}), ___EmotionJSX(Box, {
|
140
148
|
variant: "forms.input.container",
|
141
|
-
borderRadius: "4px",
|
142
|
-
p: "sm",
|
143
149
|
mt: "md",
|
144
|
-
sx: borderedBoxStyles
|
145
|
-
width: "100%"
|
150
|
+
sx: sx.borderedBoxStyles
|
146
151
|
}, ___EmotionJSX(Box, {
|
147
152
|
isRow: true
|
148
153
|
}, ___EmotionJSX(Chip, {
|
149
154
|
label: "Any",
|
150
155
|
bg: "decorative.4",
|
151
|
-
|
152
|
-
sx: customChipStyles,
|
156
|
+
sx: sx.customChipStyles,
|
153
157
|
alignSelf: "center"
|
154
158
|
}), ___EmotionJSX(Text, null, " of the conditions are true")), ___EmotionJSX(Box, {
|
155
159
|
ml: "sm"
|
@@ -164,14 +168,8 @@ export var Default = function Default() {
|
|
164
168
|
variant: "forms.input.container",
|
165
169
|
bg: "white",
|
166
170
|
isRow: true,
|
167
|
-
alignItems: "center",
|
168
|
-
borderRadius: "4px",
|
169
171
|
width: "100%",
|
170
|
-
sx:
|
171
|
-
'&::after': {
|
172
|
-
bg: 'decorative.4'
|
173
|
-
}
|
174
|
-
}
|
172
|
+
sx: sx.allConditionsBox
|
175
173
|
}, ___EmotionJSX(Text, {
|
176
174
|
pl: "md",
|
177
175
|
pr: "sm"
|
@@ -179,8 +177,7 @@ export var Default = function Default() {
|
|
179
177
|
label: "Equals",
|
180
178
|
bg: "accent.90",
|
181
179
|
textColor: "neutral.10",
|
182
|
-
sx: customChipStyles,
|
183
|
-
mr: "sm",
|
180
|
+
sx: sx.customChipStyles,
|
184
181
|
alignSelf: "center"
|
185
182
|
}), ___EmotionJSX(Text, null, item.field3)));
|
186
183
|
})))))), ___EmotionJSX(Button, {
|
@@ -213,10 +210,7 @@ export var Default = function Default() {
|
|
213
210
|
},
|
214
211
|
"aria-label": "temp-label"
|
215
212
|
}, ___EmotionJSX(Text, {
|
216
|
-
sx:
|
217
|
-
textTransform: 'none',
|
218
|
-
color: 'inherit'
|
219
|
-
}
|
213
|
+
sx: sx.defaultText
|
220
214
|
}, "Any")), ___EmotionJSX(RockerButton, {
|
221
215
|
name: "all",
|
222
216
|
key: "all",
|
@@ -225,10 +219,7 @@ export var Default = function Default() {
|
|
225
219
|
},
|
226
220
|
"aria-label": "temp-label"
|
227
221
|
}, ___EmotionJSX(Text, {
|
228
|
-
sx:
|
229
|
-
textTransform: 'none',
|
230
|
-
color: 'inherit'
|
231
|
-
}
|
222
|
+
sx: sx.defaultText
|
232
223
|
}, "All"))), ___EmotionJSX(Text, null, " of the conditions are true"), ___EmotionJSX(Button, {
|
233
224
|
variant: "inline",
|
234
225
|
width: "fit-content",
|
@@ -288,11 +279,7 @@ export var Default = function Default() {
|
|
288
279
|
mr: "sm"
|
289
280
|
}), ___EmotionJSX(Box, {
|
290
281
|
variant: "forms.input.container",
|
291
|
-
|
292
|
-
p: "sm",
|
293
|
-
width: "100%",
|
294
|
-
sx: borderedBoxStyles,
|
295
|
-
mr: "xs"
|
282
|
+
sx: sx.borderedBoxStyles
|
296
283
|
}, ___EmotionJSX(Box, {
|
297
284
|
isRow: true,
|
298
285
|
alignItems: "center",
|
@@ -308,10 +295,7 @@ export var Default = function Default() {
|
|
308
295
|
},
|
309
296
|
"aria-label": "any"
|
310
297
|
}, ___EmotionJSX(Text, {
|
311
|
-
sx:
|
312
|
-
textTransform: 'none',
|
313
|
-
color: 'inherit'
|
314
|
-
}
|
298
|
+
sx: sx.defaultText
|
315
299
|
}, "Any")), ___EmotionJSX(RockerButton, {
|
316
300
|
name: "all",
|
317
301
|
key: "all",
|
@@ -320,10 +304,7 @@ export var Default = function Default() {
|
|
320
304
|
},
|
321
305
|
"aria-label": "all"
|
322
306
|
}, ___EmotionJSX(Text, {
|
323
|
-
sx:
|
324
|
-
textTransform: 'none',
|
325
|
-
color: 'inherit'
|
326
|
-
}
|
307
|
+
sx: sx.defaultText
|
327
308
|
}, "All"))), ___EmotionJSX(Text, null, " of the conditions are true"), ___EmotionJSX(Button, {
|
328
309
|
variant: "inline",
|
329
310
|
width: "fit-content",
|
@@ -153,7 +153,7 @@ var selectedItemChip = _objectSpread(_objectSpread({}, multivaluesChip), {}, {
|
|
153
153
|
});
|
154
154
|
|
155
155
|
var readOnlyChip = _objectSpread(_objectSpread({}, multivaluesChip), {}, {
|
156
|
-
p:
|
156
|
+
p: 2.54,
|
157
157
|
border: '1px solid',
|
158
158
|
borderColor: 'neutral.80'
|
159
159
|
});
|