hrm_ui_lib 2.0.0-alpha.34 → 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.
- package/components/DatePicker/RangeDatePicker/RangeDatePickerMobile.js +5 -5
- package/components/FileUpload/DropzoneFileUpload/PreviewItem.js +2 -2
- package/components/FileUpload/DropzoneFileUpload/helpers.js +1 -1
- package/components/Snackbar/Snackbar.js +5 -3
- package/components/Snackbar/consts.d.ts +3 -3
- package/components/Snackbar/consts.js +1 -1
- package/package.json +1 -1
- package/components/IconDynamicComponent/IconDynamicComponent.d.ts +0 -7
- package/components/IconDynamicComponent/IconDynamicComponent.js +0 -1
- package/components/IconDynamicComponent/index.d.ts +0 -1
- package/components/IconDynamicComponent/index.js +0 -1
|
@@ -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"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:
|
|
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
|
-
/* @__PURE__ */a(y,{readOnly:!0,onClick:
|
|
4
|
-
/* @__PURE__ */f(W,{isOpen:A,title:null==
|
|
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==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
|
-
/* @__PURE__ */a(y,{readOnly:!0,value:i(
|
|
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,{...
|
|
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,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"react-toastify/dist/ReactToastify.css";import"dayjs";import"../../../consts/index.js";const
|
|
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:[
|
|
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{
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FILE_ACCEPT_TYPE as
|
|
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,3 +1,5 @@
|
|
|
1
|
-
import{jsx as
|
|
2
|
-
|
|
3
|
-
|
|
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"},
|
|
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};
|
package/package.json
CHANGED
|
@@ -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};
|