@donotdev/crud 0.1.44 → 0.2.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/dist/CrudService.bulk.js +1 -1
- package/dist/CrudService.bulkAcross.d.ts.map +1 -1
- package/dist/CrudService.bulkAcross.js +1 -1
- package/dist/CrudService.cache.js +1 -1
- package/dist/CrudService.d.ts +12 -0
- package/dist/CrudService.d.ts.map +1 -1
- package/dist/CrudService.internal.d.ts +8 -0
- package/dist/CrudService.internal.d.ts.map +1 -1
- package/dist/CrudService.internal.js +2 -2
- package/dist/CrudService.js +1 -1
- package/dist/CrudService.mutations.js +1 -1
- package/dist/CrudService.optimistic.js +1 -1
- package/dist/CrudService.queries.d.ts +5 -0
- package/dist/CrudService.queries.d.ts.map +1 -1
- package/dist/CrudService.queries.js +1 -1
- package/dist/CrudService.subscriptions.js +1 -1
- package/dist/CrudStore.d.ts.map +1 -1
- package/dist/CrudStore.js +1 -1
- package/dist/FieldRegistry.d.ts +21 -2
- package/dist/FieldRegistry.d.ts.map +1 -1
- package/dist/FieldRegistry.js +1 -1
- package/dist/adapters/FunctionsAdapter.d.ts.map +1 -1
- package/dist/adapters/FunctionsAdapter.js +1 -1
- package/dist/components/CrudButton.d.ts +11 -2
- package/dist/components/CrudButton.d.ts.map +1 -1
- package/dist/components/CrudButton.js +1 -1
- package/dist/components/CrudCard.d.ts +1 -1
- package/dist/components/CrudCard.d.ts.map +1 -1
- package/dist/components/CrudCard.js +1 -1
- package/dist/components/DateFilter.d.ts +1 -1
- package/dist/components/DateFilter.d.ts.map +1 -1
- package/dist/components/DateFilter.js +1 -1
- package/dist/components/DisplayFieldRenderer.d.ts +10 -1
- package/dist/components/DisplayFieldRenderer.d.ts.map +1 -1
- package/dist/components/DisplayFieldRenderer.js +1 -1
- package/dist/components/DisplayThumbnail.js +1 -1
- package/dist/components/EntityFilters.d.ts +1 -1
- package/dist/components/EntityFilters.d.ts.map +1 -1
- package/dist/components/EntityFilters.js +1 -1
- package/dist/components/FormFieldRenderer.d.ts +9 -1
- package/dist/components/FormFieldRenderer.d.ts.map +1 -1
- package/dist/components/FormFieldRenderer.js +1 -1
- package/dist/components/FormLayout.d.ts +1 -1
- package/dist/components/FormLayout.d.ts.map +1 -1
- package/dist/components/FormLayout.js +1 -1
- package/dist/components/YearFilter.d.ts +1 -1
- package/dist/components/YearFilter.d.ts.map +1 -1
- package/dist/components/YearFilter.js +1 -1
- package/dist/components/controlled/complex/ControlledAddressField.d.ts +1 -1
- package/dist/components/controlled/complex/ControlledAddressField.d.ts.map +1 -1
- package/dist/components/controlled/complex/ControlledAddressField.js +1 -1
- package/dist/components/controlled/complex/ControlledDateField.d.ts +1 -1
- package/dist/components/controlled/complex/ControlledDateField.d.ts.map +1 -1
- package/dist/components/controlled/complex/ControlledFieldArrayField.d.ts +1 -1
- package/dist/components/controlled/complex/ControlledFieldArrayField.d.ts.map +1 -1
- package/dist/components/controlled/complex/ControlledFieldArrayField.js +1 -1
- package/dist/components/controlled/complex/ControlledGeoPointField.d.ts +1 -1
- package/dist/components/controlled/complex/ControlledGeoPointField.d.ts.map +1 -1
- package/dist/components/controlled/complex/ControlledGeoPointField.js +1 -1
- package/dist/components/controlled/complex/ControlledMapField.d.ts +1 -1
- package/dist/components/controlled/complex/ControlledMapField.d.ts.map +1 -1
- package/dist/components/controlled/complex/ControlledMapField.js +1 -1
- package/dist/components/controlled/complex/ControlledMultiInputField.d.ts +1 -1
- package/dist/components/controlled/complex/ControlledMultiInputField.d.ts.map +1 -1
- package/dist/components/controlled/complex/ControlledRichTextField.d.ts +1 -1
- package/dist/components/controlled/complex/ControlledRichTextField.d.ts.map +1 -1
- package/dist/components/controlled/complex/ControlledRichTextField.js +1 -1
- package/dist/components/controlled/complex/ControlledTimestampField.d.ts +1 -1
- package/dist/components/controlled/complex/ControlledTimestampField.d.ts.map +1 -1
- package/dist/components/controlled/complex/ControlledTimestampField.js +1 -1
- package/dist/components/controlled/file/ControlledDocumentField.d.ts +1 -1
- package/dist/components/controlled/file/ControlledDocumentField.d.ts.map +1 -1
- package/dist/components/controlled/file/ControlledDocumentField.js +1 -1
- package/dist/components/controlled/file/ControlledFileField.d.ts +1 -1
- package/dist/components/controlled/file/ControlledFileField.d.ts.map +1 -1
- package/dist/components/controlled/file/ControlledFileField.js +1 -1
- package/dist/components/controlled/file/ControlledImageField.d.ts +1 -1
- package/dist/components/controlled/file/ControlledImageField.d.ts.map +1 -1
- package/dist/components/controlled/file/ControlledImageField.js +1 -1
- package/dist/components/controlled/file/ControlledMultiDocumentField.d.ts +1 -1
- package/dist/components/controlled/file/ControlledMultiDocumentField.d.ts.map +1 -1
- package/dist/components/controlled/file/ControlledMultiDocumentField.js +1 -1
- package/dist/components/controlled/file/ControlledMultiFileField.d.ts +1 -1
- package/dist/components/controlled/file/ControlledMultiFileField.d.ts.map +1 -1
- package/dist/components/controlled/file/ControlledMultiFileField.js +1 -1
- package/dist/components/controlled/file/ControlledMultiImageField.d.ts +1 -1
- package/dist/components/controlled/file/ControlledMultiImageField.d.ts.map +1 -1
- package/dist/components/controlled/file/ControlledMultiImageField.js +1 -1
- package/dist/components/controlled/input/ControlledCheckboxField.d.ts +1 -1
- package/dist/components/controlled/input/ControlledCheckboxField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledCurrencyField.d.ts +1 -1
- package/dist/components/controlled/input/ControlledCurrencyField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledCurrencyField.js +1 -1
- package/dist/components/controlled/input/ControlledDurationField.d.ts +9 -1
- package/dist/components/controlled/input/ControlledDurationField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledDurationField.js +1 -1
- package/dist/components/controlled/input/ControlledGdprConsentField.d.ts +1 -1
- package/dist/components/controlled/input/ControlledGdprConsentField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledGdprConsentField.js +1 -1
- package/dist/components/controlled/input/ControlledNumberField.d.ts +1 -1
- package/dist/components/controlled/input/ControlledNumberField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledPasswordField.d.ts +1 -1
- package/dist/components/controlled/input/ControlledPasswordField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledPhoneField.d.ts +1 -1
- package/dist/components/controlled/input/ControlledPhoneField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledPhoneField.js +1 -1
- package/dist/components/controlled/input/ControlledPriceField.d.ts +1 -1
- package/dist/components/controlled/input/ControlledPriceField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledPriceField.js +1 -1
- package/dist/components/controlled/input/ControlledRangeField.d.ts +1 -1
- package/dist/components/controlled/input/ControlledRangeField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledRangeField.js +1 -1
- package/dist/components/controlled/input/ControlledRatingField.d.ts +10 -1
- package/dist/components/controlled/input/ControlledRatingField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledRatingField.js +1 -1
- package/dist/components/controlled/input/ControlledSwitchField.d.ts +1 -1
- package/dist/components/controlled/input/ControlledSwitchField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledSwitchField.js +1 -1
- package/dist/components/controlled/input/ControlledTextField.d.ts +1 -1
- package/dist/components/controlled/input/ControlledTextField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledTextField.js +1 -1
- package/dist/components/controlled/input/ControlledTextareaField.d.ts +1 -1
- package/dist/components/controlled/input/ControlledTextareaField.d.ts.map +1 -1
- package/dist/components/controlled/input/ControlledTextareaField.js +1 -1
- package/dist/components/controlled/select/ControlledComboboxField.d.ts +1 -1
- package/dist/components/controlled/select/ControlledComboboxField.d.ts.map +1 -1
- package/dist/components/controlled/select/ControlledComboboxField.js +1 -1
- package/dist/components/controlled/select/ControlledDropdownField.d.ts +1 -1
- package/dist/components/controlled/select/ControlledDropdownField.d.ts.map +1 -1
- package/dist/components/controlled/select/ControlledMultiDropdownField.d.ts +1 -1
- package/dist/components/controlled/select/ControlledMultiDropdownField.d.ts.map +1 -1
- package/dist/components/controlled/select/ControlledMultiDropdownField.js +1 -1
- package/dist/components/controlled/select/ControlledRadioField.d.ts +1 -1
- package/dist/components/controlled/select/ControlledRadioField.d.ts.map +1 -1
- package/dist/components/controlled/select/ControlledRadioField.js +1 -1
- package/dist/components/controlled/select/ControlledReferenceField.d.ts +1 -1
- package/dist/components/controlled/select/ControlledReferenceField.d.ts.map +1 -1
- package/dist/components/controlled/select/ControlledReferenceField.js +1 -1
- package/dist/components/controlled/select/ControlledYearField.d.ts +1 -1
- package/dist/components/controlled/select/ControlledYearField.d.ts.map +1 -1
- package/dist/components/controlled/types.d.ts +11 -2
- package/dist/components/controlled/types.d.ts.map +1 -1
- package/dist/components/controlled/types.js +1 -1
- package/dist/components/fields/display/AvatarFieldDisplay.js +1 -1
- package/dist/components/fields/display/CheckboxFieldDisplay.js +1 -1
- package/dist/components/fields/display/DateFieldDisplay.d.ts +9 -1
- package/dist/components/fields/display/DateFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/DateFieldDisplay.js +1 -1
- package/dist/components/fields/display/FileFieldDisplay.js +1 -1
- package/dist/components/fields/display/GeoPointFieldDisplay.d.ts +9 -1
- package/dist/components/fields/display/GeoPointFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/HiddenFieldDisplay.d.ts +1 -1
- package/dist/components/fields/display/HiddenFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/ImageFieldDisplay.d.ts +9 -1
- package/dist/components/fields/display/ImageFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/LinkFieldDisplay.d.ts +9 -1
- package/dist/components/fields/display/LinkFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/LinkFieldDisplay.js +1 -1
- package/dist/components/fields/display/MapFieldDisplay.d.ts +9 -1
- package/dist/components/fields/display/MapFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/MultiDropdownDisplay.d.ts +9 -1
- package/dist/components/fields/display/MultiDropdownDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/MultiInputTextFieldDisplay.d.ts +9 -1
- package/dist/components/fields/display/MultiInputTextFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/NumberFieldDisplay.d.ts +9 -1
- package/dist/components/fields/display/NumberFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/NumberFieldDisplay.js +1 -1
- package/dist/components/fields/display/PasswordFieldDisplay.d.ts +1 -1
- package/dist/components/fields/display/PasswordFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/PasswordFieldDisplay.js +1 -1
- package/dist/components/fields/display/PhoneNumberDisplay.d.ts +9 -1
- package/dist/components/fields/display/PhoneNumberDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/RadioFieldDisplay.d.ts +9 -1
- package/dist/components/fields/display/RadioFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/RangeFieldDisplay.d.ts +9 -1
- package/dist/components/fields/display/RangeFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/ReferenceFieldDisplay.d.ts +9 -1
- package/dist/components/fields/display/ReferenceFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/ReferenceFieldDisplay.js +1 -1
- package/dist/components/fields/display/RichTextDisplay.d.ts +12 -1
- package/dist/components/fields/display/RichTextDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/TextAreaDisplay.d.ts +9 -1
- package/dist/components/fields/display/TextAreaDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/TextAreaDisplay.js +1 -1
- package/dist/components/fields/display/TextFieldDisplay.d.ts +1 -1
- package/dist/components/fields/display/TextFieldDisplay.d.ts.map +1 -1
- package/dist/components/fields/display/TextFieldDisplay.js +1 -1
- package/dist/components/fields/display/TimestampFieldDisplay.d.ts +9 -1
- package/dist/components/fields/display/TimestampFieldDisplay.d.ts.map +1 -1
- package/dist/components/form/fields/AddressFieldComponent.d.ts +1 -1
- package/dist/components/form/fields/AddressFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/AddressFieldComponent.js +1 -1
- package/dist/components/form/fields/AvatarFieldComponent.d.ts +1 -1
- package/dist/components/form/fields/AvatarFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/AvatarFieldComponent.js +1 -1
- package/dist/components/form/fields/BadgeFieldComponent.d.ts +1 -1
- package/dist/components/form/fields/BadgeFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/BadgeFieldComponent.js +1 -1
- package/dist/components/form/fields/ButtonFieldComponent.d.ts +9 -1
- package/dist/components/form/fields/ButtonFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/ButtonFieldComponent.js +1 -1
- package/dist/components/form/fields/CheckboxFieldComponent.d.ts +8 -0
- package/dist/components/form/fields/CheckboxFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/ComboboxComponent.d.ts.map +1 -1
- package/dist/components/form/fields/ComboboxComponent.js +1 -1
- package/dist/components/form/fields/CurrencyFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/CurrencyFieldComponent.js +1 -1
- package/dist/components/form/fields/DateFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/DateFieldComponent.js +1 -1
- package/dist/components/form/fields/DocumentFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/DocumentFieldComponent.js +1 -1
- package/dist/components/form/fields/DropdownComponent.d.ts +8 -0
- package/dist/components/form/fields/DropdownComponent.d.ts.map +1 -1
- package/dist/components/form/fields/DropdownComponent.js +1 -1
- package/dist/components/form/fields/DurationFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/DurationFieldComponent.js +1 -1
- package/dist/components/form/fields/FileFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/FileFieldComponent.js +1 -1
- package/dist/components/form/fields/GdprConsentFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/GeoPointFieldComponent.d.ts +8 -0
- package/dist/components/form/fields/GeoPointFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/GeoPointFieldComponent.js +1 -1
- package/dist/components/form/fields/ImageFieldComponent.d.ts +8 -0
- package/dist/components/form/fields/ImageFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/ImageFieldComponent.js +1 -1
- package/dist/components/form/fields/MapFieldComponent.d.ts +8 -0
- package/dist/components/form/fields/MapFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/MultiDropdownComponent.d.ts.map +1 -1
- package/dist/components/form/fields/MultiDropdownComponent.js +1 -1
- package/dist/components/form/fields/MultiInputTextFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/MultiInputTextFieldComponent.js +1 -1
- package/dist/components/form/fields/NumberFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/NumberFieldComponent.js +1 -1
- package/dist/components/form/fields/PasswordFieldComponent.d.ts +1 -1
- package/dist/components/form/fields/PasswordFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/PasswordFieldComponent.js +1 -1
- package/dist/components/form/fields/PhoneNumberComponent.d.ts.map +1 -1
- package/dist/components/form/fields/PhoneNumberComponent.js +1 -1
- package/dist/components/form/fields/PriceFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/PriceFieldComponent.js +1 -1
- package/dist/components/form/fields/RadioFieldComponent.d.ts +9 -1
- package/dist/components/form/fields/RadioFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/RangeFieldComponent.d.ts +8 -0
- package/dist/components/form/fields/RangeFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/RangeFieldComponent.js +1 -1
- package/dist/components/form/fields/RatingFieldComponent.d.ts +9 -0
- package/dist/components/form/fields/RatingFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/RatingFieldComponent.js +1 -1
- package/dist/components/form/fields/ReferenceFieldComponent.d.ts +1 -1
- package/dist/components/form/fields/ReferenceFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/ReferenceFieldComponent.js +1 -1
- package/dist/components/form/fields/RichTextComponent.d.ts +1 -1
- package/dist/components/form/fields/RichTextComponent.d.ts.map +1 -1
- package/dist/components/form/fields/RichTextComponent.js +1 -1
- package/dist/components/form/fields/SwitchFieldComponent.d.ts +9 -0
- package/dist/components/form/fields/SwitchFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/SwitchFieldComponent.js +1 -1
- package/dist/components/form/fields/TextAreaComponent.d.ts +1 -1
- package/dist/components/form/fields/TextAreaComponent.d.ts.map +1 -1
- package/dist/components/form/fields/TextAreaComponent.js +1 -1
- package/dist/components/form/fields/TextFieldComponent.d.ts +2 -2
- package/dist/components/form/fields/TextFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/TextFieldComponent.js +1 -1
- package/dist/components/form/fields/TimestampFieldComponent.d.ts +8 -0
- package/dist/components/form/fields/TimestampFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/TimestampFieldComponent.js +1 -1
- package/dist/components/form/fields/internal/TiptapEditor.d.ts +1 -1
- package/dist/components/form/fields/internal/TiptapEditor.d.ts.map +1 -1
- package/dist/components/form/fields/internal/TiptapEditor.js +2 -2
- package/dist/components/form/internal/ImageViewerDialog.d.ts +1 -1
- package/dist/components/form/internal/ImageViewerDialog.d.ts.map +1 -1
- package/dist/components/form/internal/ImageViewerDialog.js +1 -1
- package/dist/contexts/UploadContext.d.ts +1 -1
- package/dist/contexts/UploadContext.d.ts.map +1 -1
- package/dist/fieldTypeRegistry.d.ts.map +1 -1
- package/dist/fieldTypeRegistry.js +1 -1
- package/dist/fieldTypeRegistry.store.d.ts.map +1 -1
- package/dist/fieldTypeRegistry.store.js +1 -1
- package/dist/fieldTypeRegistry.types.d.ts +11 -1
- package/dist/fieldTypeRegistry.types.d.ts.map +1 -1
- package/dist/forms/hooks/useController.d.ts.map +1 -1
- package/dist/forms/hooks/useController.js +1 -1
- package/dist/forms/hooks/useEntityField.d.ts.map +1 -1
- package/dist/forms/hooks/useEntityField.js +1 -1
- package/dist/forms/hooks/useEntityForm.d.ts.map +1 -1
- package/dist/forms/hooks/useEntityForm.js +1 -1
- package/dist/forms/types.d.ts +2 -2
- package/dist/forms/types.d.ts.map +1 -1
- package/dist/forms/utils/buildInitialValues.js +1 -1
- package/dist/forms/utils/isFieldEditable.js +1 -1
- package/dist/forms/utils/translateFieldLabel.js +1 -1
- package/dist/forms/utils/validateEntity.js +1 -1
- package/dist/hooks/useCrudFilters.d.ts.map +1 -1
- package/dist/hooks/useCrudFilters.js +1 -1
- package/dist/hooks/useCrudPageSize.js +1 -1
- package/dist/hooks/useEntityFavorites.js +1 -1
- package/dist/hooks/useFieldConditions.d.ts +1 -1
- package/dist/hooks/useFieldConditions.d.ts.map +1 -1
- package/dist/hooks/useFieldConditions.js +1 -1
- package/dist/hooks/useFileUpload.d.ts.map +1 -1
- package/dist/hooks/useFileUpload.js +1 -1
- package/dist/hooks/useReferenceResolver.js +1 -1
- package/dist/hooks/useRelatedItems.js +1 -1
- package/dist/registerBuiltinFieldTypes.d.ts.map +1 -1
- package/dist/registerBuiltinFieldTypes.js +1 -1
- package/dist/stores/FormStore.js +1 -1
- package/dist/stores/UploadStore.d.ts.map +1 -1
- package/dist/stores/UploadStore.js +1 -1
- package/dist/symbol-index.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/useBaseCrudList.d.ts.map +1 -1
- package/dist/useBaseCrudList.js +1 -1
- package/dist/useCrud.d.ts.map +1 -1
- package/dist/useCrud.js +1 -1
- package/dist/useCrudCardList.d.ts.map +1 -1
- package/dist/useCrudCardList.js +1 -1
- package/dist/useCrudList.d.ts.map +1 -1
- package/dist/useCrudList.js +1 -1
- package/dist/utils/clientListProcessing.d.ts.map +1 -1
- package/dist/utils/clientListProcessing.js +1 -1
- package/dist/utils/collections.js +1 -1
- package/dist/utils/imageProcessing.d.ts +45 -3
- package/dist/utils/imageProcessing.d.ts.map +1 -1
- package/dist/utils/imageProcessing.js +1 -1
- package/dist/utils/matchesFilter.js +1 -1
- package/dist/utils/mergeWithOptimistic.d.ts.map +1 -1
- package/dist/utils/mergeWithOptimistic.js +1 -1
- package/dist/utils/sanitizeHtml.d.ts +1 -0
- package/dist/utils/sanitizeHtml.d.ts.map +1 -1
- package/dist/utils/sanitizeHtml.js +1 -1
- package/dist/utils/uploadValidation.js +1 -1
- package/dist/workflows/defineWorkflow.d.ts +1 -1
- package/dist/workflows/defineWorkflow.d.ts.map +1 -1
- package/dist/workflows/defineWorkflow.js +1 -1
- package/dist/workflows/useEntityWorkflow.d.ts.map +1 -1
- package/dist/workflows/useEntityWorkflow.js +1 -1
- package/package.json +14 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i,jsxs as n}from"react/jsx-runtime";import{useId as m}from"react";import{DatePicker as z,DateTimePicker as $,Input as b,cn as h,Stack as d}from"@donotdev/components";const x=({label:u,value:s,onChange:v,error:c,helperText:t,mode:a="date",required:g,...p})=>{const r=m(),e=!!c,f=o=>{const S=o.target.value?new Date(o.target.value).toISOString():null;v(S)};let l="";if(s){const o=new Date(s);a==="date"?l=o.toISOString().split("T")[0]||"":a==="datetime-local"?l=o.toISOString().slice(0,16)||"":a==="month"?l=o.toISOString().slice(0,7):a==="time"?l=o.toISOString().slice(11,16):a==="week"&&(l=o.toISOString().split("T")[0]||"")}return a==="date"?n(d,{gap:"tight",children:[i(z,{id:r,label:u,value:s??null,onChange:v,required:g,"aria-describedby":h(e&&`${r}-error`,t&&!e&&`${r}-helper`),"aria-invalid":e,"data-variant":e?"destructive":void 0}),e&&n(d,{id:`${r}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[i("span",{children:"\u26A0"}),c]}),t&&!e&&i("p",{id:`${r}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:t})]}):a==="datetime-local"?n(d,{gap:"tight",children:[i($,{id:r,label:u,value:s??null,onChange:v,required:g,"aria-describedby":h(e&&`${r}-error`,t&&!e&&`${r}-helper`),"aria-invalid":e,"data-variant":e?"destructive":void 0}),e&&n(d,{id:`${r}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[i("span",{children:"\u26A0"}),c]}),t&&!e&&i("p",{id:`${r}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:t})]}):n(d,{gap:"tight",children:[i(b,{id:r,label:u,type:a,value:l,onChange:f,required:g,"aria-describedby":h(e&&`${r}-error`,t&&!e&&`${r}-helper`),"aria-invalid":e,"data-variant":e?"destructive":void 0,className:"dndev-w-full",...p}),e&&n(d,{id:`${r}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[i("span",{children:"\u26A0"}),c]}),t&&!e&&i("p",{id:`${r}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:t})]})};var y=x;export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/DocumentFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DocumentFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/DocumentFieldComponent.tsx"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,6BAA6B,CAAC;AAQ3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,MAAM,WAAW,2BAA2B;IAC1C,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,IAAI,CAAC;IACvC,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1D,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yBAAyB;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,yBAAyB;IACxC,8CAA8C;IAC9C,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,4BAA4B;IAC5B,YAAY,EAAE,MAAM,SAAS,EAAE,CAAC;CACjC;AA+ED;;;GAGG;AACH,QAAA,MAAM,sBAAsB,mIA6V3B,CAAC;AAIF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as n,Fragment as K}from"react/jsx-runtime";import{Upload as V,X as _,FileText as u,FileSpreadsheet as J,File as Q,Loader2 as Y,Eye as Z}from"lucide-react";import{useState as D,useRef as $,useImperativeHandle as ee,forwardRef as ae}from"react";import{Button as k,BUTTON_VARIANT as C,Text as s,Stack as m,Progress as re,Dialog as te,DialogContent as ne,DialogHeader as ie,DialogTitle as le}from"@donotdev/components";import{handleError as y,useTranslation as oe}from"@donotdev/core";import{useFileUpload as se}from"../../../hooks/useFileUpload";import{uploadFile as de,deleteFile as ce,getFileIcon as pe,formatFileSize as me,getDocumentAcceptString as ue}from"../../../utils/fileStorage";const ve=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".html",".csv"],fe=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/markdown","text/html","text/csv"];function ge({type:d,className:i}){switch(d){case"pdf":return a(u,{className:i,style:{color:"var(--destructive)"}});case"doc":return a(u,{className:i,style:{color:"var(--primary)"}});case"xls":return a(J,{className:i,style:{color:"var(--success)"}});case"ppt":return a(u,{className:i,style:{color:"var(--warning)"}});case"text":case"html":return a(u,{className:i});default:return a(Q,{className:i})}}function z(d){const i="."+d.name.split(".").pop()?.toLowerCase();return ve.includes(i)}const P=ae(({name:d="document",label:i,value:S,onChange:A,error:v,helperText:x,multiple:f=!1,maxFiles:L=10,maxSize:
|
|
1
|
+
"use client";import{jsx as a,jsxs as n,Fragment as K}from"react/jsx-runtime";import{Upload as V,X as _,FileText as u,FileSpreadsheet as J,File as Q,Loader2 as Y,Eye as Z}from"lucide-react";import{useState as D,useRef as $,useImperativeHandle as ee,forwardRef as ae}from"react";import{Button as k,BUTTON_VARIANT as C,Text as s,Stack as m,Progress as re,Dialog as te,DialogContent as ne,DialogHeader as ie,DialogTitle as le}from"@donotdev/components";import{handleError as y,useTranslation as oe}from"@donotdev/core";import{useFileUpload as se}from"../../../hooks/useFileUpload";import{uploadFile as de,deleteFile as ce,getFileIcon as pe,formatFileSize as me,getDocumentAcceptString as ue}from"../../../utils/fileStorage";const ve=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".html",".csv"],fe=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/markdown","text/html","text/csv"];function ge({type:d,className:i}){switch(d){case"pdf":return a(u,{className:i,style:{color:"var(--destructive)"}});case"doc":return a(u,{className:i,style:{color:"var(--primary)"}});case"xls":return a(J,{className:i,style:{color:"var(--success)"}});case"ppt":return a(u,{className:i,style:{color:"var(--warning)"}});case"text":case"html":return a(u,{className:i});default:return a(Q,{className:i})}}function z(d){const i="."+d.name.split(".").pop()?.toLowerCase();return ve.includes(i)}const P=ae(({name:d="document",label:i,value:S,onChange:A,error:v,helperText:x,multiple:f=!1,maxFiles:L=10,maxSize:H=25*1024*1024,storagePath:w,required:I,enablePreview:b=!0},R)=>{const{t:l}=oe("crud"),[N,g]=D(!1),[h,T]=D(null),c=$(null),E=ue();function M(e,r){return de(e,{storagePath:w,onProgress:t=>r(t.progress)})}const{files:o,addFiles:F,removeFile:O}=se({name:d,value:S,onChange:A,multiple:f,maxFiles:L,maxSize:H,accept:fe,storagePath:w,uploadFn:M});ee(R,()=>({upload:async()=>{},getDocuments:()=>o}),[o]);function W(e){const r=Array.from(e.target.files||[]);if(r.length>0){const t=r.filter(p=>z(p)?!0:(y(new Error("Invalid document type"),{userMessage:l("document.errors.invalidType",{fileName:p.name}),severity:"warning",showNotification:!0}),!1));t.length>0&&F(t)}c.current&&(c.current.value="")}function j(e){e.preventDefault(),g(!1);const r=Array.from(e.dataTransfer.files).filter(t=>z(t)?!0:(y(new Error("Invalid document type"),{userMessage:l("document.errors.invalidType",{fileName:t.name}),severity:"warning",showNotification:!0}),!1));r.length>0&&F(r)}async function B(e){const r=o.find(t=>t.id===e);if(r)try{r.uploaded&&"url"in r.uploaded&&await ce(r.uploaded),O(e)}catch(t){y(t,{userMessage:l("document.delete.failed"),severity:"error",showNotification:!0})}}function U(e){if(e.uploaded&&"url"in e.uploaded){const r=e.uploaded;r.mimeType==="application/pdf"&&T(r.url)}}const G=f||o.length===0;return n(K,{children:[n(m,{gap:"tight",children:[n(s,{level:"body",textAlign:"start",children:[i,I?"*":""]}),G&&n("div",{role:"button",tabIndex:0,"aria-label":l("document.upload.ariaLabel"),className:"dndev-surface","data-variant":v?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:N?"var(--primary)":v?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:N?"color-mix(in oklab, var(--primary) 5%, transparent)":"var(--surface)",transition:"border-color var(--dur-fast), background-color var(--dur-fast)",cursor:"pointer",outline:"none"},onDragOver:e=>{e.preventDefault(),g(!0)},onDragLeave:()=>g(!1),onDrop:j,onClick:()=>c.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),c.current?.click())},children:[a("input",{ref:c,type:"file",accept:E,multiple:f,style:{display:"none"},onChange:W}),n(m,{align:"center",justify:"center",children:[a(V,{className:"dndev-size-lg",style:{color:"var(--muted-foreground)"}}),a(s,{as:"p",variant:"muted",level:"small",textAlign:"center",children:l("document.upload.hint")}),a(s,{as:"p",variant:"muted",level:"caption",textAlign:"center",children:"PDF, Word, Excel, PowerPoint, TXT, Markdown, HTML"})]})]}),o.length>0&&a(m,{gap:"tight",children:o.map(e=>{const r=e.uploaded&&"mimeType"in e.uploaded?e.uploaded.mimeType:e.file.type,t=pe(r||"",e.file.name),p=e.status==="uploading",X=r==="application/pdf"||e.file.name.toLowerCase().endsWith(".pdf"),q=e.uploaded&&"size"in e.uploaded?e.uploaded.size:e.file.size;return n("div",{className:"dndev-surface","data-variant":"muted",style:{padding:"var(--gap-md)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",gap:"var(--gap-md)"},children:[a(ge,{type:t,className:"dndev-size-md"}),n(m,{gap:"none",style:{flex:1,minWidth:0},children:[a(s,{level:"small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.file.name}),n(s,{level:"caption",variant:"muted",children:[me(q),e.error&&n("span",{style:{color:"var(--destructive)"},children:[" ","\xB7 ",e.error]})]}),p&&a(re,{value:e.progress||0,max:100,style:{marginTop:"var(--gap-xs)"}})]}),n(m,{direction:"row",gap:"tight",children:[b&&X&&e.status==="complete"&&a(k,{variant:C.GHOST,onClick:()=>U(e),"aria-label":l("document.preview.ariaLabel"),children:a(Z,{className:"dndev-size-sm"})}),p?a(Y,{className:"dndev-size-sm",style:{animation:"spin 1s linear infinite"}}):a(k,{variant:C.GHOST,onClick:()=>B(e.id),"aria-label":l("document.delete.ariaLabel"),children:a(_,{className:"dndev-size-sm"})})]})]},e.id)})}),x&&a(s,{level:"caption",variant:v?"destructive":"muted",style:{marginTop:"var(--gap-xs)"},children:x})]}),b&&h&&a(te,{open:!!h,onOpenChange:()=>T(null),children:n(ne,{style:{maxWidth:"90vw",maxHeight:"90vh",width:"900px",height:"80vh"},children:[a(ie,{children:a(le,{children:l("document.preview.title")})}),a("iframe",{src:h,sandbox:"allow-same-origin",style:{width:"100%",height:"100%",border:"none",borderRadius:"var(--radius-md)"},title:"PDF Preview"})]})})]})});P.displayName="DocumentFieldComponent";var he=P;export{he as default};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Dropdown Component
|
|
3
|
+
* @description Renders a select input using Radix UI components. Form field component for dropdown/select inputs in CRUD forms.
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
1
9
|
import type { ChangeEvent, ComponentType } from 'react';
|
|
2
10
|
export interface DropdownComponentProps {
|
|
3
11
|
/** Field label */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/DropdownComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DropdownComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/DropdownComponent.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKxD,MAAM,WAAW,sBAAsB;IACrC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC,wBAAwB;IACxB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/D,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACpE,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,iBAAiB,EAAE,aAAa,CAAC,sBAAsB,CAuD5D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as g}from"react/jsx-runtime";import{Select as d,Stack as v}from"@donotdev/components";import{useTranslation as m}from"@donotdev/core";const f=({label:l,value:r,options:n,error:s,helperText:a,onChange:t,onBlur:i,required:u})=>{const{t:p}=m("crud"),c=r!=null?String(r):"";return g(v,{gap:"tight",children:[o(d,{label:l,value:c,onValueChange:e=>{t&&t({target:{value:e}})},onOpenChange:e=>!e&&i?.(),placeholder:p("actions.select","Select"),required:u,options:n.map(e=>({value:String(e.value),label:e.label}))}),a&&o("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:a})]})};var h=f;export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DurationFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/DurationFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DurationFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/DurationFieldComponent.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAI3C,kCAAkC;AAClC,eAAO,MAAM,gBAAgB,8CAA+C,CAAC;AAE7E,MAAM,WAAW,2BAA2B;IAC1C,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,0CAA0C;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC;CAChE;AA4BD;;;;;;GAMG;AACH,QAAA,MAAM,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAkLtE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as i,jsxs as
|
|
1
|
+
import{jsx as i,jsxs as l}from"react/jsx-runtime";import{Clock as x}from"lucide-react";import{useState as V,useMemo as k}from"react";import{Label as z,Stack as s,Button as S,Slider as w}from"@donotdev/components";const f=[15,30,45,60,90,120,150,180],N={15:"duration.15m",30:"duration.30m",45:"duration.45m",60:"duration.1h",90:"duration.1h30",120:"duration.2h",150:"duration.2h30",180:"duration.3h"};function q(e,n){const o=e<60?`${e}m`:e%60===0?`${e/60}h`:`${Math.floor(e/60)}h${e%60}`,u=N[e];return!n||!u?o:n(`crud:${u}`,{defaultValue:o})??o}const W=({label:e,value:n,onChange:o,error:u,helperText:d,disabled:m,required:p,readonly:C,min:g=0,max:v=480,step:M=5,t})=>{const r=typeof n=="number"&&!Number.isNaN(n)?n:0,h=f.includes(r),[c,b]=V(!h&&r>0),T=k(()=>f.map(a=>({minutes:a,label:q(a,t)})),[t]),y=t?t("crud:duration.custom",{defaultValue:"Custom"}):"Custom";if(C){const a=r===0?t?t("crud:duration.zero",{defaultValue:"\u2014"}):"\u2014":r<60?t?t("crud:duration.minutes",{count:r,defaultValue:`${r} min`}):`${r} min`:t?t("crud:duration.hoursMinutes",{hours:Math.floor(r/60),minutes:r%60,defaultValue:`${Math.floor(r/60)}h${r%60?` ${r%60}min`:""}`}):`${Math.floor(r/60)}h${r%60?` ${r%60}m`:""}`;return l(s,{gap:"tight",children:[i(z,{required:p,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:e}),l(s,{direction:"row",gap:"tight",align:"center",children:[i(x,{size:18,style:{color:"var(--muted-foreground)"},"aria-hidden":!0}),i("span",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-sm)"},children:a})]}),d&&i("p",{style:{fontSize:"var(--font-size-xs)",color:u?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})}return l(s,{children:[i(z,{required:p,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:e}),l(s,{direction:"row",gap:"tight",align:"center",style:{flexWrap:"wrap"},children:[T.map(({minutes:a,label:$})=>l(S,{type:"button",variant:r===a?"primary":"outline",disabled:m,onClick:()=>{b(!1),o(a)},"aria-pressed":r===a,"aria-label":$,children:[i(x,{size:14,style:{marginRight:"var(--gap-xs)"},"aria-hidden":!0}),$]},a)),i(S,{type:"button",variant:c?"primary":"outline",disabled:m,onClick:()=>{b(!0),!h&&r>0?o(r):o(30)},"aria-pressed":c,"aria-label":y,children:y})]}),c&&i(s,{gap:"tight",style:{marginTop:"var(--gap-sm)"},children:i(w,{value:[h?30:r],onValueChange:([a])=>o(Math.max(g,Math.min(v,a??0))),min:g,max:v,step:M,showValue:!0,disabled:m,"aria-label":e})}),d&&i("p",{style:{fontSize:"var(--font-size-xs)",color:u?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})};var j=W;export{f as DURATION_PRESETS,j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/FileFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/FileFieldComponent.tsx"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,6BAA6B,CAAC;AAO3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,MAAM,WAAW,uBAAuB;IACtC,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,IAAI,CAAC;IACvC,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1D,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,0CAA0C;IAC1C,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,wBAAwB;IACxB,QAAQ,EAAE,MAAM,SAAS,EAAE,CAAC;CAC7B;AAmDD;;;GAGG;AACH,QAAA,MAAM,kBAAkB,2HAiQvB,CAAC;AAIF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as s}from"react/jsx-runtime";import{Upload as B,X as M,File as U,Loader2 as E,FileText as g,FileSpreadsheet as H,FileImage as V,FileVideo as q,FileAudio as G,FileArchive as K,FileCode as W}from"lucide-react";import{useState as X,useRef as _,useImperativeHandle as J,forwardRef as Q}from"react";import{Button as Y,BUTTON_VARIANT as Z,Text as d,Stack as u,Progress as $}from"@donotdev/components";import{handleError as ee,useTranslation as ae}from"@donotdev/core";import{useFileUpload as re}from"../../../hooks/useFileUpload";import{uploadFile as le,deleteFile as se,getFileIcon as te,formatFileSize as ie}from"../../../utils/fileStorage";function ne({type:p,className:r}){switch(p){case"pdf":return a(g,{className:r,style:{color:"var(--destructive)"}});case"doc":return a(g,{className:r,style:{color:"var(--primary)"}});case"xls":return a(H,{className:r,style:{color:"var(--success)"}});case"ppt":return a(g,{className:r,style:{color:"var(--warning)"}});case"image":return a(V,{className:r});case"video":return a(q,{className:r});case"audio":return a(G,{className:r});case"archive":return a(K,{className:r});case"html":case"text":return a(W,{className:r});default:return a(U,{className:r})}}const b=Q(({name:p="file",label:r,value:T,onChange:w,error:m,helperText:h,accept:v,multiple:n=!1,maxFiles:k=10,maxSize:z=50*1024*1024,storagePath:y,required:
|
|
1
|
+
"use client";import{jsx as a,jsxs as s}from"react/jsx-runtime";import{Upload as B,X as M,File as U,Loader2 as E,FileText as g,FileSpreadsheet as H,FileImage as V,FileVideo as q,FileAudio as G,FileArchive as K,FileCode as W}from"lucide-react";import{useState as X,useRef as _,useImperativeHandle as J,forwardRef as Q}from"react";import{Button as Y,BUTTON_VARIANT as Z,Text as d,Stack as u,Progress as $}from"@donotdev/components";import{handleError as ee,useTranslation as ae}from"@donotdev/core";import{useFileUpload as re}from"../../../hooks/useFileUpload";import{uploadFile as le,deleteFile as se,getFileIcon as te,formatFileSize as ie}from"../../../utils/fileStorage";function ne({type:p,className:r}){switch(p){case"pdf":return a(g,{className:r,style:{color:"var(--destructive)"}});case"doc":return a(g,{className:r,style:{color:"var(--primary)"}});case"xls":return a(H,{className:r,style:{color:"var(--success)"}});case"ppt":return a(g,{className:r,style:{color:"var(--warning)"}});case"image":return a(V,{className:r});case"video":return a(q,{className:r});case"audio":return a(G,{className:r});case"archive":return a(K,{className:r});case"html":case"text":return a(W,{className:r});default:return a(U,{className:r})}}const b=Q(({name:p="file",label:r,value:T,onChange:w,error:m,helperText:h,accept:v,multiple:n=!1,maxFiles:k=10,maxSize:z=50*1024*1024,storagePath:y,required:C},S)=>{const{t:c}=ae("crud"),[x,f]=X(!1),o=_(null);function A(e,l){return le(e,{storagePath:y,onProgress:t=>l(t.progress)})}const{files:i,addFiles:F,removeFile:D}=re({name:p,value:T,onChange:w,multiple:n,maxFiles:k,maxSize:z,accept:v?[v]:[],storagePath:y,uploadFn:A});J(S,()=>({upload:async()=>{},getFiles:()=>i}),[i]);function I(e){const l=Array.from(e.target.files||[]);l.length>0&&F(l),o.current&&(o.current.value="")}function L(e){e.preventDefault(),f(!1),F(Array.from(e.dataTransfer.files))}async function P(e){const l=i.find(t=>t.id===e);if(l)try{l.uploaded&&"url"in l.uploaded&&await se(l.uploaded),D(e)}catch(t){ee(t,{userMessage:c("file.delete.failed"),severity:"error",showNotification:!0})}}const R=n||i.length===0;return s(u,{gap:"tight",children:[s(d,{level:"body",textAlign:"start",children:[r,C?"*":""]}),R&&s("div",{role:"button",tabIndex:0,"aria-label":c(n?"file.upload.ariaLabelMultiple":"file.upload.ariaLabelSingle"),className:"dndev-surface","data-variant":m?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:x?"var(--primary)":m?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:x?"color-mix(in oklab, var(--primary) 5%, transparent)":"var(--surface)",transition:"border-color var(--dur-fast), background-color var(--dur-fast)",cursor:"pointer",outline:"none"},onDragOver:e=>{e.preventDefault(),f(!0)},onDragLeave:()=>f(!1),onDrop:L,onClick:()=>o.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),o.current?.click())},children:[a("input",{ref:o,type:"file",accept:v,multiple:n,style:{display:"none"},onChange:I}),s(u,{align:"center",justify:"center",children:[a(B,{className:"dndev-size-lg",style:{color:"var(--muted-foreground)"}}),a(d,{as:"p",variant:"muted",level:"small",textAlign:"center",children:c(n?"file.upload.dragDropMultiple":"file.upload.dragDropSingle")})]})]}),i.length>0&&a(u,{gap:"tight",children:i.map((e,l)=>{const t=e.uploaded&&"mimeType"in e.uploaded?e.uploaded.mimeType:e.file.type,O=te(t||"",e.file.name),N=e.status==="uploading",j=e.uploaded&&"size"in e.uploaded?e.uploaded.size:e.file.size;return s("div",{className:"dndev-surface","data-variant":"muted",style:{padding:"var(--gap-md)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",gap:"var(--gap-md)"},children:[a(ne,{type:O,className:"dndev-size-md"}),s(u,{gap:"none",style:{flex:1,minWidth:0},children:[a(d,{level:"small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.file.name}),s(d,{level:"caption",variant:"muted",children:[ie(j),e.error&&s("span",{style:{color:"var(--destructive)"},children:[" ","\xB7 ",e.error]})]}),N&&a($,{value:e.progress||0,max:100,style:{marginTop:"var(--gap-xs)"}})]}),N?a(E,{className:"dndev-size-sm",style:{animation:"spin 1s linear infinite"}}):a(Y,{variant:Z.GHOST,onClick:()=>P(e.id),"aria-label":c("file.delete.ariaLabel"),children:a(M,{className:"dndev-size-sm"})})]},e.id)})}),h&&a(d,{level:"caption",variant:m?"destructive":"muted",style:{marginTop:"var(--gap-xs)"},children:h})]})});b.displayName="FileFieldComponent";var oe=b;export{oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GdprConsentFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/GdprConsentFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GdprConsentFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/GdprConsentFieldComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AAKpE,MAAM,WAAW,8BAA8B;IAC7C,sCAAsC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC1D,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,yBAAyB,EAAE,aAAa,CAC5C,8BAA8B,CA4I/B,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Geo Point Field Component
|
|
3
|
+
* @description Provides a coordinate input field. Form field component for geographic coordinate inputs in CRUD forms.
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
1
9
|
import type { ChangeEvent, ComponentType } from 'react';
|
|
2
10
|
export interface GeoPoint {
|
|
3
11
|
lat: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeoPointFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/GeoPointFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GeoPointFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/GeoPointFieldComponent.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAIxD,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,2BAA2B;IAC1C,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpE,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,QAAA,MAAM,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAsFtE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as a,jsxs as u}from"react/jsx-runtime";import{Label as b,Input as v,Stack as g}from"@donotdev/components";const h=({label:c,value:t={lat:0,lng:0},onChange:i,error:r,helperText:o,disabled:d,required:m})=>{const p=n=>{const e=parseFloat(n.target.value)||0;if(e>=-90&&e<=90){const l={...t,lat:e},s={target:{value:JSON.stringify(l)}};i(s)}},f=n=>{const e=parseFloat(n.target.value)||0;if(e>=-180&&e<=180){const l={...t,lng:e},s={target:{value:JSON.stringify(l)}};i(s)}};return u(g,{gap:"tight",children:[a(b,{required:m,style:{display:"block",fontSize:"var(--font-size-sm)",fontWeight:500},children:c}),u(g,{direction:"row",children:[a(v,{label:"Latitude",type:"number",value:t.lat,onChange:p,min:"-90",max:"90",step:"0.000001",disabled:d,"data-variant":r?"destructive":void 0,className:"dndev-w-full"}),a(v,{label:"Longitude",type:"number",value:t.lng,onChange:f,min:"-180",max:"180",step:"0.000001",disabled:d,"data-variant":r?"destructive":void 0,className:"dndev-w-full"})]}),o&&a("p",{style:{fontSize:"var(--font-size-xs)",color:r?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:o})]})};var y=h;export{y as default};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Picture } from '@donotdev/core';
|
|
2
|
+
import type { ProcessImageOptions } from '../../../utils/imageProcessing';
|
|
2
3
|
export interface ImageFieldComponentProps {
|
|
3
4
|
/** Field name (for upload registration) */
|
|
4
5
|
name?: string;
|
|
@@ -24,6 +25,13 @@ export interface ImageFieldComponentProps {
|
|
|
24
25
|
required?: boolean;
|
|
25
26
|
/** Camera capture mode: 'environment' (back), 'user' (front), or undefined (browser decides) */
|
|
26
27
|
capture?: 'environment' | 'user';
|
|
28
|
+
/**
|
|
29
|
+
* WebP processing applied before upload (sizes, ratio, quality, background).
|
|
30
|
+
* Omit for the defaults: 1920x1440 full + 300x225 thumb, 4:3 center crop,
|
|
31
|
+
* quality 0.85 / 0.65, white background. Entity fields set it through
|
|
32
|
+
* `options.fieldSpecific.image`.
|
|
33
|
+
*/
|
|
34
|
+
processing?: Omit<ProcessImageOptions, 'crop'>;
|
|
27
35
|
}
|
|
28
36
|
export interface ImageFieldComponentRef {
|
|
29
37
|
upload: () => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/ImageFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ImageFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/ImageFieldComponent.tsx"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAK9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAQ1E,MAAM,WAAW,wBAAwB;IACvC,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;IACnC,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IACtD,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gGAAgG;IAChG,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;IACjC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AA+LD;;GAEG;AACH,QAAA,MAAM,mBAAmB,6HAiQxB,CAAC;AAIF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as s,Fragment as
|
|
1
|
+
"use client";import{jsx as r,jsxs as s,Fragment as Z}from"react/jsx-runtime";import{DndContext as _,closestCenter as Y,PointerSensor as ee,TouchSensor as re,useSensor as A,useSensors as ae}from"@dnd-kit/core";import{SortableContext as oe,useSortable as te,rectSortingStrategy as ie,arrayMove as ne}from"@dnd-kit/sortable";import{CSS as se}from"@dnd-kit/utilities";import{Upload as le,X as U,Loader2 as de,GripVertical as ce}from"lucide-react";import{forwardRef as ue,useCallback as R,useImperativeHandle as pe,useRef as ge,useState as j}from"react";import{Text as h,Stack as C,Progress as me,handleImageError as he}from"@donotdev/components";import{useTranslation as fe}from"@donotdev/core";import{useFileUpload as ve}from"../../../hooks/useFileUpload";import{processImage as be}from"../../../utils/imageProcessing";import{uploadImage as ye}from"../../../utils/imageStorage";import{ImageViewerDialog as xe}from"../internal/ImageViewerDialog";const we=["image/*"];function Ce(a){return{id:a.id,file:a.file,previewURL:a.previewURL,hash:"",rotation:0,uploadProgress:a.progress,uploaded:a.uploaded,error:a.error}}function Se({file:a,index:f,multiple:v,onImageClick:S,onRemove:b,t:l}){const{attributes:n,listeners:k,setNodeRef:D,transform:d,transition:I,isDragging:y}=te({id:a.id}),c=a.progress!==null&&a.progress<100,u=v&&!c,p={transform:se.Transform.toString(d),transition:I,position:"relative",width:100,height:100,borderRadius:"var(--radius-md)",border:"var(--border-width) solid var(--border)",overflow:"hidden",backgroundColor:"var(--surface)",opacity:y?.5:1,cursor:u?"grab":"pointer",userSelect:"none",touchAction:u?"none":"auto"};return r("div",{ref:D,style:p,...n,...u?k:{},onClick:()=>{y||S(f)},children:c?s(C,{align:"center",justify:"center",style:{width:"100%",height:"100%"},children:[r(de,{style:{animation:"spin 1s linear infinite"}}),r(me,{value:a.progress||0,style:{width:"80%"}})]}):a.error?s(C,{align:"center",justify:"center",style:{width:"100%",height:"100%"},children:[r(U,{style:{color:"var(--destructive)"}}),r(h,{variant:"destructive",level:"small",children:a.error})]}):s(Z,{children:[v&&r("div",{style:{position:"absolute",top:4,left:4,padding:2,background:"rgba(0,0,0,0.5)",borderRadius:"var(--radius-sm)",display:"flex",zIndex:2,pointerEvents:"none"},children:r(ce,{style:{color:"white",width:14,height:14}})}),r("img",{src:a.previewURL,alt:l("image.alt.upload",{index:f+1}),draggable:!1,onError:he,style:{width:"100%",height:"100%",objectFit:"cover",pointerEvents:"none",userSelect:"none"}}),r("button",{type:"button",onClick:t=>{t.stopPropagation(),b(a.id)},onPointerDown:t=>t.stopPropagation(),style:{position:"absolute",top:4,right:4,padding:4,background:"rgba(0,0,0,0.5)",border:"none",borderRadius:"var(--radius-sm)",cursor:"pointer",display:"flex",zIndex:2},children:r(U,{style:{color:"white",width:16,height:16}})}),!a.uploaded&&r("div",{style:{position:"absolute",bottom:0,left:0,right:0,padding:4,background:"rgba(0,0,0,0.7)",textAlign:"center",pointerEvents:"none"},children:r(h,{variant:"muted",level:"small",style:{color:"white"},children:l("image.upload.pending",{defaultValue:"Pending"})})})]})})}const V=ue(({name:a="image",label:f,value:v,onChange:S,error:b,helperText:l,multiple:n=!1,maxFiles:k=10,maxSize:D=10*1024*1024,storagePath:d,required:I,capture:y,processing:c},u)=>{const{t:p}=fe("crud"),t=ge(null),[L,F]=j(!1),[N,E]=j(0),B=ae(A(ee,{activationConstraint:{distance:8}}),A(re,{activationConstraint:{delay:200,tolerance:5}})),M=R(async(e,o)=>{const{fullBlob:g,thumbBlob:x}=await be(e,c);return ye(g,x,e.name,{storagePath:d,onProgress:w=>o(w.progress)})},[d,c]),{files:i,addFiles:P,removeFile:T,reorderFiles:z}=ve({name:a,value:v,onChange:S,multiple:n,maxFiles:k,maxSize:D,accept:we,storagePath:d,uploadFn:M}),q=e=>{const o=Array.from(e.target.files||[]);o.length>0&&P(o),t.current&&(t.current.value="")},G=R(e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.files.length>0&&P(Array.from(e.dataTransfer.files))},[P]),H=R(e=>{const{active:o,over:g}=e;if(g&&o.id!==g.id){const x=i.findIndex(m=>m.id===o.id),w=i.findIndex(m=>m.id===g.id);if(x!==-1&&w!==-1){const m=ne(i.map(Q=>Q.id),x,w);z(m)}}},[i,z]),K=e=>{E(e),F(!0)},O=(e,o)=>{},W=e=>{const o=i[e];o&&T(o.id)},X=e=>{E(e)},$=n||i.length===0;pe(u,()=>({upload:async()=>{},focus:()=>t.current?.focus()}),[]);const J=i.map(Ce);return s(C,{gap:"tight",children:[s(h,{level:"body",textAlign:"start",children:[f,I&&"*"]}),$&&s("div",{role:"button",tabIndex:0,onClick:()=>t.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&t.current?.click()},onDragOver:e=>e.preventDefault(),onDrop:G,style:{border:`var(--border-width) dashed ${b?"var(--destructive)":"var(--border)"}`,borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:"var(--surface)",cursor:"pointer",textAlign:"center"},children:[r("input",{ref:t,type:"file",accept:"image/*",capture:y,multiple:n,style:{display:"none"},onChange:q}),s(C,{align:"center",children:[r(le,{style:{color:"var(--muted-foreground)"}}),r(h,{variant:"muted",level:"small",children:n?p("image.upload.dropzoneMultiple",{defaultValue:"Drop images here or click to upload"}):p("image.upload.dropzoneSingle",{defaultValue:"Drop image here or click to upload"})})]})]}),i.length>0&&r(_,{sensors:B,collisionDetection:Y,onDragEnd:H,children:r(oe,{items:i.map(e=>e.id),strategy:ie,children:r("div",{style:{display:"flex",flexWrap:"wrap",gap:"var(--gap-md)"},children:i.map((e,o)=>r(Se,{file:e,index:o,multiple:n,onImageClick:K,onRemove:T,t:p},e.id))})})}),l&&r(h,{variant:b?"destructive":"muted",level:"small",children:l}),r(xe,{images:J,selectedIndex:N,open:L,onClose:()=>F(!1),onUpdate:O,onDelete:W,onNavigate:X,multiple:n})]})});V.displayName="ImageFieldComponent";var ke=V;export{ke as default};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview MapFieldComponent
|
|
3
|
+
* @description Map field component for form inputs
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
1
9
|
import type { ChangeEvent, ComponentType } from 'react';
|
|
2
10
|
export interface MapFieldComponentProps {
|
|
3
11
|
/** Field label */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/MapFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/MapFieldComponent.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKxD,MAAM,WAAW,sBAAsB;IACrC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,2DAA2D;IAC3D,QAAQ,EAAE,CACR,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,WAAW,CAAC,gBAAgB,CAAC,KACvD,IAAI,CAAC;IACV,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,iBAAiB,EAAE,aAAa,CAAC,sBAAsB,CA0E5D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiDropdownComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/MultiDropdownComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MultiDropdownComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/MultiDropdownComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAUxD,MAAM,WAAW,2BAA2B;IAC1C,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,4BAA4B;IAC5B,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/D,8BAA8B;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gCAAgC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACrE,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAsHtE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as t,Fragment as q}from"react/jsx-runtime";import{useMemo as J,useId as M}from"react";import{Combobox as R,Tag as p,Stack as h}from"@donotdev/components";import{useTranslation as k}from"@donotdev/core";const d=4,v=3,B=({label:f,value:r=[],options:l,error:b,helperText:n,onChange:u,onBlur:S,required:x,className:y})=>{const{t:g}=k("crud"),m=M(),z=J(()=>l.map(e=>({value:String(e.value),label:e.label})),[l]),N=e=>{const s=Array.isArray(e)?e:[e],a={target:{value:JSON.stringify(s)}};u(a)},C=e=>{e||S?.()},O=e=>{const s=r.filter(c=>c!==e),a={target:{value:JSON.stringify(s)}};u(a)},i=!!b,A=`${m}-error`,T=`${m}-helper`,j=r.length>0?t(q,{children:[r.slice(0,r.length>d?v:d).map((e,s)=>{const a=l.find(c=>String(c.value)===e)?.label||e;return o(p,{size:"sm",onRemove:()=>O(e),children:a},s)}),r.length>d&&t(p,{size:"sm",variant:"outline",disabled:!0,children:["+",r.length-v," more"]})]}):void 0;return t(h,{gap:"tight",className:y,children:[o(R,{label:f,value:r,onValueChange:N,onOpenChange:C,placeholder:g("actions.selectOptions","Select options..."),emptyMessage:g("messages.noResults","No results found"),options:z,multiple:!0,required:x,variant:i?"destructive":void 0,chips:j}),i&&t(h,{id:A,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[o("span",{children:"\u26A0"}),n]}),n&&!i&&o("p",{id:T,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:n})]})};var I=B;export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiInputTextFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/MultiInputTextFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MultiInputTextFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/MultiInputTextFieldComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKxD,MAAM,WAAW,iCAAiC;IAChD,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,sEAAsE;IACtE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpE,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,4BAA4B,EAAE,aAAa,CAC/C,iCAAiC,CAiFlC,CAAC;AAEF,eAAe,4BAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,jsxs as i}from"react/jsx-runtime";import{useState as y}from"react";import{Input as h,Button as b,Stack as d}from"@donotdev/components";import{useTranslation as x}from"@donotdev/core";const N=({label:m,value:
|
|
1
|
+
"use client";import{jsx as n,jsxs as i}from"react/jsx-runtime";import{useState as y}from"react";import{Input as h,Button as b,Stack as d}from"@donotdev/components";import{useTranslation as x}from"@donotdev/core";const N=({label:m,value:s=[],onChange:l,className:c,required:g})=>{const{t:o}=x("crud"),[t,u]=y(""),p=()=>{if(t.trim()){const e=[...s,t.trim()],r={target:{value:JSON.stringify(e)}};l(r),u("")}},f=e=>{const r=s.filter((w,v)=>v!==e),a={target:{value:JSON.stringify(r)}};l(a)};return i(d,{className:c,children:[i(d,{direction:"row",align:"end",children:[n(h,{label:m,type:"text",value:t,onChange:e=>u(e.target.value),required:g,className:"dndev-flex-1",placeholder:o("form.typeAndPressAdd","Type and press Add...")}),n(b,{type:"button",onClick:p,disabled:!t.trim(),children:o("form.add","Add")})]}),n(d,{direction:"row",wrap:"wrap",children:s.map((e,r)=>i("span",{className:"dndev-surface","data-variant":"muted",style:{display:"inline-flex",alignItems:"center",gap:"var(--gap-sm)",padding:"var(--gap-sm) var(--gap-md)",fontSize:"var(--font-size-sm)",fontWeight:500,borderRadius:"var(--radius-lg)"},children:[e,n("button",{type:"button",onClick:()=>f(r),style:{color:"var(--muted-foreground)",marginInlineStart:"var(--gap-sm)"},onMouseEnter:a=>{a.currentTarget.style.color="var(--foreground)"},onMouseLeave:a=>{a.currentTarget.style.color="var(--muted-foreground)"},"aria-label":`${o("form.remove","Remove")} ${e}`,children:"\xD7"})]},r))})]})};var S=N;export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/NumberFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NumberFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/NumberFieldComponent.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKxD,MAAM,WAAW,yBAAyB;IACxC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACzD,0CAA0C;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sHAAsH;IACtH,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;CAC1C;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,oBAAoB,EAAE,aAAa,CAAC,yBAAyB,CAqJlE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as v,jsxs as j}from"react/jsx-runtime";import{useState as q,useEffect as z,useCallback as f}from"react";import{Input as D,cn as E,Stack as I}from"@donotdev/components";import{useTranslation as L}from"@donotdev/core";const M=({label:b,value:l,onChange:i,error:g,helperText:c,min:x,max:y,step:N,disabled:s,required:S,className:h,mask:r="number",...
|
|
1
|
+
import{jsx as v,jsxs as j}from"react/jsx-runtime";import{useState as q,useEffect as z,useCallback as f}from"react";import{Input as D,cn as E,Stack as I}from"@donotdev/components";import{useTranslation as L}from"@donotdev/core";const M=({label:b,value:l,onChange:i,error:g,helperText:c,min:x,max:y,step:N,disabled:s,required:S,className:h,mask:r="number",...w})=>{const{i18n:F}=L(),n=F?.language||(typeof navigator<"u"?navigator.language:"en-US"),u=f(a=>a==null||isNaN(a)?"":r==="currency"?a.toLocaleString(n,{minimumFractionDigits:2,maximumFractionDigits:2}):r==="mileage"?Math.round(a).toLocaleString(n):a.toString(),[r,n]),T=f(a=>{if(!a||a.trim()==="")return null;const t=new Intl.NumberFormat(n).formatToParts(1234.56),e=t.find(m=>m.type==="group")?.value||",",C=t.find(m=>m.type==="decimal")?.value||".";let o=a.replace(new RegExp(`\\${e}`,"g"),"");o=o.replace(C,"."),o=o.replace(/[^\d.\-]/g,"");const p=parseFloat(o);return isNaN(p)?null:p},[n]),[k,d]=q(()=>u(l));return z(()=>{d(u(l))},[l,u]),j(I,{gap:"tight",children:[v(D,{type:r==="number"?"number":"text",inputMode:r==="number"?void 0:"decimal",label:b,value:k,onChange:a=>{const t=a.target.value;if(d(t),r==="number"){const e=parseFloat(t);isNaN(e)?i(a):i({...a,target:{...a.target,value:e.toString()}})}else{const e=T(t);e!==null?i({...a,target:{...a.target,value:e.toString()}}):t===""&&i({...a,target:{...a.target,value:""}})}},min:x,max:y,step:N,disabled:s,required:S,className:E("dndev-w-full",h),"data-variant":g?"destructive":void 0,style:{opacity:s?"var(--opacity-muted)":void 0,cursor:s?"not-allowed":void 0},...w}),c&&v("p",{style:{fontSize:"var(--font-size-xs)",color:g?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:c})]})};var G=M;export{G as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PasswordInput } from '@donotdev/components';
|
|
2
1
|
import type { ChangeEvent, ComponentProps, ComponentType } from 'react';
|
|
2
|
+
import { PasswordInput } from '@donotdev/components';
|
|
3
3
|
export interface PasswordFieldComponentProps extends Omit<ComponentProps<typeof PasswordInput>, 'value' | 'onChange'> {
|
|
4
4
|
/** Field label */
|
|
5
5
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PasswordFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PasswordFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PasswordFieldComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAEvE,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CACvD,cAAc,CAAC,OAAO,aAAa,CAAC,EACpC,OAAO,GAAG,UAAU,CACrB;IACC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CACR,KAAK,EAAE,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KACvD,IAAI,CAAC;IACV,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAqCtE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as d}from"react/jsx-runtime";import{useId as i}from"react";import{PasswordInput as u,Stack as m}from"@donotdev/components";const p=({label:o,value:s,onChange:t,error:
|
|
1
|
+
"use client";import{jsx as a,jsxs as d}from"react/jsx-runtime";import{useId as i}from"react";import{PasswordInput as u,Stack as m}from"@donotdev/components";const p=({label:o,value:s,onChange:t,error:l,helperText:e,...r})=>{const n=i();return d(m,{gap:"tight",children:[a(u,{id:n,value:s??"",onChange:t,label:o,className:"dndev-w-full",required:r.required,...r}),e&&a("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:e})]})};var c=p;export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneNumberComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PhoneNumberComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PhoneNumberComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PhoneNumberComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAexD,MAAM,WAAW,yBAAyB;IACxC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACzD,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oCAAoC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4EAA4E;IAC5E,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;GAMG;AACH,QAAA,MAAM,oBAAoB,EAAE,aAAa,CAAC,yBAAyB,CA8PlE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as i,jsxs as s}from"react/jsx-runtime";import{useState as L,useMemo as
|
|
1
|
+
"use client";import{jsx as i,jsxs as s}from"react/jsx-runtime";import{useState as L,useMemo as h,useEffect as M,useId as O}from"react";import{Input as j,FloatingLabel as q,Button as B,BUTTON_VARIANT as E,DropdownMenu as U,Stack as f,cn as D}from"@donotdev/components";import{Flag as T,COUNTRIES as y}from"@donotdev/core";const V=({label:W,value:d="",onChange:C,error:N,helperText:g,required:F=!1,disabled:v=!1,defaultCountry:x="FR",showFlags:S=!0,preferredCountries:c,countries:m})=>{const n=O(),p=h(()=>m&&m.length>0?m.map(e=>y.find(r=>r.code===e)).filter(e=>e!==void 0):Array.from(y),[m]),l=h(()=>{if(!c||c.length===0)return p;const e=c.map(t=>p.find(k=>k.code===t)).filter(t=>t!==void 0),r=p.filter(t=>!c.includes(t.code));return[...e,...r]},[p,c]),u=h(()=>l.find(e=>e.code===x)||l[0]||y[0],[x,l]),{country:b,phoneNumber:$}=h(()=>{if(!d)return{country:u,phoneNumber:""};const e=l.find(t=>d.startsWith(t.dialCode));if(e){let t=d.slice(e.dialCode.length).trim();return t.startsWith("0")&&(t=t.slice(1).trim()),t=t.replace(/\s+/g," ").trim(),{country:e,phoneNumber:t}}if(d.startsWith("+"))return{country:u,phoneNumber:d};let r=d.trim();return r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim(),{country:u,phoneNumber:r}},[d,u,l]),[a,z]=L(u);M(()=>{b.code!==a.code&&z(b)},[b,a.code]);const R=$,w=e=>{z(e);let r=R;r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim();const t={target:{value:e.dialCode+(r?" "+r:"")}};C(t)},A=e=>{let r=e.target.value;r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim();const t={target:{value:a.dialCode+(r?" "+r:"")}};C(t)},I=l.map(e=>({label:e.dialCode,onClick:()=>w(e),checked:e.code===a.code,children:S?s(f,{direction:"row",align:"center",gap:"tight",children:[i(T,{code:e.flagCode,title:e.name}),i("span",{children:e.dialCode}),i("span",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-xs)"},children:e.name})]}):s("span",{children:[e.dialCode," ",e.name]})})),o=!!N;return s(f,{gap:"tight",children:[i(q,{htmlFor:n,label:W,disabled:v,required:F,children:s("div",{className:"dndev-relative",style:{display:"flex",gap:0},children:[i(U,{trigger:i(B,{type:"button",variant:E.GHOST,disabled:v,style:{minWidth:"fit-content",padding:"0 var(--gap-md)"},"aria-label":`Country code: ${a.dialCode}`,children:s(f,{direction:"row",align:"center",gap:"tight",children:[S&&i(T,{code:a.flagCode,title:a.name}),i("span",{children:a.dialCode})]})}),items:I,contentWidth:"16rem"}),i(j,{id:n,type:"tel",inputMode:"tel",value:R,onChange:A,disabled:v,placeholder:"6 12 34 56 78",bare:!0,"data-variant":o?"destructive":void 0,className:"dndev-flex-1",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderRadius:"0 var(--radius-md) var(--radius-md) 0"},"aria-describedby":D(o&&`${n}-error`,g&&!o&&`${n}-helper`),"aria-invalid":o})]})}),o&&s(f,{id:`${n}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[i("span",{children:"\u26A0"}),N]}),g&&!o&&i("p",{id:`${n}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:g})]})};var _=V;export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriceFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PriceFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PriceFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PriceFieldComponent.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,OAAO,CAAC;AAaxD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,wBAAwB;IACvC,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1B,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0GAA0G;IAC1G,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAYD,QAAA,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,CAwMhE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n,jsxs as s}from"react/jsx-runtime";import{CirclePlus as R,CircleMinus as U}from"lucide-react";import{useId as q,useState as z}from"react";import{Input as C,Checkbox as D,Stack as E,Select as A,CollapsiblePrimitive as B,CollapsibleTrigger as G,CollapsibleContent as H}from"@donotdev/components";import{useTranslation as J,getCurrencySymbol as L}from"@donotdev/core";const O=["EUR","USD","GBP","CHF","JPY","KRW"],Y=({label:f,value:a,onChange:I,error:c,helperText:g,required:P=!1,disabled:o=!1,placeholder:N="0",defaultCurrency:d="EUR",optionsTitle:x="Price options",currencies:b})=>{const u=q(),{t:p}=J("crud"),r=b?.length?b:[...O],h=a?.currency??d,m=r.includes(h)?h:r[0]??d,T=a?.vatIncluded??!0,y=a?.discountPercent??0,S=`${f} (${L(m)})`,i=e=>{const l=e.amount!==void 0?e.amount:a?.amount??null;let t=e.currency!==void 0?e.currency:a?.currency??d;r.includes(t)||(t=m);const F=e.vatIncluded!==void 0?e.vatIncluded:a?.vatIncluded??!0,M=e.discountPercent!==void 0?e.discountPercent:a?.discountPercent??0;I({amount:l===null?null:Number(l),currency:t,vatIncluded:F,discountPercent:Number(M)})},k=e=>{const l=e.target.value;if(l===""||l===null){i({amount:null});return}const t=parseFloat(l);i({amount:isNaN(t)?null:t})},V=e=>{i({currency:e||d})},$=e=>{const l=e.target.value;if(l===""||l===null){i({discountPercent:0});return}const t=parseFloat(l);i({discountPercent:isNaN(t)?0:t})},[v,j]=z(!1);return s(B,{open:v,onOpenChange:j,children:[s(E,{children:[s("div",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:"var(--gap-sm)",alignItems:"end"},children:[n(C,{id:u,type:"number",inputMode:"decimal",label:S,value:a?.amount!==void 0&&a?.amount!==null?a.amount:"",onChange:k,disabled:o,placeholder:N,required:P,min:0,step:.01,"data-variant":c?"destructive":void 0,"aria-invalid":c}),n(G,{asChild:!0,children:n("button",{type:"button","aria-label":x,"aria-expanded":v,className:"dndev-collapsible-trigger",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"var(--gap-sm)",background:"none",border:"none",cursor:"pointer"},children:v?n(U,{className:"dndev-collapsible-icon","aria-hidden":"true"}):n(R,{className:"dndev-collapsible-icon","aria-hidden":"true"})})})]}),n(H,{className:"dndev-collapsible-content",children:s("div",{style:{display:"grid",gridTemplateColumns:r.length>1?"1fr auto 1fr":"auto 1fr",gap:"var(--gap-sm)",alignItems:"end",paddingTop:"var(--gap-md)"},children:[r.length>1&&n(A,{value:m,onValueChange:V,placeholder:d,options:r.map(e=>({value:e,label:e})),disabled:o,label:p("price.currency",{defaultValue:"Currency"})}),n(D,{id:`${u}-vat`,label:p("price.vatIncluded",{defaultValue:"VAT Incl."}),checked:T,onCheckedChange:e=>i({vatIncluded:e===!0}),disabled:o}),n(C,{id:`${u}-discount`,type:"number",inputMode:"decimal",min:0,max:100,step:1,value:y===0?"":y,onChange:$,disabled:o,placeholder:"0",label:p("price.discountLabel",{defaultValue:"Discount (%)"})})]})})]}),g&&n("p",{style:{fontSize:"var(--font-size-xs)",color:c?"var(--destructive-foreground)":"var(--muted-foreground)"},children:g})]})};var w=Y;export{w as default};
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview RadioFieldComponent
|
|
3
|
+
* @description Radio field component for form inputs
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
2
9
|
import type { ChangeEvent, ComponentType } from 'react';
|
|
10
|
+
import type { RadioOption } from '@donotdev/components';
|
|
3
11
|
export interface RadioFieldComponentProps {
|
|
4
12
|
/** Field label */
|
|
5
13
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/RadioFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RadioFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/RadioFieldComponent.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,WAAW,wBAAwB;IACvC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAClE,8BAA8B;IAC9B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,CA4ChE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Range Field Component
|
|
3
|
+
* @description Renders a slider input with min/max values. Form field component for range/slider inputs in CRUD forms.
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
1
9
|
import type { ChangeEvent, ComponentType } from 'react';
|
|
2
10
|
export interface RangeFieldComponentProps {
|
|
3
11
|
/** Label for the field */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/RangeFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RangeFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/RangeFieldComponent.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAIxD,MAAM,WAAW,wBAAwB;IACvC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAClE,0CAA0C;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uBAAuB;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,CA2EhE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Label as h,Slider as b,Stack as d}from"@donotdev/components";const x=({label:
|
|
1
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Label as h,Slider as b,Stack as d}from"@donotdev/components";const x=({label:a,value:i=0,onChange:u,error:n,helperText:s,min:r=0,max:c=100,step:v=1,disabled:t,required:m,showValue:f=!0})=>{const g=o=>{const p={target:{value:o.toString()}};u(p)};return l(d,{gap:"tight",children:[l(d,{direction:"row",justify:"between",align:"center",children:[e(h,{required:m,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:a}),f&&e("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:i})]}),e(b,{value:[i??r],onValueChange:([o])=>g(o??r),min:r,max:c,step:v,disabled:t,style:{borderColor:n?"var(--destructive)":void 0,opacity:t?"var(--opacity-muted)":void 0,cursor:t?"not-allowed":void 0},"aria-label":a}),s&&e("p",{style:{fontSize:"var(--font-size-xs)",color:n?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:s})]})};var y=x;export{y as default};
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Rating Field Component
|
|
3
|
+
* @description Form field component for star ratings in CRUD forms.
|
|
4
|
+
* Input accepts whole numbers (1-5), display renders fractional values.
|
|
5
|
+
*
|
|
6
|
+
* @version 0.1.0
|
|
7
|
+
* @since 0.0.1
|
|
8
|
+
* @author AMBROISE PARK Consulting
|
|
9
|
+
*/
|
|
1
10
|
import type { ComponentType } from 'react';
|
|
2
11
|
export interface RatingFieldComponentProps {
|
|
3
12
|
/** Label for the field */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RatingFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/RatingFieldComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RatingFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/RatingFieldComponent.tsx"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAI3C,MAAM,WAAW,yBAAyB;IACxC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,0CAA0C;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,oBAAoB,EAAE,aAAa,CAAC,yBAAyB,CAiDlE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as g}from"react/jsx-runtime";import{Label as h,Rating as m,Stack as
|
|
1
|
+
import{jsx as e,jsxs as g}from"react/jsx-runtime";import{Label as h,Rating as m,Stack as f}from"@donotdev/components";const v=({label:a,value:o=0,onChange:s,error:l,helperText:r,max:t=5,disabled:i,required:n,readonly:d,showValue:u=!1})=>g(f,{gap:"tight",children:[e(h,{required:n,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:a}),e(m,{value:o,onChange:s,max:t,disabled:i,readonly:d,showValue:u,"aria-label":a}),r&&e("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:r})]});var p=v;export{p as default};
|
|
@@ -53,6 +53,6 @@ export interface ReferenceFieldComponentProps {
|
|
|
53
53
|
* />
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
|
-
declare const ReferenceFieldComponent: ({ label, value, onChange, options, isLoading, error, helperText, required, onBlur, onCreate, placeholder, }: ReferenceFieldComponentProps) => import("react
|
|
56
|
+
declare const ReferenceFieldComponent: ({ label, value, onChange, options, isLoading, error, helperText, required, onBlur, onCreate, placeholder, }: ReferenceFieldComponentProps) => import("react").JSX.Element;
|
|
57
57
|
export default ReferenceFieldComponent;
|
|
58
58
|
//# sourceMappingURL=ReferenceFieldComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReferenceFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/ReferenceFieldComponent.tsx"],"names":[],"mappings":"AAmBA,wCAAwC;AACxC,MAAM,WAAW,eAAe;IAC9B,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,uCAAuC;IACvC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,oBAAoB;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,uBAAuB,GAAI,6GAY9B,4BAA4B,
|
|
1
|
+
{"version":3,"file":"ReferenceFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/ReferenceFieldComponent.tsx"],"names":[],"mappings":"AAmBA,wCAAwC;AACxC,MAAM,WAAW,eAAe;IAC9B,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,uCAAuC;IACvC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,oBAAoB;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,uBAAuB,GAAI,6GAY9B,4BAA4B,gCA4E9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as d}from"react/jsx-runtime";import"lucide-react";import{useMemo as S,useId as A}from"react";import{Combobox as $,Stack as c}from"@donotdev/components";import{useTranslation as j}from"@donotdev/core";const q=({label:r,value:
|
|
1
|
+
import{jsx as t,jsxs as d}from"react/jsx-runtime";import"lucide-react";import{useMemo as S,useId as A}from"react";import{Combobox as $,Stack as c}from"@donotdev/components";import{useTranslation as j}from"@donotdev/core";const q=({label:r,value:l,onChange:p,options:n,isLoading:u=!1,error:f,helperText:o,required:h,onBlur:m,onCreate:I,placeholder:g})=>{const{t:s}=j("crud"),i=A(),v=S(()=>n.map(e=>({value:e.id,label:e.label,description:e.description})),[n]),b=e=>{const z=Array.isArray(e)?e[0]||"":e;p(z)},x=e=>{e||m?.()},a=!!f,y=`${i}-error`,C=`${i}-helper`;return d(c,{gap:"tight",children:[t($,{label:r,value:l||"",onValueChange:b,onOpenChange:x,placeholder:g||s("reference.placeholder",{label:r})||`Select ${r}`,emptyMessage:s("reference.noResults")||"No results found",options:v,required:h,variant:a?"destructive":void 0,isLoading:u,clearable:!!l}),a&&d(c,{id:y,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[t("span",{children:"\u26A0"}),o]}),o&&!a&&t("p",{id:C,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:o})]})};var L=q;export{L as default};
|