@corva/ui 3.75.0-16 → 3.75.0-17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/cjs-bundle/componentsV2/Autocomplete/Autocomplete.js +1 -1
  2. package/cjs-bundle/componentsV2/Autocomplete/Autocomplete.js.map +1 -1
  3. package/cjs-bundle/componentsV2/DatePicker/CalendarControls/CalendarControls.js +1 -1
  4. package/cjs-bundle/componentsV2/DatePicker/CalendarControls/CalendarControls.js.map +1 -1
  5. package/cjs-bundle/componentsV2/DatePicker/CalendarControls/CalendarControls.scss.js +1 -1
  6. package/cjs-bundle/componentsV2/DatePicker/CalendarGrid/CalendarGrid.js +1 -1
  7. package/cjs-bundle/componentsV2/DatePicker/CalendarGrid/CalendarGrid.js.map +1 -1
  8. package/cjs-bundle/componentsV2/DatePicker/CalendarGrid/CalendarGrid.scss.js +1 -1
  9. package/cjs-bundle/componentsV2/DatePicker/DatePicker.js +1 -1
  10. package/cjs-bundle/componentsV2/DatePicker/DatePicker.js.map +1 -1
  11. package/cjs-bundle/componentsV2/DatePicker/DatePicker.scss.js +1 -1
  12. package/cjs-bundle/componentsV2/DatePicker/Input/Input.js +1 -1
  13. package/cjs-bundle/componentsV2/DatePicker/Input/Input.js.map +1 -1
  14. package/cjs-bundle/componentsV2/DatePicker/Input/Input.scss.js +2 -0
  15. package/cjs-bundle/componentsV2/DatePicker/Input/Input.scss.js.map +1 -0
  16. package/cjs-bundle/componentsV2/DatePicker/TimePicker/TimePicker.js +1 -1
  17. package/cjs-bundle/componentsV2/DatePicker/TimePicker/TimePicker.js.map +1 -1
  18. package/cjs-bundle/componentsV2/DatePicker/TimePicker/TimePicker.scss.js +1 -1
  19. package/cjs-bundle/componentsV2/DatePicker/utils.js +1 -1
  20. package/cjs-bundle/componentsV2/DatePicker/utils.js.map +1 -1
  21. package/cjs-bundle/componentsV2/Popover/Popover.js +1 -1
  22. package/cjs-bundle/componentsV2/Popover/Popover.js.map +1 -1
  23. package/cjs-bundle/componentsV2/ToggleButtons/ToggleButtons.scss.js +1 -1
  24. package/components/Drillstring/BHAComponentDetail/constants.d.ts +2 -2
  25. package/componentsV2/Autocomplete/Autocomplete.d.ts.map +1 -1
  26. package/componentsV2/Autocomplete/Autocomplete.js +1 -1
  27. package/componentsV2/Autocomplete/Autocomplete.js.map +1 -1
  28. package/componentsV2/DatePicker/CalendarControls/CalendarControls.d.ts.map +1 -1
  29. package/componentsV2/DatePicker/CalendarControls/CalendarControls.js +1 -1
  30. package/componentsV2/DatePicker/CalendarControls/CalendarControls.js.map +1 -1
  31. package/componentsV2/DatePicker/CalendarControls/CalendarControls.scss.js +1 -1
  32. package/componentsV2/DatePicker/CalendarGrid/CalendarGrid.js +1 -1
  33. package/componentsV2/DatePicker/CalendarGrid/CalendarGrid.js.map +1 -1
  34. package/componentsV2/DatePicker/CalendarGrid/CalendarGrid.scss.js +1 -1
  35. package/componentsV2/DatePicker/DatePicker.d.ts +4 -1
  36. package/componentsV2/DatePicker/DatePicker.d.ts.map +1 -1
  37. package/componentsV2/DatePicker/DatePicker.js +1 -1
  38. package/componentsV2/DatePicker/DatePicker.js.map +1 -1
  39. package/componentsV2/DatePicker/DatePicker.scss.js +1 -1
  40. package/componentsV2/DatePicker/Input/Input.d.ts +4 -2
  41. package/componentsV2/DatePicker/Input/Input.d.ts.map +1 -1
  42. package/componentsV2/DatePicker/Input/Input.js +1 -1
  43. package/componentsV2/DatePicker/Input/Input.js.map +1 -1
  44. package/componentsV2/DatePicker/Input/Input.scss.js +2 -0
  45. package/componentsV2/DatePicker/Input/Input.scss.js.map +1 -0
  46. package/componentsV2/DatePicker/TimePicker/TimePicker.d.ts +7 -5
  47. package/componentsV2/DatePicker/TimePicker/TimePicker.d.ts.map +1 -1
  48. package/componentsV2/DatePicker/TimePicker/TimePicker.js +1 -1
  49. package/componentsV2/DatePicker/TimePicker/TimePicker.js.map +1 -1
  50. package/componentsV2/DatePicker/TimePicker/TimePicker.scss.js +1 -1
  51. package/componentsV2/DatePicker/utils.d.ts +2 -2
  52. package/componentsV2/DatePicker/utils.d.ts.map +1 -1
  53. package/componentsV2/DatePicker/utils.js +1 -1
  54. package/componentsV2/DatePicker/utils.js.map +1 -1
  55. package/componentsV2/Popover/Popover.d.ts +1 -0
  56. package/componentsV2/Popover/Popover.d.ts.map +1 -1
  57. package/componentsV2/Popover/Popover.js +1 -1
  58. package/componentsV2/Popover/Popover.js.map +1 -1
  59. package/componentsV2/ToggleButtons/ToggleButtons.scss.js +1 -1
  60. package/mcp-server/server.mjs +7 -2
  61. package/package.json +1 -1
  62. package/tsconfig.tsbuildinfo +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')('.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM{margin:0;position:relative;transition:color .15s cubic-bezier(.4,0,.2,1),background .15s cubic-bezier(.4,0,.2,1)}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_primary__HxWEN:not(.Mui-selected):focus,.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_primary__HxWEN:not(.Mui-selected):hover{background:rgb(from var(--palette-primary-text-1) r g b/.12);color:var(--palette-primary-text-1)}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_secondary__Eq-fq{background:rgb(from var(--palette-primary-text-1) r g b/.08);font-weight:400;margin-left:1px}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_secondary__Eq-fq:not(:first-child):before{background:rgb(from var(--palette-primary-text-1) r g b/.12);content:"";inset:0 100% 0 -1px;position:absolute}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_secondary__Eq-fq.Mui-selected{background:rgb(from var(--palette-primary-text-1) r g b/.16);color:var(--palette-primary-text-1)}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_secondary__Eq-fq:not(.Mui-selected):focus,.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_secondary__Eq-fq:not(.Mui-selected):hover{background:rgb(from var(--palette-primary-text-1) r g b/.12);color:var(--palette-primary-text-1)}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06.ToggleButtons_large__-jjVa .ToggleButtons_button__GH4OM{font-size:16px}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06.ToggleButtons_medium__Q-HsC .ToggleButtons_button__GH4OM,.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06.ToggleButtons_small__2Xhd- .ToggleButtons_button__GH4OM{font-size:14px}'),module.exports={spacing:"8",root:"ToggleButtons_root__aQl06",button:"ToggleButtons_button__GH4OM",primary:"ToggleButtons_primary__HxWEN",secondary:"ToggleButtons_secondary__Eq-fq",large:"ToggleButtons_large__-jjVa",medium:"ToggleButtons_medium__Q-HsC",small:"ToggleButtons_small__2Xhd-"};
1
+ "use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')('.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM{margin:0;position:relative;transition:color .15s cubic-bezier(.4,0,.2,1),background .15s cubic-bezier(.4,0,.2,1)}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.Mui-disabled{background:rgb(from var(--palette-primary-text-1) r g b/.08)!important;color:var(--palette-primary-text-6)!important;pointer-events:none}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_primary__HxWEN:not(.Mui-selected):focus,.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_primary__HxWEN:not(.Mui-selected):hover{background:rgb(from var(--palette-primary-text-1) r g b/.12);color:var(--palette-primary-text-1)}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_secondary__Eq-fq{background:rgb(from var(--palette-primary-text-1) r g b/.08);font-weight:400;margin-left:1px}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_secondary__Eq-fq:not(:first-child):before{background:rgb(from var(--palette-primary-text-1) r g b/.12);content:"";inset:0 100% 0 -1px;position:absolute}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_secondary__Eq-fq.Mui-selected{background:rgb(from var(--palette-primary-text-1) r g b/.16);color:var(--palette-primary-text-1)}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_secondary__Eq-fq:not(.Mui-selected):focus,.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06 .ToggleButtons_button__GH4OM.ToggleButtons_secondary__Eq-fq:not(.Mui-selected):hover{background:rgb(from var(--palette-primary-text-1) r g b/.12);color:var(--palette-primary-text-1)}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06.ToggleButtons_large__-jjVa .ToggleButtons_button__GH4OM{font-size:16px}.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06.ToggleButtons_medium__Q-HsC .ToggleButtons_button__GH4OM,.ToggleButtons_root__aQl06.ToggleButtons_root__aQl06.ToggleButtons_small__2Xhd- .ToggleButtons_button__GH4OM{font-size:14px}'),module.exports={spacing:"8",root:"ToggleButtons_root__aQl06",button:"ToggleButtons_button__GH4OM",primary:"ToggleButtons_primary__HxWEN",secondary:"ToggleButtons_secondary__Eq-fq",large:"ToggleButtons_large__-jjVa",medium:"ToggleButtons_medium__Q-HsC",small:"ToggleButtons_small__2Xhd-"};
2
2
  //# sourceMappingURL=ToggleButtons.scss.js.map
@@ -106,10 +106,10 @@ export declare const BHA_COMPONENT_TYPES: ({
106
106
  })[];
107
107
  })[];
108
108
  export declare const BHA_GENERAL_FIELD_TYPES: ({
109
- unit?: undefined;
110
109
  name: string;
111
110
  label: string;
112
111
  cond?: undefined;
112
+ unit?: undefined;
113
113
  col_size?: undefined;
114
114
  family?: undefined;
115
115
  } | {
@@ -134,8 +134,8 @@ export declare const BHA_GENERAL_FIELD_TYPES: ({
134
134
  col_size: number;
135
135
  family?: undefined;
136
136
  } | {
137
- unit?: undefined;
138
137
  cond?: undefined;
138
+ unit?: undefined;
139
139
  name: string;
140
140
  label: string;
141
141
  col_size: number;
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../src/componentsV2/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,IAAI,2BAA2B,EAEvD,6BAA6B,EAG9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,WAAW,EACX,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,SAAS,EAIV,MAAM,OAAO,CAAC;AAGf,OAAO,EAAU,WAAW,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,EAEL,kBAAkB,EAQnB,MAAM,SAAS,CAAC;AAWjB,KAAK,YAAY,GACb,2BAA2B,GAC3B,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,CAAC;AACzB,KAAK,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC;AAEnF,KAAK,qBAAqB,CACxB,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,EACjD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,KAAK,IAC1C;IACF;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,E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SAAS,GAAG,KAAK,IAC1C,QAAQ,CAAC,qBAAqB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;AA2WlE;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAC3B,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,EACjD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,KAAK,IAC1C,IAAI,CACN,qBAAqB,CAAC,CAAC,EAAE,QAAQ,CAAC,EAClC,MAAM,GAAG,gBAAgB,GAAG,oBAAoB,GAAG,gBAAgB,GAAG,QAAQ,CAC/E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,CAAC,SAAS,kBAAkB,EAC5B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,KAAK,SAErC,iBAAiB,CAAC,CAAC,EAAE,QAAQ,CAAC,4CACwB,CAAC;AAGhE,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,EACjD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,KAAK,IAC1C,IAAI,CAAC,qBAAqB,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC,CAAC;yCAG1E,CAAC,SAAS,kBAAkB,EAC5B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,KAAK,EAE5C,KAAK,EAAE,qBAAqB,CAAC,CAAC,EAAE,QAAQ,CAAC;;;;;sBA1bV,iBAAiB;;0BACrB,OAAO;;cAC7B,SAAS"}
@@ -1,2 +1,2 @@
1
- import o from"@babel/runtime/helpers/defineProperty";import s from"@babel/runtime/helpers/toConsumableArray";import n from"@babel/runtime/helpers/typeof";import i from"@babel/runtime/helpers/slicedToArray";import{createFilterOptions as t,Autocomplete as c}from"@material-ui/lab";import{useState as e,useMemo as r,useCallback as m}from"react";import l from"classnames";import{Popper as p}from"../Popper/Popper.js";import{DownIcon as u,CloseSmallIcon as a}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/DragOne.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/SearchOne.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/InfoRounded.js";import"../../icons/customIcons/icons/FlameFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../../icons/customIcons/icons/Pad.js";import"../../icons/customIcons/icons/DrilloutUnit.js";import"../../icons/customIcons/icons/FracFleet.js";import"../../icons/customIcons/icons/Global.js";import"../../icons/customIcons/icons/Program.js";import"../../icons/customIcons/icons/Rig.js";import"../../icons/customIcons/icons/Well.js";import"../../icons/customIcons/icons/Gap.js";import"../../icons/customIcons/icons/Pin.js";import"../../icons/customIcons/icons/CloseOneFilled.js";import"../../icons/customIcons/icons/AttentionFilled.js";import"../../icons/customIcons/icons/CheckOneFilled.js";import"../../icons/customIcons/icons/Archive.js";import"../../icons/customIcons/icons/ArchiveCancel.js";import"../../icons/customIcons/icons/Unarchive.js";import"../../icons/customIcons/icons/Archived.js";import"../../icons/customIcons/icons/InterventionUnit.js";import"../../icons/customIcons/icons/CloudDelete.js";import"../../icons/customIcons/icons/Lasso.js";import"../../icons/customIcons/icons/Radius.js";import"../../icons/customIcons/icons/ErrorOps.js";import"../../icons/customIcons/icons/DataTypeOps.js";import"../../icons/customIcons/icons/FalsePositiveOps.js";import"../../icons/customIcons/icons/CalibrationOps.js";import"../../icons/customIcons/icons/CriticalOps.js";import"../../icons/customIcons/icons/Company.js";import"../../icons/customIcons/icons/ArchiveOne.js";import"../../icons/customIcons/icons/ParseBotFusion.js";import"../../icons/customIcons/icons/Connect.js";import"../../icons/customIcons/icons/PuzzleOne.js";import"../../icons/customIcons/icons/Feed.js";import"../../icons/customIcons/icons/Prompt.js";import"../../icons/customIcons/icons/Companies.js";import"../../icons/customIcons/icons/ClipboardAi.js";import"../../icons/customIcons/icons/Key.js";import"../../icons/customIcons/icons/AtSignCrossed.js";import"../../icons/customIcons/icons/MappingManual.js";import"../../icons/customIcons/icons/Mapping.js";import"../../icons/customIcons/icons/Metrics.js";import"../../icons/customIcons/icons/Drops.js";import"../../icons/customIcons/icons/ClipboardSearch.js";import"../../icons/customIcons/icons/Template.js";import"../../icons/customIcons/icons/ClipboardMetrics.js";import"../../icons/customIcons/icons/ClipboardBuilder.js";import"../../icons/customIcons/icons/UnitConversion.js";import"../../icons/customIcons/icons/NPT.js";import"../../icons/customIcons/icons/GuidedFrac.js";import{AutocompleteInput as d}from"./AutocompleteInput/AutocompleteInput.js";import{AutocompletePaper as j}from"./AutocompletePaper.js";import{renderSelectedValue as f,renderSelectedValueChips as I,isRealOption as b,CreateOptionMark as O,AllOptionMark as h,renderOptionDefault as g}from"./utils.js";import{AutocompleteMenuItem as v}from"./AutocompleteMenuItem.js";import{AutocompleteListBox as C}from"./AutocompleteListBox.js";import y from"./Autocomplete.scss.js";import{Menu as A}from"../Menu/Menu.js";import{jsx as P,jsxs as x}from"react/jsx-runtime";function F(o,s){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(o);s&&(i=i.filter((function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable}))),n.push.apply(n,i)}return n}function D(s){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?F(Object(i),!0).forEach((function(n){o(s,n,i[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(i)):F(Object(i)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(i,o))}))}return s}var w=function(I){var F=I.label,w=I.options,M=void 0===w?[]:w,N=I.value,S=I.onChange,z=I.multiple,T=I.renderOption,k=void 0===T?g:T,B=I.optionSize,R=void 0===B?"medium":B,E=I.showPopupIcon,G=void 0===E||E,L=I.clearable,V=void 0===L||L,U=I.loading,q=I.noOptionsMessage,W=I.filterOptions,K=I.prefix,Z=I.disabled,H=I.getOptionDisabled,J=I.renderSelected,Q=void 0===J?f:J,X=I.onInputChange,Y=I.className,$=I.testId,_=I.status,oo=I.message,so=I.useAllOption,no=void 0!==so&&so,io=I.useOnlyOptionButton,to=void 0!==io&&io,co=I.groupBy,eo=I.renderGroup,ro=I.disableFiltering,mo=I.onCreate,lo=I.dropdownClassName,po=I.popperProps,uo=I.placeholder,ao=I.focusOnClear,jo=void 0===ao||ao,fo=I.listboxComponent,Io=I.size,bo=void 0===Io?"small":Io,Oo=I.labelPlacement,ho=void 0===Oo?"top":Oo,go=I.elementsClassNames,vo=I.htmlAttributes,Co=I.type,yo=I.spacing,Ao=I.isNext,Po=e(""),xo=i(Po,2),Fo=xo[0],Do=xo[1],wo=r((function(){if(void 0===N||N instanceof Array&&0===N.length)return z?[]:null;var o=N instanceof Array?N:[N];if(z){var i=o.filter((function(o){return"object"!==n(o)})),t=o.filter((function(o){return"object"===n(o)})).map((function(o){return{id:o.id,title:o.title}})),c=M.filter((function(o){return i.includes(o.id)}));return[].concat(s(c),s(t))}return"object"===n(o[0])?o[0]:M.find((function(s){return o[0]===s.id}))||null}),[z,N,M]),Mo=wo instanceof Array&&wo.length>0,No=wo instanceof Array&&wo.length===M.length,So=U?"Loading ...":"No options",zo=!V||!wo||wo instanceof Array&&!(null!=wo&&wo.length),To=m((function(o){return P(d,D(D({},o),{},{label:F,loading:U,prefix:K,status:_,message:oo,readOnly:ro,placeholder:uo,size:bo,labelPlacement:ho,elementsClassNames:go,htmlAttributes:vo,type:Co,spacing:yo,isNext:Ao}))}),[F,U,K,_,oo,ro,uo,bo,ho,go,vo,Co,yo,Ao]),ko=m((function(o,s,n){if("clear"!==n||jo||(o.stopPropagation(),o.preventDefault()),mo&&s){var i=(s instanceof Array?s:[s]).find((function(o){return!b(o)&&!!o[O]}));if(i)return void mo(i.newOptionTitle||"")}if(z&&s instanceof Array&&s.some((function(o){return!b(o)&&!!o[h]})))return void(wo instanceof Array&&wo.length<M.length?null==S||S(M.filter(b),n,o):null==S||S([],n,o));null==S||S(s||void 0,n,o)}),[jo,mo,z,S,wo,M]),Bo=m((function(o,s){return null==S?void 0:S([o],"select-only-option",s)}),[S]),Ro=m((function(o,s){var n=s.selected;return b(o)?P(v,{size:R,selected:n,prefix:o.prefix,multiple:z,useOnlyButton:to,option:o,onSelectOnly:Bo,children:k(o)}):o[h]?x("div",{className:y.allOptionContainer,children:[P(v,{size:R,selected:Mo,indeterminate:Mo&&!No,multiple:!0,children:o.title}),P(A.Divider,{className:y.allOptionDivider})]}):P(v,{size:R,selected:Mo,children:o.title})}),[R,z,to,Bo,k,Mo,No]),Eo=m((function(n,i){var c,e=W?W(n,i.inputValue):t()(n,i),r=no&&z&&e.length&&n.length>1?[o({title:"All"},h,!0)].concat(s(e)):e;return mo&&""!==i.inputValue.trim()?[].concat(s(r),[(c={title:'Add "'.concat(i.inputValue,'"')},o(c,O,!0),o(c,"newOptionTitle",i.inputValue),c)]):r}),[W,mo,no,z]),Go=m((function(o){return b(o)&&!(null==H||!H(o))}),[H]),Lo=m((function(o){return o.title}),[]),Vo=m((function(o,s){var n=o.filter(b).map((function(o,n){return{option:o,onDelete:s({index:n}).onDelete}}));return Q(n,{useAllOption:no,allOptions:M})}),[Q,no,M]),Uo=m((function(o,s,n){o&&"blur"===o.type?Do(""):"reset"!==n&&Do(s),"reset"!==n&&(null==X||X(s,o))}),[X]),qo=r((function(){if(co)return function(o){return b(o)?co(o):""}}),[co]),Wo=r((function(){return{paper:lo}}),[lo]),Ko=m((function(o,s){return!(!b(o)||!b(s))&&o.id===s.id}),[]),Zo=c,Ho=m((function(o){return P(p,D(D({},o),po))}),[po]);return P("div",{className:l(y.root,G&&y.withArrow,!zo&&y.withClear,Y),"data-testid":$,children:P(Zo,{value:wo,options:M,getOptionLabel:Lo,renderInput:To,PopperComponent:Ho,PaperComponent:j,multiple:z,disableCloseOnSelect:z,blurOnSelect:!z,onChange:ko,renderOption:Ro,popupIcon:P(u,{size:16}),forcePopupIcon:!!G,closeIcon:P(a,{size:16}),disableClearable:zo,clearText:"",noOptionsText:q||So,filterOptions:Eo,disabled:Z,getOptionDisabled:Go,renderTags:Vo,inputValue:z?Fo:void 0,onInputChange:Uo,groupBy:qo,renderGroup:eo,clearOnBlur:!0,selectOnFocus:!ro,classes:Wo,getOptionSelected:Ko,ListboxComponent:null!=fo?fo:C})})},M=function(o){return w(D(D({},o),{},{isNext:!1}))},N=function(o){return w(D(D({},o),{},{isNext:!0}))};N.selectedValueRenderers={default:f,chipsMultiline:I};export{M as Autocomplete,N as AutocompleteNext};
1
+ import o from"@babel/runtime/helpers/defineProperty";import s from"@babel/runtime/helpers/toConsumableArray";import n from"@babel/runtime/helpers/typeof";import i from"@babel/runtime/helpers/slicedToArray";import{createFilterOptions as t,Autocomplete as c}from"@material-ui/lab";import{useState as e,useMemo as r,useCallback as l}from"react";import m from"classnames";import{Popper as p}from"../Popper/Popper.js";import{DownIcon as u,CloseSmallIcon as a}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/DragOne.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/SearchOne.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/InfoRounded.js";import"../../icons/customIcons/icons/FlameFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../../icons/customIcons/icons/Pad.js";import"../../icons/customIcons/icons/DrilloutUnit.js";import"../../icons/customIcons/icons/FracFleet.js";import"../../icons/customIcons/icons/Global.js";import"../../icons/customIcons/icons/Program.js";import"../../icons/customIcons/icons/Rig.js";import"../../icons/customIcons/icons/Well.js";import"../../icons/customIcons/icons/Gap.js";import"../../icons/customIcons/icons/Pin.js";import"../../icons/customIcons/icons/CloseOneFilled.js";import"../../icons/customIcons/icons/AttentionFilled.js";import"../../icons/customIcons/icons/CheckOneFilled.js";import"../../icons/customIcons/icons/Archive.js";import"../../icons/customIcons/icons/ArchiveCancel.js";import"../../icons/customIcons/icons/Unarchive.js";import"../../icons/customIcons/icons/Archived.js";import"../../icons/customIcons/icons/InterventionUnit.js";import"../../icons/customIcons/icons/CloudDelete.js";import"../../icons/customIcons/icons/Lasso.js";import"../../icons/customIcons/icons/Radius.js";import"../../icons/customIcons/icons/ErrorOps.js";import"../../icons/customIcons/icons/DataTypeOps.js";import"../../icons/customIcons/icons/FalsePositiveOps.js";import"../../icons/customIcons/icons/CalibrationOps.js";import"../../icons/customIcons/icons/CriticalOps.js";import"../../icons/customIcons/icons/Company.js";import"../../icons/customIcons/icons/ArchiveOne.js";import"../../icons/customIcons/icons/ParseBotFusion.js";import"../../icons/customIcons/icons/Connect.js";import"../../icons/customIcons/icons/PuzzleOne.js";import"../../icons/customIcons/icons/Feed.js";import"../../icons/customIcons/icons/Prompt.js";import"../../icons/customIcons/icons/Companies.js";import"../../icons/customIcons/icons/ClipboardAi.js";import"../../icons/customIcons/icons/Key.js";import"../../icons/customIcons/icons/AtSignCrossed.js";import"../../icons/customIcons/icons/MappingManual.js";import"../../icons/customIcons/icons/Mapping.js";import"../../icons/customIcons/icons/Metrics.js";import"../../icons/customIcons/icons/Drops.js";import"../../icons/customIcons/icons/ClipboardSearch.js";import"../../icons/customIcons/icons/Template.js";import"../../icons/customIcons/icons/ClipboardMetrics.js";import"../../icons/customIcons/icons/ClipboardBuilder.js";import"../../icons/customIcons/icons/UnitConversion.js";import"../../icons/customIcons/icons/NPT.js";import"../../icons/customIcons/icons/GuidedFrac.js";import{AutocompleteInput as d}from"./AutocompleteInput/AutocompleteInput.js";import{AutocompletePaper as j}from"./AutocompletePaper.js";import{renderSelectedValue as f,renderSelectedValueChips as I,isRealOption as b,CreateOptionMark as O,AllOptionMark as h,renderOptionDefault as v}from"./utils.js";import{AutocompleteMenuItem as g}from"./AutocompleteMenuItem.js";import{AutocompleteListBox as C}from"./AutocompleteListBox.js";import y from"./Autocomplete.scss.js";import{Menu as A}from"../Menu/Menu.js";import{jsx as P,jsxs as x}from"react/jsx-runtime";function F(o,s){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(o);s&&(i=i.filter((function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable}))),n.push.apply(n,i)}return n}function D(s){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?F(Object(i),!0).forEach((function(n){o(s,n,i[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(i)):F(Object(i)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(i,o))}))}return s}var N=function(I){var F=I.label,N=I.options,w=void 0===N?[]:N,M=I.value,S=I.onChange,z=I.multiple,T=I.renderOption,k=void 0===T?v:T,B=I.optionSize,R=void 0===B?"medium":B,E=I.showPopupIcon,G=void 0===E||E,L=I.clearable,V=void 0===L||L,U=I.loading,q=I.noOptionsMessage,W=I.filterOptions,K=I.prefix,Z=I.disabled,H=I.getOptionDisabled,J=I.renderSelected,Q=void 0===J?f:J,X=I.onInputChange,Y=I.className,$=I.testId,_=I.status,oo=I.message,so=I.useAllOption,no=void 0!==so&&so,io=I.useOnlyOptionButton,to=void 0!==io&&io,co=I.groupBy,eo=I.renderGroup,ro=I.disableFiltering,lo=I.onCreate,mo=I.dropdownClassName,po=I.popperProps,uo=I.placeholder,ao=I.focusOnClear,jo=void 0===ao||ao,fo=I.listboxComponent,Io=I.size,bo=void 0===Io?"small":Io,Oo=I.labelPlacement,ho=void 0===Oo?"top":Oo,vo=I.elementsClassNames,go=I.htmlAttributes,Co=I.type,yo=I.spacing,Ao=I.isNext,Po=e(""),xo=i(Po,2),Fo=xo[0],Do=xo[1],No=r((function(){if(void 0===M||M instanceof Array&&0===M.length)return z?[]:null;var o=M instanceof Array?M:[M];if(z){var i=o.filter((function(o){return"object"!==n(o)})),t=o.filter((function(o){return"object"===n(o)})).map((function(o){return{id:o.id,title:o.title}})),c=w.filter((function(o){return i.includes(o.id)}));return[].concat(s(c),s(t))}return"object"===n(o[0])?o[0]:w.find((function(s){return o[0]===s.id}))||null}),[z,M,w]),wo=No instanceof Array&&No.length>0,Mo=No instanceof Array&&No.length===w.length,So=U?"Loading ...":"No options",zo=!V||!No||No instanceof Array&&!(null!=No&&No.length),To=l((function(o){return P(d,D(D({},o),{},{label:F,loading:U,prefix:K,status:_,message:oo,readOnly:ro,placeholder:uo,size:bo,labelPlacement:ho,elementsClassNames:vo,htmlAttributes:go,type:Co,spacing:yo,isNext:Ao}))}),[F,U,K,_,oo,ro,uo,bo,ho,vo,go,Co,yo,Ao]),ko=l((function(o,s,n){if("clear"!==n||jo||(o.stopPropagation(),o.preventDefault()),lo&&s){var i=(s instanceof Array?s:[s]).find((function(o){return!b(o)&&!!o[O]}));if(i)return void lo(i.newOptionTitle||"")}if(z&&s instanceof Array&&s.some((function(o){return!b(o)&&!!o[h]})))return void(No instanceof Array&&No.length<w.length?null==S||S(w.filter(b),n,o):null==S||S([],n,o));null==S||S(s||void 0,n,o)}),[jo,lo,z,S,No,w]),Bo=l((function(o,s){return null==S?void 0:S([o],"select-only-option",s)}),[S]),Ro=l((function(o,s){var n=s.selected;return b(o)?P(g,{size:R,selected:n,prefix:o.prefix,multiple:z,useOnlyButton:to,option:o,onSelectOnly:Bo,children:k(o)}):o[h]?x("div",{className:y.allOptionContainer,children:[P(g,{size:R,selected:wo,indeterminate:wo&&!Mo,multiple:!0,children:o.title}),P(A.Divider,{className:y.allOptionDivider})]}):P(g,{size:R,selected:wo,children:o.title})}),[R,z,to,Bo,k,wo,Mo]),Eo=l((function(n,i){var c,e=W?W(n,i.inputValue):t()(n,i),r=no&&z&&e.length&&n.length>1?[o({title:"All"},h,!0)].concat(s(e)):e;return lo&&""!==i.inputValue.trim()?[].concat(s(r),[(c={title:'Add "'.concat(i.inputValue,'"')},o(c,O,!0),o(c,"newOptionTitle",i.inputValue),c)]):r}),[W,lo,no,z]),Go=l((function(o){return b(o)&&!(null==H||!H(o))}),[H]),Lo=l((function(o){return o.title}),[]),Vo=l((function(o,s){var n=o.filter(b).map((function(o,n){return{option:o,onDelete:s({index:n}).onDelete}}));return Q(n,{useAllOption:no,allOptions:w})}),[Q,no,w]),Uo=l((function(o,s,n){o&&"blur"===o.type?Do(""):"reset"!==n&&Do(s),"reset"!==n&&(null==X||X(s,o))}),[X]),qo=r((function(){if(co)return function(o){return b(o)?co(o):""}}),[co]),Wo=r((function(){return{paper:mo}}),[mo]),Ko=l((function(o,s){return!(!b(o)||!b(s))&&o.id===s.id}),[]),Zo=c,Ho=l((function(o){return P(p,D(D(D({},o),po),{},{className:m(null==o?void 0:o.className,null==po?void 0:po.className)}))}),[po]);return P("div",{className:m(y.root,G&&y.withArrow,!zo&&y.withClear,Y),"data-testid":$,children:P(Zo,{value:No,options:w,getOptionLabel:Lo,renderInput:To,PopperComponent:Ho,PaperComponent:j,multiple:z,disableCloseOnSelect:z,blurOnSelect:!z,onChange:ko,renderOption:Ro,popupIcon:P(u,{size:16}),forcePopupIcon:!!G,closeIcon:P(a,{size:16}),disableClearable:zo,clearText:"",noOptionsText:q||So,filterOptions:Eo,disabled:Z,getOptionDisabled:Go,renderTags:Vo,inputValue:z?Fo:void 0,onInputChange:Uo,groupBy:qo,renderGroup:eo,clearOnBlur:!0,selectOnFocus:!ro,classes:Wo,getOptionSelected:Ko,ListboxComponent:null!=fo?fo:C})})},w=function(o){return N(D(D({},o),{},{isNext:!1}))},M=function(o){return N(D(D({},o),{},{isNext:!0}))};M.selectedValueRenderers={default:f,chipsMultiline:I};export{w as Autocomplete,M as AutocompleteNext};
2
2
  //# sourceMappingURL=Autocomplete.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.js","sources":["../../../src/componentsV2/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import {\n Autocomplete as MuiAutocomplete,\n AutocompleteChangeReason as MuiAutocompleteChangeReason,\n AutocompleteProps as MuiAutocompleteBaseProps,\n AutocompleteRenderGroupParams,\n AutocompleteRenderInputParams,\n createFilterOptions,\n} from '@material-ui/lab';\nimport {\n ChangeEvent,\n ComponentType,\n HTMLAttributes,\n MouseEventHandler,\n ReactNode,\n useCallback,\n useMemo,\n useState,\n} from 'react';\nimport classNames from 'classnames';\n\nimport { Popper, PopperProps } from '../Popper';\nimport { MenuItemProps } from '../Menu/MenuItem';\nimport { CloseSmallIcon, DownIcon } from '../../icons';\nimport { TextInputNextProps } from '../TextInputNext';\nimport { TextInputProps } from '../TextInput';\n\nimport { AutocompleteInput } from './AutocompleteInput';\nimport { AutocompletePaper } from './AutocompletePaper';\nimport {\n AllOptionMark,\n AutocompleteOption,\n CreateOptionMark,\n InternalOption,\n isRealOption,\n OwnAddedOption,\n renderOptionDefault,\n renderSelectedValue,\n renderSelectedValueChips,\n} from './utils';\nimport { AutocompleteMenuItem } from './AutocompleteMenuItem';\nimport { AutocompleteListBox } from './AutocompleteListBox';\n\nimport styles from './Autocomplete.scss';\nimport { Menu } from '../Menu';\n\ntype MuiAutocompleteProps<T extends AutocompleteOption> = Required<\n MuiAutocompleteBaseProps<InternalOption<T>, boolean, false, false>\n>;\n\ntype ChangeReason =\n | MuiAutocompleteChangeReason\n | 'select-option-all'\n | 'remove-option-all'\n | 'select-only-option';\ntype AutocompletePopperProps = Omit<PopperProps, 'open' | 'anchorEl' | 'children'>;\n\ntype AutocompleteBaseProps<\n T extends AutocompleteOption = AutocompleteOption,\n Multiple extends boolean | undefined = false\n> = {\n /**\n * Options to allow selection from. Has to be assignable to `{ id: string | number; title: string; prefix?: ReactNode; }[]`\n */\n options?: T[];\n /**\n * Selected value. If `multiple` is `false | undefined`, and the value is an array, only the first element will be used\n *\n * There's a [bug in TS](https://github.com/microsoft/TypeScript/issues/47599) which causes `onChange` prop\n * to have incorrect typing if we mix T and T['id'] in `value`. Therefore, we can't use the \"correct\" typing\n * ```\n * value?: T['id'] | T | (T['id'] | T)[];\n * ```\n *\n * You may need to provide additional typings\n */\n value?: string | number | T | (string | number | T)[];\n /**\n * If `true`, the component will support multiple selection\n */\n multiple?: Multiple;\n /**\n * Selection change handler\n * Receives an array of options if `multiple` is `true`, a single selected option or `undefined` otherwise\n */\n onChange?: (\n value: Multiple extends undefined | false ? T | undefined : T[],\n reason: ChangeReason,\n event?: ChangeEvent<unknown>\n ) => void;\n label?: ReactNode;\n placeholder?: string;\n /**\n * Controls the size of the options rendered\n */\n optionSize?: MenuItemProps['size'];\n disabled?: boolean;\n /**\n * If exists - allows user to create own options. Called when 'Add \"whatever\"' option is selected\n */\n onCreate?: (title: string) => void;\n\n prefix?: ReactNode;\n loading?: boolean;\n showPopupIcon?: boolean;\n /**\n * Controls the \"Clear\" button that's shown to the right if there is a value\n */\n clearable?: boolean;\n /**\n * Controls if the field should keep/gain focus after \"Clear\" button is clicked\n */\n focusOnClear?: boolean;\n /**\n * Triggered when user types something\n */\n onInputChange?: (value: string, event: ChangeEvent<HTMLInputElement>) => void;\n status?: TextInputNextProps['status'];\n message?: TextInputNextProps['message'];\n size?: TextInputNextProps['size'];\n labelPlacement?: TextInputNextProps['labelPlacement'];\n /**\n * Makes internal text field readonly, effectively turning component into a simple `<select/>`\n */\n disableFiltering?: boolean;\n\n renderOption?: (item: T) => ReactNode;\n /**\n * Message to show when there are no options\n */\n noOptionsMessage?: ReactNode;\n spacing?: TextInputProps['spacing'];\n /**\n * Function that filters options based on input value\n */\n filterOptions?: (options: T[], inputValue: string) => T[];\n /**\n * Function that determines if an option is disabled. Used to override the default\n * @param option\n */\n getOptionDisabled?: (option: T) => boolean;\n /**\n * If `multiple === true` shows an \"All\" option that selects/deselects all options\n */\n useAllOption?: boolean;\n /**\n * If `multiple === true` shows a \"Select Only\" button on option that selects only the corresponding option\n */\n useOnlyOptionButton?: boolean;\n\n /**\n * Used to render selected values when `multiple === true`\n */\n renderSelected?: (\n data: { option: T; onDelete: MouseEventHandler }[],\n options: { useAllOption: boolean; allOptions: T[] }\n ) => ReactNode;\n\n /**\n * Defines option grouping\n */\n groupBy?: (option: T) => string;\n /**\n * Group render override\n */\n renderGroup?: (props: AutocompleteRenderGroupParams) => ReactNode;\n\n /**\n * A classname that will be applied to dropdown (`<Paper/>` component)\n */\n dropdownClassName?: string;\n /**\n * Escape hatch to customize dropdown popper behavior.\n * `open`, `anchorEl`, and `children` are controlled internally.\n */\n popperProps?: Partial<AutocompletePopperProps>;\n\n type?: 'default' | 'search';\n\n className?: string;\n testId?: string;\n\n /**\n * Escape hatch to fine-tune the styling of underlying elements\n */\n elementsClassNames?: TextInputNextProps['elementsClassNames'];\n\n /** HTML attributes forwarded to the underlying input. */\n htmlAttributes?: TextInputNextProps['htmlAttributes'];\n\n /**\n * Custom listbox component for rendering options (e.g., virtualized list)\n */\n listboxComponent?: ComponentType<HTMLAttributes<HTMLElement>>;\n\n // TODO Remove when making next a new baseline\n isNext?: boolean;\n};\n\nexport type AutocompleteChangeHandler<\n Option extends AutocompleteOption = AutocompleteOption,\n Multiple extends boolean | undefined = false\n> = Required<AutocompleteBaseProps<Option, Multiple>>['onChange'];\n\nconst AutocompleteBase = <\n T extends AutocompleteOption,\n Multiple extends boolean | undefined = false\n>({\n label,\n options = [],\n value,\n onChange,\n multiple,\n renderOption = renderOptionDefault,\n optionSize = 'medium',\n showPopupIcon = true,\n clearable = true,\n loading,\n noOptionsMessage,\n filterOptions,\n prefix,\n disabled,\n getOptionDisabled,\n renderSelected = renderSelectedValue,\n onInputChange,\n className,\n testId,\n status,\n message,\n useAllOption = false,\n useOnlyOptionButton = false,\n groupBy,\n renderGroup,\n disableFiltering,\n onCreate,\n dropdownClassName,\n popperProps,\n placeholder,\n focusOnClear = true,\n listboxComponent,\n size = 'small',\n labelPlacement = 'top',\n elementsClassNames,\n htmlAttributes,\n\n // Old props\n type,\n spacing,\n isNext,\n}: AutocompleteBaseProps<T, Multiple>) => {\n const [inputValue, setInputValue] = useState('');\n\n const muiValue = useMemo(() => {\n if (value === undefined || (value instanceof Array && value.length === 0)) {\n return multiple ? [] : null;\n }\n\n // Array of either ids or actual values\n const mixedValues = value instanceof Array ? value : [value];\n\n if (multiple) {\n const valuesArray = mixedValues.filter(value => typeof value !== 'object');\n const objectValues = mixedValues\n .filter(value => typeof value === 'object')\n // MUI Autocomplete doesn't like react nodes in value, so we strip everything from the object to the bare minimum\n .map(({ id, title }) => ({ id, title }));\n const optionsById = options.filter(option => valuesArray.includes(option.id));\n\n return [...optionsById, ...objectValues];\n } else {\n return typeof mixedValues[0] === 'object'\n ? mixedValues[0]\n : options.find(option => mixedValues[0] === option.id) || null;\n }\n }, [multiple, value, options]) as MuiAutocompleteBaseProps<T, Multiple, false, false>['value'];\n\n const hasMultiSelected = muiValue instanceof Array && muiValue.length > 0;\n const hasAllMultiSelected = muiValue instanceof Array && muiValue.length === options.length;\n const defaultNoOptionsText = loading ? 'Loading ...' : 'No options';\n const disableClearable =\n !clearable || !muiValue || (muiValue instanceof Array && !muiValue?.length);\n\n const renderInput = useCallback(\n (inputProps: AutocompleteRenderInputParams) => (\n <AutocompleteInput\n {...inputProps}\n label={label}\n loading={loading}\n prefix={prefix}\n status={status}\n message={message}\n readOnly={disableFiltering}\n placeholder={placeholder}\n size={size}\n labelPlacement={labelPlacement}\n elementsClassNames={elementsClassNames}\n htmlAttributes={htmlAttributes}\n // Old props\n type={type}\n spacing={spacing}\n isNext={isNext}\n />\n ),\n [\n label,\n loading,\n prefix,\n status,\n message,\n disableFiltering,\n placeholder,\n size,\n labelPlacement,\n elementsClassNames,\n htmlAttributes,\n type,\n spacing,\n isNext,\n ]\n );\n\n const actualOnChange = useCallback<MuiAutocompleteProps<T>['onChange']>(\n (event, optionOrArray, reason) => {\n if (reason === 'clear' && !focusOnClear) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n // Handling of \"Add\" option\n if (onCreate && optionOrArray) {\n const optionArray = optionOrArray instanceof Array ? optionOrArray : [optionOrArray];\n const foundAddOption: OwnAddedOption | undefined = optionArray.find(\n option => !isRealOption(option) && !!option[CreateOptionMark]\n );\n\n if (foundAddOption) {\n onCreate(foundAddOption.newOptionTitle || '');\n return;\n }\n }\n\n // Handling of \"All\" option - only multiselect\n if (multiple && optionOrArray instanceof Array) {\n const allOptionExists = optionOrArray.some(\n option => !isRealOption(option) && !!option[AllOptionMark]\n );\n\n if (allOptionExists) {\n // Selecting \"All\"\n if (muiValue instanceof Array && muiValue.length < options.length) {\n onChange?.(options.filter(isRealOption) as never, reason, event);\n }\n // Deselecting \"All\"\n else {\n onChange?.([] as never, reason, event);\n }\n return;\n }\n }\n\n onChange?.((optionOrArray || undefined) as never, reason, event);\n },\n [focusOnClear, onCreate, multiple, onChange, muiValue, options]\n );\n\n const onSelectOnly = useCallback(\n (option: T, event: ChangeEvent<object>) =>\n onChange?.([option] as never, 'select-only-option', event),\n [onChange]\n );\n\n const actualRenderOption = useCallback<MuiAutocompleteProps<T>['renderOption']>(\n (option: InternalOption<T>, { selected }) => {\n if (isRealOption(option)) {\n return (\n <AutocompleteMenuItem\n size={optionSize}\n selected={selected}\n prefix={option.prefix}\n multiple={multiple}\n useOnlyButton={useOnlyOptionButton}\n option={option}\n onSelectOnly={onSelectOnly}\n >\n {renderOption(option)}\n </AutocompleteMenuItem>\n );\n } else if (option[AllOptionMark]) {\n return (\n <div className={styles.allOptionContainer}>\n <AutocompleteMenuItem\n size={optionSize}\n selected={hasMultiSelected}\n indeterminate={hasMultiSelected && !hasAllMultiSelected}\n multiple\n >\n {option.title}\n </AutocompleteMenuItem>\n <Menu.Divider className={styles.allOptionDivider} />\n </div>\n );\n } else {\n return (\n <AutocompleteMenuItem size={optionSize} selected={hasMultiSelected}>\n {option.title}\n </AutocompleteMenuItem>\n );\n }\n },\n [\n optionSize,\n multiple,\n useOnlyOptionButton,\n onSelectOnly,\n renderOption,\n hasMultiSelected,\n hasAllMultiSelected,\n ]\n );\n\n const actualFilterOptions = useCallback<MuiAutocompleteProps<T>['filterOptions']>(\n (options, params): InternalOption<T>[] => {\n const filteredOptions = filterOptions\n ? filterOptions(options as T[], params.inputValue)\n : createFilterOptions<T>()(options as T[], params);\n\n // Adding \"All\" option if needed\n const optionsWithAll =\n useAllOption && multiple && filteredOptions.length && options.length > 1\n ? [{ title: 'All', [AllOptionMark]: true }, ...filteredOptions]\n : filteredOptions;\n\n // Adding \"Add\" option if needed\n return onCreate && params.inputValue.trim() !== ''\n ? [\n ...optionsWithAll,\n {\n title: `Add \"${params.inputValue}\"`,\n [CreateOptionMark]: true,\n newOptionTitle: params.inputValue,\n },\n ]\n : optionsWithAll;\n },\n [filterOptions, onCreate, useAllOption, multiple]\n );\n\n const actualGetOptionDisabled = useCallback<MuiAutocompleteProps<T>['getOptionDisabled']>(\n option => isRealOption(option) && !!getOptionDisabled?.(option),\n [getOptionDisabled]\n );\n\n const getOptionLabel = useCallback<MuiAutocompleteProps<T>['getOptionLabel']>(\n option => option.title,\n []\n );\n\n const renderTags = useCallback<MuiAutocompleteProps<T>['renderTags']>(\n (tags, getTagProps) => {\n const tagsArray = tags.filter(isRealOption).map((option, index) => {\n // Untyped in MUI, so we have to do it ourselves\n const { onDelete } = getTagProps({ index }) as { onDelete: MouseEventHandler };\n return { option, onDelete };\n });\n\n return renderSelected(tagsArray, { useAllOption, allOptions: options });\n },\n [renderSelected, useAllOption, options]\n );\n\n const actualOnInputChange = useCallback<MuiAutocompleteProps<T>['onInputChange']>(\n (event, value, reason) => {\n if (event && event.type === 'blur') {\n setInputValue('');\n } else if (reason !== 'reset') {\n setInputValue(value);\n }\n\n if (reason !== 'reset') {\n onInputChange?.(value, event as ChangeEvent<HTMLInputElement>);\n }\n },\n [onInputChange]\n );\n\n const actualGroupBy = useMemo<MuiAutocompleteProps<T>['groupBy'] | undefined>(() => {\n if (groupBy) {\n return option => {\n if (isRealOption(option)) {\n return groupBy(option);\n }\n\n return '';\n };\n }\n\n return undefined;\n }, [groupBy]);\n\n const classes = useMemo(() => ({ paper: dropdownClassName }), [dropdownClassName]);\n\n const getOptionSelected = useCallback((a: InternalOption<T>, b: InternalOption<T>) => {\n return isRealOption(a) && isRealOption(b) ? a.id === b.id : false;\n }, []);\n\n const Component = MuiAutocomplete<InternalOption<T>, Multiple, boolean, false>;\n\n const PopperComponent = useCallback(\n (props: PopperProps) => <Popper {...props} {...popperProps} />,\n [popperProps]\n ) as NonNullable<MuiAutocompleteProps<T>['PopperComponent']>;\n\n return (\n <div\n className={classNames(\n styles.root,\n showPopupIcon && styles.withArrow,\n !disableClearable && styles.withClear,\n className\n )}\n data-testid={testId}\n >\n <Component\n value={muiValue}\n options={options}\n getOptionLabel={getOptionLabel}\n renderInput={renderInput}\n PopperComponent={PopperComponent}\n PaperComponent={AutocompletePaper}\n multiple={multiple}\n disableCloseOnSelect={multiple}\n blurOnSelect={!multiple}\n onChange={actualOnChange}\n renderOption={actualRenderOption}\n popupIcon={<DownIcon size={16} />}\n forcePopupIcon={!!showPopupIcon}\n closeIcon={<CloseSmallIcon size={16} />}\n disableClearable={disableClearable}\n clearText=\"\"\n noOptionsText={noOptionsMessage || defaultNoOptionsText}\n filterOptions={actualFilterOptions}\n disabled={disabled}\n getOptionDisabled={actualGetOptionDisabled}\n renderTags={renderTags}\n inputValue={multiple ? inputValue : undefined}\n onInputChange={actualOnInputChange}\n groupBy={actualGroupBy}\n renderGroup={renderGroup}\n clearOnBlur\n selectOnFocus={!disableFiltering}\n classes={classes}\n getOptionSelected={getOptionSelected}\n ListboxComponent={listboxComponent ?? AutocompleteListBox}\n />\n </div>\n );\n};\n\n// Old version\n/**\n * @deprecated use `AutocompleteNext`, and see migration guide for `TextInputNext` for details\n */\nexport type AutocompleteProps<\n T extends AutocompleteOption = AutocompleteOption,\n Multiple extends boolean | undefined = false\n> = Omit<\n AutocompleteBaseProps<T, Multiple>,\n 'size' | 'labelPlacement' | 'elementsClassNames' | 'htmlAttributes' | 'isNext'\n>;\n\n/**\n * @deprecated use `AutocompleteNext`, and see migration guide for `TextInputNext` for details\n */\nexport const Autocomplete = <\n T extends AutocompleteOption,\n Multiple extends boolean | undefined = false\n>(\n props: AutocompleteProps<T, Multiple>\n) => AutocompleteBase<T, Multiple>({ ...props, isNext: false });\n\n// New version\nexport type AutocompleteNextProps<\n T extends AutocompleteOption = AutocompleteOption,\n Multiple extends boolean | undefined = false\n> = Omit<AutocompleteBaseProps<T, Multiple>, 'type' | 'spacing' | 'isNext'>;\n\nexport const AutocompleteNext = <\n T extends AutocompleteOption,\n Multiple extends boolean | undefined = false\n>(\n props: AutocompleteNextProps<T, Multiple>\n) => AutocompleteBase<T, Multiple>({ ...props, isNext: true });\n\nAutocompleteNext.selectedValueRenderers = {\n default: renderSelectedValue,\n chipsMultiline: renderSelectedValueChips,\n};\n"],"names":["AutocompleteBase","_ref","label","_ref$options","options","value","onChange","multiple","_ref$renderOption","renderOption","renderOptionDefault","_ref$optionSize","optionSize","_ref$showPopupIcon","showPopupIcon","_ref$clearable","clearable","loading","noOptionsMessage","filterOptions","prefix","disabled","getOptionDisabled","_ref$renderSelected","renderSelected","renderSelectedValue","onInputChange","className","testId","status","message","_ref$useAllOption","useAllOption","_ref$useOnlyOptionBut","useOnlyOptionButton","groupBy","renderGroup","disableFiltering","onCreate","dropdownClassName","popperProps","placeholder","_ref$focusOnClear","focusOnClear","listboxComponent","_ref$size","size","_ref$labelPlacement","labelPlacement","elementsClassNames","htmlAttributes","type","spacing","isNext","useState","_useState2","_slicedToArray","_useState","inputValue","setInputValue","muiValue","useMemo","undefined","Array","length","mixedValues","valuesArray","filter","_typeof","objectValues","map","_ref2","id","title","optionsById","option","includes","find","hasMultiSelected","hasAllMultiSelected","defaultNoOptionsText","disableClearable","renderInput","useCallback","inputProps","_jsx","AutocompleteInput","_objectSpread","readOnly","actualOnChange","event","optionOrArray","reason","stopPropagation","preventDefault","foundAddOption","isRealOption","CreateOptionMark","newOptionTitle","some","AllOptionMark","onSelectOnly","actualRenderOption","_ref3","selected","AutocompleteMenuItem","useOnlyButton","children","_jsxs","styles","allOptionContainer","indeterminate","Menu","Divider","allOptionDivider","actualFilterOptions","params","_ref5","filteredOptions","createFilterOptions","optionsWithAll","_defineProperty","trim","concat","_toConsumableArray","actualGetOptionDisabled","getOptionLabel","renderTags","tags","getTagProps","tagsArray","index","onDelete","allOptions","actualOnInputChange","actualGroupBy","classes","paper","getOptionSelected","a","b","Component","MuiAutocomplete","PopperComponent","props","Popper","classNames","root","withArrow","withClear","PaperComponent","AutocompletePaper","disableCloseOnSelect","blurOnSelect","popupIcon","DownIcon","forcePopupIcon","closeIcon","CloseSmallIcon","clearText","noOptionsText","clearOnBlur","selectOnFocus","ListboxComponent","AutocompleteListBox","Autocomplete","AutocompleteNext","selectedValueRenderers","default","chipsMultiline","renderSelectedValueChips"],"mappings":"6wKA2MA,IAAMA,EAAmB,SA6CiBC,GAAA,IAzCxCC,IAAAA,MAAKC,EAAAF,EACLG,QAAAA,aAAU,GAAED,EACZE,IAAAA,MACAC,IAAAA,SACAC,IAAAA,SAAQC,EAAAP,EACRQ,aAAAA,aAAeC,EAAmBF,EAAAG,EAAAV,EAClCW,WAAAA,aAAa,SAAQD,EAAAE,EAAAZ,EACrBa,cAAAA,cAAoBD,EAAAE,EAAAd,EACpBe,UAAAA,cAAgBD,EAChBE,IAAAA,QACAC,IAAAA,iBACAC,IAAAA,cACAC,IAAAA,OACAC,IAAAA,SACAC,IAAAA,kBAAiBC,EAAAtB,EACjBuB,eAAAA,aAAiBC,EAAmBF,EACpCG,IAAAA,cACAC,IAAAA,UACAC,IAAAA,OACAC,IAAAA,OACAC,KAAAA,QAAOC,GAAA9B,EACP+B,aAAAA,gBAAoBD,GAAAE,GAAAhC,EACpBiC,oBAAAA,gBAA2BD,GAC3BE,KAAAA,QACAC,KAAAA,YACAC,KAAAA,iBACAC,KAAAA,SACAC,KAAAA,kBACAC,KAAAA,YACAC,KAAAA,YAAWC,GAAAzC,EACX0C,aAAAA,gBAAmBD,GACnBE,KAAAA,iBAAgBC,GAAA5C,EAChB6C,KAAAA,eAAO,QAAOD,GAAAE,GAAA9C,EACd+C,eAAAA,eAAiB,MAAKD,GACtBE,KAAAA,mBACAC,KAAAA,eAGAC,KAAAA,KACAC,KAAAA,QACAC,KAAAA,OAEoCC,GAAAA,EAAS,IAAGC,GAAAC,EAAAC,GAAA,GAAzCC,GAAUH,GAAA,GAAEI,GAAaJ,GAAA,GAE1BK,GAAWC,GAAQ,WACvB,QAAcC,IAAVzD,GAAwBA,aAAiB0D,OAA0B,IAAjB1D,EAAM2D,OAC1D,OAAOzD,E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AAe,SAI1BrB,GAAqC,OAClChJ,SAAmCgJ,GAAK,GAAA,CAAE3F,QAAQ,IAAQ,EAQlDiH,EAAmB,SAI9BtB,GAAyC,OACtChJ,SAAmCgJ,GAAK,GAAA,CAAE3F,QAAQ,IAAO,EAE9DiH,EAAiBC,uBAAyB,CACxCC,QAAS/I,EACTgJ,eAAgBC"}
1
+ {"version":3,"file":"Autocomplete.js","sources":["../../../src/componentsV2/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import {\n Autocomplete as MuiAutocomplete,\n AutocompleteChangeReason as MuiAutocompleteChangeReason,\n AutocompleteProps as MuiAutocompleteBaseProps,\n AutocompleteRenderGroupParams,\n AutocompleteRenderInputParams,\n createFilterOptions,\n} from '@material-ui/lab';\nimport {\n ChangeEvent,\n ComponentType,\n HTMLAttributes,\n MouseEventHandler,\n ReactNode,\n useCallback,\n useMemo,\n useState,\n} from 'react';\nimport classNames from 'classnames';\n\nimport { Popper, PopperProps } from '../Popper';\nimport { MenuItemProps } from '../Menu/MenuItem';\nimport { CloseSmallIcon, DownIcon } from '../../icons';\nimport { TextInputNextProps } from '../TextInputNext';\nimport { TextInputProps } from '../TextInput';\n\nimport { AutocompleteInput } from './AutocompleteInput';\nimport { AutocompletePaper } from './AutocompletePaper';\nimport {\n AllOptionMark,\n AutocompleteOption,\n CreateOptionMark,\n InternalOption,\n isRealOption,\n OwnAddedOption,\n renderOptionDefault,\n renderSelectedValue,\n renderSelectedValueChips,\n} from './utils';\nimport { AutocompleteMenuItem } from './AutocompleteMenuItem';\nimport { AutocompleteListBox } from './AutocompleteListBox';\n\nimport styles from './Autocomplete.scss';\nimport { Menu } from '../Menu';\n\ntype MuiAutocompleteProps<T extends AutocompleteOption> = Required<\n MuiAutocompleteBaseProps<InternalOption<T>, boolean, false, false>\n>;\n\ntype ChangeReason =\n | MuiAutocompleteChangeReason\n | 'select-option-all'\n | 'remove-option-all'\n | 'select-only-option';\ntype AutocompletePopperProps = Omit<PopperProps, 'open' | 'anchorEl' | 'children'>;\n\ntype AutocompleteBaseProps<\n T extends AutocompleteOption = AutocompleteOption,\n Multiple extends boolean | undefined = false\n> = {\n /**\n * Options to allow selection from. Has to be assignable to `{ id: string | number; title: string; prefix?: ReactNode; }[]`\n */\n options?: T[];\n /**\n * Selected value. If `multiple` is `false | undefined`, and the value is an array, only the first element will be used\n *\n * There's a [bug in TS](https://github.com/microsoft/TypeScript/issues/47599) which causes `onChange` prop\n * to have incorrect typing if we mix T and T['id'] in `value`. Therefore, we can't use the \"correct\" typing\n * ```\n * value?: T['id'] | T | (T['id'] | T)[];\n * ```\n *\n * You may need to provide additional typings\n */\n value?: string | number | T | (string | number | T)[];\n /**\n * If `true`, the component will support multiple selection\n */\n multiple?: Multiple;\n /**\n * Selection change handler\n * Receives an array of options if `multiple` is `true`, a single selected option or `undefined` otherwise\n */\n onChange?: (\n value: Multiple extends undefined | false ? T | undefined : T[],\n reason: ChangeReason,\n event?: ChangeEvent<unknown>\n ) => void;\n label?: ReactNode;\n placeholder?: string;\n /**\n * Controls the size of the options rendered\n */\n optionSize?: MenuItemProps['size'];\n disabled?: boolean;\n /**\n * If exists - allows user to create own options. Called when 'Add \"whatever\"' option is selected\n */\n onCreate?: (title: string) => void;\n\n prefix?: ReactNode;\n loading?: boolean;\n showPopupIcon?: boolean;\n /**\n * Controls the \"Clear\" button that's shown to the right if there is a value\n */\n clearable?: boolean;\n /**\n * Controls if the field should keep/gain focus after \"Clear\" button is clicked\n */\n focusOnClear?: boolean;\n /**\n * Triggered when user types something\n */\n onInputChange?: (value: string, event: ChangeEvent<HTMLInputElement>) => void;\n status?: TextInputNextProps['status'];\n message?: TextInputNextProps['message'];\n size?: TextInputNextProps['size'];\n labelPlacement?: TextInputNextProps['labelPlacement'];\n /**\n * Makes internal text field readonly, effectively turning component into a simple `<select/>`\n */\n disableFiltering?: boolean;\n\n renderOption?: (item: T) => ReactNode;\n /**\n * Message to show when there are no options\n */\n noOptionsMessage?: ReactNode;\n spacing?: TextInputProps['spacing'];\n /**\n * Function that filters options based on input value\n */\n filterOptions?: (options: T[], inputValue: string) => T[];\n /**\n * Function that determines if an option is disabled. Used to override the default\n * @param option\n */\n getOptionDisabled?: (option: T) => boolean;\n /**\n * If `multiple === true` shows an \"All\" option that selects/deselects all options\n */\n useAllOption?: boolean;\n /**\n * If `multiple === true` shows a \"Select Only\" button on option that selects only the corresponding option\n */\n useOnlyOptionButton?: boolean;\n\n /**\n * Used to render selected values when `multiple === true`\n */\n renderSelected?: (\n data: { option: T; onDelete: MouseEventHandler }[],\n options: { useAllOption: boolean; allOptions: T[] }\n ) => ReactNode;\n\n /**\n * Defines option grouping\n */\n groupBy?: (option: T) => string;\n /**\n * Group render override\n */\n renderGroup?: (props: AutocompleteRenderGroupParams) => ReactNode;\n\n /**\n * A classname that will be applied to dropdown (`<Paper/>` component)\n */\n dropdownClassName?: string;\n /**\n * Escape hatch to customize dropdown popper behavior.\n * `open`, `anchorEl`, and `children` are controlled internally.\n */\n popperProps?: Partial<AutocompletePopperProps>;\n\n type?: 'default' | 'search';\n\n className?: string;\n testId?: string;\n\n /**\n * Escape hatch to fine-tune the styling of underlying elements\n */\n elementsClassNames?: TextInputNextProps['elementsClassNames'];\n\n /** HTML attributes forwarded to the underlying input. */\n htmlAttributes?: TextInputNextProps['htmlAttributes'];\n\n /**\n * Custom listbox component for rendering options (e.g., virtualized list)\n */\n listboxComponent?: ComponentType<HTMLAttributes<HTMLElement>>;\n\n // TODO Remove when making next a new baseline\n isNext?: boolean;\n};\n\nexport type AutocompleteChangeHandler<\n Option extends AutocompleteOption = AutocompleteOption,\n Multiple extends boolean | undefined = false\n> = Required<AutocompleteBaseProps<Option, Multiple>>['onChange'];\n\nconst AutocompleteBase = <\n T extends AutocompleteOption,\n Multiple extends boolean | undefined = false\n>({\n label,\n options = [],\n value,\n onChange,\n multiple,\n renderOption = renderOptionDefault,\n optionSize = 'medium',\n showPopupIcon = true,\n clearable = true,\n loading,\n noOptionsMessage,\n filterOptions,\n prefix,\n disabled,\n getOptionDisabled,\n renderSelected = renderSelectedValue,\n onInputChange,\n className,\n testId,\n status,\n message,\n useAllOption = false,\n useOnlyOptionButton = false,\n groupBy,\n renderGroup,\n disableFiltering,\n onCreate,\n dropdownClassName,\n popperProps,\n placeholder,\n focusOnClear = true,\n listboxComponent,\n size = 'small',\n labelPlacement = 'top',\n elementsClassNames,\n htmlAttributes,\n\n // Old props\n type,\n spacing,\n isNext,\n}: AutocompleteBaseProps<T, Multiple>) => {\n const [inputValue, setInputValue] = useState('');\n\n const muiValue = useMemo(() => {\n if (value === undefined || (value instanceof Array && value.length === 0)) {\n return multiple ? [] : null;\n }\n\n // Array of either ids or actual values\n const mixedValues = value instanceof Array ? value : [value];\n\n if (multiple) {\n const valuesArray = mixedValues.filter(value => typeof value !== 'object');\n const objectValues = mixedValues\n .filter(value => typeof value === 'object')\n // MUI Autocomplete doesn't like react nodes in value, so we strip everything from the object to the bare minimum\n .map(({ id, title }) => ({ id, title }));\n const optionsById = options.filter(option => valuesArray.includes(option.id));\n\n return [...optionsById, ...objectValues];\n } else {\n return typeof mixedValues[0] === 'object'\n ? mixedValues[0]\n : options.find(option => mixedValues[0] === option.id) || null;\n }\n }, [multiple, value, options]) as MuiAutocompleteBaseProps<T, Multiple, false, false>['value'];\n\n const hasMultiSelected = muiValue instanceof Array && muiValue.length > 0;\n const hasAllMultiSelected = muiValue instanceof Array && muiValue.length === options.length;\n const defaultNoOptionsText = loading ? 'Loading ...' : 'No options';\n const disableClearable =\n !clearable || !muiValue || (muiValue instanceof Array && !muiValue?.length);\n\n const renderInput = useCallback(\n (inputProps: AutocompleteRenderInputParams) => (\n <AutocompleteInput\n {...inputProps}\n label={label}\n loading={loading}\n prefix={prefix}\n status={status}\n message={message}\n readOnly={disableFiltering}\n placeholder={placeholder}\n size={size}\n labelPlacement={labelPlacement}\n elementsClassNames={elementsClassNames}\n htmlAttributes={htmlAttributes}\n // Old props\n type={type}\n spacing={spacing}\n isNext={isNext}\n />\n ),\n [\n label,\n loading,\n prefix,\n status,\n message,\n disableFiltering,\n placeholder,\n size,\n labelPlacement,\n elementsClassNames,\n htmlAttributes,\n type,\n spacing,\n isNext,\n ]\n );\n\n const actualOnChange = useCallback<MuiAutocompleteProps<T>['onChange']>(\n (event, optionOrArray, reason) => {\n if (reason === 'clear' && !focusOnClear) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n // Handling of \"Add\" option\n if (onCreate && optionOrArray) {\n const optionArray = optionOrArray instanceof Array ? optionOrArray : [optionOrArray];\n const foundAddOption: OwnAddedOption | undefined = optionArray.find(\n option => !isRealOption(option) && !!option[CreateOptionMark]\n );\n\n if (foundAddOption) {\n onCreate(foundAddOption.newOptionTitle || '');\n return;\n }\n }\n\n // Handling of \"All\" option - only multiselect\n if (multiple && optionOrArray instanceof Array) {\n const allOptionExists = optionOrArray.some(\n option => !isRealOption(option) && !!option[AllOptionMark]\n );\n\n if (allOptionExists) {\n // Selecting \"All\"\n if (muiValue instanceof Array && muiValue.length < options.length) {\n onChange?.(options.filter(isRealOption) as never, reason, event);\n }\n // Deselecting \"All\"\n else {\n onChange?.([] as never, reason, event);\n }\n return;\n }\n }\n\n onChange?.((optionOrArray || undefined) as never, reason, event);\n },\n [focusOnClear, onCreate, multiple, onChange, muiValue, options]\n );\n\n const onSelectOnly = useCallback(\n (option: T, event: ChangeEvent<object>) =>\n onChange?.([option] as never, 'select-only-option', event),\n [onChange]\n );\n\n const actualRenderOption = useCallback<MuiAutocompleteProps<T>['renderOption']>(\n (option: InternalOption<T>, { selected }) => {\n if (isRealOption(option)) {\n return (\n <AutocompleteMenuItem\n size={optionSize}\n selected={selected}\n prefix={option.prefix}\n multiple={multiple}\n useOnlyButton={useOnlyOptionButton}\n option={option}\n onSelectOnly={onSelectOnly}\n >\n {renderOption(option)}\n </AutocompleteMenuItem>\n );\n } else if (option[AllOptionMark]) {\n return (\n <div className={styles.allOptionContainer}>\n <AutocompleteMenuItem\n size={optionSize}\n selected={hasMultiSelected}\n indeterminate={hasMultiSelected && !hasAllMultiSelected}\n multiple\n >\n {option.title}\n </AutocompleteMenuItem>\n <Menu.Divider className={styles.allOptionDivider} />\n </div>\n );\n } else {\n return (\n <AutocompleteMenuItem size={optionSize} selected={hasMultiSelected}>\n {option.title}\n </AutocompleteMenuItem>\n );\n }\n },\n [\n optionSize,\n multiple,\n useOnlyOptionButton,\n onSelectOnly,\n renderOption,\n hasMultiSelected,\n hasAllMultiSelected,\n ]\n );\n\n const actualFilterOptions = useCallback<MuiAutocompleteProps<T>['filterOptions']>(\n (options, params): InternalOption<T>[] => {\n const filteredOptions = filterOptions\n ? filterOptions(options as T[], params.inputValue)\n : createFilterOptions<T>()(options as T[], params);\n\n // Adding \"All\" option if needed\n const optionsWithAll =\n useAllOption && multiple && filteredOptions.length && options.length > 1\n ? [{ title: 'All', [AllOptionMark]: true }, ...filteredOptions]\n : filteredOptions;\n\n // Adding \"Add\" option if needed\n return onCreate && params.inputValue.trim() !== ''\n ? [\n ...optionsWithAll,\n {\n title: `Add \"${params.inputValue}\"`,\n [CreateOptionMark]: true,\n newOptionTitle: params.inputValue,\n },\n ]\n : optionsWithAll;\n },\n [filterOptions, onCreate, useAllOption, multiple]\n );\n\n const actualGetOptionDisabled = useCallback<MuiAutocompleteProps<T>['getOptionDisabled']>(\n option => isRealOption(option) && !!getOptionDisabled?.(option),\n [getOptionDisabled]\n );\n\n const getOptionLabel = useCallback<MuiAutocompleteProps<T>['getOptionLabel']>(\n option => option.title,\n []\n );\n\n const renderTags = useCallback<MuiAutocompleteProps<T>['renderTags']>(\n (tags, getTagProps) => {\n const tagsArray = tags.filter(isRealOption).map((option, index) => {\n // Untyped in MUI, so we have to do it ourselves\n const { onDelete } = getTagProps({ index }) as { onDelete: MouseEventHandler };\n return { option, onDelete };\n });\n\n return renderSelected(tagsArray, { useAllOption, allOptions: options });\n },\n [renderSelected, useAllOption, options]\n );\n\n const actualOnInputChange = useCallback<MuiAutocompleteProps<T>['onInputChange']>(\n (event, value, reason) => {\n if (event && event.type === 'blur') {\n setInputValue('');\n } else if (reason !== 'reset') {\n setInputValue(value);\n }\n\n if (reason !== 'reset') {\n onInputChange?.(value, event as ChangeEvent<HTMLInputElement>);\n }\n },\n [onInputChange]\n );\n\n const actualGroupBy = useMemo<MuiAutocompleteProps<T>['groupBy'] | undefined>(() => {\n if (groupBy) {\n return option => {\n if (isRealOption(option)) {\n return groupBy(option);\n }\n\n return '';\n };\n }\n\n return undefined;\n }, [groupBy]);\n\n const classes = useMemo(() => ({ paper: dropdownClassName }), [dropdownClassName]);\n\n const getOptionSelected = useCallback((a: InternalOption<T>, b: InternalOption<T>) => {\n return isRealOption(a) && isRealOption(b) ? a.id === b.id : false;\n }, []);\n\n const Component = MuiAutocomplete<InternalOption<T>, Multiple, boolean, false>;\n\n const PopperComponent = useCallback(\n (props: PopperProps) => (\n <Popper\n {...props}\n {...popperProps}\n className={classNames(props?.className, popperProps?.className)}\n />\n ),\n [popperProps]\n ) as NonNullable<MuiAutocompleteProps<T>['PopperComponent']>;\n\n return (\n <div\n className={classNames(\n styles.root,\n showPopupIcon && styles.withArrow,\n !disableClearable && styles.withClear,\n className\n )}\n data-testid={testId}\n >\n <Component\n value={muiValue}\n options={options}\n getOptionLabel={getOptionLabel}\n renderInput={renderInput}\n PopperComponent={PopperComponent}\n PaperComponent={AutocompletePaper}\n multiple={multiple}\n disableCloseOnSelect={multiple}\n blurOnSelect={!multiple}\n onChange={actualOnChange}\n renderOption={actualRenderOption}\n popupIcon={<DownIcon size={16} />}\n forcePopupIcon={!!showPopupIcon}\n closeIcon={<CloseSmallIcon size={16} />}\n disableClearable={disableClearable}\n clearText=\"\"\n noOptionsText={noOptionsMessage || defaultNoOptionsText}\n filterOptions={actualFilterOptions}\n disabled={disabled}\n getOptionDisabled={actualGetOptionDisabled}\n renderTags={renderTags}\n inputValue={multiple ? inputValue : undefined}\n onInputChange={actualOnInputChange}\n groupBy={actualGroupBy}\n renderGroup={renderGroup}\n clearOnBlur\n selectOnFocus={!disableFiltering}\n classes={classes}\n getOptionSelected={getOptionSelected}\n ListboxComponent={listboxComponent ?? AutocompleteListBox}\n />\n </div>\n );\n};\n\n// Old version\n/**\n * @deprecated use `AutocompleteNext`, and see migration guide for `TextInputNext` for details\n */\nexport type AutocompleteProps<\n T extends AutocompleteOption = AutocompleteOption,\n Multiple extends boolean | undefined = false\n> = Omit<\n AutocompleteBaseProps<T, Multiple>,\n 'size' | 'labelPlacement' | 'elementsClassNames' | 'htmlAttributes' | 'isNext'\n>;\n\n/**\n * @deprecated use `AutocompleteNext`, and see migration guide for `TextInputNext` for details\n */\nexport const Autocomplete = <\n T extends AutocompleteOption,\n Multiple extends boolean | undefined = false\n>(\n props: AutocompleteProps<T, Multiple>\n) => AutocompleteBase<T, Multiple>({ ...props, isNext: false });\n\n// New version\nexport type AutocompleteNextProps<\n T extends AutocompleteOption = AutocompleteOption,\n Multiple extends boolean | undefined = false\n> = Omit<AutocompleteBaseProps<T, Multiple>, 'type' | 'spacing' | 'isNext'>;\n\nexport const AutocompleteNext = <\n T extends AutocompleteOption,\n Multiple extends boolean | undefined = false\n>(\n props: AutocompleteNextProps<T, Multiple>\n) => AutocompleteBase<T, Multiple>({ ...props, isNext: true });\n\nAutocompleteNext.selectedValueRenderers = {\n default: renderSelectedValue,\n chipsMultiline: renderSelectedValueChips,\n};\n"],"names":["AutocompleteBase","_ref","label","_ref$options","options","value","onChange","multiple","_ref$renderOption","renderOption","renderOptionDefault","_ref$optionSize","optionSize","_ref$showPopupIcon","showPopupIcon","_ref$clearable","clearable","loading","noOptionsMessage","filterOptions","prefix","disabled","getOptionDisabled","_ref$renderSelected","renderSelected","renderSelectedValue","onInputChange","className","testId","status","message","_ref$useAllOption","useAllOption","_ref$useOnlyOptionBut","useOnlyOptionButton","groupBy","renderGroup","disableFiltering","onCreate","dropdownClassName","popperProps","placeholder","_ref$focusOnClear","focusOnClear","listboxComponent","_ref$size","size","_ref$labelPlacement","labelPlacement","elementsClassNames","htmlAttributes","type","spacing","isNext","useState","_useState2","_slicedToArray","_useState","inputValue","setInputValue","muiValue","useMemo","undefined","Array","length","mixedValues","valuesArray","filter","_typeof","objectValues","map","_ref2","id","title","optionsById","option","includes","find","hasMultiSelected","hasAllMultiSelected","defaultNoOptionsText","disableClearable","renderInput","useCallback","inputProps","_jsx","AutocompleteInput","_objectSpread","readOnly","actualOnChange","event","optionOrArray","reason","stopPropagation","preventDefault","foundAddOption","isRealOption","CreateOptionMark","newOptionTitle","some","AllOptionMark","onSelectOnly","actualRenderOption","_ref3","selected","AutocompleteMenuItem","useOnlyButton","children","_jsxs","styles","allOptionContainer","indeterminate","Menu","Divider","allOptionDivider","actualFilterOptions","params","_ref5","filteredOptions","createFilterOptions","optionsWithAll","_defineProperty","trim","concat","_toConsumableArray","actualGetOptionDisabled","getOptionLabel","renderTags","tags","getTagProps","tagsArray","index","onDelete","allOptions","actualOnInputChange","actualGroupBy","classes","paper","getOptionSelected","a","b","Component","MuiAutocomplete","PopperComponent","props","Popper","classNames","root","withArrow","withClear","PaperComponent","AutocompletePaper","disableCloseOnSelect","blurOnSelect","popupIcon","DownIcon","forcePopupIcon","closeIcon","CloseSmallIcon","clearText","noOptionsText","clearOnBlur","selectOnFocus","ListboxComponent","AutocompleteListBox","Autocomplete","AutocompleteNext","selectedValueRenderers","default","chipsMultiline","renderSelectedValueChips"],"mappings":"6wKA2MA,IAAMA,EAAmB,SA6CiBC,GAAA,IAzCxCC,IAAAA,MAAKC,EAAAF,EACLG,QAAAA,aAAU,GAAED,EACZE,IAAAA,MACAC,IAAAA,SACAC,IAAAA,SAAQC,EAAAP,EACRQ,aAAAA,aAAeC,EAAmBF,EAAAG,EAAAV,EAClCW,WAAAA,aAAa,SAAQD,EAAAE,EAAAZ,EACrBa,cAAAA,cAAoBD,EAAAE,EAAAd,EACpBe,UAAAA,cAAgBD,EAChBE,IAAAA,QACAC,IAAAA,iBACAC,IAAAA,cACAC,IAAAA,OACAC,IAAAA,SACAC,IAAAA,k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rH,UAAWa,cAAAA,EAAAA,GAAab,aACrD,GAEJ,CAACa,KAGH,OACE6C,EAAA,MAAA,CACE1D,UAAWuH,EACTrC,EAAOsC,KACPrI,GAAiB+F,EAAOuC,WACvBnE,IAAoB4B,EAAOwC,UAC5B1H,GAEF,cAAaC,EAAO+E,SAEpBtB,EAACwD,GAAS,CACRxI,MAAOuD,GACPxD,QAASA,EACT0H,eAAgBA,GAChB5C,YAAaA,GACb6D,gBAAiBA,GACjBO,eAAgBC,EAChBhJ,SAAUA,EACViJ,qBAAsBjJ,EACtBkJ,cAAelJ,EACfD,SAAUmF,GACVhF,aAAc6F,GACdoD,UAAWrE,EAACsE,EAAQ,CAAC7G,KAAM,KAC3B8G,iBAAkB9I,EAClB+I,UAAWxE,EAACyE,EAAc,CAAChH,KAAM,KACjCmC,iBAAkBA,GAClB8E,UAAU,GACVC,cAAe9I,GAAoB8D,GACnC7D,cAAegG,GACf9F,SAAUA,EACVC,kBAAmBuG,GACnBE,WAAYA,GACZrE,WAAYnD,EAAWmD,QAAaI,EACpCpC,cAAe4G,GACfnG,QAASoG,GACTnG,YAAaA,GACb6H,aAAW,EACXC,eAAgB7H,GAChBmG,QAASA,GACTE,kBAAmBA,GACnByB,iBAAkBvH,SAAAA,GAAoBwH,KAI9C,EAiBaC,EAAe,SAI1BrB,GAAqC,OAClChJ,SAAmCgJ,GAAK,GAAA,CAAE3F,QAAQ,IAAQ,EAQlDiH,EAAmB,SAI9BtB,GAAyC,OACtChJ,SAAmCgJ,GAAK,GAAA,CAAE3F,QAAQ,IAAO,EAE9DiH,EAAiBC,uBAAyB,CACxCC,QAAS/I,EACTgJ,eAAgBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarControls.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/DatePicker/CalendarControls/CalendarControls.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAwB,MAAM,OAAO,CAAC;AAYvE,OAAO,EAAE,sBAAsB,EAAgB,MAAM,UAAU,CAAC;AAIhE,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAE9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAWF,eAAO,MAAM,gBAAgB,kEAQ1B,qBAAqB,4CAsJvB,CAAC"}
1
+ {"version":3,"file":"CalendarControls.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/DatePicker/CalendarControls/CalendarControls.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAwB,MAAM,OAAO,CAAC;AAYvE,OAAO,EAAE,sBAAsB,EAAgB,MAAM,UAAU,CAAC;AAIhE,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAE9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAaF,eAAO,MAAM,gBAAgB,kEAQ1B,qBAAqB,4CA0MvB,CAAC"}
@@ -1,2 +1,2 @@
1
- import{useCallback as o,useMemo as s}from"react";import n from"moment";import c from"classnames";import{ButtonIcon as i}from"../../ButtonIcon/ButtonIcon.js";import{LeftSmallIcon as t,RightSmallIcon as e}from"../../../icons/iconParkIcons.js";import"../../../icons/customIcons/icons/AddMessage.js";import"../../../icons/customIcons/icons/DragOne.js";import"../../../icons/customIcons/icons/Attention.js";import"../../../icons/customIcons/icons/Collapse.js";import"../../../icons/customIcons/icons/Dashboard.js";import"../../../icons/customIcons/icons/Expand.js";import"../../../icons/customIcons/icons/FolderClosed.js";import"../../../icons/customIcons/icons/FolderClosedFilled.js";import"../../../icons/customIcons/icons/FolderOpened.js";import"../../../icons/customIcons/icons/GreaterOrEqual.js";import"../../../icons/customIcons/icons/LessOrEqual.js";import"../../../icons/customIcons/icons/Search.js";import"../../../icons/customIcons/icons/SearchOne.js";import"../../../icons/customIcons/icons/Wellhub.js";import"../../../icons/customIcons/icons/MultiRuler.js";import"../../../icons/customIcons/icons/Checkbox.js";import"../../../icons/customIcons/icons/CheckboxChecked.js";import"../../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../../icons/customIcons/icons/Radio.js";import"../../../icons/customIcons/icons/RadioChecked.js";import"../../../icons/customIcons/icons/SimulFrac.js";import"../../../icons/customIcons/icons/ZipperFrac.js";import"../../../icons/customIcons/icons/CautionFilled.js";import"../../../icons/customIcons/icons/InfoRounded.js";import"../../../icons/customIcons/icons/FlameFilled.js";import"../../../icons/customIcons/icons/MoreApp.js";import"../../../icons/customIcons/icons/Pad.js";import"../../../icons/customIcons/icons/DrilloutUnit.js";import"../../../icons/customIcons/icons/FracFleet.js";import"../../../icons/customIcons/icons/Global.js";import"../../../icons/customIcons/icons/Program.js";import"../../../icons/customIcons/icons/Rig.js";import"../../../icons/customIcons/icons/Well.js";import"../../../icons/customIcons/icons/Gap.js";import"../../../icons/customIcons/icons/Pin.js";import"../../../icons/customIcons/icons/CloseOneFilled.js";import"../../../icons/customIcons/icons/AttentionFilled.js";import"../../../icons/customIcons/icons/CheckOneFilled.js";import"../../../icons/customIcons/icons/Archive.js";import"../../../icons/customIcons/icons/ArchiveCancel.js";import"../../../icons/customIcons/icons/Unarchive.js";import"../../../icons/customIcons/icons/Archived.js";import"../../../icons/customIcons/icons/InterventionUnit.js";import"../../../icons/customIcons/icons/CloudDelete.js";import"../../../icons/customIcons/icons/Lasso.js";import"../../../icons/customIcons/icons/Radius.js";import"../../../icons/customIcons/icons/ErrorOps.js";import"../../../icons/customIcons/icons/DataTypeOps.js";import"../../../icons/customIcons/icons/FalsePositiveOps.js";import"../../../icons/customIcons/icons/CalibrationOps.js";import"../../../icons/customIcons/icons/CriticalOps.js";import"../../../icons/customIcons/icons/Company.js";import"../../../icons/customIcons/icons/ArchiveOne.js";import"../../../icons/customIcons/icons/ParseBotFusion.js";import"../../../icons/customIcons/icons/Connect.js";import"../../../icons/customIcons/icons/PuzzleOne.js";import"../../../icons/customIcons/icons/Feed.js";import"../../../icons/customIcons/icons/Prompt.js";import"../../../icons/customIcons/icons/Companies.js";import"../../../icons/customIcons/icons/ClipboardAi.js";import"../../../icons/customIcons/icons/Key.js";import"../../../icons/customIcons/icons/AtSignCrossed.js";import"../../../icons/customIcons/icons/MappingManual.js";import"../../../icons/customIcons/icons/Mapping.js";import"../../../icons/customIcons/icons/Metrics.js";import"../../../icons/customIcons/icons/Drops.js";import"../../../icons/customIcons/icons/ClipboardSearch.js";import"../../../icons/customIcons/icons/Template.js";import"../../../icons/customIcons/icons/ClipboardMetrics.js";import"../../../icons/customIcons/icons/ClipboardBuilder.js";import"../../../icons/customIcons/icons/UnitConversion.js";import"../../../icons/customIcons/icons/NPT.js";import"../../../icons/customIcons/icons/GuidedFrac.js";import{AutocompleteNext as r}from"../../Autocomplete/Autocomplete.js";import{Tooltip as m}from"../../Tooltip/Tooltip.js";import{MonthOptions as u}from"../utils.js";import a from"./CalendarControls.scss.js";import{jsxs as p,jsx as l}from"react/jsx-runtime";var I={inputContainer:a.selectInputContainer,input:a.selectInput,suffix:a.suffix},j=function(o){return o.fullTitle},d=function(d){var f=d.date,h=d.setDate,C=d.minDate,g=d.maxDate,O=d.view,D=void 0===O?"month":O,F=d.testId,b=d.className,v=o((function(){return h((function(o){return n(o).startOf("month").add(1,"year"===D?"year":"month").toDate()}))}),[h,D]),T=o((function(){return h((function(o){return n(o).startOf("month").subtract(1,"year"===D?"year":"month").toDate()}))}),[h,D]),y=s((function(){return f.getMonth()+1}),[f]),N=s((function(){return f.getFullYear()}),[f]),A=s((function(){for(var o=(new Date).getFullYear()-10,s=(new Date).getFullYear()+10,c=[],i=o;i<=s;i+=1){var t=new Date(i,0,1);(!g||t.getTime()<=g.getTime())&&(!C||t.getTime()>=n(C).startOf("year").toDate().getTime())&&c.push({id:i,title:String(i)})}return c}),[g,C]),x=s((function(){return u.filter((function(o){var s=o.id,c=new Date(N,s-1,1);return(!g||c.getTime()<=g.getTime())&&(!C||c.getTime()>=n(C).startOf("month").toDate().getTime())}))}),[g,C,N]),P=o((function(o){o&&h((function(s){return n(s).startOf("month").set("month",Number(o.id)-1).toDate()}))}),[h]),w=o((function(o){o&&h((function(s){var c=n(s).startOf("month").set("year",Number(o.id)).toDate();return C&&C.getTime()>=c.getTime()?C:g&&g.getTime()<=c.getTime()?g:c}))}),[h,C,g]),k=s((function(){return!!g&&n(g).startOf("month").toDate().getTime()<=f.getTime()}),[f,g]),M=s((function(){return!!C&&n(C).startOf("month").toDate().getTime()>=n(f).startOf("month").toDate().getTime()}),[f,C]);return p("div",{className:c(a.root,b),"data-testid":F,children:[l(m,{title:"year"===D?"Previous year":"Previous month",children:l(i,{size:"small",onClick:T,disabled:M,children:l(t,{})})}),p("div",{className:a.selects,children:["year"!==D&&l(r,{className:a.select,clearable:!1,disableFiltering:!0,options:x,value:y,onChange:P,disabled:x.length<=1,elementsClassNames:I,dropdownClassName:c(a.dropdown,a.monthsDropdown),renderOption:j}),l(r,{className:a.select,clearable:!1,disableFiltering:!0,options:A,value:N,onChange:w,disabled:A.length<=1,elementsClassNames:I,dropdownClassName:a.dropdown})]}),l(m,{title:"year"===D?"Next year":"Next month",children:l(i,{size:"small",onClick:v,disabled:k,children:l(e,{})})})]})};export{d as CalendarControls};
1
+ import{useCallback as o,useMemo as s}from"react";import t from"moment";import n from"classnames";import{ButtonIcon as i}from"../../ButtonIcon/ButtonIcon.js";import{DoubleLeftIcon as c,LeftIcon as e,RightIcon as r,DoubleRightIcon as m}from"../../../icons/iconParkIcons.js";import"../../../icons/customIcons/icons/AddMessage.js";import"../../../icons/customIcons/icons/DragOne.js";import"../../../icons/customIcons/icons/Attention.js";import"../../../icons/customIcons/icons/Collapse.js";import"../../../icons/customIcons/icons/Dashboard.js";import"../../../icons/customIcons/icons/Expand.js";import"../../../icons/customIcons/icons/FolderClosed.js";import"../../../icons/customIcons/icons/FolderClosedFilled.js";import"../../../icons/customIcons/icons/FolderOpened.js";import"../../../icons/customIcons/icons/GreaterOrEqual.js";import"../../../icons/customIcons/icons/LessOrEqual.js";import"../../../icons/customIcons/icons/Search.js";import"../../../icons/customIcons/icons/SearchOne.js";import"../../../icons/customIcons/icons/Wellhub.js";import"../../../icons/customIcons/icons/MultiRuler.js";import"../../../icons/customIcons/icons/Checkbox.js";import"../../../icons/customIcons/icons/CheckboxChecked.js";import"../../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../../icons/customIcons/icons/Radio.js";import"../../../icons/customIcons/icons/RadioChecked.js";import"../../../icons/customIcons/icons/SimulFrac.js";import"../../../icons/customIcons/icons/ZipperFrac.js";import"../../../icons/customIcons/icons/CautionFilled.js";import"../../../icons/customIcons/icons/InfoRounded.js";import"../../../icons/customIcons/icons/FlameFilled.js";import"../../../icons/customIcons/icons/MoreApp.js";import"../../../icons/customIcons/icons/Pad.js";import"../../../icons/customIcons/icons/DrilloutUnit.js";import"../../../icons/customIcons/icons/FracFleet.js";import"../../../icons/customIcons/icons/Global.js";import"../../../icons/customIcons/icons/Program.js";import"../../../icons/customIcons/icons/Rig.js";import"../../../icons/customIcons/icons/Well.js";import"../../../icons/customIcons/icons/Gap.js";import"../../../icons/customIcons/icons/Pin.js";import"../../../icons/customIcons/icons/CloseOneFilled.js";import"../../../icons/customIcons/icons/AttentionFilled.js";import"../../../icons/customIcons/icons/CheckOneFilled.js";import"../../../icons/customIcons/icons/Archive.js";import"../../../icons/customIcons/icons/ArchiveCancel.js";import"../../../icons/customIcons/icons/Unarchive.js";import"../../../icons/customIcons/icons/Archived.js";import"../../../icons/customIcons/icons/InterventionUnit.js";import"../../../icons/customIcons/icons/CloudDelete.js";import"../../../icons/customIcons/icons/Lasso.js";import"../../../icons/customIcons/icons/Radius.js";import"../../../icons/customIcons/icons/ErrorOps.js";import"../../../icons/customIcons/icons/DataTypeOps.js";import"../../../icons/customIcons/icons/FalsePositiveOps.js";import"../../../icons/customIcons/icons/CalibrationOps.js";import"../../../icons/customIcons/icons/CriticalOps.js";import"../../../icons/customIcons/icons/Company.js";import"../../../icons/customIcons/icons/ArchiveOne.js";import"../../../icons/customIcons/icons/ParseBotFusion.js";import"../../../icons/customIcons/icons/Connect.js";import"../../../icons/customIcons/icons/PuzzleOne.js";import"../../../icons/customIcons/icons/Feed.js";import"../../../icons/customIcons/icons/Prompt.js";import"../../../icons/customIcons/icons/Companies.js";import"../../../icons/customIcons/icons/ClipboardAi.js";import"../../../icons/customIcons/icons/Key.js";import"../../../icons/customIcons/icons/AtSignCrossed.js";import"../../../icons/customIcons/icons/MappingManual.js";import"../../../icons/customIcons/icons/Mapping.js";import"../../../icons/customIcons/icons/Metrics.js";import"../../../icons/customIcons/icons/Drops.js";import"../../../icons/customIcons/icons/ClipboardSearch.js";import"../../../icons/customIcons/icons/Template.js";import"../../../icons/customIcons/icons/ClipboardMetrics.js";import"../../../icons/customIcons/icons/ClipboardBuilder.js";import"../../../icons/customIcons/icons/UnitConversion.js";import"../../../icons/customIcons/icons/NPT.js";import"../../../icons/customIcons/icons/GuidedFrac.js";import{AutocompleteNext as a}from"../../Autocomplete/Autocomplete.js";import{Tooltip as u}from"../../Tooltip/Tooltip.js";import{MonthOptions as p}from"../utils.js";import l from"./CalendarControls.scss.js";import{jsxs as d,jsx as I}from"react/jsx-runtime";var j={inputContainer:l.selectInputContainer,input:l.selectInput,suffix:l.suffix},f=function(o){return o.fullTitle},h={className:l.popper},g=function(g){var C=g.date,O=g.setDate,D=g.minDate,T=g.maxDate,b=g.view,F=void 0===b?"month":b,v=g.testId,y=g.className,N=o((function(){return O((function(o){return t(o).startOf("month").subtract(1,"month").toDate()}))}),[O]),P=o((function(){return O((function(o){return t(o).startOf("month").add(1,"month").toDate()}))}),[O]),A=o((function(){return O((function(o){return t(o).startOf("month").subtract(1,"year").toDate()}))}),[O]),k=o((function(){return O((function(o){return t(o).startOf("month").add(1,"year").toDate()}))}),[O]),x=s((function(){return!!D&&t(D).startOf("month").toDate().getTime()>=t(C).startOf("month").toDate().getTime()}),[C,D]),w=s((function(){return!!T&&t(T).startOf("month").toDate().getTime()<=C.getTime()}),[C,T]),M=s((function(){return!!D&&("month"===F?t(D).startOf("month").toDate().getTime()>=t(C).subtract(1,"year").endOf("month").toDate().getTime():t(D).startOf("month").toDate().getTime()>=t(C).startOf("year").toDate().getTime())}),[C,D,F]),z=s((function(){return!!T&&("month"===F?t(T).endOf("month").toDate().getTime()<=t(C).add(1,"year").startOf("month").toDate().getTime():t(T).startOf("year").toDate().getTime()<=t(C).startOf("year").toDate().getTime())}),[C,T,F]),R=s((function(){return C.getMonth()+1}),[C]),S=s((function(){return C.getFullYear()}),[C]),B=s((function(){for(var o=(new Date).getFullYear()-10,s=(new Date).getFullYear()+10,n=[],i=o;i<=s;i+=1){var c=new Date(i,0,1);(!T||c.getTime()<=T.getTime())&&(!D||c.getTime()>=t(D).startOf("year").toDate().getTime())&&n.push({id:i,title:String(i)})}return n}),[T,D]),E=s((function(){return p.filter((function(o){var s=o.id,n=new Date(S,s-1,1);return(!T||n.getTime()<=T.getTime())&&(!D||n.getTime()>=t(D).startOf("month").toDate().getTime())}))}),[T,D,S]),G=o((function(o){o&&O((function(s){return t(s).startOf("month").set("month",Number(o.id)-1).toDate()}))}),[O]),U=o((function(o){o&&O((function(s){var n=t(s).startOf("month").set("year",Number(o.id)).toDate();return D&&D.getTime()>=n.getTime()?D:T&&T.getTime()<=n.getTime()?T:n}))}),[O,D,T]);return d("div",{className:n(l.root,y),"data-testid":v,children:[I(u,{title:"Previous year",children:I(i,{size:"small",onClick:A,disabled:M,children:I("month"===F?c:e,{})})}),"month"===F&&I(u,{title:"Previous month",children:I(i,{size:"small",onClick:N,disabled:x,children:I(e,{})})}),d("div",{className:l.selects,children:["year"!==F&&I(a,{className:l.select,clearable:!1,disableFiltering:!0,options:E,value:R,onChange:G,disabled:E.length<=1,elementsClassNames:j,dropdownClassName:n(l.dropdown,l.monthsDropdown),renderOption:f,popperProps:h}),I(a,{className:l.select,clearable:!1,disableFiltering:!0,options:B,value:S,onChange:U,disabled:B.length<=1,elementsClassNames:j,dropdownClassName:l.dropdown,popperProps:h})]}),"month"===F&&I(u,{title:"Next month",children:I(i,{size:"small",onClick:P,disabled:w,children:I(r,{})})}),I(u,{title:"Next year",children:I(i,{size:"small",onClick:k,disabled:z,children:I("month"===F?m:r,{})})})]})};export{g as CalendarControls};
2
2
  //# sourceMappingURL=CalendarControls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarControls.js","sources":["../../../../src/componentsV2/DatePicker/CalendarControls/CalendarControls.tsx"],"sourcesContent":["import { Dispatch, SetStateAction, useCallback, useMemo } from 'react';\nimport moment from 'moment';\nimport classNames from 'classnames';\n\nimport { ButtonIcon } from '../../ButtonIcon';\nimport { LeftSmallIcon, RightSmallIcon } from '../../../icons';\nimport {\n AutocompleteChangeHandler,\n AutocompleteNext,\n AutocompleteNextProps,\n} from '../../Autocomplete';\nimport { Tooltip } from '../../Tooltip';\nimport { DatePickerCalendarView, MonthOptions } from '../utils';\n\nimport styles from './CalendarControls.scss';\n\nexport type CalendarControlsProps = {\n /**\n * Calendar shown date\n */\n date: Date;\n setDate: Dispatch<SetStateAction<Date>>;\n minDate?: Date;\n maxDate?: Date;\n view?: DatePickerCalendarView;\n\n className?: string;\n testId?: string;\n};\n\nconst SelectElementsClassNames: AutocompleteNextProps['elementsClassNames'] = {\n inputContainer: styles.selectInputContainer,\n input: styles.selectInput,\n suffix: styles.suffix,\n};\n\nconst renderMonthOption = ({ fullTitle }: typeof MonthOptions[number]) => fullTitle;\n\n// ⚠️ Part of public API, exported as DatePicker.Controls\nexport const CalendarControls = ({\n date,\n setDate,\n minDate,\n maxDate,\n view = 'month',\n testId,\n className,\n}: CalendarControlsProps) => {\n const shiftForward = useCallback(\n () =>\n setDate(current =>\n moment(current)\n .startOf('month')\n .add(1, view === 'year' ? 'year' : 'month')\n .toDate()\n ),\n [setDate, view]\n );\n\n const shiftBackward = useCallback(\n () =>\n setDate(current =>\n moment(current)\n .startOf('month')\n .subtract(1, view === 'year' ? 'year' : 'month')\n .toDate()\n ),\n [setDate, view]\n );\n\n const currentMonth = useMemo(() => date.getMonth() + 1, [date]);\n const currentYear = useMemo(() => date.getFullYear(), [date]);\n\n const yearOptions = useMemo(() => {\n const shift = 10;\n const minYear = new Date().getFullYear() - shift;\n const maxYear = new Date().getFullYear() + shift;\n const result = [];\n\n for (let i = minYear; i <= maxYear; i += 1) {\n const yearStart = new Date(i, 0, 1);\n if (\n (!maxDate || yearStart.getTime() <= maxDate.getTime()) &&\n (!minDate || yearStart.getTime() >= moment(minDate).startOf('year').toDate().getTime())\n ) {\n result.push({ id: i, title: String(i) });\n }\n }\n\n return result;\n }, [maxDate, minDate]);\n\n const monthOptions = useMemo(() => {\n return MonthOptions.filter(({ id }) => {\n const monthStart = new Date(currentYear, id - 1, 1);\n\n return (\n (!maxDate || monthStart.getTime() <= maxDate.getTime()) &&\n (!minDate || monthStart.getTime() >= moment(minDate).startOf('month').toDate().getTime())\n );\n });\n }, [maxDate, minDate, currentYear]);\n\n const onSelectMonth = useCallback<AutocompleteChangeHandler>(\n value => {\n if (value) {\n setDate(current =>\n moment(current)\n .startOf('month')\n .set('month', Number(value.id) - 1)\n .toDate()\n );\n }\n },\n [setDate]\n );\n\n const onSelectYear = useCallback<AutocompleteChangeHandler>(\n value => {\n if (value) {\n setDate(current => {\n const possibleDate = moment(current)\n .startOf('month')\n .set('year', Number(value.id))\n .toDate();\n\n if (minDate && minDate.getTime() >= possibleDate.getTime()) {\n return minDate;\n }\n\n if (maxDate && maxDate.getTime() <= possibleDate.getTime()) {\n return maxDate;\n }\n\n return possibleDate;\n });\n }\n },\n [setDate, minDate, maxDate]\n );\n\n const isNextDisabled = useMemo(() => {\n return !!maxDate && moment(maxDate).startOf('month').toDate().getTime() <= date.getTime();\n }, [date, maxDate]);\n\n const isPrevDisabled = useMemo(() => {\n return (\n !!minDate &&\n moment(minDate).startOf('month').toDate().getTime() >=\n moment(date).startOf('month').toDate().getTime()\n );\n }, [date, minDate]);\n\n return (\n <div className={classNames(styles.root, className)} data-testid={testId}>\n <Tooltip title={view === 'year' ? 'Previous year' : 'Previous month'}>\n <ButtonIcon size=\"small\" onClick={shiftBackward} disabled={isPrevDisabled}>\n <LeftSmallIcon />\n </ButtonIcon>\n </Tooltip>\n\n <div className={styles.selects}>\n {view !== 'year' && (\n <AutocompleteNext\n className={styles.select}\n clearable={false}\n disableFiltering\n options={monthOptions}\n value={currentMonth}\n onChange={onSelectMonth}\n disabled={monthOptions.length <= 1}\n elementsClassNames={SelectElementsClassNames}\n dropdownClassName={classNames(styles.dropdown, styles.monthsDropdown)}\n renderOption={renderMonthOption}\n />\n )}\n\n <AutocompleteNext\n className={styles.select}\n clearable={false}\n disableFiltering\n options={yearOptions}\n value={currentYear}\n onChange={onSelectYear}\n disabled={yearOptions.length <= 1}\n elementsClassNames={SelectElementsClassNames}\n dropdownClassName={styles.dropdown}\n />\n </div>\n\n <Tooltip title={view === 'year' ? 'Next year' : 'Next month'}>\n <ButtonIcon size=\"small\" onClick={shiftForward} disabled={isNextDisabled}>\n <RightSmallIcon />\n </ButtonIcon>\n </Tooltip>\n </div>\n );\n};\n"],"names":["SelectElementsClassNames","inputContainer","styles","selectInputContainer","input","selectInput","suffix","renderMonthOption","_ref","fullTitle","CalendarControls","_ref2","date","setDate","minDate","maxDate","_ref2$view","view","testId","className","shiftForward","useCallback","current","moment","startOf","add","toDate","shiftBackward","subtract","currentMonth","useMemo","getMonth","currentYear","getFullYear","yearOptions","minYear","Date","maxYear","result","i","yearStart","getTime","push","id","title","String","monthOptions","MonthOptions","filter","_ref3","monthStart","onSelectMonth","value","set","Number","onSelectYear","possibleDate","isNextDisabled","isPrevDisabled","_jsxs","classNames","root","children","_jsx","Tooltip","ButtonIcon","size","onClick","disabled","LeftSmallIcon","selects","AutocompleteNext","select","clearable","disableFiltering","options","onChange","length","elementsClassNames","dropdownClassName","dropdown","monthsDropdown","renderOption","RightSmallIcon"],"mappings":"u4IA8BA,IAAMA,EAAwE,CAC5EC,eAAgBC,EAAOC,qBACvBC,MAAOF,EAAOG,YACdC,OAAQJ,EAAOI,QAGXC,EAAoB,SAAHC,GAAe,SAATC,SAAsD,EAGtEC,EAAmB,SAQHC,GAAA,IAP3BC,IAAAA,KACAC,IAAAA,QACAC,IAAAA,QACAC,IAAAA,QAAOC,EAAAL,EACPM,KAAAA,aAAO,QAAOD,EACdE,IAAAA,OACAC,IAAAA,UAEMC,EAAeC,GACnB,WAAA,OACER,GAAQ,SAAAS,GAAO,OACbC,EAAOD,GACJE,QAAQ,SACRC,IAAI,EAAY,SAATR,EAAkB,OAAS,SAClCS,WACJ,GACH,CAACb,EAASI,IAGNU,EAAgBN,GACpB,WAAA,OACER,GAAQ,SAAAS,GAAO,OACbC,EAAOD,GACJE,QAAQ,SACRI,SAAS,EAAY,SAATX,EAAkB,OAAS,SACvCS,WACJ,GACH,CAACb,EAASI,IAGNY,EAAeC,GAAQ,WAAA,OAAMlB,EAAKmB,WAAa,IAAG,CAACnB,IACnDoB,EAAcF,GAAQ,WAAA,OAAMlB,EAAKqB,gBAAe,CAACrB,IAEjDsB,EAAcJ,GAAQ,WAM1B,IALA,IACMK,GAAU,IAAIC,MAAOH,cADb,GAERI,GAAU,IAAID,MAAOH,cAFb,GAGRK,EAAS,GAENC,EAAIJ,EAASI,GAAKF,EAASE,GAAK,EAAG,CAC1C,IA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AAC7B,EAAME,IAEV,OACE6C,EAAA,MAAA,CAAKxC,UAAWyC,EAAW1D,EAAO2D,KAAM1C,GAAY,cAAaD,EAAO4C,SAAA,CACtEC,EAACC,EAAO,CAACpB,MAAgB,SAAT3B,EAAkB,gBAAkB,iBAAiB6C,SACnEC,EAACE,EAAU,CAACC,KAAK,QAAQC,QAASxC,EAAeyC,SAAUV,EAAeI,SACxEC,EAACM,EAAa,QAIlBV,EAAA,MAAA,CAAKxC,UAAWjB,EAAOoE,QAAQR,SAAA,CACnB,SAAT7C,GACC8C,EAACQ,EAAgB,CACfpD,UAAWjB,EAAOsE,OAClBC,WAAW,EACXC,kBAAgB,EAChBC,QAAS7B,EACTM,MAAOvB,EACP+C,SAAUzB,EACViB,SAAUtB,EAAa+B,QAAU,EACjCC,mBAAoB9E,EACpB+E,kBAAmBnB,EAAW1D,EAAO8E,SAAU9E,EAAO+E,gBACtDC,aAAc3E,IAIlBwD,EAACQ,EAAgB,CACfpD,UAAWjB,EAAOsE,OAClBC,WAAW,EACXC,kBAAgB,EAChBC,QAASzC,EACTkB,MAAOpB,EACP4C,SAAUrB,EACVa,SAAUlC,EAAY2C,QAAU,EAChCC,mBAAoB9E,EACpB+E,kBAAmB7E,EAAO8E,cAI9BjB,EAACC,EAAO,CAACpB,MAAgB,SAAT3B,EAAkB,YAAc,aAAa6C,SAC3DC,EAACE,EAAU,CAACC,KAAK,QAAQC,QAAS/C,EAAcgD,SAAUX,EAAeK,SACvEC,EAACoB,EAAc,UAKzB"}
1
+ {"version":3,"file":"CalendarControls.js","sources":["../../../../src/componentsV2/DatePicker/CalendarControls/CalendarControls.tsx"],"sourcesContent":["import { Dispatch, SetStateAction, useCallback, useMemo } from 'react';\nimport moment from 'moment';\nimport classNames from 'classnames';\n\nimport { ButtonIcon } from '../../ButtonIcon';\nimport { DoubleLeftIcon, DoubleRightIcon, LeftIcon, RightIcon } from '../../../icons';\nimport {\n AutocompleteChangeHandler,\n AutocompleteNext,\n AutocompleteNextProps,\n} from '../../Autocomplete';\nimport { Tooltip } from '../../Tooltip';\nimport { DatePickerCalendarView, MonthOptions } from '../utils';\n\nimport styles from './CalendarControls.scss';\n\nexport type CalendarControlsProps = {\n /**\n * Calendar shown date\n */\n date: Date;\n setDate: Dispatch<SetStateAction<Date>>;\n minDate?: Date;\n maxDate?: Date;\n view?: DatePickerCalendarView;\n\n className?: string;\n testId?: string;\n};\n\nconst SelectElementsClassNames: AutocompleteNextProps['elementsClassNames'] = {\n inputContainer: styles.selectInputContainer,\n input: styles.selectInput,\n suffix: styles.suffix,\n};\n\nconst renderMonthOption = ({ fullTitle }: typeof MonthOptions[number]) => fullTitle;\n\nconst autocompletePopperProps = { className: styles.popper };\n\n// ⚠️ Part of public API, exported as DatePicker.Controls\nexport const CalendarControls = ({\n date,\n setDate,\n minDate,\n maxDate,\n view = 'month',\n testId,\n className,\n}: CalendarControlsProps) => {\n const shiftMonthBackward = useCallback(\n () => setDate(current => moment(current).startOf('month').subtract(1, 'month').toDate()),\n [setDate]\n );\n\n const shiftMonthForward = useCallback(\n () => setDate(current => moment(current).startOf('month').add(1, 'month').toDate()),\n [setDate]\n );\n\n const shiftYearBackward = useCallback(\n () => setDate(current => moment(current).startOf('month').subtract(1, 'year').toDate()),\n [setDate]\n );\n\n const shiftYearForward = useCallback(\n () => setDate(current => moment(current).startOf('month').add(1, 'year').toDate()),\n [setDate]\n );\n\n const isPrevMonthDisabled = useMemo(() => {\n return (\n !!minDate &&\n moment(minDate).startOf('month').toDate().getTime() >=\n moment(date).startOf('month').toDate().getTime()\n );\n }, [date, minDate]);\n\n const isNextMonthDisabled = useMemo(() => {\n return !!maxDate && moment(maxDate).startOf('month').toDate().getTime() <= date.getTime();\n }, [date, maxDate]);\n\n const isPrevYearDisabled = useMemo(() => {\n if (!minDate) {\n return false;\n }\n\n if (view === 'month') {\n return (\n moment(minDate).startOf('month').toDate().getTime() >=\n moment(date).subtract(1, 'year').endOf('month').toDate().getTime()\n );\n } else {\n return (\n moment(minDate).startOf('month').toDate().getTime() >=\n moment(date).startOf('year').toDate().getTime()\n );\n }\n }, [date, minDate, view]);\n\n const isNextYearDisabled = useMemo(() => {\n if (!maxDate) {\n return false;\n }\n\n if (view === 'month') {\n return (\n moment(maxDate).endOf('month').toDate().getTime() <=\n moment(date).add(1, 'year').startOf('month').toDate().getTime()\n );\n } else {\n return (\n moment(maxDate).startOf('year').toDate().getTime() <=\n moment(date).startOf('year').toDate().getTime()\n );\n }\n }, [date, maxDate, view]);\n\n const currentMonth = useMemo(() => date.getMonth() + 1, [date]);\n const currentYear = useMemo(() => date.getFullYear(), [date]);\n\n const yearOptions = useMemo(() => {\n const shift = 10;\n const minYear = new Date().getFullYear() - shift;\n const maxYear = new Date().getFullYear() + shift;\n const result = [];\n\n for (let i = minYear; i <= maxYear; i += 1) {\n const yearStart = new Date(i, 0, 1);\n if (\n (!maxDate || yearStart.getTime() <= maxDate.getTime()) &&\n (!minDate || yearStart.getTime() >= moment(minDate).startOf('year').toDate().getTime())\n ) {\n result.push({ id: i, title: String(i) });\n }\n }\n\n return result;\n }, [maxDate, minDate]);\n\n const monthOptions = useMemo(() => {\n return MonthOptions.filter(({ id }) => {\n const monthStart = new Date(currentYear, id - 1, 1);\n\n return (\n (!maxDate || monthStart.getTime() <= maxDate.getTime()) &&\n (!minDate || monthStart.getTime() >= moment(minDate).startOf('month').toDate().getTime())\n );\n });\n }, [maxDate, minDate, currentYear]);\n\n const onSelectMonth = useCallback<AutocompleteChangeHandler>(\n value => {\n if (value) {\n setDate(current =>\n moment(current)\n .startOf('month')\n .set('month', Number(value.id) - 1)\n .toDate()\n );\n }\n },\n [setDate]\n );\n\n const onSelectYear = useCallback<AutocompleteChangeHandler>(\n value => {\n if (value) {\n setDate(current => {\n const possibleDate = moment(current)\n .startOf('month')\n .set('year', Number(value.id))\n .toDate();\n\n if (minDate && minDate.getTime() >= possibleDate.getTime()) {\n return minDate;\n }\n\n if (maxDate && maxDate.getTime() <= possibleDate.getTime()) {\n return maxDate;\n }\n\n return possibleDate;\n });\n }\n },\n [setDate, minDate, maxDate]\n );\n\n return (\n <div className={classNames(styles.root, className)} data-testid={testId}>\n <Tooltip title=\"Previous year\">\n <ButtonIcon size=\"small\" onClick={shiftYearBackward} disabled={isPrevYearDisabled}>\n {view === 'month' ? <DoubleLeftIcon /> : <LeftIcon />}\n </ButtonIcon>\n </Tooltip>\n\n {view === 'month' && (\n <Tooltip title=\"Previous month\">\n <ButtonIcon size=\"small\" onClick={shiftMonthBackward} disabled={isPrevMonthDisabled}>\n <LeftIcon />\n </ButtonIcon>\n </Tooltip>\n )}\n\n <div className={styles.selects}>\n {view !== 'year' && (\n <AutocompleteNext\n className={styles.select}\n clearable={false}\n disableFiltering\n options={monthOptions}\n value={currentMonth}\n onChange={onSelectMonth}\n disabled={monthOptions.length <= 1}\n elementsClassNames={SelectElementsClassNames}\n dropdownClassName={classNames(styles.dropdown, styles.monthsDropdown)}\n renderOption={renderMonthOption}\n popperProps={autocompletePopperProps}\n />\n )}\n\n <AutocompleteNext\n className={styles.select}\n clearable={false}\n disableFiltering\n options={yearOptions}\n value={currentYear}\n onChange={onSelectYear}\n disabled={yearOptions.length <= 1}\n elementsClassNames={SelectElementsClassNames}\n dropdownClassName={styles.dropdown}\n popperProps={autocompletePopperProps}\n />\n </div>\n\n {view === 'month' && (\n <Tooltip title=\"Next month\">\n <ButtonIcon size=\"small\" onClick={shiftMonthForward} disabled={isNextMonthDisabled}>\n <RightIcon />\n </ButtonIcon>\n </Tooltip>\n )}\n\n <Tooltip title=\"Next year\">\n <ButtonIcon size=\"small\" onClick={shiftYearForward} disabled={isNextYearDisabled}>\n {view === 'month' ? <DoubleRightIcon /> : <RightIcon />}\n </ButtonIcon>\n </Tooltip>\n </div>\n );\n};\n"],"names":["SelectElementsClassNames","inputContainer","styles","selectInputContainer","input","selectInput","suffix","renderMonthOption","_ref","fullTitle","autocompletePopperProps","className","popper","CalendarControls","_ref2","date","setDate","minDate","maxDate","_ref2$view","view","testId","shiftMonthBackward","useCallback","current","moment","startOf","subtract","toDate","shiftMonthForward","add","shiftYearBackward","shiftYearForward","isPrevMonthDisabled","useMemo","getTime","isNextMonthDisabled","isPrevYearDisabled","endOf","isNextYearDisabled","currentMonth","getMonth","currentYear","getFullYear","yearOptions","minYear","Date","maxYear","result","i","yearStart","push","id","title","String","monthOptions","MonthOptions","filter","_ref3","monthStart","onSelectMonth","value","set","Number","onSelectYear","possibleDate","_jsxs","classNames","root","children","_jsx","Tooltip","ButtonIcon","size","onClick","disabled","DoubleLeftIcon","LeftIcon","selects","AutocompleteNext","select","clearable","disableFiltering","options","onChange","length","elementsClassNames","dropdownClassName","dropdown","monthsDropdown","renderOption","popperProps","RightIcon","DoubleRightIcon"],"mappings":"s6IA8BA,IAAMA,EAAwE,CAC5EC,eAAgBC,EAAOC,qBACvBC,MAAOF,EAAOG,YACdC,OAAQJ,EAAOI,QAGXC,EAAoB,SAAHC,GAAe,SAATC,SAAsD,EAE7EC,EAA0B,CAAEC,UAAWT,EAAOU,QAGvCC,EAAmB,SAQHC,GAAA,IAP3BC,IAAAA,KACAC,IAAAA,QACAC,IAAAA,QACAC,IAAAA,QAAOC,EAAAL,EACPM,KAAAA,aAAO,QAAOD,EACdE,IAAAA,OACAV,IAAAA,UAEMW,EAAqBC,GACzB,WAAA,OAAMP,GAAQ,SAAAQ,GAAO,OAAIC,EAAOD,GAASE,QAAQ,SAASC,SAAS,EAAG,SAASC,cAC/E,CAACZ,IAGGa,EAAoBN,GACxB,WAAA,OAAMP,GAAQ,SAAAQ,GAAO,OAAIC,EAAOD,GAASE,QAAQ,SAASI,IAAI,EAAG,SAASF,cAC1E,CAACZ,IAGGe,EAAoBR,GACxB,WAAA,OAAMP,GAAQ,SAAAQ,GAAO,OAAIC,EAAOD,GAASE,QAAQ,SAASC,SAAS,EAAG,QAAQC,cAC9E,CAACZ,IAGGgB,EAAmBT,GACvB,WAAA,OAAMP,GAAQ,SAAAQ,GAAO,OAAIC,EAAOD,GA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AU,CAACC,KAAK,QAAQC,QAASpD,EAAoBqD,SAAU1C,EAAoBoC,SAClFC,EAACO,EAAQ,QAKfX,EAAA,MAAA,CAAKvD,UAAWT,EAAO4E,QAAQT,SAAA,CACnB,SAATjD,GACCkD,EAACS,EAAgB,CACfpE,UAAWT,EAAO8E,OAClBC,WAAW,EACXC,kBAAgB,EAChBC,QAAS5B,EACTM,MAAOrB,EACP4C,SAAUxB,EACVe,SAAUpB,EAAa8B,QAAU,EACjCC,mBAAoBtF,EACpBuF,kBAAmBpB,EAAWjE,EAAOsF,SAAUtF,EAAOuF,gBACtDC,aAAcnF,EACdoF,YAAajF,IAIjB4D,EAACS,EAAgB,CACfpE,UAAWT,EAAO8E,OAClBC,WAAW,EACXC,kBAAgB,EAChBC,QAASvC,EACTiB,MAAOnB,EACP0C,SAAUpB,EACVW,SAAU/B,EAAYyC,QAAU,EAChCC,mBAAoBtF,EACpBuF,kBAAmBrF,EAAOsF,SAC1BG,YAAajF,OAIP,UAATU,GACCkD,EAACC,EAAO,CAAClB,MAAM,aAAYgB,SACzBC,EAACE,EAAU,CAACC,KAAK,QAAQC,QAAS7C,EAAmB8C,SAAUvC,EAAoBiC,SACjFC,EAACsB,EAAS,QAKhBtB,EAACC,EAAO,CAAClB,MAAM,YAAWgB,SACxBC,EAACE,EAAU,CAACC,KAAK,QAAQC,QAAS1C,EAAkB2C,SAAUpC,EAAmB8B,SAC3DC,EAAV,UAATlD,EAAoByE,EAAsBD,EAAP,CAAA,SAK9C"}
@@ -1,2 +1,2 @@
1
- import n from'./../../../ext-esm/style-inject/dist/style-inject.es.js';var o={spacing:"8",root:"CalendarControls_root__B1lzU",selects:"CalendarControls_selects__gPfQ4",selectInputContainer:"CalendarControls_selectInputContainer__OWUfF",selectInput:"CalendarControls_selectInput__Wv0WK",select:"CalendarControls_select__ngFto",dropdown:"CalendarControls_dropdown__30C2C",monthsDropdown:"CalendarControls_monthsDropdown__lahqO",suffix:"CalendarControls_suffix__TCLYb"};n(".CalendarControls_root__B1lzU{align-items:center;display:flex;flex-flow:row nowrap;justify-content:space-between;padding:8px;width:320px}.CalendarControls_selects__gPfQ4{display:flex;flex-flow:row nowrap;gap:16px}.CalendarControls_selectInputContainer__OWUfF{background-color:transparent;border:none;cursor:pointer;padding:0}.CalendarControls_selectInput__Wv0WK{font-size:16px;font-weight:500;text-align:right;text-transform:uppercase}.CalendarControls_select__ngFto{display:inline-block;margin-top:1px;width:70px}.CalendarControls_dropdown__30C2C{max-height:300px!important;min-width:90px}.CalendarControls_monthsDropdown__lahqO{min-width:120px}.CalendarControls_suffix__TCLYb{right:0;top:50%;transform:translateY(-50%)}");export{o as default};
1
+ import o from'./../../../ext-esm/style-inject/dist/style-inject.es.js';var n={spacing:"8",root:"CalendarControls_root__B1lzU",selects:"CalendarControls_selects__gPfQ4",selectInputContainer:"CalendarControls_selectInputContainer__OWUfF",selectInput:"CalendarControls_selectInput__Wv0WK",select:"CalendarControls_select__ngFto",popper:"CalendarControls_popper__ZrO40",dropdown:"CalendarControls_dropdown__30C2C",monthsDropdown:"CalendarControls_monthsDropdown__lahqO",suffix:"CalendarControls_suffix__TCLYb"};o(".CalendarControls_root__B1lzU{align-items:center;display:flex;flex-flow:row nowrap;justify-content:space-between;padding:8px;width:296px}.CalendarControls_selects__gPfQ4{display:flex;flex-flow:row nowrap;gap:16px}.CalendarControls_selectInputContainer__OWUfF{background-color:transparent;border:none;cursor:pointer;padding:0}.CalendarControls_selectInput__Wv0WK{font-size:16px;font-weight:500;text-align:right;text-transform:uppercase}.CalendarControls_select__ngFto{display:inline-block;margin-top:1px;width:70px}.CalendarControls_popper__ZrO40{z-index:calc(var(--z-index-modal) + 2)!important}.CalendarControls_dropdown__30C2C{max-height:300px!important;min-width:90px}.CalendarControls_monthsDropdown__lahqO{min-width:120px}.CalendarControls_suffix__TCLYb{right:0;top:50%;transform:translateY(-50%)}");export{n as default};
2
2
  //# sourceMappingURL=CalendarControls.scss.js.map
@@ -1,2 +1,2 @@
1
- import{useMemo as t,useCallback as e}from"react";import n from"moment";import a from"classnames";import{Text as r}from"../../Text/Text.js";import{MonthOptions as o,isSameDay as i,isSameMonth as m,getMaxDate as d,getMinDate as s}from"../utils.js";import l from"./CalendarGrid.scss.js";import{jsxs as u,jsx as c}from"react/jsx-runtime";var f=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],g=function(g){var v=g.activeStartDate,h=g.setHoveredDate,T=g.minDate,p=g.maxDate,D=g.tileDisabled,y=g.onChange,b=g.view,M=void 0===b?"month":b,w=g.rangeStartDate,N=g.rangeEndDate,S=g.rangeHoveredDate,x=g.selected,C=g.getTileClassName,j=g.className,O=g.testId,E="month"===M,k=n().startOf(E?"day":"month").toDate(),A=t((function(){if(E){var t=n(v).startOf("month"),e=0===t.day()?t.subtract(6,"days"):t.startOf("week").add(1,"days");return new Array(42).fill(void 0).map((function(t,n){return e.clone().add(n,"days").toDate()}))}var a=n(v).startOf("year");return new Array(12).fill(void 0).map((function(t,e){return a.clone().add(e,"months").toDate()}))}),[v,E]),H=e((function(){return null==h?void 0:h(void 0)}),[h]);return u("div",{className:a(l.root,!E&&l.yearView,j),onMouseLeave:H,"data-testid":O,children:[E&&f.map((function(t){return c(r,{size:14,className:l.dow,children:t},t)})),A.map((function(t){var e=E?i:m,n={activeStartDate:v,date:t},r=T&&t.getTime()<(null==T?void 0:T.getTime())||p&&t.getTime()>(null==p?void 0:p.getTime())||!(null==D||!D(n)),u=!!E&&t.getMonth()!==v.getMonth(),f=e(k,t),g=e(t,x)||e(t,w)||e(t,N),b=d(N||S,w),j=s(N||S,w),O=e(j,t),A=e(b,t),H=j&&b&&j.getTime()<t.getTime()&&b.getTime()>t.getTime(),z=O||A||H;return c("button",{className:a(l.button,!E&&l.monthButton,r&&l.disabled,u&&l.neighbourMonth,f&&l.today,g&&l.selected,z&&l.range,O&&l.rangeStart,A&&l.rangeEnd,null==C?void 0:C(n)),disabled:r,onClick:function(){return y(t)},onMouseEnter:h?function(){return h(t)}:void 0,children:c("span",{className:l.buttonContent,children:"month"===M?t.getDate():o[t.getMonth()].fullTitle})},"".concat(v.getTime(),"-").concat(t.getTime()))}))]})};export{g as CalendarGrid};
1
+ import{useMemo as t,useCallback as e}from"react";import a from"moment";import n from"classnames";import{Text as r}from"../../Text/Text.js";import{MonthOptions as o,isSameDay as i,isSameMonth as m,getMaxDate as d,getMinDate as s}from"../utils.js";import l from"./CalendarGrid.scss.js";import{jsxs as u,jsx as c}from"react/jsx-runtime";var f=["Mo","Tu","We","Th","Fr","Sa","Su"],g=function(g){var v=g.activeStartDate,h=g.setHoveredDate,T=g.minDate,p=g.maxDate,D=g.tileDisabled,y=g.onChange,b=g.view,M=void 0===b?"month":b,w=g.rangeStartDate,N=g.rangeEndDate,S=g.rangeHoveredDate,x=g.selected,C=g.getTileClassName,j=g.className,O=g.testId,E="month"===M,k=a().startOf(E?"day":"month").toDate(),A=t((function(){if(E){var t=a(v).startOf("month"),e=0===t.day()?t.subtract(6,"days"):t.startOf("week").add(1,"days");return new Array(42).fill(void 0).map((function(t,a){return e.clone().add(a,"days").toDate()}))}var n=a(v).startOf("year");return new Array(12).fill(void 0).map((function(t,e){return n.clone().add(e,"months").toDate()}))}),[v,E]),H=e((function(){return null==h?void 0:h(void 0)}),[h]);return u("div",{className:n(l.root,!E&&l.yearView,j),onMouseLeave:H,"data-testid":O,children:[E&&f.map((function(t){return c(r,{size:14,className:l.dow,color:"T6",children:t},t)})),A.map((function(t){var e=E?i:m,a={activeStartDate:v,date:t},r=T&&t.getTime()<(null==T?void 0:T.getTime())||p&&t.getTime()>(null==p?void 0:p.getTime())||!(null==D||!D(a)),u=!!E&&t.getMonth()!==v.getMonth(),f=e(k,t),g=e(t,x)||e(t,w)||e(t,N),b=d(N||S,w),j=s(N||S,w),O=e(j,t),A=e(b,t),H=j&&b&&j.getTime()<t.getTime()&&b.getTime()>t.getTime(),z=O||A||H;return c("button",{className:n(l.button,!E&&l.monthButton,r&&l.disabled,u&&l.neighbourMonth,f&&l.today,g&&l.selected,z&&l.range,O&&l.rangeStart,A&&l.rangeEnd,null==C?void 0:C(a)),disabled:r,onClick:function(){return y(t)},onMouseEnter:h?function(){return h(t)}:void 0,children:c("span",{className:l.buttonContent,children:"month"===M?t.getDate():o[t.getMonth()].title})},"".concat(v.getTime(),"-").concat(t.getTime()))}))]})};export{g as CalendarGrid};
2
2
  //# sourceMappingURL=CalendarGrid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarGrid.js","sources":["../../../../src/componentsV2/DatePicker/CalendarGrid/CalendarGrid.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport moment from 'moment';\nimport classNames from 'classnames';\n\nimport { Text } from '../../Text';\nimport {\n DatePickerCalendarView,\n getMaxDate,\n getMinDate,\n isSameDay,\n isSameMonth,\n MonthOptions,\n} from '../utils';\n\nimport styles from './CalendarGrid.scss';\n\nexport type CalendarGridProps = {\n onChange: (value: Date) => void;\n activeStartDate: Date;\n view?: DatePickerCalendarView;\n setHoveredDate?: (date?: Date) => void;\n maxDate?: Date;\n minDate?: Date;\n tileDisabled?: (args: { activeStartDate: Date; date: Date }) => boolean;\n getTileClassName?: (args: { activeStartDate: Date; date: Date }) => string;\n selected?: Date;\n rangeStartDate?: Date;\n rangeEndDate?: Date;\n rangeHoveredDate?: Date;\n\n className?: string;\n testId?: string;\n};\n\nconst DoWs = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];\n\n// ⚠️ Part of public API, exported as DatePicker.Grid\nexport const CalendarGrid = ({\n activeStartDate,\n setHoveredDate,\n minDate,\n maxDate,\n tileDisabled,\n onChange,\n view = 'month',\n rangeStartDate,\n rangeEndDate,\n rangeHoveredDate,\n selected,\n getTileClassName,\n className,\n testId,\n}: CalendarGridProps) => {\n const isMonthView = view === 'month';\n\n const nowPeriodStart = moment()\n .startOf(isMonthView ? 'day' : 'month')\n .toDate();\n\n // 4 weeks from earliest monday\n const tiles = useMemo(() => {\n if (isMonthView) {\n const monthStartMoment = moment(activeStartDate).startOf('month'); // Monday\n\n const weekStartMoment =\n monthStartMoment.day() === 0\n ? monthStartMoment.subtract(6, 'days')\n : monthStartMoment\n .startOf('week') // Sunday\n .add(1, 'days');\n\n return new Array(42)\n .fill(undefined)\n .map((_, index): Date => weekStartMoment.clone().add(index, 'days').toDate());\n } else {\n const yearStartMoment = moment(activeStartDate).startOf('year');\n return new Array(12)\n .fill(undefined)\n .map((_, index) => yearStartMoment.clone().add(index, 'months').toDate());\n }\n }, [activeStartDate, isMonthView]);\n\n const clearRangeHoveredDate = useCallback(() => setHoveredDate?.(undefined), [setHoveredDate]);\n\n return (\n <div\n className={classNames(styles.root, !isMonthView && styles.yearView, className)}\n onMouseLeave={clearRangeHoveredDate}\n data-testid={testId}\n >\n {isMonthView &&\n DoWs.map(dow => (\n <Text key={dow} size={14} className={styles.dow}>\n {dow}\n </Text>\n ))}\n\n {tiles.map(date => {\n const isSame = isMonthView ? isSameDay : isSameMonth;\n const tileParams = { activeStartDate, date };\n\n const isDisabled =\n (minDate && date.getTime() < minDate?.getTime()) ||\n (maxDate && date.getTime() > maxDate?.getTime()) ||\n !!tileDisabled?.(tileParams);\n\n const isNeighbour = isMonthView ? date.getMonth() !== activeStartDate.getMonth() : false;\n\n const isToday = isSame(nowPeriodStart, date);\n\n const isSelected =\n isSame(date, selected) || isSame(date, rangeStartDate) || isSame(date, rangeEndDate);\n\n const rangeEnd = getMaxDate(rangeEndDate || rangeHoveredDate, rangeStartDate);\n const rangeStart = getMinDate(rangeEndDate || rangeHoveredDate, rangeStartDate);\n const isRangeStart = isSame(rangeStart, date);\n const isRangeEnd = isSame(rangeEnd, date);\n const isInRange =\n rangeStart &&\n rangeEnd &&\n rangeStart.getTime() < date.getTime() &&\n rangeEnd.getTime() > date.getTime();\n const isRange = isRangeStart || isRangeEnd || isInRange;\n\n return (\n <button\n className={classNames(\n styles.button,\n !isMonthView && styles.monthButton,\n isDisabled && styles.disabled,\n isNeighbour && styles.neighbourMonth,\n isToday && styles.today,\n isSelected && styles.selected,\n isRange && styles.range,\n isRangeStart && styles.rangeStart,\n isRangeEnd && styles.rangeEnd,\n getTileClassName?.(tileParams)\n )}\n key={`${activeStartDate.getTime()}-${date.getTime()}`}\n disabled={isDisabled}\n onClick={() => onChange(date)}\n onMouseEnter={setHoveredDate ? () => setHoveredDate(date) : undefined}\n >\n <span className={styles.buttonContent}>\n {view === 'month' ? date.getDate() : MonthOptions[date.getMonth()].fullTitle}\n </span>\n </button>\n );\n })}\n </div>\n );\n};\n"],"names":["DoWs","CalendarGrid","_ref","activeStartDate","setHoveredDate","minDate","maxDate","tileDisabled","onChange","_ref$view","view","rangeStartDate","rangeEndDate","rangeHoveredDate","selected","getTileClassName","className","testId","isMonthView","nowPeriodStart","moment","startOf","toDate","tiles","useMemo","monthStartMoment","weekStartMoment","day","subtract","add","Array","fill","undefined","map","_","index","clone","yearStartMoment","clearRangeHoveredDate","useCallback","_jsxs","classNames","styles","root","yearView","onMouseLeave","children","dow","_jsx","Text","size","date","isSame","isSameDay","isSameMonth","tileParams","isDisabled","getTime","isNeighbour","getMonth","isToday","isSelected","rangeEnd","getMaxDate","rangeStart","getMinDate","isRangeStart","isRangeEnd","isInRange","isRange","button","monthButton","disabled","neighbourMonth","today","range","onClick","onMouseEnter","buttonContent","getDate","MonthOptions","fullTitle"],"mappings":"8UAkCA,IAAMA,EAAO,CAAC,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,OAG3CC,EAAe,SAeHC,GAAA,IAdvBC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,QACAC,IAAAA,QACAC,IAAAA,aACAC,IAAAA,SAAQC,EAAAP,EACRQ,KAAAA,aAAO,QAAOD,EACdE,IAAAA,eACAC,IAAAA,aACAC,IAAAA,iBACAC,IAAAA,SACAC,IAAAA,iBACAC,IAAAA,UACAC,IAAAA,OAEMC,EAAuB,UAATR,EAEdS,EAAiBC,IACpBC,QAAQH,EAAc,MAAQ,SAC9BI,SAGGC,EAA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,GAAgBC,EAAkBF,GACxDqD,EAAaC,EAAWrD,GAAgBC,EAAkBF,GAC1DuD,EAAed,EAAOY,EAAYb,GAClCgB,EAAaf,EAAOU,EAAUX,GAC9BiB,EACJJ,GACAF,GACAE,EAAWP,UAAYN,EAAKM,WAC5BK,EAASL,UAAYN,EAAKM,UACtBY,EAAUH,GAAgBC,GAAcC,EAE9C,OACEpB,EAAA,SAAA,CACEhC,UAAWyB,EACTC,EAAO4B,QACNpD,GAAewB,EAAO6B,YACvBf,GAAcd,EAAO8B,SACrBd,GAAehB,EAAO+B,eACtBb,GAAWlB,EAAOgC,MAClBb,GAAcnB,EAAO5B,SACrBuD,GAAW3B,EAAOiC,MAClBT,GAAgBxB,EAAOsB,WACvBG,GAAczB,EAAOoB,SACrB/C,aAAAA,EAAAA,EAAmBwC,IAGrBiB,SAAUhB,EACVoB,QAAS,WAAA,OAAMpE,EAAS2C,EAAM,EAC9B0B,aAAczE,EAAiB,WAAA,OAAMA,EAAe+C,EAAK,OAAGnB,EAAUc,SAEtEE,EAAA,OAAA,CAAMhC,UAAW0B,EAAOoC,cAAchC,SAC1B,UAATpC,EAAmByC,EAAK4B,UAAYC,EAAa7B,EAAKQ,YAAYsB,aAN7D9E,GAAAA,OAAAA,EAAgBsD,sBAAaN,EAAKM,WAUhD,MAGN"}
1
+ {"version":3,"file":"CalendarGrid.js","sources":["../../../../src/componentsV2/DatePicker/CalendarGrid/CalendarGrid.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport moment from 'moment';\nimport classNames from 'classnames';\n\nimport { Text } from '../../Text';\nimport {\n DatePickerCalendarView,\n getMaxDate,\n getMinDate,\n isSameDay,\n isSameMonth,\n MonthOptions,\n} from '../utils';\n\nimport styles from './CalendarGrid.scss';\n\nexport type CalendarGridProps = {\n onChange: (value: Date) => void;\n activeStartDate: Date;\n view?: DatePickerCalendarView;\n setHoveredDate?: (date?: Date) => void;\n maxDate?: Date;\n minDate?: Date;\n tileDisabled?: (args: { activeStartDate: Date; date: Date }) => boolean;\n getTileClassName?: (args: { activeStartDate: Date; date: Date }) => string;\n selected?: Date;\n rangeStartDate?: Date;\n rangeEndDate?: Date;\n rangeHoveredDate?: Date;\n\n className?: string;\n testId?: string;\n};\n\nconst DoWs = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];\n\n// ⚠️ Part of public API, exported as DatePicker.Grid\nexport const CalendarGrid = ({\n activeStartDate,\n setHoveredDate,\n minDate,\n maxDate,\n tileDisabled,\n onChange,\n view = 'month',\n rangeStartDate,\n rangeEndDate,\n rangeHoveredDate,\n selected,\n getTileClassName,\n className,\n testId,\n}: CalendarGridProps) => {\n const isMonthView = view === 'month';\n\n const nowPeriodStart = moment()\n .startOf(isMonthView ? 'day' : 'month')\n .toDate();\n\n // 4 weeks from earliest monday\n const tiles = useMemo(() => {\n if (isMonthView) {\n const monthStartMoment = moment(activeStartDate).startOf('month'); // Monday\n\n const weekStartMoment =\n monthStartMoment.day() === 0\n ? monthStartMoment.subtract(6, 'days')\n : monthStartMoment\n .startOf('week') // Sunday\n .add(1, 'days');\n\n return new Array(42)\n .fill(undefined)\n .map((_, index): Date => weekStartMoment.clone().add(index, 'days').toDate());\n } else {\n const yearStartMoment = moment(activeStartDate).startOf('year');\n return new Array(12)\n .fill(undefined)\n .map((_, index) => yearStartMoment.clone().add(index, 'months').toDate());\n }\n }, [activeStartDate, isMonthView]);\n\n const clearRangeHoveredDate = useCallback(() => setHoveredDate?.(undefined), [setHoveredDate]);\n\n return (\n <div\n className={classNames(styles.root, !isMonthView && styles.yearView, className)}\n onMouseLeave={clearRangeHoveredDate}\n data-testid={testId}\n >\n {isMonthView &&\n DoWs.map(dow => (\n <Text key={dow} size={14} className={styles.dow} color=\"T6\">\n {dow}\n </Text>\n ))}\n\n {tiles.map(date => {\n const isSame = isMonthView ? isSameDay : isSameMonth;\n const tileParams = { activeStartDate, date };\n\n const isDisabled =\n (minDate && date.getTime() < minDate?.getTime()) ||\n (maxDate && date.getTime() > maxDate?.getTime()) ||\n !!tileDisabled?.(tileParams);\n\n const isNeighbour = isMonthView ? date.getMonth() !== activeStartDate.getMonth() : false;\n\n const isToday = isSame(nowPeriodStart, date);\n\n const isSelected =\n isSame(date, selected) || isSame(date, rangeStartDate) || isSame(date, rangeEndDate);\n\n const rangeEnd = getMaxDate(rangeEndDate || rangeHoveredDate, rangeStartDate);\n const rangeStart = getMinDate(rangeEndDate || rangeHoveredDate, rangeStartDate);\n const isRangeStart = isSame(rangeStart, date);\n const isRangeEnd = isSame(rangeEnd, date);\n const isInRange =\n rangeStart &&\n rangeEnd &&\n rangeStart.getTime() < date.getTime() &&\n rangeEnd.getTime() > date.getTime();\n const isRange = isRangeStart || isRangeEnd || isInRange;\n\n return (\n <button\n className={classNames(\n styles.button,\n !isMonthView && styles.monthButton,\n isDisabled && styles.disabled,\n isNeighbour && styles.neighbourMonth,\n isToday && styles.today,\n isSelected && styles.selected,\n isRange && styles.range,\n isRangeStart && styles.rangeStart,\n isRangeEnd && styles.rangeEnd,\n getTileClassName?.(tileParams)\n )}\n key={`${activeStartDate.getTime()}-${date.getTime()}`}\n disabled={isDisabled}\n onClick={() => onChange(date)}\n onMouseEnter={setHoveredDate ? () => setHoveredDate(date) : undefined}\n >\n <span className={styles.buttonContent}>\n {view === 'month' ? date.getDate() : MonthOptions[date.getMonth()].title}\n </span>\n </button>\n );\n })}\n </div>\n );\n};\n"],"names":["DoWs","CalendarGrid","_ref","activeStartDate","setHoveredDate","minDate","maxDate","tileDisabled","onChange","_ref$view","view","rangeStartDate","rangeEndDate","rangeHoveredDate","selected","getTileClassName","className","testId","isMonthView","nowPeriodStart","moment","startOf","toDate","tiles","useMemo","monthStartMoment","weekStartMoment","day","subtract","add","Array","fill","undefined","map","_","index","clone","yearStartMoment","clearRangeHoveredDate","useCallback","_jsxs","classNames","styles","root","yearView","onMouseLeave","children","dow","_jsx","Text","size","color","date","isSame","isSameDay","isSameMonth","tileParams","isDisabled","getTime","isNeighbour","getMonth","isToday","isSelected","rangeEnd","getMaxDate","rangeStart","getMinDate","isRangeStart","isRangeEnd","isInRange","isRange","button","monthButton","disabled","neighbourMonth","today","range","onClick","onMouseEnter","buttonContent","getDate","MonthOptions","title"],"mappings":"8UAkCA,IAAMA,EAAO,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,MAGrCC,EAAe,SAeHC,GAAA,IAdvBC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,QACAC,IAAAA,QACAC,IAAAA,aACAC,IAAAA,SAAQC,EAAAP,EACRQ,KAAAA,aAAO,QAAOD,EACdE,IAAAA,eACAC,IAAAA,aACAC,IAAAA,iBACAC,IAAAA,SACAC,IAAAA,iBACAC,IAAAA,UACAC,IAAAA,OAEMC,EAAuB,UAATR,EAEdS,EAAiBC,IACpBC,QAAQH,EAAc,MAAQ,SAC9BI,SAGGC,EAAQC,GAAQ,WACpB,GAAIN,EAAa,CACf,IAAMO,EAAmBL,EAAOjB,GAAiBkB,QAAQ,SAEnDK,EACuB,IAA3BD,EAAiBE,MACbF,EAAiBG,SAAS,EAAG,QAC7BH,EACGJ,QAAQ,QACRQ,IAAI,EAAG,QAEhB,OAAO,IAAIC,MAAM,IACdC,UAAKC,GACLC,KAAI,SAACC,EAAGC,GAAK,OAAWT,EAAgBU,QAAQP,IAAIM,EAAO,QAAQb,WACxE,CACE,IAAMe,EAAkBjB,EAAOjB,GAAiBkB,QAAQ,QACxD,OAAO,IAAIS,MAAM,IACdC,UAAKC,GACLC,KAAI,SAACC,EAAGC,GAAK,OAAKE,EAAgBD,QAAQP,IAAIM,EAAO,UAAUb,WAEtE,GAAG,CAACnB,EAAiBe,IAEfoB,EAAwBC,GAAY,WAAA,OAAMnC,eAAAA,OAAiB4B,KAAY,CAAC5B,IAE9E,OACEoC,EAAA,MAAA,CACExB,UAAWyB,EAAWC,EAAOC,MAAOzB,GAAewB,EAAOE,SAAU5B,GACpE6B,aAAcP,EACd,cAAarB,EAAO6B,SAAA,CAE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AAOqC,cAAcjC,SAC1B,UAATpC,EAAmB0C,EAAK4B,UAAYC,EAAa7B,EAAKQ,YAAYsB,SAN7D/E,GAAAA,OAAAA,EAAgBuD,sBAAaN,EAAKM,WAUhD,MAGN"}
@@ -1,2 +1,2 @@
1
- import r from'./../../../ext-esm/style-inject/dist/style-inject.es.js';var e={spacing:"8",root:"CalendarGrid_root__fvX0f",yearView:"CalendarGrid_yearView__TSlCV",dow:"CalendarGrid_dow__59Krn",button:"CalendarGrid_button__MhWHl",monthButton:"CalendarGrid_monthButton__66gNn",disabled:"CalendarGrid_disabled__n2rm2",neighbourMonth:"CalendarGrid_neighbourMonth__RNirJ",today:"CalendarGrid_today__--HqO",selected:"CalendarGrid_selected__F-b13",range:"CalendarGrid_range__Z17Z-",rangeStart:"CalendarGrid_rangeStart__DOTSX",rangeEnd:"CalendarGrid_rangeEnd__3VzoI",buttonContent:"CalendarGrid_buttonContent__eNBhK"};r('.CalendarGrid_root__fvX0f{align-content:center;display:flex;flex-flow:row wrap;font-family:Roboto,sans-serif;max-width:100%;padding:8px 0 16px;width:280px}.CalendarGrid_yearView__TSlCV{gap:16px 0;height:264px;padding:0}.CalendarGrid_button__MhWHl,.CalendarGrid_dow__59Krn{line-height:40px;text-align:center;width:40px}.CalendarGrid_button__MhWHl{background:transparent;border:none;color:var(--palette-primary-text-1);cursor:pointer;font:inherit;font-size:14px;font-weight:400;height:40px;outline:none;padding:0;position:relative;transition:color .15s cubic-bezier(.4,0,.2,1);user-select:none}.CalendarGrid_button__MhWHl:hover{--DatePicker-tileColor:var(--palette-background-b-9)}.CalendarGrid_button__MhWHl:active{--DatePicker-tileColor:var(--palette-background-b-10)}.CalendarGrid_button__MhWHl:after{background:var(--DatePicker-tileColor);border-radius:8px;content:"";inset:4px;position:absolute;transition:background .15s cubic-bezier(.4,0,.2,1);z-index:0}.CalendarGrid_monthButton__66gNn{width:33.3333%}.CalendarGrid_disabled__n2rm2{cursor:auto;pointer-events:none}.CalendarGrid_disabled__n2rm2,.CalendarGrid_neighbourMonth__RNirJ{color:var(--palette-primary-text-9)}.CalendarGrid_today__--HqO{color:var(--palette-primary-main)}.CalendarGrid_selected__F-b13,.CalendarGrid_selected__F-b13:active,.CalendarGrid_selected__F-b13:hover{--DatePicker-tileColor:var(--palette-primary-main);color:var(--palette-background-b-4)}.CalendarGrid_range__Z17Z-:before{background:rgb(from var(--palette-primary-main) r g b/.08);content:"";inset:4px 0;position:absolute;z-index:0}.CalendarGrid_rangeStart__DOTSX:before{border-bottom-left-radius:8px;border-top-left-radius:8px;left:4px}.CalendarGrid_rangeEnd__3VzoI:before{border-bottom-right-radius:8px;border-top-right-radius:8px;right:4px}.CalendarGrid_buttonContent__eNBhK{position:relative;z-index:1}');export{e as default};
1
+ import r from'./../../../ext-esm/style-inject/dist/style-inject.es.js';var e={spacing:"8",root:"CalendarGrid_root__fvX0f",yearView:"CalendarGrid_yearView__TSlCV",dow:"CalendarGrid_dow__59Krn",button:"CalendarGrid_button__MhWHl",monthButton:"CalendarGrid_monthButton__66gNn",disabled:"CalendarGrid_disabled__n2rm2",neighbourMonth:"CalendarGrid_neighbourMonth__RNirJ",today:"CalendarGrid_today__--HqO",selected:"CalendarGrid_selected__F-b13",range:"CalendarGrid_range__Z17Z-",rangeStart:"CalendarGrid_rangeStart__DOTSX",rangeEnd:"CalendarGrid_rangeEnd__3VzoI",buttonContent:"CalendarGrid_buttonContent__eNBhK"};r('.CalendarGrid_root__fvX0f{align-content:center;display:flex;flex-flow:row wrap;font-family:Roboto,sans-serif;max-width:100%;padding:8px 0;width:280px}.CalendarGrid_yearView__TSlCV{gap:16px 0;height:264px;padding:0}.CalendarGrid_dow__59Krn{line-height:20px;text-align:center;width:40px}.CalendarGrid_button__MhWHl{background:transparent;border:none;color:var(--palette-primary-text-1);cursor:pointer;font:inherit;font-size:14px;font-weight:400;height:40px;line-height:40px;outline:none;padding:0;position:relative;text-align:center;transition:color .15s cubic-bezier(.4,0,.2,1);user-select:none;width:40px}.CalendarGrid_button__MhWHl:hover{--DatePicker-tileColor:rgb(from var(--palette-primary-text-1) r g b/0.08)}.CalendarGrid_button__MhWHl:active{--DatePicker-tileColor:rgb(from var(--palette-primary-text-1) r g b/0.16)}.CalendarGrid_button__MhWHl:after{background:var(--DatePicker-tileColor);border-radius:8px;content:"";inset:4px;position:absolute;transition:background .15s cubic-bezier(.4,0,.2,1);z-index:0}.CalendarGrid_monthButton__66gNn{width:33.3333%}.CalendarGrid_disabled__n2rm2{cursor:auto;pointer-events:none}.CalendarGrid_disabled__n2rm2,.CalendarGrid_neighbourMonth__RNirJ{color:var(--palette-primary-text-9)}.CalendarGrid_today__--HqO{color:var(--palette-primary-main)}.CalendarGrid_selected__F-b13,.CalendarGrid_selected__F-b13:active,.CalendarGrid_selected__F-b13:hover{--DatePicker-tileColor:var(--palette-primary-main);color:var(--palette-background-b-4)}.CalendarGrid_range__Z17Z-:before{background:rgb(from var(--palette-primary-main) r g b/.08);content:"";inset:4px 0;position:absolute;z-index:0}.CalendarGrid_rangeStart__DOTSX:before{border-bottom-left-radius:8px;border-top-left-radius:8px;left:4px}.CalendarGrid_rangeEnd__3VzoI:before{border-bottom-right-radius:8px;border-top-right-radius:8px;right:4px}.CalendarGrid_buttonContent__eNBhK{position:relative;z-index:1}');export{e as default};
2
2
  //# sourceMappingURL=CalendarGrid.scss.js.map
@@ -2,7 +2,7 @@ import { ReactElement, ReactNode } from 'react';
2
2
  import { TextInputNextProps } from '../TextInputNext';
3
3
  import { CalendarControls } from './CalendarControls';
4
4
  import { DatePickerChangeHandler, DatePickerType, DatePickerValue } from './utils';
5
- import { CalendarGrid } from './CalendarGrid/CalendarGrid';
5
+ import { CalendarGrid } from './CalendarGrid';
6
6
  type DatePickerBaseProps<IsRange extends boolean | undefined = false> = {
7
7
  label?: ReactNode;
8
8
  placeholder?: string;
@@ -55,6 +55,9 @@ type DatePickerBaseProps<IsRange extends boolean | undefined = false> = {
55
55
  testId?: string;
56
56
  isNext: boolean;
57
57
  };
58
+ /**
59
+ * Returns start date for calendar. Must return `value` if it falls into min-max range.
60
+ */
58
61
  export declare const getActiveStartDate: <IsRange extends boolean | undefined = false>({ value, minDate, maxDate, }: Pick<DatePickerBaseProps<IsRange>, 'value' | 'minDate' | 'maxDate'>) => Date;
59
62
  export type DatePickerProps<IsRange extends boolean | undefined = false> = Omit<DatePickerBaseProps<IsRange>, 'labelPlacement' | 'size' | 'elementsClassNames' | 'isNext'>;
60
63
  type DatePickerBaseType = {
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/componentsV2/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAqD,MAAM,OAAO,CAAC;AAInG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAEL,uBAAuB,EACvB,cAAc,EACd,eAAe,EAIhB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAI9E,KAAK,mBAAmB,CAAC,OAAO,SAAS,OAAO,GAAG,SAAS,GAAG,KAAK,IAAI;IACtE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAC5C;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,eAAe,EAAE,IAAI,CAAC;QAAC,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5D,CAAC;AAIF,KAAK,kBAAkB,GAAG;IACxB,CAAC,OAAO,SAAS,OAAO,GAAG,SAAS,GAAG,KAAK,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC;IAC7F,QAAQ,EAAE,OAAO,gBAAgB,CAAC;IAClC,IAAI,EAAE,OAAO,YAAY,CAAC;CAC3B,CAAC;AAOF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAwB,kBAAkB,CAAC;AAElE,MAAM,MAAM,mBAAmB,CAAC,OAAO,SAAS,OAAO,GAAG,SAAS,GAAG,KAAK,IAAI,IAAI,CACjF,mBAAmB,CAAC,OAAO,CAAC,EAC5B,QAAQ,CACT,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,CAAC,OAAO,SAAS,OAAO,GAAG,SAAS,GAAG,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC;IACjG,QAAQ,EAAE,OAAO,gBAAgB,CAAC;IAClC,IAAI,EAAE,OAAO,YAAY,CAAC;CAC3B,CAAC;AAOF,eAAO,MAAM,cAAc,EAAyB,sBAAsB,CAAC"}
@@ -1,2 +1,2 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/slicedToArray";import{useRef as t,useState as a,useCallback as n,useMemo as i,useEffect as o}from"react";import l from"moment";import{Popover as s}from"../Popover/Popover.js";import{CalendarControls as m}from"./CalendarControls/CalendarControls.js";import{TimePicker as c}from"./TimePicker/TimePicker.js";import{Input as u}from"./Input/Input.js";import{applyOffsetSeconds as d,getMinDate as f,getMaxDate as v}from"./utils.js";import{CalendarGrid as p}from"./CalendarGrid/CalendarGrid.js";import D from"./DatePicker.scss.js";import{jsxs as y,Fragment as b,jsx as h}from"react/jsx-runtime";function g(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function O(r){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?g(Object(a),!0).forEach((function(t){e(r,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):g(Object(a)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(a,e))}))}return r}var T=function(e){var r=e.value,t=e.minDate,a=e.maxDate,n=(Array.isArray(r)?r[0]:r)||new Date;return t&&n.getTime()<t.getTime()?t:a&&n.getTime()>a.getTime()?a:n},j=function(e){var g=e.label,O=e.value,j=e.maxDate,C=e.minDate,P=e.className,N=e.testId,x=e.onChange,w=e.readOnly,A=e.type,E=void 0===A?"date":A,k=e.range,G=e.getTileClassName,I=e.getTileDisabled,S=e.placeholder,z=e.format,H=e.focusOnClear,V=void 0===H||H,q=e.labelPlacement,B=void 0===q?"top":q,F=e.size,J=void 0===F?"small":F,K=e.elementsClassNames,L=e.isNext,M=e.clearable,Q=void 0===M||M,R=t(null),U=t(null),W=a(!1),X=r(W,2),Y=X[0],Z=X[1],$=a(T({maxDate:j,minDate:C,value:O})),_=r($,2),ee=_[0],re=_[1],te=a(),ae=r(te,2),ne=ae[0],ie=ae[1],oe=a("startDate"),le=r(oe,2),se=le[0],me=le[1],ce=a(),ue=r(ce,2),de=ue[0],fe=ue[1],ve=a(),pe=r(ve,2),De=pe[0],ye=pe[1],be="dateTime"===E&&!!k,he=a(),ge=r(he,2),Oe=ge[0],Te=ge[1],je=n((function(){ie(void 0),me("startDate"),fe(void 0),ye(void 0)}),[]),Ce=n((function(){return Z(!0)}),[]),Pe=n((function(){je(),Z(!1)}),[je]),Ne=i((function(){return k?void 0:ne||O}),[k,ne,O]),xe=i((function(){return!be||"startTime"!==se&&"endTime"!==se?Ne&&!Array.isArray(Ne)?Ne:void 0:De||de}),[be,se,Ne,De,de]),we=n((function(e,r){var t;"startDate"===r||"startTime"===r?(me("startTime"),fe(e),ye(void 0)):"endDate"!==r&&"endTime"!==r||(me("endTime"),ye(e)),null===(t=U.current)||void 0===t||t.flash()}),[]),Ae=n((function(e,r,t,a){if("endDate"===t){var n=l(e).endOf("month"===a?"month":"day").toDate(),i=f(n,r),o=v(n,r);return i&&o?[i,o]:void 0}"startDate"===t&&(fe(e),ye(void 0),me("endDate"))}),[]),Ee=n((function(e){if(Array.isArray(e)||!e)throw new Error("Value is array or `null`, but should not be");if(be)we(e,se);else if("dateTime"===E){var r;ie(e),null===(r=U.current)||void 0===r||r.flash()}else if(k){var t=Ae(e,de,se,E);t&&(null==x||x(t),Pe())}else!k&&e&&(null==x||x(e),Pe())}),[be,E,k,we,se,Ae,de,x,Pe]),ke=n((function(e){if(be){if("startTime"===se)me("endDate"),fe((function(r){return r&&d(r,e)}));else if("endTime"===se&&De&&de){var r=d(De,e);null==x||x(de<r?[de,r]:[r,de]),Pe()}}else if(Ne&&!Array.isArray(Ne)){var t=d(Ne,e);null==x||x(t),Pe()}}),[be,Ne,se,De,de,x,Pe]);return o((function(){if(Y){var e=Array.isArray(O);re(T({maxDate:j,minDate:C,value:O})),k&&e&&O[0]&&O[1]&&(fe(O[0]),ye(O[1]),me("startDate"))}}),[Y,O,C,j,k]),y(b,{children:[h(u,{open:Ce,isOpen:Y,className:P,testId:N,value:O,label:g,placeholder:S,ref:R,format:z,range:k,type:E,setValue:x,readOnly:w,focusOnClear:V,labelPlacement:B,size:J,elementsClassNames:K,isNext:L,clearable:Q}),ee&&y(s,{anchorEl:R.current,onClose:Pe,open:Y,className:D.popover,children:[y("div",{children:[h(m,{date:ee,setDate:re,minDate:C,maxDate:j,view:"month"===E?"year":"month",className:D.controls}),h(p,{onChange:Ee,activeStartDate:ee,view:"month"===E?"year":"month",maxDate:j,minDate:C,tileDisabled:I,selected:Ne,rangeStartDate:de,rangeEndDate:De,rangeHoveredDate:"endDate"===se?Oe:void 0,setHoveredDate:Te,getTileClassName:G,className:D.grid})]}),"dateTime"===E&&h(c,{value:xe,onChange:ke,ref:U})]})]})},C=function(e){return j(O(O({},e),{},{isNext:!1}))};C.Controls=m,C.Grid=p;var P=C,N=function(e){return j(O(O({},e),{},{isNext:!0}))};N.Controls=m,N.Grid=p;var x=N;export{P as DatePicker,x as DatePickerNext,T as getActiveStartDate};
1
+ import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import{useRef as r,useState as a,useCallback as n,useMemo as i,useEffect as o}from"react";import l from"moment";import{Popover as s}from"../Popover/Popover.js";import{CalendarControls as m}from"./CalendarControls/CalendarControls.js";import{Input as u}from"./Input/Input.js";import{getDateWithSameTime as c,isSameDay as f,getMinDate as d,getMaxDate as p}from"./utils.js";import{CalendarGrid as v}from"./CalendarGrid/CalendarGrid.js";import{TimePicker as D}from"./TimePicker/TimePicker.js";import g from"./DatePicker.scss.js";import{jsxs as y,Fragment as b,jsx as O}from"react/jsx-runtime";function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function h(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?T(Object(a),!0).forEach((function(r){e(t,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):T(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}var j=function(e){var t=e.value,r=e.minDate,a=e.maxDate,n=(Array.isArray(t)?t[0]:t)||new Date;return r&&n.getTime()<r.getTime()?r:a&&n.getTime()>a.getTime()?a:n},C=function(e){var T=e.label,h=e.value,C=e.maxDate,P=e.minDate,x=e.className,N=e.testId,w=e.onChange,A=e.readOnly,S=e.type,k=void 0===S?"date":S,G=e.range,I=e.getTileClassName,E=e.getTileDisabled,z=e.placeholder,R=e.format,V=e.focusOnClear,q=void 0===V||V,B=e.labelPlacement,F=void 0===B?"top":B,H=e.size,J=void 0===H?"small":H,K=e.elementsClassNames,L=e.isNext,M=e.clearable,Q=void 0===M||M,U=r(null),W=a(!1),X=t(W,2),Y=X[0],Z=X[1],$=a(j({maxDate:C,minDate:P,value:h})),_=t($,2),ee=_[0],te=_[1],re=a(),ae=t(re,2),ne=ae[0],ie=ae[1],oe=a("startDate"),le=t(oe,2),se=le[0],me=le[1],ue=a(Array.isArray(h)?h[0]:void 0),ce=t(ue,2),fe=ce[0],de=ce[1],pe=a(Array.isArray(h)?h[1]:void 0),ve=t(pe,2),De=ve[0],ge=ve[1],ye="dateTime"===k&&!!G,be=n((function(){ie(void 0),me("startDate")}),[]),Oe=n((function(){Y||(be(),Z(!0))}),[be,Y]),Te=n((function(){be(),Z(!1)}),[be]),he=n((function(){var e,t;G&&fe&&De&&(fe.getTime()!==(null==h||null===(e=h[0])||void 0===e?void 0:e.getTime())||De.getTime()!==(null==h||null===(t=h[1])||void 0===t?void 0:t.getTime()))?null==w||w(fe<De?[fe,De]:[De,fe]):ne&&ne.getTime()!==(null==h?void 0:h.getTime())&&(null==w||w(ne)),Te()}),[Te,w,G,De,fe,ne,h]),je=i((function(){return G?"startDate"===se?fe:De:ne||h}),[G,De,fe,se,ne,h]),Ce=n((function(e){"startDate"===e&&fe?te(fe):De&&te(De),me(e)}),[De,fe]),Pe=n((function(e,t){"startDate"===t?de((function(t){return c(e,t)})):"endDate"===t&&ge((function(t){return c(e,t)}))}),[]),xe=n((function(e,t,r,a){if("endDate"===r){var n=l(e).endOf("month"===a?"month":"day").toDate(),i=d(n,t),o=p(n,t);return i&&o?[i,o]:void 0}"startDate"===r&&(de(e),Ce("endDate"))}),[Ce]),Ne=n((function(e){if(ye)Pe(e,se);else if("dateTime"===k)ie(c(e,je));else if(G){var t=xe(e,fe,se,k);t&&(null==w||w(t),Te())}else G||(null==w||w(e),Te())}),[ye,k,G,Pe,se,je,xe,fe,w,Te]),we=n((function(e){ye?"startDate"===se?de(e):ge(e):je&&ie(e)}),[ye,je,se]),Ae=n((function(){if(ye){if("startDate"===se)Ce("endDate");else if(fe&&De){null==w||w(fe<De?[fe,De]:[De,fe]),Te()}}else je&&(null==w||w(je),Te())}),[Ce,Te,je,ye,w,De,fe,se]),Se=i((function(){var e=new Date,t=j({maxDate:C,minDate:P,value:e});return Y&&f(t,e)?function(){return te(t)}:void 0}),[Y,C,P]),ke=i((function(){if(("startDate"!==se||fe)&&("endDate"!==se||De))return function(){"startDate"===se?de(void 0):ge(void 0),te(j({maxDate:C,minDate:P}))}}),[C,P,De,fe,se]);return o((function(){Y&&te(j({maxDate:C,minDate:P,value:h}));var e=Array.isArray(h);G&&(de(e?h[0]:void 0),ge(e?h[1]:void 0),me("startDate"))}),[Y,h,P,C,G]),y(b,{children:[O(u,{open:Oe,isOpen:Y,className:x,testId:N,value:G?[fe,De]:h,label:T,placeholder:z,ref:U,format:R,range:G,rangeStep:se,setRangeStep:Ce,type:k,setValue:w,readOnly:A,focusOnClear:q,labelPlacement:F,size:J,elementsClassNames:K,isNext:L,clearable:Q}),ee&&y(s,{anchorEl:U.current,onClose:he,open:Y,className:g.popover,popperClassName:g.popper,children:[O(m,{date:ee,setDate:te,minDate:P,maxDate:C,view:"month"===k?"year":"month",className:g.controls}),O(v,{onChange:Ne,activeStartDate:ee,view:"month"===k?"year":"month",maxDate:C,minDate:P,tileDisabled:E,selected:je,getTileClassName:I,className:g.grid}),"dateTime"===k&&O(D,{value:je,onChange:we,maxDate:C,minDate:P,clear:ke,goToToday:Se,saveTime:Ae})]})]})},P=function(e){return C(h(h({},e),{},{isNext:!1}))};P.Controls=m,P.Grid=v;var x=P,N=function(e){return C(h(h({},e),{},{isNext:!0}))};N.Controls=m,N.Grid=v;var w=N;export{x as DatePicker,w as DatePickerNext,j as getActiveStartDate};
2
2
  //# sourceMappingURL=DatePicker.js.map