@anker-in/headless-ui 0.0.27-alpha.5 → 0.0.27-alpha.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/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js.map +2 -2
- package/dist/cjs/components/button.d.ts +1 -1
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +2 -2
- package/dist/cjs/stories/button.stories.d.ts +3 -1
- package/dist/cjs/stories/button.stories.js +1 -1
- package/dist/cjs/stories/button.stories.js.map +3 -3
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js.map +2 -2
- package/dist/esm/components/button.d.ts +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/button.js.map +2 -2
- package/dist/esm/stories/button.stories.d.ts +3 -1
- package/dist/esm/stories/button.stories.js +1 -1
- package/dist/esm/stories/button.stories.js.map +3 -3
- package/package.json +1 -1
- package/style.css +57 -18
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var w=Object.create;var m=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var H=(e,a)=>{for(var r in a)m(e,r,{get:a[r],enumerable:!0})},g=(e,a,r,l)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of y(a))!F.call(e,n)&&n!==r&&m(e,n,{get:()=>a[n],enumerable:!(l=u(a,n))||l.enumerable});return e};var z=(e,a,r)=>(r=e!=null?w(D(e)):{},g(a||!e||!e.__esModule?m(r,"default",{value:e,enumerable:!0}):r,e)),C=e=>g(m({},"__esModule",{value:!0}),e);var R={};H(R,{default:()=>B});module.exports=C(R);var t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";var w=Object.create;var m=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var H=(e,a)=>{for(var r in a)m(e,r,{get:a[r],enumerable:!0})},g=(e,a,r,l)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of y(a))!F.call(e,n)&&n!==r&&m(e,n,{get:()=>a[n],enumerable:!(l=u(a,n))||l.enumerable});return e};var z=(e,a,r)=>(r=e!=null?w(D(e)):{},g(a||!e||!e.__esModule?m(r,"default",{value:e,enumerable:!0}):r,e)),C=e=>g(m({},"__esModule",{value:!0}),e);var R={};H(R,{default:()=>B});module.exports=C(R);var t=require("react/jsx-runtime"),p=z(require("react")),s=require("../../components/index.js"),i=require("../../helpers/index.js"),f=require("../../shared/Styles.js");const b=p.default.forwardRef(({title:e,subtitle:a,background:r,primaryButton:l,secondaryButton:n,theme:o="light",className:v,products:c=[]},h)=>{const x=o==="dark"?"text-white":"text-[#1D1D1F]",N=o==="dark"?"bg-white":"bg-[#1D1D1F]";return(0,t.jsxs)("div",{ref:h,className:(0,i.cn)("relative flex min-h-[720px] w-full flex-col justify-between overflow-hidden bg-cover bg-center bg-no-repeat",v),style:{backgroundImage:`url(${r})`},children:[(0,t.jsxs)("div",{className:"relative z-10 flex flex-col gap-8 px-32 pt-[307px]",children:[(0,t.jsxs)("div",{className:"max-w-[686px] space-y-4",children:[(0,t.jsx)("h1",{className:(0,i.cn)("hero-banner-title font-mont text-[64px] font-bold leading-none tracking-[-0.04em]",x),children:e}),(0,t.jsx)("p",{className:(0,i.cn)("hero-banner-subtitle text-lg font-medium leading-[1.2] tracking-[-0.02em]",x),children:a})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[n&&(0,t.jsx)(s.Button,{size:"lg",variant:"primary",theme:o,className:"hero-banner-primary-button",...n,children:n.text}),l&&(0,t.jsx)(s.Button,{size:"lg",variant:"secondary",theme:o,...l,className:"hero-banner-secondary-button bg-transparent border-black text-black hover:bg-black hover:text-white",children:l.text})]})]}),c.length>0&&(0,t.jsx)("div",{className:"relative z-10 flex items-center gap-3 px-32 pb-6",children:c.map((k,d)=>(0,t.jsxs)(p.default.Fragment,{children:[(0,t.jsx)(s.Text,{className:(0,i.cn)("hero-banner-product-text text-sm font-medium leading-[1.2] tracking-[-0.02em]",o==="dark"?"text-white":"text-[#1D1D1F]"),children:k.title}),d<c.length-1&&(0,t.jsx)("div",{className:(0,i.cn)("h-4 w-px",N)})]},d))})]})});b.displayName="HeroBanner";var B=(0,f.withStyles)(b);
|
|
2
2
|
//# sourceMappingURL=HeroBanner.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/HeroBanner/HeroBanner.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from \"react\"\nimport type { HeroBannerProps } from \"./types.js\"\nimport { Button, Text } from \"../../components/index.js\"\nimport { cn } from \"../../helpers/index.js\"\nimport { withStyles } from \"../../shared/Styles.js\"\n\nconst HeroBanner = React.forwardRef<HTMLDivElement, HeroBannerProps>(\n ({ \n title, \n subtitle, \n background,\n primaryButton,\n secondaryButton,\n theme = \"light\",\n className,\n products = [] \n }, ref) => {\n const textColorClass = theme === \"dark\" ? \"text-white\" : \"text-[#1D1D1F]\"\n const dividerColorClass = theme === \"dark\" ? \"bg-white\" : \"bg-[#1D1D1F]\"\n\n return (\n <div \n ref={ref} \n className={cn(\n \"relative flex min-h-[720px] w-full flex-col justify-between overflow-hidden bg-cover bg-center bg-no-repeat\",\n className\n )}\n style={{ backgroundImage: `url(${background})` }}\n >\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"relative z-10 flex flex-col gap-8 px-32 pt-[307px]\">\n <div className=\"max-w-[686px] space-y-4\">\n <h1 className={cn(\n \"hero-banner-title font-mont text-[64px] font-bold leading-none tracking-[-0.04em]\",\n textColorClass\n )}>\n {title}\n </h1>\n <p className={cn(\n \"hero-banner-subtitle text-lg font-medium leading-[1.2] tracking-[-0.02em]\",\n textColorClass\n )}>\n {subtitle}\n </p>\n </div>\n \n {/* \u6309\u94AE\u7EC4 */}\n <div className=\"flex items-center gap-4\">\n {secondaryButton && (\n <Button\n size=\"lg\"\n variant=\"
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA+BU,IAAAI,EAAA,6BA/BVC,EAAkB,oBAElBC,EAA6B,qCAC7BC,EAAmB,kCACnBC,EAA2B,kCAE3B,MAAMC,EAAa,EAAAC,QAAM,WACvB,CAAC,CACC,MAAAC,EACA,SAAAC,EACA,WAAAC,EACA,cAAAC,EACA,gBAAAC,EACA,MAAAC,EAAQ,QACR,UAAAC,EACA,SAAAC,EAAW,CAAC,CACd,EAAGC,IAAQ,CACT,MAAMC,EAAiBJ,IAAU,OAAS,aAAe,iBACnDK,EAAoBL,IAAU,OAAS,WAAa,eAE1D,SACE,QAAC,OACC,IAAKG,EACL,aAAW,MACT,8GACAF,CACF,EACA,MAAO,CAAE,gBAAiB,OAAOJ,CAAU,GAAI,EAG/C,qBAAC,OAAI,UAAU,qDACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,MAAG,aAAW,MACb,oFACAO,CACF,EACG,SAAAT,EACH,KACA,OAAC,KAAE,aAAW,MACZ,4EACAS,CACF,EACG,SAAAR,EACH,GACF,KAGA,QAAC,OAAI,UAAU,0BACZ,UAAAG,MACC,OAAC,UACC,KAAK,KACL,QAAQ,
|
|
4
|
+
"sourcesContent": ["import React from \"react\"\nimport type { HeroBannerProps } from \"./types.js\"\nimport { Button, Text } from \"../../components/index.js\"\nimport { cn } from \"../../helpers/index.js\"\nimport { withStyles } from \"../../shared/Styles.js\"\n\nconst HeroBanner = React.forwardRef<HTMLDivElement, HeroBannerProps>(\n ({ \n title, \n subtitle, \n background,\n primaryButton,\n secondaryButton,\n theme = \"light\",\n className,\n products = [] \n }, ref) => {\n const textColorClass = theme === \"dark\" ? \"text-white\" : \"text-[#1D1D1F]\"\n const dividerColorClass = theme === \"dark\" ? \"bg-white\" : \"bg-[#1D1D1F]\"\n\n return (\n <div \n ref={ref} \n className={cn(\n \"relative flex min-h-[720px] w-full flex-col justify-between overflow-hidden bg-cover bg-center bg-no-repeat\",\n className\n )}\n style={{ backgroundImage: `url(${background})` }}\n >\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"relative z-10 flex flex-col gap-8 px-32 pt-[307px]\">\n <div className=\"max-w-[686px] space-y-4\">\n <h1 className={cn(\n \"hero-banner-title font-mont text-[64px] font-bold leading-none tracking-[-0.04em]\",\n textColorClass\n )}>\n {title}\n </h1>\n <p className={cn(\n \"hero-banner-subtitle text-lg font-medium leading-[1.2] tracking-[-0.02em]\",\n textColorClass\n )}>\n {subtitle}\n </p>\n </div>\n \n {/* \u6309\u94AE\u7EC4 */}\n <div className=\"flex items-center gap-4\">\n {secondaryButton && (\n <Button\n size=\"lg\"\n variant=\"primary\"\n theme={theme}\n className=\"hero-banner-primary-button\"\n {...secondaryButton}\n >\n {secondaryButton.text}\n </Button>\n )}\n {primaryButton && (\n <Button\n size=\"lg\"\n variant=\"secondary\"\n theme={theme}\n {...primaryButton}\n className=\"hero-banner-secondary-button bg-transparent border-black text-black hover:bg-black hover:text-white\"\n >\n {primaryButton.text}\n </Button>\n )}\n </div>\n </div>\n\n {/* \u5E95\u90E8\u4EA7\u54C1\u5217\u8868 */}\n {products.length > 0 && (\n <div className=\"relative z-10 flex items-center gap-3 px-32 pb-6\">\n {products.map((product, index) => (\n <React.Fragment key={index}>\n <Text\n className={cn(\n \"hero-banner-product-text text-sm font-medium leading-[1.2] tracking-[-0.02em]\",\n theme === \"dark\" ? \"text-white\" : \"text-[#1D1D1F]\"\n )}\n >\n {product.title}\n </Text>\n {index < products.length - 1 && (\n <div className={cn(\"h-4 w-px\", dividerColorClass)} />\n )}\n </React.Fragment>\n ))}\n </div>\n )}\n </div>\n )\n }\n)\n\nHeroBanner.displayName = \"HeroBanner\"\n\nexport default withStyles(HeroBanner)\n\n\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA+BU,IAAAI,EAAA,6BA/BVC,EAAkB,oBAElBC,EAA6B,qCAC7BC,EAAmB,kCACnBC,EAA2B,kCAE3B,MAAMC,EAAa,EAAAC,QAAM,WACvB,CAAC,CACC,MAAAC,EACA,SAAAC,EACA,WAAAC,EACA,cAAAC,EACA,gBAAAC,EACA,MAAAC,EAAQ,QACR,UAAAC,EACA,SAAAC,EAAW,CAAC,CACd,EAAGC,IAAQ,CACT,MAAMC,EAAiBJ,IAAU,OAAS,aAAe,iBACnDK,EAAoBL,IAAU,OAAS,WAAa,eAE1D,SACE,QAAC,OACC,IAAKG,EACL,aAAW,MACT,8GACAF,CACF,EACA,MAAO,CAAE,gBAAiB,OAAOJ,CAAU,GAAI,EAG/C,qBAAC,OAAI,UAAU,qDACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,MAAG,aAAW,MACb,oFACAO,CACF,EACG,SAAAT,EACH,KACA,OAAC,KAAE,aAAW,MACZ,4EACAS,CACF,EACG,SAAAR,EACH,GACF,KAGA,QAAC,OAAI,UAAU,0BACZ,UAAAG,MACC,OAAC,UACC,KAAK,KACL,QAAQ,UACR,MAAOC,EACP,UAAU,6BACT,GAAGD,EAEH,SAAAA,EAAgB,KACnB,EAEDD,MACC,OAAC,UACC,KAAK,KACL,QAAQ,YACR,MAAOE,EACN,GAAGF,EACJ,UAAU,sGAET,SAAAA,EAAc,KACjB,GAEJ,GACF,EAGCI,EAAS,OAAS,MACjB,OAAC,OAAI,UAAU,mDACZ,SAAAA,EAAS,IAAI,CAACI,EAASC,OACtB,QAAC,EAAAb,QAAM,SAAN,CACC,oBAAC,QACC,aAAW,MACT,gFACAM,IAAU,OAAS,aAAe,gBACpC,EAEC,SAAAM,EAAQ,MACX,EACCC,EAAQL,EAAS,OAAS,MACzB,OAAC,OAAI,aAAW,MAAG,WAAYG,CAAiB,EAAG,IAVlCE,CAYrB,CACD,EACH,GAEJ,CAEJ,CACF,EAEAd,EAAW,YAAc,aAEzB,IAAOP,KAAQ,cAAWO,CAAU",
|
|
6
6
|
"names": ["HeroBanner_exports", "__export", "HeroBanner_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_helpers", "import_Styles", "HeroBanner", "React", "title", "subtitle", "background", "primaryButton", "secondaryButton", "theme", "className", "products", "ref", "textColorClass", "dividerColorClass", "product", "index"]
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ import { type VariantProps } from 'class-variance-authority';
|
|
|
4
4
|
* Button Variants
|
|
5
5
|
*/
|
|
6
6
|
declare const buttonVariants: (props?: ({
|
|
7
|
-
variant?: "link" | "
|
|
7
|
+
variant?: "link" | "primary" | "secondary" | "ghost" | null | undefined;
|
|
8
8
|
size?: "sm" | "base" | "lg" | "icon" | null | undefined;
|
|
9
9
|
hoverEffect?: "none" | "slide" | null | undefined;
|
|
10
10
|
state?: "default" | "disabled" | "loading" | null | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var w=Object.create;var i=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var H=(e,t)=>{for(var r in t)i(e,r,{get:t[r],enumerable:!0})},f=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of B(t))!E.call(e,n)&&n!==r&&i(e,n,{get:()=>t[n],enumerable:!(o=V(t,n))||o.enumerable});return e};var c=(e,t,r)=>(r=e!=null?w(z(e)):{},f(t||!e||!e.__esModule?i(r,"default",{value:e,enumerable:!0}):r,e)),N=e=>f(i({},"__esModule",{value:!0}),e);var M={};H(M,{default:()=>L});module.exports=N(M);var a=require("react/jsx-runtime"),P=c(require("react")),m=require("@radix-ui/react-slot"),y=require("@radix-ui/react-visually-hidden"),d=require("class-variance-authority"),v=c(require("../icons/spinner.js")),g=require("../helpers/index.js");const R=(0,d.cva)("ring-offset-background border-[1.6px] border-solid focus-visible:ring-ring rounded-btn inline-flex items-center justify-center text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none",{variants:{variant:{primary:"bg-btn-primary text-btn-primary-foreground hover:bg-btn-primary-active",secondary:"bg-btn-secondary border-info-primary text-btn-secondary-foreground hover:bg-btn-secondary-active hover:text-btn-secondary border border-solid",link:"text-info-primary underline-offset-4 hover:underline border-none hover:text-btn-primary-active",ghost:"hover:bg-btn-primary hover:text-btn-primary-foreground"},size:{sm:"px-3 py-2 text-[12px] leading-tight",base:"px-5 pt-[11px] pb-[10px] text-[14px] leading-tight",lg:"px-7 pt-[15px] pb-[14px] text-[16px] leading-tight",icon:"size-10 rounded-full leading-tight"},hoverEffect:{none:"",slide:""},state:{default:"",disabled:"",loading:""},theme:{dark:"",light:""}},compoundVariants:[{variant:"primary",hoverEffect:"slide",class:'z-[1] before:-z-[1] before:rounded-btn hover:!bg-btn-primary before:bg-btn-primary-active relative overflow-hidden before:absolute before:inset-y-0 before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[""] hover:before:translate-x-0'},{variant:"secondary",hoverEffect:"slide",class:'z-[1] before:-z-[1] before:rounded-btn hover:!bg-btn-secondary before:bg-btn-secondary-active relative overflow-hidden before:absolute before:inset-y-0 before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[""] hover:before:translate-x-0'},{variant:"primary",state:"loading",class:"bg-btn-primary-active"},{variant:"secondary",state:"loading",class:"bg-btn-secondary disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground"},{variant:"primary",state:"disabled",class:"disabled:bg-btn-primary-disabled disabled:text-btn-primary-disabled-foreground"},{variant:"secondary",state:"disabled",class:"disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground disabled:border-btn-secondary-disabled-border"},{variant:"secondary",theme:"dark",class:"text-info-white bg-info-primary hover:border-info-white hover:text-info-primary hover:bg-info-white"},{variant:"secondary",theme:"dark",state:"loading",class:"bg-btn-info-white text-info-primary border-info-white"},{variant:"secondary",theme:"dark",state:"disabled",class:"disabled:bg-text-info-quaternary disabled:text-info-white"},{variant:"link",state:"disabled",class:"disabled:text-info-quaternary"},{variant:"primary",theme:"dark",class:"text-info-primary hover:text-info-white bg-info-white hover:border-brand-0"},{variant:"primary",theme:"dark",state:"loading",class:"bg-btn-primary-active text-info-white border-brand-0"},{variant:"secondary",theme:"dark",class:"border-info-white"},{variant:"secondary",theme:"light",class:""},{variant:"link",theme:"dark",class:"text-info-white"}],defaultVariants:{variant:"primary",size:"base",hoverEffect:"none",state:"default",theme:"light"}}),C=(0,d.cva)("",{variants:{variant:{primary:"stroke-btn-primary-foreground",secondary:"stroke-btn-secondary-foreground",link:"stroke-primary",ghost:"stroke-primary"},theme:{dark:"",light:""}},defaultVariants:{variant:"primary",theme:"light"}}),p=P.forwardRef(({asChild:e=!1,size:t="base",children:r,variant:o,theme:n="light",hoverEffect:u="none",className:h,disabled:b=!1,loading:s=!1,spinner:l,...x},k)=>(0,a.jsx)(e?m.Slot:"button",{disabled:b||s,className:(0,g.cn)(R({variant:o,size:t,hoverEffect:u,state:s?"loading":b?"disabled":"default",theme:n}),h),ref:k,...x,children:s?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{style:{display:"contents",visibility:"hidden"},"aria-hidden":!0,children:r}),(0,a.jsx)("span",{className:"absolute",children:l||(0,a.jsx)(v.default,{className:C({variant:o,theme:n})})}),(0,a.jsx)(y.VisuallyHidden,{children:r})]}):r}));p.displayName="Button";var L=p;
|
|
2
2
|
//# sourceMappingURL=button.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/button.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden'\nimport { type VariantProps, cva } from 'class-variance-authority'\nimport Spinner from '../icons/spinner.js'\nimport { cn } from '../helpers/index.js'\n\n/**\n * Button Variants\n */\nconst buttonVariants = cva(\n 'ring-offset-background focus-visible:ring-ring rounded-btn inline-flex items-center justify-center text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none',\n {\n variants: {\n variant: {\n
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden'\nimport { type VariantProps, cva } from 'class-variance-authority'\nimport Spinner from '../icons/spinner.js'\nimport { cn } from '../helpers/index.js'\n\n/**\n * Button Variants\n */\nconst buttonVariants = cva(\n 'ring-offset-background border-[1.6px] border-solid focus-visible:ring-ring rounded-btn inline-flex items-center justify-center text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none',\n {\n variants: {\n variant: {\n primary: 'bg-btn-primary text-btn-primary-foreground hover:bg-btn-primary-active',\n secondary:\n 'bg-btn-secondary border-info-primary text-btn-secondary-foreground hover:bg-btn-secondary-active hover:text-btn-secondary border border-solid',\n link: 'text-info-primary underline-offset-4 hover:underline border-none hover:text-btn-primary-active',\n ghost: 'hover:bg-btn-primary hover:text-btn-primary-foreground',\n },\n size: {\n sm: 'px-3 py-2 text-[12px] leading-tight',\n base: 'px-5 pt-[11px] pb-[10px] text-[14px] leading-tight',\n lg: 'px-7 pt-[15px] pb-[14px] text-[16px] leading-tight',\n icon: 'size-10 rounded-full leading-tight',\n },\n /** hover \u72B6\u6001\u4E0B\u7684\u52A8\u753B\u6548\u679C,\u9700\u8981\u6CE8\u610F\u4E0D\u540Cvariant \u4E0B\u7684\u6548\u679C */\n hoverEffect: {\n none: '',\n slide: '',\n },\n state: {\n default: '',\n disabled: '',\n loading: '',\n },\n theme: {\n dark: '',\n light: '',\n },\n },\n compoundVariants: [\n {\n variant: 'primary',\n hoverEffect: 'slide',\n class:\n 'z-[1] before:-z-[1] before:rounded-btn hover:!bg-btn-primary before:bg-btn-primary-active relative overflow-hidden before:absolute before:inset-y-0 before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[\"\"] hover:before:translate-x-0',\n },\n {\n variant: 'secondary',\n hoverEffect: 'slide',\n class:\n 'z-[1] before:-z-[1] before:rounded-btn hover:!bg-btn-secondary before:bg-btn-secondary-active relative overflow-hidden before:absolute before:inset-y-0 before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[\"\"] hover:before:translate-x-0',\n },\n {\n variant: 'primary',\n state: 'loading',\n class: 'bg-btn-primary-active',\n },\n {\n variant: 'secondary',\n state: 'loading',\n class: 'bg-btn-secondary disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground',\n },\n {\n variant: 'primary',\n state: 'disabled',\n class: 'disabled:bg-btn-primary-disabled disabled:text-btn-primary-disabled-foreground',\n },\n {\n variant: 'secondary',\n state: 'disabled',\n class: 'disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground disabled:border-btn-secondary-disabled-border',\n },\n {\n variant: 'secondary',\n theme: 'dark',\n class: 'text-info-white bg-info-primary hover:border-info-white hover:text-info-primary hover:bg-info-white',\n },\n {\n variant: 'secondary',\n theme: 'dark',\n state: 'loading',\n class: 'bg-btn-info-white text-info-primary border-info-white',\n },\n {\n variant: 'secondary',\n theme: 'dark',\n state: 'disabled',\n class: 'disabled:bg-text-info-quaternary disabled:text-info-white',\n },\n {\n variant: 'link',\n state: 'disabled',\n class: 'disabled:text-info-quaternary',\n },\n {\n variant: 'primary',\n theme: 'dark',\n class: 'text-info-primary hover:text-info-white bg-info-white hover:border-brand-0',\n },\n {\n variant: 'primary',\n theme: 'dark',\n state: 'loading',\n class: 'bg-btn-primary-active text-info-white border-brand-0', \n },\n {\n variant: 'secondary',\n theme: 'dark',\n class: 'border-info-white',\n },\n {\n variant: 'secondary',\n theme: 'light',\n class: '',\n },\n {\n variant: 'link',\n theme: 'dark',\n class: 'text-info-white',\n },\n ],\n defaultVariants: {\n variant: 'primary',\n size: 'base',\n hoverEffect: 'none',\n state: 'default',\n theme: 'light',\n },\n }\n)\n\nconst loadingSvgVariants = cva('', {\n variants: {\n variant: {\n primary: 'stroke-btn-primary-foreground',\n secondary: 'stroke-btn-secondary-foreground',\n link: 'stroke-primary',\n ghost: 'stroke-primary',\n },\n theme: {\n dark: '',\n light: '',\n },\n },\n defaultVariants: {\n variant: 'primary',\n theme: 'light',\n },\n})\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /** \u8BBE\u7F6E\u6309\u94AE\u8F7D\u5165\u72B6\u6001 */\n loading?: boolean\n /** \u8BBE\u7F6E\u6309\u94AE\u5931\u6548\u72B6\u6001 */\n disabled?: boolean\n /** \u5B9A\u4E49\u81EA\u7EC4\u4EF6\u4F5C\u4E3A\u7236\u7EC4\u4EF6\u7684\u7C7B\u578B\uFF0C \u8BE6\u7EC6\u4F7F\u7528\u65B9\u5F0F\u8BF7\u53C2\u8003radix-ui */\n asChild?: boolean\n /** \u81EA\u5B9A\u4E49loading */\n spinner?: React.ReactNode\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n asChild = false,\n size = 'base',\n children,\n variant,\n theme = 'light',\n hoverEffect = 'none',\n className,\n disabled = false,\n loading = false,\n spinner,\n ...props\n }: ButtonProps,\n ref\n ) => {\n const Comp = asChild ? Slot : 'button'\n const isInactive = disabled || loading\n const state = loading ? 'loading' : disabled ? 'disabled' : 'default'\n\n return (\n <Comp\n disabled={isInactive}\n className={cn(buttonVariants({ variant, size, hoverEffect, state, theme }), className)}\n ref={ref}\n {...props}\n >\n {loading ? (\n <>\n <span style={{ display: 'contents', visibility: 'hidden' }} aria-hidden>\n {children}\n </span>\n <span className=\"absolute\">\n {spinner ? (\n spinner\n ) : (\n <Spinner\n className={loadingSvgVariants({\n variant,\n theme,\n })}\n />\n )}\n </span>\n <VisuallyHidden>{children}</VisuallyHidden>\n </>\n ) : (\n children\n )}\n </Comp>\n )\n }\n)\n\nButton.displayName = 'Button'\nexport default Button\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAqMU,IAAAI,EAAA,6BAnMVC,EAAuB,oBACvBC,EAAqB,gCACrBC,EAA+B,2CAC/BC,EAAuC,oCACvCC,EAAoB,kCACpBC,EAAmB,+BAKnB,MAAMC,KAAiB,OACrB,gRACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,yEACT,UACE,gJACF,KAAM,iGACN,MAAO,wDACT,EACA,KAAM,CACJ,GAAI,uCACJ,KAAM,qDACN,GAAI,sDACJ,KAAM,qCACR,EAEA,YAAa,CACX,KAAM,GACN,MAAO,EACT,EACA,MAAO,CACL,QAAS,GACT,SAAU,GACV,QAAS,EACX,EACA,MAAO,CACL,KAAM,GACN,MAAO,EACT,CACF,EACA,iBAAkB,CAChB,CACE,QAAS,UACT,YAAa,QACb,MACE,8SACJ,EACA,CACE,QAAS,YACT,YAAa,QACb,MACE,mTACJ,EACA,CACE,QAAS,UACT,MAAO,UACP,MAAO,uBACT,EACA,CACE,QAAS,YACT,MAAO,UACP,MAAO,qGACT,EACA,CACE,QAAS,UACT,MAAO,WACP,MAAO,gFACT,EACA,CACE,QAAS,YACT,MAAO,WACP,MAAO,kIACT,EACA,CACE,QAAS,YACT,MAAO,OACP,MAAO,qGACT,EACA,CACE,QAAS,YACT,MAAO,OACP,MAAO,UACP,MAAO,uDACT,EACA,CACE,QAAS,YACT,MAAO,OACP,MAAO,WACP,MAAO,2DACT,EACA,CACE,QAAS,OACT,MAAO,WACP,MAAO,+BACT,EACA,CACE,QAAS,UACT,MAAO,OACP,MAAO,4EACT,EACA,CACE,QAAS,UACT,MAAO,OACP,MAAO,UACP,MAAO,sDACT,EACA,CACE,QAAS,YACT,MAAO,OACP,MAAO,mBACT,EACA,CACE,QAAS,YACT,MAAO,QACP,MAAO,EACT,EACA,CACE,QAAS,OACT,MAAO,OACP,MAAO,iBACT,CACF,EACA,gBAAiB,CACf,QAAS,UACT,KAAM,OACN,YAAa,OACb,MAAO,UACP,MAAO,OACT,CACF,CACF,EAEMC,KAAqB,OAAI,GAAI,CACjC,SAAU,CACR,QAAS,CACP,QAAS,gCACT,UAAW,kCACX,KAAM,iBACN,MAAO,gBACT,EACA,MAAO,CACL,KAAM,GACN,MAAO,EACT,CACF,EACA,gBAAiB,CACf,QAAS,UACT,MAAO,OACT,CACF,CAAC,EAeKC,EAASR,EAAM,WACnB,CACE,CACE,QAAAS,EAAU,GACV,KAAAC,EAAO,OACP,SAAAC,EACA,QAAAC,EACA,MAAAC,EAAQ,QACR,YAAAC,EAAc,OACd,UAAAC,EACA,SAAAC,EAAW,GACX,QAAAC,EAAU,GACV,QAAAC,EACA,GAAGC,CACL,EACAC,OAOE,OALWX,EAAU,OAAO,SAK3B,CACC,SALeO,GAAYC,EAM3B,aAAW,MAAGX,EAAe,CAAE,QAAAM,EAAS,KAAAF,EAAM,YAAAI,EAAa,MALjDG,EAAU,UAAYD,EAAW,WAAa,UAKU,MAAAH,CAAM,CAAC,EAAGE,CAAS,EACrF,IAAKK,EACJ,GAAGD,EAEH,SAAAF,KACC,oBACE,oBAAC,QAAK,MAAO,CAAE,QAAS,WAAY,WAAY,QAAS,EAAG,cAAW,GACpE,SAAAN,EACH,KACA,OAAC,QAAK,UAAU,WACb,SAAAO,MAGC,OAAC,EAAAG,QAAA,CACC,UAAWd,EAAmB,CAC5B,QAAAK,EACA,MAAAC,CACF,CAAC,EACH,EAEJ,KACA,OAAC,kBAAgB,SAAAF,EAAS,GAC5B,EAEAA,EAEJ,CAGN,EAEAH,EAAO,YAAc,SACrB,IAAOX,EAAQW",
|
|
6
6
|
"names": ["button_exports", "__export", "button_default", "__toCommonJS", "import_jsx_runtime", "React", "import_react_slot", "import_react_visually_hidden", "import_class_variance_authority", "import_spinner", "import_helpers", "buttonVariants", "loadingSvgVariants", "Button", "asChild", "size", "children", "variant", "theme", "hoverEffect", "className", "disabled", "loading", "spinner", "props", "ref", "Spinner"]
|
|
7
7
|
}
|
|
@@ -25,12 +25,14 @@ declare const meta: {
|
|
|
25
25
|
type: "select";
|
|
26
26
|
};
|
|
27
27
|
options: string[];
|
|
28
|
+
description: string;
|
|
28
29
|
};
|
|
29
30
|
size: {
|
|
30
31
|
control: {
|
|
31
32
|
type: "select";
|
|
32
33
|
};
|
|
33
34
|
options: string[];
|
|
35
|
+
description: string;
|
|
34
36
|
};
|
|
35
37
|
hoverEffect: {
|
|
36
38
|
description: string;
|
|
@@ -53,10 +55,10 @@ declare const meta: {
|
|
|
53
55
|
};
|
|
54
56
|
export default meta;
|
|
55
57
|
type Story = StoryObj<typeof meta>;
|
|
56
|
-
export declare const Nature: Story;
|
|
57
58
|
export declare const Primary: Story;
|
|
58
59
|
export declare const Secondary: Story;
|
|
59
60
|
export declare const Link: Story;
|
|
60
61
|
export declare const WithIcon: Story;
|
|
62
|
+
export declare const Loading: Story;
|
|
61
63
|
export declare const Aschild: Story;
|
|
62
64
|
export declare const Spinner: Story;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var g=(o,e)=>{for(var r in e)s(o,r,{get:e[r],enumerable:!0})},y=(o,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of p(e))!d.call(o,a)&&a!==r&&s(o,a,{get:()=>e[a],enumerable:!(i=l(e,a))||i.enumerable});return o};var h=o=>y(s({},"__esModule",{value:!0}),o);var k={};g(k,{Aschild:()=>b,Link:()=>S,Loading:()=>u,Primary:()=>v,Secondary:()=>z,Spinner:()=>M,WithIcon:()=>x,default:()=>f});module.exports=h(k);var t=require("react/jsx-runtime"),n=require("@storybook/icons"),c=require("../components/index.js"),L=require("react");const m={title:"Components/Button",component:c.Button,parameters:{layout:"centered",docs:{description:{component:"\u6309\u94AE\u7EC4\u4EF6, \u5206\u4E3A\u591A\u79CD\u53D8\u4F53\u548C\u5927\u5C0F, \u652F\u6301 loading \u72B6\u6001\u548C\u56FE\u6807"}}},tags:["autodocs"],argTypes:{theme:{control:{type:"select"},options:["dark","light"],description:"\u4E3B\u9898, \u9ED8\u8BA4\u662F light"},variant:{control:{type:"select"},options:["primary","secondary","link","ghost"],description:"\u6309\u94AE\u7C7B\u578B, \u63A8\u8350\u4F7F\u7528 primary \u548C secondary\uFF0C link ; ghost \u5C06\u4F1A\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 secondary\uFF0C \u4EE3\u66FF"},size:{control:{type:"select"},options:["sm","base","lg","icon"],description:"\u6309\u94AE\u5927\u5C0F \u9ED8\u8BA4\u662F base, \u53EF\u9009\u503C: sm, base, lg, icon"},hoverEffect:{description:"hover \u72B6\u6001\u4E0B\u7684\u52A8\u753B\u6548\u679C\uFF0C\u4EC5\u5728variant\u662Fprimary \u548C secondary \u65F6\u751F\u6548",control:{type:"select"},options:["none","slide"]}},args:{theme:"light",variant:"primary",size:"base",children:"Button",asChild:!1,disabled:!1,loading:!1,hoverEffect:"none"}};var f=m;const v={args:{size:"lg",children:"Primary"}},z={args:{size:"lg",variant:"secondary",children:"Secondary"}},S={args:{size:"lg",variant:"link",children:"Link"}},x={args:{size:"lg",children:(0,t.jsxs)(t.Fragment,{children:["WithIcon ",(0,t.jsx)(n.SearchIcon,{className:"ml-2"})]})}},u={args:{size:"lg",loading:!0}},b={args:{size:"lg",asChild:!0,children:(0,t.jsx)("a",{href:"http://example.com",children:"as a a tag"})}},M={args:{size:"lg",loading:!0,spinner:(0,t.jsxs)("div",{className:"flex animate-pulse flex-row font-bold text-neutral-900",children:[(0,t.jsx)("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"2625",width:"1rem",className:"align-middle",children:(0,t.jsx)("path",{d:"M511.882596 287.998081h-0.361244a31.998984 31.998984 0 0 1-31.659415-31.977309v-0.361244c0-0.104761 0.115598-11.722364 0.115598-63.658399V96.000564a31.998984 31.998984 0 1 1 64.001581 0V192.001129c0 52.586273-0.111986 63.88237-0.119211 64.337537a32.002596 32.002596 0 0 1-31.977309 31.659415zM511.998194 959.99842a31.998984 31.998984 0 0 1-31.998984-31.998984v-96.379871c0-51.610915-0.111986-63.174332-0.115598-63.286318s0-0.242033 0-0.361243a31.998984 31.998984 0 0 1 63.997968-0.314283c0 0.455167 0.11921 11.711527 0.11921 64.034093v96.307622a31.998984 31.998984 0 0 1-32.002596 31.998984zM330.899406 363.021212a31.897836 31.897836 0 0 1-22.866739-9.612699c-0.075861-0.075861-8.207461-8.370021-44.931515-45.094076L195.198137 240.429485a31.998984 31.998984 0 0 1 45.256635-45.253022L308.336112 263.057803c37.182834 37.182834 45.090463 45.253022 45.41197 45.578141A31.998984 31.998984 0 0 1 330.899406 363.021212zM806.137421 838.11473a31.901448 31.901448 0 0 1-22.628318-9.374279L715.624151 760.859111c-36.724054-36.724054-45.018214-44.859267-45.097687-44.93874a31.998984 31.998984 0 0 1 44.77618-45.729864c0.32512 0.317895 8.395308 8.229136 45.578142 45.411969l67.88134 67.88134a31.998984 31.998984 0 0 1-22.624705 54.630914zM224.000113 838.11473a31.901448 31.901448 0 0 0 22.628317-9.374279l67.88134-67.88134c36.724054-36.724054 45.021826-44.859267 45.097688-44.93874a31.998984 31.998984 0 0 0-44.776181-45.729864c-0.32512 0.317895-8.395308 8.229136-45.578142 45.411969l-67.88134 67.884953a31.998984 31.998984 0 0 0 22.628318 54.627301zM255.948523 544.058589h-0.361244c-0.104761 0-11.722364-0.115598-63.658399-0.115598H95.942765a31.998984 31.998984 0 1 1 0-64.00158h95.996952c52.586273 0 63.88237 0.111986 64.337538 0.11921a31.998984 31.998984 0 0 1 31.659414 31.97731v0.361244a32.002596 32.002596 0 0 1-31.988146 31.659414zM767.939492 544.058589a32.002596 32.002596 0 0 1-31.995372-31.666639v-0.361244a31.998984 31.998984 0 0 1 31.659415-31.970085c0.455167 0 11.754876-0.11921 64.34115-0.11921h96.000564a31.998984 31.998984 0 0 1 0 64.00158H831.944685c-51.936034 0-63.553638 0.111986-63.665624 0.115598h-0.335957zM692.999446 363.0176a31.998984 31.998984 0 0 1-22.863126-54.381656c0.317895-0.32512 8.229136-8.395308 45.41197-45.578141l67.88134-67.884953A31.998984 31.998984 0 1 1 828.693489 240.429485l-67.892177 67.88134c-31.020013 31.023625-41.644196 41.759794-44.241539 44.393262l-0.697201 0.722488a31.908673 31.908673 0 0 1-22.863126 9.591025z",fill:"","p-id":"2626"})}),"\xA0loading..."]})}};
|
|
2
2
|
//# sourceMappingURL=button.stories.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/stories/button.stories.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\nimport { SearchIcon } from '@storybook/icons'\n\nimport { Button } from '../components/index.js'\nimport React from 'react'\n\n// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export\nconst meta = {\n // \u540C\u65F6\u5B9A\u4E49\u4E86\u9875\u9762\u5DE6\u4FA7\u83DC\u5355\n title: 'Components/Button',\n component: Button,\n parameters: {\n // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout\n layout: 'centered',\n docs: {\n description: {\n component: `\u6309\u94AE\u7EC4\u4EF6, \u5206\u4E3A\u591A\u79CD\u53D8\u4F53\u548C\u5927\u5C0F, \u652F\u6301 loading \u72B6\u6001\u548C\u56FE\u6807`\n }\n }\n },\n // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs\n tags: ['autodocs'],\n // More on argTypes: https://storybook.js.org/docs/api/argtypes\n argTypes: {\n theme: {\n control: {\n type: 'select',\n },\n options: ['dark', 'light'],\n description: '\u4E3B\u9898, \u9ED8\u8BA4\u662F light',\n },\n variant: {\n control: {\n type: 'select',\n },\n options: ['
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,SAAAC,EAAA,
|
|
6
|
-
"names": ["button_stories_exports", "__export", "Aschild", "Link", "
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\nimport { SearchIcon } from '@storybook/icons'\n\nimport { Button } from '../components/index.js'\nimport React from 'react'\n\n// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export\nconst meta = {\n // \u540C\u65F6\u5B9A\u4E49\u4E86\u9875\u9762\u5DE6\u4FA7\u83DC\u5355\n title: 'Components/Button',\n component: Button,\n parameters: {\n // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout\n layout: 'centered',\n docs: {\n description: {\n component: `\u6309\u94AE\u7EC4\u4EF6, \u5206\u4E3A\u591A\u79CD\u53D8\u4F53\u548C\u5927\u5C0F, \u652F\u6301 loading \u72B6\u6001\u548C\u56FE\u6807`\n }\n }\n },\n // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs\n tags: ['autodocs'],\n // More on argTypes: https://storybook.js.org/docs/api/argtypes\n argTypes: {\n theme: {\n control: {\n type: 'select',\n },\n options: ['dark', 'light'],\n description: '\u4E3B\u9898, \u9ED8\u8BA4\u662F light',\n },\n variant: {\n control: {\n type: 'select',\n },\n options: ['primary', 'secondary', 'link', 'ghost'],\n description: '\u6309\u94AE\u7C7B\u578B, \u63A8\u8350\u4F7F\u7528 primary \u548C secondary\uFF0C link ; ghost \u5C06\u4F1A\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 secondary\uFF0C \u4EE3\u66FF',\n },\n size: {\n control: {\n type: 'select',\n },\n options: ['sm', 'base', 'lg', 'icon'],\n description: '\u6309\u94AE\u5927\u5C0F \u9ED8\u8BA4\u662F base, \u53EF\u9009\u503C: sm, base, lg, icon',\n },\n hoverEffect: {\n description: 'hover \u72B6\u6001\u4E0B\u7684\u52A8\u753B\u6548\u679C\uFF0C\u4EC5\u5728variant\u662Fprimary \u548C secondary \u65F6\u751F\u6548',\n control: {\n type: 'select',\n },\n options: ['none', 'slide'],\n },\n },\n args: {\n theme: 'light',\n variant: 'primary',\n size: 'base',\n children: 'Button',\n asChild: false,\n disabled: false,\n loading: false,\n hoverEffect: 'none',\n },\n} satisfies Meta<typeof Button>\n\nexport default meta\ntype Story = StoryObj<typeof meta>\n\n// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args\n// args \u4F1A\u4F5C\u4E3A props \u4F20\u9012\u7ED9\u7EC4\u4EF6\n// Story\u7684\u540D\u4F1A\u4F5C\u4E3A\u83DC\u5355\u7684\u540D\u79F0 \u81EA\u52A8\u9996\u5B57\u6BCD\u5927\u5199\u5E76\u6309\u7167\u5927\u5199\u5B57\u6BCD\u62C6\u5206 UseAsButton => Use As Button\n\nexport const Primary: Story = {\n args: {\n size: 'lg',\n children: 'Primary',\n },\n}\n\nexport const Secondary: Story = {\n args: {\n size: 'lg',\n variant: 'secondary',\n children: 'Secondary',\n },\n}\n\nexport const Link: Story = {\n args: {\n size: 'lg',\n variant: 'link',\n children: 'Link',\n },\n}\n\nexport const WithIcon: Story = {\n args: {\n size: 'lg',\n children: (\n <>\n WithIcon <SearchIcon className=\"ml-2\" />\n </>\n ),\n },\n}\n\nexport const Loading: Story = {\n args: {\n size: 'lg',\n loading: true,\n },\n}\n\nexport const Aschild: Story = {\n args: {\n size: 'lg',\n asChild: true,\n children: <a href=\"http://example.com\">as a a tag</a>,\n },\n}\n\nexport const Spinner: Story = {\n args: {\n size: 'lg',\n loading: true,\n spinner: (\n <div className=\"flex animate-pulse flex-row font-bold text-neutral-900\">\n <svg\n viewBox=\"0 0 1024 1024\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n p-id=\"2625\"\n width=\"1rem\"\n className=\"align-middle\"\n >\n <path\n d=\"M511.882596 287.998081h-0.361244a31.998984 31.998984 0 0 1-31.659415-31.977309v-0.361244c0-0.104761 0.115598-11.722364 0.115598-63.658399V96.000564a31.998984 31.998984 0 1 1 64.001581 0V192.001129c0 52.586273-0.111986 63.88237-0.119211 64.337537a32.002596 32.002596 0 0 1-31.977309 31.659415zM511.998194 959.99842a31.998984 31.998984 0 0 1-31.998984-31.998984v-96.379871c0-51.610915-0.111986-63.174332-0.115598-63.286318s0-0.242033 0-0.361243a31.998984 31.998984 0 0 1 63.997968-0.314283c0 0.455167 0.11921 11.711527 0.11921 64.034093v96.307622a31.998984 31.998984 0 0 1-32.002596 31.998984zM330.899406 363.021212a31.897836 31.897836 0 0 1-22.866739-9.612699c-0.075861-0.075861-8.207461-8.370021-44.931515-45.094076L195.198137 240.429485a31.998984 31.998984 0 0 1 45.256635-45.253022L308.336112 263.057803c37.182834 37.182834 45.090463 45.253022 45.41197 45.578141A31.998984 31.998984 0 0 1 330.899406 363.021212zM806.137421 838.11473a31.901448 31.901448 0 0 1-22.628318-9.374279L715.624151 760.859111c-36.724054-36.724054-45.018214-44.859267-45.097687-44.93874a31.998984 31.998984 0 0 1 44.77618-45.729864c0.32512 0.317895 8.395308 8.229136 45.578142 45.411969l67.88134 67.88134a31.998984 31.998984 0 0 1-22.624705 54.630914zM224.000113 838.11473a31.901448 31.901448 0 0 0 22.628317-9.374279l67.88134-67.88134c36.724054-36.724054 45.021826-44.859267 45.097688-44.93874a31.998984 31.998984 0 0 0-44.776181-45.729864c-0.32512 0.317895-8.395308 8.229136-45.578142 45.411969l-67.88134 67.884953a31.998984 31.998984 0 0 0 22.628318 54.627301zM255.948523 544.058589h-0.361244c-0.104761 0-11.722364-0.115598-63.658399-0.115598H95.942765a31.998984 31.998984 0 1 1 0-64.00158h95.996952c52.586273 0 63.88237 0.111986 64.337538 0.11921a31.998984 31.998984 0 0 1 31.659414 31.97731v0.361244a32.002596 32.002596 0 0 1-31.988146 31.659414zM767.939492 544.058589a32.002596 32.002596 0 0 1-31.995372-31.666639v-0.361244a31.998984 31.998984 0 0 1 31.659415-31.970085c0.455167 0 11.754876-0.11921 64.34115-0.11921h96.000564a31.998984 31.998984 0 0 1 0 64.00158H831.944685c-51.936034 0-63.553638 0.111986-63.665624 0.115598h-0.335957zM692.999446 363.0176a31.998984 31.998984 0 0 1-22.863126-54.381656c0.317895-0.32512 8.229136-8.395308 45.41197-45.578141l67.88134-67.884953A31.998984 31.998984 0 1 1 828.693489 240.429485l-67.892177 67.88134c-31.020013 31.023625-41.644196 41.759794-44.241539 44.393262l-0.697201 0.722488a31.908673 31.908673 0 0 1-22.863126 9.591025z\"\n fill=\"\"\n p-id=\"2626\"\n ></path>\n </svg>\n loading...\n </div>\n ),\n },\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,SAAAC,EAAA,YAAAC,EAAA,YAAAC,EAAA,cAAAC,EAAA,YAAAC,EAAA,aAAAC,EAAA,YAAAC,IAAA,eAAAC,EAAAV,GAmGM,IAAAW,EAAA,6BAlGNC,EAA2B,4BAE3BC,EAAuB,kCACvBC,EAAkB,iBAGlB,MAAMC,EAAO,CAEX,MAAO,oBACP,UAAW,SACX,WAAY,CAEV,OAAQ,WACR,KAAM,CACJ,YAAa,CACX,UAAW,uIACb,CACF,CACF,EAEA,KAAM,CAAC,UAAU,EAEjB,SAAU,CACR,MAAO,CACL,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,OAAQ,OAAO,EACzB,YAAa,wCACf,EACA,QAAS,CACP,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,UAAW,YAAa,OAAQ,OAAO,EACjD,YAAa,8KACf,EACA,KAAM,CACJ,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,KAAM,OAAQ,KAAM,MAAM,EACpC,YAAa,0FACf,EACA,YAAa,CACX,YAAa,mIACb,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,OAAQ,OAAO,CAC3B,CACF,EACA,KAAM,CACJ,MAAO,QACP,QAAS,UACT,KAAM,OACN,SAAU,SACV,QAAS,GACT,SAAU,GACV,QAAS,GACT,YAAa,MACf,CACF,EAEA,IAAON,EAAQM,EAOR,MAAMV,EAAiB,CAC5B,KAAM,CACJ,KAAM,KACN,SAAU,SACZ,CACF,EAEaC,EAAmB,CAC9B,KAAM,CACJ,KAAM,KACN,QAAS,YACT,SAAU,WACZ,CACF,EAEaH,EAAc,CACzB,KAAM,CACJ,KAAM,KACN,QAAS,OACT,SAAU,MACZ,CACF,EAEaK,EAAkB,CAC7B,KAAM,CACJ,KAAM,KACN,YACE,oBAAE,yBACS,OAAC,cAAW,UAAU,OAAO,GACxC,CAEJ,CACF,EAEaJ,EAAiB,CAC5B,KAAM,CACJ,KAAM,KACN,QAAS,EACX,CACF,EAEaF,EAAiB,CAC5B,KAAM,CACJ,KAAM,KACN,QAAS,GACT,YAAU,OAAC,KAAE,KAAK,qBAAqB,sBAAU,CACnD,CACF,EAEaK,EAAiB,CAC5B,KAAM,CACJ,KAAM,KACN,QAAS,GACT,WACE,QAAC,OAAI,UAAU,yDACb,oBAAC,OACC,QAAQ,gBACR,QAAQ,MACR,MAAM,6BACN,OAAK,OACL,MAAM,OACN,UAAU,eAEV,mBAAC,QACC,EAAE,o5EACF,KAAK,GACL,OAAK,OACN,EACH,EAAM,kBAER,CAEJ,CACF",
|
|
6
|
+
"names": ["button_stories_exports", "__export", "Aschild", "Link", "Loading", "Primary", "Secondary", "Spinner", "WithIcon", "button_stories_default", "__toCommonJS", "import_jsx_runtime", "import_icons", "import_components", "import_react", "meta"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import m from"react";import{Button as c,Text as N}from"../../components/index.js";import{cn as a}from"../../helpers/index.js";import{withStyles as k}from"../../shared/Styles.js";const
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import m from"react";import{Button as c,Text as N}from"../../components/index.js";import{cn as a}from"../../helpers/index.js";import{withStyles as k}from"../../shared/Styles.js";const p=m.forwardRef(({title:x,subtitle:d,background:g,primaryButton:n,secondaryButton:l,theme:t="light",className:b,products:i=[]},f)=>{const o=t==="dark"?"text-white":"text-[#1D1D1F]",v=t==="dark"?"bg-white":"bg-[#1D1D1F]";return r("div",{ref:f,className:a("relative flex min-h-[720px] w-full flex-col justify-between overflow-hidden bg-cover bg-center bg-no-repeat",b),style:{backgroundImage:`url(${g})`},children:[r("div",{className:"relative z-10 flex flex-col gap-8 px-32 pt-[307px]",children:[r("div",{className:"max-w-[686px] space-y-4",children:[e("h1",{className:a("hero-banner-title font-mont text-[64px] font-bold leading-none tracking-[-0.04em]",o),children:x}),e("p",{className:a("hero-banner-subtitle text-lg font-medium leading-[1.2] tracking-[-0.02em]",o),children:d})]}),r("div",{className:"flex items-center gap-4",children:[l&&e(c,{size:"lg",variant:"primary",theme:t,className:"hero-banner-primary-button",...l,children:l.text}),n&&e(c,{size:"lg",variant:"secondary",theme:t,...n,className:"hero-banner-secondary-button bg-transparent border-black text-black hover:bg-black hover:text-white",children:n.text})]})]}),i.length>0&&e("div",{className:"relative z-10 flex items-center gap-3 px-32 pb-6",children:i.map((h,s)=>r(m.Fragment,{children:[e(N,{className:a("hero-banner-product-text text-sm font-medium leading-[1.2] tracking-[-0.02em]",t==="dark"?"text-white":"text-[#1D1D1F]"),children:h.title}),s<i.length-1&&e("div",{className:a("h-4 w-px",v)})]},s))})]})});p.displayName="HeroBanner";var F=k(p);export{F as default};
|
|
2
2
|
//# sourceMappingURL=HeroBanner.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/HeroBanner/HeroBanner.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from \"react\"\nimport type { HeroBannerProps } from \"./types.js\"\nimport { Button, Text } from \"../../components/index.js\"\nimport { cn } from \"../../helpers/index.js\"\nimport { withStyles } from \"../../shared/Styles.js\"\n\nconst HeroBanner = React.forwardRef<HTMLDivElement, HeroBannerProps>(\n ({ \n title, \n subtitle, \n background,\n primaryButton,\n secondaryButton,\n theme = \"light\",\n className,\n products = [] \n }, ref) => {\n const textColorClass = theme === \"dark\" ? \"text-white\" : \"text-[#1D1D1F]\"\n const dividerColorClass = theme === \"dark\" ? \"bg-white\" : \"bg-[#1D1D1F]\"\n\n return (\n <div \n ref={ref} \n className={cn(\n \"relative flex min-h-[720px] w-full flex-col justify-between overflow-hidden bg-cover bg-center bg-no-repeat\",\n className\n )}\n style={{ backgroundImage: `url(${background})` }}\n >\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"relative z-10 flex flex-col gap-8 px-32 pt-[307px]\">\n <div className=\"max-w-[686px] space-y-4\">\n <h1 className={cn(\n \"hero-banner-title font-mont text-[64px] font-bold leading-none tracking-[-0.04em]\",\n textColorClass\n )}>\n {title}\n </h1>\n <p className={cn(\n \"hero-banner-subtitle text-lg font-medium leading-[1.2] tracking-[-0.02em]\",\n textColorClass\n )}>\n {subtitle}\n </p>\n </div>\n \n {/* \u6309\u94AE\u7EC4 */}\n <div className=\"flex items-center gap-4\">\n {secondaryButton && (\n <Button\n size=\"lg\"\n variant=\"
|
|
5
|
-
"mappings": "AA+BU,OACE,OAAAA,EADF,QAAAC,MAAA,oBA/BV,OAAOC,MAAW,QAElB,OAAS,UAAAC,EAAQ,QAAAC,MAAY,4BAC7B,OAAS,MAAAC,MAAU,yBACnB,OAAS,cAAAC,MAAkB,yBAE3B,MAAMC,EAAaL,EAAM,WACvB,CAAC,CACC,MAAAM,EACA,SAAAC,EACA,WAAAC,EACA,cAAAC,EACA,gBAAAC,EACA,MAAAC,EAAQ,QACR,UAAAC,EACA,SAAAC,EAAW,CAAC,CACd,EAAGC,IAAQ,CACT,MAAMC,EAAiBJ,IAAU,OAAS,aAAe,iBACnDK,EAAoBL,IAAU,OAAS,WAAa,eAE1D,OACEZ,EAAC,OACC,IAAKe,EACL,UAAWX,EACT,8GACAS,CACF,EACA,MAAO,CAAE,gBAAiB,OAAOJ,CAAU,GAAI,EAG/C,UAAAT,EAAC,OAAI,UAAU,qDACb,UAAAA,EAAC,OAAI,UAAU,0BACb,UAAAD,EAAC,MAAG,UAAWK,EACb,oFACAY,CACF,EACG,SAAAT,EACH,EACAR,EAAC,KAAE,UAAWK,EACZ,4EACAY,CACF,EACG,SAAAR,EACH,GACF,EAGAR,EAAC,OAAI,UAAU,0BACZ,UAAAW,GACCZ,EAACG,EAAA,CACC,KAAK,KACL,QAAQ,
|
|
4
|
+
"sourcesContent": ["import React from \"react\"\nimport type { HeroBannerProps } from \"./types.js\"\nimport { Button, Text } from \"../../components/index.js\"\nimport { cn } from \"../../helpers/index.js\"\nimport { withStyles } from \"../../shared/Styles.js\"\n\nconst HeroBanner = React.forwardRef<HTMLDivElement, HeroBannerProps>(\n ({ \n title, \n subtitle, \n background,\n primaryButton,\n secondaryButton,\n theme = \"light\",\n className,\n products = [] \n }, ref) => {\n const textColorClass = theme === \"dark\" ? \"text-white\" : \"text-[#1D1D1F]\"\n const dividerColorClass = theme === \"dark\" ? \"bg-white\" : \"bg-[#1D1D1F]\"\n\n return (\n <div \n ref={ref} \n className={cn(\n \"relative flex min-h-[720px] w-full flex-col justify-between overflow-hidden bg-cover bg-center bg-no-repeat\",\n className\n )}\n style={{ backgroundImage: `url(${background})` }}\n >\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"relative z-10 flex flex-col gap-8 px-32 pt-[307px]\">\n <div className=\"max-w-[686px] space-y-4\">\n <h1 className={cn(\n \"hero-banner-title font-mont text-[64px] font-bold leading-none tracking-[-0.04em]\",\n textColorClass\n )}>\n {title}\n </h1>\n <p className={cn(\n \"hero-banner-subtitle text-lg font-medium leading-[1.2] tracking-[-0.02em]\",\n textColorClass\n )}>\n {subtitle}\n </p>\n </div>\n \n {/* \u6309\u94AE\u7EC4 */}\n <div className=\"flex items-center gap-4\">\n {secondaryButton && (\n <Button\n size=\"lg\"\n variant=\"primary\"\n theme={theme}\n className=\"hero-banner-primary-button\"\n {...secondaryButton}\n >\n {secondaryButton.text}\n </Button>\n )}\n {primaryButton && (\n <Button\n size=\"lg\"\n variant=\"secondary\"\n theme={theme}\n {...primaryButton}\n className=\"hero-banner-secondary-button bg-transparent border-black text-black hover:bg-black hover:text-white\"\n >\n {primaryButton.text}\n </Button>\n )}\n </div>\n </div>\n\n {/* \u5E95\u90E8\u4EA7\u54C1\u5217\u8868 */}\n {products.length > 0 && (\n <div className=\"relative z-10 flex items-center gap-3 px-32 pb-6\">\n {products.map((product, index) => (\n <React.Fragment key={index}>\n <Text\n className={cn(\n \"hero-banner-product-text text-sm font-medium leading-[1.2] tracking-[-0.02em]\",\n theme === \"dark\" ? \"text-white\" : \"text-[#1D1D1F]\"\n )}\n >\n {product.title}\n </Text>\n {index < products.length - 1 && (\n <div className={cn(\"h-4 w-px\", dividerColorClass)} />\n )}\n </React.Fragment>\n ))}\n </div>\n )}\n </div>\n )\n }\n)\n\nHeroBanner.displayName = \"HeroBanner\"\n\nexport default withStyles(HeroBanner)\n\n\n"],
|
|
5
|
+
"mappings": "AA+BU,OACE,OAAAA,EADF,QAAAC,MAAA,oBA/BV,OAAOC,MAAW,QAElB,OAAS,UAAAC,EAAQ,QAAAC,MAAY,4BAC7B,OAAS,MAAAC,MAAU,yBACnB,OAAS,cAAAC,MAAkB,yBAE3B,MAAMC,EAAaL,EAAM,WACvB,CAAC,CACC,MAAAM,EACA,SAAAC,EACA,WAAAC,EACA,cAAAC,EACA,gBAAAC,EACA,MAAAC,EAAQ,QACR,UAAAC,EACA,SAAAC,EAAW,CAAC,CACd,EAAGC,IAAQ,CACT,MAAMC,EAAiBJ,IAAU,OAAS,aAAe,iBACnDK,EAAoBL,IAAU,OAAS,WAAa,eAE1D,OACEZ,EAAC,OACC,IAAKe,EACL,UAAWX,EACT,8GACAS,CACF,EACA,MAAO,CAAE,gBAAiB,OAAOJ,CAAU,GAAI,EAG/C,UAAAT,EAAC,OAAI,UAAU,qDACb,UAAAA,EAAC,OAAI,UAAU,0BACb,UAAAD,EAAC,MAAG,UAAWK,EACb,oFACAY,CACF,EACG,SAAAT,EACH,EACAR,EAAC,KAAE,UAAWK,EACZ,4EACAY,CACF,EACG,SAAAR,EACH,GACF,EAGAR,EAAC,OAAI,UAAU,0BACZ,UAAAW,GACCZ,EAACG,EAAA,CACC,KAAK,KACL,QAAQ,UACR,MAAOU,EACP,UAAU,6BACT,GAAGD,EAEH,SAAAA,EAAgB,KACnB,EAEDD,GACCX,EAACG,EAAA,CACC,KAAK,KACL,QAAQ,YACR,MAAOU,EACN,GAAGF,EACJ,UAAU,sGAET,SAAAA,EAAc,KACjB,GAEJ,GACF,EAGCI,EAAS,OAAS,GACjBf,EAAC,OAAI,UAAU,mDACZ,SAAAe,EAAS,IAAI,CAACI,EAASC,IACtBnB,EAACC,EAAM,SAAN,CACC,UAAAF,EAACI,EAAA,CACC,UAAWC,EACT,gFACAQ,IAAU,OAAS,aAAe,gBACpC,EAEC,SAAAM,EAAQ,MACX,EACCC,EAAQL,EAAS,OAAS,GACzBf,EAAC,OAAI,UAAWK,EAAG,WAAYa,CAAiB,EAAG,IAVlCE,CAYrB,CACD,EACH,GAEJ,CAEJ,CACF,EAEAb,EAAW,YAAc,aAEzB,IAAOc,EAAQf,EAAWC,CAAU",
|
|
6
6
|
"names": ["jsx", "jsxs", "React", "Button", "Text", "cn", "withStyles", "HeroBanner", "title", "subtitle", "background", "primaryButton", "secondaryButton", "theme", "className", "products", "ref", "textColorClass", "dividerColorClass", "product", "index", "HeroBanner_default"]
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ import { type VariantProps } from 'class-variance-authority';
|
|
|
4
4
|
* Button Variants
|
|
5
5
|
*/
|
|
6
6
|
declare const buttonVariants: (props?: ({
|
|
7
|
-
variant?: "link" | "
|
|
7
|
+
variant?: "link" | "primary" | "secondary" | "ghost" | null | undefined;
|
|
8
8
|
size?: "sm" | "base" | "lg" | "icon" | null | undefined;
|
|
9
9
|
hoverEffect?: "none" | "slide" | null | undefined;
|
|
10
10
|
state?: "default" | "disabled" | "loading" | null | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as w,jsx as e,jsxs as V}from"react/jsx-runtime";import*as y from"react";import{Slot as v}from"@radix-ui/react-slot";import{VisuallyHidden as g}from"@radix-ui/react-visually-hidden";import{cva as s}from"class-variance-authority";import u from"../icons/spinner.js";import{cn as h}from"../helpers/index.js";const x=s("ring-offset-background border-[1.6px] border-solid focus-visible:ring-ring rounded-btn inline-flex items-center justify-center text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none",{variants:{variant:{primary:"bg-btn-primary text-btn-primary-foreground hover:bg-btn-primary-active",secondary:"bg-btn-secondary border-info-primary text-btn-secondary-foreground hover:bg-btn-secondary-active hover:text-btn-secondary border border-solid",link:"text-info-primary underline-offset-4 hover:underline border-none hover:text-btn-primary-active",ghost:"hover:bg-btn-primary hover:text-btn-primary-foreground"},size:{sm:"px-3 py-2 text-[12px] leading-tight",base:"px-5 pt-[11px] pb-[10px] text-[14px] leading-tight",lg:"px-7 pt-[15px] pb-[14px] text-[16px] leading-tight",icon:"size-10 rounded-full leading-tight"},hoverEffect:{none:"",slide:""},state:{default:"",disabled:"",loading:""},theme:{dark:"",light:""}},compoundVariants:[{variant:"primary",hoverEffect:"slide",class:'z-[1] before:-z-[1] before:rounded-btn hover:!bg-btn-primary before:bg-btn-primary-active relative overflow-hidden before:absolute before:inset-y-0 before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[""] hover:before:translate-x-0'},{variant:"secondary",hoverEffect:"slide",class:'z-[1] before:-z-[1] before:rounded-btn hover:!bg-btn-secondary before:bg-btn-secondary-active relative overflow-hidden before:absolute before:inset-y-0 before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[""] hover:before:translate-x-0'},{variant:"primary",state:"loading",class:"bg-btn-primary-active"},{variant:"secondary",state:"loading",class:"bg-btn-secondary disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground"},{variant:"primary",state:"disabled",class:"disabled:bg-btn-primary-disabled disabled:text-btn-primary-disabled-foreground"},{variant:"secondary",state:"disabled",class:"disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground disabled:border-btn-secondary-disabled-border"},{variant:"secondary",theme:"dark",class:"text-info-white bg-info-primary hover:border-info-white hover:text-info-primary hover:bg-info-white"},{variant:"secondary",theme:"dark",state:"loading",class:"bg-btn-info-white text-info-primary border-info-white"},{variant:"secondary",theme:"dark",state:"disabled",class:"disabled:bg-text-info-quaternary disabled:text-info-white"},{variant:"link",state:"disabled",class:"disabled:text-info-quaternary"},{variant:"primary",theme:"dark",class:"text-info-primary hover:text-info-white bg-info-white hover:border-brand-0"},{variant:"primary",theme:"dark",state:"loading",class:"bg-btn-primary-active text-info-white border-brand-0"},{variant:"secondary",theme:"dark",class:"border-info-white"},{variant:"secondary",theme:"light",class:""},{variant:"link",theme:"dark",class:"text-info-white"}],defaultVariants:{variant:"primary",size:"base",hoverEffect:"none",state:"default",theme:"light"}}),k=s("",{variants:{variant:{primary:"stroke-btn-primary-foreground",secondary:"stroke-btn-secondary-foreground",link:"stroke-primary",ghost:"stroke-primary"},theme:{dark:"",light:""}},defaultVariants:{variant:"primary",theme:"light"}}),d=y.forwardRef(({asChild:b=!1,size:l="base",children:t,variant:a,theme:n="light",hoverEffect:f="none",className:c,disabled:o=!1,loading:r=!1,spinner:i,...p},m)=>e(b?v:"button",{disabled:o||r,className:h(x({variant:a,size:l,hoverEffect:f,state:r?"loading":o?"disabled":"default",theme:n}),c),ref:m,...p,children:r?V(w,{children:[e("span",{style:{display:"contents",visibility:"hidden"},"aria-hidden":!0,children:t}),e("span",{className:"absolute",children:i||e(u,{className:k({variant:a,theme:n})})}),e(g,{children:t})]}):t}));d.displayName="Button";var L=d;export{L as default};
|
|
2
2
|
//# sourceMappingURL=button.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/button.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden'\nimport { type VariantProps, cva } from 'class-variance-authority'\nimport Spinner from '../icons/spinner.js'\nimport { cn } from '../helpers/index.js'\n\n/**\n * Button Variants\n */\nconst buttonVariants = cva(\n 'ring-offset-background focus-visible:ring-ring rounded-btn inline-flex items-center justify-center text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none',\n {\n variants: {\n variant: {\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden'\nimport { type VariantProps, cva } from 'class-variance-authority'\nimport Spinner from '../icons/spinner.js'\nimport { cn } from '../helpers/index.js'\n\n/**\n * Button Variants\n */\nconst buttonVariants = cva(\n 'ring-offset-background border-[1.6px] border-solid focus-visible:ring-ring rounded-btn inline-flex items-center justify-center text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none',\n {\n variants: {\n variant: {\n primary: 'bg-btn-primary text-btn-primary-foreground hover:bg-btn-primary-active',\n secondary:\n 'bg-btn-secondary border-info-primary text-btn-secondary-foreground hover:bg-btn-secondary-active hover:text-btn-secondary border border-solid',\n link: 'text-info-primary underline-offset-4 hover:underline border-none hover:text-btn-primary-active',\n ghost: 'hover:bg-btn-primary hover:text-btn-primary-foreground',\n },\n size: {\n sm: 'px-3 py-2 text-[12px] leading-tight',\n base: 'px-5 pt-[11px] pb-[10px] text-[14px] leading-tight',\n lg: 'px-7 pt-[15px] pb-[14px] text-[16px] leading-tight',\n icon: 'size-10 rounded-full leading-tight',\n },\n /** hover \u72B6\u6001\u4E0B\u7684\u52A8\u753B\u6548\u679C,\u9700\u8981\u6CE8\u610F\u4E0D\u540Cvariant \u4E0B\u7684\u6548\u679C */\n hoverEffect: {\n none: '',\n slide: '',\n },\n state: {\n default: '',\n disabled: '',\n loading: '',\n },\n theme: {\n dark: '',\n light: '',\n },\n },\n compoundVariants: [\n {\n variant: 'primary',\n hoverEffect: 'slide',\n class:\n 'z-[1] before:-z-[1] before:rounded-btn hover:!bg-btn-primary before:bg-btn-primary-active relative overflow-hidden before:absolute before:inset-y-0 before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[\"\"] hover:before:translate-x-0',\n },\n {\n variant: 'secondary',\n hoverEffect: 'slide',\n class:\n 'z-[1] before:-z-[1] before:rounded-btn hover:!bg-btn-secondary before:bg-btn-secondary-active relative overflow-hidden before:absolute before:inset-y-0 before:w-full before:-translate-x-full before:transition-transform before:duration-300 before:ease-in-out before:content-[\"\"] hover:before:translate-x-0',\n },\n {\n variant: 'primary',\n state: 'loading',\n class: 'bg-btn-primary-active',\n },\n {\n variant: 'secondary',\n state: 'loading',\n class: 'bg-btn-secondary disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground',\n },\n {\n variant: 'primary',\n state: 'disabled',\n class: 'disabled:bg-btn-primary-disabled disabled:text-btn-primary-disabled-foreground',\n },\n {\n variant: 'secondary',\n state: 'disabled',\n class: 'disabled:bg-btn-secondary-disabled disabled:text-btn-secondary-disabled-foreground disabled:border-btn-secondary-disabled-border',\n },\n {\n variant: 'secondary',\n theme: 'dark',\n class: 'text-info-white bg-info-primary hover:border-info-white hover:text-info-primary hover:bg-info-white',\n },\n {\n variant: 'secondary',\n theme: 'dark',\n state: 'loading',\n class: 'bg-btn-info-white text-info-primary border-info-white',\n },\n {\n variant: 'secondary',\n theme: 'dark',\n state: 'disabled',\n class: 'disabled:bg-text-info-quaternary disabled:text-info-white',\n },\n {\n variant: 'link',\n state: 'disabled',\n class: 'disabled:text-info-quaternary',\n },\n {\n variant: 'primary',\n theme: 'dark',\n class: 'text-info-primary hover:text-info-white bg-info-white hover:border-brand-0',\n },\n {\n variant: 'primary',\n theme: 'dark',\n state: 'loading',\n class: 'bg-btn-primary-active text-info-white border-brand-0', \n },\n {\n variant: 'secondary',\n theme: 'dark',\n class: 'border-info-white',\n },\n {\n variant: 'secondary',\n theme: 'light',\n class: '',\n },\n {\n variant: 'link',\n theme: 'dark',\n class: 'text-info-white',\n },\n ],\n defaultVariants: {\n variant: 'primary',\n size: 'base',\n hoverEffect: 'none',\n state: 'default',\n theme: 'light',\n },\n }\n)\n\nconst loadingSvgVariants = cva('', {\n variants: {\n variant: {\n primary: 'stroke-btn-primary-foreground',\n secondary: 'stroke-btn-secondary-foreground',\n link: 'stroke-primary',\n ghost: 'stroke-primary',\n },\n theme: {\n dark: '',\n light: '',\n },\n },\n defaultVariants: {\n variant: 'primary',\n theme: 'light',\n },\n})\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /** \u8BBE\u7F6E\u6309\u94AE\u8F7D\u5165\u72B6\u6001 */\n loading?: boolean\n /** \u8BBE\u7F6E\u6309\u94AE\u5931\u6548\u72B6\u6001 */\n disabled?: boolean\n /** \u5B9A\u4E49\u81EA\u7EC4\u4EF6\u4F5C\u4E3A\u7236\u7EC4\u4EF6\u7684\u7C7B\u578B\uFF0C \u8BE6\u7EC6\u4F7F\u7528\u65B9\u5F0F\u8BF7\u53C2\u8003radix-ui */\n asChild?: boolean\n /** \u81EA\u5B9A\u4E49loading */\n spinner?: React.ReactNode\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n asChild = false,\n size = 'base',\n children,\n variant,\n theme = 'light',\n hoverEffect = 'none',\n className,\n disabled = false,\n loading = false,\n spinner,\n ...props\n }: ButtonProps,\n ref\n ) => {\n const Comp = asChild ? Slot : 'button'\n const isInactive = disabled || loading\n const state = loading ? 'loading' : disabled ? 'disabled' : 'default'\n\n return (\n <Comp\n disabled={isInactive}\n className={cn(buttonVariants({ variant, size, hoverEffect, state, theme }), className)}\n ref={ref}\n {...props}\n >\n {loading ? (\n <>\n <span style={{ display: 'contents', visibility: 'hidden' }} aria-hidden>\n {children}\n </span>\n <span className=\"absolute\">\n {spinner ? (\n spinner\n ) : (\n <Spinner\n className={loadingSvgVariants({\n variant,\n theme,\n })}\n />\n )}\n </span>\n <VisuallyHidden>{children}</VisuallyHidden>\n </>\n ) : (\n children\n )}\n </Comp>\n )\n }\n)\n\nButton.displayName = 'Button'\nexport default Button\n"],
|
|
5
|
+
"mappings": "aAqMU,mBAAAA,EACE,OAAAC,EADF,QAAAC,MAAA,oBAnMV,UAAYC,MAAW,QACvB,OAAS,QAAAC,MAAY,uBACrB,OAAS,kBAAAC,MAAsB,kCAC/B,OAA4B,OAAAC,MAAW,2BACvC,OAAOC,MAAa,sBACpB,OAAS,MAAAC,MAAU,sBAKnB,MAAMC,EAAiBH,EACrB,gRACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,yEACT,UACE,gJACF,KAAM,iGACN,MAAO,wDACT,EACA,KAAM,CACJ,GAAI,uCACJ,KAAM,qDACN,GAAI,sDACJ,KAAM,qCACR,EAEA,YAAa,CACX,KAAM,GACN,MAAO,EACT,EACA,MAAO,CACL,QAAS,GACT,SAAU,GACV,QAAS,EACX,EACA,MAAO,CACL,KAAM,GACN,MAAO,EACT,CACF,EACA,iBAAkB,CAChB,CACE,QAAS,UACT,YAAa,QACb,MACE,8SACJ,EACA,CACE,QAAS,YACT,YAAa,QACb,MACE,mTACJ,EACA,CACE,QAAS,UACT,MAAO,UACP,MAAO,uBACT,EACA,CACE,QAAS,YACT,MAAO,UACP,MAAO,qGACT,EACA,CACE,QAAS,UACT,MAAO,WACP,MAAO,gFACT,EACA,CACE,QAAS,YACT,MAAO,WACP,MAAO,kIACT,EACA,CACE,QAAS,YACT,MAAO,OACP,MAAO,qGACT,EACA,CACE,QAAS,YACT,MAAO,OACP,MAAO,UACP,MAAO,uDACT,EACA,CACE,QAAS,YACT,MAAO,OACP,MAAO,WACP,MAAO,2DACT,EACA,CACE,QAAS,OACT,MAAO,WACP,MAAO,+BACT,EACA,CACE,QAAS,UACT,MAAO,OACP,MAAO,4EACT,EACA,CACE,QAAS,UACT,MAAO,OACP,MAAO,UACP,MAAO,sDACT,EACA,CACE,QAAS,YACT,MAAO,OACP,MAAO,mBACT,EACA,CACE,QAAS,YACT,MAAO,QACP,MAAO,EACT,EACA,CACE,QAAS,OACT,MAAO,OACP,MAAO,iBACT,CACF,EACA,gBAAiB,CACf,QAAS,UACT,KAAM,OACN,YAAa,OACb,MAAO,UACP,MAAO,OACT,CACF,CACF,EAEMI,EAAqBJ,EAAI,GAAI,CACjC,SAAU,CACR,QAAS,CACP,QAAS,gCACT,UAAW,kCACX,KAAM,iBACN,MAAO,gBACT,EACA,MAAO,CACL,KAAM,GACN,MAAO,EACT,CACF,EACA,gBAAiB,CACf,QAAS,UACT,MAAO,OACT,CACF,CAAC,EAeKK,EAASR,EAAM,WACnB,CACE,CACE,QAAAS,EAAU,GACV,KAAAC,EAAO,OACP,SAAAC,EACA,QAAAC,EACA,MAAAC,EAAQ,QACR,YAAAC,EAAc,OACd,UAAAC,EACA,SAAAC,EAAW,GACX,QAAAC,EAAU,GACV,QAAAC,EACA,GAAGC,CACL,EACAC,IAOEtB,EALWW,EAAUR,EAAO,SAK3B,CACC,SALee,GAAYC,EAM3B,UAAWZ,EAAGC,EAAe,CAAE,QAAAM,EAAS,KAAAF,EAAM,YAAAI,EAAa,MALjDG,EAAU,UAAYD,EAAW,WAAa,UAKU,MAAAH,CAAM,CAAC,EAAGE,CAAS,EACrF,IAAKK,EACJ,GAAGD,EAEH,SAAAF,EACClB,EAAAF,EAAA,CACE,UAAAC,EAAC,QAAK,MAAO,CAAE,QAAS,WAAY,WAAY,QAAS,EAAG,cAAW,GACpE,SAAAa,EACH,EACAb,EAAC,QAAK,UAAU,WACb,SAAAoB,GAGCpB,EAACM,EAAA,CACC,UAAWG,EAAmB,CAC5B,QAAAK,EACA,MAAAC,CACF,CAAC,EACH,EAEJ,EACAf,EAACI,EAAA,CAAgB,SAAAS,EAAS,GAC5B,EAEAA,EAEJ,CAGN,EAEAH,EAAO,YAAc,SACrB,IAAOa,EAAQb",
|
|
6
6
|
"names": ["Fragment", "jsx", "jsxs", "React", "Slot", "VisuallyHidden", "cva", "Spinner", "cn", "buttonVariants", "loadingSvgVariants", "Button", "asChild", "size", "children", "variant", "theme", "hoverEffect", "className", "disabled", "loading", "spinner", "props", "ref", "button_default"]
|
|
7
7
|
}
|
|
@@ -25,12 +25,14 @@ declare const meta: {
|
|
|
25
25
|
type: "select";
|
|
26
26
|
};
|
|
27
27
|
options: string[];
|
|
28
|
+
description: string;
|
|
28
29
|
};
|
|
29
30
|
size: {
|
|
30
31
|
control: {
|
|
31
32
|
type: "select";
|
|
32
33
|
};
|
|
33
34
|
options: string[];
|
|
35
|
+
description: string;
|
|
34
36
|
};
|
|
35
37
|
hoverEffect: {
|
|
36
38
|
description: string;
|
|
@@ -53,10 +55,10 @@ declare const meta: {
|
|
|
53
55
|
};
|
|
54
56
|
export default meta;
|
|
55
57
|
type Story = StoryObj<typeof meta>;
|
|
56
|
-
export declare const Nature: Story;
|
|
57
58
|
export declare const Primary: Story;
|
|
58
59
|
export declare const Secondary: Story;
|
|
59
60
|
export declare const Link: Story;
|
|
60
61
|
export declare const WithIcon: Story;
|
|
62
|
+
export declare const Loading: Story;
|
|
61
63
|
export declare const Aschild: Story;
|
|
62
64
|
export declare const Spinner: Story;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as s,jsx as t,jsxs as e}from"react/jsx-runtime";import{SearchIcon as o}from"@storybook/icons";import{Button as a}from"../components/index.js";import"react";const r={title:"Components/Button",component:a,parameters:{layout:"centered",docs:{description:{component:"\u6309\u94AE\u7EC4\u4EF6, \u5206\u4E3A\u591A\u79CD\u53D8\u4F53\u548C\u5927\u5C0F, \u652F\u6301 loading \u72B6\u6001\u548C\u56FE\u6807"}}},tags:["autodocs"],argTypes:{theme:{control:{type:"select"},options:["dark","light"],description:"\u4E3B\u9898, \u9ED8\u8BA4\u662F light"},variant:{control:{type:"select"},options:["primary","secondary","link","ghost"],description:"\u6309\u94AE\u7C7B\u578B, \u63A8\u8350\u4F7F\u7528 primary \u548C secondary\uFF0C link ; ghost \u5C06\u4F1A\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 secondary\uFF0C \u4EE3\u66FF"},size:{control:{type:"select"},options:["sm","base","lg","icon"],description:"\u6309\u94AE\u5927\u5C0F \u9ED8\u8BA4\u662F base, \u53EF\u9009\u503C: sm, base, lg, icon"},hoverEffect:{description:"hover \u72B6\u6001\u4E0B\u7684\u52A8\u753B\u6548\u679C\uFF0C\u4EC5\u5728variant\u662Fprimary \u548C secondary \u65F6\u751F\u6548",control:{type:"select"},options:["none","slide"]}},args:{theme:"light",variant:"primary",size:"base",children:"Button",asChild:!1,disabled:!1,loading:!1,hoverEffect:"none"}};var p=r;const d={args:{size:"lg",children:"Primary"}},g={args:{size:"lg",variant:"secondary",children:"Secondary"}},y={args:{size:"lg",variant:"link",children:"Link"}},h={args:{size:"lg",children:e(s,{children:["WithIcon ",t(o,{className:"ml-2"})]})}},m={args:{size:"lg",loading:!0}},f={args:{size:"lg",asChild:!0,children:t("a",{href:"http://example.com",children:"as a a tag"})}},v={args:{size:"lg",loading:!0,spinner:e("div",{className:"flex animate-pulse flex-row font-bold text-neutral-900",children:[t("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"2625",width:"1rem",className:"align-middle",children:t("path",{d:"M511.882596 287.998081h-0.361244a31.998984 31.998984 0 0 1-31.659415-31.977309v-0.361244c0-0.104761 0.115598-11.722364 0.115598-63.658399V96.000564a31.998984 31.998984 0 1 1 64.001581 0V192.001129c0 52.586273-0.111986 63.88237-0.119211 64.337537a32.002596 32.002596 0 0 1-31.977309 31.659415zM511.998194 959.99842a31.998984 31.998984 0 0 1-31.998984-31.998984v-96.379871c0-51.610915-0.111986-63.174332-0.115598-63.286318s0-0.242033 0-0.361243a31.998984 31.998984 0 0 1 63.997968-0.314283c0 0.455167 0.11921 11.711527 0.11921 64.034093v96.307622a31.998984 31.998984 0 0 1-32.002596 31.998984zM330.899406 363.021212a31.897836 31.897836 0 0 1-22.866739-9.612699c-0.075861-0.075861-8.207461-8.370021-44.931515-45.094076L195.198137 240.429485a31.998984 31.998984 0 0 1 45.256635-45.253022L308.336112 263.057803c37.182834 37.182834 45.090463 45.253022 45.41197 45.578141A31.998984 31.998984 0 0 1 330.899406 363.021212zM806.137421 838.11473a31.901448 31.901448 0 0 1-22.628318-9.374279L715.624151 760.859111c-36.724054-36.724054-45.018214-44.859267-45.097687-44.93874a31.998984 31.998984 0 0 1 44.77618-45.729864c0.32512 0.317895 8.395308 8.229136 45.578142 45.411969l67.88134 67.88134a31.998984 31.998984 0 0 1-22.624705 54.630914zM224.000113 838.11473a31.901448 31.901448 0 0 0 22.628317-9.374279l67.88134-67.88134c36.724054-36.724054 45.021826-44.859267 45.097688-44.93874a31.998984 31.998984 0 0 0-44.776181-45.729864c-0.32512 0.317895-8.395308 8.229136-45.578142 45.411969l-67.88134 67.884953a31.998984 31.998984 0 0 0 22.628318 54.627301zM255.948523 544.058589h-0.361244c-0.104761 0-11.722364-0.115598-63.658399-0.115598H95.942765a31.998984 31.998984 0 1 1 0-64.00158h95.996952c52.586273 0 63.88237 0.111986 64.337538 0.11921a31.998984 31.998984 0 0 1 31.659414 31.97731v0.361244a32.002596 32.002596 0 0 1-31.988146 31.659414zM767.939492 544.058589a32.002596 32.002596 0 0 1-31.995372-31.666639v-0.361244a31.998984 31.998984 0 0 1 31.659415-31.970085c0.455167 0 11.754876-0.11921 64.34115-0.11921h96.000564a31.998984 31.998984 0 0 1 0 64.00158H831.944685c-51.936034 0-63.553638 0.111986-63.665624 0.115598h-0.335957zM692.999446 363.0176a31.998984 31.998984 0 0 1-22.863126-54.381656c0.317895-0.32512 8.229136-8.395308 45.41197-45.578141l67.88134-67.884953A31.998984 31.998984 0 1 1 828.693489 240.429485l-67.892177 67.88134c-31.020013 31.023625-41.644196 41.759794-44.241539 44.393262l-0.697201 0.722488a31.908673 31.908673 0 0 1-22.863126 9.591025z",fill:"","p-id":"2626"})}),"\xA0loading..."]})}};export{f as Aschild,y as Link,m as Loading,d as Primary,g as Secondary,v as Spinner,h as WithIcon,p as default};
|
|
2
2
|
//# sourceMappingURL=button.stories.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/stories/button.stories.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\nimport { SearchIcon } from '@storybook/icons'\n\nimport { Button } from '../components/index.js'\nimport React from 'react'\n\n// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export\nconst meta = {\n // \u540C\u65F6\u5B9A\u4E49\u4E86\u9875\u9762\u5DE6\u4FA7\u83DC\u5355\n title: 'Components/Button',\n component: Button,\n parameters: {\n // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout\n layout: 'centered',\n docs: {\n description: {\n component: `\u6309\u94AE\u7EC4\u4EF6, \u5206\u4E3A\u591A\u79CD\u53D8\u4F53\u548C\u5927\u5C0F, \u652F\u6301 loading \u72B6\u6001\u548C\u56FE\u6807`\n }\n }\n },\n // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs\n tags: ['autodocs'],\n // More on argTypes: https://storybook.js.org/docs/api/argtypes\n argTypes: {\n theme: {\n control: {\n type: 'select',\n },\n options: ['dark', 'light'],\n description: '\u4E3B\u9898, \u9ED8\u8BA4\u662F light',\n },\n variant: {\n control: {\n type: 'select',\n },\n options: ['
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Fragment", "jsx", "jsxs", "SearchIcon", "Button", "meta", "button_stories_default", "
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\nimport { SearchIcon } from '@storybook/icons'\n\nimport { Button } from '../components/index.js'\nimport React from 'react'\n\n// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export\nconst meta = {\n // \u540C\u65F6\u5B9A\u4E49\u4E86\u9875\u9762\u5DE6\u4FA7\u83DC\u5355\n title: 'Components/Button',\n component: Button,\n parameters: {\n // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout\n layout: 'centered',\n docs: {\n description: {\n component: `\u6309\u94AE\u7EC4\u4EF6, \u5206\u4E3A\u591A\u79CD\u53D8\u4F53\u548C\u5927\u5C0F, \u652F\u6301 loading \u72B6\u6001\u548C\u56FE\u6807`\n }\n }\n },\n // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs\n tags: ['autodocs'],\n // More on argTypes: https://storybook.js.org/docs/api/argtypes\n argTypes: {\n theme: {\n control: {\n type: 'select',\n },\n options: ['dark', 'light'],\n description: '\u4E3B\u9898, \u9ED8\u8BA4\u662F light',\n },\n variant: {\n control: {\n type: 'select',\n },\n options: ['primary', 'secondary', 'link', 'ghost'],\n description: '\u6309\u94AE\u7C7B\u578B, \u63A8\u8350\u4F7F\u7528 primary \u548C secondary\uFF0C link ; ghost \u5C06\u4F1A\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 secondary\uFF0C \u4EE3\u66FF',\n },\n size: {\n control: {\n type: 'select',\n },\n options: ['sm', 'base', 'lg', 'icon'],\n description: '\u6309\u94AE\u5927\u5C0F \u9ED8\u8BA4\u662F base, \u53EF\u9009\u503C: sm, base, lg, icon',\n },\n hoverEffect: {\n description: 'hover \u72B6\u6001\u4E0B\u7684\u52A8\u753B\u6548\u679C\uFF0C\u4EC5\u5728variant\u662Fprimary \u548C secondary \u65F6\u751F\u6548',\n control: {\n type: 'select',\n },\n options: ['none', 'slide'],\n },\n },\n args: {\n theme: 'light',\n variant: 'primary',\n size: 'base',\n children: 'Button',\n asChild: false,\n disabled: false,\n loading: false,\n hoverEffect: 'none',\n },\n} satisfies Meta<typeof Button>\n\nexport default meta\ntype Story = StoryObj<typeof meta>\n\n// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args\n// args \u4F1A\u4F5C\u4E3A props \u4F20\u9012\u7ED9\u7EC4\u4EF6\n// Story\u7684\u540D\u4F1A\u4F5C\u4E3A\u83DC\u5355\u7684\u540D\u79F0 \u81EA\u52A8\u9996\u5B57\u6BCD\u5927\u5199\u5E76\u6309\u7167\u5927\u5199\u5B57\u6BCD\u62C6\u5206 UseAsButton => Use As Button\n\nexport const Primary: Story = {\n args: {\n size: 'lg',\n children: 'Primary',\n },\n}\n\nexport const Secondary: Story = {\n args: {\n size: 'lg',\n variant: 'secondary',\n children: 'Secondary',\n },\n}\n\nexport const Link: Story = {\n args: {\n size: 'lg',\n variant: 'link',\n children: 'Link',\n },\n}\n\nexport const WithIcon: Story = {\n args: {\n size: 'lg',\n children: (\n <>\n WithIcon <SearchIcon className=\"ml-2\" />\n </>\n ),\n },\n}\n\nexport const Loading: Story = {\n args: {\n size: 'lg',\n loading: true,\n },\n}\n\nexport const Aschild: Story = {\n args: {\n size: 'lg',\n asChild: true,\n children: <a href=\"http://example.com\">as a a tag</a>,\n },\n}\n\nexport const Spinner: Story = {\n args: {\n size: 'lg',\n loading: true,\n spinner: (\n <div className=\"flex animate-pulse flex-row font-bold text-neutral-900\">\n <svg\n viewBox=\"0 0 1024 1024\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n p-id=\"2625\"\n width=\"1rem\"\n className=\"align-middle\"\n >\n <path\n d=\"M511.882596 287.998081h-0.361244a31.998984 31.998984 0 0 1-31.659415-31.977309v-0.361244c0-0.104761 0.115598-11.722364 0.115598-63.658399V96.000564a31.998984 31.998984 0 1 1 64.001581 0V192.001129c0 52.586273-0.111986 63.88237-0.119211 64.337537a32.002596 32.002596 0 0 1-31.977309 31.659415zM511.998194 959.99842a31.998984 31.998984 0 0 1-31.998984-31.998984v-96.379871c0-51.610915-0.111986-63.174332-0.115598-63.286318s0-0.242033 0-0.361243a31.998984 31.998984 0 0 1 63.997968-0.314283c0 0.455167 0.11921 11.711527 0.11921 64.034093v96.307622a31.998984 31.998984 0 0 1-32.002596 31.998984zM330.899406 363.021212a31.897836 31.897836 0 0 1-22.866739-9.612699c-0.075861-0.075861-8.207461-8.370021-44.931515-45.094076L195.198137 240.429485a31.998984 31.998984 0 0 1 45.256635-45.253022L308.336112 263.057803c37.182834 37.182834 45.090463 45.253022 45.41197 45.578141A31.998984 31.998984 0 0 1 330.899406 363.021212zM806.137421 838.11473a31.901448 31.901448 0 0 1-22.628318-9.374279L715.624151 760.859111c-36.724054-36.724054-45.018214-44.859267-45.097687-44.93874a31.998984 31.998984 0 0 1 44.77618-45.729864c0.32512 0.317895 8.395308 8.229136 45.578142 45.411969l67.88134 67.88134a31.998984 31.998984 0 0 1-22.624705 54.630914zM224.000113 838.11473a31.901448 31.901448 0 0 0 22.628317-9.374279l67.88134-67.88134c36.724054-36.724054 45.021826-44.859267 45.097688-44.93874a31.998984 31.998984 0 0 0-44.776181-45.729864c-0.32512 0.317895-8.395308 8.229136-45.578142 45.411969l-67.88134 67.884953a31.998984 31.998984 0 0 0 22.628318 54.627301zM255.948523 544.058589h-0.361244c-0.104761 0-11.722364-0.115598-63.658399-0.115598H95.942765a31.998984 31.998984 0 1 1 0-64.00158h95.996952c52.586273 0 63.88237 0.111986 64.337538 0.11921a31.998984 31.998984 0 0 1 31.659414 31.97731v0.361244a32.002596 32.002596 0 0 1-31.988146 31.659414zM767.939492 544.058589a32.002596 32.002596 0 0 1-31.995372-31.666639v-0.361244a31.998984 31.998984 0 0 1 31.659415-31.970085c0.455167 0 11.754876-0.11921 64.34115-0.11921h96.000564a31.998984 31.998984 0 0 1 0 64.00158H831.944685c-51.936034 0-63.553638 0.111986-63.665624 0.115598h-0.335957zM692.999446 363.0176a31.998984 31.998984 0 0 1-22.863126-54.381656c0.317895-0.32512 8.229136-8.395308 45.41197-45.578141l67.88134-67.884953A31.998984 31.998984 0 1 1 828.693489 240.429485l-67.892177 67.88134c-31.020013 31.023625-41.644196 41.759794-44.241539 44.393262l-0.697201 0.722488a31.908673 31.908673 0 0 1-22.863126 9.591025z\"\n fill=\"\"\n p-id=\"2626\"\n ></path>\n </svg>\n loading...\n </div>\n ),\n },\n}\n"],
|
|
5
|
+
"mappings": "AAmGM,mBAAAA,EACW,OAAAC,EADX,QAAAC,MAAA,oBAlGN,OAAS,cAAAC,MAAkB,mBAE3B,OAAS,UAAAC,MAAc,yBACvB,MAAkB,QAGlB,MAAMC,EAAO,CAEX,MAAO,oBACP,UAAWD,EACX,WAAY,CAEV,OAAQ,WACR,KAAM,CACJ,YAAa,CACX,UAAW,uIACb,CACF,CACF,EAEA,KAAM,CAAC,UAAU,EAEjB,SAAU,CACR,MAAO,CACL,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,OAAQ,OAAO,EACzB,YAAa,wCACf,EACA,QAAS,CACP,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,UAAW,YAAa,OAAQ,OAAO,EACjD,YAAa,8KACf,EACA,KAAM,CACJ,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,KAAM,OAAQ,KAAM,MAAM,EACpC,YAAa,0FACf,EACA,YAAa,CACX,YAAa,mIACb,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,OAAQ,OAAO,CAC3B,CACF,EACA,KAAM,CACJ,MAAO,QACP,QAAS,UACT,KAAM,OACN,SAAU,SACV,QAAS,GACT,SAAU,GACV,QAAS,GACT,YAAa,MACf,CACF,EAEA,IAAOE,EAAQD,EAOR,MAAME,EAAiB,CAC5B,KAAM,CACJ,KAAM,KACN,SAAU,SACZ,CACF,EAEaC,EAAmB,CAC9B,KAAM,CACJ,KAAM,KACN,QAAS,YACT,SAAU,WACZ,CACF,EAEaC,EAAc,CACzB,KAAM,CACJ,KAAM,KACN,QAAS,OACT,SAAU,MACZ,CACF,EAEaC,EAAkB,CAC7B,KAAM,CACJ,KAAM,KACN,SACER,EAAAF,EAAA,CAAE,sBACSC,EAACE,EAAA,CAAW,UAAU,OAAO,GACxC,CAEJ,CACF,EAEaQ,EAAiB,CAC5B,KAAM,CACJ,KAAM,KACN,QAAS,EACX,CACF,EAEaC,EAAiB,CAC5B,KAAM,CACJ,KAAM,KACN,QAAS,GACT,SAAUX,EAAC,KAAE,KAAK,qBAAqB,sBAAU,CACnD,CACF,EAEaY,EAAiB,CAC5B,KAAM,CACJ,KAAM,KACN,QAAS,GACT,QACEX,EAAC,OAAI,UAAU,yDACb,UAAAD,EAAC,OACC,QAAQ,gBACR,QAAQ,MACR,MAAM,6BACN,OAAK,OACL,MAAM,OACN,UAAU,eAEV,SAAAA,EAAC,QACC,EAAE,o5EACF,KAAK,GACL,OAAK,OACN,EACH,EAAM,kBAER,CAEJ,CACF",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "SearchIcon", "Button", "meta", "button_stories_default", "Primary", "Secondary", "Link", "WithIcon", "Loading", "Aschild", "Spinner"]
|
|
7
7
|
}
|
package/package.json
CHANGED
package/style.css
CHANGED
|
@@ -951,12 +951,21 @@ video {
|
|
|
951
951
|
.\!border-none {
|
|
952
952
|
border-style: none !important;
|
|
953
953
|
}
|
|
954
|
+
.border-none {
|
|
955
|
+
border-style: none;
|
|
956
|
+
}
|
|
957
|
+
.border-brand-0 {
|
|
958
|
+
border-color: var(--brand-color-0);
|
|
959
|
+
}
|
|
954
960
|
.border-btn-primary {
|
|
955
|
-
border-color: var(--
|
|
961
|
+
border-color: var(--info-primary-color);
|
|
956
962
|
}
|
|
957
963
|
.border-info-primary {
|
|
958
964
|
border-color: var(--info-primary-color);
|
|
959
965
|
}
|
|
966
|
+
.border-info-white {
|
|
967
|
+
border-color: var(--info-white-color);
|
|
968
|
+
}
|
|
960
969
|
.border-lines-1 {
|
|
961
970
|
border-color: var(--line-color-1);
|
|
962
971
|
}
|
|
@@ -970,7 +979,7 @@ video {
|
|
|
970
979
|
border-color: var(--dark-error-color-0);
|
|
971
980
|
}
|
|
972
981
|
.border-primary {
|
|
973
|
-
border-color: var(--brand-color-
|
|
982
|
+
border-color: var(--brand-color-0);
|
|
974
983
|
}
|
|
975
984
|
.border-b-brand-0 {
|
|
976
985
|
border-bottom-color: var(--brand-color-0);
|
|
@@ -1008,7 +1017,10 @@ video {
|
|
|
1008
1017
|
background-color: var(--brand-color-1);
|
|
1009
1018
|
}
|
|
1010
1019
|
.bg-btn-primary {
|
|
1011
|
-
background-color: var(--
|
|
1020
|
+
background-color: var(--info-primary-color);
|
|
1021
|
+
}
|
|
1022
|
+
.bg-btn-primary-active {
|
|
1023
|
+
background-color: var(--brand-color-0);
|
|
1012
1024
|
}
|
|
1013
1025
|
.bg-btn-secondary {
|
|
1014
1026
|
background-color: var(--btn-bg-secondary-color);
|
|
@@ -1147,7 +1159,7 @@ video {
|
|
|
1147
1159
|
stroke: var(--btn-text-secondary-color);
|
|
1148
1160
|
}
|
|
1149
1161
|
.stroke-primary {
|
|
1150
|
-
stroke: var(--brand-color-
|
|
1162
|
+
stroke: var(--brand-color-0);
|
|
1151
1163
|
}
|
|
1152
1164
|
.p-1 {
|
|
1153
1165
|
padding: 0.25rem;
|
|
@@ -1363,7 +1375,7 @@ video {
|
|
|
1363
1375
|
color: rgb(134 134 140 / var(--tw-text-opacity, 1));
|
|
1364
1376
|
}
|
|
1365
1377
|
.text-btn-primary {
|
|
1366
|
-
color: var(--
|
|
1378
|
+
color: var(--info-primary-color);
|
|
1367
1379
|
}
|
|
1368
1380
|
.text-btn-primary-foreground {
|
|
1369
1381
|
color: var(--btn-text-color);
|
|
@@ -1396,7 +1408,7 @@ video {
|
|
|
1396
1408
|
color: var(--dark-error-color-0);
|
|
1397
1409
|
}
|
|
1398
1410
|
.text-primary {
|
|
1399
|
-
color: var(--brand-color-
|
|
1411
|
+
color: var(--brand-color-0);
|
|
1400
1412
|
}
|
|
1401
1413
|
.underline {
|
|
1402
1414
|
text-decoration-line: underline;
|
|
@@ -1506,11 +1518,11 @@ video {
|
|
|
1506
1518
|
}
|
|
1507
1519
|
.before\:bg-btn-primary-active::before {
|
|
1508
1520
|
content: var(--tw-content);
|
|
1509
|
-
background-color: var(--
|
|
1521
|
+
background-color: var(--brand-color-0);
|
|
1510
1522
|
}
|
|
1511
1523
|
.before\:bg-btn-secondary-active::before {
|
|
1512
1524
|
content: var(--tw-content);
|
|
1513
|
-
background-color: var(--
|
|
1525
|
+
background-color: var(--info-primary-color);
|
|
1514
1526
|
}
|
|
1515
1527
|
.before\:transition-transform::before {
|
|
1516
1528
|
content: var(--tw-content);
|
|
@@ -1537,30 +1549,48 @@ video {
|
|
|
1537
1549
|
.empty\:block:empty {
|
|
1538
1550
|
display: block;
|
|
1539
1551
|
}
|
|
1552
|
+
.hover\:border-brand-0:hover {
|
|
1553
|
+
border-color: var(--brand-color-0);
|
|
1554
|
+
}
|
|
1555
|
+
.hover\:border-info-white:hover {
|
|
1556
|
+
border-color: var(--info-white-color);
|
|
1557
|
+
}
|
|
1540
1558
|
.hover\:\!bg-btn-primary:hover {
|
|
1541
|
-
background-color: var(--
|
|
1559
|
+
background-color: var(--info-primary-color) !important;
|
|
1542
1560
|
}
|
|
1543
1561
|
.hover\:\!bg-btn-secondary:hover {
|
|
1544
1562
|
background-color: var(--btn-bg-secondary-color) !important;
|
|
1545
1563
|
}
|
|
1546
1564
|
.hover\:bg-btn-primary:hover {
|
|
1547
|
-
background-color: var(--
|
|
1565
|
+
background-color: var(--info-primary-color);
|
|
1548
1566
|
}
|
|
1549
1567
|
.hover\:bg-btn-primary-active:hover {
|
|
1550
|
-
background-color: var(--
|
|
1568
|
+
background-color: var(--brand-color-0);
|
|
1551
1569
|
}
|
|
1552
1570
|
.hover\:bg-btn-secondary-active:hover {
|
|
1553
|
-
background-color: var(--
|
|
1571
|
+
background-color: var(--info-primary-color);
|
|
1572
|
+
}
|
|
1573
|
+
.hover\:bg-info-white:hover {
|
|
1574
|
+
background-color: var(--info-white-color);
|
|
1554
1575
|
}
|
|
1555
1576
|
.hover\:text-brand-0:hover {
|
|
1556
1577
|
color: var(--brand-color-0);
|
|
1557
1578
|
}
|
|
1579
|
+
.hover\:text-btn-primary-active:hover {
|
|
1580
|
+
color: var(--brand-color-0);
|
|
1581
|
+
}
|
|
1558
1582
|
.hover\:text-btn-primary-foreground:hover {
|
|
1559
1583
|
color: var(--btn-text-color);
|
|
1560
1584
|
}
|
|
1561
1585
|
.hover\:text-btn-secondary:hover {
|
|
1562
1586
|
color: var(--btn-bg-secondary-color);
|
|
1563
1587
|
}
|
|
1588
|
+
.hover\:text-info-primary:hover {
|
|
1589
|
+
color: var(--info-primary-color);
|
|
1590
|
+
}
|
|
1591
|
+
.hover\:text-info-white:hover {
|
|
1592
|
+
color: var(--info-white-color);
|
|
1593
|
+
}
|
|
1564
1594
|
.hover\:underline:hover {
|
|
1565
1595
|
text-decoration-line: underline;
|
|
1566
1596
|
}
|
|
@@ -1602,20 +1632,29 @@ video {
|
|
|
1602
1632
|
.disabled\:cursor-not-allowed:disabled {
|
|
1603
1633
|
cursor: not-allowed;
|
|
1604
1634
|
}
|
|
1635
|
+
.disabled\:border-btn-secondary-disabled-border:disabled {
|
|
1636
|
+
border-color: var(--info-quaternary-color);
|
|
1637
|
+
}
|
|
1605
1638
|
.disabled\:bg-btn-primary-disabled:disabled {
|
|
1606
|
-
background-color: var(--
|
|
1639
|
+
background-color: var(--info-quaternary-color);
|
|
1607
1640
|
}
|
|
1608
1641
|
.disabled\:bg-btn-secondary-disabled:disabled {
|
|
1609
|
-
background-color: var(--
|
|
1642
|
+
background-color: var(--info-white-color);
|
|
1610
1643
|
}
|
|
1611
1644
|
.disabled\:text-btn-primary-disabled-foreground:disabled {
|
|
1612
|
-
color: var(--
|
|
1645
|
+
color: var(--info-white-color);
|
|
1613
1646
|
}
|
|
1614
1647
|
.disabled\:text-btn-secondary-disabled:disabled {
|
|
1615
|
-
color: var(--
|
|
1648
|
+
color: var(--info-white-color);
|
|
1616
1649
|
}
|
|
1617
1650
|
.disabled\:text-btn-secondary-disabled-foreground:disabled {
|
|
1618
|
-
color: var(--
|
|
1651
|
+
color: var(--info-quaternary-color);
|
|
1652
|
+
}
|
|
1653
|
+
.disabled\:text-info-quaternary:disabled {
|
|
1654
|
+
color: var(--info-quaternary-color);
|
|
1655
|
+
}
|
|
1656
|
+
.disabled\:text-info-white:disabled {
|
|
1657
|
+
color: var(--info-white-color);
|
|
1619
1658
|
}
|
|
1620
1659
|
.disabled\:opacity-50:disabled {
|
|
1621
1660
|
opacity: 0.5;
|
|
@@ -1642,7 +1681,7 @@ video {
|
|
|
1642
1681
|
border-bottom-width: 3px;
|
|
1643
1682
|
}
|
|
1644
1683
|
.data-\[state\=checked\]\:bg-primary[data-state="checked"] {
|
|
1645
|
-
background-color: var(--brand-color-
|
|
1684
|
+
background-color: var(--brand-color-0);
|
|
1646
1685
|
}
|
|
1647
1686
|
.data-\[inline-skeleton\=true\]\:leading-\[0\][data-inline-skeleton="true"] {
|
|
1648
1687
|
line-height: 0;
|