{"version":3,"file":"TimeZonePicker.cjs","names":["_react","require","_Autocomplete","_jsxRuntime","TimeZonePicker","label","isReadOnly","onTimeZoneChange","timeZoneOptions","value","onChange","useCallback","_","option","jsx","Autocomplete","options","find","MemoizedTimeZonePicker","exports","memo","displayName"],"sources":["../../../src/DatePickers/TimeZonePicker.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, useCallback } from \"react\";\n\nimport { Autocomplete, AutocompleteProps } from \"../Autocomplete.js\";\n\nexport type TimeZoneOption = {\n  label: string;\n  value: string;\n};\n\nexport type TimeZonePickerProps = {\n  /** Accessible label for the time zone autocomplete input. */\n  label: string;\n  /**\n   * Called when the selected time zone changes. Receives the `value` string of the selected option, or `undefined` when the selection is cleared.\n   */\n  onTimeZoneChange?: (timeZone: string | undefined) => void;\n  /** Array of time zone options available for selection.\n   * Each entry requires a human-readable `label` and a machine-readable `value`.\n   */\n  timeZoneOptions: TimeZoneOption[];\n  /** The currently selected time zone, matched against `TimeZoneOption.value`. */\n  value?: string;\n} & Pick<AutocompleteProps<TimeZoneOption, false, false>, \"isReadOnly\">;\n\n/**\n * An autocomplete input for selecting a time zone from a provided list of options.\n */\nconst TimeZonePicker = ({\n  label,\n  isReadOnly,\n  onTimeZoneChange,\n  timeZoneOptions,\n  value,\n}: TimeZonePickerProps) => {\n  const onChange = useCallback<\n    NonNullable<AutocompleteProps<TimeZoneOption, false, false>[\"onChange\"]>\n  >(\n    (_, option) => {\n      onTimeZoneChange?.(option?.value);\n    },\n    [onTimeZoneChange],\n  );\n\n  return (\n    <Autocomplete<TimeZoneOption, false, false>\n      isReadOnly={isReadOnly}\n      label={label}\n      onChange={onChange}\n      options={timeZoneOptions}\n      value={timeZoneOptions.find((option) => option.value === value)}\n    />\n  );\n};\n\nconst MemoizedTimeZonePicker = memo(TimeZonePicker);\nMemoizedTimeZonePicker.displayName = \"TimeZonePicker\";\n\nexport { MemoizedTimeZonePicker as TimeZonePicker };\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAAqE,IAAAE,WAAA,GAAAF,OAAA;AAdrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GA6BA,MAAMG,cAAc,GAAGA,CAAC;EACtBC,KAAK;EACLC,UAAU;EACVC,gBAAgB;EAChBC,eAAe;EACfC;AACmB,CAAC,KAAK;EACzB,MAAMC,QAAQ,GAAG,IAAAC,kBAAW,EAG1B,CAACC,CAAC,EAAEC,MAAM,KAAK;IACbN,gBAAgB,GAAGM,MAAM,EAAEJ,KAAK,CAAC;EACnC,CAAC,EACD,CAACF,gBAAgB,CACnB,CAAC;EAED,OACE,IAAAJ,WAAA,CAAAW,GAAA,EAACZ,aAAA,CAAAa,YAAY;IACXT,UAAU,EAAEA,UAAW;IACvBD,KAAK,EAAEA,KAAM;IACbK,QAAQ,EAAEA,QAAS;IACnBM,OAAO,EAAER,eAAgB;IACzBC,KAAK,EAAED,eAAe,CAACS,IAAI,CAAEJ,MAAM,IAAKA,MAAM,CAACJ,KAAK,KAAKA,KAAK;EAAE,CACjE,CAAC;AAEN,CAAC;AAED,MAAMS,sBAAsB,GAAAC,OAAA,CAAAf,cAAA,GAAG,IAAAgB,WAAI,EAAChB,cAAc,CAAC;AACnDc,sBAAsB,CAACG,WAAW,gDAAmB","ignoreList":[]}