@restio/ui 0.2.2-20261120112041 → 0.2.2-20261120112131
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/core.cjs +1 -1
- package/dist/core.d.ts +16 -2
- package/dist/core.js +27 -26
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +1 -0
- package/dist/data.js +1 -1
- package/dist/experimental.cjs +1 -1
- package/dist/experimental.d.ts +1 -0
- package/dist/experimental.js +100 -100
- package/dist/framework.cjs +1 -1
- package/dist/framework.d.ts +1 -0
- package/dist/framework.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/index.js +79 -78
- package/dist/src-C-0-H5TG.cjs +159 -0
- package/dist/{src-EDgNKq5W.js → src-DzNRRdGD.js} +8939 -8496
- package/dist/ui.css +1 -1
- package/package.json +1 -1
- package/dist/src-CIRn7l8b.cjs +0 -158
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./src-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./src-C-0-H5TG.cjs");exports.AnchoredOverlay=e.AnchoredOverlay;exports.Banner=e.Banner;exports.Button=e.Button;exports.ButtonDropdown=e.ButtonDropdown;exports.ButtonGroup=e.ButtonGroup;exports.CellType=e.CellType;exports.Checkbox=e.Checkbox;exports.CheckboxGroup=e.CheckboxGroup;exports.DatePicker=e.DatePicker;exports.DateRangePicker=e.DateRangePicker;exports.FileUpload=e.FileUpload;exports.Icon=e.Icon;exports.Input=e.Input;exports.Kbd=e.Kbd;exports.Label=e.Label;exports.Menu=e.Menu;exports.NumberInput=e.NumberInput;exports.OTP=e.OTPComponent;exports.OverlayPanel=e.OverlayPanel;exports.PasswordInput=e.PasswordInput;exports.ProgressBar=e.ProgressBar;exports.Radio=e.Radio;exports.RadioGroup=e.RadioGroup;exports.Select=e.Select;exports.SelectionGrid=e.SelectionGrid;exports.ShortcutProvider=e.ShortcutProvider;exports.Stack=e.Stack;exports.Tag=e.Tag;exports.TextInput=e.TextInput;exports.Textarea=e.Textarea;exports.Typography=e.Typography;exports.useDynamicVirtualList=e.useDynamicVirtualList;exports.useShortcut=e.useShortcut;
|
package/dist/core.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ declare const CellType: {
|
|
|
58
58
|
readonly BUTTON_GROUP: "BUTTON_GROUP";
|
|
59
59
|
readonly TEXT: "TEXT";
|
|
60
60
|
readonly TEXTAREA: "TEXTAREA";
|
|
61
|
+
readonly PASSWORD: "PASSWORD";
|
|
61
62
|
readonly NUMBER: "NUMBER";
|
|
62
63
|
readonly DATE: "DATE";
|
|
63
64
|
readonly DATE_RANGE: "DATE_RANGE";
|
|
@@ -465,6 +466,19 @@ interface TextInputProps extends sharedInputProps {
|
|
|
465
466
|
|
|
466
467
|
declare const TextInput: React__default.FC<TextInputProps>;
|
|
467
468
|
|
|
469
|
+
/** Props for `PasswordInput`: a text field that masks its value. */
|
|
470
|
+
interface PasswordInputProps extends sharedInputProps {
|
|
471
|
+
value: string | undefined;
|
|
472
|
+
onChange: (value: string | undefined) => void;
|
|
473
|
+
/** Shows a button that reveals the value while pressed. @default true */
|
|
474
|
+
revealable?: boolean;
|
|
475
|
+
/** Browser autofill hint, e.g. `current-password`, `new-password` or `off`. @default "off" */
|
|
476
|
+
autoComplete?: string;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/** Single-line input that masks its value, with an optional button to reveal it. */
|
|
480
|
+
declare const PasswordInput: React__default.FC<PasswordInputProps>;
|
|
481
|
+
|
|
468
482
|
interface SelectTemplateProps {
|
|
469
483
|
options: Option[];
|
|
470
484
|
value: string | string[];
|
|
@@ -974,5 +988,5 @@ interface UseDynamicVirtualListResult {
|
|
|
974
988
|
*/
|
|
975
989
|
declare function useDynamicVirtualList({ count, estimatedItemHeight, overscan, }: UseDynamicVirtualListOptions): UseDynamicVirtualListResult;
|
|
976
990
|
|
|
977
|
-
export { AnchoredOverlay, Banner, Button, ButtonDropdown, ButtonGroup, CellType, Checkbox, CheckboxGroup, DatePicker, DateRangePicker, FileUpload, Icon, Input, Kbd, Label, Menu, NumberInput, OTPComponent as OTP, OverlayPanel, ProgressBar, Radio, RadioGroup, Select, SelectionGrid, ShortcutProvider, Stack, Tag, TextInput, Textarea, Typography, useDynamicVirtualList, useShortcut };
|
|
978
|
-
export type { AnchoredOverlayProps, BannerProps, Breakpoint, ButtonDropdownProps, ButtonGroupProps, ButtonProps, CheckboxGroupProps, CheckboxOption, CheckboxProps, DatePickerMode, DatePickerProps, DateRange, DateRangePickerProps, DynamicVirtualItem, IconProps, InputProps, KbdProps, LabelProps, ListItemVariant, MenuItem, MenuProps, MenuSubmenuProps, NumberInputProps, OTPProps, Option, OverlayPanelFooterProps, OverlayPanelHeaderProps, OverlayPanelPosition, OverlayPanelProps, OverlayPanelVariant, ProgressBarProps, RadioGroupProps, RadioOption, RadioProps, SelectProps, SelectionGridProps, ShortcutConfig, Size, StackProps, State, TagProps, TextInputProps, TextareaProps, TypographyProps, TypographyVariant, UseDynamicVirtualListOptions, UseDynamicVirtualListResult, UseShortcutOptions };
|
|
991
|
+
export { AnchoredOverlay, Banner, Button, ButtonDropdown, ButtonGroup, CellType, Checkbox, CheckboxGroup, DatePicker, DateRangePicker, FileUpload, Icon, Input, Kbd, Label, Menu, NumberInput, OTPComponent as OTP, OverlayPanel, PasswordInput, ProgressBar, Radio, RadioGroup, Select, SelectionGrid, ShortcutProvider, Stack, Tag, TextInput, Textarea, Typography, useDynamicVirtualList, useShortcut };
|
|
992
|
+
export type { AnchoredOverlayProps, BannerProps, Breakpoint, ButtonDropdownProps, ButtonGroupProps, ButtonProps, CheckboxGroupProps, CheckboxOption, CheckboxProps, DatePickerMode, DatePickerProps, DateRange, DateRangePickerProps, DynamicVirtualItem, IconProps, InputProps, KbdProps, LabelProps, ListItemVariant, MenuItem, MenuProps, MenuSubmenuProps, NumberInputProps, OTPProps, Option, OverlayPanelFooterProps, OverlayPanelHeaderProps, OverlayPanelPosition, OverlayPanelProps, OverlayPanelVariant, PasswordInputProps, ProgressBarProps, RadioGroupProps, RadioOption, RadioProps, SelectProps, SelectionGridProps, ShortcutConfig, Size, StackProps, State, TagProps, TextInputProps, TextareaProps, TypographyProps, TypographyVariant, UseDynamicVirtualListOptions, UseDynamicVirtualListResult, UseShortcutOptions };
|
package/dist/core.js
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { At as a, Bt as s, Ct as e, Dt as o, Et as r, Ft as n, Gt as u, Ht as p, It as c,
|
|
1
|
+
import { At as a, Bt as s, Ct as e, Dt as o, Et as r, Ft as n, Gt as u, Ht as p, It as c, Jt as i, Kt as l, Lt as d, Mt as P, Nt as T, Ot as h, Pt as y, St as b, Tt as k, Ut as x, Vt as B, Wt as I, _t as S, bt as g, gt as m, ht as C, jt as D, kt as G, qt as O, vt as v, wt as w, xt as L, yt as R, zt as A } from "./src-DzNRRdGD.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
s as AnchoredOverlay,
|
|
4
|
+
p as Banner,
|
|
5
|
+
x as Button,
|
|
6
|
+
d as ButtonDropdown,
|
|
7
|
+
B as ButtonGroup,
|
|
8
|
+
v as CellType,
|
|
9
|
+
c as Checkbox,
|
|
10
|
+
n as CheckboxGroup,
|
|
11
11
|
e as DatePicker,
|
|
12
|
-
|
|
12
|
+
b as DateRangePicker,
|
|
13
13
|
g as FileUpload,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
i as Icon,
|
|
15
|
+
O as Input,
|
|
16
|
+
D as Kbd,
|
|
17
|
+
k as Label,
|
|
18
|
+
L as Menu,
|
|
19
|
+
a as NumberInput,
|
|
20
|
+
l as OTP,
|
|
21
|
+
P as OverlayPanel,
|
|
22
|
+
G as PasswordInput,
|
|
23
|
+
R as ProgressBar,
|
|
24
|
+
y as Radio,
|
|
25
|
+
T as RadioGroup,
|
|
25
26
|
r as Select,
|
|
26
|
-
|
|
27
|
+
h as SelectionGrid,
|
|
27
28
|
S as ShortcutProvider,
|
|
28
29
|
o as Stack,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
I as Tag,
|
|
31
|
+
A as TextInput,
|
|
32
|
+
w as Textarea,
|
|
33
|
+
u as Typography,
|
|
33
34
|
C as useDynamicVirtualList,
|
|
34
35
|
m as useShortcut
|
|
35
36
|
};
|
package/dist/data.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./src-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./src-C-0-H5TG.cjs");exports.Calendar=e.Calendar;exports.Card=e.Card;exports.CardList=e.CardList;exports.Cell=e.Cell;exports.Chart=e.Chart;exports.DataComponentConfigurator=e.DataComponentConfigurator;exports.Form=e.Form;exports.Gantt=e.Gantt;exports.KPI=e.KPI;exports.Switcher=e.Switcher;exports.TableGrid=e.TableGrid;exports.Tree=e.Tree;exports.TreeCard=e.TreeCard;exports.cardLayoutPresetOptions=e.cardLayoutPresetOptions;exports.cardLayoutWithIcon=e.cardLayoutWithIcon;exports.createDataStructureFromFile=e.createDataStructureFromFile;exports.financeKpiLayout=e.financeKpiLayout;exports.financeKpiLayoutWithIcon=e.financeKpiLayoutWithIcon;exports.kpiLayoutPresetOptions=e.kpiLayoutPresetOptions;exports.resolveCardLayoutPreset=e.resolveCardLayoutPreset;exports.resolveKpiLayoutPreset=e.resolveKpiLayoutPreset;
|
package/dist/data.d.ts
CHANGED
package/dist/data.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as s, B as t, F as e, H as r, I as o, K as i, L as n, M as p, N as u, P as c, R as C, T as L, U as d, V as l, W as y, j as P, k as m, pt as K, q as f, w as h, z as F } from "./src-
|
|
1
|
+
import { A as s, B as t, F as e, H as r, I as o, K as i, L as n, M as p, N as u, P as c, R as C, T as L, U as d, V as l, W as y, j as P, k as m, pt as K, q as f, w as h, z as F } from "./src-DzNRRdGD.js";
|
|
2
2
|
export {
|
|
3
3
|
l as Calendar,
|
|
4
4
|
y as Card,
|
package/dist/experimental.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./src-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./src-C-0-H5TG.cjs");let s=require("react");s=n.__toESM(s,1);let xe=require("react-dom");var we={"rst-pip-container":"_rst-pip-container_63eby_1"},e=n.require_jsx_runtime(),ye=({pipWindow:a,className:r,children:d,...t})=>{if(!a)return null;const m=[we["rst-pip-container"],r].filter(Boolean).join(" ");return(0,xe.createPortal)((0,e.jsx)("div",{className:m,...t,children:d}),a.document.body)};function be(){return globalThis.documentPictureInPicture}function Ce(){return be()!==void 0}function je(a,r=document){for(const d of Array.from(r.querySelectorAll('style, link[rel="stylesheet"]')))a.head.appendChild(d.cloneNode(!0));for(const{name:d,value:t}of Array.from(r.documentElement.attributes))a.documentElement.setAttribute(d,t);for(const{name:d,value:t}of Array.from(r.body.attributes))a.body.setAttribute(d,t)}function Se(a){const r=a.createElement("style");r.textContent=["html, body { height: 100%; margin: 0; }","body {"," background-color: var(--rst-backgroundColor-default);"," color: var(--rst-fontColor-main);"," font: var(--rst-font-body);","}"].join(`
|
|
2
2
|
`),a.head.appendChild(r)}function ke({width:a,height:r,copyStyles:d=!0}={}){const[t,m]=(0,s.useState)(null),[p,v]=(0,s.useState)(null),j=(0,s.useRef)(null),k=(0,s.useCallback)(async()=>{const x=be();if(!(!x||j.current)){v(null);try{const g=await x.requestWindow({width:a,height:r});j.current=g,d&&je(g.document),Se(g.document),g.addEventListener("pagehide",()=>{j.current=null,m(null)}),m(g)}catch(g){v(g instanceof Error?`${g.name}: ${g.message}`:String(g))}}},[a,r,d]),b=(0,s.useCallback)(()=>{j.current?.close()},[]);return(0,s.useEffect)(()=>()=>j.current?.close(),[]),{pipWindow:t,error:p,isOpen:t!==null,isSupported:Ce(),open:k,close:b}}var Me=1;function Ne(a,r){const d=a.col+a.w,t=a.row+a.h,m=r.col+r.w,p=r.row+r.h;return a.col<m&&d>r.col&&a.row<p&&t>r.row}function ie(a){return a.col>=1&&a.col+a.w-1<=12&&a.row>=1&&a.row+a.h-1<=30}function oe(a,r,d){for(const t of r)if(t.id!==d&&Ne(a,t.position))return t.id;return null}function he(a,r,d){for(let p=1;p<=30-r+1;p++)for(let v=1;v<=12-a+1;v++){const j={col:v,row:p,w:a,h:r};if(!oe(j,d))return j}return{col:1,row:d.reduce((p,v)=>Math.max(p,v.position.row+v.position.h),1),w:a,h:r}}function De(a,r){const d={};for(const t of a){const m=r[t.dataSourceId];if(!m)continue;const p=m.data??[],v=p.length>0?Object.keys(p[0]):[],j=n.generateColumnsFromSchema(v),k=t.columns??j,b=n.fieldOptionsFromColumns(k),x=new Set,g=[];for(const w of b)x.has(w.id)||(x.add(w.id),g.push(w));d[t.dataSourceId]=g}return d}var ne=0;function ce(){return ne+=1,`widget-${Date.now()}-${ne}`}function ue(){return{version:1,name:"Untitled Dashboard",filters:null,widgets:[]}}function ze(a,r){const[d,t]=(0,s.useState)(a??ue),[m,p]=(0,s.useState)(null),[v,j]=(0,s.useState)(r?"view":"edit"),k=(0,s.useRef)(!1),b=(0,s.useCallback)(()=>{k.current=!0},[]),x=(0,s.useCallback)((c,_,E)=>{t(o=>{const S={id:ce(),title:`New ${c}`,componentType:c,dataSourceId:_,position:E};return{...o,widgets:[...o.widgets,S]}}),b()},[b]),g=(0,s.useCallback)(c=>{t(_=>{const E=he(6,3,_.widgets),o={id:ce(),position:E,...c.widget};return{..._,widgets:[..._.widgets,o]}}),b()},[b]),w=(0,s.useCallback)(c=>{t(_=>({..._,widgets:_.widgets.filter(E=>E.id!==c)})),p(_=>_===c?null:_),b()},[b]),I=(0,s.useCallback)((c,_)=>{t(E=>({...E,widgets:E.widgets.map(o=>{if(o.id!==c)return o;const S={...o,..._};if(_.dataSourceId&&_.dataSourceId!==o.dataSourceId){const F=n.propSchemaRegistry[o.componentType]??[];S.columns=void 0,S.componentProps=n.buildDefaultPropsFromSchema(F),S.filters=void 0,S.uiConfig=void 0}return S})})),b()},[b]),u=(0,s.useCallback)((c,_)=>{I(c,{position:_})},[I]),W=(0,s.useCallback)(c=>{p(c)},[]),G=d.widgets.find(c=>c.id===m)??null,B=(0,s.useCallback)(c=>{t(_=>({..._,name:c})),b()},[b]),l=(0,s.useCallback)(c=>{t(_=>({..._,filters:typeof c=="function"?c(_.filters):c})),b()},[b]),h=(0,s.useCallback)(c=>{t(c??ue()),p(null),k.current=!1},[]),D=(0,s.useCallback)(c=>{t(c),p(null),k.current=!1},[]);return{state:{config:d,selectedWidgetId:m,isDirty:k.current},mode:v,setMode:j,addWidget:x,addPrebuiltWidget:g,removeWidget:w,updateWidget:I,moveWidget:u,selectWidget:W,selectedWidget:G,setName:B,setFilters:l,resetConfig:h,loadConfig:D}}var i={"rst-dashboard-builder":"_rst-dashboard-builder_19ws7_2","rst-dashboard-builder-sidebar":"_rst-dashboard-builder-sidebar_19ws7_18","rst-dashboard-builder-sidebar-header":"_rst-dashboard-builder-sidebar-header_19ws7_28","rst-dashboard-builder-sidebar-list":"_rst-dashboard-builder-sidebar-list_19ws7_33","rst-dashboard-builder-widget-type-item":"_rst-dashboard-builder-widget-type-item_19ws7_40","rst-dashboard-builder-widget-type-label":"_rst-dashboard-builder-widget-type-label_19ws7_59","rst-dashboard-builder-widget-type-desc":"_rst-dashboard-builder-widget-type-desc_19ws7_63","rst-dashboard-builder-main":"_rst-dashboard-builder-main_19ws7_69","rst-dashboard-builder-toolbar":"_rst-dashboard-builder-toolbar_19ws7_77","rst-dashboard-builder-toolbar-left":"_rst-dashboard-builder-toolbar-left_19ws7_87","rst-dashboard-builder-toolbar-right":"_rst-dashboard-builder-toolbar-right_19ws7_93","rst-dashboard-builder-name-input":"_rst-dashboard-builder-name-input_19ws7_99","rst-dashboard-builder-name-display":"_rst-dashboard-builder-name-display_19ws7_115","rst-dashboard-builder-view":"_rst-dashboard-builder-view_19ws7_122","rst-dashboard-widget":"_rst-dashboard-widget_19ws7_146","rst-switcher":"_rst-switcher_19ws7_170","rst-dashboard-builder-canvas":"_rst-dashboard-builder-canvas_19ws7_183","rst-dashboard-builder-grid":"_rst-dashboard-builder-grid_19ws7_191","rst-dashboard-builder-grid-cell":"_rst-dashboard-builder-grid-cell_19ws7_201","rst-dashboard-builder-grid-cell-view":"_rst-dashboard-builder-grid-cell-view_19ws7_213","rst-dashboard-builder-grid-empty":"_rst-dashboard-builder-grid-empty_19ws7_219","rst-dashboard-builder-widget":"_rst-dashboard-builder-widget_19ws7_40","rst-dashboard-builder-widget-view":"_rst-dashboard-builder-widget-view_19ws7_290","rst-dashboard-builder-widget-selected":"_rst-dashboard-builder-widget-selected_19ws7_298","rst-dashboard-builder-widget-dragging":"_rst-dashboard-builder-widget-dragging_19ws7_304","rst-dashboard-builder-widget-collision":"_rst-dashboard-builder-widget-collision_19ws7_310","rst-dashboard-builder-resize-handle-n":"_rst-dashboard-builder-resize-handle-n_19ws7_317","rst-dashboard-builder-resize-handle-s":"_rst-dashboard-builder-resize-handle-s_19ws7_318","rst-dashboard-builder-resize-handle-e":"_rst-dashboard-builder-resize-handle-e_19ws7_319","rst-dashboard-builder-resize-handle-w":"_rst-dashboard-builder-resize-handle-w_19ws7_320","rst-dashboard-builder-resize-handle-ne":"_rst-dashboard-builder-resize-handle-ne_19ws7_321","rst-dashboard-builder-resize-handle-nw":"_rst-dashboard-builder-resize-handle-nw_19ws7_322","rst-dashboard-builder-resize-handle-se":"_rst-dashboard-builder-resize-handle-se_19ws7_323","rst-dashboard-builder-resize-handle-sw":"_rst-dashboard-builder-resize-handle-sw_19ws7_324","rst-dashboard-builder-filter-body":"_rst-dashboard-builder-filter-body_19ws7_540","rst-dashboard-builder-filter-tabs":"_rst-dashboard-builder-filter-tabs_19ws7_548","rst-dashboard-builder-configurator":"_rst-dashboard-builder-configurator_19ws7_557","rst-dashboard-builder-configurator-header":"_rst-dashboard-builder-configurator-header_19ws7_567","rst-dashboard-builder-configurator-body":"_rst-dashboard-builder-configurator-body_19ws7_575","rst-dashboard-builder-configurator-empty":"_rst-dashboard-builder-configurator-empty_19ws7_582","rst-dashboard-builder-configurator-divider":"_rst-dashboard-builder-configurator-divider_19ws7_593","rst-dashboard-builder-field":"_rst-dashboard-builder-field_19ws7_599","rst-dashboard-builder-field-label":"_rst-dashboard-builder-field-label_19ws7_605","rst-dashboard-builder-checkbox-row":"_rst-dashboard-builder-checkbox-row_19ws7_611","rst-dashboard-builder-checkbox-label":"_rst-dashboard-builder-checkbox-label_19ws7_618","rst-dashboard-builder-drag-ghost":"_rst-dashboard-builder-drag-ghost_19ws7_624","rst-dashboard-builder-drop-zone":"_rst-dashboard-builder-drop-zone_19ws7_638","rst-dashboard-builder-add-widget-item":"_rst-dashboard-builder-add-widget-item_19ws7_646","rst-dashboard-builder-add-widget-item-label":"_rst-dashboard-builder-add-widget-item-label_19ws7_667","rst-dashboard-builder-add-widget-item-desc":"_rst-dashboard-builder-add-widget-item-desc_19ws7_673","rst-dashboard-builder-template-wrapper":"_rst-dashboard-builder-template-wrapper_19ws7_679","rst-dashboard-builder-template-picker":"_rst-dashboard-builder-template-picker_19ws7_683","rst-dashboard-builder-template-picker-header":"_rst-dashboard-builder-template-picker-header_19ws7_697","rst-dashboard-builder-template-item":"_rst-dashboard-builder-template-item_19ws7_705","rst-dashboard-builder-template-item-name":"_rst-dashboard-builder-template-item-name_19ws7_727","rst-dashboard-builder-template-item-desc":"_rst-dashboard-builder-template-item-desc_19ws7_733"},Z=12,se=30,de=12;function Re({widgets:a,onMoveWidget:r,onAddWidget:d,onChange:t}){const m=(0,s.useRef)(null),[p,v]=(0,s.useState)(null),[j,k]=(0,s.useState)(null),[b,x]=(0,s.useState)(null),[g,w]=(0,s.useState)(null),[I,u]=(0,s.useState)(!1),[W,G]=(0,s.useState)(null),[B,l]=(0,s.useState)(null),[h,D]=(0,s.useState)(null),[c,_]=(0,s.useState)(null),[E,o]=(0,s.useState)(!1),S=(0,s.useCallback)(()=>m.current?{colWidth:(m.current.getBoundingClientRect().width-132)/Z,rowHeight:92}:null,[]),F=(0,s.useCallback)((C,M)=>{if(!m.current)return{col:1,row:1};const R=m.current.getBoundingClientRect(),z=(R.width-132)/Z;return{col:Math.max(1,Math.min(Z,Math.round((C-R.left)/(z+de))+1)),row:Math.max(1,Math.min(se,Math.round((M-R.top)/92)+1))}},[]),J=(0,s.useCallback)(C=>{if(C.preventDefault(),C.dataTransfer.types.includes("application/widget-type")){C.dataTransfer.dropEffect="copy";return}if(C.dataTransfer.types.includes("application/move-widget")&&p&&j&&b){C.dataTransfer.dropEffect="move";const M=a.find(P=>P.id===p);if(!M)return;const R=S();if(!R)return;const z=C.clientX-j.x,L=C.clientY-j.y,re=Math.round(z/(R.colWidth+de)),q=Math.round(L/R.rowHeight),H={col:Math.max(1,Math.min(Z-M.position.w+1,b.col+re)),row:Math.max(1,Math.min(se-M.position.h+1,b.row+q)),w:M.position.w,h:M.position.h};w(H);const T=oe(H,a,p);u(T!==null)}},[p,j,b,S,a]),Q=(0,s.useCallback)(C=>{C.preventDefault();const M=C.dataTransfer.getData("application/widget-type");if(M){const{col:R,row:z}=F(C.clientX,C.clientY),L={col:R,row:z,w:4,h:3};if(R+4-1>Z&&(L.col=9),z+3-1>se&&(L.row=28),oe(L,a))return;d(M,"",L),t();return}p&&g&&(!I&&ie(g)&&(r(p,g),t()),v(null),k(null),x(null),w(null),u(!1))},[F,a,d,t,p,g,I,r]),U=(0,s.useCallback)((C,M)=>{C.stopPropagation(),C.dataTransfer.setData("application/move-widget",M.id),C.dataTransfer.effectAllowed="move",v(M.id),k({x:C.clientX,y:C.clientY}),x({...M.position}),w({...M.position}),u(!1)},[]),ae=(0,s.useCallback)(()=>{v(null),k(null),x(null),w(null),u(!1)},[]),y=(0,s.useCallback)((C,M,R)=>{C.stopPropagation(),C.preventDefault(),G(M.id),l(R),D({...M.position}),_({x:C.clientX,y:C.clientY}),o(!1)},[]);return(0,s.useEffect)(()=>{if(!W||!B||!h||!c)return;const C=R=>{if(!a.find(N=>N.id===W))return;const z=S();if(!z)return;const L=R.clientX-c.x,re=R.clientY-c.y,q=Math.round(L/(z.colWidth+de)),H=Math.round(re/z.rowHeight),T=h.col,P=h.row,Y=h.w,K=h.h;let O={...h};switch(B){case"e":{const N=Math.max(1,Math.min(Z-T+1,Y+q));O={...O,w:N};break}case"w":{const N=Math.max(1,Math.min(T+Y-1,T+q)),A=T+Y-N;O={...h,col:N,w:Math.max(1,A)};break}case"s":{const N=Math.max(1,Math.min(se-P+1,K+H));O={...h,h:N};break}case"n":{const N=Math.max(1,Math.min(P+K-1,P+H)),A=P+K-N;O={...h,row:N,h:Math.max(1,A)};break}case"se":{const N=Math.max(1,Math.min(Z-T+1,Y+q)),A=Math.max(1,Math.min(se-P+1,K+H));O={...h,w:N,h:A};break}case"sw":{const N=Math.max(1,Math.min(T+Y-1,T+q)),A=T+Y-N,f=Math.max(1,Math.min(se-P+1,K+H));O={...h,col:N,w:Math.max(1,A),h:f};break}case"ne":{const N=Math.max(1,Math.min(P+K-1,P+H)),A=P+K-N,f=Math.max(1,Math.min(Z-T+1,Y+q));O={...h,row:N,h:Math.max(1,A),w:f};break}case"nw":{const N=Math.max(1,Math.min(T+Y-1,T+q)),A=Math.max(1,Math.min(P+K-1,P+H)),f=T+Y-N,$=P+K-A;O={col:N,row:A,w:Math.max(1,f),h:Math.max(1,$)};break}}w(O),v(W);const te=oe(O,a,W);o(te!==null),u(te!==null)},M=()=>{a.find(R=>R.id===W)&&g&&!E&&ie(g)&&(r(W,g),t()),G(null),l(null),D(null),_(null),o(!1),v(null),k(null),x(null),w(null),u(!1)};return document.addEventListener("mousemove",C),document.addEventListener("mouseup",M),()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",M)}},[W,B,h,c,a,g,E,S,r,t]),{gridRef:m,draggingWidgetId:p,dragPreviewPos:g,hasCollision:I,resizeCollision:E,handleDragOver:J,handleDrop:Q,handleWidgetDragStart:U,handleWidgetDragEnd:ae,handleResizeStart:y,pixelToGrid:F}}var Ie=12,Ee=20,me=({widgets:a,selectedWidgetId:r,dataSources:d,onSelectWidget:t,onMoveWidget:m,onRemoveWidget:p,onAddWidget:v,onChange:j,getWidgetActions:k,mode:b="edit"})=>{const x=b==="view",{gridRef:g,draggingWidgetId:w,dragPreviewPos:I,hasCollision:u,handleDragOver:W,handleDrop:G,handleWidgetDragStart:B,handleWidgetDragEnd:l,handleResizeStart:h}=Re({widgets:a,onMoveWidget:m,onAddWidget:v,onChange:j}),D=(0,s.useCallback)((o,S)=>{o.stopPropagation(),t(S)},[t]),c=(0,s.useCallback)(()=>{t(null)},[t]),_=(0,s.useCallback)(o=>{const S=d[o.dataSourceId]?.data??[],F=S.length>0?Object.keys(S[0]):[];return{data:S,columns:o.columns??n.generateColumnsFromSchema(F)}},[d]),E=[];for(let o=1;o<=Ee;o++)for(let S=1;S<=Ie;S++){const F=x?i["rst-dashboard-builder-grid-cell-view"]:i["rst-dashboard-builder-grid-cell"];E.push((0,e.jsx)("div",{className:F,style:{gridColumn:S,gridRow:o}},`cell-${o}-${S}`))}return(0,e.jsx)("div",{className:i["rst-dashboard-builder-canvas"],onClick:c,children:(0,e.jsxs)("div",{ref:g,className:i["rst-dashboard-builder-grid"],onDragOver:W,onDrop:G,children:[E,a.length===0&&(0,e.jsx)("div",{className:i["rst-dashboard-builder-grid-empty"],children:"Drag a widget from the palette to get started"}),a.map(o=>{const S=!x&&o.id===r,F=!x&&o.id===w,J=_(o),Q=F&&I?I:o.position,U=F&&u,ae=[i["rst-dashboard-builder-widget"],x?i["rst-dashboard-builder-widget-view"]:"",S?i["rst-dashboard-builder-widget-selected"]:"",F?i["rst-dashboard-builder-widget-dragging"]:"",U?i["rst-dashboard-builder-widget-collision"]:""].filter(Boolean).join(" ");return(0,e.jsxs)("div",{className:ae,style:{gridColumn:`${Q.col} / span ${Q.w}`,gridRow:`${Q.row} / span ${Q.h}`},draggable:!x,...x?{}:{onDragStart:y=>B(y,o),onDragEnd:l,onClick:y=>D(y,o.id),role:"button",tabIndex:0,"aria-label":`Widget: ${o.title}`,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),t(o.id)),(y.key==="Delete"||y.key==="Backspace")&&(y.preventDefault(),p(o.id),j())}},children:[(0,e.jsx)(n.DashboardWidget,{id:o.id,dataSourceId:o.dataSourceId,title:o.title,subtitle:o.subtitle,icon:o.icon,data:J.data,columns:J.columns,enableExport:k?.(o).enableExport??!0,enableScreenshot:k?.(o).enableScreenshot??!1,enableExpand:k?.(o).enableExpand??!0,enableFilter:k?.(o).enableFilter??!1,fieldOptions:n.fieldOptionsFromColumns(J.columns),children:({data:y})=>(0,e.jsx)(n.Switcher,{data:y,columns:J.columns,activeComponent:o.componentType,componentProps:o.componentProps,showConfigurator:!1})}),!x&&S&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:i["rst-dashboard-builder-resize-handle-n"],onMouseDown:y=>h(y,o,"n")}),(0,e.jsx)("div",{className:i["rst-dashboard-builder-resize-handle-s"],onMouseDown:y=>h(y,o,"s")}),(0,e.jsx)("div",{className:i["rst-dashboard-builder-resize-handle-e"],onMouseDown:y=>h(y,o,"e")}),(0,e.jsx)("div",{className:i["rst-dashboard-builder-resize-handle-w"],onMouseDown:y=>h(y,o,"w")}),(0,e.jsx)("div",{className:i["rst-dashboard-builder-resize-handle-ne"],onMouseDown:y=>h(y,o,"ne")}),(0,e.jsx)("div",{className:i["rst-dashboard-builder-resize-handle-nw"],onMouseDown:y=>h(y,o,"nw")}),(0,e.jsx)("div",{className:i["rst-dashboard-builder-resize-handle-se"],onMouseDown:y=>h(y,o,"se")}),(0,e.jsx)("div",{className:i["rst-dashboard-builder-resize-handle-sw"],onMouseDown:y=>h(y,o,"sw")})]})]},`${o.id}::${o.dataSourceId}`)})]})})};me.displayName="BuilderCanvas";var Pe=[{type:"table-grid",label:"Table",icon:"table",description:"Sortable, filterable data table"},{type:"chart",label:"Chart",icon:"chart",description:"Bar, line, pie charts"},{type:"calendar",label:"Calendar",icon:"calendar",description:"Calendar view of events"},{type:"card-list",label:"Card List",icon:"list",description:"Visual card layout"},{type:"form",label:"Form",icon:"form",description:"Editable form from schema"},{type:"gantt",label:"Gantt",icon:"chart-gantt",description:"Project timeline view"},{type:"kpi",label:"KPI",icon:"chart",description:"Single-metric KPI card"}],pe=({widget:a,dataSources:r,onUpdate:d,onRemove:t,onClose:m,onAddWidget:p,prebuiltSections:v,onAddPrebuiltSection:j})=>{const k=Object.values(r).map(l=>({value:l.id,label:l.name})),b=(0,s.useMemo)(()=>[{value:"",id:"none"},...Object.keys(n.svgAssets).map(l=>({value:l,leadingVisual:l}))],[]),x=a?.dataSourceId,g=(0,s.useMemo)(()=>{if(!x)return[];const l=r[x];return l?l.fields.map(h=>({id:h.id,header:h.name,accessorKey:h.id})):[]},[x,r]),w=(0,s.useMemo)(()=>n.propSchemaRegistry[a?.componentType??"table-grid"]??[],[a?.componentType]),I=(0,s.useMemo)(()=>a?.componentProps??n.buildDefaultPropsFromSchema(w),[a?.componentProps,w]),u=(0,s.useCallback)((l,h)=>{d({[l]:h})},[d]),W=(0,s.useCallback)(l=>{const h=n.propSchemaRegistry[l]??[];d({componentType:l,componentProps:n.buildDefaultPropsFromSchema(h)})},[d]),G=(0,s.useCallback)((l,h)=>{d({componentProps:{...I,[l]:h}})},[I,d]),B=(0,s.useMemo)(()=>!v||v.length===0?[]:v.filter(l=>l.version===1),[v]);return a?(0,e.jsxs)("aside",{className:i["rst-dashboard-builder-configurator"],"aria-label":"Widget configurator",children:[(0,e.jsxs)("div",{className:i["rst-dashboard-builder-configurator-header"],children:[(0,e.jsx)(n.Typography,{variant:"heading",children:"Configure"}),(0,e.jsx)(n.Button,{variant:"invisible",size:"small",leadingVisual:"close",onClick:m,"aria-label":"Close configurator"})]}),(0,e.jsxs)("div",{className:i["rst-dashboard-builder-configurator-body"],children:[(0,e.jsxs)("div",{className:i["rst-dashboard-builder-field"],children:[(0,e.jsx)("label",{className:i["rst-dashboard-builder-field-label"],children:"Title"}),(0,e.jsx)(n.TextInput,{value:a.title,onChange:l=>u("title",l??""),placeholder:"Widget title"})]}),(0,e.jsxs)("div",{className:i["rst-dashboard-builder-field"],children:[(0,e.jsx)("label",{className:i["rst-dashboard-builder-field-label"],children:"Subtitle"}),(0,e.jsx)(n.TextInput,{value:a.subtitle??"",onChange:l=>u("subtitle",l||void 0),placeholder:"Optional subtitle"})]}),(0,e.jsxs)("div",{className:i["rst-dashboard-builder-field"],children:[(0,e.jsx)("label",{className:i["rst-dashboard-builder-field-label"],children:"Icon"}),(0,e.jsx)(n.Select,{value:a.icon??"",onChange:l=>u("icon",l||void 0),options:b,renderList:({options:l,value:h,onChange:D,onClose:c})=>(0,e.jsx)(n.List,{options:l,activeIndex:[typeof h=="string"?h:""],onClick:_=>{D(_.value),c()},showFilter:!0})})]}),(0,e.jsxs)("div",{className:i["rst-dashboard-builder-field"],children:[(0,e.jsx)("label",{className:i["rst-dashboard-builder-field-label"],children:"Data Source"}),(0,e.jsx)(n.Select,{value:a.dataSourceId,onChange:l=>u("dataSourceId",l),options:k})]}),a.dataSourceId&&r[a.dataSourceId]&&(0,e.jsxs)("div",{className:i["rst-dashboard-builder-field"],children:[(0,e.jsx)("label",{className:i["rst-dashboard-builder-field-label"],children:"Columns"}),(0,e.jsx)(n.CheckboxGroup,{options:r[a.dataSourceId].fields.map(l=>({value:l.id,label:l.name})),value:a.columns?.map(l=>l.id).filter(Boolean)??r[a.dataSourceId].fields.map(l=>l.id),onChange:l=>{const h=r[a.dataSourceId],D=l.map(c=>h.fields.find(_=>_.id===c)).filter(Boolean).map(c=>({id:c.id,header:c.name,accessorKey:c.id}));d({columns:D.length===h.fields.length?void 0:D})}})]}),(0,e.jsxs)("div",{className:i["rst-dashboard-builder-field"],children:[(0,e.jsx)("label",{className:i["rst-dashboard-builder-field-label"],children:"Actions"}),(0,e.jsxs)("div",{className:i["rst-dashboard-builder-checkbox-row"],children:[(0,e.jsx)(n.Checkbox,{checked:a.enableExport??!0,onChange:l=>u("enableExport",l)}),(0,e.jsx)("span",{className:i["rst-dashboard-builder-checkbox-label"],children:"Export CSV"})]}),(0,e.jsxs)("div",{className:i["rst-dashboard-builder-checkbox-row"],children:[(0,e.jsx)(n.Checkbox,{checked:a.enableScreenshot??!1,onChange:l=>u("enableScreenshot",l)}),(0,e.jsx)("span",{className:i["rst-dashboard-builder-checkbox-label"],children:"Screenshot"})]}),(0,e.jsxs)("div",{className:i["rst-dashboard-builder-checkbox-row"],children:[(0,e.jsx)(n.Checkbox,{checked:a.enableExpand??!0,onChange:l=>u("enableExpand",l)}),(0,e.jsx)("span",{className:i["rst-dashboard-builder-checkbox-label"],children:"Expand"})]}),(0,e.jsxs)("div",{className:i["rst-dashboard-builder-checkbox-row"],children:[(0,e.jsx)(n.Checkbox,{checked:a.enableFilter??!0,onChange:l=>u("enableFilter",l)}),(0,e.jsx)("span",{className:i["rst-dashboard-builder-checkbox-label"],children:"Filter"})]})]}),(0,e.jsx)("div",{className:i["rst-dashboard-builder-configurator-divider"]}),(0,e.jsx)(n.DataComponentConfigurator,{schema:w,values:I,onChange:G,columns:g,scope:"all",componentId:a.componentType,onComponentChange:W,componentMetaList:n.dataComponentMetaList},a.dataSourceId??"no-ds"),(0,e.jsx)("div",{className:i["rst-dashboard-builder-configurator-divider"]}),(0,e.jsx)(n.Button,{variant:"danger",size:"small",value:"Remove widget",leadingVisual:"trash",onClick:t})]})]}):(0,e.jsxs)("aside",{className:i["rst-dashboard-builder-configurator"],"aria-label":"Add widget",children:[(0,e.jsx)("div",{className:i["rst-dashboard-builder-configurator-header"],children:(0,e.jsx)(n.Typography,{variant:"heading",children:"Add Widget"})}),(0,e.jsxs)("div",{className:i["rst-dashboard-builder-configurator-body"],children:[Pe.map(l=>(0,e.jsxs)("button",{className:i["rst-dashboard-builder-add-widget-item"],onClick:()=>p(l.type),children:[(0,e.jsx)(n.Icon,{src:l.icon}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:i["rst-dashboard-builder-add-widget-item-label"],children:l.label}),(0,e.jsx)("div",{className:i["rst-dashboard-builder-add-widget-item-desc"],children:l.description})]})]},l.type)),B.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:i["rst-dashboard-builder-configurator-divider"]}),(0,e.jsx)(n.Typography,{variant:"heading",children:"Pre-built Sections"}),B.map(l=>(0,e.jsxs)("button",{className:i["rst-dashboard-builder-add-widget-item"],onClick:()=>j?.(l),children:[(0,e.jsx)(n.Icon,{src:"layout"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:i["rst-dashboard-builder-add-widget-item-label"],children:l.name}),(0,e.jsx)("div",{className:i["rst-dashboard-builder-add-widget-item-desc"],children:l.description})]})]},l.name))]})]})]})};pe.displayName="WidgetConfigurator";var fe=({dataSources:a,initialConfig:r,templates:d,prebuiltSections:t,onSave:m,onChange:p,widgetActionDefaults:v,readOnly:j,className:k})=>{const{state:b,mode:x,setMode:g,addWidget:w,addPrebuiltWidget:I,removeWidget:u,updateWidget:W,moveWidget:G,selectWidget:B,selectedWidget:l,setName:h,setFilters:D,loadConfig:c}=ze(r,j),[_,E]=(0,s.useState)(!1),[o,S]=(0,s.useState)("dialog"),[F,J]=(0,s.useState)(null),[Q,U]=(0,s.useState)(null),[ae,y]=(0,s.useState)(!1),[C,M]=(0,s.useState)(null),R=(0,s.useMemo)(()=>De(b.config.widgets,a),[b.config.widgets,a]),z=x==="view",L=z?Q:b.config.filters;(0,s.useEffect)(()=>{_&&M(L)},[_]);const re=(0,s.useCallback)(()=>{z?U(C):D(C),E(!1)},[C,z,D]);(0,s.useEffect)(()=>{z&&!ae&&(U(b.config.filters),y(!0)),z||y(!1)},[z,ae,b.config.filters]);const q=(0,s.useRef)(p);q.current=p;const H=(0,s.useCallback)((f,$)=>{(z?U:D)(ee=>({...ee??{},[f]:$}))},[z,D]),T=(0,s.useMemo)(()=>({filters:L,onFilterChange:H}),[L,H]),P=(0,s.useMemo)(()=>!d||d.length===0?[]:d.filter(f=>f.version===1),[d]),Y=(0,s.useMemo)(()=>P.map(f=>({value:f.name,id:f.name,description:f.description})),[P]),K=(0,s.useCallback)(f=>{const $=P.find(X=>X.name===f);if(!$)return;const ee={version:1,...$.config};c(ee)},[P,c]),O=(0,s.useMemo)(()=>({enableExport:v?.enableExport??!0,enableScreenshot:v?.enableScreenshot??!1,enableExpand:v?.enableExpand??!0,enableFilter:v?.enableFilter??!0}),[v]),te=(0,s.useCallback)(f=>({enableExport:f.enableExport??O.enableExport,enableScreenshot:f.enableScreenshot??O.enableScreenshot,enableExpand:f.enableExpand??O.enableExpand,enableFilter:f.enableFilter??O.enableFilter}),[O]);(0,s.useEffect)(()=>{q.current?.(b.config)},[b.config]);const N=[i["rst-dashboard-builder"],k].filter(Boolean).join(" "),A=(0,s.useCallback)(()=>{m(b.config)},[b.config,m]);return(0,e.jsx)("div",{className:N,children:(0,e.jsxs)("div",{className:i["rst-dashboard-builder-main"],children:[(0,e.jsxs)("div",{className:i["rst-dashboard-builder-toolbar"],children:[(0,e.jsxs)("div",{className:i["rst-dashboard-builder-toolbar-left"],children:[z?(0,e.jsx)("span",{className:i["rst-dashboard-builder-name-display"],children:b.config.name}):(0,e.jsx)("input",{className:i["rst-dashboard-builder-name-input"],type:"text",value:b.config.name,onChange:f=>h(f.target.value),placeholder:"Dashboard name","aria-label":"Dashboard name"}),Object.keys(R).length>0&&(0,e.jsx)(n.Button,{variant:"invisible",size:"small",leadingVisual:"filter",onClick:()=>E(f=>!f),"aria-label":"Toggle filter panel","aria-pressed":_})]}),(0,e.jsxs)("div",{className:i["rst-dashboard-builder-toolbar-right"],children:[P.length>0&&!z&&(0,e.jsx)(n.ButtonDropdown,{options:Y,onChange:K,placeholder:"Load Template",size:"small"}),!j&&(0,e.jsx)(n.ButtonGroup,{value:x,options:[{value:"edit"},{value:"view"}],onChange:f=>g(f)}),!z&&(0,e.jsx)(n.Button,{variant:"primary",size:"small",value:"Save",onClick:A})]})]}),(0,e.jsx)(n.DashboardContext,{value:T,children:(0,e.jsxs)("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[(0,e.jsx)(me,{mode:x,widgets:b.config.widgets,selectedWidgetId:b.selectedWidgetId,dataSources:a,onSelectWidget:B,onMoveWidget:G,onRemoveWidget:u,onAddWidget:w,onChange:()=>{},getWidgetActions:te}),_&&Object.keys(R).length>0&&(0,e.jsxs)(n.OverlayPanel,{open:_,variant:o,position:o==="dialog"?"center":"right",onClose:()=>E(!1),closeOnEscape:!0,closeOnClickOutside:o==="dialog",width:o==="sidepanel"?360:void 0,maxWidth:o==="dialog"?640:void 0,maxHeight:o==="dialog"?"80vh":void 0,"aria-label":"Dashboard filters",children:[(0,e.jsx)(n.OverlayPanel.Header,{title:"Filters",onClose:()=>E(!1),actions:(0,e.jsx)(n.Button,{variant:"invisible",size:"small",leadingVisual:o==="dialog"?"square-half":"open-center",onClick:()=>S(f=>f==="dialog"?"sidepanel":"dialog"),"aria-label":o==="dialog"?"Switch to side panel":"Switch to dialog"})}),(0,e.jsx)("div",{className:i["rst-dashboard-builder-filter-body"],children:(()=>{const f=Object.keys(R);if(f.length===0)return(0,e.jsx)("div",{style:{padding:"var(--rst-space-default)"},children:"No data sources to filter."});const $=F&&f.includes(F)?F:f[0],ee=C?.[$]??n.emptyFilterGroup();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:i["rst-dashboard-builder-filter-tabs"],children:f.map(X=>(0,e.jsx)(n.Button,{value:X,variant:X===$?"base":"invisible",size:"small",onClick:()=>J(X),children:X},X))}),(0,e.jsx)(n.FilterBuilder,{filters:ee,onChange:X=>M(ve=>({...ve??{},[$]:X.filters.length===0?null:X})),fieldOptions:R[$]})]})})()}),(0,e.jsxs)(n.OverlayPanel.Footer,{children:[(0,e.jsx)(n.Button,{variant:"invisible",size:"small",value:"Clear",onClick:()=>M({})}),(0,e.jsx)(n.Button,{variant:"primary",size:"small",value:"Apply",onClick:re})]})]}),!z&&(0,e.jsx)(pe,{widget:l,dataSources:a,onUpdate:f=>{l&&W(l.id,f)},onRemove:()=>{l&&u(l.id)},onClose:()=>B(null),onAddWidget:f=>{const $=Object.values(a)[0],ee=he(6,3,b.config.widgets);w(f,$?.id??"",ee)},prebuiltSections:t,onAddPrebuiltSection:f=>{I(f)}})]})})]})})};fe.displayName="DashboardBuilder";var le={"rst-border-beam":"_rst-border-beam_4g5sg_1","rst-border-beam-effect":"_rst-border-beam-effect_4g5sg_7","rst-border-beam-ring":"_rst-border-beam-ring_4g5sg_15","rst-border-beam-spin":"_rst-border-beam-spin_4g5sg_27","rst-border-beam-travel":"_rst-border-beam-travel_4g5sg_1"};function We(a){return[...a].filter(r=>r.color).map(r=>({...r,percent:Math.min(100,Math.max(0,r.percent))})).sort((r,d)=>r.percent-d.percent)}function Fe(a,r,d,t){const m=360/Math.max(1,t),p=2*(r+d);return p<=0||a<=0?Math.min(90,m):Math.min(a/p*360,m)}function Oe(a,r){const d=Math.max(0,Math.min(r,360)),t=We(a);return`conic-gradient(from 0deg, ${t.length?t.map(m=>`${m.color} ${m.percent/100*d}deg`).join(", "):"var(--rst-borderColor-focus) 0deg"}, transparent ${d}deg, transparent 360deg)`}var Be=[{color:"transparent",percent:0},{color:"var(--rst-borderColor-primary-default)",percent:70},{color:"var(--rst-borderColor-focus)",percent:100}],ge=({children:a,color:r=Be,count:d=1,duration:t=6,lineWidth:m=1,outset:p=0,inset:v=0,size:j=120,className:k,style:b,...x})=>{const g=(0,s.useRef)(null),[w,I]=(0,s.useState)({radius:"",width:0,height:0});(0,s.useEffect)(()=>{const D=g.current?.firstElementChild;if(!D||typeof ResizeObserver>"u")return;const c=new ResizeObserver(()=>{I({radius:getComputedStyle(D).borderTopLeftRadius,width:D.clientWidth,height:D.clientHeight})});return c.observe(D),()=>c.disconnect()},[]);const u=Math.max(1,Math.floor(d)),W=(0,s.useMemo)(()=>Oe(r,Fe(j,w.width,w.height,u)),[r,j,w.width,w.height,u]),G=360/u,B=Math.hypot(w.width+2*p,w.height+2*p),l=[le["rst-border-beam"],k].filter(Boolean).join(" "),h={"--rst-border-beam-gradient":W,"--rst-border-beam-duration":`${t}s`,"--rst-border-beam-line-width":`${m}px`,"--rst-border-beam-outset":`${p}px`,"--rst-border-beam-inset":`${v}px`,...B>0?{"--rst-border-beam-diagonal":`${B}px`}:{},...w.radius?{"--rst-border-beam-radius":w.radius}:{},...b};return(0,e.jsxs)("div",{ref:g,className:l,style:h,...x,children:[a,(0,e.jsx)("span",{className:le["rst-border-beam-effect"],"aria-hidden":"true",children:(0,e.jsx)("span",{className:le["rst-border-beam-ring"],children:Array.from({length:u},(D,c)=>(0,e.jsx)("span",{className:le["rst-border-beam-spin"],style:{"--rst-border-beam-offset":`${c*G}deg`}},c))})})]})};ge.displayName="BorderBeam";function Te(a){return a.filter(r=>r.type==="text").map(r=>r.text).join(" ").trim()}function Ae(a){return a.data??[]}function _e(a,r){return a.events?.includes(r)??!1}function $e({block:a,onBlockEvent:r}){const d=Ae(a),t=a.props??{};if(a.component==="form")return(0,e.jsx)(Ge,{block:a,onBlockEvent:r});if(a.component==="chart"){const m=t.height??16;return(0,e.jsx)(n.Chart,{data:d,columns:a.columns,type:t.type??"bar",xAxisColumn:t.xAxisColumn,yAxisColumns:t.yAxisColumns,series:t.series,title:t.title,subtitle:t.subtitle,showLegend:t.showLegend,showGrid:t.showGrid,height:m})}return a.component==="kpi"?(0,e.jsx)(n.KPI,{data:d[0]??{},columns:a.columns,layout:n.resolveKpiLayoutPreset(t.layout)}):a.component==="card-list"?(0,e.jsx)(n.CardList,{data:d,columns:a.columns,layout:n.resolveCardLayoutPreset(t.layout),onCardClick:_e(a,"action")?m=>r?.({blockId:a.id,component:"card-list",event:"action",handler:a.handler,values:m}):void 0}):(0,e.jsx)(n.TableGrid,{data:d,columns:a.columns,enableSorting:t.enableSorting!==!1,enableSelection:t.enableSelection===!0,showGrid:t.showGrid??"horizontal",columnSizing:"fixed",enableVirtualization:t.enableVirtualization!==!1})}function Ge({block:a,onBlockEvent:r}){const[d,t]=(0,s.useState)(!1);return _e(a,"submit")?(0,e.jsx)(n.Form,{data:a.data??[{}],columns:a.columns,labelAlign:"top",onSubmit:async m=>{t(!0);try{await r?.({blockId:a.id,component:"form",event:"submit",handler:a.handler,values:m})}finally{t(!1)}},actions:[{type:"submit",variant:"primary",value:"Submit",loading:d,disabled:d},{type:"reset",variant:"invisible",value:"Reset",disabled:d}]}):(0,e.jsx)(n.Form,{data:a.data??[{}],columns:a.columns})}var V={"rst-chat":"_rst-chat_12syz_1","rst-chat-empty":"_rst-chat-empty_12syz_9","rst-chat-messages":"_rst-chat-messages_12syz_19","rst-chat-message":"_rst-chat-message_12syz_19","rst-chat-message-user":"_rst-chat-message-user_12syz_33","rst-chat-message-assistant":"_rst-chat-message-assistant_12syz_37","rst-chat-bubble":"_rst-chat-bubble_12syz_41","rst-chat-bubble-user":"_rst-chat-bubble-user_12syz_51","rst-chat-bubble-assistant":"_rst-chat-bubble-assistant_12syz_56","rst-chat-text":"_rst-chat-text_12syz_63","rst-chat-block":"_rst-chat-block_12syz_68","rst-chat-block-title":"_rst-chat-block-title_12syz_76","rst-chat-processing":"_rst-chat-processing_12syz_80","rst-chat-composer":"_rst-chat-composer_12syz_84"};function Le({messages:a,isProcessing:r=!1,inputValue:d,onInputChange:t,onSubmit:m,onKeyDown:p,onBlockEvent:v,emptyStateText:j="Ask a question to get started.",inputPlaceholder:k="Ask something...",className:b,renderBlock:x}){const g=(0,s.useRef)(null);(0,s.useEffect)(()=>{const u=g.current;u&&(u.scrollTop=u.scrollHeight)},[a,r]);const w=r||d.trim().length===0,I=(u,W)=>u.type==="text"?(0,e.jsx)(n.Typography,{variant:"body",className:V["rst-chat-text"],children:u.text},W):(0,e.jsxs)("div",{className:V["rst-chat-block"],children:[u.block.meta?.title&&(0,e.jsx)(n.Typography,{variant:"label",className:V["rst-chat-block-title"],children:u.block.meta.title}),x?x(u.block):(0,e.jsx)($e,{block:u.block,onBlockEvent:v})]},u.block.id);return(0,e.jsxs)("div",{className:[V["rst-chat"],b].filter(Boolean).join(" "),children:[a.length===0?(0,e.jsx)("div",{className:V["rst-chat-empty"],children:(0,e.jsx)(n.Typography,{variant:"body",children:j})}):(0,e.jsxs)("div",{ref:g,className:V["rst-chat-messages"],role:"log","aria-live":"polite",children:[a.map(u=>(0,e.jsx)("article",{className:[V["rst-chat-message"],V[`rst-chat-message-${u.role}`]].join(" "),"aria-label":`${u.role==="user"?"You":"Assistant"}: ${Te(u.parts)}`,children:(0,e.jsx)("div",{className:[V["rst-chat-bubble"],V[`rst-chat-bubble-${u.role}`]].join(" "),children:u.parts.map(I)})},u.id)),r&&(0,e.jsx)("div",{className:V["rst-chat-processing"],children:(0,e.jsx)(n.Typography,{variant:"caption",children:"Working..."})})]}),(0,e.jsxs)("form",{className:V["rst-chat-composer"],onSubmit:u=>{u.preventDefault(),w||m()},children:[(0,e.jsx)(n.Textarea,{value:d,onChange:t,onKeyDown:p,placeholder:k,ariaLabel:"Message",rows:1,disabled:r}),(0,e.jsx)(n.Button,{type:"submit",variant:"primary",value:"Send",leadingVisual:"send",disabled:w})]})]})}exports.BorderBeam=ge;exports.ChatSurface=Le;exports.DASHBOARD_CONFIG_VERSION=Me;exports.DashboardBuilder=fe;exports.PipContainer=ye;exports.usePip=ke;
|
package/dist/experimental.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ declare const CellType: {
|
|
|
99
99
|
readonly BUTTON_GROUP: "BUTTON_GROUP";
|
|
100
100
|
readonly TEXT: "TEXT";
|
|
101
101
|
readonly TEXTAREA: "TEXTAREA";
|
|
102
|
+
readonly PASSWORD: "PASSWORD";
|
|
102
103
|
readonly NUMBER: "NUMBER";
|
|
103
104
|
readonly DATE: "DATE";
|
|
104
105
|
readonly DATE_RANGE: "DATE_RANGE";
|