@telegraph/input 0.0.47 → 0.0.49
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 +22 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/css/default.css +1 -1
- package/dist/esm/index.mjs +156 -100
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/Input/Input.constants.d.ts +92 -28
- package/dist/types/Input/Input.constants.d.ts.map +1 -1
- package/dist/types/Input/Input.d.ts +8 -9
- package/dist/types/Input/Input.d.ts.map +1 -1
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @telegraph/input
|
|
2
2
|
|
|
3
|
+
## 0.0.49
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`bca0117`](https://github.com/knocklabs/telegraph/commit/bca011776c3b8b96e4f46a049578fcd7a167e052)]:
|
|
8
|
+
- @telegraph/layout@0.2.0
|
|
9
|
+
- @telegraph/typography@0.1.22
|
|
10
|
+
|
|
11
|
+
## 0.0.48
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#501](https://github.com/knocklabs/telegraph/pull/501) [`dc12662`](https://github.com/knocklabs/telegraph/commit/dc12662f6f41697d976d0978871a567d564777e8) Thanks [@kylemcd](https://github.com/kylemcd)! - deprecate usage of `@telegraph/motion` in favor of tiny `motion` package
|
|
16
|
+
|
|
17
|
+
- [#498](https://github.com/knocklabs/telegraph/pull/498) [`99e01e3`](https://github.com/knocklabs/telegraph/commit/99e01e3dcf7508af0bfae14e9b62cccff7af3388) Thanks [@kylemcd](https://github.com/kylemcd)! - update imports for the `Lucide` object from `@telegraph/icon` to import icons directly from `lucide-react` instead.
|
|
18
|
+
|
|
19
|
+
- [#497](https://github.com/knocklabs/telegraph/pull/497) [`2d3e1cd`](https://github.com/knocklabs/telegraph/commit/2d3e1cddd8a6bfac7108e350649f81bdc18f57c8) Thanks [@kylemcd](https://github.com/kylemcd)! - deprecate tailwind usage and migrate any remaining packages
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`e554068`](https://github.com/knocklabs/telegraph/commit/e554068b0f9ca5a1e8fe9d6f27dd2a30373a3cc8), [`99e01e3`](https://github.com/knocklabs/telegraph/commit/99e01e3dcf7508af0bfae14e9b62cccff7af3388), [`2d3e1cd`](https://github.com/knocklabs/telegraph/commit/2d3e1cddd8a6bfac7108e350649f81bdc18f57c8)]:
|
|
22
|
+
- @telegraph/layout@0.1.21
|
|
23
|
+
- @telegraph/typography@0.1.21
|
|
24
|
+
|
|
3
25
|
## 0.0.47
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),_=require("@radix-ui/react-slot"),q=require("@telegraph/compose-refs"),b=require("@telegraph/layout"),w=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"},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,disabled:u,errored:C,children:j,tgphRef:y,...S})=>{const R=e,d=s.useRef(null),z=q.useComposedRefs(y,d),a=u?"disabled":C?"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,children:[r.jsx(w.Text,{as:R,bg:"transparent",shadow:"0",h:"full",w:"full",disabled:u,tgphRef:z,...i.Text[t],...g.Text[a],...S,...n,"data-tgph-input-field":!0}),j]})})},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(_.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 T=x;exports.Input=T;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -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\": \
|
|
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\",\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\ntype BaseRootProps = {\n size?: \"1\" | \"2\" | \"3\";\n variant?: \"outline\" | \"ghost\";\n errored?: boolean;\n};\n\ntype RootProps<T extends TgphElement> = BaseRootProps & {\n textProps?: Omit<React.ComponentProps<typeof Text<T>>, \"as\">;\n} & Omit<React.ComponentProps<typeof Text<T>>, \"as\">;\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 textProps,\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 >\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\ntype 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\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","textProps","disabled","errored","children","tgphRef","props","Component","inputRef","composedRefs","useComposedRefs","state","jsx","jsxs","Stack","event","input","Text","Slot","position","forwardedRef","context","RadixSlot","Default","LeadingComponent","T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SACR,EAAE,OACF,uBAAoB,GACpB,gCAA+BK,EAC/B,4BAA2Bb,EAAM,MAAQe,EAAQ,KAChD,GAAIF,IAAa,WAAa1B,EAAK,YAAY4B,EAAQ,IAAI,EAC3D,GAAIF,IAAa,YAAc1B,EAAK,aAAa4B,EAAQ,IAAI,EAE9D,SAAAT,EAAAA,IAACU,EAAAA,MAAU,KAAMD,EAAQ,KAAO,GAAGf,EAAO,IAAKc,CAAA,CAAc,CAAA,CAAA,CAGnE,CACF,EAQMG,EAAU,CAAwB,CACtC,iBAAAC,EACA,kBAAAC,EACA,GAAGnB,CACL,IAEIO,EAAAA,KAAChB,EAAA,CAAM,GAAGS,EACP,SAAA,CAAAkB,GAAoBZ,EAAAA,IAACM,EAAA,CAAK,SAAS,UAAW,SAAAM,EAAiB,EAC/DC,GACCb,EAAAA,IAACM,EAAA,CAAK,SAAS,WAAY,SAAAO,CAAA,CAAkB,CAAA,EAEjD,EAIJ,OAAO,OAAOF,EAAS,CAAE,KAAA1B,EAAM,KAAAqB,EAAM,EAErC,MAAMQ,EAAQH"}
|
package/dist/css/default.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
[data-tgph-input-container]{box-sizing:border-box}[data-tgph-input-slot]{box-sizing:border-box;order:2}[data-tgph-input-slot]>[data-tgph-button]{width:var(--tgph-spacing-full);height:var(--tgph-spacing-auto)}[data-tgph-input-slot]>[data-tgph-button-layout=icon-only]{aspect-ratio:1;padding:var(--tgph-spacing-0)}[data-tgph-input-slot]>[data-tgph-button-layout=default]{padding:var(--tgph-spacing-2)}[data-tgph-input-slot]:has([data-tgph-button-layout=icon-only]){aspect-ratio:1}[data-tgph-input-slot]:has([data-tgph-button-layout=icon-only]){padding:var(--tgph-spacing-1)!important}[data-tgph-input-slot-position=leading]{order:1}[data-tgph-input-slot-position=trailing]{order:3}[data-tgph-input-slot-size="1"]>[data-tgph-button]{border-radius:var(--tgph-rounded-1)}[data-tgph-input-slot-size="2"]>[data-tgph-button]{border-radius:var(--tgph-rounded-1)}[data-tgph-input-slot-size="3"]>[data-tgph-button]{border-radius:var(--tgph-rounded-2)}[data-tgph-input-container-state=disabled]{cursor:not-allowed}[data-tgph-input-field]{-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none;box-shadow:none;order:2;font-family:inherit}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,57 +1,120 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Slot as
|
|
3
|
-
import { useComposedRefs as
|
|
4
|
-
import {
|
|
5
|
-
import { Text as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
const n = {
|
|
1
|
+
import { jsx as n, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { Slot as y } from "@radix-ui/react-slot";
|
|
3
|
+
import { useComposedRefs as T } from "@telegraph/compose-refs";
|
|
4
|
+
import { Stack as b } from "@telegraph/layout";
|
|
5
|
+
import { Text as v } from "@telegraph/typography";
|
|
6
|
+
import i from "react";
|
|
7
|
+
const l = {
|
|
9
8
|
Container: {
|
|
10
|
-
1:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
1: {
|
|
10
|
+
h: "6",
|
|
11
|
+
pl: "0",
|
|
12
|
+
rounded: "2"
|
|
13
|
+
},
|
|
14
|
+
2: {
|
|
15
|
+
h: "8",
|
|
16
|
+
pl: "0",
|
|
17
|
+
rounded: "2"
|
|
18
|
+
},
|
|
19
|
+
3: {
|
|
20
|
+
h: "10",
|
|
21
|
+
pl: "0",
|
|
22
|
+
rounded: "2"
|
|
23
|
+
}
|
|
18
24
|
},
|
|
19
25
|
Text: {
|
|
20
|
-
1:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
1: {
|
|
27
|
+
size: "1",
|
|
28
|
+
px: "1"
|
|
29
|
+
},
|
|
30
|
+
2: {
|
|
31
|
+
size: "2",
|
|
32
|
+
px: "2"
|
|
33
|
+
},
|
|
34
|
+
3: {
|
|
35
|
+
size: "3",
|
|
36
|
+
px: "3"
|
|
37
|
+
}
|
|
28
38
|
},
|
|
29
39
|
SlotLeading: {
|
|
30
|
-
1:
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
1: {
|
|
41
|
+
pl: "1"
|
|
42
|
+
},
|
|
43
|
+
2: {
|
|
44
|
+
pl: "2"
|
|
45
|
+
},
|
|
46
|
+
3: {
|
|
47
|
+
pl: "3"
|
|
48
|
+
}
|
|
33
49
|
},
|
|
34
50
|
SlotTrailing: {
|
|
35
|
-
1:
|
|
36
|
-
|
|
37
|
-
|
|
51
|
+
1: {
|
|
52
|
+
pr: "1"
|
|
53
|
+
},
|
|
54
|
+
2: {
|
|
55
|
+
pr: "2"
|
|
56
|
+
},
|
|
57
|
+
3: {
|
|
58
|
+
pr: "3"
|
|
59
|
+
}
|
|
38
60
|
}
|
|
39
|
-
},
|
|
61
|
+
}, g = {
|
|
40
62
|
Container: {
|
|
41
63
|
default: {
|
|
42
|
-
outline:
|
|
43
|
-
|
|
64
|
+
outline: {
|
|
65
|
+
bg: "surface-1",
|
|
66
|
+
border: "px",
|
|
67
|
+
borderColor: "gray-6",
|
|
68
|
+
hover_borderColor: "gray-7",
|
|
69
|
+
focus_within_borderColor: "blue-8"
|
|
70
|
+
},
|
|
71
|
+
ghost: {
|
|
72
|
+
bg: "transparent",
|
|
73
|
+
border: "px",
|
|
74
|
+
borderColor: "transparent",
|
|
75
|
+
hover_backgroundColor: "gray-3",
|
|
76
|
+
hover_borderColor: "transparent",
|
|
77
|
+
focus_within_backgroundColor: "gray-4",
|
|
78
|
+
focus_within_borderColor: "blue-8"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
disabled: {
|
|
82
|
+
outline: {
|
|
83
|
+
bg: "gray-2",
|
|
84
|
+
border: "px",
|
|
85
|
+
borderColor: "gray-2"
|
|
86
|
+
},
|
|
87
|
+
ghost: {
|
|
88
|
+
bg: "transparent",
|
|
89
|
+
border: "px",
|
|
90
|
+
borderColor: "transparent"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
error: {
|
|
94
|
+
outline: {
|
|
95
|
+
bg: "surface-1",
|
|
96
|
+
border: "px",
|
|
97
|
+
borderColor: "red-6"
|
|
98
|
+
},
|
|
99
|
+
ghost: {
|
|
100
|
+
bg: "transparent",
|
|
101
|
+
border: "px",
|
|
102
|
+
borderColor: "red-6"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
Text: {
|
|
107
|
+
default: {
|
|
108
|
+
color: "default"
|
|
44
109
|
},
|
|
45
110
|
disabled: {
|
|
46
|
-
|
|
47
|
-
ghost: "cursor-not-allowed bg-transparent border border-transparent [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9"
|
|
111
|
+
color: "disabled"
|
|
48
112
|
},
|
|
49
113
|
error: {
|
|
50
|
-
|
|
51
|
-
ghost: "bg-transparent border-red-6"
|
|
114
|
+
color: "default"
|
|
52
115
|
}
|
|
53
116
|
}
|
|
54
|
-
},
|
|
117
|
+
}, h = i.createContext({
|
|
55
118
|
state: "default",
|
|
56
119
|
size: "2",
|
|
57
120
|
variant: "outline"
|
|
@@ -59,92 +122,85 @@ const n = {
|
|
|
59
122
|
as: r = "input",
|
|
60
123
|
size: t = "2",
|
|
61
124
|
variant: e = "outline",
|
|
62
|
-
textProps: o
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
children: S,
|
|
125
|
+
textProps: o,
|
|
126
|
+
disabled: d,
|
|
127
|
+
errored: m,
|
|
128
|
+
children: z,
|
|
67
129
|
tgphRef: R,
|
|
68
|
-
...
|
|
130
|
+
...S
|
|
69
131
|
}) => {
|
|
70
|
-
const
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
-
|
|
132
|
+
const _ = r, u = i.useRef(null), w = T(R, u), a = d ? "disabled" : m ? "error" : "default";
|
|
133
|
+
return /* @__PURE__ */ n(h.Provider, { value: { size: t, variant: e, state: a }, children: /* @__PURE__ */ f(
|
|
134
|
+
b,
|
|
73
135
|
{
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
q.Container[p][e],
|
|
78
|
-
n.Container[t]
|
|
79
|
-
),
|
|
80
|
-
onPointerDown: (c) => {
|
|
81
|
-
if (c.target.closest("button, a")) {
|
|
82
|
-
c.preventDefault();
|
|
136
|
+
onPointerDown: (p) => {
|
|
137
|
+
if (p.target.closest("button, a")) {
|
|
138
|
+
p.preventDefault();
|
|
83
139
|
return;
|
|
84
140
|
}
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
141
|
+
const c = u.current;
|
|
142
|
+
c && requestAnimationFrame(() => {
|
|
143
|
+
c.focus();
|
|
88
144
|
});
|
|
89
145
|
},
|
|
146
|
+
align: "center",
|
|
147
|
+
...l.Container[t],
|
|
148
|
+
...g.Container[a][e],
|
|
149
|
+
"data-tgph-input-container": !0,
|
|
150
|
+
"data-tgph-input-container-variant": e,
|
|
151
|
+
"data-tgph-input-container-state": a,
|
|
152
|
+
"data-tgph-input-container-size": t,
|
|
90
153
|
children: [
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
154
|
+
/* @__PURE__ */ n(
|
|
155
|
+
v,
|
|
93
156
|
{
|
|
94
|
-
as:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
157
|
+
as: _,
|
|
158
|
+
bg: "transparent",
|
|
159
|
+
shadow: "0",
|
|
160
|
+
h: "full",
|
|
161
|
+
w: "full",
|
|
162
|
+
disabled: d,
|
|
163
|
+
tgphRef: w,
|
|
164
|
+
...l.Text[t],
|
|
165
|
+
...g.Text[a],
|
|
166
|
+
...S,
|
|
103
167
|
...o,
|
|
104
|
-
|
|
105
|
-
tgphRef: I
|
|
168
|
+
"data-tgph-input-field": !0
|
|
106
169
|
}
|
|
107
170
|
),
|
|
108
|
-
|
|
171
|
+
z
|
|
109
172
|
]
|
|
110
173
|
}
|
|
111
174
|
) });
|
|
112
|
-
}, s =
|
|
175
|
+
}, s = i.forwardRef(
|
|
113
176
|
({ position: r = "leading", ...t }, e) => {
|
|
114
|
-
const o =
|
|
115
|
-
return /* @__PURE__ */
|
|
116
|
-
|
|
177
|
+
const o = i.useContext(h);
|
|
178
|
+
return /* @__PURE__ */ n(
|
|
179
|
+
b,
|
|
117
180
|
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
// If only an icon button is present, reset the padding to spacing-1
|
|
128
|
-
"[&:has([data-tgph-button-layout='icon-only'])]:!p-1",
|
|
129
|
-
r === "leading" && n.SlotLeading[o.size],
|
|
130
|
-
r === "trailing" && n.SlotTrailing[o.size],
|
|
131
|
-
n.Slot[t.size ?? o.size]
|
|
132
|
-
),
|
|
133
|
-
children: /* @__PURE__ */ a(j, { size: o.size, ...t, ref: e })
|
|
181
|
+
align: "center",
|
|
182
|
+
justify: "center",
|
|
183
|
+
h: "full",
|
|
184
|
+
"data-tgph-input-slot": !0,
|
|
185
|
+
"data-tgph-input-slot-position": r,
|
|
186
|
+
"data-tgph-input-slot-size": t.size ?? o.size,
|
|
187
|
+
...r === "leading" && l.SlotLeading[o.size],
|
|
188
|
+
...r === "trailing" && l.SlotTrailing[o.size],
|
|
189
|
+
children: /* @__PURE__ */ n(y, { size: o.size, ...t, ref: e })
|
|
134
190
|
}
|
|
135
191
|
);
|
|
136
192
|
}
|
|
137
|
-
),
|
|
193
|
+
), C = ({
|
|
138
194
|
LeadingComponent: r,
|
|
139
195
|
TrailingComponent: t,
|
|
140
196
|
...e
|
|
141
|
-
}) => /* @__PURE__ */
|
|
142
|
-
r && /* @__PURE__ */
|
|
143
|
-
t && /* @__PURE__ */
|
|
197
|
+
}) => /* @__PURE__ */ f(x, { ...e, children: [
|
|
198
|
+
r && /* @__PURE__ */ n(s, { position: "leading", children: r }),
|
|
199
|
+
t && /* @__PURE__ */ n(s, { position: "trailing", children: t })
|
|
144
200
|
] });
|
|
145
|
-
Object.assign(
|
|
146
|
-
const
|
|
201
|
+
Object.assign(C, { Root: x, Slot: s });
|
|
202
|
+
const q = C;
|
|
147
203
|
export {
|
|
148
|
-
|
|
204
|
+
q as Input
|
|
149
205
|
};
|
|
150
206
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -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\": \"px-1\",\n \"2\": \"px-2\",\n \"3\": \"px-3\",\n },\n Text: {\n \"1\": \"1\",\n \"2\": \"2\",\n \"3\": \"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 { Text } from \"@telegraph/typography\";\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 textProps?: Omit<React.ComponentProps<typeof Text<\"input\">>, \"as\">;\n };\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 textProps = { size: SIZE.Text[size], color: \"default\" },\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 {/* \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 className={clsx(\n \"appearance-none 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 {...textProps}\n {...props}\n tgphRef={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","textProps","className","disabled","errored","children","tgphRef","props","Component","inputRef","composedRefs","useComposedRefs","state","jsx","jsxs","Box","clsx","event","input","Text","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,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,EAAA;AAET,GAEaC,IAAQ;AAAA,EACnB,WAAW;AA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AA,GAEjD;AAIJ,OAAO,OAAOF,GAAS,EAAE,MAAA5B,GAAM,MAAAuB,GAAM;AAErC,MAAMQ,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\": {\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\",\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\ntype BaseRootProps = {\n size?: \"1\" | \"2\" | \"3\";\n variant?: \"outline\" | \"ghost\";\n errored?: boolean;\n};\n\ntype RootProps<T extends TgphElement> = BaseRootProps & {\n textProps?: Omit<React.ComponentProps<typeof Text<T>>, \"as\">;\n} & Omit<React.ComponentProps<typeof Text<T>>, \"as\">;\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 textProps,\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 >\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\ntype 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\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","textProps","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,IAAA;AAAA,EACN;AAEJ,GAEaC,IAAQ;AAAA,EACnB,WAAW;AAAA,IACT,SAAS;AAAA,MACP,SAAS;AAAA,QACP,IAAI;AAAA,QACJ,QAAQ;AAAA,QACR,aAAa;AAAA,QACb,mBAAmB;AAAA,QACnB,0BAA0B;AAAA,MAAA;AAAA,MAE5B,OAAO;AAAA,QACL,IAAI;AAAA,QACJ,QAAQ;AAAA,QACR,aAAa;AAAA,QACb,uBAAuB;AA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,GAAIF,MAAa,cAAc1B,EAAK,aAAa4B,EAAQ,IAAI;AAAA,QAE9D,UAAA,gBAAAT,EAACU,KAAU,MAAMD,EAAQ,MAAO,GAAGf,GAAO,KAAKc,EAAA,CAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAGnE;AACF,GAQMG,IAAU,CAAwB;AAAA,EACtC,kBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,GAAGnB;AACL,MAEI,gBAAAO,EAAChB,GAAA,EAAM,GAAGS,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,MAAA1B,GAAM,MAAAqB,GAAM;AAErC,MAAMQ,IAAQH;"}
|
|
@@ -1,48 +1,112 @@
|
|
|
1
1
|
export declare const SIZE: {
|
|
2
2
|
readonly Container: {
|
|
3
|
-
readonly "1":
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
readonly "
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
readonly "1": {
|
|
4
|
+
readonly h: "6";
|
|
5
|
+
readonly pl: "0";
|
|
6
|
+
readonly rounded: "2";
|
|
7
|
+
};
|
|
8
|
+
readonly "2": {
|
|
9
|
+
readonly h: "8";
|
|
10
|
+
readonly pl: "0";
|
|
11
|
+
readonly rounded: "2";
|
|
12
|
+
};
|
|
13
|
+
readonly "3": {
|
|
14
|
+
readonly h: "10";
|
|
15
|
+
readonly pl: "0";
|
|
16
|
+
readonly rounded: "2";
|
|
17
|
+
};
|
|
11
18
|
};
|
|
12
19
|
readonly Text: {
|
|
13
|
-
readonly "1":
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
readonly "1": {
|
|
21
|
+
readonly size: "1";
|
|
22
|
+
readonly px: "1";
|
|
23
|
+
};
|
|
24
|
+
readonly "2": {
|
|
25
|
+
readonly size: "2";
|
|
26
|
+
readonly px: "2";
|
|
27
|
+
};
|
|
28
|
+
readonly "3": {
|
|
29
|
+
readonly size: "3";
|
|
30
|
+
readonly px: "3";
|
|
31
|
+
};
|
|
21
32
|
};
|
|
22
33
|
readonly SlotLeading: {
|
|
23
|
-
readonly "1":
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
readonly "1": {
|
|
35
|
+
readonly pl: "1";
|
|
36
|
+
};
|
|
37
|
+
readonly "2": {
|
|
38
|
+
readonly pl: "2";
|
|
39
|
+
};
|
|
40
|
+
readonly "3": {
|
|
41
|
+
readonly pl: "3";
|
|
42
|
+
};
|
|
26
43
|
};
|
|
27
44
|
readonly SlotTrailing: {
|
|
28
|
-
readonly "1":
|
|
29
|
-
|
|
30
|
-
|
|
45
|
+
readonly "1": {
|
|
46
|
+
readonly pr: "1";
|
|
47
|
+
};
|
|
48
|
+
readonly "2": {
|
|
49
|
+
readonly pr: "2";
|
|
50
|
+
};
|
|
51
|
+
readonly "3": {
|
|
52
|
+
readonly pr: "3";
|
|
53
|
+
};
|
|
31
54
|
};
|
|
32
55
|
};
|
|
33
56
|
export declare const COLOR: {
|
|
34
57
|
readonly Container: {
|
|
35
58
|
readonly default: {
|
|
36
|
-
readonly outline:
|
|
37
|
-
|
|
59
|
+
readonly outline: {
|
|
60
|
+
readonly bg: "surface-1";
|
|
61
|
+
readonly border: "px";
|
|
62
|
+
readonly borderColor: "gray-6";
|
|
63
|
+
readonly hover_borderColor: "gray-7";
|
|
64
|
+
readonly focus_within_borderColor: "blue-8";
|
|
65
|
+
};
|
|
66
|
+
readonly ghost: {
|
|
67
|
+
readonly bg: "transparent";
|
|
68
|
+
readonly border: "px";
|
|
69
|
+
readonly borderColor: "transparent";
|
|
70
|
+
readonly hover_backgroundColor: "gray-3";
|
|
71
|
+
readonly hover_borderColor: "transparent";
|
|
72
|
+
readonly focus_within_backgroundColor: "gray-4";
|
|
73
|
+
readonly focus_within_borderColor: "blue-8";
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
readonly disabled: {
|
|
77
|
+
readonly outline: {
|
|
78
|
+
readonly bg: "gray-2";
|
|
79
|
+
readonly border: "px";
|
|
80
|
+
readonly borderColor: "gray-2";
|
|
81
|
+
};
|
|
82
|
+
readonly ghost: {
|
|
83
|
+
readonly bg: "transparent";
|
|
84
|
+
readonly border: "px";
|
|
85
|
+
readonly borderColor: "transparent";
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
readonly error: {
|
|
89
|
+
readonly outline: {
|
|
90
|
+
readonly bg: "surface-1";
|
|
91
|
+
readonly border: "px";
|
|
92
|
+
readonly borderColor: "red-6";
|
|
93
|
+
};
|
|
94
|
+
readonly ghost: {
|
|
95
|
+
readonly bg: "transparent";
|
|
96
|
+
readonly border: "px";
|
|
97
|
+
readonly borderColor: "red-6";
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
readonly Text: {
|
|
102
|
+
readonly default: {
|
|
103
|
+
readonly color: "default";
|
|
38
104
|
};
|
|
39
105
|
readonly disabled: {
|
|
40
|
-
readonly
|
|
41
|
-
readonly ghost: "cursor-not-allowed bg-transparent border border-transparent [&_[data-tgph-icon]]:text-gray-8 placeholder:text-gray-9 [&>input]:text-gray-9";
|
|
106
|
+
readonly color: "disabled";
|
|
42
107
|
};
|
|
43
108
|
readonly error: {
|
|
44
|
-
readonly
|
|
45
|
-
readonly ghost: "bg-transparent border-red-6";
|
|
109
|
+
readonly color: "default";
|
|
46
110
|
};
|
|
47
111
|
};
|
|
48
112
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.constants.d.ts","sourceRoot":"","sources":["../../../src/Input/Input.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI
|
|
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,18 +1,17 @@
|
|
|
1
|
-
import { PolymorphicProps,
|
|
1
|
+
import { PolymorphicProps, TgphComponentProps, TgphElement } from '@telegraph/helpers';
|
|
2
2
|
import { Text } from '@telegraph/typography';
|
|
3
3
|
import { default as React } from 'react';
|
|
4
|
-
import { COLOR, SIZE } from './Input.constants';
|
|
5
4
|
type BaseRootProps = {
|
|
6
|
-
size?:
|
|
7
|
-
variant?:
|
|
5
|
+
size?: "1" | "2" | "3";
|
|
6
|
+
variant?: "outline" | "ghost";
|
|
8
7
|
errored?: boolean;
|
|
9
8
|
};
|
|
10
|
-
type RootProps<T extends TgphElement> =
|
|
11
|
-
textProps?: Omit<React.ComponentProps<typeof Text<
|
|
12
|
-
}
|
|
13
|
-
declare const Root: <T extends TgphElement>({ as, size, variant, textProps,
|
|
9
|
+
type RootProps<T extends TgphElement> = BaseRootProps & {
|
|
10
|
+
textProps?: Omit<React.ComponentProps<typeof Text<T>>, "as">;
|
|
11
|
+
} & Omit<React.ComponentProps<typeof Text<T>>, "as">;
|
|
12
|
+
declare const Root: <T extends TgphElement>({ as, size, variant, textProps, disabled, errored, children, tgphRef, ...props }: RootProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
14
13
|
declare const Slot: React.ForwardRefExoticComponent<Omit<import('@radix-ui/react-slot').SlotProps & React.RefAttributes<HTMLElement>, "ref"> & {
|
|
15
|
-
size?:
|
|
14
|
+
size?: "1" | "2" | "3";
|
|
16
15
|
position?: "leading" | "trailing";
|
|
17
16
|
} & React.RefAttributes<HTMLElement>>;
|
|
18
17
|
type DefaultProps<T extends TgphElement> = PolymorphicProps<T> & TgphComponentProps<typeof Root> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/Input/Input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/Input/Input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAEhB,kBAAkB,EAClB,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACvB,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,SAAS,CAAC,CAAC,SAAS,WAAW,IAAI,aAAa,GAAG;IACtD,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;CAC9D,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAYrD,QAAA,MAAM,IAAI,GAAI,CAAC,SAAS,WAAW,oFAUhC,SAAS,CAAC,CAAC,CAAC,4CAyDd,CAAC;AAQF,QAAA,MAAM,IAAI;WALD,GAAG,GAAG,GAAG,GAAG,GAAG;eACX,SAAS,GAAG,UAAU;qCAsBlC,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;AAEJ,QAAA,MAAM,OAAO,GAAI,CAAC,SAAS,WAAW,qDAInC,YAAY,CAAC,CAAC,CAAC,4CASjB,CAAC;AAIF,QAAA,MAAM,KAAK,EAAc,OAAO,OAAO,GAAG;IACxC,IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,IAAI,EAAE,OAAO,IAAI,CAAC;CACnB,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telegraph/input",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.49",
|
|
4
4
|
"description": "Input component for Telegraph",
|
|
5
5
|
"repository": "https://github.com/knocklabs/telegraph/tree/main/packages/input",
|
|
6
6
|
"author": "@knocklabs",
|
|
@@ -35,16 +35,15 @@
|
|
|
35
35
|
"@radix-ui/react-slot": "^1.2.3",
|
|
36
36
|
"@telegraph/compose-refs": "^0.0.7",
|
|
37
37
|
"@telegraph/helpers": "^0.0.13",
|
|
38
|
-
"@telegraph/layout": "^0.
|
|
39
|
-
"@telegraph/typography": "^0.1.
|
|
38
|
+
"@telegraph/layout": "^0.2.0",
|
|
39
|
+
"@telegraph/typography": "^0.1.22",
|
|
40
40
|
"clsx": "^2.1.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@knocklabs/eslint-config": "^0.0.4",
|
|
44
44
|
"@knocklabs/typescript-config": "^0.0.2",
|
|
45
|
-
"@telegraph/postcss-config": "^0.0.
|
|
45
|
+
"@telegraph/postcss-config": "^0.0.28",
|
|
46
46
|
"@telegraph/prettier-config": "^0.0.7",
|
|
47
|
-
"@telegraph/tailwind-config": "^0.0.13",
|
|
48
47
|
"@telegraph/vite-config": "^0.0.15",
|
|
49
48
|
"@types/react": "^18.3.18",
|
|
50
49
|
"eslint": "^8.56.0",
|