@sito/ui 0.3.2 → 0.3.3
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/components/Dialog/types.d.ts +3 -0
- package/dist/components/Dialog/utils.d.ts +16 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +86 -76
- package/package.json +1 -1
|
@@ -28,6 +28,9 @@ type DialogBaseProps = {
|
|
|
28
28
|
mobileFullScreen?: boolean;
|
|
29
29
|
containerClassName?: string;
|
|
30
30
|
className?: string;
|
|
31
|
+
headerClassName?: string;
|
|
32
|
+
titleClassName?: string;
|
|
33
|
+
closeButtonClassName?: string;
|
|
31
34
|
closeLabel?: string;
|
|
32
35
|
closeIcon?: ReactNode;
|
|
33
36
|
showCloseButton?: boolean;
|
|
@@ -17,3 +17,19 @@ export declare const getFocusableElements: (element: HTMLElement) => HTMLElement
|
|
|
17
17
|
* @returns Active HTMLElement, or null when unavailable.
|
|
18
18
|
*/
|
|
19
19
|
export declare const getActiveElement: () => HTMLElement | null;
|
|
20
|
+
/**
|
|
21
|
+
* Registers an interactive dialog as the topmost dialog.
|
|
22
|
+
* @param dialogStackId Stable internal identifier for the dialog instance.
|
|
23
|
+
*/
|
|
24
|
+
export declare const registerDialog: (dialogStackId: symbol) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Removes a dialog from the interactive dialog stack.
|
|
27
|
+
* @param dialogStackId Stable internal identifier for the dialog instance.
|
|
28
|
+
*/
|
|
29
|
+
export declare const unregisterDialog: (dialogStackId: symbol) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Checks whether a dialog is currently the topmost interactive dialog.
|
|
32
|
+
* @param dialogStackId Stable internal identifier for the dialog instance.
|
|
33
|
+
* @returns Whether the dialog is at the top of the stack.
|
|
34
|
+
*/
|
|
35
|
+
export declare const isTopmostDialog: (dialogStackId: symbol) => boolean;
|
package/dist/ui.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react/jsx-runtime"),n=require("react-dom");var r=(...e)=>e.filter(Boolean).join(` `),i={DEFAULT:`default`,PRIMARY:`primary`,SECONDARY:`secondary`,ERROR:`error`,WARNING:`warning`,SUCCESS:`success`,INFO:`info`},a={TEXT:`text`,SUBMIT:`submit`,OUTLINED:`outlined`},o={SM:`sm`,MD:`md`,LG:`lg`},s=(0,e.forwardRef)(function(e,n){let{color:s=i.DEFAULT,size:c=o.MD,type:l=`button`,variant:u=a.TEXT,loading:d=!1,loadingIndicator:f,loadingLabel:p=`Loading`,disabled:m,className:h,children:g,..._}=e,v=r(`sito-ui-button`,`sito-ui-button--${u}`,`sito-ui-button--${s}`,`sito-ui-button--${c}`,d&&`sito-ui-button--loading`,h),y=f===void 0?(0,t.jsx)(`span`,{className:`sito-ui-button__spinner`,"aria-hidden":`true`,"data-sito-ui":`button-spinner`}):f;return(0,t.jsxs)(`button`,{"data-sito-ui":`button`,..._,type:l,ref:n,disabled:m||d,"aria-busy":d||_[`aria-busy`],className:v,children:[d?(0,t.jsxs)(t.Fragment,{children:[y,(0,t.jsx)(`span`,{className:`sito-ui-button__loading-label`,children:p})]}):null,g]})}),c={SM:`sm`,MD:`md`,LG:`lg`},l=e=>{if(e!==void 0)return typeof e==`number`?`${e}px`:e},u=(0,e.forwardRef)(function(e,n){let{children:i,icon:a,iconClassName:o,type:u=`button`,variant:d=`text`,color:f=`default`,loading:p=!1,size:m=c.MD,iconSize:h,className:g,style:_,...v}=e,y=i!=null&&typeof i!=`boolean`,b=l(h),x=b===void 0?_:{..._,"--sito-ui-icon-button-icon-size":b},S=r(`sito-ui-icon-button`,`sito-ui-icon-button--${m}`,y&&`sito-ui-icon-button--with-content`,g);return(0,t.jsxs)(s,{...v,ref:n,type:u,variant:d,color:f,size:m,loading:p,"data-sito-ui":`icon-button`,className:S,style:x,children:[p?null:(0,t.jsx)(`span`,{className:r(`sito-ui-icon-button__icon`,o),"aria-hidden":`true`,children:a}),i]})}),d=`input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled])`,f=`button[type="submit"]:not([disabled]), input[type="submit"]:not([disabled])`,p=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`),m=0,h=null,g=()=>typeof document<`u`&&!!document.body,
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react/jsx-runtime"),n=require("react-dom");var r=(...e)=>e.filter(Boolean).join(` `),i={DEFAULT:`default`,PRIMARY:`primary`,SECONDARY:`secondary`,ERROR:`error`,WARNING:`warning`,SUCCESS:`success`,INFO:`info`},a={TEXT:`text`,SUBMIT:`submit`,OUTLINED:`outlined`},o={SM:`sm`,MD:`md`,LG:`lg`},s=(0,e.forwardRef)(function(e,n){let{color:s=i.DEFAULT,size:c=o.MD,type:l=`button`,variant:u=a.TEXT,loading:d=!1,loadingIndicator:f,loadingLabel:p=`Loading`,disabled:m,className:h,children:g,..._}=e,v=r(`sito-ui-button`,`sito-ui-button--${u}`,`sito-ui-button--${s}`,`sito-ui-button--${c}`,d&&`sito-ui-button--loading`,h),y=f===void 0?(0,t.jsx)(`span`,{className:`sito-ui-button__spinner`,"aria-hidden":`true`,"data-sito-ui":`button-spinner`}):f;return(0,t.jsxs)(`button`,{"data-sito-ui":`button`,..._,type:l,ref:n,disabled:m||d,"aria-busy":d||_[`aria-busy`],className:v,children:[d?(0,t.jsxs)(t.Fragment,{children:[y,(0,t.jsx)(`span`,{className:`sito-ui-button__loading-label`,children:p})]}):null,g]})}),c={SM:`sm`,MD:`md`,LG:`lg`},l=e=>{if(e!==void 0)return typeof e==`number`?`${e}px`:e},u=(0,e.forwardRef)(function(e,n){let{children:i,icon:a,iconClassName:o,type:u=`button`,variant:d=`text`,color:f=`default`,loading:p=!1,size:m=c.MD,iconSize:h,className:g,style:_,...v}=e,y=i!=null&&typeof i!=`boolean`,b=l(h),x=b===void 0?_:{..._,"--sito-ui-icon-button-icon-size":b},S=r(`sito-ui-icon-button`,`sito-ui-icon-button--${m}`,y&&`sito-ui-icon-button--with-content`,g);return(0,t.jsxs)(s,{...v,ref:n,type:u,variant:d,color:f,size:m,loading:p,"data-sito-ui":`icon-button`,className:S,style:x,children:[p?null:(0,t.jsx)(`span`,{className:r(`sito-ui-icon-button__icon`,o),"aria-hidden":`true`,children:a}),i]})}),d=`input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled])`,f=`button[type="submit"]:not([disabled]), input[type="submit"]:not([disabled])`,p=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`),m=0,h=null,g=[],_=()=>typeof document<`u`&&!!document.body,v=()=>{_()&&(m===0&&(h=document.body.style.overflow,document.body.style.overflow=`hidden`),m+=1)},y=()=>{!_()||m===0||(--m,m===0&&(document.body.style.overflow=h??``,h=null))},b=e=>Array.from(e.querySelectorAll(p)).filter(e=>e.getAttribute(`aria-disabled`)!==`true`),x=()=>typeof document>`u`?null:document.activeElement instanceof HTMLElement?document.activeElement:null,S=e=>{let t=g.indexOf(e);t>=0&&g.splice(t,1),g.push(e)},ee=e=>{let t=g.indexOf(e);t>=0&&g.splice(t,1)},C=e=>g[g.length-1]===e,w=typeof window>`u`?e.useEffect:e.useLayoutEffect,T=i=>{let a=(0,e.useId)(),o=(0,e.useRef)(Symbol(`sito-ui-dialog`)),s=(0,e.useRef)(null),c=(0,e.useRef)(null),l=(0,e.useRef)(null),p=(0,e.useRef)(void 0),{dialogId:m,title:h,ariaLabel:g,children:_,onClose:T,initialFocus:E=`none`,closeOnBackdropClick:D=!1,closeOnEscape:O=!0,lockBodyScroll:k=!0,onSubmit:A,open:j=!1,mobileFullScreen:M=!1,containerClassName:N,className:P,headerClassName:F,titleClassName:I,closeButtonClassName:L,closeLabel:R=`Close dialog`,closeIcon:z=`x`,showCloseButton:B=!0,portalContainer:te,exitDurationMs:V=0,onExitComplete:H}=i,[U,W]=(0,e.useState)(j),[G,K]=(0,e.useState)(!1),q=h?`${m??a}-title`:void 0,J=G?`closing`:`open`,Y=j&&!G,X=o.current;(0,e.useEffect)(()=>{p.current=H},[H]);let Z=(0,e.useCallback)(()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),Q=(0,e.useCallback)(()=>{W(!1),K(!1),p.current?.(),l.current=null},[]);w(()=>{if(j){Z(),W(!0),K(!1);return}if(!U)return;let e=Math.max(0,V);if(e===0){Z(),Q();return}K(!0),Z(),l.current=window.setTimeout(Q,e)},[Z,V,Q,j,U]),(0,e.useEffect)(()=>()=>{Z()},[Z]);let $=(0,e.useCallback)(e=>{if(!C(X))return;if(e.key===`Escape`&&Y&&O){T();return}if(e.key!==`Tab`||!Y)return;let t=s.current;if(!t)return;let n=b(t);if(n.length===0){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=x(),o=!a||!t.contains(a);if(e.shiftKey&&(o||a===r)){e.preventDefault(),i.focus();return}!e.shiftKey&&(o||a===i)&&(e.preventDefault(),r.focus())},[O,X,Y,T]);(0,e.useEffect)(()=>{if(!(!Y||typeof window>`u`))return window.addEventListener(`keydown`,$),()=>{window.removeEventListener(`keydown`,$)}},[$,Y]),w(()=>{if(j)return c.current=x(),S(X),()=>{let e=C(X);ee(X),e&&c.current?.isConnected&&c.current.focus(),c.current=null}},[X,j]),w(()=>{if(!j)return;let e=s.current;if(e){if(E===`first-input`){let t=e.querySelector(d);if(t){t.focus();return}}if(E===`submit`){let t=e.querySelector(f);if(t){t.focus();return}}e.focus()}},[E,j]),(0,e.useEffect)(()=>{if(!(!U||!k))return v(),()=>{y()}},[k,U]);let ne=(0,e.useCallback)(e=>{C(X)&&Y&&D&&e.target===e.currentTarget&&T()},[D,X,Y,T]),re=(0,e.useCallback)(e=>{e.preventDefault(),A?.(e)},[A]);if(!U||typeof document>`u`)return null;let ie=A?(0,t.jsx)(`form`,{onSubmit:re,children:_}):_,ae=typeof z==`string`?(0,t.jsx)(`span`,{"aria-hidden":`true`,children:z}):z;return(0,n.createPortal)((0,t.jsx)(`div`,{id:m?`backdrop-${m}`:void 0,"data-sito-ui":`dialog-backdrop`,"data-state":J,onClick:ne,className:r(`sito-ui-dialog-backdrop`,`sito-ui-dialog-backdrop--${J}`,N),children:(0,t.jsxs)(`div`,{id:m,ref:s,role:`dialog`,"aria-modal":`true`,"aria-label":h?void 0:g,"aria-labelledby":q,tabIndex:-1,"data-sito-ui":`dialog`,"data-state":J,className:r(`sito-ui-dialog`,`sito-ui-dialog--${J}`,M&&`sito-ui-dialog--mobile-full-screen`,P),children:[(0,t.jsxs)(`div`,{className:r(`sito-ui-dialog__header`,F),children:[h?(0,t.jsx)(`h3`,{id:q,className:r(`sito-ui-dialog__title`,I),children:h}):null,B?(0,t.jsx)(u,{icon:ae,disabled:!Y,"aria-disabled":!Y,onClick:T,variant:`text`,color:`error`,className:r(`sito-ui-dialog__close`,L),"aria-label":R}):null]}),ie]})}),te??document.body)},E=e=>{let{primaryText:n,cancelText:i,onPrimaryClick:a,onCancel:o,isLoading:c=!1,loadingIndicator:l,disabled:u=!1,primaryType:d=`submit`,containerClassName:f,primaryClassName:p,cancelClassName:m,alignEnd:h=!1,primaryName:g,primaryAriaLabel:_,cancelName:v,cancelAriaLabel:y,extraActions:b=[]}=e;return(0,t.jsxs)(`div`,{"data-sito-ui":`dialog-actions`,className:r(`sito-ui-dialog-actions`,h&&`sito-ui-dialog-actions--end`,f),children:[(0,t.jsx)(s,{type:d,color:`primary`,variant:`submit`,className:p,disabled:u,loading:c,loadingIndicator:l,onClick:a,name:g,"aria-label":_,children:n}),b.map(({id:e,...n})=>(0,t.jsx)(s,{...n},e)),(0,t.jsx)(s,{type:`button`,variant:`outlined`,className:m,disabled:u||c,onClick:o,name:v,"aria-label":y,children:i})]})},D=(t=!1)=>{let[n,r]=(0,e.useState)(t);return{open:n,setOpen:r,handleClose:()=>r(!1),handleOpen:()=>r(!0)}};exports.Button=s,exports.Dialog=T,exports.DialogActions=E,exports.IconButton=u,exports.useDialog=D;
|
package/dist/ui.js
CHANGED
|
@@ -72,50 +72,57 @@ var d = (...e) => e.filter(Boolean).join(" "), f = {
|
|
|
72
72
|
"input:not([disabled])",
|
|
73
73
|
"select:not([disabled])",
|
|
74
74
|
"[tabindex]:not([tabindex=\"-1\"])"
|
|
75
|
-
].join(","), S = 0, C = null, w = () => typeof document < "u" && !!document.body,
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
!
|
|
79
|
-
},
|
|
80
|
-
let
|
|
75
|
+
].join(","), S = 0, C = null, w = [], T = () => typeof document < "u" && !!document.body, E = () => {
|
|
76
|
+
T() && (S === 0 && (C = document.body.style.overflow, document.body.style.overflow = "hidden"), S += 1);
|
|
77
|
+
}, D = () => {
|
|
78
|
+
!T() || S === 0 || (--S, S === 0 && (document.body.style.overflow = C ?? "", C = null));
|
|
79
|
+
}, ee = (e) => Array.from(e.querySelectorAll(x)).filter((e) => e.getAttribute("aria-disabled") !== "true"), O = () => typeof document > "u" ? null : document.activeElement instanceof HTMLElement ? document.activeElement : null, te = (e) => {
|
|
80
|
+
let t = w.indexOf(e);
|
|
81
|
+
t >= 0 && w.splice(t, 1), w.push(e);
|
|
82
|
+
}, ne = (e) => {
|
|
83
|
+
let t = w.indexOf(e);
|
|
84
|
+
t >= 0 && w.splice(t, 1);
|
|
85
|
+
}, k = (e) => w[w.length - 1] === e, A = typeof window > "u" ? n : i, j = (e) => {
|
|
86
|
+
let i = r(), s = a(Symbol("sito-ui-dialog")), f = a(null), p = a(null), m = a(null), h = a(void 0), { dialogId: g, title: _, ariaLabel: x, children: S, onClose: C, initialFocus: w = "none", closeOnBackdropClick: T = !1, closeOnEscape: j = !0, lockBodyScroll: M = !0, onSubmit: N, open: P = !1, mobileFullScreen: F = !1, containerClassName: I, className: L, headerClassName: R, titleClassName: z, closeButtonClassName: re, closeLabel: ie = "Close dialog", closeIcon: B = "x", showCloseButton: ae = !0, portalContainer: oe, exitDurationMs: V = 0, onExitComplete: H } = e, [U, W] = o(P), [G, K] = o(!1), q = _ ? `${g ?? i}-title` : void 0, J = G ? "closing" : "open", Y = P && !G, X = s.current;
|
|
81
87
|
n(() => {
|
|
82
|
-
|
|
88
|
+
h.current = H;
|
|
83
89
|
}, [H]);
|
|
84
|
-
let
|
|
85
|
-
|
|
86
|
-
}, []),
|
|
87
|
-
W(!1), K(!1),
|
|
90
|
+
let Z = t(() => {
|
|
91
|
+
m.current !== null && (window.clearTimeout(m.current), m.current = null);
|
|
92
|
+
}, []), Q = t(() => {
|
|
93
|
+
W(!1), K(!1), h.current?.(), m.current = null;
|
|
88
94
|
}, []);
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
95
|
+
A(() => {
|
|
96
|
+
if (P) {
|
|
97
|
+
Z(), W(!0), K(!1);
|
|
92
98
|
return;
|
|
93
99
|
}
|
|
94
100
|
if (!U) return;
|
|
95
101
|
let e = Math.max(0, V);
|
|
96
102
|
if (e === 0) {
|
|
97
|
-
|
|
103
|
+
Z(), Q();
|
|
98
104
|
return;
|
|
99
105
|
}
|
|
100
|
-
K(!0),
|
|
106
|
+
K(!0), Z(), m.current = window.setTimeout(Q, e);
|
|
101
107
|
}, [
|
|
102
|
-
X,
|
|
103
|
-
V,
|
|
104
108
|
Z,
|
|
105
|
-
|
|
109
|
+
V,
|
|
110
|
+
Q,
|
|
111
|
+
P,
|
|
106
112
|
U
|
|
107
113
|
]), n(() => () => {
|
|
108
|
-
|
|
109
|
-
}, [
|
|
110
|
-
let
|
|
111
|
-
if (
|
|
112
|
-
|
|
114
|
+
Z();
|
|
115
|
+
}, [Z]);
|
|
116
|
+
let $ = t((e) => {
|
|
117
|
+
if (!k(X)) return;
|
|
118
|
+
if (e.key === "Escape" && Y && j) {
|
|
119
|
+
C();
|
|
113
120
|
return;
|
|
114
121
|
}
|
|
115
122
|
if (e.key !== "Tab" || !Y) return;
|
|
116
|
-
let t =
|
|
123
|
+
let t = f.current;
|
|
117
124
|
if (!t) return;
|
|
118
|
-
let n =
|
|
125
|
+
let n = ee(t);
|
|
119
126
|
if (n.length === 0) {
|
|
120
127
|
e.preventDefault(), t.focus();
|
|
121
128
|
return;
|
|
@@ -127,30 +134,32 @@ var d = (...e) => e.filter(Boolean).join(" "), f = {
|
|
|
127
134
|
}
|
|
128
135
|
!e.shiftKey && (o || a === i) && (e.preventDefault(), r.focus());
|
|
129
136
|
}, [
|
|
130
|
-
|
|
137
|
+
j,
|
|
138
|
+
X,
|
|
131
139
|
Y,
|
|
132
|
-
|
|
140
|
+
C
|
|
133
141
|
]);
|
|
134
142
|
n(() => {
|
|
135
|
-
if (!(!Y || typeof window > "u")) return window.addEventListener("keydown",
|
|
136
|
-
window.removeEventListener("keydown",
|
|
143
|
+
if (!(!Y || typeof window > "u")) return window.addEventListener("keydown", $), () => {
|
|
144
|
+
window.removeEventListener("keydown", $);
|
|
137
145
|
};
|
|
138
|
-
}, [
|
|
139
|
-
if (
|
|
140
|
-
|
|
146
|
+
}, [$, Y]), A(() => {
|
|
147
|
+
if (P) return p.current = O(), te(X), () => {
|
|
148
|
+
let e = k(X);
|
|
149
|
+
ne(X), e && p.current?.isConnected && p.current.focus(), p.current = null;
|
|
141
150
|
};
|
|
142
|
-
}, [
|
|
143
|
-
if (!
|
|
144
|
-
let e =
|
|
151
|
+
}, [X, P]), A(() => {
|
|
152
|
+
if (!P) return;
|
|
153
|
+
let e = f.current;
|
|
145
154
|
if (e) {
|
|
146
|
-
if (
|
|
155
|
+
if (w === "first-input") {
|
|
147
156
|
let t = e.querySelector(y);
|
|
148
157
|
if (t) {
|
|
149
158
|
t.focus();
|
|
150
159
|
return;
|
|
151
160
|
}
|
|
152
161
|
}
|
|
153
|
-
if (
|
|
162
|
+
if (w === "submit") {
|
|
154
163
|
let t = e.querySelector(b);
|
|
155
164
|
if (t) {
|
|
156
165
|
t.focus();
|
|
@@ -159,65 +168,66 @@ var d = (...e) => e.filter(Boolean).join(" "), f = {
|
|
|
159
168
|
}
|
|
160
169
|
e.focus();
|
|
161
170
|
}
|
|
162
|
-
}, [
|
|
163
|
-
if (!(!U || !
|
|
164
|
-
|
|
171
|
+
}, [w, P]), n(() => {
|
|
172
|
+
if (!(!U || !M)) return E(), () => {
|
|
173
|
+
D();
|
|
165
174
|
};
|
|
166
|
-
}, [
|
|
167
|
-
let
|
|
168
|
-
Y &&
|
|
175
|
+
}, [M, U]);
|
|
176
|
+
let se = t((e) => {
|
|
177
|
+
k(X) && Y && T && e.target === e.currentTarget && C();
|
|
169
178
|
}, [
|
|
170
|
-
|
|
179
|
+
T,
|
|
180
|
+
X,
|
|
171
181
|
Y,
|
|
172
|
-
|
|
173
|
-
]),
|
|
174
|
-
e.preventDefault(),
|
|
175
|
-
}, [
|
|
182
|
+
C
|
|
183
|
+
]), ce = t((e) => {
|
|
184
|
+
e.preventDefault(), N?.(e);
|
|
185
|
+
}, [N]);
|
|
176
186
|
if (!U || typeof document > "u") return null;
|
|
177
|
-
let
|
|
178
|
-
onSubmit:
|
|
179
|
-
children:
|
|
180
|
-
}) :
|
|
187
|
+
let le = N ? /* @__PURE__ */ c("form", {
|
|
188
|
+
onSubmit: ce,
|
|
189
|
+
children: S
|
|
190
|
+
}) : S, ue = typeof B == "string" ? /* @__PURE__ */ c("span", {
|
|
181
191
|
"aria-hidden": "true",
|
|
182
|
-
children:
|
|
183
|
-
}) :
|
|
192
|
+
children: B
|
|
193
|
+
}) : B;
|
|
184
194
|
return u(/* @__PURE__ */ c("div", {
|
|
185
|
-
id:
|
|
195
|
+
id: g ? `backdrop-${g}` : void 0,
|
|
186
196
|
"data-sito-ui": "dialog-backdrop",
|
|
187
197
|
"data-state": J,
|
|
188
|
-
onClick:
|
|
189
|
-
className: d("sito-ui-dialog-backdrop", `sito-ui-dialog-backdrop--${J}`,
|
|
198
|
+
onClick: se,
|
|
199
|
+
className: d("sito-ui-dialog-backdrop", `sito-ui-dialog-backdrop--${J}`, I),
|
|
190
200
|
children: /* @__PURE__ */ l("div", {
|
|
191
|
-
id:
|
|
192
|
-
ref:
|
|
201
|
+
id: g,
|
|
202
|
+
ref: f,
|
|
193
203
|
role: "dialog",
|
|
194
204
|
"aria-modal": "true",
|
|
195
|
-
"aria-label":
|
|
205
|
+
"aria-label": _ ? void 0 : x,
|
|
196
206
|
"aria-labelledby": q,
|
|
197
207
|
tabIndex: -1,
|
|
198
208
|
"data-sito-ui": "dialog",
|
|
199
209
|
"data-state": J,
|
|
200
|
-
className: d("sito-ui-dialog", `sito-ui-dialog--${J}`,
|
|
210
|
+
className: d("sito-ui-dialog", `sito-ui-dialog--${J}`, F && "sito-ui-dialog--mobile-full-screen", L),
|
|
201
211
|
children: [/* @__PURE__ */ l("div", {
|
|
202
|
-
className: "sito-ui-dialog__header",
|
|
203
|
-
children: [
|
|
212
|
+
className: d("sito-ui-dialog__header", R),
|
|
213
|
+
children: [_ ? /* @__PURE__ */ c("h3", {
|
|
204
214
|
id: q,
|
|
205
|
-
className: "sito-ui-dialog__title",
|
|
206
|
-
children:
|
|
207
|
-
}) : null,
|
|
208
|
-
icon:
|
|
215
|
+
className: d("sito-ui-dialog__title", z),
|
|
216
|
+
children: _
|
|
217
|
+
}) : null, ae ? /* @__PURE__ */ c(v, {
|
|
218
|
+
icon: ue,
|
|
209
219
|
disabled: !Y,
|
|
210
220
|
"aria-disabled": !Y,
|
|
211
|
-
onClick:
|
|
221
|
+
onClick: C,
|
|
212
222
|
variant: "text",
|
|
213
223
|
color: "error",
|
|
214
|
-
className: "sito-ui-dialog__close",
|
|
215
|
-
"aria-label":
|
|
224
|
+
className: d("sito-ui-dialog__close", re),
|
|
225
|
+
"aria-label": ie
|
|
216
226
|
}) : null]
|
|
217
|
-
}),
|
|
227
|
+
}), le]
|
|
218
228
|
})
|
|
219
|
-
}),
|
|
220
|
-
},
|
|
229
|
+
}), oe ?? document.body);
|
|
230
|
+
}, M = (e) => {
|
|
221
231
|
let { primaryText: t, cancelText: n, onPrimaryClick: r, onCancel: i, isLoading: a = !1, loadingIndicator: o, disabled: s = !1, primaryType: u = "submit", containerClassName: f, primaryClassName: p, cancelClassName: m, alignEnd: g = !1, primaryName: _, primaryAriaLabel: v, cancelName: y, cancelAriaLabel: b, extraActions: x = [] } = e;
|
|
222
232
|
return /* @__PURE__ */ l("div", {
|
|
223
233
|
"data-sito-ui": "dialog-actions",
|
|
@@ -249,7 +259,7 @@ var d = (...e) => e.filter(Boolean).join(" "), f = {
|
|
|
249
259
|
})
|
|
250
260
|
]
|
|
251
261
|
});
|
|
252
|
-
},
|
|
262
|
+
}, N = (e = !1) => {
|
|
253
263
|
let [t, n] = o(e);
|
|
254
264
|
return {
|
|
255
265
|
open: t,
|
|
@@ -259,4 +269,4 @@ var d = (...e) => e.filter(Boolean).join(" "), f = {
|
|
|
259
269
|
};
|
|
260
270
|
};
|
|
261
271
|
//#endregion
|
|
262
|
-
export { h as Button,
|
|
272
|
+
export { h as Button, j as Dialog, M as DialogActions, v as IconButton, N as useDialog };
|