@homebound/beam 2.229.0 → 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"]>;
@@ -38,7 +38,7 @@ function TextFieldBase(props) {
38
38
  ? [Css_1.Palette.Gray100, Css_1.Palette.Gray200, Css_1.Palette.Gray200]
39
39
  : [Css_1.Palette.White, Css_1.Palette.Gray100, Css_1.Palette.Gray100];
40
40
  const fieldStyles = {
41
- container: Css_1.Css.df.fdc.w100.maxw((0, Css_1.px)(550)).relative.if(labelStyle === "left").fdr.gap2.jcsb.aic.$,
41
+ container: Css_1.Css.df.fdc.w100.maxw((0, Css_1.px)(550)).relative.if(labelStyle === "left").maxw100.fdr.gap2.jcsb.aic.$,
42
42
  inputWrapper: {
43
43
  ...Css_1.Css[typeScale].df.aic.br4.px1.w100
44
44
  .hPx(fieldHeight - maybeSmaller)
@@ -46,7 +46,7 @@ function TextFieldBase(props) {
46
46
  .hPx(compactFieldHeight - maybeSmaller).$,
47
47
  ...Css_1.Css.bgColor(bgColor)
48
48
  .gray900.if(contrast)
49
- .white.if(labelStyle === "left").maxw50.$,
49
+ .white.if(labelStyle === "left").w50.$,
50
50
  // When borderless then perceived vertical alignments are misaligned. As there is no longer a border, then the field looks oddly indented.
51
51
  // This typically happens in tables when a column has a mix of static text (i.e. "roll up" rows and table headers) and input fields.
52
52
  // To remedy this perceived misalignment then we increase the width by the horizontal padding applied (16px), and set a negative margin left margin to re-center the field.
@@ -247,7 +247,7 @@ function SelectFieldBase(props) {
247
247
  // Ensures the menu never gets too small.
248
248
  minWidth: 200,
249
249
  };
250
- return ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.df.fdc.w100.maxw((0, Css_1.px)(550)).$, ref: comboBoxRef, children: [(0, jsx_runtime_1.jsx)(SelectFieldInput_1.SelectFieldInput, { ...otherProps, buttonProps: buttonProps, buttonRef: triggerRef, inputProps: inputProps, inputRef: inputRef, inputWrapRef: inputWrapRef, state: state, labelProps: labelProps, selectedOptions: fieldState.selectedOptions, getOptionValue: getOptionValue, getOptionLabel: getOptionLabel, contrast: contrast, nothingSelectedText: nothingSelectedText, borderless: borderless, tooltip: (0, components_1.resolveTooltip)(disabled, undefined, readOnly), resetField: resetField }), state.isOpen && ((0, jsx_runtime_1.jsx)(internal_1.Popover, { triggerRef: triggerRef, popoverRef: popoverRef, positionProps: positionProps, onClose: () => state.close(), isOpen: state.isOpen, minWidth: 200, children: (0, jsx_runtime_1.jsx)(ListBox_1.ListBox, { ...listBoxProps, positionProps: positionProps, state: state, listBoxRef: listBoxRef, selectedOptions: fieldState.selectedOptions, getOptionLabel: getOptionLabel, getOptionValue: (o) => (0, Value_1.valueToKey)(getOptionValue(o)), contrast: contrast, loading: fieldState.optionsLoading, disabledOptionsWithReasons: disabledOptionsWithReasons }) }))] }));
250
+ return ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.df.fdc.w100.maxw((0, Css_1.px)(550)).if(otherProps.labelStyle === "left").maxw100.$, ref: comboBoxRef, children: [(0, jsx_runtime_1.jsx)(SelectFieldInput_1.SelectFieldInput, { ...otherProps, buttonProps: buttonProps, buttonRef: triggerRef, inputProps: inputProps, inputRef: inputRef, inputWrapRef: inputWrapRef, state: state, labelProps: labelProps, selectedOptions: fieldState.selectedOptions, getOptionValue: getOptionValue, getOptionLabel: getOptionLabel, contrast: contrast, nothingSelectedText: nothingSelectedText, borderless: borderless, tooltip: (0, components_1.resolveTooltip)(disabled, undefined, readOnly), resetField: resetField }), state.isOpen && ((0, jsx_runtime_1.jsx)(internal_1.Popover, { triggerRef: triggerRef, popoverRef: popoverRef, positionProps: positionProps, onClose: () => state.close(), isOpen: state.isOpen, minWidth: 200, children: (0, jsx_runtime_1.jsx)(ListBox_1.ListBox, { ...listBoxProps, positionProps: positionProps, state: state, listBoxRef: listBoxRef, selectedOptions: fieldState.selectedOptions, getOptionLabel: getOptionLabel, getOptionValue: (o) => (0, Value_1.valueToKey)(getOptionValue(o)), contrast: contrast, loading: fieldState.optionsLoading, disabledOptionsWithReasons: disabledOptionsWithReasons }) }))] }));
251
251
  }
252
252
  exports.SelectFieldBase = SelectFieldBase;
253
253
  function getInputValue(selectedOptions, getOptionLabel, multiselect, nothingSelectedText) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.229.0",
3
+ "version": "2.230.0",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",