@solibo/solibo-ui 2.2.13 → 2.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -1
- package/dist/assets/index46.css +1 -1
- package/dist/assets/index47.css +1 -1
- package/dist/assets/index48.css +1 -1
- package/dist/assets/index49.css +1 -1
- package/dist/assets/index50.css +1 -1
- package/dist/assets/index51.css +1 -1
- package/dist/assets/index52.css +1 -1
- package/dist/assets/index53.css +1 -1
- package/dist/assets/index54.css +1 -1
- package/dist/assets/index55.css +1 -1
- package/dist/assets/index56.css +1 -1
- package/dist/assets/index57.css +1 -1
- package/dist/assets/index58.css +1 -1
- package/dist/assets/index59.css +1 -0
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index60.css +1 -0
- package/dist/components/app-link/index.cjs +1 -1
- package/dist/components/app-link/index.js +9 -9
- package/dist/components/app-shell/index.cjs +1 -1
- package/dist/components/app-shell/index.js +1 -1
- package/dist/components/aside/index.cjs +1 -1
- package/dist/components/aside/index.js +1 -1
- package/dist/components/avatar/index.cjs +1 -1
- package/dist/components/avatar/index.js +38 -39
- package/dist/components/badge/index.cjs +1 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/banner/index.cjs +1 -1
- package/dist/components/banner/index.js +1 -1
- package/dist/components/branding/index.cjs +1 -1
- package/dist/components/branding/index.js +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/card/index.cjs +1 -1
- package/dist/components/card/index.js +49 -49
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +23 -17
- package/dist/components/chip/index.cjs +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/clipboard/index.cjs +1 -1
- package/dist/components/clipboard/index.js +1 -1
- package/dist/components/collapsible/index.cjs +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/comment/index.cjs +1 -1
- package/dist/components/comment/index.js +1 -1
- package/dist/components/comments/index.cjs +1 -1
- package/dist/components/comments/index.js +2 -2
- package/dist/components/controls/index.cjs +1 -1
- package/dist/components/controls/index.js +1 -1
- package/dist/components/croppable/index.cjs +1 -1
- package/dist/components/croppable/index.js +152 -152
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/divider/index.cjs +1 -1
- package/dist/components/divider/index.js +1 -1
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.js +3 -3
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +1 -1
- package/dist/components/editor/index.cjs +1 -1
- package/dist/components/editor/index.js +237 -234
- package/dist/components/empty-state/index.cjs +1 -1
- package/dist/components/empty-state/index.js +1 -1
- package/dist/components/fieldset/index.cjs +1 -1
- package/dist/components/fieldset/index.js +1 -1
- package/dist/components/figure/index.cjs +1 -1
- package/dist/components/figure/index.js +1 -1
- package/dist/components/file/index.cjs +1 -1
- package/dist/components/file/index.js +1 -1
- package/dist/components/footer/index.cjs +1 -1
- package/dist/components/footer/index.js +1 -1
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +21 -12
- package/dist/components/graph/index.cjs +1 -1
- package/dist/components/graph/index.js +1 -1
- package/dist/components/group/index.cjs +1 -1
- package/dist/components/group/index.js +1 -1
- package/dist/components/header/index.cjs +1 -1
- package/dist/components/header/index.js +1 -1
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/iframe/index.cjs +1 -1
- package/dist/components/iframe/index.js +2 -2
- package/dist/components/image/index.cjs +1 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +4 -2
- package/dist/components/label/index.cjs +1 -0
- package/dist/components/label/index.js +18 -0
- package/dist/components/link/index.cjs +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.js +1 -1
- package/dist/components/loading/index.cjs +1 -1
- package/dist/components/loading/index.js +1 -1
- package/dist/components/message/index.cjs +1 -1
- package/dist/components/message/index.js +2 -2
- package/dist/components/messages/index.cjs +1 -1
- package/dist/components/messages/index.js +2 -2
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.js +1 -1
- package/dist/components/object/index.cjs +1 -1
- package/dist/components/object/index.js +1 -1
- package/dist/components/page-layout/index.cjs +1 -1
- package/dist/components/page-layout/index.js +1 -1
- package/dist/components/panel/index.cjs +1 -1
- package/dist/components/panel/index.js +1 -1
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/portal/index.cjs +1 -1
- package/dist/components/portal/index.js +1 -1
- package/dist/components/radio/index.cjs +1 -0
- package/dist/components/radio/index.js +35 -0
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +2 -2
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +3 -2
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.js +30 -29
- package/dist/components/toggle/index.cjs +1 -1
- package/dist/components/toggle/index.js +16 -16
- package/dist/components/toolbar/index.cjs +1 -1
- package/dist/components/toolbar/index.js +8 -9
- package/dist/components/tooltip/index.cjs +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/{index-DqZSdMHT.cjs → index-B4dFheLl.cjs} +1 -1
- package/dist/{index-KGoXYG8u.js → index-BJiUk1q2.js} +2 -2
- package/dist/index-BQoXmNo3.cjs +1 -0
- package/dist/index-Bre56YYa.js +90 -0
- package/dist/{index-Bl5EEYDv.cjs → index-BwfsmdF6.cjs} +1 -1
- package/dist/index-CHJNMNDr.cjs +1 -0
- package/dist/index-GPsHvb4d.js +74 -0
- package/dist/{index-DQuc_Zkg.js → index-acMNM3VJ.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +30 -7
- package/dist/index.js +74 -70
- package/dist/tokens.css +79 -38
- package/dist/tokens.json +627 -257
- package/package.json +1 -1
- package/dist/index-FSKjg3Z8.js +0 -82
- package/dist/index-HVXauXrX.js +0 -73
- package/dist/index-S1XsOUKE.cjs +0 -1
- package/dist/index-riaH5c_S.cjs +0 -1
|
@@ -1,69 +1,68 @@
|
|
|
1
|
-
import { jsxs as i, jsx as
|
|
2
|
-
import
|
|
3
|
-
import { Figure as
|
|
1
|
+
import { jsxs as i, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import v from "classix";
|
|
3
|
+
import { Figure as N } from "../figure/index.js";
|
|
4
4
|
import { Icon as g } from "../icon/index.js";
|
|
5
|
-
import { Link as
|
|
6
|
-
import '../../assets/
|
|
7
|
-
avatar:
|
|
5
|
+
import { Link as f } from "../link/index.js";
|
|
6
|
+
import '../../assets/index25.css';const b = "_avatar_9nson_1", y = "_secondary_9nson_9", x = "_media_9nson_14", k = "_role_9nson_14", A = "_details_9nson_63", I = "_text_9nson_85", L = "_initials_9nson_105", $ = "_small_9nson_109", j = "_medium_9nson_117", w = "_large_9nson_129", F = "_link_9nson_149", o = {
|
|
7
|
+
avatar: b,
|
|
8
8
|
secondary: y,
|
|
9
|
-
"color-1": "_color-
|
|
10
|
-
"color-solibo": "_color-
|
|
9
|
+
"color-1": "_color-1_9nson_14",
|
|
10
|
+
"color-solibo": "_color-solibo_9nson_14",
|
|
11
11
|
media: x,
|
|
12
12
|
role: k,
|
|
13
|
-
"color-2": "_color-
|
|
14
|
-
"color-board": "_color-
|
|
15
|
-
"color-3": "_color-
|
|
16
|
-
"color-owner": "_color-
|
|
17
|
-
"color-4": "_color-
|
|
18
|
-
"color-renter": "_color-
|
|
19
|
-
"color-5": "_color-
|
|
20
|
-
"color-external": "_color-
|
|
13
|
+
"color-2": "_color-2_9nson_19",
|
|
14
|
+
"color-board": "_color-board_9nson_19",
|
|
15
|
+
"color-3": "_color-3_9nson_24",
|
|
16
|
+
"color-owner": "_color-owner_9nson_24",
|
|
17
|
+
"color-4": "_color-4_9nson_29",
|
|
18
|
+
"color-renter": "_color-renter_9nson_29",
|
|
19
|
+
"color-5": "_color-5_9nson_34",
|
|
20
|
+
"color-external": "_color-external_9nson_34",
|
|
21
21
|
details: A,
|
|
22
22
|
text: I,
|
|
23
|
-
"role-name": "_role-name_gphab_94",
|
|
24
23
|
initials: L,
|
|
25
24
|
small: $,
|
|
26
25
|
medium: j,
|
|
27
26
|
large: w,
|
|
28
27
|
link: F
|
|
29
28
|
}, U = {
|
|
30
|
-
large:
|
|
31
|
-
medium:
|
|
32
|
-
small:
|
|
33
|
-
},
|
|
29
|
+
large: o.large,
|
|
30
|
+
medium: o.medium,
|
|
31
|
+
small: o.small
|
|
32
|
+
}, u = {
|
|
34
33
|
large: "large",
|
|
35
34
|
medium: "medium",
|
|
36
35
|
small: "medium"
|
|
37
36
|
}, B = (_) => {
|
|
38
|
-
const
|
|
37
|
+
const a = _.trim().split(/\s+/).filter(Boolean), t = Array.from(a[0] ?? "")[0] ?? "", c = a.length > 1 ? Array.from(a[a.length - 1])[0] : "";
|
|
39
38
|
return `${t}${c}`.toLocaleUpperCase();
|
|
40
39
|
}, E = ({
|
|
41
40
|
accessibleLabel: _,
|
|
42
|
-
color:
|
|
41
|
+
color: a,
|
|
43
42
|
icon: t,
|
|
44
43
|
imageUrl: c,
|
|
45
44
|
link: m,
|
|
46
|
-
name:
|
|
47
|
-
role:
|
|
48
|
-
size:
|
|
49
|
-
text:
|
|
45
|
+
name: l,
|
|
46
|
+
role: s,
|
|
47
|
+
size: r = "small",
|
|
48
|
+
text: e
|
|
50
49
|
}) => {
|
|
51
|
-
const d = _ ||
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
const d = _ || l || "User Avatar", p = l ? B(l) : "", h = /* @__PURE__ */ i("div", { className: v(o.avatar, U[r], a && o[`color-${a}`]), "data-color": a, "data-size": r, "data-component": "avatar", children: [
|
|
51
|
+
/* @__PURE__ */ n("span", { className: o.media, children: /* @__PURE__ */ n(N, { accessibleLabel: d, children: t ? /* @__PURE__ */ n(g, { name: t, size: u[r] }) : c ? /* @__PURE__ */ n("img", { src: c, alt: d }) : p ? /* @__PURE__ */ n("span", { "aria-hidden": "true", className: o.initials, children: p }) : /* @__PURE__ */ n(g, { name: "User", size: u[r] }) }) }),
|
|
52
|
+
(l || s || e) && /* @__PURE__ */ i("span", { className: o.details, children: [
|
|
53
|
+
l && /* @__PURE__ */ n("strong", { children: l }),
|
|
54
|
+
r === "small" && (e || s) && /* @__PURE__ */ i("span", { className: o.text, children: [
|
|
55
|
+
e,
|
|
56
|
+
e && s && " | ",
|
|
57
|
+
s && /* @__PURE__ */ n("span", { className: o["role-name"], children: s })
|
|
59
58
|
] }),
|
|
60
|
-
(
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
(r === "medium" || r === "large") && /* @__PURE__ */ i("span", { className: o.secondary, children: [
|
|
60
|
+
e && /* @__PURE__ */ n("span", { className: o.text, children: e }),
|
|
61
|
+
s && /* @__PURE__ */ n("span", { className: o.role, children: s })
|
|
63
62
|
] })
|
|
64
63
|
] })
|
|
65
64
|
] });
|
|
66
|
-
return m ? /* @__PURE__ */
|
|
65
|
+
return m ? /* @__PURE__ */ n(f, { className: o.link, to: m, "data-component": "avatar", children: h }) : h;
|
|
67
66
|
};
|
|
68
67
|
export {
|
|
69
68
|
E as Avatar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index26.css');const _=require("react/jsx-runtime"),u=require("classix"),s=require("../icon/index.cjs"),t="_badge_1b5u6_1",i="_small_1b5u6_20",g="_highlight_1b5u6_25",b="_info_1b5u6_31",m="_primary_1b5u6_36",h="_success_1b5u6_41",p="_warning_1b5u6_46",o={badge:t,small:i,highlight:g,info:b,primary:m,success:h,warning:p,"color-1":"_color-1_1b5u6_51","color-2":"_color-2_1b5u6_56","color-yellow":"_color-yellow_1b5u6_57","color-3":"_color-3_1b5u6_62","color-peach":"_color-peach_1b5u6_63","color-4":"_color-4_1b5u6_68","color-magenta":"_color-magenta_1b5u6_69","color-5":"_color-5_1b5u6_74","color-purple":"_color-purple_1b5u6_75","color-6":"_color-6_1b5u6_80","color-blue":"_color-blue_1b5u6_81","color-7":"_color-7_1b5u6_86","color-green":"_color-green_1b5u6_87"},d={default:o.default,highlight:o.highlight,info:o.info,primary:o.primary,success:o.success,warning:o.warning},f=({color:c,children:r,icon:l,position:e="left",size:n="large",variant:a="default"})=>r===0||r==null?null:_.jsxs("span",{className:u(o.badge,d[a],c&&o[`color-${c}`],o[n]),"data-component":"badge",children:[l&&e=="left"&&_.jsx(s.Icon,{name:l,size:"small"}),_.jsx("span",{children:r}),l&&e=="right"&&_.jsx(s.Icon,{name:l,size:"small"})]});exports.Badge=f;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import t from "classix";
|
|
3
3
|
import { Icon as s } from "../icon/index.js";
|
|
4
|
-
import '../../assets/
|
|
4
|
+
import '../../assets/index26.css';const b = "_badge_1b5u6_1", g = "_small_1b5u6_20", i = "_highlight_1b5u6_25", m = "_info_1b5u6_31", h = "_primary_1b5u6_36", p = "_success_1b5u6_41", f = "_warning_1b5u6_46", o = {
|
|
5
5
|
badge: b,
|
|
6
6
|
small: g,
|
|
7
7
|
highlight: i,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index27.css');const t=require("react/jsx-runtime"),s=require("classix"),i=require("../button/index.cjs"),o="_banner_hqbfl_13",u="_visible_hqbfl_32",r={banner:o,visible:u},d=({button:a,message:b,onClick:e,onDismiss:n,visible:c=!1})=>{const l=()=>{e==null||e(),n==null||n()};return t.jsxs("div",{"aria-live":"assertive",className:s(r.banner,c&&r.visible),"data-component":"banner",children:[b,t.jsx(i.Button,{onClick:l,children:a})]})};exports.Banner=d;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import i from "classix";
|
|
3
3
|
import { Button as s } from "../button/index.js";
|
|
4
|
-
import '../../assets/
|
|
4
|
+
import '../../assets/index27.css';const v = "_banner_hqbfl_13", f = "_visible_hqbfl_32", n = {
|
|
5
5
|
banner: v,
|
|
6
6
|
visible: f
|
|
7
7
|
}, p = ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index28.css');const t=require("react/jsx-runtime"),l="_branding_ag38m_1",H={branding:l};function a(C){return`data:image/svg+xml,${encodeURIComponent(C)}`}const n=`<svg viewBox="0 0 99 28" xmlns="http://www.w3.org/2000/svg">
|
|
2
2
|
<path d="M25.875 0H2.25C1.00733 0 0 1.00288 0 2.24V4.66667H7.08817C9.23746 4.66667 11.2328 5.77705 12.3587 7.59969L14.5006 11.067C15.6265 12.8896 17.6219 14 19.7712 14H28.125V2.24C28.125 1.00288 27.1176 0 25.875 0Z" fill="#CDE517"/>
|
|
3
3
|
<path d="M15.7662 20.4004L13.6244 16.9331C12.4984 15.1104 10.5031 14 8.3538 14H0V25.76C0 26.9971 1.00733 28 2.25 28H25.875C27.1176 28 28.125 26.9971 28.125 25.76V23.3334H21.0368C18.8875 23.3334 16.8922 22.223 15.7662 20.4004Z" fill="#CDE517"/>
|
|
4
4
|
<path d="M42.2876 14.048C39.6354 14.048 38.1933 12.8174 37.7556 10.4077L35.5151 10.8951C35.9269 13.8688 37.7815 15.9702 42.2098 15.9961C46.433 15.9961 48.1838 14.2272 48.1838 11.51C48.1838 9.35697 47.0766 7.76723 42.5964 6.9215C39.2228 6.30657 38.5022 5.43504 38.5022 4.15275C38.5022 2.76877 39.5324 1.92304 41.7461 1.92304C44.1414 1.92304 44.9909 2.97375 45.4546 5.02431L47.7972 4.56351C47.2054 1.82054 45.6605 0 41.8499 0C38.0644 0 36.1587 1.66641 36.1587 4.28108C36.1587 6.61405 37.5238 8.17796 41.7461 8.92122C44.8361 9.45947 45.8145 10.1769 45.8145 11.6642C45.8145 13.0998 44.7332 14.048 42.2876 14.048Z" fill="#F8FAC0"/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index29.css');const n=require("react/jsx-runtime"),u=require("classix"),p=require("../loading/index.cjs"),g=require("../badge/index.cjs"),b=require("../icon/index.cjs"),x="_button_10ypn_1",j="_large_10ypn_20",f="_small_10ypn_24",h="_danger_10ypn_34",q="_simple_10ypn_40",v="_primary_10ypn_53",B="_secondary_10ypn_64",S="_tertiary_10ypn_91",e={button:x,large:j,small:f,danger:h,simple:q,primary:v,secondary:B,tertiary:S},z={primary:e.primary,secondary:e.secondary,simple:e.simple,tertiary:e.tertiary},I={large:e.large,medium:e.medium,small:e.small};function L({badge:s,children:o,className:i,disabled:l=!1,icon:r,intent:a="default",isLoading:m=!1,onClick:c,ref:d,size:t="medium",variant:_="secondary",...y}){return n.jsxs("button",{className:u(e.button,z[_],I[t],i,a==="danger"&&e.danger),"data-intent":a,disabled:l,onClick:c,ref:d,type:"button",...y,"data-component":"button",children:[m?n.jsx(p.Loading,{size:t==="large"?"medium":"small"}):r&&n.jsx(b.Icon,{name:r,size:t==="large"?"medium":"small"}),o,n.jsx(g.Badge,{variant:"highlight",children:s})]})}exports.Button=L;
|
|
@@ -3,7 +3,7 @@ import g from "classix";
|
|
|
3
3
|
import { Loading as u } from "../loading/index.js";
|
|
4
4
|
import { Badge as f } from "../badge/index.js";
|
|
5
5
|
import { Icon as b } from "../icon/index.js";
|
|
6
|
-
import '../../assets/
|
|
6
|
+
import '../../assets/index29.css';const h = "_button_10ypn_1", x = "_large_10ypn_20", j = "_small_10ypn_24", v = "_danger_10ypn_34", B = "_simple_10ypn_40", z = "_primary_10ypn_53", I = "_secondary_10ypn_64", L = "_tertiary_10ypn_91", r = {
|
|
7
7
|
button: h,
|
|
8
8
|
large: x,
|
|
9
9
|
small: j,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index30.css');const t=require("react/jsx-runtime"),d=require("classix"),q=require("../badge/index.cjs"),T=require("../checkbox/index.cjs"),p=require("../figure/index.cjs"),k=require("../icon/index.cjs"),y="_card_xrcbb_1",E="_head_xrcbb_28",F="_center_xrcbb_40",I="_content_xrcbb_52",S="_preview_xrcbb_58",$="_margin_xrcbb_98",z="_outlined_xrcbb_138",B="_clickable_xrcbb_144",C="_muted_xrcbb_155",M="_selected_xrcbb_160",e={card:y,head:E,center:F,content:I,preview:S,"preview-leading":"_preview-leading_xrcbb_69","preview-trailing":"_preview-trailing_xrcbb_70","preview-content":"_preview-content_xrcbb_90",margin:$,outlined:z,clickable:B,muted:C,selected:M,"image-top":"_image-top_xrcbb_165","image-left":"_image-left_xrcbb_180"},O=({appearance:g="default",actions:j,badge:o,checkbox:r,className:f,children:u,emphasis:b="default",fullWidth:v=!1,header:_,icon:x,image:i,imagePosition:s="top",onClick:a,onKeyDown:m,preview:l,selected:h=(r==null?void 0:r.checked)??!1,tabIndex:N,variant:c="default",...w})=>t.jsxs("article",{className:d(e.card,g==="outlined"&&e.outlined,b==="muted"&&e.muted,a&&e.clickable,h&&e.selected,f),"data-emphasis":b,"data-minimal":c==="minimal","data-span":v?"all":void 0,...w,onClick:a,onKeyDown:n=>{m==null||m(n),!(n.defaultPrevented||!a)&&n.currentTarget===document.activeElement&&(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),n.currentTarget.click())},tabIndex:N??(a?0:-1),"data-component":"card",children:[i&&c!=="minimal"&&s==="top"&&t.jsx(p.Figure,{className:e[`image-${s}`],children:i}),t.jsxs("section",{children:[t.jsxs("div",{className:d(e.head,c==="minimal"&&e.center),children:[r&&t.jsx("span",{onClick:n=>n.stopPropagation(),children:t.jsx(T.Checkbox,{...r})}),i&&c!=="minimal"&&s==="left"&&t.jsx(p.Figure,{className:e[`image-${s}`],children:i}),_,o&&t.jsx(q.Badge,{...o}),x&&t.jsx(k.Icon,{name:x,size:"medium"}),j]}),u&&c!=="minimal"&&t.jsx("div",{className:d(e.content,!!_&&e.margin),children:u}),l&&c!=="minimal"&&t.jsxs("div",{className:d(e.preview,!!_&&e.margin),children:[t.jsx("span",{className:e["preview-leading"],children:l.leading}),t.jsx("span",{className:e["preview-content"],children:l.children}),t.jsx("span",{className:e["preview-trailing"],children:l.trailing})]})]})]});exports.Card=O;
|
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import s from "classix";
|
|
3
|
-
import { Badge as
|
|
4
|
-
import { Checkbox as
|
|
5
|
-
import { Figure as
|
|
6
|
-
import { Icon as
|
|
7
|
-
import '../../assets/
|
|
8
|
-
card:
|
|
9
|
-
head:
|
|
10
|
-
center:
|
|
11
|
-
content:
|
|
12
|
-
preview:
|
|
13
|
-
"preview-leading": "_preview-
|
|
14
|
-
"preview-trailing": "_preview-
|
|
15
|
-
"preview-content": "_preview-
|
|
16
|
-
margin:
|
|
17
|
-
outlined:
|
|
18
|
-
clickable:
|
|
19
|
-
muted:
|
|
20
|
-
selected:
|
|
21
|
-
"image-top": "_image-
|
|
22
|
-
"image-left": "_image-
|
|
23
|
-
},
|
|
24
|
-
appearance:
|
|
3
|
+
import { Badge as I } from "../badge/index.js";
|
|
4
|
+
import { Checkbox as T } from "../checkbox/index.js";
|
|
5
|
+
import { Figure as g } from "../figure/index.js";
|
|
6
|
+
import { Icon as $ } from "../icon/index.js";
|
|
7
|
+
import '../../assets/index30.css';const k = "_card_xrcbb_1", z = "_head_xrcbb_28", B = "_center_xrcbb_40", F = "_content_xrcbb_52", q = "_preview_xrcbb_58", y = "_margin_xrcbb_98", A = "_outlined_xrcbb_138", C = "_clickable_xrcbb_144", G = "_muted_xrcbb_155", H = "_selected_xrcbb_160", e = {
|
|
8
|
+
card: k,
|
|
9
|
+
head: z,
|
|
10
|
+
center: B,
|
|
11
|
+
content: F,
|
|
12
|
+
preview: q,
|
|
13
|
+
"preview-leading": "_preview-leading_xrcbb_69",
|
|
14
|
+
"preview-trailing": "_preview-trailing_xrcbb_70",
|
|
15
|
+
"preview-content": "_preview-content_xrcbb_90",
|
|
16
|
+
margin: y,
|
|
17
|
+
outlined: A,
|
|
18
|
+
clickable: C,
|
|
19
|
+
muted: G,
|
|
20
|
+
selected: H,
|
|
21
|
+
"image-top": "_image-top_xrcbb_165",
|
|
22
|
+
"image-left": "_image-left_xrcbb_180"
|
|
23
|
+
}, S = ({
|
|
24
|
+
appearance: x = "default",
|
|
25
25
|
actions: v,
|
|
26
|
-
badge:
|
|
27
|
-
checkbox:
|
|
26
|
+
badge: p,
|
|
27
|
+
checkbox: n,
|
|
28
28
|
className: N,
|
|
29
|
-
children:
|
|
30
|
-
emphasis:
|
|
29
|
+
children: b,
|
|
30
|
+
emphasis: u = "default",
|
|
31
31
|
fullWidth: h = !1,
|
|
32
|
-
header:
|
|
33
|
-
icon:
|
|
34
|
-
image:
|
|
35
|
-
imagePosition:
|
|
36
|
-
onClick:
|
|
37
|
-
onKeyDown:
|
|
32
|
+
header: _,
|
|
33
|
+
icon: f,
|
|
34
|
+
image: a,
|
|
35
|
+
imagePosition: i = "top",
|
|
36
|
+
onClick: l,
|
|
37
|
+
onKeyDown: o,
|
|
38
38
|
preview: d,
|
|
39
|
-
selected: w = (
|
|
40
|
-
tabIndex:
|
|
41
|
-
variant:
|
|
42
|
-
...
|
|
43
|
-
}) => /* @__PURE__ */ m("article", { className: s(e.card,
|
|
44
|
-
|
|
45
|
-
}, tabIndex:
|
|
46
|
-
|
|
39
|
+
selected: w = (n == null ? void 0 : n.checked) ?? !1,
|
|
40
|
+
tabIndex: j,
|
|
41
|
+
variant: c = "default",
|
|
42
|
+
...E
|
|
43
|
+
}) => /* @__PURE__ */ m("article", { className: s(e.card, x === "outlined" && e.outlined, u === "muted" && e.muted, l && e.clickable, w && e.selected, N), "data-emphasis": u, "data-minimal": c === "minimal", "data-span": h ? "all" : void 0, ...E, onClick: l, onKeyDown: (r) => {
|
|
44
|
+
o == null || o(r), !(r.defaultPrevented || !l) && r.currentTarget === document.activeElement && (r.key === "Enter" || r.key === " ") && (r.preventDefault(), r.currentTarget.click());
|
|
45
|
+
}, tabIndex: j ?? (l ? 0 : -1), "data-component": "card", children: [
|
|
46
|
+
a && c !== "minimal" && i === "top" && /* @__PURE__ */ t(g, { className: e[`image-${i}`], children: a }),
|
|
47
47
|
/* @__PURE__ */ m("section", { children: [
|
|
48
|
-
/* @__PURE__ */ m("div", { className: s(e.head,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
/* @__PURE__ */ m("div", { className: s(e.head, c === "minimal" && e.center), children: [
|
|
49
|
+
n && /* @__PURE__ */ t("span", { onClick: (r) => r.stopPropagation(), children: /* @__PURE__ */ t(T, { ...n }) }),
|
|
50
|
+
a && c !== "minimal" && i === "left" && /* @__PURE__ */ t(g, { className: e[`image-${i}`], children: a }),
|
|
51
|
+
_,
|
|
52
|
+
p && /* @__PURE__ */ t(I, { ...p }),
|
|
53
|
+
f && /* @__PURE__ */ t($, { name: f, size: "medium" }),
|
|
54
54
|
v
|
|
55
55
|
] }),
|
|
56
|
-
|
|
57
|
-
d &&
|
|
56
|
+
b && c !== "minimal" && /* @__PURE__ */ t("div", { className: s(e.content, !!_ && e.margin), children: b }),
|
|
57
|
+
d && c !== "minimal" && /* @__PURE__ */ m("div", { className: s(e.preview, !!_ && e.margin), children: [
|
|
58
58
|
/* @__PURE__ */ t("span", { className: e["preview-leading"], children: d.leading }),
|
|
59
59
|
/* @__PURE__ */ t("span", { className: e["preview-content"], children: d.children }),
|
|
60
60
|
/* @__PURE__ */ t("span", { className: e["preview-trailing"], children: d.trailing })
|
|
@@ -62,5 +62,5 @@ import '../../assets/index31.css';const z = "_card_1pyj3_1", B = "_head_1pyj3_28
|
|
|
62
62
|
] })
|
|
63
63
|
] });
|
|
64
64
|
export {
|
|
65
|
-
|
|
65
|
+
S as Card
|
|
66
66
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index31.css');const c=require("react/jsx-runtime"),n=require("react"),a=require("../../icons-BIdcCH-v.cjs"),b=require("../loading/index.cjs"),h="_checkbox_31wdz_3",k={checkbox:h},d=({checked:r,disabled:i,indeterminate:t=!1,isLoading:s,label:o,onChange:u,...l})=>{const e=n.useRef(null);n.useEffect(()=>{e.current&&(e.current.indeterminate=t)},[t]);const x={"--icon-svg":a.iconSVG("Check")};return c.jsxs("label",{className:k.checkbox,"data-component":"checkbox",children:[c.jsx("input",{ref:e,checked:r,disabled:i||s,onChange:u,type:"checkbox",style:x,...l}),s&&c.jsx(b.Loading,{size:"small",sticky:!0}),o&&o]})};exports.Checkbox=d;
|
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
import { jsxs as h, jsx as
|
|
2
|
-
import {
|
|
1
|
+
import { jsxs as h, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as l, useEffect as x } from "react";
|
|
3
|
+
import { i as a } from "../../icons-DVeBguFb.js";
|
|
3
4
|
import { Loading as k } from "../loading/index.js";
|
|
4
|
-
import '../../assets/
|
|
5
|
-
checkbox:
|
|
6
|
-
},
|
|
7
|
-
checked:
|
|
8
|
-
disabled:
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import '../../assets/index31.css';const p = "_checkbox_31wdz_3", u = {
|
|
6
|
+
checkbox: p
|
|
7
|
+
}, j = ({
|
|
8
|
+
checked: r,
|
|
9
|
+
disabled: n,
|
|
10
|
+
indeterminate: e = !1,
|
|
11
|
+
isLoading: o,
|
|
12
|
+
label: t,
|
|
11
13
|
onChange: i,
|
|
12
|
-
...
|
|
14
|
+
...f
|
|
13
15
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
+
const c = l(null);
|
|
17
|
+
x(() => {
|
|
18
|
+
c.current && (c.current.indeterminate = e);
|
|
19
|
+
}, [e]);
|
|
20
|
+
const m = {
|
|
21
|
+
"--icon-svg": a("Check")
|
|
16
22
|
};
|
|
17
|
-
return /* @__PURE__ */ h("label", { className:
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
return /* @__PURE__ */ h("label", { className: u.checkbox, "data-component": "checkbox", children: [
|
|
24
|
+
/* @__PURE__ */ s("input", { ref: c, checked: r, disabled: n || o, onChange: i, type: "checkbox", style: m, ...f }),
|
|
25
|
+
o && /* @__PURE__ */ s(k, { size: "small", sticky: !0 }),
|
|
26
|
+
t && t
|
|
21
27
|
] });
|
|
22
28
|
};
|
|
23
29
|
export {
|
|
24
|
-
|
|
30
|
+
j as Checkbox
|
|
25
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index32.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;
|
|
@@ -3,7 +3,7 @@ import e from "classix";
|
|
|
3
3
|
import { Icon as m } from "../icon/index.js";
|
|
4
4
|
import { Button as h } from "../button/index.js";
|
|
5
5
|
import { Link as _ } from "../link/index.js";
|
|
6
|
-
import '../../assets/
|
|
6
|
+
import '../../assets/index32.css';const k = "_chip_zhdgo_1", g = "_clickable_zhdgo_22", z = "_divider_zhdgo_39", b = "_link_zhdgo_47", i = {
|
|
7
7
|
chip: k,
|
|
8
8
|
clickable: g,
|
|
9
9
|
delete: "_delete_zhdgo_35",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index33.css');const t=require("react/jsx-runtime"),l=require("../icon/index.cjs"),s="_clipboard_1npqh_1",d="_label_1npqh_9",c={clipboard:s,label:d},p=({label:o,onSuccess:a})=>{const i=async()=>{if(navigator.clipboard)return navigator.clipboard.writeText(o);const e=document.createElement("textarea");e.value=o,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();const r=document.execCommand("copy");if(e.remove(),!r)throw new Error("Unable to copy text to clipboard")},n=()=>{i().then(()=>a())};return t.jsxs("span",{className:c.clipboard,onClick:n,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),n())},role:"button",tabIndex:0,"data-component":"clipboard",children:[t.jsx("span",{className:c.label,children:o}),t.jsx(l.Icon,{name:"Copy",size:"small"})]})};exports.Clipboard=p;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as i, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { Icon as p } from "../icon/index.js";
|
|
3
|
-
import '../../assets/
|
|
3
|
+
import '../../assets/index33.css';const s = "_clipboard_1npqh_1", d = "_label_1npqh_9", a = {
|
|
4
4
|
clipboard: s,
|
|
5
5
|
label: d
|
|
6
6
|
}, y = ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index34.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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as m, useEffect as f } from "react";
|
|
3
3
|
import { Icon as u } from "../icon/index.js";
|
|
4
|
-
import '../../assets/
|
|
4
|
+
import '../../assets/index34.css';const b = "_collapsible_1nzgt_1", v = "_content_1nzgt_12", w = "_indicator_1nzgt_16", r = {
|
|
5
5
|
collapsible: b,
|
|
6
6
|
content: v,
|
|
7
7
|
indicator: w
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");require("../avatar/index.cjs");require("../button/index.cjs");require("../group/index.cjs");require("../icon/index.cjs");const e=require("../../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");require("../avatar/index.cjs");require("../button/index.cjs");require("../group/index.cjs");require("../icon/index.cjs");const e=require("../../index-B4dFheLl.cjs");exports.Comment=e.Comment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index36.css');const e=require("react/jsx-runtime"),s=require("react"),y=require("../button/index.cjs"),j=require("../../index-B4dFheLl.cjs"),p=require("../icon/index.cjs"),v=require("../loading/index.cjs"),I="_comments_7c16w_1",R="_content_7c16w_26",S="_guidance_7c16w_32",k="_list_7c16w_39",c={comments:I,content:R,guidance:S,list:k},N=({comments:o,title:g,open:t,onOpenChange:l,showLabel:f="Show",hideLabel:b="Hide",guidance:a,loading:C,composer:d,status:m,pagination:q})=>{const u=s.useId(),_=s.useRef(null),r=s.useRef(null),i=s.useCallback(()=>{var h;const n=Array.from(((h=_.current)==null?void 0:h.querySelectorAll("[data-comment-id]"))??[]).find(w=>w.dataset.commentId===r.current);n&&(r.current=null,n.scrollIntoView({behavior:"smooth",block:"center"}))},[]);s.useEffect(i,[o,t,i]);const x=n=>{r.current=n,i()};return e.jsxs("div",{className:c.comments,"data-component":"comments","data-open":t,onClick:t?void 0:()=>l(!0),ref:_,children:[e.jsxs("header",{children:[e.jsx("h3",{children:g}),e.jsxs(y.Button,{"aria-controls":u,"aria-expanded":t,onClick:n=>{n.stopPropagation(),l(!t)},variant:"tertiary",children:[t?b:f,e.jsx(p.Icon,{name:t?"CaretUp":"CaretDown",size:"small"})]})]}),t&&e.jsxs("div",{className:c.content,id:u,children:[a&&e.jsx("p",{className:c.guidance,children:a}),C?e.jsx(v.Loading,{}):o.length>0&&e.jsx("ul",{className:c.list,children:o.map(n=>e.jsx("li",{children:e.jsx(j.Comment,{...n,onPublished:x})},n.id))}),q,d&&e.jsx(j.CommentComposer,{...d,onPublished:x}),m&&e.jsx("sub",{children:m})]})]})};exports.Comments=N;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as o, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useId as I, useRef as C, useCallback as k, useEffect as x } from "react";
|
|
3
3
|
import { Button as N } from "../button/index.js";
|
|
4
|
-
import { C as P, a as S } from "../../index-
|
|
4
|
+
import { C as P, a as S } from "../../index-BJiUk1q2.js";
|
|
5
5
|
import { Icon as j } from "../icon/index.js";
|
|
6
6
|
import { Loading as A } from "../loading/index.js";
|
|
7
|
-
import '../../assets/
|
|
7
|
+
import '../../assets/index36.css';const R = "_comments_7c16w_1", q = "_content_7c16w_26", z = "_guidance_7c16w_32", B = "_list_7c16w_39", c = {
|
|
8
8
|
comments: R,
|
|
9
9
|
content: q,
|
|
10
10
|
guidance: z,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("classix");require("react");require("../../menu-popover-bqblnK6P.cjs");const e=require("../../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("classix");require("react");require("../../menu-popover-bqblnK6P.cjs");const e=require("../../index-BwfsmdF6.cjs");exports.Controls=e.Controls;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index39.css');const i=require("react/jsx-runtime"),gt=require("classix"),c=require("react"),Vt=require("../toolbar/index.cjs"),ot=require("../button/index.cjs"),Ct=require("../figure/index.cjs"),te=require("../icon/index.cjs"),X=10,Z=.1,ee=.92,y=(s,d,R)=>Math.min(R,Math.max(d,s)),ne=s=>new Promise((d,R)=>{const f=URL.createObjectURL(s),h=new globalThis.Image;h.onload=()=>{URL.revokeObjectURL(f),d(h)},h.onerror=()=>{URL.revokeObjectURL(f),R(new Error("croppable-image-load-failed"))},h.src=f}),re=async({file:s,fill:d,transform:R,viewport:f})=>{const h=await ne(s),z=f.width/h.naturalWidth,Q=f.height/h.naturalHeight,j=Math.max(z,Q),q=h.naturalWidth*j,k=h.naturalHeight*j,M=d==="width"?Math.max(Z,z/j):d==="height"?Math.max(Z,Q/j):Z,P=y(R.zoom,M,X),D=j*P,O=q*P,$=k*P,ct=(f.width-O)/2+R.offset.x,E=(f.height-$)/2+R.offset.y,F=y(-ct/D,0,h.naturalWidth),v=y(-E/D,0,h.naturalHeight),_=y(f.width/D,1,Math.max(1,h.naturalWidth-F)),b=y(f.height/D,1,Math.max(1,h.naturalHeight-v)),T=document.createElement("canvas"),U=T.getContext("2d");if(!U)throw new Error("croppable-image-context-missing");T.width=Math.max(1,Math.round(_)),T.height=Math.max(1,Math.round(b)),U.drawImage(h,F,v,_,b,0,0,T.width,T.height);const g=s.type.startsWith("image/")?s.type:"image/jpeg",x=await new Promise(Y=>{T.toBlob(Y,g,ee)});if(!x)throw new Error("croppable-image-export-failed");return new globalThis.File([x],s.name,{lastModified:Date.now(),type:x.type||g})},oe="_croppable_1tvcl_1",ce="_empty_1tvcl_15",se="_action_1tvcl_28",ie="_caption_1tvcl_36",ae="_media_1tvcl_43",ue="_viewport_1tvcl_54",le="_draggable_1tvcl_66",de="_dragging_1tvcl_70",fe="_inner_1tvcl_74",he="_standalone_1tvcl_90",l={croppable:oe,empty:ce,"drop-target":"_drop-target_1tvcl_23",action:se,caption:ie,media:ae,viewport:ue,draggable:le,dragging:de,inner:fe,standalone:he},pe=192,L={offset:{x:0,y:0},zoom:1},It=(s,d)=>(s==null?void 0:s.file)===d.file&&(s==null?void 0:s.source)===d.source&&(s==null?void 0:s.settings)===d.settings,me=({cancelLabel:s,children:d,deleteLabel:R,fill:f="none",height:h,image:z,isDeleting:Q,isSaving:j,onCroppableChange:q,onDelete:k,onFileChange:M,onImageChange:P,onSave:D,onTransformChange:O,saveLabel:$,standalone:ct,transform:E,uploadLabel:F})=>{const v=c.useRef(null),_=c.useRef(null),b=c.useRef(null),T=c.useRef(null),U=c.useRef(0),g=c.useRef(P),x=c.useRef(null),Y=c.useRef(null),H=c.useRef(null),G=c.useRef(new Map),u=c.useRef(L),st=c.useRef(null),[w,V]=c.useState(null),[it,at]=c.useState(null),[xt,C]=c.useState(!1),[Lt,ut]=c.useState(!1),[St,lt]=c.useState(L),[S,dt]=c.useState(null),[m,At]=c.useState({width:0,height:0}),[wt,ft]=c.useState(null),[J,tt]=c.useState(null),K=(()=>{const t=m.width,e=m.height;if(!t||!e)return{width:0,height:0,minZoom:Z};if(!w)return{width:t,height:e,minZoom:Z};const r=t/w.width,n=e/w.height,o=Math.max(r,n),a=f==="width"?r/o:f==="height"?n/o:0;return{width:w.width*o,height:w.height*o,minZoom:Math.max(Z,a)}})(),B=K.minZoom,A=E??St,N=y(A.zoom,B,X),et=it??z??null,yt=!d&&!!z&&!it&&!S,nt=!yt,_t=d??(et?i.jsx("img",{alt:"",draggable:!1,onLoad:t=>{const e=t.currentTarget;e.naturalWidth&&e.naturalHeight&&V({width:e.naturalWidth,height:e.naturalHeight})},src:et}):null),I=_t==null,ht={file:S,source:it,settings:JSON.stringify([f,N,A.offset.x,A.offset.y,m.width,m.height])};c.useEffect(()=>{!J||!z||z===J.image&&z!==J.crop.source||(ft(J.crop),tt(null))},[z,J]);const pt=(t,e)=>{const{maxX:r,maxY:n}=Rt(e);return{x:y(t.x,-r,r),y:y(t.y,-n,n)}},bt=(t,e)=>{const r=st.current;if(!r)return null;const n=r.getBoundingClientRect(),o=t-n.left-n.width/2,a=e-n.top-n.height/2;return{x:o,y:a}},Nt=(t,e,r,n)=>{const o=y(e,B,X),a=y(r,B,X);if(o===0)return t;const p=a/o;return{x:(1-p)*n.x+p*t.x,y:(1-p)*n.y+p*t.y}},Wt=(t,e,r)=>{const n=u.current.zoom,o=y(t,B,X),a=u.current.offset,p=r?Nt(a,n,o,r):e,W=pt(p,o);u.current={zoom:o,offset:W},E||lt({zoom:o,offset:W}),O==null||O({zoom:o,offset:W})},rt=(t,e,r)=>{Y.current={zoom:t,offset:e,anchor:r??null},_.current==null&&(_.current=window.requestAnimationFrame(()=>{_.current=null;const n=Y.current;Y.current=null;const o=(n==null?void 0:n.zoom)??u.current.zoom,a=(n==null?void 0:n.offset)??u.current.offset,p=(n==null?void 0:n.anchor)??null;Wt(o,a,p)}))},Xt=t=>{if(I||!nt)return;const e=t.ctrlKey?.001:25e-5,r=u.current.zoom*Math.exp(-t.deltaY*e),n=bt(t.clientX,t.clientY);rt(r,u.current.offset,n)},Rt=t=>{const e=m.width,r=m.height;if(!e||!r)return{maxX:0,maxY:0};const n=y(t,B,X),o=K.width*n,a=K.height*n,p=Math.max(0,(o-e)/2),W=Math.max(0,(a-r)/2);return{maxX:p,maxY:W}},zt=t=>{if(tt(null),ft(null),x.current&&(URL.revokeObjectURL(x.current),x.current=null),!t){at(null),dt(null),M==null||M(null);return}const e=URL.createObjectURL(t);x.current=e,at(e),V(null),dt(t),rt(L.zoom,L.offset),u.current=L,M==null||M(t)},kt=t=>{var e;zt(((e=t.target.files)==null?void 0:e[0])??null),t.target.value=""},Mt=t=>!j&&(Array.from(t.items??[]).some(e=>e.kind==="file"&&e.type.startsWith("image/"))||Array.from(t.files??[]).some(e=>e.type.startsWith("image/"))),Yt=t=>{if(t.preventDefault(),t.stopPropagation(),U.current=0,ut(!1),j)return;const e=Array.from(t.dataTransfer.files).find(r=>r.type.startsWith("image/"));e&&zt(e)},jt=()=>{tt(null),ft(null),_.current!=null&&(window.cancelAnimationFrame(_.current),_.current=null),Y.current=null,v.current=null,b.current=null,H.current=null,G.current.clear(),C(!1),x.current&&(URL.revokeObjectURL(x.current),x.current=null),at(null),V(null),dt(null),u.current=L,lt(L),O==null||O(L),M==null||M(null)},Ht=t=>{t.stopPropagation(),jt()},Bt=t=>{t.stopPropagation(),jt(),k==null||k()},Zt=t=>{if(!(I||!nt||t.pointerType==="mouse"&&t.button!==0)){if(t.currentTarget.setPointerCapture(t.pointerId),t.pointerType==="touch"){const e=G.current;if(e.set(t.pointerId,{x:t.clientX,y:t.clientY}),e.size===2){b.current=null,v.current=null,C(!1);const[r,n]=Array.from(e.values());H.current=Math.hypot(r.x-n.x,r.y-n.y);return}}v.current=t.pointerId,b.current={x:t.clientX,y:t.clientY,originX:u.current.offset.x,originY:u.current.offset.y}}},qt=t=>{if(I||!nt)return;if(t.pointerType==="touch"){const o=G.current;if(!o.has(t.pointerId))return;if(o.set(t.pointerId,{x:t.clientX,y:t.clientY}),o.size===2){const[a,p]=Array.from(o.values()),W=a.x-p.x,Gt=a.y-p.y,Ot=Math.hypot(W,Gt),Ut={x:(a.x+p.x)/2,y:(a.y+p.y)/2};if(H.current){const Jt=Ot/H.current,Kt=u.current.zoom*Jt,Qt=bt(Ut.x,Ut.y);rt(Kt,u.current.offset,Qt)}H.current=Ot;return}}if(v.current!==t.pointerId||!b.current||!mt)return;const e=t.clientX-b.current.x,r=t.clientY-b.current.y,n=Math.abs(e)+Math.abs(r);!xt&&n>2&&C(!0),!(n<=1)&&rt(u.current.zoom,{x:b.current.originX+e,y:b.current.originY+r})},Dt=t=>{t.pointerType==="touch"&&(G.current.delete(t.pointerId),G.current.size<2&&(H.current=null)),v.current===t.pointerId&&(v.current=null,b.current=null,C(!1))};c.useEffect(()=>{if(!E)return;const t=y(E.zoom,B,X);u.current={zoom:t,offset:pt(E.offset,t)}},[E,m.width,m.height,w==null?void 0:w.width,w==null?void 0:w.height]),c.useEffect(()=>()=>{x.current&&URL.revokeObjectURL(x.current)},[]),c.useEffect(()=>{const t=st.current;if(!t)return;const e=()=>{const o=t.getBoundingClientRect();At(a=>a.width===o.width&&a.height===o.height?a:{width:o.width,height:o.height}),q&&q(o)};e();const r=()=>e();if(window.addEventListener("scroll",r,!0),typeof ResizeObserver>"u"){const o=()=>e();return window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",r,!0)}}const n=new ResizeObserver(()=>e());return n.observe(t),()=>{n.disconnect(),window.removeEventListener("scroll",r,!0)}},[q]),c.useEffect(()=>{if(E)return;const t=u.current.offset,e=pt(t,N);t.x===e.x&&t.y===e.y||(u.current={zoom:u.current.zoom,offset:e},lt(r=>({...r,offset:e})))},[N,w,m.width,m.height]),c.useEffect(()=>{et||V(null)},[et]),c.useEffect(()=>{g.current=P},[P]),c.useEffect(()=>{var r;if(!P)return;if(!S||!m.width||!m.height||d){(r=g.current)==null||r.call(g,null);return}let t=!0;const e=window.setTimeout(()=>{re({file:S,fill:f,transform:{zoom:N,offset:A.offset},viewport:m}).then(n=>{var o;t&&((o=g.current)==null||o.call(g,n))}).catch(()=>{var n;t&&((n=g.current)==null||n.call(g,null))})},75);return()=>{t=!1,window.clearTimeout(e)}},[d,N,A.offset,f,S,m]),c.useEffect(()=>()=>{_.current!=null&&(window.cancelAnimationFrame(_.current),_.current=null)},[]);const Et=Rt(N),mt=!I&&nt&&(Et.maxX>0||Et.maxY>0),vt=!I&&!yt&&!!D&&!It(wt,ht),Tt=!!z&&!d&&!!S&&!It(wt,ht),$t=!Tt&&!I&&!!(S||k),Pt=()=>{var t;return(t=T.current)==null?void 0:t.click()},Ft=t=>{t.preventDefault(),t.stopPropagation(),Pt()};return i.jsxs("div",{className:gt(l.croppable,ct&&l.standalone,Lt&&l["drop-target"]),onDragEnter:t=>{t.preventDefault(),t.stopPropagation(),U.current+=1,ut(Mt(t.dataTransfer))},onDragOver:t=>{t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=Mt(t.dataTransfer)?"copy":"none"},onDragLeave:t=>{t.preventDefault(),t.stopPropagation(),U.current=Math.max(0,U.current-1),U.current||ut(!1)},onDrop:Yt,onClick:()=>{I&&Pt()},"data-component":"croppable",children:[i.jsx("input",{accept:"image/*",onChange:kt,ref:T,type:"file"}),i.jsx("div",{className:l.viewport,ref:st,onDragStart:t=>t.preventDefault(),onPointerDown:Zt,onPointerMove:qt,onPointerUp:Dt,onPointerCancel:Dt,onWheel:Xt,style:{"--croppable-height":`${h??pe}px`,"--croppable-zoom":N,"--croppable-x":`${A.offset.x}px`,"--croppable-y":`${A.offset.y}px`,...w?{"--croppable-image-width":`${K.width}px`,"--croppable-image-height":`${K.height}px`}:null},children:I?i.jsx("div",{className:l.empty,children:i.jsx(Ct.Figure,{children:i.jsx(te.Icon,{name:"Image",size:"large"})})}):i.jsx("div",{className:gt(l.media,mt&&l.draggable,mt&&xt&&l.dragging),children:i.jsx("div",{className:gt(l.inner),children:_t})})}),i.jsxs(Vt.Toolbar,{children:[vt&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{isLoading:j,"aria-label":$??"Save image",icon:"FloppyDisk",onClick:()=>{tt({image:z,crop:ht}),D==null||D()},variant:"primary"}),$&&i.jsx("span",{className:l.caption,children:$})]}),!vt&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{"aria-label":F,icon:"UploadSimple",onClick:Ft,variant:"secondary"}),i.jsx("span",{className:l.caption,children:F})]}),Tt&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{"aria-label":s??"Cancel changes",icon:"X",onClick:Ht,variant:"secondary"}),s&&i.jsx("span",{className:l.caption,children:s})]}),$t&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{"aria-label":R??"Delete image",icon:"Trash",intent:"danger",isLoading:Q,onClick:Bt,variant:"secondary"}),R&&i.jsx("span",{className:l.caption,children:R})]})]})]})};exports.Croppable=me;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index38.css');const i=require("react/jsx-runtime"),gt=require("classix"),s=require("react"),Vt=require("../toolbar/index.cjs"),ot=require("../button/index.cjs"),Ct=require("../figure/index.cjs"),te=require("../icon/index.cjs"),k=10,Z=.1,ee=.92,y=(c,d,R)=>Math.min(R,Math.max(d,c)),re=c=>new Promise((d,R)=>{const f=URL.createObjectURL(c),h=new globalThis.Image;h.onload=()=>{URL.revokeObjectURL(f),d(h)},h.onerror=()=>{URL.revokeObjectURL(f),R(new Error("croppable-image-load-failed"))},h.src=f}),ne=async({file:c,fill:d,transform:R,viewport:f})=>{const h=await re(c),z=f.width/h.naturalWidth,Q=f.height/h.naturalHeight,j=Math.max(z,Q),q=h.naturalWidth*j,Y=h.naturalHeight*j,M=d==="width"?Math.max(Z,z/j):d==="height"?Math.max(Z,Q/j):Z,O=y(R.zoom,M,k),D=j*O,U=q*O,$=Y*O,st=(f.width-U)/2+R.offset.x,E=(f.height-$)/2+R.offset.y,F=y(-st/D,0,h.naturalWidth),T=y(-E/D,0,h.naturalHeight),_=y(f.width/D,1,Math.max(1,h.naturalWidth-F)),b=y(f.height/D,1,Math.max(1,h.naturalHeight-T)),P=document.createElement("canvas"),I=P.getContext("2d");if(!I)throw new Error("croppable-image-context-missing");P.width=Math.max(1,Math.round(_)),P.height=Math.max(1,Math.round(b)),I.drawImage(h,F,T,_,b,0,0,P.width,P.height);const g=c.type.startsWith("image/")?c.type:"image/jpeg",x=await new Promise(v=>{P.toBlob(v,g,ee)});if(!x)throw new Error("croppable-image-export-failed");return new globalThis.File([x],c.name,{lastModified:Date.now(),type:x.type||g})},oe="_croppable_i05ue_1",se="_empty_i05ue_15",ce="_action_i05ue_28",ie="_caption_i05ue_35",ae="_media_i05ue_42",ue="_viewport_i05ue_53",le="_draggable_i05ue_65",de="_dragging_i05ue_69",fe="_inner_i05ue_73",he="_standalone_i05ue_89",l={croppable:oe,empty:se,"drop-target":"_drop-target_i05ue_23",action:ce,caption:ie,media:ae,viewport:ue,draggable:le,dragging:de,inner:fe,standalone:he},pe=192,S={offset:{x:0,y:0},zoom:1},Lt=(c,d)=>(c==null?void 0:c.file)===d.file&&(c==null?void 0:c.source)===d.source&&(c==null?void 0:c.settings)===d.settings,me=({cancelLabel:c,children:d,deleteLabel:R,fill:f="none",height:h,image:z,isDeleting:Q,isSaving:j,onCroppableChange:q,onDelete:Y,onFileChange:M,onImageChange:O,onSave:D,onTransformChange:U,saveLabel:$,standalone:st,transform:E,uploadLabel:F})=>{const T=s.useRef(null),_=s.useRef(null),b=s.useRef(null),P=s.useRef(null),I=s.useRef(0),g=s.useRef(O),x=s.useRef(null),v=s.useRef(null),H=s.useRef(null),G=s.useRef(new Map),u=s.useRef(S),ct=s.useRef(null),[w,V]=s.useState(null),[it,at]=s.useState(null),[xt,C]=s.useState(!1),[St,ut]=s.useState(!1),[At,lt]=s.useState(S),[A,dt]=s.useState(null),[m,Nt]=s.useState({width:0,height:0}),[wt,ft]=s.useState(null),[J,tt]=s.useState(null),K=(()=>{const t=m.width,e=m.height;if(!t||!e)return{width:0,height:0,minZoom:Z};if(!w)return{width:t,height:e,minZoom:Z};const n=t/w.width,r=e/w.height,o=Math.max(n,r),a=f==="width"?n/o:f==="height"?r/o:0;return{width:w.width*o,height:w.height*o,minZoom:Math.max(Z,a)}})(),B=K.minZoom,N=E??At,W=y(N.zoom,B,k),et=it??z??null,yt=!d&&!!z&&!it&&!A,rt=!yt,_t=d??(et?i.jsx("img",{alt:"",draggable:!1,onLoad:t=>{const e=t.currentTarget;e.naturalWidth&&e.naturalHeight&&V({width:e.naturalWidth,height:e.naturalHeight})},src:et}):null),L=_t==null,ht={file:A,source:it,settings:JSON.stringify([f,W,N.offset.x,N.offset.y,m.width,m.height])};s.useEffect(()=>{!J||!z||z===J.image&&z!==J.crop.source||(ft(J.crop),tt(null))},[z,J]);const pt=(t,e)=>{const{maxX:n,maxY:r}=Rt(e);return{x:y(t.x,-n,n),y:y(t.y,-r,r)}},bt=(t,e)=>{const n=ct.current;if(!n)return null;const r=n.getBoundingClientRect(),o=t-r.left-r.width/2,a=e-r.top-r.height/2;return{x:o,y:a}},Wt=(t,e,n,r)=>{const o=y(e,B,k),a=y(n,B,k);if(o===0)return t;const p=a/o;return{x:(1-p)*r.x+p*t.x,y:(1-p)*r.y+p*t.y}},Xt=(t,e,n)=>{const r=u.current.zoom,o=y(t,B,k),a=u.current.offset,p=n?Wt(a,r,o,n):e,X=pt(p,o);u.current={zoom:o,offset:X},E||lt({zoom:o,offset:X}),U==null||U({zoom:o,offset:X})},nt=(t,e,n)=>{v.current={zoom:t,offset:e,anchor:n??null},_.current==null&&(_.current=window.requestAnimationFrame(()=>{_.current=null;const r=v.current;v.current=null;const o=(r==null?void 0:r.zoom)??u.current.zoom,a=(r==null?void 0:r.offset)??u.current.offset,p=(r==null?void 0:r.anchor)??null;Xt(o,a,p)}))},kt=t=>{if(L||!rt)return;const e=t.ctrlKey?.001:25e-5,n=u.current.zoom*Math.exp(-t.deltaY*e),r=bt(t.clientX,t.clientY);nt(n,u.current.offset,r)},Rt=t=>{const e=m.width,n=m.height;if(!e||!n)return{maxX:0,maxY:0};const r=y(t,B,k),o=K.width*r,a=K.height*r,p=Math.max(0,(o-e)/2),X=Math.max(0,(a-n)/2);return{maxX:p,maxY:X}},zt=t=>{if(tt(null),ft(null),x.current&&(URL.revokeObjectURL(x.current),x.current=null),!t){at(null),dt(null),M==null||M(null);return}const e=URL.createObjectURL(t);x.current=e,at(e),V(null),dt(t),nt(S.zoom,S.offset),u.current=S,M==null||M(t)},Yt=t=>{var e;zt(((e=t.target.files)==null?void 0:e[0])??null),t.target.value=""},Mt=t=>!j&&(Array.from(t.items??[]).some(e=>e.kind==="file"&&e.type.startsWith("image/"))||Array.from(t.files??[]).some(e=>e.type.startsWith("image/"))),vt=t=>{if(t.preventDefault(),t.stopPropagation(),I.current=0,ut(!1),j)return;const e=Array.from(t.dataTransfer.files).find(n=>n.type.startsWith("image/"));e&&zt(e)},jt=()=>{tt(null),ft(null),_.current!=null&&(window.cancelAnimationFrame(_.current),_.current=null),v.current=null,T.current=null,b.current=null,H.current=null,G.current.clear(),C(!1),x.current&&(URL.revokeObjectURL(x.current),x.current=null),at(null),V(null),dt(null),u.current=S,lt(S),U==null||U(S),M==null||M(null)},Ht=t=>{t.stopPropagation(),jt()},Bt=t=>{t.stopPropagation(),jt(),Y==null||Y()},Zt=t=>{if(!(L||!rt||t.pointerType==="mouse"&&t.button!==0)){if(t.currentTarget.setPointerCapture(t.pointerId),t.pointerType==="touch"){const e=G.current;if(e.set(t.pointerId,{x:t.clientX,y:t.clientY}),e.size===2){b.current=null,T.current=null,C(!1);const[n,r]=Array.from(e.values());H.current=Math.hypot(n.x-r.x,n.y-r.y);return}}T.current=t.pointerId,b.current={x:t.clientX,y:t.clientY,originX:u.current.offset.x,originY:u.current.offset.y}}},qt=t=>{if(L||!rt)return;if(t.pointerType==="touch"){const o=G.current;if(!o.has(t.pointerId))return;if(o.set(t.pointerId,{x:t.clientX,y:t.clientY}),o.size===2){const[a,p]=Array.from(o.values()),X=a.x-p.x,Gt=a.y-p.y,Ut=Math.hypot(X,Gt),It={x:(a.x+p.x)/2,y:(a.y+p.y)/2};if(H.current){const Jt=Ut/H.current,Kt=u.current.zoom*Jt,Qt=bt(It.x,It.y);nt(Kt,u.current.offset,Qt)}H.current=Ut;return}}if(T.current!==t.pointerId||!b.current||!mt)return;const e=t.clientX-b.current.x,n=t.clientY-b.current.y,r=Math.abs(e)+Math.abs(n);!xt&&r>2&&C(!0),!(r<=1)&&nt(u.current.zoom,{x:b.current.originX+e,y:b.current.originY+n})},Dt=t=>{t.pointerType==="touch"&&(G.current.delete(t.pointerId),G.current.size<2&&(H.current=null)),T.current===t.pointerId&&(T.current=null,b.current=null,C(!1))};s.useEffect(()=>{if(!E)return;const t=y(E.zoom,B,k);u.current={zoom:t,offset:pt(E.offset,t)}},[E,m.width,m.height,w==null?void 0:w.width,w==null?void 0:w.height]),s.useEffect(()=>()=>{x.current&&URL.revokeObjectURL(x.current)},[]),s.useEffect(()=>{const t=ct.current;if(!t)return;const e=()=>{const o=t.getBoundingClientRect();Nt(a=>a.width===o.width&&a.height===o.height?a:{width:o.width,height:o.height}),q&&q(o)};e();const n=()=>e();if(window.addEventListener("scroll",n,!0),typeof ResizeObserver>"u"){const o=()=>e();return window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",n,!0)}}const r=new ResizeObserver(()=>e());return r.observe(t),()=>{r.disconnect(),window.removeEventListener("scroll",n,!0)}},[q]),s.useEffect(()=>{if(E)return;const t=u.current.offset,e=pt(t,W);t.x===e.x&&t.y===e.y||(u.current={zoom:u.current.zoom,offset:e},lt(n=>({...n,offset:e})))},[W,w,m.width,m.height]),s.useEffect(()=>{et||V(null)},[et]),s.useEffect(()=>{g.current=O},[O]),s.useEffect(()=>{var n;if(!O)return;if(!A||!m.width||!m.height||d){(n=g.current)==null||n.call(g,null);return}let t=!0;const e=window.setTimeout(()=>{ne({file:A,fill:f,transform:{zoom:W,offset:N.offset},viewport:m}).then(r=>{var o;t&&((o=g.current)==null||o.call(g,r))}).catch(()=>{var r;t&&((r=g.current)==null||r.call(g,null))})},75);return()=>{t=!1,window.clearTimeout(e)}},[d,W,N.offset,f,A,m]),s.useEffect(()=>()=>{_.current!=null&&(window.cancelAnimationFrame(_.current),_.current=null)},[]);const Et=Rt(W),mt=!L&&rt&&(Et.maxX>0||Et.maxY>0),Tt=!L&&!yt&&!!D&&!Lt(wt,ht),Pt=!!z&&!d&&!!A&&!Lt(wt,ht),$t=!Pt&&!L&&!!(A||Y),Ot=()=>{var t;return(t=P.current)==null?void 0:t.click()},Ft=t=>{t.preventDefault(),t.stopPropagation(),Ot()};return i.jsxs("div",{className:gt(l.croppable,st&&l.standalone,St&&l["drop-target"]),onDragEnter:t=>{t.preventDefault(),t.stopPropagation(),I.current+=1,ut(Mt(t.dataTransfer))},onDragOver:t=>{t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=Mt(t.dataTransfer)?"copy":"none"},onDragLeave:t=>{t.preventDefault(),t.stopPropagation(),I.current=Math.max(0,I.current-1),I.current||ut(!1)},onDrop:vt,onClick:()=>{L&&Ot()},"data-component":"croppable",children:[i.jsx("input",{accept:"image/*",onChange:Yt,ref:P,type:"file"}),i.jsx("div",{className:l.viewport,ref:ct,onDragStart:t=>t.preventDefault(),onPointerDown:Zt,onPointerMove:qt,onPointerUp:Dt,onPointerCancel:Dt,onWheel:kt,style:{"--croppable-height":`${h??pe}px`,"--croppable-zoom":W,"--croppable-x":`${N.offset.x}px`,"--croppable-y":`${N.offset.y}px`,...w?{"--croppable-image-width":`${K.width}px`,"--croppable-image-height":`${K.height}px`}:null},children:L?i.jsx("div",{className:l.empty,children:i.jsx(Ct.Figure,{children:i.jsx(te.Icon,{name:"Image",size:"large"})})}):i.jsx("div",{className:gt(l.media,mt&&l.draggable,mt&&xt&&l.dragging),children:i.jsx("div",{className:gt(l.inner),children:_t})})}),i.jsxs(Vt.Toolbar,{children:[Tt&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{isLoading:j,"aria-label":$??"Save image",icon:"FloppyDisk",onClick:()=>{tt({image:z,crop:ht}),D==null||D()},variant:"primary"}),$&&i.jsx("span",{className:l.caption,children:$})]}),!Tt&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{"aria-label":F,icon:"UploadSimple",onClick:Ft,variant:"tertiary"}),i.jsx("span",{className:l.caption,children:F})]}),Pt&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{"aria-label":c??"Cancel changes",icon:"X",onClick:Ht,variant:"tertiary"}),c&&i.jsx("span",{className:l.caption,children:c})]}),$t&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{"aria-label":R??"Delete image",icon:"Trash",intent:"danger",isLoading:Q,onClick:Bt,variant:"tertiary"}),R&&i.jsx("span",{className:l.caption,children:R})]})]})]})};exports.Croppable=me;
|