@10x-media/form-builder 0.1.0-beta.0 → 0.1.0-beta.10
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/CHANGELOG.md +345 -0
- package/README.md +45 -1402
- package/dist/actions/body/converters.d.ts +20 -0
- package/dist/actions/body/converters.js +57 -0
- package/dist/actions/body/converters.js.map +1 -0
- package/dist/actions/body/escapeHtml.d.ts +6 -0
- package/dist/actions/body/escapeHtml.js +14 -0
- package/dist/actions/body/escapeHtml.js.map +1 -0
- package/dist/actions/body/serializeBody.d.ts +55 -0
- package/dist/actions/body/serializeBody.js +78 -0
- package/dist/actions/body/serializeBody.js.map +1 -0
- package/dist/actions/body/serializeSlate.js +31 -0
- package/dist/actions/body/serializeSlate.js.map +1 -0
- package/dist/actions/body/textOfBody.d.ts +13 -0
- package/dist/actions/body/textOfBody.js +35 -0
- package/dist/actions/body/textOfBody.js.map +1 -0
- package/dist/actions/body/wildcards.d.ts +10 -0
- package/dist/actions/body/wildcards.js +33 -0
- package/dist/actions/body/wildcards.js.map +1 -0
- package/dist/actions/buildActionBlocks.js +22 -0
- package/dist/actions/buildActionBlocks.js.map +1 -0
- package/dist/actions/builtin/confirmation.js +52 -0
- package/dist/actions/builtin/confirmation.js.map +1 -0
- package/dist/actions/builtin/emailAction.d.ts +17 -0
- package/dist/actions/builtin/emailAction.js +83 -0
- package/dist/actions/builtin/emailAction.js.map +1 -0
- package/dist/actions/builtin/emailTeam.js +22 -0
- package/dist/actions/builtin/emailTeam.js.map +1 -0
- package/dist/actions/builtin/index.d.ts +22 -0
- package/dist/actions/builtin/index.js +27 -0
- package/dist/actions/builtin/index.js.map +1 -0
- package/dist/actions/builtin/signedWebhook.js +53 -0
- package/dist/actions/builtin/signedWebhook.js.map +1 -0
- package/dist/actions/defineAction.d.ts +37 -0
- package/dist/actions/defineAction.js +6 -0
- package/dist/actions/defineAction.js.map +1 -0
- package/dist/actions/dispatch.js +49 -0
- package/dist/actions/dispatch.js.map +1 -0
- package/dist/actions/emailRecipients.d.ts +12 -0
- package/dist/actions/emailRecipients.js +116 -0
- package/dist/actions/emailRecipients.js.map +1 -0
- package/dist/actions/fromAddresses.d.ts +21 -0
- package/dist/actions/fromAddresses.js +74 -0
- package/dist/actions/fromAddresses.js.map +1 -0
- package/dist/actions/registry.d.ts +17 -0
- package/dist/actions/registry.js +12 -0
- package/dist/actions/registry.js.map +1 -0
- package/dist/actions/runActions.d.ts +9 -0
- package/dist/actions/runActions.js +43 -0
- package/dist/actions/runActions.js.map +1 -0
- package/dist/actions/sign.d.ts +7 -0
- package/dist/actions/sign.js +9 -0
- package/dist/actions/sign.js.map +1 -0
- package/dist/actions/task.js +87 -0
- package/dist/actions/task.js.map +1 -0
- package/dist/aggregation/aggregateResponses.d.ts +40 -0
- package/dist/aggregation/aggregateResponses.js +80 -0
- package/dist/aggregation/aggregateResponses.js.map +1 -0
- package/dist/aggregation/aggregateRows.d.ts +10 -0
- package/dist/aggregation/aggregateRows.js +64 -0
- package/dist/aggregation/aggregateRows.js.map +1 -0
- package/dist/aggregation/resolveResultsRequest.d.ts +61 -0
- package/dist/aggregation/resolveResultsRequest.js +113 -0
- package/dist/aggregation/resolveResultsRequest.js.map +1 -0
- package/dist/aggregation/types.d.ts +39 -0
- package/dist/calc/computeCalcFields.d.ts +15 -0
- package/dist/calc/computeCalcFields.js +28 -0
- package/dist/calc/computeCalcFields.js.map +1 -0
- package/dist/calc/evaluate.d.ts +8 -0
- package/dist/calc/evaluate.js +58 -0
- package/dist/calc/evaluate.js.map +1 -0
- package/dist/calc/normalizeCalc.d.ts +8 -0
- package/dist/calc/normalizeCalc.js +87 -0
- package/dist/calc/normalizeCalc.js.map +1 -0
- package/dist/calc/types.d.ts +34 -0
- package/dist/calc/types.js +22 -0
- package/dist/calc/types.js.map +1 -0
- package/dist/client/ByteSizeField.d.ts +29 -0
- package/dist/client/ByteSizeField.js +58 -0
- package/dist/client/ByteSizeField.js.map +1 -0
- package/dist/client/ClosePollButton.d.ts +15 -0
- package/dist/client/ClosePollButton.js +80 -0
- package/dist/client/ClosePollButton.js.map +1 -0
- package/dist/client/CondensedArray.d.ts +15 -0
- package/dist/client/CondensedArray.js +97 -0
- package/dist/client/CondensedArray.js.map +1 -0
- package/dist/client/ConditionBuilder.js +122 -0
- package/dist/client/ConditionBuilder.js.map +1 -0
- package/dist/client/ConditionRow.js +150 -0
- package/dist/client/ConditionRow.js.map +1 -0
- package/dist/client/ConsentBlockLabel.d.ts +15 -0
- package/dist/client/ConsentBlockLabel.js +71 -0
- package/dist/client/ConsentBlockLabel.js.map +1 -0
- package/dist/client/ConsentSourceRowLabel.d.ts +9 -0
- package/dist/client/ConsentSourceRowLabel.js +21 -0
- package/dist/client/ConsentSourceRowLabel.js.map +1 -0
- package/dist/client/EndpointOptionsSelect.d.ts +46 -0
- package/dist/client/EndpointOptionsSelect.js +106 -0
- package/dist/client/EndpointOptionsSelect.js.map +1 -0
- package/dist/client/FieldBlockLabel.d.ts +18 -0
- package/dist/client/FieldBlockLabel.js +34 -0
- package/dist/client/FieldBlockLabel.js.map +1 -0
- package/dist/client/FieldNameSelect.d.ts +37 -0
- package/dist/client/FieldNameSelect.js +72 -0
- package/dist/client/FieldNameSelect.js.map +1 -0
- package/dist/client/FlowBuilder.d.ts +15 -0
- package/dist/client/FlowBuilder.js +457 -0
- package/dist/client/FlowBuilder.js.map +1 -0
- package/dist/client/FormConditionField.d.ts +21 -0
- package/dist/client/FormConditionField.js +30 -0
- package/dist/client/FormConditionField.js.map +1 -0
- package/dist/client/RecipientsSelect.d.ts +31 -0
- package/dist/client/RecipientsSelect.js +174 -0
- package/dist/client/RecipientsSelect.js.map +1 -0
- package/dist/client/RuleDescription.d.ts +21 -0
- package/dist/client/RuleDescription.js +19 -0
- package/dist/client/RuleDescription.js.map +1 -0
- package/dist/client/admin.css +275 -0
- package/dist/client/endpointOptions.js +29 -0
- package/dist/client/endpointOptions.js.map +1 -0
- package/dist/client/flowAuthoring.js +142 -0
- package/dist/client/flowAuthoring.js.map +1 -0
- package/dist/client/synthesizeClientField.js +57 -0
- package/dist/client/synthesizeClientField.js.map +1 -0
- package/dist/client/toStaticLabel.js +13 -0
- package/dist/client/toStaticLabel.js.map +1 -0
- package/dist/collections/buttonFields.d.ts +34 -0
- package/dist/collections/buttonFields.js +35 -0
- package/dist/collections/buttonFields.js.map +1 -0
- package/dist/collections/cells/FieldCountCell.d.ts +15 -0
- package/dist/collections/cells/FieldCountCell.js +18 -0
- package/dist/collections/cells/FieldCountCell.js.map +1 -0
- package/dist/collections/cells/FlowStepsCell.d.ts +14 -0
- package/dist/collections/cells/FlowStepsCell.js +17 -0
- package/dist/collections/cells/FlowStepsCell.js.map +1 -0
- package/dist/collections/formSubmissions.js +204 -0
- package/dist/collections/formSubmissions.js.map +1 -0
- package/dist/collections/forms.js +482 -0
- package/dist/collections/forms.js.map +1 -0
- package/dist/collections/formsEndpoints.js +101 -0
- package/dist/collections/formsEndpoints.js.map +1 -0
- package/dist/collections/redirectFields.d.ts +29 -0
- package/dist/conditions/conditionType.js +21 -0
- package/dist/conditions/conditionType.js.map +1 -0
- package/dist/conditions/evaluate.d.ts +17 -0
- package/dist/conditions/evaluate.js +94 -0
- package/dist/conditions/evaluate.js.map +1 -0
- package/dist/conditions/fieldTypes.d.ts +11 -0
- package/dist/{fieldTypes-CzhhJXjg.js → conditions/fieldTypes.js} +6 -3
- package/dist/conditions/fieldTypes.js.map +1 -0
- package/dist/conditions/normalizeConditions.js +61 -0
- package/dist/conditions/normalizeConditions.js.map +1 -0
- package/dist/conditions/types.d.ts +8 -0
- package/dist/consent/applyConsentStatements.d.ts +14 -0
- package/dist/consent/applyConsentStatements.js +17 -0
- package/dist/consent/applyConsentStatements.js.map +1 -0
- package/dist/consent/captureConsent.d.ts +55 -0
- package/dist/consent/captureConsent.js +73 -0
- package/dist/consent/captureConsent.js.map +1 -0
- package/dist/consent/consentSourcesField.d.ts +66 -0
- package/dist/consent/consentSourcesField.js +90 -0
- package/dist/consent/consentSourcesField.js.map +1 -0
- package/dist/consent/resolveConsentEntries.d.ts +24 -0
- package/dist/consent/resolveConsentEntries.js +40 -0
- package/dist/consent/resolveConsentEntries.js.map +1 -0
- package/dist/consent/resolveConsentSourcesRequest.d.ts +37 -0
- package/dist/consent/resolveConsentSourcesRequest.js +54 -0
- package/dist/consent/resolveConsentSourcesRequest.js.map +1 -0
- package/dist/consent/resolveConsentStatements.d.ts +45 -0
- package/dist/consent/resolveConsentStatements.js +44 -0
- package/dist/consent/resolveConsentStatements.js.map +1 -0
- package/dist/consent/resolvePublishedVersionRef.d.ts +23 -0
- package/dist/consent/resolvePublishedVersionRef.js +30 -0
- package/dist/consent/resolvePublishedVersionRef.js.map +1 -0
- package/dist/consent/types.d.ts +61 -0
- package/dist/email/departments.d.ts +59 -0
- package/dist/email/departments.js +87 -0
- package/dist/email/departments.js.map +1 -0
- package/dist/email/departmentsField.d.ts +53 -0
- package/dist/email/departmentsField.js +73 -0
- package/dist/email/departmentsField.js.map +1 -0
- package/dist/events/noopSink.js +6 -0
- package/dist/events/noopSink.js.map +1 -0
- package/dist/events/resolveEventSink.js +8 -0
- package/dist/events/resolveEventSink.js.map +1 -0
- package/dist/events/types.d.ts +31 -0
- package/dist/exports/client.d.ts +15 -21
- package/dist/exports/client.js +15 -319
- package/dist/exports/i18n.d.ts +6 -138
- package/dist/exports/i18n.js +6 -3
- package/dist/exports/react.d.ts +63 -550
- package/dist/exports/react.js +55 -1563
- package/dist/exports/rsc.d.ts +9 -16
- package/dist/exports/rsc.js +9 -55
- package/dist/exports/types.d.ts +36 -5
- package/dist/fields/buildFieldBlocks.js +80 -0
- package/dist/fields/buildFieldBlocks.js.map +1 -0
- package/dist/fields/builtin/calculation.js +144 -0
- package/dist/fields/builtin/calculation.js.map +1 -0
- package/dist/fields/builtin/checkbox.js +21 -0
- package/dist/fields/builtin/checkbox.js.map +1 -0
- package/dist/fields/builtin/consent.js +47 -0
- package/dist/fields/builtin/consent.js.map +1 -0
- package/dist/fields/builtin/country.d.ts +13 -0
- package/dist/fields/builtin/country.js +30 -0
- package/dist/fields/builtin/country.js.map +1 -0
- package/dist/fields/builtin/date.js +31 -0
- package/dist/fields/builtin/date.js.map +1 -0
- package/dist/fields/builtin/email.js +18 -0
- package/dist/fields/builtin/email.js.map +1 -0
- package/dist/fields/builtin/file.d.ts +15 -0
- package/dist/fields/builtin/file.js +127 -0
- package/dist/fields/builtin/file.js.map +1 -0
- package/dist/fields/builtin/index.d.ts +26 -0
- package/dist/fields/builtin/index.js +49 -0
- package/dist/fields/builtin/index.js.map +1 -0
- package/dist/fields/builtin/message.js +30 -0
- package/dist/fields/builtin/message.js.map +1 -0
- package/dist/fields/builtin/number.js +17 -0
- package/dist/fields/builtin/number.js.map +1 -0
- package/dist/fields/builtin/repeater.js +49 -0
- package/dist/fields/builtin/repeater.js.map +1 -0
- package/dist/fields/builtin/select.js +49 -0
- package/dist/fields/builtin/select.js.map +1 -0
- package/dist/fields/builtin/state.d.ts +13 -0
- package/dist/fields/builtin/state.js +30 -0
- package/dist/fields/builtin/state.js.map +1 -0
- package/dist/fields/builtin/text.js +13 -0
- package/dist/fields/builtin/text.js.map +1 -0
- package/dist/fields/builtin/textarea.js +13 -0
- package/dist/fields/builtin/textarea.js.map +1 -0
- package/dist/fields/data/regions.d.ts +21 -0
- package/dist/fields/data/regions.js +1238 -0
- package/dist/fields/data/regions.js.map +1 -0
- package/dist/fields/defineFormField.d.ts +13 -0
- package/dist/fields/defineFormField.js +12 -0
- package/dist/fields/defineFormField.js.map +1 -0
- package/dist/fields/fieldKey.d.ts +15 -0
- package/dist/fields/fieldKey.js +16 -0
- package/dist/fields/fieldKey.js.map +1 -0
- package/dist/fields/fieldNamesOfType.js +30 -0
- package/dist/fields/fieldNamesOfType.js.map +1 -0
- package/dist/fields/instanceOptions.js +20 -0
- package/dist/fields/instanceOptions.js.map +1 -0
- package/dist/fields/localizedIf.d.ts +13 -0
- package/dist/fields/localizedIf.js +12 -0
- package/dist/fields/localizedIf.js.map +1 -0
- package/dist/fields/registry.d.ts +12 -0
- package/dist/fields/registry.js +39 -0
- package/dist/fields/registry.js.map +1 -0
- package/dist/fields/sharedConfig.js +151 -0
- package/dist/fields/sharedConfig.js.map +1 -0
- package/dist/fields/types.d.ts +152 -0
- package/dist/flow/engine.d.ts +19 -0
- package/dist/flow/engine.js +29 -0
- package/dist/flow/engine.js.map +1 -0
- package/dist/flow/normalizeFlow.js +54 -0
- package/dist/flow/normalizeFlow.js.map +1 -0
- package/dist/flow/stepLabel.js +15 -0
- package/dist/flow/stepLabel.js.map +1 -0
- package/dist/flow/types.d.ts +32 -0
- package/dist/flow/types.js +11 -0
- package/dist/flow/types.js.map +1 -0
- package/dist/form/pollState.d.ts +22 -0
- package/dist/form/pollState.js +17 -0
- package/dist/form/pollState.js.map +1 -0
- package/dist/form/toFormDocument.d.ts +102 -0
- package/dist/form/toFormDocument.js +87 -0
- package/dist/form/toFormDocument.js.map +1 -0
- package/dist/form/types.d.ts +65 -0
- package/dist/index.d.ts +88 -4
- package/dist/index.js +111 -1898
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +229 -0
- package/dist/plugin/access.js +12 -0
- package/dist/plugin/access.js.map +1 -0
- package/dist/plugin/applyRegistryConfig.d.ts +11 -0
- package/dist/plugin/applyRegistryConfig.js +20 -0
- package/dist/plugin/applyRegistryConfig.js.map +1 -0
- package/dist/plugin/collectionOverrides.d.ts +22 -0
- package/dist/plugin/customState.js +26 -0
- package/dist/plugin/customState.js.map +1 -0
- package/dist/plugin/registerCollections.js +60 -0
- package/dist/plugin/registerCollections.js.map +1 -0
- package/dist/plugin/registerTranslations.js +19 -0
- package/dist/plugin/registerTranslations.js.map +1 -0
- package/dist/plugin/uploadsCollection.d.ts +16 -0
- package/dist/plugin/uploadsCollection.js +53 -0
- package/dist/plugin/uploadsCollection.js.map +1 -0
- package/dist/poll/applyPollOptions.js +18 -0
- package/dist/poll/applyPollOptions.js.map +1 -0
- package/dist/poll/buildPollOptionSourceFields.js +50 -0
- package/dist/poll/buildPollOptionSourceFields.js.map +1 -0
- package/dist/poll/closeJob.d.ts +52 -0
- package/dist/poll/closeJob.js +119 -0
- package/dist/poll/closeJob.js.map +1 -0
- package/dist/poll/definePollOptionSource.d.ts +44 -0
- package/dist/poll/definePollOptionSource.js +6 -0
- package/dist/poll/definePollOptionSource.js.map +1 -0
- package/dist/poll/definePollType.d.ts +34 -0
- package/dist/poll/definePollType.js +6 -0
- package/dist/poll/definePollType.js.map +1 -0
- package/dist/poll/effectivePollOptions.d.ts +38 -0
- package/dist/poll/effectivePollOptions.js +64 -0
- package/dist/poll/effectivePollOptions.js.map +1 -0
- package/dist/poll/mostVoted.d.ts +21 -0
- package/dist/poll/mostVoted.js +32 -0
- package/dist/poll/mostVoted.js.map +1 -0
- package/dist/poll/outcomeBeforeChange.js +91 -0
- package/dist/poll/outcomeBeforeChange.js.map +1 -0
- package/dist/poll/outcomeFields.d.ts +38 -0
- package/dist/poll/outcomeFields.js +52 -0
- package/dist/poll/outcomeFields.js.map +1 -0
- package/dist/poll/pollTypeRegistry.d.ts +34 -0
- package/dist/poll/pollTypeRegistry.js +69 -0
- package/dist/poll/pollTypeRegistry.js.map +1 -0
- package/dist/poll/registry.d.ts +17 -0
- package/dist/poll/registry.js +12 -0
- package/dist/poll/registry.js.map +1 -0
- package/dist/poll/resolvePollCloseRequest.js +105 -0
- package/dist/poll/resolvePollCloseRequest.js.map +1 -0
- package/dist/poll/resolvePollOptions.d.ts +29 -0
- package/dist/poll/resolvePollOptions.js +52 -0
- package/dist/poll/resolvePollOptions.js.map +1 -0
- package/dist/poll/resolvePollOptionsRequest.js +50 -0
- package/dist/poll/resolvePollOptionsRequest.js.map +1 -0
- package/dist/poll/resolvePollOutcome.d.ts +34 -0
- package/dist/poll/resolvePollOutcome.js +76 -0
- package/dist/poll/resolvePollOutcome.js.map +1 -0
- package/dist/poll/resultsField.js +21 -0
- package/dist/poll/resultsField.js.map +1 -0
- package/dist/prefill/valuesFromSearchParams.d.ts +18 -0
- package/dist/prefill/valuesFromSearchParams.js +41 -0
- package/dist/prefill/valuesFromSearchParams.js.map +1 -0
- package/dist/presentations/defaults.d.ts +33 -0
- package/dist/presentations/defaults.js +35 -0
- package/dist/presentations/defaults.js.map +1 -0
- package/dist/presentations/types.d.ts +19 -0
- package/dist/react/Form.d.ts +128 -0
- package/dist/react/Form.js +619 -0
- package/dist/react/Form.js.map +1 -0
- package/dist/react/FormContext.d.ts +59 -0
- package/dist/react/FormContext.js +14 -0
- package/dist/react/FormContext.js.map +1 -0
- package/dist/react/FormControls.d.ts +55 -0
- package/dist/react/FormControls.js +56 -0
- package/dist/react/FormControls.js.map +1 -0
- package/dist/react/FormFields.d.ts +18 -0
- package/dist/react/FormFields.js +114 -0
- package/dist/react/FormFields.js.map +1 -0
- package/dist/react/FormLayout.d.ts +22 -0
- package/dist/react/FormLayout.js +15 -0
- package/dist/react/FormLayout.js.map +1 -0
- package/dist/react/FormResults.d.ts +28 -0
- package/dist/react/FormResults.js +93 -0
- package/dist/react/FormResults.js.map +1 -0
- package/dist/react/FormSteps.d.ts +17 -0
- package/dist/react/FormSteps.js +35 -0
- package/dist/react/FormSteps.js.map +1 -0
- package/dist/react/Honeypot.d.ts +22 -0
- package/dist/react/Honeypot.js +38 -0
- package/dist/react/Honeypot.js.map +1 -0
- package/dist/react/Poll.d.ts +43 -0
- package/dist/react/Poll.js +135 -0
- package/dist/react/Poll.js.map +1 -0
- package/dist/react/captcha/HcaptchaCaptcha.d.ts +28 -0
- package/dist/react/captcha/HcaptchaCaptcha.js +53 -0
- package/dist/react/captcha/HcaptchaCaptcha.js.map +1 -0
- package/dist/react/captcha/RecaptchaCaptcha.d.ts +41 -0
- package/dist/react/captcha/RecaptchaCaptcha.js +93 -0
- package/dist/react/captcha/RecaptchaCaptcha.js.map +1 -0
- package/dist/react/captcha/TurnstileCaptcha.d.ts +28 -0
- package/dist/react/captcha/TurnstileCaptcha.js +53 -0
- package/dist/react/captcha/TurnstileCaptcha.js.map +1 -0
- package/dist/react/captcha/types.d.ts +8 -0
- package/dist/react/captcha/useCaptchaScript.js +45 -0
- package/dist/react/captcha/useCaptchaScript.js.map +1 -0
- package/dist/react/captcha/vendors.js +8 -0
- package/dist/react/captcha/vendors.js.map +1 -0
- package/dist/react/cn.d.ts +6 -0
- package/dist/react/cn.js +8 -0
- package/dist/react/cn.js.map +1 -0
- package/dist/react/contract.d.ts +31 -0
- package/dist/react/contract.js +7 -0
- package/dist/react/contract.js.map +1 -0
- package/dist/react/events.js +14 -0
- package/dist/react/events.js.map +1 -0
- package/dist/react/fetchResults.d.ts +25 -0
- package/dist/react/fetchResults.js +31 -0
- package/dist/react/fetchResults.js.map +1 -0
- package/dist/react/presentation/Backdrop.d.ts +18 -0
- package/dist/react/presentation/Backdrop.js +14 -0
- package/dist/react/presentation/Backdrop.js.map +1 -0
- package/dist/react/presentation/DialogSurface.d.ts +35 -0
- package/dist/react/presentation/DialogSurface.js +53 -0
- package/dist/react/presentation/DialogSurface.js.map +1 -0
- package/dist/react/presentation/presentations.d.ts +7 -0
- package/dist/react/presentation/presentations.js +32 -0
- package/dist/react/presentation/presentations.js.map +1 -0
- package/dist/react/presentation/registry.d.ts +11 -0
- package/dist/react/presentation/registry.js +12 -0
- package/dist/react/presentation/registry.js.map +1 -0
- package/dist/react/presentation/types.d.ts +19 -0
- package/dist/react/presentation/useDismiss.d.ts +19 -0
- package/dist/react/presentation/useDismiss.js +33 -0
- package/dist/react/presentation/useDismiss.js.map +1 -0
- package/dist/react/presentation/useFocusTrap.d.ts +8 -0
- package/dist/react/presentation/useFocusTrap.js +35 -0
- package/dist/react/presentation/useFocusTrap.js.map +1 -0
- package/dist/react/presentation/useScrollLock.d.ts +6 -0
- package/dist/react/presentation/useScrollLock.js +18 -0
- package/dist/react/presentation/useScrollLock.js.map +1 -0
- package/dist/react/primitives/Checkbox.d.ts +28 -0
- package/dist/react/primitives/Checkbox.js +21 -0
- package/dist/react/primitives/Checkbox.js.map +1 -0
- package/dist/react/primitives/FieldShell.d.ts +29 -0
- package/dist/react/primitives/FieldShell.js +44 -0
- package/dist/react/primitives/FieldShell.js.map +1 -0
- package/dist/react/primitives/Input.d.ts +30 -0
- package/dist/react/primitives/Input.js +21 -0
- package/dist/react/primitives/Input.js.map +1 -0
- package/dist/react/primitives/Select.d.ts +34 -0
- package/dist/react/primitives/Select.js +26 -0
- package/dist/react/primitives/Select.js.map +1 -0
- package/dist/react/primitives/Textarea.d.ts +28 -0
- package/dist/react/primitives/Textarea.js +20 -0
- package/dist/react/primitives/Textarea.js.map +1 -0
- package/dist/react/recall.js +20 -0
- package/dist/react/recall.js.map +1 -0
- package/dist/react/registry.d.ts +16 -0
- package/dist/react/registry.js +16 -0
- package/dist/react/registry.js.map +1 -0
- package/dist/react/renderers/calculation.js +27 -0
- package/dist/react/renderers/calculation.js.map +1 -0
- package/dist/react/renderers/checkbox.js +32 -0
- package/dist/react/renderers/checkbox.js.map +1 -0
- package/dist/react/renderers/consent.js +97 -0
- package/dist/react/renderers/consent.js.map +1 -0
- package/dist/react/renderers/date.js +33 -0
- package/dist/react/renderers/date.js.map +1 -0
- package/dist/react/renderers/email.js +34 -0
- package/dist/react/renderers/email.js.map +1 -0
- package/dist/react/renderers/file.js +107 -0
- package/dist/react/renderers/file.js.map +1 -0
- package/dist/react/renderers/index.d.ts +8 -0
- package/dist/react/renderers/index.js +35 -0
- package/dist/react/renderers/index.js.map +1 -0
- package/dist/react/renderers/message.js +41 -0
- package/dist/react/renderers/message.js.map +1 -0
- package/dist/react/renderers/number.js +37 -0
- package/dist/react/renderers/number.js.map +1 -0
- package/dist/react/renderers/region.js +43 -0
- package/dist/react/renderers/region.js.map +1 -0
- package/dist/react/renderers/repeater.js +131 -0
- package/dist/react/renderers/repeater.js.map +1 -0
- package/dist/react/renderers/select.js +35 -0
- package/dist/react/renderers/select.js.map +1 -0
- package/dist/react/renderers/text.js +34 -0
- package/dist/react/renderers/text.js.map +1 -0
- package/dist/react/renderers/textarea.js +33 -0
- package/dist/react/renderers/textarea.js.map +1 -0
- package/dist/react/resolveForm.js +16 -0
- package/dist/react/resolveForm.js.map +1 -0
- package/dist/react/state.d.ts +52 -0
- package/dist/react/state.js +125 -0
- package/dist/react/state.js.map +1 -0
- package/dist/react/submitForm.d.ts +31 -0
- package/dist/react/submitForm.js +58 -0
- package/dist/react/submitForm.js.map +1 -0
- package/dist/react/uploadFile.d.ts +23 -0
- package/dist/react/uploadFile.js +39 -0
- package/dist/react/uploadFile.js.map +1 -0
- package/dist/react/useField.d.ts +13 -0
- package/dist/react/useField.js +49 -0
- package/dist/react/useField.js.map +1 -0
- package/dist/react/useFormState.d.ts +8 -0
- package/dist/react/useFormState.js +9 -0
- package/dist/react/useFormState.js.map +1 -0
- package/dist/react/useFormStep.d.ts +8 -0
- package/dist/react/useFormStep.js +9 -0
- package/dist/react/useFormStep.js.map +1 -0
- package/dist/react/validateField.js +27 -0
- package/dist/react/validateField.js.map +1 -0
- package/dist/recall/interpolate.d.ts +11 -0
- package/dist/recall/interpolate.js +17 -0
- package/dist/recall/interpolate.js.map +1 -0
- package/dist/recall/resolver.d.ts +22 -0
- package/dist/recall/resolver.js +48 -0
- package/dist/recall/resolver.js.map +1 -0
- package/dist/spam/captcha.d.ts +13 -0
- package/dist/spam/captcha.js +12 -0
- package/dist/spam/captcha.js.map +1 -0
- package/dist/spam/clientIp.js +9 -0
- package/dist/spam/clientIp.js.map +1 -0
- package/dist/spam/constants.d.ts +12 -0
- package/dist/spam/constants.js +21 -0
- package/dist/spam/constants.js.map +1 -0
- package/dist/spam/identify.d.ts +12 -0
- package/dist/spam/identify.js +17 -0
- package/dist/spam/identify.js.map +1 -0
- package/dist/spam/providers/hcaptcha.d.ts +17 -0
- package/dist/spam/providers/hcaptcha.js +18 -0
- package/dist/spam/providers/hcaptcha.js.map +1 -0
- package/dist/spam/providers/recaptcha.d.ts +23 -0
- package/dist/spam/providers/recaptcha.js +23 -0
- package/dist/spam/providers/recaptcha.js.map +1 -0
- package/dist/spam/providers/siteverify.js +34 -0
- package/dist/spam/providers/siteverify.js.map +1 -0
- package/dist/spam/providers/turnstile.d.ts +17 -0
- package/dist/spam/providers/turnstile.js +18 -0
- package/dist/spam/providers/turnstile.js.map +1 -0
- package/dist/spam/rateLimiter.d.ts +18 -0
- package/dist/spam/rateLimiter.js +41 -0
- package/dist/spam/rateLimiter.js.map +1 -0
- package/dist/spam/reserved.js +30 -0
- package/dist/spam/reserved.js.map +1 -0
- package/dist/spam/resolveSpam.d.ts +12 -0
- package/dist/spam/resolveSpam.js +43 -0
- package/dist/spam/resolveSpam.js.map +1 -0
- package/dist/spam/spamGuard.js +81 -0
- package/dist/spam/spamGuard.js.map +1 -0
- package/dist/spam/types.d.ts +88 -0
- package/dist/spam/uploadHooks.js +33 -0
- package/dist/spam/uploadHooks.js.map +1 -0
- package/dist/submissions/SubmissionAnswers.d.ts +14 -0
- package/dist/submissions/SubmissionAnswers.js +137 -0
- package/dist/submissions/SubmissionAnswers.js.map +1 -0
- package/dist/submissions/SubmissionAnswersClient.js +178 -0
- package/dist/submissions/SubmissionAnswersClient.js.map +1 -0
- package/dist/submissions/coerceBoolean.js +14 -0
- package/dist/submissions/coerceBoolean.js.map +1 -0
- package/dist/submissions/createSubmission.d.ts +36 -0
- package/dist/submissions/createSubmission.js +26 -0
- package/dist/submissions/createSubmission.js.map +1 -0
- package/dist/submissions/runSubmission.d.ts +10 -0
- package/dist/submissions/runSubmission.js +306 -0
- package/dist/submissions/runSubmission.js.map +1 -0
- package/dist/submissions/types.d.ts +41 -0
- package/dist/submissions/validateSubmission.js +110 -0
- package/dist/submissions/validateSubmission.js.map +1 -0
- package/dist/submissions/votedCookie.d.ts +13 -0
- package/dist/submissions/votedCookie.js +27 -0
- package/dist/submissions/votedCookie.js.map +1 -0
- package/dist/translations/clientRuntimeKeys.d.ts +17 -0
- package/dist/translations/clientRuntimeKeys.js +46 -0
- package/dist/translations/clientRuntimeKeys.js.map +1 -0
- package/dist/translations/de.d.ts +12 -0
- package/dist/translations/de.js +309 -0
- package/dist/translations/de.js.map +1 -0
- package/dist/translations/en.d.ts +12 -0
- package/dist/translations/en.js +309 -0
- package/dist/translations/en.js.map +1 -0
- package/dist/translations/index.d.ts +23 -0
- package/dist/translations/index.js +37 -0
- package/dist/translations/index.js.map +1 -0
- package/dist/translations/keys.d.ts +308 -0
- package/dist/translations/keys.js +308 -0
- package/dist/translations/keys.js.map +1 -0
- package/dist/translations/makeTranslate.d.ts +15 -0
- package/dist/translations/makeTranslate.js +20 -0
- package/dist/translations/makeTranslate.js.map +1 -0
- package/dist/translations/server.js +32 -0
- package/dist/translations/server.js.map +1 -0
- package/dist/translations/useTranslation.js +12 -0
- package/dist/translations/useTranslation.js.map +1 -0
- package/dist/uploads/captureFileRef.d.ts +34 -0
- package/dist/uploads/captureFileRef.js +43 -0
- package/dist/uploads/captureFileRef.js.map +1 -0
- package/dist/uploads/formatBytes.d.ts +9 -0
- package/dist/uploads/formatBytes.js +25 -0
- package/dist/uploads/formatBytes.js.map +1 -0
- package/dist/uploads/resolveFileRef.d.ts +26 -0
- package/dist/uploads/resolveFileRef.js +45 -0
- package/dist/uploads/resolveFileRef.js.map +1 -0
- package/dist/uploads/types.d.ts +19 -0
- package/dist/validation/buildRuleBlocks.js +47 -0
- package/dist/validation/buildRuleBlocks.js.map +1 -0
- package/dist/validation/builtin/email.js +20 -0
- package/dist/validation/builtin/email.js.map +1 -0
- package/dist/validation/builtin/index.d.ts +14 -0
- package/dist/validation/builtin/index.js +38 -0
- package/dist/validation/builtin/index.js.map +1 -0
- package/dist/validation/builtin/matchesField.js +16 -0
- package/dist/validation/builtin/matchesField.js.map +1 -0
- package/dist/validation/builtin/max.js +22 -0
- package/dist/validation/builtin/max.js.map +1 -0
- package/dist/validation/builtin/maxDate.js +24 -0
- package/dist/validation/builtin/maxDate.js.map +1 -0
- package/dist/validation/builtin/maxLength.js +27 -0
- package/dist/validation/builtin/maxLength.js.map +1 -0
- package/dist/validation/builtin/min.js +22 -0
- package/dist/validation/builtin/min.js.map +1 -0
- package/dist/validation/builtin/minDate.js +24 -0
- package/dist/validation/builtin/minDate.js.map +1 -0
- package/dist/validation/builtin/minLength.js +27 -0
- package/dist/validation/builtin/minLength.js.map +1 -0
- package/dist/validation/builtin/notAlreadySubmitted.js +34 -0
- package/dist/validation/builtin/notAlreadySubmitted.js.map +1 -0
- package/dist/validation/builtin/oneOf.js +35 -0
- package/dist/validation/builtin/oneOf.js.map +1 -0
- package/dist/validation/builtin/pattern.js +50 -0
- package/dist/validation/builtin/pattern.js.map +1 -0
- package/dist/validation/builtin/url.js +23 -0
- package/dist/validation/builtin/url.js.map +1 -0
- package/dist/validation/builtin/validateDateBound.js +18 -0
- package/dist/validation/builtin/validateDateBound.js.map +1 -0
- package/dist/validation/builtin/validateRegexParams.js +44 -0
- package/dist/validation/builtin/validateRegexParams.js.map +1 -0
- package/dist/validation/defineValidationRule.d.ts +12 -0
- package/dist/validation/defineValidationRule.js +11 -0
- package/dist/validation/defineValidationRule.js.map +1 -0
- package/dist/validation/emailPattern.js +10 -0
- package/dist/validation/emailPattern.js.map +1 -0
- package/dist/validation/fieldTargetParam.d.ts +22 -0
- package/dist/validation/fieldTargetParam.js +38 -0
- package/dist/validation/fieldTargetParam.js.map +1 -0
- package/dist/validation/message.js +14 -0
- package/dist/validation/message.js.map +1 -0
- package/dist/validation/registry.d.ts +11 -0
- package/dist/validation/registry.js +13 -0
- package/dist/validation/registry.js.map +1 -0
- package/dist/validation/runValidation.js +90 -0
- package/dist/validation/runValidation.js.map +1 -0
- package/dist/validation/types.d.ts +70 -0
- package/dist/validation/validateUrl.js +22 -0
- package/dist/validation/validateUrl.js.map +1 -0
- package/package.json +12 -7
- package/styles/form-builder.css +21 -11
- package/dist/constants-B-BUfetP.d.ts +0 -288
- package/dist/exports/client.js.map +0 -1
- package/dist/exports/react.js.map +0 -1
- package/dist/exports/rsc.js.map +0 -1
- package/dist/fieldTypes-B8jkNRob.d.ts +0 -188
- package/dist/fieldTypes-CzhhJXjg.js.map +0 -1
- package/dist/index-DfFYGbVF.d.ts +0 -481
- package/dist/keys-N5xGiUsh.js +0 -132
- package/dist/keys-N5xGiUsh.js.map +0 -1
- package/dist/registry-CoCyhtvB.js +0 -282
- package/dist/registry-CoCyhtvB.js.map +0 -1
- package/dist/resolver-OeQyVH2N.js +0 -665
- package/dist/resolver-OeQyVH2N.js.map +0 -1
- package/dist/translations-edMqq_2e.js +0 -152
- package/dist/translations-edMqq_2e.js.map +0 -1
- package/dist/types-DsJ_6kGJ.d.ts +0 -23
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.js","names":[],"sources":["../../src/translations/keys.ts"],"sourcesContent":["/**\n * Typed translation keys. Lookups must go through these constants, not string\n * literals (enforced by requireI18nKeysTyped.grit). Every key here must have a\n * value in every locale (`en.ts`), or it is a type error.\n */\nexport const keys = {\n\tfieldTitle: 'formBuilder:fieldTitle',\n\tfieldTypeText: 'formBuilder:fieldType.text',\n\tfieldTypeTextarea: 'formBuilder:fieldType.textarea',\n\tfieldTypeEmail: 'formBuilder:fieldType.email',\n\tfieldTypeNumber: 'formBuilder:fieldType.number',\n\tfieldTypeSelect: 'formBuilder:fieldType.select',\n\tfieldTypeCountry: 'formBuilder:fieldType.country',\n\tfieldTypeState: 'formBuilder:fieldType.state',\n\tfieldTypeCheckbox: 'formBuilder:fieldType.checkbox',\n\tfieldTypeDate: 'formBuilder:fieldType.date',\n\tconfigOptions: 'formBuilder:config.options',\n\tconfigOption: 'formBuilder:config.option',\n\tconfigOptionLabel: 'formBuilder:config.optionLabel',\n\tconfigOptionValue: 'formBuilder:config.optionValue',\n\tvalidationRequired: 'formBuilder:validation.required',\n\tvalidationEmail: 'formBuilder:validation.email',\n\tvalidationNumber: 'formBuilder:validation.number',\n\tvalidationDate: 'formBuilder:validation.date',\n\tvalidationSelect: 'formBuilder:validation.select',\n\tvalidationCountry: 'formBuilder:validation.country',\n\tvalidationState: 'formBuilder:validation.state',\n\tvalidationRegexPattern: 'formBuilder:validation.regexPattern',\n\tvalidationRegexFlags: 'formBuilder:validation.regexFlags',\n\tvalidationEmailFieldUnknown: 'formBuilder:validation.emailFieldUnknown',\n\tvalidationResultsFieldUnknown: 'formBuilder:validation.resultsFieldUnknown',\n\tformatYes: 'formBuilder:format.yes',\n\tformatNo: 'formBuilder:format.no',\n\tconfigName: 'formBuilder:config.name',\n\tconfigLabel: 'formBuilder:config.label',\n\tconfigRequired: 'formBuilder:config.required',\n\tconfigWidth: 'formBuilder:config.width',\n\tconfigPlaceholder: 'formBuilder:config.placeholder',\n\tconfigDescription: 'formBuilder:config.description',\n\tconfigVisibleWhen: 'formBuilder:config.visibleWhen',\n\tconfigValidateWhen: 'formBuilder:config.validateWhen',\n\tsubmissionAnswers: 'formBuilder:submission.answers',\n\tsubmissionNoAnswers: 'formBuilder:submission.noAnswers',\n\truleMinLength: 'formBuilder:rule.minLength.label',\n\truleMaxLength: 'formBuilder:rule.maxLength.label',\n\truleMin: 'formBuilder:rule.min.label',\n\truleMax: 'formBuilder:rule.max.label',\n\truleMinDate: 'formBuilder:rule.minDate.label',\n\truleMaxDate: 'formBuilder:rule.maxDate.label',\n\trulePattern: 'formBuilder:rule.pattern.label',\n\truleEmail: 'formBuilder:rule.email.label',\n\truleUrl: 'formBuilder:rule.url.label',\n\truleOneOf: 'formBuilder:rule.oneOf.label',\n\truleMatchesField: 'formBuilder:rule.matchesField.label',\n\truleNotAlreadySubmitted: 'formBuilder:rule.notAlreadySubmitted.label',\n\truleMinLengthMessage: 'formBuilder:rule.minLength.message',\n\truleMaxLengthMessage: 'formBuilder:rule.maxLength.message',\n\truleMinMessage: 'formBuilder:rule.min.message',\n\truleMaxMessage: 'formBuilder:rule.max.message',\n\truleMinDateMessage: 'formBuilder:rule.minDate.message',\n\truleMaxDateMessage: 'formBuilder:rule.maxDate.message',\n\trulePatternMessage: 'formBuilder:rule.pattern.message',\n\truleEmailMessage: 'formBuilder:rule.email.message',\n\truleUrlMessage: 'formBuilder:rule.url.message',\n\truleOneOfMessage: 'formBuilder:rule.oneOf.message',\n\truleMatchesFieldMessage: 'formBuilder:rule.matchesField.message',\n\truleNotAlreadySubmittedMessage: 'formBuilder:rule.notAlreadySubmitted.message',\n\truleMinLengthDescription: 'formBuilder:rule.minLength.description',\n\truleMaxLengthDescription: 'formBuilder:rule.maxLength.description',\n\truleMinDescription: 'formBuilder:rule.min.description',\n\truleMaxDescription: 'formBuilder:rule.max.description',\n\truleMinDateDescription: 'formBuilder:rule.minDate.description',\n\truleMaxDateDescription: 'formBuilder:rule.maxDate.description',\n\trulePatternDescription: 'formBuilder:rule.pattern.description',\n\truleEmailDescription: 'formBuilder:rule.email.description',\n\truleUrlDescription: 'formBuilder:rule.url.description',\n\truleOneOfDescription: 'formBuilder:rule.oneOf.description',\n\truleMatchesFieldDescription: 'formBuilder:rule.matchesField.description',\n\truleNotAlreadySubmittedDescription: 'formBuilder:rule.notAlreadySubmitted.description',\n\truleFieldTargetInvalid: 'formBuilder:rule.fieldTargetInvalid',\n\truleParamMin: 'formBuilder:rule.param.min',\n\truleParamMax: 'formBuilder:rule.param.max',\n\truleParamMinDate: 'formBuilder:rule.param.minDate',\n\truleParamMaxDate: 'formBuilder:rule.param.maxDate',\n\truleParamPattern: 'formBuilder:rule.param.pattern',\n\truleParamFlags: 'formBuilder:rule.param.flags',\n\truleParamValues: 'formBuilder:rule.param.values',\n\truleParamField: 'formBuilder:rule.param.field',\n\tvalidationsLabel: 'formBuilder:validations.label',\n\tvalidationMessageLabel: 'formBuilder:validations.message',\n\tconditionAddCondition: 'formBuilder:condition.addCondition',\n\tconditionAddOr: 'formBuilder:condition.addOr',\n\tconditionAnd: 'formBuilder:condition.and',\n\tconditionOr: 'formBuilder:condition.or',\n\tconditionRemove: 'formBuilder:condition.remove',\n\tconditionNoFields: 'formBuilder:condition.noFields',\n\tconditionEmpty: 'formBuilder:condition.empty',\n\tconditionSelectField: 'formBuilder:condition.selectField',\n\tconditionTrue: 'formBuilder:condition.true',\n\tconditionFalse: 'formBuilder:condition.false',\n\tconfigHidden: 'formBuilder:config.hidden',\n\ttabFields: 'formBuilder:tab.fields',\n\ttabFlow: 'formBuilder:tab.flow',\n\ttabActions: 'formBuilder:tab.actions',\n\ttabField: 'formBuilder:tab.field',\n\ttabValidation: 'formBuilder:tab.validation',\n\ttabAdvanced: 'formBuilder:tab.advanced',\n\tfieldTypeCalculation: 'formBuilder:fieldType.calculation',\n\tconfigExpression: 'formBuilder:config.expression',\n\tconfigExpressionDescription: 'formBuilder:config.expressionDescription',\n\tconfigCalcDisplay: 'formBuilder:config.calcDisplay',\n\tvalidationCalcExpressionInvalid: 'formBuilder:validation.calcExpressionInvalid',\n\tpresentationPage: 'formBuilder:presentation.page',\n\tpresentationModal: 'formBuilder:presentation.modal',\n\tpresentationDrawer: 'formBuilder:presentation.drawer',\n\tpresentationInline: 'formBuilder:presentation.inline',\n\tactionEmailTeam: 'formBuilder:action.emailTeam',\n\tactionConfirmation: 'formBuilder:action.confirmation',\n\tactionSignedWebhook: 'formBuilder:action.signedWebhook',\n\tactionConfigTo: 'formBuilder:action.config.to',\n\tactionConfigSubject: 'formBuilder:action.config.subject',\n\tactionConfigBody: 'formBuilder:action.config.body',\n\tactionConfigBodyDescription: 'formBuilder:action.config.bodyDescription',\n\tactionConfigToField: 'formBuilder:action.config.toField',\n\tactionConfigToFieldDescription: 'formBuilder:action.config.toFieldDescription',\n\tactionConfigFrom: 'formBuilder:action.config.from',\n\tactionConfigFromDescription: 'formBuilder:action.config.fromDescription',\n\tactionConfigCc: 'formBuilder:action.config.cc',\n\tactionConfigBcc: 'formBuilder:action.config.bcc',\n\tactionConfigReplyTo: 'formBuilder:action.config.replyTo',\n\trecipientsGroupDepartments: 'formBuilder:recipients.group.departments',\n\trecipientsGroupFields: 'formBuilder:recipients.group.fields',\n\tvalidationRecipientInvalid: 'formBuilder:validation.recipient.invalid',\n\tvalidationRecipientUnknownField: 'formBuilder:validation.recipient.unknownField',\n\tvalidationRecipientNotAllowed: 'formBuilder:validation.recipient.notAllowed',\n\tvalidationRecipientOptionsUnavailable: 'formBuilder:validation.recipient.optionsUnavailable',\n\tvalidationFromUnknown: 'formBuilder:validation.fromUnknown',\n\tvalidationFromUnavailable: 'formBuilder:validation.fromUnavailable',\n\tactionConfigUrl: 'formBuilder:action.config.url',\n\tactionConfigUrlDescription: 'formBuilder:action.config.urlDescription',\n\tactionConfigSecret: 'formBuilder:action.config.secret',\n\tactionConfigSecretDescription: 'formBuilder:action.config.secretDescription',\n\tvalidationUrlInvalid: 'formBuilder:validation.urlInvalid',\n\tconfigActions: 'formBuilder:config.actions',\n\tfieldTypeConsent: 'formBuilder:fieldType.consent',\n\tconsentConfigSource: 'formBuilder:consent.config.source',\n\tconsentConfigSourceDescription: 'formBuilder:consent.config.sourceDescription',\n\tconsentSourcesField: 'formBuilder:consentSources.field',\n\tconsentSourcesFieldDescription: 'formBuilder:consentSources.fieldDescription',\n\tconsentSourceSingular: 'formBuilder:consentSources.singular',\n\tconsentSourcePlural: 'formBuilder:consentSources.plural',\n\tconsentSourceLabel: 'formBuilder:consentSources.label',\n\tconsentSourceStatement: 'formBuilder:consentSources.statement',\n\tconsentSourcePage: 'formBuilder:consentSources.page',\n\tconsentSourcePageDescription: 'formBuilder:consentSources.pageDescription',\n\tconsentSourcesUnavailable: 'formBuilder:consent.sourcesUnavailable',\n\tresultsResponses: 'formBuilder:results.responses',\n\tresultsNoResponses: 'formBuilder:results.noResponses',\n\tresultsTruncated: 'formBuilder:results.truncated',\n\tpollGroup: 'formBuilder:poll.group',\n\tpollResultsField: 'formBuilder:poll.resultsField',\n\tpollResultsFieldDescription: 'formBuilder:poll.resultsFieldDescription',\n\tpollVoteFieldChoose: 'formBuilder:poll.voteFieldChoose',\n\tpollVoteFieldMissing: 'formBuilder:poll.voteFieldMissing',\n\tpollResultsVisibility: 'formBuilder:poll.resultsVisibility',\n\tpollVisibilityAfterVote: 'formBuilder:poll.visibility.afterVote',\n\tpollVisibilityAfterClose: 'formBuilder:poll.visibility.afterClose',\n\tpollClosesAt: 'formBuilder:poll.closesAt',\n\tpollClosed: 'formBuilder:poll.closed',\n\tpollResultsAfterClose: 'formBuilder:poll.resultsAfterClose',\n\tpollOptionSource: 'formBuilder:poll.optionSource',\n\tpollOptionSourceDescription: 'formBuilder:poll.optionSourceDescription',\n\tpollSourceConfig: 'formBuilder:poll.sourceConfig',\n\tpollOutcome: 'formBuilder:poll.outcome',\n\tpollType: 'formBuilder:poll.type',\n\tpollTypeDescription: 'formBuilder:poll.typeDescription',\n\tpollTypeManual: 'formBuilder:poll.type.manual',\n\tpollTypeMostVoted: 'formBuilder:poll.type.mostVoted',\n\tpollTypeSource: 'formBuilder:poll.type.source',\n\tpollCloseButton: 'formBuilder:poll.close.button',\n\tpollReopenButton: 'formBuilder:poll.reopen.button',\n\tpollCloseHintManual: 'formBuilder:poll.close.hintManual',\n\tpollCloseHintMostVoted: 'formBuilder:poll.close.hintMostVoted',\n\tpollCloseHintSource: 'formBuilder:poll.close.hintSource',\n\tpollReopenHint: 'formBuilder:poll.reopen.hint',\n\tpollCloseNeedsWinner: 'formBuilder:poll.close.needsWinner',\n\tpollCloseManualNoWinner: 'formBuilder:poll.close.manualNoWinner',\n\tpollWinningValue: 'formBuilder:poll.winningValue',\n\tpollWinningValueDescription: 'formBuilder:poll.winningValueDescription',\n\tpollResolvedAt: 'formBuilder:poll.resolvedAt',\n\tvalidationWinningValueUnknown: 'formBuilder:validation.winningValueUnknown',\n\tvalidationWinningValueDisabled: 'formBuilder:validation.winningValueDisabled',\n\tendpointOptionsLoading: 'formBuilder:endpointOptions.loading',\n\tendpointOptionsError: 'formBuilder:endpointOptions.error',\n\tpollOptionsUnavailable: 'formBuilder:poll.optionsUnavailable',\n\tpollFinalResult: 'formBuilder:poll.finalResult',\n\tpollResultsError: 'formBuilder:poll.resultsError',\n\tresultsWinner: 'formBuilder:results.winner',\n\tvalidationFileMissing: 'formBuilder:validation.file.missing',\n\tvalidationFileMimeType: 'formBuilder:validation.file.mimeType',\n\tvalidationFileTooLarge: 'formBuilder:validation.file.tooLarge',\n\tfieldTypeFile: 'formBuilder:fieldType.file',\n\tfileConfigMimeTypes: 'formBuilder:file.config.mimeTypes',\n\tfileConfigMaxSize: 'formBuilder:file.config.maxSize',\n\tfileConfigMaxSizeDescription: 'formBuilder:file.config.maxSizeDescription',\n\tfileTooLarge: 'formBuilder:file.tooLarge',\n\tfileUploadMisconfigured: 'formBuilder:file.uploadMisconfigured',\n\tfileHintAccepted: 'formBuilder:file.hint.accepted',\n\tfileHintMaxSize: 'formBuilder:file.hint.maxSize',\n\tfileUploaded: 'formBuilder:file.uploaded',\n\tfileUploading: 'formBuilder:file.uploading',\n\tfileUploadFailed: 'formBuilder:file.uploadFailed',\n\tfileRemove: 'formBuilder:file.remove',\n\tspamRateLimited: 'formBuilder:spam.rateLimited',\n\tspamRejected: 'formBuilder:spam.rejected',\n\tspamCaptchaFailed: 'formBuilder:spam.captchaFailed',\n\tcollectionFormSingular: 'formBuilder:collection.form.singular',\n\tcollectionFormPlural: 'formBuilder:collection.form.plural',\n\tcollectionSubmissionSingular: 'formBuilder:collection.submission.singular',\n\tcollectionSubmissionPlural: 'formBuilder:collection.submission.plural',\n\tstatusComplete: 'formBuilder:status.complete',\n\tstatusPartial: 'formBuilder:status.partial',\n\tfieldTypeRepeater: 'formBuilder:fieldType.repeater',\n\tconfigMinRows: 'formBuilder:config.minRows',\n\tconfigMaxRows: 'formBuilder:config.maxRows',\n\tconfigAddLabel: 'formBuilder:config.addLabel',\n\tconfigSubFields: 'formBuilder:config.subFields',\n\tvalidationRepeaterMin: 'formBuilder:validation.repeaterMin',\n\tvalidationRepeaterMax: 'formBuilder:validation.repeaterMax',\n\trepeaterAddRow: 'formBuilder:repeater.addRow',\n\trepeaterRemoveRow: 'formBuilder:repeater.removeRow',\n\trepeaterRow: 'formBuilder:repeater.row',\n\trepeaterRowCount: 'formBuilder:repeater.rowCount',\n\tsubmissionConsent: 'formBuilder:submission.consent',\n\tsubmissionDetails: 'formBuilder:submission.details',\n\tsubmissionConsentAgreed: 'formBuilder:submission.consentAgreed',\n\tsubmissionConsentDeclined: 'formBuilder:submission.consentDeclined',\n\tsubmissionMetaLocale: 'formBuilder:submission.meta.locale',\n\tsubmissionMetaReceivedAt: 'formBuilder:submission.meta.receivedAt',\n\tsubmissionMetaIp: 'formBuilder:submission.meta.ip',\n\tsubmissionMetaUserAgent: 'formBuilder:submission.meta.userAgent',\n\tsubmissionMetaCaptcha: 'formBuilder:submission.meta.captcha',\n\tflowDescription: 'formBuilder:flow.description',\n\tflowStepFallbackTitle: 'formBuilder:flow.stepFallbackTitle',\n\tflowFieldInStep: 'formBuilder:flow.fieldInStep',\n\tflowUnassigned: 'formBuilder:flow.unassigned',\n\tflowAssignToStep: 'formBuilder:flow.assignToStep',\n\tflowNextSequential: 'formBuilder:flow.nextSequential',\n\tflowNextTerminal: 'formBuilder:flow.nextTerminal',\n\tflowFields: 'formBuilder:flow.fields',\n\tflowDefaultNext: 'formBuilder:flow.defaultNext',\n\tflowConditionalTransitions: 'formBuilder:flow.conditionalTransitions',\n\tflowStepTitleLabel: 'formBuilder:flow.stepTitleLabel',\n\tflowSelectStepPlaceholder: 'formBuilder:flow.selectStepPlaceholder',\n\tflowMoveTransitionUp: 'formBuilder:flow.moveTransitionUp',\n\tflowMoveTransitionDown: 'formBuilder:flow.moveTransitionDown',\n\tflowRemoveTransition: 'formBuilder:flow.removeTransition',\n\tflowAddAbove: 'formBuilder:flow.addAbove',\n\tflowAddBelow: 'formBuilder:flow.addBelow',\n\tflowGoTo: 'formBuilder:flow.goTo',\n\tflowWhen: 'formBuilder:flow.when',\n\tflowNoFields: 'formBuilder:flow.noFields',\n\tflowFirstMatchWins: 'formBuilder:flow.firstMatchWins',\n\tflowAddTransition: 'formBuilder:flow.addTransition',\n\tflowNoSteps: 'formBuilder:flow.noSteps',\n\tflowFallbackTitle: 'formBuilder:flow.fallbackTitle',\n\tfieldTypeMessage: 'formBuilder:fieldType.message',\n\tconfigContent: 'formBuilder:config.content',\n\ttabResponse: 'formBuilder:tab.response',\n\tresponseType: 'formBuilder:response.type',\n\tresponseTypeMessage: 'formBuilder:response.type.message',\n\tresponseTypeRedirect: 'formBuilder:response.type.redirect',\n\tresponseMessage: 'formBuilder:response.message',\n\tresponseRedirect: 'formBuilder:response.redirect',\n\tresponseUrl: 'formBuilder:response.url',\n\tresponseRedirectReference: 'formBuilder:response.redirect.reference',\n\tresponseRedirectReferenceDescription: 'formBuilder:response.redirect.referenceDescription',\n\tbuttonsSubmitLabel: 'formBuilder:buttons.submitLabel',\n\tbuttonsNextLabel: 'formBuilder:buttons.nextLabel',\n\tbuttonsPrevLabel: 'formBuilder:buttons.prevLabel',\n\tformBack: 'formBuilder:form.back',\n\tformNext: 'formBuilder:form.next',\n\tformSubmit: 'formBuilder:form.submit',\n\tformMultistep: 'formBuilder:form.multistep',\n\tformPollEnabled: 'formBuilder:form.pollEnabled',\n\tformClose: 'formBuilder:form.close',\n\tformSuccess: 'formBuilder:form.success',\n\tformSubmitFailed: 'formBuilder:form.submitFailed',\n\tformStepStatus: 'formBuilder:form.stepStatus',\n\tformStepInvalid: 'formBuilder:form.stepInvalid',\n\tcellStepCountOne: 'formBuilder:cell.stepCount.one',\n\tcellStepCountOther: 'formBuilder:cell.stepCount.other',\n\tcellFieldCountOne: 'formBuilder:cell.fieldCount.one',\n\tcellFieldCountOther: 'formBuilder:cell.fieldCount.other',\n\tdepartmentsField: 'formBuilder:departments.field',\n\tdepartmentsFieldDescription: 'formBuilder:departments.fieldDescription',\n\tdepartmentSingular: 'formBuilder:departments.singular',\n\tdepartmentPlural: 'formBuilder:departments.plural',\n\tdepartmentLabel: 'formBuilder:departments.label',\n\tdepartmentEmail: 'formBuilder:departments.email',\n\tdepartmentAddRow: 'formBuilder:departments.addRow',\n\tdepartmentRemoveRow: 'formBuilder:departments.removeRow',\n} as const\n\nexport type TranslationKey = (typeof keys)[keyof typeof keys]\n"],"mappings":";;;;;;AAKA,MAAa,OAAO;CACnB,YAAY;CACZ,eAAe;CACf,mBAAmB;CACnB,gBAAgB;CAChB,iBAAiB;CACjB,iBAAiB;CACjB,kBAAkB;CAClB,gBAAgB;CAChB,mBAAmB;CACnB,eAAe;CACf,eAAe;CACf,cAAc;CACd,mBAAmB;CACnB,mBAAmB;CACnB,oBAAoB;CACpB,iBAAiB;CACjB,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,wBAAwB;CACxB,sBAAsB;CACtB,6BAA6B;CAC7B,+BAA+B;CAC/B,WAAW;CACX,UAAU;CACV,YAAY;CACZ,aAAa;CACb,gBAAgB;CAChB,aAAa;CACb,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CACnB,oBAAoB;CACpB,mBAAmB;CACnB,qBAAqB;CACrB,eAAe;CACf,eAAe;CACf,SAAS;CACT,SAAS;CACT,aAAa;CACb,aAAa;CACb,aAAa;CACb,WAAW;CACX,SAAS;CACT,WAAW;CACX,kBAAkB;CAClB,yBAAyB;CACzB,sBAAsB;CACtB,sBAAsB;CACtB,gBAAgB;CAChB,gBAAgB;CAChB,oBAAoB;CACpB,oBAAoB;CACpB,oBAAoB;CACpB,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;CAClB,yBAAyB;CACzB,gCAAgC;CAChC,0BAA0B;CAC1B,0BAA0B;CAC1B,oBAAoB;CACpB,oBAAoB;CACpB,wBAAwB;CACxB,wBAAwB;CACxB,wBAAwB;CACxB,sBAAsB;CACtB,oBAAoB;CACpB,sBAAsB;CACtB,6BAA6B;CAC7B,oCAAoC;CACpC,wBAAwB;CACxB,cAAc;CACd,cAAc;CACd,kBAAkB;CAClB,kBAAkB;CAClB,kBAAkB;CAClB,gBAAgB;CAChB,iBAAiB;CACjB,gBAAgB;CAChB,kBAAkB;CAClB,wBAAwB;CACxB,uBAAuB;CACvB,gBAAgB;CAChB,cAAc;CACd,aAAa;CACb,iBAAiB;CACjB,mBAAmB;CACnB,gBAAgB;CAChB,sBAAsB;CACtB,eAAe;CACf,gBAAgB;CAChB,cAAc;CACd,WAAW;CACX,SAAS;CACT,YAAY;CACZ,UAAU;CACV,eAAe;CACf,aAAa;CACb,sBAAsB;CACtB,kBAAkB;CAClB,6BAA6B;CAC7B,mBAAmB;CACnB,iCAAiC;CACjC,kBAAkB;CAClB,mBAAmB;CACnB,oBAAoB;CACpB,oBAAoB;CACpB,iBAAiB;CACjB,oBAAoB;CACpB,qBAAqB;CACrB,gBAAgB;CAChB,qBAAqB;CACrB,kBAAkB;CAClB,6BAA6B;CAC7B,qBAAqB;CACrB,gCAAgC;CAChC,kBAAkB;CAClB,6BAA6B;CAC7B,gBAAgB;CAChB,iBAAiB;CACjB,qBAAqB;CACrB,4BAA4B;CAC5B,uBAAuB;CACvB,4BAA4B;CAC5B,iCAAiC;CACjC,+BAA+B;CAC/B,uCAAuC;CACvC,uBAAuB;CACvB,2BAA2B;CAC3B,iBAAiB;CACjB,4BAA4B;CAC5B,oBAAoB;CACpB,+BAA+B;CAC/B,sBAAsB;CACtB,eAAe;CACf,kBAAkB;CAClB,qBAAqB;CACrB,gCAAgC;CAChC,qBAAqB;CACrB,gCAAgC;CAChC,uBAAuB;CACvB,qBAAqB;CACrB,oBAAoB;CACpB,wBAAwB;CACxB,mBAAmB;CACnB,8BAA8B;CAC9B,2BAA2B;CAC3B,kBAAkB;CAClB,oBAAoB;CACpB,kBAAkB;CAClB,WAAW;CACX,kBAAkB;CAClB,6BAA6B;CAC7B,qBAAqB;CACrB,sBAAsB;CACtB,uBAAuB;CACvB,yBAAyB;CACzB,0BAA0B;CAC1B,cAAc;CACd,YAAY;CACZ,uBAAuB;CACvB,kBAAkB;CAClB,6BAA6B;CAC7B,kBAAkB;CAClB,aAAa;CACb,UAAU;CACV,qBAAqB;CACrB,gBAAgB;CAChB,mBAAmB;CACnB,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,qBAAqB;CACrB,wBAAwB;CACxB,qBAAqB;CACrB,gBAAgB;CAChB,sBAAsB;CACtB,yBAAyB;CACzB,kBAAkB;CAClB,6BAA6B;CAC7B,gBAAgB;CAChB,+BAA+B;CAC/B,gCAAgC;CAChC,wBAAwB;CACxB,sBAAsB;CACtB,wBAAwB;CACxB,iBAAiB;CACjB,kBAAkB;CAClB,eAAe;CACf,uBAAuB;CACvB,wBAAwB;CACxB,wBAAwB;CACxB,eAAe;CACf,qBAAqB;CACrB,mBAAmB;CACnB,8BAA8B;CAC9B,cAAc;CACd,yBAAyB;CACzB,kBAAkB;CAClB,iBAAiB;CACjB,cAAc;CACd,eAAe;CACf,kBAAkB;CAClB,YAAY;CACZ,iBAAiB;CACjB,cAAc;CACd,mBAAmB;CACnB,wBAAwB;CACxB,sBAAsB;CACtB,8BAA8B;CAC9B,4BAA4B;CAC5B,gBAAgB;CAChB,eAAe;CACf,mBAAmB;CACnB,eAAe;CACf,eAAe;CACf,gBAAgB;CAChB,iBAAiB;CACjB,uBAAuB;CACvB,uBAAuB;CACvB,gBAAgB;CAChB,mBAAmB;CACnB,aAAa;CACb,kBAAkB;CAClB,mBAAmB;CACnB,mBAAmB;CACnB,yBAAyB;CACzB,2BAA2B;CAC3B,sBAAsB;CACtB,0BAA0B;CAC1B,kBAAkB;CAClB,yBAAyB;CACzB,uBAAuB;CACvB,iBAAiB;CACjB,uBAAuB;CACvB,iBAAiB;CACjB,gBAAgB;CAChB,kBAAkB;CAClB,oBAAoB;CACpB,kBAAkB;CAClB,YAAY;CACZ,iBAAiB;CACjB,4BAA4B;CAC5B,oBAAoB;CACpB,2BAA2B;CAC3B,sBAAsB;CACtB,wBAAwB;CACxB,sBAAsB;CACtB,cAAc;CACd,cAAc;CACd,UAAU;CACV,UAAU;CACV,cAAc;CACd,oBAAoB;CACpB,mBAAmB;CACnB,aAAa;CACb,mBAAmB;CACnB,kBAAkB;CAClB,eAAe;CACf,aAAa;CACb,cAAc;CACd,qBAAqB;CACrB,sBAAsB;CACtB,iBAAiB;CACjB,kBAAkB;CAClB,aAAa;CACb,2BAA2B;CAC3B,sCAAsC;CACtC,oBAAoB;CACpB,kBAAkB;CAClB,kBAAkB;CAClB,UAAU;CACV,UAAU;CACV,YAAY;CACZ,eAAe;CACf,iBAAiB;CACjB,WAAW;CACX,aAAa;CACb,kBAAkB;CAClB,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,oBAAoB;CACpB,mBAAmB;CACnB,qBAAqB;CACrB,kBAAkB;CAClB,6BAA6B;CAC7B,oBAAoB;CACpB,kBAAkB;CAClB,iBAAiB;CACjB,iBAAiB;CACjB,kBAAkB;CAClB,qBAAqB;AACtB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RendererTranslate } from "../react/contract.js";
|
|
2
|
+
|
|
3
|
+
//#region src/translations/makeTranslate.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Build a `RendererTranslate` from either a locale code or an explicit map.
|
|
6
|
+
*
|
|
7
|
+
* Pass a locale code (`makeTranslate('de')`) to resolve against that shipped bundle, falling back to
|
|
8
|
+
* `en` for a locale this plugin does not ship, so a host bridging its own translator never leaks the
|
|
9
|
+
* raw key for an un-mirrored string. Pass a flat key->string map to use it verbatim (custom or partial
|
|
10
|
+
* maps still work). Unknown keys fall back to the key itself so nothing crashes on an incomplete map.
|
|
11
|
+
*/
|
|
12
|
+
declare const makeTranslate: (localeOrMap: string | Record<string, string>) => RendererTranslate;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { makeTranslate };
|
|
15
|
+
//# sourceMappingURL=makeTranslate.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { en } from "./en.js";
|
|
3
|
+
import { bundles } from "./index.js";
|
|
4
|
+
//#region src/translations/makeTranslate.ts
|
|
5
|
+
/**
|
|
6
|
+
* Build a `RendererTranslate` from either a locale code or an explicit map.
|
|
7
|
+
*
|
|
8
|
+
* Pass a locale code (`makeTranslate('de')`) to resolve against that shipped bundle, falling back to
|
|
9
|
+
* `en` for a locale this plugin does not ship, so a host bridging its own translator never leaks the
|
|
10
|
+
* raw key for an un-mirrored string. Pass a flat key->string map to use it verbatim (custom or partial
|
|
11
|
+
* maps still work). Unknown keys fall back to the key itself so nothing crashes on an incomplete map.
|
|
12
|
+
*/
|
|
13
|
+
const makeTranslate = (localeOrMap) => {
|
|
14
|
+
const map = typeof localeOrMap === "string" ? bundles[localeOrMap] ?? en : localeOrMap;
|
|
15
|
+
return (key) => map[key] ?? key;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { makeTranslate };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=makeTranslate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeTranslate.js","names":[],"sources":["../../src/translations/makeTranslate.ts"],"sourcesContent":["'use client'\n\nimport type { RendererTranslate } from '../react/contract'\nimport { en } from './en'\nimport { bundles } from './index'\n\n/**\n * Build a `RendererTranslate` from either a locale code or an explicit map.\n *\n * Pass a locale code (`makeTranslate('de')`) to resolve against that shipped bundle, falling back to\n * `en` for a locale this plugin does not ship, so a host bridging its own translator never leaks the\n * raw key for an un-mirrored string. Pass a flat key->string map to use it verbatim (custom or partial\n * maps still work). Unknown keys fall back to the key itself so nothing crashes on an incomplete map.\n */\nexport const makeTranslate = (localeOrMap: string | Record<string, string>): RendererTranslate => {\n\tconst map: Record<string, string> =\n\t\ttypeof localeOrMap === 'string' ? (bundles[localeOrMap] ?? en) : localeOrMap\n\treturn (key) => map[key] ?? key\n}\n"],"mappings":";;;;;;;;;;;;AAcA,MAAa,iBAAiB,gBAAoE;CACjG,MAAM,MACL,OAAO,gBAAgB,WAAY,QAAQ,gBAAgB,KAAM;CAClE,QAAQ,QAAQ,IAAI,QAAQ;AAC7B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/translations/server.ts
|
|
2
|
+
/**
|
|
3
|
+
* Adapt a Payload request `t` (typed to core keys only) so it also accepts this
|
|
4
|
+
* plugin's keys. They are registered at config time and resolve at runtime; the
|
|
5
|
+
* cast only widens the compile-time key domain.
|
|
6
|
+
*/
|
|
7
|
+
const asTranslate = (t) => t;
|
|
8
|
+
/**
|
|
9
|
+
* Adapt a Payload request `t` to the engine-facing `Translate` the submission core and field-type
|
|
10
|
+
* `format`/`validate` speak (any key string). Same runtime function as `asTranslate`; this widening
|
|
11
|
+
* accepts arbitrary keys because the engine resolves both this plugin's and a host's registered keys.
|
|
12
|
+
*/
|
|
13
|
+
const asFieldTranslate = (t) => t;
|
|
14
|
+
/** A field `label`/`description` backed by a typed key, resolved per request. */
|
|
15
|
+
const labelForKey = (key) => ({ t }) => asTranslate(t)(key);
|
|
16
|
+
/**
|
|
17
|
+
* A `label`/`description` from an arbitrary key string (a field-type-supplied label, which may be a
|
|
18
|
+
* host-registered key or a literal; Payload's `t` returns the input unchanged when unknown). Distinct
|
|
19
|
+
* from `labelForKey`, which constrains to this plugin's typed keys.
|
|
20
|
+
*/
|
|
21
|
+
const labelFor = (key) => ({ t }) => asTranslate(t)(key);
|
|
22
|
+
/**
|
|
23
|
+
* Turn a registry definition's `label` into a value Payload accepts for a field/block `label`. A
|
|
24
|
+
* string resolves per request like a field label (an i18n key or a literal) via `labelFor`; a
|
|
25
|
+
* per-locale record passes through unchanged. Shared by the action, poll-source, and poll-type
|
|
26
|
+
* registries so every definition label honors one contract.
|
|
27
|
+
*/
|
|
28
|
+
const resolveDefinitionLabel = (label) => typeof label === "string" ? labelFor(label) : label;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { asFieldTranslate, asTranslate, labelFor, labelForKey, resolveDefinitionLabel };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","names":[],"sources":["../../src/translations/server.ts"],"sourcesContent":["import type { LabelFunction } from 'payload'\n\nimport type { Translate as FieldTranslate } from '../fields/types'\nimport type { TranslationKey } from './keys'\n\n/** A `t`-like function narrowed to this plugin's typed keys. */\ntype Translate = (key: TranslationKey) => string\n\n/**\n * Adapt a Payload request `t` (typed to core keys only) so it also accepts this\n * plugin's keys. They are registered at config time and resolve at runtime; the\n * cast only widens the compile-time key domain.\n */\nexport const asTranslate = (t: unknown): Translate => t as Translate\n\n/**\n * Adapt a Payload request `t` to the engine-facing `Translate` the submission core and field-type\n * `format`/`validate` speak (any key string). Same runtime function as `asTranslate`; this widening\n * accepts arbitrary keys because the engine resolves both this plugin's and a host's registered keys.\n */\nexport const asFieldTranslate = (t: unknown): FieldTranslate => t as FieldTranslate\n\n/** A field `label`/`description` backed by a typed key, resolved per request. */\nexport const labelForKey =\n\t(key: TranslationKey): LabelFunction =>\n\t({ t }) =>\n\t\tasTranslate(t)(key)\n\n/**\n * A `label`/`description` from an arbitrary key string (a field-type-supplied label, which may be a\n * host-registered key or a literal; Payload's `t` returns the input unchanged when unknown). Distinct\n * from `labelForKey`, which constrains to this plugin's typed keys.\n */\nexport const labelFor =\n\t(key: string): LabelFunction =>\n\t({ t }) =>\n\t\tasTranslate(t)(key as TranslationKey)\n\n/**\n * Turn a registry definition's `label` into a value Payload accepts for a field/block `label`. A\n * string resolves per request like a field label (an i18n key or a literal) via `labelFor`; a\n * per-locale record passes through unchanged. Shared by the action, poll-source, and poll-type\n * registries so every definition label honors one contract.\n */\nexport const resolveDefinitionLabel = (\n\tlabel: string | Record<string, string>\n): LabelFunction | Record<string, string> => (typeof label === 'string' ? labelFor(label) : label)\n"],"mappings":";;;;;;AAaA,MAAa,eAAe,MAA0B;;;;;;AAOtD,MAAa,oBAAoB,MAA+B;;AAGhE,MAAa,eACX,SACA,EAAE,QACF,YAAY,CAAC,EAAE,GAAG;;;;;;AAOpB,MAAa,YACX,SACA,EAAE,QACF,YAAY,CAAC,EAAE,GAAqB;;;;;;;AAQtC,MAAa,0BACZ,UAC6C,OAAO,UAAU,WAAW,SAAS,KAAK,IAAI"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useTranslation } from "@payloadcms/ui";
|
|
3
|
+
//#region src/translations/useTranslation.ts
|
|
4
|
+
/**
|
|
5
|
+
* `useTranslation` bound to this plugin's keys, so `t(keys.X)` typechecks without
|
|
6
|
+
* a per-call `@ts-expect-error`. Returns Payload's `{ t, i18n }` unchanged.
|
|
7
|
+
*/
|
|
8
|
+
const useTranslation$1 = () => useTranslation();
|
|
9
|
+
//#endregion
|
|
10
|
+
export { useTranslation$1 as useTranslation };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=useTranslation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTranslation.js","names":["useTranslation","usePayloadTranslation"],"sources":["../../src/translations/useTranslation.ts"],"sourcesContent":["'use client'\n\nimport { useTranslation as usePayloadTranslation } from '@payloadcms/ui'\n\nimport type { TranslationKey } from './keys'\n\n/**\n * `useTranslation` bound to this plugin's keys, so `t(keys.X)` typechecks without\n * a per-call `@ts-expect-error`. Returns Payload's `{ t, i18n }` unchanged.\n */\nexport const useTranslation = () => usePayloadTranslation<Record<string, never>, TranslationKey>()\n"],"mappings":";;;;;;;AAUA,MAAaA,yBAAuBC,eAA6D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FileFieldConfig } from "./types.js";
|
|
2
|
+
import { ResolveFileRefResult } from "./resolveFileRef.js";
|
|
3
|
+
import { Payload, PayloadRequest } from "payload";
|
|
4
|
+
|
|
5
|
+
//#region src/uploads/captureFileRef.d.ts
|
|
6
|
+
type CaptureFileRefArgs = {
|
|
7
|
+
payload: Payload;
|
|
8
|
+
collectionSlug: string;
|
|
9
|
+
uploadId: string | number;
|
|
10
|
+
config: FileFieldConfig;
|
|
11
|
+
req?: PayloadRequest; /** Resolved submitter identity; must match the upload's `owner` stamp when both are present. */
|
|
12
|
+
expectedOwner?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Fail closed when a stamped upload's submitter cannot be identified (plugin `spam.uploadOwnership:
|
|
15
|
+
* 'strict'`). Default lenient: an unidentifiable submitter passes an owned upload through.
|
|
16
|
+
*/
|
|
17
|
+
strict?: boolean;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Load the referenced upload doc and run the pure trust-boundary check. The client sends only the id; the
|
|
21
|
+
* filename/mimeType/filesize are read authoritatively from the stored doc, never from the client. When the
|
|
22
|
+
* upload carries an `owner` stamp AND the submitter is identifiable, the two must match, so an anonymous
|
|
23
|
+
* submitter cannot capture another identity's upload; a mismatch collapses to `missing`, indistinguishable
|
|
24
|
+
* from a deleted upload. When the submitter cannot be identified (no `expectedOwner`), ownership is not
|
|
25
|
+
* enforced by default (fail-open, consistent with rate-limiting): a proxy-configured deployment identifies
|
|
26
|
+
* every request, so this only relaxes scoping where it could not be applied fairly anyway. Under `strict`
|
|
27
|
+
* (plugin `spam.uploadOwnership: 'strict'`) a stamped upload is rejected even then, so an unverifiable
|
|
28
|
+
* claim can never capture an owned upload. Unstamped uploads (no identity at upload time, or a BYO
|
|
29
|
+
* collection without the field) pass unchanged in either mode.
|
|
30
|
+
*/
|
|
31
|
+
declare const captureFileRef: (args: CaptureFileRefArgs) => Promise<ResolveFileRefResult>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { captureFileRef };
|
|
34
|
+
//# sourceMappingURL=captureFileRef.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { resolveFileRef } from "./resolveFileRef.js";
|
|
2
|
+
//#region src/uploads/captureFileRef.ts
|
|
3
|
+
/**
|
|
4
|
+
* Load the referenced upload doc and run the pure trust-boundary check. The client sends only the id; the
|
|
5
|
+
* filename/mimeType/filesize are read authoritatively from the stored doc, never from the client. When the
|
|
6
|
+
* upload carries an `owner` stamp AND the submitter is identifiable, the two must match, so an anonymous
|
|
7
|
+
* submitter cannot capture another identity's upload; a mismatch collapses to `missing`, indistinguishable
|
|
8
|
+
* from a deleted upload. When the submitter cannot be identified (no `expectedOwner`), ownership is not
|
|
9
|
+
* enforced by default (fail-open, consistent with rate-limiting): a proxy-configured deployment identifies
|
|
10
|
+
* every request, so this only relaxes scoping where it could not be applied fairly anyway. Under `strict`
|
|
11
|
+
* (plugin `spam.uploadOwnership: 'strict'`) a stamped upload is rejected even then, so an unverifiable
|
|
12
|
+
* claim can never capture an owned upload. Unstamped uploads (no identity at upload time, or a BYO
|
|
13
|
+
* collection without the field) pass unchanged in either mode.
|
|
14
|
+
*/
|
|
15
|
+
const captureFileRef = async (args) => {
|
|
16
|
+
const { payload, collectionSlug, uploadId, config, req, expectedOwner, strict } = args;
|
|
17
|
+
const doc = await payload.findByID({
|
|
18
|
+
collection: collectionSlug,
|
|
19
|
+
id: uploadId,
|
|
20
|
+
depth: 0,
|
|
21
|
+
overrideAccess: true,
|
|
22
|
+
req
|
|
23
|
+
}).catch(() => null);
|
|
24
|
+
if (doc) {
|
|
25
|
+
const owner = doc.owner;
|
|
26
|
+
if (typeof owner === "string" && owner.length > 0) {
|
|
27
|
+
if (expectedOwner == null) {
|
|
28
|
+
if (strict) return {
|
|
29
|
+
ok: false,
|
|
30
|
+
code: "missing"
|
|
31
|
+
};
|
|
32
|
+
} else if (owner !== expectedOwner) return {
|
|
33
|
+
ok: false,
|
|
34
|
+
code: "missing"
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return resolveFileRef(doc, config);
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { captureFileRef };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=captureFileRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captureFileRef.js","names":[],"sources":["../../src/uploads/captureFileRef.ts"],"sourcesContent":["import type { CollectionSlug, Payload, PayloadRequest } from 'payload'\nimport { type ResolveFileRefResult, resolveFileRef } from './resolveFileRef'\nimport type { FileFieldConfig } from './types'\n\nexport type CaptureFileRefArgs = {\n\tpayload: Payload\n\tcollectionSlug: string\n\tuploadId: string | number\n\tconfig: FileFieldConfig\n\treq?: PayloadRequest\n\t/** Resolved submitter identity; must match the upload's `owner` stamp when both are present. */\n\texpectedOwner?: string\n\t/**\n\t * Fail closed when a stamped upload's submitter cannot be identified (plugin `spam.uploadOwnership:\n\t * 'strict'`). Default lenient: an unidentifiable submitter passes an owned upload through.\n\t */\n\tstrict?: boolean\n}\n\n/**\n * Load the referenced upload doc and run the pure trust-boundary check. The client sends only the id; the\n * filename/mimeType/filesize are read authoritatively from the stored doc, never from the client. When the\n * upload carries an `owner` stamp AND the submitter is identifiable, the two must match, so an anonymous\n * submitter cannot capture another identity's upload; a mismatch collapses to `missing`, indistinguishable\n * from a deleted upload. When the submitter cannot be identified (no `expectedOwner`), ownership is not\n * enforced by default (fail-open, consistent with rate-limiting): a proxy-configured deployment identifies\n * every request, so this only relaxes scoping where it could not be applied fairly anyway. Under `strict`\n * (plugin `spam.uploadOwnership: 'strict'`) a stamped upload is rejected even then, so an unverifiable\n * claim can never capture an owned upload. Unstamped uploads (no identity at upload time, or a BYO\n * collection without the field) pass unchanged in either mode.\n */\nexport const captureFileRef = async (args: CaptureFileRefArgs): Promise<ResolveFileRefResult> => {\n\tconst { payload, collectionSlug, uploadId, config, req, expectedOwner, strict } = args\n\tconst doc = await payload\n\t\t.findByID({\n\t\t\tcollection: collectionSlug as CollectionSlug,\n\t\t\tid: uploadId,\n\t\t\tdepth: 0,\n\t\t\toverrideAccess: true,\n\t\t\treq,\n\t\t})\n\t\t.catch(() => null)\n\tif (doc) {\n\t\tconst owner = (doc as { owner?: unknown }).owner\n\t\tconst stamped = typeof owner === 'string' && owner.length > 0\n\t\tif (stamped) {\n\t\t\tif (expectedOwner == null) {\n\t\t\t\tif (strict) {\n\t\t\t\t\treturn { ok: false, code: 'missing' }\n\t\t\t\t}\n\t\t\t} else if (owner !== expectedOwner) {\n\t\t\t\treturn { ok: false, code: 'missing' }\n\t\t\t}\n\t\t}\n\t}\n\treturn resolveFileRef(doc, config)\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,MAAa,iBAAiB,OAAO,SAA4D;CAChG,MAAM,EAAE,SAAS,gBAAgB,UAAU,QAAQ,KAAK,eAAe,WAAW;CAClF,MAAM,MAAM,MAAM,QAChB,SAAS;EACT,YAAY;EACZ,IAAI;EACJ,OAAO;EACP,gBAAgB;EAChB;CACD,CAAC,EACA,YAAY,IAAI;CAClB,IAAI,KAAK;EACR,MAAM,QAAS,IAA4B;EAE3C,IADgB,OAAO,UAAU,YAAY,MAAM,SAAS;OAEvD,iBAAiB;QAChB,QACH,OAAO;KAAE,IAAI;KAAO,MAAM;IAAU;GAAA,OAE/B,IAAI,UAAU,eACpB,OAAO;IAAE,IAAI;IAAO,MAAM;GAAU;EAAA;CAGvC;CACA,OAAO,eAAe,KAAK,MAAM;AAClC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/uploads/formatBytes.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Format a byte count as a human-readable size (1024-based, B/KB/MB/GB) with at most one decimal.
|
|
4
|
+
* Trailing `.0` is dropped: `2621440` -> `'2.5 MB'`, `1024` -> `'1 KB'`, `500` -> `'500 B'`.
|
|
5
|
+
*/
|
|
6
|
+
declare const formatBytes: (n: number) => string;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { formatBytes };
|
|
9
|
+
//# sourceMappingURL=formatBytes.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/uploads/formatBytes.ts
|
|
2
|
+
const units = [
|
|
3
|
+
"B",
|
|
4
|
+
"KB",
|
|
5
|
+
"MB",
|
|
6
|
+
"GB"
|
|
7
|
+
];
|
|
8
|
+
/**
|
|
9
|
+
* Format a byte count as a human-readable size (1024-based, B/KB/MB/GB) with at most one decimal.
|
|
10
|
+
* Trailing `.0` is dropped: `2621440` -> `'2.5 MB'`, `1024` -> `'1 KB'`, `500` -> `'500 B'`.
|
|
11
|
+
*/
|
|
12
|
+
const formatBytes = (n) => {
|
|
13
|
+
if (!Number.isFinite(n) || n <= 0) return "0 B";
|
|
14
|
+
let value = n;
|
|
15
|
+
let unit = 0;
|
|
16
|
+
while (value >= 1024 && unit < units.length - 1) {
|
|
17
|
+
value /= 1024;
|
|
18
|
+
unit += 1;
|
|
19
|
+
}
|
|
20
|
+
return `${Math.round(value * 10) / 10} ${units[unit]}`;
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { formatBytes };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=formatBytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatBytes.js","names":[],"sources":["../../src/uploads/formatBytes.ts"],"sourcesContent":["const units = ['B', 'KB', 'MB', 'GB'] as const\n\n/**\n * Format a byte count as a human-readable size (1024-based, B/KB/MB/GB) with at most one decimal.\n * Trailing `.0` is dropped: `2621440` -> `'2.5 MB'`, `1024` -> `'1 KB'`, `500` -> `'500 B'`.\n */\nexport const formatBytes = (n: number): string => {\n\tif (!Number.isFinite(n) || n <= 0) {\n\t\treturn '0 B'\n\t}\n\tlet value = n\n\tlet unit = 0\n\twhile (value >= 1024 && unit < units.length - 1) {\n\t\tvalue /= 1024\n\t\tunit += 1\n\t}\n\treturn `${Math.round(value * 10) / 10} ${units[unit]}`\n}\n"],"mappings":";AAAA,MAAM,QAAQ;CAAC;CAAK;CAAM;CAAM;AAAI;;;;;AAMpC,MAAa,eAAe,MAAsB;CACjD,IAAI,CAAC,OAAO,SAAS,CAAC,KAAK,KAAK,GAC/B,OAAO;CAER,IAAI,QAAQ;CACZ,IAAI,OAAO;CACX,OAAO,SAAS,QAAQ,OAAO,MAAM,SAAS,GAAG;EAChD,SAAS;EACT,QAAQ;CACT;CACA,OAAO,GAAG,KAAK,MAAM,QAAQ,EAAE,IAAI,GAAG,GAAG,MAAM;AAChD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FileFieldConfig, FileRef, FileRefError } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/uploads/resolveFileRef.d.ts
|
|
4
|
+
type UploadDoc = {
|
|
5
|
+
id?: string | number;
|
|
6
|
+
filename?: unknown;
|
|
7
|
+
mimeType?: unknown;
|
|
8
|
+
filesize?: unknown;
|
|
9
|
+
url?: unknown;
|
|
10
|
+
};
|
|
11
|
+
type ResolveFileRefResult = {
|
|
12
|
+
ok: true;
|
|
13
|
+
ref: FileRef;
|
|
14
|
+
} | {
|
|
15
|
+
ok: false;
|
|
16
|
+
code: FileRefError;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Pure server trust-boundary check for an uploaded file: given the loaded upload doc (or null) and the
|
|
20
|
+
* field's constraints, either return an authoritative `FileRef` snapshot or a rejection code. Never trusts
|
|
21
|
+
* client metadata; the caller passes the doc it loaded from the upload collection.
|
|
22
|
+
*/
|
|
23
|
+
declare const resolveFileRef: (doc: UploadDoc | null | undefined, config: FileFieldConfig) => ResolveFileRefResult;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { ResolveFileRefResult, resolveFileRef };
|
|
26
|
+
//# sourceMappingURL=resolveFileRef.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region src/uploads/resolveFileRef.ts
|
|
2
|
+
/** Whether `mimeType` matches an `allow` list of exact strings or trailing-`*` prefix wildcards; empty allows all. */
|
|
3
|
+
const mimeAllowed = (mimeType, allow) => {
|
|
4
|
+
if (!allow || allow.length === 0) return true;
|
|
5
|
+
return allow.some((pattern) => {
|
|
6
|
+
if (pattern.endsWith("*")) return mimeType.startsWith(pattern.slice(0, -1));
|
|
7
|
+
return mimeType === pattern;
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Pure server trust-boundary check for an uploaded file: given the loaded upload doc (or null) and the
|
|
12
|
+
* field's constraints, either return an authoritative `FileRef` snapshot or a rejection code. Never trusts
|
|
13
|
+
* client metadata; the caller passes the doc it loaded from the upload collection.
|
|
14
|
+
*/
|
|
15
|
+
const resolveFileRef = (doc, config) => {
|
|
16
|
+
if (doc == null || doc.id == null) return {
|
|
17
|
+
ok: false,
|
|
18
|
+
code: "missing"
|
|
19
|
+
};
|
|
20
|
+
const mimeType = typeof doc.mimeType === "string" ? doc.mimeType : "";
|
|
21
|
+
const filesize = typeof doc.filesize === "number" ? doc.filesize : 0;
|
|
22
|
+
if (!mimeAllowed(mimeType, config.mimeTypes)) return {
|
|
23
|
+
ok: false,
|
|
24
|
+
code: "mimeType"
|
|
25
|
+
};
|
|
26
|
+
if (typeof config.maxSize === "number" && filesize > config.maxSize) return {
|
|
27
|
+
ok: false,
|
|
28
|
+
code: "tooLarge"
|
|
29
|
+
};
|
|
30
|
+
const ref = {
|
|
31
|
+
id: doc.id,
|
|
32
|
+
filename: typeof doc.filename === "string" ? doc.filename : "",
|
|
33
|
+
mimeType,
|
|
34
|
+
filesize
|
|
35
|
+
};
|
|
36
|
+
if (typeof doc.url === "string" && doc.url.length > 0) ref.url = doc.url;
|
|
37
|
+
return {
|
|
38
|
+
ok: true,
|
|
39
|
+
ref
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { mimeAllowed, resolveFileRef };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=resolveFileRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveFileRef.js","names":[],"sources":["../../src/uploads/resolveFileRef.ts"],"sourcesContent":["import type { FileFieldConfig, FileRef, FileRefError } from './types'\n\ntype UploadDoc = {\n\tid?: string | number\n\tfilename?: unknown\n\tmimeType?: unknown\n\tfilesize?: unknown\n\turl?: unknown\n}\n\nexport type ResolveFileRefResult = { ok: true; ref: FileRef } | { ok: false; code: FileRefError }\n\n/** Whether `mimeType` matches an `allow` list of exact strings or trailing-`*` prefix wildcards; empty allows all. */\nexport const mimeAllowed = (mimeType: string, allow: string[] | undefined): boolean => {\n\tif (!allow || allow.length === 0) {\n\t\treturn true\n\t}\n\treturn allow.some((pattern) => {\n\t\tif (pattern.endsWith('*')) {\n\t\t\treturn mimeType.startsWith(pattern.slice(0, -1))\n\t\t}\n\t\treturn mimeType === pattern\n\t})\n}\n\n/**\n * Pure server trust-boundary check for an uploaded file: given the loaded upload doc (or null) and the\n * field's constraints, either return an authoritative `FileRef` snapshot or a rejection code. Never trusts\n * client metadata; the caller passes the doc it loaded from the upload collection.\n */\nexport const resolveFileRef = (\n\tdoc: UploadDoc | null | undefined,\n\tconfig: FileFieldConfig\n): ResolveFileRefResult => {\n\tif (doc == null || doc.id == null) {\n\t\treturn { ok: false, code: 'missing' }\n\t}\n\tconst mimeType = typeof doc.mimeType === 'string' ? doc.mimeType : ''\n\tconst filesize = typeof doc.filesize === 'number' ? doc.filesize : 0\n\tif (!mimeAllowed(mimeType, config.mimeTypes)) {\n\t\treturn { ok: false, code: 'mimeType' }\n\t}\n\tif (typeof config.maxSize === 'number' && filesize > config.maxSize) {\n\t\treturn { ok: false, code: 'tooLarge' }\n\t}\n\tconst ref: FileRef = {\n\t\tid: doc.id,\n\t\tfilename: typeof doc.filename === 'string' ? doc.filename : '',\n\t\tmimeType,\n\t\tfilesize,\n\t}\n\tif (typeof doc.url === 'string' && doc.url.length > 0) {\n\t\tref.url = doc.url\n\t}\n\treturn { ok: true, ref }\n}\n"],"mappings":";;AAaA,MAAa,eAAe,UAAkB,UAAyC;CACtF,IAAI,CAAC,SAAS,MAAM,WAAW,GAC9B,OAAO;CAER,OAAO,MAAM,MAAM,YAAY;EAC9B,IAAI,QAAQ,SAAS,GAAG,GACvB,OAAO,SAAS,WAAW,QAAQ,MAAM,GAAG,EAAE,CAAC;EAEhD,OAAO,aAAa;CACrB,CAAC;AACF;;;;;;AAOA,MAAa,kBACZ,KACA,WAC0B;CAC1B,IAAI,OAAO,QAAQ,IAAI,MAAM,MAC5B,OAAO;EAAE,IAAI;EAAO,MAAM;CAAU;CAErC,MAAM,WAAW,OAAO,IAAI,aAAa,WAAW,IAAI,WAAW;CACnE,MAAM,WAAW,OAAO,IAAI,aAAa,WAAW,IAAI,WAAW;CACnE,IAAI,CAAC,YAAY,UAAU,OAAO,SAAS,GAC1C,OAAO;EAAE,IAAI;EAAO,MAAM;CAAW;CAEtC,IAAI,OAAO,OAAO,YAAY,YAAY,WAAW,OAAO,SAC3D,OAAO;EAAE,IAAI;EAAO,MAAM;CAAW;CAEtC,MAAM,MAAe;EACpB,IAAI,IAAI;EACR,UAAU,OAAO,IAAI,aAAa,WAAW,IAAI,WAAW;EAC5D;EACA;CACD;CACA,IAAI,OAAO,IAAI,QAAQ,YAAY,IAAI,IAAI,SAAS,GACnD,IAAI,MAAM,IAAI;CAEf,OAAO;EAAE,IAAI;EAAM;CAAI;AACxB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/uploads/types.d.ts
|
|
2
|
+
/** A self-describing reference to an uploaded file, captured server-side and stored as the field's value. */
|
|
3
|
+
type FileRef = {
|
|
4
|
+
id: string | number;
|
|
5
|
+
filename: string;
|
|
6
|
+
mimeType: string;
|
|
7
|
+
filesize: number;
|
|
8
|
+
url?: string;
|
|
9
|
+
};
|
|
10
|
+
/** Per-field file constraints, authored in the field config. */
|
|
11
|
+
type FileFieldConfig = {
|
|
12
|
+
/** Allowed MIME types (exact match or a `type/*` wildcard). Empty/absent allows any. */mimeTypes?: string[]; /** Maximum file size in bytes. Absent allows any size (subject to the collection limit). */
|
|
13
|
+
maxSize?: number;
|
|
14
|
+
};
|
|
15
|
+
/** Why a file reference was rejected at the server trust boundary. */
|
|
16
|
+
type FileRefError = 'missing' | 'mimeType' | 'tooLarge';
|
|
17
|
+
//#endregion
|
|
18
|
+
export { FileFieldConfig, FileRef, FileRefError };
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { keys } from "../translations/keys.js";
|
|
2
|
+
import { labelFor } from "../translations/server.js";
|
|
3
|
+
//#region src/validation/buildRuleBlocks.ts
|
|
4
|
+
const RULE_DESCRIPTION_REF = "@10x-media/form-builder/client#RuleDescription";
|
|
5
|
+
/** Each rule block appends its own `message` field, so a rule param of that name would collide and be silently dropped by Payload. */
|
|
6
|
+
const RESERVED_PARAM_NAMES = new Set(["message"]);
|
|
7
|
+
/**
|
|
8
|
+
* One block per rule applicable to `fieldType` (gated by `appliesTo`): a leading plain-language
|
|
9
|
+
* description (when the rule sets one), the rule params, then a message override. The description is
|
|
10
|
+
* a `ui` field mounting `RuleDescription`, because Payload `Block`s have no native description slot.
|
|
11
|
+
*/
|
|
12
|
+
const buildRuleBlocks = (registry, fieldType) => {
|
|
13
|
+
const blocks = [];
|
|
14
|
+
for (const rule of registry.values()) {
|
|
15
|
+
if (rule.appliesTo && !rule.appliesTo.includes(fieldType)) continue;
|
|
16
|
+
for (const param of rule.params ?? []) if ("name" in param && RESERVED_PARAM_NAMES.has(param.name)) throw new Error(`form-builder: validation rule "${rule.type}" declares a reserved param name "${param.name}". The name "message" is reserved for the constraint-list UI.`);
|
|
17
|
+
const descriptionField = rule.description ? [{
|
|
18
|
+
name: `${rule.type}Description`,
|
|
19
|
+
type: "ui",
|
|
20
|
+
admin: { components: { Field: {
|
|
21
|
+
path: RULE_DESCRIPTION_REF,
|
|
22
|
+
clientProps: { descriptionKey: rule.description }
|
|
23
|
+
} } }
|
|
24
|
+
}] : [];
|
|
25
|
+
blocks.push({
|
|
26
|
+
slug: rule.type,
|
|
27
|
+
labels: {
|
|
28
|
+
singular: labelFor(rule.label),
|
|
29
|
+
plural: labelFor(rule.label)
|
|
30
|
+
},
|
|
31
|
+
fields: [
|
|
32
|
+
...descriptionField,
|
|
33
|
+
...rule.params ?? [],
|
|
34
|
+
{
|
|
35
|
+
name: "message",
|
|
36
|
+
type: "text",
|
|
37
|
+
label: labelFor(keys.validationMessageLabel)
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return blocks;
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { buildRuleBlocks };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=buildRuleBlocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildRuleBlocks.js","names":[],"sources":["../../src/validation/buildRuleBlocks.ts"],"sourcesContent":["import type { Block, Field } from 'payload'\nimport { keys } from '../translations/keys'\nimport { labelFor } from '../translations/server'\nimport type { ValidationRuleRegistry } from './registry'\n\nconst RULE_DESCRIPTION_REF = '@10x-media/form-builder/client#RuleDescription'\n\n/** Each rule block appends its own `message` field, so a rule param of that name would collide and be silently dropped by Payload. */\nconst RESERVED_PARAM_NAMES = new Set(['message'])\n\n/**\n * One block per rule applicable to `fieldType` (gated by `appliesTo`): a leading plain-language\n * description (when the rule sets one), the rule params, then a message override. The description is\n * a `ui` field mounting `RuleDescription`, because Payload `Block`s have no native description slot.\n */\nexport const buildRuleBlocks = (registry: ValidationRuleRegistry, fieldType: string): Block[] => {\n\tconst blocks: Block[] = []\n\tfor (const rule of registry.values()) {\n\t\tif (rule.appliesTo && !rule.appliesTo.includes(fieldType)) {\n\t\t\tcontinue\n\t\t}\n\t\tfor (const param of rule.params ?? []) {\n\t\t\tif ('name' in param && RESERVED_PARAM_NAMES.has(param.name)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`form-builder: validation rule \"${rule.type}\" declares a reserved param name \"${param.name}\". The name \"message\" is reserved for the constraint-list UI.`\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tconst descriptionField: Field[] = rule.description\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: `${rule.type}Description`,\n\t\t\t\t\t\ttype: 'ui',\n\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\tcomponents: {\n\t\t\t\t\t\t\t\tField: {\n\t\t\t\t\t\t\t\t\tpath: RULE_DESCRIPTION_REF,\n\t\t\t\t\t\t\t\t\tclientProps: { descriptionKey: rule.description },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []\n\t\tblocks.push({\n\t\t\tslug: rule.type,\n\t\t\tlabels: { singular: labelFor(rule.label), plural: labelFor(rule.label) },\n\t\t\tfields: [\n\t\t\t\t...descriptionField,\n\t\t\t\t...(rule.params ?? []),\n\t\t\t\t{ name: 'message', type: 'text', label: labelFor(keys.validationMessageLabel) },\n\t\t\t],\n\t\t})\n\t}\n\treturn blocks\n}\n"],"mappings":";;;AAKA,MAAM,uBAAuB;;AAG7B,MAAM,uBAAuB,IAAI,IAAI,CAAC,SAAS,CAAC;;;;;;AAOhD,MAAa,mBAAmB,UAAkC,cAA+B;CAChG,MAAM,SAAkB,CAAC;CACzB,KAAK,MAAM,QAAQ,SAAS,OAAO,GAAG;EACrC,IAAI,KAAK,aAAa,CAAC,KAAK,UAAU,SAAS,SAAS,GACvD;EAED,KAAK,MAAM,SAAS,KAAK,UAAU,CAAC,GACnC,IAAI,UAAU,SAAS,qBAAqB,IAAI,MAAM,IAAI,GACzD,MAAM,IAAI,MACT,kCAAkC,KAAK,KAAK,oCAAoC,MAAM,KAAK,8DAC5F;EAGF,MAAM,mBAA4B,KAAK,cACpC,CACA;GACC,MAAM,GAAG,KAAK,KAAK;GACnB,MAAM;GACN,OAAO,EACN,YAAY,EACX,OAAO;IACN,MAAM;IACN,aAAa,EAAE,gBAAgB,KAAK,YAAY;GACjD,EACD,EACD;EACD,CACD,IACC,CAAC;EACJ,OAAO,KAAK;GACX,MAAM,KAAK;GACX,QAAQ;IAAE,UAAU,SAAS,KAAK,KAAK;IAAG,QAAQ,SAAS,KAAK,KAAK;GAAE;GACvE,QAAQ;IACP,GAAG;IACH,GAAI,KAAK,UAAU,CAAC;IACpB;KAAE,MAAM;KAAW,MAAM;KAAQ,OAAO,SAAS,KAAK,sBAAsB;IAAE;GAC/E;EACD,CAAC;CACF;CACA,OAAO;AACR"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { keys } from "../../translations/keys.js";
|
|
2
|
+
import { EMAIL_PATTERN } from "../emailPattern.js";
|
|
3
|
+
import { defineValidationRule } from "../defineValidationRule.js";
|
|
4
|
+
//#region src/validation/builtin/email.ts
|
|
5
|
+
const emailRule = defineValidationRule({
|
|
6
|
+
type: "email",
|
|
7
|
+
label: keys.ruleEmail,
|
|
8
|
+
description: keys.ruleEmailDescription,
|
|
9
|
+
appliesTo: [
|
|
10
|
+
"text",
|
|
11
|
+
"textarea",
|
|
12
|
+
"email"
|
|
13
|
+
],
|
|
14
|
+
defaultMessage: keys.ruleEmailMessage,
|
|
15
|
+
validate: ({ value, message }) => value == null || value === "" || EMAIL_PATTERN.test(value) ? true : message()
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { emailRule };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=email.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.js","names":[],"sources":["../../../src/validation/builtin/email.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { defineValidationRule } from '../defineValidationRule'\nimport { EMAIL_PATTERN } from '../emailPattern'\n\nexport const emailRule = defineValidationRule<Record<string, never>, string>({\n\ttype: 'email',\n\tlabel: keys.ruleEmail,\n\tdescription: keys.ruleEmailDescription,\n\tappliesTo: ['text', 'textarea', 'email'],\n\tdefaultMessage: keys.ruleEmailMessage,\n\tvalidate: ({ value, message }) =>\n\t\tvalue == null || value === '' || EMAIL_PATTERN.test(value) ? true : message(),\n})\n"],"mappings":";;;;AAIA,MAAa,YAAY,qBAAoD;CAC5E,MAAM;CACN,OAAO,KAAK;CACZ,aAAa,KAAK;CAClB,WAAW;EAAC;EAAQ;EAAY;CAAO;CACvC,gBAAgB,KAAK;CACrB,WAAW,EAAE,OAAO,cACnB,SAAS,QAAQ,UAAU,MAAM,cAAc,KAAK,KAAK,IAAI,OAAO,QAAQ;AAC9E,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AnyValidationRuleDefinition } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/validation/builtin/index.d.ts
|
|
4
|
+
declare const defaultValidationRules: AnyValidationRuleDefinition[];
|
|
5
|
+
/**
|
|
6
|
+
* `defaultValidationRules` indexed by `type`, so a single built-in can be spread and tweaked
|
|
7
|
+
* without hand-rolling a `.find()`, e.g.
|
|
8
|
+
* `rules: { minLength: { ...defaultValidationRulesByType.minLength, message: myMessage } }`. The
|
|
9
|
+
* `rules` plugin option replaces a built-in of the same `type`; `false` removes it, `true` keeps it.
|
|
10
|
+
*/
|
|
11
|
+
declare const defaultValidationRulesByType: Record<string, AnyValidationRuleDefinition>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { defaultValidationRules, defaultValidationRulesByType };
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { emailRule } from "./email.js";
|
|
2
|
+
import { matchesFieldRule } from "./matchesField.js";
|
|
3
|
+
import { maxRule } from "./max.js";
|
|
4
|
+
import { maxDateRule } from "./maxDate.js";
|
|
5
|
+
import { maxLengthRule } from "./maxLength.js";
|
|
6
|
+
import { minRule } from "./min.js";
|
|
7
|
+
import { minDateRule } from "./minDate.js";
|
|
8
|
+
import { minLengthRule } from "./minLength.js";
|
|
9
|
+
import { notAlreadySubmittedRule } from "./notAlreadySubmitted.js";
|
|
10
|
+
import { oneOfRule } from "./oneOf.js";
|
|
11
|
+
import { patternRule } from "./pattern.js";
|
|
12
|
+
import { urlRule } from "./url.js";
|
|
13
|
+
//#region src/validation/builtin/index.ts
|
|
14
|
+
const defaultValidationRules = [
|
|
15
|
+
minLengthRule,
|
|
16
|
+
maxLengthRule,
|
|
17
|
+
minRule,
|
|
18
|
+
maxRule,
|
|
19
|
+
minDateRule,
|
|
20
|
+
maxDateRule,
|
|
21
|
+
patternRule,
|
|
22
|
+
emailRule,
|
|
23
|
+
urlRule,
|
|
24
|
+
oneOfRule,
|
|
25
|
+
matchesFieldRule,
|
|
26
|
+
notAlreadySubmittedRule
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* `defaultValidationRules` indexed by `type`, so a single built-in can be spread and tweaked
|
|
30
|
+
* without hand-rolling a `.find()`, e.g.
|
|
31
|
+
* `rules: { minLength: { ...defaultValidationRulesByType.minLength, message: myMessage } }`. The
|
|
32
|
+
* `rules` plugin option replaces a built-in of the same `type`; `false` removes it, `true` keeps it.
|
|
33
|
+
*/
|
|
34
|
+
const defaultValidationRulesByType = Object.fromEntries(defaultValidationRules.map((rule) => [rule.type, rule]));
|
|
35
|
+
//#endregion
|
|
36
|
+
export { defaultValidationRules, defaultValidationRulesByType };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/validation/builtin/index.ts"],"sourcesContent":["import type { AnyValidationRuleDefinition } from '../types'\nimport { emailRule } from './email'\nimport { matchesFieldRule } from './matchesField'\nimport { maxRule } from './max'\nimport { maxDateRule } from './maxDate'\nimport { maxLengthRule } from './maxLength'\nimport { minRule } from './min'\nimport { minDateRule } from './minDate'\nimport { minLengthRule } from './minLength'\nimport { notAlreadySubmittedRule } from './notAlreadySubmitted'\nimport { oneOfRule } from './oneOf'\nimport { patternRule } from './pattern'\nimport { urlRule } from './url'\n\n// Rules are authored with precise param/value generics; the registry stores them erased (params\n// re-narrow per matched rule at execution). One cast per rule, no `any`.\nexport const defaultValidationRules: AnyValidationRuleDefinition[] = [\n\tminLengthRule as AnyValidationRuleDefinition,\n\tmaxLengthRule as AnyValidationRuleDefinition,\n\tminRule as AnyValidationRuleDefinition,\n\tmaxRule as AnyValidationRuleDefinition,\n\tminDateRule as AnyValidationRuleDefinition,\n\tmaxDateRule as AnyValidationRuleDefinition,\n\tpatternRule as AnyValidationRuleDefinition,\n\temailRule as AnyValidationRuleDefinition,\n\turlRule as AnyValidationRuleDefinition,\n\toneOfRule as AnyValidationRuleDefinition,\n\tmatchesFieldRule as AnyValidationRuleDefinition,\n\tnotAlreadySubmittedRule as AnyValidationRuleDefinition,\n]\n\n/**\n * `defaultValidationRules` indexed by `type`, so a single built-in can be spread and tweaked\n * without hand-rolling a `.find()`, e.g.\n * `rules: { minLength: { ...defaultValidationRulesByType.minLength, message: myMessage } }`. The\n * `rules` plugin option replaces a built-in of the same `type`; `false` removes it, `true` keeps it.\n */\nexport const defaultValidationRulesByType: Record<string, AnyValidationRuleDefinition> =\n\tObject.fromEntries(defaultValidationRules.map((rule) => [rule.type, rule]))\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAa,yBAAwD;CACpE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;;;;;;AAQA,MAAa,+BACZ,OAAO,YAAY,uBAAuB,KAAK,SAAS,CAAC,KAAK,MAAM,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { keys } from "../../translations/keys.js";
|
|
2
|
+
import { defineValidationRule } from "../defineValidationRule.js";
|
|
3
|
+
import { fieldTargetParam } from "../fieldTargetParam.js";
|
|
4
|
+
//#region src/validation/builtin/matchesField.ts
|
|
5
|
+
const matchesFieldRule = defineValidationRule({
|
|
6
|
+
type: "matchesField",
|
|
7
|
+
label: keys.ruleMatchesField,
|
|
8
|
+
description: keys.ruleMatchesFieldDescription,
|
|
9
|
+
params: [fieldTargetParam("field")],
|
|
10
|
+
defaultMessage: keys.ruleMatchesFieldMessage,
|
|
11
|
+
validate: ({ value, params, siblingData, message }) => value === siblingData[params.field] ? true : message()
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { matchesFieldRule };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=matchesField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matchesField.js","names":[],"sources":["../../../src/validation/builtin/matchesField.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { defineValidationRule } from '../defineValidationRule'\nimport { fieldTargetParam } from '../fieldTargetParam'\n\nexport const matchesFieldRule = defineValidationRule<{ field: string }, unknown>({\n\ttype: 'matchesField',\n\tlabel: keys.ruleMatchesField,\n\tdescription: keys.ruleMatchesFieldDescription,\n\tparams: [fieldTargetParam('field')],\n\tdefaultMessage: keys.ruleMatchesFieldMessage,\n\tvalidate: ({ value, params, siblingData, message }) =>\n\t\tvalue === siblingData[params.field] ? true : message(),\n})\n"],"mappings":";;;;AAIA,MAAa,mBAAmB,qBAAiD;CAChF,MAAM;CACN,OAAO,KAAK;CACZ,aAAa,KAAK;CAClB,QAAQ,CAAC,iBAAiB,OAAO,CAAC;CAClC,gBAAgB,KAAK;CACrB,WAAW,EAAE,OAAO,QAAQ,aAAa,cACxC,UAAU,YAAY,OAAO,SAAS,OAAO,QAAQ;AACvD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { keys } from "../../translations/keys.js";
|
|
2
|
+
import { labelFor } from "../../translations/server.js";
|
|
3
|
+
import { defineValidationRule } from "../defineValidationRule.js";
|
|
4
|
+
//#region src/validation/builtin/max.ts
|
|
5
|
+
const maxRule = defineValidationRule({
|
|
6
|
+
type: "max",
|
|
7
|
+
label: keys.ruleMax,
|
|
8
|
+
description: keys.ruleMaxDescription,
|
|
9
|
+
appliesTo: ["number"],
|
|
10
|
+
params: [{
|
|
11
|
+
name: "max",
|
|
12
|
+
type: "number",
|
|
13
|
+
required: true,
|
|
14
|
+
label: labelFor(keys.ruleParamMax)
|
|
15
|
+
}],
|
|
16
|
+
defaultMessage: keys.ruleMaxMessage,
|
|
17
|
+
validate: ({ value, params, message }) => value == null || value <= params.max ? true : message({ max: params.max })
|
|
18
|
+
});
|
|
19
|
+
//#endregion
|
|
20
|
+
export { maxRule };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=max.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"max.js","names":[],"sources":["../../../src/validation/builtin/max.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineValidationRule } from '../defineValidationRule'\n\nexport const maxRule = defineValidationRule<{ max: number }, number>({\n\ttype: 'max',\n\tlabel: keys.ruleMax,\n\tdescription: keys.ruleMaxDescription,\n\tappliesTo: ['number'],\n\tparams: [{ name: 'max', type: 'number', required: true, label: labelFor(keys.ruleParamMax) }],\n\tdefaultMessage: keys.ruleMaxMessage,\n\tvalidate: ({ value, params, message }) =>\n\t\tvalue == null || value <= params.max ? true : message({ max: params.max }),\n})\n"],"mappings":";;;;AAIA,MAAa,UAAU,qBAA8C;CACpE,MAAM;CACN,OAAO,KAAK;CACZ,aAAa,KAAK;CAClB,WAAW,CAAC,QAAQ;CACpB,QAAQ,CAAC;EAAE,MAAM;EAAO,MAAM;EAAU,UAAU;EAAM,OAAO,SAAS,KAAK,YAAY;CAAE,CAAC;CAC5F,gBAAgB,KAAK;CACrB,WAAW,EAAE,OAAO,QAAQ,cAC3B,SAAS,QAAQ,SAAS,OAAO,MAAM,OAAO,QAAQ,EAAE,KAAK,OAAO,IAAI,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { keys } from "../../translations/keys.js";
|
|
2
|
+
import { labelFor } from "../../translations/server.js";
|
|
3
|
+
import { defineValidationRule } from "../defineValidationRule.js";
|
|
4
|
+
import { validateDateBound } from "./validateDateBound.js";
|
|
5
|
+
//#region src/validation/builtin/maxDate.ts
|
|
6
|
+
const maxDateRule = defineValidationRule({
|
|
7
|
+
type: "maxDate",
|
|
8
|
+
label: keys.ruleMaxDate,
|
|
9
|
+
description: keys.ruleMaxDateDescription,
|
|
10
|
+
appliesTo: ["date"],
|
|
11
|
+
params: [{
|
|
12
|
+
name: "max",
|
|
13
|
+
type: "text",
|
|
14
|
+
required: true,
|
|
15
|
+
label: labelFor(keys.ruleParamMaxDate),
|
|
16
|
+
validate: validateDateBound
|
|
17
|
+
}],
|
|
18
|
+
defaultMessage: keys.ruleMaxDateMessage,
|
|
19
|
+
validate: ({ value, params, message }) => value == null || value === "" || value <= params.max ? true : message({ max: params.max })
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
export { maxDateRule };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=maxDate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maxDate.js","names":[],"sources":["../../../src/validation/builtin/maxDate.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineValidationRule } from '../defineValidationRule'\nimport { validateDateBound } from './validateDateBound'\n\nexport const maxDateRule = defineValidationRule<{ max: string }, string>({\n\ttype: 'maxDate',\n\tlabel: keys.ruleMaxDate,\n\tdescription: keys.ruleMaxDateDescription,\n\tappliesTo: ['date'],\n\tparams: [\n\t\t{\n\t\t\tname: 'max',\n\t\t\ttype: 'text',\n\t\t\trequired: true,\n\t\t\tlabel: labelFor(keys.ruleParamMaxDate),\n\t\t\tvalidate: validateDateBound,\n\t\t},\n\t],\n\tdefaultMessage: keys.ruleMaxDateMessage,\n\tvalidate: ({ value, params, message }) =>\n\t\tvalue == null || value === '' || value <= params.max ? true : message({ max: params.max }),\n})\n"],"mappings":";;;;;AAKA,MAAa,cAAc,qBAA8C;CACxE,MAAM;CACN,OAAO,KAAK;CACZ,aAAa,KAAK;CAClB,WAAW,CAAC,MAAM;CAClB,QAAQ,CACP;EACC,MAAM;EACN,MAAM;EACN,UAAU;EACV,OAAO,SAAS,KAAK,gBAAgB;EACrC,UAAU;CACX,CACD;CACA,gBAAgB,KAAK;CACrB,WAAW,EAAE,OAAO,QAAQ,cAC3B,SAAS,QAAQ,UAAU,MAAM,SAAS,OAAO,MAAM,OAAO,QAAQ,EAAE,KAAK,OAAO,IAAI,CAAC;AAC3F,CAAC"}
|