@algolia/satellite 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Actions/Accordion/Accordion.d.ts +142 -0
- package/dist/cjs/Actions/Accordion/Accordion.js +149 -0
- package/dist/cjs/Actions/Accordion/Accordion.tailwind.d.ts +5 -0
- package/dist/cjs/Actions/Accordion/Accordion.tailwind.js +44 -0
- package/dist/cjs/Actions/Button/Button.tailwind.js +0 -12
- package/dist/cjs/Actions/ToggleGroup/ToggleGroup.d.ts +2 -2
- package/dist/cjs/Actions/index.d.ts +2 -0
- package/dist/cjs/Actions/index.js +18 -0
- package/dist/cjs/Fields/Field/Field.js +2 -2
- package/dist/cjs/Fields/Form/Form.d.ts +12 -10
- package/dist/cjs/Fields/Form/Form.js +50 -38
- package/dist/cjs/Fields/Form/FormContext.d.ts +6 -6
- package/dist/cjs/Fields/Form/FormContext.js +2 -2
- package/dist/cjs/Fields/Form/index.d.ts +4 -3
- package/dist/cjs/Fields/Form/index.js +31 -21
- package/dist/cjs/Fields/Form/stories/AsynchronousValidation.js +142 -127
- package/dist/cjs/Fields/Form/stories/Complex.js +648 -642
- package/dist/cjs/Fields/Form/stories/DependentFieldsValidation.js +127 -121
- package/dist/cjs/Fields/Form/stories/DirtyFields.js +195 -189
- package/dist/cjs/Fields/Form/stories/DynamicFieldsValidation.js +251 -245
- package/dist/cjs/Fields/Form/stories/ExtraErrors.js +289 -0
- package/dist/cjs/Fields/Form/stories/FieldArrays.js +180 -174
- package/dist/cjs/Fields/Form/stories/JSONForms.js +59 -56
- package/dist/cjs/Fields/Form/stories/MultiStep.js +706 -0
- package/dist/cjs/Fields/Form/stories/ValidationStrategies.js +243 -237
- package/dist/cjs/Fields/Form/useForm.d.ts +1 -1
- package/dist/cjs/Fields/Form/useForm.js +3 -3
- package/dist/cjs/Helpers/utilities/focusable.tailwind.js +1 -1
- package/dist/cjs/Icons/index.d.ts +1 -1
- package/dist/cjs/Icons/index.js +6 -0
- package/dist/cjs/Indicators/Skeleton/Skeleton.d.ts +7 -0
- package/dist/cjs/Indicators/Skeleton/Skeleton.js +12 -5
- package/dist/cjs/Indicators/index.d.ts +1 -0
- package/dist/cjs/Indicators/index.js +11 -0
- package/dist/cjs/Layout/Sidebar/SidebarButtonLink.js +1 -1
- package/dist/cjs/Layout/Sidebar/SidebarLink.js +2 -2
- package/dist/cjs/Layout/Sidebar/SidebarLinksGroup/SidebarGroupLink.js +1 -1
- package/dist/cjs/Layout/Sidebar/SidebarLinksGroup/SidebarLinksGroup.js +4 -5
- package/dist/cjs/Layout/Tables/DataTable/DataTable.d.ts +3 -1
- package/dist/cjs/Layout/Tables/DataTable/DataTable.js +3 -0
- package/dist/cjs/Layout/Tables/Table/Table.d.ts +2 -0
- package/dist/cjs/Layout/Tables/Table/Table.js +4 -2
- package/dist/cjs/Layout/Tables/Table/Table.tailwind.js +6 -1
- package/dist/cjs/Overlay/MenuButton/components/items/LinkItem.d.ts +1 -1
- package/dist/cjs/Overlay/MenuButton/components/items/ToggleItem.d.ts +1 -1
- package/dist/cjs/styles/tailwind.config.js +1 -1
- package/dist/cjs/utils/isCssPropertySupported.d.ts +1 -1
- package/dist/esm/Actions/Accordion/Accordion.d.ts +142 -0
- package/dist/esm/Actions/Accordion/Accordion.js +139 -0
- package/dist/esm/Actions/Accordion/Accordion.tailwind.d.ts +5 -0
- package/dist/esm/Actions/Accordion/Accordion.tailwind.js +43 -0
- package/dist/esm/Actions/Button/Button.tailwind.js +0 -12
- package/dist/esm/Actions/ToggleGroup/ToggleGroup.d.ts +2 -2
- package/dist/esm/Actions/index.d.ts +2 -0
- package/dist/esm/Actions/index.js +2 -2
- package/dist/esm/Fields/Field/Field.js +3 -3
- package/dist/esm/Fields/Form/Form.d.ts +12 -10
- package/dist/esm/Fields/Form/Form.js +52 -40
- package/dist/esm/Fields/Form/FormContext.d.ts +6 -6
- package/dist/esm/Fields/Form/FormContext.js +1 -1
- package/dist/esm/Fields/Form/index.d.ts +4 -3
- package/dist/esm/Fields/Form/index.js +2 -3
- package/dist/esm/Fields/Form/stories/AsynchronousValidation.js +143 -128
- package/dist/esm/Fields/Form/stories/Complex.js +649 -643
- package/dist/esm/Fields/Form/stories/DependentFieldsValidation.js +128 -122
- package/dist/esm/Fields/Form/stories/DirtyFields.js +196 -190
- package/dist/esm/Fields/Form/stories/DynamicFieldsValidation.js +252 -246
- package/dist/esm/Fields/Form/stories/ExtraErrors.js +279 -0
- package/dist/esm/Fields/Form/stories/FieldArrays.js +181 -175
- package/dist/esm/Fields/Form/stories/JSONForms.js +60 -57
- package/dist/esm/Fields/Form/stories/MultiStep.js +697 -0
- package/dist/esm/Fields/Form/stories/ValidationStrategies.js +244 -238
- package/dist/esm/Fields/Form/useForm.d.ts +1 -1
- package/dist/esm/Fields/Form/useForm.js +3 -3
- package/dist/esm/Helpers/utilities/focusable.tailwind.js +1 -1
- package/dist/esm/Icons/index.d.ts +1 -1
- package/dist/esm/Icons/index.js +1 -1
- package/dist/esm/Indicators/Skeleton/Skeleton.d.ts +7 -0
- package/dist/esm/Indicators/Skeleton/Skeleton.js +12 -5
- package/dist/esm/Indicators/index.d.ts +1 -0
- package/dist/esm/Indicators/index.js +2 -1
- package/dist/esm/Layout/Sidebar/SidebarButtonLink.js +1 -1
- package/dist/esm/Layout/Sidebar/SidebarLink.js +2 -2
- package/dist/esm/Layout/Sidebar/SidebarLinksGroup/SidebarGroupLink.js +1 -1
- package/dist/esm/Layout/Sidebar/SidebarLinksGroup/SidebarLinksGroup.js +4 -5
- package/dist/esm/Layout/Tables/DataTable/DataTable.d.ts +3 -1
- package/dist/esm/Layout/Tables/DataTable/DataTable.js +3 -0
- package/dist/esm/Layout/Tables/Table/Table.d.ts +2 -0
- package/dist/esm/Layout/Tables/Table/Table.js +4 -2
- package/dist/esm/Layout/Tables/Table/Table.tailwind.js +6 -1
- package/dist/esm/Overlay/MenuButton/components/items/LinkItem.d.ts +1 -1
- package/dist/esm/Overlay/MenuButton/components/items/ToggleItem.d.ts +1 -1
- package/dist/esm/styles/tailwind.config.js +1 -1
- package/dist/esm/utils/isCssPropertySupported.d.ts +1 -1
- package/dist/satellite.min.css +1 -1
- package/package.json +7 -1
@@ -24,7 +24,7 @@ var _Select = require("../../Select");
|
|
24
24
|
var _Form = require("../Form");
|
25
25
|
var _useFormikAutoFocusOnError = require("./utils/useFormikAutoFocusOnError");
|
26
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
27
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28;
|
27
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30;
|
28
28
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
29
29
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
30
30
|
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; }
|
@@ -110,71 +110,74 @@ var RHFFieldsArraysComponent = exports.RHFFieldsArraysComponent = function RHFFi
|
|
110
110
|
append = _useFieldArray.append,
|
111
111
|
remove = _useFieldArray.remove;
|
112
112
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
113
|
-
className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["
|
114
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.ExperimentalFormErrorMessage, {}), fields.map(function (field, index) {
|
124
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
125
|
-
className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["w-full flex flex-col gap-2"]))),
|
126
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
127
|
-
className: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["w-full flex items-center justify-between"]))),
|
128
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
129
|
-
children: index === 0 ? "Only display items that match this group" : "And"
|
130
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Actions.IconButton, {
|
131
|
-
title: "Remove group",
|
132
|
-
variant: "subtle",
|
133
|
-
icon: _Icons.MinusIcon,
|
134
|
-
disabled: fields.length === 1,
|
135
|
-
onClick: function onClick() {
|
136
|
-
return remove(index);
|
137
|
-
}
|
138
|
-
})]
|
139
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(RHFFilter, {
|
140
|
-
parentIndex: index
|
141
|
-
})]
|
142
|
-
}, field.id);
|
143
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Actions.Button, {
|
144
|
-
variant: "subtle",
|
145
|
-
startIcon: _Icons.PlusIcon,
|
146
|
-
onClick: function onClick() {
|
147
|
-
return (
|
148
|
-
// It accepts `object` and object[]`, so we need to append an array of array
|
149
|
-
append([[{
|
150
|
-
facet: undefined,
|
151
|
-
operator: "is",
|
152
|
-
value: undefined
|
153
|
-
}]])
|
154
|
-
);
|
113
|
+
className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["@container w-full flex justify-center"]))),
|
114
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
115
|
+
className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-8 w-full"]))),
|
116
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactHookForm.FormProvider, _objectSpread(_objectSpread({}, api), {}, {
|
117
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Form.Form, {
|
118
|
+
onSubmit: handleSubmit(function (data) {
|
119
|
+
return setFormData(data);
|
120
|
+
}),
|
121
|
+
onReset: function onReset() {
|
122
|
+
return setFormData(initialFormData);
|
155
123
|
},
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
124
|
+
className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col items-start gap-6 min-w-72"]))),
|
125
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormErrorMessage, {}), fields.map(function (field, index) {
|
126
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
127
|
+
className: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["w-full flex flex-col gap-2"]))),
|
128
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
129
|
+
className: (0, _satellitePrefixer["default"])(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["w-full flex items-center justify-between"]))),
|
130
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
131
|
+
children: index === 0 ? "Only display items that match this group" : "And"
|
132
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Actions.IconButton, {
|
133
|
+
title: "Remove group",
|
134
|
+
variant: "subtle",
|
135
|
+
icon: _Icons.MinusIcon,
|
136
|
+
disabled: fields.length === 1,
|
137
|
+
onClick: function onClick() {
|
138
|
+
return remove(index);
|
139
|
+
}
|
140
|
+
})]
|
141
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(RHFFilter, {
|
142
|
+
parentIndex: index
|
143
|
+
})]
|
144
|
+
}, field.id);
|
145
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Actions.Button, {
|
146
|
+
variant: "subtle",
|
147
|
+
startIcon: _Icons.PlusIcon,
|
165
148
|
onClick: function onClick() {
|
166
|
-
return
|
149
|
+
return (
|
150
|
+
// It accepts `object` and object[]`, so we need to append an array of array
|
151
|
+
append([[{
|
152
|
+
facet: undefined,
|
153
|
+
operator: "is",
|
154
|
+
value: undefined
|
155
|
+
}]])
|
156
|
+
);
|
167
157
|
},
|
168
|
-
children: "
|
158
|
+
children: "And"
|
159
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
160
|
+
className: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["flex gap-2"]))),
|
161
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormSubmit, {
|
162
|
+
variant: "primary",
|
163
|
+
"aria-label": "Apply changes",
|
164
|
+
children: "Apply"
|
165
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormReset, {
|
166
|
+
"aria-label": "Reset the form",
|
167
|
+
onClick: function onClick() {
|
168
|
+
return reset();
|
169
|
+
},
|
170
|
+
children: "Reset"
|
171
|
+
})]
|
169
172
|
})]
|
173
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {
|
174
|
+
className: (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["text-grey-500"])))
|
175
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
176
|
+
className: (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["whitespace-pre display-code"]))),
|
177
|
+
children: JSON.stringify(formData, null, 2)
|
170
178
|
})]
|
171
|
-
})
|
172
|
-
|
173
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
174
|
-
className: (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["whitespace-pre"]))),
|
175
|
-
children: JSON.stringify(formData, null, 2)
|
176
|
-
})]
|
177
|
-
}))
|
179
|
+
}))
|
180
|
+
})
|
178
181
|
});
|
179
182
|
};
|
180
183
|
var RHFFilter = function RHFFilter(_ref) {
|
@@ -212,12 +215,12 @@ var RHFFilter = function RHFFilter(_ref) {
|
|
212
215
|
}
|
213
216
|
};
|
214
217
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
215
|
-
className: (0, _satellitePrefixer["default"])(
|
218
|
+
className: (0, _satellitePrefixer["default"])(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["w-full flex flex-col items-start gap-6 bg-grey-100 border border-grey-200 rounded p-4"]))),
|
216
219
|
children: [fields.map(function (field, index) {
|
217
220
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
218
|
-
className: (0, _satellitePrefixer["default"])(
|
221
|
+
className: (0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["w-full flex items-stretch gap-2 flex-col @xl:flex-row"]))),
|
219
222
|
children: [index > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
220
|
-
className: (0, _satellitePrefixer["default"])(
|
223
|
+
className: (0, _satellitePrefixer["default"])(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["mt-0 @xl:mt-8"]))),
|
221
224
|
children: "Or"
|
222
225
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
223
226
|
name: "filterGroups.".concat(parentIndex, ".").concat(index, ".facet"),
|
@@ -228,7 +231,7 @@ var RHFFilter = function RHFFilter(_ref) {
|
|
228
231
|
label: "Facet",
|
229
232
|
labelFor: "filterGroups.".concat(parentIndex, ".").concat(index, ".facet"),
|
230
233
|
state: getFieldState("filterGroups.".concat(parentIndex, ".").concat(index, ".facet")),
|
231
|
-
className: (0, _satellitePrefixer["default"])(
|
234
|
+
className: (0, _satellitePrefixer["default"])(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["w-full"]))),
|
232
235
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.AutoComplete, _objectSpread({
|
233
236
|
id: "filterGroups.".concat(parentIndex, ".").concat(index, ".facet"),
|
234
237
|
options: autocompleteFacets,
|
@@ -249,7 +252,7 @@ var RHFFilter = function RHFFilter(_ref) {
|
|
249
252
|
state: getFieldState("filterGroups.".concat(parentIndex, ".").concat(index, ".operator")),
|
250
253
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, _objectSpread(_objectSpread({
|
251
254
|
id: "filterGroups.".concat(parentIndex, ".").concat(index, ".operator"),
|
252
|
-
className: (0, _satellitePrefixer["default"])(
|
255
|
+
className: (0, _satellitePrefixer["default"])(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["w-min"]))),
|
253
256
|
required: true
|
254
257
|
}, field), {}, {
|
255
258
|
children: operators.map(function (operator) {
|
@@ -271,7 +274,7 @@ var RHFFilter = function RHFFilter(_ref) {
|
|
271
274
|
label: "Value",
|
272
275
|
labelFor: "filterGroups.".concat(parentIndex, ".").concat(index, ".value"),
|
273
276
|
state: getFieldState("filterGroups.".concat(parentIndex, ".").concat(index, ".value")),
|
274
|
-
className: (0, _satellitePrefixer["default"])(
|
277
|
+
className: (0, _satellitePrefixer["default"])(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["w-full"]))),
|
275
278
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.AutoComplete, _objectSpread({
|
276
279
|
id: "filterGroups.".concat(parentIndex, ".").concat(index, ".value"),
|
277
280
|
options: getAutocompleteFacetValues((_filterGroup$index = filterGroup[index]) === null || _filterGroup$index === void 0 || (_filterGroup$index = _filterGroup$index.facet) === null || _filterGroup$index === void 0 ? void 0 : _filterGroup$index.label),
|
@@ -285,7 +288,7 @@ var RHFFilter = function RHFFilter(_ref) {
|
|
285
288
|
title: "Remove filter",
|
286
289
|
variant: "subtle",
|
287
290
|
icon: _Icons.MinusIcon,
|
288
|
-
className: (0, _satellitePrefixer["default"])(
|
291
|
+
className: (0, _satellitePrefixer["default"])(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["shrink-0 mt-0 @lg:mt-8"]))),
|
289
292
|
disabled: fields.length === 1,
|
290
293
|
onClick: function onClick() {
|
291
294
|
return remove(index);
|
@@ -328,108 +331,111 @@ var FormikFieldArraysComponent = exports.FormikFieldArraysComponent = function F
|
|
328
331
|
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
329
332
|
revalidationEnabled = _useState6[0],
|
330
333
|
setRevalidationEnabled = _useState6[1];
|
331
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
332
|
-
className: (0, _satellitePrefixer["default"])(
|
333
|
-
children:
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
return
|
345
|
-
|
346
|
-
|
334
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
335
|
+
className: (0, _satellitePrefixer["default"])(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["@container w-full flex justify-center"]))),
|
336
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
337
|
+
className: (0, _satellitePrefixer["default"])(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-8 w-full"]))),
|
338
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, {
|
339
|
+
initialValues: initialFormData,
|
340
|
+
validateOnChange: revalidationEnabled,
|
341
|
+
validateOnBlur: revalidationEnabled,
|
342
|
+
validationSchema: yupSchema,
|
343
|
+
onSubmit: function onSubmit(values) {
|
344
|
+
// We need to transform the values here because transforms in Yup are run before validations
|
345
|
+
var transformedValues = _objectSpread(_objectSpread({}, values), {}, {
|
346
|
+
filterGroups: values.filterGroups.map(function (group) {
|
347
|
+
return group.map(function (item) {
|
348
|
+
var _item$facet, _item$value;
|
349
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
350
|
+
facet: (_item$facet = item.facet) === null || _item$facet === void 0 ? void 0 : _item$facet.label,
|
351
|
+
value: (_item$value = item.value) === null || _item$value === void 0 ? void 0 : _item$value.label
|
352
|
+
});
|
347
353
|
});
|
348
|
-
})
|
349
|
-
})
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
}
|
354
|
+
})
|
355
|
+
});
|
356
|
+
setFormData(transformedValues);
|
357
|
+
},
|
358
|
+
onReset: function onReset() {
|
359
|
+
return setFormData(initialFormData);
|
360
|
+
},
|
361
|
+
render: function render(_ref5) {
|
362
|
+
var handleSubmit = _ref5.handleSubmit,
|
363
|
+
handleReset = _ref5.handleReset,
|
364
|
+
values = _ref5.values,
|
365
|
+
resetForm = _ref5.resetForm;
|
366
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Form.Form, {
|
367
|
+
onSubmit: function onSubmit(e) {
|
368
|
+
setRevalidationEnabled(true);
|
369
|
+
handleSubmit(e);
|
370
|
+
},
|
371
|
+
onReset: function onReset(e) {
|
372
|
+
setRevalidationEnabled(false);
|
373
|
+
handleReset(e);
|
374
|
+
},
|
375
|
+
className: (0, _satellitePrefixer["default"])(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col items-start gap-6 min-w-72"]))),
|
376
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormErrorMessage, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.FieldArray, {
|
377
|
+
name: "filterGroups",
|
378
|
+
render: function render(_ref6) {
|
379
|
+
var push = _ref6.push,
|
380
|
+
remove = _ref6.remove;
|
381
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
382
|
+
children: [values.filterGroups.map(function (_, index) {
|
383
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
384
|
+
className: (0, _satellitePrefixer["default"])(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2["default"])(["w-full flex flex-col gap-2"]))),
|
385
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
386
|
+
className: (0, _satellitePrefixer["default"])(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2["default"])(["w-full flex items-center justify-between"]))),
|
387
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
388
|
+
children: index === 0 ? "Only display items that match this group" : "And"
|
389
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Actions.IconButton, {
|
390
|
+
title: "Remove group",
|
391
|
+
variant: "subtle",
|
392
|
+
icon: _Icons.MinusIcon,
|
393
|
+
disabled: values.filterGroups.length === 1,
|
394
|
+
onClick: function onClick() {
|
395
|
+
return remove(index);
|
396
|
+
}
|
397
|
+
})]
|
398
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(FormikFilter, {
|
399
|
+
parentIndex: index
|
392
400
|
})]
|
393
|
-
}
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
},
|
422
|
-
children: "Reset"
|
401
|
+
}, index);
|
402
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Actions.Button, {
|
403
|
+
variant: "subtle",
|
404
|
+
startIcon: _Icons.PlusIcon,
|
405
|
+
onClick: function onClick() {
|
406
|
+
return push([{
|
407
|
+
facet: undefined,
|
408
|
+
operator: "is",
|
409
|
+
value: undefined
|
410
|
+
}]);
|
411
|
+
},
|
412
|
+
children: "And"
|
413
|
+
})]
|
414
|
+
});
|
415
|
+
}
|
416
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
417
|
+
className: (0, _satellitePrefixer["default"])(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2["default"])(["flex gap-2"]))),
|
418
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormSubmit, {
|
419
|
+
variant: "primary",
|
420
|
+
"aria-label": "Apply changes",
|
421
|
+
children: "Apply"
|
422
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormReset, {
|
423
|
+
"aria-label": "Reset the form",
|
424
|
+
onClick: function onClick() {
|
425
|
+
return resetForm();
|
426
|
+
},
|
427
|
+
children: "Reset"
|
428
|
+
})]
|
423
429
|
})]
|
424
|
-
})
|
425
|
-
}
|
426
|
-
}
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
})
|
430
|
+
});
|
431
|
+
}
|
432
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {
|
433
|
+
className: (0, _satellitePrefixer["default"])(_templateObject22 || (_templateObject22 = (0, _taggedTemplateLiteral2["default"])(["text-grey-500"])))
|
434
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
435
|
+
className: (0, _satellitePrefixer["default"])(_templateObject23 || (_templateObject23 = (0, _taggedTemplateLiteral2["default"])(["whitespace-pre display-code"]))),
|
436
|
+
children: JSON.stringify(formData, null, 2)
|
437
|
+
})]
|
438
|
+
})
|
433
439
|
});
|
434
440
|
};
|
435
441
|
var FormikFilter = function FormikFilter(_ref7) {
|
@@ -460,19 +466,19 @@ var FormikFilter = function FormikFilter(_ref7) {
|
|
460
466
|
remove = _ref8.remove,
|
461
467
|
form = _ref8.form;
|
462
468
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
463
|
-
className: (0, _satellitePrefixer["default"])(
|
469
|
+
className: (0, _satellitePrefixer["default"])(_templateObject24 || (_templateObject24 = (0, _taggedTemplateLiteral2["default"])(["w-full flex flex-col items-start gap-6 bg-grey-100 border border-grey-200 rounded p-4"]))),
|
464
470
|
children: [formik.values.filterGroups[parentIndex].map(function (_, index) {
|
465
471
|
var _form$values$filterGr;
|
466
472
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
467
|
-
className: (0, _satellitePrefixer["default"])(
|
473
|
+
className: (0, _satellitePrefixer["default"])(_templateObject25 || (_templateObject25 = (0, _taggedTemplateLiteral2["default"])(["w-full flex items-stretch gap-2 flex-col @xl:flex-row"]))),
|
468
474
|
children: [index > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
469
|
-
className: (0, _satellitePrefixer["default"])(
|
475
|
+
className: (0, _satellitePrefixer["default"])(_templateObject26 || (_templateObject26 = (0, _taggedTemplateLiteral2["default"])(["mt-0 @xl:mt-8"]))),
|
470
476
|
children: "Or"
|
471
477
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Field.Field, {
|
472
478
|
label: "Facet",
|
473
479
|
labelFor: "filterGroups.".concat(parentIndex, ".").concat(index, ".facet"),
|
474
480
|
state: getFieldState("filterGroups.".concat(parentIndex, ".").concat(index, ".facet")),
|
475
|
-
className: (0, _satellitePrefixer["default"])(
|
481
|
+
className: (0, _satellitePrefixer["default"])(_templateObject27 || (_templateObject27 = (0, _taggedTemplateLiteral2["default"])(["w-full"]))),
|
476
482
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.AutoComplete, _objectSpread(_objectSpread({
|
477
483
|
id: "filterGroups.".concat(parentIndex, ".").concat(index, ".facet"),
|
478
484
|
options: autocompleteFacets,
|
@@ -492,7 +498,7 @@ var FormikFilter = function FormikFilter(_ref7) {
|
|
492
498
|
state: getFieldState("filterGroups.".concat(parentIndex, ".").concat(index, ".operator")),
|
493
499
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, _objectSpread(_objectSpread({
|
494
500
|
id: "filterGroups.".concat(parentIndex, ".").concat(index, ".operator"),
|
495
|
-
className: (0, _satellitePrefixer["default"])(
|
501
|
+
className: (0, _satellitePrefixer["default"])(_templateObject28 || (_templateObject28 = (0, _taggedTemplateLiteral2["default"])(["w-min"]))),
|
496
502
|
required: true
|
497
503
|
}, form.getFieldProps("filterGroups.".concat(parentIndex, ".").concat(index, ".operator"))), {}, {
|
498
504
|
children: operators.map(function (operator) {
|
@@ -506,7 +512,7 @@ var FormikFilter = function FormikFilter(_ref7) {
|
|
506
512
|
label: "Value",
|
507
513
|
labelFor: "filterGroups.".concat(parentIndex, ".").concat(index, ".value"),
|
508
514
|
state: getFieldState("filterGroups.".concat(parentIndex, ".").concat(index, ".value")),
|
509
|
-
className: (0, _satellitePrefixer["default"])(
|
515
|
+
className: (0, _satellitePrefixer["default"])(_templateObject29 || (_templateObject29 = (0, _taggedTemplateLiteral2["default"])(["w-full"]))),
|
510
516
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.AutoComplete, _objectSpread(_objectSpread({
|
511
517
|
id: "filterGroups.".concat(parentIndex, ".").concat(index, ".value"),
|
512
518
|
options: getAutocompleteFacetValues((_form$values$filterGr = form.values.filterGroups[parentIndex][index]) === null || _form$values$filterGr === void 0 || (_form$values$filterGr = _form$values$filterGr.facet) === null || _form$values$filterGr === void 0 ? void 0 : _form$values$filterGr.label),
|
@@ -524,7 +530,7 @@ var FormikFilter = function FormikFilter(_ref7) {
|
|
524
530
|
title: "Remove filter",
|
525
531
|
variant: "subtle",
|
526
532
|
icon: _Icons.MinusIcon,
|
527
|
-
className: (0, _satellitePrefixer["default"])(
|
533
|
+
className: (0, _satellitePrefixer["default"])(_templateObject30 || (_templateObject30 = (0, _taggedTemplateLiteral2["default"])(["shrink-0 mt-0 @lg:mt-8"]))),
|
528
534
|
disabled: form.values.filterGroups[parentIndex].length === 1,
|
529
535
|
onClick: function onClick() {
|
530
536
|
return remove(index);
|
@@ -29,7 +29,7 @@ var _TextArea = require("../../TextArea");
|
|
29
29
|
var _Toggle = require("../../Toggle");
|
30
30
|
var _Form = require("../Form");
|
31
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
32
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21;
|
32
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22;
|
33
33
|
var schema = {
|
34
34
|
type: "object",
|
35
35
|
properties: {
|
@@ -838,7 +838,7 @@ var renderers = [{
|
|
838
838
|
var styleContextValue = {
|
839
839
|
styles: [{
|
840
840
|
name: "vertical.layout",
|
841
|
-
classNames: [(0, _satellitePrefixer["default"])(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col items-start gap-
|
841
|
+
classNames: [(0, _satellitePrefixer["default"])(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col items-start gap-6 min-w-72 w-full"])))]
|
842
842
|
}, {
|
843
843
|
name: "vertical.layout.item",
|
844
844
|
classNames: [(0, _satellitePrefixer["default"])(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["w-full"])))]
|
@@ -878,63 +878,66 @@ var JSONFormsComplexComponent = exports.JSONFormsComplexComponent = function JSO
|
|
878
878
|
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
879
879
|
validationMode = _useState10[0],
|
880
880
|
setValidationMode = _useState10[1];
|
881
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
882
|
-
className: (0, _satellitePrefixer["default"])(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["
|
883
|
-
children:
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
setInternalFormData(initialFormData);
|
893
|
-
setFormData(initialFormData);
|
894
|
-
setAdditionalErrors([]);
|
895
|
-
setValidationMode("ValidateAndHide");
|
896
|
-
},
|
897
|
-
className: (0, _satellitePrefixer["default"])(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col items-start gap-4 min-w-72"]))),
|
898
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.ExperimentalFormErrorMessage, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(AdditionalErrorsContext.Provider, {
|
899
|
-
value: {
|
900
|
-
setAdditionalErrors: setAdditionalErrors
|
881
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
882
|
+
className: (0, _satellitePrefixer["default"])(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["@container w-full flex justify-center"]))),
|
883
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
884
|
+
className: (0, _satellitePrefixer["default"])(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-8 w-full @lg:w-1/2"]))),
|
885
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Form.Form, {
|
886
|
+
onSubmit: function onSubmit(e) {
|
887
|
+
e.preventDefault();
|
888
|
+
setValidationMode("ValidateAndShow");
|
889
|
+
if (!errors.length) {
|
890
|
+
setFormData(internalFormData);
|
891
|
+
}
|
901
892
|
},
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
893
|
+
onReset: function onReset() {
|
894
|
+
setInternalFormData(initialFormData);
|
895
|
+
setFormData(initialFormData);
|
896
|
+
setAdditionalErrors([]);
|
897
|
+
setValidationMode("ValidateAndHide");
|
898
|
+
},
|
899
|
+
className: (0, _satellitePrefixer["default"])(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col items-start gap-6 min-w-72"]))),
|
900
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormErrorMessage, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(AdditionalErrorsContext.Provider, {
|
901
|
+
value: {
|
902
|
+
setAdditionalErrors: setAdditionalErrors
|
903
|
+
},
|
904
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vanillaRenderers.JsonFormsStyleContext.Provider, {
|
905
|
+
value: styleContextValue,
|
906
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.JsonForms, {
|
907
|
+
schema: schema,
|
908
|
+
uischema: uischema,
|
909
|
+
data: internalFormData,
|
910
|
+
renderers: renderers,
|
911
|
+
ajv: ajv,
|
912
|
+
validationMode: validationMode,
|
913
|
+
additionalErrors: additionalErrors,
|
914
|
+
onChange: function onChange(_ref12) {
|
915
|
+
var data = _ref12.data,
|
916
|
+
errors = _ref12.errors;
|
917
|
+
setInternalFormData(data);
|
918
|
+
setErrors((errors === null || errors === void 0 ? void 0 : errors.map(function (error) {
|
919
|
+
return error.message || "";
|
920
|
+
})) || []);
|
921
|
+
}
|
922
|
+
})
|
920
923
|
})
|
921
|
-
})
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
924
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
925
|
+
className: (0, _satellitePrefixer["default"])(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2["default"])(["flex gap-2"]))),
|
926
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormSubmit, {
|
927
|
+
variant: "primary",
|
928
|
+
"aria-label": "Save the form",
|
929
|
+
children: "Save"
|
930
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormReset, {
|
931
|
+
"aria-label": "Reset the form",
|
932
|
+
children: "Reset"
|
933
|
+
})]
|
931
934
|
})]
|
935
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {
|
936
|
+
className: (0, _satellitePrefixer["default"])(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2["default"])(["text-grey-500"])))
|
937
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
938
|
+
className: (0, _satellitePrefixer["default"])(_templateObject22 || (_templateObject22 = (0, _taggedTemplateLiteral2["default"])(["whitespace-pre display-code"]))),
|
939
|
+
children: JSON.stringify(formData, null, 2)
|
932
940
|
})]
|
933
|
-
})
|
934
|
-
className: (0, _satellitePrefixer["default"])(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2["default"])(["text-grey-500"])))
|
935
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
936
|
-
className: (0, _satellitePrefixer["default"])(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2["default"])(["whitespace-pre"]))),
|
937
|
-
children: JSON.stringify(formData, null, 2)
|
938
|
-
})]
|
941
|
+
})
|
939
942
|
});
|
940
943
|
};
|