krl-alfred 1.76.2 → 1.76.4
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.
|
@@ -59,7 +59,15 @@ var AutocompleteInput = function (props) {
|
|
|
59
59
|
setInputValue({ value: value, label: label });
|
|
60
60
|
setShowDropdown(false);
|
|
61
61
|
};
|
|
62
|
-
|
|
62
|
+
var handleChange = function (e) {
|
|
63
|
+
var _a, _b, _c;
|
|
64
|
+
var value = inputValue;
|
|
65
|
+
if (((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.value.indexOf("{")) <= -1) {
|
|
66
|
+
value = { value: (_b = e === null || e === void 0 ? void 0 : e.target) === null || _b === void 0 ? void 0 : _b.value, label: (_c = e === null || e === void 0 ? void 0 : e.target) === null || _c === void 0 ? void 0 : _c.value };
|
|
67
|
+
}
|
|
68
|
+
onChange(__assign(__assign({}, e), { target: __assign(__assign({}, e.target), { value: value }) }));
|
|
69
|
+
};
|
|
70
|
+
return ((0, jsx_runtime_1.jsxs)(AutocompleteInput_styled_1.Container, __assign({ width: width, ref: containerRef }, { children: [label && ((0, jsx_runtime_1.jsxs)("div", __assign({ className: (0, classnames_1.default)("top caption-bold-12-15", (_a = {}, _a["justify-between"] = customLinkText, _a)) }, { children: [(0, jsx_runtime_1.jsx)("p", { children: label }), customLinkText && (0, jsx_runtime_1.jsx)(TextLink_1.default, __assign({}, (customLinkHref && { href: customLinkHref }), { onClick: onCustomLinkClick }, { children: customLinkText }))] }))), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "input" }, { children: [(0, jsx_runtime_1.jsx)(AutocompleteInput_styled_1.InputStyled, { ref: inputRef, placeholder: placeholder, autofocus: autofocus, readonly: readonly, type: "text", disabled: disabled, hasError: hasError, isShowDropdown: showDropdown, onKeyUp: onKeyUp, onBlur: onBlur, onFocus: onFocus }), (0, jsx_runtime_1.jsx)("input", { ref: realInputRef, type: "text", name: name, onChange: handleChange, className: "hiddenInput" }), hasLoading && (0, jsx_runtime_1.jsx)("div", __assign({ className: "inputIcon" }, { children: (0, jsx_runtime_1.jsx)(Loader_1.default, { variant: "primary", width: "16px", height: "16px" }) })), hasClear && ((0, jsx_runtime_1.jsx)("div", __assign({ className: "inputIcon", onClick: handleClear }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "Close", width: "16px", height: "16px" }) }))), showDropdown && ((0, jsx_runtime_1.jsx)(AutocompleteInput_styled_1.DropdownStyled, __assign({ dropdownMaxHeight: dropdownMaxHeight }, { children: dropdownList.length > 0 ? (dropdownList.map(function (item, key) {
|
|
63
71
|
return (0, jsx_runtime_1.jsx)("li", __assign({ className: (0, classnames_1.default)({ "isFixedBottom": item.isFixedBottom }), onClick: function () { return handleSelectValue(item.value, item.label); } }, { children: item.label }));
|
|
64
72
|
})) : (0, jsx_runtime_1.jsx)("li", __assign({ className: "isFixedBottom hasNoResult" }, { children: noResultTemplate() })) })))] })), hasError && ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "error" }, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { name: "ErrorIcon" }), (0, jsx_runtime_1.jsx)("p", __assign({ className: "caption-semi-bold-11-13" }, { children: errorMessage }))] })))] })));
|
|
65
73
|
};
|
|
@@ -38,12 +38,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
+
var react_1 = require("react");
|
|
41
42
|
var SelectBox_styled_1 = require("./SelectBox.styled");
|
|
42
43
|
var classnames_1 = __importDefault(require("classnames"));
|
|
43
44
|
var react_select_1 = __importStar(require("react-select"));
|
|
44
45
|
var Icon_1 = __importDefault(require("../Icon/Icon"));
|
|
45
46
|
var async_1 = __importDefault(require("react-select/async"));
|
|
46
|
-
var SelectBox = function (props) {
|
|
47
|
+
var SelectBox = (0, react_1.forwardRef)(function (props, ref) {
|
|
47
48
|
var _a, _b, _c, _d;
|
|
48
49
|
var hasShowDropdownIcon = props.hasShowDropdownIcon, isAsync = props.isAsync, maxOptionListHeight = props.maxOptionListHeight, options = props.options, name = props.name, placeholder = props.placeholder, onChange = props.onChange, isSearchable = props.isSearchable, hasShowSearchIcon = props.hasShowSearchIcon, menuIsOpen = props.menuIsOpen, filterOption = props.filterOption, instanceId = props.instanceId, lightBg = props.lightBg, hasError = props.hasError, errorMessage = props.errorMessage, autoComplete = props.autoComplete;
|
|
49
50
|
var formatOptionLabel = function (_a) {
|
|
@@ -51,21 +52,7 @@ var SelectBox = function (props) {
|
|
|
51
52
|
var innerProps = _a.innerProps, isDisabled = _a.isDisabled, data = _a.data;
|
|
52
53
|
return ((0, jsx_runtime_1.jsx)("div", __assign({}, innerProps, { className: (0, classnames_1.default)("option", (_b = {}, _b["optionSm"] = !data.labelBottom, _b), (_c = {}, _c["fixedBottom"] = data.isFixedBottom, _c), (_d = {}, _d["secondary"] = data.isSecondary, _d)) }, { children: (0, jsx_runtime_1.jsxs)("div", { children: [data.label && (0, jsx_runtime_1.jsx)("strong", __assign({ className: "title-bold-16-19" }, { children: data.label })), data.labelBottom && (0, jsx_runtime_1.jsx)("span", __assign({ className: "body-medium-13-16" }, { children: data.labelBottom }))] }) })));
|
|
53
54
|
};
|
|
54
|
-
var Input = function (props) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return ((0, jsx_runtime_1.jsxs)(SelectBox_styled_1.Container, __assign({ width: props.width, hasError: hasError, maxOptionListHeight: maxOptionListHeight, hasShowDropdownIcon: hasShowDropdownIcon }, { children: [(props === null || props === void 0 ? void 0 : props.label) && ((0, jsx_runtime_1.jsx)("div", __assign({ className: (0, classnames_1.default)("top caption-bold-12-15") }, { children: (0, jsx_runtime_1.jsx)("p", { children: props === null || props === void 0 ? void 0 : props.label }) }))), (0, jsx_runtime_1.jsx)("div", __assign({ className: "select" }, { children: isAsync ? ((0, jsx_runtime_1.jsx)(async_1.default, __assign({ components: { Option: formatOptionLabel, Input: Input }, options: options, instanceId: instanceId, filterOption: filterOption, isSearchable: isSearchable, name: name, menuIsOpen: menuIsOpen, onChange: onChange, classNamePrefix: "customSelect", className: (0, classnames_1.default)("customSelect", (_a = {}, _a['isSearchable'] = isSearchable && hasShowSearchIcon, _a), (_b = {}, _b['lightBg'] = lightBg, _b)), placeholder: placeholder, noOptionsMessage: function () { return 'Sonuç bulunamadı'; } }, props))) : ((0, jsx_runtime_1.jsx)(react_select_1.default, __assign({ components: { Option: formatOptionLabel, Input: Input }, options: options, instanceId: instanceId, filterOption: filterOption, isSearchable: isSearchable, name: name, menuIsOpen: menuIsOpen, onChange: onChange, classNamePrefix: "customSelect", className: (0, classnames_1.default)("customSelect", (_c = {}, _c['isSearchable'] = isSearchable && hasShowSearchIcon, _c), (_d = {}, _d['lightBg'] = lightBg, _d)), placeholder: placeholder, noOptionsMessage: function () { return 'Sonuç bulunamadı'; } }, props))) })), hasError && (0, jsx_runtime_1.jsxs)("div", __assign({ className: "error" }, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { name: "ErrorIcon" }), (0, jsx_runtime_1.jsx)("p", __assign({ className: "caption-semi-bold-11-13" }, { children: errorMessage }))] }))] })));
|
|
58
|
-
};
|
|
59
|
-
SelectBox.defaultValues = {
|
|
60
|
-
hasError: false,
|
|
61
|
-
lightBg: true,
|
|
62
|
-
label: "Label",
|
|
63
|
-
width: "370px",
|
|
64
|
-
placeholder: "İstediğiniz tarihi seçin...",
|
|
65
|
-
maxOptionListHeight: "200px",
|
|
66
|
-
isAsync: false,
|
|
67
|
-
hasShowDropdownIcon: true,
|
|
68
|
-
hasShowSearchIcon: true,
|
|
69
|
-
autoComplete: "on",
|
|
70
|
-
};
|
|
55
|
+
var Input = function (props) { return (0, jsx_runtime_1.jsx)(react_select_1.components.Input, __assign({}, props, { autoComplete: autoComplete })); };
|
|
56
|
+
return ((0, jsx_runtime_1.jsxs)(SelectBox_styled_1.Container, __assign({ width: props.width, hasError: hasError, maxOptionListHeight: maxOptionListHeight, hasShowDropdownIcon: hasShowDropdownIcon }, { children: [(props === null || props === void 0 ? void 0 : props.label) && ((0, jsx_runtime_1.jsx)("div", __assign({ className: (0, classnames_1.default)("top caption-bold-12-15") }, { children: (0, jsx_runtime_1.jsx)("p", { children: props === null || props === void 0 ? void 0 : props.label }) }))), (0, jsx_runtime_1.jsx)("div", __assign({ className: "select" }, { children: isAsync ? ((0, jsx_runtime_1.jsx)(async_1.default, __assign({ components: { Option: formatOptionLabel, Input: Input }, options: options, instanceId: instanceId, filterOption: filterOption, isSearchable: isSearchable, name: name, menuIsOpen: menuIsOpen, onChange: onChange, classNamePrefix: "customSelect", className: (0, classnames_1.default)("customSelect", (_a = {}, _a['isSearchable'] = isSearchable && hasShowSearchIcon, _a), (_b = {}, _b['lightBg'] = lightBg, _b)), placeholder: placeholder, noOptionsMessage: function () { return 'Sonuç bulunamadı'; } }, props, { ref: ref }))) : ((0, jsx_runtime_1.jsx)(react_select_1.default, __assign({ components: { Option: formatOptionLabel, Input: Input }, options: options, instanceId: instanceId, filterOption: filterOption, isSearchable: isSearchable, name: name, menuIsOpen: menuIsOpen, onChange: onChange, classNamePrefix: "customSelect", className: (0, classnames_1.default)("customSelect", (_c = {}, _c['isSearchable'] = isSearchable && hasShowSearchIcon, _c), (_d = {}, _d['lightBg'] = lightBg, _d)), placeholder: placeholder, noOptionsMessage: function () { return 'Sonuç bulunamadı'; } }, props, { ref: ref }))) })), hasError && (0, jsx_runtime_1.jsxs)("div", __assign({ className: "error" }, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { name: "ErrorIcon" }), (0, jsx_runtime_1.jsx)("p", __assign({ className: "caption-semi-bold-11-13" }, { children: errorMessage }))] }))] })));
|
|
57
|
+
});
|
|
71
58
|
exports.default = SelectBox;
|
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var SelectBoxDefault = {
|
|
4
|
+
hasError: false,
|
|
5
|
+
lightBg: true,
|
|
6
|
+
label: "Label",
|
|
7
|
+
width: "370px",
|
|
8
|
+
placeholder: "İstediğiniz tarihi seçin...",
|
|
9
|
+
maxOptionListHeight: "200px",
|
|
10
|
+
isAsync: false,
|
|
11
|
+
hasShowDropdownIcon: true,
|
|
12
|
+
hasShowSearchIcon: true,
|
|
13
|
+
autoComplete: "on",
|
|
14
|
+
};
|