@ufal-lccv/gpsub-ds 0.2.35 → 0.2.37

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.
@@ -0,0 +1 @@
1
+ "use strict";const e=require("./GenericAGGridTable-z2D_k8k2.cjs"),b=require("./index-CPP6SuZS.cjs"),m=require("react");require("sbwb-ds");let u=[];const p=[],F=r=>(p.push(r),()=>{const o=p.indexOf(r);o>=0&&p.splice(o,1)}),R=()=>p.forEach(r=>r()),A=r=>{u=[r,...u],R()},I=r=>{u=u.filter(o=>o.instanceId!==r),R()},y=()=>u,d={subscribe:F,add:A,remove:I,getAlerts:y},w=()=>{const[r,o]=m.useState(d.getAlerts());return m.useEffect(()=>d.subscribe(()=>o([...d.getAlerts()])),[]),e.jsxRuntimeExports.jsx(e.AlertStackContainer,{children:r.map(({instanceId:s,props:t,destroy:n})=>e.jsxRuntimeExports.jsx(e.AlertView,{...t,destroy:n},s))})};let g=!1;const S=({id:r,type:o,title:s,description:t,durationInMilliseconds:n=3e3,dataToCopy:l,offset:a={x:0,y:0}})=>{const c=r+Date.now()+Math.random(),x=()=>d.remove(c);if(d.add({instanceId:c,props:{id:r,type:o,title:s,description:t,durationInMilliseconds:n,dataToCopy:l,offset:a},destroy:x}),!g){g=!0;const j=b.dom.portal.add("alert-stack");e.clientExports.createRoot(j).render(e.jsxRuntimeExports.jsx(w,{}))}},q=({width:r="100%",height:o="fit-content",type:s,variant:t="small",title:n,message:l,margin:a,open:c=!0,onClose:x,canClose:j=!0})=>{var h,E;const[C,k]=m.useState(c),i={info:{backgroundColor:"#D5EBFD",borderColor:e.y.colors.feedbackColors.colorFeedbackInfo,icon:e.jsxRuntimeExports.jsx(e.InfoFill_default,{color:e.y.colors.feedbackColors.colorFeedbackInfo,height:"24px",width:"24px"})},success:{backgroundColor:"#DAF9DB",borderColor:e.y.colors.feedbackColors.colorFeedbackSuccess,icon:e.jsxRuntimeExports.jsx(e.CheckCircleFill_default,{color:e.y.colors.feedbackColors.colorFeedbackSuccess,height:"24px",width:"24px"})},warning:{backgroundColor:"#FEEECF",borderColor:e.y.colors.feedbackColors.colorFeedbackWarning},error:{backgroundColor:"#FFE1E1",borderColor:e.y.colors.feedbackColors.colorFeedbackError,icon:e.jsxRuntimeExports.jsx(e.ErrorFill_default,{color:e.y.colors.feedbackColors.colorFeedbackError,height:"24px",width:"24px"})}};function f(){k(!1),x==null||x()}return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:C?e.jsxRuntimeExports.jsxs(e.Container,{width:r,height:o,direction:"horizontal",verticalAlign:n?"top":"center",gap:e.y.spacings.spacingInline.spacingInlineAnt,padding:t=="small"?`${e.y.spacings.spacingStack.spacingStackXs} ${e.y.spacings.spacingInline.spacingInlineAnt}`:e.y.spacings.spacingInline.spacingInlineSm,backgroundColor:(h=i==null?void 0:i[s])==null?void 0:h.backgroundColor,customStyles:{border:`1px solid ${(E=i==null?void 0:i[s])==null?void 0:E.borderColor}`,borderRadius:e.y.borders.borderRadius.borderRadiusSm,margin:a,position:"relative"},children:[s==="warning"?e.jsxRuntimeExports.jsx(e.ContainerWarning,{children:e.jsxRuntimeExports.jsx(e.WarningFill_default,{width:"24px",height:"24px"})}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:i==null?void 0:i[s].icon}),e.jsxRuntimeExports.jsxs(e.Container,{width:"100%",flex:"1",height:"100%",verticalAlign:"center",children:[b.valuable(n)&&e.jsxRuntimeExports.jsx(e.Title$1,{children:n}),b.valuable(l)&&e.jsxRuntimeExports.jsx(e.Message,{children:l})]}),j&&e.jsxRuntimeExports.jsx(e.Container,{children:e.jsxRuntimeExports.jsx(e.Close_default,{color:e.y.colors.neutralColors.colorNeutralCloudy,cursor:"pointer",onClick:f,height:"20px",width:"20px"})})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})})},v=({label:r,labelRender:o,infoProps:s={},withInfo:t=!0,flex:n,width:l="100%",isRequired:a=!1})=>{const c={tooltipProps:{position:"top",...s==null?void 0:s.tooltipProps,size:"Small"}};return e.jsxRuntimeExports.jsxs(e.Container,{width:l,direction:"horizontal",gap:"4px",flex:n,children:[o??e.jsxRuntimeExports.jsxs(e.Label$1,{children:[r," ",a?e.jsxRuntimeExports.jsx(e.Required,{}):null]}),t&&e.jsxRuntimeExports.jsx(e.Info,{...c})]})},$=({width:r="100%",flex:o,label:s="Obrigatório",margin:t="0 0 16px 0"})=>e.jsxRuntimeExports.jsx(e.Container,{width:r,flex:o,customStyles:{margin:t},children:e.jsxRuntimeExports.jsx(e.Label$2,{children:`* ${s}`})});exports.AlertInline=q;exports.LabelField=v;exports.RequiredLabelView=$;exports.showAlert=S;
@@ -1,53 +1,53 @@
1
- import { a1 as e, ae as E, af as S, ag as w, ah as R, $ as a, ai as $, a8 as D, c as u, aj as L, ak as O, al as _, am as v, a6 as y, an as z, e as W, I as q, ao as B } from "./GenericAGGridTable-D37ouiXm.js";
2
- import { d as M } from "./index-YF_5f0O1.js";
3
- import { useState as j, useEffect as V } from "react";
1
+ import { a1 as e, ae as S, af as w, ag as R, ah as v, $ as a, ai as $, a8 as D, c as u, aj as L, ak as O, al as _, am as y, a6 as z, an as W, e as q, I as B, ao as M } from "./GenericAGGridTable-_FOU2vUj.js";
2
+ import { d as V, v as j } from "./index-YF_5f0O1.js";
3
+ import { useState as C, useEffect as N } from "react";
4
4
  import "sbwb-ds";
5
- let h = [];
6
- const b = [], N = (r) => (b.push(r), () => {
7
- const o = b.indexOf(r);
8
- o >= 0 && b.splice(o, 1);
9
- }), C = () => b.forEach((r) => r()), T = (r) => {
10
- h = [r, ...h], C();
11
- }, X = (r) => {
12
- h = h.filter((o) => o.instanceId !== r), C();
13
- }, G = () => h, x = { subscribe: N, add: T, remove: X, getAlerts: G }, H = () => {
14
- const [r, o] = j(x.getAlerts());
15
- return V(() => x.subscribe(() => o([...x.getAlerts()])), []), /* @__PURE__ */ e.jsx(E, { children: r.map(({ instanceId: s, props: t, destroy: n }) => /* @__PURE__ */ e.jsx(S, { ...t, destroy: n }, s)) });
5
+ let b = [];
6
+ const h = [], T = (r) => (h.push(r), () => {
7
+ const o = h.indexOf(r);
8
+ o >= 0 && h.splice(o, 1);
9
+ }), F = () => h.forEach((r) => r()), X = (r) => {
10
+ b = [r, ...b], F();
11
+ }, G = (r) => {
12
+ b = b.filter((o) => o.instanceId !== r), F();
13
+ }, H = () => b, x = { subscribe: T, add: X, remove: G, getAlerts: H }, J = () => {
14
+ const [r, o] = C(x.getAlerts());
15
+ return N(() => x.subscribe(() => o([...x.getAlerts()])), []), /* @__PURE__ */ e.jsx(S, { children: r.map(({ instanceId: s, props: t, destroy: l }) => /* @__PURE__ */ e.jsx(w, { ...t, destroy: l }, s)) });
16
16
  };
17
17
  let m = !1;
18
- const Y = ({
18
+ const Z = ({
19
19
  id: r,
20
20
  type: o,
21
21
  title: s,
22
22
  description: t,
23
- durationInMilliseconds: n = 3e3,
24
- dataToCopy: i,
23
+ durationInMilliseconds: l = 3e3,
24
+ dataToCopy: c,
25
25
  offset: d = { x: 0, y: 0 }
26
26
  }) => {
27
- const c = r + Date.now() + Math.random(), p = () => x.remove(c);
27
+ const i = r + Date.now() + Math.random(), p = () => x.remove(i);
28
28
  if (x.add({
29
- instanceId: c,
30
- props: { id: r, type: o, title: s, description: t, durationInMilliseconds: n, dataToCopy: i, offset: d },
29
+ instanceId: i,
30
+ props: { id: r, type: o, title: s, description: t, durationInMilliseconds: l, dataToCopy: c, offset: d },
31
31
  destroy: p
32
32
  }), !m) {
33
33
  m = !0;
34
- const g = M.portal.add("alert-stack");
35
- w.createRoot(g).render(/* @__PURE__ */ e.jsx(H, {}));
34
+ const g = V.portal.add("alert-stack");
35
+ R.createRoot(g).render(/* @__PURE__ */ e.jsx(J, {}));
36
36
  }
37
- }, Z = ({
37
+ }, P = ({
38
38
  width: r = "100%",
39
39
  height: o = "fit-content",
40
40
  type: s,
41
41
  variant: t = "small",
42
- title: n,
43
- message: i,
42
+ title: l,
43
+ message: c,
44
44
  margin: d,
45
- open: c = !0,
45
+ open: i = !0,
46
46
  onClose: p,
47
47
  canClose: g = !0
48
48
  }) => {
49
49
  var k, f;
50
- const [F, I] = j(c), l = {
50
+ const [I, A] = C(i), n = {
51
51
  info: {
52
52
  backgroundColor: "#D5EBFD",
53
53
  borderColor: a.colors.feedbackColors.colorFeedbackInfo,
@@ -80,7 +80,7 @@ const Y = ({
80
80
  backgroundColor: "#FFE1E1",
81
81
  borderColor: a.colors.feedbackColors.colorFeedbackError,
82
82
  icon: /* @__PURE__ */ e.jsx(
83
- R,
83
+ v,
84
84
  {
85
85
  color: a.colors.feedbackColors.colorFeedbackError,
86
86
  height: "24px",
@@ -89,37 +89,37 @@ const Y = ({
89
89
  )
90
90
  }
91
91
  };
92
- function A() {
93
- I(!1), p == null || p();
92
+ function E() {
93
+ A(!1), p == null || p();
94
94
  }
95
- return /* @__PURE__ */ e.jsx(e.Fragment, { children: F ? /* @__PURE__ */ e.jsxs(
95
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: I ? /* @__PURE__ */ e.jsxs(
96
96
  u,
97
97
  {
98
98
  width: r,
99
99
  height: o,
100
100
  direction: "horizontal",
101
- verticalAlign: n ? "top" : "center",
101
+ verticalAlign: l ? "top" : "center",
102
102
  gap: a.spacings.spacingInline.spacingInlineAnt,
103
103
  padding: t == "small" ? `${a.spacings.spacingStack.spacingStackXs} ${a.spacings.spacingInline.spacingInlineAnt}` : a.spacings.spacingInline.spacingInlineSm,
104
- backgroundColor: (k = l == null ? void 0 : l[s]) == null ? void 0 : k.backgroundColor,
104
+ backgroundColor: (k = n == null ? void 0 : n[s]) == null ? void 0 : k.backgroundColor,
105
105
  customStyles: {
106
- border: `1px solid ${(f = l == null ? void 0 : l[s]) == null ? void 0 : f.borderColor}`,
106
+ border: `1px solid ${(f = n == null ? void 0 : n[s]) == null ? void 0 : f.borderColor}`,
107
107
  borderRadius: a.borders.borderRadius.borderRadiusSm,
108
108
  margin: d,
109
109
  position: "relative"
110
110
  },
111
111
  children: [
112
- s === "warning" ? /* @__PURE__ */ e.jsx(L, { children: /* @__PURE__ */ e.jsx(O, { width: "24px", height: "24px" }) }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: l == null ? void 0 : l[s].icon }),
113
- /* @__PURE__ */ e.jsxs(u, { width: "100%", flex: "1", height: "100%", children: [
114
- /* @__PURE__ */ e.jsx(_, { children: n }),
115
- /* @__PURE__ */ e.jsx(v, { children: i })
112
+ s === "warning" ? /* @__PURE__ */ e.jsx(L, { children: /* @__PURE__ */ e.jsx(O, { width: "24px", height: "24px" }) }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: n == null ? void 0 : n[s].icon }),
113
+ /* @__PURE__ */ e.jsxs(u, { width: "100%", flex: "1", height: "100%", verticalAlign: "center", children: [
114
+ j(l) && /* @__PURE__ */ e.jsx(_, { children: l }),
115
+ j(c) && /* @__PURE__ */ e.jsx(y, { children: c })
116
116
  ] }),
117
117
  g && /* @__PURE__ */ e.jsx(u, { children: /* @__PURE__ */ e.jsx(
118
- y,
118
+ z,
119
119
  {
120
120
  color: a.colors.neutralColors.colorNeutralCloudy,
121
121
  cursor: "pointer",
122
- onClick: A,
122
+ onClick: E,
123
123
  height: "20px",
124
124
  width: "20px"
125
125
  }
@@ -127,39 +127,39 @@ const Y = ({
127
127
  ]
128
128
  }
129
129
  ) : /* @__PURE__ */ e.jsx(e.Fragment, {}) });
130
- }, P = ({
130
+ }, ee = ({
131
131
  label: r,
132
132
  labelRender: o,
133
133
  infoProps: s = {},
134
134
  withInfo: t = !0,
135
- flex: n,
136
- width: i = "100%",
135
+ flex: l,
136
+ width: c = "100%",
137
137
  isRequired: d = !1
138
138
  }) => {
139
- const c = {
139
+ const i = {
140
140
  tooltipProps: {
141
141
  position: "top",
142
142
  ...s == null ? void 0 : s.tooltipProps,
143
143
  size: "Small"
144
144
  }
145
145
  };
146
- return /* @__PURE__ */ e.jsxs(u, { width: i, direction: "horizontal", gap: "4px", flex: n, children: [
147
- o ?? /* @__PURE__ */ e.jsxs(z, { children: [
146
+ return /* @__PURE__ */ e.jsxs(u, { width: c, direction: "horizontal", gap: "4px", flex: l, children: [
147
+ o ?? /* @__PURE__ */ e.jsxs(W, { children: [
148
148
  r,
149
149
  " ",
150
- d ? /* @__PURE__ */ e.jsx(W, {}) : null
150
+ d ? /* @__PURE__ */ e.jsx(q, {}) : null
151
151
  ] }),
152
- t && /* @__PURE__ */ e.jsx(q, { ...c })
152
+ t && /* @__PURE__ */ e.jsx(B, { ...i })
153
153
  ] });
154
- }, ee = ({
154
+ }, re = ({
155
155
  width: r = "100%",
156
156
  flex: o,
157
157
  label: s = "Obrigatório",
158
158
  margin: t = "0 0 16px 0"
159
- }) => /* @__PURE__ */ e.jsx(u, { width: r, flex: o, customStyles: { margin: t }, children: /* @__PURE__ */ e.jsx(B, { children: `* ${s}` }) });
159
+ }) => /* @__PURE__ */ e.jsx(u, { width: r, flex: o, customStyles: { margin: t }, children: /* @__PURE__ */ e.jsx(M, { children: `* ${s}` }) });
160
160
  export {
161
- Z as A,
162
- P as L,
163
- ee as R,
164
- Y as s
161
+ P as A,
162
+ ee as L,
163
+ re as R,
164
+ Z as s
165
165
  };