@dxos/react-ui-form 0.8.1 → 0.8.2-main.12df754

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.
@@ -65,7 +65,7 @@ import { mx, textBlockWidth } from "@dxos/react-ui-theme";
65
65
  var DeprecatedFormContainer = ({ children, classNames }) => {
66
66
  return /* @__PURE__ */ React.createElement("div", {
67
67
  role: "none",
68
- className: "w-full p-4 justify-center overflow-x-hidden overflow-y-auto"
68
+ className: "container-max-width p-4 justify-center overflow-x-hidden overflow-y-auto"
69
69
  }, /* @__PURE__ */ React.createElement("div", {
70
70
  role: "form",
71
71
  className: mx("flex flex-col", textBlockWidth, classNames)
@@ -99,9 +99,23 @@ var DeprecatedFormInput = ({ label, description, secondary, children }) => {
99
99
  return primary;
100
100
  };
101
101
 
102
- // packages/ui/react-ui-form/src/components/ControlSection.tsx
102
+ // packages/ui/react-ui-form/src/components/ControlSection/ControlSection.tsx
103
103
  import React2 from "react";
104
- import { toLocalizedString, useTranslation, Input as Input2 } from "@dxos/react-ui";
104
+ import { Button, Input as Input2, toLocalizedString, useTranslation } from "@dxos/react-ui";
105
+ import { mx as mx2 } from "@dxos/react-ui-theme";
106
+ var ControlPage = ({ children, classNames, ...props }) => {
107
+ return /* @__PURE__ */ React2.createElement("div", {
108
+ role: "none",
109
+ className: mx2("pli-2", classNames),
110
+ ...props
111
+ }, children);
112
+ };
113
+ var ControlSection = ({ title, description, children }) => {
114
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ControlSectionHeading, {
115
+ title,
116
+ description
117
+ }), children);
118
+ };
105
119
  var ControlSectionHeading = ({ title, description }) => {
106
120
  const { t } = useTranslation(translationKey);
107
121
  return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("h2", {
@@ -110,15 +124,18 @@ var ControlSectionHeading = ({ title, description }) => {
110
124
  className: "pli-4 mlb-4 container-max-width text-description"
111
125
  }, toLocalizedString(description, t)));
112
126
  };
113
- var ControlSection = ({ title, description, children }) => {
114
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ControlSectionHeading, {
115
- title,
116
- description
117
- }), children);
127
+ var ControlGroupButton = ({ classNames, ...props }) => {
128
+ return /* @__PURE__ */ React2.createElement(Button, {
129
+ ...props,
130
+ classNames: [
131
+ "md:col-span-2",
132
+ classNames
133
+ ]
134
+ });
118
135
  };
119
- var ControlGroup = ({ children }) => /* @__PURE__ */ React2.createElement("div", {
136
+ var ControlGroup = ({ children, classNames }) => /* @__PURE__ */ React2.createElement("div", {
120
137
  role: "none",
121
- className: "group container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content] gap-4"
138
+ className: mx2("group container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content] gap-4", classNames)
122
139
  }, children);
123
140
  var ControlFrame = ({ children }) => /* @__PURE__ */ React2.createElement("div", {
124
141
  role: "none",
@@ -272,7 +289,7 @@ import { PublicKey } from "@dxos/keys";
272
289
  import { Icon as Icon2, IconButton, Input as Input4, Tag, Toolbar, useTranslation as useTranslation3 } from "@dxos/react-ui";
273
290
  import { List } from "@dxos/react-ui-list";
274
291
  import { HuePicker } from "@dxos/react-ui-pickers";
275
- import { hues, mx as mx2 } from "@dxos/react-ui-theme";
292
+ import { hues, mx as mx3 } from "@dxos/react-ui-theme";
276
293
  var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3, onValueChange }) => {
277
294
  const [selected, setSelectedId] = useState2(null);
278
295
  const [isNewOption, setIsNewOption] = useState2(false);
@@ -398,7 +415,7 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
398
415
  }, /* @__PURE__ */ React5.createElement(List.Item, {
399
416
  role: "button",
400
417
  item,
401
- classNames: mx2("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
418
+ classNames: mx3("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
402
419
  "aria-expanded": selected === item.id
403
420
  }, /* @__PURE__ */ React5.createElement("div", {
404
421
  className: "flex items-center"
@@ -439,7 +456,7 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
439
456
  role: "listitem"
440
457
  }, /* @__PURE__ */ React5.createElement("div", {
441
458
  role: "button",
442
- className: mx2("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
459
+ className: mx3("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
443
460
  onClick: handleAdd
444
461
  }, /* @__PURE__ */ React5.createElement("div", {
445
462
  className: "flex items-center gap-1"
@@ -453,7 +470,7 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
453
470
  // packages/ui/react-ui-form/src/components/Form/custom/TupleInput.tsx
454
471
  import React6 from "react";
455
472
  import { Input as Input5 } from "@dxos/react-ui";
456
- import { mx as mx3 } from "@dxos/react-ui-theme";
473
+ import { mx as mx4 } from "@dxos/react-ui-theme";
457
474
  import { safeParseFloat as safeParseFloat2 } from "@dxos/util";
458
475
  var gridCols = [
459
476
  "grid-cols-1",
@@ -469,7 +486,7 @@ var TupleInput = ({ binding, type, label, disabled, getStatus, getValue: getValu
469
486
  }, /* @__PURE__ */ React6.createElement(InputHeader, {
470
487
  error
471
488
  }, /* @__PURE__ */ React6.createElement(Input5.Label, null, label)), /* @__PURE__ */ React6.createElement("div", {
472
- className: mx3("grid gap-2", gridCols[binding.length - 1])
489
+ className: mx4("grid gap-2", gridCols[binding.length - 1])
473
490
  }, binding.map((prop) => /* @__PURE__ */ React6.createElement(Input5.TextInput, {
474
491
  key: prop,
475
492
  type: "number",
@@ -590,12 +607,12 @@ var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus,
590
607
 
591
608
  // packages/ui/react-ui-form/src/components/Form/Form.tsx
592
609
  import React12, { useEffect as useEffect6, useMemo as useMemo6, useRef as useRef3 } from "react";
593
- import { mx as mx7 } from "@dxos/react-ui-theme";
610
+ import { mx as mx8 } from "@dxos/react-ui-theme";
594
611
 
595
612
  // packages/ui/react-ui-form/src/components/Form/FormActions.tsx
596
613
  import React9 from "react";
597
614
  import { IconButton as IconButton2, useTranslation as useTranslation4 } from "@dxos/react-ui";
598
- import { mx as mx4 } from "@dxos/react-ui-theme";
615
+ import { mx as mx5 } from "@dxos/react-ui-theme";
599
616
 
600
617
  // packages/ui/react-ui-form/src/components/Form/FormContext.tsx
601
618
  import React8, { createContext, useContext, useEffect as useEffect5, useMemo as useMemo3 } from "react";
@@ -886,7 +903,7 @@ var FormActions = ({ onCancel, readonly }) => {
886
903
  className: "mt-2 flex justify-center"
887
904
  }, /* @__PURE__ */ React9.createElement("div", {
888
905
  role: "none",
889
- className: mx4(onCancel && !readonly && "grid grid-cols-2 gap-2")
906
+ className: mx5(onCancel && !readonly && "grid grid-cols-2 gap-2")
890
907
  }, onCancel && !readonly && /* @__PURE__ */ React9.createElement(IconButton2, {
891
908
  "data-testid": "cancel-button",
892
909
  icon: "ph--x--regular",
@@ -908,7 +925,7 @@ import { capitalize as capitalize2 } from "effect/String";
908
925
  import React11, { useMemo as useMemo5 } from "react";
909
926
  import { AST as AST3, S } from "@dxos/echo-schema";
910
927
  import { createJsonPath as createJsonPath3, findNode as findNode2, getDiscriminatedType as getDiscriminatedType2, isDiscriminatedUnion as isDiscriminatedUnion2 } from "@dxos/effect";
911
- import { mx as mx6 } from "@dxos/react-ui-theme";
928
+ import { mx as mx7 } from "@dxos/react-ui-theme";
912
929
  import { getSchemaProperties as getSchemaProperties2 } from "@dxos/schema";
913
930
  import { isNotFalsy } from "@dxos/util";
914
931
 
@@ -920,7 +937,7 @@ import { AST as AST2 } from "@dxos/echo-schema";
920
937
  import { findNode, getDiscriminatedType, isDiscriminatedUnion, SimpleType } from "@dxos/effect";
921
938
  import { invariant as invariant2 } from "@dxos/invariant";
922
939
  import { IconButton as IconButton3, useTranslation as useTranslation5 } from "@dxos/react-ui";
923
- import { mx as mx5 } from "@dxos/react-ui-theme";
940
+ import { mx as mx6 } from "@dxos/react-ui-theme";
924
941
  import { getSchemaProperties } from "@dxos/schema";
925
942
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/Form/ArrayField.tsx";
926
943
  var padding = "px-2";
@@ -986,7 +1003,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
986
1003
  }
987
1004
  return /* @__PURE__ */ React10.createElement("div", {
988
1005
  role: "none",
989
- className: mx5(padding)
1006
+ className: mx6(padding)
990
1007
  }, /* @__PURE__ */ React10.createElement(InputHeader, null, label), /* @__PURE__ */ React10.createElement("div", {
991
1008
  role: "none",
992
1009
  className: "flex flex-col gap-1"
@@ -1158,7 +1175,7 @@ var FormFields = ({ schema, path, filter, sort, readonly, lookupComponent, Custo
1158
1175
  ]);
1159
1176
  return /* @__PURE__ */ React11.createElement("div", {
1160
1177
  role: "form",
1161
- className: mx6("flex flex-col w-full gap-2")
1178
+ className: mx7("flex flex-col w-full gap-2")
1162
1179
  }, properties.map((property) => {
1163
1180
  return /* @__PURE__ */ React11.createElement(FormField, {
1164
1181
  key: property.name,
@@ -1203,7 +1220,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, r
1203
1220
  }, /* @__PURE__ */ React12.createElement("div", {
1204
1221
  ref: formRef,
1205
1222
  role: "none",
1206
- className: mx7("p-2", classNames),
1223
+ className: mx8("p-2", classNames),
1207
1224
  "data-testid": testId
1208
1225
  }, /* @__PURE__ */ React12.createElement(FormFields, {
1209
1226
  schema,
@@ -1384,7 +1401,7 @@ import { AST as AST4, Format, S as S2 } from "@dxos/echo-schema";
1384
1401
  import { invariant as invariant3 } from "@dxos/invariant";
1385
1402
  import { IconButton as IconButton4, useTranslation as useTranslation7 } from "@dxos/react-ui";
1386
1403
  import { List as List2 } from "@dxos/react-ui-list";
1387
- import { ghostHover, inputTextLabel, mx as mx8 } from "@dxos/react-ui-theme";
1404
+ import { ghostHover, inputTextLabel, mx as mx9 } from "@dxos/react-ui-theme";
1388
1405
  import { FieldSchema, ViewProjection, VIEW_FIELD_LIMIT } from "@dxos/schema";
1389
1406
  var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
1390
1407
  var grid = "grid grid-cols-[32px_1fr_32px] min-bs-[2.5rem]";
@@ -1510,7 +1527,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
1510
1527
  ]);
1511
1528
  return /* @__PURE__ */ React14.createElement("div", {
1512
1529
  role: "none",
1513
- className: mx8("flex flex-col w-full divide-y divide-separator", classNames)
1530
+ className: mx9("flex flex-col w-full divide-y divide-separator", classNames)
1514
1531
  }, /* @__PURE__ */ React14.createElement(Form, {
1515
1532
  autoSave: true,
1516
1533
  schema: ViewMetaSchema,
@@ -1520,7 +1537,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
1520
1537
  role: "none",
1521
1538
  className: "p-2"
1522
1539
  }, /* @__PURE__ */ React14.createElement("label", {
1523
- className: mx8(inputTextLabel)
1540
+ className: mx9(inputTextLabel)
1524
1541
  }, t("fields label"))), /* @__PURE__ */ React14.createElement(List2.Root, {
1525
1542
  items: view.fields,
1526
1543
  isItem: S2.is(FieldSchema),
@@ -1537,7 +1554,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
1537
1554
  }, fields?.map((field2) => /* @__PURE__ */ React14.createElement(List2.Item, {
1538
1555
  key: field2.id,
1539
1556
  item: field2,
1540
- classNames: mx8(grid, ghostHover, "cursor-pointer")
1557
+ classNames: mx9(grid, ghostHover, "cursor-pointer")
1541
1558
  }, /* @__PURE__ */ React14.createElement(List2.ItemDragHandle, null), /* @__PURE__ */ React14.createElement(List2.ItemTitle, {
1542
1559
  onClick: () => handleSelect(field2)
1543
1560
  }, field2.path), /* @__PURE__ */ React14.createElement("div", {
@@ -1554,7 +1571,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
1554
1571
  role: "none",
1555
1572
  className: "p-2"
1556
1573
  }, /* @__PURE__ */ React14.createElement("label", {
1557
- className: mx8(inputTextLabel)
1574
+ className: mx9(inputTextLabel)
1558
1575
  }, t("hidden fields label"))), /* @__PURE__ */ React14.createElement(List2.Root, {
1559
1576
  items: hiddenProperties,
1560
1577
  isItem: (item) => typeof item === "string",
@@ -1565,7 +1582,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
1565
1582
  }, properties?.map((property) => /* @__PURE__ */ React14.createElement(List2.Item, {
1566
1583
  key: property,
1567
1584
  item: property,
1568
- classNames: mx8(grid, ghostHover, "cursor-pointer")
1585
+ classNames: mx9(grid, ghostHover, "cursor-pointer")
1569
1586
  }, /* @__PURE__ */ React14.createElement("div", null), /* @__PURE__ */ React14.createElement(List2.ItemTitle, null, property), /* @__PURE__ */ React14.createElement(List2.ItemButton, {
1570
1587
  icon: "ph--eye--regular",
1571
1588
  onClick: () => handleShow(property)
@@ -1849,8 +1866,10 @@ export {
1849
1866
  ControlFrame,
1850
1867
  ControlFrameItem,
1851
1868
  ControlGroup,
1869
+ ControlGroupButton,
1852
1870
  ControlItem,
1853
1871
  ControlItemInput,
1872
+ ControlPage,
1854
1873
  ControlSection,
1855
1874
  ControlSectionHeading,
1856
1875
  DeprecatedFormContainer,