@telegraph/input 0.0.5 → 0.0.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @telegraph/input
2
2
 
3
+ ## 0.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`8d4c7bb`](https://github.com/knocklabs/telegraph/commit/8d4c7bb5031747c185faa31c0bc0aef7bd14d01c)]:
8
+ - @telegraph/helpers@0.0.3
9
+ - @telegraph/layout@0.0.13
10
+
11
+ ## 0.0.6
12
+
13
+ ### Patch Changes
14
+
15
+ - [#124](https://github.com/knocklabs/telegraph/pull/124) [`def3d89`](https://github.com/knocklabs/telegraph/commit/def3d89056aa54c0d24f74e33bc04df8efc712d9) Thanks [@kylemcd](https://github.com/kylemcd)! - better ts support for as prop with custom tgphRef
16
+
17
+ - Updated dependencies [[`04e1459`](https://github.com/knocklabs/telegraph/commit/04e14597ed2148354923023b3668f63387ce63c4), [`def3d89`](https://github.com/knocklabs/telegraph/commit/def3d89056aa54c0d24f74e33bc04df8efc712d9), [`790c5e0`](https://github.com/knocklabs/telegraph/commit/790c5e0626c9b99451214f892def9807165d9572)]:
18
+ - @telegraph/layout@0.0.12
19
+ - @telegraph/helpers@0.0.2
20
+
3
21
  ## 0.0.5
4
22
 
5
23
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("@radix-ui/react-slot"),w=require("@telegraph/compose-refs"),l=require("clsx"),s=require("react"),a={Container:{1:"h-6 pl-0 rounded-2",2:"h-8 pl-0 rounded-2",3:"h-10 pl-0 rounded-3"},Input:{1:"text-1 px-1",2:"text-2 px-2",3:"text-3 px-3"},Slot:{1:"[&>[data-tgph-button]]:rounded-1",2:"[&>[data-tgph-button]]:rounded-1",3:"[&>[data-tgph-button]]:rounded-2"},SlotLeading:{1:"order-1 pl-1",2:"order-1 pl-2",3:"order-1 pl-3"},SlotTrailing:{1:"order-3 pr-1",2:"order-3 pr-2",3:"order-3 pr-3"}},R={Container:{default:{outline:"bg-surface-1 border-gray-6 hover:border-gray-7 focus-within:!border-blue-8",ghost:"bg-transparent border-transparent hover:bg-gray-3 focus-within:!bg-gray-4 focus-within:!border-blue-8"},disabled:{outline:"cursor-not-allowed bg-gray-2 border-gray-2 [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9",ghost:"cursor-not-allowed bg-transparent border border-transparent [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9"},error:{outline:"bg-surface-1 border-red-6",ghost:"bg-transparent border-red-6"}}},g=s.createContext({state:"default",size:"2",variant:"outline"}),b=s.forwardRef(({size:t="2",variant:e="outline",className:n,disabled:o,errored:f,children:x,...y},j)=>{const d=s.useRef(null),S=w.useComposedRefs(j,d),i=o?"disabled":f?"error":"default";return r.jsx(g.Provider,{value:{size:t,variant:e,state:i},children:r.jsxs("div",{className:l("box-border flex items-center transition-all","border-[1px] border-solid text-gray-12 placeholder:text-gray-10",R.Container[i][e],a.Container[t]),onPointerDown:c=>{if(c.target.closest("button, a")){c.preventDefault();return}const p=d.current;p&&requestAnimationFrame(()=>{p.focus()})},children:[r.jsx("input",{className:l("appearance-none text-gray-12 border-none shadow-0 outline-0 bg-transparent","[font-family:inherit] h-full w-full","order-2",a.Input[t],n),disabled:o,...y,ref:S}),x]})})}),u=s.forwardRef(({position:t="leading",...e},n)=>{const o=s.useContext(g);return r.jsx("div",{className:l("group box-border flex items-center justify-center h-full","[&>[data-tgph-button]]:w-full [&>[data-tgph-button]]:h-auto","[&>[data-tgph-button-layout='icon-only']]:aspect-square [&>[data-tgph-button-layout='icon-only']]:p-0","[&>[data-tgph-button-layout='default']]:px-2","[&:has([data-tgph-button-layout='icon-only'])]:aspect-square","[&:has([data-tgph-button-layout='icon-only'])]:!p-1",t==="leading"&&a.SlotLeading[o.size],t==="trailing"&&a.SlotTrailing[o.size],a.Slot[e.size??o.size]),children:r.jsx(m.Slot,{size:o.size,...e,ref:n})})}),h=({LeadingComponent:t,TrailingComponent:e,...n})=>r.jsxs(b,{...n,children:[t&&r.jsx(u,{position:"leading",children:t}),e&&r.jsx(u,{position:"trailing",children:e})]});Object.assign(h,{Root:b,Slot:u});const q=h;exports.Input=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),q=require("@radix-ui/react-slot"),C=require("@telegraph/compose-refs"),b=require("@telegraph/layout"),l=require("clsx"),s=require("react"),a={Container:{1:"h-6 pl-0 rounded-2",2:"h-8 pl-0 rounded-2",3:"h-10 pl-0 rounded-3"},Input:{1:"text-1 px-1",2:"text-2 px-2",3:"text-3 px-3"},Slot:{1:"[&>[data-tgph-button]]:rounded-1",2:"[&>[data-tgph-button]]:rounded-1",3:"[&>[data-tgph-button]]:rounded-2"},SlotLeading:{1:"order-1 pl-1",2:"order-1 pl-2",3:"order-1 pl-3"},SlotTrailing:{1:"order-3 pr-1",2:"order-3 pr-2",3:"order-3 pr-3"}},I={Container:{default:{outline:"bg-surface-1 border-gray-6 hover:border-gray-7 focus-within:!border-blue-8",ghost:"bg-transparent border-transparent hover:bg-gray-3 focus-within:!bg-gray-4 focus-within:!border-blue-8"},disabled:{outline:"cursor-not-allowed bg-gray-2 border-gray-2 [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9",ghost:"cursor-not-allowed bg-transparent border border-transparent [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9"},error:{outline:"bg-surface-1 border-red-6",ghost:"bg-transparent border-red-6"}}},h=s.createContext({state:"default",size:"2",variant:"outline"}),x=({as:r="input",size:t="2",variant:o="outline",className:n,disabled:d,errored:y,children:j,tgphRef:m,...S})=>{const w=r,i=s.useRef(null),R=C.useComposedRefs(m,i),c=d?"disabled":y?"error":"default";return e.jsx(h.Provider,{value:{size:t,variant:o,state:c},children:e.jsxs(b.Box,{className:l("box-border flex items-center transition-all","border-[1px] border-solid text-gray-12 placeholder:text-gray-10",I.Container[c][o],a.Container[t]),onPointerDown:p=>{if(p.target.closest("button, a")){p.preventDefault();return}const g=i.current;g&&requestAnimationFrame(()=>{g.focus()})},children:[e.jsx(w,{className:l("appearance-none text-gray-12 border-none shadow-0 outline-0 bg-transparent","[font-family:inherit] h-full w-full","order-2",a.Input[t],n),disabled:d,...S,ref:R}),j]})})},u=s.forwardRef(({position:r="leading",...t},o)=>{const n=s.useContext(h);return e.jsx(b.Box,{className:l("group box-border flex items-center justify-center h-full","[&>[data-tgph-button]]:w-full [&>[data-tgph-button]]:h-auto","[&>[data-tgph-button-layout='icon-only']]:aspect-square [&>[data-tgph-button-layout='icon-only']]:p-0","[&>[data-tgph-button-layout='default']]:px-2","[&:has([data-tgph-button-layout='icon-only'])]:aspect-square","[&:has([data-tgph-button-layout='icon-only'])]:!p-1",r==="leading"&&a.SlotLeading[n.size],r==="trailing"&&a.SlotTrailing[n.size],a.Slot[t.size??n.size]),children:e.jsx(q.Slot,{size:n.size,...t,ref:o})})}),f=({LeadingComponent:r,TrailingComponent:t,...o})=>e.jsxs(x,{...o,children:[r&&e.jsx(u,{position:"leading",children:r}),t&&e.jsx(u,{position:"trailing",children:t})]});Object.assign(f,{Root:x,Slot:u});const v=f;exports.Input=v;
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/Input/Input.constants.ts","../../src/Input/Input.tsx"],"sourcesContent":["export const SIZE = {\n Container: {\n \"1\": \"h-6 pl-0 rounded-2\",\n \"2\": \"h-8 pl-0 rounded-2\",\n \"3\": \"h-10 pl-0 rounded-3\",\n },\n Input: {\n \"1\": \"text-1 px-1\",\n \"2\": \"text-2 px-2\",\n \"3\": \"text-3 px-3\",\n },\n Slot: {\n \"1\": \"[&>[data-tgph-button]]:rounded-1\",\n \"2\": \"[&>[data-tgph-button]]:rounded-1\",\n \"3\": \"[&>[data-tgph-button]]:rounded-2\",\n },\n SlotLeading: {\n \"1\": \"order-1 pl-1\",\n \"2\": \"order-1 pl-2\",\n \"3\": \"order-1 pl-3\",\n },\n SlotTrailing: {\n \"1\": \"order-3 pr-1\",\n \"2\": \"order-3 pr-2\",\n \"3\": \"order-3 pr-3\",\n },\n} as const;\n\nexport const COLOR = {\n Container: {\n default: {\n outline:\n \"bg-surface-1 border-gray-6 hover:border-gray-7 focus-within:!border-blue-8\",\n ghost:\n \"bg-transparent border-transparent hover:bg-gray-3 focus-within:!bg-gray-4 focus-within:!border-blue-8\",\n },\n disabled: {\n outline:\n \"cursor-not-allowed bg-gray-2 border-gray-2 [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9\",\n ghost:\n \"cursor-not-allowed bg-transparent border border-transparent [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9\",\n },\n error: {\n outline: \"bg-surface-1 border-red-6\",\n ghost: \"bg-transparent border-red-6\",\n },\n },\n} as const;\n","import { Slot as RadixSlot } from \"@radix-ui/react-slot\";\nimport { useComposedRefs } from \"@telegraph/compose-refs\";\nimport type { Required } from \"@telegraph/helpers\";\nimport clsx from \"clsx\";\nimport React from \"react\";\n\nimport { COLOR, SIZE } from \"./Input.constants\";\n\ntype BaseRootProps = {\n size?: keyof typeof SIZE.Container;\n variant?: keyof typeof COLOR.Container.default;\n errored?: boolean;\n};\n\ntype RootProps = BaseRootProps &\n Omit<React.ComponentPropsWithoutRef<\"input\">, \"size\">;\n\ntype RootRef = HTMLInputElement;\n\ntype InternalProps = Omit<BaseRootProps, \"errored\"> & {\n state: \"default\" | \"disabled\" | \"error\";\n};\n\nconst InputContext = React.createContext<Required<InternalProps>>({\n state: \"default\",\n size: \"2\",\n variant: \"outline\",\n});\n\nconst Root = React.forwardRef<RootRef, RootProps>(\n (\n {\n size = \"2\",\n variant = \"outline\",\n className,\n disabled,\n errored,\n children,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, inputRef);\n\n const state = disabled ? \"disabled\" : errored ? \"error\" : \"default\";\n\n return (\n <InputContext.Provider value={{ size, variant, state }}>\n <div\n className={clsx(\n \"box-border flex items-center transition-all\",\n \"border-[1px] border-solid text-gray-12 placeholder:text-gray-10\",\n COLOR.Container[state][variant],\n SIZE.Container[size],\n )}\n // Focus the input when clicking on the container\n onPointerDown={(event) => {\n const target = event.target as HTMLElement;\n\n // Make sure we're not clicking on an interactive element\n if (target.closest(\"button, a\")) {\n event.preventDefault();\n return;\n }\n\n const input = inputRef.current;\n if (!input) return;\n\n requestAnimationFrame(() => {\n input.focus();\n });\n }}\n >\n <input\n className={clsx(\n \"appearance-none text-gray-12 border-none shadow-0 outline-0 bg-transparent\",\n \"[font-family:inherit] h-full w-full\",\n \"order-2\",\n SIZE.Input[size],\n className,\n )}\n disabled={disabled}\n {...props}\n ref={composedRefs}\n />\n {children}\n </div>\n </InputContext.Provider>\n );\n },\n);\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof RadixSlot> & {\n size?: keyof typeof SIZE.Slot;\n position?: \"leading\" | \"trailing\";\n};\ntype SlotRef = React.ElementRef<typeof RadixSlot>;\n\nconst Slot = React.forwardRef<SlotRef, SlotProps>(\n ({ position = \"leading\", ...props }, forwardedRef) => {\n const context = React.useContext(InputContext);\n return (\n <div\n className={clsx(\n \"group box-border flex items-center justify-center h-full\",\n \"[&>[data-tgph-button]]:w-full [&>[data-tgph-button]]:h-auto\",\n // Overrides to match the icon button in figma\n \"[&>[data-tgph-button-layout='icon-only']]:aspect-square [&>[data-tgph-button-layout='icon-only']]:p-0\",\n // Overrides default button layout to match the button in figma\n \"[&>[data-tgph-button-layout='default']]:px-2\",\n // If only an icon button is present, set the aspect ratio to square\n \"[&:has([data-tgph-button-layout='icon-only'])]:aspect-square\",\n // If only an icon button is present, reset the padding to spacing-1\n \"[&:has([data-tgph-button-layout='icon-only'])]:!p-1\",\n position === \"leading\" && SIZE.SlotLeading[context.size],\n position === \"trailing\" && SIZE.SlotTrailing[context.size],\n SIZE.Slot[props.size ?? context.size],\n )}\n >\n <RadixSlot size={context.size} {...props} ref={forwardedRef} />\n </div>\n );\n },\n);\n\ntype DefaultProps = React.ComponentPropsWithoutRef<typeof Root> & {\n LeadingComponent?: React.ReactNode;\n TrailingComponent?: React.ReactNode;\n};\n\nconst Default = ({\n LeadingComponent,\n TrailingComponent,\n ...props\n}: DefaultProps) => {\n return (\n <Root {...props}>\n {LeadingComponent && <Slot position=\"leading\">{LeadingComponent}</Slot>}\n {TrailingComponent && (\n <Slot position=\"trailing\">{TrailingComponent}</Slot>\n )}\n </Root>\n );\n};\n\nObject.assign(Default, { Root, Slot });\n\nconst Input = Default as typeof Default & {\n Root: typeof Root;\n Slot: typeof Slot;\n};\n\nexport { Input };\n"],"names":["SIZE","COLOR","InputContext","React","Root","size","variant","className","disabled","errored","children","props","forwardedRef","inputRef","composedRefs","useComposedRefs","state","jsx","jsxs","clsx","event","input","Slot","position","context","RadixSlot","Default","LeadingComponent","TrailingComponent","Input"],"mappings":"iOAAaA,EAAO,CAClB,UAAW,CACT,EAAK,qBACL,EAAK,qBACL,EAAK,qBACP,EACA,MAAO,CACL,EAAK,cACL,EAAK,cACL,EAAK,aACP,EACA,KAAM,CACJ,EAAK,mCACL,EAAK,mCACL,EAAK,kCACP,EACA,YAAa,CACX,EAAK,eACL,EAAK,eACL,EAAK,cACP,EACA,aAAc,CACZ,EAAK,eACL,EAAK,eACL,EAAK,cACP,CACF,EAEaC,EAAQ,CACnB,UAAW,CACT,QAAS,CACP,QACE,6EACF,MACE,uGACJ,EACA,SAAU,CACR,QACE,4HACF,MACE,4IACJ,EACA,MAAO,CACL,QAAS,4BACT,MAAO,6BACT,CACF,CACF,ECxBMC,EAAeC,EAAM,cAAuC,CAChE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AK,KAAKW,EAAM,MAAQa,EAAQ,IAAI,CACtC,EAEA,SAAAP,EAAA,IAACQ,QAAU,KAAMD,EAAQ,KAAO,GAAGb,EAAO,IAAKC,EAAc,CAAA,CAAA,CAGnE,CACF,EAOMc,EAAU,CAAC,CACf,iBAAAC,EACA,kBAAAC,EACA,GAAGjB,CACL,IAEIO,EAAA,KAACd,EAAM,CAAA,GAAGO,EACP,SAAA,CAAAgB,GAAqBV,EAAA,IAAAK,EAAA,CAAK,SAAS,UAAW,SAAiBK,EAAA,EAC/DC,GACCX,EAAA,IAACK,EAAK,CAAA,SAAS,WAAY,SAAkBM,EAAA,CAEjD,CAAA,CAAA,EAIJ,OAAO,OAAOF,EAAS,CAAE,KAAAtB,EAAM,KAAAkB,CAAM,CAAA,EAErC,MAAMO,EAAQH"}
1
+ {"version":3,"file":"index.js","sources":["../../src/Input/Input.constants.ts","../../src/Input/Input.tsx"],"sourcesContent":["export const SIZE = {\n Container: {\n \"1\": \"h-6 pl-0 rounded-2\",\n \"2\": \"h-8 pl-0 rounded-2\",\n \"3\": \"h-10 pl-0 rounded-3\",\n },\n Input: {\n \"1\": \"text-1 px-1\",\n \"2\": \"text-2 px-2\",\n \"3\": \"text-3 px-3\",\n },\n Slot: {\n \"1\": \"[&>[data-tgph-button]]:rounded-1\",\n \"2\": \"[&>[data-tgph-button]]:rounded-1\",\n \"3\": \"[&>[data-tgph-button]]:rounded-2\",\n },\n SlotLeading: {\n \"1\": \"order-1 pl-1\",\n \"2\": \"order-1 pl-2\",\n \"3\": \"order-1 pl-3\",\n },\n SlotTrailing: {\n \"1\": \"order-3 pr-1\",\n \"2\": \"order-3 pr-2\",\n \"3\": \"order-3 pr-3\",\n },\n} as const;\n\nexport const COLOR = {\n Container: {\n default: {\n outline:\n \"bg-surface-1 border-gray-6 hover:border-gray-7 focus-within:!border-blue-8\",\n ghost:\n \"bg-transparent border-transparent hover:bg-gray-3 focus-within:!bg-gray-4 focus-within:!border-blue-8\",\n },\n disabled: {\n outline:\n \"cursor-not-allowed bg-gray-2 border-gray-2 [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9\",\n ghost:\n \"cursor-not-allowed bg-transparent border border-transparent [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9\",\n },\n error: {\n outline: \"bg-surface-1 border-red-6\",\n ghost: \"bg-transparent border-red-6\",\n },\n },\n} as const;\n","import { Slot as RadixSlot } from \"@radix-ui/react-slot\";\nimport { useComposedRefs } from \"@telegraph/compose-refs\";\nimport type {\n PolymorphicProps,\n PolymorphicPropsWithTgphRef,\n Required,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Box } from \"@telegraph/layout\";\nimport clsx from \"clsx\";\nimport React from \"react\";\n\nimport { COLOR, SIZE } from \"./Input.constants\";\n\ntype BaseRootProps = {\n size?: keyof typeof SIZE.Container;\n variant?: keyof typeof COLOR.Container.default;\n errored?: boolean;\n};\n\ntype RootProps<T extends TgphElement> = Omit<\n PolymorphicPropsWithTgphRef<T, HTMLInputElement>,\n \"size\"\n> &\n BaseRootProps;\n\ntype InternalProps = Omit<BaseRootProps, \"errored\"> & {\n state: \"default\" | \"disabled\" | \"error\";\n};\n\nconst InputContext = React.createContext<Required<InternalProps>>({\n state: \"default\",\n size: \"2\",\n variant: \"outline\",\n});\n\nconst Root = <T extends TgphElement>({\n as = \"input\" as T,\n size = \"2\",\n variant = \"outline\",\n className,\n disabled,\n errored,\n children,\n tgphRef,\n ...props\n}: RootProps<T>) => {\n const Component = as;\n const inputRef = React.useRef<HTMLInputElement>(null);\n const composedRefs = useComposedRefs(tgphRef, inputRef);\n\n const state = disabled ? \"disabled\" : errored ? \"error\" : \"default\";\n\n return (\n <InputContext.Provider value={{ size, variant, state }}>\n <Box\n className={clsx(\n \"box-border flex items-center transition-all\",\n \"border-[1px] border-solid text-gray-12 placeholder:text-gray-10\",\n COLOR.Container[state][variant],\n SIZE.Container[size],\n )}\n // Focus the input when clicking on the container\n onPointerDown={(event: React.MouseEvent<HTMLDivElement>) => {\n const target = event.target as HTMLElement;\n\n // Make sure we're not clicking on an interactive element\n if (target.closest(\"button, a\")) {\n event.preventDefault();\n return;\n }\n\n const input = inputRef.current;\n if (!input) return;\n\n requestAnimationFrame(() => {\n input.focus();\n });\n }}\n >\n <Component\n className={clsx(\n \"appearance-none text-gray-12 border-none shadow-0 outline-0 bg-transparent\",\n \"[font-family:inherit] h-full w-full\",\n \"order-2\",\n SIZE.Input[size],\n className,\n )}\n disabled={disabled}\n {...props}\n ref={composedRefs}\n />\n {children}\n </Box>\n </InputContext.Provider>\n );\n};\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof RadixSlot> & {\n size?: keyof typeof SIZE.Slot;\n position?: \"leading\" | \"trailing\";\n};\ntype SlotRef = React.ElementRef<typeof RadixSlot>;\n\nconst Slot = React.forwardRef<SlotRef, SlotProps>(\n ({ position = \"leading\", ...props }, forwardedRef) => {\n const context = React.useContext(InputContext);\n return (\n <Box\n className={clsx(\n \"group box-border flex items-center justify-center h-full\",\n \"[&>[data-tgph-button]]:w-full [&>[data-tgph-button]]:h-auto\",\n // Overrides to match the icon button in figma\n \"[&>[data-tgph-button-layout='icon-only']]:aspect-square [&>[data-tgph-button-layout='icon-only']]:p-0\",\n // Overrides default button layout to match the button in figma\n \"[&>[data-tgph-button-layout='default']]:px-2\",\n // If only an icon button is present, set the aspect ratio to square\n \"[&:has([data-tgph-button-layout='icon-only'])]:aspect-square\",\n // If only an icon button is present, reset the padding to spacing-1\n \"[&:has([data-tgph-button-layout='icon-only'])]:!p-1\",\n position === \"leading\" && SIZE.SlotLeading[context.size],\n position === \"trailing\" && SIZE.SlotTrailing[context.size],\n SIZE.Slot[props.size ?? context.size],\n )}\n >\n <RadixSlot size={context.size} {...props} ref={forwardedRef} />\n </Box>\n );\n },\n);\n\ntype DefaultProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Root> & {\n LeadingComponent?: React.ReactNode;\n TrailingComponent?: React.ReactNode;\n };\n\nconst Default = <T extends TgphElement>({\n LeadingComponent,\n TrailingComponent,\n ...props\n}: DefaultProps<T>) => {\n return (\n <Root {...props}>\n {LeadingComponent && <Slot position=\"leading\">{LeadingComponent}</Slot>}\n {TrailingComponent && (\n <Slot position=\"trailing\">{TrailingComponent}</Slot>\n )}\n </Root>\n );\n};\n\nObject.assign(Default, { Root, Slot });\n\nconst Input = Default as typeof Default & {\n Root: typeof Root;\n Slot: typeof Slot;\n};\n\nexport { Input };\n"],"names":["SIZE","COLOR","InputContext","React","Root","as","size","variant","className","disabled","errored","children","tgphRef","props","Component","inputRef","composedRefs","useComposedRefs","state","jsx","jsxs","Box","clsx","event","input","Slot","position","forwardedRef","context","RadixSlot","Default","LeadingComponent","TrailingComponent","Input"],"mappings":"gQAAaA,EAAO,CAClB,UAAW,CACT,EAAK,qBACL,EAAK,qBACL,EAAK,qBACP,EACA,MAAO,CACL,EAAK,cACL,EAAK,cACL,EAAK,aACP,EACA,KAAM,CACJ,EAAK,mCACL,EAAK,mCACL,EAAK,kCACP,EACA,YAAa,CACX,EAAK,eACL,EAAK,eACL,EAAK,cACP,EACA,aAAc,CACZ,EAAK,eACL,EAAK,eACL,EAAK,cACP,CACF,EAEaC,EAAQ,CACnB,UAAW,CACT,QAAS,CACP,QACE,6EACF,MACE,uGACJ,EACA,SAAU,CACR,QACE,4HACF,MACE,4IACJ,EACA,MAAO,CACL,QAAS,4BACT,MAAO,6BACT,CACF,CACF,EChBMC,EAAeC,EAAM,cAAuC,CAChE,MAAO,UACP,KAAM,IACN,QAAS,SACX,CAAC,EAEKC,EAAO,CAAwB,CACnC,GAAAC,EAAK,QACL,KAAAC,EAAO,IACP,QAAAC,EAAU,UACV,UAAAC,EACA,SAAAC,EACA,QAAAC,EACA,SAAAC,EACA,QAAAC,EACA,GAAGC,CACL,IAAoB,CAClB,MAAMC,EAAYT,EACZU,EAAWZ,EAAM,OAAyB,IAAI,EAC9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IAEIO,EAAA,KAAChB,EAAM,CAAA,GAAGS,EACP,SAAA,CAAAkB,GAAqBZ,EAAA,IAAAM,EAAA,CAAK,SAAS,UAAW,SAAiBM,EAAA,EAC/DC,GACCb,EAAA,IAACM,EAAK,CAAA,SAAS,WAAY,SAAkBO,EAAA,CAEjD,CAAA,CAAA,EAIJ,OAAO,OAAOF,EAAS,CAAE,KAAA1B,EAAM,KAAAqB,CAAM,CAAA,EAErC,MAAMQ,EAAQH"}
@@ -1,6 +1,7 @@
1
- import { jsx as o, jsxs as g } from "react/jsx-runtime";
2
- import { Slot as R } from "@radix-ui/react-slot";
3
- import { useComposedRefs as C } from "@telegraph/compose-refs";
1
+ import { jsx as n, jsxs as b } from "react/jsx-runtime";
2
+ import { Slot as I } from "@radix-ui/react-slot";
3
+ import { useComposedRefs as j } from "@telegraph/compose-refs";
4
+ import { Box as h } from "@telegraph/layout";
4
5
  import d from "clsx";
5
6
  import l from "react";
6
7
  const a = {
@@ -44,66 +45,66 @@ const a = {
44
45
  ghost: "bg-transparent border-red-6"
45
46
  }
46
47
  }
47
- }, b = l.createContext({
48
+ }, f = l.createContext({
48
49
  state: "default",
49
50
  size: "2",
50
51
  variant: "outline"
51
- }), h = l.forwardRef(
52
- ({
53
- size: t = "2",
54
- variant: r = "outline",
55
- className: n,
56
- disabled: e,
57
- errored: x,
58
- children: y,
59
- ...m
60
- }, w) => {
61
- const u = l.useRef(null), S = C(w, u), s = e ? "disabled" : x ? "error" : "default";
62
- return /* @__PURE__ */ o(b.Provider, { value: { size: t, variant: r, state: s }, children: /* @__PURE__ */ g(
63
- "div",
64
- {
65
- className: d(
66
- "box-border flex items-center transition-all",
67
- "border-[1px] border-solid text-gray-12 placeholder:text-gray-10",
68
- v.Container[s][r],
69
- a.Container[t]
70
- ),
71
- onPointerDown: (p) => {
72
- if (p.target.closest("button, a")) {
73
- p.preventDefault();
74
- return;
52
+ }), x = ({
53
+ as: r = "input",
54
+ size: t = "2",
55
+ variant: e = "outline",
56
+ className: o,
57
+ disabled: u,
58
+ errored: m,
59
+ children: w,
60
+ tgphRef: S,
61
+ ...C
62
+ }) => {
63
+ const R = r, i = l.useRef(null), z = j(S, i), p = u ? "disabled" : m ? "error" : "default";
64
+ return /* @__PURE__ */ n(f.Provider, { value: { size: t, variant: e, state: p }, children: /* @__PURE__ */ b(
65
+ h,
66
+ {
67
+ className: d(
68
+ "box-border flex items-center transition-all",
69
+ "border-[1px] border-solid text-gray-12 placeholder:text-gray-10",
70
+ v.Container[p][e],
71
+ a.Container[t]
72
+ ),
73
+ onPointerDown: (c) => {
74
+ if (c.target.closest("button, a")) {
75
+ c.preventDefault();
76
+ return;
77
+ }
78
+ const g = i.current;
79
+ g && requestAnimationFrame(() => {
80
+ g.focus();
81
+ });
82
+ },
83
+ children: [
84
+ /* @__PURE__ */ n(
85
+ R,
86
+ {
87
+ className: d(
88
+ "appearance-none text-gray-12 border-none shadow-0 outline-0 bg-transparent",
89
+ "[font-family:inherit] h-full w-full",
90
+ "order-2",
91
+ a.Input[t],
92
+ o
93
+ ),
94
+ disabled: u,
95
+ ...C,
96
+ ref: z
75
97
  }
76
- const c = u.current;
77
- c && requestAnimationFrame(() => {
78
- c.focus();
79
- });
80
- },
81
- children: [
82
- /* @__PURE__ */ o(
83
- "input",
84
- {
85
- className: d(
86
- "appearance-none text-gray-12 border-none shadow-0 outline-0 bg-transparent",
87
- "[font-family:inherit] h-full w-full",
88
- "order-2",
89
- a.Input[t],
90
- n
91
- ),
92
- disabled: e,
93
- ...m,
94
- ref: S
95
- }
96
- ),
97
- y
98
- ]
99
- }
100
- ) });
101
- }
102
- ), i = l.forwardRef(
103
- ({ position: t = "leading", ...r }, n) => {
104
- const e = l.useContext(b);
105
- return /* @__PURE__ */ o(
106
- "div",
98
+ ),
99
+ w
100
+ ]
101
+ }
102
+ ) });
103
+ }, s = l.forwardRef(
104
+ ({ position: r = "leading", ...t }, e) => {
105
+ const o = l.useContext(f);
106
+ return /* @__PURE__ */ n(
107
+ h,
107
108
  {
108
109
  className: d(
109
110
  "group box-border flex items-center justify-center h-full",
@@ -116,25 +117,25 @@ const a = {
116
117
  "[&:has([data-tgph-button-layout='icon-only'])]:aspect-square",
117
118
  // If only an icon button is present, reset the padding to spacing-1
118
119
  "[&:has([data-tgph-button-layout='icon-only'])]:!p-1",
119
- t === "leading" && a.SlotLeading[e.size],
120
- t === "trailing" && a.SlotTrailing[e.size],
121
- a.Slot[r.size ?? e.size]
120
+ r === "leading" && a.SlotLeading[o.size],
121
+ r === "trailing" && a.SlotTrailing[o.size],
122
+ a.Slot[t.size ?? o.size]
122
123
  ),
123
- children: /* @__PURE__ */ o(R, { size: e.size, ...r, ref: n })
124
+ children: /* @__PURE__ */ n(I, { size: o.size, ...t, ref: e })
124
125
  }
125
126
  );
126
127
  }
127
- ), f = ({
128
- LeadingComponent: t,
129
- TrailingComponent: r,
130
- ...n
131
- }) => /* @__PURE__ */ g(h, { ...n, children: [
132
- t && /* @__PURE__ */ o(i, { position: "leading", children: t }),
133
- r && /* @__PURE__ */ o(i, { position: "trailing", children: r })
128
+ ), y = ({
129
+ LeadingComponent: r,
130
+ TrailingComponent: t,
131
+ ...e
132
+ }) => /* @__PURE__ */ b(x, { ...e, children: [
133
+ r && /* @__PURE__ */ n(s, { position: "leading", children: r }),
134
+ t && /* @__PURE__ */ n(s, { position: "trailing", children: t })
134
135
  ] });
135
- Object.assign(f, { Root: h, Slot: i });
136
- const O = f;
136
+ Object.assign(y, { Root: x, Slot: s });
137
+ const A = y;
137
138
  export {
138
- O as Input
139
+ A as Input
139
140
  };
140
141
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/Input/Input.constants.ts","../../src/Input/Input.tsx"],"sourcesContent":["export const SIZE = {\n Container: {\n \"1\": \"h-6 pl-0 rounded-2\",\n \"2\": \"h-8 pl-0 rounded-2\",\n \"3\": \"h-10 pl-0 rounded-3\",\n },\n Input: {\n \"1\": \"text-1 px-1\",\n \"2\": \"text-2 px-2\",\n \"3\": \"text-3 px-3\",\n },\n Slot: {\n \"1\": \"[&>[data-tgph-button]]:rounded-1\",\n \"2\": \"[&>[data-tgph-button]]:rounded-1\",\n \"3\": \"[&>[data-tgph-button]]:rounded-2\",\n },\n SlotLeading: {\n \"1\": \"order-1 pl-1\",\n \"2\": \"order-1 pl-2\",\n \"3\": \"order-1 pl-3\",\n },\n SlotTrailing: {\n \"1\": \"order-3 pr-1\",\n \"2\": \"order-3 pr-2\",\n \"3\": \"order-3 pr-3\",\n },\n} as const;\n\nexport const COLOR = {\n Container: {\n default: {\n outline:\n \"bg-surface-1 border-gray-6 hover:border-gray-7 focus-within:!border-blue-8\",\n ghost:\n \"bg-transparent border-transparent hover:bg-gray-3 focus-within:!bg-gray-4 focus-within:!border-blue-8\",\n },\n disabled: {\n outline:\n \"cursor-not-allowed bg-gray-2 border-gray-2 [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9\",\n ghost:\n \"cursor-not-allowed bg-transparent border border-transparent [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9\",\n },\n error: {\n outline: \"bg-surface-1 border-red-6\",\n ghost: \"bg-transparent border-red-6\",\n },\n },\n} as const;\n","import { Slot as RadixSlot } from \"@radix-ui/react-slot\";\nimport { useComposedRefs } from \"@telegraph/compose-refs\";\nimport type { Required } from \"@telegraph/helpers\";\nimport clsx from \"clsx\";\nimport React from \"react\";\n\nimport { COLOR, SIZE } from \"./Input.constants\";\n\ntype BaseRootProps = {\n size?: keyof typeof SIZE.Container;\n variant?: keyof typeof COLOR.Container.default;\n errored?: boolean;\n};\n\ntype RootProps = BaseRootProps &\n Omit<React.ComponentPropsWithoutRef<\"input\">, \"size\">;\n\ntype RootRef = HTMLInputElement;\n\ntype InternalProps = Omit<BaseRootProps, \"errored\"> & {\n state: \"default\" | \"disabled\" | \"error\";\n};\n\nconst InputContext = React.createContext<Required<InternalProps>>({\n state: \"default\",\n size: \"2\",\n variant: \"outline\",\n});\n\nconst Root = React.forwardRef<RootRef, RootProps>(\n (\n {\n size = \"2\",\n variant = \"outline\",\n className,\n disabled,\n errored,\n children,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, inputRef);\n\n const state = disabled ? \"disabled\" : errored ? \"error\" : \"default\";\n\n return (\n <InputContext.Provider value={{ size, variant, state }}>\n <div\n className={clsx(\n \"box-border flex items-center transition-all\",\n \"border-[1px] border-solid text-gray-12 placeholder:text-gray-10\",\n COLOR.Container[state][variant],\n SIZE.Container[size],\n )}\n // Focus the input when clicking on the container\n onPointerDown={(event) => {\n const target = event.target as HTMLElement;\n\n // Make sure we're not clicking on an interactive element\n if (target.closest(\"button, a\")) {\n event.preventDefault();\n return;\n }\n\n const input = inputRef.current;\n if (!input) return;\n\n requestAnimationFrame(() => {\n input.focus();\n });\n }}\n >\n <input\n className={clsx(\n \"appearance-none text-gray-12 border-none shadow-0 outline-0 bg-transparent\",\n \"[font-family:inherit] h-full w-full\",\n \"order-2\",\n SIZE.Input[size],\n className,\n )}\n disabled={disabled}\n {...props}\n ref={composedRefs}\n />\n {children}\n </div>\n </InputContext.Provider>\n );\n },\n);\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof RadixSlot> & {\n size?: keyof typeof SIZE.Slot;\n position?: \"leading\" | \"trailing\";\n};\ntype SlotRef = React.ElementRef<typeof RadixSlot>;\n\nconst Slot = React.forwardRef<SlotRef, SlotProps>(\n ({ position = \"leading\", ...props }, forwardedRef) => {\n const context = React.useContext(InputContext);\n return (\n <div\n className={clsx(\n \"group box-border flex items-center justify-center h-full\",\n \"[&>[data-tgph-button]]:w-full [&>[data-tgph-button]]:h-auto\",\n // Overrides to match the icon button in figma\n \"[&>[data-tgph-button-layout='icon-only']]:aspect-square [&>[data-tgph-button-layout='icon-only']]:p-0\",\n // Overrides default button layout to match the button in figma\n \"[&>[data-tgph-button-layout='default']]:px-2\",\n // If only an icon button is present, set the aspect ratio to square\n \"[&:has([data-tgph-button-layout='icon-only'])]:aspect-square\",\n // If only an icon button is present, reset the padding to spacing-1\n \"[&:has([data-tgph-button-layout='icon-only'])]:!p-1\",\n position === \"leading\" && SIZE.SlotLeading[context.size],\n position === \"trailing\" && SIZE.SlotTrailing[context.size],\n SIZE.Slot[props.size ?? context.size],\n )}\n >\n <RadixSlot size={context.size} {...props} ref={forwardedRef} />\n </div>\n );\n },\n);\n\ntype DefaultProps = React.ComponentPropsWithoutRef<typeof Root> & {\n LeadingComponent?: React.ReactNode;\n TrailingComponent?: React.ReactNode;\n};\n\nconst Default = ({\n LeadingComponent,\n TrailingComponent,\n ...props\n}: DefaultProps) => {\n return (\n <Root {...props}>\n {LeadingComponent && <Slot position=\"leading\">{LeadingComponent}</Slot>}\n {TrailingComponent && (\n <Slot position=\"trailing\">{TrailingComponent}</Slot>\n )}\n </Root>\n );\n};\n\nObject.assign(Default, { Root, Slot });\n\nconst Input = Default as typeof Default & {\n Root: typeof Root;\n Slot: typeof Slot;\n};\n\nexport { Input };\n"],"names":["SIZE","COLOR","InputContext","React","Root","size","variant","className","disabled","errored","children","props","forwardedRef","inputRef","composedRefs","useComposedRefs","state","jsx","jsxs","clsx","event","input","Slot","position","context","RadixSlot","Default","LeadingComponent","TrailingComponent","Input"],"mappings":";;;;;AAAO,MAAMA,IAAO;AAAA,EAClB,WAAW;AAAA,IACT,GAAK;AAAA,IACL,GAAK;AAAA,IACL,GAAK;AAAA,EACP;AAAA,EACA,OAAO;AAAA,IACL,GAAK;AAAA,IACL,GAAK;AAAA,IACL,GAAK;AAAA,EACP;AAAA,EACA,MAAM;AAAA,IACJ,GAAK;AAAA,IACL,GAAK;AAAA,IACL,GAAK;AAAA,EACP;AAAA,EACA,aAAa;AAAA,IACX,GAAK;AAAA,IACL,GAAK;AAAA,IACL,GAAK;AAAA,EACP;AAAA,EACA,cAAc;AAAA,IACZ,GAAK;AAAA,I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AAM,CAAA;AAErC,MAAMO,IAAQH;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/Input/Input.constants.ts","../../src/Input/Input.tsx"],"sourcesContent":["export const SIZE = {\n Container: {\n \"1\": \"h-6 pl-0 rounded-2\",\n \"2\": \"h-8 pl-0 rounded-2\",\n \"3\": \"h-10 pl-0 rounded-3\",\n },\n Input: {\n \"1\": \"text-1 px-1\",\n \"2\": \"text-2 px-2\",\n \"3\": \"text-3 px-3\",\n },\n Slot: {\n \"1\": \"[&>[data-tgph-button]]:rounded-1\",\n \"2\": \"[&>[data-tgph-button]]:rounded-1\",\n \"3\": \"[&>[data-tgph-button]]:rounded-2\",\n },\n SlotLeading: {\n \"1\": \"order-1 pl-1\",\n \"2\": \"order-1 pl-2\",\n \"3\": \"order-1 pl-3\",\n },\n SlotTrailing: {\n \"1\": \"order-3 pr-1\",\n \"2\": \"order-3 pr-2\",\n \"3\": \"order-3 pr-3\",\n },\n} as const;\n\nexport const COLOR = {\n Container: {\n default: {\n outline:\n \"bg-surface-1 border-gray-6 hover:border-gray-7 focus-within:!border-blue-8\",\n ghost:\n \"bg-transparent border-transparent hover:bg-gray-3 focus-within:!bg-gray-4 focus-within:!border-blue-8\",\n },\n disabled: {\n outline:\n \"cursor-not-allowed bg-gray-2 border-gray-2 [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9\",\n ghost:\n \"cursor-not-allowed bg-transparent border border-transparent [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9\",\n },\n error: {\n outline: \"bg-surface-1 border-red-6\",\n ghost: \"bg-transparent border-red-6\",\n },\n },\n} as const;\n","import { Slot as RadixSlot } from \"@radix-ui/react-slot\";\nimport { useComposedRefs } from \"@telegraph/compose-refs\";\nimport type {\n PolymorphicProps,\n PolymorphicPropsWithTgphRef,\n Required,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Box } from \"@telegraph/layout\";\nimport clsx from \"clsx\";\nimport React from \"react\";\n\nimport { COLOR, SIZE } from \"./Input.constants\";\n\ntype BaseRootProps = {\n size?: keyof typeof SIZE.Container;\n variant?: keyof typeof COLOR.Container.default;\n errored?: boolean;\n};\n\ntype RootProps<T extends TgphElement> = Omit<\n PolymorphicPropsWithTgphRef<T, HTMLInputElement>,\n \"size\"\n> &\n BaseRootProps;\n\ntype InternalProps = Omit<BaseRootProps, \"errored\"> & {\n state: \"default\" | \"disabled\" | \"error\";\n};\n\nconst InputContext = React.createContext<Required<InternalProps>>({\n state: \"default\",\n size: \"2\",\n variant: \"outline\",\n});\n\nconst Root = <T extends TgphElement>({\n as = \"input\" as T,\n size = \"2\",\n variant = \"outline\",\n className,\n disabled,\n errored,\n children,\n tgphRef,\n ...props\n}: RootProps<T>) => {\n const Component = as;\n const inputRef = React.useRef<HTMLInputElement>(null);\n const composedRefs = useComposedRefs(tgphRef, inputRef);\n\n const state = disabled ? \"disabled\" : errored ? \"error\" : \"default\";\n\n return (\n <InputContext.Provider value={{ size, variant, state }}>\n <Box\n className={clsx(\n \"box-border flex items-center transition-all\",\n \"border-[1px] border-solid text-gray-12 placeholder:text-gray-10\",\n COLOR.Container[state][variant],\n SIZE.Container[size],\n )}\n // Focus the input when clicking on the container\n onPointerDown={(event: React.MouseEvent<HTMLDivElement>) => {\n const target = event.target as HTMLElement;\n\n // Make sure we're not clicking on an interactive element\n if (target.closest(\"button, a\")) {\n event.preventDefault();\n return;\n }\n\n const input = inputRef.current;\n if (!input) return;\n\n requestAnimationFrame(() => {\n input.focus();\n });\n }}\n >\n <Component\n className={clsx(\n \"appearance-none text-gray-12 border-none shadow-0 outline-0 bg-transparent\",\n \"[font-family:inherit] h-full w-full\",\n \"order-2\",\n SIZE.Input[size],\n className,\n )}\n disabled={disabled}\n {...props}\n ref={composedRefs}\n />\n {children}\n </Box>\n </InputContext.Provider>\n );\n};\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof RadixSlot> & {\n size?: keyof typeof SIZE.Slot;\n position?: \"leading\" | \"trailing\";\n};\ntype SlotRef = React.ElementRef<typeof RadixSlot>;\n\nconst Slot = React.forwardRef<SlotRef, SlotProps>(\n ({ position = \"leading\", ...props }, forwardedRef) => {\n const context = React.useContext(InputContext);\n return (\n <Box\n className={clsx(\n \"group box-border flex items-center justify-center h-full\",\n \"[&>[data-tgph-button]]:w-full [&>[data-tgph-button]]:h-auto\",\n // Overrides to match the icon button in figma\n \"[&>[data-tgph-button-layout='icon-only']]:aspect-square [&>[data-tgph-button-layout='icon-only']]:p-0\",\n // Overrides default button layout to match the button in figma\n \"[&>[data-tgph-button-layout='default']]:px-2\",\n // If only an icon button is present, set the aspect ratio to square\n \"[&:has([data-tgph-button-layout='icon-only'])]:aspect-square\",\n // If only an icon button is present, reset the padding to spacing-1\n \"[&:has([data-tgph-button-layout='icon-only'])]:!p-1\",\n position === \"leading\" && SIZE.SlotLeading[context.size],\n position === \"trailing\" && SIZE.SlotTrailing[context.size],\n SIZE.Slot[props.size ?? context.size],\n )}\n >\n <RadixSlot size={context.size} {...props} ref={forwardedRef} />\n </Box>\n );\n },\n);\n\ntype DefaultProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Root> & {\n LeadingComponent?: React.ReactNode;\n TrailingComponent?: React.ReactNode;\n };\n\nconst Default = <T extends TgphElement>({\n LeadingComponent,\n TrailingComponent,\n ...props\n}: DefaultProps<T>) => {\n return (\n <Root {...props}>\n {LeadingComponent && <Slot position=\"leading\">{LeadingComponent}</Slot>}\n {TrailingComponent && (\n <Slot position=\"trailing\">{TrailingComponent}</Slot>\n )}\n </Root>\n );\n};\n\nObject.assign(Default, { Root, Slot });\n\nconst Input = Default as typeof Default & {\n Root: typeof Root;\n Slot: typeof Slot;\n};\n\nexport { Input };\n"],"names":["SIZE","COLOR","InputContext","React","Root","as","size","variant","className","disabled","errored","children","tgphRef","props","Component","inputRef","composedRefs","useComposedRefs","state","jsx","jsxs","Box","clsx","event","input","Slot","position","forwardedRef","context","RadixSlot","Default","LeadingComponent","TrailingComponent","Input"],"mappings":";;;;;;AAAO,MAAMA,IAAO;AAAA,EAClB,WAAW;AAAA,IACT,GAAK;AAAA,IACL,GAAK;AAAA,IACL,GAAK;AAAA,EACP;AAAA,EACA,OAAO;AAAA,IACL,GAAK;AAAA,IACL,GAAK;AAAA,IACL,GAAK;AAAA,EACP;AAAA,EACA,MAAM;AAAA,IACJ,GAAK;AAAA,IACL,GAAK;AAAA,IACL,GAAK;AAAA,EACP;AAAA,EACA,aAAa;AAAA,IACX,GAAK;AAAA,IACL,GAAK;AAAA,IACL,GAAK;AAAA,EACP;AAAA,EACA,cAAc;AAAA,IACZ,GAAK;AAAA,IACL,GAAK;AAAA,IACL,GAAK;AAAA,EACP;AACF,GAEaC,IAAQ;AAAA,EACnB,WAAW;AAAA,IACT,SAAS;AAAA,MACP,SACE;AAAA,MACF,OACE;AAAA,IACJ;AAAA,IACA,UAAU;AAAA,MACR,SACE;AAAA,MACF,OACE;AAAA,IACJ;AAAA,IACA,OAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACF,GChBMC,IAAeC,EAAM,cAAuC;AAAA,EAChE,OAAO;AAAA,EACP,MAAM;AAAA,EACN,SAAS;AACX,CAAC,GAEKC,IAAO,CAAwB;AAAA,EACnC,IAAAC,IAAK;AAAA,EACL,MAAAC,IAAO;AAAA,EACP,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,GAAGC;AACL,MAAoB;AAClB,QAAMC,IAAYT,GACZU,IAAWZ,EAAM,OAAyB,IAAI,GAC9Ca,IAAeC,EAAgBL,GAASG,CAAQ,GAEhDG,IAAQT,IAAW,aAAaC,IAAU,UAAU;AAGxD,SAAA,gBAAAS,EAACjB,EAAa,UAAb,EAAsB,OAAO,EAAE,MAAAI,GAAM,SAAAC,GAAS,O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U,KAAU,MAAMD,EAAQ,MAAO,GAAGf,GAAO,KAAKc,GAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAGnE;AACF,GAQMG,IAAU,CAAwB;AAAA,EACtC,kBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,GAAGnB;AACL,MAEI,gBAAAO,EAAChB,GAAM,EAAA,GAAGS,GACP,UAAA;AAAA,EAAAkB,KAAqB,gBAAAZ,EAAAM,GAAA,EAAK,UAAS,WAAW,UAAiBM,GAAA;AAAA,EAC/DC,KACC,gBAAAb,EAACM,GAAK,EAAA,UAAS,YAAY,UAAkBO,GAAA;AAEjD,EAAA,CAAA;AAIJ,OAAO,OAAOF,GAAS,EAAE,MAAA1B,GAAM,MAAAqB,EAAM,CAAA;AAErC,MAAMQ,IAAQH;"}
@@ -1,20 +1,23 @@
1
- import React from "react";
2
- import { COLOR, SIZE } from "./Input.constants";
1
+ import { PolymorphicProps, PolymorphicPropsWithTgphRef, TgphComponentProps, TgphElement } from '@telegraph/helpers';
2
+ import { default as React } from 'react';
3
+ import { COLOR, SIZE } from './Input.constants';
4
+
3
5
  type BaseRootProps = {
4
6
  size?: keyof typeof SIZE.Container;
5
7
  variant?: keyof typeof COLOR.Container.default;
6
8
  errored?: boolean;
7
9
  };
8
- declare const Root: React.ForwardRefExoticComponent<BaseRootProps & Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "size"> & React.RefAttributes<HTMLInputElement>>;
9
- declare const Slot: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-slot").SlotProps & React.RefAttributes<HTMLElement>, "ref"> & {
10
+ type RootProps<T extends TgphElement> = Omit<PolymorphicPropsWithTgphRef<T, HTMLInputElement>, "size"> & BaseRootProps;
11
+ declare const Root: <T extends TgphElement>({ as, size, variant, className, disabled, errored, children, tgphRef, ...props }: RootProps<T>) => import("react/jsx-runtime").JSX.Element;
12
+ declare const Slot: React.ForwardRefExoticComponent<Omit<import('@radix-ui/react-slot').SlotProps & React.RefAttributes<HTMLElement>, "ref"> & {
10
13
  size?: "1" | "2" | "3" | undefined;
11
14
  position?: "leading" | "trailing" | undefined;
12
15
  } & React.RefAttributes<HTMLElement>>;
13
- type DefaultProps = React.ComponentPropsWithoutRef<typeof Root> & {
16
+ type DefaultProps<T extends TgphElement> = PolymorphicProps<T> & TgphComponentProps<typeof Root> & {
14
17
  LeadingComponent?: React.ReactNode;
15
18
  TrailingComponent?: React.ReactNode;
16
19
  };
17
- declare const Input: (({ LeadingComponent, TrailingComponent, ...props }: DefaultProps) => import("react/jsx-runtime").JSX.Element) & {
20
+ declare const Input: (<T extends TgphElement>({ LeadingComponent, TrailingComponent, ...props }: DefaultProps<T>) => import("react/jsx-runtime").JSX.Element) & {
18
21
  Root: typeof Root;
19
22
  Slot: typeof Slot;
20
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/Input/Input.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEhD,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,OAAO,IAAI,CAAC,SAAS,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAiBF,QAAA,MAAM,IAAI,4MA8DT,CAAC;AAQF,QAAA,MAAM,IAAI;;;qCAyBT,CAAC;AAEF,KAAK,YAAY,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,IAAI,CAAC,GAAG;IAChE,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACrC,CAAC;AAmBF,QAAA,MAAM,KAAK,uDAbR,YAAY;UAcP,WAAW;UACX,WAAW;CAClB,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/Input/Input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,2BAA2B,EAE3B,kBAAkB,EAClB,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEhD,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,OAAO,IAAI,CAAC,SAAS,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,SAAS,CAAC,CAAC,SAAS,WAAW,IAAI,IAAI,CAC1C,2BAA2B,CAAC,CAAC,EAAE,gBAAgB,CAAC,EAChD,MAAM,CACP,GACC,aAAa,CAAC;AAYhB,QAAA,MAAM,IAAI,4GAUP,UAAU,CAAC,CAAC,4CAkDd,CAAC;AAQF,QAAA,MAAM,IAAI;;;qCAyBT,CAAC;AAEF,KAAK,YAAY,CAAC,CAAC,SAAS,WAAW,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAC5D,kBAAkB,CAAC,OAAO,IAAI,CAAC,GAAG;IAChC,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACrC,CAAC;AAmBJ,QAAA,MAAM,KAAK,8EAbR,aAAa,CAAC,CAAC;UAcV,WAAW;UACX,WAAW;CAClB,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -1,2 +1,2 @@
1
- export { Input } from "./Input";
1
+ export { Input } from './Input';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export { Input } from "./Input";
1
+ export { Input } from './Input';
2
2
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telegraph/input",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Input component for Telegraph",
5
5
  "repository": "https://github.com/knocklabs/telegraph/tree/main/packages/input",
6
6
  "author": "@knocklabs",
@@ -37,13 +37,14 @@
37
37
  "dependencies": {
38
38
  "@radix-ui/react-slot": "^1.0.2",
39
39
  "@telegraph/compose-refs": "^0.0.1",
40
- "@telegraph/helpers": "^0.0.1",
40
+ "@telegraph/helpers": "^0.0.3",
41
+ "@telegraph/layout": "^0.0.13",
41
42
  "clsx": "^2.1.0"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@knocklabs/eslint-config": "^0.0.3",
45
46
  "@knocklabs/typescript-config": "^0.0.2",
46
- "@telegraph/postcss-config": "^0.0.13",
47
+ "@telegraph/postcss-config": "^0.0.16",
47
48
  "@telegraph/prettier-config": "^0.0.6",
48
49
  "@telegraph/tailwind-config": "^0.0.11",
49
50
  "@telegraph/vite-config": "^0.0.9",
@@ -53,7 +54,7 @@
53
54
  "react": "^18.2.0",
54
55
  "react-dom": "^18.2.0",
55
56
  "typescript": "^5.3.3",
56
- "vite": "^5.1.7",
57
+ "vite": "^5.3.0",
57
58
  "vitest": "^1.2.2"
58
59
  },
59
60
  "peerDependencies": {
@@ -1,9 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { Input as TelegraphInput } from "./Input";
3
- declare const meta: Meta<typeof TelegraphInput>;
4
- export default meta;
5
- type Story = StoryObj<typeof TelegraphInput>;
6
- export declare const Default: Story;
7
- export declare const LeadingIcon: Story;
8
- export declare const TrailingAction: Story;
9
- //# sourceMappingURL=Input.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Input.stories.d.ts","sourceRoot":"","sources":["../../../src/Input/Input.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIvD,OAAO,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;AAKlD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CA+CrC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;AAE7C,eAAO,MAAM,OAAO,EAAE,KA0BrB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAkBzB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KA6B5B,CAAC"}