@geoinsight/react-components 0.6.4 → 0.6.6
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/cjs/index.js +5 -3
- package/dist/esm/index.js +5 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -197,7 +197,7 @@ function Form({ children, onSubmit, submitButton = {
|
|
|
197
197
|
});
|
|
198
198
|
return (jsxRuntime.jsxs("form", { className: "form", onSubmit: handleSubmit(async (data) => await onSubmit(data, setResult)), ...rest, children: [react.Children.map(children, (child) => {
|
|
199
199
|
const { props: { name, error, isRequired, ...rest }, } = child;
|
|
200
|
-
return (jsxRuntime.jsx(reactHookForm.Controller, { name: name, control: control, rules: {
|
|
200
|
+
return child.props.name ? (jsxRuntime.jsx(reactHookForm.Controller, { name: name, control: control, rules: {
|
|
201
201
|
...(isRequired
|
|
202
202
|
? {
|
|
203
203
|
required: error?.message || "Field is required",
|
|
@@ -216,7 +216,7 @@ function Form({ children, onSubmit, submitButton = {
|
|
|
216
216
|
...restField,
|
|
217
217
|
...rest,
|
|
218
218
|
});
|
|
219
|
-
} }));
|
|
219
|
+
} })) : child;
|
|
220
220
|
}), result.message && (jsxRuntime.jsxs("div", { className: "form__message", children: [result.isSuccess ? (jsxRuntime.jsx(bs.BsCheckCircleFill, { color: "var(--color-success)", size: 48 })) : (jsxRuntime.jsx(bs.BsXCircleFill, { color: "var(--color-danger)", size: 48 })), result.message] })), jsxRuntime.jsx(Button, { type: "submit", disabled: !isValid, children: submitButton.label })] }));
|
|
221
221
|
}
|
|
222
222
|
|
|
@@ -237,7 +237,9 @@ function Modal({ modalref, children, title, subtitle, footer, hasCloseButton = t
|
|
|
237
237
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "modal-overlay" }), jsxRuntime.jsxs("div", { ref: modalref, className: "modal", children: [hasCloseButton && (jsxRuntime.jsx(Button, { mode: "secondary", className: "modal__close", size: "small", onClick: handleClose, children: jsxRuntime.jsx(io5.IoClose, {}) })), jsxRuntime.jsxs("div", { className: "modal__content", children: [title && (jsxRuntime.jsxs("div", { className: "modal__header", children: [jsxRuntime.jsx("h3", { children: title }), jsxRuntime.jsx("h6", { children: subtitle })] })), jsxRuntime.jsx("div", { className: "modal__children", children: children }), footer && jsxRuntime.jsx("div", { className: "modal__footer", children: footer })] })] })] }));
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
function Select({ inputClassName = "", classNameGroup = "", options, styleGroup, defaultValue,
|
|
240
|
+
function Select({ inputClassName = "", classNameGroup = "", options, styleGroup, defaultValue,
|
|
241
|
+
// inputProps,
|
|
242
|
+
setFormSelected, onFormBlur, handleSelect, ...rest }) {
|
|
241
243
|
const [isOpen, setIsOpen] = react.useState(false);
|
|
242
244
|
const [value, setValue] = react.useState(defaultValue || (options && options[0]));
|
|
243
245
|
const [filteredOptions, setFilteredOptions] = react.useState(options);
|
package/dist/esm/index.js
CHANGED
|
@@ -195,7 +195,7 @@ function Form({ children, onSubmit, submitButton = {
|
|
|
195
195
|
});
|
|
196
196
|
return (jsxs("form", { className: "form", onSubmit: handleSubmit(async (data) => await onSubmit(data, setResult)), ...rest, children: [Children.map(children, (child) => {
|
|
197
197
|
const { props: { name, error, isRequired, ...rest }, } = child;
|
|
198
|
-
return (jsx(Controller, { name: name, control: control, rules: {
|
|
198
|
+
return child.props.name ? (jsx(Controller, { name: name, control: control, rules: {
|
|
199
199
|
...(isRequired
|
|
200
200
|
? {
|
|
201
201
|
required: error?.message || "Field is required",
|
|
@@ -214,7 +214,7 @@ function Form({ children, onSubmit, submitButton = {
|
|
|
214
214
|
...restField,
|
|
215
215
|
...rest,
|
|
216
216
|
});
|
|
217
|
-
} }));
|
|
217
|
+
} })) : child;
|
|
218
218
|
}), result.message && (jsxs("div", { className: "form__message", children: [result.isSuccess ? (jsx(BsCheckCircleFill, { color: "var(--color-success)", size: 48 })) : (jsx(BsXCircleFill, { color: "var(--color-danger)", size: 48 })), result.message] })), jsx(Button, { type: "submit", disabled: !isValid, children: submitButton.label })] }));
|
|
219
219
|
}
|
|
220
220
|
|
|
@@ -235,7 +235,9 @@ function Modal({ modalref, children, title, subtitle, footer, hasCloseButton = t
|
|
|
235
235
|
return (jsxs(Fragment, { children: [jsx("div", { className: "modal-overlay" }), jsxs("div", { ref: modalref, className: "modal", children: [hasCloseButton && (jsx(Button, { mode: "secondary", className: "modal__close", size: "small", onClick: handleClose, children: jsx(IoClose, {}) })), jsxs("div", { className: "modal__content", children: [title && (jsxs("div", { className: "modal__header", children: [jsx("h3", { children: title }), jsx("h6", { children: subtitle })] })), jsx("div", { className: "modal__children", children: children }), footer && jsx("div", { className: "modal__footer", children: footer })] })] })] }));
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
function Select({ inputClassName = "", classNameGroup = "", options, styleGroup, defaultValue,
|
|
238
|
+
function Select({ inputClassName = "", classNameGroup = "", options, styleGroup, defaultValue,
|
|
239
|
+
// inputProps,
|
|
240
|
+
setFormSelected, onFormBlur, handleSelect, ...rest }) {
|
|
239
241
|
const [isOpen, setIsOpen] = useState(false);
|
|
240
242
|
const [value, setValue] = useState(defaultValue || (options && options[0]));
|
|
241
243
|
const [filteredOptions, setFilteredOptions] = useState(options);
|