@pingux/astro 2.72.0-alpha.0 → 2.72.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/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +2 -2
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.d.ts +0 -2
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.js +52 -177
- package/lib/cjs/styles/templates/Nav/HeaderBar.js +1 -1
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +2 -2
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.js +50 -173
- package/lib/styles/templates/Nav/HeaderBar.js +1 -1
- package/package.json +1 -1
@@ -268,7 +268,6 @@ var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
268
268
|
onClose: handlePopoverClose,
|
269
269
|
hasNoArrow: true,
|
270
270
|
isDismissable: true,
|
271
|
-
p: 10,
|
272
271
|
role: "presentation"
|
273
272
|
}), (0, _react2.jsx)(_reactAria.FocusScope, {
|
274
273
|
restoreFocus: true,
|
@@ -280,7 +279,8 @@ var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
280
279
|
placeholder: "Search",
|
281
280
|
"aria-label": "Items Search",
|
282
281
|
"data-testid": "Environment-Breadcrumb-Search",
|
283
|
-
onChange: setSearchValue
|
282
|
+
onChange: setSearchValue,
|
283
|
+
p: "10px"
|
284
284
|
}, searchProps)), (0, _react2.jsx)(_visuallyHidden.VisuallyHidden, {
|
285
285
|
role: "alert",
|
286
286
|
"aria-live": "polite",
|
@@ -4,9 +4,7 @@ import { EnvironmentBreadcrumbProps, EnvironmentItemProps } from '../../types';
|
|
4
4
|
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
5
5
|
export default _default;
|
6
6
|
export declare const Default: StoryFn<EnvironmentBreadcrumbProps<EnvironmentItemProps>>;
|
7
|
-
export declare const DefaultClosed: (args: EnvironmentBreadcrumbProps<EnvironmentItemProps>) => React.JSX.Element;
|
8
7
|
export declare const WithSections: () => React.JSX.Element;
|
9
8
|
export declare const OrgLevel: () => React.JSX.Element;
|
10
9
|
export declare const DefaultOpen: () => React.JSX.Element;
|
11
10
|
export declare const ControlledMenu: () => React.JSX.Element;
|
12
|
-
export declare const RightAlignedBadges: (args: EnvironmentBreadcrumbProps<EnvironmentItemProps>) => React.JSX.Element;
|
@@ -14,7 +14,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
14
14
|
_Object$defineProperty(exports, "__esModule", {
|
15
15
|
value: true
|
16
16
|
});
|
17
|
-
exports["default"] = exports.WithSections = exports.
|
17
|
+
exports["default"] = exports.WithSections = exports.OrgLevel = exports.DefaultOpen = exports.Default = exports.ControlledMenu = void 0;
|
18
18
|
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
19
19
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
20
20
|
var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
|
@@ -112,17 +112,6 @@ var environmentsWithSections = [{
|
|
112
112
|
}, {
|
113
113
|
name: 'Mine'
|
114
114
|
}]
|
115
|
-
}, {
|
116
|
-
name: 'Other',
|
117
|
-
key: 'Other',
|
118
|
-
options: [{
|
119
|
-
name: 'Default'
|
120
|
-
}, {
|
121
|
-
name: 'Auth test',
|
122
|
-
isSandbox: true
|
123
|
-
}, {
|
124
|
-
name: 'Mike’s Workforce'
|
125
|
-
}]
|
126
115
|
}];
|
127
116
|
var Default = function Default(args) {
|
128
117
|
var _useState = (0, _react.useState)(defaultEnvironments[0]),
|
@@ -151,7 +140,7 @@ var Default = function Default(args) {
|
|
151
140
|
};
|
152
141
|
return (0, _react2.jsx)(_index.EnvironmentBreadcrumb, (0, _extends2["default"])({}, args, {
|
153
142
|
items: defaultEnvironments,
|
154
|
-
name: "
|
143
|
+
name: "Organization",
|
155
144
|
selectedItem: envNode,
|
156
145
|
onSelectionChange: handleSelectionChange
|
157
146
|
}), function (_ref2) {
|
@@ -163,71 +152,28 @@ var Default = function Default(args) {
|
|
163
152
|
}, name, isSandbox ? (0, _react2.jsx)(_index.Badge, {
|
164
153
|
label: "SANDBOX",
|
165
154
|
variant: "environmentBadge",
|
166
|
-
bg: "neutral.40"
|
155
|
+
bg: "neutral.40",
|
156
|
+
align: "right"
|
167
157
|
}) : null);
|
168
158
|
});
|
169
159
|
};
|
170
160
|
exports.Default = Default;
|
171
|
-
var DefaultClosed = function DefaultClosed(args) {
|
172
|
-
var _useState3 = (0, _react.useState)(defaultEnvironments[0]),
|
173
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
174
|
-
selectedEnvironment = _useState4[0],
|
175
|
-
setSelectedEnvironment = _useState4[1];
|
176
|
-
var envNode = (0, _react2.jsx)(_index.Box, {
|
177
|
-
isRow: true,
|
178
|
-
key: selectedEnvironment.name
|
179
|
-
}, (0, _react2.jsx)(_index.Text, {
|
180
|
-
color: "inherit"
|
181
|
-
}, selectedEnvironment.name), selectedEnvironment.isSandbox ? (0, _react2.jsx)(_index.Badge, {
|
182
|
-
label: "SANDBOX",
|
183
|
-
variant: "environmentBadge",
|
184
|
-
bg: "neutral.40"
|
185
|
-
}) : null);
|
186
|
-
var findEnvObj = function findEnvObj(envName) {
|
187
|
-
return (0, _find["default"])(defaultEnvironments).call(defaultEnvironments, function (_ref3) {
|
188
|
-
var name = _ref3.name;
|
189
|
-
return name === envName;
|
190
|
-
});
|
191
|
-
};
|
192
|
-
var handleSelectionChange = function handleSelectionChange(newEnvName) {
|
193
|
-
var envObj = findEnvObj(newEnvName);
|
194
|
-
if ((0, _typeof2["default"])(envObj) === 'object') setSelectedEnvironment(_objectSpread({}, envObj));
|
195
|
-
};
|
196
|
-
return (0, _react2.jsx)(_index.EnvironmentBreadcrumb, (0, _extends2["default"])({}, args, {
|
197
|
-
items: defaultEnvironments,
|
198
|
-
name: "Globochem",
|
199
|
-
selectedItem: envNode,
|
200
|
-
onSelectionChange: handleSelectionChange
|
201
|
-
}), function (_ref4) {
|
202
|
-
var name = _ref4.name,
|
203
|
-
isSandbox = _ref4.isSandbox;
|
204
|
-
return (0, _react2.jsx)(_index.Item, {
|
205
|
-
key: name,
|
206
|
-
textValue: name
|
207
|
-
}, name, isSandbox ? (0, _react2.jsx)(_index.Badge, {
|
208
|
-
label: "SANDBOX",
|
209
|
-
variant: "environmentBadge",
|
210
|
-
bg: "neutral.40"
|
211
|
-
}) : null);
|
212
|
-
});
|
213
|
-
};
|
214
|
-
exports.DefaultClosed = DefaultClosed;
|
215
161
|
var WithSections = function WithSections() {
|
216
162
|
var _context, _context2;
|
217
163
|
var selectedSectionIndex = 0;
|
218
164
|
var selectedOptionIndex = 0;
|
219
|
-
var
|
165
|
+
var _useState3 = (0, _react.useState)(environmentsWithSections),
|
166
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
167
|
+
environments = _useState4[0],
|
168
|
+
setEnvironments = _useState4[1];
|
169
|
+
var _useState5 = (0, _react.useState)(null),
|
220
170
|
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
221
|
-
|
222
|
-
|
223
|
-
var _useState7 = (0, _react.useState)(
|
171
|
+
filteredOptionsNumber = _useState6[0],
|
172
|
+
setFilteredOptionsNumber = _useState6[1];
|
173
|
+
var _useState7 = (0, _react.useState)(environmentsWithSections[selectedSectionIndex].options && environmentsWithSections[selectedSectionIndex].options[selectedOptionIndex]),
|
224
174
|
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
225
|
-
|
226
|
-
|
227
|
-
var _useState9 = (0, _react.useState)(environmentsWithSections[selectedSectionIndex].options && environmentsWithSections[selectedSectionIndex].options[selectedOptionIndex]),
|
228
|
-
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
229
|
-
selectedEnvironment = _useState10[0],
|
230
|
-
setSelectedEnvironment = _useState10[1];
|
175
|
+
selectedEnvironment = _useState8[0],
|
176
|
+
setSelectedEnvironment = _useState8[1];
|
231
177
|
var selectedKey = (0, _concat["default"])(_context = "".concat(environmentsWithSections[selectedSectionIndex].key, "-")).call(_context, selectedEnvironment === null || selectedEnvironment === void 0 ? void 0 : selectedEnvironment.name);
|
232
178
|
var recentEnvShown = 3;
|
233
179
|
var totalOptionsNumber = (0, _reduce["default"])(environmentsWithSections).call(environmentsWithSections, function (acc, section) {
|
@@ -296,25 +242,25 @@ var WithSections = function WithSections() {
|
|
296
242
|
}) : null);
|
297
243
|
return (0, _react2.jsx)(_index.EnvironmentBreadcrumb, {
|
298
244
|
items: environments,
|
299
|
-
name: "
|
245
|
+
name: "Organization",
|
300
246
|
selectedItem: envNode,
|
301
247
|
onSelectionChange: handleEnvPress,
|
302
248
|
onFilteredOptionsNumber: setFilteredOptionsNumber,
|
303
249
|
optionsCountMessage: optionsCountMessage,
|
304
250
|
isDefaultOpen: true
|
305
|
-
}, function (
|
306
|
-
var sectionName =
|
307
|
-
sectionOptions =
|
308
|
-
sectionKey =
|
251
|
+
}, function (_ref3) {
|
252
|
+
var sectionName = _ref3.name,
|
253
|
+
sectionOptions = _ref3.options,
|
254
|
+
sectionKey = _ref3.key;
|
309
255
|
return (0, _react2.jsx)(_index.Section, {
|
310
256
|
key: sectionKey,
|
311
257
|
title: sectionName,
|
312
258
|
items: sectionOptions
|
313
|
-
}, function (
|
259
|
+
}, function (_ref4) {
|
314
260
|
var _context7;
|
315
|
-
var itemName =
|
316
|
-
itemOptions =
|
317
|
-
isSandbox =
|
261
|
+
var itemName = _ref4.name,
|
262
|
+
itemOptions = _ref4.options,
|
263
|
+
isSandbox = _ref4.isSandbox;
|
318
264
|
return (0, _react2.jsx)(_index.Item, {
|
319
265
|
key: (0, _concat["default"])(_context7 = "".concat(sectionName, "-")).call(_context7, itemName),
|
320
266
|
childItems: itemOptions,
|
@@ -324,7 +270,8 @@ var WithSections = function WithSections() {
|
|
324
270
|
}, itemName, isSandbox ? (0, _react2.jsx)(_index.Badge, {
|
325
271
|
label: "SANDBOX",
|
326
272
|
variant: "environmentBadge",
|
327
|
-
bg: "neutral.40"
|
273
|
+
bg: "neutral.40",
|
274
|
+
align: "right"
|
328
275
|
}) : null));
|
329
276
|
});
|
330
277
|
});
|
@@ -332,15 +279,15 @@ var WithSections = function WithSections() {
|
|
332
279
|
exports.WithSections = WithSections;
|
333
280
|
var OrgLevel = function OrgLevel() {
|
334
281
|
return (0, _react2.jsx)(_index.EnvironmentBreadcrumb, {
|
335
|
-
name: "
|
282
|
+
name: "Organization"
|
336
283
|
});
|
337
284
|
};
|
338
285
|
exports.OrgLevel = OrgLevel;
|
339
286
|
var DefaultOpen = function DefaultOpen() {
|
340
|
-
var
|
341
|
-
|
342
|
-
selectedEnvironment =
|
343
|
-
setSelectedEnvironment =
|
287
|
+
var _useState9 = (0, _react.useState)(defaultEnvironments[0]),
|
288
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
289
|
+
selectedEnvironment = _useState10[0],
|
290
|
+
setSelectedEnvironment = _useState10[1];
|
344
291
|
var envNode = (0, _react2.jsx)(_index.Box, {
|
345
292
|
isRow: true,
|
346
293
|
key: selectedEnvironment.name
|
@@ -352,8 +299,8 @@ var DefaultOpen = function DefaultOpen() {
|
|
352
299
|
bg: "neutral.40"
|
353
300
|
}) : null);
|
354
301
|
var findEnvObj = function findEnvObj(envName) {
|
355
|
-
return (0, _find["default"])(defaultEnvironments).call(defaultEnvironments, function (
|
356
|
-
var name =
|
302
|
+
return (0, _find["default"])(defaultEnvironments).call(defaultEnvironments, function (_ref5) {
|
303
|
+
var name = _ref5.name;
|
357
304
|
return name === envName;
|
358
305
|
});
|
359
306
|
};
|
@@ -363,33 +310,34 @@ var DefaultOpen = function DefaultOpen() {
|
|
363
310
|
};
|
364
311
|
return (0, _react2.jsx)(_index.EnvironmentBreadcrumb, {
|
365
312
|
items: defaultEnvironments,
|
366
|
-
name: "
|
313
|
+
name: "Organization",
|
367
314
|
selectedItem: envNode,
|
368
315
|
onSelectionChange: handleSelectionChange,
|
369
316
|
isDefaultOpen: true
|
370
|
-
}, function (
|
371
|
-
var name =
|
372
|
-
isSandbox =
|
317
|
+
}, function (_ref6) {
|
318
|
+
var name = _ref6.name,
|
319
|
+
isSandbox = _ref6.isSandbox;
|
373
320
|
return (0, _react2.jsx)(_index.Item, {
|
374
321
|
key: name,
|
375
322
|
textValue: name
|
376
323
|
}, name, isSandbox ? (0, _react2.jsx)(_index.Badge, {
|
377
324
|
label: "SANDBOX",
|
378
325
|
variant: "environmentBadge",
|
379
|
-
bg: "neutral.40"
|
326
|
+
bg: "neutral.40",
|
327
|
+
align: "right"
|
380
328
|
}) : null);
|
381
329
|
});
|
382
330
|
};
|
383
331
|
exports.DefaultOpen = DefaultOpen;
|
384
332
|
var ControlledMenu = function ControlledMenu() {
|
385
|
-
var
|
333
|
+
var _useState11 = (0, _react.useState)(false),
|
334
|
+
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
335
|
+
isOpen = _useState12[0],
|
336
|
+
setIsOpen = _useState12[1];
|
337
|
+
var _useState13 = (0, _react.useState)(defaultEnvironments[0]),
|
386
338
|
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
387
|
-
|
388
|
-
|
389
|
-
var _useState15 = (0, _react.useState)(defaultEnvironments[0]),
|
390
|
-
_useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
|
391
|
-
selectedEnvironment = _useState16[0],
|
392
|
-
setSelectedEnvironment = _useState16[1];
|
339
|
+
selectedEnvironment = _useState14[0],
|
340
|
+
setSelectedEnvironment = _useState14[1];
|
393
341
|
var envNode = (0, _react2.jsx)(_index.Box, {
|
394
342
|
isRow: true,
|
395
343
|
key: selectedEnvironment.name
|
@@ -401,8 +349,8 @@ var ControlledMenu = function ControlledMenu() {
|
|
401
349
|
bg: "neutral.40"
|
402
350
|
}) : null);
|
403
351
|
var findEnvObj = function findEnvObj(envName) {
|
404
|
-
return (0, _find["default"])(defaultEnvironments).call(defaultEnvironments, function (
|
405
|
-
var name =
|
352
|
+
return (0, _find["default"])(defaultEnvironments).call(defaultEnvironments, function (_ref7) {
|
353
|
+
var name = _ref7.name;
|
406
354
|
return name === envName;
|
407
355
|
});
|
408
356
|
};
|
@@ -412,87 +360,14 @@ var ControlledMenu = function ControlledMenu() {
|
|
412
360
|
};
|
413
361
|
return (0, _react2.jsx)(_index.EnvironmentBreadcrumb, {
|
414
362
|
items: defaultEnvironments,
|
415
|
-
name: "
|
363
|
+
name: "Organization",
|
416
364
|
selectedItem: envNode,
|
417
365
|
onSelectionChange: handleSelectionChange,
|
418
366
|
isOpen: isOpen,
|
419
367
|
onOpenChange: setIsOpen
|
420
|
-
}, function (
|
421
|
-
var name =
|
422
|
-
isSandbox =
|
423
|
-
return (0, _react2.jsx)(_index.Item, {
|
424
|
-
key: name,
|
425
|
-
textValue: name
|
426
|
-
}, name, isSandbox ? (0, _react2.jsx)(_index.Badge, {
|
427
|
-
label: "SANDBOX",
|
428
|
-
variant: "environmentBadge",
|
429
|
-
bg: "neutral.40"
|
430
|
-
}) : null);
|
431
|
-
});
|
432
|
-
};
|
433
|
-
exports.ControlledMenu = ControlledMenu;
|
434
|
-
var RightAlignedBadges = function RightAlignedBadges(args) {
|
435
|
-
var items = [{
|
436
|
-
name: 'Default'
|
437
|
-
}, {
|
438
|
-
name: 'Kangaroo',
|
439
|
-
isSandbox: true
|
440
|
-
}, {
|
441
|
-
name: 'Snake',
|
442
|
-
isSandbox: true
|
443
|
-
}, {
|
444
|
-
name: 'Snail'
|
445
|
-
}, {
|
446
|
-
name: 'Slug',
|
447
|
-
isSandbox: true
|
448
|
-
}, {
|
449
|
-
name: 'Crow'
|
450
|
-
}, {
|
451
|
-
name: 'Dog'
|
452
|
-
}, {
|
453
|
-
name: 'Crab',
|
454
|
-
isSandbox: true
|
455
|
-
}, {
|
456
|
-
name: 'Fish',
|
457
|
-
isSandbox: true
|
458
|
-
}, {
|
459
|
-
name: 'Turtle',
|
460
|
-
isSandbox: true
|
461
|
-
}, {
|
462
|
-
name: 'Mouse'
|
463
|
-
}];
|
464
|
-
var _useState17 = (0, _react.useState)(items[0]),
|
465
|
-
_useState18 = (0, _slicedToArray2["default"])(_useState17, 2),
|
466
|
-
selectedEnvironment = _useState18[0],
|
467
|
-
setSelectedEnvironment = _useState18[1];
|
468
|
-
var envNode = (0, _react2.jsx)(_index.Box, {
|
469
|
-
isRow: true,
|
470
|
-
key: selectedEnvironment.name
|
471
|
-
}, (0, _react2.jsx)(_index.Text, {
|
472
|
-
color: "inherit"
|
473
|
-
}, selectedEnvironment.name), selectedEnvironment.isSandbox ? (0, _react2.jsx)(_index.Badge, {
|
474
|
-
label: "SANDBOX",
|
475
|
-
variant: "environmentBadge",
|
476
|
-
bg: "neutral.40"
|
477
|
-
}) : null);
|
478
|
-
var findEnvObj = function findEnvObj(envName) {
|
479
|
-
return (0, _find["default"])(items).call(items, function (_ref11) {
|
480
|
-
var name = _ref11.name;
|
481
|
-
return name === envName;
|
482
|
-
});
|
483
|
-
};
|
484
|
-
var handleSelectionChange = function handleSelectionChange(newEnvName) {
|
485
|
-
var envObj = findEnvObj(newEnvName);
|
486
|
-
if ((0, _typeof2["default"])(envObj) === 'object') setSelectedEnvironment(_objectSpread({}, envObj));
|
487
|
-
};
|
488
|
-
return (0, _react2.jsx)(_index.EnvironmentBreadcrumb, (0, _extends2["default"])({}, args, {
|
489
|
-
items: items,
|
490
|
-
name: "Globochem",
|
491
|
-
selectedItem: envNode,
|
492
|
-
onSelectionChange: handleSelectionChange
|
493
|
-
}), function (_ref12) {
|
494
|
-
var name = _ref12.name,
|
495
|
-
isSandbox = _ref12.isSandbox;
|
368
|
+
}, function (_ref8) {
|
369
|
+
var name = _ref8.name,
|
370
|
+
isSandbox = _ref8.isSandbox;
|
496
371
|
return (0, _react2.jsx)(_index.Item, {
|
497
372
|
key: name,
|
498
373
|
textValue: name
|
@@ -504,4 +379,4 @@ var RightAlignedBadges = function RightAlignedBadges(args) {
|
|
504
379
|
}) : null);
|
505
380
|
});
|
506
381
|
};
|
507
|
-
exports.
|
382
|
+
exports.ControlledMenu = ControlledMenu;
|
@@ -64,7 +64,7 @@ var HeaderBar = function HeaderBar() {
|
|
64
64
|
isRow: true,
|
65
65
|
alignItems: "center",
|
66
66
|
justifyContent: "space-between"
|
67
|
-
}, (0, _react2.jsx)(_EnvironmentBreadcrumb.
|
67
|
+
}, (0, _react2.jsx)(_EnvironmentBreadcrumb.Default, null), (0, _react2.jsx)(_index.Box, {
|
68
68
|
isRow: true
|
69
69
|
}, (0, _react2.jsx)(_index.Box, {
|
70
70
|
isRow: true,
|
@@ -254,7 +254,6 @@ var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
254
254
|
onClose: handlePopoverClose,
|
255
255
|
hasNoArrow: true,
|
256
256
|
isDismissable: true,
|
257
|
-
p: 10,
|
258
257
|
role: "presentation"
|
259
258
|
}), ___EmotionJSX(FocusScope, {
|
260
259
|
restoreFocus: true,
|
@@ -266,7 +265,8 @@ var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
266
265
|
placeholder: "Search",
|
267
266
|
"aria-label": "Items Search",
|
268
267
|
"data-testid": "Environment-Breadcrumb-Search",
|
269
|
-
onChange: setSearchValue
|
268
|
+
onChange: setSearchValue,
|
269
|
+
p: "10px"
|
270
270
|
}, searchProps)), ___EmotionJSX(VisuallyHidden, {
|
271
271
|
role: "alert",
|
272
272
|
"aria-live": "polite",
|
@@ -99,17 +99,6 @@ var environmentsWithSections = [{
|
|
99
99
|
}, {
|
100
100
|
name: 'Mine'
|
101
101
|
}]
|
102
|
-
}, {
|
103
|
-
name: 'Other',
|
104
|
-
key: 'Other',
|
105
|
-
options: [{
|
106
|
-
name: 'Default'
|
107
|
-
}, {
|
108
|
-
name: 'Auth test',
|
109
|
-
isSandbox: true
|
110
|
-
}, {
|
111
|
-
name: 'Mike’s Workforce'
|
112
|
-
}]
|
113
102
|
}];
|
114
103
|
export var Default = function Default(args) {
|
115
104
|
var _useState = useState(defaultEnvironments[0]),
|
@@ -138,7 +127,7 @@ export var Default = function Default(args) {
|
|
138
127
|
};
|
139
128
|
return ___EmotionJSX(EnvironmentBreadcrumb, _extends({}, args, {
|
140
129
|
items: defaultEnvironments,
|
141
|
-
name: "
|
130
|
+
name: "Organization",
|
142
131
|
selectedItem: envNode,
|
143
132
|
onSelectionChange: handleSelectionChange
|
144
133
|
}), function (_ref2) {
|
@@ -150,50 +139,8 @@ export var Default = function Default(args) {
|
|
150
139
|
}, name, isSandbox ? ___EmotionJSX(Badge, {
|
151
140
|
label: "SANDBOX",
|
152
141
|
variant: "environmentBadge",
|
153
|
-
bg: "neutral.40"
|
154
|
-
|
155
|
-
});
|
156
|
-
};
|
157
|
-
export var DefaultClosed = function DefaultClosed(args) {
|
158
|
-
var _useState3 = useState(defaultEnvironments[0]),
|
159
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
160
|
-
selectedEnvironment = _useState4[0],
|
161
|
-
setSelectedEnvironment = _useState4[1];
|
162
|
-
var envNode = ___EmotionJSX(Box, {
|
163
|
-
isRow: true,
|
164
|
-
key: selectedEnvironment.name
|
165
|
-
}, ___EmotionJSX(Text, {
|
166
|
-
color: "inherit"
|
167
|
-
}, selectedEnvironment.name), selectedEnvironment.isSandbox ? ___EmotionJSX(Badge, {
|
168
|
-
label: "SANDBOX",
|
169
|
-
variant: "environmentBadge",
|
170
|
-
bg: "neutral.40"
|
171
|
-
}) : null);
|
172
|
-
var findEnvObj = function findEnvObj(envName) {
|
173
|
-
return _findInstanceProperty(defaultEnvironments).call(defaultEnvironments, function (_ref3) {
|
174
|
-
var name = _ref3.name;
|
175
|
-
return name === envName;
|
176
|
-
});
|
177
|
-
};
|
178
|
-
var handleSelectionChange = function handleSelectionChange(newEnvName) {
|
179
|
-
var envObj = findEnvObj(newEnvName);
|
180
|
-
if (_typeof(envObj) === 'object') setSelectedEnvironment(_objectSpread({}, envObj));
|
181
|
-
};
|
182
|
-
return ___EmotionJSX(EnvironmentBreadcrumb, _extends({}, args, {
|
183
|
-
items: defaultEnvironments,
|
184
|
-
name: "Globochem",
|
185
|
-
selectedItem: envNode,
|
186
|
-
onSelectionChange: handleSelectionChange
|
187
|
-
}), function (_ref4) {
|
188
|
-
var name = _ref4.name,
|
189
|
-
isSandbox = _ref4.isSandbox;
|
190
|
-
return ___EmotionJSX(Item, {
|
191
|
-
key: name,
|
192
|
-
textValue: name
|
193
|
-
}, name, isSandbox ? ___EmotionJSX(Badge, {
|
194
|
-
label: "SANDBOX",
|
195
|
-
variant: "environmentBadge",
|
196
|
-
bg: "neutral.40"
|
142
|
+
bg: "neutral.40",
|
143
|
+
align: "right"
|
197
144
|
}) : null);
|
198
145
|
});
|
199
146
|
};
|
@@ -201,18 +148,18 @@ export var WithSections = function WithSections() {
|
|
201
148
|
var _context, _context2;
|
202
149
|
var selectedSectionIndex = 0;
|
203
150
|
var selectedOptionIndex = 0;
|
204
|
-
var
|
151
|
+
var _useState3 = useState(environmentsWithSections),
|
152
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
153
|
+
environments = _useState4[0],
|
154
|
+
setEnvironments = _useState4[1];
|
155
|
+
var _useState5 = useState(null),
|
205
156
|
_useState6 = _slicedToArray(_useState5, 2),
|
206
|
-
|
207
|
-
|
208
|
-
var _useState7 = useState(
|
157
|
+
filteredOptionsNumber = _useState6[0],
|
158
|
+
setFilteredOptionsNumber = _useState6[1];
|
159
|
+
var _useState7 = useState(environmentsWithSections[selectedSectionIndex].options && environmentsWithSections[selectedSectionIndex].options[selectedOptionIndex]),
|
209
160
|
_useState8 = _slicedToArray(_useState7, 2),
|
210
|
-
|
211
|
-
|
212
|
-
var _useState9 = useState(environmentsWithSections[selectedSectionIndex].options && environmentsWithSections[selectedSectionIndex].options[selectedOptionIndex]),
|
213
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
214
|
-
selectedEnvironment = _useState10[0],
|
215
|
-
setSelectedEnvironment = _useState10[1];
|
161
|
+
selectedEnvironment = _useState8[0],
|
162
|
+
setSelectedEnvironment = _useState8[1];
|
216
163
|
var selectedKey = _concatInstanceProperty(_context = "".concat(environmentsWithSections[selectedSectionIndex].key, "-")).call(_context, selectedEnvironment === null || selectedEnvironment === void 0 ? void 0 : selectedEnvironment.name);
|
217
164
|
var recentEnvShown = 3;
|
218
165
|
var totalOptionsNumber = _reduceInstanceProperty(environmentsWithSections).call(environmentsWithSections, function (acc, section) {
|
@@ -281,25 +228,25 @@ export var WithSections = function WithSections() {
|
|
281
228
|
}) : null);
|
282
229
|
return ___EmotionJSX(EnvironmentBreadcrumb, {
|
283
230
|
items: environments,
|
284
|
-
name: "
|
231
|
+
name: "Organization",
|
285
232
|
selectedItem: envNode,
|
286
233
|
onSelectionChange: handleEnvPress,
|
287
234
|
onFilteredOptionsNumber: setFilteredOptionsNumber,
|
288
235
|
optionsCountMessage: optionsCountMessage,
|
289
236
|
isDefaultOpen: true
|
290
|
-
}, function (
|
291
|
-
var sectionName =
|
292
|
-
sectionOptions =
|
293
|
-
sectionKey =
|
237
|
+
}, function (_ref3) {
|
238
|
+
var sectionName = _ref3.name,
|
239
|
+
sectionOptions = _ref3.options,
|
240
|
+
sectionKey = _ref3.key;
|
294
241
|
return ___EmotionJSX(Section, {
|
295
242
|
key: sectionKey,
|
296
243
|
title: sectionName,
|
297
244
|
items: sectionOptions
|
298
|
-
}, function (
|
245
|
+
}, function (_ref4) {
|
299
246
|
var _context7;
|
300
|
-
var itemName =
|
301
|
-
itemOptions =
|
302
|
-
isSandbox =
|
247
|
+
var itemName = _ref4.name,
|
248
|
+
itemOptions = _ref4.options,
|
249
|
+
isSandbox = _ref4.isSandbox;
|
303
250
|
return ___EmotionJSX(Item, {
|
304
251
|
key: _concatInstanceProperty(_context7 = "".concat(sectionName, "-")).call(_context7, itemName),
|
305
252
|
childItems: itemOptions,
|
@@ -309,21 +256,22 @@ export var WithSections = function WithSections() {
|
|
309
256
|
}, itemName, isSandbox ? ___EmotionJSX(Badge, {
|
310
257
|
label: "SANDBOX",
|
311
258
|
variant: "environmentBadge",
|
312
|
-
bg: "neutral.40"
|
259
|
+
bg: "neutral.40",
|
260
|
+
align: "right"
|
313
261
|
}) : null));
|
314
262
|
});
|
315
263
|
});
|
316
264
|
};
|
317
265
|
export var OrgLevel = function OrgLevel() {
|
318
266
|
return ___EmotionJSX(EnvironmentBreadcrumb, {
|
319
|
-
name: "
|
267
|
+
name: "Organization"
|
320
268
|
});
|
321
269
|
};
|
322
270
|
export var DefaultOpen = function DefaultOpen() {
|
323
|
-
var
|
324
|
-
|
325
|
-
selectedEnvironment =
|
326
|
-
setSelectedEnvironment =
|
271
|
+
var _useState9 = useState(defaultEnvironments[0]),
|
272
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
273
|
+
selectedEnvironment = _useState10[0],
|
274
|
+
setSelectedEnvironment = _useState10[1];
|
327
275
|
var envNode = ___EmotionJSX(Box, {
|
328
276
|
isRow: true,
|
329
277
|
key: selectedEnvironment.name
|
@@ -335,8 +283,8 @@ export var DefaultOpen = function DefaultOpen() {
|
|
335
283
|
bg: "neutral.40"
|
336
284
|
}) : null);
|
337
285
|
var findEnvObj = function findEnvObj(envName) {
|
338
|
-
return _findInstanceProperty(defaultEnvironments).call(defaultEnvironments, function (
|
339
|
-
var name =
|
286
|
+
return _findInstanceProperty(defaultEnvironments).call(defaultEnvironments, function (_ref5) {
|
287
|
+
var name = _ref5.name;
|
340
288
|
return name === envName;
|
341
289
|
});
|
342
290
|
};
|
@@ -346,32 +294,33 @@ export var DefaultOpen = function DefaultOpen() {
|
|
346
294
|
};
|
347
295
|
return ___EmotionJSX(EnvironmentBreadcrumb, {
|
348
296
|
items: defaultEnvironments,
|
349
|
-
name: "
|
297
|
+
name: "Organization",
|
350
298
|
selectedItem: envNode,
|
351
299
|
onSelectionChange: handleSelectionChange,
|
352
300
|
isDefaultOpen: true
|
353
|
-
}, function (
|
354
|
-
var name =
|
355
|
-
isSandbox =
|
301
|
+
}, function (_ref6) {
|
302
|
+
var name = _ref6.name,
|
303
|
+
isSandbox = _ref6.isSandbox;
|
356
304
|
return ___EmotionJSX(Item, {
|
357
305
|
key: name,
|
358
306
|
textValue: name
|
359
307
|
}, name, isSandbox ? ___EmotionJSX(Badge, {
|
360
308
|
label: "SANDBOX",
|
361
309
|
variant: "environmentBadge",
|
362
|
-
bg: "neutral.40"
|
310
|
+
bg: "neutral.40",
|
311
|
+
align: "right"
|
363
312
|
}) : null);
|
364
313
|
});
|
365
314
|
};
|
366
315
|
export var ControlledMenu = function ControlledMenu() {
|
367
|
-
var
|
316
|
+
var _useState11 = useState(false),
|
317
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
318
|
+
isOpen = _useState12[0],
|
319
|
+
setIsOpen = _useState12[1];
|
320
|
+
var _useState13 = useState(defaultEnvironments[0]),
|
368
321
|
_useState14 = _slicedToArray(_useState13, 2),
|
369
|
-
|
370
|
-
|
371
|
-
var _useState15 = useState(defaultEnvironments[0]),
|
372
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
373
|
-
selectedEnvironment = _useState16[0],
|
374
|
-
setSelectedEnvironment = _useState16[1];
|
322
|
+
selectedEnvironment = _useState14[0],
|
323
|
+
setSelectedEnvironment = _useState14[1];
|
375
324
|
var envNode = ___EmotionJSX(Box, {
|
376
325
|
isRow: true,
|
377
326
|
key: selectedEnvironment.name
|
@@ -383,8 +332,8 @@ export var ControlledMenu = function ControlledMenu() {
|
|
383
332
|
bg: "neutral.40"
|
384
333
|
}) : null);
|
385
334
|
var findEnvObj = function findEnvObj(envName) {
|
386
|
-
return _findInstanceProperty(defaultEnvironments).call(defaultEnvironments, function (
|
387
|
-
var name =
|
335
|
+
return _findInstanceProperty(defaultEnvironments).call(defaultEnvironments, function (_ref7) {
|
336
|
+
var name = _ref7.name;
|
388
337
|
return name === envName;
|
389
338
|
});
|
390
339
|
};
|
@@ -394,86 +343,14 @@ export var ControlledMenu = function ControlledMenu() {
|
|
394
343
|
};
|
395
344
|
return ___EmotionJSX(EnvironmentBreadcrumb, {
|
396
345
|
items: defaultEnvironments,
|
397
|
-
name: "
|
346
|
+
name: "Organization",
|
398
347
|
selectedItem: envNode,
|
399
348
|
onSelectionChange: handleSelectionChange,
|
400
349
|
isOpen: isOpen,
|
401
350
|
onOpenChange: setIsOpen
|
402
|
-
}, function (
|
403
|
-
var name =
|
404
|
-
isSandbox =
|
405
|
-
return ___EmotionJSX(Item, {
|
406
|
-
key: name,
|
407
|
-
textValue: name
|
408
|
-
}, name, isSandbox ? ___EmotionJSX(Badge, {
|
409
|
-
label: "SANDBOX",
|
410
|
-
variant: "environmentBadge",
|
411
|
-
bg: "neutral.40"
|
412
|
-
}) : null);
|
413
|
-
});
|
414
|
-
};
|
415
|
-
export var RightAlignedBadges = function RightAlignedBadges(args) {
|
416
|
-
var items = [{
|
417
|
-
name: 'Default'
|
418
|
-
}, {
|
419
|
-
name: 'Kangaroo',
|
420
|
-
isSandbox: true
|
421
|
-
}, {
|
422
|
-
name: 'Snake',
|
423
|
-
isSandbox: true
|
424
|
-
}, {
|
425
|
-
name: 'Snail'
|
426
|
-
}, {
|
427
|
-
name: 'Slug',
|
428
|
-
isSandbox: true
|
429
|
-
}, {
|
430
|
-
name: 'Crow'
|
431
|
-
}, {
|
432
|
-
name: 'Dog'
|
433
|
-
}, {
|
434
|
-
name: 'Crab',
|
435
|
-
isSandbox: true
|
436
|
-
}, {
|
437
|
-
name: 'Fish',
|
438
|
-
isSandbox: true
|
439
|
-
}, {
|
440
|
-
name: 'Turtle',
|
441
|
-
isSandbox: true
|
442
|
-
}, {
|
443
|
-
name: 'Mouse'
|
444
|
-
}];
|
445
|
-
var _useState17 = useState(items[0]),
|
446
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
447
|
-
selectedEnvironment = _useState18[0],
|
448
|
-
setSelectedEnvironment = _useState18[1];
|
449
|
-
var envNode = ___EmotionJSX(Box, {
|
450
|
-
isRow: true,
|
451
|
-
key: selectedEnvironment.name
|
452
|
-
}, ___EmotionJSX(Text, {
|
453
|
-
color: "inherit"
|
454
|
-
}, selectedEnvironment.name), selectedEnvironment.isSandbox ? ___EmotionJSX(Badge, {
|
455
|
-
label: "SANDBOX",
|
456
|
-
variant: "environmentBadge",
|
457
|
-
bg: "neutral.40"
|
458
|
-
}) : null);
|
459
|
-
var findEnvObj = function findEnvObj(envName) {
|
460
|
-
return _findInstanceProperty(items).call(items, function (_ref11) {
|
461
|
-
var name = _ref11.name;
|
462
|
-
return name === envName;
|
463
|
-
});
|
464
|
-
};
|
465
|
-
var handleSelectionChange = function handleSelectionChange(newEnvName) {
|
466
|
-
var envObj = findEnvObj(newEnvName);
|
467
|
-
if (_typeof(envObj) === 'object') setSelectedEnvironment(_objectSpread({}, envObj));
|
468
|
-
};
|
469
|
-
return ___EmotionJSX(EnvironmentBreadcrumb, _extends({}, args, {
|
470
|
-
items: items,
|
471
|
-
name: "Globochem",
|
472
|
-
selectedItem: envNode,
|
473
|
-
onSelectionChange: handleSelectionChange
|
474
|
-
}), function (_ref12) {
|
475
|
-
var name = _ref12.name,
|
476
|
-
isSandbox = _ref12.isSandbox;
|
351
|
+
}, function (_ref8) {
|
352
|
+
var name = _ref8.name,
|
353
|
+
isSandbox = _ref8.isSandbox;
|
477
354
|
return ___EmotionJSX(Item, {
|
478
355
|
key: name,
|
479
356
|
textValue: name
|
@@ -3,7 +3,7 @@ import React, { useState } from 'react';
|
|
3
3
|
import ExploreIcon from '@pingux/mdi-react/CompassOutlineIcon';
|
4
4
|
import HelpCircleOutlineIcon from '@pingux/mdi-react/HelpCircleOutlineIcon';
|
5
5
|
import MenuDownIcon from '@pingux/mdi-react/MenuDownIcon';
|
6
|
-
import {
|
6
|
+
import { Default as EnvironmentBreadcrumb } from '../../../components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories';
|
7
7
|
import { Box, Icon, IconButton, Item, Menu, OverlayProvider, PopoverMenu, Text } from '../../../index';
|
8
8
|
import { PersonIcon } from './NavData';
|
9
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|