oraculo-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.css ADDED
@@ -0,0 +1,216 @@
1
+ /* src/atoms/OraculoButton/OraculoButton.css */
2
+ .orc-btn {
3
+ --nl-green: #9EE86E;
4
+ --nl-hover-hex: #D9F6C6;
5
+ --nl-hover-alpha: .22;
6
+ --nl-press: #254B0C;
7
+ --nl-disabled-border: #4a5542;
8
+ --nl-disabled-fg: #4a5542;
9
+ --stroke-w: 1.5px;
10
+ --h: 32px;
11
+ --pad-x: 12px;
12
+ --pad-y: 8px;
13
+ --radius: 12px;
14
+ box-sizing: border-box;
15
+ height: var(--h);
16
+ font-family: var(--clmc-font);
17
+ display: inline-flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ gap: 8px;
21
+ cursor: pointer;
22
+ text-decoration: none;
23
+ border-radius: var(--radius);
24
+ outline: none;
25
+ position: relative;
26
+ padding: var(--pad-y) var(--pad-x);
27
+ border: 0;
28
+ }
29
+ .orc-btn__label {
30
+ color: currentColor;
31
+ font-size: 14px;
32
+ }
33
+ .orc-btn__icon {
34
+ color: currentColor;
35
+ display: inline-flex;
36
+ line-height: 0;
37
+ font-size: 18px;
38
+ }
39
+ .orc-btn--primary {
40
+ background: var(--nl-green);
41
+ color: #1C1C1C;
42
+ box-shadow: inset 0 0 0 var(--stroke-w) transparent;
43
+ }
44
+ .orc-btn--primary:hover {
45
+ background: var(--nl-hover-hex);
46
+ color: #1C1C1C;
47
+ }
48
+ .orc-btn--primary:active {
49
+ background: var(--nl-press);
50
+ color: #FFFFFF;
51
+ transform: translateY(1px);
52
+ }
53
+ .orc-btn--primary:disabled,
54
+ .orc-btn--primary[aria-disabled=true] {
55
+ background: transparent;
56
+ color: var(--nl-disabled-fg);
57
+ box-shadow: inset 0 0 0 var(--stroke-w) var(--nl-disabled-border);
58
+ cursor: not-allowed;
59
+ transform: none;
60
+ opacity: 1;
61
+ }
62
+ .orc-btn--secondary {
63
+ background: transparent;
64
+ color: var(--nl-green);
65
+ box-shadow: inset 0 0 0 var(--stroke-w) var(--nl-green);
66
+ }
67
+ .orc-btn--secondary:hover {
68
+ background: rgba(229, 244, 219, var(--nl-hover-alpha)) !important;
69
+ color: var(--nl-hover-hex);
70
+ box-shadow: inset 0 0 0 var(--stroke-w) var(--nl-hover-hex);
71
+ }
72
+ .orc-btn--secondary:active {
73
+ transform: translateY(1px);
74
+ color: var(--nl-press);
75
+ box-shadow: inset 0 0 0 var(--stroke-w) var(--nl-press);
76
+ background: rgba(37, 75, 12, 0.10);
77
+ }
78
+ .orc-btn--secondary:focus-visible {
79
+ box-shadow: inset 0 0 0 var(--stroke-w) var(--nl-green), 0 0 0 3px rgba(197, 228, 177, .45);
80
+ }
81
+ .orc-btn--secondary:disabled,
82
+ .orc-btn--secondary[aria-disabled=true] {
83
+ background: transparent;
84
+ color: var(--nl-disabled-fg);
85
+ box-shadow: inset 0 0 0 var(--stroke-w) var(--nl-disabled-border);
86
+ cursor: not-allowed;
87
+ }
88
+ .orc-btn--tertiary {
89
+ background: transparent;
90
+ color: var(--nl-green);
91
+ box-shadow: none;
92
+ }
93
+ .orc-btn--tertiary:hover {
94
+ color: var(--nl-hover-hex);
95
+ }
96
+ .orc-btn--tertiary:active {
97
+ color: var(--nl-press);
98
+ background: rgba(37, 75, 12, 0.08);
99
+ transform: translateY(1px);
100
+ }
101
+ .orc-btn--tertiary:focus-visible {
102
+ box-shadow: 0 0 0 3px rgba(197, 228, 177, .45);
103
+ }
104
+ .orc-btn--tertiary:disabled,
105
+ .orc-btn--tertiary[aria-disabled=true] {
106
+ color: var(--nl-disabled-fg);
107
+ background: transparent;
108
+ box-shadow: none;
109
+ cursor: not-allowed;
110
+ }
111
+ .orc-btn--sm {
112
+ --h: 32px;
113
+ --pad-y: 8px;
114
+ --pad-x: 12px;
115
+ --radius: 12px;
116
+ }
117
+ .orc-btn--md {
118
+ --h: 40px;
119
+ --pad-y: 10px;
120
+ --pad-x: 16px;
121
+ --radius: 12px;
122
+ }
123
+ .orc-btn--lg {
124
+ --h: 48px;
125
+ --pad-y: 12px;
126
+ --pad-x: 20px;
127
+ --radius: 16px;
128
+ }
129
+ .orc-btn--sm .orc-btn__label,
130
+ .orc-btn--md .orc-btn__label,
131
+ .orc-btn--lg .orc-btn__label {
132
+ font-size: 14px !important;
133
+ }
134
+ .orc-btn--iconOnly {
135
+ width: 40px;
136
+ min-width: 40px;
137
+ padding: 0;
138
+ }
139
+ .orc-btn--sm.orc-btn--iconOnly {
140
+ width: 32px;
141
+ min-width: 32px;
142
+ }
143
+ .orc-btn--md.orc-btn--iconOnly {
144
+ width: 40px;
145
+ min-width: 40px;
146
+ }
147
+ .orc-btn--lg.orc-btn--iconOnly {
148
+ width: 48px;
149
+ min-width: 48px;
150
+ }
151
+ .orc-btn--full {
152
+ width: 100%;
153
+ }
154
+ .orc-btn--fullHeight {
155
+ height: 100%;
156
+ }
157
+
158
+ /* src/atoms/OraculoSectionTitle/OraculoSectionTitle.css */
159
+ .orc-section-title {
160
+ display: flex;
161
+ align-items: center;
162
+ gap: 8px;
163
+ }
164
+ .orc-section-title__icon {
165
+ width: 40px;
166
+ height: 40px;
167
+ object-fit: none;
168
+ }
169
+ .orc-section-title__title {
170
+ margin: 0;
171
+ font-weight: 700;
172
+ letter-spacing: 0;
173
+ color: #ffffff;
174
+ }
175
+ .orc-section-title--xs .orc-section-title__title {
176
+ font-size: 14px;
177
+ line-height: 18px;
178
+ }
179
+ .orc-section-title--sm .orc-section-title__title {
180
+ font-size: 18px;
181
+ line-height: 24px;
182
+ }
183
+ .orc-section-title--md .orc-section-title__title {
184
+ font-size: 32px;
185
+ line-height: 48px;
186
+ }
187
+ .orc-section-title--lg .orc-section-title__title {
188
+ font-size: 22px;
189
+ line-height: 30px;
190
+ }
191
+ .orc-section-title--xs .orc-section-title__icon {
192
+ width: 24px;
193
+ height: 24px;
194
+ }
195
+ @media (max-width: 768px) {
196
+ .orc-section-title__icon {
197
+ width: 24px;
198
+ height: 24px;
199
+ }
200
+ .orc-section-title--xs .orc-section-title__title {
201
+ font-size: 14px;
202
+ line-height: 18px;
203
+ }
204
+ .orc-section-title--sm .orc-section-title__title {
205
+ font-size: 16px;
206
+ line-height: 22px;
207
+ }
208
+ .orc-section-title--md .orc-section-title__title {
209
+ font-size: 18px;
210
+ line-height: 24px;
211
+ }
212
+ .orc-section-title--lg .orc-section-title__title {
213
+ font-size: 20px;
214
+ line-height: 26px;
215
+ }
216
+ }
@@ -0,0 +1,81 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React, { ReactNode } from 'react';
3
+
4
+ interface OraculoButtonProps {
5
+ children?: React.ReactNode;
6
+ onClick?: () => void;
7
+ href?: string;
8
+ target?: React.HTMLAttributeAnchorTarget;
9
+ rel?: string;
10
+ type?: "button" | "submit" | "reset";
11
+ disabled?: boolean;
12
+ variant?: "primary" | "secondary" | "tertiary";
13
+ size?: "sm" | "md" | "lg";
14
+ fullWidth?: boolean;
15
+ fullHeight?: boolean;
16
+ className?: string;
17
+ ariaLabel?: string;
18
+ leftIcon?: React.ReactNode;
19
+ rightIcon?: React.ReactNode;
20
+ iconOnly?: boolean;
21
+ }
22
+ declare function OraculoButton({ children, onClick, href, target, rel, type, disabled, variant, size, fullWidth, fullHeight, className, ariaLabel, leftIcon, rightIcon, iconOnly, }: OraculoButtonProps): react_jsx_runtime.JSX.Element;
23
+
24
+ interface OraculoSectionTitleProps {
25
+ title: string;
26
+ iconUrl?: string;
27
+ size?: "xs" | "sm" | "md" | "lg";
28
+ className?: string;
29
+ }
30
+ declare function OraculoSectionTitle({ title, iconUrl, size, className, }: OraculoSectionTitleProps): react_jsx_runtime.JSX.Element;
31
+
32
+ interface OraculoCarouselOptions {
33
+ type?: string;
34
+ perPage?: number;
35
+ gap?: string;
36
+ pagination?: boolean;
37
+ arrows?: boolean;
38
+ padding?: {
39
+ left?: string;
40
+ right?: string;
41
+ };
42
+ breakpoints?: Record<string | number, OraculoCarouselOptions>;
43
+ [key: string]: any;
44
+ }
45
+ interface OraculoCarouselRef {
46
+ next: () => void;
47
+ prev: () => void;
48
+ go: (index: number | string) => void;
49
+ }
50
+ interface OraculoCarouselProps<T = any> {
51
+ items: T[];
52
+ renderItem: (item: T, index: number) => ReactNode;
53
+ perPage?: number;
54
+ gap?: string;
55
+ breakpoints?: {};
56
+ options?: OraculoCarouselOptions;
57
+ className?: string;
58
+ onMove?: (info: {
59
+ index: number;
60
+ isStart: boolean;
61
+ isEnd: boolean;
62
+ total: number;
63
+ }) => void;
64
+ }
65
+ declare const OraculoCarousel: React.ForwardRefExoticComponent<OraculoCarouselProps<any> & React.RefAttributes<OraculoCarouselRef>>;
66
+
67
+ interface OraculoDestacadoItem {
68
+ id?: string | number;
69
+ src: string;
70
+ alt: string;
71
+ }
72
+ interface OraculoSeccionDestacadosProps {
73
+ items: OraculoDestacadoItem[];
74
+ title?: string;
75
+ iconUrl?: string;
76
+ onViewMore?: () => void;
77
+ className?: string;
78
+ }
79
+ declare function OraculoSeccionDestacados({ items, title, iconUrl, onViewMore, className, }: OraculoSeccionDestacadosProps): react_jsx_runtime.JSX.Element;
80
+
81
+ export { OraculoButton, type OraculoButtonProps, OraculoCarousel, type OraculoCarouselOptions, type OraculoCarouselProps, type OraculoCarouselRef, type OraculoDestacadoItem, OraculoSeccionDestacados, type OraculoSeccionDestacadosProps, OraculoSectionTitle, type OraculoSectionTitleProps };
@@ -0,0 +1,81 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React, { ReactNode } from 'react';
3
+
4
+ interface OraculoButtonProps {
5
+ children?: React.ReactNode;
6
+ onClick?: () => void;
7
+ href?: string;
8
+ target?: React.HTMLAttributeAnchorTarget;
9
+ rel?: string;
10
+ type?: "button" | "submit" | "reset";
11
+ disabled?: boolean;
12
+ variant?: "primary" | "secondary" | "tertiary";
13
+ size?: "sm" | "md" | "lg";
14
+ fullWidth?: boolean;
15
+ fullHeight?: boolean;
16
+ className?: string;
17
+ ariaLabel?: string;
18
+ leftIcon?: React.ReactNode;
19
+ rightIcon?: React.ReactNode;
20
+ iconOnly?: boolean;
21
+ }
22
+ declare function OraculoButton({ children, onClick, href, target, rel, type, disabled, variant, size, fullWidth, fullHeight, className, ariaLabel, leftIcon, rightIcon, iconOnly, }: OraculoButtonProps): react_jsx_runtime.JSX.Element;
23
+
24
+ interface OraculoSectionTitleProps {
25
+ title: string;
26
+ iconUrl?: string;
27
+ size?: "xs" | "sm" | "md" | "lg";
28
+ className?: string;
29
+ }
30
+ declare function OraculoSectionTitle({ title, iconUrl, size, className, }: OraculoSectionTitleProps): react_jsx_runtime.JSX.Element;
31
+
32
+ interface OraculoCarouselOptions {
33
+ type?: string;
34
+ perPage?: number;
35
+ gap?: string;
36
+ pagination?: boolean;
37
+ arrows?: boolean;
38
+ padding?: {
39
+ left?: string;
40
+ right?: string;
41
+ };
42
+ breakpoints?: Record<string | number, OraculoCarouselOptions>;
43
+ [key: string]: any;
44
+ }
45
+ interface OraculoCarouselRef {
46
+ next: () => void;
47
+ prev: () => void;
48
+ go: (index: number | string) => void;
49
+ }
50
+ interface OraculoCarouselProps<T = any> {
51
+ items: T[];
52
+ renderItem: (item: T, index: number) => ReactNode;
53
+ perPage?: number;
54
+ gap?: string;
55
+ breakpoints?: {};
56
+ options?: OraculoCarouselOptions;
57
+ className?: string;
58
+ onMove?: (info: {
59
+ index: number;
60
+ isStart: boolean;
61
+ isEnd: boolean;
62
+ total: number;
63
+ }) => void;
64
+ }
65
+ declare const OraculoCarousel: React.ForwardRefExoticComponent<OraculoCarouselProps<any> & React.RefAttributes<OraculoCarouselRef>>;
66
+
67
+ interface OraculoDestacadoItem {
68
+ id?: string | number;
69
+ src: string;
70
+ alt: string;
71
+ }
72
+ interface OraculoSeccionDestacadosProps {
73
+ items: OraculoDestacadoItem[];
74
+ title?: string;
75
+ iconUrl?: string;
76
+ onViewMore?: () => void;
77
+ className?: string;
78
+ }
79
+ declare function OraculoSeccionDestacados({ items, title, iconUrl, onViewMore, className, }: OraculoSeccionDestacadosProps): react_jsx_runtime.JSX.Element;
80
+
81
+ export { OraculoButton, type OraculoButtonProps, OraculoCarousel, type OraculoCarouselOptions, type OraculoCarouselProps, type OraculoCarouselRef, type OraculoDestacadoItem, OraculoSeccionDestacados, type OraculoSeccionDestacadosProps, OraculoSectionTitle, type OraculoSectionTitleProps };
package/dist/index.js ADDED
@@ -0,0 +1,357 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ OraculoButton: () => OraculoButton,
24
+ OraculoCarousel: () => OraculoCarousel_default,
25
+ OraculoSeccionDestacados: () => OraculoSeccionDestacados,
26
+ OraculoSectionTitle: () => OraculoSectionTitle
27
+ });
28
+ module.exports = __toCommonJS(index_exports);
29
+
30
+ // src/atoms/OraculoButton/OraculoButton.tsx
31
+ var import_material = require("@mui/material");
32
+ var import_jsx_runtime = require("react/jsx-runtime");
33
+ function OraculoButton({
34
+ children,
35
+ onClick,
36
+ href,
37
+ target,
38
+ rel,
39
+ type = "button",
40
+ disabled = false,
41
+ variant = "primary",
42
+ size,
43
+ fullWidth = false,
44
+ fullHeight = false,
45
+ className = "",
46
+ ariaLabel,
47
+ leftIcon,
48
+ rightIcon,
49
+ iconOnly
50
+ }) {
51
+ const hasText = !!children && children !== true;
52
+ const hasLeft = !!leftIcon;
53
+ const hasRight = !!rightIcon;
54
+ const onlyOneIcon = (hasLeft ? 1 : 0) + (hasRight ? 1 : 0) === 1;
55
+ const isIconOnly = iconOnly != null ? iconOnly : onlyOneIcon && !hasText;
56
+ const cls = [
57
+ "orc-btn",
58
+ variant === "secondary" ? "orc-btn--secondary" : variant === "tertiary" ? "orc-btn--tertiary" : "orc-btn--primary",
59
+ size ? `orc-btn--${size}` : "",
60
+ fullWidth ? "orc-btn--full" : "",
61
+ fullHeight ? "orc-btn--fullHeight" : "",
62
+ isIconOnly ? "orc-btn--iconOnly" : "",
63
+ className
64
+ ].filter(Boolean).join(" ");
65
+ const content = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
66
+ leftIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "orc-btn__icon", children: leftIcon }),
67
+ !isIconOnly && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "orc-btn__label", children }),
68
+ rightIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "orc-btn__icon", children: rightIcon })
69
+ ] });
70
+ const ariaDisabled = disabled ? true : void 0;
71
+ if (href) {
72
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
+ import_material.Link,
74
+ {
75
+ href,
76
+ target,
77
+ rel,
78
+ "aria-label": ariaLabel,
79
+ "aria-disabled": ariaDisabled,
80
+ tabIndex: ariaDisabled ? -1 : void 0,
81
+ className: cls,
82
+ onClick: ariaDisabled ? (e) => e.preventDefault() : onClick,
83
+ children: content
84
+ }
85
+ );
86
+ }
87
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
88
+ "button",
89
+ {
90
+ type,
91
+ onClick,
92
+ disabled: !!ariaDisabled,
93
+ "aria-label": ariaLabel,
94
+ className: cls,
95
+ children: content
96
+ }
97
+ );
98
+ }
99
+
100
+ // src/atoms/OraculoSectionTitle/OraculoSectionTitle.tsx
101
+ var import_jsx_runtime2 = require("react/jsx-runtime");
102
+ function OraculoSectionTitle({
103
+ title,
104
+ iconUrl,
105
+ size = "md",
106
+ className = ""
107
+ }) {
108
+ const sizeClass = size ? `orc-section-title--${size}` : "";
109
+ const wrapperClass = [
110
+ "orc-section-title",
111
+ sizeClass,
112
+ className
113
+ ].filter(Boolean).join(" ");
114
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: wrapperClass, children: [
115
+ iconUrl && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
116
+ "img",
117
+ {
118
+ src: iconUrl,
119
+ alt: "",
120
+ className: "orc-section-title__icon"
121
+ }
122
+ ),
123
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { className: "orc-section-title__title", children: title })
124
+ ] });
125
+ }
126
+
127
+ // src/molecules/OraculoCarousel/OraculoCarousel.tsx
128
+ var import_react = require("react");
129
+ var import_react_splide = require("@splidejs/react-splide");
130
+ var import_jsx_runtime3 = require("react/jsx-runtime");
131
+ var Splide = import_react_splide.Splide;
132
+ var SplideSlide = import_react_splide.SplideSlide;
133
+ var OraculoCarousel = (0, import_react.forwardRef)(
134
+ ({
135
+ items = [],
136
+ renderItem,
137
+ perPage = 4,
138
+ gap = "12px",
139
+ breakpoints = {
140
+ 1024: { perPage: 3, gap: "10px" },
141
+ 768: { perPage: 1.3, gap: "10px", padding: { right: "16px" } }
142
+ },
143
+ options = {},
144
+ className = "",
145
+ onMove
146
+ }, ref) => {
147
+ const splideRef = (0, import_react.useRef)(null);
148
+ (0, import_react.useImperativeHandle)(ref, () => ({
149
+ next: () => {
150
+ var _a;
151
+ return (_a = splideRef.current) == null ? void 0 : _a.go(">");
152
+ },
153
+ prev: () => {
154
+ var _a;
155
+ return (_a = splideRef.current) == null ? void 0 : _a.go("<");
156
+ },
157
+ go: (index) => {
158
+ var _a;
159
+ return (_a = splideRef.current) == null ? void 0 : _a.go(index);
160
+ }
161
+ }));
162
+ const handleMove = (0, import_react.useCallback)(
163
+ (splide) => {
164
+ const index = splide.index;
165
+ const total = splide.length;
166
+ const perPage2 = splide.options.perPage || 1;
167
+ const isStart = index === 0;
168
+ const isEnd = index >= total - perPage2;
169
+ onMove == null ? void 0 : onMove({ index, isStart, isEnd, total });
170
+ },
171
+ [onMove]
172
+ );
173
+ const handleMounted = (0, import_react.useCallback)(
174
+ (splide) => {
175
+ handleMove(splide);
176
+ },
177
+ [handleMove]
178
+ );
179
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, style: { width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
180
+ Splide,
181
+ {
182
+ ref: splideRef,
183
+ options: {
184
+ type: "slide",
185
+ trimSpace: false,
186
+ perPage,
187
+ gap,
188
+ drag: true,
189
+ pagination: false,
190
+ rewind: false,
191
+ arrows: false,
192
+ focus: 0,
193
+ autoWidth: true,
194
+ breakpoints,
195
+ ...options
196
+ },
197
+ onMove: handleMove,
198
+ onMounted: handleMounted,
199
+ children: items.map((item, index) => {
200
+ var _a;
201
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SplideSlide, { children: renderItem(item, index) }, (_a = item.id) != null ? _a : index);
202
+ })
203
+ }
204
+ ) });
205
+ }
206
+ );
207
+ var OraculoCarousel_default = OraculoCarousel;
208
+
209
+ // src/organisms/OraculoSeccionDestacados/OraculoSeccionDestacados.tsx
210
+ var import_react2 = require("react");
211
+
212
+ // ../node_modules/@mui/icons-material/esm/utils/createSvgIcon.js
213
+ var import_utils = require("@mui/material/utils");
214
+
215
+ // ../node_modules/@mui/icons-material/esm/ChevronLeftRounded.js
216
+ var import_jsx_runtime4 = require("react/jsx-runtime");
217
+ var ChevronLeftRounded_default = (0, import_utils.createSvgIcon)(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", {
218
+ d: "M14.71 6.71a.996.996 0 0 0-1.41 0L8.71 11.3c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0s.39-1.02 0-1.41L10.83 12l3.88-3.88c.39-.39.38-1.03 0-1.41"
219
+ }), "ChevronLeftRounded");
220
+
221
+ // ../node_modules/@mui/icons-material/esm/ChevronRightRounded.js
222
+ var import_jsx_runtime5 = require("react/jsx-runtime");
223
+ var ChevronRightRounded_default = (0, import_utils.createSvgIcon)(/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", {
224
+ d: "M9.29 6.71c-.39.39-.39 1.02 0 1.41L13.17 12l-3.88 3.88c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41L10.7 6.7c-.38-.38-1.02-.38-1.41.01"
225
+ }), "ChevronRightRounded");
226
+
227
+ // src/organisms/OraculoSeccionDestacados/OraculoSeccionDestacados.tsx
228
+ var import_jsx_runtime6 = require("react/jsx-runtime");
229
+ function OraculoSeccionDestacados({
230
+ items,
231
+ title = "Destacados",
232
+ iconUrl,
233
+ onViewMore,
234
+ className = ""
235
+ }) {
236
+ const carouselRef = (0, import_react2.useRef)(null);
237
+ const [navState, setNavState] = (0, import_react2.useState)({ isStart: true, isEnd: false });
238
+ const handlePrev = () => {
239
+ var _a;
240
+ (_a = carouselRef.current) == null ? void 0 : _a.prev();
241
+ };
242
+ const handleNext = () => {
243
+ var _a;
244
+ (_a = carouselRef.current) == null ? void 0 : _a.next();
245
+ };
246
+ const handleViewMore = () => {
247
+ onViewMore == null ? void 0 : onViewMore();
248
+ };
249
+ const sectionClassName = className || void 0;
250
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: sectionClassName, style: { width: "100%" }, children: [
251
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
252
+ "header",
253
+ {
254
+ style: {
255
+ display: "grid",
256
+ gridTemplateColumns: "1fr auto auto",
257
+ alignItems: "center",
258
+ columnGap: 12,
259
+ rowGap: 8,
260
+ marginBottom: 16
261
+ },
262
+ children: [
263
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
264
+ OraculoSectionTitle,
265
+ {
266
+ title,
267
+ iconUrl,
268
+ size: "md"
269
+ }
270
+ ),
271
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
272
+ "div",
273
+ {
274
+ style: {
275
+ display: "flex",
276
+ gap: 8
277
+ },
278
+ children: [
279
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
280
+ OraculoButton,
281
+ {
282
+ ariaLabel: "Anterior",
283
+ variant: "secondary",
284
+ iconOnly: true,
285
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronLeftRounded_default, {}),
286
+ onClick: handlePrev,
287
+ disabled: navState.isStart
288
+ }
289
+ ),
290
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
291
+ OraculoButton,
292
+ {
293
+ ariaLabel: "Siguiente",
294
+ variant: "secondary",
295
+ iconOnly: true,
296
+ rightIcon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronRightRounded_default, {}),
297
+ onClick: handleNext,
298
+ disabled: navState.isEnd
299
+ }
300
+ )
301
+ ]
302
+ }
303
+ ),
304
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(OraculoButton, { variant: "secondary", onClick: handleViewMore, children: "Ver m\xE1s" })
305
+ ]
306
+ }
307
+ ),
308
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
309
+ OraculoCarousel_default,
310
+ {
311
+ ref: carouselRef,
312
+ items,
313
+ perPage: 3.395,
314
+ gap: "16px",
315
+ options: { autoWidth: false },
316
+ breakpoints: {
317
+ 768: { perPage: 1.15, focus: "start" },
318
+ 1024: { perPage: 2.5, focus: "start" }
319
+ },
320
+ renderItem: (item) => {
321
+ var _a;
322
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
323
+ "div",
324
+ {
325
+ style: {
326
+ textAlign: "center",
327
+ marginTop: 16
328
+ },
329
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
330
+ "img",
331
+ {
332
+ src: item.src,
333
+ alt: item.alt,
334
+ style: {
335
+ width: "100%",
336
+ height: "auto",
337
+ borderRadius: 8,
338
+ display: "block"
339
+ }
340
+ }
341
+ )
342
+ },
343
+ (_a = item.id) != null ? _a : item.src
344
+ );
345
+ },
346
+ onMove: ({ isStart, isEnd }) => setNavState({ isStart, isEnd })
347
+ }
348
+ )
349
+ ] });
350
+ }
351
+ // Annotate the CommonJS export names for ESM import in node:
352
+ 0 && (module.exports = {
353
+ OraculoButton,
354
+ OraculoCarousel,
355
+ OraculoSeccionDestacados,
356
+ OraculoSectionTitle
357
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,335 @@
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
+ // src/atoms/OraculoSectionTitle/OraculoSectionTitle.tsx
72
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
73
+ function OraculoSectionTitle({
74
+ title,
75
+ iconUrl,
76
+ size = "md",
77
+ className = ""
78
+ }) {
79
+ const sizeClass = size ? `orc-section-title--${size}` : "";
80
+ const wrapperClass = [
81
+ "orc-section-title",
82
+ sizeClass,
83
+ className
84
+ ].filter(Boolean).join(" ");
85
+ return /* @__PURE__ */ jsxs2("div", { className: wrapperClass, children: [
86
+ iconUrl && /* @__PURE__ */ jsx2(
87
+ "img",
88
+ {
89
+ src: iconUrl,
90
+ alt: "",
91
+ className: "orc-section-title__icon"
92
+ }
93
+ ),
94
+ /* @__PURE__ */ jsx2("h2", { className: "orc-section-title__title", children: title })
95
+ ] });
96
+ }
97
+
98
+ // src/molecules/OraculoCarousel/OraculoCarousel.tsx
99
+ import {
100
+ useRef,
101
+ useImperativeHandle,
102
+ forwardRef,
103
+ useCallback
104
+ } from "react";
105
+ import {
106
+ Splide as SplideRaw,
107
+ SplideSlide as SplideSlideRaw
108
+ } from "@splidejs/react-splide";
109
+ import { jsx as jsx3 } from "react/jsx-runtime";
110
+ var Splide = SplideRaw;
111
+ var SplideSlide = SplideSlideRaw;
112
+ var OraculoCarousel = forwardRef(
113
+ ({
114
+ items = [],
115
+ renderItem,
116
+ perPage = 4,
117
+ gap = "12px",
118
+ breakpoints = {
119
+ 1024: { perPage: 3, gap: "10px" },
120
+ 768: { perPage: 1.3, gap: "10px", padding: { right: "16px" } }
121
+ },
122
+ options = {},
123
+ className = "",
124
+ onMove
125
+ }, ref) => {
126
+ const splideRef = useRef(null);
127
+ useImperativeHandle(ref, () => ({
128
+ next: () => {
129
+ var _a;
130
+ return (_a = splideRef.current) == null ? void 0 : _a.go(">");
131
+ },
132
+ prev: () => {
133
+ var _a;
134
+ return (_a = splideRef.current) == null ? void 0 : _a.go("<");
135
+ },
136
+ go: (index) => {
137
+ var _a;
138
+ return (_a = splideRef.current) == null ? void 0 : _a.go(index);
139
+ }
140
+ }));
141
+ const handleMove = useCallback(
142
+ (splide) => {
143
+ const index = splide.index;
144
+ const total = splide.length;
145
+ const perPage2 = splide.options.perPage || 1;
146
+ const isStart = index === 0;
147
+ const isEnd = index >= total - perPage2;
148
+ onMove == null ? void 0 : onMove({ index, isStart, isEnd, total });
149
+ },
150
+ [onMove]
151
+ );
152
+ const handleMounted = useCallback(
153
+ (splide) => {
154
+ handleMove(splide);
155
+ },
156
+ [handleMove]
157
+ );
158
+ return /* @__PURE__ */ jsx3("div", { className, style: { width: "100%" }, children: /* @__PURE__ */ jsx3(
159
+ Splide,
160
+ {
161
+ ref: splideRef,
162
+ options: {
163
+ type: "slide",
164
+ trimSpace: false,
165
+ perPage,
166
+ gap,
167
+ drag: true,
168
+ pagination: false,
169
+ rewind: false,
170
+ arrows: false,
171
+ focus: 0,
172
+ autoWidth: true,
173
+ breakpoints,
174
+ ...options
175
+ },
176
+ onMove: handleMove,
177
+ onMounted: handleMounted,
178
+ children: items.map((item, index) => {
179
+ var _a;
180
+ return /* @__PURE__ */ jsx3(SplideSlide, { children: renderItem(item, index) }, (_a = item.id) != null ? _a : index);
181
+ })
182
+ }
183
+ ) });
184
+ }
185
+ );
186
+ var OraculoCarousel_default = OraculoCarousel;
187
+
188
+ // src/organisms/OraculoSeccionDestacados/OraculoSeccionDestacados.tsx
189
+ import { useRef as useRef2, useState } from "react";
190
+
191
+ // ../node_modules/@mui/icons-material/esm/utils/createSvgIcon.js
192
+ import { createSvgIcon } from "@mui/material/utils";
193
+
194
+ // ../node_modules/@mui/icons-material/esm/ChevronLeftRounded.js
195
+ import { jsx as _jsx } from "react/jsx-runtime";
196
+ var ChevronLeftRounded_default = createSvgIcon(/* @__PURE__ */ _jsx("path", {
197
+ d: "M14.71 6.71a.996.996 0 0 0-1.41 0L8.71 11.3c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0s.39-1.02 0-1.41L10.83 12l3.88-3.88c.39-.39.38-1.03 0-1.41"
198
+ }), "ChevronLeftRounded");
199
+
200
+ // ../node_modules/@mui/icons-material/esm/ChevronRightRounded.js
201
+ import { jsx as _jsx2 } from "react/jsx-runtime";
202
+ var ChevronRightRounded_default = createSvgIcon(/* @__PURE__ */ _jsx2("path", {
203
+ d: "M9.29 6.71c-.39.39-.39 1.02 0 1.41L13.17 12l-3.88 3.88c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41L10.7 6.7c-.38-.38-1.02-.38-1.41.01"
204
+ }), "ChevronRightRounded");
205
+
206
+ // src/organisms/OraculoSeccionDestacados/OraculoSeccionDestacados.tsx
207
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
208
+ function OraculoSeccionDestacados({
209
+ items,
210
+ title = "Destacados",
211
+ iconUrl,
212
+ onViewMore,
213
+ className = ""
214
+ }) {
215
+ const carouselRef = useRef2(null);
216
+ const [navState, setNavState] = useState({ isStart: true, isEnd: false });
217
+ const handlePrev = () => {
218
+ var _a;
219
+ (_a = carouselRef.current) == null ? void 0 : _a.prev();
220
+ };
221
+ const handleNext = () => {
222
+ var _a;
223
+ (_a = carouselRef.current) == null ? void 0 : _a.next();
224
+ };
225
+ const handleViewMore = () => {
226
+ onViewMore == null ? void 0 : onViewMore();
227
+ };
228
+ const sectionClassName = className || void 0;
229
+ return /* @__PURE__ */ jsxs3("section", { className: sectionClassName, style: { width: "100%" }, children: [
230
+ /* @__PURE__ */ jsxs3(
231
+ "header",
232
+ {
233
+ style: {
234
+ display: "grid",
235
+ gridTemplateColumns: "1fr auto auto",
236
+ alignItems: "center",
237
+ columnGap: 12,
238
+ rowGap: 8,
239
+ marginBottom: 16
240
+ },
241
+ children: [
242
+ /* @__PURE__ */ jsx4(
243
+ OraculoSectionTitle,
244
+ {
245
+ title,
246
+ iconUrl,
247
+ size: "md"
248
+ }
249
+ ),
250
+ /* @__PURE__ */ jsxs3(
251
+ "div",
252
+ {
253
+ style: {
254
+ display: "flex",
255
+ gap: 8
256
+ },
257
+ children: [
258
+ /* @__PURE__ */ jsx4(
259
+ OraculoButton,
260
+ {
261
+ ariaLabel: "Anterior",
262
+ variant: "secondary",
263
+ iconOnly: true,
264
+ leftIcon: /* @__PURE__ */ jsx4(ChevronLeftRounded_default, {}),
265
+ onClick: handlePrev,
266
+ disabled: navState.isStart
267
+ }
268
+ ),
269
+ /* @__PURE__ */ jsx4(
270
+ OraculoButton,
271
+ {
272
+ ariaLabel: "Siguiente",
273
+ variant: "secondary",
274
+ iconOnly: true,
275
+ rightIcon: /* @__PURE__ */ jsx4(ChevronRightRounded_default, {}),
276
+ onClick: handleNext,
277
+ disabled: navState.isEnd
278
+ }
279
+ )
280
+ ]
281
+ }
282
+ ),
283
+ /* @__PURE__ */ jsx4(OraculoButton, { variant: "secondary", onClick: handleViewMore, children: "Ver m\xE1s" })
284
+ ]
285
+ }
286
+ ),
287
+ /* @__PURE__ */ jsx4(
288
+ OraculoCarousel_default,
289
+ {
290
+ ref: carouselRef,
291
+ items,
292
+ perPage: 3.395,
293
+ gap: "16px",
294
+ options: { autoWidth: false },
295
+ breakpoints: {
296
+ 768: { perPage: 1.15, focus: "start" },
297
+ 1024: { perPage: 2.5, focus: "start" }
298
+ },
299
+ renderItem: (item) => {
300
+ var _a;
301
+ return /* @__PURE__ */ jsx4(
302
+ "div",
303
+ {
304
+ style: {
305
+ textAlign: "center",
306
+ marginTop: 16
307
+ },
308
+ children: /* @__PURE__ */ jsx4(
309
+ "img",
310
+ {
311
+ src: item.src,
312
+ alt: item.alt,
313
+ style: {
314
+ width: "100%",
315
+ height: "auto",
316
+ borderRadius: 8,
317
+ display: "block"
318
+ }
319
+ }
320
+ )
321
+ },
322
+ (_a = item.id) != null ? _a : item.src
323
+ );
324
+ },
325
+ onMove: ({ isStart, isEnd }) => setNavState({ isStart, isEnd })
326
+ }
327
+ )
328
+ ] });
329
+ }
330
+ export {
331
+ OraculoButton,
332
+ OraculoCarousel_default as OraculoCarousel,
333
+ OraculoSeccionDestacados,
334
+ OraculoSectionTitle
335
+ };
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "oraculo-ui",
3
+ "version": "0.1.0",
4
+ "main": "./dist/index.js",
5
+ "module": "./dist/index.mjs",
6
+ "types": "./dist/index.d.ts",
7
+ "sideEffects": [
8
+ "./dist/index.css"
9
+ ],
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsup src/index.ts --dts --format cjs,esm --out-dir dist --target=es2019 --tsconfig ./tsconfig.json"
15
+ },
16
+ "peerDependencies": {
17
+ "@mui/material": ">=5",
18
+ "react": ">=18",
19
+ "react-dom": ">=18",
20
+ "@splidejs/react-splide": ">=0.7.0"
21
+ },
22
+ "devDependencies": {
23
+ "@types/react": "^18.3.27",
24
+ "@types/react-dom": "^18.3.7",
25
+ "tsup": "^8.5.1",
26
+ "typescript": "^5.9.3"
27
+ }
28
+ }