@a-ui/react 7.13.0-beta.4 → 7.13.0-beta.5

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.
Files changed (269) hide show
  1. package/cjs/index10.js +1 -1
  2. package/cjs/index100.js +1 -1
  3. package/cjs/index101.js +1 -1
  4. package/cjs/index102.js +1 -1
  5. package/cjs/index103.js +1 -1
  6. package/cjs/index104.js +1 -1
  7. package/cjs/index105.js +1 -1
  8. package/cjs/index106.js +1 -1
  9. package/cjs/index107.js +1 -1
  10. package/cjs/index108.js +1 -1
  11. package/cjs/index109.js +1 -1
  12. package/cjs/index11.js +1 -1
  13. package/cjs/index110.js +1 -1
  14. package/cjs/index111.js +1 -1
  15. package/cjs/index112.js +1 -1
  16. package/cjs/index113.js +1 -1
  17. package/cjs/index114.js +2 -1
  18. package/cjs/index115.js +1 -1
  19. package/cjs/index116.js +1 -1
  20. package/cjs/index117.js +1 -1
  21. package/cjs/index118.js +1 -1
  22. package/cjs/index119.js +10 -1
  23. package/cjs/index12.js +1 -1
  24. package/cjs/index120.js +1 -1
  25. package/cjs/index121.js +1 -1
  26. package/cjs/index122.js +1 -1
  27. package/cjs/index123.js +1 -2
  28. package/cjs/index124.js +1 -1
  29. package/cjs/index125.js +1 -1
  30. package/cjs/index126.js +5 -1
  31. package/cjs/index127.js +9 -1
  32. package/cjs/index128.js +1 -10
  33. package/cjs/index129.js +1 -1
  34. package/cjs/index13.js +1 -1
  35. package/cjs/index130.js +1 -1
  36. package/cjs/index131.js +1 -1
  37. package/cjs/index132.js +1 -1
  38. package/cjs/index133.js +1 -1
  39. package/cjs/index134.js +1 -1
  40. package/cjs/index135.js +1 -5
  41. package/cjs/index136.js +1 -9
  42. package/cjs/index14.js +1 -1
  43. package/cjs/index144.js +1 -11
  44. package/cjs/index145.js +11 -1
  45. package/cjs/index146.js +1 -1
  46. package/cjs/index147.js +1 -1
  47. package/cjs/index16.js +1 -1
  48. package/cjs/index167.js +1 -1
  49. package/cjs/index17.js +1 -1
  50. package/cjs/index170.js +1 -1
  51. package/cjs/index171.js +1 -1
  52. package/cjs/index172.js +1 -1
  53. package/cjs/index176.js +1 -1
  54. package/cjs/index177.js +1 -1
  55. package/cjs/index18.js +1 -1
  56. package/cjs/index187.js +1 -1
  57. package/cjs/index194.js +1 -1
  58. package/cjs/index2.js +1 -1
  59. package/cjs/index20.js +1 -1
  60. package/cjs/index21.js +1 -1
  61. package/cjs/index22.js +1 -1
  62. package/cjs/index224.js +1 -1
  63. package/cjs/index225.js +1 -1
  64. package/cjs/index226.js +1 -1
  65. package/cjs/index227.js +1 -1
  66. package/cjs/index228.js +1 -1
  67. package/cjs/index229.js +1 -1
  68. package/cjs/index230.js +1 -1
  69. package/cjs/index231.js +1 -1
  70. package/cjs/index24.js +1 -1
  71. package/cjs/index25.js +1 -1
  72. package/cjs/index26.js +1 -1
  73. package/cjs/index27.js +1 -1
  74. package/cjs/index28.js +1 -1
  75. package/cjs/index3.js +1 -1
  76. package/cjs/index30.js +1 -1
  77. package/cjs/index31.js +1 -1
  78. package/cjs/index32.js +1 -1
  79. package/cjs/index33.js +1 -1
  80. package/cjs/index34.js +1 -1
  81. package/cjs/index36.js +1 -1
  82. package/cjs/index37.js +1 -1
  83. package/cjs/index38.js +1 -1
  84. package/cjs/index39.js +1 -1
  85. package/cjs/index4.js +1 -1
  86. package/cjs/index40.js +1 -1
  87. package/cjs/index41.js +1 -1
  88. package/cjs/index42.js +1 -1
  89. package/cjs/index43.js +1 -1
  90. package/cjs/index44.js +1 -1
  91. package/cjs/index45.js +1 -1
  92. package/cjs/index46.js +1 -1
  93. package/cjs/index47.js +1 -1
  94. package/cjs/index48.js +1 -1
  95. package/cjs/index49.js +1 -1
  96. package/cjs/index5.js +1 -1
  97. package/cjs/index50.js +1 -1
  98. package/cjs/index51.js +1 -1
  99. package/cjs/index52.js +1 -1
  100. package/cjs/index53.js +1 -1
  101. package/cjs/index54.js +1 -1
  102. package/cjs/index55.js +1 -7
  103. package/cjs/index56.js +1 -1
  104. package/cjs/index57.js +1 -1
  105. package/cjs/index58.js +1 -1
  106. package/cjs/index59.js +1 -1
  107. package/cjs/index6.js +1 -1
  108. package/cjs/index60.js +1 -1
  109. package/cjs/index61.js +7 -1
  110. package/cjs/index62.js +1 -1
  111. package/cjs/index63.js +1 -1
  112. package/cjs/index64.js +1 -1
  113. package/cjs/index65.js +1 -1
  114. package/cjs/index67.js +1 -1
  115. package/cjs/index68.js +1 -1
  116. package/cjs/index69.js +1 -1
  117. package/cjs/index71.js +1 -1
  118. package/cjs/index8.js +1 -1
  119. package/cjs/index82.js +1 -1
  120. package/cjs/index83.js +1 -1
  121. package/cjs/index85.js +1 -1
  122. package/cjs/index86.js +1 -1
  123. package/cjs/index87.js +1 -0
  124. package/cjs/index88.js +1 -0
  125. package/cjs/index89.js +1 -1
  126. package/cjs/index9.js +1 -1
  127. package/cjs/index90.js +1 -1
  128. package/cjs/index91.js +1 -1
  129. package/cjs/index94.js +1 -1
  130. package/cjs/index95.js +1 -1
  131. package/cjs/index96.js +1 -1
  132. package/cjs/index97.js +1 -1
  133. package/cjs/index98.js +1 -1
  134. package/cjs/index99.js +1 -1
  135. package/es/index10.mjs +4 -4
  136. package/es/index100.mjs +4 -66
  137. package/es/index101.mjs +11 -3
  138. package/es/index102.mjs +247 -5
  139. package/es/index103.mjs +88 -10
  140. package/es/index104.mjs +14 -6
  141. package/es/index105.mjs +4 -11
  142. package/es/index106.mjs +2 -247
  143. package/es/index107.mjs +2 -89
  144. package/es/index108.mjs +4 -15
  145. package/es/index109.mjs +391 -4
  146. package/es/index11.mjs +1 -1
  147. package/es/index110.mjs +125 -2
  148. package/es/index111.mjs +134 -2
  149. package/es/index112.mjs +2 -63
  150. package/es/index113.mjs +7 -13
  151. package/es/index114.mjs +326 -6
  152. package/es/index115.mjs +49 -6
  153. package/es/index116.mjs +2 -6
  154. package/es/index117.mjs +64 -5
  155. package/es/index118.mjs +43 -5
  156. package/es/index119.mjs +59 -6
  157. package/es/index12.mjs +2 -2
  158. package/es/index120.mjs +45 -6
  159. package/es/index121.mjs +40 -2
  160. package/es/index122.mjs +2 -8
  161. package/es/index123.mjs +2 -327
  162. package/es/index124.mjs +2 -50
  163. package/es/index125.mjs +31 -2
  164. package/es/index126.mjs +19 -65
  165. package/es/index127.mjs +58 -40
  166. package/es/index128.mjs +62 -59
  167. package/es/index129.mjs +15 -45
  168. package/es/index13.mjs +2 -2
  169. package/es/index130.mjs +6 -39
  170. package/es/index131.mjs +7 -2
  171. package/es/index132.mjs +6 -2
  172. package/es/index133.mjs +6 -2
  173. package/es/index134.mjs +4 -30
  174. package/es/index135.mjs +7 -19
  175. package/es/index136.mjs +4 -60
  176. package/es/index14.mjs +3 -3
  177. package/es/index144.mjs +2 -58
  178. package/es/index145.mjs +58 -2
  179. package/es/index146.mjs +2 -2
  180. package/es/index147.mjs +2 -2
  181. package/es/index16.mjs +1 -1
  182. package/es/index167.mjs +1 -1
  183. package/es/index17.mjs +2 -2
  184. package/es/index170.mjs +1 -1
  185. package/es/index171.mjs +1 -1
  186. package/es/index172.mjs +1 -1
  187. package/es/index176.mjs +1 -1
  188. package/es/index177.mjs +1 -1
  189. package/es/index18.mjs +3 -3
  190. package/es/index187.mjs +1 -1
  191. package/es/index194.mjs +1 -1
  192. package/es/index2.mjs +1 -1
  193. package/es/index20.mjs +2 -2
  194. package/es/index21.mjs +1 -1
  195. package/es/index22.mjs +1 -1
  196. package/es/index224.mjs +67 -58
  197. package/es/index225.mjs +31 -9
  198. package/es/index226.mjs +9 -20
  199. package/es/index227.mjs +104 -64
  200. package/es/index228.mjs +102 -26
  201. package/es/index229.mjs +59 -9
  202. package/es/index230.mjs +9 -108
  203. package/es/index231.mjs +19 -106
  204. package/es/index24.mjs +4 -4
  205. package/es/index25.mjs +2 -2
  206. package/es/index26.mjs +1 -1
  207. package/es/index27.mjs +1 -1
  208. package/es/index28.mjs +1 -1
  209. package/es/index3.mjs +1 -1
  210. package/es/index30.mjs +2 -2
  211. package/es/index31.mjs +2 -2
  212. package/es/index32.mjs +2 -2
  213. package/es/index33.mjs +3 -3
  214. package/es/index34.mjs +1 -1
  215. package/es/index36.mjs +3 -3
  216. package/es/index37.mjs +3 -3
  217. package/es/index38.mjs +3 -3
  218. package/es/index39.mjs +3 -3
  219. package/es/index4.mjs +2 -2
  220. package/es/index40.mjs +2 -2
  221. package/es/index41.mjs +1 -1
  222. package/es/index42.mjs +4 -4
  223. package/es/index43.mjs +1 -1
  224. package/es/index44.mjs +2 -2
  225. package/es/index45.mjs +3 -3
  226. package/es/index46.mjs +3 -3
  227. package/es/index47.mjs +2 -2
  228. package/es/index48.mjs +1 -1
  229. package/es/index49.mjs +2 -2
  230. package/es/index50.mjs +1 -1
  231. package/es/index51.mjs +11 -8
  232. package/es/index52.mjs +8 -11
  233. package/es/index53.mjs +21 -28
  234. package/es/index54.mjs +8 -47
  235. package/es/index55.mjs +28 -409
  236. package/es/index56.mjs +47 -21
  237. package/es/index57.mjs +47 -45
  238. package/es/index58.mjs +30 -8
  239. package/es/index59.mjs +17 -49
  240. package/es/index6.mjs +3 -3
  241. package/es/index60.mjs +28 -61
  242. package/es/index61.mjs +407 -58
  243. package/es/index62.mjs +27 -27
  244. package/es/index63.mjs +35 -20
  245. package/es/index64.mjs +3 -3
  246. package/es/index65.mjs +35 -30
  247. package/es/index67.mjs +9 -9
  248. package/es/index68.mjs +2 -2
  249. package/es/index69.mjs +2 -2
  250. package/es/index71.mjs +6 -6
  251. package/es/index8.mjs +3 -3
  252. package/es/index82.mjs +83 -60
  253. package/es/index83.mjs +1 -1
  254. package/es/index85.mjs +60 -12
  255. package/es/index86.mjs +57 -56
  256. package/es/index87.mjs +16 -0
  257. package/es/index88.mjs +61 -0
  258. package/es/index89.mjs +5 -5
  259. package/es/index9.mjs +1 -1
  260. package/es/index90.mjs +3 -3
  261. package/es/index91.mjs +1 -1
  262. package/es/index93.mjs +2 -2
  263. package/es/index94.mjs +224 -380
  264. package/es/index95.mjs +2 -125
  265. package/es/index96.mjs +63 -130
  266. package/es/index97.mjs +3 -2
  267. package/es/index98.mjs +5 -235
  268. package/es/index99.mjs +11 -2
  269. package/package.json +1 -1
package/es/index55.mjs CHANGED
@@ -1,411 +1,30 @@
1
- import ce, { useState as w, useRef as $, useEffect as u, useContext as St, useCallback as At, useImperativeHandle as Et, createContext as kt, useLayoutEffect as Ot } from "react";
2
- import { autoUpdate as Tt, arrow as xt, computePosition as ut, offset as Lt, flip as Ct, shift as Rt } from "./index90.mjs";
3
- import lt from "./index91.mjs";
4
- /*
5
- * React Tooltip
6
- * {@link https://github.com/ReactTooltip/react-tooltip}
7
- * @copyright ReactTooltip Team
8
- * @license MIT
9
- */
10
- const Nt = "react-tooltip-core-styles", zt = "react-tooltip-base-styles", dt = { core: !1, base: !1 };
11
- function pt({ css: l, id: n = zt, type: v = "base", ref: c }) {
12
- var m, h;
13
- if (!l || typeof document > "u" || dt[v] || v === "core" && typeof process < "u" && (!((m = process == null ? void 0 : process.env) === null || m === void 0) && m.REACT_TOOLTIP_DISABLE_CORE_STYLES) || v !== "base" && typeof process < "u" && (!((h = process == null ? void 0 : process.env) === null || h === void 0) && h.REACT_TOOLTIP_DISABLE_BASE_STYLES)) return;
14
- v === "core" && (n = Nt), c || (c = {});
15
- const { insertAt: C } = c;
16
- if (document.getElementById(n)) return;
17
- const b = document.head || document.getElementsByTagName("head")[0], _ = document.createElement("style");
18
- _.id = n, _.type = "text/css", C === "top" && b.firstChild ? b.insertBefore(_, b.firstChild) : b.appendChild(_), _.styleSheet ? _.styleSheet.cssText = l : _.appendChild(document.createTextNode(l)), dt[v] = !0;
19
- }
20
- const ft = async ({ elementReference: l = null, tooltipReference: n = null, tooltipArrowReference: v = null, place: c = "top", offset: m = 10, strategy: h = "absolute", middlewares: C = [Lt(Number(m)), Ct({ fallbackAxisSideDirection: "start" }), Rt({ padding: 5 })], border: b, arrowSize: _ = 8 }) => {
21
- if (!l) return { tooltipStyles: {}, tooltipArrowStyles: {}, place: c };
22
- if (n === null) return { tooltipStyles: {}, tooltipArrowStyles: {}, place: c };
23
- const q = C;
24
- return v ? (q.push(xt({ element: v, padding: 5 })), ut(l, n, { placement: c, strategy: h, middleware: q }).then(({ x: K, y: j, placement: J, middlewareData: G }) => {
25
- var I, x;
26
- const Z = { left: `${K}px`, top: `${j}px`, border: b }, { x: M, y: U } = (I = G.arrow) !== null && I !== void 0 ? I : { x: 0, y: 0 }, W = (x = { top: "bottom", right: "left", bottom: "top", left: "right" }[J.split("-")[0]]) !== null && x !== void 0 ? x : "bottom", Y = b && { borderBottom: b, borderRight: b };
27
- let ue = 0;
28
- if (b) {
29
- const ee = `${b}`.match(/(\d+)px/);
30
- ue = ee?.[1] ? Number(ee[1]) : 1;
31
- }
32
- return { tooltipStyles: Z, tooltipArrowStyles: { left: M != null ? `${M}px` : "", top: U != null ? `${U}px` : "", right: "", bottom: "", ...Y, [W]: `-${_ / 2 + ue}px` }, place: J };
33
- })) : ut(l, n, { placement: "bottom", strategy: h, middleware: q }).then(({ x: K, y: j, placement: J }) => ({ tooltipStyles: { left: `${K}px`, top: `${j}px` }, tooltipArrowStyles: {}, place: J }));
34
- }, vt = (l, n) => !("CSS" in window && "supports" in window.CSS) || window.CSS.supports(l, n), mt = (l, n, v) => {
35
- let c = null;
36
- const m = function(...h) {
37
- const C = () => {
38
- c = null;
39
- };
40
- !c && (l.apply(this, h), c = setTimeout(C, n));
41
- };
42
- return m.cancel = () => {
43
- c && (clearTimeout(c), c = null);
44
- }, m;
45
- }, yt = (l) => l !== null && !Array.isArray(l) && typeof l == "object", rt = (l, n) => {
46
- if (l === n) return !0;
47
- if (Array.isArray(l) && Array.isArray(n)) return l.length === n.length && l.every((m, h) => rt(m, n[h]));
48
- if (Array.isArray(l) !== Array.isArray(n)) return !1;
49
- if (!yt(l) || !yt(n)) return l === n;
50
- const v = Object.keys(l), c = Object.keys(n);
51
- return v.length === c.length && v.every((m) => rt(l[m], n[m]));
52
- }, $t = (l) => {
53
- if (!(l instanceof HTMLElement || l instanceof SVGElement)) return !1;
54
- const n = getComputedStyle(l);
55
- return ["overflow", "overflow-x", "overflow-y"].some((v) => {
56
- const c = n.getPropertyValue(v);
57
- return c === "auto" || c === "scroll";
58
- });
59
- }, wt = (l) => {
60
- if (!l) return null;
61
- let n = l.parentElement;
62
- for (; n; ) {
63
- if ($t(n)) return n;
64
- n = n.parentElement;
65
- }
66
- return document.scrollingElement || document.documentElement;
67
- }, jt = typeof window < "u" ? Ot : u, z = (l) => {
68
- l.current && (clearTimeout(l.current), l.current = null);
69
- }, It = "DEFAULT_TOOLTIP_ID", Bt = { anchorRefs: /* @__PURE__ */ new Set(), activeAnchor: { current: null }, attach: () => {
70
- }, detach: () => {
71
- }, setActiveAnchor: () => {
72
- } }, Dt = kt({ getTooltipData: () => Bt });
73
- function ht(l = It) {
74
- return St(Dt).getTooltipData(l);
75
- }
76
- var Te = { tooltip: "core-styles-module_tooltip__3vRRp", fixed: "core-styles-module_fixed__pcSol", arrow: "core-styles-module_arrow__cvMwQ", noArrow: "core-styles-module_noArrow__xock6", clickable: "core-styles-module_clickable__ZuTTB", show: "core-styles-module_show__Nt9eE", closing: "core-styles-module_closing__sGnxF" }, ot = { tooltip: "styles-module_tooltip__mnnfp", arrow: "styles-module_arrow__K0L3T", dark: "styles-module_dark__xNqje", light: "styles-module_light__Z6W-X", success: "styles-module_success__A2AKt", warning: "styles-module_warning__SCK0X", error: "styles-module_error__JvumD", info: "styles-module_info__BWdHW" };
77
- const qt = ({ forwardRef: l, id: n, className: v, classNameArrow: c, variant: m = "dark", anchorId: h, anchorSelect: C, place: b = "top", offset: _ = 10, events: q = ["hover"], openOnClick: K = !1, positionStrategy: j = "absolute", middlewares: J, wrapper: G, delayShow: I = 0, delayHide: x = 0, float: Z = !1, hidden: M = !1, noArrow: U = !1, clickable: W = !1, closeOnEsc: Y = !1, closeOnScroll: ue = !1, closeOnResize: ee = !1, openEvents: R, closeEvents: de, globalCloseEvents: xe, imperativeModeOnly: Ge, style: Me, position: We, afterShow: He, afterHide: H, disableTooltip: pe, content: Le, contentWrapperRef: te, isOpen: B, defaultIsOpen: fe = !1, setIsOpen: oe, previousActiveAnchor: Ce, activeAnchor: d, setActiveAnchor: ve, border: Pe, opacity: Xe, arrowColor: Je, arrowSize: me = 8, role: Ze = "tooltip" }) => {
78
- var le;
79
- const k = $(null), ye = $(null), D = $(null), re = $(null), we = $(null), [ne, Ue] = w({ tooltipStyles: {}, tooltipArrowStyles: {}, place: b }), [O, Re] = w(!1), [he, F] = w(!1), [f, be] = w(null), Ve = $(!1), _e = $(null), { anchorRefs: Ye, setActiveAnchor: Ne } = ht(n), ze = $(!1), [Q, $e] = w([]), se = $(!1), ge = K || q.includes("click"), Fe = ge || R?.click || R?.dblclick || R?.mousedown, je = R ? { ...R } : { mouseover: !0, focus: !0, mouseenter: !1, click: !1, dblclick: !1, mousedown: !1 };
80
- !R && ge && Object.assign(je, { mouseenter: !1, focus: !1, mouseover: !1, click: !0 });
81
- const ae = de ? { ...de } : { mouseout: !0, blur: !0, mouseleave: !1, click: !1, dblclick: !1, mouseup: !1 };
82
- !de && ge && Object.assign(ae, { mouseleave: !1, blur: !1, mouseout: !1 });
83
- const S = xe ? { ...xe } : { escape: Y || !1, scroll: ue || !1, resize: ee || !1, clickOutsideAnchor: Fe || !1 };
84
- Ge && (Object.assign(je, { mouseover: !1, focus: !1, mouseenter: !1, click: !1, dblclick: !1, mousedown: !1 }), Object.assign(ae, { mouseout: !1, blur: !1, mouseleave: !1, click: !1, dblclick: !1, mouseup: !1 }), Object.assign(S, { escape: !1, scroll: !1, resize: !1, clickOutsideAnchor: !1 })), jt(() => (se.current = !0, () => {
85
- se.current = !1;
86
- }), []);
87
- const T = (e) => {
88
- se.current && (e && F(!0), setTimeout(() => {
89
- se.current && (oe?.(e), B === void 0 && Re(e));
90
- }, 10));
91
- };
92
- u(() => {
93
- if (n) {
94
- if (O) {
95
- o(Ce);
96
- const t = e(d), i = [.../* @__PURE__ */ new Set([...t, n])].filter(Boolean).join(" ");
97
- d?.setAttribute("aria-describedby", i);
98
- } else o(d);
99
- return () => {
100
- o(d), o(Ce);
101
- };
102
- }
103
- function e(t) {
104
- var i;
105
- return ((i = t?.getAttribute("aria-describedby")) === null || i === void 0 ? void 0 : i.split(" ")) || [];
106
- }
107
- function o(t) {
108
- const i = e(t).filter((g) => g !== n);
109
- i.length ? t?.setAttribute("aria-describedby", i.join(" ")) : t?.removeAttribute("aria-describedby");
110
- }
111
- }, [d, O, n, Ce]), u(() => {
112
- if (B === void 0) return () => null;
113
- B && F(!0);
114
- const e = setTimeout(() => {
115
- Re(B);
116
- }, 10);
117
- return () => {
118
- clearTimeout(e);
119
- };
120
- }, [B]), u(() => {
121
- if (O !== Ve.current) if (z(we), Ve.current = O, O) He?.();
122
- else {
123
- const e = ((o) => {
124
- const t = o.match(/^([\d.]+)(ms|s)$/);
125
- if (!t) return 0;
126
- const [, i, g] = t;
127
- return Number(i) * (g === "ms" ? 1 : 1e3);
128
- })(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));
129
- we.current = setTimeout(() => {
130
- F(!1), be(null), H?.();
131
- }, e + 25);
132
- }
133
- }, [O]);
134
- const Ie = (e) => {
135
- Ue((o) => rt(o, e) ? o : e);
136
- }, Be = (e = I) => {
137
- z(D), he ? T(!0) : D.current = setTimeout(() => {
138
- T(!0);
139
- }, e);
140
- }, Se = (e = x) => {
141
- z(re), re.current = setTimeout(() => {
142
- ze.current || T(!1);
143
- }, e);
144
- }, De = (e) => {
145
- var o;
146
- if (!e) return;
147
- const t = (o = e.currentTarget) !== null && o !== void 0 ? o : e.target;
148
- if (!t?.isConnected) return ve(null), void Ne({ current: null });
149
- I ? Be() : T(!0), ve(t), Ne({ current: t }), z(re);
150
- }, Ae = () => {
151
- W ? Se(x || 100) : x ? Se() : T(!1), z(D);
152
- }, Ee = ({ x: e, y: o }) => {
153
- var t;
154
- const i = { getBoundingClientRect: () => ({ x: e, y: o, width: 0, height: 0, top: o, left: e, right: e, bottom: o }) };
155
- ft({ place: (t = f?.place) !== null && t !== void 0 ? t : b, offset: _, elementReference: i, tooltipReference: k.current, tooltipArrowReference: ye.current, strategy: j, middlewares: J, border: Pe, arrowSize: me }).then((g) => {
156
- Ie(g);
157
- });
158
- }, ke = (e) => {
159
- if (!e) return;
160
- const o = e, t = { x: o.clientX, y: o.clientY };
161
- Ee(t), _e.current = t;
162
- }, qe = (e) => {
163
- var o;
164
- if (!O) return;
165
- const t = e.target;
166
- t.isConnected && (!((o = k.current) === null || o === void 0) && o.contains(t) || [document.querySelector(`[id='${h}']`), ...Q].some((i) => i?.contains(t)) || (T(!1), z(D)));
167
- }, Qe = mt(De, 50), y = mt(Ae, 50), A = (e) => {
168
- y.cancel(), Qe(e);
169
- }, r = () => {
170
- Qe.cancel(), y();
171
- }, s = At(() => {
172
- var e, o;
173
- const t = (e = f?.position) !== null && e !== void 0 ? e : We;
174
- t ? Ee(t) : Z ? _e.current && Ee(_e.current) : d?.isConnected && ft({ place: (o = f?.place) !== null && o !== void 0 ? o : b, offset: _, elementReference: d, tooltipReference: k.current, tooltipArrowReference: ye.current, strategy: j, middlewares: J, border: Pe, arrowSize: me }).then((i) => {
175
- se.current && Ie(i);
176
- });
177
- }, [O, d, Le, Me, b, f?.place, _, j, We, f?.position, Z, me]);
178
- u(() => {
179
- var e, o;
180
- const t = new Set(Ye);
181
- Q.forEach((a) => {
182
- pe?.(a) || t.add({ current: a });
183
- });
184
- const i = document.querySelector(`[id='${h}']`);
185
- i && !pe?.(i) && t.add({ current: i });
186
- const g = () => {
187
- T(!1);
188
- }, P = wt(d), X = wt(k.current);
189
- S.scroll && (window.addEventListener("scroll", g), P?.addEventListener("scroll", g), X?.addEventListener("scroll", g));
190
- let E = null;
191
- S.resize ? window.addEventListener("resize", g) : d && k.current && (E = Tt(d, k.current, s, { ancestorResize: !0, elementResize: !0, layoutShift: !0 }));
192
- const N = (a) => {
193
- a.key === "Escape" && T(!1);
194
- };
195
- S.escape && window.addEventListener("keydown", N), S.clickOutsideAnchor && window.addEventListener("click", qe);
196
- const p = [], Oe = (a) => !!(a?.target && d?.contains(a.target)), bt = (a) => {
197
- O && Oe(a) || De(a);
198
- }, _t = (a) => {
199
- O && Oe(a) && Ae();
200
- }, nt = ["mouseover", "mouseout", "mouseenter", "mouseleave", "focus", "blur"], st = ["click", "dblclick", "mousedown", "mouseup"];
201
- Object.entries(je).forEach(([a, V]) => {
202
- V && (nt.includes(a) ? p.push({ event: a, listener: A }) : st.includes(a) && p.push({ event: a, listener: bt }));
203
- }), Object.entries(ae).forEach(([a, V]) => {
204
- V && (nt.includes(a) ? p.push({ event: a, listener: r }) : st.includes(a) && p.push({ event: a, listener: _t }));
205
- }), Z && p.push({ event: "pointermove", listener: ke });
206
- const at = () => {
207
- ze.current = !0;
208
- }, it = () => {
209
- ze.current = !1, Ae();
210
- }, ct = W && (ae.mouseout || ae.mouseleave);
211
- return ct && ((e = k.current) === null || e === void 0 || e.addEventListener("mouseover", at), (o = k.current) === null || o === void 0 || o.addEventListener("mouseout", it)), p.forEach(({ event: a, listener: V }) => {
212
- t.forEach((et) => {
213
- var Ke;
214
- (Ke = et.current) === null || Ke === void 0 || Ke.addEventListener(a, V);
215
- });
216
- }), () => {
217
- var a, V;
218
- S.scroll && (window.removeEventListener("scroll", g), P?.removeEventListener("scroll", g), X?.removeEventListener("scroll", g)), S.resize ? window.removeEventListener("resize", g) : E?.(), S.clickOutsideAnchor && window.removeEventListener("click", qe), S.escape && window.removeEventListener("keydown", N), ct && ((a = k.current) === null || a === void 0 || a.removeEventListener("mouseover", at), (V = k.current) === null || V === void 0 || V.removeEventListener("mouseout", it)), p.forEach(({ event: et, listener: Ke }) => {
219
- t.forEach((gt) => {
220
- var tt;
221
- (tt = gt.current) === null || tt === void 0 || tt.removeEventListener(et, Ke);
222
- });
223
- });
224
- };
225
- }, [d, s, he, Ye, Q, R, de, xe, ge, I, x]), u(() => {
226
- var e, o;
227
- let t = (o = (e = f?.anchorSelect) !== null && e !== void 0 ? e : C) !== null && o !== void 0 ? o : "";
228
- !t && n && (t = `[data-tooltip-id='${n.replace(/'/g, "\\'")}']`);
229
- const i = new MutationObserver((g) => {
230
- const P = [], X = [];
231
- g.forEach((E) => {
232
- if (E.type === "attributes" && E.attributeName === "data-tooltip-id" && (E.target.getAttribute("data-tooltip-id") === n ? P.push(E.target) : E.oldValue === n && X.push(E.target)), E.type === "childList") {
233
- if (d) {
234
- const N = [...E.removedNodes].filter((p) => p.nodeType === 1);
235
- if (t) try {
236
- X.push(...N.filter((p) => p.matches(t))), X.push(...N.flatMap((p) => [...p.querySelectorAll(t)]));
237
- } catch {
238
- }
239
- N.some((p) => {
240
- var Oe;
241
- return !!(!((Oe = p?.contains) === null || Oe === void 0) && Oe.call(p, d)) && (F(!1), T(!1), ve(null), z(D), z(re), !0);
242
- });
243
- }
244
- if (t) try {
245
- const N = [...E.addedNodes].filter((p) => p.nodeType === 1);
246
- P.push(...N.filter((p) => p.matches(t))), P.push(...N.flatMap((p) => [...p.querySelectorAll(t)]));
247
- } catch {
248
- }
249
- }
250
- }), (P.length || X.length) && $e((E) => [...E.filter((N) => !X.includes(N)), ...P]);
251
- });
252
- return i.observe(document.body, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["data-tooltip-id"], attributeOldValue: !0 }), () => {
253
- i.disconnect();
254
- };
255
- }, [n, C, f?.anchorSelect, d]), u(() => {
256
- s();
257
- }, [s]), u(() => {
258
- if (!te?.current) return () => null;
259
- const e = new ResizeObserver(() => {
260
- setTimeout(() => s());
261
- });
262
- return e.observe(te.current), () => {
263
- e.disconnect();
264
- };
265
- }, [Le, te?.current]), u(() => {
266
- var e;
267
- const o = document.querySelector(`[id='${h}']`), t = [...Q, o];
268
- d && t.includes(d) || ve((e = Q[0]) !== null && e !== void 0 ? e : o);
269
- }, [h, Q, d]), u(() => (fe && T(!0), () => {
270
- z(D), z(re);
271
- }), []), u(() => {
272
- var e;
273
- let o = (e = f?.anchorSelect) !== null && e !== void 0 ? e : C;
274
- if (!o && n && (o = `[data-tooltip-id='${n.replace(/'/g, "\\'")}']`), o) try {
275
- const t = Array.from(document.querySelectorAll(o));
276
- $e(t);
277
- } catch {
278
- $e([]);
279
- }
280
- }, [n, C, f?.anchorSelect]), u(() => {
281
- D.current && (z(D), Be(I));
282
- }, [I]);
283
- const L = (le = f?.content) !== null && le !== void 0 ? le : Le, ie = O && Object.keys(ne.tooltipStyles).length > 0;
284
- return Et(l, () => ({ open: (e) => {
285
- if (e?.anchorSelect) try {
286
- document.querySelector(e.anchorSelect);
287
- } catch {
288
- return void console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`);
289
- }
290
- be(e ?? null), e?.delay ? Be(e.delay) : T(!0);
291
- }, close: (e) => {
292
- e?.delay ? Se(e.delay) : T(!1);
293
- }, activeAnchor: d, place: ne.place, isOpen: !!(he && !M && L && ie) })), he && !M && L ? ce.createElement(G, { id: n, role: Ze, className: lt("react-tooltip", Te.tooltip, ot.tooltip, ot[m], v, `react-tooltip__place-${ne.place}`, Te[ie ? "show" : "closing"], ie ? "react-tooltip__show" : "react-tooltip__closing", j === "fixed" && Te.fixed, W && Te.clickable), onTransitionEnd: (e) => {
294
- z(we), O || e.propertyName !== "opacity" || (F(!1), be(null), H?.());
295
- }, style: { ...Me, ...ne.tooltipStyles, opacity: Xe !== void 0 && ie ? Xe : void 0 }, ref: k }, L, ce.createElement(G, { className: lt("react-tooltip-arrow", Te.arrow, ot.arrow, c, U && Te.noArrow), style: { ...ne.tooltipArrowStyles, background: Je ? `linear-gradient(to right bottom, transparent 50%, ${Je} 50%)` : void 0, "--rt-arrow-size": `${me}px` }, ref: ye })) : null;
296
- }, Kt = ({ content: l }) => ce.createElement("span", { dangerouslySetInnerHTML: { __html: l } }), Pt = ce.forwardRef(({ id: l, anchorId: n, anchorSelect: v, content: c, html: m, render: h, className: C, classNameArrow: b, variant: _ = "dark", place: q = "top", offset: K = 10, wrapper: j = "div", children: J = null, events: G = ["hover"], openOnClick: I = !1, positionStrategy: x = "absolute", middlewares: Z, delayShow: M = 0, delayHide: U = 0, float: W = !1, hidden: Y = !1, noArrow: ue = !1, clickable: ee = !1, closeOnEsc: R = !1, closeOnScroll: de = !1, closeOnResize: xe = !1, openEvents: Ge, closeEvents: Me, globalCloseEvents: We, imperativeModeOnly: He = !1, style: H, position: pe, isOpen: Le, defaultIsOpen: te = !1, disableStyleInjection: B = !1, border: fe, opacity: oe, arrowColor: Ce, arrowSize: d, setIsOpen: ve, afterShow: Pe, afterHide: Xe, disableTooltip: Je, role: me = "tooltip" }, Ze) => {
297
- const [le, k] = w(c), [ye, D] = w(m), [re, we] = w(q), [ne, Ue] = w(_), [O, Re] = w(K), [he, F] = w(M), [f, be] = w(U), [Ve, _e] = w(W), [Ye, Ne] = w(Y), [ze, Q] = w(j), [$e, se] = w(G), [ge, Fe] = w(x), [je, ae] = w(null), [S, T] = w(null), Ie = $(null), Be = $(B), { anchorRefs: Se, activeAnchor: De } = ht(l), Ae = (y) => y?.getAttributeNames().reduce((A, r) => {
298
- var s;
299
- return r.startsWith("data-tooltip-") && (A[r.replace(/^data-tooltip-/, "")] = (s = y?.getAttribute(r)) !== null && s !== void 0 ? s : null), A;
300
- }, {}), Ee = (y) => {
301
- const A = { place: (r) => {
302
- var s;
303
- we((s = r) !== null && s !== void 0 ? s : q);
304
- }, content: (r) => {
305
- k(r ?? c);
306
- }, html: (r) => {
307
- D(r ?? m);
308
- }, variant: (r) => {
309
- var s;
310
- Ue((s = r) !== null && s !== void 0 ? s : _);
311
- }, offset: (r) => {
312
- Re(r === null ? K : Number(r));
313
- }, wrapper: (r) => {
314
- var s;
315
- Q((s = r) !== null && s !== void 0 ? s : j);
316
- }, events: (r) => {
317
- const s = r?.split(" ");
318
- se(s ?? G);
319
- }, "position-strategy": (r) => {
320
- var s;
321
- Fe((s = r) !== null && s !== void 0 ? s : x);
322
- }, "delay-show": (r) => {
323
- F(r === null ? M : Number(r));
324
- }, "delay-hide": (r) => {
325
- be(r === null ? U : Number(r));
326
- }, float: (r) => {
327
- _e(r === null ? W : r === "true");
328
- }, hidden: (r) => {
329
- Ne(r === null ? Y : r === "true");
330
- }, "class-name": (r) => {
331
- ae(r);
332
- } };
333
- Object.values(A).forEach((r) => r(null)), Object.entries(y).forEach(([r, s]) => {
334
- var L;
335
- (L = A[r]) === null || L === void 0 || L.call(A, s);
336
- });
337
- };
338
- u(() => {
339
- k(c);
340
- }, [c]), u(() => {
341
- D(m);
342
- }, [m]), u(() => {
343
- we(q);
344
- }, [q]), u(() => {
345
- Ue(_);
346
- }, [_]), u(() => {
347
- Re(K);
348
- }, [K]), u(() => {
349
- F(M);
350
- }, [M]), u(() => {
351
- be(U);
352
- }, [U]), u(() => {
353
- _e(W);
354
- }, [W]), u(() => {
355
- Ne(Y);
356
- }, [Y]), u(() => {
357
- Fe(x);
358
- }, [x]), u(() => {
359
- Be.current !== B && console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.");
360
- }, [B]), u(() => {
361
- typeof window < "u" && window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles", { detail: { disableCore: B === "core", disableBase: B } }));
362
- }, []), u(() => {
363
- var y;
364
- const A = new Set(Se);
365
- let r = v;
366
- if (!r && l && (r = `[data-tooltip-id='${l.replace(/'/g, "\\'")}']`), r) try {
367
- document.querySelectorAll(r).forEach((o) => {
368
- A.add({ current: o });
369
- });
370
- } catch {
371
- console.warn(`[react-tooltip] "${r}" is not a valid CSS selector`);
372
- }
373
- const s = document.querySelector(`[id='${n}']`);
374
- if (s && A.add({ current: s }), !A.size) return () => null;
375
- const L = (y = S ?? s) !== null && y !== void 0 ? y : De.current, ie = new MutationObserver((o) => {
376
- o.forEach((t) => {
377
- var i;
378
- if (!L || t.type !== "attributes" || !(!((i = t.attributeName) === null || i === void 0) && i.startsWith("data-tooltip-"))) return;
379
- const g = Ae(L);
380
- Ee(g);
381
- });
382
- }), e = { attributes: !0, childList: !1, subtree: !1 };
383
- if (L) {
384
- const o = Ae(L);
385
- Ee(o), ie.observe(L, e);
386
- }
387
- return () => {
388
- ie.disconnect();
389
- };
390
- }, [Se, De, S, n, v]), u(() => {
391
- H?.border && console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."), fe && !vt("border", `${fe}`) && console.warn(`[react-tooltip] "${fe}" is not a valid \`border\`.`), H?.opacity && console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."), oe && !vt("opacity", `${oe}`) && console.warn(`[react-tooltip] "${oe}" is not a valid \`opacity\`.`);
392
- }, []);
393
- let ke = J;
394
- const qe = $(null);
395
- if (h) {
396
- const y = h({ content: S?.getAttribute("data-tooltip-content") || le || null, activeAnchor: S });
397
- ke = y ? ce.createElement("div", { ref: qe, className: "react-tooltip-content-wrapper" }, y) : null;
398
- } else le && (ke = le);
399
- ye && (ke = ce.createElement(Kt, { content: ye }));
400
- const Qe = { forwardRef: Ze, id: l, anchorId: n, anchorSelect: v, className: lt(C, je), classNameArrow: b, content: ke, contentWrapperRef: qe, place: re, variant: ne, offset: O, wrapper: ze, events: $e, openOnClick: I, positionStrategy: ge, middlewares: Z, delayShow: he, delayHide: f, float: Ve, hidden: Ye, noArrow: ue, clickable: ee, closeOnEsc: R, closeOnScroll: de, closeOnResize: xe, openEvents: Ge, closeEvents: Me, globalCloseEvents: We, imperativeModeOnly: He, style: H, position: pe, isOpen: Le, defaultIsOpen: te, border: fe, opacity: oe, arrowColor: Ce, arrowSize: d, setIsOpen: ve, afterShow: Pe, afterHide: Xe, disableTooltip: Je, activeAnchor: S, previousActiveAnchor: Ie.current, setActiveAnchor: (y) => {
401
- T((A) => (y?.isSameNode(A) || (Ie.current = A), y));
402
- }, role: me };
403
- return ce.createElement(qt, { ...Qe });
404
- });
405
- typeof window < "u" && window.addEventListener("react-tooltip-inject-styles", (l) => {
406
- l.detail.disableCore || pt({ css: ":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s;--rt-arrow-size:8px}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit;z-index:-1}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}", type: "core" }), l.detail.disableBase || pt({ css: `
407
- .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:var(--rt-arrow-size);height:var(--rt-arrow-size)}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`, type: "base" });
408
- });
1
+ var a = /* @__PURE__ */ ((r) => (r.HIGH = "high", r.MEDIUM = "medium", r.LOW = "low", r))(a || {});
2
+ const t = "high", e = {
3
+ medium: "outlined",
4
+ low: "transparent"
5
+ };
6
+ var n = /* @__PURE__ */ ((r) => (r.XS = "extra-small", r.S = "small", r.MD = "medium", r.L = "large", r))(n || {});
7
+ const c = "medium", u = {
8
+ "extra-small": "xs",
9
+ small: "s",
10
+ medium: "md",
11
+ large: "l"
12
+ };
13
+ var l = /* @__PURE__ */ ((r) => (r.PRIMARY = "primary", r.NEUTRAL = "neutral", r.DANGER = "danger", r.SUCCESS = "success", r.WARNING = "warning", r))(l || {});
14
+ const E = {
15
+ success: "check-1",
16
+ warning: "alert-circle",
17
+ danger: "alert-triangle"
18
+ };
19
+ var s = /* @__PURE__ */ ((r) => (r.SUCCESS = "success", r.ERROR = "error", r))(s || {});
409
20
  export {
410
- Pt as Tooltip
21
+ t as DEFAULT_EMPHASIS,
22
+ c as DEFAULT_SIZE,
23
+ e as EMPHASIS_MAP,
24
+ a as Emphasis,
25
+ u as SIZE_MAP,
26
+ n as Size,
27
+ s as State,
28
+ E as THEME_ICON_MAP,
29
+ l as Theme
411
30
  };
package/es/index56.mjs CHANGED
@@ -1,23 +1,49 @@
1
- import { ICONS_SVG_HTML_ID as s } from "./index52.mjs";
2
- const r = 1048576;
3
- function a(i, e = "") {
4
- return e.split(",").map((t) => t.trim()).flatMap((t) => t.split(".")).some(
5
- (t) => !t || t === "*" || t === i.type || t.includes("*") && !!t.split("/")?.[0] && i.type.startsWith(t.split("/")?.[0])
6
- );
7
- }
8
- function c(i, e) {
9
- return !e || i.size <= e * r;
10
- }
11
- function o(i, e, n) {
12
- return i.map((t) => ({ validFormat: a(t, e), validSize: c(t, n) }));
13
- }
14
- function p(i) {
15
- const e = document.getElementById(s);
16
- return e ? !!e.querySelector(`symbol#ai-${i}`) : !1;
17
- }
1
+ import { jsxs as m, jsx as c } from "react/jsx-runtime";
2
+ import { State as i, THEME_ICON_MAP as a, Theme as p } from "./index55.mjs";
3
+ import { classNames as d } from "./index52.mjs";
4
+ import { renderRequiredAsterisk as f } from "./index57.mjs";
5
+ import { Icon as u } from "./index24.mjs";
6
+ const b = ({ label: s, id: l, required: e, inline: n, className: r = "", noMargin: t = !1 }) => {
7
+ const o = d({
8
+ "a-input__label": !t,
9
+ "a-input__label--inline": !!n,
10
+ [r]: !!r
11
+ });
12
+ return s ? /* @__PURE__ */ m("label", { className: o, htmlFor: l, children: [
13
+ s,
14
+ e && f()
15
+ ] }) : null;
16
+ }, O = ({ id: s, description: l, state: e }) => {
17
+ const n = d({
18
+ "a-input__description": !0,
19
+ "is-error": e === i.ERROR,
20
+ "is-success": e === i.SUCCESS
21
+ });
22
+ return l ? /* @__PURE__ */ m("small", { id: `${s}--description`, className: n, children: [
23
+ e === i.SUCCESS && /* @__PURE__ */ c(u, { name: a[p.SUCCESS] }),
24
+ e === i.ERROR && /* @__PURE__ */ c(u, { name: a[p.DANGER] }),
25
+ l
26
+ ] }) : null;
27
+ }, A = ({
28
+ id: s,
29
+ charCountText: l,
30
+ charCounter: e,
31
+ characterCount: n,
32
+ maxLength: r
33
+ }) => {
34
+ const t = r ? r - n : 0, o = r && t <= 0, S = r ? l?.replace("%max%", r.toString()).replace("%count%", n.toString()).replace("%left%", t.toString()) : l?.replace("%count%", n.toString());
35
+ return e ? /* @__PURE__ */ c(
36
+ "small",
37
+ {
38
+ "aria-live": "polite",
39
+ id: `${s}--counter`,
40
+ className: `a-input__description u-text-left${o ? " u-text-danger" : ""}`,
41
+ children: S
42
+ }
43
+ ) : null;
44
+ };
18
45
  export {
19
- o as areFilesValid,
20
- a as hasValidFormat,
21
- c as hasValidSize,
22
- p as iconExists
46
+ A as renderCharacterCounter,
47
+ O as renderDescription,
48
+ b as renderLabel
23
49
  };
package/es/index57.mjs CHANGED
@@ -1,49 +1,51 @@
1
- import { jsxs as m, jsx as c } from "react/jsx-runtime";
2
- import { State as i, THEME_ICON_MAP as a, Theme as p } from "./index53.mjs";
3
- import { classNames as d } from "./index51.mjs";
4
- import { renderRequiredAsterisk as f } from "./index55.mjs";
5
- import { Icon as u } from "./index24.mjs";
6
- const b = ({ label: s, id: l, required: e, inline: n, className: r = "", noMargin: t = !1 }) => {
7
- const o = d({
8
- "a-input__label": !t,
9
- "a-input__label--inline": !!n,
10
- [r]: !!r
11
- });
12
- return s ? /* @__PURE__ */ m("label", { className: o, htmlFor: l, children: [
13
- s,
14
- e && f()
15
- ] }) : null;
16
- }, O = ({ id: s, description: l, state: e }) => {
17
- const n = d({
18
- "a-input__description": !0,
19
- "is-error": e === i.ERROR,
20
- "is-success": e === i.SUCCESS
21
- });
22
- return l ? /* @__PURE__ */ m("small", { id: `${s}--description`, className: n, children: [
23
- e === i.SUCCESS && /* @__PURE__ */ c(u, { name: a[p.SUCCESS] }),
24
- e === i.ERROR && /* @__PURE__ */ c(u, { name: a[p.DANGER] }),
25
- l
26
- ] }) : null;
27
- }, A = ({
28
- id: s,
29
- charCountText: l,
30
- charCounter: e,
31
- characterCount: n,
32
- maxLength: r
33
- }) => {
34
- const t = r ? r - n : 0, o = r && t <= 0, S = r ? l?.replace("%max%", r.toString()).replace("%count%", n.toString()).replace("%left%", t.toString()) : l?.replace("%count%", n.toString());
35
- return e ? /* @__PURE__ */ c(
36
- "small",
1
+ import { jsx as n, jsxs as o } from "react/jsx-runtime";
2
+ import { cloneElement as f } from "react";
3
+ import { Size as l } from "./index55.mjs";
4
+ import { Spinner as c } from "./index39.mjs";
5
+ import { Avatar as s } from "./index6.mjs";
6
+ import { Icon as i } from "./index24.mjs";
7
+ function x(e, r, t) {
8
+ return t ? f(r, { children: e }) : e;
9
+ }
10
+ function D(e, r, t) {
11
+ return !e?.href && !e?.onClick ? e?.label || "" : e?.href ? /* @__PURE__ */ o("a", { href: e.href, target: e.target || "_self", ...t, children: [
12
+ e.label || "",
13
+ r ? /* @__PURE__ */ n(i, { name: r }) : null
14
+ ] }) : /* @__PURE__ */ o(
15
+ "a",
37
16
  {
38
- "aria-live": "polite",
39
- id: `${s}--counter`,
40
- className: `a-input__description u-text-left${o ? " u-text-danger" : ""}`,
41
- children: S
17
+ style: { cursor: "pointer" },
18
+ onClick: (a) => (a.preventDefault(), e.onClick && e.onClick(a)),
19
+ onKeyDown: (a) => {
20
+ if (a.key === "Enter")
21
+ return a.preventDefault(), e.onClick && e.onClick(a);
22
+ },
23
+ role: "button",
24
+ tabIndex: 0,
25
+ ...t,
26
+ children: [
27
+ e.label || "",
28
+ r ? /* @__PURE__ */ n(i, { name: r }) : null
29
+ ]
42
30
  }
43
- ) : null;
44
- };
31
+ );
32
+ }
33
+ function S(e, r, t, u) {
34
+ return r ? /* @__PURE__ */ o("div", { className: "a-input", children: [
35
+ /* @__PURE__ */ n("label", { className: "a-input__label", id: u, htmlFor: t, children: r }),
36
+ e
37
+ ] }) : e;
38
+ }
39
+ function w(e, r) {
40
+ return e?.type === "spinner" ? /* @__PURE__ */ n(c, { ariaHidden: !0, size: r === l.S ? l.XS : l.S }) : e?.type === "avatar" ? /* @__PURE__ */ n(s, { ...e?.avatarProps, size: r }) : e?.type === "icon" ? /* @__PURE__ */ n(i, { ...e?.iconProps }) : null;
41
+ }
42
+ function g() {
43
+ return /* @__PURE__ */ n("span", { className: "u-text-danger", "aria-hidden": "true", children: "*" });
44
+ }
45
45
  export {
46
- A as renderCharacterCounter,
47
- O as renderDescription,
48
- b as renderLabel
46
+ S as labelWrapper,
47
+ w as renderAddOn,
48
+ D as renderHTMLLink,
49
+ g as renderRequiredAsterisk,
50
+ x as wrapWithIf
49
51
  };
package/es/index58.mjs CHANGED
@@ -1,10 +1,32 @@
1
- function o(r) {
2
- console.warn(`[AUI] Warning - ${r}.`);
3
- }
4
- function n(r) {
5
- console.error(`[AUI] Error - ${r}.`);
6
- }
1
+ const f = (t, n) => Array(n - t + 1).fill(0).map((e, o) => o + t), d = (t, n) => {
2
+ const e = n <= 7 ? 7 : t > 4 && t < n - 3 ? 2 : 4;
3
+ let o = Math.round(t - e / 2), a = Math.round(t + e / 2);
4
+ (o - 1 === 1 || a + 1 === n) && (o += 1, a += 1);
5
+ let s = t > e ? f(Math.min(o, n - e), Math.min(a, n)) : f(1, Math.min(n, e + 1));
6
+ return s[0] !== 1 && (s = [1, 0].concat(s)), s[s.length - 1] < n && (s = s.concat([0, n])), s;
7
+ }, p = (t, n, e, o) => {
8
+ const a = e - n, c = (t - n) / a;
9
+ return Math.round(c * o);
10
+ }, h = (t, n, e) => Math.min(Math.max(t, n), e), l = (t, n) => n ? t - n : t, M = (t, n, e, o, a, s, c) => {
11
+ const i = h(t, 0, n) / (n || 1);
12
+ let r = e * Math.round(i * (c - s)) / e + s;
13
+ return r >= a && (r = a), r <= o && (r = o), r;
14
+ }, V = (t, n, e, o, a, s, c, i) => {
15
+ const u = "clientX", r = t.type !== "touchmove" ? t[u] : t.touches[0][u], g = l(r, i);
16
+ return M(g, n, e, o, a, s, c);
17
+ }, y = (t, n, e) => {
18
+ const o = [];
19
+ if (e <= 0)
20
+ return [n];
21
+ for (let a = t; a < n; a += e)
22
+ o.push(a);
23
+ return [...o, n];
24
+ };
7
25
  export {
8
- n as logError,
9
- o as logWarning
26
+ l as getPosition,
27
+ V as getPositionValue,
28
+ y as getSteps,
29
+ M as getValueFromPosition,
30
+ p as lineValuesToPosition,
31
+ d as pagesArray
10
32
  };