@adityabheke/renderer-package 1.0.6 → 1.0.8
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.cjs +17 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +17 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -258,7 +258,8 @@ var Button = ({
|
|
|
258
258
|
shadowBlur,
|
|
259
259
|
shadowColor,
|
|
260
260
|
className,
|
|
261
|
-
animationType = "none"
|
|
261
|
+
animationType = "none",
|
|
262
|
+
navigate
|
|
262
263
|
}) => {
|
|
263
264
|
const styles = {
|
|
264
265
|
backgroundColor: variant === "solid" ? isBackgroundTransparent ? "transparent" : backgroundColor : "transparent",
|
|
@@ -274,6 +275,20 @@ var Button = ({
|
|
|
274
275
|
...buildButtonRadiusVars(borderRadius)
|
|
275
276
|
};
|
|
276
277
|
const animationClass = ANIMATION_VARIANTS[animationType] || "";
|
|
278
|
+
const handleClick = () => {
|
|
279
|
+
if (navigate.type === "link") {
|
|
280
|
+
if (navigate.target === "internal") {
|
|
281
|
+
window.location.href = `/${navigate.destination}`;
|
|
282
|
+
} else {
|
|
283
|
+
window.open(`/${navigate.destination}`, "_blank");
|
|
284
|
+
}
|
|
285
|
+
} else if (navigate.type === "scroll") {
|
|
286
|
+
const element = document.getElementById(`/${navigate.destination}`);
|
|
287
|
+
if (element) {
|
|
288
|
+
element.scrollIntoView({ behavior: "smooth" });
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
277
292
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
278
293
|
"div",
|
|
279
294
|
{
|
|
@@ -285,6 +300,7 @@ var Button = ({
|
|
|
285
300
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
286
301
|
"button",
|
|
287
302
|
{
|
|
303
|
+
onClick: handleClick,
|
|
288
304
|
className: cn(
|
|
289
305
|
"transition-all duration-200",
|
|
290
306
|
"[font-size:var(--btns-base)] @sm:[font-size:var(--btns-sm)] @md:[font-size:var(--btns-md)] @lg:[font-size:var(--btns-lg)] @xl:[font-size:var(--btns-xl)] @2xl:[font-size:var(--btns-2xl)]",
|
package/dist/index.d.cts
CHANGED
|
@@ -145,6 +145,11 @@ interface HeadingProps {
|
|
|
145
145
|
animationType?: AnimationType;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
interface ButtonAction {
|
|
149
|
+
type: "link" | "scroll";
|
|
150
|
+
target?: 'internal' | 'external';
|
|
151
|
+
destination: string;
|
|
152
|
+
}
|
|
148
153
|
interface ButtonProps {
|
|
149
154
|
text: string;
|
|
150
155
|
fontSize: ResponsiveValue<number>;
|
|
@@ -159,6 +164,7 @@ interface ButtonProps {
|
|
|
159
164
|
shadowColor: string;
|
|
160
165
|
className?: string;
|
|
161
166
|
animationType?: AnimationType;
|
|
167
|
+
navigate: ButtonAction;
|
|
162
168
|
}
|
|
163
169
|
|
|
164
170
|
declare const componentRegistry: {
|
package/dist/index.d.ts
CHANGED
|
@@ -145,6 +145,11 @@ interface HeadingProps {
|
|
|
145
145
|
animationType?: AnimationType;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
interface ButtonAction {
|
|
149
|
+
type: "link" | "scroll";
|
|
150
|
+
target?: 'internal' | 'external';
|
|
151
|
+
destination: string;
|
|
152
|
+
}
|
|
148
153
|
interface ButtonProps {
|
|
149
154
|
text: string;
|
|
150
155
|
fontSize: ResponsiveValue<number>;
|
|
@@ -159,6 +164,7 @@ interface ButtonProps {
|
|
|
159
164
|
shadowColor: string;
|
|
160
165
|
className?: string;
|
|
161
166
|
animationType?: AnimationType;
|
|
167
|
+
navigate: ButtonAction;
|
|
162
168
|
}
|
|
163
169
|
|
|
164
170
|
declare const componentRegistry: {
|
package/dist/index.js
CHANGED
|
@@ -221,7 +221,8 @@ var Button = ({
|
|
|
221
221
|
shadowBlur,
|
|
222
222
|
shadowColor,
|
|
223
223
|
className,
|
|
224
|
-
animationType = "none"
|
|
224
|
+
animationType = "none",
|
|
225
|
+
navigate
|
|
225
226
|
}) => {
|
|
226
227
|
const styles = {
|
|
227
228
|
backgroundColor: variant === "solid" ? isBackgroundTransparent ? "transparent" : backgroundColor : "transparent",
|
|
@@ -237,6 +238,20 @@ var Button = ({
|
|
|
237
238
|
...buildButtonRadiusVars(borderRadius)
|
|
238
239
|
};
|
|
239
240
|
const animationClass = ANIMATION_VARIANTS[animationType] || "";
|
|
241
|
+
const handleClick = () => {
|
|
242
|
+
if (navigate.type === "link") {
|
|
243
|
+
if (navigate.target === "internal") {
|
|
244
|
+
window.location.href = `/${navigate.destination}`;
|
|
245
|
+
} else {
|
|
246
|
+
window.open(`/${navigate.destination}`, "_blank");
|
|
247
|
+
}
|
|
248
|
+
} else if (navigate.type === "scroll") {
|
|
249
|
+
const element = document.getElementById(`/${navigate.destination}`);
|
|
250
|
+
if (element) {
|
|
251
|
+
element.scrollIntoView({ behavior: "smooth" });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
240
255
|
return /* @__PURE__ */ jsx(
|
|
241
256
|
"div",
|
|
242
257
|
{
|
|
@@ -248,6 +263,7 @@ var Button = ({
|
|
|
248
263
|
children: /* @__PURE__ */ jsx(
|
|
249
264
|
"button",
|
|
250
265
|
{
|
|
266
|
+
onClick: handleClick,
|
|
251
267
|
className: cn(
|
|
252
268
|
"transition-all duration-200",
|
|
253
269
|
"[font-size:var(--btns-base)] @sm:[font-size:var(--btns-sm)] @md:[font-size:var(--btns-md)] @lg:[font-size:var(--btns-lg)] @xl:[font-size:var(--btns-xl)] @2xl:[font-size:var(--btns-2xl)]",
|