@panneau/app 4.0.2 → 4.0.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.
Files changed (2) hide show
  1. package/es/index.js +617 -507
  2. package/package.json +8 -8
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
3
3
  import { useMemoryRouter, createPathToRegexpParser } from '@folklore/routes';
4
- import React$1, { useCallback, useMemo, useState, useEffect, Fragment } from 'react';
4
+ import { useCallback, useMemo, useState, useEffect, Fragment as Fragment$1 } from 'react';
5
5
  import { useLocation, useSearch, Route, Switch, Redirect, Router } from 'wouter';
6
6
  import ActionsProvider from '@panneau/actions';
7
7
  import { useUser, useLogout, useAuth, AuthProvider } from '@panneau/auth';
@@ -19,6 +19,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
19
19
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
20
20
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
21
21
  import isObject from 'lodash-es/isObject';
22
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
22
23
  import classNames from 'classnames';
23
24
  import isString from 'lodash-es/isString';
24
25
  import queryString from 'query-string';
@@ -39,9 +40,8 @@ import ResourceForm from '@panneau/form-resource';
39
40
  import { getComponentFromName } from '@panneau/core/utils';
40
41
  import Filters from '@panneau/filter-filters';
41
42
 
42
- // Kept for backward compatibility with exports
43
43
  function ResourceFormWrapper(props) {
44
- return /*#__PURE__*/React.createElement(ResourceForm, props);
44
+ return /*#__PURE__*/jsx(ResourceForm, _objectSpread({}, props));
45
45
  }
46
46
 
47
47
  function AccountMenu(_ref) {
@@ -63,7 +63,7 @@ function AccountMenu(_ref) {
63
63
  var items = useMemo(function () {
64
64
  return user !== null ? [{
65
65
  id: 'account',
66
- label: /*#__PURE__*/React$1.createElement(FormattedMessage, {
66
+ label: /*#__PURE__*/jsx(FormattedMessage, {
67
67
  id: "IuqEHB",
68
68
  defaultMessage: [{
69
69
  "type": 0,
@@ -72,7 +72,7 @@ function AccountMenu(_ref) {
72
72
  }),
73
73
  href: route('account'),
74
74
  dropdown: [].concat(_toConsumableArray(withAccountForm ? [{
75
- label: /*#__PURE__*/React$1.createElement(FormattedMessage, {
75
+ label: /*#__PURE__*/jsx(FormattedMessage, {
76
76
  id: "V7Us0a",
77
77
  defaultMessage: [{
78
78
  "type": 0,
@@ -81,7 +81,7 @@ function AccountMenu(_ref) {
81
81
  }),
82
82
  href: route('account')
83
83
  }] : []), [{
84
- label: /*#__PURE__*/React$1.createElement(FormattedMessage, {
84
+ label: /*#__PURE__*/jsx(FormattedMessage, {
85
85
  id: "REIcPg",
86
86
  defaultMessage: [{
87
87
  "type": 0,
@@ -92,7 +92,7 @@ function AccountMenu(_ref) {
92
92
  onClick: onClickLogout
93
93
  }])
94
94
  }] : [{
95
- label: /*#__PURE__*/React$1.createElement(FormattedMessage, {
95
+ label: /*#__PURE__*/jsx(FormattedMessage, {
96
96
  id: "d0g58T",
97
97
  defaultMessage: [{
98
98
  "type": 0,
@@ -102,7 +102,7 @@ function AccountMenu(_ref) {
102
102
  href: route('auth.login')
103
103
  }];
104
104
  }, [user, route, onClickLogout, withAccountForm]);
105
- return items !== null ? /*#__PURE__*/React$1.createElement(Menu, {
105
+ return items !== null ? /*#__PURE__*/jsx(Menu, {
106
106
  className: className,
107
107
  itemClassName: itemClassName,
108
108
  linkClassName: linkClassName,
@@ -140,7 +140,7 @@ function ResourcesMenu(_ref) {
140
140
  };
141
141
  });
142
142
  }, [resources, pathname, resourceRoute]);
143
- return /*#__PURE__*/React.createElement(Menu, {
143
+ return /*#__PURE__*/jsx(Menu, {
144
144
  items: items,
145
145
  className: className,
146
146
  itemClassName: itemClassName,
@@ -180,53 +180,53 @@ function MainNavbar(_ref) {
180
180
  return it !== null;
181
181
  }).reduce(function (currentItems, item, index) {
182
182
  if (item === 'resources') {
183
- return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/React.createElement(ResourcesMenu, {
184
- key: "menu-item-resource-".concat(index + 1),
183
+ return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/jsx(ResourcesMenu, {
185
184
  className: navClassNames,
186
185
  itemClassName: "nav-item",
187
186
  linkClassName: "nav-link"
188
- })]);
187
+ }, "menu-item-resource-".concat(index + 1))]);
189
188
  }
190
189
  if (item === 'account') {
191
- return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/React.createElement(AccountMenu, {
192
- key: "menu-item-account-".concat(index + 1),
190
+ return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/jsx(AccountMenu, {
193
191
  className: navClassNames,
194
192
  itemClassName: "nav-item",
195
193
  linkClassName: "nav-link"
196
- })]);
194
+ }, "menu-item-account-".concat(index + 1))]);
197
195
  }
198
196
  if (item === 'separator') {
199
- return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/React.createElement("span", {
200
- key: "menu-item-spacer-".concat(index + 1),
197
+ return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/jsx("span", {
201
198
  className: "ms-auto"
202
- })]);
199
+ }, "menu-item-spacer-".concat(index + 1))]);
203
200
  }
204
201
  var lastItem = currentItems.length > 0 ? currentItems[currentItems.length - 1] : null;
205
202
  return isArray(lastItem) ? [].concat(_toConsumableArray(currentItems.slice(0, currentItems.length - 1)), [[].concat(_toConsumableArray(lastItem), [item])]) : [].concat(_toConsumableArray(currentItems), [[item]]);
206
203
  }, []).map(function (it, index) {
207
- return isArray(it) ? /*#__PURE__*/React.createElement(Menu, {
204
+ return isArray(it) ? /*#__PURE__*/jsx(Menu, {
208
205
  items: it,
209
- key: "submenu-item-".concat(index + 1),
210
206
  className: navClassNames,
211
207
  itemClassName: "nav-item",
212
208
  linkClassName: "nav-link"
213
- }) : it;
209
+ }, "submenu-item-".concat(index + 1)) : it;
214
210
  });
215
211
  }, [main, guest, user, navClassNames]);
216
- return /*#__PURE__*/React.createElement(Navbar, Object.assign({
212
+ return /*#__PURE__*/jsxs(Navbar, _objectSpread(_objectSpread({
217
213
  theme: background,
218
214
  loading: loading,
219
215
  vertical: vertical,
220
216
  className: className
221
- }, props), name !== null ? /*#__PURE__*/React.createElement(Link, {
222
- href: route('home'),
223
- className: "navbar-brand"
224
- }, /*#__PURE__*/React.createElement("span", {
225
- className: classNames([{
226
- 'text-opacity-75': loading,
227
- 'ms-2': vertical
228
- }])
229
- }, name)) : null, items);
217
+ }, props), {}, {
218
+ children: [name !== null ? /*#__PURE__*/jsx(Link, {
219
+ href: route('home'),
220
+ className: "navbar-brand",
221
+ children: /*#__PURE__*/jsx("span", {
222
+ className: classNames([{
223
+ 'text-opacity-75': loading,
224
+ 'ms-2': vertical
225
+ }]),
226
+ children: name
227
+ })
228
+ }) : null, items]
229
+ }));
230
230
  }
231
231
 
232
232
  function MainLayout(_ref) {
@@ -246,35 +246,37 @@ function MainLayout(_ref) {
246
246
  _usePanneauColorSchem5 = _usePanneauColorSchem.text,
247
247
  text = _usePanneauColorSchem5 === void 0 ? null : _usePanneauColorSchem5;
248
248
  var vertical = sidebarPosition === 'left' || sidebarPosition === 'right';
249
- return /*#__PURE__*/React.createElement("div", {
249
+ return /*#__PURE__*/jsxs("div", {
250
250
  className: classNames(['d-flex', 'min-vh-100', {
251
251
  'flex-column': !vertical
252
252
  }]),
253
- "data-bs-theme": theme !== null ? theme : undefined
254
- }, /*#__PURE__*/React.createElement(MainNavbar, {
255
- className: classNames([{
256
- 'shadow-sm': !vertical,
257
- 'border-bottom': !vertical,
258
- 'sticky-top': !vertical,
259
- 'px-3': !vertical,
260
- 'pe-3': vertical && sidebarPosition === 'left',
261
- 'ps-3': vertical && sidebarPosition === 'right',
262
- 'me-2': vertical && sidebarPosition === 'left',
263
- 'ms-2': vertical && sidebarPosition === 'right'
264
- // [styles.navbar]: true,
265
- // [styles[sidebarPosition]]: sidebarPosition !== null,
266
- // [styles.verticalNav]: vertical,
267
- }]),
268
- theme: theme,
269
- loading: loading,
270
- vertical: vertical
271
- }), /*#__PURE__*/React.createElement("div", {
272
- className: classNames(['flex-grow-1', _defineProperty(_defineProperty({
273
- 'd-flex flex-column': fullscreen
274
- }, "bg-".concat(background), background !== null), "text-".concat(text), text !== null)])
275
- }, children), /*#__PURE__*/React.createElement(Modals, {
276
- theme: theme
277
- }));
253
+ "data-bs-theme": theme !== null ? theme : undefined,
254
+ children: [/*#__PURE__*/jsx(MainNavbar, {
255
+ className: classNames([{
256
+ 'shadow-sm': !vertical,
257
+ 'border-bottom': !vertical,
258
+ 'sticky-top': !vertical,
259
+ 'px-3': !vertical,
260
+ 'pe-3': vertical && sidebarPosition === 'left',
261
+ 'ps-3': vertical && sidebarPosition === 'right',
262
+ 'me-2': vertical && sidebarPosition === 'left',
263
+ 'ms-2': vertical && sidebarPosition === 'right'
264
+ // [styles.navbar]: true,
265
+ // [styles[sidebarPosition]]: sidebarPosition !== null,
266
+ // [styles.verticalNav]: vertical,
267
+ }]),
268
+ theme: theme,
269
+ loading: loading,
270
+ vertical: vertical
271
+ }), /*#__PURE__*/jsx("div", {
272
+ className: classNames(['flex-grow-1', _defineProperty(_defineProperty({
273
+ 'd-flex flex-column': fullscreen
274
+ }, "bg-".concat(background), background !== null), "text-".concat(text), text !== null)]),
275
+ children: children
276
+ }), /*#__PURE__*/jsx(Modals, {
277
+ theme: theme
278
+ })]
279
+ });
278
280
  }
279
281
 
280
282
  function PageHeader(_ref) {
@@ -293,22 +295,31 @@ function PageHeader(_ref) {
293
295
  var _usePanneauColorSchem = usePanneauColorScheme(),
294
296
  text = _usePanneauColorSchem.text,
295
297
  background = _usePanneauColorSchem.background;
296
- var inner = /*#__PURE__*/React.createElement("div", {
297
- className: "d-flex align-items-center flex-wrap"
298
- }, title !== null ? /*#__PURE__*/React.createElement("h1", {
299
- className: classNames(['mb-0', 'h2'])
300
- }, /*#__PURE__*/React.createElement(Label, null, title)) : null, actions !== null ? /*#__PURE__*/React.createElement("div", {
301
- className: "ms-auto"
302
- }, actions) : null);
303
- return /*#__PURE__*/React.createElement("div", {
304
- className: classNames(['py-4', _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "bg-".concat(background), background !== null), "text-".concat(text), text !== null), "border-bottom", background || text !== null), className, className !== null)])
305
- }, /*#__PURE__*/React.createElement("div", {
306
- className: "container-sm"
307
- }, small ? /*#__PURE__*/React.createElement("div", {
308
- className: "row justify-content-center"
309
- }, /*#__PURE__*/React.createElement("div", {
310
- className: "col-12 col-md-8 col-lg-7"
311
- }, inner)) : inner), children);
298
+ var inner = /*#__PURE__*/jsxs("div", {
299
+ className: "d-flex align-items-center flex-wrap",
300
+ children: [title !== null ? /*#__PURE__*/jsx("h1", {
301
+ className: classNames(['mb-0', 'h2']),
302
+ children: /*#__PURE__*/jsx(Label, {
303
+ children: title
304
+ })
305
+ }) : null, actions !== null ? /*#__PURE__*/jsx("div", {
306
+ className: "ms-auto",
307
+ children: actions
308
+ }) : null]
309
+ });
310
+ return /*#__PURE__*/jsxs("div", {
311
+ className: classNames(['py-4', _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "bg-".concat(background), background !== null), "text-".concat(text), text !== null), "border-bottom", background || text !== null), className, className !== null)]),
312
+ children: [/*#__PURE__*/jsx("div", {
313
+ className: "container-sm",
314
+ children: small ? /*#__PURE__*/jsx("div", {
315
+ className: "row justify-content-center",
316
+ children: /*#__PURE__*/jsx("div", {
317
+ className: "col-12 col-md-8 col-lg-7",
318
+ children: inner
319
+ })
320
+ }) : inner
321
+ }), children]
322
+ });
312
323
  }
313
324
 
314
325
  function ResourceCreatePage(_ref) {
@@ -330,30 +341,36 @@ function ResourceCreatePage(_ref) {
330
341
  var onSuccess = useCallback(function () {
331
342
  navigate("".concat(resourceRoute('index'), "?created=true"));
332
343
  }, [navigate, resourceRoute]);
333
- return /*#__PURE__*/React.createElement(ResourceProvider, {
334
- resource: resource
335
- }, /*#__PURE__*/React.createElement(MainLayout, null, /*#__PURE__*/React.createElement(ResourceFormWrapper, {
344
+ return /*#__PURE__*/jsx(ResourceProvider, {
336
345
  resource: resource,
337
- type: type,
338
- onSuccess: onSuccess,
339
- withContainer: true,
340
- header: /*#__PURE__*/React.createElement(PageHeader, {
341
- title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
342
- values: resourceValues,
343
- id: "6viUpq",
344
- defaultMessage: [{
345
- "type": 0,
346
- "value": "Create "
347
- }, {
348
- "type": 1,
349
- "value": "a_singular"
350
- }]
351
- }), typeName !== null ? /*#__PURE__*/React.createElement("span", {
352
- className: "text-body-secondary"
353
- }, " (", typeName, ")") : null),
354
- small: true
346
+ children: /*#__PURE__*/jsx(MainLayout, {
347
+ children: /*#__PURE__*/jsx(ResourceFormWrapper, {
348
+ resource: resource,
349
+ type: type,
350
+ onSuccess: onSuccess,
351
+ withContainer: true,
352
+ header: /*#__PURE__*/jsx(PageHeader, {
353
+ title: /*#__PURE__*/jsxs(Fragment, {
354
+ children: [/*#__PURE__*/jsx(FormattedMessage, {
355
+ values: resourceValues,
356
+ id: "6viUpq",
357
+ defaultMessage: [{
358
+ "type": 0,
359
+ "value": "Create "
360
+ }, {
361
+ "type": 1,
362
+ "value": "a_singular"
363
+ }]
364
+ }), typeName !== null ? /*#__PURE__*/jsxs("span", {
365
+ className: "text-body-secondary",
366
+ children: [" (", typeName, ")"]
367
+ }) : null]
368
+ }),
369
+ small: true
370
+ })
371
+ })
355
372
  })
356
- })));
373
+ });
357
374
  }
358
375
 
359
376
  function ResourceDeletePage(_ref) {
@@ -375,41 +392,47 @@ function ResourceDeletePage(_ref) {
375
392
  var onSuccess = useCallback(function () {
376
393
  return navigate("".concat(resourceRoute('index'), "?deleted=true"));
377
394
  }, [navigate, resourceRoute]);
378
- return /*#__PURE__*/React.createElement(ResourceProvider, {
379
- resource: resource
380
- }, /*#__PURE__*/React.createElement(MainLayout, {
381
- loading: loading
382
- }, item !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
395
+ return /*#__PURE__*/jsx(ResourceProvider, {
383
396
  resource: resource,
384
- item: item,
385
- onSuccess: onSuccess,
386
- isDelete: true,
387
- withContainer: true,
388
- header: /*#__PURE__*/React.createElement(PageHeader, {
389
- title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
390
- values: resourceValues,
391
- id: "zN5N/Q",
392
- defaultMessage: [{
393
- "type": 0,
394
- "value": "Delete "
395
- }, {
396
- "type": 1,
397
- "value": "a_singular"
398
- }]
399
- }), typeName !== null ? /*#__PURE__*/React.createElement("span", {
400
- className: "text-body-secondary"
401
- }, ' ', "(", typeName, ")") : null),
402
- small: true
397
+ children: /*#__PURE__*/jsxs(MainLayout, {
398
+ loading: loading,
399
+ children: [item !== null ? /*#__PURE__*/jsx(ResourceFormWrapper, {
400
+ resource: resource,
401
+ item: item,
402
+ onSuccess: onSuccess,
403
+ isDelete: true,
404
+ withContainer: true,
405
+ header: /*#__PURE__*/jsx(PageHeader, {
406
+ title: /*#__PURE__*/jsxs(Fragment, {
407
+ children: [/*#__PURE__*/jsx(FormattedMessage, {
408
+ values: resourceValues,
409
+ id: "zN5N/Q",
410
+ defaultMessage: [{
411
+ "type": 0,
412
+ "value": "Delete "
413
+ }, {
414
+ "type": 1,
415
+ "value": "a_singular"
416
+ }]
417
+ }), typeName !== null ? /*#__PURE__*/jsxs("span", {
418
+ className: "text-body-secondary",
419
+ children: [' ', "(", typeName, ")"]
420
+ }) : null]
421
+ }),
422
+ small: true
423
+ })
424
+ }) : null, item === null && loading && !error ? /*#__PURE__*/jsx(Loading, {
425
+ withDelay: true,
426
+ children: /*#__PURE__*/jsx(FormattedMessage, {
427
+ id: "TV3jir",
428
+ defaultMessage: [{
429
+ "type": 0,
430
+ "value": "Loading"
431
+ }]
432
+ })
433
+ }) : null]
403
434
  })
404
- }) : null, item === null && loading && !error ? /*#__PURE__*/React.createElement(Loading, {
405
- withDelay: true
406
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
407
- id: "TV3jir",
408
- defaultMessage: [{
409
- "type": 0,
410
- "value": "Loading"
411
- }]
412
- })) : null));
435
+ });
413
436
  }
414
437
 
415
438
  function ResourceEditPage(_ref) {
@@ -434,41 +457,47 @@ function ResourceEditPage(_ref) {
434
457
  setEditItem(item);
435
458
  }, [item, setEditItem]);
436
459
  var resourceValues = useResourceValues(resource);
437
- return /*#__PURE__*/React.createElement(ResourceProvider, {
438
- resource: resource
439
- }, /*#__PURE__*/React.createElement(MainLayout, {
440
- loading: loading
441
- }, editItem !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
460
+ return /*#__PURE__*/jsx(ResourceProvider, {
442
461
  resource: resource,
443
- item: editItem,
444
- type: type,
445
- onSuccess: onSuccess,
446
- withContainer: true,
447
- header: /*#__PURE__*/React.createElement(PageHeader, {
448
- title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
449
- values: resourceValues,
450
- id: "mCfzkJ",
451
- defaultMessage: [{
452
- "type": 0,
453
- "value": "Edit "
454
- }, {
455
- "type": 1,
456
- "value": "a_singular"
457
- }]
458
- }), typeName !== null ? /*#__PURE__*/React.createElement("span", {
459
- className: "text-body-secondary"
460
- }, ' ', "(", typeName, ")") : null),
461
- small: true
462
+ children: /*#__PURE__*/jsxs(MainLayout, {
463
+ loading: loading,
464
+ children: [editItem !== null ? /*#__PURE__*/jsx(ResourceFormWrapper, {
465
+ resource: resource,
466
+ item: editItem,
467
+ type: type,
468
+ onSuccess: onSuccess,
469
+ withContainer: true,
470
+ header: /*#__PURE__*/jsx(PageHeader, {
471
+ title: /*#__PURE__*/jsxs(Fragment, {
472
+ children: [/*#__PURE__*/jsx(FormattedMessage, {
473
+ values: resourceValues,
474
+ id: "mCfzkJ",
475
+ defaultMessage: [{
476
+ "type": 0,
477
+ "value": "Edit "
478
+ }, {
479
+ "type": 1,
480
+ "value": "a_singular"
481
+ }]
482
+ }), typeName !== null ? /*#__PURE__*/jsxs("span", {
483
+ className: "text-body-secondary",
484
+ children: [' ', "(", typeName, ")"]
485
+ }) : null]
486
+ }),
487
+ small: true
488
+ })
489
+ }) : null, editItem === null && loading && !error ? /*#__PURE__*/jsx(Loading, {
490
+ withDelay: true,
491
+ children: /*#__PURE__*/jsx(FormattedMessage, {
492
+ id: "TV3jir",
493
+ defaultMessage: [{
494
+ "type": 0,
495
+ "value": "Loading"
496
+ }]
497
+ })
498
+ }) : null]
462
499
  })
463
- }) : null, editItem === null && loading && !error ? /*#__PURE__*/React.createElement(Loading, {
464
- withDelay: true
465
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
466
- id: "TV3jir",
467
- defaultMessage: [{
468
- "type": 0,
469
- "value": "Loading"
470
- }]
471
- })) : null));
500
+ });
472
501
  }
473
502
 
474
503
  function ResourceCreateButton(_ref) {
@@ -503,41 +532,43 @@ function ResourceCreateButton(_ref) {
503
532
  setDropdownOpened(false);
504
533
  }
505
534
  }, [setDropdownOpened, dropdownOpened]);
506
- var button = /*#__PURE__*/React.createElement(Button, {
535
+ var button = /*#__PURE__*/jsx(Button, {
507
536
  href: !hasMultipleTypes ? "".concat(resourceRoute('create')).concat(finalTypes !== null && finalTypes.length === 1 ? "?type=".concat(finalTypes[0].id) : '') : '#',
508
537
  size: size,
509
538
  theme: "primary",
510
539
  className: classNames([_defineProperty({
511
540
  'dropdown-toggle': hasMultipleTypes
512
541
  }, className, className !== null)]),
513
- onClick: hasMultipleTypes ? onClickDropdown : null
514
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
515
- values: resourceValues,
516
- id: "l+ddDH",
517
- defaultMessage: [{
518
- "type": 0,
519
- "value": "Create "
520
- }, {
521
- "type": 1,
522
- "value": "a_singular"
523
- }]
524
- }));
525
- return hasMultipleTypes ? /*#__PURE__*/React.createElement("div", {
542
+ onClick: hasMultipleTypes ? onClickDropdown : null,
543
+ children: /*#__PURE__*/jsx(FormattedMessage, {
544
+ values: resourceValues,
545
+ id: "l+ddDH",
546
+ defaultMessage: [{
547
+ "type": 0,
548
+ "value": "Create "
549
+ }, {
550
+ "type": 1,
551
+ "value": "a_singular"
552
+ }]
553
+ })
554
+ });
555
+ return hasMultipleTypes ? /*#__PURE__*/jsxs("div", {
526
556
  className: classNames(['dropdown', {
527
557
  show: dropdownOpened
528
- }])
529
- }, button, /*#__PURE__*/React.createElement(Dropdown, {
530
- items: finalTypes.map(function (it) {
531
- return {
532
- id: it.id,
533
- label: it.name,
534
- href: "".concat(resourceRoute('create'), "?type=").concat(it.id)
535
- };
536
- }),
537
- visible: dropdownOpened,
538
- align: "end",
539
- onClickOutside: onDropdownClickOutside
540
- })) : button;
558
+ }]),
559
+ children: [button, /*#__PURE__*/jsx(Dropdown, {
560
+ items: finalTypes.map(function (it) {
561
+ return {
562
+ id: it.id,
563
+ label: it.name,
564
+ href: "".concat(resourceRoute('create'), "?type=").concat(it.id)
565
+ };
566
+ }),
567
+ visible: dropdownOpened,
568
+ align: "end",
569
+ onClickOutside: onDropdownClickOutside
570
+ })]
571
+ }) : button;
541
572
  }
542
573
 
543
574
  var _excluded$3 = ["resource"];
@@ -550,7 +581,7 @@ function ResourceItemsList(_ref) {
550
581
  },
551
582
  _ref2$id = _ref2.id,
552
583
  finalResource = _ref2$id === void 0 ? null : _ref2$id;
553
- return /*#__PURE__*/React.createElement(ResourceList, Object.assign({
584
+ return /*#__PURE__*/jsx(ResourceList, _objectSpread({
554
585
  resource: finalResource
555
586
  }, props));
556
587
  }
@@ -630,75 +661,81 @@ function ResourceIndexPage(_ref) {
630
661
  replace: true
631
662
  });
632
663
  }, [navigate, url]);
633
- return /*#__PURE__*/React.createElement(ResourceProvider, {
634
- resource: resource
635
- }, /*#__PURE__*/React.createElement(MainLayout, null, /*#__PURE__*/React.createElement(PageHeader, {
636
- title: name,
637
- actions: finalActions.length > 0 ? /*#__PURE__*/React.createElement("div", {
638
- className: "d-flex align-items-center"
639
- }, finalActions.map(function (_ref5) {
640
- var id = _ref5.id,
641
- _ref5$component = _ref5.component,
642
- component = _ref5$component === void 0 ? Button : _ref5$component,
643
- _ref5$withQuery = _ref5.withQuery,
644
- withQuery = _ref5$withQuery === void 0 ? false : _ref5$withQuery,
645
- _ref5$href = _ref5.href,
646
- href = _ref5$href === void 0 ? null : _ref5$href,
647
- actionsProps = _objectWithoutProperties(_ref5, _excluded$2);
648
- var ActionComponent = isString(component) ? componentsManager.getComponent(component) : component;
649
- var isButton = ActionComponent === Button;
650
- var finalHref = href;
651
- if (isButton && withQuery && href !== null) {
652
- finalHref = "".concat(finalHref).concat(finalHref.indexOf('?') !== -1 ? '&' : '?').concat(queryString.stringify(query, {
653
- arrayFormat: 'bracket'
654
- }));
655
- }
656
- return ActionComponent !== null ? /*#__PURE__*/React.createElement(ActionComponent, Object.assign({
657
- key: "action-".concat(id),
658
- href: finalHref
659
- }, actionsProps, !isButton ? {
660
- resource: resource,
661
- query: query,
662
- onQueryChange: onQueryChange
663
- } : {})) : null;
664
- })) : null
665
- }), /*#__PURE__*/React.createElement("div", {
666
- className: classNames(['container-sm py-4'])
667
- }, created ? /*#__PURE__*/React.createElement(Alert, {
668
- className: "mb-4",
669
- onClose: onClickCloseAlert
670
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
671
- values: resourceValues,
672
- id: "bfP/d8",
673
- defaultMessage: [{
674
- "type": 1,
675
- "value": "The_singular"
676
- }, {
677
- "type": 0,
678
- "value": " has been created."
679
- }]
680
- })) : null, deleted ? /*#__PURE__*/React.createElement(Alert, {
681
- className: "mb-4",
682
- onClose: onClickCloseAlert
683
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
684
- values: resourceValues,
685
- id: "dkRdks",
686
- defaultMessage: [{
687
- "type": 1,
688
- "value": "The_singular"
689
- }, {
690
- "type": 0,
691
- "value": " has been deleted."
692
- }]
693
- })) : null, /*#__PURE__*/React.createElement(ResourceItemsList, {
664
+ return /*#__PURE__*/jsx(ResourceProvider, {
694
665
  resource: resource,
695
- baseUrl: url,
696
- query: listQuery,
697
- paginated: paginated,
698
- onQueryChange: onQueryChange,
699
- onQueryReset: onQueryReset,
700
- theme: theme
701
- }))));
666
+ children: /*#__PURE__*/jsxs(MainLayout, {
667
+ children: [/*#__PURE__*/jsx(PageHeader, {
668
+ title: name,
669
+ actions: finalActions.length > 0 ? /*#__PURE__*/jsx("div", {
670
+ className: "d-flex align-items-center",
671
+ children: finalActions.map(function (_ref5) {
672
+ var id = _ref5.id,
673
+ _ref5$component = _ref5.component,
674
+ component = _ref5$component === void 0 ? Button : _ref5$component,
675
+ _ref5$withQuery = _ref5.withQuery,
676
+ withQuery = _ref5$withQuery === void 0 ? false : _ref5$withQuery,
677
+ _ref5$href = _ref5.href,
678
+ href = _ref5$href === void 0 ? null : _ref5$href,
679
+ actionsProps = _objectWithoutProperties(_ref5, _excluded$2);
680
+ var ActionComponent = isString(component) ? componentsManager.getComponent(component) : component;
681
+ var isButton = ActionComponent === Button;
682
+ var finalHref = href;
683
+ if (isButton && withQuery && href !== null) {
684
+ finalHref = "".concat(finalHref).concat(finalHref.indexOf('?') !== -1 ? '&' : '?').concat(queryString.stringify(query, {
685
+ arrayFormat: 'bracket'
686
+ }));
687
+ }
688
+ return ActionComponent !== null ? /*#__PURE__*/jsx(ActionComponent, _objectSpread(_objectSpread({
689
+ href: finalHref
690
+ }, actionsProps), !isButton ? {
691
+ resource: resource,
692
+ query: query,
693
+ onQueryChange: onQueryChange
694
+ } : {}), "action-".concat(id)) : null;
695
+ })
696
+ }) : null
697
+ }), /*#__PURE__*/jsxs("div", {
698
+ className: classNames(['container-sm py-4']),
699
+ children: [created ? /*#__PURE__*/jsx(Alert, {
700
+ className: "mb-4",
701
+ onClose: onClickCloseAlert,
702
+ children: /*#__PURE__*/jsx(FormattedMessage, {
703
+ values: resourceValues,
704
+ id: "bfP/d8",
705
+ defaultMessage: [{
706
+ "type": 1,
707
+ "value": "The_singular"
708
+ }, {
709
+ "type": 0,
710
+ "value": " has been created."
711
+ }]
712
+ })
713
+ }) : null, deleted ? /*#__PURE__*/jsx(Alert, {
714
+ className: "mb-4",
715
+ onClose: onClickCloseAlert,
716
+ children: /*#__PURE__*/jsx(FormattedMessage, {
717
+ values: resourceValues,
718
+ id: "dkRdks",
719
+ defaultMessage: [{
720
+ "type": 1,
721
+ "value": "The_singular"
722
+ }, {
723
+ "type": 0,
724
+ "value": " has been deleted."
725
+ }]
726
+ })
727
+ }) : null, /*#__PURE__*/jsx(ResourceItemsList, {
728
+ resource: resource,
729
+ baseUrl: url,
730
+ query: listQuery,
731
+ paginated: paginated,
732
+ onQueryChange: onQueryChange,
733
+ onQueryReset: onQueryReset,
734
+ theme: theme
735
+ })]
736
+ })]
737
+ })
738
+ });
702
739
  }
703
740
 
704
741
  function ResourceShowPage(_ref) {
@@ -712,29 +749,32 @@ function ResourceShowPage(_ref) {
712
749
  var _ref2 = item || {},
713
750
  _ref2$type = _ref2.type,
714
751
  type = _ref2$type === void 0 ? null : _ref2$type;
715
- return /*#__PURE__*/React.createElement(ResourceProvider, {
716
- resource: resource
717
- }, /*#__PURE__*/React.createElement(MainLayout, {
718
- loading: loading
719
- }, item !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
752
+ return /*#__PURE__*/jsx(ResourceProvider, {
720
753
  resource: resource,
721
- item: item,
722
- type: type,
723
- disabled: true,
724
- header: /*#__PURE__*/React.createElement(PageHeader, {
725
- title: "".concat(name, " #").concat(itemId),
726
- small: true
727
- }),
728
- withContainer: true
729
- }) : null, item === null && loading && !error ? /*#__PURE__*/React.createElement(Loading, {
730
- withDelay: true
731
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
732
- id: "TV3jir",
733
- defaultMessage: [{
734
- "type": 0,
735
- "value": "Loading"
736
- }]
737
- })) : null));
754
+ children: /*#__PURE__*/jsxs(MainLayout, {
755
+ loading: loading,
756
+ children: [item !== null ? /*#__PURE__*/jsx(ResourceFormWrapper, {
757
+ resource: resource,
758
+ item: item,
759
+ type: type,
760
+ disabled: true,
761
+ header: /*#__PURE__*/jsx(PageHeader, {
762
+ title: "".concat(name, " #").concat(itemId),
763
+ small: true
764
+ }),
765
+ withContainer: true
766
+ }) : null, item === null && loading && !error ? /*#__PURE__*/jsx(Loading, {
767
+ withDelay: true,
768
+ children: /*#__PURE__*/jsx(FormattedMessage, {
769
+ id: "TV3jir",
770
+ defaultMessage: [{
771
+ "type": 0,
772
+ "value": "Loading"
773
+ }]
774
+ })
775
+ }) : null]
776
+ })
777
+ });
738
778
  }
739
779
 
740
780
  function ResourceDuplicatePage(_ref) {
@@ -761,42 +801,48 @@ function ResourceDuplicatePage(_ref) {
761
801
  id: id
762
802
  }), "?duplicated=true"));
763
803
  }, [navigate, resourceRoute]);
764
- return /*#__PURE__*/React.createElement(ResourceProvider, {
765
- resource: resource
766
- }, /*#__PURE__*/React.createElement(MainLayout, {
767
- loading: loading
768
- }, item !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
804
+ return /*#__PURE__*/jsx(ResourceProvider, {
769
805
  resource: resource,
770
- item: item,
771
- onSuccess: onSuccess,
772
- isDuplicate: true,
773
- withContainer: true,
774
- header: /*#__PURE__*/React.createElement(PageHeader, {
775
- title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
776
- values: resourceValues,
777
- id: "G7M4nI",
778
- defaultMessage: [{
779
- "type": 0,
780
- "value": "Duplicate "
781
- }, {
782
- "type": 1,
783
- "value": "a_singular"
784
- }]
785
- }), typeName !== null ? /*#__PURE__*/React.createElement("span", {
786
- className: "text-body-secondary"
787
- }, ' ', "(", typeName, ")") : null),
788
- small: true
806
+ children: /*#__PURE__*/jsxs(MainLayout, {
807
+ loading: loading,
808
+ children: [item !== null ? /*#__PURE__*/jsx(ResourceFormWrapper, {
809
+ resource: resource,
810
+ item: item,
811
+ onSuccess: onSuccess,
812
+ isDuplicate: true,
813
+ withContainer: true,
814
+ header: /*#__PURE__*/jsx(PageHeader, {
815
+ title: /*#__PURE__*/jsxs(Fragment, {
816
+ children: [/*#__PURE__*/jsx(FormattedMessage, {
817
+ values: resourceValues,
818
+ id: "G7M4nI",
819
+ defaultMessage: [{
820
+ "type": 0,
821
+ "value": "Duplicate "
822
+ }, {
823
+ "type": 1,
824
+ "value": "a_singular"
825
+ }]
826
+ }), typeName !== null ? /*#__PURE__*/jsxs("span", {
827
+ className: "text-body-secondary",
828
+ children: [' ', "(", typeName, ")"]
829
+ }) : null]
830
+ }),
831
+ small: true
832
+ })
833
+ }) : null, item === null && loading && !error ? /*#__PURE__*/jsx(Loading, {
834
+ className: "w-10 m-auto",
835
+ withDelay: true,
836
+ children: /*#__PURE__*/jsx(FormattedMessage, {
837
+ id: "TV3jir",
838
+ defaultMessage: [{
839
+ "type": 0,
840
+ "value": "Loading"
841
+ }]
842
+ })
843
+ }) : null]
789
844
  })
790
- }) : null, item === null && loading && !error ? /*#__PURE__*/React.createElement(Loading, {
791
- className: "w-10 m-auto",
792
- withDelay: true
793
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
794
- id: "TV3jir",
795
- defaultMessage: [{
796
- "type": 0,
797
- "value": "Loading"
798
- }]
799
- })) : null));
845
+ });
800
846
  }
801
847
 
802
848
  function ResourceLink(_ref) {
@@ -805,22 +851,23 @@ function ResourceLink(_ref) {
805
851
  var _ref2 = resource || {},
806
852
  resourceId = _ref2.id;
807
853
  var resourceValues = useResourceValues(resource);
808
- return /*#__PURE__*/React.createElement(Link, {
854
+ return /*#__PURE__*/jsx(Link, {
809
855
  className: "d-block my-2",
810
856
  href: route('resources.index', {
811
857
  resource: resourceId
858
+ }),
859
+ children: /*#__PURE__*/jsx(FormattedMessage, {
860
+ values: resourceValues,
861
+ id: "FntHPK",
862
+ defaultMessage: [{
863
+ "type": 0,
864
+ "value": "View "
865
+ }, {
866
+ "type": 1,
867
+ "value": "the_plural"
868
+ }]
812
869
  })
813
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
814
- values: resourceValues,
815
- id: "FntHPK",
816
- defaultMessage: [{
817
- "type": 0,
818
- "value": "View "
819
- }, {
820
- "type": 1,
821
- "value": "the_plural"
822
- }]
823
- }));
870
+ });
824
871
  }
825
872
  function HomePage() {
826
873
  var resources = usePanneauResources();
@@ -831,22 +878,27 @@ function HomePage() {
831
878
  hideInNavbar = _ref3$settings2$hideI === void 0 ? false : _ref3$settings2$hideI;
832
879
  return !hideInNavbar;
833
880
  });
834
- return /*#__PURE__*/React.createElement(MainLayout, null, /*#__PURE__*/React.createElement("div", {
835
- className: "container-sm py-4"
836
- }, visibleResources.map(function (resource) {
837
- var _ref4 = resource || {},
838
- resourceId = _ref4.id;
839
- return /*#__PURE__*/React.createElement(ResourceLink, {
840
- key: "resource-link-".concat(resourceId),
841
- resource: resource
842
- });
843
- })));
881
+ return /*#__PURE__*/jsx(MainLayout, {
882
+ children: /*#__PURE__*/jsx("div", {
883
+ className: "container-sm py-4",
884
+ children: visibleResources.map(function (resource) {
885
+ var _ref4 = resource || {},
886
+ resourceId = _ref4.id;
887
+ return /*#__PURE__*/jsx(ResourceLink, {
888
+ resource: resource
889
+ }, "resource-link-".concat(resourceId));
890
+ })
891
+ })
892
+ });
844
893
  }
845
894
 
846
895
  function AccountPage() {
847
- return /*#__PURE__*/React.createElement(MainLayout, null, /*#__PURE__*/React.createElement("div", {
848
- className: "container-sm py-4"
849
- }, "Account page"));
896
+ return /*#__PURE__*/jsx(MainLayout, {
897
+ children: /*#__PURE__*/jsx("div", {
898
+ className: "container-sm py-4",
899
+ children: "Account page"
900
+ })
901
+ });
850
902
  }
851
903
 
852
904
  function LoginForm(_ref) {
@@ -864,12 +916,12 @@ function LoginForm(_ref) {
864
916
  }, [login]);
865
917
  var FormComponents = useFormsComponents();
866
918
  var FormComponent = getComponentFromName('login', FormComponents);
867
- return FormComponent !== null ? /*#__PURE__*/React.createElement(FormComponent, {
919
+ return FormComponent !== null ? /*#__PURE__*/jsx(FormComponent, {
868
920
  action: url('auth.login'),
869
921
  postForm: postForm,
870
922
  onComplete: onSuccess,
871
923
  className: className,
872
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
924
+ submitButtonLabel: /*#__PURE__*/jsx(FormattedMessage, {
873
925
  id: "g6qbbX",
874
926
  defaultMessage: [{
875
927
  "type": 0,
@@ -890,22 +942,25 @@ function GuestLayout(_ref) {
890
942
  background = _usePanneauColorSchem3 === void 0 ? null : _usePanneauColorSchem3,
891
943
  _usePanneauColorSchem4 = _usePanneauColorSchem.text,
892
944
  text = _usePanneauColorSchem4 === void 0 ? null : _usePanneauColorSchem4;
893
- return /*#__PURE__*/React.createElement("div", {
945
+ return /*#__PURE__*/jsxs("div", {
894
946
  className: classNames([{
895
947
  'd-flex flex-column min-vh-100': fullscreen
896
948
  }]),
897
- "data-bs-theme": theme !== null ? theme : undefined
898
- }, /*#__PURE__*/React.createElement(MainNavbar, {
899
- className: classNames(['sticky-top', 'px-3'])
900
- }), /*#__PURE__*/React.createElement("div", {
901
- className: classNames(_defineProperty(_defineProperty({
902
- 'd-flex flex-column flex-grow-1': fullscreen
903
- }, "bg-".concat(background), background !== null), "text-".concat(text), text !== null))
904
- }, /*#__PURE__*/React.createElement("div", {
905
- className: classNames({
906
- 'w-100 my-auto': fullscreen
907
- })
908
- }, children)));
949
+ "data-bs-theme": theme !== null ? theme : undefined,
950
+ children: [/*#__PURE__*/jsx(MainNavbar, {
951
+ className: classNames(['sticky-top', 'px-3'])
952
+ }), /*#__PURE__*/jsx("div", {
953
+ className: classNames(_defineProperty(_defineProperty({
954
+ 'd-flex flex-column flex-grow-1': fullscreen
955
+ }, "bg-".concat(background), background !== null), "text-".concat(text), text !== null)),
956
+ children: /*#__PURE__*/jsx("div", {
957
+ className: classNames({
958
+ 'w-100 my-auto': fullscreen
959
+ }),
960
+ children: children
961
+ })
962
+ })]
963
+ });
909
964
  }
910
965
 
911
966
  function LoginPage() {
@@ -915,25 +970,30 @@ function LoginPage() {
915
970
  var onSuccess = useCallback(function () {
916
971
  window.location.href = route('home');
917
972
  }, [route]);
918
- return /*#__PURE__*/React.createElement(GuestLayout, {
919
- fullscreen: true
920
- }, /*#__PURE__*/React.createElement("div", {
921
- className: "container-sm py-4"
922
- }, /*#__PURE__*/React.createElement("div", {
923
- className: "row justify-content-center"
924
- }, /*#__PURE__*/React.createElement("div", {
925
- className: "col-12 col-sm-8 col-md-6"
926
- }, /*#__PURE__*/React.createElement("h1", {
927
- className: "mb-4"
928
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
929
- id: "AeOZq+",
930
- defaultMessage: [{
931
- "type": 0,
932
- "value": "Login"
933
- }]
934
- })), /*#__PURE__*/React.createElement(LoginForm, {
935
- onSuccess: onSuccess
936
- })))));
973
+ return /*#__PURE__*/jsx(GuestLayout, {
974
+ fullscreen: true,
975
+ children: /*#__PURE__*/jsx("div", {
976
+ className: "container-sm py-4",
977
+ children: /*#__PURE__*/jsx("div", {
978
+ className: "row justify-content-center",
979
+ children: /*#__PURE__*/jsxs("div", {
980
+ className: "col-12 col-sm-8 col-md-6",
981
+ children: [/*#__PURE__*/jsx("h1", {
982
+ className: "mb-4",
983
+ children: /*#__PURE__*/jsx(FormattedMessage, {
984
+ id: "AeOZq+",
985
+ defaultMessage: [{
986
+ "type": 0,
987
+ "value": "Login"
988
+ }]
989
+ })
990
+ }), /*#__PURE__*/jsx(LoginForm, {
991
+ onSuccess: onSuccess
992
+ })]
993
+ })
994
+ })
995
+ })
996
+ });
937
997
  }
938
998
 
939
999
  var messages = defineMessages({
@@ -1032,15 +1092,27 @@ var messages = defineMessages({
1032
1092
  function ErrorPage(_ref) {
1033
1093
  var _ref$statusCode = _ref.statusCode,
1034
1094
  statusCode = _ref$statusCode === void 0 ? null : _ref$statusCode;
1035
- return /*#__PURE__*/React.createElement(GuestLayout, {
1036
- fullscreen: true
1037
- }, /*#__PURE__*/React.createElement("div", {
1038
- className: "container-sm py-4"
1039
- }, /*#__PURE__*/React.createElement("div", {
1040
- className: "row justify-content-center"
1041
- }, /*#__PURE__*/React.createElement("div", {
1042
- className: "col-12 col-sm-8 col-md-6"
1043
- }, /*#__PURE__*/React.createElement("h1", null, /*#__PURE__*/React.createElement(Label, null, messages["title".concat(statusCode || 404)])), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(Label, null, messages["description".concat(statusCode || 404)]))))));
1095
+ return /*#__PURE__*/jsx(GuestLayout, {
1096
+ fullscreen: true,
1097
+ children: /*#__PURE__*/jsx("div", {
1098
+ className: "container-sm py-4",
1099
+ children: /*#__PURE__*/jsx("div", {
1100
+ className: "row justify-content-center",
1101
+ children: /*#__PURE__*/jsxs("div", {
1102
+ className: "col-12 col-sm-8 col-md-6",
1103
+ children: [/*#__PURE__*/jsx("h1", {
1104
+ children: /*#__PURE__*/jsx(Label, {
1105
+ children: messages["title".concat(statusCode || 404)]
1106
+ })
1107
+ }), /*#__PURE__*/jsx("p", {
1108
+ children: /*#__PURE__*/jsx(Label, {
1109
+ children: messages["description".concat(statusCode || 404)]
1110
+ })
1111
+ })]
1112
+ })
1113
+ })
1114
+ })
1115
+ });
1044
1116
  }
1045
1117
 
1046
1118
  var _excluded$1 = ["path", "component"];
@@ -1088,91 +1160,91 @@ function createResourceRoutes(resource, _ref) {
1088
1160
  var ResourceEditComponent = componentsManager.getComponent(resourceEditPage === null || resourceEditPage === void 0 ? void 0 : resourceEditPage.component) || componentsManager.getComponent(editPage === null || editPage === void 0 ? void 0 : editPage.component) || ResourceEditPage;
1089
1161
  var ResourceDeleteComponent = componentsManager.getComponent(resourceDeletePage === null || resourceDeletePage === void 0 ? void 0 : resourceDeletePage.component) || componentsManager.getComponent(deletePage === null || deletePage === void 0 ? void 0 : deletePage.component) || ResourceDeletePage;
1090
1162
  var ResourceDuplicateComponent = componentsManager.getComponent(resourceDuplicatePage === null || resourceDuplicatePage === void 0 ? void 0 : resourceDuplicatePage.component) || componentsManager.getComponent(duplicatePage === null || duplicatePage === void 0 ? void 0 : duplicatePage.component) || ResourceDuplicatePage;
1091
- return [/*#__PURE__*/React$1.createElement(Route, {
1092
- key: "".concat(resourceId, "-create"),
1163
+ return [/*#__PURE__*/jsx(Route, {
1093
1164
  path: route('resources.create', {
1094
1165
  resource: resourceId
1095
1166
  }),
1096
- exact: true
1097
- }, function () {
1098
- return /*#__PURE__*/React$1.createElement(ResourceCreateComponent, {
1099
- resource: resource
1100
- });
1101
- }), /*#__PURE__*/React$1.createElement(Route, {
1102
- key: "".concat(resourceId, "-show"),
1167
+ exact: true,
1168
+ children: function children() {
1169
+ return /*#__PURE__*/jsx(ResourceCreateComponent, {
1170
+ resource: resource
1171
+ });
1172
+ }
1173
+ }, "".concat(resourceId, "-create")), /*#__PURE__*/jsx(Route, {
1103
1174
  path: route('resources.show', {
1104
1175
  resource: resourceId,
1105
1176
  id: ':id'
1106
- })
1107
- }, function (_ref4) {
1108
- var _ref4$id = _ref4.id,
1109
- id = _ref4$id === void 0 ? null : _ref4$id;
1110
- return /*#__PURE__*/React$1.createElement(ResourceShowComponent, {
1111
- itemId: id,
1112
- resource: resource
1113
- });
1114
- }), /*#__PURE__*/React$1.createElement(Route, {
1115
- key: "".concat(resourceId, "-edit"),
1177
+ }),
1178
+ children: function children(_ref4) {
1179
+ var _ref4$id = _ref4.id,
1180
+ id = _ref4$id === void 0 ? null : _ref4$id;
1181
+ return /*#__PURE__*/jsx(ResourceShowComponent, {
1182
+ itemId: id,
1183
+ resource: resource
1184
+ });
1185
+ }
1186
+ }, "".concat(resourceId, "-show")), /*#__PURE__*/jsx(Route, {
1116
1187
  path: route('resources.edit', {
1117
1188
  resource: resourceId,
1118
1189
  id: ':id'
1119
- })
1120
- }, function (_ref5) {
1121
- var _ref5$id = _ref5.id,
1122
- id = _ref5$id === void 0 ? null : _ref5$id;
1123
- return /*#__PURE__*/React$1.createElement(ResourceEditComponent, {
1124
- itemId: id,
1125
- resource: resource
1126
- });
1127
- }), /*#__PURE__*/React$1.createElement(Route, {
1128
- key: "".concat(resourceId, "-delete"),
1190
+ }),
1191
+ children: function children(_ref5) {
1192
+ var _ref5$id = _ref5.id,
1193
+ id = _ref5$id === void 0 ? null : _ref5$id;
1194
+ return /*#__PURE__*/jsx(ResourceEditComponent, {
1195
+ itemId: id,
1196
+ resource: resource
1197
+ });
1198
+ }
1199
+ }, "".concat(resourceId, "-edit")), /*#__PURE__*/jsx(Route, {
1129
1200
  path: route('resources.delete', {
1130
1201
  resource: resourceId,
1131
1202
  id: ':id'
1132
- })
1133
- }, function (_ref6) {
1134
- var _ref6$id = _ref6.id,
1135
- id = _ref6$id === void 0 ? null : _ref6$id;
1136
- return /*#__PURE__*/React$1.createElement(ResourceDeleteComponent, {
1137
- itemId: id,
1138
- resource: resource
1139
- });
1140
- }), /*#__PURE__*/React$1.createElement(Route, {
1141
- key: "".concat(resourceId, "-duplicate"),
1203
+ }),
1204
+ children: function children(_ref6) {
1205
+ var _ref6$id = _ref6.id,
1206
+ id = _ref6$id === void 0 ? null : _ref6$id;
1207
+ return /*#__PURE__*/jsx(ResourceDeleteComponent, {
1208
+ itemId: id,
1209
+ resource: resource
1210
+ });
1211
+ }
1212
+ }, "".concat(resourceId, "-delete")), /*#__PURE__*/jsx(Route, {
1142
1213
  path: route('resources.duplicate', {
1143
1214
  resource: resourceId,
1144
1215
  id: ':id'
1145
- })
1146
- }, function (_ref7) {
1147
- var _ref7$id = _ref7.id,
1148
- id = _ref7$id === void 0 ? null : _ref7$id;
1149
- return /*#__PURE__*/React$1.createElement(ResourceDuplicateComponent, {
1150
- itemId: id,
1151
- resource: resource
1152
- });
1153
- })].concat(_toConsumableArray(extraRoutes.map(function (_ref8) {
1216
+ }),
1217
+ children: function children(_ref7) {
1218
+ var _ref7$id = _ref7.id,
1219
+ id = _ref7$id === void 0 ? null : _ref7$id;
1220
+ return /*#__PURE__*/jsx(ResourceDuplicateComponent, {
1221
+ itemId: id,
1222
+ resource: resource
1223
+ });
1224
+ }
1225
+ }, "".concat(resourceId, "-duplicate"))].concat(_toConsumableArray(extraRoutes.map(function (_ref8) {
1154
1226
  var path = _ref8.path,
1155
1227
  component = _ref8.component,
1156
1228
  pageProps = _objectWithoutProperties(_ref8, _excluded$1);
1157
1229
  var RouteComponent = componentsManager.getComponent(component);
1158
- return RouteComponent !== null ? /*#__PURE__*/React$1.createElement(Route, {
1159
- key: "route-".concat(path),
1160
- path: path
1161
- }, function () {
1162
- return /*#__PURE__*/React$1.createElement(RouteComponent, Object.assign({
1163
- resource: resource
1164
- }, pageProps));
1165
- }) : null;
1166
- })), [/*#__PURE__*/React$1.createElement(Route, {
1167
- key: "".concat(resourceId, "-index"),
1230
+ return RouteComponent !== null ? /*#__PURE__*/jsx(Route, {
1231
+ path: path,
1232
+ children: function children() {
1233
+ return /*#__PURE__*/jsx(RouteComponent, _objectSpread({
1234
+ resource: resource
1235
+ }, pageProps));
1236
+ }
1237
+ }, "route-".concat(path)) : null;
1238
+ })), [/*#__PURE__*/jsx(Route, {
1168
1239
  path: route('resources.index', {
1169
1240
  resource: resourceId
1170
- })
1171
- }, function () {
1172
- return /*#__PURE__*/React$1.createElement(ResourceIndexComponent, {
1173
- resource: resource
1174
- });
1175
- })]);
1241
+ }),
1242
+ children: function children() {
1243
+ return /*#__PURE__*/jsx(ResourceIndexComponent, {
1244
+ resource: resource
1245
+ });
1246
+ }
1247
+ }, "".concat(resourceId, "-index"))]);
1176
1248
  }
1177
1249
 
1178
1250
  var _excluded = ["home", "login", "account", "error", "index", "show", "create", "edit", "delete", "duplicate"],
@@ -1252,54 +1324,66 @@ function PanneauRoutes(_ref) {
1252
1324
 
1253
1325
  // If there is an error status code
1254
1326
  if (statusCode !== null) {
1255
- return /*#__PURE__*/React.createElement(ErrorComponent, Object.assign({
1327
+ return /*#__PURE__*/jsx(ErrorComponent, _objectSpread({
1256
1328
  statusCode: statusCode
1257
1329
  }, errorPage));
1258
1330
  }
1259
1331
 
1260
1332
  // If user is unauthenticated
1261
1333
  if (user === null) {
1262
- return /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
1263
- path: routes['auth.login']
1264
- }, /*#__PURE__*/React.createElement(LoginComponent, loginPage)), /*#__PURE__*/React.createElement(Route, null, /*#__PURE__*/React.createElement(Redirect, {
1265
- to: "".concat(route('auth.login'), "?next=").concat(encodeURIComponent(pathname))
1266
- })));
1334
+ return /*#__PURE__*/jsxs(Switch, {
1335
+ children: [/*#__PURE__*/jsx(Route, {
1336
+ path: routes['auth.login'],
1337
+ children: /*#__PURE__*/jsx(LoginComponent, _objectSpread({}, loginPage))
1338
+ }), /*#__PURE__*/jsx(Route, {
1339
+ children: /*#__PURE__*/jsx(Redirect, {
1340
+ to: "".concat(route('auth.login'), "?next=").concat(encodeURIComponent(pathname))
1341
+ })
1342
+ })]
1343
+ });
1267
1344
  }
1268
1345
 
1269
1346
  // Normal routes
1270
- return /*#__PURE__*/React.createElement(Switch, null, user !== null ? /*#__PURE__*/React.createElement(Route, {
1271
- path: routes['auth.login']
1272
- }, /*#__PURE__*/React.createElement(Redirect, {
1273
- to: routes.home,
1274
- replace: true
1275
- })) : null, resources.map(function (resource) {
1276
- var _ref4 = resource || {},
1277
- resourceId = _ref4.id;
1278
- return /*#__PURE__*/React.createElement(Fragment, {
1279
- key: "resource-".concat(resourceId)
1280
- }, createResourceRoutes(resource, {
1281
- route: route,
1282
- componentsManager: componentsManager,
1283
- pages: pages
1284
- }));
1285
- }), /*#__PURE__*/React.createElement(Route, {
1286
- path: routes.account
1287
- }, /*#__PURE__*/React.createElement(AccountComponent, accountPage)), customRoutes.map(function (_ref5) {
1288
- var _ref5$path = _ref5.path,
1289
- path = _ref5$path === void 0 ? null : _ref5$path,
1290
- _ref5$route = _ref5.route,
1291
- pageRoute = _ref5$route === void 0 ? null : _ref5$route,
1292
- component = _ref5.component,
1293
- props = _objectWithoutProperties(_ref5, _excluded2);
1294
- var PageComponent = componentsManager.getComponent(component);
1295
- var finalPath = path || routes[pageRoute];
1296
- return PageComponent !== null ? /*#__PURE__*/React.createElement(Route, {
1297
- key: "custom-route-".concat(finalPath),
1298
- path: path || routes[pageRoute]
1299
- }, /*#__PURE__*/React.createElement(PageComponent, props)) : null;
1300
- }), /*#__PURE__*/React.createElement(Route, {
1301
- path: routes.home
1302
- }, /*#__PURE__*/React.createElement(HomeComponent, homePage)), /*#__PURE__*/React.createElement(Route, null, /*#__PURE__*/React.createElement(ErrorComponent, null)));
1347
+ return /*#__PURE__*/jsxs(Switch, {
1348
+ children: [user !== null ? /*#__PURE__*/jsx(Route, {
1349
+ path: routes['auth.login'],
1350
+ children: /*#__PURE__*/jsx(Redirect, {
1351
+ to: routes.home,
1352
+ replace: true
1353
+ })
1354
+ }) : null, resources.map(function (resource) {
1355
+ var _ref4 = resource || {},
1356
+ resourceId = _ref4.id;
1357
+ return /*#__PURE__*/jsx(Fragment$1, {
1358
+ children: createResourceRoutes(resource, {
1359
+ route: route,
1360
+ componentsManager: componentsManager,
1361
+ pages: pages
1362
+ })
1363
+ }, "resource-".concat(resourceId));
1364
+ }), /*#__PURE__*/jsx(Route, {
1365
+ path: routes.account,
1366
+ children: /*#__PURE__*/jsx(AccountComponent, _objectSpread({}, accountPage))
1367
+ }), customRoutes.map(function (_ref5) {
1368
+ var _ref5$path = _ref5.path,
1369
+ path = _ref5$path === void 0 ? null : _ref5$path,
1370
+ _ref5$route = _ref5.route,
1371
+ pageRoute = _ref5$route === void 0 ? null : _ref5$route,
1372
+ component = _ref5.component,
1373
+ props = _objectWithoutProperties(_ref5, _excluded2);
1374
+ var PageComponent = componentsManager.getComponent(component);
1375
+ var finalPath = path || routes[pageRoute];
1376
+ return PageComponent !== null ? /*#__PURE__*/jsx(Route, {
1377
+ path: path || routes[pageRoute],
1378
+ children: /*#__PURE__*/jsx(PageComponent, _objectSpread({}, props))
1379
+ }, "custom-route-".concat(finalPath)) : null;
1380
+ }), /*#__PURE__*/jsx(Route, {
1381
+ path: routes.home,
1382
+ children: /*#__PURE__*/jsx(HomeComponent, _objectSpread({}, homePage))
1383
+ }), /*#__PURE__*/jsx(Route, {
1384
+ children: /*#__PURE__*/jsx(ErrorComponent, {})
1385
+ })]
1386
+ });
1303
1387
  }
1304
1388
 
1305
1389
  var pathToRegexpParser = createPathToRegexpParser();
@@ -1360,34 +1444,60 @@ function Container(_ref) {
1360
1444
  var _useMemoryRouter = useMemoryRouter(),
1361
1445
  memoryLocationHook = _useMemoryRouter.hook,
1362
1446
  memorySearchHook = _useMemoryRouter.searchHook;
1363
- return /*#__PURE__*/React$1.createElement(Router, {
1447
+ return /*#__PURE__*/jsx(Router, {
1364
1448
  hook: isMemoryRouter ? memoryLocationHook : undefined,
1365
1449
  searchHook: isMemoryRouter ? memorySearchHook : undefined,
1366
- parser: pathToRegexpParser
1367
- }, /*#__PURE__*/React$1.createElement(IntlProvider, {
1368
- locale: locale,
1369
- locales: locales,
1370
- extraMessages: extraMessages
1371
- }, /*#__PURE__*/React$1.createElement(PanneauProvider, {
1372
- definition: definition
1373
- }, /*#__PURE__*/React$1.createElement(UppyProvider, uppy, /*#__PURE__*/React$1.createElement(RoutesProvider, {
1374
- routes: routes
1375
- }, /*#__PURE__*/React$1.createElement(FieldsProvider, null, /*#__PURE__*/React$1.createElement(FormsProvider, null, /*#__PURE__*/React$1.createElement(ListsProvider, null, /*#__PURE__*/React$1.createElement(DisplaysProvider, null, /*#__PURE__*/React$1.createElement(FiltersProvider, null, /*#__PURE__*/React$1.createElement(ActionsProvider, null, /*#__PURE__*/React$1.createElement(ModalProvider, null, /*#__PURE__*/React$1.createElement(ModalsProvider, null, /*#__PURE__*/React$1.createElement(ApiProvider, {
1376
- baseUrl: baseUrl,
1377
- onUnauthorized: onUnauthorized
1378
- }, /*#__PURE__*/React$1.createElement(QueryProvider, null, /*#__PURE__*/React$1.createElement(AuthProvider, {
1379
- user: user,
1380
- onLogout: onLogout
1381
- }, /*#__PURE__*/React$1.createElement(ComponentsProvider, {
1382
- components: components
1383
- }, /*#__PURE__*/React$1.createElement(PanneauRoutes, {
1384
- statusCode: statusCode
1385
- }))))))))))))))))));
1450
+ parser: pathToRegexpParser,
1451
+ children: /*#__PURE__*/jsx(IntlProvider, {
1452
+ locale: locale,
1453
+ locales: locales,
1454
+ extraMessages: extraMessages,
1455
+ children: /*#__PURE__*/jsx(PanneauProvider, {
1456
+ definition: definition,
1457
+ children: /*#__PURE__*/jsx(UppyProvider, _objectSpread(_objectSpread({}, uppy), {}, {
1458
+ children: /*#__PURE__*/jsx(RoutesProvider, {
1459
+ routes: routes,
1460
+ children: /*#__PURE__*/jsx(FieldsProvider, {
1461
+ children: /*#__PURE__*/jsx(FormsProvider, {
1462
+ children: /*#__PURE__*/jsx(ListsProvider, {
1463
+ children: /*#__PURE__*/jsx(DisplaysProvider, {
1464
+ children: /*#__PURE__*/jsx(FiltersProvider, {
1465
+ children: /*#__PURE__*/jsx(ActionsProvider, {
1466
+ children: /*#__PURE__*/jsx(ModalProvider, {
1467
+ children: /*#__PURE__*/jsx(ModalsProvider, {
1468
+ children: /*#__PURE__*/jsx(ApiProvider, {
1469
+ baseUrl: baseUrl,
1470
+ onUnauthorized: onUnauthorized,
1471
+ children: /*#__PURE__*/jsx(QueryProvider, {
1472
+ children: /*#__PURE__*/jsx(AuthProvider, {
1473
+ user: user,
1474
+ onLogout: onLogout,
1475
+ children: /*#__PURE__*/jsx(ComponentsProvider, {
1476
+ components: components,
1477
+ children: /*#__PURE__*/jsx(PanneauRoutes, {
1478
+ statusCode: statusCode
1479
+ })
1480
+ })
1481
+ })
1482
+ })
1483
+ })
1484
+ })
1485
+ })
1486
+ })
1487
+ })
1488
+ })
1489
+ })
1490
+ })
1491
+ })
1492
+ })
1493
+ }))
1494
+ })
1495
+ })
1496
+ });
1386
1497
  }
1387
1498
 
1388
- // Kept for backward compatibility with exports
1389
1499
  function ResourceFilters(props) {
1390
- return /*#__PURE__*/React.createElement(Filters, props);
1500
+ return /*#__PURE__*/jsx(Filters, _objectSpread({}, props));
1391
1501
  }
1392
1502
 
1393
1503
  export { GuestLayout, MainLayout, PageHeader, ResourceFilters, ResourceFormWrapper as ResourceForm, ResourceItemsList, Container as default };