@pingux/astro 2.123.0 → 2.124.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.
@@ -52,9 +52,9 @@ var _excluded = ["items"],
52
52
  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); }
53
53
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
54
54
  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; }
55
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context11, _context12; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context11 = ownKeys(Object(source), !0)).call(_context11, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context12 = ownKeys(Object(source))).call(_context12, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
55
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context13, _context14; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context13 = ownKeys(Object(source), !0)).call(_context13, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context14 = ownKeys(Object(source))).call(_context14, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
56
56
  var DefaultMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
57
- var _context8, _listBoxRef$current2;
57
+ var _context10, _listBoxRef$current2;
58
58
  var initialItems = props.items,
59
59
  otherProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
60
60
  var defaultSelectedKeys = otherProps.defaultSelectedKeys,
@@ -207,17 +207,33 @@ var DefaultMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (prop
207
207
  minWidth: menuWidth
208
208
  });
209
209
  (0, _react.useEffect)(function () {
210
- if (defaultSelectedKeys) selectionManager.setSelectedKeys(defaultSelectedKeys);
210
+ if (defaultSelectedKeys) {
211
+ selectionManager.setSelectedKeys(defaultSelectedKeys);
212
+ setItems(function (prevItems) {
213
+ return (0, _filter["default"])(prevItems).call(prevItems, function (item) {
214
+ var _context3;
215
+ return !(0, _includes["default"])(_context3 = (0, _from["default"])(defaultSelectedKeys)).call(_context3, item.key);
216
+ });
217
+ });
218
+ }
211
219
  }, []);
212
220
  (0, _react.useEffect)(function () {
213
- if (selectedKeys) selectionManager.setSelectedKeys(selectedKeys);
221
+ if (selectedKeys) {
222
+ selectionManager.setSelectedKeys(selectedKeys);
223
+ setItems(function (prevItems) {
224
+ return (0, _filter["default"])(prevItems).call(prevItems, function (item) {
225
+ var _context4;
226
+ return !(0, _includes["default"])(_context4 = (0, _from["default"])(selectedKeys)).call(_context4, item.key);
227
+ });
228
+ });
229
+ }
214
230
  }, []);
215
231
  (0, _react.useEffect)(function () {
216
232
  if (onOpenChange) onOpenChange(isOpen);
217
233
  if (!isOpen) setActiveDescendant('');
218
234
  }, [isOpen]);
219
235
  var addNewBadgeFromInput = function addNewBadgeFromInput(inputValue) {
220
- var _context3, _context4;
236
+ var _context5, _context6;
221
237
  var key = (0, _trim["default"])(inputValue).call(inputValue);
222
238
  if (key === '') {
223
239
  return;
@@ -225,8 +241,8 @@ var DefaultMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (prop
225
241
  if (state.selectionManager.isSelected(key)) {
226
242
  return;
227
243
  }
228
- selectionManager.setSelectedKeys((0, _concat["default"])(_context3 = []).call(_context3, (0, _from["default"])(selectionManager.state.selectedKeys), [key]));
229
- setCustomItems((0, _concat["default"])(_context4 = []).call(_context4, customItems, [{
244
+ selectionManager.setSelectedKeys((0, _concat["default"])(_context5 = []).call(_context5, (0, _from["default"])(selectionManager.state.selectedKeys), [key]));
245
+ setCustomItems((0, _concat["default"])(_context6 = []).call(_context6, customItems, [{
230
246
  id: key,
231
247
  key: key,
232
248
  name: key
@@ -304,8 +320,8 @@ var DefaultMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (prop
304
320
  if (onKeyDown) onKeyDown(e.nativeEvent);
305
321
  };
306
322
  var deleteItem = function deleteItem(key, e) {
307
- var _context5;
308
- var activeBadgesKeys = (0, _reduce["default"])(_context5 = closeBadgeRefs.current).call(_context5, function (result, item) {
323
+ var _context7;
324
+ var activeBadgesKeys = (0, _reduce["default"])(_context7 = closeBadgeRefs.current).call(_context7, function (result, item) {
309
325
  if (item) {
310
326
  result.push(item.dataset.item);
311
327
  }
@@ -340,8 +356,8 @@ var DefaultMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (prop
340
356
  }, name);
341
357
  };
342
358
  var readOnlyInputEntry = isReadOnly && (readOnlyKeys.length ? (0, _map["default"])(readOnlyKeys).call(readOnlyKeys, function (key) {
343
- var _context6, _context7;
344
- var item = (0, _find["default"])(_context6 = (0, _concat["default"])(_context7 = []).call(_context7, initialItems, customItems)).call(_context6, function (el) {
359
+ var _context8, _context9;
360
+ var item = (0, _find["default"])(_context8 = (0, _concat["default"])(_context9 = []).call(_context9, initialItems, customItems)).call(_context8, function (el) {
345
361
  return el.key === key;
346
362
  });
347
363
  if (item) {
@@ -405,9 +421,9 @@ var DefaultMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (prop
405
421
  }
406
422
  }))));
407
423
  };
408
- var selectedItems = (0, _react2.jsx)(_react["default"].Fragment, null, (0, _map["default"])(_context8 = (0, _from["default"])(selectionManager.selectedKeys)).call(_context8, function (key, i) {
409
- var _context9, _context10;
410
- var item = (0, _find["default"])(_context9 = (0, _concat["default"])(_context10 = []).call(_context10, initialItems, customItems)).call(_context9, function (el) {
424
+ var selectedItems = (0, _react2.jsx)(_react["default"].Fragment, null, (0, _map["default"])(_context10 = (0, _from["default"])(selectionManager.selectedKeys)).call(_context10, function (key, i) {
425
+ var _context11, _context12;
426
+ var item = (0, _find["default"])(_context11 = (0, _concat["default"])(_context12 = []).call(_context12, initialItems, customItems)).call(_context11, function (el) {
411
427
  return el.key === key;
412
428
  });
413
429
  if (item) {
@@ -682,6 +682,20 @@ test('default selected keys', function () {
682
682
  var secondBadge = _testWrapper.screen.getByText(items[2].name);
683
683
  expect(secondBadge).toBeInTheDocument();
684
684
  });
685
+ test('default selected keys are removed from the list', function () {
686
+ getComponent({
687
+ defaultSelectedKeys: [items[1].key, items[2].key]
688
+ });
689
+ var input = _testWrapper.screen.getByRole('combobox');
690
+ _userEvent["default"].click(input);
691
+ var listbox = _testWrapper.screen.queryByRole('listbox');
692
+ _userEvent["default"].type(listbox, '{arrowdown}', {
693
+ skipClick: true
694
+ });
695
+ var options = (0, _testWrapper.within)(listbox).getAllByRole('option');
696
+ expect(options.length).toBe(1);
697
+ expect((0, _testWrapper.within)(options[0]).getByText(items[0].key)).toBeInTheDocument();
698
+ });
685
699
  test('selected keys', function () {
686
700
  getComponent({
687
701
  selectedKeys: [items[1].key, items[2].key]
@@ -693,6 +707,20 @@ test('selected keys', function () {
693
707
  var secondBadge = _testWrapper.screen.getByText(items[2].name);
694
708
  expect(secondBadge).toBeInTheDocument();
695
709
  });
710
+ test('selected keys are removed from the list', function () {
711
+ getComponent({
712
+ selectedKeys: [items[1].key, items[2].key]
713
+ });
714
+ var input = _testWrapper.screen.getByRole('combobox');
715
+ _userEvent["default"].click(input);
716
+ var listbox = _testWrapper.screen.queryByRole('listbox');
717
+ _userEvent["default"].type(listbox, '{arrowdown}', {
718
+ skipClick: true
719
+ });
720
+ var options = (0, _testWrapper.within)(listbox).getAllByRole('option');
721
+ expect(options.length).toBe(1);
722
+ expect((0, _testWrapper.within)(options[0]).getByText(items[0].key)).toBeInTheDocument();
723
+ });
696
724
  test('read only keys', function () {
697
725
  getComponent({
698
726
  readOnlyKeys: [items[1].key, items[2].key]
@@ -23,13 +23,156 @@ declare const buttons: {
23
23
  color: string;
24
24
  };
25
25
  };
26
- default: {
26
+ inline: {
27
+ color: string;
28
+ borderColor: string;
29
+ '&.is-hovered': {
30
+ backgroundColor: string;
31
+ color: string;
32
+ borderColor: string;
33
+ };
34
+ '&.is-pressed': {
35
+ color: string;
36
+ borderColor: string;
37
+ };
38
+ };
39
+ inlinePrimary: {
40
+ color: string;
41
+ '&.is-hovered': {
42
+ color: string;
43
+ };
44
+ '&.is-pressed': {
45
+ color: string;
46
+ };
47
+ };
48
+ withIcon: {
49
+ color: string;
50
+ borderColor: string;
51
+ '&.is-hovered': {
52
+ backgroundColor: string;
53
+ borderColor: string;
54
+ color: string;
55
+ path: {
56
+ fill: string;
57
+ };
58
+ };
59
+ '&.is-pressed': {
60
+ color: string;
61
+ borderColor: string;
62
+ path: {
63
+ fill: string;
64
+ };
65
+ };
66
+ };
67
+ primaryWithIcon: {
68
+ color: string;
69
+ path: {
70
+ fill: string;
71
+ };
72
+ '&.is-hovered': {
73
+ color: string;
74
+ path: {
75
+ fill: string;
76
+ };
77
+ };
78
+ '&.is-pressed': {
79
+ color: string;
80
+ path: {
81
+ fill: string;
82
+ };
83
+ };
84
+ };
85
+ inlineWithIcon: {
86
+ color: string;
87
+ borderColor: string;
88
+ '&.is-hovered': {
89
+ color: string;
90
+ backgroundColor: string;
91
+ borderColor: string;
92
+ path: {
93
+ fill: string;
94
+ };
95
+ };
96
+ '&.is-pressed': {
97
+ color: string;
98
+ borderColor: string;
99
+ path: {
100
+ fill: string;
101
+ };
102
+ };
103
+ };
104
+ inlinePrimaryWithIcon: {
105
+ color: string;
106
+ path: {
107
+ fill: string;
108
+ };
109
+ '&.is-hovered': {
110
+ color: string;
111
+ path: {
112
+ fill: string;
113
+ };
114
+ };
115
+ '&.is-pressed': {
116
+ color: string;
117
+ path: {
118
+ fill: string;
119
+ };
120
+ };
121
+ };
122
+ colorBlock: {
123
+ bg: string;
27
124
  borderColor: string;
125
+ path: {
126
+ fill: string;
127
+ };
128
+ '& span': {
129
+ color: string;
130
+ };
131
+ '&.is-hovered': {
132
+ bg: string;
133
+ borderColor: string;
134
+ };
135
+ '&.is-pressed': {
136
+ bg: string;
137
+ borderColor: string;
138
+ };
139
+ '&>svg': {
140
+ color: string;
141
+ fill: string;
142
+ };
143
+ };
144
+ colorBlockPrimary: {
145
+ path: {
146
+ fill: string;
147
+ };
148
+ '& span': {
149
+ color: string;
150
+ };
151
+ '&.is-hovered': {
152
+ path: {
153
+ fill: string;
154
+ };
155
+ };
156
+ '&.is-pressed': {
157
+ path: {
158
+ fill: string;
159
+ };
160
+ };
161
+ '&>svg': {
162
+ color: string;
163
+ fill: string;
164
+ };
165
+ };
166
+ default: {
28
167
  color: string;
168
+ borderColor: string;
29
169
  '&.is-pressed': {
30
170
  color: string;
171
+ borderColor: string;
31
172
  };
32
173
  '&.is-hovered': {
174
+ backgroundColor: string;
175
+ borderColor: string;
33
176
  color: string;
34
177
  };
35
178
  };
@@ -88,13 +88,156 @@ var buttons = {
88
88
  color: 'black'
89
89
  }
90
90
  },
91
- "default": {
91
+ inline: {
92
+ color: 'blue-400',
93
+ borderColor: 'blue-400',
94
+ '&.is-hovered': {
95
+ backgroundColor: 'active_hover',
96
+ color: 'black',
97
+ borderColor: 'blue'
98
+ },
99
+ '&.is-pressed': {
100
+ color: 'black',
101
+ borderColor: 'blue'
102
+ }
103
+ },
104
+ inlinePrimary: {
105
+ color: 'black',
106
+ '&.is-hovered': {
107
+ color: 'black'
108
+ },
109
+ '&.is-pressed': {
110
+ color: 'black'
111
+ }
112
+ },
113
+ withIcon: {
114
+ color: 'blue-400',
92
115
  borderColor: 'blue-400',
116
+ '&.is-hovered': {
117
+ backgroundColor: 'active_hover',
118
+ borderColor: 'blue',
119
+ color: 'black',
120
+ path: {
121
+ fill: 'black'
122
+ }
123
+ },
124
+ '&.is-pressed': {
125
+ color: 'black',
126
+ borderColor: 'blue',
127
+ path: {
128
+ fill: 'black'
129
+ }
130
+ }
131
+ },
132
+ primaryWithIcon: {
133
+ color: 'black',
134
+ path: {
135
+ fill: 'black'
136
+ },
137
+ '&.is-hovered': {
138
+ color: 'black',
139
+ path: {
140
+ fill: 'black'
141
+ }
142
+ },
143
+ '&.is-pressed': {
144
+ color: 'black',
145
+ path: {
146
+ fill: 'black'
147
+ }
148
+ }
149
+ },
150
+ inlineWithIcon: {
93
151
  color: 'blue-400',
152
+ borderColor: 'blue-400',
153
+ '&.is-hovered': {
154
+ color: 'black',
155
+ backgroundColor: 'active_hover',
156
+ borderColor: 'blue',
157
+ path: {
158
+ fill: 'black'
159
+ }
160
+ },
94
161
  '&.is-pressed': {
162
+ color: 'black',
163
+ borderColor: 'blue',
164
+ path: {
165
+ fill: 'black'
166
+ }
167
+ }
168
+ },
169
+ inlinePrimaryWithIcon: {
170
+ color: 'black',
171
+ path: {
172
+ fill: 'black'
173
+ },
174
+ '&.is-hovered': {
175
+ color: 'black',
176
+ path: {
177
+ fill: 'black'
178
+ }
179
+ },
180
+ '&.is-pressed': {
181
+ color: 'black',
182
+ path: {
183
+ fill: 'black'
184
+ }
185
+ }
186
+ },
187
+ colorBlock: {
188
+ bg: 'gray-200',
189
+ borderColor: 'gray-200',
190
+ path: {
191
+ fill: 'black'
192
+ },
193
+ '& span': {
194
+ color: 'black'
195
+ },
196
+ '&.is-hovered': {
197
+ bg: 'blue-100',
198
+ borderColor: 'blue-100'
199
+ },
200
+ '&.is-pressed': {
201
+ bg: 'blue-100',
202
+ borderColor: 'blue-100'
203
+ },
204
+ '&>svg': {
205
+ color: 'black',
206
+ fill: 'black'
207
+ }
208
+ },
209
+ colorBlockPrimary: {
210
+ path: {
211
+ fill: 'black'
212
+ },
213
+ '& span': {
95
214
  color: 'black'
96
215
  },
97
216
  '&.is-hovered': {
217
+ path: {
218
+ fill: 'black'
219
+ }
220
+ },
221
+ '&.is-pressed': {
222
+ path: {
223
+ fill: 'black'
224
+ }
225
+ },
226
+ '&>svg': {
227
+ color: 'black',
228
+ fill: 'black'
229
+ }
230
+ },
231
+ "default": {
232
+ color: 'blue-400',
233
+ borderColor: 'blue-400',
234
+ '&.is-pressed': {
235
+ color: 'black',
236
+ borderColor: 'blue'
237
+ },
238
+ '&.is-hovered': {
239
+ backgroundColor: 'active_hover',
240
+ borderColor: 'blue',
98
241
  color: 'black'
99
242
  }
100
243
  },
@@ -222,8 +222,12 @@ declare const colors: {
222
222
  link: string;
223
223
  label: string;
224
224
  };
225
+ active_hover: string;
226
+ active_pressed: string;
225
227
  active_light: string;
226
228
  success_light: string;
229
+ critical_hover: string;
230
+ critical_pressed: string;
227
231
  critical_light: string;
228
232
  warning_light: string;
229
233
  lightblue: string;
@@ -2,7 +2,6 @@ declare const nextGenConvertedComponents: string[];
2
2
  export declare const componentSpecificNextGenBlacklist: {
3
3
  AstroProvider: string[];
4
4
  Badge: string[];
5
- Button: string[];
6
5
  Messages: string[];
7
6
  MultivaluesField: string[];
8
7
  PasswordField: string[];
@@ -9,7 +9,6 @@ var nextGenConvertedComponents = ['DataTable', 'Message', 'Button', 'Badge', 'Ic
9
9
  var componentSpecificNextGenBlacklist = {
10
10
  AstroProvider: ['Default', 'With Custom Theme Override'],
11
11
  Badge: ['Status Badge Variants', 'Badge With Left Slot And Icon', 'Callout Badges', 'Removable'],
12
- Button: ['Color Block Button', 'Text Icon Button'],
13
12
  Messages: ['Customization'],
14
13
  MultivaluesField: ['Condensed', 'Condensed With Section'],
15
14
  PasswordField: ['Success'],