"use strict";var e=require("react"),t=require("tailwind-merge"),a=require("../../../assets/ArrowDownHeadIcon.cjs");require("tslib");var r=require("../../../assets/CalendarIcon.cjs"),l=require("../../../assets/XCircleIcon.cjs"),n=require("../../../lib/constants.cjs"),o=require("../../../lib/shape.cjs"),s=require("../../../lib/sizing.cjs"),i=require("../../../lib/spacing.cjs"),c=require("../../../lib/font.cjs"),d=require("../../../lib/theme.cjs"),g=require("../../../lib/utils.cjs"),u=require("./dateRangePickerUtils.cjs"),m=require("../selectUtils.cjs");function w(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=w(e);module.exports=({value:e,options:w,placeholder:C,disabled:h,calendarRef:p,showCalendar:b,setShowCalendar:R,onCalendarKeyDown:N,enableDropdown:D,dropdownRef:k,showDropdown:x,setShowDropdown:P,onDropdownKeyDown:j,locale:q,dropdownPlaceholder:v="Select",enableClear:B,onClear:M})=>{var E;const[S,y,z]=e,L=null!=(S||y),T=m.hasValue(z),X=L?u.formatSelectedDates(S,y,q):C,O=z?String(null===(E=w.find((e=>e.value===z)))||void 0===E?void 0:E.text):v;return f.default.createElement("div",{className:t.twMerge(u.makeDateRangePickerClassName("button"),"flex items-center justify-between",g.getColorClassNames("white").bgColor,o.borderRadius.md.all,o.boxShadow.sm)},f.default.createElement("button",{type:"button",ref:p,onClick:()=>R(!b),onKeyDown:N,className:t.twMerge(u.makeDateRangePickerClassName("calendarButton"),"flex items-center w-full truncate focus:outline-none focus:ring-2",m.getSelectButtonColors(L,h),D?o.border.none.right:t.twMerge(o.borderRadius.md.right,o.border.sm.right),g.getColorClassNames(n.BaseColors.Blue,d.colorPalette.lightRing).focusRingColor,i.spacing.twoXl.paddingX,i.spacing.sm.paddingY,o.borderRadius.md.left,o.border.sm.all),disabled:h},f.default.createElement(r,{className:t.twMerge(u.makeDateRangePickerClassName("calendarButtonIcon"),"flex-none",g.getColorClassNames(d.DEFAULT_COLOR,d.colorPalette.lightText).textColor,s.sizing.lg.height,s.sizing.lg.width,i.spacing.threeXs.negativeMarginLeft,i.spacing.lg.marginRight),"aria-hidden":"true"}),f.default.createElement("p",{className:t.twMerge(u.makeDateRangePickerClassName("calendarButtonText"),"whitespace-nowrap truncate w-full text-start",c.fontSize.sm,c.fontWeight.md)},X),B&&L?f.default.createElement("div",{role:"button",className:t.twMerge(u.makeDateRangePickerClassName("resetButton"),i.spacing.xs.marginRight),onClick:e=>{e.stopPropagation(),M()}},f.default.createElement(l,{className:t.twMerge("flex-none",s.sizing.md.height,s.sizing.md.width,g.getColorClassNames(d.DEFAULT_COLOR,d.colorPalette.lightText).textColor),"aria-hidden":"true"})):null),D?f.default.createElement("button",{type:"button",ref:k,onClick:()=>P(!x),className:t.twMerge(u.makeDateRangePickerClassName("dropdownButton"),"inline-flex justify-between w-48 truncate focus:outline-none focus:ring-2",m.getSelectButtonColors(T,h),g.getColorClassNames(n.BaseColors.Blue,d.colorPalette.lightRing).focusRingColor,i.spacing.twoXl.paddingX,i.spacing.sm.paddingY,i.spacing.px.negativeMarginLeft,o.borderRadius.md.right,o.border.sm.all),onKeyDown:j,disabled:h},f.default.createElement("p",{className:t.twMerge(u.makeDateRangePickerClassName("dropdownButtonText"),"whitespace-nowrap truncate",c.fontSize.sm,c.fontWeight.md)},O),f.default.createElement(a,{className:t.twMerge(u.makeDateRangePickerClassName("dropdownButtonIcon"),"flex-none",s.sizing.lg.height,s.sizing.lg.width,i.spacing.twoXs.negativeMarginRight,g.getColorClassNames(d.DEFAULT_COLOR,d.colorPalette.lightText).textColor),"aria-hidden":"true"})):null)};
