@solibo/solibo-ui 2.1.2 → 2.2.1

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 (293) hide show
  1. package/dist/assets/Degular.woff2 +0 -0
  2. package/dist/assets/Geist.woff2 +0 -0
  3. package/dist/assets/index.css +1 -1
  4. package/dist/assets/index10.css +1 -1
  5. package/dist/assets/index11.css +1 -1
  6. package/dist/assets/index12.css +1 -1
  7. package/dist/assets/index13.css +1 -1
  8. package/dist/assets/index14.css +1 -1
  9. package/dist/assets/index15.css +1 -1
  10. package/dist/assets/index16.css +1 -1
  11. package/dist/assets/index17.css +1 -1
  12. package/dist/assets/index18.css +1 -1
  13. package/dist/assets/index19.css +1 -1
  14. package/dist/assets/index2.css +1 -1
  15. package/dist/assets/index20.css +1 -0
  16. package/dist/assets/index21.css +1 -1
  17. package/dist/assets/index22.css +1 -1
  18. package/dist/assets/index23.css +1 -1
  19. package/dist/assets/index26.css +1 -1
  20. package/dist/assets/index27.css +1 -1
  21. package/dist/assets/index28.css +1 -1
  22. package/dist/assets/index3.css +1 -1
  23. package/dist/assets/index31.css +1 -1
  24. package/dist/assets/index32.css +1 -1
  25. package/dist/assets/index33.css +1 -1
  26. package/dist/assets/index34.css +1 -1
  27. package/dist/assets/index38.css +1 -1
  28. package/dist/assets/index39.css +1 -1
  29. package/dist/assets/index41.css +1 -1
  30. package/dist/assets/index43.css +1 -1
  31. package/dist/assets/index46.css +1 -1
  32. package/dist/assets/index48.css +1 -1
  33. package/dist/assets/index49.css +1 -1
  34. package/dist/assets/index50.css +1 -1
  35. package/dist/assets/index51.css +1 -1
  36. package/dist/assets/index52.css +1 -1
  37. package/dist/assets/index53.css +1 -1
  38. package/dist/assets/index54.css +1 -1
  39. package/dist/assets/index55.css +1 -1
  40. package/dist/assets/index56.css +1 -0
  41. package/dist/assets/index6.css +1 -1
  42. package/dist/assets/index8.css +1 -1
  43. package/dist/assets/index9.css +1 -1
  44. package/dist/assets/menu-popover.css +1 -1
  45. package/dist/components/app-link/index.cjs +1 -1
  46. package/dist/components/app-link/index.js +1 -1
  47. package/dist/components/app-shell/index.cjs +1 -1
  48. package/dist/components/app-shell/index.js +3 -3
  49. package/dist/components/aside/index.cjs +1 -1
  50. package/dist/components/aside/index.js +5 -5
  51. package/dist/components/avatar/index.cjs +1 -1
  52. package/dist/components/avatar/index.js +30 -30
  53. package/dist/components/badge/index.cjs +1 -1
  54. package/dist/components/badge/index.js +41 -39
  55. package/dist/components/banner/index.cjs +1 -1
  56. package/dist/components/banner/index.js +4 -4
  57. package/dist/components/branding/index.cjs +1 -1
  58. package/dist/components/branding/index.js +2 -2
  59. package/dist/components/button/index.cjs +1 -1
  60. package/dist/components/button/index.js +29 -29
  61. package/dist/components/card/index.cjs +1 -1
  62. package/dist/components/card/index.js +57 -49
  63. package/dist/components/checkbox/index.cjs +1 -1
  64. package/dist/components/checkbox/index.js +5 -5
  65. package/dist/components/chip/index.cjs +1 -1
  66. package/dist/components/chip/index.js +25 -25
  67. package/dist/components/collapsible/index.cjs +1 -1
  68. package/dist/components/collapsible/index.js +34 -18
  69. package/dist/components/controls/index.cjs +2 -2
  70. package/dist/components/controls/index.js +11 -11
  71. package/dist/components/croppable/index.cjs +1 -1
  72. package/dist/components/croppable/index.js +269 -233
  73. package/dist/components/dialog/index.cjs +1 -1
  74. package/dist/components/dialog/index.js +38 -38
  75. package/dist/components/divider/index.cjs +1 -1
  76. package/dist/components/divider/index.js +3 -3
  77. package/dist/components/dropdown/index.cjs +1 -1
  78. package/dist/components/dropdown/index.js +90 -90
  79. package/dist/components/dropzone/index.cjs +1 -1
  80. package/dist/components/dropzone/index.js +11 -11
  81. package/dist/components/editor/index.cjs +1 -55
  82. package/dist/components/editor/index.js +403 -16299
  83. package/dist/components/fieldset/index.cjs +1 -1
  84. package/dist/components/fieldset/index.js +3 -3
  85. package/dist/components/figure/index.cjs +1 -1
  86. package/dist/components/figure/index.js +14 -12
  87. package/dist/components/file/index.cjs +1 -1
  88. package/dist/components/file/index.js +1 -1
  89. package/dist/components/footer/index.cjs +1 -1
  90. package/dist/components/footer/index.js +12 -8
  91. package/dist/components/form/index.cjs +1 -1
  92. package/dist/components/form/index.js +9 -9
  93. package/dist/components/graph/index.cjs +1 -1
  94. package/dist/components/graph/index.js +12 -12
  95. package/dist/components/group/index.cjs +1 -1
  96. package/dist/components/group/index.js +38 -11
  97. package/dist/components/header/index.cjs +1 -1
  98. package/dist/components/header/index.js +49 -32
  99. package/dist/components/icon/index.cjs +1 -1
  100. package/dist/components/icon/index.js +7 -7
  101. package/dist/components/iframe/index.cjs +1 -1
  102. package/dist/components/iframe/index.js +71 -66
  103. package/dist/components/image/index.cjs +1 -1
  104. package/dist/components/image/index.js +1 -1
  105. package/dist/components/input/index.cjs +1 -1
  106. package/dist/components/input/index.js +3 -3
  107. package/dist/components/link/index.cjs +1 -1
  108. package/dist/components/link/index.js +27 -14
  109. package/dist/components/list/index.cjs +1 -1
  110. package/dist/components/list/index.js +62 -58
  111. package/dist/components/loading/index.cjs +1 -1
  112. package/dist/components/loading/index.js +5 -5
  113. package/dist/components/menu/index.cjs +1 -1
  114. package/dist/components/menu/index.js +1 -1
  115. package/dist/components/message/index.cjs +1 -1
  116. package/dist/components/message/index.js +2 -2
  117. package/dist/components/messages/index.cjs +1 -1
  118. package/dist/components/messages/index.js +6 -6
  119. package/dist/components/nav/index.cjs +1 -1
  120. package/dist/components/nav/index.js +31 -29
  121. package/dist/components/object/index.cjs +1 -1
  122. package/dist/components/object/index.js +1 -1
  123. package/dist/components/page-layout/index.cjs +1 -1
  124. package/dist/components/page-layout/index.js +33 -20
  125. package/dist/components/panel/index.cjs +2 -0
  126. package/dist/components/panel/index.js +25 -0
  127. package/dist/components/popover/index.cjs +1 -1
  128. package/dist/components/popover/index.js +35 -35
  129. package/dist/components/portal/index.cjs +1 -1
  130. package/dist/components/portal/index.js +22 -22
  131. package/dist/components/search/index.cjs +1 -1
  132. package/dist/components/search/index.js +50 -50
  133. package/dist/components/select/index.cjs +1 -1
  134. package/dist/components/select/index.js +3 -3
  135. package/dist/components/sortable/index.cjs +1 -1
  136. package/dist/components/sortable/index.js +49 -49
  137. package/dist/components/textarea/index.cjs +1 -1
  138. package/dist/components/textarea/index.js +29 -27
  139. package/dist/components/toast/index.cjs +1 -1
  140. package/dist/components/toast/index.js +1 -1
  141. package/dist/components/toggle/index.cjs +1 -1
  142. package/dist/components/toggle/index.js +10 -10
  143. package/dist/components/toolbar/index.cjs +1 -1
  144. package/dist/components/toolbar/index.js +3 -3
  145. package/dist/components/tooltip/index.cjs +1 -1
  146. package/dist/components/tooltip/index.js +2 -2
  147. package/dist/components/widget/index.cjs +1 -1
  148. package/dist/components/widget/index.js +22 -13
  149. package/dist/icons-BIdcCH-v.cjs +2 -0
  150. package/dist/{icons-CTtWkF6z.js → icons-DVeBguFb.js} +6 -3
  151. package/dist/index-7blZaPiA.cjs +2 -0
  152. package/dist/{index-CMPTHneU.js → index-Dd20d_9U.js} +9 -9
  153. package/dist/{index-BIpgkB-u.js → index-Dx-KtGBg.js} +12 -12
  154. package/dist/index-VLDsM9it.cjs +2 -0
  155. package/dist/index.cjs +1 -1
  156. package/dist/index.d.ts +391 -17
  157. package/dist/index.js +59 -56
  158. package/dist/menu-popover-Ceb_9V67.js +77 -0
  159. package/dist/menu-popover-bqblnK6P.cjs +2 -0
  160. package/dist/styles/fonts.css +11 -0
  161. package/dist/tokens.json +1 -1
  162. package/package.json +15 -8
  163. package/dist/classix-5H4IWnMA.cjs +0 -2
  164. package/dist/classix-5H4IWnMA.cjs.map +0 -1
  165. package/dist/classix-DG18itHa.js +0 -9
  166. package/dist/classix-DG18itHa.js.map +0 -1
  167. package/dist/components/app-link/index.cjs.map +0 -1
  168. package/dist/components/app-link/index.js.map +0 -1
  169. package/dist/components/app-shell/index.cjs.map +0 -1
  170. package/dist/components/app-shell/index.js.map +0 -1
  171. package/dist/components/aside/index.cjs.map +0 -1
  172. package/dist/components/aside/index.js.map +0 -1
  173. package/dist/components/avatar/index.cjs.map +0 -1
  174. package/dist/components/avatar/index.js.map +0 -1
  175. package/dist/components/badge/index.cjs.map +0 -1
  176. package/dist/components/badge/index.js.map +0 -1
  177. package/dist/components/banner/index.cjs.map +0 -1
  178. package/dist/components/banner/index.js.map +0 -1
  179. package/dist/components/branding/index.cjs.map +0 -1
  180. package/dist/components/branding/index.js.map +0 -1
  181. package/dist/components/button/index.cjs.map +0 -1
  182. package/dist/components/button/index.js.map +0 -1
  183. package/dist/components/card/index.cjs.map +0 -1
  184. package/dist/components/card/index.js.map +0 -1
  185. package/dist/components/checkbox/index.cjs.map +0 -1
  186. package/dist/components/checkbox/index.js.map +0 -1
  187. package/dist/components/chip/index.cjs.map +0 -1
  188. package/dist/components/chip/index.js.map +0 -1
  189. package/dist/components/clipboard/index.cjs.map +0 -1
  190. package/dist/components/clipboard/index.js.map +0 -1
  191. package/dist/components/collapsible/index.cjs.map +0 -1
  192. package/dist/components/collapsible/index.js.map +0 -1
  193. package/dist/components/controls/index.cjs.map +0 -1
  194. package/dist/components/controls/index.js.map +0 -1
  195. package/dist/components/croppable/index.cjs.map +0 -1
  196. package/dist/components/croppable/index.js.map +0 -1
  197. package/dist/components/dialog/index.cjs.map +0 -1
  198. package/dist/components/dialog/index.js.map +0 -1
  199. package/dist/components/divider/index.cjs.map +0 -1
  200. package/dist/components/divider/index.js.map +0 -1
  201. package/dist/components/dropdown/index.cjs.map +0 -1
  202. package/dist/components/dropdown/index.js.map +0 -1
  203. package/dist/components/dropzone/index.cjs.map +0 -1
  204. package/dist/components/dropzone/index.js.map +0 -1
  205. package/dist/components/editor/index.cjs.map +0 -1
  206. package/dist/components/editor/index.js.map +0 -1
  207. package/dist/components/empty-state/index.cjs.map +0 -1
  208. package/dist/components/empty-state/index.js.map +0 -1
  209. package/dist/components/fieldset/index.cjs.map +0 -1
  210. package/dist/components/fieldset/index.js.map +0 -1
  211. package/dist/components/figure/index.cjs.map +0 -1
  212. package/dist/components/figure/index.js.map +0 -1
  213. package/dist/components/file/index.cjs.map +0 -1
  214. package/dist/components/file/index.js.map +0 -1
  215. package/dist/components/footer/index.cjs.map +0 -1
  216. package/dist/components/footer/index.js.map +0 -1
  217. package/dist/components/form/index.cjs.map +0 -1
  218. package/dist/components/form/index.js.map +0 -1
  219. package/dist/components/graph/index.cjs.map +0 -1
  220. package/dist/components/graph/index.js.map +0 -1
  221. package/dist/components/group/index.cjs.map +0 -1
  222. package/dist/components/group/index.js.map +0 -1
  223. package/dist/components/header/index.cjs.map +0 -1
  224. package/dist/components/header/index.js.map +0 -1
  225. package/dist/components/icon/index.cjs.map +0 -1
  226. package/dist/components/icon/index.js.map +0 -1
  227. package/dist/components/iframe/index.cjs.map +0 -1
  228. package/dist/components/iframe/index.js.map +0 -1
  229. package/dist/components/image/index.cjs.map +0 -1
  230. package/dist/components/image/index.js.map +0 -1
  231. package/dist/components/input/index.cjs.map +0 -1
  232. package/dist/components/input/index.js.map +0 -1
  233. package/dist/components/link/index.cjs.map +0 -1
  234. package/dist/components/link/index.js.map +0 -1
  235. package/dist/components/list/index.cjs.map +0 -1
  236. package/dist/components/list/index.js.map +0 -1
  237. package/dist/components/loading/index.cjs.map +0 -1
  238. package/dist/components/loading/index.js.map +0 -1
  239. package/dist/components/menu/index.cjs.map +0 -1
  240. package/dist/components/menu/index.js.map +0 -1
  241. package/dist/components/message/index.cjs.map +0 -1
  242. package/dist/components/message/index.js.map +0 -1
  243. package/dist/components/messages/index.cjs.map +0 -1
  244. package/dist/components/messages/index.js.map +0 -1
  245. package/dist/components/nav/index.cjs.map +0 -1
  246. package/dist/components/nav/index.js.map +0 -1
  247. package/dist/components/object/index.cjs.map +0 -1
  248. package/dist/components/object/index.js.map +0 -1
  249. package/dist/components/page-layout/index.cjs.map +0 -1
  250. package/dist/components/page-layout/index.js.map +0 -1
  251. package/dist/components/popover/index.cjs.map +0 -1
  252. package/dist/components/popover/index.js.map +0 -1
  253. package/dist/components/portal/index.cjs.map +0 -1
  254. package/dist/components/portal/index.js.map +0 -1
  255. package/dist/components/search/index.cjs.map +0 -1
  256. package/dist/components/search/index.js.map +0 -1
  257. package/dist/components/select/index.cjs.map +0 -1
  258. package/dist/components/select/index.js.map +0 -1
  259. package/dist/components/sortable/index.cjs.map +0 -1
  260. package/dist/components/sortable/index.js.map +0 -1
  261. package/dist/components/table/index.cjs.map +0 -1
  262. package/dist/components/table/index.js.map +0 -1
  263. package/dist/components/textarea/index.cjs.map +0 -1
  264. package/dist/components/textarea/index.js.map +0 -1
  265. package/dist/components/toast/index.cjs.map +0 -1
  266. package/dist/components/toast/index.js.map +0 -1
  267. package/dist/components/toasts/index.cjs.map +0 -1
  268. package/dist/components/toasts/index.js.map +0 -1
  269. package/dist/components/toggle/index.cjs.map +0 -1
  270. package/dist/components/toggle/index.js.map +0 -1
  271. package/dist/components/toolbar/index.cjs.map +0 -1
  272. package/dist/components/toolbar/index.js.map +0 -1
  273. package/dist/components/tooltip/index.cjs.map +0 -1
  274. package/dist/components/tooltip/index.js.map +0 -1
  275. package/dist/components/widget/index.cjs.map +0 -1
  276. package/dist/components/widget/index.js.map +0 -1
  277. package/dist/icons-B3hIY9Bm.cjs +0 -2
  278. package/dist/icons-B3hIY9Bm.cjs.map +0 -1
  279. package/dist/icons-CTtWkF6z.js.map +0 -1
  280. package/dist/index-BIpgkB-u.js.map +0 -1
  281. package/dist/index-Bbauu1No.cjs +0 -2
  282. package/dist/index-Bbauu1No.cjs.map +0 -1
  283. package/dist/index-CMPTHneU.js.map +0 -1
  284. package/dist/index-DAjU2bTe.cjs +0 -2
  285. package/dist/index-DAjU2bTe.cjs.map +0 -1
  286. package/dist/index.cjs.map +0 -1
  287. package/dist/index.js.map +0 -1
  288. package/dist/menu-popover-BV7nUXlb.js +0 -77
  289. package/dist/menu-popover-BV7nUXlb.js.map +0 -1
  290. package/dist/menu-popover-fGpFDJTo.cjs +0 -2
  291. package/dist/menu-popover-fGpFDJTo.cjs.map +0 -1
  292. package/dist/use-touched-B999bBr8.js.map +0 -1
  293. package/dist/use-touched-Bq5Gjbpz.cjs.map +0 -1
@@ -1,59 +1,67 @@
1
1
  import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
- import { t as d } from "../../classix-DG18itHa.js";
3
- import { Badge as w } from "../badge/index.js";
4
- import { Checkbox as v } from "../checkbox/index.js";
5
- import { Figure as f } from "../figure/index.js";
6
- import { Icon as N } from "../icon/index.js";
7
- import '../../assets/index32.css';const h = "_card_1czes_1", y = "_head_1czes_28", j = "_center_1czes_40", D = "_content_1czes_52", E = "_preview_1czes_58", I = "_margin_1czes_98", T = "_clickable_1czes_143", $ = "_muted_1czes_158", k = "_selected_1czes_163", e = {
8
- card: h,
9
- head: y,
10
- center: j,
11
- content: D,
12
- preview: E,
13
- "preview-leading": "_preview-leading_1czes_69",
14
- "preview-trailing": "_preview-trailing_1czes_70",
15
- "preview-content": "_preview-content_1czes_90",
16
- margin: I,
17
- clickable: T,
18
- muted: $,
19
- selected: k,
20
- "image-top": "_image-top_1czes_168",
21
- "image-left": "_image-left_1czes_179"
22
- }, G = ({
23
- actions: z,
2
+ import s from "classix";
3
+ import { Badge as T } from "../badge/index.js";
4
+ import { Checkbox as $ } from "../checkbox/index.js";
5
+ import { Figure as j } from "../figure/index.js";
6
+ import { Icon as k } from "../icon/index.js";
7
+ import '../../assets/index32.css';const z = "_card_1pyj3_1", B = "_head_1pyj3_28", F = "_center_1pyj3_40", q = "_content_1pyj3_52", x = "_preview_1pyj3_58", A = "_margin_1pyj3_98", C = "_outlined_1pyj3_142", G = "_clickable_1pyj3_148", H = "_muted_1pyj3_159", J = "_selected_1pyj3_164", e = {
8
+ card: z,
9
+ head: B,
10
+ center: F,
11
+ content: q,
12
+ preview: x,
13
+ "preview-leading": "_preview-leading_1pyj3_69",
14
+ "preview-trailing": "_preview-trailing_1pyj3_70",
15
+ "preview-content": "_preview-content_1pyj3_90",
16
+ margin: A,
17
+ outlined: C,
18
+ clickable: G,
19
+ muted: H,
20
+ selected: J,
21
+ "image-top": "_image-top_1pyj3_169",
22
+ "image-left": "_image-left_1pyj3_180"
23
+ }, U = ({
24
+ appearance: y = "default",
25
+ actions: v,
24
26
  badge: o,
25
- checkbox: r,
26
- children: p,
27
- emphasis: g = "default",
28
- header: _,
29
- icon: u,
30
- image: a,
31
- imagePosition: i = "top",
32
- onClick: s,
33
- preview: l,
34
- variant: n = "default"
35
- }) => /* @__PURE__ */ m("article", { className: d(e.card, g === "muted" && e.muted, s && e.clickable, (r == null ? void 0 : r.checked) && e.selected), "data-emphasis": g, "data-minimal": n === "minimal", onClick: s, onKeyDown: (c) => {
36
- s && c.currentTarget === document.activeElement && (c.key === "Enter" || c.key === " ") && (c.preventDefault(), c.currentTarget.click());
37
- }, tabIndex: s ? 0 : -1, "data-component": "card", children: [
38
- a && n !== "minimal" && i === "top" && /* @__PURE__ */ t(f, { className: e[`image-${i}`], children: a }),
27
+ checkbox: i,
28
+ className: N,
29
+ children: u,
30
+ emphasis: f = "default",
31
+ fullWidth: h = !1,
32
+ header: p,
33
+ icon: g,
34
+ image: l,
35
+ imagePosition: r = "top",
36
+ onClick: c,
37
+ onKeyDown: _,
38
+ preview: d,
39
+ selected: w = (i == null ? void 0 : i.checked) ?? !1,
40
+ tabIndex: E,
41
+ variant: a = "default",
42
+ ...I
43
+ }) => /* @__PURE__ */ m("article", { className: s(e.card, y === "outlined" && e.outlined, f === "muted" && e.muted, c && e.clickable, w && e.selected, N), "data-emphasis": f, "data-minimal": a === "minimal", "data-span": h ? "all" : void 0, ...I, onClick: c, onKeyDown: (n) => {
44
+ _ == null || _(n), !(n.defaultPrevented || !c) && n.currentTarget === document.activeElement && (n.key === "Enter" || n.key === " ") && (n.preventDefault(), n.currentTarget.click());
45
+ }, tabIndex: E ?? (c ? 0 : -1), "data-component": "card", children: [
46
+ l && a !== "minimal" && r === "top" && /* @__PURE__ */ t(j, { className: e[`image-${r}`], children: l }),
39
47
  /* @__PURE__ */ m("section", { children: [
40
- /* @__PURE__ */ m("div", { className: d(e.head, n === "minimal" && e.center), children: [
41
- r && /* @__PURE__ */ t("span", { onClick: (c) => c.stopPropagation(), children: /* @__PURE__ */ t(v, { ...r }) }),
42
- a && n !== "minimal" && i === "left" && /* @__PURE__ */ t(f, { className: e[`image-${i}`], children: a }),
43
- _,
44
- o && /* @__PURE__ */ t(w, { ...o }),
45
- u && /* @__PURE__ */ t(N, { name: u, size: "medium" }),
46
- z
48
+ /* @__PURE__ */ m("div", { className: s(e.head, a === "minimal" && e.center), children: [
49
+ i && /* @__PURE__ */ t("span", { onClick: (n) => n.stopPropagation(), children: /* @__PURE__ */ t($, { ...i }) }),
50
+ l && a !== "minimal" && r === "left" && /* @__PURE__ */ t(j, { className: e[`image-${r}`], children: l }),
51
+ p,
52
+ o && /* @__PURE__ */ t(T, { ...o }),
53
+ g && /* @__PURE__ */ t(k, { name: g, size: "medium" }),
54
+ v
47
55
  ] }),
48
- p && n !== "minimal" && /* @__PURE__ */ t("div", { className: d(e.content, !!_ && e.margin), children: p }),
49
- l && n !== "minimal" && /* @__PURE__ */ m("div", { className: d(e.preview, !!_ && e.margin), children: [
50
- /* @__PURE__ */ t("span", { className: e["preview-leading"], children: l.leading }),
51
- /* @__PURE__ */ t("span", { className: e["preview-content"], children: l.children }),
52
- /* @__PURE__ */ t("span", { className: e["preview-trailing"], children: l.trailing })
56
+ u && a !== "minimal" && /* @__PURE__ */ t("div", { className: s(e.content, !!p && e.margin), children: u }),
57
+ d && a !== "minimal" && /* @__PURE__ */ m("div", { className: s(e.preview, !!p && e.margin), children: [
58
+ /* @__PURE__ */ t("span", { className: e["preview-leading"], children: d.leading }),
59
+ /* @__PURE__ */ t("span", { className: e["preview-content"], children: d.children }),
60
+ /* @__PURE__ */ t("span", { className: e["preview-trailing"], children: d.trailing })
53
61
  ] })
54
62
  ] })
55
63
  ] });
56
64
  export {
57
- G as Card
65
+ U as Card
58
66
  };
59
67
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index33.css');const e=require("react/jsx-runtime"),x=require("../../icons-B3hIY9Bm.cjs"),b=require("../loading/index.cjs"),h="_checkbox_qf257_3",l={checkbox:h},a=({checked:s,disabled:t,isLoading:c,label:o,onChange:n,...i})=>{const r={"--icon-svg":x.iconSVG("Check")};return e.jsxs("label",{className:l.checkbox,"data-component":"checkbox",children:[e.jsx("input",{checked:s,disabled:t||c,onChange:n,type:"checkbox",style:r,...i}),c&&e.jsx(b.Loading,{size:"small",sticky:!0}),o&&o]})};exports.Checkbox=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index33.css');const e=require("react/jsx-runtime"),x=require("../../icons-BIdcCH-v.cjs"),b=require("../loading/index.cjs"),h="_checkbox_3o7pi_3",l={checkbox:h},a=({checked:s,disabled:t,isLoading:c,label:o,onChange:n,...i})=>{const r={"--icon-svg":x.iconSVG("Check")};return e.jsxs("label",{className:l.checkbox,"data-component":"checkbox",children:[e.jsx("input",{checked:s,disabled:t||c,onChange:n,type:"checkbox",style:r,...i}),c&&e.jsx(b.Loading,{size:"small",sticky:!0}),o&&o]})};exports.Checkbox=a;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,21 +1,21 @@
1
1
  import { jsxs as h, jsx as e } from "react/jsx-runtime";
2
- import { i as x } from "../../icons-CTtWkF6z.js";
2
+ import { i as x } from "../../icons-DVeBguFb.js";
3
3
  import { Loading as k } from "../loading/index.js";
4
- import '../../assets/index33.css';const m = "_checkbox_qf257_3", a = {
4
+ import '../../assets/index33.css';const m = "_checkbox_3o7pi_3", a = {
5
5
  checkbox: m
6
6
  }, d = ({
7
7
  checked: s,
8
8
  disabled: t,
9
9
  isLoading: c,
10
10
  label: o,
11
- onChange: r,
12
- ...i
11
+ onChange: i,
12
+ ...r
13
13
  }) => {
14
14
  const n = {
15
15
  "--icon-svg": x("Check")
16
16
  };
17
17
  return /* @__PURE__ */ h("label", { className: a.checkbox, "data-component": "checkbox", children: [
18
- /* @__PURE__ */ e("input", { checked: s, disabled: t || c, onChange: r, type: "checkbox", style: n, ...i }),
18
+ /* @__PURE__ */ e("input", { checked: s, disabled: t || c, onChange: i, type: "checkbox", style: n, ...r }),
19
19
  c && /* @__PURE__ */ e(k, { size: "small", sticky: !0 }),
20
20
  o && o
21
21
  ] });
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index34.css');const e=require("react/jsx-runtime"),c=require("../../classix-5H4IWnMA.cjs"),p=require("../icon/index.cjs"),d=require("../button/index.cjs"),_=require("../link/index.cjs"),u="_chip_1apyw_3",k="_clickable_1apyw_24",m="_divider_1apyw_45",h="_link_1apyw_53",i={chip:u,clickable:k,delete:"_delete_1apyw_41",divider:m,link:h},x=({accessibleLabel:s,className:o,label:t,link:a,onDelete:l,...r})=>e.jsx(e.Fragment,{children:a?e.jsxs("span",{className:c.t(i.chip,o),...r,children:[e.jsx(_.Link,{className:c.t(i.link,i.clickable),onClick:n=>n.stopPropagation(),to:a,children:t}),e.jsx("span",{"aria-hidden":"true",className:i.divider}),e.jsx(d.Button,{"aria-label":s??`Delete ${t}`,className:c.t(i.delete,i.clickable),icon:"X",onClick:n=>{n.stopPropagation(),l()},variant:"simple"})]}):e.jsxs("button",{...r,"aria-label":s??`Delete ${t}`,className:c.t(i.chip,i.clickable,o),onClick:n=>{n.stopPropagation(),l()},type:"button",children:[t,e.jsx(p.Icon,{name:"X",size:"small"})]})});exports.Chip=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index34.css');const e=require("react/jsx-runtime"),t=require("classix"),d=require("../icon/index.cjs"),p=require("../button/index.cjs"),_=require("../link/index.cjs"),h="_chip_zhdgo_1",m="_clickable_zhdgo_22",u="_divider_zhdgo_39",k="_link_zhdgo_47",i={chip:h,clickable:m,delete:"_delete_zhdgo_35",divider:u,link:k},x=({accessibleLabel:o,className:s,label:c,link:a,onDelete:l,...r})=>e.jsx(e.Fragment,{children:a?e.jsxs("span",{className:t(i.chip,s),...r,"data-component":"chip",children:[e.jsx(_.Link,{className:t(i.link,i.clickable),onClick:n=>n.stopPropagation(),to:a,children:c}),e.jsx("span",{"aria-hidden":"true",className:i.divider}),e.jsx(p.Button,{"aria-label":o??`Delete ${c}`,className:t(i.delete,i.clickable),icon:"X",onClick:n=>{n.stopPropagation(),l()},variant:"simple"})]}):e.jsxs("button",{...r,"aria-label":o??`Delete ${c}`,className:t(i.chip,i.clickable,s),onClick:n=>{n.stopPropagation(),l()},type:"button","data-component":"chip",children:[c,e.jsx(d.Icon,{name:"X",size:"small"})]})});exports.Chip=x;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,32 +1,32 @@
1
- import { jsx as t, Fragment as m, jsxs as s } from "react/jsx-runtime";
2
- import { t as c } from "../../classix-DG18itHa.js";
3
- import { Icon as d } from "../icon/index.js";
4
- import { Button as _ } from "../button/index.js";
5
- import { Link as k } from "../link/index.js";
6
- import '../../assets/index34.css';const h = "_chip_1apyw_3", y = "_clickable_1apyw_24", b = "_divider_1apyw_45", f = "_link_1apyw_53", i = {
7
- chip: h,
8
- clickable: y,
9
- delete: "_delete_1apyw_41",
10
- divider: b,
11
- link: f
1
+ import { jsx as c, Fragment as s, jsxs as p } from "react/jsx-runtime";
2
+ import e from "classix";
3
+ import { Icon as m } from "../icon/index.js";
4
+ import { Button as h } from "../button/index.js";
5
+ import { Link as _ } from "../link/index.js";
6
+ import '../../assets/index34.css';const k = "_chip_zhdgo_1", g = "_clickable_zhdgo_22", z = "_divider_zhdgo_39", b = "_link_zhdgo_47", i = {
7
+ chip: k,
8
+ clickable: g,
9
+ delete: "_delete_zhdgo_35",
10
+ divider: z,
11
+ link: b
12
12
  }, N = ({
13
- accessibleLabel: o,
14
- className: n,
15
- label: a,
13
+ accessibleLabel: n,
14
+ className: a,
15
+ label: t,
16
16
  link: l,
17
17
  onDelete: r,
18
- ...p
19
- }) => /* @__PURE__ */ t(m, { children: l ? /* @__PURE__ */ s("span", { className: c(i.chip, n), ...p, children: [
20
- /* @__PURE__ */ t(k, { className: c(i.link, i.clickable), onClick: (e) => e.stopPropagation(), to: l, children: a }),
21
- /* @__PURE__ */ t("span", { "aria-hidden": "true", className: i.divider }),
22
- /* @__PURE__ */ t(_, { "aria-label": o ?? `Delete ${a}`, className: c(i.delete, i.clickable), icon: "X", onClick: (e) => {
23
- e.stopPropagation(), r();
18
+ ...d
19
+ }) => /* @__PURE__ */ c(s, { children: l ? /* @__PURE__ */ p("span", { className: e(i.chip, a), ...d, "data-component": "chip", children: [
20
+ /* @__PURE__ */ c(_, { className: e(i.link, i.clickable), onClick: (o) => o.stopPropagation(), to: l, children: t }),
21
+ /* @__PURE__ */ c("span", { "aria-hidden": "true", className: i.divider }),
22
+ /* @__PURE__ */ c(h, { "aria-label": n ?? `Delete ${t}`, className: e(i.delete, i.clickable), icon: "X", onClick: (o) => {
23
+ o.stopPropagation(), r();
24
24
  }, variant: "simple" })
25
- ] }) : /* @__PURE__ */ s("button", { ...p, "aria-label": o ?? `Delete ${a}`, className: c(i.chip, i.clickable, n), onClick: (e) => {
26
- e.stopPropagation(), r();
27
- }, type: "button", children: [
28
- a,
29
- /* @__PURE__ */ t(d, { name: "X", size: "small" })
25
+ ] }) : /* @__PURE__ */ p("button", { ...d, "aria-label": n ?? `Delete ${t}`, className: e(i.chip, i.clickable, a), onClick: (o) => {
26
+ o.stopPropagation(), r();
27
+ }, type: "button", "data-component": "chip", children: [
28
+ t,
29
+ /* @__PURE__ */ c(m, { name: "X", size: "small" })
30
30
  ] }) });
31
31
  export {
32
32
  N as Chip
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index36.css');const n=require("react/jsx-runtime"),l=require("../icon/index.cjs"),a="_collapsible_1nzgt_1",i="_content_1nzgt_12",r="_indicator_1nzgt_16",e={collapsible:a,content:i,indicator:r},d=({children:o,disabled:t,open:s,summary:c})=>n.jsxs("details",{className:e.collapsible,open:t||s||void 0,"data-component":"collapsible",children:[n.jsxs("summary",{children:[n.jsx("span",{className:e.content,"data-content":"collapsible-summary",children:c}),!t&&n.jsx("span",{className:e.indicator,"data-content":"collapsible-indicator",children:n.jsx(l.Icon,{name:"CaretDown",size:"medium"})})]}),o]});exports.Collapsible=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index36.css');const n=require("react/jsx-runtime"),l=require("react"),u=require("../icon/index.cjs"),f="_collapsible_1nzgt_1",m="_content_1nzgt_12",b="_indicator_1nzgt_16",i={collapsible:f,content:m,indicator:b},v=({children:a,disabled:r,open:d,summary:p})=>{const s=l.useRef(null);return l.useEffect(()=>{const t=s.current;if(!t)return;let e;const c=()=>{e===void 0&&(e=t.open,t.open=!0)},o=()=>{e!==void 0&&(t.open=e,e=void 0)};return window.addEventListener("beforeprint",c),window.addEventListener("afterprint",o),()=>{window.removeEventListener("beforeprint",c),window.removeEventListener("afterprint",o),o()}},[]),n.jsxs("details",{ref:s,className:i.collapsible,open:r||d||void 0,"data-component":"collapsible",children:[n.jsxs("summary",{children:[n.jsx("span",{className:i.content,"data-content":"collapsible-summary",children:p}),!r&&n.jsx("span",{className:i.indicator,"data-content":"collapsible-indicator",children:n.jsx(u.Icon,{name:"CaretDown",size:"medium"})})]}),a]})};exports.Collapsible=v;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,22 +1,38 @@
1
- import { jsxs as c, jsx as n } from "react/jsx-runtime";
2
- import { Icon as s } from "../icon/index.js";
3
- import '../../assets/index36.css';const i = "_collapsible_1nzgt_1", r = "_content_1nzgt_12", m = "_indicator_1nzgt_16", t = {
4
- collapsible: i,
5
- content: r,
6
- indicator: m
7
- }, _ = ({
1
+ import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
+ import { useRef as m, useEffect as f } from "react";
3
+ import { Icon as u } from "../icon/index.js";
4
+ import '../../assets/index36.css';const b = "_collapsible_1nzgt_1", v = "_content_1nzgt_12", w = "_indicator_1nzgt_16", r = {
5
+ collapsible: b,
6
+ content: v,
7
+ indicator: w
8
+ }, z = ({
8
9
  children: l,
9
- disabled: o,
10
- open: a,
11
- summary: e
12
- }) => /* @__PURE__ */ c("details", { className: t.collapsible, open: o || a || void 0, "data-component": "collapsible", children: [
13
- /* @__PURE__ */ c("summary", { children: [
14
- /* @__PURE__ */ n("span", { className: t.content, "data-content": "collapsible-summary", children: e }),
15
- !o && /* @__PURE__ */ n("span", { className: t.indicator, "data-content": "collapsible-indicator", children: /* @__PURE__ */ n(s, { name: "CaretDown", size: "medium" }) })
16
- ] }),
17
- l
18
- ] });
10
+ disabled: i,
11
+ open: d,
12
+ summary: p
13
+ }) => {
14
+ const s = m(null);
15
+ return f(() => {
16
+ const n = s.current;
17
+ if (!n) return;
18
+ let e;
19
+ const a = () => {
20
+ e === void 0 && (e = n.open, n.open = !0);
21
+ }, t = () => {
22
+ e !== void 0 && (n.open = e, e = void 0);
23
+ };
24
+ return window.addEventListener("beforeprint", a), window.addEventListener("afterprint", t), () => {
25
+ window.removeEventListener("beforeprint", a), window.removeEventListener("afterprint", t), t();
26
+ };
27
+ }, []), /* @__PURE__ */ c("details", { ref: s, className: r.collapsible, open: i || d || void 0, "data-component": "collapsible", children: [
28
+ /* @__PURE__ */ c("summary", { children: [
29
+ /* @__PURE__ */ o("span", { className: r.content, "data-content": "collapsible-summary", children: p }),
30
+ !i && /* @__PURE__ */ o("span", { className: r.indicator, "data-content": "collapsible-indicator", children: /* @__PURE__ */ o(u, { name: "CaretDown", size: "medium" }) })
31
+ ] }),
32
+ l
33
+ ] });
34
+ };
19
35
  export {
20
- _ as Collapsible
36
+ z as Collapsible
21
37
  };
22
38
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index37.css');const b=require("react/jsx-runtime"),Z=require("../../classix-5H4IWnMA.cjs"),l=require("react"),ee=require("../button/index.cjs"),A=require("../../menu-popover-fGpFDJTo.cjs"),te="_controls_t1re6_13",ne="_inline_t1re6_43",ie="_embedded_t1re6_48",re="_fixed_t1re6_49",oe="_adaptive_t1re6_60",se="_measurement_t1re6_65",h={controls:te,default:"_default_t1re6_28",inline:ne,embedded:ie,fixed:re,adaptive:oe,measurement:se,"non-button-content":"_non-button-content_t1re6_99","overflow-trigger":"_overflow-trigger_t1re6_128"},de={primary:2,secondary:1,tertiary:0,simple:0},ce={default:h.default,embedded:h.embedded,fixed:h.fixed,inline:h.inline},ae=s=>de[s.props.variant??"secondary"];function le({buttons:s,menuAccessibleLabel:i,triggerAccessibleLabel:n}){const x=s.map(o=>({button:o,isDanger:o.props.intent==="danger",value:o}));return b.jsx(A.MenuPopover,{triggerAccessibleLabel:n,"data-component":"overflowmenu",children:({close:o,initialFocus:r})=>b.jsx(A.MenuActionList,{actions:x,initialFocus:r,menuAccessibleLabel:i,onSelect:()=>o(),usesMenuSemantics:!0})})}const p=(s,i)=>{const n=Number.parseFloat(String(s[i]));return Number.isFinite(n)?n:0},ue=s=>{if(!s.trim().endsWith("px"))return;const i=Number.parseFloat(s);return Number.isFinite(i)?i:void 0},me=(s,i)=>{const n=s.parentElement;if(!n)return;const x=n.getBoundingClientRect(),o=getComputedStyle(n),r=x.width||n.clientWidth,S=x.left+p(o,"borderLeftWidth")+p(o,"paddingLeft"),M=x.left+r-p(o,"borderRightWidth")-p(o,"paddingRight"),_=Array.from(n.children).slice(0,Array.from(n.children).indexOf(s)),y=_.reduce((f,u)=>Math.max(f,u.getBoundingClientRect().right),S),c=_.length>0?p(o,"columnGap"):0,a=Math.max(0,M-y-c),R=(i==null?void 0:i.parent)===n?Math.max(0,r-i.parentWidth):0;return{availableWidth:R>0?Math.max(a,((i==null?void 0:i.availableWidth)??0)+R):a,parent:n,parentWidth:r}},fe=({children:s,className:i,maxVisibleButtons:n,overflow:x,overflowAccessibleLabel:o="More actions",variant:r="default",...S})=>{const M=l.Children.toArray(s),_=[],y=[];M.forEach(e=>{l.isValidElement(e)&&e.type===ee.Button?_.push(e):y.push(e)});const c=_.map((e,d)=>({button:e,index:d,rank:ae(e)})).sort((e,d)=>e.rank-d.rank||e.index-d.index).map(({button:e,index:d})=>l.cloneElement(e,{key:e.key??d})),a=r==="embedded"||r==="fixed"&&x==="menu",R=typeof n=="number"&&Number.isFinite(n)?Math.floor(n):0,f=r==="embedded"&&R>0?Math.min(c.length,R):c.length,u=l.useRef(null),N=l.useRef(void 0),z=l.useRef(null),E=l.useRef(null),[F,C]=l.useState(f),k=c.map(e=>String(e.key)).join(`
2
- `),[D,G]=l.useState(k);D!==k&&(G(k),C(f));const g=l.useCallback(()=>{var L,I,T;if(!a){C(f);return}const e=u.current,d=z.current;if(!e||!d)return;const W=Array.from(d.querySelectorAll('[data-component="button"]')),w=W.at(-1);if(!w)return;const v=W.slice(0,c.length).map(t=>t.getBoundingClientRect().width);if(v.length!==c.length)return;const m=getComputedStyle(e),H=p(m,"paddingLeft")+p(m,"paddingRight")+p(m,"borderLeftWidth")+p(m,"borderRightWidth"),J=ue(m.maxWidth),B=r==="embedded"?me(e,N.current):void 0;B&&(N.current=B);const Q=(B==null?void 0:B.availableWidth)??((L=e.parentElement)==null?void 0:L.clientWidth)??0,U=((I=window.visualViewport)==null?void 0:I.width)??document.documentElement.clientWidth,V=Math.min(...[J,Q,U].filter(t=>typeof t=="number"&&Number.isFinite(t)&&t>0));if(!Number.isFinite(V))return;const q=Math.max(0,V-H),P=((T=E.current)==null?void 0:T.getBoundingClientRect().width)??0,X=v.reduce((t,Y)=>t+Y,0);if(f===c.length&&P+X<=q){C(t=>t===f?t:f);return}let K=P+w.getBoundingClientRect().width,j=0;for(let t=0;t<f&&!(K+v[t]>q);t+=1)K+=v[t],j=t+1;C(t=>t===j?t:j)},[a,c.length,r,f]);if(l.useLayoutEffect(()=>{var d,W,w,v;if(g(),!a)return;const e=typeof ResizeObserver>"u"?void 0:new ResizeObserver(g);return u.current&&(e==null||e.observe(u.current)),(d=u.current)!=null&&d.parentElement&&(e==null||e.observe(u.current.parentElement)),r==="embedded"&&((W=u.current)!=null&&W.parentElement)&&Array.from(u.current.parentElement.children).forEach(m=>{m!==u.current&&(e==null||e.observe(m))}),E.current&&(e==null||e.observe(E.current)),window.addEventListener("resize",g),(w=window.visualViewport)==null||w.addEventListener("resize",g),(v=document.fonts)==null||v.ready.then(g),()=>{var m;e==null||e.disconnect(),window.removeEventListener("resize",g),(m=window.visualViewport)==null||m.removeEventListener("resize",g)}},[a,s,g,r]),M.length===0)return null;const $=a?c.slice(0,F):c,O=a?c.slice(F):[];return b.jsxs("div",{"data-component":"controls","data-dynamic-position":r==="fixed"?!0:void 0,"data-adaptive":a?!0:void 0,className:Z.t(h.controls,ce[r],a&&h.adaptive,i),ref:u,...S,children:[a&&b.jsxs("div",{"aria-hidden":"true",className:h.measurement,ref:z,children:[c.map((e,d)=>l.cloneElement(e,{"aria-hidden":!0,id:void 0,key:`measure-${String(e.key??d)}`,onClick:void 0,ref:void 0,tabIndex:-1})),b.jsx(A.MenuPopover,{triggerAccessibleLabel:o,children:null})]}),r!=="embedded"&&y.length>0&&b.jsx("span",{className:h["non-button-content"],ref:E,children:y}),$,O.length>0&&b.jsx("span",{className:h["overflow-trigger"],children:b.jsx(le,{buttons:O,menuAccessibleLabel:o,triggerAccessibleLabel:o})})]})};exports.Controls=fe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index37.css');const b=require("react/jsx-runtime"),Z=require("classix"),l=require("react"),ee=require("../button/index.cjs"),A=require("../../menu-popover-bqblnK6P.cjs"),te="_controls_t1re6_13",ne="_inline_t1re6_43",ie="_embedded_t1re6_48",re="_fixed_t1re6_49",oe="_adaptive_t1re6_60",se="_measurement_t1re6_65",h={controls:te,default:"_default_t1re6_28",inline:ne,embedded:ie,fixed:re,adaptive:oe,measurement:se,"non-button-content":"_non-button-content_t1re6_99","overflow-trigger":"_overflow-trigger_t1re6_128"},de={primary:2,secondary:1,tertiary:0,simple:0},ce={default:h.default,embedded:h.embedded,fixed:h.fixed,inline:h.inline},ae=s=>de[s.props.variant??"secondary"];function le({buttons:s,menuAccessibleLabel:i,triggerAccessibleLabel:n}){const x=s.map(o=>({button:o,isDanger:o.props.intent==="danger",value:o}));return b.jsx(A.MenuPopover,{triggerAccessibleLabel:n,"data-component":"overflowmenu",children:({close:o,initialFocus:r})=>b.jsx(A.MenuActionList,{actions:x,initialFocus:r,menuAccessibleLabel:i,onSelect:()=>o(),usesMenuSemantics:!0})})}const p=(s,i)=>{const n=Number.parseFloat(String(s[i]));return Number.isFinite(n)?n:0},ue=s=>{if(!s.trim().endsWith("px"))return;const i=Number.parseFloat(s);return Number.isFinite(i)?i:void 0},me=(s,i)=>{const n=s.parentElement;if(!n)return;const x=n.getBoundingClientRect(),o=getComputedStyle(n),r=x.width||n.clientWidth,S=x.left+p(o,"borderLeftWidth")+p(o,"paddingLeft"),M=x.left+r-p(o,"borderRightWidth")-p(o,"paddingRight"),_=Array.from(n.children).slice(0,Array.from(n.children).indexOf(s)),y=_.reduce((f,u)=>Math.max(f,u.getBoundingClientRect().right),S),c=_.length>0?p(o,"columnGap"):0,a=Math.max(0,M-y-c),R=(i==null?void 0:i.parent)===n?Math.max(0,r-i.parentWidth):0;return{availableWidth:R>0?Math.max(a,((i==null?void 0:i.availableWidth)??0)+R):a,parent:n,parentWidth:r}},fe=({children:s,className:i,maxVisibleButtons:n,overflow:x,overflowAccessibleLabel:o="More actions",variant:r="default",...S})=>{const M=l.Children.toArray(s),_=[],y=[];M.forEach(e=>{l.isValidElement(e)&&e.type===ee.Button?_.push(e):y.push(e)});const c=_.map((e,d)=>({button:e,index:d,rank:ae(e)})).sort((e,d)=>e.rank-d.rank||e.index-d.index).map(({button:e,index:d})=>l.cloneElement(e,{key:e.key??d})),a=r==="embedded"||r==="fixed"&&x==="menu",R=typeof n=="number"&&Number.isFinite(n)?Math.floor(n):0,f=r==="embedded"&&R>0?Math.min(c.length,R):c.length,u=l.useRef(null),N=l.useRef(void 0),z=l.useRef(null),E=l.useRef(null),[F,C]=l.useState(f),k=c.map(e=>String(e.key)).join(`
2
+ `),[D,G]=l.useState(k);D!==k&&(G(k),C(f));const g=l.useCallback(()=>{var L,I,T;if(!a){C(f);return}const e=u.current,d=z.current;if(!e||!d)return;const W=Array.from(d.querySelectorAll('[data-component="button"]')),w=W.at(-1);if(!w)return;const v=W.slice(0,c.length).map(t=>t.getBoundingClientRect().width);if(v.length!==c.length)return;const m=getComputedStyle(e),H=p(m,"paddingLeft")+p(m,"paddingRight")+p(m,"borderLeftWidth")+p(m,"borderRightWidth"),J=ue(m.maxWidth),B=r==="embedded"?me(e,N.current):void 0;B&&(N.current=B);const Q=(B==null?void 0:B.availableWidth)??((L=e.parentElement)==null?void 0:L.clientWidth)??0,U=((I=window.visualViewport)==null?void 0:I.width)??document.documentElement.clientWidth,V=Math.min(...[J,Q,U].filter(t=>typeof t=="number"&&Number.isFinite(t)&&t>0));if(!Number.isFinite(V))return;const q=Math.max(0,V-H),P=((T=E.current)==null?void 0:T.getBoundingClientRect().width)??0,X=v.reduce((t,Y)=>t+Y,0);if(f===c.length&&P+X<=q){C(t=>t===f?t:f);return}let K=P+w.getBoundingClientRect().width,j=0;for(let t=0;t<f&&!(K+v[t]>q);t+=1)K+=v[t],j=t+1;C(t=>t===j?t:j)},[a,c.length,r,f]);if(l.useLayoutEffect(()=>{var d,W,w,v;if(g(),!a)return;const e=typeof ResizeObserver>"u"?void 0:new ResizeObserver(g);return u.current&&(e==null||e.observe(u.current)),(d=u.current)!=null&&d.parentElement&&(e==null||e.observe(u.current.parentElement)),r==="embedded"&&((W=u.current)!=null&&W.parentElement)&&Array.from(u.current.parentElement.children).forEach(m=>{m!==u.current&&(e==null||e.observe(m))}),E.current&&(e==null||e.observe(E.current)),window.addEventListener("resize",g),(w=window.visualViewport)==null||w.addEventListener("resize",g),(v=document.fonts)==null||v.ready.then(g),()=>{var m;e==null||e.disconnect(),window.removeEventListener("resize",g),(m=window.visualViewport)==null||m.removeEventListener("resize",g)}},[a,s,g,r]),M.length===0)return null;const $=a?c.slice(0,F):c,O=a?c.slice(F):[];return b.jsxs("div",{"data-dynamic-position":r==="fixed"?!0:void 0,"data-adaptive":a?!0:void 0,className:Z(h.controls,ce[r],a&&h.adaptive,i),ref:u,...S,"data-component":"controls",children:[a&&b.jsxs("div",{"aria-hidden":"true",className:h.measurement,ref:z,children:[c.map((e,d)=>l.cloneElement(e,{"aria-hidden":!0,id:void 0,key:`measure-${String(e.key??d)}`,onClick:void 0,ref:void 0,tabIndex:-1})),b.jsx(A.MenuPopover,{triggerAccessibleLabel:o,children:null})]}),r!=="embedded"&&y.length>0&&b.jsx("span",{className:h["non-button-content"],ref:E,children:y}),$,O.length>0&&b.jsx("span",{className:h["overflow-trigger"],children:b.jsx(le,{buttons:O,menuAccessibleLabel:o,triggerAccessibleLabel:o})})]})};exports.Controls=fe;
3
3
  //# sourceMappingURL=index.cjs.map
@@ -1,8 +1,8 @@
1
1
  import { jsxs as G, jsx as v } from "react/jsx-runtime";
2
- import { t as ne } from "../../classix-DG18itHa.js";
2
+ import ne from "classix";
3
3
  import { Children as ie, isValidElement as re, cloneElement as P, useRef as C, useState as T, useCallback as oe, useLayoutEffect as de } from "react";
4
4
  import { Button as se } from "../button/index.js";
5
- import { a as $, M as ce } from "../../menu-popover-BV7nUXlb.js";
5
+ import { a as $, M as ce } from "../../menu-popover-Ceb_9V67.js";
6
6
  import '../../assets/index37.css';const ae = "_controls_t1re6_13", le = "_inline_t1re6_43", ue = "_embedded_t1re6_48", me = "_fixed_t1re6_49", fe = "_adaptive_t1re6_60", he = "_measurement_t1re6_65", f = {
7
7
  controls: ae,
8
8
  default: "_default_t1re6_28",
@@ -46,12 +46,12 @@ const h = (d, i) => {
46
46
  if (!d.trim().endsWith("px")) return;
47
47
  const i = Number.parseFloat(d);
48
48
  return Number.isFinite(i) ? i : void 0;
49
- }, We = (d, i) => {
49
+ }, xe = (d, i) => {
50
50
  const n = d.parentElement;
51
51
  if (!n) return;
52
- const g = n.getBoundingClientRect(), o = getComputedStyle(n), r = g.width || n.clientWidth, S = g.left + h(o, "borderLeftWidth") + h(o, "paddingLeft"), B = g.left + r - h(o, "borderRightWidth") - h(o, "paddingRight"), _ = Array.from(n.children).slice(0, Array.from(n.children).indexOf(d)), W = _.reduce((m, l) => Math.max(m, l.getBoundingClientRect().right), S), c = _.length > 0 ? h(o, "columnGap") : 0, a = Math.max(0, B - W - c), x = (i == null ? void 0 : i.parent) === n ? Math.max(0, r - i.parentWidth) : 0;
52
+ const g = n.getBoundingClientRect(), o = getComputedStyle(n), r = g.width || n.clientWidth, S = g.left + h(o, "borderLeftWidth") + h(o, "paddingLeft"), B = g.left + r - h(o, "borderRightWidth") - h(o, "paddingRight"), _ = Array.from(n.children).slice(0, Array.from(n.children).indexOf(d)), x = _.reduce((m, l) => Math.max(m, l.getBoundingClientRect().right), S), c = _.length > 0 ? h(o, "columnGap") : 0, a = Math.max(0, B - x - c), W = (i == null ? void 0 : i.parent) === n ? Math.max(0, r - i.parentWidth) : 0;
53
53
  return {
54
- availableWidth: x > 0 ? Math.max(a, ((i == null ? void 0 : i.availableWidth) ?? 0) + x) : a,
54
+ availableWidth: W > 0 ? Math.max(a, ((i == null ? void 0 : i.availableWidth) ?? 0) + W) : a,
55
55
  parent: n,
56
56
  parentWidth: r
57
57
  };
@@ -64,9 +64,9 @@ const h = (d, i) => {
64
64
  variant: r = "default",
65
65
  ...S
66
66
  }) => {
67
- const B = ie.toArray(d), _ = [], W = [];
67
+ const B = ie.toArray(d), _ = [], x = [];
68
68
  B.forEach((e) => {
69
- re(e) && e.type === se ? _.push(e) : W.push(e);
69
+ re(e) && e.type === se ? _.push(e) : x.push(e);
70
70
  });
71
71
  const c = _.map((e, s) => ({
72
72
  button: e,
@@ -77,7 +77,7 @@ const h = (d, i) => {
77
77
  index: s
78
78
  }) => P(e, {
79
79
  key: e.key ?? s
80
- })), a = r === "embedded" || r === "fixed" && g === "menu", x = typeof n == "number" && Number.isFinite(n) ? Math.floor(n) : 0, m = r === "embedded" && x > 0 ? Math.min(c.length, x) : c.length, l = C(null), N = C(void 0), z = C(null), M = C(null), [F, E] = T(m), k = c.map((e) => String(e.key)).join(`
80
+ })), a = r === "embedded" || r === "fixed" && g === "menu", W = typeof n == "number" && Number.isFinite(n) ? Math.floor(n) : 0, m = r === "embedded" && W > 0 ? Math.min(c.length, W) : c.length, l = C(null), N = C(void 0), z = C(null), M = C(null), [F, E] = T(m), k = c.map((e) => String(e.key)).join(`
81
81
  `), [H, J] = T(k);
82
82
  H !== k && (J(k), E(m));
83
83
  const p = oe(() => {
@@ -92,7 +92,7 @@ const h = (d, i) => {
92
92
  if (!w) return;
93
93
  const b = y.slice(0, c.length).map((t) => t.getBoundingClientRect().width);
94
94
  if (b.length !== c.length) return;
95
- const u = getComputedStyle(e), U = h(u, "paddingLeft") + h(u, "paddingRight") + h(u, "borderLeftWidth") + h(u, "borderRightWidth"), X = _e(u.maxWidth), R = r === "embedded" ? We(e, N.current) : void 0;
95
+ const u = getComputedStyle(e), U = h(u, "paddingLeft") + h(u, "paddingRight") + h(u, "borderLeftWidth") + h(u, "borderRightWidth"), X = _e(u.maxWidth), R = r === "embedded" ? xe(e, N.current) : void 0;
96
96
  R && (N.current = R);
97
97
  const Y = (R == null ? void 0 : R.availableWidth) ?? ((I = e.parentElement) == null ? void 0 : I.clientWidth) ?? 0, Z = ((q = window.visualViewport) == null ? void 0 : q.width) ?? document.documentElement.clientWidth, O = Math.min(...[X, Y, Z].filter((t) => typeof t == "number" && Number.isFinite(t) && t > 0));
98
98
  if (!Number.isFinite(O)) return;
@@ -119,7 +119,7 @@ const h = (d, i) => {
119
119
  }, [a, d, p, r]), B.length === 0)
120
120
  return null;
121
121
  const Q = a ? c.slice(0, F) : c, V = a ? c.slice(F) : [];
122
- return /* @__PURE__ */ G("div", { "data-component": "controls", "data-dynamic-position": r === "fixed" ? !0 : void 0, "data-adaptive": a ? !0 : void 0, className: ne(f.controls, ge[r], a && f.adaptive, i), ref: l, ...S, children: [
122
+ return /* @__PURE__ */ G("div", { "data-dynamic-position": r === "fixed" ? !0 : void 0, "data-adaptive": a ? !0 : void 0, className: ne(f.controls, ge[r], a && f.adaptive, i), ref: l, ...S, "data-component": "controls", children: [
123
123
  a && /* @__PURE__ */ G("div", { "aria-hidden": "true", className: f.measurement, ref: z, children: [
124
124
  c.map((e, s) => P(e, {
125
125
  "aria-hidden": !0,
@@ -131,7 +131,7 @@ const h = (d, i) => {
131
131
  })),
132
132
  /* @__PURE__ */ v($, { triggerAccessibleLabel: o, children: null })
133
133
  ] }),
134
- r !== "embedded" && W.length > 0 && /* @__PURE__ */ v("span", { className: f["non-button-content"], ref: M, children: W }),
134
+ r !== "embedded" && x.length > 0 && /* @__PURE__ */ v("span", { className: f["non-button-content"], ref: M, children: x }),
135
135
  Q,
136
136
  V.length > 0 && /* @__PURE__ */ v("span", { className: f["overflow-trigger"], children: /* @__PURE__ */ v(ve, { buttons: V, menuAccessibleLabel: o, triggerAccessibleLabel: o }) })
137
137
  ] });
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index38.css');const d=require("react/jsx-runtime"),tt=require("../../classix-5H4IWnMA.cjs"),c=require("react"),mt=require("../button/index.cjs"),pt=require("../figure/index.cjs"),gt=require("../icon/index.cjs"),I=10,A=.1,kt=.92,m=(h,x,R)=>Math.min(R,Math.max(x,h)),It=h=>new Promise((x,R)=>{const f=URL.createObjectURL(h),a=new globalThis.Image;a.onload=()=>{URL.revokeObjectURL(f),x(a)},a.onerror=()=>{URL.revokeObjectURL(f),R(new Error("croppable-image-load-failed"))},a.src=f}),Ot=async({file:h,fill:x,transform:R,viewport:f})=>{const a=await It(h),O=f.width/a.naturalWidth,M=f.height/a.naturalHeight,y=Math.max(O,M),D=a.naturalWidth*y,E=a.naturalHeight*y,Q=x==="width"?Math.max(A,O/y):x==="height"?Math.max(A,M/y):A,j=m(R.zoom,Q,I),w=y*j,b=D*j,B=E*j,p=(f.width-b)/2+R.offset.x,L=(f.height-B)/2+R.offset.y,S=m(-p/w,0,a.naturalWidth),T=m(-L/w,0,a.naturalHeight),v=m(f.width/w,1,Math.max(1,a.naturalWidth-S)),s=m(f.height/w,1,Math.max(1,a.naturalHeight-T)),_=document.createElement("canvas"),u=_.getContext("2d");if(!u)throw new Error("croppable-image-context-missing");_.width=Math.max(1,Math.round(v)),_.height=Math.max(1,Math.round(s)),u.drawImage(a,S,T,v,s,0,0,_.width,_.height);const U=h.type.startsWith("image/")?h.type:"image/jpeg",P=await new Promise(N=>{_.toBlob(N,U,kt)});if(!P)throw new Error("croppable-image-export-failed");return new globalThis.File([P],h.name,{lastModified:Date.now(),type:P.type||U})},St="_croppable_1kqo4_1",Ut="_empty_1kqo4_14",Pt="_media_1kqo4_22",qt="_overlay_1kqo4_33",Yt="_viewport_1kqo4_41",Xt="_draggable_1kqo4_53",At="_dragging_1kqo4_57",Dt="_inner_1kqo4_61",Wt="_standalone_1kqo4_77",z={croppable:St,empty:Ut,media:Pt,overlay:qt,viewport:Yt,draggable:Xt,dragging:At,inner:Dt,standalone:Wt},Ht=192,Z={offset:{x:0,y:0},zoom:1},xt="Select image",Zt=({children:h,fill:x="none",height:R,image:f,label:a,onCroppableChange:O,onFileChange:M,onImageChange:y,onTransformChange:D,transform:E,standalone:Q})=>{const j=c.useRef(null),w=c.useRef(null),b=c.useRef(null),B=c.useRef(null),p=c.useRef(y),L=c.useRef(null),S=c.useRef(null),T=c.useRef(null),v=c.useRef(new Map),s=c.useRef(Z),_=c.useRef(null),[u,U]=c.useState(null),[P,N]=c.useState(null),[et,V]=c.useState(!1),[wt,nt]=c.useState(Z),[F,ot]=c.useState(null),[g,yt]=c.useState({width:0,height:0}),W=(()=>{const t=g.width,n=g.height;if(!t||!n)return{width:0,height:0,minZoom:A};if(!u)return{width:t,height:n,minZoom:A};const o=t/u.width,e=n/u.height,r=Math.max(o,e),i=x==="width"?o/r:x==="height"?e/r:0;return{width:u.width*r,height:u.height*r,minZoom:Math.max(A,i)}})(),q=W.minZoom,H=E??wt,Y=m(H.zoom,q,I),$=P??f??null,rt=!h&&!!f&&!P&&!F,G=!rt,ct=h??($?d.jsx("img",{alt:"",draggable:!1,onLoad:t=>{const n=t.currentTarget;n.naturalWidth&&n.naturalHeight&&U({width:n.naturalWidth,height:n.naturalHeight})},src:$}):null),X=ct==null,J=(t,n)=>{const{maxX:o,maxY:e}=it(n);return{x:m(t.x,-o,o),y:m(t.y,-e,e)}},st=(t,n)=>{const o=_.current;if(!o)return null;const e=o.getBoundingClientRect(),r=t-e.left-e.width/2,i=n-e.top-e.height/2;return{x:r,y:i}},bt=(t,n,o,e)=>{const r=m(n,q,I),i=m(o,q,I);if(r===0)return t;const l=i/r;return{x:(1-l)*e.x+l*t.x,y:(1-l)*e.y+l*t.y}},_t=(t,n,o)=>{const e=s.current.zoom,r=m(t,q,I),i=s.current.offset,l=o?bt(i,e,r,o):n,k=J(l,r);s.current={zoom:r,offset:k},E||nt({zoom:r,offset:k}),D==null||D({zoom:r,offset:k})},K=(t,n,o)=>{S.current={zoom:t,offset:n,anchor:o??null},w.current==null&&(w.current=window.requestAnimationFrame(()=>{w.current=null;const e=S.current;S.current=null;const r=(e==null?void 0:e.zoom)??s.current.zoom,i=(e==null?void 0:e.offset)??s.current.offset,l=(e==null?void 0:e.anchor)??null;_t(r,i,l)}))},zt=t=>{if(X||!G)return;const n=t.ctrlKey?.001:25e-5,o=s.current.zoom*Math.exp(-t.deltaY*n),e=st(t.clientX,t.clientY);K(o,s.current.offset,e)},it=t=>{const n=g.width,o=g.height;if(!n||!o)return{maxX:0,maxY:0};const e=m(t,q,I),r=W.width*e,i=W.height*e,l=Math.max(0,(r-n)/2),k=Math.max(0,(i-o)/2);return{maxX:l,maxY:k}},Rt=t=>{var r;const n=t.target,o=((r=n.files)==null?void 0:r[0])??null;if(L.current&&(URL.revokeObjectURL(L.current),L.current=null),!o){N(null),ot(null),M==null||M(null),n.value="";return}const e=URL.createObjectURL(o);L.current=e,N(e),U(null),ot(o),K(Z.zoom,Z.offset),s.current=Z,M==null||M(o),n.value=""},Mt=t=>{if(!(X||!G||t.pointerType==="mouse"&&t.button!==0)){if(t.currentTarget.setPointerCapture(t.pointerId),t.pointerType==="touch"){const n=v.current;if(n.set(t.pointerId,{x:t.clientX,y:t.clientY}),n.size===2){b.current=null,j.current=null,V(!1);const[o,e]=Array.from(n.values());T.current=Math.hypot(o.x-e.x,o.y-e.y);return}}j.current=t.pointerId,b.current={x:t.clientX,y:t.clientY,originX:s.current.offset.x,originY:s.current.offset.y}}},Et=t=>{if(X||!G)return;if(t.pointerType==="touch"){const r=v.current;if(!r.has(t.pointerId))return;if(r.set(t.pointerId,{x:t.clientX,y:t.clientY}),r.size===2){const[i,l]=Array.from(r.values()),k=i.x-l.x,jt=i.y-l.y,ht=Math.hypot(k,jt),ft={x:(i.x+l.x)/2,y:(i.y+l.y)/2};if(T.current){const Lt=ht/T.current,Tt=s.current.zoom*Lt,vt=st(ft.x,ft.y);K(Tt,s.current.offset,vt)}T.current=ht;return}}if(j.current!==t.pointerId||!b.current||!C)return;const n=t.clientX-b.current.x,o=t.clientY-b.current.y,e=Math.abs(n)+Math.abs(o);!et&&e>2&&V(!0),!(e<=1)&&K(s.current.zoom,{x:b.current.originX+n,y:b.current.originY+o})},at=t=>{t.pointerType==="touch"&&(v.current.delete(t.pointerId),v.current.size<2&&(T.current=null)),j.current===t.pointerId&&(j.current=null,b.current=null,V(!1))};c.useEffect(()=>{if(!E)return;const t=m(E.zoom,q,I);s.current={zoom:t,offset:J(E.offset,t)}},[E,g.width,g.height,u==null?void 0:u.width,u==null?void 0:u.height]),c.useEffect(()=>()=>{L.current&&URL.revokeObjectURL(L.current)},[]),c.useEffect(()=>{const t=_.current;if(!t)return;const n=()=>{const r=t.getBoundingClientRect();yt(i=>i.width===r.width&&i.height===r.height?i:{width:r.width,height:r.height}),O&&O(r)};n();const o=()=>n();if(window.addEventListener("scroll",o,!0),typeof ResizeObserver>"u"){const r=()=>n();return window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r),window.removeEventListener("scroll",o,!0)}}const e=new ResizeObserver(()=>n());return e.observe(t),()=>{e.disconnect(),window.removeEventListener("scroll",o,!0)}},[O]),c.useEffect(()=>{if(E)return;const t=s.current.offset,n=J(t,Y);t.x===n.x&&t.y===n.y||(s.current={zoom:s.current.zoom,offset:n},nt(o=>({...o,offset:n})))},[Y,u,g.width,g.height]),c.useEffect(()=>{$||U(null)},[$]),c.useEffect(()=>{p.current=y},[y]),c.useEffect(()=>{var o;if(!y)return;if(!F||!g.width||!g.height||h){(o=p.current)==null||o.call(p,null);return}let t=!0;const n=window.setTimeout(()=>{Ot({file:F,fill:x,transform:{zoom:Y,offset:H.offset},viewport:g}).then(e=>{var r;t&&((r=p.current)==null||r.call(p,e))}).catch(()=>{var e;t&&((e=p.current)==null||e.call(p,null))})},75);return()=>{t=!1,window.clearTimeout(n)}},[h,Y,H.offset,x,F,g]),c.useEffect(()=>()=>{w.current!=null&&(window.cancelAnimationFrame(w.current),w.current=null)},[]);const ut=it(Y),C=!X&&G&&(ut.maxX>0||ut.maxY>0),lt=()=>{var t;return(t=B.current)==null?void 0:t.click()},dt=t=>{t.preventDefault(),t.stopPropagation(),lt()};return d.jsxs("div",{className:tt.t(z.croppable,Q&&z.standalone),onClick:()=>{X&&lt()},"data-component":"croppable",children:[d.jsx("input",{accept:"image/*",onChange:Rt,ref:B,type:"file"}),d.jsx("div",{className:z.viewport,ref:_,onDragStart:t=>t.preventDefault(),onPointerDown:Mt,onPointerMove:Et,onPointerUp:at,onPointerCancel:at,onWheel:zt,style:{"--croppable-height":`${R??Ht}px`,"--croppable-zoom":Y,"--croppable-x":`${H.offset.x}px`,"--croppable-y":`${H.offset.y}px`,...u?{"--croppable-image-width":`${W.width}px`,"--croppable-image-height":`${W.height}px`}:null},children:X?d.jsxs("div",{className:z.empty,children:[d.jsx(pt.Figure,{children:d.jsx(gt.Icon,{name:"Image",size:"large"})}),d.jsx(mt.Button,{onClick:dt,children:a??xt})]}):d.jsxs("div",{className:tt.t(z.media,C&&z.draggable,C&&et&&z.dragging),children:[d.jsx("div",{className:tt.t(z.inner),children:ct}),rt&&d.jsx("div",{className:z.overlay,children:d.jsxs("div",{className:z.empty,children:[d.jsx(pt.Figure,{children:d.jsx(gt.Icon,{name:"Image",size:"large"})}),d.jsx(mt.Button,{onClick:dt,children:a??xt})]})})]})})]})};exports.Croppable=Zt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index38.css');const a=require("react/jsx-runtime"),ht=require("classix"),o=require("react"),Zt=require("../toolbar/index.cjs"),et=require("../button/index.cjs"),qt=require("../figure/index.cjs"),$t=require("../icon/index.cjs"),A=10,Z=.1,Gt=.92,y=(i,d,x)=>Math.min(x,Math.max(d,i)),Ft=i=>new Promise((d,x)=>{const z=URL.createObjectURL(i),s=new globalThis.Image;s.onload=()=>{URL.revokeObjectURL(z),d(s)},s.onerror=()=>{URL.revokeObjectURL(z),x(new Error("croppable-image-load-failed"))},s.src=z}),Jt=async({file:i,fill:d,transform:x,viewport:z})=>{const s=await Ft(i),D=z.width/s.naturalWidth,W=z.height/s.naturalHeight,O=Math.max(D,W),q=s.naturalWidth*O,H=s.naturalHeight*O,j=d==="width"?Math.max(Z,D/O):d==="height"?Math.max(Z,W/O):Z,S=y(x.zoom,j,A),R=O*S,v=q*S,M=H*S,nt=(z.width-v)/2+x.offset.x,P=(z.height-M)/2+x.offset.y,b=y(-nt/R,0,s.naturalWidth),_=y(-P/R,0,s.naturalHeight),$=y(z.width/R,1,Math.max(1,s.naturalWidth-b)),g=y(z.height/R,1,Math.max(1,s.naturalHeight-_)),h=document.createElement("canvas"),L=h.getContext("2d");if(!L)throw new Error("croppable-image-context-missing");h.width=Math.max(1,Math.round($)),h.height=Math.max(1,Math.round(g)),L.drawImage(s,b,_,$,g,0,0,h.width,h.height);const E=i.type.startsWith("image/")?i.type:"image/jpeg",U=await new Promise(u=>{h.toBlob(u,E,Gt)});if(!U)throw new Error("croppable-image-export-failed");return new globalThis.File([U],i.name,{lastModified:Date.now(),type:U.type||E})},Kt="_croppable_sjc2z_1",Qt="_empty_sjc2z_15",Vt="_action_sjc2z_23",Ct="_caption_sjc2z_31",te="_media_sjc2z_38",ee="_viewport_sjc2z_49",ne="_draggable_sjc2z_61",re="_dragging_sjc2z_65",ce="_inner_sjc2z_69",oe="_standalone_sjc2z_85",f={croppable:Kt,empty:Qt,action:Vt,caption:Ct,media:te,viewport:ee,draggable:ne,dragging:re,inner:ce,standalone:oe},se=192,T={offset:{x:0,y:0},zoom:1},Ut=(i,d)=>(i==null?void 0:i.file)===d.file&&(i==null?void 0:i.source)===d.source&&(i==null?void 0:i.settings)===d.settings,ie=({cancelLabel:i,children:d,fill:x="none",height:z,image:s,deleteLabel:D,saveLabel:W,uploadLabel:O,onCroppableChange:q,onDelete:H,onFileChange:j,onImageChange:S,onSave:R,onTransformChange:v,transform:M,standalone:nt})=>{const P=o.useRef(null),b=o.useRef(null),_=o.useRef(null),$=o.useRef(null),g=o.useRef(S),h=o.useRef(null),L=o.useRef(null),E=o.useRef(null),U=o.useRef(new Map),u=o.useRef(T),rt=o.useRef(null),[w,J]=o.useState(null),[ct,ot]=o.useState(null),[ft,K]=o.useState(!1),[Ot,st]=o.useState(T),[N,it]=o.useState(null),[m,St]=o.useState({width:0,height:0}),[pt,at]=o.useState(null),[G,Q]=o.useState(null),F=(()=>{const t=m.width,n=m.height;if(!t||!n)return{width:0,height:0,minZoom:Z};if(!w)return{width:t,height:n,minZoom:Z};const r=t/w.width,e=n/w.height,c=Math.max(r,e),l=x==="width"?r/c:x==="height"?e/c:0;return{width:w.width*c,height:w.height*c,minZoom:Math.max(Z,l)}})(),B=F.minZoom,X=M??Ot,Y=y(X.zoom,B,A),V=ct??s??null,mt=!d&&!!s&&!ct&&!N,C=!mt,xt=d??(V?a.jsx("img",{alt:"",draggable:!1,onLoad:t=>{const n=t.currentTarget;n.naturalWidth&&n.naturalHeight&&J({width:n.naturalWidth,height:n.naturalHeight})},src:V}):null),I=xt==null,ut={file:N,source:ct,settings:JSON.stringify([x,Y,X.offset.x,X.offset.y,m.width,m.height])};o.useEffect(()=>{!G||!s||s===G.image&&s!==G.crop.source||(at(G.crop),Q(null))},[s,G]);const lt=(t,n)=>{const{maxX:r,maxY:e}=wt(n);return{x:y(t.x,-r,r),y:y(t.y,-e,e)}},gt=(t,n)=>{const r=rt.current;if(!r)return null;const e=r.getBoundingClientRect(),c=t-e.left-e.width/2,l=n-e.top-e.height/2;return{x:c,y:l}},vt=(t,n,r,e)=>{const c=y(n,B,A),l=y(r,B,A);if(c===0)return t;const p=l/c;return{x:(1-p)*e.x+p*t.x,y:(1-p)*e.y+p*t.y}},Pt=(t,n,r)=>{const e=u.current.zoom,c=y(t,B,A),l=u.current.offset,p=r?vt(l,e,c,r):n,k=lt(p,c);u.current={zoom:c,offset:k},M||st({zoom:c,offset:k}),v==null||v({zoom:c,offset:k})},tt=(t,n,r)=>{L.current={zoom:t,offset:n,anchor:r??null},b.current==null&&(b.current=window.requestAnimationFrame(()=>{b.current=null;const e=L.current;L.current=null;const c=(e==null?void 0:e.zoom)??u.current.zoom,l=(e==null?void 0:e.offset)??u.current.offset,p=(e==null?void 0:e.anchor)??null;Pt(c,l,p)}))},It=t=>{if(I||!C)return;const n=t.ctrlKey?.001:25e-5,r=u.current.zoom*Math.exp(-t.deltaY*n),e=gt(t.clientX,t.clientY);tt(r,u.current.offset,e)},wt=t=>{const n=m.width,r=m.height;if(!n||!r)return{maxX:0,maxY:0};const e=y(t,B,A),c=F.width*e,l=F.height*e,p=Math.max(0,(c-n)/2),k=Math.max(0,(l-r)/2);return{maxX:p,maxY:k}},Tt=t=>{var c;Q(null),at(null);const n=t.target,r=((c=n.files)==null?void 0:c[0])??null;if(h.current&&(URL.revokeObjectURL(h.current),h.current=null),!r){ot(null),it(null),j==null||j(null),n.value="";return}const e=URL.createObjectURL(r);h.current=e,ot(e),J(null),it(r),tt(T.zoom,T.offset),u.current=T,j==null||j(r),n.value=""},yt=()=>{Q(null),at(null),b.current!=null&&(window.cancelAnimationFrame(b.current),b.current=null),L.current=null,P.current=null,_.current=null,E.current=null,U.current.clear(),K(!1),h.current&&(URL.revokeObjectURL(h.current),h.current=null),ot(null),J(null),it(null),u.current=T,st(T),v==null||v(T),j==null||j(null)},Lt=t=>{t.stopPropagation(),yt()},Nt=t=>{t.stopPropagation(),yt(),H==null||H()},Xt=t=>{if(!(I||!C||t.pointerType==="mouse"&&t.button!==0)){if(t.currentTarget.setPointerCapture(t.pointerId),t.pointerType==="touch"){const n=U.current;if(n.set(t.pointerId,{x:t.clientX,y:t.clientY}),n.size===2){_.current=null,P.current=null,K(!1);const[r,e]=Array.from(n.values());E.current=Math.hypot(r.x-e.x,r.y-e.y);return}}P.current=t.pointerId,_.current={x:t.clientX,y:t.clientY,originX:u.current.offset.x,originY:u.current.offset.y}}},Yt=t=>{if(I||!C)return;if(t.pointerType==="touch"){const c=U.current;if(!c.has(t.pointerId))return;if(c.set(t.pointerId,{x:t.clientX,y:t.clientY}),c.size===2){const[l,p]=Array.from(c.values()),k=l.x-p.x,Dt=l.y-p.y,Mt=Math.hypot(k,Dt),Et={x:(l.x+p.x)/2,y:(l.y+p.y)/2};if(E.current){const Wt=Mt/E.current,Ht=u.current.zoom*Wt,Bt=gt(Et.x,Et.y);tt(Ht,u.current.offset,Bt)}E.current=Mt;return}}if(P.current!==t.pointerId||!_.current||!dt)return;const n=t.clientX-_.current.x,r=t.clientY-_.current.y,e=Math.abs(n)+Math.abs(r);!ft&&e>2&&K(!0),!(e<=1)&&tt(u.current.zoom,{x:_.current.originX+n,y:_.current.originY+r})},zt=t=>{t.pointerType==="touch"&&(U.current.delete(t.pointerId),U.current.size<2&&(E.current=null)),P.current===t.pointerId&&(P.current=null,_.current=null,K(!1))};o.useEffect(()=>{if(!M)return;const t=y(M.zoom,B,A);u.current={zoom:t,offset:lt(M.offset,t)}},[M,m.width,m.height,w==null?void 0:w.width,w==null?void 0:w.height]),o.useEffect(()=>()=>{h.current&&URL.revokeObjectURL(h.current)},[]),o.useEffect(()=>{const t=rt.current;if(!t)return;const n=()=>{const c=t.getBoundingClientRect();St(l=>l.width===c.width&&l.height===c.height?l:{width:c.width,height:c.height}),q&&q(c)};n();const r=()=>n();if(window.addEventListener("scroll",r,!0),typeof ResizeObserver>"u"){const c=()=>n();return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",r,!0)}}const e=new ResizeObserver(()=>n());return e.observe(t),()=>{e.disconnect(),window.removeEventListener("scroll",r,!0)}},[q]),o.useEffect(()=>{if(M)return;const t=u.current.offset,n=lt(t,Y);t.x===n.x&&t.y===n.y||(u.current={zoom:u.current.zoom,offset:n},st(r=>({...r,offset:n})))},[Y,w,m.width,m.height]),o.useEffect(()=>{V||J(null)},[V]),o.useEffect(()=>{g.current=S},[S]),o.useEffect(()=>{var r;if(!S)return;if(!N||!m.width||!m.height||d){(r=g.current)==null||r.call(g,null);return}let t=!0;const n=window.setTimeout(()=>{Jt({file:N,fill:x,transform:{zoom:Y,offset:X.offset},viewport:m}).then(e=>{var c;t&&((c=g.current)==null||c.call(g,e))}).catch(()=>{var e;t&&((e=g.current)==null||e.call(g,null))})},75);return()=>{t=!1,window.clearTimeout(n)}},[d,Y,X.offset,x,N,m]),o.useEffect(()=>()=>{b.current!=null&&(window.cancelAnimationFrame(b.current),b.current=null)},[]);const bt=wt(Y),dt=!I&&C&&(bt.maxX>0||bt.maxY>0),_t=!I&&!mt&&!!R&&!Ut(pt,ut),jt=!!s&&!d&&!!N&&!Ut(pt,ut),kt=!jt&&!I&&!!(N||H),Rt=()=>{var t;return(t=$.current)==null?void 0:t.click()},At=t=>{t.preventDefault(),t.stopPropagation(),Rt()};return a.jsxs("div",{className:ht(f.croppable,nt&&f.standalone),onClick:()=>{I&&Rt()},"data-component":"croppable",children:[a.jsx("input",{accept:"image/*",onChange:Tt,ref:$,type:"file"}),a.jsx("div",{className:f.viewport,ref:rt,onDragStart:t=>t.preventDefault(),onPointerDown:Xt,onPointerMove:Yt,onPointerUp:zt,onPointerCancel:zt,onWheel:It,style:{"--croppable-height":`${z??se}px`,"--croppable-zoom":Y,"--croppable-x":`${X.offset.x}px`,"--croppable-y":`${X.offset.y}px`,...w?{"--croppable-image-width":`${F.width}px`,"--croppable-image-height":`${F.height}px`}:null},children:I?a.jsx("div",{className:f.empty,children:a.jsx(qt.Figure,{children:a.jsx($t.Icon,{name:"Image",size:"large"})})}):a.jsx("div",{className:ht(f.media,dt&&f.draggable,dt&&ft&&f.dragging),children:a.jsx("div",{className:ht(f.inner),children:xt})})}),a.jsxs(Zt.Toolbar,{children:[_t&&a.jsxs("span",{className:f.action,children:[a.jsx(et.Button,{"aria-label":W??"Save image",icon:"FloppyDisk",onClick:()=>{Q({image:s,crop:ut}),R==null||R()},variant:"primary"}),W&&a.jsx("span",{className:f.caption,children:W})]}),!_t&&a.jsxs("span",{className:f.action,children:[a.jsx(et.Button,{"aria-label":O,icon:"UploadSimple",onClick:At,variant:"secondary"}),a.jsx("span",{className:f.caption,children:O})]}),jt&&a.jsxs("span",{className:f.action,children:[a.jsx(et.Button,{"aria-label":i??"Cancel changes",icon:"X",onClick:Lt,variant:"secondary"}),i&&a.jsx("span",{className:f.caption,children:i})]}),kt&&a.jsxs("span",{className:f.action,children:[a.jsx(et.Button,{"aria-label":D??"Delete image",icon:"Trash",intent:"danger",onClick:Nt,variant:"secondary"}),D&&a.jsx("span",{className:f.caption,children:D})]})]})]})};exports.Croppable=ie;
2
2
  //# sourceMappingURL=index.cjs.map