@react-fabric/searchbar 1.0.0-beta.44 → 1.0.0-beta.46
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/dist/cjs/filterbar/FilterForm.js +14 -0
- package/dist/cjs/filterbar/FilterTag.js +1 -1
- package/dist/esm/filterbar/FilterForm.js +14 -0
- package/dist/esm/filterbar/FilterTag.js +1 -1
- package/package.json +7 -7
- package/src/filterbar/FilterForm.tsx +13 -0
- package/src/filterbar/FilterTag.tsx +4 -1
|
@@ -128,6 +128,7 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
if ((field === null || field === void 0 ? void 0 : field.type) === index.FIELD_TYPE.STRING || (field === null || field === void 0 ? void 0 : field.type) === index.FIELD_TYPE.ID) {
|
|
131
|
+
var _field$values2;
|
|
131
132
|
if ((values === null || values === void 0 ? void 0 : values.operator) === index.OPERATOR.IN) {
|
|
132
133
|
var _field$values;
|
|
133
134
|
return /*#__PURE__*/jsxRuntime.jsx(form.Controller, {
|
|
@@ -142,6 +143,19 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
142
143
|
onQuery: field.onSearch
|
|
143
144
|
})
|
|
144
145
|
});
|
|
146
|
+
} else if (!!field.onSearch || (_field$values2 = field.values) !== null && _field$values2 !== void 0 && _field$values2.length) {
|
|
147
|
+
var _field$values3;
|
|
148
|
+
return /*#__PURE__*/jsxRuntime.jsx(form.Controller, {
|
|
149
|
+
name: "value",
|
|
150
|
+
children: /*#__PURE__*/jsxRuntime.jsx(form.Select, {
|
|
151
|
+
searchable: true,
|
|
152
|
+
allowCreate: true,
|
|
153
|
+
allowClear: true,
|
|
154
|
+
options: (_field$values3 = field.values) !== null && _field$values3 !== void 0 ? _field$values3 : [],
|
|
155
|
+
label: t("label.value"),
|
|
156
|
+
onQuery: field.onSearch
|
|
157
|
+
})
|
|
158
|
+
});
|
|
145
159
|
} else {
|
|
146
160
|
return /*#__PURE__*/jsxRuntime.jsx(form.Controller, {
|
|
147
161
|
name: "value",
|
|
@@ -63,7 +63,7 @@ var FilterTag = function FilterTag(_ref) {
|
|
|
63
63
|
children: [/*#__PURE__*/jsxRuntime.jsx(core.Chip, {
|
|
64
64
|
size: "sm",
|
|
65
65
|
color: color,
|
|
66
|
-
className: "outline
|
|
66
|
+
className: classNames("outline max-w-60", filter.disabled && "opacity-65"),
|
|
67
67
|
variant: filter.pinned ? "solid" : undefined,
|
|
68
68
|
icon: icon,
|
|
69
69
|
iconColor: color,
|
|
@@ -128,6 +128,7 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
if ((field === null || field === void 0 ? void 0 : field.type) === FIELD_TYPE.STRING || (field === null || field === void 0 ? void 0 : field.type) === FIELD_TYPE.ID) {
|
|
131
|
+
var _field$values2;
|
|
131
132
|
if ((values === null || values === void 0 ? void 0 : values.operator) === OPERATOR.IN) {
|
|
132
133
|
var _field$values;
|
|
133
134
|
return /*#__PURE__*/jsx(Controller, {
|
|
@@ -142,6 +143,19 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
142
143
|
onQuery: field.onSearch
|
|
143
144
|
})
|
|
144
145
|
});
|
|
146
|
+
} else if (!!field.onSearch || (_field$values2 = field.values) !== null && _field$values2 !== void 0 && _field$values2.length) {
|
|
147
|
+
var _field$values3;
|
|
148
|
+
return /*#__PURE__*/jsx(Controller, {
|
|
149
|
+
name: "value",
|
|
150
|
+
children: /*#__PURE__*/jsx(Select, {
|
|
151
|
+
searchable: true,
|
|
152
|
+
allowCreate: true,
|
|
153
|
+
allowClear: true,
|
|
154
|
+
options: (_field$values3 = field.values) !== null && _field$values3 !== void 0 ? _field$values3 : [],
|
|
155
|
+
label: t("label.value"),
|
|
156
|
+
onQuery: field.onSearch
|
|
157
|
+
})
|
|
158
|
+
});
|
|
145
159
|
} else {
|
|
146
160
|
return /*#__PURE__*/jsx(Controller, {
|
|
147
161
|
name: "value",
|
|
@@ -63,7 +63,7 @@ var FilterTag = function FilterTag(_ref) {
|
|
|
63
63
|
children: [/*#__PURE__*/jsx(Chip, {
|
|
64
64
|
size: "sm",
|
|
65
65
|
color: color,
|
|
66
|
-
className: "outline
|
|
66
|
+
className: classNames("outline max-w-60", filter.disabled && "opacity-65"),
|
|
67
67
|
variant: filter.pinned ? "solid" : undefined,
|
|
68
68
|
icon: icon,
|
|
69
69
|
iconColor: color,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/searchbar",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.46",
|
|
4
4
|
"description": "RUF: Searchbar with filters package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@floating-ui/react": "^0.26.24",
|
|
37
|
-
"@react-fabric/core": "^1.0.0-beta.
|
|
38
|
-
"@react-fabric/form": "^1.0.0-beta.
|
|
39
|
-
"@react-fabric/monaco": "^1.0.0-beta.
|
|
40
|
-
"@react-fabric/utilities": "^1.0.0-beta.
|
|
37
|
+
"@react-fabric/core": "^1.0.0-beta.46",
|
|
38
|
+
"@react-fabric/form": "^1.0.0-beta.46",
|
|
39
|
+
"@react-fabric/monaco": "^1.0.0-beta.46",
|
|
40
|
+
"@react-fabric/utilities": "^1.0.0-beta.46",
|
|
41
41
|
"classnames": "^2.5.1",
|
|
42
42
|
"react-hook-form": "^7.52.1"
|
|
43
43
|
},
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"react-i18next": "^15.0.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@react-fabric/superdate": "^1.0.0-beta.
|
|
51
|
+
"@react-fabric/superdate": "^1.0.0-beta.46"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=18.12.0",
|
|
55
55
|
"npm": ">=8.19.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "0dfc20b9c84712bb1cb5205c22464e8a1eb2341c"
|
|
58
58
|
}
|
|
@@ -172,6 +172,19 @@ export const FilterForm = ({
|
|
|
172
172
|
/>
|
|
173
173
|
</Controller>
|
|
174
174
|
);
|
|
175
|
+
} else if (!!field.onSearch || field.values?.length) {
|
|
176
|
+
return (
|
|
177
|
+
<Controller name="value">
|
|
178
|
+
<Select
|
|
179
|
+
searchable
|
|
180
|
+
allowCreate
|
|
181
|
+
allowClear
|
|
182
|
+
options={field.values ?? []}
|
|
183
|
+
label={t("label.value")}
|
|
184
|
+
onQuery={field.onSearch}
|
|
185
|
+
/>
|
|
186
|
+
</Controller>
|
|
187
|
+
);
|
|
175
188
|
} else {
|
|
176
189
|
return (
|
|
177
190
|
<Controller name="value">
|
|
@@ -82,7 +82,10 @@ export const FilterTag = ({
|
|
|
82
82
|
<Chip
|
|
83
83
|
size="sm"
|
|
84
84
|
color={color}
|
|
85
|
-
className=
|
|
85
|
+
className={classNames(
|
|
86
|
+
"outline max-w-60",
|
|
87
|
+
filter.disabled && "opacity-65",
|
|
88
|
+
)}
|
|
86
89
|
variant={filter.pinned ? "solid" : undefined}
|
|
87
90
|
icon={icon}
|
|
88
91
|
iconColor={color}
|