@pingux/astro 1.37.2 → 1.38.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/CHANGELOG.md +0 -12
- package/lib/cjs/components/Chip/Chip.js +11 -2
- package/lib/cjs/components/Chip/Chip.stories.js +51 -2
- package/lib/cjs/components/Chip/Chip.test.js +17 -0
- package/lib/cjs/components/MultivaluesField/MultivaluesField.js +23 -17
- package/lib/cjs/components/MultivaluesField/MultivaluesField.stories.js +236 -65
- package/lib/cjs/styles/variants/boxes.js +17 -1
- package/lib/cjs/styles/variants/buttons.js +26 -3
- package/lib/components/Chip/Chip.js +11 -2
- package/lib/components/Chip/Chip.stories.js +47 -0
- package/lib/components/Chip/Chip.test.js +15 -0
- package/lib/components/MultivaluesField/MultivaluesField.js +22 -17
- package/lib/components/MultivaluesField/MultivaluesField.stories.js +224 -56
- package/lib/styles/variants/boxes.js +17 -1
- package/lib/styles/variants/buttons.js +26 -3
- package/package.json +1 -1
- package/NOTICE.html +0 -4665
@@ -193,7 +193,10 @@ var multivaluesChip = _objectSpread(_objectSpread({}, chip), {}, {
|
|
193
193
|
cursor: 'default',
|
194
194
|
m: 5,
|
195
195
|
mr: 10,
|
196
|
-
ml: 0
|
196
|
+
ml: 0,
|
197
|
+
'& span': {
|
198
|
+
mr: '2px'
|
199
|
+
}
|
197
200
|
});
|
198
201
|
|
199
202
|
var selectedItemChip = _objectSpread(_objectSpread({}, multivaluesChip), {}, {
|
@@ -208,6 +211,18 @@ var readOnlyChip = _objectSpread(_objectSpread({}, multivaluesChip), {}, {
|
|
208
211
|
borderColor: 'neutral.80'
|
209
212
|
});
|
210
213
|
|
214
|
+
var itemChipWithSlot = _objectSpread(_objectSpread({}, readOnlyChip), {}, {
|
215
|
+
p: 3,
|
216
|
+
my: 0,
|
217
|
+
backgroundColor: 'white',
|
218
|
+
'& span': {
|
219
|
+
color: 'text.primary',
|
220
|
+
mr: '2px',
|
221
|
+
lineHeight: '16px'
|
222
|
+
},
|
223
|
+
maxHeight: '22px'
|
224
|
+
});
|
225
|
+
|
211
226
|
var inputInContainerSlot = {
|
212
227
|
position: 'absolute',
|
213
228
|
bg: 'transparent',
|
@@ -406,6 +421,7 @@ var _default = {
|
|
406
421
|
environmentChip: environmentChip,
|
407
422
|
expandableRow: expandableRow,
|
408
423
|
inputInContainerSlot: inputInContainerSlot,
|
424
|
+
itemChipWithSlot: itemChipWithSlot,
|
409
425
|
textFieldInContainerSlot: textFieldInContainerSlot,
|
410
426
|
fileInputFieldWrapper: fileInputFieldWrapper,
|
411
427
|
listItem: listItem,
|
@@ -435,13 +435,16 @@ var quiet = {
|
|
435
435
|
all: 'unset',
|
436
436
|
display: 'flex'
|
437
437
|
};
|
438
|
-
var
|
438
|
+
var chipDeleteStandard = {
|
439
439
|
borderRadius: '50%',
|
440
440
|
cursor: 'pointer',
|
441
441
|
height: 14,
|
442
|
-
mx: '3px !important',
|
443
442
|
p: 0,
|
444
443
|
width: 14,
|
444
|
+
mx: '3px !important'
|
445
|
+
};
|
446
|
+
|
447
|
+
var chipDeleteButton = _objectSpread(_objectSpread({}, chipDeleteStandard), {}, {
|
445
448
|
'&.is-focused, &.is-hovered': _objectSpread({
|
446
449
|
bg: 'accent.40'
|
447
450
|
}, focusWithCroppedOutline),
|
@@ -449,7 +452,26 @@ var chipDeleteButton = {
|
|
449
452
|
bg: 'accent.20',
|
450
453
|
borderColor: 'accent.20'
|
451
454
|
}
|
452
|
-
};
|
455
|
+
});
|
456
|
+
|
457
|
+
var chipWithSlotDeleteButton = _objectSpread(_objectSpread({}, chipDeleteStandard), {}, {
|
458
|
+
path: {
|
459
|
+
fill: 'neutral.40'
|
460
|
+
},
|
461
|
+
'&.is-focused': _objectSpread({}, defaultFocus),
|
462
|
+
'&.is-hovered': {
|
463
|
+
backgroundColor: '#e5e9f8 !important',
|
464
|
+
path: {
|
465
|
+
fill: 'neutral.40'
|
466
|
+
}
|
467
|
+
},
|
468
|
+
'&.is-pressed': {
|
469
|
+
'path': {
|
470
|
+
fill: 'white'
|
471
|
+
},
|
472
|
+
bg: '#4462ED !important'
|
473
|
+
}
|
474
|
+
});
|
453
475
|
|
454
476
|
var rocker = _objectSpread(_objectSpread({}, base), {}, {
|
455
477
|
border: '0',
|
@@ -741,6 +763,7 @@ var navBarSectionButton = _objectSpread(_objectSpread({}, quiet), {}, {
|
|
741
763
|
var _default = {
|
742
764
|
accordionHeader: accordionHeader,
|
743
765
|
chipDeleteButton: chipDeleteButton,
|
766
|
+
chipWithSlotDeleteButton: chipWithSlotDeleteButton,
|
744
767
|
close: close,
|
745
768
|
colorField: colorField,
|
746
769
|
comboBox: comboBox,
|
@@ -33,7 +33,8 @@ var Chip = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
33
33
|
textProps = props.textProps,
|
34
34
|
label = props.label,
|
35
35
|
align = props.align,
|
36
|
-
isUppercase = props.isUppercase
|
36
|
+
isUppercase = props.isUppercase,
|
37
|
+
slots = props.slots;
|
37
38
|
|
38
39
|
var sx = _objectSpread({}, isUppercase && {
|
39
40
|
paddingBottom: '3px'
|
@@ -53,7 +54,9 @@ var Chip = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
53
54
|
variant: "boxes.chip",
|
54
55
|
sx: sx,
|
55
56
|
ref: ref
|
56
|
-
}, props), ___EmotionJSX(
|
57
|
+
}, props), (slots === null || slots === void 0 ? void 0 : slots.leftIcon) && ___EmotionJSX(Box, {
|
58
|
+
mr: "xs"
|
59
|
+
}, slots.leftIcon), ___EmotionJSX(Text, _extends({
|
57
60
|
variant: "label",
|
58
61
|
color: textColor,
|
59
62
|
sx: isUppercase && {
|
@@ -69,6 +72,12 @@ Chip.propTypes = {
|
|
69
72
|
/** The background color of the chip. */
|
70
73
|
bg: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
71
74
|
|
75
|
+
/** Provides a way to insert markup in specified places. */
|
76
|
+
slots: PropTypes.shape({
|
77
|
+
/** The given node will be inserted into left side of the chip. */
|
78
|
+
leftIcon: PropTypes.node
|
79
|
+
}),
|
80
|
+
|
72
81
|
/** The label of the chip. */
|
73
82
|
label: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
74
83
|
|
@@ -53,6 +53,34 @@ export default {
|
|
53
53
|
}
|
54
54
|
}
|
55
55
|
};
|
56
|
+
|
57
|
+
var VariableIcon = function VariableIcon(props) {
|
58
|
+
return ___EmotionJSX("svg", _extends({
|
59
|
+
width: "16",
|
60
|
+
height: "16",
|
61
|
+
viewBox: "0 0 16 16",
|
62
|
+
fill: "none",
|
63
|
+
xmlns: "http://www.w3.org/2000/svg"
|
64
|
+
}, props), ___EmotionJSX("g", {
|
65
|
+
clipPath: "url(#clip0_709_18965)"
|
66
|
+
}, ___EmotionJSX("circle", {
|
67
|
+
cx: "8",
|
68
|
+
cy: "8",
|
69
|
+
r: "7.5",
|
70
|
+
fill: "white",
|
71
|
+
stroke: "#7AC7F2"
|
72
|
+
}), ___EmotionJSX("path", {
|
73
|
+
d: "M11.5042 4.25C12.0833 5.37917 12.3125 6.68333 12.1667 8C12.0833 9.31667 11.625 10.6208 10.8458 11.75L10.2083 11.3333C10.8792 10.3208 11.2708 9.16667 11.3333 8C11.475 6.83333 11.2875 5.67917 10.7917 4.66667L11.5042 4.25ZM5.15416 4.25L5.79166 4.66667C5.12083 5.67917 4.72916 6.83333 4.66666 8C4.525 9.16667 4.71666 10.3208 5.20833 11.3333L4.50416 11.75C3.92083 10.6208 3.6875 9.32083 3.83333 8C3.91666 6.68333 4.375 5.37917 5.15416 4.25ZM8.03333 7.45L9 6.10417H10.0542L8.47916 8.1875L9.39583 10.2375H8.45416L7.87916 8.83333L6.86666 10.2208H5.81666L7.44166 8.0875L6.55416 6.10417H7.5L8.03333 7.45Z",
|
74
|
+
fill: "#7AC7F2"
|
75
|
+
})), ___EmotionJSX("defs", null, ___EmotionJSX("clipPath", {
|
76
|
+
id: "clip0_709_18965"
|
77
|
+
}, ___EmotionJSX("rect", {
|
78
|
+
width: "16",
|
79
|
+
height: "16",
|
80
|
+
fill: "white"
|
81
|
+
}))));
|
82
|
+
};
|
83
|
+
|
56
84
|
export var Default = function Default(_ref5) {
|
57
85
|
var args = _extends({}, _ref5);
|
58
86
|
|
@@ -121,4 +149,23 @@ export var ChipWithIcon = function ChipWithIcon() {
|
|
121
149
|
"aria-hidden": "true",
|
122
150
|
focusable: "false"
|
123
151
|
})));
|
152
|
+
};
|
153
|
+
export var ChipWithLeftSlotAndIcon = function ChipWithLeftSlotAndIcon() {
|
154
|
+
return ___EmotionJSX(Chip, {
|
155
|
+
label: "Chip with Icon Button and Left Slot",
|
156
|
+
bg: "white",
|
157
|
+
variant: "boxes.itemChipWithSlot",
|
158
|
+
slots: {
|
159
|
+
leftIcon: ___EmotionJSX(Icon, {
|
160
|
+
icon: VariableIcon,
|
161
|
+
size: 16
|
162
|
+
})
|
163
|
+
}
|
164
|
+
}, ___EmotionJSX(IconButton, {
|
165
|
+
"aria-label": "delete",
|
166
|
+
variant: "buttons.chipWithSlotDeleteButton"
|
167
|
+
}, ___EmotionJSX(Icon, {
|
168
|
+
icon: Clear,
|
169
|
+
size: 14
|
170
|
+
})));
|
124
171
|
};
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import React from 'react';
|
3
3
|
import { render, screen } from '@testing-library/react';
|
4
|
+
import Earth from 'mdi-react/EarthIcon';
|
4
5
|
import Chip from '../Chip/Chip';
|
5
6
|
import Button from '../Button/Button';
|
7
|
+
import Icon from '../Icon/Icon';
|
6
8
|
import axeTest from '../../utils/testUtils/testAxe';
|
7
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
10
|
var testId = 'test-separator';
|
@@ -48,4 +50,17 @@ test('renders Chip component with custom alignment', function () {
|
|
48
50
|
});
|
49
51
|
expect(screen.getByTestId(testId)).toHaveStyleRule('position', 'absolute');
|
50
52
|
expect(screen.getByTestId(testId)).toHaveStyleRule('right', '15px');
|
53
|
+
});
|
54
|
+
test('renders Chip component with left slot', function () {
|
55
|
+
var slots = {
|
56
|
+
leftIcon: ___EmotionJSX(Icon, {
|
57
|
+
icon: Earth,
|
58
|
+
size: 14,
|
59
|
+
"data-testid": "iconId"
|
60
|
+
})
|
61
|
+
};
|
62
|
+
getComponent({
|
63
|
+
slots: slots
|
64
|
+
});
|
65
|
+
expect(screen.getByTestId('iconId')).toBeInTheDocument();
|
51
66
|
});
|
@@ -364,6 +364,27 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
364
364
|
return null;
|
365
365
|
}));
|
366
366
|
|
367
|
+
var multivaluesFieldChip = function multivaluesFieldChip(item) {
|
368
|
+
return ___EmotionJSX(Chip, _extends({
|
369
|
+
key: item.key,
|
370
|
+
role: "presentation",
|
371
|
+
variant: "boxes.selectedItemChip",
|
372
|
+
bg: "active",
|
373
|
+
label: item.name,
|
374
|
+
slots: item.slots
|
375
|
+
}, item.chipProps), ___EmotionJSX(IconButton, _extends({
|
376
|
+
"aria-label": "delete",
|
377
|
+
onPress: function onPress() {
|
378
|
+
return deleteItem(item.key);
|
379
|
+
},
|
380
|
+
variant: "buttons.chipDeleteButton"
|
381
|
+
}, item.buttonProps), ___EmotionJSX(Icon, {
|
382
|
+
icon: Clear,
|
383
|
+
color: "white",
|
384
|
+
size: 14
|
385
|
+
})));
|
386
|
+
};
|
387
|
+
|
367
388
|
var selectedItems = ___EmotionJSX(React.Fragment, null, _mapInstanceProperty(_context7 = _Array$from(selectionManager.selectedKeys)).call(_context7, function (key) {
|
368
389
|
var _context8, _context9;
|
369
390
|
|
@@ -372,23 +393,7 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
372
393
|
});
|
373
394
|
|
374
395
|
if (item) {
|
375
|
-
return
|
376
|
-
key: item.key,
|
377
|
-
role: "presentation",
|
378
|
-
variant: "boxes.selectedItemChip",
|
379
|
-
bg: "active",
|
380
|
-
label: item.name
|
381
|
-
}, ___EmotionJSX(IconButton, {
|
382
|
-
"aria-label": "delete",
|
383
|
-
onPress: function onPress() {
|
384
|
-
return deleteItem(item.key);
|
385
|
-
},
|
386
|
-
variant: "buttons.chipDeleteButton"
|
387
|
-
}, ___EmotionJSX(Icon, {
|
388
|
-
icon: Clear,
|
389
|
-
color: "white",
|
390
|
-
size: 14
|
391
|
-
})));
|
396
|
+
return multivaluesFieldChip(item);
|
392
397
|
}
|
393
398
|
|
394
399
|
return null;
|