@itcase/ui-web 1.9.111 → 1.9.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DatePicker_cjs_Cd7wsJCG.js +1 -0
- package/dist/DatePicker_es_BhrZj2OP.js +1 -0
- package/dist/cjs/components/DatePeriod.js +1 -1
- package/dist/cjs/components/DatePicker.js +1 -1
- package/dist/components/DatePeriod.js +1 -1
- package/dist/components/DatePicker.js +1 -1
- package/dist/css/styles/bundles.css +13 -1
- package/dist/stories/DatePickerOverview.mdx +1 -1
- package/dist/types/components/DatePicker/DatePicker.interface.d.ts +22 -28
- package/dist/types/components/DatePicker/DatePicker.js +3 -4
- package/dist/types/components/DatePicker/stories/DatePicker.stories.d.ts +10 -1
- package/dist/types/components/DatePicker/stories/DatePicker.stories.js +31 -33
- package/dist/types/components/DatePicker/stories/DatePickerClear.stories.d.ts +9 -1
- package/dist/types/components/DatePicker/stories/DatePickerClear.stories.js +20 -24
- package/dist/types/components/DatePicker/stories/DatePickerSize.stories.d.ts +8 -0
- package/dist/types/components/DatePicker/stories/DatePickerSize.stories.js +13 -24
- package/dist/types/components/DatePicker/stories/DatePickerStory.d.ts +2 -0
- package/dist/types/components/DatePicker/stories/DatePickerStory.js +18 -0
- package/dist/types/components/DatePicker/stories/DatePickerStyle.stories.d.ts +8 -0
- package/dist/types/components/DatePicker/stories/DatePickerStyle.stories.js +13 -29
- package/dist/types/components/DatePicker/stories/DatePickerWithButton.stories.d.ts +12 -1
- package/dist/types/components/DatePicker/stories/DatePickerWithButton.stories.js +30 -32
- package/package.json +2 -2
- package/dist/DatePicker_cjs_BhZXIBZm.js +0 -1
- package/dist/DatePicker_es_vJagTqXm.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),a=require("clsx"),r=require("date-fns/locale"),i=require("react-datepicker"),n=require("@itcase/ui-core/hooks"),o=require("./Button_cjs_CDr9zTdB.js"),c=require("./primitives_cjs_ocTnUpml.js"),s=require("./Input_cjs_D9PxC_lJ.js"),l=require("./default_cjs_BMbs2it-.js");const p={surfacePrimary:{dayTextColor:"surfaceTextPrimary",dayTextShape:"rounded",iconFillHover:"surfaceSecondary",iconItemFill:"surfaceItemPrimary",iconShape:"circular",monthTextColor:"surfaceTextPrimary",monthTextWeight:"400",yearTextColor:"surfaceTextPrimary",yearTextWeight:"400"},...{sizeL:{size:"l",daySize:"xs",dayTextSize:"m",iconFillSize:"24",iconLeft:l.icons14.Arrow.ChevronLeft,iconRight:l.icons14.Arrow.ChevronRight},sizeM:{size:"m",daySize:"xxl",dayTextSize:"m",iconFillSize:"24",iconLeft:l.icons14.Arrow.ChevronLeft,iconRight:l.icons14.Arrow.ChevronRight,iconSize:"14",monthTextSize:"m",yearTextSize:"m"},sizeS:{size:"s",daySize:"xs",dayTextSize:"m",iconFillSize:"24",iconLeft:l.icons14.Arrow.ChevronLeft,iconRight:l.icons14.Arrow.ChevronRight}},solid:{inputProps:{borderColor:"none"}},outlined:{inputProps:{fill:"none"}},full:{},ghost:{inputProps:{fill:"none",borderColor:"none"}}},u=e=>{const t=e.getDay()||7,a=new Date(e);a.setDate(e.getDate()-(t-1));const r=new Date(a);return r.setDate(a.getDate()+6),{mondayDate:a,sundayDate:r}},d={appearance:p,setAppearance:e=>{d.appearance=e}};const m=t.forwardRef((r,i)=>{const{inputIcon:n,inputProps:o,value:c,isClearable:l}=r,p=t.useMemo(()=>{if(c){const e=c.split(" - ");return e[0]===e[1]?e[0]:c}return""},[c]);return e.jsxs(t.Fragment,{children:[e.jsx(s.Input,{...r,...o,className:a(o?.className,"datepicker__input"),ref:i,autocomplete:"off",value:p}),n&&e.jsx(x,{...o}),l&&e.jsx(h,{datepickerRef:r.datepickerRef,...o})]})});function h(r){const{clearButton:i,clearButtonAppearance:n,clearIcon:s,clearIconAppearance:l,clearIconSrc:p,datepickerRef:u}=r,d=t.useCallback(e=>{u?.current?.onClearClick(e),u?.current?.handleFocus(e)},[]);return e.jsx(t.Fragment,{children:i?e.jsx(o.Button,{appearance:n,className:a("react-datepicker__clear-button","cursor_type_pointer"),label:i,onClick:d}):(s||p)&&e.jsx(c.Icon,{appearance:l,className:a("react-datepicker__clear-icon","cursor_type_pointer"),imageSrc:p,SvgImage:s,onClick:d})})}function x(t){const{inputIcon:r,inputIconFill:i,inputIconFillHover:n,inputIconFillSize:o,inputIconItemFill:s,inputIconShape:l,inputIconSize:p,inputIconSrc:u,onClick:d}=t;return e.jsx(c.Icon,{className:a("react-datepicker__input-icon","cursor_type_pointer"),size:p,fill:i,fillHover:n,fillSize:o,iconFill:s,imageSrc:u,shape:l,SvgImage:r,onClick:()=>d&&d()})}exports.DatePickerInput=function(s){const{className:l,dataTestId:p,dataTour:h,datePickerProps:x={},endValue:f,inputProps:y={},value:k,onChange:C}=s,{appearance:S,customTimeInput:g,disablePastDays:_,monthsShown:z,selectsRange:I,showWeekNumbers:v,showWeekPicker:T}=x,j=n.useAppearanceConfig(S,d),D=n.useDevicePropsGenerator(x,j),{daySize:P,dayTextColor:b,dayTextShape:F,dayTextSize:w,iconFill:N,iconFillHover:R,iconFillSize:A,iconItemFill:q,iconLeft:L,iconRight:W,iconShape:H,monthTextColor:B,monthTextSize:M,monthTextWeight:$,popper:O,popperPlacement:U,sizeClass:G,widthClass:V,yearTextColor:E,yearTextSize:J,yearTextWeight:K,isClearable:Q}=D,X=t.useRef(null),[Y,Z]=t.useMemo(()=>{let e,t;return k&&(e="string"==typeof k?new Date(k):k),f&&(t="string"==typeof f?new Date(f):f),[e,t]},[k,f]),ee=t.useCallback(e=>{const t=Array.isArray(e)?e:[e],[a,r]=t;if(a&&T){const{mondayDate:e,sundayDate:t}=u(a);C?.(e,t)}else C?.(a,r)},[T,C]),te=t.useCallback(e=>{const{mondayDate:t,sundayDate:a}=u(e);C?.(t,a)},[C]),ae=t.useCallback((t,a)=>e.jsx(o.Button,{className:"react-datepicker__day-button",size:P,label:a.getDate().toString(),labelTextColor:b,labelTextSize:w,shape:F}),[P,b,F,w]),re=t.useCallback(({decreaseMonth:t,increaseMonth:a,monthDate:r})=>e.jsxs("div",{className:"react-datepicker__header--div",children:[L&&e.jsx(c.Icon,{className:"react-datepicker__icon",fill:N,fillHover:R,fillSize:A,iconFill:q,shape:H,SvgImage:L,onClick:t}),e.jsxs("div",{className:"react-datepicker__data",children:[e.jsx(c.Text,{className:"react-datepicker__month",size:M,textColor:B,textWeight:$,children:r.toLocaleString("ru-RU",{month:"long"})}),e.jsx(c.Text,{className:"react-datepicker__year",size:J,textColor:E,textWeight:K,children:r.toLocaleString("ru-RU",{year:"numeric"})})]}),W&&e.jsx(c.Icon,{className:"react-datepicker__icon",fill:N,fillHover:R,fillSize:A,iconFill:q,shape:H,SvgImage:W,onClick:a})]}),[N,R,A,q,L,W,H,B,M,$,E,J,K]),{styles:ie}=n.useStyles(s);return e.jsx("div",{className:a(l,"datepicker",z&&"datepicker_multiple-months",g&&"datepicker_button",G&&`datepicker_size_${G}`,V&&`datepicker_width_${V}`),"data-testid":p,"data-tour":h,style:ie,children:e.jsx(i,{ref:X,...x,minDate:_?new Date:void 0,customInput:e.jsx(m,{datepickerRef:X,inputProps:y,isClearable:Q}),endDate:I?Z:void 0,locale:r.ru,outsideClickIgnoreClass:"react-datepicker-popper",popperClassName:O&&`react-datepicker-popper-${O}`,popperPlacement:U,preventOpenOnFocus:!0,renderCustomHeader:re,renderDayContents:ae,selected:Y,startDate:Y,isClearable:!1,onChange:ee,onWeekSelect:v?te:void 0})})},exports.datePickerAppearance=p,exports.datePickerConfig=d;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import a,{useMemo as r,useCallback as i,useRef as o}from"react";import n from"clsx";import{ru as c}from"date-fns/locale";import l from"react-datepicker";import{useAppearanceConfig as s,useDevicePropsGenerator as p,useStyles as d}from"@itcase/ui-core/hooks";import{B as m}from"./Button_es_M2ryMLoI.js";import{I as u,T as h}from"./primitives_es_BQqNcRQk.js";import{I as f}from"./Input_es_DabuPYuA.js";import{a as y}from"./default_es_CaWUd9iO.js";const S={surfacePrimary:{dayTextColor:"surfaceTextPrimary",dayTextShape:"rounded",iconFillHover:"surfaceSecondary",iconItemFill:"surfaceItemPrimary",iconShape:"circular",monthTextColor:"surfaceTextPrimary",monthTextWeight:"400",yearTextColor:"surfaceTextPrimary",yearTextWeight:"400"},...{sizeL:{size:"l",daySize:"xs",dayTextSize:"m",iconFillSize:"24",iconLeft:y.Arrow.ChevronLeft,iconRight:y.Arrow.ChevronRight},sizeM:{size:"m",daySize:"xxl",dayTextSize:"m",iconFillSize:"24",iconLeft:y.Arrow.ChevronLeft,iconRight:y.Arrow.ChevronRight,iconSize:"14",monthTextSize:"m",yearTextSize:"m"},sizeS:{size:"s",daySize:"xs",dayTextSize:"m",iconFillSize:"24",iconLeft:y.Arrow.ChevronLeft,iconRight:y.Arrow.ChevronRight}},solid:{inputProps:{borderColor:"none"}},outlined:{inputProps:{fill:"none"}},full:{},ghost:{inputProps:{fill:"none",borderColor:"none"}}},_=e=>{const t=e.getDay()||7,a=new Date(e);a.setDate(e.getDate()-(t-1));const r=new Date(a);return r.setDate(a.getDate()+6),{mondayDate:a,sundayDate:r}},g={appearance:S,setAppearance:e=>{g.appearance=e}};function C(a){const{className:f,dataTestId:y,dataTour:S,datePickerProps:C={},endValue:x,inputProps:z={},value:T,onChange:v}=a,{appearance:I,customTimeInput:D,disablePastDays:F,monthsShown:w,selectsRange:P,showWeekNumbers:N,showWeekPicker:b}=C,R=s(I,g),A=p(C,R),{daySize:L,dayTextColor:W,dayTextShape:H,dayTextSize:j,iconFill:B,iconFillHover:M,iconFillSize:$,iconItemFill:O,iconLeft:U,iconRight:V,iconShape:q,monthTextColor:E,monthTextSize:G,monthTextWeight:J,popper:K,popperPlacement:Q,sizeClass:X,widthClass:Y,yearTextColor:Z,yearTextSize:ee,yearTextWeight:te,isClearable:ae}=A,re=o(null),[ie,oe]=r(()=>{let e,t;return T&&(e="string"==typeof T?new Date(T):T),x&&(t="string"==typeof x?new Date(x):x),[e,t]},[T,x]),ne=i(e=>{const t=Array.isArray(e)?e:[e],[a,r]=t;if(a&&b){const{mondayDate:e,sundayDate:t}=_(a);v?.(e,t)}else v?.(a,r)},[b,v]),ce=i(e=>{const{mondayDate:t,sundayDate:a}=_(e);v?.(t,a)},[v]),le=i((e,a)=>t(m,{className:"react-datepicker__day-button",size:L,label:a.getDate().toString(),labelTextColor:W,labelTextSize:j,shape:H}),[L,W,H,j]),se=i(({decreaseMonth:a,increaseMonth:r,monthDate:i})=>e("div",{className:"react-datepicker__header--div",children:[U&&t(u,{className:"react-datepicker__icon",fill:B,fillHover:M,fillSize:$,iconFill:O,shape:q,SvgImage:U,onClick:a}),e("div",{className:"react-datepicker__data",children:[t(h,{className:"react-datepicker__month",size:G,textColor:E,textWeight:J,children:i.toLocaleString("ru-RU",{month:"long"})}),t(h,{className:"react-datepicker__year",size:ee,textColor:Z,textWeight:te,children:i.toLocaleString("ru-RU",{year:"numeric"})})]}),V&&t(u,{className:"react-datepicker__icon",fill:B,fillHover:M,fillSize:$,iconFill:O,shape:q,SvgImage:V,onClick:r})]}),[B,M,$,O,U,V,q,E,G,J,Z,ee,te]),{styles:pe}=d(a);return t("div",{className:n(f,"datepicker",w&&"datepicker_multiple-months",D&&"datepicker_button",X&&`datepicker_size_${X}`,Y&&`datepicker_width_${Y}`),"data-testid":y,"data-tour":S,style:pe,children:t(l,{ref:re,...C,minDate:F?new Date:void 0,customInput:t(k,{datepickerRef:re,inputProps:z,isClearable:ae}),endDate:P?oe:void 0,locale:c,outsideClickIgnoreClass:"react-datepicker-popper",popperClassName:K&&`react-datepicker-popper-${K}`,popperPlacement:Q,preventOpenOnFocus:!0,renderCustomHeader:se,renderDayContents:le,selected:ie,startDate:ie,isClearable:!1,onChange:ne,onWeekSelect:N?ce:void 0})})}const k=a.forwardRef((i,o)=>{const{inputIcon:c,inputProps:l,value:s,isClearable:p}=i,d=r(()=>{if(s){const e=s.split(" - ");return e[0]===e[1]?e[0]:s}return""},[s]);return e(a.Fragment,{children:[t(f,{...i,...l,className:n(l?.className,"datepicker__input"),ref:o,autocomplete:"off",value:d}),c&&t(z,{...l}),p&&t(x,{datepickerRef:i.datepickerRef,...l})]})});function x(e){const{clearButton:r,clearButtonAppearance:o,clearIcon:c,clearIconAppearance:l,clearIconSrc:s,datepickerRef:p}=e,d=i(e=>{p?.current?.onClearClick(e),p?.current?.handleFocus(e)},[]);return t(a.Fragment,{children:r?t(m,{appearance:o,className:n("react-datepicker__clear-button","cursor_type_pointer"),label:r,onClick:d}):(c||s)&&t(u,{appearance:l,className:n("react-datepicker__clear-icon","cursor_type_pointer"),imageSrc:s,SvgImage:c,onClick:d})})}function z(e){const{inputIcon:a,inputIconFill:r,inputIconFillHover:i,inputIconFillSize:o,inputIconItemFill:c,inputIconShape:l,inputIconSize:s,inputIconSrc:p,onClick:d}=e;return t(u,{className:n("react-datepicker__input-icon","cursor_type_pointer"),size:s,fill:r,fillHover:i,fillSize:o,iconFill:c,imageSrc:p,shape:l,SvgImage:a,onClick:()=>d&&d()})}export{C as D,g as a,S as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),a=require("react"),r=require("clsx"),i=require("luxon"),s=require("@itcase/common"),t=require("@itcase/ui-core/hooks"),c=require("@itcase/ui-core/utils"),p=require("../../ChipsGroup_cjs_BfWpClti.js"),d=require("../../
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),a=require("react"),r=require("clsx"),i=require("luxon"),s=require("@itcase/common"),t=require("@itcase/ui-core/hooks"),c=require("@itcase/ui-core/utils"),p=require("../../ChipsGroup_cjs_BfWpClti.js"),d=require("../../DatePicker_cjs_Cd7wsJCG.js");require("react-select"),require("../../primitives_cjs_ocTnUpml.js");var n=require("../../SelectContainer_cjs_DEG3N6SX.js");require("../../Group_cjs_CiLUYKP7.js"),require("date-fns/locale"),require("react-datepicker"),require("../../Button_cjs_CDr9zTdB.js"),require("../../Loader_cjs_nwF8h8Ku.js"),require("../../Input_cjs_D9PxC_lJ.js"),require("../../default_cjs_BMbs2it-.js"),require("@rc-component/tooltip"),require("react-inlinesvg"),require("@itcase/ui-core/hoc"),require("react-select/creatable");const o={surfacePrimary:{fill:"surfacePrimary",chipsAppearance:"surfacePrimary sizeM ghost rounded",datePickerAppearance:"surfacePrimary sizeM solid rounded",datePickerInputAppearance:"defaultPrimary sizeM solid rounded",selectAppearance:"defaultPrimary sizeM solid rounded"},surfaceSecondary:{fill:"surfaceSecondary",chipsAppearance:"surfacePrimary sizeM ghost rounded",datePickerAppearance:"surfacePrimary sizeM solid rounded",datePickerInputAppearance:"defaultPrimary sizeM solid rounded",selectAppearance:"defaultPrimary sizeM solid rounded"},sizeL:{size:"l",chipsAppearanceSize:"sizeXL",datePickerAppearanceSize:"sizeL",datePickerInputAppearanceSize:"sizeL",selectAppearanceSize:"sizeL"},sizeM:{size:"m",chipsAppearanceSize:"sizeL",datePickerAppearanceSize:"sizeM",datePickerInputAppearanceSize:"sizeM",selectAppearanceSize:"sizeM"},sizeS:{size:"s",chipsAppearanceSize:"sizeM",datePickerAppearanceSize:"sizeS",datePickerInputAppearanceSize:"sizeS",selectAppearanceSize:"sizeS"},circular:{shape:"circular"},rounded:{chipsShape:"rounded",selectShape:"rounded",shape:"rounded"},roundedXL:{chipsShape:"roundedXL",selectShape:"roundedXL",shape:"roundedXL"},roundedL:{chipsShape:"roundedL",selectShape:"roundedL",shape:"roundedL"},roundedM:{chipsShape:"roundedM",selectShape:"roundedM",shape:"roundedM"},roundedS:{chipsShape:"roundedS",selectShape:"roundedS",shape:"roundedS"}},l={appearance:o,setAppearance:e=>{l.appearance=e}};exports.DatePeriod=function(o){const{appearance:u,className:h,dataTestId:S,dataTour:P,datePeriodIntervalsList:z=Object.values(s.DATE_PERIOD_INTERVALS),datePeriodSelectFirstOptions:m,datePeriodSelectFirstPlaceholder:_,datePeriodSelectFirstValue:A,datePeriodSelectSecondOptions:k,datePeriodSelectSecondPlaceholder:j,datePeriodSelectSecondValue:f,datePeriodValueEnd:y,datePeriodValueStart:q,monthsShown:D,popperPlacement:C,selectsRange:I=!0,showWeekNumbers:L=!0,isDisabled:v,isSkeleton:g,onChangeDatePeriod:x,onChangeDatePeriodFirstSelect:M,onChangeDatePeriodSecondSelect:b,onKeyDown:w}=o,N=t.useAppearanceConfig(u,l,v),K=t.useDevicePropsGenerator(o,N),{fillClass:T,chipsAppearance:F,chipsAppearanceSize:O,chipsShape:V,datePickerAppearance:X,datePickerAppearanceSize:E,datePickerInputAppearance:G,datePickerInputAppearanceSize:R,datePickerInputFillHover:W,datePickerInputTextSize:$,selectAppearance:H,selectAppearanceSize:J,selectShape:B,shapeClass:Q,sizeClass:U}=K,Y=a.useCallback(e=>{const a=e.dateIntervalsList[0],r=e.dateIntervalsList[1];x?.(new Date(a),new Date(r))},[x]),Z=a.useCallback(e=>{const a=e.dateIntervalsList[0],r=e.dateIntervalsList[1];let s=null,t=null;return q&&(s=i.DateTime.fromJSDate(new Date(q)).toISODate()),y&&(t=i.DateTime.fromJSDate(new Date(y)).toISODate()),a===s&&r===t},[y,q]);return e.jsxs("div",{className:r(h,"date-period",U&&`date-period_size_${U}`,g&&"skeleton"),"data-testid":S,"data-tour":P,children:[e.jsxs("div",{className:r("date-period__wrapper",Q&&`shape_${Q}`,T&&`fill_${T}`,"cursor_type_pointer"),children:[e.jsx(p.ChipsGroup,{className:"date-period__choice",direction:"horizontal",children:z.map(a=>e.jsx(p.Chips,{appearance:c.mergeAppearanceKeys(F,O),label:a.label,shape:V,isActive:Z(a),onClick:()=>Y(a)},a.value))}),e.jsx(d.DatePickerInput,{className:"date-period__datepicker",datePickerProps:{appearance:c.mergeAppearanceKeys(X,E),dateFormat:"dd/MM/yyyy",monthsShown:D,popperPlacement:C,selectsRange:I,showWeekNumbers:L,isClearable:!1,onKeyDown:w},endValue:y,inputProps:{appearance:c.mergeAppearanceKeys(G,R,"ghost"),className:`date-period__datepicker-input date-period__datepicker-input_size_${U} `,fillHover:W,textSize:$,placeholder:"Выбрать период"},value:q,onChange:x})]}),m&&e.jsx(n.SelectContainer,{appearance:c.mergeAppearanceKeys(H,J),className:"date-period__select",width:"180px",minWidth:"180px",options:m,placeholder:_,shape:B,value:A,isSearchable:!0,onChange:M}),k&&e.jsx(n.SelectContainer,{appearance:c.mergeAppearanceKeys(H,J),className:"date-period__select",width:"180px",minWidth:"180px",options:k,placeholder:j,shape:B,value:f,isSearchable:!0,onChange:b})]})},exports.datePeriodAppearance=o,exports.datePeriodConfig=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../
|
|
1
|
+
"use strict";var e=require("../../DatePicker_cjs_Cd7wsJCG.js");require("react/jsx-runtime"),require("react"),require("clsx"),require("date-fns/locale"),require("react-datepicker"),require("@itcase/ui-core/hooks"),require("../../Button_cjs_CDr9zTdB.js"),require("@itcase/ui-core/utils"),require("../../primitives_cjs_ocTnUpml.js"),require("@rc-component/tooltip"),require("react-inlinesvg"),require("@itcase/ui-core/hoc"),require("../../Loader_cjs_nwF8h8Ku.js"),require("@itcase/common"),require("../../Input_cjs_D9PxC_lJ.js"),require("../../default_cjs_BMbs2it-.js"),exports.DatePickerInput=e.DatePickerInput,exports.datePickerAppearance=e.datePickerAppearance,exports.datePickerConfig=e.datePickerConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as a}from"react/jsx-runtime";import{useCallback as r}from"react";import i from"clsx";import{DateTime as t}from"luxon";import{DATE_PERIOD_INTERVALS as s}from"@itcase/common";import{useAppearanceConfig as p,useDevicePropsGenerator as
|
|
1
|
+
import{jsxs as e,jsx as a}from"react/jsx-runtime";import{useCallback as r}from"react";import i from"clsx";import{DateTime as t}from"luxon";import{DATE_PERIOD_INTERVALS as s}from"@itcase/common";import{useAppearanceConfig as p,useDevicePropsGenerator as c}from"@itcase/ui-core/hooks";import{mergeAppearanceKeys as o}from"@itcase/ui-core/utils";import{a as d,C as n}from"../ChipsGroup_es_CrKRN7eQ.js";import{D as l}from"../DatePicker_es_BhrZj2OP.js";import"react-select";import"../primitives_es_BQqNcRQk.js";import{a as u}from"../SelectContainer_es_CXIvftMU.js";import"../Group_es_DIuSNHx3.js";import"date-fns/locale";import"react-datepicker";import"../Button_es_M2ryMLoI.js";import"../Loader_es_CwVQZ1L0.js";import"../Input_es_DabuPYuA.js";import"../default_es_CaWUd9iO.js";import"@rc-component/tooltip";import"react-inlinesvg";import"@itcase/ui-core/hoc";import"react-select/creatable";const h={surfacePrimary:{fill:"surfacePrimary",chipsAppearance:"surfacePrimary sizeM ghost rounded",datePickerAppearance:"surfacePrimary sizeM solid rounded",datePickerInputAppearance:"defaultPrimary sizeM solid rounded",selectAppearance:"defaultPrimary sizeM solid rounded"},surfaceSecondary:{fill:"surfaceSecondary",chipsAppearance:"surfacePrimary sizeM ghost rounded",datePickerAppearance:"surfacePrimary sizeM solid rounded",datePickerInputAppearance:"defaultPrimary sizeM solid rounded",selectAppearance:"defaultPrimary sizeM solid rounded"},sizeL:{size:"l",chipsAppearanceSize:"sizeXL",datePickerAppearanceSize:"sizeL",datePickerInputAppearanceSize:"sizeL",selectAppearanceSize:"sizeL"},sizeM:{size:"m",chipsAppearanceSize:"sizeL",datePickerAppearanceSize:"sizeM",datePickerInputAppearanceSize:"sizeM",selectAppearanceSize:"sizeM"},sizeS:{size:"s",chipsAppearanceSize:"sizeM",datePickerAppearanceSize:"sizeS",datePickerInputAppearanceSize:"sizeS",selectAppearanceSize:"sizeS"},circular:{shape:"circular"},rounded:{chipsShape:"rounded",selectShape:"rounded",shape:"rounded"},roundedXL:{chipsShape:"roundedXL",selectShape:"roundedXL",shape:"roundedXL"},roundedL:{chipsShape:"roundedL",selectShape:"roundedL",shape:"roundedL"},roundedM:{chipsShape:"roundedM",selectShape:"roundedM",shape:"roundedM"},roundedS:{chipsShape:"roundedS",selectShape:"roundedS",shape:"roundedS"}},m={appearance:h,setAppearance:e=>{m.appearance=e}};function S(h){const{appearance:S,className:z,dataTestId:P,dataTour:_,datePeriodIntervalsList:f=Object.values(s),datePeriodSelectFirstOptions:A,datePeriodSelectFirstPlaceholder:k,datePeriodSelectFirstValue:L,datePeriodSelectSecondOptions:y,datePeriodSelectSecondPlaceholder:M,datePeriodSelectSecondValue:I,datePeriodValueEnd:v,datePeriodValueStart:D,monthsShown:C,popperPlacement:w,selectsRange:g=!0,showWeekNumbers:b=!0,isDisabled:j,isSkeleton:x,onChangeDatePeriod:N,onChangeDatePeriodFirstSelect:F,onChangeDatePeriodSecondSelect:O,onKeyDown:V}=h,X=p(S,m,j),W=c(h,X),{fillClass:$,chipsAppearance:T,chipsAppearanceSize:G,chipsShape:H,datePickerAppearance:J,datePickerAppearanceSize:K,datePickerInputAppearance:R,datePickerInputAppearanceSize:B,datePickerInputFillHover:E,datePickerInputTextSize:q,selectAppearance:Q,selectAppearanceSize:U,selectShape:Y,shapeClass:Z,sizeClass:ee}=W,ae=r(e=>{const a=e.dateIntervalsList[0],r=e.dateIntervalsList[1];N?.(new Date(a),new Date(r))},[N]),re=r(e=>{const a=e.dateIntervalsList[0],r=e.dateIntervalsList[1];let i=null,s=null;return D&&(i=t.fromJSDate(new Date(D)).toISODate()),v&&(s=t.fromJSDate(new Date(v)).toISODate()),a===i&&r===s},[v,D]);return e("div",{className:i(z,"date-period",ee&&`date-period_size_${ee}`,x&&"skeleton"),"data-testid":P,"data-tour":_,children:[e("div",{className:i("date-period__wrapper",Z&&`shape_${Z}`,$&&`fill_${$}`,"cursor_type_pointer"),children:[a(d,{className:"date-period__choice",direction:"horizontal",children:f.map(e=>a(n,{appearance:o(T,G),label:e.label,shape:H,isActive:re(e),onClick:()=>ae(e)},e.value))}),a(l,{className:"date-period__datepicker",datePickerProps:{appearance:o(J,K),dateFormat:"dd/MM/yyyy",monthsShown:C,popperPlacement:w,selectsRange:g,showWeekNumbers:b,isClearable:!1,onKeyDown:V},endValue:v,inputProps:{appearance:o(R,B,"ghost"),className:`date-period__datepicker-input date-period__datepicker-input_size_${ee} `,fillHover:E,textSize:q,placeholder:"Выбрать период"},value:D,onChange:N})]}),A&&a(u,{appearance:o(Q,U),className:"date-period__select",width:"180px",minWidth:"180px",options:A,placeholder:k,shape:Y,value:L,isSearchable:!0,onChange:F}),y&&a(u,{appearance:o(Q,U),className:"date-period__select",width:"180px",minWidth:"180px",options:y,placeholder:M,shape:Y,value:I,isSearchable:!0,onChange:O})]})}export{S as DatePeriod,h as datePeriodAppearance,m as datePeriodConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{D as DatePickerInput,d as datePickerAppearance,a as datePickerConfig}from"../
|
|
1
|
+
export{D as DatePickerInput,d as datePickerAppearance,a as datePickerConfig}from"../DatePicker_es_BhrZj2OP.js";import"react/jsx-runtime";import"react";import"clsx";import"date-fns/locale";import"react-datepicker";import"@itcase/ui-core/hooks";import"../Button_es_M2ryMLoI.js";import"@itcase/ui-core/utils";import"../primitives_es_BQqNcRQk.js";import"@rc-component/tooltip";import"react-inlinesvg";import"@itcase/ui-core/hoc";import"../Loader_es_CwVQZ1L0.js";import"@itcase/common";import"../Input_es_DabuPYuA.js";import"../default_es_CaWUd9iO.js";
|
|
@@ -61264,8 +61264,12 @@ h2.react-datepicker__current-month {
|
|
|
61264
61264
|
right: 12px;
|
|
61265
61265
|
transform: translateY(-50%);
|
|
61266
61266
|
}
|
|
61267
|
-
&__clear-
|
|
61267
|
+
&__clear-button {
|
|
61268
|
+
position: absolute;
|
|
61269
|
+
top: 50%;
|
|
61270
|
+
right: 12px;
|
|
61268
61271
|
width: auto;
|
|
61272
|
+
transform: translateY(-50%);
|
|
61269
61273
|
}
|
|
61270
61274
|
&__input-icon.icon {
|
|
61271
61275
|
background: #fff;
|
|
@@ -61340,6 +61344,12 @@ h2.react-datepicker__current-month {
|
|
|
61340
61344
|
&__input-time-container {
|
|
61341
61345
|
grid-row-start: 2;
|
|
61342
61346
|
grid-column-start: span 2;
|
|
61347
|
+
&:not(:last-child) {
|
|
61348
|
+
display: none;
|
|
61349
|
+
}
|
|
61350
|
+
&:last-child {
|
|
61351
|
+
grid-column: 1 / -1;
|
|
61352
|
+
}
|
|
61343
61353
|
}
|
|
61344
61354
|
}
|
|
61345
61355
|
}
|
|
@@ -61347,12 +61357,14 @@ h2.react-datepicker__current-month {
|
|
|
61347
61357
|
:root {
|
|
61348
61358
|
--date-picker-padding: 24px 12px;
|
|
61349
61359
|
--date-picker-fill: var(--color-surface-fill-primary);
|
|
61360
|
+
--date-picker-background: var(--date-picker-fill);
|
|
61350
61361
|
--date-picker-box-shadow: 0px 4px 24px 0px rgb(0, 0, 0, 0.2);
|
|
61351
61362
|
--date-picker-border-radius: 12px;
|
|
61352
61363
|
--date-picker-border: solid 1px var(--color-surface-fill-tertiary);
|
|
61353
61364
|
|
|
61354
61365
|
--date-picker-input-container-padding: 9px 15px;
|
|
61355
61366
|
--date-picker-input-border-radius: 6px;
|
|
61367
|
+
--date-picker-input-min-width: 70px;
|
|
61356
61368
|
|
|
61357
61369
|
--date-picker-selected-weight: 400;
|
|
61358
61370
|
--date-picker-week-width: 40px;
|
|
@@ -6,14 +6,13 @@ import type { AppearancePartialRecord, AppearanceRecord } from '@itcase/types-ui
|
|
|
6
6
|
import { ButtonProps } from 'src/components/Button/Button.interface';
|
|
7
7
|
import { IconProps } from 'src/components/Icon/Icon.interface';
|
|
8
8
|
import { InputProps } from 'src/components/Input/Input.interface';
|
|
9
|
-
import { LabelProps } from 'src/components/Label/Label.interface';
|
|
10
9
|
import { TextProps } from 'src/components/Text/Text.interface';
|
|
11
10
|
type DatePickerInputAppearanceProps = {
|
|
12
11
|
appearance?: CompositeAppearanceKeys;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
clearButton?: ButtonProps['label'];
|
|
13
|
+
clearButtonAppearance?: ButtonProps['appearance'];
|
|
14
|
+
clearIcon?: IconProps['SvgImage'];
|
|
15
|
+
clearIconAppearance?: IconProps['appearance'];
|
|
17
16
|
daySize?: ButtonProps['size'];
|
|
18
17
|
dayTextColor?: ButtonProps['labelTextColor'];
|
|
19
18
|
dayTextShape?: ButtonProps['shape'];
|
|
@@ -40,32 +39,12 @@ type DatePickerInputAppearanceProps = {
|
|
|
40
39
|
yearTextSize?: TextProps['size'];
|
|
41
40
|
yearTextWeight?: TextProps['textWeight'];
|
|
42
41
|
};
|
|
43
|
-
type DatePickerInputProps = DatePickerInputAppearanceProps & Omit<DatePickerProps, 'onChange'> & {
|
|
44
|
-
className?: string;
|
|
45
|
-
dataTestId?: string;
|
|
46
|
-
dataTour?: string;
|
|
47
|
-
datePickerProps?: DatePickerInputAppearanceProps & Omit<DatePickerProps, 'selectsRange'> & {
|
|
48
|
-
selectsRange?: boolean;
|
|
49
|
-
};
|
|
50
|
-
endValue?: string | Date | DateIso;
|
|
51
|
-
onChange?: (dateStart: Date | null, dateEnd: Date | null) => void;
|
|
52
|
-
popperPlacement?: ReactNode;
|
|
53
|
-
value?: string | Date | DateIso;
|
|
54
|
-
};
|
|
55
42
|
type DatePickerCustomInput = {
|
|
43
|
+
clearButton?: ButtonProps['label'];
|
|
44
|
+
clearButtonAppearance?: ButtonProps['appearance'];
|
|
56
45
|
clearIcon?: IconProps['SvgImage'];
|
|
57
|
-
|
|
58
|
-
clearIconFillHover?: IconProps['fillHover'];
|
|
59
|
-
clearIconFillSize?: IconProps['fillSize'];
|
|
60
|
-
clearIconItemFill?: IconProps['iconFill'];
|
|
61
|
-
clearIconItemFillHover?: IconProps['iconFillHover'];
|
|
62
|
-
clearIconShape?: IconProps['shape'];
|
|
63
|
-
clearIconSize?: IconProps['size'];
|
|
46
|
+
clearIconAppearance?: IconProps['appearance'];
|
|
64
47
|
clearIconSrc?: IconProps['imageSrc'];
|
|
65
|
-
clearLabel?: LabelProps['label'];
|
|
66
|
-
clearLabelTextColor?: LabelProps['labelTextColor'];
|
|
67
|
-
clearLabelTextColorHover?: LabelProps['labelTextColorHover'];
|
|
68
|
-
clearLabelTextSize?: LabelProps['labelTextSize'];
|
|
69
48
|
datepickerRef?: RefObject<DatePicker | null>;
|
|
70
49
|
inputIcon?: IconProps['SvgImage'];
|
|
71
50
|
inputIconFill?: IconProps['fill'];
|
|
@@ -80,6 +59,21 @@ type DatePickerCustomInput = {
|
|
|
80
59
|
labelTextSize?: TextSizeProps;
|
|
81
60
|
value?: string;
|
|
82
61
|
};
|
|
62
|
+
type DatePickerInputClearProps = Pick<DatePickerCustomInput, 'clearButton' | 'clearButtonAppearance' | 'clearIcon' | 'clearIconAppearance' | 'clearIconSrc'>;
|
|
63
|
+
type DatePickerInputProps = DatePickerInputAppearanceProps & Omit<DatePickerProps, 'onChange'> & {
|
|
64
|
+
className?: string;
|
|
65
|
+
dataTestId?: string;
|
|
66
|
+
dataTour?: string;
|
|
67
|
+
datePickerProps?: DatePickerInputAppearanceProps & Omit<DatePickerProps, 'selectsRange'> & {
|
|
68
|
+
isClearable?: boolean;
|
|
69
|
+
selectsRange?: boolean;
|
|
70
|
+
};
|
|
71
|
+
endValue?: string | Date | DateIso;
|
|
72
|
+
inputProps?: DatePickerInputClearProps & InputProps;
|
|
73
|
+
onChange?: (dateStart: Date | null, dateEnd: Date | null) => void;
|
|
74
|
+
popperPlacement?: ReactNode;
|
|
75
|
+
value?: string | Date | DateIso;
|
|
76
|
+
};
|
|
83
77
|
type DatePickerInputIcon = {
|
|
84
78
|
inputIcon?: IconProps['SvgImage'];
|
|
85
79
|
inputIconFill?: IconProps['fill'];
|
|
@@ -7,7 +7,6 @@ import { useAppearanceConfig, useDevicePropsGenerator, useStyles, } from '@itcas
|
|
|
7
7
|
import { Button } from 'src/components/Button';
|
|
8
8
|
import { Icon } from 'src/components/Icon';
|
|
9
9
|
import { Input } from 'src/components/Input';
|
|
10
|
-
import { Label } from 'src/components/Label';
|
|
11
10
|
import { Text } from 'src/components/Text';
|
|
12
11
|
import { datePickerAppearance } from './DatePicker.appearance';
|
|
13
12
|
import { getWeekRange } from './DatePicker.utils';
|
|
@@ -90,16 +89,16 @@ const DatePickerCustomInput = React.forwardRef((props, ref) => {
|
|
|
90
89
|
}
|
|
91
90
|
return '';
|
|
92
91
|
}, [value]);
|
|
93
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Input, { ...props, ...inputProps, className: clsx(inputProps?.className, 'datepicker__input'), ref: ref, autocomplete: "off", value: multipleValue }), inputIcon && _jsx(DatePickerInputIcon, { ...inputProps }), isClearable && _jsx(DatePickerClearButton, { ...inputProps })] }));
|
|
92
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Input, { ...props, ...inputProps, className: clsx(inputProps?.className, 'datepicker__input'), ref: ref, autocomplete: "off", value: multipleValue }), inputIcon && _jsx(DatePickerInputIcon, { ...inputProps }), isClearable && (_jsx(DatePickerClearButton, { datepickerRef: props.datepickerRef, ...inputProps }))] }));
|
|
94
93
|
});
|
|
95
94
|
function DatePickerClearButton(props) {
|
|
96
|
-
const {
|
|
95
|
+
const { clearButton, clearButtonAppearance, clearIcon, clearIconAppearance, clearIconSrc, datepickerRef, } = props;
|
|
97
96
|
const onClick = useCallback((event) => {
|
|
98
97
|
datepickerRef?.current?.onClearClick(event);
|
|
99
98
|
datepickerRef?.current?.handleFocus(event);
|
|
100
99
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
100
|
}, []);
|
|
102
|
-
return (_jsx(React.Fragment, { children:
|
|
101
|
+
return (_jsx(React.Fragment, { children: clearButton ? (_jsx(Button, { appearance: clearButtonAppearance, className: clsx('react-datepicker__clear-button', 'cursor_type_pointer'), label: clearButton, onClick: onClick })) : ((clearIcon || clearIconSrc) && (_jsx(Icon, { appearance: clearIconAppearance, className: clsx('react-datepicker__clear-icon', 'cursor_type_pointer'), imageSrc: clearIconSrc, SvgImage: clearIcon, onClick: onClick }))) }));
|
|
103
102
|
}
|
|
104
103
|
function DatePickerInputIcon(props) {
|
|
105
104
|
const { inputIcon, inputIconFill, inputIconFillHover, inputIconFillSize, inputIconItemFill, inputIconShape, inputIconSize, inputIconSrc, onClick, } = props;
|
|
@@ -5,6 +5,14 @@ declare const meta: {
|
|
|
5
5
|
component: typeof DatePickerInput;
|
|
6
6
|
args: {
|
|
7
7
|
width: "220px";
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: "surfacePrimary sizeM solid rounded";
|
|
10
|
+
dateFormat: string;
|
|
11
|
+
placeholderText: string;
|
|
12
|
+
};
|
|
13
|
+
inputProps: {
|
|
14
|
+
appearance: "defaultPrimary sizeM solid rounded";
|
|
15
|
+
};
|
|
8
16
|
};
|
|
9
17
|
parameters: {
|
|
10
18
|
layout: string;
|
|
@@ -12,7 +20,8 @@ declare const meta: {
|
|
|
12
20
|
};
|
|
13
21
|
export default meta;
|
|
14
22
|
type Story = StoryObj<typeof meta>;
|
|
15
|
-
export declare const
|
|
23
|
+
export declare const Default: Story;
|
|
24
|
+
export declare const WithInitialDate: Story;
|
|
16
25
|
export declare const DateTime: Story;
|
|
17
26
|
export declare const DateRange: Story;
|
|
18
27
|
export declare const DateWeek: Story;
|
|
@@ -1,82 +1,80 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { DatePickerInput } from '../DatePicker';
|
|
2
|
+
import { createDatePickerStory } from './DatePickerStory';
|
|
3
3
|
const meta = {
|
|
4
4
|
title: 'Molecules / DatePicker',
|
|
5
5
|
component: DatePickerInput,
|
|
6
6
|
args: {
|
|
7
7
|
width: '220px',
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: 'surfacePrimary sizeM solid rounded',
|
|
10
|
+
dateFormat: 'dd.MM.yyyy',
|
|
11
|
+
placeholderText: 'Выберите дату',
|
|
12
|
+
},
|
|
13
|
+
inputProps: {
|
|
14
|
+
appearance: 'defaultPrimary sizeM solid rounded',
|
|
15
|
+
},
|
|
8
16
|
},
|
|
9
17
|
parameters: {
|
|
10
18
|
layout: 'centered',
|
|
11
19
|
},
|
|
12
20
|
};
|
|
13
21
|
export default meta;
|
|
14
|
-
|
|
22
|
+
const DatePickerStory = createDatePickerStory(meta.args);
|
|
23
|
+
export const Default = {
|
|
24
|
+
render: DatePickerStory,
|
|
25
|
+
};
|
|
26
|
+
export const WithInitialDate = {
|
|
15
27
|
args: {
|
|
16
28
|
datePickerProps: {
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
inputProps: {
|
|
20
|
-
appearance: 'defaultPrimary sizeM solid rounded',
|
|
29
|
+
placeholderText: 'Дата с начальным значением',
|
|
21
30
|
},
|
|
31
|
+
value: '2025-06-15',
|
|
22
32
|
},
|
|
23
|
-
render:
|
|
24
|
-
return _jsx(DatePickerInput, { ...args });
|
|
25
|
-
},
|
|
33
|
+
render: DatePickerStory,
|
|
26
34
|
};
|
|
27
35
|
export const DateTime = {
|
|
28
36
|
args: {
|
|
29
37
|
datePickerProps: {
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
dateFormat: 'dd.MM.yyyy HH:mm',
|
|
39
|
+
placeholderText: 'Дата и время',
|
|
32
40
|
popperPlacement: 'bottom',
|
|
33
41
|
showTimeSelect: true,
|
|
34
42
|
timeCaption: 'Время',
|
|
35
|
-
timeFormat: '
|
|
43
|
+
timeFormat: 'HH:mm',
|
|
36
44
|
timeIntervals: 15,
|
|
37
45
|
},
|
|
38
|
-
|
|
39
|
-
appearance: 'defaultPrimary sizeM solid rounded',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
render: (args) => {
|
|
43
|
-
return _jsx(DatePickerInput, { ...args });
|
|
46
|
+
value: '2025-06-15T14:30:00',
|
|
44
47
|
},
|
|
48
|
+
render: DatePickerStory,
|
|
45
49
|
};
|
|
46
50
|
export const DateRange = {
|
|
47
51
|
args: {
|
|
48
52
|
width: '360px',
|
|
49
53
|
datePickerProps: {
|
|
50
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
51
54
|
monthsShown: 2,
|
|
52
|
-
placeholderText: '
|
|
55
|
+
placeholderText: 'Начало – конец',
|
|
53
56
|
selectsRange: true,
|
|
54
57
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
render: (args) => {
|
|
60
|
-
return _jsx(DatePickerInput, { ...args });
|
|
58
|
+
endValue: '2025-06-20',
|
|
59
|
+
value: '2025-06-01',
|
|
61
60
|
},
|
|
61
|
+
render: DatePickerStory,
|
|
62
62
|
};
|
|
63
63
|
export const DateWeek = {
|
|
64
64
|
args: {
|
|
65
|
+
width: '360px',
|
|
65
66
|
datePickerProps: {
|
|
66
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
67
67
|
dateFormat: 'I неделя',
|
|
68
68
|
monthsShown: 2,
|
|
69
|
+
placeholderText: 'Выберите неделю',
|
|
69
70
|
readOnly: false,
|
|
70
71
|
selectsRange: true,
|
|
71
72
|
showWeekNumbers: true,
|
|
72
73
|
showWeekPicker: false,
|
|
73
74
|
isClearable: false,
|
|
74
75
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
render: (args) => {
|
|
80
|
-
return _jsx(DatePickerInput, { ...args });
|
|
76
|
+
endValue: '2025-06-15',
|
|
77
|
+
value: '2025-06-09',
|
|
81
78
|
},
|
|
79
|
+
render: DatePickerStory,
|
|
82
80
|
};
|
|
@@ -5,6 +5,14 @@ declare const meta: {
|
|
|
5
5
|
component: typeof DatePickerInput;
|
|
6
6
|
args: {
|
|
7
7
|
width: "220px";
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: "surfacePrimary sizeM solid rounded";
|
|
10
|
+
dateFormat: string;
|
|
11
|
+
placeholderText: string;
|
|
12
|
+
readOnly: false;
|
|
13
|
+
isClearable: true;
|
|
14
|
+
onKeyDown: (event: import("react").KeyboardEvent<HTMLElement>) => void;
|
|
15
|
+
};
|
|
8
16
|
};
|
|
9
17
|
parameters: {
|
|
10
18
|
layout: string;
|
|
@@ -13,4 +21,4 @@ declare const meta: {
|
|
|
13
21
|
export default meta;
|
|
14
22
|
type Story = StoryObj<typeof meta>;
|
|
15
23
|
export declare const ClearIcon: Story;
|
|
16
|
-
export declare const
|
|
24
|
+
export declare const ClearButton: Story;
|
|
@@ -1,50 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { icons24 } from '@itcase/icons-default';
|
|
2
2
|
import { DatePickerInput } from '../DatePicker';
|
|
3
|
+
import { createDatePickerStory } from './DatePickerStory';
|
|
3
4
|
const meta = {
|
|
4
5
|
title: 'Molecules / DatePicker / Clear',
|
|
5
6
|
component: DatePickerInput,
|
|
6
7
|
args: {
|
|
7
8
|
width: '220px',
|
|
9
|
+
datePickerProps: {
|
|
10
|
+
appearance: 'surfacePrimary sizeM solid rounded',
|
|
11
|
+
dateFormat: 'dd.MM.yyyy',
|
|
12
|
+
placeholderText: 'Выберите дату',
|
|
13
|
+
readOnly: false,
|
|
14
|
+
isClearable: true,
|
|
15
|
+
onKeyDown: (event) => event.preventDefault(),
|
|
16
|
+
},
|
|
8
17
|
},
|
|
9
18
|
parameters: {
|
|
10
19
|
layout: 'centered',
|
|
11
20
|
},
|
|
12
21
|
};
|
|
13
22
|
export default meta;
|
|
23
|
+
const DatePickerStory = createDatePickerStory(meta.args);
|
|
14
24
|
export const ClearIcon = {
|
|
15
25
|
args: {
|
|
16
|
-
datePickerProps: {
|
|
17
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
18
|
-
readOnly: false,
|
|
19
|
-
isClearable: true,
|
|
20
|
-
onKeyDown: (e) => {
|
|
21
|
-
e.preventDefault();
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
26
|
inputProps: {
|
|
25
27
|
appearance: 'defaultPrimary sizeM solid rounded',
|
|
28
|
+
clearIcon: icons24.Action.Clear,
|
|
29
|
+
clearIconAppearance: 'surfaceTertiary size24_24 ghost circular',
|
|
26
30
|
},
|
|
31
|
+
value: '2025-06-15',
|
|
27
32
|
},
|
|
28
|
-
render:
|
|
29
|
-
return _jsx(DatePickerInput, { ...args });
|
|
30
|
-
},
|
|
33
|
+
render: DatePickerStory,
|
|
31
34
|
};
|
|
32
|
-
export const
|
|
35
|
+
export const ClearButton = {
|
|
33
36
|
args: {
|
|
34
37
|
width: '360px',
|
|
35
|
-
datePickerProps: {
|
|
36
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
37
|
-
readOnly: false,
|
|
38
|
-
isClearable: true,
|
|
39
|
-
onKeyDown: (e) => {
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
38
|
inputProps: {
|
|
44
39
|
appearance: 'defaultPrimary sizeM solid rounded',
|
|
40
|
+
clearButton: 'Очистить',
|
|
41
|
+
clearButtonAppearance: 'surfaceSecondary sizeM solid rounded',
|
|
45
42
|
},
|
|
43
|
+
value: '2025-06-15',
|
|
46
44
|
},
|
|
47
|
-
render:
|
|
48
|
-
return _jsx(DatePickerInput, { ...args });
|
|
49
|
-
},
|
|
45
|
+
render: DatePickerStory,
|
|
50
46
|
};
|
|
@@ -5,6 +5,14 @@ declare const meta: {
|
|
|
5
5
|
component: typeof DatePickerInput;
|
|
6
6
|
args: {
|
|
7
7
|
width: "220px";
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: "surfacePrimary sizeM solid rounded";
|
|
10
|
+
dateFormat: string;
|
|
11
|
+
placeholderText: string;
|
|
12
|
+
};
|
|
13
|
+
inputProps: {
|
|
14
|
+
appearance: "defaultPrimary sizeM solid rounded";
|
|
15
|
+
};
|
|
8
16
|
};
|
|
9
17
|
parameters: {
|
|
10
18
|
layout: string;
|
|
@@ -1,52 +1,41 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { DatePickerInput } from '../DatePicker';
|
|
2
|
+
import { createDatePickerStory } from './DatePickerStory';
|
|
3
3
|
const meta = {
|
|
4
4
|
title: 'Molecules / DatePicker / Size',
|
|
5
5
|
component: DatePickerInput,
|
|
6
6
|
args: {
|
|
7
7
|
width: '220px',
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: 'surfacePrimary sizeM solid rounded',
|
|
10
|
+
dateFormat: 'dd.MM.yyyy',
|
|
11
|
+
placeholderText: 'Выберите дату',
|
|
12
|
+
},
|
|
13
|
+
inputProps: {
|
|
14
|
+
appearance: 'defaultPrimary sizeM solid rounded',
|
|
15
|
+
},
|
|
8
16
|
},
|
|
9
17
|
parameters: {
|
|
10
18
|
layout: 'centered',
|
|
11
19
|
},
|
|
12
20
|
};
|
|
13
21
|
export default meta;
|
|
22
|
+
const DatePickerStory = createDatePickerStory(meta.args);
|
|
14
23
|
export const SizeL = {
|
|
15
24
|
args: {
|
|
16
|
-
datePickerProps: {
|
|
17
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
18
|
-
},
|
|
19
25
|
inputProps: {
|
|
20
26
|
appearance: 'defaultPrimary sizeL solid rounded',
|
|
21
27
|
},
|
|
22
28
|
},
|
|
23
|
-
render:
|
|
24
|
-
return _jsx(DatePickerInput, { ...args });
|
|
25
|
-
},
|
|
29
|
+
render: DatePickerStory,
|
|
26
30
|
};
|
|
27
31
|
export const SizeM = {
|
|
28
|
-
|
|
29
|
-
datePickerProps: {
|
|
30
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
31
|
-
},
|
|
32
|
-
inputProps: {
|
|
33
|
-
appearance: 'defaultPrimary sizeM solid rounded',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
render: (args) => {
|
|
37
|
-
return _jsx(DatePickerInput, { ...args });
|
|
38
|
-
},
|
|
32
|
+
render: DatePickerStory,
|
|
39
33
|
};
|
|
40
34
|
export const SizeS = {
|
|
41
35
|
args: {
|
|
42
|
-
datePickerProps: {
|
|
43
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
44
|
-
},
|
|
45
36
|
inputProps: {
|
|
46
37
|
appearance: 'defaultPrimary sizeS solid rounded',
|
|
47
38
|
},
|
|
48
39
|
},
|
|
49
|
-
render:
|
|
50
|
-
return _jsx(DatePickerInput, { ...args });
|
|
51
|
-
},
|
|
40
|
+
render: DatePickerStory,
|
|
52
41
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { DatePickerInput } from '../DatePicker';
|
|
4
|
+
export function createDatePickerStory(defaultArgs = {}) {
|
|
5
|
+
return function DatePickerStory(args) {
|
|
6
|
+
const [dates, setDates] = useState(() => ({
|
|
7
|
+
end: args.endValue ? new Date(args.endValue) : null,
|
|
8
|
+
start: args.value ? new Date(args.value) : null,
|
|
9
|
+
}));
|
|
10
|
+
return (_jsx(DatePickerInput, { ...defaultArgs, ...args, datePickerProps: {
|
|
11
|
+
...defaultArgs.datePickerProps,
|
|
12
|
+
...args.datePickerProps,
|
|
13
|
+
}, endValue: dates.end?.toISOString(), inputProps: {
|
|
14
|
+
...defaultArgs.inputProps,
|
|
15
|
+
...args.inputProps,
|
|
16
|
+
}, value: dates.start?.toISOString(), onChange: (start, end) => setDates({ end, start }) }));
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -5,6 +5,14 @@ declare const meta: {
|
|
|
5
5
|
component: typeof DatePickerInput;
|
|
6
6
|
args: {
|
|
7
7
|
width: "220px";
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: "surfacePrimary sizeM solid rounded";
|
|
10
|
+
dateFormat: string;
|
|
11
|
+
placeholderText: string;
|
|
12
|
+
};
|
|
13
|
+
inputProps: {
|
|
14
|
+
appearance: "defaultPrimary sizeM solid rounded";
|
|
15
|
+
};
|
|
8
16
|
};
|
|
9
17
|
parameters: {
|
|
10
18
|
layout: string;
|
|
@@ -1,65 +1,49 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { DatePickerInput } from '../DatePicker';
|
|
2
|
+
import { createDatePickerStory } from './DatePickerStory';
|
|
3
3
|
const meta = {
|
|
4
4
|
title: 'Molecules / DatePicker / Style',
|
|
5
5
|
component: DatePickerInput,
|
|
6
6
|
args: {
|
|
7
7
|
width: '220px',
|
|
8
|
-
},
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: 'centered',
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
export default meta;
|
|
14
|
-
export const Solid = {
|
|
15
|
-
args: {
|
|
16
8
|
datePickerProps: {
|
|
17
9
|
appearance: 'surfacePrimary sizeM solid rounded',
|
|
10
|
+
dateFormat: 'dd.MM.yyyy',
|
|
11
|
+
placeholderText: 'Выберите дату',
|
|
18
12
|
},
|
|
19
13
|
inputProps: {
|
|
20
14
|
appearance: 'defaultPrimary sizeM solid rounded',
|
|
21
15
|
},
|
|
22
16
|
},
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: 'centered',
|
|
25
19
|
},
|
|
26
20
|
};
|
|
21
|
+
export default meta;
|
|
22
|
+
const DatePickerStory = createDatePickerStory(meta.args);
|
|
23
|
+
export const Solid = {
|
|
24
|
+
render: DatePickerStory,
|
|
25
|
+
};
|
|
27
26
|
export const Outlined = {
|
|
28
27
|
args: {
|
|
29
|
-
datePickerProps: {
|
|
30
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
31
|
-
},
|
|
32
28
|
inputProps: {
|
|
33
29
|
appearance: 'defaultPrimary sizeM outlined rounded',
|
|
34
30
|
},
|
|
35
31
|
},
|
|
36
|
-
render:
|
|
37
|
-
return _jsx(DatePickerInput, { ...args });
|
|
38
|
-
},
|
|
32
|
+
render: DatePickerStory,
|
|
39
33
|
};
|
|
40
34
|
export const Ghost = {
|
|
41
35
|
args: {
|
|
42
|
-
datePickerProps: {
|
|
43
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
44
|
-
},
|
|
45
36
|
inputProps: {
|
|
46
37
|
appearance: 'defaultPrimary sizeM ghost rounded',
|
|
47
38
|
},
|
|
48
39
|
},
|
|
49
|
-
render:
|
|
50
|
-
return _jsx(DatePickerInput, { ...args });
|
|
51
|
-
},
|
|
40
|
+
render: DatePickerStory,
|
|
52
41
|
};
|
|
53
42
|
export const Full = {
|
|
54
43
|
args: {
|
|
55
|
-
datePickerProps: {
|
|
56
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
57
|
-
},
|
|
58
44
|
inputProps: {
|
|
59
45
|
appearance: 'defaultPrimary sizeM full rounded',
|
|
60
46
|
},
|
|
61
47
|
},
|
|
62
|
-
render:
|
|
63
|
-
return _jsx(DatePickerInput, { ...args });
|
|
64
|
-
},
|
|
48
|
+
render: DatePickerStory,
|
|
65
49
|
};
|
|
@@ -5,6 +5,16 @@ declare const meta: {
|
|
|
5
5
|
component: typeof DatePickerInput;
|
|
6
6
|
args: {
|
|
7
7
|
width: "220px";
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: "surfacePrimary sizeM solid rounded";
|
|
10
|
+
customTimeInput: import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
dateFormat: string;
|
|
12
|
+
placeholderText: string;
|
|
13
|
+
showTimeInput: true;
|
|
14
|
+
};
|
|
15
|
+
inputProps: {
|
|
16
|
+
appearance: "defaultPrimary sizeM solid rounded";
|
|
17
|
+
};
|
|
8
18
|
};
|
|
9
19
|
parameters: {
|
|
10
20
|
layout: string;
|
|
@@ -12,6 +22,7 @@ declare const meta: {
|
|
|
12
22
|
};
|
|
13
23
|
export default meta;
|
|
14
24
|
type Story = StoryObj<typeof meta>;
|
|
15
|
-
export declare const
|
|
25
|
+
export declare const Default: Story;
|
|
26
|
+
export declare const WithInitialDate: Story;
|
|
16
27
|
export declare const DateTime: Story;
|
|
17
28
|
export declare const DateRange: Story;
|
|
@@ -1,68 +1,66 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from '../../Button';
|
|
3
3
|
import { DatePickerInput } from '../DatePicker';
|
|
4
|
+
import { createDatePickerStory } from './DatePickerStory';
|
|
4
5
|
const meta = {
|
|
5
6
|
title: 'Molecules / DatePicker / With Button',
|
|
6
7
|
component: DatePickerInput,
|
|
7
8
|
args: {
|
|
8
9
|
width: '220px',
|
|
9
|
-
},
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: 'centered',
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
export default meta;
|
|
15
|
-
export const Date = {
|
|
16
|
-
args: {
|
|
17
10
|
datePickerProps: {
|
|
18
11
|
appearance: 'surfacePrimary sizeM solid rounded',
|
|
19
12
|
customTimeInput: (_jsx(Button, { appearance: "accentPrimary sizeL solid rounded", width: "fill", label: "OK" })),
|
|
20
|
-
dateFormat: 'dd
|
|
13
|
+
dateFormat: 'dd.MM.yyyy',
|
|
14
|
+
placeholderText: 'Выберите дату',
|
|
21
15
|
showTimeInput: true,
|
|
22
16
|
},
|
|
23
17
|
inputProps: {
|
|
24
18
|
appearance: 'defaultPrimary sizeM solid rounded',
|
|
25
19
|
},
|
|
26
20
|
},
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
parameters: {
|
|
22
|
+
layout: 'centered',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export default meta;
|
|
26
|
+
const DatePickerStory = createDatePickerStory(meta.args);
|
|
27
|
+
export const Default = {
|
|
28
|
+
render: DatePickerStory,
|
|
29
|
+
};
|
|
30
|
+
export const WithInitialDate = {
|
|
31
|
+
args: {
|
|
32
|
+
datePickerProps: {
|
|
33
|
+
placeholderText: 'Дата с начальным значением',
|
|
34
|
+
},
|
|
35
|
+
value: '2025-06-15',
|
|
29
36
|
},
|
|
37
|
+
render: DatePickerStory,
|
|
30
38
|
};
|
|
31
39
|
export const DateTime = {
|
|
32
40
|
args: {
|
|
33
41
|
datePickerProps: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
showTimeInput: true,
|
|
42
|
+
dateFormat: 'dd.MM.yyyy HH:mm',
|
|
43
|
+
placeholderText: 'Дата и время',
|
|
44
|
+
popperPlacement: 'bottom',
|
|
38
45
|
showTimeSelect: true,
|
|
39
46
|
timeCaption: 'Время',
|
|
40
|
-
timeFormat: '
|
|
47
|
+
timeFormat: 'HH:mm',
|
|
41
48
|
timeIntervals: 15,
|
|
42
49
|
},
|
|
43
|
-
|
|
44
|
-
appearance: 'defaultPrimary sizeM solid rounded',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
render: (args) => {
|
|
48
|
-
return _jsx(DatePickerInput, { ...args });
|
|
50
|
+
value: '2025-06-15T14:30:00',
|
|
49
51
|
},
|
|
52
|
+
render: DatePickerStory,
|
|
50
53
|
};
|
|
51
54
|
export const DateRange = {
|
|
52
55
|
args: {
|
|
56
|
+
width: '360px',
|
|
53
57
|
datePickerProps: {
|
|
54
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
55
|
-
customTimeInput: (_jsx(Button, { appearance: "accentPrimary sizeL solid rounded", width: "fill", label: "OK", shape: "rounded" })),
|
|
56
58
|
monthsShown: 2,
|
|
57
|
-
placeholderText: '
|
|
59
|
+
placeholderText: 'Начало – конец',
|
|
58
60
|
selectsRange: true,
|
|
59
|
-
showTimeInput: true,
|
|
60
61
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
render: (args) => {
|
|
66
|
-
return _jsx(DatePickerInput, { ...args });
|
|
62
|
+
endValue: '2025-06-20',
|
|
63
|
+
value: '2025-06-01',
|
|
67
64
|
},
|
|
65
|
+
render: DatePickerStory,
|
|
68
66
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/ui-web",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.112",
|
|
4
4
|
"description": "UI components",
|
|
5
5
|
"keywords": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"storybook": "^10.4.0",
|
|
115
115
|
"typescript": "^6.0.3"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "985b7cd49b2f7db7233d288d4561b5af826037f0"
|
|
118
118
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("clsx"),a=require("date-fns/locale"),i=require("react-datepicker"),o=require("@itcase/ui-core/hooks"),l=require("./Button_cjs_CDr9zTdB.js"),c=require("./primitives_cjs_ocTnUpml.js"),n=require("./Input_cjs_D9PxC_lJ.js"),s=require("./Label_cjs_DI2LmDIX.js"),p=require("./default_cjs_BMbs2it-.js");const u={surfacePrimary:{dayTextColor:"surfaceTextPrimary",dayTextShape:"rounded",iconFillHover:"surfaceSecondary",iconItemFill:"surfaceItemPrimary",iconShape:"circular",monthTextColor:"surfaceTextPrimary",monthTextWeight:"400",yearTextColor:"surfaceTextPrimary",yearTextWeight:"400"},...{sizeL:{size:"l",daySize:"xs",dayTextSize:"m",iconFillSize:"24",iconLeft:p.icons14.Arrow.ChevronLeft,iconRight:p.icons14.Arrow.ChevronRight},sizeM:{size:"m",daySize:"xxl",dayTextSize:"m",iconFillSize:"24",iconLeft:p.icons14.Arrow.ChevronLeft,iconRight:p.icons14.Arrow.ChevronRight,iconSize:"14",monthTextSize:"m",yearTextSize:"m"},sizeS:{size:"s",daySize:"xs",dayTextSize:"m",iconFillSize:"24",iconLeft:p.icons14.Arrow.ChevronLeft,iconRight:p.icons14.Arrow.ChevronRight}},solid:{inputProps:{borderColor:"none"}},outlined:{inputProps:{fill:"none"}},full:{},ghost:{inputProps:{fill:"none",borderColor:"none"}}},d=e=>{const t=e.getDay()||7,r=new Date(e);r.setDate(e.getDate()-(t-1));const a=new Date(r);return a.setDate(r.getDate()+6),{mondayDate:r,sundayDate:a}},m={appearance:u,setAppearance:e=>{m.appearance=e}};const x=t.forwardRef((a,i)=>{const{inputIcon:o,inputProps:l,value:c,isClearable:s}=a,p=t.useMemo(()=>{if(c){const e=c.split(" - ");return e[0]===e[1]?e[0]:c}return""},[c]);return e.jsxs(t.Fragment,{children:[e.jsx(n.Input,{...a,...l,className:r(l?.className,"datepicker__input"),ref:i,autocomplete:"off",value:p}),o&&e.jsx(S,{...l}),s&&e.jsx(h,{...l})]})});function h(a){const{clearIcon:i,clearIconFill:o,clearIconFillHover:l,clearIconFillSize:n,clearIconItemFill:p,clearIconItemFillHover:u,clearIconShape:d,clearIconSize:m,clearIconSrc:x,clearLabel:h,clearLabelTextColor:S,clearLabelTextColorHover:C,clearLabelTextSize:f,datepickerRef:y}=a,_=t.useCallback(e=>{y?.current?.onClearClick(e),y?.current?.handleFocus(e)},[]);return e.jsx(t.Fragment,{children:h?e.jsx(s.Label,{className:r("react-datepicker__clear-label","cursor_type_pointer"),label:h,labelTextColor:S,labelTextColorHover:C,labelTextSize:f,onClick:_}):(i||x)&&e.jsx(c.Icon,{className:r("react-datepicker__clear-icon","cursor_type_pointer"),size:m,fill:o,fillHover:l,fillSize:n,iconFill:p,iconFillHover:u,imageSrc:x,shape:d,SvgImage:i,onClick:_})})}function S(t){const{inputIcon:a,inputIconFill:i,inputIconFillHover:o,inputIconFillSize:l,inputIconItemFill:n,inputIconShape:s,inputIconSize:p,inputIconSrc:u,onClick:d}=t;return e.jsx(c.Icon,{className:r("react-datepicker__input-icon","cursor_type_pointer"),size:p,fill:i,fillHover:o,fillSize:l,iconFill:n,imageSrc:u,shape:s,SvgImage:a,onClick:()=>d&&d()})}exports.DatePickerInput=function(n){const{className:s,dataTestId:p,dataTour:u,datePickerProps:h={},endValue:S,inputProps:C={},value:f,onChange:y}=n,{appearance:_,customTimeInput:k,disablePastDays:g,monthsShown:z,selectsRange:I,showWeekNumbers:v,showWeekPicker:T}=h,b=o.useAppearanceConfig(_,m),j=o.useDevicePropsGenerator(h,b),{daySize:F,dayTextColor:D,dayTextShape:P,dayTextSize:w,iconFill:L,iconFillHover:N,iconFillSize:R,iconItemFill:H,iconLeft:q,iconRight:A,iconShape:W,monthTextColor:M,monthTextSize:$,monthTextWeight:B,popper:O,popperPlacement:U,sizeClass:G,widthClass:V,yearTextColor:E,yearTextSize:J,yearTextWeight:K,isClearable:Q}=j,X=t.useRef(null),[Y,Z]=t.useMemo(()=>{let e,t;return f&&(e="string"==typeof f?new Date(f):f),S&&(t="string"==typeof S?new Date(S):S),[e,t]},[f,S]),ee=t.useCallback(e=>{const t=Array.isArray(e)?e:[e],[r,a]=t;if(r&&T){const{mondayDate:e,sundayDate:t}=d(r);y?.(e,t)}else y?.(r,a)},[T,y]),te=t.useCallback(e=>{const{mondayDate:t,sundayDate:r}=d(e);y?.(t,r)},[y]),re=t.useCallback((t,r)=>e.jsx(l.Button,{className:"react-datepicker__day-button",size:F,label:r.getDate().toString(),labelTextColor:D,labelTextSize:w,shape:P}),[F,D,P,w]),ae=t.useCallback(({decreaseMonth:t,increaseMonth:r,monthDate:a})=>e.jsxs("div",{className:"react-datepicker__header--div",children:[q&&e.jsx(c.Icon,{className:"react-datepicker__icon",fill:L,fillHover:N,fillSize:R,iconFill:H,shape:W,SvgImage:q,onClick:t}),e.jsxs("div",{className:"react-datepicker__data",children:[e.jsx(c.Text,{className:"react-datepicker__month",size:$,textColor:M,textWeight:B,children:a.toLocaleString("ru-RU",{month:"long"})}),e.jsx(c.Text,{className:"react-datepicker__year",size:J,textColor:E,textWeight:K,children:a.toLocaleString("ru-RU",{year:"numeric"})})]}),A&&e.jsx(c.Icon,{className:"react-datepicker__icon",fill:L,fillHover:N,fillSize:R,iconFill:H,shape:W,SvgImage:A,onClick:r})]}),[L,N,R,H,q,A,W,M,$,B,E,J,K]),{styles:ie}=o.useStyles(n);return e.jsx("div",{className:r(s,"datepicker",z&&"datepicker_multiple-months",k&&"datepicker_button",G&&`datepicker_size_${G}`,V&&`datepicker_width_${V}`),"data-testid":p,"data-tour":u,style:ie,children:e.jsx(i,{ref:X,...h,minDate:g?new Date:void 0,customInput:e.jsx(x,{datepickerRef:X,inputProps:C,isClearable:Q}),endDate:I?Z:void 0,locale:a.ru,outsideClickIgnoreClass:"react-datepicker-popper",popperClassName:O&&`react-datepicker-popper-${O}`,popperPlacement:U,preventOpenOnFocus:!0,renderCustomHeader:ae,renderDayContents:re,selected:Y,startDate:Y,isClearable:!1,onChange:ee,onWeekSelect:v?te:void 0})})},exports.datePickerAppearance=u,exports.datePickerConfig=m;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import r,{useMemo as a,useCallback as i,useRef as o}from"react";import l from"clsx";import{ru as n}from"date-fns/locale";import c from"react-datepicker";import{useAppearanceConfig as s,useDevicePropsGenerator as p,useStyles as m}from"@itcase/ui-core/hooks";import{B as d}from"./Button_es_M2ryMLoI.js";import{I as u,T as h}from"./primitives_es_BQqNcRQk.js";import{I as f}from"./Input_es_DabuPYuA.js";import{L as S}from"./Label_es_C4QnITZA.js";import{a as y}from"./default_es_CaWUd9iO.js";const _={surfacePrimary:{dayTextColor:"surfaceTextPrimary",dayTextShape:"rounded",iconFillHover:"surfaceSecondary",iconItemFill:"surfaceItemPrimary",iconShape:"circular",monthTextColor:"surfaceTextPrimary",monthTextWeight:"400",yearTextColor:"surfaceTextPrimary",yearTextWeight:"400"},...{sizeL:{size:"l",daySize:"xs",dayTextSize:"m",iconFillSize:"24",iconLeft:y.Arrow.ChevronLeft,iconRight:y.Arrow.ChevronRight},sizeM:{size:"m",daySize:"xxl",dayTextSize:"m",iconFillSize:"24",iconLeft:y.Arrow.ChevronLeft,iconRight:y.Arrow.ChevronRight,iconSize:"14",monthTextSize:"m",yearTextSize:"m"},sizeS:{size:"s",daySize:"xs",dayTextSize:"m",iconFillSize:"24",iconLeft:y.Arrow.ChevronLeft,iconRight:y.Arrow.ChevronRight}},solid:{inputProps:{borderColor:"none"}},outlined:{inputProps:{fill:"none"}},full:{},ghost:{inputProps:{fill:"none",borderColor:"none"}}},x=e=>{const t=e.getDay()||7,r=new Date(e);r.setDate(e.getDate()-(t-1));const a=new Date(r);return a.setDate(r.getDate()+6),{mondayDate:r,sundayDate:a}},C={appearance:_,setAppearance:e=>{C.appearance=e}};function z(r){const{className:f,dataTestId:S,dataTour:y,datePickerProps:_={},endValue:z,inputProps:k={},value:I,onChange:T}=r,{appearance:v,customTimeInput:F,disablePastDays:D,monthsShown:b,selectsRange:w,showWeekNumbers:P,showWeekPicker:L}=_,N=s(v,C),H=p(_,N),{daySize:R,dayTextColor:A,dayTextShape:W,dayTextSize:j,iconFill:M,iconFillHover:$,iconFillSize:B,iconItemFill:O,iconLeft:U,iconRight:V,iconShape:q,monthTextColor:E,monthTextSize:G,monthTextWeight:J,popper:K,popperPlacement:Q,sizeClass:X,widthClass:Y,yearTextColor:Z,yearTextSize:ee,yearTextWeight:te,isClearable:re}=H,ae=o(null),[ie,oe]=a(()=>{let e,t;return I&&(e="string"==typeof I?new Date(I):I),z&&(t="string"==typeof z?new Date(z):z),[e,t]},[I,z]),le=i(e=>{const t=Array.isArray(e)?e:[e],[r,a]=t;if(r&&L){const{mondayDate:e,sundayDate:t}=x(r);T?.(e,t)}else T?.(r,a)},[L,T]),ne=i(e=>{const{mondayDate:t,sundayDate:r}=x(e);T?.(t,r)},[T]),ce=i((e,r)=>t(d,{className:"react-datepicker__day-button",size:R,label:r.getDate().toString(),labelTextColor:A,labelTextSize:j,shape:W}),[R,A,W,j]),se=i(({decreaseMonth:r,increaseMonth:a,monthDate:i})=>e("div",{className:"react-datepicker__header--div",children:[U&&t(u,{className:"react-datepicker__icon",fill:M,fillHover:$,fillSize:B,iconFill:O,shape:q,SvgImage:U,onClick:r}),e("div",{className:"react-datepicker__data",children:[t(h,{className:"react-datepicker__month",size:G,textColor:E,textWeight:J,children:i.toLocaleString("ru-RU",{month:"long"})}),t(h,{className:"react-datepicker__year",size:ee,textColor:Z,textWeight:te,children:i.toLocaleString("ru-RU",{year:"numeric"})})]}),V&&t(u,{className:"react-datepicker__icon",fill:M,fillHover:$,fillSize:B,iconFill:O,shape:q,SvgImage:V,onClick:a})]}),[M,$,B,O,U,V,q,E,G,J,Z,ee,te]),{styles:pe}=m(r);return t("div",{className:l(f,"datepicker",b&&"datepicker_multiple-months",F&&"datepicker_button",X&&`datepicker_size_${X}`,Y&&`datepicker_width_${Y}`),"data-testid":S,"data-tour":y,style:pe,children:t(c,{ref:ae,..._,minDate:D?new Date:void 0,customInput:t(g,{datepickerRef:ae,inputProps:k,isClearable:re}),endDate:w?oe:void 0,locale:n,outsideClickIgnoreClass:"react-datepicker-popper",popperClassName:K&&`react-datepicker-popper-${K}`,popperPlacement:Q,preventOpenOnFocus:!0,renderCustomHeader:se,renderDayContents:ce,selected:ie,startDate:ie,isClearable:!1,onChange:le,onWeekSelect:P?ne:void 0})})}const g=r.forwardRef((i,o)=>{const{inputIcon:n,inputProps:c,value:s,isClearable:p}=i,m=a(()=>{if(s){const e=s.split(" - ");return e[0]===e[1]?e[0]:s}return""},[s]);return e(r.Fragment,{children:[t(f,{...i,...c,className:l(c?.className,"datepicker__input"),ref:o,autocomplete:"off",value:m}),n&&t(I,{...c}),p&&t(k,{...c})]})});function k(e){const{clearIcon:a,clearIconFill:o,clearIconFillHover:n,clearIconFillSize:c,clearIconItemFill:s,clearIconItemFillHover:p,clearIconShape:m,clearIconSize:d,clearIconSrc:h,clearLabel:f,clearLabelTextColor:y,clearLabelTextColorHover:_,clearLabelTextSize:x,datepickerRef:C}=e,z=i(e=>{C?.current?.onClearClick(e),C?.current?.handleFocus(e)},[]);return t(r.Fragment,{children:f?t(S,{className:l("react-datepicker__clear-label","cursor_type_pointer"),label:f,labelTextColor:y,labelTextColorHover:_,labelTextSize:x,onClick:z}):(a||h)&&t(u,{className:l("react-datepicker__clear-icon","cursor_type_pointer"),size:d,fill:o,fillHover:n,fillSize:c,iconFill:s,iconFillHover:p,imageSrc:h,shape:m,SvgImage:a,onClick:z})})}function I(e){const{inputIcon:r,inputIconFill:a,inputIconFillHover:i,inputIconFillSize:o,inputIconItemFill:n,inputIconShape:c,inputIconSize:s,inputIconSrc:p,onClick:m}=e;return t(u,{className:l("react-datepicker__input-icon","cursor_type_pointer"),size:s,fill:a,fillHover:i,fillSize:o,iconFill:n,imageSrc:p,shape:c,SvgImage:r,onClick:()=>m&&m()})}export{z as D,C as a,_ as d};
|