@solibo/solibo-ui 1.1.6 → 1.1.7
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/index25.css +1 -1
- package/dist/components/avatar/index.cjs +1 -1
- package/dist/components/avatar/index.cjs.map +1 -1
- package/dist/components/avatar/index.js +43 -45
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/editor/index.cjs +1 -1
- package/dist/components/editor/index.cjs.map +1 -1
- package/dist/components/editor/index.js +1 -1
- package/dist/components/editor/index.js.map +1 -1
- package/dist/tokens.json +1 -1
- package/package.json +1 -1
package/dist/assets/index25.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._avatar_yz2kp_1{--avatar-size: var(--scale-40);align-items:center;display:inline-flex;gap:var(--scale-8);margin:0 var(--scale-4)}._avatar_yz2kp_1:has(._secondary_yz2kp_9){width:100%}:is(._color-1_yz2kp_14,._color-solibo_yz2kp_14) :is(._media_yz2kp_14,._role_yz2kp_14){background-color:var(--colors-semantic-roles-bg-solibo);color:var(--colors-semantic-roles-content-solibo)}:is(._color-2_yz2kp_19,._color-board_yz2kp_19) :is(._media_yz2kp_14,._role_yz2kp_14){background-color:var(--colors-semantic-roles-bg-board);color:var(--colors-semantic-roles-content-board)}:is(._color-3_yz2kp_24,._color-owner_yz2kp_24) :is(._media_yz2kp_14,._role_yz2kp_14){background-color:var(--colors-semantic-roles-bg-owner);color:var(--colors-semantic-roles-content-owner)}:is(._color-4_yz2kp_29,._color-renter_yz2kp_29) :is(._media_yz2kp_14,._role_yz2kp_14){background-color:var(--colors-semantic-roles-bg-renter);color:var(--colors-semantic-roles-content-renter)}:is(._color-5_yz2kp_34,._color-external_yz2kp_34) :is(._media_yz2kp_14,._role_yz2kp_14){background-color:var(--colors-semantic-roles-bg-external);color:var(--colors-semantic-roles-content-external)}._media_yz2kp_14{align-items:center;background-color:var(--colors-semantic-interactive-disabled);border-radius:var(--shape-border-radius-radius-md);display:inline-flex;flex:0 0 var(--avatar-size);height:var(--avatar-size);justify-content:center;overflow:hidden;width:var(--avatar-size)}._media_yz2kp_14>figure{align-items:center;display:flex;height:100%;justify-content:center;width:100%}._media_yz2kp_14>figure>img{height:100%}._details_yz2kp_63{display:flex;flex-direction:column;min-width:0;width:100%}._details_yz2kp_63>strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._secondary_yz2kp_9{align-items:center;display:flex;gap:var(--scale-8);justify-content:space-between;min-width:0;width:100%}._text_yz2kp_85{color:var(--colors-semantic-content-tertiary);font-size:var(--typography-font-sizes-label-sm);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._role_yz2kp_14,._role-name_yz2kp_94{text-transform:capitalize}._role_yz2kp_14{background-color:var(--colors-semantic-interactive-disabled);border-radius:var(--scale-32);color:var(--colors-semantic-content-secondary);display:block;overflow:hidden;padding:var(--shape-spacing-2xs) var(--shape-spacing-xs);text-overflow:ellipsis;white-space:nowrap;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}._initials_yz2kp_110{font-weight:var(--font-font-weight-semibold)}._small_yz2kp_114{--avatar-size: var(--scale-40)}._small_yz2kp_114 ._initials_yz2kp_110{font-size:var(--typography-font-sizes-label-sm)}._medium_yz2kp_122{--avatar-size: var(--scale-56)}._medium_yz2kp_122 ._details_yz2kp_63{gap:var(--shape-spacing-xs)}._medium_yz2kp_122 ._initials_yz2kp_110{font-size:var(--typography-font-sizes-label-lg)}._large_yz2kp_134{--avatar-size: var(--scale-96)}._large_yz2kp_134 ._details_yz2kp_63{gap:var(--shape-spacing-sm)}._large_yz2kp_134 ._details_yz2kp_63>strong{font-size:var(--typography-font-sizes-h3)}._large_yz2kp_134 ._initials_yz2kp_110{font-size:var(--typography-font-sizes-h3)}._large_yz2kp_134 ._text_yz2kp_85{font-size:var(--typography-font-sizes-label-lg)}._link_yz2kp_154{text-decoration:none}._link_yz2kp_154>._avatar_yz2kp_1{background-color:transparent}@media (width <= 480px){._secondary_yz2kp_9{flex-direction:column;align-items:start}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index25.css');const s=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index25.css');const s=require("react/jsx-runtime"),u=require("../../classix-5H4IWnMA.cjs"),x=require("../figure/index.cjs"),y=require("../icon/index.cjs"),z=require("../link/index.cjs"),g="_avatar_yz2kp_1",j="_secondary_yz2kp_9",h="_media_yz2kp_14",v="_role_yz2kp_14",N="_details_yz2kp_63",b="_text_yz2kp_85",f="_initials_yz2kp_110",q="_small_yz2kp_114",A="_medium_yz2kp_122",I="_large_yz2kp_134",L="_link_yz2kp_154",a={avatar:g,secondary:j,"color-1":"_color-1_yz2kp_14","color-solibo":"_color-solibo_yz2kp_14",media:h,role:v,"color-2":"_color-2_yz2kp_19","color-board":"_color-board_yz2kp_19","color-3":"_color-3_yz2kp_24","color-owner":"_color-owner_yz2kp_24","color-4":"_color-4_yz2kp_29","color-renter":"_color-renter_yz2kp_29","color-5":"_color-5_yz2kp_34","color-external":"_color-external_yz2kp_34",details:N,text:b,"role-name":"_role-name_yz2kp_94",initials:f,small:q,medium:A,large:I,link:L},S={large:a.large,medium:a.medium,small:a.small},k={large:"large",medium:"medium",small:"medium"},$=i=>{const e=i.trim().split(/\s+/).filter(Boolean),c=Array.from(e[0]??"")[0]??"",t=e.length>1?Array.from(e[e.length-1])[0]:"";return`${c}${t}`.toLocaleUpperCase()},w=({accessibleLabel:i,color:e,icon:c,imageUrl:t,link:_,name:r,role:o,size:l="small",text:n})=>{const m=i||r||"User Avatar",d=r?$(r):"",p=s.jsxs("div",{className:u.t(a.avatar,S[l],e&&a[`color-${e}`]),"data-color":e,"data-size":l,children:[s.jsx("span",{className:a.media,children:s.jsx(x.Figure,{accessibleLabel:m,children:c?s.jsx(y.Icon,{name:c,size:k[l]}):t?s.jsx("img",{src:t,alt:m}):d?s.jsx("span",{"aria-hidden":"true",className:a.initials,children:d}):s.jsx(y.Icon,{name:"User",size:k[l]})})}),(r||o||n)&&s.jsxs("span",{className:a.details,children:[r&&s.jsx("strong",{children:r}),l==="small"&&(n||o)&&s.jsxs("span",{className:a.text,children:[n,n&&o&&" | ",o&&s.jsx("span",{className:a["role-name"],children:o})]}),(l==="medium"||l==="large")&&s.jsxs("span",{className:a.secondary,children:[n&&s.jsx("span",{className:a.text,children:n}),o&&s.jsx("span",{className:a.role,children:o})]})]})]});return _?s.jsx(z.Link,{className:a.link,to:_,"data-component":"avatar",children:p}):p};exports.Avatar=w;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/avatar/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { Figure } from '@/components/figure';\nimport { Icon, type IconProps } from '@/components/icon';\nimport { Link } from '@/components/link';\n\nimport styles from './styles.module.css';\n\nexport type AvatarColor =\n | 'solibo'\n | 'board'\n | 'owner'\n | 'renter'\n | 'external'\n | '1'\n | '2'\n | '3'\n | '4'\n | '5';\n\nexport type AvatarSize = 'small' | 'medium' | 'large';\n\nexport type AvatarProps = {\n accessibleLabel?: string;\n color?: AvatarColor;\n icon?: IconProps['name'];\n imageUrl?: string;\n link?: string;\n name?: string;\n role?: string;\n size?: AvatarSize;\n text?: string;\n};\n\nconst sizes: Record<AvatarSize, string> = {\n large: styles.large,\n medium: styles.medium,\n small: styles.small,\n};\n\nconst iconSizes: Record<AvatarSize, NonNullable<IconProps['size']>> = {\n large: 'large',\n medium: 'medium',\n small: 'medium',\n};\n\nconst getInitials = (name: string) => {\n const nameParts = name.trim().split(/\\s+/).filter(Boolean);\n const firstInitial = Array.from(nameParts[0] ?? '')[0] ?? '';\n const lastInitial = nameParts.length > 1 ? Array.from(nameParts[nameParts.length - 1])[0] : '';\n\n return `${firstInitial}${lastInitial}`.toLocaleUpperCase();\n};\n\nexport const Avatar = ({\n accessibleLabel,\n color,\n icon,\n imageUrl,\n link,\n name,\n role,\n size = 'small',\n text,\n}: AvatarProps) => {\n const avatarLabel = accessibleLabel || name || 'User Avatar';\n const initials = name ? getInitials(name) : '';\n\n const avatarFigure = (\n <div\n className={cx(styles.avatar, sizes[size], color && styles[`color-${color}`])}\n data-color={color}\n data-size={size}\n >\n <span className={styles.media}>\n <Figure accessibleLabel={avatarLabel}>\n {icon ? (\n <Icon\n name={icon}\n size={iconSizes[size]}\n />\n ) : imageUrl ? (\n <img\n src={imageUrl}\n alt={avatarLabel}\n />\n ) : initials ? (\n <span\n aria-hidden='true'\n className={styles.initials}\n >\n {initials}\n </span>\n ) : (\n <Icon\n name='User'\n size={iconSizes[size]}\n />\n )}\n </Figure>\n </span>\n {(name || role || text) && (\n <span className={styles.details}>\n {name && <strong>{name}</strong>}\n {size === 'small' && (text || role) && (\n <span className={styles.text}>\n {text}\n {text && role && ' | '}\n {role && <span className={styles['role-name']}>{role}</span>}\n </span>\n )}\n {size === 'medium' && (\n <span className={styles.secondary}>\n {text && <span className={styles.text}>{text}</span>}\n {role && <span className={styles.role}>{role}</span>}\n </span>\n )}\n
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/avatar/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { Figure } from '@/components/figure';\nimport { Icon, type IconProps } from '@/components/icon';\nimport { Link } from '@/components/link';\n\nimport styles from './styles.module.css';\n\nexport type AvatarColor =\n | 'solibo'\n | 'board'\n | 'owner'\n | 'renter'\n | 'external'\n | '1'\n | '2'\n | '3'\n | '4'\n | '5';\n\nexport type AvatarSize = 'small' | 'medium' | 'large';\n\nexport type AvatarProps = {\n accessibleLabel?: string;\n color?: AvatarColor;\n icon?: IconProps['name'];\n imageUrl?: string;\n link?: string;\n name?: string;\n role?: string;\n size?: AvatarSize;\n text?: string;\n};\n\nconst sizes: Record<AvatarSize, string> = {\n large: styles.large,\n medium: styles.medium,\n small: styles.small,\n};\n\nconst iconSizes: Record<AvatarSize, NonNullable<IconProps['size']>> = {\n large: 'large',\n medium: 'medium',\n small: 'medium',\n};\n\nconst getInitials = (name: string) => {\n const nameParts = name.trim().split(/\\s+/).filter(Boolean);\n const firstInitial = Array.from(nameParts[0] ?? '')[0] ?? '';\n const lastInitial = nameParts.length > 1 ? Array.from(nameParts[nameParts.length - 1])[0] : '';\n\n return `${firstInitial}${lastInitial}`.toLocaleUpperCase();\n};\n\nexport const Avatar = ({\n accessibleLabel,\n color,\n icon,\n imageUrl,\n link,\n name,\n role,\n size = 'small',\n text,\n}: AvatarProps) => {\n const avatarLabel = accessibleLabel || name || 'User Avatar';\n const initials = name ? getInitials(name) : '';\n\n const avatarFigure = (\n <div\n className={cx(styles.avatar, sizes[size], color && styles[`color-${color}`])}\n data-color={color}\n data-size={size}\n >\n <span className={styles.media}>\n <Figure accessibleLabel={avatarLabel}>\n {icon ? (\n <Icon\n name={icon}\n size={iconSizes[size]}\n />\n ) : imageUrl ? (\n <img\n src={imageUrl}\n alt={avatarLabel}\n />\n ) : initials ? (\n <span\n aria-hidden='true'\n className={styles.initials}\n >\n {initials}\n </span>\n ) : (\n <Icon\n name='User'\n size={iconSizes[size]}\n />\n )}\n </Figure>\n </span>\n {(name || role || text) && (\n <span className={styles.details}>\n {name && <strong>{name}</strong>}\n {size === 'small' && (text || role) && (\n <span className={styles.text}>\n {text}\n {text && role && ' | '}\n {role && <span className={styles['role-name']}>{role}</span>}\n </span>\n )}\n {(size === 'medium' || size === 'large') && (\n <span className={styles.secondary}>\n {text && <span className={styles.text}>{text}</span>}\n {role && <span className={styles.role}>{role}</span>}\n </span>\n )}\n </span>\n )}\n </div>\n );\n\n return link ? (\n <Link\n className={styles.link}\n to={link}\n >\n {avatarFigure}\n </Link>\n ) : (\n avatarFigure\n );\n};\n"],"names":["sizes","large","styles","medium","small","iconSizes","getInitials","name","nameParts","trim","split","filter","Boolean","firstInitial","Array","from","lastInitial","length","toLocaleUpperCase","Avatar","accessibleLabel","color","icon","imageUrl","link","role","size","text","avatarLabel","initials","avatarFigure","cx","avatar","jsx","media","Figure","Icon","details","secondary","Link"],"mappings":"u8BAkCMA,EAAoC,CACxCC,MAAOC,EAAOD,MACdE,OAAQD,EAAOC,OACfC,MAAOF,EAAOE,KAChB,EAEMC,EAAgE,CACpEJ,MAAO,QACPE,OAAQ,SACRC,MAAO,QACT,EAEME,EAAeC,GAAiB,CACpC,MAAMC,EAAYD,EAAKE,KAAAA,EAAOC,MAAM,KAAK,EAAEC,OAAOC,OAAO,EACnDC,EAAeC,MAAMC,KAAKP,EAAU,CAAC,GAAK,EAAE,EAAE,CAAC,GAAK,GACpDQ,EAAcR,EAAUS,OAAS,EAAIH,MAAMC,KAAKP,EAAUA,EAAUS,OAAS,CAAC,CAAC,EAAE,CAAC,EAAI,GAE5F,MAAO,GAAGJ,CAAY,GAAGG,CAAW,GAAGE,kBAAAA,CACzC,EAEaC,EAASA,CAAC,CACrBC,gBAAAA,EACAC,MAAAA,EACAC,KAAAA,EACAC,SAAAA,EACAC,KAAAA,EACAjB,KAAAA,EACAkB,KAAAA,EACAC,KAAAA,EAAO,QACPC,KAAAA,CACW,IAAM,CACjB,MAAMC,EAAcR,GAAmBb,GAAQ,cACzCsB,EAAWtB,EAAOD,EAAYC,CAAI,EAAI,GAEtCuB,SACH,MAAA,CACC,UAAWC,EAAAA,EAAG7B,EAAO8B,OAAQhC,EAAM0B,CAAI,EAAGL,GAASnB,EAAO,SAASmB,CAAK,EAAE,CAAC,EAC3E,aAAYA,EACZ,YAAWK,EAEX,SAAA,CAAAO,EAAAA,IAAC,OAAA,CAAK,UAAW/B,EAAOgC,MACtB,eAACC,EAAAA,OAAA,CAAO,gBAAiBP,EACtBN,SAAAA,EACCW,EAAAA,IAACG,QACC,KAAMd,EACN,KAAMjB,EAAUqB,CAAI,EAAE,EAEtBH,QACD,MAAA,CACC,IAAKA,EACL,IAAKK,EAAY,EAEjBC,EACFI,EAAAA,IAAC,QACC,cAAY,OACZ,UAAW/B,EAAO2B,SAEjBA,WACH,EAEAI,EAAAA,IAACG,EAAAA,MACC,KAAK,OACL,KAAM/B,EAAUqB,CAAI,EAAE,CAAA,CAG5B,CAAA,CACF,GACEnB,GAAQkB,GAAQE,WACf,OAAA,CAAK,UAAWzB,EAAOmC,QACrB9B,SAAAA,CAAAA,GAAQ0B,EAAAA,IAAC,UAAQ1B,SAAAA,CAAAA,CAAK,EACtBmB,IAAS,UAAYC,GAAQF,WAC3B,OAAA,CAAK,UAAWvB,EAAOyB,KACrBA,SAAAA,CAAAA,EACAA,GAAQF,GAAQ,MAChBA,GAAQQ,EAAAA,IAAC,OAAA,CAAK,UAAW/B,EAAO,WAAW,EAAIuB,SAAAA,CAAAA,CAAK,CAAA,EACvD,GAEAC,IAAS,UAAYA,IAAS,iBAC7B,OAAA,CAAK,UAAWxB,EAAOoC,UACrBX,SAAAA,CAAAA,GAAQM,EAAAA,IAAC,OAAA,CAAK,UAAW/B,EAAOyB,KAAOA,SAAAA,EAAK,EAC5CF,GAAQQ,EAAAA,IAAC,OAAA,CAAK,UAAW/B,EAAOuB,KAAOA,SAAAA,CAAAA,CAAK,CAAA,CAAA,CAC/C,CAAA,CAAA,CAEJ,CAAA,EAEJ,EAGF,OAAOD,EACLS,EAAAA,IAACM,EAAAA,KAAA,CACC,UAAWrC,EAAOsB,KAClB,GAAIA,EAAK,iBAAA,SAERM,SAAAA,CAAAA,CACH,EAEAA,CAEJ"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { jsx as l, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import { t as h } from "../../classix-DG18itHa.js";
|
|
3
3
|
import { Figure as g } from "../figure/index.js";
|
|
4
|
-
import { Icon as
|
|
4
|
+
import { Icon as k } from "../icon/index.js";
|
|
5
5
|
import { Link as u } from "../link/index.js";
|
|
6
|
-
import '../../assets/index25.css';const
|
|
7
|
-
avatar:
|
|
8
|
-
|
|
9
|
-
"color-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"color-
|
|
14
|
-
"color-
|
|
15
|
-
"color-
|
|
16
|
-
"color-
|
|
17
|
-
"color-
|
|
18
|
-
"color-
|
|
19
|
-
"color-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
text:
|
|
23
|
-
"role-name": "_role-
|
|
24
|
-
initials:
|
|
25
|
-
small:
|
|
26
|
-
medium:
|
|
27
|
-
large:
|
|
28
|
-
link:
|
|
29
|
-
},
|
|
6
|
+
import '../../assets/index25.css';const v = "_avatar_yz2kp_1", N = "_secondary_yz2kp_9", f = "_media_yz2kp_14", b = "_role_yz2kp_14", x = "_details_yz2kp_63", A = "_text_yz2kp_85", I = "_initials_yz2kp_110", L = "_small_yz2kp_114", $ = "_medium_yz2kp_122", j = "_large_yz2kp_134", w = "_link_yz2kp_154", a = {
|
|
7
|
+
avatar: v,
|
|
8
|
+
secondary: N,
|
|
9
|
+
"color-1": "_color-1_yz2kp_14",
|
|
10
|
+
"color-solibo": "_color-solibo_yz2kp_14",
|
|
11
|
+
media: f,
|
|
12
|
+
role: b,
|
|
13
|
+
"color-2": "_color-2_yz2kp_19",
|
|
14
|
+
"color-board": "_color-board_yz2kp_19",
|
|
15
|
+
"color-3": "_color-3_yz2kp_24",
|
|
16
|
+
"color-owner": "_color-owner_yz2kp_24",
|
|
17
|
+
"color-4": "_color-4_yz2kp_29",
|
|
18
|
+
"color-renter": "_color-renter_yz2kp_29",
|
|
19
|
+
"color-5": "_color-5_yz2kp_34",
|
|
20
|
+
"color-external": "_color-external_yz2kp_34",
|
|
21
|
+
details: x,
|
|
22
|
+
text: A,
|
|
23
|
+
"role-name": "_role-name_yz2kp_94",
|
|
24
|
+
initials: I,
|
|
25
|
+
small: L,
|
|
26
|
+
medium: $,
|
|
27
|
+
large: j,
|
|
28
|
+
link: w
|
|
29
|
+
}, F = {
|
|
30
30
|
large: a.large,
|
|
31
31
|
medium: a.medium,
|
|
32
32
|
small: a.small
|
|
@@ -34,38 +34,36 @@ import '../../assets/index25.css';const N = "_avatar_12qzb_1", v = "_media_12qzb
|
|
|
34
34
|
large: "large",
|
|
35
35
|
medium: "medium",
|
|
36
36
|
small: "medium"
|
|
37
|
-
},
|
|
38
|
-
const o = _.trim().split(/\s+/).filter(Boolean),
|
|
39
|
-
return `${
|
|
37
|
+
}, U = (_) => {
|
|
38
|
+
const o = _.trim().split(/\s+/).filter(Boolean), t = Array.from(o[0] ?? "")[0] ?? "", c = o.length > 1 ? Array.from(o[o.length - 1])[0] : "";
|
|
39
|
+
return `${t}${c}`.toLocaleUpperCase();
|
|
40
40
|
}, D = ({
|
|
41
41
|
accessibleLabel: _,
|
|
42
42
|
color: o,
|
|
43
|
-
icon:
|
|
44
|
-
imageUrl:
|
|
43
|
+
icon: t,
|
|
44
|
+
imageUrl: c,
|
|
45
45
|
link: m,
|
|
46
|
-
name:
|
|
46
|
+
name: e,
|
|
47
47
|
role: r,
|
|
48
48
|
size: s = "small",
|
|
49
|
-
text:
|
|
49
|
+
text: n
|
|
50
50
|
}) => {
|
|
51
|
-
const d = _ ||
|
|
52
|
-
/* @__PURE__ */ l("span", { className: a.media, children: /* @__PURE__ */ l(g, { accessibleLabel: d, children:
|
|
53
|
-
(
|
|
54
|
-
|
|
55
|
-
s === "small" && (
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
const d = _ || e || "User Avatar", p = e ? U(e) : "", y = /* @__PURE__ */ i("div", { className: h(a.avatar, F[s], o && a[`color-${o}`]), "data-color": o, "data-size": s, children: [
|
|
52
|
+
/* @__PURE__ */ l("span", { className: a.media, children: /* @__PURE__ */ l(g, { accessibleLabel: d, children: t ? /* @__PURE__ */ l(k, { name: t, size: z[s] }) : c ? /* @__PURE__ */ l("img", { src: c, alt: d }) : p ? /* @__PURE__ */ l("span", { "aria-hidden": "true", className: a.initials, children: p }) : /* @__PURE__ */ l(k, { name: "User", size: z[s] }) }) }),
|
|
53
|
+
(e || r || n) && /* @__PURE__ */ i("span", { className: a.details, children: [
|
|
54
|
+
e && /* @__PURE__ */ l("strong", { children: e }),
|
|
55
|
+
s === "small" && (n || r) && /* @__PURE__ */ i("span", { className: a.text, children: [
|
|
56
|
+
n,
|
|
57
|
+
n && r && " | ",
|
|
58
58
|
r && /* @__PURE__ */ l("span", { className: a["role-name"], children: r })
|
|
59
59
|
] }),
|
|
60
|
-
s === "medium" && /* @__PURE__ */ i("span", { className: a.secondary, children: [
|
|
61
|
-
|
|
60
|
+
(s === "medium" || s === "large") && /* @__PURE__ */ i("span", { className: a.secondary, children: [
|
|
61
|
+
n && /* @__PURE__ */ l("span", { className: a.text, children: n }),
|
|
62
62
|
r && /* @__PURE__ */ l("span", { className: a.role, children: r })
|
|
63
|
-
] })
|
|
64
|
-
s === "large" && r && /* @__PURE__ */ l("span", { className: a.role, children: r }),
|
|
65
|
-
s === "large" && e && /* @__PURE__ */ l("span", { className: a.text, children: e })
|
|
63
|
+
] })
|
|
66
64
|
] })
|
|
67
65
|
] });
|
|
68
|
-
return m ? /* @__PURE__ */ l(u, { className: a.link, to: m, "data-component": "avatar", children:
|
|
66
|
+
return m ? /* @__PURE__ */ l(u, { className: a.link, to: m, "data-component": "avatar", children: y }) : y;
|
|
69
67
|
};
|
|
70
68
|
export {
|
|
71
69
|
D as Avatar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/avatar/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { Figure } from '@/components/figure';\nimport { Icon, type IconProps } from '@/components/icon';\nimport { Link } from '@/components/link';\n\nimport styles from './styles.module.css';\n\nexport type AvatarColor =\n | 'solibo'\n | 'board'\n | 'owner'\n | 'renter'\n | 'external'\n | '1'\n | '2'\n | '3'\n | '4'\n | '5';\n\nexport type AvatarSize = 'small' | 'medium' | 'large';\n\nexport type AvatarProps = {\n accessibleLabel?: string;\n color?: AvatarColor;\n icon?: IconProps['name'];\n imageUrl?: string;\n link?: string;\n name?: string;\n role?: string;\n size?: AvatarSize;\n text?: string;\n};\n\nconst sizes: Record<AvatarSize, string> = {\n large: styles.large,\n medium: styles.medium,\n small: styles.small,\n};\n\nconst iconSizes: Record<AvatarSize, NonNullable<IconProps['size']>> = {\n large: 'large',\n medium: 'medium',\n small: 'medium',\n};\n\nconst getInitials = (name: string) => {\n const nameParts = name.trim().split(/\\s+/).filter(Boolean);\n const firstInitial = Array.from(nameParts[0] ?? '')[0] ?? '';\n const lastInitial = nameParts.length > 1 ? Array.from(nameParts[nameParts.length - 1])[0] : '';\n\n return `${firstInitial}${lastInitial}`.toLocaleUpperCase();\n};\n\nexport const Avatar = ({\n accessibleLabel,\n color,\n icon,\n imageUrl,\n link,\n name,\n role,\n size = 'small',\n text,\n}: AvatarProps) => {\n const avatarLabel = accessibleLabel || name || 'User Avatar';\n const initials = name ? getInitials(name) : '';\n\n const avatarFigure = (\n <div\n className={cx(styles.avatar, sizes[size], color && styles[`color-${color}`])}\n data-color={color}\n data-size={size}\n >\n <span className={styles.media}>\n <Figure accessibleLabel={avatarLabel}>\n {icon ? (\n <Icon\n name={icon}\n size={iconSizes[size]}\n />\n ) : imageUrl ? (\n <img\n src={imageUrl}\n alt={avatarLabel}\n />\n ) : initials ? (\n <span\n aria-hidden='true'\n className={styles.initials}\n >\n {initials}\n </span>\n ) : (\n <Icon\n name='User'\n size={iconSizes[size]}\n />\n )}\n </Figure>\n </span>\n {(name || role || text) && (\n <span className={styles.details}>\n {name && <strong>{name}</strong>}\n {size === 'small' && (text || role) && (\n <span className={styles.text}>\n {text}\n {text && role && ' | '}\n {role && <span className={styles['role-name']}>{role}</span>}\n </span>\n )}\n {size === 'medium' && (\n <span className={styles.secondary}>\n {text && <span className={styles.text}>{text}</span>}\n {role && <span className={styles.role}>{role}</span>}\n </span>\n )}\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/avatar/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { Figure } from '@/components/figure';\nimport { Icon, type IconProps } from '@/components/icon';\nimport { Link } from '@/components/link';\n\nimport styles from './styles.module.css';\n\nexport type AvatarColor =\n | 'solibo'\n | 'board'\n | 'owner'\n | 'renter'\n | 'external'\n | '1'\n | '2'\n | '3'\n | '4'\n | '5';\n\nexport type AvatarSize = 'small' | 'medium' | 'large';\n\nexport type AvatarProps = {\n accessibleLabel?: string;\n color?: AvatarColor;\n icon?: IconProps['name'];\n imageUrl?: string;\n link?: string;\n name?: string;\n role?: string;\n size?: AvatarSize;\n text?: string;\n};\n\nconst sizes: Record<AvatarSize, string> = {\n large: styles.large,\n medium: styles.medium,\n small: styles.small,\n};\n\nconst iconSizes: Record<AvatarSize, NonNullable<IconProps['size']>> = {\n large: 'large',\n medium: 'medium',\n small: 'medium',\n};\n\nconst getInitials = (name: string) => {\n const nameParts = name.trim().split(/\\s+/).filter(Boolean);\n const firstInitial = Array.from(nameParts[0] ?? '')[0] ?? '';\n const lastInitial = nameParts.length > 1 ? Array.from(nameParts[nameParts.length - 1])[0] : '';\n\n return `${firstInitial}${lastInitial}`.toLocaleUpperCase();\n};\n\nexport const Avatar = ({\n accessibleLabel,\n color,\n icon,\n imageUrl,\n link,\n name,\n role,\n size = 'small',\n text,\n}: AvatarProps) => {\n const avatarLabel = accessibleLabel || name || 'User Avatar';\n const initials = name ? getInitials(name) : '';\n\n const avatarFigure = (\n <div\n className={cx(styles.avatar, sizes[size], color && styles[`color-${color}`])}\n data-color={color}\n data-size={size}\n >\n <span className={styles.media}>\n <Figure accessibleLabel={avatarLabel}>\n {icon ? (\n <Icon\n name={icon}\n size={iconSizes[size]}\n />\n ) : imageUrl ? (\n <img\n src={imageUrl}\n alt={avatarLabel}\n />\n ) : initials ? (\n <span\n aria-hidden='true'\n className={styles.initials}\n >\n {initials}\n </span>\n ) : (\n <Icon\n name='User'\n size={iconSizes[size]}\n />\n )}\n </Figure>\n </span>\n {(name || role || text) && (\n <span className={styles.details}>\n {name && <strong>{name}</strong>}\n {size === 'small' && (text || role) && (\n <span className={styles.text}>\n {text}\n {text && role && ' | '}\n {role && <span className={styles['role-name']}>{role}</span>}\n </span>\n )}\n {(size === 'medium' || size === 'large') && (\n <span className={styles.secondary}>\n {text && <span className={styles.text}>{text}</span>}\n {role && <span className={styles.role}>{role}</span>}\n </span>\n )}\n </span>\n )}\n </div>\n );\n\n return link ? (\n <Link\n className={styles.link}\n to={link}\n >\n {avatarFigure}\n </Link>\n ) : (\n avatarFigure\n );\n};\n"],"names":["sizes","large","styles","medium","small","iconSizes","getInitials","name","nameParts","trim","split","filter","Boolean","firstInitial","Array","from","lastInitial","length","toLocaleUpperCase","Avatar","accessibleLabel","color","icon","imageUrl","link","role","size","text","avatarLabel","initials","avatarFigure","cx","avatar","jsx","media","Figure","Icon","details","secondary","Link"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCMA,IAAoC;AAAA,EACxCC,OAAOC,EAAOD;AAAAA,EACdE,QAAQD,EAAOC;AAAAA,EACfC,OAAOF,EAAOE;AAChB,GAEMC,IAAgE;AAAA,EACpEJ,OAAO;AAAA,EACPE,QAAQ;AAAA,EACRC,OAAO;AACT,GAEME,IAAcA,CAACC,MAAiB;AACpC,QAAMC,IAAYD,EAAKE,KAAAA,EAAOC,MAAM,KAAK,EAAEC,OAAOC,OAAO,GACnDC,IAAeC,MAAMC,KAAKP,EAAU,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IACpDQ,IAAcR,EAAUS,SAAS,IAAIH,MAAMC,KAAKP,EAAUA,EAAUS,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI;AAE5F,SAAO,GAAGJ,CAAY,GAAGG,CAAW,GAAGE,kBAAAA;AACzC,GAEaC,IAASA,CAAC;AAAA,EACrBC,iBAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,MAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,MAAAA;AAAAA,EACAjB,MAAAA;AAAAA,EACAkB,MAAAA;AAAAA,EACAC,MAAAA,IAAO;AAAA,EACPC,MAAAA;AACW,MAAM;AACjB,QAAMC,IAAcR,KAAmBb,KAAQ,eACzCsB,IAAWtB,IAAOD,EAAYC,CAAI,IAAI,IAEtCuB,sBACH,OAAA,EACC,WAAWC,EAAG7B,EAAO8B,QAAQhC,EAAM0B,CAAI,GAAGL,KAASnB,EAAO,SAASmB,CAAK,EAAE,CAAC,GAC3E,cAAYA,GACZ,aAAWK,GAEX,UAAA;AAAA,IAAA,gBAAAO,EAAC,QAAA,EAAK,WAAW/B,EAAOgC,OACtB,4BAACC,GAAA,EAAO,iBAAiBP,GACtBN,UAAAA,IACC,gBAAAW,EAACG,KACC,MAAMd,GACN,MAAMjB,EAAUqB,CAAI,GAAE,IAEtBH,sBACD,OAAA,EACC,KAAKA,GACL,KAAKK,GAAY,IAEjBC,IACF,gBAAAI,EAAC,UACC,eAAY,QACZ,WAAW/B,EAAO2B,UAEjBA,aACH,IAEA,gBAAAI,EAACG,KACC,MAAK,QACL,MAAM/B,EAAUqB,CAAI,GAAE,EAAA,CAG5B,EAAA,CACF;AAAA,KACEnB,KAAQkB,KAAQE,wBACf,QAAA,EAAK,WAAWzB,EAAOmC,SACrB9B,UAAAA;AAAAA,MAAAA,KAAQ,gBAAA0B,EAAC,YAAQ1B,UAAAA,EAAAA,CAAK;AAAA,MACtBmB,MAAS,YAAYC,KAAQF,wBAC3B,QAAA,EAAK,WAAWvB,EAAOyB,MACrBA,UAAAA;AAAAA,QAAAA;AAAAA,QACAA,KAAQF,KAAQ;AAAA,QAChBA,KAAQ,gBAAAQ,EAAC,QAAA,EAAK,WAAW/B,EAAO,WAAW,GAAIuB,UAAAA,EAAAA,CAAK;AAAA,MAAA,GACvD;AAAA,OAEAC,MAAS,YAAYA,MAAS,8BAC7B,QAAA,EAAK,WAAWxB,EAAOoC,WACrBX,UAAAA;AAAAA,QAAAA,KAAQ,gBAAAM,EAAC,QAAA,EAAK,WAAW/B,EAAOyB,MAAOA,UAAAA,GAAK;AAAA,QAC5CF,KAAQ,gBAAAQ,EAAC,QAAA,EAAK,WAAW/B,EAAOuB,MAAOA,UAAAA,EAAAA,CAAK;AAAA,MAAA,EAAA,CAC/C;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,GAEJ;AAGF,SAAOD,IACL,gBAAAS,EAACM,GAAA,EACC,WAAWrC,EAAOsB,MAClB,IAAIA,GAAK,kBAAA,UAERM,UAAAA,EAAAA,CACH,IAEAA;AAEJ;"}
|
|
@@ -54,5 +54,5 @@ vulnerable to XSS attacks. Please remove it from \`allowedTags\`.
|
|
|
54
54
|
Or, to disable this warning, add the \`allowVulnerableTags\` option
|
|
55
55
|
and ensure you are accounting for this risk.
|
|
56
56
|
|
|
57
|
-
`)});const o=e.nonTextTags||["script","style","textarea","option"];let a,l;e.allowedAttributes&&(a={},l={},sn(e.allowedAttributes,function(_,O){a[O]=[];const N=[];_.forEach(function(U){typeof U=="string"&&U.indexOf("*")>=0?N.push(Fa(U).replace(/\\\*/g,".*")):a[O].push(U)}),N.length&&(l[O]=new RegExp("^("+N.join("|")+")$"))}));const f={},h={},c={};sn(e.allowedClasses,function(_,O){if(a&&(st(a,O)||(a[O]=[]),a[O].push("class")),f[O]=_,Array.isArray(_)){const N=[];f[O]=[],c[O]=[],_.forEach(function(U){typeof U=="string"&&U.indexOf("*")>=0?N.push(Fa(U).replace(/\\\*/g,".*")):U instanceof RegExp?c[O].push(U):f[O].push(U)}),N.length&&(h[O]=new RegExp("^("+N.join("|")+")$"))}});const d={};let p;sn(e.transformTags,function(_,O){let N;typeof _=="function"?N=_:typeof _=="string"&&(N=nr.simpleTransform(_)),O==="*"?p=N:d[O]=N});let m,g,y,b,v,w,S=!1;I();const T=new R1.Parser({onopentag:function(_,O){if(e.onOpenTag&&e.onOpenTag(_,O),e.enforceHtmlBoundary&&_==="html"&&I(),v){w++;return}const N=new i(_,O);g.push(N);let U=!1;const Y=!!N.text;let ee;if(st(d,_)&&(ee=d[_](_,O),N.attribs=O=ee.attribs,ee.text!==void 0&&(N.innerText=ee.text),_!==ee.tagName&&(N.name=_=ee.tagName,b[m]=ee.tagName)),p&&(ee=p(_,O),N.attribs=O=ee.attribs,_!==ee.tagName&&(N.name=_=ee.tagName,b[m]=ee.tagName)),(!s(_)||e.disallowedTagsMode==="recursiveEscape"&&!z1(y)||e.nestingLimit!=null&&m>=e.nestingLimit)&&(U=!0,y[m]=!0,(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&o.indexOf(_)!==-1&&(v=!0,w=1)),m++,U){if(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){if(N.innerText&&!Y){const H=C(N.innerText);e.textFilter?r+=e.textFilter(H,_):r+=H,S=!0}return}u=r,r=""}r+="<"+_,_==="script"&&(e.allowedScriptHostnames||e.allowedScriptDomains)&&(N.innerText=""),U&&(e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape")&&e.preserveEscapedAttributes?sn(O,function(H,W){r+=" "+W+'="'+C(H||"",!0)+'"'}):(!a||st(a,_)||a["*"])&&sn(O,function(H,W){if(!H1.test(W)){delete N.attribs[W];return}if(H===""&&!e.allowedEmptyAttributes.includes(W)&&(e.nonBooleanAttributes.includes(W)||e.nonBooleanAttributes.includes("*"))){delete N.attribs[W];return}let pe=!1;if(!a||st(a,_)&&a[_].indexOf(W)!==-1||a["*"]&&a["*"].indexOf(W)!==-1||st(l,_)&&l[_].test(W)||l["*"]&&l["*"].test(W))pe=!0;else if(a&&a[_]){for(const K of a[_])if(B1(K)&&K.name&&K.name===W){pe=!0;let X="";if(K.multiple===!0){const ye=H.split(" ");for(const ge of ye)K.values.indexOf(ge)!==-1&&(X===""?X=ge:X+=" "+ge)}else K.values.indexOf(H)>=0&&(X=H);H=X}}if(pe){if(e.allowedSchemesAppliedToAttributes.indexOf(W)!==-1&&L(_,H)){delete N.attribs[W];return}if(_==="script"&&W==="src"){let K=!0;try{const X=$(H);if(e.allowedScriptHostnames||e.allowedScriptDomains){const ye=(e.allowedScriptHostnames||[]).find(function(xe){return xe===X.url.hostname}),ge=(e.allowedScriptDomains||[]).find(function(xe){return X.url.hostname===xe||X.url.hostname.endsWith(`.${xe}`)});K=ye||ge}}catch{K=!1}if(!K){delete N.attribs[W];return}}if(_==="iframe"&&W==="src"){let K=!0;try{const X=$(H);if(X.isRelativeUrl)K=st(e,"allowIframeRelativeUrls")?e.allowIframeRelativeUrls:!e.allowedIframeHostnames&&!e.allowedIframeDomains;else if(e.allowedIframeHostnames||e.allowedIframeDomains){const ye=(e.allowedIframeHostnames||[]).find(function(xe){return xe===X.url.hostname}),ge=(e.allowedIframeDomains||[]).find(function(xe){return X.url.hostname===xe||X.url.hostname.endsWith(`.${xe}`)});K=ye||ge}}catch{K=!1}if(!K){delete N.attribs[W];return}}if(W==="srcset")try{let K=F1(H);if(K.forEach(function(X){L("srcset",X.url)&&(X.evil=!0)}),K=qa(K,function(X){return!X.evil}),K.length)H=$1(qa(K,function(X){return!X.evil})),N.attribs[W]=H;else{delete N.attribs[W];return}}catch{delete N.attribs[W];return}if(W==="class"){const K=f[_],X=f["*"],ye=h[_],ge=c[_],xe=c["*"],Ju=h["*"],Sr=[ye,Ju].concat(ge,xe).filter(function(Cn){return Cn});if(K&&X?H=B(H,ja(K,X),Sr):H=B(H,K||X,Sr),!H.length){delete N.attribs[W];return}}if(W==="style"){if(e.parseStyleAttributes)try{const K=j1(_+" {"+H+"}",{map:!1}),X=x(K,e.allowedStyles);if(H=E(X),H.length===0){delete N.attribs[W];return}}catch{typeof window<"u"&&console.warn('Failed to parse "'+_+" {"+H+`}", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547`),delete N.attribs[W];return}else if(e.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.")}r+=" "+W,H&&H.length?r+='="'+C(H,!0)+'"':e.allowedEmptyAttributes.includes(W)&&(r+='=""')}else delete N.attribs[W]}),e.selfClosing.indexOf(_)!==-1?r+=" />":(r+=">",N.innerText&&!Y&&!e.textFilter&&(r+=C(N.innerText),S=!0)),U&&(r=u+C(r),u=""),N.openingTagLength=r.length-N.tagPosition},ontext:function(_){if(v)return;const O=g[g.length-1];let N;if(O&&(N=O.tag,_=O.innerText!==void 0?O.innerText:_),e.disallowedTagsMode==="completelyDiscard"&&!s(N))_="";else if((e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&(N==="script"||N==="style"))r+=_;else if(!S){const U=C(_,!1);e.textFilter?r+=e.textFilter(U,N):r+=U}if(g.length){const U=g[g.length-1];U.text+=_}},onclosetag:function(_,O){if(e.onCloseTag&&e.onCloseTag(_,O),v)if(w--,!w)v=!1;else return;const N=g.pop();if(!N)return;if(N.tag!==_){g.push(N);return}v=e.enforceHtmlBoundary?_==="html":!1,m--;const U=y[m];if(U){if(delete y[m],e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){N.updateParentNodeText();return}u=r,r=""}if(b[m]&&(_=b[m],delete b[m]),e.exclusiveFilter){const Y=e.exclusiveFilter(N);if(Y==="excludeTag"){U&&(r=u,u=""),r=r.substring(0,N.tagPosition)+r.substring(N.tagPosition+N.openingTagLength);return}else if(Y){r=r.substring(0,N.tagPosition);return}}if(N.updateParentNodeMediaChildren(),N.updateParentNodeText(),e.selfClosing.indexOf(_)!==-1||O&&!s(_)&&["escape","recursiveEscape"].indexOf(e.disallowedTagsMode)>=0){U&&(r=u,u="");return}r+="</"+_+">",U&&(r=u+C(r),u=""),S=!1}},e.parser);if(T.write(n),T.end(),e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape"){const _=T.endIndex;if(_!=null&&_>=0&&_<n.length){const O=n.substring(_);r+=C(O)}else(_==null||_<0)&&n.length>0&&r===""&&(r=C(n))}return r;function I(){r="",m=0,g=[],y={},b={},v=!1,w=0}function C(_,O){return typeof _!="string"&&(_=_+""),e.parser.decodeEntities&&(_=_.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),O&&(_=_.replace(/"/g,"""))),_=_.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&").replace(/</g,"<").replace(/>/g,">"),O&&(_=_.replace(/"/g,""")),_}function L(_,O){for(O=O.replace(/[\x00-\x20]+/g,"");;){const Y=O.indexOf("<!--");if(Y===-1)break;const ee=O.indexOf("-->",Y+4);if(ee===-1)break;O=O.substring(0,Y)+O.substring(ee+3)}const N=O.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!N)return O.match(/^[/\\]{2}/)?!e.allowProtocolRelative:!1;const U=N[1].toLowerCase();return st(e.allowedSchemesByTag,_)?e.allowedSchemesByTag[_].indexOf(U)===-1:!e.allowedSchemes||e.allowedSchemes.indexOf(U)===-1}function $(_){if(_=_.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//"),_.startsWith("relative:"))throw new Error("relative: exploit attempt");let O="relative://relative-site";for(let Y=0;Y<100;Y++)O+=`/${Y}`;const N=new URL(_,O);return{isRelativeUrl:N&&N.hostname==="relative-site"&&N.protocol==="relative:",url:N}}function x(_,O){if(!O)return _;const N=_.nodes[0];let U;return O[N.selector]&&O["*"]?U=ja(O[N.selector],O["*"]):U=O[N.selector]||O["*"],U&&(_.nodes[0].nodes=N.nodes.reduce(A(U),[])),_}function E(_){return _.nodes[0].nodes.reduce(function(O,N){return O.push(`${N.prop}:${N.value}${N.important?" !important":""}`),O},[]).join(";")}function A(_){return function(O,N){return st(_,N.prop)&&_[N.prop].some(function(Y){return Y.test(N.value)})&&O.push(N),O}}function B(_,O,N){return O?(_=_.split(/\s+/),_.filter(function(U){return O.indexOf(U)!==-1||N.some(function(Y){return Y.test(U)})}).join(" ")):_}}const V1={decodeEntities:!0};nr.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","menu","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0,preserveEscapedAttributes:!1};nr.simpleTransform=function(n,e,t){return t=t===void 0?!0:t,e=e||{},function(r,u){let i;if(t)for(i in e)u[i]=e[i];else u=e;return{tagName:n,attribs:u}}};const pi=wh(W1),C0=xn();class wr extends jl{constructor(t,r,u,i,s,o,a){super(s);Mt(this,"__src");Mt(this,"__alt");Mt(this,"__width");Mt(this,"__height");Mt(this,"__soliboDocumentId");Mt(this,"__soliboDocumentSlot");this.__src=t,this.__alt=r,this.__width=u,this.__height=i,this.__soliboDocumentId=o,this.__soliboDocumentSlot=a}static getType(){return"image"}static clone(t){return new wr(t.__src,t.__alt,t.__width,t.__height,t.__key,t.__soliboDocumentId,t.__soliboDocumentSlot)}static importJSON(t){return Tu({alt:t.alt,height:t.height,soliboDocumentId:t.soliboDocumentId,soliboDocumentSlot:t.soliboDocumentSlot,src:t.src,width:t.width})}exportJSON(){return{alt:this.__alt,height:this.__height,...this.__soliboDocumentId?{soliboDocumentId:this.__soliboDocumentId}:void 0,...this.__soliboDocumentSlot?{soliboDocumentSlot:this.__soliboDocumentSlot}:void 0,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:t=>({conversion:r=>{if(!(r instanceof HTMLImageElement))return null;const u=r.getAttribute("src")??"";if(!u)return null;const i=r.getAttribute("width"),s=r.getAttribute("height");return{node:Tu({alt:r.getAttribute("alt")??"",height:s?Number(s):void 0,soliboDocumentId:r.getAttribute("data-solibo-document-id")??void 0,soliboDocumentSlot:r.getAttribute("data-solibo-document-slot")??void 0,src:u,width:i?Number(i):void 0})}},priority:0})}}exportDOM(){const t=document.createElement("img");return this.__soliboDocumentSlot||t.setAttribute("src",this.__src),this.__soliboDocumentId&&t.setAttribute("data-solibo-document-id",this.__soliboDocumentId),this.__soliboDocumentSlot&&t.setAttribute("data-solibo-document-slot",this.__soliboDocumentSlot),this.__alt&&t.setAttribute("alt",this.__alt),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),{element:t}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(t){const r=this.getWritable();return r.__src=t,r}setWidth(t){const r=this.getWritable();return r.__width=t,r.__height=void 0,r}decorate(t){return j.jsx("img",{alt:this.__alt,height:this.__height,"data-solibo-document-id":this.__soliboDocumentId,"data-solibo-document-slot":this.__soliboDocumentSlot,onClick:r=>{r.preventDefault(),t.dispatchCommand(C0,{key:this.getKey(),soliboDocumentSlot:this.__soliboDocumentSlot,src:this.__src,width:this.__width})},src:this.__src,width:this.__width})}}function Tu({alt:n="",height:e,soliboDocumentId:t,soliboDocumentSlot:r,src:u,width:i}){return new wr(u,n,i,e,void 0,t,r)}function gi(n){return n instanceof wr}const G1=({createImages:n})=>{const[e]=De();return R.useEffect(()=>e.registerCommand(rr,t=>{var s;if(!("clipboardData"in t))return!1;const r=t,u=Array.from(((s=r.clipboardData)==null?void 0:s.items)??[]).flatMap(o=>{if(o.kind!=="file"||!o.type.startsWith("image/"))return[];const a=o.getAsFile();return a?[a]:[]});if(u.length===0)return!1;r.preventDefault();const i=n(u);return e.update(()=>{Ru(i.map(o=>Tu(o)))}),!0},Hf),[n,e]),null},K1=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,J1=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,Z1=[n=>{const e=K1.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:`mailto:${e[0]}`}:null},n=>{const e=J1.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:e[0].startsWith("http")?e[0]:`https://${e[0]}`}:null}];function us(n){try{const e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}const X1="_field_h3lp5_3",Q1="_editor_h3lp5_8",Y1="_invalid_h3lp5_46",em="_error_h3lp5_50",tm="_content_h3lp5_56",nm="_files_h3lp5_60",rm="_placeholder_h3lp5_68",um="_fill_h3lp5_76",im="_meta_h3lp5_99",sm="_active_h3lp5_108",om="_submit_h3lp5_127",am="_bold_h3lp5_131",lm="_italic_h3lp5_135",cm="_underline_h3lp5_139",fm="_link_h3lp5_143",dm="_list_h3lp5_149",hm="_paragraph_h3lp5_150",ae={field:X1,editor:Q1,"has-files":"_has-files_h3lp5_42",invalid:Y1,error:em,content:tm,files:nm,placeholder:rm,fill:um,"fill-editor":"_fill-editor_h3lp5_83",meta:im,active:sm,"image-sizes":"_image-sizes_h3lp5_120",submit:om,bold:am,italic:lm,underline:cm,link:fm,list:dm,paragraph:hm},pm=[{label:"Small",width:320},{label:"Medium",width:640},{label:"Large",width:960},{label:"Original",width:void 0}],gm=({disabled:n=!1,isSubmitting:e=!1,onFilesSelected:t,onInlineImageRemove:r,onSubmit:u,submitLabel:i="Submit"})=>{const[s]=De(),[o,a]=R.useState(!1),[l,f]=R.useState(!1),[h,c]=R.useState(!1),[d,p]=R.useState(!1),[m,g]=R.useState(!1),[y,b]=R.useState(!1),[v,w]=R.useState(""),[S,T]=R.useState(null),[I,C]=R.useState(null),[L,$]=R.useState(void 0),[x,E]=R.useState(""),A=us(x.trim()),B=R.useRef(null),_=R.useRef(null),O=R.useRef(null),N=R.useRef(null),U=R.useRef(!1),Y=F=>F.preventDefault(),ee=R.useCallback(F=>{N.current=D(F)?F.clone():null},[]),G=R.useCallback(F=>{s.update(()=>{N.current&&Re(N.current),F()}),N.current=null},[s]),ie=F=>{U.current=!0,F.preventDefault()},H=()=>{if(U.current){U.current=!1;return}ge()},W=R.useCallback(()=>{f(!1),w(""),T(null),C(null),$(void 0)},[]),pe=R.useCallback(()=>{g(!1),E("")},[]),K=R.useCallback(F=>{f(!0),w((F==null?void 0:F.src)??""),T((F==null?void 0:F.key)??null),C((F==null?void 0:F.soliboDocumentSlot)??null),$(F==null?void 0:F.width),pe(),F!=null&&F.soliboDocumentSlot||setTimeout(()=>{var se;return(se=_.current)==null?void 0:se.focus()},0)},[pe]),X=R.useCallback(F=>{s.getEditorState().read(()=>{ee(z())}),g(!0),E(F),W(),setTimeout(()=>{var se;return(se=O.current)==null?void 0:se.focus()},0)},[W,s,ee]),ye=R.useCallback(()=>{const F=x.trim();us(F)&&(G(()=>{s.dispatchCommand(dn,{url:F,target:"_blank"});const se=z();if(!D(se))return;const Ke=se.getNodes().at(-1)??null,Lt=(Ke==null?void 0:Ke.getParent())??null,Pe=$e(Ke)?Ke:$e(Lt)?Lt:null;if(Pe){const bt=Pe.getLastChild();if(P(bt)){const Qs=bt.getTextContent(),Ys=Qs.replace(/\s+$/,"");Ys!==Qs&&bt.setTextContent(Ys)}const en=Pe.getNextSibling();if(P(en)&&/^\s/.test(en.getTextContent())){en.select(1,1);return}const Fe=ce(" ");Pe.insertAfter(Fe),Fe.selectEnd()}}),pe())},[pe,s,x,G]),ge=R.useCallback(()=>{const F=v.trim();if(!F){W();return}s.update(()=>{if(S){const se=he(S);gi(se)&&se.setSrc(F);return}Ru([Tu({src:F})])}),W()},[W,s,S,v]),xe=R.useCallback(()=>{if(!S){W();return}s.update(()=>{const F=he(S);if(gi(F)){const se=F.getParent();Ht(se)&&se.getChildrenSize()===1?se.remove():F.remove(),I&&(r==null||r(I))}}),W()},[W,s,S,I,r]),Ju=R.useCallback(F=>{S&&(s.update(()=>{const se=he(S);gi(se)&&se.setWidth(F)}),$(F))},[s,S]),Sr=R.useCallback(()=>{G(()=>{s.dispatchCommand(dn,null)}),pe()},[pe,s,G]),Cn=R.useCallback(()=>{const F=z();if(!D(F)){if(Me(F)){const Lt=F.getNodes(),Pe=Lt[0]??null,bt=(Pe==null?void 0:Pe.getParent())??null;a(Lt.some(Fe=>P(Fe)&&Fe.hasFormat("bold"))),c(Lt.some(Fe=>P(Fe)&&Fe.hasFormat("italic"))),p(Lt.some(Fe=>P(Fe)&&Fe.hasFormat("underline"))),b(Q(bt)||oe(bt)||Q(Pe)||oe(Pe));const en=$e(Pe)?Pe:$e(bt)?bt:null;if(en){g(!0),E(en.getURL());return}g(!1),E(""),N.current=null;return}a(!1),c(!1),p(!1),b(!1),g(!1),E(""),N.current=null;return}const[se]=F.getNodes(),Ke=(se==null?void 0:se.getParent())??null;if(a(F.hasFormat("bold")),c(F.hasFormat("italic")),p(F.hasFormat("underline")),b(Q(Ke)||oe(Ke)),$e(Ke)){g(!0),E(Ke.getURL()),ee(F);return}g(!1),E(""),N.current=null},[ee]);return R.useEffect(()=>pt(s.registerUpdateListener(({editorState:F})=>{F.read(()=>{Cn()})}),s.registerCommand(C0,F=>(K(F),!0),at),s.registerCommand(Cu,()=>(s.getEditorState().read(()=>{Cn()}),!1),at)),[s,K,Cn]),j.jsxs(A0.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[j.jsx(Le.Button,{"aria-label":"Bold","data-active":o,onClick:()=>{s.dispatchCommand(We,"bold")},title:"Bold",variant:"tertiary",children:j.jsx(Je.Icon,{name:"TextB"})}),j.jsx(Le.Button,{"aria-label":"Italic","data-active":h,onClick:()=>{s.dispatchCommand(We,"italic")},title:"Italic",variant:"tertiary",children:j.jsx(Je.Icon,{name:"TextItalic"})}),j.jsx(Le.Button,{"aria-label":"Underline","data-active":d,onClick:()=>{s.dispatchCommand(We,"underline")},title:"Underline",variant:"tertiary",children:j.jsx(Je.Icon,{name:"TextUnderline"})}),j.jsx(Le.Button,{"aria-label":"List","data-active":y,onClick:()=>{y?s.dispatchCommand(uc,void 0):s.dispatchCommand(rc,void 0)},title:"List",variant:"tertiary",children:j.jsx(Je.Icon,{name:"ListBullets"})}),j.jsx(Le.Button,{"aria-label":"Link","data-active":m,onClick:()=>{m?X(x):(s.dispatchCommand(dn,{url:"https://"}),X("https://"))},title:"Link",variant:"tertiary",children:j.jsx(Je.Icon,{name:"Link"})}),t&&j.jsxs(j.Fragment,{children:[j.jsx("input",{hidden:!0,multiple:!0,onChange:F=>{F.target.files&&t(F.target.files),F.target.value=""},ref:B,type:"file"}),j.jsx(Le.Button,{"aria-label":"Upload files",onClick:()=>{var F;return(F=B.current)==null?void 0:F.click()},title:"Upload files",variant:"tertiary",children:j.jsx(Je.Icon,{name:"Paperclip"})})]}),u&&j.jsx(Le.Button,{"aria-label":i,className:ae.submit,disabled:n,icon:"PaperPlaneTilt",isLoading:e,onClick:()=>u(),variant:"primary",children:j.jsx("span",{children:i})}),j.jsxs("div",{className:Jr.t(ae.meta,m||l?ae.active:""),children:[m&&j.jsxs(j.Fragment,{children:[j.jsx(to.Input,{"aria-invalid":!A,onBlur:()=>ye(),onChange:F=>E(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),ye())},ref:O,value:x}),j.jsx(Le.Button,{"aria-label":"Apply link",disabled:!A,onClick:()=>{ye()},onMouseDown:Y,variant:"tertiary",children:j.jsx(Je.Icon,{name:"Check"})}),j.jsx(Le.Button,{"aria-label":"Remove link",onClick:()=>Sr(),onMouseDown:Y,variant:"tertiary",children:j.jsx(Je.Icon,{name:"Trash",variant:"danger"})})]}),l&&j.jsxs(j.Fragment,{children:[!I&&j.jsxs(j.Fragment,{children:[j.jsx(to.Input,{className:Jr.t(ae.active),onBlur:H,onChange:F=>w(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),U.current=!0,ge())},ref:_,value:v}),j.jsx(Le.Button,{"aria-label":"Apply image",onClick:()=>ge(),onMouseDown:ie,variant:"tertiary",children:j.jsx(Je.Icon,{name:"Check"})})]}),j.jsx("div",{className:ae["image-sizes"],children:pm.map(({label:F,width:se})=>j.jsx(Le.Button,{"aria-label":`${F} image`,"data-active":L===se,onClick:()=>Ju(se),onMouseDown:Y,variant:"tertiary",children:F},F))}),j.jsx(Le.Button,{"aria-label":"Remove image",onClick:()=>xe(),onMouseDown:ie,variant:"tertiary",children:j.jsx(Je.Icon,{name:"Trash",variant:"danger"})})]})]})]})};function mm({autofocus:n,content:e="",lastEmittedContentRef:t}){const[r]=De();return R.useEffect(()=>{t.current!==e&&r.update(()=>{const i=new DOMParser().parseFromString(e,"text/html"),s=Gl(r,i),o=fe();o.clear().select(),Ru(s),n?o.selectEnd():Re(null)})},[n,e,r,t]),null}const bm=({autofocus:n=!1,autolink:e=!1,content:t,disabled:r=!1,errorMessage:u,fill:i=!1,files:s,inline:o=!1,inlineImages:a,invalid:l=!1,isSubmitting:f=!1,maxRows:h=12,minRows:c=1,onChange:d,onFilesChange:p,onInlineImagesChange:m,onSubmit:g,onUpload:y,placeholder:b,required:v=!1,submitLabel:w})=>{const S=R.useId(),T=R.useRef(void 0),[I,C]=R.useState([]),[L,$]=R.useState([]),x=R.useRef(new Map),E=s??I,A=a??L,B=G=>{s===void 0&&C(G),p==null||p(G)},_=R.useCallback(G=>{a===void 0&&$(G),m==null||m(G)},[a,m]),O=R.useCallback(G=>{const ie=G.map(H=>{const W=`pasted-${crypto.randomUUID()}`,pe=URL.createObjectURL(H);return x.current.set(W,pe),{image:{alt:H.name,soliboDocumentSlot:W,src:pe},pending:{file:H,slot:W}}});return _([...A,...ie.map(({pending:H})=>H)]),ie.map(({image:H})=>H)},[A,_]),N=R.useCallback(G=>{_(A.filter(H=>H.slot!==G));const ie=x.current.get(G);ie&&URL.revokeObjectURL(ie),x.current.delete(G)},[A,_]);R.useEffect(()=>()=>{x.current.forEach(G=>URL.revokeObjectURL(G)),x.current.clear()},[]),R.useEffect(()=>{const G=new Set(A.map(ie=>ie.slot));x.current.forEach((ie,H)=>{G.has(H)||(URL.revokeObjectURL(ie),x.current.delete(H))})},[A]);const U=G=>{if(typeof DataTransfer<"u"){const ie=new DataTransfer;return G.forEach(H=>ie.items.add(H)),ie.files}return Object.assign([...G],{item:ie=>G[ie]??null})},Y=async()=>{try{E.length>0&&await(y==null?void 0:y(U(E))),await(g==null?void 0:g()),E.length>0&&B([])}catch{return}},ee={namespace:"Editor",theme:{link:ae.link,list:{ol:ae.list,ul:ae.list},paragraph:ae.paragraph,text:{bold:ae.bold,italic:ae.italic,underline:ae.underline}},onError(G){throw G},nodes:[qu,pr,wn,gr,wr]};return j.jsxs("div",{className:Jr.t(ae.field,i&&ae.fill),"data-component":"editor","data-max-rows":h,"data-min-rows":c,children:[j.jsx("div",{className:Jr.t(ae.editor,i&&ae["fill-editor"],l&&ae.invalid,E.length>0&&ae["has-files"]),style:{"--editor-max-height":`calc(${h*1.25}em + (2 * var(--scale-8)))`,"--editor-min-height":`calc(${c*1.25}em + (2 * var(--scale-8)))`},children:j.jsxs(Dd,{initialConfig:ee,children:[!o&&j.jsx(gm,{disabled:r,isSubmitting:f,onInlineImageRemove:N,onFilesSelected:y||p?G=>{B([...E,...Array.from(G)])}:void 0,onSubmit:g?()=>void Y():void 0,submitLabel:w}),j.jsx("div",{className:ae.content,children:j.jsx(xh,{contentEditable:j.jsx(jd,{"aria-placeholder":b??"",ariaErrorMessage:l&&u?S:void 0,ariaInvalid:l||void 0,ariaRequired:v||void 0,placeholder:()=>b?j.jsx("div",{className:ae.placeholder,children:b}):null}),ErrorBoundary:$d})}),E.length>0&&j.jsx("div",{"aria-label":"Files to upload",className:ae.files,role:"region",children:E.map((G,ie)=>j.jsx(N0.File,{deleteAccessibleLabel:`Remove ${G.name} from upload queue`,name:G.name,onDelete:()=>B(E.filter((H,W)=>W!==ie))},`${G.name}-${G.size}-${G.lastModified}-${ie}`))}),n&&j.jsx(wd,{}),e&&j.jsx(Od,{matchers:Z1}),j.jsx(Xd,{}),m&&j.jsx(G1,{createImages:O}),t!==void 0&&j.jsx(mm,{autofocus:n,content:t,lastEmittedContentRef:T}),j.jsx(Qd,{validateUrl:us}),j.jsx(Yd,{}),d&&j.jsx(th,{onChange:(G,ie)=>{G.read(()=>{const H=Kl(ie,null),W=pi(H,{allowedAttributes:{...pi.defaults.allowedAttributes,img:[...pi.defaults.allowedAttributes.img??[],"data-solibo-document-id","data-solibo-document-slot"]},allowedTags:["a","b","br","i","img","li","ol","p","u","ul"]});T.current=W,d(W)})}})]})}),l&&u&&j.jsx("div",{className:ae.error,id:S,children:u})]})};exports.Editor=bm;
|
|
57
|
+
`)});const o=e.nonTextTags||["script","style","textarea","option"];let a,l;e.allowedAttributes&&(a={},l={},sn(e.allowedAttributes,function(_,O){a[O]=[];const N=[];_.forEach(function(U){typeof U=="string"&&U.indexOf("*")>=0?N.push(Fa(U).replace(/\\\*/g,".*")):a[O].push(U)}),N.length&&(l[O]=new RegExp("^("+N.join("|")+")$"))}));const f={},h={},c={};sn(e.allowedClasses,function(_,O){if(a&&(st(a,O)||(a[O]=[]),a[O].push("class")),f[O]=_,Array.isArray(_)){const N=[];f[O]=[],c[O]=[],_.forEach(function(U){typeof U=="string"&&U.indexOf("*")>=0?N.push(Fa(U).replace(/\\\*/g,".*")):U instanceof RegExp?c[O].push(U):f[O].push(U)}),N.length&&(h[O]=new RegExp("^("+N.join("|")+")$"))}});const d={};let p;sn(e.transformTags,function(_,O){let N;typeof _=="function"?N=_:typeof _=="string"&&(N=nr.simpleTransform(_)),O==="*"?p=N:d[O]=N});let m,g,y,b,v,w,S=!1;I();const T=new R1.Parser({onopentag:function(_,O){if(e.onOpenTag&&e.onOpenTag(_,O),e.enforceHtmlBoundary&&_==="html"&&I(),v){w++;return}const N=new i(_,O);g.push(N);let U=!1;const Y=!!N.text;let ee;if(st(d,_)&&(ee=d[_](_,O),N.attribs=O=ee.attribs,ee.text!==void 0&&(N.innerText=ee.text),_!==ee.tagName&&(N.name=_=ee.tagName,b[m]=ee.tagName)),p&&(ee=p(_,O),N.attribs=O=ee.attribs,_!==ee.tagName&&(N.name=_=ee.tagName,b[m]=ee.tagName)),(!s(_)||e.disallowedTagsMode==="recursiveEscape"&&!z1(y)||e.nestingLimit!=null&&m>=e.nestingLimit)&&(U=!0,y[m]=!0,(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&o.indexOf(_)!==-1&&(v=!0,w=1)),m++,U){if(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){if(N.innerText&&!Y){const H=C(N.innerText);e.textFilter?r+=e.textFilter(H,_):r+=H,S=!0}return}u=r,r=""}r+="<"+_,_==="script"&&(e.allowedScriptHostnames||e.allowedScriptDomains)&&(N.innerText=""),U&&(e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape")&&e.preserveEscapedAttributes?sn(O,function(H,W){r+=" "+W+'="'+C(H||"",!0)+'"'}):(!a||st(a,_)||a["*"])&&sn(O,function(H,W){if(!H1.test(W)){delete N.attribs[W];return}if(H===""&&!e.allowedEmptyAttributes.includes(W)&&(e.nonBooleanAttributes.includes(W)||e.nonBooleanAttributes.includes("*"))){delete N.attribs[W];return}let pe=!1;if(!a||st(a,_)&&a[_].indexOf(W)!==-1||a["*"]&&a["*"].indexOf(W)!==-1||st(l,_)&&l[_].test(W)||l["*"]&&l["*"].test(W))pe=!0;else if(a&&a[_]){for(const K of a[_])if(B1(K)&&K.name&&K.name===W){pe=!0;let X="";if(K.multiple===!0){const ye=H.split(" ");for(const ge of ye)K.values.indexOf(ge)!==-1&&(X===""?X=ge:X+=" "+ge)}else K.values.indexOf(H)>=0&&(X=H);H=X}}if(pe){if(e.allowedSchemesAppliedToAttributes.indexOf(W)!==-1&&L(_,H)){delete N.attribs[W];return}if(_==="script"&&W==="src"){let K=!0;try{const X=$(H);if(e.allowedScriptHostnames||e.allowedScriptDomains){const ye=(e.allowedScriptHostnames||[]).find(function(xe){return xe===X.url.hostname}),ge=(e.allowedScriptDomains||[]).find(function(xe){return X.url.hostname===xe||X.url.hostname.endsWith(`.${xe}`)});K=ye||ge}}catch{K=!1}if(!K){delete N.attribs[W];return}}if(_==="iframe"&&W==="src"){let K=!0;try{const X=$(H);if(X.isRelativeUrl)K=st(e,"allowIframeRelativeUrls")?e.allowIframeRelativeUrls:!e.allowedIframeHostnames&&!e.allowedIframeDomains;else if(e.allowedIframeHostnames||e.allowedIframeDomains){const ye=(e.allowedIframeHostnames||[]).find(function(xe){return xe===X.url.hostname}),ge=(e.allowedIframeDomains||[]).find(function(xe){return X.url.hostname===xe||X.url.hostname.endsWith(`.${xe}`)});K=ye||ge}}catch{K=!1}if(!K){delete N.attribs[W];return}}if(W==="srcset")try{let K=F1(H);if(K.forEach(function(X){L("srcset",X.url)&&(X.evil=!0)}),K=qa(K,function(X){return!X.evil}),K.length)H=$1(qa(K,function(X){return!X.evil})),N.attribs[W]=H;else{delete N.attribs[W];return}}catch{delete N.attribs[W];return}if(W==="class"){const K=f[_],X=f["*"],ye=h[_],ge=c[_],xe=c["*"],Ju=h["*"],Sr=[ye,Ju].concat(ge,xe).filter(function(Cn){return Cn});if(K&&X?H=B(H,ja(K,X),Sr):H=B(H,K||X,Sr),!H.length){delete N.attribs[W];return}}if(W==="style"){if(e.parseStyleAttributes)try{const K=j1(_+" {"+H+"}",{map:!1}),X=x(K,e.allowedStyles);if(H=E(X),H.length===0){delete N.attribs[W];return}}catch{typeof window<"u"&&console.warn('Failed to parse "'+_+" {"+H+`}", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547`),delete N.attribs[W];return}else if(e.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.")}r+=" "+W,H&&H.length?r+='="'+C(H,!0)+'"':e.allowedEmptyAttributes.includes(W)&&(r+='=""')}else delete N.attribs[W]}),e.selfClosing.indexOf(_)!==-1?r+=" />":(r+=">",N.innerText&&!Y&&!e.textFilter&&(r+=C(N.innerText),S=!0)),U&&(r=u+C(r),u=""),N.openingTagLength=r.length-N.tagPosition},ontext:function(_){if(v)return;const O=g[g.length-1];let N;if(O&&(N=O.tag,_=O.innerText!==void 0?O.innerText:_),e.disallowedTagsMode==="completelyDiscard"&&!s(N))_="";else if((e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&(N==="script"||N==="style"))r+=_;else if(!S){const U=C(_,!1);e.textFilter?r+=e.textFilter(U,N):r+=U}if(g.length){const U=g[g.length-1];U.text+=_}},onclosetag:function(_,O){if(e.onCloseTag&&e.onCloseTag(_,O),v)if(w--,!w)v=!1;else return;const N=g.pop();if(!N)return;if(N.tag!==_){g.push(N);return}v=e.enforceHtmlBoundary?_==="html":!1,m--;const U=y[m];if(U){if(delete y[m],e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){N.updateParentNodeText();return}u=r,r=""}if(b[m]&&(_=b[m],delete b[m]),e.exclusiveFilter){const Y=e.exclusiveFilter(N);if(Y==="excludeTag"){U&&(r=u,u=""),r=r.substring(0,N.tagPosition)+r.substring(N.tagPosition+N.openingTagLength);return}else if(Y){r=r.substring(0,N.tagPosition);return}}if(N.updateParentNodeMediaChildren(),N.updateParentNodeText(),e.selfClosing.indexOf(_)!==-1||O&&!s(_)&&["escape","recursiveEscape"].indexOf(e.disallowedTagsMode)>=0){U&&(r=u,u="");return}r+="</"+_+">",U&&(r=u+C(r),u=""),S=!1}},e.parser);if(T.write(n),T.end(),e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape"){const _=T.endIndex;if(_!=null&&_>=0&&_<n.length){const O=n.substring(_);r+=C(O)}else(_==null||_<0)&&n.length>0&&r===""&&(r=C(n))}return r;function I(){r="",m=0,g=[],y={},b={},v=!1,w=0}function C(_,O){return typeof _!="string"&&(_=_+""),e.parser.decodeEntities&&(_=_.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),O&&(_=_.replace(/"/g,"""))),_=_.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&").replace(/</g,"<").replace(/>/g,">"),O&&(_=_.replace(/"/g,""")),_}function L(_,O){for(O=O.replace(/[\x00-\x20]+/g,"");;){const Y=O.indexOf("<!--");if(Y===-1)break;const ee=O.indexOf("-->",Y+4);if(ee===-1)break;O=O.substring(0,Y)+O.substring(ee+3)}const N=O.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!N)return O.match(/^[/\\]{2}/)?!e.allowProtocolRelative:!1;const U=N[1].toLowerCase();return st(e.allowedSchemesByTag,_)?e.allowedSchemesByTag[_].indexOf(U)===-1:!e.allowedSchemes||e.allowedSchemes.indexOf(U)===-1}function $(_){if(_=_.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//"),_.startsWith("relative:"))throw new Error("relative: exploit attempt");let O="relative://relative-site";for(let Y=0;Y<100;Y++)O+=`/${Y}`;const N=new URL(_,O);return{isRelativeUrl:N&&N.hostname==="relative-site"&&N.protocol==="relative:",url:N}}function x(_,O){if(!O)return _;const N=_.nodes[0];let U;return O[N.selector]&&O["*"]?U=ja(O[N.selector],O["*"]):U=O[N.selector]||O["*"],U&&(_.nodes[0].nodes=N.nodes.reduce(A(U),[])),_}function E(_){return _.nodes[0].nodes.reduce(function(O,N){return O.push(`${N.prop}:${N.value}${N.important?" !important":""}`),O},[]).join(";")}function A(_){return function(O,N){return st(_,N.prop)&&_[N.prop].some(function(Y){return Y.test(N.value)})&&O.push(N),O}}function B(_,O,N){return O?(_=_.split(/\s+/),_.filter(function(U){return O.indexOf(U)!==-1||N.some(function(Y){return Y.test(U)})}).join(" ")):_}}const V1={decodeEntities:!0};nr.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","menu","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0,preserveEscapedAttributes:!1};nr.simpleTransform=function(n,e,t){return t=t===void 0?!0:t,e=e||{},function(r,u){let i;if(t)for(i in e)u[i]=e[i];else u=e;return{tagName:n,attribs:u}}};const pi=wh(W1),C0=xn();class wr extends jl{constructor(t,r,u,i,s,o,a){super(s);Mt(this,"__src");Mt(this,"__alt");Mt(this,"__width");Mt(this,"__height");Mt(this,"__soliboDocumentId");Mt(this,"__soliboDocumentSlot");this.__src=t,this.__alt=r,this.__width=u,this.__height=i,this.__soliboDocumentId=o,this.__soliboDocumentSlot=a}static getType(){return"image"}static clone(t){return new wr(t.__src,t.__alt,t.__width,t.__height,t.__key,t.__soliboDocumentId,t.__soliboDocumentSlot)}static importJSON(t){return Tu({alt:t.alt,height:t.height,soliboDocumentId:t.soliboDocumentId,soliboDocumentSlot:t.soliboDocumentSlot,src:t.src,width:t.width})}exportJSON(){return{alt:this.__alt,height:this.__height,...this.__soliboDocumentId?{soliboDocumentId:this.__soliboDocumentId}:void 0,...this.__soliboDocumentSlot?{soliboDocumentSlot:this.__soliboDocumentSlot}:void 0,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:t=>({conversion:r=>{if(!(r instanceof HTMLImageElement))return null;const u=r.getAttribute("src")??"";if(!u)return null;const i=r.getAttribute("width"),s=r.getAttribute("height");return{node:Tu({alt:r.getAttribute("alt")??"",height:s?Number(s):void 0,soliboDocumentId:r.getAttribute("data-solibo-document-id")??void 0,soliboDocumentSlot:r.getAttribute("data-solibo-document-slot")??void 0,src:u,width:i?Number(i):void 0})}},priority:0})}}exportDOM(){const t=document.createElement("img");return this.__soliboDocumentSlot||t.setAttribute("src",this.__src),this.__soliboDocumentId&&t.setAttribute("data-solibo-document-id",this.__soliboDocumentId),this.__soliboDocumentSlot&&t.setAttribute("data-solibo-document-slot",this.__soliboDocumentSlot),this.__alt&&t.setAttribute("alt",this.__alt),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),{element:t}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(t){const r=this.getWritable();return r.__src=t,r}setWidth(t){const r=this.getWritable();return r.__width=t,r.__height=void 0,r}decorate(t){return j.jsx("img",{alt:this.__alt,height:this.__height,"data-solibo-document-id":this.__soliboDocumentId,"data-solibo-document-slot":this.__soliboDocumentSlot,onClick:r=>{r.preventDefault(),t.dispatchCommand(C0,{key:this.getKey(),soliboDocumentSlot:this.__soliboDocumentSlot,src:this.__src,width:this.__width})},src:this.__src,width:this.__width})}}function Tu({alt:n="",height:e,soliboDocumentId:t,soliboDocumentSlot:r,src:u,width:i}){return new wr(u,n,i,e,void 0,t,r)}function gi(n){return n instanceof wr}const G1=({createImages:n})=>{const[e]=De();return R.useEffect(()=>e.registerCommand(rr,t=>{var s;if(!("clipboardData"in t))return!1;const r=t,u=Array.from(((s=r.clipboardData)==null?void 0:s.items)??[]).flatMap(o=>{if(o.kind!=="file"||!o.type.startsWith("image/"))return[];const a=o.getAsFile();return a?[a]:[]});if(u.length===0)return!1;r.preventDefault();const i=n(u);return e.update(()=>{Ru(i.map(o=>Tu(o)))}),!0},Hf),[n,e]),null},K1=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,J1=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,Z1=[n=>{const e=K1.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:`mailto:${e[0]}`}:null},n=>{const e=J1.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:e[0].startsWith("http")?e[0]:`https://${e[0]}`}:null}];function us(n){try{const e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}const X1="_field_h3lp5_3",Q1="_editor_h3lp5_8",Y1="_invalid_h3lp5_46",em="_error_h3lp5_50",tm="_content_h3lp5_56",nm="_files_h3lp5_60",rm="_placeholder_h3lp5_68",um="_fill_h3lp5_76",im="_meta_h3lp5_99",sm="_active_h3lp5_108",om="_submit_h3lp5_127",am="_bold_h3lp5_131",lm="_italic_h3lp5_135",cm="_underline_h3lp5_139",fm="_link_h3lp5_143",dm="_list_h3lp5_149",hm="_paragraph_h3lp5_150",ae={field:X1,editor:Q1,"has-files":"_has-files_h3lp5_42",invalid:Y1,error:em,content:tm,files:nm,placeholder:rm,fill:um,"fill-editor":"_fill-editor_h3lp5_83",meta:im,active:sm,"image-sizes":"_image-sizes_h3lp5_120",submit:om,bold:am,italic:lm,underline:cm,link:fm,list:dm,paragraph:hm},pm=[{label:"Small",width:320},{label:"Medium",width:640},{label:"Large",width:960},{label:"Original",width:void 0}],gm=({disabled:n=!1,isSubmitting:e=!1,onFilesSelected:t,onInlineImageRemove:r,onSubmit:u,submitLabel:i="Submit"})=>{const[s]=De(),[o,a]=R.useState(!1),[l,f]=R.useState(!1),[h,c]=R.useState(!1),[d,p]=R.useState(!1),[m,g]=R.useState(!1),[y,b]=R.useState(!1),[v,w]=R.useState(""),[S,T]=R.useState(null),[I,C]=R.useState(null),[L,$]=R.useState(void 0),[x,E]=R.useState(""),A=us(x.trim()),B=R.useRef(null),_=R.useRef(null),O=R.useRef(null),N=R.useRef(null),U=R.useRef(!1),Y=F=>F.preventDefault(),ee=R.useCallback(F=>{N.current=D(F)?F.clone():null},[]),G=R.useCallback(F=>{s.update(()=>{N.current&&Re(N.current),F()}),N.current=null},[s]),ie=F=>{U.current=!0,F.preventDefault()},H=()=>{if(U.current){U.current=!1;return}ge()},W=R.useCallback(()=>{f(!1),w(""),T(null),C(null),$(void 0)},[]),pe=R.useCallback(()=>{g(!1),E("")},[]),K=R.useCallback(F=>{f(!0),w((F==null?void 0:F.src)??""),T((F==null?void 0:F.key)??null),C((F==null?void 0:F.soliboDocumentSlot)??null),$(F==null?void 0:F.width),pe(),F!=null&&F.soliboDocumentSlot||setTimeout(()=>{var se;return(se=_.current)==null?void 0:se.focus()},0)},[pe]),X=R.useCallback(F=>{s.getEditorState().read(()=>{ee(z())}),g(!0),E(F),W(),setTimeout(()=>{var se;return(se=O.current)==null?void 0:se.focus()},0)},[W,s,ee]),ye=R.useCallback(()=>{const F=x.trim();us(F)&&(G(()=>{s.dispatchCommand(dn,{url:F,target:"_blank"});const se=z();if(!D(se))return;const Ke=se.getNodes().at(-1)??null,Lt=(Ke==null?void 0:Ke.getParent())??null,Pe=$e(Ke)?Ke:$e(Lt)?Lt:null;if(Pe){const bt=Pe.getLastChild();if(P(bt)){const Qs=bt.getTextContent(),Ys=Qs.replace(/\s+$/,"");Ys!==Qs&&bt.setTextContent(Ys)}const en=Pe.getNextSibling();if(P(en)&&/^\s/.test(en.getTextContent())){en.select(1,1);return}const Fe=ce(" ");Pe.insertAfter(Fe),Fe.selectEnd()}}),pe())},[pe,s,x,G]),ge=R.useCallback(()=>{const F=v.trim();if(!F){W();return}s.update(()=>{if(S){const se=he(S);gi(se)&&se.setSrc(F);return}Ru([Tu({src:F})])}),W()},[W,s,S,v]),xe=R.useCallback(()=>{if(!S){W();return}s.update(()=>{const F=he(S);if(gi(F)){const se=F.getParent();Ht(se)&&se.getChildrenSize()===1?se.remove():F.remove(),I&&(r==null||r(I))}}),W()},[W,s,S,I,r]),Ju=R.useCallback(F=>{S&&(s.update(()=>{const se=he(S);gi(se)&&se.setWidth(F)}),$(F))},[s,S]),Sr=R.useCallback(()=>{G(()=>{s.dispatchCommand(dn,null)}),pe()},[pe,s,G]),Cn=R.useCallback(()=>{const F=z();if(!D(F)){if(Me(F)){const Lt=F.getNodes(),Pe=Lt[0]??null,bt=(Pe==null?void 0:Pe.getParent())??null;a(Lt.some(Fe=>P(Fe)&&Fe.hasFormat("bold"))),c(Lt.some(Fe=>P(Fe)&&Fe.hasFormat("italic"))),p(Lt.some(Fe=>P(Fe)&&Fe.hasFormat("underline"))),b(Q(bt)||oe(bt)||Q(Pe)||oe(Pe));const en=$e(Pe)?Pe:$e(bt)?bt:null;if(en){g(!0),E(en.getURL());return}g(!1),E(""),N.current=null;return}a(!1),c(!1),p(!1),b(!1),g(!1),E(""),N.current=null;return}const[se]=F.getNodes(),Ke=(se==null?void 0:se.getParent())??null;if(a(F.hasFormat("bold")),c(F.hasFormat("italic")),p(F.hasFormat("underline")),b(Q(Ke)||oe(Ke)),$e(Ke)){g(!0),E(Ke.getURL()),ee(F);return}g(!1),E(""),N.current=null},[ee]);return R.useEffect(()=>pt(s.registerUpdateListener(({editorState:F})=>{F.read(()=>{Cn()})}),s.registerCommand(C0,F=>(K(F),!0),at),s.registerCommand(Cu,()=>(s.getEditorState().read(()=>{Cn()}),!1),at)),[s,K,Cn]),j.jsxs(A0.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[j.jsx(Le.Button,{"aria-label":"Bold","data-active":o,onClick:()=>{s.dispatchCommand(We,"bold")},title:"Bold",variant:"tertiary",children:j.jsx(Je.Icon,{name:"TextB"})}),j.jsx(Le.Button,{"aria-label":"Italic","data-active":h,onClick:()=>{s.dispatchCommand(We,"italic")},title:"Italic",variant:"tertiary",children:j.jsx(Je.Icon,{name:"TextItalic"})}),j.jsx(Le.Button,{"aria-label":"Underline","data-active":d,onClick:()=>{s.dispatchCommand(We,"underline")},title:"Underline",variant:"tertiary",children:j.jsx(Je.Icon,{name:"TextUnderline"})}),j.jsx(Le.Button,{"aria-label":"List","data-active":y,onClick:()=>{y?s.dispatchCommand(uc,void 0):s.dispatchCommand(rc,void 0)},title:"List",variant:"tertiary",children:j.jsx(Je.Icon,{name:"ListBullets"})}),j.jsx(Le.Button,{"aria-label":"Link","data-active":m,onClick:()=>{m?X(x):(s.dispatchCommand(dn,{url:"https://"}),X("https://"))},title:"Link",variant:"tertiary",children:j.jsx(Je.Icon,{name:"Link"})}),t&&j.jsxs(j.Fragment,{children:[j.jsx("input",{hidden:!0,multiple:!0,onChange:F=>{F.target.files&&t(F.target.files),F.target.value=""},ref:B,type:"file"}),j.jsx(Le.Button,{"aria-label":"Upload files",onClick:()=>{var F;return(F=B.current)==null?void 0:F.click()},title:"Upload files",variant:"tertiary",children:j.jsx(Je.Icon,{name:"Paperclip"})})]}),u&&j.jsx(Le.Button,{"aria-label":i,className:ae.submit,"data-cy":"toolbar-submit-button",disabled:n,icon:"PaperPlaneTilt",isLoading:e,onClick:()=>u(),variant:"primary",children:j.jsx("span",{children:i})}),j.jsxs("div",{className:Jr.t(ae.meta,m||l?ae.active:""),children:[m&&j.jsxs(j.Fragment,{children:[j.jsx(to.Input,{"aria-invalid":!A,onBlur:()=>ye(),onChange:F=>E(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),ye())},ref:O,value:x}),j.jsx(Le.Button,{"aria-label":"Apply link",disabled:!A,onClick:()=>{ye()},onMouseDown:Y,variant:"tertiary",children:j.jsx(Je.Icon,{name:"Check"})}),j.jsx(Le.Button,{"aria-label":"Remove link",onClick:()=>Sr(),onMouseDown:Y,variant:"tertiary",children:j.jsx(Je.Icon,{name:"Trash",variant:"danger"})})]}),l&&j.jsxs(j.Fragment,{children:[!I&&j.jsxs(j.Fragment,{children:[j.jsx(to.Input,{className:Jr.t(ae.active),onBlur:H,onChange:F=>w(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),U.current=!0,ge())},ref:_,value:v}),j.jsx(Le.Button,{"aria-label":"Apply image",onClick:()=>ge(),onMouseDown:ie,variant:"tertiary",children:j.jsx(Je.Icon,{name:"Check"})})]}),j.jsx("div",{className:ae["image-sizes"],children:pm.map(({label:F,width:se})=>j.jsx(Le.Button,{"aria-label":`${F} image`,"data-active":L===se,onClick:()=>Ju(se),onMouseDown:Y,variant:"tertiary",children:F},F))}),j.jsx(Le.Button,{"aria-label":"Remove image",onClick:()=>xe(),onMouseDown:ie,variant:"tertiary",children:j.jsx(Je.Icon,{name:"Trash",variant:"danger"})})]})]})]})};function mm({autofocus:n,content:e="",lastEmittedContentRef:t}){const[r]=De();return R.useEffect(()=>{t.current!==e&&r.update(()=>{const i=new DOMParser().parseFromString(e,"text/html"),s=Gl(r,i),o=fe();o.clear().select(),Ru(s),n?o.selectEnd():Re(null)})},[n,e,r,t]),null}const bm=({autofocus:n=!1,autolink:e=!1,content:t,disabled:r=!1,errorMessage:u,fill:i=!1,files:s,inline:o=!1,inlineImages:a,invalid:l=!1,isSubmitting:f=!1,maxRows:h=12,minRows:c=1,onChange:d,onFilesChange:p,onInlineImagesChange:m,onSubmit:g,onUpload:y,placeholder:b,required:v=!1,submitLabel:w})=>{const S=R.useId(),T=R.useRef(void 0),[I,C]=R.useState([]),[L,$]=R.useState([]),x=R.useRef(new Map),E=s??I,A=a??L,B=G=>{s===void 0&&C(G),p==null||p(G)},_=R.useCallback(G=>{a===void 0&&$(G),m==null||m(G)},[a,m]),O=R.useCallback(G=>{const ie=G.map(H=>{const W=`pasted-${crypto.randomUUID()}`,pe=URL.createObjectURL(H);return x.current.set(W,pe),{image:{alt:H.name,soliboDocumentSlot:W,src:pe},pending:{file:H,slot:W}}});return _([...A,...ie.map(({pending:H})=>H)]),ie.map(({image:H})=>H)},[A,_]),N=R.useCallback(G=>{_(A.filter(H=>H.slot!==G));const ie=x.current.get(G);ie&&URL.revokeObjectURL(ie),x.current.delete(G)},[A,_]);R.useEffect(()=>()=>{x.current.forEach(G=>URL.revokeObjectURL(G)),x.current.clear()},[]),R.useEffect(()=>{const G=new Set(A.map(ie=>ie.slot));x.current.forEach((ie,H)=>{G.has(H)||(URL.revokeObjectURL(ie),x.current.delete(H))})},[A]);const U=G=>{if(typeof DataTransfer<"u"){const ie=new DataTransfer;return G.forEach(H=>ie.items.add(H)),ie.files}return Object.assign([...G],{item:ie=>G[ie]??null})},Y=async()=>{try{E.length>0&&await(y==null?void 0:y(U(E))),await(g==null?void 0:g()),E.length>0&&B([])}catch{return}},ee={namespace:"Editor",theme:{link:ae.link,list:{ol:ae.list,ul:ae.list},paragraph:ae.paragraph,text:{bold:ae.bold,italic:ae.italic,underline:ae.underline}},onError(G){throw G},nodes:[qu,pr,wn,gr,wr]};return j.jsxs("div",{className:Jr.t(ae.field,i&&ae.fill),"data-component":"editor","data-max-rows":h,"data-min-rows":c,children:[j.jsx("div",{className:Jr.t(ae.editor,i&&ae["fill-editor"],l&&ae.invalid,E.length>0&&ae["has-files"]),style:{"--editor-max-height":`calc(${h*1.25}em + (2 * var(--scale-8)))`,"--editor-min-height":`calc(${c*1.25}em + (2 * var(--scale-8)))`},children:j.jsxs(Dd,{initialConfig:ee,children:[!o&&j.jsx(gm,{disabled:r,isSubmitting:f,onInlineImageRemove:N,onFilesSelected:y||p?G=>{B([...E,...Array.from(G)])}:void 0,onSubmit:g?()=>void Y():void 0,submitLabel:w}),j.jsx("div",{className:ae.content,children:j.jsx(xh,{contentEditable:j.jsx(jd,{"aria-placeholder":b??"",ariaErrorMessage:l&&u?S:void 0,ariaInvalid:l||void 0,ariaRequired:v||void 0,placeholder:()=>b?j.jsx("div",{className:ae.placeholder,children:b}):null}),ErrorBoundary:$d})}),E.length>0&&j.jsx("div",{"aria-label":"Files to upload",className:ae.files,role:"region",children:E.map((G,ie)=>j.jsx(N0.File,{deleteAccessibleLabel:`Remove ${G.name} from upload queue`,name:G.name,onDelete:()=>B(E.filter((H,W)=>W!==ie))},`${G.name}-${G.size}-${G.lastModified}-${ie}`))}),n&&j.jsx(wd,{}),e&&j.jsx(Od,{matchers:Z1}),j.jsx(Xd,{}),m&&j.jsx(G1,{createImages:O}),t!==void 0&&j.jsx(mm,{autofocus:n,content:t,lastEmittedContentRef:T}),j.jsx(Qd,{validateUrl:us}),j.jsx(Yd,{}),d&&j.jsx(th,{onChange:(G,ie)=>{G.read(()=>{const H=Kl(ie,null),W=pi(H,{allowedAttributes:{...pi.defaults.allowedAttributes,img:[...pi.defaults.allowedAttributes.img??[],"data-solibo-document-id","data-solibo-document-slot"]},allowedTags:["a","b","br","i","img","li","ol","p","u","ul"]});T.current=W,d(W)})}})]})}),l&&u&&j.jsx("div",{className:ae.error,id:S,children:u})]})};exports.Editor=bm;
|
|
58
58
|
//# sourceMappingURL=index.cjs.map
|