@anker-in/headless-ui 0.0.15 → 0.0.16

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.
@@ -9,8 +9,9 @@ export interface InputProps extends ComponentPropsWithout<'input', 'size'>, Vari
9
9
  interface InputSlotProps extends ComponentPropsWithout<'div', RemovedProps> {
10
10
  /**
11
11
  * 插槽的位置
12
+ * default: right
12
13
  */
13
- side: 'left' | 'right';
14
+ side?: 'left' | 'right';
14
15
  }
15
16
  /**
16
17
  * InputSlot
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var c=Object.create;var n=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var x=(e,i)=>{for(var t in i)n(e,t,{get:i[t],enumerable:!0})},f=(e,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of v(i))!h.call(e,a)&&a!==t&&n(e,a,{get:()=>i[a],enumerable:!(o=b(i,a))||o.enumerable});return e};var P=(e,i,t)=>(t=e!=null?c(g(e)):{},f(i||!e||!e.__esModule?n(t,"default",{value:e,enumerable:!0}):t,e)),I=e=>f(n({},"__esModule",{value:!0}),e);var y={};x(y,{Input:()=>d,InputSlot:()=>l});module.exports=I(y);var r=require("react/jsx-runtime"),u=P(require("react")),s=require("../helpers/index.js"),m=require("class-variance-authority");const R=(0,m.cva)("ai-border-input ai-bg-background focus-visible:ai-ring-ring ai-ring-offset-background ai-flex ai-flex-row ai-items-center ai-overflow-hidden ai-rounded-md ai-border ai-px-3 focus-visible:ai-ring-2 focus-visible:ai-ring-offset-2",{variants:{size:{sm:"ai-h-8",base:"ai-h-10",lg:"ai-h-12"}},defaultVariants:{size:"base"}}),l=u.forwardRef((e,i)=>{const{className:t,side:o,children:a,...p}=e;return(0,r.jsx)("div",{ref:i,...p,className:(0,s.cn)("ai-flex ai-h-full ai-items-center ai-px-2",t,{"-ai-order-1 ai-pl-0":o==="left","ai-order-2 ai-pr-0":o==="right"}),children:a})}),d=u.forwardRef(({className:e,type:i,size:t,children:o,...a},p)=>(0,r.jsxs)("div",{className:(0,s.cn)(R({size:t}),e),children:[(0,r.jsx)("input",{type:i,className:(0,s.cn)("placeholder:ai-text-muted-foreground ai-flex ai-size-full ai-text-sm file:ai-border-0 file:ai-bg-transparent file:ai-text-sm file:ai-font-medium focus-visible:ai-outline-none disabled:ai-cursor-not-allowed disabled:ai-opacity-50"),ref:p,...a}),o]}));d.displayName="Input",l.displayName="InputSlot";
1
+ "use strict";"use client";var h=Object.create;var p=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var I=(e,t)=>{for(var i in t)p(e,i,{get:t[i],enumerable:!0})},f=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of b(t))!P.call(e,a)&&a!==i&&p(e,a,{get:()=>t[a],enumerable:!(o=v(t,a))||o.enumerable});return e};var g=(e,t,i)=>(i=e!=null?h(x(e)):{},f(t||!e||!e.__esModule?p(i,"default",{value:e,enumerable:!0}):i,e)),R=e=>f(p({},"__esModule",{value:!0}),e);var y={};I(y,{Input:()=>u,InputSlot:()=>d});module.exports=R(y);var r=require("react/jsx-runtime"),l=g(require("react")),n=require("../helpers/index.js"),c=require("class-variance-authority");const m=(0,c.cva)("ai-border-input ai-w-full ai-bg-background focus-visible:ai-outline-none ai-flex ai-flex-row ai-items-center ai-overflow-hidden ai-rounded-md ai-border",{variants:{size:{sm:"ai-h-8 ai-text-sm",base:"ai-h-10",lg:"ai-h-12 ai-text-lg"}},defaultVariants:{size:"base"}}),d=l.forwardRef((e,t)=>{const{className:i,side:o="right",children:a,...s}=e;return(0,r.jsx)("div",{ref:t,...s,className:(0,n.cn)("ai-flex ai-h-full ai-items-center",i,{"-ai-order-1":o==="left","ai-order-2":o==="right"}),children:a})}),u=l.forwardRef(({className:e,type:t,size:i,children:o,...a},s)=>l.isValidElement(o)?(0,r.jsxs)("div",{className:(0,n.cn)(m({size:i}),e),children:[(0,r.jsx)("input",{type:t,className:(0,n.cn)("placeholder:ai-text-muted-foreground ai-flex ai-size-full file:ai-border-0 file:ai-bg-transparent file:ai-font-medium focus-visible:ai-outline-none disabled:ai-cursor-not-allowed disabled:ai-opacity-50 ai-px-3"),ref:s,...a}),o]}):(0,r.jsx)("input",{type:t,className:(0,n.cn)(m({size:i}),"ai-px-3",e),ref:s,...a}));u.displayName="Input",d.displayName="InputSlot";
2
2
  //# sourceMappingURL=input.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/input.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../helpers/index.js'\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nconst inputVariants = cva(\n 'ai-border-input ai-bg-background focus-visible:ai-ring-ring ai-ring-offset-background ai-flex ai-flex-row ai-items-center ai-overflow-hidden ai-rounded-md ai-border ai-px-3 focus-visible:ai-ring-2 focus-visible:ai-ring-offset-2',\n {\n variants: {\n size: {\n sm: 'ai-h-8',\n base: 'ai-h-10',\n lg: 'ai-h-12',\n },\n },\n defaultVariants: {\n size: 'base',\n },\n }\n)\n\nexport interface InputProps extends ComponentPropsWithout<'input', 'size'>, VariantProps<typeof inputVariants> {}\n\ntype InputSlotElement = React.ElementRef<'div'>\ninterface InputSlotProps extends ComponentPropsWithout<'div', RemovedProps> {\n /**\n * \u63D2\u69FD\u7684\u4F4D\u7F6E\n */\n side: 'left' | 'right'\n}\n\n/**\n * InputSlot\n * \u7528\u6765\u5728 Input \u7EC4\u4EF6\u4E2D\u63D2\u5165\u989D\u5916\u7684\u5185\u5BB9\uFF0C\u6BD4\u5982icon \uFF0C\u6309\u94AE\n */\nconst InputSlot = React.forwardRef<InputSlotElement, InputSlotProps>((props, forwardedRef) => {\n const { className, side, children, ...slotProps } = props\n\n return (\n <div\n ref={forwardedRef}\n {...slotProps}\n className={cn('ai-flex ai-h-full ai-items-center ai-px-2', className, {\n '-ai-order-1 ai-pl-0': side === 'left',\n 'ai-order-2 ai-pr-0': side === 'right',\n })}\n >\n {children}\n </div>\n )\n})\n\nconst Input = React.forwardRef<React.ElementRef<'input'>, InputProps>(\n ({ className, type, size, children, ...props }, ref) => {\n return (\n <div className={cn(inputVariants({ size }), className)}>\n <input\n type={type}\n className={cn(\n 'placeholder:ai-text-muted-foreground ai-flex ai-size-full ai-text-sm file:ai-border-0 file:ai-bg-transparent file:ai-text-sm file:ai-font-medium focus-visible:ai-outline-none disabled:ai-cursor-not-allowed disabled:ai-opacity-50'\n )}\n ref={ref}\n {...props}\n />\n {children}\n </div>\n )\n }\n)\nInput.displayName = 'Input'\nInputSlot.displayName = 'InputSlot'\n\nexport { Input, InputSlot }\n"],
5
- "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,cAAAC,IAAA,eAAAC,EAAAJ,GAyCI,IAAAK,EAAA,6BAvCJC,EAAuB,oBACvBC,EAAmB,+BAEnBC,EAAuC,oCAEvC,MAAMC,KAAgB,OACpB,sOACA,CACE,SAAU,CACR,KAAM,CACJ,GAAI,SACJ,KAAM,UACN,GAAI,SACN,CACF,EACA,gBAAiB,CACf,KAAM,MACR,CACF,CACF,EAgBMN,EAAYG,EAAM,WAA6C,CAACI,EAAOC,IAAiB,CAC5F,KAAM,CAAE,UAAAC,EAAW,KAAAC,EAAM,SAAAC,EAAU,GAAGC,CAAU,EAAIL,EAEpD,SACE,OAAC,OACC,IAAKC,EACJ,GAAGI,EACJ,aAAW,MAAG,4CAA6CH,EAAW,CACpE,sBAAuBC,IAAS,OAChC,qBAAsBA,IAAS,OACjC,CAAC,EAEA,SAAAC,EACH,CAEJ,CAAC,EAEKZ,EAAQI,EAAM,WAClB,CAAC,CAAE,UAAAM,EAAW,KAAAI,EAAM,KAAAC,EAAM,SAAAH,EAAU,GAAGJ,CAAM,EAAGQ,OAE5C,QAAC,OAAI,aAAW,MAAGT,EAAc,CAAE,KAAAQ,CAAK,CAAC,EAAGL,CAAS,EACnD,oBAAC,SACC,KAAMI,EACN,aAAW,MACT,sOACF,EACA,IAAKE,EACJ,GAAGR,EACN,EACCI,GACH,CAGN,EACAZ,EAAM,YAAc,QACpBC,EAAU,YAAc",
4
+ "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../helpers/index.js'\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nconst inputVariants = cva(\n 'ai-border-input ai-w-full ai-bg-background focus-visible:ai-outline-none ai-flex ai-flex-row ai-items-center ai-overflow-hidden ai-rounded-md ai-border',\n {\n variants: {\n size: {\n sm: 'ai-h-8 ai-text-sm',\n base: 'ai-h-10',\n lg: 'ai-h-12 ai-text-lg',\n },\n },\n defaultVariants: {\n size: 'base',\n },\n }\n)\n\nexport interface InputProps extends ComponentPropsWithout<'input', 'size'>, VariantProps<typeof inputVariants> {}\n\ntype InputSlotElement = React.ElementRef<'div'>\ninterface InputSlotProps extends ComponentPropsWithout<'div', RemovedProps> {\n /**\n * \u63D2\u69FD\u7684\u4F4D\u7F6E\n * default: right\n */\n side?: 'left' | 'right'\n}\n\n/**\n * InputSlot\n * \u7528\u6765\u5728 Input \u7EC4\u4EF6\u4E2D\u63D2\u5165\u989D\u5916\u7684\u5185\u5BB9\uFF0C\u6BD4\u5982icon \uFF0C\u6309\u94AE\n */\nconst InputSlot = React.forwardRef<InputSlotElement, InputSlotProps>((props, forwardedRef) => {\n const { className, side = 'right', children, ...slotProps } = props\n\n return (\n <div\n ref={forwardedRef}\n {...slotProps}\n className={cn('ai-flex ai-h-full ai-items-center', className, {\n '-ai-order-1': side === 'left',\n 'ai-order-2': side === 'right',\n })}\n >\n {children}\n </div>\n )\n})\n\nconst Input = React.forwardRef<React.ElementRef<'input'>, InputProps>(\n ({ className, type, size, children, ...props }, ref) => {\n if (!React.isValidElement(children)) {\n return <input type={type} className={cn(inputVariants({ size }), 'ai-px-3', className)} ref={ref} {...props} />\n }\n return (\n <div className={cn(inputVariants({ size }), className)}>\n <input\n type={type}\n className={cn(\n 'placeholder:ai-text-muted-foreground ai-flex ai-size-full file:ai-border-0 file:ai-bg-transparent file:ai-font-medium focus-visible:ai-outline-none disabled:ai-cursor-not-allowed disabled:ai-opacity-50 ai-px-3'\n )}\n ref={ref}\n {...props}\n />\n {children}\n </div>\n )\n }\n)\nInput.displayName = 'Input'\nInputSlot.displayName = 'InputSlot'\n\nexport { Input, InputSlot }\n"],
5
+ "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,cAAAC,IAAA,eAAAC,EAAAJ,GA0CI,IAAAK,EAAA,6BAxCJC,EAAuB,oBACvBC,EAAmB,+BAEnBC,EAAuC,oCAEvC,MAAMC,KAAgB,OACpB,0JACA,CACE,SAAU,CACR,KAAM,CACJ,GAAI,oBACJ,KAAM,UACN,GAAI,oBACN,CACF,EACA,gBAAiB,CACf,KAAM,MACR,CACF,CACF,EAiBMN,EAAYG,EAAM,WAA6C,CAACI,EAAOC,IAAiB,CAC5F,KAAM,CAAE,UAAAC,EAAW,KAAAC,EAAO,QAAS,SAAAC,EAAU,GAAGC,CAAU,EAAIL,EAE9D,SACE,OAAC,OACC,IAAKC,EACJ,GAAGI,EACJ,aAAW,MAAG,oCAAqCH,EAAW,CAC5D,cAAeC,IAAS,OACxB,aAAcA,IAAS,OACzB,CAAC,EAEA,SAAAC,EACH,CAEJ,CAAC,EAEKZ,EAAQI,EAAM,WAClB,CAAC,CAAE,UAAAM,EAAW,KAAAI,EAAM,KAAAC,EAAM,SAAAH,EAAU,GAAGJ,CAAM,EAAGQ,IACzCZ,EAAM,eAAeQ,CAAQ,KAIhC,QAAC,OAAI,aAAW,MAAGL,EAAc,CAAE,KAAAQ,CAAK,CAAC,EAAGL,CAAS,EACnD,oBAAC,SACC,KAAMI,EACN,aAAW,MACT,mNACF,EACA,IAAKE,EACJ,GAAGR,EACN,EACCI,GACH,KAbO,OAAC,SAAM,KAAME,EAAM,aAAW,MAAGP,EAAc,CAAE,KAAAQ,CAAK,CAAC,EAAG,UAAWL,CAAS,EAAG,IAAKM,EAAM,GAAGR,EAAO,CAgBnH,EACAR,EAAM,YAAc,QACpBC,EAAU,YAAc",
6
6
  "names": ["input_exports", "__export", "Input", "InputSlot", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_class_variance_authority", "inputVariants", "props", "forwardedRef", "className", "side", "children", "slotProps", "type", "size", "ref"]
7
7
  }
@@ -9,8 +9,9 @@ export interface InputProps extends ComponentPropsWithout<'input', 'size'>, Vari
9
9
  interface InputSlotProps extends ComponentPropsWithout<'div', RemovedProps> {
10
10
  /**
11
11
  * 插槽的位置
12
+ * default: right
12
13
  */
13
- side: 'left' | 'right';
14
+ side?: 'left' | 'right';
14
15
  }
15
16
  /**
16
17
  * InputSlot
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as d,jsxs as m}from"react/jsx-runtime";import*as s from"react";import{cn as n}from"../helpers/index.js";import{cva as f}from"class-variance-authority";const u=f("ai-border-input ai-bg-background focus-visible:ai-ring-ring ai-ring-offset-background ai-flex ai-flex-row ai-items-center ai-overflow-hidden ai-rounded-md ai-border ai-px-3 focus-visible:ai-ring-2 focus-visible:ai-ring-offset-2",{variants:{size:{sm:"ai-h-8",base:"ai-h-10",lg:"ai-h-12"}},defaultVariants:{size:"base"}}),p=s.forwardRef((i,t)=>{const{className:a,side:e,children:o,...r}=i;return d("div",{ref:t,...r,className:n("ai-flex ai-h-full ai-items-center ai-px-2",a,{"-ai-order-1 ai-pl-0":e==="left","ai-order-2 ai-pr-0":e==="right"}),children:o})}),l=s.forwardRef(({className:i,type:t,size:a,children:e,...o},r)=>m("div",{className:n(u({size:a}),i),children:[d("input",{type:t,className:n("placeholder:ai-text-muted-foreground ai-flex ai-size-full ai-text-sm file:ai-border-0 file:ai-bg-transparent file:ai-text-sm file:ai-font-medium focus-visible:ai-outline-none disabled:ai-cursor-not-allowed disabled:ai-opacity-50"),ref:r,...o}),e]}));l.displayName="Input",p.displayName="InputSlot";export{l as Input,p as InputSlot};
1
+ "use client";import{jsx as p,jsxs as m}from"react/jsx-runtime";import*as s from"react";import{cn as n}from"../helpers/index.js";import{cva as f}from"class-variance-authority";const l=f("ai-border-input ai-w-full ai-bg-background focus-visible:ai-outline-none ai-flex ai-flex-row ai-items-center ai-overflow-hidden ai-rounded-md ai-border",{variants:{size:{sm:"ai-h-8 ai-text-sm",base:"ai-h-10",lg:"ai-h-12 ai-text-lg"}},defaultVariants:{size:"base"}}),d=s.forwardRef((t,i)=>{const{className:a,side:e="right",children:o,...r}=t;return p("div",{ref:i,...r,className:n("ai-flex ai-h-full ai-items-center",a,{"-ai-order-1":e==="left","ai-order-2":e==="right"}),children:o})}),u=s.forwardRef(({className:t,type:i,size:a,children:e,...o},r)=>s.isValidElement(e)?m("div",{className:n(l({size:a}),t),children:[p("input",{type:i,className:n("placeholder:ai-text-muted-foreground ai-flex ai-size-full file:ai-border-0 file:ai-bg-transparent file:ai-font-medium focus-visible:ai-outline-none disabled:ai-cursor-not-allowed disabled:ai-opacity-50 ai-px-3"),ref:r,...o}),e]}):p("input",{type:i,className:n(l({size:a}),"ai-px-3",t),ref:r,...o}));u.displayName="Input",d.displayName="InputSlot";export{u as Input,d as InputSlot};
2
2
  //# sourceMappingURL=input.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/input.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../helpers/index.js'\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nconst inputVariants = cva(\n 'ai-border-input ai-bg-background focus-visible:ai-ring-ring ai-ring-offset-background ai-flex ai-flex-row ai-items-center ai-overflow-hidden ai-rounded-md ai-border ai-px-3 focus-visible:ai-ring-2 focus-visible:ai-ring-offset-2',\n {\n variants: {\n size: {\n sm: 'ai-h-8',\n base: 'ai-h-10',\n lg: 'ai-h-12',\n },\n },\n defaultVariants: {\n size: 'base',\n },\n }\n)\n\nexport interface InputProps extends ComponentPropsWithout<'input', 'size'>, VariantProps<typeof inputVariants> {}\n\ntype InputSlotElement = React.ElementRef<'div'>\ninterface InputSlotProps extends ComponentPropsWithout<'div', RemovedProps> {\n /**\n * \u63D2\u69FD\u7684\u4F4D\u7F6E\n */\n side: 'left' | 'right'\n}\n\n/**\n * InputSlot\n * \u7528\u6765\u5728 Input \u7EC4\u4EF6\u4E2D\u63D2\u5165\u989D\u5916\u7684\u5185\u5BB9\uFF0C\u6BD4\u5982icon \uFF0C\u6309\u94AE\n */\nconst InputSlot = React.forwardRef<InputSlotElement, InputSlotProps>((props, forwardedRef) => {\n const { className, side, children, ...slotProps } = props\n\n return (\n <div\n ref={forwardedRef}\n {...slotProps}\n className={cn('ai-flex ai-h-full ai-items-center ai-px-2', className, {\n '-ai-order-1 ai-pl-0': side === 'left',\n 'ai-order-2 ai-pr-0': side === 'right',\n })}\n >\n {children}\n </div>\n )\n})\n\nconst Input = React.forwardRef<React.ElementRef<'input'>, InputProps>(\n ({ className, type, size, children, ...props }, ref) => {\n return (\n <div className={cn(inputVariants({ size }), className)}>\n <input\n type={type}\n className={cn(\n 'placeholder:ai-text-muted-foreground ai-flex ai-size-full ai-text-sm file:ai-border-0 file:ai-bg-transparent file:ai-text-sm file:ai-font-medium focus-visible:ai-outline-none disabled:ai-cursor-not-allowed disabled:ai-opacity-50'\n )}\n ref={ref}\n {...props}\n />\n {children}\n </div>\n )\n }\n)\nInput.displayName = 'Input'\nInputSlot.displayName = 'InputSlot'\n\nexport { Input, InputSlot }\n"],
5
- "mappings": "aAyCI,cAAAA,EAgBE,QAAAC,MAhBF,oBAvCJ,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,sBAEnB,OAAS,OAAAC,MAA8B,2BAEvC,MAAMC,EAAgBD,EACpB,sOACA,CACE,SAAU,CACR,KAAM,CACJ,GAAI,SACJ,KAAM,UACN,GAAI,SACN,CACF,EACA,gBAAiB,CACf,KAAM,MACR,CACF,CACF,EAgBME,EAAYJ,EAAM,WAA6C,CAACK,EAAOC,IAAiB,CAC5F,KAAM,CAAE,UAAAC,EAAW,KAAAC,EAAM,SAAAC,EAAU,GAAGC,CAAU,EAAIL,EAEpD,OACEP,EAAC,OACC,IAAKQ,EACJ,GAAGI,EACJ,UAAWT,EAAG,4CAA6CM,EAAW,CACpE,sBAAuBC,IAAS,OAChC,qBAAsBA,IAAS,OACjC,CAAC,EAEA,SAAAC,EACH,CAEJ,CAAC,EAEKE,EAAQX,EAAM,WAClB,CAAC,CAAE,UAAAO,EAAW,KAAAK,EAAM,KAAAC,EAAM,SAAAJ,EAAU,GAAGJ,CAAM,EAAGS,IAE5Cf,EAAC,OAAI,UAAWE,EAAGE,EAAc,CAAE,KAAAU,CAAK,CAAC,EAAGN,CAAS,EACnD,UAAAT,EAAC,SACC,KAAMc,EACN,UAAWX,EACT,sOACF,EACA,IAAKa,EACJ,GAAGT,EACN,EACCI,GACH,CAGN,EACAE,EAAM,YAAc,QACpBP,EAAU,YAAc",
4
+ "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../helpers/index.js'\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nconst inputVariants = cva(\n 'ai-border-input ai-w-full ai-bg-background focus-visible:ai-outline-none ai-flex ai-flex-row ai-items-center ai-overflow-hidden ai-rounded-md ai-border',\n {\n variants: {\n size: {\n sm: 'ai-h-8 ai-text-sm',\n base: 'ai-h-10',\n lg: 'ai-h-12 ai-text-lg',\n },\n },\n defaultVariants: {\n size: 'base',\n },\n }\n)\n\nexport interface InputProps extends ComponentPropsWithout<'input', 'size'>, VariantProps<typeof inputVariants> {}\n\ntype InputSlotElement = React.ElementRef<'div'>\ninterface InputSlotProps extends ComponentPropsWithout<'div', RemovedProps> {\n /**\n * \u63D2\u69FD\u7684\u4F4D\u7F6E\n * default: right\n */\n side?: 'left' | 'right'\n}\n\n/**\n * InputSlot\n * \u7528\u6765\u5728 Input \u7EC4\u4EF6\u4E2D\u63D2\u5165\u989D\u5916\u7684\u5185\u5BB9\uFF0C\u6BD4\u5982icon \uFF0C\u6309\u94AE\n */\nconst InputSlot = React.forwardRef<InputSlotElement, InputSlotProps>((props, forwardedRef) => {\n const { className, side = 'right', children, ...slotProps } = props\n\n return (\n <div\n ref={forwardedRef}\n {...slotProps}\n className={cn('ai-flex ai-h-full ai-items-center', className, {\n '-ai-order-1': side === 'left',\n 'ai-order-2': side === 'right',\n })}\n >\n {children}\n </div>\n )\n})\n\nconst Input = React.forwardRef<React.ElementRef<'input'>, InputProps>(\n ({ className, type, size, children, ...props }, ref) => {\n if (!React.isValidElement(children)) {\n return <input type={type} className={cn(inputVariants({ size }), 'ai-px-3', className)} ref={ref} {...props} />\n }\n return (\n <div className={cn(inputVariants({ size }), className)}>\n <input\n type={type}\n className={cn(\n 'placeholder:ai-text-muted-foreground ai-flex ai-size-full file:ai-border-0 file:ai-bg-transparent file:ai-font-medium focus-visible:ai-outline-none disabled:ai-cursor-not-allowed disabled:ai-opacity-50 ai-px-3'\n )}\n ref={ref}\n {...props}\n />\n {children}\n </div>\n )\n }\n)\nInput.displayName = 'Input'\nInputSlot.displayName = 'InputSlot'\n\nexport { Input, InputSlot }\n"],
5
+ "mappings": "aA0CI,cAAAA,EAmBE,QAAAC,MAnBF,oBAxCJ,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,sBAEnB,OAAS,OAAAC,MAA8B,2BAEvC,MAAMC,EAAgBD,EACpB,0JACA,CACE,SAAU,CACR,KAAM,CACJ,GAAI,oBACJ,KAAM,UACN,GAAI,oBACN,CACF,EACA,gBAAiB,CACf,KAAM,MACR,CACF,CACF,EAiBME,EAAYJ,EAAM,WAA6C,CAACK,EAAOC,IAAiB,CAC5F,KAAM,CAAE,UAAAC,EAAW,KAAAC,EAAO,QAAS,SAAAC,EAAU,GAAGC,CAAU,EAAIL,EAE9D,OACEP,EAAC,OACC,IAAKQ,EACJ,GAAGI,EACJ,UAAWT,EAAG,oCAAqCM,EAAW,CAC5D,cAAeC,IAAS,OACxB,aAAcA,IAAS,OACzB,CAAC,EAEA,SAAAC,EACH,CAEJ,CAAC,EAEKE,EAAQX,EAAM,WAClB,CAAC,CAAE,UAAAO,EAAW,KAAAK,EAAM,KAAAC,EAAM,SAAAJ,EAAU,GAAGJ,CAAM,EAAGS,IACzCd,EAAM,eAAeS,CAAQ,EAIhCV,EAAC,OAAI,UAAWE,EAAGE,EAAc,CAAE,KAAAU,CAAK,CAAC,EAAGN,CAAS,EACnD,UAAAT,EAAC,SACC,KAAMc,EACN,UAAWX,EACT,mNACF,EACA,IAAKa,EACJ,GAAGT,EACN,EACCI,GACH,EAbOX,EAAC,SAAM,KAAMc,EAAM,UAAWX,EAAGE,EAAc,CAAE,KAAAU,CAAK,CAAC,EAAG,UAAWN,CAAS,EAAG,IAAKO,EAAM,GAAGT,EAAO,CAgBnH,EACAM,EAAM,YAAc,QACpBP,EAAU,YAAc",
6
6
  "names": ["jsx", "jsxs", "React", "cn", "cva", "inputVariants", "InputSlot", "props", "forwardedRef", "className", "side", "children", "slotProps", "Input", "type", "size", "ref"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anker-in/headless-ui",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "type": "commonjs",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/cjs/index.d.ts",
@@ -6,13 +6,13 @@ import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-p
6
6
  import { cva, type VariantProps } from 'class-variance-authority'
7
7
 
8
8
  const inputVariants = cva(
9
- 'ai-border-input ai-bg-background focus-visible:ai-ring-ring ai-ring-offset-background ai-flex ai-flex-row ai-items-center ai-overflow-hidden ai-rounded-md ai-border ai-px-3 focus-visible:ai-ring-2 focus-visible:ai-ring-offset-2',
9
+ 'ai-border-input ai-w-full ai-bg-background focus-visible:ai-outline-none ai-flex ai-flex-row ai-items-center ai-overflow-hidden ai-rounded-md ai-border',
10
10
  {
11
11
  variants: {
12
12
  size: {
13
- sm: 'ai-h-8',
13
+ sm: 'ai-h-8 ai-text-sm',
14
14
  base: 'ai-h-10',
15
- lg: 'ai-h-12',
15
+ lg: 'ai-h-12 ai-text-lg',
16
16
  },
17
17
  },
18
18
  defaultVariants: {
@@ -27,8 +27,9 @@ type InputSlotElement = React.ElementRef<'div'>
27
27
  interface InputSlotProps extends ComponentPropsWithout<'div', RemovedProps> {
28
28
  /**
29
29
  * 插槽的位置
30
+ * default: right
30
31
  */
31
- side: 'left' | 'right'
32
+ side?: 'left' | 'right'
32
33
  }
33
34
 
34
35
  /**
@@ -36,15 +37,15 @@ interface InputSlotProps extends ComponentPropsWithout<'div', RemovedProps> {
36
37
  * 用来在 Input 组件中插入额外的内容,比如icon ,按钮
37
38
  */
38
39
  const InputSlot = React.forwardRef<InputSlotElement, InputSlotProps>((props, forwardedRef) => {
39
- const { className, side, children, ...slotProps } = props
40
+ const { className, side = 'right', children, ...slotProps } = props
40
41
 
41
42
  return (
42
43
  <div
43
44
  ref={forwardedRef}
44
45
  {...slotProps}
45
- className={cn('ai-flex ai-h-full ai-items-center ai-px-2', className, {
46
- '-ai-order-1 ai-pl-0': side === 'left',
47
- 'ai-order-2 ai-pr-0': side === 'right',
46
+ className={cn('ai-flex ai-h-full ai-items-center', className, {
47
+ '-ai-order-1': side === 'left',
48
+ 'ai-order-2': side === 'right',
48
49
  })}
49
50
  >
50
51
  {children}
@@ -54,12 +55,15 @@ const InputSlot = React.forwardRef<InputSlotElement, InputSlotProps>((props, for
54
55
 
55
56
  const Input = React.forwardRef<React.ElementRef<'input'>, InputProps>(
56
57
  ({ className, type, size, children, ...props }, ref) => {
58
+ if (!React.isValidElement(children)) {
59
+ return <input type={type} className={cn(inputVariants({ size }), 'ai-px-3', className)} ref={ref} {...props} />
60
+ }
57
61
  return (
58
62
  <div className={cn(inputVariants({ size }), className)}>
59
63
  <input
60
64
  type={type}
61
65
  className={cn(
62
- 'placeholder:ai-text-muted-foreground ai-flex ai-size-full ai-text-sm file:ai-border-0 file:ai-bg-transparent file:ai-text-sm file:ai-font-medium focus-visible:ai-outline-none disabled:ai-cursor-not-allowed disabled:ai-opacity-50'
66
+ 'placeholder:ai-text-muted-foreground ai-flex ai-size-full file:ai-border-0 file:ai-bg-transparent file:ai-font-medium focus-visible:ai-outline-none disabled:ai-cursor-not-allowed disabled:ai-opacity-50 ai-px-3'
63
67
  )}
64
68
  ref={ref}
65
69
  {...props}
@@ -154,17 +154,16 @@
154
154
  --brand-color-1: #e42d46;
155
155
  }
156
156
 
157
-
158
157
  :root[data-brand-theme='soundcore'] {
159
- --btn-bg-color: #17BBEF;
158
+ --btn-bg-color: #17bbef;
160
159
  --btn-text-color: #ffffff;
161
160
  --btn-bg-color-active: #48cffa;
162
161
  --btn-bg-disabled-color: #ccdfe8;
163
162
 
164
163
  --btn-bg-secondary-color: #ffffff;
165
- --btn-text-secondary-color: #17BBEF;
166
- --btn-bg-secondary-active-color: #17BBEF;
167
- --btn-bg-secondary-disabled-color: #17BBEF;
164
+ --btn-text-secondary-color: #17bbef;
165
+ --btn-bg-secondary-active-color: #17bbef;
166
+ --btn-bg-secondary-disabled-color: #17bbef;
168
167
 
169
168
  --btn-radius: 30px;
170
169
 
package/style.css CHANGED
@@ -748,10 +748,6 @@ video {
748
748
  .ai-p-6 {
749
749
  padding: 1.5rem;
750
750
  }
751
- .ai-px-2 {
752
- padding-left: 0.5rem;
753
- padding-right: 0.5rem;
754
- }
755
751
  .ai-px-3 {
756
752
  padding-left: 0.75rem;
757
753
  padding-right: 0.75rem;
@@ -776,12 +772,6 @@ video {
776
772
  padding-top: 0.5rem;
777
773
  padding-bottom: 0.5rem;
778
774
  }
779
- .ai-pl-0 {
780
- padding-left: 0px;
781
- }
782
- .ai-pr-0 {
783
- padding-right: 0px;
784
- }
785
775
  .ai-text-left {
786
776
  text-align: left;
787
777
  }
@@ -1073,17 +1063,16 @@ video {
1073
1063
  --brand-color-1: #e42d46;
1074
1064
  }
1075
1065
 
1076
-
1077
1066
  :root[data-brand-theme='soundcore'] {
1078
- --btn-bg-color: #17BBEF;
1067
+ --btn-bg-color: #17bbef;
1079
1068
  --btn-text-color: #ffffff;
1080
1069
  --btn-bg-color-active: #48cffa;
1081
1070
  --btn-bg-disabled-color: #ccdfe8;
1082
1071
 
1083
1072
  --btn-bg-secondary-color: #ffffff;
1084
- --btn-text-secondary-color: #17BBEF;
1085
- --btn-bg-secondary-active-color: #17BBEF;
1086
- --btn-bg-secondary-disabled-color: #17BBEF;
1073
+ --btn-text-secondary-color: #17bbef;
1074
+ --btn-bg-secondary-active-color: #17bbef;
1075
+ --btn-bg-secondary-disabled-color: #17bbef;
1087
1076
 
1088
1077
  --btn-radius: 30px;
1089
1078
 
@@ -1122,11 +1111,6 @@ video {
1122
1111
  background-color: transparent;
1123
1112
  }
1124
1113
 
1125
- .file\:ai-text-sm::file-selector-button {
1126
- font-size: 0.875rem;
1127
- line-height: 1.25rem;
1128
- }
1129
-
1130
1114
  .file\:ai-font-medium::file-selector-button {
1131
1115
  font-weight: 500;
1132
1116
  }