{"version":3,"file":"TimePicker-CZZqigTA.js","sources":["../../Client/legacy/Components/FormGroups/TimePicker.tsx"],"sourcesContent":["import { Value } from '@webkit/index';\r\nimport dayjs from 'dayjs';\r\nimport * as React from 'react';\r\nimport { DropdownItem } from '../../FormFields';\r\nimport { IFormGroupProps } from './Base';\r\nimport { DropdownFormGroup } from './Dropdown';\r\n\r\nconst TIME_FORMAT = 'h:mm A';\r\n\r\nexport interface ITimePickerFormGroupProps extends IFormGroupProps {\r\n    /** The value containing input properties and validation state. */\r\n    value: Value<dayjs.Dayjs>;\r\n\r\n    /** The change handler responsible for returning the selected time to the caller. */\r\n    onChange: (item: dayjs.Dayjs) => void;\r\n\r\n    /** An optional CSS class for the input field. */\r\n    inputClassName?: string;\r\n\r\n    /** An optional CSS class for the input label field. Use .hide-dropdown-label-ly to hide the label  */\r\n    labelClassName?: string;\r\n\r\n    /** An optional placeholder string for the input field. */\r\n    placeholder?: string;\r\n\r\n    /** An optional error message that gets displayed to the user. */\r\n    error?: string | boolean | null;\r\n\r\n    /** An optional custom error component that gets displayed to the user instead of the standard error component. */\r\n    customError?: any;\r\n\r\n    /** An optional CSS selector for the DOM element into which the time picker selector is rendered. */\r\n    portalSelector?: string;\r\n\r\n    /** An optional tab index for keyboard navigation. */\r\n    tabIndex?: number;\r\n\r\n    /** An optional validation that limits time options up to the current hour if the date chosen matches today's date  */\r\n    selectedDate?: dayjs.Dayjs;\r\n\r\n    /** An optional flag to disable the input if a certain condition is met (passed to DropdownFormGroup as props) */\r\n    disabled?: boolean;\r\n}\r\n\r\n/**\r\n * @deprecated The `TimePickerFormGroup` component should no longer be used. Instead, use `TimePicker` from @webkit for new development.\r\n */\r\nexport class TimePickerFormGroup extends React.Component<ITimePickerFormGroupProps, {}> {\r\n    render() {\r\n        const p = this.props;\r\n        return (\r\n            <div>\r\n                <DropdownFormGroup\r\n                    {...p}\r\n                    className={`form-group-time-picker-cp ${p.className || ''}`}\r\n                    options={this.buildTimeOptions(p.selectedDate)}\r\n                    scrollable={true}\r\n                    onChange={(item: DropdownItem) => this.props.onChange(dayjs(item.value, TIME_FORMAT))}\r\n                    displayModifier={time => (time ? dayjs(time).format(TIME_FORMAT) : '')}\r\n                    inputClassName='time-picker-value-cp'\r\n                    labelClassName={p.labelClassName}\r\n                    disabled={p.disabled}\r\n                    id={p.id}\r\n                />\r\n                <img src='/images/clock.svg' className='form-group-time-picker-icon-cp' alt='Choose a Time' />\r\n            </div>\r\n        );\r\n    }\r\n\r\n    private buildTimeOptions(selected?: dayjs.Dayjs): DropdownItem[] {\r\n        const max = dayjs(),\r\n            items: DropdownItem[] = [];\r\n\r\n        let count = 0;\r\n        for (\r\n            let time = dayjs(selected).startOf('d');\r\n            time.isBefore(max) && count++ < 48;\r\n            time = time.add(30, 'minutes')\r\n        )\r\n            items.push(new DropdownItem(time.format(TIME_FORMAT)));\r\n\r\n        return items;\r\n    }\r\n}\r\n"],"names":["TIME_FORMAT","TimePickerFormGroup","React.Component","p","jsx","DropdownFormGroup","item","dayjs","time","selected","max","items","count","DropdownItem"],"mappings":"6KAOA,MAAMA,EAAc,SAwCP,MAAAC,UAA4BC,EAAAA,SAA+C,CACpF,QAAS,CACL,MAAMC,EAAI,KAAK,MACf,cACK,MACG,CAAA,SAAA,CAAAC,EAAA,IAACC,EAAA,CACI,GAAGF,EACJ,UAAW,6BAA6BA,EAAE,WAAa,EAAE,GACzD,QAAS,KAAK,iBAAiBA,EAAE,YAAY,EAC7C,WAAY,GACZ,SAAWG,GAAuB,KAAK,MAAM,SAASC,EAAMD,EAAK,MAAON,CAAW,CAAC,EACpF,mBAA0BQ,EAAOD,EAAMC,CAAI,EAAE,OAAOR,CAAW,EAAI,GACnE,eAAe,uBACf,eAAgBG,EAAE,eAClB,SAAUA,EAAE,SACZ,GAAIA,EAAE,EAAA,CACV,QACC,MAAI,CAAA,IAAI,oBAAoB,UAAU,iCAAiC,IAAI,eAAgB,CAAA,CAAA,EAChG,CAAA,CAIA,iBAAiBM,EAAwC,CAC7D,MAAMC,EAAMH,IACRI,EAAwB,CAAC,EAE7B,IAAIC,EAAQ,EACZ,QACQJ,EAAOD,EAAME,CAAQ,EAAE,QAAQ,GAAG,EACtCD,EAAK,SAASE,CAAG,GAAKE,IAAU,GAChCJ,EAAOA,EAAK,IAAI,GAAI,SAAS,EAE7BG,EAAM,KAAK,IAAIE,EAAaL,EAAK,OAAOR,CAAW,CAAC,CAAC,EAElD,OAAAW,CAAA,CAEf"}