@stackshift-ui/button 7.0.0-beta.7 → 7.0.0-beta.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/button.d.ts +25 -0
- package/dist/button.js +1 -0
- package/dist/button.mjs +1 -0
- package/dist/chunk-M2U4ECA5.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 +4 -4
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { LabeledRoute } from "./types";
|
|
4
|
+
declare const buttonVariants: (props?: ({
|
|
5
|
+
variant?: "unstyled" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
|
6
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
type BaseButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants> & {
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
iconPosition?: "left" | "right";
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
};
|
|
15
|
+
type LinkButtonProps = BaseButtonProps & {
|
|
16
|
+
as: "link";
|
|
17
|
+
link: LabeledRoute;
|
|
18
|
+
};
|
|
19
|
+
type DefaultButtonProps = BaseButtonProps & {
|
|
20
|
+
as?: undefined;
|
|
21
|
+
link?: never;
|
|
22
|
+
};
|
|
23
|
+
export type ButtonProps = LinkButtonProps | DefaultButtonProps;
|
|
24
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
25
|
+
export { Button, buttonVariants };
|
package/dist/button.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var N=Object.create;var u=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},g=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of w(e))!M.call(t,r)&&r!==n&&u(t,r,{get:()=>e[r],enumerable:!(s=C(e,r))||s.enumerable});return t};var V=(t,e,n)=>(n=t!=null?N(H(t)):{},g(e||!t||!t.__esModule?u(n,"default",{value:t,enumerable:!0}):n,t)),A=t=>g(u({},"__esModule",{value:!0}),t);var S={};T(S,{Button:()=>B,buttonVariants:()=>c});module.exports=A(S);var m=require("@radix-ui/react-slot"),b=require("@stackshift-ui/link"),o=require("@stackshift-ui/system"),h=require("class-variance-authority"),v=V(require("react")),a=require("react/jsx-runtime"),y="Button",c=(0,h.cva)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{unstyled:"bg-transparent p-0 border-none shadow-none hover:bg-transparent ring-0 outline-none text-inherit",default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),B=v.forwardRef(({className:t,variant:e,size:n,asChild:s=!1,iconPosition:r="right",icon:i,children:f,...p},k)=>{let{[y]:x=o.DefaultComponent}=(0,o.useStackShiftUIComponents)(),L=s?m.Slot:"button";if(p.as==="link"){let{link:d,...P}=p,R=P;if(!d)return;let l=(0,o.buildSanityLink)(d);return(0,a.jsx)(b.Link,{className:(0,o.cn)(c({variant:e,size:n,className:t})),"aria-label":d.ariaLabel,href:l.href,target:l.target,rel:l.rel,...R,children:f})}return(0,a.jsx)(x,{as:L,className:(0,o.cn)(c({variant:e,size:n,className:t})),ref:k,...p,children:(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[r==="left"&&i&&(0,a.jsx)("span",{children:i}),f,r==="right"&&i&&(0,a.jsx)("span",{children:i})]})})});B.displayName=y;0&&(module.exports={Button,buttonVariants});
|
package/dist/button.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-M2U4ECA5.mjs";export{b as Button,a as buttonVariants};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Slot as B}from"@radix-ui/react-slot";import{Link as k}from"@stackshift-ui/link";import{buildSanityLink as x,cn as d,DefaultComponent as L,useStackShiftUIComponents as P}from"@stackshift-ui/system";import{cva as R}from"class-variance-authority";import*as c from"react";import{jsx as e,jsxs as C}from"react/jsx-runtime";var f="Button",l=R("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{unstyled:"bg-transparent p-0 border-none shadow-none hover:bg-transparent ring-0 outline-none text-inherit",default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),N=c.forwardRef(({className:a,variant:s,size:i,asChild:g=!1,iconPosition:u="right",icon:t,children:p,...n},m)=>{let{[f]:b=L}=P(),h=g?B:"button";if(n.as==="link"){let{link:o,...v}=n,y=v;if(!o)return;let r=x(o);return e(k,{className:d(l({variant:s,size:i,className:a})),"aria-label":o.ariaLabel,href:r.href,target:r.target,rel:r.rel,...y,children:p})}return e(b,{as:h,className:d(l({variant:s,size:i,className:a})),ref:m,...n,children:C("span",{className:"flex items-center gap-2",children:[u==="left"&&t&&e("span",{children:t}),p,u==="right"&&t&&e("span",{children:t})]})})});N.displayName=f;export{l as a,N as b};
|
|
@@ -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
|
+
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 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 N=Object.create;var u=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},m=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of w(e))!M.call(t,r)&&r!==n&&u(t,r,{get:()=>e[r],enumerable:!(s=C(e,r))||s.enumerable});return t};var V=(t,e,n)=>(n=t!=null?N(H(t)):{},m(e||!t||!t.__esModule?u(n,"default",{value:t,enumerable:!0}):n,t)),A=t=>m(u({},"__esModule",{value:!0}),t);var S={};T(S,{Button:()=>B,buttonVariants:()=>d});module.exports=A(S);var g=require("@radix-ui/react-slot"),b=require("@stackshift-ui/link"),o=require("@stackshift-ui/system"),h=require("class-variance-authority"),v=V(require("react")),a=require("react/jsx-runtime"),y="Button",d=(0,h.cva)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{unstyled:"bg-transparent p-0 border-none shadow-none hover:bg-transparent ring-0 outline-none text-inherit",default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),B=v.forwardRef(({className:t,variant:e,size:n,asChild:s=!1,iconPosition:r="right",icon:i,children:f,...p},k)=>{let{[y]:x=o.DefaultComponent}=(0,o.useStackShiftUIComponents)(),L=s?g.Slot:"button";if(p.as==="link"){let{link:l,...P}=p,R=P;if(!l)return;let c=(0,o.buildSanityLink)(l);return(0,a.jsx)(b.Link,{className:(0,o.cn)(d({variant:e,size:n,className:t})),"aria-label":l.ariaLabel,href:c.href,target:c.target,rel:c.rel,...R,children:f})}return(0,a.jsx)(x,{as:L,className:(0,o.cn)(d({variant:e,size:n,className:t})),ref:k,...p,children:(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[r==="left"&&i&&(0,a.jsx)("span",{children:i}),f,r==="right"&&i&&(0,a.jsx)("span",{children:i})]})})});B.displayName=y;0&&(module.exports={Button,buttonVariants});
|
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": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"class-variance-authority": "^0.7.1",
|
|
36
36
|
"classnames": "^2.5.1",
|
|
37
37
|
"react-icons": "^5.3.0",
|
|
38
|
-
"@stackshift-ui/link": "7.0.0-beta.
|
|
39
|
-
"@stackshift-ui/system": "7.0.0-beta.
|
|
40
|
-
"@stackshift-ui/scripts": "7.0.0-beta.
|
|
38
|
+
"@stackshift-ui/link": "7.0.0-beta.6",
|
|
39
|
+
"@stackshift-ui/system": "7.0.0-beta.6",
|
|
40
|
+
"@stackshift-ui/scripts": "7.0.0-beta.5"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@types/react": "16.8 - 19",
|