hrm_ui_lib 0.0.1-beta.13 → 0.0.1-beta.15

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.
Files changed (53) hide show
  1. package/assets/styles/styles.css +1 -1
  2. package/components/Avatar/Avatar.d.ts +1 -1
  3. package/components/Avatar/Avatar.js +2 -1
  4. package/components/Avatar/types.d.ts +1 -0
  5. package/components/Copy/Copy.js +1 -1
  6. package/components/DarkModeSwitcher/DarkModeSwitcher.d.ts +10 -2
  7. package/components/DarkModeSwitcher/DarkModeSwitcher.js +5 -6
  8. package/components/DatePicker/CustomHeader/CustomHeader.js +5 -5
  9. package/components/DatePicker/RangeDatePicker/RangeDatePickerMobile.js +5 -5
  10. package/components/DatePicker/SimpleDatePicker/SimpleDatePickerMobile.js +3 -3
  11. package/components/DatePicker/TimePicker/MobileModalContent.js +2 -2
  12. package/components/FileUpload/DropzoneFileUpload/PreviewItem.js +2 -2
  13. package/components/FileUpload/DropzoneFileUpload/helpers.js +1 -1
  14. package/components/Link/Link.js +2 -2
  15. package/components/Link/types.d.ts +3 -0
  16. package/components/Menu/Menu.js +3 -3
  17. package/components/Menu/NestedMenu.js +3 -3
  18. package/components/Modal/Modal.js +2 -1
  19. package/components/Modal/ModalConfirmation.js +3 -2
  20. package/components/Popover/PopoverMobile.js +2 -2
  21. package/components/SVGIcons/IconBudgetTransfer.d.ts +4 -0
  22. package/components/SVGIcons/IconBudgetTransfer.js +7 -0
  23. package/components/SVGIcons/IconMoon.js +1 -1
  24. package/components/SVGIcons/IconRibbon.d.ts +4 -0
  25. package/components/SVGIcons/IconRibbon.js +1 -0
  26. package/components/SVGIcons/IconSun.js +10 -10
  27. package/components/SVGIcons/IconVacation.d.ts +4 -0
  28. package/components/SVGIcons/IconVacation.js +1 -0
  29. package/components/Select/FilterSelect/FilterSelect.js +4 -4
  30. package/components/Select/MultiSelect/MobileWrapper.js +2 -2
  31. package/components/Select/MultiSelect/MultiBase/MultiBase.js +4 -4
  32. package/components/Select/MultiSelect/MultiSelectGrouped/MultiSelectGrouped.js +7 -7
  33. package/components/Select/MultiSelect/MultiSelectWithTabs/MultiSelectWithTabs.js +7 -7
  34. package/components/Select/Select/Select.js +1 -1
  35. package/components/Select/Select/SelectMobile/MobileTopContent.d.ts +2 -1
  36. package/components/Select/Select/SelectMobile/MobileTopContent.js +2 -2
  37. package/components/Select/Select/SelectMobile/index.js +2 -2
  38. package/components/Select/Select/helpers.d.ts +1 -1
  39. package/components/Select/Select/helpers.js +1 -1
  40. package/components/Select/SharedComponents/InputSelectWrapper/InputSelectWrapper.js +3 -3
  41. package/components/Snackbar/Snackbar.d.ts +0 -1
  42. package/components/Snackbar/Snackbar.js +3 -3
  43. package/components/TableV2/AdvancedPagination.js +1 -1
  44. package/components/Tooltip/Tooltip.js +2 -1
  45. package/consts/index.d.ts +1 -2
  46. package/consts/index.js +1 -1
  47. package/helpers/current-week-work-days-range.d.ts +1 -0
  48. package/helpers/current-week-work-days-range.js +1 -0
  49. package/helpers/format-date.d.ts +3 -0
  50. package/helpers/format-date.js +1 -1
  51. package/package.json +1 -1
  52. package/utils/helpers.d.ts +2 -1
  53. package/utils/helpers.js +1 -1
@@ -1,5 +1,5 @@
1
- import{jsxs as m,jsx as e}from"react/jsx-runtime";import{OptionItem as R}from"../../../../helperComponents/OptionItem/OptionItem.js";import{Empty as E}from"../../../Empty/Empty.js";import{Modal as H}from"../../../Modal/Modal.js";import"react";import"classnames";import"../../../../consts/index.js";import"../../../../context/types.js";import"../../../../hooks/useScreenSize.js";import"react-hook-form";import{Text as O}from"../../../Text/Text.js";import{ITEM_SIZE_MOBILE as T}from"../../constants.js";import"../../../Checkbox/Checkbox.js";import"react-dom";import"motion/react";import"dayjs";import"../../../Collapse/CollapseGroup/CollapseGroup.js";import"../../SharedComponents/ContentTop.js";import{Loading as k}from"../../SharedComponents/Loading.js";import"../../../Input/Input.js";import{MobileTopContent as D}from"./MobileTopContent.js";import{FixedSizeList as F}from"react-window";const re=o=>{const{translations:t,currentSelection:n,isOpen:i,closeDropdown:s,isLoading:a,dataId:r,innerHelperText:l,filteredData:p,isRequiredField:d,onItemSelect:c,onItemDeselect:h,tooltipAddons:u,labelLeftIconProps:C,optionRightIconComponent:I,labelRightIconComponent:j,withSearch:g,searchValue:S,setSearchValue:b}=o,f=e=>({value:o})=>{b(""),e?d||h():c(o)},x=window.innerHeight,w=window.innerWidth;/* @__PURE__ */
1
+ import{jsxs as m,jsx as e}from"react/jsx-runtime";import{OptionItem as R}from"../../../../helperComponents/OptionItem/OptionItem.js";import{Empty as E}from"../../../Empty/Empty.js";import{Modal as H}from"../../../Modal/Modal.js";import"react";import"classnames";import"../../../../consts/index.js";import"../../../../context/types.js";import"../../../../hooks/useScreenSize.js";import"react-hook-form";import{Text as O}from"../../../Text/Text.js";import"react-dom";import{ITEM_SIZE_MOBILE as T}from"../../constants.js";import"../../../Checkbox/Checkbox.js";import"motion/react";import"dayjs";import"../../../Collapse/CollapseGroup/CollapseGroup.js";import"../../SharedComponents/ContentTop.js";import{Loading as k}from"../../SharedComponents/Loading.js";import"../../../Input/Input.js";import{MobileTopContent as D}from"./MobileTopContent.js";import{FixedSizeList as F}from"react-window";const re=o=>{const{translations:t,currentSelection:n,isOpen:i,closeDropdown:s,isLoading:a,dataId:r,innerHelperText:l,filteredData:p,isRequiredField:d,onItemSelect:c,onItemDeselect:h,tooltipAddons:u,labelLeftIconProps:C,optionRightIconComponent:I,labelRightIconComponent:j,withSearch:g,searchValue:S,setSearchValue:b}=o,f=e=>({value:o})=>{b(""),e?d||h():c(o)},x=window.innerHeight,w=window.innerWidth;/* @__PURE__ */
2
2
  return m(H,{isOpen:i,onClose:s,isMobileFullScreen:!0,children:[
3
- /* @__PURE__ */e(D,{searchValue:S,setSearchValue:b,onBack:()=>{s(),b("")},withSearch:g}),
3
+ /* @__PURE__ */e(D,{searchValue:S,setSearchValue:b,onBack:()=>{s(),b("")},withSearch:g,isOpen:i}),
4
4
  /* @__PURE__ */m("div",{className:"mobile_options_content",children:[l?/* @__PURE__ */e(O,{size:"xsmall",type:"secondary",className:"mobile_options_content__label",children:l}):null,a?/* @__PURE__ */e(k,{}):/* @__PURE__ */m("div",{"data-id":`${r}-options-content`,children:[p.length>0&&/* @__PURE__ */e(F,{height:x-30-32-24,itemCount:p.length,itemSize:T,width:w,style:{width:"100%",overflowX:"hidden",overflowY:"auto",willChange:"auto"},children:({index:o,style:t})=>{const i=p[o],s=i.value===n;/* @__PURE__ */
5
5
  return e(R,{size:"large",tooltipAddons:u,data:i,onClick:f(s),labelLeftIconProps:C,OptionRightIconComponent:I,LabelRightIconComponent:j,disabled:i.disabled,isSelected:s,dataId:i.dataId,style:t},i.value)}}),0===p.length?/* @__PURE__ */e(E,{size:"small",mainMessage:null==t?void 0:t.emptyListMainMessage}):null]})]})]})};export{re as SelectMobile};
@@ -1 +1 @@
1
- export declare const filterOptions: (options: TSelectOptions, searchValue: string) => TSelectOptions;
1
+ export declare const filterSearchData: (data: TSelectOptions, searchString: string) => TSelectOptions;
@@ -1 +1 @@
1
- const l=(e,l)=>l?e.filter(e=>"string"==typeof e.label&&e.label.toLowerCase().includes(l.toLowerCase())):e;export{l as filterOptions};
1
+ function s(t,e){return e.reduce(({contains:t,sourceStr:e},r)=>{const n=e.replace(r,"");return{contains:t&&n.length<e.length,sourceStr:n}},{contains:!0,sourceStr:t}).contains}const c=(t,e)=>{if(!e)return t;const r=e.toLowerCase().split(/\s+/).filter(Boolean).sort((t,e)=>e.length-t.length);return t.filter(({label:t})=>s(t.toString().toLowerCase(),r))};export{c as filterSearchData};
@@ -1,3 +1,3 @@
1
- import{jsxs as A,jsx as l,Fragment as B}from"react/jsx-runtime";import{useRef as M,useCallback as T,useMemo as q}from"react";import F from"classnames";import{Input as G}from"../../../Input/Input.js";import{useGetElemSizes as H}from"../../../../hooks/useGetElemSizes.js";import"../../../../consts/index.js";import"../../../../context/types.js";import"../../../../hooks/useScreenSize.js";import{useGetHasBottomSpace as P}from"../../../../hooks/useGetHasBottomSpace.js";import"react-hook-form";import{getStringWidth as _,setTranslationValue as E,noop as U}from"../../../../utils/helpers.js";import{useChangePositionsOnScroll as J}from"../../../../hooks/useChangePositionsOnScroll.js";import{MobileWrapper as K}from"../../MultiSelect/MobileWrapper.js";import{DesktopWrapper as Q}from"../../MultiSelect/DesktopWrapper.js";import X from"../../../SVGIcons/IconChevronUp.js";import Y from"../../../SVGIcons/IconChevronDown.js";const fe=e=>{const{isMobile:o,children:s,options:t,label:r,placeHolder:n,isRequiredField:i,labelAddons:a,disabled:p,className:c="",dropdownWidth:m,align:d="left",size:u,dropdownRef:f,setDropdownRef:h,containerRef:S,setIsOpen:j,isOpen:g,selectedValues:b,setContainerRef:I,overflowText:x,hasError:v,modalApplyButtonText:w,applySelectedItems:R,hideSelectedOptions:k=!1}=e,O=M(null),{width:C}=H(S),W=T(e=>_(e,14)>C-80,[C]),D=q(()=>{if(!b||!b.length)return"";const e=b.map(e=>e.label).join(", ");return W(e)?E(x||"",b.length):e},[t,b,W]),{hasBottomSpace:y}=P({element:f,input:O.current});return J(null==O?void 0:O.current,f,y),/* @__PURE__ */A("div",{className:F("select select--multi",c),ref:I,children:[
2
- /* @__PURE__ */l("div",{onClick:p?U:e=>{const o=null==e?void 0:e.target,s=null==o?void 0:o.getAttribute("class");e&&s&&(-1!==s.indexOf("icon-")||-1!==s.indexOf("svg-icon"))?(j(!g),e.preventDefault()):j(!0)},children:/* @__PURE__ */l(G,{readonly:!0,label:r,ref:O,hasError:v,className:"select__input",placeholder:n,required:i,currentValue:k?"":D,rightIconProps:{Component:g?X:Y,size:"small"},labelAddons:a,disabled:p,size:"large"===u?"large":"small"})}),
3
- /* @__PURE__ */l(B,{children:o?/* @__PURE__ */l(K,{applySelectedItems:R,isOpen:g,closeDrodown:()=>j(!1),modalApplyButtonText:w,children:s}):/* @__PURE__ */l(Q,{setDropdownRef:h,isOpen:g,align:d,dropdownWidth:m,inputRef:O.current,dropdownRef:f,containerRef:S,children:s})})]})};export{fe as InputSelectWrapper};
1
+ import{jsxs as A,jsx as n,Fragment as B}from"react/jsx-runtime";import{useRef as M,useCallback as T,useMemo as q}from"react";import F from"classnames";import{Input as G}from"../../../Input/Input.js";import{useGetElemSizes as H}from"../../../../hooks/useGetElemSizes.js";import"../../../../consts/index.js";import"../../../../context/types.js";import"../../../../hooks/useScreenSize.js";import{useGetHasBottomSpace as P}from"../../../../hooks/useGetHasBottomSpace.js";import"react-hook-form";import{getStringWidth as _,setTranslationValue as E,noop as U}from"../../../../utils/helpers.js";import{useChangePositionsOnScroll as J}from"../../../../hooks/useChangePositionsOnScroll.js";import{MobileWrapper as K}from"../../MultiSelect/MobileWrapper.js";import{DesktopWrapper as Q}from"../../MultiSelect/DesktopWrapper.js";import X from"../../../SVGIcons/IconChevronUp.js";import Y from"../../../SVGIcons/IconChevronDown.js";const fe=e=>{const{isMobile:o,children:s,options:t,label:r,placeHolder:l,isRequiredField:i,labelAddons:a,disabled:p,className:c="",dropdownWidth:m,align:d="left",size:u="small",dropdownRef:f,setDropdownRef:h,containerRef:S,setIsOpen:j,isOpen:g,selectedValues:b,setContainerRef:I,overflowText:x,hasError:v,modalApplyButtonText:w,applySelectedItems:R,hideSelectedOptions:k=!1}=e,O=M(null),{width:C}=H(S),W=T(e=>_(e,14)>C-80,[C]),D=q(()=>{if(!b||!b.length)return"";const e=b.map(e=>e.label).join(", ");return W(e)?E(x||"",b.length):e},[t,b,W]),{hasBottomSpace:y}=P({element:f,input:O.current});return J(null==O?void 0:O.current,f,y),/* @__PURE__ */A("div",{className:F("select select--multi",c),ref:I,children:[
2
+ /* @__PURE__ */n("div",{onClick:p?U:e=>{const o=null==e?void 0:e.target,s=null==o?void 0:o.getAttribute("class");e&&s&&(-1!==s.indexOf("icon-")||-1!==s.indexOf("svg-icon"))?(j(!g),e.preventDefault()):j(!0)},children:/* @__PURE__ */n(G,{readonly:!0,label:r,ref:O,hasError:v,className:"select__input",placeholder:l,required:i,currentValue:k?"":D,rightIconProps:{Component:g?X:Y,size:"small"},labelAddons:a,disabled:p,size:u})}),
3
+ /* @__PURE__ */n(B,{children:o?/* @__PURE__ */n(K,{applySelectedItems:R,isOpen:g,closeDrodown:()=>j(!1),modalApplyButtonText:w,children:s}):/* @__PURE__ */n(Q,{setDropdownRef:h,isOpen:g,align:d,dropdownWidth:m,inputRef:O.current,dropdownRef:f,containerRef:S,children:s})})]})};export{fe as InputSelectWrapper};
@@ -1,5 +1,4 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { TSnackbarProps, TToastProps } from './types';
3
- import 'react-toastify/dist/ReactToastify.css';
4
3
  export declare const notify: (toastProps: TToastProps) => void;
5
4
  export declare const Snackbar: (props: TSnackbarProps) => ReactElement;
@@ -1,5 +1,5 @@
1
- import{jsx as s,jsxs as o}from"react/jsx-runtime";import{toast as m,ToastContainer as l,Slide as d}from"react-toastify";import{Text as c}from"../Text/Text.js";import{Button as u}from"../Button/Button.js";import{DEFAULT_DURATION as f,TYPE_MAPPING as C,ICONS_MAPPING as h}from"./consts.js";import{IconDynamicComponent as N}from"../../helperComponents/IconDynamicComponent/IconDynamicComponent.js";import"react-toastify/dist/ReactToastify.css";const g=({actionProps:t,toastId:a,type:n="information",text:e})=>/* @__PURE__ */o("div",{"data-id":`${n}-toast-message`,className:"snackbar",children:[
1
+ import{jsx as s,jsxs as o}from"react/jsx-runtime";import{toast as m,ToastContainer as l,Slide as d}from"react-toastify";import{Text as c}from"../Text/Text.js";import{Button as u}from"../Button/Button.js";import{DEFAULT_DURATION as f,TYPE_MAPPING as C,ICONS_MAPPING as h}from"./consts.js";import{IconDynamicComponent as N}from"../../helperComponents/IconDynamicComponent/IconDynamicComponent.js";const g=({actionProps:t,toastId:a,type:n="information",text:e})=>/* @__PURE__ */o("div",{"data-id":`${n}-toast-message`,className:"snackbar",children:[
2
2
  /* @__PURE__ */o("div",{className:"snackbar__content",children:[
3
3
  /* @__PURE__ */s(N,{Component:h[n],type:C[n],size:"medium"}),
4
- /* @__PURE__ */s(c,{className:"snackbar__text pl-16 pr-8",type:"primary",size:"standard",weight:"regular",lineHeight:"large",children:e})]}),t?/* @__PURE__ */s(u,{size:"small",type:"tertiary",...t,onClick:s=>{var o;m.dismiss(a),null==(o=null==t?void 0:t.onClick)||o.call(t,s)}}):null]},a),y=t=>{const{toastId:s,closeSnackbar:o,actionProps:a,duration:n=f}=t;m(g(t),{className:"_container",toastId:s,autoClose:!a&&n}),m.onChange(t=>{"removed"===t.status&&(null==o||o(t.id))})},A=t=>{const{duration:o=1e3,position:a="bottom-center"}=t;/* @__PURE__ */
5
- return s(l,{className:"snackbar-wrapper",theme:"light",hideProgressBar:!0,transition:d,position:a,autoClose:o,closeButton:()=>null})};export{A as Snackbar,y as notify};
4
+ /* @__PURE__ */s(c,{className:"snackbar__text pl-16 pr-8",type:"primary",size:"standard",weight:"regular",lineHeight:"large",children:e})]}),t?/* @__PURE__ */s(u,{size:"small",type:"tertiary",...t,onClick:s=>{var o;m.dismiss(a),null==(o=null==t?void 0:t.onClick)||o.call(t,s)}}):null]},a),I=t=>{const{toastId:s,closeSnackbar:o,actionProps:a,duration:n=f}=t;m(g(t),{className:"_container",toastId:s,autoClose:!a&&n}),m.onChange(t=>{"removed"===t.status&&(null==o||o(t.id))})},y=t=>{const{duration:o=1e3,position:a="bottom-center"}=t;/* @__PURE__ */
5
+ return s(l,{className:"snackbar-wrapper",theme:"light",hideProgressBar:!0,transition:d,position:a,autoClose:o,closeButton:()=>null})};export{y as Snackbar,I as notify};
@@ -1,4 +1,4 @@
1
- import{jsxs as r,jsx as i}from"react/jsx-runtime";import{useState as v,useEffect as C}from"react";import{Input as x}from"../Input/Input.js";import{Button as N}from"../Button/Button.js";import{Select as _}from"../Select/Select/Select.js";import"../Select/MultiSelect/MultiSelect.js";import I from"classnames";import{Text as z}from"../Text/Text.js";import"../../consts/index.js";import"../../context/types.js";import"../../hooks/useScreenSize.js";import"react-hook-form";import"dayjs";import"../../helperComponents/ErrorMessage/consts.js";import"../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import"../Checkbox/Checkbox.js";import"react-dom";import"motion/react";import S from"../SVGIcons/IconChevronRight.js";import"../Collapse/CollapseGroup/CollapseGroup.js";import m from"../SVGIcons/IconMore.js";import"../Select/SharedComponents/ContentTop.js";import{OPTIONS as k}from"./constants/index.js";import $ from"../SVGIcons/IconChevronLeft.js";import y from"../SVGIcons/IconChevronDoubleLeft.js";import T from"../SVGIcons/IconChevronDoubleRight.js";function oe({table:e,totalCount:t,buttonText:o}){const[a,n]=v("1"),s=e.getState().pagination.pageIndex,l=e.getState().pagination.pageSize;return C(()=>{e.getPageCount()<Number(a)&&n("1")},[e.getPageCount(),e.getState().pagination]),/* @__PURE__ */r("div",{className:"advanced-table__pagination",children:[
1
+ import{jsxs as r,jsx as i}from"react/jsx-runtime";import{useState as v,useEffect as C}from"react";import{Input as x}from"../Input/Input.js";import{Button as N}from"../Button/Button.js";import{Select as _}from"../Select/Select/Select.js";import"../Select/MultiSelect/MultiSelect.js";import I from"classnames";import{Text as z}from"../Text/Text.js";import"../../consts/index.js";import"../../context/types.js";import"../../hooks/useScreenSize.js";import"react-hook-form";import"dayjs";import"../../helperComponents/ErrorMessage/consts.js";import"../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import"react-dom";import"../Checkbox/Checkbox.js";import"motion/react";import S from"../SVGIcons/IconChevronRight.js";import"../Collapse/CollapseGroup/CollapseGroup.js";import m from"../SVGIcons/IconMore.js";import"../Select/SharedComponents/ContentTop.js";import{OPTIONS as k}from"./constants/index.js";import $ from"../SVGIcons/IconChevronLeft.js";import y from"../SVGIcons/IconChevronDoubleLeft.js";import T from"../SVGIcons/IconChevronDoubleRight.js";function oe({table:e,totalCount:t,buttonText:o}){const[a,n]=v("1"),s=e.getState().pagination.pageIndex,l=e.getState().pagination.pageSize;return C(()=>{e.getPageCount()<Number(a)&&n("1")},[e.getPageCount(),e.getState().pagination]),/* @__PURE__ */r("div",{className:"advanced-table__pagination",children:[
2
2
  /* @__PURE__ */i(_,{setSelectedItem:t=>(t=>{t&&e.setPagination({pageIndex:0,pageSize:Number(t)})})(t),selectedItem:`${l}`,className:"no-border",options:k}),
3
3
  /* @__PURE__ */r("div",{className:"advanced-table__pagination__right",children:[
4
4
  /* @__PURE__ */r(z,{type:"tertiary",children:[s*l+1," - ",(s+1)*l," / ",t]}),
@@ -1 +1,2 @@
1
- import{jsx as p}from"react/jsx-runtime";import{useRef as H,useState as l,useEffect as n}from"react";import I from"classnames";import{Text as N}from"../Text/Text.js";import{useGetTooltipStyles as $}from"../../hooks/useGetTooltipStyles.js";import{useHideOnScroll as M}from"../../hooks/useHideOnScroll.js";import"../../context/types.js";import"../../hooks/useScreenSize.js";import"react-hook-form";import{Positions as O}from"./types.js";const G=e=>{const t=H(null),{size:o="large",text:s,className:i="",position:r=O.BOTTOM_LEFT,dataId:a="",id:m,elemRef:u,hovered:c=!1}=e,[d,f]=l(c),[v,h]=l(u||null),[x,T]=l(0);n(()=>{if(m){const e=document.getElementById(m.toString());h(e)}},[m]);const y=()=>{f(!0)},S=()=>f(!1);M(S);const{tooltipStyles:j,tooltipPosition:E}=$({elemRef:v,tooltipRef:t.current,initialPosition:r,toolTipCurrentWidth:x});return n(()=>(v&&(v.addEventListener("mouseenter",y),v.addEventListener("mouseleave",S)),()=>{null==v||v.removeEventListener("mouseenter",y),null==v||v.removeEventListener("mouseleave",S)}),[v]),n(()=>{var e;T(d&&(null==(e=null==t?void 0:t.current)?void 0:e.clientWidth)||0)},[d]),d?/* @__PURE__ */p("div",{style:j,"data-id":a,className:I(`tooltip tooltip--${o} tooltip--${E}`,i),ref:t,children:/* @__PURE__ */p(N,{dataId:`${a}-text`,className:"tooltip__inner",type:"primary",weight:"regular",lineHeight:"small",size:""+("small"==o?"xsmall":"small"),children:s})}):null};export{G as Tooltip};
1
+ import{jsx as p}from"react/jsx-runtime";import{useRef as H,useState as l,useEffect as n}from"react";import I from"classnames";import{Text as N}from"../Text/Text.js";import{useGetTooltipStyles as P}from"../../hooks/useGetTooltipStyles.js";import{useHideOnScroll as $}from"../../hooks/useHideOnScroll.js";import"../../context/types.js";import"../../hooks/useScreenSize.js";import"react-hook-form";import{Positions as M}from"./types.js";import{createPortal as O}from"react-dom";const k=e=>{const t=H(null),{size:o="large",text:s,className:i="",position:r=M.BOTTOM_LEFT,dataId:a="",id:m,elemRef:u,hovered:c=!1}=e,[d,f]=l(c),[v,h]=l(u||null),[x,y]=l(0);n(()=>{if(m){const e=document.getElementById(m.toString());h(e)}},[m]);const T=()=>{f(!0)},S=()=>f(!1);$(S);const{tooltipStyles:j,tooltipPosition:E}=P({elemRef:v,tooltipRef:t.current,initialPosition:r,toolTipCurrentWidth:x});return n(()=>(v&&(v.addEventListener("mouseenter",T),v.addEventListener("mouseleave",S)),()=>{null==v||v.removeEventListener("mouseenter",T),null==v||v.removeEventListener("mouseleave",S)}),[v]),n(()=>{var e;y(d&&(null==(e=null==t?void 0:t.current)?void 0:e.clientWidth)||0)},[d]),d?O(
2
+ /* @__PURE__ */p("div",{style:j,"data-id":a,className:I(`tooltip tooltip--${o} tooltip--${E}`,i),ref:t,children:/* @__PURE__ */p(N,{dataId:`${a}-text`,className:"tooltip__inner",type:"primary",weight:"regular",lineHeight:"small",size:""+("small"==o?"xsmall":"small"),children:s})}),document.body):null};export{k as Tooltip};
package/consts/index.d.ts CHANGED
@@ -38,8 +38,7 @@ export declare enum STORE_KEYS {
38
38
  isAuthenticated = "isAuthenticated",
39
39
  personId = "personId",
40
40
  isMobile = "isMobile",
41
- staffListColumns = "staffListColumns",
42
- themeMode = "themeMode"
41
+ staffListColumns = "staffListColumns"
43
42
  }
44
43
  export declare enum ThemeMode {
45
44
  Light = "light",
package/consts/index.js CHANGED
@@ -1 +1 @@
1
- import{FileTypeEnum as a}from"../type/file-upload.js";const s=["image/jpeg","image/png","application/pdf"],u=["image/jpeg","image/jpg","image/png","image/heic","image/heif","application/pdf"],c=[".jpeg",".jpg",".png",".heic",".heif",".pdf"],l={SMALL:768,MEDIUM:992,LARGE:1200},p=l.SMALL;var n=/* @__PURE__ */(e=>(e[e.size=0]="size",e[e.type=1]="type",e))(n||{}),i=/* @__PURE__ */(e=>(e.cardRadio="cardRadio",e.card="card",e))(i||{});const d="Custom scroll event has fired",g="CUSTOM_SCROLL_EVENT",M=[{label:"January",value:0},{label:"February",value:1},{label:"March",value:2},{label:"April",value:3},{label:"May",value:4},{label:"June",value:5},{label:"July",value:6},{label:"August",value:7},{label:"September",value:8},{label:"October",value:9},{label:"November",value:10},{label:"December",value:11}],m=10,v={[a.PDF]:["application/pdf"],[a.IMAGE]:["image/jpeg","image/png"],[a.DOC]:[".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"]};var o=/* @__PURE__ */(e=>(e.selectedLanguage="selectedLanguage",e.theme="theme",e.userActiveRole="userActiveRole",e.roleInfo="roleInfo",e.userInfo="userInfo",e.navigationInfo="navigationInfo",e.isNavMenuExpanded="isNavMenuExpanded",e.isAuthenticated="isAuthenticated",e.personId="personId",e.isMobile="isMobile",e.staffListColumns="staffListColumns",e.themeMode="themeMode",e))(o||{}),t=/* @__PURE__ */(e=>(e.Light="light",e.Dark="dark",e))(t||{});export{i as CARD_SELECT_TYPES,d as CUSTOM_SCROLL_MESSAGE,g as CUSTOM_SCROLL_NAME,m as DROPDOWN_AND_INPUT_GAP,v as FILE_ACCEPT_TYPE,n as FILE_UPLOAD_ERRORS,c as IMAGE_MIME_TYPE,s as IMAGE_MIME_TYPES,u as IMAGE_MIME_TYPES_FOR_PREVIEW,p as MOBILE_POINT,M as MONTHS,l as SCREEN_SIZES,o as STORE_KEYS,t as ThemeMode};
1
+ import{FileTypeEnum as a}from"../type/file-upload.js";const s=["image/jpeg","image/png","application/pdf"],u=["image/jpeg","image/jpg","image/png","image/heic","image/heif","application/pdf"],c=[".jpeg",".jpg",".png",".heic",".heif",".pdf"],l={SMALL:768,MEDIUM:992,LARGE:1200},p=l.SMALL;var n=/* @__PURE__ */(e=>(e[e.size=0]="size",e[e.type=1]="type",e))(n||{}),i=/* @__PURE__ */(e=>(e.cardRadio="cardRadio",e.card="card",e))(i||{});const g="Custom scroll event has fired",d="CUSTOM_SCROLL_EVENT",M=[{label:"January",value:0},{label:"February",value:1},{label:"March",value:2},{label:"April",value:3},{label:"May",value:4},{label:"June",value:5},{label:"July",value:6},{label:"August",value:7},{label:"September",value:8},{label:"October",value:9},{label:"November",value:10},{label:"December",value:11}],m=10,v={[a.PDF]:["application/pdf"],[a.IMAGE]:["image/jpeg","image/png"],[a.DOC]:[".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"]};var o=/* @__PURE__ */(e=>(e.selectedLanguage="selectedLanguage",e.theme="theme",e.userActiveRole="userActiveRole",e.roleInfo="roleInfo",e.userInfo="userInfo",e.navigationInfo="navigationInfo",e.isNavMenuExpanded="isNavMenuExpanded",e.isAuthenticated="isAuthenticated",e.personId="personId",e.isMobile="isMobile",e.staffListColumns="staffListColumns",e))(o||{}),t=/* @__PURE__ */(e=>(e.Light="light",e.Dark="dark",e))(t||{});export{i as CARD_SELECT_TYPES,g as CUSTOM_SCROLL_MESSAGE,d as CUSTOM_SCROLL_NAME,m as DROPDOWN_AND_INPUT_GAP,v as FILE_ACCEPT_TYPE,n as FILE_UPLOAD_ERRORS,c as IMAGE_MIME_TYPE,s as IMAGE_MIME_TYPES,u as IMAGE_MIME_TYPES_FOR_PREVIEW,p as MOBILE_POINT,M as MONTHS,l as SCREEN_SIZES,o as STORE_KEYS,t as ThemeMode};
@@ -0,0 +1 @@
1
+ export declare const getCurrentWeekWorkdaysRange: () => [Date, Date];
@@ -0,0 +1 @@
1
+ const s=()=>{const e=/* @__PURE__ */new Date,t=new Date(e),a=new Date(e),n=e.getDay(),s=0===n?-6:1-n;return t.setDate(e.getDate()+s),[t,a]};export{s as getCurrentWeekWorkdaysRange};
@@ -1,2 +1,5 @@
1
+ import 'dayjs/locale/hy-am';
2
+ import 'dayjs/locale/ru';
3
+ import 'dayjs/locale/en';
1
4
  export declare const formatDate: (value: string | Date | null | undefined, format: string, defaultValue?: string) => string;
2
5
  export declare const formatDateUTC: (value: string | Date | null | undefined, format: string, defaultValue?: string) => string;
@@ -1 +1 @@
1
- import r from"dayjs";import m from"dayjs/plugin/utc";import{getDayJSLocale as a}from"./locale.js";r.extend(m);const n=(o,t,m="")=>r(o).isValid()&&o?r(o).locale(a()).format(t):m,d=(o,t,m="")=>r(o).isValid()&&o?r.utc(o).locale(a()).format(t):m;export{n as formatDate,d as formatDateUTC};
1
+ import r from"dayjs";import s from"dayjs/plugin/utc";import{getDayJSLocale as a}from"./locale.js";import"dayjs/locale/hy-am";import"dayjs/locale/ru";import"dayjs/locale/en";r.extend(s);const p=(o,t,l="")=>r(o).isValid()&&o?r(o).locale(a()).format(t):l,V=(o,t,l="")=>r(o).isValid()&&o?r.utc(o).locale(a()).format(t):l;export{p as formatDate,V as formatDateUTC};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hrm_ui_lib",
3
- "version": "0.0.1-beta.13",
3
+ "version": "0.0.1-beta.15",
4
4
  "description": "UI library for Dino",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -1,3 +1,4 @@
1
+ import { STORE_KEYS } from '../consts';
1
2
  export declare const noop: () => void;
2
3
  export declare const checkIsAllowedFileSize: (allowedSize: number, fileSize: number) => boolean;
3
4
  export declare const openFileInNewWindow: ({ e, file, handleFileClick }: {
@@ -13,4 +14,4 @@ export declare const setTranslationValue: (translation: string, value: string |
13
14
  export declare const getYearOptions: (startYear: number, lastYear: number) => TSelectOptions;
14
15
  export declare const isSameDay: (date1?: Date, date2?: Date) => boolean;
15
16
  export declare const generateDataTestId: (postfix: string, dataId?: string) => string;
16
- export declare const clearStorage: () => void;
17
+ export declare const clearStorage: (preservedKeys?: STORE_KEYS[]) => void;
package/utils/helpers.js CHANGED
@@ -1 +1 @@
1
- import s from"dayjs";import{STORE_KEYS as c}from"../consts/index.js";const l=()=>{},u=(e,o)=>o<=e,d=({e:e,file:o,handleFileClick:t})=>{if(e.preventDefault(),t&&t(o),o)if(o instanceof Blob){const e=URL.createObjectURL(o);window.open(e)}else console.error("The provided object is not a File or Blob.");else console.error("No file provided.")},p=e=>{const o=[];for(let t=0;t<e.length;t++){const s=new FileReader;s.onloadend=()=>{console.log(s.result)},s.readAsDataURL(e[t]),o.push(s)}return o},f=e=>e.filter((e,o,t)=>o===t.findIndex(o=>o.name===e.name)),m=(e,o)=>e.includes(o),g=(e,o)=>{const t=document.createElement("canvas").getContext("2d");return t?(t.font=o+"px Arial",t.measureText(e).width):0},v=(e,o)=>e.replace("%s",o.toString()),w=(e,o)=>{const t=[];for(;e<=o;)t.push({value:o,label:o}),o--;return t},S=(e,o)=>!(!e||!o)&&s(e).isSame(o,"day"),h=(e,o)=>o?`${o}-${e}`:"",x=()=>{for(const e in c)localStorage.removeItem(e)};export{u as checkIsAllowedFileSize,m as checkIsAllowedTypes,x as clearStorage,h as generateDataTestId,p as getFormattedValues,g as getStringWidth,w as getYearOptions,S as isSameDay,l as noop,d as openFileInNewWindow,v as setTranslationValue,f as uniqueFiles};
1
+ import c from"dayjs";import{STORE_KEYS as r}from"../consts/index.js";const l=()=>{},u=(e,o)=>o<=e,d=({e:e,file:o,handleFileClick:t})=>{if(e.preventDefault(),t&&t(o),o)if(o instanceof Blob){const e=URL.createObjectURL(o);window.open(e)}else console.error("The provided object is not a File or Blob.");else console.error("No file provided.")},f=e=>{const o=[];for(let t=0;t<e.length;t++){const a=new FileReader;a.onloadend=()=>{console.log(a.result)},a.readAsDataURL(e[t]),o.push(a)}return o},m=e=>e.filter((e,o,t)=>o===t.findIndex(o=>o.name===e.name)),p=(e,o)=>e.includes(o),g=(e,o)=>{const t=document.createElement("canvas").getContext("2d");return t?(t.font=o+"px Arial",t.measureText(e).width):0},h=(e,o)=>e.replace("%s",o.toString()),v=(e,o)=>{const t=[];for(;e<=o;)t.push({value:o,label:o}),o--;return t},w=(e,o)=>!(!e||!o)&&c(e).isSame(o,"day"),S=(e,o)=>o?`${o}-${e}`:"",b=(e=[r.theme])=>{Object.values(r).forEach(o=>{e.includes(o)||localStorage.removeItem(o)})};export{u as checkIsAllowedFileSize,p as checkIsAllowedTypes,b as clearStorage,S as generateDataTestId,f as getFormattedValues,g as getStringWidth,v as getYearOptions,w as isSameDay,l as noop,d as openFileInNewWindow,h as setTranslationValue,m as uniqueFiles};