@panneau/app 4.0.1 → 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 -514
  2. package/package.json +41 -41
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, { 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,11 +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
- /* eslint-disable react/jsx-props-no-spreading */
43
-
44
- // Kept for backward compatibility with exports
45
43
  function ResourceFormWrapper(props) {
46
- return /*#__PURE__*/React.createElement(ResourceForm, props);
44
+ return /*#__PURE__*/jsx(ResourceForm, _objectSpread({}, props));
47
45
  }
48
46
 
49
47
  function AccountMenu(_ref) {
@@ -65,7 +63,7 @@ function AccountMenu(_ref) {
65
63
  var items = useMemo(function () {
66
64
  return user !== null ? [{
67
65
  id: 'account',
68
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
66
+ label: /*#__PURE__*/jsx(FormattedMessage, {
69
67
  id: "IuqEHB",
70
68
  defaultMessage: [{
71
69
  "type": 0,
@@ -74,7 +72,7 @@ function AccountMenu(_ref) {
74
72
  }),
75
73
  href: route('account'),
76
74
  dropdown: [].concat(_toConsumableArray(withAccountForm ? [{
77
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
75
+ label: /*#__PURE__*/jsx(FormattedMessage, {
78
76
  id: "V7Us0a",
79
77
  defaultMessage: [{
80
78
  "type": 0,
@@ -83,7 +81,7 @@ function AccountMenu(_ref) {
83
81
  }),
84
82
  href: route('account')
85
83
  }] : []), [{
86
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
84
+ label: /*#__PURE__*/jsx(FormattedMessage, {
87
85
  id: "REIcPg",
88
86
  defaultMessage: [{
89
87
  "type": 0,
@@ -94,7 +92,7 @@ function AccountMenu(_ref) {
94
92
  onClick: onClickLogout
95
93
  }])
96
94
  }] : [{
97
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
95
+ label: /*#__PURE__*/jsx(FormattedMessage, {
98
96
  id: "d0g58T",
99
97
  defaultMessage: [{
100
98
  "type": 0,
@@ -104,7 +102,7 @@ function AccountMenu(_ref) {
104
102
  href: route('auth.login')
105
103
  }];
106
104
  }, [user, route, onClickLogout, withAccountForm]);
107
- return items !== null ? /*#__PURE__*/React.createElement(Menu, {
105
+ return items !== null ? /*#__PURE__*/jsx(Menu, {
108
106
  className: className,
109
107
  itemClassName: itemClassName,
110
108
  linkClassName: linkClassName,
@@ -142,7 +140,7 @@ function ResourcesMenu(_ref) {
142
140
  };
143
141
  });
144
142
  }, [resources, pathname, resourceRoute]);
145
- return /*#__PURE__*/React.createElement(Menu, {
143
+ return /*#__PURE__*/jsx(Menu, {
146
144
  items: items,
147
145
  className: className,
148
146
  itemClassName: itemClassName,
@@ -182,53 +180,53 @@ function MainNavbar(_ref) {
182
180
  return it !== null;
183
181
  }).reduce(function (currentItems, item, index) {
184
182
  if (item === 'resources') {
185
- return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/React.createElement(ResourcesMenu, {
186
- key: "menu-item-resource-".concat(index + 1),
183
+ return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/jsx(ResourcesMenu, {
187
184
  className: navClassNames,
188
185
  itemClassName: "nav-item",
189
186
  linkClassName: "nav-link"
190
- })]);
187
+ }, "menu-item-resource-".concat(index + 1))]);
191
188
  }
192
189
  if (item === 'account') {
193
- return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/React.createElement(AccountMenu, {
194
- key: "menu-item-account-".concat(index + 1),
190
+ return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/jsx(AccountMenu, {
195
191
  className: navClassNames,
196
192
  itemClassName: "nav-item",
197
193
  linkClassName: "nav-link"
198
- })]);
194
+ }, "menu-item-account-".concat(index + 1))]);
199
195
  }
200
196
  if (item === 'separator') {
201
- return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/React.createElement("span", {
202
- key: "menu-item-spacer-".concat(index + 1),
197
+ return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/jsx("span", {
203
198
  className: "ms-auto"
204
- })]);
199
+ }, "menu-item-spacer-".concat(index + 1))]);
205
200
  }
206
201
  var lastItem = currentItems.length > 0 ? currentItems[currentItems.length - 1] : null;
207
202
  return isArray(lastItem) ? [].concat(_toConsumableArray(currentItems.slice(0, currentItems.length - 1)), [[].concat(_toConsumableArray(lastItem), [item])]) : [].concat(_toConsumableArray(currentItems), [[item]]);
208
203
  }, []).map(function (it, index) {
209
- return isArray(it) ? /*#__PURE__*/React.createElement(Menu, {
204
+ return isArray(it) ? /*#__PURE__*/jsx(Menu, {
210
205
  items: it,
211
- key: "submenu-item-".concat(index + 1),
212
206
  className: navClassNames,
213
207
  itemClassName: "nav-item",
214
208
  linkClassName: "nav-link"
215
- }) : it;
209
+ }, "submenu-item-".concat(index + 1)) : it;
216
210
  });
217
211
  }, [main, guest, user, navClassNames]);
218
- return /*#__PURE__*/React.createElement(Navbar, Object.assign({
212
+ return /*#__PURE__*/jsxs(Navbar, _objectSpread(_objectSpread({
219
213
  theme: background,
220
214
  loading: loading,
221
215
  vertical: vertical,
222
216
  className: className
223
- }, props), name !== null ? /*#__PURE__*/React.createElement(Link, {
224
- href: route('home'),
225
- className: "navbar-brand"
226
- }, /*#__PURE__*/React.createElement("span", {
227
- className: classNames([{
228
- 'text-opacity-75': loading,
229
- 'ms-2': vertical
230
- }])
231
- }, 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
+ }));
232
230
  }
233
231
 
234
232
  function MainLayout(_ref) {
@@ -248,35 +246,37 @@ function MainLayout(_ref) {
248
246
  _usePanneauColorSchem5 = _usePanneauColorSchem.text,
249
247
  text = _usePanneauColorSchem5 === void 0 ? null : _usePanneauColorSchem5;
250
248
  var vertical = sidebarPosition === 'left' || sidebarPosition === 'right';
251
- return /*#__PURE__*/React.createElement("div", {
249
+ return /*#__PURE__*/jsxs("div", {
252
250
  className: classNames(['d-flex', 'min-vh-100', {
253
251
  'flex-column': !vertical
254
252
  }]),
255
- "data-bs-theme": theme !== null ? theme : undefined
256
- }, /*#__PURE__*/React.createElement(MainNavbar, {
257
- className: classNames([{
258
- 'shadow-sm': !vertical,
259
- 'border-bottom': !vertical,
260
- 'sticky-top': !vertical,
261
- 'px-3': !vertical,
262
- 'pe-3': vertical && sidebarPosition === 'left',
263
- 'ps-3': vertical && sidebarPosition === 'right',
264
- 'me-2': vertical && sidebarPosition === 'left',
265
- 'ms-2': vertical && sidebarPosition === 'right'
266
- // [styles.navbar]: true,
267
- // [styles[sidebarPosition]]: sidebarPosition !== null,
268
- // [styles.verticalNav]: vertical,
269
- }]),
270
- theme: theme,
271
- loading: loading,
272
- vertical: vertical
273
- }), /*#__PURE__*/React.createElement("div", {
274
- className: classNames(['flex-grow-1', _defineProperty(_defineProperty({
275
- 'd-flex flex-column': fullscreen
276
- }, "bg-".concat(background), background !== null), "text-".concat(text), text !== null)])
277
- }, children), /*#__PURE__*/React.createElement(Modals, {
278
- theme: theme
279
- }));
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
+ });
280
280
  }
281
281
 
282
282
  function PageHeader(_ref) {
@@ -295,22 +295,31 @@ function PageHeader(_ref) {
295
295
  var _usePanneauColorSchem = usePanneauColorScheme(),
296
296
  text = _usePanneauColorSchem.text,
297
297
  background = _usePanneauColorSchem.background;
298
- var inner = /*#__PURE__*/React.createElement("div", {
299
- className: "d-flex align-items-center flex-wrap"
300
- }, title !== null ? /*#__PURE__*/React.createElement("h1", {
301
- className: classNames(['mb-0', 'h2'])
302
- }, /*#__PURE__*/React.createElement(Label, null, title)) : null, actions !== null ? /*#__PURE__*/React.createElement("div", {
303
- className: "ms-auto"
304
- }, actions) : null);
305
- return /*#__PURE__*/React.createElement("div", {
306
- 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)])
307
- }, /*#__PURE__*/React.createElement("div", {
308
- className: "container-sm"
309
- }, small ? /*#__PURE__*/React.createElement("div", {
310
- className: "row justify-content-center"
311
- }, /*#__PURE__*/React.createElement("div", {
312
- className: "col-12 col-md-8 col-lg-7"
313
- }, 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
+ });
314
323
  }
315
324
 
316
325
  function ResourceCreatePage(_ref) {
@@ -332,30 +341,36 @@ function ResourceCreatePage(_ref) {
332
341
  var onSuccess = useCallback(function () {
333
342
  navigate("".concat(resourceRoute('index'), "?created=true"));
334
343
  }, [navigate, resourceRoute]);
335
- return /*#__PURE__*/React.createElement(ResourceProvider, {
336
- resource: resource
337
- }, /*#__PURE__*/React.createElement(MainLayout, null, /*#__PURE__*/React.createElement(ResourceFormWrapper, {
344
+ return /*#__PURE__*/jsx(ResourceProvider, {
338
345
  resource: resource,
339
- type: type,
340
- onSuccess: onSuccess,
341
- withContainer: true,
342
- header: /*#__PURE__*/React.createElement(PageHeader, {
343
- title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
344
- values: resourceValues,
345
- id: "6viUpq",
346
- defaultMessage: [{
347
- "type": 0,
348
- "value": "Create "
349
- }, {
350
- "type": 1,
351
- "value": "a_singular"
352
- }]
353
- }), typeName !== null ? /*#__PURE__*/React.createElement("span", {
354
- className: "text-body-secondary"
355
- }, " (", typeName, ")") : null),
356
- 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
+ })
357
372
  })
358
- })));
373
+ });
359
374
  }
360
375
 
361
376
  function ResourceDeletePage(_ref) {
@@ -377,41 +392,47 @@ function ResourceDeletePage(_ref) {
377
392
  var onSuccess = useCallback(function () {
378
393
  return navigate("".concat(resourceRoute('index'), "?deleted=true"));
379
394
  }, [navigate, resourceRoute]);
380
- return /*#__PURE__*/React.createElement(ResourceProvider, {
381
- resource: resource
382
- }, /*#__PURE__*/React.createElement(MainLayout, {
383
- loading: loading
384
- }, item !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
395
+ return /*#__PURE__*/jsx(ResourceProvider, {
385
396
  resource: resource,
386
- item: item,
387
- onSuccess: onSuccess,
388
- isDelete: true,
389
- withContainer: true,
390
- header: /*#__PURE__*/React.createElement(PageHeader, {
391
- title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
392
- values: resourceValues,
393
- id: "zN5N/Q",
394
- defaultMessage: [{
395
- "type": 0,
396
- "value": "Delete "
397
- }, {
398
- "type": 1,
399
- "value": "a_singular"
400
- }]
401
- }), typeName !== null ? /*#__PURE__*/React.createElement("span", {
402
- className: "text-body-secondary"
403
- }, ' ', "(", typeName, ")") : null),
404
- 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]
405
434
  })
406
- }) : null, item === null && loading && !error ? /*#__PURE__*/React.createElement(Loading, {
407
- withDelay: true
408
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
409
- id: "TV3jir",
410
- defaultMessage: [{
411
- "type": 0,
412
- "value": "Loading"
413
- }]
414
- })) : null));
435
+ });
415
436
  }
416
437
 
417
438
  function ResourceEditPage(_ref) {
@@ -436,41 +457,47 @@ function ResourceEditPage(_ref) {
436
457
  setEditItem(item);
437
458
  }, [item, setEditItem]);
438
459
  var resourceValues = useResourceValues(resource);
439
- return /*#__PURE__*/React.createElement(ResourceProvider, {
440
- resource: resource
441
- }, /*#__PURE__*/React.createElement(MainLayout, {
442
- loading: loading
443
- }, editItem !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
460
+ return /*#__PURE__*/jsx(ResourceProvider, {
444
461
  resource: resource,
445
- item: editItem,
446
- type: type,
447
- onSuccess: onSuccess,
448
- withContainer: true,
449
- header: /*#__PURE__*/React.createElement(PageHeader, {
450
- title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
451
- values: resourceValues,
452
- id: "mCfzkJ",
453
- defaultMessage: [{
454
- "type": 0,
455
- "value": "Edit "
456
- }, {
457
- "type": 1,
458
- "value": "a_singular"
459
- }]
460
- }), typeName !== null ? /*#__PURE__*/React.createElement("span", {
461
- className: "text-body-secondary"
462
- }, ' ', "(", typeName, ")") : null),
463
- 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]
464
499
  })
465
- }) : null, editItem === null && loading && !error ? /*#__PURE__*/React.createElement(Loading, {
466
- withDelay: true
467
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
468
- id: "TV3jir",
469
- defaultMessage: [{
470
- "type": 0,
471
- "value": "Loading"
472
- }]
473
- })) : null));
500
+ });
474
501
  }
475
502
 
476
503
  function ResourceCreateButton(_ref) {
@@ -505,41 +532,43 @@ function ResourceCreateButton(_ref) {
505
532
  setDropdownOpened(false);
506
533
  }
507
534
  }, [setDropdownOpened, dropdownOpened]);
508
- var button = /*#__PURE__*/React.createElement(Button, {
535
+ var button = /*#__PURE__*/jsx(Button, {
509
536
  href: !hasMultipleTypes ? "".concat(resourceRoute('create')).concat(finalTypes !== null && finalTypes.length === 1 ? "?type=".concat(finalTypes[0].id) : '') : '#',
510
537
  size: size,
511
538
  theme: "primary",
512
539
  className: classNames([_defineProperty({
513
540
  'dropdown-toggle': hasMultipleTypes
514
541
  }, className, className !== null)]),
515
- onClick: hasMultipleTypes ? onClickDropdown : null
516
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
517
- values: resourceValues,
518
- id: "l+ddDH",
519
- defaultMessage: [{
520
- "type": 0,
521
- "value": "Create "
522
- }, {
523
- "type": 1,
524
- "value": "a_singular"
525
- }]
526
- }));
527
- 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", {
528
556
  className: classNames(['dropdown', {
529
557
  show: dropdownOpened
530
- }])
531
- }, button, /*#__PURE__*/React.createElement(Dropdown, {
532
- items: finalTypes.map(function (it) {
533
- return {
534
- id: it.id,
535
- label: it.name,
536
- href: "".concat(resourceRoute('create'), "?type=").concat(it.id)
537
- };
538
- }),
539
- visible: dropdownOpened,
540
- align: "end",
541
- onClickOutside: onDropdownClickOutside
542
- })) : 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;
543
572
  }
544
573
 
545
574
  var _excluded$3 = ["resource"];
@@ -552,7 +581,7 @@ function ResourceItemsList(_ref) {
552
581
  },
553
582
  _ref2$id = _ref2.id,
554
583
  finalResource = _ref2$id === void 0 ? null : _ref2$id;
555
- return /*#__PURE__*/React.createElement(ResourceList, Object.assign({
584
+ return /*#__PURE__*/jsx(ResourceList, _objectSpread({
556
585
  resource: finalResource
557
586
  }, props));
558
587
  }
@@ -632,75 +661,81 @@ function ResourceIndexPage(_ref) {
632
661
  replace: true
633
662
  });
634
663
  }, [navigate, url]);
635
- return /*#__PURE__*/React.createElement(ResourceProvider, {
636
- resource: resource
637
- }, /*#__PURE__*/React.createElement(MainLayout, null, /*#__PURE__*/React.createElement(PageHeader, {
638
- title: name,
639
- actions: finalActions.length > 0 ? /*#__PURE__*/React.createElement("div", {
640
- className: "d-flex align-items-center"
641
- }, finalActions.map(function (_ref5) {
642
- var id = _ref5.id,
643
- _ref5$component = _ref5.component,
644
- component = _ref5$component === void 0 ? Button : _ref5$component,
645
- _ref5$withQuery = _ref5.withQuery,
646
- withQuery = _ref5$withQuery === void 0 ? false : _ref5$withQuery,
647
- _ref5$href = _ref5.href,
648
- href = _ref5$href === void 0 ? null : _ref5$href,
649
- actionsProps = _objectWithoutProperties(_ref5, _excluded$2);
650
- var ActionComponent = isString(component) ? componentsManager.getComponent(component) : component;
651
- var isButton = ActionComponent === Button;
652
- var finalHref = href;
653
- if (isButton && withQuery && href !== null) {
654
- finalHref = "".concat(finalHref).concat(finalHref.indexOf('?') !== -1 ? '&' : '?').concat(queryString.stringify(query, {
655
- arrayFormat: 'bracket'
656
- }));
657
- }
658
- return ActionComponent !== null ? /*#__PURE__*/React.createElement(ActionComponent, Object.assign({
659
- key: "action-".concat(id),
660
- href: finalHref
661
- }, actionsProps, !isButton ? {
662
- resource: resource,
663
- query: query,
664
- onQueryChange: onQueryChange
665
- } : {})) : null;
666
- })) : null
667
- }), /*#__PURE__*/React.createElement("div", {
668
- className: classNames(['container-sm py-4'])
669
- }, created ? /*#__PURE__*/React.createElement(Alert, {
670
- className: "mb-4",
671
- onClose: onClickCloseAlert
672
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
673
- values: resourceValues,
674
- id: "bfP/d8",
675
- defaultMessage: [{
676
- "type": 1,
677
- "value": "The_singular"
678
- }, {
679
- "type": 0,
680
- "value": " has been created."
681
- }]
682
- })) : null, deleted ? /*#__PURE__*/React.createElement(Alert, {
683
- className: "mb-4",
684
- onClose: onClickCloseAlert
685
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
686
- values: resourceValues,
687
- id: "dkRdks",
688
- defaultMessage: [{
689
- "type": 1,
690
- "value": "The_singular"
691
- }, {
692
- "type": 0,
693
- "value": " has been deleted."
694
- }]
695
- })) : null, /*#__PURE__*/React.createElement(ResourceItemsList, {
664
+ return /*#__PURE__*/jsx(ResourceProvider, {
696
665
  resource: resource,
697
- baseUrl: url,
698
- query: listQuery,
699
- paginated: paginated,
700
- onQueryChange: onQueryChange,
701
- onQueryReset: onQueryReset,
702
- theme: theme
703
- }))));
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
+ });
704
739
  }
705
740
 
706
741
  function ResourceShowPage(_ref) {
@@ -714,29 +749,32 @@ function ResourceShowPage(_ref) {
714
749
  var _ref2 = item || {},
715
750
  _ref2$type = _ref2.type,
716
751
  type = _ref2$type === void 0 ? null : _ref2$type;
717
- return /*#__PURE__*/React.createElement(ResourceProvider, {
718
- resource: resource
719
- }, /*#__PURE__*/React.createElement(MainLayout, {
720
- loading: loading
721
- }, item !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
752
+ return /*#__PURE__*/jsx(ResourceProvider, {
722
753
  resource: resource,
723
- item: item,
724
- type: type,
725
- disabled: true,
726
- header: /*#__PURE__*/React.createElement(PageHeader, {
727
- title: "".concat(name, " #").concat(itemId),
728
- small: true
729
- }),
730
- withContainer: true
731
- }) : null, item === null && loading && !error ? /*#__PURE__*/React.createElement(Loading, {
732
- withDelay: true
733
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
734
- id: "TV3jir",
735
- defaultMessage: [{
736
- "type": 0,
737
- "value": "Loading"
738
- }]
739
- })) : 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
+ });
740
778
  }
741
779
 
742
780
  function ResourceDuplicatePage(_ref) {
@@ -763,67 +801,73 @@ function ResourceDuplicatePage(_ref) {
763
801
  id: id
764
802
  }), "?duplicated=true"));
765
803
  }, [navigate, resourceRoute]);
766
- return /*#__PURE__*/React.createElement(ResourceProvider, {
767
- resource: resource
768
- }, /*#__PURE__*/React.createElement(MainLayout, {
769
- loading: loading
770
- }, item !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
804
+ return /*#__PURE__*/jsx(ResourceProvider, {
771
805
  resource: resource,
772
- item: item,
773
- onSuccess: onSuccess,
774
- isDuplicate: true,
775
- withContainer: true,
776
- header: /*#__PURE__*/React.createElement(PageHeader, {
777
- title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, {
778
- values: resourceValues,
779
- id: "G7M4nI",
780
- defaultMessage: [{
781
- "type": 0,
782
- "value": "Duplicate "
783
- }, {
784
- "type": 1,
785
- "value": "a_singular"
786
- }]
787
- }), typeName !== null ? /*#__PURE__*/React.createElement("span", {
788
- className: "text-body-secondary"
789
- }, ' ', "(", typeName, ")") : null),
790
- 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]
791
844
  })
792
- }) : null, item === null && loading && !error ? /*#__PURE__*/React.createElement(Loading, {
793
- className: "w-10 m-auto",
794
- withDelay: true
795
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
796
- id: "TV3jir",
797
- defaultMessage: [{
798
- "type": 0,
799
- "value": "Loading"
800
- }]
801
- })) : null));
845
+ });
802
846
  }
803
847
 
804
- /* eslint-disable react/jsx-props-no-spreading */
805
848
  function ResourceLink(_ref) {
806
849
  var resource = _ref.resource;
807
850
  var route = useUrlGenerator();
808
851
  var _ref2 = resource || {},
809
852
  resourceId = _ref2.id;
810
853
  var resourceValues = useResourceValues(resource);
811
- return /*#__PURE__*/React.createElement(Link, {
854
+ return /*#__PURE__*/jsx(Link, {
812
855
  className: "d-block my-2",
813
856
  href: route('resources.index', {
814
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
+ }]
815
869
  })
816
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
817
- values: resourceValues,
818
- id: "FntHPK",
819
- defaultMessage: [{
820
- "type": 0,
821
- "value": "View "
822
- }, {
823
- "type": 1,
824
- "value": "the_plural"
825
- }]
826
- }));
870
+ });
827
871
  }
828
872
  function HomePage() {
829
873
  var resources = usePanneauResources();
@@ -834,25 +878,29 @@ function HomePage() {
834
878
  hideInNavbar = _ref3$settings2$hideI === void 0 ? false : _ref3$settings2$hideI;
835
879
  return !hideInNavbar;
836
880
  });
837
- return /*#__PURE__*/React.createElement(MainLayout, null, /*#__PURE__*/React.createElement("div", {
838
- className: "container-sm py-4"
839
- }, visibleResources.map(function (resource) {
840
- var _ref4 = resource || {},
841
- resourceId = _ref4.id;
842
- return /*#__PURE__*/React.createElement(ResourceLink, {
843
- key: "resource-link-".concat(resourceId),
844
- resource: resource
845
- });
846
- })));
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
+ });
847
893
  }
848
894
 
849
895
  function AccountPage() {
850
- return /*#__PURE__*/React.createElement(MainLayout, null, /*#__PURE__*/React.createElement("div", {
851
- className: "container-sm py-4"
852
- }, "Account page"));
896
+ return /*#__PURE__*/jsx(MainLayout, {
897
+ children: /*#__PURE__*/jsx("div", {
898
+ className: "container-sm py-4",
899
+ children: "Account page"
900
+ })
901
+ });
853
902
  }
854
903
 
855
- /* eslint-disable react/jsx-props-no-spreading */
856
904
  function LoginForm(_ref) {
857
905
  var _ref$className = _ref.className,
858
906
  className = _ref$className === void 0 ? null : _ref$className,
@@ -868,12 +916,12 @@ function LoginForm(_ref) {
868
916
  }, [login]);
869
917
  var FormComponents = useFormsComponents();
870
918
  var FormComponent = getComponentFromName('login', FormComponents);
871
- return FormComponent !== null ? /*#__PURE__*/React.createElement(FormComponent, {
919
+ return FormComponent !== null ? /*#__PURE__*/jsx(FormComponent, {
872
920
  action: url('auth.login'),
873
921
  postForm: postForm,
874
922
  onComplete: onSuccess,
875
923
  className: className,
876
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
924
+ submitButtonLabel: /*#__PURE__*/jsx(FormattedMessage, {
877
925
  id: "g6qbbX",
878
926
  defaultMessage: [{
879
927
  "type": 0,
@@ -894,25 +942,27 @@ function GuestLayout(_ref) {
894
942
  background = _usePanneauColorSchem3 === void 0 ? null : _usePanneauColorSchem3,
895
943
  _usePanneauColorSchem4 = _usePanneauColorSchem.text,
896
944
  text = _usePanneauColorSchem4 === void 0 ? null : _usePanneauColorSchem4;
897
- return /*#__PURE__*/React.createElement("div", {
945
+ return /*#__PURE__*/jsxs("div", {
898
946
  className: classNames([{
899
947
  'd-flex flex-column min-vh-100': fullscreen
900
948
  }]),
901
- "data-bs-theme": theme !== null ? theme : undefined
902
- }, /*#__PURE__*/React.createElement(MainNavbar, {
903
- className: classNames(['sticky-top', 'px-3'])
904
- }), /*#__PURE__*/React.createElement("div", {
905
- className: classNames(_defineProperty(_defineProperty({
906
- 'd-flex flex-column flex-grow-1': fullscreen
907
- }, "bg-".concat(background), background !== null), "text-".concat(text), text !== null))
908
- }, /*#__PURE__*/React.createElement("div", {
909
- className: classNames({
910
- 'w-100 my-auto': fullscreen
911
- })
912
- }, 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
+ });
913
964
  }
914
965
 
915
- /* eslint-disable react/jsx-props-no-spreading */
916
966
  function LoginPage() {
917
967
  var route = useUrlGenerator();
918
968
  // Sadly necessary to update cookies and routes correctly from the backend,
@@ -920,25 +970,30 @@ function LoginPage() {
920
970
  var onSuccess = useCallback(function () {
921
971
  window.location.href = route('home');
922
972
  }, [route]);
923
- return /*#__PURE__*/React.createElement(GuestLayout, {
924
- fullscreen: true
925
- }, /*#__PURE__*/React.createElement("div", {
926
- className: "container-sm py-4"
927
- }, /*#__PURE__*/React.createElement("div", {
928
- className: "row justify-content-center"
929
- }, /*#__PURE__*/React.createElement("div", {
930
- className: "col-12 col-sm-8 col-md-6"
931
- }, /*#__PURE__*/React.createElement("h1", {
932
- className: "mb-4"
933
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
934
- id: "AeOZq+",
935
- defaultMessage: [{
936
- "type": 0,
937
- "value": "Login"
938
- }]
939
- })), /*#__PURE__*/React.createElement(LoginForm, {
940
- onSuccess: onSuccess
941
- })))));
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
+ });
942
997
  }
943
998
 
944
999
  var messages = defineMessages({
@@ -1037,15 +1092,27 @@ var messages = defineMessages({
1037
1092
  function ErrorPage(_ref) {
1038
1093
  var _ref$statusCode = _ref.statusCode,
1039
1094
  statusCode = _ref$statusCode === void 0 ? null : _ref$statusCode;
1040
- return /*#__PURE__*/React.createElement(GuestLayout, {
1041
- fullscreen: true
1042
- }, /*#__PURE__*/React.createElement("div", {
1043
- className: "container-sm py-4"
1044
- }, /*#__PURE__*/React.createElement("div", {
1045
- className: "row justify-content-center"
1046
- }, /*#__PURE__*/React.createElement("div", {
1047
- className: "col-12 col-sm-8 col-md-6"
1048
- }, /*#__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
+ });
1049
1116
  }
1050
1117
 
1051
1118
  var _excluded$1 = ["path", "component"];
@@ -1093,91 +1160,91 @@ function createResourceRoutes(resource, _ref) {
1093
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;
1094
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;
1095
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;
1096
- return [/*#__PURE__*/React.createElement(Route, {
1097
- key: "".concat(resourceId, "-create"),
1163
+ return [/*#__PURE__*/jsx(Route, {
1098
1164
  path: route('resources.create', {
1099
1165
  resource: resourceId
1100
1166
  }),
1101
- exact: true
1102
- }, function () {
1103
- return /*#__PURE__*/React.createElement(ResourceCreateComponent, {
1104
- resource: resource
1105
- });
1106
- }), /*#__PURE__*/React.createElement(Route, {
1107
- 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, {
1108
1174
  path: route('resources.show', {
1109
1175
  resource: resourceId,
1110
1176
  id: ':id'
1111
- })
1112
- }, function (_ref4) {
1113
- var _ref4$id = _ref4.id,
1114
- id = _ref4$id === void 0 ? null : _ref4$id;
1115
- return /*#__PURE__*/React.createElement(ResourceShowComponent, {
1116
- itemId: id,
1117
- resource: resource
1118
- });
1119
- }), /*#__PURE__*/React.createElement(Route, {
1120
- 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, {
1121
1187
  path: route('resources.edit', {
1122
1188
  resource: resourceId,
1123
1189
  id: ':id'
1124
- })
1125
- }, function (_ref5) {
1126
- var _ref5$id = _ref5.id,
1127
- id = _ref5$id === void 0 ? null : _ref5$id;
1128
- return /*#__PURE__*/React.createElement(ResourceEditComponent, {
1129
- itemId: id,
1130
- resource: resource
1131
- });
1132
- }), /*#__PURE__*/React.createElement(Route, {
1133
- 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, {
1134
1200
  path: route('resources.delete', {
1135
1201
  resource: resourceId,
1136
1202
  id: ':id'
1137
- })
1138
- }, function (_ref6) {
1139
- var _ref6$id = _ref6.id,
1140
- id = _ref6$id === void 0 ? null : _ref6$id;
1141
- return /*#__PURE__*/React.createElement(ResourceDeleteComponent, {
1142
- itemId: id,
1143
- resource: resource
1144
- });
1145
- }), /*#__PURE__*/React.createElement(Route, {
1146
- 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, {
1147
1213
  path: route('resources.duplicate', {
1148
1214
  resource: resourceId,
1149
1215
  id: ':id'
1150
- })
1151
- }, function (_ref7) {
1152
- var _ref7$id = _ref7.id,
1153
- id = _ref7$id === void 0 ? null : _ref7$id;
1154
- return /*#__PURE__*/React.createElement(ResourceDuplicateComponent, {
1155
- itemId: id,
1156
- resource: resource
1157
- });
1158
- })].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) {
1159
1226
  var path = _ref8.path,
1160
1227
  component = _ref8.component,
1161
1228
  pageProps = _objectWithoutProperties(_ref8, _excluded$1);
1162
1229
  var RouteComponent = componentsManager.getComponent(component);
1163
- return RouteComponent !== null ? /*#__PURE__*/React.createElement(Route, {
1164
- key: "route-".concat(path),
1165
- path: path
1166
- }, function () {
1167
- return /*#__PURE__*/React.createElement(RouteComponent, Object.assign({
1168
- resource: resource
1169
- }, pageProps));
1170
- }) : null;
1171
- })), [/*#__PURE__*/React.createElement(Route, {
1172
- 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, {
1173
1239
  path: route('resources.index', {
1174
1240
  resource: resourceId
1175
- })
1176
- }, function () {
1177
- return /*#__PURE__*/React.createElement(ResourceIndexComponent, {
1178
- resource: resource
1179
- });
1180
- })]);
1241
+ }),
1242
+ children: function children() {
1243
+ return /*#__PURE__*/jsx(ResourceIndexComponent, {
1244
+ resource: resource
1245
+ });
1246
+ }
1247
+ }, "".concat(resourceId, "-index"))]);
1181
1248
  }
1182
1249
 
1183
1250
  var _excluded = ["home", "login", "account", "error", "index", "show", "create", "edit", "delete", "duplicate"],
@@ -1257,54 +1324,66 @@ function PanneauRoutes(_ref) {
1257
1324
 
1258
1325
  // If there is an error status code
1259
1326
  if (statusCode !== null) {
1260
- return /*#__PURE__*/React.createElement(ErrorComponent, Object.assign({
1327
+ return /*#__PURE__*/jsx(ErrorComponent, _objectSpread({
1261
1328
  statusCode: statusCode
1262
1329
  }, errorPage));
1263
1330
  }
1264
1331
 
1265
1332
  // If user is unauthenticated
1266
1333
  if (user === null) {
1267
- return /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
1268
- path: routes['auth.login']
1269
- }, /*#__PURE__*/React.createElement(LoginComponent, loginPage)), /*#__PURE__*/React.createElement(Route, null, /*#__PURE__*/React.createElement(Redirect, {
1270
- to: "".concat(route('auth.login'), "?next=").concat(encodeURIComponent(pathname))
1271
- })));
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
+ });
1272
1344
  }
1273
1345
 
1274
1346
  // Normal routes
1275
- return /*#__PURE__*/React.createElement(Switch, null, user !== null ? /*#__PURE__*/React.createElement(Route, {
1276
- path: routes['auth.login']
1277
- }, /*#__PURE__*/React.createElement(Redirect, {
1278
- to: routes.home,
1279
- replace: true
1280
- })) : null, resources.map(function (resource) {
1281
- var _ref4 = resource || {},
1282
- resourceId = _ref4.id;
1283
- return /*#__PURE__*/React.createElement(Fragment, {
1284
- key: "resource-".concat(resourceId)
1285
- }, createResourceRoutes(resource, {
1286
- route: route,
1287
- componentsManager: componentsManager,
1288
- pages: pages
1289
- }));
1290
- }), /*#__PURE__*/React.createElement(Route, {
1291
- path: routes.account
1292
- }, /*#__PURE__*/React.createElement(AccountComponent, accountPage)), customRoutes.map(function (_ref5) {
1293
- var _ref5$path = _ref5.path,
1294
- path = _ref5$path === void 0 ? null : _ref5$path,
1295
- _ref5$route = _ref5.route,
1296
- pageRoute = _ref5$route === void 0 ? null : _ref5$route,
1297
- component = _ref5.component,
1298
- props = _objectWithoutProperties(_ref5, _excluded2);
1299
- var PageComponent = componentsManager.getComponent(component);
1300
- var finalPath = path || routes[pageRoute];
1301
- return PageComponent !== null ? /*#__PURE__*/React.createElement(Route, {
1302
- key: "custom-route-".concat(finalPath),
1303
- path: path || routes[pageRoute]
1304
- }, /*#__PURE__*/React.createElement(PageComponent, props)) : null;
1305
- }), /*#__PURE__*/React.createElement(Route, {
1306
- path: routes.home
1307
- }, /*#__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
+ });
1308
1387
  }
1309
1388
 
1310
1389
  var pathToRegexpParser = createPathToRegexpParser();
@@ -1365,36 +1444,60 @@ function Container(_ref) {
1365
1444
  var _useMemoryRouter = useMemoryRouter(),
1366
1445
  memoryLocationHook = _useMemoryRouter.hook,
1367
1446
  memorySearchHook = _useMemoryRouter.searchHook;
1368
- return /*#__PURE__*/React.createElement(Router, {
1447
+ return /*#__PURE__*/jsx(Router, {
1369
1448
  hook: isMemoryRouter ? memoryLocationHook : undefined,
1370
1449
  searchHook: isMemoryRouter ? memorySearchHook : undefined,
1371
- parser: pathToRegexpParser
1372
- }, /*#__PURE__*/React.createElement(IntlProvider, {
1373
- locale: locale,
1374
- locales: locales,
1375
- extraMessages: extraMessages
1376
- }, /*#__PURE__*/React.createElement(PanneauProvider, {
1377
- definition: definition
1378
- }, /*#__PURE__*/React.createElement(UppyProvider, uppy, /*#__PURE__*/React.createElement(RoutesProvider, {
1379
- routes: routes
1380
- }, /*#__PURE__*/React.createElement(FieldsProvider, null, /*#__PURE__*/React.createElement(FormsProvider, null, /*#__PURE__*/React.createElement(ListsProvider, null, /*#__PURE__*/React.createElement(DisplaysProvider, null, /*#__PURE__*/React.createElement(FiltersProvider, null, /*#__PURE__*/React.createElement(ActionsProvider, null, /*#__PURE__*/React.createElement(ModalProvider, null, /*#__PURE__*/React.createElement(ModalsProvider, null, /*#__PURE__*/React.createElement(ApiProvider, {
1381
- baseUrl: baseUrl,
1382
- onUnauthorized: onUnauthorized
1383
- }, /*#__PURE__*/React.createElement(QueryProvider, null, /*#__PURE__*/React.createElement(AuthProvider, {
1384
- user: user,
1385
- onLogout: onLogout
1386
- }, /*#__PURE__*/React.createElement(ComponentsProvider, {
1387
- components: components
1388
- }, /*#__PURE__*/React.createElement(PanneauRoutes, {
1389
- statusCode: statusCode
1390
- }))))))))))))))))));
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
+ });
1391
1497
  }
1392
1498
 
1393
- /* eslint-disable react/jsx-props-no-spreading */
1394
-
1395
- // Kept for backward compatibility with exports
1396
1499
  function ResourceFilters(props) {
1397
- return /*#__PURE__*/React.createElement(Filters, props);
1500
+ return /*#__PURE__*/jsx(Filters, _objectSpread({}, props));
1398
1501
  }
1399
1502
 
1400
1503
  export { GuestLayout, MainLayout, PageHeader, ResourceFilters, ResourceFormWrapper as ResourceForm, ResourceItemsList, Container as default };