@equisoft/design-elements-react 4.1.1-snapshot.20220706181822 → 4.1.1-snapshot.20220715143507

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 CHANGED
@@ -1344,14 +1344,14 @@
1344
1344
  padding: 0 var(--spacing-1x);
1345
1345
  `;function f(e){return e?Array.isArray(e)?e:[e]:[]}t.Listbox=(0,i.forwardRef)((({ariaLabelledBy:e,id:t,options:n,onChange:a,onFocusedValueChange:o,onKeyDown:d,checkIndicator:v=!1,className:g,defaultValue:y,dropdown:b=!1,multiselect:w=!1,numberOfItemsVisible:_=4,autofocus:M=!1,focusedValue:E,value:k},C)=>{const x=(0,i.useMemo)((()=>t||(0,u.v4)()),[t]),{isMobile:T}=(0,s.useDeviceContext)(),[S,H]=(0,i.useState)(),P=(0,i.useCallback)((e=>H(e)),[]),[V,O]=(0,i.useState)(f(k||y)),[q,L]=(0,i.useState)((()=>w?-1:n.findIndex((e=>e.value===V[0])))),D=(0,i.useMemo)((()=>n.map(((e,t)=>Object.assign(Object.assign({},e),{id:`${x}_${e.value}`,focusIndex:t,ref:(0,i.createRef)()})))),[x,n]),A=(0,i.useCallback)((e=>{O(f(e)),e===[]?L(-1):D.length>0&&!w&&L(n.findIndex((t=>t.value===e[0])))}),[D.length,w,n]);(0,i.useEffect)((()=>{void 0!==k&&A(k)}),[A,k]);const j=(0,i.useCallback)(((e,t)=>{const n=null==e?void 0:e.ref.current;if(!S||!e||!n||void 0===t)return;const a=S.getBoundingClientRect(),r=n.getBoundingClientRect();if(n.offsetTop>=S.scrollTop+a.height)S.scrollTop=r.height*(t+1)-a.height;else if(a.top-r.top>=0){const e=(a.top-r.top)/r.height;S.scrollTop-=r.height*e}else S.scrollTop=n.offsetTop}),[S]);(0,i.useEffect)((()=>{if(E){const e=n.findIndex((e=>e.value===E)),t=D[e];L(e),j(t,e)}else L(-1)}),[E,D,n,j]),(0,i.useEffect)((()=>{if(M&&S&&S.focus(),V&&!w){const e=n.findIndex((e=>e.value===V[0]));-1!==e&&L(e)}}),[M,w,n,V,S]);const I=(0,i.useCallback)((e=>w?V.includes(e.value):V.length>0&&V[0]===e.value),[w,V]),R=(0,i.useCallback)((e=>e.focusIndex===q),[q]),W=(0,i.useCallback)((e=>v&&I(e)),[v,I]),N=(0,i.useCallback)((e=>{L(e.focusIndex),w?V.includes(e.value)?O(V.filter((t=>t!==e.value))):O([...V,e.value]):O([e.value]),null==a||a(e)}),[w,a,V]),z=(0,i.useCallback)((e=>{const t=D.filter((e=>!e.disabled));return(0,l.getPreviousElementInArray)(t,t.findIndex((t=>t.focusIndex===e)))}),[D]),Z=(0,i.useCallback)((e=>{const t=D.filter((e=>!e.disabled));return(0,l.getNextElementInArray)(t,t.findIndex((t=>t.focusIndex===e)))}),[D]),B=(0,i.useCallback)((e=>()=>N(e)),[N]),F=(0,i.useCallback)((e=>{L(e.focusIndex)}),[]);(0,i.useLayoutEffect)((()=>{var e;const t=D[q];if(!S||!(null===(e=null==t?void 0:t.ref)||void 0===e?void 0:e.current))return;const n=S.getBoundingClientRect(),a=t.ref.current.getBoundingClientRect(),r=n.y,i=n.y+n.height,o=a.y,l=a.y+a.height;let u=null;switch(o>=r&&l<=i?u=null:o<=r?u="up":l>=i&&(u="down"),u){case"up":case"down":j(D[q],q)}}),[D,_,q,j,S]),(0,i.useEffect)((()=>{const e=n.findIndex((e=>e.value===E));-1!==e&&S&&L(e)}),[n,E,S]);const U=(0,i.useCallback)((e=>{switch(e.key){case"Enter":e.preventDefault(),q>=0&&N(D[q]);break;case"ArrowUp":{e.preventDefault();const t=z(q);t&&(L(t.focusIndex),o&&o(D[t.focusIndex]));break}case"ArrowDown":{e.preventDefault();const t=Z(q);t&&(L(t.focusIndex),o&&o(D[t.focusIndex]));break}}null==d||d(e)}),[D,o,d,q,N,z,Z]);return(0,r.jsx)(c,Object.assign({"aria-activedescendant":function(e){if(e>=0&&D[e])return`${x}_${D[e].value}`}(q),"aria-labelledby":e,"aria-multiselectable":w,className:g,isDropdown:b,ref:C,role:"listbox",tabIndex:-1},{children:(0,r.jsx)(m,Object.assign({"data-testid":"listbox-list",id:x,isMobile:T,numberOfItemsVisible:_,onBlur:()=>L(-1),onKeyDown:U,onKeyPress:U,ref:P,role:"presentation",tabIndex:0},{children:D.map((e=>(0,r.jsxs)(p,Object.assign({"aria-disabled":e.disabled,"aria-label":e.label||e.value,"aria-selected":I(e),checkIndicator:v,"data-testid":`listitem-${e.value}`,disabled:e.disabled,focused:R(e),id:e.id,isMobile:T,onClick:e.disabled?void 0:B(e),onMouseMove:()=>F(e),ref:e.ref,role:"option",selected:I(e)},{children:[W(e)&&(0,r.jsx)(h,{"data-testid":"check-icon",name:"check",size:T?"24":"16"}),e.label||e.value]}),e.id)))}))}))})),t.Listbox.displayName="Listbox";try{Listbox.displayName="Listbox",Listbox.__docgenInfo={description:"",displayName:"Listbox",props:{ariaLabelledBy:{defaultValue:null,description:"",name:"ariaLabelledBy",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},options:{defaultValue:null,description:"{ value: string; label?: string; }[]",name:"options",required:!0,type:{name:"ListboxOption[]"}},autofocus:{defaultValue:{value:!1},description:"Autofocus",name:"autofocus",required:!1,type:{name:"boolean"}},checkIndicator:{defaultValue:{value:!1},description:"Display check indicator on the selected option",name:"checkIndicator",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},defaultValue:{defaultValue:null,description:"The default selected option. You may specify an array of strings when using multiselect feature.",name:"defaultValue",required:!1,type:{name:"Value"}},dropdown:{defaultValue:{value:!1},description:"Add this if its used as a dropdown (Adds absolute positioning)",name:"dropdown",required:!1,type:{name:"boolean"}},multiselect:{defaultValue:{value:!1},description:"Activates multiple selection feature",name:"multiselect",required:!1,type:{name:"boolean"}},numberOfItemsVisible:{defaultValue:{value:4},description:"Number of visible items in the listbox before overflow",name:"numberOfItemsVisible",required:!1,type:{name:"number"}},focusedValue:{defaultValue:null,description:"Sets the current focused element in the listbox",name:"focusedValue",required:!1,type:{name:"string"}},value:{defaultValue:null,description:"Sets the selected value (controlled input)",name:"value",required:!1,type:{name:"Value"}},onChange:{defaultValue:null,description:"onChange callback function, invoked when an option is selected",name:"onChange",required:!1,type:{name:"((option: ListboxOption) => void)"}},onKeyDown:{defaultValue:null,description:"onKeyDown callback function, invoked when a key is pressed",name:"onKeyDown",required:!1,type:{name:"((event: KeyboardEvent<Element>) => void)"}},onFocusedValueChange:{defaultValue:null,description:"onFocusedValueChange callback function, invoked when focused value changes",name:"onFocusedValueChange",required:!1,type:{name:"((option?: ListboxOption) => void)"}},ref:{defaultValue:null,description:"",name:"ref",required:!1,type:{name:"Ref<HTMLDivElement>"}},key:{defaultValue:null,description:"",name:"key",required:!1,type:{name:"Key | null"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/listbox/listbox.tsx#Listbox"]={docgenInfo:Listbox.__docgenInfo,name:"Listbox",path:"src/components/listbox/listbox.tsx#Listbox"})}catch(e){}},2374:function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Lozenge=void 0;const r=n(348),i=a(n(1608)),o=n(9924),l=n(5369),u=i.default.span`
1346
1346
  align-items: center;
1347
- background-color: ${function({$type:e,theme:t}){switch(e){case"success":return t.notifications["success-1.2"];case"disabled":return t.greys["light-grey"];case"alert":return t.notifications["alert-2.2"];case"warning":return t.notifications["warning-3.2"];case"info":return"#f9f7fb";default:return t.greys["light-grey"]}}};
1348
- border: 1px solid ${function({$type:e,theme:t}){switch(e){case"success":return t.notifications["success-1.1"];case"disabled":return t.greys["mid-grey"];case"alert":return t.notifications["alert-2.1"];case"warning":return t.notifications["warning-3.1"];case"info":return t.notifications["info-1.1"];default:return t.greys["dark-grey"]}}};
1347
+ background-color: ${function({$type:e,theme:t}){switch(e){case"success":return t.notifications["success-1.2"];case"disabled":return t.greys["light-grey"];case"alert":return t.notifications["alert-2.2"];case"warning":return t.notifications["warning-3.2"];case"info":return"#f9f7fb";case"default":default:return t.greys["light-grey"]}}};
1348
+ border: 1px solid ${function({$type:e,theme:t}){switch(e){case"success":return t.notifications["success-1.1"];case"disabled":return t.greys["mid-grey"];case"alert":return t.notifications["alert-2.1"];case"warning":return t.notifications["warning-3.1"];case"info":return t.notifications["info-1.1"];case"default":default:return t.greys["dark-grey"]}}};
1349
1349
  border-radius: ${({$isMobile:e})=>e?"var(--border-radius)":"var(--border-radius-half)"};
1350
1350
  box-sizing: border-box;
1351
- color: ${function({$type:e,theme:t}){switch(e){case"success":return t.notifications["success-1.1"];case"disabled":return t.greys["mid-grey"];case"alert":return t.notifications["alert-2.1"];case"warning":return t.notifications["warning-3.1"];case"info":return t.notifications["info-1.1"];default:return t.greys["dark-grey"]}}};
1351
+ color: ${function({$type:e,theme:t}){switch(e){case"success":return t.notifications["success-1.1"];case"disabled":return t.greys["mid-grey"];case"alert":return t.notifications["alert-2.1"];case"warning":return t.notifications["warning-3.1"];case"info":return t.notifications["info-1.1"];case"default":default:return t.greys["dark-grey"]}}};
1352
1352
  display: inline-flex;
1353
1353
  font-size: ${({$isMobile:e})=>e?"0.875rem":"0.75rem"};
1354
- font-weight: var(--font-semi-bold);
1354
+ font-weight: var(--font-normal);
1355
1355
  line-height: ${({$isMobile:e})=>e?"1.375rem":"0.875rem"};
1356
1356
  max-width: ${"312px"};
1357
1357
  overflow: hidden;
@@ -1362,7 +1362,7 @@
1362
1362
  width: fit-content;
1363
1363
  `,s=(0,i.default)(l.Icon)`
1364
1364
  margin-right: ${({$isMobile:e})=>e?"var(--spacing-1x)":"var(--spacing-half)"};
1365
- `,d=({children:e,className:t,icon:n,type:a})=>{const{isMobile:i}=(0,o.useDeviceContext)();return(0,r.jsxs)(u,Object.assign({$type:a,className:t,$isMobile:i},{children:[n&&(0,r.jsx)(s,{"data-testid":"lozenge-icon",name:n,size:i?"16":"12",$isMobile:i}),e]}))};t.Lozenge=d;try{d.displayName="Lozenge",d.__docgenInfo={description:"",displayName:"Lozenge",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},type:{defaultValue:null,description:"",name:"type",required:!1,type:{name:"enum",value:[{value:'"disabled"'},{value:'"info"'},{value:'"alert"'},{value:'"success"'},{value:'"warning"'}]}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"enum",value:[{value:'"alertCircle"'},{value:'"alertFilled"'},{value:'"alertTriangle"'},{value:'"alertOctagon"'},{value:'"arrowDown"'},{value:'"arrowLeft"'},{value:'"arrowRight"'},{value:'"arrowUp"'},{value:'"bell"'},{value:'"bento"'},{value:'"calendar"'},{value:'"check"'},{value:'"chevronDown"'},{value:'"chevronLeft"'},{value:'"chevronRight"'},{value:'"chevronUp"'},{value:'"chevronsLeft"'},{value:'"chevronsRight"'},{value:'"circle"'},{value:'"contracts"'},{value:'"copy"'},{value:'"edit"'},{value:'"equisoft"'},{value:'"externalLink"'},{value:'"eye"'},{value:'"eyeOff"'},{value:'"files"'},{value:'"helpCircle"'},{value:'"history"'},{value:'"home"'},{value:'"info"'},{value:'"mail"'},{value:'"mapPin"'},{value:'"megaphone"'},{value:'"menu"'},{value:'"minus"'},{value:'"moreHorizontal"'},{value:'"moreVertical"'},{value:'"organization"'},{value:'"open"'},{value:'"phone"'},{value:'"plusSign"'},{value:'"reorder"'},{value:'"search"'},{value:'"settings"'},{value:'"star"'},{value:'"transfer"'},{value:'"trash"'},{value:'"user"'},{value:'"users"'},{value:'"warningFilled"'},{value:'"x"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/lozenge/lozenge.tsx#Lozenge"]={docgenInfo:d.__docgenInfo,name:"Lozenge",path:"src/components/lozenge/lozenge.tsx#Lozenge"})}catch(e){}},2976:function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MenuButton=void 0;const r=n(348),i=n(8156),o=n(3210),l=a(n(1608)),u=n(8075),s=n(1011),d=n(4406),c=n(5369),m=n(1612),p=(0,l.default)(m.Menu)`
1365
+ `,d=({children:e,className:t,icon:n,type:a})=>{const{isMobile:i}=(0,o.useDeviceContext)();return(0,r.jsxs)(u,Object.assign({$type:a,className:t,$isMobile:i},{children:[n&&(0,r.jsx)(s,{"data-testid":"lozenge-icon",name:n,size:i?"16":"12",$isMobile:i}),e]}))};t.Lozenge=d;try{d.displayName="Lozenge",d.__docgenInfo={description:"",displayName:"Lozenge",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},type:{defaultValue:null,description:"",name:"type",required:!1,type:{name:"enum",value:[{value:'"disabled"'},{value:'"info"'},{value:'"default"'},{value:'"alert"'},{value:'"success"'},{value:'"warning"'}]}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"enum",value:[{value:'"alertCircle"'},{value:'"alertFilled"'},{value:'"alertTriangle"'},{value:'"alertOctagon"'},{value:'"arrowDown"'},{value:'"arrowLeft"'},{value:'"arrowRight"'},{value:'"arrowUp"'},{value:'"bell"'},{value:'"bento"'},{value:'"calendar"'},{value:'"check"'},{value:'"chevronDown"'},{value:'"chevronLeft"'},{value:'"chevronRight"'},{value:'"chevronUp"'},{value:'"chevronsLeft"'},{value:'"chevronsRight"'},{value:'"circle"'},{value:'"contracts"'},{value:'"copy"'},{value:'"edit"'},{value:'"equisoft"'},{value:'"externalLink"'},{value:'"eye"'},{value:'"eyeOff"'},{value:'"files"'},{value:'"helpCircle"'},{value:'"history"'},{value:'"home"'},{value:'"info"'},{value:'"mail"'},{value:'"mapPin"'},{value:'"megaphone"'},{value:'"menu"'},{value:'"minus"'},{value:'"moreHorizontal"'},{value:'"moreVertical"'},{value:'"organization"'},{value:'"open"'},{value:'"phone"'},{value:'"plusSign"'},{value:'"reorder"'},{value:'"search"'},{value:'"settings"'},{value:'"star"'},{value:'"transfer"'},{value:'"trash"'},{value:'"user"'},{value:'"users"'},{value:'"warningFilled"'},{value:'"x"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/lozenge/lozenge.tsx#Lozenge"]={docgenInfo:d.__docgenInfo,name:"Lozenge",path:"src/components/lozenge/lozenge.tsx#Lozenge"})}catch(e){}},2976:function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MenuButton=void 0;const r=n(348),i=n(8156),o=n(3210),l=a(n(1608)),u=n(8075),s=n(1011),d=n(4406),c=n(5369),m=n(1612),p=(0,l.default)(m.Menu)`
1366
1366
  max-width: ${u.menuDimensions.maxWidth};
1367
1367
  min-width: ${u.menuDimensions.minWidth};
1368
1368
  `,h=(0,l.default)(c.Icon)`
@@ -1,6 +1,6 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { IconName } from '../icon/icon';
3
- export declare type LozengeType = 'success' | 'alert' | 'warning' | 'info' | 'disabled';
3
+ export declare type LozengeType = 'default' | 'success' | 'alert' | 'warning' | 'info' | 'disabled';
4
4
  interface Props {
5
5
  className?: string;
6
6
  type?: LozengeType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equisoft/design-elements-react",
3
- "version": "4.1.1-snapshot.20220706181822",
3
+ "version": "4.1.1-snapshot.20220715143507",
4
4
  "description": "React implementation of the Equisoft design system.",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/bundle.js",