@optigrit/optigrit-ui 0.0.16 → 0.0.17
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.
|
@@ -259,6 +259,8 @@ type AlertOptions = {
|
|
|
259
259
|
|
|
260
260
|
declare const handleAlert: (title: React__default.ReactNode, type?: AlertType, options?: AlertOptions) => void;
|
|
261
261
|
|
|
262
|
+
declare const handleError: () => void;
|
|
263
|
+
|
|
262
264
|
interface CardProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
263
265
|
}
|
|
264
266
|
declare const Card: React__default.ForwardRefExoticComponent<CardProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
@@ -281,4 +283,4 @@ interface CardFooterProps extends React__default.HTMLAttributes<HTMLDivElement>
|
|
|
281
283
|
}
|
|
282
284
|
declare const CardFooter: React__default.ForwardRefExoticComponent<CardFooterProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
283
285
|
|
|
284
|
-
export { Button, type ButtonColor, type ButtonProps, type ButtonRoundness, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, Carousel, type CarouselItem, type CarouselProps, type Column, DataTable, type DataTableProps, Dialog, DialogContent, DialogFooter, DialogHeader, type DialogProps, Drawer, DrawerContent, DrawerFooter, DrawerHeader, type DrawerProps, IconButton, type IconButtonProps, InputField, type InputFieldProps, MultiSelect, type MultiSelectProps, SearchBar, type SearchBarProps, Select, type SelectProps, Separator, type SeparatorProps, TabList, type TabListProps, TabPanel, type TabPanelProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableContainer, type TableContainerProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, type TablePaginationConfig, type TableProps, TableRow, type TableRowProps, Tooltip, type TooltipProps, handleAlert };
|
|
286
|
+
export { Button, type ButtonColor, type ButtonProps, type ButtonRoundness, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, Carousel, type CarouselItem, type CarouselProps, type Column, DataTable, type DataTableProps, Dialog, DialogContent, DialogFooter, DialogHeader, type DialogProps, Drawer, DrawerContent, DrawerFooter, DrawerHeader, type DrawerProps, IconButton, type IconButtonProps, InputField, type InputFieldProps, MultiSelect, type MultiSelectProps, SearchBar, type SearchBarProps, Select, type SelectProps, Separator, type SeparatorProps, TabList, type TabListProps, TabPanel, type TabPanelProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableContainer, type TableContainerProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, type TablePaginationConfig, type TableProps, TableRow, type TableRowProps, Tooltip, type TooltipProps, handleAlert, handleError };
|
package/dist/components/index.js
CHANGED
|
@@ -305,7 +305,7 @@ function InputField(props) {
|
|
|
305
305
|
} = props;
|
|
306
306
|
const initRef = useRef4({ isUserTyped: false });
|
|
307
307
|
const [error, setError] = useState2("");
|
|
308
|
-
function
|
|
308
|
+
function handleError2(value) {
|
|
309
309
|
if (!initRef.current.isUserTyped) return;
|
|
310
310
|
setError(() => {
|
|
311
311
|
const error2 = validateValue?.(value);
|
|
@@ -317,12 +317,12 @@ function InputField(props) {
|
|
|
317
317
|
}
|
|
318
318
|
function handleOnChange(event) {
|
|
319
319
|
onChangeValue?.(event.target.value);
|
|
320
|
-
|
|
320
|
+
handleError2(event.target.value);
|
|
321
321
|
props.onChange?.(event);
|
|
322
322
|
}
|
|
323
323
|
function handleOnBlur(event) {
|
|
324
324
|
initRef.current.isUserTyped = true;
|
|
325
|
-
|
|
325
|
+
handleError2(event.target.value);
|
|
326
326
|
props.onBlur?.(event);
|
|
327
327
|
}
|
|
328
328
|
function handleOnFocus(event) {
|
|
@@ -331,7 +331,7 @@ function InputField(props) {
|
|
|
331
331
|
useLayoutEffect(() => {
|
|
332
332
|
if (props.value) {
|
|
333
333
|
initRef.current.isUserTyped = true;
|
|
334
|
-
|
|
334
|
+
handleError2(props.value);
|
|
335
335
|
}
|
|
336
336
|
}, [props.value]);
|
|
337
337
|
return /* @__PURE__ */ jsxs4("div", { ...containerProps, children: [
|
|
@@ -1847,6 +1847,16 @@ var handleAlert = (title, type = "info", options) => {
|
|
|
1847
1847
|
});
|
|
1848
1848
|
};
|
|
1849
1849
|
|
|
1850
|
+
// src/components/Overlay/Alert/handleError.tsx
|
|
1851
|
+
var handleError = () => {
|
|
1852
|
+
renderAlert({
|
|
1853
|
+
open: true,
|
|
1854
|
+
title: "Something went wrong!",
|
|
1855
|
+
type: "error",
|
|
1856
|
+
options: { duration: 5e3 }
|
|
1857
|
+
});
|
|
1858
|
+
};
|
|
1859
|
+
|
|
1850
1860
|
// src/components/Surfaces/Card/Card.tsx
|
|
1851
1861
|
import React5 from "react";
|
|
1852
1862
|
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
@@ -1964,5 +1974,6 @@ export {
|
|
|
1964
1974
|
TableHead_default as TableHead,
|
|
1965
1975
|
TableRow_default as TableRow,
|
|
1966
1976
|
Tooltip,
|
|
1967
|
-
handleAlert
|
|
1977
|
+
handleAlert,
|
|
1978
|
+
handleError
|
|
1968
1979
|
};
|