oraculo-ui 0.1.8 → 0.1.10

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.
@@ -0,0 +1,475 @@
1
+ import {
2
+ OraculoButton
3
+ } from "./chunk-IJQLK4NO.mjs";
4
+
5
+ // src/organisms/OraculoSeccionBonoBienvenida/OraculoSeccionBonoBienvenida.tsx
6
+ import { useRef as useRef2, useState } from "react";
7
+ import Box2 from "@mui/material/Box";
8
+ import Typography2 from "@mui/material/Typography";
9
+ import useMediaQuery from "@mui/material/useMediaQuery";
10
+
11
+ // src/molecules/OraculoCarousel/OraculoCarousel.tsx
12
+ import {
13
+ forwardRef,
14
+ useCallback,
15
+ useImperativeHandle,
16
+ useRef
17
+ } from "react";
18
+ import {
19
+ Splide as SplideRaw,
20
+ SplideSlide as SplideSlideRaw
21
+ } from "@splidejs/react-splide";
22
+ import { jsx } from "react/jsx-runtime";
23
+ var Splide = SplideRaw;
24
+ var SplideSlide = SplideSlideRaw;
25
+ var OraculoCarousel = forwardRef(
26
+ ({
27
+ items = [],
28
+ renderItem,
29
+ perPage = 1,
30
+ gap = "0px",
31
+ breakpoints,
32
+ options = {},
33
+ className = "",
34
+ onMove
35
+ }, ref) => {
36
+ const splideRef = useRef(null);
37
+ useImperativeHandle(ref, () => ({
38
+ next: () => {
39
+ var _a;
40
+ return (_a = splideRef.current) == null ? void 0 : _a.go(">");
41
+ },
42
+ prev: () => {
43
+ var _a;
44
+ return (_a = splideRef.current) == null ? void 0 : _a.go("<");
45
+ },
46
+ go: (index) => {
47
+ var _a;
48
+ return (_a = splideRef.current) == null ? void 0 : _a.go(index);
49
+ }
50
+ }));
51
+ const handleMove = useCallback(
52
+ (splide) => {
53
+ const index = splide.index;
54
+ const total = splide.length;
55
+ const currentPerPage = splide.options.perPage || 1;
56
+ const isStart = index === 0;
57
+ const isEnd = index >= total - currentPerPage;
58
+ onMove == null ? void 0 : onMove({ index, isStart, isEnd, total });
59
+ },
60
+ [onMove]
61
+ );
62
+ const handleMounted = useCallback(
63
+ (splide) => {
64
+ handleMove(splide);
65
+ },
66
+ [handleMove]
67
+ );
68
+ const mergedOptions = {
69
+ type: "slide",
70
+ trimSpace: false,
71
+ drag: true,
72
+ pagination: false,
73
+ arrows: false,
74
+ rewind: false,
75
+ focus: "start",
76
+ autoWidth: false,
77
+ perPage,
78
+ gap,
79
+ breakpoints,
80
+ ...options
81
+ };
82
+ return /* @__PURE__ */ jsx("div", { className, style: { width: "100%" }, children: /* @__PURE__ */ jsx(
83
+ Splide,
84
+ {
85
+ ref: splideRef,
86
+ options: mergedOptions,
87
+ onMove: handleMove,
88
+ onMounted: handleMounted,
89
+ children: items.map((item, index) => {
90
+ var _a;
91
+ return /* @__PURE__ */ jsx(SplideSlide, { children: renderItem(item, index) }, (_a = item.id) != null ? _a : index);
92
+ })
93
+ }
94
+ ) });
95
+ }
96
+ );
97
+ var OraculoCarousel_default = OraculoCarousel;
98
+
99
+ // src/molecules/OraculoWelcomeBanner/OraculoWelcomeBanner.tsx
100
+ import Box from "@mui/material/Box";
101
+ import Typography from "@mui/material/Typography";
102
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
103
+ var OraculoWelcomeBanner = ({
104
+ title,
105
+ amount,
106
+ subtitle,
107
+ buttonText,
108
+ onButtonClick,
109
+ backgroundImage,
110
+ alt,
111
+ className = "",
112
+ variant = "small"
113
+ }) => {
114
+ const symbol = amount ? amount.slice(0, 2) : "";
115
+ const value = amount ? amount.slice(2) : "";
116
+ const isLarge = variant === "large";
117
+ return /* @__PURE__ */ jsxs(
118
+ Box,
119
+ {
120
+ className,
121
+ sx: {
122
+ position: "relative",
123
+ width: "100%",
124
+ maxWidth: {
125
+ xs: 328,
126
+ lg: isLarge ? 618 : 456
127
+ },
128
+ mx: "auto"
129
+ },
130
+ children: [
131
+ backgroundImage && /* @__PURE__ */ jsx2(
132
+ Box,
133
+ {
134
+ sx: {
135
+ position: "relative",
136
+ width: "100%",
137
+ aspectRatio: {
138
+ xs: "328 / 188",
139
+ lg: isLarge ? "618 / 346" : "456 / 272"
140
+ },
141
+ borderRadius: "14px",
142
+ overflow: "hidden"
143
+ },
144
+ children: /* @__PURE__ */ jsx2(
145
+ Box,
146
+ {
147
+ component: "img",
148
+ src: backgroundImage,
149
+ alt: alt != null ? alt : "Fondo promocional",
150
+ sx: {
151
+ width: "100%",
152
+ height: "100%",
153
+ objectFit: "cover",
154
+ objectPosition: {
155
+ xs: "50% 0%",
156
+ lg: "45% 0%"
157
+ },
158
+ display: "block"
159
+ }
160
+ }
161
+ )
162
+ }
163
+ ),
164
+ /* @__PURE__ */ jsx2(
165
+ Box,
166
+ {
167
+ sx: {
168
+ position: "absolute",
169
+ inset: 0,
170
+ display: "flex",
171
+ alignItems: "center",
172
+ justifyContent: "flex-end",
173
+ color: "#e7f8ff",
174
+ textAlign: "center",
175
+ pl: "14%",
176
+ pr: { xs: "14%", lg: "15%" }
177
+ },
178
+ children: /* @__PURE__ */ jsxs(
179
+ Box,
180
+ {
181
+ sx: {
182
+ maxWidth: "60%",
183
+ display: "flex",
184
+ flexDirection: "column",
185
+ alignItems: "center"
186
+ },
187
+ children: [
188
+ title && /* @__PURE__ */ jsx2(
189
+ Typography,
190
+ {
191
+ sx: {
192
+ fontSize: { xs: 12, lg: 20 },
193
+ fontWeight: 400,
194
+ color: "#e7f8ff"
195
+ },
196
+ children: title
197
+ }
198
+ ),
199
+ amount && /* @__PURE__ */ jsxs(
200
+ Box,
201
+ {
202
+ component: "p",
203
+ sx: {
204
+ fontFamily: '"secondary", sans-serif',
205
+ lineHeight: { xs: 0.9, lg: 0.87 },
206
+ m: "4px 0",
207
+ background: "linear-gradient(175deg, #EDC421 -12.56%, #FFFABF 17.99%, #EDC421 49.74%)",
208
+ WebkitBackgroundClip: "text",
209
+ WebkitTextFillColor: "transparent",
210
+ WebkitTextStroke: "0.5px #fff8c1",
211
+ filter: "drop-shadow(0px 4px 0px #8D4406) drop-shadow(0px 4px 4px rgba(28, 28, 28, 0.4))",
212
+ display: "flex",
213
+ alignItems: "baseline",
214
+ justifyContent: "center"
215
+ },
216
+ children: [
217
+ /* @__PURE__ */ jsx2(
218
+ Box,
219
+ {
220
+ component: "span",
221
+ sx: { fontSize: { xs: 35, lg: 48 }, mr: 0.5 },
222
+ children: symbol
223
+ }
224
+ ),
225
+ /* @__PURE__ */ jsx2(
226
+ Box,
227
+ {
228
+ component: "span",
229
+ sx: { fontSize: { xs: 52, lg: 77 } },
230
+ children: value
231
+ }
232
+ )
233
+ ]
234
+ }
235
+ ),
236
+ subtitle && /* @__PURE__ */ jsx2(
237
+ Typography,
238
+ {
239
+ sx: {
240
+ pb: "20px",
241
+ fontSize: 14,
242
+ fontWeight: 600,
243
+ color: "#e7f8ff"
244
+ },
245
+ children: subtitle
246
+ }
247
+ ),
248
+ buttonText && /* @__PURE__ */ jsx2(OraculoButton, { onClick: onButtonClick, children: buttonText })
249
+ ]
250
+ }
251
+ )
252
+ }
253
+ )
254
+ ]
255
+ }
256
+ );
257
+ };
258
+ var OraculoWelcomeBanner_default = OraculoWelcomeBanner;
259
+
260
+ // src/atoms/OraculoCarouselDots/OraculoCarouselDots.tsx
261
+ import { jsx as jsx3 } from "react/jsx-runtime";
262
+ var OraculoCarouselDots = ({
263
+ total,
264
+ active,
265
+ onSelect,
266
+ className = ""
267
+ }) => {
268
+ if (total <= 1) return null;
269
+ const rootClass = ["orc-dots", className].filter(Boolean).join(" ");
270
+ return /* @__PURE__ */ jsx3("div", { className: rootClass, role: "tablist", children: Array.from({ length: total }).map((_, i) => /* @__PURE__ */ jsx3("span", { className: "orc-dots__cell", children: /* @__PURE__ */ jsx3(
271
+ "button",
272
+ {
273
+ type: "button",
274
+ role: "tab",
275
+ "aria-selected": i === active,
276
+ "aria-label": `Ir al slide ${i + 1}`,
277
+ className: "orc-dots__dot" + (i === active ? " orc-dots__dot--active" : ""),
278
+ onClick: () => onSelect == null ? void 0 : onSelect(i)
279
+ }
280
+ ) }, i)) });
281
+ };
282
+ var OraculoCarouselDots_default = OraculoCarouselDots;
283
+
284
+ // src/organisms/OraculoSeccionBonoBienvenida/OraculoSeccionBonoBienvenida.tsx
285
+ import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
286
+ var buildSectionSx = (bgUrl) => ({
287
+ width: "100vw",
288
+ position: "relative",
289
+ left: "50%",
290
+ right: "50%",
291
+ marginLeft: "-50vw",
292
+ marginRight: "-50vw",
293
+ py: 8,
294
+ color: "#fff",
295
+ backgroundImage: `
296
+ linear-gradient(to bottom,#121212 0%, rgba(18,18,18,0) 10%),
297
+ linear-gradient(to top, #121212 0%, rgba(18,18,18,0) 10%),
298
+ linear-gradient(to left, #121212 0%, rgba(18,18,18,0) 10%),
299
+ linear-gradient(to right, #121212 0%, rgba(18,18,18,0) 10%),
300
+ url("${bgUrl}")
301
+ `,
302
+ backgroundRepeat: "no-repeat",
303
+ backgroundPosition: "center",
304
+ backgroundSize: "cover"
305
+ });
306
+ var headlineBaseSx = {
307
+ textAlign: "center",
308
+ lineHeight: 1.1,
309
+ mb: 1.5
310
+ };
311
+ var hlTopSx = {
312
+ display: "inline-block",
313
+ fontWeight: 600,
314
+ fontSize: 24
315
+ };
316
+ var hlBottomSx = {
317
+ display: "inline-block",
318
+ fontSize: 24,
319
+ lineHeight: 1.1,
320
+ WebkitTextStroke: "0.3px rgba(255, 255, 255, .5)",
321
+ textShadow: `
322
+ 0 0 2px rgba(255, 255, 255, .95),
323
+ 0 0 6px rgba(255, 255, 255, .6),
324
+ 0 1px 0 rgba(137, 137, 137, .85)
325
+ `
326
+ };
327
+ var OraculoSeccionBonoBienvenida = ({
328
+ headline,
329
+ items,
330
+ backgroundImageUrl
331
+ }) => {
332
+ const [hl1 = "", hl2 = ""] = (headline || "").split("\n");
333
+ const isMobile = useMediaQuery("(max-width: 767px)");
334
+ const showDots = items.length > 1;
335
+ const bgUrl = backgroundImageUrl != null ? backgroundImageUrl : "/assets/img/home/BonoBienvenida/Fondobg.png";
336
+ const sectionSx = buildSectionSx(bgUrl);
337
+ const carouselRef = useRef2(null);
338
+ const [navState, setNavState] = useState({ isStart: true, isEnd: false });
339
+ const [activeIndex, setActiveIndex] = useState(0);
340
+ if (isMobile) {
341
+ return /* @__PURE__ */ jsxs2(
342
+ Box2,
343
+ {
344
+ component: "section",
345
+ sx: {
346
+ ...sectionSx,
347
+ textAlign: "center"
348
+ },
349
+ children: [
350
+ (hl1 || hl2) && /* @__PURE__ */ jsxs2(Box2, { sx: headlineBaseSx, children: [
351
+ hl1 && /* @__PURE__ */ jsx4(Typography2, { component: "span", sx: hlTopSx, children: hl1 }),
352
+ hl2 && /* @__PURE__ */ jsxs2(Fragment, { children: [
353
+ /* @__PURE__ */ jsx4("br", {}),
354
+ /* @__PURE__ */ jsx4(Typography2, { component: "span", sx: hlBottomSx, children: hl2 })
355
+ ] })
356
+ ] }),
357
+ /* @__PURE__ */ jsxs2(Box2, { children: [
358
+ /* @__PURE__ */ jsx4(
359
+ OraculoCarousel_default,
360
+ {
361
+ ref: carouselRef,
362
+ items,
363
+ perPage: 1,
364
+ gap: "12px",
365
+ breakpoints: {
366
+ 480: {
367
+ perPage: 1,
368
+ gap: "8px",
369
+ padding: { left: "8px", right: "8px" }
370
+ },
371
+ 768: {
372
+ perPage: 1,
373
+ gap: "12px",
374
+ padding: { left: "8px", right: "8px" }
375
+ }
376
+ },
377
+ options: {
378
+ autoWidth: false
379
+ },
380
+ renderItem: (it) => /* @__PURE__ */ jsx4(OraculoWelcomeBanner_default, { ...it, onButtonClick: items[0].onButtonClick }),
381
+ onMove: ({ index, isStart, isEnd }) => {
382
+ setNavState({ isStart, isEnd });
383
+ setActiveIndex(index);
384
+ }
385
+ }
386
+ ),
387
+ showDots && /* @__PURE__ */ jsx4(
388
+ OraculoCarouselDots_default,
389
+ {
390
+ total: items.length,
391
+ active: activeIndex,
392
+ onSelect: (i) => {
393
+ var _a;
394
+ setActiveIndex(i);
395
+ (_a = carouselRef.current) == null ? void 0 : _a.go(i);
396
+ }
397
+ }
398
+ )
399
+ ] })
400
+ ]
401
+ }
402
+ );
403
+ }
404
+ return /* @__PURE__ */ jsx4(Box2, { component: "section", sx: sectionSx, children: /* @__PURE__ */ jsxs2(
405
+ Box2,
406
+ {
407
+ sx: {
408
+ maxWidth: 1200,
409
+ mx: 5,
410
+ px: 2,
411
+ display: "grid",
412
+ gridTemplateColumns: "200px auto",
413
+ alignItems: "center"
414
+ },
415
+ children: [
416
+ (hl1 || hl2) && /* @__PURE__ */ jsx4(
417
+ Box2,
418
+ {
419
+ sx: {
420
+ display: "flex",
421
+ alignItems: "center",
422
+ justifyContent: "flex-start",
423
+ minHeight: "100%"
424
+ },
425
+ children: /* @__PURE__ */ jsxs2(
426
+ Box2,
427
+ {
428
+ sx: {
429
+ ...headlineBaseSx,
430
+ textAlign: "left",
431
+ mb: 0
432
+ },
433
+ children: [
434
+ hl1 && /* @__PURE__ */ jsx4(Typography2, { component: "span", sx: hlTopSx, children: hl1 }),
435
+ hl2 && /* @__PURE__ */ jsxs2(Fragment, { children: [
436
+ /* @__PURE__ */ jsx4("br", {}),
437
+ /* @__PURE__ */ jsx4(Typography2, { component: "span", sx: hlBottomSx, children: hl2 })
438
+ ] })
439
+ ]
440
+ }
441
+ )
442
+ }
443
+ ),
444
+ /* @__PURE__ */ jsx4(
445
+ Box2,
446
+ {
447
+ sx: {
448
+ display: "flex",
449
+ justifyContent: "center",
450
+ alignItems: "center",
451
+ flexWrap: "nowrap",
452
+ gap: 4
453
+ },
454
+ children: items.map((it, idx) => /* @__PURE__ */ jsx4(
455
+ OraculoWelcomeBanner_default,
456
+ {
457
+ onButtonClick: it.onButtonClick,
458
+ ...it
459
+ },
460
+ idx
461
+ ))
462
+ }
463
+ )
464
+ ]
465
+ }
466
+ ) });
467
+ };
468
+ var OraculoSeccionBonoBienvenida_default = OraculoSeccionBonoBienvenida;
469
+
470
+ export {
471
+ OraculoCarouselDots_default,
472
+ OraculoCarousel_default,
473
+ OraculoWelcomeBanner_default,
474
+ OraculoSeccionBonoBienvenida_default
475
+ };
@@ -0,0 +1,73 @@
1
+ // src/atoms/OraculoButton/OraculoButton.tsx
2
+ import { Link as MuiLink } from "@mui/material";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ function OraculoButton({
5
+ children,
6
+ onClick,
7
+ href,
8
+ target,
9
+ rel,
10
+ type = "button",
11
+ disabled = false,
12
+ variant = "primary",
13
+ size,
14
+ fullWidth = false,
15
+ fullHeight = false,
16
+ className = "",
17
+ ariaLabel,
18
+ leftIcon,
19
+ rightIcon,
20
+ iconOnly
21
+ }) {
22
+ const hasText = !!children && children !== true;
23
+ const hasLeft = !!leftIcon;
24
+ const hasRight = !!rightIcon;
25
+ const onlyOneIcon = (hasLeft ? 1 : 0) + (hasRight ? 1 : 0) === 1;
26
+ const isIconOnly = iconOnly != null ? iconOnly : onlyOneIcon && !hasText;
27
+ const cls = [
28
+ "orc-btn",
29
+ variant === "secondary" ? "orc-btn--secondary" : variant === "tertiary" ? "orc-btn--tertiary" : "orc-btn--primary",
30
+ size ? `orc-btn--${size}` : "",
31
+ fullWidth ? "orc-btn--full" : "",
32
+ fullHeight ? "orc-btn--fullHeight" : "",
33
+ isIconOnly ? "orc-btn--iconOnly" : "",
34
+ className
35
+ ].filter(Boolean).join(" ");
36
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
37
+ leftIcon && /* @__PURE__ */ jsx("span", { className: "orc-btn__icon", children: leftIcon }),
38
+ !isIconOnly && /* @__PURE__ */ jsx("span", { className: "orc-btn__label", children }),
39
+ rightIcon && /* @__PURE__ */ jsx("span", { className: "orc-btn__icon", children: rightIcon })
40
+ ] });
41
+ const ariaDisabled = disabled ? true : void 0;
42
+ if (href) {
43
+ return /* @__PURE__ */ jsx(
44
+ MuiLink,
45
+ {
46
+ href,
47
+ target,
48
+ rel,
49
+ "aria-label": ariaLabel,
50
+ "aria-disabled": ariaDisabled,
51
+ tabIndex: ariaDisabled ? -1 : void 0,
52
+ className: cls,
53
+ onClick: ariaDisabled ? (e) => e.preventDefault() : onClick,
54
+ children: content
55
+ }
56
+ );
57
+ }
58
+ return /* @__PURE__ */ jsx(
59
+ "button",
60
+ {
61
+ type,
62
+ onClick,
63
+ disabled: !!ariaDisabled,
64
+ "aria-label": ariaLabel,
65
+ className: cls,
66
+ children: content
67
+ }
68
+ );
69
+ }
70
+
71
+ export {
72
+ OraculoButton
73
+ };