datastake-daf 0.6.558 → 0.6.560

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.
@@ -40633,7 +40633,7 @@ function AuthForm(_ref) {
40633
40633
  initialValues: initialValues,
40634
40634
  onFinish: handleSubmit,
40635
40635
  children: [currentFields.map(renderField), formErrors ? renderErrors(formErrors, t) : null, isMultiStep && currentStep > 0 ? /*#__PURE__*/jsxRuntime.jsxs("div", {
40636
- className: "flex flex-column gap-2 mt-4",
40636
+ className: "flex flex-column gap-2",
40637
40637
  style: {
40638
40638
  width: '100%'
40639
40639
  },
@@ -40645,6 +40645,9 @@ function AuthForm(_ref) {
40645
40645
  const allFieldsFilled = checkRequiredFieldsFilled({}, form.getFieldsValue());
40646
40646
  return /*#__PURE__*/jsxRuntime.jsx("div", {
40647
40647
  className: "buttons",
40648
+ style: {
40649
+ marginTop: 0
40650
+ },
40648
40651
  children: /*#__PURE__*/jsxRuntime.jsx(BorderedButton, {
40649
40652
  type: "primary",
40650
40653
  htmlType: "submit",
@@ -40657,6 +40660,9 @@ function AuthForm(_ref) {
40657
40660
  }
40658
40661
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
40659
40662
  className: "buttons",
40663
+ style: {
40664
+ marginTop: 0
40665
+ },
40660
40666
  children: /*#__PURE__*/jsxRuntime.jsx(BorderedButton, {
40661
40667
  onClick: prev,
40662
40668
  block: true,
@@ -40666,6 +40672,9 @@ function AuthForm(_ref) {
40666
40672
  })]
40667
40673
  }) : /*#__PURE__*/jsxRuntime.jsx("div", {
40668
40674
  className: "buttons",
40675
+ style: {
40676
+ marginTop: 0
40677
+ },
40669
40678
  children: /*#__PURE__*/jsxRuntime.jsx(BorderedButton, {
40670
40679
  type: "primary",
40671
40680
  htmlType: "submit",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.558",
3
+ "version": "0.6.560",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -1,3 +1,5 @@
1
+ import React from "react";
2
+ import { Checkbox, DatePicker, Rate, Slider } from "antd";
1
3
  import ThemeLayout from "../ThemeLayout";
2
4
  import AuthForm from "./index";
3
5
 
@@ -24,7 +26,7 @@ export default {
24
26
  },
25
27
  fields: {
26
28
  control: "object",
27
- description: "Array of field objects for single-step forms. Each field should have name, label, type, etc.",
29
+ description: "Array of field objects for single-step forms. Each field should have name, label, type, etc. Supported types: 'input', 'email', 'number', 'password', 'textarea', 'select', 'custom'. For custom type, provide a 'component' prop with your custom React component.",
28
30
  table: {
29
31
  type: { summary: "array" },
30
32
  },
@@ -357,4 +359,63 @@ export const CustomValidation = {
357
359
  console.log("Validated values:", values);
358
360
  },
359
361
  },
362
+ };
363
+
364
+ export const WithCustomFields = {
365
+ name: "Form with Custom Field Components",
366
+ // Note: For custom fields with default values, always set those values in initialValues
367
+ // to ensure they are included in form submission even when not touched by the user
368
+ args: {
369
+ fields: [
370
+ {
371
+ name: "username",
372
+ label: "Username",
373
+ type: "input",
374
+ placeholder: "Enter username",
375
+ required: true,
376
+ },
377
+ {
378
+ name: "birthdate",
379
+ label: "Birth Date",
380
+ type: "custom",
381
+ required: true,
382
+ component: <DatePicker style={{ width: "100%" }} placeholder="Select your birth date" />,
383
+ },
384
+ {
385
+ name: "rating",
386
+ label: "Rate Your Experience",
387
+ type: "custom",
388
+ required: false,
389
+ component: <Rate allowHalf />,
390
+ },
391
+ {
392
+ name: "budget",
393
+ label: "Budget Range ($)",
394
+ type: "custom",
395
+ required: false,
396
+ component: <Slider range min={0} max={10000} />,
397
+ },
398
+ {
399
+ name: "bio",
400
+ label: "Bio",
401
+ type: "textarea",
402
+ placeholder: "Tell us about yourself",
403
+ required: false,
404
+ props: {
405
+ rows: 3,
406
+ },
407
+ },
408
+ ],
409
+ initialValues: {
410
+ rating: 3,
411
+ budget: [1000, 5000],
412
+ },
413
+ submitText: "Submit",
414
+ onSubmit: (values) => {
415
+ console.log("Form with custom fields values:", values);
416
+ },
417
+ executeRecaptcha: () => {
418
+ return "mock-recaptcha-token";
419
+ },
420
+ },
360
421
  };
@@ -157,14 +157,14 @@ function AuthForm ({
157
157
  ) : null}
158
158
 
159
159
  {isMultiStep && currentStep > 0 ? (
160
- <div className="flex flex-column gap-2 mt-4" style={{ width: '100%' }}>
160
+ <div className="flex flex-column gap-2" style={{ width: '100%' }}>
161
161
  <Form.Item noStyle shouldUpdate>
162
162
  {(form) => {
163
163
  const isLastStep = currentStep === steps?.length - 1;
164
164
  const allFieldsFilled = checkRequiredFieldsFilled({}, form.getFieldsValue());
165
165
 
166
166
  return (
167
- <div className="buttons">
167
+ <div className="buttons" style={{ marginTop: 0}}>
168
168
  <BorderedButton
169
169
  type="primary"
170
170
  htmlType="submit"
@@ -177,14 +177,14 @@ function AuthForm ({
177
177
  );
178
178
  }}
179
179
  </Form.Item>
180
- <div className="buttons">
180
+ <div className="buttons" style={{ marginTop: 0}}>
181
181
  <BorderedButton onClick={prev} block className="normal-br">
182
182
  {t("Back")}
183
183
  </BorderedButton>
184
184
  </div>
185
185
  </div>
186
186
  ) : (
187
- <div className="buttons">
187
+ <div className="buttons" style={{ marginTop: 0}}>
188
188
  <BorderedButton type="primary" htmlType="submit" block className="normal-br">
189
189
  {isMultiStep ? t("Next") : submitText}
190
190
  </BorderedButton>