@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
|
@@ -7,6 +7,6 @@ const Css_1 = require("../../Css");
|
|
|
7
7
|
function PreventBrowserScroll({ children }) {
|
|
8
8
|
return (
|
|
9
9
|
// Take over the full viewport and hide any overflown content.
|
|
10
|
-
(0, jsx_runtime_1.jsx)("div",
|
|
10
|
+
(0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.overflowHidden.vh100.$, children: (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.h100.df.fdc.mh0.overflowAuto.$, children: children }) }));
|
|
11
11
|
}
|
|
12
12
|
exports.PreventBrowserScroll = PreventBrowserScroll;
|
|
@@ -2,7 +2,7 @@ import React, { ReactNode } from "react";
|
|
|
2
2
|
export interface OpenRightPaneOpts {
|
|
3
3
|
content: ReactNode;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export type RightPaneLayoutContextProps = {
|
|
6
6
|
openInPane: (opts: OpenRightPaneOpts) => void;
|
|
7
7
|
closePane: () => void;
|
|
8
8
|
clearPane: () => void;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -40,7 +44,7 @@ function RightPaneProvider({ children }) {
|
|
|
40
44
|
const closePane = (0, react_1.useCallback)(() => setIsRightPaneOpen(false), [setRightPaneContent]);
|
|
41
45
|
const clearPane = (0, react_1.useCallback)(() => setRightPaneContent(undefined), [setRightPaneContent]);
|
|
42
46
|
const context = (0, react_1.useMemo)(() => ({ openInPane, closePane, clearPane, rightPaneContent, isRightPaneOpen }), [openInPane, closePane, rightPaneContent, clearPane, isRightPaneOpen]);
|
|
43
|
-
return (0, jsx_runtime_1.jsx)(exports.RightPaneContext.Provider,
|
|
47
|
+
return (0, jsx_runtime_1.jsx)(exports.RightPaneContext.Provider, { value: context, children: children });
|
|
44
48
|
}
|
|
45
49
|
exports.RightPaneProvider = RightPaneProvider;
|
|
46
50
|
function useRightPaneContext() {
|
|
@@ -7,12 +7,12 @@ const Css_1 = require("../../../Css");
|
|
|
7
7
|
const RightPaneContext_1 = require("./RightPaneContext");
|
|
8
8
|
function RightPaneLayout({ children, paneBgColor = Css_1.Palette.White, paneWidth = 450, }) {
|
|
9
9
|
const { isRightPaneOpen, rightPaneContent, clearPane } = (0, RightPaneContext_1.useRightPaneContext)();
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.h100.df.overflowXHidden.$, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.w(`calc(100% - ${paneWidth + 24}px)`)
|
|
11
11
|
.add("transition", "width .2s linear")
|
|
12
|
-
.h100.mr3.overflowXAuto.if(!isRightPaneOpen).w100.mr0
|
|
12
|
+
.h100.mr3.overflowXAuto.if(!isRightPaneOpen).w100.mr0.$, children: children }), (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: isRightPaneOpen && ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { layout: "position", "data-testid": "rightPaneContent", css: Css_1.Css.bgColor(paneBgColor).h100.wPx(paneWidth).$,
|
|
13
13
|
// Keeping initial x to offset pane width and space between panel and page content
|
|
14
14
|
initial: { x: paneWidth + 24 }, animate: { x: 0 }, transition: { ease: "linear", duration: 0.2 }, exit: { transition: { ease: "linear", duration: 0.2 }, x: paneWidth },
|
|
15
15
|
// Clear the content of the detail pane when the animation is completed and only when pane is closing
|
|
16
|
-
onAnimationComplete: (definition) => definition.x !== 0 && clearPane()
|
|
16
|
+
onAnimationComplete: (definition) => definition.x !== 0 && clearPane(), children: rightPaneContent }, "rightPane")) })] }) }));
|
|
17
17
|
}
|
|
18
18
|
exports.RightPaneLayout = RightPaneLayout;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -6,6 +6,14 @@ interface ScrollableContentProps {
|
|
|
6
6
|
omitBottomPadding?: true;
|
|
7
7
|
bgColor?: Palette;
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Helper component for placing scrollable content within a `ScrollableParent`.
|
|
11
|
+
*
|
|
12
|
+
* See the docs on `ScrollableParent.
|
|
13
|
+
*
|
|
14
|
+
* Note that you should not use this "just to get a scrollbar", instead just use `Css.overflowAuto.$`
|
|
15
|
+
* or what not; this is only for implementing page-level patterns that need multiple stickied
|
|
16
|
+
* components (page header, tab bar, table filter & actions).
|
|
17
|
+
*/
|
|
10
18
|
export declare function ScrollableContent(props: ScrollableContentProps): ReactPortal | JSX.Element;
|
|
11
19
|
export {};
|
|
@@ -6,7 +6,15 @@ const react_1 = require("react");
|
|
|
6
6
|
const react_dom_1 = require("react-dom");
|
|
7
7
|
const ScrollableParent_1 = require("./ScrollableParent");
|
|
8
8
|
const Css_1 = require("../../Css");
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Helper component for placing scrollable content within a `ScrollableParent`.
|
|
11
|
+
*
|
|
12
|
+
* See the docs on `ScrollableParent.
|
|
13
|
+
*
|
|
14
|
+
* Note that you should not use this "just to get a scrollbar", instead just use `Css.overflowAuto.$`
|
|
15
|
+
* or what not; this is only for implementing page-level patterns that need multiple stickied
|
|
16
|
+
* components (page header, tab bar, table filter & actions).
|
|
17
|
+
*/
|
|
10
18
|
function ScrollableContent(props) {
|
|
11
19
|
const { children, virtualized = false, omitBottomPadding, bgColor } = props;
|
|
12
20
|
const { scrollableEl, setPortalTick, pl, pr } = (0, ScrollableParent_1.useScrollableParent)();
|
|
@@ -19,12 +27,12 @@ function ScrollableContent(props) {
|
|
|
19
27
|
}, [setPortalTick]);
|
|
20
28
|
// Escape hatch specifically for tests where a "ScrollableParent" context may not be present.
|
|
21
29
|
if (!scrollableEl) {
|
|
22
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }
|
|
30
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
23
31
|
}
|
|
24
|
-
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div",
|
|
32
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { css: {
|
|
25
33
|
...Css_1.Css.h100.pr(pr).pl(pl).if(virtualized).pr0.$,
|
|
26
34
|
...(bgColor && Css_1.Css.bgColor(bgColor).$),
|
|
27
35
|
...(!omitBottomPadding && !virtualized && ScrollableParent_1.scrollContainerBottomPadding),
|
|
28
|
-
}
|
|
36
|
+
}, children: children }), scrollableEl);
|
|
29
37
|
}
|
|
30
38
|
exports.ScrollableContent = ScrollableContent;
|
|
@@ -10,6 +10,30 @@ interface ScrollableParentContextProviderProps {
|
|
|
10
10
|
xss?: Properties;
|
|
11
11
|
tagName?: keyof JSX.IntrinsicElements;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Provides a pattern for implementing "multiple sticky" components.
|
|
15
|
+
*
|
|
16
|
+
* In css, `position: sticky` is great for pinning 1 element to the top of a container.
|
|
17
|
+
*
|
|
18
|
+
* However, in UX patterns, we're often asked to pin multiple DOM elements that are actually
|
|
19
|
+
* spread across multiple React components. For example:
|
|
20
|
+
*
|
|
21
|
+
* - Sticky a Header (in FooPage)
|
|
22
|
+
* - Sticky the table filter & actions (in FooTable)
|
|
23
|
+
* - Sticky the table header row(s) (in GridTable)
|
|
24
|
+
*
|
|
25
|
+
* Historically the way we did this was passing `stickyOffset`s around, where the header would be
|
|
26
|
+
* `top: 0px`, the filter & actions would be `top: ${headerPx}px`, and the table header rows would
|
|
27
|
+
* be `top: ${headerPx + filterActionsPx}px`.
|
|
28
|
+
*
|
|
29
|
+
* However, this is brittle as the `headerPx` / `filterActionsPx` are likely dynamic.
|
|
30
|
+
*
|
|
31
|
+
* `ScrollableParent` solves this by putting all the stickied content (except the table header rows)
|
|
32
|
+
* into a single div, and then having the page use `ScrollableContent` to mark what should actually
|
|
33
|
+
* scroll, which then we "pull up" to be a sibling div of "everything that was stickied".
|
|
34
|
+
*
|
|
35
|
+
* See [this miro](https://miro.com/app/board/o9J_l-FQ-RU=/) and how we need to "cut the component in half".
|
|
36
|
+
*/
|
|
13
37
|
export declare function ScrollableParent(props: PropsWithChildren<ScrollableParentContextProviderProps>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
14
38
|
export declare function useScrollableParent(): ScrollableParentContextProps;
|
|
15
39
|
export declare const scrollContainerBottomPadding: {
|
|
@@ -10,6 +10,30 @@ const ScrollableParentContext = (0, react_1.createContext)({
|
|
|
10
10
|
pl: 0,
|
|
11
11
|
setPortalTick: (v) => { },
|
|
12
12
|
});
|
|
13
|
+
/**
|
|
14
|
+
* Provides a pattern for implementing "multiple sticky" components.
|
|
15
|
+
*
|
|
16
|
+
* In css, `position: sticky` is great for pinning 1 element to the top of a container.
|
|
17
|
+
*
|
|
18
|
+
* However, in UX patterns, we're often asked to pin multiple DOM elements that are actually
|
|
19
|
+
* spread across multiple React components. For example:
|
|
20
|
+
*
|
|
21
|
+
* - Sticky a Header (in FooPage)
|
|
22
|
+
* - Sticky the table filter & actions (in FooTable)
|
|
23
|
+
* - Sticky the table header row(s) (in GridTable)
|
|
24
|
+
*
|
|
25
|
+
* Historically the way we did this was passing `stickyOffset`s around, where the header would be
|
|
26
|
+
* `top: 0px`, the filter & actions would be `top: ${headerPx}px`, and the table header rows would
|
|
27
|
+
* be `top: ${headerPx + filterActionsPx}px`.
|
|
28
|
+
*
|
|
29
|
+
* However, this is brittle as the `headerPx` / `filterActionsPx` are likely dynamic.
|
|
30
|
+
*
|
|
31
|
+
* `ScrollableParent` solves this by putting all the stickied content (except the table header rows)
|
|
32
|
+
* into a single div, and then having the page use `ScrollableContent` to mark what should actually
|
|
33
|
+
* scroll, which then we "pull up" to be a sibling div of "everything that was stickied".
|
|
34
|
+
*
|
|
35
|
+
* See [this miro](https://miro.com/app/board/o9J_l-FQ-RU=/) and how we need to "cut the component in half".
|
|
36
|
+
*/
|
|
13
37
|
function ScrollableParent(props) {
|
|
14
38
|
const { children, xss, tagName: Tag = "div" } = props;
|
|
15
39
|
const scrollableEl = (0, react_1.useMemo)(() => {
|
|
@@ -31,10 +55,10 @@ function ScrollableParent(props) {
|
|
|
31
55
|
(0, react_1.useEffect)(() => {
|
|
32
56
|
scrollableRef.current.appendChild(scrollableEl);
|
|
33
57
|
}, [scrollableEl]);
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(ScrollableParentContext.Provider,
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(ScrollableParentContext.Provider, { value: context, children: (0, jsx_runtime_1.jsxs)(Tag, { css: { ...Css_1.Css.mh0.mw0.fg1.df.fdc.$, ...otherXss }, children: [(0, jsx_runtime_1.jsx)("div", { css: {
|
|
35
59
|
...Css_1.Css.pl(context.pl).pr(context.pr).$,
|
|
36
60
|
...(!hasScrollableContent ? { ...Css_1.Css.overflowAuto.h100.$, ...exports.scrollContainerBottomPadding } : undefined),
|
|
37
|
-
}
|
|
61
|
+
}, children: children }), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.fg1.overflowAuto.$, ref: scrollableRef })] }) }));
|
|
38
62
|
}
|
|
39
63
|
exports.ScrollableParent = ScrollableParent;
|
|
40
64
|
function useScrollableParent() {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -17,7 +17,7 @@ function Loader({ size = "lg", contrast = false }) {
|
|
|
17
17
|
.add("animationDuration", "800ms")
|
|
18
18
|
.add("animationIterationCount", "infinite")
|
|
19
19
|
.add("animationTimingFunction", "linear")
|
|
20
|
-
.add("transform", "translateZ(0)").$ }
|
|
20
|
+
.add("transform", "translateZ(0)").$ }));
|
|
21
21
|
}
|
|
22
22
|
exports.Loader = Loader;
|
|
23
23
|
const sizeToPixels = {
|
|
@@ -14,7 +14,7 @@ function LoadingSkeleton({ rows = 1, columns = 1, size = "md", randomizeWidths =
|
|
|
14
14
|
.add("flexGrow", flexGrowForCell)
|
|
15
15
|
.bgGray300.if(contrast).bgGray700.$ }, `row-${rowNumber}-cell-${i}`)));
|
|
16
16
|
};
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)("div", { "aria-label": "Loading", children: rowArray.map((_, i) => ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.df.gap1.mb1.hPx(rowHeight).$, children: rowCells(i) }, `row-${i}`))) }));
|
|
18
18
|
}
|
|
19
19
|
exports.LoadingSkeleton = LoadingSkeleton;
|
|
20
20
|
/** Create the illusion of random widths by cycling through a list of widths that look nice in order */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MutableRefObject, PropsWithChildren, ReactNode } from "react";
|
|
2
2
|
import { Only, Xss } from "../../Css";
|
|
3
|
-
export
|
|
3
|
+
export type ModalSize = "sm" | "md" | "lg" | "xl";
|
|
4
4
|
export interface ModalProps {
|
|
5
5
|
/**
|
|
6
6
|
* The modal size, defaults to `md`.
|
|
@@ -23,7 +23,7 @@ export interface ModalProps {
|
|
|
23
23
|
/** Adds a border for the header. */
|
|
24
24
|
drawHeaderBorder?: boolean;
|
|
25
25
|
}
|
|
26
|
-
export
|
|
26
|
+
export type ModalApi = {
|
|
27
27
|
setSize: (size: ModalProps["size"]) => void;
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
@@ -39,7 +39,7 @@ export declare function ModalHeader({ children }: {
|
|
|
39
39
|
export declare function ModalBody({ children, virtualized, }: PropsWithChildren<{
|
|
40
40
|
virtualized?: boolean;
|
|
41
41
|
}>): JSX.Element;
|
|
42
|
-
|
|
42
|
+
type ModalFooterXss = Xss<"justifyContent" | "alignItems">;
|
|
43
43
|
/** Provides consistent styling for modal footers, i.e. where actions are placed. */
|
|
44
44
|
export declare function ModalFooter<X extends Only<ModalFooterXss, X>>({ children, xss, }: {
|
|
45
45
|
children: ReactNode;
|
|
@@ -60,17 +60,17 @@ function Modal(props) {
|
|
|
60
60
|
modalBodyRef.current.appendChild(modalBodyDiv);
|
|
61
61
|
modalFooterRef.current.appendChild(modalFooterDiv);
|
|
62
62
|
}, [modalBodyRef, modalFooterRef, modalHeaderRef]);
|
|
63
|
-
return ((0, jsx_runtime_1.jsx)(react_aria_1.OverlayContainer, { children: (0, jsx_runtime_1.jsx)(form_state_1.AutoSaveStatusProvider, { children: (0, jsx_runtime_1.jsx)("div",
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(react_aria_1.OverlayContainer, { children: (0, jsx_runtime_1.jsx)(form_state_1.AutoSaveStatusProvider, { children: (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.underlay.z4.$, ...underlayProps, ...testId.underlay, children: (0, jsx_runtime_1.jsx)(react_aria_1.FocusScope, { contain: true, restoreFocus: true, autoFocus: true, children: (0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.br24.bgWhite.bshModal.overflowHidden
|
|
64
64
|
.maxh("90vh")
|
|
65
65
|
.df.fdc.wPx(width)
|
|
66
66
|
.mhPx(defaultMinHeight)
|
|
67
67
|
.if(isFixedHeight)
|
|
68
|
-
.hPx(height).$, ref: ref
|
|
68
|
+
.hPx(height).$, ref: ref, ...overlayProps, ...dialogProps, ...modalProps, ...testId, children: [(0, jsx_runtime_1.jsxs)("header", { css: Css_1.Css.df.p3.fs0.if(drawHeaderBorder).bb.bGray200.$, children: [(0, jsx_runtime_1.jsx)("h1", { css: Css_1.Css.fg1.xl2Sb.gray900.$, ref: modalHeaderRef, ...titleProps, ...testId.title }), (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.fs0.pl1.$, children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { icon: "x", onClick: closeModal, ...testId.titleClose }) })] }), (0, jsx_runtime_1.jsx)("main", { ref: modalBodyRef, css: Css_1.Css.fg1.overflowYAuto.if(hasScroll).bb.bGray200.if(!!forceScrolling).overflowYScroll.$, children: content }), (0, jsx_runtime_1.jsx)("footer", { css: Css_1.Css.fs0.$, children: (0, jsx_runtime_1.jsx)("div", { ref: modalFooterRef }) })] }) }) }) }) }));
|
|
69
69
|
}
|
|
70
70
|
exports.Modal = Modal;
|
|
71
71
|
function ModalHeader({ children }) {
|
|
72
72
|
const { modalHeaderDiv } = (0, BeamContext_1.useBeamContext)();
|
|
73
|
-
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }
|
|
73
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }), modalHeaderDiv);
|
|
74
74
|
}
|
|
75
75
|
exports.ModalHeader = ModalHeader;
|
|
76
76
|
/** Provides consistent styling and the scrolling behavior for a modal's primary content. */
|
|
@@ -79,14 +79,14 @@ function ModalBody({ children, virtualized = false, }) {
|
|
|
79
79
|
const testId = (0, utils_1.useTestIds)({}, testIdPrefix);
|
|
80
80
|
return (0, react_dom_1.createPortal)(
|
|
81
81
|
// If `virtualized`, then we are expecting the `children` will handle their own scrollbar, so have the overflow hidden and adjust padding
|
|
82
|
-
(0, jsx_runtime_1.jsx)("div",
|
|
82
|
+
(0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.h100.if(virtualized).overflowHidden.pl3.else.px3.$, ...testId.content, children: children }), modalBodyDiv);
|
|
83
83
|
}
|
|
84
84
|
exports.ModalBody = ModalBody;
|
|
85
85
|
/** Provides consistent styling for modal footers, i.e. where actions are placed. */
|
|
86
86
|
function ModalFooter({ children, xss, }) {
|
|
87
87
|
const { modalFooterDiv } = (0, BeamContext_1.useBeamContext)();
|
|
88
88
|
const testId = (0, utils_1.useTestIds)({}, testIdPrefix);
|
|
89
|
-
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div",
|
|
89
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { css: { ...Css_1.Css.p3.df.aic.jcfe.gap1.$, ...xss }, ...testId.footer, children: children }), modalFooterDiv);
|
|
90
90
|
}
|
|
91
91
|
exports.ModalFooter = ModalFooter;
|
|
92
92
|
const testIdPrefix = "modal";
|
|
@@ -33,10 +33,10 @@ function OpenModal(props) {
|
|
|
33
33
|
}
|
|
34
34
|
}, [keepOpen, openModal, size, children]);
|
|
35
35
|
if (keepOpen) {
|
|
36
|
-
return (0, jsx_runtime_1.jsx)(Modal_1.Modal, { size: size, content: children }
|
|
36
|
+
return (0, jsx_runtime_1.jsx)(Modal_1.Modal, { size: size, content: children });
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
|
-
return (0, jsx_runtime_1.jsx)("div", { children: "dummy content" }
|
|
39
|
+
return (0, jsx_runtime_1.jsx)("div", { children: "dummy content" });
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
exports.OpenModal = OpenModal;
|
|
@@ -24,19 +24,19 @@ function TestModalContent(props) {
|
|
|
24
24
|
const [date, setDate] = (0, react_1.useState)(formStateDomain_1.jan1);
|
|
25
25
|
const [internalValue, setValue] = (0, react_1.useState)("");
|
|
26
26
|
const { triggerNotice } = (0, Snackbar_1.useSnackbar)();
|
|
27
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalHeader, { children: props.withTag ? ((0, jsx_runtime_1.jsxs)("div",
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalHeader, { children: props.withTag ? ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.df.aic.$, children: [(0, jsx_runtime_1.jsx)("span", { children: "Modal Title with Tag" }), (0, jsx_runtime_1.jsx)(Tag_1.Tag, { text: "In progress", type: "info", xss: Css_1.Css.ml1.$ })] })) : props.withTextArea ? ((0, jsx_runtime_1.jsx)(inputs_1.TextAreaField, { label: "Title", placeholder: "Test title", value: internalValue, onChange: (v) => setValue(v), preventNewLines: true, labelStyle: "hidden", borderless: true, xss: Css_1.Css.xl.$ })) : ("The title of the modal that might wrap") }), (0, jsx_runtime_1.jsxs)(Modal_1.ModalBody, { children: [(0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.df.gap1.fdc.aifs.$, children: [(0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.df.gap1.$, children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { label: "More", onClick: () => setNumSentences(numSentences + 2) }), (0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Clear", onClick: () => setNumSentences(0) }), (0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Primary", onClick: () => setPrimaryDisabled(!primaryDisabled) }), (0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Trigger Snackbar", onClick: () => triggerNotice({ message: "Snackbar message" }) }), showLeftAction && ((0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Left Action", onClick: () => setLeftActionDisabled(!leftActionDisabled) }))] }), (0, jsx_runtime_1.jsx)("p", { children: "The body content of the modal. This content can be anything!".repeat(numSentences) })] }), withDateField && (0, jsx_runtime_1.jsx)(inputs_1.DateField, { value: date, label: "Date", onChange: setDate })] }), (0, jsx_runtime_1.jsxs)(Modal_1.ModalFooter, { xss: showLeftAction ? Css_1.Css.jcsb.$ : undefined, children: [showLeftAction && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Clear", onClick: (0, addon_actions_1.action)("Clear Action"), variant: "tertiary", disabled: leftActionDisabled }) })), (0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.df.gap1.$, children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Cancel", onClick: closeModal, variant: "tertiary" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Apply", onClick: (0, addon_actions_1.action)("Primary action"), disabled: primaryDisabled })] })] })] }));
|
|
28
28
|
}
|
|
29
29
|
exports.TestModalContent = TestModalContent;
|
|
30
30
|
function TestModalFilterTable() {
|
|
31
31
|
const [filter, setFilter] = (0, react_1.useState)();
|
|
32
32
|
const { closeModal } = (0, useModal_1.useModal)();
|
|
33
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalHeader, { children: "Filterable table" }
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalHeader, { children: "Filterable table" }), (0, jsx_runtime_1.jsxs)(Modal_1.ModalBody, { children: [(0, jsx_runtime_1.jsx)(inputs_1.TextField, { label: "Search", value: filter, onChange: setFilter }), (0, jsx_runtime_1.jsx)(Table_1.GridTable, { columns: columns, rows: rows, filter: filter, xss: Css_1.Css.mt1.$ })] }), (0, jsx_runtime_1.jsx)(Modal_1.ModalFooter, { children: (0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Cancel", onClick: closeModal, variant: "tertiary" }) })] }));
|
|
34
34
|
}
|
|
35
35
|
exports.TestModalFilterTable = TestModalFilterTable;
|
|
36
36
|
function VirtualizedTable() {
|
|
37
37
|
const [filter, setFilter] = (0, react_1.useState)();
|
|
38
38
|
const { closeModal } = (0, useModal_1.useModal)();
|
|
39
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalHeader, { children: "Filterable table" }
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalHeader, { children: "Filterable table" }), (0, jsx_runtime_1.jsx)(Modal_1.ModalBody, { virtualized: true, children: (0, jsx_runtime_1.jsxs)(Layout_1.ScrollableParent, { xss: Css_1.Css.h100.$, children: [(0, jsx_runtime_1.jsx)(inputs_1.TextField, { label: "Search", value: filter, onChange: setFilter }), (0, jsx_runtime_1.jsx)(Layout_1.ScrollableContent, { virtualized: true, children: (0, jsx_runtime_1.jsx)(Table_1.GridTable, { as: "virtual", columns: columns, rows: rows, filter: filter, xss: Css_1.Css.mt1.$ }) })] }) }), (0, jsx_runtime_1.jsx)(Modal_1.ModalFooter, { children: (0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Cancel", onClick: closeModal, variant: "tertiary" }) })] }));
|
|
40
40
|
}
|
|
41
41
|
exports.VirtualizedTable = VirtualizedTable;
|
|
42
42
|
const users = [
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -11,7 +11,7 @@ export interface NavLinkProps extends BeamFocusableProps {
|
|
|
11
11
|
openInNew?: boolean;
|
|
12
12
|
contrast?: boolean;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
type NavLinkVariant = "side" | "global";
|
|
15
15
|
export declare function NavLink(props: NavLinkProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
16
16
|
export declare function getNavLinkStyles(variant: NavLinkVariant, contrast: boolean): {
|
|
17
17
|
baseStyles: {};
|
|
@@ -39,8 +39,8 @@ function NavLink(props) {
|
|
|
39
39
|
...(isPressed && pressedStyles),
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
|
-
const linkContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [label, icon && ((0, jsx_runtime_1.jsx)("span",
|
|
43
|
-
return external ? ((0, jsx_runtime_1.jsx)("a",
|
|
42
|
+
const linkContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [label, icon && ((0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.ml1.$, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: icon }) }))] }));
|
|
43
|
+
return external ? ((0, jsx_runtime_1.jsx)("a", { href: href, ...(0, react_aria_1.mergeProps)(otherButtonProps, focusProps, hoverProps), ...linkAttributes, children: linkContent })) : ((0, jsx_runtime_1.jsx)(react_router_dom_1.Link, { to: href, ...(0, react_aria_1.mergeProps)(otherButtonProps, focusProps, hoverProps), ...linkAttributes, children: linkContent }));
|
|
44
44
|
}
|
|
45
45
|
exports.NavLink = NavLink;
|
|
46
46
|
function getNavLinkStyles(variant, contrast) {
|
|
@@ -3,7 +3,8 @@ import { GridStyle } from "./Table";
|
|
|
3
3
|
import { Typography } from "../Css";
|
|
4
4
|
export interface PresentationFieldProps {
|
|
5
5
|
numberAlignment?: "left" | "right";
|
|
6
|
-
|
|
6
|
+
/** Sets the label position or visibility. Defaults to "above" */
|
|
7
|
+
labelStyle?: "inline" | "hidden" | "above" | "left";
|
|
7
8
|
labelSuffix?: LabelSuffixStyle;
|
|
8
9
|
borderless?: boolean;
|
|
9
10
|
compact?: boolean;
|
|
@@ -11,7 +12,7 @@ export interface PresentationFieldProps {
|
|
|
11
12
|
visuallyDisabled?: false;
|
|
12
13
|
errorInTooltip?: true;
|
|
13
14
|
}
|
|
14
|
-
export
|
|
15
|
+
export type PresentationContextProps = {
|
|
15
16
|
fieldProps?: PresentationFieldProps;
|
|
16
17
|
gridTableStyle?: GridStyle;
|
|
17
18
|
wrap?: boolean;
|
|
@@ -25,7 +26,7 @@ export declare function usePresentationContext(): PresentationContextProps;
|
|
|
25
26
|
* We may want to just hard-code this behavior, so that it's very consistent,
|
|
26
27
|
* but for now making it configurable.
|
|
27
28
|
*/
|
|
28
|
-
export
|
|
29
|
+
export type LabelSuffixStyle = {
|
|
29
30
|
/** The suffix to use for required fields. */
|
|
30
31
|
required?: string;
|
|
31
32
|
/** The suffix to use for explicitly optional (i.e. `required=false`) fields. */
|
|
@@ -12,7 +12,7 @@ function PresentationProvider(props) {
|
|
|
12
12
|
const fieldProps = { ...existingContext.fieldProps, ...presentationProps.fieldProps };
|
|
13
13
|
return { ...existingContext, ...presentationProps, fieldProps };
|
|
14
14
|
}, [presentationProps, existingContext]);
|
|
15
|
-
return (0, jsx_runtime_1.jsx)(exports.PresentationContext.Provider,
|
|
15
|
+
return (0, jsx_runtime_1.jsx)(exports.PresentationContext.Provider, { value: context, children: children });
|
|
16
16
|
}
|
|
17
17
|
exports.PresentationProvider = PresentationProvider;
|
|
18
18
|
function usePresentationContext() {
|
|
@@ -8,7 +8,7 @@ const utils_1 = require("../../utils");
|
|
|
8
8
|
function Snackbar({ notices, offset }) {
|
|
9
9
|
var _a;
|
|
10
10
|
const tid = (0, utils_1.useTestIds)({});
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)("div", { ...tid.snackbarWrapper, css: Css_1.Css.fixed.z999.bottomPx((_a = offset.bottom) !== null && _a !== void 0 ? _a : defaultOffset.bottom).left3.df.fdc.aifs.gapPx(12).$, children: notices.map((data) => ((0, jsx_runtime_1.jsx)(SnackbarNotice_1.SnackbarNotice, { ...data }, data.id))) }));
|
|
12
12
|
}
|
|
13
13
|
exports.Snackbar = Snackbar;
|
|
14
14
|
const defaultOffset = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
2
|
import { SnackbarNoticeProps } from "./SnackbarNotice";
|
|
3
3
|
import { Offset } from "./Snackbar";
|
|
4
|
-
export
|
|
4
|
+
export type SnackbarContextProps = {
|
|
5
5
|
setNotices: React.Dispatch<React.SetStateAction<SnackbarNoticeProps[]>>;
|
|
6
6
|
setOffset: React.Dispatch<React.SetStateAction<Offset>>;
|
|
7
7
|
};
|
|
@@ -9,7 +9,7 @@ function SnackbarProvider(props) {
|
|
|
9
9
|
const [notices, setNotices] = (0, react_1.useState)([]);
|
|
10
10
|
const [offset, setOffset] = (0, react_1.useState)({});
|
|
11
11
|
const contextValue = (0, react_1.useMemo)(() => ({ setNotices, setOffset }), []);
|
|
12
|
-
return ((0, jsx_runtime_1.jsxs)(exports.SnackbarContext.Provider,
|
|
12
|
+
return ((0, jsx_runtime_1.jsxs)(exports.SnackbarContext.Provider, { value: contextValue, children: [props.children, (0, jsx_runtime_1.jsx)(Snackbar_1.Snackbar, { notices: notices, offset: offset })] }));
|
|
13
13
|
}
|
|
14
14
|
exports.SnackbarProvider = SnackbarProvider;
|
|
15
15
|
function useSnackbarContext() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { ButtonProps } from "../Button";
|
|
3
|
-
export
|
|
3
|
+
export type SnackbarNoticeTypes = "error" | "warning" | "success" | "info" | "alert";
|
|
4
4
|
export interface SnackbarNoticeProps {
|
|
5
5
|
/** Adds action button to the right of the notice */
|
|
6
6
|
action?: Pick<ButtonProps, "label" | "onClick" | "variant">;
|
|
@@ -12,7 +12,7 @@ function SnackbarNotice(props) {
|
|
|
12
12
|
const tid = (0, utils_1.useTestIds)(props, "snackbar");
|
|
13
13
|
// Only allow the "close" button to be hidden if not a `persistent` notice. Otherwise we could get in a state where the user cannot remove the notice from the screen.
|
|
14
14
|
const reallyHideClose = hideCloseButton && !persistent;
|
|
15
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.white.bgGray800.br4.base.df.aic.maxwPx(420).$, ...tid, role: "alert", children: [icon && ((0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.fs0.plPx(12).$, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { ...typeToIcon[icon], ...tid.icon }) })), (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.lineClamp3.pr2.myPx(12).plPx(icon ? 8 : 16).$, ...(typeof message === "string" ? { title: message } : undefined), ...tid.message, children: message }), (action || !reallyHideClose) && ((0, jsx_runtime_1.jsxs)("span", { css: Css_1.Css.fs0.df.aic.$, children: [action && ((0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.ttu.sm.prPx(!reallyHideClose && action.variant !== "text" ? 4 : 8).$, children: (0, jsx_runtime_1.jsx)(Button_1.Button, { contrast: true, ...action, ...tid.action }) })), !reallyHideClose && ((0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.pr1.add("lineHeight", 0).$, children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { icon: "x", contrast: true, onClick: onClose, ...tid.close }) }))] }))] }));
|
|
16
16
|
}
|
|
17
17
|
exports.SnackbarNotice = SnackbarNotice;
|
|
18
18
|
const typeToIcon = {
|
|
@@ -19,15 +19,15 @@ function Stepper(props) {
|
|
|
19
19
|
const maxStepWidth = 200;
|
|
20
20
|
const minStepWidth = 100;
|
|
21
21
|
const gap = 8;
|
|
22
|
-
return ((0, jsx_runtime_1.jsxs)("nav",
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)("nav", { "aria-label": "steps", css: Css_1.Css.df.fdc.w100.$, ...tid, children: [(0, jsx_runtime_1.jsx)("ol", { css: Css_1.Css.listReset.df.gapPx(gap).$, children: steps.map((step) => {
|
|
23
23
|
const isCurrent = currentStep === step.value;
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)("li",
|
|
25
|
-
}) }),
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)("li", { css: Css_1.Css.df.fg1.fdc.maxwPx(maxStepWidth).mwPx(minStepWidth).$, "aria-current": isCurrent, ...tid.step, children: (0, jsx_runtime_1.jsx)(StepButton, { ...step, onClick: () => onChange(step.value), isCurrent: isCurrent, ...tid.stepButton }) }, step.label));
|
|
25
|
+
}) }), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.mt1.bgGray300
|
|
26
26
|
.hPx(4)
|
|
27
27
|
.maxwPx(steps.length * maxStepWidth + (steps.length - 1) * gap)
|
|
28
|
-
.mwPx(steps.length * minStepWidth + (steps.length - 1) * gap).w100
|
|
28
|
+
.mwPx(steps.length * minStepWidth + (steps.length - 1) * gap).w100.$, children: (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.bgLightBlue600
|
|
29
29
|
.add("transition", "width 200ms")
|
|
30
|
-
.h100.w(`${((lastCompletedStep + 1) / steps.length) * 100}%`).$ }
|
|
30
|
+
.h100.w(`${((lastCompletedStep + 1) / steps.length) * 100}%`).$ }) })] }));
|
|
31
31
|
}
|
|
32
32
|
exports.Stepper = Stepper;
|
|
33
33
|
function StepButton(props) {
|
|
@@ -39,7 +39,7 @@ function StepButton(props) {
|
|
|
39
39
|
const { hoverProps, isHovered } = (0, react_aria_1.useHover)(ariaProps);
|
|
40
40
|
const focusRingStyles = state === "error" ? Css_1.Css.bshDanger.$ : Css_1.Css.bshFocus.$;
|
|
41
41
|
const tid = (0, utils_1.useTestIds)(props, "stepButton");
|
|
42
|
-
return ((0, jsx_runtime_1.jsxs)("button",
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)("button", { ref: ref, ...buttonProps, ...focusProps, ...hoverProps, css: {
|
|
43
43
|
...Css_1.Css.buttonBase.$,
|
|
44
44
|
...Css_1.Css.tl.w100.h100.sm.gray700.add("whiteSpace", "initial").if(state === "error").red600.$,
|
|
45
45
|
...(isCurrent ? Css_1.Css.lightBlue700.if(state === "error").red800.$ : {}),
|
|
@@ -47,19 +47,19 @@ function StepButton(props) {
|
|
|
47
47
|
...(isPressed ? Css_1.Css.lightBlue500.if(state === "error").red900.$ : {}),
|
|
48
48
|
...(disabled ? Css_1.Css.gray400.cursorNotAllowed.if(state === "error").red200.$ : {}),
|
|
49
49
|
...(isFocusVisible ? focusRingStyles : {}),
|
|
50
|
-
}
|
|
50
|
+
}, ...tid[(0, defaultTestId_1.defaultTestId)(label)], children: [(0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.fs0.mrPx(4).$, children: (0, jsx_runtime_1.jsx)(StepIcon, { state: state, isHovered: isHovered, isPressed: isPressed, isCurrent: isCurrent }) }), label] }));
|
|
51
51
|
}
|
|
52
52
|
function StepIcon({ state, isHovered = false, isPressed = false, isCurrent = false }) {
|
|
53
53
|
if (state === "error") {
|
|
54
|
-
return (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "errorCircle" }
|
|
54
|
+
return (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "errorCircle" });
|
|
55
55
|
}
|
|
56
56
|
if (state === "complete") {
|
|
57
|
-
return (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "check" }
|
|
57
|
+
return (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "check" });
|
|
58
58
|
}
|
|
59
59
|
// Otherwise state is "incomplete", return the custom circle "icon"
|
|
60
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.wPx(24).hPx(24).df.aic.jcc.$, children: (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.wPx(10)
|
|
61
61
|
.hPx(10)
|
|
62
62
|
.ba.bw2.br100.add("color", "currentColor")
|
|
63
63
|
.if(isHovered || isPressed || isCurrent)
|
|
64
|
-
.add("backgroundColor", "currentColor").$ }
|
|
64
|
+
.add("backgroundColor", "currentColor").$ }) }));
|
|
65
65
|
}
|
|
@@ -14,10 +14,10 @@ function ConfirmCloseModal(props) {
|
|
|
14
14
|
// after a close and could/will cause other close attempts to fail.
|
|
15
15
|
modalState.current = undefined;
|
|
16
16
|
}
|
|
17
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.ModalHeader, { children: "Are you sure you want to cancel?" }
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.ModalHeader, { children: "Are you sure you want to cancel?" }), (0, jsx_runtime_1.jsx)(components_1.ModalBody, { children: (0, jsx_runtime_1.jsx)("p", { children: "Any changes you've made so far will be lost." }) }), (0, jsx_runtime_1.jsxs)(components_1.ModalFooter, { children: [(0, jsx_runtime_1.jsx)(components_1.Button, { variant: "tertiary", label: discardText, onClick: () => {
|
|
18
18
|
// The order of these calls doesn't really matter; close this modal and tell the call to do their close
|
|
19
19
|
onClose();
|
|
20
20
|
closeModal();
|
|
21
|
-
} }
|
|
21
|
+
} }), (0, jsx_runtime_1.jsx)(components_1.Button, { label: continueText, onClick: closeModal })] })] }));
|
|
22
22
|
}
|
|
23
23
|
exports.ConfirmCloseModal = ConfirmCloseModal;
|