{"version":3,"file":"Dropdown-DFIa1r5e.js","sources":["../../Client/legacy/Components/FormGroups/Dropdown.tsx"],"sourcesContent":["import { simpleDateFormat } from '@shared/Constants';\r\nimport { Value } from '@webkit/index';\r\nimport dayjs from 'dayjs';\r\nimport * as React from 'react';\r\nimport { DefaultDropdownType, Dropdown, DropdownItem, InlineError } from '../../FormFields';\r\nimport { IFormGroupProps } from './Base';\r\n\r\nexport interface IDropdownFormGroupProps<TValue = DefaultDropdownType> extends IFormGroupProps {\r\n /** The value containing input properties and validation state. */\r\n value: Value<TValue>;\r\n\r\n /** The change handler for the dropdown. */\r\n onChange: (item: DropdownItem<TValue>) => void;\r\n\r\n /** The list of options that will show up in the dropdown. */\r\n options: DropdownItem[];\r\n\r\n /** The optional CSS class for the label. */\r\n labelClassName?: string;\r\n\r\n /** The optional CSS class for the input field. */\r\n inputClassName?: string;\r\n\r\n /** The optional placeholder that is shown before the user has selected an option. */\r\n placeholder?: string;\r\n\r\n /** The optional error message. */\r\n error?: string | boolean | null;\r\n\r\n /** An optional error component to be displayed instead of the standard error control. */\r\n customError?: any;\r\n\r\n /** An optional selector for the portal element into which the dropdown selector will be rendered. */\r\n portalSelector?: string;\r\n\r\n /** An optional ID for the portal element into which the dropdown selector will be rendered. */\r\n portalId?: string;\r\n\r\n /** An optional flag indicating whether or not the dropdown selector should be scrollable. */\r\n scrollable?: boolean;\r\n\r\n /** An optional tab index for supporting keyboard navigation. */\r\n tabIndex?: number;\r\n\r\n /** An optional flag indicating whether text input is allowed. */\r\n textInput?: boolean;\r\n\r\n /** An optional modifier method that transforms the selected dropdown item's value for showing to the user. */\r\n displayModifier?: (item: TValue) => string;\r\n\r\n /** An optional modifier method for transforming the displayed text for each item in the selector. */\r\n optionModifier?: (item: DropdownItem) => string;\r\n\r\n //** An optional flag to disable the input if a certain condition is met */\r\n disabled?: boolean;\r\n\r\n /** Optional icon */\r\n icon?: any;\r\n\r\n /** Optional class for the dropdown selector. */\r\n selectorClassName?: string;\r\n\r\n /** Optional title attribute */\r\n title?: string;\r\n\r\n /** Optional. An event handler for the focus event. */\r\n onFocus?: () => void;\r\n\r\n /** Optional. An event handler for the blur event. */\r\n onBlur?: () => void;\r\n\r\n /** Optional. The name set on the underlying input field. */\r\n name?: string;\r\n\r\n /** Optional. An optional flag to disable browser auto-complete. */\r\n autoComplete?: boolean;\r\n}\r\n\r\n/**\r\n * @deprecated The `DropdownFormGroup` component should no longer be used. Instead, use `Select` and `SelectItem` from @webkit for new development.\r\n */\r\nexport class DropdownFormGroup<TValue = DefaultDropdownType> extends React.Component<\r\n IDropdownFormGroupProps<TValue>,\r\n {}\r\n> {\r\n dropDown: Dropdown;\r\n\r\n render() {\r\n const p = this.props;\r\n\r\n return (\r\n <Dropdown\r\n ref={c => {\r\n this.dropDown = c as Dropdown;\r\n }}\r\n value={\r\n (this.props.displayModifier\r\n ? this.props.displayModifier(p.value.content)\r\n : dayjs.isDayjs(p.value.content)\r\n ? (p.value.content as dayjs.Dayjs).format(simpleDateFormat)\r\n : p.value.content) as DefaultDropdownType\r\n }\r\n onChange={p.onChange.bind(this)}\r\n options={p.options}\r\n label={p.label}\r\n className={`form-group-cp ${p.className || ''}`}\r\n disabled={p.disabled}\r\n labelClassName={`form-group-label-cp ${p.labelClassName || ''}`}\r\n inputClassName={`form-group-input-cp ${p.inputClassName || ''} ${\r\n p.value.error ? 'form-group-input-error-cp' : ''\r\n }`}\r\n placeholder={p.placeholder}\r\n portalSelector={p.portalSelector}\r\n portalId={p.portalId}\r\n scrollable={p.scrollable}\r\n tabIndex={p.tabIndex}\r\n textInput={p.textInput || false}\r\n customError={\r\n <InlineError className='dropdown-error-ly' error={p.error === undefined ? p.value.error : ''} />\r\n }\r\n optionModifier={this.props.optionModifier}\r\n error={p.error === undefined ? !!p.value.error : p.error}\r\n id={p.id}\r\n name={p.name}\r\n icon={p.icon}\r\n selectorClassName={p.selectorClassName}\r\n title={p.title}\r\n loading={p.loading}\r\n onFocus={p.onFocus}\r\n onBlur={p.onBlur}\r\n autoComplete={p.autoComplete}\r\n />\r\n );\r\n }\r\n}\r\n"],"names":["DropdownFormGroup","React.Component","__publicField","p","jsx","Dropdown","c","dayjs","simpleDateFormat","InlineError"],"mappings":"gVAiFa,MAAAA,UAAwDC,EAAAA,SAGnE,CAHW,kCAITC,EAAA,iBAEA,QAAS,CACL,MAAMC,EAAI,KAAK,MAGX,OAAAC,EAAA,IAACC,EAAA,CACG,IAAUC,GAAA,CACN,KAAK,SAAWA,CACpB,EACA,MACK,KAAK,MAAM,gBACN,KAAK,MAAM,gBAAgBH,EAAE,MAAM,OAAO,EAC1CI,EAAM,QAAQJ,EAAE,MAAM,OAAO,EAC5BA,EAAE,MAAM,QAAwB,OAAOK,CAAgB,EACxDL,EAAE,MAAM,QAElB,SAAUA,EAAE,SAAS,KAAK,IAAI,EAC9B,QAASA,EAAE,QACX,MAAOA,EAAE,MACT,UAAW,iBAAiBA,EAAE,WAAa,EAAE,GAC7C,SAAUA,EAAE,SACZ,eAAgB,uBAAuBA,EAAE,gBAAkB,EAAE,GAC7D,eAAgB,uBAAuBA,EAAE,gBAAkB,EAAE,IACzDA,EAAE,MAAM,MAAQ,4BAA8B,EAClD,GACA,YAAaA,EAAE,YACf,eAAgBA,EAAE,eAClB,SAAUA,EAAE,SACZ,WAAYA,EAAE,WACd,SAAUA,EAAE,SACZ,UAAWA,EAAE,WAAa,GAC1B,YACIC,EAAAA,IAACK,EAAY,CAAA,UAAU,oBAAoB,MAAON,EAAE,QAAU,OAAYA,EAAE,MAAM,MAAQ,EAAI,CAAA,EAElG,eAAgB,KAAK,MAAM,eAC3B,MAAOA,EAAE,QAAU,OAAY,CAAC,CAACA,EAAE,MAAM,MAAQA,EAAE,MACnD,GAAIA,EAAE,GACN,KAAMA,EAAE,KACR,KAAMA,EAAE,KACR,kBAAmBA,EAAE,kBACrB,MAAOA,EAAE,MACT,QAASA,EAAE,QACX,QAASA,EAAE,QACX,OAAQA,EAAE,OACV,aAAcA,EAAE,YAAA,CACpB,CAAA,CAGZ"}