@axin666/ai-ui 0.1.9 → 0.1.12

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/README.md CHANGED
@@ -13,10 +13,10 @@
13
13
 
14
14
  ```bash
15
15
  # npm
16
- npm install ai-ui
16
+ npm install @axin666/ai-ui
17
17
 
18
18
  # pnpm
19
- pnpm add ai-ui
19
+ pnpm add @axin666/ai-ui
20
20
  ```
21
21
 
22
22
  ## 🔨 使用
@@ -25,8 +25,8 @@ pnpm add ai-ui
25
25
 
26
26
  ```ts
27
27
  import { createApp } from 'vue'
28
- import AiUI from '@ai-ui'
29
- import '@ai-ui/theme/index.scss'
28
+ import AiUI from '@axin666/ai-ui'
29
+ import '@axin666/ai-ui/dist/style.css'
30
30
  import App from './App.vue'
31
31
 
32
32
  const app = createApp(App)
@@ -39,13 +39,13 @@ app.mount('#app')
39
39
  ```vue
40
40
  <script setup lang="ts">
41
41
  // 从主入口引入组件
42
- import { AiButton, AiLoadingIcon } from '@ai-ui'
42
+ import { AiButton, AiLoadingIcon } from '@axin666/ai-ui'
43
43
 
44
44
  // 导入工具函数
45
- import { createBem } from '@ai-ui'
45
+ import { createBem } from '@axin666/ai-ui'
46
46
 
47
47
  // 导入 Hooks
48
- import { useEventListener } from '@ai-ui'
48
+ import { useEventListener } from '@axin666/ai-ui'
49
49
  </script>
50
50
 
51
51
  <template>
package/dist/ai-ui.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");function g(n){return function(t,s){if(t===void 0)return n;if(typeof t=="object")return y(n,t);const r=`${n}__${t}`;return s===void 0?r:typeof s=="string"?`${r}--${s}`:y(r,s)}}function y(n,o){const t=[n];for(const[s,r]of Object.entries(o))r&&t.push(`${n}--${s}`);return t.join(" ")}function b(n="ai"){return function(o){return g(`${n}-${o}`)}}const T=b("ai"),p=typeof window<"u";function j(n){return p?n in document.documentElement.style:!1}function W(n,o,t,s){return n.addEventListener(o,t,s),()=>n.removeEventListener(o,t,s)}function H(n){let o=n.parentElement;for(;o;){const{overflow:t,overflowX:s,overflowY:r}=getComputedStyle(o);if(/(auto|scroll|overlay)/.test(t+s+r))return o;o=o.parentElement}return window}function h(n){return n.getBoundingClientRect()}function U(n,o=0){const t=h(n),s=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth,l=t.top<=s*(1-o)&&t.bottom>=s*o,c=t.left<=r*(1-o)&&t.right>=r*o;return l&&c}function F(n){n.stopPropagation()}function G(n){n.preventDefault()}const k=e.defineComponent({name:"AiButton",__name:"AiButton",props:{type:{default:"default"},size:{default:"md"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},ghost:{type:Boolean,default:!1},block:{type:Boolean,default:!1},round:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},nativeType:{default:"button"},icon:{},iconRight:{},href:{},target:{}},emits:["click"],setup(n,{emit:o}){const t=n,s=o,r=e.useSlots(),l=g("ai-button"),c=e.computed(()=>!!t.href),d=e.computed(()=>{const a=l(),u=[a,`${a}--${t.type}`,`${a}--${t.size}`];return t.block&&u.push(`${a}--block`),t.ghost&&u.push(`${a}--ghost`),t.round&&u.push(`${a}--round`),t.circle&&u.push(`${a}--circle`),t.loading&&u.push(`${a}--loading`),t.disabled&&u.push(`${a}--disabled`),u}),m=a=>{if(t.disabled||t.loading){a.preventDefault(),a.stopPropagation();return}s("click",a)},f=a=>a?typeof a=="string"?a:e.h(a):null;return(a,u)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value?"a":"button"),{class:e.normalizeClass(d.value),href:c.value?n.href:void 0,target:c.value?n.target:void 0,type:c.value?void 0:n.nativeType,disabled:!c.value&&n.disabled,onClick:m},{default:e.withCtx(()=>[n.loading?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(l)("spinner"))},null,2)):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass(e.unref(l)("content"))},[e.unref(r).icon||n.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass([e.unref(l)("icon"),e.unref(l)("icon","left")])},[e.renderSlot(a.$slots,"icon",{},()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(f(n.icon))))])],2)):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass(e.unref(l)("text"))},[e.renderSlot(a.$slots,"default")],2),e.unref(r).iconRight||n.iconRight?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass([e.unref(l)("icon"),e.unref(l)("icon","right")])},[e.renderSlot(a.$slots,"iconRight",{},()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(f(n.iconRight))))])],2)):e.createCommentVNode("",!0)],2)]),_:3},8,["class","href","target","type","disabled"]))}}),q={class:"ai-loading-icon"},O=["width","height","stroke","stroke-width"],x=e.defineComponent({name:"AiLoadingIcon",__name:"AiLoadingIcon",props:{size:{default:"1em"},color:{default:"currentColor"},strokeWidth:{default:2}},setup(n){const o=n,t=e.computed(()=>typeof o.size=="number"?`${o.size}px`:o.size);return(s,r)=>(e.openBlock(),e.createElementBlock("span",q,[(e.openBlock(),e.createElementBlock("svg",{width:t.value,height:t.value,viewBox:"0 0 24 24",fill:"none",stroke:n.color,"stroke-width":n.strokeWidth,"stroke-linecap":"round","stroke-linejoin":"round"},[...r[0]||(r[0]=[e.createElementVNode("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"},null,-1)])],8,O))]))}}),X=[k,x];function Y(n){X.forEach(o=>{n.component(o.name,o)})}function J(n,o){if(!p)return;const t=s=>{const r=n.value;!r||r===s.target||r.contains(s.target)||o(s)};e.onMounted(()=>{document.addEventListener("click",t,!0)}),e.onUnmounted(()=>{document.removeEventListener("click",t,!0)})}function K(n,o,t,s){if(!p)return;let r;const l=d=>{d.addEventListener(o,t,s),r=()=>d.removeEventListener(o,t,s)},c=()=>{r==null||r(),r=void 0};e.isRef(n)?e.watch(n,(d,m,f)=>{d&&(l(d),f(c))},{immediate:!0}):e.onMounted(()=>l(n)),e.onUnmounted(c)}const v={primary:"#6366f1",primaryLight:"#818cf8",primaryDark:"#4f46e5",primaryBg:"#eef2ff"},C={success:"#10b981",successLight:"#34d399",successDark:"#059669",successBg:"#ecfdf5",warning:"#f59e0b",warningLight:"#fbbf24",warningDark:"#d97706",warningBg:"#fffbeb",error:"#ef4444",errorLight:"#f87171",errorDark:"#dc2626",errorBg:"#fef2f2",info:"#3b82f6",infoLight:"#60a5fa",infoDark:"#2563eb",infoBg:"#eff6ff"},i={white:"#ffffff",black:"#000000",gray50:"#f9fafb",gray100:"#f3f4f6",gray200:"#e5e7eb",gray300:"#d1d5db",gray400:"#9ca3af",gray500:"#6b7280",gray600:"#4b5563",gray700:"#374151",gray800:"#1f2937",gray900:"#111827"},w={primary:i.gray900,secondary:i.gray600,placeholder:i.gray400,disabled:i.gray300,inverse:i.white},B={page:i.gray50,container:i.white,elevated:i.white,disabled:i.gray100,mask:"rgba(0, 0, 0, 0.45)"},E={base:i.gray200,light:i.gray100,dark:i.gray300},S={brand:v,functional:C,neutral:i,text:w,bg:B,border:E},Q=4,L={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},$={buttonSm:{x:12,y:6},buttonMd:{x:16,y:8},buttonLg:{x:20,y:12},inputSm:{x:8,y:4},inputMd:{x:12,y:8},inputLg:{x:16,y:12},cardSm:12,cardMd:16,cardLg:24},N={none:0,xs:2,sm:4,md:6,lg:8,xl:12,"2xl":16,full:9999},z={none:"none",sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",base:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"},I={fast:"150ms ease",base:"200ms ease",slow:"300ms ease"},P={spacing:L,padding:$,radius:N,shadow:z,transition:I},R={sans:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",mono:"'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace"},A={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36},D={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},V={normal:400,medium:500,semibold:600,bold:700},M={fontFamily:R,fontSize:A,lineHeight:D,fontWeight:V},Z={...S,...P,...M};exports.AiButton=k;exports.AiLoadingIcon=x;exports.BASE_SPACING_UNIT=Q;exports.addEventListener=W;exports.bgColors=B;exports.borderColors=E;exports.borderRadius=N;exports.brandColors=v;exports.colorTokens=S;exports.componentPadding=$;exports.createBem=g;exports.createNamespace=b;exports.fontFamily=R;exports.fontSize=A;exports.fontWeight=V;exports.functionalColors=C;exports.getElementRect=h;exports.getScrollParent=H;exports.install=Y;exports.isClient=p;exports.isCssPropertySupported=j;exports.isElementInViewport=U;exports.lineHeight=D;exports.neutralColors=i;exports.preventDefault=G;exports.shadows=z;exports.spacingScale=L;exports.spacingTokens=P;exports.stopPropagation=F;exports.textColors=w;exports.tokens=Z;exports.transitions=I;exports.typographyTokens=M;exports.useClickOutside=J;exports.useEventListener=K;exports.useNamespace=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");function h(t){return function(n,r){if(n===void 0)return t;if(typeof n=="object")return B(t,n);const l=`${t}__${n}`;return r===void 0?l:typeof r=="string"?`${l}--${r}`:B(l,r)}}function B(t,o){const n=[t];for(const[r,l]of Object.entries(o))l&&n.push(`${t}--${r}`);return n.join(" ")}function w(t="ai"){return function(o){return h(`${t}-${o}`)}}const Q=w("ai"),k=typeof window<"u";function Z(t){return k?t in document.documentElement.style:!1}function ee(t,o,n,r){return t.addEventListener(o,n,r),()=>t.removeEventListener(o,n,r)}function te(t){let o=t.parentElement;for(;o;){const{overflow:n,overflowX:r,overflowY:l}=getComputedStyle(o);if(/(auto|scroll|overlay)/.test(n+r+l))return o;o=o.parentElement}return window}function E(t){return t.getBoundingClientRect()}function ne(t,o=0){const n=E(t),r=window.innerHeight||document.documentElement.clientHeight,l=window.innerWidth||document.documentElement.clientWidth,i=n.top<=r*(1-o)&&n.bottom>=r*o,c=n.left<=l*(1-o)&&n.right>=l*o;return i&&c}function oe(t){t.stopPropagation()}function se(t){t.preventDefault()}const x=e.defineComponent({name:"AiButton",__name:"AiButton",props:{type:{default:"default"},size:{default:"md"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},ghost:{type:Boolean,default:!1},block:{type:Boolean,default:!1},round:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},nativeType:{default:"button"},icon:{},iconRight:{},href:{},target:{}},emits:["click"],setup(t,{emit:o}){const n=t,r=o,l=e.useSlots(),i=h("ai-button"),c=e.computed(()=>!!n.href),u=e.computed(()=>{const a=i(),f=[a,`${a}--${n.type}`,`${a}--${n.size}`];return n.block&&f.push(`${a}--block`),n.ghost&&f.push(`${a}--ghost`),n.round&&f.push(`${a}--round`),n.circle&&f.push(`${a}--circle`),n.loading&&f.push(`${a}--loading`),n.disabled&&f.push(`${a}--disabled`),f}),g=a=>{if(n.disabled||n.loading){a.preventDefault(),a.stopPropagation();return}r("click",a)},m=a=>a?typeof a=="string"?a:e.h(a):null;return(a,f)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value?"a":"button"),{class:e.normalizeClass(u.value),href:c.value?t.href:void 0,target:c.value?t.target:void 0,type:c.value?void 0:t.nativeType,disabled:!c.value&&t.disabled,onClick:g},{default:e.withCtx(()=>[t.loading?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(i)("spinner"))},null,2)):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass(e.unref(i)("content"))},[e.unref(l).icon||t.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass([e.unref(i)("icon"),e.unref(i)("icon","left")])},[e.renderSlot(a.$slots,"icon",{},()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m(t.icon))))])],2)):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass(e.unref(i)("text"))},[e.renderSlot(a.$slots,"default")],2),e.unref(l).iconRight||t.iconRight?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass([e.unref(i)("icon"),e.unref(i)("icon","right")])},[e.renderSlot(a.$slots,"iconRight",{},()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m(t.iconRight))))])],2)):e.createCommentVNode("",!0)],2)]),_:3},8,["class","href","target","type","disabled"]))}}),le={class:"ai-loading-icon"},re=["width","height","stroke","stroke-width"],z=e.defineComponent({name:"AiLoadingIcon",__name:"AiLoadingIcon",props:{size:{default:"1em"},color:{default:"currentColor"},strokeWidth:{default:2}},setup(t){const o=t,n=e.computed(()=>typeof o.size=="number"?`${o.size}px`:o.size);return(r,l)=>(e.openBlock(),e.createElementBlock("span",le,[(e.openBlock(),e.createElementBlock("svg",{width:n.value,height:n.value,viewBox:"0 0 24 24",fill:"none",stroke:t.color,"stroke-width":t.strokeWidth,"stroke-linecap":"round","stroke-linejoin":"round"},[...l[0]||(l[0]=[e.createElementVNode("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"},null,-1)])],8,re))]))}}),ae={class:"ai-icon"},ie=["width","height","fill"],b=e.defineComponent({name:"AiCloseCircleIcon",__name:"AiCloseCircleIcon",props:{size:{default:"1em"},color:{default:"currentColor"},strokeWidth:{}},setup(t){const o=t,n=e.computed(()=>typeof o.size=="number"?`${o.size}px`:o.size);return(r,l)=>(e.openBlock(),e.createElementBlock("span",ae,[(e.openBlock(),e.createElementBlock("svg",{viewBox:"0 0 1024 1024",width:n.value,height:n.value,fill:t.color},[...l[0]||(l[0]=[e.createElementVNode("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-47.4 47.4L512 611.4l-118 118.2-47.4-47.4L464.6 564l-118.2-118 47.4-47.4L512 516.6l118-118.2 47.4 47.4L559.4 564l118 118.2z"},null,-1)])],8,ie))]))}}),ce={class:"ai-icon"},ue=["width","height","fill"],v=e.defineComponent({name:"AiEyeIcon",__name:"AiEyeIcon",props:{size:{default:"1em"},color:{default:"currentColor"},strokeWidth:{}},setup(t){const o=t,n=e.computed(()=>typeof o.size=="number"?`${o.size}px`:o.size);return(r,l)=>(e.openBlock(),e.createElementBlock("span",ce,[(e.openBlock(),e.createElementBlock("svg",{viewBox:"0 0 1024 1024",width:n.value,height:n.value,fill:t.color},[...l[0]||(l[0]=[e.createElementVNode("path",{d:"M942.2 486.2C847.4 286.6 704.1 186 512 186c-192.2 0-335.4 100.6-430.2 300.2-9.6 20.2-9.6 43.5 0 63.7C176.6 749.4 319.9 850 512 850c192.2 0 335.4-100.6 430.2-300.2 9.6-20.2 9.6-43.5 0-63.6zM512 774c-158.4 0-281.4-82.6-365.1-262 83.7-179.4 206.7-262 365.1-262 158.4 0 281.4 82.6 365.1 262-83.7 179.4-206.7 262-365.1 262z"},null,-1),e.createElementVNode("path",{d:"M512 354c-87.3 0-158 70.7-158 158s70.7 158 158 158 158-70.7 158-158-70.7-158-158-158zm0 240c-45.3 0-82-36.7-82-82s36.7-82 82-82 82 36.7 82 82-36.7 82-82 82z"},null,-1)])],8,ue))]))}}),de={class:"ai-icon"},pe=["width","height","fill"],C=e.defineComponent({name:"AiEyeInvisibleIcon",__name:"AiEyeInvisibleIcon",props:{size:{default:"1em"},color:{default:"currentColor"},strokeWidth:{}},setup(t){const o=t,n=e.computed(()=>typeof o.size=="number"?`${o.size}px`:o.size);return(r,l)=>(e.openBlock(),e.createElementBlock("span",de,[(e.openBlock(),e.createElementBlock("svg",{viewBox:"0 0 1024 1024",width:n.value,height:n.value,fill:t.color},[...l[0]||(l[0]=[e.createElementVNode("path",{d:"M512 354c-87.3 0-158 70.7-158 158 0 23.6 5.2 46 14.4 66.1l40.3-40.3c-1.7-8.1-2.7-16.4-2.7-25.1 0-45.3 36.7-82 82-82 8.7 0 17 1 25.1 2.7l40.3-40.3c-20.1-9.2-42.5-14.4-66.1-14.4zM471.7 667.3c20.1 9.2 42.5 14.4 66.1 14.4 87.3 0 158-70.7 158-158 0-23.6-5.2-46-14.4-66.1l-40.3 40.3c1.7 8.1 2.7 16.4 2.7 25.1 0 45.3-36.7 82-82 82-8.7 0-17-1-25.1-2.7l-40.3 40.3zM942.2 486.2C847.4 286.6 704.1 186 512 186c-19.1 0-37.8 1-56.1 3l74.1 74.1C523.3 261 517.7 261 512 261c-158.4 0-281.4 82.6-365.1 262 3.1 6.6 6.3 13.2 9.8 19.7l-64.4 64.4c-6.7-13.8-12.8-27.9-18.4-42.4-9.6-20.2-9.6-43.5 0-63.7C176.6 300.6 319.9 200 512 200c30.2 0 59.3 2.5 87.2 7.3l-56.9 56.9zM662.6 662.6L169.1 169.1c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l100.3 100.3C185.3 363.3 151.2 421.4 121.8 486.2c-9.6 20.2-9.6 43.5 0 63.7C216.6 749.4 359.9 850 552 850c45.3 0 88.6-5.6 128.9-16.1l111.9 111.9c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L662.6 662.6zM552 774c-158.4 0-281.4-82.6-365.1-262 14.8-31.7 32.8-60.6 53.6-86.3l371.4 371.4C592.1 768.1 572.4 774 552 774z"},null,-1)])],8,pe))]))}}),fe={modelValue:{type:[String,Number],default:""},type:{type:String,default:"text"},size:{type:String,default:"md"},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},form:{type:String},autocomplete:{type:String,default:"off"}},me={"update:modelValue":t=>typeof t=="string"||typeof t=="number",input:t=>typeof t=="string"||typeof t=="number",change:t=>typeof t=="string"||typeof t=="number",focus:t=>t instanceof FocusEvent,blur:t=>t instanceof FocusEvent,clear:()=>!0},ge={key:0,class:"ai-input-group__prepend"},ye=["type","value","placeholder","disabled","readonly","form","autofocus","autocomplete"],he={key:1,class:"ai-input-group__append"},y=e.defineComponent({name:"AiInput",inheritAttrs:!1,__name:"AiInput",props:fe,emits:me,setup(t,{expose:o,emit:n}){const r=t,l=n,i=e.useSlots(),c=h("ai-input"),u=e.ref(null),g=e.ref(!1),m=e.ref(!1),a=e.computed(()=>r.modelValue===null||r.modelValue===void 0?"":String(r.modelValue)),f=e.computed(()=>r.type==="password"&&r.showPassword?m.value?"text":"password":r.type),U=e.computed(()=>{const s=c(),p=[s,`${s}--${r.size}`];return r.disabled&&p.push(`${s}--disabled`),(i.prepend||i.append)&&(p.push("ai-input-group"),i.prepend&&p.push("ai-input-group--prepend"),i.append&&p.push("ai-input-group--append")),p}),G=e.computed(()=>[c("wrapper"),g.value?"is-focus":""]),q=s=>{const{value:p}=s.target;l("update:modelValue",p),l("input",p)},O=s=>{const{value:p}=s.target;l("change",p)},X=s=>{g.value=!0,l("focus",s)},Y=s=>{g.value=!1,l("blur",s)},J=()=>{l("update:modelValue",""),l("input",""),l("change",""),l("clear"),e.nextTick(()=>{var s;(s=u.value)==null||s.focus()})},K=()=>{m.value=!m.value,e.nextTick(()=>{var s;(s=u.value)==null||s.focus()})};return o({input:u,focus:()=>{var s;return(s=u.value)==null?void 0:s.focus()},blur:()=>{var s;return(s=u.value)==null?void 0:s.blur()},select:()=>{var s;return(s=u.value)==null?void 0:s.select()}}),e.watch(()=>r.modelValue,()=>{}),(s,p)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({class:U.value},s.$attrs),[e.unref(i).prepend?(e.openBlock(),e.createElementBlock("div",ge,[e.renderSlot(s.$slots,"prepend")])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(G.value)},[e.unref(i).prefix?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(c)("prefix"))},[e.renderSlot(s.$slots,"prefix")],2)):e.createCommentVNode("",!0),e.createElementVNode("input",{ref_key:"inputRef",ref:u,class:e.normalizeClass(e.unref(c)("inner")),type:f.value,value:a.value,placeholder:s.placeholder,disabled:s.disabled,readonly:s.readonly,form:s.form,autofocus:s.autofocus,autocomplete:s.autocomplete,onInput:q,onChange:O,onFocus:X,onBlur:Y},null,42,ye),e.unref(i).suffix||s.clearable||s.showPassword?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(c)("suffix"))},[e.renderSlot(s.$slots,"suffix"),s.clearable&&a.value&&!s.disabled&&!s.readonly?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(c)("clear")),onMousedown:p[0]||(p[0]=e.withModifiers(()=>{},["prevent"])),onClick:J},[e.createVNode(e.unref(b))],34)):e.createCommentVNode("",!0),s.showPassword&&s.type==="password"&&!s.disabled?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(c)("password")),onClick:K},[m.value?(e.openBlock(),e.createBlock(e.unref(v),{key:0})):(e.openBlock(),e.createBlock(e.unref(C),{key:1}))],2)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)],2),e.unref(i).append?(e.openBlock(),e.createElementBlock("div",he,[e.renderSlot(s.$slots,"append")])):e.createCommentVNode("",!0)],16))}});y.install=t=>{t.component(y.name,y)};const ke=[x,y,z,b,v,C];function be(t){ke.forEach(o=>{t.component(o.name,o)})}function ve(t,o){if(!k)return;const n=r=>{const l=t.value;!l||l===r.target||l.contains(r.target)||o(r)};e.onMounted(()=>{document.addEventListener("click",n,!0)}),e.onUnmounted(()=>{document.removeEventListener("click",n,!0)})}function Ce(t,o,n,r){if(!k)return;let l;const i=u=>{u.addEventListener(o,n,r),l=()=>u.removeEventListener(o,n,r)},c=()=>{l==null||l(),l=void 0};e.isRef(t)?e.watch(t,(u,g,m)=>{u&&(i(u),m(c))},{immediate:!0}):e.onMounted(()=>i(t)),e.onUnmounted(c)}const $={primary:"#6366f1",primaryLight:"#818cf8",primaryDark:"#4f46e5",primaryBg:"#eef2ff"},S={success:"#10b981",successLight:"#34d399",successDark:"#059669",successBg:"#ecfdf5",warning:"#f59e0b",warningLight:"#fbbf24",warningDark:"#d97706",warningBg:"#fffbeb",error:"#ef4444",errorLight:"#f87171",errorDark:"#dc2626",errorBg:"#fef2f2",info:"#3b82f6",infoLight:"#60a5fa",infoDark:"#2563eb",infoBg:"#eff6ff"},d={white:"#ffffff",black:"#000000",gray50:"#f9fafb",gray100:"#f3f4f6",gray200:"#e5e7eb",gray300:"#d1d5db",gray400:"#9ca3af",gray500:"#6b7280",gray600:"#4b5563",gray700:"#374151",gray800:"#1f2937",gray900:"#111827"},V={primary:d.gray900,secondary:d.gray600,placeholder:d.gray400,disabled:d.gray300,inverse:d.white},I={page:d.gray50,container:d.white,elevated:d.white,disabled:d.gray100,mask:"rgba(0, 0, 0, 0.45)"},L={base:d.gray200,light:d.gray100,dark:d.gray300},N={brand:$,functional:S,neutral:d,text:V,bg:I,border:L},Be=4,A={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},M={buttonSm:{x:12,y:6},buttonMd:{x:16,y:8},buttonLg:{x:20,y:12},inputSm:{x:8,y:4},inputMd:{x:12,y:8},inputLg:{x:16,y:12},cardSm:12,cardMd:16,cardLg:24},P={none:0,xs:2,sm:4,md:6,lg:8,xl:12,"2xl":16,full:9999},R={none:"none",sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",base:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"},T={fast:"150ms ease",base:"200ms ease",slow:"300ms ease"},D={spacing:A,padding:M,radius:P,shadow:R,transition:T},_={sans:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",mono:"'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace"},F={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36},W={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},j={normal:400,medium:500,semibold:600,bold:700},H={fontFamily:_,fontSize:F,lineHeight:W,fontWeight:j},we={...N,...D,...H};exports.AiButton=x;exports.AiCloseCircleIcon=b;exports.AiEyeIcon=v;exports.AiEyeInvisibleIcon=C;exports.AiInput=y;exports.AiLoadingIcon=z;exports.BASE_SPACING_UNIT=Be;exports.addEventListener=ee;exports.bgColors=I;exports.borderColors=L;exports.borderRadius=P;exports.brandColors=$;exports.colorTokens=N;exports.componentPadding=M;exports.createBem=h;exports.createNamespace=w;exports.fontFamily=_;exports.fontSize=F;exports.fontWeight=j;exports.functionalColors=S;exports.getElementRect=E;exports.getScrollParent=te;exports.install=be;exports.isClient=k;exports.isCssPropertySupported=Z;exports.isElementInViewport=ne;exports.lineHeight=W;exports.neutralColors=d;exports.preventDefault=se;exports.shadows=R;exports.spacingScale=A;exports.spacingTokens=D;exports.stopPropagation=oe;exports.textColors=V;exports.tokens=we;exports.transitions=T;exports.typographyTokens=H;exports.useClickOutside=ve;exports.useEventListener=Ce;exports.useNamespace=Q;
package/dist/ai-ui.esm.js CHANGED
@@ -1,56 +1,56 @@
1
- import { defineComponent as $, useSlots as I, computed as v, createBlock as y, openBlock as d, resolveDynamicComponent as b, normalizeClass as g, withCtx as R, createElementBlock as p, createCommentVNode as h, createElementVNode as k, unref as c, renderSlot as x, h as A, onMounted as B, onUnmounted as E, isRef as z, watch as D } from "vue";
2
- function S(e) {
3
- return function(t, s) {
1
+ import { defineComponent as C, useSlots as V, computed as y, createBlock as $, openBlock as l, resolveDynamicComponent as B, normalizeClass as m, withCtx as Y, createElementBlock as d, createCommentVNode as v, createElementVNode as w, unref as u, renderSlot as x, h as q, ref as E, watch as M, mergeProps as J, withModifiers as K, createVNode as Q, nextTick as S, onMounted as P, onUnmounted as R, isRef as Z } from "vue";
2
+ function L(e) {
3
+ return function(t, a) {
4
4
  if (t === void 0)
5
5
  return e;
6
6
  if (typeof t == "object")
7
- return L(e, t);
8
- const o = `${e}__${t}`;
9
- return s === void 0 ? o : typeof s == "string" ? `${o}--${s}` : L(o, s);
7
+ return A(e, t);
8
+ const s = `${e}__${t}`;
9
+ return a === void 0 ? s : typeof a == "string" ? `${s}--${a}` : A(s, a);
10
10
  };
11
11
  }
12
- function L(e, n) {
12
+ function A(e, n) {
13
13
  const t = [e];
14
- for (const [s, o] of Object.entries(n))
15
- o && t.push(`${e}--${s}`);
14
+ for (const [a, s] of Object.entries(n))
15
+ s && t.push(`${e}--${a}`);
16
16
  return t.join(" ");
17
17
  }
18
- function M(e = "ai") {
18
+ function O(e = "ai") {
19
19
  return function(n) {
20
- return S(`${e}-${n}`);
20
+ return L(`${e}-${n}`);
21
21
  };
22
22
  }
23
- const re = M("ai"), w = typeof window < "u";
24
- function ie(e) {
25
- return w ? e in document.documentElement.style : !1;
23
+ const Re = O("ai"), I = typeof window < "u";
24
+ function Ne(e) {
25
+ return I ? e in document.documentElement.style : !1;
26
26
  }
27
- function ae(e, n, t, s) {
28
- return e.addEventListener(n, t, s), () => e.removeEventListener(n, t, s);
27
+ function De(e, n, t, a) {
28
+ return e.addEventListener(n, t, a), () => e.removeEventListener(n, t, a);
29
29
  }
30
- function le(e) {
30
+ function Fe(e) {
31
31
  let n = e.parentElement;
32
32
  for (; n; ) {
33
- const { overflow: t, overflowX: s, overflowY: o } = getComputedStyle(n);
34
- if (/(auto|scroll|overlay)/.test(t + s + o))
33
+ const { overflow: t, overflowX: a, overflowY: s } = getComputedStyle(n);
34
+ if (/(auto|scroll|overlay)/.test(t + a + s))
35
35
  return n;
36
36
  n = n.parentElement;
37
37
  }
38
38
  return window;
39
39
  }
40
- function N(e) {
40
+ function ee(e) {
41
41
  return e.getBoundingClientRect();
42
42
  }
43
- function ce(e, n = 0) {
44
- const t = N(e), s = window.innerHeight || document.documentElement.clientHeight, o = window.innerWidth || document.documentElement.clientWidth, i = t.top <= s * (1 - n) && t.bottom >= s * n, l = t.left <= o * (1 - n) && t.right >= o * n;
45
- return i && l;
43
+ function We(e, n = 0) {
44
+ const t = ee(e), a = window.innerHeight || document.documentElement.clientHeight, s = window.innerWidth || document.documentElement.clientWidth, r = t.top <= a * (1 - n) && t.bottom >= a * n, c = t.left <= s * (1 - n) && t.right >= s * n;
45
+ return r && c;
46
46
  }
47
- function ue(e) {
47
+ function _e(e) {
48
48
  e.stopPropagation();
49
49
  }
50
- function de(e) {
50
+ function Te(e) {
51
51
  e.preventDefault();
52
52
  }
53
- const P = /* @__PURE__ */ $({
53
+ const te = /* @__PURE__ */ C({
54
54
  name: "AiButton",
55
55
  __name: "AiButton",
56
56
  props: {
@@ -70,59 +70,59 @@ const P = /* @__PURE__ */ $({
70
70
  },
71
71
  emits: ["click"],
72
72
  setup(e, { emit: n }) {
73
- const t = e, s = n, o = I(), i = S("ai-button"), l = v(() => !!t.href), f = v(() => {
74
- const r = i(), u = [r, `${r}--${t.type}`, `${r}--${t.size}`];
75
- return t.block && u.push(`${r}--block`), t.ghost && u.push(`${r}--ghost`), t.round && u.push(`${r}--round`), t.circle && u.push(`${r}--circle`), t.loading && u.push(`${r}--loading`), t.disabled && u.push(`${r}--disabled`), u;
76
- }), C = (r) => {
73
+ const t = e, a = n, s = V(), r = L("ai-button"), c = y(() => !!t.href), p = y(() => {
74
+ const i = r(), h = [i, `${i}--${t.type}`, `${i}--${t.size}`];
75
+ return t.block && h.push(`${i}--block`), t.ghost && h.push(`${i}--ghost`), t.round && h.push(`${i}--round`), t.circle && h.push(`${i}--circle`), t.loading && h.push(`${i}--loading`), t.disabled && h.push(`${i}--disabled`), h;
76
+ }), k = (i) => {
77
77
  if (t.disabled || t.loading) {
78
- r.preventDefault(), r.stopPropagation();
78
+ i.preventDefault(), i.stopPropagation();
79
79
  return;
80
80
  }
81
- s("click", r);
82
- }, m = (r) => r ? typeof r == "string" ? r : A(r) : null;
83
- return (r, u) => (d(), y(b(l.value ? "a" : "button"), {
84
- class: g(f.value),
85
- href: l.value ? e.href : void 0,
86
- target: l.value ? e.target : void 0,
87
- type: l.value ? void 0 : e.nativeType,
88
- disabled: !l.value && e.disabled,
89
- onClick: C
81
+ a("click", i);
82
+ }, b = (i) => i ? typeof i == "string" ? i : q(i) : null;
83
+ return (i, h) => (l(), $(B(c.value ? "a" : "button"), {
84
+ class: m(p.value),
85
+ href: c.value ? e.href : void 0,
86
+ target: c.value ? e.target : void 0,
87
+ type: c.value ? void 0 : e.nativeType,
88
+ disabled: !c.value && e.disabled,
89
+ onClick: k
90
90
  }, {
91
- default: R(() => [
92
- e.loading ? (d(), p("span", {
91
+ default: Y(() => [
92
+ e.loading ? (l(), d("span", {
93
93
  key: 0,
94
- class: g(c(i)("spinner"))
95
- }, null, 2)) : h("", !0),
96
- k("span", {
97
- class: g(c(i)("content"))
94
+ class: m(u(r)("spinner"))
95
+ }, null, 2)) : v("", !0),
96
+ w("span", {
97
+ class: m(u(r)("content"))
98
98
  }, [
99
- c(o).icon || e.icon ? (d(), p("span", {
99
+ u(s).icon || e.icon ? (l(), d("span", {
100
100
  key: 0,
101
- class: g([c(i)("icon"), c(i)("icon", "left")])
101
+ class: m([u(r)("icon"), u(r)("icon", "left")])
102
102
  }, [
103
- x(r.$slots, "icon", {}, () => [
104
- (d(), y(b(m(e.icon))))
103
+ x(i.$slots, "icon", {}, () => [
104
+ (l(), $(B(b(e.icon))))
105
105
  ])
106
- ], 2)) : h("", !0),
107
- k("span", {
108
- class: g(c(i)("text"))
106
+ ], 2)) : v("", !0),
107
+ w("span", {
108
+ class: m(u(r)("text"))
109
109
  }, [
110
- x(r.$slots, "default")
110
+ x(i.$slots, "default")
111
111
  ], 2),
112
- c(o).iconRight || e.iconRight ? (d(), p("span", {
112
+ u(s).iconRight || e.iconRight ? (l(), d("span", {
113
113
  key: 1,
114
- class: g([c(i)("icon"), c(i)("icon", "right")])
114
+ class: m([u(r)("icon"), u(r)("icon", "right")])
115
115
  }, [
116
- x(r.$slots, "iconRight", {}, () => [
117
- (d(), y(b(m(e.iconRight))))
116
+ x(i.$slots, "iconRight", {}, () => [
117
+ (l(), $(B(b(e.iconRight))))
118
118
  ])
119
- ], 2)) : h("", !0)
119
+ ], 2)) : v("", !0)
120
120
  ], 2)
121
121
  ]),
122
122
  _: 3
123
123
  }, 8, ["class", "href", "target", "type", "disabled"]));
124
124
  }
125
- }), j = { class: "ai-loading-icon" }, V = ["width", "height", "stroke", "stroke-width"], W = /* @__PURE__ */ $({
125
+ }), ne = { class: "ai-loading-icon" }, oe = ["width", "height", "stroke", "stroke-width"], se = /* @__PURE__ */ C({
126
126
  name: "AiLoadingIcon",
127
127
  __name: "AiLoadingIcon",
128
128
  props: {
@@ -131,9 +131,9 @@ const P = /* @__PURE__ */ $({
131
131
  strokeWidth: { default: 2 }
132
132
  },
133
133
  setup(e) {
134
- const n = e, t = v(() => typeof n.size == "number" ? `${n.size}px` : n.size);
135
- return (s, o) => (d(), p("span", j, [
136
- (d(), p("svg", {
134
+ const n = e, t = y(() => typeof n.size == "number" ? `${n.size}px` : n.size);
135
+ return (a, s) => (l(), d("span", ne, [
136
+ (l(), d("svg", {
137
137
  width: t.value,
138
138
  height: t.value,
139
139
  viewBox: "0 0 24 24",
@@ -142,51 +142,329 @@ const P = /* @__PURE__ */ $({
142
142
  "stroke-width": e.strokeWidth,
143
143
  "stroke-linecap": "round",
144
144
  "stroke-linejoin": "round"
145
- }, [...o[0] || (o[0] = [
146
- k("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }, null, -1)
147
- ])], 8, V))
145
+ }, [...s[0] || (s[0] = [
146
+ w("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }, null, -1)
147
+ ])], 8, oe))
148
148
  ]));
149
149
  }
150
- }), H = [P, W];
151
- function fe(e) {
152
- H.forEach((n) => {
150
+ }), ae = { class: "ai-icon" }, ie = ["width", "height", "fill"], N = /* @__PURE__ */ C({
151
+ name: "AiCloseCircleIcon",
152
+ __name: "AiCloseCircleIcon",
153
+ props: {
154
+ size: { default: "1em" },
155
+ color: { default: "currentColor" },
156
+ strokeWidth: {}
157
+ },
158
+ setup(e) {
159
+ const n = e, t = y(() => typeof n.size == "number" ? `${n.size}px` : n.size);
160
+ return (a, s) => (l(), d("span", ae, [
161
+ (l(), d("svg", {
162
+ viewBox: "0 0 1024 1024",
163
+ width: t.value,
164
+ height: t.value,
165
+ fill: e.color
166
+ }, [...s[0] || (s[0] = [
167
+ w("path", { d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-47.4 47.4L512 611.4l-118 118.2-47.4-47.4L464.6 564l-118.2-118 47.4-47.4L512 516.6l118-118.2 47.4 47.4L559.4 564l118 118.2z" }, null, -1)
168
+ ])], 8, ie))
169
+ ]));
170
+ }
171
+ }), le = { class: "ai-icon" }, re = ["width", "height", "fill"], D = /* @__PURE__ */ C({
172
+ name: "AiEyeIcon",
173
+ __name: "AiEyeIcon",
174
+ props: {
175
+ size: { default: "1em" },
176
+ color: { default: "currentColor" },
177
+ strokeWidth: {}
178
+ },
179
+ setup(e) {
180
+ const n = e, t = y(() => typeof n.size == "number" ? `${n.size}px` : n.size);
181
+ return (a, s) => (l(), d("span", le, [
182
+ (l(), d("svg", {
183
+ viewBox: "0 0 1024 1024",
184
+ width: t.value,
185
+ height: t.value,
186
+ fill: e.color
187
+ }, [...s[0] || (s[0] = [
188
+ w("path", { d: "M942.2 486.2C847.4 286.6 704.1 186 512 186c-192.2 0-335.4 100.6-430.2 300.2-9.6 20.2-9.6 43.5 0 63.7C176.6 749.4 319.9 850 512 850c192.2 0 335.4-100.6 430.2-300.2 9.6-20.2 9.6-43.5 0-63.6zM512 774c-158.4 0-281.4-82.6-365.1-262 83.7-179.4 206.7-262 365.1-262 158.4 0 281.4 82.6 365.1 262-83.7 179.4-206.7 262-365.1 262z" }, null, -1),
189
+ w("path", { d: "M512 354c-87.3 0-158 70.7-158 158s70.7 158 158 158 158-70.7 158-158-70.7-158-158-158zm0 240c-45.3 0-82-36.7-82-82s36.7-82 82-82 82 36.7 82 82-36.7 82-82 82z" }, null, -1)
190
+ ])], 8, re))
191
+ ]));
192
+ }
193
+ }), ue = { class: "ai-icon" }, ce = ["width", "height", "fill"], F = /* @__PURE__ */ C({
194
+ name: "AiEyeInvisibleIcon",
195
+ __name: "AiEyeInvisibleIcon",
196
+ props: {
197
+ size: { default: "1em" },
198
+ color: { default: "currentColor" },
199
+ strokeWidth: {}
200
+ },
201
+ setup(e) {
202
+ const n = e, t = y(() => typeof n.size == "number" ? `${n.size}px` : n.size);
203
+ return (a, s) => (l(), d("span", ue, [
204
+ (l(), d("svg", {
205
+ viewBox: "0 0 1024 1024",
206
+ width: t.value,
207
+ height: t.value,
208
+ fill: e.color
209
+ }, [...s[0] || (s[0] = [
210
+ w("path", { d: "M512 354c-87.3 0-158 70.7-158 158 0 23.6 5.2 46 14.4 66.1l40.3-40.3c-1.7-8.1-2.7-16.4-2.7-25.1 0-45.3 36.7-82 82-82 8.7 0 17 1 25.1 2.7l40.3-40.3c-20.1-9.2-42.5-14.4-66.1-14.4zM471.7 667.3c20.1 9.2 42.5 14.4 66.1 14.4 87.3 0 158-70.7 158-158 0-23.6-5.2-46-14.4-66.1l-40.3 40.3c1.7 8.1 2.7 16.4 2.7 25.1 0 45.3-36.7 82-82 82-8.7 0-17-1-25.1-2.7l-40.3 40.3zM942.2 486.2C847.4 286.6 704.1 186 512 186c-19.1 0-37.8 1-56.1 3l74.1 74.1C523.3 261 517.7 261 512 261c-158.4 0-281.4 82.6-365.1 262 3.1 6.6 6.3 13.2 9.8 19.7l-64.4 64.4c-6.7-13.8-12.8-27.9-18.4-42.4-9.6-20.2-9.6-43.5 0-63.7C176.6 300.6 319.9 200 512 200c30.2 0 59.3 2.5 87.2 7.3l-56.9 56.9zM662.6 662.6L169.1 169.1c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l100.3 100.3C185.3 363.3 151.2 421.4 121.8 486.2c-9.6 20.2-9.6 43.5 0 63.7C216.6 749.4 359.9 850 552 850c45.3 0 88.6-5.6 128.9-16.1l111.9 111.9c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L662.6 662.6zM552 774c-158.4 0-281.4-82.6-365.1-262 14.8-31.7 32.8-60.6 53.6-86.3l371.4 371.4C592.1 768.1 572.4 774 552 774z" }, null, -1)
211
+ ])], 8, ce))
212
+ ]));
213
+ }
214
+ }), de = {
215
+ /**
216
+ * 绑定值
217
+ */
218
+ modelValue: {
219
+ type: [String, Number],
220
+ default: ""
221
+ },
222
+ /**
223
+ * 类型
224
+ */
225
+ type: {
226
+ type: String,
227
+ default: "text"
228
+ },
229
+ /**
230
+ * 尺寸
231
+ */
232
+ size: {
233
+ type: String,
234
+ default: "md"
235
+ },
236
+ /**
237
+ * 占位文本
238
+ */
239
+ placeholder: {
240
+ type: String,
241
+ default: ""
242
+ },
243
+ /**
244
+ * 是否禁用
245
+ */
246
+ disabled: {
247
+ type: Boolean,
248
+ default: !1
249
+ },
250
+ /**
251
+ * 是否可清空
252
+ */
253
+ clearable: {
254
+ type: Boolean,
255
+ default: !1
256
+ },
257
+ /**
258
+ * 是否显示密码切换图标
259
+ */
260
+ showPassword: {
261
+ type: Boolean,
262
+ default: !1
263
+ },
264
+ /**
265
+ * 是否只读
266
+ */
267
+ readonly: {
268
+ type: Boolean,
269
+ default: !1
270
+ },
271
+ /**
272
+ * 是否自动聚焦
273
+ */
274
+ autofocus: {
275
+ type: Boolean,
276
+ default: !1
277
+ },
278
+ /**
279
+ * 原生 form 属性
280
+ */
281
+ form: {
282
+ type: String
283
+ },
284
+ /**
285
+ * 原生 autocomplete 属性
286
+ */
287
+ autocomplete: {
288
+ type: String,
289
+ default: "off"
290
+ }
291
+ }, pe = {
292
+ "update:modelValue": (e) => typeof e == "string" || typeof e == "number",
293
+ input: (e) => typeof e == "string" || typeof e == "number",
294
+ change: (e) => typeof e == "string" || typeof e == "number",
295
+ focus: (e) => e instanceof FocusEvent,
296
+ blur: (e) => e instanceof FocusEvent,
297
+ clear: () => !0
298
+ }, fe = {
299
+ key: 0,
300
+ class: "ai-input-group__prepend"
301
+ }, ge = ["type", "value", "placeholder", "disabled", "readonly", "form", "autofocus", "autocomplete"], me = {
302
+ key: 1,
303
+ class: "ai-input-group__append"
304
+ }, z = /* @__PURE__ */ C({
305
+ name: "AiInput",
306
+ inheritAttrs: !1,
307
+ __name: "AiInput",
308
+ props: de,
309
+ emits: pe,
310
+ setup(e, { expose: n, emit: t }) {
311
+ const a = e, s = t, r = V(), c = L("ai-input"), p = E(null), k = E(!1), b = E(!1), i = y(
312
+ () => a.modelValue === null || a.modelValue === void 0 ? "" : String(a.modelValue)
313
+ ), h = y(() => a.type === "password" && a.showPassword ? b.value ? "text" : "password" : a.type), W = y(() => {
314
+ const o = c(), f = [o, `${o}--${a.size}`];
315
+ return a.disabled && f.push(`${o}--disabled`), (r.prepend || r.append) && (f.push("ai-input-group"), r.prepend && f.push("ai-input-group--prepend"), r.append && f.push("ai-input-group--append")), f;
316
+ }), _ = y(() => [c("wrapper"), k.value ? "is-focus" : ""]), T = (o) => {
317
+ const { value: f } = o.target;
318
+ s("update:modelValue", f), s("input", f);
319
+ }, j = (o) => {
320
+ const { value: f } = o.target;
321
+ s("change", f);
322
+ }, H = (o) => {
323
+ k.value = !0, s("focus", o);
324
+ }, U = (o) => {
325
+ k.value = !1, s("blur", o);
326
+ }, G = () => {
327
+ s("update:modelValue", ""), s("input", ""), s("change", ""), s("clear"), S(() => {
328
+ var o;
329
+ (o = p.value) == null || o.focus();
330
+ });
331
+ }, X = () => {
332
+ b.value = !b.value, S(() => {
333
+ var o;
334
+ (o = p.value) == null || o.focus();
335
+ });
336
+ };
337
+ return n({
338
+ /** 获取原生 input 引用 */
339
+ input: p,
340
+ /** 使输入框聚焦 */
341
+ focus: () => {
342
+ var o;
343
+ return (o = p.value) == null ? void 0 : o.focus();
344
+ },
345
+ /** 使输入框失焦 */
346
+ blur: () => {
347
+ var o;
348
+ return (o = p.value) == null ? void 0 : o.blur();
349
+ },
350
+ /** 选中输入框中的文本 */
351
+ select: () => {
352
+ var o;
353
+ return (o = p.value) == null ? void 0 : o.select();
354
+ }
355
+ }), M(
356
+ () => a.modelValue,
357
+ () => {
358
+ }
359
+ ), (o, f) => (l(), d("div", J({ class: W.value }, o.$attrs), [
360
+ u(r).prepend ? (l(), d("div", fe, [
361
+ x(o.$slots, "prepend")
362
+ ])) : v("", !0),
363
+ w("div", {
364
+ class: m(_.value)
365
+ }, [
366
+ u(r).prefix ? (l(), d("span", {
367
+ key: 0,
368
+ class: m(u(c)("prefix"))
369
+ }, [
370
+ x(o.$slots, "prefix")
371
+ ], 2)) : v("", !0),
372
+ w("input", {
373
+ ref_key: "inputRef",
374
+ ref: p,
375
+ class: m(u(c)("inner")),
376
+ type: h.value,
377
+ value: i.value,
378
+ placeholder: o.placeholder,
379
+ disabled: o.disabled,
380
+ readonly: o.readonly,
381
+ form: o.form,
382
+ autofocus: o.autofocus,
383
+ autocomplete: o.autocomplete,
384
+ onInput: T,
385
+ onChange: j,
386
+ onFocus: H,
387
+ onBlur: U
388
+ }, null, 42, ge),
389
+ u(r).suffix || o.clearable || o.showPassword ? (l(), d("span", {
390
+ key: 1,
391
+ class: m(u(c)("suffix"))
392
+ }, [
393
+ x(o.$slots, "suffix"),
394
+ o.clearable && i.value && !o.disabled && !o.readonly ? (l(), d("span", {
395
+ key: 0,
396
+ class: m(u(c)("clear")),
397
+ onMousedown: f[0] || (f[0] = K(() => {
398
+ }, ["prevent"])),
399
+ onClick: G
400
+ }, [
401
+ Q(u(N))
402
+ ], 34)) : v("", !0),
403
+ o.showPassword && o.type === "password" && !o.disabled ? (l(), d("span", {
404
+ key: 1,
405
+ class: m(u(c)("password")),
406
+ onClick: X
407
+ }, [
408
+ b.value ? (l(), $(u(D), { key: 0 })) : (l(), $(u(F), { key: 1 }))
409
+ ], 2)) : v("", !0)
410
+ ], 2)) : v("", !0)
411
+ ], 2),
412
+ u(r).append ? (l(), d("div", me, [
413
+ x(o.$slots, "append")
414
+ ])) : v("", !0)
415
+ ], 16));
416
+ }
417
+ });
418
+ z.install = (e) => {
419
+ e.component(z.name, z);
420
+ };
421
+ const he = [
422
+ te,
423
+ z,
424
+ se,
425
+ N,
426
+ D,
427
+ F
428
+ ];
429
+ function je(e) {
430
+ he.forEach((n) => {
153
431
  e.component(n.name, n);
154
432
  });
155
433
  }
156
- function ge(e, n) {
157
- if (!w) return;
158
- const t = (s) => {
159
- const o = e.value;
160
- !o || o === s.target || o.contains(s.target) || n(s);
434
+ function He(e, n) {
435
+ if (!I) return;
436
+ const t = (a) => {
437
+ const s = e.value;
438
+ !s || s === a.target || s.contains(a.target) || n(a);
161
439
  };
162
- B(() => {
440
+ P(() => {
163
441
  document.addEventListener("click", t, !0);
164
- }), E(() => {
442
+ }), R(() => {
165
443
  document.removeEventListener("click", t, !0);
166
444
  });
167
445
  }
168
- function pe(e, n, t, s) {
169
- if (!w) return;
170
- let o;
171
- const i = (f) => {
172
- f.addEventListener(n, t, s), o = () => f.removeEventListener(n, t, s);
173
- }, l = () => {
174
- o == null || o(), o = void 0;
446
+ function Ue(e, n, t, a) {
447
+ if (!I) return;
448
+ let s;
449
+ const r = (p) => {
450
+ p.addEventListener(n, t, a), s = () => p.removeEventListener(n, t, a);
451
+ }, c = () => {
452
+ s == null || s(), s = void 0;
175
453
  };
176
- z(e) ? D(
454
+ Z(e) ? M(
177
455
  e,
178
- (f, C, m) => {
179
- f && (i(f), m(l));
456
+ (p, k, b) => {
457
+ p && (r(p), b(c));
180
458
  },
181
459
  { immediate: !0 }
182
- ) : B(() => i(e)), E(l);
460
+ ) : P(() => r(e)), R(c);
183
461
  }
184
- const T = {
462
+ const ye = {
185
463
  primary: "#6366f1",
186
464
  primaryLight: "#818cf8",
187
465
  primaryDark: "#4f46e5",
188
466
  primaryBg: "#eef2ff"
189
- }, F = {
467
+ }, be = {
190
468
  success: "#10b981",
191
469
  successLight: "#34d399",
192
470
  successDark: "#059669",
@@ -203,7 +481,7 @@ const T = {
203
481
  infoLight: "#60a5fa",
204
482
  infoDark: "#2563eb",
205
483
  infoBg: "#eff6ff"
206
- }, a = {
484
+ }, g = {
207
485
  white: "#ffffff",
208
486
  black: "#000000",
209
487
  gray50: "#f9fafb",
@@ -216,30 +494,30 @@ const T = {
216
494
  gray700: "#374151",
217
495
  gray800: "#1f2937",
218
496
  gray900: "#111827"
219
- }, U = {
220
- primary: a.gray900,
221
- secondary: a.gray600,
222
- placeholder: a.gray400,
223
- disabled: a.gray300,
224
- inverse: a.white
225
- }, G = {
226
- page: a.gray50,
227
- container: a.white,
228
- elevated: a.white,
229
- disabled: a.gray100,
497
+ }, ve = {
498
+ primary: g.gray900,
499
+ secondary: g.gray600,
500
+ placeholder: g.gray400,
501
+ disabled: g.gray300,
502
+ inverse: g.white
503
+ }, we = {
504
+ page: g.gray50,
505
+ container: g.white,
506
+ elevated: g.white,
507
+ disabled: g.gray100,
230
508
  mask: "rgba(0, 0, 0, 0.45)"
231
- }, X = {
232
- base: a.gray200,
233
- light: a.gray100,
234
- dark: a.gray300
235
- }, Y = {
236
- brand: T,
237
- functional: F,
238
- neutral: a,
239
- text: U,
240
- bg: G,
241
- border: X
242
- }, me = 4, q = {
509
+ }, xe = {
510
+ base: g.gray200,
511
+ light: g.gray100,
512
+ dark: g.gray300
513
+ }, ke = {
514
+ brand: ye,
515
+ functional: be,
516
+ neutral: g,
517
+ text: ve,
518
+ bg: we,
519
+ border: xe
520
+ }, Ge = 4, Ce = {
243
521
  /** 0px */
244
522
  none: 0,
245
523
  /** 4px */
@@ -262,7 +540,7 @@ const T = {
262
540
  "5xl": 48,
263
541
  /** 64px */
264
542
  "6xl": 64
265
- }, J = {
543
+ }, $e = {
266
544
  /** 按钮等小型组件 */
267
545
  buttonSm: { x: 12, y: 6 },
268
546
  buttonMd: { x: 16, y: 8 },
@@ -275,7 +553,7 @@ const T = {
275
553
  cardSm: 12,
276
554
  cardMd: 16,
277
555
  cardLg: 24
278
- }, K = {
556
+ }, ze = {
279
557
  /** 0px */
280
558
  none: 0,
281
559
  /** 2px */
@@ -292,30 +570,30 @@ const T = {
292
570
  "2xl": 16,
293
571
  /** 9999px - 完全圆角 */
294
572
  full: 9999
295
- }, Q = {
573
+ }, Be = {
296
574
  none: "none",
297
575
  sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
298
576
  base: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
299
577
  md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
300
578
  lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
301
579
  xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"
302
- }, Z = {
580
+ }, Ee = {
303
581
  /** 快速过渡 - 用于小型交互 */
304
582
  fast: "150ms ease",
305
583
  /** 默认过渡 */
306
584
  base: "200ms ease",
307
585
  /** 慢速过渡 - 用于大型动画 */
308
586
  slow: "300ms ease"
309
- }, O = {
310
- spacing: q,
311
- padding: J,
312
- radius: K,
313
- shadow: Q,
314
- transition: Z
315
- }, _ = {
587
+ }, Le = {
588
+ spacing: Ce,
589
+ padding: $e,
590
+ radius: ze,
591
+ shadow: Be,
592
+ transition: Ee
593
+ }, Ie = {
316
594
  sans: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
317
595
  mono: "'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace"
318
- }, ee = {
596
+ }, Se = {
319
597
  /** 12px */
320
598
  xs: 12,
321
599
  /** 14px */
@@ -332,7 +610,7 @@ const T = {
332
610
  "3xl": 30,
333
611
  /** 36px */
334
612
  "4xl": 36
335
- }, te = {
613
+ }, Ae = {
336
614
  /** 1 */
337
615
  none: 1,
338
616
  /** 1.25 */
@@ -345,7 +623,7 @@ const T = {
345
623
  relaxed: 1.625,
346
624
  /** 2 */
347
625
  loose: 2
348
- }, ne = {
626
+ }, Ve = {
349
627
  /** 400 */
350
628
  normal: 400,
351
629
  /** 500 */
@@ -354,51 +632,55 @@ const T = {
354
632
  semibold: 600,
355
633
  /** 700 */
356
634
  bold: 700
357
- }, oe = {
358
- fontFamily: _,
359
- fontSize: ee,
360
- lineHeight: te,
361
- fontWeight: ne
362
- }, ye = {
363
- ...Y,
364
- ...O,
365
- ...oe
635
+ }, Me = {
636
+ fontFamily: Ie,
637
+ fontSize: Se,
638
+ lineHeight: Ae,
639
+ fontWeight: Ve
640
+ }, Xe = {
641
+ ...ke,
642
+ ...Le,
643
+ ...Me
366
644
  };
367
645
  export {
368
- P as AiButton,
369
- W as AiLoadingIcon,
370
- me as BASE_SPACING_UNIT,
371
- ae as addEventListener,
372
- G as bgColors,
373
- X as borderColors,
374
- K as borderRadius,
375
- T as brandColors,
376
- Y as colorTokens,
377
- J as componentPadding,
378
- S as createBem,
379
- M as createNamespace,
380
- _ as fontFamily,
381
- ee as fontSize,
382
- ne as fontWeight,
383
- F as functionalColors,
384
- N as getElementRect,
385
- le as getScrollParent,
386
- fe as install,
387
- w as isClient,
388
- ie as isCssPropertySupported,
389
- ce as isElementInViewport,
390
- te as lineHeight,
391
- a as neutralColors,
392
- de as preventDefault,
393
- Q as shadows,
394
- q as spacingScale,
395
- O as spacingTokens,
396
- ue as stopPropagation,
397
- U as textColors,
398
- ye as tokens,
399
- Z as transitions,
400
- oe as typographyTokens,
401
- ge as useClickOutside,
402
- pe as useEventListener,
403
- re as useNamespace
646
+ te as AiButton,
647
+ N as AiCloseCircleIcon,
648
+ D as AiEyeIcon,
649
+ F as AiEyeInvisibleIcon,
650
+ z as AiInput,
651
+ se as AiLoadingIcon,
652
+ Ge as BASE_SPACING_UNIT,
653
+ De as addEventListener,
654
+ we as bgColors,
655
+ xe as borderColors,
656
+ ze as borderRadius,
657
+ ye as brandColors,
658
+ ke as colorTokens,
659
+ $e as componentPadding,
660
+ L as createBem,
661
+ O as createNamespace,
662
+ Ie as fontFamily,
663
+ Se as fontSize,
664
+ Ve as fontWeight,
665
+ be as functionalColors,
666
+ ee as getElementRect,
667
+ Fe as getScrollParent,
668
+ je as install,
669
+ I as isClient,
670
+ Ne as isCssPropertySupported,
671
+ We as isElementInViewport,
672
+ Ae as lineHeight,
673
+ g as neutralColors,
674
+ Te as preventDefault,
675
+ Be as shadows,
676
+ Ce as spacingScale,
677
+ Le as spacingTokens,
678
+ _e as stopPropagation,
679
+ ve as textColors,
680
+ Xe as tokens,
681
+ Ee as transitions,
682
+ Me as typographyTokens,
683
+ He as useClickOutside,
684
+ Ue as useEventListener,
685
+ Re as useNamespace
404
686
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";:root{--ai-color-primary: #ff4d4f;--ai-color-primary-hover: #ff7875;--ai-color-primary-active: #d9363e;--ai-color-primary-light: #ff7875;--ai-color-primary-dark: #d9363e;--ai-color-primary-bg: rgba(255, 77, 79, .12);--ai-color-success: #22c55e;--ai-color-success-light: #4ade80;--ai-color-success-dark: #16a34a;--ai-color-success-bg: rgba(34, 197, 94, .12);--ai-color-warning: #eab308;--ai-color-warning-light: #facc15;--ai-color-warning-dark: #ca8a04;--ai-color-warning-bg: rgba(234, 179, 8, .12);--ai-color-danger: #ff4d4f;--ai-color-error: #ff4d4f;--ai-color-error-light: #ff7875;--ai-color-error-dark: #d9363e;--ai-color-error-bg: rgba(255, 77, 79, .12);--ai-color-info: #ff4d4f;--ai-color-info-light: #ff7875;--ai-color-info-dark: #d9363e;--ai-color-info-bg: rgba(255, 77, 79, .12);--ai-color-white: #ffffff;--ai-color-black: #000000;--ai-color-gray-50: #f9fafb;--ai-color-gray-100: #f3f4f6;--ai-color-gray-200: #e5e7eb;--ai-color-gray-300: #d1d5db;--ai-color-gray-400: #9ca3af;--ai-color-gray-500: #6b7280;--ai-color-gray-600: #4b5563;--ai-color-gray-700: #374151;--ai-color-gray-800: #1f2937;--ai-color-gray-900: #111827;--ai-color-bg-base: #ffffff;--ai-color-bg-elevated: #ffffff;--ai-color-fill-default: #f9fafb;--ai-color-fill-hover: #f3f4f6;--ai-color-fill-active: #e5e7eb;--ai-bg-page: #ffffff;--ai-bg-container: #ffffff;--ai-bg-elevated: #ffffff;--ai-bg-disabled: #f3f4f6;--ai-bg-mask: rgba(0, 0, 0, .45);--ai-color-text-primary: #111827;--ai-color-text-secondary: #6b7280;--ai-color-text-disabled: #9ca3af;--ai-text-primary: #111827;--ai-text-secondary: #6b7280;--ai-text-placeholder: #9ca3af;--ai-text-disabled: #9ca3af;--ai-text-inverse: #ffffff;--ai-color-border: #e5e7eb;--ai-color-border-strong: #d1d5db;--ai-border-color: #e5e7eb;--ai-border-color-light: #f3f4f6;--ai-border-color-dark: #d1d5db;--ai-spacing-none: 0;--ai-spacing-xs: 4px;--ai-spacing-sm: 8px;--ai-spacing-md: 12px;--ai-spacing-lg: 16px;--ai-spacing-xl: 20px;--ai-spacing-2xl: 24px;--ai-spacing-3xl: 32px;--ai-spacing-4xl: 40px;--ai-spacing-5xl: 48px;--ai-spacing-6xl: 64px;--ai-radius-none: 0;--ai-radius-xs: 2px;--ai-radius-sm: 4px;--ai-radius-md: 6px;--ai-radius-lg: 8px;--ai-radius-xl: 12px;--ai-radius-2xl: 16px;--ai-radius-full: 9999px;--ai-radius-pill: 9999px;--ai-shadow-none: none;--ai-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);--ai-shadow-base: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--ai-shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--ai-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--ai-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--ai-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";--ai-font-family-mono: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;--ai-font-size-xs: 12px;--ai-font-size-sm: 14px;--ai-font-size-base: 16px;--ai-font-size-lg: 18px;--ai-font-size-xl: 20px;--ai-font-size-2xl: 24px;--ai-font-size-3xl: 30px;--ai-font-size-4xl: 36px;--ai-line-height-none: 1;--ai-line-height-tight: 1.25;--ai-line-height-snug: 1.375;--ai-line-height-normal: 1.5;--ai-line-height-relaxed: 1.625;--ai-line-height-loose: 2;--ai-line-height-base: 1.5;--ai-font-weight-normal: 400;--ai-font-weight-medium: 500;--ai-font-weight-semibold: 600;--ai-font-weight-bold: 700;--ai-transition-fast: .15s ease;--ai-transition-base: .2s ease;--ai-transition-slow: .3s ease;--ai-z-dropdown: 1000;--ai-z-sticky: 1020;--ai-z-fixed: 1030;--ai-z-modal-backdrop: 1040;--ai-z-modal: 1050;--ai-z-popover: 1060;--ai-z-tooltip: 1070}.ai-button{position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;padding:0 var(--ai-spacing-md);height:32px;border-radius:var(--ai-radius-md);font-size:var(--ai-font-size-sm);line-height:var(--ai-line-height-base);font-weight:var(--ai-font-weight-medium, 500);border:1px solid transparent;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;text-decoration:none;outline:none;background-image:none;touch-action:manipulation;transition:background-color .2s ease,border-color .2s ease,color .2s ease,box-shadow .2s ease,transform .1s ease;color:var(--ai-color-text-primary);background-color:var(--ai-color-fill-default);border-color:var(--ai-color-border)}.ai-button:hover{background-color:var(--ai-color-fill-hover);border-color:var(--ai-color-border-strong)}.ai-button:active{background-color:var(--ai-color-fill-active);transform:translateY(1px)}.ai-button--primary{background-color:var(--ai-color-primary);border-color:var(--ai-color-primary);color:#fff}.ai-button--primary:hover{background-color:var(--ai-color-primary-hover);border-color:var(--ai-color-primary-hover)}.ai-button--primary:active{background-color:var(--ai-color-primary-active);border-color:var(--ai-color-primary-active);box-shadow:0 0 0 1px #ff634773}.ai-button--success{background-color:var(--ai-color-success);border-color:var(--ai-color-success);color:#fff}.ai-button--success:hover{background-color:var(--ai-color-success-light);border-color:var(--ai-color-success-light)}.ai-button--success:active{background-color:var(--ai-color-success-dark);border-color:var(--ai-color-success-dark);box-shadow:0 0 0 1px #22c55e66}.ai-button--warning{background-color:var(--ai-color-warning);border-color:var(--ai-color-warning);color:#111827}.ai-button--warning:hover{background-color:var(--ai-color-warning-light);border-color:var(--ai-color-warning-light)}.ai-button--warning:active{background-color:var(--ai-color-warning-dark);border-color:var(--ai-color-warning-dark);box-shadow:0 0 0 1px #eab30866}.ai-button--danger{background-color:var(--ai-color-danger);border-color:var(--ai-color-danger);color:#fff}.ai-button--danger:hover{background-color:var(--ai-color-error-light);border-color:var(--ai-color-error-light)}.ai-button--danger:active{background-color:var(--ai-color-error-dark);border-color:var(--ai-color-error-dark);box-shadow:0 0 0 1px #f9737366}.ai-button--default{background-color:var(--ai-color-fill-default);border-color:var(--ai-color-border);color:var(--ai-color-text-primary)}.ai-button--default:hover{background-color:var(--ai-color-fill-hover);border-color:var(--ai-color-border-strong)}.ai-button--default:active{background-color:var(--ai-color-fill-active)}.ai-button--text{background-color:transparent;border-color:transparent;color:var(--ai-color-text-secondary);padding-left:4px;padding-right:4px}.ai-button--text:hover{background-color:#f871711f;color:var(--ai-color-text-primary)}.ai-button--text:active{background-color:#f8717133}.ai-button--sm{height:28px;padding:0 var(--ai-spacing-sm);font-size:var(--ai-font-size-xs)}.ai-button--lg{height:36px;padding:0 var(--ai-spacing-lg);font-size:var(--ai-font-size-base)}.ai-button--block{display:flex;width:100%}.ai-button--round{border-radius:var(--ai-radius-pill)}.ai-button--circle{border-radius:50%;padding:0;width:32px;height:32px}.ai-button--circle.ai-button--sm{width:28px;height:28px}.ai-button--circle.ai-button--lg{width:36px;height:36px}.ai-button--ghost{background-color:transparent;color:var(--ai-color-text-primary);border-color:var(--ai-color-border)}.ai-button--ghost:hover{background-color:#ff63471f}.ai-button--ghost:active{background-color:#ff634733}.ai-button--ghost.ai-button--primary{color:var(--ai-color-primary);border-color:var(--ai-color-primary)}.ai-button--ghost.ai-button--primary:hover{background-color:#ff63471f}.ai-button--ghost.ai-button--primary:active{background-color:#ff634733}.ai-button--ghost.ai-button--success{color:var(--ai-color-success);border-color:var(--ai-color-success)}.ai-button--ghost.ai-button--success:hover{background-color:#22c55e1f}.ai-button--ghost.ai-button--success:active{background-color:#22c55e33}.ai-button--ghost.ai-button--warning{color:var(--ai-color-warning);border-color:var(--ai-color-warning)}.ai-button--ghost.ai-button--warning:hover{background-color:#eab3081f}.ai-button--ghost.ai-button--warning:active{background-color:#eab30833}.ai-button--ghost.ai-button--danger{color:var(--ai-color-danger);border-color:var(--ai-color-danger)}.ai-button--ghost.ai-button--danger:hover{background-color:#ff63471f}.ai-button--ghost.ai-button--danger:active{background-color:#ff634733}.ai-button--disabled,.ai-button:disabled,.ai-button[disabled]{cursor:not-allowed;opacity:.6;background-color:var(--ai-color-fill-default);border-color:var(--ai-color-border);color:var(--ai-color-text-disabled);box-shadow:none;transform:none}.ai-button--disabled:hover,.ai-button--disabled:active,.ai-button:disabled:hover,.ai-button:disabled:active,.ai-button[disabled]:hover,.ai-button[disabled]:active{background-color:var(--ai-color-fill-default);border-color:var(--ai-color-border);color:var(--ai-color-text-disabled);transform:none}.ai-button--loading{cursor:default;opacity:.85;pointer-events:none}.ai-button__content{display:inline-flex;align-items:center;justify-content:center;gap:6px}.ai-button__text{display:inline-flex;align-items:center}.ai-button__icon{display:inline-flex;align-items:center;justify-content:center}.ai-button__icon--left{margin-right:4px}.ai-button__icon--right{margin-left:4px}.ai-button__spinner{position:absolute;left:8px;width:14px;height:14px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;opacity:.6;animation:ai-button-spin .7s linear infinite}.ai-button--circle .ai-button__spinner{position:static;left:auto;margin-right:0}@keyframes ai-button-spin{to{transform:rotate(360deg)}}.ai-loading-icon{display:inline-flex;align-items:center;justify-content:center;animation:ai-loading-icon-spin 1s linear infinite}.ai-loading-icon svg{display:block}@keyframes ai-loading-icon-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
1
+ @charset "UTF-8";:root{--ai-color-primary: #ff4d4f;--ai-color-primary-hover: #ff7875;--ai-color-primary-active: #d9363e;--ai-color-primary-light: #ff7875;--ai-color-primary-dark: #d9363e;--ai-color-primary-bg: rgba(255, 77, 79, .12);--ai-color-success: #22c55e;--ai-color-success-light: #4ade80;--ai-color-success-dark: #16a34a;--ai-color-success-bg: rgba(34, 197, 94, .12);--ai-color-warning: #eab308;--ai-color-warning-light: #facc15;--ai-color-warning-dark: #ca8a04;--ai-color-warning-bg: rgba(234, 179, 8, .12);--ai-color-danger: #ff4d4f;--ai-color-error: #ff4d4f;--ai-color-error-light: #ff7875;--ai-color-error-dark: #d9363e;--ai-color-error-bg: rgba(255, 77, 79, .12);--ai-color-info: #ff4d4f;--ai-color-info-light: #ff7875;--ai-color-info-dark: #d9363e;--ai-color-info-bg: rgba(255, 77, 79, .12);--ai-color-white: #ffffff;--ai-color-black: #000000;--ai-color-gray-50: #f9fafb;--ai-color-gray-100: #f3f4f6;--ai-color-gray-200: #e5e7eb;--ai-color-gray-300: #d1d5db;--ai-color-gray-400: #9ca3af;--ai-color-gray-500: #6b7280;--ai-color-gray-600: #4b5563;--ai-color-gray-700: #374151;--ai-color-gray-800: #1f2937;--ai-color-gray-900: #111827;--ai-color-bg-base: #ffffff;--ai-color-bg-elevated: #ffffff;--ai-color-fill-default: #f9fafb;--ai-color-fill-hover: #f3f4f6;--ai-color-fill-active: #e5e7eb;--ai-bg-page: #ffffff;--ai-bg-container: #ffffff;--ai-bg-elevated: #ffffff;--ai-bg-disabled: #f3f4f6;--ai-bg-mask: rgba(0, 0, 0, .45);--ai-color-text-primary: #111827;--ai-color-text-secondary: #6b7280;--ai-color-text-disabled: #9ca3af;--ai-text-primary: #111827;--ai-text-secondary: #6b7280;--ai-text-placeholder: #9ca3af;--ai-text-disabled: #9ca3af;--ai-text-inverse: #ffffff;--ai-color-border: #e5e7eb;--ai-color-border-strong: #d1d5db;--ai-border-color: #e5e7eb;--ai-border-color-light: #f3f4f6;--ai-border-color-dark: #d1d5db;--ai-spacing-none: 0;--ai-spacing-xs: 4px;--ai-spacing-sm: 8px;--ai-spacing-md: 12px;--ai-spacing-lg: 16px;--ai-spacing-xl: 20px;--ai-spacing-2xl: 24px;--ai-spacing-3xl: 32px;--ai-spacing-4xl: 40px;--ai-spacing-5xl: 48px;--ai-spacing-6xl: 64px;--ai-radius-none: 0;--ai-radius-xs: 2px;--ai-radius-sm: 4px;--ai-radius-md: 6px;--ai-radius-lg: 8px;--ai-radius-xl: 12px;--ai-radius-2xl: 16px;--ai-radius-full: 9999px;--ai-radius-pill: 9999px;--ai-shadow-none: none;--ai-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);--ai-shadow-base: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--ai-shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--ai-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--ai-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--ai-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";--ai-font-family-mono: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;--ai-font-size-xs: 12px;--ai-font-size-sm: 14px;--ai-font-size-base: 16px;--ai-font-size-lg: 18px;--ai-font-size-xl: 20px;--ai-font-size-2xl: 24px;--ai-font-size-3xl: 30px;--ai-font-size-4xl: 36px;--ai-line-height-none: 1;--ai-line-height-tight: 1.25;--ai-line-height-snug: 1.375;--ai-line-height-normal: 1.5;--ai-line-height-relaxed: 1.625;--ai-line-height-loose: 2;--ai-line-height-base: 1.5;--ai-font-weight-normal: 400;--ai-font-weight-medium: 500;--ai-font-weight-semibold: 600;--ai-font-weight-bold: 700;--ai-transition-fast: .15s ease;--ai-transition-base: .2s ease;--ai-transition-slow: .3s ease;--ai-z-dropdown: 1000;--ai-z-sticky: 1020;--ai-z-fixed: 1030;--ai-z-modal-backdrop: 1040;--ai-z-modal: 1050;--ai-z-popover: 1060;--ai-z-tooltip: 1070}.ai-button{position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;padding:0 var(--ai-spacing-md);height:32px;border-radius:var(--ai-radius-md);font-size:var(--ai-font-size-sm);line-height:var(--ai-line-height-base);font-weight:var(--ai-font-weight-medium, 500);border:1px solid transparent;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;text-decoration:none;outline:none;background-image:none;touch-action:manipulation;transition:background-color .2s ease,border-color .2s ease,color .2s ease,box-shadow .2s ease,transform .1s ease;color:var(--ai-color-text-primary);background-color:var(--ai-color-fill-default);border-color:var(--ai-color-border)}.ai-button:hover{background-color:var(--ai-color-fill-hover);border-color:var(--ai-color-border-strong)}.ai-button:active{background-color:var(--ai-color-fill-active);transform:translateY(1px)}.ai-button--primary{background-color:var(--ai-color-primary);border-color:var(--ai-color-primary);color:#fff}.ai-button--primary:hover{background-color:var(--ai-color-primary-hover);border-color:var(--ai-color-primary-hover)}.ai-button--primary:active{background-color:var(--ai-color-primary-active);border-color:var(--ai-color-primary-active);box-shadow:0 0 0 1px #ff634773}.ai-button--success{background-color:var(--ai-color-success);border-color:var(--ai-color-success);color:#fff}.ai-button--success:hover{background-color:var(--ai-color-success-light);border-color:var(--ai-color-success-light)}.ai-button--success:active{background-color:var(--ai-color-success-dark);border-color:var(--ai-color-success-dark);box-shadow:0 0 0 1px #22c55e66}.ai-button--warning{background-color:var(--ai-color-warning);border-color:var(--ai-color-warning);color:#111827}.ai-button--warning:hover{background-color:var(--ai-color-warning-light);border-color:var(--ai-color-warning-light)}.ai-button--warning:active{background-color:var(--ai-color-warning-dark);border-color:var(--ai-color-warning-dark);box-shadow:0 0 0 1px #eab30866}.ai-button--danger{background-color:var(--ai-color-danger);border-color:var(--ai-color-danger);color:#fff}.ai-button--danger:hover{background-color:var(--ai-color-error-light);border-color:var(--ai-color-error-light)}.ai-button--danger:active{background-color:var(--ai-color-error-dark);border-color:var(--ai-color-error-dark);box-shadow:0 0 0 1px #f9737366}.ai-button--default{background-color:var(--ai-color-fill-default);border-color:var(--ai-color-border);color:var(--ai-color-text-primary)}.ai-button--default:hover{background-color:var(--ai-color-fill-hover);border-color:var(--ai-color-border-strong)}.ai-button--default:active{background-color:var(--ai-color-fill-active)}.ai-button--text{background-color:transparent;border-color:transparent;color:var(--ai-color-text-secondary);padding-left:4px;padding-right:4px}.ai-button--text:hover{background-color:#f871711f;color:var(--ai-color-text-primary)}.ai-button--text:active{background-color:#f8717133}.ai-button--sm{height:28px;padding:0 var(--ai-spacing-sm);font-size:var(--ai-font-size-xs)}.ai-button--lg{height:36px;padding:0 var(--ai-spacing-lg);font-size:var(--ai-font-size-base)}.ai-button--block{display:flex;width:100%}.ai-button--round{border-radius:var(--ai-radius-pill)}.ai-button--circle{border-radius:50%;padding:0;width:32px;height:32px}.ai-button--circle.ai-button--sm{width:28px;height:28px}.ai-button--circle.ai-button--lg{width:36px;height:36px}.ai-button--ghost{background-color:transparent;color:var(--ai-color-text-primary);border-color:var(--ai-color-border)}.ai-button--ghost:hover{background-color:#ff63471f}.ai-button--ghost:active{background-color:#ff634733}.ai-button--ghost.ai-button--primary{color:var(--ai-color-primary);border-color:var(--ai-color-primary)}.ai-button--ghost.ai-button--primary:hover{background-color:#ff63471f}.ai-button--ghost.ai-button--primary:active{background-color:#ff634733}.ai-button--ghost.ai-button--success{color:var(--ai-color-success);border-color:var(--ai-color-success)}.ai-button--ghost.ai-button--success:hover{background-color:#22c55e1f}.ai-button--ghost.ai-button--success:active{background-color:#22c55e33}.ai-button--ghost.ai-button--warning{color:var(--ai-color-warning);border-color:var(--ai-color-warning)}.ai-button--ghost.ai-button--warning:hover{background-color:#eab3081f}.ai-button--ghost.ai-button--warning:active{background-color:#eab30833}.ai-button--ghost.ai-button--danger{color:var(--ai-color-danger);border-color:var(--ai-color-danger)}.ai-button--ghost.ai-button--danger:hover{background-color:#ff63471f}.ai-button--ghost.ai-button--danger:active{background-color:#ff634733}.ai-button--disabled,.ai-button:disabled,.ai-button[disabled]{cursor:not-allowed;opacity:.6;background-color:var(--ai-color-fill-default);border-color:var(--ai-color-border);color:var(--ai-color-text-disabled);box-shadow:none;transform:none}.ai-button--disabled:hover,.ai-button--disabled:active,.ai-button:disabled:hover,.ai-button:disabled:active,.ai-button[disabled]:hover,.ai-button[disabled]:active{background-color:var(--ai-color-fill-default);border-color:var(--ai-color-border);color:var(--ai-color-text-disabled);transform:none}.ai-button--loading{cursor:default;opacity:.85;pointer-events:none}.ai-button__content{display:inline-flex;align-items:center;justify-content:center;gap:6px}.ai-button__text{display:inline-flex;align-items:center}.ai-button__icon{display:inline-flex;align-items:center;justify-content:center}.ai-button__icon--left{margin-right:4px}.ai-button__icon--right{margin-left:4px}.ai-button__spinner{position:absolute;left:8px;width:14px;height:14px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;opacity:.6;animation:ai-button-spin .7s linear infinite}.ai-button--circle .ai-button__spinner{position:static;left:auto;margin-right:0}@keyframes ai-button-spin{to{transform:rotate(360deg)}}.ai-loading-icon{display:inline-flex;align-items:center;justify-content:center;animation:ai-loading-icon-spin 1s linear infinite}.ai-loading-icon svg{display:block}@keyframes ai-loading-icon-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ai-input{--ai-input-height-sm: 28px;--ai-input-height-md: 32px;--ai-input-height-lg: 36px;position:relative;display:inline-flex;width:100%;font-size:var(--ai-font-size-sm);line-height:var(--ai-line-height-base);box-sizing:border-box;vertical-align:middle}.ai-input__wrapper{display:inline-flex;flex-grow:1;align-items:center;justify-content:center;padding:1px 11px;background-color:var(--ai-color-fill-default);background-image:none;border:1px solid var(--ai-color-border);border-radius:var(--ai-radius-md);transition:var(--ai-transition-base);cursor:text}.ai-input__wrapper:hover{border-color:var(--ai-color-gray-400)}.ai-input__wrapper.is-focus{border-color:var(--ai-color-primary);box-shadow:0 0 0 1px var(--ai-color-primary)}.ai-input__inner{width:100%;flex-grow:1;color:var(--ai-color-text-primary);font-size:inherit;height:calc(100% - 2px);line-height:inherit;padding:0;outline:none;border:none;background:none;box-sizing:border-box}.ai-input__inner::placeholder{color:var(--ai-color-text-secondary)}.ai-input__inner::-ms-reveal{display:none}.ai-input__prefix,.ai-input__suffix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--ai-color-text-secondary);transition:all var(--ai-transition-base);pointer-events:all}.ai-input__prefix{margin-right:8px}.ai-input__suffix{margin-left:8px}.ai-input__clear,.ai-input__password{cursor:pointer;font-size:14px;margin-left:4px;transition:color var(--ai-transition-base)}.ai-input__clear:hover,.ai-input__password:hover{color:var(--ai-color-text-primary)}.ai-input--sm .ai-input__wrapper{height:var(--ai-input-height-sm)}.ai-input--md .ai-input__wrapper{height:var(--ai-input-height-md)}.ai-input--lg .ai-input__wrapper{height:var(--ai-input-height-lg);font-size:var(--ai-font-size-base)}.ai-input--disabled{cursor:not-allowed}.ai-input--disabled .ai-input__wrapper{background-color:var(--ai-bg-disabled);border-color:var(--ai-color-border);color:var(--ai-color-text-disabled);cursor:not-allowed}.ai-input--disabled .ai-input__wrapper:hover{border-color:var(--ai-color-border)}.ai-input--disabled .ai-input__inner{color:var(--ai-color-text-disabled);cursor:not-allowed}.ai-input-group{display:inline-flex;width:100%;align-items:stretch}.ai-input-group__prepend,.ai-input-group__append{background-color:var(--ai-color-fill-default);color:var(--ai-color-text-secondary);border:1px solid var(--ai-color-border);border-radius:var(--ai-radius-md);padding:0 12px;white-space:nowrap;display:flex;align-items:center;justify-content:center}.ai-input-group__prepend{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0}.ai-input-group__append{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0}.ai-input-group .ai-input__wrapper{border-radius:0}.ai-input-group--prepend .ai-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--ai-radius-md);border-bottom-right-radius:var(--ai-radius-md)}.ai-input-group--append .ai-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:var(--ai-radius-md);border-bottom-left-radius:var(--ai-radius-md)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axin666/ai-ui",
3
- "version": "0.1.9",
3
+ "version": "0.1.12",
4
4
  "description": "A Vue 3 component library for admin systems",
5
5
  "type": "module",
6
6
  "main": "dist/ai-ui.cjs.js",
@@ -12,6 +12,11 @@
12
12
  "require": "./dist/ai-ui.cjs.js",
13
13
  "types": "./dist/types/src/index.d.ts"
14
14
  },
15
+ "./Icon": {
16
+ "import": "./dist/ai-ui.esm.js",
17
+ "require": "./dist/ai-ui.cjs.js",
18
+ "types": "./dist/types/src/index.d.ts"
19
+ },
15
20
  "./dist/style.css": "./dist/style.css"
16
21
  },
17
22
  "files": [
@@ -50,6 +55,8 @@
50
55
  "@typescript-eslint/eslint-plugin": "^6.13.1",
51
56
  "@typescript-eslint/parser": "^6.13.1",
52
57
  "@vitejs/plugin-vue": "^5.0.0",
58
+ "@vitepress-demo-preview/component": "^2.6.1",
59
+ "@vitepress-demo-preview/plugin": "^1.4.1",
53
60
  "@vue/eslint-config-prettier": "^8.0.0",
54
61
  "@vue/eslint-config-typescript": "^12.0.0",
55
62
  "@vue/test-utils": "^2.4.0",