@telegraph/textarea 0.1.9 → 0.2.0
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 +11 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +56 -46
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/TextArea/TextArea.constants.d.ts +2 -2
- package/dist/types/TextArea/TextArea.constants.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @telegraph/textarea
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#714](https://github.com/knocklabs/telegraph/pull/714) [`627e61c`](https://github.com/knocklabs/telegraph/commit/627e61c3b17ccfc36f5fb835bb5f21a092efca95) Thanks [@kylemcd](https://github.com/kylemcd)! - feat: hover, focus, etc states as component props
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies []:
|
|
12
|
+
- @telegraph/typography@0.2.1
|
|
13
|
+
|
|
3
14
|
## 0.1.9
|
|
4
15
|
|
|
5
16
|
### 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 n=require("react/jsx-runtime"),b=require("@telegraph/typography"),l={1:{px:"1_5",py:"1",size:"1",rounded:"2"},2:{px:"2",py:"1_5",size:"2",rounded:"2"},3:{px:"3",py:"2",size:"3",rounded:"2"}},c={outline:{border:"px",borderColor:"gray-6",_hover:{borderColor:"gray-7",backgroundColor:"surface-2"},_active:{borderColor:"blue-8",backgroundColor:"surface-3"},_focus:{borderColor:"blue-8",backgroundColor:"surface-3"}},ghost:{border:"px",borderColor:"transparent",_hover:{borderColor:"gray-7",backgroundColor:"surface-2"},_active:{borderColor:"blue-8",backgroundColor:"surface-3"},_focus:{borderColor:"blue-8",backgroundColor:"surface-3"}}},i={default:{outline:{bg:"surface-3"},ghost:{bg:"transparent"}},disabled:{outline:{bg:"gray-2",borderColor:"transparent",_hover:void 0,_active:void 0,_focus:void 0},ghost:{bg:"transparent",borderColor:"transparent",_hover:void 0,_active:void 0,_focus:void 0}},error:{outline:{bg:"surface-3",borderColor:"red-6",_hover:{borderColor:"red-7"}},ghost:{bg:"surface-3",borderColor:"red-6",_hover:{borderColor:"red-7"}}}},g=({disabled:e,errored:r})=>e?"disabled":r?"error":"default",p=({size:e="2",variant:r="outline",resize:a="both",disabled:o,errored:d,textProps:u,...s})=>{const t=g({disabled:o,errored:d});return n.jsx(b.Text,{as:"textarea","data-tgph-textarea":!0,"data-tgph-textarea-state":t,"data-tgph-textarea-variant":r,"data-tgph-textarea-size":e,"data-tgph-textarea-resize":a,disabled:o,...l[e],...c[r],...i[t][r],...u,...s})};exports.TextArea=p;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/TextArea/TextArea.constants.ts","../../src/TextArea/TextArea.tsx"],"sourcesContent":["import type { TgphComponentProps } from \"@telegraph/helpers\";\nimport type { Text } from \"@telegraph/typography\";\n\nexport type Size = \"1\" | \"2\" | \"3\";\nexport type Variant = \"outline\" | \"ghost\";\nexport type State = \"default\" | \"disabled\" | \"error\";\n\ntype SizeMap = {\n [key in Size]: Partial<\n Pick<\n TgphComponentProps<typeof Text>,\n \"p\" | \"size\" | \"px\" | \"py\" | \"rounded\"\n >\n >;\n};\n\ntype VariantMap = {\n [key in Variant]: Partial<\n Pick<\n TgphComponentProps<typeof Text>,\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/TextArea/TextArea.constants.ts","../../src/TextArea/TextArea.tsx"],"sourcesContent":["import type { TgphComponentProps } from \"@telegraph/helpers\";\nimport type { Text } from \"@telegraph/typography\";\n\nexport type Size = \"1\" | \"2\" | \"3\";\nexport type Variant = \"outline\" | \"ghost\";\nexport type State = \"default\" | \"disabled\" | \"error\";\n\ntype SizeMap = {\n [key in Size]: Partial<\n Pick<\n TgphComponentProps<typeof Text>,\n \"p\" | \"size\" | \"px\" | \"py\" | \"rounded\"\n >\n >;\n};\n\ntype VariantMap = {\n [key in Variant]: Partial<\n Pick<\n TgphComponentProps<typeof Text>,\n \"border\" | \"borderColor\" | \"_hover\" | \"_active\" | \"_focus\"\n >\n >;\n};\n\ntype StateMap = {\n [key in State]: {\n [key in Variant]: Partial<\n Pick<\n TgphComponentProps<typeof Text>,\n \"bg\" | \"borderColor\" | \"_hover\" | \"_active\" | \"_focus\"\n >\n >;\n };\n};\n\nexport const sizeMap: SizeMap = {\n \"1\": {\n px: \"1_5\",\n py: \"1\",\n size: \"1\",\n rounded: \"2\",\n },\n \"2\": {\n px: \"2\",\n py: \"1_5\",\n size: \"2\",\n rounded: \"2\",\n },\n \"3\": {\n px: \"3\",\n py: \"2\",\n size: \"3\",\n rounded: \"2\",\n },\n};\n\nexport const variantMap: VariantMap = {\n outline: {\n border: \"px\",\n borderColor: \"gray-6\",\n _hover: {\n borderColor: \"gray-7\",\n backgroundColor: \"surface-2\",\n },\n _active: {\n borderColor: \"blue-8\",\n backgroundColor: \"surface-3\",\n },\n _focus: {\n borderColor: \"blue-8\",\n backgroundColor: \"surface-3\",\n },\n },\n ghost: {\n border: \"px\",\n borderColor: \"transparent\",\n _hover: {\n borderColor: \"gray-7\",\n backgroundColor: \"surface-2\",\n },\n _active: {\n borderColor: \"blue-8\",\n backgroundColor: \"surface-3\",\n },\n _focus: {\n borderColor: \"blue-8\",\n backgroundColor: \"surface-3\",\n },\n },\n};\n\nexport const stateMap: StateMap = {\n default: {\n outline: {\n bg: \"surface-3\",\n },\n ghost: {\n bg: \"transparent\",\n },\n },\n disabled: {\n outline: {\n bg: \"gray-2\",\n borderColor: \"transparent\",\n _hover: undefined,\n _active: undefined,\n _focus: undefined,\n },\n ghost: {\n bg: \"transparent\",\n borderColor: \"transparent\",\n _hover: undefined,\n _active: undefined,\n _focus: undefined,\n },\n },\n error: {\n outline: {\n bg: \"surface-3\",\n borderColor: \"red-6\",\n _hover: {\n borderColor: \"red-7\",\n },\n },\n ghost: {\n bg: \"surface-3\",\n borderColor: \"red-6\",\n _hover: {\n borderColor: \"red-7\",\n },\n },\n },\n};\n","import { Text, type TextProps } from \"@telegraph/typography\";\n\nimport {\n type Size,\n type Variant,\n sizeMap,\n stateMap,\n variantMap,\n} from \"./TextArea.constants\";\n\nconst deriveState = ({\n disabled,\n errored,\n}: Pick<TextAreaBaseProps, \"disabled\" | \"errored\">) => {\n if (disabled) return \"disabled\";\n if (errored) return \"error\";\n return \"default\";\n};\n\ntype TextAreaTextProps = Omit<TextProps<\"textarea\">, \"as\">;\n\ntype TextAreaBaseProps = {\n size?: Size;\n variant?: Variant;\n errored?: boolean;\n disabled?: boolean;\n resize?: \"both\" | \"vertical\" | \"horizontal\" | \"none\";\n textProps?: TextAreaTextProps;\n};\n\ntype TextAreaProps = TextAreaBaseProps & TextAreaTextProps;\n\nconst TextArea = ({\n size = \"2\",\n variant = \"outline\",\n resize = \"both\",\n disabled,\n errored,\n textProps,\n ...props\n}: TextAreaProps) => {\n const derivedState = deriveState({ disabled, errored });\n\n return (\n <Text\n as=\"textarea\"\n data-tgph-textarea\n data-tgph-textarea-state={derivedState}\n data-tgph-textarea-variant={variant}\n data-tgph-textarea-size={size}\n data-tgph-textarea-resize={resize}\n disabled={disabled}\n {...sizeMap[size]}\n {...variantMap[variant]}\n {...stateMap[derivedState][variant]}\n {...textProps}\n {...props}\n />\n );\n};\n\nexport { TextArea, type TextAreaProps };\n"],"names":["sizeMap","variantMap","stateMap","deriveState","disabled","errored","TextArea","size","variant","resize","textProps","props","derivedState","j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B,MAAMC,EAAeT,EAAY,CAAE,SAAAC,EAAU,QAAAC,EAAS,EAEtD,OACEQ,EAAAA,IAACC,EAAAA,KAAA,CACC,GAAG,WACH,qBAAkB,GAClB,2BAA0BF,EAC1B,6BAA4BJ,EAC5B,0BAAyBD,EACzB,4BAA2BE,EAC3B,SAAAL,EACC,GAAGJ,EAAQO,CAAI,EACf,GAAGN,EAAWO,CAAO,EACrB,GAAGN,EAASU,CAAY,EAAEJ,CAAO,EACjC,GAAGE,EACH,GAAGC,CAAA,CAAA,CAGV"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Text as
|
|
3
|
-
const
|
|
1
|
+
import { jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { Text as n } from "@telegraph/typography";
|
|
3
|
+
const l = {
|
|
4
4
|
1: {
|
|
5
5
|
px: "1_5",
|
|
6
6
|
py: "1",
|
|
@@ -19,26 +19,38 @@ const s = {
|
|
|
19
19
|
size: "3",
|
|
20
20
|
rounded: "2"
|
|
21
21
|
}
|
|
22
|
-
},
|
|
22
|
+
}, c = {
|
|
23
23
|
outline: {
|
|
24
24
|
border: "px",
|
|
25
25
|
borderColor: "gray-6",
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
_hover: {
|
|
27
|
+
borderColor: "gray-7",
|
|
28
|
+
backgroundColor: "surface-2"
|
|
29
|
+
},
|
|
30
|
+
_active: {
|
|
31
|
+
borderColor: "blue-8",
|
|
32
|
+
backgroundColor: "surface-3"
|
|
33
|
+
},
|
|
34
|
+
_focus: {
|
|
35
|
+
borderColor: "blue-8",
|
|
36
|
+
backgroundColor: "surface-3"
|
|
37
|
+
}
|
|
32
38
|
},
|
|
33
39
|
ghost: {
|
|
34
40
|
border: "px",
|
|
35
41
|
borderColor: "transparent",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
_hover: {
|
|
43
|
+
borderColor: "gray-7",
|
|
44
|
+
backgroundColor: "surface-2"
|
|
45
|
+
},
|
|
46
|
+
_active: {
|
|
47
|
+
borderColor: "blue-8",
|
|
48
|
+
backgroundColor: "surface-3"
|
|
49
|
+
},
|
|
50
|
+
_focus: {
|
|
51
|
+
borderColor: "blue-8",
|
|
52
|
+
backgroundColor: "surface-3"
|
|
53
|
+
}
|
|
42
54
|
}
|
|
43
55
|
}, i = {
|
|
44
56
|
default: {
|
|
@@ -53,68 +65,66 @@ const s = {
|
|
|
53
65
|
outline: {
|
|
54
66
|
bg: "gray-2",
|
|
55
67
|
borderColor: "transparent",
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
active_backgroundColor: void 0,
|
|
60
|
-
focus_borderColor: void 0,
|
|
61
|
-
focus_backgroundColor: void 0
|
|
68
|
+
_hover: void 0,
|
|
69
|
+
_active: void 0,
|
|
70
|
+
_focus: void 0
|
|
62
71
|
},
|
|
63
72
|
ghost: {
|
|
64
73
|
bg: "transparent",
|
|
65
74
|
borderColor: "transparent",
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
active_backgroundColor: void 0,
|
|
70
|
-
focus_borderColor: void 0,
|
|
71
|
-
focus_backgroundColor: void 0
|
|
75
|
+
_hover: void 0,
|
|
76
|
+
_active: void 0,
|
|
77
|
+
_focus: void 0
|
|
72
78
|
}
|
|
73
79
|
},
|
|
74
80
|
error: {
|
|
75
81
|
outline: {
|
|
76
82
|
bg: "surface-3",
|
|
77
83
|
borderColor: "red-6",
|
|
78
|
-
|
|
84
|
+
_hover: {
|
|
85
|
+
borderColor: "red-7"
|
|
86
|
+
}
|
|
79
87
|
},
|
|
80
88
|
ghost: {
|
|
81
89
|
bg: "surface-3",
|
|
82
90
|
borderColor: "red-6",
|
|
83
|
-
|
|
91
|
+
_hover: {
|
|
92
|
+
borderColor: "red-7"
|
|
93
|
+
}
|
|
84
94
|
}
|
|
85
95
|
}
|
|
86
|
-
},
|
|
96
|
+
}, g = ({
|
|
87
97
|
disabled: o,
|
|
88
98
|
errored: r
|
|
89
|
-
}) => o ? "disabled" : r ? "error" : "default",
|
|
99
|
+
}) => o ? "disabled" : r ? "error" : "default", f = ({
|
|
90
100
|
size: o = "2",
|
|
91
101
|
variant: r = "outline",
|
|
92
|
-
resize:
|
|
102
|
+
resize: a = "both",
|
|
93
103
|
disabled: e,
|
|
94
104
|
errored: d,
|
|
95
|
-
textProps:
|
|
96
|
-
...
|
|
105
|
+
textProps: s,
|
|
106
|
+
...u
|
|
97
107
|
}) => {
|
|
98
|
-
const
|
|
99
|
-
return /* @__PURE__ */
|
|
100
|
-
|
|
108
|
+
const t = g({ disabled: e, errored: d });
|
|
109
|
+
return /* @__PURE__ */ b(
|
|
110
|
+
n,
|
|
101
111
|
{
|
|
102
112
|
as: "textarea",
|
|
103
113
|
"data-tgph-textarea": !0,
|
|
104
|
-
"data-tgph-textarea-state":
|
|
114
|
+
"data-tgph-textarea-state": t,
|
|
105
115
|
"data-tgph-textarea-variant": r,
|
|
106
116
|
"data-tgph-textarea-size": o,
|
|
107
|
-
"data-tgph-textarea-resize":
|
|
117
|
+
"data-tgph-textarea-resize": a,
|
|
108
118
|
disabled: e,
|
|
109
|
-
...
|
|
110
|
-
...
|
|
111
|
-
...i[
|
|
112
|
-
...
|
|
113
|
-
...
|
|
119
|
+
...l[o],
|
|
120
|
+
...c[r],
|
|
121
|
+
...i[t][r],
|
|
122
|
+
...s,
|
|
123
|
+
...u
|
|
114
124
|
}
|
|
115
125
|
);
|
|
116
126
|
};
|
|
117
127
|
export {
|
|
118
|
-
|
|
128
|
+
f as TextArea
|
|
119
129
|
};
|
|
120
130
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/TextArea/TextArea.constants.ts","../../src/TextArea/TextArea.tsx"],"sourcesContent":["import type { TgphComponentProps } from \"@telegraph/helpers\";\nimport type { Text } from \"@telegraph/typography\";\n\nexport type Size = \"1\" | \"2\" | \"3\";\nexport type Variant = \"outline\" | \"ghost\";\nexport type State = \"default\" | \"disabled\" | \"error\";\n\ntype SizeMap = {\n [key in Size]: Partial<\n Pick<\n TgphComponentProps<typeof Text>,\n \"p\" | \"size\" | \"px\" | \"py\" | \"rounded\"\n >\n >;\n};\n\ntype VariantMap = {\n [key in Variant]: Partial<\n Pick<\n TgphComponentProps<typeof Text>,\n
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/TextArea/TextArea.constants.ts","../../src/TextArea/TextArea.tsx"],"sourcesContent":["import type { TgphComponentProps } from \"@telegraph/helpers\";\nimport type { Text } from \"@telegraph/typography\";\n\nexport type Size = \"1\" | \"2\" | \"3\";\nexport type Variant = \"outline\" | \"ghost\";\nexport type State = \"default\" | \"disabled\" | \"error\";\n\ntype SizeMap = {\n [key in Size]: Partial<\n Pick<\n TgphComponentProps<typeof Text>,\n \"p\" | \"size\" | \"px\" | \"py\" | \"rounded\"\n >\n >;\n};\n\ntype VariantMap = {\n [key in Variant]: Partial<\n Pick<\n TgphComponentProps<typeof Text>,\n \"border\" | \"borderColor\" | \"_hover\" | \"_active\" | \"_focus\"\n >\n >;\n};\n\ntype StateMap = {\n [key in State]: {\n [key in Variant]: Partial<\n Pick<\n TgphComponentProps<typeof Text>,\n \"bg\" | \"borderColor\" | \"_hover\" | \"_active\" | \"_focus\"\n >\n >;\n };\n};\n\nexport const sizeMap: SizeMap = {\n \"1\": {\n px: \"1_5\",\n py: \"1\",\n size: \"1\",\n rounded: \"2\",\n },\n \"2\": {\n px: \"2\",\n py: \"1_5\",\n size: \"2\",\n rounded: \"2\",\n },\n \"3\": {\n px: \"3\",\n py: \"2\",\n size: \"3\",\n rounded: \"2\",\n },\n};\n\nexport const variantMap: VariantMap = {\n outline: {\n border: \"px\",\n borderColor: \"gray-6\",\n _hover: {\n borderColor: \"gray-7\",\n backgroundColor: \"surface-2\",\n },\n _active: {\n borderColor: \"blue-8\",\n backgroundColor: \"surface-3\",\n },\n _focus: {\n borderColor: \"blue-8\",\n backgroundColor: \"surface-3\",\n },\n },\n ghost: {\n border: \"px\",\n borderColor: \"transparent\",\n _hover: {\n borderColor: \"gray-7\",\n backgroundColor: \"surface-2\",\n },\n _active: {\n borderColor: \"blue-8\",\n backgroundColor: \"surface-3\",\n },\n _focus: {\n borderColor: \"blue-8\",\n backgroundColor: \"surface-3\",\n },\n },\n};\n\nexport const stateMap: StateMap = {\n default: {\n outline: {\n bg: \"surface-3\",\n },\n ghost: {\n bg: \"transparent\",\n },\n },\n disabled: {\n outline: {\n bg: \"gray-2\",\n borderColor: \"transparent\",\n _hover: undefined,\n _active: undefined,\n _focus: undefined,\n },\n ghost: {\n bg: \"transparent\",\n borderColor: \"transparent\",\n _hover: undefined,\n _active: undefined,\n _focus: undefined,\n },\n },\n error: {\n outline: {\n bg: \"surface-3\",\n borderColor: \"red-6\",\n _hover: {\n borderColor: \"red-7\",\n },\n },\n ghost: {\n bg: \"surface-3\",\n borderColor: \"red-6\",\n _hover: {\n borderColor: \"red-7\",\n },\n },\n },\n};\n","import { Text, type TextProps } from \"@telegraph/typography\";\n\nimport {\n type Size,\n type Variant,\n sizeMap,\n stateMap,\n variantMap,\n} from \"./TextArea.constants\";\n\nconst deriveState = ({\n disabled,\n errored,\n}: Pick<TextAreaBaseProps, \"disabled\" | \"errored\">) => {\n if (disabled) return \"disabled\";\n if (errored) return \"error\";\n return \"default\";\n};\n\ntype TextAreaTextProps = Omit<TextProps<\"textarea\">, \"as\">;\n\ntype TextAreaBaseProps = {\n size?: Size;\n variant?: Variant;\n errored?: boolean;\n disabled?: boolean;\n resize?: \"both\" | \"vertical\" | \"horizontal\" | \"none\";\n textProps?: TextAreaTextProps;\n};\n\ntype TextAreaProps = TextAreaBaseProps & TextAreaTextProps;\n\nconst TextArea = ({\n size = \"2\",\n variant = \"outline\",\n resize = \"both\",\n disabled,\n errored,\n textProps,\n ...props\n}: TextAreaProps) => {\n const derivedState = deriveState({ disabled, errored });\n\n return (\n <Text\n as=\"textarea\"\n data-tgph-textarea\n data-tgph-textarea-state={derivedState}\n data-tgph-textarea-variant={variant}\n data-tgph-textarea-size={size}\n data-tgph-textarea-resize={resize}\n disabled={disabled}\n {...sizeMap[size]}\n {...variantMap[variant]}\n {...stateMap[derivedState][variant]}\n {...textProps}\n {...props}\n />\n );\n};\n\nexport { TextArea, type TextAreaProps };\n"],"names":["sizeMap","variantMap","stateMap","deriveState","disabled","errored","TextArea","size","variant","resize","textProps","props","derivedState","jsx","Text"],"mappings":";;AAoCO,MAAMA,IAAmB;AAAA,EAC9B,GAAK;AAAA,IACH,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,EAAA;AAAA,EAEX,GAAK;AAAA,IACH,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,EAAA;AAAA,EAEX,GAAK;AAAA,IACH,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,EAAA;AAEb,GAEaC,IAAyB;AAAA,EACpC,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,MACN,aAAa;AAAA,MACb,iBAAiB;AAAA,IAAA;AAAA,IAEnB,SAAS;AAAA,MACP,aAAa;AAAA,MACb,iBAAiB;AAAA,IAAA;AAAA,IAEnB,QAAQ;AAAA,MACN,aAAa;AAAA,MACb,iBAAiB;AAAA,IAAA;AAAA,EACnB;AAAA,EAEF,OAAO;AAAA,IACL,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,MACN,aAAa;AAAA,MACb,iBAAiB;AAAA,IAAA;AAAA,IAEnB,SAAS;AAAA,MACP,aAAa;AAAA,MACb,iBAAiB;AAAA,IAAA;AAA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B,6BAA2BE;AAAA,MAC3B,UAAAL;AAAA,MACC,GAAGJ,EAAQO,CAAI;AAAA,MACf,GAAGN,EAAWO,CAAO;AAAA,MACrB,GAAGN,EAASU,CAAY,EAAEJ,CAAO;AAAA,MACjC,GAAGE;AAAA,MACH,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -7,11 +7,11 @@ type SizeMap = {
|
|
|
7
7
|
[key in Size]: Partial<Pick<TgphComponentProps<typeof Text>, "p" | "size" | "px" | "py" | "rounded">>;
|
|
8
8
|
};
|
|
9
9
|
type VariantMap = {
|
|
10
|
-
[key in Variant]: Partial<Pick<TgphComponentProps<typeof Text>, "border" | "borderColor" | "
|
|
10
|
+
[key in Variant]: Partial<Pick<TgphComponentProps<typeof Text>, "border" | "borderColor" | "_hover" | "_active" | "_focus">>;
|
|
11
11
|
};
|
|
12
12
|
type StateMap = {
|
|
13
13
|
[key in State]: {
|
|
14
|
-
[key in Variant]: Partial<Pick<TgphComponentProps<typeof Text>, "bg" | "borderColor" | "
|
|
14
|
+
[key in Variant]: Partial<Pick<TgphComponentProps<typeof Text>, "bg" | "borderColor" | "_hover" | "_active" | "_focus">>;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
export declare const sizeMap: SizeMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.constants.d.ts","sourceRoot":"","sources":["../../../src/TextArea/TextArea.constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AACnC,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAC1C,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAErD,KAAK,OAAO,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Aa,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CACvD,CACF;KACF;CACF,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,OAmBrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAiCxB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,QAyCtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telegraph/textarea",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A multi-line user input.",
|
|
5
5
|
"repository": "https://github.com/knocklabs/telegraph/tree/main/packages/textarea",
|
|
6
6
|
"author": "@knocklabs",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@telegraph/helpers": "^0.0.15",
|
|
36
|
-
"@telegraph/typography": "^0.2.
|
|
36
|
+
"@telegraph/typography": "^0.2.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@knocklabs/eslint-config": "^0.0.5",
|
|
40
40
|
"@knocklabs/typescript-config": "^0.0.2",
|
|
41
|
-
"@telegraph/postcss-config": "^0.0
|
|
41
|
+
"@telegraph/postcss-config": "^0.1.0",
|
|
42
42
|
"@telegraph/prettier-config": "^0.0.7",
|
|
43
43
|
"@telegraph/vite-config": "^0.0.15",
|
|
44
44
|
"@types/react": "^19.2.9",
|