@admin-layout/tailwind-ui 12.2.4-alpha.97 → 12.2.5-alpha.10
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/lib/components/ErrorHandlers/ApplicationErrorHandler.d.ts.map +1 -1
- package/lib/components/ErrorHandlers/ApplicationErrorHandler.js +5 -1
- package/lib/components/ErrorHandlers/ApplicationErrorHandler.js.map +1 -1
- package/lib/components/ErrorHandlers/RemixErrorBoundary.d.ts +11 -0
- package/lib/components/ErrorHandlers/RemixErrorBoundary.d.ts.map +1 -1
- package/lib/components/ErrorHandlers/RemixErrorBoundary.js +134 -3
- package/lib/components/ErrorHandlers/RemixErrorBoundary.js.map +1 -1
- package/lib/components/ErrorHandlers/SPAErrorBoundary.d.ts.map +1 -1
- package/lib/components/ErrorHandlers/SPAErrorBoundary.js +5 -1
- package/lib/components/ErrorHandlers/SPAErrorBoundary.js.map +1 -1
- package/lib/components/ErrorHandlers/__tests__/RemixErrorBoundary.test.d.ts +2 -0
- package/lib/components/ErrorHandlers/__tests__/RemixErrorBoundary.test.d.ts.map +1 -0
- package/lib/components/ErrorPages/403.d.ts.map +1 -1
- package/lib/components/ErrorPages/403.js +3 -2
- package/lib/components/ErrorPages/403.js.map +1 -1
- package/lib/components/ErrorPages/404.d.ts.map +1 -1
- package/lib/components/ErrorPages/404.js +3 -2
- package/lib/components/ErrorPages/404.js.map +1 -1
- package/lib/components/ErrorPages/500.d.ts.map +1 -1
- package/lib/components/ErrorPages/500.js +3 -2
- package/lib/components/ErrorPages/500.js.map +1 -1
- package/lib/components/ErrorPages/useErrorAsset.d.ts +11 -0
- package/lib/components/ErrorPages/useErrorAsset.d.ts.map +1 -0
- package/lib/components/ErrorPages/useErrorAsset.js +24 -0
- package/lib/components/ErrorPages/useErrorAsset.js.map +1 -0
- package/lib/components/InputToolBar/InputToolBar.d.ts.map +1 -1
- package/lib/components/InputToolBar/InputToolBar.js +73 -31
- package/lib/components/InputToolBar/InputToolBar.js.map +1 -1
- package/lib/components/InputToolBar/__tests__/RightOverflowMenu.test.d.ts +8 -0
- package/lib/components/InputToolBar/__tests__/RightOverflowMenu.test.d.ts.map +1 -0
- package/lib/components/InputToolBar/types.d.ts +2 -0
- package/lib/components/InputToolBar/types.d.ts.map +1 -1
- package/lib/components/PageContainer/PageContainer.d.ts +9 -0
- package/lib/components/PageContainer/PageContainer.d.ts.map +1 -1
- package/lib/components/PageContainer/PageContainer.js +24 -8
- package/lib/components/PageContainer/PageContainer.js.map +1 -1
- package/lib/components/PageContainer/__tests__/PageContainer.test.d.ts +7 -0
- package/lib/components/PageContainer/__tests__/PageContainer.test.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewAsyncDropdown.js +111 -0
- package/lib/components/RJSFPreview/PreviewAsyncDropdown.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewCheckboxWidget.js +95 -0
- package/lib/components/RJSFPreview/PreviewCheckboxWidget.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewCustomFieldTemplate.js +235 -0
- package/lib/components/RJSFPreview/PreviewCustomFieldTemplate.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewDateWidget.js +178 -0
- package/lib/components/RJSFPreview/PreviewDateWidget.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewDialog.js +21 -0
- package/lib/components/RJSFPreview/PreviewDialog.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewDropdownWidget.js +66 -0
- package/lib/components/RJSFPreview/PreviewDropdownWidget.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewFieldTemplate.js +69 -0
- package/lib/components/RJSFPreview/PreviewFieldTemplate.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewFileUploadWidget.js +113 -0
- package/lib/components/RJSFPreview/PreviewFileUploadWidget.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewFormRenderer.js +195 -0
- package/lib/components/RJSFPreview/PreviewFormRenderer.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewImageUploadWidget.js +104 -0
- package/lib/components/RJSFPreview/PreviewImageUploadWidget.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewInputWidget.js +70 -0
- package/lib/components/RJSFPreview/PreviewInputWidget.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewObjectFieldTemplate.js +33 -0
- package/lib/components/RJSFPreview/PreviewObjectFieldTemplate.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewRadioWidget.js +55 -0
- package/lib/components/RJSFPreview/PreviewRadioWidget.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewStepper.js +40 -0
- package/lib/components/RJSFPreview/PreviewStepper.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewSwitchWidget.js +75 -0
- package/lib/components/RJSFPreview/PreviewSwitchWidget.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewTab.js +358 -0
- package/lib/components/RJSFPreview/PreviewTab.js.map +1 -0
- package/lib/components/RJSFPreview/PreviewTextareaWidget.js +45 -0
- package/lib/components/RJSFPreview/PreviewTextareaWidget.js.map +1 -0
- package/lib/components/RJSFPreview/generateSchemaWithInputs.js +134 -0
- package/lib/components/RJSFPreview/generateSchemaWithInputs.js.map +1 -0
- package/lib/components/RJSFPreview/index.d.ts +34 -0
- package/lib/components/RJSFPreview/index.d.ts.map +1 -1
- package/lib/components/RJSFPreview/index.js +1 -0
- package/lib/components/RJSFPreview/index.js.map +1 -0
- package/lib/components/ThemeProvider/ThemeProvider.js +1 -1
- package/lib/components/index.d.ts.map +1 -1
- package/lib/hooks/__tests__/useMediaQuery.test.d.ts +2 -0
- package/lib/hooks/__tests__/useMediaQuery.test.d.ts.map +1 -0
- package/lib/hooks/useMediaQuery.d.ts +9 -2
- package/lib/hooks/useMediaQuery.d.ts.map +1 -1
- package/lib/hooks/useMediaQuery.js +39 -31
- package/lib/hooks/useMediaQuery.js.map +1 -1
- package/lib/hooks/useWindowSize.d.ts +4 -0
- package/lib/hooks/useWindowSize.d.ts.map +1 -1
- package/lib/hooks/useWindowSize.js +13 -19
- package/lib/hooks/useWindowSize.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/shardui/chart.d.ts +1 -1
- package/lib/shardui/resizable.d.ts +1 -1
- package/package.json +20 -5
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {jsx,jsxs}from'react/jsx-runtime';import {useState,useCallback}from'react';import {useDropzone}from'react-dropzone';import {BsUpload}from'@react-icons/all-files/bs/BsUpload.js';const PreviewImageUploadWidget = ({
|
|
2
|
+
id,
|
|
3
|
+
value,
|
|
4
|
+
required,
|
|
5
|
+
disabled,
|
|
6
|
+
readonly,
|
|
7
|
+
onChange,
|
|
8
|
+
onBlur,
|
|
9
|
+
onFocus,
|
|
10
|
+
autofocus,
|
|
11
|
+
options,
|
|
12
|
+
schema,
|
|
13
|
+
type,
|
|
14
|
+
label,
|
|
15
|
+
placeholder,
|
|
16
|
+
rawErrors
|
|
17
|
+
}) => {
|
|
18
|
+
const [previewUrl, setPreviewUrl] = useState(value || '');
|
|
19
|
+
const [fileName, setFileName] = useState('');
|
|
20
|
+
const handleDrop = useCallback(acceptedFiles => {
|
|
21
|
+
const file = acceptedFiles[0];
|
|
22
|
+
if (file) {
|
|
23
|
+
setFileName(file.name);
|
|
24
|
+
const reader = new FileReader();
|
|
25
|
+
reader.onload = e => {
|
|
26
|
+
const dataUrl = e.target?.result;
|
|
27
|
+
setPreviewUrl(dataUrl);
|
|
28
|
+
onChange(dataUrl);
|
|
29
|
+
};
|
|
30
|
+
reader.readAsDataURL(file);
|
|
31
|
+
}
|
|
32
|
+
}, [onChange]);
|
|
33
|
+
const handleRemoveImage = () => {
|
|
34
|
+
setPreviewUrl('');
|
|
35
|
+
setFileName('');
|
|
36
|
+
onChange('');
|
|
37
|
+
};
|
|
38
|
+
const {
|
|
39
|
+
getRootProps,
|
|
40
|
+
getInputProps,
|
|
41
|
+
isDragActive
|
|
42
|
+
} = useDropzone({
|
|
43
|
+
onDrop: handleDrop,
|
|
44
|
+
accept: {
|
|
45
|
+
'image/*': []
|
|
46
|
+
},
|
|
47
|
+
multiple: false,
|
|
48
|
+
disabled: disabled || readonly,
|
|
49
|
+
autoFocus: Boolean(autofocus)
|
|
50
|
+
});
|
|
51
|
+
return jsx("div", {
|
|
52
|
+
className: "bg-white rounded-lg ",
|
|
53
|
+
children: jsxs("div", {
|
|
54
|
+
className: "space-y-3",
|
|
55
|
+
children: [label && jsxs("label", {
|
|
56
|
+
htmlFor: id,
|
|
57
|
+
className: "block text-base font-semibold text-gray-800 mb-3",
|
|
58
|
+
children: [label, required && jsx("span", {
|
|
59
|
+
className: "text-red-500 ml-1",
|
|
60
|
+
children: "*"
|
|
61
|
+
})]
|
|
62
|
+
}), !previewUrl && jsxs("div", {
|
|
63
|
+
...getRootProps({
|
|
64
|
+
className: `flex items-center justify-start border-2 border-dashed rounded-md px-4 py-6 cursor-pointer transition-colors text-xs ${isDragActive ? 'border-blue-500 bg-blue-50' : rawErrors && rawErrors.length > 0 ? 'border-red-500 bg-red-50 hover:bg-red-100' : 'border-gray-300 bg-gray-100 hover:bg-gray-200'} ${disabled || readonly ? 'opacity-50 cursor-not-allowed' : ''}`,
|
|
65
|
+
tabIndex: 0,
|
|
66
|
+
onBlur: () => onBlur(id, value),
|
|
67
|
+
onFocus: () => onFocus(id, value)
|
|
68
|
+
}),
|
|
69
|
+
children: [jsx("input", {
|
|
70
|
+
...getInputProps(),
|
|
71
|
+
id: id
|
|
72
|
+
}), jsx(BsUpload, {
|
|
73
|
+
className: "w-4 h-4 mr-2 text-gray-500"
|
|
74
|
+
}), jsx("span", {
|
|
75
|
+
children: isDragActive ? 'Drop the image here...' : placeholder || 'Drag & drop or click to upload image...'
|
|
76
|
+
})]
|
|
77
|
+
}), previewUrl && jsxs("div", {
|
|
78
|
+
className: "space-y-2",
|
|
79
|
+
children: [jsxs("div", {
|
|
80
|
+
className: "relative inline-block",
|
|
81
|
+
children: [jsx("img", {
|
|
82
|
+
src: previewUrl,
|
|
83
|
+
alt: fileName || 'Uploaded image',
|
|
84
|
+
className: "max-w-48 max-h-32 rounded-lg border border-gray-200"
|
|
85
|
+
}), jsx("button", {
|
|
86
|
+
type: "button",
|
|
87
|
+
onClick: handleRemoveImage,
|
|
88
|
+
disabled: disabled || readonly,
|
|
89
|
+
className: "absolute -top-2 -right-2 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center hover:bg-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 transition-colors text-sm",
|
|
90
|
+
children: "\u00D7"
|
|
91
|
+
})]
|
|
92
|
+
}), jsx("div", {
|
|
93
|
+
className: "text-sm text-gray-600",
|
|
94
|
+
children: fileName && jsxs("span", {
|
|
95
|
+
children: ["File: ", fileName]
|
|
96
|
+
})
|
|
97
|
+
})]
|
|
98
|
+
}), rawErrors && rawErrors.length > 0 && jsx("p", {
|
|
99
|
+
className: "mt-1 text-sm text-red-500",
|
|
100
|
+
children: rawErrors[0]
|
|
101
|
+
})]
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
};export{PreviewImageUploadWidget};//# sourceMappingURL=PreviewImageUploadWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewImageUploadWidget.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {jsx,jsxs}from'react/jsx-runtime';const PreviewInputWidget = ({
|
|
2
|
+
id,
|
|
3
|
+
value,
|
|
4
|
+
required,
|
|
5
|
+
disabled,
|
|
6
|
+
readonly,
|
|
7
|
+
onChange,
|
|
8
|
+
onBlur,
|
|
9
|
+
onFocus,
|
|
10
|
+
autofocus,
|
|
11
|
+
options,
|
|
12
|
+
schema,
|
|
13
|
+
type,
|
|
14
|
+
label,
|
|
15
|
+
placeholder,
|
|
16
|
+
rawErrors
|
|
17
|
+
}) => {
|
|
18
|
+
const handleChange = event => {
|
|
19
|
+
const newValue = event.target.type === 'checkbox' ? event.target.checked : event.target.value;
|
|
20
|
+
onChange(newValue);
|
|
21
|
+
};
|
|
22
|
+
const handleBlur = event => {
|
|
23
|
+
onBlur(id, event.target.value);
|
|
24
|
+
};
|
|
25
|
+
const handleFocus = event => {
|
|
26
|
+
onFocus(id, event.target.value);
|
|
27
|
+
};
|
|
28
|
+
if (type === 'checkbox') {
|
|
29
|
+
return jsx("input", {
|
|
30
|
+
id: id,
|
|
31
|
+
type: "checkbox",
|
|
32
|
+
checked: value || false,
|
|
33
|
+
required: required,
|
|
34
|
+
disabled: disabled || readonly,
|
|
35
|
+
autoFocus: autofocus,
|
|
36
|
+
onChange: handleChange,
|
|
37
|
+
onBlur: handleBlur,
|
|
38
|
+
onFocus: handleFocus,
|
|
39
|
+
className: "h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return jsx("div", {
|
|
43
|
+
children: jsxs("div", {
|
|
44
|
+
className: "space-y-2",
|
|
45
|
+
children: [label && jsxs("label", {
|
|
46
|
+
htmlFor: id,
|
|
47
|
+
className: "block text-sm font-semibold text-gray-800 mb-1",
|
|
48
|
+
children: [label, required && jsx("span", {
|
|
49
|
+
className: "text-red-500 ml-1",
|
|
50
|
+
children: "*"
|
|
51
|
+
})]
|
|
52
|
+
}), jsx("input", {
|
|
53
|
+
id: id,
|
|
54
|
+
type: type || 'text',
|
|
55
|
+
value: value || '',
|
|
56
|
+
required: required,
|
|
57
|
+
disabled: disabled || readonly,
|
|
58
|
+
autoFocus: autofocus,
|
|
59
|
+
placeholder: placeholder,
|
|
60
|
+
onChange: handleChange,
|
|
61
|
+
onBlur: handleBlur,
|
|
62
|
+
onFocus: handleFocus,
|
|
63
|
+
className: `w-full px-4 py-2 rounded-md focus:outline-none focus:ring-2 text-base placeholder-gray-400 ${rawErrors && rawErrors.length > 0 ? 'border-2 border-red-500 focus:border-red-500 focus:ring-red-100' : 'border border-gray-300 focus:border-blue-300 focus:ring-blue-100'}`
|
|
64
|
+
}), rawErrors && rawErrors.length > 0 && jsx("p", {
|
|
65
|
+
className: "mt-1 text-sm text-red-500",
|
|
66
|
+
children: rawErrors[0]
|
|
67
|
+
})]
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
};export{PreviewInputWidget};//# sourceMappingURL=PreviewInputWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewInputWidget.js","sources":["../../../src/components/RJSFPreview/PreviewInputWidget.tsx"],"sourcesContent":[null],"names":[],"mappings":"yCACS,MAAA;AAET,EAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';const PreviewObjectFieldTemplate = ({
|
|
2
|
+
title,
|
|
3
|
+
description,
|
|
4
|
+
properties,
|
|
5
|
+
required,
|
|
6
|
+
schema,
|
|
7
|
+
uiSchema,
|
|
8
|
+
idSchema
|
|
9
|
+
}) => {
|
|
10
|
+
const isRoot = idSchema.$id === 'root' || !title;
|
|
11
|
+
const isConfigurationStep = idSchema.$id === 'root_configurationStep' || title === 'Configuration';
|
|
12
|
+
return jsxs("div", {
|
|
13
|
+
children: [!isRoot && !isConfigurationStep && title && jsxs("div", {
|
|
14
|
+
className: "mb-6",
|
|
15
|
+
children: [jsxs("h3", {
|
|
16
|
+
className: "text-base font-bold text-gray-800 mb-2",
|
|
17
|
+
children: [title, required && jsx("span", {
|
|
18
|
+
className: "text-red-500 ml-1",
|
|
19
|
+
children: "*"
|
|
20
|
+
})]
|
|
21
|
+
}), description && jsx("p", {
|
|
22
|
+
className: "text-sm text-gray-600 mt-1",
|
|
23
|
+
children: description
|
|
24
|
+
})]
|
|
25
|
+
}), jsx("div", {
|
|
26
|
+
className: "space-y-3 pl-4 [&_label]:text-sm [&_label]:mb-2 [&_.text-base]:text-sm [&_.mb-4]:mb-2 [&_.mb-3]:mb-2",
|
|
27
|
+
children: properties.map((element, index) => jsx("div", {
|
|
28
|
+
className: "property-wrapper",
|
|
29
|
+
children: element.content
|
|
30
|
+
}, index))
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
33
|
+
};export{PreviewObjectFieldTemplate};//# sourceMappingURL=PreviewObjectFieldTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewObjectFieldTemplate.js","sources":["../../../src/components/RJSFPreview/PreviewObjectFieldTemplate.tsx"],"sourcesContent":[null],"names":[],"mappings":"yCACS,MAAA,0BAA0B;AAEnC,EAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {jsx,Fragment,jsxs}from'react/jsx-runtime';const PreviewRadioWidget = ({
|
|
2
|
+
id,
|
|
3
|
+
value,
|
|
4
|
+
disabled,
|
|
5
|
+
readonly,
|
|
6
|
+
onChange,
|
|
7
|
+
schema,
|
|
8
|
+
options,
|
|
9
|
+
rawErrors,
|
|
10
|
+
formContext,
|
|
11
|
+
label,
|
|
12
|
+
...otherProps
|
|
13
|
+
}) => {
|
|
14
|
+
const handleChange = event => {
|
|
15
|
+
const selectedValue = event.target.value;
|
|
16
|
+
onChange(selectedValue);
|
|
17
|
+
};
|
|
18
|
+
const radioOptions = Array.isArray(options?.enumOptions) ? options.enumOptions : Array.isArray(schema?.oneOf) ? schema.oneOf.map((option, index) => ({
|
|
19
|
+
value: option.const || option.properties?.selectedOption?.const || `option${index + 1}`,
|
|
20
|
+
label: option.title || `Option ${index + 1}`
|
|
21
|
+
})) : [];
|
|
22
|
+
return jsx(Fragment, {
|
|
23
|
+
children: jsxs("div", {
|
|
24
|
+
className: "space-y-3",
|
|
25
|
+
children: [(label || schema?.title) && jsx("label", {
|
|
26
|
+
className: "block text-base font-semibold text-gray-800 mb-3",
|
|
27
|
+
children: label || schema.title
|
|
28
|
+
}), Array.isArray(radioOptions) && radioOptions.map((option, index) => {
|
|
29
|
+
const optionValue = option.value !== undefined ? option.value : option;
|
|
30
|
+
const optionLabel = option.label !== undefined ? option.label : option;
|
|
31
|
+
const radioId = `${id}-${index}`;
|
|
32
|
+
return jsxs("div", {
|
|
33
|
+
className: "flex items-center space-x-3",
|
|
34
|
+
children: [jsx("input", {
|
|
35
|
+
id: radioId,
|
|
36
|
+
name: id,
|
|
37
|
+
type: "radio",
|
|
38
|
+
value: String(optionValue),
|
|
39
|
+
checked: value === optionValue,
|
|
40
|
+
onChange: handleChange,
|
|
41
|
+
disabled: disabled || readonly,
|
|
42
|
+
className: `h-4 w-4 text-blue-600 focus:ring-blue-500 focus:ring-2 disabled:opacity-50 disabled:cursor-not-allowed ${rawErrors && rawErrors.length > 0 ? 'border-2 border-red-500' : 'border border-gray-300'}`
|
|
43
|
+
}), jsx("label", {
|
|
44
|
+
htmlFor: radioId,
|
|
45
|
+
className: `text-sm text-gray-700 ${disabled || readonly ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`,
|
|
46
|
+
children: String(optionLabel)
|
|
47
|
+
})]
|
|
48
|
+
}, index);
|
|
49
|
+
}), rawErrors && rawErrors.length > 0 && jsx("p", {
|
|
50
|
+
className: "mt-1 text-sm text-red-500",
|
|
51
|
+
children: rawErrors[0]
|
|
52
|
+
})]
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
};export{PreviewRadioWidget};//# sourceMappingURL=PreviewRadioWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewRadioWidget.js","sources":["../../../src/components/RJSFPreview/PreviewRadioWidget.tsx"],"sourcesContent":[null],"names":[],"mappings":"kDACS,MAAA;AAET,EAAA,EAAA;OACI;AACH,EAAA,QAAA;AAED,EAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {jsx,jsxs}from'react/jsx-runtime';const PreviewStepper = ({
|
|
2
|
+
steps,
|
|
3
|
+
currentStep,
|
|
4
|
+
schema
|
|
5
|
+
}) => {
|
|
6
|
+
steps.indexOf(currentStep);
|
|
7
|
+
const isSingleStep = steps.length === 1;
|
|
8
|
+
return jsx("div", {
|
|
9
|
+
className: "mb-8",
|
|
10
|
+
children: jsxs("div", {
|
|
11
|
+
className: "flex items-center justify-center relative",
|
|
12
|
+
children: [jsx("div", {
|
|
13
|
+
className: "absolute top-5 left-0 w-full h-0.5 bg-gray-200"
|
|
14
|
+
}), jsx("div", {
|
|
15
|
+
className: `flex items-center w-full relative z-10 px-4 ${isSingleStep ? 'justify-center' : 'justify-between'}`,
|
|
16
|
+
children: steps.map((step, index) => {
|
|
17
|
+
const isCurrent = currentStep === step;
|
|
18
|
+
const stepSchema = schema?.properties?.[step];
|
|
19
|
+
const title = stepSchema?.title || step.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase());
|
|
20
|
+
return jsxs("div", {
|
|
21
|
+
className: "flex flex-col items-center",
|
|
22
|
+
children: [jsx("div", {
|
|
23
|
+
className: `
|
|
24
|
+
w-10 h-10 rounded-full flex items-center justify-center text-lg font-bold border-2
|
|
25
|
+
${isCurrent ? 'bg-blue-600 text-white border-white' : 'bg-white text-gray-600 border-gray-300'}
|
|
26
|
+
`,
|
|
27
|
+
children: index + 1
|
|
28
|
+
}), jsx("div", {
|
|
29
|
+
className: "mt-2 text-center",
|
|
30
|
+
children: jsx("p", {
|
|
31
|
+
className: `text-sm ${isCurrent ? 'text-blue-600 font-medium' : 'text-gray-600'}`,
|
|
32
|
+
children: title.replace('_', ' ')
|
|
33
|
+
})
|
|
34
|
+
})]
|
|
35
|
+
}, step);
|
|
36
|
+
})
|
|
37
|
+
})]
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
};export{PreviewStepper};//# sourceMappingURL=PreviewStepper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewStepper.js","sources":["../../../src/components/RJSFPreview/PreviewStepper.tsx"],"sourcesContent":[null],"names":[],"mappings":"yCAEU,MAAA,cAAA,GAAmB,CAAA;OACzB;aACA;;AAEH,CAAA,KAAA;AAED,eAA6B,CAAA,WAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';const PreviewSwitchWidget = ({
|
|
2
|
+
id,
|
|
3
|
+
value,
|
|
4
|
+
required,
|
|
5
|
+
disabled,
|
|
6
|
+
readonly,
|
|
7
|
+
onChange,
|
|
8
|
+
label,
|
|
9
|
+
placeholder,
|
|
10
|
+
options,
|
|
11
|
+
schema,
|
|
12
|
+
rawErrors,
|
|
13
|
+
showTitle = false
|
|
14
|
+
}) => {
|
|
15
|
+
const handleToggle = () => {
|
|
16
|
+
if (!disabled && !readonly) {
|
|
17
|
+
onChange(!value);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const handleKeyDown = event => {
|
|
21
|
+
if (event.key === ' ' || event.key === 'Enter') {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
handleToggle();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return jsxs("div", {
|
|
27
|
+
className: "space-y-3",
|
|
28
|
+
children: [showTitle && schema?.title && jsxs("label", {
|
|
29
|
+
className: "block text-base font-semibold text-gray-800 mb-3",
|
|
30
|
+
children: [schema.title, required && jsx("span", {
|
|
31
|
+
className: "text-red-500 ml-1",
|
|
32
|
+
children: "*"
|
|
33
|
+
})]
|
|
34
|
+
}), jsxs("div", {
|
|
35
|
+
className: "flex items-center space-x-3",
|
|
36
|
+
children: [jsxs("button", {
|
|
37
|
+
type: "button",
|
|
38
|
+
role: "switch",
|
|
39
|
+
"aria-checked": value || false,
|
|
40
|
+
"aria-labelledby": `${id}-label`,
|
|
41
|
+
onClick: handleToggle,
|
|
42
|
+
onKeyDown: handleKeyDown,
|
|
43
|
+
disabled: disabled || readonly,
|
|
44
|
+
className: `
|
|
45
|
+
relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent
|
|
46
|
+
transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
|
|
47
|
+
${value ? 'bg-blue-600' : 'bg-gray-200'}
|
|
48
|
+
${disabled || readonly ? 'opacity-50 cursor-not-allowed' : 'hover:bg-blue-700 hover:bg-opacity-90'}
|
|
49
|
+
`,
|
|
50
|
+
children: [jsxs("span", {
|
|
51
|
+
className: "sr-only",
|
|
52
|
+
children: [value ? 'Disable' : 'Enable', " ", schema?.title || label || 'toggle']
|
|
53
|
+
}), jsx("span", {
|
|
54
|
+
"aria-hidden": "true",
|
|
55
|
+
className: `
|
|
56
|
+
pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0
|
|
57
|
+
transition duration-200 ease-in-out
|
|
58
|
+
${value ? 'translate-x-5' : 'translate-x-0'}
|
|
59
|
+
`
|
|
60
|
+
})]
|
|
61
|
+
}), jsx("label", {
|
|
62
|
+
id: `${id}-label`,
|
|
63
|
+
className: `text-sm text-gray-700 ${disabled || readonly ? 'opacity-50' : 'cursor-pointer'}`,
|
|
64
|
+
onClick: !disabled && !readonly ? handleToggle : undefined,
|
|
65
|
+
children: placeholder || options?.placeholder || 'Toggle option'
|
|
66
|
+
})]
|
|
67
|
+
}), rawErrors && rawErrors.length > 0 && jsx("p", {
|
|
68
|
+
className: "text-sm text-red-500 mt-1",
|
|
69
|
+
children: rawErrors[0]
|
|
70
|
+
}), schema?.description && jsx("p", {
|
|
71
|
+
className: "text-xs text-gray-500 mt-1",
|
|
72
|
+
children: schema.description
|
|
73
|
+
})]
|
|
74
|
+
});
|
|
75
|
+
};export{PreviewSwitchWidget};//# sourceMappingURL=PreviewSwitchWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewSwitchWidget.js","sources":["../../../src/components/RJSFPreview/PreviewSwitchWidget.tsx"],"sourcesContent":[null],"names":[],"mappings":"yCACS,MAAA;AAET,EAAA,EAAA;OACI;UACA;AACH,EAAA,QAAA;AAED,EAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|