@homebound/beam 2.227.0 → 2.228.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/Css.d.ts +9 -9
- package/dist/components/Accordion.d.ts +1 -1
- package/dist/components/Accordion.js +4 -4
- package/dist/components/AccordionList.js +1 -1
- package/dist/components/AutoSaveIndicator.js +5 -5
- package/dist/components/Avatar.d.ts +1 -1
- package/dist/components/Avatar.js +2 -2
- package/dist/components/AvatarButton.js +1 -1
- package/dist/components/BeamContext.js +1 -1
- package/dist/components/Button.d.ts +2 -2
- package/dist/components/Button.js +1 -1
- package/dist/components/ButtonDatePicker.js +2 -2
- package/dist/components/ButtonGroup.d.ts +2 -2
- package/dist/components/ButtonGroup.js +6 -6
- package/dist/components/ButtonMenu.d.ts +5 -5
- package/dist/components/ButtonMenu.js +1 -1
- package/dist/components/ButtonModal.js +1 -1
- package/dist/components/Chip.d.ts +1 -1
- package/dist/components/Chip.js +2 -2
- package/dist/components/Chips.d.ts +1 -1
- package/dist/components/Chips.js +3 -3
- package/dist/components/Copy.js +2 -2
- package/dist/components/CssReset.js +1 -1
- package/dist/components/Filters/BooleanFilter.d.ts +1 -1
- package/dist/components/Filters/BooleanFilter.js +3 -3
- package/dist/components/Filters/DateFilter.d.ts +2 -2
- package/dist/components/Filters/DateFilter.js +2 -2
- package/dist/components/Filters/DateRangeFilter.d.ts +2 -2
- package/dist/components/Filters/DateRangeFilter.js +2 -2
- package/dist/components/Filters/FilterModal.js +4 -4
- package/dist/components/Filters/Filters.d.ts +2 -2
- package/dist/components/Filters/Filters.js +8 -8
- package/dist/components/Filters/MultiFilter.d.ts +1 -1
- package/dist/components/Filters/MultiFilter.js +4 -4
- package/dist/components/Filters/NumberRangeFilter.d.ts +2 -2
- package/dist/components/Filters/NumberRangeFilter.js +5 -5
- package/dist/components/Filters/SingleFilter.d.ts +1 -1
- package/dist/components/Filters/SingleFilter.js +1 -1
- package/dist/components/Filters/ToggleFilter.d.ts +1 -1
- package/dist/components/Filters/ToggleFilter.js +2 -2
- package/dist/components/Filters/index.js +5 -1
- package/dist/components/Filters/testDomain.d.ts +9 -9
- package/dist/components/Filters/types.d.ts +2 -2
- package/dist/components/HbLoadingSpinner.js +9 -5
- package/dist/components/HelperText.js +1 -1
- package/dist/components/Icon.d.ts +1 -1
- package/dist/components/Icon.js +97 -97
- package/dist/components/IconButton.js +1 -1
- package/dist/components/Label.js +3 -3
- package/dist/components/Layout/PreventBrowserScroll.js +1 -1
- package/dist/components/Layout/RightPaneLayout/RightPaneContext.d.ts +1 -1
- package/dist/components/Layout/RightPaneLayout/RightPaneContext.js +6 -2
- package/dist/components/Layout/RightPaneLayout/RightPaneLayout.js +3 -3
- package/dist/components/Layout/RightPaneLayout/index.js +5 -1
- package/dist/components/Layout/ScrollableContent.d.ts +9 -1
- package/dist/components/Layout/ScrollableContent.js +12 -4
- package/dist/components/Layout/ScrollableParent.d.ts +24 -0
- package/dist/components/Layout/ScrollableParent.js +26 -2
- package/dist/components/Layout/index.js +5 -1
- package/dist/components/Loader.js +1 -1
- package/dist/components/LoadingSkeleton.d.ts +2 -2
- package/dist/components/LoadingSkeleton.js +1 -1
- package/dist/components/Modal/Modal.d.ts +3 -3
- package/dist/components/Modal/Modal.js +5 -5
- package/dist/components/Modal/OpenModal.js +2 -2
- package/dist/components/Modal/TestModalContent.js +3 -3
- package/dist/components/Modal/index.js +5 -1
- package/dist/components/NavLink.d.ts +1 -1
- package/dist/components/NavLink.js +2 -2
- package/dist/components/PresentationContext.d.ts +4 -3
- package/dist/components/PresentationContext.js +1 -1
- package/dist/components/Snackbar/Snackbar.d.ts +1 -1
- package/dist/components/Snackbar/Snackbar.js +1 -1
- package/dist/components/Snackbar/SnackbarContext.d.ts +1 -1
- package/dist/components/Snackbar/SnackbarContext.js +1 -1
- package/dist/components/Snackbar/SnackbarNotice.d.ts +1 -1
- package/dist/components/Snackbar/SnackbarNotice.js +1 -1
- package/dist/components/Stepper.js +11 -11
- package/dist/components/SuperDrawer/ConfirmCloseModal.js +2 -2
- package/dist/components/SuperDrawer/SuperDrawer.js +3 -3
- package/dist/components/SuperDrawer/SuperDrawerContent.js +3 -3
- package/dist/components/SuperDrawer/components/SuperDrawerHeader.js +2 -2
- package/dist/components/SuperDrawer/index.js +5 -1
- package/dist/components/SuperDrawer/useSuperDrawer.d.ts +1 -1
- package/dist/components/SuperDrawer/useSuperDrawer.js +2 -2
- package/dist/components/Table/GridTable.d.ts +1 -1
- package/dist/components/Table/GridTable.js +34 -30
- package/dist/components/Table/GridTableApi.d.ts +1 -1
- package/dist/components/Table/TableActions.d.ts +1 -1
- package/dist/components/Table/TableActions.js +1 -1
- package/dist/components/Table/TableStyles.d.ts +1 -1
- package/dist/components/Table/components/CollapseToggle.js +1 -1
- package/dist/components/Table/components/EditColumnsButton.js +2 -2
- package/dist/components/Table/components/ExpandableHeader.js +2 -2
- package/dist/components/Table/components/Row.d.ts +2 -2
- package/dist/components/Table/components/Row.js +7 -3
- package/dist/components/Table/components/SelectToggle.js +1 -1
- package/dist/components/Table/components/SortHeader.js +3 -3
- package/dist/components/Table/components/cell.d.ts +2 -2
- package/dist/components/Table/components/cell.js +6 -6
- package/dist/components/Table/index.js +5 -1
- package/dist/components/Table/types.d.ts +13 -13
- package/dist/components/Table/utils/TableState.d.ts +4 -4
- package/dist/components/Table/utils/columns.js +2 -2
- package/dist/components/Table/utils/simpleHelpers.d.ts +1 -1
- package/dist/components/Table/utils/utils.js +5 -5
- package/dist/components/Tabs.d.ts +1 -1
- package/dist/components/Tabs.js +7 -7
- package/dist/components/Tag.d.ts +2 -2
- package/dist/components/Tag.js +1 -1
- package/dist/components/Toast/Toast.d.ts +1 -1
- package/dist/components/Toast/Toast.js +1 -1
- package/dist/components/Toast/ToastContext.d.ts +1 -1
- package/dist/components/Toast/ToastContext.js +1 -1
- package/dist/components/ToggleChip.d.ts +1 -1
- package/dist/components/ToggleChip.js +2 -2
- package/dist/components/ToggleChips.d.ts +1 -1
- package/dist/components/ToggleChips.js +1 -1
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip.js +9 -5
- package/dist/components/index.js +5 -1
- package/dist/components/internal/CompoundField.js +6 -6
- package/dist/components/internal/ContextualModal.js +1 -1
- package/dist/components/internal/DatePicker/DatePicker.js +2 -2
- package/dist/components/internal/DatePicker/DatePickerOverlay.js +1 -1
- package/dist/components/internal/DatePicker/DateRangePicker.js +2 -2
- package/dist/components/internal/DatePicker/Day.js +6 -6
- package/dist/components/internal/DatePicker/Header.js +2 -2
- package/dist/components/internal/DatePicker/WeekHeader.js +1 -1
- package/dist/components/internal/DatePicker/index.js +5 -1
- package/dist/components/internal/Menu.js +4 -4
- package/dist/components/internal/MenuItem.js +6 -6
- package/dist/components/internal/MenuSection.js +1 -1
- package/dist/components/internal/OverlayTrigger.js +1 -1
- package/dist/components/internal/Popover.js +1 -1
- package/dist/components/internal/index.js +5 -1
- package/dist/components/testData.d.ts +1 -1
- package/dist/components/testData.js +5 -5
- package/dist/forms/BoundCheckboxField.d.ts +1 -1
- package/dist/forms/BoundCheckboxField.js +3 -3
- package/dist/forms/BoundCheckboxGroupField.d.ts +1 -1
- package/dist/forms/BoundCheckboxGroupField.js +2 -2
- package/dist/forms/BoundChipSelectField.js +3 -3
- package/dist/forms/BoundDateField.d.ts +1 -1
- package/dist/forms/BoundDateField.js +2 -2
- package/dist/forms/BoundDateRangeField.d.ts +1 -1
- package/dist/forms/BoundDateRangeField.js +2 -2
- package/dist/forms/BoundMultiSelectField.d.ts +1 -1
- package/dist/forms/BoundMultiSelectField.js +3 -3
- package/dist/forms/BoundNumberField.d.ts +1 -1
- package/dist/forms/BoundNumberField.js +2 -2
- package/dist/forms/BoundRadioGroupField.d.ts +1 -1
- package/dist/forms/BoundRadioGroupField.js +2 -2
- package/dist/forms/BoundRichTextField.d.ts +1 -1
- package/dist/forms/BoundRichTextField.js +2 -2
- package/dist/forms/BoundSelectAndTextField.d.ts +2 -2
- package/dist/forms/BoundSelectAndTextField.js +1 -1
- package/dist/forms/BoundSelectField.d.ts +1 -1
- package/dist/forms/BoundSelectField.js +3 -3
- package/dist/forms/BoundSwitchField.d.ts +1 -1
- package/dist/forms/BoundSwitchField.js +3 -3
- package/dist/forms/BoundTextAreaField.d.ts +1 -1
- package/dist/forms/BoundTextAreaField.js +2 -2
- package/dist/forms/BoundTextField.d.ts +1 -1
- package/dist/forms/BoundTextField.js +2 -2
- package/dist/forms/BoundToggleChipGroupField.d.ts +1 -1
- package/dist/forms/BoundToggleChipGroupField.js +1 -1
- package/dist/forms/FormHeading.js +2 -2
- package/dist/forms/FormLines.d.ts +1 -1
- package/dist/forms/FormLines.js +5 -5
- package/dist/forms/FormStateApp.js +5 -5
- package/dist/forms/StaticField.js +1 -1
- package/dist/forms/StepperFormApp.js +10 -10
- package/dist/forms/index.js +5 -1
- package/dist/hooks/index.js +5 -1
- package/dist/hooks/useBreakpoint.d.ts +1 -1
- package/dist/hooks/useQueryState.d.ts +1 -1
- package/dist/hooks/useSessionStorage.d.ts +1 -1
- package/dist/index.js +5 -1
- package/dist/inputs/Checkbox.js +1 -1
- package/dist/inputs/CheckboxBase.js +6 -6
- package/dist/inputs/CheckboxGroup.d.ts +2 -3
- package/dist/inputs/CheckboxGroup.js +6 -3
- package/dist/inputs/ChipSelectField.d.ts +2 -2
- package/dist/inputs/ChipSelectField.js +14 -14
- package/dist/inputs/ChipTextField.js +3 -3
- package/dist/inputs/DateFields/DateField.js +1 -1
- package/dist/inputs/DateFields/DateField.mock.js +2 -2
- package/dist/inputs/DateFields/DateFieldBase.d.ts +1 -3
- package/dist/inputs/DateFields/DateFieldBase.js +8 -8
- package/dist/inputs/DateFields/DateRangeField.js +1 -1
- package/dist/inputs/DateFields/index.js +5 -1
- package/dist/inputs/DateFields/utils.d.ts +2 -2
- package/dist/inputs/ErrorMessage.js +2 -2
- package/dist/inputs/MultiSelectField.js +2 -2
- package/dist/inputs/MultiSelectField.mock.js +4 -4
- package/dist/inputs/NumberField.d.ts +3 -4
- package/dist/inputs/NumberField.js +4 -4
- package/dist/inputs/RadioGroupField.d.ts +2 -2
- package/dist/inputs/RadioGroupField.js +5 -5
- package/dist/inputs/RichTextField.js +3 -3
- package/dist/inputs/RichTextField.mock.js +2 -2
- package/dist/inputs/SelectField.js +2 -2
- package/dist/inputs/SelectField.mock.js +4 -4
- package/dist/inputs/Switch.d.ts +1 -1
- package/dist/inputs/Switch.js +6 -5
- package/dist/inputs/SwitchGroup.d.ts +1 -1
- package/dist/inputs/SwitchGroup.js +1 -1
- package/dist/inputs/TextAreaField.js +1 -1
- package/dist/inputs/TextField.d.ts +1 -2
- package/dist/inputs/TextField.js +1 -1
- package/dist/inputs/TextFieldBase.d.ts +1 -2
- package/dist/inputs/TextFieldBase.js +16 -16
- package/dist/inputs/ToggleButton.js +1 -1
- package/dist/inputs/ToggleChipGroup.d.ts +1 -1
- package/dist/inputs/ToggleChipGroup.js +3 -3
- package/dist/inputs/Value.d.ts +1 -1
- package/dist/inputs/index.js +5 -1
- package/dist/inputs/internal/ListBox.js +3 -3
- package/dist/inputs/internal/ListBoxChip.js +1 -1
- package/dist/inputs/internal/ListBoxSection.js +1 -1
- package/dist/inputs/internal/ListBoxToggleChip.js +2 -2
- package/dist/inputs/internal/LoadingDots.js +2 -2
- package/dist/inputs/internal/MenuSearchField.d.ts +0 -1
- package/dist/inputs/internal/MenuSearchField.js +1 -1
- package/dist/inputs/internal/Option.js +3 -3
- package/dist/inputs/internal/SelectFieldBase.d.ts +1 -3
- package/dist/inputs/internal/SelectFieldBase.js +3 -3
- package/dist/inputs/internal/SelectFieldInput.d.ts +0 -1
- package/dist/inputs/internal/SelectFieldInput.js +5 -5
- package/dist/inputs/internal/VirtualizedOptions.js +2 -2
- package/dist/interfaces.d.ts +1 -1
- package/dist/types.d.ts +4 -4
- package/dist/utils/getInteractiveElement.js +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +5 -1
- package/dist/utils/rtl.js +1 -1
- package/dist/utils/sb.d.ts +2 -2
- package/dist/utils/sb.js +4 -4
- package/dist/utils/useTestIds.d.ts +1 -1
- package/package.json +4 -4
package/dist/Css.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Properties as Properties1 } from "csstype";
|
|
2
2
|
/** Given a type X, and the user's proposed type T, only allow keys in X and nothing else. */
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
|
|
3
|
+
export type Only<X, T> = X & Record<Exclude<keyof T, keyof X>, never>;
|
|
4
|
+
export type Properties = Properties1<string | 0, string>;
|
|
5
|
+
export type Typography = "tiny" | "tinyMd" | "tinySb" | "tinyBd" | "xs" | "xsMd" | "xsSb" | "xsBd" | "sm" | "smMd" | "smSb" | "smBd" | "base" | "baseMd" | "baseSb" | "baseBd" | "lg" | "lgMd" | "lgSb" | "lgBd" | "xl" | "xlMd" | "xlSb" | "xlBd" | "xl2" | "xl2Md" | "xl2Sb" | "xl2Bd" | "xl3" | "xl3Md" | "xl3Sb" | "xl3Bd" | "xl4" | "xl4Md" | "xl4Sb" | "xl4Bd" | "xl5" | "xl5Md" | "xl5Sb" | "xl5Bd";
|
|
6
|
+
type Opts<T> = {
|
|
7
7
|
rules: T;
|
|
8
8
|
enabled: boolean;
|
|
9
9
|
important: boolean;
|
|
@@ -3838,13 +3838,13 @@ export declare enum Palette {
|
|
|
3838
3838
|
Violet900 = "rgba(100,78,116,1)"
|
|
3839
3839
|
}
|
|
3840
3840
|
/** A shortcut for defining Xss types. */
|
|
3841
|
-
export
|
|
3841
|
+
export type Xss<P extends keyof Properties> = Pick<Properties, P>;
|
|
3842
3842
|
/** An entry point for Css expressions. CssBuilder is immutable so this is safe to share. */
|
|
3843
3843
|
export declare const Css: CssBuilder<{}>;
|
|
3844
|
-
export
|
|
3845
|
-
export
|
|
3846
|
-
export
|
|
3847
|
-
export
|
|
3844
|
+
export type Margin = "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft";
|
|
3845
|
+
export type Padding = "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft";
|
|
3846
|
+
export type Font = "fontSize" | "fontWeight" | "lineHeight";
|
|
3847
|
+
export type Breakpoint = "print" | "sm" | "md" | "smOrMd" | "mdAndUp" | "mdAndDown" | "lg" | "mdOrLg";
|
|
3848
3848
|
export declare enum Breakpoints {
|
|
3849
3849
|
print = "@media print",
|
|
3850
3850
|
sm = "@media screen and (max-width:599px)",
|
|
@@ -17,4 +17,4 @@ export interface AccordionProps {
|
|
|
17
17
|
setExpandedIndex?: Dispatch<SetStateAction<number | undefined>>;
|
|
18
18
|
}
|
|
19
19
|
export declare function Accordion(props: AccordionProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
20
|
-
export
|
|
20
|
+
export type AccordionSize = "xs" | "sm" | "md" | "lg";
|
|
@@ -36,10 +36,10 @@ function Accordion(props) {
|
|
|
36
36
|
}
|
|
37
37
|
}, [expanded, setContentHeight]);
|
|
38
38
|
(0, utils_1.useResizeObserver)({ ref: contentRef, onResize });
|
|
39
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ...testIds.container, css: {
|
|
40
40
|
...Css_1.Css.bGray300.if(topBorder).bt.if(bottomBorder).bb.$,
|
|
41
41
|
...(size ? Css_1.Css.wPx(accordionSizes[size]).$ : {}),
|
|
42
|
-
}
|
|
42
|
+
}, children: [(0, jsx_runtime_1.jsxs)("button", { ...testIds.title, ...focusProps, "aria-controls": id, "aria-expanded": expanded, disabled: disabled, css: {
|
|
43
43
|
...Css_1.Css.df.jcsb.gap2.aic.w100.p2.baseMd.outline("none").addIn(":hover", Css_1.Css.bgGray100.$).$,
|
|
44
44
|
...(disabled && Css_1.Css.gray500.$),
|
|
45
45
|
...(isFocusVisible && Css_1.Css.boxShadow(`inset 0 0 0 2px ${Css_1.Palette.LightBlue700}`).$),
|
|
@@ -47,10 +47,10 @@ function Accordion(props) {
|
|
|
47
47
|
setExpanded(!expanded);
|
|
48
48
|
if (setExpandedIndex)
|
|
49
49
|
setExpandedIndex(index);
|
|
50
|
-
}
|
|
50
|
+
}, children: [(0, jsx_runtime_1.jsx)("span", { children: title }), (0, jsx_runtime_1.jsx)("span", { css: {
|
|
51
51
|
transition: "transform 250ms linear",
|
|
52
52
|
transform: expanded ? "rotate(180deg)" : "rotate(0deg)",
|
|
53
|
-
}
|
|
53
|
+
}, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "chevronDown" }) })] }), (0, jsx_runtime_1.jsx)("div", { ...testIds.details, id: id, "aria-hidden": !expanded, css: Css_1.Css.overflowHidden.h(contentHeight).add("transition", "height 250ms ease-in-out").$, children: expanded && ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.px2.pb2.pt1.$, ref: contentRef, ...testIds.content, children: children })) })] }));
|
|
54
54
|
}
|
|
55
55
|
exports.Accordion = Accordion;
|
|
56
56
|
const accordionSizes = {
|
|
@@ -10,6 +10,6 @@ function AccordionList(props) {
|
|
|
10
10
|
const { accordions, size, allowMultipleExpanded = true } = props;
|
|
11
11
|
const [expandedIndex, setExpandedIndex] = (0, react_2.useState)(accordions.findIndex((a) => a.defaultExpanded));
|
|
12
12
|
const tid = (0, __1.useTestIds)(props, "accordionList");
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: accordions.map((accordionProps, index, arr) => ((0, react_1.createElement)(Accordion_1.Accordion, { ...accordionProps, ...tid, key: index, size: size, bottomBorder: index === arr.length - 1, defaultExpanded: !allowMultipleExpanded && expandedIndex === index, index: index, setExpandedIndex: setExpandedIndex }))) }
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: accordions.map((accordionProps, index, arr) => ((0, react_1.createElement)(Accordion_1.Accordion, { ...accordionProps, ...tid, key: index, size: size, bottomBorder: index === arr.length - 1, defaultExpanded: !allowMultipleExpanded && expandedIndex === index, index: index, setExpandedIndex: setExpandedIndex }))) }));
|
|
14
14
|
}
|
|
15
15
|
exports.AccordionList = AccordionList;
|
|
@@ -21,11 +21,11 @@ function AutoSaveIndicator({ hideOnIdle, doNotReset }) {
|
|
|
21
21
|
}, []);
|
|
22
22
|
switch (status) {
|
|
23
23
|
case form_state_1.AutoSaveStatus.IDLE:
|
|
24
|
-
return hideOnIdle ? null : (0, jsx_runtime_1.jsx)(Indicator, { icon: "cloudSave" }
|
|
24
|
+
return hideOnIdle ? null : (0, jsx_runtime_1.jsx)(Indicator, { icon: "cloudSave" });
|
|
25
25
|
case form_state_1.AutoSaveStatus.SAVING:
|
|
26
|
-
return (0, jsx_runtime_1.jsx)(Indicator, { icon: "refresh", text: "Saving..." }
|
|
26
|
+
return (0, jsx_runtime_1.jsx)(Indicator, { icon: "refresh", text: "Saving..." });
|
|
27
27
|
case form_state_1.AutoSaveStatus.DONE:
|
|
28
|
-
return (0, jsx_runtime_1.jsx)(Indicator, { icon: "cloudSave", text: "Saved" }
|
|
28
|
+
return (0, jsx_runtime_1.jsx)(Indicator, { icon: "cloudSave", text: "Saved" });
|
|
29
29
|
case form_state_1.AutoSaveStatus.ERROR:
|
|
30
30
|
return (
|
|
31
31
|
/**
|
|
@@ -33,12 +33,12 @@ function AutoSaveIndicator({ hideOnIdle, doNotReset }) {
|
|
|
33
33
|
* rendering it far away from the Icon/Text. Wrap it with a div to constrain
|
|
34
34
|
* it.
|
|
35
35
|
*/
|
|
36
|
-
(0, jsx_runtime_1.jsx)("div",
|
|
36
|
+
(0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.dif.$, children: (0, jsx_runtime_1.jsx)(_1.Tooltip, { title: String(errors), placement: "bottom", children: (0, jsx_runtime_1.jsx)(Indicator, { icon: "error", color: Css_1.Palette.Red500, text: "Error saving" }) }) }));
|
|
37
37
|
default:
|
|
38
38
|
(0, types_1.assertNever)(status);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
exports.AutoSaveIndicator = AutoSaveIndicator;
|
|
42
42
|
function Indicator({ text, icon, color }) {
|
|
43
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)("div", { "data-testid": "autoSave", css: Css_1.Css.df.gap1.aic.gray700.smMd.$, children: [(0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: icon, color: color }), text] }));
|
|
44
44
|
}
|
|
@@ -5,4 +5,4 @@ export interface AvatarProps {
|
|
|
5
5
|
showName?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare function Avatar({ src, name, size, showName, ...others }: AvatarProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
|
-
export
|
|
8
|
+
export type AvatarSize = "sm" | "md" | "lg" | "xl";
|
|
@@ -11,8 +11,8 @@ function Avatar({ src, name, size = "md", showName = false, ...others }) {
|
|
|
11
11
|
const px = sizeToPixel[size];
|
|
12
12
|
const [showFallback, setShowFallback] = (0, react_1.useState)(src === undefined);
|
|
13
13
|
const styles = Css_1.Css.br100.wPx(px).hPx(px).overflowHidden.$;
|
|
14
|
-
const img = showFallback ? ((0, jsx_runtime_1.jsx)("div",
|
|
15
|
-
return showName && name ? ((0, jsx_runtime_1.jsxs)("div",
|
|
14
|
+
const img = showFallback ? ((0, jsx_runtime_1.jsx)("div", { css: { ...styles, ...Css_1.Css[sizeToFallbackTypeScale[size]].bgGray400.gray100.df.aic.jcc.$ }, ...tid, children: name ? nameToInitials(name) : (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "userCircle", inc: sizeToIconInc[size] }) })) : ((0, jsx_runtime_1.jsx)("img", { src: src, alt: name, css: { ...styles, ...Css_1.Css.objectCover.$ }, onError: () => setShowFallback(true), loading: "lazy", ...tid }));
|
|
15
|
+
return showName && name ? ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.dif.aic.gap1.if(size === "lg" || size === "xl").fdc.$, children: [img, (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css[sizeToTypeScale[size]].$, children: name })] })) : (img);
|
|
16
16
|
}
|
|
17
17
|
exports.Avatar = Avatar;
|
|
18
18
|
const sizeToPixel = {
|
|
@@ -44,7 +44,7 @@ function AvatarButton(props) {
|
|
|
44
44
|
return (0, components_1.maybeTooltip)({
|
|
45
45
|
title: (0, components_1.resolveTooltip)(disabled, tooltip),
|
|
46
46
|
placement: "top",
|
|
47
|
-
children: (0, getInteractiveElement_1.getButtonOrLink)((0, jsx_runtime_1.jsx)(Avatar_1.Avatar,
|
|
47
|
+
children: (0, getInteractiveElement_1.getButtonOrLink)((0, jsx_runtime_1.jsx)(Avatar_1.Avatar, { ...avatarProps, ...tid }), onPress, buttonAttrs, openInNew),
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
exports.AvatarButton = AvatarButton;
|
|
@@ -61,7 +61,7 @@ function BeamProvider({ children, ...presentationProps }) {
|
|
|
61
61
|
sdHeaderDiv,
|
|
62
62
|
};
|
|
63
63
|
}, [modalBodyDiv, modalFooterDiv]);
|
|
64
|
-
return ((0, jsx_runtime_1.jsx)(exports.BeamContext.Provider,
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)(exports.BeamContext.Provider, { value: { ...context }, children: (0, jsx_runtime_1.jsx)(PresentationContext_1.PresentationProvider, { ...presentationProps, children: (0, jsx_runtime_1.jsx)(Layout_1.RightPaneProvider, { children: (0, jsx_runtime_1.jsx)(form_state_1.AutoSaveStatusProvider, { children: (0, jsx_runtime_1.jsx)(SnackbarContext_1.SnackbarProvider, { children: (0, jsx_runtime_1.jsxs)(ToastContext_1.ToastProvider, { children: [(0, jsx_runtime_1.jsxs)(react_aria_1.OverlayProvider, { children: [children, modalRef.current && (0, jsx_runtime_1.jsx)(Modal_1.Modal, { ...modalRef.current })] }), (0, jsx_runtime_1.jsx)(SuperDrawer_1.SuperDrawer, {})] }) }) }) }) }) }));
|
|
65
65
|
}
|
|
66
66
|
exports.BeamProvider = BeamProvider;
|
|
67
67
|
/** Looks like a ref, but invokes a re-render on set (w/o changing the setter identity). */
|
|
@@ -21,5 +21,5 @@ export interface ButtonProps extends BeamButtonProps, BeamFocusableProps {
|
|
|
21
21
|
labelInFlight?: string;
|
|
22
22
|
}
|
|
23
23
|
export declare function Button(props: ButtonProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
24
|
-
export
|
|
25
|
-
export
|
|
24
|
+
export type ButtonSize = "sm" | "md" | "lg";
|
|
25
|
+
export type ButtonVariant = "primary" | "secondary" | "tertiary" | "tertiaryDanger" | "danger" | "text";
|
|
@@ -38,7 +38,7 @@ function Button(props) {
|
|
|
38
38
|
const { isFocusVisible, focusProps } = (0, react_aria_1.useFocusRing)(ariaProps);
|
|
39
39
|
const { hoverProps, isHovered } = (0, react_aria_1.useHover)(ariaProps);
|
|
40
40
|
const { baseStyles, hoverStyles, disabledStyles, pressedStyles, focusStyles } = (0, react_1.useMemo)(() => getButtonStyles(variant, size, contrast), [variant, size, contrast]);
|
|
41
|
-
const buttonContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [icon && (0, jsx_runtime_1.jsx)(components_1.Icon, { xss: iconStyles[size], icon: icon }
|
|
41
|
+
const buttonContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [icon && (0, jsx_runtime_1.jsx)(components_1.Icon, { xss: iconStyles[size], icon: icon }), labelInFlight && asyncInProgress ? labelInFlight : label, (endAdornment || asyncInProgress) && ((0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.ml1.$, children: asyncInProgress ? (0, jsx_runtime_1.jsx)(components_1.Loader, { size: "xs", contrast: contrast }) : endAdornment }))] }));
|
|
42
42
|
const buttonAttrs = {
|
|
43
43
|
ref: ref,
|
|
44
44
|
...buttonProps,
|
|
@@ -16,9 +16,9 @@ function ButtonDatePicker(props) {
|
|
|
16
16
|
const buttonRef = (0, react_1.useRef)(null);
|
|
17
17
|
const { menuTriggerProps, menuProps } = (0, react_aria_1.useMenuTrigger)({ isDisabled: !!disabled }, state, buttonRef);
|
|
18
18
|
const tid = (0, utils_1.useTestIds)(props, (0, OverlayTrigger_1.isTextButton)(trigger) ? (0, defaultTestId_1.defaultTestId)(trigger.label) : (0, OverlayTrigger_1.isIconButton)(trigger) ? trigger.icon : trigger.name);
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(OverlayTrigger_1.OverlayTrigger,
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(OverlayTrigger_1.OverlayTrigger, { ...props, menuTriggerProps: menuTriggerProps, state: state, buttonRef: buttonRef, ...tid, children: (0, jsx_runtime_1.jsx)(DatePickerOverlay_1.DatePickerOverlay, { overlayProps: menuProps, children: (0, jsx_runtime_1.jsx)(DatePicker_1.DatePicker, { ...datePickerProps, onSelect: (d) => {
|
|
20
20
|
onSelect(d);
|
|
21
21
|
state.close();
|
|
22
|
-
}
|
|
22
|
+
}, ...tid.datePicker }) }) }));
|
|
23
23
|
}
|
|
24
24
|
exports.ButtonDatePicker = ButtonDatePicker;
|
|
@@ -6,7 +6,7 @@ export interface ButtonGroupProps {
|
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
size?: ButtonGroupSize;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export type ButtonGroupButton = {
|
|
10
10
|
icon?: IconProps["icon"];
|
|
11
11
|
text?: string;
|
|
12
12
|
onClick?: VoidFunction;
|
|
@@ -18,5 +18,5 @@ export declare type ButtonGroupButton = {
|
|
|
18
18
|
tooltip?: ReactNode;
|
|
19
19
|
};
|
|
20
20
|
export declare function ButtonGroup(props: ButtonGroupProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
21
|
-
|
|
21
|
+
type ButtonGroupSize = "xs" | "sm" | "md";
|
|
22
22
|
export {};
|
|
@@ -14,9 +14,9 @@ function ButtonGroup(props) {
|
|
|
14
14
|
const tid = (0, utils_1.useTestIds)(props, "buttonGroup");
|
|
15
15
|
return (
|
|
16
16
|
// Adding `line-height: 0` prevent inheriting line-heights that might throw off sizing within the button group.
|
|
17
|
-
(0, jsx_runtime_1.jsx)("div",
|
|
17
|
+
(0, jsx_runtime_1.jsx)("div", { ...tid, css: Css_1.Css.df.lh(0).add(sizeStyles[size]).$, children: buttons.map(({ disabled: buttonDisabled, ...buttonProps }, i) => (
|
|
18
18
|
// Disable the button if the ButtonGroup is disabled or if the current button is disabled.
|
|
19
|
-
(0, jsx_runtime_1.jsx)(GroupButton,
|
|
19
|
+
(0, jsx_runtime_1.jsx)(GroupButton, { ...buttonProps, disabled: disabled || buttonDisabled, size: size, ...tid }, i))) }));
|
|
20
20
|
}
|
|
21
21
|
exports.ButtonGroup = ButtonGroup;
|
|
22
22
|
function GroupButton(props) {
|
|
@@ -28,18 +28,18 @@ function GroupButton(props) {
|
|
|
28
28
|
const { isFocusVisible, focusProps } = (0, react_aria_1.useFocusRing)();
|
|
29
29
|
const { hoverProps, isHovered } = (0, react_aria_1.useHover)(ariaProps);
|
|
30
30
|
const tid = (0, utils_1.useTestIds)(props);
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)("span",
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)("span", { css: getButtonStyles(), children: (0, Tooltip_1.maybeTooltip)({
|
|
32
32
|
title: (0, Tooltip_1.resolveTooltip)(disabled, tooltip),
|
|
33
33
|
placement: "top",
|
|
34
|
-
children: ((0, jsx_runtime_1.jsxs)("button",
|
|
34
|
+
children: ((0, jsx_runtime_1.jsxs)("button", { ref: ref, ...buttonProps, ...focusProps, ...hoverProps, css: {
|
|
35
35
|
...Css_1.Css.buttonBase.px2.br0.h100.$,
|
|
36
36
|
"&:disabled": Css_1.Css.gray400.cursorNotAllowed.bGray300.$,
|
|
37
37
|
...(isFocusVisible ? defaultFocusRingStyles : {}),
|
|
38
38
|
...(active ? activeStyles : {}),
|
|
39
39
|
...(isPressed ? pressedStyles : isHovered ? hoverStyles : {}),
|
|
40
40
|
...(icon ? iconStyles[size] : {}),
|
|
41
|
-
}
|
|
42
|
-
}) })
|
|
41
|
+
}, ...tid[(0, defaultTestId_1.defaultTestId)((_a = text !== null && text !== void 0 ? text : icon) !== null && _a !== void 0 ? _a : "button")], children: [icon && (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: icon }), text] })),
|
|
42
|
+
}) }));
|
|
43
43
|
}
|
|
44
44
|
const pressedStyles = Css_1.Css.bgGray200.$;
|
|
45
45
|
const activeStyles = Css_1.Css.bgGray300.$;
|
|
@@ -7,22 +7,22 @@ interface ButtonMenuProps extends Pick<OverlayTriggerProps, "trigger" | "placeme
|
|
|
7
7
|
defaultOpen?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export declare function ButtonMenu(props: ButtonMenuProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
-
|
|
10
|
+
type MenuItemBase = {
|
|
11
11
|
label: string;
|
|
12
12
|
onClick: string | VoidFunction;
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
destructive?: boolean;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type IconMenuItemType = MenuItemBase & {
|
|
17
17
|
icon: IconProps["icon"];
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type ImageMenuItemType = MenuItemBase & {
|
|
20
20
|
src: string;
|
|
21
21
|
size?: 24 | 48;
|
|
22
22
|
isAvatar?: boolean;
|
|
23
23
|
};
|
|
24
|
-
export
|
|
25
|
-
export
|
|
24
|
+
export type MenuItem = MenuItemBase | IconMenuItemType | ImageMenuItemType;
|
|
25
|
+
export type MenuSection = MenuItem & {
|
|
26
26
|
items?: MenuItem[];
|
|
27
27
|
};
|
|
28
28
|
export {};
|
|
@@ -14,6 +14,6 @@ function ButtonMenu(props) {
|
|
|
14
14
|
const buttonRef = (0, react_1.useRef)(null);
|
|
15
15
|
const { menuTriggerProps, menuProps } = (0, react_aria_1.useMenuTrigger)({ isDisabled: !!disabled }, state, buttonRef);
|
|
16
16
|
const tid = (0, utils_1.useTestIds)(props, (0, OverlayTrigger_1.isTextButton)(trigger) ? trigger.label : (0, OverlayTrigger_1.isIconButton)(trigger) ? trigger.icon : trigger.name);
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(OverlayTrigger_1.OverlayTrigger,
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(OverlayTrigger_1.OverlayTrigger, { ...props, menuTriggerProps: menuTriggerProps, state: state, buttonRef: buttonRef, ...tid, children: (0, jsx_runtime_1.jsx)(Menu_1.Menu, { ariaMenuProps: menuProps, onClose: () => state.close(), items: items, persistentItems: persistentItems, searchable: searchable, ...tid }) }));
|
|
18
18
|
}
|
|
19
19
|
exports.ButtonMenu = ButtonMenu;
|
|
@@ -14,6 +14,6 @@ function ButtonModal(props) {
|
|
|
14
14
|
const buttonRef = (0, react_1.useRef)(null);
|
|
15
15
|
const { menuTriggerProps } = (0, react_aria_1.useMenuTrigger)({ isDisabled: !!disabled }, state, buttonRef);
|
|
16
16
|
const tid = (0, utils_1.useTestIds)(props, (0, OverlayTrigger_1.isTextButton)(trigger) ? trigger.label : (0, OverlayTrigger_1.isIconButton)(trigger) ? trigger.icon : trigger.name);
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(OverlayTrigger_1.OverlayTrigger,
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(OverlayTrigger_1.OverlayTrigger, { ...props, menuTriggerProps: menuTriggerProps, state: state, buttonRef: buttonRef, ...tid, children: (0, jsx_runtime_1.jsx)(ContextualModal_1.ContextualModal, { content: content, title: title, close: state.close }) }));
|
|
18
18
|
}
|
|
19
19
|
exports.ButtonModal = ButtonModal;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { Margin, Only, Xss } from "../Css";
|
|
3
|
-
|
|
3
|
+
type ChipType = "caution" | "warning" | "success" | "light" | "dark" | "neutral";
|
|
4
4
|
export declare const ChipTypes: Record<ChipType, ChipType>;
|
|
5
5
|
export interface ChipProps<X> {
|
|
6
6
|
text: string;
|
package/dist/components/Chip.js
CHANGED
|
@@ -23,11 +23,11 @@ function Chip({ type = exports.ChipTypes.neutral, ...props }) {
|
|
|
23
23
|
return (0, Tooltip_1.maybeTooltip)({
|
|
24
24
|
title,
|
|
25
25
|
placement: "bottom",
|
|
26
|
-
children: ((0, jsx_runtime_1.jsx)("span",
|
|
26
|
+
children: ((0, jsx_runtime_1.jsx)("span", { css: {
|
|
27
27
|
...Css_1.Css[compact ? "xs" : "sm"].dif.aic.br16.pl1.px1.pyPx(2).gray900.$,
|
|
28
28
|
...typeStyles[type],
|
|
29
29
|
...xss,
|
|
30
|
-
}
|
|
30
|
+
}, ...tid, children: (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.lineClamp1.breakAll.$, children: text }) })),
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
exports.Chip = Chip;
|
package/dist/components/Chips.js
CHANGED
|
@@ -9,13 +9,13 @@ const Css_1 = require("../Css");
|
|
|
9
9
|
function Chips(props) {
|
|
10
10
|
const { wrap } = (0, PresentationContext_1.usePresentationContext)();
|
|
11
11
|
const { values, xss = {} } = props;
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)("div", { css: {
|
|
13
13
|
...Css_1.Css.df.aifs.gap1.whiteSpace("normal").$,
|
|
14
14
|
...(wrap !== false ? Css_1.Css.add({ flexWrap: "wrap" }).$ : {}),
|
|
15
15
|
...xss,
|
|
16
|
-
}
|
|
16
|
+
}, children: values.map((value, i) => {
|
|
17
17
|
const { text, title } = (value.hasOwnProperty("text") ? value : { text: value });
|
|
18
18
|
return (0, jsx_runtime_1.jsx)(Chip_1.Chip, { text: text, title: title }, i);
|
|
19
|
-
}) })
|
|
19
|
+
}) }));
|
|
20
20
|
}
|
|
21
21
|
exports.Chips = Chips;
|
package/dist/components/Copy.js
CHANGED
|
@@ -4,9 +4,9 @@ exports.Copy = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
5
|
const Css_1 = require("../Css");
|
|
6
6
|
function Copy(props) {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("div", { css: {
|
|
8
8
|
...Css_1.Css.sm.gray700.mt2.mb3.wPx(480).$,
|
|
9
9
|
"& > p": Css_1.Css.my2.$,
|
|
10
|
-
}
|
|
10
|
+
}, children: props.children }));
|
|
11
11
|
}
|
|
12
12
|
exports.Copy = Copy;
|
|
@@ -8,7 +8,7 @@ const Css_1 = require("../Css");
|
|
|
8
8
|
* Applies a CSS Reset that is based on modern-normalize + TW customizations.
|
|
9
9
|
*/
|
|
10
10
|
function CssReset() {
|
|
11
|
-
return (0, jsx_runtime_1.jsx)(react_1.Global, { styles: [modernNormalizeReset, tailwindPreflightReset, ourReset] }
|
|
11
|
+
return (0, jsx_runtime_1.jsx)(react_1.Global, { styles: [modernNormalizeReset, tailwindPreflightReset, ourReset] });
|
|
12
12
|
}
|
|
13
13
|
exports.CssReset = CssReset;
|
|
14
14
|
// Certain `a` tags in the app we want to opt-out of the default `a` / `a:visited` look
|
|
@@ -12,13 +12,13 @@ class BooleanFilter extends BaseFilter_1.BaseFilter {
|
|
|
12
12
|
render(value, setValue, tid, inModal, vertical) {
|
|
13
13
|
// Our options are a list of tuples
|
|
14
14
|
const { options = defaultBooleanOptions, label, defaultValue, ...props } = this.props;
|
|
15
|
-
return ((0, jsx_runtime_1.jsx)(SelectField_1.SelectField,
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(SelectField_1.SelectField, { ...props, compact: !vertical, label: this.label,
|
|
16
16
|
// We use `String(value)` so that `undefined` becomes "undefined"
|
|
17
|
-
value: String(value),
|
|
17
|
+
value: String(value), labelStyle: inModal ? "hidden" : !inModal && !vertical ? "inline" : "above", sizeToContent: !inModal && !vertical, options: options, getOptionValue: (o) => String(o[0]), getOptionLabel: (o) => o[1], onSelect: (value) => {
|
|
18
18
|
// Change our string "true" / "false" / "undefined" back to boolean | undefined
|
|
19
19
|
const parsedValue = value === "undefined" ? undefined : value === "true";
|
|
20
20
|
setValue(parsedValue);
|
|
21
|
-
}
|
|
21
|
+
}, ...this.testId(tid) }));
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
const defaultBooleanOptions = [
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Key } from "react";
|
|
2
2
|
import { Filter } from "./types";
|
|
3
3
|
import { Value } from "../../inputs";
|
|
4
|
-
export
|
|
4
|
+
export type DateFilterProps<O, V extends Value, DV extends DateFilterValue<V>> = {
|
|
5
5
|
label: string;
|
|
6
6
|
operations: O[];
|
|
7
7
|
getOperationValue: (o: O) => V;
|
|
8
8
|
getOperationLabel: (o: O) => string;
|
|
9
9
|
defaultValue?: DV;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type DateFilterValue<V extends Value> = {
|
|
12
12
|
op: V;
|
|
13
13
|
value: Date;
|
|
14
14
|
};
|
|
@@ -16,12 +16,12 @@ const anyOption = {};
|
|
|
16
16
|
class DateFilter extends BaseFilter_1.BaseFilter {
|
|
17
17
|
render(value, setValue, tid, inModal, vertical) {
|
|
18
18
|
const { label, operations, getOperationValue, getOperationLabel } = this.props;
|
|
19
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [vertical && (0, jsx_runtime_1.jsx)(Label_1.Label, { label: label }
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [vertical && (0, jsx_runtime_1.jsx)(Label_1.Label, { label: label }), (0, jsx_runtime_1.jsxs)(CompoundField_1.CompoundField, { children: [(0, jsx_runtime_1.jsx)(inputs_1.SelectField, { compact: true, sizeToContent: true, options: [
|
|
20
20
|
// Always show the 'Any' option
|
|
21
21
|
anyOption,
|
|
22
22
|
...operations,
|
|
23
23
|
], getOptionValue: (o) => (o === anyOption ? undefined : getOperationValue(o)), getOptionLabel: (o) => (o === anyOption ? "Any" : getOperationLabel(o)), value: value === null || value === void 0 ? void 0 : value.op, onSelect: (op) =>
|
|
24
24
|
// default the selected date to today if it doesn't exist in the filter's value
|
|
25
|
-
setValue(op ? { op, value: (value === null || value === void 0 ? void 0 : value.value) ? new Date(value.value) : new Date() } : undefined), label: inModal ? `${label} date filter operation` : label,
|
|
25
|
+
setValue(op ? { op, value: (value === null || value === void 0 ? void 0 : value.value) ? new Date(value.value) : new Date() } : undefined), label: inModal ? `${label} date filter operation` : label, labelStyle: !inModal && !vertical ? "inline" : inModal || vertical ? "hidden" : "above", nothingSelectedText: "Any", ...tid[`${(0, defaultTestId_1.defaultTestId)(this.label)}_dateOperation`] }), (0, jsx_runtime_1.jsx)(inputs_1.DateField, { compact: true, labelStyle: "inline", value: (value === null || value === void 0 ? void 0 : value.value) ? new Date(value.value) : new Date(), label: "Date", onChange: (d) => setValue({ ...value, value: d }), disabled: !value, ...tid[`${(0, defaultTestId_1.defaultTestId)(this.label)}_dateField`] })] })] }));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -3,14 +3,14 @@ import { Matcher } from "react-day-picker";
|
|
|
3
3
|
import { Filter } from "./types";
|
|
4
4
|
import { Value } from "../../inputs";
|
|
5
5
|
import { DateRange } from "../../types";
|
|
6
|
-
export
|
|
6
|
+
export type DateRangeFilterProps<V extends Value, DV extends DateRangeFilterValue<V>> = {
|
|
7
7
|
label: string;
|
|
8
8
|
defaultValue?: DV;
|
|
9
9
|
placeholderText?: string;
|
|
10
10
|
disabledDays?: Matcher | Matcher[];
|
|
11
11
|
testFieldLabel?: string;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type DateRangeFilterValue<V extends Value> = {
|
|
14
14
|
op: V;
|
|
15
15
|
value: DateRange | undefined;
|
|
16
16
|
};
|
|
@@ -13,10 +13,10 @@ exports.dateRangeFilter = dateRangeFilter;
|
|
|
13
13
|
class DateRangeFilter extends BaseFilter_1.BaseFilter {
|
|
14
14
|
render(value, setValue, tid, inModal, vertical) {
|
|
15
15
|
const { label, placeholderText, disabledDays, testFieldLabel, defaultValue } = this.props;
|
|
16
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [vertical && (0, jsx_runtime_1.jsx)(Label_1.Label, { label: label }
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [vertical && (0, jsx_runtime_1.jsx)(Label_1.Label, { label: label }), (0, jsx_runtime_1.jsx)(inputs_1.DateRangeField, { compact: true, labelStyle: "inline", isRangeFilterField: true, placeholder: placeholderText, label: testFieldLabel !== null && testFieldLabel !== void 0 ? testFieldLabel : "Date",
|
|
17
17
|
// Making sure that DateRange is Date type and not string before passing. Will never have undefined from/to
|
|
18
18
|
value: (value === null || value === void 0 ? void 0 : value.value)
|
|
19
19
|
? { from: new Date(value.value.from), to: new Date(value.value.to) }
|
|
20
|
-
: undefined, onChange: (d) => (d ? setValue({ op: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.op, value: d }) : setValue(undefined)), disabledDays: disabledDays
|
|
20
|
+
: undefined, onChange: (d) => (d ? setValue({ op: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.op, value: d }) : setValue(undefined)), disabledDays: disabledDays, ...tid[`${(0, defaultTestId_1.defaultTestId)(this.label)}_dateField`] })] }));
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -14,16 +14,16 @@ function FilterModal(props) {
|
|
|
14
14
|
const { closeModal } = (0, Modal_1.useModal)();
|
|
15
15
|
// Local copy of the filter that we'll use to manage the modal's state separate from the rest of the Filter
|
|
16
16
|
const [modalFilter, setModalFilter] = (0, react_1.useState)(filter);
|
|
17
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalHeader, { children: "More Filters" }
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalHeader, { children: "More Filters" }), (0, jsx_runtime_1.jsx)(Modal_1.ModalBody, { children: (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.df.fdc.$, children: (0, utils_1.safeEntries)(filters).map(([key, f]) => ((0, jsx_runtime_1.jsx)(ModalFilterItem, { label: f.hideLabelInModal ? undefined : f.label, children: f.render(modalFilter[key], (value) => setModalFilter((0, Filters_1.updateFilter)(modalFilter, key, value)), testId, true, false) }, key))) }) }), (0, jsx_runtime_1.jsxs)(Modal_1.ModalFooter, { xss: Css_1.Css.jcsb.$, children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Clear", variant: "tertiary", disabled: (0, utils_1.safeKeys)(filters).filter((fk) => modalFilter[fk] !== undefined).length === 0, onClick: () =>
|
|
18
18
|
// Only remove the filters keys that exist in the modal.
|
|
19
|
-
setModalFilter((0, utils_1.safeKeys)(filters).reduce((acc, fk) => (0, utils_1.omitKey)(fk, acc), modalFilter))
|
|
19
|
+
setModalFilter((0, utils_1.safeKeys)(filters).reduce((acc, fk) => (0, utils_1.omitKey)(fk, acc), modalFilter)), ...testId.modalClear }), (0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.df.gap1.$, children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Cancel", variant: "tertiary", onClick: closeModal, ...testId.modalClose }), (0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Apply", onClick: () => {
|
|
20
20
|
onApply(modalFilter);
|
|
21
21
|
closeModal();
|
|
22
|
-
}
|
|
22
|
+
}, ...testId.modalApply })] })] })] }));
|
|
23
23
|
}
|
|
24
24
|
exports.FilterModal = FilterModal;
|
|
25
25
|
// Wraps a filter component to be displayed in the Filter Modal
|
|
26
26
|
function ModalFilterItem({ label, children }) {
|
|
27
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.mb4.if(!label).bt.bGray200.$, children: [label && (0, jsx_runtime_1.jsx)("h2", { css: Css_1.Css.baseMd.mb2.$, children: label }), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.if(!label).pt3.$, children: children })] }));
|
|
28
28
|
}
|
|
29
29
|
exports.ModalFilterItem = ModalFilterItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FilterDefs } from "./";
|
|
2
2
|
import { Value } from "../../inputs/Value";
|
|
3
|
-
interface FilterProps<F, G extends Value = string> {
|
|
3
|
+
interface FilterProps<F extends Record<string, unknown>, G extends Value = string> {
|
|
4
4
|
/** List of filters */
|
|
5
5
|
filterDefs: FilterDefs<F>;
|
|
6
6
|
/** The current filter value. */
|
|
@@ -23,6 +23,6 @@ interface FilterProps<F, G extends Value = string> {
|
|
|
23
23
|
/** Specifies the number of in line filters before more filters modal */
|
|
24
24
|
numberOfInlineFilters?: number;
|
|
25
25
|
}
|
|
26
|
-
declare function Filters<F, G extends Value = string>(props: FilterProps<F, G>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
26
|
+
declare function Filters<F extends Record<string, unknown>, G extends Value = string>(props: FilterProps<F, G>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
27
27
|
declare const _Filters: typeof Filters;
|
|
28
28
|
export { _Filters as Filters };
|
|
@@ -20,22 +20,22 @@ function Filters(props) {
|
|
|
20
20
|
if (!vertical && impls.length > numberOfInlineFilters) {
|
|
21
21
|
// Then return up to the numberOfInlineFilters, and the remainder in the modal.
|
|
22
22
|
return [
|
|
23
|
-
Object.fromEntries(impls.slice(0, numberOfInlineFilters)),
|
|
24
|
-
Object.fromEntries(impls.slice(numberOfInlineFilters)),
|
|
23
|
+
Object.fromEntries(impls.slice(0, numberOfInlineFilters - 1)),
|
|
24
|
+
Object.fromEntries(impls.slice(numberOfInlineFilters - 1)),
|
|
25
25
|
];
|
|
26
26
|
}
|
|
27
27
|
// Otherwise, we don't have enough to show the modal, so only use page filter keys
|
|
28
28
|
return [Object.fromEntries(impls), {}];
|
|
29
|
-
}, [numberOfInlineFilters, filterDefs]);
|
|
29
|
+
}, [numberOfInlineFilters, vertical, filterDefs]);
|
|
30
30
|
const numModalFilters = (0, utils_1.safeKeys)(modalFilters).filter((fk) => filter[fk] !== undefined).length;
|
|
31
|
-
const maybeGroupByField = groupBy ? ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(SelectField_1.SelectField, { label: "Group by", compact: !vertical,
|
|
31
|
+
const maybeGroupByField = groupBy ? ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(SelectField_1.SelectField, { label: "Group by", compact: !vertical, labelStyle: !vertical ? "inline" : "above", sizeToContent: !vertical, options: groupBy.options, getOptionValue: (o) => o.id, getOptionLabel: (o) => o.name, value: groupBy.value, onSelect: (g) => g && groupBy.setValue(g) }) })) : null;
|
|
32
32
|
// Return list of filter components. `onSelect` should update the `filter`
|
|
33
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: {
|
|
34
34
|
...(vertical ? Css_1.Css.df.fdc.gap2.$ : Css_1.Css.df.aic.gap1.$),
|
|
35
|
-
}
|
|
35
|
+
}, ...testId, children: [maybeGroupByField, (0, utils_1.safeEntries)(pageFilters).map(([key, f]) => ((0, jsx_runtime_1.jsx)("div", { children: f.render(filter[key], (value) => onChange((0, Filters_1.updateFilter)(filter, key, value)), testId, false, vertical) }, key))), Object.keys(modalFilters).length > 0 && ((0, jsx_runtime_1.jsx)(Button_1.Button, { label: "More Filters", endAdornment: numModalFilters > 0 && ((0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.wPx(16).hPx(16).fs0.br100.bgLightBlue700.white.tinySb.df.aic.jcc.$, children: numModalFilters })), variant: "secondary", onClick: () => openModal({
|
|
36
36
|
// Spreading `props` to pass along `data-testid`
|
|
37
|
-
content: (0, jsx_runtime_1.jsx)(Filters_1.FilterModal,
|
|
38
|
-
})
|
|
37
|
+
content: (0, jsx_runtime_1.jsx)(Filters_1.FilterModal, { ...props, filter: filter, onApply: onChange, filters: modalFilters }),
|
|
38
|
+
}), ...testId.moreFiltersBtn })), Object.keys(filter).length > 0 && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Clear", variant: "tertiary", onClick: () => onChange({}), ...testId.clearBtn }) }))] }));
|
|
39
39
|
}
|
|
40
40
|
// memo doesn't support generic parameters, so cast the result to the correct type
|
|
41
41
|
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/37087#issuecomment-849543638
|
|
@@ -2,7 +2,7 @@ import { Key } from "react";
|
|
|
2
2
|
import { Filter } from "./types";
|
|
3
3
|
import { MultiSelectFieldProps } from "../../inputs/MultiSelectField";
|
|
4
4
|
import { Value } from "../../inputs/Value";
|
|
5
|
-
export
|
|
5
|
+
export type MultiFilterProps<O, V extends Value> = Omit<MultiSelectFieldProps<O, V>, "values" | "onSelect" | "label"> & {
|
|
6
6
|
defaultValue?: V[];
|
|
7
7
|
label?: string;
|
|
8
8
|
};
|
|
@@ -13,16 +13,16 @@ exports.multiFilter = multiFilter;
|
|
|
13
13
|
class MultiFilter extends BaseFilter_1.BaseFilter {
|
|
14
14
|
render(value, setValue, tid, inModal, vertical) {
|
|
15
15
|
if (inModal && this.props.options.length > 0 && this.props.options.length <= 8) {
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)(ToggleChipGroup_1.ToggleChipGroup,
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(ToggleChipGroup_1.ToggleChipGroup, { label: this.label, options: this.props.options.map((o) => ({
|
|
17
17
|
label: this.props.getOptionLabel(o),
|
|
18
18
|
value: this.props.getOptionValue(o),
|
|
19
19
|
})), onChange: (values) => {
|
|
20
20
|
setValue(values.length === 0 ? undefined : values);
|
|
21
|
-
}, values: value || [], hideLabel: true
|
|
21
|
+
}, values: value || [], hideLabel: true, ...tid[(0, defaultTestId_1.defaultTestId)(this.label)] }));
|
|
22
22
|
}
|
|
23
23
|
const { defaultValue, ...props } = this.props;
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(MultiSelectField_1.MultiSelectField,
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(MultiSelectField_1.MultiSelectField, { ...props, compact: !vertical, label: this.label, values: value || [], labelStyle: inModal ? "hidden" : !inModal && !vertical ? "inline" : "above", sizeToContent: !inModal && !vertical, onSelect: (values) => {
|
|
25
25
|
setValue(values.length === 0 ? undefined : values);
|
|
26
|
-
}, nothingSelectedText: "All"
|
|
26
|
+
}, nothingSelectedText: "All", ...this.testId(tid) }));
|
|
27
27
|
}
|
|
28
28
|
}
|