@homebound/beam 2.383.0 → 2.383.1

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/index.cjs CHANGED
@@ -11042,13 +11042,15 @@ function CheckboxGroup(props) {
11042
11042
  helperText,
11043
11043
  onBlur,
11044
11044
  onFocus,
11045
- columns = 1
11045
+ columns = 1,
11046
+ required
11046
11047
  } = props;
11047
11048
  const state = (0, import_react_stately10.useCheckboxGroupState)({ ...props, value: values });
11048
11049
  const { groupProps, labelProps } = (0, import_react_aria30.useCheckboxGroup)(props, state);
11049
11050
  const tid = useTestIds(props);
11051
+ const labelSuffix = useLabelSuffix(required, false);
11050
11052
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { ...groupProps, css: Css.if(labelStyle === "left").df.fdr.$, onBlur, onFocus, ...tid, children: [
11051
- labelStyle !== "hidden" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { css: Css.if(labelStyle === "left").w50.$, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Label, { label, ...labelProps, ...tid.label }) }),
11053
+ labelStyle !== "hidden" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { css: Css.if(labelStyle === "left").w50.$, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Label, { label, ...labelProps, ...tid.label, suffix: labelSuffix }) }),
11052
11054
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { css: Css.dg.gtc(`repeat(${columns}, auto)`).gap2.$, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11053
11055
  CheckboxGroupItem,
11054
11056
  {
@@ -12363,12 +12365,22 @@ var import_jsx_runtime76 = require("@emotion/react/jsx-runtime");
12363
12365
  function ToggleChipGroup(props) {
12364
12366
  const { fieldProps } = usePresentationContext();
12365
12367
  const { labelLeftFieldWidth = "50%" } = fieldProps ?? {};
12366
- const { values, label, labelStyle = fieldProps?.labelStyle ?? "above", options, xss } = props;
12368
+ const { values, label, labelStyle = fieldProps?.labelStyle ?? "above", options, required, xss } = props;
12367
12369
  const state = (0, import_react_stately16.useCheckboxGroupState)({ ...props, value: values });
12368
12370
  const { groupProps, labelProps } = (0, import_react_aria39.useCheckboxGroup)(props, state);
12369
12371
  const tid = useTestIds(props, "toggleChip");
12372
+ const labelSuffix = useLabelSuffix(required, false);
12370
12373
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { ...groupProps, css: Css.relative.df.fdc.if(labelStyle === "left").fdr.gap2.maxw100.jcsb.$, children: [
12371
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Label, { label, ...labelProps, hidden: labelStyle === "hidden", inline: labelStyle !== "above" }),
12374
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
12375
+ Label,
12376
+ {
12377
+ label,
12378
+ ...labelProps,
12379
+ hidden: labelStyle === "hidden",
12380
+ inline: labelStyle !== "above",
12381
+ suffix: labelSuffix
12382
+ }
12383
+ ),
12372
12384
  /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
12373
12385
  "div",
12374
12386
  {
@@ -14362,7 +14374,7 @@ function SuperDrawer() {
14362
14374
  }
14363
14375
 
14364
14376
  // src/components/Layout/FormPageLayout.tsx
14365
- var import_mobx_react20 = require("mobx-react");
14377
+ var import_mobx_react21 = require("mobx-react");
14366
14378
  var import_react84 = __toESM(require("react"), 1);
14367
14379
  var import_react_aria43 = require("react-aria");
14368
14380
 
@@ -14430,6 +14442,7 @@ function BoundCheckboxGroupField(props) {
14430
14442
  CheckboxGroup,
14431
14443
  {
14432
14444
  label,
14445
+ required: field.required,
14433
14446
  values: field.value || [],
14434
14447
  onChange: (values) => {
14435
14448
  onChange(values);
@@ -15084,7 +15097,17 @@ var import_jsx_runtime109 = require("@emotion/react/jsx-runtime");
15084
15097
  function BoundToggleChipGroupField(props) {
15085
15098
  const { field, onChange = (value) => field.set(value), label = defaultLabel(field.key), ...others } = props;
15086
15099
  const testId = useTestIds(props, field.key);
15087
- return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_mobx_react18.Observer, { children: () => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ToggleChipGroup, { label, values: field.value || [], onChange, ...testId, ...others }) });
15100
+ return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_mobx_react18.Observer, { children: () => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
15101
+ ToggleChipGroup,
15102
+ {
15103
+ label,
15104
+ required: field.required,
15105
+ values: field.value || [],
15106
+ onChange,
15107
+ ...testId,
15108
+ ...others
15109
+ }
15110
+ ) });
15088
15111
  }
15089
15112
 
15090
15113
  // src/forms/BoundTreeSelectField.tsx
@@ -15438,21 +15461,26 @@ function StaticField(props) {
15438
15461
  }
15439
15462
 
15440
15463
  // src/forms/SubmitButton.tsx
15464
+ var import_mobx_react20 = require("mobx-react");
15441
15465
  var import_jsx_runtime117 = require("@emotion/react/jsx-runtime");
15442
15466
  function SubmitButton(props) {
15443
15467
  const { form, disabled, onClick, label = "Submit", ...others } = props;
15444
15468
  if (typeof onClick === "string") {
15445
15469
  throw new Error("SubmitButton.onClick doesn't support strings yet");
15446
15470
  }
15447
- const dirty = useComputed(() => form.dirty, [form]);
15471
+ const state = (0, import_mobx_react20.useLocalObservable)(() => ({ clicked: false }));
15472
+ const canSubmit = useComputed(() => {
15473
+ return form.isNewEntity && !state.clicked ? true : form.dirty && form.valid;
15474
+ }, [form]);
15448
15475
  return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
15449
15476
  Button,
15450
15477
  {
15451
15478
  label,
15452
- disabled: disabled || !dirty,
15479
+ disabled: disabled || !canSubmit,
15453
15480
  onClick: (e) => {
15481
+ state.clicked = true;
15454
15482
  if (form.canSave()) {
15455
- void onClick(e);
15483
+ return onClick(e);
15456
15484
  }
15457
15485
  },
15458
15486
  ...others
@@ -15518,7 +15546,7 @@ function PageHeader(props) {
15518
15546
  breadCrumb && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(PageHeaderBreadcrumbs, { breadcrumb: breadCrumb }),
15519
15547
  /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("h1", { css: Css.xl3Sb.$, ...tids.pageTitle, children: pageTitle })
15520
15548
  ] }),
15521
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(import_mobx_react20.Observer, { children: () => /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { css: Css.df.gap1.$, children: [
15549
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(import_mobx_react21.Observer, { children: () => /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { css: Css.df.gap1.$, children: [
15522
15550
  tertiaryAction && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
15523
15551
  Button,
15524
15552
  {