formanitor 0.1.7 → 0.1.9
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 +142 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +143 -64
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
- package/src/styles/index.css +28 -0
package/dist/index.cjs
CHANGED
|
@@ -11,6 +11,7 @@ var react = require('@tiptap/react');
|
|
|
11
11
|
var StarterKit = require('@tiptap/starter-kit');
|
|
12
12
|
var Placeholder = require('@tiptap/extension-placeholder');
|
|
13
13
|
var Underline = require('@tiptap/extension-underline');
|
|
14
|
+
var extensionTable = require('@tiptap/extension-table');
|
|
14
15
|
var reactSlot = require('@radix-ui/react-slot');
|
|
15
16
|
var SeparatorPrimitive = require('@radix-ui/react-separator');
|
|
16
17
|
var SelectPrimitive = require('@radix-ui/react-select');
|
|
@@ -2228,9 +2229,47 @@ function isEmptyHtml(html) {
|
|
|
2228
2229
|
const t = html.trim();
|
|
2229
2230
|
return t === "" || t === "<p></p>" || t === "<p><br></p>" || t === '<p><br class="ProseMirror-trailingBreak"></p>';
|
|
2230
2231
|
}
|
|
2232
|
+
function buildRichTextExtensions(placeholder, tables) {
|
|
2233
|
+
const base = [
|
|
2234
|
+
StarterKit__default.default.configure({
|
|
2235
|
+
// Disable headings entirely so the UI/content can't introduce H2/H3.
|
|
2236
|
+
heading: false,
|
|
2237
|
+
bulletList: {
|
|
2238
|
+
HTMLAttributes: {
|
|
2239
|
+
class: "list-disc pl-6 my-2"
|
|
2240
|
+
}
|
|
2241
|
+
},
|
|
2242
|
+
orderedList: {
|
|
2243
|
+
HTMLAttributes: {
|
|
2244
|
+
class: "list-decimal pl-6 my-2"
|
|
2245
|
+
}
|
|
2246
|
+
},
|
|
2247
|
+
listItem: {
|
|
2248
|
+
HTMLAttributes: {
|
|
2249
|
+
class: "my-1"
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
}),
|
|
2253
|
+
Underline__default.default,
|
|
2254
|
+
Placeholder__default.default.configure({
|
|
2255
|
+
placeholder
|
|
2256
|
+
})
|
|
2257
|
+
];
|
|
2258
|
+
if (!tables) return base;
|
|
2259
|
+
return [
|
|
2260
|
+
...base,
|
|
2261
|
+
extensionTable.Table.configure({
|
|
2262
|
+
resizable: false
|
|
2263
|
+
}),
|
|
2264
|
+
extensionTable.TableRow,
|
|
2265
|
+
extensionTable.TableHeader,
|
|
2266
|
+
extensionTable.TableCell
|
|
2267
|
+
];
|
|
2268
|
+
}
|
|
2231
2269
|
function RichTextToolbar({
|
|
2232
2270
|
editor,
|
|
2233
|
-
disabled
|
|
2271
|
+
disabled,
|
|
2272
|
+
tablesEnabled
|
|
2234
2273
|
}) {
|
|
2235
2274
|
const [, rerender] = React15.useReducer((n) => n + 1, 0);
|
|
2236
2275
|
React15.useEffect(() => {
|
|
@@ -2261,6 +2300,7 @@ function RichTextToolbar({
|
|
|
2261
2300
|
children: icon
|
|
2262
2301
|
}
|
|
2263
2302
|
);
|
|
2303
|
+
const inTable = tablesEnabled && editor.isActive("table");
|
|
2264
2304
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2265
2305
|
"div",
|
|
2266
2306
|
{
|
|
@@ -2305,6 +2345,46 @@ function RichTextToolbar({
|
|
|
2305
2345
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListOrdered, { className: "h-4 w-4" }),
|
|
2306
2346
|
"Numbered list"
|
|
2307
2347
|
),
|
|
2348
|
+
tablesEnabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2349
|
+
/* @__PURE__ */ jsxRuntime.jsx(Separator, { orientation: "vertical", className: "mx-0.5 h-6" }),
|
|
2350
|
+
!inTable ? fmtBtn(
|
|
2351
|
+
false,
|
|
2352
|
+
() => editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(),
|
|
2353
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Table, { className: "h-4 w-4" }),
|
|
2354
|
+
"Insert table"
|
|
2355
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2356
|
+
fmtBtn(
|
|
2357
|
+
false,
|
|
2358
|
+
() => editor.chain().focus().addRowAfter().run(),
|
|
2359
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Rows2, { className: "h-4 w-4" }),
|
|
2360
|
+
"Add row below"
|
|
2361
|
+
),
|
|
2362
|
+
fmtBtn(
|
|
2363
|
+
false,
|
|
2364
|
+
() => editor.chain().focus().addColumnAfter().run(),
|
|
2365
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Columns2, { className: "h-4 w-4" }),
|
|
2366
|
+
"Add column right"
|
|
2367
|
+
),
|
|
2368
|
+
fmtBtn(
|
|
2369
|
+
false,
|
|
2370
|
+
() => editor.chain().focus().deleteRow().run(),
|
|
2371
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.TableRowsSplit, { className: "h-4 w-4" }),
|
|
2372
|
+
"Delete row"
|
|
2373
|
+
),
|
|
2374
|
+
fmtBtn(
|
|
2375
|
+
false,
|
|
2376
|
+
() => editor.chain().focus().deleteColumn().run(),
|
|
2377
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.TableColumnsSplit, { className: "h-4 w-4" }),
|
|
2378
|
+
"Delete column"
|
|
2379
|
+
),
|
|
2380
|
+
fmtBtn(
|
|
2381
|
+
false,
|
|
2382
|
+
() => editor.chain().focus().deleteTable().run(),
|
|
2383
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }),
|
|
2384
|
+
"Delete table"
|
|
2385
|
+
)
|
|
2386
|
+
] })
|
|
2387
|
+
] }),
|
|
2308
2388
|
/* @__PURE__ */ jsxRuntime.jsx(Separator, { orientation: "vertical", className: "mx-0.5 h-6" }),
|
|
2309
2389
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2310
2390
|
Button,
|
|
@@ -2345,33 +2425,10 @@ var RichTextWidget = ({ fieldId }) => {
|
|
|
2345
2425
|
const def = fieldDef;
|
|
2346
2426
|
const placeholder = def?.placeholder ?? "Start typing\u2026";
|
|
2347
2427
|
const minHeight = def?.minHeight ?? 160;
|
|
2428
|
+
const tablesEnabled = !!def?.tables;
|
|
2348
2429
|
const extensions = React15.useMemo(
|
|
2349
|
-
() =>
|
|
2350
|
-
|
|
2351
|
-
// Disable headings entirely so the UI/content can't introduce H2/H3.
|
|
2352
|
-
heading: false,
|
|
2353
|
-
bulletList: {
|
|
2354
|
-
HTMLAttributes: {
|
|
2355
|
-
class: "list-disc pl-6 my-2"
|
|
2356
|
-
}
|
|
2357
|
-
},
|
|
2358
|
-
orderedList: {
|
|
2359
|
-
HTMLAttributes: {
|
|
2360
|
-
class: "list-decimal pl-6 my-2"
|
|
2361
|
-
}
|
|
2362
|
-
},
|
|
2363
|
-
listItem: {
|
|
2364
|
-
HTMLAttributes: {
|
|
2365
|
-
class: "my-1"
|
|
2366
|
-
}
|
|
2367
|
-
}
|
|
2368
|
-
}),
|
|
2369
|
-
Underline__default.default,
|
|
2370
|
-
Placeholder__default.default.configure({
|
|
2371
|
-
placeholder
|
|
2372
|
-
})
|
|
2373
|
-
],
|
|
2374
|
-
[placeholder]
|
|
2430
|
+
() => buildRichTextExtensions(placeholder, tablesEnabled),
|
|
2431
|
+
[placeholder, tablesEnabled]
|
|
2375
2432
|
);
|
|
2376
2433
|
const stringValue = typeof value === "string" ? value : "";
|
|
2377
2434
|
const editor = react.useEditor(
|
|
@@ -2388,7 +2445,7 @@ var RichTextWidget = ({ fieldId }) => {
|
|
|
2388
2445
|
editorProps: {
|
|
2389
2446
|
attributes: {
|
|
2390
2447
|
id: fieldId,
|
|
2391
|
-
class: "focus:outline-none",
|
|
2448
|
+
class: "tiptap focus:outline-none",
|
|
2392
2449
|
style: `min-height: ${minHeight}px`
|
|
2393
2450
|
}
|
|
2394
2451
|
}
|
|
@@ -2454,7 +2511,14 @@ var RichTextWidget = ({ fieldId }) => {
|
|
|
2454
2511
|
)
|
|
2455
2512
|
),
|
|
2456
2513
|
children: [
|
|
2457
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2514
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2515
|
+
RichTextToolbar,
|
|
2516
|
+
{
|
|
2517
|
+
editor,
|
|
2518
|
+
disabled,
|
|
2519
|
+
tablesEnabled
|
|
2520
|
+
}
|
|
2521
|
+
),
|
|
2458
2522
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2459
2523
|
"div",
|
|
2460
2524
|
{
|
|
@@ -2480,6 +2544,9 @@ var RichTextWidget = ({ fieldId }) => {
|
|
|
2480
2544
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
2481
2545
|
] });
|
|
2482
2546
|
};
|
|
2547
|
+
function richTextHtmlClassName() {
|
|
2548
|
+
return cn("richtext-content prose prose-sm max-w-none");
|
|
2549
|
+
}
|
|
2483
2550
|
var Select = SelectPrimitive__namespace.Root;
|
|
2484
2551
|
var SelectValue = SelectPrimitive__namespace.Value;
|
|
2485
2552
|
var SelectTrigger = React15__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2763,7 +2830,7 @@ var MultiSelectWidget = ({ fieldId }) => {
|
|
|
2763
2830
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
2764
2831
|
] });
|
|
2765
2832
|
};
|
|
2766
|
-
var
|
|
2833
|
+
var Table2 = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2767
2834
|
"table",
|
|
2768
2835
|
{
|
|
2769
2836
|
ref,
|
|
@@ -2771,9 +2838,9 @@ var Table = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
2771
2838
|
...props
|
|
2772
2839
|
}
|
|
2773
2840
|
) }));
|
|
2774
|
-
|
|
2775
|
-
var
|
|
2776
|
-
|
|
2841
|
+
Table2.displayName = "Table";
|
|
2842
|
+
var TableHeader2 = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
2843
|
+
TableHeader2.displayName = "TableHeader";
|
|
2777
2844
|
var TableBody = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2778
2845
|
"tbody",
|
|
2779
2846
|
{
|
|
@@ -2795,7 +2862,7 @@ var TableFooter = React15__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
2795
2862
|
}
|
|
2796
2863
|
));
|
|
2797
2864
|
TableFooter.displayName = "TableFooter";
|
|
2798
|
-
var
|
|
2865
|
+
var TableRow2 = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2799
2866
|
"tr",
|
|
2800
2867
|
{
|
|
2801
2868
|
ref,
|
|
@@ -2806,7 +2873,7 @@ var TableRow = React15__namespace.forwardRef(({ className, ...props }, ref) => /
|
|
|
2806
2873
|
...props
|
|
2807
2874
|
}
|
|
2808
2875
|
));
|
|
2809
|
-
|
|
2876
|
+
TableRow2.displayName = "TableRow";
|
|
2810
2877
|
var TableHead = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2811
2878
|
"th",
|
|
2812
2879
|
{
|
|
@@ -2819,7 +2886,7 @@ var TableHead = React15__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
2819
2886
|
}
|
|
2820
2887
|
));
|
|
2821
2888
|
TableHead.displayName = "TableHead";
|
|
2822
|
-
var
|
|
2889
|
+
var TableCell2 = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2823
2890
|
"td",
|
|
2824
2891
|
{
|
|
2825
2892
|
ref,
|
|
@@ -2827,7 +2894,7 @@ var TableCell = React15__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
2827
2894
|
...props
|
|
2828
2895
|
}
|
|
2829
2896
|
));
|
|
2830
|
-
|
|
2897
|
+
TableCell2.displayName = "TableCell";
|
|
2831
2898
|
var TableCaption = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2832
2899
|
"caption",
|
|
2833
2900
|
{
|
|
@@ -2877,15 +2944,15 @@ var RepeatableWidget = ({
|
|
|
2877
2944
|
}
|
|
2878
2945
|
)
|
|
2879
2946
|
] }),
|
|
2880
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2881
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2947
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsxs(Table2, { children: [
|
|
2948
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeader2, { children: /* @__PURE__ */ jsxRuntime.jsxs(TableRow2, { children: [
|
|
2882
2949
|
def.row.map((subDef) => /* @__PURE__ */ jsxRuntime.jsx(TableHead, { children: subDef.label }, subDef.id)),
|
|
2883
2950
|
/* @__PURE__ */ jsxRuntime.jsx(TableHead, { className: "w-[50px]" })
|
|
2884
2951
|
] }) }),
|
|
2885
2952
|
/* @__PURE__ */ jsxRuntime.jsxs(TableBody, { children: [
|
|
2886
2953
|
rows.map(
|
|
2887
|
-
(row, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2888
|
-
def.row.map((subDef) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2954
|
+
(row, index) => /* @__PURE__ */ jsxRuntime.jsxs(TableRow2, { children: [
|
|
2955
|
+
def.row.map((subDef) => /* @__PURE__ */ jsxRuntime.jsx(TableCell2, { children: subDef.type === "number" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2889
2956
|
"input",
|
|
2890
2957
|
{
|
|
2891
2958
|
type: "number",
|
|
@@ -2903,7 +2970,7 @@ var RepeatableWidget = ({
|
|
|
2903
2970
|
disabled
|
|
2904
2971
|
}
|
|
2905
2972
|
) }, subDef.id)),
|
|
2906
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2973
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell2, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2907
2974
|
Button,
|
|
2908
2975
|
{
|
|
2909
2976
|
type: "button",
|
|
@@ -2917,8 +2984,8 @@ var RepeatableWidget = ({
|
|
|
2917
2984
|
) })
|
|
2918
2985
|
] }, index)
|
|
2919
2986
|
),
|
|
2920
|
-
rows.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2921
|
-
|
|
2987
|
+
rows.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(TableRow2, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2988
|
+
TableCell2,
|
|
2922
2989
|
{
|
|
2923
2990
|
colSpan: def.row.length + 1,
|
|
2924
2991
|
className: "h-24 text-center",
|
|
@@ -4099,6 +4166,7 @@ var FormFileUploadWidget = ({
|
|
|
4099
4166
|
if (hadLocal) {
|
|
4100
4167
|
const next = Array.from(localFiles).filter((_, i) => i !== index);
|
|
4101
4168
|
if (next.length === 0) {
|
|
4169
|
+
store.setExternalError(fieldId, null);
|
|
4102
4170
|
setLocalFiles(null);
|
|
4103
4171
|
setValue(null);
|
|
4104
4172
|
return;
|
|
@@ -4113,14 +4181,17 @@ var FormFileUploadWidget = ({
|
|
|
4113
4181
|
}
|
|
4114
4182
|
if (allowMultiple && Array.isArray(value)) {
|
|
4115
4183
|
const next = value.filter((_, i) => i !== index);
|
|
4184
|
+
if (next.length === 0) store.setExternalError(fieldId, null);
|
|
4116
4185
|
setValue(next.length ? next : null);
|
|
4117
4186
|
return;
|
|
4118
4187
|
}
|
|
4188
|
+
store.setExternalError(fieldId, null);
|
|
4119
4189
|
setValue(null);
|
|
4120
4190
|
};
|
|
4121
4191
|
const handleChange = async (files) => {
|
|
4122
4192
|
setTouched();
|
|
4123
4193
|
if (!files || files.length === 0) {
|
|
4194
|
+
store.setExternalError(fieldId, null);
|
|
4124
4195
|
setLocalFiles(null);
|
|
4125
4196
|
setValue(null);
|
|
4126
4197
|
return;
|
|
@@ -4128,16 +4199,20 @@ var FormFileUploadWidget = ({
|
|
|
4128
4199
|
const selected = Array.from(files);
|
|
4129
4200
|
for (const file of selected) {
|
|
4130
4201
|
if (!matchesAccept(file, accept)) {
|
|
4131
|
-
|
|
4202
|
+
setLocalFiles(null);
|
|
4203
|
+
store.setExternalError(fieldId, `File type not allowed: ${file.name}`);
|
|
4132
4204
|
return;
|
|
4133
4205
|
}
|
|
4134
4206
|
if (file.size > maxSize) {
|
|
4135
|
-
|
|
4207
|
+
setLocalFiles(null);
|
|
4208
|
+
store.setExternalError(
|
|
4209
|
+
fieldId,
|
|
4136
4210
|
`File must be less than ${Math.round(maxSize / (1024 * 1024))}MB: ${file.name}`
|
|
4137
4211
|
);
|
|
4138
4212
|
return;
|
|
4139
4213
|
}
|
|
4140
4214
|
}
|
|
4215
|
+
store.setExternalError(fieldId, null);
|
|
4141
4216
|
const toUpload = allowMultiple ? selected : [selected[0]];
|
|
4142
4217
|
setLocalFiles(fileListFromArray(toUpload));
|
|
4143
4218
|
setIsUploading(true);
|
|
@@ -4153,10 +4228,11 @@ var FormFileUploadWidget = ({
|
|
|
4153
4228
|
const key = await uploadHandler(toUpload[0], toUpload[0].name);
|
|
4154
4229
|
setValue(key);
|
|
4155
4230
|
}
|
|
4231
|
+
store.setExternalError(fieldId, null);
|
|
4156
4232
|
} catch (err) {
|
|
4157
4233
|
console.error("[FormFileUpload] Upload failed:", err);
|
|
4158
4234
|
const message = err instanceof Error ? err.message : "Upload failed. Please try again.";
|
|
4159
|
-
|
|
4235
|
+
store.setExternalError(fieldId, message);
|
|
4160
4236
|
setLocalFiles(null);
|
|
4161
4237
|
setValue(null);
|
|
4162
4238
|
} finally {
|
|
@@ -4385,23 +4461,23 @@ var EditableTableWidget = ({
|
|
|
4385
4461
|
/* @__PURE__ */ jsxRuntime.jsx(Label, { children: fieldDef.label }),
|
|
4386
4462
|
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: fieldDef.description })
|
|
4387
4463
|
] }),
|
|
4388
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4389
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4464
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsxs(Table2, { children: [
|
|
4465
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeader2, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxRuntime.jsx(TableRow2, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(TableHead, { children: header.isPlaceholder ? null : reactTable.flexRender(
|
|
4390
4466
|
header.column.columnDef.header,
|
|
4391
4467
|
header.getContext()
|
|
4392
4468
|
) }, header.id)) }, headerGroup.id)) }),
|
|
4393
4469
|
/* @__PURE__ */ jsxRuntime.jsx(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4394
|
-
|
|
4470
|
+
TableRow2,
|
|
4395
4471
|
{
|
|
4396
4472
|
"data-state": row.getIsSelected() && "selected",
|
|
4397
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4473
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(TableCell2, { className: "p-1", children: reactTable.flexRender(
|
|
4398
4474
|
cell.column.columnDef.cell,
|
|
4399
4475
|
cell.getContext()
|
|
4400
4476
|
) }, cell.id))
|
|
4401
4477
|
},
|
|
4402
4478
|
row.id
|
|
4403
|
-
)) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4404
|
-
|
|
4479
|
+
)) : /* @__PURE__ */ jsxRuntime.jsx(TableRow2, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4480
|
+
TableCell2,
|
|
4405
4481
|
{
|
|
4406
4482
|
colSpan: columns.length,
|
|
4407
4483
|
className: "h-24 text-center",
|
|
@@ -15401,7 +15477,10 @@ var ReadOnlyText = ({ fieldDef, value }) => {
|
|
|
15401
15477
|
isRichText ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
15402
15478
|
"div",
|
|
15403
15479
|
{
|
|
15404
|
-
className:
|
|
15480
|
+
className: cn(
|
|
15481
|
+
richTextHtmlClassName(),
|
|
15482
|
+
"text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50"
|
|
15483
|
+
),
|
|
15405
15484
|
dangerouslySetInnerHTML: { __html: displayValue }
|
|
15406
15485
|
}
|
|
15407
15486
|
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem] whitespace-pre-wrap", children: displayValue || /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "No value" }) })
|
|
@@ -15470,10 +15549,10 @@ var ReadOnlyRepeatable = ({ fieldDef, value }) => {
|
|
|
15470
15549
|
const rows = Array.isArray(value) ? value : [];
|
|
15471
15550
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
15472
15551
|
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium text-gray-700", children: fieldDef.label }),
|
|
15473
|
-
rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-400 italic border border-gray-200 rounded-md p-4 bg-gray-50 text-center", children: "No items" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-gray-200 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15474
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15552
|
+
rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-400 italic border border-gray-200 rounded-md p-4 bg-gray-50 text-center", children: "No items" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-gray-200 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsxs(Table2, { children: [
|
|
15553
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeader2, { children: /* @__PURE__ */ jsxRuntime.jsx(TableRow2, { children: fieldDef.row.map((subDef) => /* @__PURE__ */ jsxRuntime.jsx(TableHead, { className: "bg-gray-50", children: subDef.label }, subDef.id)) }) }),
|
|
15475
15554
|
/* @__PURE__ */ jsxRuntime.jsx(TableBody, { children: rows.map(
|
|
15476
|
-
(row, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15555
|
+
(row, index) => /* @__PURE__ */ jsxRuntime.jsx(TableRow2, { children: fieldDef.row.map((subDef) => /* @__PURE__ */ jsxRuntime.jsx(TableCell2, { className: "text-gray-900", children: row[subDef.id] ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "\u2014" }) }, subDef.id)) }, index)
|
|
15477
15556
|
) })
|
|
15478
15557
|
] }) })
|
|
15479
15558
|
] });
|
|
@@ -15653,16 +15732,16 @@ var ReadOnlyTable = ({
|
|
|
15653
15732
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
15654
15733
|
/* @__PURE__ */ jsxRuntime.jsx(Label, { children: fieldDef.label }),
|
|
15655
15734
|
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: fieldDef.description }),
|
|
15656
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15657
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15735
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsxs(Table2, { children: [
|
|
15736
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeader2, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxRuntime.jsx(TableRow2, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(TableHead, { children: header.isPlaceholder ? null : reactTable.flexRender(
|
|
15658
15737
|
header.column.columnDef.header,
|
|
15659
15738
|
header.getContext()
|
|
15660
15739
|
) }, header.id)) }, headerGroup.id)) }),
|
|
15661
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15740
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(TableRow2, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(TableCell2, { className: "p-2", children: reactTable.flexRender(
|
|
15662
15741
|
cell.column.columnDef.cell,
|
|
15663
15742
|
cell.getContext()
|
|
15664
|
-
) }, cell.id)) }, row.id)) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
15665
|
-
|
|
15743
|
+
) }, cell.id)) }, row.id)) : /* @__PURE__ */ jsxRuntime.jsx(TableRow2, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
15744
|
+
TableCell2,
|
|
15666
15745
|
{
|
|
15667
15746
|
colSpan: columns.length,
|
|
15668
15747
|
className: "h-16 text-center text-muted-foreground",
|
|
@@ -16403,6 +16482,7 @@ exports.fieldLabelClass = fieldLabelClass;
|
|
|
16403
16482
|
exports.fieldMetaRequestsMarMedicationOrdersButton = fieldMetaRequestsMarMedicationOrdersButton;
|
|
16404
16483
|
exports.fieldWrapperClass = fieldWrapperClass;
|
|
16405
16484
|
exports.isLabelVisible = isLabelVisible;
|
|
16485
|
+
exports.richTextHtmlClassName = richTextHtmlClassName;
|
|
16406
16486
|
exports.useField = useField;
|
|
16407
16487
|
exports.useFieldHandlers = useFieldHandlers;
|
|
16408
16488
|
exports.useForm = useForm;
|