krl-alfred 2.17.53 → 2.17.54

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.
@@ -110,7 +110,7 @@ var SelectBox = (0, react_1.forwardRef)(function (_a, ref) {
110
110
  // Add +N indicator if there are additional selections
111
111
  var additionalCount = selectedValues.length - 1;
112
112
  var additionalText = additionalCount > 0 ? " (+".concat(additionalCount, ")") : '';
113
- return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "customSelect__multi-value" }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "customSelect__multi-value__label" }, { children: [(0, jsx_runtime_1.jsx)("span", { children: firstLabel }), (0, jsx_runtime_1.jsx)("span", { children: additionalText })] })), (0, jsx_runtime_1.jsx)("div", __assign({ className: "customSelect__multi-value__remove", onClick: function (e) {
113
+ return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "customSelect__multi-value" }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "customSelect__multi-value__label" }, { children: [(0, jsx_runtime_1.jsx)("span", { children: firstLabel }), additionalText && (0, jsx_runtime_1.jsx)("span", { children: additionalText })] })), (0, jsx_runtime_1.jsx)("div", __assign({ className: "customSelect__multi-value__remove", onClick: function (e) {
114
114
  e.stopPropagation();
115
115
  // Use onChange to clear all selections
116
116
  if (selectProps.onChange) {
@@ -122,6 +122,30 @@ var SelectBox = (0, react_1.forwardRef)(function (_a, ref) {
122
122
  var ValueContainer = function (props) {
123
123
  return ((0, jsx_runtime_1.jsx)(react_select_1.components.ValueContainer, __assign({}, props, { children: props.children })));
124
124
  };
125
+ // Helper function to extract string label from option for search/filtering
126
+ var getOptionLabel = function (option) {
127
+ var _a, _b, _c, _d, _e;
128
+ if (!option)
129
+ return '';
130
+ // If label is a React component, try to extract text or use a fallback
131
+ if (react_1.default.isValidElement(option.label)) {
132
+ // For React components, try to get text content or use value as fallback
133
+ return ((_a = option.value) === null || _a === void 0 ? void 0 : _a.toString()) || '';
134
+ }
135
+ if (react_1.default.isValidElement(option.optionLabel)) {
136
+ return ((_b = option.value) === null || _b === void 0 ? void 0 : _b.toString()) || '';
137
+ }
138
+ // Return string label or optionLabel
139
+ return ((_c = option.optionLabel) === null || _c === void 0 ? void 0 : _c.toString()) || ((_d = option.label) === null || _d === void 0 ? void 0 : _d.toString()) || ((_e = option.value) === null || _e === void 0 ? void 0 : _e.toString()) || '';
140
+ };
141
+ // Wrapper for filterOption to handle React component labels
142
+ var wrappedFilterOption = filterOption ? function (option, inputValue) {
143
+ // Create a normalized option with string labels for filtering
144
+ var normalizedOption = __assign(__assign({}, option), { label: getOptionLabel(option), optionLabel: typeof option.optionLabel === 'string' ? option.optionLabel : getOptionLabel(option) });
145
+ return filterOption(normalizedOption, inputValue);
146
+ } : undefined;
147
+ // Remove filterOption from other to avoid duplicate props
148
+ var _5 = other, _ = _5.filterOption, restOther = __rest(_5, ["filterOption"]);
125
149
  return ((0, jsx_runtime_1.jsxs)(SelectBox_styled_1.Container, __assign({ "$width": width, "$hasError": hasError, "$maxOptionListHeight": maxOptionListHeight, "$hasShowDropdownIcon": hasShowDropdownIcon, "$MenuPlacement": menuPlacement, "$size": size, "$isMulti": isMulti, "$menuPosition": menuPosition }, { children: [label && ((0, jsx_runtime_1.jsx)("div", __assign({ className: "top" }, { children: (0, jsx_runtime_1.jsx)("label", __assign({ htmlFor: id }, { children: label })) }))), (0, jsx_runtime_1.jsx)("div", __assign({ className: "select" }, { children: isAsync ? ((0, jsx_runtime_1.jsx)(async_1.default, __assign({ components: {
126
150
  Option: CustomOption,
127
151
  Input: Input,
@@ -129,13 +153,13 @@ var SelectBox = (0, react_1.forwardRef)(function (_a, ref) {
129
153
  MenuList: MenuList,
130
154
  LoadingIndicator: LoadingIndicator,
131
155
  MultiValue: MultiValue
132
- }, options: options || [], instanceId: instanceId, filterOption: filterOption, isSearchable: isSearchable, name: name, menuIsOpen: menuIsOpen, onChange: onChange, classNamePrefix: "customSelect", className: (0, classnames_1.default)("customSelect", (_b = {}, _b['isSearchable'] = isSearchable && hasShowSearchIcon, _b), (_c = {}, _c['lightBg'] = lightBg, _c)), placeholder: placeholder, noOptionsMessage: function () { return 'Sonuç bulunamadı'; }, loadingMessage: function () { return 'Sonuç bulunamadı'; }, captureMenuScroll: false, isClearable: isClearable, defaultValue: defaultValue, isMulti: isMulti, closeMenuOnSelect: !isMulti }, other, { ref: ref, id: id }))) : ((0, jsx_runtime_1.jsx)(react_select_1.default, __assign({ components: {
156
+ }, options: options || [], instanceId: instanceId, getOptionLabel: getOptionLabel, filterOption: wrappedFilterOption, isSearchable: isSearchable, name: name, menuIsOpen: menuIsOpen, onChange: onChange, classNamePrefix: "customSelect", className: (0, classnames_1.default)("customSelect", (_b = {}, _b['isSearchable'] = isSearchable && hasShowSearchIcon, _b), (_c = {}, _c['lightBg'] = lightBg, _c)), placeholder: placeholder, noOptionsMessage: function () { return 'Sonuç bulunamadı'; }, loadingMessage: function () { return 'Sonuç bulunamadı'; }, captureMenuScroll: false, isClearable: isClearable, defaultValue: defaultValue, isMulti: isMulti, closeMenuOnSelect: !isMulti }, restOther, { ref: ref, id: id }))) : ((0, jsx_runtime_1.jsx)(react_select_1.default, __assign({ components: {
133
157
  Option: CustomOption,
134
158
  Input: Input,
135
159
  DropdownIndicator: DropdownIndicator,
136
160
  MenuList: MenuList,
137
161
  LoadingIndicator: LoadingIndicator,
138
162
  MultiValue: MultiValue
139
- }, options: options || [], instanceId: instanceId, filterOption: filterOption, isSearchable: isSearchable, name: name, menuIsOpen: menuIsOpen, onChange: onChange, classNamePrefix: "customSelect", className: (0, classnames_1.default)("customSelect", (_d = {}, _d['isSearchable'] = isSearchable && hasShowSearchIcon, _d), (_e = {}, _e['lightBg'] = lightBg, _e)), placeholder: placeholder, noOptionsMessage: function () { return 'Sonuç bulunamadı'; }, captureMenuScroll: false, isClearable: isClearable, defaultValue: defaultValue, isMulti: isMulti, closeMenuOnSelect: !isMulti, hideSelectedOptions: false }, other, { ref: ref, id: id }))) })), hasError && ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "error" }, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { name: "SwitchPassive" }), (0, jsx_runtime_1.jsx)("p", { children: errorMessage })] })))] })));
163
+ }, options: options || [], instanceId: instanceId, getOptionLabel: getOptionLabel, filterOption: wrappedFilterOption, isSearchable: isSearchable, name: name, menuIsOpen: menuIsOpen, onChange: onChange, classNamePrefix: "customSelect", className: (0, classnames_1.default)("customSelect", (_d = {}, _d['isSearchable'] = isSearchable && hasShowSearchIcon, _d), (_e = {}, _e['lightBg'] = lightBg, _e)), placeholder: placeholder, noOptionsMessage: function () { return 'Sonuç bulunamadı'; }, captureMenuScroll: false, isClearable: isClearable, defaultValue: defaultValue, isMulti: isMulti, closeMenuOnSelect: !isMulti, hideSelectedOptions: false }, restOther, { ref: ref, id: id }))) })), hasError && ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "error" }, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { name: "SwitchPassive" }), (0, jsx_runtime_1.jsx)("p", { children: errorMessage })] })))] })));
140
164
  });
141
165
  exports.default = SelectBox;
@@ -1,5 +1,21 @@
1
+ import React from "react";
1
2
  export declare const sizes: string[];
2
3
  type SIZES = typeof sizes[number];
4
+ export interface SelectBoxOption {
5
+ label?: string | React.ReactNode;
6
+ value?: any;
7
+ optionLabel?: string | React.ReactNode;
8
+ labelBottom?: string | React.ReactNode;
9
+ price?: string;
10
+ priceSm?: string;
11
+ period?: string;
12
+ isCustom?: boolean;
13
+ customContent?: React.ReactNode;
14
+ isFixedBottom?: boolean;
15
+ isDisabled?: boolean;
16
+ isHideSelected?: boolean;
17
+ [key: string]: any;
18
+ }
3
19
  export interface SelectBox {
4
20
  size?: SIZES;
5
21
  isSearchable?: boolean;
@@ -9,10 +25,10 @@ export interface SelectBox {
9
25
  name?: string;
10
26
  placeholder?: string;
11
27
  instanceId?: string;
12
- options?: object[];
28
+ options?: SelectBoxOption[];
13
29
  lightBg?: boolean;
14
30
  onChange?(): void;
15
- filterOption?(): any;
31
+ filterOption?(option: SelectBoxOption, inputValue: string): boolean;
16
32
  hasError?: boolean;
17
33
  isClearable?: boolean;
18
34
  errorMessage?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "krl-alfred",
3
- "version": "2.17.53",
3
+ "version": "2.17.54",
4
4
  "files": [
5
5
  "dist"
6
6
  ],