hrm_ui_lib 2.0.0-alpha.33 → 2.0.0-alpha.35

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,6 +1,5 @@
1
- import{jsx as e,jsxs as i}from"react/jsx-runtime";import{TYPE_MAPPING as s,ICONS_MAPPING as y}from"./consts.js";import h from"classnames";import{Text as a}from"../Text/Text.js";import{Button as n}from"../Button/Button.js";import u from"../SVGIcons/IconDismissFilled.js";import{IconDynamicComponent as f}from"../IconDynamicComponent/IconDynamicComponent.js";const C=t=>{const{buttonProps:l,type:o="information",position:r="inline",text:m,subtext:c,closeIcon:p,onClose:d,className:N=""}=t;/* @__PURE__ */
2
- return e("div",{className:h("alert",`alert--${o} alert--${r}`,N),children:/* @__PURE__ */i("div",{className:"alert__content",children:[
3
- /* @__PURE__ */e(f,{componentName:y[o],size:"small",type:s[o]}),
1
+ import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Suspense as N}from"react";import{ICONS_MAPPING as f,TYPE_MAPPING as a}from"./consts.js";import y from"classnames";import{Text as n}from"../Text/Text.js";import{Button as o}from"../Button/Button.js";import g from"../SVGIcons/IconDismissFilled.js";const A=s=>{const{buttonProps:t,type:l="information",position:r="inline",text:m,subtext:c,closeIcon:p,onClose:d,className:u=""}=s,h=f[l]||null;/* @__PURE__ */
2
+ return e("div",{className:y("alert",`alert--${l} alert--${r}`,u),children:/* @__PURE__ */i("div",{className:"alert__content",children:[h&&/* @__PURE__ */e(N,{fallback:null,children:/* @__PURE__ */e(h,{size:"small",type:a[l]})}),
4
3
  /* @__PURE__ */i("div",{className:"alert__text pl-8",children:[
5
4
  /* @__PURE__ */i("div",{children:[
6
- /* @__PURE__ */e(a,{type:"primary",size:"standard",weight:"regular",lineHeight:"large",children:m}),c?/* @__PURE__ */e(a,{className:"mt-4",type:"secondary",size:"small",weight:"regular",lineHeight:"large",children:c}):null]}),l?/* @__PURE__ */i("div",{className:"alert__actions",children:[l.confirm&&/* @__PURE__ */e(n,{size:"medium",type:"secondary",...l.confirm}),l.cancel&&/* @__PURE__ */e(n,{size:"medium",type:"tertiary",className:"ml-12",...l.cancel})]}):null]}),p?/* @__PURE__ */e(u,{type:s[o],size:"xsmall",className:"ml-12 pointer",onClick:d}):null]})})};export{C as Alert};
5
+ /* @__PURE__ */e(n,{type:"primary",size:"standard",weight:"regular",lineHeight:"large",children:m}),c?/* @__PURE__ */e(n,{className:"mt-4",type:"secondary",size:"small",weight:"regular",lineHeight:"large",children:c}):null]}),t?/* @__PURE__ */i("div",{className:"alert__actions",children:[t.confirm&&/* @__PURE__ */e(o,{size:"medium",type:"secondary",...t.confirm}),t.cancel&&/* @__PURE__ */e(o,{size:"medium",type:"tertiary",className:"ml-12",...t.cancel})]}):null]}),p?/* @__PURE__ */e(g,{type:a[l],size:"xsmall",className:"ml-12 pointer",onClick:d}):null]})})};export{A as Alert};
@@ -1,7 +1,7 @@
1
1
  import { TSVGIconType } from '../SVGIcons/types';
2
+ import type React from 'react';
3
+ import { IconComponent } from '../SVGIcons/icon-registry';
2
4
  export declare const TYPE_MAPPING: {
3
5
  [key: string]: TSVGIconType;
4
6
  };
5
- export declare const ICONS_MAPPING: {
6
- [key: string]: string;
7
- };
7
+ export declare const ICONS_MAPPING: Record<string, React.LazyExoticComponent<IconComponent>>;
@@ -1 +1 @@
1
- const r={warning:"warning",success:"success",error:"danger",information:"information",discovery:"discovery"},i={warning:"warningFilled",success:"checkmarkCircleFilled",error:"errorCircleFilled",information:"infoFilled",discovery:"infoFilled"};export{i as ICONS_MAPPING,r as TYPE_MAPPING};
1
+ import{lazy as r}from"react";const i={warning:"warning",success:"success",error:"danger",information:"information",discovery:"discovery"},n={warning:r(()=>import("../SVGIcons/IconWarningFilled.js")),success:r(()=>import("../SVGIcons/IconCheckmarkFilled.js")),error:r(()=>import("../SVGIcons/IconErrorCircleFilled.js")),information:r(()=>import("../SVGIcons/IconInfoFilled.js")),discovery:r(()=>import("../SVGIcons/IconInfoFilled.js"))};export{n as ICONS_MAPPING,i as TYPE_MAPPING};
@@ -1,6 +1,6 @@
1
- import{jsx as e,jsxs as o,Fragment as d}from"react/jsx-runtime";import{forwardRef as V,useRef as $,useMemo as F}from"react";import T from"classnames";import{Popover as q}from"../Popover/Popover.js";import{Link as w}from"../Link/Link.js";import{Text as m}from"../Text/Text.js";import A from"../SVGIcons/IconInfo.js";import{IconDynamicComponent as B}from"../IconDynamicComponent/IconDynamicComponent.js";const D=V((l,a)=>{const{label:r,disabled:n,required:s=!1,link:i,name:c,setFieldValue:t,selectedValue:p,value:h,className:b="",iconProps:k={name:"checkmark"},dataId:f="",onClick:u,beforeLink:x,afterLink:y,helperText:N="",popoverAddons:I,isInvalid:_,stopPropagation:v=!1}=l,g=$(null),j=a&&Object.keys(a).length?a:g,C=!!h||p,P=e=>{v&&e.stopPropagation(),c&&t&&t(c,!C,{shouldValidate:!C}),u&&u(!C)},D=I?/* @__PURE__ */e(q,{id:`${I.id}`,...I,children:/* @__PURE__ */e("div",{id:`${I.id}`,children:/* @__PURE__ */e(A,{dataId:`${f}-icon`,type:"information",size:"xsmall",className:"ml-4 pointer",onClick:P})})}):null,V=F(()=>r?"string"!=typeof r?r:/* @__PURE__ */e(m,i?{type:n?"disabled":"primary",className:"controller__label",children:/* @__PURE__ */o(d,{children:[x&&/* @__PURE__ */e("span",{className:"mr-4",children:x}),
2
- /* @__PURE__ */e(w,{dataId:f,url:i,target:"_blank",children:r}),y&&/* @__PURE__ */e("span",{className:"ml-4",children:y}),s&&/* @__PURE__ */e("sup",{children:"*"})]})}:{type:n?"disabled":"primary",className:"controller__label",children:/* @__PURE__ */o(d,{children:[r,s&&/* @__PURE__ */e("sup",{children:"*"})]})}):null,[r,i]);/* @__PURE__ */
3
- return e(d,{children:/* @__PURE__ */o("label",{className:T("controller",{"controller--checkbox":!0,"controller--disabled":n,"controller--error":_,[b]:!!b}),onClick:e=>v&&e.stopPropagation(),children:[
4
- /* @__PURE__ */e("input",{"data-id":f,type:"checkbox",ref:j,tabIndex:0,onChange:P,checked:!!C,disabled:n}),
5
- /* @__PURE__ */e("span",{className:"controller__icon",children:/* @__PURE__ */e(B,{componentName:k.name,size:"xxsmall",type:n?"disabled":"inverse",className:"controller__mark"})}),V?/* @__PURE__ */o("div",{className:"controller__right",children:[
6
- /* @__PURE__ */o("div",{className:"flexbox",children:[V,D]}),N?/* @__PURE__ */e(m,{size:"small",type:n?"disabled":"secondary",children:N}):null]}):null]})})});D.displayName="Checkbox";export{D as Checkbox};
1
+ import{jsx as e,jsxs as o,Fragment as d}from"react/jsx-runtime";import{forwardRef as V,useRef as $,useMemo as z}from"react";import F from"classnames";import{Popover as T}from"../Popover/Popover.js";import{Link as q}from"../Link/Link.js";import{Text as m}from"../Text/Text.js";import w from"../SVGIcons/IconInfo.js";const A=V((l,a)=>{const{label:r,disabled:s,required:n=!1,link:i,name:c,setFieldValue:t,selectedValue:p,value:h,className:b="",iconProps:k={name:"checkmark"},dataId:u="",onClick:f,beforeLink:x,afterLink:y,helperText:N="",popoverAddons:g,isInvalid:v,stopPropagation:_=!1}=l,j=$(null),I=a&&Object.keys(a).length?a:j,P=!!h||p,C=e=>{_&&e.stopPropagation(),c&&t&&t(c,!P,{shouldValidate:!P}),f&&f(!P)},V=g?/* @__PURE__ */e(T,{id:`${g.id}`,...g,children:/* @__PURE__ */e("div",{id:`${g.id}`,children:/* @__PURE__ */e(w,{dataId:`${u}-icon`,type:"information",size:"xsmall",className:"ml-4 pointer",onClick:C})})}):null,L=z(()=>r?"string"!=typeof r?r:/* @__PURE__ */e(m,i?{type:s?"disabled":"primary",className:"controller__label",children:/* @__PURE__ */o(d,{children:[x&&/* @__PURE__ */e("span",{className:"mr-4",children:x}),
2
+ /* @__PURE__ */e(q,{dataId:u,url:i,target:"_blank",children:r}),y&&/* @__PURE__ */e("span",{className:"ml-4",children:y}),n&&/* @__PURE__ */e("sup",{children:"*"})]})}:{type:s?"disabled":"primary",className:"controller__label",children:/* @__PURE__ */o(d,{children:[r,n&&/* @__PURE__ */e("sup",{children:"*"})]})}):null,[r,i]);/* @__PURE__ */
3
+ return e(d,{children:/* @__PURE__ */o("label",{className:F("controller",{"controller--checkbox":!0,"controller--disabled":s,"controller--error":v,[b]:!!b}),onClick:e=>_&&e.stopPropagation(),children:[
4
+ /* @__PURE__ */e("input",{"data-id":u,type:"checkbox",ref:I,tabIndex:0,onChange:C,checked:!!P,disabled:s}),
5
+ /* @__PURE__ */e("span",{className:"controller__icon"}),L?/* @__PURE__ */o("div",{className:"controller__right",children:[
6
+ /* @__PURE__ */o("div",{className:"flexbox",children:[L,V]}),N?/* @__PURE__ */e(m,{size:"small",type:s?"disabled":"secondary",children:N}):null]}):null]})})});A.displayName="Checkbox";export{A as Checkbox};
@@ -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"../../SVGIcons/icon-registry.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:i,decreaseMonth:l,increaseMonth:a,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__ */
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"../../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 G=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
2
  return p("div",{className:"flexbox custom_header_container",children:[
3
- /* @__PURE__ */r(C,{size:"small",className:"cursor-pointer",dataId:o?`${o}-prev-month-button`:"",onClick:m?d:l,type:m?"disabled":"primary"}),
3
+ /* @__PURE__ */r(C,{size:"small",className:"cursor-pointer",dataId:o?`${o}-prev-month-button`:"",onClick:m?d:a,type:m?"disabled":"primary"}),
4
4
  /* @__PURE__ */p("div",{className:"selects_container",children:[
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=>i(e),dropdownWidth:150,isRequiredField:!0}),
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
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:a,type:u?"disabled":"primary"})]})};export{J as CustomHeader};
7
+ /* @__PURE__ */r(S,{size:"small",className:"cursor-pointer",dataId:o?`${o}-next-month-button`:"",onClick:u?d:i,type:u?"disabled":"primary"})]})};export{G 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"motion/react";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"../../SVGIcons/icon-registry.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:h,modalOptions:C,...b}=e;K(u);const g=p?p.getFullYear():1900,I=d?d.getFullYear():/* @__PURE__ */(new Date).getFullYear()+5,k=void 0!==r&&Array.isArray(r)?r:o,[v,F]=D(k),[A,M]=D(!1),[O,P]=D(!1),R=e=>{e&&Array.isArray(e)&&F(e)};if(B(()=>{F(k)},[k]),!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"motion/react";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__ */
2
2
  return f(q,{children:[
3
3
  /* @__PURE__ */a(y,{readOnly:!0,onClick:S,dataId:m,disabled:x,placeholder:j,currentValue:(e=>{if(A&&!O)return;const[t,a]=e,r=i(t,c),o=i(a,c);return Q(t,a)||!a?r:`${r} - ${o}`})(v),rightIconProps:{Component:U,onClick:S}}),
4
- /* @__PURE__ */f(W,{isOpen:A,title:null==C?void 0:C.title,onClose:T,buttonProps:{confirm:{buttonText:null==C?void 0:C.btnConfirmText,onClick:()=>{l&&l(v),s&&n&&s(n,v),P(!0),T()}},cancel:{buttonText:null==C?void 0:C.btnCancelText,onClick:T}},closeIcon:!0,children:[
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:[
5
5
  /* @__PURE__ */f("div",{className:"flexbox justify-content--between mb-16 gap-16",children:[
6
6
  /* @__PURE__ */a(y,{readOnly:!0,value:i(H,c)}),
7
7
  /* @__PURE__ */a(y,{readOnly:!0,value:i(Y,c)})]}),
8
- /* @__PURE__ */a(G,{...b,inline:!0,locale:u,minDate:p,maxDate:d,startDate:H,endDate:Y,selectsRange:!0,disabled:x,onChange:R,onClickOutside:()=>{const[e,t]=v;(!e||!t)&&R([null,null])},renderCustomHeader:e=>/* @__PURE__ */a(X,{...e,locale:u,startYear:g,endYear:I,dataPrefix:h,isMobile:!0})})]})]})});Z.displayName="RangeDatePickerMobile";export{Z as RangeDatePickerMobile};
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,t]=v;(!e||!t)&&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};
@@ -1,4 +1,4 @@
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"../../SVGIcons/icon-registry.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"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__ */
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:[
@@ -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"react";import"../../SVGIcons/icon-registry.js";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 p}from"../../../consts/index.js";import"../../../helpers/format-date.js";import{getTranslationLocale as $}from"../../../helpers/locale.js";import"react/jsx-runtime";import"react";import"react-toastify";import"classnames";import"dayjs";import"../../Snackbar/consts.js";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,4 +1,4 @@
1
- import{jsx as t,Fragment as y,jsxs as z}from"react/jsx-runtime";import{useState as c,useId as G,useCallback as h}from"react";import{createPortal as H}from"react-dom";import{useHideOnScroll as L}from"../../../hooks/useHideOnScroll.js";import"../../../context/types.js";import{useOnOutsideClick as A}from"../../../hooks/useOnOutsideClick.js";import"../../../hooks/useScreenSize.js";import"react-hook-form";import{FilterDropdownContent as B}from"./FilterDropdown.js";import{FilterGroupDropdownContent as q}from"./FilterGroupDropdown.js";import{Footer as E}from"../SharedComponents/Footer.js";import"classnames";import"dayjs";import"../../../consts/index.js";import"../../SVGIcons/icon-registry.js";import"../../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import"../../Checkbox/Checkbox.js";import"motion/react";import"../../Collapse/CollapseGroup/CollapseGroup.js";import"../SharedComponents/ContentTop.js";import{Loading as J}from"../SharedComponents/Loading.js";import{Input as K}from"../../Input/Input.js";import M from"../../SVGIcons/IconSearchFilled.js";import Q from"../../SVGIcons/IconDismissFilled.js";const Se=o=>{const{isLoading:e,isGrouped:s,options:r,isOpen:l,setFieldValue:n,name:i,footerButtonProps:a,selectedItems:p,setSelectedItems:m,closeHandler:d,parentRef:u,language:f="en",...j}=o,[C,S]=c(null),[I,F]=c(p),[g,k]=c("");A(C,d,l,G()),L(d);const v=h(o=>{F(e=>[...e,o])},[]),x=o=>{m&&m(o),i&&n&&n(i,o),d()},D=o=>void 0!==I.find(e=>e.value===o),_=h(()=>{x(I),d()},[I]),O=({value:o})=>{F(e=>e.filter(e=>e.value!==o))};return l?/* @__PURE__ */t(y,{children:H(
2
- /* @__PURE__ */t("div",{className:"select filter",children:/* @__PURE__ */z("div",{className:"select__options",ref:S,children:[
3
- /* @__PURE__ */t(K,{onChange:o=>{o.preventDefault(),o.stopPropagation(),k(o.target.value)},className:"filter__input",size:"small",currentValue:g,rightIconProps:{size:""===g?"small":"xsmall",Component:""===g?M:Q,onClick:()=>{k("")}}}),
4
- /* @__PURE__ */t("div",{className:"select__options__scroll scrollbar scrollbar--vertical ",children:e?/* @__PURE__ */t(J,{}):/* @__PURE__ */t(s?q:B,{checkIsSelected:D,onItemDeselect:O,filterValue:g,onItemSelect:v,options:r,...j})}),e?null:/* @__PURE__ */t(E,{buttonProps:a,onCancel:()=>{x(p),F(p),d()},onApply:_,language:f})]})}),u)}):null};export{Se as FilterSelect};
1
+ import{jsx as t,Fragment as y,jsxs as z}from"react/jsx-runtime";import{useState as c,useId as G,useCallback as h}from"react";import{createPortal as H}from"react-dom";import{useHideOnScroll as L}from"../../../hooks/useHideOnScroll.js";import"../../../context/types.js";import{useOnOutsideClick as A}from"../../../hooks/useOnOutsideClick.js";import"../../../hooks/useScreenSize.js";import"react-hook-form";import{FilterDropdownContent as B}from"./FilterDropdown.js";import{FilterGroupDropdownContent as q}from"./FilterGroupDropdown.js";import{Footer as E}from"../SharedComponents/Footer.js";import"classnames";import"dayjs";import"../../../consts/index.js";import"../../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import"../../Checkbox/Checkbox.js";import"motion/react";import"../../Collapse/CollapseGroup/CollapseGroup.js";import"../SharedComponents/ContentTop.js";import{Loading as J}from"../SharedComponents/Loading.js";import{Input as K}from"../../Input/Input.js";import M from"../../SVGIcons/IconSearchFilled.js";import Q from"../../SVGIcons/IconDismissFilled.js";const Fe=e=>{const{isLoading:o,isGrouped:s,options:r,isOpen:l,setFieldValue:n,name:a,footerButtonProps:i,selectedItems:p,setSelectedItems:m,closeHandler:d,parentRef:u,language:f="en",...j}=e,[C,F]=c(null),[S,I]=c(p),[g,k]=c("");A(C,d,l,G()),L(d);const v=h(e=>{I(o=>[...o,e])},[]),x=e=>{m&&m(e),a&&n&&n(a,e),d()},D=e=>void 0!==S.find(o=>o.value===e),_=h(()=>{x(S),d()},[S]),O=({value:e})=>{I(o=>o.filter(o=>o.value!==e))};return l?/* @__PURE__ */t(y,{children:H(
2
+ /* @__PURE__ */t("div",{className:"select filter",children:/* @__PURE__ */z("div",{className:"select__options",ref:F,children:[
3
+ /* @__PURE__ */t(K,{onChange:e=>{e.preventDefault(),e.stopPropagation(),k(e.target.value)},className:"filter__input",size:"small",currentValue:g,rightIconProps:{size:""===g?"small":"xsmall",Component:""===g?M:Q,onClick:()=>{k("")}}}),
4
+ /* @__PURE__ */t("div",{className:"select__options__scroll scrollbar scrollbar--vertical ",children:o?/* @__PURE__ */t(J,{}):/* @__PURE__ */t(s?q:B,{checkIsSelected:D,onItemDeselect:O,filterValue:g,onItemSelect:v,options:r,...j})}),o?null:/* @__PURE__ */t(E,{buttonProps:i,onCancel:()=>{x(p),I(p),d()},onApply:_,language:f})]})}),u)}):null};export{Fe as FilterSelect};
@@ -1,3 +1,3 @@
1
- import{jsx as f,jsxs as U,Fragment as V}from"react/jsx-runtime";import{forwardRef as X,useState as l,useMemo as Y,useEffect as C,useId as Z}from"react";import{OptionsWrapper as $}from"./OptionsWrapper.js";import{Footer as ee}from"../SharedComponents/Footer.js";import"classnames";import"react-dom";import"../../../consts/index.js";import"../../../context/types.js";import{useOnOutsideClick as oe}from"../../../hooks/useOnOutsideClick.js";import"../../../hooks/useScreenSize.js";import"react-hook-form";import"dayjs";import"../../SVGIcons/icon-registry.js";import"../../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import"../../Checkbox/Checkbox.js";import"motion/react";import"../../Collapse/CollapseGroup/CollapseGroup.js";import"../SharedComponents/ContentTop.js";import{InputSelectWrapper as te}from"../SharedComponents/InputSelectWrapper/InputSelectWrapper.js";import{ButtonSelectWrapper as re}from"../SharedComponents/ButtonSelectWrapper/ButtonSelectWrapper.js";import{useIsMobile as ne}from"../../../hooks/useGetIsMobile.js";import{SELECT_TRANSLATIONS as se}from"../localization.js";const le=X((e,o)=>{const{isMobileFullScreen:s=!0,options:t,footerButtonProps:r,selectedItems:n,setSelectedItems:a,name:i,setFieldValue:p,value:d,label:c,placeHolder:m,isRequiredField:u,labelAddons:S,className:h="",disabled:j,dropdownWidth:I,align:b="left",size:x,isButtonSelect:O,checkboxInfo:g,translations:F,hasError:W,language:k="en",hideSelectedOptions:w=!1,...R}=e,[v,M]=l(null),y=d||n||[],[z,T]=l(!1),[A,B]=l(y),[E,N]=l(null),D=()=>T(!1),G=Y(()=>(null==A?void 0:A.length)!==(null==y?void 0:y.length)||-1!==(null==A?void 0:A.findIndex(e=>-1===(null==y?void 0:y.findIndex(o=>o.value===e.value)))),[A,y]);C(()=>{B(d||[])},[d]),C(()=>{n&&B(n||[])},[n]);const q=()=>{B(y),D()};oe(E,q,z,Z());const H=(e=!1)=>{((e,o)=>{a&&a(e,o),i&&p&&p(i,e),D()})(A,e)},L=O?re:te,P={...se[k],...F},X=ne();/* @__PURE__ */
2
- return f(L,{dropdownRef:v,isOpen:z,setIsOpen:T,containerRef:E,setContainerRef:N,dropdownWidth:I,setDropdownRef:M,size:x,label:c,align:b,disabled:j,className:h,labelAddons:S,placeHolder:m,selectedValues:A,isRequiredField:u,overflowText:P.overflowText,hasError:W,applySelectedItems:H,isMobile:X&&s,hideSelectedOptions:w,children:/* @__PURE__ */U(V,{children:[
3
- /* @__PURE__ */f($,{options:t,isOpen:z,translations:P,setIsOpen:T,dropdownRef:v,openDropdown:()=>T(!0),selectedValues:A,setSelectedValues:B,containerRef:E,dropdownWidth:I,isMobileFullScreen:s,...R}),!t.length||X&&s?null:/* @__PURE__ */f(ee,{checkboxInfo:g,hasChange:G,buttonProps:r,onCancel:q,onApply:H,language:k})]})})});le.displayName="MultiSelect";export{le as MultiSelect};
1
+ import{jsx as f,jsxs as U,Fragment as V}from"react/jsx-runtime";import{forwardRef as X,useState as l,useMemo as Y,useEffect as C,useId as Z}from"react";import{OptionsWrapper as $}from"./OptionsWrapper.js";import{Footer as ee}from"../SharedComponents/Footer.js";import"classnames";import"react-dom";import"../../../consts/index.js";import"../../../context/types.js";import{useOnOutsideClick as oe}from"../../../hooks/useOnOutsideClick.js";import"../../../hooks/useScreenSize.js";import"react-hook-form";import"dayjs";import"../../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import"../../Checkbox/Checkbox.js";import"motion/react";import"../../Collapse/CollapseGroup/CollapseGroup.js";import"../SharedComponents/ContentTop.js";import{InputSelectWrapper as te}from"../SharedComponents/InputSelectWrapper/InputSelectWrapper.js";import{ButtonSelectWrapper as re}from"../SharedComponents/ButtonSelectWrapper/ButtonSelectWrapper.js";import{useIsMobile as ne}from"../../../hooks/useGetIsMobile.js";import{SELECT_TRANSLATIONS as se}from"../localization.js";const le=X((e,o)=>{const{isMobileFullScreen:t=!0,options:s,footerButtonProps:r,selectedItems:n,setSelectedItems:a,name:i,setFieldValue:p,value:d,label:c,placeHolder:m,isRequiredField:u,labelAddons:h,className:S="",disabled:j,dropdownWidth:b,align:I="left",size:x,isButtonSelect:O,checkboxInfo:g,translations:F,hasError:W,language:k="en",hideSelectedOptions:w=!1,...R}=e,[v,M]=l(null),z=d||n||[],[T,y]=l(!1),[A,B]=l(z),[E,N]=l(null),D=()=>y(!1),G=Y(()=>(null==A?void 0:A.length)!==(null==z?void 0:z.length)||-1!==(null==A?void 0:A.findIndex(e=>-1===(null==z?void 0:z.findIndex(o=>o.value===e.value)))),[A,z]);C(()=>{B(d||[])},[d]),C(()=>{n&&B(n||[])},[n]);const q=()=>{B(z),D()};oe(E,q,T,Z());const H=(e=!1)=>{((e,o)=>{a&&a(e,o),i&&p&&p(i,e),D()})(A,e)},L=O?re:te,P={...se[k],...F},X=ne();/* @__PURE__ */
2
+ return f(L,{dropdownRef:v,isOpen:T,setIsOpen:y,containerRef:E,setContainerRef:N,dropdownWidth:b,setDropdownRef:M,size:x,label:c,align:I,disabled:j,className:S,labelAddons:h,placeHolder:m,selectedValues:A,isRequiredField:u,overflowText:P.overflowText,hasError:W,applySelectedItems:H,isMobile:X&&t,hideSelectedOptions:w,children:/* @__PURE__ */U(V,{children:[
3
+ /* @__PURE__ */f($,{options:s,isOpen:T,translations:P,setIsOpen:y,dropdownRef:v,openDropdown:()=>y(!0),selectedValues:A,setSelectedValues:B,containerRef:E,dropdownWidth:b,isMobileFullScreen:t,...R}),!s.length||X&&t?null:/* @__PURE__ */f(ee,{checkboxInfo:g,hasChange:G,buttonProps:r,onCancel:q,onApply:H,language:k})]})})});le.displayName="MultiSelect";export{le as MultiSelect};
@@ -1 +1 @@
1
- import{jsx as u}from"react/jsx-runtime";import{useRef as v,useCallback as B,useMemo as L}from"react";import"classnames";import"../../Checkbox/Checkbox.js";import"react-dom";import{useGetElemSizes as R}from"../../../hooks/useGetElemSizes.js";import"../../../consts/index.js";import"../../../context/types.js";import"../../../hooks/useScreenSize.js";import{useGetHasBottomSpace as V,useGetHasTopSpace as x}from"../../../hooks/useGetHasBottomSpace.js";import"react-hook-form";import{getStringWidth as y}from"../../../utils/helpers.js";import"../../SVGIcons/icon-registry.js";import"../../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import"motion/react";import"../../Collapse/CollapseGroup/CollapseGroup.js";import"../SharedComponents/ContentTop.js";import{Loading as D}from"../SharedComponents/Loading.js";import"../../Input/Input.js";import{useIsMobile as H}from"../../../hooks/useGetIsMobile.js";import{MultiSelectGrouped as k}from"./MultiSelectGrouped/MultiSelectGrouped.js";import{MultiBase as N}from"./MultiBase/MultiBase.js";import{MultiSelectWithTabs as j}from"./MultiSelectWithTabs/MultiSelectWithTabs.js";import{SELECTED_VISIBLE_MIN_COUNT as z}from"../constants.js";const ft=e=>{const{isLoading:t,withTabs:o,isGrouped:s,isOpen:r,containerRef:i,options:a,selectedValues:l,setSelectedValues:p,setIsOpen:m,dropdownRef:n,isMobileFullScreen:c,...S}=e,{width:d}=R(i),h=v(null),f=o?j:s?k:N,M=B(e=>y(e,14)>d-80,[d]),b=L(()=>s||o?a.reduce((e,t)=>{const{data:o}=t;return e+o.length},0):a.length,[a]),{hasBottomSpace:G,bottomSpace:C}=V({element:n,input:h.current}),I=x({element:n,input:h.current}),g=H()&&c;return t?/* @__PURE__ */u(D,{}):/* @__PURE__ */u(f,{options:a,isOpen:r,isMobile:g,hasBottomSpace:G,selectedValues:l,onItemSelect:e=>{p([...l,e])},onItemDeselect:e=>{p(l.filter(t=>t.value!==e.value))},setSelectedValues:p,closeDropdown:()=>m(!1),checkIsValueOverflowed:M,isSearchAvailable:b>z,scrollableContentStyle:{...G||I?{}:{maxHeight:C-65-56}},...S})};export{ft as OptionsWrapper};
1
+ import{jsx as u}from"react/jsx-runtime";import{useRef as v,useCallback as B,useMemo as L}from"react";import"classnames";import"../../Checkbox/Checkbox.js";import"react-dom";import{useGetElemSizes as R}from"../../../hooks/useGetElemSizes.js";import"../../../consts/index.js";import"../../../context/types.js";import"../../../hooks/useScreenSize.js";import{useGetHasBottomSpace as V,useGetHasTopSpace as x}from"../../../hooks/useGetHasBottomSpace.js";import"react-hook-form";import{getStringWidth as y}from"../../../utils/helpers.js";import"../../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import"motion/react";import"../../Collapse/CollapseGroup/CollapseGroup.js";import"../SharedComponents/ContentTop.js";import{Loading as D}from"../SharedComponents/Loading.js";import"../../Input/Input.js";import{useIsMobile as H}from"../../../hooks/useGetIsMobile.js";import{MultiSelectGrouped as k}from"./MultiSelectGrouped/MultiSelectGrouped.js";import{MultiBase as N}from"./MultiBase/MultiBase.js";import{MultiSelectWithTabs as j}from"./MultiSelectWithTabs/MultiSelectWithTabs.js";import{SELECTED_VISIBLE_MIN_COUNT as z}from"../constants.js";const at=e=>{const{isLoading:t,withTabs:o,isGrouped:s,isOpen:r,containerRef:a,options:i,selectedValues:l,setSelectedValues:p,setIsOpen:m,dropdownRef:n,isMobileFullScreen:c,...S}=e,{width:d}=R(a),h=v(null),f=o?j:s?k:N,M=B(e=>y(e,14)>d-80,[d]),b=L(()=>s||o?i.reduce((e,t)=>{const{data:o}=t;return e+o.length},0):i.length,[i]),{hasBottomSpace:C,bottomSpace:G}=V({element:n,input:h.current}),I=x({element:n,input:h.current}),g=H()&&c;return t?/* @__PURE__ */u(D,{}):/* @__PURE__ */u(f,{options:i,isOpen:r,isMobile:g,hasBottomSpace:C,selectedValues:l,onItemSelect:e=>{p([...l,e])},onItemDeselect:e=>{p(l.filter(t=>t.value!==e.value))},setSelectedValues:p,closeDropdown:()=>m(!1),checkIsValueOverflowed:M,isSearchAvailable:b>z,scrollableContentStyle:{...C||I?{}:{maxHeight:G-65-56}},...S})};export{at as OptionsWrapper};
@@ -1,3 +1,3 @@
1
- import{jsxs as i,jsx as t}from"react/jsx-runtime";import{useState as s}from"react";import{Button as u}from"../../Button/Button.js";import{Menu as f}from"../../Menu/Menu.js";import"react-dom";import"../../../consts/index.js";import"../../../context/types.js";import"../../../hooks/useScreenSize.js";import"react-hook-form";import"classnames";import"motion/react";import{Text as b}from"../../Text/Text.js";import"dayjs";import"../../Collapse/CollapseGroup/CollapseGroup.js";import"../../SVGIcons/icon-registry.js";import"../../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import"../../Checkbox/Checkbox.js";import d from"../../SVGIcons/IconMore.js";const P=o=>{const{selectActions:e,innerLabel:r}=o,[n,a]=s(!1),[l,m]=s(null);return e.length?/* @__PURE__ */i("div",{className:"action-bar",children:[r?/* @__PURE__ */t(b,{size:"xsmall",type:"secondary",className:"action-bar__label",children:r}):null,
1
+ import{jsxs as i,jsx as t}from"react/jsx-runtime";import{useState as s}from"react";import{Button as u}from"../../Button/Button.js";import{Menu as f}from"../../Menu/Menu.js";import"react-dom";import"../../../consts/index.js";import"../../../context/types.js";import"../../../hooks/useScreenSize.js";import"react-hook-form";import"classnames";import"motion/react";import{Text as b}from"../../Text/Text.js";import"dayjs";import"../../Collapse/CollapseGroup/CollapseGroup.js";import"../../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import"../../Checkbox/Checkbox.js";import d from"../../SVGIcons/IconMore.js";const L=o=>{const{selectActions:e,innerLabel:r}=o,[n,a]=s(!1),[l,m]=s(null);return e.length?/* @__PURE__ */i("div",{className:"action-bar",children:[r?/* @__PURE__ */t(b,{size:"xsmall",type:"secondary",className:"action-bar__label",children:r}):null,
2
2
  /* @__PURE__ */i("div",{ref:m,className:"action-bar__right",children:[
3
- /* @__PURE__ */t(u,{type:"tertiary",onClick:()=>a(!0),iconProps:{Component:d},size:"small"}),l?/* @__PURE__ */t(f,{menuItems:e,parentRef:l,onClose:()=>a(!1),position:"bottom-left",isOpen:n}):null]})]}):null};export{P as Actions};
3
+ /* @__PURE__ */t(u,{type:"tertiary",onClick:()=>a(!0),iconProps:{Component:d},size:"small"}),l?/* @__PURE__ */t(f,{menuItems:e,parentRef:l,onClose:()=>a(!1),position:"bottom-left",isOpen:n}):null]})]}):null};export{L as Actions};
@@ -1,5 +1,5 @@
1
- import{jsx as a,jsxs as o}from"react/jsx-runtime";import{toast as m,ToastContainer as l,Slide as c}from"react-toastify";import{Text as d}from"../Text/Text.js";import{Button as u}from"../Button/Button.js";import{DEFAULT_DURATION as f,TYPE_MAPPING as N,ICONS_MAPPING as h}from"./consts.js";import{IconDynamicComponent as C}from"../IconDynamicComponent/IconDynamicComponent.js";import"react-toastify/dist/ReactToastify.css";const g=({actionProps:t,toastId:s,type:n="information",text:e})=>/* @__PURE__ */o("div",{"data-id":`${n}-toast-message`,className:"snackbar",children:[
2
- /* @__PURE__ */o("div",{className:"snackbar__content",children:[
3
- /* @__PURE__ */a(C,{componentName:h[n],type:N[n],size:"medium"}),
4
- /* @__PURE__ */a(d,{className:"snackbar__text pl-16 pr-8",type:"primary",size:"standard",weight:"regular",lineHeight:"large",children:e})]}),t?/* @__PURE__ */a(u,{size:"small",type:"tertiary",...t,onClick:a=>{var o;m.dismiss(s),null==(o=null==t?void 0:t.onClick)||o.call(t,a)}}):null]},s),y=t=>{const{toastId:a,closeSnackbar:o,actionProps:s,duration:n=f}=t;m(g(t),{className:"_container",toastId:a,autoClose:!s&&n}),m.onChange(t=>{"removed"===t.status&&(null==o||o(t.id))})},A=t=>{const{duration:o=1e3,position:s="bottom-center"}=t;/* @__PURE__ */
5
- return a(l,{className:"snackbar-wrapper",theme:"light",hideProgressBar:!0,transition:c,position:s,autoClose:o,closeButton:()=>null})};export{A as Snackbar,y as notify};
1
+ import{jsx as s,jsxs as o}from"react/jsx-runtime";import{Suspense as u}from"react";import{toast as l,ToastContainer as c,Slide as d}from"react-toastify";import{Text as f}from"../Text/Text.js";import{Button as h}from"../Button/Button.js";import{DEFAULT_DURATION as N,ICONS_MAPPING as g,TYPE_MAPPING as C}from"./consts.js";import"react-toastify/dist/ReactToastify.css";const _=({actionProps:t,toastId:a,type:e="information",text:r})=>{const n=g[e]||null;/* @__PURE__ */
2
+ return o("div",{"data-id":`${e}-toast-message`,className:"snackbar",children:[
3
+ /* @__PURE__ */o("div",{className:"snackbar__content",children:[n&&/* @__PURE__ */s(u,{fallback:null,children:/* @__PURE__ */s(n,{size:"medium",type:C[e]})}),
4
+ /* @__PURE__ */s(f,{className:"snackbar__text pl-16 pr-8",type:"primary",size:"standard",weight:"regular",lineHeight:"large",children:r})]}),t?/* @__PURE__ */s(h,{size:"small",type:"tertiary",...t,onClick:s=>{var o;l.dismiss(a),null==(o=null==t?void 0:t.onClick)||o.call(t,s)}}):null]},a)},v=t=>{const{toastId:s,closeSnackbar:a,actionProps:o,duration:e=N}=t;l(_(t),{className:"_container",toastId:s,autoClose:!o&&e}),l.onChange(t=>{"removed"===t.status&&(null==a||a(t.id))})},y=t=>{const{duration:a=1e3,position:o="bottom-center"}=t;/* @__PURE__ */
5
+ return s(c,{className:"snackbar-wrapper",theme:"light",hideProgressBar:!0,transition:d,position:o,autoClose:a,closeButton:()=>null})};export{y as Snackbar,v as notify};
@@ -1,8 +1,8 @@
1
1
  import { TSVGIconType } from '../SVGIcons/types';
2
+ import React from 'react';
3
+ import { IconComponent } from '../SVGIcons/icon-registry';
2
4
  export declare const TYPE_MAPPING: {
3
5
  [key: string]: TSVGIconType;
4
6
  };
5
- export declare const ICONS_MAPPING: {
6
- [key: string]: string;
7
- };
7
+ export declare const ICONS_MAPPING: Record<string, React.LazyExoticComponent<IconComponent>>;
8
8
  export declare const DEFAULT_DURATION = 6000;
@@ -1 +1 @@
1
- const r={warning:"warning",success:"success",error:"danger",information:"information"},n={warning:"warningFilled",success:"checkmarkCircleFilled",error:"errorCircleFilled",information:"infoFilled"},i=6e3;export{i as DEFAULT_DURATION,n as ICONS_MAPPING,r as TYPE_MAPPING};
1
+ import{getIcon as n}from"../SVGIcons/icon-registry.js";const r={warning:"warning",success:"success",error:"danger",information:"information"},c={warning:n("IconWarningFilled"),success:n("IconCheckmarkFilled"),error:n("IconErrorCircleFilled"),information:n("IconInfoFilled"),discovery:n("IconInfoFilled")},i=6e3;export{i as DEFAULT_DURATION,c as ICONS_MAPPING,r as TYPE_MAPPING};
@@ -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"../SVGIcons/icon-registry.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"../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 te({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]}),
@@ -9,4 +9,4 @@ import{jsxs as r,jsx as i}from"react/jsx-runtime";import{useState as v,useEffect
9
9
  /* @__PURE__ */i("li",{className:"previous "+(e.getCanPreviousPage()?"":"disabled"),children:/* @__PURE__ */i("a",{rel:"prev",role:"button",onClick:()=>e.firstPage(),children:/* @__PURE__ */i(y,{size:"small"})})}),
10
10
  /* @__PURE__ */i("li",{className:"previous "+(e.getCanPreviousPage()?"":"disabled"),children:/* @__PURE__ */i("a",{rel:"prev",role:"button",onClick:()=>e.previousPage(),children:/* @__PURE__ */i($,{size:"small"})})}),(()=>{const t=s,i=e.getPageCount(),o=[];return i<=7?Array.from({length:i},(e,t)=>t+1):(o.push(1),t<=3?o.push(2,3,4,5,"+++",i):t>i-5?o.push("---",i-4,i-3,i-2,i-1,i):o.push("---",t,t+1,t+2,"+++",i),o)})().map((t,o)=>"---"===t?/* @__PURE__ */i("li",{className:"pagination__more",children:/* @__PURE__ */i("a",{role:"button",onClick:()=>e.setPageIndex(+s-3),children:/* @__PURE__ */i(m,{size:"small"})})},`ellipsis-${o}`):"+++"===t?/* @__PURE__ */i("li",{className:"pagination__more",children:/* @__PURE__ */i("a",{role:"button",onClick:()=>e.setPageIndex(+s+3),children:/* @__PURE__ */i(m,{size:"small"})})},`ellipsis-${o}`):/* @__PURE__ */i("li",{className:I({active:t===s+1}),children:/* @__PURE__ */i("a",{role:"button",onClick:()=>e.setPageIndex(+t-1),children:t})},t)),
11
11
  /* @__PURE__ */i("li",{className:"next "+(e.getCanNextPage()?"":"disabled"),children:/* @__PURE__ */i("a",{rel:"next",role:"button",onClick:()=>e.nextPage(),children:/* @__PURE__ */i(S,{size:"small"})})}),
12
- /* @__PURE__ */i("li",{className:"next "+(e.getCanNextPage()?"":"disabled"),children:/* @__PURE__ */i("a",{rel:"next",role:"button",onClick:()=>e.lastPage(),children:/* @__PURE__ */i(T,{size:"small"})})})]})]})]})}export{oe as AdvancedPagination};
12
+ /* @__PURE__ */i("li",{className:"next "+(e.getCanNextPage()?"":"disabled"),children:/* @__PURE__ */i("a",{rel:"next",role:"button",onClick:()=>e.lastPage(),children:/* @__PURE__ */i(T,{size:"small"})})})]})]})]})}export{te as AdvancedPagination};
@@ -1,8 +1,8 @@
1
- import{jsxs as n,jsx as i}from"react/jsx-runtime";import{useState as d}from"react";import{Button as h}from"../Button/Button.js";import _ from"../SVGIcons/IconSettings.js";import{Switcher as a}from"../Switcher/Switcher.js";import{Menu as b}from"../Menu/Menu.js";import"react-dom";import{Positions as v}from"../Tooltip/types.js";import"../../consts/index.js";import"../../context/types.js";import"../../hooks/useScreenSize.js";import"react-hook-form";import"classnames";import"motion/react";import"dayjs";import"../Collapse/CollapseGroup/CollapseGroup.js";import"../SVGIcons/icon-registry.js";import"../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import{Tooltip as y}from"../Tooltip/Tooltip.js";import"../Checkbox/Checkbox.js";const N=["select","actions","expand"];function q({table:e,tooltipText:o,hiddenColumns:t=[],allToggleText:s="All"}){const[l,r]=d(null),[c,m]=d(!1),p=N.concat(t);/* @__PURE__ */
1
+ import{jsxs as n,jsx as i}from"react/jsx-runtime";import{useState as d}from"react";import{Button as h}from"../Button/Button.js";import _ from"../SVGIcons/IconSettings.js";import{Switcher as a}from"../Switcher/Switcher.js";import{Menu as b}from"../Menu/Menu.js";import"react-dom";import{Positions as v}from"../Tooltip/types.js";import"../../consts/index.js";import"../../context/types.js";import"../../hooks/useScreenSize.js";import"react-hook-form";import"classnames";import"motion/react";import"dayjs";import"../Collapse/CollapseGroup/CollapseGroup.js";import"../FileUpload/DropzoneFileUpload/DropzoneFileUpload.js";import{Tooltip as y}from"../Tooltip/Tooltip.js";import"../Checkbox/Checkbox.js";const N=["select","actions","expand"];function U({table:e,tooltipText:o,hiddenColumns:t=[],allToggleText:s="All"}){const[l,r]=d(null),[c,m]=d(!1),p=N.concat(t);/* @__PURE__ */
2
2
  return n("div",{ref:r,children:[
3
3
  /* @__PURE__ */i(h,{type:"secondary",iconProps:{Component:_},onClick:()=>m(e=>!e)}),
4
4
  /* @__PURE__ */i(b,{className:"settings-menu",position:"top-left",onClose:()=>{m(!1)},isOpen:c,parentRef:l,children:/* @__PURE__ */n("div",{className:"settings-menu__dropdown",children:[
5
5
  /* @__PURE__ */i("div",{className:"relative",children:/* @__PURE__ */i("div",{className:"settings-menu__dropdown__option sticky",children:/* @__PURE__ */i(a,{label:s,selectedValue:e.getIsAllColumnsVisible(),onClick:()=>e.toggleAllColumnsVisible(),inlineType:!0,size:"small"})})}),
6
6
  /* @__PURE__ */i("div",{className:"scrollbar--content scrollbar scrollbar--vertical",children:e.getAllLeafColumns().map(e=>{if(null==p||!p.includes(e.id)){const t="string"==typeof e.columnDef.header?e.columnDef.header:e.columnDef.id;/* @__PURE__ */
7
7
  return n("div",{className:"settings-menu__dropdown__option",children:[o&&!e.getCanHide()&&/* @__PURE__ */i(y,{position:v.TOP_CENTER,text:o,id:e.columnDef.id}),
8
- /* @__PURE__ */i(a,{label:t,id:e.columnDef.id,selectedValue:e.getIsVisible(),onClick:()=>(e=>{const o=e.getToggleVisibilityHandler();o&&o({target:{checked:!e.getIsVisible()}})})(e),disabled:!e.getCanHide(),inlineType:!0,size:"small"})]},e.id)}})})]})})]})}export{q as ColumnSettings};
8
+ /* @__PURE__ */i(a,{label:t,id:e.columnDef.id,selectedValue:e.getIsVisible(),onClick:()=>(e=>{const o=e.getToggleVisibilityHandler();o&&o({target:{checked:!e.getIsVisible()}})})(e),disabled:!e.getCanHide(),inlineType:!0,size:"small"})]},e.id)}})})]})})]})}export{U as ColumnSettings};
@@ -1,2 +1 @@
1
- import{jsx as e,jsxs as o,Fragment as t}from"react/jsx-runtime";import{Text as n}from"../../components/Text/Text.js";import{IconDynamicComponent as p}from"../../components/IconDynamicComponent/IconDynamicComponent.js";import{generateDataTestId as i}from"../../utils/helpers.js";import l from"classnames";const N=({message:s,icon:a,dataId:m,className:r})=>/* @__PURE__ */e(n,{className:l("error-message",r),size:"small",type:"danger",dataId:i("error-message",m),children:/* @__PURE__ */o(t,{children:[a&&/* @__PURE__ */e(p,{componentName:a,className:"mr-4",size:"xsmall",type:"danger"}),
2
- /* @__PURE__ */e("span",{children:s})]})});export{N as ErrorMessage};
1
+ import{jsx as r,Fragment as m}from"react/jsx-runtime";import{Text as o}from"../../components/Text/Text.js";import{generateDataTestId as t}from"../../utils/helpers.js";import n from"classnames";const g=({message:e,icon:s,dataId:a,className:i})=>/* @__PURE__ */r(o,{className:n("error-message",i),size:"small",type:"danger",dataId:t("error-message",a),children:/* @__PURE__ */r(m,{children:/* @__PURE__ */r("span",{children:e})})});export{g as ErrorMessage};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hrm_ui_lib",
3
- "version": "2.0.0-alpha.33",
3
+ "version": "2.0.0-alpha.35",
4
4
  "description": "UI library for Dino",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -1,7 +0,0 @@
1
- import { ReactElement } from 'react';
2
- import { ISVGIconProps } from '../SVGIcons/types';
3
- interface IconDynamicComponentProps extends ISVGIconProps {
4
- componentName: string;
5
- }
6
- export declare const IconDynamicComponent: ({ componentName, ...rest }: IconDynamicComponentProps) => ReactElement | null;
7
- export {};
@@ -1 +0,0 @@
1
- import{jsx as l}from"react/jsx-runtime";import{useMemo as i,Suspense as m}from"react";import{getIcon as u}from"../SVGIcons/icon-registry.js";const r=/* @__PURE__ */new Map,g=({componentName:e,...n})=>{const t=i(()=>{if(!e)return null;const n=`Icon${t=e,t.replace(/^[a-z]/,r=>r.toUpperCase()).replace(/[A-Z]/g,r=>` ${r}`).trim().split(/\s|_|-/).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")}`;var t;if(r.has(n))return r.get(n);const o=u(n);return o?(r.set(n,o),o):null},[e]);return t?/* @__PURE__ */l(m,{fallback:null,children:/* @__PURE__ */l(t,{...n})}):null};export{g as IconDynamicComponent};
@@ -1 +0,0 @@
1
- export * from './IconDynamicComponent';
@@ -1 +0,0 @@
1
- import{IconDynamicComponent as m}from"./IconDynamicComponent.js";export{m as IconDynamicComponent};