@equisoft/design-elements-react 10.4.2-snapshot.20260901130211 → 10.4.2-snapshot.20260901210302
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/bundle.js +23 -11
- package/dist/components/avatar/avatar.d.ts +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -297,23 +297,35 @@
|
|
|
297
297
|
display: flex;
|
|
298
298
|
flex-direction: column;
|
|
299
299
|
justify-content: flex-start;
|
|
300
|
-
`,mo=({className:e,id:t,mode:r="single",items:a,onToggle:i})=>{const l=(0,o.useMemo)(()=>t||d(),[t]),s=(0,o.useMemo)(()=>a.map(()=>(0,o.createRef)()),[a]),[c,u]=(0,o.useState)(()=>a.map(e=>{const t=`${l}-${e.title.replace(/\s+/g,"-")}`;return e.expanded?t:null}).filter(e=>null!==e)),p=(0,o.useCallback)(e=>{"single"===r?u(t=>t.includes(e)?[]:[e]):"multi"===r&&u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),null==i||i(e,!c.includes(e))},[r,i,c,u]);return(0,n.jsx)(po,{className:e,children:a.map((e,t)=>{const r=`${l}-${e.title.replace(/\s+/g,"-")}`;return(0,n.jsx)(uo,{id:r,title:e.title,content:e.content,expanded:c.includes(r),disabled:e.disabled,buttonRef:s[t],headingType:e.headingType,headingTag:e.headingTag,onToggle:()=>p(r),onKeyDown:e=>((e,t)=>{var r;const{key:n}=e;if("ArrowUp"===n||"ArrowDown"===n){let o;for(e.preventDefault(),"ArrowUp"===n?(o=t-1,o<0&&(o=a.length-1)):o=(t+1)%a.length;null===(r=a[o])||void 0===r?void 0:r.disabled;)o="ArrowUp"===n?o-1:(o+1)%a.length,o<0&&(o=a.length-1);const i=s[o].current;i&&i.focus()}})(e,t)},r)})})};mo.displayName="Accordion";const ho=["#EBE6EB","#FAF3E7","#E7F0F1","#F3E6E6","#F2F5E8","#FAEDE6","#E7EDF5","#E6EDEB","#F2E9EF","#F1F0F7","#ECF5F0","#F7EAF1","#F0EBFA","#E8F7EA","#F5ECE5","#E9F0F6","#F6E9E5","#EAF6F6","#F7F2E8","#E5EBF7","#F1E5F3","#EEF8E5","#F8EAEA","#E6E9F4","#F4F0E6","#EBF7F1"],fo=["#220123","#7D520B","#0B3E45","#530000","#4A5E11","#7B2D00","#0A2A5B","#042A1F","#4C1536","#444167","#1A4A2E","#582339","#2E1A58","#0D4A1D","#5F3308","#134A62","#5F1818","#0A5659","#755808","#082C67","#46084B","#3B5A0A","#670808","#1F2756","#614710","#0D5137"];function go(e){return{backgroundColor:e.component["avatar-background-color"],textColor:e.component["avatar-text-color"]}}function bo(){return(0,o.useContext)(l.ThemeContext)}function vo({size:e,isMobile:t}){switch(e){case"
|
|
301
|
-
font-size:
|
|
300
|
+
`,mo=({className:e,id:t,mode:r="single",items:a,onToggle:i})=>{const l=(0,o.useMemo)(()=>t||d(),[t]),s=(0,o.useMemo)(()=>a.map(()=>(0,o.createRef)()),[a]),[c,u]=(0,o.useState)(()=>a.map(e=>{const t=`${l}-${e.title.replace(/\s+/g,"-")}`;return e.expanded?t:null}).filter(e=>null!==e)),p=(0,o.useCallback)(e=>{"single"===r?u(t=>t.includes(e)?[]:[e]):"multi"===r&&u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),null==i||i(e,!c.includes(e))},[r,i,c,u]);return(0,n.jsx)(po,{className:e,children:a.map((e,t)=>{const r=`${l}-${e.title.replace(/\s+/g,"-")}`;return(0,n.jsx)(uo,{id:r,title:e.title,content:e.content,expanded:c.includes(r),disabled:e.disabled,buttonRef:s[t],headingType:e.headingType,headingTag:e.headingTag,onToggle:()=>p(r),onKeyDown:e=>((e,t)=>{var r;const{key:n}=e;if("ArrowUp"===n||"ArrowDown"===n){let o;for(e.preventDefault(),"ArrowUp"===n?(o=t-1,o<0&&(o=a.length-1)):o=(t+1)%a.length;null===(r=a[o])||void 0===r?void 0:r.disabled;)o="ArrowUp"===n?o-1:(o+1)%a.length,o<0&&(o=a.length-1);const i=s[o].current;i&&i.focus()}})(e,t)},r)})})};mo.displayName="Accordion";const ho=["#EBE6EB","#FAF3E7","#E7F0F1","#F3E6E6","#F2F5E8","#FAEDE6","#E7EDF5","#E6EDEB","#F2E9EF","#F1F0F7","#ECF5F0","#F7EAF1","#F0EBFA","#E8F7EA","#F5ECE5","#E9F0F6","#F6E9E5","#EAF6F6","#F7F2E8","#E5EBF7","#F1E5F3","#EEF8E5","#F8EAEA","#E6E9F4","#F4F0E6","#EBF7F1"],fo=["#220123","#7D520B","#0B3E45","#530000","#4A5E11","#7B2D00","#0A2A5B","#042A1F","#4C1536","#444167","#1A4A2E","#582339","#2E1A58","#0D4A1D","#5F3308","#134A62","#5F1818","#0A5659","#755808","#082C67","#46084B","#3B5A0A","#670808","#1F2756","#614710","#0D5137"];function go(e){return{backgroundColor:e.component["avatar-background-color"],textColor:e.component["avatar-text-color"]}}function bo(){return(0,o.useContext)(l.ThemeContext)}function vo({size:e,isMobile:t}){switch(e){case"xxsmall":return l.css`
|
|
301
|
+
font-size: 0.375rem;
|
|
302
|
+
height: var(--size-1x);
|
|
303
|
+
letter-spacing: 0.00831rem;
|
|
304
|
+
width: var(--size-1x);
|
|
305
|
+
`;case"xsmall":return l.css`
|
|
306
|
+
font-size: 0.46875rem;
|
|
307
|
+
height: 1.25rem;
|
|
308
|
+
letter-spacing: 0.01044rem;
|
|
309
|
+
width: 1.25rem;
|
|
310
|
+
`;case"small":return l.css`
|
|
311
|
+
font-size: ${t?"0.75":"0.5625"}rem;
|
|
302
312
|
height: ${t?"var(--size-2x)":"var(--size-1halfx)"};
|
|
303
|
-
letter-spacing:
|
|
313
|
+
letter-spacing: 0.0125rem;
|
|
304
314
|
width: ${t?"var(--size-2x)":"var(--size-1halfx)"};
|
|
305
|
-
`;case"
|
|
306
|
-
font-size: ${t?"
|
|
315
|
+
`;case"medium":return l.css`
|
|
316
|
+
font-size: ${t?"1":"0.75"}rem;
|
|
307
317
|
height: ${t?"var(--size-2halfx)":"var(--size-2x)"};
|
|
308
|
-
letter-spacing:
|
|
318
|
+
letter-spacing: 0.0125rem;
|
|
309
319
|
width: ${t?"var(--size-2halfx)":"var(--size-2x)"};
|
|
310
|
-
`;case"medium":return l.css`
|
|
311
|
-
font-size: 1rem;
|
|
312
|
-
height: var(--size-3x);
|
|
313
|
-
width: var(--size-3x);
|
|
314
320
|
`;case"large":return l.css`
|
|
321
|
+
font-size: ${t?"1.125":"1"}rem;
|
|
322
|
+
height: ${t?"var(--size-3halfx)":"var(--size-3x)"};
|
|
323
|
+
letter-spacing: 0.0125rem;
|
|
324
|
+
width: ${t?"var(--size-3halfx)":"var(--size-3x)"};
|
|
325
|
+
`;case"xlarge":return l.css`
|
|
315
326
|
font-size: 1.5rem;
|
|
316
327
|
height: ${t?"var(--size-4halfx)":"var(--size-5x)"};
|
|
328
|
+
letter-spacing: 0.0125rem;
|
|
317
329
|
width: ${t?"var(--size-4halfx)":"var(--size-5x)"};
|
|
318
330
|
`}}const yo=s().div`
|
|
319
331
|
align-items: center;
|
|
@@ -329,7 +341,7 @@
|
|
|
329
341
|
border-radius: 50%;
|
|
330
342
|
object-fit: cover;
|
|
331
343
|
${vo}
|
|
332
|
-
`,xo=({bgColor:e,className:t,iconName:r,imgSrc:a,username:i,size:l="
|
|
344
|
+
`,xo=({bgColor:e,className:t,iconName:r,imgSrc:a,username:i,size:l="small"})=>{const{t:s}=z("avatar"),{isMobile:c}=y(),d=bo(),{backgroundColor:u,textColor:p}=(0,o.useMemo)(()=>function(e,t){if(!t||0===t.trim().length)return go(e);var r;const n=((r=t.charAt(0).toUpperCase())?r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").charCodeAt(0):-1)-65;return n>=0&&n<ho.length?{backgroundColor:ho[n],textColor:fo[n]}:go(e)}(d,i),[d,i]),m=null!=e?e:u,h=e?void 0:p,f=(0,o.useMemo)(()=>void 0===i?"":function(e){const t=e.normalize("NFD").replace(/[^a-zA-Z0-9\s]/g,"");if(0===t.length)return"";const r=t.split(/\s/);return 1===r.length&&t.length>0?t.substring(0,2).toUpperCase():r[0].charAt(0).toUpperCase()+r[r.length-1].charAt(0).toUpperCase()}(i),[i]),g=(0,o.useMemo)(()=>s("ariaLabel",{username:i}),[i,s]),b=f.length<=2&&f.length>0;return a?(0,n.jsx)(_o,{src:a,alt:g,className:t,size:l,isMobile:c}):(0,n.jsx)(yo,{role:"img","aria-label":g,className:t,$bgColor:m,$textColor:h,size:l,isMobile:c,children:r?(0,n.jsx)(dn,{name:r}):(0,n.jsx)("span",{"data-testid":"avatar-initials",children:b?f:(0,n.jsx)(dn,{name:"user",size:c?"24":"16"})})})};xo.displayName="Avatar";const ko=no("Badge",["root"]),wo=s().span`
|
|
333
345
|
display: inline-flex;
|
|
334
346
|
flex-shrink: 0;
|
|
335
347
|
position: relative;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
2
|
import { type IconName } from '../icon';
|
|
3
|
-
export type AvatarSize = 'xsmall' | 'small' | 'medium' | 'large';
|
|
3
|
+
export type AvatarSize = 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
4
4
|
interface BaseAvatarProps {
|
|
5
5
|
bgColor?: string;
|
|
6
6
|
className?: string;
|
package/package.json
CHANGED