datocms-react-ui 0.8.2 → 1.0.0-alpha.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.
Files changed (43) hide show
  1. package/dist/cjs/Canvas/index.js +1 -2
  2. package/dist/cjs/Canvas/index.js.map +1 -1
  3. package/dist/cjs/Form/index.js +0 -9
  4. package/dist/cjs/Form/index.js.map +1 -1
  5. package/dist/cjs/index.js +0 -2
  6. package/dist/cjs/index.js.map +1 -1
  7. package/dist/esm/Canvas/index.js +1 -2
  8. package/dist/esm/Canvas/index.js.map +1 -1
  9. package/dist/esm/Form/index.d.ts +0 -9
  10. package/dist/esm/Form/index.js +0 -9
  11. package/dist/esm/Form/index.js.map +1 -1
  12. package/dist/esm/index.d.ts +0 -2
  13. package/dist/esm/index.js +0 -2
  14. package/dist/esm/index.js.map +1 -1
  15. package/dist/types/Form/index.d.ts +0 -9
  16. package/dist/types/index.d.ts +0 -2
  17. package/package.json +3 -3
  18. package/src/Canvas/index.tsx +1 -4
  19. package/src/Form/index.tsx +0 -9
  20. package/src/global.css +0 -2
  21. package/src/index.ts +0 -2
  22. package/styles.css +1 -1
  23. package/types.json +306 -736
  24. package/dist/cjs/TextareaField/index.js +0 -26
  25. package/dist/cjs/TextareaField/index.js.map +0 -1
  26. package/dist/cjs/TextareaInput/index.js +0 -71
  27. package/dist/cjs/TextareaInput/index.js.map +0 -1
  28. package/dist/cjs/TextareaInput/styles.module.css.json +0 -1
  29. package/dist/esm/TextareaField/index.d.ts +0 -17
  30. package/dist/esm/TextareaField/index.js +0 -19
  31. package/dist/esm/TextareaField/index.js.map +0 -1
  32. package/dist/esm/TextareaInput/index.d.ts +0 -13
  33. package/dist/esm/TextareaInput/index.js +0 -41
  34. package/dist/esm/TextareaInput/index.js.map +0 -1
  35. package/dist/esm/TextareaInput/styles.module.css.json +0 -1
  36. package/dist/types/TextareaField/index.d.ts +0 -17
  37. package/dist/types/TextareaInput/index.d.ts +0 -13
  38. package/src/TextareaField/index.tsx +0 -56
  39. package/src/TextareaField/styles.module.css +0 -0
  40. package/src/TextareaField/styles.module.css.json +0 -1
  41. package/src/TextareaInput/index.tsx +0 -70
  42. package/src/TextareaInput/styles.module.css +0 -52
  43. package/src/TextareaInput/styles.module.css.json +0 -1
@@ -1,26 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,71 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- { "TextareaInput": "_TextareaInput_1wnu9_1", "TextareaInput--monospaced": "_TextareaInput--monospaced_1wnu9_30", "TextareaInput--disabled": "_TextareaInput--disabled_1wnu9_35", "TextareaInput--error": "_TextareaInput--error_1wnu9_41" }
@@ -1,17 +0,0 @@
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 {};
@@ -1,19 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,13 +0,0 @@
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;
@@ -1,41 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- { "TextareaInput": "_TextareaInput_1wnu9_1", "TextareaInput--monospaced": "_TextareaInput--monospaced_1wnu9_30", "TextareaInput--disabled": "_TextareaInput--disabled_1wnu9_35", "TextareaInput--error": "_TextareaInput--error_1wnu9_41" }
@@ -1,17 +0,0 @@
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 {};
@@ -1,13 +0,0 @@
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;
@@ -1,56 +0,0 @@
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
@@ -1 +0,0 @@
1
- {}
@@ -1,70 +0,0 @@
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
- };
@@ -1,52 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- {"TextareaInput":"_TextareaInput_1wnu9_1","TextareaInput--monospaced":"_TextareaInput--monospaced_1wnu9_30","TextareaInput--disabled":"_TextareaInput--disabled_1wnu9_35","TextareaInput--error":"_TextareaInput--error_1wnu9_41"}