@123usmanhaider321/ui 0.1.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +416 -31
- package/dist/images/icon/1LINK.svg +50 -0
- package/dist/images/icon/CreditCard.svg +83 -0
- package/dist/images/icon/Easypaisa.png +0 -0
- package/dist/images/icon/MobileWallet.png +0 -0
- package/dist/images/icon/Raast-Logo.png +0 -0
- package/dist/images/icon/VISA.png +0 -0
- package/dist/images/icon/add-circle-1.svg +5 -0
- package/dist/images/icon/check-circle-broken.svg +3 -0
- package/dist/images/icon/close-circle.svg +5 -0
- package/dist/images/icon/jazzcash.png +0 -0
- package/dist/images/icon/loading_icon.json +3347 -0
- package/dist/images/icon/mastercard-logo.webp +0 -0
- package/dist/images/icon/paymo.jpeg +0 -0
- package/dist/images/icon/preview-svgrepo-com.svg +36 -0
- package/dist/images/icon/trash.svg +7 -0
- package/dist/images/icon/unionpay-logo.svg +9 -0
- package/dist/index-87FQZHOs.js +11119 -0
- package/dist/index-87FQZHOs.js.map +1 -0
- package/dist/index-Tl9g213f.js +60475 -0
- package/dist/index-Tl9g213f.js.map +1 -0
- package/dist/index.d.ts +1 -10
- package/dist/index.es-CpgTaa1Y.js +16734 -0
- package/dist/index.es-CpgTaa1Y.js.map +1 -0
- package/dist/index.js +40 -12
- package/dist/index.js.map +1 -1
- package/dist/loading_icon-n5H5dQBl.js +3375 -0
- package/dist/loading_icon-n5H5dQBl.js.map +1 -0
- package/dist/src/components/Alert/ErrorAlert.d.ts +6 -0
- package/dist/src/components/Alert/SuccessAlert.d.ts +6 -0
- package/dist/{components → src/components}/FormBuilder/DiscountInput.d.ts +3 -6
- package/dist/{components → src/components}/FormBuilder/FormBuilder.d.ts +2 -11
- package/dist/{components → src/components}/FormBuilder/QuestionCard.d.ts +0 -5
- package/dist/{components → src/components}/FormBuilder/QuestionEditor.d.ts +0 -5
- package/dist/{components → src/components}/FormBuilder/SortableQuestionList.d.ts +0 -5
- package/dist/src/components/FormBuilder/questionIcons.d.ts +5 -0
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/AddEventLayout.d.ts +2 -1
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/AddEventStepper.d.ts +2 -2
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/common/ConfirmationModal.d.ts +1 -1
- package/dist/src/components/NewAddEvent/components/EventSubmissionConfirmationModal.d.ts +14 -0
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/StepTwo/TicketTierSection.d.ts +1 -1
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/TicketTierForm.d.ts +1 -1
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/hooks/useStepperForm.d.ts +22 -22
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/hooks/useTicketTierForm.d.ts +63 -15
- package/dist/src/components/NewAddEvent/schemas/step1.d.ts +211 -0
- package/dist/src/components/NewAddEvent/schemas/step2.d.ts +411 -0
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/schemas/utils.d.ts +8 -2
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/IndividualFormStep.d.ts +1 -1
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/SocialProfilesStep.d.ts +1 -1
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/TeamFormStep.d.ts +1 -1
- package/dist/src/components/Spinner/spinner.d.ts +4 -0
- package/dist/src/components/TicketlyUIProvider.d.ts +35 -0
- package/dist/src/components/common/Loader/index.d.ts +8 -0
- package/dist/src/components/common/Modals/ConfirmationModal.d.ts +7 -0
- package/dist/{components/FormInput → src/components/ui}/FormInput.d.ts +1 -1
- package/dist/src/components/ui/Loader.d.ts +4 -0
- package/dist/{components/Button/Button.d.ts → src/components/ui/button.d.ts} +1 -1
- package/dist/src/index.d.ts +10 -0
- package/dist/{lib → src/lib}/actions.d.ts +0 -126
- package/dist/src/lib/dom-utils.d.ts +2 -0
- package/dist/src/lib/storage-utils.d.ts +5 -0
- package/dist/src/lib/types.d.ts +258 -0
- package/dist/src/redux/baseQuery.d.ts +16 -0
- package/dist/{services → src/redux/features}/eventApi.d.ts +1053 -1745
- package/dist/src/redux/features/globalSlice.d.ts +17 -0
- package/dist/{services → src/redux/features/single-event}/single-event-api.d.ts +856 -1190
- package/dist/src/redux/types.d.ts +2 -0
- package/dist/src/services/library-services.d.ts +15 -0
- package/dist/src/services/remote-config.d.ts +27 -0
- package/dist/{services → src/services}/utils.d.ts +1 -1
- package/dist/src/theme/colors.d.ts +127 -0
- package/dist/src/theme/typography.d.ts +13 -0
- package/dist/src/types/api.d.ts +18 -0
- package/dist/style.css +2984 -0
- package/dist/styles.css +3758 -3636
- package/package.json +78 -68
- package/dist/_virtual/_commonjsHelpers.js +0 -9
- package/dist/_virtual/_commonjsHelpers.js.map +0 -1
- package/dist/_virtual/customParseFormat.js +0 -5
- package/dist/_virtual/customParseFormat.js.map +0 -1
- package/dist/_virtual/dayjs.min.js +0 -5
- package/dist/_virtual/dayjs.min.js.map +0 -1
- package/dist/_virtual/duration.js +0 -5
- package/dist/_virtual/duration.js.map +0 -1
- package/dist/_virtual/index.js +0 -5
- package/dist/_virtual/index.js.map +0 -1
- package/dist/_virtual/isBetween.js +0 -5
- package/dist/_virtual/isBetween.js.map +0 -1
- package/dist/_virtual/relativeTime.js +0 -5
- package/dist/_virtual/relativeTime.js.map +0 -1
- package/dist/_virtual/use-sync-external-store-shim.development.js +0 -5
- package/dist/_virtual/use-sync-external-store-shim.development.js.map +0 -1
- package/dist/_virtual/use-sync-external-store-shim.production.js +0 -5
- package/dist/_virtual/use-sync-external-store-shim.production.js.map +0 -1
- package/dist/_virtual/with-selector.development.js +0 -5
- package/dist/_virtual/with-selector.development.js.map +0 -1
- package/dist/_virtual/with-selector.js +0 -5
- package/dist/_virtual/with-selector.js.map +0 -1
- package/dist/_virtual/with-selector.production.js +0 -5
- package/dist/_virtual/with-selector.production.js.map +0 -1
- package/dist/components/Alert/Alert.js +0 -51
- package/dist/components/Alert/Alert.js.map +0 -1
- package/dist/components/Button/Button.js +0 -52
- package/dist/components/Button/Button.js.map +0 -1
- package/dist/components/Button/Button.test.d.ts +0 -1
- package/dist/components/Button/index.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.js +0 -50
- package/dist/components/Checkbox/Checkbox.js.map +0 -1
- package/dist/components/Checkbox/Checkbox.test.d.ts +0 -1
- package/dist/components/Checkbox/index.d.ts +0 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +0 -25
- package/dist/components/CheckboxGroup/CheckboxGroup.js +0 -99
- package/dist/components/CheckboxGroup/CheckboxGroup.js.map +0 -1
- package/dist/components/ConfirmationModal/ConfirmationModal.d.ts +0 -15
- package/dist/components/ConfirmationModal/ConfirmationModal.js +0 -136
- package/dist/components/ConfirmationModal/ConfirmationModal.js.map +0 -1
- package/dist/components/ConfirmationModal/index.d.ts +0 -2
- package/dist/components/CustomSelect/CustomSelect.js +0 -259
- package/dist/components/CustomSelect/CustomSelect.js.map +0 -1
- package/dist/components/EventAddForm/AddEventLayout.js +0 -227
- package/dist/components/EventAddForm/AddEventLayout.js.map +0 -1
- package/dist/components/EventAddForm/AddEventStepper.js +0 -719
- package/dist/components/EventAddForm/AddEventStepper.js.map +0 -1
- package/dist/components/EventAddForm/common/ConfirmationModal.js +0 -136
- package/dist/components/EventAddForm/common/ConfirmationModal.js.map +0 -1
- package/dist/components/EventAddForm/common/DescriptionModal.js +0 -70
- package/dist/components/EventAddForm/common/DescriptionModal.js.map +0 -1
- package/dist/components/EventAddForm/components/AnimatedBackground.d.ts +0 -8
- package/dist/components/EventAddForm/components/ApprovalConfirmationModal.d.ts +0 -7
- package/dist/components/EventAddForm/components/CheckboxGroup.js +0 -92
- package/dist/components/EventAddForm/components/CheckboxGroup.js.map +0 -1
- package/dist/components/EventAddForm/components/CustomMeetingForm.js +0 -237
- package/dist/components/EventAddForm/components/CustomMeetingForm.js.map +0 -1
- package/dist/components/EventAddForm/components/DateTimeField.js +0 -173
- package/dist/components/EventAddForm/components/DateTimeField.js.map +0 -1
- package/dist/components/EventAddForm/components/EventSubmissionConfirmationModal.d.ts +0 -33
- package/dist/components/EventAddForm/components/EventSubmissionConfirmationModal.js +0 -366
- package/dist/components/EventAddForm/components/EventSubmissionConfirmationModal.js.map +0 -1
- package/dist/components/EventAddForm/components/FileUpload.js +0 -412
- package/dist/components/EventAddForm/components/FileUpload.js.map +0 -1
- package/dist/components/EventAddForm/components/FormBuilderProceedModal.js +0 -197
- package/dist/components/EventAddForm/components/FormBuilderProceedModal.js.map +0 -1
- package/dist/components/EventAddForm/components/GoogleMapsAutocompleteInput.js +0 -1179
- package/dist/components/EventAddForm/components/GoogleMapsAutocompleteInput.js.map +0 -1
- package/dist/components/EventAddForm/components/InputField.d.ts +0 -15
- package/dist/components/EventAddForm/components/RadioGroupButton.d.ts +0 -14
- package/dist/components/EventAddForm/components/SelectField.d.ts +0 -19
- package/dist/components/EventAddForm/components/SingleDateTimeInput.js +0 -102
- package/dist/components/EventAddForm/components/SingleDateTimeInput.js.map +0 -1
- package/dist/components/EventAddForm/components/StepTwo/CustomFormSection.js +0 -277
- package/dist/components/EventAddForm/components/StepTwo/CustomFormSection.js.map +0 -1
- package/dist/components/EventAddForm/components/StepTwo/TicketTierSection.js +0 -148
- package/dist/components/EventAddForm/components/StepTwo/TicketTierSection.js.map +0 -1
- package/dist/components/EventAddForm/components/TicketTierForm.js +0 -418
- package/dist/components/EventAddForm/components/TicketTierForm.js.map +0 -1
- package/dist/components/EventAddForm/components/TicketTypeSelection.js +0 -93
- package/dist/components/EventAddForm/components/TicketTypeSelection.js.map +0 -1
- package/dist/components/EventAddForm/hooks/useStepperForm.js +0 -371
- package/dist/components/EventAddForm/hooks/useStepperForm.js.map +0 -1
- package/dist/components/EventAddForm/hooks/useTicketTierForm.js +0 -237
- package/dist/components/EventAddForm/hooks/useTicketTierForm.js.map +0 -1
- package/dist/components/EventAddForm/index.d.ts +0 -3
- package/dist/components/EventAddForm/index.js +0 -41
- package/dist/components/EventAddForm/index.js.map +0 -1
- package/dist/components/EventAddForm/schemas/index.d.ts +0 -2
- package/dist/components/EventAddForm/schemas/step1.d.ts +0 -47
- package/dist/components/EventAddForm/schemas/step1.js +0 -135
- package/dist/components/EventAddForm/schemas/step1.js.map +0 -1
- package/dist/components/EventAddForm/schemas/step2.d.ts +0 -138
- package/dist/components/EventAddForm/schemas/step2.js +0 -94
- package/dist/components/EventAddForm/schemas/step2.js.map +0 -1
- package/dist/components/EventAddForm/schemas/utils.js +0 -28
- package/dist/components/EventAddForm/schemas/utils.js.map +0 -1
- package/dist/components/EventAddForm/steps/IndividualFormStep.js +0 -85
- package/dist/components/EventAddForm/steps/IndividualFormStep.js.map +0 -1
- package/dist/components/EventAddForm/steps/SocialProfilesStep.js +0 -123
- package/dist/components/EventAddForm/steps/SocialProfilesStep.js.map +0 -1
- package/dist/components/EventAddForm/steps/StepOne.js +0 -462
- package/dist/components/EventAddForm/steps/StepOne.js.map +0 -1
- package/dist/components/EventAddForm/steps/StepTwo.js +0 -173
- package/dist/components/EventAddForm/steps/StepTwo.js.map +0 -1
- package/dist/components/EventAddForm/steps/TeamFormStep.js +0 -13
- package/dist/components/EventAddForm/steps/TeamFormStep.js.map +0 -1
- package/dist/components/FormBuilder/CategoryList.js +0 -242
- package/dist/components/FormBuilder/CategoryList.js.map +0 -1
- package/dist/components/FormBuilder/DiscountInput.js +0 -366
- package/dist/components/FormBuilder/DiscountInput.js.map +0 -1
- package/dist/components/FormBuilder/FormBuilder.js +0 -918
- package/dist/components/FormBuilder/FormBuilder.js.map +0 -1
- package/dist/components/FormBuilder/OptionList.js +0 -120
- package/dist/components/FormBuilder/OptionList.js.map +0 -1
- package/dist/components/FormBuilder/PaymentPreview.d.ts +0 -12
- package/dist/components/FormBuilder/PaymentPreview.js +0 -70
- package/dist/components/FormBuilder/PaymentPreview.js.map +0 -1
- package/dist/components/FormBuilder/PreviewInput.d.ts +0 -10
- package/dist/components/FormBuilder/PreviewInput.js +0 -143
- package/dist/components/FormBuilder/PreviewInput.js.map +0 -1
- package/dist/components/FormBuilder/QuestionCard.js +0 -252
- package/dist/components/FormBuilder/QuestionCard.js.map +0 -1
- package/dist/components/FormBuilder/QuestionEditor.js +0 -166
- package/dist/components/FormBuilder/QuestionEditor.js.map +0 -1
- package/dist/components/FormBuilder/RequiredToggle.js +0 -43
- package/dist/components/FormBuilder/RequiredToggle.js.map +0 -1
- package/dist/components/FormBuilder/SortableQuestionList.js +0 -137
- package/dist/components/FormBuilder/SortableQuestionList.js.map +0 -1
- package/dist/components/FormBuilder/index.d.ts +0 -4
- package/dist/components/FormBuilder/utils.js +0 -229
- package/dist/components/FormBuilder/utils.js.map +0 -1
- package/dist/components/FormInput/FormInput.js +0 -126
- package/dist/components/FormInput/FormInput.js.map +0 -1
- package/dist/components/FormInput/FormInput.test.d.ts +0 -1
- package/dist/components/FormInput/index.d.ts +0 -2
- package/dist/components/ImageCropModal/index.js +0 -464
- package/dist/components/ImageCropModal/index.js.map +0 -1
- package/dist/components/InformationPopover/InformationPopover.d.ts +0 -7
- package/dist/components/InformationPopover/InformationPopover.js +0 -19
- package/dist/components/InformationPopover/InformationPopover.js.map +0 -1
- package/dist/components/InformationPopover.js +0 -19
- package/dist/components/InformationPopover.js.map +0 -1
- package/dist/components/InputErrorMessage/InputErrorMessage.js +0 -21
- package/dist/components/InputErrorMessage/InputErrorMessage.js.map +0 -1
- package/dist/components/Modal/Modal.d.ts +0 -15
- package/dist/components/Modal/Modal.js +0 -73
- package/dist/components/Modal/Modal.js.map +0 -1
- package/dist/components/Radio/Radio.js +0 -35
- package/dist/components/Radio/Radio.js.map +0 -1
- package/dist/components/Spinner/spinner.d.ts +0 -2
- package/dist/components/Spinner/spinner.js +0 -22
- package/dist/components/Spinner/spinner.js.map +0 -1
- package/dist/components/Toggle/Toggle.d.ts +0 -16
- package/dist/components/Toggle/index.d.ts +0 -2
- package/dist/components/Tooltip/Tooltip.d.ts +0 -12
- package/dist/components/Tooltip/Tooltip.js +0 -134
- package/dist/components/Tooltip/Tooltip.js.map +0 -1
- package/dist/components/common/FallbackImage.js +0 -47
- package/dist/components/common/FallbackImage.js.map +0 -1
- package/dist/components/ui/Calendar/calendar-utils.js +0 -51
- package/dist/components/ui/Calendar/calendar-utils.js.map +0 -1
- package/dist/components/ui/Calendar/index.js +0 -142
- package/dist/components/ui/Calendar/index.js.map +0 -1
- package/dist/components/ui/Checkbox.d.ts +0 -9
- package/dist/components/ui/Checkbox.js +0 -50
- package/dist/components/ui/Checkbox.js.map +0 -1
- package/dist/components/ui/DatePicker/index.js +0 -188
- package/dist/components/ui/DatePicker/index.js.map +0 -1
- package/dist/components/ui/FormInput.js +0 -129
- package/dist/components/ui/FormInput.js.map +0 -1
- package/dist/components/ui/InputErrorMessage.d.ts +0 -7
- package/dist/components/ui/InputErrorMessage.js +0 -21
- package/dist/components/ui/InputErrorMessage.js.map +0 -1
- package/dist/components/ui/Modal/index.js +0 -73
- package/dist/components/ui/Modal/index.js.map +0 -1
- package/dist/components/ui/Radio.d.ts +0 -6
- package/dist/components/ui/Radio.js +0 -35
- package/dist/components/ui/Radio.js.map +0 -1
- package/dist/components/ui/RichTextEditor.js +0 -242
- package/dist/components/ui/RichTextEditor.js.map +0 -1
- package/dist/components/ui/TimePicker/index.js +0 -215
- package/dist/components/ui/TimePicker/index.js.map +0 -1
- package/dist/components/ui/TimeSelector/index.js +0 -138
- package/dist/components/ui/TimeSelector/index.js.map +0 -1
- package/dist/components/ui/Tooltip.d.ts +0 -12
- package/dist/components/ui/Tooltip.js +0 -136
- package/dist/components/ui/Tooltip.js.map +0 -1
- package/dist/hooks/useDropdownPosition.d.ts +0 -11
- package/dist/hooks/useFirebaseAuthState.d.ts +0 -6
- package/dist/hooks/useFirebaseAuthState.js +0 -23
- package/dist/hooks/useFirebaseAuthState.js.map +0 -1
- package/dist/hooks/useTicketTierForm.d.ts +0 -61
- package/dist/lib/actions.js +0 -32
- package/dist/lib/actions.js.map +0 -1
- package/dist/lib/cropImage.js +0 -113
- package/dist/lib/cropImage.js.map +0 -1
- package/dist/lib/imageAnalysis.js +0 -58
- package/dist/lib/imageAnalysis.js.map +0 -1
- package/dist/lib/utils.js +0 -9
- package/dist/lib/utils.js.map +0 -1
- package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +0 -60
- package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js.map +0 -1
- package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +0 -3458
- package/dist/node_modules/@dnd-kit/core/dist/core.esm.js.map +0 -1
- package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +0 -593
- package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js.map +0 -1
- package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +0 -302
- package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js.map +0 -1
- package/dist/node_modules/@firebase/app/dist/esm/index.esm.js +0 -768
- package/dist/node_modules/@firebase/app/dist/esm/index.esm.js.map +0 -1
- package/dist/node_modules/@firebase/component/dist/esm/index.esm.js +0 -340
- package/dist/node_modules/@firebase/component/dist/esm/index.esm.js.map +0 -1
- package/dist/node_modules/@firebase/logger/dist/esm/index.esm.js +0 -123
- package/dist/node_modules/@firebase/logger/dist/esm/index.esm.js.map +0 -1
- package/dist/node_modules/@firebase/storage/dist/index.esm.js +0 -2623
- package/dist/node_modules/@firebase/storage/dist/index.esm.js.map +0 -1
- package/dist/node_modules/@firebase/util/dist/index.esm.js +0 -658
- package/dist/node_modules/@firebase/util/dist/index.esm.js.map +0 -1
- package/dist/node_modules/@firebase/util/dist/postinstall.js +0 -5
- package/dist/node_modules/@firebase/util/dist/postinstall.js.map +0 -1
- package/dist/node_modules/@fortawesome/fontawesome-svg-core/index.js +0 -3179
- package/dist/node_modules/@fortawesome/fontawesome-svg-core/index.js.map +0 -1
- package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.js +0 -60
- package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.js.map +0 -1
- package/dist/node_modules/@fortawesome/react-fontawesome/dist/index.js +0 -400
- package/dist/node_modules/@fortawesome/react-fontawesome/dist/index.js.map +0 -1
- package/dist/node_modules/@heroicons/react/20/solid/esm/CheckIcon.js +0 -27
- package/dist/node_modules/@heroicons/react/20/solid/esm/CheckIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/20/solid/esm/ChevronDownIcon.js +0 -27
- package/dist/node_modules/@heroicons/react/20/solid/esm/ChevronDownIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/ArrowRightIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/ArrowRightIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/ClockIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/ClockIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/DocumentDuplicateIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/DocumentDuplicateIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/InformationCircleIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/InformationCircleIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/LinkIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/LinkIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/MagnifyingGlassIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/MagnifyingGlassIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/MapPinIcon.js +0 -33
- package/dist/node_modules/@heroicons/react/24/outline/esm/MapPinIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/VideoCameraIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/VideoCameraIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/XMarkIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/XMarkIcon.js.map +0 -1
- package/dist/node_modules/@tiptap/core/dist/index.js +0 -5446
- package/dist/node_modules/@tiptap/core/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +0 -21
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +0 -78
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js +0 -100
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +0 -70
- package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +0 -317
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-document/dist/index.js +0 -16
- package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +0 -66
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +0 -86
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +0 -80
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js +0 -98
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +0 -423
- package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +0 -1039
- package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +0 -61
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +0 -7
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js +0 -79
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-text/dist/index.js +0 -16
- package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js +0 -76
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extensions/dist/index.js +0 -376
- package/dist/node_modules/@tiptap/extensions/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/react/dist/index.js +0 -650
- package/dist/node_modules/@tiptap/react/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js +0 -97
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +0 -1
- package/dist/node_modules/dayjs/dayjs.min.js +0 -283
- package/dist/node_modules/dayjs/dayjs.min.js.map +0 -1
- package/dist/node_modules/dayjs/plugin/customParseFormat.js +0 -130
- package/dist/node_modules/dayjs/plugin/customParseFormat.js.map +0 -1
- package/dist/node_modules/dayjs/plugin/duration.js +0 -137
- package/dist/node_modules/dayjs/plugin/duration.js.map +0 -1
- package/dist/node_modules/dayjs/plugin/isBetween.js +0 -20
- package/dist/node_modules/dayjs/plugin/isBetween.js.map +0 -1
- package/dist/node_modules/dayjs/plugin/relativeTime.js +0 -49
- package/dist/node_modules/dayjs/plugin/relativeTime.js.map +0 -1
- package/dist/node_modules/fast-equals/dist/es/index.js +0 -442
- package/dist/node_modules/fast-equals/dist/es/index.js.map +0 -1
- package/dist/node_modules/idb/build/index.js +0 -70
- package/dist/node_modules/idb/build/index.js.map +0 -1
- package/dist/node_modules/idb/build/wrap-idb-value.js +0 -149
- package/dist/node_modules/idb/build/wrap-idb-value.js.map +0 -1
- package/dist/node_modules/linkifyjs/dist/linkify.js +0 -1159
- package/dist/node_modules/linkifyjs/dist/linkify.js.map +0 -1
- package/dist/node_modules/orderedmap/dist/index.js +0 -120
- package/dist/node_modules/orderedmap/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-commands/dist/index.js +0 -527
- package/dist/node_modules/prosemirror-commands/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +0 -137
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +0 -221
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-history/dist/index.js +0 -357
- package/dist/node_modules/prosemirror-history/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-keymap/dist/index.js +0 -84
- package/dist/node_modules/prosemirror-keymap/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-model/dist/index.js +0 -3209
- package/dist/node_modules/prosemirror-model/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-schema-list/dist/index.js +0 -131
- package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-state/dist/index.js +0 -936
- package/dist/node_modules/prosemirror-state/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-transform/dist/index.js +0 -1881
- package/dist/node_modules/prosemirror-transform/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-view/dist/index.js +0 -5232
- package/dist/node_modules/prosemirror-view/dist/index.js.map +0 -1
- package/dist/node_modules/rope-sequence/dist/index.js +0 -184
- package/dist/node_modules/rope-sequence/dist/index.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +0 -82
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +0 -78
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -78
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -63
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +0 -13
- package/dist/node_modules/use-sync-external-store/shim/index.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js +0 -13
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js.map +0 -1
- package/dist/node_modules/w3c-keyname/index.js +0 -106
- package/dist/node_modules/w3c-keyname/index.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/coerce.js +0 -10
- package/dist/node_modules/zod/v4/classic/coerce.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/compat.js +0 -8
- package/dist/node_modules/zod/v4/classic/compat.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/errors.js +0 -45
- package/dist/node_modules/zod/v4/classic/errors.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/iso.js +0 -44
- package/dist/node_modules/zod/v4/classic/iso.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/parse.js +0 -30
- package/dist/node_modules/zod/v4/classic/parse.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/schemas.js +0 -711
- package/dist/node_modules/zod/v4/classic/schemas.js.map +0 -1
- package/dist/node_modules/zod/v4/core/api.js +0 -588
- package/dist/node_modules/zod/v4/core/api.js.map +0 -1
- package/dist/node_modules/zod/v4/core/checks.js +0 -411
- package/dist/node_modules/zod/v4/core/checks.js.map +0 -1
- package/dist/node_modules/zod/v4/core/core.js +0 -75
- package/dist/node_modules/zod/v4/core/core.js.map +0 -1
- package/dist/node_modules/zod/v4/core/doc.js +0 -38
- package/dist/node_modules/zod/v4/core/doc.js.map +0 -1
- package/dist/node_modules/zod/v4/core/errors.js +0 -73
- package/dist/node_modules/zod/v4/core/errors.js.map +0 -1
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -359
- package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +0 -1
- package/dist/node_modules/zod/v4/core/parse.js +0 -96
- package/dist/node_modules/zod/v4/core/parse.js.map +0 -1
- package/dist/node_modules/zod/v4/core/regexes.js +0 -84
- package/dist/node_modules/zod/v4/core/regexes.js.map +0 -1
- package/dist/node_modules/zod/v4/core/registries.js +0 -52
- package/dist/node_modules/zod/v4/core/registries.js.map +0 -1
- package/dist/node_modules/zod/v4/core/schemas.js +0 -1391
- package/dist/node_modules/zod/v4/core/schemas.js.map +0 -1
- package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -363
- package/dist/node_modules/zod/v4/core/to-json-schema.js.map +0 -1
- package/dist/node_modules/zod/v4/core/util.js +0 -431
- package/dist/node_modules/zod/v4/core/util.js.map +0 -1
- package/dist/node_modules/zod/v4/core/versions.js +0 -9
- package/dist/node_modules/zod/v4/core/versions.js.map +0 -1
- package/dist/redux/baseQuery.d.ts +0 -1
- package/dist/redux/baseQuery.js +0 -24
- package/dist/redux/baseQuery.js.map +0 -1
- package/dist/services/eventApi.js +0 -411
- package/dist/services/eventApi.js.map +0 -1
- package/dist/services/helpers.js +0 -115
- package/dist/services/helpers.js.map +0 -1
- package/dist/services/initialize-firebase.d.ts +0 -2
- package/dist/services/initialize-firebase.js +0 -20
- package/dist/services/initialize-firebase.js.map +0 -1
- package/dist/services/process-image-on-server.js +0 -30
- package/dist/services/process-image-on-server.js.map +0 -1
- package/dist/services/remote-config.d.ts +0 -5
- package/dist/services/remote-config.js +0 -9
- package/dist/services/remote-config.js.map +0 -1
- package/dist/services/single-event-api.js +0 -301
- package/dist/services/single-event-api.js.map +0 -1
- package/dist/services/utils.js +0 -107
- package/dist/services/utils.js.map +0 -1
- package/dist/setupTests.d.ts +0 -1
- package/dist/stories/Alert.stories.d.ts +0 -10
- package/dist/stories/Button.stories.d.ts +0 -13
- package/dist/types/redux-types.d.ts +0 -15
- package/dist/types/types.d.ts +0 -60
- package/dist/types/types.js +0 -10
- package/dist/types/types.js.map +0 -1
- package/dist/utils/cn.d.ts +0 -6
- package/dist/utils/cn.js +0 -9
- package/dist/utils/cn.js.map +0 -1
- package/dist/utils/date-range.d.ts +0 -4
- package/dist/utils/date-range.js +0 -13
- package/dist/utils/date-range.js.map +0 -1
- package/dist/utils/single-event-helpers.d.ts +0 -50
- package/dist/utils/single-event-helpers.js +0 -18
- package/dist/utils/single-event-helpers.js.map +0 -1
- package/dist/utils/social-validation.js +0 -42
- package/dist/utils/social-validation.js.map +0 -1
- package/dist/utils/utils.js +0 -20
- package/dist/utils/utils.js.map +0 -1
- /package/dist/{components/Alert/Alert.d.ts → src/components/Alert/index.d.ts} +0 -0
- /package/dist/{components → src/components}/FormBuilder/CategoryList.d.ts +0 -0
- /package/dist/{components → src/components}/FormBuilder/OptionList.d.ts +0 -0
- /package/dist/{components → src/components}/FormBuilder/RequiredToggle.d.ts +0 -0
- /package/dist/{components → src/components}/FormBuilder/types.d.ts +0 -0
- /package/dist/{components → src/components}/FormBuilder/utils.d.ts +0 -0
- /package/dist/{components → src/components}/ImageCropModal/index.d.ts +0 -0
- /package/dist/{components → src/components}/InformationPopover.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/common/DescriptionModal.d.ts +0 -0
- /package/dist/{components/ui/FormInput.d.ts → src/components/NewAddEvent/components/AddEventFormInput.d.ts} +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/CheckboxGroup.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/CustomMeetingForm.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/DateTimeField.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/FileUpload.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/FormBuilderProceedModal.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/GoogleMapsAutocompleteInput.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/SingleDateTimeInput.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/StepTwo/CustomFormSection.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/TicketTypeSelection.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/StepOne.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/StepTwo.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/types.d.ts +0 -0
- /package/dist/{components → src/components}/common/FallbackImage.d.ts +0 -0
- /package/dist/{components → src/components}/ui/Calendar/calendar-utils.d.ts +0 -0
- /package/dist/{components → src/components}/ui/Calendar/index.d.ts +0 -0
- /package/dist/{components/Checkbox → src/components/ui}/Checkbox.d.ts +0 -0
- /package/dist/{components/CustomSelect → src/components/ui}/CustomSelect.d.ts +0 -0
- /package/dist/{components → src/components}/ui/DatePicker/index.d.ts +0 -0
- /package/dist/{components/InputErrorMessage → src/components/ui}/InputErrorMessage.d.ts +0 -0
- /package/dist/{components → src/components}/ui/Modal/index.d.ts +0 -0
- /package/dist/{components/Radio → src/components/ui}/Radio.d.ts +0 -0
- /package/dist/{components → src/components}/ui/RichTextEditor.d.ts +0 -0
- /package/dist/{components → src/components}/ui/TimePicker/index.d.ts +0 -0
- /package/dist/{components → src/components}/ui/TimeSelector/index.d.ts +0 -0
- /package/dist/{components → src/components}/ui/Tooltip/index.d.ts +0 -0
- /package/dist/{lib → src/lib}/constants.d.ts +0 -0
- /package/dist/{lib → src/lib}/cropImage.d.ts +0 -0
- /package/dist/{lib → src/lib}/imageAnalysis.d.ts +0 -0
- /package/dist/{utils → src/lib}/social-validation.d.ts +0 -0
- /package/dist/{lib/utils.d.ts → src/lib/tailwind-merge.d.ts} +0 -0
- /package/dist/{utils → src/lib}/utils.d.ts +0 -0
- /package/dist/{services → src/redux/features/single-event}/helpers.d.ts +0 -0
- /package/dist/{services → src/services}/process-image-on-server.d.ts +0 -0
- /package/dist/{types → src/types}/events.d.ts +0 -0
- /package/dist/{types → src/types}/question.d.ts +0 -0
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useSortable } from "../../node_modules/@dnd-kit/sortable/dist/sortable.esm.js";
|
|
3
|
-
import { CSS } from "../../node_modules/@dnd-kit/utilities/dist/utilities.esm.js";
|
|
4
|
-
import QuestionCard from "./QuestionCard.js";
|
|
5
|
-
const SortableQuestionList = ({
|
|
6
|
-
questions,
|
|
7
|
-
questionOrder,
|
|
8
|
-
formId,
|
|
9
|
-
eventId,
|
|
10
|
-
userUid,
|
|
11
|
-
isLocked,
|
|
12
|
-
activeQuestionId,
|
|
13
|
-
onSetActiveQuestion,
|
|
14
|
-
onDelete,
|
|
15
|
-
onUpdate,
|
|
16
|
-
onSave,
|
|
17
|
-
onDuplicate,
|
|
18
|
-
onCancel,
|
|
19
|
-
activeQuestionProps,
|
|
20
|
-
disabled = false,
|
|
21
|
-
scope,
|
|
22
|
-
participationType,
|
|
23
|
-
disableDiscountOption,
|
|
24
|
-
showValidationErrors,
|
|
25
|
-
storageService
|
|
26
|
-
}) => {
|
|
27
|
-
return /* @__PURE__ */ jsx("div", { className: "ui-flex ui-flex-col ui-space-y-6", children: questionOrder.map((id) => {
|
|
28
|
-
const question = questions[id];
|
|
29
|
-
if (!question) return null;
|
|
30
|
-
const isActive = activeQuestionId === id;
|
|
31
|
-
const props = isActive ? activeQuestionProps : {};
|
|
32
|
-
return /* @__PURE__ */ jsx(
|
|
33
|
-
SortableQuestionItem,
|
|
34
|
-
{
|
|
35
|
-
question,
|
|
36
|
-
formId,
|
|
37
|
-
eventId,
|
|
38
|
-
userUid,
|
|
39
|
-
isLocked,
|
|
40
|
-
isOpen: isActive,
|
|
41
|
-
onToggle: () => {
|
|
42
|
-
onSetActiveQuestion(isActive ? null : id);
|
|
43
|
-
},
|
|
44
|
-
onDelete,
|
|
45
|
-
onUpdate,
|
|
46
|
-
onSave,
|
|
47
|
-
onDuplicate,
|
|
48
|
-
onCancel,
|
|
49
|
-
disabled,
|
|
50
|
-
scope,
|
|
51
|
-
participationType,
|
|
52
|
-
disableDiscountOption,
|
|
53
|
-
showValidationErrors,
|
|
54
|
-
storageService,
|
|
55
|
-
...props
|
|
56
|
-
},
|
|
57
|
-
id
|
|
58
|
-
);
|
|
59
|
-
}) });
|
|
60
|
-
};
|
|
61
|
-
function SortableQuestionItem({
|
|
62
|
-
question,
|
|
63
|
-
formId,
|
|
64
|
-
eventId,
|
|
65
|
-
userUid,
|
|
66
|
-
isLocked,
|
|
67
|
-
isOpen,
|
|
68
|
-
onToggle,
|
|
69
|
-
onDelete,
|
|
70
|
-
onUpdate,
|
|
71
|
-
onSave,
|
|
72
|
-
onDuplicate,
|
|
73
|
-
onCancel,
|
|
74
|
-
isDirty,
|
|
75
|
-
isSaving,
|
|
76
|
-
isNew,
|
|
77
|
-
isValid,
|
|
78
|
-
disabled,
|
|
79
|
-
errorMessage,
|
|
80
|
-
scope,
|
|
81
|
-
participationType,
|
|
82
|
-
disableDiscountOption,
|
|
83
|
-
showValidationErrors,
|
|
84
|
-
storageService
|
|
85
|
-
}) {
|
|
86
|
-
const isSystem = ["TEAM_SIZE", "NAME_ON_TICKET"].includes(question.kind);
|
|
87
|
-
const {
|
|
88
|
-
attributes,
|
|
89
|
-
listeners,
|
|
90
|
-
setNodeRef,
|
|
91
|
-
transform,
|
|
92
|
-
transition,
|
|
93
|
-
isDragging
|
|
94
|
-
} = useSortable({
|
|
95
|
-
id: question.id,
|
|
96
|
-
disabled: isLocked || isSystem || disabled
|
|
97
|
-
});
|
|
98
|
-
const style = {
|
|
99
|
-
transform: CSS.Transform.toString(transform),
|
|
100
|
-
transition,
|
|
101
|
-
opacity: isDragging ? 0.5 : 1,
|
|
102
|
-
zIndex: isDragging ? 1e3 : "auto"
|
|
103
|
-
};
|
|
104
|
-
const showTooltip = disabled && !isOpen;
|
|
105
|
-
return /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, className: `ui-w-full ui-relative ${showTooltip ? "ui-cursor-not-allowed ui-opacity-60" : ""}`, id: `question-${question.id}`, children: /* @__PURE__ */ jsx(
|
|
106
|
-
QuestionCard,
|
|
107
|
-
{
|
|
108
|
-
question,
|
|
109
|
-
formId,
|
|
110
|
-
eventId,
|
|
111
|
-
userUid,
|
|
112
|
-
isLocked,
|
|
113
|
-
isOpen,
|
|
114
|
-
onToggle,
|
|
115
|
-
dragHandleProps: !isLocked && !isSystem && !disabled ? { ...attributes, ...listeners } : void 0,
|
|
116
|
-
onDelete,
|
|
117
|
-
onUpdate,
|
|
118
|
-
onSave,
|
|
119
|
-
onDuplicate,
|
|
120
|
-
onCancel: () => onCancel == null ? void 0 : onCancel(question.id),
|
|
121
|
-
isDirty,
|
|
122
|
-
isSaving,
|
|
123
|
-
isNew,
|
|
124
|
-
isValid,
|
|
125
|
-
errorMessage,
|
|
126
|
-
scope,
|
|
127
|
-
participationType,
|
|
128
|
-
disableDiscountOption,
|
|
129
|
-
showValidationErrors,
|
|
130
|
-
storageService
|
|
131
|
-
}
|
|
132
|
-
) });
|
|
133
|
-
}
|
|
134
|
-
export {
|
|
135
|
-
SortableQuestionList
|
|
136
|
-
};
|
|
137
|
-
//# sourceMappingURL=SortableQuestionList.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SortableQuestionList.js","sources":["../../../src/components/FormBuilder/SortableQuestionList.tsx"],"sourcesContent":["import React from 'react';\r\nimport { useSortable } from '@dnd-kit/sortable';\r\nimport { CSS } from '@dnd-kit/utilities';\r\nimport QuestionCard from './QuestionCard';\r\nimport { QuestionDraft } from \"./types\";\r\n\r\ninterface SortableQuestionListProps {\r\n questions: Record<string, QuestionDraft>;\r\n questionOrder: string[];\r\n formId: string;\r\n eventId: string;\r\n userUid?: string;\r\n isLocked: boolean;\r\n activeQuestionId: string | null;\r\n onSetActiveQuestion: (id: string | null) => void;\r\n onDelete: (questionId: string) => void;\r\n onUpdate: (questionId: string, updates: Partial<QuestionDraft>) => void;\r\n onSave?: (questionId: string) => void;\r\n onDuplicate: (questionId: string) => void;\r\n onCancel: (questionId: string) => void;\r\n activeQuestionProps?: {\r\n isDirty: boolean;\r\n isSaving: boolean;\r\n isNew: boolean;\r\n isValid: boolean;\r\n errorMessage?: string;\r\n };\r\n disabled?: boolean;\r\n showValidationErrors?: boolean;\r\n scope?: 'INDIVIDUAL' | 'TEAM';\r\n participationType?: string;\r\n disableDiscountOption?: boolean;\r\n storageService?: {\r\n uploadFile: (path: string, file: File) => Promise<void>;\r\n downloadFile: (path: string) => Promise<Blob>;\r\n };\r\n}\r\n\r\nexport const SortableQuestionList: React.FC<SortableQuestionListProps> = ({\r\n questions,\r\n questionOrder,\r\n formId,\r\n eventId,\r\n userUid,\r\n isLocked,\r\n activeQuestionId,\r\n onSetActiveQuestion,\r\n onDelete,\r\n onUpdate,\r\n onSave,\r\n onDuplicate,\r\n onCancel,\r\n activeQuestionProps,\r\n disabled = false,\r\n scope,\r\n participationType,\r\n disableDiscountOption,\r\n showValidationErrors,\r\n storageService\r\n}) => {\r\n return (\r\n <div className=\"ui-flex ui-flex-col ui-space-y-6\">\r\n {questionOrder.map((id) => {\r\n const question = questions[id];\r\n if (!question) return null;\r\n\r\n const isActive = activeQuestionId === id;\r\n const props = isActive ? activeQuestionProps : {};\r\n\r\n return (\r\n <SortableQuestionItem\r\n key={id}\r\n question={question}\r\n formId={formId}\r\n eventId={eventId}\r\n userUid={userUid}\r\n isLocked={isLocked}\r\n isOpen={isActive}\r\n onToggle={() => {\r\n onSetActiveQuestion(isActive ? null : id);\r\n }}\r\n onDelete={onDelete}\r\n onUpdate={onUpdate}\r\n onSave={onSave}\r\n onDuplicate={onDuplicate}\r\n onCancel={onCancel}\r\n disabled={disabled}\r\n scope={scope}\r\n participationType={participationType}\r\n disableDiscountOption={disableDiscountOption}\r\n showValidationErrors={showValidationErrors}\r\n storageService={storageService}\r\n {...props}\r\n />\r\n );\r\n })}\r\n </div>\r\n );\r\n};\r\n\r\ninterface SortableQuestionItemProps {\r\n question: QuestionDraft;\r\n formId: string;\r\n eventId: string;\r\n userUid?: string;\r\n isLocked: boolean;\r\n isOpen: boolean;\r\n onToggle: () => void;\r\n onDelete?: (questionId: string) => void;\r\n onUpdate: (questionId: string, updates: Partial<QuestionDraft>) => void;\r\n onSave?: (questionId: string) => void;\r\n onDuplicate: (questionId: string) => void;\r\n onCancel?: (questionId: string) => void;\r\n isDirty?: boolean;\r\n isSaving?: boolean;\r\n isNew?: boolean;\r\n isValid?: boolean;\r\n disabled?: boolean;\r\n scope?: 'INDIVIDUAL' | 'TEAM';\r\n participationType?: string;\r\n disableDiscountOption?: boolean;\r\n showValidationErrors?: boolean;\r\n storageService?: {\r\n uploadFile: (path: string, file: File) => Promise<void>;\r\n downloadFile: (path: string) => Promise<Blob>;\r\n };\r\n}\r\n\r\nfunction SortableQuestionItem({\r\n question,\r\n formId,\r\n eventId,\r\n userUid,\r\n isLocked,\r\n isOpen,\r\n onToggle,\r\n onDelete,\r\n onUpdate,\r\n onSave,\r\n onDuplicate,\r\n onCancel,\r\n isDirty,\r\n isSaving,\r\n isNew,\r\n isValid,\r\n disabled,\r\n errorMessage,\r\n scope,\r\n participationType,\r\n disableDiscountOption,\r\n showValidationErrors,\r\n storageService\r\n}: SortableQuestionItemProps & { errorMessage?: string }) {\r\n const isSystem = ['TEAM_SIZE', 'NAME_ON_TICKET'].includes(question.kind);\r\n\r\n const {\r\n attributes,\r\n listeners,\r\n setNodeRef,\r\n transform,\r\n transition,\r\n isDragging,\r\n } = useSortable({\r\n id: question.id,\r\n disabled: isLocked || isSystem || disabled\r\n });\r\n\r\n const style = {\r\n transform: CSS.Transform.toString(transform),\r\n transition,\r\n opacity: isDragging ? 0.5 : 1,\r\n zIndex: isDragging ? 1000 : 'auto',\r\n };\r\n\r\n const showTooltip = disabled && !isOpen;\r\n\r\n return (\r\n <div ref={setNodeRef} style={style} className={`ui-w-full ui-relative ${showTooltip ? 'ui-cursor-not-allowed ui-opacity-60' : ''}`} id={`question-${question.id}`}>\r\n <QuestionCard\r\n question={question}\r\n formId={formId}\r\n eventId={eventId}\r\n userUid={userUid}\r\n isLocked={isLocked}\r\n isOpen={isOpen}\r\n onToggle={onToggle}\r\n dragHandleProps={!isLocked && !isSystem && !disabled ? { ...attributes, ...listeners } : undefined}\r\n onDelete={onDelete}\r\n onUpdate={onUpdate}\r\n onSave={onSave}\r\n onDuplicate={onDuplicate}\r\n onCancel={() => onCancel?.(question.id)}\r\n isDirty={isDirty}\r\n isSaving={isSaving}\r\n isNew={isNew}\r\n isValid={isValid}\r\n errorMessage={errorMessage}\r\n scope={scope}\r\n participationType={participationType}\r\n disableDiscountOption={disableDiscountOption}\r\n showValidationErrors={showValidationErrors}\r\n storageService={storageService}\r\n />\r\n </div>\r\n );\r\n}\r\n"],"names":[],"mappings":";;;;AAsCO,MAAM,uBAA4D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,MAAM;AACF,6BACK,OAAA,EAAI,WAAU,oCACV,UAAA,cAAc,IAAI,CAAC,OAAO;AACvB,UAAM,WAAW,UAAU,EAAE;AAC7B,QAAI,CAAC,SAAU,QAAO;AAEtB,UAAM,WAAW,qBAAqB;AACtC,UAAM,QAAQ,WAAW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,IAAC;AAAA,IAAA;AAAA,MACG;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB,CAAC,YAAY,CAAC,YAAY,CAAC,WAAW,EAAE,GAAG,YAAY,GAAG,UAAA,IAAc;AAAA,MACzF;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,MAAM,qCAAW,SAAS;AAAA,MACpC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAAA,GAER;AAER;"}
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
function sanitizeQuestionData(question, newKind) {
|
|
2
|
-
const sanitized = { ...question, kind: newKind };
|
|
3
|
-
const choiceTypes = ["MULTIPLE_CHOICE", "DROPDOWN", "CHECKBOX"];
|
|
4
|
-
if (!choiceTypes.includes(newKind)) {
|
|
5
|
-
delete sanitized.options;
|
|
6
|
-
}
|
|
7
|
-
if (newKind !== "PAYMENT" && newKind !== "PAYMENT_CHECKBOX") {
|
|
8
|
-
delete sanitized.Categories;
|
|
9
|
-
}
|
|
10
|
-
if (newKind !== "DISCOUNT") {
|
|
11
|
-
delete sanitized.applies_on;
|
|
12
|
-
delete sanitized.discount_file_path;
|
|
13
|
-
delete sanitized.file;
|
|
14
|
-
}
|
|
15
|
-
if (!["EMAIL", "PHONE", "CNIC"].includes(newKind)) {
|
|
16
|
-
delete sanitized.validation;
|
|
17
|
-
}
|
|
18
|
-
return sanitized;
|
|
19
|
-
}
|
|
20
|
-
function mapKind(type) {
|
|
21
|
-
const map = {
|
|
22
|
-
"1": "INPUT_INT",
|
|
23
|
-
"2": "INPUT_STR",
|
|
24
|
-
"3": "INPUT_FLOAT",
|
|
25
|
-
"4": "MULTIPLE_CHOICE",
|
|
26
|
-
"5": "DROPDOWN",
|
|
27
|
-
"7": "FILE_UPLOAD",
|
|
28
|
-
"8": "PAYMENT",
|
|
29
|
-
"9": "EMAIL",
|
|
30
|
-
"10": "PHONE",
|
|
31
|
-
"11": "CNIC",
|
|
32
|
-
"12": "CHECKBOX",
|
|
33
|
-
"13": "PAYMENT_CHECKBOX",
|
|
34
|
-
"14": "DATE",
|
|
35
|
-
"15": "DISCOUNT",
|
|
36
|
-
"16": "TEAM_SIZE",
|
|
37
|
-
"17": "NAME_ON_TICKET"
|
|
38
|
-
};
|
|
39
|
-
return map[type] || "INPUT_STR";
|
|
40
|
-
}
|
|
41
|
-
function normalizeFormSchema(fields, discountFilePath, individualDiscountFilePath) {
|
|
42
|
-
const questions = {};
|
|
43
|
-
const questionOrder = [];
|
|
44
|
-
fields == null ? void 0 : fields.forEach((field) => {
|
|
45
|
-
var _a, _b;
|
|
46
|
-
const id = crypto.randomUUID();
|
|
47
|
-
const rawLabel = field.question || field.label || "Untitled Question";
|
|
48
|
-
const label = String(rawLabel);
|
|
49
|
-
const type = String(field.type);
|
|
50
|
-
const options = ((_a = field.options) == null ? void 0 : _a.map((opt) => {
|
|
51
|
-
if (typeof opt === "string") {
|
|
52
|
-
return {
|
|
53
|
-
id: crypto.randomUUID(),
|
|
54
|
-
label: opt,
|
|
55
|
-
value: opt
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
const optLabel = opt.name ?? opt.label ?? opt.value ?? (typeof opt === "object" ? "" : String(opt));
|
|
59
|
-
return {
|
|
60
|
-
id: crypto.randomUUID(),
|
|
61
|
-
label: String(optLabel),
|
|
62
|
-
value: String(opt.value ?? optLabel)
|
|
63
|
-
};
|
|
64
|
-
})) || [];
|
|
65
|
-
questions[id] = {
|
|
66
|
-
id,
|
|
67
|
-
kind: mapKind(type),
|
|
68
|
-
label: String(label),
|
|
69
|
-
originalLabel: String(label),
|
|
70
|
-
required: field.validation !== void 0 ? field.validation : !!field.required,
|
|
71
|
-
options,
|
|
72
|
-
placeholder: field.placeholder,
|
|
73
|
-
individual: field.individual,
|
|
74
|
-
scope: field.scope === "TEAM" || field.scope === "BOTH" ? field.scope : "INDIVIDUAL",
|
|
75
|
-
applies_on: field.applies_on || [],
|
|
76
|
-
discount_file_path: discountFilePath,
|
|
77
|
-
individual_discount_file_path: individualDiscountFilePath,
|
|
78
|
-
Categories: ((_b = field.Categories) == null ? void 0 : _b.map((c) => ({
|
|
79
|
-
id: c.id || crypto.randomUUID(),
|
|
80
|
-
name: c.name || "",
|
|
81
|
-
price: c.price || 0
|
|
82
|
-
}))) || []
|
|
83
|
-
};
|
|
84
|
-
questionOrder.push(id);
|
|
85
|
-
});
|
|
86
|
-
return {
|
|
87
|
-
questions,
|
|
88
|
-
questionOrder
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function reverseMapKind(kind) {
|
|
92
|
-
const map = {
|
|
93
|
-
"INPUT_INT": "1",
|
|
94
|
-
"INPUT_STR": "2",
|
|
95
|
-
"INPUT_FLOAT": "3",
|
|
96
|
-
"MULTIPLE_CHOICE": "4",
|
|
97
|
-
"DROPDOWN": "5",
|
|
98
|
-
"FILE_UPLOAD": "7",
|
|
99
|
-
"PAYMENT": "8",
|
|
100
|
-
"EMAIL": "9",
|
|
101
|
-
"PHONE": "10",
|
|
102
|
-
"CNIC": "11",
|
|
103
|
-
"CHECKBOX": "12",
|
|
104
|
-
"PAYMENT_CHECKBOX": "13",
|
|
105
|
-
"DATE": "14",
|
|
106
|
-
"DISCOUNT": "15",
|
|
107
|
-
"TEAM_SIZE": "16",
|
|
108
|
-
"NAME_ON_TICKET": "17"
|
|
109
|
-
};
|
|
110
|
-
return map[kind] || "2";
|
|
111
|
-
}
|
|
112
|
-
function denormalizeFormSchema(questions, order) {
|
|
113
|
-
return order.map((id) => {
|
|
114
|
-
var _a, _b;
|
|
115
|
-
const q = questions[id];
|
|
116
|
-
if (!q) return null;
|
|
117
|
-
return {
|
|
118
|
-
question: q.label,
|
|
119
|
-
label: q.label,
|
|
120
|
-
type: reverseMapKind(q.kind),
|
|
121
|
-
required: q.required,
|
|
122
|
-
validation: q.required,
|
|
123
|
-
// Legacy support
|
|
124
|
-
options: (_a = q.options) == null ? void 0 : _a.map((o) => ({
|
|
125
|
-
name: o.label,
|
|
126
|
-
label: o.label,
|
|
127
|
-
value: o.value || o.label
|
|
128
|
-
})),
|
|
129
|
-
placeholder: q.placeholder,
|
|
130
|
-
individual: q.individual,
|
|
131
|
-
scope: q.scope,
|
|
132
|
-
applies_on: q.applies_on,
|
|
133
|
-
discount_file_path: q.discount_file_path,
|
|
134
|
-
Categories: (_b = q.Categories) == null ? void 0 : _b.map((c) => ({
|
|
135
|
-
name: c.name,
|
|
136
|
-
price: c.price
|
|
137
|
-
}))
|
|
138
|
-
};
|
|
139
|
-
}).filter(Boolean);
|
|
140
|
-
}
|
|
141
|
-
function getDiscountFilePath(eventId, userUid, participationType, scope, question) {
|
|
142
|
-
const effectiveScope = scope || question.scope || (question.individual === false ? "TEAM" : "INDIVIDUAL");
|
|
143
|
-
const path = `/data/${userUid}/events/discounts/${eventId}.csv`;
|
|
144
|
-
const individualPath = `/data/${userUid}/events/discounts/${eventId}_individual.csv`;
|
|
145
|
-
const isBothParticipation = participationType === "3" || participationType === "BOTH";
|
|
146
|
-
let targetUploadPath = path;
|
|
147
|
-
if (isBothParticipation && effectiveScope === "INDIVIDUAL") {
|
|
148
|
-
targetUploadPath = individualPath;
|
|
149
|
-
}
|
|
150
|
-
return targetUploadPath;
|
|
151
|
-
}
|
|
152
|
-
function truncateMiddle(text, maxLength = 30) {
|
|
153
|
-
if (!text || text.length <= maxLength) return text;
|
|
154
|
-
const startChars = Math.ceil(maxLength / 2);
|
|
155
|
-
const endChars = Math.floor(maxLength / 2);
|
|
156
|
-
return `${text.substring(0, startChars)}...${text.substring(text.length - endChars)}`;
|
|
157
|
-
}
|
|
158
|
-
function validateQuestionError(q, questions, participationType, isSameQuestionTitleAllowed) {
|
|
159
|
-
var _a;
|
|
160
|
-
if (!q) return null;
|
|
161
|
-
if (!((_a = q.label) == null ? void 0 : _a.trim())) return "Question title is required.";
|
|
162
|
-
if (!isSameQuestionTitleAllowed) {
|
|
163
|
-
const normalizedLabel = q.label.trim().toLowerCase();
|
|
164
|
-
const isBothParticipation = participationType === "3" || participationType === "BOTH";
|
|
165
|
-
const hasDuplicate = Object.values(questions).some((other) => {
|
|
166
|
-
var _a2;
|
|
167
|
-
if (other.id === q.id) return false;
|
|
168
|
-
const otherLabel = (_a2 = other.label) == null ? void 0 : _a2.trim().toLowerCase();
|
|
169
|
-
if (otherLabel !== normalizedLabel) return false;
|
|
170
|
-
if (isBothParticipation) {
|
|
171
|
-
const qScope = q.scope || (q.individual === false ? "TEAM" : "INDIVIDUAL");
|
|
172
|
-
const otherScope = other.scope || (other.individual === false ? "TEAM" : "INDIVIDUAL");
|
|
173
|
-
if (qScope === "BOTH" || otherScope === "BOTH") return true;
|
|
174
|
-
if (qScope === otherScope) return true;
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
return true;
|
|
178
|
-
});
|
|
179
|
-
if (hasDuplicate) {
|
|
180
|
-
return "A question already exists with same title.";
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (["MULTIPLE_CHOICE", "CHECKBOX", "DROPDOWN"].includes(q.kind)) {
|
|
184
|
-
if (!q.options || q.options.length < 2) return "At least 2 options are required.";
|
|
185
|
-
const hasInvalidOption = q.options.some((o) => !o.label || !o.label.trim());
|
|
186
|
-
if (hasInvalidOption) return "All options must have a label.";
|
|
187
|
-
const labels = /* @__PURE__ */ new Set();
|
|
188
|
-
const hasDuplicate = q.options.some((o) => {
|
|
189
|
-
var _a2;
|
|
190
|
-
const label = (_a2 = o.label) == null ? void 0 : _a2.trim().toLowerCase();
|
|
191
|
-
if (labels.has(label)) return true;
|
|
192
|
-
labels.add(label);
|
|
193
|
-
return false;
|
|
194
|
-
});
|
|
195
|
-
if (hasDuplicate) return "Duplicate options found.";
|
|
196
|
-
}
|
|
197
|
-
if (["PAYMENT", "PAYMENT_CHECKBOX"].includes(q.kind)) {
|
|
198
|
-
if (!q.Categories || q.Categories.length === 0) return "At least 1 category is required.";
|
|
199
|
-
const hasInvalidCategory = q.Categories.some((c) => !c.name || !c.name.trim());
|
|
200
|
-
if (hasInvalidCategory) return "All categories must have a name.";
|
|
201
|
-
const names = /* @__PURE__ */ new Set();
|
|
202
|
-
const hasDuplicate = q.Categories.some((c) => {
|
|
203
|
-
var _a2;
|
|
204
|
-
const name = (_a2 = c.name) == null ? void 0 : _a2.trim().toLowerCase();
|
|
205
|
-
if (names.has(name)) return true;
|
|
206
|
-
names.add(name);
|
|
207
|
-
return false;
|
|
208
|
-
});
|
|
209
|
-
if (hasDuplicate) return "Duplicate categories found.";
|
|
210
|
-
}
|
|
211
|
-
if (q.kind === "DISCOUNT") {
|
|
212
|
-
const hasFile = !!q.file || !!q.file_name || !!q.discount_file_path || !!q.individual_discount_file_path;
|
|
213
|
-
if (!hasFile) return "Please upload a CSV file.";
|
|
214
|
-
if (!q.applies_on || q.applies_on.length === 0) {
|
|
215
|
-
return "Please select at least one item it applies on.";
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
export {
|
|
221
|
-
denormalizeFormSchema,
|
|
222
|
-
getDiscountFilePath,
|
|
223
|
-
normalizeFormSchema,
|
|
224
|
-
reverseMapKind,
|
|
225
|
-
sanitizeQuestionData,
|
|
226
|
-
truncateMiddle,
|
|
227
|
-
validateQuestionError
|
|
228
|
-
};
|
|
229
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/components/FormBuilder/utils.ts"],"sourcesContent":["import { QuestionDraft, FormDraft, QuestionKind } from \"./types\";\r\n\r\nexport function sanitizeQuestionData(question: QuestionDraft, newKind: QuestionKind): QuestionDraft {\r\n const sanitized = { ...question, kind: newKind };\r\n\r\n const choiceTypes: QuestionKind[] = ['MULTIPLE_CHOICE', 'DROPDOWN', 'CHECKBOX'];\r\n if (!choiceTypes.includes(newKind)) {\r\n delete sanitized.options;\r\n }\r\n\r\n if (newKind !== 'PAYMENT' && newKind !== 'PAYMENT_CHECKBOX') {\r\n delete sanitized.Categories;\r\n }\r\n\r\n if (newKind !== 'DISCOUNT') {\r\n delete sanitized.applies_on;\r\n delete sanitized.discount_file_path;\r\n delete sanitized.file;\r\n }\r\n\r\n if (!['EMAIL', 'PHONE', 'CNIC'].includes(newKind)) {\r\n delete sanitized.validation;\r\n }\r\n\r\n return sanitized;\r\n}\r\n\r\n// Map API string types to new QuestionKind\r\nfunction mapKind(type: string): any {\r\n const map: Record<string, string> = {\r\n '1': 'INPUT_INT',\r\n '2': 'INPUT_STR',\r\n '3': 'INPUT_FLOAT',\r\n '4': 'MULTIPLE_CHOICE',\r\n '5': 'DROPDOWN',\r\n '7': 'FILE_UPLOAD',\r\n '8': 'PAYMENT',\r\n '9': 'EMAIL',\r\n '10': 'PHONE',\r\n '11': 'CNIC',\r\n '12': 'CHECKBOX',\r\n '13': 'PAYMENT_CHECKBOX',\r\n '14': 'DATE',\r\n '15': 'DISCOUNT',\r\n '16': 'TEAM_SIZE',\r\n '17': 'NAME_ON_TICKET',\r\n };\r\n return map[type] || 'INPUT_STR';\r\n}\r\n\r\nexport function normalizeFormSchema(fields: any[], discountFilePath?: string, individualDiscountFilePath?: string): Partial<FormDraft> {\r\n const questions: Record<string, QuestionDraft> = {};\r\n const questionOrder: string[] = [];\r\n\r\n fields?.forEach((field) => {\r\n const id = crypto.randomUUID();\r\n const rawLabel = field.question || field.label || \"Untitled Question\";\r\n const label = String(rawLabel);\r\n const type = String(field.type);\r\n\r\n const options = field.options?.map((opt: any) => {\r\n if (typeof opt === 'string') {\r\n return {\r\n id: crypto.randomUUID(),\r\n label: opt,\r\n value: opt\r\n };\r\n }\r\n const optLabel = opt.name ?? opt.label ?? opt.value ?? (typeof opt === 'object' ? '' : String(opt));\r\n return {\r\n id: crypto.randomUUID(),\r\n label: String(optLabel),\r\n value: String(opt.value ?? optLabel)\r\n };\r\n }) || [];\r\n\r\n questions[id] = {\r\n id,\r\n kind: mapKind(type),\r\n label: String(label),\r\n originalLabel: String(label),\r\n required: field.validation !== undefined ? field.validation : !!field.required,\r\n options,\r\n placeholder: field.placeholder,\r\n individual: field.individual,\r\n scope: (field.scope === 'TEAM' || field.scope === 'BOTH') ? field.scope : 'INDIVIDUAL',\r\n applies_on: field.applies_on || [],\r\n discount_file_path: discountFilePath,\r\n individual_discount_file_path: individualDiscountFilePath,\r\n Categories: field.Categories?.map((c: any) => ({\r\n id: c.id || crypto.randomUUID(),\r\n name: c.name || \"\",\r\n price: c.price || 0\r\n })) || [],\r\n };\r\n questionOrder.push(id);\r\n });\r\n\r\n return {\r\n questions,\r\n questionOrder,\r\n };\r\n}\r\n\r\nexport function reverseMapKind(kind: QuestionKind): string {\r\n const map: Record<string, string> = {\r\n 'INPUT_INT': '1',\r\n 'INPUT_STR': '2',\r\n 'INPUT_FLOAT': '3',\r\n 'MULTIPLE_CHOICE': '4',\r\n 'DROPDOWN': '5',\r\n 'FILE_UPLOAD': '7',\r\n 'PAYMENT': '8',\r\n 'EMAIL': '9',\r\n 'PHONE': '10',\r\n 'CNIC': '11',\r\n 'CHECKBOX': '12',\r\n 'PAYMENT_CHECKBOX': '13',\r\n 'DATE': '14',\r\n 'DISCOUNT': '15',\r\n 'TEAM_SIZE': '16',\r\n 'NAME_ON_TICKET': '17',\r\n };\r\n return map[kind] || '2';\r\n}\r\n\r\n\r\n\r\nexport function denormalizeFormSchema(questions: Record<string, QuestionDraft>, order: string[]): any[] {\r\n return order.map(id => {\r\n const q = questions[id];\r\n if (!q) return null;\r\n\r\n return {\r\n question: q.label,\r\n label: q.label,\r\n type: reverseMapKind(q.kind),\r\n required: q.required,\r\n validation: q.required, // Legacy support\r\n options: q.options?.map(o => ({\r\n name: o.label,\r\n label: o.label,\r\n value: o.value || o.label\r\n })),\r\n placeholder: q.placeholder,\r\n individual: q.individual,\r\n scope: q.scope,\r\n applies_on: q.applies_on,\r\n discount_file_path: q.discount_file_path,\r\n Categories: q.Categories?.map(c => ({ \r\n name: c.name, \r\n price: c.price \r\n })),\r\n };\r\n }).filter(Boolean);\r\n}\r\n\r\nexport function getDiscountFilePath(\r\n eventId: string,\r\n userUid: string | undefined,\r\n participationType: string | undefined,\r\n scope: 'INDIVIDUAL' | 'TEAM' | undefined,\r\n question: QuestionDraft\r\n): string {\r\n const effectiveScope = scope || question.scope || (question.individual === false ? 'TEAM' : 'INDIVIDUAL');\r\n const path = `/data/${userUid}/events/discounts/${eventId}.csv`;\r\n const individualPath = `/data/${userUid}/events/discounts/${eventId}_individual.csv`;\r\n\r\n const isBothParticipation = participationType === '3' || participationType === 'BOTH';\r\n let targetUploadPath = path;\r\n\r\n if (isBothParticipation && effectiveScope === 'INDIVIDUAL') {\r\n targetUploadPath = individualPath;\r\n }\r\n return targetUploadPath;\r\n}\r\n\r\nexport function truncateMiddle(text: string, maxLength: number = 30): string {\r\n if (!text || text.length <= maxLength) return text;\r\n\r\n const startChars = Math.ceil(maxLength / 2);\r\n const endChars = Math.floor(maxLength / 2);\r\n\r\n return `${text.substring(0, startChars)}...${text.substring(text.length - endChars)}`;\r\n}\r\n\r\nexport function validateQuestionError(\r\n q: QuestionDraft | undefined,\r\n questions: Record<string, QuestionDraft>,\r\n participationType?: string,\r\n isSameQuestionTitleAllowed?: boolean\r\n): string | null {\r\n if (!q) return null;\r\n if (!q.label?.trim()) return \"Question title is required.\";\r\n\r\n // Duplicate Title Check\r\n if (!isSameQuestionTitleAllowed) {\r\n const normalizedLabel = q.label.trim().toLowerCase();\r\n const isBothParticipation = participationType === '3' || participationType === 'BOTH';\r\n\r\n const hasDuplicate = Object.values(questions).some(other => {\r\n if (other.id === q.id) return false;\r\n const otherLabel = other.label?.trim().toLowerCase();\r\n if (otherLabel !== normalizedLabel) return false;\r\n\r\n // If names match, check scope collision\r\n if (isBothParticipation) {\r\n const qScope = q.scope || (q.individual === false ? 'TEAM' : 'INDIVIDUAL');\r\n const otherScope = other.scope || (other.individual === false ? 'TEAM' : 'INDIVIDUAL');\r\n\r\n if (qScope === 'BOTH' || otherScope === 'BOTH') return true;\r\n if (qScope === otherScope) return true;\r\n\r\n return false;\r\n }\r\n\r\n return true;\r\n });\r\n\r\n if (hasDuplicate) {\r\n return \"A question already exists with same title.\";\r\n }\r\n }\r\n\r\n // Kind Specific Validation\r\n if (['MULTIPLE_CHOICE', 'CHECKBOX', 'DROPDOWN'].includes(q.kind)) {\r\n if (!q.options || q.options.length < 2) return \"At least 2 options are required.\";\r\n const hasInvalidOption = q.options.some(o => !o.label || !o.label.trim());\r\n if (hasInvalidOption) return \"All options must have a label.\";\r\n\r\n const labels = new Set();\r\n const hasDuplicate = q.options.some(o => {\r\n const label = o.label?.trim().toLowerCase();\r\n if (labels.has(label)) return true;\r\n labels.add(label);\r\n return false;\r\n });\r\n if (hasDuplicate) return \"Duplicate options found.\";\r\n }\r\n\r\n if (['PAYMENT', 'PAYMENT_CHECKBOX'].includes(q.kind)) {\r\n if (!q.Categories || q.Categories.length === 0) return \"At least 1 category is required.\";\r\n const hasInvalidCategory = q.Categories.some(c => !c.name || !c.name.trim());\r\n if (hasInvalidCategory) return \"All categories must have a name.\";\r\n\r\n const names = new Set();\r\n const hasDuplicate = q.Categories.some(c => {\r\n const name = c.name?.trim().toLowerCase();\r\n if (names.has(name)) return true;\r\n names.add(name);\r\n return false;\r\n });\r\n if (hasDuplicate) return \"Duplicate categories found.\";\r\n }\r\n\r\n if (q.kind === 'DISCOUNT') {\r\n const hasFile = !!q.file || !!q.file_name || !!q.discount_file_path || !!q.individual_discount_file_path;\r\n if (!hasFile) return \"Please upload a CSV file.\";\r\n\r\n if (!q.applies_on || q.applies_on.length === 0) {\r\n return \"Please select at least one item it applies on.\";\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n"],"names":["_a"],"mappings":"AAEO,SAAS,qBAAqB,UAAyB,SAAsC;AAChG,QAAM,YAAY,EAAE,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con } from "../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
|
|
4
|
-
import { faEyeSlash, faEye } from "../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
|
|
5
|
-
import { cn } from "../../utils/cn.js";
|
|
6
|
-
import InputErrorMessage from "../InputErrorMessage/InputErrorMessage.js";
|
|
7
|
-
import InformationPopover from "../InformationPopover/InformationPopover.js";
|
|
8
|
-
const FormInput = ({
|
|
9
|
-
label,
|
|
10
|
-
icon: Icon,
|
|
11
|
-
type,
|
|
12
|
-
placeholder,
|
|
13
|
-
value,
|
|
14
|
-
onChange,
|
|
15
|
-
onBlur,
|
|
16
|
-
error,
|
|
17
|
-
showPasswordToggle = false,
|
|
18
|
-
required = false,
|
|
19
|
-
description,
|
|
20
|
-
disabled,
|
|
21
|
-
min,
|
|
22
|
-
prefix,
|
|
23
|
-
isTextArea = false,
|
|
24
|
-
className = "",
|
|
25
|
-
inputCon = "",
|
|
26
|
-
inputClassName = "",
|
|
27
|
-
animated = false,
|
|
28
|
-
autoFocus = false,
|
|
29
|
-
tooltip,
|
|
30
|
-
suffix
|
|
31
|
-
}) => {
|
|
32
|
-
const [showPassword, setShowPassword] = useState(false);
|
|
33
|
-
const inputType = showPasswordToggle && showPassword ? "text" : type;
|
|
34
|
-
const localInputRef = useRef(null);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (autoFocus && localInputRef.current) {
|
|
37
|
-
localInputRef.current.focus();
|
|
38
|
-
}
|
|
39
|
-
}, [autoFocus]);
|
|
40
|
-
return /* @__PURE__ */ jsxs("div", { className: `ui-text-sm ui-space-y-2 ${className} ${animated ? "ui-group" : ""}`, children: [
|
|
41
|
-
label && /* @__PURE__ */ jsx("div", { className: "ui-flex ui-items-center ui-justify-between", children: /* @__PURE__ */ jsxs("div", { className: "ui-w-full ui-flex ui-items-center ui-gap-2", children: [
|
|
42
|
-
/* @__PURE__ */ jsxs("label", { className: "ui-text-sm ui-font-medium ui-text-gray-700 ui-block", children: [
|
|
43
|
-
label,
|
|
44
|
-
" ",
|
|
45
|
-
required && /* @__PURE__ */ jsx("span", { className: "ui-text-red-500", children: "*" })
|
|
46
|
-
] }),
|
|
47
|
-
tooltip && /* @__PURE__ */ jsx(InformationPopover, { text: tooltip })
|
|
48
|
-
] }) }),
|
|
49
|
-
isTextArea ? /* @__PURE__ */ jsx("div", { className: "ui-relative ui-space-y-1", children: /* @__PURE__ */ jsx(
|
|
50
|
-
"textarea",
|
|
51
|
-
{
|
|
52
|
-
value,
|
|
53
|
-
onChange: (e) => onChange(e.target.value),
|
|
54
|
-
placeholder,
|
|
55
|
-
disabled,
|
|
56
|
-
className: cn(
|
|
57
|
-
"ui-w-full ui-min-h-[150px] ui-p-3 ui-text-sm ui-text-gray-900 ui-border ui-rounded-lg ui-outline-none focus:ui-ring-2 focus:ui-ring-primaryx-500/20 focus:ui-border-primaryx-500",
|
|
58
|
-
error ? "ui-border-red-500" : "ui-border-gray-300"
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
) }) : /* @__PURE__ */ jsxs("div", { className: cn(
|
|
62
|
-
"ui-relative ui-flex ui-items-center",
|
|
63
|
-
animated ? "ui-bg-white ui-rounded-xl ui-px-3 ui-py-2 ui-transition-all ui-duration-200 hover:ui-shadow-sm focus-within:ui-shadow-md ui-overflow-hidden" : "",
|
|
64
|
-
animated && error ? "ui-ring-2 ui-ring-red-500" : "",
|
|
65
|
-
inputCon,
|
|
66
|
-
error && "ui-rounded-xl"
|
|
67
|
-
), children: [
|
|
68
|
-
Icon && /* @__PURE__ */ jsx(Icon, { className: "ui-absolute ui-left-3 ui-top-1/2 ui-transform ui--translate-y-1/2 ui-text-gray-400 ui-h-5 ui-w-5" }),
|
|
69
|
-
/* @__PURE__ */ jsx(
|
|
70
|
-
"input",
|
|
71
|
-
{
|
|
72
|
-
ref: localInputRef,
|
|
73
|
-
type: inputType,
|
|
74
|
-
placeholder,
|
|
75
|
-
value,
|
|
76
|
-
onChange,
|
|
77
|
-
onKeyDown: (e) => {
|
|
78
|
-
if (type === "number" && ["e", "E", "+", "-", "."].includes(e.key)) {
|
|
79
|
-
e.preventDefault();
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
onWheel: (e) => type === "number" && e.currentTarget.blur(),
|
|
83
|
-
onBlur: () => {
|
|
84
|
-
if (typeof value === "string") {
|
|
85
|
-
const trimmed = (value == null ? void 0 : value.trim()) || "";
|
|
86
|
-
if (trimmed !== value) {
|
|
87
|
-
onChange({ target: { value: trimmed } });
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (onBlur) onBlur();
|
|
91
|
-
},
|
|
92
|
-
disabled,
|
|
93
|
-
min: min || (inputType == "number" ? 0 : void 0),
|
|
94
|
-
required,
|
|
95
|
-
className: cn(
|
|
96
|
-
animated ? `ui-w-full ui-text-[26px] ui-font-medium placeholder:ui-text-gray-400/60 ui-outline-none ui-border-none focus:ui-outline-none focus:ui-ring-0 ui-p-0 ui-bg-transparent ui-transition-colors ui-duration-200 ui-text-gray-900 ui-cursor-text` : `ui-text-sm ui-w-full ${Icon ? "ui-pl-10" : "ui-pl-3"} ui-py-2 ui-border ${error ? "ui-border-red-500" : "ui-border-gray-300 hover:ui-border-gray-400"} ui-rounded-lg focus:ui-ring-2 focus:ui-ring-primaryx-500/20 focus:ui-border-primaryx-500 ui-transition-all ui-duration-200 ui-text-gray-900 placeholder-ui-gray-400 ui-bg-white ${showPasswordToggle ? "ui-pr-10" : "ui-pr-3"} ${suffix ? "ui-pr-12" : ""} ${disabled ? "ui-bg-gray-50 ui-cursor-not-allowed" : ""}`,
|
|
97
|
-
inputClassName
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
),
|
|
101
|
-
prefix && !animated && /* @__PURE__ */ jsx("span", { className: "ui-absolute ui-left-10 ui-top-1/2 ui-transform ui--translate-y-1/2 ui-text-gray-900 ui-text-sm", children: prefix }),
|
|
102
|
-
suffix && /* @__PURE__ */ jsx("span", { className: "ui-absolute ui-right-3 ui-top-1/2 ui--translate-y-1/2 ui-text-md ui-text-gray-900 ui-pointer-events-none ui-uppercase", children: suffix }),
|
|
103
|
-
showPasswordToggle && /* @__PURE__ */ jsx(
|
|
104
|
-
"button",
|
|
105
|
-
{
|
|
106
|
-
type: "button",
|
|
107
|
-
onClick: () => setShowPassword((prev) => !prev),
|
|
108
|
-
className: "ui-absolute ui-right-3 ui-top-1/2 ui-transform ui--translate-y-1/2 ui-text-sm ui-text-gray-500 hover:ui-text-gray-700 focus:ui-outline-none",
|
|
109
|
-
children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: showPassword ? faEyeSlash : faEye })
|
|
110
|
-
}
|
|
111
|
-
),
|
|
112
|
-
animated && /* @__PURE__ */ jsxs("div", { className: "ui-absolute ui-bottom-0 ui-left-0 ui-right-0 ui-h-0.5 ui-overflow-hidden", children: [
|
|
113
|
-
/* @__PURE__ */ jsx("div", { className: "ui-absolute ui-inset-0 ui-bg-gray-300 ui-rounded-full" }),
|
|
114
|
-
/* @__PURE__ */ jsx("div", { className: `ui-absolute ui-inset-0 ui-rounded-full ui-transform ui-origin-left ui-transition-transform ui-duration-300 ui-ease-out ${error ? "" : "ui-bg-primaryx-500 ui-group-hover:ui-scale-x-100 ui-scale-x-0"}` }),
|
|
115
|
-
/* @__PURE__ */ jsx("div", { className: `ui-absolute ui-inset-0 ui-rounded-full ui-transform ui-origin-left ui-transition-transform ui-duration-300 ui-ease-out ${error ? "" : "ui-bg-primaryx-500 ui-group-focus-within:ui-scale-x-100 ui-scale-x-0"}` })
|
|
116
|
-
] })
|
|
117
|
-
] }),
|
|
118
|
-
description && /* @__PURE__ */ jsx("p", { className: "ui-text-xs ui-text-gray-500", children: description }),
|
|
119
|
-
/* @__PURE__ */ jsx(InputErrorMessage, { error: error || "" })
|
|
120
|
-
] });
|
|
121
|
-
};
|
|
122
|
-
const FormInput$1 = memo(FormInput);
|
|
123
|
-
export {
|
|
124
|
-
FormInput$1 as default
|
|
125
|
-
};
|
|
126
|
-
//# sourceMappingURL=FormInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormInput.js","sources":["../../../src/components/FormInput/FormInput.tsx"],"sourcesContent":["import React, { memo, useState, useRef, useEffect } from 'react';\r\nimport { LucideIcon } from 'lucide-react';\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { faEye, faEyeSlash } from \"@fortawesome/free-solid-svg-icons\";\r\nimport { cn } from '../../utils/cn';\r\nimport InputErrorMessage from '../InputErrorMessage/InputErrorMessage';\r\nimport InformationPopover from '../InformationPopover/InformationPopover';\r\n\r\nexport interface FormInputProps {\r\n label?: string;\r\n icon?: LucideIcon;\r\n type: string;\r\n placeholder: string;\r\n value: string;\r\n onChange: (e: React.ChangeEvent<HTMLInputElement> | string) => void;\r\n onBlur?: () => void;\r\n error?: string;\r\n showPasswordToggle?: boolean;\r\n required?: boolean;\r\n description?: string;\r\n disabled?: boolean;\r\n min?: number;\r\n isTextArea?: boolean;\r\n className?: string;\r\n inputCon?: string;\r\n inputClassName?: string;\r\n animated?: boolean;\r\n autoFocus?: boolean;\r\n tooltip?: string;\r\n suffix?: string;\r\n prefix?: string;\r\n}\r\n\r\nconst FormInput = ({\r\n label,\r\n icon: Icon,\r\n type,\r\n placeholder,\r\n value,\r\n onChange,\r\n onBlur,\r\n error,\r\n showPasswordToggle = false,\r\n required = false,\r\n description,\r\n disabled,\r\n min,\r\n prefix,\r\n isTextArea = false,\r\n className = \"\",\r\n inputCon = \"\",\r\n inputClassName = \"\",\r\n animated = false,\r\n autoFocus = false,\r\n tooltip,\r\n suffix,\r\n}: FormInputProps) => {\r\n const [showPassword, setShowPassword] = useState(false);\r\n const inputType = showPasswordToggle && showPassword ? \"text\" : type;\r\n const localInputRef = useRef<HTMLInputElement>(null);\r\n\r\n useEffect(() => {\r\n if (autoFocus && localInputRef.current) {\r\n localInputRef.current.focus();\r\n }\r\n }, [autoFocus]);\r\n\r\n return (\r\n <div className={`ui-text-sm ui-space-y-2 ${className} ${animated ? 'ui-group' : ''}`}>\r\n {label && (\r\n <div className=\"ui-flex ui-items-center ui-justify-between\">\r\n <div className=\"ui-w-full ui-flex ui-items-center ui-gap-2\">\r\n <label className=\"ui-text-sm ui-font-medium ui-text-gray-700 ui-block\">\r\n {label} {required && <span className=\"ui-text-red-500\">*</span>}\r\n </label>\r\n {tooltip && <InformationPopover text={tooltip} />}\r\n </div>\r\n </div>\r\n )}\r\n\r\n {isTextArea ? (\r\n <div className=\"ui-relative ui-space-y-1\">\r\n {/* Placeholder for RichTextEditor or falling back to simple textarea for now */}\r\n <textarea\r\n value={value}\r\n onChange={(e) => onChange(e.target.value)}\r\n placeholder={placeholder}\r\n disabled={disabled}\r\n className={cn(\r\n \"ui-w-full ui-min-h-[150px] ui-p-3 ui-text-sm ui-text-gray-900 ui-border ui-rounded-lg ui-outline-none focus:ui-ring-2 focus:ui-ring-primaryx-500/20 focus:ui-border-primaryx-500\",\r\n error ? \"ui-border-red-500\" : \"ui-border-gray-300\"\r\n )}\r\n />\r\n </div>\r\n ) : (\r\n <div className={cn(\r\n \"ui-relative ui-flex ui-items-center\",\r\n animated ? 'ui-bg-white ui-rounded-xl ui-px-3 ui-py-2 ui-transition-all ui-duration-200 hover:ui-shadow-sm focus-within:ui-shadow-md ui-overflow-hidden' : '',\r\n animated && error ? 'ui-ring-2 ui-ring-red-500' : '',\r\n inputCon,\r\n error && 'ui-rounded-xl'\r\n )}>\r\n {Icon && <Icon className=\"ui-absolute ui-left-3 ui-top-1/2 ui-transform ui--translate-y-1/2 ui-text-gray-400 ui-h-5 ui-w-5\" />}\r\n\r\n <input\r\n ref={localInputRef}\r\n type={inputType}\r\n placeholder={placeholder}\r\n value={value}\r\n onChange={onChange as (e: React.ChangeEvent<HTMLInputElement>) => void}\r\n onKeyDown={(e) => {\r\n if (type === \"number\" && [\"e\", \"E\", \"+\", \"-\", \".\"].includes(e.key)) {\r\n e.preventDefault();\r\n }\r\n }}\r\n onWheel={(e) => type === \"number\" && e.currentTarget.blur()}\r\n onBlur={() => {\r\n if (typeof value === 'string') {\r\n const trimmed = value?.trim() || \"\";\r\n if (trimmed !== value) {\r\n onChange({ target: { value: trimmed } } as any);\r\n }\r\n }\r\n if (onBlur) onBlur();\r\n }}\r\n disabled={disabled}\r\n min={min || (inputType == \"number\" ? 0 : undefined)}\r\n required={required}\r\n className={cn(\r\n animated\r\n ? `ui-w-full ui-text-[26px] ui-font-medium placeholder:ui-text-gray-400/60 ui-outline-none ui-border-none focus:ui-outline-none focus:ui-ring-0 ui-p-0 ui-bg-transparent ui-transition-colors ui-duration-200 ui-text-gray-900 ui-cursor-text`\r\n : `ui-text-sm ui-w-full ${Icon ? 'ui-pl-10' : 'ui-pl-3'} ui-py-2 ui-border ${\r\n error ? 'ui-border-red-500' : 'ui-border-gray-300 hover:ui-border-gray-400'\r\n } ui-rounded-lg focus:ui-ring-2 focus:ui-ring-primaryx-500/20 focus:ui-border-primaryx-500 ui-transition-all ui-duration-200 ui-text-gray-900 placeholder-ui-gray-400 ui-bg-white ${\r\n showPasswordToggle ? 'ui-pr-10' : 'ui-pr-3'\r\n } ${suffix ? 'ui-pr-12' : ''} ${disabled ? 'ui-bg-gray-50 ui-cursor-not-allowed' : ''}`,\r\n inputClassName\r\n )}\r\n />\r\n\r\n {prefix && !animated && (\r\n <span className=\"ui-absolute ui-left-10 ui-top-1/2 ui-transform ui--translate-y-1/2 ui-text-gray-900 ui-text-sm\">\r\n {prefix}\r\n </span>\r\n )}\r\n\r\n {suffix && (\r\n <span className=\"ui-absolute ui-right-3 ui-top-1/2 ui--translate-y-1/2 ui-text-md ui-text-gray-900 ui-pointer-events-none ui-uppercase\">\r\n {suffix}\r\n </span>\r\n )}\r\n\r\n {showPasswordToggle && (\r\n <button\r\n type=\"button\"\r\n onClick={() => setShowPassword(prev => !prev)}\r\n className=\"ui-absolute ui-right-3 ui-top-1/2 ui-transform ui--translate-y-1/2 ui-text-sm ui-text-gray-500 hover:ui-text-gray-700 focus:ui-outline-none\"\r\n >\r\n <FontAwesomeIcon icon={showPassword ? faEyeSlash : faEye} />\r\n </button>\r\n )}\r\n\r\n {animated && (\r\n <div className=\"ui-absolute ui-bottom-0 ui-left-0 ui-right-0 ui-h-0.5 ui-overflow-hidden\">\r\n <div className=\"ui-absolute ui-inset-0 ui-bg-gray-300 ui-rounded-full\" />\r\n <div className={`ui-absolute ui-inset-0 ui-rounded-full ui-transform ui-origin-left ui-transition-transform ui-duration-300 ui-ease-out ${error ? '' : 'ui-bg-primaryx-500 ui-group-hover:ui-scale-x-100 ui-scale-x-0'}`} />\r\n <div className={`ui-absolute ui-inset-0 ui-rounded-full ui-transform ui-origin-left ui-transition-transform ui-duration-300 ui-ease-out ${error ? '' : 'ui-bg-primaryx-500 ui-group-focus-within:ui-scale-x-100 ui-scale-x-0'}`} />\r\n </div>\r\n )}\r\n </div>\r\n )}\r\n {description && <p className=\"ui-text-xs ui-text-gray-500\">{description}</p>}\r\n <InputErrorMessage error={error || \"\"} />\r\n </div>\r\n );\r\n};\r\n\r\nexport default memo(FormInput);\r\n"],"names":[],"mappings":";;;;;;;AAiCA,MAAM,YAAY,CAAC;AAAA,EACf;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ;AAAA,EACA;AACJ,MAAsB;AAClB,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AACtD,QAAM,YAAY,sBAAsB,eAAe,SAAS;AAChE,QAAM,gBAAgB,OAAyB,IAAI;AAEnD,YAAU,MAAM;AACZ,QAAI,aAAa,cAAc,SAAS;AACpC,oBAAc,QAAQ,MA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