@admin-layout/tailwind-ui 12.2.4-alpha.98 → 12.2.5-alpha.15

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 (81) hide show
  1. package/lib/components/ErrorHandlers/ApplicationErrorHandler.d.ts.map +1 -1
  2. package/lib/components/ErrorHandlers/ApplicationErrorHandler.js +5 -1
  3. package/lib/components/ErrorHandlers/ApplicationErrorHandler.js.map +1 -1
  4. package/lib/components/ErrorHandlers/RemixErrorBoundary.d.ts +11 -0
  5. package/lib/components/ErrorHandlers/RemixErrorBoundary.d.ts.map +1 -1
  6. package/lib/components/ErrorHandlers/RemixErrorBoundary.js +134 -3
  7. package/lib/components/ErrorHandlers/RemixErrorBoundary.js.map +1 -1
  8. package/lib/components/ErrorHandlers/SPAErrorBoundary.d.ts.map +1 -1
  9. package/lib/components/ErrorHandlers/SPAErrorBoundary.js +5 -1
  10. package/lib/components/ErrorHandlers/SPAErrorBoundary.js.map +1 -1
  11. package/lib/components/ErrorHandlers/__tests__/RemixErrorBoundary.test.d.ts +2 -0
  12. package/lib/components/ErrorHandlers/__tests__/RemixErrorBoundary.test.d.ts.map +1 -0
  13. package/lib/components/InputToolBar/InputToolBar.d.ts.map +1 -1
  14. package/lib/components/InputToolBar/InputToolBar.js +73 -31
  15. package/lib/components/InputToolBar/InputToolBar.js.map +1 -1
  16. package/lib/components/InputToolBar/__tests__/RightOverflowMenu.test.d.ts +8 -0
  17. package/lib/components/InputToolBar/__tests__/RightOverflowMenu.test.d.ts.map +1 -0
  18. package/lib/components/InputToolBar/types.d.ts +2 -0
  19. package/lib/components/InputToolBar/types.d.ts.map +1 -1
  20. package/lib/components/PageContainer/PageContainer.d.ts +9 -0
  21. package/lib/components/PageContainer/PageContainer.d.ts.map +1 -1
  22. package/lib/components/PageContainer/PageContainer.js +24 -8
  23. package/lib/components/PageContainer/PageContainer.js.map +1 -1
  24. package/lib/components/PageContainer/__tests__/PageContainer.test.d.ts +7 -0
  25. package/lib/components/PageContainer/__tests__/PageContainer.test.d.ts.map +1 -0
  26. package/lib/components/RJSFPreview/PreviewAsyncDropdown.js +111 -0
  27. package/lib/components/RJSFPreview/PreviewAsyncDropdown.js.map +1 -0
  28. package/lib/components/RJSFPreview/PreviewCheckboxWidget.js +95 -0
  29. package/lib/components/RJSFPreview/PreviewCheckboxWidget.js.map +1 -0
  30. package/lib/components/RJSFPreview/PreviewCustomFieldTemplate.js +235 -0
  31. package/lib/components/RJSFPreview/PreviewCustomFieldTemplate.js.map +1 -0
  32. package/lib/components/RJSFPreview/PreviewDateWidget.js +178 -0
  33. package/lib/components/RJSFPreview/PreviewDateWidget.js.map +1 -0
  34. package/lib/components/RJSFPreview/PreviewDialog.js +21 -0
  35. package/lib/components/RJSFPreview/PreviewDialog.js.map +1 -0
  36. package/lib/components/RJSFPreview/PreviewDropdownWidget.js +66 -0
  37. package/lib/components/RJSFPreview/PreviewDropdownWidget.js.map +1 -0
  38. package/lib/components/RJSFPreview/PreviewFieldTemplate.js +69 -0
  39. package/lib/components/RJSFPreview/PreviewFieldTemplate.js.map +1 -0
  40. package/lib/components/RJSFPreview/PreviewFileUploadWidget.js +113 -0
  41. package/lib/components/RJSFPreview/PreviewFileUploadWidget.js.map +1 -0
  42. package/lib/components/RJSFPreview/PreviewFormRenderer.js +195 -0
  43. package/lib/components/RJSFPreview/PreviewFormRenderer.js.map +1 -0
  44. package/lib/components/RJSFPreview/PreviewImageUploadWidget.js +104 -0
  45. package/lib/components/RJSFPreview/PreviewImageUploadWidget.js.map +1 -0
  46. package/lib/components/RJSFPreview/PreviewInputWidget.js +70 -0
  47. package/lib/components/RJSFPreview/PreviewInputWidget.js.map +1 -0
  48. package/lib/components/RJSFPreview/PreviewObjectFieldTemplate.js +33 -0
  49. package/lib/components/RJSFPreview/PreviewObjectFieldTemplate.js.map +1 -0
  50. package/lib/components/RJSFPreview/PreviewRadioWidget.js +55 -0
  51. package/lib/components/RJSFPreview/PreviewRadioWidget.js.map +1 -0
  52. package/lib/components/RJSFPreview/PreviewStepper.js +40 -0
  53. package/lib/components/RJSFPreview/PreviewStepper.js.map +1 -0
  54. package/lib/components/RJSFPreview/PreviewSwitchWidget.js +75 -0
  55. package/lib/components/RJSFPreview/PreviewSwitchWidget.js.map +1 -0
  56. package/lib/components/RJSFPreview/PreviewTab.js +358 -0
  57. package/lib/components/RJSFPreview/PreviewTab.js.map +1 -0
  58. package/lib/components/RJSFPreview/PreviewTextareaWidget.js +45 -0
  59. package/lib/components/RJSFPreview/PreviewTextareaWidget.js.map +1 -0
  60. package/lib/components/RJSFPreview/generateSchemaWithInputs.js +134 -0
  61. package/lib/components/RJSFPreview/generateSchemaWithInputs.js.map +1 -0
  62. package/lib/components/RJSFPreview/index.d.ts +34 -0
  63. package/lib/components/RJSFPreview/index.d.ts.map +1 -1
  64. package/lib/components/RJSFPreview/index.js +1 -0
  65. package/lib/components/RJSFPreview/index.js.map +1 -0
  66. package/lib/components/ThemeProvider/ThemeProvider.js +1 -1
  67. package/lib/components/index.d.ts.map +1 -1
  68. package/lib/hooks/__tests__/useMediaQuery.test.d.ts +2 -0
  69. package/lib/hooks/__tests__/useMediaQuery.test.d.ts.map +1 -0
  70. package/lib/hooks/useMediaQuery.d.ts +9 -2
  71. package/lib/hooks/useMediaQuery.d.ts.map +1 -1
  72. package/lib/hooks/useMediaQuery.js +39 -31
  73. package/lib/hooks/useMediaQuery.js.map +1 -1
  74. package/lib/hooks/useWindowSize.d.ts +4 -0
  75. package/lib/hooks/useWindowSize.d.ts.map +1 -1
  76. package/lib/hooks/useWindowSize.js +13 -19
  77. package/lib/hooks/useWindowSize.js.map +1 -1
  78. package/lib/index.js +1 -1
  79. package/lib/shardui/chart.d.ts +1 -1
  80. package/lib/shardui/resizable.d.ts +1 -1
  81. package/package.json +20 -5
@@ -0,0 +1,111 @@
1
+ import {jsxs,jsx}from'react/jsx-runtime';import {useState,useCallback,useEffect}from'react';const PreviewAsyncDropdown = props => {
2
+ const {
3
+ id,
4
+ placeholder,
5
+ disabled,
6
+ readonly,
7
+ autofocus,
8
+ options,
9
+ value,
10
+ onChange,
11
+ onBlur,
12
+ onFocus,
13
+ uiSchema,
14
+ multiple = false,
15
+ schema,
16
+ required,
17
+ rawErrors
18
+ } = props;
19
+ console.log('we are here', props);
20
+ const isMultiple = multiple || schema.type === 'array';
21
+ const [loading, setLoading] = useState(false);
22
+ const [dropdownOptions, setDropdownOptions] = useState([]);
23
+ const loadOptions = useCallback(async () => {
24
+ console.log('loadOptions', uiSchema, schema);
25
+ const asyncFuncStr = options?.loadOptionsFunc || schema?.loadOptionsFunc;
26
+ if (!asyncFuncStr) return;
27
+ console.log('asyncFuncStr', asyncFuncStr);
28
+ try {
29
+ setLoading(true);
30
+ const dummyResults = await new Promise(resolve => {
31
+ setTimeout(() => {
32
+ resolve([{
33
+ label: 'Async Option 1',
34
+ value: 'async_1'
35
+ }, {
36
+ label: 'Async Option 2',
37
+ value: 'async_2'
38
+ }, {
39
+ label: 'Async Option 3',
40
+ value: 'async_3'
41
+ }, {
42
+ label: 'Dynamic Choice A',
43
+ value: 'dynamic_a'
44
+ }, {
45
+ label: 'Dynamic Choice B',
46
+ value: 'dynamic_b'
47
+ }]);
48
+ }, 1000);
49
+ });
50
+ setDropdownOptions(dummyResults);
51
+ } catch (error) {
52
+ console.error('Error loading async dropdown options:', error);
53
+ } finally {
54
+ setLoading(false);
55
+ }
56
+ }, [uiSchema, schema]);
57
+ useEffect(() => {
58
+ loadOptions();
59
+ }, [loadOptions]);
60
+ useEffect(() => {
61
+ if (options?.enumOptions && !options?.loadOptionsFunc) {
62
+ const enumOptions = options.enumOptions.map(option => ({
63
+ label: option.label,
64
+ value: option.value
65
+ }));
66
+ setDropdownOptions(enumOptions);
67
+ }
68
+ }, [options, uiSchema]);
69
+ const handleChange = e => {
70
+ const selectedValue = e.target.value;
71
+ onChange(selectedValue);
72
+ };
73
+ return jsxs("div", {
74
+ className: "space-y-3",
75
+ children: [jsxs("div", {
76
+ className: "block text-base font-semibold text-gray-800 mb-1",
77
+ children: [schema?.title, required && jsx("span", {
78
+ className: "text-red-500 ml-1",
79
+ children: "*"
80
+ })]
81
+ }), jsxs("div", {
82
+ className: "relative",
83
+ children: [jsxs("select", {
84
+ id: id,
85
+ value: value || '',
86
+ disabled: disabled || readonly,
87
+ autoFocus: autofocus,
88
+ onChange: handleChange,
89
+ onBlur: onBlur && (() => onBlur(id, value)),
90
+ onFocus: onFocus && (() => onFocus(id, value)),
91
+ className: `w-full px-3 pb-2 rounded-md focus:outline-none focus:ring-2 disabled:opacity-50 disabled:cursor-not-allowed text-sm ${rawErrors && rawErrors.length > 0 ? 'border-2 border-red-500 focus:border-red-500 focus:ring-red-500' : 'border border-gray-300 focus:border-blue-500 focus:ring-blue-500'}`,
92
+ multiple: isMultiple,
93
+ children: [jsx("option", {
94
+ value: "",
95
+ children: placeholder || 'Select an option...'
96
+ }), dropdownOptions.map((option, index) => jsx("option", {
97
+ value: String(option.value),
98
+ children: String(option.label)
99
+ }, index))]
100
+ }), loading && jsx("div", {
101
+ className: "absolute right-3 top-1/2 transform -translate-y-1/2",
102
+ children: jsx("div", {
103
+ className: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"
104
+ })
105
+ })]
106
+ }), rawErrors && rawErrors.length > 0 && jsx("p", {
107
+ className: "mt-1 text-sm text-red-500",
108
+ children: rawErrors[0]
109
+ })]
110
+ });
111
+ };export{PreviewAsyncDropdown as default};//# sourceMappingURL=PreviewAsyncDropdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewAsyncDropdown.js","sources":["../../../src/components/RJSFPreview/PreviewAsyncDropdown.tsx"],"sourcesContent":[null],"names":[],"mappings":"4FAII,MAAA,oBAAmB,GAAA,KAAA,IAAA;AACnB,EAAA,MAAA;AACI,IAAA,EAAA;AACA,IAAA,WAAA;YACF;AACL,IAAA,QAAA;AAOD,IAAA;AA+GA,IAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,95 @@
1
+ import {jsxs,jsx}from'react/jsx-runtime';const PreviewCheckboxWidget = ({
2
+ id,
3
+ value,
4
+ required,
5
+ disabled,
6
+ readonly,
7
+ onChange,
8
+ label,
9
+ placeholder,
10
+ schema,
11
+ options,
12
+ rawErrors
13
+ }) => {
14
+ const isBooleanCheckbox = schema?.type === 'boolean';
15
+ const isArrayCheckbox = schema?.type === 'array';
16
+ if (isBooleanCheckbox) {
17
+ const handleBooleanChange = event => {
18
+ onChange(event.target.checked);
19
+ };
20
+ const displayLabel = placeholder || schema?.placeholder || label || schema?.title || 'Checkbox';
21
+ return jsxs("div", {
22
+ className: "space-y-2",
23
+ children: [jsxs("div", {
24
+ className: "flex items-start space-x-3",
25
+ children: [jsx("input", {
26
+ id: id,
27
+ type: "checkbox",
28
+ checked: value || false,
29
+ onChange: handleBooleanChange,
30
+ disabled: disabled || readonly,
31
+ className: `mt-1 h-4 w-4 text-blue-600 rounded 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'}`
32
+ }), jsx("label", {
33
+ htmlFor: id,
34
+ className: `text-sm text-gray-700 ${disabled || readonly ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`,
35
+ children: displayLabel
36
+ })]
37
+ }), rawErrors && rawErrors.length > 0 && jsx("p", {
38
+ className: "mt-1 text-sm text-red-500",
39
+ children: rawErrors[0]
40
+ })]
41
+ });
42
+ }
43
+ if (isArrayCheckbox) {
44
+ const handleArrayChange = (optionValue, checked) => {
45
+ const currentValues = Array.isArray(value) ? value : [];
46
+ let newValues;
47
+ if (checked) {
48
+ newValues = currentValues.includes(optionValue) ? currentValues : [...currentValues, optionValue];
49
+ } else {
50
+ newValues = currentValues.filter(v => v !== optionValue);
51
+ }
52
+ onChange(newValues);
53
+ };
54
+ const checkboxOptions = Array.isArray(options?.enumOptions) ? options.enumOptions : Array.isArray(schema?.items?.oneOf) ? (schema?.items?.oneOf || []).map(option => ({
55
+ value: option.const || option.value || option,
56
+ label: option.title || option.label || option.const || option
57
+ })) : Array.isArray(schema?.items?.enum) ? (schema?.items?.enum || []).map(option => ({
58
+ value: option,
59
+ label: option
60
+ })) : [];
61
+ const currentValues = Array.isArray(value) ? value : [];
62
+ schema?.title || label || 'Select Options';
63
+ return jsxs("div", {
64
+ className: "space-y-2",
65
+ children: [checkboxOptions.map((option, index) => {
66
+ const optionValue = option.value !== undefined ? option.value : option;
67
+ const optionLabel = option.label !== undefined ? option.label : option;
68
+ const checkboxId = `${id}-${index}`;
69
+ const isChecked = currentValues.includes(optionValue);
70
+ return jsxs("div", {
71
+ className: "flex items-center space-x-3",
72
+ children: [jsx("input", {
73
+ id: checkboxId,
74
+ type: "checkbox",
75
+ checked: isChecked,
76
+ onChange: e => handleArrayChange(optionValue, e.target.checked),
77
+ disabled: disabled || readonly,
78
+ className: `h-4 w-4 text-blue-600 rounded 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'}`
79
+ }), jsx("label", {
80
+ htmlFor: checkboxId,
81
+ className: `text-sm text-gray-700 ${disabled || readonly ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`,
82
+ children: String(optionLabel)
83
+ })]
84
+ }, index);
85
+ }), rawErrors && rawErrors.length > 0 && jsx("p", {
86
+ className: "mt-1 text-sm text-red-500",
87
+ children: rawErrors[0]
88
+ })]
89
+ });
90
+ }
91
+ return jsxs("div", {
92
+ className: "text-red-500 text-sm",
93
+ children: ["Unsupported checkbox schema type: ", schema?.type]
94
+ });
95
+ };export{PreviewCheckboxWidget};//# sourceMappingURL=PreviewCheckboxWidget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewCheckboxWidget.js","sources":["../../../src/components/RJSFPreview/PreviewCheckboxWidget.tsx"],"sourcesContent":[null],"names":[],"mappings":"yCACS,MAAA;AAET,EAAA,EAAA;OACI;AACH,EAAA,QAAA;AAED,EAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,235 @@
1
+ import {jsxs,jsx}from'react/jsx-runtime';import React__default from'react';import {PreviewImageUploadWidget}from'./PreviewImageUploadWidget.js';import {PreviewFileUploadWidget}from'./PreviewFileUploadWidget.js';const PreviewCustomFieldTemplate = props => {
2
+ const {
3
+ id,
4
+ classNames,
5
+ style,
6
+ label,
7
+ help,
8
+ required,
9
+ description,
10
+ errors,
11
+ children,
12
+ schema,
13
+ uiSchema,
14
+ rawErrors
15
+ } = props;
16
+ const isImageField = schema.type === 'string' && schema.format === 'data-url' && (uiSchema?.['ui:widget'] === 'image-upload' || uiSchema?.['ui:options']?.fieldType === 'image' || typeof uiSchema?.['ui:options']?.accept === 'string' && uiSchema['ui:options'].accept.includes('image/*'));
17
+ const isFileField = schema.type === 'string' && schema.format === 'data-url' && (uiSchema?.['ui:widget'] === 'file-upload' || uiSchema?.['ui:options']?.fieldType === 'file' || typeof uiSchema?.['ui:options']?.accept === 'string' && !uiSchema['ui:options'].accept.includes('image/*'));
18
+ const isTextareaField = schema.type === 'string' && (uiSchema?.['ui:widget'] === 'textarea' || schema.widget === 'textarea');
19
+ const isDropdownField = schema.type === 'string' && schema.enum && Array.isArray(schema.enum) && schema.enum.length > 0;
20
+ const isGroupField = schema.type === 'object' && schema.properties;
21
+ const isStepField = schema.type === 'object' && schema.properties && (id === 'root' || id === 'root_step1' || id.includes('step'));
22
+ const isRadioField = schema.type === 'string' && (uiSchema?.['ui:widget'] === 'radio' || uiSchema?.['ui:widget'] === 'MultiFormControl' || schema.widget === 'radio' || schema.oneOf && Array.isArray(schema.oneOf));
23
+ const shouldShowLabel = label && (isImageField || isFileField || !isStepField && !isGroupField && !isTextareaField && (isDropdownField || schema.type !== 'object'));
24
+ const isPlainTextOrNumberInput = (schema.type === 'string' || schema.type === 'number') && !isImageField && !isFileField && !isTextareaField && !isDropdownField;
25
+ if (isPlainTextOrNumberInput) {
26
+ return jsxs("div", {
27
+ className: classNames,
28
+ style: style,
29
+ children: [React__default.isValidElement(children) ? React__default.cloneElement(children, {
30
+ rawErrors
31
+ }) : children, description && id !== 'root' && jsx("p", {
32
+ className: "text-sm text-gray-600 mb-3",
33
+ children: description
34
+ }), help && jsx("p", {
35
+ className: "text-sm text-gray-500 mt-2",
36
+ children: help
37
+ }), errors && Array.isArray(errors) && errors.length > 0 && jsx("div", {
38
+ className: "text-red-600 text-sm mt-2",
39
+ children: errors.map((error, index) => jsx("div", {
40
+ children: error
41
+ }, index))
42
+ })]
43
+ });
44
+ }
45
+ if (isDropdownField) {
46
+ return jsxs("div", {
47
+ className: classNames,
48
+ style: style,
49
+ children: [React__default.isValidElement(children) ? React__default.cloneElement(children, {
50
+ rawErrors
51
+ }) : children, description && jsx("p", {
52
+ className: "text-sm text-gray-600 mb-3",
53
+ children: description
54
+ }), help && jsx("p", {
55
+ className: "text-sm text-gray-500 mt-2",
56
+ children: help
57
+ }), errors && Array.isArray(errors) && errors.length > 0 && jsx("div", {
58
+ className: "text-red-600 text-sm mt-2",
59
+ children: errors.map((error, index) => jsx("div", {
60
+ children: error
61
+ }, index))
62
+ })]
63
+ });
64
+ }
65
+ if (isImageField) {
66
+ const childProps = children?.props;
67
+ if (childProps) {
68
+ return jsxs("div", {
69
+ className: classNames,
70
+ style: style,
71
+ children: [shouldShowLabel && jsxs("label", {
72
+ htmlFor: id,
73
+ className: "block text-base font-bold text-gray-800 mb-4",
74
+ children: [label, required && jsx("span", {
75
+ className: "text-red-500 ml-1",
76
+ children: "*"
77
+ })]
78
+ }), jsx(PreviewImageUploadWidget, {
79
+ ...childProps
80
+ }), description && jsx("p", {
81
+ className: "text-sm text-gray-600 mb-3",
82
+ children: description
83
+ }), help && jsx("p", {
84
+ className: "text-sm text-gray-500 mt-2",
85
+ children: help
86
+ }), errors && Array.isArray(errors) && errors.length > 0 && jsx("div", {
87
+ className: "text-red-600 text-sm mt-2",
88
+ children: errors.map((error, index) => jsx("div", {
89
+ children: error
90
+ }, index))
91
+ })]
92
+ });
93
+ }
94
+ }
95
+ if (isFileField) {
96
+ const childProps = children?.props;
97
+ if (childProps) {
98
+ return jsxs("div", {
99
+ className: classNames,
100
+ style: style,
101
+ children: [shouldShowLabel && jsxs("label", {
102
+ htmlFor: id,
103
+ className: "block text-base font-bold text-gray-800 mb-4",
104
+ children: [label, required && jsx("span", {
105
+ className: "text-red-500 ml-1",
106
+ children: "*"
107
+ })]
108
+ }), jsx(PreviewFileUploadWidget, {
109
+ ...childProps
110
+ }), description && jsx("p", {
111
+ className: "text-sm text-gray-600 mb-3",
112
+ children: description
113
+ }), help && jsx("p", {
114
+ className: "text-sm text-gray-500 mt-2",
115
+ children: help
116
+ }), errors && Array.isArray(errors) && errors.length > 0 && jsx("div", {
117
+ className: "text-red-600 text-sm mt-2",
118
+ children: errors.map((error, index) => jsx("div", {
119
+ children: error
120
+ }, index))
121
+ })]
122
+ });
123
+ }
124
+ }
125
+ if (isTextareaField) {
126
+ return jsxs("div", {
127
+ className: classNames,
128
+ style: style,
129
+ children: [React__default.isValidElement(children) ? React__default.cloneElement(children, {
130
+ rawErrors
131
+ }) : children, help && jsx("p", {
132
+ className: "text-sm text-gray-500 mt-2",
133
+ children: help
134
+ }), errors && Array.isArray(errors) && errors.length > 0 && jsx("div", {
135
+ className: "text-red-600 text-sm mt-2",
136
+ children: errors.map((error, index) => jsx("div", {
137
+ children: error
138
+ }, index))
139
+ })]
140
+ });
141
+ }
142
+ if (isRadioField) {
143
+ return jsxs("div", {
144
+ className: classNames,
145
+ style: style,
146
+ children: [React__default.isValidElement(children) ? React__default.cloneElement(children, {
147
+ rawErrors,
148
+ label
149
+ }) : children, description && jsx("p", {
150
+ className: "text-sm text-gray-600 mb-3",
151
+ children: description
152
+ }), help && jsx("p", {
153
+ className: "text-sm text-gray-500 mt-2",
154
+ children: help
155
+ }), errors && Array.isArray(errors) && errors.length > 0 && jsx("div", {
156
+ className: "text-red-600 text-sm mt-2",
157
+ children: errors.map((error, index) => jsx("div", {
158
+ children: error
159
+ }, index))
160
+ })]
161
+ });
162
+ }
163
+ if (isGroupField && !isStepField) {
164
+ return jsxs("div", {
165
+ className: "bg-white rounded-lg pt-5 pr-5 pb-5 pl-0 mb-4",
166
+ children: [jsx("div", {
167
+ className: "mb-1",
168
+ children: React__default.isValidElement(children) ? React__default.cloneElement(children, {
169
+ rawErrors
170
+ }) : children
171
+ }), help && jsx("p", {
172
+ className: "text-sm text-gray-500 mt-2",
173
+ children: help
174
+ }), errors && Array.isArray(errors) && errors.length > 0 && jsx("div", {
175
+ className: "text-red-600 text-sm mt-2",
176
+ children: errors.map((error, index) => jsx("div", {
177
+ children: error
178
+ }, index))
179
+ })]
180
+ });
181
+ }
182
+ const isBooleanCheckbox = schema.type === 'boolean';
183
+ const isArrayCheckbox = schema.type === 'array' && !isDropdownField && !isFileField && !isImageField && !isTextareaField;
184
+ if (isBooleanCheckbox || isArrayCheckbox) {
185
+ return jsxs("div", {
186
+ className: "bg-white rounded-lg mb-4",
187
+ children: [label && jsxs("label", {
188
+ htmlFor: id,
189
+ className: "block text-base font-bold text-gray-800 mb-4",
190
+ children: [label, required && jsx("span", {
191
+ className: "text-red-500 ml-1",
192
+ children: "*"
193
+ })]
194
+ }), React__default.isValidElement(children) ? React__default.cloneElement(children, {
195
+ rawErrors
196
+ }) : children, description && jsx("p", {
197
+ className: "text-sm text-gray-600 mb-3",
198
+ children: description
199
+ }), help && jsx("p", {
200
+ className: "text-sm text-gray-500 mt-2",
201
+ children: help
202
+ }), errors && Array.isArray(errors) && errors.length > 0 && jsx("div", {
203
+ className: "text-red-600 text-sm mt-2",
204
+ children: errors.map((error, index) => jsx("div", {
205
+ children: error
206
+ }, index))
207
+ })]
208
+ });
209
+ }
210
+ return jsxs("div", {
211
+ className: classNames,
212
+ style: style,
213
+ children: [shouldShowLabel && jsxs("label", {
214
+ htmlFor: id,
215
+ className: "block text-base font-bold text-gray-800 mb-4",
216
+ children: [label, required && jsx("span", {
217
+ className: "text-red-500 ml-1",
218
+ children: "*"
219
+ })]
220
+ }), React__default.isValidElement(children) ? React__default.cloneElement(children, {
221
+ rawErrors
222
+ }) : children, !isTextareaField && description && jsx("p", {
223
+ className: "text-sm text-gray-600 mb-3",
224
+ children: description
225
+ }), help && jsx("p", {
226
+ className: "text-sm text-gray-500 mt-2",
227
+ children: help
228
+ }), errors && Array.isArray(errors) && errors.length > 0 && jsx("div", {
229
+ className: "text-red-600 text-sm mt-2",
230
+ children: errors.map((error, index) => jsx("div", {
231
+ children: error
232
+ }, index))
233
+ })]
234
+ });
235
+ };export{PreviewCustomFieldTemplate};//# sourceMappingURL=PreviewCustomFieldTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewCustomFieldTemplate.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,178 @@
1
+ import {jsxs,jsx}from'react/jsx-runtime';import {useState,useRef}from'react';const style = `
2
+ input[type="date"]::-webkit-calendar-picker-indicator {
3
+ opacity: 0;
4
+ display: none;
5
+ }
6
+ input[type="date"]::-moz-calendar-picker-indicator {
7
+ opacity: 0;
8
+ display: none;
9
+ }
10
+ input[type="date"]::-ms-input-placeholder {
11
+ opacity: 0;
12
+ display: none;
13
+ }
14
+ `;
15
+ const PreviewDateWidget = ({
16
+ id,
17
+ value,
18
+ required,
19
+ disabled,
20
+ readonly,
21
+ onChange,
22
+ placeholder,
23
+ schema,
24
+ rawErrors
25
+ }) => {
26
+ const [isCalendarOpen, setIsCalendarOpen] = useState(false);
27
+ const [currentDate, setCurrentDate] = useState(() => {
28
+ if (value) {
29
+ return new Date(value);
30
+ }
31
+ return new Date();
32
+ });
33
+ const inputRef = useRef(null);
34
+ const handleDateChange = event => {
35
+ const dateValue = event.target.value;
36
+ onChange(dateValue);
37
+ };
38
+ const handleCalendarDateSelect = date => {
39
+ const formattedDate = date.toISOString().split('T')[0];
40
+ onChange(formattedDate);
41
+ setIsCalendarOpen(false);
42
+ };
43
+ const generateCalendarDays = () => {
44
+ const year = currentDate.getFullYear();
45
+ const month = currentDate.getMonth();
46
+ const firstDay = new Date(year, month, 1);
47
+ const startDate = new Date(firstDay);
48
+ startDate.setDate(startDate.getDate() - firstDay.getDay());
49
+ const days = [];
50
+ for (let i = 0; i < 42; i++) {
51
+ const date = new Date(startDate);
52
+ date.setDate(startDate.getDate() + i);
53
+ days.push(date);
54
+ }
55
+ return days;
56
+ };
57
+ return jsxs("div", {
58
+ className: "mb-4",
59
+ children: [jsx("style", {
60
+ children: style
61
+ }), schema?.title && jsxs("label", {
62
+ htmlFor: id,
63
+ className: "block text-base font-semibold text-gray-800 mb-3",
64
+ children: [schema.title, required && jsx("span", {
65
+ className: "text-red-500 ml-1",
66
+ children: "*"
67
+ })]
68
+ }), jsxs("div", {
69
+ className: "relative",
70
+ children: [jsx("input", {
71
+ ref: inputRef,
72
+ id: id,
73
+ type: "date",
74
+ value: value || '',
75
+ onChange: handleDateChange,
76
+ disabled: disabled || readonly,
77
+ className: `w-full px-3 py-2 rounded-md focus:outline-none focus:ring-2 disabled:opacity-50 disabled:cursor-not-allowed ${rawErrors && rawErrors.length > 0 ? 'border-2 border-red-500 focus:border-red-500 focus:ring-red-100' : 'border border-gray-300 focus:border-blue-500 focus:ring-blue-500'}`
78
+ }), rawErrors && rawErrors.length > 0 && jsx("p", {
79
+ className: "mt-1 text-sm text-red-500",
80
+ children: rawErrors[0]
81
+ }), !disabled && !readonly && jsx("button", {
82
+ type: "button",
83
+ onClick: () => setIsCalendarOpen(!isCalendarOpen),
84
+ className: "absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",
85
+ tabIndex: -1,
86
+ children: jsx("svg", {
87
+ className: "w-5 h-5",
88
+ fill: "none",
89
+ stroke: "currentColor",
90
+ viewBox: "0 0 24 24",
91
+ children: jsx("path", {
92
+ strokeLinecap: "round",
93
+ strokeLinejoin: "round",
94
+ strokeWidth: 2,
95
+ d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
96
+ })
97
+ })
98
+ }), isCalendarOpen && !disabled && !readonly && jsxs("div", {
99
+ className: "absolute z-10 mt-1 w-64 bg-white border border-gray-300 rounded-md shadow-lg",
100
+ children: [jsx("div", {
101
+ className: "p-3 border-b border-gray-200",
102
+ children: jsxs("div", {
103
+ className: "flex items-center justify-between",
104
+ children: [jsx("button", {
105
+ type: "button",
106
+ onClick: () => {
107
+ const prevMonth = new Date(currentDate);
108
+ prevMonth.setMonth(prevMonth.getMonth() - 1);
109
+ setCurrentDate(prevMonth);
110
+ },
111
+ className: "p-1 hover:bg-gray-100 rounded",
112
+ children: jsx("svg", {
113
+ className: "w-4 h-4",
114
+ fill: "none",
115
+ stroke: "currentColor",
116
+ viewBox: "0 0 24 24",
117
+ children: jsx("path", {
118
+ strokeLinecap: "round",
119
+ strokeLinejoin: "round",
120
+ strokeWidth: 2,
121
+ d: "M15 19l-7-7 7-7"
122
+ })
123
+ })
124
+ }), jsx("span", {
125
+ className: "text-sm font-medium",
126
+ children: currentDate.toLocaleDateString('en-US', {
127
+ year: 'numeric',
128
+ month: 'long'
129
+ })
130
+ }), jsx("button", {
131
+ type: "button",
132
+ onClick: () => {
133
+ const nextMonth = new Date(currentDate);
134
+ nextMonth.setMonth(nextMonth.getMonth() + 1);
135
+ setCurrentDate(nextMonth);
136
+ },
137
+ className: "p-1 hover:bg-gray-100 rounded",
138
+ children: jsx("svg", {
139
+ className: "w-4 h-4",
140
+ fill: "none",
141
+ stroke: "currentColor",
142
+ viewBox: "0 0 24 24",
143
+ children: jsx("path", {
144
+ strokeLinecap: "round",
145
+ strokeLinejoin: "round",
146
+ strokeWidth: 2,
147
+ d: "M9 5l7 7-7 7"
148
+ })
149
+ })
150
+ })]
151
+ })
152
+ }), jsxs("div", {
153
+ className: "p-3",
154
+ children: [jsx("div", {
155
+ className: "grid grid-cols-7 gap-1 text-xs text-gray-500 mb-2",
156
+ children: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].map(day => jsx("div", {
157
+ className: "text-center",
158
+ children: day
159
+ }, day))
160
+ }), jsx("div", {
161
+ className: "grid grid-cols-7 gap-1",
162
+ children: generateCalendarDays().map((date, index) => {
163
+ const isCurrentMonth = date.getMonth() === currentDate.getMonth();
164
+ const isToday = date.toDateString() === new Date().toDateString();
165
+ const isSelected = value && date.toISOString().split('T')[0] === value;
166
+ return jsx("button", {
167
+ type: "button",
168
+ onClick: () => handleCalendarDateSelect(date),
169
+ className: `p-2 text-sm rounded hover:bg-blue-50 ${!isCurrentMonth ? 'text-gray-300' : 'text-gray-700'} ${isToday ? 'bg-blue-100 font-semibold' : ''} ${isSelected ? 'bg-blue-500 text-white hover:bg-blue-600' : ''}`,
170
+ children: date.getDate()
171
+ }, index);
172
+ })
173
+ })]
174
+ })]
175
+ })]
176
+ })]
177
+ });
178
+ };export{PreviewDateWidget};//# sourceMappingURL=PreviewDateWidget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewDateWidget.js","sources":["../../../src/components/RJSFPreview/PreviewDateWidget.tsx"],"sourcesContent":[null],"names":[],"mappings":"6EAkBA,MAAA,KAAU,GAAA;;AAET;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,21 @@
1
+ import {jsx,jsxs}from'react/jsx-runtime';const PreviewDialog = ({
2
+ open,
3
+ onClose,
4
+ children
5
+ }) => {
6
+ if (!open) return null;
7
+ return jsx("div", {
8
+ className: "fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-40",
9
+ onClick: onClose,
10
+ children: jsxs("div", {
11
+ className: "bg-white rounded-lg shadow-lg p-6 min-w-[320px] max-w-lg w-full relative",
12
+ onClick: e => e.stopPropagation(),
13
+ children: [jsx("button", {
14
+ className: "absolute top-2 right-2 text-gray-500 hover:text-gray-700",
15
+ onClick: onClose,
16
+ "aria-label": "Close",
17
+ children: "\u00D7"
18
+ }), children]
19
+ })
20
+ });
21
+ };export{PreviewDialog};//# sourceMappingURL=PreviewDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewDialog.js","sources":["../../../src/components/RJSFPreview/PreviewDialog.tsx"],"sourcesContent":[null],"names":[],"mappings":"yCAEU,MAAA,aAAA,GAAkB,CAAA;MACxB;SACA;AACA,EAAA;AACH,CAAA,KAAA;AAED,EAAA,IAAA,CAAA,IAAA,EAAA,OAAO;;;;;;;;;;;;;;;"}