@solibo/solibo-ui 0.4.12 → 0.5.4

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 (191) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/index.css +1 -1
  3. package/dist/assets/index10.css +1 -1
  4. package/dist/assets/index11.css +1 -1
  5. package/dist/assets/index12.css +1 -1
  6. package/dist/assets/index13.css +1 -1
  7. package/dist/assets/index14.css +1 -1
  8. package/dist/assets/index15.css +1 -1
  9. package/dist/assets/index16.css +1 -1
  10. package/dist/assets/index17.css +1 -1
  11. package/dist/assets/index18.css +1 -1
  12. package/dist/assets/index19.css +1 -1
  13. package/dist/assets/index2.css +1 -1
  14. package/dist/assets/index20.css +1 -1
  15. package/dist/assets/index21.css +1 -1
  16. package/dist/assets/index22.css +1 -1
  17. package/dist/assets/index23.css +1 -1
  18. package/dist/assets/index24.css +1 -1
  19. package/dist/assets/index25.css +1 -1
  20. package/dist/assets/index26.css +1 -1
  21. package/dist/assets/index27.css +1 -1
  22. package/dist/assets/index29.css +1 -1
  23. package/dist/assets/index3.css +1 -1
  24. package/dist/assets/index31.css +1 -1
  25. package/dist/assets/index32.css +1 -1
  26. package/dist/assets/index33.css +1 -1
  27. package/dist/assets/index34.css +1 -1
  28. package/dist/assets/index35.css +1 -1
  29. package/dist/assets/index36.css +1 -1
  30. package/dist/assets/index37.css +1 -1
  31. package/dist/assets/index38.css +1 -1
  32. package/dist/assets/index39.css +1 -1
  33. package/dist/assets/index40.css +1 -1
  34. package/dist/assets/index41.css +1 -1
  35. package/dist/assets/index42.css +1 -1
  36. package/dist/assets/index43.css +1 -1
  37. package/dist/assets/index44.css +1 -1
  38. package/dist/assets/index5.css +1 -1
  39. package/dist/assets/index6.css +1 -1
  40. package/dist/assets/index7.css +0 -1
  41. package/dist/assets/index8.css +1 -0
  42. package/dist/assets/index9.css +1 -1
  43. package/dist/assets/styles.css +1 -1
  44. package/dist/components/_avatar/index.cjs +1 -1
  45. package/dist/components/_avatar/index.cjs.map +1 -1
  46. package/dist/components/_avatar/index.js +9 -9
  47. package/dist/components/_avatar/index.js.map +1 -1
  48. package/dist/components/_card/index.cjs +1 -1
  49. package/dist/components/_card/index.js +12 -12
  50. package/dist/components/_collapsible/index.cjs +1 -1
  51. package/dist/components/_collapsible/index.js +1 -1
  52. package/dist/components/_croppable/index.cjs +1 -1
  53. package/dist/components/_croppable/index.js +175 -175
  54. package/dist/components/_dropdown/index.cjs +1 -1
  55. package/dist/components/_dropdown/index.cjs.map +1 -1
  56. package/dist/components/_dropdown/index.js +87 -87
  57. package/dist/components/_dropdown/index.js.map +1 -1
  58. package/dist/components/_dropzone/index.cjs +1 -1
  59. package/dist/components/_dropzone/index.js +34 -34
  60. package/dist/components/_editor/index.cjs +16 -16
  61. package/dist/components/_editor/index.cjs.map +1 -1
  62. package/dist/components/_editor/index.js +19 -19
  63. package/dist/components/_editor/index.js.map +1 -1
  64. package/dist/components/_messages/index.cjs +1 -1
  65. package/dist/components/_messages/index.cjs.map +1 -1
  66. package/dist/components/_messages/index.js +15 -15
  67. package/dist/components/_messages/index.js.map +1 -1
  68. package/dist/components/_portal/index.cjs +1 -1
  69. package/dist/components/_portal/index.cjs.map +1 -1
  70. package/dist/components/_portal/index.js +17 -16
  71. package/dist/components/_portal/index.js.map +1 -1
  72. package/dist/components/_sortable/index.cjs +1 -1
  73. package/dist/components/_sortable/index.cjs.map +1 -1
  74. package/dist/components/_sortable/index.js +21 -21
  75. package/dist/components/_sortable/index.js.map +1 -1
  76. package/dist/components/_widget/index.cjs +1 -1
  77. package/dist/components/_widget/index.js +3 -3
  78. package/dist/components/app-link/index.cjs +1 -1
  79. package/dist/components/app-link/index.cjs.map +1 -1
  80. package/dist/components/app-link/index.js +9 -9
  81. package/dist/components/app-link/index.js.map +1 -1
  82. package/dist/components/aside/index.cjs +1 -1
  83. package/dist/components/aside/index.js +6 -6
  84. package/dist/components/badge/index.cjs +1 -1
  85. package/dist/components/badge/index.cjs.map +1 -1
  86. package/dist/components/badge/index.js +19 -18
  87. package/dist/components/badge/index.js.map +1 -1
  88. package/dist/components/banner/index.cjs +1 -1
  89. package/dist/components/banner/index.js +9 -9
  90. package/dist/components/branding/index.cjs +1 -1
  91. package/dist/components/branding/index.js +12 -12
  92. package/dist/components/button/index.cjs +1 -1
  93. package/dist/components/button/index.js +12 -12
  94. package/dist/components/checkbox/index.cjs +1 -1
  95. package/dist/components/checkbox/index.js +7 -7
  96. package/dist/components/controls/index.cjs +1 -1
  97. package/dist/components/controls/index.cjs.map +1 -1
  98. package/dist/components/controls/index.js +21 -10
  99. package/dist/components/controls/index.js.map +1 -1
  100. package/dist/components/dialog/index.cjs +1 -1
  101. package/dist/components/dialog/index.js +3 -3
  102. package/dist/components/figure/index.cjs +1 -1
  103. package/dist/components/figure/index.cjs.map +1 -1
  104. package/dist/components/figure/index.js +11 -11
  105. package/dist/components/figure/index.js.map +1 -1
  106. package/dist/components/file/index.cjs +1 -1
  107. package/dist/components/file/index.cjs.map +1 -1
  108. package/dist/components/file/index.js +14 -13
  109. package/dist/components/file/index.js.map +1 -1
  110. package/dist/components/footer/index.cjs +1 -1
  111. package/dist/components/footer/index.js +3 -3
  112. package/dist/components/form/index.cjs +1 -1
  113. package/dist/components/form/index.js +11 -11
  114. package/dist/components/graph/index.cjs +1 -1
  115. package/dist/components/graph/index.cjs.map +1 -1
  116. package/dist/components/graph/index.js +31 -31
  117. package/dist/components/graph/index.js.map +1 -1
  118. package/dist/components/group/index.cjs +1 -1
  119. package/dist/components/group/index.js +1 -1
  120. package/dist/components/header/index.cjs +1 -1
  121. package/dist/components/header/index.js +3 -3
  122. package/dist/components/icon/index.cjs +1 -1
  123. package/dist/components/icon/index.cjs.map +1 -1
  124. package/dist/components/icon/index.js +26 -26
  125. package/dist/components/icon/index.js.map +1 -1
  126. package/dist/components/image/index.cjs +1 -1
  127. package/dist/components/image/index.js +9 -9
  128. package/dist/components/input/index.cjs +1 -1
  129. package/dist/components/input/index.cjs.map +1 -1
  130. package/dist/components/input/index.js +34 -33
  131. package/dist/components/input/index.js.map +1 -1
  132. package/dist/components/link/index.cjs +1 -1
  133. package/dist/components/link/index.js +11 -11
  134. package/dist/components/list/index.cjs +1 -1
  135. package/dist/components/list/index.js +7 -7
  136. package/dist/components/loading/index.cjs +1 -1
  137. package/dist/components/loading/index.js +13 -13
  138. package/dist/components/message/index.cjs +1 -1
  139. package/dist/components/message/index.js +7 -7
  140. package/dist/components/nav/index.cjs +1 -1
  141. package/dist/components/nav/index.js +23 -23
  142. package/dist/components/object/index.cjs +1 -1
  143. package/dist/components/object/index.cjs.map +1 -1
  144. package/dist/components/object/index.js +1 -1
  145. package/dist/components/object/index.js.map +1 -1
  146. package/dist/components/select/index.cjs +1 -1
  147. package/dist/components/select/index.js +1 -1
  148. package/dist/components/table/index.cjs +1 -1
  149. package/dist/components/table/index.cjs.map +1 -1
  150. package/dist/components/table/index.js +22 -22
  151. package/dist/components/table/index.js.map +1 -1
  152. package/dist/components/textarea/index.cjs +1 -1
  153. package/dist/components/textarea/index.cjs.map +1 -1
  154. package/dist/components/textarea/index.js +23 -23
  155. package/dist/components/textarea/index.js.map +1 -1
  156. package/dist/components/toast/index.cjs +1 -1
  157. package/dist/components/toast/index.cjs.map +1 -1
  158. package/dist/components/toast/index.js +23 -24
  159. package/dist/components/toast/index.js.map +1 -1
  160. package/dist/components/toggle/index.cjs +1 -1
  161. package/dist/components/toggle/index.js +1 -1
  162. package/dist/components/toolbar/index.cjs +1 -1
  163. package/dist/components/toolbar/index.js +9 -9
  164. package/dist/index-CiEbbnD6.js +42 -0
  165. package/dist/index-CiEbbnD6.js.map +1 -0
  166. package/dist/index-ClrKYsAQ.cjs +2 -0
  167. package/dist/index-ClrKYsAQ.cjs.map +1 -0
  168. package/dist/index.cjs +1 -1
  169. package/dist/index.d.ts +20 -23
  170. package/dist/index.js +40 -42
  171. package/dist/index.js.map +1 -1
  172. package/dist/styles.module-BOTEBJ0C.js +9 -0
  173. package/dist/styles.module-BOTEBJ0C.js.map +1 -0
  174. package/dist/styles.module-BPvMQa_x.cjs +2 -0
  175. package/dist/styles.module-BPvMQa_x.cjs.map +1 -0
  176. package/dist/tokens.css +44 -12
  177. package/dist/tokens.json +541 -68
  178. package/package.json +1 -1
  179. package/dist/assets/index45.css +0 -1
  180. package/dist/components/layout/index.cjs +0 -2
  181. package/dist/components/layout/index.cjs.map +0 -1
  182. package/dist/components/layout/index.js +0 -18
  183. package/dist/components/layout/index.js.map +0 -1
  184. package/dist/index-BNaQZHo6.js +0 -40
  185. package/dist/index-BNaQZHo6.js.map +0 -1
  186. package/dist/index-Bh5n72jH.cjs +0 -2
  187. package/dist/index-Bh5n72jH.cjs.map +0 -1
  188. package/dist/styles.module-DZXAP_eP.js +0 -8
  189. package/dist/styles.module-DZXAP_eP.js.map +0 -1
  190. package/dist/styles.module-Vt6mmlsz.cjs +0 -2
  191. package/dist/styles.module-Vt6mmlsz.cjs.map +0 -1
@@ -1,17 +1,17 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { t as o } from "../../classix-DG18itHa.js";
3
- import '../../assets/index38.css';const _ = "_link_8fl9a_1", s = "_primary_8fl9a_7", e = "_danger_8fl9a_13", c = "_minimal_8fl9a_21", n = {
4
- link: _,
5
- primary: s,
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { t as _ } from "../../classix-DG18itHa.js";
3
+ import '../../assets/index37.css';const s = "_link_xhd9q_1", l = "_primary_xhd9q_7", e = "_danger_xhd9q_13", c = "_minimal_xhd9q_21", n = {
4
+ link: s,
5
+ primary: l,
6
6
  danger: e,
7
7
  minimal: c
8
8
  }, k = ({
9
- children: a,
10
- className: r,
11
- to: i = "#",
12
- variant: m = "primary",
13
- ...l
14
- }) => /* @__PURE__ */ t("a", { className: o(r, n.link, n[m]), href: i, ...l, "data-component": "link", children: a });
9
+ children: r,
10
+ className: i,
11
+ to: m = "#",
12
+ variant: a = "primary",
13
+ ...t
14
+ }) => /* @__PURE__ */ o("a", { className: _(i, n.link, n[a]), href: m, ...t, "data-component": "link", children: r });
15
15
  export {
16
16
  k as Link
17
17
  };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index39.css');const a=require("react/jsx-runtime"),_=require("../../classix-5H4IWnMA.cjs"),c=require("../../helpers-BD5fFZi-.cjs"),d="_horizontal_ham8z_1",z="_list_ham8z_12",x="_columns_ham8z_51",s={horizontal:d,list:z,columns:x};function y({children:t,className:r,columns:o=1,horizontal:m,ordered:u,style:h,...l}){const n=Number.isFinite(o)?Math.max(1,Math.floor(o)):1,e=_.t(r,s.list,n>1&&s.columns,m&&s.horizontal),i={...h,"--list-columns":n};return u?a.jsx("ol",{className:e,style:i,...l,"data-component":"list",children:c.wrapChildren(t)}):a.jsx("ul",{className:e,style:i,...l,"data-component":"list",children:c.wrapChildren(t)})}exports.List=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index38.css');const c=require("react/jsx-runtime"),_=require("../../classix-5H4IWnMA.cjs"),r=require("../../helpers-BD5fFZi-.cjs"),d="_horizontal_1w5i6_1",w="_list_1w5i6_12",x="_columns_1w5i6_53",s={horizontal:d,list:w,columns:x};function y({children:t,className:a,columns:o=1,horizontal:u,ordered:m,style:h,...l}){const i=Number.isFinite(o)?Math.max(1,Math.floor(o)):1,n=_.t(a,s.list,i>1&&s.columns,u&&s.horizontal),e={...h,"--list-columns":i};return m?c.jsx("ol",{className:n,style:e,...l,"data-component":"list",children:r.wrapChildren(t)}):c.jsx("ul",{className:n,style:e,...l,"data-component":"list",children:r.wrapChildren(t)})}exports.List=y;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,25 +1,25 @@
1
1
  import { jsx as c } from "react/jsx-runtime";
2
2
  import { t as u } from "../../classix-DG18itHa.js";
3
- import { w as m } from "../../helpers-D56OHkFI.js";
4
- import '../../assets/index39.css';const z = "_horizontal_ham8z_1", f = "_list_ham8z_12", p = "_columns_ham8z_51", t = {
5
- horizontal: z,
3
+ import { w as r } from "../../helpers-D56OHkFI.js";
4
+ import '../../assets/index38.css';const w = "_horizontal_1w5i6_1", f = "_list_1w5i6_12", p = "_columns_1w5i6_53", t = {
5
+ horizontal: w,
6
6
  list: f,
7
7
  columns: p
8
8
  };
9
9
  function y({
10
10
  children: o,
11
- className: r,
11
+ className: m,
12
12
  columns: s = 1,
13
13
  horizontal: e,
14
14
  ordered: h,
15
15
  style: _,
16
16
  ...l
17
17
  }) {
18
- const n = Number.isFinite(s) ? Math.max(1, Math.floor(s)) : 1, a = u(r, t.list, n > 1 && t.columns, e && t.horizontal), i = {
18
+ const i = Number.isFinite(s) ? Math.max(1, Math.floor(s)) : 1, n = u(m, t.list, i > 1 && t.columns, e && t.horizontal), a = {
19
19
  ..._,
20
- "--list-columns": n
20
+ "--list-columns": i
21
21
  };
22
- return h ? /* @__PURE__ */ c("ol", { className: a, style: i, ...l, "data-component": "list", children: m(o) }) : /* @__PURE__ */ c("ul", { className: a, style: i, ...l, "data-component": "list", children: m(o) });
22
+ return h ? /* @__PURE__ */ c("ol", { className: n, style: a, ...l, "data-component": "list", children: r(o) }) : /* @__PURE__ */ c("ul", { className: n, style: a, ...l, "data-component": "list", children: r(o) });
23
23
  }
24
24
  export {
25
25
  y as List
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index15.css');const n=require("react/jsx-runtime"),i=require("../../classix-5H4IWnMA.cjs"),c="_loading_1ytlq_23",d="_spin_1ytlq_1",_="_ping_1ytlq_39",r="_sticky_1ytlq_65",s={loading:c,default:"_default_1ytlq_28",spin:d,ping:_,sticky:r},g=({variant:o="default",size:t,sticky:l=!1,...a})=>{const e={"--border-size":t?t/8+"px":void 0,"--size":t?t+"px":void 0};return n.jsx("div",{className:i.t(s.loading,l&&s.sticky),"data-component":"loading",children:n.jsx("span",{className:i.t(s.loading,s[o]),style:e,...a})})};exports.Loading=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index14.css');const t=require("react/jsx-runtime"),i=require("../../classix-5H4IWnMA.cjs"),c="_loading_1nndz_23",l="_spin_1nndz_1",_="_ping_1nndz_39",r="_sticky_1nndz_65",s={loading:c,default:"_default_1nndz_28",spin:l,ping:_,sticky:r},g=({variant:o="default",size:n,sticky:d=!1,...a})=>{const e={"--border-size":n?n/8+"px":void 0,"--size":n?n+"px":void 0};return t.jsx("div",{className:i.t(s.loading,d&&s.sticky),"data-component":"loading",children:t.jsx("span",{className:i.t(s.loading,s[o]),style:e,...a})})};exports.Loading=g;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,24 +1,24 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { t as s } from "../../classix-DG18itHa.js";
3
- import '../../assets/index15.css';const c = "_loading_1ytlq_23", _ = "_spin_1ytlq_1", p = "_ping_1ytlq_39", e = "_sticky_1ytlq_65", n = {
4
- loading: c,
5
- default: "_default_1ytlq_28",
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { t } from "../../classix-DG18itHa.js";
3
+ import '../../assets/index14.css';const l = "_loading_1nndz_23", _ = "_spin_1nndz_1", p = "_ping_1nndz_39", e = "_sticky_1nndz_65", o = {
4
+ loading: l,
5
+ default: "_default_1nndz_28",
6
6
  spin: _,
7
7
  ping: p,
8
8
  sticky: e
9
- }, g = ({
9
+ }, m = ({
10
10
  variant: i = "default",
11
- size: t,
12
- sticky: l = !1,
11
+ size: n,
12
+ sticky: d = !1,
13
13
  ...a
14
14
  }) => {
15
- const d = {
16
- "--border-size": t ? t / 8 + "px" : void 0,
17
- "--size": t ? t + "px" : void 0
15
+ const c = {
16
+ "--border-size": n ? n / 8 + "px" : void 0,
17
+ "--size": n ? n + "px" : void 0
18
18
  };
19
- return /* @__PURE__ */ o("div", { className: s(n.loading, l && n.sticky), "data-component": "loading", children: /* @__PURE__ */ o("span", { className: s(n.loading, n[i]), style: d, ...a }) });
19
+ return /* @__PURE__ */ s("div", { className: t(o.loading, d && o.sticky), "data-component": "loading", children: /* @__PURE__ */ s("span", { className: t(o.loading, o[i]), style: c, ...a }) });
20
20
  };
21
21
  export {
22
- g as Loading
22
+ m as Loading
23
23
  };
24
24
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index40.css');const s=require("react/jsx-runtime"),c=require("../../classix-5H4IWnMA.cjs"),o=require("../icon/index.cjs"),r="_message_1cg9n_1",g="_preview_1cg9n_38",t={message:r,preview:g},m=({content:n,id:a,preview:i,type:e="default"})=>s.jsxs("div",{className:c.t(t.message,i&&t.preview),"data-id":a,"data-type":e,"data-component":"message",children:[e=="system"&&s.jsx(o.Icon,{gap:"right",name:"info"}),n]});exports.Message=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index39.css');const s=require("react/jsx-runtime"),o=require("../../classix-5H4IWnMA.cjs"),r=require("../icon/index.cjs"),c="_message_k0j8z_1",m="_preview_k0j8z_40",t={message:c,preview:m},g=({content:a,id:n,preview:i,type:e="default"})=>s.jsxs("div",{className:o.t(t.message,i&&t.preview),"data-id":n,"data-type":e,"data-component":"message",children:[e=="system"&&s.jsx(r.Icon,{gap:"right",name:"info"}),a]});exports.Message=g;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,16 +1,16 @@
1
1
  import { jsxs as o, jsx as r } from "react/jsx-runtime";
2
- import { t as n } from "../../classix-DG18itHa.js";
3
- import { Icon as i } from "../icon/index.js";
4
- import '../../assets/index40.css';const c = "_message_1cg9n_1", g = "_preview_1cg9n_38", s = {
5
- message: c,
6
- preview: g
2
+ import { t as i } from "../../classix-DG18itHa.js";
3
+ import { Icon as n } from "../icon/index.js";
4
+ import '../../assets/index39.css';const p = "_message_k0j8z_1", c = "_preview_k0j8z_40", s = {
5
+ message: p,
6
+ preview: c
7
7
  }, f = ({
8
8
  content: t,
9
9
  id: a,
10
10
  preview: m,
11
11
  type: e = "default"
12
- }) => /* @__PURE__ */ o("div", { className: n(s.message, m && s.preview), "data-id": a, "data-type": e, "data-component": "message", children: [
13
- e == "system" && /* @__PURE__ */ r(i, { gap: "right", name: "info" }),
12
+ }) => /* @__PURE__ */ o("div", { className: i(s.message, m && s.preview), "data-id": a, "data-type": e, "data-component": "message", children: [
13
+ e == "system" && /* @__PURE__ */ r(n, { gap: "right", name: "info" }),
14
14
  t
15
15
  ] });
16
16
  export {
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index41.css');const p=require("react/jsx-runtime"),_=require("../../classix-5H4IWnMA.cjs"),f=require("react"),v=require("../../icons-C_cX1FYp.cjs"),h="_nav_joer2_1",b="_horizontal_joer2_7",j="_tabs_joer2_17",g="_pills_joer2_38",t={nav:h,horizontal:b,tabs:j,pills:g},m={default:t.default,pills:t.pills,tabs:t.tabs},w=({animation:o,children:i,className:r,horizontal:s=!1,variant:e="default",...l})=>{const[c,a]=f.useState(!1),u={"--icon-svg":v.iconSVG("chevron")};return p.jsx("nav",{className:_.t(r,s&&t.horizontal,t.nav,m[e]),"data-animation":o,"data-open":c?"true":"false","data-orientation":s?"horizontal":"vertical",onBlurCapture:n=>{if(e!=="pills"||window.innerWidth>960)return;const d=n.relatedTarget;n.currentTarget.contains(d)||a(!1)},onClick:()=>{e!=="pills"||window.innerWidth>960||a(n=>!n)},style:u,...l,"data-component":"nav",children:i})};exports.Nav=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index40.css');const p=require("react/jsx-runtime"),_=require("../../classix-5H4IWnMA.cjs"),f=require("react"),v=require("../../icons-C_cX1FYp.cjs"),h="_nav_2unxd_1",x="_horizontal_2unxd_7",b="_tabs_2unxd_17",g="_pills_2unxd_38",t={nav:h,horizontal:x,tabs:b,pills:g},m={default:t.default,pills:t.pills,tabs:t.tabs},w=({animation:o,children:i,className:l,horizontal:s=!1,variant:e="default",...r})=>{const[c,a]=f.useState(!1),u={"--icon-svg":v.iconSVG("chevron")};return p.jsx("nav",{className:_.t(l,s&&t.horizontal,t.nav,m[e]),"data-animation":o,"data-open":c?"true":"false","data-orientation":s?"horizontal":"vertical",onBlurCapture:n=>{if(e!=="pills"||window.innerWidth>960)return;const d=n.relatedTarget;n.currentTarget.contains(d)||a(!1)},onClick:()=>{e!=="pills"||window.innerWidth>960||a(n=>!n)},style:u,...r,"data-component":"nav",children:i})};exports.Nav=w;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,36 +1,36 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { t as _ } from "../../classix-DG18itHa.js";
3
- import { useState as m } from "react";
4
- import { i as u } from "../../icons-DfmpRbxE.js";
5
- import '../../assets/index41.css';const v = "_nav_joer2_1", h = "_horizontal_joer2_7", b = "_tabs_joer2_17", j = "_pills_joer2_38", t = {
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { t as f } from "../../classix-DG18itHa.js";
3
+ import { useState as _ } from "react";
4
+ import { i as m } from "../../icons-DfmpRbxE.js";
5
+ import '../../assets/index40.css';const v = "_nav_2unxd_1", h = "_horizontal_2unxd_7", x = "_tabs_2unxd_17", b = "_pills_2unxd_38", t = {
6
6
  nav: v,
7
7
  horizontal: h,
8
- tabs: b,
9
- pills: j
8
+ tabs: x,
9
+ pills: b
10
10
  }, w = {
11
11
  default: t.default,
12
12
  pills: t.pills,
13
13
  tabs: t.tabs
14
- }, C = ({
15
- animation: e,
16
- children: r,
17
- className: i,
18
- horizontal: a = !1,
19
- variant: o = "default",
20
- ...l
14
+ }, N = ({
15
+ animation: i,
16
+ children: e,
17
+ className: l,
18
+ horizontal: o = !1,
19
+ variant: a = "default",
20
+ ...r
21
21
  }) => {
22
- const [c, s] = m(!1), p = {
23
- "--icon-svg": u("chevron")
22
+ const [c, s] = _(!1), p = {
23
+ "--icon-svg": m("chevron")
24
24
  };
25
- return /* @__PURE__ */ d("nav", { className: _(i, a && t.horizontal, t.nav, w[o]), "data-animation": e, "data-open": c ? "true" : "false", "data-orientation": a ? "horizontal" : "vertical", onBlurCapture: (n) => {
26
- if (o !== "pills" || window.innerWidth > 960) return;
27
- const f = n.relatedTarget;
28
- n.currentTarget.contains(f) || s(!1);
25
+ return /* @__PURE__ */ u("nav", { className: f(l, o && t.horizontal, t.nav, w[a]), "data-animation": i, "data-open": c ? "true" : "false", "data-orientation": o ? "horizontal" : "vertical", onBlurCapture: (n) => {
26
+ if (a !== "pills" || window.innerWidth > 960) return;
27
+ const d = n.relatedTarget;
28
+ n.currentTarget.contains(d) || s(!1);
29
29
  }, onClick: () => {
30
- o !== "pills" || window.innerWidth > 960 || s((n) => !n);
31
- }, style: p, ...l, "data-component": "nav", children: r });
30
+ a !== "pills" || window.innerWidth > 960 || s((n) => !n);
31
+ }, style: p, ...r, "data-component": "nav", children: e });
32
32
  };
33
33
  export {
34
- C as Nav
34
+ N as Nav
35
35
  };
36
36
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index4.css');const e=require("react/jsx-runtime"),n="_object_1esdj_1",s={object:n},a=({alt:c,url:t,...o})=>e.jsx("object",{"aria-label":c,className:s.object,data:t,type:"application/pdf",...o,"data-component":"objectcomponent",children:t&&e.jsxs(e.Fragment,{children:["We cannot show this file. You can try accessing it directly:",e.jsx("br",{}),e.jsx("a",{href:t,children:t})]})});exports.Object=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index4.css');const e=require("react/jsx-runtime"),n="_object_1esdj_1",s={object:n},a=({accessibleLabel:c,url:t,...o})=>e.jsx("object",{"aria-label":c,className:s.object,data:t,type:"application/pdf",...o,"data-component":"objectcomponent",children:t&&e.jsxs(e.Fragment,{children:["We cannot show this file. You can try accessing it directly:",e.jsx("br",{}),e.jsx("a",{href:t,children:t})]})});exports.Object=a;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/object/index.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\n\nimport styles from './styles.module.css';\n\nexport type ObjectProps = Omit<ComponentPropsWithoutRef<'object'>, 'data' | 'type'> & {\n alt: string;\n url: string;\n};\n\nconst ObjectComponent = ({ alt, url, ...props }: ObjectProps) => {\n return (\n <object\n aria-label={alt}\n className={styles.object}\n data={url}\n type={`application/pdf`}\n {...props}\n >\n {url && (\n <>\n We cannot show this file. You can try accessing it directly:\n <br />\n <a href={url}>{url}</a>\n </>\n )}\n </object>\n );\n};\n\nexport { ObjectComponent as Object };\n"],"names":["ObjectComponent","alt","url","props","styles","object","jsxs","Fragment","jsx"],"mappings":"sJASMA,EAAkBA,CAAC,CAAEC,IAAAA,EAAKC,IAAAA,EAAK,GAAGC,CAAmB,UAEtD,SAAA,CACC,aAAYF,EACZ,UAAWG,EAAOC,OAClB,KAAMH,EACN,KAAM,kBACN,GAAIC,EAAM,iBAAA,kBAETD,YACCI,EAAAA,KAAAC,WAAA,CAAA,SAAA,CAAA,qEAEG,KAAA,EAAE,EACHC,EAAAA,IAAC,IAAA,CAAE,KAAMN,EAAMA,SAAAA,CAAAA,CAAI,CAAA,CAAA,CACrB,CAAA,CAEJ"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/object/index.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\n\nimport styles from './styles.module.css';\n\nexport type ObjectProps = Omit<ComponentPropsWithoutRef<'object'>, 'data' | 'type'> & {\n accessibleLabel: string;\n url: string;\n};\n\nconst ObjectComponent = ({ accessibleLabel, url, ...props }: ObjectProps) => {\n return (\n <object\n aria-label={accessibleLabel}\n className={styles.object}\n data={url}\n type={`application/pdf`}\n {...props}\n >\n {url && (\n <>\n We cannot show this file. You can try accessing it directly:\n <br />\n <a href={url}>{url}</a>\n </>\n )}\n </object>\n );\n};\n\nexport { ObjectComponent as Object };\n"],"names":["ObjectComponent","accessibleLabel","url","props","styles","object","jsxs","Fragment","jsx"],"mappings":"sJASMA,EAAkBA,CAAC,CAAEC,gBAAAA,EAAiBC,IAAAA,EAAK,GAAGC,CAAmB,UAElE,SAAA,CACC,aAAYF,EACZ,UAAWG,EAAOC,OAClB,KAAMH,EACN,KAAM,kBACN,GAAIC,EAAM,iBAAA,kBAETD,YACCI,EAAAA,KAAAC,WAAA,CAAA,SAAA,CAAA,qEAEG,KAAA,EAAE,EACHC,EAAAA,IAAC,IAAA,CAAE,KAAMN,EAAMA,SAAAA,CAAAA,CAAI,CAAA,CAAA,CACrB,CAAA,CAEJ"}
@@ -2,7 +2,7 @@ import { jsx as e, jsxs as n, Fragment as a } from "react/jsx-runtime";
2
2
  import '../../assets/index4.css';const s = "_object_1esdj_1", i = {
3
3
  object: s
4
4
  }, r = ({
5
- alt: c,
5
+ accessibleLabel: c,
6
6
  url: t,
7
7
  ...o
8
8
  }) => /* @__PURE__ */ e("object", { "aria-label": c, className: i.object, data: t, type: "application/pdf", ...o, "data-component": "objectcomponent", children: t && /* @__PURE__ */ n(a, { children: [
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/object/index.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\n\nimport styles from './styles.module.css';\n\nexport type ObjectProps = Omit<ComponentPropsWithoutRef<'object'>, 'data' | 'type'> & {\n alt: string;\n url: string;\n};\n\nconst ObjectComponent = ({ alt, url, ...props }: ObjectProps) => {\n return (\n <object\n aria-label={alt}\n className={styles.object}\n data={url}\n type={`application/pdf`}\n {...props}\n >\n {url && (\n <>\n We cannot show this file. You can try accessing it directly:\n <br />\n <a href={url}>{url}</a>\n </>\n )}\n </object>\n );\n};\n\nexport { ObjectComponent as Object };\n"],"names":["ObjectComponent","alt","url","props","styles","object","jsxs","Fragment","jsx"],"mappings":";;;GASMA,IAAkBA,CAAC;AAAA,EAAEC,KAAAA;AAAAA,EAAKC,KAAAA;AAAAA,EAAK,GAAGC;AAAmB,wBAEtD,UAAA,EACC,cAAYF,GACZ,WAAWG,EAAOC,QAClB,MAAMH,GACN,MAAM,mBACN,GAAIC,GAAM,kBAAA,mBAETD,eACC,gBAAAI,EAAAC,GAAA,EAAA,UAAA;AAAA,EAAA;AAAA,oBAEG,MAAA,EAAE;AAAA,EACH,gBAAAC,EAAC,KAAA,EAAE,MAAMN,GAAMA,UAAAA,EAAAA,CAAI;AAAA,EAAA,CACrB,EAAA,CAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/object/index.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\n\nimport styles from './styles.module.css';\n\nexport type ObjectProps = Omit<ComponentPropsWithoutRef<'object'>, 'data' | 'type'> & {\n accessibleLabel: string;\n url: string;\n};\n\nconst ObjectComponent = ({ accessibleLabel, url, ...props }: ObjectProps) => {\n return (\n <object\n aria-label={accessibleLabel}\n className={styles.object}\n data={url}\n type={`application/pdf`}\n {...props}\n >\n {url && (\n <>\n We cannot show this file. You can try accessing it directly:\n <br />\n <a href={url}>{url}</a>\n </>\n )}\n </object>\n );\n};\n\nexport { ObjectComponent as Object };\n"],"names":["ObjectComponent","accessibleLabel","url","props","styles","object","jsxs","Fragment","jsx"],"mappings":";;;GASMA,IAAkBA,CAAC;AAAA,EAAEC,iBAAAA;AAAAA,EAAiBC,KAAAA;AAAAA,EAAK,GAAGC;AAAmB,wBAElE,UAAA,EACC,cAAYF,GACZ,WAAWG,EAAOC,QAClB,MAAMH,GACN,MAAM,mBACN,GAAIC,GAAM,kBAAA,mBAETD,eACC,gBAAAI,EAAAC,GAAA,EAAA,UAAA;AAAA,EAAA;AAAA,oBAEG,MAAA,EAAE;AAAA,EACH,gBAAAC,EAAC,KAAA,EAAE,MAAMN,GAAMA,UAAAA,EAAAA,CAAI;AAAA,EAAA,CACrB,EAAA,CAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../classix-5H4IWnMA.cjs");require("../../icons-C_cX1FYp.cjs");require("../../utils-DBzf7CFq.cjs");const e=require("../../index-Bh5n72jH.cjs");exports.Select=e.Select;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../classix-5H4IWnMA.cjs");require("../../icons-C_cX1FYp.cjs");require("../../utils-DBzf7CFq.cjs");const e=require("../../index-ClrKYsAQ.cjs");exports.Select=e.Select;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "../../classix-DG18itHa.js";
3
3
  import "../../icons-DfmpRbxE.js";
4
4
  import "../../utils--n2yqjCy.js";
5
- import { S as e } from "../../index-BNaQZHo6.js";
5
+ import { S as e } from "../../index-CiEbbnD6.js";
6
6
  export {
7
7
  e as Select
8
8
  };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index3.css');const f=require("react/jsx-runtime"),i=require("react"),k=require("../icon/index.cjs"),z="_table_18uji_1",D="_sortable_18uji_27",j={table:z,sortable:D},m=r=>i.isValidElement(r),A=r=>i.Children.toArray(r).reduce((e,t)=>m(t)?e+(t.type==="td"||t.type==="th"?1:A(t.props.children)):e,0),v=r=>{for(const e of i.Children.toArray(r)){if(!m(e))continue;if(e.type==="tr")return A(e.props.children);const t=v(e.props.children);if(t!==null)return t}return null},S=(r,e)=>i.Children.map(r,t=>{if(!m(t))return t;let s=t.props.children===void 0?t.props.children:S(t.props.children,e),n;return t.type==="td"&&t.props["data-span"]==="all"&&(n={colSpan:e}),t.type==="th"&&t.props["data-type"]&&(s=f.jsxs("span",{className:j.sortable,children:[s,f.jsx(k.Icon,{"aria-hidden":"true",name:"updown",variant:"primary"})]})),n||s!==t.props.children?i.cloneElement(t,n,s):t}),I=(r,e,t,s,n=1)=>{if(t==="text")return r.localeCompare(e,s,{sensitivity:"base"})*n;const l=t==="date"?Date.parse(r):Number.parseFloat(r),c=t==="date"?Date.parse(e):Number.parseFloat(e);return Number.isNaN(l)&&Number.isNaN(c)?0:Number.isNaN(l)?1:Number.isNaN(c)?-1:(l-c)*n},P=({children:r,locale:e,...t})=>{const s=i.useRef(null),n=v(r),l=n&&n>0?S(r,n):r,c=(d,u,o)=>{d.querySelectorAll("th[data-type]").forEach(a=>{a===u?(a.dataset.dir=o,a.setAttribute("aria-sort",o==="asc"?"ascending":"descending")):(delete a.dataset.dir,a.setAttribute("aria-sort","none"))})},q=i.useCallback(d=>{var x,g;const u=s.current;if(!u)return;const o=(x=d.target)==null?void 0:x.closest("th");if(!o)return;const p=u.tHead;if(!p||!p.contains(o))return;const a=o.cellIndex;if(a<0)return;const b=(g=u.tBodies)==null?void 0:g[0];if(!b)return;const y=o.getAttribute("data-type");if(!y)return;const N=o.dataset.dir==="asc"?"desc":"asc";c(p,o,N);const w=N==="asc"?1:-1,C=Array.from(b.rows);C.sort((E,R)=>{var _,h;const T=(((_=E.cells[a])==null?void 0:_.textContent)??"").trim(),F=(((h=R.cells[a])==null?void 0:h.textContent)??"").trim();return I(T,F,y,e,w)}),b.append(...C)},[e]);return f.jsx("table",{className:j.table,onClick:q,ref:s,...t,"data-component":"table",children:l})};exports.Table=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index3.css');const f=require("react/jsx-runtime"),i=require("react"),k=require("../icon/index.cjs"),z="_table_1egqd_1",D="_sortable_1egqd_27",h={table:z,sortable:D},m=r=>i.isValidElement(r),q=r=>i.Children.toArray(r).reduce((e,t)=>m(t)?e+(t.type==="td"||t.type==="th"?1:q(t.props.children)):e,0),v=r=>{for(const e of i.Children.toArray(r)){if(!m(e))continue;if(e.type==="tr")return q(e.props.children);const t=v(e.props.children);if(t!==null)return t}return null},S=(r,e)=>i.Children.map(r,t=>{if(!m(t))return t;let s=t.props.children===void 0?t.props.children:S(t.props.children,e),n;return t.type==="td"&&t.props["data-span"]==="all"&&(n={colSpan:e}),t.type==="th"&&t.props["data-type"]&&(s=f.jsxs("span",{className:h.sortable,children:[s,f.jsx(k.Icon,{name:"updown",variant:"primary"})]})),n||s!==t.props.children?i.cloneElement(t,n,s):t}),I=(r,e,t,s,n=1)=>{if(t==="text")return r.localeCompare(e,s,{sensitivity:"base"})*n;const l=t==="date"?Date.parse(r):Number.parseFloat(r),c=t==="date"?Date.parse(e):Number.parseFloat(e);return Number.isNaN(l)&&Number.isNaN(c)?0:Number.isNaN(l)?1:Number.isNaN(c)?-1:(l-c)*n},P=({children:r,locale:e,...t})=>{const s=i.useRef(null),n=v(r),l=n&&n>0?S(r,n):r,c=(d,u,o)=>{d.querySelectorAll("th[data-type]").forEach(a=>{a===u?(a.dataset.dir=o,a.setAttribute("aria-sort",o==="asc"?"ascending":"descending")):(delete a.dataset.dir,a.setAttribute("aria-sort","none"))})},j=i.useCallback(d=>{var x,g;const u=s.current;if(!u)return;const o=(x=d.target)==null?void 0:x.closest("th");if(!o)return;const p=u.tHead;if(!p||!p.contains(o))return;const a=o.cellIndex;if(a<0)return;const b=(g=u.tBodies)==null?void 0:g[0];if(!b)return;const y=o.getAttribute("data-type");if(!y)return;const N=o.dataset.dir==="asc"?"desc":"asc";c(p,o,N);const w=N==="asc"?1:-1,C=Array.from(b.rows);C.sort((E,R)=>{var _,A;const T=(((_=E.cells[a])==null?void 0:_.textContent)??"").trim(),F=(((A=R.cells[a])==null?void 0:A.textContent)??"").trim();return I(T,F,y,e,w)}),b.append(...C)},[e]);return f.jsx("table",{className:h.table,onClick:j,ref:s,...t,"data-component":"table",children:l})};exports.Table=P;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/table/index.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, useCallback, useRef } from 'react';\n\nimport { Icon } from '../icon';\nimport styles from './styles.module.css';\n\nexport type TableProps = React.TableHTMLAttributes<HTMLTableElement> & {\n children?: React.ReactNode;\n locale?: string | string[];\n};\n\ntype SortType = 'date' | 'number' | 'text';\n\ntype TableChildProps = {\n children?: React.ReactNode;\n colSpan?: number;\n 'data-span'?: string;\n 'data-type'?: SortType;\n};\n\nconst isTableElement = (child: React.ReactNode): child is React.ReactElement<TableChildProps> =>\n isValidElement<TableChildProps>(child);\n\nconst countCells = (children: React.ReactNode): number =>\n Children.toArray(children).reduce<number>((count, child) => {\n if (!isTableElement(child)) return count;\n return (\n count + (child.type === 'td' || child.type === 'th' ? 1 : countCells(child.props.children))\n );\n }, 0);\n\nconst getFirstRowCellCount = (children: React.ReactNode): number | null => {\n for (const child of Children.toArray(children)) {\n if (!isTableElement(child)) continue;\n\n if (child.type === 'tr') return countCells(child.props.children);\n\n const nestedCount = getFirstRowCellCount(child.props.children);\n if (nestedCount !== null) return nestedCount;\n }\n\n return null;\n};\n\nconst normalizeChildren = (children: React.ReactNode, columnCount: number): React.ReactNode =>\n Children.map(children, (child) => {\n if (!isTableElement(child)) return child;\n\n let nextChildren =\n child.props.children === undefined\n ? child.props.children\n : normalizeChildren(child.props.children, columnCount);\n let nextProps: Partial<TableChildProps> | undefined;\n\n if (child.type === 'td' && child.props['data-span'] === 'all') {\n nextProps = { colSpan: columnCount };\n }\n\n if (child.type === 'th' && child.props['data-type']) {\n nextChildren = (\n <span className={styles.sortable}>\n {nextChildren}\n <Icon\n aria-hidden='true'\n name='updown'\n variant='primary'\n />\n </span>\n );\n }\n\n return nextProps || nextChildren !== child.props.children\n ? cloneElement(child, nextProps, nextChildren)\n : child;\n });\n\n/**\n * Sortable columns must provide data-type (text, number, or date) in the `th` element.\n */\n\nconst compare = (a: string, b: string, type: SortType, locale?: string | string[], dir = 1) => {\n if (type === 'text') {\n return a.localeCompare(b, locale, { sensitivity: 'base' }) * dir;\n }\n\n const left = type === 'date' ? Date.parse(a) : Number.parseFloat(a);\n const right = type === 'date' ? Date.parse(b) : Number.parseFloat(b);\n\n if (Number.isNaN(left) && Number.isNaN(right)) return 0;\n if (Number.isNaN(left)) return 1;\n if (Number.isNaN(right)) return -1;\n return (left - right) * dir;\n};\n\nexport const Table = ({ children, locale, ...props }: TableProps) => {\n const ref = useRef<HTMLTableElement | null>(null);\n const columnCount = getFirstRowCellCount(children);\n const normalizedChildren =\n columnCount && columnCount > 0 ? normalizeChildren(children, columnCount) : children;\n\n const setSortState = (\n thead: HTMLTableSectionElement,\n active: HTMLTableCellElement,\n dir: 'asc' | 'desc'\n ) => {\n const ths = thead.querySelectorAll<HTMLTableCellElement>('th[data-type]');\n\n ths.forEach((th) => {\n if (th === active) {\n th.dataset.dir = dir;\n th.setAttribute('aria-sort', dir === 'asc' ? 'ascending' : 'descending');\n } else {\n delete th.dataset.dir;\n th.setAttribute('aria-sort', 'none');\n }\n });\n };\n\n const onClick = useCallback(\n (e: React.MouseEvent<HTMLTableElement>) => {\n const table = ref.current;\n if (!table) return;\n\n const th = (e.target as HTMLElement | null)?.closest('th');\n if (!th) return;\n\n const thead = table.tHead;\n if (!thead || !thead.contains(th)) return;\n\n const col = th.cellIndex;\n if (col < 0) return;\n\n const tbody = table.tBodies?.[0];\n if (!tbody) return;\n\n const type = th.getAttribute('data-type') as SortType | null;\n if (!type) return;\n\n const direction = th.dataset.dir === 'asc' ? 'desc' : 'asc';\n setSortState(thead, th, direction);\n const dir = direction === 'asc' ? 1 : -1;\n\n const rows = Array.from(tbody.rows);\n\n rows.sort((a, b) => {\n const av = (a.cells[col]?.textContent ?? '').trim();\n const bv = (b.cells[col]?.textContent ?? '').trim();\n return compare(av, bv, type, locale, dir);\n });\n\n tbody.append(...rows);\n },\n [locale]\n );\n\n return (\n <table\n className={styles.table}\n onClick={onClick}\n ref={ref}\n {...props}\n >\n {normalizedChildren}\n </table>\n );\n};\n"],"names":["isTableElement","child","isValidElement","countCells","children","Children","toArray","reduce","count","type","props","getFirstRowCellCount","nestedCount","normalizeChildren","columnCount","map","nextChildren","undefined","nextProps","colSpan","jsxs","styles","sortable","Icon","cloneElement","compare","a","b","locale","dir","localeCompare","sensitivity","left","Date","parse","Number","parseFloat","right","isNaN","Table","ref","useRef","normalizedChildren","setSortState","thead","active","querySelectorAll","forEach","th","dataset","setAttribute","onClick","useCallback","e","table","current","target","closest","tHead","contains","col","cellIndex","tbody","tBodies","getAttribute","direction","rows","Array","from","sort","av","cells","textContent","trim","bv","append","jsx"],"mappings":"wOAmBMA,EAAkBC,GACtBC,EAAAA,eAAgCD,CAAK,EAEjCE,EAAcC,GAClBC,EAAAA,SAASC,QAAQF,CAAQ,EAAEG,OAAe,CAACC,EAAOP,IAC3CD,EAAeC,CAAK,EAEvBO,GAASP,EAAMQ,OAAS,MAAQR,EAAMQ,OAAS,KAAO,EAAIN,EAAWF,EAAMS,MAAMN,QAAQ,GAFxDI,EAIlC,CAAC,EAEAG,EAAwBP,GAA6C,CACzE,UAAWH,KAASI,EAAAA,SAASC,QAAQF,CAAQ,EAAG,CAC9C,GAAI,CAACJ,EAAeC,CAAK,EAAG,SAE5B,GAAIA,EAAMQ,OAAS,YAAaN,EAAWF,EAAMS,MAAMN,QAAQ,EAE/D,MAAMQ,EAAcD,EAAqBV,EAAMS,MAAMN,QAAQ,EAC7D,GAAIQ,IAAgB,KAAM,OAAOA,CACnC,CAEA,OAAO,IACT,EAEMC,EAAoBA,CAACT,EAA2BU,IACpDT,EAAAA,SAASU,IAAIX,EAAWH,GAAU,CAChC,GAAI,CAACD,EAAeC,CAAK,EAAG,OAAOA,EAEnC,IAAIe,EACFf,EAAMS,MAAMN,WAAaa,OACrBhB,EAAMS,MAAMN,SACZS,EAAkBZ,EAAMS,MAAMN,SAAUU,CAAW,EACrDI,EAEJ,OAAIjB,EAAMQ,OAAS,MAAQR,EAAMS,MAAM,WAAW,IAAM,QACtDQ,EAAY,CAAEC,QAASL,CAAAA,GAGrBb,EAAMQ,OAAS,MAAQR,EAAMS,MAAM,WAAW,IAChDM,EACEI,EAAA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AAUC,cACbC,GAA0C,SACzC,MAAMC,EAAQd,EAAIe,QAClB,GAAI,CAACD,EAAO,OAEZ,MAAMN,GAAMK,EAAAA,EAAEG,SAAFH,YAAAA,EAAiCI,QAAQ,MACrD,GAAI,CAACT,EAAI,OAET,MAAMJ,EAAQU,EAAMI,MACpB,GAAI,CAACd,GAAS,CAACA,EAAMe,SAASX,CAAE,EAAG,OAEnC,MAAMY,EAAMZ,EAAGa,UACf,GAAID,EAAM,EAAG,OAEb,MAAME,GAAQR,EAAAA,EAAMS,UAANT,YAAAA,EAAgB,GAC9B,GAAI,CAACQ,EAAO,OAEZ,MAAMrD,EAAOuC,EAAGgB,aAAa,WAAW,EACxC,GAAI,CAACvD,EAAM,OAEX,MAAMwD,EAAYjB,EAAGC,QAAQpB,MAAQ,MAAQ,OAAS,MACtDc,EAAaC,EAAOI,EAAIiB,CAAS,EACjC,MAAMpC,EAAMoC,IAAc,MAAQ,EAAI,GAEhCC,EAAOC,MAAMC,KAAKN,EAAMI,IAAI,EAElCA,EAAKG,KAAK,CAAC3C,EAAGC,IAAM,SAClB,MAAM2C,KAAM5C,EAAAA,EAAE6C,MAAMX,CAAG,IAAXlC,YAAAA,EAAc8C,cAAe,IAAIC,KAAAA,EACvCC,KAAM/C,EAAAA,EAAE4C,MAAMX,CAAG,IAAXjC,YAAAA,EAAc6C,cAAe,IAAIC,KAAAA,EAC7C,OAAOhD,EAAQ6C,EAAII,EAAIjE,EAAMmB,EAAQC,CAAG,CAC1C,CAAC,EAEDiC,EAAMa,OAAO,GAAGT,CAAI,CACtB,EACA,CAACtC,CAAM,CACT,EAEA,OACEgD,EAAAA,IAAC,QAAA,CACC,UAAWvD,EAAOiC,MAClB,QAAAH,EACA,IAAAX,EACA,GAAI9B,EAAM,iBAAA,QAETgC,SAAAA,CAAAA,CACH,CAEJ"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/table/index.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, useCallback, useRef } from 'react';\n\nimport { Icon } from '../icon';\nimport styles from './styles.module.css';\n\nexport type TableProps = React.TableHTMLAttributes<HTMLTableElement> & {\n children?: React.ReactNode;\n locale?: string | string[];\n};\n\ntype SortType = 'date' | 'number' | 'text';\n\ntype TableChildProps = {\n children?: React.ReactNode;\n colSpan?: number;\n 'data-span'?: string;\n 'data-type'?: SortType;\n};\n\nconst isTableElement = (child: React.ReactNode): child is React.ReactElement<TableChildProps> =>\n isValidElement<TableChildProps>(child);\n\nconst countCells = (children: React.ReactNode): number =>\n Children.toArray(children).reduce<number>((count, child) => {\n if (!isTableElement(child)) return count;\n return (\n count + (child.type === 'td' || child.type === 'th' ? 1 : countCells(child.props.children))\n );\n }, 0);\n\nconst getFirstRowCellCount = (children: React.ReactNode): number | null => {\n for (const child of Children.toArray(children)) {\n if (!isTableElement(child)) continue;\n\n if (child.type === 'tr') return countCells(child.props.children);\n\n const nestedCount = getFirstRowCellCount(child.props.children);\n if (nestedCount !== null) return nestedCount;\n }\n\n return null;\n};\n\nconst normalizeChildren = (children: React.ReactNode, columnCount: number): React.ReactNode =>\n Children.map(children, (child) => {\n if (!isTableElement(child)) return child;\n\n let nextChildren =\n child.props.children === undefined\n ? child.props.children\n : normalizeChildren(child.props.children, columnCount);\n let nextProps: Partial<TableChildProps> | undefined;\n\n if (child.type === 'td' && child.props['data-span'] === 'all') {\n nextProps = { colSpan: columnCount };\n }\n\n if (child.type === 'th' && child.props['data-type']) {\n nextChildren = (\n <span className={styles.sortable}>\n {nextChildren}\n <Icon\n name='updown'\n variant='primary'\n />\n </span>\n );\n }\n\n return nextProps || nextChildren !== child.props.children\n ? cloneElement(child, nextProps, nextChildren)\n : child;\n });\n\n/**\n * Sortable columns must provide data-type (text, number, or date) in the `th` element.\n */\n\nconst compare = (a: string, b: string, type: SortType, locale?: string | string[], dir = 1) => {\n if (type === 'text') {\n return a.localeCompare(b, locale, { sensitivity: 'base' }) * dir;\n }\n\n const left = type === 'date' ? Date.parse(a) : Number.parseFloat(a);\n const right = type === 'date' ? Date.parse(b) : Number.parseFloat(b);\n\n if (Number.isNaN(left) && Number.isNaN(right)) return 0;\n if (Number.isNaN(left)) return 1;\n if (Number.isNaN(right)) return -1;\n return (left - right) * dir;\n};\n\nexport const Table = ({ children, locale, ...props }: TableProps) => {\n const ref = useRef<HTMLTableElement | null>(null);\n const columnCount = getFirstRowCellCount(children);\n const normalizedChildren =\n columnCount && columnCount > 0 ? normalizeChildren(children, columnCount) : children;\n\n const setSortState = (\n thead: HTMLTableSectionElement,\n active: HTMLTableCellElement,\n dir: 'asc' | 'desc'\n ) => {\n const ths = thead.querySelectorAll<HTMLTableCellElement>('th[data-type]');\n\n ths.forEach((th) => {\n if (th === active) {\n th.dataset.dir = dir;\n th.setAttribute('aria-sort', dir === 'asc' ? 'ascending' : 'descending');\n } else {\n delete th.dataset.dir;\n th.setAttribute('aria-sort', 'none');\n }\n });\n };\n\n const onClick = useCallback(\n (e: React.MouseEvent<HTMLTableElement>) => {\n const table = ref.current;\n if (!table) return;\n\n const th = (e.target as HTMLElement | null)?.closest('th');\n if (!th) return;\n\n const thead = table.tHead;\n if (!thead || !thead.contains(th)) return;\n\n const col = th.cellIndex;\n if (col < 0) return;\n\n const tbody = table.tBodies?.[0];\n if (!tbody) return;\n\n const type = th.getAttribute('data-type') as SortType | null;\n if (!type) return;\n\n const direction = th.dataset.dir === 'asc' ? 'desc' : 'asc';\n setSortState(thead, th, direction);\n const dir = direction === 'asc' ? 1 : -1;\n\n const rows = Array.from(tbody.rows);\n\n rows.sort((a, b) => {\n const av = (a.cells[col]?.textContent ?? '').trim();\n const bv = (b.cells[col]?.textContent ?? '').trim();\n return compare(av, bv, type, locale, dir);\n });\n\n tbody.append(...rows);\n },\n [locale]\n );\n\n return (\n <table\n className={styles.table}\n onClick={onClick}\n ref={ref}\n {...props}\n >\n {normalizedChildren}\n </table>\n );\n};\n"],"names":["isTableElement","child","isValidElement","countCells","children","Children","toArray","reduce","count","type","props","getFirstRowCellCount","nestedCount","normalizeChildren","columnCount","map","nextChildren","undefined","nextProps","colSpan","jsxs","styles","sortable","jsx","Icon","cloneElement","compare","a","b","locale","dir","localeCompare","sensitivity","left","Date","parse","Number","parseFloat","right","isNaN","Table","ref","useRef","normalizedChildren","setSortState","thead","active","querySelectorAll","forEach","th","dataset","setAttribute","onClick","useCallback","e","table","current","target","closest","tHead","contains","col","cellIndex","tbody","tBodies","getAttribute","direction","rows","Array","from","sort","av","cells","textContent","trim","bv","append"],"mappings":"wOAmBMA,EAAkBC,GACtBC,EAAAA,eAAgCD,CAAK,EAEjCE,EAAcC,GAClBC,EAAAA,SAASC,QAAQF,CAAQ,EAAEG,OAAe,CAACC,EAAOP,IAC3CD,EAAeC,CAAK,EAEvBO,GAASP,EAAMQ,OAAS,MAAQR,EAAMQ,OAAS,KAAO,EAAIN,EAAWF,EAAMS,MAAMN,QAAQ,GAFxDI,EAIlC,CAAC,EAEAG,EAAwBP,GAA6C,CACzE,UAAWH,KAASI,EAAAA,SAASC,QAAQF,CAAQ,EAAG,CAC9C,GAAI,CAACJ,EAAeC,CAAK,EAAG,SAE5B,GAAIA,EAAMQ,OAAS,YAAaN,EAAWF,EAAMS,MAAMN,QAAQ,EAE/D,MAAMQ,EAAcD,EAAqBV,EAAMS,MAAMN,QAAQ,EAC7D,GAAIQ,IAAgB,KAAM,OAAOA,CACnC,CAEA,OAAO,IACT,EAEMC,EAAoBA,CAACT,EAA2BU,IACpDT,EAAAA,SAASU,IAAIX,EAAWH,GAAU,CAChC,GAAI,CAACD,EAAeC,CAAK,EAAG,OAAOA,EAEnC,IAAIe,EACFf,EAAMS,MAAMN,WAAaa,OACrBhB,EAAMS,MAAMN,SACZS,EAAkBZ,EAAMS,MAAMN,SAAUU,CAAW,EACrDI,EAEJ,OAAIjB,EAAMQ,OAAS,MAAQR,EAAMS,MAAM,WAAW,IAAM,QACtDQ,EAAY,CAAEC,QAASL,CAAAA,GAGrBb,EAAMQ,OAAS,MAAQR,EAAMS,MAAM,WAAW,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Children as f, cloneElement as q, isValidElement as B } from "react";
1
+ import { jsx as _, jsxs as D } from "react/jsx-runtime";
2
+ import { useRef as I, useCallback as R, Children as f, cloneElement as T, isValidElement as B } from "react";
3
3
  import { Icon as H } from "../icon/index.js";
4
- import '../../assets/index3.css';const P = "_table_18uji_1", V = "_sortable_18uji_27", h = {
4
+ import '../../assets/index3.css';const P = "_table_1egqd_1", V = "_sortable_1egqd_27", v = {
5
5
  table: P,
6
6
  sortable: V
7
- }, m = (r) => B(r), v = (r) => f.toArray(r).reduce((e, t) => m(t) ? e + (t.type === "td" || t.type === "th" ? 1 : v(t.props.children)) : e, 0), j = (r) => {
7
+ }, m = (r) => B(r), h = (r) => f.toArray(r).reduce((e, t) => m(t) ? e + (t.type === "td" || t.type === "th" ? 1 : h(t.props.children)) : e, 0), w = (r) => {
8
8
  for (const e of f.toArray(r)) {
9
9
  if (!m(e)) continue;
10
- if (e.type === "tr") return v(e.props.children);
11
- const t = j(e.props.children);
10
+ if (e.type === "tr") return h(e.props.children);
11
+ const t = w(e.props.children);
12
12
  if (t !== null) return t;
13
13
  }
14
14
  return null;
15
- }, w = (r, e) => f.map(r, (t) => {
15
+ }, E = (r, e) => f.map(r, (t) => {
16
16
  if (!m(t)) return t;
17
- let s = t.props.children === void 0 ? t.props.children : w(t.props.children, e), n;
17
+ let s = t.props.children === void 0 ? t.props.children : E(t.props.children, e), n;
18
18
  return t.type === "td" && t.props["data-span"] === "all" && (n = {
19
19
  colSpan: e
20
- }), t.type === "th" && t.props["data-type"] && (s = /* @__PURE__ */ I("span", { className: h.sortable, children: [
20
+ }), t.type === "th" && t.props["data-type"] && (s = /* @__PURE__ */ D("span", { className: v.sortable, children: [
21
21
  s,
22
- /* @__PURE__ */ _(H, { "aria-hidden": "true", name: "updown", variant: "primary" })
23
- ] })), n || s !== t.props.children ? q(t, n, s) : t;
22
+ /* @__PURE__ */ _(H, { name: "updown", variant: "primary" })
23
+ ] })), n || s !== t.props.children ? T(t, n, s) : t;
24
24
  }), G = (r, e, t, s, n = 1) => {
25
25
  if (t === "text")
26
26
  return r.localeCompare(e, s, {
27
27
  sensitivity: "base"
28
28
  }) * n;
29
- const i = t === "date" ? Date.parse(r) : Number.parseFloat(r), l = t === "date" ? Date.parse(e) : Number.parseFloat(e);
30
- return Number.isNaN(i) && Number.isNaN(l) ? 0 : Number.isNaN(i) ? 1 : Number.isNaN(l) ? -1 : (i - l) * n;
29
+ const l = t === "date" ? Date.parse(r) : Number.parseFloat(r), i = t === "date" ? Date.parse(e) : Number.parseFloat(e);
30
+ return Number.isNaN(l) && Number.isNaN(i) ? 0 : Number.isNaN(l) ? 1 : Number.isNaN(i) ? -1 : (l - i) * n;
31
31
  }, M = ({
32
32
  children: r,
33
33
  locale: e,
34
34
  ...t
35
35
  }) => {
36
- const s = R(null), n = j(r), i = n && n > 0 ? w(r, n) : r, l = (u, c, o) => {
36
+ const s = I(null), n = w(r), l = n && n > 0 ? E(r, n) : r, i = (u, c, o) => {
37
37
  u.querySelectorAll("th[data-type]").forEach((a) => {
38
38
  a === c ? (a.dataset.dir = o, a.setAttribute("aria-sort", o === "asc" ? "ascending" : "descending")) : (delete a.dataset.dir, a.setAttribute("aria-sort", "none"));
39
39
  });
40
- }, E = T((u) => {
40
+ }, S = R((u) => {
41
41
  var C, x;
42
42
  const c = s.current;
43
43
  if (!c) return;
@@ -52,15 +52,15 @@ import '../../assets/index3.css';const P = "_table_18uji_1", V = "_sortable_18uj
52
52
  const b = o.getAttribute("data-type");
53
53
  if (!b) return;
54
54
  const N = o.dataset.dir === "asc" ? "desc" : "asc";
55
- l(p, o, N);
56
- const S = N === "asc" ? 1 : -1, y = Array.from(d.rows);
57
- y.sort((F, k) => {
58
- var A, g;
59
- const z = (((A = F.cells[a]) == null ? void 0 : A.textContent) ?? "").trim(), D = (((g = k.cells[a]) == null ? void 0 : g.textContent) ?? "").trim();
60
- return G(z, D, b, e, S);
55
+ i(p, o, N);
56
+ const q = N === "asc" ? 1 : -1, y = Array.from(d.rows);
57
+ y.sort((F, j) => {
58
+ var g, A;
59
+ const k = (((g = F.cells[a]) == null ? void 0 : g.textContent) ?? "").trim(), z = (((A = j.cells[a]) == null ? void 0 : A.textContent) ?? "").trim();
60
+ return G(k, z, b, e, q);
61
61
  }), d.append(...y);
62
62
  }, [e]);
63
- return /* @__PURE__ */ _("table", { className: h.table, onClick: E, ref: s, ...t, "data-component": "table", children: i });
63
+ return /* @__PURE__ */ _("table", { className: v.table, onClick: S, ref: s, ...t, "data-component": "table", children: l });
64
64
  };
65
65
  export {
66
66
  M as Table
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/table/index.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, useCallback, useRef } from 'react';\n\nimport { Icon } from '../icon';\nimport styles from './styles.module.css';\n\nexport type TableProps = React.TableHTMLAttributes<HTMLTableElement> & {\n children?: React.ReactNode;\n locale?: string | string[];\n};\n\ntype SortType = 'date' | 'number' | 'text';\n\ntype TableChildProps = {\n children?: React.ReactNode;\n colSpan?: number;\n 'data-span'?: string;\n 'data-type'?: SortType;\n};\n\nconst isTableElement = (child: React.ReactNode): child is React.ReactElement<TableChildProps> =>\n isValidElement<TableChildProps>(child);\n\nconst countCells = (children: React.ReactNode): number =>\n Children.toArray(children).reduce<number>((count, child) => {\n if (!isTableElement(child)) return count;\n return (\n count + (child.type === 'td' || child.type === 'th' ? 1 : countCells(child.props.children))\n );\n }, 0);\n\nconst getFirstRowCellCount = (children: React.ReactNode): number | null => {\n for (const child of Children.toArray(children)) {\n if (!isTableElement(child)) continue;\n\n if (child.type === 'tr') return countCells(child.props.children);\n\n const nestedCount = getFirstRowCellCount(child.props.children);\n if (nestedCount !== null) return nestedCount;\n }\n\n return null;\n};\n\nconst normalizeChildren = (children: React.ReactNode, columnCount: number): React.ReactNode =>\n Children.map(children, (child) => {\n if (!isTableElement(child)) return child;\n\n let nextChildren =\n child.props.children === undefined\n ? child.props.children\n : normalizeChildren(child.props.children, columnCount);\n let nextProps: Partial<TableChildProps> | undefined;\n\n if (child.type === 'td' && child.props['data-span'] === 'all') {\n nextProps = { colSpan: columnCount };\n }\n\n if (child.type === 'th' && child.props['data-type']) {\n nextChildren = (\n <span className={styles.sortable}>\n {nextChildren}\n <Icon\n aria-hidden='true'\n name='updown'\n variant='primary'\n />\n </span>\n );\n }\n\n return nextProps || nextChildren !== child.props.children\n ? cloneElement(child, nextProps, nextChildren)\n : child;\n });\n\n/**\n * Sortable columns must provide data-type (text, number, or date) in the `th` element.\n */\n\nconst compare = (a: string, b: string, type: SortType, locale?: string | string[], dir = 1) => {\n if (type === 'text') {\n return a.localeCompare(b, locale, { sensitivity: 'base' }) * dir;\n }\n\n const left = type === 'date' ? Date.parse(a) : Number.parseFloat(a);\n const right = type === 'date' ? Date.parse(b) : Number.parseFloat(b);\n\n if (Number.isNaN(left) && Number.isNaN(right)) return 0;\n if (Number.isNaN(left)) return 1;\n if (Number.isNaN(right)) return -1;\n return (left - right) * dir;\n};\n\nexport const Table = ({ children, locale, ...props }: TableProps) => {\n const ref = useRef<HTMLTableElement | null>(null);\n const columnCount = getFirstRowCellCount(children);\n const normalizedChildren =\n columnCount && columnCount > 0 ? normalizeChildren(children, columnCount) : children;\n\n const setSortState = (\n thead: HTMLTableSectionElement,\n active: HTMLTableCellElement,\n dir: 'asc' | 'desc'\n ) => {\n const ths = thead.querySelectorAll<HTMLTableCellElement>('th[data-type]');\n\n ths.forEach((th) => {\n if (th === active) {\n th.dataset.dir = dir;\n th.setAttribute('aria-sort', dir === 'asc' ? 'ascending' : 'descending');\n } else {\n delete th.dataset.dir;\n th.setAttribute('aria-sort', 'none');\n }\n });\n };\n\n const onClick = useCallback(\n (e: React.MouseEvent<HTMLTableElement>) => {\n const table = ref.current;\n if (!table) return;\n\n const th = (e.target as HTMLElement | null)?.closest('th');\n if (!th) return;\n\n const thead = table.tHead;\n if (!thead || !thead.contains(th)) return;\n\n const col = th.cellIndex;\n if (col < 0) return;\n\n const tbody = table.tBodies?.[0];\n if (!tbody) return;\n\n const type = th.getAttribute('data-type') as SortType | null;\n if (!type) return;\n\n const direction = th.dataset.dir === 'asc' ? 'desc' : 'asc';\n setSortState(thead, th, direction);\n const dir = direction === 'asc' ? 1 : -1;\n\n const rows = Array.from(tbody.rows);\n\n rows.sort((a, b) => {\n const av = (a.cells[col]?.textContent ?? '').trim();\n const bv = (b.cells[col]?.textContent ?? '').trim();\n return compare(av, bv, type, locale, dir);\n });\n\n tbody.append(...rows);\n },\n [locale]\n );\n\n return (\n <table\n className={styles.table}\n onClick={onClick}\n ref={ref}\n {...props}\n >\n {normalizedChildren}\n </table>\n );\n};\n"],"names":["isTableElement","child","isValidElement","countCells","children","Children","toArray","reduce","count","type","props","getFirstRowCellCount","nestedCount","normalizeChildren","columnCount","map","nextChildren","undefined","nextProps","colSpan","jsxs","styles","sortable","Icon","cloneElement","compare","a","b","locale","dir","localeCompare","sensitivity","left","Date","parse","Number","parseFloat","right","isNaN","Table","ref","useRef","normalizedChildren","setSortState","thead","active","ths","querySelectorAll","forEach","th","dataset","setAttribute","onClick","useCallback","e","table","current","target","closest","tHead","contains","col","cellIndex","tbody","tBodies","getAttribute","direction","rows","Array","from","sort","av","cells","textContent","trim","bv","append","jsx"],"mappings":";;;;;;GAmBMA,IAAiBA,CAACC,MACtBC,EAAgCD,CAAK,GAEjCE,IAAaA,CAACC,MAClBC,EAASC,QAAQF,CAAQ,EAAEG,OAAe,CAACC,GAAOP,MAC3CD,EAAeC,CAAK,IAEvBO,KAASP,EAAMQ,SAAS,QAAQR,EAAMQ,SAAS,OAAO,IAAIN,EAAWF,EAAMS,MAAMN,QAAQ,KAFxDI,GAIlC,CAAC,GAEAG,IAAuBA,CAACP,MAA6C;AACzE,aAAWH,KAASI,EAASC,QAAQF,CAAQ,GAAG;AAC9C,QAAI,CAACJ,EAAeC,CAAK,EAAG;AAE5B,QAAIA,EAAMQ,SAAS,aAAaN,EAAWF,EAAMS,MAAMN,QAAQ;AAE/D,UAAMQ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ElCA,IAAAA,EAAKG,KAAK,CAAC5C,GAAGC,MAAM;;AAClB,YAAM4C,OAAM7C,IAAAA,EAAE8C,MAAMX,CAAG,MAAXnC,gBAAAA,EAAc+C,gBAAe,IAAIC,KAAAA,GACvCC,OAAMhD,IAAAA,EAAE6C,MAAMX,CAAG,MAAXlC,gBAAAA,EAAc8C,gBAAe,IAAIC,KAAAA;AAC7C,aAAOjD,EAAQ8C,GAAII,GAAIlE,GAAMmB,GAAQC,CAAG;AAAA,IAC1C,CAAC,GAEDkC,EAAMa,OAAO,GAAGT,CAAI;AAAA,EACtB,GACA,CAACvC,CAAM,CACT;AAEA,SACE,gBAAAiD,EAAC,SAAA,EACC,WAAWxD,EAAOkC,OAClB,SAAAH,GACA,KAAAZ,GACA,GAAI9B,GAAM,kBAAA,SAETgC,UAAAA,EAAAA,CACH;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/table/index.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, useCallback, useRef } from 'react';\n\nimport { Icon } from '../icon';\nimport styles from './styles.module.css';\n\nexport type TableProps = React.TableHTMLAttributes<HTMLTableElement> & {\n children?: React.ReactNode;\n locale?: string | string[];\n};\n\ntype SortType = 'date' | 'number' | 'text';\n\ntype TableChildProps = {\n children?: React.ReactNode;\n colSpan?: number;\n 'data-span'?: string;\n 'data-type'?: SortType;\n};\n\nconst isTableElement = (child: React.ReactNode): child is React.ReactElement<TableChildProps> =>\n isValidElement<TableChildProps>(child);\n\nconst countCells = (children: React.ReactNode): number =>\n Children.toArray(children).reduce<number>((count, child) => {\n if (!isTableElement(child)) return count;\n return (\n count + (child.type === 'td' || child.type === 'th' ? 1 : countCells(child.props.children))\n );\n }, 0);\n\nconst getFirstRowCellCount = (children: React.ReactNode): number | null => {\n for (const child of Children.toArray(children)) {\n if (!isTableElement(child)) continue;\n\n if (child.type === 'tr') return countCells(child.props.children);\n\n const nestedCount = getFirstRowCellCount(child.props.children);\n if (nestedCount !== null) return nestedCount;\n }\n\n return null;\n};\n\nconst normalizeChildren = (children: React.ReactNode, columnCount: number): React.ReactNode =>\n Children.map(children, (child) => {\n if (!isTableElement(child)) return child;\n\n let nextChildren =\n child.props.children === undefined\n ? child.props.children\n : normalizeChildren(child.props.children, columnCount);\n let nextProps: Partial<TableChildProps> | undefined;\n\n if (child.type === 'td' && child.props['data-span'] === 'all') {\n nextProps = { colSpan: columnCount };\n }\n\n if (child.type === 'th' && child.props['data-type']) {\n nextChildren = (\n <span className={styles.sortable}>\n {nextChildren}\n <Icon\n name='updown'\n variant='primary'\n />\n </span>\n );\n }\n\n return nextProps || nextChildren !== child.props.children\n ? cloneElement(child, nextProps, nextChildren)\n : child;\n });\n\n/**\n * Sortable columns must provide data-type (text, number, or date) in the `th` element.\n */\n\nconst compare = (a: string, b: string, type: SortType, locale?: string | string[], dir = 1) => {\n if (type === 'text') {\n return a.localeCompare(b, locale, { sensitivity: 'base' }) * dir;\n }\n\n const left = type === 'date' ? Date.parse(a) : Number.parseFloat(a);\n const right = type === 'date' ? Date.parse(b) : Number.parseFloat(b);\n\n if (Number.isNaN(left) && Number.isNaN(right)) return 0;\n if (Number.isNaN(left)) return 1;\n if (Number.isNaN(right)) return -1;\n return (left - right) * dir;\n};\n\nexport const Table = ({ children, locale, ...props }: TableProps) => {\n const ref = useRef<HTMLTableElement | null>(null);\n const columnCount = getFirstRowCellCount(children);\n const normalizedChildren =\n columnCount && columnCount > 0 ? normalizeChildren(children, columnCount) : children;\n\n const setSortState = (\n thead: HTMLTableSectionElement,\n active: HTMLTableCellElement,\n dir: 'asc' | 'desc'\n ) => {\n const ths = thead.querySelectorAll<HTMLTableCellElement>('th[data-type]');\n\n ths.forEach((th) => {\n if (th === active) {\n th.dataset.dir = dir;\n th.setAttribute('aria-sort', dir === 'asc' ? 'ascending' : 'descending');\n } else {\n delete th.dataset.dir;\n th.setAttribute('aria-sort', 'none');\n }\n });\n };\n\n const onClick = useCallback(\n (e: React.MouseEvent<HTMLTableElement>) => {\n const table = ref.current;\n if (!table) return;\n\n const th = (e.target as HTMLElement | null)?.closest('th');\n if (!th) return;\n\n const thead = table.tHead;\n if (!thead || !thead.contains(th)) return;\n\n const col = th.cellIndex;\n if (col < 0) return;\n\n const tbody = table.tBodies?.[0];\n if (!tbody) return;\n\n const type = th.getAttribute('data-type') as SortType | null;\n if (!type) return;\n\n const direction = th.dataset.dir === 'asc' ? 'desc' : 'asc';\n setSortState(thead, th, direction);\n const dir = direction === 'asc' ? 1 : -1;\n\n const rows = Array.from(tbody.rows);\n\n rows.sort((a, b) => {\n const av = (a.cells[col]?.textContent ?? '').trim();\n const bv = (b.cells[col]?.textContent ?? '').trim();\n return compare(av, bv, type, locale, dir);\n });\n\n tbody.append(...rows);\n },\n [locale]\n );\n\n return (\n <table\n className={styles.table}\n onClick={onClick}\n ref={ref}\n {...props}\n >\n {normalizedChildren}\n </table>\n );\n};\n"],"names":["isTableElement","child","isValidElement","countCells","children","Children","toArray","reduce","count","type","props","getFirstRowCellCount","nestedCount","normalizeChildren","columnCount","map","nextChildren","undefined","nextProps","colSpan","jsxs","styles","sortable","jsx","Icon","cloneElement","compare","a","b","locale","dir","localeCompare","sensitivity","left","Date","parse","Number","parseFloat","right","isNaN","Table","ref","useRef","normalizedChildren","setSortState","thead","active","ths","querySelectorAll","forEach","th","dataset","setAttribute","onClick","useCallback","e","table","current","target","closest","tHead","contains","col","cellIndex","tbody","tBodies","getAttribute","direction","rows","Array","from","sort","av","cells","textContent","trim","bv","append"],"mappings":";;;;;;GAmBMA,IAAiBA,CAACC,MACtBC,EAAgCD,CAAK,GAEjCE,IAAaA,CAACC,MAClBC,EAASC,QAAQF,CAAQ,EAAEG,OAAe,CAACC,GAAOP,MAC3CD,EAAeC,CAAK,IAEvBO,KAASP,EAAMQ,SAAS,QAAQR,EAAMQ,SAAS,OAAO,IAAIN,EAAWF,EAAMS,MAAMN,QAAQ,KAFxDI,GAIlC,CAAC,GAEAG,IAAuBA,CAACP,MAA6C;AACzE,aA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QrB,QAAQ,QAAQ,SAAS;AACtDc,IAAAA,EAAaC,GAAOK,GAAIiB,CAAS;AACjC,UAAMrC,IAAMqC,MAAc,QAAQ,IAAI,IAEhCC,IAAOC,MAAMC,KAAKN,EAAMI,IAAI;AAElCA,IAAAA,EAAKG,KAAK,CAAC5C,GAAGC,MAAM;;AAClB,YAAM4C,OAAM7C,IAAAA,EAAE8C,MAAMX,CAAG,MAAXnC,gBAAAA,EAAc+C,gBAAe,IAAIC,KAAAA,GACvCC,OAAMhD,IAAAA,EAAE6C,MAAMX,CAAG,MAAXlC,gBAAAA,EAAc8C,gBAAe,IAAIC,KAAAA;AAC7C,aAAOjD,EAAQ8C,GAAII,GAAInE,GAAMoB,GAAQC,CAAG;AAAA,IAC1C,CAAC,GAEDkC,EAAMa,OAAO,GAAGT,CAAI;AAAA,EACtB,GACA,CAACvC,CAAM,CACT;AAEA,SACE,gBAAAN,EAAC,SAAA,EACC,WAAWF,EAAOmC,OAClB,SAAAH,GACA,KAAAZ,GACA,GAAI/B,GAAM,kBAAA,SAETiC,UAAAA,EAAAA,CACH;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index43.css');const e=require("react/jsx-runtime"),i=require("../../classix-5H4IWnMA.cjs"),x=require("../../utils-DBzf7CFq.cjs"),l=require("../../styles.module-Vt6mmlsz.cjs"),d="_textarea_b5yys_5",y={textarea:d},m=({label:t,maxRows:r=12,minRows:a=3,required:n,value:s,...o})=>{const{touched:c,onBlur:u}=x.useTouched(s==="");return e.jsxs("label",{"data-component":"textarea",children:[t&&e.jsx("span",{children:t}),e.jsx("textarea",{className:i.t(l.inputStyles.input,y.textarea,c&&"touched"),onBlur:u,...o,required:n,style:{"--min-rows":a,"--max-rows":r},value:s})]})};exports.Textarea=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index42.css');const e=require("react/jsx-runtime"),n=require("../../classix-5H4IWnMA.cjs"),x=require("../../utils-DBzf7CFq.cjs"),t=require("../../styles.module-BPvMQa_x.cjs"),d="_textarea_19s8w_5",m={textarea:d},y=({label:s,maxRows:o=12,minRows:c=3,required:r,value:a,...u})=>{const{touched:i,onBlur:l}=x.useTouched(a==="");return e.jsxs("label",{"data-component":"textarea",children:[s&&e.jsx("span",{className:n.t(r&&t.inputStyles.required),children:s}),e.jsx("textarea",{className:n.t(t.inputStyles.input,m.textarea,i&&t.inputStyles.touched),onBlur:l,...u,required:r,style:{"--min-rows":c,"--max-rows":o},value:a})]})};exports.Textarea=y;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/textarea/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { useTouched } from '@/utils.ts';\n\nimport inputStyles from '../input/styles.module.css';\nimport styles from './styles.module.css';\n\nexport type TextareaProps = Omit<React.ComponentPropsWithoutRef<'textarea'>, 'children'> & {\n label?: string;\n maxRows?: number;\n minRows?: number;\n};\n\nexport const Textarea = ({\n label,\n maxRows = 12,\n minRows = 3,\n required,\n value,\n ...props\n}: TextareaProps) => {\n const { touched, onBlur } = useTouched(value === '');\n\n return (\n <label>\n {label && <span>{label}</span>}\n <textarea\n className={cx(inputStyles.input, styles.textarea, touched && 'touched')}\n onBlur={onBlur}\n {...props}\n required={required}\n style={\n {\n '--min-rows': minRows,\n '--max-rows': maxRows,\n } as React.CSSProperties\n }\n value={value}\n />\n </label>\n );\n};\n"],"names":["Textarea","label","maxRows","minRows","required","value","props","touched","onBlur","useTouched","jsxs","jsx","cx","inputStyles","input","styles","textarea"],"mappings":"sRAaaA,EAAWA,CAAC,CACvBC,MAAAA,EACAC,QAAAA,EAAU,GACVC,QAAAA,EAAU,EACVC,SAAAA,EACAC,MAAAA,EACA,GAAGC,CACU,IAAM,CACnB,KAAM,CAAEC,QAAAA,EAASC,OAAAA,CAAAA,EAAWC,EAAAA,WAAWJ,IAAU,EAAE,EAEnD,OACEK,EAAAA,KAAC,QAAA,CAAK,iBAAA,WACHT,SAAAA,CAAAA,GAASU,EAAAA,IAAC,QAAMV,SAAAA,CAAAA,CAAM,EACvBU,EAAAA,IAAC,WAAA,CACC,UAAWC,EAAAA,EAAGC,EAAAA,YAAYC,MAAOC,EAAOC,SAAUT,GAAW,SAAS,EACtE,OAAAC,KACIF,EACJ,SAAAF,EACA,MACE,CACE,aAAcD,EACd,aAAcD,CAAAA,EAGlB,MAAAG,CAAA,CAAa,CAAA,EAEjB,CAEJ"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/textarea/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { useTouched } from '@/utils.ts';\n\nimport inputStyles from '../input/styles.module.css';\nimport styles from './styles.module.css';\n\nexport type TextareaProps = Omit<React.ComponentPropsWithoutRef<'textarea'>, 'children'> & {\n label?: string;\n maxRows?: number;\n minRows?: number;\n};\n\nexport const Textarea = ({\n label,\n maxRows = 12,\n minRows = 3,\n required,\n value,\n ...props\n}: TextareaProps) => {\n const { touched, onBlur } = useTouched(value === '');\n\n return (\n <label>\n {label && <span className={cx(required && inputStyles.required)}>{label}</span>}\n <textarea\n className={cx(inputStyles.input, styles.textarea, touched && inputStyles.touched)}\n onBlur={onBlur}\n {...props}\n required={required}\n style={\n {\n '--min-rows': minRows,\n '--max-rows': maxRows,\n } as React.CSSProperties\n }\n value={value}\n />\n </label>\n );\n};\n"],"names":["Textarea","label","maxRows","minRows","required","value","props","touched","onBlur","useTouched","jsxs","jsx","cx","inputStyles","input","styles","textarea"],"mappings":"sRAaaA,EAAWA,CAAC,CACvBC,MAAAA,EACAC,QAAAA,EAAU,GACVC,QAAAA,EAAU,EACVC,SAAAA,EACAC,MAAAA,EACA,GAAGC,CACU,IAAM,CACnB,KAAM,CAAEC,QAAAA,EAASC,OAAAA,CAAAA,EAAWC,EAAAA,WAAWJ,IAAU,EAAE,EAEnD,OACEK,EAAAA,KAAC,QAAA,CAAK,iBAAA,WACHT,SAAAA,CAAAA,GAASU,EAAAA,IAAC,QAAK,UAAWC,EAAAA,EAAGR,GAAYS,EAAAA,YAAYT,QAAQ,EAAIH,SAAAA,CAAAA,CAAM,QACvE,WAAA,CACC,UAAWW,EAAAA,EAAGC,EAAAA,YAAYC,MAAOC,EAAOC,SAAUT,GAAWM,EAAAA,YAAYN,OAAO,EAChF,OAAAC,EACA,GAAIF,EACJ,SAAAF,EACA,MACE,CACE,aAAcD,EACd,aAAcD,CAAAA,EAGlB,MAAAG,CAAA,CAAa,CAAA,EAEjB,CAEJ"}
@@ -1,30 +1,30 @@
1
- import { jsxs as x, jsx as r } from "react/jsx-runtime";
2
- import { t as i } from "../../classix-DG18itHa.js";
3
- import { u as p } from "../../utils--n2yqjCy.js";
4
- import { i as u } from "../../styles.module-DZXAP_eP.js";
5
- import '../../assets/index43.css';const d = "_textarea_b5yys_5", l = {
6
- textarea: d
7
- }, j = ({
8
- label: t,
9
- maxRows: a = 12,
10
- minRows: o = 3,
11
- required: s,
12
- value: e,
13
- ...n
1
+ import { jsxs as p, jsx as s } from "react/jsx-runtime";
2
+ import { t as o } from "../../classix-DG18itHa.js";
3
+ import { u } from "../../utils--n2yqjCy.js";
4
+ import { i as t } from "../../styles.module-BOTEBJ0C.js";
5
+ import '../../assets/index42.css';const l = "_textarea_19s8w_5", d = {
6
+ textarea: l
7
+ }, _ = ({
8
+ label: e,
9
+ maxRows: n = 12,
10
+ minRows: m = 3,
11
+ required: a,
12
+ value: r,
13
+ ...c
14
14
  }) => {
15
15
  const {
16
- touched: m,
17
- onBlur: c
18
- } = p(e === "");
19
- return /* @__PURE__ */ x("label", { "data-component": "textarea", children: [
20
- t && /* @__PURE__ */ r("span", { children: t }),
21
- /* @__PURE__ */ r("textarea", { className: i(u.input, l.textarea, m && "touched"), onBlur: c, ...n, required: s, style: {
22
- "--min-rows": o,
23
- "--max-rows": a
24
- }, value: e })
16
+ touched: x,
17
+ onBlur: i
18
+ } = u(r === "");
19
+ return /* @__PURE__ */ p("label", { "data-component": "textarea", children: [
20
+ e && /* @__PURE__ */ s("span", { className: o(a && t.required), children: e }),
21
+ /* @__PURE__ */ s("textarea", { className: o(t.input, d.textarea, x && t.touched), onBlur: i, ...c, required: a, style: {
22
+ "--min-rows": m,
23
+ "--max-rows": n
24
+ }, value: r })
25
25
  ] });
26
26
  };
27
27
  export {
28
- j as Textarea
28
+ _ as Textarea
29
29
  };
30
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/textarea/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { useTouched } from '@/utils.ts';\n\nimport inputStyles from '../input/styles.module.css';\nimport styles from './styles.module.css';\n\nexport type TextareaProps = Omit<React.ComponentPropsWithoutRef<'textarea'>, 'children'> & {\n label?: string;\n maxRows?: number;\n minRows?: number;\n};\n\nexport const Textarea = ({\n label,\n maxRows = 12,\n minRows = 3,\n required,\n value,\n ...props\n}: TextareaProps) => {\n const { touched, onBlur } = useTouched(value === '');\n\n return (\n <label>\n {label && <span>{label}</span>}\n <textarea\n className={cx(inputStyles.input, styles.textarea, touched && 'touched')}\n onBlur={onBlur}\n {...props}\n required={required}\n style={\n {\n '--min-rows': minRows,\n '--max-rows': maxRows,\n } as React.CSSProperties\n }\n value={value}\n />\n </label>\n );\n};\n"],"names":["Textarea","label","maxRows","minRows","required","value","props","touched","onBlur","useTouched","jsxs","jsx","cx","inputStyles","input","styles","textarea"],"mappings":";;;;;;GAaaA,IAAWA,CAAC;AAAA,EACvBC,OAAAA;AAAAA,EACAC,SAAAA,IAAU;AAAA,EACVC,SAAAA,IAAU;AAAA,EACVC,UAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACA,GAAGC;AACU,MAAM;AACnB,QAAM;AAAA,IAAEC,SAAAA;AAAAA,IAASC,QAAAA;AAAAA,EAAAA,IAAWC,EAAWJ,MAAU,EAAE;AAEnD,SACE,gBAAAK,EAAC,SAAA,EAAK,kBAAA,YACHT,UAAAA;AAAAA,IAAAA,KAAS,gBAAAU,EAAC,UAAMV,UAAAA,EAAAA,CAAM;AAAA,IACvB,gBAAAU,EAAC,YAAA,EACC,WAAWC,EAAGC,EAAYC,OAAOC,EAAOC,UAAUT,KAAW,SAAS,GACtE,QAAAC,MACIF,GACJ,UAAAF,GACA,OACE;AAAA,MACE,cAAcD;AAAAA,MACd,cAAcD;AAAAA,IAAAA,GAGlB,OAAAG,EAAA,CAAa;AAAA,EAAA,GAEjB;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/textarea/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { useTouched } from '@/utils.ts';\n\nimport inputStyles from '../input/styles.module.css';\nimport styles from './styles.module.css';\n\nexport type TextareaProps = Omit<React.ComponentPropsWithoutRef<'textarea'>, 'children'> & {\n label?: string;\n maxRows?: number;\n minRows?: number;\n};\n\nexport const Textarea = ({\n label,\n maxRows = 12,\n minRows = 3,\n required,\n value,\n ...props\n}: TextareaProps) => {\n const { touched, onBlur } = useTouched(value === '');\n\n return (\n <label>\n {label && <span className={cx(required && inputStyles.required)}>{label}</span>}\n <textarea\n className={cx(inputStyles.input, styles.textarea, touched && inputStyles.touched)}\n onBlur={onBlur}\n {...props}\n required={required}\n style={\n {\n '--min-rows': minRows,\n '--max-rows': maxRows,\n } as React.CSSProperties\n }\n value={value}\n />\n </label>\n );\n};\n"],"names":["Textarea","label","maxRows","minRows","required","value","props","touched","onBlur","useTouched","jsxs","jsx","cx","inputStyles","input","styles","textarea"],"mappings":";;;;;;GAaaA,IAAWA,CAAC;AAAA,EACvBC,OAAAA;AAAAA,EACAC,SAAAA,IAAU;AAAA,EACVC,SAAAA,IAAU;AAAA,EACVC,UAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACA,GAAGC;AACU,MAAM;AACnB,QAAM;AAAA,IAAEC,SAAAA;AAAAA,IAASC,QAAAA;AAAAA,EAAAA,IAAWC,EAAWJ,MAAU,EAAE;AAEnD,SACE,gBAAAK,EAAC,SAAA,EAAK,kBAAA,YACHT,UAAAA;AAAAA,IAAAA,KAAS,gBAAAU,EAAC,UAAK,WAAWC,EAAGR,KAAYS,EAAYT,QAAQ,GAAIH,UAAAA,EAAAA,CAAM;AAAA,sBACvE,YAAA,EACC,WAAWW,EAAGC,EAAYC,OAAOC,EAAOC,UAAUT,KAAWM,EAAYN,OAAO,GAChF,QAAAC,GACA,GAAIF,GACJ,UAAAF,GACA,OACE;AAAA,MACE,cAAcD;AAAAA,MACd,cAAcD;AAAAA,IAAAA,GAGlB,OAAAG,EAAA,CAAa;AAAA,EAAA,GAEjB;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index44.css');const o=require("react/jsx-runtime"),v=require("../../classix-5H4IWnMA.cjs"),n=require("react"),f=require("../icon/index.cjs"),l="_toast_tav58_1",d="_active_tav58_18",m="_error_tav58_24",q="_info_tav58_28",T="_success_tav58_33",a={toast:l,active:d,error:m,info:q,success:T},g=({label:i,type:s="success",onClick:u,onExitComplete:e,open:r=!0})=>{const[_,c]=n.useState(!1);return n.useEffect(()=>{if(!r)return c(!1);const t=requestAnimationFrame(()=>c(!0));return()=>cancelAnimationFrame(t)},[r]),o.jsxs("div",{"aria-live":s==="error"?"assertive":"polite",className:v.t(a.toast,a[s],_&&a.active),onClick:u,onTransitionEnd:t=>{r||t.propertyName!=="opacity"||t.currentTarget!==t.target||e==null||e()},"data-component":"toast",children:[o.jsx(f.Icon,{name:s}),i]})};exports.Toast=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index43.css');const o=require("react/jsx-runtime"),l=require("../../classix-5H4IWnMA.cjs"),n=require("react"),q=require("../icon/index.cjs"),d="_toast_12yql_1",f="_active_12yql_21",m="_error_12yql_27",y="_success_12yql_36",c={toast:d,active:f,error:m,success:y},v=({label:i,type:t="success",onClick:u,onExitComplete:e,open:r=!0})=>{const[_,a]=n.useState(!1);return n.useEffect(()=>{if(!r)return a(!1);const s=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(s)},[r]),o.jsxs("div",{"aria-live":t==="error"?"assertive":"polite",className:l.t(c.toast,c[t],_&&c.active),onClick:u,onTransitionEnd:s=>{r||s.propertyName!=="opacity"||s.currentTarget!==s.target||e==null||e()},"data-component":"toast",children:[o.jsx(q.Icon,{name:t}),i]})};exports.Toast=v;
2
2
  //# sourceMappingURL=index.cjs.map