@comet/admin 9.0.0-beta.4 → 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.
- package/lib/common/DeleteDialog.d.ts +1 -0
- package/lib/common/DeleteDialog.d.ts.map +1 -1
- package/lib/common/DeleteDialog.js +8 -1
- package/lib/common/buttons/clearinput/ClearInputButton.js +1 -1
- package/lib/common/toolbar/__stories__/DataGridToolbar.stories.js +76 -0
- package/lib/common/toolbar/__stories__/Toolbar.stories.js +82 -0
- package/lib/dataGrid/__stories__/ClickableRows.stories.js +109 -0
- package/lib/dataGrid/__stories__/CrudMoreActionsMenu.stories.js +50 -0
- package/lib/dataGrid/__stories__/DataGrid.stories.js +94 -0
- package/lib/dataGrid/__stories__/DataGridSingleSelectFilter.stories.js +492 -0
- package/lib/form/__stories__/AsyncAutocompleteField.stories.js +660 -0
- package/lib/form/__stories__/AsyncSelectField.stories.js +513 -0
- package/lib/form/__stories__/Autocomplete.stories.js +188 -0
- package/lib/form/__stories__/AutocompleteField.stories.js +48 -0
- package/lib/form/__stories__/Checkbox.stories.js +70 -0
- package/lib/form/__stories__/CheckboxField.stories.js +87 -0
- package/lib/form/__stories__/CheckboxListField.stories.js +172 -0
- package/lib/form/__stories__/CustomButtons.stories.js +78 -0
- package/lib/form/__stories__/DependentAsyncSelects.stories.js +91 -0
- package/lib/form/__stories__/DisableAutoNavigation.stories.js +132 -0
- package/lib/form/__stories__/DisabledSubmitIfNotDirty.stories.js +54 -0
- package/lib/form/__stories__/FieldContainer.stories.js +87 -0
- package/lib/form/__stories__/FinalFormFileSelect.stories.js +155 -0
- package/lib/form/__stories__/FormInStack.stories.js +133 -0
- package/lib/form/__stories__/FormLayouts.stories.js +174 -0
- package/lib/form/__stories__/FormValidation.stories.js +82 -0
- package/lib/form/__stories__/Input.stories.js +37 -0
- package/lib/form/__stories__/NumberField.stories.js +38 -0
- package/lib/form/__stories__/Radio.stories.js +101 -0
- package/lib/form/__stories__/RadioGroupField.stories.js +172 -0
- package/lib/form/__stories__/RangeInput.stories.js +239 -0
- package/lib/form/__stories__/RouterTabs.stories.js +96 -0
- package/lib/form/__stories__/RouterTabsInForm.stories.js +73 -0
- package/lib/form/__stories__/RouterTabsInFormWithSubroutes.stories.js +96 -0
- package/lib/form/__stories__/ScrollToErrorField.stories.js +82 -0
- package/lib/form/__stories__/SearchField.stories.js +38 -0
- package/lib/form/__stories__/Select.stories.js +187 -0
- package/lib/form/__stories__/SelectField.stories.js +100 -0
- package/lib/form/__stories__/ShowErrorStrategies.stories.js +107 -0
- package/lib/form/__stories__/SingleTextField.stories.js +108 -0
- package/lib/form/__stories__/StackInForm.stories.js +53 -0
- package/lib/form/__stories__/SubmitErrors.stories.js +90 -0
- package/lib/form/__stories__/Switch.stories.js +49 -0
- package/lib/form/__stories__/SwitchField.stories.js +87 -0
- package/lib/form/__stories__/Tabs.stories.js +78 -0
- package/lib/form/__stories__/TextAreaField.stories.js +38 -0
- package/lib/form/__stories__/TextField.stories.js +67 -0
- package/lib/form/__stories__/ToggleButtonGroupField.stories.js +312 -0
- package/lib/form/__stories__/TwoLevelValidation.stories.js +168 -0
- package/lib/form/__stories__/Typography.stories.js +71 -0
- package/lib/form/file/__stories__/FileDropzone.stories.js +81 -0
- package/lib/form/file/__stories__/FileSelect.stories.js +139 -0
- package/lib/form/file/__stories__/FileSelectListItem.stories.js +108 -0
- package/lib/form/file/__stories__/FileSelectMultipleExamples.stories.js +187 -0
- package/lib/helpers/useTopOffset.js +1 -1
- package/lib/tabs/__stories__/DynamicTabs.stories.js +84 -0
- package/lib/tabs/__stories__/NestedStackSwitchWithRouterTabs.stories.js +84 -0
- package/lib/tabs/__stories__/OverflowIssues.stories.js +224 -0
- package/lib/tabs/__stories__/RouterTabs.stories.js +31 -0
- package/lib/tabs/__stories__/RouterTabsInStack.stories.js +74 -0
- package/lib/tabs/__stories__/RouterTabsInSubroute.stories.js +68 -0
- package/lib/tabs/__stories__/Tabs.stories.js +219 -0
- package/lib/theme/componentsTheme/MuiDataGrid.js +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
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 }; })(); }
|
|
8
|
+
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); }
|
|
9
|
+
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); }
|
|
10
|
+
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); }); }; }
|
|
11
|
+
import { Form } from "react-final-form";
|
|
12
|
+
import { Button } from "../../common/buttons/Button";
|
|
13
|
+
import { FinalFormAutocomplete } from "../../form/Autocomplete";
|
|
14
|
+
import { Field } from "../../form/Field";
|
|
15
|
+
import { FinalFormSelect } from "../../form/FinalFormSelect";
|
|
16
|
+
import { useAsyncOptionsProps } from "../../hooks/useAsyncOptionsProps";
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
var options = [{
|
|
19
|
+
value: "chocolate",
|
|
20
|
+
label: "Chocolate"
|
|
21
|
+
}, {
|
|
22
|
+
value: "strawberry",
|
|
23
|
+
label: "Strawberry"
|
|
24
|
+
}, {
|
|
25
|
+
value: "vanilla",
|
|
26
|
+
label: "Vanilla"
|
|
27
|
+
}];
|
|
28
|
+
var initialValues = {
|
|
29
|
+
autocomplete: {
|
|
30
|
+
value: "strawberry",
|
|
31
|
+
label: "Strawberry"
|
|
32
|
+
},
|
|
33
|
+
autocompleteAsync: {
|
|
34
|
+
value: "strawberry",
|
|
35
|
+
label: "Strawberry"
|
|
36
|
+
},
|
|
37
|
+
select: {
|
|
38
|
+
value: "strawberry",
|
|
39
|
+
label: "Strawberry"
|
|
40
|
+
},
|
|
41
|
+
selectAsync: {
|
|
42
|
+
value: "strawberry",
|
|
43
|
+
label: "Strawberry"
|
|
44
|
+
},
|
|
45
|
+
selectAsyncMultiple: [{
|
|
46
|
+
value: "strawberry",
|
|
47
|
+
label: "Strawberry"
|
|
48
|
+
}, {
|
|
49
|
+
value: "chocolate",
|
|
50
|
+
label: "Chocolate"
|
|
51
|
+
}]
|
|
52
|
+
};
|
|
53
|
+
export default {
|
|
54
|
+
title: "components/form"
|
|
55
|
+
};
|
|
56
|
+
export var AutocompleteAsyncSelect = {
|
|
57
|
+
render: function render() {
|
|
58
|
+
var acAsyncProps = useAsyncOptionsProps(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
59
|
+
return _regenerator().w(function (_context) {
|
|
60
|
+
while (1) switch (_context.n) {
|
|
61
|
+
case 0:
|
|
62
|
+
return _context.a(2, new Promise(function (resolve) {
|
|
63
|
+
return setTimeout(function () {
|
|
64
|
+
return resolve(options);
|
|
65
|
+
}, 500);
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
}, _callee);
|
|
69
|
+
})));
|
|
70
|
+
var selectAsyncProps = useAsyncOptionsProps(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
71
|
+
return _regenerator().w(function (_context2) {
|
|
72
|
+
while (1) switch (_context2.n) {
|
|
73
|
+
case 0:
|
|
74
|
+
return _context2.a(2, new Promise(function (resolve) {
|
|
75
|
+
return setTimeout(function () {
|
|
76
|
+
return resolve(options);
|
|
77
|
+
}, 500);
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
}, _callee2);
|
|
81
|
+
})));
|
|
82
|
+
var selectAsyncMultipleProps = useAsyncOptionsProps(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
83
|
+
return _regenerator().w(function (_context3) {
|
|
84
|
+
while (1) switch (_context3.n) {
|
|
85
|
+
case 0:
|
|
86
|
+
return _context3.a(2, new Promise(function (resolve) {
|
|
87
|
+
return setTimeout(function () {
|
|
88
|
+
return resolve(options);
|
|
89
|
+
}, 500);
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
}, _callee3);
|
|
93
|
+
})));
|
|
94
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
95
|
+
style: {
|
|
96
|
+
maxWidth: "800px"
|
|
97
|
+
},
|
|
98
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
99
|
+
children: "FinalFormAutocomplete provides a select with a search field. It can also be used asynchronously with the useAsyncOptionsProps-Hook. It expects the value to be an object to be able to display the current value without having to load the async options."
|
|
100
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
101
|
+
children: "Furthermore FinalFormSelect can also be used like FinalFormAutocomplete (e.g. when no search field is needed)."
|
|
102
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
103
|
+
style: {
|
|
104
|
+
width: "300px"
|
|
105
|
+
},
|
|
106
|
+
children: /*#__PURE__*/_jsx(Form, {
|
|
107
|
+
mode: "edit",
|
|
108
|
+
onSubmit: function onSubmit(values) {
|
|
109
|
+
alert(JSON.stringify(values, null, 4));
|
|
110
|
+
},
|
|
111
|
+
initialValues: initialValues,
|
|
112
|
+
render: function render(_ref4) {
|
|
113
|
+
var handleSubmit = _ref4.handleSubmit;
|
|
114
|
+
return /*#__PURE__*/_jsxs("form", {
|
|
115
|
+
onSubmit: handleSubmit,
|
|
116
|
+
children: [/*#__PURE__*/_jsx(Field, {
|
|
117
|
+
component: FinalFormAutocomplete,
|
|
118
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
119
|
+
return option.label;
|
|
120
|
+
},
|
|
121
|
+
getOptionSelected: function getOptionSelected(option, value) {
|
|
122
|
+
return option.value === value.value;
|
|
123
|
+
},
|
|
124
|
+
options: options,
|
|
125
|
+
name: "autocomplete",
|
|
126
|
+
label: "Autocomplete",
|
|
127
|
+
fullWidth: true
|
|
128
|
+
}), /*#__PURE__*/_jsx(Field, _objectSpread(_objectSpread({
|
|
129
|
+
component: FinalFormAutocomplete
|
|
130
|
+
}, acAsyncProps), {}, {
|
|
131
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
132
|
+
return option.label;
|
|
133
|
+
},
|
|
134
|
+
getOptionSelected: function getOptionSelected(option, value) {
|
|
135
|
+
return option.value === value.value;
|
|
136
|
+
},
|
|
137
|
+
name: "autocompleteAsync",
|
|
138
|
+
label: "AutocompleteAsync",
|
|
139
|
+
fullWidth: true
|
|
140
|
+
})), /*#__PURE__*/_jsx(Field, {
|
|
141
|
+
component: FinalFormSelect,
|
|
142
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
143
|
+
return option.label;
|
|
144
|
+
},
|
|
145
|
+
getOptionSelected: function getOptionSelected(option, value) {
|
|
146
|
+
return option.value === value.value;
|
|
147
|
+
},
|
|
148
|
+
options: options,
|
|
149
|
+
name: "select",
|
|
150
|
+
label: "Select",
|
|
151
|
+
fullWidth: true
|
|
152
|
+
}), /*#__PURE__*/_jsx(Field, _objectSpread(_objectSpread({
|
|
153
|
+
component: FinalFormSelect,
|
|
154
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
155
|
+
return option.label;
|
|
156
|
+
},
|
|
157
|
+
getOptionSelected: function getOptionSelected(option, value) {
|
|
158
|
+
return option.value === value.value;
|
|
159
|
+
}
|
|
160
|
+
}, selectAsyncProps), {}, {
|
|
161
|
+
name: "selectAsync",
|
|
162
|
+
label: "SelectAsync",
|
|
163
|
+
fullWidth: true
|
|
164
|
+
})), /*#__PURE__*/_jsx(Field, _objectSpread(_objectSpread({
|
|
165
|
+
component: FinalFormSelect,
|
|
166
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
167
|
+
return option.label;
|
|
168
|
+
},
|
|
169
|
+
getOptionSelected: function getOptionSelected(option, value) {
|
|
170
|
+
return option.value === value.value;
|
|
171
|
+
}
|
|
172
|
+
}, selectAsyncMultipleProps), {}, {
|
|
173
|
+
name: "selectAsyncMultiple",
|
|
174
|
+
label: "SelectAsyncMultiple",
|
|
175
|
+
multiple: true,
|
|
176
|
+
fullWidth: true
|
|
177
|
+
})), /*#__PURE__*/_jsx(Button, {
|
|
178
|
+
type: "submit",
|
|
179
|
+
children: "Submit"
|
|
180
|
+
})]
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
})]
|
|
185
|
+
});
|
|
186
|
+
},
|
|
187
|
+
name: "Autocomplete / Async Select"
|
|
188
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Alert } from "../../alert/Alert";
|
|
2
|
+
import { FinalForm } from "../../FinalForm";
|
|
3
|
+
import { AutocompleteField } from "../../form/fields/AutocompleteField";
|
|
4
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
var config = {
|
|
6
|
+
component: AutocompleteField,
|
|
7
|
+
title: "components/form/AutocompleteField"
|
|
8
|
+
};
|
|
9
|
+
export default config;
|
|
10
|
+
export var Default = {
|
|
11
|
+
render: function render() {
|
|
12
|
+
return /*#__PURE__*/_jsx(FinalForm, {
|
|
13
|
+
mode: "edit",
|
|
14
|
+
onSubmit: function onSubmit() {
|
|
15
|
+
// not handled
|
|
16
|
+
},
|
|
17
|
+
subscription: {
|
|
18
|
+
values: true
|
|
19
|
+
},
|
|
20
|
+
children: function children(_ref) {
|
|
21
|
+
var values = _ref.values;
|
|
22
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
23
|
+
children: [/*#__PURE__*/_jsx(AutocompleteField, {
|
|
24
|
+
name: "value",
|
|
25
|
+
label: "Autocomplete Field",
|
|
26
|
+
fullWidth: true,
|
|
27
|
+
variant: "horizontal",
|
|
28
|
+
options: [{
|
|
29
|
+
label: "Option 1",
|
|
30
|
+
value: "option1"
|
|
31
|
+
}, {
|
|
32
|
+
label: "Option 2",
|
|
33
|
+
value: "option2"
|
|
34
|
+
}, {
|
|
35
|
+
label: "Option 3",
|
|
36
|
+
value: "option3"
|
|
37
|
+
}]
|
|
38
|
+
}), /*#__PURE__*/_jsx(Alert, {
|
|
39
|
+
title: "FormState",
|
|
40
|
+
children: /*#__PURE__*/_jsx("pre", {
|
|
41
|
+
children: JSON.stringify(values, null, 2)
|
|
42
|
+
})
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Card, CardContent, Grid } from "@mui/material";
|
|
2
|
+
import { Form } from "react-final-form";
|
|
3
|
+
import { FieldContainer } from "../../form/FieldContainer";
|
|
4
|
+
import { CheckboxField } from "../../form/fields/CheckboxField";
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
export default {
|
|
7
|
+
title: "components/form"
|
|
8
|
+
};
|
|
9
|
+
export var Checkbox = function Checkbox() {
|
|
10
|
+
return /*#__PURE__*/_jsx("div", {
|
|
11
|
+
style: {
|
|
12
|
+
width: 600
|
|
13
|
+
},
|
|
14
|
+
children: /*#__PURE__*/_jsx(Form, {
|
|
15
|
+
initialValues: {
|
|
16
|
+
unchecked: false,
|
|
17
|
+
checked: true,
|
|
18
|
+
disabledUnchecked: false,
|
|
19
|
+
disabledChecked: true,
|
|
20
|
+
uncheckedSecondary: false,
|
|
21
|
+
checkedSecondary: true,
|
|
22
|
+
disabledUncheckedSecondary: false,
|
|
23
|
+
disabledCheckedSecondary: true
|
|
24
|
+
},
|
|
25
|
+
onSubmit: function onSubmit(values) {
|
|
26
|
+
//
|
|
27
|
+
},
|
|
28
|
+
render: function render(_ref) {
|
|
29
|
+
var handleSubmit = _ref.handleSubmit;
|
|
30
|
+
return /*#__PURE__*/_jsx("form", {
|
|
31
|
+
onSubmit: handleSubmit,
|
|
32
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
|
33
|
+
container: true,
|
|
34
|
+
spacing: 4,
|
|
35
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
|
36
|
+
size: 6,
|
|
37
|
+
children: /*#__PURE__*/_jsx(Card, {
|
|
38
|
+
variant: "outlined",
|
|
39
|
+
children: /*#__PURE__*/_jsx(CardContent, {
|
|
40
|
+
children: /*#__PURE__*/_jsxs(FieldContainer, {
|
|
41
|
+
label: "Checkboxes",
|
|
42
|
+
children: [/*#__PURE__*/_jsx(CheckboxField, {
|
|
43
|
+
name: "unchecked",
|
|
44
|
+
label: "Unchecked",
|
|
45
|
+
fullWidth: true
|
|
46
|
+
}), /*#__PURE__*/_jsx(CheckboxField, {
|
|
47
|
+
name: "checked",
|
|
48
|
+
label: "Checked",
|
|
49
|
+
fullWidth: true
|
|
50
|
+
}), /*#__PURE__*/_jsx(CheckboxField, {
|
|
51
|
+
name: "disabledUnchecked",
|
|
52
|
+
label: "Disabled",
|
|
53
|
+
fullWidth: true,
|
|
54
|
+
disabled: true
|
|
55
|
+
}), /*#__PURE__*/_jsx(CheckboxField, {
|
|
56
|
+
name: "disabledChecked",
|
|
57
|
+
label: "Disabled & Checked",
|
|
58
|
+
fullWidth: true,
|
|
59
|
+
disabled: true
|
|
60
|
+
})]
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Stack } from "@mui/material";
|
|
2
|
+
import { Alert } from "../../alert/Alert";
|
|
3
|
+
import { FieldSet } from "../../common/FieldSet";
|
|
4
|
+
import { FinalForm } from "../../FinalForm";
|
|
5
|
+
import { CheckboxField } from "../../form/fields/CheckboxField";
|
|
6
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
var config = {
|
|
8
|
+
component: CheckboxField,
|
|
9
|
+
title: "components/form/CheckboxField"
|
|
10
|
+
};
|
|
11
|
+
export default config;
|
|
12
|
+
export var Default = {
|
|
13
|
+
render: function render() {
|
|
14
|
+
return /*#__PURE__*/_jsx(FinalForm, {
|
|
15
|
+
mode: "edit",
|
|
16
|
+
onSubmit: function onSubmit() {
|
|
17
|
+
// not handled
|
|
18
|
+
},
|
|
19
|
+
subscription: {
|
|
20
|
+
values: true
|
|
21
|
+
},
|
|
22
|
+
children: function children(_ref) {
|
|
23
|
+
var values = _ref.values;
|
|
24
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
25
|
+
children: [/*#__PURE__*/_jsx(CheckboxField, {
|
|
26
|
+
name: "value",
|
|
27
|
+
label: "Checkbox Field",
|
|
28
|
+
fullWidth: true,
|
|
29
|
+
variant: "horizontal"
|
|
30
|
+
}), /*#__PURE__*/_jsx(Alert, {
|
|
31
|
+
title: "FormState",
|
|
32
|
+
children: /*#__PURE__*/_jsx("pre", {
|
|
33
|
+
children: JSON.stringify(values, null, 2)
|
|
34
|
+
})
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export var LayoutVariants = {
|
|
42
|
+
render: function render() {
|
|
43
|
+
return /*#__PURE__*/_jsx(FinalForm, {
|
|
44
|
+
mode: "edit",
|
|
45
|
+
onSubmit: function onSubmit() {
|
|
46
|
+
// not handled
|
|
47
|
+
},
|
|
48
|
+
children: function children() {
|
|
49
|
+
return /*#__PURE__*/_jsxs(Stack, {
|
|
50
|
+
spacing: 5,
|
|
51
|
+
p: 5,
|
|
52
|
+
children: [/*#__PURE__*/_jsxs(FieldSet, {
|
|
53
|
+
title: "Single line CheckboxField",
|
|
54
|
+
children: [/*#__PURE__*/_jsx(CheckboxField, {
|
|
55
|
+
name: "singleLineHorizontal",
|
|
56
|
+
fieldLabel: "Single Line Horizontal",
|
|
57
|
+
label: "Hello Checkbox",
|
|
58
|
+
variant: "horizontal",
|
|
59
|
+
fullWidth: true
|
|
60
|
+
}), /*#__PURE__*/_jsx(CheckboxField, {
|
|
61
|
+
name: "singleLineVertical",
|
|
62
|
+
fieldLabel: "Single Line Vertical",
|
|
63
|
+
label: "Hello Checkbox",
|
|
64
|
+
variant: "vertical",
|
|
65
|
+
fullWidth: true
|
|
66
|
+
})]
|
|
67
|
+
}), /*#__PURE__*/_jsxs(FieldSet, {
|
|
68
|
+
title: "Multi line CheckboxField",
|
|
69
|
+
children: [/*#__PURE__*/_jsx(CheckboxField, {
|
|
70
|
+
name: "multiLineHorizontal",
|
|
71
|
+
fieldLabel: "Multi Line Horizontal",
|
|
72
|
+
label: "Nulla vitae elit libero, a pharetra augue. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis risus eget urna mollis ornare vel eu leo.",
|
|
73
|
+
variant: "horizontal",
|
|
74
|
+
fullWidth: true
|
|
75
|
+
}), /*#__PURE__*/_jsx(CheckboxField, {
|
|
76
|
+
name: "multiLineVertical",
|
|
77
|
+
fieldLabel: "Multi Line Vertical",
|
|
78
|
+
label: "Nulla vitae elit libero, a pharetra augue. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis risus eget urna mollis ornare vel eu leo.",
|
|
79
|
+
variant: "vertical",
|
|
80
|
+
fullWidth: true
|
|
81
|
+
})]
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Alert } from "../../alert/Alert";
|
|
2
|
+
import { FieldSet } from "../../common/FieldSet";
|
|
3
|
+
import { FinalForm } from "../../FinalForm";
|
|
4
|
+
import { CheckboxListField } from "../../form/fields/CheckboxListField";
|
|
5
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
var config = {
|
|
7
|
+
component: CheckboxListField,
|
|
8
|
+
title: "components/form/CheckboxListField"
|
|
9
|
+
};
|
|
10
|
+
export default config;
|
|
11
|
+
export var Default = {
|
|
12
|
+
render: function render() {
|
|
13
|
+
return /*#__PURE__*/_jsx(FinalForm, {
|
|
14
|
+
mode: "edit",
|
|
15
|
+
onSubmit: function onSubmit() {
|
|
16
|
+
// not handled
|
|
17
|
+
},
|
|
18
|
+
subscription: {
|
|
19
|
+
values: true
|
|
20
|
+
},
|
|
21
|
+
children: function children(_ref) {
|
|
22
|
+
var values = _ref.values;
|
|
23
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
24
|
+
children: [/*#__PURE__*/_jsx(CheckboxListField, {
|
|
25
|
+
options: [{
|
|
26
|
+
label: "Option 1",
|
|
27
|
+
value: "option1"
|
|
28
|
+
}, {
|
|
29
|
+
label: "Option 2",
|
|
30
|
+
value: "option2"
|
|
31
|
+
}, {
|
|
32
|
+
label: "Option 3",
|
|
33
|
+
value: "option3"
|
|
34
|
+
}],
|
|
35
|
+
name: "value",
|
|
36
|
+
label: "Checkbox List Field",
|
|
37
|
+
fullWidth: true,
|
|
38
|
+
variant: "horizontal"
|
|
39
|
+
}), /*#__PURE__*/_jsx(Alert, {
|
|
40
|
+
title: "FormState",
|
|
41
|
+
children: /*#__PURE__*/_jsx("pre", {
|
|
42
|
+
children: JSON.stringify(values, null, 2)
|
|
43
|
+
})
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var optionsWithShortNames = [{
|
|
51
|
+
label: "Option 1",
|
|
52
|
+
value: "option1"
|
|
53
|
+
}, {
|
|
54
|
+
label: "[disabled] Option 2",
|
|
55
|
+
value: "option2",
|
|
56
|
+
disabled: true
|
|
57
|
+
}, {
|
|
58
|
+
label: "Option 3",
|
|
59
|
+
value: "option3"
|
|
60
|
+
}, {
|
|
61
|
+
label: "Option 4",
|
|
62
|
+
value: "option4"
|
|
63
|
+
}, {
|
|
64
|
+
label: "Option 5",
|
|
65
|
+
value: "option5"
|
|
66
|
+
}, {
|
|
67
|
+
label: "Option 6",
|
|
68
|
+
value: "option6"
|
|
69
|
+
}, {
|
|
70
|
+
label: "Option 7",
|
|
71
|
+
value: "option7"
|
|
72
|
+
}];
|
|
73
|
+
var optionsWithLongNames = [{
|
|
74
|
+
label: "Donec sed odio dui.",
|
|
75
|
+
value: "donec"
|
|
76
|
+
}, {
|
|
77
|
+
label: "[disabled] Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.",
|
|
78
|
+
value: "lorem",
|
|
79
|
+
disabled: true
|
|
80
|
+
}, {
|
|
81
|
+
label: "Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.",
|
|
82
|
+
value: "duis"
|
|
83
|
+
}, {
|
|
84
|
+
label: "Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.",
|
|
85
|
+
value: "aenean"
|
|
86
|
+
}, {
|
|
87
|
+
label: "Donec id elit non mi porta gravida at eget metus.",
|
|
88
|
+
value: "donec-id"
|
|
89
|
+
}, {
|
|
90
|
+
label: "Etiam porta sem malesuada magna mollis euismod.",
|
|
91
|
+
value: "etiam"
|
|
92
|
+
}, {
|
|
93
|
+
label: "Curabitur blandit tempus porttitor. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Maecenas faucibus mollis interdum.",
|
|
94
|
+
value: "curabitur"
|
|
95
|
+
}];
|
|
96
|
+
export var LayoutVariants = {
|
|
97
|
+
render: function render() {
|
|
98
|
+
return /*#__PURE__*/_jsx(FinalForm, {
|
|
99
|
+
mode: "edit",
|
|
100
|
+
onSubmit: function onSubmit() {
|
|
101
|
+
// not handled
|
|
102
|
+
},
|
|
103
|
+
children: function children() {
|
|
104
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
105
|
+
children: [/*#__PURE__*/_jsxs(FieldSet, {
|
|
106
|
+
title: "Horizontal Field-Variant",
|
|
107
|
+
children: [/*#__PURE__*/_jsx(CheckboxListField, {
|
|
108
|
+
name: "horizontalRowShortOptions",
|
|
109
|
+
label: "Row Layout",
|
|
110
|
+
variant: "horizontal",
|
|
111
|
+
layout: "row",
|
|
112
|
+
options: optionsWithShortNames,
|
|
113
|
+
fullWidth: true
|
|
114
|
+
}), /*#__PURE__*/_jsx(CheckboxListField, {
|
|
115
|
+
name: "horizontalColumnShortOptions",
|
|
116
|
+
label: "Column Layout",
|
|
117
|
+
variant: "horizontal",
|
|
118
|
+
layout: "column",
|
|
119
|
+
options: optionsWithShortNames,
|
|
120
|
+
fullWidth: true
|
|
121
|
+
}), /*#__PURE__*/_jsx(CheckboxListField, {
|
|
122
|
+
name: "horizontalRowLongOptions",
|
|
123
|
+
label: "Row Layout",
|
|
124
|
+
variant: "horizontal",
|
|
125
|
+
layout: "row",
|
|
126
|
+
options: optionsWithLongNames,
|
|
127
|
+
fullWidth: true
|
|
128
|
+
}), /*#__PURE__*/_jsx(CheckboxListField, {
|
|
129
|
+
name: "horizontalColumnLongOptions",
|
|
130
|
+
label: "Column Layout",
|
|
131
|
+
variant: "horizontal",
|
|
132
|
+
layout: "column",
|
|
133
|
+
options: optionsWithLongNames,
|
|
134
|
+
fullWidth: true
|
|
135
|
+
})]
|
|
136
|
+
}), /*#__PURE__*/_jsxs(FieldSet, {
|
|
137
|
+
title: "Vertical Field-Variant",
|
|
138
|
+
children: [/*#__PURE__*/_jsx(CheckboxListField, {
|
|
139
|
+
name: "verticalRowShortOptions",
|
|
140
|
+
label: "Row Layout",
|
|
141
|
+
variant: "vertical",
|
|
142
|
+
layout: "row",
|
|
143
|
+
options: optionsWithShortNames,
|
|
144
|
+
fullWidth: true
|
|
145
|
+
}), /*#__PURE__*/_jsx(CheckboxListField, {
|
|
146
|
+
name: "verticalColumnShortOptions",
|
|
147
|
+
label: "Column Layout",
|
|
148
|
+
variant: "vertical",
|
|
149
|
+
layout: "column",
|
|
150
|
+
options: optionsWithShortNames,
|
|
151
|
+
fullWidth: true
|
|
152
|
+
}), /*#__PURE__*/_jsx(CheckboxListField, {
|
|
153
|
+
name: "verticalRowLongOptions",
|
|
154
|
+
label: "Row Layout",
|
|
155
|
+
variant: "vertical",
|
|
156
|
+
layout: "row",
|
|
157
|
+
options: optionsWithLongNames,
|
|
158
|
+
fullWidth: true
|
|
159
|
+
}), /*#__PURE__*/_jsx(CheckboxListField, {
|
|
160
|
+
name: "verticalColumnLongOptions",
|
|
161
|
+
label: "Column Layout",
|
|
162
|
+
variant: "vertical",
|
|
163
|
+
layout: "column",
|
|
164
|
+
options: optionsWithLongNames,
|
|
165
|
+
fullWidth: true
|
|
166
|
+
})]
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
+
import { Master } from "@comet/admin-icons";
|
|
3
|
+
import { Box, Card, CardContent } from "@mui/material";
|
|
4
|
+
import { styled } from "@mui/material/styles";
|
|
5
|
+
import { useFormState } from "react-final-form";
|
|
6
|
+
import { Button } from "../../common/buttons/Button";
|
|
7
|
+
import { FinalForm } from "../../FinalForm";
|
|
8
|
+
import { Field } from "../../form/Field";
|
|
9
|
+
import { FinalFormInput } from "../../form/FinalFormInput";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
var StyledButton = /*#__PURE__*/styled(Button, process.env.NODE_ENV === "production" ? {
|
|
12
|
+
target: "e30wl2v0"
|
|
13
|
+
} : {
|
|
14
|
+
target: "e30wl2v0",
|
|
15
|
+
label: "StyledButton"
|
|
16
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
17
|
+
name: "4g6iwk",
|
|
18
|
+
styles: "text-transform:capitalize;background-color:#006699;color:white;&:disabled{color:lightgrey;background-color:slategrey;}&:hover{background-color:#006699;}"
|
|
19
|
+
} : {
|
|
20
|
+
name: "4g6iwk",
|
|
21
|
+
styles: "text-transform:capitalize;background-color:#006699;color:white;&:disabled{color:lightgrey;background-color:slategrey;}&:hover{background-color:#006699;}/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9mb3JtL19fc3Rvcmllc19fL0N1c3RvbUJ1dHRvbnMuc3Rvcmllcy50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBVW1DIiwiZmlsZSI6Ii4uLy4uLy4uL3NyYy9mb3JtL19fc3Rvcmllc19fL0N1c3RvbUJ1dHRvbnMuc3Rvcmllcy50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBNYXN0ZXIgfSBmcm9tIFwiQGNvbWV0L2FkbWluLWljb25zXCI7XG5pbXBvcnQgeyBCb3gsIENhcmQsIENhcmRDb250ZW50IH0gZnJvbSBcIkBtdWkvbWF0ZXJpYWxcIjtcbmltcG9ydCB7IHN0eWxlZCB9IGZyb20gXCJAbXVpL21hdGVyaWFsL3N0eWxlc1wiO1xuaW1wb3J0IHsgdXNlRm9ybVN0YXRlIH0gZnJvbSBcInJlYWN0LWZpbmFsLWZvcm1cIjtcblxuaW1wb3J0IHsgQnV0dG9uIH0gZnJvbSBcIi4uLy4uL2NvbW1vbi9idXR0b25zL0J1dHRvblwiO1xuaW1wb3J0IHsgRmluYWxGb3JtIH0gZnJvbSBcIi4uLy4uL0ZpbmFsRm9ybVwiO1xuaW1wb3J0IHsgRmllbGQgfSBmcm9tIFwiLi4vLi4vZm9ybS9GaWVsZFwiO1xuaW1wb3J0IHsgRmluYWxGb3JtSW5wdXQgfSBmcm9tIFwiLi4vLi4vZm9ybS9GaW5hbEZvcm1JbnB1dFwiO1xuXG5jb25zdCBTdHlsZWRCdXR0b24gPSBzdHlsZWQoQnV0dG9uKWBcbiAgICB0ZXh0LXRyYW5zZm9ybTogY2FwaXRhbGl6ZTtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjMDA2Njk5O1xuICAgIGNvbG9yOiB3aGl0ZTtcblxuICAgICY6ZGlzYWJsZWQge1xuICAgICAgICBjb2xvcjogbGlnaHRncmV5O1xuICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiBzbGF0ZWdyZXk7XG4gICAgfVxuXG4gICAgJjpob3ZlciB7XG4gICAgICAgIGJhY2tncm91bmQtY29sb3I6ICMwMDY2OTk7XG4gICAgfVxuYDtcblxuY29uc3QgQ3VzdG9tQnV0dG9ucyA9ICgpID0+IHtcbiAgICBjb25zdCB7IHZhbHVlcywgcHJpc3RpbmUsIGhhc1ZhbGlkYXRpb25FcnJvcnMsIHN1Ym1pdHRpbmcgfSA9IHVzZUZvcm1TdGF0ZSgpO1xuXG4gICAgcmV0dXJuIChcbiAgICAgICAgPFN0eWxlZEJ1dHRvblxuICAgICAgICAgICAgc3RhcnRJY29uPXs8TWFzdGVyIC8+fVxuICAgICAgICAgICAgdmFyaWFudD1cInRleHREYXJrXCJcbiAgICAgICAgICAgIGRpc2FibGVkPXtwcmlzdGluZSB8fCBoYXNWYWxpZGF0aW9uRXJyb3JzIHx8IHN1Ym1pdHRpbmd9XG4gICAgICAgICAgICBvbkNsaWNrPXtoYW5kbGVDdXN0b21CdXR0b25DbGlja31cbiAgICAgICAgPlxuICAgICAgICAgICAge3ByaXN0aW5lID8gXCJQbGVhc2UgZmlsbCBvdXQgdGhlIGZvcm1cIiA6IFwiQ2xpY2sgTWUgLSBJJ20gYSBDdXN0b20gYnV0dG9uXCJ9XG4gICAgICAgIDwvU3R5bGVkQnV0dG9uPlxuICAgICk7XG5cbiAgICBmdW5jdGlvbiBoYW5kbGVDdXN0b21CdXR0b25DbGljaygpIHtcbiAgICAgICAgd2luZG93LmFsZXJ0KGBGb3JtIHZhbHVlczogJHtKU09OLnN0cmluZ2lmeSh2YWx1ZXMpfWApO1xuICAgIH1cbn07XG5cbmV4cG9ydCBkZWZhdWx0IHtcbiAgICB0aXRsZTogXCJjb21wb25lbnRzL2Zvcm1cIixcbn07XG5cbmV4cG9ydCBjb25zdCBfQ3VzdG9tQnV0dG9ucyA9IHtcbiAgICByZW5kZXI6ICgpID0+IHtcbiAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgIDxkaXYgc3R5bGU9e3sgd2lkdGg6IDMwMCB9fT5cbiAgICAgICAgICAgICAgICA8RmluYWxGb3JtXG4gICAgICAgICAgICAgICAgICAgIG1vZGU9XCJlZGl0XCJcbiAgICAgICAgICAgICAgICAgICAgb25TdWJtaXQ9eygpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFkZCB5b3VyIGZvcm0tc3VibWl0IGZ1bmN0aW9uIGhlcmVcbiAgICAgICAgICAgICAgICAgICAgfX1cbiAgICAgICAgICAgICAgICA+XG4gICAgICAgICAgICAgICAgICAgIDxDYXJkIHZhcmlhbnQ9XCJvdXRsaW5lZFwiPlxuICAgICAgICAgICAgICAgICAgICAgICAgPENhcmRDb250ZW50PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxGaWVsZCBsYWJlbD1cIkZvb1wiIG5hbWU9XCJmb29cIiBjb21wb25lbnQ9e0ZpbmFsRm9ybUlucHV0fSBmdWxsV2lkdGggLz5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8RmllbGQgbGFiZWw9XCJCYXJcIiBuYW1lPVwiYmFyXCIgY29tcG9uZW50PXtGaW5hbEZvcm1JbnB1dH0gZnVsbFdpZHRoIC8+XG4gICAgICAgICAgICAgICAgICAgICAgICA8L0NhcmRDb250ZW50PlxuICAgICAgICAgICAgICAgICAgICA8L0NhcmQ+XG4gICAgICAgICAgICAgICAgICAgIDxCb3ggcGFkZGluZ1RvcD17NH0+XG4gICAgICAgICAgICAgICAgICAgICAgICA8Q3VzdG9tQnV0dG9ucyAvPlxuICAgICAgICAgICAgICAgICAgICA8L0JveD5cbiAgICAgICAgICAgICAgICA8L0ZpbmFsRm9ybT5cbiAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICApO1xuICAgIH0sXG5cbiAgICBuYW1lOiBcIkN1c3RvbUJ1dHRvbnNcIixcbn07XG4iXX0= */",
|
|
22
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
23
|
+
});
|
|
24
|
+
var CustomButtons = function CustomButtons() {
|
|
25
|
+
var _useFormState = useFormState(),
|
|
26
|
+
values = _useFormState.values,
|
|
27
|
+
pristine = _useFormState.pristine,
|
|
28
|
+
hasValidationErrors = _useFormState.hasValidationErrors,
|
|
29
|
+
submitting = _useFormState.submitting;
|
|
30
|
+
return /*#__PURE__*/_jsx(StyledButton, {
|
|
31
|
+
startIcon: /*#__PURE__*/_jsx(Master, {}),
|
|
32
|
+
variant: "textDark",
|
|
33
|
+
disabled: pristine || hasValidationErrors || submitting,
|
|
34
|
+
onClick: handleCustomButtonClick,
|
|
35
|
+
children: pristine ? "Please fill out the form" : "Click Me - I'm a Custom button"
|
|
36
|
+
});
|
|
37
|
+
function handleCustomButtonClick() {
|
|
38
|
+
window.alert("Form values: ".concat(JSON.stringify(values)));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export default {
|
|
42
|
+
title: "components/form"
|
|
43
|
+
};
|
|
44
|
+
export var _CustomButtons = {
|
|
45
|
+
render: function render() {
|
|
46
|
+
return /*#__PURE__*/_jsx("div", {
|
|
47
|
+
style: {
|
|
48
|
+
width: 300
|
|
49
|
+
},
|
|
50
|
+
children: /*#__PURE__*/_jsxs(FinalForm, {
|
|
51
|
+
mode: "edit",
|
|
52
|
+
onSubmit: function onSubmit() {
|
|
53
|
+
// add your form-submit function here
|
|
54
|
+
},
|
|
55
|
+
children: [/*#__PURE__*/_jsx(Card, {
|
|
56
|
+
variant: "outlined",
|
|
57
|
+
children: /*#__PURE__*/_jsxs(CardContent, {
|
|
58
|
+
children: [/*#__PURE__*/_jsx(Field, {
|
|
59
|
+
label: "Foo",
|
|
60
|
+
name: "foo",
|
|
61
|
+
component: FinalFormInput,
|
|
62
|
+
fullWidth: true
|
|
63
|
+
}), /*#__PURE__*/_jsx(Field, {
|
|
64
|
+
label: "Bar",
|
|
65
|
+
name: "bar",
|
|
66
|
+
component: FinalFormInput,
|
|
67
|
+
fullWidth: true
|
|
68
|
+
})]
|
|
69
|
+
})
|
|
70
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
71
|
+
paddingTop: 4,
|
|
72
|
+
children: /*#__PURE__*/_jsx(CustomButtons, {})
|
|
73
|
+
})]
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
name: "CustomButtons"
|
|
78
|
+
};
|