datocms-react-ui 0.7.15 → 0.8.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.
Files changed (38) hide show
  1. package/dist/cjs/Form/index.js +9 -0
  2. package/dist/cjs/Form/index.js.map +1 -1
  3. package/dist/cjs/TextareaField/index.js +26 -0
  4. package/dist/cjs/TextareaField/index.js.map +1 -0
  5. package/dist/cjs/TextareaInput/index.js +71 -0
  6. package/dist/cjs/TextareaInput/index.js.map +1 -0
  7. package/dist/cjs/TextareaInput/styles.module.css.json +1 -0
  8. package/dist/cjs/index.js +2 -0
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/esm/Form/index.d.ts +9 -0
  11. package/dist/esm/Form/index.js +9 -0
  12. package/dist/esm/Form/index.js.map +1 -1
  13. package/dist/esm/TextareaField/index.d.ts +17 -0
  14. package/dist/esm/TextareaField/index.js +19 -0
  15. package/dist/esm/TextareaField/index.js.map +1 -0
  16. package/dist/esm/TextareaInput/index.d.ts +13 -0
  17. package/dist/esm/TextareaInput/index.js +41 -0
  18. package/dist/esm/TextareaInput/index.js.map +1 -0
  19. package/dist/esm/TextareaInput/styles.module.css.json +1 -0
  20. package/dist/esm/index.d.ts +2 -0
  21. package/dist/esm/index.js +2 -0
  22. package/dist/esm/index.js.map +1 -1
  23. package/dist/types/Form/index.d.ts +9 -0
  24. package/dist/types/TextareaField/index.d.ts +17 -0
  25. package/dist/types/TextareaInput/index.d.ts +13 -0
  26. package/dist/types/index.d.ts +2 -0
  27. package/package.json +3 -3
  28. package/src/Form/index.tsx +9 -0
  29. package/src/TextareaField/index.tsx +56 -0
  30. package/src/TextareaField/styles.module.css +0 -0
  31. package/src/TextareaField/styles.module.css.json +1 -0
  32. package/src/TextareaInput/index.tsx +70 -0
  33. package/src/TextareaInput/styles.module.css +52 -0
  34. package/src/TextareaInput/styles.module.css.json +1 -0
  35. package/src/global.css +2 -0
  36. package/src/index.ts +2 -0
  37. package/styles.css +1 -1
  38. package/types.json +736 -306
@@ -91,6 +91,15 @@ var styles_module_css_json_1 = __importDefault(require("./styles.module.css.json
91
91
  * textInputProps={{ monospaced: true }}
92
92
  * onChange={(newValue) => console.log(newValue)}
93
93
  * />
94
+ * <TextareaField
95
+ * required
96
+ * name="longText"
97
+ * id="longText"
98
+ * label="Long text"
99
+ * value="Lorem ipsum dolor sit amet, consectetur adipiscing elit.."
100
+ * hint="Enter some text"
101
+ * onChange={(newValue) => console.log(newValue)}
102
+ * />
94
103
  * <SelectField
95
104
  * name="option"
96
105
  * id="option"
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Form/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAOe;AACf,0DAA4B;AAC5B,oFAA8C;AAU9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AACI,IAAM,IAAI,GAAG,UAAC,EAMT;IALV,IAAA,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,eAAmB,EAAnB,OAAO,mBAAG,SAAS,KAAA,EAChB,UAAU,cALM,gDAMpB,CADc;IAEb,IAAM,UAAU,GAAG,IAAA,oBAAE,EAAC,gCAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAE9C,IAAM,kBAAkB,GAAG,IAAA,oBAAE,EAC3B,gCAAM,CAAC,UAAU,EACjB,gCAAM,CAAC,sBAAe,OAAO,CAAE,CAAC,CACjC,CAAC;IAEF,IAAM,YAAY,GAAG,IAAA,mBAAW,EAC9B,UAAC,KAAgB;QACf,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,KAAK,CAAC,CAAC;SACjB;IACH,CAAC,EACD,CAAC,QAAQ,CAAC,C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;IAEF,OAAO,CACL,iDAAM,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,IAAM,UAAU,GAChE,gBAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAC,KAAK;QAC5B,IAAI,KAAK,EAAE;YACT,OAAO,uCAAK,SAAS,EAAE,kBAAkB,IAAG,KAAK,CAAO,CAAC;SAC1D;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CACG,CACR,CAAC;AACJ,CAAC,CAAC;AAlCW,QAAA,IAAI,QAkCf"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.TextareaField = void 0;
18
+ var react_1 = __importDefault(require("react"));
19
+ var __1 = require("..");
20
+ function TextareaField(_a) {
21
+ var id = _a.id, name = _a.name, label = _a.label, hint = _a.hint, error = _a.error, required = _a.required, placeholder = _a.placeholder, formLabelProps = _a.formLabelProps, value = _a.value, onChange = _a.onChange, textareaInputProps = _a.textareaInputProps;
22
+ return (react_1.default.createElement(__1.FieldWrapper, { formLabelProps: formLabelProps, id: id, required: required, error: error, hint: hint, label: label },
23
+ react_1.default.createElement(__1.TextareaInput, __assign({}, textareaInputProps, { id: id, name: name, value: value, placeholder: placeholder, onChange: onChange, error: !!error }))));
24
+ }
25
+ exports.TextareaField = TextareaField;
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/TextareaField/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAAyC;AACzC,wBAKY;AAgBZ,SAAgB,aAAa,CAAC,EAYT;QAXnB,EAAE,QAAA,EACF,IAAI,UAAA,EACJ,KAAK,WAAA,EACL,IAAI,UAAA,EACJ,KAAK,WAAA,EACL,QAAQ,cAAA,EACR,WAAW,iBAAA,EACX,cAAc,oBAAA,EACd,KAAK,WAAA,EACL,QAAQ,cAAA,EACR,kBAAkB,wBAAA;IAElB,OAAO,CACL,8BAAC,gBAAY,IACX,cAAc,EAAE,cAAc,EAC9B,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK;QAEZ,8BAAC,iBAAa,eACR,kBAAkB,IACtB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,CAAC,CAAC,KAAK,IACd,CACW,CAChB,CAAC;AACJ,CAAC;AAjCD,sCAiCC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __rest = (this && this.__rest) || function (s, e) {
37
+ var t = {};
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
+ t[p] = s[p];
40
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
+ t[p[i]] = s[p[i]];
44
+ }
45
+ return t;
46
+ };
47
+ var __importDefault = (this && this.__importDefault) || function (mod) {
48
+ return (mod && mod.__esModule) ? mod : { "default": mod };
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.TextareaInput = void 0;
52
+ var react_1 = __importStar(require("react"));
53
+ var classnames_1 = __importDefault(require("classnames"));
54
+ var styles_module_css_json_1 = __importDefault(require("./styles.module.css.json"));
55
+ var TextareaInput = function (_a) {
56
+ var _b;
57
+ var className = _a.className, _c = _a.disabled, disabled = _c === void 0 ? false : _c, error = _a.error, id = _a.id, inputRef = _a.inputRef, maxLength = _a.maxLength, name = _a.name, labelText = _a.labelText, onBlur = _a.onBlur, onChange = _a.onChange, placeholder = _a.placeholder, _d = _a.required, required = _d === void 0 ? false : _d, value = _a.value, monospaced = _a.monospaced, otherProps = __rest(_a, ["className", "disabled", "error", "id", "inputRef", "maxLength", "name", "labelText", "onBlur", "onChange", "placeholder", "required", "value", "monospaced"]);
58
+ var handleChange = (0, react_1.useCallback)(function (e) {
59
+ if (onChange) {
60
+ onChange(e.target.value, e);
61
+ }
62
+ }, [onChange]);
63
+ var classNames = (0, classnames_1.default)(styles_module_css_json_1.default['TextareaInput'], className, (_b = {},
64
+ _b[styles_module_css_json_1.default['TextareaInput--disabled']] = disabled,
65
+ _b[styles_module_css_json_1.default['TextareaInput--error']] = error,
66
+ _b[styles_module_css_json_1.default['TextareaInput--monospaced']] = monospaced,
67
+ _b));
68
+ return (react_1.default.createElement("textarea", __assign({ className: classNames, "aria-label": labelText, id: id, name: name, required: required, placeholder: placeholder, maxLength: maxLength, disabled: disabled, onBlur: onBlur, onChange: handleChange, value: value, ref: inputRef }, otherProps)));
69
+ };
70
+ exports.TextareaInput = TextareaInput;
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/TextareaInput/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAmE;AACnE,0DAA4B;AAC5B,oFAAyC;AAkBlC,IAAM,aAAa,GAAG,UAAC,EAgBT;;IAfnB,IAAA,SAAS,eAAA,EACT,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,KAAK,WAAA,EACL,EAAE,QAAA,EACF,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,IAAI,UAAA,EACJ,SAAS,eAAA,EACT,MAAM,YAAA,EACN,QAAQ,cAAA,EACR,WAAW,iBAAA,EACX,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,KAAK,WAAA,EACL,UAAU,gBAAA,EACP,UAAU,cAfe,8JAgB7B,CADc;IAEb,IAAM,YAAY,GAAG,IAAA,mBAAW,EAC9B,UAAC,CAAmC;QAClC,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAC7B;IACH,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,IAAM,UAAU,GAAG,IAAA,oBAAE,EAAC,gCAAC,CAAC,eAAe,CAAC,EAAE,SAAS;QACjD,GAAC,gCAAC,CAAC,yBAAyB,CAAC,IAAG,QAAQ;QACxC,GAAC,gCAAC,CAAC,sBAAsB,CAAC,IAAG,KAAK;QAClC,GAAC,gCAAC,CAAC,2BAA2B,CAAC,IAAG,UAAU;YAC5C,CAAC;IAEH,OAAO,CACL,qDACE,SAAS,EAAE,UAAU,gBACT,SAAS,EACrB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,QAAQ,IACT,UAAU,EACd,CACH,CAAC;AACJ,CAAC,CAAC;AAjDW,QAAA,aAAa,iBAiDxB"}
@@ -0,0 +1 @@
1
+ { "TextareaInput": "_TextareaInput_1wnu9_1", "TextareaInput--monospaced": "_TextareaInput--monospaced_1wnu9_30", "TextareaInput--disabled": "_TextareaInput--disabled_1wnu9_35", "TextareaInput--error": "_TextareaInput--error_1wnu9_41" }
package/dist/cjs/index.js CHANGED
@@ -35,6 +35,8 @@ __exportStar(require("./SwitchField"), exports);
35
35
  __exportStar(require("./SwitchInput"), exports);
36
36
  __exportStar(require("./TextField"), exports);
37
37
  __exportStar(require("./TextInput"), exports);
38
+ __exportStar(require("./TextareaField"), exports);
39
+ __exportStar(require("./TextareaInput"), exports);
38
40
  __exportStar(require("./Toolbar"), exports);
39
41
  __exportStar(require("./useClickOutside"), exports);
40
42
  __exportStar(require("./useMediaQuery"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,gDAA8B;AAC9B,2CAAyB;AACzB,qDAAmC;AACnC,6CAA2B;AAC3B,+CAA6B;AAC7B,+CAA6B;AAC7B,8CAA4B;AAC5B,yCAAuB;AACvB,iDAA+B;AAC/B,8CAA4B;AAC5B,0CAAwB;AACxB,4CAA0B;AAC1B,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B;AAC/B,4CAA0B;AAC1B,gDAA8B;AAC9B,gDAA8B;AAC9B,8CAA4B;AAC5B,8CAA4B;AAC5B,4CAA0B;AAC1B,oDAAkC;AAClC,kDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,gDAA8B;AAC9B,2CAAyB;AACzB,qDAAmC;AACnC,6CAA2B;AAC3B,+CAA6B;AAC7B,+CAA6B;AAC7B,8CAA4B;AAC5B,yCAAuB;AACvB,iDAA+B;AAC/B,8CAA4B;AAC5B,0CAAwB;AACxB,4CAA0B;AAC1B,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B;AAC/B,4CAA0B;AAC1B,gDAA8B;AAC9B,gDAA8B;AAC9B,8CAA4B;AAC5B,8CAA4B;AAC5B,kDAAgC;AAChC,kDAAgC;AAChC,4CAA0B;AAC1B,oDAAkC;AAClC,kDAAgC"}
@@ -45,6 +45,15 @@ export interface FormProps {
45
45
  * textInputProps={{ monospaced: true }}
46
46
  * onChange={(newValue) => console.log(newValue)}
47
47
  * />
48
+ * <TextareaField
49
+ * required
50
+ * name="longText"
51
+ * id="longText"
52
+ * label="Long text"
53
+ * value="Lorem ipsum dolor sit amet, consectetur adipiscing elit.."
54
+ * hint="Enter some text"
55
+ * onChange={(newValue) => console.log(newValue)}
56
+ * />
48
57
  * <SelectField
49
58
  * name="option"
50
59
  * id="option"
@@ -62,6 +62,15 @@ import styles from './styles.module.css.json';
62
62
  * textInputProps={{ monospaced: true }}
63
63
  * onChange={(newValue) => console.log(newValue)}
64
64
  * />
65
+ * <TextareaField
66
+ * required
67
+ * name="longText"
68
+ * id="longText"
69
+ * label="Long text"
70
+ * value="Lorem ipsum dolor sit amet, consectetur adipiscing elit.."
71
+ * hint="Enter some text"
72
+ * onChange={(newValue) => console.log(newValue)}
73
+ * />
65
74
  * <SelectField
66
75
  * name="option"
67
76
  * id="option"
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Form/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,WAAW,GAKZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAU9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AACH,MAAM,CAAC,IAAM,IAAI,GAAG,UAAC,EAMT;IALV,IAAA,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,eAAmB,EAAnB,OAAO,mBAAG,SAAS,KAAA,EAChB,UAAU,cALM,gDAMpB,CADc;IAEb,IAAM,UAAU,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAE9C,IAAM,kBAAkB,GAAG,EAAE,CAC3B,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,sBAAe,OAAO,CAAE,CAAC,CACjC,CAAC;IAEF,IAAM,YAAY,GAAG,WAAW,CAC9B,UAAC,KAAgB;QACf,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,KAAK,CAAC,CAAC;SACjB;IACH,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC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AAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,uCAAM,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,IAAM,UAAU,GAChE,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAC,KAAK;QAC5B,IAAI,KAAK,EAAE;YACT,OAAO,6BAAK,SAAS,EAAE,kBAAkB,IAAG,KAAK,CAAO,CAAC;SAC1D;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CACG,CACR,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from 'react';
2
+ import { FormLabelProps, TextareaInputProps } from '..';
3
+ declare type TextareaFieldProps = {
4
+ id: string;
5
+ name: string;
6
+ label: ReactNode;
7
+ hint?: ReactNode;
8
+ placeholder?: string;
9
+ error?: ReactNode;
10
+ required?: boolean;
11
+ formLabelProps?: FormLabelProps;
12
+ value: TextareaInputProps['value'];
13
+ onChange: TextareaInputProps['onChange'];
14
+ textareaInputProps?: TextareaInputProps;
15
+ };
16
+ export declare function TextareaField({ id, name, label, hint, error, required, placeholder, formLabelProps, value, onChange, textareaInputProps, }: TextareaFieldProps): JSX.Element;
17
+ export {};
@@ -0,0 +1,19 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import React from 'react';
13
+ import { FieldWrapper, TextareaInput, } from '..';
14
+ export function TextareaField(_a) {
15
+ var id = _a.id, name = _a.name, label = _a.label, hint = _a.hint, error = _a.error, required = _a.required, placeholder = _a.placeholder, formLabelProps = _a.formLabelProps, value = _a.value, onChange = _a.onChange, textareaInputProps = _a.textareaInputProps;
16
+ return (React.createElement(FieldWrapper, { formLabelProps: formLabelProps, id: id, required: required, error: error, hint: hint, label: label },
17
+ React.createElement(TextareaInput, __assign({}, textareaInputProps, { id: id, name: name, value: value, placeholder: placeholder, onChange: onChange, error: !!error }))));
18
+ }
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/TextareaField/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EACL,YAAY,EAEZ,aAAa,GAEd,MAAM,IAAI,CAAC;AAgBZ,MAAM,UAAU,aAAa,CAAC,EAYT;QAXnB,EAAE,QAAA,EACF,IAAI,UAAA,EACJ,KAAK,WAAA,EACL,IAAI,UAAA,EACJ,KAAK,WAAA,EACL,QAAQ,cAAA,EACR,WAAW,iBAAA,EACX,cAAc,oBAAA,EACd,KAAK,WAAA,EACL,QAAQ,cAAA,EACR,kBAAkB,wBAAA;IAElB,OAAO,CACL,oBAAC,YAAY,IACX,cAAc,EAAE,cAAc,EAC9B,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK;QAEZ,oBAAC,aAAa,eACR,kBAAkB,IACtB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,CAAC,CAAC,KAAK,IACd,CACW,CAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import React, { RefObject } from 'react';
2
+ export declare type TextareaInputChangeEventHandler = (newValue: string, event: React.ChangeEvent<HTMLTextAreaElement>) => void;
3
+ export declare type TextareaInputProps = {
4
+ name?: string;
5
+ labelText?: string;
6
+ id?: string;
7
+ className?: string;
8
+ monospaced?: boolean;
9
+ onChange?: TextareaInputChangeEventHandler;
10
+ inputRef?: RefObject<HTMLTextAreaElement>;
11
+ error?: boolean;
12
+ } & Omit<JSX.IntrinsicElements['textarea'], 'onChange'>;
13
+ export declare const TextareaInput: ({ className, disabled, error, id, inputRef, maxLength, name, labelText, onBlur, onChange, placeholder, required, value, monospaced, ...otherProps }: TextareaInputProps) => JSX.Element;
@@ -0,0 +1,41 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import React, { useCallback } from 'react';
24
+ import cn from 'classnames';
25
+ import s from './styles.module.css.json';
26
+ export var TextareaInput = function (_a) {
27
+ var _b;
28
+ var className = _a.className, _c = _a.disabled, disabled = _c === void 0 ? false : _c, error = _a.error, id = _a.id, inputRef = _a.inputRef, maxLength = _a.maxLength, name = _a.name, labelText = _a.labelText, onBlur = _a.onBlur, onChange = _a.onChange, placeholder = _a.placeholder, _d = _a.required, required = _d === void 0 ? false : _d, value = _a.value, monospaced = _a.monospaced, otherProps = __rest(_a, ["className", "disabled", "error", "id", "inputRef", "maxLength", "name", "labelText", "onBlur", "onChange", "placeholder", "required", "value", "monospaced"]);
29
+ var handleChange = useCallback(function (e) {
30
+ if (onChange) {
31
+ onChange(e.target.value, e);
32
+ }
33
+ }, [onChange]);
34
+ var classNames = cn(s['TextareaInput'], className, (_b = {},
35
+ _b[s['TextareaInput--disabled']] = disabled,
36
+ _b[s['TextareaInput--error']] = error,
37
+ _b[s['TextareaInput--monospaced']] = monospaced,
38
+ _b));
39
+ return (React.createElement("textarea", __assign({ className: classNames, "aria-label": labelText, id: id, name: name, required: required, placeholder: placeholder, maxLength: maxLength, disabled: disabled, onBlur: onBlur, onChange: handleChange, value: value, ref: inputRef }, otherProps)));
40
+ };
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/TextareaInput/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAA0B,MAAM,OAAO,CAAC;AACnE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAkBzC,MAAM,CAAC,IAAM,aAAa,GAAG,UAAC,EAgBT;;IAfnB,IAAA,SAAS,eAAA,EACT,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,KAAK,WAAA,EACL,EAAE,QAAA,EACF,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,IAAI,UAAA,EACJ,SAAS,eAAA,EACT,MAAM,YAAA,EACN,QAAQ,cAAA,EACR,WAAW,iBAAA,EACX,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,KAAK,WAAA,EACL,UAAU,gBAAA,EACP,UAAU,cAfe,8JAgB7B,CADc;IAEb,IAAM,YAAY,GAAG,WAAW,CAC9B,UAAC,CAAmC;QAClC,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAC7B;IACH,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,IAAM,UAAU,GAAG,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,SAAS;QACjD,GAAC,CAAC,CAAC,yBAAyB,CAAC,IAAG,QAAQ;QACxC,GAAC,CAAC,CAAC,sBAAsB,CAAC,IAAG,KAAK;QAClC,GAAC,CAAC,CAAC,2BAA2B,CAAC,IAAG,UAAU;YAC5C,CAAC;IAEH,OAAO,CACL,2CACE,SAAS,EAAE,UAAU,gBACT,SAAS,EACrB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,QAAQ,IACT,UAAU,EACd,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ { "TextareaInput": "_TextareaInput_1wnu9_1", "TextareaInput--monospaced": "_TextareaInput--monospaced_1wnu9_30", "TextareaInput--disabled": "_TextareaInput--disabled_1wnu9_35", "TextareaInput--error": "_TextareaInput--error_1wnu9_41" }
@@ -19,6 +19,8 @@ export * from './SwitchField';
19
19
  export * from './SwitchInput';
20
20
  export * from './TextField';
21
21
  export * from './TextInput';
22
+ export * from './TextareaField';
23
+ export * from './TextareaInput';
22
24
  export * from './Toolbar';
23
25
  export * from './useClickOutside';
24
26
  export * from './useMediaQuery';
package/dist/esm/index.js CHANGED
@@ -19,6 +19,8 @@ export * from './SwitchField';
19
19
  export * from './SwitchInput';
20
20
  export * from './TextField';
21
21
  export * from './TextInput';
22
+ export * from './TextareaField';
23
+ export * from './TextareaInput';
22
24
  export * from './Toolbar';
23
25
  export * from './useClickOutside';
24
26
  export * from './useMediaQuery';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC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mB,CAAC;AAClC,cAAc,iBAAiB,CAAC"}
@@ -45,6 +45,15 @@ export interface FormProps {
45
45
  * textInputProps={{ monospaced: true }}
46
46
  * onChange={(newValue) => console.log(newValue)}
47
47
  * />
48
+ * <TextareaField
49
+ * required
50
+ * name="longText"
51
+ * id="longText"
52
+ * label="Long text"
53
+ * value="Lorem ipsum dolor sit amet, consectetur adipiscing elit.."
54
+ * hint="Enter some text"
55
+ * onChange={(newValue) => console.log(newValue)}
56
+ * />
48
57
  * <SelectField
49
58
  * name="option"
50
59
  * id="option"
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from 'react';
2
+ import { FormLabelProps, TextareaInputProps } from '..';
3
+ declare type TextareaFieldProps = {
4
+ id: string;
5
+ name: string;
6
+ label: ReactNode;
7
+ hint?: ReactNode;
8
+ placeholder?: string;
9
+ error?: ReactNode;
10
+ required?: boolean;
11
+ formLabelProps?: FormLabelProps;
12
+ value: TextareaInputProps['value'];
13
+ onChange: TextareaInputProps['onChange'];
14
+ textareaInputProps?: TextareaInputProps;
15
+ };
16
+ export declare function TextareaField({ id, name, label, hint, error, required, placeholder, formLabelProps, value, onChange, textareaInputProps, }: TextareaFieldProps): JSX.Element;
17
+ export {};
@@ -0,0 +1,13 @@
1
+ import React, { RefObject } from 'react';
2
+ export declare type TextareaInputChangeEventHandler = (newValue: string, event: React.ChangeEvent<HTMLTextAreaElement>) => void;
3
+ export declare type TextareaInputProps = {
4
+ name?: string;
5
+ labelText?: string;
6
+ id?: string;
7
+ className?: string;
8
+ monospaced?: boolean;
9
+ onChange?: TextareaInputChangeEventHandler;
10
+ inputRef?: RefObject<HTMLTextAreaElement>;
11
+ error?: boolean;
12
+ } & Omit<JSX.IntrinsicElements['textarea'], 'onChange'>;
13
+ export declare const TextareaInput: ({ className, disabled, error, id, inputRef, maxLength, name, labelText, onBlur, onChange, placeholder, required, value, monospaced, ...otherProps }: TextareaInputProps) => JSX.Element;
@@ -19,6 +19,8 @@ export * from './SwitchField';
19
19
  export * from './SwitchInput';
20
20
  export * from './TextField';
21
21
  export * from './TextInput';
22
+ export * from './TextareaField';
23
+ export * from './TextareaInput';
22
24
  export * from './Toolbar';
23
25
  export * from './useClickOutside';
24
26
  export * from './useMediaQuery';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datocms-react-ui",
3
- "version": "0.7.15",
3
+ "version": "0.8.1",
4
4
  "description": "React components to use inside DatoCMS plugins",
5
5
  "keywords": [
6
6
  "datocms",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "classnames": "^2.3.1",
44
- "datocms-plugin-sdk": "^0.7.15",
44
+ "datocms-plugin-sdk": "^0.8.0",
45
45
  "react-intersection-observer": "^8.31.0",
46
46
  "react-select": "^5.2.1",
47
47
  "scroll-into-view-if-needed": "^2.2.20"
@@ -57,5 +57,5 @@
57
57
  "postcss-nested": "^5.0.6",
58
58
  "typedoc": "^0.23.20"
59
59
  },
60
- "gitHead": "5d21c006626fb71e79cbf29a3b7398b9e896ce10"
60
+ "gitHead": "abf8273c07ea3d1886bc4bc22ebe18eb924d56b7"
61
61
  }
@@ -56,6 +56,15 @@ export interface FormProps {
56
56
  * textInputProps={{ monospaced: true }}
57
57
  * onChange={(newValue) => console.log(newValue)}
58
58
  * />
59
+ * <TextareaField
60
+ * required
61
+ * name="longText"
62
+ * id="longText"
63
+ * label="Long text"
64
+ * value="Lorem ipsum dolor sit amet, consectetur adipiscing elit.."
65
+ * hint="Enter some text"
66
+ * onChange={(newValue) => console.log(newValue)}
67
+ * />
59
68
  * <SelectField
60
69
  * name="option"
61
70
  * id="option"
@@ -0,0 +1,56 @@
1
+ import React, { ReactNode } from 'react';
2
+ import {
3
+ FieldWrapper,
4
+ FormLabelProps,
5
+ TextareaInput,
6
+ TextareaInputProps,
7
+ } from '..';
8
+
9
+ type TextareaFieldProps = {
10
+ id: string;
11
+ name: string;
12
+ label: ReactNode;
13
+ hint?: ReactNode;
14
+ placeholder?: string;
15
+ error?: ReactNode;
16
+ required?: boolean;
17
+ formLabelProps?: FormLabelProps;
18
+ value: TextareaInputProps['value'];
19
+ onChange: TextareaInputProps['onChange'];
20
+ textareaInputProps?: TextareaInputProps;
21
+ };
22
+
23
+ export function TextareaField({
24
+ id,
25
+ name,
26
+ label,
27
+ hint,
28
+ error,
29
+ required,
30
+ placeholder,
31
+ formLabelProps,
32
+ value,
33
+ onChange,
34
+ textareaInputProps,
35
+ }: TextareaFieldProps): JSX.Element {
36
+ return (
37
+ <FieldWrapper
38
+ formLabelProps={formLabelProps}
39
+ id={id}
40
+ required={required}
41
+ error={error}
42
+ hint={hint}
43
+ label={label}
44
+ >
45
+ <TextareaInput
46
+ {...textareaInputProps}
47
+ id={id}
48
+ name={name}
49
+ value={value}
50
+ placeholder={placeholder}
51
+ onChange={onChange}
52
+ error={!!error}
53
+ />
54
+ </FieldWrapper>
55
+ );
56
+ }
File without changes
@@ -0,0 +1,70 @@
1
+ import React, { useCallback, RefObject, ChangeEvent } from 'react';
2
+ import cn from 'classnames';
3
+ import s from './styles.module.css.json';
4
+
5
+ export type TextareaInputChangeEventHandler = (
6
+ newValue: string,
7
+ event: React.ChangeEvent<HTMLTextAreaElement>,
8
+ ) => void;
9
+
10
+ export type TextareaInputProps = {
11
+ name?: string;
12
+ labelText?: string;
13
+ id?: string;
14
+ className?: string;
15
+ monospaced?: boolean;
16
+ onChange?: TextareaInputChangeEventHandler;
17
+ inputRef?: RefObject<HTMLTextAreaElement>;
18
+ error?: boolean;
19
+ } & Omit<JSX.IntrinsicElements['textarea'], 'onChange'>;
20
+
21
+ export const TextareaInput = ({
22
+ className,
23
+ disabled = false,
24
+ error,
25
+ id,
26
+ inputRef,
27
+ maxLength,
28
+ name,
29
+ labelText,
30
+ onBlur,
31
+ onChange,
32
+ placeholder,
33
+ required = false,
34
+ value,
35
+ monospaced,
36
+ ...otherProps
37
+ }: TextareaInputProps): JSX.Element => {
38
+ const handleChange = useCallback(
39
+ (e: ChangeEvent<HTMLTextAreaElement>) => {
40
+ if (onChange) {
41
+ onChange(e.target.value, e);
42
+ }
43
+ },
44
+ [onChange],
45
+ );
46
+
47
+ const classNames = cn(s['TextareaInput'], className, {
48
+ [s['TextareaInput--disabled']]: disabled,
49
+ [s['TextareaInput--error']]: error,
50
+ [s['TextareaInput--monospaced']]: monospaced,
51
+ });
52
+
53
+ return (
54
+ <textarea
55
+ className={classNames}
56
+ aria-label={labelText}
57
+ id={id}
58
+ name={name}
59
+ required={required}
60
+ placeholder={placeholder}
61
+ maxLength={maxLength}
62
+ disabled={disabled}
63
+ onBlur={onBlur}
64
+ onChange={handleChange}
65
+ value={value}
66
+ ref={inputRef}
67
+ {...otherProps}
68
+ />
69
+ );
70
+ };
@@ -0,0 +1,52 @@
1
+ .TextareaInput {
2
+ display: block;
3
+ box-sizing: border-box;
4
+ width: 100%;
5
+ padding: 10px;
6
+ border: 1px solid var(--border-color);
7
+ appearance: none;
8
+ border-radius: 0;
9
+ background-image: none;
10
+ transition: border 0.2s var(--material-ease);
11
+ font-size: var(--font-size-m);
12
+ resize: none;
13
+ font-family: inherit;
14
+
15
+ &::placeholder {
16
+ color: var(--placeholder-body-color);
17
+ }
18
+
19
+ &:hover {
20
+ border-color: var(--darker-border-color);
21
+ }
22
+
23
+ &:focus {
24
+ outline: 0;
25
+ border-color: var(--accent-color);
26
+ box-shadow: 0 0 0 3px var(--semi-transparent-accent-color);
27
+ }
28
+ }
29
+
30
+ .TextareaInput--monospaced {
31
+ font-family: var(--monospaced-font-family);
32
+ font-size: var(--font-size-s);
33
+ }
34
+
35
+ .TextareaInput--disabled {
36
+ color: var(--light-body-color);
37
+ border-color: var(--border-color);
38
+ background: var(--lighter-bg-color);
39
+ }
40
+
41
+ .TextareaInput--error {
42
+ border-color: var(--alert-color);
43
+
44
+ &:hover,
45
+ &:focus {
46
+ border-color: var(--alert-color);
47
+ }
48
+
49
+ &:focus {
50
+ box-shadow: 0 0 0 3px rgba(var(--alert-color-rgb-components), 0.2);
51
+ }
52
+ }
@@ -0,0 +1 @@
1
+ {"TextareaInput":"_TextareaInput_1wnu9_1","TextareaInput--monospaced":"_TextareaInput--monospaced_1wnu9_30","TextareaInput--disabled":"_TextareaInput--disabled_1wnu9_35","TextareaInput--error":"_TextareaInput--error_1wnu9_41"}
package/src/global.css CHANGED
@@ -16,6 +16,8 @@
16
16
  @import './SwitchInput/styles.module.css';
17
17
  @import './TextField/styles.module.css';
18
18
  @import './TextInput/styles.module.css';
19
+ @import './TextareaField/styles.module.css';
20
+ @import './TextareaInput/styles.module.css';
19
21
  @import './Toolbar/Button/styles.module.css';
20
22
  @import './Toolbar/Stack/styles.module.css';
21
23
  @import './Toolbar/Title/styles.module.css';
package/src/index.ts CHANGED
@@ -19,6 +19,8 @@ export * from './SwitchField';
19
19
  export * from './SwitchInput';
20
20
  export * from './TextField';
21
21
  export * from './TextInput';
22
+ export * from './TextareaField';
23
+ export * from './TextareaInput';
22
24
  export * from './Toolbar';
23
25
  export * from './useClickOutside';
24
26
  export * from './useMediaQuery';