@telegraph/textarea 0.0.1
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 +7 -0
- package/README.md +17 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/css/default.css +1 -0
- package/dist/esm/index.mjs +150 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/types/TextArea/TextArea.constants.d.ts +20 -0
- package/dist/types/TextArea/TextArea.constants.d.ts.map +1 -0
- package/dist/types/TextArea/TextArea.css.d.ts +61 -0
- package/dist/types/TextArea/TextArea.css.d.ts.map +1 -0
- package/dist/types/TextArea/TextArea.d.ts +17 -0
- package/dist/types/TextArea/TextArea.d.ts.map +1 -0
- package/dist/types/TextArea/index.d.ts +2 -0
- package/dist/types/TextArea/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +57 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @telegraph/textarea
|
|
2
|
+
|
|
3
|
+
## 0.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#292](https://github.com/knocklabs/telegraph/pull/292) [`9600829`](https://github.com/knocklabs/telegraph/commit/960082989f7bc953fc68ae5a254c4a267d3d75aa) Thanks [@kylemcd](https://github.com/kylemcd)! - first iteration of TextArea component
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@telegraph/textarea)
|
|
4
|
+
|
|
5
|
+
# @telegraph/textarea
|
|
6
|
+
> A multi-line user input.
|
|
7
|
+
|
|
8
|
+
## Installation Instructions
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @telegraph/textarea
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Add stylesheet
|
|
15
|
+
```
|
|
16
|
+
@import "@telegraph/textarea"
|
|
17
|
+
```
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),g=require("@telegraph/layout"),m=require("clsx"),h={1:{p:"1"},2:{px:"2",py:"1"},3:{px:"3",py:"2"}},y={outline:{border:"px"},ghost:{border:"px",borderColor:"transparent"}},O={default:{},disabled:{bg:"gray-2",borderColor:"gray-2"},error:{borderColor:"red-6"}};function j(r,e){if(typeof r!="object"||!r)return r;var a=r[Symbol.toPrimitive];if(a!==void 0){var t=a.call(r,e||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function z(r){var e=j(r,"string");return typeof e=="symbol"?e:String(e)}function P(r,e,a){return e=z(e),e in r?Object.defineProperty(r,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[e]=a,r}function p(r,e){var a=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),a.push.apply(a,t)}return a}function v(r){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?p(Object(a),!0).forEach(function(t){P(r,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):p(Object(a)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(a,t))})}return r}function f(r,e){var a={};for(var t in r)a[t]=e(r[t],t);return a}var x=(r,e,a)=>{for(var t of Object.keys(r)){var s;if(r[t]!==((s=e[t])!==null&&s!==void 0?s:a[t]))return!1}return!0},w=r=>{var e=a=>{var t=r.defaultClassName,s=v(v({},r.defaultVariants),a);for(var i in s){var o,u=(o=s[i])!==null&&o!==void 0?o:r.defaultVariants[i];if(u!=null){var n=u;typeof n=="boolean"&&(n=n===!0?"true":"false");var l=r.variantClassNames[i][n];l&&(t+=" "+l)}}for(var[b,d]of r.compoundVariants)x(b,s,r.defaultVariants)&&(t+=" "+d);return t};return e.variants=()=>Object.keys(r.variantClassNames),e.classNames={get base(){return r.defaultClassName.split(" ")[0]},get variants(){return f(r.variantClassNames,a=>f(a,t=>t.split(" ")[0]))}},e},S="tgph-1izsev00",C=w({defaultClassName:"tgph-1izsev01",variantClassNames:{size:{1:"tgph-1izsev02",2:"tgph-1izsev03",3:"tgph-1izsev04"},state:{default:"tgph-1izsev05",disabled:"tgph-1izsev06",error:"tgph-1izsev07"},resize:{both:"tgph-1izsev08",vertical:"tgph-1izsev09",horizontal:"tgph-1izsev0a",none:"tgph-1izsev0b"},variant:{outline:"tgph-1izsev0c",ghost:"tgph-1izsev0d"}},defaultVariants:{},compoundVariants:[]});const V=({disabled:r,errored:e})=>r?"disabled":e?"error":"default",N=({size:r="2",variant:e="outline",rounded:a="2",resize:t="both",disabled:s,errored:i,className:o,...u})=>{const n=V({disabled:s,errored:i});return c.jsx(g.Box,{as:"textarea",className:m.clsx(S,C({variant:e,size:r,resize:t,state:n}),o),rounded:a,disabled:s,...h[r],...y[e],...O[n],...u})};exports.TextArea=N;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/TextArea/TextArea.constants.ts","../../../../node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js","../../src/TextArea/TextArea.tsx"],"sourcesContent":["import type { TgphComponentProps } from \"@telegraph/helpers\";\nimport type { Box } from \"@telegraph/layout\";\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]: TgphComponentProps<typeof Box>;\n};\n\ntype VariantMap = {\n [key in Variant]: TgphComponentProps<typeof Box>;\n};\n\ntype StateMap = {\n [key in State]: TgphComponentProps<typeof Box>;\n};\n\nexport const sizeMap: SizeMap = {\n \"1\": {\n p: \"1\",\n },\n \"2\": {\n px: \"2\",\n py: \"1\",\n },\n \"3\": {\n px: \"3\",\n py: \"2\",\n },\n};\n\nexport const variantMap: VariantMap = {\n outline: {\n border: \"px\",\n },\n ghost: {\n border: \"px\",\n borderColor: \"transparent\",\n },\n};\n\nexport const stateMap: StateMap = {\n default: {},\n disabled: {\n bg: \"gray-2\",\n borderColor: \"gray-2\",\n },\n error: {\n borderColor: \"red-6\",\n },\n};\n","function toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\n\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : String(i);\n}\n\nfunction _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\n\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n _defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\n\nfunction mapValues(input, fn) {\n var result = {};\n for (var _key in input) {\n result[_key] = fn(input[_key], _key);\n }\n return result;\n}\n\nvar shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {\n for (var key of Object.keys(compoundCheck)) {\n var _selections$key;\n if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {\n return false;\n }\n }\n return true;\n};\nvar createRuntimeFn = config => {\n var runtimeFn = options => {\n var className = config.defaultClassName;\n var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);\n for (var variantName in selections) {\n var _selections$variantNa;\n var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];\n if (variantSelection != null) {\n var selection = variantSelection;\n if (typeof selection === 'boolean') {\n // @ts-expect-error\n selection = selection === true ? 'true' : 'false';\n }\n var selectionClassName =\n // @ts-expect-error\n config.variantClassNames[variantName][selection];\n if (selectionClassName) {\n className += ' ' + selectionClassName;\n }\n }\n }\n for (var [compoundCheck, compoundClassName] of config.compoundVariants) {\n if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {\n className += ' ' + compoundClassName;\n }\n }\n return className;\n };\n runtimeFn.variants = () => Object.keys(config.variantClassNames);\n runtimeFn.classNames = {\n get base() {\n return config.defaultClassName.split(' ')[0];\n },\n get variants() {\n return mapValues(config.variantClassNames, classNames => mapValues(classNames, className => className.split(' ')[0]));\n }\n };\n return runtimeFn;\n};\n\nexport { createRuntimeFn as c, mapValues as m };\n","import type { TgphComponentProps } from \"@telegraph/helpers\";\nimport { Box } from \"@telegraph/layout\";\nimport { clsx } from \"clsx\";\nimport React from \"react\";\n\nimport {\n type Size,\n type State,\n type Variant,\n sizeMap,\n stateMap,\n variantMap,\n} from \"./TextArea.constants\";\nimport { baseStyles, variants } from \"./TextArea.css\";\n\nconst deriveState = ({ disabled, errored }: TextAreaBaseProps): State => {\n if (disabled) return \"disabled\";\n if (errored) return \"error\";\n return \"default\";\n};\n\ntype TextAreaBaseProps = {\n size?: Size;\n variant?: Variant;\n errored?: boolean;\n disabled?: boolean;\n resize?: \"both\" | \"vertical\" | \"horizontal\" | \"none\";\n};\n\ntype TextAreaProps = TextAreaBaseProps &\n TgphComponentProps<typeof Box> &\n React.ComponentPropsWithoutRef<\"textarea\">;\n\nconst TextArea = ({\n size = \"2\",\n variant = \"outline\",\n rounded = \"2\",\n resize = \"both\",\n disabled,\n errored,\n className,\n ...props\n}: TextAreaProps) => {\n const derivedState = deriveState({ disabled, errored });\n\n return (\n <Box\n as=\"textarea\"\n className={clsx(\n baseStyles,\n variants({ variant, size, resize, state: derivedState }),\n className,\n )}\n rounded={rounded}\n disabled={disabled}\n {...sizeMap[size]}\n {...variantMap[variant]}\n {...stateMap[derivedState]}\n {...props}\n />\n );\n};\n\ntype TextAreaExportedProps = TgphComponentProps<typeof TextArea>;\n\nexport { TextArea, type TextAreaExportedProps as TextAreaProps };\n"],"names":["sizeMap","variantMap","stateMap","toPrimitive","t","r","e","i","toPropertyKey","_defineProperty","obj","key","value","ownKeys","o","_objectSpread2","mapValues","input","fn","result","_key","shouldApplyCompound","compoundCheck","selections","defaultVariants","_selections$key","createRuntimeFn","config","runtimeFn","options","className","variantName","_selections$variantNa","variantSelection","selection","selectionClassName","compoundClassName","classNames","deriveState","disabled","errored","TextArea","size","variant","rounded","resize","props","derivedState","jsx","Box","clsx","baseStyles","variants"],"mappings":"sKAmBaA,EAAmB,CAC9B,EAAK,CACH,EAAG,GACL,EACA,EAAK,CACH,GAAI,IACJ,GAAI,GACN,EACA,EAAK,CACH,GAAI,IACJ,GAAI,GACN,CACF,EAEaC,EAAyB,CACpC,QAAS,CACP,OAAQ,IACV,EACA,MAAO,CACL,OAAQ,KACR,YAAa,aACf,CACF,EAEaC,EAAqB,CAChC,QAAS,CAAC,EACV,SAAU,CACR,GAAI,SACJ,YAAa,QACf,EACA,MAAO,CACL,YAAa,OACf,CACF,ECpDA,SAASC,EAAYC,EAAGC,EAAG,CACzB,GAAgB,OAAOD,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AAF,EAAU,SAAW,IAAM,OAAO,KAAKD,EAAO,iBAAiB,EAC/DC,EAAU,WAAa,CACrB,IAAI,MAAO,CACT,OAAOD,EAAO,iBAAiB,MAAM,GAAG,EAAE,CAAC,CAC5C,EACD,IAAI,UAAW,CACb,OAAOX,EAAUW,EAAO,kBAAmBU,GAAcrB,EAAUqB,EAAYP,GAAaA,EAAU,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,CACrH,CACL,EACSF,CACT,kaC7FA,MAAMU,EAAc,CAAC,CAAE,SAAAC,EAAU,QAAAC,KAC3BD,EAAiB,WACjBC,EAAgB,QACb,UAeHC,EAAW,CAAC,CAChB,KAAAC,EAAO,IACP,QAAAC,EAAU,UACV,QAAAC,EAAU,IACV,OAAAC,EAAS,OACT,SAAAN,EACA,QAAAC,EACA,UAAAV,EACA,GAAGgB,CACL,IAAqB,CACnB,MAAMC,EAAeT,EAAY,CAAE,SAAAC,EAAU,QAAAC,CAAS,CAAA,EAGpD,OAAAQ,EAAA,IAACC,EAAA,IAAA,CACC,GAAG,WACH,UAAWC,EAAA,KACTC,EACAC,EAAS,CAAE,QAAAT,EAAS,KAAAD,EAAM,OAAAG,EAAQ,MAAOE,EAAc,EACvDjB,CACF,EACA,QAAAc,EACA,SAAAL,EACC,GAAGvC,EAAQ0C,CAAI,EACf,GAAGzC,EAAW0C,CAAO,EACrB,GAAGzC,EAAS6C,CAAY,EACxB,GAAGD,CAAA,CAAA,CAGV","x_google_ignoreList":[1]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.tgph-1izsev00{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:var(--tgph-gray-12);font-family:var(--tgph-font-sans);transition:border-color .15s cubic-bezier(.4,0,.2,1)}.tgph-1izsev00:hover{border-color:var(--tgph-gray-7)}.tgph-1izsev00:focus{border-color:var(--tgph-blue-8);outline:none}.tgph-1izsev00::-moz-placeholder{color:var(--tgph-gray-10)}.tgph-1izsev00::placeholder{color:var(--tgph-gray-10)}.tgph-1izsev02{font-size:var(--tgph-text-1);line-height:var(--tgph-leading-1);letter-spacing:var(--tgph-tracking-1)}.tgph-1izsev03{font-size:var(--tgph-text-2);line-height:var(--tgph-leading-2);letter-spacing:var(--tgph-tracking-2)}.tgph-1izsev04{font-size:var(--tgph-text-3);line-height:var(--tgph-leading-3);letter-spacing:var(--tgph-tracking-3)}.tgph-1izsev06{cursor:not-allowed}.tgph-1izsev06:hover{border-color:var(--tgph-gray-2)}.tgph-1izsev06:focus{border-color:var(--tgph-gray-2)}.tgph-1izsev07:hover{border-color:var(--tgph-red-6)}.tgph-1izsev07:focus{border-color:var(--tgph-red-8)}.tgph-1izsev08{resize:both}.tgph-1izsev09{resize:vertical}.tgph-1izsev0a{resize:horizontal}.tgph-1izsev0b,.tgph-1izsev0d{resize:none}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { Box as c } from "@telegraph/layout";
|
|
3
|
+
import { clsx as g } from "clsx";
|
|
4
|
+
const h = {
|
|
5
|
+
1: {
|
|
6
|
+
p: "1"
|
|
7
|
+
},
|
|
8
|
+
2: {
|
|
9
|
+
px: "2",
|
|
10
|
+
py: "1"
|
|
11
|
+
},
|
|
12
|
+
3: {
|
|
13
|
+
px: "3",
|
|
14
|
+
py: "2"
|
|
15
|
+
}
|
|
16
|
+
}, y = {
|
|
17
|
+
outline: {
|
|
18
|
+
border: "px"
|
|
19
|
+
},
|
|
20
|
+
ghost: {
|
|
21
|
+
border: "px",
|
|
22
|
+
borderColor: "transparent"
|
|
23
|
+
}
|
|
24
|
+
}, O = {
|
|
25
|
+
default: {},
|
|
26
|
+
disabled: {
|
|
27
|
+
bg: "gray-2",
|
|
28
|
+
borderColor: "gray-2"
|
|
29
|
+
},
|
|
30
|
+
error: {
|
|
31
|
+
borderColor: "red-6"
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
function z(r, t) {
|
|
35
|
+
if (typeof r != "object" || !r) return r;
|
|
36
|
+
var a = r[Symbol.toPrimitive];
|
|
37
|
+
if (a !== void 0) {
|
|
38
|
+
var e = a.call(r, t || "default");
|
|
39
|
+
if (typeof e != "object") return e;
|
|
40
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
41
|
+
}
|
|
42
|
+
return (t === "string" ? String : Number)(r);
|
|
43
|
+
}
|
|
44
|
+
function j(r) {
|
|
45
|
+
var t = z(r, "string");
|
|
46
|
+
return typeof t == "symbol" ? t : String(t);
|
|
47
|
+
}
|
|
48
|
+
function P(r, t, a) {
|
|
49
|
+
return t = j(t), t in r ? Object.defineProperty(r, t, {
|
|
50
|
+
value: a,
|
|
51
|
+
enumerable: !0,
|
|
52
|
+
configurable: !0,
|
|
53
|
+
writable: !0
|
|
54
|
+
}) : r[t] = a, r;
|
|
55
|
+
}
|
|
56
|
+
function l(r, t) {
|
|
57
|
+
var a = Object.keys(r);
|
|
58
|
+
if (Object.getOwnPropertySymbols) {
|
|
59
|
+
var e = Object.getOwnPropertySymbols(r);
|
|
60
|
+
t && (e = e.filter(function(s) {
|
|
61
|
+
return Object.getOwnPropertyDescriptor(r, s).enumerable;
|
|
62
|
+
})), a.push.apply(a, e);
|
|
63
|
+
}
|
|
64
|
+
return a;
|
|
65
|
+
}
|
|
66
|
+
function v(r) {
|
|
67
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
68
|
+
var a = arguments[t] != null ? arguments[t] : {};
|
|
69
|
+
t % 2 ? l(Object(a), !0).forEach(function(e) {
|
|
70
|
+
P(r, e, a[e]);
|
|
71
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(a)) : l(Object(a)).forEach(function(e) {
|
|
72
|
+
Object.defineProperty(r, e, Object.getOwnPropertyDescriptor(a, e));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return r;
|
|
76
|
+
}
|
|
77
|
+
function f(r, t) {
|
|
78
|
+
var a = {};
|
|
79
|
+
for (var e in r)
|
|
80
|
+
a[e] = t(r[e], e);
|
|
81
|
+
return a;
|
|
82
|
+
}
|
|
83
|
+
var w = (r, t, a) => {
|
|
84
|
+
for (var e of Object.keys(r)) {
|
|
85
|
+
var s;
|
|
86
|
+
if (r[e] !== ((s = t[e]) !== null && s !== void 0 ? s : a[e]))
|
|
87
|
+
return !1;
|
|
88
|
+
}
|
|
89
|
+
return !0;
|
|
90
|
+
}, x = (r) => {
|
|
91
|
+
var t = (a) => {
|
|
92
|
+
var e = r.defaultClassName, s = v(v({}, r.defaultVariants), a);
|
|
93
|
+
for (var i in s) {
|
|
94
|
+
var o, u = (o = s[i]) !== null && o !== void 0 ? o : r.defaultVariants[i];
|
|
95
|
+
if (u != null) {
|
|
96
|
+
var n = u;
|
|
97
|
+
typeof n == "boolean" && (n = n === !0 ? "true" : "false");
|
|
98
|
+
var p = (
|
|
99
|
+
// @ts-expect-error
|
|
100
|
+
r.variantClassNames[i][n]
|
|
101
|
+
);
|
|
102
|
+
p && (e += " " + p);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
for (var [b, d] of r.compoundVariants)
|
|
106
|
+
w(b, s, r.defaultVariants) && (e += " " + d);
|
|
107
|
+
return e;
|
|
108
|
+
};
|
|
109
|
+
return t.variants = () => Object.keys(r.variantClassNames), t.classNames = {
|
|
110
|
+
get base() {
|
|
111
|
+
return r.defaultClassName.split(" ")[0];
|
|
112
|
+
},
|
|
113
|
+
get variants() {
|
|
114
|
+
return f(r.variantClassNames, (a) => f(a, (e) => e.split(" ")[0]));
|
|
115
|
+
}
|
|
116
|
+
}, t;
|
|
117
|
+
}, C = "tgph-1izsev00", S = x({ defaultClassName: "tgph-1izsev01", variantClassNames: { size: { 1: "tgph-1izsev02", 2: "tgph-1izsev03", 3: "tgph-1izsev04" }, state: { default: "tgph-1izsev05", disabled: "tgph-1izsev06", error: "tgph-1izsev07" }, resize: { both: "tgph-1izsev08", vertical: "tgph-1izsev09", horizontal: "tgph-1izsev0a", none: "tgph-1izsev0b" }, variant: { outline: "tgph-1izsev0c", ghost: "tgph-1izsev0d" } }, defaultVariants: {}, compoundVariants: [] });
|
|
118
|
+
const V = ({ disabled: r, errored: t }) => r ? "disabled" : t ? "error" : "default", M = ({
|
|
119
|
+
size: r = "2",
|
|
120
|
+
variant: t = "outline",
|
|
121
|
+
rounded: a = "2",
|
|
122
|
+
resize: e = "both",
|
|
123
|
+
disabled: s,
|
|
124
|
+
errored: i,
|
|
125
|
+
className: o,
|
|
126
|
+
...u
|
|
127
|
+
}) => {
|
|
128
|
+
const n = V({ disabled: s, errored: i });
|
|
129
|
+
return /* @__PURE__ */ m(
|
|
130
|
+
c,
|
|
131
|
+
{
|
|
132
|
+
as: "textarea",
|
|
133
|
+
className: g(
|
|
134
|
+
C,
|
|
135
|
+
S({ variant: t, size: r, resize: e, state: n }),
|
|
136
|
+
o
|
|
137
|
+
),
|
|
138
|
+
rounded: a,
|
|
139
|
+
disabled: s,
|
|
140
|
+
...h[r],
|
|
141
|
+
...y[t],
|
|
142
|
+
...O[n],
|
|
143
|
+
...u
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
export {
|
|
148
|
+
M as TextArea
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/TextArea/TextArea.constants.ts","../../../../node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js","../../src/TextArea/TextArea.tsx"],"sourcesContent":["import type { TgphComponentProps } from \"@telegraph/helpers\";\nimport type { Box } from \"@telegraph/layout\";\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]: TgphComponentProps<typeof Box>;\n};\n\ntype VariantMap = {\n [key in Variant]: TgphComponentProps<typeof Box>;\n};\n\ntype StateMap = {\n [key in State]: TgphComponentProps<typeof Box>;\n};\n\nexport const sizeMap: SizeMap = {\n \"1\": {\n p: \"1\",\n },\n \"2\": {\n px: \"2\",\n py: \"1\",\n },\n \"3\": {\n px: \"3\",\n py: \"2\",\n },\n};\n\nexport const variantMap: VariantMap = {\n outline: {\n border: \"px\",\n },\n ghost: {\n border: \"px\",\n borderColor: \"transparent\",\n },\n};\n\nexport const stateMap: StateMap = {\n default: {},\n disabled: {\n bg: \"gray-2\",\n borderColor: \"gray-2\",\n },\n error: {\n borderColor: \"red-6\",\n },\n};\n","function toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\n\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : String(i);\n}\n\nfunction _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\n\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n _defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\n\nfunction mapValues(input, fn) {\n var result = {};\n for (var _key in input) {\n result[_key] = fn(input[_key], _key);\n }\n return result;\n}\n\nvar shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {\n for (var key of Object.keys(compoundCheck)) {\n var _selections$key;\n if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {\n return false;\n }\n }\n return true;\n};\nvar createRuntimeFn = config => {\n var runtimeFn = options => {\n var className = config.defaultClassName;\n var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);\n for (var variantName in selections) {\n var _selections$variantNa;\n var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];\n if (variantSelection != null) {\n var selection = variantSelection;\n if (typeof selection === 'boolean') {\n // @ts-expect-error\n selection = selection === true ? 'true' : 'false';\n }\n var selectionClassName =\n // @ts-expect-error\n config.variantClassNames[variantName][selection];\n if (selectionClassName) {\n className += ' ' + selectionClassName;\n }\n }\n }\n for (var [compoundCheck, compoundClassName] of config.compoundVariants) {\n if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {\n className += ' ' + compoundClassName;\n }\n }\n return className;\n };\n runtimeFn.variants = () => Object.keys(config.variantClassNames);\n runtimeFn.classNames = {\n get base() {\n return config.defaultClassName.split(' ')[0];\n },\n get variants() {\n return mapValues(config.variantClassNames, classNames => mapValues(classNames, className => className.split(' ')[0]));\n }\n };\n return runtimeFn;\n};\n\nexport { createRuntimeFn as c, mapValues as m };\n","import type { TgphComponentProps } from \"@telegraph/helpers\";\nimport { Box } from \"@telegraph/layout\";\nimport { clsx } from \"clsx\";\nimport React from \"react\";\n\nimport {\n type Size,\n type State,\n type Variant,\n sizeMap,\n stateMap,\n variantMap,\n} from \"./TextArea.constants\";\nimport { baseStyles, variants } from \"./TextArea.css\";\n\nconst deriveState = ({ disabled, errored }: TextAreaBaseProps): State => {\n if (disabled) return \"disabled\";\n if (errored) return \"error\";\n return \"default\";\n};\n\ntype TextAreaBaseProps = {\n size?: Size;\n variant?: Variant;\n errored?: boolean;\n disabled?: boolean;\n resize?: \"both\" | \"vertical\" | \"horizontal\" | \"none\";\n};\n\ntype TextAreaProps = TextAreaBaseProps &\n TgphComponentProps<typeof Box> &\n React.ComponentPropsWithoutRef<\"textarea\">;\n\nconst TextArea = ({\n size = \"2\",\n variant = \"outline\",\n rounded = \"2\",\n resize = \"both\",\n disabled,\n errored,\n className,\n ...props\n}: TextAreaProps) => {\n const derivedState = deriveState({ disabled, errored });\n\n return (\n <Box\n as=\"textarea\"\n className={clsx(\n baseStyles,\n variants({ variant, size, resize, state: derivedState }),\n className,\n )}\n rounded={rounded}\n disabled={disabled}\n {...sizeMap[size]}\n {...variantMap[variant]}\n {...stateMap[derivedState]}\n {...props}\n />\n );\n};\n\ntype TextAreaExportedProps = TgphComponentProps<typeof TextArea>;\n\nexport { TextArea, type TextAreaExportedProps as TextAreaProps };\n"],"names":["sizeMap","variantMap","stateMap","toPrimitive","t","r","e","i","toPropertyKey","_defineProperty","obj","key","value","ownKeys","o","_objectSpread2","mapValues","input","fn","result","_key","shouldApplyCompound","compoundCheck","selections","defaultVariants","_selections$key","createRuntimeFn","config","runtimeFn","options","className","variantName","_selections$variantNa","variantSelection","selection","selectionClassName","compoundClassName","classNames","deriveState","disabled","errored","TextArea","size","variant","rounded","resize","props","derivedState","jsx","Box","clsx","baseStyles","variants"],"mappings":";;;AAmBO,MAAMA,IAAmB;AAAA,EAC9B,GAAK;AAAA,IACH,GAAG;AAAA,EACL;AAAA,EACA,GAAK;AAAA,IACH,IAAI;AAAA,IACJ,IAAI;AAAA,EACN;AAAA,EACA,GAAK;AAAA,IACH,IAAI;AAAA,IACJ,IAAI;AAAA,EACN;AACF,GAEaC,IAAyB;AAAA,EACpC,SAAS;AAAA,IACP,QAAQ;AAAA,EACV;AAAA,EACA,OAAO;AAAA,IACL,QAAQ;AAAA,IACR,aAAa;AAAA,EACf;AACF,GAEaC,IA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;AAAA,MACF;AAAA,MACA,SAAAc;AAAA,MACA,UAAAL;AAAA,MACC,GAAGvC,EAAQ0C,CAAI;AAAA,MACf,GAAGzC,EAAW0C,CAAO;AAAA,MACrB,GAAGzC,EAAS6C,CAAY;AAAA,MACxB,GAAGD;AAAA,IAAA;AAAA,EAAA;AAGV;","x_google_ignoreList":[1]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TgphComponentProps } from '@telegraph/helpers';
|
|
2
|
+
import { Box } from '@telegraph/layout';
|
|
3
|
+
|
|
4
|
+
export type Size = "1" | "2" | "3";
|
|
5
|
+
export type Variant = "outline" | "ghost";
|
|
6
|
+
export type State = "default" | "disabled" | "error";
|
|
7
|
+
type SizeMap = {
|
|
8
|
+
[key in Size]: TgphComponentProps<typeof Box>;
|
|
9
|
+
};
|
|
10
|
+
type VariantMap = {
|
|
11
|
+
[key in Variant]: TgphComponentProps<typeof Box>;
|
|
12
|
+
};
|
|
13
|
+
type StateMap = {
|
|
14
|
+
[key in State]: TgphComponentProps<typeof Box>;
|
|
15
|
+
};
|
|
16
|
+
export declare const sizeMap: SizeMap;
|
|
17
|
+
export declare const variantMap: VariantMap;
|
|
18
|
+
export declare const stateMap: StateMap;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=TextArea.constants.d.ts.map
|
|
@@ -0,0 +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,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAE7C,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,GAAG;KACZ,GAAG,IAAI,IAAI,GAAG,kBAAkB,CAAC,OAAO,GAAG,CAAC;CAC9C,CAAC;AAEF,KAAK,UAAU,GAAG;KACf,GAAG,IAAI,OAAO,GAAG,kBAAkB,CAAC,OAAO,GAAG,CAAC;CACjD,CAAC;AAEF,KAAK,QAAQ,GAAG;KACb,GAAG,IAAI,KAAK,GAAG,kBAAkB,CAAC,OAAO,GAAG,CAAC;CAC/C,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,OAYrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAQxB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,QAStB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare const baseStyles: string;
|
|
2
|
+
export declare const variants: import('@vanilla-extract/recipes').RuntimeFn<{
|
|
3
|
+
size: {
|
|
4
|
+
"1": {
|
|
5
|
+
fontSize: "var(--tgph-text-1)";
|
|
6
|
+
lineHeight: "var(--tgph-leading-1)";
|
|
7
|
+
letterSpacing: "var(--tgph-tracking-1)";
|
|
8
|
+
};
|
|
9
|
+
"2": {
|
|
10
|
+
fontSize: "var(--tgph-text-2)";
|
|
11
|
+
lineHeight: "var(--tgph-leading-2)";
|
|
12
|
+
letterSpacing: "var(--tgph-tracking-2)";
|
|
13
|
+
};
|
|
14
|
+
"3": {
|
|
15
|
+
fontSize: "var(--tgph-text-3)";
|
|
16
|
+
lineHeight: "var(--tgph-leading-3)";
|
|
17
|
+
letterSpacing: "var(--tgph-tracking-3)";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
state: {
|
|
21
|
+
default: {};
|
|
22
|
+
disabled: {
|
|
23
|
+
cursor: "not-allowed";
|
|
24
|
+
":hover": {
|
|
25
|
+
borderColor: "var(--tgph-gray-2)";
|
|
26
|
+
};
|
|
27
|
+
":focus": {
|
|
28
|
+
borderColor: "var(--tgph-gray-2)";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
error: {
|
|
32
|
+
":hover": {
|
|
33
|
+
borderColor: "var(--tgph-red-6)";
|
|
34
|
+
};
|
|
35
|
+
":focus": {
|
|
36
|
+
borderColor: "var(--tgph-red-8)";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
resize: {
|
|
41
|
+
both: {
|
|
42
|
+
resize: "both";
|
|
43
|
+
};
|
|
44
|
+
vertical: {
|
|
45
|
+
resize: "vertical";
|
|
46
|
+
};
|
|
47
|
+
horizontal: {
|
|
48
|
+
resize: "horizontal";
|
|
49
|
+
};
|
|
50
|
+
none: {
|
|
51
|
+
resize: "none";
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
variant: {
|
|
55
|
+
outline: {};
|
|
56
|
+
ghost: {
|
|
57
|
+
resize: "none";
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
}>;
|
|
61
|
+
//# sourceMappingURL=TextArea.css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.css.d.ts","sourceRoot":"","sources":["../../../src/TextArea/TextArea.css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,QAerB,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4DnB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TgphComponentProps } from '@telegraph/helpers';
|
|
2
|
+
import { Box } from '@telegraph/layout';
|
|
3
|
+
import { default as React } from 'react';
|
|
4
|
+
import { Size, Variant } from './TextArea.constants';
|
|
5
|
+
|
|
6
|
+
type TextAreaBaseProps = {
|
|
7
|
+
size?: Size;
|
|
8
|
+
variant?: Variant;
|
|
9
|
+
errored?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
resize?: "both" | "vertical" | "horizontal" | "none";
|
|
12
|
+
};
|
|
13
|
+
type TextAreaProps = TextAreaBaseProps & TgphComponentProps<typeof Box> & React.ComponentPropsWithoutRef<"textarea">;
|
|
14
|
+
declare const TextArea: ({ size, variant, rounded, resize, disabled, errored, className, ...props }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
type TextAreaExportedProps = TgphComponentProps<typeof TextArea>;
|
|
16
|
+
export { TextArea, type TextAreaExportedProps as TextAreaProps };
|
|
17
|
+
//# sourceMappingURL=TextArea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/TextArea/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,KAAK,IAAI,EAET,KAAK,OAAO,EAIb,MAAM,sBAAsB,CAAC;AAS9B,KAAK,iBAAiB,GAAG;IACvB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;CACtD,CAAC;AAEF,KAAK,aAAa,GAAG,iBAAiB,GACpC,kBAAkB,CAAC,OAAO,GAAG,CAAC,GAC9B,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;AAE7C,QAAA,MAAM,QAAQ,+EASX,aAAa,4CAmBf,CAAC;AAEF,KAAK,qBAAqB,GAAG,kBAAkB,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,KAAK,qBAAqB,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/TextArea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@telegraph/textarea",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A multi-line user input.",
|
|
5
|
+
"repository": "https://github.com/knocklabs/telegraph/tree/main/packages/textarea",
|
|
6
|
+
"author": "@knocklabs",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"main": "./dist/cjs/index.js",
|
|
9
|
+
"module": "./dist/esm/index.mjs",
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/esm/index.mjs",
|
|
14
|
+
"require": "./dist/cjs/index.js",
|
|
15
|
+
"types": "./dist/types/index.d.ts",
|
|
16
|
+
"default": "./dist/css/default.css"
|
|
17
|
+
},
|
|
18
|
+
"./default.css": "./dist/css/default.css"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"prettier": "@telegraph/prettier-config",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"clean": "rm -rf dist",
|
|
27
|
+
"dev": "vite build --watch --emptyOutDir false",
|
|
28
|
+
"build": "yarn clean && vite build",
|
|
29
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
30
|
+
"format": "prettier \"src/**/*.{js,ts,tsx}\" --write",
|
|
31
|
+
"format:check": "prettier \"src/**/*.{js,ts,tsx}\" --check",
|
|
32
|
+
"preview": "vite preview"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@telegraph/helpers": "^0.0.7",
|
|
36
|
+
"@telegraph/layout": "^0.0.30",
|
|
37
|
+
"@telegraph/style-engine": "^0.0.5",
|
|
38
|
+
"clsx": "^2.1.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@knocklabs/eslint-config": "^0.0.3",
|
|
42
|
+
"@knocklabs/typescript-config": "^0.0.2",
|
|
43
|
+
"@telegraph/postcss-config": "^0.0.20",
|
|
44
|
+
"@telegraph/prettier-config": "^0.0.6",
|
|
45
|
+
"@telegraph/vite-config": "^0.0.11",
|
|
46
|
+
"@types/react": "^18.2.48",
|
|
47
|
+
"eslint": "^8.56.0",
|
|
48
|
+
"react": "^18.2.0",
|
|
49
|
+
"react-dom": "^18.3.1",
|
|
50
|
+
"typescript": "^5.5.4",
|
|
51
|
+
"vite": "^5.3.6"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"react": "^18.2.0",
|
|
55
|
+
"react-dom": "^18.3.1"
|
|
56
|
+
}
|
|
57
|
+
}
|