@pingux/astro 1.37.2-alpha.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/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
@@ -66,7 +66,8 @@ var Chip = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
66
66
|
textProps = props.textProps,
|
67
67
|
label = props.label,
|
68
68
|
align = props.align,
|
69
|
-
isUppercase = props.isUppercase
|
69
|
+
isUppercase = props.isUppercase,
|
70
|
+
slots = props.slots;
|
70
71
|
|
71
72
|
var sx = _objectSpread({}, isUppercase && {
|
72
73
|
paddingBottom: '3px'
|
@@ -86,7 +87,9 @@ var Chip = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
86
87
|
variant: "boxes.chip",
|
87
88
|
sx: sx,
|
88
89
|
ref: ref
|
89
|
-
}, props), (0, _react2.jsx)(
|
90
|
+
}, props), (slots === null || slots === void 0 ? void 0 : slots.leftIcon) && (0, _react2.jsx)(_Box["default"], {
|
91
|
+
mr: "xs"
|
92
|
+
}, slots.leftIcon), (0, _react2.jsx)(_Text["default"], (0, _extends2["default"])({
|
90
93
|
variant: "label",
|
91
94
|
color: textColor,
|
92
95
|
sx: isUppercase && {
|
@@ -103,6 +106,12 @@ Chip.propTypes = {
|
|
103
106
|
/** The background color of the chip. */
|
104
107
|
bg: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]),
|
105
108
|
|
109
|
+
/** Provides a way to insert markup in specified places. */
|
110
|
+
slots: _propTypes["default"].shape({
|
111
|
+
/** The given node will be inserted into left side of the chip. */
|
112
|
+
leftIcon: _propTypes["default"].node
|
113
|
+
}),
|
114
|
+
|
106
115
|
/** The label of the chip. */
|
107
116
|
label: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]),
|
108
117
|
|
@@ -8,7 +8,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
9
9
|
});
|
10
10
|
|
11
|
-
exports["default"] = exports.Default = exports.CountChip = exports.ChipWithIcon = exports.ChipWithCustomColors = void 0;
|
11
|
+
exports["default"] = exports.Default = exports.CountChip = exports.ChipWithLeftSlotAndIcon = exports.ChipWithIcon = exports.ChipWithCustomColors = void 0;
|
12
12
|
|
13
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
14
14
|
|
@@ -80,6 +80,33 @@ var _default = {
|
|
80
80
|
};
|
81
81
|
exports["default"] = _default;
|
82
82
|
|
83
|
+
var VariableIcon = function VariableIcon(props) {
|
84
|
+
return (0, _react2.jsx)("svg", (0, _extends2["default"])({
|
85
|
+
width: "16",
|
86
|
+
height: "16",
|
87
|
+
viewBox: "0 0 16 16",
|
88
|
+
fill: "none",
|
89
|
+
xmlns: "http://www.w3.org/2000/svg"
|
90
|
+
}, props), (0, _react2.jsx)("g", {
|
91
|
+
clipPath: "url(#clip0_709_18965)"
|
92
|
+
}, (0, _react2.jsx)("circle", {
|
93
|
+
cx: "8",
|
94
|
+
cy: "8",
|
95
|
+
r: "7.5",
|
96
|
+
fill: "white",
|
97
|
+
stroke: "#7AC7F2"
|
98
|
+
}), (0, _react2.jsx)("path", {
|
99
|
+
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",
|
100
|
+
fill: "#7AC7F2"
|
101
|
+
})), (0, _react2.jsx)("defs", null, (0, _react2.jsx)("clipPath", {
|
102
|
+
id: "clip0_709_18965"
|
103
|
+
}, (0, _react2.jsx)("rect", {
|
104
|
+
width: "16",
|
105
|
+
height: "16",
|
106
|
+
fill: "white"
|
107
|
+
}))));
|
108
|
+
};
|
109
|
+
|
83
110
|
var Default = function Default(_ref5) {
|
84
111
|
var args = (0, _extends2["default"])({}, _ref5);
|
85
112
|
return (0, _react2.jsx)(_Chip["default"], (0, _extends2["default"])({
|
@@ -157,4 +184,26 @@ var ChipWithIcon = function ChipWithIcon() {
|
|
157
184
|
})));
|
158
185
|
};
|
159
186
|
|
160
|
-
exports.ChipWithIcon = ChipWithIcon;
|
187
|
+
exports.ChipWithIcon = ChipWithIcon;
|
188
|
+
|
189
|
+
var ChipWithLeftSlotAndIcon = function ChipWithLeftSlotAndIcon() {
|
190
|
+
return (0, _react2.jsx)(_Chip["default"], {
|
191
|
+
label: "Chip with Icon Button and Left Slot",
|
192
|
+
bg: "white",
|
193
|
+
variant: "boxes.itemChipWithSlot",
|
194
|
+
slots: {
|
195
|
+
leftIcon: (0, _react2.jsx)(_Icon["default"], {
|
196
|
+
icon: VariableIcon,
|
197
|
+
size: 16
|
198
|
+
})
|
199
|
+
}
|
200
|
+
}, (0, _react2.jsx)(_IconButton["default"], {
|
201
|
+
"aria-label": "delete",
|
202
|
+
variant: "buttons.chipWithSlotDeleteButton"
|
203
|
+
}, (0, _react2.jsx)(_Icon["default"], {
|
204
|
+
icon: _CloseIcon["default"],
|
205
|
+
size: 14
|
206
|
+
})));
|
207
|
+
};
|
208
|
+
|
209
|
+
exports.ChipWithLeftSlotAndIcon = ChipWithLeftSlotAndIcon;
|
@@ -8,10 +8,14 @@ var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
|
9
9
|
var _react2 = require("@testing-library/react");
|
10
10
|
|
11
|
+
var _EarthIcon = _interopRequireDefault(require("mdi-react/EarthIcon"));
|
12
|
+
|
11
13
|
var _Chip = _interopRequireDefault(require("../Chip/Chip"));
|
12
14
|
|
13
15
|
var _Button = _interopRequireDefault(require("../Button/Button"));
|
14
16
|
|
17
|
+
var _Icon = _interopRequireDefault(require("../Icon/Icon"));
|
18
|
+
|
15
19
|
var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
|
16
20
|
|
17
21
|
var _react3 = require("@emotion/react");
|
@@ -62,4 +66,17 @@ test('renders Chip component with custom alignment', function () {
|
|
62
66
|
});
|
63
67
|
expect(_react2.screen.getByTestId(testId)).toHaveStyleRule('position', 'absolute');
|
64
68
|
expect(_react2.screen.getByTestId(testId)).toHaveStyleRule('right', '15px');
|
69
|
+
});
|
70
|
+
test('renders Chip component with left slot', function () {
|
71
|
+
var slots = {
|
72
|
+
leftIcon: (0, _react3.jsx)(_Icon["default"], {
|
73
|
+
icon: _EarthIcon["default"],
|
74
|
+
size: 14,
|
75
|
+
"data-testid": "iconId"
|
76
|
+
})
|
77
|
+
};
|
78
|
+
getComponent({
|
79
|
+
slots: slots
|
80
|
+
});
|
81
|
+
expect(_react2.screen.getByTestId('iconId')).toBeInTheDocument();
|
65
82
|
});
|
@@ -414,6 +414,28 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
414
414
|
|
415
415
|
return null;
|
416
416
|
}));
|
417
|
+
|
418
|
+
var multivaluesFieldChip = function multivaluesFieldChip(item) {
|
419
|
+
return (0, _react2.jsx)(_.Chip, (0, _extends2["default"])({
|
420
|
+
key: item.key,
|
421
|
+
role: "presentation",
|
422
|
+
variant: "boxes.selectedItemChip",
|
423
|
+
bg: "active",
|
424
|
+
label: item.name,
|
425
|
+
slots: item.slots
|
426
|
+
}, item.chipProps), (0, _react2.jsx)(_.IconButton, (0, _extends2["default"])({
|
427
|
+
"aria-label": "delete",
|
428
|
+
onPress: function onPress() {
|
429
|
+
return deleteItem(item.key);
|
430
|
+
},
|
431
|
+
variant: "buttons.chipDeleteButton"
|
432
|
+
}, item.buttonProps), (0, _react2.jsx)(_.Icon, {
|
433
|
+
icon: _CloseIcon["default"],
|
434
|
+
color: "white",
|
435
|
+
size: 14
|
436
|
+
})));
|
437
|
+
};
|
438
|
+
|
417
439
|
var selectedItems = (0, _react2.jsx)(_react["default"].Fragment, null, (0, _map["default"])(_context7 = (0, _from["default"])(selectionManager.selectedKeys)).call(_context7, function (key) {
|
418
440
|
var _context8, _context9;
|
419
441
|
|
@@ -422,23 +444,7 @@ var MultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
422
444
|
});
|
423
445
|
|
424
446
|
if (item) {
|
425
|
-
return (
|
426
|
-
key: item.key,
|
427
|
-
role: "presentation",
|
428
|
-
variant: "boxes.selectedItemChip",
|
429
|
-
bg: "active",
|
430
|
-
label: item.name
|
431
|
-
}, (0, _react2.jsx)(_.IconButton, {
|
432
|
-
"aria-label": "delete",
|
433
|
-
onPress: function onPress() {
|
434
|
-
return deleteItem(item.key);
|
435
|
-
},
|
436
|
-
variant: "buttons.chipDeleteButton"
|
437
|
-
}, (0, _react2.jsx)(_.Icon, {
|
438
|
-
icon: _CloseIcon["default"],
|
439
|
-
color: "white",
|
440
|
-
size: 14
|
441
|
-
})));
|
447
|
+
return multivaluesFieldChip(item);
|
442
448
|
}
|
443
449
|
|
444
450
|
return null;
|
@@ -26,12 +26,12 @@ _Object$defineProperty(exports, "__esModule", {
|
|
26
26
|
value: true
|
27
27
|
});
|
28
28
|
|
29
|
-
exports["default"] = exports.
|
30
|
-
|
31
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
29
|
+
exports["default"] = exports.Uncontrolled = exports.ReadOnlyValues = exports.ReadOnlyField = exports.IconSlotsInChip = exports.Error = exports.DisabledKeys = exports.Default = exports.CustomValues = exports.CustomSize = exports.Controlled = void 0;
|
32
30
|
|
33
31
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
34
32
|
|
33
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
34
|
+
|
35
35
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
36
36
|
|
37
37
|
var _react = _interopRequireWildcard(require("react"));
|
@@ -124,6 +124,96 @@ var _default = {
|
|
124
124
|
}
|
125
125
|
};
|
126
126
|
exports["default"] = _default;
|
127
|
+
|
128
|
+
var VariableIcon = function VariableIcon(props) {
|
129
|
+
return (0, _react2.jsx)("svg", (0, _extends2["default"])({
|
130
|
+
width: "16",
|
131
|
+
height: "16",
|
132
|
+
viewBox: "0 0 16 16",
|
133
|
+
fill: "none",
|
134
|
+
xmlns: "http://www.w3.org/2000/svg"
|
135
|
+
}, props), (0, _react2.jsx)("g", {
|
136
|
+
clipPath: "url(#clip0_709_18965)"
|
137
|
+
}, (0, _react2.jsx)("circle", {
|
138
|
+
cx: "8",
|
139
|
+
cy: "8",
|
140
|
+
r: "7.5",
|
141
|
+
fill: "white",
|
142
|
+
stroke: "#7AC7F2"
|
143
|
+
}), (0, _react2.jsx)("path", {
|
144
|
+
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",
|
145
|
+
fill: "#7AC7F2"
|
146
|
+
})), (0, _react2.jsx)("defs", null, (0, _react2.jsx)("clipPath", {
|
147
|
+
id: "clip0_709_18965"
|
148
|
+
}, (0, _react2.jsx)("rect", {
|
149
|
+
width: "16",
|
150
|
+
height: "16",
|
151
|
+
fill: "white"
|
152
|
+
}))));
|
153
|
+
};
|
154
|
+
|
155
|
+
var HTMLIcon = function HTMLIcon(props) {
|
156
|
+
return (0, _react2.jsx)("svg", (0, _extends2["default"])({
|
157
|
+
width: "16",
|
158
|
+
height: "16",
|
159
|
+
viewBox: "0 0 16 16",
|
160
|
+
fill: "none",
|
161
|
+
xmlns: "http://www.w3.org/2000/svg"
|
162
|
+
}, props), (0, _react2.jsx)("g", {
|
163
|
+
clipPath: "url(#clip0_709_18936)"
|
164
|
+
}, (0, _react2.jsx)("circle", {
|
165
|
+
cx: "8",
|
166
|
+
cy: "8",
|
167
|
+
r: "7.5",
|
168
|
+
fill: "white",
|
169
|
+
stroke: "#2E5EA6"
|
170
|
+
}), (0, _react2.jsx)("g", {
|
171
|
+
clipPath: "url(#clip1_709_18936)"
|
172
|
+
}, (0, _react2.jsx)("path", {
|
173
|
+
d: "M9.81667 8.83325C9.85 8.55825 9.875 8.28325 9.875 7.99992C9.875 7.71659 9.85 7.44159 9.81667 7.16659H11.225C11.2917 7.43325 11.3333 7.71242 11.3333 7.99992C11.3333 8.28742 11.2917 8.56659 11.225 8.83325H9.81667ZM9.07917 11.1499C9.32917 10.6874 9.52084 10.1874 9.65417 9.66659H10.8833C10.4833 10.3541 9.84584 10.8874 9.07917 11.1499ZM8.975 8.83325H7.025C6.98334 8.55825 6.95834 8.28325 6.95834 7.99992C6.95834 7.71659 6.98334 7.43742 7.025 7.16659H8.975C9.0125 7.43742 9.04167 7.71659 9.04167 7.99992C9.04167 8.28325 9.0125 8.55825 8.975 8.83325ZM8 11.3166C7.65417 10.8166 7.375 10.2624 7.20417 9.66659H8.79584C8.625 10.2624 8.34584 10.8166 8 11.3166ZM6.33334 6.33325H5.11667C5.5125 5.64159 6.15417 5.10825 6.91667 4.84992C6.66667 5.31242 6.47917 5.81242 6.33334 6.33325ZM5.11667 9.66659H6.33334C6.47917 10.1874 6.66667 10.6874 6.91667 11.1499C6.15417 10.8874 5.5125 10.3541 5.11667 9.66659ZM4.775 8.83325C4.70834 8.56659 4.66667 8.28742 4.66667 7.99992C4.66667 7.71242 4.70834 7.43325 4.775 7.16659H6.18334C6.15 7.44159 6.125 7.71659 6.125 7.99992C6.125 8.28325 6.15 8.55825 6.18334 8.83325H4.775ZM8 4.67909C8.34584 5.17909 8.625 5.73742 8.79584 6.33325H7.20417C7.375 5.73742 7.65417 5.17909 8 4.67909ZM10.8833 6.33325H9.65417C9.52084 5.81242 9.32917 5.31242 9.07917 4.84992C9.84584 5.11242 10.4833 5.64159 10.8833 6.33325ZM8 3.83325C5.69584 3.83325 3.83334 5.70825 3.83334 7.99992C3.83334 9.10499 4.27232 10.1648 5.05372 10.9462C5.44064 11.3331 5.89996 11.64 6.40549 11.8494C6.91101 12.0588 7.45283 12.1666 8 12.1666C9.10507 12.1666 10.1649 11.7276 10.9463 10.9462C11.7277 10.1648 12.1667 9.10499 12.1667 7.99992C12.1667 7.45274 12.0589 6.91093 11.8495 6.4054C11.6401 5.89988 11.3332 5.44055 10.9463 5.05364C10.5594 4.66673 10.1 4.35982 9.59452 4.15042C9.08899 3.94103 8.54718 3.83325 8 3.83325Z",
|
174
|
+
fill: "#4660A2"
|
175
|
+
}))), (0, _react2.jsx)("g", {
|
176
|
+
clipPath: "url(#clip2_709_18936)"
|
177
|
+
}, (0, _react2.jsx)("circle", {
|
178
|
+
cx: "8",
|
179
|
+
cy: "8",
|
180
|
+
r: "7.5",
|
181
|
+
fill: "white",
|
182
|
+
stroke: "#2E5EA6"
|
183
|
+
}), (0, _react2.jsx)("g", {
|
184
|
+
clipPath: "url(#clip3_709_18936)"
|
185
|
+
}, (0, _react2.jsx)("path", {
|
186
|
+
d: "M9.81667 8.83325C9.85 8.55825 9.875 8.28325 9.875 7.99992C9.875 7.71659 9.85 7.44159 9.81667 7.16659H11.225C11.2917 7.43325 11.3333 7.71242 11.3333 7.99992C11.3333 8.28742 11.2917 8.56659 11.225 8.83325H9.81667ZM9.07917 11.1499C9.32917 10.6874 9.52084 10.1874 9.65417 9.66659H10.8833C10.4833 10.3541 9.84584 10.8874 9.07917 11.1499ZM8.975 8.83325H7.025C6.98334 8.55825 6.95834 8.28325 6.95834 7.99992C6.95834 7.71659 6.98334 7.43742 7.025 7.16659H8.975C9.0125 7.43742 9.04167 7.71659 9.04167 7.99992C9.04167 8.28325 9.0125 8.55825 8.975 8.83325ZM8 11.3166C7.65417 10.8166 7.375 10.2624 7.20417 9.66659H8.79584C8.625 10.2624 8.34584 10.8166 8 11.3166ZM6.33334 6.33325H5.11667C5.5125 5.64159 6.15417 5.10825 6.91667 4.84992C6.66667 5.31242 6.47917 5.81242 6.33334 6.33325ZM5.11667 9.66659H6.33334C6.47917 10.1874 6.66667 10.6874 6.91667 11.1499C6.15417 10.8874 5.5125 10.3541 5.11667 9.66659ZM4.775 8.83325C4.70834 8.56659 4.66667 8.28742 4.66667 7.99992C4.66667 7.71242 4.70834 7.43325 4.775 7.16659H6.18334C6.15 7.44159 6.125 7.71659 6.125 7.99992C6.125 8.28325 6.15 8.55825 6.18334 8.83325H4.775ZM8 4.67909C8.34584 5.17909 8.625 5.73742 8.79584 6.33325H7.20417C7.375 5.73742 7.65417 5.17909 8 4.67909ZM10.8833 6.33325H9.65417C9.52084 5.81242 9.32917 5.31242 9.07917 4.84992C9.84584 5.11242 10.4833 5.64159 10.8833 6.33325ZM8 3.83325C5.69584 3.83325 3.83334 5.70825 3.83334 7.99992C3.83334 9.10499 4.27232 10.1648 5.05372 10.9462C5.44064 11.3331 5.89996 11.64 6.40549 11.8494C6.91101 12.0588 7.45283 12.1666 8 12.1666C9.10507 12.1666 10.1649 11.7276 10.9463 10.9462C11.7277 10.1648 12.1667 9.10499 12.1667 7.99992C12.1667 7.45274 12.0589 6.91093 11.8495 6.4054C11.6401 5.89988 11.3332 5.44055 10.9463 5.05364C10.5594 4.66673 10.1 4.35982 9.59452 4.15042C9.08899 3.94103 8.54718 3.83325 8 3.83325Z",
|
187
|
+
fill: "#4660A2"
|
188
|
+
}))), (0, _react2.jsx)("defs", null, (0, _react2.jsx)("clipPath", {
|
189
|
+
id: "clip0_709_18936"
|
190
|
+
}, (0, _react2.jsx)("rect", {
|
191
|
+
width: "16",
|
192
|
+
height: "16",
|
193
|
+
fill: "white"
|
194
|
+
})), (0, _react2.jsx)("clipPath", {
|
195
|
+
id: "clip1_709_18936"
|
196
|
+
}, (0, _react2.jsx)("rect", {
|
197
|
+
width: "10",
|
198
|
+
height: "10",
|
199
|
+
fill: "white",
|
200
|
+
transform: "translate(3 3)"
|
201
|
+
})), (0, _react2.jsx)("clipPath", {
|
202
|
+
id: "clip2_709_18936"
|
203
|
+
}, (0, _react2.jsx)("rect", {
|
204
|
+
width: "16",
|
205
|
+
height: "16",
|
206
|
+
fill: "white"
|
207
|
+
})), (0, _react2.jsx)("clipPath", {
|
208
|
+
id: "clip3_709_18936"
|
209
|
+
}, (0, _react2.jsx)("rect", {
|
210
|
+
width: "10",
|
211
|
+
height: "10",
|
212
|
+
fill: "white",
|
213
|
+
transform: "translate(3 3)"
|
214
|
+
}))));
|
215
|
+
};
|
216
|
+
|
127
217
|
var items = [{
|
128
218
|
id: 1,
|
129
219
|
name: 'Aardvark',
|
@@ -153,6 +243,58 @@ var items = [{
|
|
153
243
|
name: 'Shark',
|
154
244
|
key: 'Shark'
|
155
245
|
}];
|
246
|
+
var itemsWithSlots = [{
|
247
|
+
id: 1,
|
248
|
+
name: 'Aardvark',
|
249
|
+
key: 'Aardvark',
|
250
|
+
chipProps: {
|
251
|
+
variant: 'boxes.itemChipWithSlot',
|
252
|
+
bg: 'white'
|
253
|
+
},
|
254
|
+
buttonProps: {
|
255
|
+
variant: 'buttons.chipWithSlotDeleteButton'
|
256
|
+
},
|
257
|
+
slots: {
|
258
|
+
leftIcon: (0, _react2.jsx)(_.Icon, {
|
259
|
+
icon: VariableIcon,
|
260
|
+
size: 16
|
261
|
+
})
|
262
|
+
}
|
263
|
+
}, {
|
264
|
+
id: 2,
|
265
|
+
name: 'Kangaroo',
|
266
|
+
key: 'Kangaroo',
|
267
|
+
chipProps: {
|
268
|
+
variant: 'boxes.itemChipWithSlot',
|
269
|
+
bg: 'white'
|
270
|
+
},
|
271
|
+
buttonProps: {
|
272
|
+
variant: 'buttons.chipWithSlotDeleteButton'
|
273
|
+
},
|
274
|
+
slots: {
|
275
|
+
leftIcon: (0, _react2.jsx)(_.Icon, {
|
276
|
+
icon: HTMLIcon,
|
277
|
+
size: 16
|
278
|
+
})
|
279
|
+
}
|
280
|
+
}, {
|
281
|
+
id: 3,
|
282
|
+
name: 'Snake',
|
283
|
+
key: 'Snake',
|
284
|
+
chipProps: {
|
285
|
+
variant: 'boxes.itemChipWithSlot',
|
286
|
+
bg: 'white'
|
287
|
+
},
|
288
|
+
buttonProps: {
|
289
|
+
variant: 'buttons.chipWithSlotDeleteButton'
|
290
|
+
},
|
291
|
+
slots: {
|
292
|
+
leftIcon: (0, _react2.jsx)(_.Icon, {
|
293
|
+
icon: HTMLIcon,
|
294
|
+
size: 16
|
295
|
+
})
|
296
|
+
}
|
297
|
+
}];
|
156
298
|
|
157
299
|
var setOverlayStyle = function setOverlayStyle(direction, isOpen, mr, ml, mt) {
|
158
300
|
return {
|
@@ -191,7 +333,7 @@ var Default = function Default(args) {
|
|
191
333
|
|
192
334
|
exports.Default = Default;
|
193
335
|
|
194
|
-
var
|
336
|
+
var Uncontrolled = function Uncontrolled(args) {
|
195
337
|
var _useState3 = (0, _react.useState)(false),
|
196
338
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
197
339
|
isOpen = _useState4[0],
|
@@ -207,8 +349,8 @@ var WithCustomValues = function WithCustomValues(args) {
|
|
207
349
|
, {
|
208
350
|
style: setOverlayStyle(direction, isOpen, '50%', '50%', '20%')
|
209
351
|
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({
|
210
|
-
|
211
|
-
|
352
|
+
defaultSelectedKeys: ['Aardvark', 'Snake'],
|
353
|
+
items: items
|
212
354
|
}, args, {
|
213
355
|
onOpenChange: onOpenChange
|
214
356
|
}), function (item) {
|
@@ -219,18 +361,18 @@ var WithCustomValues = function WithCustomValues(args) {
|
|
219
361
|
}));
|
220
362
|
};
|
221
363
|
|
222
|
-
exports.
|
223
|
-
WithCustomValues.argTypes = {
|
224
|
-
mode: {
|
225
|
-
defaultValue: 'non-restrictive'
|
226
|
-
}
|
227
|
-
};
|
364
|
+
exports.Uncontrolled = Uncontrolled;
|
228
365
|
|
229
|
-
var
|
230
|
-
var _useState5 = (0, _react.useState)(
|
366
|
+
var Controlled = function Controlled(args) {
|
367
|
+
var _useState5 = (0, _react.useState)(['Aardvark', 'Snake']),
|
231
368
|
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
232
|
-
|
233
|
-
|
369
|
+
selectedKeys = _useState6[0],
|
370
|
+
setSelectedKeys = _useState6[1];
|
371
|
+
|
372
|
+
var _useState7 = (0, _react.useState)(false),
|
373
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
374
|
+
isOpen = _useState8[0],
|
375
|
+
setIsOpen = _useState8[1];
|
234
376
|
|
235
377
|
var direction = args.direction;
|
236
378
|
|
@@ -242,9 +384,11 @@ var WithDisabledKeys = function WithDisabledKeys(args) {
|
|
242
384
|
, {
|
243
385
|
style: setOverlayStyle(direction, isOpen, '50%', '50%', '20%')
|
244
386
|
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({
|
245
|
-
|
246
|
-
items: items
|
387
|
+
label: "Field Label"
|
247
388
|
}, args, {
|
389
|
+
items: items,
|
390
|
+
onSelectionChange: setSelectedKeys,
|
391
|
+
selectedKeys: selectedKeys,
|
248
392
|
onOpenChange: onOpenChange
|
249
393
|
}), function (item) {
|
250
394
|
return (0, _react2.jsx)(_.Item, {
|
@@ -254,13 +398,13 @@ var WithDisabledKeys = function WithDisabledKeys(args) {
|
|
254
398
|
}));
|
255
399
|
};
|
256
400
|
|
257
|
-
exports.
|
401
|
+
exports.Controlled = Controlled;
|
258
402
|
|
259
|
-
var
|
260
|
-
var
|
261
|
-
|
262
|
-
isOpen =
|
263
|
-
setIsOpen =
|
403
|
+
var Error = function Error(args) {
|
404
|
+
var _useState9 = (0, _react.useState)(false),
|
405
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
406
|
+
isOpen = _useState10[0],
|
407
|
+
setIsOpen = _useState10[1];
|
264
408
|
|
265
409
|
var direction = args.direction;
|
266
410
|
|
@@ -271,10 +415,10 @@ var Uncontrolled = function Uncontrolled(args) {
|
|
271
415
|
return (0, _react2.jsx)(_.OverlayProvider // note: spacing for demo purpose only so that the select list renders in the correct place
|
272
416
|
, {
|
273
417
|
style: setOverlayStyle(direction, isOpen, '50%', '50%', '20%')
|
274
|
-
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({
|
275
|
-
|
276
|
-
|
277
|
-
|
418
|
+
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({}, args, {
|
419
|
+
items: items,
|
420
|
+
helperText: "Here is some helpful text...",
|
421
|
+
status: "error",
|
278
422
|
onOpenChange: onOpenChange
|
279
423
|
}), function (item) {
|
280
424
|
return (0, _react2.jsx)(_.Item, {
|
@@ -284,14 +428,9 @@ var Uncontrolled = function Uncontrolled(args) {
|
|
284
428
|
}));
|
285
429
|
};
|
286
430
|
|
287
|
-
exports.
|
288
|
-
|
289
|
-
var Controlled = function Controlled(args) {
|
290
|
-
var _useState9 = (0, _react.useState)(['Aardvark', 'Snake']),
|
291
|
-
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
292
|
-
selectedKeys = _useState10[0],
|
293
|
-
setSelectedKeys = _useState10[1];
|
431
|
+
exports.Error = Error;
|
294
432
|
|
433
|
+
var ReadOnlyField = function ReadOnlyField(args) {
|
295
434
|
var _useState11 = (0, _react.useState)(false),
|
296
435
|
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
297
436
|
isOpen = _useState12[0],
|
@@ -307,11 +446,9 @@ var Controlled = function Controlled(args) {
|
|
307
446
|
, {
|
308
447
|
style: setOverlayStyle(direction, isOpen, '50%', '50%', '20%')
|
309
448
|
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({
|
310
|
-
|
449
|
+
items: items
|
311
450
|
}, args, {
|
312
|
-
|
313
|
-
onSelectionChange: setSelectedKeys,
|
314
|
-
selectedKeys: selectedKeys,
|
451
|
+
isReadOnly: true,
|
315
452
|
onOpenChange: onOpenChange
|
316
453
|
}), function (item) {
|
317
454
|
return (0, _react2.jsx)(_.Item, {
|
@@ -321,9 +458,9 @@ var Controlled = function Controlled(args) {
|
|
321
458
|
}));
|
322
459
|
};
|
323
460
|
|
324
|
-
exports.
|
461
|
+
exports.ReadOnlyField = ReadOnlyField;
|
325
462
|
|
326
|
-
var
|
463
|
+
var ReadOnlyValues = function ReadOnlyValues(args) {
|
327
464
|
var _useState13 = (0, _react.useState)(false),
|
328
465
|
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
329
466
|
isOpen = _useState14[0],
|
@@ -335,18 +472,11 @@ var WithCustomSize = function WithCustomSize(args) {
|
|
335
472
|
setIsOpen(true);
|
336
473
|
};
|
337
474
|
|
338
|
-
return (0, _react2.jsx)(_.
|
339
|
-
sx: {
|
340
|
-
width: '100%',
|
341
|
-
alignItems: 'center',
|
342
|
-
justifyContent: 'center'
|
343
|
-
}
|
344
|
-
}, (0, _react2.jsx)(_.Box, {
|
345
|
-
width: 300
|
346
|
-
}, (0, _react2.jsx)(_.OverlayProvider // note: spacing for demo purpose only so that the select list renders in the correct place
|
475
|
+
return (0, _react2.jsx)(_.OverlayProvider // note: spacing for demo purpose only so that the select list renders in the correct place
|
347
476
|
, {
|
348
|
-
style: setOverlayStyle(direction, isOpen, '
|
477
|
+
style: setOverlayStyle(direction, isOpen, '50%', '50%', '20%')
|
349
478
|
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({
|
479
|
+
readOnlyKeys: ['Aardvark', 'Snake'],
|
350
480
|
items: items
|
351
481
|
}, args, {
|
352
482
|
onOpenChange: onOpenChange
|
@@ -355,12 +485,12 @@ var WithCustomSize = function WithCustomSize(args) {
|
|
355
485
|
key: item.key,
|
356
486
|
"data-id": item.name
|
357
487
|
}, item.name);
|
358
|
-
}))
|
488
|
+
}));
|
359
489
|
};
|
360
490
|
|
361
|
-
exports.
|
491
|
+
exports.ReadOnlyValues = ReadOnlyValues;
|
362
492
|
|
363
|
-
var
|
493
|
+
var DisabledKeys = function DisabledKeys(args) {
|
364
494
|
var _useState15 = (0, _react.useState)(false),
|
365
495
|
_useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
|
366
496
|
isOpen = _useState16[0],
|
@@ -376,7 +506,7 @@ var WithReadOnlyValues = function WithReadOnlyValues(args) {
|
|
376
506
|
, {
|
377
507
|
style: setOverlayStyle(direction, isOpen, '50%', '50%', '20%')
|
378
508
|
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({
|
379
|
-
|
509
|
+
disabledKeys: ['Aardvark'],
|
380
510
|
items: items
|
381
511
|
}, args, {
|
382
512
|
onOpenChange: onOpenChange
|
@@ -388,9 +518,9 @@ var WithReadOnlyValues = function WithReadOnlyValues(args) {
|
|
388
518
|
}));
|
389
519
|
};
|
390
520
|
|
391
|
-
exports.
|
521
|
+
exports.DisabledKeys = DisabledKeys;
|
392
522
|
|
393
|
-
var
|
523
|
+
var CustomValues = function CustomValues(args) {
|
394
524
|
var _useState17 = (0, _react.useState)(false),
|
395
525
|
_useState18 = (0, _slicedToArray2["default"])(_useState17, 2),
|
396
526
|
isOpen = _useState18[0],
|
@@ -405,10 +535,10 @@ var Error = function Error(args) {
|
|
405
535
|
return (0, _react2.jsx)(_.OverlayProvider // note: spacing for demo purpose only so that the select list renders in the correct place
|
406
536
|
, {
|
407
537
|
style: setOverlayStyle(direction, isOpen, '50%', '50%', '20%')
|
408
|
-
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({
|
538
|
+
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({
|
409
539
|
items: items,
|
410
|
-
|
411
|
-
|
540
|
+
mode: "non-restrictive"
|
541
|
+
}, args, {
|
412
542
|
onOpenChange: onOpenChange
|
413
543
|
}), function (item) {
|
414
544
|
return (0, _react2.jsx)(_.Item, {
|
@@ -418,9 +548,14 @@ var Error = function Error(args) {
|
|
418
548
|
}));
|
419
549
|
};
|
420
550
|
|
421
|
-
exports.
|
551
|
+
exports.CustomValues = CustomValues;
|
552
|
+
CustomValues.argTypes = {
|
553
|
+
mode: {
|
554
|
+
defaultValue: 'non-restrictive'
|
555
|
+
}
|
556
|
+
};
|
422
557
|
|
423
|
-
var
|
558
|
+
var IconSlotsInChip = function IconSlotsInChip(args) {
|
424
559
|
var _useState19 = (0, _react.useState)(false),
|
425
560
|
_useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
|
426
561
|
isOpen = _useState20[0],
|
@@ -436,9 +571,8 @@ var ReadOnlyField = function ReadOnlyField(args) {
|
|
436
571
|
, {
|
437
572
|
style: setOverlayStyle(direction, isOpen, '50%', '50%', '20%')
|
438
573
|
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({
|
439
|
-
items:
|
574
|
+
items: itemsWithSlots
|
440
575
|
}, args, {
|
441
|
-
isReadOnly: true,
|
442
576
|
onOpenChange: onOpenChange
|
443
577
|
}), function (item) {
|
444
578
|
return (0, _react2.jsx)(_.Item, {
|
@@ -448,4 +582,41 @@ var ReadOnlyField = function ReadOnlyField(args) {
|
|
448
582
|
}));
|
449
583
|
};
|
450
584
|
|
451
|
-
exports.
|
585
|
+
exports.IconSlotsInChip = IconSlotsInChip;
|
586
|
+
|
587
|
+
var CustomSize = function CustomSize(args) {
|
588
|
+
var _useState21 = (0, _react.useState)(false),
|
589
|
+
_useState22 = (0, _slicedToArray2["default"])(_useState21, 2),
|
590
|
+
isOpen = _useState22[0],
|
591
|
+
setIsOpen = _useState22[1];
|
592
|
+
|
593
|
+
var direction = args.direction;
|
594
|
+
|
595
|
+
var onOpenChange = function onOpenChange() {
|
596
|
+
setIsOpen(true);
|
597
|
+
};
|
598
|
+
|
599
|
+
return (0, _react2.jsx)(_.Box, {
|
600
|
+
sx: {
|
601
|
+
width: '100%',
|
602
|
+
alignItems: 'center',
|
603
|
+
justifyContent: 'center'
|
604
|
+
}
|
605
|
+
}, (0, _react2.jsx)(_.Box, {
|
606
|
+
width: 300
|
607
|
+
}, (0, _react2.jsx)(_.OverlayProvider // note: spacing for demo purpose only so that the select list renders in the correct place
|
608
|
+
, {
|
609
|
+
style: setOverlayStyle(direction, isOpen, '25%', '25%', '75%')
|
610
|
+
}, (0, _react2.jsx)(_.MultivaluesField, (0, _extends2["default"])({
|
611
|
+
items: items
|
612
|
+
}, args, {
|
613
|
+
onOpenChange: onOpenChange
|
614
|
+
}), function (item) {
|
615
|
+
return (0, _react2.jsx)(_.Item, {
|
616
|
+
key: item.key,
|
617
|
+
"data-id": item.name
|
618
|
+
}, item.name);
|
619
|
+
}))));
|
620
|
+
};
|
621
|
+
|
622
|
+
exports.CustomSize = CustomSize;
|
@@ -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,
|