hrm_ui_lib 2.1.0-alpha.13 → 2.1.0-alpha.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.
@@ -1,3 +1,3 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { TAvatarProps } from './types';
3
- export declare const Avatar: ({ dataId, id, color, size, type, imagePath, initials, className, isEditable, allowedTypes, onError, fileAllowedSize, onAvatarChange }: TAvatarProps) => ReactElement;
3
+ export declare const Avatar: ({ dataId, id, color, size, type, imagePath, initials, className, isEditable, allowedTypes, onError, fileAllowedSize, onAvatarChange, onAvatarClick }: TAvatarProps) => ReactElement;
@@ -1 +1,2 @@
1
- import{jsxs as F,jsx as U}from"react/jsx-runtime";import{useState as $,useEffect as x}from"react";import w from"classnames";import{FileUpload as I}from"../FileUpload/FileUpload.js";import"../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import{FileUploadMode as L}from"../FileUpload/types.js";const O=({dataId:a,id:e,color:l="default",size:i="medium",type:o,imagePath:t="",initials:r="",className:s="",isEditable:d=!1,allowedTypes:p=".png, .jpg, .jpeg, image/jpeg, image/png, image/jpg",onError:m,fileAllowedSize:n,onAvatarChange:g})=>{const[c,j]=$(t),u={backgroundImage:c?`url(${c})`:"none"};return x(()=>{j(t)},[t]),/* @__PURE__ */F("div",{id:e,"data-id":a,className:w(`avatar avatar--${l} avatar--${o} avatar--${i}`,s,{"avatar--image":c,"avatar--edit":d}),style:u,children:[c?null:r,d&&/* @__PURE__ */U(I,{onError:m,fileAllowedSize:n,multiple:!1,withFilePreview:!1,getFiles:a=>{a&&a[0]&&(j(URL.createObjectURL(a[0])),null==g||g(a[0]))},allowedTypes:p,mode:L.edit})]})};export{O as Avatar};
1
+ import{jsxs as x,jsx as o}from"react/jsx-runtime";import{useState as N,useEffect as k}from"react";import s from"classnames";import{FileUpload as w}from"../FileUpload/FileUpload.js";import"../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import{FileUploadMode as I}from"../FileUpload/types.js";const S=({dataId:a,id:e,color:l="default",size:i="medium",type:t,imagePath:r="",initials:d="",className:p="",isEditable:m=!1,allowedTypes:n=".png, .jpg, .jpeg, image/jpeg, image/png, image/jpg",onError:c,fileAllowedSize:g,onAvatarChange:v,onAvatarClick:j})=>{const[u,f]=N(r),F={backgroundImage:u?`url(${u})`:"none"};return k(()=>{f(r)},[r]),/* @__PURE__ */x("div",{id:e,"data-id":a,className:s(`avatar avatar--${l} avatar--${t} avatar--${i}`,p,{"avatar--edit":m}),children:[
2
+ /* @__PURE__ */o("div",{className:s({"avatar--image":u}),onClick:j,style:F}),u?null:d,m&&/* @__PURE__ */o(w,{onError:c,fileAllowedSize:g,multiple:!1,withFilePreview:!1,getFiles:a=>{a&&a[0]&&(f(URL.createObjectURL(a[0])),null==v||v(a[0]))},allowedTypes:n,mode:I.edit})]})};export{S as Avatar};
@@ -15,6 +15,7 @@ export interface TAvatarProps extends IFormCompProps {
15
15
  tooltipContent?: string | ReactElement;
16
16
  onError?: (type: FILE_UPLOAD_ERRORS) => void;
17
17
  fileAllowedSize?: number;
18
+ onAvatarClick?: () => void;
18
19
  }
19
20
  export interface TAvatarGroupProps {
20
21
  dataId?: string;
@@ -1,7 +1,7 @@
1
- import{jsxs as p,jsx as r}from"react/jsx-runtime";import"../../Select/Select/Select.js";import"../../Select/MultiSelect/MultiSelect.js";import"react";import"../../Input/Input.js";import"classnames";import{noop as d,getYearOptions as N}from"../../../utils/helpers.js";import"../../../consts/index.js";import"../../../context/types.js";import"../../../hooks/useScreenSize.js";import"react-hook-form";import"../../../helperComponents/ErrorMessage/consts.js";import"../../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import"../../Checkbox/Checkbox.js";import{ButtonSelect as h}from"../../Select/ButtonSelect/ButtonSelect.js";import C from"../../SVGIcons/IconChevronLeft.js";import S from"../../SVGIcons/IconChevronRight.js";import{generateMonthOptions as Y}from"./helpers.js";const J=e=>{const{date:t,dataPrefix:o,changeYear:s,changeMonth:l,decreaseMonth:a,increaseMonth:i,startYear:n,endYear:c,prevMonthButtonDisabled:m,nextMonthButtonDisabled:u,locale:f,isMobile:j=!1}=e,I=Y(f),x=null==t?void 0:t.getMonth(),b=null==t?void 0:t.getFullYear();/* @__PURE__ */
2
- return p("div",{className:"flexbox custom_header_container",children:[
1
+ import{jsxs as c,jsx as r}from"react/jsx-runtime";import"../../Select/Select/Select.js";import"../../Select/MultiSelect/MultiSelect.js";import"react";import"../../Input/Input.js";import"classnames";import{noop as d,getYearOptions as N}from"../../../utils/helpers.js";import"../../../consts/index.js";import"../../../context/types.js";import"../../../hooks/useScreenSize.js";import"react-hook-form";import"../../../helperComponents/ErrorMessage/consts.js";import"../../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import"react-dom";import"../../Checkbox/Checkbox.js";import{ButtonSelect as h}from"../../Select/ButtonSelect/ButtonSelect.js";import C from"../../SVGIcons/IconChevronLeft.js";import S from"../../SVGIcons/IconChevronRight.js";import{generateMonthOptions as Y}from"./helpers.js";const K=e=>{const{date:t,dataPrefix:o,changeYear:s,changeMonth:l,decreaseMonth:a,increaseMonth:i,startYear:n,endYear:p,prevMonthButtonDisabled:m,nextMonthButtonDisabled:u,locale:f,isMobile:j=!1}=e,I=Y(f),x=null==t?void 0:t.getMonth(),b=null==t?void 0:t.getFullYear();/* @__PURE__ */
2
+ return c("div",{className:"flexbox custom_header_container",children:[
3
3
  /* @__PURE__ */r(C,{size:"small",className:"cursor-pointer",dataId:o?`${o}-prev-month-button`:"",onClick:m?d:a,type:m?"disabled":"primary"}),
4
- /* @__PURE__ */p("div",{className:"selects_container",children:[
4
+ /* @__PURE__ */c("div",{className:"selects_container",children:[
5
5
  /* @__PURE__ */r(h,{size:"small",type:"tertiary",className:"date_picker_select",offsets:j?{}:{top:42,left:48},placeHolder:(e=>{const t=I.find(t=>t.value===e);return null==t?void 0:t.label.toString()})(x),dataId:o?`${o}-month-select`:"",options:I,selectedItem:x,setSelectedItem:e=>l(e),dropdownWidth:150,isRequiredField:!0}),
6
- /* @__PURE__ */r(h,{type:"tertiary",className:"date_picker_select",offsets:j?{}:{top:42,left:138},placeHolder:b.toString(),dataId:o?`${o}-year-select`:"",size:"small",options:N(n,c),selectedItem:b,setSelectedItem:e=>s(e),dropdownWidth:100,isRequiredField:!0})]}),
7
- /* @__PURE__ */r(S,{size:"small",className:"cursor-pointer",dataId:o?`${o}-next-month-button`:"",onClick:u?d:i,type:u?"disabled":"primary"})]})};export{J as CustomHeader};
6
+ /* @__PURE__ */r(h,{type:"tertiary",className:"date_picker_select",offsets:j?{}:{top:42,left:138},placeHolder:b.toString(),dataId:o?`${o}-year-select`:"",size:"small",options:N(n,p),selectedItem:b,setSelectedItem:e=>s(e),dropdownWidth:100,isRequiredField:!0})]}),
7
+ /* @__PURE__ */r(S,{size:"small",className:"cursor-pointer",dataId:o?`${o}-next-month-button`:"",onClick:u?d:i,type:u?"disabled":"primary"})]})};export{K as CustomHeader};
@@ -1,8 +1,8 @@
1
- import{jsxs as f,Fragment as q,jsx as a}from"react/jsx-runtime";import{forwardRef as z,useState as D,useEffect as B}from"react";import G from"react-datepicker";import{Input as y}from"../../Input/Input.js";import{DateFormat as J}from"../types.js";import{useImportFilesDynamically as K}from"../hooks.js";import{isSameDay as Q}from"../../../utils/helpers.js";import U from"../../SVGIcons/IconCalendarRight.js";import{Modal as W}from"../../Modal/Modal.js";import"classnames";import"../../../consts/index.js";import"../../../context/types.js";import"../../../hooks/useScreenSize.js";import"react-hook-form";import{CustomHeader as X}from"../CustomHeader/CustomHeader.js";import{formatDate as i}from"../../../helpers/format-date.js";import"react-toastify";import"../../Snackbar/consts.js";import"react-toastify/dist/ReactToastify.css";const Z=z((e,t)=>{const{value:r,currentDates:o=[],setFieldValue:s,name:n,changeHandler:l,dataId:m,format:c=J.LongDate,maxDate:d,minDate:p,locale:u="hy",disabled:x,placeholderText:j,dataIdPrefix:b,modalOptions:h,...C}=e;K(u);const g=p?p.getFullYear():1900,k=d?d.getFullYear():/* @__PURE__ */(new Date).getFullYear()+5,I=void 0!==r&&Array.isArray(r)?r:o,[v,F]=D(I),[A,M]=D(!1),[O,P]=D(!1),R=e=>{e&&Array.isArray(e)&&F(e)};if(B(()=>{F(I)},[I]),!Array.isArray(v))return null;const S=()=>{M(!0)},T=()=>{M(!1)},[H,Y]=v;/* @__PURE__ */
1
+ import{jsxs as f,Fragment as q,jsx as a}from"react/jsx-runtime";import{forwardRef as z,useState as D,useEffect as B}from"react";import G from"react-datepicker";import{Input as y}from"../../Input/Input.js";import{DateFormat as J}from"../types.js";import{useImportFilesDynamically as K}from"../hooks.js";import{isSameDay as Q}from"../../../utils/helpers.js";import U from"../../SVGIcons/IconCalendarRight.js";import{Modal as W}from"../../Modal/Modal.js";import"classnames";import"../../../consts/index.js";import"../../../context/types.js";import"../../../hooks/useScreenSize.js";import"react-hook-form";import{CustomHeader as X}from"../CustomHeader/CustomHeader.js";import{formatDate as i}from"../../../helpers/format-date.js";import"react-toastify";import"../../Snackbar/consts.js";const Z=z((e,t)=>{const{value:r,currentDates:o=[],setFieldValue:s,name:n,changeHandler:l,dataId:m,format:c=J.LongDate,maxDate:d,minDate:u,locale:p="hy",disabled:x,placeholderText:j,dataIdPrefix:b,modalOptions:h,...C}=e;K(p);const g=u?u.getFullYear():1900,k=d?d.getFullYear():/* @__PURE__ */(new Date).getFullYear()+5,I=void 0!==r&&Array.isArray(r)?r:o,[v,F]=D(I),[A,M]=D(!1),[O,P]=D(!1),S=e=>{e&&Array.isArray(e)&&F(e)};if(B(()=>{F(I)},[I]),!Array.isArray(v))return null;const H=()=>{M(!0)},R=()=>{M(!1)},[T,Y]=v;/* @__PURE__ */
2
2
  return f(q,{children:[
3
- /* @__PURE__ */a(y,{readOnly:!0,onClick:S,dataId:m,disabled:x,placeholder:j,currentValue:(e=>{if(A&&!O)return;const[a,t]=e,r=i(a,c),o=i(t,c);return Q(a,t)||!t?r:`${r} - ${o}`})(v),rightIconProps:{Component:U,onClick:S}}),
4
- /* @__PURE__ */f(W,{isOpen:A,title:null==h?void 0:h.title,onClose:T,buttonProps:{confirm:{buttonText:null==h?void 0:h.btnConfirmText,onClick:()=>{l&&l(v),s&&n&&s(n,v),P(!0),T()}},cancel:{buttonText:null==h?void 0:h.btnCancelText,onClick:T}},closeIcon:!0,children:[
3
+ /* @__PURE__ */a(y,{readOnly:!0,onClick:H,dataId:m,disabled:x,placeholder:j,currentValue:(e=>{if(A&&!O)return;const[a,t]=e,r=i(a,c),o=i(t,c);return Q(a,t)||!t?r:`${r} - ${o}`})(v),rightIconProps:{Component:U,onClick:H}}),
4
+ /* @__PURE__ */f(W,{isOpen:A,title:null==h?void 0:h.title,onClose:R,buttonProps:{confirm:{buttonText:null==h?void 0:h.btnConfirmText,onClick:()=>{l&&l(v),s&&n&&s(n,v),P(!0),R()}},cancel:{buttonText:null==h?void 0:h.btnCancelText,onClick:R}},closeIcon:!0,children:[
5
5
  /* @__PURE__ */f("div",{className:"flexbox justify-content--between mb-16 gap-16",children:[
6
- /* @__PURE__ */a(y,{readOnly:!0,value:i(H,c)}),
6
+ /* @__PURE__ */a(y,{readOnly:!0,value:i(T,c)}),
7
7
  /* @__PURE__ */a(y,{readOnly:!0,value:i(Y,c)})]}),
8
- /* @__PURE__ */a(G,{...C,inline:!0,locale:u,minDate:p,maxDate:d,startDate:H,endDate:Y,selectsRange:!0,disabled:x,onChange:R,onClickOutside:()=>{const[e,a]=v;(!e||!a)&&R([null,null])},renderCustomHeader:e=>/* @__PURE__ */a(X,{...e,locale:u,startYear:g,endYear:k,dataPrefix:b,isMobile:!0})})]})]})});Z.displayName="RangeDatePickerMobile";export{Z as RangeDatePickerMobile};
8
+ /* @__PURE__ */a(G,{...C,inline:!0,locale:p,minDate:u,maxDate:d,startDate:T,endDate:Y,selectsRange:!0,disabled:x,onChange:S,onClickOutside:()=>{const[e,a]=v;(!e||!a)&&S([null,null])},renderCustomHeader:e=>/* @__PURE__ */a(X,{...e,locale:p,startYear:g,endYear:k,dataPrefix:b,isMobile:!0})})]})]})});Z.displayName="RangeDatePickerMobile";export{Z as RangeDatePickerMobile};
@@ -1,7 +1,7 @@
1
- import{jsxs as l,jsx as e}from"react/jsx-runtime";import{Text as n}from"../../Text/Text.js";import{Button as s}from"../../Button/Button.js";import f from"../../SVGIcons/IconDelete.js";import{useMemo as _}from"react";import{FileUploadMode as t}from"../types.js";import{FilePreview as w}from"./FilePreview.js";import{shortenFileName as v,formatFileSize as z}from"./helpers.js";import h from"../../SVGIcons/IconArrowDownloadFilled.js";import u from"classnames";import"../../../helpers/format-date.js";import{downloadFile as F}from"../../../helpers/download-file.js";import"react-toastify";import"../../Snackbar/consts.js";import"react-toastify/dist/ReactToastify.css";import"dayjs";import"../../../consts/index.js";const O=({file:i,onRemove:o,mode:r})=>{const a=i.type.split("/")[0],m=_(()=>URL.createObjectURL(i),[i.name]);/* @__PURE__ */
1
+ import{jsxs as l,jsx as e}from"react/jsx-runtime";import{Text as n}from"../../Text/Text.js";import{Button as s}from"../../Button/Button.js";import f from"../../SVGIcons/IconDelete.js";import{useMemo as _}from"react";import{FileUploadMode as t}from"../types.js";import{FilePreview as w}from"./FilePreview.js";import{shortenFileName as v,formatFileSize as z}from"./helpers.js";import h from"../../SVGIcons/IconArrowDownloadFilled.js";import u from"classnames";import"../../../helpers/format-date.js";import{downloadFile as F}from"../../../helpers/download-file.js";import"react-toastify";import"../../Snackbar/consts.js";import"dayjs";import"../../../consts/index.js";const B=({file:i,onRemove:o,mode:r})=>{const a=i.type.split("/")[0],m=_(()=>URL.createObjectURL(i),[i.name]);/* @__PURE__ */
2
2
  return l("div",{className:u("dz-file-upload__files--item",{"dz-file-upload__files--item--view":r===t.view}),onClick:()=>{r===t.view&&window.open(m,"_blank")},children:[
3
3
  /* @__PURE__ */e("div",{className:"dz-file-upload__files--item__preview",children:/* @__PURE__ */e(w,{preview:m,type:a})}),
4
4
  /* @__PURE__ */l("div",{className:"dz-file-upload__files--item__info",children:[
5
5
  /* @__PURE__ */l("div",{className:"dz-file-upload__files--item__info-title",children:[
6
6
  /* @__PURE__ */e(n,{weight:"semibold",children:v(i.name,40)}),r===t.attach&&/* @__PURE__ */e(s,{size:"small",type:"tertiary",onClick:o,iconProps:{Component:f}}),r===t.view&&/* @__PURE__ */e(s,{size:"small",type:"tertiary",onClick:e=>{e.preventDefault(),e.stopPropagation(),F(m,i.name)},iconProps:{Component:h}})]}),
7
- /* @__PURE__ */e("div",{className:"dz-file-upload__files--item__info-size",children:/* @__PURE__ */e(n,{size:"small",children:z(i.size)})})]})]})};export{O as PreviewItem};
7
+ /* @__PURE__ */e("div",{className:"dz-file-upload__files--item__info-size",children:/* @__PURE__ */e(n,{size:"small",children:z(i.size)})})]})]})};export{B as PreviewItem};
@@ -1 +1 @@
1
- import{FILE_ACCEPT_TYPE as p}from"../../../consts/index.js";import"../../../helpers/format-date.js";import{getTranslationLocale as $}from"../../../helpers/locale.js";import"react/jsx-runtime";import"react-toastify";import"classnames";import"dayjs";import"../../Snackbar/consts.js";import"react";import"react-toastify/dist/ReactToastify.css";const C=(e,o)=>e.length>o?e.replace(/^(.{10}).*?(.{10}\.[^.]*)$/,"$1...$2"):e,s=(e,o=0)=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(o)} KB`:e<1073741824?`${(e/1048576).toFixed(o)} MB`:`${(e/1073741824).toFixed(o)} GB`,v=({allowedTypes:e,maxSize:o,locale:t})=>{const a=e.map(e=>p[e]).flat(),r=c(t),i=1===e.length?e[0]:e.reduce((e,o,t,a)=>t===a.length-1?`${e} ${r.or} ${o}`:e?`${e}, ${o}`:o,"");return{acceptTypes:a,maxSizeFormatted:s(o),acceptTypesMessage:i}},c=e=>{const o={en:{title:"Choose a file or drop it here",format:"format",formats:"formats",maxSize:"Maximum size up to $1.",fileInvalidType:"The file type should be $1",fileTooLarge:"The file is too large (Max $1)",tooManyFiles:"Too many files. Please select one file.",or:"or"},ru:{title:"Выберите файл или перетащите его сюда",format:"формат",formats:"форматы",maxSize:"Максимальный размер до $1",fileInvalidType:"Тип файла должен быть $1",fileTooLarge:"Файл слишком большой (Максимум $1)",tooManyFiles:"Слишком много файлов. Пожалуйста, выберите один файл.",or:"или"},hy:{title:"Ընտրեք ֆայլ կամ քաշեք այն այստեղ",format:"ֆորմատ",formats:"ֆորմատներ",maxSize:"Առավելագույն չափը՝ մինչև $1",fileInvalidType:"Ֆայլի տեսակը պետք է լինի $1",fileTooLarge:"Ֆայլը չափազանց մեծ է (Առավելագույնը $1)",tooManyFiles:"Չափազանց շատ ֆայլեր։ Խնդրում ենք ընտրել միայն մեկ ֆայլ։",or:"կամ"}};return o[e||$()]||o.en};export{s as formatFileSize,v as generateAreaContent,c as getDropzoneLocale,C as shortenFileName};
1
+ import{FILE_ACCEPT_TYPE as $}from"../../../consts/index.js";import"../../../helpers/format-date.js";import{getTranslationLocale as p}from"../../../helpers/locale.js";import"react/jsx-runtime";import"react-toastify";import"classnames";import"dayjs";import"../../Snackbar/consts.js";import"react";const S=(e,o)=>e.length>o?e.replace(/^(.{10}).*?(.{10}\.[^.]*)$/,"$1...$2"):e,s=(e,o=0)=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(o)} KB`:e<1073741824?`${(e/1048576).toFixed(o)} MB`:`${(e/1073741824).toFixed(o)} GB`,C=({allowedTypes:e,maxSize:o,locale:t})=>{const a=e.map(e=>$[e]).flat(),r=c(t),i=1===e.length?e[0]:e.reduce((e,o,t,a)=>t===a.length-1?`${e} ${r.or} ${o}`:e?`${e}, ${o}`:o,"");return{acceptTypes:a,maxSizeFormatted:s(o),acceptTypesMessage:i}},c=e=>{const o={en:{title:"Choose a file or drop it here",format:"format",formats:"formats",maxSize:"Maximum size up to $1.",fileInvalidType:"The file type should be $1",fileTooLarge:"The file is too large (Max $1)",tooManyFiles:"Too many files. Please select one file.",or:"or"},ru:{title:"Выберите файл или перетащите его сюда",format:"формат",formats:"форматы",maxSize:"Максимальный размер до $1",fileInvalidType:"Тип файла должен быть $1",fileTooLarge:"Файл слишком большой (Максимум $1)",tooManyFiles:"Слишком много файлов. Пожалуйста, выберите один файл.",or:"или"},hy:{title:"Ընտրեք ֆայլ կամ քաշեք այն այստեղ",format:"ֆորմատ",formats:"ֆորմատներ",maxSize:"Առավելագույն չափը՝ մինչև $1",fileInvalidType:"Ֆայլի տեսակը պետք է լինի $1",fileTooLarge:"Ֆայլը չափազանց մեծ է (Առավելագույնը $1)",tooManyFiles:"Չափազանց շատ ֆայլեր։ Խնդրում ենք ընտրել միայն մեկ ֆայլ։",or:"կամ"}};return o[e||p()]||o.en};export{s as formatFileSize,C as generateAreaContent,c as getDropzoneLocale,S as shortenFileName};
@@ -0,0 +1,4 @@
1
+ import { ReactElement } from 'react';
2
+ import { ISVGIconProps } from '../../type';
3
+ declare const IconVacation: ({ size, type, className, onClick, refHandler, id, dataId }: ISVGIconProps) => ReactElement;
4
+ export default IconVacation;
@@ -0,0 +1 @@
1
+ import{jsx as i}from"react/jsx-runtime";import r from"classnames";const g=({size:L,type:C,className:s="",onClick:e,refHandler:a,id:o,dataId:n})=>/* @__PURE__ */i("svg",{xmlns:"http://www.w3.org/2000/svg",className:r("svg-icon",{[`svg-icon__size-${L}`]:L,[`svg-icon__type-${C}`]:C,[s]:s}),viewBox:"0 0 24 24",fill:"none",onClick:e,ref:a,id:o,"data-id":n?`${n}-svg-icon`:"",children:/* @__PURE__ */i("path",{d:"M4.6381 6.43812L0.77304 2.67828L0.729516 2.62721C0.219912 1.99775 0.317072 1.07436 0.94653 0.564757C1.51518 0.104379 2.2821 -0.0244014 2.99846 0.233786L3.15177 0.298076L8.7297 2.92244L11.4663 0.571064C12.4577 -0.280919 13.9521 -0.167922 14.8105 0.831109L14.8486 0.876814C15.6711 1.89286 15.5143 3.38335 14.4825 4.21829L11.6079 6.40945L13.0374 12.5087C13.2204 13.2893 12.9408 14.1057 12.3176 14.6102C11.6882 15.1198 10.7648 15.0227 10.2426 14.3772L10.1795 14.2899L7.292 9.69936L5.74603 10.878L5.97745 11.5533C6.21878 12.2577 5.99438 13.0378 5.41567 13.5064C4.7952 14.0087 3.88499 13.9129 3.38246 13.2922L2.94712 12.7539L2.81878 12.82C2.08181 13.1988 1.1802 13.0087 0.658807 12.3647C0.137344 11.7206 0.139499 10.799 0.663856 10.1574L0.754848 10.0461L0.318349 9.50743C-0.141596 8.93931 -0.10376 8.11971 0.429608 7.56686L0.532264 7.47442C1.05995 7.04722 1.78398 6.9596 2.42846 7.26088L2.55906 7.33121L3.17208 7.69786L4.6381 6.43812ZM1.80675 1.62729C1.76411 1.66181 1.75753 1.72436 1.77898 1.75134L6.66323 6.50043L3.31584 9.37682L1.88774 8.52161L1.81934 8.48426C1.67933 8.41903 1.51333 8.43912 1.42459 8.50927L1.38458 8.54419C1.3581 8.57173 1.35603 8.61652 1.38067 8.64696L2.5173 10.0495L1.72246 11.0225C1.60794 11.1626 1.60747 11.3639 1.72134 11.5045C1.83539 11.6454 2.03263 11.687 2.19351 11.6043L3.31055 11.0294L4.44519 12.4322C4.47244 12.4659 4.5218 12.4711 4.55545 12.4438C4.68803 12.3365 4.73944 12.1578 4.68416 11.9964L4.13317 10.3885L7.65274 7.70528L11.302 13.5119L11.3177 13.533C11.3522 13.5756 11.4148 13.5822 11.4574 13.5477C11.673 13.3732 11.7697 13.0907 11.7064 12.8207L10.0748 5.8591L13.638 3.1434C14.0673 2.79591 14.1336 2.16621 13.7924 1.74478L13.7672 1.71449C13.4073 1.29574 12.7761 1.24801 12.3573 1.60793L8.94897 4.53646L2.59934 1.54816L2.50591 1.50865C2.26884 1.42348 2.00344 1.46805 1.80675 1.62729Z"})});export{g as default};
@@ -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};
@@ -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": "2.1.0-alpha.13",
3
+ "version": "2.1.0-alpha.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};