@stenajs-webui/tooltip 23.18.0 → 23.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- ._floating_1glwr_1{display:flex;flex-direction:row;align-items:center;background:#fff;color:#fff;border-radius:var(--swui-border-radius);padding:var(--swui-metrics-spacing) calc(var(--swui-metrics-indent) * 2);box-shadow:var(--swui-shadow-popover)}._floating_1glwr_1._disablePadding_1glwr_11{padding:0}._iconWrapper_1glwr_16{--current-bg-color: transparent;--current-border-color: var(--lhds-color-ui-50);--current-icon-color: var(--lhds-color-ui-50);display:inline-flex;flex-direction:row;white-space:nowrap;background-color:var(--current-bg-color);border:1px solid var(--current-border-color);border-radius:var(--swui-border-radius);padding:calc(var(--swui-metrics-spacing) * .5);align-items:flex-start}._iconWrapper_1glwr_16 svg{color:var(--current-icon-color)}._iconWrapper_1glwr_16._info_1glwr_36{--current-border-color: var(--lhds-color-blue-300);--current-bg-color: var(--lhds-color-blue-100);--current-icon-color: var(--lhds-color-blue-700)}._iconWrapper_1glwr_16._warning_1glwr_42{--current-border-color: var(--lhds-color-orange-300);--current-bg-color: var(--lhds-color-orange-100);--current-icon-color: var(--lhds-color-orange-700)}._iconWrapper_1glwr_16._error_1glwr_48{--current-border-color: var(--lhds-color-red-300);--current-bg-color: var(--lhds-color-red-100);--current-icon-color: var(--lhds-color-red-700)}._floating_15fk9_1{display:flex;align-items:center;background:#333;color:#fff;border-radius:var(--swui-border-radius);padding:var(--swui-metrics-spacing) calc(var(--swui-metrics-indent) * 2);width:-webkit-fit-content;width:fit-content}._floating_15fk9_1._withIcon_15fk9_10{padding:calc(var(--swui-metrics-spacing) * .5);padding-right:calc(var(--swui-metrics-indent) * 2)}._iconWrapper_15fk9_16{--current-bg-color: transparent;--current-border-color: var(--lhds-color-ui-50);--current-icon-color: var(--lhds-color-ui-50);display:inline-flex;flex-direction:row;white-space:nowrap;background-color:var(--current-bg-color);border:1px solid var(--current-border-color);border-radius:var(--swui-border-radius);padding:calc(var(--swui-metrics-spacing) * .5);align-items:flex-start}._iconWrapper_15fk9_16 svg{color:var(--current-icon-color)}._iconWrapper_15fk9_16._info_15fk9_36{--current-border-color: var(--lhds-color-blue-300);--current-bg-color: var(--lhds-color-blue-100);--current-icon-color: var(--lhds-color-blue-700)}._iconWrapper_15fk9_16._warning_15fk9_42{--current-border-color: var(--lhds-color-orange-300);--current-bg-color: var(--lhds-color-orange-100);--current-icon-color: var(--lhds-color-orange-700)}._iconWrapper_15fk9_16._error_15fk9_48{--current-border-color: var(--lhds-color-red-300);--current-bg-color: var(--lhds-color-red-100);--current-icon-color: var(--lhds-color-red-700)}
1
+ ._floating_dg9ix_1{display:flex;flex-direction:row;align-items:center;background:#fff;color:#fff;border-radius:var(--swui-border-radius);padding:var(--swui-metrics-spacing) calc(var(--swui-metrics-indent) * 2);box-shadow:var(--swui-shadow-popover)}._floating_dg9ix_1._disablePadding_dg9ix_11{padding:0}._iconWrapper_dg9ix_16{--current-bg-color: transparent;--current-border-color: var(--lhds-color-ui-50);--current-icon-color: var(--lhds-color-ui-50);display:inline-flex;flex-direction:row;white-space:nowrap;background-color:var(--current-bg-color);border:1px solid var(--current-border-color);border-radius:var(--swui-border-radius);padding:calc(var(--swui-metrics-spacing) * .5);align-items:flex-start}._iconWrapper_dg9ix_16 svg{color:var(--current-icon-color)}._iconWrapper_dg9ix_16._info_dg9ix_36{--current-border-color: var(--lhds-color-blue-300);--current-bg-color: var(--swui-info-weak-bg-color);--current-icon-color: var(--lhds-color-blue-700)}._iconWrapper_dg9ix_16._warning_dg9ix_42{--current-border-color: var(--lhds-color-orange-300);--current-bg-color: var(--swui-warning-weak-bg-color);--current-icon-color: var(--lhds-color-orange-700)}._iconWrapper_dg9ix_16._error_dg9ix_48{--current-border-color: var(--lhds-color-red-300);--current-bg-color: var(--swui-error-weak-bg-color);--current-icon-color: var(--lhds-color-red-700)}._floating_pdrwr_1{display:flex;align-items:center;background:#333;color:#fff;border-radius:var(--swui-border-radius);padding:var(--swui-metrics-spacing) calc(var(--swui-metrics-indent) * 2);width:-webkit-fit-content;width:fit-content}._floating_pdrwr_1._withIcon_pdrwr_10{padding:calc(var(--swui-metrics-spacing) * .5);padding-right:calc(var(--swui-metrics-indent) * 2)}._iconWrapper_pdrwr_16{--current-bg-color: transparent;--current-border-color: var(--lhds-color-ui-50);--current-icon-color: var(--lhds-color-ui-50);display:inline-flex;flex-direction:row;white-space:nowrap;background-color:var(--current-bg-color);border:1px solid var(--current-border-color);border-radius:var(--swui-border-radius);padding:calc(var(--swui-metrics-spacing) * .5);align-items:flex-start}._iconWrapper_pdrwr_16 svg{color:var(--current-icon-color)}._iconWrapper_pdrwr_16._info_pdrwr_36{--current-border-color: var(--lhds-color-blue-300);--current-bg-color: var(--swui-info-weak-bg-color);--current-icon-color: var(--lhds-color-blue-700)}._iconWrapper_pdrwr_16._warning_pdrwr_42{--current-border-color: var(--lhds-color-orange-300);--current-bg-color: var(--swui-warning-weak-bg-color);--current-icon-color: var(--lhds-color-orange-700)}._iconWrapper_pdrwr_16._error_pdrwr_48{--current-border-color: var(--lhds-color-red-300);--current-bg-color: var(--swui-error-weak-bg-color);--current-icon-color: var(--lhds-color-red-700)}
package/dist/index.es.js CHANGED
@@ -1,25 +1,25 @@
1
- import { jsxs as r, jsx as e, Fragment as C } from "react/jsx-runtime";
2
- import { Column as _e, Text as Z, Space as N, Row as q } from "@stenajs-webui/core";
3
- import { FlatButton as we, PrimaryButton as ye, Spinner as Ie, Icon as Re, stenaExclamationTriangle as Pe, stenaExclamationCircle as ve, stenaInfoCircle as Fe } from "@stenajs-webui/elements";
4
- import { useRef as S, useCallback as O, useState as ee } from "react";
5
- import { useFloatingParentNodeId as ne, FloatingTree as te, useFloatingNodeId as oe, useFloating as H, autoUpdate as E, offset as M, flip as $, shift as G, arrow as D, useTransitionStyles as j, useDismiss as se, useRole as ie, useInteractions as z, FloatingNode as le, FloatingPortal as B, FloatingFocusManager as re, FloatingArrow as U, useFocus as Ce, useClick as be, useHover as ce, safePolygon as xe } from "@floating-ui/react";
6
- import b from "classnames";
1
+ import { jsxs as l, jsx as e, Fragment as C } from "react/jsx-runtime";
2
+ import { Column as we, Text as Z, Space as O, Row as q } from "@stenajs-webui/core";
3
+ import { FlatButton as _e, PrimaryButton as ye, Spinner as Ie, Icon as Re, stenaExclamationTriangle as Pe, stenaExclamationCircle as ve, stenaInfoCircle as Fe } from "@stenajs-webui/elements";
4
+ import { useRef as H, useCallback as S, useState as ee } from "react";
5
+ import { useFloatingParentNodeId as ne, FloatingTree as te, useFloatingNodeId as oe, useFloating as E, autoUpdate as M, offset as $, flip as k, shift as G, arrow as D, useTransitionStyles as j, useDismiss as ie, useRole as se, useInteractions as z, FloatingNode as re, FloatingPortal as B, FloatingFocusManager as le, FloatingArrow as U, useFocus as Ce, useClick as xe, useHover as ce, safePolygon as be } from "@floating-ui/react";
6
+ import x from "classnames";
7
7
  import { cssColor as Ae } from "@stenajs-webui/theme";
8
8
  import './index.css';const Ve = ({
9
9
  text: n = "Are you sure?",
10
10
  yesLabel: t = "Yes",
11
11
  noLabel: o = "No",
12
12
  onNo: a,
13
- onYes: s,
13
+ onYes: i,
14
14
  loading: d
15
- }) => /* @__PURE__ */ r(_e, { position: "relative", children: [
16
- /* @__PURE__ */ r("div", { style: { opacity: d ? 0 : 1 }, children: [
15
+ }) => /* @__PURE__ */ l(we, { position: "relative", children: [
16
+ /* @__PURE__ */ l("div", { style: { opacity: d ? 0 : 1 }, children: [
17
17
  /* @__PURE__ */ e(Z, { children: n }),
18
- /* @__PURE__ */ e(N, {}),
19
- /* @__PURE__ */ r(q, { justifyContent: "flex-end", alignItems: "center", children: [
20
- /* @__PURE__ */ e(we, { label: o, onClick: a }),
21
- /* @__PURE__ */ e(N, {}),
22
- /* @__PURE__ */ e(ye, { label: t, onClick: s })
18
+ /* @__PURE__ */ e(O, {}),
19
+ /* @__PURE__ */ l(q, { justifyContent: "flex-end", alignItems: "center", children: [
20
+ /* @__PURE__ */ e(_e, { label: o, onClick: a }),
21
+ /* @__PURE__ */ e(O, {}),
22
+ /* @__PURE__ */ e(ye, { label: t, onClick: i })
23
23
  ] })
24
24
  ] }),
25
25
  d && /* @__PURE__ */ e(
@@ -35,10 +35,10 @@ import './index.css';const Ve = ({
35
35
  children: /* @__PURE__ */ e(Ie, { size: "small" })
36
36
  }
37
37
  )
38
- ] }), Te = "_floating_1glwr_1", We = "_disablePadding_1glwr_11", R = {
38
+ ] }), Te = "_floating_dg9ix_1", We = "_disablePadding_dg9ix_11", R = {
39
39
  floating: Te,
40
40
  disablePadding: We
41
- }, ke = 12, J = 8, Ne = 2, Xe = ({
41
+ }, Ne = 12, J = 8, Oe = 2, Xe = ({
42
42
  children: n,
43
43
  ...t
44
44
  }) => ne() == null ? /* @__PURE__ */ e(te, { children: /* @__PURE__ */ e(K, { ...t, children: n }) }) : /* @__PURE__ */ e(K, { ...t, children: n }), K = ({
@@ -46,63 +46,63 @@ import './index.css';const Ve = ({
46
46
  placement: t = "bottom",
47
47
  hideArrow: o,
48
48
  renderTrigger: a,
49
- disablePadding: s,
49
+ disablePadding: i,
50
50
  open: d,
51
51
  onRequestClose: f,
52
- restoreFocus: w,
52
+ restoreFocus: _,
53
53
  returnFocus: y,
54
54
  initialFocus: I,
55
55
  appendTo: p,
56
56
  zIndex: h
57
57
  }) => {
58
- const g = oe(), c = S(null), u = O(
58
+ const g = oe(), c = H(null), u = S(
59
59
  (W) => {
60
60
  W || f();
61
61
  },
62
62
  [f]
63
- ), { refs: m, floatingStyles: _, context: i } = H({
63
+ ), { refs: m, floatingStyles: w, context: s } = E({
64
64
  nodeId: g,
65
65
  open: d,
66
66
  onOpenChange: u,
67
67
  placement: t,
68
68
  middleware: [
69
- M(J + Ne),
70
- $({ padding: 5 }),
69
+ $(J + Oe),
70
+ k({ padding: 5 }),
71
71
  G({ padding: 5 }),
72
72
  D({ element: c })
73
73
  ],
74
- whileElementsMounted: E
75
- }), { isMounted: P, styles: x } = j(i, {
74
+ whileElementsMounted: M
75
+ }), { isMounted: P, styles: b } = j(s, {
76
76
  initial: {
77
77
  opacity: 0
78
78
  }
79
- }), v = se(i), A = ie(i), { getReferenceProps: l, getFloatingProps: T } = z([
79
+ }), v = ie(s), A = se(s), { getReferenceProps: r, getFloatingProps: T } = z([
80
80
  v,
81
81
  A
82
82
  ]);
83
- return /* @__PURE__ */ r(C, { children: [
84
- a({ ref: m.setReference, ...l() }),
85
- /* @__PURE__ */ e(le, { id: g, children: P && /* @__PURE__ */ e(B, { root: p, children: /* @__PURE__ */ e(
86
- re,
83
+ return /* @__PURE__ */ l(C, { children: [
84
+ a({ ref: m.setReference, ...r() }),
85
+ /* @__PURE__ */ e(re, { id: g, children: P && /* @__PURE__ */ e(B, { root: p, children: /* @__PURE__ */ e(
86
+ le,
87
87
  {
88
- context: i,
88
+ context: s,
89
89
  modal: !1,
90
- restoreFocus: w,
90
+ restoreFocus: _,
91
91
  returnFocus: y,
92
92
  initialFocus: I,
93
93
  children: /* @__PURE__ */ e(
94
94
  "div",
95
95
  {
96
96
  ref: m.setFloating,
97
- style: { zIndex: h, ..._ },
97
+ style: { zIndex: h, ...w },
98
98
  ...T(),
99
- children: /* @__PURE__ */ r(
99
+ children: /* @__PURE__ */ l(
100
100
  "div",
101
101
  {
102
- style: x,
103
- className: b(
102
+ style: b,
103
+ className: x(
104
104
  R.floating,
105
- s && R.disablePadding
105
+ i && R.disablePadding
106
106
  ),
107
107
  children: [
108
108
  n,
@@ -110,8 +110,8 @@ import './index.css';const Ve = ({
110
110
  U,
111
111
  {
112
112
  ref: c,
113
- context: i,
114
- width: ke,
113
+ context: s,
114
+ width: Ne,
115
115
  height: J,
116
116
  fill: "white"
117
117
  }
@@ -124,15 +124,15 @@ import './index.css';const Ve = ({
124
124
  }
125
125
  ) }) })
126
126
  ] });
127
- }, Oe = 12, L = 8, Se = 2, Ze = ({ children: n, ...t }) => ne() == null ? /* @__PURE__ */ e(te, { children: /* @__PURE__ */ e(Q, { ...t, children: n }) }) : /* @__PURE__ */ e(Q, { ...t, children: n }), Q = ({
127
+ }, Se = 12, L = 8, He = 2, Ze = ({ children: n, ...t }) => ne() == null ? /* @__PURE__ */ e(te, { children: /* @__PURE__ */ e(Q, { ...t, children: n }) }) : /* @__PURE__ */ e(Q, { ...t, children: n }), Q = ({
128
128
  children: n,
129
129
  variant: t,
130
130
  trigger: o = "hover",
131
131
  placement: a = "bottom",
132
- hideArrow: s,
132
+ hideArrow: i,
133
133
  renderTrigger: d,
134
134
  disablePadding: f,
135
- restoreFocus: w,
135
+ restoreFocus: _,
136
136
  returnFocus: y,
137
137
  initialFocus: I,
138
138
  appendTo: p,
@@ -141,35 +141,35 @@ import './index.css';const Ve = ({
141
141
  onOpened: c,
142
142
  onClosed: u
143
143
  }) => {
144
- const [m, _] = ee(!1), i = oe(), P = S(null), x = O(
144
+ const [m, w] = ee(!1), s = oe(), P = H(null), b = S(
145
145
  (Y) => {
146
- _(Y), Y ? c?.() : u?.();
146
+ w(Y), Y ? c?.() : u?.();
147
147
  },
148
148
  [u, c]
149
- ), { refs: v, floatingStyles: A, context: l } = H({
150
- nodeId: i,
149
+ ), { refs: v, floatingStyles: A, context: r } = E({
150
+ nodeId: s,
151
151
  open: m,
152
- onOpenChange: x,
152
+ onOpenChange: b,
153
153
  placement: a,
154
154
  elements: {
155
155
  reference: h
156
156
  },
157
157
  middleware: [
158
- M(L + Se),
159
- $({ padding: 5, fallbackAxisSideDirection: "start" }),
158
+ $(L + He),
159
+ k({ padding: 5, fallbackAxisSideDirection: "start" }),
160
160
  G({ padding: 5 }),
161
161
  D({ element: P })
162
162
  ],
163
- whileElementsMounted: E
164
- }), { isMounted: T, styles: W } = j(l, {
163
+ whileElementsMounted: M
164
+ }), { isMounted: T, styles: W } = j(r, {
165
165
  initial: {
166
166
  opacity: 0
167
167
  }
168
- }), ae = O(() => {
169
- _(!1);
170
- }, []), de = se(l), fe = ie(l), pe = Ce(l, { enabled: k(o, "focus") }), he = be(l, { enabled: k(o, "click") }), ge = ce(l, {
171
- enabled: k(o, "hover"),
172
- handleClose: xe(),
168
+ }), ae = S(() => {
169
+ w(!1);
170
+ }, []), de = ie(r), fe = se(r), pe = Ce(r, { enabled: N(o, "focus") }), he = xe(r, { enabled: N(o, "click") }), ge = ce(r, {
171
+ enabled: N(o, "hover"),
172
+ handleClose: be(),
173
173
  restMs: 100
174
174
  }), { getReferenceProps: ue, getFloatingProps: me } = z([
175
175
  pe,
@@ -178,14 +178,14 @@ import './index.css';const Ve = ({
178
178
  de,
179
179
  fe
180
180
  ]);
181
- return /* @__PURE__ */ r(C, { children: [
181
+ return /* @__PURE__ */ l(C, { children: [
182
182
  d({ ref: v.setReference, ...ue() }),
183
- /* @__PURE__ */ e(le, { id: i, children: T && /* @__PURE__ */ e(B, { root: p, children: /* @__PURE__ */ e(
184
- re,
183
+ /* @__PURE__ */ e(re, { id: s, children: T && /* @__PURE__ */ e(B, { root: p, children: /* @__PURE__ */ e(
184
+ le,
185
185
  {
186
- context: l,
186
+ context: r,
187
187
  modal: !1,
188
- restoreFocus: w,
188
+ restoreFocus: _,
189
189
  returnFocus: y,
190
190
  initialFocus: I,
191
191
  children: /* @__PURE__ */ e(
@@ -194,23 +194,23 @@ import './index.css';const Ve = ({
194
194
  ref: v.setFloating,
195
195
  style: { zIndex: g, ...A },
196
196
  ...me(),
197
- children: /* @__PURE__ */ r(
197
+ children: /* @__PURE__ */ l(
198
198
  "div",
199
199
  {
200
200
  style: W,
201
- className: b(
201
+ className: x(
202
202
  R.floating,
203
203
  f && R.disablePadding,
204
204
  t && R.withIcon
205
205
  ),
206
206
  children: [
207
207
  typeof n == "function" ? n({ onRequestClose: ae }) : n,
208
- !s && /* @__PURE__ */ e(
208
+ !i && /* @__PURE__ */ e(
209
209
  U,
210
210
  {
211
211
  ref: P,
212
- context: l,
213
- width: Oe,
212
+ context: r,
213
+ width: Se,
214
214
  height: L,
215
215
  fill: "white"
216
216
  }
@@ -223,11 +223,11 @@ import './index.css';const Ve = ({
223
223
  }
224
224
  ) }) })
225
225
  ] });
226
- }, k = (n, t) => typeof n == "string" ? n === t : n.includes(t), He = "_floating_15fk9_1", Ee = "_withIcon_15fk9_10", Me = "_iconWrapper_15fk9_16", $e = "_info_15fk9_36", Ge = "_warning_15fk9_42", De = "_error_15fk9_48", F = {
227
- floating: He,
228
- withIcon: Ee,
229
- iconWrapper: Me,
230
- info: $e,
226
+ }, N = (n, t) => typeof n == "string" ? n === t : n.includes(t), Ee = "_floating_pdrwr_1", Me = "_withIcon_pdrwr_10", $e = "_iconWrapper_pdrwr_16", ke = "_info_pdrwr_36", Ge = "_warning_pdrwr_42", De = "_error_pdrwr_48", F = {
227
+ floating: Ee,
228
+ withIcon: Me,
229
+ iconWrapper: $e,
230
+ info: ke,
231
231
  warning: Ge,
232
232
  error: De
233
233
  }, je = {
@@ -239,50 +239,50 @@ import './index.css';const Ve = ({
239
239
  visible: t,
240
240
  placement: o,
241
241
  label: a,
242
- variant: s,
242
+ variant: i,
243
243
  maxWidth: d = "500px",
244
244
  appendTo: f,
245
- zIndex: w
245
+ zIndex: _
246
246
  }) => {
247
- const [y, I] = ee(!1), p = S(null), { refs: h, floatingStyles: g, context: c } = H({
247
+ const [y, I] = ee(!1), p = H(null), { refs: h, floatingStyles: g, context: c } = E({
248
248
  placement: o,
249
249
  open: t ?? y,
250
250
  onOpenChange: I,
251
251
  middleware: [
252
- M(V + Be),
253
- $({ padding: 5 }),
252
+ $(V + Be),
253
+ k({ padding: 5 }),
254
254
  G({ padding: 5 }),
255
255
  D({ element: p })
256
256
  ],
257
- whileElementsMounted: E
257
+ whileElementsMounted: M
258
258
  }), { isMounted: u, styles: m } = j(c, {
259
259
  initial: {
260
260
  opacity: 0
261
261
  }
262
- }), _ = ce(c), { getReferenceProps: i } = z([_]);
263
- return /* @__PURE__ */ r(C, { children: [
264
- /* @__PURE__ */ e("div", { ref: h.setReference, ...i(), children: n }),
265
- u && /* @__PURE__ */ e(B, { root: f, children: /* @__PURE__ */ e("div", { ref: h.setFloating, style: { zIndex: w, ...g }, children: /* @__PURE__ */ r(
262
+ }), w = ce(c), { getReferenceProps: s } = z([w]);
263
+ return /* @__PURE__ */ l(C, { children: [
264
+ /* @__PURE__ */ e("div", { ref: h.setReference, ...s(), children: n }),
265
+ u && /* @__PURE__ */ e(B, { root: f, children: /* @__PURE__ */ e("div", { ref: h.setFloating, style: { zIndex: _, ...g }, children: /* @__PURE__ */ l(
266
266
  "div",
267
267
  {
268
268
  style: { maxWidth: d, ...m },
269
- className: b(
269
+ className: x(
270
270
  F.floating,
271
- s && F.withIcon
271
+ i && F.withIcon
272
272
  ),
273
273
  children: [
274
- s ? /* @__PURE__ */ r(C, { children: [
274
+ i ? /* @__PURE__ */ l(C, { children: [
275
275
  /* @__PURE__ */ e(
276
276
  "div",
277
277
  {
278
- className: b(
278
+ className: x(
279
279
  F.iconWrapper,
280
- F[s]
280
+ F[i]
281
281
  ),
282
- children: /* @__PURE__ */ e(Re, { icon: je[s], size: 16 })
282
+ children: /* @__PURE__ */ e(Re, { icon: je[i], size: 16 })
283
283
  }
284
284
  ),
285
- /* @__PURE__ */ e(N, {}),
285
+ /* @__PURE__ */ e(O, {}),
286
286
  /* @__PURE__ */ e(X, { label: a })
287
287
  ] }) : /* @__PURE__ */ e(X, { label: a }),
288
288
  /* @__PURE__ */ e(
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const n=require("react/jsx-runtime"),f=require("@stenajs-webui/core"),g=require("@stenajs-webui/elements"),u=require("react"),e=require("@floating-ui/react"),b=require("classnames"),L=require("@stenajs-webui/theme"),Q=({text:t="Are you sure?",yesLabel:s="Yes",noLabel:o="No",onNo:c,onYes:i,loading:d})=>n.jsxs(f.Column,{position:"relative",children:[n.jsxs("div",{style:{opacity:d?0:1},children:[n.jsx(f.Text,{children:t}),n.jsx(f.Space,{}),n.jsxs(f.Row,{justifyContent:"flex-end",alignItems:"center",children:[n.jsx(g.FlatButton,{label:o,onClick:c}),n.jsx(f.Space,{}),n.jsx(g.PrimaryButton,{label:s,onClick:i})]})]}),d&&n.jsx(f.Row,{justifyContent:"center",alignItems:"center",left:0,top:0,width:"100%",height:"100%",position:"absolute",children:n.jsx(g.Spinner,{size:"small"})})]}),V="_floating_1glwr_1",X="_disablePadding_1glwr_11",R={floating:V,disablePadding:X},Z=12,W=8,ee=2,ne=({children:t,...s})=>e.useFloatingParentNodeId()==null?n.jsx(e.FloatingTree,{children:n.jsx(H,{...s,children:t})}):n.jsx(H,{...s,children:t}),H=({children:t,placement:s="bottom",hideArrow:o,renderTrigger:c,disablePadding:i,open:d,onRequestClose:p,restoreFocus:F,returnFocus:I,initialFocus:_,appendTo:h,zIndex:x})=>{const j=e.useFloatingNodeId(),a=u.useRef(null),m=u.useCallback(N=>{N||p()},[p]),{refs:w,floatingStyles:y,context:l}=e.useFloating({nodeId:j,open:d,onOpenChange:m,placement:s,middleware:[e.offset(W+ee),e.flip({padding:5}),e.shift({padding:5}),e.arrow({element:a})],whileElementsMounted:e.autoUpdate}),{isMounted:P,styles:S}=e.useTransitionStyles(l,{initial:{opacity:0}}),v=e.useDismiss(l),T=e.useRole(l),{getReferenceProps:r,getFloatingProps:A}=e.useInteractions([v,T]);return n.jsxs(n.Fragment,{children:[c({ref:w.setReference,...r()}),n.jsx(e.FloatingNode,{id:j,children:P&&n.jsx(e.FloatingPortal,{root:h,children:n.jsx(e.FloatingFocusManager,{context:l,modal:!1,restoreFocus:F,returnFocus:I,initialFocus:_,children:n.jsx("div",{ref:w.setFloating,style:{zIndex:x,...y},...A(),children:n.jsxs("div",{style:S,className:b(R.floating,i&&R.disablePadding),children:[t,!o&&n.jsx(e.FloatingArrow,{ref:a,context:l,width:Z,height:W,fill:"white"})]})})})})})]})},te=12,M=8,se=2,oe=({children:t,...s})=>e.useFloatingParentNodeId()==null?n.jsx(e.FloatingTree,{children:n.jsx($,{...s,children:t})}):n.jsx($,{...s,children:t}),$=({children:t,variant:s,trigger:o="hover",placement:c="bottom",hideArrow:i,renderTrigger:d,disablePadding:p,restoreFocus:F,returnFocus:I,initialFocus:_,appendTo:h,anchor:x,zIndex:j,onOpened:a,onClosed:m})=>{const[w,y]=u.useState(!1),l=e.useFloatingNodeId(),P=u.useRef(null),S=u.useCallback(O=>{y(O),O?a?.():m?.()},[m,a]),{refs:v,floatingStyles:T,context:r}=e.useFloating({nodeId:l,open:w,onOpenChange:S,placement:c,elements:{reference:x},middleware:[e.offset(M+se),e.flip({padding:5,fallbackAxisSideDirection:"start"}),e.shift({padding:5}),e.arrow({element:P})],whileElementsMounted:e.autoUpdate}),{isMounted:A,styles:N}=e.useTransitionStyles(r,{initial:{opacity:0}}),D=u.useCallback(()=>{y(!1)},[]),G=e.useDismiss(r),z=e.useRole(r),U=e.useFocus(r,{enabled:k(o,"focus")}),B=e.useClick(r,{enabled:k(o,"click")}),Y=e.useHover(r,{enabled:k(o,"hover"),handleClose:e.safePolygon(),restMs:100}),{getReferenceProps:J,getFloatingProps:K}=e.useInteractions([U,B,Y,G,z]);return n.jsxs(n.Fragment,{children:[d({ref:v.setReference,...J()}),n.jsx(e.FloatingNode,{id:l,children:A&&n.jsx(e.FloatingPortal,{root:h,children:n.jsx(e.FloatingFocusManager,{context:r,modal:!1,restoreFocus:F,returnFocus:I,initialFocus:_,children:n.jsx("div",{ref:v.setFloating,style:{zIndex:j,...T},...K(),children:n.jsxs("div",{style:N,className:b(R.floating,p&&R.disablePadding,s&&R.withIcon),children:[typeof t=="function"?t({onRequestClose:D}):t,!i&&n.jsx(e.FloatingArrow,{ref:P,context:r,width:te,height:M,fill:"white"})]})})})})})]})},k=(t,s)=>typeof t=="string"?t===s:t.includes(s),ie="_floating_15fk9_1",le="_withIcon_15fk9_10",re="_iconWrapper_15fk9_16",ae="_info_15fk9_36",ce="_warning_15fk9_42",de="_error_15fk9_48",C={floating:ie,withIcon:le,iconWrapper:re,info:ae,warning:ce,error:de},fe={info:g.stenaInfoCircle,warning:g.stenaExclamationCircle,error:g.stenaExclamationTriangle},ue=12,E=8,ge=2,pe=({children:t,visible:s,placement:o,label:c,variant:i,maxWidth:d="500px",appendTo:p,zIndex:F})=>{const[I,_]=u.useState(!1),h=u.useRef(null),{refs:x,floatingStyles:j,context:a}=e.useFloating({placement:o,open:s??I,onOpenChange:_,middleware:[e.offset(E+ge),e.flip({padding:5}),e.shift({padding:5}),e.arrow({element:h})],whileElementsMounted:e.autoUpdate}),{isMounted:m,styles:w}=e.useTransitionStyles(a,{initial:{opacity:0}}),y=e.useHover(a),{getReferenceProps:l}=e.useInteractions([y]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:x.setReference,...l(),children:t}),m&&n.jsx(e.FloatingPortal,{root:p,children:n.jsx("div",{ref:x.setFloating,style:{zIndex:F,...j},children:n.jsxs("div",{style:{maxWidth:d,...w},className:b(C.floating,i&&C.withIcon),children:[i?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:b(C.iconWrapper,C[i]),children:n.jsx(g.Icon,{icon:fe[i],size:16})}),n.jsx(f.Space,{}),n.jsx(q,{label:c})]}):n.jsx(q,{label:c}),n.jsx(e.FloatingArrow,{ref:h,context:a,width:ue,height:E,fill:"#333"})]})})})]})},q=({label:t})=>n.jsx(f.Text,{color:L.cssColor("--lhds-color-ui-50"),size:"small",variant:"bold",children:t});exports.ActionPrompt=Q;exports.ControlledPopover=ne;exports.Popover=oe;exports.Tooltip=pe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const n=require("react/jsx-runtime"),u=require("@stenajs-webui/core"),g=require("@stenajs-webui/elements"),f=require("react"),e=require("@floating-ui/react"),b=require("classnames"),L=require("@stenajs-webui/theme"),Q=({text:t="Are you sure?",yesLabel:s="Yes",noLabel:o="No",onNo:c,onYes:i,loading:d})=>n.jsxs(u.Column,{position:"relative",children:[n.jsxs("div",{style:{opacity:d?0:1},children:[n.jsx(u.Text,{children:t}),n.jsx(u.Space,{}),n.jsxs(u.Row,{justifyContent:"flex-end",alignItems:"center",children:[n.jsx(g.FlatButton,{label:o,onClick:c}),n.jsx(u.Space,{}),n.jsx(g.PrimaryButton,{label:s,onClick:i})]})]}),d&&n.jsx(u.Row,{justifyContent:"center",alignItems:"center",left:0,top:0,width:"100%",height:"100%",position:"absolute",children:n.jsx(g.Spinner,{size:"small"})})]}),V="_floating_dg9ix_1",X="_disablePadding_dg9ix_11",R={floating:V,disablePadding:X},Z=12,H=8,ee=2,ne=({children:t,...s})=>e.useFloatingParentNodeId()==null?n.jsx(e.FloatingTree,{children:n.jsx(M,{...s,children:t})}):n.jsx(M,{...s,children:t}),M=({children:t,placement:s="bottom",hideArrow:o,renderTrigger:c,disablePadding:i,open:d,onRequestClose:p,restoreFocus:F,returnFocus:I,initialFocus:_,appendTo:x,zIndex:h})=>{const j=e.useFloatingNodeId(),a=f.useRef(null),m=f.useCallback(N=>{N||p()},[p]),{refs:w,floatingStyles:y,context:r}=e.useFloating({nodeId:j,open:d,onOpenChange:m,placement:s,middleware:[e.offset(H+ee),e.flip({padding:5}),e.shift({padding:5}),e.arrow({element:a})],whileElementsMounted:e.autoUpdate}),{isMounted:P,styles:S}=e.useTransitionStyles(r,{initial:{opacity:0}}),v=e.useDismiss(r),T=e.useRole(r),{getReferenceProps:l,getFloatingProps:A}=e.useInteractions([v,T]);return n.jsxs(n.Fragment,{children:[c({ref:w.setReference,...l()}),n.jsx(e.FloatingNode,{id:j,children:P&&n.jsx(e.FloatingPortal,{root:x,children:n.jsx(e.FloatingFocusManager,{context:r,modal:!1,restoreFocus:F,returnFocus:I,initialFocus:_,children:n.jsx("div",{ref:w.setFloating,style:{zIndex:h,...y},...A(),children:n.jsxs("div",{style:S,className:b(R.floating,i&&R.disablePadding),children:[t,!o&&n.jsx(e.FloatingArrow,{ref:a,context:r,width:Z,height:H,fill:"white"})]})})})})})]})},te=12,$=8,se=2,oe=({children:t,...s})=>e.useFloatingParentNodeId()==null?n.jsx(e.FloatingTree,{children:n.jsx(k,{...s,children:t})}):n.jsx(k,{...s,children:t}),k=({children:t,variant:s,trigger:o="hover",placement:c="bottom",hideArrow:i,renderTrigger:d,disablePadding:p,restoreFocus:F,returnFocus:I,initialFocus:_,appendTo:x,anchor:h,zIndex:j,onOpened:a,onClosed:m})=>{const[w,y]=f.useState(!1),r=e.useFloatingNodeId(),P=f.useRef(null),S=f.useCallback(W=>{y(W),W?a?.():m?.()},[m,a]),{refs:v,floatingStyles:T,context:l}=e.useFloating({nodeId:r,open:w,onOpenChange:S,placement:c,elements:{reference:h},middleware:[e.offset($+se),e.flip({padding:5,fallbackAxisSideDirection:"start"}),e.shift({padding:5}),e.arrow({element:P})],whileElementsMounted:e.autoUpdate}),{isMounted:A,styles:N}=e.useTransitionStyles(l,{initial:{opacity:0}}),D=f.useCallback(()=>{y(!1)},[]),G=e.useDismiss(l),z=e.useRole(l),U=e.useFocus(l,{enabled:O(o,"focus")}),B=e.useClick(l,{enabled:O(o,"click")}),Y=e.useHover(l,{enabled:O(o,"hover"),handleClose:e.safePolygon(),restMs:100}),{getReferenceProps:J,getFloatingProps:K}=e.useInteractions([U,B,Y,G,z]);return n.jsxs(n.Fragment,{children:[d({ref:v.setReference,...J()}),n.jsx(e.FloatingNode,{id:r,children:A&&n.jsx(e.FloatingPortal,{root:x,children:n.jsx(e.FloatingFocusManager,{context:l,modal:!1,restoreFocus:F,returnFocus:I,initialFocus:_,children:n.jsx("div",{ref:v.setFloating,style:{zIndex:j,...T},...K(),children:n.jsxs("div",{style:N,className:b(R.floating,p&&R.disablePadding,s&&R.withIcon),children:[typeof t=="function"?t({onRequestClose:D}):t,!i&&n.jsx(e.FloatingArrow,{ref:P,context:l,width:te,height:$,fill:"white"})]})})})})})]})},O=(t,s)=>typeof t=="string"?t===s:t.includes(s),ie="_floating_pdrwr_1",re="_withIcon_pdrwr_10",le="_iconWrapper_pdrwr_16",ae="_info_pdrwr_36",ce="_warning_pdrwr_42",de="_error_pdrwr_48",C={floating:ie,withIcon:re,iconWrapper:le,info:ae,warning:ce,error:de},ue={info:g.stenaInfoCircle,warning:g.stenaExclamationCircle,error:g.stenaExclamationTriangle},fe=12,E=8,ge=2,pe=({children:t,visible:s,placement:o,label:c,variant:i,maxWidth:d="500px",appendTo:p,zIndex:F})=>{const[I,_]=f.useState(!1),x=f.useRef(null),{refs:h,floatingStyles:j,context:a}=e.useFloating({placement:o,open:s??I,onOpenChange:_,middleware:[e.offset(E+ge),e.flip({padding:5}),e.shift({padding:5}),e.arrow({element:x})],whileElementsMounted:e.autoUpdate}),{isMounted:m,styles:w}=e.useTransitionStyles(a,{initial:{opacity:0}}),y=e.useHover(a),{getReferenceProps:r}=e.useInteractions([y]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:h.setReference,...r(),children:t}),m&&n.jsx(e.FloatingPortal,{root:p,children:n.jsx("div",{ref:h.setFloating,style:{zIndex:F,...j},children:n.jsxs("div",{style:{maxWidth:d,...w},className:b(C.floating,i&&C.withIcon),children:[i?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:b(C.iconWrapper,C[i]),children:n.jsx(g.Icon,{icon:ue[i],size:16})}),n.jsx(u.Space,{}),n.jsx(q,{label:c})]}):n.jsx(q,{label:c}),n.jsx(e.FloatingArrow,{ref:x,context:a,width:fe,height:E,fill:"#333"})]})})})]})},q=({label:t})=>n.jsx(u.Text,{color:L.cssColor("--lhds-color-ui-50"),size:"small",variant:"bold",children:t});exports.ActionPrompt=Q;exports.ControlledPopover=ne;exports.Popover=oe;exports.Tooltip=pe;
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stenajs-webui/tooltip",
3
- "version": "23.18.0",
3
+ "version": "23.19.0",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "author": "mattias800",
@@ -38,9 +38,9 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@floating-ui/react": "^0.27.3",
41
- "@stenajs-webui/core": "23.18.0",
42
- "@stenajs-webui/elements": "23.18.0",
43
- "@stenajs-webui/theme": "23.18.0",
41
+ "@stenajs-webui/core": "23.19.0",
42
+ "@stenajs-webui/elements": "23.19.0",
43
+ "@stenajs-webui/theme": "23.19.0",
44
44
  "classnames": "^2.5.1"
45
45
  },
46
46
  "peerDependencies": {
@@ -62,7 +62,7 @@
62
62
  "files": [
63
63
  "dist"
64
64
  ],
65
- "gitHead": "235e894e09b8fd5092b222022bfc6c057af659c0",
65
+ "gitHead": "912cc8c27a008b28e422ac639ced616b74da3194",
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  }