@telegraph/input 0.2.0 → 0.2.2

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,17 @@
1
1
  # @telegraph/input
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#701](https://github.com/knocklabs/telegraph/pull/701) [`16e678c`](https://github.com/knocklabs/telegraph/commit/16e678c5e8bc7f13613116954bc15099a8694bb7) Thanks [@ksorathia](https://github.com/ksorathia)! - Add surface-3 background color for interactive outlined variants.
8
+
9
+ ## 0.2.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#704](https://github.com/knocklabs/telegraph/pull/704) [`b954d02`](https://github.com/knocklabs/telegraph/commit/b954d0263ccde551736b07fed21b13f5bf78d9fb) Thanks [@dependabot](https://github.com/apps/dependabot)! - chore(deps): bump @radix-ui/react-slot from 1.2.3 to 1.2.4
14
+
3
15
  ## 0.2.0
4
16
 
5
17
  ### Minor 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"),q=require("@radix-ui/react-slot"),w=require("@telegraph/compose-refs"),b=require("@telegraph/layout"),T=require("@telegraph/typography"),s=require("react"),i={Container:{1:{h:"6",pl:"0",rounded:"2"},2:{h:"8",pl:"0",rounded:"2"},3:{h:"10",pl:"0",rounded:"2"}},Text:{1:{size:"1",px:"1"},2:{size:"2",px:"2"},3:{size:"3",px:"3"}},SlotLeading:{1:{pl:"1_5"},2:{pl:"2"},3:{pl:"3"}},SlotTrailing:{1:{pr:"1"},2:{pr:"2"},3:{pr:"3"}}},g={Container:{default:{outline:{bg:"surface-1",border:"px",borderColor:"gray-6",hover_borderColor:"gray-7",focus_within_borderColor:"blue-8"},ghost:{bg:"transparent",border:"px",borderColor:"transparent",hover_backgroundColor:"gray-3",hover_borderColor:"transparent",focus_within_backgroundColor:"gray-4",focus_within_borderColor:"blue-8"}},disabled:{outline:{bg:"gray-2",border:"px",borderColor:"gray-2"},ghost:{bg:"transparent",border:"px",borderColor:"transparent"}},error:{outline:{bg:"surface-1",border:"px",borderColor:"red-6"},ghost:{bg:"transparent",border:"px",borderColor:"red-6"}}},Text:{default:{color:"default"},disabled:{color:"disabled"},error:{color:"default"}}},f=s.createContext({state:"default",size:"2",variant:"outline"}),h=({as:e="input",size:t="2",variant:o="outline",textProps:n,stackProps:C,disabled:u,errored:j,children:y,tgphRef:S,...R})=>{const _=e,d=s.useRef(null),z=w.useComposedRefs(S,d),a=u?"disabled":j?"error":"default";return r.jsx(f.Provider,{value:{size:t,variant:o,state:a},children:r.jsxs(b.Stack,{onPointerDown:c=>{if(c.target.closest("button, a")){c.preventDefault();return}const p=d.current;p&&requestAnimationFrame(()=>{p.focus()})},align:"center",...i.Container[t],...g.Container[a][o],"data-tgph-input-container":!0,"data-tgph-input-container-variant":o,"data-tgph-input-container-state":a,"data-tgph-input-container-size":t,...C,children:[r.jsx(T.Text,{as:_,bg:"transparent",shadow:"0",h:"full",w:"full",disabled:u,tgphRef:z,...i.Text[t],...g.Text[a],...R,...n,"data-tgph-input-field":!0}),y]})})},l=s.forwardRef(({position:e="leading",...t},o)=>{const n=s.useContext(f);return r.jsx(b.Stack,{align:"center",justify:"center",h:"full","data-tgph-input-slot":!0,"data-tgph-input-slot-position":e,"data-tgph-input-slot-size":t.size??n.size,...e==="leading"&&i.SlotLeading[n.size],...e==="trailing"&&i.SlotTrailing[n.size],children:r.jsx(q.Slot,{size:n.size,...t,ref:o})})}),x=({LeadingComponent:e,TrailingComponent:t,...o})=>r.jsxs(h,{...o,children:[e&&r.jsx(l,{position:"leading",children:e}),t&&r.jsx(l,{position:"trailing",children:t})]});Object.assign(x,{Root:h,Slot:l});const m=x;exports.Input=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),k=require("@radix-ui/react-slot"),y=require("@telegraph/compose-refs"),b=require("@telegraph/layout"),z=require("@telegraph/typography"),s=require("react"),u={Container:{1:{h:"6",pl:"0",rounded:"2"},2:{h:"8",pl:"0",rounded:"2"},3:{h:"10",pl:"0",rounded:"2"}},Text:{1:{size:"1",px:"1"},2:{size:"2",px:"2"},3:{size:"3",px:"3"}},SlotLeading:{1:{pl:"1_5"},2:{pl:"2"},3:{pl:"3"}},SlotTrailing:{1:{pr:"1"},2:{pr:"2"},3:{pr:"3"}}},g={Container:{default:{outline:{bg:"surface-3",border:"px",borderColor:"gray-6",hover_backgroundColor:"surface-2",hover_borderColor:"gray-7",focus_within_backgroundColor:"surface-3",focus_within_borderColor:"blue-8"},ghost:{bg:"transparent",border:"px",borderColor:"transparent",hover_backgroundColor:"surface-2",hover_borderColor:"gray-7",focus_within_backgroundColor:"surface-3",focus_within_borderColor:"blue-8"}},disabled:{outline:{bg:"gray-2",border:"px",borderColor:"transparent"},ghost:{bg:"transparent",border:"px",borderColor:"transparent"}},error:{outline:{bg:"surface-3",border:"px",borderColor:"red-6",hover_backgroundColor:"surface-2",hover_borderColor:"red-7",focus_within_backgroundColor:"surface-3",focus_within_borderColor:"blue-8"},ghost:{bg:"surface-3",border:"px",borderColor:"red-6",hover_backgroundColor:"surface-2",hover_borderColor:"red-7",focus_within_backgroundColor:"surface-3",focus_within_borderColor:"blue-8"}}},Text:{default:{color:"default"},disabled:{color:"disabled"},error:{color:"default"}}},f=s.createContext({state:"default",size:"2",variant:"outline"}),h=({as:e="input",size:r="2",variant:t="outline",textProps:n,stackProps:x,disabled:l,errored:_,children:j,tgphRef:w,...S})=>{const v=e,c=s.useRef(null),R=y.useComposedRefs(w,c),a=l?"disabled":_?"error":"default";return o.jsx(f.Provider,{value:{size:r,variant:t,state:a},children:o.jsxs(b.Stack,{onPointerDown:d=>{if(d.target.closest("button, a")){d.preventDefault();return}const p=c.current;p&&requestAnimationFrame(()=>{p.focus()})},align:"center",...u.Container[r],...g.Container[a][t],"data-tgph-input-container":!0,"data-tgph-input-container-variant":t,"data-tgph-input-container-state":a,"data-tgph-input-container-size":r,...x,children:[o.jsx(z.Text,{as:v,bg:"transparent",shadow:"0",h:"full",w:"full",disabled:l,tgphRef:R,...u.Text[r],...g.Text[a],...S,...n,"data-tgph-input-field":!0}),j]})})},i=s.forwardRef(({position:e="leading",...r},t)=>{const n=s.useContext(f);return o.jsx(b.Stack,{align:"center",justify:"center",h:"full","data-tgph-input-slot":!0,"data-tgph-input-slot-position":e,"data-tgph-input-slot-size":r.size??n.size,...e==="leading"&&u.SlotLeading[n.size],...e==="trailing"&&u.SlotTrailing[n.size],children:o.jsx(k.Slot,{size:n.size,...r,ref:t})})}),C=({LeadingComponent:e,TrailingComponent:r,...t})=>o.jsxs(h,{...t,children:[e&&o.jsx(i,{position:"leading",children:e}),r&&o.jsx(i,{position:"trailing",children:r})]});Object.assign(C,{Root:h,Slot:i});const q=C;exports.Input=q;
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\": {\n h: \"6\",\n pl: \"0\",\n rounded: \"2\",\n },\n \"2\": {\n h: \"8\",\n pl: \"0\",\n rounded: \"2\",\n },\n \"3\": {\n h: \"10\",\n pl: \"0\",\n rounded: \"2\",\n },\n },\n Text: {\n \"1\": {\n size: \"1\",\n px: \"1\",\n },\n \"2\": {\n size: \"2\",\n px: \"2\",\n },\n \"3\": {\n size: \"3\",\n px: \"3\",\n },\n },\n SlotLeading: {\n \"1\": {\n pl: \"1_5\",\n },\n \"2\": {\n pl: \"2\",\n },\n \"3\": {\n pl: \"3\",\n },\n },\n SlotTrailing: {\n \"1\": {\n pr: \"1\",\n },\n \"2\": {\n pr: \"2\",\n },\n \"3\": {\n pr: \"3\",\n },\n },\n} as const;\n\nexport const COLOR = {\n Container: {\n default: {\n outline: {\n bg: \"surface-1\",\n border: \"px\",\n borderColor: \"gray-6\",\n hover_borderColor: \"gray-7\",\n focus_within_borderColor: \"blue-8\",\n },\n ghost: {\n bg: \"transparent\",\n border: \"px\",\n borderColor: \"transparent\",\n hover_backgroundColor: \"gray-3\",\n hover_borderColor: \"transparent\",\n focus_within_backgroundColor: \"gray-4\",\n focus_within_borderColor: \"blue-8\",\n },\n },\n disabled: {\n outline: {\n bg: \"gray-2\",\n border: \"px\",\n borderColor: \"gray-2\",\n },\n ghost: {\n bg: \"transparent\",\n border: \"px\",\n borderColor: \"transparent\",\n },\n },\n error: {\n outline: {\n bg: \"surface-1\",\n border: \"px\",\n borderColor: \"red-6\",\n },\n ghost: {\n bg: \"transparent\",\n border: \"px\",\n borderColor: \"red-6\",\n },\n },\n },\n Text: {\n default: {\n color: \"default\",\n },\n disabled: {\n color: \"disabled\",\n },\n error: {\n color: \"default\",\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 Required,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Stack } from \"@telegraph/layout\";\nimport { Text } from \"@telegraph/typography\";\nimport React from \"react\";\n\nimport { COLOR, SIZE } from \"./Input.constants\";\n\nexport type BaseRootProps = {\n size?: \"1\" | \"2\" | \"3\";\n variant?: \"outline\" | \"ghost\";\n errored?: boolean;\n};\n\nexport type RootProps<T extends TgphElement = \"input\"> = BaseRootProps & {\n textProps?: Omit<React.ComponentProps<typeof Text<T>>, \"as\">;\n stackProps?: Omit<React.ComponentProps<typeof Stack>, \"as\">;\n} & Omit<React.ComponentProps<typeof Text<T>>, \"as\" | keyof 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 = \"input\">({\n as = \"input\" as T,\n size = \"2\",\n variant = \"outline\",\n textProps,\n stackProps,\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 <Stack\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 align=\"center\"\n {...SIZE.Container[size]}\n {...COLOR.Container[state][variant]}\n data-tgph-input-container\n data-tgph-input-container-variant={variant}\n data-tgph-input-container-state={state}\n data-tgph-input-container-size={size}\n {...stackProps}\n >\n {/* \n We choose to use the `<Text/>` component as a base here so that we can \n configure the text inside of the input to match the design system font sizes\n */}\n <Text\n as={Component}\n bg=\"transparent\"\n shadow=\"0\"\n h=\"full\"\n w=\"full\"\n disabled={disabled}\n tgphRef={composedRefs}\n {...SIZE.Text[size]}\n {...COLOR.Text[state]}\n {...props}\n {...textProps}\n data-tgph-input-field\n />\n {children}\n </Stack>\n </InputContext.Provider>\n );\n};\n\nexport type SlotProps = React.ComponentPropsWithoutRef<typeof RadixSlot> & {\n size?: \"1\" | \"2\" | \"3\";\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 <Stack\n align=\"center\"\n justify=\"center\"\n h=\"full\"\n data-tgph-input-slot\n data-tgph-input-slot-position={position}\n data-tgph-input-slot-size={props.size ?? context.size}\n {...(position === \"leading\" && SIZE.SlotLeading[context.size])}\n {...(position === \"trailing\" && SIZE.SlotTrailing[context.size])}\n >\n <RadixSlot size={context.size} {...props} ref={forwardedRef} />\n </Stack>\n );\n },\n);\n\nexport type DefaultProps<T extends TgphElement = \"input\"> = Omit<\n PolymorphicProps<T>,\n keyof BaseRootProps\n> &\n TgphComponentProps<typeof Root> & {\n LeadingComponent?: React.ReactNode;\n TrailingComponent?: React.ReactNode;\n };\n\nconst Default = <T extends TgphElement = \"input\">({\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","textProps","stackProps","disabled","errored","children","tgphRef","props","Component","inputRef","composedRefs","useComposedRefs","state","jsx","jsxs","Stack","event","input","Text","Slot","position","forwardedRef","context","RadixSlot","Default","LeadingComponent","TrailingComponent","Input"],"mappings":"iRAAaA,EAAO,CAClB,UAAW,CACT,EAAK,CACH,EAAG,IACH,GAAI,IACJ,QAAS,GAAA,EAEX,EAAK,CACH,EAAG,IACH,GAAI,IACJ,QAAS,GAAA,EAEX,EAAK,CACH,EAAG,KACH,GAAI,IACJ,QAAS,GAAA,CACX,EAEF,KAAM,CACJ,EAAK,CACH,KAAM,IACN,GAAI,GAAA,EAEN,EAAK,CACH,KAAM,IACN,GAAI,GAAA,EAEN,EAAK,CACH,KAAM,IACN,GAAI,GAAA,CACN,EAEF,YAAa,CACX,EAAK,CACH,GAAI,KAAA,EAEN,EAAK,CACH,GAAI,GAAA,EAEN,EAAK,CACH,GAAI,GAAA,CACN,EAEF,aAAc,CACZ,EAAK,CACH,GAAI,GAAA,EAEN,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AAK,SAAS,UAAW,SAAAM,EAAiB,EAC/DC,GACCb,EAAAA,IAACM,EAAA,CAAK,SAAS,WAAY,SAAAO,CAAA,CAAkB,CAAA,EAEjD,EAIJ,OAAO,OAAOF,EAAS,CAAE,KAAA3B,EAAM,KAAAsB,EAAM,EAErC,MAAMQ,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\": {\n h: \"6\",\n pl: \"0\",\n rounded: \"2\",\n },\n \"2\": {\n h: \"8\",\n pl: \"0\",\n rounded: \"2\",\n },\n \"3\": {\n h: \"10\",\n pl: \"0\",\n rounded: \"2\",\n },\n },\n Text: {\n \"1\": {\n size: \"1\",\n px: \"1\",\n },\n \"2\": {\n size: \"2\",\n px: \"2\",\n },\n \"3\": {\n size: \"3\",\n px: \"3\",\n },\n },\n SlotLeading: {\n \"1\": {\n pl: \"1_5\",\n },\n \"2\": {\n pl: \"2\",\n },\n \"3\": {\n pl: \"3\",\n },\n },\n SlotTrailing: {\n \"1\": {\n pr: \"1\",\n },\n \"2\": {\n pr: \"2\",\n },\n \"3\": {\n pr: \"3\",\n },\n },\n} as const;\n\nexport const COLOR = {\n Container: {\n default: {\n outline: {\n bg: \"surface-3\",\n border: \"px\",\n borderColor: \"gray-6\",\n hover_backgroundColor: \"surface-2\",\n hover_borderColor: \"gray-7\",\n focus_within_backgroundColor: \"surface-3\",\n focus_within_borderColor: \"blue-8\",\n },\n ghost: {\n bg: \"transparent\",\n border: \"px\",\n borderColor: \"transparent\",\n hover_backgroundColor: \"surface-2\",\n hover_borderColor: \"gray-7\",\n focus_within_backgroundColor: \"surface-3\",\n focus_within_borderColor: \"blue-8\",\n },\n },\n disabled: {\n outline: {\n bg: \"gray-2\",\n border: \"px\",\n borderColor: \"transparent\",\n },\n ghost: {\n bg: \"transparent\",\n border: \"px\",\n borderColor: \"transparent\",\n },\n },\n error: {\n outline: {\n bg: \"surface-3\",\n border: \"px\",\n borderColor: \"red-6\",\n hover_backgroundColor: \"surface-2\",\n hover_borderColor: \"red-7\",\n focus_within_backgroundColor: \"surface-3\",\n focus_within_borderColor: \"blue-8\",\n },\n ghost: {\n bg: \"surface-3\",\n border: \"px\",\n borderColor: \"red-6\",\n hover_backgroundColor: \"surface-2\",\n hover_borderColor: \"red-7\",\n focus_within_backgroundColor: \"surface-3\",\n focus_within_borderColor: \"blue-8\",\n },\n },\n },\n Text: {\n default: {\n color: \"default\",\n },\n disabled: {\n color: \"disabled\",\n },\n error: {\n color: \"default\",\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 Required,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Stack } from \"@telegraph/layout\";\nimport { Text } from \"@telegraph/typography\";\nimport React from \"react\";\n\nimport { COLOR, SIZE } from \"./Input.constants\";\n\nexport type BaseRootProps = {\n size?: \"1\" | \"2\" | \"3\";\n variant?: \"outline\" | \"ghost\";\n errored?: boolean;\n};\n\nexport type RootProps<T extends TgphElement = \"input\"> = BaseRootProps & {\n textProps?: Omit<React.ComponentProps<typeof Text<T>>, \"as\">;\n stackProps?: Omit<React.ComponentProps<typeof Stack>, \"as\">;\n} & Omit<React.ComponentProps<typeof Text<T>>, \"as\" | keyof 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 = \"input\">({\n as = \"input\" as T,\n size = \"2\",\n variant = \"outline\",\n textProps,\n stackProps,\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 <Stack\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 align=\"center\"\n {...SIZE.Container[size]}\n {...COLOR.Container[state][variant]}\n data-tgph-input-container\n data-tgph-input-container-variant={variant}\n data-tgph-input-container-state={state}\n data-tgph-input-container-size={size}\n {...stackProps}\n >\n {/* \n We choose to use the `<Text/>` component as a base here so that we can \n configure the text inside of the input to match the design system font sizes\n */}\n <Text\n as={Component}\n bg=\"transparent\"\n shadow=\"0\"\n h=\"full\"\n w=\"full\"\n disabled={disabled}\n tgphRef={composedRefs}\n {...SIZE.Text[size]}\n {...COLOR.Text[state]}\n {...props}\n {...textProps}\n data-tgph-input-field\n />\n {children}\n </Stack>\n </InputContext.Provider>\n );\n};\n\nexport type SlotProps = React.ComponentPropsWithoutRef<typeof RadixSlot> & {\n size?: \"1\" | \"2\" | \"3\";\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 <Stack\n align=\"center\"\n justify=\"center\"\n h=\"full\"\n data-tgph-input-slot\n data-tgph-input-slot-position={position}\n data-tgph-input-slot-size={props.size ?? context.size}\n {...(position === \"leading\" && SIZE.SlotLeading[context.size])}\n {...(position === \"trailing\" && SIZE.SlotTrailing[context.size])}\n >\n <RadixSlot size={context.size} {...props} ref={forwardedRef} />\n </Stack>\n );\n },\n);\n\nexport type DefaultProps<T extends TgphElement = \"input\"> = Omit<\n PolymorphicProps<T>,\n keyof BaseRootProps\n> &\n TgphComponentProps<typeof Root> & {\n LeadingComponent?: React.ReactNode;\n TrailingComponent?: React.ReactNode;\n };\n\nconst Default = <T extends TgphElement = \"input\">({\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","textProps","stackProps","disabled","errored","children","tgphRef","props","Component","inputRef","composedRefs","useComposedRefs","state","jsx","jsxs","Stack","event","input","Text","Slot","position","forwardedRef","context","RadixSlot","Default","LeadingComponent","TrailingComponent","Input"],"mappings":"iRAAaA,EAAO,CAClB,UAAW,CACT,EAAK,CACH,EAAG,IACH,GAAI,IACJ,QAAS,GAAA,EAEX,EAAK,CACH,EAAG,IACH,GAAI,IACJ,QAAS,GAAA,EAEX,EAAK,CACH,EAAG,KACH,GAAI,IACJ,QAAS,GAAA,CACX,EAEF,KAAM,CACJ,EAAK,CACH,KAAM,IACN,GAAI,GAAA,EAEN,EAAK,CACH,KAAM,IACN,GAAI,GAAA,EAEN,EAAK,CACH,KAAM,IACN,GAAI,GAAA,CACN,EAEF,YAAa,CACX,EAAK,CACH,GAAI,KAAA,EAEN,EAAK,CACH,GAAI,GAAA,EAEN,EAAK,CACH,GAAI,GAAA,CACN,EAEF,aAAc,CACZ,EAAK,CACH,GAAI,GAAA,EAEN,EAAK,CACH,GAAI,GAAA,EAEN,EAAK,CACH,GAAI,GAAA,CACN,CAEJ,EAEaC,EAAQ,CACnB,UAAW,CACT,QAAS,CACP,QAAS,CACP,GAAI,YACJ,OAAQ,KACR,YAAa,SACb,sBAAuB,YACvB,kBAAmB,SACnB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,EAC/DC,GACCb,EAAAA,IAACM,EAAA,CAAK,SAAS,WAAY,SAAAO,CAAA,CAAkB,CAAA,EAEjD,EAIJ,OAAO,OAAOF,EAAS,CAAE,KAAA3B,EAAM,KAAAsB,EAAM,EAErC,MAAMQ,EAAQH"}
@@ -1,8 +1,8 @@
1
- import { jsx as n, jsxs as f } from "react/jsx-runtime";
2
- import { Slot as T } from "@radix-ui/react-slot";
3
- import { useComposedRefs as v } from "@telegraph/compose-refs";
4
- import { Stack as b } from "@telegraph/layout";
5
- import { Text as j } from "@telegraph/typography";
1
+ import { jsx as n, jsxs as b } from "react/jsx-runtime";
2
+ import { Slot as S } from "@radix-ui/react-slot";
3
+ import { useComposedRefs as T } from "@telegraph/compose-refs";
4
+ import { Stack as g } from "@telegraph/layout";
5
+ import { Text as y } from "@telegraph/typography";
6
6
  import i from "react";
7
7
  const l = {
8
8
  Container: {
@@ -58,23 +58,25 @@ const l = {
58
58
  pr: "3"
59
59
  }
60
60
  }
61
- }, g = {
61
+ }, f = {
62
62
  Container: {
63
63
  default: {
64
64
  outline: {
65
- bg: "surface-1",
65
+ bg: "surface-3",
66
66
  border: "px",
67
67
  borderColor: "gray-6",
68
+ hover_backgroundColor: "surface-2",
68
69
  hover_borderColor: "gray-7",
70
+ focus_within_backgroundColor: "surface-3",
69
71
  focus_within_borderColor: "blue-8"
70
72
  },
71
73
  ghost: {
72
74
  bg: "transparent",
73
75
  border: "px",
74
76
  borderColor: "transparent",
75
- hover_backgroundColor: "gray-3",
76
- hover_borderColor: "transparent",
77
- focus_within_backgroundColor: "gray-4",
77
+ hover_backgroundColor: "surface-2",
78
+ hover_borderColor: "gray-7",
79
+ focus_within_backgroundColor: "surface-3",
78
80
  focus_within_borderColor: "blue-8"
79
81
  }
80
82
  },
@@ -82,7 +84,7 @@ const l = {
82
84
  outline: {
83
85
  bg: "gray-2",
84
86
  border: "px",
85
- borderColor: "gray-2"
87
+ borderColor: "transparent"
86
88
  },
87
89
  ghost: {
88
90
  bg: "transparent",
@@ -92,14 +94,22 @@ const l = {
92
94
  },
93
95
  error: {
94
96
  outline: {
95
- bg: "surface-1",
97
+ bg: "surface-3",
96
98
  border: "px",
97
- borderColor: "red-6"
99
+ borderColor: "red-6",
100
+ hover_backgroundColor: "surface-2",
101
+ hover_borderColor: "red-7",
102
+ focus_within_backgroundColor: "surface-3",
103
+ focus_within_borderColor: "blue-8"
98
104
  },
99
105
  ghost: {
100
- bg: "transparent",
106
+ bg: "surface-3",
101
107
  border: "px",
102
- borderColor: "red-6"
108
+ borderColor: "red-6",
109
+ hover_backgroundColor: "surface-2",
110
+ hover_borderColor: "red-7",
111
+ focus_within_backgroundColor: "surface-3",
112
+ focus_within_borderColor: "blue-8"
103
113
  }
104
114
  }
105
115
  },
@@ -118,90 +128,90 @@ const l = {
118
128
  state: "default",
119
129
  size: "2",
120
130
  variant: "outline"
121
- }), x = ({
122
- as: r = "input",
123
- size: t = "2",
131
+ }), C = ({
132
+ as: o = "input",
133
+ size: r = "2",
124
134
  variant: e = "outline",
125
- textProps: o,
126
- stackProps: m,
127
- disabled: d,
128
- errored: _,
129
- children: z,
130
- tgphRef: R,
131
- ...S
135
+ textProps: t,
136
+ stackProps: x,
137
+ disabled: s,
138
+ errored: m,
139
+ children: w,
140
+ tgphRef: v,
141
+ ...k
132
142
  }) => {
133
- const w = r, u = i.useRef(null), y = v(R, u), a = d ? "disabled" : _ ? "error" : "default";
134
- return /* @__PURE__ */ n(h.Provider, { value: { size: t, variant: e, state: a }, children: /* @__PURE__ */ f(
135
- b,
143
+ const z = o, d = i.useRef(null), R = T(v, d), a = s ? "disabled" : m ? "error" : "default";
144
+ return /* @__PURE__ */ n(h.Provider, { value: { size: r, variant: e, state: a }, children: /* @__PURE__ */ b(
145
+ g,
136
146
  {
137
- onPointerDown: (p) => {
138
- if (p.target.closest("button, a")) {
139
- p.preventDefault();
147
+ onPointerDown: (c) => {
148
+ if (c.target.closest("button, a")) {
149
+ c.preventDefault();
140
150
  return;
141
151
  }
142
- const c = u.current;
143
- c && requestAnimationFrame(() => {
144
- c.focus();
152
+ const p = d.current;
153
+ p && requestAnimationFrame(() => {
154
+ p.focus();
145
155
  });
146
156
  },
147
157
  align: "center",
148
- ...l.Container[t],
149
- ...g.Container[a][e],
158
+ ...l.Container[r],
159
+ ...f.Container[a][e],
150
160
  "data-tgph-input-container": !0,
151
161
  "data-tgph-input-container-variant": e,
152
162
  "data-tgph-input-container-state": a,
153
- "data-tgph-input-container-size": t,
154
- ...m,
163
+ "data-tgph-input-container-size": r,
164
+ ...x,
155
165
  children: [
156
166
  /* @__PURE__ */ n(
157
- j,
167
+ y,
158
168
  {
159
- as: w,
169
+ as: z,
160
170
  bg: "transparent",
161
171
  shadow: "0",
162
172
  h: "full",
163
173
  w: "full",
164
- disabled: d,
165
- tgphRef: y,
166
- ...l.Text[t],
167
- ...g.Text[a],
168
- ...S,
169
- ...o,
174
+ disabled: s,
175
+ tgphRef: R,
176
+ ...l.Text[r],
177
+ ...f.Text[a],
178
+ ...k,
179
+ ...t,
170
180
  "data-tgph-input-field": !0
171
181
  }
172
182
  ),
173
- z
183
+ w
174
184
  ]
175
185
  }
176
186
  ) });
177
- }, s = i.forwardRef(
178
- ({ position: r = "leading", ...t }, e) => {
179
- const o = i.useContext(h);
187
+ }, u = i.forwardRef(
188
+ ({ position: o = "leading", ...r }, e) => {
189
+ const t = i.useContext(h);
180
190
  return /* @__PURE__ */ n(
181
- b,
191
+ g,
182
192
  {
183
193
  align: "center",
184
194
  justify: "center",
185
195
  h: "full",
186
196
  "data-tgph-input-slot": !0,
187
- "data-tgph-input-slot-position": r,
188
- "data-tgph-input-slot-size": t.size ?? o.size,
189
- ...r === "leading" && l.SlotLeading[o.size],
190
- ...r === "trailing" && l.SlotTrailing[o.size],
191
- children: /* @__PURE__ */ n(T, { size: o.size, ...t, ref: e })
197
+ "data-tgph-input-slot-position": o,
198
+ "data-tgph-input-slot-size": r.size ?? t.size,
199
+ ...o === "leading" && l.SlotLeading[t.size],
200
+ ...o === "trailing" && l.SlotTrailing[t.size],
201
+ children: /* @__PURE__ */ n(S, { size: t.size, ...r, ref: e })
192
202
  }
193
203
  );
194
204
  }
195
- ), C = ({
196
- LeadingComponent: r,
197
- TrailingComponent: t,
205
+ ), _ = ({
206
+ LeadingComponent: o,
207
+ TrailingComponent: r,
198
208
  ...e
199
- }) => /* @__PURE__ */ f(x, { ...e, children: [
200
- r && /* @__PURE__ */ n(s, { position: "leading", children: r }),
201
- t && /* @__PURE__ */ n(s, { position: "trailing", children: t })
209
+ }) => /* @__PURE__ */ b(C, { ...e, children: [
210
+ o && /* @__PURE__ */ n(u, { position: "leading", children: o }),
211
+ r && /* @__PURE__ */ n(u, { position: "trailing", children: r })
202
212
  ] });
203
- Object.assign(C, { Root: x, Slot: s });
204
- const A = C;
213
+ Object.assign(_, { Root: C, Slot: u });
214
+ const A = _;
205
215
  export {
206
216
  A as Input
207
217
  };
@@ -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\": {\n h: \"6\",\n pl: \"0\",\n rounded: \"2\",\n },\n \"2\": {\n h: \"8\",\n pl: \"0\",\n rounded: \"2\",\n },\n \"3\": {\n h: \"10\",\n pl: \"0\",\n rounded: \"2\",\n },\n },\n Text: {\n \"1\": {\n size: \"1\",\n px: \"1\",\n },\n \"2\": {\n size: \"2\",\n px: \"2\",\n },\n \"3\": {\n size: \"3\",\n px: \"3\",\n },\n },\n SlotLeading: {\n \"1\": {\n pl: \"1_5\",\n },\n \"2\": {\n pl: \"2\",\n },\n \"3\": {\n pl: \"3\",\n },\n },\n SlotTrailing: {\n \"1\": {\n pr: \"1\",\n },\n \"2\": {\n pr: \"2\",\n },\n \"3\": {\n pr: \"3\",\n },\n },\n} as const;\n\nexport const COLOR = {\n Container: {\n default: {\n outline: {\n bg: \"surface-1\",\n border: \"px\",\n borderColor: \"gray-6\",\n hover_borderColor: \"gray-7\",\n focus_within_borderColor: \"blue-8\",\n },\n ghost: {\n bg: \"transparent\",\n border: \"px\",\n borderColor: \"transparent\",\n hover_backgroundColor: \"gray-3\",\n hover_borderColor: \"transparent\",\n focus_within_backgroundColor: \"gray-4\",\n focus_within_borderColor: \"blue-8\",\n },\n },\n disabled: {\n outline: {\n bg: \"gray-2\",\n border: \"px\",\n borderColor: \"gray-2\",\n },\n ghost: {\n bg: \"transparent\",\n border: \"px\",\n borderColor: \"transparent\",\n },\n },\n error: {\n outline: {\n bg: \"surface-1\",\n border: \"px\",\n borderColor: \"red-6\",\n },\n ghost: {\n bg: \"transparent\",\n border: \"px\",\n borderColor: \"red-6\",\n },\n },\n },\n Text: {\n default: {\n color: \"default\",\n },\n disabled: {\n color: \"disabled\",\n },\n error: {\n color: \"default\",\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 Required,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Stack } from \"@telegraph/layout\";\nimport { Text } from \"@telegraph/typography\";\nimport React from \"react\";\n\nimport { COLOR, SIZE } from \"./Input.constants\";\n\nexport type BaseRootProps = {\n size?: \"1\" | \"2\" | \"3\";\n variant?: \"outline\" | \"ghost\";\n errored?: boolean;\n};\n\nexport type RootProps<T extends TgphElement = \"input\"> = BaseRootProps & {\n textProps?: Omit<React.ComponentProps<typeof Text<T>>, \"as\">;\n stackProps?: Omit<React.ComponentProps<typeof Stack>, \"as\">;\n} & Omit<React.ComponentProps<typeof Text<T>>, \"as\" | keyof 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 = \"input\">({\n as = \"input\" as T,\n size = \"2\",\n variant = \"outline\",\n textProps,\n stackProps,\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 <Stack\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 align=\"center\"\n {...SIZE.Container[size]}\n {...COLOR.Container[state][variant]}\n data-tgph-input-container\n data-tgph-input-container-variant={variant}\n data-tgph-input-container-state={state}\n data-tgph-input-container-size={size}\n {...stackProps}\n >\n {/* \n We choose to use the `<Text/>` component as a base here so that we can \n configure the text inside of the input to match the design system font sizes\n */}\n <Text\n as={Component}\n bg=\"transparent\"\n shadow=\"0\"\n h=\"full\"\n w=\"full\"\n disabled={disabled}\n tgphRef={composedRefs}\n {...SIZE.Text[size]}\n {...COLOR.Text[state]}\n {...props}\n {...textProps}\n data-tgph-input-field\n />\n {children}\n </Stack>\n </InputContext.Provider>\n );\n};\n\nexport type SlotProps = React.ComponentPropsWithoutRef<typeof RadixSlot> & {\n size?: \"1\" | \"2\" | \"3\";\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 <Stack\n align=\"center\"\n justify=\"center\"\n h=\"full\"\n data-tgph-input-slot\n data-tgph-input-slot-position={position}\n data-tgph-input-slot-size={props.size ?? context.size}\n {...(position === \"leading\" && SIZE.SlotLeading[context.size])}\n {...(position === \"trailing\" && SIZE.SlotTrailing[context.size])}\n >\n <RadixSlot size={context.size} {...props} ref={forwardedRef} />\n </Stack>\n );\n },\n);\n\nexport type DefaultProps<T extends TgphElement = \"input\"> = Omit<\n PolymorphicProps<T>,\n keyof BaseRootProps\n> &\n TgphComponentProps<typeof Root> & {\n LeadingComponent?: React.ReactNode;\n TrailingComponent?: React.ReactNode;\n };\n\nconst Default = <T extends TgphElement = \"input\">({\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","textProps","stackProps","disabled","errored","children","tgphRef","props","Component","inputRef","composedRefs","useComposedRefs","state","jsx","jsxs","Stack","event","input","Text","Slot","position","forwardedRef","context","RadixSlot","Default","LeadingComponent","TrailingComponent","Input"],"mappings":";;;;;;AAAO,MAAMA,IAAO;AAAA,EAClB,WAAW;AAAA,IACT,GAAK;AAAA,MACH,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,SAAS;AAAA,IAAA;AAAA,IAEX,GAAK;AAAA,MACH,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,SAAS;AAAA,IAAA;AAAA,IAEX,GAAK;AAAA,MACH,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,SAAS;AAAA,IAAA;AAAA,EACX;AAAA,EAEF,MAAM;AAAA,IACJ,GAAK;AAAA,MACH,MAAM;AAAA,MACN,IAAI;AAAA,IAAA;AAAA,IAEN,GAAK;AAAA,MACH,MAAM;AAAA,MACN,IAAI;AAAA,IAAA;AAAA,IAEN,GAAK;AAAA,MACH,MAAM;AAAA,MACN,IAAI;AAAA,IA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H;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/Input/Input.constants.ts","../../src/Input/Input.tsx"],"sourcesContent":["export const SIZE = {\n Container: {\n \"1\": {\n h: \"6\",\n pl: \"0\",\n rounded: \"2\",\n },\n \"2\": {\n h: \"8\",\n pl: \"0\",\n rounded: \"2\",\n },\n \"3\": {\n h: \"10\",\n pl: \"0\",\n rounded: \"2\",\n },\n },\n Text: {\n \"1\": {\n size: \"1\",\n px: \"1\",\n },\n \"2\": {\n size: \"2\",\n px: \"2\",\n },\n \"3\": {\n size: \"3\",\n px: \"3\",\n },\n },\n SlotLeading: {\n \"1\": {\n pl: \"1_5\",\n },\n \"2\": {\n pl: \"2\",\n },\n \"3\": {\n pl: \"3\",\n },\n },\n SlotTrailing: {\n \"1\": {\n pr: \"1\",\n },\n \"2\": {\n pr: \"2\",\n },\n \"3\": {\n pr: \"3\",\n },\n },\n} as const;\n\nexport const COLOR = {\n Container: {\n default: {\n outline: {\n bg: \"surface-3\",\n border: \"px\",\n borderColor: \"gray-6\",\n hover_backgroundColor: \"surface-2\",\n hover_borderColor: \"gray-7\",\n focus_within_backgroundColor: \"surface-3\",\n focus_within_borderColor: \"blue-8\",\n },\n ghost: {\n bg: \"transparent\",\n border: \"px\",\n borderColor: \"transparent\",\n hover_backgroundColor: \"surface-2\",\n hover_borderColor: \"gray-7\",\n focus_within_backgroundColor: \"surface-3\",\n focus_within_borderColor: \"blue-8\",\n },\n },\n disabled: {\n outline: {\n bg: \"gray-2\",\n border: \"px\",\n borderColor: \"transparent\",\n },\n ghost: {\n bg: \"transparent\",\n border: \"px\",\n borderColor: \"transparent\",\n },\n },\n error: {\n outline: {\n bg: \"surface-3\",\n border: \"px\",\n borderColor: \"red-6\",\n hover_backgroundColor: \"surface-2\",\n hover_borderColor: \"red-7\",\n focus_within_backgroundColor: \"surface-3\",\n focus_within_borderColor: \"blue-8\",\n },\n ghost: {\n bg: \"surface-3\",\n border: \"px\",\n borderColor: \"red-6\",\n hover_backgroundColor: \"surface-2\",\n hover_borderColor: \"red-7\",\n focus_within_backgroundColor: \"surface-3\",\n focus_within_borderColor: \"blue-8\",\n },\n },\n },\n Text: {\n default: {\n color: \"default\",\n },\n disabled: {\n color: \"disabled\",\n },\n error: {\n color: \"default\",\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 Required,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Stack } from \"@telegraph/layout\";\nimport { Text } from \"@telegraph/typography\";\nimport React from \"react\";\n\nimport { COLOR, SIZE } from \"./Input.constants\";\n\nexport type BaseRootProps = {\n size?: \"1\" | \"2\" | \"3\";\n variant?: \"outline\" | \"ghost\";\n errored?: boolean;\n};\n\nexport type RootProps<T extends TgphElement = \"input\"> = BaseRootProps & {\n textProps?: Omit<React.ComponentProps<typeof Text<T>>, \"as\">;\n stackProps?: Omit<React.ComponentProps<typeof Stack>, \"as\">;\n} & Omit<React.ComponentProps<typeof Text<T>>, \"as\" | keyof 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 = \"input\">({\n as = \"input\" as T,\n size = \"2\",\n variant = \"outline\",\n textProps,\n stackProps,\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 <Stack\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 align=\"center\"\n {...SIZE.Container[size]}\n {...COLOR.Container[state][variant]}\n data-tgph-input-container\n data-tgph-input-container-variant={variant}\n data-tgph-input-container-state={state}\n data-tgph-input-container-size={size}\n {...stackProps}\n >\n {/* \n We choose to use the `<Text/>` component as a base here so that we can \n configure the text inside of the input to match the design system font sizes\n */}\n <Text\n as={Component}\n bg=\"transparent\"\n shadow=\"0\"\n h=\"full\"\n w=\"full\"\n disabled={disabled}\n tgphRef={composedRefs}\n {...SIZE.Text[size]}\n {...COLOR.Text[state]}\n {...props}\n {...textProps}\n data-tgph-input-field\n />\n {children}\n </Stack>\n </InputContext.Provider>\n );\n};\n\nexport type SlotProps = React.ComponentPropsWithoutRef<typeof RadixSlot> & {\n size?: \"1\" | \"2\" | \"3\";\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 <Stack\n align=\"center\"\n justify=\"center\"\n h=\"full\"\n data-tgph-input-slot\n data-tgph-input-slot-position={position}\n data-tgph-input-slot-size={props.size ?? context.size}\n {...(position === \"leading\" && SIZE.SlotLeading[context.size])}\n {...(position === \"trailing\" && SIZE.SlotTrailing[context.size])}\n >\n <RadixSlot size={context.size} {...props} ref={forwardedRef} />\n </Stack>\n );\n },\n);\n\nexport type DefaultProps<T extends TgphElement = \"input\"> = Omit<\n PolymorphicProps<T>,\n keyof BaseRootProps\n> &\n TgphComponentProps<typeof Root> & {\n LeadingComponent?: React.ReactNode;\n TrailingComponent?: React.ReactNode;\n };\n\nconst Default = <T extends TgphElement = \"input\">({\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","textProps","stackProps","disabled","errored","children","tgphRef","props","Component","inputRef","composedRefs","useComposedRefs","state","jsx","jsxs","Stack","event","input","Text","Slot","position","forwardedRef","context","RadixSlot","Default","LeadingComponent","TrailingComponent","Input"],"mappings":";;;;;;AAAO,MAAMA,IAAO;AAAA,EAClB,WAAW;AAAA,IACT,GAAK;AAAA,MACH,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,SAAS;AAAA,IAAA;AAAA,IAEX,GAAK;AAAA,MACH,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,SAAS;AAAA,IAAA;AAAA,IAEX,GAAK;AAAA,MACH,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,SAAS;AAAA,IAAA;AAAA,EACX;AAAA,EAEF,MAAM;AAAA,IACJ,GAAK;AAAA,MACH,MAAM;AAAA,MACN,IAAI;AAAA,IAAA;AAAA,IAEN,GAAK;AAAA,MACH,MAAM;AAAA,MACN,IAAI;AAAA,IAAA;AAAA,IAEN,GAAK;AAAA,MACH,MAAM;AAAA,MACN,IAAI;AAAA,IAAA;AAAA,EACN;AAAA,EAEF,aAAa;AAAA,IACX,GAAK;AAAA,MACH,IAAI;AAAA,IAAA;AAAA,IAEN,GAAK;AAAA,MACH,IAAI;AAAA,IAAA;AAAA,IAEN,GAAK;AAAA,MACH,IAAI;AAAA,IAAA;AAAA,EACN;AAAA,EAEF,cAAc;AAAA,IACZ,GAAK;AAAA,MACH,IAAI;AAAA,IAAA;AAAA,IAEN,GAAK;AAAA,MACH,IAAI;AAAA,IAAA;AAAA,IAEN,GAAK;AAAA,MACH,IAAI;AAAA,IAA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AA,YACnB,GAAGL;AAAA,YACH,GAAGN;AAAA,YACJ,yBAAqB;AAAA,UAAA;AAAA,QAAA;AAAA,QAEtBI;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ,GAQMc,IAAOvB,EAAM;AAAA,EACjB,CAAC,EAAE,UAAAwB,IAAW,WAAW,GAAGb,EAAA,GAASc,MAAiB;AACpD,UAAMC,IAAU1B,EAAM,WAAWD,CAAY;AAC7C,WACE,gBAAAkB;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,GAAE;AAAA,QACF,wBAAoB;AAAA,QACpB,iCAA+BK;AAAA,QAC/B,6BAA2Bb,EAAM,QAAQe,EAAQ;AAAA,QAChD,GAAIF,MAAa,aAAa3B,EAAK,YAAY6B,EAAQ,IAAI;AAAA,QAC3D,GAAIF,MAAa,cAAc3B,EAAK,aAAa6B,EAAQ,IAAI;AAAA,QAE9D,UAAA,gBAAAT,EAACU,KAAU,MAAMD,EAAQ,MAAO,GAAGf,GAAO,KAAKc,EAAA,CAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAGnE;AACF,GAWMG,IAAU,CAAkC;AAAA,EAChD,kBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,GAAGnB;AACL,MAEI,gBAAAO,EAACjB,GAAA,EAAM,GAAGU,GACP,UAAA;AAAA,EAAAkB,KAAoB,gBAAAZ,EAACM,GAAA,EAAK,UAAS,WAAW,UAAAM,GAAiB;AAAA,EAC/DC,KACC,gBAAAb,EAACM,GAAA,EAAK,UAAS,YAAY,UAAAO,EAAA,CAAkB;AAAA,GAEjD;AAIJ,OAAO,OAAOF,GAAS,EAAE,MAAA3B,GAAM,MAAAsB,GAAM;AAErC,MAAMQ,IAAQH;"}
@@ -57,19 +57,21 @@ export declare const COLOR: {
57
57
  readonly Container: {
58
58
  readonly default: {
59
59
  readonly outline: {
60
- readonly bg: "surface-1";
60
+ readonly bg: "surface-3";
61
61
  readonly border: "px";
62
62
  readonly borderColor: "gray-6";
63
+ readonly hover_backgroundColor: "surface-2";
63
64
  readonly hover_borderColor: "gray-7";
65
+ readonly focus_within_backgroundColor: "surface-3";
64
66
  readonly focus_within_borderColor: "blue-8";
65
67
  };
66
68
  readonly ghost: {
67
69
  readonly bg: "transparent";
68
70
  readonly border: "px";
69
71
  readonly borderColor: "transparent";
70
- readonly hover_backgroundColor: "gray-3";
71
- readonly hover_borderColor: "transparent";
72
- readonly focus_within_backgroundColor: "gray-4";
72
+ readonly hover_backgroundColor: "surface-2";
73
+ readonly hover_borderColor: "gray-7";
74
+ readonly focus_within_backgroundColor: "surface-3";
73
75
  readonly focus_within_borderColor: "blue-8";
74
76
  };
75
77
  };
@@ -77,7 +79,7 @@ export declare const COLOR: {
77
79
  readonly outline: {
78
80
  readonly bg: "gray-2";
79
81
  readonly border: "px";
80
- readonly borderColor: "gray-2";
82
+ readonly borderColor: "transparent";
81
83
  };
82
84
  readonly ghost: {
83
85
  readonly bg: "transparent";
@@ -87,14 +89,22 @@ export declare const COLOR: {
87
89
  };
88
90
  readonly error: {
89
91
  readonly outline: {
90
- readonly bg: "surface-1";
92
+ readonly bg: "surface-3";
91
93
  readonly border: "px";
92
94
  readonly borderColor: "red-6";
95
+ readonly hover_backgroundColor: "surface-2";
96
+ readonly hover_borderColor: "red-7";
97
+ readonly focus_within_backgroundColor: "surface-3";
98
+ readonly focus_within_borderColor: "blue-8";
93
99
  };
94
100
  readonly ghost: {
95
- readonly bg: "transparent";
101
+ readonly bg: "surface-3";
96
102
  readonly border: "px";
97
103
  readonly borderColor: "red-6";
104
+ readonly hover_backgroundColor: "surface-2";
105
+ readonly hover_borderColor: "red-7";
106
+ readonly focus_within_backgroundColor: "surface-3";
107
+ readonly focus_within_borderColor: "blue-8";
98
108
  };
99
109
  };
100
110
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Input.constants.d.ts","sourceRoot":"","sources":["../../../src/Input/Input.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDP,CAAC;AAEX,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDR,CAAC"}
1
+ {"version":3,"file":"Input.constants.d.ts","sourceRoot":"","sources":["../../../src/Input/Input.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDP,CAAC;AAEX,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkER,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telegraph/input",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Input component for Telegraph",
5
5
  "repository": "https://github.com/knocklabs/telegraph/tree/main/packages/input",
6
6
  "author": "@knocklabs",
@@ -32,7 +32,7 @@
32
32
  "preview": "vite preview"
33
33
  },
34
34
  "dependencies": {
35
- "@radix-ui/react-slot": "^1.2.3",
35
+ "@radix-ui/react-slot": "^1.2.4",
36
36
  "@telegraph/compose-refs": "^0.0.8",
37
37
  "@telegraph/helpers": "^0.0.15",
38
38
  "@telegraph/layout": "^0.4.0",
@@ -46,7 +46,7 @@
46
46
  "@telegraph/prettier-config": "^0.0.7",
47
47
  "@telegraph/vite-config": "^0.0.15",
48
48
  "@types/react": "^19.2.9",
49
- "eslint": "^8.56.0",
49
+ "eslint": "^10.0.2",
50
50
  "react": "^19.2.4",
51
51
  "react-dom": "^19.2.4",
52
52
  "typescript": "^5.9.3",