@pingux/astro 1.1.1-alpha.5 → 1.2.0-alpha.3
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/Breadcrumbs/BreadcrumbItem.js +3 -0
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.js +24 -14
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.test.js +9 -0
- package/lib/cjs/components/CopyText/CopyButton.js +9 -2
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +338 -0
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.js +295 -0
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +287 -0
- package/lib/cjs/components/EnvironmentBreadcrumb/index.js +18 -0
- package/lib/cjs/components/Messages/Messages.reducer.js +2 -1
- package/lib/cjs/components/Messages/Messages.stories.js +10 -10
- package/lib/cjs/components/Messages/Messages.test.js +15 -1
- package/lib/cjs/components/Messages/index.js +21 -2
- package/lib/cjs/components/TextField/TextField.stories.js +79 -2
- package/lib/cjs/index.js +10 -0
- package/lib/cjs/styles/variants/boxes.js +13 -0
- package/lib/cjs/styles/variants/buttons.js +23 -0
- package/lib/cjs/styles/variants/text.js +9 -0
- package/lib/cjs/utils/devUtils/constants/animals.js +11 -0
- package/lib/cjs/utils/devUtils/constants/firstNames.js +11 -0
- package/lib/cjs/utils/devUtils/createMockData.js +96 -0
- package/lib/components/Breadcrumbs/BreadcrumbItem.js +4 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.js +24 -15
- package/lib/components/Breadcrumbs/Breadcrumbs.test.js +9 -0
- package/lib/components/CopyText/CopyButton.js +7 -2
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +296 -0
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.js +256 -0
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +246 -0
- package/lib/components/EnvironmentBreadcrumb/index.js +1 -0
- package/lib/components/Messages/Messages.reducer.js +1 -1
- package/lib/components/Messages/Messages.stories.js +1 -1
- package/lib/components/Messages/Messages.test.js +11 -1
- package/lib/components/Messages/index.js +2 -1
- package/lib/components/TextField/TextField.stories.js +72 -0
- package/lib/index.js +1 -0
- package/lib/styles/variants/boxes.js +13 -0
- package/lib/styles/variants/buttons.js +23 -0
- package/lib/styles/variants/text.js +9 -0
- package/lib/utils/devUtils/constants/animals.js +1 -0
- package/lib/utils/devUtils/constants/firstNames.js +1 -0
- package/lib/utils/devUtils/createMockData.js +68 -0
- package/package.json +1 -1
@@ -26,7 +26,7 @@ var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
|
|
26
26
|
|
27
27
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
28
28
|
|
29
|
-
var _ =
|
29
|
+
var _ = _interopRequireWildcard(require("."));
|
30
30
|
|
31
31
|
var _Button = _interopRequireDefault(require("../Button"));
|
32
32
|
|
@@ -211,4 +211,18 @@ describe('announcements', function () {
|
|
211
211
|
expect(messages.childElementCount).toBe(1);
|
212
212
|
expect(_liveAnnouncer.announce).toHaveBeenCalledWith('New message 1', 'polite');
|
213
213
|
});
|
214
|
+
});
|
215
|
+
test('should render messages with messagesReducerStory', function () {
|
216
|
+
getComponent();
|
217
|
+
|
218
|
+
_.messagesReducerStory.actions.showSuccessMessage();
|
219
|
+
|
220
|
+
expect(_testWrapper.screen.getByTestId(testId)).toBeInTheDocument();
|
221
|
+
});
|
222
|
+
test('should render messages with multiMessagesReducerStory', function () {
|
223
|
+
getComponent();
|
224
|
+
|
225
|
+
_.multiMessagesReducerStory.actions.showSuccessMessage();
|
226
|
+
|
227
|
+
expect(_testWrapper.screen.getByTestId(testId)).toBeInTheDocument();
|
214
228
|
});
|
@@ -14,7 +14,10 @@ _Object$defineProperty(exports, "__esModule", {
|
|
14
14
|
value: true
|
15
15
|
});
|
16
16
|
|
17
|
-
var _exportNames = {
|
17
|
+
var _exportNames = {
|
18
|
+
messagesReducerStory: true,
|
19
|
+
multiMessagesReducerStory: true
|
20
|
+
};
|
18
21
|
|
19
22
|
_Object$defineProperty(exports, "default", {
|
20
23
|
enumerable: true,
|
@@ -23,6 +26,20 @@ _Object$defineProperty(exports, "default", {
|
|
23
26
|
}
|
24
27
|
});
|
25
28
|
|
29
|
+
_Object$defineProperty(exports, "messagesReducerStory", {
|
30
|
+
enumerable: true,
|
31
|
+
get: function get() {
|
32
|
+
return _Messages2.messagesReducer;
|
33
|
+
}
|
34
|
+
});
|
35
|
+
|
36
|
+
_Object$defineProperty(exports, "multiMessagesReducerStory", {
|
37
|
+
enumerable: true,
|
38
|
+
get: function get() {
|
39
|
+
return _Messages2.multiMessagesReducer;
|
40
|
+
}
|
41
|
+
});
|
42
|
+
|
26
43
|
var _Messages = _interopRequireDefault(require("./Messages"));
|
27
44
|
|
28
45
|
var _utils = require("./utils");
|
@@ -37,4 +54,6 @@ _forEachInstanceProperty(_context = _Object$keys(_utils)).call(_context, functio
|
|
37
54
|
return _utils[key];
|
38
55
|
}
|
39
56
|
});
|
40
|
-
});
|
57
|
+
});
|
58
|
+
|
59
|
+
var _Messages2 = require("./Messages.reducer");
|
@@ -10,7 +10,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
10
10
|
value: true
|
11
11
|
});
|
12
12
|
|
13
|
-
exports.MaxLength = exports.WithoutStatusIndicator = exports.WithHelpHint = exports.Warning = exports.Success = exports.Error = exports.DynamicRequired = exports.Required = exports.ReadOnly = exports.Disabled = exports.Password = exports.Controlled = exports.LeftLabel = exports.FloatLabel = exports.SmallVariant = exports.Default = exports["default"] = void 0;
|
13
|
+
exports.WithSlots = exports.MaxLength = exports.WithoutStatusIndicator = exports.WithHelpHint = exports.Warning = exports.Success = exports.Error = exports.DynamicRequired = exports.Required = exports.ReadOnly = exports.Disabled = exports.Password = exports.Controlled = exports.LeftLabel = exports.FloatLabel = exports.SmallVariant = exports.Default = exports["default"] = void 0;
|
14
14
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
16
16
|
|
@@ -32,6 +32,10 @@ var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/s
|
|
32
32
|
|
33
33
|
var _Box = _interopRequireDefault(require("../Box"));
|
34
34
|
|
35
|
+
var _useCopyToClipboard = _interopRequireDefault(require("../../hooks/useCopyToClipboard"));
|
36
|
+
|
37
|
+
var _CopyButton = _interopRequireDefault(require("../CopyText/CopyButton"));
|
38
|
+
|
35
39
|
var _react2 = require("@emotion/react");
|
36
40
|
|
37
41
|
var _default = {
|
@@ -259,4 +263,77 @@ var MaxLength = function MaxLength() {
|
|
259
263
|
});
|
260
264
|
};
|
261
265
|
|
262
|
-
exports.MaxLength = MaxLength;
|
266
|
+
exports.MaxLength = MaxLength;
|
267
|
+
|
268
|
+
var WithSlots = function WithSlots() {
|
269
|
+
var _useState5 = (0, _react.useState)("[{ 'type': 'work', 'streetAddress': 'San Antonio MI 47096' },{ 'type': 'home', 'streetAddress': 'Santa Rosa MN 98804' }]"),
|
270
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
271
|
+
addressesValue = _useState6[0],
|
272
|
+
setAddressesValue = _useState6[1];
|
273
|
+
|
274
|
+
var _useState7 = (0, _react.useState)("[{ 'status': 'inactive', 'subject': 'example@pingidentity.com' },{ 'status': 'active', 'subject': 'john@pingidentity.com' }]"),
|
275
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
276
|
+
jsonValue = _useState8[0],
|
277
|
+
setJsonValue = _useState8[1];
|
278
|
+
|
279
|
+
var copyAddressesToClipboard = (0, _useCopyToClipboard["default"])(addressesValue);
|
280
|
+
var copyJsonToClipboard = (0, _useCopyToClipboard["default"])(jsonValue);
|
281
|
+
var buttonSx = {
|
282
|
+
position: 'absolute',
|
283
|
+
right: 0,
|
284
|
+
top: '5px'
|
285
|
+
};
|
286
|
+
var containerSx = {
|
287
|
+
sx: {
|
288
|
+
'& input': {
|
289
|
+
paddingRight: '40px'
|
290
|
+
}
|
291
|
+
}
|
292
|
+
};
|
293
|
+
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_["default"], {
|
294
|
+
label: "Multiple Addresses",
|
295
|
+
labelMode: "float",
|
296
|
+
onChange: function onChange(e) {
|
297
|
+
return setAddressesValue(e.target.value);
|
298
|
+
},
|
299
|
+
value: addressesValue,
|
300
|
+
containerProps: containerSx,
|
301
|
+
slots: {
|
302
|
+
inContainer: (0, _react2.jsx)(_CopyButton["default"], {
|
303
|
+
onPress: copyAddressesToClipboard,
|
304
|
+
sx: buttonSx,
|
305
|
+
iconProps: {
|
306
|
+
sx: {
|
307
|
+
path: {
|
308
|
+
fill: 'active'
|
309
|
+
}
|
310
|
+
}
|
311
|
+
}
|
312
|
+
})
|
313
|
+
},
|
314
|
+
mb: 30
|
315
|
+
}), (0, _react2.jsx)(_["default"], {
|
316
|
+
label: "Example JSON",
|
317
|
+
labelMode: "float",
|
318
|
+
onChange: function onChange(e) {
|
319
|
+
return setJsonValue(e.target.value);
|
320
|
+
},
|
321
|
+
value: jsonValue,
|
322
|
+
containerProps: containerSx,
|
323
|
+
slots: {
|
324
|
+
inContainer: (0, _react2.jsx)(_CopyButton["default"], {
|
325
|
+
onPress: copyJsonToClipboard,
|
326
|
+
sx: buttonSx,
|
327
|
+
iconProps: {
|
328
|
+
sx: {
|
329
|
+
path: {
|
330
|
+
fill: 'active'
|
331
|
+
}
|
332
|
+
}
|
333
|
+
}
|
334
|
+
})
|
335
|
+
}
|
336
|
+
}));
|
337
|
+
};
|
338
|
+
|
339
|
+
exports.WithSlots = WithSlots;
|
package/lib/cjs/index.js
CHANGED
@@ -34,6 +34,7 @@ var _exportNames = {
|
|
34
34
|
ComboBoxField: true,
|
35
35
|
CopyText: true,
|
36
36
|
ColorField: true,
|
37
|
+
EnvironmentBreadcrumb: true,
|
37
38
|
FieldHelperText: true,
|
38
39
|
FileInputField: true,
|
39
40
|
HelpHint: true,
|
@@ -214,6 +215,13 @@ _Object$defineProperty(exports, "ColorField", {
|
|
214
215
|
}
|
215
216
|
});
|
216
217
|
|
218
|
+
_Object$defineProperty(exports, "EnvironmentBreadcrumb", {
|
219
|
+
enumerable: true,
|
220
|
+
get: function get() {
|
221
|
+
return _EnvironmentBreadcrumb["default"];
|
222
|
+
}
|
223
|
+
});
|
224
|
+
|
217
225
|
_Object$defineProperty(exports, "FieldHelperText", {
|
218
226
|
enumerable: true,
|
219
227
|
get: function get() {
|
@@ -817,6 +825,8 @@ var _CopyText = _interopRequireDefault(require("./components/CopyText"));
|
|
817
825
|
|
818
826
|
var _ColorField = _interopRequireDefault(require("./components/ColorField"));
|
819
827
|
|
828
|
+
var _EnvironmentBreadcrumb = _interopRequireDefault(require("./components/EnvironmentBreadcrumb"));
|
829
|
+
|
820
830
|
var _FieldHelperText = _interopRequireWildcard(require("./components/FieldHelperText"));
|
821
831
|
|
822
832
|
_forEachInstanceProperty(_context14 = _Object$keys(_FieldHelperText)).call(_context14, function (key) {
|
@@ -274,6 +274,18 @@ var datePicker = {
|
|
274
274
|
}
|
275
275
|
}
|
276
276
|
};
|
277
|
+
|
278
|
+
var environmentChip = _objectSpread(_objectSpread({}, chip), {}, {
|
279
|
+
alignSelf: 'center',
|
280
|
+
height: '17px',
|
281
|
+
minWidth: 'fit-content',
|
282
|
+
ml: 8,
|
283
|
+
'& span': {
|
284
|
+
fontSize: 'xs',
|
285
|
+
lineHeight: 1
|
286
|
+
}
|
287
|
+
});
|
288
|
+
|
277
289
|
var fileInputFieldWrapper = {
|
278
290
|
display: 'flex',
|
279
291
|
border: '1px dashed',
|
@@ -302,6 +314,7 @@ var _default = {
|
|
302
314
|
chip: chip,
|
303
315
|
copy: copy,
|
304
316
|
datePicker: datePicker,
|
317
|
+
environmentChip: environmentChip,
|
305
318
|
expandableRow: expandableRow,
|
306
319
|
inputInContainerSlot: inputInContainerSlot,
|
307
320
|
fileInputFieldWrapper: fileInputFieldWrapper,
|
@@ -485,6 +485,28 @@ var expandableRow = {
|
|
485
485
|
}
|
486
486
|
}
|
487
487
|
};
|
488
|
+
var environmentBreadcrumb = {
|
489
|
+
current: _objectSpread(_objectSpread({}, text), {}, {
|
490
|
+
color: 'neutral.30',
|
491
|
+
fontSize: 'md',
|
492
|
+
fontWeight: 1,
|
493
|
+
'&.is-hovered, &.is-focused': {
|
494
|
+
color: 'active',
|
495
|
+
textDecoration: 'none',
|
496
|
+
boxShadow: 'none'
|
497
|
+
},
|
498
|
+
'&.is-pressed': {
|
499
|
+
color: 'accent.20',
|
500
|
+
textDecoration: 'none'
|
501
|
+
}
|
502
|
+
}),
|
503
|
+
selectItem: _objectSpread(_objectSpread({}, text), {}, {
|
504
|
+
color: 'neutral.10',
|
505
|
+
fontSize: 'md',
|
506
|
+
fontWeight: 0,
|
507
|
+
justifyContent: 'start'
|
508
|
+
})
|
509
|
+
};
|
488
510
|
var fileInputField = {
|
489
511
|
background: 'none',
|
490
512
|
cursor: 'pointer',
|
@@ -551,6 +573,7 @@ var _default = {
|
|
551
573
|
'&.is-pressed': _objectSpread({}, defaultActive),
|
552
574
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
553
575
|
}),
|
576
|
+
environmentBreadcrumb: environmentBreadcrumb,
|
554
577
|
expandableRow: expandableRow,
|
555
578
|
fileInputField: fileInputField,
|
556
579
|
iconButton: iconButton,
|
@@ -139,6 +139,14 @@ var expandableRow = {
|
|
139
139
|
}
|
140
140
|
}
|
141
141
|
};
|
142
|
+
|
143
|
+
var environmentBreadcrumb = _objectSpread(_objectSpread({}, base), {}, {
|
144
|
+
fontSize: 'sm',
|
145
|
+
fontWeight: 3,
|
146
|
+
color: 'secondary',
|
147
|
+
textTransform: 'capitalize'
|
148
|
+
});
|
149
|
+
|
142
150
|
var navBarSubtitle = {
|
143
151
|
fontWeight: 3,
|
144
152
|
fontSize: '11px',
|
@@ -175,6 +183,7 @@ var text = {
|
|
175
183
|
textTransform: 'uppercase',
|
176
184
|
fontFamily: 'standard'
|
177
185
|
}),
|
186
|
+
environmentBreadcrumb: environmentBreadcrumb,
|
178
187
|
fieldHelperText: fieldHelperText,
|
179
188
|
inputValue: {
|
180
189
|
fontWeight: 1,
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
|
9
|
+
exports["default"] = void 0;
|
10
|
+
var _default = ['Aardvark', 'Albatross', 'Alligator', 'Alpaca', 'Ant', 'Anteater', 'Antelope', 'Ape', 'Armadillo', 'Donkey', 'Baboon', 'Badger', 'Barracuda', 'Bat', 'Bear', 'Beaver', 'Bee', 'Bison', 'Boar', 'Buffalo', 'Butterfly', 'Camel', 'Capybara', 'Caribou', 'Cassowary', 'Cat', 'Caterpillar', 'Cattle', 'Chamois', 'Cheetah', 'Chicken', 'Chimpanzee', 'Chinchilla', 'Chough', 'Clam', 'Cobra', 'Cockroach', 'Cod', 'Cormorant', 'Coyote', 'Crab', 'Crane', 'Crocodile', 'Crow', 'Curlew', 'Deer', 'Dinosaur', 'Dog', 'Dogfish', 'Dolphin', 'Dotterel', 'Dove', 'Dragonfly', 'Duck', 'Dugong', 'Dunlin', 'Eagle', 'Echidna', 'Eel', 'Eland', 'Elephant', 'Elk', 'Emu', 'Falcon', 'Ferret', 'Finch', 'Fish', 'Flamingo', 'Fly', 'Fox', 'Frog', 'Gaur', 'Gazelle', 'Gerbil', 'Giraffe', 'Gnat', 'Gnu', 'Goat', 'Goldfinch', 'Goldfish', 'Goose', 'Gorilla', 'Goshawk', 'Grasshopper', 'Grouse', 'Guanaco', 'Gull', 'Hamster', 'Hare', 'Hawk', 'Hedgehog', 'Heron', 'Herring', 'Hippopotamus', 'Hornet', 'Horse', 'Human', 'Hummingbird', 'Hyena', 'Ibex', 'Ibis', 'Jackal', 'Jaguar', 'Jay', 'Jellyfish', 'Kangaroo', 'Kingfisher', 'Koala', 'Kookabura', 'Kouprey', 'Kudu', 'Lapwing', 'Lark', 'Lemur', 'Leopard', 'Lion', 'Llama', 'Lobster', 'Locust', 'Loris', 'Louse', 'Lyrebird', 'Magpie', 'Mallard', 'Manatee', 'Mandrill', 'Mantis', 'Marten', 'Meerkat', 'Mink', 'Mole', 'Mongoose', 'Monkey', 'Moose', 'Mosquito', 'Mouse', 'Mule', 'Narwhal', 'Newt', 'Nightingale', 'Octopus', 'Okapi', 'Opossum', 'Oryx', 'Ostrich', 'Otter', 'Owl', 'Oyster', 'Panther', 'Parrot', 'Partridge', 'Peafowl', 'Pelican', 'Penguin', 'Pheasant', 'Pig', 'Pigeon', 'Pony', 'Porcupine', 'Porpoise', 'Quail', 'Quelea', 'Quetzal', 'Rabbit', 'Raccoon', 'Rail', 'Ram', 'Rat', 'Raven', 'Red deer', 'Red panda', 'Reindeer', 'Rhinoceros', 'Rook', 'Salamander', 'Salmon', 'Sand Dollar', 'Sandpiper', 'Sardine', 'Scorpion', 'Seahorse', 'Seal', 'Shark', 'Sheep', 'Shrew', 'Skunk', 'Snail', 'Snake', 'Sparrow', 'Spider', 'Spoonbill', 'Squid', 'Squirrel', 'Starling', 'Stingray', 'Stinkbug', 'Stork', 'Swallow', 'Swan', 'Tapir', 'Tarsier', 'Termite', 'Tiger', 'Toad', 'Trout', 'Turkey', 'Turtle', 'Viper', 'Vulture', 'Wallaby', 'Walrus', 'Wasp', 'Weasel', 'Whale', 'Wildcat', 'Wolf', 'Wolverine', 'Wombat', 'Woodcock', 'Woodpecker', 'Worm', 'Wren', 'Yak', 'Zebra'];
|
11
|
+
exports["default"] = _default;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
|
9
|
+
exports["default"] = void 0;
|
10
|
+
var _default = ['Michael', 'Christopher', 'Jessica', 'Matthew', 'Ashley', 'Jennifer', 'Joshua', 'Amanda', 'Daniel', 'David', 'James', 'Robert', 'John', 'Joseph', 'Andrew', 'Ryan', 'Brandon', 'Jason', 'Justin', 'Sarah', 'William', 'Jonathan', 'Stephanie', 'Brian', 'Nicole', 'Nicholas', 'Anthony', 'Heather', 'Eric', 'Elizabeth', 'Adam', 'Megan', 'Melissa', 'Kevin', 'Steven', 'Thomas', 'Timothy', 'Christina', 'Kyle', 'Rachel', 'Laura', 'Lauren', 'Amber', 'Brittany', 'Danielle', 'Richard', 'Kimberly', 'Jeffrey', 'Amy', 'Crystal', 'Michelle', 'Tiffany', 'Jeremy', 'Benjamin', 'Mark', 'Emily', 'Aaron', 'Charles', 'Rebecca', 'Jacob', 'Stephen', 'Patrick', 'Sean', 'Erin', 'Zachary', 'Jamie', 'Kelly', 'Samantha', 'Nathan', 'Sara', 'Dustin', 'Paul', 'Angela', 'Tyler', 'Scott', 'Katherine', 'Andrea', 'Gregory', 'Erica', 'Mary', 'Travis', 'Lisa', 'Kenneth', 'Bryan', 'Lindsey', 'Kristen', 'Jose', 'Alexander', 'Jesse', 'Katie', 'Lindsay', 'Shannon', 'Vanessa', 'Courtney', 'Christine', 'Alicia', 'Cody', 'Allison', 'Bradley', 'Samuel'];
|
11
|
+
exports["default"] = _default;
|
@@ -0,0 +1,96 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
var _Object$defineProperty2 = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
6
|
+
|
7
|
+
_Object$defineProperty2(exports, "__esModule", {
|
8
|
+
value: true
|
9
|
+
});
|
10
|
+
|
11
|
+
exports["default"] = void 0;
|
12
|
+
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-property"));
|
14
|
+
|
15
|
+
var _defineProperties = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-properties"));
|
16
|
+
|
17
|
+
var _getOwnPropertyDescriptors = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors"));
|
18
|
+
|
19
|
+
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
20
|
+
|
21
|
+
var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor"));
|
22
|
+
|
23
|
+
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
24
|
+
|
25
|
+
var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
|
26
|
+
|
27
|
+
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
28
|
+
|
29
|
+
var _fill = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/fill"));
|
30
|
+
|
31
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
32
|
+
|
33
|
+
var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
|
34
|
+
|
35
|
+
var _defineProperty3 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
36
|
+
|
37
|
+
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
|
38
|
+
|
39
|
+
var _uuid = require("uuid");
|
40
|
+
|
41
|
+
var _animals = _interopRequireDefault(require("./constants/animals"));
|
42
|
+
|
43
|
+
var _firstNames = _interopRequireDefault(require("./constants/firstNames"));
|
44
|
+
|
45
|
+
function ownKeys(object, enumerableOnly) { var keys = (0, _keys["default"])(object); if (_getOwnPropertySymbols["default"]) { var symbols = (0, _getOwnPropertySymbols["default"])(object); if (enumerableOnly) symbols = (0, _filter["default"])(symbols).call(symbols, function (sym) { return (0, _getOwnPropertyDescriptor["default"])(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
46
|
+
|
47
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context3; (0, _forEach["default"])(_context3 = ownKeys(Object(source), true)).call(_context3, function (key) { (0, _defineProperty3["default"])(target, key, source[key]); }); } else if (_getOwnPropertyDescriptors["default"]) { (0, _defineProperties["default"])(target, (0, _getOwnPropertyDescriptors["default"])(source)); } else { var _context4; (0, _forEach["default"])(_context4 = ownKeys(Object(source))).call(_context4, function (key) { (0, _defineProperty2["default"])(target, key, (0, _getOwnPropertyDescriptor["default"])(source, key)); }); } } return target; }
|
48
|
+
|
49
|
+
function createMockData(length, objectScheme) {
|
50
|
+
var mockDataBase = {
|
51
|
+
animal: _animals["default"],
|
52
|
+
firstName: _firstNames["default"]
|
53
|
+
};
|
54
|
+
var itemsNumber = {
|
55
|
+
animal: 0,
|
56
|
+
firstName: 0
|
57
|
+
};
|
58
|
+
|
59
|
+
var getPropValue = function getPropValue(valueType) {
|
60
|
+
if (valueType === 'id') {
|
61
|
+
return (0, _uuid.v4)();
|
62
|
+
}
|
63
|
+
|
64
|
+
var valueNumber = itemsNumber[valueType];
|
65
|
+
var propValue = mockDataBase[valueType][valueNumber];
|
66
|
+
itemsNumber[valueType] += 1;
|
67
|
+
return propValue;
|
68
|
+
};
|
69
|
+
|
70
|
+
var generateObject = function generateObject() {
|
71
|
+
var entries = (0, _entries["default"])(objectScheme);
|
72
|
+
|
73
|
+
var reducer = function reducer(previousValue, currentValue) {
|
74
|
+
var fieldName = currentValue[0];
|
75
|
+
var fieldValue = getPropValue(currentValue[1]);
|
76
|
+
return _objectSpread(_objectSpread({}, previousValue), {}, (0, _defineProperty3["default"])({}, fieldName, fieldValue));
|
77
|
+
};
|
78
|
+
|
79
|
+
return (0, _reduce["default"])(entries).call(entries, reducer, {});
|
80
|
+
};
|
81
|
+
|
82
|
+
var generateDataArr = function generateDataArr() {
|
83
|
+
var _context, _context2;
|
84
|
+
|
85
|
+
return (0, _map["default"])(_context = (0, _fill["default"])(_context2 = Array(length)).call(_context2, undefined)).call(_context, function () {
|
86
|
+
return generateObject();
|
87
|
+
});
|
88
|
+
};
|
89
|
+
|
90
|
+
return generateDataArr();
|
91
|
+
}
|
92
|
+
|
93
|
+
var _default = createMockData; // usage(delete this comment as soon as we used this function in a few stories so we have examples):
|
94
|
+
// const mockData = createMockData(100, { name: 'animal', id: 'id' });
|
95
|
+
|
96
|
+
exports["default"] = _default;
|
@@ -14,7 +14,7 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
14
14
|
|
15
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source), true)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context3; _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
16
16
|
|
17
|
-
import React, { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';
|
17
|
+
import React, { forwardRef, Fragment, useCallback, useImperativeHandle, useMemo, useRef } from 'react';
|
18
18
|
import { useBreadcrumbItem } from '@react-aria/breadcrumbs';
|
19
19
|
import PropTypes from 'prop-types';
|
20
20
|
import { mergeProps } from '@react-aria/utils';
|
@@ -54,6 +54,9 @@ var BreadcrumbItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
54
54
|
case 'Text':
|
55
55
|
return Text;
|
56
56
|
|
57
|
+
case 'Fragment':
|
58
|
+
return Fragment;
|
59
|
+
|
57
60
|
default:
|
58
61
|
return elementType;
|
59
62
|
}
|
@@ -1,7 +1,9 @@
|
|
1
|
-
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
1
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
2
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
4
|
+
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
3
5
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
4
|
-
import React, { forwardRef, useRef, useImperativeHandle, Fragment } from 'react';
|
6
|
+
import React, { forwardRef, useRef, useImperativeHandle, Fragment, useCallback } from 'react';
|
5
7
|
import { useBreadcrumbs } from '@react-aria/breadcrumbs';
|
6
8
|
import PropTypes from 'prop-types';
|
7
9
|
import { mergeProps } from '@react-aria/utils';
|
@@ -21,7 +23,12 @@ var Breadcrumbs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
21
23
|
icon = props.icon,
|
22
24
|
iconProps = props.iconProps,
|
23
25
|
onAction = props.onAction,
|
24
|
-
others = _objectWithoutProperties(props, ["children", "icon", "iconProps", "onAction"]);
|
26
|
+
others = _objectWithoutProperties(props, ["children", "icon", "iconProps", "onAction"]); // the following filters undefined values passed as a child
|
27
|
+
|
28
|
+
|
29
|
+
var filteredChildren = _Array$isArray(children) ? _filterInstanceProperty(children).call(children, function (child) {
|
30
|
+
return child;
|
31
|
+
}) : children;
|
25
32
|
|
26
33
|
var _useBreadcrumbs = useBreadcrumbs(props),
|
27
34
|
wrapperProps = _useBreadcrumbs.navProps;
|
@@ -33,26 +40,28 @@ var Breadcrumbs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
33
40
|
useImperativeHandle(ref, function () {
|
34
41
|
return breadcrumbsRef.current;
|
35
42
|
});
|
36
|
-
|
37
|
-
|
38
|
-
display: "flex",
|
39
|
-
flexDirection: "row",
|
40
|
-
alignItems: "center",
|
41
|
-
sx: {
|
42
|
-
overflow: 'auto'
|
43
|
-
}
|
44
|
-
}, mergeProps(wrapperProps, others)), _mapInstanceProperty(children).call(children, function (child, idx) {
|
43
|
+
var createBreadcrumb = useCallback(function (child, idx) {
|
44
|
+
var isCurrentItem = _Array$isArray(filteredChildren) && filteredChildren.length > 1 ? idx === children.length - 1 : true;
|
45
45
|
return ___EmotionJSX(Fragment, {
|
46
46
|
key: "fragment-".concat(child.key)
|
47
47
|
}, ___EmotionJSX(BreadcrumbItem, _extends({
|
48
48
|
"data-id": child['data-id'],
|
49
|
-
isCurrent:
|
49
|
+
isCurrent: isCurrentItem,
|
50
50
|
onAction: onAction,
|
51
51
|
actionKey: child.key
|
52
|
-
}, child.props), child.props.children), icon &&
|
52
|
+
}, child.props), child.props.children), icon && !isCurrentItem && ___EmotionJSX(Icon, _extends({
|
53
53
|
icon: icon
|
54
54
|
}, iconProps)));
|
55
|
-
})
|
55
|
+
}, [children.length, filteredChildren, icon, iconProps, onAction]);
|
56
|
+
return ___EmotionJSX(Box, _extends({
|
57
|
+
ref: breadcrumbsRef,
|
58
|
+
display: "flex",
|
59
|
+
flexDirection: "row",
|
60
|
+
alignItems: "center",
|
61
|
+
sx: {
|
62
|
+
overflow: 'auto'
|
63
|
+
}
|
64
|
+
}, mergeProps(wrapperProps, others)), _Array$isArray(filteredChildren) ? _mapInstanceProperty(filteredChildren).call(filteredChildren, createBreadcrumb) : createBreadcrumb(children));
|
56
65
|
});
|
57
66
|
Breadcrumbs.propTypes = {
|
58
67
|
/** The icon to render in between each node. */
|
@@ -89,4 +89,13 @@ test('Item accepts a data-id and the data-id can be found in the DOM', function
|
|
89
89
|
var item = screen.getByText(testItemsArr[0]);
|
90
90
|
expect(item).toBeInTheDocument();
|
91
91
|
expect(item).toHaveAttribute('data-id', testItemsArr[0]);
|
92
|
+
});
|
93
|
+
test('will render correctly with single child item', function () {
|
94
|
+
render(___EmotionJSX(Breadcrumbs, mergeProps(defaultProps), ___EmotionJSX(Item, {
|
95
|
+
key: testItemsArr[0],
|
96
|
+
"data-id": testItemsArr[0],
|
97
|
+
isCurrent: true
|
98
|
+
}, testItemsArr[0])));
|
99
|
+
expect(screen.getByTestId(testId)).toBeInTheDocument();
|
100
|
+
expect(screen.getByText(testItemsArr[0])).toBeInTheDocument();
|
92
101
|
});
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import React, { forwardRef } from 'react';
|
3
3
|
import ContentCopy from 'mdi-react/ContentCopyIcon';
|
4
|
+
import { omit } from 'lodash';
|
5
|
+
import PropTypes from 'prop-types';
|
4
6
|
import Icon from '../Icon';
|
5
7
|
import IconButton from '../IconButton';
|
6
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -9,9 +11,12 @@ var CopyButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
9
11
|
ref: ref,
|
10
12
|
"aria-label": "copy",
|
11
13
|
variant: "buttons.copy"
|
12
|
-
}, props), ___EmotionJSX(Icon, {
|
14
|
+
}, omit(props, 'iconProps')), ___EmotionJSX(Icon, _extends({
|
13
15
|
icon: ContentCopy,
|
14
16
|
size: 15
|
15
|
-
}));
|
17
|
+
}, props === null || props === void 0 ? void 0 : props.iconProps)));
|
16
18
|
});
|
19
|
+
CopyButton.propTypes = {
|
20
|
+
iconProps: PropTypes.shape({})
|
21
|
+
};
|
17
22
|
export default CopyButton;
|