UNPKG

@razorpay/blade

Version:

The Design System that powers Razorpay

48 lines (45 loc) 1.9 kB
import 'react'; import '../../ActionList/index.js'; import '../../Dropdown/index.js'; import { InputDropdownButton } from '../../Dropdown/InputDropdownButton.web.js'; import '../../Icons/index.js'; import { jsxs, jsx } from 'react/jsx-runtime'; import { Dropdown } from '../../Dropdown/Dropdown.js'; import CalendarIcon from '../../Icons/CalendarIcon/CalendarIcon.js'; import { DropdownOverlay } from '../../Dropdown/DropdownOverlay.web.js'; import { ActionList } from '../../ActionList/ActionList.js'; import { ActionListItem } from '../../ActionList/ActionListItem.js'; var renderPresetDropdown = function renderPresetDropdown(_ref) { var onSelection = _ref.onSelection, onOpenCalendar = _ref.onOpenCalendar, presetStates = _ref.presetStates, selectedPresetLabel = _ref.selectedPresetLabel; return /*#__PURE__*/jsxs(Dropdown, { children: [/*#__PURE__*/jsx(InputDropdownButton, { value: selectedPresetLabel !== null && selectedPresetLabel !== void 0 ? selectedPresetLabel : 'Custom', icon: CalendarIcon }), /*#__PURE__*/jsx(DropdownOverlay, { children: /*#__PURE__*/jsx(ActionList, { children: presetStates.map(function (_ref2) { var preset = _ref2.preset, isSelected = _ref2.isSelected, isCustomType = _ref2.isCustomType; return /*#__PURE__*/jsx(ActionListItem, { title: preset.label, value: preset.label, isSelected: isSelected, onClick: function onClick() { onSelection(preset.value); // If this is a custom preset selection, also trigger calendar opening if (isCustomType && onOpenCalendar) { onOpenCalendar(); } } }, preset.label); }) }) })] }); }; export { renderPresetDropdown }; //# sourceMappingURL=renderPresetDropdown.web.js.map