@rjsf/daisyui 6.0.1 → 6.1.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/chakra-ui.esm.js +29 -12
- package/dist/chakra-ui.esm.js.map +2 -2
- package/dist/chakra-ui.umd.js +27 -12
- package/dist/index.cjs +66 -49
- package/dist/index.cjs.map +3 -3
- package/lib/templates/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +2 -2
- package/lib/templates/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/templates/BaseInputTemplate/BaseInputTemplate.js +2 -2
- package/lib/templates/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/templates/FieldHelpTemplate/FieldHelpTemplate.d.ts +1 -1
- package/lib/templates/FieldHelpTemplate/FieldHelpTemplate.js +7 -2
- package/lib/templates/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/templates/FieldTemplate/FieldTemplate.js +1 -1
- package/lib/templates/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +5 -3
- package/lib/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/templates/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +5 -4
- package/src/templates/BaseInputTemplate/BaseInputTemplate.tsx +2 -2
- package/src/templates/FieldHelpTemplate/FieldHelpTemplate.tsx +8 -4
- package/src/templates/FieldTemplate/FieldTemplate.tsx +2 -0
- package/src/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +11 -5
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@ export default function ArrayFieldItemTemplate<
|
|
|
24
24
|
S extends StrictRJSFSchema = RJSFSchema,
|
|
25
25
|
F extends FormContextType = any,
|
|
26
26
|
>(props: ArrayFieldItemTemplateProps<T, S, F>) {
|
|
27
|
-
const { children, buttonsProps, hasToolbar, registry, uiSchema, index, totalItems } = props;
|
|
27
|
+
const { children, buttonsProps, displayLabel, hasToolbar, registry, uiSchema, index, totalItems } = props;
|
|
28
28
|
const uiOptions = getUiOptions<T, S, F>(uiSchema);
|
|
29
29
|
const ArrayFieldItemButtonsTemplate = getTemplate<'ArrayFieldItemButtonsTemplate', T, S, F>(
|
|
30
30
|
'ArrayFieldItemButtonsTemplate',
|
|
@@ -40,13 +40,14 @@ export default function ArrayFieldItemTemplate<
|
|
|
40
40
|
const zIndex = index === undefined ? '' : 'z-' + (10 - Math.min(index, 9));
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
|
-
<fieldset
|
|
43
|
+
<fieldset
|
|
44
|
+
className={`fieldset bg-base-100 border border-base-300 p-4 flex ${borderRadius} ${marginBottom} ${zIndex}`}
|
|
45
|
+
>
|
|
44
46
|
{/* Main content area */}
|
|
45
47
|
{children}
|
|
46
|
-
|
|
47
48
|
{/* Action buttons */}
|
|
48
49
|
{hasToolbar && (
|
|
49
|
-
<div className=
|
|
50
|
+
<div className={`flex justify-end ${displayLabel ? 'mt-5' : 'mt-1'}`}>
|
|
50
51
|
<ArrayFieldItemButtonsTemplate {...buttonsProps} />
|
|
51
52
|
</div>
|
|
52
53
|
)}
|
|
@@ -49,11 +49,11 @@ export default function BaseInputTemplate<
|
|
|
49
49
|
} = props;
|
|
50
50
|
|
|
51
51
|
const inputProps = getInputProps<T, S, F>(schema, type, options);
|
|
52
|
-
let className = 'input input-bordered';
|
|
52
|
+
let className = 'input input-bordered w-full';
|
|
53
53
|
let isMulti = multiple;
|
|
54
54
|
if (type === 'file') {
|
|
55
55
|
isMulti = schema.type === 'array' || Boolean(options.multiple);
|
|
56
|
-
className = 'file-input
|
|
56
|
+
className = 'file-input';
|
|
57
57
|
}
|
|
58
58
|
// Extract step, min, max, accept from inputProps
|
|
59
59
|
const { step, min, max, accept, ...rest } = inputProps;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { FieldHelpProps, StrictRJSFSchema, RJSFSchema, FormContextType } from '@rjsf/utils';
|
|
1
|
+
import { FieldHelpProps, StrictRJSFSchema, RJSFSchema, FormContextType, helpId } from '@rjsf/utils';
|
|
2
|
+
import { RichHelp } from '@rjsf/core';
|
|
2
3
|
|
|
3
4
|
/** The `FieldHelpTemplate` component renders help text for a specific form field
|
|
4
5
|
* with DaisyUI styling. It displays the help text in a subtle gray color and smaller size
|
|
@@ -14,10 +15,13 @@ export default function FieldHelpTemplate<
|
|
|
14
15
|
S extends StrictRJSFSchema = RJSFSchema,
|
|
15
16
|
F extends FormContextType = any,
|
|
16
17
|
>(props: FieldHelpProps<T, S, F>) {
|
|
17
|
-
const { help } = props;
|
|
18
|
+
const { help, uiSchema, registry, fieldPathId } = props;
|
|
19
|
+
if (!help) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
18
22
|
return (
|
|
19
|
-
<div className='rjsf-field-help-template text-gray-500 text-sm'>
|
|
20
|
-
<
|
|
23
|
+
<div id={helpId(fieldPathId)} className='rjsf-field-help-template text-gray-500 text-sm'>
|
|
24
|
+
<RichHelp help={help} registry={registry} uiSchema={uiSchema} />
|
|
21
25
|
</div>
|
|
22
26
|
);
|
|
23
27
|
}
|
|
@@ -68,6 +68,7 @@ export default function FieldTemplate<
|
|
|
68
68
|
disabled={divProps.disabled}
|
|
69
69
|
id={id}
|
|
70
70
|
label={label}
|
|
71
|
+
displayLabel={displayLabel}
|
|
71
72
|
onKeyRename={onKeyRename}
|
|
72
73
|
onKeyRenameBlur={onKeyRenameBlur}
|
|
73
74
|
onRemoveProperty={onRemoveProperty}
|
|
@@ -87,6 +88,7 @@ export default function FieldTemplate<
|
|
|
87
88
|
</label>
|
|
88
89
|
)}
|
|
89
90
|
{children}
|
|
91
|
+
{displayLabel && description ? description : null}
|
|
90
92
|
{errors}
|
|
91
93
|
{help}
|
|
92
94
|
</div>
|
|
@@ -24,6 +24,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
24
24
|
disabled,
|
|
25
25
|
id,
|
|
26
26
|
label,
|
|
27
|
+
displayLabel,
|
|
27
28
|
readonly,
|
|
28
29
|
required,
|
|
29
30
|
schema,
|
|
@@ -31,6 +32,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
31
32
|
onKeyRename,
|
|
32
33
|
onKeyRenameBlur,
|
|
33
34
|
onRemoveProperty,
|
|
35
|
+
rawDescription,
|
|
34
36
|
registry,
|
|
35
37
|
...rest
|
|
36
38
|
} = props;
|
|
@@ -40,18 +42,22 @@ export default function WrapIfAdditionalTemplate<
|
|
|
40
42
|
// Button templates are not overridden in the uiSchema
|
|
41
43
|
const { RemoveButton } = templates.ButtonTemplates;
|
|
42
44
|
const keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
45
|
+
const marginDesc = rawDescription ? 10 : 0;
|
|
46
|
+
const margin = displayLabel ? 32 + marginDesc : 10;
|
|
43
47
|
|
|
44
48
|
if (!additional) {
|
|
45
|
-
return <div className={classNames}>{children}</div>;
|
|
49
|
+
return <div className={`flex-grow ${classNames}`}>{children}</div>;
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
return (
|
|
49
53
|
<div className={`wrap-if-additional-template ${classNames}`} {...rest}>
|
|
50
54
|
<div className='flex items-baseline' style={{ justifyContent: 'space-between' }}>
|
|
51
55
|
<div>
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
56
|
+
{displayLabel && (
|
|
57
|
+
<label htmlFor={`${id}-key`} className='label'>
|
|
58
|
+
<span className='label-text'>{keyLabel}</span>
|
|
59
|
+
</label>
|
|
60
|
+
)}
|
|
55
61
|
<input
|
|
56
62
|
type='text'
|
|
57
63
|
className='input input-bordered'
|
|
@@ -62,7 +68,7 @@ export default function WrapIfAdditionalTemplate<
|
|
|
62
68
|
/>
|
|
63
69
|
</div>
|
|
64
70
|
{children}
|
|
65
|
-
<div className='flex self-
|
|
71
|
+
<div className='flex self-start' style={{ marginTop: `${margin}px` }}>
|
|
66
72
|
<RemoveButton
|
|
67
73
|
id={buttonId(id, 'remove')}
|
|
68
74
|
className='rjsf-object-property-remove'
|