@fayz-ai/plugin-forms 0.1.4 → 0.2.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.
- package/dist/config.d.ts +4 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/index.cjs +22 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -16
- package/dist/index.js.map +1 -1
- package/dist/views/CustomFormsSettingsTab.d.ts +1 -3
- package/dist/views/CustomFormsSettingsTab.d.ts.map +1 -1
- package/package.json +7 -9
- package/src/config.ts +5 -1
- package/src/index.ts +20 -3
- package/src/views/CustomFormsSettingsTab.tsx +2 -19
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AASnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAyCxD,YAAY,EAAE,wBAAwB,EAAE,CAAA;AACxC,OAAO,EAAE,4BAA4B,EAAE,KAAK,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEnH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,cAAc,CA6J1F"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FormRenderer } from './chunk-32I43T37.js';
|
|
2
2
|
import React2, { useState, useCallback, useRef, useEffect } from 'react';
|
|
3
3
|
import { registerTranslations, createSafeDataProvider, useTranslation, getSupabaseClientOptional, getActiveTenantId } from '@fayz-ai/core';
|
|
4
|
+
import { PluginSettingsPanel } from '@fayz-ai/saas';
|
|
4
5
|
import { create } from 'zustand';
|
|
5
|
-
import { FileText, Image, Paperclip,
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { FileText, Image, Paperclip, Search, Plus, Pencil, Trash2, ArrowLeft, Loader2, Save, ChevronDown, Upload, Eye } from 'lucide-react';
|
|
7
|
+
import { Input, Button, Card, CardContent, Badge, useSaveBar, Dropdown, DropdownTrigger, DropdownContent, DropdownSeparator, DropdownLabel, DropdownItem } from '@fayz-ai/ui';
|
|
8
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
9
|
|
|
9
10
|
// src/data/mock.ts
|
|
10
11
|
function uuid() {
|
|
@@ -694,6 +695,7 @@ var customFormsLocales = {
|
|
|
694
695
|
var DEFAULT_LABELS = {
|
|
695
696
|
pageTitle: "Custom Forms",
|
|
696
697
|
settingsLabel: "Forms & Documents",
|
|
698
|
+
settingsSubtitle: "Create and manage custom forms for your business",
|
|
697
699
|
templates: "Templates",
|
|
698
700
|
documents: "Documents",
|
|
699
701
|
newTemplate: "New Template",
|
|
@@ -815,8 +817,7 @@ function TemplateListView({ store, config, onEdit, onNew }) {
|
|
|
815
817
|
] }) }, i)) })
|
|
816
818
|
] });
|
|
817
819
|
}
|
|
818
|
-
function CustomFormsSettingsTab({ config, provider, store
|
|
819
|
-
const t = useTranslation();
|
|
820
|
+
function CustomFormsSettingsTab({ config, provider, store }) {
|
|
820
821
|
const [builderTemplateId, setBuilderTemplateId] = useState(null);
|
|
821
822
|
const handleNew = useCallback(() => {
|
|
822
823
|
setBuilderTemplateId("__new__");
|
|
@@ -840,7 +841,7 @@ function CustomFormsSettingsTab({ config, provider, store, registries }) {
|
|
|
840
841
|
}
|
|
841
842
|
checkHash();
|
|
842
843
|
}, []);
|
|
843
|
-
|
|
844
|
+
return builderTemplateId ? /* @__PURE__ */ jsx(
|
|
844
845
|
BuilderWrapper,
|
|
845
846
|
{
|
|
846
847
|
templateId: builderTemplateId === "__new__" ? void 0 : builderTemplateId,
|
|
@@ -858,13 +859,6 @@ function CustomFormsSettingsTab({ config, provider, store, registries }) {
|
|
|
858
859
|
onNew: handleNew
|
|
859
860
|
}
|
|
860
861
|
);
|
|
861
|
-
return /* @__PURE__ */ jsxs("div", { style: { padding: "24px" }, children: [
|
|
862
|
-
/* @__PURE__ */ jsxs("div", { style: { marginBottom: "16px" }, children: [
|
|
863
|
-
/* @__PURE__ */ jsx("h1", { style: { fontSize: "20px", fontWeight: 600, margin: 0 }, children: t("customForms.settingsTitle") }),
|
|
864
|
-
/* @__PURE__ */ jsx("p", { style: { color: "var(--muted-foreground, #6b7280)", margin: "4px 0 0", fontSize: "14px" }, children: t("customForms.settingsSubtitle") })
|
|
865
|
-
] }),
|
|
866
|
-
templatesContent
|
|
867
|
-
] });
|
|
868
862
|
}
|
|
869
863
|
function BuilderWrapper({
|
|
870
864
|
templateId,
|
|
@@ -1514,8 +1508,23 @@ function createCustomFormsPlugin(options) {
|
|
|
1514
1508
|
]
|
|
1515
1509
|
}
|
|
1516
1510
|
];
|
|
1517
|
-
const
|
|
1518
|
-
SettingsComponent
|
|
1511
|
+
const registries = [...formRegistries, ...options?.settingsRegistries ?? []];
|
|
1512
|
+
const SettingsComponent = () => React2.createElement(PluginSettingsPanel, {
|
|
1513
|
+
title: config.labels.settingsLabel,
|
|
1514
|
+
subtitle: config.labels.settingsSubtitle,
|
|
1515
|
+
customTabs: [
|
|
1516
|
+
{
|
|
1517
|
+
id: "forms",
|
|
1518
|
+
label: config.labels.pageTitle,
|
|
1519
|
+
icon: "FileText",
|
|
1520
|
+
content: React2.createElement(CustomFormsSettingsTab, { config, provider, store })
|
|
1521
|
+
}
|
|
1522
|
+
],
|
|
1523
|
+
registries,
|
|
1524
|
+
routeBase: "/settings/custom_forms",
|
|
1525
|
+
hostPluginId: "custom_forms"
|
|
1526
|
+
});
|
|
1527
|
+
SettingsComponent.displayName = "CustomFormsSettingsPanel";
|
|
1519
1528
|
const PersonDocumentsWidget2 = (props) => React2.createElement(PersonDocumentsWidget, { ...props, config, provider, store });
|
|
1520
1529
|
PersonDocumentsWidget2.displayName = "PersonDocumentsWidget";
|
|
1521
1530
|
return {
|
|
@@ -1549,7 +1558,7 @@ function createCustomFormsPlugin(options) {
|
|
|
1549
1558
|
order: 0
|
|
1550
1559
|
}
|
|
1551
1560
|
],
|
|
1552
|
-
registries
|
|
1561
|
+
registries,
|
|
1553
1562
|
aiTools: [
|
|
1554
1563
|
{
|
|
1555
1564
|
id: "custom_forms.list-templates",
|