@qoretechnologies/reqore 0.74.0-pr.645.g4798615 → 0.74.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.
- package/dist/components/MultiSelect/index.d.ts +18 -69
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.js +20 -194
- package/dist/components/MultiSelect/index.js.map +1 -1
- package/dist/components/Select/index.d.ts +95 -0
- package/dist/components/Select/index.d.ts.map +1 -0
- package/dist/components/Select/index.js +243 -0
- package/dist/components/Select/index.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/docs/docs/intro.md +1 -2
- package/package.json +1 -1
- package/tests.json +1 -0
- package/dist/components/SingleSelect/index.d.ts +0 -23
- package/dist/components/SingleSelect/index.d.ts.map +0 -1
- package/dist/components/SingleSelect/index.js +0 -52
- package/dist/components/SingleSelect/index.js.map +0 -1
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { IReqoreMultiSelectCommonProps, TReqoreMultiSelectItem } from '../MultiSelect';
|
|
2
|
-
export type TReqoreSingleSelectItem = TReqoreMultiSelectItem;
|
|
3
|
-
export interface IReqoreSingleSelectProps extends IReqoreMultiSelectCommonProps {
|
|
4
|
-
/** The selected value, or `undefined` when nothing is selected. */
|
|
5
|
-
value?: string;
|
|
6
|
-
/** Called with the new value, or `undefined` when the selection is cleared. */
|
|
7
|
-
onValueChange: (value?: string) => void;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* A single-value picker with the affordances of `ReqoreMultiSelect`: the chosen
|
|
11
|
-
* value is a chip, the candidates are a searchable list, and with
|
|
12
|
-
* `canCreateItems` a value outside that list can be entered.
|
|
13
|
-
*
|
|
14
|
-
* It shares `ReqoreMultiSelect`'s implementation, so the create / chip / custom
|
|
15
|
-
* item machinery behaves identically — it only differs in holding one value:
|
|
16
|
-
* picking another item replaces the current one rather than adding to it, and
|
|
17
|
-
* the list closes once a value is picked.
|
|
18
|
-
*
|
|
19
|
-
* Unlike the multi-select, the chip is removable by default (`canRemoveItems`),
|
|
20
|
-
* because otherwise there is no obvious way to clear a value once one is set.
|
|
21
|
-
*/
|
|
22
|
-
export declare const ReqoreSingleSelect: import("react").MemoExoticComponent<({ value, onValueChange, canRemoveItems, noItemsSelectedLabel, noMatchingItemsLabel, noItemsAvailableLabel, customItemsDividerLabel, matchingItemsDividerLabel, searchPlaceholder, createItemPlaceholder, ...rest }: IReqoreSingleSelectProps) => import("react/jsx-runtime").JSX.Element>;
|
|
23
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SingleSelect/index.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,6BAA6B,EAE7B,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAE7D,MAAM,WAAW,wBAAyB,SAAQ,6BAA6B;IAC7E,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,aAAa,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,2PAa1B,wBAAwB,6CAgC5B,CAAC"}
|
|
@@ -1,52 +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 __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.ReqoreSingleSelect = void 0;
|
|
26
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
-
var react_1 = require("react");
|
|
28
|
-
var MultiSelect_1 = require("../MultiSelect");
|
|
29
|
-
/**
|
|
30
|
-
* A single-value picker with the affordances of `ReqoreMultiSelect`: the chosen
|
|
31
|
-
* value is a chip, the candidates are a searchable list, and with
|
|
32
|
-
* `canCreateItems` a value outside that list can be entered.
|
|
33
|
-
*
|
|
34
|
-
* It shares `ReqoreMultiSelect`'s implementation, so the create / chip / custom
|
|
35
|
-
* item machinery behaves identically — it only differs in holding one value:
|
|
36
|
-
* picking another item replaces the current one rather than adding to it, and
|
|
37
|
-
* the list closes once a value is picked.
|
|
38
|
-
*
|
|
39
|
-
* Unlike the multi-select, the chip is removable by default (`canRemoveItems`),
|
|
40
|
-
* because otherwise there is no obvious way to clear a value once one is set.
|
|
41
|
-
*/
|
|
42
|
-
exports.ReqoreSingleSelect = (0, react_1.memo)(function (_a) {
|
|
43
|
-
var value = _a.value, onValueChange = _a.onValueChange, _b = _a.canRemoveItems, canRemoveItems = _b === void 0 ? true : _b, _c = _a.noItemsSelectedLabel, noItemsSelectedLabel = _c === void 0 ? 'No value selected' : _c, _d = _a.noMatchingItemsLabel, noMatchingItemsLabel = _d === void 0 ? 'No existing value found' : _d, _e = _a.noItemsAvailableLabel, noItemsAvailableLabel = _e === void 0 ? 'No values exist' : _e, _f = _a.customItemsDividerLabel, customItemsDividerLabel = _f === void 0 ? 'Custom Values' : _f, _g = _a.matchingItemsDividerLabel, matchingItemsDividerLabel = _g === void 0 ? 'Values matching your query' : _g, _h = _a.searchPlaceholder, searchPlaceholder = _h === void 0 ? 'Type to search...' : _h, _j = _a.createItemPlaceholder, createItemPlaceholder = _j === void 0 ? 'Type to search or enter a value...' : _j, rest = __rest(_a, ["value", "onValueChange", "canRemoveItems", "noItemsSelectedLabel", "noMatchingItemsLabel", "noItemsAvailableLabel", "customItemsDividerLabel", "matchingItemsDividerLabel", "searchPlaceholder", "createItemPlaceholder"]);
|
|
44
|
-
// An empty string is a value the user cannot see and cannot remove, so it
|
|
45
|
-
// counts as "nothing selected" the same way `undefined` and `null` do.
|
|
46
|
-
var selected = (0, react_1.useMemo)(function () { return (value === undefined || value === null || value === '' ? [] : [value]); }, [value]);
|
|
47
|
-
var handleValueChange = (0, react_1.useCallback)(function (values) {
|
|
48
|
-
onValueChange(values.length ? values[values.length - 1] : undefined);
|
|
49
|
-
}, [onValueChange]);
|
|
50
|
-
return ((0, jsx_runtime_1.jsx)(MultiSelect_1.ReqoreMultiSelectBase, __assign({}, rest, { single: true, canRemoveItems: canRemoveItems, noItemsSelectedLabel: noItemsSelectedLabel, noMatchingItemsLabel: noMatchingItemsLabel, noItemsAvailableLabel: noItemsAvailableLabel, customItemsDividerLabel: customItemsDividerLabel, matchingItemsDividerLabel: matchingItemsDividerLabel, searchPlaceholder: searchPlaceholder, createItemPlaceholder: createItemPlaceholder, value: selected, onValueChange: handleValueChange })));
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SingleSelect/index.tsx"],"names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