@algolia/satellite 1.6.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/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 +1 -1
- 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 +58 -55
- package/dist/cjs/Fields/Form/stories/MultiStep.js +474 -468
- 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/Indicators/Skeleton/Skeleton.d.ts +7 -0
- package/dist/cjs/Indicators/Skeleton/Skeleton.js +12 -5
- 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/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 +2 -2
- 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 +59 -56
- package/dist/esm/Fields/Form/stories/MultiStep.js +475 -469
- 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/Indicators/Skeleton/Skeleton.d.ts +7 -0
- package/dist/esm/Indicators/Skeleton/Skeleton.js +12 -5
- 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 +2 -1
@@ -29,7 +29,7 @@ var _RadioGroup = require("../../RadioGroup");
|
|
29
29
|
var _Form = require("../Form");
|
30
30
|
var _useFormikAutoFocusOnError = require("./utils/useFormikAutoFocusOnError");
|
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, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50, _templateObject51, _templateObject52, _templateObject53, _templateObject54, _templateObject55, _templateObject56, _templateObject57, _templateObject58, _templateObject59, _templateObject60, _templateObject61, _templateObject62, _templateObject63, _templateObject64, _templateObject65, _templateObject66, _templateObject67, _templateObject68, _templateObject69, _templateObject70;
|
32
|
+
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, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50, _templateObject51, _templateObject52, _templateObject53, _templateObject54, _templateObject55, _templateObject56, _templateObject57, _templateObject58, _templateObject59, _templateObject60, _templateObject61, _templateObject62, _templateObject63, _templateObject64, _templateObject65, _templateObject66, _templateObject67, _templateObject68, _templateObject69, _templateObject70, _templateObject71, _templateObject72;
|
33
33
|
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); }
|
34
34
|
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; }
|
35
35
|
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; }
|
@@ -131,263 +131,266 @@ var RHFMultiStepComponent = exports.RHFMultiStepComponent = function RHFMultiSte
|
|
131
131
|
};
|
132
132
|
}
|
133
133
|
};
|
134
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
135
|
-
className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["
|
136
|
-
children:
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.ExperimentalFormErrorMessage, {
|
145
|
-
locale: {
|
146
|
-
errorText: function errorText(invalidFields) {
|
147
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
148
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
149
|
-
className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["display-heading mb-2"]))),
|
150
|
-
children: ["Please fix ", invalidFields.length, " error", invalidFields.length > 1 ? "s" : "", " below and try again."]
|
151
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
152
|
-
className: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col"]))),
|
153
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
154
|
-
href: "#",
|
155
|
-
className: (0, _satellitePrefixer["default"])(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["text-black underline hover:text-grey-800"]))),
|
156
|
-
onClick: function onClick(e) {
|
157
|
-
e.preventDefault();
|
158
|
-
var firstInvalid = steps.find(function (step) {
|
159
|
-
return getFieldState(step).status === "invalid";
|
160
|
-
});
|
161
|
-
if (firstInvalid) {
|
162
|
-
goToPage(steps.indexOf(firstInvalid) + 1);
|
163
|
-
}
|
164
|
-
},
|
165
|
-
children: "Go to first error"
|
166
|
-
})
|
167
|
-
})]
|
168
|
-
});
|
169
|
-
}
|
170
|
-
}
|
171
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
172
|
-
className: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["flex transition-transform ease-out duration-500"]))),
|
173
|
-
style: {
|
174
|
-
transform: "translateX(-".concat((page - 1) * 100, "%)")
|
134
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
135
|
+
className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["@container w-full flex justify-center"]))),
|
136
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
137
|
+
className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-8 w-full @lg:w-4/5"]))),
|
138
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Form.Form, {
|
139
|
+
onSubmit: handleSubmit(function (data) {
|
140
|
+
return setFormData(data);
|
141
|
+
}),
|
142
|
+
onReset: function onReset() {
|
143
|
+
return setFormData(initialFormData);
|
175
144
|
},
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
className: (0, _satellitePrefixer["default"])(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["shrink-0"])))
|
204
|
-
})), option.title]
|
205
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
206
|
-
className: (0, _satellitePrefixer["default"])(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["ml-6 typo-subdued"]))),
|
207
|
-
children: option.description
|
208
|
-
})]
|
209
|
-
}, option.value);
|
210
|
-
})
|
211
|
-
})
|
212
|
-
});
|
145
|
+
className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-8 overflow-hidden"]))),
|
146
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormErrorMessage, {
|
147
|
+
locale: {
|
148
|
+
errorText: function errorText(invalidFields) {
|
149
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
150
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
151
|
+
className: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["display-heading mb-2"]))),
|
152
|
+
children: ["Please fix ", invalidFields.length, " error", invalidFields.length > 1 ? "s" : "", " below and try again."]
|
153
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
154
|
+
className: (0, _satellitePrefixer["default"])(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col"]))),
|
155
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
156
|
+
href: "#",
|
157
|
+
className: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["text-black underline hover:text-grey-800"]))),
|
158
|
+
onClick: function onClick(e) {
|
159
|
+
e.preventDefault();
|
160
|
+
var firstInvalid = steps.find(function (step) {
|
161
|
+
return getFieldState(step).status === "invalid";
|
162
|
+
});
|
163
|
+
if (firstInvalid) {
|
164
|
+
goToPage(steps.indexOf(firstInvalid) + 1);
|
165
|
+
}
|
166
|
+
},
|
167
|
+
children: "Go to first error"
|
168
|
+
})
|
169
|
+
})]
|
170
|
+
});
|
171
|
+
}
|
213
172
|
}
|
214
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
173
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
174
|
+
className: (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["flex transition-transform ease-out duration-500"]))),
|
175
|
+
style: {
|
176
|
+
transform: "translateX(-".concat((page - 1) * 100, "%)")
|
177
|
+
},
|
178
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
179
|
+
name: "variants",
|
180
|
+
control: control,
|
181
|
+
render: function render(_ref) {
|
182
|
+
var field = _ref.field;
|
183
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Field.Field, {
|
184
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
185
|
+
className: (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["display-xlarge whitespace-normal inline"]))),
|
186
|
+
children: "How should we display products that contain multiple variants?"
|
187
|
+
}),
|
188
|
+
labelFor: variantsEnum[0],
|
189
|
+
state: getFieldState("variants"),
|
190
|
+
className: (0, _satellitePrefixer["default"])(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["w-full shrink-0"]))),
|
191
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
192
|
+
className: (0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["mt-7"]))),
|
193
|
+
children: variantsOptions.map(function (option) {
|
194
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
195
|
+
htmlFor: option.value,
|
196
|
+
className: (0, _satellitePrefixer["default"])(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-3 p-6 rounded display-body transition-colors hover:bg-grey-100"]))),
|
197
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
198
|
+
className: (0, _satellitePrefixer["default"])(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["flex items-center gap-2"]))),
|
199
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RadioGroup.RadioButton, _objectSpread(_objectSpread({
|
200
|
+
id: option.value,
|
201
|
+
"aria-labelledby": option.value,
|
202
|
+
required: true
|
203
|
+
}, field), {}, {
|
204
|
+
value: option.value,
|
205
|
+
className: (0, _satellitePrefixer["default"])(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["shrink-0"])))
|
206
|
+
})), option.title]
|
207
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
208
|
+
className: (0, _satellitePrefixer["default"])(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["ml-6 typo-subdued"]))),
|
209
|
+
children: option.description
|
210
|
+
})]
|
211
|
+
}, option.value);
|
212
|
+
})
|
248
213
|
})
|
249
|
-
})
|
250
|
-
}
|
251
|
-
}
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
}
|
284
|
-
}
|
285
|
-
}
|
214
|
+
});
|
215
|
+
}
|
216
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
217
|
+
name: "outOfStock",
|
218
|
+
control: control,
|
219
|
+
render: function render(_ref2) {
|
220
|
+
var field = _ref2.field;
|
221
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Field.Field, {
|
222
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
223
|
+
className: (0, _satellitePrefixer["default"])(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["display-xlarge whitespace-normal inline"]))),
|
224
|
+
children: "How would you like to show out-of-stock items?"
|
225
|
+
}),
|
226
|
+
labelFor: outOfStockEnum[0],
|
227
|
+
state: getFieldState("outOfStock"),
|
228
|
+
className: (0, _satellitePrefixer["default"])(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["w-full shrink-0"]))),
|
229
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
230
|
+
className: (0, _satellitePrefixer["default"])(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["mt-7"]))),
|
231
|
+
children: outOfStockOptions.map(function (option) {
|
232
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
233
|
+
htmlFor: option.value,
|
234
|
+
className: (0, _satellitePrefixer["default"])(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-3 p-6 rounded display-body transition-colors hover:bg-grey-100"]))),
|
235
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
236
|
+
className: (0, _satellitePrefixer["default"])(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2["default"])(["flex items-center gap-2"]))),
|
237
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RadioGroup.RadioButton, _objectSpread(_objectSpread({
|
238
|
+
id: option.value,
|
239
|
+
"aria-labelledby": option.value,
|
240
|
+
required: true
|
241
|
+
}, field), {}, {
|
242
|
+
value: option.value,
|
243
|
+
className: (0, _satellitePrefixer["default"])(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2["default"])(["shrink-0"])))
|
244
|
+
})), option.title]
|
245
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
246
|
+
className: (0, _satellitePrefixer["default"])(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2["default"])(["ml-6 typo-subdued"]))),
|
247
|
+
children: option.description
|
248
|
+
})]
|
249
|
+
}, option.value);
|
250
|
+
})
|
286
251
|
})
|
287
|
-
})
|
288
|
-
}
|
289
|
-
}
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
}
|
252
|
+
});
|
253
|
+
}
|
254
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
255
|
+
name: "sorting",
|
256
|
+
control: control,
|
257
|
+
render: function render(_ref3) {
|
258
|
+
var field = _ref3.field;
|
259
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Field.Field, {
|
260
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
261
|
+
className: (0, _satellitePrefixer["default"])(_templateObject22 || (_templateObject22 = (0, _taggedTemplateLiteral2["default"])(["display-xlarge whitespace-normal inline"]))),
|
262
|
+
children: "Select how your customers can sort their search results"
|
263
|
+
}),
|
264
|
+
labelFor: sortingOptions[0],
|
265
|
+
state: getFieldState("sorting"),
|
266
|
+
className: (0, _satellitePrefixer["default"])(_templateObject23 || (_templateObject23 = (0, _taggedTemplateLiteral2["default"])(["w-full shrink-0"]))),
|
267
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
268
|
+
className: (0, _satellitePrefixer["default"])(_templateObject24 || (_templateObject24 = (0, _taggedTemplateLiteral2["default"])(["mt-4 typo-subdued"]))),
|
269
|
+
children: "Select the sort order options you'd like to show customers. You can change these later."
|
270
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
271
|
+
className: (0, _satellitePrefixer["default"])(_templateObject25 || (_templateObject25 = (0, _taggedTemplateLiteral2["default"])(["mt-7"]))),
|
272
|
+
children: sortingOptions.map(function (option) {
|
273
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
274
|
+
htmlFor: option,
|
275
|
+
className: (0, _satellitePrefixer["default"])(_templateObject26 || (_templateObject26 = (0, _taggedTemplateLiteral2["default"])(["flex gap-2 p-4 rounded display-body transition-colors hover:bg-grey-100"]))),
|
276
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, _objectSpread(_objectSpread({
|
277
|
+
id: option,
|
278
|
+
required: true,
|
279
|
+
checked: getValues("sorting").includes(option)
|
280
|
+
}, field), {}, {
|
281
|
+
onChange: function onChange() {
|
282
|
+
return field.onChange(field.value.includes(option) ? field.value.filter(function (v) {
|
283
|
+
return v !== option;
|
284
|
+
}) : [].concat((0, _toConsumableArray2["default"])(field.value), [option]));
|
285
|
+
}
|
286
|
+
})), (0, _capitalize["default"])(option)]
|
287
|
+
}, option);
|
288
|
+
})
|
289
|
+
})]
|
290
|
+
});
|
291
|
+
}
|
292
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
293
|
+
name: "filters",
|
294
|
+
control: control,
|
295
|
+
render: function render(_ref4) {
|
296
|
+
var field = _ref4.field;
|
297
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Field.Field, {
|
298
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
299
|
+
className: (0, _satellitePrefixer["default"])(_templateObject27 || (_templateObject27 = (0, _taggedTemplateLiteral2["default"])(["display-xlarge whitespace-normal inline"]))),
|
300
|
+
children: "Add filters to help narrow results"
|
301
|
+
}),
|
302
|
+
labelFor: filtersOptions[0],
|
303
|
+
state: getFieldState("filters"),
|
304
|
+
className: (0, _satellitePrefixer["default"])(_templateObject28 || (_templateObject28 = (0, _taggedTemplateLiteral2["default"])(["w-full shrink-0"]))),
|
305
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
306
|
+
className: (0, _satellitePrefixer["default"])(_templateObject29 || (_templateObject29 = (0, _taggedTemplateLiteral2["default"])(["mt-4 typo-subdued"]))),
|
307
|
+
children: ["Select the filter options customers can use to refine results.", /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), "You can edit these after setup."]
|
308
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
309
|
+
className: (0, _satellitePrefixer["default"])(_templateObject30 || (_templateObject30 = (0, _taggedTemplateLiteral2["default"])(["mt-7"]))),
|
310
|
+
children: filtersOptions.map(function (option) {
|
311
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
312
|
+
htmlFor: option,
|
313
|
+
className: (0, _satellitePrefixer["default"])(_templateObject31 || (_templateObject31 = (0, _taggedTemplateLiteral2["default"])(["flex gap-2 p-4 rounded display-body transition-colors hover:bg-grey-100"]))),
|
314
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, _objectSpread(_objectSpread({
|
315
|
+
id: option,
|
316
|
+
required: true,
|
317
|
+
checked: getValues("filters").includes(option)
|
318
|
+
}, field), {}, {
|
319
|
+
onChange: function onChange() {
|
320
|
+
return field.onChange(field.value.includes(option) ? field.value.filter(function (v) {
|
321
|
+
return v !== option;
|
322
|
+
}) : [].concat((0, _toConsumableArray2["default"])(field.value), [option]));
|
323
|
+
}
|
324
|
+
})), (0, _capitalize["default"])(option)]
|
325
|
+
}, option);
|
326
|
+
})
|
327
|
+
})]
|
328
|
+
});
|
329
|
+
}
|
330
|
+
})]
|
331
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
332
|
+
className: (0, _satellitePrefixer["default"])(_templateObject32 || (_templateObject32 = (0, _taggedTemplateLiteral2["default"])(["w-full flex justify-between"]))),
|
333
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
334
|
+
className: (0, _satellitePrefixer["default"])(_templateObject33 || (_templateObject33 = (0, _taggedTemplateLiteral2["default"])(["flex gap-2"]))),
|
335
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
336
|
+
"aria-label": "Previous step",
|
337
|
+
disabled: page <= 1,
|
338
|
+
onClick: function onClick() {
|
339
|
+
return goToPreviousPage();
|
340
|
+
},
|
341
|
+
children: "Back"
|
342
|
+
}), page >= steps.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormSubmit, {
|
343
|
+
variant: "primary",
|
344
|
+
"aria-label": "Complete",
|
345
|
+
children: "Complete"
|
346
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
347
|
+
variant: "primary",
|
348
|
+
"aria-label": "Next step",
|
349
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
350
|
+
var valid;
|
351
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
352
|
+
while (1) switch (_context.prev = _context.next) {
|
353
|
+
case 0:
|
354
|
+
_context.next = 2;
|
355
|
+
return trigger(steps[page - 1]);
|
356
|
+
case 2:
|
357
|
+
valid = _context.sent;
|
358
|
+
if (valid) {
|
359
|
+
goToNextPage();
|
321
360
|
}
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
334
|
-
"aria-label": "Previous step",
|
335
|
-
disabled: page <= 1,
|
361
|
+
case 4:
|
362
|
+
case "end":
|
363
|
+
return _context.stop();
|
364
|
+
}
|
365
|
+
}, _callee);
|
366
|
+
})),
|
367
|
+
children: "Next"
|
368
|
+
})]
|
369
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
370
|
+
variant: "subtle",
|
371
|
+
"aria-label": "Reset the form",
|
336
372
|
onClick: function onClick() {
|
337
|
-
|
373
|
+
reset();
|
374
|
+
goToPage(1);
|
338
375
|
},
|
339
|
-
children: "
|
340
|
-
}), page >= steps.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.ExperimentalFormSubmit, {
|
341
|
-
variant: "primary",
|
342
|
-
"aria-label": "Complete",
|
343
|
-
children: "Complete"
|
344
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
345
|
-
variant: "primary",
|
346
|
-
"aria-label": "Next step",
|
347
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
348
|
-
var valid;
|
349
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
350
|
-
while (1) switch (_context.prev = _context.next) {
|
351
|
-
case 0:
|
352
|
-
_context.next = 2;
|
353
|
-
return trigger(steps[page - 1]);
|
354
|
-
case 2:
|
355
|
-
valid = _context.sent;
|
356
|
-
if (valid) {
|
357
|
-
goToNextPage();
|
358
|
-
}
|
359
|
-
case 4:
|
360
|
-
case "end":
|
361
|
-
return _context.stop();
|
362
|
-
}
|
363
|
-
}, _callee);
|
364
|
-
})),
|
365
|
-
children: "Next"
|
376
|
+
children: "Reset"
|
366
377
|
})]
|
367
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
goToPage
|
373
|
-
|
374
|
-
|
378
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
379
|
+
className: (0, _satellitePrefixer["default"])(_templateObject34 || (_templateObject34 = (0, _taggedTemplateLiteral2["default"])(["mt-8 mx-auto"]))),
|
380
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DotPagination.DotPagination, {
|
381
|
+
nbPages: steps.length,
|
382
|
+
currentPage: page,
|
383
|
+
onChange: goToPage,
|
384
|
+
size: "small"
|
385
|
+
})
|
375
386
|
})]
|
376
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("
|
377
|
-
className: (0, _satellitePrefixer["default"])(
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
onChange: goToPage,
|
382
|
-
size: "small"
|
383
|
-
})
|
387
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {
|
388
|
+
className: (0, _satellitePrefixer["default"])(_templateObject35 || (_templateObject35 = (0, _taggedTemplateLiteral2["default"])(["text-grey-500"])))
|
389
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
390
|
+
className: (0, _satellitePrefixer["default"])(_templateObject36 || (_templateObject36 = (0, _taggedTemplateLiteral2["default"])(["whitespace-pre display-code"]))),
|
391
|
+
children: JSON.stringify(formData, null, 2)
|
384
392
|
})]
|
385
|
-
})
|
386
|
-
className: (0, _satellitePrefixer["default"])(_templateObject34 || (_templateObject34 = (0, _taggedTemplateLiteral2["default"])(["text-grey-500"])))
|
387
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
388
|
-
className: (0, _satellitePrefixer["default"])(_templateObject35 || (_templateObject35 = (0, _taggedTemplateLiteral2["default"])(["whitespace-pre display-code"]))),
|
389
|
-
children: JSON.stringify(formData, null, 2)
|
390
|
-
})]
|
393
|
+
})
|
391
394
|
});
|
392
395
|
};
|
393
396
|
var yupSchema = yup.object({
|
@@ -462,239 +465,242 @@ var FormikMultiStepComponent = exports.FormikMultiStepComponent = function Formi
|
|
462
465
|
goToNextPage();
|
463
466
|
}
|
464
467
|
}
|
465
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
466
|
-
className: (0, _satellitePrefixer["default"])(
|
467
|
-
children:
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
setRevalidationEnabled(false);
|
474
|
-
formik.handleReset(e);
|
475
|
-
},
|
476
|
-
className: (0, _satellitePrefixer["default"])(_templateObject37 || (_templateObject37 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-8 overflow-hidden"]))),
|
477
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.ExperimentalFormErrorMessage, {
|
478
|
-
locale: {
|
479
|
-
errorText: function errorText(invalidFields) {
|
480
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
481
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
482
|
-
className: (0, _satellitePrefixer["default"])(_templateObject38 || (_templateObject38 = (0, _taggedTemplateLiteral2["default"])(["display-heading mb-2"]))),
|
483
|
-
children: ["Please fix ", invalidFields.length, " error", invalidFields.length > 1 ? "s" : "", " below and try again."]
|
484
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
485
|
-
className: (0, _satellitePrefixer["default"])(_templateObject39 || (_templateObject39 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col"]))),
|
486
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
487
|
-
href: "#",
|
488
|
-
className: (0, _satellitePrefixer["default"])(_templateObject40 || (_templateObject40 = (0, _taggedTemplateLiteral2["default"])(["text-black underline hover:text-grey-800"]))),
|
489
|
-
onClick: function onClick(e) {
|
490
|
-
e.preventDefault();
|
491
|
-
var firstInvalid = steps.find(function (step) {
|
492
|
-
return getFieldState(step).status === "invalid";
|
493
|
-
});
|
494
|
-
if (firstInvalid) {
|
495
|
-
goToPage(steps.indexOf(firstInvalid) + 1);
|
496
|
-
}
|
497
|
-
},
|
498
|
-
children: "Go to first error"
|
499
|
-
})
|
500
|
-
})]
|
501
|
-
});
|
502
|
-
}
|
503
|
-
}
|
504
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
505
|
-
className: (0, _satellitePrefixer["default"])(_templateObject41 || (_templateObject41 = (0, _taggedTemplateLiteral2["default"])(["flex transition-transform ease-out duration-500"]))),
|
506
|
-
style: {
|
507
|
-
transform: "translateX(-".concat((page - 1) * 100, "%)")
|
468
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
469
|
+
className: (0, _satellitePrefixer["default"])(_templateObject37 || (_templateObject37 = (0, _taggedTemplateLiteral2["default"])(["@container w-full flex justify-center"]))),
|
470
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
471
|
+
className: (0, _satellitePrefixer["default"])(_templateObject38 || (_templateObject38 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-8 w-full @lg:w-4/5"]))),
|
472
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Form.Form, {
|
473
|
+
onSubmit: function onSubmit(e) {
|
474
|
+
setRevalidationEnabled(true);
|
475
|
+
formik.handleSubmit(e);
|
508
476
|
},
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
className: (0, _satellitePrefixer["default"])(_templateObject44 || (_templateObject44 = (0, _taggedTemplateLiteral2["default"])(["mt-7"]))),
|
519
|
-
children: variantsOptions.map(function (option) {
|
520
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
521
|
-
htmlFor: option.value,
|
522
|
-
className: (0, _satellitePrefixer["default"])(_templateObject45 || (_templateObject45 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-3 p-6 rounded display-body transition-colors hover:bg-grey-100"]))),
|
523
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
524
|
-
className: (0, _satellitePrefixer["default"])(_templateObject46 || (_templateObject46 = (0, _taggedTemplateLiteral2["default"])(["flex items-center gap-2"]))),
|
525
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RadioGroup.RadioButton, _objectSpread(_objectSpread({
|
526
|
-
id: option.value,
|
527
|
-
"aria-labelledby": option.value,
|
528
|
-
required: true
|
529
|
-
}, formik.getFieldProps({
|
530
|
-
name: "variants",
|
531
|
-
value: option.value,
|
532
|
-
type: "radio"
|
533
|
-
})), {}, {
|
534
|
-
className: (0, _satellitePrefixer["default"])(_templateObject47 || (_templateObject47 = (0, _taggedTemplateLiteral2["default"])(["shrink-0"])))
|
535
|
-
})), option.title]
|
536
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
537
|
-
className: (0, _satellitePrefixer["default"])(_templateObject48 || (_templateObject48 = (0, _taggedTemplateLiteral2["default"])(["ml-6 typo-subdued"]))),
|
538
|
-
children: option.description
|
539
|
-
})]
|
540
|
-
}, option.value);
|
541
|
-
})
|
542
|
-
})
|
543
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Field.Field, {
|
544
|
-
label: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
545
|
-
className: (0, _satellitePrefixer["default"])(_templateObject49 || (_templateObject49 = (0, _taggedTemplateLiteral2["default"])(["display-xlarge whitespace-normal inline"]))),
|
546
|
-
children: "How would you like to show out-of-stock items?"
|
547
|
-
}),
|
548
|
-
labelFor: outOfStockEnum[0],
|
549
|
-
state: getFieldState("outOfStock"),
|
550
|
-
className: (0, _satellitePrefixer["default"])(_templateObject50 || (_templateObject50 = (0, _taggedTemplateLiteral2["default"])(["w-full shrink-0"]))),
|
551
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
552
|
-
className: (0, _satellitePrefixer["default"])(_templateObject51 || (_templateObject51 = (0, _taggedTemplateLiteral2["default"])(["mt-7"]))),
|
553
|
-
children: outOfStockOptions.map(function (option) {
|
554
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
555
|
-
htmlFor: option.value,
|
556
|
-
className: (0, _satellitePrefixer["default"])(_templateObject52 || (_templateObject52 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-3 p-6 rounded display-body transition-colors hover:bg-grey-100"]))),
|
477
|
+
onReset: function onReset(e) {
|
478
|
+
setRevalidationEnabled(false);
|
479
|
+
formik.handleReset(e);
|
480
|
+
},
|
481
|
+
className: (0, _satellitePrefixer["default"])(_templateObject39 || (_templateObject39 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-8 overflow-hidden"]))),
|
482
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormErrorMessage, {
|
483
|
+
locale: {
|
484
|
+
errorText: function errorText(invalidFields) {
|
485
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
557
486
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
558
|
-
className: (0, _satellitePrefixer["default"])(
|
559
|
-
children: [
|
560
|
-
id: option.value,
|
561
|
-
"aria-labelledby": option.value,
|
562
|
-
required: true
|
563
|
-
}, formik.getFieldProps({
|
564
|
-
name: "outOfStock",
|
565
|
-
value: option.value,
|
566
|
-
type: "radio"
|
567
|
-
})), {}, {
|
568
|
-
className: (0, _satellitePrefixer["default"])(_templateObject54 || (_templateObject54 = (0, _taggedTemplateLiteral2["default"])(["shrink-0"])))
|
569
|
-
})), option.title]
|
487
|
+
className: (0, _satellitePrefixer["default"])(_templateObject40 || (_templateObject40 = (0, _taggedTemplateLiteral2["default"])(["display-heading mb-2"]))),
|
488
|
+
children: ["Please fix ", invalidFields.length, " error", invalidFields.length > 1 ? "s" : "", " below and try again."]
|
570
489
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
571
|
-
className: (0, _satellitePrefixer["default"])(
|
572
|
-
children:
|
490
|
+
className: (0, _satellitePrefixer["default"])(_templateObject41 || (_templateObject41 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col"]))),
|
491
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
492
|
+
href: "#",
|
493
|
+
className: (0, _satellitePrefixer["default"])(_templateObject42 || (_templateObject42 = (0, _taggedTemplateLiteral2["default"])(["text-black underline hover:text-grey-800"]))),
|
494
|
+
onClick: function onClick(e) {
|
495
|
+
e.preventDefault();
|
496
|
+
var firstInvalid = steps.find(function (step) {
|
497
|
+
return getFieldState(step).status === "invalid";
|
498
|
+
});
|
499
|
+
if (firstInvalid) {
|
500
|
+
goToPage(steps.indexOf(firstInvalid) + 1);
|
501
|
+
}
|
502
|
+
},
|
503
|
+
children: "Go to first error"
|
504
|
+
})
|
573
505
|
})]
|
574
|
-
}
|
506
|
+
});
|
507
|
+
}
|
508
|
+
}
|
509
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
510
|
+
className: (0, _satellitePrefixer["default"])(_templateObject43 || (_templateObject43 = (0, _taggedTemplateLiteral2["default"])(["flex transition-transform ease-out duration-500"]))),
|
511
|
+
style: {
|
512
|
+
transform: "translateX(-".concat((page - 1) * 100, "%)")
|
513
|
+
},
|
514
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Field.Field, {
|
515
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
516
|
+
className: (0, _satellitePrefixer["default"])(_templateObject44 || (_templateObject44 = (0, _taggedTemplateLiteral2["default"])(["display-xlarge whitespace-normal inline"]))),
|
517
|
+
children: "How should we display products that contain multiple variants?"
|
518
|
+
}),
|
519
|
+
labelFor: variantsEnum[0],
|
520
|
+
state: getFieldState("variants"),
|
521
|
+
className: (0, _satellitePrefixer["default"])(_templateObject45 || (_templateObject45 = (0, _taggedTemplateLiteral2["default"])(["w-full shrink-0"]))),
|
522
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
523
|
+
className: (0, _satellitePrefixer["default"])(_templateObject46 || (_templateObject46 = (0, _taggedTemplateLiteral2["default"])(["mt-7"]))),
|
524
|
+
children: variantsOptions.map(function (option) {
|
525
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
526
|
+
htmlFor: option.value,
|
527
|
+
className: (0, _satellitePrefixer["default"])(_templateObject47 || (_templateObject47 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-3 p-6 rounded display-body transition-colors hover:bg-grey-100"]))),
|
528
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
529
|
+
className: (0, _satellitePrefixer["default"])(_templateObject48 || (_templateObject48 = (0, _taggedTemplateLiteral2["default"])(["flex items-center gap-2"]))),
|
530
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RadioGroup.RadioButton, _objectSpread(_objectSpread({
|
531
|
+
id: option.value,
|
532
|
+
"aria-labelledby": option.value,
|
533
|
+
required: true
|
534
|
+
}, formik.getFieldProps({
|
535
|
+
name: "variants",
|
536
|
+
value: option.value,
|
537
|
+
type: "radio"
|
538
|
+
})), {}, {
|
539
|
+
className: (0, _satellitePrefixer["default"])(_templateObject49 || (_templateObject49 = (0, _taggedTemplateLiteral2["default"])(["shrink-0"])))
|
540
|
+
})), option.title]
|
541
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
542
|
+
className: (0, _satellitePrefixer["default"])(_templateObject50 || (_templateObject50 = (0, _taggedTemplateLiteral2["default"])(["ml-6 typo-subdued"]))),
|
543
|
+
children: option.description
|
544
|
+
})]
|
545
|
+
}, option.value);
|
546
|
+
})
|
575
547
|
})
|
576
|
-
})
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
548
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Field.Field, {
|
549
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
550
|
+
className: (0, _satellitePrefixer["default"])(_templateObject51 || (_templateObject51 = (0, _taggedTemplateLiteral2["default"])(["display-xlarge whitespace-normal inline"]))),
|
551
|
+
children: "How would you like to show out-of-stock items?"
|
552
|
+
}),
|
553
|
+
labelFor: outOfStockEnum[0],
|
554
|
+
state: getFieldState("outOfStock"),
|
555
|
+
className: (0, _satellitePrefixer["default"])(_templateObject52 || (_templateObject52 = (0, _taggedTemplateLiteral2["default"])(["w-full shrink-0"]))),
|
556
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
557
|
+
className: (0, _satellitePrefixer["default"])(_templateObject53 || (_templateObject53 = (0, _taggedTemplateLiteral2["default"])(["mt-7"]))),
|
558
|
+
children: outOfStockOptions.map(function (option) {
|
559
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
560
|
+
htmlFor: option.value,
|
561
|
+
className: (0, _satellitePrefixer["default"])(_templateObject54 || (_templateObject54 = (0, _taggedTemplateLiteral2["default"])(["flex flex-col gap-3 p-6 rounded display-body transition-colors hover:bg-grey-100"]))),
|
562
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
563
|
+
className: (0, _satellitePrefixer["default"])(_templateObject55 || (_templateObject55 = (0, _taggedTemplateLiteral2["default"])(["flex items-center gap-2"]))),
|
564
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RadioGroup.RadioButton, _objectSpread(_objectSpread({
|
565
|
+
id: option.value,
|
566
|
+
"aria-labelledby": option.value,
|
567
|
+
required: true
|
568
|
+
}, formik.getFieldProps({
|
569
|
+
name: "outOfStock",
|
570
|
+
value: option.value,
|
571
|
+
type: "radio"
|
572
|
+
})), {}, {
|
573
|
+
className: (0, _satellitePrefixer["default"])(_templateObject56 || (_templateObject56 = (0, _taggedTemplateLiteral2["default"])(["shrink-0"])))
|
574
|
+
})), option.title]
|
575
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
576
|
+
className: (0, _satellitePrefixer["default"])(_templateObject57 || (_templateObject57 = (0, _taggedTemplateLiteral2["default"])(["ml-6 typo-subdued"]))),
|
577
|
+
children: option.description
|
578
|
+
})]
|
579
|
+
}, option.value);
|
580
|
+
})
|
607
581
|
})
|
582
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Field.Field, {
|
583
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
584
|
+
className: (0, _satellitePrefixer["default"])(_templateObject58 || (_templateObject58 = (0, _taggedTemplateLiteral2["default"])(["display-xlarge whitespace-normal inline"]))),
|
585
|
+
children: "Select how your customers can sort their search results"
|
586
|
+
}),
|
587
|
+
labelFor: sortingOptions[0],
|
588
|
+
state: getFieldState("sorting"),
|
589
|
+
className: (0, _satellitePrefixer["default"])(_templateObject59 || (_templateObject59 = (0, _taggedTemplateLiteral2["default"])(["w-full shrink-0"]))),
|
590
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
591
|
+
className: (0, _satellitePrefixer["default"])(_templateObject60 || (_templateObject60 = (0, _taggedTemplateLiteral2["default"])(["mt-4 typo-subdued"]))),
|
592
|
+
children: "Select the sort order options you'd like to show customers. You can change these later."
|
593
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
594
|
+
className: (0, _satellitePrefixer["default"])(_templateObject61 || (_templateObject61 = (0, _taggedTemplateLiteral2["default"])(["mt-7"]))),
|
595
|
+
children: sortingOptions.map(function (option) {
|
596
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
597
|
+
htmlFor: option,
|
598
|
+
className: (0, _satellitePrefixer["default"])(_templateObject62 || (_templateObject62 = (0, _taggedTemplateLiteral2["default"])(["flex gap-2 p-4 rounded display-body transition-colors hover:bg-grey-100"]))),
|
599
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, _objectSpread(_objectSpread({
|
600
|
+
id: option,
|
601
|
+
required: true,
|
602
|
+
checked: formik.values.sorting.includes(option)
|
603
|
+
}, formik.getFieldProps("sorting")), {}, {
|
604
|
+
onChange: function onChange() {
|
605
|
+
var fieldProps = formik.getFieldProps("sorting");
|
606
|
+
formik.setFieldValue("sorting", fieldProps.value.includes(option) ? fieldProps.value.filter(function (v) {
|
607
|
+
return v !== option;
|
608
|
+
}) : [].concat((0, _toConsumableArray2["default"])(fieldProps.value), [option]));
|
609
|
+
}
|
610
|
+
})), (0, _capitalize["default"])(option)]
|
611
|
+
}, option);
|
612
|
+
})
|
613
|
+
})]
|
614
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Field.Field, {
|
615
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
616
|
+
className: (0, _satellitePrefixer["default"])(_templateObject63 || (_templateObject63 = (0, _taggedTemplateLiteral2["default"])(["display-xlarge whitespace-normal inline"]))),
|
617
|
+
children: "Add filters to help narrow results"
|
618
|
+
}),
|
619
|
+
labelFor: filtersOptions[0],
|
620
|
+
state: getFieldState("filters"),
|
621
|
+
className: (0, _satellitePrefixer["default"])(_templateObject64 || (_templateObject64 = (0, _taggedTemplateLiteral2["default"])(["w-full shrink-0"]))),
|
622
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
623
|
+
className: (0, _satellitePrefixer["default"])(_templateObject65 || (_templateObject65 = (0, _taggedTemplateLiteral2["default"])(["mt-4 typo-subdued"]))),
|
624
|
+
children: ["Select the filter options customers can use to refine results.", /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), "You can edit these after setup."]
|
625
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
626
|
+
className: (0, _satellitePrefixer["default"])(_templateObject66 || (_templateObject66 = (0, _taggedTemplateLiteral2["default"])(["mt-7"]))),
|
627
|
+
children: filtersOptions.map(function (option) {
|
628
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
629
|
+
htmlFor: option,
|
630
|
+
className: (0, _satellitePrefixer["default"])(_templateObject67 || (_templateObject67 = (0, _taggedTemplateLiteral2["default"])(["flex gap-2 p-4 rounded display-body transition-colors hover:bg-grey-100"]))),
|
631
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, {
|
632
|
+
id: option,
|
633
|
+
required: true,
|
634
|
+
checked: formik.values.filters.includes(option),
|
635
|
+
onChange: function onChange() {
|
636
|
+
var fieldProps = formik.getFieldProps("filters");
|
637
|
+
formik.setFieldValue("filters", fieldProps.value.includes(option) ? fieldProps.value.filter(function (v) {
|
638
|
+
return v !== option;
|
639
|
+
}) : [].concat((0, _toConsumableArray2["default"])(fieldProps.value), [option]));
|
640
|
+
}
|
641
|
+
}), (0, _capitalize["default"])(option)]
|
642
|
+
}, option);
|
643
|
+
})
|
644
|
+
})]
|
608
645
|
})]
|
609
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
610
|
-
|
611
|
-
className: (0, _satellitePrefixer["default"])(_templateObject61 || (_templateObject61 = (0, _taggedTemplateLiteral2["default"])(["display-xlarge whitespace-normal inline"]))),
|
612
|
-
children: "Add filters to help narrow results"
|
613
|
-
}),
|
614
|
-
labelFor: filtersOptions[0],
|
615
|
-
state: getFieldState("filters"),
|
616
|
-
className: (0, _satellitePrefixer["default"])(_templateObject62 || (_templateObject62 = (0, _taggedTemplateLiteral2["default"])(["w-full shrink-0"]))),
|
646
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
647
|
+
className: (0, _satellitePrefixer["default"])(_templateObject68 || (_templateObject68 = (0, _taggedTemplateLiteral2["default"])(["w-full flex justify-between"]))),
|
617
648
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
618
|
-
className: (0, _satellitePrefixer["default"])(
|
619
|
-
children: [
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
649
|
+
className: (0, _satellitePrefixer["default"])(_templateObject69 || (_templateObject69 = (0, _taggedTemplateLiteral2["default"])(["flex gap-2"]))),
|
650
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
651
|
+
"aria-label": "Previous step",
|
652
|
+
disabled: page <= 1,
|
653
|
+
onClick: function onClick() {
|
654
|
+
return goToPreviousPage();
|
655
|
+
},
|
656
|
+
children: "Back"
|
657
|
+
}), page >= steps.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.FormSubmit, {
|
658
|
+
variant: "primary",
|
659
|
+
"aria-label": "Complete",
|
660
|
+
children: "Complete"
|
661
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
662
|
+
variant: "primary",
|
663
|
+
"aria-label": "Next step",
|
664
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
665
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
666
|
+
while (1) switch (_context2.prev = _context2.next) {
|
667
|
+
case 0:
|
668
|
+
_context2.next = 2;
|
669
|
+
return formik.validateField(steps[page - 1]);
|
670
|
+
case 2:
|
671
|
+
setNextPageClicked(true); // See workaround above
|
672
|
+
case 3:
|
673
|
+
case "end":
|
674
|
+
return _context2.stop();
|
635
675
|
}
|
636
|
-
}
|
637
|
-
},
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
644
|
-
className: (0, _satellitePrefixer["default"])(_templateObject67 || (_templateObject67 = (0, _taggedTemplateLiteral2["default"])(["flex gap-2"]))),
|
645
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
646
|
-
"aria-label": "Previous step",
|
647
|
-
disabled: page <= 1,
|
676
|
+
}, _callee2);
|
677
|
+
})),
|
678
|
+
children: "Next"
|
679
|
+
})]
|
680
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
681
|
+
variant: "subtle",
|
682
|
+
"aria-label": "Reset the form",
|
648
683
|
onClick: function onClick() {
|
649
|
-
|
684
|
+
formik.resetForm();
|
685
|
+
goToPage(1);
|
650
686
|
},
|
651
|
-
children: "
|
652
|
-
}), page >= steps.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.ExperimentalFormSubmit, {
|
653
|
-
variant: "primary",
|
654
|
-
"aria-label": "Complete",
|
655
|
-
children: "Complete"
|
656
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
657
|
-
variant: "primary",
|
658
|
-
"aria-label": "Next step",
|
659
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
660
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
661
|
-
while (1) switch (_context2.prev = _context2.next) {
|
662
|
-
case 0:
|
663
|
-
_context2.next = 2;
|
664
|
-
return formik.validateField(steps[page - 1]);
|
665
|
-
case 2:
|
666
|
-
setNextPageClicked(true); // See workaround above
|
667
|
-
case 3:
|
668
|
-
case "end":
|
669
|
-
return _context2.stop();
|
670
|
-
}
|
671
|
-
}, _callee2);
|
672
|
-
})),
|
673
|
-
children: "Next"
|
687
|
+
children: "Reset"
|
674
688
|
})]
|
675
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
goToPage
|
681
|
-
|
682
|
-
|
689
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
690
|
+
className: (0, _satellitePrefixer["default"])(_templateObject70 || (_templateObject70 = (0, _taggedTemplateLiteral2["default"])(["mt-8 mx-auto"]))),
|
691
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DotPagination.DotPagination, {
|
692
|
+
nbPages: steps.length,
|
693
|
+
currentPage: page,
|
694
|
+
onChange: goToPage,
|
695
|
+
size: "small"
|
696
|
+
})
|
683
697
|
})]
|
684
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("
|
685
|
-
className: (0, _satellitePrefixer["default"])(
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
onChange: goToPage,
|
690
|
-
size: "small"
|
691
|
-
})
|
698
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {
|
699
|
+
className: (0, _satellitePrefixer["default"])(_templateObject71 || (_templateObject71 = (0, _taggedTemplateLiteral2["default"])(["text-grey-500"])))
|
700
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
701
|
+
className: (0, _satellitePrefixer["default"])(_templateObject72 || (_templateObject72 = (0, _taggedTemplateLiteral2["default"])(["whitespace-pre display-code"]))),
|
702
|
+
children: JSON.stringify(formData, null, 2)
|
692
703
|
})]
|
693
|
-
})
|
694
|
-
className: (0, _satellitePrefixer["default"])(_templateObject69 || (_templateObject69 = (0, _taggedTemplateLiteral2["default"])(["text-grey-500"])))
|
695
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
696
|
-
className: (0, _satellitePrefixer["default"])(_templateObject70 || (_templateObject70 = (0, _taggedTemplateLiteral2["default"])(["whitespace-pre display-code"]))),
|
697
|
-
children: JSON.stringify(formData, null, 2)
|
698
|
-
})]
|
704
|
+
})
|
699
705
|
});
|
700
706
|
};
|