hisd3-ui-kit 4.2.1 → 4.2.2

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/index.js CHANGED
@@ -13,7 +13,10 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{ConfigPro
13
13
  * The Sider is rendered as a plain antd <Sider> (not styled(Sider)) because
14
14
  * styled-components would swallow its \`theme\` prop; style it from here.
15
15
  */
16
+ /* the whole sidebar is chrome: never select its text on drag */
16
17
  > .ant-layout-sider.hisd3-sider {
18
+ user-select: none;
19
+ -webkit-user-select: none;
17
20
  position: sticky;
18
21
  top: 0;
19
22
  height: ${({$appShell:e})=>e?"100%":"100vh"};
@@ -203,6 +206,8 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{ConfigPro
203
206
  background: rgba(0, 0, 0, 0.05);
204
207
  }
205
208
  `,pe=S.button`
209
+ user-select: none;
210
+ -webkit-user-select: none;
206
211
  position: absolute;
207
212
  top: ${({$top:e})=>e}px;
208
213
  left: ${({$left:e})=>e}px;
@@ -321,6 +326,8 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{ConfigPro
321
326
  `,ve=(e,t)=>e.key??e.path??`menu-${t}`,we=(e,t)=>(e??[]).filter((e=>e&&!e.hideInMenu)).map(((e,r)=>{const n=ve(e,r);return Array.isArray(e.children)&&e.children.length>0?{key:n,icon:e.icon,label:e.name,disabled:e.disabled,type:e.group?"group":void 0,children:we(e.children,t)}:{key:n,icon:e.icon,disabled:e.disabled,label:t(e,e.name)}})),ke=(e,t)=>v("a",{href:e.path||"/"},t),Se=({account:r,avatarSrc:n,settingsUrl:i,onLogout:l,collapsed:d=!1,placement:s="topRight",extraItems:p=[]})=>{const{modal:c}=o.useApp(),h=[...p??[],{key:"settings",icon:t(I,{}),label:"Settings",onClick:()=>{window.location.href=i??"/settings"}},{key:"logout",icon:t(C,{}),label:"Logout",onClick:()=>{c.confirm({title:"Are you sure you want to logout?",content:"Please click OK to continue",icon:t(z,{}),onOk:l})}}],g=(r.fullName||"").replace(/\(.*?\)/g," ").split(/[\s,]+/).map((e=>e.replace(/[^\p{L}\p{N}]/gu,""))).filter(Boolean).slice(0,2).map((e=>e[0].toUpperCase())).join("")||"?";return t(he,{className:"cr-user-info-light",$collapsed:d,$inHeader:"bottomRight"===s,children:t(a,{trigger:["click"],placement:s,menu:{items:h},children:e(ge,{className:"ant-dropdown-link",onClick:e=>e.preventDefault(),children:[t(ue,{$src:n,"aria-hidden":!0,children:!n&&g}),!d&&e(be,{children:[e(me,{children:[t(xe,{title:r.fullName,children:r.fullName}),t(fe,{children:t(E,{})})]}),r.positionType&&t(ye,{title:r.positionType,children:r.positionType})]})]})})})},{Sider:$e}=i,Ie=({children:i,account:a,logoUrl:s,appName:p,menuItems:c,onLogout:h,pathname:g,avatarSrc:u,styledTheme:b,settingsUrl:m,antdTheme:x,renderMenuLink:f=ke,headerExtra:v,userMenuItems:S,onCollapse:I,collapsed:C=!1,loading:E=!1,hideSidebar:z=!1,layoutTop:B=!1,hideCollapseTrigger:A=!1,collapseTrigger:F="edge",collapseTriggerOffset:O=Math.round(re/2),siderWidth:R=ee,bareContent:U=!1,hideHeaderBar:H=!1,brandHref:M="/",hideAccountCard:j=!1,scrollContent:G=!0})=>{const W=q(),_=void 0===x?W?null:X:x,[P,K]=w(C);k((()=>{K(C)}),[C]);const V=y((()=>we(c,f)),[c,f]),Y=y((()=>((e,t)=>{let r;const n=(e,o)=>{(e??[]).forEach(((e,i)=>{const a=ve(e,i);if(e.path&&t.startsWith(e.path)){const n=t===e.path,i=e.path.length+(n?1:0);(!r||i>r.length)&&(r={key:a,parents:o,length:i})}e.children?.length&&n(e.children,[...o,a])}))};return n(e,[]),{selectedKey:r?.key,openKeys:r?.parents??[]}})(c,g)),[c,g]),[J,Q]=w((()=>Y.openKeys));k((()=>{Q((e=>Array.from(new Set([...e,...Y.openKeys]))))}),[Y.openKeys.join("|")]);const Z=e=>{K(e),I?.(e)},he=Y.selectedKey?[Y.selectedKey]:[],ge=A?"none":F,ue=P?"Expand menu":"Collapse menu",be=e(ae,{href:M,$collapsed:!B&&P,children:[s?t("img",{src:s,alt:p}):t("span",{className:"hisd3-brand-mark","aria-hidden":!0}),(B||!P)&&t("h1",{children:p})]}),me=U?i:t(ce,{children:i});if("undefined"==typeof document)return null;const xe=t(o,{component:!1,children:t(l,{spinning:E,size:"large",children:z?t(r,{children:i}):e(ne,B?{$appShell:G,children:[e(le,{children:[be,t(d,{mode:"horizontal",items:V,selectedKeys:he}),v,!j&&t(Se,{account:a,avatarSrc:u,settingsUrl:m,onLogout:h,placement:"bottomRight",extraItems:S})]}),t(oe,{$scroll:G,children:me})]}:{hasSider:!0,$appShell:G,children:[e($e,{className:"hisd3-sider",width:R,collapsedWidth:te,collapsible:!0,collapsed:P,trigger:null,theme:"light",breakpoint:"lg",onBreakpoint:e=>{e&&Z(!0)},children:[be,t(ie,{className:P?"hisd3-collapsed":void 0,children:t(d,{mode:"inline",theme:"light",inlineCollapsed:P,items:V,selectedKeys:he,openKeys:P?void 0:J,onOpenChange:e=>Q(e)})}),!j&&t(Se,{account:a,avatarSrc:u,settingsUrl:m,onLogout:h,collapsed:P,placement:"topRight",extraItems:S})]}),e(oe,{$scroll:G,children:[!H&&e(de,{children:["header"===ge&&t(se,{type:"button","aria-label":ue,onClick:()=>Z(!P),children:t(P?D:T,{})}),t("span",{style:{flex:1}}),v]}),me]}),"edge"===ge&&t(pe,{type:"button","aria-label":ue,title:ue,$left:P?te:R,$top:O,onClick:()=>Z(!P),children:t(P?L:N,{})})]})})});return W&&!b?_?t(n,{theme:_,children:xe}):xe:t($,{theme:b??{},children:_?t(n,{theme:_,children:xe}):xe})},Ce=O.pageGutter,Ee=S.header`
322
327
  display: contents;
323
328
  `,ze=S.div`
329
+ user-select: none;
330
+ -webkit-user-select: none;
324
331
  display: flex;
325
332
  align-items: center;
326
333
  gap: 16px;
@@ -376,6 +383,8 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{ConfigPro
376
383
  flex: 1 0 auto;
377
384
  padding: 24px ${Ce}px 40px;
378
385
  `,Ne=({title:r,subtitle:n,breadcrumb:o,extra:i,leading:a,hideTopBar:l=!1,className:d})=>e(Ee,{className:d,children:[!l&&e(ze,{children:[a,o&&o.length>0&&t(s,{items:o.map((e=>({title:e.href?t("a",{href:e.href,children:e.title}):e.title,onClick:e.onClick})))}),!o?.length&&t("span",{style:{flex:1}}),i&&t(De,{children:i})]}),e(Te,{children:[t("h1",{children:r}),n&&t("p",{children:n})]})]}),Be=S.button`
386
+ user-select: none;
387
+ -webkit-user-select: none;
379
388
  position: relative;
380
389
  width: ${({$size:e=40})=>e}px;
381
390
  height: ${({$size:e=40})=>e}px;
@@ -546,6 +555,8 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{ConfigPro
546
555
  `,We=S.div`
547
556
  padding: 28px 16px;
548
557
  `,_e=({items:r=[],count:n,loading:o=!1,title:i="Notifications",onMarkAllRead:d,onSeeAll:s,seeAllLabel:c="See all notifications",emptyText:h="You're all caught up",onOpenChange:g,size:u=40,icon:b,className:m})=>{const[x,f]=w(!1),y=n??r.filter((e=>e.unread)).length,v=e(Fe,{children:[e(Oe,{children:[t("h4",{children:i}),d&&y>0&&t("button",{type:"button",onClick:d,children:"Mark all as read"})]}),o?t(We,{style:{textAlign:"center"},children:t(l,{})}):0===r.length?t(We,{children:t(p,{image:p.PRESENTED_IMAGE_SIMPLE,description:h})}):t(Re,{children:r.map((r=>e(Ue,{type:"button",$unread:r.unread,onClick:()=>{r.onClick?.(r),f(!1),g?.(!1)},children:[t(He,{$src:r.avatarSrc,children:!r.avatarSrc&&(r.icon??t(B,{}))}),e(Me,{children:[t("strong",{children:r.title}),r.description&&t("span",{children:r.description}),r.time&&t("time",{children:r.time})]}),r.unread&&t(je,{})]},r.id)))}),s&&t(Ge,{type:"button",onClick:()=>{s(),f(!1),g?.(!1)},children:c})]});return t(a,{open:x,onOpenChange:e=>{f(e),g?.(e)},trigger:["click"],placement:"bottomRight",popupRender:()=>v,children:e(Be,{type:"button",$size:u,$open:x,className:m,"aria-label":`${i}${y?` (${y} unread)`:""}`,children:[b??t(B,{}),y>0&&t(Ae,{$size:u,children:y>99?"99+":y})]})})},Pe=S.button`
558
+ user-select: none;
559
+ -webkit-user-select: none;
549
560
  position: relative;
550
561
  width: ${({$size:e})=>e}px;
551
562
  height: ${({$size:e})=>e}px;
@@ -737,6 +748,8 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{ConfigPro
737
748
  text-transform: uppercase;
738
749
  color: var(--ant-color-text-tertiary);
739
750
  `,nt=S.div`
751
+ user-select: none;
752
+ -webkit-user-select: none;
740
753
  display: flex;
741
754
  align-items: center;
742
755
  gap: 24px;
@@ -822,6 +835,8 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{ConfigPro
822
835
  }
823
836
  `,it=e=>`Total ${e.toLocaleString()} items`;function at({pagination:r,footer:n,...o}){const i=r||void 0,a=i?.pageSizeOptions??[10,20,50];return e(tt,{children:[t(c,{...o,pagination:!1}),n&&t(rt,{children:n}),i&&e(nt,{children:[t("span",{className:"hisd3-total",children:(i.renderTotal??it)(i.total,[(i.current-1)*i.pageSize+1,Math.min(i.current*i.pageSize,i.total)])}),t(h,{current:i.current,pageSize:i.pageSize,total:i.total,showSizeChanger:!1,onChange:(e,t)=>i.onChange(e,t),itemRender:(e,r,n)=>"prev"===r?t("span",{className:"ant-pagination-item-link",children:t(N,{})}):"next"===r?t("span",{className:"ant-pagination-item-link",children:t(L,{})}):n}),!i.hidePageSize&&t(ot,{role:"group","aria-label":"Rows per page",children:a.map((t=>e("button",{type:"button","aria-pressed":t===i.pageSize,onClick:()=>i.onChange(1,t),children:[t," / page"]},t)))})]})]})}const lt=S(g)`
824
837
  &.ant-tabs .ant-tabs-nav {
838
+ user-select: none;
839
+ -webkit-user-select: none;
825
840
  margin: 0;
826
841
 
827
842
  &::before {