@bfrs/agentic-components 0.8.7 → 0.8.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/BFRS_AGENTIC_COMPONENTS.md +1 -0
- package/dist/components/data-display/DataTable/TableSaveView.d.ts +14 -1
- package/dist/components/data-display/DataTable/TableSaveView.js +164 -144
- package/dist/components/data-display/DataTable/TableSaveView.js.map +1 -1
- package/dist/components/data-display/DataTable/TableViewSelector.d.ts +15 -1
- package/dist/components/data-display/DataTable/TableViewSelector.js +304 -296
- package/dist/components/data-display/DataTable/TableViewSelector.js.map +1 -1
- package/dist/components/data-display/DataTable/index.d.ts +1 -0
- package/dist/components/data-display/DataTable/savedViewAnalytics.d.ts +109 -0
- package/dist/components/data-display/DataTable/savedViewAnalytics.js +140 -0
- package/dist/components/data-display/DataTable/savedViewAnalytics.js.map +1 -0
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/patterns/ChatComposer/ChatComposer.d.ts +10 -0
- package/dist/components/ui/patterns/ChatComposer/ChatComposer.js +79 -78
- package/dist/components/ui/patterns/ChatComposer/ChatComposer.js.map +1 -1
- package/dist/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.d.ts +18 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.js +12 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.js.map +1 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/analyticsContext.d.ts +78 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/analyticsContext.js +41 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/analyticsContext.js.map +1 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/index.d.ts +4 -0
- package/dist/components/ui/providers/BfrsProvider/BfrsProvider.d.ts +25 -0
- package/dist/components/ui/providers/BfrsProvider/BfrsProvider.js +42 -41
- package/dist/components/ui/providers/BfrsProvider/BfrsProvider.js.map +1 -1
- package/dist/custom-elements.js +9330 -9141
- package/dist/custom-elements.js.map +1 -1
- package/dist/index.js +224 -213
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/lint/cli.cjs +6 -0
|
@@ -1,73 +1,74 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { ensureDocumentStyles as
|
|
5
|
-
import { createAgenticThemeVariables as
|
|
6
|
-
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as S, useState as d, useMemo as i, useCallback as g, useContext as P, useEffect as x, createContext as B } from "react";
|
|
3
|
+
import { cn as C } from "../../../../lib/cn.js";
|
|
4
|
+
import { ensureDocumentStyles as R } from "../../../../lib/documentStyles.js";
|
|
5
|
+
import { createAgenticThemeVariables as M } from "../../../../theme/overrides.js";
|
|
6
|
+
import { BfrsAnalyticsProvider as N } from "../BfrsAnalyticsProvider/BfrsAnalyticsProvider.js";
|
|
7
|
+
const y = B({
|
|
7
8
|
root: null
|
|
8
9
|
});
|
|
9
|
-
function
|
|
10
|
-
if (
|
|
11
|
-
if (typeof
|
|
12
|
-
e
|
|
10
|
+
function T(t, e) {
|
|
11
|
+
if (t) {
|
|
12
|
+
if (typeof t == "function") {
|
|
13
|
+
t(e);
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
t.current = e;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
|
-
const
|
|
19
|
+
const V = (t) => t, a = (t, e) => {
|
|
19
20
|
const r = {
|
|
20
21
|
display: "contents"
|
|
21
22
|
};
|
|
22
|
-
if (
|
|
23
|
+
if (e && (r.colorScheme = e), !t)
|
|
23
24
|
return r;
|
|
24
|
-
for (let
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
for (let s = 0; s < t.style.length; s += 1) {
|
|
26
|
+
const o = t.style.item(s);
|
|
27
|
+
o.startsWith("--bfrs-") && (r[o] = t.style.getPropertyValue(o));
|
|
27
28
|
}
|
|
28
29
|
return r;
|
|
29
|
-
},
|
|
30
|
-
const [
|
|
31
|
-
(
|
|
32
|
-
|
|
30
|
+
}, w = S(({ analytics: t, className: e, colorScheme: r = "light", theme: s, style: o, ...n }, c) => {
|
|
31
|
+
const [f, b] = d(null), u = i(() => V(M(s ?? {})), [s]), p = i(() => ({ ...u, ...o }), [o, u]), h = g(
|
|
32
|
+
(m) => {
|
|
33
|
+
b(m), T(c, m);
|
|
33
34
|
},
|
|
34
|
-
[
|
|
35
|
-
),
|
|
35
|
+
[c]
|
|
36
|
+
), v = i(
|
|
36
37
|
() => ({
|
|
37
|
-
root:
|
|
38
|
-
colorScheme:
|
|
38
|
+
root: f,
|
|
39
|
+
colorScheme: r
|
|
39
40
|
}),
|
|
40
|
-
[
|
|
41
|
+
[r, f]
|
|
41
42
|
);
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ l(N, { emit: t, children: /* @__PURE__ */ l(y.Provider, { value: v, children: /* @__PURE__ */ l(
|
|
43
44
|
"div",
|
|
44
45
|
{
|
|
45
|
-
ref:
|
|
46
|
+
ref: h,
|
|
46
47
|
"data-bfrs-root": "",
|
|
47
|
-
"data-bfrs-color-scheme":
|
|
48
|
-
className:
|
|
49
|
-
style:
|
|
50
|
-
...
|
|
48
|
+
"data-bfrs-color-scheme": r,
|
|
49
|
+
className: C("bfrs", e),
|
|
50
|
+
style: p,
|
|
51
|
+
...n
|
|
51
52
|
}
|
|
52
|
-
) });
|
|
53
|
+
) }) });
|
|
53
54
|
});
|
|
54
|
-
|
|
55
|
-
function
|
|
56
|
-
const { root:
|
|
55
|
+
w.displayName = "BfrsProvider";
|
|
56
|
+
function F({ children: t }) {
|
|
57
|
+
const { root: e, colorScheme: r } = P(y), [s, o] = d(() => a(e, r));
|
|
57
58
|
return x(() => {
|
|
58
|
-
if (
|
|
59
|
+
if (R(), o(a(e, r)), !e || typeof globalThis.MutationObserver > "u")
|
|
59
60
|
return;
|
|
60
61
|
const n = new globalThis.MutationObserver(() => {
|
|
61
|
-
|
|
62
|
+
o(a(e, r));
|
|
62
63
|
});
|
|
63
|
-
return n.observe(
|
|
64
|
+
return n.observe(e, {
|
|
64
65
|
attributes: !0,
|
|
65
66
|
attributeFilter: ["style", "data-bfrs-color-scheme"]
|
|
66
67
|
}), () => n.disconnect();
|
|
67
|
-
}, [r,
|
|
68
|
+
}, [r, e]), /* @__PURE__ */ l("div", { className: "bfrs", "data-bfrs-portal": "", "data-bfrs-color-scheme": r, style: s, children: t });
|
|
68
69
|
}
|
|
69
70
|
export {
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
F as BfrsPortalScope,
|
|
72
|
+
w as BfrsProvider
|
|
72
73
|
};
|
|
73
74
|
//# sourceMappingURL=BfrsProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BfrsProvider.js","sources":["../../../../../src/components/ui/providers/BfrsProvider/BfrsProvider.tsx"],"sourcesContent":["import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type MutableRefObject,\n type ReactNode,\n type Ref\n} from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport { ensureDocumentStyles } from \"@/lib/documentStyles\";\nimport { createAgenticThemeVariables, type AgenticThemeOverrides } from \"@/theme\";\n\nexport type BfrsColorScheme = \"light\" | \"dark\";\n\nexport type BfrsProviderProps = HTMLAttributes<HTMLDivElement> & {\n theme?: AgenticThemeOverrides;\n colorScheme?: BfrsColorScheme;\n};\n\ntype BfrsStyleScopeContextValue = {\n root: HTMLElement | null;\n colorScheme?: BfrsColorScheme;\n};\n\nconst BfrsStyleScopeContext = createContext<BfrsStyleScopeContextValue>({\n root: null\n});\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(value);\n return;\n }\n\n (ref as MutableRefObject<T | null>).current = value;\n}\n\nconst toStyleProperties = (variables: Record<string, string | undefined>) => variables as CSSProperties;\n\nconst collectBfrsInlineStyle = (root: HTMLElement | null, colorScheme?: BfrsColorScheme): CSSProperties => {\n const style: Record<string, string> = {\n display: \"contents\"\n };\n\n if (colorScheme) {\n style.colorScheme = colorScheme;\n }\n\n if (!root) {\n return style as CSSProperties;\n }\n\n for (let index = 0; index < root.style.length; index += 1) {\n const name = root.style.item(index);\n\n if (name.startsWith(\"--bfrs-\")) {\n style[name] = root.style.getPropertyValue(name);\n }\n }\n\n return style as CSSProperties;\n};\n\nexport const BfrsProvider = forwardRef<HTMLDivElement, BfrsProviderProps>(({ className, colorScheme = \"light\", theme, style, ...props }, ref) => {\n const [root, setRoot] = useState<HTMLDivElement | null>(null);\n const themeStyle = useMemo(() => toStyleProperties(createAgenticThemeVariables(theme ?? {})), [theme]);\n const mergedStyle = useMemo(() => ({ ...themeStyle, ...style }), [style, themeStyle]);\n\n const handleRef = useCallback(\n (node: HTMLDivElement | null) => {\n setRoot(node);\n assignRef(ref, node);\n },\n [ref]\n );\n\n const contextValue = useMemo(\n () => ({\n root,\n colorScheme\n }),\n [colorScheme, root]\n );\n\n return (\n <BfrsStyleScopeContext.Provider value={contextValue}>\n
|
|
1
|
+
{"version":3,"file":"BfrsProvider.js","sources":["../../../../../src/components/ui/providers/BfrsProvider/BfrsProvider.tsx"],"sourcesContent":["import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type MutableRefObject,\n type ReactNode,\n type Ref\n} from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport { ensureDocumentStyles } from \"@/lib/documentStyles\";\nimport { createAgenticThemeVariables, type AgenticThemeOverrides } from \"@/theme\";\nimport { BfrsAnalyticsProvider } from \"../BfrsAnalyticsProvider/BfrsAnalyticsProvider\";\nimport type { BfrsAnalyticsSink } from \"../BfrsAnalyticsProvider/analyticsContext\";\n\nexport type BfrsColorScheme = \"light\" | \"dark\";\n\nexport type BfrsProviderProps = HTMLAttributes<HTMLDivElement> & {\n theme?: AgenticThemeOverrides;\n colorScheme?: BfrsColorScheme;\n /**\n * Where library-owned interactions are reported, wired once per app:\n *\n * ```tsx\n * <BfrsProvider analytics={(event) => analytics.track(event.name, event.properties)}>\n * ```\n *\n * Nothing in the library touches `gtag`, `dataLayer` or a provider SDK — it\n * hands the event here and the app decides what happens to it. Omitted, the\n * library reports nothing.\n */\n analytics?: BfrsAnalyticsSink;\n};\n\ntype BfrsStyleScopeContextValue = {\n root: HTMLElement | null;\n colorScheme?: BfrsColorScheme;\n};\n\nconst BfrsStyleScopeContext = createContext<BfrsStyleScopeContextValue>({\n root: null\n});\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(value);\n return;\n }\n\n (ref as MutableRefObject<T | null>).current = value;\n}\n\nconst toStyleProperties = (variables: Record<string, string | undefined>) => variables as CSSProperties;\n\nconst collectBfrsInlineStyle = (root: HTMLElement | null, colorScheme?: BfrsColorScheme): CSSProperties => {\n const style: Record<string, string> = {\n display: \"contents\"\n };\n\n if (colorScheme) {\n style.colorScheme = colorScheme;\n }\n\n if (!root) {\n return style as CSSProperties;\n }\n\n for (let index = 0; index < root.style.length; index += 1) {\n const name = root.style.item(index);\n\n if (name.startsWith(\"--bfrs-\")) {\n style[name] = root.style.getPropertyValue(name);\n }\n }\n\n return style as CSSProperties;\n};\n\nexport const BfrsProvider = forwardRef<HTMLDivElement, BfrsProviderProps>(({ analytics, className, colorScheme = \"light\", theme, style, ...props }, ref) => {\n const [root, setRoot] = useState<HTMLDivElement | null>(null);\n const themeStyle = useMemo(() => toStyleProperties(createAgenticThemeVariables(theme ?? {})), [theme]);\n const mergedStyle = useMemo(() => ({ ...themeStyle, ...style }), [style, themeStyle]);\n\n const handleRef = useCallback(\n (node: HTMLDivElement | null) => {\n setRoot(node);\n assignRef(ref, node);\n },\n [ref]\n );\n\n const contextValue = useMemo(\n () => ({\n root,\n colorScheme\n }),\n [colorScheme, root]\n );\n\n return (\n <BfrsAnalyticsProvider emit={analytics}>\n <BfrsStyleScopeContext.Provider value={contextValue}>\n <div\n ref={handleRef}\n data-bfrs-root=\"\"\n data-bfrs-color-scheme={colorScheme}\n className={cn(\"bfrs\", className)}\n style={mergedStyle}\n {...props}\n />\n </BfrsStyleScopeContext.Provider>\n </BfrsAnalyticsProvider>\n );\n});\n\nBfrsProvider.displayName = \"BfrsProvider\";\n\nexport function BfrsStyleScope({ children, root, colorScheme = \"light\" }: { children: ReactNode; root: HTMLElement | null; colorScheme?: BfrsColorScheme }) {\n const contextValue = useMemo(\n () => ({\n root,\n colorScheme\n }),\n [colorScheme, root]\n );\n\n return <BfrsStyleScopeContext.Provider value={contextValue}>{children}</BfrsStyleScopeContext.Provider>;\n}\n\nexport function BfrsPortalScope({ children }: { children: ReactNode }) {\n const { root, colorScheme } = useContext(BfrsStyleScopeContext);\n const [portalStyle, setPortalStyle] = useState<CSSProperties>(() => collectBfrsInlineStyle(root, colorScheme));\n\n useEffect(() => {\n // Overlays portal to <body>; make sure the document carries the library\n // stylesheet so portaled content stays styled.\n ensureDocumentStyles();\n setPortalStyle(collectBfrsInlineStyle(root, colorScheme));\n\n if (!root || typeof globalThis.MutationObserver === \"undefined\") {\n return undefined;\n }\n\n const observer = new globalThis.MutationObserver(() => {\n setPortalStyle(collectBfrsInlineStyle(root, colorScheme));\n });\n\n observer.observe(root, {\n attributes: true,\n attributeFilter: [\"style\", \"data-bfrs-color-scheme\"]\n });\n\n return () => observer.disconnect();\n }, [colorScheme, root]);\n\n return (\n <div className=\"bfrs\" data-bfrs-portal=\"\" data-bfrs-color-scheme={colorScheme} style={portalStyle}>\n {children}\n </div>\n );\n}\n"],"names":["BfrsStyleScopeContext","createContext","assignRef","ref","value","toStyleProperties","variables","collectBfrsInlineStyle","root","colorScheme","style","index","name","BfrsProvider","forwardRef","analytics","className","theme","props","setRoot","useState","themeStyle","useMemo","createAgenticThemeVariables","mergedStyle","handleRef","useCallback","node","contextValue","jsx","BfrsAnalyticsProvider","cn","BfrsPortalScope","children","useContext","portalStyle","setPortalStyle","useEffect","ensureDocumentStyles","observer"],"mappings":";;;;;;AA4CA,MAAMA,IAAwBC,EAA0C;AAAA,EACtE,MAAM;AACR,CAAC;AAED,SAASC,EAAaC,GAAyBC,GAAiB;AAC9D,MAAKD,GAIL;AAAA,QAAI,OAAOA,KAAQ,YAAY;AAC7B,MAAAA,EAAIC,CAAK;AACT;AAAA,IACF;AAEC,IAAAD,EAAmC,UAAUC;AAAA;AAChD;AAEA,MAAMC,IAAoB,CAACC,MAAkDA,GAEvEC,IAAyB,CAACC,GAA0BC,MAAiD;AACzG,QAAMC,IAAgC;AAAA,IACpC,SAAS;AAAA,EAAA;AAOX,MAJID,MACFC,EAAM,cAAcD,IAGlB,CAACD;AACH,WAAOE;AAGT,WAASC,IAAQ,GAAGA,IAAQH,EAAK,MAAM,QAAQG,KAAS,GAAG;AACzD,UAAMC,IAAOJ,EAAK,MAAM,KAAKG,CAAK;AAElC,IAAIC,EAAK,WAAW,SAAS,MAC3BF,EAAME,CAAI,IAAIJ,EAAK,MAAM,iBAAiBI,CAAI;AAAA,EAElD;AAEA,SAAOF;AACT,GAEaG,IAAeC,EAA8C,CAAC,EAAE,WAAAC,GAAW,WAAAC,GAAW,aAAAP,IAAc,SAAS,OAAAQ,GAAO,OAAAP,GAAO,GAAGQ,EAAA,GAASf,MAAQ;AAC1J,QAAM,CAACK,GAAMW,CAAO,IAAIC,EAAgC,IAAI,GACtDC,IAAaC,EAAQ,MAAMjB,EAAkBkB,EAA4BN,KAAS,EAAE,CAAC,GAAG,CAACA,CAAK,CAAC,GAC/FO,IAAcF,EAAQ,OAAO,EAAE,GAAGD,GAAY,GAAGX,EAAA,IAAU,CAACA,GAAOW,CAAU,CAAC,GAE9EI,IAAYC;AAAA,IAChB,CAACC,MAAgC;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