@comet/admin 9.0.0-beta.3 → 9.0.0-beta.5

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 (105) hide show
  1. package/lib/common/DeleteDialog.d.ts +1 -0
  2. package/lib/common/DeleteDialog.d.ts.map +1 -1
  3. package/lib/common/DeleteDialog.js +8 -1
  4. package/lib/common/__stories__/Tooltip.stories.js +404 -0
  5. package/lib/common/buttons/__stories__/Button.stories.js +445 -0
  6. package/lib/common/buttons/clearinput/ClearInputButton.js +1 -1
  7. package/lib/common/buttons/delete/__stories__/DeleteButton.stories.js +1 -1
  8. package/lib/common/toolbar/__stories__/DataGridToolbar.stories.js +76 -0
  9. package/lib/common/toolbar/__stories__/Toolbar.stories.js +82 -0
  10. package/lib/dataGrid/__stories__/ClickableRows.stories.js +109 -0
  11. package/lib/dataGrid/__stories__/CrudMoreActionsMenu.stories.js +50 -0
  12. package/lib/dataGrid/__stories__/DataGrid.stories.js +94 -0
  13. package/lib/dataGrid/__stories__/DataGridSingleSelectFilter.stories.js +492 -0
  14. package/lib/error/errorHandler/ErrorHandlerProvider.d.ts +8 -0
  15. package/lib/error/errorHandler/ErrorHandlerProvider.d.ts.map +1 -0
  16. package/lib/error/errorHandler/ErrorHandlerProvider.js +16 -0
  17. package/lib/error/errorboundary/ErrorBoundary.d.ts.map +1 -1
  18. package/lib/error/errorboundary/ErrorBoundary.js +26 -18
  19. package/lib/form/FinalFormInput.d.ts.map +1 -1
  20. package/lib/form/FinalFormInput.js +3 -2
  21. package/lib/form/__stories__/AsyncAutocompleteField.stories.js +660 -0
  22. package/lib/form/__stories__/AsyncSelectField.stories.js +513 -0
  23. package/lib/form/__stories__/Autocomplete.stories.js +188 -0
  24. package/lib/form/__stories__/AutocompleteField.stories.js +48 -0
  25. package/lib/form/__stories__/Checkbox.stories.js +70 -0
  26. package/lib/form/__stories__/CheckboxField.stories.js +87 -0
  27. package/lib/form/__stories__/CheckboxListField.stories.js +172 -0
  28. package/lib/form/__stories__/CustomButtons.stories.js +78 -0
  29. package/lib/form/__stories__/DependentAsyncSelects.stories.js +91 -0
  30. package/lib/form/__stories__/DisableAutoNavigation.stories.js +132 -0
  31. package/lib/form/__stories__/DisabledSubmitIfNotDirty.stories.js +54 -0
  32. package/lib/form/__stories__/FieldContainer.stories.js +87 -0
  33. package/lib/form/__stories__/FinalFormFileSelect.stories.js +155 -0
  34. package/lib/form/__stories__/FormInStack.stories.js +133 -0
  35. package/lib/form/__stories__/FormLayouts.stories.js +174 -0
  36. package/lib/form/__stories__/FormValidation.stories.js +82 -0
  37. package/lib/form/__stories__/Input.stories.js +37 -0
  38. package/lib/form/__stories__/NumberField.stories.js +38 -0
  39. package/lib/form/__stories__/Radio.stories.js +101 -0
  40. package/lib/form/__stories__/RadioGroupField.stories.js +172 -0
  41. package/lib/form/__stories__/RangeInput.stories.js +239 -0
  42. package/lib/form/__stories__/RouterTabs.stories.js +96 -0
  43. package/lib/form/__stories__/RouterTabsInForm.stories.js +73 -0
  44. package/lib/form/__stories__/RouterTabsInFormWithSubroutes.stories.js +96 -0
  45. package/lib/form/__stories__/ScrollToErrorField.stories.js +82 -0
  46. package/lib/form/__stories__/SearchField.stories.js +38 -0
  47. package/lib/form/__stories__/Select.stories.js +187 -0
  48. package/lib/form/__stories__/SelectField.stories.js +100 -0
  49. package/lib/form/__stories__/ShowErrorStrategies.stories.js +107 -0
  50. package/lib/form/__stories__/SingleTextField.stories.js +108 -0
  51. package/lib/form/__stories__/StackInForm.stories.js +53 -0
  52. package/lib/form/__stories__/SubmitErrors.stories.js +90 -0
  53. package/lib/form/__stories__/Switch.stories.js +49 -0
  54. package/lib/form/__stories__/SwitchField.stories.js +87 -0
  55. package/lib/form/__stories__/Tabs.stories.js +78 -0
  56. package/lib/form/__stories__/TextAreaField.stories.js +38 -0
  57. package/lib/form/__stories__/TextField.stories.js +67 -0
  58. package/lib/form/__stories__/ToggleButtonGroupField.stories.js +312 -0
  59. package/lib/form/__stories__/TwoLevelValidation.stories.js +168 -0
  60. package/lib/form/__stories__/Typography.stories.js +71 -0
  61. package/lib/form/file/__stories__/FileDropzone.stories.js +81 -0
  62. package/lib/form/file/__stories__/FileSelect.stories.js +139 -0
  63. package/lib/form/file/__stories__/FileSelectListItem.stories.js +108 -0
  64. package/lib/form/file/__stories__/FileSelectMultipleExamples.stories.js +187 -0
  65. package/lib/helpers/useTopOffset.js +1 -1
  66. package/lib/index.d.ts +1 -0
  67. package/lib/index.d.ts.map +1 -1
  68. package/lib/index.js +1 -0
  69. package/lib/section/__stories__/SectionHeadline.stories.js +71 -0
  70. package/lib/stack/Stack.d.ts.map +1 -1
  71. package/lib/stack/Stack.js +3 -0
  72. package/lib/stack/__stories__/RouterTabsNestedStack.stories.js +51 -0
  73. package/lib/stack/__stories__/Stack.stories.js +14 -0
  74. package/lib/stack/__stories__/StackBackButton.stories.js +50 -0
  75. package/lib/stack/__stories__/StackBreadcrumbs.stories.js +139 -0
  76. package/lib/stack/__stories__/StackBreadcrumbsTabs.stories.js +47 -0
  77. package/lib/stack/__stories__/StackCustomSeparator.stories.js +47 -0
  78. package/lib/stack/__stories__/StackLink.stories.js +41 -0
  79. package/lib/stack/__stories__/StackNested.stories.js +58 -0
  80. package/lib/stack/__stories__/StackNestedOnInitialPage.stories.js +78 -0
  81. package/lib/stack/__stories__/StackNestedOneStack.stories.js +90 -0
  82. package/lib/stack/__stories__/StackPageTitle.stories.js +121 -0
  83. package/lib/stack/__stories__/StackReactNodeTitle.stories.js +54 -0
  84. package/lib/stack/__stories__/StackRefApi.stories.js +56 -0
  85. package/lib/stack/__stories__/StackTableFormQueryAtStack.stories.js +155 -0
  86. package/lib/stack/__stories__/StackTableFormQueryInTable.stories.js +160 -0
  87. package/lib/stack/__stories__/StackUrl.stories.js +66 -0
  88. package/lib/tabs/__stories__/DynamicTabs.stories.js +84 -0
  89. package/lib/tabs/__stories__/NestedStackSwitchWithRouterTabs.stories.js +84 -0
  90. package/lib/tabs/__stories__/OverflowIssues.stories.js +224 -0
  91. package/lib/tabs/__stories__/RouterTabs.stories.js +31 -0
  92. package/lib/tabs/__stories__/RouterTabsInStack.stories.js +74 -0
  93. package/lib/tabs/__stories__/RouterTabsInSubroute.stories.js +68 -0
  94. package/lib/tabs/__stories__/Tabs.stories.js +219 -0
  95. package/lib/theme/componentsTheme/MuiDataGrid.js +1 -1
  96. package/lib/translator/ContentTranslationServiceContext.d.ts +1 -0
  97. package/lib/translator/ContentTranslationServiceContext.d.ts.map +1 -1
  98. package/lib/translator/ContentTranslationServiceProvider.d.ts +1 -1
  99. package/lib/translator/ContentTranslationServiceProvider.d.ts.map +1 -1
  100. package/lib/translator/ContentTranslationServiceProvider.js +4 -2
  101. package/lib/translator/PlainTextTranslationDialog.d.ts +1 -0
  102. package/lib/translator/PlainTextTranslationDialog.d.ts.map +1 -1
  103. package/lib/translator/PlainTextTranslationDialog.js +8 -3
  104. package/lib/translator/__stories__/ContentTranslation.stories.js +104 -0
  105. package/package.json +23 -24
@@ -0,0 +1,91 @@
1
+ var _templateObject, _templateObject2;
2
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
3
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
4
+ function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
5
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
6
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
7
+ import { gql, useApolloClient } from "@apollo/client";
8
+ import { Box } from "@mui/material";
9
+ import { FinalForm } from "../../FinalForm";
10
+ import { AsyncSelectField } from "../../form/fields/AsyncSelectField";
11
+ import { OnChangeField } from "../../form/helpers/OnChangeField";
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ export default {
14
+ title: "components/form"
15
+ };
16
+ export var DependentAsyncSelects = function DependentAsyncSelects() {
17
+ var client = useApolloClient();
18
+ return /*#__PURE__*/_jsx(Box, {
19
+ maxWidth: 400,
20
+ children: /*#__PURE__*/_jsx(FinalForm, {
21
+ mode: "add",
22
+ onSubmit: function onSubmit() {
23
+ // Noop
24
+ },
25
+ children: function children(_ref) {
26
+ var values = _ref.values,
27
+ form = _ref.form;
28
+ return /*#__PURE__*/_jsxs(_Fragment, {
29
+ children: [/*#__PURE__*/_jsx(AsyncSelectField, {
30
+ name: "manufacturer",
31
+ loadOptions: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
32
+ var _yield$client$query, data;
33
+ return _regenerator().w(function (_context) {
34
+ while (1) switch (_context.n) {
35
+ case 0:
36
+ _context.n = 1;
37
+ return client.query({
38
+ query: gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query Manufacturers {\n manufacturers {\n id\n name\n }\n }\n "])))
39
+ });
40
+ case 1:
41
+ _yield$client$query = _context.v;
42
+ data = _yield$client$query.data;
43
+ return _context.a(2, data.manufacturers);
44
+ }
45
+ }, _callee);
46
+ })),
47
+ getOptionLabel: function getOptionLabel(option) {
48
+ return option.name;
49
+ },
50
+ label: "Manufacturer",
51
+ fullWidth: true
52
+ }), /*#__PURE__*/_jsx(AsyncSelectField, {
53
+ name: "product",
54
+ loadOptions: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
55
+ var _values$manufacturer;
56
+ var _yield$client$query2, data;
57
+ return _regenerator().w(function (_context2) {
58
+ while (1) switch (_context2.n) {
59
+ case 0:
60
+ _context2.n = 1;
61
+ return client.query({
62
+ query: gql(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n query Products($manufacturer: ID) {\n products(manufacturer: $manufacturer) {\n id\n name\n }\n }\n "]))),
63
+ variables: {
64
+ manufacturer: (_values$manufacturer = values.manufacturer) === null || _values$manufacturer === void 0 ? void 0 : _values$manufacturer.id
65
+ }
66
+ });
67
+ case 1:
68
+ _yield$client$query2 = _context2.v;
69
+ data = _yield$client$query2.data;
70
+ return _context2.a(2, data.products);
71
+ }
72
+ }, _callee2);
73
+ })),
74
+ getOptionLabel: function getOptionLabel(option) {
75
+ return option.name;
76
+ },
77
+ label: "Product",
78
+ fullWidth: true,
79
+ disabled: !values.manufacturer
80
+ }), /*#__PURE__*/_jsx(OnChangeField, {
81
+ name: "manufacturer",
82
+ children: function children() {
83
+ form.change("product", undefined);
84
+ }
85
+ })]
86
+ });
87
+ }
88
+ })
89
+ });
90
+ };
91
+ DependentAsyncSelects.storyName = "Dependent async selects";
@@ -0,0 +1,132 @@
1
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
2
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
3
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
4
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
5
+ import { Edit } from "@comet/admin-icons";
6
+ import { Box, Card, CardContent, IconButton, Paper, Typography } from "@mui/material";
7
+ import { useContext } from "react";
8
+ import { Switch } from "react-router";
9
+ import { MainContent } from "../../common/MainContent";
10
+ import { ToolbarBackButton } from "../../common/toolbar/backbutton/ToolbarBackButton";
11
+ import { ToolbarItem } from "../../common/toolbar/item/ToolbarItem";
12
+ import { Toolbar } from "../../common/toolbar/Toolbar";
13
+ import { FinalForm } from "../../FinalForm";
14
+ import { Field } from "../../form/Field";
15
+ import { FinalFormInput } from "../../form/FinalFormInput";
16
+ import { StackPage } from "../../stack/Page";
17
+ import { Stack } from "../../stack/Stack";
18
+ import { StackSwitch, StackSwitchApiContext } from "../../stack/Switch";
19
+ import { Table } from "../../table/Table";
20
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
21
+ var SampleTable = function SampleTable() {
22
+ var stackApi = useContext(StackSwitchApiContext);
23
+ return /*#__PURE__*/_jsxs(_Fragment, {
24
+ children: [/*#__PURE__*/_jsx(Box, {
25
+ marginBottom: 4,
26
+ children: /*#__PURE__*/_jsxs(Toolbar, {
27
+ children: [/*#__PURE__*/_jsx(ToolbarBackButton, {}), /*#__PURE__*/_jsx(ToolbarItem, {
28
+ children: /*#__PURE__*/_jsx(Typography, {
29
+ variant: "h3",
30
+ children: "Sample Table"
31
+ })
32
+ })]
33
+ })
34
+ }), /*#__PURE__*/_jsx(Paper, {
35
+ elevation: 0,
36
+ children: /*#__PURE__*/_jsx(Table, {
37
+ data: [{
38
+ id: "1",
39
+ name: "Lorem"
40
+ }, {
41
+ id: "2",
42
+ name: "ipsum"
43
+ }],
44
+ totalCount: 2,
45
+ columns: [{
46
+ name: "id",
47
+ header: "id"
48
+ }, {
49
+ name: "name",
50
+ header: "Title"
51
+ }, {
52
+ name: "actions",
53
+ render: function render(recipe) {
54
+ return /*#__PURE__*/_jsx(IconButton, {
55
+ color: "primary",
56
+ onClick: function onClick() {
57
+ return stackApi.activatePage("edit", recipe.id);
58
+ },
59
+ size: "large",
60
+ children: /*#__PURE__*/_jsx(Edit, {})
61
+ });
62
+ }
63
+ }]
64
+ })
65
+ })]
66
+ });
67
+ };
68
+ var SampleForm = function SampleForm() {
69
+ var onSubmit = /*#__PURE__*/function () {
70
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
71
+ return _regenerator().w(function (_context) {
72
+ while (1) switch (_context.n) {
73
+ case 0:
74
+ alert("Submit successful");
75
+ return _context.a(2, Promise.resolve());
76
+ }
77
+ }, _callee);
78
+ }));
79
+ return function onSubmit() {
80
+ return _ref.apply(this, arguments);
81
+ };
82
+ }();
83
+ return /*#__PURE__*/_jsxs(_Fragment, {
84
+ children: [/*#__PURE__*/_jsxs(Toolbar, {
85
+ children: [/*#__PURE__*/_jsx(ToolbarBackButton, {}), /*#__PURE__*/_jsx(ToolbarItem, {
86
+ children: /*#__PURE__*/_jsx(Typography, {
87
+ variant: "h3",
88
+ children: "Sample Form"
89
+ })
90
+ })]
91
+ }), /*#__PURE__*/_jsx(MainContent, {
92
+ children: /*#__PURE__*/_jsx(FinalForm, {
93
+ mode: "edit",
94
+ onSubmit: onSubmit,
95
+ onAfterSubmit: function onAfterSubmit(values, form) {
96
+ form.reset(values); //Reset values to new values so dirty state is correct after submitting
97
+ },
98
+ children: /*#__PURE__*/_jsx(Card, {
99
+ variant: "outlined",
100
+ children: /*#__PURE__*/_jsx(CardContent, {
101
+ children: /*#__PURE__*/_jsx(Field, {
102
+ label: "Foo",
103
+ name: "foo",
104
+ component: FinalFormInput
105
+ })
106
+ })
107
+ })
108
+ })
109
+ })]
110
+ });
111
+ };
112
+ export default {
113
+ title: "components/form"
114
+ };
115
+ export var DisableAutoNavigation = function DisableAutoNavigation() {
116
+ return /*#__PURE__*/_jsx(Switch, {
117
+ children: /*#__PURE__*/_jsx(Stack, {
118
+ topLevelTitle: "Sample",
119
+ children: /*#__PURE__*/_jsxs(StackSwitch, {
120
+ initialPage: "table",
121
+ children: [/*#__PURE__*/_jsx(StackPage, {
122
+ name: "table",
123
+ children: /*#__PURE__*/_jsx(SampleTable, {})
124
+ }), /*#__PURE__*/_jsx(StackPage, {
125
+ name: "edit",
126
+ title: "Edit",
127
+ children: /*#__PURE__*/_jsx(SampleForm, {})
128
+ })]
129
+ })
130
+ })
131
+ });
132
+ };
@@ -0,0 +1,54 @@
1
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
2
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
3
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
4
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
5
+ import { SaveButton } from "../../common/buttons/SaveButton";
6
+ import { FinalForm } from "../../FinalForm";
7
+ import { Field } from "../../form/Field";
8
+ import { FinalFormInput } from "../../form/FinalFormInput";
9
+ import { FormSection } from "../../form/FormSection";
10
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
+ export default {
12
+ title: "stories/form/FinalForm"
13
+ };
14
+ export var DisabledSubmitIfNotDirty = function DisabledSubmitIfNotDirty() {
15
+ return /*#__PURE__*/_jsx(FinalForm, {
16
+ mode: "add",
17
+ onSubmit: (/*#__PURE__*/function () {
18
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(values) {
19
+ return _regenerator().w(function (_context) {
20
+ while (1) switch (_context.n) {
21
+ case 0:
22
+ window.alert(JSON.stringify(values));
23
+ case 1:
24
+ return _context.a(2);
25
+ }
26
+ }, _callee);
27
+ }));
28
+ return function (_x) {
29
+ return _ref.apply(this, arguments);
30
+ };
31
+ }()),
32
+ children: function children(_ref2) {
33
+ var dirty = _ref2.dirty;
34
+ return /*#__PURE__*/_jsxs(_Fragment, {
35
+ children: [/*#__PURE__*/_jsxs(FormSection, {
36
+ children: [/*#__PURE__*/_jsx(Field, {
37
+ label: "First name",
38
+ name: "firstname",
39
+ component: FinalFormInput,
40
+ fullWidth: true
41
+ }), /*#__PURE__*/_jsx(Field, {
42
+ label: "Last name",
43
+ name: "lastname",
44
+ component: FinalFormInput,
45
+ fullWidth: true
46
+ })]
47
+ }), /*#__PURE__*/_jsx(SaveButton, {
48
+ type: "submit",
49
+ disabled: !dirty
50
+ })]
51
+ });
52
+ }
53
+ });
54
+ };
@@ -0,0 +1,87 @@
1
+ import { Form } from "react-final-form";
2
+ import { FieldSet } from "../../common/FieldSet";
3
+ import { TextField } from "../../form/fields/TextField";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ export default {
6
+ title: "components/form"
7
+ };
8
+ export var FieldContainer = function FieldContainer() {
9
+ return /*#__PURE__*/_jsx(Form, {
10
+ onSubmit: function onSubmit() {
11
+ // do nothing
12
+ },
13
+ render: function render(_ref) {
14
+ var handleSubmit = _ref.handleSubmit;
15
+ return /*#__PURE__*/_jsxs("form", {
16
+ onSubmit: handleSubmit,
17
+ children: [/*#__PURE__*/_jsxs(FieldSet, {
18
+ title: "HORIZONTAL (Full-width)",
19
+ children: [/*#__PURE__*/_jsx(TextField, {
20
+ name: "textFieldWithLabelOne",
21
+ label: "TextField label",
22
+ variant: "horizontal",
23
+ fullWidth: true
24
+ }), /*#__PURE__*/_jsx(TextField, {
25
+ name: "textFieldWithLabelTwo",
26
+ label: "TextField label",
27
+ variant: "horizontal",
28
+ fullWidth: true
29
+ }), /*#__PURE__*/_jsx(TextField, {
30
+ name: "testWithoutLabel",
31
+ variant: "horizontal",
32
+ placeholder: "TextField without label",
33
+ fullWidth: true
34
+ })]
35
+ }), /*#__PURE__*/_jsxs(FieldSet, {
36
+ title: "VERTICAL (Full-width)",
37
+ children: [/*#__PURE__*/_jsx(TextField, {
38
+ name: "textFieldWithLabelOne",
39
+ label: "TextField label",
40
+ variant: "vertical",
41
+ fullWidth: true
42
+ }), /*#__PURE__*/_jsx(TextField, {
43
+ name: "textFieldWithLabelTwo",
44
+ label: "TextField label",
45
+ variant: "vertical",
46
+ fullWidth: true
47
+ }), /*#__PURE__*/_jsx(TextField, {
48
+ name: "testWithoutLabel",
49
+ variant: "vertical",
50
+ placeholder: "TextField without label",
51
+ fullWidth: true
52
+ })]
53
+ }), /*#__PURE__*/_jsxs(FieldSet, {
54
+ title: "HORIZONTAL (auto-width)",
55
+ children: [/*#__PURE__*/_jsx(TextField, {
56
+ name: "textFieldWithLabelOne",
57
+ label: "TextField label",
58
+ variant: "horizontal"
59
+ }), /*#__PURE__*/_jsx(TextField, {
60
+ name: "textFieldWithLabelTwo",
61
+ label: "TextField label",
62
+ variant: "horizontal"
63
+ }), /*#__PURE__*/_jsx(TextField, {
64
+ name: "testWithoutLabel",
65
+ variant: "horizontal",
66
+ placeholder: "TextField without label"
67
+ })]
68
+ }), /*#__PURE__*/_jsxs(FieldSet, {
69
+ title: "VERTICAL (auto-width)",
70
+ children: [/*#__PURE__*/_jsx(TextField, {
71
+ name: "textFieldWithLabelOne",
72
+ label: "TextField label",
73
+ variant: "vertical"
74
+ }), /*#__PURE__*/_jsx(TextField, {
75
+ name: "textFieldWithLabelTwo",
76
+ label: "TextField label",
77
+ variant: "vertical"
78
+ }), /*#__PURE__*/_jsx(TextField, {
79
+ name: "testWithoutLabel",
80
+ variant: "vertical",
81
+ placeholder: "TextField without label"
82
+ })]
83
+ })]
84
+ });
85
+ }
86
+ });
87
+ };
@@ -0,0 +1,155 @@
1
+ import { Box, Card, CardContent, Grid, Typography } from "@mui/material";
2
+ import { Form } from "react-final-form";
3
+ import { Field } from "../../form/Field";
4
+ import { FinalFormFileSelect } from "../../form/FinalFormFileSelect";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ export default {
7
+ title: "components/form"
8
+ };
9
+ export var _FinalFormFileSelect = {
10
+ render: function render() {
11
+ return /*#__PURE__*/_jsx(Box, {
12
+ maxWidth: 1600,
13
+ children: /*#__PURE__*/_jsx(Form, {
14
+ onSubmit: function onSubmit(values) {
15
+ //
16
+ },
17
+ render: function render(_ref) {
18
+ var handleSubmit = _ref.handleSubmit,
19
+ values = _ref.values;
20
+ return /*#__PURE__*/_jsxs("form", {
21
+ onSubmit: handleSubmit,
22
+ children: [/*#__PURE__*/_jsxs(Grid, {
23
+ container: true,
24
+ spacing: 4,
25
+ children: [/*#__PURE__*/_jsx(Grid, {
26
+ size: 6,
27
+ children: /*#__PURE__*/_jsx(Card, {
28
+ variant: "outlined",
29
+ children: /*#__PURE__*/_jsx(CardContent, {
30
+ children: /*#__PURE__*/_jsx(Field, {
31
+ name: "singleFile",
32
+ label: "Single file select",
33
+ component: FinalFormFileSelect,
34
+ fullWidth: true
35
+ })
36
+ })
37
+ })
38
+ }), /*#__PURE__*/_jsx(Grid, {
39
+ size: 6,
40
+ children: /*#__PURE__*/_jsx(Card, {
41
+ variant: "outlined",
42
+ children: /*#__PURE__*/_jsx(CardContent, {
43
+ children: /*#__PURE__*/_jsx(Field, {
44
+ name: "multipleFiles",
45
+ label: "Multi file select (max file size 5 MB)",
46
+ component: FinalFormFileSelect,
47
+ maxSize: 5 * 1024 * 1024 // 5 MB
48
+ ,
49
+ multiple: true,
50
+ fullWidth: true
51
+ })
52
+ })
53
+ })
54
+ }), /*#__PURE__*/_jsx(Grid, {
55
+ size: 6,
56
+ children: /*#__PURE__*/_jsx(Card, {
57
+ variant: "outlined",
58
+ children: /*#__PURE__*/_jsx(CardContent, {
59
+ children: /*#__PURE__*/_jsx(Field, {
60
+ name: "fiveImages",
61
+ label: "Select up to 5 images",
62
+ component: FinalFormFileSelect,
63
+ accept: {
64
+ "image/*": []
65
+ },
66
+ maxFiles: 5,
67
+ fullWidth: true
68
+ })
69
+ })
70
+ })
71
+ }), /*#__PURE__*/_jsx(Grid, {
72
+ size: 6,
73
+ children: /*#__PURE__*/_jsx(Card, {
74
+ variant: "outlined",
75
+ children: /*#__PURE__*/_jsx(CardContent, {
76
+ children: /*#__PURE__*/_jsx(Field, {
77
+ name: "disabled",
78
+ label: "Disabled file select",
79
+ component: FinalFormFileSelect,
80
+ disabled: true,
81
+ fullWidth: true
82
+ })
83
+ })
84
+ })
85
+ }), /*#__PURE__*/_jsx(Grid, {
86
+ size: 12,
87
+ children: /*#__PURE__*/_jsx(Card, {
88
+ variant: "outlined",
89
+ children: /*#__PURE__*/_jsxs(CardContent, {
90
+ children: [/*#__PURE__*/_jsx(Typography, {
91
+ variant: "h4",
92
+ sx: {
93
+ mb: 4
94
+ },
95
+ children: "Vertical form layout"
96
+ }), /*#__PURE__*/_jsx(Field, {
97
+ name: "vertical",
98
+ label: "File Select",
99
+ component: FinalFormFileSelect,
100
+ multiple: true,
101
+ fullWidth: true,
102
+ helperText: "Selected files will also be shown in the read-only field below."
103
+ }), /*#__PURE__*/_jsx(Field, {
104
+ name: "vertical",
105
+ label: "File Select - ReadOnly Grid",
106
+ component: FinalFormFileSelect,
107
+ layout: "grid",
108
+ readOnly: true,
109
+ multiple: true,
110
+ fullWidth: true
111
+ })]
112
+ })
113
+ })
114
+ }), /*#__PURE__*/_jsx(Grid, {
115
+ size: 12,
116
+ children: /*#__PURE__*/_jsx(Card, {
117
+ variant: "outlined",
118
+ children: /*#__PURE__*/_jsxs(CardContent, {
119
+ children: [/*#__PURE__*/_jsx(Typography, {
120
+ variant: "h4",
121
+ sx: {
122
+ mb: 4
123
+ },
124
+ children: "Horizontal form layout"
125
+ }), /*#__PURE__*/_jsx(Field, {
126
+ name: "horizontal",
127
+ label: "File Select",
128
+ component: FinalFormFileSelect,
129
+ multiple: true,
130
+ fullWidth: true,
131
+ variant: "horizontal",
132
+ helperText: "Selected files will also be shown in the read-only field below."
133
+ }), /*#__PURE__*/_jsx(Field, {
134
+ variant: "horizontal",
135
+ name: "horizontal",
136
+ label: "File Select - ReadOnly Grid",
137
+ component: FinalFormFileSelect,
138
+ layout: "grid",
139
+ readOnly: true,
140
+ multiple: true,
141
+ fullWidth: true
142
+ })]
143
+ })
144
+ })
145
+ })]
146
+ }), /*#__PURE__*/_jsx("pre", {
147
+ children: JSON.stringify(values, null, 2)
148
+ })]
149
+ });
150
+ }
151
+ })
152
+ });
153
+ },
154
+ name: "FinalFormFileSelect"
155
+ };
@@ -0,0 +1,133 @@
1
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
2
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
3
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4
+ import { Box, Card, CardContent } from "@mui/material";
5
+ import { useContext } from "react";
6
+ import { Button } from "../../common/buttons/Button";
7
+ import { FillSpace } from "../../common/FillSpace";
8
+ import { ToolbarActions } from "../../common/toolbar/actions/ToolbarActions";
9
+ import { Toolbar } from "../../common/toolbar/Toolbar";
10
+ import { FinalForm } from "../../FinalForm";
11
+ import { FinalFormSaveCancelButtonsLegacy } from "../../FinalFormSaveCancelButtonsLegacy";
12
+ import { Field } from "../../form/Field";
13
+ import { FinalFormInput } from "../../form/FinalFormInput";
14
+ import { StackPage } from "../../stack/Page";
15
+ import { Stack } from "../../stack/Stack";
16
+ import { StackSwitch, StackSwitchApiContext } from "../../stack/Switch";
17
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
18
+ var onSubmit = function onSubmit(_ref) {
19
+ var foo = _ref.foo,
20
+ bar = _ref.bar;
21
+ var errors = [];
22
+ if (foo !== "foo") {
23
+ errors.push({
24
+ foo: "".concat(foo, " is not foo")
25
+ });
26
+ }
27
+ if (bar !== "bar") {
28
+ errors.push({
29
+ bar: "".concat(bar, " is not bar")
30
+ });
31
+ }
32
+ return Promise.reject({
33
+ errors: errors
34
+ });
35
+ };
36
+ var resolveSubmitErrors = function resolveSubmitErrors(error) {
37
+ // error = { errors: [{fieldName: errorMessage},...] }
38
+ var result = {};
39
+ if (error) {
40
+ var _iterator = _createForOfIteratorHelper(error.errors),
41
+ _step;
42
+ try {
43
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
44
+ var submitError = _step.value;
45
+ Object.assign(result, submitError);
46
+ }
47
+ } catch (err) {
48
+ _iterator.e(err);
49
+ } finally {
50
+ _iterator.f();
51
+ }
52
+ }
53
+
54
+ // result = {fieldName: errorMessage, ...}
55
+ return result;
56
+ };
57
+ function Page1() {
58
+ var switchApi = useContext(StackSwitchApiContext);
59
+ return /*#__PURE__*/_jsxs(_Fragment, {
60
+ children: [/*#__PURE__*/_jsx(Box, {
61
+ marginBottom: 4,
62
+ children: /*#__PURE__*/_jsxs(Toolbar, {
63
+ children: [/*#__PURE__*/_jsx(FillSpace, {}), /*#__PURE__*/_jsx(ToolbarActions, {
64
+ children: /*#__PURE__*/_jsx(Button, {
65
+ onClick: function onClick() {
66
+ switchApi === null || switchApi === void 0 || switchApi.activatePage("page2", "test");
67
+ },
68
+ children: "activate page2"
69
+ })
70
+ })]
71
+ })
72
+ }), /*#__PURE__*/_jsx(FinalForm, {
73
+ mode: "edit",
74
+ onSubmit: onSubmit,
75
+ initialValues: {},
76
+ resolveSubmitErrors: resolveSubmitErrors,
77
+ children: /*#__PURE__*/_jsx(Card, {
78
+ variant: "outlined",
79
+ children: /*#__PURE__*/_jsxs(CardContent, {
80
+ children: [/*#__PURE__*/_jsx(Box, {
81
+ marginBottom: 4,
82
+ children: /*#__PURE__*/_jsx(Field, {
83
+ label: "Foo",
84
+ name: "foo",
85
+ component: FinalFormInput
86
+ })
87
+ }), /*#__PURE__*/_jsx(FinalFormSaveCancelButtonsLegacy, {})]
88
+ })
89
+ })
90
+ })]
91
+ });
92
+ }
93
+ function Page2() {
94
+ return /*#__PURE__*/_jsx(FinalForm, {
95
+ mode: "edit",
96
+ onSubmit: onSubmit,
97
+ initialValues: {},
98
+ resolveSubmitErrors: resolveSubmitErrors,
99
+ children: /*#__PURE__*/_jsx(Card, {
100
+ variant: "outlined",
101
+ children: /*#__PURE__*/_jsxs(CardContent, {
102
+ children: [/*#__PURE__*/_jsx(Box, {
103
+ marginBottom: 4,
104
+ children: /*#__PURE__*/_jsx(Field, {
105
+ label: "Bar",
106
+ name: "bar",
107
+ component: FinalFormInput
108
+ })
109
+ }), /*#__PURE__*/_jsx(FinalFormSaveCancelButtonsLegacy, {})]
110
+ })
111
+ })
112
+ });
113
+ }
114
+ export default {
115
+ title: "components/form"
116
+ };
117
+ export var FormInStack = {
118
+ render: function render() {
119
+ return /*#__PURE__*/_jsx(Stack, {
120
+ topLevelTitle: "Stack",
121
+ children: /*#__PURE__*/_jsxs(StackSwitch, {
122
+ children: [/*#__PURE__*/_jsx(StackPage, {
123
+ name: "page1",
124
+ children: /*#__PURE__*/_jsx(Page1, {})
125
+ }), /*#__PURE__*/_jsx(StackPage, {
126
+ name: "page2",
127
+ children: /*#__PURE__*/_jsx(Page2, {})
128
+ })]
129
+ })
130
+ });
131
+ },
132
+ name: "FormInStack"
133
+ };