@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.
Files changed (96) hide show
  1. package/dist/cjs/Actions/Accordion/Accordion.d.ts +142 -0
  2. package/dist/cjs/Actions/Accordion/Accordion.js +149 -0
  3. package/dist/cjs/Actions/Accordion/Accordion.tailwind.d.ts +5 -0
  4. package/dist/cjs/Actions/Accordion/Accordion.tailwind.js +44 -0
  5. package/dist/cjs/Actions/Button/Button.tailwind.js +0 -12
  6. package/dist/cjs/Actions/ToggleGroup/ToggleGroup.d.ts +2 -2
  7. package/dist/cjs/Actions/index.d.ts +2 -0
  8. package/dist/cjs/Actions/index.js +18 -0
  9. package/dist/cjs/Fields/Field/Field.js +2 -2
  10. package/dist/cjs/Fields/Form/Form.d.ts +12 -10
  11. package/dist/cjs/Fields/Form/Form.js +50 -38
  12. package/dist/cjs/Fields/Form/FormContext.d.ts +6 -6
  13. package/dist/cjs/Fields/Form/FormContext.js +2 -2
  14. package/dist/cjs/Fields/Form/index.d.ts +4 -3
  15. package/dist/cjs/Fields/Form/index.js +31 -21
  16. package/dist/cjs/Fields/Form/stories/AsynchronousValidation.js +142 -127
  17. package/dist/cjs/Fields/Form/stories/Complex.js +648 -642
  18. package/dist/cjs/Fields/Form/stories/DependentFieldsValidation.js +127 -121
  19. package/dist/cjs/Fields/Form/stories/DirtyFields.js +195 -189
  20. package/dist/cjs/Fields/Form/stories/DynamicFieldsValidation.js +251 -245
  21. package/dist/cjs/Fields/Form/stories/ExtraErrors.js +289 -0
  22. package/dist/cjs/Fields/Form/stories/FieldArrays.js +180 -174
  23. package/dist/cjs/Fields/Form/stories/JSONForms.js +59 -56
  24. package/dist/cjs/Fields/Form/stories/MultiStep.js +706 -0
  25. package/dist/cjs/Fields/Form/stories/ValidationStrategies.js +243 -237
  26. package/dist/cjs/Fields/Form/useForm.d.ts +1 -1
  27. package/dist/cjs/Fields/Form/useForm.js +3 -3
  28. package/dist/cjs/Helpers/utilities/focusable.tailwind.js +1 -1
  29. package/dist/cjs/Icons/index.d.ts +1 -1
  30. package/dist/cjs/Icons/index.js +6 -0
  31. package/dist/cjs/Indicators/Skeleton/Skeleton.d.ts +7 -0
  32. package/dist/cjs/Indicators/Skeleton/Skeleton.js +12 -5
  33. package/dist/cjs/Indicators/index.d.ts +1 -0
  34. package/dist/cjs/Indicators/index.js +11 -0
  35. package/dist/cjs/Layout/Sidebar/SidebarButtonLink.js +1 -1
  36. package/dist/cjs/Layout/Sidebar/SidebarLink.js +2 -2
  37. package/dist/cjs/Layout/Sidebar/SidebarLinksGroup/SidebarGroupLink.js +1 -1
  38. package/dist/cjs/Layout/Sidebar/SidebarLinksGroup/SidebarLinksGroup.js +4 -5
  39. package/dist/cjs/Layout/Tables/DataTable/DataTable.d.ts +3 -1
  40. package/dist/cjs/Layout/Tables/DataTable/DataTable.js +3 -0
  41. package/dist/cjs/Layout/Tables/Table/Table.d.ts +2 -0
  42. package/dist/cjs/Layout/Tables/Table/Table.js +4 -2
  43. package/dist/cjs/Layout/Tables/Table/Table.tailwind.js +6 -1
  44. package/dist/cjs/Overlay/MenuButton/components/items/LinkItem.d.ts +1 -1
  45. package/dist/cjs/Overlay/MenuButton/components/items/ToggleItem.d.ts +1 -1
  46. package/dist/cjs/styles/tailwind.config.js +1 -1
  47. package/dist/cjs/utils/isCssPropertySupported.d.ts +1 -1
  48. package/dist/esm/Actions/Accordion/Accordion.d.ts +142 -0
  49. package/dist/esm/Actions/Accordion/Accordion.js +139 -0
  50. package/dist/esm/Actions/Accordion/Accordion.tailwind.d.ts +5 -0
  51. package/dist/esm/Actions/Accordion/Accordion.tailwind.js +43 -0
  52. package/dist/esm/Actions/Button/Button.tailwind.js +0 -12
  53. package/dist/esm/Actions/ToggleGroup/ToggleGroup.d.ts +2 -2
  54. package/dist/esm/Actions/index.d.ts +2 -0
  55. package/dist/esm/Actions/index.js +2 -2
  56. package/dist/esm/Fields/Field/Field.js +3 -3
  57. package/dist/esm/Fields/Form/Form.d.ts +12 -10
  58. package/dist/esm/Fields/Form/Form.js +52 -40
  59. package/dist/esm/Fields/Form/FormContext.d.ts +6 -6
  60. package/dist/esm/Fields/Form/FormContext.js +1 -1
  61. package/dist/esm/Fields/Form/index.d.ts +4 -3
  62. package/dist/esm/Fields/Form/index.js +2 -3
  63. package/dist/esm/Fields/Form/stories/AsynchronousValidation.js +143 -128
  64. package/dist/esm/Fields/Form/stories/Complex.js +649 -643
  65. package/dist/esm/Fields/Form/stories/DependentFieldsValidation.js +128 -122
  66. package/dist/esm/Fields/Form/stories/DirtyFields.js +196 -190
  67. package/dist/esm/Fields/Form/stories/DynamicFieldsValidation.js +252 -246
  68. package/dist/esm/Fields/Form/stories/ExtraErrors.js +279 -0
  69. package/dist/esm/Fields/Form/stories/FieldArrays.js +181 -175
  70. package/dist/esm/Fields/Form/stories/JSONForms.js +60 -57
  71. package/dist/esm/Fields/Form/stories/MultiStep.js +697 -0
  72. package/dist/esm/Fields/Form/stories/ValidationStrategies.js +244 -238
  73. package/dist/esm/Fields/Form/useForm.d.ts +1 -1
  74. package/dist/esm/Fields/Form/useForm.js +3 -3
  75. package/dist/esm/Helpers/utilities/focusable.tailwind.js +1 -1
  76. package/dist/esm/Icons/index.d.ts +1 -1
  77. package/dist/esm/Icons/index.js +1 -1
  78. package/dist/esm/Indicators/Skeleton/Skeleton.d.ts +7 -0
  79. package/dist/esm/Indicators/Skeleton/Skeleton.js +12 -5
  80. package/dist/esm/Indicators/index.d.ts +1 -0
  81. package/dist/esm/Indicators/index.js +2 -1
  82. package/dist/esm/Layout/Sidebar/SidebarButtonLink.js +1 -1
  83. package/dist/esm/Layout/Sidebar/SidebarLink.js +2 -2
  84. package/dist/esm/Layout/Sidebar/SidebarLinksGroup/SidebarGroupLink.js +1 -1
  85. package/dist/esm/Layout/Sidebar/SidebarLinksGroup/SidebarLinksGroup.js +4 -5
  86. package/dist/esm/Layout/Tables/DataTable/DataTable.d.ts +3 -1
  87. package/dist/esm/Layout/Tables/DataTable/DataTable.js +3 -0
  88. package/dist/esm/Layout/Tables/Table/Table.d.ts +2 -0
  89. package/dist/esm/Layout/Tables/Table/Table.js +4 -2
  90. package/dist/esm/Layout/Tables/Table/Table.tailwind.js +6 -1
  91. package/dist/esm/Overlay/MenuButton/components/items/LinkItem.d.ts +1 -1
  92. package/dist/esm/Overlay/MenuButton/components/items/ToggleItem.d.ts +1 -1
  93. package/dist/esm/styles/tailwind.config.js +1 -1
  94. package/dist/esm/utils/isCssPropertySupported.d.ts +1 -1
  95. package/dist/satellite.min.css +1 -1
  96. package/package.json +7 -1
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
4
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16;
5
5
  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; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  import { zodResolver } from "@hookform/resolvers/zod";
@@ -13,7 +13,7 @@ import { z } from "zod";
13
13
  import stl from "../../../styles/helpers/satellitePrefixer";
14
14
  import { Field } from "../../Field";
15
15
  import { Input } from "../../Input";
16
- import { ExperimentalForm, ExperimentalFormErrorMessage, ExperimentalFormReset, ExperimentalFormSubmit } from "../Form";
16
+ import { Form, FormErrorMessage, FormReset, FormSubmit } from "../Form";
17
17
  import { useFormikAutoFocusOnError } from "./utils/useFormikAutoFocusOnError";
18
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
19
  var initialFormData = {
@@ -66,74 +66,77 @@ export var RHFDependentFieldsValidationComponent = function RHFDependentFieldsVa
66
66
  };
67
67
  }
68
68
  };
69
- return /*#__PURE__*/_jsxs("div", {
70
- className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["flex flex-col gap-8 w-3/5"]))),
71
- children: [/*#__PURE__*/_jsxs(ExperimentalForm, {
72
- onSubmit: handleSubmit(function (data) {
73
- return setFormData(data);
74
- }),
75
- onReset: function onReset() {
76
- return setFormData(initialFormData);
77
- },
78
- className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flex flex-col items-start gap-4 min-w-72"]))),
79
- children: [/*#__PURE__*/_jsx(ExperimentalFormErrorMessage, {}), /*#__PURE__*/_jsx(Controller, {
80
- name: "password",
81
- control: control,
82
- render: function render(_ref) {
83
- var field = _ref.field;
84
- return /*#__PURE__*/_jsx(Field, {
85
- label: "Password",
86
- labelFor: "password",
87
- description: "Please enter your password",
88
- state: getFieldState("password"),
89
- className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["w-full"]))),
90
- children: /*#__PURE__*/_jsx(Input, _objectSpread({
91
- id: "password",
92
- placeholder: "Password",
93
- type: "password",
94
- required: true
95
- }, field))
96
- });
97
- }
98
- }), /*#__PURE__*/_jsx(Controller, {
99
- name: "confirmPassword",
100
- control: control,
101
- render: function render(_ref2) {
102
- var field = _ref2.field;
103
- return /*#__PURE__*/_jsx(Field, {
104
- label: "Confirm Password",
105
- labelFor: "confirmPassword",
106
- description: "Please confirm your password",
107
- state: getFieldState("confirmPassword"),
108
- className: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["w-full"]))),
109
- children: /*#__PURE__*/_jsx(Input, _objectSpread({
110
- id: "confirmPassword",
111
- placeholder: "Confirm password",
112
- type: "password",
113
- required: true
114
- }, field))
115
- });
116
- }
117
- }), /*#__PURE__*/_jsxs("div", {
118
- className: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["flex gap-2"]))),
119
- children: [/*#__PURE__*/_jsx(ExperimentalFormSubmit, {
120
- variant: "primary",
121
- "aria-label": "Save the form",
122
- children: "Save"
123
- }), /*#__PURE__*/_jsx(ExperimentalFormReset, {
124
- "aria-label": "Reset the form",
125
- onClick: function onClick() {
126
- return reset();
127
- },
128
- children: "Reset"
69
+ return /*#__PURE__*/_jsx("div", {
70
+ className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["@container w-full flex justify-center"]))),
71
+ children: /*#__PURE__*/_jsxs("div", {
72
+ className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flex flex-col gap-8 w-full @lg:w-1/2"]))),
73
+ children: [/*#__PURE__*/_jsxs(Form, {
74
+ onSubmit: handleSubmit(function (data) {
75
+ return setFormData(data);
76
+ }),
77
+ onReset: function onReset() {
78
+ return setFormData(initialFormData);
79
+ },
80
+ className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["flex flex-col items-start gap-6 min-w-72"]))),
81
+ children: [/*#__PURE__*/_jsx(FormErrorMessage, {}), /*#__PURE__*/_jsx(Controller, {
82
+ name: "password",
83
+ control: control,
84
+ render: function render(_ref) {
85
+ var field = _ref.field;
86
+ return /*#__PURE__*/_jsx(Field, {
87
+ label: "Password",
88
+ labelFor: "password",
89
+ description: "Please enter your password",
90
+ state: getFieldState("password"),
91
+ className: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["w-full"]))),
92
+ children: /*#__PURE__*/_jsx(Input, _objectSpread({
93
+ id: "password",
94
+ placeholder: "Password",
95
+ type: "password",
96
+ required: true
97
+ }, field))
98
+ });
99
+ }
100
+ }), /*#__PURE__*/_jsx(Controller, {
101
+ name: "confirmPassword",
102
+ control: control,
103
+ render: function render(_ref2) {
104
+ var field = _ref2.field;
105
+ return /*#__PURE__*/_jsx(Field, {
106
+ label: "Confirm Password",
107
+ labelFor: "confirmPassword",
108
+ description: "Please confirm your password",
109
+ state: getFieldState("confirmPassword"),
110
+ className: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["w-full"]))),
111
+ children: /*#__PURE__*/_jsx(Input, _objectSpread({
112
+ id: "confirmPassword",
113
+ placeholder: "Confirm password",
114
+ type: "password",
115
+ required: true
116
+ }, field))
117
+ });
118
+ }
119
+ }), /*#__PURE__*/_jsxs("div", {
120
+ className: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["flex gap-2"]))),
121
+ children: [/*#__PURE__*/_jsx(FormSubmit, {
122
+ variant: "primary",
123
+ "aria-label": "Save the form",
124
+ children: "Save"
125
+ }), /*#__PURE__*/_jsx(FormReset, {
126
+ "aria-label": "Reset the form",
127
+ onClick: function onClick() {
128
+ return reset();
129
+ },
130
+ children: "Reset"
131
+ })]
129
132
  })]
133
+ }), /*#__PURE__*/_jsx("hr", {
134
+ className: stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["text-grey-500"])))
135
+ }), /*#__PURE__*/_jsx("code", {
136
+ className: stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["whitespace-pre display-code"]))),
137
+ children: JSON.stringify(formData, null, 2)
130
138
  })]
131
- }), /*#__PURE__*/_jsx("hr", {
132
- className: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["text-grey-500"])))
133
- }), /*#__PURE__*/_jsx("code", {
134
- className: stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["whitespace-pre"]))),
135
- children: JSON.stringify(formData, null, 2)
136
- })]
139
+ })
137
140
  });
138
141
  };
139
142
  var yupSchema = yup.object({
@@ -179,61 +182,64 @@ export var FormikDependentFieldsValidationComponent = function FormikDependentFi
179
182
  }
180
183
  };
181
184
  useFormikAutoFocusOnError(formik);
182
- return /*#__PURE__*/_jsxs("div", {
183
- className: stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["flex flex-col gap-8 w-3/5"]))),
184
- children: [/*#__PURE__*/_jsxs(ExperimentalForm, {
185
- onSubmit: function onSubmit(e) {
186
- setRevalidationEnabled(true);
187
- formik.handleSubmit(e);
188
- },
189
- onReset: function onReset(e) {
190
- setRevalidationEnabled(false);
191
- formik.handleReset(e);
192
- },
193
- className: stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["flex flex-col items-start gap-4 min-w-72"]))),
194
- children: [/*#__PURE__*/_jsx(ExperimentalFormErrorMessage, {}), /*#__PURE__*/_jsx(Field, {
195
- label: "Password",
196
- labelFor: "password",
197
- description: "Please enter your password",
198
- state: getFieldState("password"),
199
- className: stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["w-full"]))),
200
- children: /*#__PURE__*/_jsx(Input, _objectSpread({
201
- id: "password",
202
- placeholder: "Password",
203
- type: "password",
204
- required: true
205
- }, formik.getFieldProps("password")))
206
- }), /*#__PURE__*/_jsx(Field, {
207
- label: "Confirm Password",
208
- labelFor: "confirmPassword",
209
- description: "Please confirm your password",
210
- state: getFieldState("confirmPassword"),
211
- className: stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["w-full"]))),
212
- children: /*#__PURE__*/_jsx(Input, _objectSpread({
213
- id: "confirmPassword",
214
- placeholder: "Confirm password",
215
- type: "password",
216
- required: true
217
- }, formik.getFieldProps("confirmPassword")))
218
- }), /*#__PURE__*/_jsxs("div", {
219
- className: stl(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["flex gap-2"]))),
220
- children: [/*#__PURE__*/_jsx(ExperimentalFormSubmit, {
221
- variant: "primary",
222
- "aria-label": "Save the form",
223
- children: "Save"
224
- }), /*#__PURE__*/_jsx(ExperimentalFormReset, {
225
- "aria-label": "Reset the form",
226
- onClick: function onClick() {
227
- return formik.resetForm();
228
- },
229
- children: "Reset"
185
+ return /*#__PURE__*/_jsx("div", {
186
+ className: stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["@container w-full flex justify-center"]))),
187
+ children: /*#__PURE__*/_jsxs("div", {
188
+ className: stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["flex flex-col gap-8 w-full @lg:w-1/2"]))),
189
+ children: [/*#__PURE__*/_jsxs(Form, {
190
+ onSubmit: function onSubmit(e) {
191
+ setRevalidationEnabled(true);
192
+ formik.handleSubmit(e);
193
+ },
194
+ onReset: function onReset(e) {
195
+ setRevalidationEnabled(false);
196
+ formik.handleReset(e);
197
+ },
198
+ className: stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["flex flex-col items-start gap-6 min-w-72"]))),
199
+ children: [/*#__PURE__*/_jsx(FormErrorMessage, {}), /*#__PURE__*/_jsx(Field, {
200
+ label: "Password",
201
+ labelFor: "password",
202
+ description: "Please enter your password",
203
+ state: getFieldState("password"),
204
+ className: stl(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["w-full"]))),
205
+ children: /*#__PURE__*/_jsx(Input, _objectSpread({
206
+ id: "password",
207
+ placeholder: "Password",
208
+ type: "password",
209
+ required: true
210
+ }, formik.getFieldProps("password")))
211
+ }), /*#__PURE__*/_jsx(Field, {
212
+ label: "Confirm Password",
213
+ labelFor: "confirmPassword",
214
+ description: "Please confirm your password",
215
+ state: getFieldState("confirmPassword"),
216
+ className: stl(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["w-full"]))),
217
+ children: /*#__PURE__*/_jsx(Input, _objectSpread({
218
+ id: "confirmPassword",
219
+ placeholder: "Confirm password",
220
+ type: "password",
221
+ required: true
222
+ }, formik.getFieldProps("confirmPassword")))
223
+ }), /*#__PURE__*/_jsxs("div", {
224
+ className: stl(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["flex gap-2"]))),
225
+ children: [/*#__PURE__*/_jsx(FormSubmit, {
226
+ variant: "primary",
227
+ "aria-label": "Save the form",
228
+ children: "Save"
229
+ }), /*#__PURE__*/_jsx(FormReset, {
230
+ "aria-label": "Reset the form",
231
+ onClick: function onClick() {
232
+ return formik.resetForm();
233
+ },
234
+ children: "Reset"
235
+ })]
230
236
  })]
237
+ }), /*#__PURE__*/_jsx("hr", {
238
+ className: stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["text-grey-500"])))
239
+ }), /*#__PURE__*/_jsx("code", {
240
+ className: stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["whitespace-pre display-code"]))),
241
+ children: JSON.stringify(formData, null, 2)
231
242
  })]
232
- }), /*#__PURE__*/_jsx("hr", {
233
- className: stl(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["text-grey-500"])))
234
- }), /*#__PURE__*/_jsx("code", {
235
- className: stl(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["whitespace-pre"]))),
236
- children: JSON.stringify(formData, null, 2)
237
- })]
243
+ })
238
244
  });
239
245
  };