@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.
Files changed (241) hide show
  1. package/dist/Css.d.ts +9 -9
  2. package/dist/components/Accordion.d.ts +1 -1
  3. package/dist/components/Accordion.js +4 -4
  4. package/dist/components/AccordionList.js +1 -1
  5. package/dist/components/AutoSaveIndicator.js +5 -5
  6. package/dist/components/Avatar.d.ts +1 -1
  7. package/dist/components/Avatar.js +2 -2
  8. package/dist/components/AvatarButton.js +1 -1
  9. package/dist/components/BeamContext.js +1 -1
  10. package/dist/components/Button.d.ts +2 -2
  11. package/dist/components/Button.js +1 -1
  12. package/dist/components/ButtonDatePicker.js +2 -2
  13. package/dist/components/ButtonGroup.d.ts +2 -2
  14. package/dist/components/ButtonGroup.js +6 -6
  15. package/dist/components/ButtonMenu.d.ts +5 -5
  16. package/dist/components/ButtonMenu.js +1 -1
  17. package/dist/components/ButtonModal.js +1 -1
  18. package/dist/components/Chip.d.ts +1 -1
  19. package/dist/components/Chip.js +2 -2
  20. package/dist/components/Chips.d.ts +1 -1
  21. package/dist/components/Chips.js +3 -3
  22. package/dist/components/Copy.js +2 -2
  23. package/dist/components/CssReset.js +1 -1
  24. package/dist/components/Filters/BooleanFilter.d.ts +1 -1
  25. package/dist/components/Filters/BooleanFilter.js +3 -3
  26. package/dist/components/Filters/DateFilter.d.ts +2 -2
  27. package/dist/components/Filters/DateFilter.js +2 -2
  28. package/dist/components/Filters/DateRangeFilter.d.ts +2 -2
  29. package/dist/components/Filters/DateRangeFilter.js +2 -2
  30. package/dist/components/Filters/FilterModal.js +4 -4
  31. package/dist/components/Filters/Filters.d.ts +2 -2
  32. package/dist/components/Filters/Filters.js +8 -8
  33. package/dist/components/Filters/MultiFilter.d.ts +1 -1
  34. package/dist/components/Filters/MultiFilter.js +4 -4
  35. package/dist/components/Filters/NumberRangeFilter.d.ts +2 -2
  36. package/dist/components/Filters/NumberRangeFilter.js +5 -5
  37. package/dist/components/Filters/SingleFilter.d.ts +1 -1
  38. package/dist/components/Filters/SingleFilter.js +1 -1
  39. package/dist/components/Filters/ToggleFilter.d.ts +1 -1
  40. package/dist/components/Filters/ToggleFilter.js +2 -2
  41. package/dist/components/Filters/index.js +5 -1
  42. package/dist/components/Filters/testDomain.d.ts +9 -9
  43. package/dist/components/Filters/types.d.ts +2 -2
  44. package/dist/components/HbLoadingSpinner.js +9 -5
  45. package/dist/components/HelperText.js +1 -1
  46. package/dist/components/Icon.d.ts +1 -1
  47. package/dist/components/Icon.js +97 -97
  48. package/dist/components/IconButton.js +1 -1
  49. package/dist/components/Label.js +3 -3
  50. package/dist/components/Layout/PreventBrowserScroll.js +1 -1
  51. package/dist/components/Layout/RightPaneLayout/RightPaneContext.d.ts +1 -1
  52. package/dist/components/Layout/RightPaneLayout/RightPaneContext.js +6 -2
  53. package/dist/components/Layout/RightPaneLayout/RightPaneLayout.js +3 -3
  54. package/dist/components/Layout/RightPaneLayout/index.js +5 -1
  55. package/dist/components/Layout/ScrollableContent.d.ts +9 -1
  56. package/dist/components/Layout/ScrollableContent.js +12 -4
  57. package/dist/components/Layout/ScrollableParent.d.ts +24 -0
  58. package/dist/components/Layout/ScrollableParent.js +26 -2
  59. package/dist/components/Layout/index.js +5 -1
  60. package/dist/components/Loader.js +1 -1
  61. package/dist/components/LoadingSkeleton.d.ts +2 -2
  62. package/dist/components/LoadingSkeleton.js +1 -1
  63. package/dist/components/Modal/Modal.d.ts +3 -3
  64. package/dist/components/Modal/Modal.js +5 -5
  65. package/dist/components/Modal/OpenModal.js +2 -2
  66. package/dist/components/Modal/TestModalContent.js +3 -3
  67. package/dist/components/Modal/index.js +5 -1
  68. package/dist/components/NavLink.d.ts +1 -1
  69. package/dist/components/NavLink.js +2 -2
  70. package/dist/components/PresentationContext.d.ts +4 -3
  71. package/dist/components/PresentationContext.js +1 -1
  72. package/dist/components/Snackbar/Snackbar.d.ts +1 -1
  73. package/dist/components/Snackbar/Snackbar.js +1 -1
  74. package/dist/components/Snackbar/SnackbarContext.d.ts +1 -1
  75. package/dist/components/Snackbar/SnackbarContext.js +1 -1
  76. package/dist/components/Snackbar/SnackbarNotice.d.ts +1 -1
  77. package/dist/components/Snackbar/SnackbarNotice.js +1 -1
  78. package/dist/components/Stepper.js +11 -11
  79. package/dist/components/SuperDrawer/ConfirmCloseModal.js +2 -2
  80. package/dist/components/SuperDrawer/SuperDrawer.js +3 -3
  81. package/dist/components/SuperDrawer/SuperDrawerContent.js +3 -3
  82. package/dist/components/SuperDrawer/components/SuperDrawerHeader.js +2 -2
  83. package/dist/components/SuperDrawer/index.js +5 -1
  84. package/dist/components/SuperDrawer/useSuperDrawer.d.ts +1 -1
  85. package/dist/components/SuperDrawer/useSuperDrawer.js +2 -2
  86. package/dist/components/Table/GridTable.d.ts +1 -1
  87. package/dist/components/Table/GridTable.js +34 -30
  88. package/dist/components/Table/GridTableApi.d.ts +1 -1
  89. package/dist/components/Table/TableActions.d.ts +1 -1
  90. package/dist/components/Table/TableActions.js +1 -1
  91. package/dist/components/Table/TableStyles.d.ts +1 -1
  92. package/dist/components/Table/components/CollapseToggle.js +1 -1
  93. package/dist/components/Table/components/EditColumnsButton.js +2 -2
  94. package/dist/components/Table/components/ExpandableHeader.js +2 -2
  95. package/dist/components/Table/components/Row.d.ts +2 -2
  96. package/dist/components/Table/components/Row.js +7 -3
  97. package/dist/components/Table/components/SelectToggle.js +1 -1
  98. package/dist/components/Table/components/SortHeader.js +3 -3
  99. package/dist/components/Table/components/cell.d.ts +2 -2
  100. package/dist/components/Table/components/cell.js +6 -6
  101. package/dist/components/Table/index.js +5 -1
  102. package/dist/components/Table/types.d.ts +13 -13
  103. package/dist/components/Table/utils/TableState.d.ts +4 -4
  104. package/dist/components/Table/utils/columns.js +2 -2
  105. package/dist/components/Table/utils/simpleHelpers.d.ts +1 -1
  106. package/dist/components/Table/utils/utils.js +5 -5
  107. package/dist/components/Tabs.d.ts +1 -1
  108. package/dist/components/Tabs.js +7 -7
  109. package/dist/components/Tag.d.ts +2 -2
  110. package/dist/components/Tag.js +1 -1
  111. package/dist/components/Toast/Toast.d.ts +1 -1
  112. package/dist/components/Toast/Toast.js +1 -1
  113. package/dist/components/Toast/ToastContext.d.ts +1 -1
  114. package/dist/components/Toast/ToastContext.js +1 -1
  115. package/dist/components/ToggleChip.d.ts +1 -1
  116. package/dist/components/ToggleChip.js +2 -2
  117. package/dist/components/ToggleChips.d.ts +1 -1
  118. package/dist/components/ToggleChips.js +1 -1
  119. package/dist/components/Tooltip.d.ts +1 -1
  120. package/dist/components/Tooltip.js +9 -5
  121. package/dist/components/index.js +5 -1
  122. package/dist/components/internal/CompoundField.js +6 -6
  123. package/dist/components/internal/ContextualModal.js +1 -1
  124. package/dist/components/internal/DatePicker/DatePicker.js +2 -2
  125. package/dist/components/internal/DatePicker/DatePickerOverlay.js +1 -1
  126. package/dist/components/internal/DatePicker/DateRangePicker.js +2 -2
  127. package/dist/components/internal/DatePicker/Day.js +6 -6
  128. package/dist/components/internal/DatePicker/Header.js +2 -2
  129. package/dist/components/internal/DatePicker/WeekHeader.js +1 -1
  130. package/dist/components/internal/DatePicker/index.js +5 -1
  131. package/dist/components/internal/Menu.js +4 -4
  132. package/dist/components/internal/MenuItem.js +6 -6
  133. package/dist/components/internal/MenuSection.js +1 -1
  134. package/dist/components/internal/OverlayTrigger.js +1 -1
  135. package/dist/components/internal/Popover.js +1 -1
  136. package/dist/components/internal/index.js +5 -1
  137. package/dist/components/testData.d.ts +1 -1
  138. package/dist/components/testData.js +5 -5
  139. package/dist/forms/BoundCheckboxField.d.ts +1 -1
  140. package/dist/forms/BoundCheckboxField.js +3 -3
  141. package/dist/forms/BoundCheckboxGroupField.d.ts +1 -1
  142. package/dist/forms/BoundCheckboxGroupField.js +2 -2
  143. package/dist/forms/BoundChipSelectField.js +3 -3
  144. package/dist/forms/BoundDateField.d.ts +1 -1
  145. package/dist/forms/BoundDateField.js +2 -2
  146. package/dist/forms/BoundDateRangeField.d.ts +1 -1
  147. package/dist/forms/BoundDateRangeField.js +2 -2
  148. package/dist/forms/BoundMultiSelectField.d.ts +1 -1
  149. package/dist/forms/BoundMultiSelectField.js +3 -3
  150. package/dist/forms/BoundNumberField.d.ts +1 -1
  151. package/dist/forms/BoundNumberField.js +2 -2
  152. package/dist/forms/BoundRadioGroupField.d.ts +1 -1
  153. package/dist/forms/BoundRadioGroupField.js +2 -2
  154. package/dist/forms/BoundRichTextField.d.ts +1 -1
  155. package/dist/forms/BoundRichTextField.js +2 -2
  156. package/dist/forms/BoundSelectAndTextField.d.ts +2 -2
  157. package/dist/forms/BoundSelectAndTextField.js +1 -1
  158. package/dist/forms/BoundSelectField.d.ts +1 -1
  159. package/dist/forms/BoundSelectField.js +3 -3
  160. package/dist/forms/BoundSwitchField.d.ts +1 -1
  161. package/dist/forms/BoundSwitchField.js +3 -3
  162. package/dist/forms/BoundTextAreaField.d.ts +1 -1
  163. package/dist/forms/BoundTextAreaField.js +2 -2
  164. package/dist/forms/BoundTextField.d.ts +1 -1
  165. package/dist/forms/BoundTextField.js +2 -2
  166. package/dist/forms/BoundToggleChipGroupField.d.ts +1 -1
  167. package/dist/forms/BoundToggleChipGroupField.js +1 -1
  168. package/dist/forms/FormHeading.js +2 -2
  169. package/dist/forms/FormLines.d.ts +1 -1
  170. package/dist/forms/FormLines.js +5 -5
  171. package/dist/forms/FormStateApp.js +5 -5
  172. package/dist/forms/StaticField.js +1 -1
  173. package/dist/forms/StepperFormApp.js +10 -10
  174. package/dist/forms/index.js +5 -1
  175. package/dist/hooks/index.js +5 -1
  176. package/dist/hooks/useBreakpoint.d.ts +1 -1
  177. package/dist/hooks/useQueryState.d.ts +1 -1
  178. package/dist/hooks/useSessionStorage.d.ts +1 -1
  179. package/dist/index.js +5 -1
  180. package/dist/inputs/Checkbox.js +1 -1
  181. package/dist/inputs/CheckboxBase.js +6 -6
  182. package/dist/inputs/CheckboxGroup.d.ts +2 -3
  183. package/dist/inputs/CheckboxGroup.js +6 -3
  184. package/dist/inputs/ChipSelectField.d.ts +2 -2
  185. package/dist/inputs/ChipSelectField.js +14 -14
  186. package/dist/inputs/ChipTextField.js +3 -3
  187. package/dist/inputs/DateFields/DateField.js +1 -1
  188. package/dist/inputs/DateFields/DateField.mock.js +2 -2
  189. package/dist/inputs/DateFields/DateFieldBase.d.ts +1 -3
  190. package/dist/inputs/DateFields/DateFieldBase.js +8 -8
  191. package/dist/inputs/DateFields/DateRangeField.js +1 -1
  192. package/dist/inputs/DateFields/index.js +5 -1
  193. package/dist/inputs/DateFields/utils.d.ts +2 -2
  194. package/dist/inputs/ErrorMessage.js +2 -2
  195. package/dist/inputs/MultiSelectField.js +2 -2
  196. package/dist/inputs/MultiSelectField.mock.js +4 -4
  197. package/dist/inputs/NumberField.d.ts +3 -4
  198. package/dist/inputs/NumberField.js +4 -4
  199. package/dist/inputs/RadioGroupField.d.ts +2 -2
  200. package/dist/inputs/RadioGroupField.js +5 -5
  201. package/dist/inputs/RichTextField.js +3 -3
  202. package/dist/inputs/RichTextField.mock.js +2 -2
  203. package/dist/inputs/SelectField.js +2 -2
  204. package/dist/inputs/SelectField.mock.js +4 -4
  205. package/dist/inputs/Switch.d.ts +1 -1
  206. package/dist/inputs/Switch.js +6 -5
  207. package/dist/inputs/SwitchGroup.d.ts +1 -1
  208. package/dist/inputs/SwitchGroup.js +1 -1
  209. package/dist/inputs/TextAreaField.js +1 -1
  210. package/dist/inputs/TextField.d.ts +1 -2
  211. package/dist/inputs/TextField.js +1 -1
  212. package/dist/inputs/TextFieldBase.d.ts +1 -2
  213. package/dist/inputs/TextFieldBase.js +16 -16
  214. package/dist/inputs/ToggleButton.js +1 -1
  215. package/dist/inputs/ToggleChipGroup.d.ts +1 -1
  216. package/dist/inputs/ToggleChipGroup.js +3 -3
  217. package/dist/inputs/Value.d.ts +1 -1
  218. package/dist/inputs/index.js +5 -1
  219. package/dist/inputs/internal/ListBox.js +3 -3
  220. package/dist/inputs/internal/ListBoxChip.js +1 -1
  221. package/dist/inputs/internal/ListBoxSection.js +1 -1
  222. package/dist/inputs/internal/ListBoxToggleChip.js +2 -2
  223. package/dist/inputs/internal/LoadingDots.js +2 -2
  224. package/dist/inputs/internal/MenuSearchField.d.ts +0 -1
  225. package/dist/inputs/internal/MenuSearchField.js +1 -1
  226. package/dist/inputs/internal/Option.js +3 -3
  227. package/dist/inputs/internal/SelectFieldBase.d.ts +1 -3
  228. package/dist/inputs/internal/SelectFieldBase.js +3 -3
  229. package/dist/inputs/internal/SelectFieldInput.d.ts +0 -1
  230. package/dist/inputs/internal/SelectFieldInput.js +5 -5
  231. package/dist/inputs/internal/VirtualizedOptions.js +2 -2
  232. package/dist/interfaces.d.ts +1 -1
  233. package/dist/types.d.ts +4 -4
  234. package/dist/utils/getInteractiveElement.js +2 -2
  235. package/dist/utils/index.d.ts +2 -2
  236. package/dist/utils/index.js +5 -1
  237. package/dist/utils/rtl.js +1 -1
  238. package/dist/utils/sb.d.ts +2 -2
  239. package/dist/utils/sb.js +4 -4
  240. package/dist/utils/useTestIds.d.ts +1 -1
  241. package/package.json +4 -4
@@ -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.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
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];
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from "react";
2
2
  import { TabWithContent } from "./Tabs";
3
- export declare type TabValue = "tab1" | "tab2" | "tab3" | "tab4";
3
+ export type TabValue = "tab1" | "tab2" | "tab3" | "tab4";
4
4
  export declare const testTabs: TabWithContent<TabValue>[];
5
5
  export declare function TestTabContent({ content }: {
6
6
  content: ReactNode;
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TestTabContent = exports.testTabs = void 0;
4
4
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
5
  exports.testTabs = [
6
- { name: "Tab 1", value: "tab1", render: () => (0, jsx_runtime_1.jsx)(TestTabContent, { content: "Tab 1 Content" }, void 0) },
7
- { name: "Tab 2", value: "tab2", render: () => (0, jsx_runtime_1.jsx)(TestTabContent, { content: "Tab 2 Content" }, void 0) },
8
- { name: "Tab 3", value: "tab3", disabled: true, render: () => (0, jsx_runtime_1.jsx)(TestTabContent, { content: "Tab 3 Content" }, void 0) },
9
- { name: "Tab 4", value: "tab4", render: () => (0, jsx_runtime_1.jsx)(TestTabContent, { content: "Tab 4 Content" }, void 0) },
6
+ { name: "Tab 1", value: "tab1", render: () => (0, jsx_runtime_1.jsx)(TestTabContent, { content: "Tab 1 Content" }) },
7
+ { name: "Tab 2", value: "tab2", render: () => (0, jsx_runtime_1.jsx)(TestTabContent, { content: "Tab 2 Content" }) },
8
+ { name: "Tab 3", value: "tab3", disabled: true, render: () => (0, jsx_runtime_1.jsx)(TestTabContent, { content: "Tab 3 Content" }) },
9
+ { name: "Tab 4", value: "tab4", render: () => (0, jsx_runtime_1.jsx)(TestTabContent, { content: "Tab 4 Content" }) },
10
10
  ];
11
11
  function TestTabContent({ content }) {
12
- return (0, jsx_runtime_1.jsx)("div", { children: content }, void 0);
12
+ return (0, jsx_runtime_1.jsx)("div", { children: content });
13
13
  }
14
14
  exports.TestTabContent = TestTabContent;
@@ -1,6 +1,6 @@
1
1
  import { FieldState } from "@homebound/form-state";
2
2
  import { CheckboxProps } from "../inputs";
3
- export declare type BoundCheckboxFieldProps = Omit<CheckboxProps, "selected" | "onChange" | "label"> & {
3
+ export type BoundCheckboxFieldProps = Omit<CheckboxProps, "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?: (values: boolean) => void;
@@ -12,7 +12,7 @@ function BoundCheckboxField(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.Checkbox, Object.assign({ label: label, selected: (_a = field.value) !== null && _a !== void 0 ? _a : false, onChange: (selected) => {
15
+ return ((0, jsx_runtime_1.jsx)(inputs_1.Checkbox, { label: label, selected: (_a = field.value) !== null && _a !== void 0 ? _a : false, onChange: (selected) => {
16
16
  // We are triggering blur manually for checkbox fields due to its transactional nature
17
17
  onChange(selected);
18
18
  field.maybeAutoSave();
@@ -22,7 +22,7 @@ function BoundCheckboxField(props) {
22
22
  }, onBlur: () => {
23
23
  field.blur();
24
24
  (0, utils_1.maybeCall)(onBlur);
25
- }, disabled: disabled || field.readOnly }, testId, others), void 0));
26
- } }, void 0));
25
+ }, disabled: disabled || field.readOnly, ...testId, ...others }));
26
+ } }));
27
27
  }
28
28
  exports.BoundCheckboxField = BoundCheckboxField;
@@ -1,6 +1,6 @@
1
1
  import { FieldState } from "@homebound/form-state";
2
2
  import { CheckboxGroupProps } from "../inputs";
3
- export declare type BoundCheckboxGroupFieldProps = Omit<CheckboxGroupProps, "values" | "onChange" | "label"> & {
3
+ export type BoundCheckboxGroupFieldProps = Omit<CheckboxGroupProps, "values" | "onChange" | "label"> & {
4
4
  field: FieldState<any, string[] | null | undefined>;
5
5
  /** Make optional so that callers can override if they want to. */
6
6
  onChange?: (values: string[]) => void;
@@ -11,7 +11,7 @@ const defaultLabel_1 = require("../utils/defaultLabel");
11
11
  function BoundCheckboxGroupField(props) {
12
12
  const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), onBlur, onFocus, ...others } = props;
13
13
  const testId = (0, utils_1.useTestIds)(props, field.key);
14
- return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.CheckboxGroup, Object.assign({ label: label, values: field.value || [], onChange: (values) => {
14
+ return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.CheckboxGroup, { label: label, values: field.value || [], onChange: (values) => {
15
15
  onChange(values);
16
16
  field.maybeAutoSave();
17
17
  }, errorMsg: field.touched ? field.errors.join(" ") : undefined, onBlur: () => {
@@ -20,6 +20,6 @@ function BoundCheckboxGroupField(props) {
20
20
  }, onFocus: () => {
21
21
  field.focus();
22
22
  (0, utils_1.maybeCall)(onFocus);
23
- } }, testId, others), void 0)) }, void 0));
23
+ }, ...testId, ...others })) }));
24
24
  }
25
25
  exports.BoundCheckboxGroupField = BoundCheckboxGroupField;
@@ -13,7 +13,7 @@ function BoundChipSelectField(props) {
13
13
  const testId = (0, utils_1.useTestIds)(props, field.key);
14
14
  return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => {
15
15
  var _a;
16
- return ((0, jsx_runtime_1.jsx)(ChipSelectField_1.ChipSelectField, Object.assign({ label: label, value: (_a = field.value) !== null && _a !== void 0 ? _a : undefined, onSelect: (value) => {
16
+ return ((0, jsx_runtime_1.jsx)(ChipSelectField_1.ChipSelectField, { label: label, value: (_a = field.value) !== null && _a !== void 0 ? _a : undefined, onSelect: (value) => {
17
17
  onSelect(value);
18
18
  field.maybeAutoSave();
19
19
  }, getOptionLabel: getOptionLabel, getOptionValue: getOptionValue, onBlur: () => {
@@ -27,7 +27,7 @@ function BoundChipSelectField(props) {
27
27
  await onCreateNew(v);
28
28
  field.maybeAutoSave();
29
29
  }
30
- : undefined }, others, testId), void 0));
31
- } }, void 0));
30
+ : undefined, ...others, ...testId }));
31
+ } }));
32
32
  }
33
33
  exports.BoundChipSelectField = BoundChipSelectField;
@@ -1,6 +1,6 @@
1
1
  import { FieldState } from "@homebound/form-state";
2
2
  import { DateFieldProps } from "../inputs";
3
- export declare type BoundDateFieldProps = Omit<DateFieldProps, "label" | "value" | "onChange"> & {
3
+ export type BoundDateFieldProps = Omit<DateFieldProps, "label" | "value" | "onChange"> & {
4
4
  field: FieldState<any, Date | null | undefined>;
5
5
  label?: string;
6
6
  onChange?: (value: Date | undefined) => void;
@@ -10,7 +10,7 @@ const defaultLabel_1 = require("../utils/defaultLabel");
10
10
  function BoundDateField(props) {
11
11
  const { field, readOnly, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), onBlur, onFocus, onEnter, ...others } = props;
12
12
  const testId = (0, utils_1.useTestIds)(props, field.key);
13
- return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.DateField, Object.assign({ label: label, value: field.value || undefined, onChange: (value) => {
13
+ return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.DateField, { label: label, value: field.value || undefined, onChange: (value) => {
14
14
  onChange(value);
15
15
  field.maybeAutoSave();
16
16
  }, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly, errorMsg: field.touched ? field.errors.join(" ") : undefined, required: field.required, onBlur: () => {
@@ -22,6 +22,6 @@ function BoundDateField(props) {
22
22
  }, onEnter: () => {
23
23
  (0, utils_1.maybeCall)(onEnter);
24
24
  field.maybeAutoSave();
25
- } }, testId, others), void 0)) }, void 0));
25
+ }, ...testId, ...others })) }));
26
26
  }
27
27
  exports.BoundDateField = BoundDateField;
@@ -1,7 +1,7 @@
1
1
  import { FieldState } from "@homebound/form-state";
2
2
  import { DateRangeFieldProps } from "../inputs";
3
3
  import { DateRange } from "../types";
4
- export declare type BoundDateRangeFieldProps = Omit<DateRangeFieldProps, "label" | "value" | "onChange"> & {
4
+ export type BoundDateRangeFieldProps = Omit<DateRangeFieldProps, "label" | "value" | "onChange"> & {
5
5
  field: FieldState<any, DateRange | null | undefined>;
6
6
  label?: string;
7
7
  onChange?: (value: DateRange | undefined) => void;
@@ -10,7 +10,7 @@ const defaultLabel_1 = require("../utils/defaultLabel");
10
10
  function BoundDateRangeField(props) {
11
11
  const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), onBlur, onFocus, onEnter, readOnly, ...others } = props;
12
12
  const testId = (0, utils_1.useTestIds)(props, field.key);
13
- return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.DateRangeField, Object.assign({ label: label, value: field.value || undefined, onChange: (value) => {
13
+ return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.DateRangeField, { label: label, value: field.value || undefined, onChange: (value) => {
14
14
  onChange(value);
15
15
  field.maybeAutoSave();
16
16
  }, errorMsg: field.touched ? field.errors.join(" ") : undefined, required: field.required, onBlur: () => {
@@ -22,6 +22,6 @@ function BoundDateRangeField(props) {
22
22
  }, onEnter: () => {
23
23
  (0, utils_1.maybeCall)(onEnter);
24
24
  field.maybeAutoSave();
25
- }, readOnly: readOnly || field.readOnly }, testId, others), void 0)) }, void 0));
25
+ }, readOnly: readOnly || field.readOnly, ...testId, ...others })) }));
26
26
  }
27
27
  exports.BoundDateRangeField = BoundDateRangeField;
@@ -1,7 +1,7 @@
1
1
  import { FieldState } from "@homebound/form-state";
2
2
  import { MultiSelectFieldProps, Value } from "../inputs";
3
3
  import { HasIdAndName, Optional } from "../types";
4
- export declare type BoundMultiSelectFieldProps<O, V extends Value> = Omit<MultiSelectFieldProps<O, V>, "values" | "onSelect" | "label"> & {
4
+ export type BoundMultiSelectFieldProps<O, V extends Value> = Omit<MultiSelectFieldProps<O, V>, "values" | "onSelect" | "label"> & {
5
5
  onSelect?: (values: V[], opts: O[]) => void;
6
6
  field: FieldState<any, V[] | null | undefined>;
7
7
  label?: string;
@@ -14,7 +14,7 @@ function BoundMultiSelectField(props) {
14
14
  const testId = (0, useTestIds_1.useTestIds)(props, field.key);
15
15
  return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => {
16
16
  var _a;
17
- return ((0, jsx_runtime_1.jsx)(inputs_1.MultiSelectField, Object.assign({ label: label, values: (_a = field.value) !== null && _a !== void 0 ? _a : [], onSelect: (values, options) => {
17
+ return ((0, jsx_runtime_1.jsx)(inputs_1.MultiSelectField, { label: label, values: (_a = field.value) !== null && _a !== void 0 ? _a : [], onSelect: (values, options) => {
18
18
  onSelect(values, options);
19
19
  field.maybeAutoSave();
20
20
  }, options: options, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly, errorMsg: field.touched ? field.errors.join(" ") : undefined, required: field.required, getOptionLabel: getOptionLabel, getOptionValue: getOptionValue, onBlur: () => {
@@ -23,7 +23,7 @@ function BoundMultiSelectField(props) {
23
23
  }, onFocus: () => {
24
24
  field.focus();
25
25
  (0, utils_1.maybeCall)(onFocus);
26
- } }, others, testId), void 0));
27
- } }, void 0));
26
+ }, ...others, ...testId }));
27
+ } }));
28
28
  }
29
29
  exports.BoundMultiSelectField = BoundMultiSelectField;
@@ -1,6 +1,6 @@
1
1
  import { FieldState } from "@homebound/form-state";
2
2
  import { NumberFieldProps } from "../inputs/NumberField";
3
- export declare type BoundNumberFieldProps = Omit<NumberFieldProps, "value" | "onChange" | "label"> & {
3
+ export type BoundNumberFieldProps = Omit<NumberFieldProps, "value" | "onChange" | "label"> & {
4
4
  label?: string;
5
5
  field: FieldState<any, number | null | undefined>;
6
6
  onChange?: (value: number | undefined) => void;
@@ -10,7 +10,7 @@ const defaultLabel_1 = require("../utils/defaultLabel");
10
10
  function BoundNumberField(props) {
11
11
  const { field, readOnly, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key.replace(/InCents$/, "")), type = field.key.endsWith("InCents") ? "cents" : undefined, onFocus, onBlur, onEnter, ...others } = props;
12
12
  const testId = (0, utils_1.useTestIds)(props, label || field.key);
13
- return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(NumberField_1.NumberField, Object.assign({ label: label, value: typeof field.value === "number" ? field.value : undefined, onChange: onChange, type: type, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly, errorMsg: field.touched ? field.errors.join(" ") : undefined, required: field.required, onFocus: () => {
13
+ return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(NumberField_1.NumberField, { label: label, value: typeof field.value === "number" ? field.value : undefined, onChange: onChange, type: type, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly, errorMsg: field.touched ? field.errors.join(" ") : undefined, required: field.required, onFocus: () => {
14
14
  field.focus();
15
15
  (0, utils_1.maybeCall)(onFocus);
16
16
  }, onBlur: () => {
@@ -19,6 +19,6 @@ function BoundNumberField(props) {
19
19
  }, onEnter: () => {
20
20
  (0, utils_1.maybeCall)(onEnter);
21
21
  field.maybeAutoSave();
22
- } }, testId, others), void 0)) }, void 0));
22
+ }, ...testId, ...others })) }));
23
23
  }
24
24
  exports.BoundNumberField = BoundNumberField;
@@ -1,6 +1,6 @@
1
1
  import { FieldState } from "@homebound/form-state";
2
2
  import { RadioGroupFieldProps } from "../inputs";
3
- export declare type BoundRadioGroupFieldProps<K extends string> = Omit<RadioGroupFieldProps<K>, "value" | "onChange" | "label"> & {
3
+ export type BoundRadioGroupFieldProps<K extends string> = Omit<RadioGroupFieldProps<K>, "value" | "onChange" | "label"> & {
4
4
  field: FieldState<any, K | null | undefined>;
5
5
  /** Make optional so that callers can override if they want to. */
6
6
  onChange?: (value: K) => void;
@@ -10,7 +10,7 @@ const defaultLabel_1 = require("../utils/defaultLabel");
10
10
  function BoundRadioGroupField(props) {
11
11
  const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), onBlur, onFocus, ...others } = props;
12
12
  const testId = (0, utils_1.useTestIds)(props, field.key);
13
- return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.RadioGroupField, Object.assign({ label: label, value: field.value || undefined, onChange: (value) => {
13
+ return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.RadioGroupField, { label: label, value: field.value || undefined, onChange: (value) => {
14
14
  onChange(value);
15
15
  field.maybeAutoSave();
16
16
  }, errorMsg: field.touched ? field.errors.join(" ") : undefined, onBlur: () => {
@@ -19,6 +19,6 @@ function BoundRadioGroupField(props) {
19
19
  }, onFocus: () => {
20
20
  field.focus();
21
21
  (0, utils_1.maybeCall)(onFocus);
22
- } }, testId, others), void 0)) }, void 0));
22
+ }, ...testId, ...others })) }));
23
23
  }
24
24
  exports.BoundRadioGroupField = BoundRadioGroupField;
@@ -1,6 +1,6 @@
1
1
  import { FieldState } from "@homebound/form-state";
2
2
  import { RichTextFieldProps } from "../inputs/RichTextField";
3
- export declare type BoundRichTextFieldProps = Omit<RichTextFieldProps, "value" | "onChange"> & {
3
+ export type BoundRichTextFieldProps = Omit<RichTextFieldProps, "value" | "onChange"> & {
4
4
  field: FieldState<any, string | null | undefined>;
5
5
  onChange?: (value: string | undefined) => void;
6
6
  };
@@ -10,7 +10,7 @@ const defaultLabel_1 = require("../utils/defaultLabel");
10
10
  function BoundRichTextField(props) {
11
11
  const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), readOnly, onFocus, onBlur, ...others } = props;
12
12
  const testId = (0, utils_1.useTestIds)(props, field.key);
13
- return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(RichTextField_1.RichTextField, Object.assign({ label: label, value: field.value || undefined, onChange: onChange,
13
+ return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(RichTextField_1.RichTextField, { label: label, value: field.value || undefined, onChange: onChange,
14
14
  // TODO: Potentially support this in the future?
15
15
  // errorMsg={field.touched ? field.errors.join(" ") : undefined}
16
16
  onBlur: () => {
@@ -19,6 +19,6 @@ function BoundRichTextField(props) {
19
19
  }, onFocus: () => {
20
20
  field.focus();
21
21
  (0, utils_1.maybeCall)(onFocus);
22
- }, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly }, testId, others), void 0)) }, void 0));
22
+ }, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly, ...testId, ...others })) }));
23
23
  }
24
24
  exports.BoundRichTextField = BoundRichTextField;
@@ -12,6 +12,6 @@ export declare function BoundSelectAndTextField<O, V extends Value, X extends On
12
12
  export declare function BoundSelectAndTextField<O extends HasIdAndName<V>, V extends Value, X extends Only<TextFieldXss, X>>(props: Omit<BoundSelectAndTextFieldProps<O, V, X>, "selectFieldProps"> & {
13
13
  selectFieldProps: Optional<CompoundSelectFieldProps<O, V>, "getOptionValue" | "getOptionLabel">;
14
14
  }): JSX.Element;
15
- declare type CompoundSelectFieldProps<O, V extends Value> = Omit<BoundSelectFieldProps<O, V>, "compact">;
16
- declare type CompoundTextFieldProps<X> = Omit<BoundTextFieldProps<X>, "compact">;
15
+ type CompoundSelectFieldProps<O, V extends Value> = Omit<BoundSelectFieldProps<O, V>, "compact">;
16
+ type CompoundTextFieldProps<X> = Omit<BoundTextFieldProps<X>, "compact">;
17
17
  export {};
@@ -10,6 +10,6 @@ function BoundSelectAndTextField(props) {
10
10
  var _a, _b;
11
11
  const { selectFieldProps, textFieldProps, compact = true } = props;
12
12
  const tid = (0, utils_1.useTestIds)(props);
13
- return ((0, jsx_runtime_1.jsxs)(CompoundField_1.CompoundField, { children: [(0, jsx_runtime_1.jsx)(index_1.BoundSelectField, Object.assign({}, tid[(0, defaultTestId_1.defaultTestId)((_a = selectFieldProps.label) !== null && _a !== void 0 ? _a : selectFieldProps.field.key)], selectFieldProps, { sizeToContent: true, compact: compact }), void 0), (0, jsx_runtime_1.jsx)(index_1.BoundTextField, Object.assign({}, tid[(0, defaultTestId_1.defaultTestId)((_b = textFieldProps.label) !== null && _b !== void 0 ? _b : textFieldProps.field.key)], textFieldProps, { compact: compact }), void 0)] }, void 0));
13
+ return ((0, jsx_runtime_1.jsxs)(CompoundField_1.CompoundField, { children: [(0, jsx_runtime_1.jsx)(index_1.BoundSelectField, { ...tid[(0, defaultTestId_1.defaultTestId)((_a = selectFieldProps.label) !== null && _a !== void 0 ? _a : selectFieldProps.field.key)], ...selectFieldProps, sizeToContent: true, compact: compact }), (0, jsx_runtime_1.jsx)(index_1.BoundTextField, { ...tid[(0, defaultTestId_1.defaultTestId)((_b = textFieldProps.label) !== null && _b !== void 0 ? _b : textFieldProps.field.key)], ...textFieldProps, compact: compact })] }));
14
14
  }
15
15
  exports.BoundSelectAndTextField = BoundSelectAndTextField;
@@ -1,7 +1,7 @@
1
1
  import { FieldState } from "@homebound/form-state";
2
2
  import { SelectFieldProps, Value } from "../inputs";
3
3
  import { HasIdAndName, Optional } from "../types";
4
- export declare type BoundSelectFieldProps<O, V extends Value> = Omit<SelectFieldProps<O, V>, "value" | "onSelect" | "label"> & {
4
+ export type BoundSelectFieldProps<O, V extends Value> = Omit<SelectFieldProps<O, V>, "value" | "onSelect" | "label"> & {
5
5
  onSelect?: (value: V | undefined, opt: O | undefined) => void;
6
6
  field: FieldState<any, V | null | undefined>;
7
7
  label?: string;
@@ -14,7 +14,7 @@ function BoundSelectField(props) {
14
14
  const testId = (0, useTestIds_1.useTestIds)(props, field.key);
15
15
  return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => {
16
16
  var _a;
17
- return ((0, jsx_runtime_1.jsx)(inputs_1.SelectField, Object.assign({ label: label, value: (_a = field.value) !== null && _a !== void 0 ? _a : undefined, onSelect: (value, opt) => {
17
+ return ((0, jsx_runtime_1.jsx)(inputs_1.SelectField, { label: label, value: (_a = field.value) !== null && _a !== void 0 ? _a : undefined, onSelect: (value, opt) => {
18
18
  onSelect(value, opt);
19
19
  field.maybeAutoSave();
20
20
  }, options: options, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly, errorMsg: field.touched ? field.errors.join(" ") : undefined, required: field.required, getOptionLabel: getOptionLabel, getOptionValue: getOptionValue, onBlur: () => {
@@ -23,7 +23,7 @@ function BoundSelectField(props) {
23
23
  }, onFocus: () => {
24
24
  field.focus();
25
25
  (0, utils_1.maybeCall)(onFocus);
26
- } }, others, testId), void 0));
27
- } }, void 0));
26
+ }, ...others, ...testId }));
27
+ } }));
28
28
  }
29
29
  exports.BoundSelectField = BoundSelectField;
@@ -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"> & {
3
+ export 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;
@@ -12,10 +12,10 @@ function BoundSwitchField(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: labelStyle, selected: (_a = field.value) !== null && _a !== void 0 ? _a : false, onChange: (selected) => {
15
+ return ((0, jsx_runtime_1.jsx)(inputs_1.Switch, { 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
- }, disabled: disabled || field.readOnly }, testId, others), void 0));
19
- } }, void 0));
18
+ }, disabled: disabled || field.readOnly, ...testId, ...others }));
19
+ } }));
20
20
  }
21
21
  exports.BoundSwitchField = BoundSwitchField;
@@ -2,7 +2,7 @@ import { FieldState } from "@homebound/form-state";
2
2
  import { Only } from "../Css";
3
3
  import { TextAreaFieldProps } from "../inputs";
4
4
  import { TextFieldXss } from "../interfaces";
5
- export declare type BoundTextAreaFieldProps<X> = Omit<TextAreaFieldProps<X>, "value" | "onChange" | "label"> & {
5
+ export type BoundTextAreaFieldProps<X> = Omit<TextAreaFieldProps<X>, "value" | "onChange" | "label"> & {
6
6
  label?: string;
7
7
  field: FieldState<any, string | null | undefined>;
8
8
  onChange?: (value: string | undefined) => void;
@@ -10,7 +10,7 @@ const defaultLabel_1 = require("../utils/defaultLabel");
10
10
  function BoundTextAreaField(props) {
11
11
  const { field, readOnly, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), onFocus, onBlur, onEnter, ...others } = props;
12
12
  const testId = (0, utils_1.useTestIds)(props, field.key);
13
- return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.TextAreaField, Object.assign({ label: label, value: field.value || undefined, onChange: onChange, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly, errorMsg: field.touched ? field.errors.join(" ") : undefined, onBlur: () => {
13
+ return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.TextAreaField, { label: label, value: field.value || undefined, onChange: onChange, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly, errorMsg: field.touched ? field.errors.join(" ") : undefined, onBlur: () => {
14
14
  field.blur();
15
15
  (0, utils_1.maybeCall)(onBlur);
16
16
  }, onFocus: () => {
@@ -19,6 +19,6 @@ function BoundTextAreaField(props) {
19
19
  }, onEnter: () => {
20
20
  (0, utils_1.maybeCall)(onEnter);
21
21
  field.maybeAutoSave();
22
- } }, testId, others), void 0)) }, void 0));
22
+ }, ...testId, ...others })) }));
23
23
  }
24
24
  exports.BoundTextAreaField = BoundTextAreaField;
@@ -2,7 +2,7 @@ import { FieldState } from "@homebound/form-state";
2
2
  import { Only } from "../Css";
3
3
  import { TextFieldProps } from "../inputs";
4
4
  import { TextFieldXss } from "../interfaces";
5
- export declare type BoundTextFieldProps<X> = Omit<TextFieldProps<X>, "value" | "onChange" | "label"> & {
5
+ export type BoundTextFieldProps<X> = Omit<TextFieldProps<X>, "value" | "onChange" | "label"> & {
6
6
  label?: string;
7
7
  field: FieldState<any, string | null | undefined>;
8
8
  onChange?: (value: string | undefined) => void;
@@ -10,7 +10,7 @@ const defaultLabel_1 = require("../utils/defaultLabel");
10
10
  function BoundTextField(props) {
11
11
  const { field, readOnly, onBlur, onFocus, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), onEnter, ...others } = props;
12
12
  const testId = (0, utils_1.useTestIds)(props, field.key);
13
- return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.TextField, Object.assign({ label: label, value: field.value || undefined, onChange: onChange, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly, errorMsg: field.touched ? field.errors.join(" ") : undefined, required: field.required, onBlur: () => {
13
+ return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.TextField, { label: label, value: field.value || undefined, onChange: onChange, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly, errorMsg: field.touched ? field.errors.join(" ") : undefined, required: field.required, onBlur: () => {
14
14
  (0, utils_1.maybeCall)(onBlur);
15
15
  field.blur();
16
16
  }, onFocus: () => {
@@ -19,6 +19,6 @@ function BoundTextField(props) {
19
19
  }, onEnter: () => {
20
20
  (0, utils_1.maybeCall)(onEnter);
21
21
  field.maybeAutoSave();
22
- } }, testId, others), void 0)) }, void 0));
22
+ }, ...testId, ...others })) }));
23
23
  }
24
24
  exports.BoundTextField = BoundTextField;
@@ -1,6 +1,6 @@
1
1
  import { FieldState } from "@homebound/form-state";
2
2
  import { ToggleChipGroupProps } from "../inputs";
3
- export declare type BoundToggleChipGroupFieldProps = Omit<ToggleChipGroupProps, "values" | "onChange" | "label"> & {
3
+ export type BoundToggleChipGroupFieldProps = Omit<ToggleChipGroupProps, "values" | "onChange" | "label"> & {
4
4
  field: FieldState<any, string[] | null | undefined>;
5
5
  /** Make optional so that callers can override if they want to. */
6
6
  onChange?: (values: string[]) => void;
@@ -10,6 +10,6 @@ const defaultLabel_1 = require("../utils/defaultLabel");
10
10
  function BoundToggleChipGroupField(props) {
11
11
  const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), ...others } = props;
12
12
  const testId = (0, utils_1.useTestIds)(props, field.key);
13
- return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => (0, jsx_runtime_1.jsx)(inputs_1.ToggleChipGroup, Object.assign({ label: label, values: field.value || [], onChange: onChange }, testId, others), void 0) }, void 0));
13
+ return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => (0, jsx_runtime_1.jsx)(inputs_1.ToggleChipGroup, { label: label, values: field.value || [], onChange: onChange, ...testId, ...others }) }));
14
14
  }
15
15
  exports.BoundToggleChipGroupField = BoundToggleChipGroupField;
@@ -5,12 +5,12 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
5
  const Css_1 = require("../Css");
6
6
  function FormHeading(props) {
7
7
  const { title, xss, isFirst = false, ...others } = props;
8
- return ((0, jsx_runtime_1.jsx)("h3", Object.assign({ css: {
8
+ return ((0, jsx_runtime_1.jsx)("h3", { css: {
9
9
  ...Css_1.Css.baseMd.$,
10
10
  // Add space before the heading, but only if it's not first.
11
11
  ...(!isFirst && Css_1.Css.mt4.$),
12
12
  ...xss,
13
- } }, others, { children: title }), void 0));
13
+ }, ...others, children: title }));
14
14
  }
15
15
  exports.FormHeading = FormHeading;
16
16
  // https://github.com/gaearon/react-hot-loader/issues/304#issuecomment-456569720
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from "react";
2
2
  import { LabelSuffixStyle } from "../components/PresentationContext";
3
- export declare type FormWidth =
3
+ export type FormWidth =
4
4
  /** 320px. */
5
5
  "sm"
6
6
  /** 480px, works well in a small, single-stack form. */
@@ -19,12 +19,12 @@ function FormLines(props) {
19
19
  ...("labelSuffix" in props ? { labelSuffix } : {}),
20
20
  ...("compact" in props ? { compact } : {}),
21
21
  };
22
- return ((0, jsx_runtime_1.jsx)(PresentationContext_1.PresentationProvider, Object.assign({ fieldProps: newFieldProps }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
22
+ return ((0, jsx_runtime_1.jsx)(PresentationContext_1.PresentationProvider, { fieldProps: newFieldProps, children: (0, jsx_runtime_1.jsx)("div", { css: {
23
23
  // Note that we're purposefully not using display:flex so that our children's margins will collapse.
24
24
  ...Css_1.Css.w(sizes[width]).$,
25
25
  // Purposefully use this instead of childGap3 to put margin-bottom on the last line
26
26
  "& > *": Css_1.Css.mb2.$,
27
- } }, { children: react_1.Children.map(children, (child) => {
27
+ }, children: react_1.Children.map(children, (child) => {
28
28
  if (child && typeof child === "object" && "type" in child && child.type.isFormHeading) {
29
29
  const clone = (0, react_1.cloneElement)(child, { isFirst: firstFormHeading });
30
30
  firstFormHeading = false;
@@ -33,12 +33,12 @@ function FormLines(props) {
33
33
  else {
34
34
  return child;
35
35
  }
36
- }) }), void 0) }), void 0));
36
+ }) }) }));
37
37
  }
38
38
  exports.FormLines = FormLines;
39
39
  /** Draws a line between form lines. */
40
40
  function FormDivider() {
41
- return (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.hPx(1).my2.bgGray200.$ }, void 0);
41
+ return (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.hPx(1).my2.bgGray200.$ });
42
42
  }
43
43
  exports.FormDivider = FormDivider;
44
44
  /** Groups multiple fields side-by-side. */
@@ -51,7 +51,7 @@ function FieldGroup(props) {
51
51
  return typeof width === `number` ? `${width}fr` : width;
52
52
  })
53
53
  .join(" ");
54
- return (0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.dg.gap2.gtc(gtc).$ }, { children: children }), void 0);
54
+ return (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.dg.gap2.gtc(gtc).$, children: children });
55
55
  }
56
56
  exports.FieldGroup = FieldGroup;
57
57
  const sizes = {
@@ -56,23 +56,23 @@ function FormStateApp() {
56
56
  { value: "a:4", label: "Iguana" },
57
57
  { value: "a:5", label: "Turtle" },
58
58
  ];
59
- return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.df.$ }, { children: [(0, jsx_runtime_1.jsxs)("header", Object.assign({ css: Css_1.Css.wPx(700).$ }, { children: [(0, jsx_runtime_1.jsxs)(FormLines_1.FormLines, Object.assign({ labelSuffix: { required: "*", optional: "(Opt)" } }, { children: [(0, jsx_runtime_1.jsx)("b", { children: "Author" }, void 0), (0, jsx_runtime_1.jsx)(forms_1.BoundTextField, { field: formState.firstName }, void 0), (0, jsx_runtime_1.jsx)(forms_1.BoundTextField, { field: formState.middleInitial }, void 0), (0, jsx_runtime_1.jsx)(forms_1.BoundTextField, { field: formState.lastName }, void 0), (0, jsx_runtime_1.jsx)(forms_1.BoundDateField, { field: formState.birthday }, void 0), (0, jsx_runtime_1.jsxs)(forms_1.FieldGroup, { children: [(0, jsx_runtime_1.jsx)(forms_1.StaticField, { label: "Revenue", value: "$500" }, void 0), (0, jsx_runtime_1.jsx)(forms_1.StaticField, Object.assign({ label: "Website" }, { children: (0, jsx_runtime_1.jsx)("a", Object.assign({ href: "https://google.com" }, { children: "google.com" }), void 0) }), void 0)] }, void 0), (0, jsx_runtime_1.jsx)(forms_1.BoundNumberField, { field: formState.heightInInches }, void 0), (0, jsx_runtime_1.jsx)(forms_1.FormDivider, {}, void 0), (0, jsx_runtime_1.jsx)(forms_1.BoundSelectField, { field: formState.favoriteSport, options: sports }, void 0), (0, jsx_runtime_1.jsx)(forms_1.BoundMultiSelectField, { field: formState.favoriteShapes, options: shapes }, void 0), (0, jsx_runtime_1.jsx)(BoundCheckboxGroupField_1.BoundCheckboxGroupField, { field: formState.favoriteColors, options: colors }, void 0), (0, jsx_runtime_1.jsx)(forms_1.BoundToggleChipGroupField, { field: formState.animals, options: animals }, void 0), (0, jsx_runtime_1.jsx)(forms_1.FormDivider, {}, void 0), (0, jsx_runtime_1.jsx)(forms_1.BoundSwitchField, { field: formState.isAvailable }, void 0)] }), void 0), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("strong", { children: ["Books", (0, jsx_runtime_1.jsx)(components_1.IconButton, { icon: "plus", onClick: () => formState.books.add({ id: String(formState.books.value.length) }) }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)(components_1.GridTable, { columns: columns, rows: rows }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.df.gap1.$ }, { children: [(0, jsx_runtime_1.jsx)(components_1.Button, { onClick: () => formState.revertChanges(), label: "Cancel" }, void 0), (0, jsx_runtime_1.jsx)(components_1.Button, { onClick: () => {
59
+ return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.df.$, children: [(0, jsx_runtime_1.jsxs)("header", { css: Css_1.Css.wPx(700).$, children: [(0, jsx_runtime_1.jsxs)(FormLines_1.FormLines, { labelSuffix: { required: "*", optional: "(Opt)" }, children: [(0, jsx_runtime_1.jsx)("b", { children: "Author" }), (0, jsx_runtime_1.jsx)(forms_1.BoundTextField, { field: formState.firstName }), (0, jsx_runtime_1.jsx)(forms_1.BoundTextField, { field: formState.middleInitial }), (0, jsx_runtime_1.jsx)(forms_1.BoundTextField, { field: formState.lastName }), (0, jsx_runtime_1.jsx)(forms_1.BoundDateField, { field: formState.birthday }), (0, jsx_runtime_1.jsxs)(forms_1.FieldGroup, { children: [(0, jsx_runtime_1.jsx)(forms_1.StaticField, { label: "Revenue", value: "$500" }), (0, jsx_runtime_1.jsx)(forms_1.StaticField, { label: "Website", children: (0, jsx_runtime_1.jsx)("a", { href: "https://google.com", children: "google.com" }) })] }), (0, jsx_runtime_1.jsx)(forms_1.BoundNumberField, { field: formState.heightInInches }), (0, jsx_runtime_1.jsx)(forms_1.FormDivider, {}), (0, jsx_runtime_1.jsx)(forms_1.BoundSelectField, { field: formState.favoriteSport, options: sports }), (0, jsx_runtime_1.jsx)(forms_1.BoundMultiSelectField, { field: formState.favoriteShapes, options: shapes }), (0, jsx_runtime_1.jsx)(BoundCheckboxGroupField_1.BoundCheckboxGroupField, { field: formState.favoriteColors, options: colors }), (0, jsx_runtime_1.jsx)(forms_1.BoundToggleChipGroupField, { field: formState.animals, options: animals }), (0, jsx_runtime_1.jsx)(forms_1.FormDivider, {}), (0, jsx_runtime_1.jsx)(forms_1.BoundSwitchField, { field: formState.isAvailable })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("strong", { children: ["Books", (0, jsx_runtime_1.jsx)(components_1.IconButton, { icon: "plus", onClick: () => formState.books.add({ id: String(formState.books.value.length) }) })] }), (0, jsx_runtime_1.jsx)(components_1.GridTable, { columns: columns, rows: rows })] }), (0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.df.gap1.$, children: [(0, jsx_runtime_1.jsx)(components_1.Button, { onClick: () => formState.revertChanges(), label: "Cancel" }), (0, jsx_runtime_1.jsx)(components_1.Button, { onClick: () => {
60
60
  if (formState.canSave()) {
61
61
  formState.commitChanges();
62
62
  }
63
- }, label: "Save" }, void 0)] }), void 0)] }), void 0), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(components_1.Button, { label: "Read Only", onClick: () => setReadOnly(!readOnly) }, void 0) }, void 0), (0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.mt1.$ }, { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Form Values:" }, void 0), (0, jsx_runtime_1.jsx)("pre", { children: JSON.stringify(formState.value, null, 2) }, void 0)] }), void 0)] }, void 0)] }), void 0)) }, void 0));
63
+ }, label: "Save" })] })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(components_1.Button, { label: "Read Only", onClick: () => setReadOnly(!readOnly) }) }), (0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.mt1.$, children: [(0, jsx_runtime_1.jsx)("strong", { children: "Form Values:" }), (0, jsx_runtime_1.jsx)("pre", { children: JSON.stringify(formState.value, null, 2) })] })] })] })) }));
64
64
  }
65
65
  exports.FormStateApp = FormStateApp;
66
66
  function createColumns(formState) {
67
67
  return [
68
- { header: "#", data: ({ id }) => (0, jsx_runtime_1.jsx)("span", { children: id.value }, void 0) },
68
+ { header: "#", data: ({ id }) => (0, jsx_runtime_1.jsx)("span", { children: id.value }) },
69
69
  {
70
70
  header: "Title",
71
- data: ({ title }) => (0, jsx_runtime_1.jsx)(forms_1.BoundTextField, { label: "Book Title", hideLabel: true, compact: true, field: title }, void 0),
71
+ data: ({ title }) => (0, jsx_runtime_1.jsx)(forms_1.BoundTextField, { label: "Book Title", labelStyle: "hidden", compact: true, field: title }),
72
72
  },
73
73
  {
74
74
  header: "Actions",
75
- data: (row) => (0, jsx_runtime_1.jsx)(components_1.IconButton, { icon: "x", onClick: () => formState.books.remove(row.value) }, void 0),
75
+ data: (row) => (0, jsx_runtime_1.jsx)(components_1.IconButton, { icon: "x", onClick: () => formState.books.remove(row.value) }),
76
76
  },
77
77
  ];
78
78
  }
@@ -10,6 +10,6 @@ function StaticField(props) {
10
10
  const { label, value, children } = props;
11
11
  const tid = (0, useTestIds_1.useTestIds)(props, typeof label === "string" ? (0, defaultTestId_1.defaultTestId)(label) : "staticField");
12
12
  const id = (0, utils_1.useId)();
13
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", Object.assign({ css: Css_1.Css.db.sm.gray700.mbPx(4).$, htmlFor: id }, tid.label, { children: label }), void 0), (0, jsx_runtime_1.jsx)("div", Object.assign({ id: id, css: Css_1.Css.smMd.gray900.df.aic.$ }, tid, { children: value || children }), void 0)] }, void 0));
13
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { css: Css_1.Css.db.sm.gray700.mbPx(4).$, htmlFor: id, ...tid.label, children: label }), (0, jsx_runtime_1.jsx)("div", { id: id, css: Css_1.Css.smMd.gray900.df.aic.$, ...tid, children: value || children })] }));
14
14
  }
15
15
  exports.StaticField = StaticField;