@homebound/beam 2.229.1 → 2.230.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.
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Filter } from "./types";
|
|
2
|
+
export type CheckboxFilterProps<V> = {
|
|
3
|
+
label?: string;
|
|
4
|
+
onValue?: V | undefined;
|
|
5
|
+
offValue?: V | undefined;
|
|
6
|
+
defaultValue?: V | undefined;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Provides a two-state "on/off" filter.
|
|
10
|
+
*
|
|
11
|
+
* By default the on/off values are `on === true` and `off === undefined`.
|
|
12
|
+
*
|
|
13
|
+
* You can flip the on/off values by passing `onValue: false`, in which case
|
|
14
|
+
* `on === false` and off === undefined`.
|
|
15
|
+
*
|
|
16
|
+
* Or you can set on/off directly, by passing both `onValue` and `offValue`, even to
|
|
17
|
+
* non-boolean values, i.e. `onValue: "foo", offValue: "bar"`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkboxFilter<V = boolean>(props: CheckboxFilterProps<V>): (key: string) => Filter<V>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkboxFilter = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const BaseFilter_1 = require("./BaseFilter");
|
|
6
|
+
const inputs_1 = require("../../inputs");
|
|
7
|
+
/**
|
|
8
|
+
* Provides a two-state "on/off" filter.
|
|
9
|
+
*
|
|
10
|
+
* By default the on/off values are `on === true` and `off === undefined`.
|
|
11
|
+
*
|
|
12
|
+
* You can flip the on/off values by passing `onValue: false`, in which case
|
|
13
|
+
* `on === false` and off === undefined`.
|
|
14
|
+
*
|
|
15
|
+
* Or you can set on/off directly, by passing both `onValue` and `offValue`, even to
|
|
16
|
+
* non-boolean values, i.e. `onValue: "foo", offValue: "bar"`.
|
|
17
|
+
*/
|
|
18
|
+
function checkboxFilter(props) {
|
|
19
|
+
return (key) => new CheckboxFilter(key, {
|
|
20
|
+
// If the user has set the offValue, that should be the default b/c we're only a two-state
|
|
21
|
+
defaultValue: props.offValue,
|
|
22
|
+
...props,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
exports.checkboxFilter = checkboxFilter;
|
|
26
|
+
class CheckboxFilter extends BaseFilter_1.BaseFilter {
|
|
27
|
+
render(value, setValue, tid, inModal, vertical) {
|
|
28
|
+
const { defaultValue, onValue = true, offValue = undefined, ...props } = this.props;
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)(inputs_1.Checkbox, { ...props, selected: value === undefined ? false : value === onValue, label: this.label, onChange: (on) => {
|
|
30
|
+
setValue(on ? onValue : offValue);
|
|
31
|
+
}, ...this.testId(tid) }));
|
|
32
|
+
}
|
|
33
|
+
get hideLabelInModal() {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -28,6 +28,7 @@ export type Project = {
|
|
|
28
28
|
status: Status;
|
|
29
29
|
isTest: boolean;
|
|
30
30
|
doNotUse: boolean;
|
|
31
|
+
isStale: boolean;
|
|
31
32
|
};
|
|
32
33
|
export type ProjectFilter = {
|
|
33
34
|
marketId?: string[] | null;
|
|
@@ -41,6 +42,7 @@ export type ProjectFilter = {
|
|
|
41
42
|
date?: DateFilterValue<string>;
|
|
42
43
|
dateRange?: DateRangeFilterValue<string>;
|
|
43
44
|
numberRange?: NumberRangeFilterValue;
|
|
45
|
+
isStale?: boolean | null;
|
|
44
46
|
};
|
|
45
47
|
export type StageFilter = NonNullable<FilterDefs<ProjectFilter>["stage"]>;
|
|
46
48
|
export type StageSingleFilter = NonNullable<FilterDefs<ProjectFilter>["stageSingle"]>;
|