@stackshift-ui/button 6.0.5 → 6.0.6
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/button.d.ts +26 -0
- package/dist/button.js +1 -0
- package/dist/button.mjs +1 -0
- package/dist/chunk-5BNLLVMY.mjs +1 -0
- package/dist/chunk-RVVB2H7S.mjs +1 -0
- package/dist/helper/index.d.ts +2 -0
- package/dist/helper/index.js +1 -0
- package/dist/helper/index.mjs +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.js +1 -0
- package/package.json +6 -6
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import { type LabeledRoute } from "./types";
|
|
3
|
+
type Variant = "outline" | "ghost" | "link" | "custom" | "solid" | "addToWishlist" | "unstyled" | "swiper_pagination" | "tab";
|
|
4
|
+
type TextSize = "xs" | "sm" | "md" | "lg";
|
|
5
|
+
type RadiusSize = "none" | "sm" | "md" | "base" | "lg" | "xl" | "2xl" | "full";
|
|
6
|
+
interface BaseType {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
variant?: Variant;
|
|
9
|
+
radius?: RadiusSize;
|
|
10
|
+
size?: TextSize;
|
|
11
|
+
ariaLabel?: string;
|
|
12
|
+
isActive?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface LinkProps extends BaseType, Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "type"> {
|
|
15
|
+
link: LabeledRoute;
|
|
16
|
+
as: "link";
|
|
17
|
+
}
|
|
18
|
+
interface ButtonProps extends BaseType, ButtonHTMLAttributes<HTMLButtonElement> {
|
|
19
|
+
as?: "button";
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
loadingComponent?: React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
type Props = ButtonProps | LinkProps;
|
|
25
|
+
export declare function Button({ children, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export {};
|
package/dist/button.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var O=Object.create;var d=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var G=(t,e)=>{for(var o in e)d(t,o,{get:e[o],enumerable:!0})},T=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of j(e))!D.call(t,r)&&r!==o&&d(t,r,{get:()=>e[r],enumerable:!(s=U(e,r))||s.enumerable});return t};var J=(t,e,o)=>(o=t!=null?O(q(t)):{},T(e||!t||!t.__esModule?d(o,"default",{value:t,enumerable:!0}):o,t)),K=t=>T(d({},"__esModule",{value:!0}),t);var X={};G(X,{Button:()=>Q});module.exports=K(X);var S=require("@stackshift-ui/link"),B=require("@stackshift-ui/system"),u=J(require("classnames")),w=require("react-icons/fa");var v=t=>{var e,o;return!(t!=null&&t.internalLink)&&!(t!=null&&t.externalLink)?"/page-not-found":(t==null?void 0:t.type)==="linkInternal"&&((o=(e=t==null?void 0:t.internalLink)==null?void 0:e.toLowerCase())!=null&&o.includes("home"))?"/":(t==null?void 0:t.type)==="linkInternal"?`/${t==null?void 0:t.internalLink}`:(t==null?void 0:t.type)==="linkExternal"?`${t==null?void 0:t.externalLink}`:"/"};var l=require("react/jsx-runtime"),R="Button";function Q({children:t,...e}){let{[R]:o="button"}=(0,B.useStackShiftUIComponents)(),s={xs:"py-1 px-3 text-xs",sm:"py-2 px-4 text-sm",default:"py-3 px-6 text-default",md:"py-3 px-6 text-base",lg:"py-4 px-7 text-lg"},r={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",base:"rounded-base",lg:"rounded-lg",xl:"rounded-xl","2xl":"rounded-2xl",full:"rounded-full",global:"rounded-global"},{radius:x,size:p,variant:m,ariaLabel:f,className:g,isActive:L}=e,a=x?r[x]:"rounded-global",n=s[p!=null?p:"default"],i="inline-block font-default text-default transition duration-200",A=`${i} ${n} ${a} bg-primary hover:bg-primary/50 text-gray-50`,C=`inline-block bg-primary hover:bg-primary/50 ${n} ${a} text-gray-50 font-bold transition duration-200`,N=`${i} ${n} ${a} bg-white hover:bg-primary/50 outline outline-1 text-primary outline-primary`,z=`${i} ${a} ${n} bg-transparent hover:bg-primary/50 text-primary`,M=`transition-200 text-primary hover:text-primary/50 underline ${a} ${(0,u.default)(n,"px-0 py-0")}`,P="",H=`mr-1 ${L?"bg-primary":"bg-gray-200"} rounded-full p-1 focus:outline-none`,V=`mx-auto mb-1 w-auto px-4 py-2 rounded duration-200 transition focus:outline-none font-bold ${L?"bg-gray-50 text-primary shadow":"text-gray-700 hover:bg-secondary/50 hover:text-primary hover:shadow"}`,E=`${i} ${a} ${n} ml-auto sm:ml-0 flex-shrink-0 inline-flex items-center justify-center w-full rounded-md border hover:border-primary`,h={outline:N,ghost:z,link:M,custom:C,solid:A,addToWishlist:E,unstyled:P,swiper_pagination:H,tab:V}[m!=null?m:"solid"];if(e.as==="link"){let{link:b,...F}=e;return(0,l.jsx)(S.Link,{className:(0,u.default)(h,g),"aria-label":f,href:v(b),target:b.linkTarget,rel:b.linkTarget==="_blank"?"noopener noreferrer":"",...F,children:t})}let{loadingComponent:c,onClick:I,loading:$,disabled:y,type:_}=e,W=c!=null?c:(0,l.jsx)(w.FaSpinner,{className:"animate-spin",size:30});return(0,l.jsx)(o,{onClick:I,disabled:y!=null?y:$,className:(0,u.default)(h,g),"aria-label":f,"data-testid":R.toLowerCase(),type:_,children:$?W:t})}0&&(module.exports={Button});
|
package/dist/button.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-RVVB2H7S.mjs";import"./chunk-5BNLLVMY.mjs";export{a as Button};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=e=>{var t,r;return!(e!=null&&e.internalLink)&&!(e!=null&&e.externalLink)?"/page-not-found":(e==null?void 0:e.type)==="linkInternal"&&((r=(t=e==null?void 0:e.internalLink)==null?void 0:t.toLowerCase())!=null&&r.includes("home"))?"/":(e==null?void 0:e.type)==="linkInternal"?`/${e==null?void 0:e.internalLink}`:(e==null?void 0:e.type)==="linkExternal"?`${e==null?void 0:e.externalLink}`:"/"};export{a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as f}from"./chunk-5BNLLVMY.mjs";import{Link as V}from"@stackshift-ui/link";import{useStackShiftUIComponents as _}from"@stackshift-ui/system";import d from"classnames";import{FaSpinner as E}from"react-icons/fa";import{jsx as u}from"react/jsx-runtime";var h="Button";function q({children:p,...o}){let{[h]:k="button"}=_(),L={xs:"py-1 px-3 text-xs",sm:"py-2 px-4 text-sm",default:"py-3 px-6 text-default",md:"py-3 px-6 text-base",lg:"py-4 px-7 text-lg"},$={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",base:"rounded-base",lg:"rounded-lg",xl:"rounded-xl","2xl":"rounded-2xl",full:"rounded-full",global:"rounded-global"},{radius:m,size:r,variant:a,ariaLabel:c,className:y,isActive:b}=o,t=m?$[m]:"rounded-global",e=L[r!=null?r:"default"],n="inline-block font-default text-default transition duration-200",T=`${n} ${e} ${t} bg-primary hover:bg-primary/50 text-gray-50`,v=`inline-block bg-primary hover:bg-primary/50 ${e} ${t} text-gray-50 font-bold transition duration-200`,S=`${n} ${e} ${t} bg-white hover:bg-primary/50 outline outline-1 text-primary outline-primary`,B=`${n} ${t} ${e} bg-transparent hover:bg-primary/50 text-primary`,R=`transition-200 text-primary hover:text-primary/50 underline ${t} ${d(e,"px-0 py-0")}`,A="",w=`mr-1 ${b?"bg-primary":"bg-gray-200"} rounded-full p-1 focus:outline-none`,N=`mx-auto mb-1 w-auto px-4 py-2 rounded duration-200 transition focus:outline-none font-bold ${b?"bg-gray-50 text-primary shadow":"text-gray-700 hover:bg-secondary/50 hover:text-primary hover:shadow"}`,z=`${n} ${t} ${e} ml-auto sm:ml-0 flex-shrink-0 inline-flex items-center justify-center w-full rounded-md border hover:border-primary`,x={outline:S,ghost:B,link:R,custom:v,solid:T,addToWishlist:z,unstyled:A,swiper_pagination:w,tab:N}[a!=null?a:"solid"];if(o.as==="link"){let{link:l,...H}=o;return u(V,{className:d(x,y),"aria-label":c,href:f(l),target:l.linkTarget,rel:l.linkTarget==="_blank"?"noopener noreferrer":"",...H,children:p})}let{loadingComponent:i,onClick:C,loading:g,disabled:s,type:M}=o,P=i!=null?i:u(E,{className:"animate-spin",size:30});return u(k,{onClick:C,disabled:s!=null?s:g,className:d(x,y),"aria-label":c,"data-testid":h.toLowerCase(),type:M,children:g?P:p})}export{q as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var x=(e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},d=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of f(t))!p.call(e,a)&&a!==r&&o(e,a,{get:()=>t[a],enumerable:!(u=L(t,a))||u.enumerable});return e};var c=e=>d(o({},"__esModule",{value:!0}),e);var s={};x(s,{extractLink:()=>m});module.exports=c(s);var m=e=>{var t,r;return!(e!=null&&e.internalLink)&&!(e!=null&&e.externalLink)?"/page-not-found":(e==null?void 0:e.type)==="linkInternal"&&((r=(t=e==null?void 0:e.internalLink)==null?void 0:t.toLowerCase())!=null&&r.includes("home"))?"/":(e==null?void 0:e.type)==="linkInternal"?`/${e==null?void 0:e.internalLink}`:(e==null?void 0:e.type)==="linkExternal"?`${e==null?void 0:e.externalLink}`:"/"};0&&(module.exports={extractLink});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-5BNLLVMY.mjs";export{a as extractLink};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./button";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var O=Object.create;var d=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var G=(t,e)=>{for(var o in e)d(t,o,{get:e[o],enumerable:!0})},T=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of j(e))!D.call(t,r)&&r!==o&&d(t,r,{get:()=>e[r],enumerable:!(s=U(e,r))||s.enumerable});return t};var J=(t,e,o)=>(o=t!=null?O(q(t)):{},T(e||!t||!t.__esModule?d(o,"default",{value:t,enumerable:!0}):o,t)),K=t=>T(d({},"__esModule",{value:!0}),t);var X={};G(X,{Button:()=>Q});module.exports=K(X);var S=require("@stackshift-ui/link"),B=require("@stackshift-ui/system"),u=J(require("classnames")),w=require("react-icons/fa");var v=t=>{var e,o;return!(t!=null&&t.internalLink)&&!(t!=null&&t.externalLink)?"/page-not-found":(t==null?void 0:t.type)==="linkInternal"&&((o=(e=t==null?void 0:t.internalLink)==null?void 0:e.toLowerCase())!=null&&o.includes("home"))?"/":(t==null?void 0:t.type)==="linkInternal"?`/${t==null?void 0:t.internalLink}`:(t==null?void 0:t.type)==="linkExternal"?`${t==null?void 0:t.externalLink}`:"/"};var l=require("react/jsx-runtime"),R="Button";function Q({children:t,...e}){let{[R]:o="button"}=(0,B.useStackShiftUIComponents)(),s={xs:"py-1 px-3 text-xs",sm:"py-2 px-4 text-sm",default:"py-3 px-6 text-default",md:"py-3 px-6 text-base",lg:"py-4 px-7 text-lg"},r={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",base:"rounded-base",lg:"rounded-lg",xl:"rounded-xl","2xl":"rounded-2xl",full:"rounded-full",global:"rounded-global"},{radius:x,size:p,variant:m,ariaLabel:f,className:g,isActive:L}=e,n=x?r[x]:"rounded-global",a=s[p!=null?p:"default"],i="inline-block font-default text-default transition duration-200",A=`${i} ${a} ${n} bg-primary hover:bg-primary/50 text-gray-50`,C=`inline-block bg-primary hover:bg-primary/50 ${a} ${n} text-gray-50 font-bold transition duration-200`,N=`${i} ${a} ${n} bg-white hover:bg-primary/50 outline outline-1 text-primary outline-primary`,z=`${i} ${n} ${a} bg-transparent hover:bg-primary/50 text-primary`,M=`transition-200 text-primary hover:text-primary/50 underline ${n} ${(0,u.default)(a,"px-0 py-0")}`,P="",H=`mr-1 ${L?"bg-primary":"bg-gray-200"} rounded-full p-1 focus:outline-none`,V=`mx-auto mb-1 w-auto px-4 py-2 rounded duration-200 transition focus:outline-none font-bold ${L?"bg-gray-50 text-primary shadow":"text-gray-700 hover:bg-secondary/50 hover:text-primary hover:shadow"}`,E=`${i} ${n} ${a} ml-auto sm:ml-0 flex-shrink-0 inline-flex items-center justify-center w-full rounded-md border hover:border-primary`,h={outline:N,ghost:z,link:M,custom:C,solid:A,addToWishlist:E,unstyled:P,swiper_pagination:H,tab:V}[m!=null?m:"solid"];if(e.as==="link"){let{link:b,...F}=e;return(0,l.jsx)(S.Link,{className:(0,u.default)(h,g),"aria-label":f,href:v(b),target:b.linkTarget,rel:b.linkTarget==="_blank"?"noopener noreferrer":"",...F,children:t})}let{loadingComponent:c,onClick:I,loading:$,disabled:y,type:_}=e,W=c!=null?c:(0,l.jsx)(w.FaSpinner,{className:"animate-spin",size:30});return(0,l.jsx)(o,{onClick:I,disabled:y!=null?y:$,className:(0,u.default)(h,g),"aria-label":f,"data-testid":R.toLowerCase(),type:_,children:$?W:t})}0&&(module.exports={Button});
|
package/dist/index.mjs
ADDED
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type StyleVariants<T extends string> = Record<T, string>;
|
|
2
|
+
export interface LabeledRoute extends ConditionalLink {
|
|
3
|
+
ariaLabel?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
linkTarget?: string;
|
|
6
|
+
linkType?: string;
|
|
7
|
+
_type?: string;
|
|
8
|
+
linkInternal?: any;
|
|
9
|
+
}
|
|
10
|
+
export interface ConditionalLink {
|
|
11
|
+
type?: string;
|
|
12
|
+
internalLink?: string | null;
|
|
13
|
+
externalLink?: string | null;
|
|
14
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var r=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var o=(t,n,l,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of s(n))!g.call(t,e)&&e!==l&&r(t,e,{get:()=>n[e],enumerable:!(i=a(n,e))||i.enumerable});return t};var k=t=>o(r({},"__esModule",{value:!0}),t);var p={};module.exports=k(p);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackshift-ui/button",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"typescript": "^5.6.2",
|
|
28
28
|
"vite-tsconfig-paths": "^5.0.1",
|
|
29
29
|
"vitest": "^2.1.1",
|
|
30
|
-
"@stackshift-ui/eslint-config": "6.0.
|
|
31
|
-
"@stackshift-ui/typescript-config": "6.0.
|
|
30
|
+
"@stackshift-ui/eslint-config": "6.0.5",
|
|
31
|
+
"@stackshift-ui/typescript-config": "6.0.5"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"classnames": "^2.5.1",
|
|
35
35
|
"react-icons": "^5.3.0",
|
|
36
|
-
"@stackshift-ui/
|
|
37
|
-
"@stackshift-ui/link": "6.0.
|
|
38
|
-
"@stackshift-ui/
|
|
36
|
+
"@stackshift-ui/system": "6.0.6",
|
|
37
|
+
"@stackshift-ui/link": "6.0.6",
|
|
38
|
+
"@stackshift-ui/scripts": "6.0.5"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@types/react": "16.8 - 19",
|