blixify-ui-web 0.1.6
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/README.md +1 -0
- package/lib/components/action/button/index.d.ts +16 -0
- package/lib/components/action/button/index.d.ts.map +1 -0
- package/lib/components/action/button/index.js +90 -0
- package/lib/components/action/button/index.js.map +1 -0
- package/lib/components/action/buttonGroup/index.d.ts +17 -0
- package/lib/components/action/buttonGroup/index.d.ts.map +1 -0
- package/lib/components/action/buttonGroup/index.js +74 -0
- package/lib/components/action/buttonGroup/index.js.map +1 -0
- package/lib/components/action/iconButton/index.d.ts +14 -0
- package/lib/components/action/iconButton/index.d.ts.map +1 -0
- package/lib/components/action/iconButton/index.js +71 -0
- package/lib/components/action/iconButton/index.js.map +1 -0
- package/lib/components/action/textButton/index.d.ts +13 -0
- package/lib/components/action/textButton/index.d.ts.map +1 -0
- package/lib/components/action/textButton/index.js +62 -0
- package/lib/components/action/textButton/index.js.map +1 -0
- package/lib/components/action/toggle/index.d.ts +17 -0
- package/lib/components/action/toggle/index.d.ts.map +1 -0
- package/lib/components/action/toggle/index.js +91 -0
- package/lib/components/action/toggle/index.js.map +1 -0
- package/lib/components/data/readQuery/index.d.ts +46 -0
- package/lib/components/data/readQuery/index.d.ts.map +1 -0
- package/lib/components/data/readQuery/index.js +210 -0
- package/lib/components/data/readQuery/index.js.map +1 -0
- package/lib/components/data/readQueryHoc/index.d.ts +24 -0
- package/lib/components/data/readQueryHoc/index.d.ts.map +1 -0
- package/lib/components/data/readQueryHoc/index.js +255 -0
- package/lib/components/data/readQueryHoc/index.js.map +1 -0
- package/lib/components/data/writeQuery/index.d.ts +14 -0
- package/lib/components/data/writeQuery/index.d.ts.map +1 -0
- package/lib/components/data/writeQuery/index.js +120 -0
- package/lib/components/data/writeQuery/index.js.map +1 -0
- package/lib/components/display/detailList/index.d.ts +17 -0
- package/lib/components/display/detailList/index.d.ts.map +1 -0
- package/lib/components/display/detailList/index.js +68 -0
- package/lib/components/display/detailList/index.js.map +1 -0
- package/lib/components/display/feeds/index.d.ts +19 -0
- package/lib/components/display/feeds/index.d.ts.map +1 -0
- package/lib/components/display/feeds/index.js +79 -0
- package/lib/components/display/feeds/index.js.map +1 -0
- package/lib/components/display/grid/index.d.ts +33 -0
- package/lib/components/display/grid/index.d.ts.map +1 -0
- package/lib/components/display/grid/index.js +180 -0
- package/lib/components/display/grid/index.js.map +1 -0
- package/lib/components/display/list/index.d.ts +30 -0
- package/lib/components/display/list/index.d.ts.map +1 -0
- package/lib/components/display/list/index.js +160 -0
- package/lib/components/display/list/index.js.map +1 -0
- package/lib/components/display/loading/index.d.ts +6 -0
- package/lib/components/display/loading/index.d.ts.map +1 -0
- package/lib/components/display/loading/index.js +55 -0
- package/lib/components/display/loading/index.js.map +1 -0
- package/lib/components/display/modal/index.d.ts +16 -0
- package/lib/components/display/modal/index.d.ts.map +1 -0
- package/lib/components/display/modal/index.js +67 -0
- package/lib/components/display/modal/index.js.map +1 -0
- package/lib/components/display/notification/index.d.ts +20 -0
- package/lib/components/display/notification/index.d.ts.map +1 -0
- package/lib/components/display/notification/index.js +69 -0
- package/lib/components/display/notification/index.js.map +1 -0
- package/lib/components/display/table/index.d.ts +32 -0
- package/lib/components/display/table/index.d.ts.map +1 -0
- package/lib/components/display/table/index.js +202 -0
- package/lib/components/display/table/index.js.map +1 -0
- package/lib/components/index.d.ts +30 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +62 -0
- package/lib/components/index.js.map +1 -0
- package/lib/components/input/address/index.d.ts +41 -0
- package/lib/components/input/address/index.d.ts.map +1 -0
- package/lib/components/input/address/index.js +162 -0
- package/lib/components/input/address/index.js.map +1 -0
- package/lib/components/input/datePicker/index.d.ts +26 -0
- package/lib/components/input/datePicker/index.d.ts.map +1 -0
- package/lib/components/input/datePicker/index.js +132 -0
- package/lib/components/input/datePicker/index.js.map +1 -0
- package/lib/components/input/form/index.d.ts +14 -0
- package/lib/components/input/form/index.d.ts.map +1 -0
- package/lib/components/input/form/index.js +77 -0
- package/lib/components/input/form/index.js.map +1 -0
- package/lib/components/input/select/index.d.ts +40 -0
- package/lib/components/input/select/index.d.ts.map +1 -0
- package/lib/components/input/select/index.js +269 -0
- package/lib/components/input/select/index.js.map +1 -0
- package/lib/components/input/textArea/index.d.ts +23 -0
- package/lib/components/input/textArea/index.d.ts.map +1 -0
- package/lib/components/input/textArea/index.js +95 -0
- package/lib/components/input/textArea/index.js.map +1 -0
- package/lib/components/input/textInput/index.d.ts +25 -0
- package/lib/components/input/textInput/index.d.ts.map +1 -0
- package/lib/components/input/textInput/index.js +121 -0
- package/lib/components/input/textInput/index.js.map +1 -0
- package/lib/components/input/uploadInput/index.d.ts +23 -0
- package/lib/components/input/uploadInput/index.d.ts.map +1 -0
- package/lib/components/input/uploadInput/index.js +103 -0
- package/lib/components/input/uploadInput/index.js.map +1 -0
- package/lib/components/navigation/bars/index.d.ts +17 -0
- package/lib/components/navigation/bars/index.d.ts.map +1 -0
- package/lib/components/navigation/bars/index.js +73 -0
- package/lib/components/navigation/bars/index.js.map +1 -0
- package/lib/components/navigation/header/index.d.ts +35 -0
- package/lib/components/navigation/header/index.d.ts.map +1 -0
- package/lib/components/navigation/header/index.js +167 -0
- package/lib/components/navigation/header/index.js.map +1 -0
- package/lib/components/navigation/tabs/index.d.ts +16 -0
- package/lib/components/navigation/tabs/index.d.ts.map +1 -0
- package/lib/components/navigation/tabs/index.js +70 -0
- package/lib/components/navigation/tabs/index.js.map +1 -0
- package/lib/components/structure/column/index.d.ts +13 -0
- package/lib/components/structure/column/index.d.ts.map +1 -0
- package/lib/components/structure/column/index.js +89 -0
- package/lib/components/structure/column/index.js.map +1 -0
- package/lib/components/structure/container/index.d.ts +11 -0
- package/lib/components/structure/container/index.d.ts.map +1 -0
- package/lib/components/structure/container/index.js +57 -0
- package/lib/components/structure/container/index.js.map +1 -0
- package/lib/components/structure/text/index.d.ts +16 -0
- package/lib/components/structure/text/index.d.ts.map +1 -0
- package/lib/components/structure/text/index.js +153 -0
- package/lib/components/structure/text/index.js.map +1 -0
- package/lib/index.css +105 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/package.json +104 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.InputDatePicker = void 0;
|
|
45
|
+
var date_fns_1 = require("date-fns");
|
|
46
|
+
var moment_1 = __importDefault(require("moment"));
|
|
47
|
+
var react_1 = __importStar(require("react"));
|
|
48
|
+
var react_datepicker_1 = __importDefault(require("react-datepicker"));
|
|
49
|
+
require("../../../index.css");
|
|
50
|
+
var InputDatePicker = /** @class */ (function (_super) {
|
|
51
|
+
__extends(InputDatePicker, _super);
|
|
52
|
+
function InputDatePicker() {
|
|
53
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
54
|
+
_this.state = {
|
|
55
|
+
error: "",
|
|
56
|
+
};
|
|
57
|
+
_this.handleSubmit = function () {
|
|
58
|
+
var testCond = false;
|
|
59
|
+
var error = "Please select a date";
|
|
60
|
+
if (!_this.props.optional) {
|
|
61
|
+
if (_this.props.range) {
|
|
62
|
+
if ((0, moment_1.default)(_this.props.startDate).isAfter((0, moment_1.default)(_this.props.endDate))) {
|
|
63
|
+
error = "Please select a proper date range";
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
testCond = true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
if (_this.props.value instanceof Date) {
|
|
71
|
+
testCond = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
testCond = true;
|
|
77
|
+
}
|
|
78
|
+
if (!testCond) {
|
|
79
|
+
_this.setState({ error: error });
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
_this.setState({ error: "" });
|
|
83
|
+
}
|
|
84
|
+
return testCond;
|
|
85
|
+
};
|
|
86
|
+
_this.handleFilter = function (date) {
|
|
87
|
+
if (_this.props.filterDate) {
|
|
88
|
+
var isDay_1 = false;
|
|
89
|
+
_this.props.filterDate.map(function (eachDay) {
|
|
90
|
+
if ((0, date_fns_1.getDay)(date) === eachDay) {
|
|
91
|
+
isDay_1 = true;
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
});
|
|
95
|
+
return isDay_1;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
_this.renderContent = function () {
|
|
102
|
+
if (_this.props.range) {
|
|
103
|
+
return (react_1.default.createElement("div", { className: "grid grid-cols-2" },
|
|
104
|
+
react_1.default.createElement("div", { className: "mr-2" },
|
|
105
|
+
react_1.default.createElement("div", { className: "font-medium text-sm mb-1" }, "Start Date"),
|
|
106
|
+
react_1.default.createElement(react_datepicker_1.default, { dateFormat: "dd/MM/yy", selected: _this.props.startDate, onChange: function (date) {
|
|
107
|
+
_this.props.onChange(date, "start");
|
|
108
|
+
}, selectsStart: true, minDate: _this.props.minDate, maxDate: _this.props.endDate, startDate: _this.props.startDate, endDate: _this.props.endDate, nextMonthButtonLabel: ">", previousMonthButtonLabel: "<", filterDate: _this.handleFilter })),
|
|
109
|
+
react_1.default.createElement("div", { className: "ml-2" },
|
|
110
|
+
react_1.default.createElement("div", { className: "font-medium text-sm mb-1" }, "End Date"),
|
|
111
|
+
react_1.default.createElement(react_datepicker_1.default, { dateFormat: "dd/MM/yy", selected: _this.props.endDate, onChange: function (date) {
|
|
112
|
+
_this.props.onChange(date, "end");
|
|
113
|
+
}, selectsEnd: true, minDate: _this.props.startDate, maxDate: _this.props.maxDate, startDate: _this.props.startDate, endDate: _this.props.endDate, nextMonthButtonLabel: ">", previousMonthButtonLabel: "<", filterDate: _this.handleFilter }))));
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
return (react_1.default.createElement(react_datepicker_1.default, { dateFormat: "dd/MM/yy", selected: _this.props.value, onChange: function (date) { return _this.props.onChange(date); }, selectsStart: true, minDate: _this.props.minDate, maxDate: _this.props.maxDate, nextMonthButtonLabel: ">", previousMonthButtonLabel: "<", filterDate: _this.handleFilter }));
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
return _this;
|
|
120
|
+
}
|
|
121
|
+
InputDatePicker.prototype.render = function () {
|
|
122
|
+
var _a;
|
|
123
|
+
return (react_1.default.createElement("div", { className: "w-full ".concat(this.props.className) },
|
|
124
|
+
react_1.default.createElement("div", { className: "relative" },
|
|
125
|
+
react_1.default.createElement("label", { className: "block mb-1 text-sm font-medium text-gray-700" }, !this.props.range && ((_a = this.props.title) !== null && _a !== void 0 ? _a : "Select Date")),
|
|
126
|
+
this.renderContent(),
|
|
127
|
+
react_1.default.createElement("span", { className: "text-red-500 text-sm" }, this.state.error))));
|
|
128
|
+
};
|
|
129
|
+
return InputDatePicker;
|
|
130
|
+
}(react_1.Component));
|
|
131
|
+
exports.InputDatePicker = InputDatePicker;
|
|
132
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/input/datePicker/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAkC;AAClC,kDAA4B;AAC5B,6CAAyC;AACzC,sEAA0C;AAC1C,8BAA4B;AAgB5B;IAAqC,mCAAgB;IAArD;QAAA,qEAuHC;QAtHC,WAAK,GAAG;YACN,KAAK,EAAE,EAAE;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|
+
refList: any[];
|
|
6
|
+
className?: string;
|
|
7
|
+
handleComplete?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare class Form extends Component<Props> {
|
|
10
|
+
handleSubmit: () => void;
|
|
11
|
+
render(): JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/input/form/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,oBAAoB,CAAC;AAE5B,UAAU,KAAK;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,qBAAa,IAAK,SAAQ,SAAS,CAAC,KAAK,CAAC;IACxC,YAAY,aAsBV;IAEF,MAAM;CAGP"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.Form = void 0;
|
|
42
|
+
var react_1 = __importStar(require("react"));
|
|
43
|
+
require("../../../index.css");
|
|
44
|
+
var Form = /** @class */ (function (_super) {
|
|
45
|
+
__extends(Form, _super);
|
|
46
|
+
function Form() {
|
|
47
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
48
|
+
_this.handleSubmit = function () {
|
|
49
|
+
var completedCond = true;
|
|
50
|
+
if (_this.props.refList && _this.props.refList.length > 0) {
|
|
51
|
+
if (_this.props.refList.map(function (eachRef) {
|
|
52
|
+
var _a;
|
|
53
|
+
if ((_a = eachRef.current) === null || _a === void 0 ? void 0 : _a.handleSubmit) {
|
|
54
|
+
var condition = eachRef.current.handleSubmit();
|
|
55
|
+
if (!condition) {
|
|
56
|
+
completedCond = false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
})) {
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (completedCond) {
|
|
64
|
+
if (_this.props.handleComplete) {
|
|
65
|
+
_this.props.handleComplete();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return _this;
|
|
70
|
+
}
|
|
71
|
+
Form.prototype.render = function () {
|
|
72
|
+
return react_1.default.createElement("form", { className: this.props.className }, this.props.children);
|
|
73
|
+
};
|
|
74
|
+
return Form;
|
|
75
|
+
}(react_1.Component));
|
|
76
|
+
exports.Form = Form;
|
|
77
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/input/form/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAyC;AACzC,8BAA4B;AAS5B;IAA0B,wBAAgB;IAA1C;QAAA,qEA4BC;QA3BC,kBAAY,GAAG;YACb,IAAI,aAAa,GAAG,IAAI,CAAC;YACzB,IAAI,KAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBACvD,IACE,KAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,OAAO;;oBAC7B,IAAI,MAAA,OAAO,CAAC,OAAO,0CAAE,YAAY,EAAE;wBACjC,IAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;wBACjD,IAAI,CAAC,SAAS,EAAE;4BACd,aAAa,GAAG,KAAK,CAAC;yBACvB;qBACF;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC,CAAC,EACF;iBACD;aACF;YAED,IAAI,aAAa,EAAE;gBACjB,IAAI,KAAI,CAAC,KAAK,CAAC,cAAc,EAAE;oBAC7B,KAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;iBAC7B;aACF;QACH,CAAC,CAAC;;IAKJ,CAAC;IAHC,qBAAM,GAAN;QACE,OAAO,wCAAM,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,IAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAQ,CAAC;IAC7E,CAAC;IACH,WAAC;AAAD,CAAC,AA5BD,CAA0B,iBAAS,GA4BlC;AA5BY,oBAAI"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Component } from "react";
|
|
2
|
+
import "../../../index.css";
|
|
3
|
+
export interface Option {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
interface Props {
|
|
8
|
+
value: string | string[];
|
|
9
|
+
label: string;
|
|
10
|
+
options: Option[];
|
|
11
|
+
id?: string;
|
|
12
|
+
optional?: string;
|
|
13
|
+
containerClassName?: string;
|
|
14
|
+
selectClassName?: string;
|
|
15
|
+
onSearch?: (value: string) => void;
|
|
16
|
+
onChange?: (value: any) => void;
|
|
17
|
+
}
|
|
18
|
+
interface State {
|
|
19
|
+
error: string;
|
|
20
|
+
valuePlaceholder: string;
|
|
21
|
+
onFocus: boolean;
|
|
22
|
+
filterOptions: Option[];
|
|
23
|
+
}
|
|
24
|
+
export declare class Select extends Component<Props> {
|
|
25
|
+
typingTimeout: ReturnType<typeof setTimeout> | null;
|
|
26
|
+
state: State;
|
|
27
|
+
componentDidMount: () => void;
|
|
28
|
+
componentDidUpdate: (prevProps: Props) => Promise<void>;
|
|
29
|
+
handleSubmit: () => boolean;
|
|
30
|
+
handleGetPlaceholder: () => Promise<void>;
|
|
31
|
+
handleGetSuggestions: () => Promise<void>;
|
|
32
|
+
handleOnChange: (e: any) => void;
|
|
33
|
+
handleBlur: () => void;
|
|
34
|
+
handleFocus: () => void;
|
|
35
|
+
handleOnSelectChange: (key: string) => void;
|
|
36
|
+
renderOptions: () => any;
|
|
37
|
+
render(): JSX.Element;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/input/select/index.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,oBAAoB,CAAC;AAE5B,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CACjC;AAED,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,qBAAa,MAAO,SAAQ,SAAS,CAAC,KAAK,CAAC;IAC1C,aAAa,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,IAAI,CAAQ;IAE3D,KAAK,EAAE,KAAK,CAKV;IAEF,iBAAiB,aAGf;IAEF,kBAAkB,cAAqB,KAAK,mBAS1C;IAEF,YAAY,gBAmBV;IAEF,oBAAoB,sBAmBlB;IAEF,oBAAoB,sBAalB;IAEF,cAAc,MAAO,GAAG,UAgBtB;IAEF,UAAU,aAUR;IAEF,WAAW,aAaT;IAEF,oBAAoB,QAAS,MAAM,UAoBjC;IAEF,aAAa,YA6BX;IAEF,MAAM;CAwCP"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
50
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
51
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
52
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
53
|
+
function step(op) {
|
|
54
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
55
|
+
while (_) try {
|
|
56
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
57
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
58
|
+
switch (op[0]) {
|
|
59
|
+
case 0: case 1: t = op; break;
|
|
60
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
61
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
62
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
63
|
+
default:
|
|
64
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
65
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
66
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
67
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
68
|
+
if (t[2]) _.ops.pop();
|
|
69
|
+
_.trys.pop(); continue;
|
|
70
|
+
}
|
|
71
|
+
op = body.call(thisArg, _);
|
|
72
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
73
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
|
+
exports.Select = void 0;
|
|
78
|
+
var outline_1 = require("@heroicons/react/24/outline");
|
|
79
|
+
var react_1 = __importStar(require("react"));
|
|
80
|
+
require("../../../index.css");
|
|
81
|
+
var Select = /** @class */ (function (_super) {
|
|
82
|
+
__extends(Select, _super);
|
|
83
|
+
function Select() {
|
|
84
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
85
|
+
_this.typingTimeout = null;
|
|
86
|
+
_this.state = {
|
|
87
|
+
error: "",
|
|
88
|
+
valuePlaceholder: "",
|
|
89
|
+
onFocus: false,
|
|
90
|
+
filterOptions: [],
|
|
91
|
+
};
|
|
92
|
+
_this.componentDidMount = function () {
|
|
93
|
+
_this.handleGetSuggestions();
|
|
94
|
+
_this.handleGetPlaceholder();
|
|
95
|
+
};
|
|
96
|
+
_this.componentDidUpdate = function (prevProps) { return __awaiter(_this, void 0, void 0, function () {
|
|
97
|
+
return __generator(this, function (_a) {
|
|
98
|
+
if (JSON.stringify(this.props.value) !== JSON.stringify(prevProps.value)) {
|
|
99
|
+
this.handleGetPlaceholder();
|
|
100
|
+
}
|
|
101
|
+
if (JSON.stringify(this.props.options) !== JSON.stringify(prevProps.options)) {
|
|
102
|
+
this.handleGetSuggestions();
|
|
103
|
+
}
|
|
104
|
+
return [2 /*return*/];
|
|
105
|
+
});
|
|
106
|
+
}); };
|
|
107
|
+
_this.handleSubmit = function () {
|
|
108
|
+
var testCond = false;
|
|
109
|
+
var error = "Please select an option";
|
|
110
|
+
if (!_this.props.optional) {
|
|
111
|
+
if (Array.isArray(_this.props.value)) {
|
|
112
|
+
testCond = _this.props.value.length > 0 ? true : false;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
testCond = _this.props.value ? true : false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
testCond = true;
|
|
120
|
+
}
|
|
121
|
+
if (!testCond) {
|
|
122
|
+
_this.setState({ error: error });
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
_this.setState({ error: "" });
|
|
126
|
+
}
|
|
127
|
+
return testCond;
|
|
128
|
+
};
|
|
129
|
+
_this.handleGetPlaceholder = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
130
|
+
var valuePlaceholder;
|
|
131
|
+
var _this = this;
|
|
132
|
+
var _a, _b;
|
|
133
|
+
return __generator(this, function (_c) {
|
|
134
|
+
valuePlaceholder = "";
|
|
135
|
+
if (this.props.value && !Array.isArray(this.props.value)) {
|
|
136
|
+
valuePlaceholder =
|
|
137
|
+
(_b = (_a = this.props.options.find(function (eachOption) { return eachOption.key === _this.props.value; })) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : "";
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
valuePlaceholder = this.props.options
|
|
141
|
+
.filter(function (eachOption) {
|
|
142
|
+
return _this.props.value.includes(eachOption.key);
|
|
143
|
+
})
|
|
144
|
+
.map(function (eachOption) {
|
|
145
|
+
return eachOption.label;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
this.setState({
|
|
149
|
+
valuePlaceholder: valuePlaceholder,
|
|
150
|
+
});
|
|
151
|
+
return [2 /*return*/];
|
|
152
|
+
});
|
|
153
|
+
}); };
|
|
154
|
+
_this.handleGetSuggestions = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
155
|
+
var filterOptions;
|
|
156
|
+
var _this = this;
|
|
157
|
+
return __generator(this, function (_a) {
|
|
158
|
+
filterOptions = this.props.options;
|
|
159
|
+
if (this.props.options) {
|
|
160
|
+
filterOptions = this.props.options.filter(function (eachOption) {
|
|
161
|
+
return _this.props.options &&
|
|
162
|
+
eachOption.label.includes(_this.state.valuePlaceholder);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
this.setState({
|
|
166
|
+
filterOptions: filterOptions,
|
|
167
|
+
});
|
|
168
|
+
return [2 /*return*/];
|
|
169
|
+
});
|
|
170
|
+
}); };
|
|
171
|
+
_this.handleOnChange = function (e) {
|
|
172
|
+
_this.setState({
|
|
173
|
+
valuePlaceholder: e.target.value,
|
|
174
|
+
});
|
|
175
|
+
if (_this.typingTimeout) {
|
|
176
|
+
clearTimeout(_this.typingTimeout);
|
|
177
|
+
_this.typingTimeout = null;
|
|
178
|
+
}
|
|
179
|
+
_this.typingTimeout = setTimeout(function () {
|
|
180
|
+
_this.handleGetSuggestions();
|
|
181
|
+
if (_this.props.onSearch) {
|
|
182
|
+
_this.props.onSearch(_this.state.valuePlaceholder);
|
|
183
|
+
}
|
|
184
|
+
}, 250);
|
|
185
|
+
};
|
|
186
|
+
_this.handleBlur = function () {
|
|
187
|
+
_this.setState({
|
|
188
|
+
onFocus: false,
|
|
189
|
+
valuePlaceholder: "",
|
|
190
|
+
}, function () {
|
|
191
|
+
_this.handleGetPlaceholder();
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
_this.handleFocus = function () {
|
|
195
|
+
_this.setState({
|
|
196
|
+
onFocus: true,
|
|
197
|
+
valuePlaceholder: "",
|
|
198
|
+
}, function () {
|
|
199
|
+
_this.handleGetSuggestions();
|
|
200
|
+
if (_this.props.onSearch) {
|
|
201
|
+
_this.props.onSearch("");
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
_this.handleOnSelectChange = function (key) {
|
|
206
|
+
var _a, _b;
|
|
207
|
+
if (_this.props.value && Array.isArray(_this.props.value)) {
|
|
208
|
+
var selectedValue = (_a = _this.props.value) !== null && _a !== void 0 ? _a : [];
|
|
209
|
+
var newSelectedList = (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.length) > 0 ? _this.props.value : [];
|
|
210
|
+
if ((_b = _this.props.value) === null || _b === void 0 ? void 0 : _b.includes(key)) {
|
|
211
|
+
newSelectedList.splice(newSelectedList.indexOf(key), 1);
|
|
212
|
+
if (_this.props.onChange) {
|
|
213
|
+
_this.props.onChange(newSelectedList);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
newSelectedList === null || newSelectedList === void 0 ? void 0 : newSelectedList.push(key);
|
|
218
|
+
if (_this.props.onChange) {
|
|
219
|
+
_this.props.onChange(newSelectedList);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
if (_this.props.onChange) {
|
|
225
|
+
_this.props.onChange(key === _this.props.value ? "" : key);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
_this.renderOptions = function () {
|
|
230
|
+
var optionView = [];
|
|
231
|
+
_this.state.filterOptions.map(function (eachOption) {
|
|
232
|
+
var isSelected = false;
|
|
233
|
+
if (Array.isArray(_this.props.value)) {
|
|
234
|
+
isSelected = _this.props.value.includes(eachOption.key);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
isSelected = _this.props.value === eachOption.key;
|
|
238
|
+
}
|
|
239
|
+
optionView.push(react_1.default.createElement("li", { key: eachOption.key, className: "text-gray-900 cursor-default select-none relative px-5 py-3 hover:bg-primary-300 group", onMouseDown: _this.handleOnSelectChange.bind(_this, eachOption.key) },
|
|
240
|
+
react_1.default.createElement("span", { className: "font-normal block truncate group-hover:text-white" }, eachOption.label),
|
|
241
|
+
isSelected && (react_1.default.createElement("span", { className: "text-primary-600 absolute inset-y-0 right-0 flex items-center pr-4 group-hover:text-white" },
|
|
242
|
+
react_1.default.createElement(outline_1.CheckIcon, { className: "h-5 w-5" })))));
|
|
243
|
+
return null;
|
|
244
|
+
});
|
|
245
|
+
return optionView;
|
|
246
|
+
};
|
|
247
|
+
return _this;
|
|
248
|
+
}
|
|
249
|
+
Select.prototype.render = function () {
|
|
250
|
+
var defaultClassName = "block w-full border border-gray-300 rounded-md mt-1 px-5 py-3 text-base text-gray-900 placeholder-gray-300 focus:border-primary-500 focus:outline-none";
|
|
251
|
+
if (this.state.error) {
|
|
252
|
+
defaultClassName += " mb-0.5 border-red-300";
|
|
253
|
+
}
|
|
254
|
+
if (this.props.selectClassName) {
|
|
255
|
+
defaultClassName += " ".concat(this.props.selectClassName);
|
|
256
|
+
}
|
|
257
|
+
return (react_1.default.createElement("div", { className: "w-full ".concat(this.props.containerClassName) },
|
|
258
|
+
react_1.default.createElement("div", { className: "relative" },
|
|
259
|
+
react_1.default.createElement("div", { className: "flex justify-between" },
|
|
260
|
+
react_1.default.createElement("label", { className: "block text-sm font-medium text-gray-700" }, this.props.label)),
|
|
261
|
+
react_1.default.createElement("div", null,
|
|
262
|
+
react_1.default.createElement("input", { id: this.props.id, className: defaultClassName, value: this.state.valuePlaceholder, placeholder: "Select An Option", onFocus: this.handleFocus, onBlur: this.handleBlur, onChange: this.handleOnChange }),
|
|
263
|
+
this.state.onFocus && (react_1.default.createElement("ul", { className: "absolute z-10 w-full bg-white shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm" }, this.renderOptions()))),
|
|
264
|
+
react_1.default.createElement("span", { className: "text-red-500 text-sm" }, this.state.error))));
|
|
265
|
+
};
|
|
266
|
+
return Select;
|
|
267
|
+
}(react_1.Component));
|
|
268
|
+
exports.Select = Select;
|
|
269
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/input/select/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwD;AACxD,6CAAyC;AACzC,8BAA4B;AA0B5B;IAA4B,0BAAgB;IAA5C;QAAA,qEA6NC;QA5NC,mBAAa,GAAyC,IAAI,CAAC;QAE3D,WAAK,GAAU;YACb,KAAK,EAAE,EAAE;YACT,gBAAgB,EAAE,EAAE;YACpB,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,EAAE;SAClB,CAAC;QAEF,uBAAiB,GAAG;YAClB,KAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,KAAI,CAAC,oBAAoB,EAAE,CAAC;QAC9B,CAAC,CAAC;QAEF,wBAAkB,GAAG,UAAO,SAAgB;;gBAC1C,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;oBACxE,IAAI,CAAC,oBAAoB,EAAE,CAAC;iBAC7B;gBACD,IACE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,EACxE;oBACA,IAAI,C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K,CAAQ,CAC5D,CACF,CACP,CAAC;IACJ,CAAC;IACH,aAAC;AAAD,CAAC,AA7ND,CAA4B,iBAAS,GA6NpC;AA7NY,wBAAM"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component } from "react";
|
|
2
|
+
import "../../../index.css";
|
|
3
|
+
interface Props {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
placeholder: string;
|
|
7
|
+
rows: number;
|
|
8
|
+
id?: string;
|
|
9
|
+
optional?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
onChange?: (e: any) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare class TextArea extends Component<Props> {
|
|
15
|
+
state: {
|
|
16
|
+
error: string;
|
|
17
|
+
};
|
|
18
|
+
handleOnChange: (e: any) => void;
|
|
19
|
+
handleSubmit: () => boolean;
|
|
20
|
+
render(): JSX.Element;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/input/textArea/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,oBAAoB,CAAC;AAE5B,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAC7B;AAED,qBAAa,QAAS,SAAQ,SAAS,CAAC,KAAK,CAAC;IAC5C,KAAK;;MAEH;IAEF,cAAc,MAAO,GAAG,UAItB;IAEF,YAAY,gBAmBV;IAEF,MAAM;CA8BP"}
|