@soyfri/shared-library 2.0.0-beta.13 → 2.0.0-beta.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.
- package/{Autocomplete-C2x-lBvZ.cjs → Autocomplete-4i0dNDKr.cjs} +55 -33
- package/Autocomplete-4i0dNDKr.cjs.map +1 -0
- package/{Autocomplete-BA-cGASd.js → Autocomplete-i3-V38n1.js} +56 -34
- package/Autocomplete-i3-V38n1.js.map +1 -0
- package/{Avatar-BJTr-PBd.js → Avatar-CgT7955R.js} +18 -19
- package/Avatar-CgT7955R.js.map +1 -0
- package/{Avatar-9L7YMxya.cjs → Avatar-CuSrK8Wn.cjs} +18 -19
- package/Avatar-CuSrK8Wn.cjs.map +1 -0
- package/Button-C17mExpd.cjs.map +1 -1
- package/Button-UkkP-bNw.js.map +1 -1
- package/Card-B1wtavyl.js +98 -0
- package/Card-B1wtavyl.js.map +1 -0
- package/Card-DfdU610V.cjs +97 -0
- package/Card-DfdU610V.cjs.map +1 -0
- package/Checkbox-BCqMFWt4.cjs +187 -0
- package/Checkbox-BCqMFWt4.cjs.map +1 -0
- package/Checkbox-gB5YKkVo.js +188 -0
- package/Checkbox-gB5YKkVo.js.map +1 -0
- package/{DatePicker-DLSfkgGA.cjs → DatePicker-CtCFqXDw.cjs} +41 -64
- package/DatePicker-CtCFqXDw.cjs.map +1 -0
- package/{DatePicker-8f_9bwhS.js → DatePicker-D0Bz9Ryg.js} +37 -60
- package/DatePicker-D0Bz9Ryg.js.map +1 -0
- package/{DateTimePicker-D4L9GAod.js → DateTimePicker-77w-9TP5.js} +27 -17
- package/DateTimePicker-77w-9TP5.js.map +1 -0
- package/{DateTimePicker-CWNW09-O.cjs → DateTimePicker-CTnRQCZo.cjs} +31 -21
- package/DateTimePicker-CTnRQCZo.cjs.map +1 -0
- package/{Input-DI0jfq5X.cjs → Input-jYapjJYM.cjs} +27 -14
- package/Input-jYapjJYM.cjs.map +1 -0
- package/{Input-Cp911l23.js → Input-rVVhI_wk.js} +24 -11
- package/Input-rVVhI_wk.js.map +1 -0
- package/{Modal-Bm_HH9cv.cjs → Modal-BN5s-Tfk.cjs} +126 -98
- package/Modal-BN5s-Tfk.cjs.map +1 -0
- package/{Modal-Bnz6d9m9.js → Modal-BRZMPwDj.js} +134 -106
- package/Modal-BRZMPwDj.js.map +1 -0
- package/{RadioGroup-CxqDHap1.cjs → RadioGroup-Dd0rHXSX.cjs} +10 -8
- package/RadioGroup-Dd0rHXSX.cjs.map +1 -0
- package/{RadioGroup-DMi9FvMP.js → RadioGroup-bO-ahP9T.js} +10 -8
- package/RadioGroup-bO-ahP9T.js.map +1 -0
- package/Select-B6jE3WH_.cjs +253 -0
- package/Select-B6jE3WH_.cjs.map +1 -0
- package/Select-bSVQokFX.js +254 -0
- package/Select-bSVQokFX.js.map +1 -0
- package/StatusMessage-B3nXpuRl.cjs +88 -0
- package/StatusMessage-B3nXpuRl.cjs.map +1 -0
- package/StatusMessage-D0WgSBx7.js +89 -0
- package/StatusMessage-D0WgSBx7.js.map +1 -0
- package/Step-BArsou1V.js +301 -0
- package/Step-BArsou1V.js.map +1 -0
- package/Step-Nd7SJbRZ.cjs +300 -0
- package/Step-Nd7SJbRZ.cjs.map +1 -0
- package/{Switch-BIeobv6i.cjs → Switch-CQFOopYy.cjs} +6 -3
- package/Switch-CQFOopYy.cjs.map +1 -0
- package/{Switch-DQEOxM2R.js → Switch-D72dpkH2.js} +6 -3
- package/Switch-D72dpkH2.js.map +1 -0
- package/{Tab-Co31KY2k.cjs → Tab-BbP8jBcK.cjs} +43 -28
- package/Tab-BbP8jBcK.cjs.map +1 -0
- package/Tab-BxSxKJsP.js +111 -0
- package/Tab-BxSxKJsP.js.map +1 -0
- package/components/ActionMenu/ActionMenu.cjs +52 -52
- package/components/ActionMenu/ActionMenu.cjs.map +1 -1
- package/components/ActionMenu/ActionMenu.d.ts +20 -36
- package/components/ActionMenu/ActionMenu.js +55 -55
- package/components/ActionMenu/ActionMenu.js.map +1 -1
- package/components/ActionMenu/index.d.ts +2 -2
- package/components/AppBar/AppBar.cjs +2 -219
- package/components/AppBar/AppBar.cjs.map +1 -1
- package/components/AppBar/AppBar.d.ts +6 -6
- package/components/AppBar/AppBar.js +5 -222
- package/components/AppBar/AppBar.js.map +1 -1
- package/components/AppBar/index.d.ts +0 -6
- package/components/Autocomplete/Autocomplete.cjs +1 -1
- package/components/Autocomplete/Autocomplete.d.ts +8 -6
- package/components/Autocomplete/Autocomplete.helpers.d.ts +8 -4
- package/components/Autocomplete/Autocomplete.js +1 -1
- package/components/Autocomplete/_parts/AutocompleteOption.d.ts +5 -8
- package/components/Autocomplete/index.d.ts +1 -1
- package/components/Avatar/Avatar.cjs +1 -1
- package/components/Avatar/Avatar.js +1 -1
- package/components/Avatar/index.d.ts +1 -0
- package/components/Button/Button.d.ts +5 -5
- package/components/Button/index.d.ts +1 -0
- package/components/Card/Card.cjs +1 -4
- package/components/Card/Card.cjs.map +1 -1
- package/components/Card/Card.d.ts +3 -50
- package/components/Card/Card.js +1 -4
- package/components/Card/Card.sx.d.ts +3 -6
- package/components/Card/index.d.ts +1 -1
- package/components/Checkbox/Checkbox.cjs +6 -0
- package/components/Checkbox/Checkbox.cjs.map +1 -0
- package/components/Checkbox/Checkbox.d.ts +55 -0
- package/components/Checkbox/Checkbox.js +6 -0
- package/components/Checkbox/Checkbox.js.map +1 -0
- package/components/Checkbox/Checkbox.sx.d.ts +13 -0
- package/components/Checkbox/index.d.ts +2 -0
- package/components/Checkbox.d.ts +6 -0
- package/components/Chip/Chip.cjs +2 -1
- package/components/Chip/Chip.cjs.map +1 -1
- package/components/Chip/Chip.js +3 -2
- package/components/Chip/index.d.ts +2 -1
- package/components/Chip.d.ts +4 -0
- package/components/DatePicker/DatePicker.cjs +1 -1
- package/components/DatePicker/DatePicker.d.ts +1 -13
- package/components/DatePicker/DatePicker.js +1 -1
- package/components/DatePicker/index.d.ts +1 -1
- package/components/DateTimePicker/DateTimePicker.cjs +1 -1
- package/components/DateTimePicker/DateTimePicker.d.ts +10 -6
- package/components/DateTimePicker/DateTimePicker.definitions.d.ts +2 -0
- package/components/DateTimePicker/DateTimePicker.helpers.d.ts +4 -2
- package/components/DateTimePicker/DateTimePicker.js +1 -1
- package/components/DateTimePicker/index.d.ts +1 -1
- package/components/Drawer/Drawer.cjs +10 -6
- package/components/Drawer/Drawer.cjs.map +1 -1
- package/components/Drawer/Drawer.js +11 -7
- package/components/Drawer/Drawer.js.map +1 -1
- package/components/Drawer/DrawerItem.d.ts +6 -1
- package/components/Gallery/Gallery.cjs +154 -79
- package/components/Gallery/Gallery.cjs.map +1 -1
- package/components/Gallery/Gallery.d.ts +25 -9
- package/components/Gallery/Gallery.js +154 -79
- package/components/Gallery/Gallery.js.map +1 -1
- package/components/Gallery/GalleryLightbox.d.ts +6 -10
- package/components/Gallery/GalleryMain.d.ts +3 -7
- package/components/Gallery/GalleryThumbnails.d.ts +7 -11
- package/components/Gallery/index.d.ts +2 -1
- package/components/Gallery.d.ts +4 -0
- package/components/Icon/Icon.cjs +6 -8
- package/components/Icon/Icon.cjs.map +1 -1
- package/components/Icon/Icon.d.ts +11 -17
- package/components/Icon/Icon.js +6 -8
- package/components/Icon/Icon.js.map +1 -1
- package/components/Icon/index.d.ts +2 -1
- package/components/Icon.d.ts +4 -0
- package/components/Input/Input.cjs +1 -1
- package/components/Input/Input.d.ts +9 -2
- package/components/Input/Input.helpers.d.ts +3 -3
- package/components/Input/Input.js +1 -1
- package/components/Input/index.d.ts +1 -1
- package/components/InputGroup/InputGroup.cjs +23 -22
- package/components/InputGroup/InputGroup.cjs.map +1 -1
- package/components/InputGroup/InputGroup.d.ts +4 -4
- package/components/InputGroup/InputGroup.js +22 -21
- package/components/InputGroup/InputGroup.js.map +1 -1
- package/components/InputGroup/index.d.ts +2 -1
- package/components/InputGroup.d.ts +4 -0
- package/components/Modal/Modal.cjs +1 -1
- package/components/Modal/Modal.d.ts +20 -5
- package/components/Modal/Modal.js +6 -6
- package/components/Modal/ModalBody.d.ts +6 -1
- package/components/Modal/ModalFooter.d.ts +4 -4
- package/components/Modal/ModalHeader.d.ts +6 -1
- package/components/Modal/index.d.ts +2 -0
- package/components/RadioGroup/RadioGroup.cjs +1 -1
- package/components/RadioGroup/RadioGroup.d.ts +9 -3
- package/components/RadioGroup/RadioGroup.js +1 -1
- package/components/RadioGroup/index.d.ts +1 -1
- package/components/Select/Select.cjs +1 -1
- package/components/Select/Select.d.ts +13 -18
- package/components/Select/Select.helpers.d.ts +5 -19
- package/components/Select/Select.js +1 -1
- package/components/Select/index.d.ts +1 -1
- package/components/Stat/Stat.cjs +2 -2
- package/components/Stat/Stat.js +3 -3
- package/components/Stat/Stat.js.map +1 -1
- package/components/Stat/index.d.ts +2 -1
- package/components/Stat.d.ts +4 -0
- package/components/StatusMessage/StatusMessage.cjs +1 -1
- package/components/StatusMessage/StatusMessage.d.ts +20 -36
- package/components/StatusMessage/StatusMessage.js +1 -1
- package/components/Stepper/Stepper.cjs +6 -2
- package/components/Stepper/Stepper.cjs.map +1 -1
- package/components/Stepper/Stepper.d.ts +9 -8
- package/components/Stepper/Stepper.js +6 -2
- package/{hooks/Wizard/WizardContext.d.ts → components/Stepper/StepperContext.d.ts} +28 -22
- package/components/Stepper/_hooks/useHorizontalScroll.d.ts +19 -0
- package/components/Stepper/_parts/StepperScrollArrow.d.ts +19 -0
- package/components/Stepper/index.d.ts +6 -2
- package/components/Stepper.d.ts +4 -0
- package/components/Switch/Switch.cjs +1 -1
- package/components/Switch/Switch.d.ts +7 -2
- package/components/Switch/Switch.js +1 -1
- package/components/Tabs/Tabs.cjs +3 -2
- package/components/Tabs/Tabs.cjs.map +1 -1
- package/components/Tabs/Tabs.d.ts +21 -16
- package/components/Tabs/Tabs.js +3 -2
- package/components/Tabs/index.d.ts +4 -2
- package/components/Tabs.d.ts +4 -0
- package/components/Timeline/Timeline.cjs +3 -3
- package/components/Timeline/Timeline.cjs.map +1 -1
- package/components/Timeline/Timeline.d.ts +4 -8
- package/components/Timeline/Timeline.js +2 -2
- package/components/Timeline/Timeline.js.map +1 -1
- package/components/Timeline/index.d.ts +4 -3
- package/components/Timeline.d.ts +4 -0
- package/components/_shared/mergeSx.d.ts +7 -0
- package/{formField.sx-DfVbMe0V.js → formField.sx-8_QRnKxv.js} +2 -11
- package/formField.sx-8_QRnKxv.js.map +1 -0
- package/{formField.sx-CQ1mbk9M.cjs → formField.sx-BAX7KwMR.cjs} +10 -19
- package/formField.sx-BAX7KwMR.cjs.map +1 -0
- package/index.cjs +38 -15
- package/index.cjs.map +1 -1
- package/index.d.ts +3 -0
- package/index.js +33 -19
- package/index.js.map +1 -1
- package/mergeSx-BXoNZjB_.js +10 -0
- package/mergeSx-BXoNZjB_.js.map +1 -0
- package/mergeSx-Dbccoo_H.cjs +9 -0
- package/mergeSx-Dbccoo_H.cjs.map +1 -0
- package/mui.d.ts +2 -1
- package/package.json +32 -42
- package/theme/componentStyles.d.ts +1 -1
- package/tokens-BRrcP_p_.js +21 -0
- package/tokens-BRrcP_p_.js.map +1 -0
- package/tokens-jaWWNk39.cjs +20 -0
- package/tokens-jaWWNk39.cjs.map +1 -0
- package/utils/index.d.ts +2 -0
- package/{components/ScrollTopButton → utils}/scrollToTop.d.ts +6 -7
- package/Autocomplete-BA-cGASd.js.map +0 -1
- package/Autocomplete-C2x-lBvZ.cjs.map +0 -1
- package/Avatar-9L7YMxya.cjs.map +0 -1
- package/Avatar-BJTr-PBd.js.map +0 -1
- package/Card-DG_crfkK.cjs +0 -185
- package/Card-DG_crfkK.cjs.map +0 -1
- package/Card-Ug-ttVSh.js +0 -186
- package/Card-Ug-ttVSh.js.map +0 -1
- package/DatePicker-8f_9bwhS.js.map +0 -1
- package/DatePicker-DLSfkgGA.cjs.map +0 -1
- package/DateTimePicker-CWNW09-O.cjs.map +0 -1
- package/DateTimePicker-D4L9GAod.js.map +0 -1
- package/Input-Cp911l23.js.map +0 -1
- package/Input-DI0jfq5X.cjs.map +0 -1
- package/Modal-Bm_HH9cv.cjs.map +0 -1
- package/Modal-Bnz6d9m9.js.map +0 -1
- package/RadioGroup-CxqDHap1.cjs.map +0 -1
- package/RadioGroup-DMi9FvMP.js.map +0 -1
- package/Select-3CBOfM2H.js +0 -447
- package/Select-3CBOfM2H.js.map +0 -1
- package/Select-Bku4f4f8.cjs +0 -446
- package/Select-Bku4f4f8.cjs.map +0 -1
- package/StatusMessage-C5B6oGZ_.cjs +0 -78
- package/StatusMessage-C5B6oGZ_.cjs.map +0 -1
- package/StatusMessage-D1GlfQdz.js +0 -79
- package/StatusMessage-D1GlfQdz.js.map +0 -1
- package/Step-Dq0N72YB.js +0 -49
- package/Step-Dq0N72YB.js.map +0 -1
- package/Step-a8U8O-91.cjs +0 -48
- package/Step-a8U8O-91.cjs.map +0 -1
- package/Switch-BIeobv6i.cjs.map +0 -1
- package/Switch-DQEOxM2R.js.map +0 -1
- package/Tab-Co31KY2k.cjs.map +0 -1
- package/Tab-DiK62gRz.js +0 -96
- package/Tab-DiK62gRz.js.map +0 -1
- package/components/AppBar/AppBarBrand.d.ts +0 -31
- package/components/AppBar/AppBarUserMenu.d.ts +0 -65
- package/components/Autocomplete/Autocomplete.types.d.ts +0 -1
- package/components/DatePicker/DatePicker.types.d.ts +0 -1
- package/components/DateTimePicker/DateTimePicker.types.d.ts +0 -1
- package/components/Input/Input.types.d.ts +0 -1
- package/components/PageLoader/PageLoader.cjs +0 -61
- package/components/PageLoader/PageLoader.cjs.map +0 -1
- package/components/PageLoader/PageLoader.d.ts +0 -38
- package/components/PageLoader/PageLoader.js +0 -61
- package/components/PageLoader/PageLoader.js.map +0 -1
- package/components/PageLoader/index.d.ts +0 -2
- package/components/PageLoader.d.ts +0 -6
- package/components/RadioGroup/RadioGroup.types.d.ts +0 -1
- package/components/ScrollTopButton/ScrollTopButton.cjs +0 -79
- package/components/ScrollTopButton/ScrollTopButton.cjs.map +0 -1
- package/components/ScrollTopButton/ScrollTopButton.d.ts +0 -48
- package/components/ScrollTopButton/ScrollTopButton.js +0 -79
- package/components/ScrollTopButton/ScrollTopButton.js.map +0 -1
- package/components/ScrollTopButton/index.d.ts +0 -4
- package/components/ScrollTopButton.d.ts +0 -6
- package/components/Select/Select.definitions.d.ts +0 -17
- package/components/Select/Select.types.d.ts +0 -1
- package/components/Select/_parts/SelectSearchHeader.d.ts +0 -15
- package/formField.sx-CQ1mbk9M.cjs.map +0 -1
- package/formField.sx-DfVbMe0V.js.map +0 -1
- package/hooks/Wizard/Wizard.cjs +0 -7
- package/hooks/Wizard/Wizard.cjs.map +0 -1
- package/hooks/Wizard/Wizard.js +0 -7
- package/hooks/Wizard/Wizard.js.map +0 -1
- package/hooks/Wizard/index.d.ts +0 -3
- package/hooks/Wizard/useWizard.d.ts +0 -9
- package/hooks/Wizard.d.ts +0 -2
- package/useWizard-CWdIxZzX.cjs +0 -94
- package/useWizard-CWdIxZzX.cjs.map +0 -1
- package/useWizard-CWq--C3o.js +0 -95
- package/useWizard-CWq--C3o.js.map +0 -1
- /package/{styles.css → index.css} +0 -0
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
18
|
-
import { Fade, Box, CircularProgress, Typography } from "@mui/material";
|
|
19
|
-
function PageLoader({
|
|
20
|
-
fullscreen = true,
|
|
21
|
-
message,
|
|
22
|
-
logo,
|
|
23
|
-
size = 48,
|
|
24
|
-
open = true,
|
|
25
|
-
backdropColor,
|
|
26
|
-
sx,
|
|
27
|
-
className
|
|
28
|
-
}) {
|
|
29
|
-
const rootSx = [
|
|
30
|
-
(theme) => __spreadValues({
|
|
31
|
-
display: "flex",
|
|
32
|
-
flexDirection: "column",
|
|
33
|
-
alignItems: "center",
|
|
34
|
-
justifyContent: "center",
|
|
35
|
-
gap: 2
|
|
36
|
-
}, fullscreen ? {
|
|
37
|
-
position: "fixed",
|
|
38
|
-
inset: 0,
|
|
39
|
-
zIndex: theme.zIndex.modal + 10,
|
|
40
|
-
backgroundColor: backdropColor != null ? backdropColor : theme.palette.background.default
|
|
41
|
-
} : {
|
|
42
|
-
width: "100%",
|
|
43
|
-
minHeight: 160
|
|
44
|
-
}),
|
|
45
|
-
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
46
|
-
];
|
|
47
|
-
const content = /* @__PURE__ */ jsxs(Box, { className, sx: rootSx, role: "status", "aria-live": "polite", children: [
|
|
48
|
-
logo && /* @__PURE__ */ jsx(Box, { sx: { mb: 1 }, children: logo }),
|
|
49
|
-
/* @__PURE__ */ jsx(CircularProgress, { size, thickness: 4 }),
|
|
50
|
-
message && /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children: message })
|
|
51
|
-
] });
|
|
52
|
-
if (!fullscreen) {
|
|
53
|
-
return open ? content : null;
|
|
54
|
-
}
|
|
55
|
-
return /* @__PURE__ */ jsx(Fade, { in: open, timeout: { enter: 0, exit: 200 }, unmountOnExit: true, children: content });
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
PageLoader,
|
|
59
|
-
PageLoader as default
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=PageLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PageLoader.js","sources":["../../../src/components/PageLoader/PageLoader.tsx"],"sourcesContent":["import React, { type ReactNode } from 'react';\nimport { Box, CircularProgress, Typography, Fade } from '@mui/material';\nimport type { SxProps, Theme } from '@mui/material/styles';\n\nexport interface PageLoaderProps {\n /**\n * Si es true, muestra el loader ocupando toda la ventana (fixed, 100vh/vw)\n * con backdrop. Default: true.\n */\n fullscreen?: boolean;\n /** Texto bajo el spinner. */\n message?: ReactNode;\n /** Logo/imagen opcional arriba del spinner. */\n logo?: ReactNode;\n /** Tamaño del spinner en px. Default: 48. */\n size?: number;\n /**\n * Control explícito. Si es undefined, el loader se muestra apenas se monta.\n * Útil para fades.\n */\n open?: boolean;\n /** Color del backdrop (solo fullscreen). Default: usa theme.palette.background.default. */\n backdropColor?: string;\n /** sx del root. */\n sx?: SxProps<Theme>;\n className?: string;\n}\n\n/**\n * Loader full-page o inline. Reemplaza el `LayoutSplashScreen` de Metronic.\n *\n * ```tsx\n * // Splash de arranque\n * <PageLoader logo={<img src={logo} />} message=\"Cargando...\" />\n *\n * // Loader local dentro de una card\n * <PageLoader fullscreen={false} size={32} />\n * ```\n */\nexport function PageLoader({\n fullscreen = true,\n message,\n logo,\n size = 48,\n open = true,\n backdropColor,\n sx,\n className,\n}: PageLoaderProps) {\n const rootSx: SxProps<Theme> = [\n (theme) => ({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 2,\n ...(fullscreen\n ? {\n position: 'fixed',\n inset: 0,\n zIndex: theme.zIndex.modal + 10,\n backgroundColor:\n backdropColor ?? theme.palette.background.default,\n }\n : {\n width: '100%',\n minHeight: 160,\n }),\n }),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n const content = (\n <Box className={className} sx={rootSx} role=\"status\" aria-live=\"polite\">\n {logo && <Box sx={{ mb: 1 }}>{logo}</Box>}\n <CircularProgress size={size} thickness={4} />\n {message && (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {message}\n </Typography>\n )}\n </Box>\n );\n\n if (!fullscreen) {\n return open ? content : null;\n }\n\n return (\n <Fade in={open} timeout={{ enter: 0, exit: 200 }} unmountOnExit>\n {content}\n </Fade>\n );\n}\n\nexport default PageLoader;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAuCO,SAAS,WAAW;AAAA,EACzB,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AACF,GAAoB;AAClB,QAAM,SAAyB;AAAA,IAC7B,CAAC,UAAW;AAAA,MACV,SAAS;AAAA,MACT,eAAe;AAAA,MACf,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,KAAK;AAAA,OACD,aACA;AAAA,MACE,UAAU;AAAA,MACV,OAAO;AAAA,MACP,QAAQ,MAAM,OAAO,QAAQ;AAAA,MAC7B,iBACE,wCAAiB,MAAM,QAAQ,WAAW;AAAA,IAAA,IAE9C;AAAA,MACE,OAAO;AAAA,MACP,WAAW;AAAA,IAAA;AAAA,IAGnB,GAAI,MAAM,QAAQ,EAAE,IAAI,KAAK,KAAK,CAAC,EAAE,IAAI,CAAA;AAAA,EAAC;AAG5C,QAAM,+BACH,KAAA,EAAI,WAAsB,IAAI,QAAQ,MAAK,UAAS,aAAU,UAC5D,UAAA;AAAA,IAAA,4BAAS,KAAA,EAAI,IAAI,EAAE,IAAI,EAAA,GAAM,UAAA,MAAK;AAAA,IACnC,oBAAC,kBAAA,EAAiB,MAAY,WAAW,EAAA,CAAG;AAAA,IAC3C,WACC,oBAAC,YAAA,EAAW,SAAQ,SAAQ,OAAM,kBAC/B,UAAA,QAAA,CACH;AAAA,EAAA,GAEJ;AAGF,MAAI,CAAC,YAAY;AACf,WAAO,OAAO,UAAU;AAAA,EAC1B;AAEA,SACE,oBAAC,MAAA,EAAK,IAAI,MAAM,SAAS,EAAE,OAAO,GAAG,MAAM,IAAA,GAAO,eAAa,MAC5D,UAAA,SACH;AAEJ;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { RadioOption, RadioGroupSize, BaseRadioGroupProps, RHFRadioGroupProps, ControlledRadioGroupProps, RadioGroupProps, } from './RadioGroup';
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const material = require("@mui/material");
|
|
6
|
-
const KeyboardArrowUpIcon = require("@mui/icons-material/KeyboardArrowUp");
|
|
7
|
-
const resolvePreset = require("../../resolvePreset-CxTI6_Ln.cjs");
|
|
8
|
-
function scrollToTop({
|
|
9
|
-
behavior = "smooth",
|
|
10
|
-
target = typeof window !== "undefined" ? window : void 0,
|
|
11
|
-
top = 0
|
|
12
|
-
} = {}) {
|
|
13
|
-
if (!target) return;
|
|
14
|
-
target.scrollTo({ top, left: 0, behavior });
|
|
15
|
-
}
|
|
16
|
-
const positionSx = {
|
|
17
|
-
"bottom-right": { position: "fixed", bottom: 24, right: 24 },
|
|
18
|
-
"bottom-left": { position: "fixed", bottom: 24, left: 24 },
|
|
19
|
-
"bottom-center": {
|
|
20
|
-
position: "fixed",
|
|
21
|
-
bottom: 24,
|
|
22
|
-
left: "50%",
|
|
23
|
-
transform: "translateX(-50%)"
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
function ScrollTopButton({
|
|
27
|
-
threshold = 300,
|
|
28
|
-
position = "bottom-right",
|
|
29
|
-
scrollTarget,
|
|
30
|
-
size = "medium",
|
|
31
|
-
color = "default",
|
|
32
|
-
icon,
|
|
33
|
-
ariaLabel = "Subir al inicio",
|
|
34
|
-
preset,
|
|
35
|
-
sx,
|
|
36
|
-
className
|
|
37
|
-
}) {
|
|
38
|
-
const theme = material.useTheme();
|
|
39
|
-
const [visible, setVisible] = React.useState(false);
|
|
40
|
-
React.useEffect(() => {
|
|
41
|
-
const target = scrollTarget != null ? scrollTarget : typeof window !== "undefined" ? window : null;
|
|
42
|
-
if (!target) return;
|
|
43
|
-
const readScrollTop = () => target === window ? window.scrollY || document.documentElement.scrollTop : target.scrollTop;
|
|
44
|
-
const handleScroll = () => {
|
|
45
|
-
setVisible(readScrollTop() > threshold);
|
|
46
|
-
};
|
|
47
|
-
handleScroll();
|
|
48
|
-
target.addEventListener("scroll", handleScroll, { passive: true });
|
|
49
|
-
return () => target.removeEventListener("scroll", handleScroll);
|
|
50
|
-
}, [threshold, scrollTarget]);
|
|
51
|
-
const handleClick = () => {
|
|
52
|
-
scrollToTop({
|
|
53
|
-
target: scrollTarget != null ? scrollTarget : typeof window !== "undefined" ? window : void 0
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
const presetSx = resolvePreset.resolvePreset("ScrollTopButton", preset, theme);
|
|
57
|
-
const mergedSx = [
|
|
58
|
-
positionSx[position],
|
|
59
|
-
{ zIndex: theme.zIndex.speedDial },
|
|
60
|
-
...presetSx ? [presetSx] : [],
|
|
61
|
-
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
62
|
-
];
|
|
63
|
-
return /* @__PURE__ */ jsxRuntime.jsx(material.Zoom, { in: visible, unmountOnExit: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
-
material.Fab,
|
|
65
|
-
{
|
|
66
|
-
size,
|
|
67
|
-
color,
|
|
68
|
-
"aria-label": ariaLabel,
|
|
69
|
-
onClick: handleClick,
|
|
70
|
-
className,
|
|
71
|
-
sx: mergedSx,
|
|
72
|
-
children: icon != null ? icon : /* @__PURE__ */ jsxRuntime.jsx(KeyboardArrowUpIcon, {})
|
|
73
|
-
}
|
|
74
|
-
) });
|
|
75
|
-
}
|
|
76
|
-
exports.ScrollTopButton = ScrollTopButton;
|
|
77
|
-
exports.default = ScrollTopButton;
|
|
78
|
-
exports.scrollToTop = scrollToTop;
|
|
79
|
-
//# sourceMappingURL=ScrollTopButton.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollTopButton.cjs","sources":["../../../src/components/ScrollTopButton/scrollToTop.ts","../../../src/components/ScrollTopButton/ScrollTopButton.tsx"],"sourcesContent":["export interface ScrollToTopOptions {\n /** Comportamiento del scroll. Default: `'smooth'`. */\n behavior?: ScrollBehavior;\n /**\n * Elemento target del scroll. Default: `window`. Útil cuando el contenedor\n * scrolleable NO es `window` (p.ej. un `<Box>` con `overflow: auto`).\n */\n target?: Window | HTMLElement;\n /** Offset desde el top. Default: `0`. */\n top?: number;\n}\n\n/**\n * Reemplaza imperativamente a `ScrollTopComponent.goTop()` de Metronic.\n *\n * Llamar tras mutaciones / cambios de filtros / apertura de modales para\n * asegurar que el usuario vea el mensaje de confirmación en la parte\n * superior de la página.\n *\n * ```ts\n * // Reemplazo directo del legacy:\n * // Antes: ScrollTopComponent.goTop()\n * scrollToTop();\n *\n * // Con opciones:\n * scrollToTop({ behavior: 'auto' });\n * scrollToTop({ target: myScrollableRef.current });\n * ```\n */\nexport function scrollToTop({\n behavior = 'smooth',\n target = typeof window !== 'undefined' ? window : undefined,\n top = 0,\n}: ScrollToTopOptions = {}): void {\n if (!target) return;\n target.scrollTo({ top, left: 0, behavior });\n}\n","import React, { useEffect, useState, type ReactNode } from 'react';\nimport { Fab, Zoom, useTheme } from '@mui/material';\nimport KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';\nimport type { SxProps, Theme } from '@mui/material/styles';\n\nimport { resolvePreset } from '../_shared/resolvePreset';\nimport { scrollToTop } from './scrollToTop';\n\nexport type ScrollTopButtonPosition =\n | 'bottom-right'\n | 'bottom-left'\n | 'bottom-center';\n\nexport interface ScrollTopButtonProps {\n /**\n * Distancia en px que hay que scrollear antes de mostrar el botón.\n * Default: `300`.\n */\n threshold?: number;\n /**\n * Posición del botón en la pantalla. Default: `'bottom-right'`.\n */\n position?: ScrollTopButtonPosition;\n /**\n * Elemento scrolleable a observar y al que se hace scrollTop. Si se omite,\n * se usa `window` (caso más común).\n */\n scrollTarget?: Window | HTMLElement | null;\n /** Tamaño del FAB. Default: `'medium'`. */\n size?: 'small' | 'medium' | 'large';\n /**\n * Color del FAB. Default: `'default'`.\n */\n color?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error';\n /** Icono custom. Default: `<KeyboardArrowUpIcon />`. */\n icon?: ReactNode;\n /** Texto accesible (aria-label). Default: `\"Subir al inicio\"`. */\n ariaLabel?: string;\n /** Preset registrado en `theme.styles.ScrollTopButton`. */\n preset?: string;\n /** sx del Fab. Se compone sobre la posición + preset. */\n sx?: SxProps<Theme>;\n className?: string;\n}\n\nconst positionSx: Record<ScrollTopButtonPosition, SxProps<Theme>> = {\n 'bottom-right': { position: 'fixed', bottom: 24, right: 24 },\n 'bottom-left': { position: 'fixed', bottom: 24, left: 24 },\n 'bottom-center': {\n position: 'fixed',\n bottom: 24,\n left: '50%',\n transform: 'translateX(-50%)',\n },\n};\n\n/**\n * Botón flotante que aparece tras scrollear más de `threshold` px y, al\n * clickearse, hace scroll suave hasta el tope. Reemplaza al componente\n * visible de `ScrollTopComponent` de Metronic.\n *\n * Para el caso imperativo (llamar `goTop()` tras una mutación), usar el\n * helper `scrollToTop()` directamente.\n *\n * ```tsx\n * <ScrollTopButton threshold={400} position=\"bottom-right\" />\n * ```\n */\nexport function ScrollTopButton({\n threshold = 300,\n position = 'bottom-right',\n scrollTarget,\n size = 'medium',\n color = 'default',\n icon,\n ariaLabel = 'Subir al inicio',\n preset,\n sx,\n className,\n}: ScrollTopButtonProps) {\n const theme = useTheme();\n const [visible, setVisible] = useState(false);\n\n useEffect(() => {\n // Si viene scrollTarget explícito, usarlo; si no, window.\n const target: Window | HTMLElement | null =\n scrollTarget ?? (typeof window !== 'undefined' ? window : null);\n if (!target) return;\n\n const readScrollTop = () =>\n target === window\n ? window.scrollY || document.documentElement.scrollTop\n : (target as HTMLElement).scrollTop;\n\n const handleScroll = () => {\n setVisible(readScrollTop() > threshold);\n };\n\n handleScroll(); // check inicial por si ya estamos scrolleados\n target.addEventListener('scroll', handleScroll, { passive: true });\n return () => target.removeEventListener('scroll', handleScroll);\n }, [threshold, scrollTarget]);\n\n const handleClick = () => {\n scrollToTop({\n target: scrollTarget ?? (typeof window !== 'undefined' ? window : undefined),\n });\n };\n\n const presetSx = resolvePreset('ScrollTopButton', preset, theme);\n\n const mergedSx: SxProps<Theme> = [\n positionSx[position],\n { zIndex: theme.zIndex.speedDial },\n ...(presetSx ? [presetSx] : []),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n return (\n <Zoom in={visible} unmountOnExit>\n <Fab\n size={size}\n color={color}\n aria-label={ariaLabel}\n onClick={handleClick}\n className={className}\n sx={mergedSx}\n >\n {icon ?? <KeyboardArrowUpIcon />}\n </Fab>\n </Zoom>\n );\n}\n\nexport default ScrollTopButton;\n"],"names":["useTheme","useState","useEffect","resolvePreset","jsx","Zoom","Fab"],"mappings":";;;;;;;AA6BO,SAAS,YAAY;AAAA,EAC1B,WAAW;AAAA,EACX,SAAS,OAAO,WAAW,cAAc,SAAS;AAAA,EAClD,MAAM;AACR,IAAwB,IAAU;AAChC,MAAI,CAAC,OAAQ;AACb,SAAO,SAAS,EAAE,KAAK,MAAM,GAAG,UAAU;AAC5C;ACSA,MAAM,aAA8D;AAAA,EAClE,gBAAgB,EAAE,UAAU,SAAS,QAAQ,IAAI,OAAO,GAAA;AAAA,EACxD,eAAe,EAAE,UAAU,SAAS,QAAQ,IAAI,MAAM,GAAA;AAAA,EACtD,iBAAiB;AAAA,IACf,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,WAAW;AAAA,EAAA;AAEf;AAcO,SAAS,gBAAgB;AAAA,EAC9B,YAAY;AAAA,EACZ,WAAW;AAAA,EACX;AAAA,EACA,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,QAAQA,SAAAA,SAAA;AACd,QAAM,CAAC,SAAS,UAAU,IAAIC,MAAAA,SAAS,KAAK;AAE5CC,QAAAA,UAAU,MAAM;AAEd,UAAM,SACJ,sCAAiB,OAAO,WAAW,cAAc,SAAS;AAC5D,QAAI,CAAC,OAAQ;AAEb,UAAM,gBAAgB,MACpB,WAAW,SACP,OAAO,WAAW,SAAS,gBAAgB,YAC1C,OAAuB;AAE9B,UAAM,eAAe,MAAM;AACzB,iBAAW,cAAA,IAAkB,SAAS;AAAA,IACxC;AAEA,iBAAA;AACA,WAAO,iBAAiB,UAAU,cAAc,EAAE,SAAS,MAAM;AACjE,WAAO,MAAM,OAAO,oBAAoB,UAAU,YAAY;AAAA,EAChE,GAAG,CAAC,WAAW,YAAY,CAAC;AAE5B,QAAM,cAAc,MAAM;AACxB,gBAAY;AAAA,MACV,QAAQ,sCAAiB,OAAO,WAAW,cAAc,SAAS;AAAA,IAAA,CACnE;AAAA,EACH;AAEA,QAAM,WAAWC,cAAAA,cAAc,mBAAmB,QAAQ,KAAK;AAE/D,QAAM,WAA2B;AAAA,IAC/B,WAAW,QAAQ;AAAA,IACnB,EAAE,QAAQ,MAAM,OAAO,UAAA;AAAA,IACvB,GAAI,WAAW,CAAC,QAAQ,IAAI,CAAA;AAAA,IAC5B,GAAI,MAAM,QAAQ,EAAE,IAAI,KAAK,KAAK,CAAC,EAAE,IAAI,CAAA;AAAA,EAAC;AAG5C,SACEC,2BAAAA,IAACC,SAAAA,MAAA,EAAK,IAAI,SAAS,eAAa,MAC9B,UAAAD,2BAAAA;AAAAA,IAACE,SAAAA;AAAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,cAAY;AAAA,MACZ,SAAS;AAAA,MACT;AAAA,MACA,IAAI;AAAA,MAEH,UAAA,qDAAS,qBAAA,CAAA,CAAoB;AAAA,IAAA;AAAA,EAAA,GAElC;AAEJ;;;;"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
-
export type ScrollTopButtonPosition = 'bottom-right' | 'bottom-left' | 'bottom-center';
|
|
4
|
-
export interface ScrollTopButtonProps {
|
|
5
|
-
/**
|
|
6
|
-
* Distancia en px que hay que scrollear antes de mostrar el botón.
|
|
7
|
-
* Default: `300`.
|
|
8
|
-
*/
|
|
9
|
-
threshold?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Posición del botón en la pantalla. Default: `'bottom-right'`.
|
|
12
|
-
*/
|
|
13
|
-
position?: ScrollTopButtonPosition;
|
|
14
|
-
/**
|
|
15
|
-
* Elemento scrolleable a observar y al que se hace scrollTop. Si se omite,
|
|
16
|
-
* se usa `window` (caso más común).
|
|
17
|
-
*/
|
|
18
|
-
scrollTarget?: Window | HTMLElement | null;
|
|
19
|
-
/** Tamaño del FAB. Default: `'medium'`. */
|
|
20
|
-
size?: 'small' | 'medium' | 'large';
|
|
21
|
-
/**
|
|
22
|
-
* Color del FAB. Default: `'default'`.
|
|
23
|
-
*/
|
|
24
|
-
color?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error';
|
|
25
|
-
/** Icono custom. Default: `<KeyboardArrowUpIcon />`. */
|
|
26
|
-
icon?: ReactNode;
|
|
27
|
-
/** Texto accesible (aria-label). Default: `"Subir al inicio"`. */
|
|
28
|
-
ariaLabel?: string;
|
|
29
|
-
/** Preset registrado en `theme.styles.ScrollTopButton`. */
|
|
30
|
-
preset?: string;
|
|
31
|
-
/** sx del Fab. Se compone sobre la posición + preset. */
|
|
32
|
-
sx?: SxProps<Theme>;
|
|
33
|
-
className?: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Botón flotante que aparece tras scrollear más de `threshold` px y, al
|
|
37
|
-
* clickearse, hace scroll suave hasta el tope. Reemplaza al componente
|
|
38
|
-
* visible de `ScrollTopComponent` de Metronic.
|
|
39
|
-
*
|
|
40
|
-
* Para el caso imperativo (llamar `goTop()` tras una mutación), usar el
|
|
41
|
-
* helper `scrollToTop()` directamente.
|
|
42
|
-
*
|
|
43
|
-
* ```tsx
|
|
44
|
-
* <ScrollTopButton threshold={400} position="bottom-right" />
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare function ScrollTopButton({ threshold, position, scrollTarget, size, color, icon, ariaLabel, preset, sx, className, }: ScrollTopButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
-
export default ScrollTopButton;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from "react";
|
|
3
|
-
import { useTheme, Zoom, Fab } from "@mui/material";
|
|
4
|
-
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
5
|
-
import { r as resolvePreset } from "../../resolvePreset-K6_BfWHD.js";
|
|
6
|
-
function scrollToTop({
|
|
7
|
-
behavior = "smooth",
|
|
8
|
-
target = typeof window !== "undefined" ? window : void 0,
|
|
9
|
-
top = 0
|
|
10
|
-
} = {}) {
|
|
11
|
-
if (!target) return;
|
|
12
|
-
target.scrollTo({ top, left: 0, behavior });
|
|
13
|
-
}
|
|
14
|
-
const positionSx = {
|
|
15
|
-
"bottom-right": { position: "fixed", bottom: 24, right: 24 },
|
|
16
|
-
"bottom-left": { position: "fixed", bottom: 24, left: 24 },
|
|
17
|
-
"bottom-center": {
|
|
18
|
-
position: "fixed",
|
|
19
|
-
bottom: 24,
|
|
20
|
-
left: "50%",
|
|
21
|
-
transform: "translateX(-50%)"
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
function ScrollTopButton({
|
|
25
|
-
threshold = 300,
|
|
26
|
-
position = "bottom-right",
|
|
27
|
-
scrollTarget,
|
|
28
|
-
size = "medium",
|
|
29
|
-
color = "default",
|
|
30
|
-
icon,
|
|
31
|
-
ariaLabel = "Subir al inicio",
|
|
32
|
-
preset,
|
|
33
|
-
sx,
|
|
34
|
-
className
|
|
35
|
-
}) {
|
|
36
|
-
const theme = useTheme();
|
|
37
|
-
const [visible, setVisible] = useState(false);
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
const target = scrollTarget != null ? scrollTarget : typeof window !== "undefined" ? window : null;
|
|
40
|
-
if (!target) return;
|
|
41
|
-
const readScrollTop = () => target === window ? window.scrollY || document.documentElement.scrollTop : target.scrollTop;
|
|
42
|
-
const handleScroll = () => {
|
|
43
|
-
setVisible(readScrollTop() > threshold);
|
|
44
|
-
};
|
|
45
|
-
handleScroll();
|
|
46
|
-
target.addEventListener("scroll", handleScroll, { passive: true });
|
|
47
|
-
return () => target.removeEventListener("scroll", handleScroll);
|
|
48
|
-
}, [threshold, scrollTarget]);
|
|
49
|
-
const handleClick = () => {
|
|
50
|
-
scrollToTop({
|
|
51
|
-
target: scrollTarget != null ? scrollTarget : typeof window !== "undefined" ? window : void 0
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
const presetSx = resolvePreset("ScrollTopButton", preset, theme);
|
|
55
|
-
const mergedSx = [
|
|
56
|
-
positionSx[position],
|
|
57
|
-
{ zIndex: theme.zIndex.speedDial },
|
|
58
|
-
...presetSx ? [presetSx] : [],
|
|
59
|
-
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
60
|
-
];
|
|
61
|
-
return /* @__PURE__ */ jsx(Zoom, { in: visible, unmountOnExit: true, children: /* @__PURE__ */ jsx(
|
|
62
|
-
Fab,
|
|
63
|
-
{
|
|
64
|
-
size,
|
|
65
|
-
color,
|
|
66
|
-
"aria-label": ariaLabel,
|
|
67
|
-
onClick: handleClick,
|
|
68
|
-
className,
|
|
69
|
-
sx: mergedSx,
|
|
70
|
-
children: icon != null ? icon : /* @__PURE__ */ jsx(KeyboardArrowUpIcon, {})
|
|
71
|
-
}
|
|
72
|
-
) });
|
|
73
|
-
}
|
|
74
|
-
export {
|
|
75
|
-
ScrollTopButton,
|
|
76
|
-
ScrollTopButton as default,
|
|
77
|
-
scrollToTop
|
|
78
|
-
};
|
|
79
|
-
//# sourceMappingURL=ScrollTopButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollTopButton.js","sources":["../../../src/components/ScrollTopButton/scrollToTop.ts","../../../src/components/ScrollTopButton/ScrollTopButton.tsx"],"sourcesContent":["export interface ScrollToTopOptions {\n /** Comportamiento del scroll. Default: `'smooth'`. */\n behavior?: ScrollBehavior;\n /**\n * Elemento target del scroll. Default: `window`. Útil cuando el contenedor\n * scrolleable NO es `window` (p.ej. un `<Box>` con `overflow: auto`).\n */\n target?: Window | HTMLElement;\n /** Offset desde el top. Default: `0`. */\n top?: number;\n}\n\n/**\n * Reemplaza imperativamente a `ScrollTopComponent.goTop()` de Metronic.\n *\n * Llamar tras mutaciones / cambios de filtros / apertura de modales para\n * asegurar que el usuario vea el mensaje de confirmación en la parte\n * superior de la página.\n *\n * ```ts\n * // Reemplazo directo del legacy:\n * // Antes: ScrollTopComponent.goTop()\n * scrollToTop();\n *\n * // Con opciones:\n * scrollToTop({ behavior: 'auto' });\n * scrollToTop({ target: myScrollableRef.current });\n * ```\n */\nexport function scrollToTop({\n behavior = 'smooth',\n target = typeof window !== 'undefined' ? window : undefined,\n top = 0,\n}: ScrollToTopOptions = {}): void {\n if (!target) return;\n target.scrollTo({ top, left: 0, behavior });\n}\n","import React, { useEffect, useState, type ReactNode } from 'react';\nimport { Fab, Zoom, useTheme } from '@mui/material';\nimport KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';\nimport type { SxProps, Theme } from '@mui/material/styles';\n\nimport { resolvePreset } from '../_shared/resolvePreset';\nimport { scrollToTop } from './scrollToTop';\n\nexport type ScrollTopButtonPosition =\n | 'bottom-right'\n | 'bottom-left'\n | 'bottom-center';\n\nexport interface ScrollTopButtonProps {\n /**\n * Distancia en px que hay que scrollear antes de mostrar el botón.\n * Default: `300`.\n */\n threshold?: number;\n /**\n * Posición del botón en la pantalla. Default: `'bottom-right'`.\n */\n position?: ScrollTopButtonPosition;\n /**\n * Elemento scrolleable a observar y al que se hace scrollTop. Si se omite,\n * se usa `window` (caso más común).\n */\n scrollTarget?: Window | HTMLElement | null;\n /** Tamaño del FAB. Default: `'medium'`. */\n size?: 'small' | 'medium' | 'large';\n /**\n * Color del FAB. Default: `'default'`.\n */\n color?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error';\n /** Icono custom. Default: `<KeyboardArrowUpIcon />`. */\n icon?: ReactNode;\n /** Texto accesible (aria-label). Default: `\"Subir al inicio\"`. */\n ariaLabel?: string;\n /** Preset registrado en `theme.styles.ScrollTopButton`. */\n preset?: string;\n /** sx del Fab. Se compone sobre la posición + preset. */\n sx?: SxProps<Theme>;\n className?: string;\n}\n\nconst positionSx: Record<ScrollTopButtonPosition, SxProps<Theme>> = {\n 'bottom-right': { position: 'fixed', bottom: 24, right: 24 },\n 'bottom-left': { position: 'fixed', bottom: 24, left: 24 },\n 'bottom-center': {\n position: 'fixed',\n bottom: 24,\n left: '50%',\n transform: 'translateX(-50%)',\n },\n};\n\n/**\n * Botón flotante que aparece tras scrollear más de `threshold` px y, al\n * clickearse, hace scroll suave hasta el tope. Reemplaza al componente\n * visible de `ScrollTopComponent` de Metronic.\n *\n * Para el caso imperativo (llamar `goTop()` tras una mutación), usar el\n * helper `scrollToTop()` directamente.\n *\n * ```tsx\n * <ScrollTopButton threshold={400} position=\"bottom-right\" />\n * ```\n */\nexport function ScrollTopButton({\n threshold = 300,\n position = 'bottom-right',\n scrollTarget,\n size = 'medium',\n color = 'default',\n icon,\n ariaLabel = 'Subir al inicio',\n preset,\n sx,\n className,\n}: ScrollTopButtonProps) {\n const theme = useTheme();\n const [visible, setVisible] = useState(false);\n\n useEffect(() => {\n // Si viene scrollTarget explícito, usarlo; si no, window.\n const target: Window | HTMLElement | null =\n scrollTarget ?? (typeof window !== 'undefined' ? window : null);\n if (!target) return;\n\n const readScrollTop = () =>\n target === window\n ? window.scrollY || document.documentElement.scrollTop\n : (target as HTMLElement).scrollTop;\n\n const handleScroll = () => {\n setVisible(readScrollTop() > threshold);\n };\n\n handleScroll(); // check inicial por si ya estamos scrolleados\n target.addEventListener('scroll', handleScroll, { passive: true });\n return () => target.removeEventListener('scroll', handleScroll);\n }, [threshold, scrollTarget]);\n\n const handleClick = () => {\n scrollToTop({\n target: scrollTarget ?? (typeof window !== 'undefined' ? window : undefined),\n });\n };\n\n const presetSx = resolvePreset('ScrollTopButton', preset, theme);\n\n const mergedSx: SxProps<Theme> = [\n positionSx[position],\n { zIndex: theme.zIndex.speedDial },\n ...(presetSx ? [presetSx] : []),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n return (\n <Zoom in={visible} unmountOnExit>\n <Fab\n size={size}\n color={color}\n aria-label={ariaLabel}\n onClick={handleClick}\n className={className}\n sx={mergedSx}\n >\n {icon ?? <KeyboardArrowUpIcon />}\n </Fab>\n </Zoom>\n );\n}\n\nexport default ScrollTopButton;\n"],"names":[],"mappings":";;;;;AA6BO,SAAS,YAAY;AAAA,EAC1B,WAAW;AAAA,EACX,SAAS,OAAO,WAAW,cAAc,SAAS;AAAA,EAClD,MAAM;AACR,IAAwB,IAAU;AAChC,MAAI,CAAC,OAAQ;AACb,SAAO,SAAS,EAAE,KAAK,MAAM,GAAG,UAAU;AAC5C;ACSA,MAAM,aAA8D;AAAA,EAClE,gBAAgB,EAAE,UAAU,SAAS,QAAQ,IAAI,OAAO,GAAA;AAAA,EACxD,eAAe,EAAE,UAAU,SAAS,QAAQ,IAAI,MAAM,GAAA;AAAA,EACtD,iBAAiB;AAAA,IACf,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,WAAW;AAAA,EAAA;AAEf;AAcO,SAAS,gBAAgB;AAAA,EAC9B,YAAY;AAAA,EACZ,WAAW;AAAA,EACX;AAAA,EACA,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,QAAQ,SAAA;AACd,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAE5C,YAAU,MAAM;AAEd,UAAM,SACJ,sCAAiB,OAAO,WAAW,cAAc,SAAS;AAC5D,QAAI,CAAC,OAAQ;AAEb,UAAM,gBAAgB,MACpB,WAAW,SACP,OAAO,WAAW,SAAS,gBAAgB,YAC1C,OAAuB;AAE9B,UAAM,eAAe,MAAM;AACzB,iBAAW,cAAA,IAAkB,SAAS;AAAA,IACxC;AAEA,iBAAA;AACA,WAAO,iBAAiB,UAAU,cAAc,EAAE,SAAS,MAAM;AACjE,WAAO,MAAM,OAAO,oBAAoB,UAAU,YAAY;AAAA,EAChE,GAAG,CAAC,WAAW,YAAY,CAAC;AAE5B,QAAM,cAAc,MAAM;AACxB,gBAAY;AAAA,MACV,QAAQ,sCAAiB,OAAO,WAAW,cAAc,SAAS;AAAA,IAAA,CACnE;AAAA,EACH;AAEA,QAAM,WAAW,cAAc,mBAAmB,QAAQ,KAAK;AAE/D,QAAM,WAA2B;AAAA,IAC/B,WAAW,QAAQ;AAAA,IACnB,EAAE,QAAQ,MAAM,OAAO,UAAA;AAAA,IACvB,GAAI,WAAW,CAAC,QAAQ,IAAI,CAAA;AAAA,IAC5B,GAAI,MAAM,QAAQ,EAAE,IAAI,KAAK,KAAK,CAAC,EAAE,IAAI,CAAA;AAAA,EAAC;AAG5C,SACE,oBAAC,MAAA,EAAK,IAAI,SAAS,eAAa,MAC9B,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,cAAY;AAAA,MACZ,SAAS;AAAA,MACT;AAAA,MACA,IAAI;AAAA,MAEH,UAAA,0CAAS,qBAAA,CAAA,CAAoB;AAAA,IAAA;AAAA,EAAA,GAElC;AAEJ;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const SimpleSelectDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Box, Typography } from '@mui/material';\n\nconst basicOptions = [\n { value: '10', label: '10' },\n { value: '25', label: '25' },\n { value: '50', label: '50' },\n { value: '100', label: '100' },\n];\n\nexport const SimpleSelectExample = () => {\n const [value, setValue] = useState<string>('25');\n return (\n <Box sx={{ width: 200 }}>\n <Select\n label=\"Registros por p\u00E1gina\"\n options={basicOptions}\n value={value}\n onChange={(val) => setValue(val as string)}\n maxWidth={150}\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>\n </Box>\n );\n};\n";
|
|
2
|
-
export declare const MultiSelectDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Box, Typography } from '@mui/material';\n\nexport const MultiSelectExample = () => {\n const [value, setValue] = useState<string[]>([]);\n return (\n <Box sx={{ width: 400 }}>\n <Select\n label=\"Seleccionar estados\"\n multiple\n maxChipsToShow={2}\n options={[\n { value: 'pending', label: 'Pendiente' },\n { value: 'approved', label: 'Aprobado' },\n { value: 'rejected', label: 'Rechazado' },\n { value: 'canceled', label: 'Cancelado' },\n { value: 'completed', label: 'Completado' },\n { value: 'invoiced', label: 'Facturado' },\n ]}\n value={value}\n onChange={(val) => setValue(val as string[])}\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {JSON.stringify(value)}</Typography>\n </Box>\n );\n};\n";
|
|
3
|
-
export declare const WithPlaceholderDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Box, Typography } from '@mui/material';\n\nconst basicOptions = [\n { value: '10', label: '10' },\n { value: '25', label: '25' },\n { value: '50', label: '50' },\n { value: '100', label: '100' },\n];\n\nexport const WithPlaceholderExample = () => {\n const [value, setValue] = useState('');\n return (\n <Box sx={{ width: 300 }}>\n <Select\n label=\"Seleccione una opci\u00F3n\"\n options={basicOptions}\n value={value}\n onChange={(val) => setValue(val as string)}\n placeholder=\"Ninguna opci\u00F3n seleccionada\"\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {value || 'Ninguno'}</Typography>\n </Box>\n );\n};\n";
|
|
4
|
-
export declare const WithFilterDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Box, Typography } from '@mui/material';\n\nconst groupedOptions = [\n { value: 'gt', label: 'Guatemala', group: 'Centroam\u00E9rica' },\n { value: 'sv', label: 'El Salvador', group: 'Centroam\u00E9rica' },\n { value: 'mx', label: 'M\u00E9xico', group: 'Norteam\u00E9rica' },\n { value: 'us', label: 'EE.UU.', group: 'Norteam\u00E9rica' },\n];\n\nexport const WithFilterExample = () => {\n const [value, setValue] = useState('');\n return (\n <Box sx={{ width: 300 }}>\n <Select\n label=\"Buscar pa\u00EDs\"\n filterable\n options={groupedOptions}\n value={value}\n onChange={(val) => setValue(val as string)}\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>\n </Box>\n );\n};\n";
|
|
5
|
-
export declare const WithGroupDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Box, Typography } from '@mui/material';\n\nconst groupedOptions = [\n { value: 'gt', label: 'Guatemala', group: 'Centroam\u00E9rica' },\n { value: 'sv', label: 'El Salvador', group: 'Centroam\u00E9rica' },\n { value: 'mx', label: 'M\u00E9xico', group: 'Norteam\u00E9rica' },\n { value: 'us', label: 'EE.UU.', group: 'Norteam\u00E9rica' },\n];\n\nexport const WithGroupExample = () => {\n const [value, setValue] = useState('');\n return (\n <Box sx={{ width: 300 }}>\n <Select\n label=\"Pa\u00EDs por regi\u00F3n\"\n options={groupedOptions}\n value={value}\n onChange={(val) => setValue(val as string)}\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>\n </Box>\n );\n};\n";
|
|
6
|
-
export declare const CustomRenderWithAvatarDefinition = "\nimport React, { useState } from 'react';\nimport { Select, Option } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Avatar, Box, Typography } from '@mui/material';\n\nconst userOptions = [\n { value: 'admin', label: 'Administrador', img: 'https://placehold.co/40x40?text=A' },\n { value: 'user', label: 'Usuario', img: 'https://placehold.co/40x40?text=U' },\n];\n\nexport const CustomRenderWithAvatarExample = () => {\n const [value, setValue] = useState<string[]>([]);\n return (\n <Box sx={{ width: 300 }}>\n <Select\n options={userOptions}\n multiple\n value={value}\n onChange={(val) => setValue(val as string[])}\n label=\"Usuarios\"\n placeholder=\"Selecciona usuarios\"\n >\n <Option>\n {({ img, label }) => (\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>\n <Avatar src={img} sx={{ width: 24, height: 24 }} />\n <Typography variant=\"body2\">{label}</Typography>\n </Box>\n )}\n </Option>\n </Select>\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {JSON.stringify(value)}</Typography>\n </Box>\n );\n};\n";
|
|
7
|
-
export declare const MultiSelectCustomChipRenderDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Box, Typography, Chip } from '@mui/material';\n\nconst transactionStatuses = [\n { value: 'PENDING', label: 'Pendiente' },\n { value: 'REJECTED', label: 'Rechazado' },\n { value: 'CANCELED', label: 'Cancelado' },\n { value: 'REFUNDED', label: 'Reembolsado' },\n { value: 'COMPLETED', label: 'Completado' },\n { value: 'EXPIRED', label: 'Expirado' },\n];\n\nexport const MultiSelectCustomChipRenderExample = () => {\n const [value, setValue] = useState<string[]>(['pending', 'approved', 'rejected', 'canceled']);\n return (\n <Box sx={{ width: 400 }}>\n <Select\n label=\"Estados de Transacci\u00F3n\"\n multiple\n maxChipsToShow={3}\n options={transactionStatuses}\n value={value}\n onChange={(val) => setValue(val as string[])}\n placeholder=\"Selecciona estados\"\n renderChipLabel={(item) => (\n <Typography variant=\"caption\" sx={{ fontWeight: 'bold' }}>\n {item.label.charAt(0).toUpperCase()}\n </Typography>\n )}\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {JSON.stringify(value)}</Typography>\n </Box>\n );\n};\n";
|
|
8
|
-
export declare const MultiSelectCustomChipRenderFullLabelDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Avatar, Box, Typography } from '@mui/material';\n\nconst groupedOptions = [\n { value: 'gt', label: 'Guatemala', group: 'Centroam\u00E9rica' },\n { value: 'sv', label: 'El Salvador', group: 'Centroam\u00E9rica' },\n { value: 'mx', label: 'M\u00E9xico', group: 'Norteam\u00E9rica' },\n { value: 'us', label: 'EE.UU.', group: 'Norteam\u00E9rica' },\n { value: 'ca', label: 'Canad\u00E1', group: 'Norteam\u00E9rica' },\n { value: 'br', label: 'Brasil', group: 'Sudam\u00E9rica' },\n { value: 'ar', label: 'Argentina', group: 'Sudam\u00E9rica' },\n];\n\nexport const MultiSelectCustomChipRenderFullLabelExample = () => {\n const [value, setValue] = useState<string[]>(['gt', 'mx', 'us', 'ca', 'br']);\n return (\n <Box sx={{ width: 400 }}>\n <Select\n label=\"Pa\u00EDses seleccionados\"\n multiple\n maxChipsToShow={3}\n options={groupedOptions}\n value={value}\n onChange={(val) => setValue(val as string[])}\n placeholder=\"Selecciona pa\u00EDses\"\n renderChipLabel={(item) => (\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>\n {item.img && <Avatar src={item.img} sx={{ width: 18, height: 18 }} />}\n <Typography variant=\"caption\" sx={{ fontWeight: 'medium' }}>\n {item.label}\n </Typography>\n </Box>\n )}\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {JSON.stringify(value)}</Typography>\n </Box>\n );\n};\n";
|
|
9
|
-
export declare const ConstrainedHeightDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Box, Typography } from '@mui/material';\n\nconst optionsWithManyItems = [\n { value: 'gt', label: 'Guatemala' }, { value: 'sv', label: 'El Salvador' },\n { value: 'mx', label: 'M\u00E9xico' }, { value: 'us', label: 'EE.UU.' },\n { value: 'ca', label: 'Canad\u00E1' }, { value: 'br', label: 'Brasil' },\n { value: 'ar', label: 'Argentina' }, { value: 'cl', label: 'Chile' },\n { value: 'co', label: 'Colombia' }, { value: 'pe', label: 'Per\u00FA' },\n { value: 'ec', label: 'Ecuador' }, { value: 've', label: 'Venezuela' },\n { value: 'py', label: 'Paraguay' }, { value: 'uy', label: 'Uruguay' },\n { value: 'bo', label: 'Bolivia' }, { value: 'cr', label: 'Costa Rica' },\n { value: 'pa', label: 'Panam\u00E1' }, { value: 'hn', label: 'Honduras' },\n { value: 'ni', label: 'Nicaragua' }, { value: 'do', label: 'Rep. Dominicana' },\n { value: 'cu', label: 'Cuba' }, { value: 'pr', label: 'Puerto Rico' },\n { value: 'es', label: 'Espa\u00F1a' }, { value: 'fr', label: 'Francia' },\n { value: 'de', label: 'Alemania' }, { value: 'it', label: 'Italia' },\n];\n\nexport const ConstrainedHeightExample = () => {\n const [value, setValue] = useState('');\n return (\n <Box sx={{ width: 300 }}>\n <Select\n label=\"Opciones (Altura Limitada)\"\n options={optionsWithManyItems}\n value={value}\n onChange={(val) => setValue(val as string)}\n maxHeight={150}\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>\n </Box>\n );\n};\n";
|
|
10
|
-
export declare const ConstrainedWidthDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Box, Typography } from '@mui/material';\n\nconst basicOptions = [\n { value: '10', label: '10' },\n { value: '25', label: '25' },\n];\nconst groupedOptions = [\n { value: 'gt', label: 'Guatemala', group: 'Centroam\u00E9rica' },\n { value: 'sv', label: 'El Salvador', group: 'Centroam\u00E9rica' },\n];\n\nexport const ConstrainedWidthExample = () => {\n const [value, setValue] = useState('');\n return (\n <Box sx={{ width: 200 }}>\n <Select\n label=\"Opciones (Ancho Limitado)\"\n options={basicOptions.concat(groupedOptions)}\n value={value}\n onChange={(val) => setValue(val as string)}\n maxWidth={100}\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>\n </Box>\n );\n};\n";
|
|
11
|
-
export declare const AllFeaturesCombinedDefinition = "\nimport React, { useState } from 'react';\nimport { Select, Option } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Avatar, Box, Typography, Chip } from '@mui/material';\n\nconst allOptions = [\n { value: 'gt', label: 'Guatemala', group: 'Centroam\u00E9rica' },\n { value: 'admin', label: 'Administrador', img: 'https://placehold.co/40x40?text=A' },\n { value: 'PENDING', label: 'Pendiente' },\n { value: 'ca', label: 'Canad\u00E1', group: 'Norteam\u00E9rica' },\n { value: 'user', label: 'Usuario', img: 'https://placehold.co/40x40?text=U' },\n { value: 'COMPLETED', label: 'Completado' },\n];\n\nexport const AllFeaturesCombinedExample = () => {\n const [value, setValue] = useState<string[]>(['gt', 'admin', 'PENDING', 'ca', 'user', 'COMPLETED']);\n return (\n <Box sx={{ width: 500 }}>\n <Select\n label=\"Selecci\u00F3n Completa\"\n multiple\n filterable\n maxChipsToShow={3}\n maxHeight={250}\n maxWidth=\"400px\"\n options={allOptions}\n value={value}\n onChange={(val) => setValue(val as string[])}\n placeholder=\"Busca y selecciona todo tipo de elementos\"\n renderChipLabel={(item) => (\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>\n {item.img && <Avatar src={item.img} sx={{ width: 16, height: 16 }} />}\n <Typography variant=\"caption\" sx={{ fontWeight: 'bold' }}>\n {item.label.length > 10 ? item.label.substring(0, 7) + '...' : item.label}\n </Typography>\n </Box>\n )}\n >\n <Option>\n {(item) => (\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, my: 0.5 }}>\n {item.img && <Avatar src={item.img} sx={{ width: 28, height: 28 }} />}\n <Box>\n <Typography variant=\"body2\" fontWeight=\"medium\">{item.label}</Typography>\n {item.group && (\n <Typography variant=\"caption\" color=\"text.secondary\">\n Grupo: {item.group}\n </Typography>\n )}\n {item.disabled && <Chip label=\"No disponible\" size=\"small\" color=\"warning\" sx={{ ml: 1 }} />}\n </Box>\n </Box>\n )}\n </Option>\n </Select>\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {JSON.stringify(value)}</Typography>\n </Box>\n );\n};\n";
|
|
12
|
-
export declare const EmptyOptionsDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Box, Typography } from '@mui/material';\n\nexport const EmptyOptionsExample = () => {\n const [value, setValue] = useState(null);\n return (\n <Box sx={{ width: 300 }}>\n <Select\n label=\"Seleccionar (Vac\u00EDo)\"\n options={[]}\n value={value}\n onChange={setValue}\n placeholder=\"No hay opciones disponibles\"\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {value || 'Ninguno'}</Typography>\n </Box>\n );\n};\n";
|
|
13
|
-
export declare const SelectWithManyOptionsDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select'; // Asumiendo que Select.tsx est\u00E1 en el mismo directorio\nimport { Box, Typography } from '@mui/material';\n\nconst manyOptions = Array.from({ length: 50 }, (_, i) => ({\n value: `option-${i}`,\n label: `Opci\u00F3n ${i + 1}`,\n group: i < 25 ? 'Grupo A' : 'Grupo B',\n}));\n\nexport const SelectWithManyOptionsExample = () => {\n const [value, setValue] = useState('');\n return (\n <Box sx={{ width: 300 }}>\n <Select\n label=\"Muchas Opciones\"\n options={manyOptions}\n value={value}\n onChange={(val) => setValue(val as string)}\n filterable\n maxHeight={200}\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>\n </Box>\n );\n};\n";
|
|
14
|
-
export declare const LabelPositionFloatingDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select';\nimport { Box, Typography } from '@mui/material';\n\nconst basicOptions = [\n { value: '10', label: '10' },\n { value: '25', label: '25' },\n { value: '50', label: '50' },\n { value: '100', label: '100' },\n];\n\nexport const LabelPositionFloatingExample = () => {\n const [value, setValue] = useState('');\n return (\n <Box sx={{ width: 300 }}>\n <Select\n label=\"Label flotante (MUI nativo)\"\n options={basicOptions}\n value={value}\n onChange={(val) => setValue(val as string)}\n labelPosition=\"floating\"\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {value || 'Ninguno'}</Typography>\n </Box>\n );\n};\n";
|
|
15
|
-
export declare const CustomBorderRadiusDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select';\nimport { Box } from '@mui/material';\n\nconst basicOptions = [\n { value: '10', label: '10' },\n { value: '25', label: '25' },\n { value: '50', label: '50' },\n { value: '100', label: '100' },\n];\n\nexport const CustomBorderRadiusExample = () => {\n const [valueA, setValueA] = useState('25');\n const [valueB, setValueB] = useState('25');\n const [valueC, setValueC] = useState('25');\n return (\n <Box sx={{ width: 300, display: 'flex', flexDirection: 'column', gap: 2 }}>\n <Select\n label=\"Sin border radius\"\n options={basicOptions}\n value={valueA}\n onChange={(val) => setValueA(val as string)}\n borderRadius={0}\n />\n <Select\n label=\"Border radius est\u00E1ndar\"\n options={basicOptions}\n value={valueB}\n onChange={(val) => setValueB(val as string)}\n borderRadius={10}\n />\n <Select\n label=\"Pill-shaped\"\n options={basicOptions}\n value={valueC}\n onChange={(val) => setValueC(val as string)}\n borderRadius={999}\n />\n </Box>\n );\n};\n";
|
|
16
|
-
export declare const CustomStylingDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select';\nimport { Box, Typography } from '@mui/material';\n\nconst userOptions = [\n { value: 'admin', label: 'Administrador', img: 'https://placehold.co/40x40?text=A' },\n { value: 'user', label: 'Usuario', img: 'https://placehold.co/40x40?text=U' },\n { value: 'moderator', label: 'Moderador', img: 'https://placehold.co/40x40?text=M' },\n];\n\nexport const CustomStylingExample = () => {\n const [value, setValue] = useState<string[]>(['admin']);\n return (\n <Box sx={{ width: 360 }}>\n <Select\n label=\"Select con estilos personalizados\"\n options={userOptions}\n multiple\n value={value}\n onChange={(val) => setValue(val as string[])}\n placeholder=\"Selecciona usuarios\"\n sx={{\n '& .MuiInputBase-root': {\n backgroundColor: 'action.hover',\n },\n '& .MuiOutlinedInput-notchedOutline': {\n borderColor: 'primary.main',\n borderWidth: '2px',\n },\n '&:hover .MuiOutlinedInput-notchedOutline': {\n borderColor: 'primary.dark',\n },\n }}\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {JSON.stringify(value)}</Typography>\n </Box>\n );\n};\n";
|
|
17
|
-
export declare const AsyncSelectDefinition = "\nimport React, { useState } from 'react';\nimport { Select } from './Select';\nimport { Box, Typography } from '@mui/material';\n\nconst mockAsyncOptions = [\n { value: 'apple', label: 'Apple' },\n { value: 'banana', label: 'Banana' },\n { value: 'orange', label: 'Orange' },\n { value: 'grape', label: 'Grape' },\n { value: 'strawberry', label: 'Strawberry' },\n { value: 'blueberry', label: 'Blueberry' },\n { value: 'pineapple', label: 'Pineapple' },\n];\n\n// Simulate an API call\nconst simulatedLoadOptions = (inputValue: string): Promise<any[]> => {\n return new Promise((resolve) => {\n setTimeout(() => {\n const filtered = mockAsyncOptions.filter(option =>\n option.label.toLowerCase().includes(inputValue.toLowerCase())\n );\n resolve(filtered);\n }, 800); // Simulate network delay\n });\n};\n\nexport const AsyncSelectExample = () => {\n const [value, setValue] = useState('');\n return (\n <Box sx={{ width: 300 }}>\n <Select\n label=\"Buscar Frutas\"\n loadOptions={simulatedLoadOptions}\n value={value}\n onChange={(val) => setValue(val as string)}\n placeholder=\"Escribe para buscar...\"\n loadingMessage=\"Buscando frutas...\"\n noOptionsMessage=\"No se encontraron frutas.\"\n />\n <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>\n </Box>\n );\n};\n";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { SelectOption, LabelPosition, ChipVariant, SelectSize, RenderOptionItem, RenderChipLabel, OptionProps, BaseSelectProps, RHFSelectProps, StandardSelectProps, SelectProps, } from './Select';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
interface SelectSearchHeaderProps {
|
|
3
|
-
value: string;
|
|
4
|
-
onChange: (next: string) => void;
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
inputRef?: React.Ref<HTMLInputElement>;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Header sticky del menu del Select que contiene el input de búsqueda.
|
|
10
|
-
* Se usa cuando `filterable` es true o cuando el Select opera en modo async.
|
|
11
|
-
* Detiene la propagación de click/keydown para que el menu no se cierre ni
|
|
12
|
-
* intercepte las teclas al tipear.
|
|
13
|
-
*/
|
|
14
|
-
export declare const SelectSearchHeader: React.FC<SelectSearchHeaderProps>;
|
|
15
|
-
export default SelectSearchHeader;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formField.sx-CQ1mbk9M.cjs","sources":["../src/theme/tokens.ts","../src/components/_shared/formField.sx.ts"],"sourcesContent":["/**\n * Design tokens compartidos por los componentes de formulario\n * (Input, Select, Autocomplete, DatePicker, DateTimePicker).\n *\n * Centralizar estos valores garantiza que:\n * - el espaciado, la tipografía y las animaciones del label sean idénticos\n * en todos los campos;\n * - un cambio visual global (p.ej. cambiar el transform del shrink) se haga\n * en un único archivo.\n */\n\n// ── Spacing ──────────────────────────────────────────────────────────────\n/** Margen superior que deja el aire para el label flotante \"outside\". */\nexport const LABEL_MARGIN_TOP = '14px';\n\n/** Padding vertical interno del input (TextField/Select/Picker sections). */\nexport const FIELD_INPUT_PADDING_Y = '8.5px';\n\n// ── Label animation ──────────────────────────────────────────────────────\n/** Transform que aplica el label cuando sube arriba del input (shrink). */\nexport const LABEL_SHRINK_TRANSFORM = 'translate(4px, -22px) scale(0.85)';\n\n/** Origen del transform para el shrink. */\nexport const LABEL_TRANSFORM_ORIGIN = 'top left';\n\n/** Transición del label (color + transform + max-width). */\nexport const LABEL_TRANSITION =\n 'color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms, ' +\n 'transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms, ' +\n 'max-width 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms';\n\n// ── Label colors (theme-aware) ───────────────────────────────────────────\n/** Color del label en reposo. */\nexport const LABEL_COLOR_REST = 'text.secondary';\n\n/** Color del label cuando el campo tiene valor (shrink). */\nexport const LABEL_COLOR_FILLED = 'text.primary';\n\n/** Color del label cuando el campo está focused. */\nexport const LABEL_COLOR_FOCUSED = 'primary.main';\n\n/** Peso del label cuando sube (filled/focused). */\nexport const LABEL_FONT_WEIGHT_FILLED = 500;\n","import type { SxProps, Theme } from '@mui/material/styles';\n\nimport {\n LABEL_COLOR_FILLED,\n LABEL_COLOR_FOCUSED,\n LABEL_COLOR_REST,\n LABEL_FONT_WEIGHT_FILLED,\n LABEL_MARGIN_TOP,\n LABEL_SHRINK_TRANSFORM,\n LABEL_TRANSFORM_ORIGIN,\n LABEL_TRANSITION,\n} from '../../theme/tokens';\n\nexport type LabelPosition = 'outside' | 'floating';\n\nexport interface BuildFormFieldSxOptions {\n borderRadius: number | string;\n labelPosition: LabelPosition;\n /**\n * Si es `true`, los selectores incluyen también la API nueva de MUI X\n * Pickers (v8): `MuiPickersInputBase-root`, `MuiPickersOutlinedInput-*`.\n */\n includePickersApi?: boolean;\n /**\n * Selectores/valores extra que se mergean SOLO cuando labelPosition === 'outside'.\n * Usar para paddings específicos del componente (p.ej. MuiAutocomplete-input).\n */\n extraOutsideSx?: Record<string, any>;\n /**\n * Selectores/valores extra que se mergean SOLO cuando labelPosition === 'floating'.\n */\n extraFloatingSx?: Record<string, any>;\n}\n\nconst toRadius = (borderRadius: number | string) =>\n typeof borderRadius === 'number' ? `${borderRadius}px` : borderRadius;\n\n/**\n * Builder del sx compartido por todos los campos de formulario\n * (Input/Select/Autocomplete/DatePicker/DateTimePicker).\n *\n * Produce:\n * - en modo \"floating\": sólo el border-radius del outlined input;\n * - en modo \"outside\": todo el pack (margen superior, label flotante afuera,\n * input base, notched outline oculto, helper text sin margen izquierdo).\n *\n * Componentes con paddings o selectores propios pueden inyectarlos vía\n * `extraOutsideSx` / `extraFloatingSx`.\n */\nexport const buildFormFieldSx = ({\n borderRadius,\n labelPosition,\n includePickersApi = false,\n extraOutsideSx,\n extraFloatingSx,\n}: BuildFormFieldSxOptions): SxProps<Theme> => {\n const radius = toRadius(borderRadius);\n\n // ── Selectores (alternan según la API de pickers) ────────────────────\n const outlinedRootSelector = includePickersApi\n ? '& .MuiOutlinedInput-root, & .MuiPickersOutlinedInput-root'\n : '& .MuiOutlinedInput-root';\n\n const inputBaseSelector = includePickersApi\n ? '& .MuiInputBase-root, & .MuiPickersInputBase-root'\n : '& .MuiInputBase-root';\n\n const notchedOutlineSelector = includePickersApi\n ? '& .MuiOutlinedInput-notchedOutline, & .MuiPickersOutlinedInput-notchedOutline'\n : '& .MuiOutlinedInput-notchedOutline';\n\n // ── Floating ─────────────────────────────────────────────────────────\n if (labelPosition === 'floating') {\n return {\n [outlinedRootSelector]: { borderRadius: radius },\n ...(extraFloatingSx ?? {}),\n };\n }\n\n // ── Outside ──────────────────────────────────────────────────────────\n return {\n marginTop: LABEL_MARGIN_TOP,\n\n '& .MuiInputLabel-root': {\n color: LABEL_COLOR_REST,\n transition: LABEL_TRANSITION,\n\n // Estado shrunk (focused o con valor): flota ARRIBA del input.\n '&.MuiInputLabel-shrink': {\n transform: LABEL_SHRINK_TRANSFORM,\n transformOrigin: LABEL_TRANSFORM_ORIGIN,\n color: LABEL_COLOR_FILLED,\n fontWeight: LABEL_FONT_WEIGHT_FILLED,\n },\n\n '&.Mui-focused': { color: LABEL_COLOR_FOCUSED },\n },\n\n // Input base — centra verticalmente (clásico y, si aplica, pickers).\n [inputBaseSelector]: {\n borderRadius: radius,\n display: 'flex',\n alignItems: 'center',\n },\n\n // El label flota afuera: ocultar legend del notch.\n [notchedOutlineSelector]: {\n top: 0,\n '& legend': { display: 'none' },\n },\n\n '& .MuiFormHelperText-root': {\n marginLeft: 0,\n },\n\n ...(extraOutsideSx ?? {}),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAaO,MAAM,mBAAmB;AAGzB,MAAM,wBAAwB;AAI9B,MAAM,yBAAyB;AAG/B,MAAM,yBAAyB;AAG/B,MAAM,mBACX;AAMK,MAAM,mBAAmB;AAGzB,MAAM,qBAAqB;AAG3B,MAAM,sBAAsB;AAG5B,MAAM,2BAA2B;ACRxC,MAAM,WAAW,CAAC,iBAChB,OAAO,iBAAiB,WAAW,GAAG,YAAY,OAAO;AAcpD,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB;AAAA,EACA;AACF,MAA+C;AAC7C,QAAM,SAAS,SAAS,YAAY;AAGpC,QAAM,uBAAuB,oBACzB,8DACA;AAEJ,QAAM,oBAAoB,oBACtB,sDACA;AAEJ,QAAM,yBAAyB,oBAC3B,kFACA;AAGJ,MAAI,kBAAkB,YAAY;AAChC,WAAO;AAAA,MACL,CAAC,oBAAoB,GAAG,EAAE,cAAc,OAAA;AAAA,OACpC,4CAAmB,CAAA;AAAA,EAE3B;AAGA,SAAO;AAAA,IACL,WAAW;AAAA,IAEX,yBAAyB;AAAA,MACvB,OAAO;AAAA,MACP,YAAY;AAAA;AAAA,MAGZ,0BAA0B;AAAA,QACxB,WAAW;AAAA,QACX,iBAAiB;AAAA,QACjB,OAAO;AAAA,QACP,YAAY;AAAA,MAAA;AAAA,MAGd,iBAAiB,EAAE,OAAO,oBAAA;AAAA,IAAoB;AAAA;AAAA,IAIhD,CAAC,iBAAiB,GAAG;AAAA,MACnB,cAAc;AAAA,MACd,SAAS;AAAA,MACT,YAAY;AAAA,IAAA;AAAA;AAAA,IAId,CAAC,sBAAsB,GAAG;AAAA,MACxB,KAAK;AAAA,MACL,YAAY,EAAE,SAAS,OAAA;AAAA,IAAO;AAAA,IAGhC,6BAA6B;AAAA,MAC3B,YAAY;AAAA,IAAA;AAAA,KAGV,0CAAkB,CAAA;AAE1B;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formField.sx-DfVbMe0V.js","sources":["../src/theme/tokens.ts","../src/components/_shared/formField.sx.ts"],"sourcesContent":["/**\n * Design tokens compartidos por los componentes de formulario\n * (Input, Select, Autocomplete, DatePicker, DateTimePicker).\n *\n * Centralizar estos valores garantiza que:\n * - el espaciado, la tipografía y las animaciones del label sean idénticos\n * en todos los campos;\n * - un cambio visual global (p.ej. cambiar el transform del shrink) se haga\n * en un único archivo.\n */\n\n// ── Spacing ──────────────────────────────────────────────────────────────\n/** Margen superior que deja el aire para el label flotante \"outside\". */\nexport const LABEL_MARGIN_TOP = '14px';\n\n/** Padding vertical interno del input (TextField/Select/Picker sections). */\nexport const FIELD_INPUT_PADDING_Y = '8.5px';\n\n// ── Label animation ──────────────────────────────────────────────────────\n/** Transform que aplica el label cuando sube arriba del input (shrink). */\nexport const LABEL_SHRINK_TRANSFORM = 'translate(4px, -22px) scale(0.85)';\n\n/** Origen del transform para el shrink. */\nexport const LABEL_TRANSFORM_ORIGIN = 'top left';\n\n/** Transición del label (color + transform + max-width). */\nexport const LABEL_TRANSITION =\n 'color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms, ' +\n 'transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms, ' +\n 'max-width 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms';\n\n// ── Label colors (theme-aware) ───────────────────────────────────────────\n/** Color del label en reposo. */\nexport const LABEL_COLOR_REST = 'text.secondary';\n\n/** Color del label cuando el campo tiene valor (shrink). */\nexport const LABEL_COLOR_FILLED = 'text.primary';\n\n/** Color del label cuando el campo está focused. */\nexport const LABEL_COLOR_FOCUSED = 'primary.main';\n\n/** Peso del label cuando sube (filled/focused). */\nexport const LABEL_FONT_WEIGHT_FILLED = 500;\n","import type { SxProps, Theme } from '@mui/material/styles';\n\nimport {\n LABEL_COLOR_FILLED,\n LABEL_COLOR_FOCUSED,\n LABEL_COLOR_REST,\n LABEL_FONT_WEIGHT_FILLED,\n LABEL_MARGIN_TOP,\n LABEL_SHRINK_TRANSFORM,\n LABEL_TRANSFORM_ORIGIN,\n LABEL_TRANSITION,\n} from '../../theme/tokens';\n\nexport type LabelPosition = 'outside' | 'floating';\n\nexport interface BuildFormFieldSxOptions {\n borderRadius: number | string;\n labelPosition: LabelPosition;\n /**\n * Si es `true`, los selectores incluyen también la API nueva de MUI X\n * Pickers (v8): `MuiPickersInputBase-root`, `MuiPickersOutlinedInput-*`.\n */\n includePickersApi?: boolean;\n /**\n * Selectores/valores extra que se mergean SOLO cuando labelPosition === 'outside'.\n * Usar para paddings específicos del componente (p.ej. MuiAutocomplete-input).\n */\n extraOutsideSx?: Record<string, any>;\n /**\n * Selectores/valores extra que se mergean SOLO cuando labelPosition === 'floating'.\n */\n extraFloatingSx?: Record<string, any>;\n}\n\nconst toRadius = (borderRadius: number | string) =>\n typeof borderRadius === 'number' ? `${borderRadius}px` : borderRadius;\n\n/**\n * Builder del sx compartido por todos los campos de formulario\n * (Input/Select/Autocomplete/DatePicker/DateTimePicker).\n *\n * Produce:\n * - en modo \"floating\": sólo el border-radius del outlined input;\n * - en modo \"outside\": todo el pack (margen superior, label flotante afuera,\n * input base, notched outline oculto, helper text sin margen izquierdo).\n *\n * Componentes con paddings o selectores propios pueden inyectarlos vía\n * `extraOutsideSx` / `extraFloatingSx`.\n */\nexport const buildFormFieldSx = ({\n borderRadius,\n labelPosition,\n includePickersApi = false,\n extraOutsideSx,\n extraFloatingSx,\n}: BuildFormFieldSxOptions): SxProps<Theme> => {\n const radius = toRadius(borderRadius);\n\n // ── Selectores (alternan según la API de pickers) ────────────────────\n const outlinedRootSelector = includePickersApi\n ? '& .MuiOutlinedInput-root, & .MuiPickersOutlinedInput-root'\n : '& .MuiOutlinedInput-root';\n\n const inputBaseSelector = includePickersApi\n ? '& .MuiInputBase-root, & .MuiPickersInputBase-root'\n : '& .MuiInputBase-root';\n\n const notchedOutlineSelector = includePickersApi\n ? '& .MuiOutlinedInput-notchedOutline, & .MuiPickersOutlinedInput-notchedOutline'\n : '& .MuiOutlinedInput-notchedOutline';\n\n // ── Floating ─────────────────────────────────────────────────────────\n if (labelPosition === 'floating') {\n return {\n [outlinedRootSelector]: { borderRadius: radius },\n ...(extraFloatingSx ?? {}),\n };\n }\n\n // ── Outside ──────────────────────────────────────────────────────────\n return {\n marginTop: LABEL_MARGIN_TOP,\n\n '& .MuiInputLabel-root': {\n color: LABEL_COLOR_REST,\n transition: LABEL_TRANSITION,\n\n // Estado shrunk (focused o con valor): flota ARRIBA del input.\n '&.MuiInputLabel-shrink': {\n transform: LABEL_SHRINK_TRANSFORM,\n transformOrigin: LABEL_TRANSFORM_ORIGIN,\n color: LABEL_COLOR_FILLED,\n fontWeight: LABEL_FONT_WEIGHT_FILLED,\n },\n\n '&.Mui-focused': { color: LABEL_COLOR_FOCUSED },\n },\n\n // Input base — centra verticalmente (clásico y, si aplica, pickers).\n [inputBaseSelector]: {\n borderRadius: radius,\n display: 'flex',\n alignItems: 'center',\n },\n\n // El label flota afuera: ocultar legend del notch.\n [notchedOutlineSelector]: {\n top: 0,\n '& legend': { display: 'none' },\n },\n\n '& .MuiFormHelperText-root': {\n marginLeft: 0,\n },\n\n ...(extraOutsideSx ?? {}),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAaO,MAAM,mBAAmB;AAGzB,MAAM,wBAAwB;AAI9B,MAAM,yBAAyB;AAG/B,MAAM,yBAAyB;AAG/B,MAAM,mBACX;AAMK,MAAM,mBAAmB;AAGzB,MAAM,qBAAqB;AAG3B,MAAM,sBAAsB;AAG5B,MAAM,2BAA2B;ACRxC,MAAM,WAAW,CAAC,iBAChB,OAAO,iBAAiB,WAAW,GAAG,YAAY,OAAO;AAcpD,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB;AAAA,EACA;AACF,MAA+C;AAC7C,QAAM,SAAS,SAAS,YAAY;AAGpC,QAAM,uBAAuB,oBACzB,8DACA;AAEJ,QAAM,oBAAoB,oBACtB,sDACA;AAEJ,QAAM,yBAAyB,oBAC3B,kFACA;AAGJ,MAAI,kBAAkB,YAAY;AAChC,WAAO;AAAA,MACL,CAAC,oBAAoB,GAAG,EAAE,cAAc,OAAA;AAAA,OACpC,4CAAmB,CAAA;AAAA,EAE3B;AAGA,SAAO;AAAA,IACL,WAAW;AAAA,IAEX,yBAAyB;AAAA,MACvB,OAAO;AAAA,MACP,YAAY;AAAA;AAAA,MAGZ,0BAA0B;AAAA,QACxB,WAAW;AAAA,QACX,iBAAiB;AAAA,QACjB,OAAO;AAAA,QACP,YAAY;AAAA,MAAA;AAAA,MAGd,iBAAiB,EAAE,OAAO,oBAAA;AAAA,IAAoB;AAAA;AAAA,IAIhD,CAAC,iBAAiB,GAAG;AAAA,MACnB,cAAc;AAAA,MACd,SAAS;AAAA,MACT,YAAY;AAAA,IAAA;AAAA;AAAA,IAId,CAAC,sBAAsB,GAAG;AAAA,MACxB,KAAK;AAAA,MACL,YAAY,EAAE,SAAS,OAAA;AAAA,IAAO;AAAA,IAGhC,6BAA6B;AAAA,MAC3B,YAAY;AAAA,IAAA;AAAA,KAGV,0CAAkB,CAAA;AAE1B;"}
|
package/hooks/Wizard/Wizard.cjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const useWizard = require("../../useWizard-CWdIxZzX.cjs");
|
|
4
|
-
exports.WizardContext = useWizard.WizardContext;
|
|
5
|
-
exports.WizardProvider = useWizard.WizardProvider;
|
|
6
|
-
exports.useWizard = useWizard.useWizard;
|
|
7
|
-
//# sourceMappingURL=Wizard.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Wizard.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
package/hooks/Wizard/Wizard.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Wizard.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/hooks/Wizard/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { WizardContextValue } from './WizardContext';
|
|
2
|
-
/**
|
|
3
|
-
* Hook para consumir el `WizardContext` desde cualquier descendiente de
|
|
4
|
-
* `<WizardProvider>`.
|
|
5
|
-
*
|
|
6
|
-
* Si se llama fuera de un provider, devuelve los valores por defecto (no-op)
|
|
7
|
-
* para mantener compatibilidad con el hook original de fri-web-components.
|
|
8
|
-
*/
|
|
9
|
-
export declare function useWizard(): WizardContextValue;
|
package/hooks/Wizard.d.ts
DELETED
package/useWizard-CWdIxZzX.cjs
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const React = require("react");
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const defaultValue = {
|
|
5
|
-
currentStep: 0,
|
|
6
|
-
totalSteps: 0,
|
|
7
|
-
isFirst: true,
|
|
8
|
-
isLast: true,
|
|
9
|
-
completed: false,
|
|
10
|
-
nextStep: () => {
|
|
11
|
-
},
|
|
12
|
-
prevStep: () => {
|
|
13
|
-
},
|
|
14
|
-
goToStep: () => {
|
|
15
|
-
},
|
|
16
|
-
submitStep: () => {
|
|
17
|
-
},
|
|
18
|
-
reset: () => {
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const WizardContext = React.createContext(defaultValue);
|
|
22
|
-
const WizardProvider = ({
|
|
23
|
-
totalSteps,
|
|
24
|
-
initialStep = 0,
|
|
25
|
-
onSubmit,
|
|
26
|
-
onStepChange,
|
|
27
|
-
children
|
|
28
|
-
}) => {
|
|
29
|
-
const [currentStep, setCurrentStep] = React.useState(initialStep);
|
|
30
|
-
const [completed, setCompleted] = React.useState(false);
|
|
31
|
-
const changeStep = React.useCallback(
|
|
32
|
-
(newStep) => {
|
|
33
|
-
setCurrentStep((prev) => {
|
|
34
|
-
if (newStep === prev) return prev;
|
|
35
|
-
if (newStep < 0 || newStep >= totalSteps) return prev;
|
|
36
|
-
onStepChange == null ? void 0 : onStepChange(newStep, prev);
|
|
37
|
-
return newStep;
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
[totalSteps, onStepChange]
|
|
41
|
-
);
|
|
42
|
-
const nextStep = React.useCallback(() => {
|
|
43
|
-
changeStep(currentStep + 1);
|
|
44
|
-
}, [changeStep, currentStep]);
|
|
45
|
-
const prevStep = React.useCallback(() => {
|
|
46
|
-
changeStep(currentStep - 1);
|
|
47
|
-
}, [changeStep, currentStep]);
|
|
48
|
-
const goToStep = React.useCallback(
|
|
49
|
-
(stepNumber) => {
|
|
50
|
-
changeStep(stepNumber);
|
|
51
|
-
},
|
|
52
|
-
[changeStep]
|
|
53
|
-
);
|
|
54
|
-
const submitStep = React.useCallback(() => {
|
|
55
|
-
setCompleted(true);
|
|
56
|
-
onSubmit == null ? void 0 : onSubmit(currentStep);
|
|
57
|
-
}, [currentStep, onSubmit]);
|
|
58
|
-
const reset = React.useCallback(() => {
|
|
59
|
-
setCurrentStep(initialStep);
|
|
60
|
-
setCompleted(false);
|
|
61
|
-
}, [initialStep]);
|
|
62
|
-
const value = React.useMemo(
|
|
63
|
-
() => ({
|
|
64
|
-
currentStep,
|
|
65
|
-
totalSteps,
|
|
66
|
-
isFirst: currentStep === 0,
|
|
67
|
-
isLast: currentStep === totalSteps - 1,
|
|
68
|
-
completed,
|
|
69
|
-
nextStep,
|
|
70
|
-
prevStep,
|
|
71
|
-
goToStep,
|
|
72
|
-
submitStep,
|
|
73
|
-
reset
|
|
74
|
-
}),
|
|
75
|
-
[
|
|
76
|
-
currentStep,
|
|
77
|
-
totalSteps,
|
|
78
|
-
completed,
|
|
79
|
-
nextStep,
|
|
80
|
-
prevStep,
|
|
81
|
-
goToStep,
|
|
82
|
-
submitStep,
|
|
83
|
-
reset
|
|
84
|
-
]
|
|
85
|
-
);
|
|
86
|
-
return /* @__PURE__ */ jsxRuntime.jsx(WizardContext.Provider, { value, children });
|
|
87
|
-
};
|
|
88
|
-
function useWizard() {
|
|
89
|
-
return React.useContext(WizardContext);
|
|
90
|
-
}
|
|
91
|
-
exports.WizardContext = WizardContext;
|
|
92
|
-
exports.WizardProvider = WizardProvider;
|
|
93
|
-
exports.useWizard = useWizard;
|
|
94
|
-
//# sourceMappingURL=useWizard-CWdIxZzX.cjs.map
|