@soyfri/shared-library 2.0.0-beta.1 → 2.0.0-beta.2

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 (181) hide show
  1. package/dist/components/Icon/Icon.js +1 -1
  2. package/dist/components/Table/Table.js +1 -1
  3. package/package.json +32 -4
  4. package/.dockerignore +0 -8
  5. package/.github/workflows/publish.yml +0 -107
  6. package/.prettierrc +0 -3
  7. package/.storybook/main.ts +0 -19
  8. package/.storybook/preview.ts +0 -14
  9. package/.storybook/vitest.setup.ts +0 -9
  10. package/Dockerfile +0 -37
  11. package/build.js +0 -139
  12. package/chromatic.config.json +0 -5
  13. package/cleanDirectories.js +0 -40
  14. package/rollup.config.cjs +0 -87
  15. package/src/components/ActionMenu/ActionMenu.stories.tsx +0 -230
  16. package/src/components/ActionMenu/ActionMenu.tsx +0 -174
  17. package/src/components/ActionMenu/index.ts +0 -2
  18. package/src/components/AppBar/AppBar.stories.tsx +0 -272
  19. package/src/components/AppBar/AppBar.sx.ts +0 -32
  20. package/src/components/AppBar/AppBar.tsx +0 -123
  21. package/src/components/AppBar/AppBarBrand.tsx +0 -120
  22. package/src/components/AppBar/AppBarContext.ts +0 -25
  23. package/src/components/AppBar/AppBarMenuToggle.tsx +0 -90
  24. package/src/components/AppBar/AppBarUserMenu.tsx +0 -217
  25. package/src/components/AppBar/index.ts +0 -25
  26. package/src/components/Autocomplete/Autocomplete.definitions.ts +0 -477
  27. package/src/components/Autocomplete/Autocomplete.helpers.ts +0 -60
  28. package/src/components/Autocomplete/Autocomplete.stories.tsx +0 -748
  29. package/src/components/Autocomplete/Autocomplete.sx.ts +0 -30
  30. package/src/components/Autocomplete/Autocomplete.tsx +0 -361
  31. package/src/components/Autocomplete/Autocomplete.types.ts +0 -13
  32. package/src/components/Autocomplete/_parts/AutocompleteChips.tsx +0 -55
  33. package/src/components/Autocomplete/_parts/AutocompleteLoader.tsx +0 -17
  34. package/src/components/Autocomplete/_parts/AutocompleteOption.tsx +0 -31
  35. package/src/components/Autocomplete/index.ts +0 -12
  36. package/src/components/Avatar/Avatar.definitions.ts +0 -162
  37. package/src/components/Avatar/Avatar.stories.tsx +0 -258
  38. package/src/components/Avatar/Avatar.tsx +0 -206
  39. package/src/components/Avatar/index.ts +0 -1
  40. package/src/components/Button/Button.definition.ts +0 -97
  41. package/src/components/Button/Button.stories.tsx +0 -285
  42. package/src/components/Button/Button.tsx +0 -67
  43. package/src/components/Button/index.ts +0 -1
  44. package/src/components/Card/Card.definition.ts +0 -5
  45. package/src/components/Card/Card.stories.tsx +0 -221
  46. package/src/components/Card/Card.sx.ts +0 -104
  47. package/src/components/Card/Card.tsx +0 -200
  48. package/src/components/Card/index.ts +0 -9
  49. package/src/components/Chip/Chip.definitions.ts +0 -167
  50. package/src/components/Chip/Chip.stories.tsx +0 -265
  51. package/src/components/Chip/Chip.tsx +0 -61
  52. package/src/components/Chip/index.ts +0 -1
  53. package/src/components/Column/Column.tsx +0 -29
  54. package/src/components/Column/index.ts +0 -1
  55. package/src/components/DatePicker/DatePicker.definitions.ts +0 -228
  56. package/src/components/DatePicker/DatePicker.helpers.ts +0 -24
  57. package/src/components/DatePicker/DatePicker.stories.tsx +0 -309
  58. package/src/components/DatePicker/DatePicker.sx.ts +0 -33
  59. package/src/components/DatePicker/DatePicker.tsx +0 -189
  60. package/src/components/DatePicker/DatePicker.types.ts +0 -10
  61. package/src/components/DatePicker/index.ts +0 -9
  62. package/src/components/DateRangePicker/DateRangePicker.definitions.ts +0 -191
  63. package/src/components/DateRangePicker/DateRangePicker.stories.tsx +0 -252
  64. package/src/components/DateRangePicker/DateRangePicker.tsx +0 -56
  65. package/src/components/DateRangePicker/index.ts +0 -1
  66. package/src/components/DateTimePicker/DateTimePicker.definitions.ts +0 -256
  67. package/src/components/DateTimePicker/DateTimePicker.helpers.ts +0 -38
  68. package/src/components/DateTimePicker/DateTimePicker.stories.tsx +0 -418
  69. package/src/components/DateTimePicker/DateTimePicker.sx.ts +0 -30
  70. package/src/components/DateTimePicker/DateTimePicker.tsx +0 -225
  71. package/src/components/DateTimePicker/DateTimePicker.types.ts +0 -10
  72. package/src/components/DateTimePicker/index.ts +0 -9
  73. package/src/components/Drawer/Drawer.stories.tsx +0 -270
  74. package/src/components/Drawer/Drawer.sx.ts +0 -106
  75. package/src/components/Drawer/Drawer.tsx +0 -214
  76. package/src/components/Drawer/DrawerContext.ts +0 -26
  77. package/src/components/Drawer/DrawerItem.tsx +0 -110
  78. package/src/components/Drawer/index.ts +0 -10
  79. package/src/components/Flyout/Flyout.stories.tsx +0 -282
  80. package/src/components/Flyout/Flyout.tsx +0 -122
  81. package/src/components/Flyout/index.ts +0 -1
  82. package/src/components/Gallery/Gallery.definition.tsx +0 -37
  83. package/src/components/Gallery/Gallery.stories.tsx +0 -82
  84. package/src/components/Gallery/Gallery.tsx +0 -118
  85. package/src/components/Gallery/GalleryLightbox.tsx +0 -170
  86. package/src/components/Gallery/GalleryMain.tsx +0 -84
  87. package/src/components/Gallery/GalleryThumbnails.tsx +0 -106
  88. package/src/components/Gallery/index.ts +0 -1
  89. package/src/components/Icon/Icon.stories.tsx +0 -121
  90. package/src/components/Icon/Icon.tsx +0 -175
  91. package/src/components/Icon/index.ts +0 -2
  92. package/src/components/Input/Input.definitions.ts +0 -324
  93. package/src/components/Input/Input.helpers.ts +0 -49
  94. package/src/components/Input/Input.stories.tsx +0 -499
  95. package/src/components/Input/Input.sx.ts +0 -42
  96. package/src/components/Input/Input.tsx +0 -141
  97. package/src/components/Input/Input.types.ts +0 -10
  98. package/src/components/Input/index.ts +0 -9
  99. package/src/components/InputGroup/InputGroup.definitions.ts +0 -158
  100. package/src/components/InputGroup/InputGroup.stories.tsx +0 -267
  101. package/src/components/InputGroup/InputGroup.tsx +0 -179
  102. package/src/components/InputGroup/index.ts +0 -1
  103. package/src/components/MenuButton/MenuButton.stories.tsx +0 -197
  104. package/src/components/MenuButton/MenuButton.tsx +0 -100
  105. package/src/components/MenuButton/index.ts +0 -1
  106. package/src/components/Modal/Modal.stories.tsx +0 -721
  107. package/src/components/Modal/Modal.tsx +0 -355
  108. package/src/components/Modal/ModalBody.tsx +0 -16
  109. package/src/components/Modal/ModalFooter.tsx +0 -71
  110. package/src/components/Modal/ModalHeader.tsx +0 -18
  111. package/src/components/Modal/index.ts +0 -6
  112. package/src/components/PageLoader/PageLoader.stories.tsx +0 -217
  113. package/src/components/PageLoader/PageLoader.tsx +0 -96
  114. package/src/components/PageLoader/index.ts +0 -2
  115. package/src/components/ScrollTopButton/ScrollTopButton.stories.tsx +0 -158
  116. package/src/components/ScrollTopButton/ScrollTopButton.tsx +0 -135
  117. package/src/components/ScrollTopButton/index.ts +0 -8
  118. package/src/components/ScrollTopButton/scrollToTop.ts +0 -37
  119. package/src/components/Select/Select.definitions.ts +0 -602
  120. package/src/components/Select/Select.helpers.ts +0 -71
  121. package/src/components/Select/Select.stories.tsx +0 -687
  122. package/src/components/Select/Select.sx.ts +0 -14
  123. package/src/components/Select/Select.tsx +0 -429
  124. package/src/components/Select/Select.types.ts +0 -15
  125. package/src/components/Select/_parts/SelectMenuItem.tsx +0 -40
  126. package/src/components/Select/_parts/SelectSearchHeader.tsx +0 -51
  127. package/src/components/Select/_parts/SelectValue.tsx +0 -96
  128. package/src/components/Select/index.ts +0 -14
  129. package/src/components/Stat/Stat.stories.tsx +0 -85
  130. package/src/components/Stat/Stat.tsx +0 -117
  131. package/src/components/Stat/index.ts +0 -2
  132. package/src/components/StatusMessage/StatusMessage.stories.tsx +0 -130
  133. package/src/components/StatusMessage/StatusMessage.tsx +0 -162
  134. package/src/components/StatusMessage/index.ts +0 -2
  135. package/src/components/Stepper/Step.tsx +0 -21
  136. package/src/components/Stepper/Stepper.definition.ts +0 -75
  137. package/src/components/Stepper/Stepper.stories.tsx +0 -122
  138. package/src/components/Stepper/Stepper.tsx +0 -75
  139. package/src/components/Stepper/index.ts +0 -2
  140. package/src/components/Table/EmptyTable.png +0 -0
  141. package/src/components/Table/Table.definition.ts +0 -580
  142. package/src/components/Table/Table.stories.tsx +0 -853
  143. package/src/components/Table/Table.tsx +0 -495
  144. package/src/components/Table/data.ts +0 -134
  145. package/src/components/Table/exportsUtils.ts +0 -195
  146. package/src/components/Table/index.ts +0 -3
  147. package/src/components/Table/types.ts +0 -34
  148. package/src/components/Tabs/Tab.definition.ts +0 -53
  149. package/src/components/Tabs/Tab.tsx +0 -19
  150. package/src/components/Tabs/Tabs.stories.tsx +0 -118
  151. package/src/components/Tabs/Tabs.tsx +0 -99
  152. package/src/components/Tabs/_tabUtils.tsx +0 -4
  153. package/src/components/Tabs/index.ts +0 -2
  154. package/src/components/Timeline/Timeline.definition.ts +0 -43
  155. package/src/components/Timeline/Timeline.stories.tsx +0 -108
  156. package/src/components/Timeline/Timeline.tsx +0 -49
  157. package/src/components/Timeline/TimelineItem.tsx +0 -31
  158. package/src/components/Timeline/index.ts +0 -2
  159. package/src/components/Tooltip/Tooltip.stories.tsx +0 -129
  160. package/src/components/Tooltip/Tooltip.tsx +0 -58
  161. package/src/components/Tooltip/index.ts +0 -1
  162. package/src/components/_shared/formField.sx.ts +0 -118
  163. package/src/components/_shared/resolvePreset.ts +0 -35
  164. package/src/hooks/ClipBoard/ClipBoard.stories.tsx +0 -168
  165. package/src/hooks/ClipBoard/ClipBoard.tsx +0 -131
  166. package/src/hooks/ClipBoard/ClipboardUnifiedDemo.tsx +0 -111
  167. package/src/hooks/ClipBoard/index.ts +0 -1
  168. package/src/hooks/Wizard/Wizard.stories.tsx +0 -301
  169. package/src/hooks/Wizard/WizardContext.tsx +0 -166
  170. package/src/hooks/Wizard/index.ts +0 -6
  171. package/src/hooks/Wizard/useWizard.ts +0 -13
  172. package/src/index.ts +0 -17
  173. package/src/mui.ts +0 -44
  174. package/src/styles.css +0 -3
  175. package/src/theme/componentStyles.ts +0 -47
  176. package/src/theme/tokens.ts +0 -43
  177. package/tailwind.config.js +0 -10
  178. package/tsconfig.json +0 -48
  179. package/tsup.config.js +0 -41
  180. package/vite.config.js +0 -132
  181. package/vitest.config.ts +0 -35
@@ -1,118 +0,0 @@
1
- import React, { useState, useRef, useEffect } from "react";
2
- import { Stack, useMediaQuery } from "@mui/material";
3
- import { GalleryThumbnails } from "./GalleryThumbnails";
4
- import { GalleryMain } from "./GalleryMain";
5
- import { GalleryLightbox } from "./GalleryLightbox";
6
-
7
- export interface Props {
8
- items: Array<{
9
- url: string;
10
- type: "image" | "video" | string;
11
- title: string;
12
- thumbnail: string;
13
- }>;
14
- maxWidth?: string;
15
- }
16
-
17
-
18
- export const Gallery:React.FC<Props> = ({ items, maxWidth='600px' }: Props) => {
19
- const isMobile = useMediaQuery("(max-width:700px)");
20
- const [selectedIdx, setSelectedIdx] = useState(0);
21
- const [openLightbox, setOpenLightbox] = useState(false);
22
- const [zoom, setZoom] = useState(1);
23
- const [rotation, setRotation] = useState(0);
24
- const videoRef = useRef<HTMLVideoElement | null>(null);
25
-
26
- const [thumbStartIdx, setThumbStartIdx] = useState(0);
27
- const THUMB_VISIBLE_COUNT = isMobile ? 3 : 5;
28
-
29
- // Flechas para miniaturas
30
- const handleThumbUp = () => {
31
- setThumbStartIdx((prev) => Math.max(0, prev - 1));
32
- };
33
- const handleThumbDown = () => {
34
- setThumbStartIdx((prev) =>
35
- Math.min(items.length - THUMB_VISIBLE_COUNT, prev + 1)
36
- );
37
- };
38
-
39
- // Navegación entre imágenes
40
- const handlePrev = () => {
41
- setSelectedIdx((idx) => (idx === 0 ? items.length - 1 : idx - 1));
42
- };
43
- const handleNext = () => {
44
- setSelectedIdx((idx) =>
45
- idx === items.length - 1 ? 0 : idx + 1
46
- );
47
- };
48
-
49
- // Acciones de teclado
50
- useEffect(() => {
51
- if (!openLightbox) return;
52
- const handleKey = (e: KeyboardEvent) => {
53
- switch (e.key) {
54
- case "ArrowLeft":
55
- handlePrev();
56
- break;
57
- case "ArrowRight":
58
- handleNext();
59
- break;
60
- case "Escape":
61
- setOpenLightbox(false);
62
- break;
63
- default:
64
- break;
65
- }
66
- };
67
- window.addEventListener("keydown", handleKey);
68
- return () => window.removeEventListener("keydown", handleKey);
69
- }, [openLightbox, items.length]);
70
-
71
- // Reset zoom/rotación y autoplay video
72
- useEffect(() => {
73
- if (
74
- openLightbox &&
75
- items[selectedIdx]?.type === "video" &&
76
- videoRef.current
77
- ) {
78
- videoRef.current.currentTime = 0;
79
- videoRef.current.play();
80
- }
81
- setZoom(1);
82
- setRotation(0);
83
- }, [openLightbox, selectedIdx, items]);
84
-
85
- return (
86
- <Stack direction={isMobile ? "column" : "row"} gap={3} sx={{ maxWidth: maxWidth, mx: "auto", minHeight: 300 }}>
87
- <GalleryThumbnails
88
- items={items}
89
- selectedIdx={selectedIdx}
90
- onSelect={setSelectedIdx}
91
- thumbStartIdx={thumbStartIdx}
92
- THUMB_VISIBLE_COUNT={THUMB_VISIBLE_COUNT}
93
- handleThumbUp={handleThumbUp}
94
- handleThumbDown={handleThumbDown}
95
- isMobile={isMobile}
96
- />
97
- <GalleryMain
98
- item={items[selectedIdx]}
99
- onOpenLightbox={() => setOpenLightbox(true)}
100
- isMobile={isMobile}
101
- />
102
- <GalleryLightbox
103
- open={openLightbox}
104
- onClose={() => setOpenLightbox(false)}
105
- item={items[selectedIdx]}
106
- handlePrev={handlePrev}
107
- handleNext={handleNext}
108
- zoom={zoom}
109
- setZoom={setZoom}
110
- rotation={rotation}
111
- setRotation={setRotation}
112
- videoRef={videoRef}
113
- />
114
- </Stack>
115
- );
116
- };
117
-
118
- export default Gallery;
@@ -1,170 +0,0 @@
1
- import React from "react";
2
- import {
3
- Dialog,
4
- DialogContent,
5
- DialogActions,
6
- Stack,
7
- IconButton,
8
- Box,
9
- Typography,
10
- } from "@mui/material";
11
- import ArrowBackIosNewIcon from "@mui/icons-material/ArrowBackIosNew";
12
- import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos";
13
- import ZoomInIcon from "@mui/icons-material/ZoomIn";
14
- import ZoomOutIcon from "@mui/icons-material/ZoomOut";
15
- import RotateLeftIcon from "@mui/icons-material/RotateLeft";
16
- import RotateRightIcon from "@mui/icons-material/RotateRight";
17
- import RestartAltIcon from "@mui/icons-material/RestartAlt";
18
- import CloseIcon from "@mui/icons-material/Close";
19
- import { Button } from "../Button";
20
-
21
-
22
- interface Props {
23
- open: boolean;
24
- onClose: () => void;
25
- item: {
26
- url: string;
27
- type: "image" | "video" | string;
28
- title: string;
29
- thumbnail: string;
30
- };
31
- handlePrev: () => void;
32
- handleNext: () => void;
33
- zoom: number;
34
- setZoom: React.Dispatch<React.SetStateAction<number>>;
35
- rotation: number;
36
- setRotation: React.Dispatch<React.SetStateAction<number>>;
37
- videoRef?: React.RefObject<HTMLVideoElement | null>;
38
- }
39
-
40
- export const GalleryLightbox = ({
41
- open,
42
- onClose,
43
- item,
44
- handlePrev,
45
- handleNext,
46
- zoom,
47
- setZoom,
48
- rotation,
49
- setRotation,
50
- videoRef,
51
- }: Props) => (
52
- <Dialog open={open} onClose={onClose} fullWidth maxWidth="lg">
53
- <DialogContent
54
- sx={{
55
- minHeight: 431,
56
- display: "flex",
57
- flexDirection: "column",
58
- alignItems: "center",
59
- justifyContent: "center",
60
- gap: 2,
61
- }}
62
- >
63
- <Stack direction="row" justifyContent="space-between" alignItems="center" width="100%">
64
- <IconButton onClick={handlePrev}>
65
- <ArrowBackIosNewIcon />
66
- </IconButton>
67
- <Typography variant="subtitle1" fontWeight={600} sx={{ flex: 1, textAlign: "center" }}>
68
- {item.title}
69
- </Typography>
70
- <IconButton onClick={handleNext}>
71
- <ArrowForwardIosIcon />
72
- </IconButton>
73
- </Stack>
74
- {item.type === "video" ? (
75
- <Box
76
- component="video"
77
- key={item.url}
78
- ref={videoRef}
79
- src={item.url}
80
- controls
81
- autoPlay
82
- sx={{
83
- width: "100%",
84
- maxWidth: "900px",
85
- maxHeight: "70vh",
86
- objectFit: "contain",
87
- bgcolor: "#000",
88
- borderRadius: 1,
89
- }}
90
- />
91
- ) : (
92
- <Box
93
- component="img"
94
- src={item.url}
95
- alt={item.title}
96
- sx={{
97
- transform: `scale(${zoom}) rotate(${rotation}deg)`,
98
- transition: "transform 0.2s ease",
99
- width: "100%",
100
- maxWidth: "900px",
101
- maxHeight: "70vh",
102
- objectFit: "contain",
103
- borderRadius: 1,
104
- }}
105
- />
106
- )}
107
- </DialogContent>
108
- <DialogActions
109
- sx={{
110
- display: "flex",
111
- justifyContent: item.type === 'image' ? "space-between" : "end",
112
- flexWrap: "wrap",
113
- gap: 1,
114
- }}
115
- >
116
-
117
- {item.type === 'image' && <>
118
- <Stack direction="row" spacing={1}>
119
- <Button
120
- variant="outlined"
121
- startIcon={<ZoomInIcon />}
122
- onClick={() => setZoom((z) => z + 0.25)}
123
- >
124
- Zoom +
125
- </Button>
126
- <Button
127
- variant="outlined"
128
- startIcon={<ZoomOutIcon />}
129
- onClick={() => setZoom((z) => Math.max(0.25, z - 0.25))}
130
- >
131
- Zoom −
132
- </Button>
133
- </Stack>
134
- <Stack direction="row" spacing={1}>
135
- <Button
136
- variant="outlined"
137
- onClick={() => setRotation((r) => r - 90)}
138
- >
139
- <RotateLeftIcon />
140
- </Button>
141
- <Button
142
- variant="outlined"
143
- onClick={() => setRotation((r) => r + 90)}
144
- >
145
- <RotateRightIcon />
146
- </Button>
147
- </Stack>
148
- <Button
149
- variant="outlined"
150
- startIcon={<RestartAltIcon />}
151
- onClick={() => {
152
- setZoom(1);
153
- setRotation(0);
154
- }}
155
- >
156
- Reset
157
- </Button>
158
-
159
- </>
160
- }
161
- <Button
162
- variant="contained"
163
- startIcon={<CloseIcon />}
164
- onClick={onClose}
165
- >
166
- Cerrar
167
- </Button>
168
- </DialogActions>
169
- </Dialog >
170
- );
@@ -1,84 +0,0 @@
1
- import React from "react";
2
- import { Box, IconButton } from "@mui/material";
3
- import FullscreenIcon from "@mui/icons-material/Fullscreen";
4
-
5
- interface Props {
6
- item: {
7
- url: string;
8
- type: "image" | "video" | string;
9
- title: string;
10
- thumbnail: string;
11
- };
12
- onOpenLightbox: () => void;
13
- isMobile: boolean;
14
- }
15
-
16
- export const GalleryMain = ({ item, onOpenLightbox, isMobile }: Props) => (
17
- <Box
18
- sx={{
19
- width: isMobile ? "80%" : '100%',
20
- maxHeight: 431,
21
- maxWidth: isMobile ? "80%" : '100%',
22
- display: "flex",
23
- justifyContent: "center",
24
- alignItems: "center",
25
- position: "relative",
26
- borderRadius: 1,
27
- bgcolor: "#f8f9fa",
28
- overflow: "hidden",
29
- mx: "auto",
30
- }}
31
- >
32
- <Box
33
- sx={{
34
- width: "100%",
35
- height: "100%",
36
- cursor: "pointer",
37
- display: "flex",
38
- alignItems: "center",
39
- justifyContent: "center",
40
- }}
41
- onClick={onOpenLightbox}
42
- >
43
- {item.type === "video" ? (
44
- <Box
45
- component="video"
46
- controls
47
- src={item.url}
48
- sx={{
49
- width: "100%",
50
- height: "100%",
51
- objectFit: "contain",
52
- bgcolor: "#000",
53
- borderRadius: 1,
54
- }}
55
- />
56
- ) : (
57
- <Box
58
- component="img"
59
- src={item.url}
60
- alt={item.title}
61
- sx={{
62
- width: "100%",
63
- height: "100%",
64
- objectFit: "contain",
65
- borderRadius: 1,
66
- }}
67
- />
68
- )}
69
- </Box>
70
- <IconButton
71
- onClick={onOpenLightbox}
72
- sx={{
73
- position: "absolute",
74
- top: 16,
75
- right: 16,
76
- bgcolor: "#1976d2",
77
- "&:hover": { bgcolor: "#1565c0" },
78
- boxShadow: 2,
79
- }}
80
- >
81
- <FullscreenIcon sx={{ color: "#fff" }} />
82
- </IconButton>
83
- </Box>
84
- );
@@ -1,106 +0,0 @@
1
- import React from "react";
2
- import { Box, IconButton } from "@mui/material";
3
- import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
4
- import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
5
- import KeyboardArrowLeftIcon from "@mui/icons-material/KeyboardArrowLeft";
6
- import KeyboardArrowRightIcon from "@mui/icons-material/KeyboardArrowRight";
7
-
8
-
9
- interface Props {
10
- items: Array<{
11
- url: string;
12
- type: string;
13
- title: string;
14
- thumbnail: string;
15
- }>;
16
- selectedIdx: number;
17
- onSelect: (idx: number) => void;
18
- thumbStartIdx: number;
19
- THUMB_VISIBLE_COUNT: number;
20
- handleThumbUp: () => void;
21
- handleThumbDown: () => void;
22
- isMobile: boolean;
23
- }
24
-
25
- export const GalleryThumbnails = ({
26
- items,
27
- selectedIdx,
28
- onSelect,
29
- thumbStartIdx,
30
- THUMB_VISIBLE_COUNT,
31
- handleThumbUp,
32
- handleThumbDown,
33
- isMobile,
34
- }: Props) => (
35
- <Box
36
- sx={{
37
- display: "flex",
38
- flexDirection: isMobile ? "row" : "column",
39
- alignItems: "center",
40
- minWidth: 70,
41
- width: 70,
42
- borderRadius: 1,
43
- bgcolor: "#f8f9fa",
44
- boxSizing: "border-box",
45
- py: 1,
46
- mb: isMobile ? 2 : 0,
47
- px: isMobile ? 1 : 0,
48
- }}
49
- >
50
- <IconButton
51
- size="small"
52
- onClick={handleThumbUp}
53
- disabled={thumbStartIdx === 0}
54
- sx={{ mb: isMobile ? 0 : 1, mr: isMobile ? 1 : 0 }}
55
- >
56
- {isMobile ? <KeyboardArrowLeftIcon /> : <KeyboardArrowUpIcon />}
57
- </IconButton>
58
- {items
59
- .slice(thumbStartIdx, thumbStartIdx + THUMB_VISIBLE_COUNT)
60
- .map((item, idx) => {
61
- const realIdx = thumbStartIdx + idx;
62
- return (
63
- <Box
64
- key={realIdx}
65
- onClick={() => onSelect(realIdx)}
66
- sx={{
67
- cursor: "pointer",
68
- width: 60,
69
- height: 60,
70
- borderRadius: 1,
71
- border:
72
- selectedIdx === realIdx
73
- ? "2px solid #1976d2"
74
- : "2px solid #eee",
75
- overflow: "hidden",
76
- bgcolor: "#eee",
77
- display: "flex",
78
- alignItems: "center",
79
- justifyContent: "center",
80
- flexShrink: 0,
81
- m: isMobile ? "0 4px" : "4px 0",
82
- }}
83
- >
84
- <Box
85
- component="img"
86
- src={item.thumbnail}
87
- alt={item.title}
88
- sx={{
89
- width: "100%",
90
- height: "100%",
91
- objectFit: "cover",
92
- }}
93
- />
94
- </Box>
95
- );
96
- })}
97
- <IconButton
98
- size="small"
99
- onClick={handleThumbDown}
100
- disabled={thumbStartIdx + THUMB_VISIBLE_COUNT >= items.length}
101
- sx={{ mt: isMobile ? 0 : 1, ml: isMobile ? 1 : 0 }}
102
- >
103
- {isMobile ? <KeyboardArrowRightIcon /> : <KeyboardArrowDownIcon />}
104
- </IconButton>
105
- </Box>
106
- );
@@ -1 +0,0 @@
1
- export {default as Gallery } from './Gallery';
@@ -1,121 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { Icon } from './Icon';
3
- import NotificationsIcon from '@mui/icons-material/Notifications';
4
- import SettingsIcon from '@mui/icons-material/Settings';
5
-
6
- const meta: Meta<typeof Icon> = {
7
- title: 'Components/Icon',
8
- component: Icon,
9
- parameters: {
10
- layout: 'centered',
11
- docs: {
12
- description: {
13
- component:
14
- 'Componente Icon con soporte para 3 fuentes: `children` (elemento MUI), `path` (string SVG inline, para los iconos custom de Metronic) y `url` (ruta a un archivo `.svg`).',
15
- },
16
- },
17
- },
18
- tags: ['autodocs'],
19
- };
20
-
21
- export default meta;
22
- type Story = StoryObj<typeof Icon>;
23
-
24
- // ── Modo legacy: children ──────────────────────────────────────────────
25
-
26
- export const Default: Story = {
27
- args: {
28
- children: <NotificationsIcon />,
29
- },
30
- };
31
-
32
- export const Outlined: Story = {
33
- args: {
34
- children: <SettingsIcon />,
35
- outlined: true,
36
- },
37
- };
38
-
39
- export const Spinning: Story = {
40
- args: {
41
- children: <SettingsIcon />,
42
- spin: true,
43
- },
44
- };
45
-
46
- export const WithBadge: Story = {
47
- args: {
48
- children: <NotificationsIcon />,
49
- badge: 3,
50
- badgeColor: 'error',
51
- },
52
- };
53
-
54
- export const LargeWhiteIcon: Story = {
55
- args: {
56
- children: <NotificationsIcon />,
57
- size: 'xl',
58
- white: true,
59
- badge: 10,
60
- badgeColor: 'primary',
61
- },
62
- };
63
-
64
- // ── Nuevas fuentes: path + url ────────────────────────────────────────
65
-
66
- export const FromPathD: Story = {
67
- args: {
68
- path: 'M12 2L2 22h20L12 2zm0 3.83L19.17 20H4.83L12 5.83zM11 16h2v2h-2v-2zm0-6h2v5h-2v-5z',
69
- color: '#f59e0b',
70
- size: 'lg',
71
- },
72
- parameters: {
73
- docs: {
74
- description: {
75
- story:
76
- 'Renderiza un SVG a partir del atributo `d` de un `<path>`. Es la forma en que Metronic suele entregar iconos custom.',
77
- },
78
- },
79
- },
80
- };
81
-
82
- export const FromFullSvg: Story = {
83
- args: {
84
- path: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2" stroke="white" stroke-width="2" fill="none"/></svg>',
85
- color: '#2563eb',
86
- size: 'lg',
87
- },
88
- parameters: {
89
- docs: {
90
- description: {
91
- story:
92
- 'Si `path` contiene un `<svg>` completo (con `viewBox`, múltiples paths, etc), se inyecta tal cual.',
93
- },
94
- },
95
- },
96
- };
97
-
98
- export const FromUrl: Story = {
99
- args: {
100
- url: 'https://upload.wikimedia.org/wikipedia/commons/4/4f/SVG_Logo.svg',
101
- alt: 'SVG logo',
102
- size: 'xl',
103
- },
104
- parameters: {
105
- docs: {
106
- description: {
107
- story:
108
- 'Renderiza un `<img>` apuntando a un archivo `.svg`. Útil para assets locales (p.ej. `/public/icons/foo.svg`).',
109
- },
110
- },
111
- },
112
- };
113
-
114
- export const PathWithBadge: Story = {
115
- args: {
116
- path: 'M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z',
117
- badge: '9+',
118
- badgeColor: 'error',
119
- size: 'md',
120
- },
121
- };