@homebound/beam 2.123.4 → 2.124.2

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.
@@ -318,6 +318,8 @@ function renderVirtual(style, id, columns, headerRows, filteredRows, firstRowMes
318
318
  tableRef.current = ref;
319
319
  }
320
320
  }, components: {
321
+ // Applying a zIndex: 2 to ensure it stays on top of sticky columns
322
+ TopItemList: react_1.default.forwardRef((props, ref) => ((0, jsx_runtime_1.jsx)("div", Object.assign({}, props, { ref: ref, style: { ...props.style, ...{ zIndex: 2 } } }), void 0))),
321
323
  List: VirtualRoot(listStyle, columns, id, firstLastColumnWidth, xss),
322
324
  Footer: () => (0, jsx_runtime_1.jsx)("div", { css: footerStyle }, void 0),
323
325
  },
@@ -4,5 +4,6 @@ export interface DatePickerProps {
4
4
  value?: Date;
5
5
  onSelect: (value: Date) => void;
6
6
  disabledDays?: Modifier | Modifier[];
7
+ dottedDays?: Modifier[];
7
8
  }
8
9
  export declare function DatePicker(props: DatePickerProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -11,7 +11,7 @@ const Css_1 = require("../../Css");
11
11
  const utils_1 = require("../../utils");
12
12
  require("./DatePicker.css");
13
13
  function DatePicker(props) {
14
- const { value, onSelect, disabledDays } = props;
14
+ const { value, onSelect, disabledDays, dottedDays } = props;
15
15
  const tid = (0, utils_1.useTestIds)(props, "datePicker");
16
16
  return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
17
17
  ...Css_1.Css.dib.bgWhite.xs.$,
@@ -20,7 +20,7 @@ function DatePicker(props) {
20
20
  // Un-collapse the borders so we can hover each cell
21
21
  "& .DayPicker-Month": Css_1.Css.add({ borderCollapse: "separate" }).$,
22
22
  // // Make the boxes smaller, this ends up being 32x32 which matches figma
23
- "& .DayPicker-Day": Css_1.Css.pPx(8).xs.ba.bWhite.br4.$,
23
+ "& .DayPicker-Day": Css_1.Css.px1.ptPx(6).pbPx(10).xs.ba.bWhite.br4.relative.$,
24
24
  // For today, use a background
25
25
  "& .DayPicker-Day--today": Css_1.Css.bgGray100.$,
26
26
  // For selected, use a background - `--outside` modifier is set on placeholder days not within the viewed month
@@ -33,12 +33,16 @@ function DatePicker(props) {
33
33
  "& .DayPicker-Day--disabled": Css_1.Css.cursorNotAllowed.$,
34
34
  // Override `.DayPicker-Day:active` background when the day is disabled
35
35
  "& .DayPicker-Day--disabled:active": Css_1.Css.bgWhite.$,
36
+ // Display dottedDays using positioned pseudo elements.
37
+ "& .DayPicker-Day--indicatorDot": Css_1.Css.addIn("&:after", Css_1.Css.wPx(4).hPx(4).br4.absolute.bottomPx(5).left("calc(50% - 2px)").bgLightBlue700.add("content", "''").$).$,
38
+ // Update dottedDays color if day is "selected"
39
+ "& .DayPicker-Day--selected.DayPicker-Day--indicatorDot": Css_1.Css.addIn("&:after", Css_1.Css.bgWhite.$).$,
36
40
  } }, tid, { children: (0, jsx_runtime_1.jsx)(react_day_picker_1.default, { navbarElement: NavbarElement, weekdayElement: Weekday, selectedDays: [value], initialMonth: value !== null && value !== void 0 ? value : new Date(), onDayClick: (day, modifiers) => {
37
41
  if (modifiers.disabled)
38
42
  return;
39
43
  // Set the day value
40
44
  onSelect(day);
41
- }, disabledDays: disabledDays }, void 0) }), void 0));
45
+ }, disabledDays: disabledDays, modifiers: { indicatorDot: dottedDays } }, void 0) }), void 0));
42
46
  }
43
47
  exports.DatePicker = DatePicker;
44
48
  /** Customize the prev/next button to be our SVG icons. */
@@ -1,6 +1,6 @@
1
1
  import { FieldState } from "@homebound/form-state";
2
2
  import { SwitchProps } from "../inputs";
3
- export declare type BoundSwitchFieldProps = Omit<SwitchProps, "selected" | "onChange" | "label" | "labelStyle"> & {
3
+ export declare type BoundSwitchFieldProps = Omit<SwitchProps, "selected" | "onChange" | "label"> & {
4
4
  field: FieldState<any, boolean | null | undefined>;
5
5
  /** Make optional so that callers can override if they want to. */
6
6
  onChange?: (value: boolean) => void;
@@ -8,11 +8,11 @@ const utils_1 = require("../utils");
8
8
  const defaultLabel_1 = require("../utils/defaultLabel");
9
9
  /** Wraps `Switch` and binds it to a form field. */
10
10
  function BoundSwitchField(props) {
11
- const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), ...others } = props;
11
+ const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), labelStyle = "form", ...others } = props;
12
12
  const testId = (0, utils_1.useTestIds)(props, field.key);
13
13
  return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => {
14
14
  var _a;
15
- return ((0, jsx_runtime_1.jsx)(inputs_1.Switch, Object.assign({ label: label, labelStyle: "form", selected: (_a = field.value) !== null && _a !== void 0 ? _a : false, onChange: (selected) => {
15
+ return ((0, jsx_runtime_1.jsx)(inputs_1.Switch, Object.assign({ label: label, labelStyle: labelStyle, selected: (_a = field.value) !== null && _a !== void 0 ? _a : false, onChange: (selected) => {
16
16
  onChange(selected);
17
17
  field.maybeAutoSave();
18
18
  } }, testId, others), void 0));
@@ -1,14 +1,17 @@
1
+ import { ReactNode } from "react";
1
2
  export interface SwitchProps {
2
3
  /** Whether the element should receive focus on render. */
3
4
  autoFocus?: boolean;
4
5
  /** Whether to render a compact version of Switch */
5
6
  compact?: boolean;
6
- /** Whether the interactive element is disabled. */
7
- disabled?: boolean;
7
+ /** Whether the field is disabled. If a ReactNode, it's treated as a "disabled reason" that's shown in a tooltip. */
8
+ disabled?: boolean | ReactNode;
8
9
  /** Input label */
9
10
  label: string;
10
11
  /** Where to put the label. */
11
12
  labelStyle?: "form" | "inline" | "filter";
13
+ /** Whether or not to hide the label */
14
+ hideLabel?: boolean;
12
15
  /** Handler when the interactive element state changes. */
13
16
  onChange: (value: boolean) => void;
14
17
  /** Whether the switch is selected */
@@ -4,39 +4,46 @@ exports.switchSelectedHoverStyles = exports.switchFocusStyles = exports.switchHo
4
4
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const react_aria_1 = require("react-aria");
7
+ const components_1 = require("../components");
7
8
  const Label_1 = require("../components/Label");
8
9
  const Css_1 = require("../Css");
9
10
  const Icon_1 = require("../components/Icon");
10
11
  const utils_1 = require("../utils");
11
12
  function Switch(props) {
12
- const { selected: isSelected, disabled: isDisabled = false, onChange, withIcon, compact = false, label, labelStyle = "inline", ...otherProps } = props;
13
+ const { selected: isSelected, disabled = false, onChange, withIcon, compact = false, label, labelStyle = "inline", hideLabel = false, ...otherProps } = props;
14
+ const isDisabled = !!disabled;
13
15
  const ariaProps = { isSelected, isDisabled, ...otherProps };
14
16
  const state = (0, utils_1.toToggleState)(isSelected, onChange);
15
17
  const ref = (0, react_1.useRef)(null);
16
18
  const { inputProps } = (0, react_aria_1.useSwitch)({ ...ariaProps, "aria-label": label }, state, ref);
17
19
  const { isFocusVisible: isKeyboardFocus, focusProps } = (0, react_aria_1.useFocusRing)(otherProps);
18
20
  const { hoverProps, isHovered } = (0, react_aria_1.useHover)(ariaProps);
19
- return ((0, jsx_runtime_1.jsxs)("label", Object.assign({}, hoverProps, { css: {
20
- ...Css_1.Css.relative.cursorPointer.df.w("max-content").smEm.selectNone.$,
21
- ...(labelStyle === "form" && Css_1.Css.fdc.$),
22
- ...(labelStyle === "inline" && Css_1.Css.childGap2.aic.$),
23
- ...(labelStyle === "filter" && Css_1.Css.jcsb.aic.w("auto").sm.$),
24
- ...(isDisabled && Css_1.Css.cursorNotAllowed.gray400.$),
25
- } }, { children: [labelStyle === "form" && (0, jsx_runtime_1.jsx)(Label_1.Label, { label: label }, void 0), labelStyle === "filter" && (0, jsx_runtime_1.jsx)("span", { children: label }, void 0), (0, jsx_runtime_1.jsx)("div", Object.assign({ "aria-hidden": "true", css: {
26
- ...Css_1.Css.wPx(toggleWidth(compact)).hPx(toggleHeight(compact)).bgGray200.br12.relative.transition.$,
27
- ...(isHovered && exports.switchHoverStyles),
28
- ...(isKeyboardFocus && exports.switchFocusStyles),
29
- ...(isDisabled && Css_1.Css.bgGray300.$),
30
- ...(isSelected && Css_1.Css.bgLightBlue700.$),
31
- ...(isSelected && isHovered && exports.switchSelectedHoverStyles),
32
- } }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
33
- ...switchCircleDefaultStyles(compact),
34
- ...(isDisabled && Css_1.Css.bgGray100.$),
35
- ...(isSelected && switchCircleSelectedStyles(compact)),
36
- } }, { children: withIcon && ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: isSelected ? "check" : "x", color: isSelected ? Css_1.Palette.LightBlue700 : Css_1.Palette.Gray400 }, void 0)) }), void 0) }), void 0), labelStyle === "inline" && ((0, jsx_runtime_1.jsx)("span", Object.assign({ css: {
37
- // LineHeight is conditionally applied to handle compact version text alignment
38
- ...Css_1.Css.if(compact).add("lineHeight", "1").$,
39
- } }, { children: label }), void 0)), (0, jsx_runtime_1.jsx)(react_aria_1.VisuallyHidden, { children: (0, jsx_runtime_1.jsx)("input", Object.assign({ ref: ref }, inputProps, focusProps), void 0) }, void 0)] }), void 0));
21
+ const tooltip = (0, components_1.resolveTooltip)(disabled);
22
+ return (0, components_1.maybeTooltip)({
23
+ title: tooltip,
24
+ placement: "top",
25
+ children: ((0, jsx_runtime_1.jsxs)("label", Object.assign({}, hoverProps, { css: {
26
+ ...Css_1.Css.relative.cursorPointer.df.w("max-content").smEm.selectNone.$,
27
+ ...(labelStyle === "form" && Css_1.Css.fdc.$),
28
+ ...(labelStyle === "inline" && Css_1.Css.childGap2.aic.$),
29
+ ...(labelStyle === "filter" && Css_1.Css.jcsb.aic.w("auto").sm.$),
30
+ ...(isDisabled && Css_1.Css.cursorNotAllowed.gray400.$),
31
+ }, "aria-label": label }, { children: [!hideLabel && labelStyle === "form" && (0, jsx_runtime_1.jsx)(Label_1.Label, { label: label }, void 0), !hideLabel && labelStyle === "filter" && (0, jsx_runtime_1.jsx)("span", { children: label }, void 0), (0, jsx_runtime_1.jsx)("div", Object.assign({ "aria-hidden": "true", css: {
32
+ ...Css_1.Css.wPx(toggleWidth(compact)).hPx(toggleHeight(compact)).bgGray200.br12.relative.transition.$,
33
+ ...(isHovered && exports.switchHoverStyles),
34
+ ...(isKeyboardFocus && exports.switchFocusStyles),
35
+ ...(isDisabled && Css_1.Css.bgGray300.$),
36
+ ...(isSelected && Css_1.Css.bgLightBlue700.$),
37
+ ...(isSelected && isHovered && exports.switchSelectedHoverStyles),
38
+ } }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
39
+ ...switchCircleDefaultStyles(compact),
40
+ ...(isDisabled && Css_1.Css.bgGray100.$),
41
+ ...(isSelected && switchCircleSelectedStyles(compact)),
42
+ } }, { children: withIcon && ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: isSelected ? "check" : "x", color: isSelected ? Css_1.Palette.LightBlue700 : Css_1.Palette.Gray400 }, void 0)) }), void 0) }), void 0), !hideLabel && labelStyle === "inline" && ((0, jsx_runtime_1.jsx)("span", Object.assign({ css: {
43
+ // LineHeight is conditionally applied to handle compact version text alignment
44
+ ...Css_1.Css.if(compact).add("lineHeight", "1").$,
45
+ } }, { children: label }), void 0)), (0, jsx_runtime_1.jsx)(react_aria_1.VisuallyHidden, { children: (0, jsx_runtime_1.jsx)("input", Object.assign({ ref: ref }, inputProps, focusProps), void 0) }, void 0)] }), void 0)),
46
+ });
40
47
  }
41
48
  exports.Switch = Switch;
42
49
  /** Styles */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.123.4",
3
+ "version": "2.124.2",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -48,7 +48,7 @@
48
48
  "react-router": "^5.2.0",
49
49
  "react-router-dom": "^5.2.0",
50
50
  "react-stately": "^3.12.2",
51
- "react-virtuoso": "^2.4.0",
51
+ "react-virtuoso": "2.10.2",
52
52
  "tributejs": "^5.1.3",
53
53
  "trix": "^1.3.1",
54
54
  "use-debounce": "^7.0.1",