@10x-media/form-builder 0.1.0-beta.1 → 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 +293 -0
- package/README.md +6 -4
- 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 +12 -9
- package/dist/actions/buildActionBlocks.js.map +1 -1
- package/dist/actions/builtin/confirmation.js +46 -43
- package/dist/actions/builtin/confirmation.js.map +1 -1
- 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 +14 -38
- package/dist/actions/builtin/emailTeam.js.map +1 -1
- package/dist/actions/builtin/index.d.ts +16 -1
- package/dist/actions/builtin/index.js +21 -7
- package/dist/actions/builtin/index.js.map +1 -1
- package/dist/actions/builtin/signedWebhook.js +6 -2
- package/dist/actions/builtin/signedWebhook.js.map +1 -1
- package/dist/actions/defineAction.d.ts +5 -4
- package/dist/actions/defineAction.js.map +1 -1
- package/dist/actions/dispatch.js +2 -1
- package/dist/actions/dispatch.js.map +1 -1
- 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 +2 -1
- package/dist/actions/registry.js +2 -6
- package/dist/actions/registry.js.map +1 -1
- package/dist/actions/runActions.js +10 -1
- package/dist/actions/runActions.js.map +1 -1
- package/dist/actions/task.js +20 -15
- package/dist/actions/task.js.map +1 -1
- package/dist/aggregation/aggregateResponses.d.ts +9 -0
- package/dist/aggregation/aggregateResponses.js +8 -14
- package/dist/aggregation/aggregateResponses.js.map +1 -1
- package/dist/aggregation/resolveResultsRequest.d.ts +35 -6
- package/dist/aggregation/resolveResultsRequest.js +68 -11
- package/dist/aggregation/resolveResultsRequest.js.map +1 -1
- package/dist/calc/computeCalcFields.js +2 -1
- package/dist/calc/computeCalcFields.js.map +1 -1
- package/dist/calc/evaluate.js +1 -2
- package/dist/calc/evaluate.js.map +1 -1
- package/dist/calc/normalizeCalc.js +6 -19
- package/dist/calc/normalizeCalc.js.map +1 -1
- package/dist/calc/types.d.ts +8 -2
- 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 +2 -1
- package/dist/client/ConditionBuilder.js.map +1 -1
- 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 +2 -2
- package/dist/client/FlowBuilder.js +137 -88
- package/dist/client/FlowBuilder.js.map +1 -1
- package/dist/client/FormConditionField.js +1 -4
- package/dist/client/FormConditionField.js.map +1 -1
- 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 +21 -10
- package/dist/client/synthesizeClientField.js.map +1 -1
- 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 +108 -42
- package/dist/collections/formSubmissions.js.map +1 -1
- package/dist/collections/forms.js +409 -114
- package/dist/collections/forms.js.map +1 -1
- 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 +9 -2
- package/dist/conditions/conditionType.js.map +1 -1
- package/dist/conditions/evaluate.js +1 -1
- package/dist/conditions/evaluate.js.map +1 -1
- package/dist/conditions/fieldTypes.d.ts +3 -1
- package/dist/conditions/fieldTypes.js +4 -1
- package/dist/conditions/fieldTypes.js.map +1 -1
- package/dist/conditions/normalizeConditions.js +20 -6
- package/dist/conditions/normalizeConditions.js.map +1 -1
- 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 +38 -11
- package/dist/consent/captureConsent.js +60 -13
- package/dist/consent/captureConsent.js.map +1 -1
- 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 +17 -11
- package/dist/consent/resolvePublishedVersionRef.js +13 -10
- package/dist/consent/resolvePublishedVersionRef.js.map +1 -1
- 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/exports/client.d.ts +13 -1
- package/dist/exports/client.js +13 -1
- package/dist/exports/i18n.d.ts +5 -2
- package/dist/exports/i18n.js +5 -2
- package/dist/exports/react.d.ts +26 -8
- package/dist/exports/react.js +19 -3
- package/dist/exports/rsc.d.ts +8 -1
- package/dist/exports/rsc.js +8 -1
- package/dist/exports/types.d.ts +19 -10
- package/dist/fields/buildFieldBlocks.js +53 -19
- package/dist/fields/buildFieldBlocks.js.map +1 -1
- package/dist/fields/builtin/calculation.js +122 -2
- package/dist/fields/builtin/calculation.js.map +1 -1
- package/dist/fields/builtin/checkbox.js +8 -0
- package/dist/fields/builtin/checkbox.js.map +1 -1
- package/dist/fields/builtin/consent.js +30 -15
- package/dist/fields/builtin/consent.js.map +1 -1
- 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 +1 -1
- package/dist/fields/builtin/email.js.map +1 -1
- package/dist/fields/builtin/file.d.ts +15 -0
- package/dist/fields/builtin/file.js +95 -8
- package/dist/fields/builtin/file.js.map +1 -1
- package/dist/fields/builtin/index.d.ts +26 -0
- package/dist/fields/builtin/index.js +30 -6
- package/dist/fields/builtin/index.js.map +1 -1
- package/dist/fields/builtin/message.js +30 -0
- package/dist/fields/builtin/message.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 +8 -3
- package/dist/fields/builtin/select.js.map +1 -1
- 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/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/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 +3 -1
- package/dist/fields/registry.js +23 -8
- package/dist/fields/registry.js.map +1 -1
- package/dist/fields/sharedConfig.js +120 -58
- package/dist/fields/sharedConfig.js.map +1 -1
- package/dist/fields/types.d.ts +71 -7
- package/dist/flow/engine.d.ts +6 -4
- package/dist/flow/engine.js +11 -6
- package/dist/flow/engine.js.map +1 -1
- package/dist/flow/normalizeFlow.js +28 -9
- package/dist/flow/normalizeFlow.js.map +1 -1
- package/dist/flow/stepLabel.js +15 -0
- package/dist/flow/stepLabel.js.map +1 -0
- package/dist/flow/types.d.ts +12 -3
- 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 +53 -39
- package/dist/index.js +85 -23
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +229 -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 +40 -20
- package/dist/plugin/registerCollections.js.map +1 -1
- 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.js +5 -9
- package/dist/prefill/valuesFromSearchParams.js.map +1 -1
- package/dist/presentations/types.d.ts +3 -2
- package/dist/react/Form.d.ts +66 -19
- package/dist/react/Form.js +342 -180
- package/dist/react/Form.js.map +1 -1
- package/dist/react/FormContext.d.ts +44 -1
- package/dist/react/FormContext.js.map +1 -1
- 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 +4 -2
- package/dist/react/FormLayout.js +3 -2
- package/dist/react/FormLayout.js.map +1 -1
- package/dist/react/FormResults.d.ts +6 -3
- package/dist/react/FormResults.js +37 -29
- package/dist/react/FormResults.js.map +1 -1
- 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/Poll.d.ts +17 -6
- package/dist/react/Poll.js +79 -21
- package/dist/react/Poll.js.map +1 -1
- 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/contract.d.ts +2 -3
- package/dist/react/contract.js.map +1 -1
- package/dist/react/fetchResults.d.ts +1 -1
- package/dist/react/fetchResults.js +1 -1
- package/dist/react/fetchResults.js.map +1 -1
- package/dist/react/presentation/DialogSurface.js +1 -4
- package/dist/react/presentation/DialogSurface.js.map +1 -1
- package/dist/react/primitives/Checkbox.d.ts +4 -2
- package/dist/react/primitives/Checkbox.js +2 -1
- package/dist/react/primitives/Checkbox.js.map +1 -1
- package/dist/react/primitives/FieldShell.d.ts +2 -4
- package/dist/react/primitives/FieldShell.js +12 -19
- package/dist/react/primitives/FieldShell.js.map +1 -1
- package/dist/react/primitives/Input.d.ts +1 -1
- package/dist/react/primitives/Input.js.map +1 -1
- package/dist/react/renderers/calculation.js +1 -4
- package/dist/react/renderers/calculation.js.map +1 -1
- package/dist/react/renderers/checkbox.js +1 -4
- package/dist/react/renderers/checkbox.js.map +1 -1
- package/dist/react/renderers/consent.js +78 -35
- package/dist/react/renderers/consent.js.map +1 -1
- package/dist/react/renderers/date.js +33 -0
- package/dist/react/renderers/date.js.map +1 -0
- package/dist/react/renderers/email.js +1 -4
- package/dist/react/renderers/email.js.map +1 -1
- package/dist/react/renderers/file.js +29 -14
- package/dist/react/renderers/file.js.map +1 -1
- package/dist/react/renderers/index.js +9 -0
- package/dist/react/renderers/index.js.map +1 -1
- package/dist/react/renderers/message.js +41 -0
- package/dist/react/renderers/message.js.map +1 -0
- package/dist/react/renderers/number.js +1 -4
- package/dist/react/renderers/number.js.map +1 -1
- 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 +1 -4
- package/dist/react/renderers/select.js.map +1 -1
- package/dist/react/renderers/text.js +1 -4
- package/dist/react/renderers/text.js.map +1 -1
- package/dist/react/renderers/textarea.js +1 -4
- package/dist/react/renderers/textarea.js.map +1 -1
- package/dist/react/state.d.ts +40 -3
- package/dist/react/state.js +64 -9
- package/dist/react/state.js.map +1 -1
- package/dist/react/uploadFile.d.ts +2 -2
- package/dist/react/uploadFile.js +1 -1
- package/dist/react/uploadFile.js.map +1 -1
- package/dist/react/useField.d.ts +0 -1
- package/dist/react/useField.js +6 -6
- package/dist/react/useField.js.map +1 -1
- package/dist/react/useFormState.d.ts +1 -1
- package/dist/react/useFormState.js +1 -1
- package/dist/react/useFormState.js.map +1 -1
- package/dist/react/validateField.js +3 -6
- package/dist/react/validateField.js.map +1 -1
- package/dist/recall/interpolate.d.ts +4 -3
- package/dist/recall/interpolate.js +5 -4
- package/dist/recall/interpolate.js.map +1 -1
- package/dist/recall/resolver.d.ts +1 -1
- package/dist/recall/resolver.js +14 -2
- package/dist/recall/resolver.js.map +1 -1
- package/dist/spam/captcha.d.ts +4 -3
- package/dist/spam/captcha.js +4 -3
- package/dist/spam/captcha.js.map +1 -1
- package/dist/spam/clientIp.js +9 -0
- package/dist/spam/clientIp.js.map +1 -0
- package/dist/spam/constants.js +7 -1
- package/dist/spam/constants.js.map +1 -1
- package/dist/spam/identify.js +3 -6
- package/dist/spam/identify.js.map +1 -1
- 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/resolveSpam.js +2 -1
- package/dist/spam/resolveSpam.js.map +1 -1
- package/dist/spam/spamGuard.js +23 -10
- package/dist/spam/spamGuard.js.map +1 -1
- package/dist/spam/types.d.ts +19 -4
- package/dist/submissions/SubmissionAnswers.d.ts +2 -4
- package/dist/submissions/SubmissionAnswers.js +114 -34
- package/dist/submissions/SubmissionAnswers.js.map +1 -1
- 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 +128 -27
- package/dist/submissions/runSubmission.js.map +1 -1
- package/dist/submissions/types.d.ts +12 -4
- package/dist/submissions/validateSubmission.js +62 -11
- package/dist/submissions/validateSubmission.js.map +1 -1
- 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.js +203 -27
- package/dist/translations/en.js.map +1 -1
- package/dist/translations/index.d.ts +14 -5
- package/dist/translations/index.js +14 -3
- package/dist/translations/index.js.map +1 -1
- package/dist/translations/keys.d.ts +199 -23
- package/dist/translations/keys.js +200 -24
- package/dist/translations/keys.js.map +1 -1
- package/dist/translations/makeTranslate.d.ts +7 -3
- package/dist/translations/makeTranslate.js +12 -3
- package/dist/translations/makeTranslate.js.map +1 -1
- package/dist/translations/server.js +8 -1
- package/dist/translations/server.js.map +1 -1
- package/dist/uploads/captureFileRef.d.ts +10 -3
- package/dist/uploads/captureFileRef.js +18 -9
- package/dist/uploads/captureFileRef.js.map +1 -1
- 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.js +3 -2
- package/dist/uploads/resolveFileRef.js.map +1 -1
- package/dist/uploads/types.d.ts +1 -2
- package/dist/validation/buildRuleBlocks.js +18 -17
- package/dist/validation/buildRuleBlocks.js.map +1 -1
- package/dist/validation/builtin/email.js +2 -1
- package/dist/validation/builtin/email.js.map +1 -1
- package/dist/validation/builtin/index.d.ts +14 -0
- package/dist/validation/builtin/index.js +12 -1
- package/dist/validation/builtin/index.js.map +1 -1
- package/dist/validation/builtin/matchesField.js +3 -7
- package/dist/validation/builtin/matchesField.js.map +1 -1
- package/dist/validation/builtin/max.js +1 -0
- package/dist/validation/builtin/max.js.map +1 -1
- package/dist/validation/builtin/maxDate.js +24 -0
- package/dist/validation/builtin/maxDate.js.map +1 -0
- package/dist/validation/builtin/maxLength.js +1 -0
- package/dist/validation/builtin/maxLength.js.map +1 -1
- package/dist/validation/builtin/min.js +1 -0
- package/dist/validation/builtin/min.js.map +1 -1
- package/dist/validation/builtin/minDate.js +24 -0
- package/dist/validation/builtin/minDate.js.map +1 -0
- package/dist/validation/builtin/minLength.js +1 -0
- package/dist/validation/builtin/minLength.js.map +1 -1
- package/dist/validation/builtin/notAlreadySubmitted.js +2 -0
- package/dist/validation/builtin/notAlreadySubmitted.js.map +1 -1
- package/dist/validation/builtin/oneOf.js +1 -0
- package/dist/validation/builtin/oneOf.js.map +1 -1
- package/dist/validation/builtin/pattern.js +11 -2
- package/dist/validation/builtin/pattern.js.map +1 -1
- package/dist/validation/builtin/url.js +1 -0
- package/dist/validation/builtin/url.js.map +1 -1
- 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/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/registry.d.ts +2 -1
- package/dist/validation/registry.js +2 -9
- package/dist/validation/registry.js.map +1 -1
- package/dist/validation/runValidation.js +9 -30
- package/dist/validation/runValidation.js.map +1 -1
- package/dist/validation/types.d.ts +5 -11
- package/dist/validation/validateUrl.js +22 -0
- package/dist/validation/validateUrl.js.map +1 -0
- package/package.json +7 -5
- package/styles/form-builder.css +10 -190
- package/dist/collections/uploads.d.ts +0 -29
- package/dist/collections/uploads.js +0 -46
- package/dist/collections/uploads.js.map +0 -1
- package/dist/consent/buildConsentSourceConfig.js +0 -49
- package/dist/consent/buildConsentSourceConfig.js.map +0 -1
- package/dist/consent/builtin/index.d.ts +0 -7
- package/dist/consent/builtin/index.js +0 -11
- package/dist/consent/builtin/index.js.map +0 -1
- package/dist/consent/builtin/pageReference.js +0 -75
- package/dist/consent/builtin/pageReference.js.map +0 -1
- package/dist/consent/builtin/static.js +0 -44
- package/dist/consent/builtin/static.js.map +0 -1
- package/dist/consent/defineConsentSource.d.ts +0 -35
- package/dist/consent/defineConsentSource.js +0 -6
- package/dist/consent/defineConsentSource.js.map +0 -1
- package/dist/consent/registry.d.ts +0 -16
- package/dist/consent/registry.js +0 -16
- package/dist/consent/registry.js.map +0 -1
- package/dist/consent/resolveConsentLinks.d.ts +0 -19
- package/dist/consent/resolveConsentLinks.js +0 -26
- package/dist/consent/resolveConsentLinks.js.map +0 -1
- package/dist/presentations/registry.d.ts +0 -15
- package/dist/presentations/registry.js +0 -15
- package/dist/presentations/registry.js.map +0 -1
- package/dist/react/toFormDocument.d.ts +0 -24
- package/dist/react/toFormDocument.js +0 -22
- package/dist/react/toFormDocument.js.map +0 -1
package/dist/exports/react.js
CHANGED
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { interpolate } from "../recall/interpolate.js";
|
|
3
|
+
import { sanitizeUrl } from "../actions/body/converters.js";
|
|
4
|
+
import { serializeBody } from "../actions/body/serializeBody.js";
|
|
3
5
|
import { CAPTCHA_TOKEN_KEY, DEFAULT_HONEYPOT_FIELD } from "../spam/constants.js";
|
|
6
|
+
import { fieldKey } from "../fields/fieldKey.js";
|
|
4
7
|
import { evaluateCalc } from "../calc/evaluate.js";
|
|
5
8
|
import { computeCalcFields } from "../calc/computeCalcFields.js";
|
|
6
9
|
import { evaluateCondition } from "../conditions/evaluate.js";
|
|
10
|
+
import { textOfBody } from "../actions/body/textOfBody.js";
|
|
11
|
+
import { de } from "../translations/de.js";
|
|
7
12
|
import { en } from "../translations/en.js";
|
|
13
|
+
import { bundles } from "../translations/index.js";
|
|
14
|
+
import { COUNTRIES, US_STATES } from "../fields/data/regions.js";
|
|
15
|
+
import { toFormDocument } from "../form/toFormDocument.js";
|
|
8
16
|
import { valuesFromSearchParams } from "../prefill/valuesFromSearchParams.js";
|
|
9
17
|
import { buildRecallResolver } from "../recall/resolver.js";
|
|
18
|
+
import { formatBytes } from "../uploads/formatBytes.js";
|
|
10
19
|
import { firstStepId, isTerminalStepId, resolveNextStepId, stepFieldNames } from "../flow/engine.js";
|
|
20
|
+
import { HCAPTCHA_SCRIPT_URL, HcaptchaCaptcha } from "../react/captcha/HcaptchaCaptcha.js";
|
|
21
|
+
import { RECAPTCHA_SCRIPT_URL, RecaptchaCaptcha } from "../react/captcha/RecaptchaCaptcha.js";
|
|
22
|
+
import { TURNSTILE_SCRIPT_URL, TurnstileCaptcha } from "../react/captcha/TurnstileCaptcha.js";
|
|
11
23
|
import { cn } from "../react/cn.js";
|
|
12
24
|
import { defineFieldRenderer } from "../react/contract.js";
|
|
13
25
|
import { makeTranslate } from "../translations/makeTranslate.js";
|
|
26
|
+
import { useFormContext } from "../react/FormContext.js";
|
|
27
|
+
import { FormControls } from "../react/FormControls.js";
|
|
14
28
|
import { FormLayout, widthProps } from "../react/FormLayout.js";
|
|
29
|
+
import { useField } from "../react/useField.js";
|
|
30
|
+
import { FormFields } from "../react/FormFields.js";
|
|
15
31
|
import { Honeypot } from "../react/Honeypot.js";
|
|
16
32
|
import { Backdrop } from "../react/presentation/Backdrop.js";
|
|
17
33
|
import { useDismiss } from "../react/presentation/useDismiss.js";
|
|
@@ -29,12 +45,12 @@ import { Select } from "../react/primitives/Select.js";
|
|
|
29
45
|
import { Textarea } from "../react/primitives/Textarea.js";
|
|
30
46
|
import { defaultRenderers } from "../react/renderers/index.js";
|
|
31
47
|
import { submitForm } from "../react/submitForm.js";
|
|
32
|
-
import { useField } from "../react/useField.js";
|
|
33
48
|
import { Form } from "../react/Form.js";
|
|
34
49
|
import { FormResults } from "../react/FormResults.js";
|
|
50
|
+
import { FormSteps } from "../react/FormSteps.js";
|
|
35
51
|
import { fetchFormResults } from "../react/fetchResults.js";
|
|
36
52
|
import { Poll } from "../react/Poll.js";
|
|
37
|
-
import { toFormDocument } from "../react/toFormDocument.js";
|
|
38
53
|
import { useFormState } from "../react/useFormState.js";
|
|
39
54
|
import { useFormStep } from "../react/useFormStep.js";
|
|
40
|
-
|
|
55
|
+
import { clientRuntimeKeys } from "../translations/clientRuntimeKeys.js";
|
|
56
|
+
export { Backdrop, CAPTCHA_TOKEN_KEY, COUNTRIES, Checkbox, DEFAULT_HONEYPOT_FIELD, DialogSurface, FieldShell, Form, FormControls, FormFields, FormLayout, FormResults, FormSteps, HCAPTCHA_SCRIPT_URL, HcaptchaCaptcha, Honeypot, Input, Poll, RECAPTCHA_SCRIPT_URL, RecaptchaCaptcha, Select, TURNSTILE_SCRIPT_URL, Textarea, TurnstileCaptcha, US_STATES, buildRecallResolver, bundles, clientRuntimeKeys, cn, computeCalcFields, de, defaultPresentations, defaultRenderers, defineFieldRenderer, en, evaluateCalc, evaluateCondition, fetchFormResults, fieldKey, firstStepId, formatBytes, interpolate, isTerminalStepId, makeTranslate, resolveNextStepId, resolvePresentations, resolveRenderers, sanitizeUrl, serializeBody, stepFieldNames, submitForm, textOfBody, toFormDocument, uploadFile, useDismiss, useField, useFocusTrap, useFormContext, useFormState, useFormStep, useScrollLock, valuesFromSearchParams, widthProps };
|
package/dist/exports/rsc.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
import { resolveConsentStatements } from "../consent/resolveConsentStatements.js";
|
|
2
|
+
import { toFormDocument } from "../form/toFormDocument.js";
|
|
3
|
+
import { isPollClosed } from "../form/pollState.js";
|
|
4
|
+
import { resolveEffectivePollOptions } from "../poll/effectivePollOptions.js";
|
|
5
|
+
import { resolvePollOptions } from "../poll/resolvePollOptions.js";
|
|
6
|
+
import { resolvePollOutcome } from "../poll/resolvePollOutcome.js";
|
|
1
7
|
import { SubmissionAnswers } from "../submissions/SubmissionAnswers.js";
|
|
2
|
-
|
|
8
|
+
import { hasVotedCookie, votedCookieName } from "../submissions/votedCookie.js";
|
|
9
|
+
export { SubmissionAnswers, hasVotedCookie, isPollClosed, resolveConsentStatements, resolveEffectivePollOptions, resolvePollOptions, resolvePollOutcome, toFormDocument, votedCookieName };
|
package/dist/exports/rsc.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
import { resolveConsentStatements } from "../consent/resolveConsentStatements.js";
|
|
2
|
+
import { isPollClosed } from "../form/pollState.js";
|
|
3
|
+
import { resolvePollOptions } from "../poll/resolvePollOptions.js";
|
|
4
|
+
import { resolvePollOutcome } from "../poll/resolvePollOutcome.js";
|
|
5
|
+
import { resolveEffectivePollOptions } from "../poll/effectivePollOptions.js";
|
|
6
|
+
import { hasVotedCookie, votedCookieName } from "../submissions/votedCookie.js";
|
|
7
|
+
import { toFormDocument } from "../form/toFormDocument.js";
|
|
1
8
|
import { SubmissionAnswers } from "../submissions/SubmissionAnswers.js";
|
|
2
|
-
export { SubmissionAnswers };
|
|
9
|
+
export { SubmissionAnswers, hasVotedCookie, isPollClosed, resolveConsentStatements, resolveEffectivePollOptions, resolvePollOptions, resolvePollOutcome, toFormDocument, votedCookieName };
|
package/dist/exports/types.d.ts
CHANGED
|
@@ -1,27 +1,36 @@
|
|
|
1
|
+
import { FormFieldInstance, SubmissionDescriptor, SubmissionFieldError, SubmissionValue, SubmissionWidth } from "../submissions/types.js";
|
|
1
2
|
import { FileFieldConfig, FileRef, FileRefError } from "../uploads/types.js";
|
|
2
|
-
import { AnyFormFieldDefinition, FormFieldDefinition, FormFieldFormat, FormFieldValidate, FormFieldValueKind } from "../fields/types.js";
|
|
3
|
-
import {
|
|
3
|
+
import { AnyFormFieldDefinition, FormFieldDefinition, FormFieldFormat, FormFieldValidate, FormFieldValueKind, OmittableSharedField } from "../fields/types.js";
|
|
4
|
+
import { RichTextBodyOption } from "../actions/body/serializeBody.js";
|
|
4
5
|
import { AggregationBucket, AggregationRow, FieldAggregation, FieldMeta, SubmissionStatusFilter } from "../aggregation/types.js";
|
|
5
6
|
import { CalcExpression } from "../calc/types.js";
|
|
7
|
+
import { ConsentSourceEntry, ConsentSourcePage, ConsentSourcesResolver } from "../consent/types.js";
|
|
8
|
+
import { ConsentStatement, ConsentStatements, ResolveConsentStatementsArgs } from "../consent/resolveConsentStatements.js";
|
|
6
9
|
import { FlowStep, FlowTransition, FormFlow } from "../flow/types.js";
|
|
10
|
+
import { FormButtonSettings, FormDocument, FormPollSettings, FormResponseSettings } from "../form/types.js";
|
|
7
11
|
import { FieldTypeOption, FieldTypeRegistry, FieldTypesConfig } from "../fields/registry.js";
|
|
8
12
|
import { PrefillOptions } from "../prefill/valuesFromSearchParams.js";
|
|
9
13
|
import { FormEvent, FormEventSink } from "../events/types.js";
|
|
10
|
-
import { AnyValidationRuleDefinition, ValidationRuleDefinition, ValidationRuleResult
|
|
14
|
+
import { AnyValidationRuleDefinition, ValidationRuleDefinition, ValidationRuleResult } from "../validation/types.js";
|
|
11
15
|
import { PresentationDensity, PresentationDescriptor, PresentationSurface } from "../presentations/types.js";
|
|
12
16
|
import { RecallResolver } from "../recall/resolver.js";
|
|
17
|
+
import { PollOptionSourceOption, PollOptionSourceRegistry, PollOptionSourcesConfig } from "../poll/registry.js";
|
|
13
18
|
import { ActionDefinition, ActionRunArgs, AnyActionDefinition } from "../actions/defineAction.js";
|
|
19
|
+
import { FromAddressOption, FromAddressesResolver } from "../actions/fromAddresses.js";
|
|
14
20
|
import { ActionOption, ActionRegistry, ActionsConfig } from "../actions/registry.js";
|
|
15
21
|
import { ActionResult } from "../actions/runActions.js";
|
|
16
22
|
import { AggregateFieldResponsesArgs, AggregateFormResponsesArgs } from "../aggregation/aggregateResponses.js";
|
|
17
|
-
import { ResolveResultsRequestArgs, ResolveResultsRequestResult } from "../aggregation/resolveResultsRequest.js";
|
|
18
|
-
import {
|
|
23
|
+
import { FormResultsAccess, FormResultsAccessArgs, ResolveResultsRequestArgs, ResolveResultsRequestResult } from "../aggregation/resolveResultsRequest.js";
|
|
24
|
+
import { ButtonFieldsOverride, ButtonsOption, DefaultButtonFields } from "../collections/buttonFields.js";
|
|
19
25
|
import { FieldCondition } from "../conditions/types.js";
|
|
20
|
-
import { AnyConsentSource, ConsentLink, ConsentResolveArgs, ConsentResolved, ConsentSource } from "../consent/defineConsentSource.js";
|
|
21
|
-
import { ConsentSourceOption, ConsentSourceRegistry, ConsentSourcesConfig } from "../consent/registry.js";
|
|
22
26
|
import { ConsentProof } from "../consent/captureConsent.js";
|
|
23
|
-
import {
|
|
27
|
+
import { ConsentSourcesFieldOptions } from "../consent/consentSourcesField.js";
|
|
28
|
+
import { ResolveConsentEntriesArgs } from "../consent/resolveConsentEntries.js";
|
|
29
|
+
import { ConsentSourceOption, ResolveConsentSourcesRequestArgs, ResolveConsentSourcesRequestResult } from "../consent/resolveConsentSourcesRequest.js";
|
|
30
|
+
import { ResolvePublishedVersionRefArgs } from "../consent/resolvePublishedVersionRef.js";
|
|
31
|
+
import { CollectionOverrides, FieldsOverride } from "../plugin/collectionOverrides.js";
|
|
24
32
|
import { CaptchaProvider, CaptchaVerifyArgs, IdentifyFn, RateLimitCheckArgs, RateLimitConfig, RateLimitResult, RateLimiter, SpamConfig, SpamMetadataConfig, SpamOption } from "../spam/types.js";
|
|
33
|
+
import { UploadsOption } from "../plugin/uploadsCollection.js";
|
|
25
34
|
import { ValidationRuleOption, ValidationRuleRegistry, ValidationRulesConfig } from "../validation/registry.js";
|
|
26
|
-
import { FormBuilderPluginOptions } from "../
|
|
27
|
-
export type { ActionDefinition, ActionOption, ActionRegistry, ActionResult, ActionRunArgs, ActionsConfig, AggregateFieldResponsesArgs, AggregateFormResponsesArgs, AggregationBucket, AggregationRow, AnyActionDefinition,
|
|
35
|
+
import { FormBuilderPluginOptions } from "../options.js";
|
|
36
|
+
export type { ActionDefinition, ActionOption, ActionRegistry, ActionResult, ActionRunArgs, ActionsConfig, AggregateFieldResponsesArgs, AggregateFormResponsesArgs, AggregationBucket, AggregationRow, AnyActionDefinition, AnyFormFieldDefinition, AnyValidationRuleDefinition, ButtonFieldsOverride, ButtonsOption, CalcExpression, CaptchaProvider, CaptchaVerifyArgs, CollectionOverrides, ConsentProof, ConsentSourceEntry, ConsentSourceOption, ConsentSourcePage, ConsentSourcesFieldOptions, ConsentSourcesResolver, ConsentStatement, ConsentStatements, DefaultButtonFields, FieldAggregation, FieldCondition, FieldMeta, FieldTypeOption, FieldTypeRegistry, FieldTypesConfig, FieldsOverride, FileFieldConfig, FileRef, FileRefError, FlowStep, FlowTransition, FormBuilderPluginOptions, FormButtonSettings, FormDocument, FormEvent, FormEventSink, FormFieldDefinition, FormFieldFormat, FormFieldInstance, FormFieldValidate, FormFieldValueKind, FormFlow, FormPollSettings, FormResponseSettings, FormResultsAccess, FormResultsAccessArgs, FromAddressOption, FromAddressesResolver, IdentifyFn, OmittableSharedField, PollOptionSourceOption, PollOptionSourceRegistry, PollOptionSourcesConfig, PrefillOptions, PresentationDensity, PresentationDescriptor, PresentationSurface, RateLimitCheckArgs, RateLimitConfig, RateLimitResult, RateLimiter, RecallResolver, ResolveConsentEntriesArgs, ResolveConsentSourcesRequestArgs, ResolveConsentSourcesRequestResult, ResolveConsentStatementsArgs, ResolvePublishedVersionRefArgs, ResolveResultsRequestArgs, ResolveResultsRequestResult, RichTextBodyOption, SpamConfig, SpamMetadataConfig, SpamOption, SubmissionDescriptor, SubmissionFieldError, SubmissionStatusFilter, SubmissionValue, SubmissionWidth, UploadsOption, ValidationRuleDefinition, ValidationRuleOption, ValidationRuleRegistry, ValidationRuleResult, ValidationRulesConfig };
|
|
@@ -1,24 +1,45 @@
|
|
|
1
1
|
import { keys } from "../translations/keys.js";
|
|
2
2
|
import { labelFor } from "../translations/server.js";
|
|
3
3
|
import { buildConditionTypeMap } from "../conditions/conditionType.js";
|
|
4
|
-
import { buildConsentSourceConfig } from "../consent/buildConsentSourceConfig.js";
|
|
5
4
|
import { buildRuleBlocks } from "../validation/buildRuleBlocks.js";
|
|
6
|
-
import {
|
|
5
|
+
import { fieldBlockTabs } from "./sharedConfig.js";
|
|
7
6
|
//#region src/fields/buildFieldBlocks.ts
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const FIELD_BLOCK_LABEL_REF = "@10x-media/form-builder/client#FieldBlockLabel";
|
|
8
|
+
/**
|
|
9
|
+
* Replace Payload's default `blockName` row header (which reads "Untitled" until filled) with the
|
|
10
|
+
* field's own `label`, keyed to the type label as fallback. See `FieldBlockLabel`.
|
|
11
|
+
*/
|
|
12
|
+
const blockLabelAdmin = (typeLabelKey, ref = FIELD_BLOCK_LABEL_REF) => ({ components: { Label: {
|
|
13
|
+
path: ref,
|
|
14
|
+
clientProps: { typeLabelKey }
|
|
15
|
+
} } });
|
|
16
|
+
/** Whether `fields` contains a field named `name`, descending into presentational rows. */
|
|
17
|
+
const hasNameField = (fields) => fields.some((f) => {
|
|
18
|
+
if ("name" in f && f.name === "name") return true;
|
|
19
|
+
return f.type === "row" && hasNameField(f.fields);
|
|
20
|
+
});
|
|
21
|
+
/** The tab whose fields hold the shared basics and type config, found by the `name` field it carries. */
|
|
22
|
+
const fieldTabOf = (block) => {
|
|
23
|
+
return block.fields.find((f) => f.type === "tabs")?.tabs.find((tab) => hasNameField(tab.fields))?.fields;
|
|
24
|
+
};
|
|
25
|
+
const buildFieldBlocks = ({ registry, ruleRegistry, localize = true }) => {
|
|
10
26
|
const conditionTypes = buildConditionTypeMap(registry);
|
|
11
27
|
const blocks = [];
|
|
28
|
+
const bareSlugs = /* @__PURE__ */ new Set();
|
|
12
29
|
for (const definition of registry.values()) {
|
|
13
|
-
|
|
14
|
-
if (definition.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
30
|
+
const typeConfig = definition.config ?? [];
|
|
31
|
+
if (definition.bare === true) {
|
|
32
|
+
bareSlugs.add(definition.type);
|
|
33
|
+
blocks.push({
|
|
34
|
+
slug: definition.type,
|
|
35
|
+
labels: {
|
|
36
|
+
singular: labelFor(definition.label),
|
|
37
|
+
plural: labelFor(definition.label)
|
|
38
|
+
},
|
|
39
|
+
admin: blockLabelAdmin(definition.label, definition.blockLabel),
|
|
40
|
+
fields: typeConfig
|
|
41
|
+
});
|
|
42
|
+
continue;
|
|
22
43
|
}
|
|
23
44
|
blocks.push({
|
|
24
45
|
slug: definition.type,
|
|
@@ -26,18 +47,31 @@ const buildFieldBlocks = (registry, ruleRegistry, consentRegistry) => {
|
|
|
26
47
|
singular: labelFor(definition.label),
|
|
27
48
|
plural: labelFor(definition.label)
|
|
28
49
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
admin: blockLabelAdmin(definition.label, definition.blockLabel),
|
|
51
|
+
fields: [fieldBlockTabs({
|
|
52
|
+
conditionTypes,
|
|
53
|
+
typeConfig,
|
|
54
|
+
validations: {
|
|
33
55
|
name: "validations",
|
|
34
56
|
type: "blocks",
|
|
35
57
|
label: labelFor(keys.validationsLabel),
|
|
36
58
|
blocks: buildRuleBlocks(ruleRegistry, definition.type)
|
|
37
|
-
}
|
|
38
|
-
|
|
59
|
+
},
|
|
60
|
+
localize,
|
|
61
|
+
omitShared: definition.omitShared
|
|
62
|
+
})]
|
|
39
63
|
});
|
|
40
64
|
}
|
|
65
|
+
const repeaterBlock = blocks.find((b) => b.slug === "repeater");
|
|
66
|
+
if (repeaterBlock) {
|
|
67
|
+
const subFieldsField = {
|
|
68
|
+
name: "subFields",
|
|
69
|
+
type: "blocks",
|
|
70
|
+
label: labelFor(keys.configSubFields),
|
|
71
|
+
blocks: blocks.filter((b) => b.slug !== "repeater" && !bareSlugs.has(b.slug))
|
|
72
|
+
};
|
|
73
|
+
(fieldTabOf(repeaterBlock) ?? repeaterBlock.fields).push(subFieldsField);
|
|
74
|
+
}
|
|
41
75
|
return blocks;
|
|
42
76
|
};
|
|
43
77
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildFieldBlocks.js","names":[],"sources":["../../src/fields/buildFieldBlocks.ts"],"sourcesContent":["import type { Block, Field } from 'payload'\nimport { buildConditionTypeMap } from '../conditions/conditionType'\nimport {
|
|
1
|
+
{"version":3,"file":"buildFieldBlocks.js","names":[],"sources":["../../src/fields/buildFieldBlocks.ts"],"sourcesContent":["import type { Block, Field, TabsField } from 'payload'\nimport { buildConditionTypeMap } from '../conditions/conditionType'\nimport { keys } from '../translations/keys'\nimport { labelFor } from '../translations/server'\nimport { buildRuleBlocks } from '../validation/buildRuleBlocks'\nimport type { ValidationRuleRegistry } from '../validation/registry'\nimport type { FieldTypeRegistry } from './registry'\nimport { fieldBlockTabs } from './sharedConfig'\n\nconst FIELD_BLOCK_LABEL_REF = '@10x-media/form-builder/client#FieldBlockLabel'\n\n/**\n * Replace Payload's default `blockName` row header (which reads \"Untitled\" until filled) with the\n * field's own `label`, keyed to the type label as fallback. See `FieldBlockLabel`.\n */\nconst blockLabelAdmin = (\n\ttypeLabelKey: string,\n\tref: string = FIELD_BLOCK_LABEL_REF\n): NonNullable<Block['admin']> => ({\n\tcomponents: { Label: { path: ref, clientProps: { typeLabelKey } } },\n})\n\n/** Whether `fields` contains a field named `name`, descending into presentational rows. */\nconst hasNameField = (fields: Field[]): boolean =>\n\tfields.some((f) => {\n\t\tif ('name' in f && f.name === 'name') {\n\t\t\treturn true\n\t\t}\n\t\treturn f.type === 'row' && hasNameField(f.fields)\n\t})\n\n/** The tab whose fields hold the shared basics and type config, found by the `name` field it carries. */\nconst fieldTabOf = (block: Block): Field[] | undefined => {\n\tconst tabsField = block.fields.find((f): f is TabsField => f.type === 'tabs')\n\treturn tabsField?.tabs.find((tab) => hasNameField(tab.fields))?.fields\n}\n\n/**\n * One add-field block per registered type: tabs holding shared config, type config, and\n * validations. Bare definitions (e.g. `message`) skip all of that: their block is the\n * definition's `config` alone, no name/shared basics/tabs. `localize` controls whether the\n * shared content fields carry `localized: true`; per-type config fields carry their own flag\n * from the registry definitions.\n */\ntype BuildFieldBlocksArgs = {\n\tregistry: FieldTypeRegistry\n\truleRegistry: ValidationRuleRegistry\n\tlocalize?: boolean\n}\n\nexport const buildFieldBlocks = ({\n\tregistry,\n\truleRegistry,\n\tlocalize = true,\n}: BuildFieldBlocksArgs): Block[] => {\n\tconst conditionTypes = buildConditionTypeMap(registry)\n\tconst blocks: Block[] = []\n\tconst bareSlugs = new Set<string>()\n\tfor (const definition of registry.values()) {\n\t\tconst typeConfig: Field[] = definition.config ?? []\n\n\t\tif (definition.bare === true) {\n\t\t\tbareSlugs.add(definition.type)\n\t\t\tblocks.push({\n\t\t\t\tslug: definition.type,\n\t\t\t\tlabels: { singular: labelFor(definition.label), plural: labelFor(definition.label) },\n\t\t\t\tadmin: blockLabelAdmin(definition.label, definition.blockLabel),\n\t\t\t\tfields: typeConfig,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tblocks.push({\n\t\t\tslug: definition.type,\n\t\t\tlabels: { singular: labelFor(definition.label), plural: labelFor(definition.label) },\n\t\t\tadmin: blockLabelAdmin(definition.label, definition.blockLabel),\n\t\t\tfields: [\n\t\t\t\tfieldBlockTabs({\n\t\t\t\t\tconditionTypes,\n\t\t\t\t\ttypeConfig,\n\t\t\t\t\tvalidations: {\n\t\t\t\t\t\tname: 'validations',\n\t\t\t\t\t\ttype: 'blocks',\n\t\t\t\t\t\tlabel: labelFor(keys.validationsLabel),\n\t\t\t\t\t\tblocks: buildRuleBlocks(ruleRegistry, definition.type),\n\t\t\t\t\t},\n\t\t\t\t\tlocalize,\n\t\t\t\t\tomitShared: definition.omitShared,\n\t\t\t\t}),\n\t\t\t],\n\t\t})\n\t}\n\n\t// Second pass: inject subFields into the repeater block using all non-repeater blocks.\n\t// Done after the main loop so every sibling block is already built.\n\t// Repeater-in-repeater is not supported in v1; the repeater block is excluded from subFields.\n\t// Bare blocks are excluded too: repeater row plumbing (values, composite error paths) is name-keyed.\n\tconst repeaterBlock = blocks.find((b) => b.slug === 'repeater')\n\tif (repeaterBlock) {\n\t\tconst subFieldsField: Field = {\n\t\t\tname: 'subFields',\n\t\t\ttype: 'blocks',\n\t\t\tlabel: labelFor(keys.configSubFields),\n\t\t\tblocks: blocks.filter((b) => b.slug !== 'repeater' && !bareSlugs.has(b.slug)),\n\t\t}\n\t\tconst fieldTabFields = fieldTabOf(repeaterBlock)\n\t\t;(fieldTabFields ?? (repeaterBlock.fields as Field[])).push(subFieldsField)\n\t}\n\n\treturn blocks\n}\n"],"mappings":";;;;;;AASA,MAAM,wBAAwB;;;;;AAM9B,MAAM,mBACL,cACA,MAAc,2BACoB,EAClC,YAAY,EAAE,OAAO;CAAE,MAAM;CAAK,aAAa,EAAE,aAAa;AAAE,EAAE,EACnE;;AAGA,MAAM,gBAAgB,WACrB,OAAO,MAAM,MAAM;CAClB,IAAI,UAAU,KAAK,EAAE,SAAS,QAC7B,OAAO;CAER,OAAO,EAAE,SAAS,SAAS,aAAa,EAAE,MAAM;AACjD,CAAC;;AAGF,MAAM,cAAc,UAAsC;CAEzD,OADkB,MAAM,OAAO,MAAM,MAAsB,EAAE,SAAS,MACvD,GAAG,KAAK,MAAM,QAAQ,aAAa,IAAI,MAAM,CAAC,GAAG;AACjE;AAeA,MAAa,oBAAoB,EAChC,UACA,cACA,WAAW,WACyB;CACpC,MAAM,iBAAiB,sBAAsB,QAAQ;CACrD,MAAM,SAAkB,CAAC;CACzB,MAAM,4BAAY,IAAI,IAAY;CAClC,KAAK,MAAM,cAAc,SAAS,OAAO,GAAG;EAC3C,MAAM,aAAsB,WAAW,UAAU,CAAC;EAElD,IAAI,WAAW,SAAS,MAAM;GAC7B,UAAU,IAAI,WAAW,IAAI;GAC7B,OAAO,KAAK;IACX,MAAM,WAAW;IACjB,QAAQ;KAAE,UAAU,SAAS,WAAW,KAAK;KAAG,QAAQ,SAAS,WAAW,KAAK;IAAE;IACnF,OAAO,gBAAgB,WAAW,OAAO,WAAW,UAAU;IAC9D,QAAQ;GACT,CAAC;GACD;EACD;EAEA,OAAO,KAAK;GACX,MAAM,WAAW;GACjB,QAAQ;IAAE,UAAU,SAAS,WAAW,KAAK;IAAG,QAAQ,SAAS,WAAW,KAAK;GAAE;GACnF,OAAO,gBAAgB,WAAW,OAAO,WAAW,UAAU;GAC9D,QAAQ,CACP,eAAe;IACd;IACA;IACA,aAAa;KACZ,MAAM;KACN,MAAM;KACN,OAAO,SAAS,KAAK,gBAAgB;KACrC,QAAQ,gBAAgB,cAAc,WAAW,IAAI;IACtD;IACA;IACA,YAAY,WAAW;GACxB,CAAC,CACF;EACD,CAAC;CACF;CAMA,MAAM,gBAAgB,OAAO,MAAM,MAAM,EAAE,SAAS,UAAU;CAC9D,IAAI,eAAe;EAClB,MAAM,iBAAwB;GAC7B,MAAM;GACN,MAAM;GACN,OAAO,SAAS,KAAK,eAAe;GACpC,QAAQ,OAAO,QAAQ,MAAM,EAAE,SAAS,cAAc,CAAC,UAAU,IAAI,EAAE,IAAI,CAAC;EAC7E;EAEC,CADsB,WAAW,aACnB,KAAM,cAAc,QAAoB,KAAK,cAAc;CAC3E;CAEA,OAAO;AACR"}
|
|
@@ -1,15 +1,135 @@
|
|
|
1
1
|
import { keys } from "../../translations/keys.js";
|
|
2
|
-
import { labelFor } from "../../translations/server.js";
|
|
2
|
+
import { asTranslate, labelFor } from "../../translations/server.js";
|
|
3
|
+
import { CALC_FNS, CALC_OPS } from "../../calc/types.js";
|
|
4
|
+
import { normalizeCalc } from "../../calc/normalizeCalc.js";
|
|
3
5
|
import { defineFormField } from "../defineFormField.js";
|
|
4
6
|
//#region src/fields/builtin/calculation.ts
|
|
7
|
+
/**
|
|
8
|
+
* Editor-facing JSON schema for `CalcExpression` (src/calc/types.ts), used by the admin JSON
|
|
9
|
+
* field's Monaco editor for autocomplete and inline diagnostics. The real validity gate is
|
|
10
|
+
* `validateExpression`/`normalizeCalc`; this schema is a convenience, not the source of truth.
|
|
11
|
+
*/
|
|
12
|
+
const calcExpressionSchema = {
|
|
13
|
+
uri: "https://10xmedia.de/schemas/form-builder/calc-expression.json",
|
|
14
|
+
fileMatch: ["https://10xmedia.de/schemas/form-builder/calc-expression.json"],
|
|
15
|
+
schema: {
|
|
16
|
+
$ref: "#/definitions/expr",
|
|
17
|
+
definitions: {
|
|
18
|
+
expr: { oneOf: [
|
|
19
|
+
{ $ref: "#/definitions/lit" },
|
|
20
|
+
{ $ref: "#/definitions/ref" },
|
|
21
|
+
{ $ref: "#/definitions/op" },
|
|
22
|
+
{ $ref: "#/definitions/neg" },
|
|
23
|
+
{ $ref: "#/definitions/fn" },
|
|
24
|
+
{ $ref: "#/definitions/weight" }
|
|
25
|
+
] },
|
|
26
|
+
lit: {
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: {
|
|
29
|
+
type: { enum: ["lit"] },
|
|
30
|
+
value: { type: "number" }
|
|
31
|
+
},
|
|
32
|
+
required: ["type", "value"],
|
|
33
|
+
additionalProperties: false
|
|
34
|
+
},
|
|
35
|
+
ref: {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
type: { enum: ["ref"] },
|
|
39
|
+
field: { type: "string" }
|
|
40
|
+
},
|
|
41
|
+
required: ["type", "field"],
|
|
42
|
+
additionalProperties: false
|
|
43
|
+
},
|
|
44
|
+
op: {
|
|
45
|
+
type: "object",
|
|
46
|
+
properties: {
|
|
47
|
+
type: { enum: ["op"] },
|
|
48
|
+
op: { enum: [...CALC_OPS] },
|
|
49
|
+
left: { $ref: "#/definitions/expr" },
|
|
50
|
+
right: { $ref: "#/definitions/expr" }
|
|
51
|
+
},
|
|
52
|
+
required: [
|
|
53
|
+
"type",
|
|
54
|
+
"op",
|
|
55
|
+
"left",
|
|
56
|
+
"right"
|
|
57
|
+
],
|
|
58
|
+
additionalProperties: false
|
|
59
|
+
},
|
|
60
|
+
neg: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: {
|
|
63
|
+
type: { enum: ["neg"] },
|
|
64
|
+
operand: { $ref: "#/definitions/expr" }
|
|
65
|
+
},
|
|
66
|
+
required: ["type", "operand"],
|
|
67
|
+
additionalProperties: false
|
|
68
|
+
},
|
|
69
|
+
fn: {
|
|
70
|
+
type: "object",
|
|
71
|
+
properties: {
|
|
72
|
+
type: { enum: ["fn"] },
|
|
73
|
+
fn: { enum: [...CALC_FNS] },
|
|
74
|
+
args: {
|
|
75
|
+
type: "array",
|
|
76
|
+
items: { $ref: "#/definitions/expr" }
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
required: [
|
|
80
|
+
"type",
|
|
81
|
+
"fn",
|
|
82
|
+
"args"
|
|
83
|
+
],
|
|
84
|
+
additionalProperties: false
|
|
85
|
+
},
|
|
86
|
+
weight: {
|
|
87
|
+
type: "object",
|
|
88
|
+
properties: {
|
|
89
|
+
type: { enum: ["weight"] },
|
|
90
|
+
field: { type: "string" },
|
|
91
|
+
weights: {
|
|
92
|
+
type: "object",
|
|
93
|
+
additionalProperties: { type: "number" }
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
required: [
|
|
97
|
+
"type",
|
|
98
|
+
"field",
|
|
99
|
+
"weights"
|
|
100
|
+
],
|
|
101
|
+
additionalProperties: false
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Validates the calculation field's `expression`: unset/empty is fine, otherwise it must
|
|
108
|
+
* normalize into a well-formed `CalcExpression` tree. Exported for unit testing.
|
|
109
|
+
*/
|
|
110
|
+
const validateExpression = (value, { req }) => {
|
|
111
|
+
if (value == null || value === "") return true;
|
|
112
|
+
return normalizeCalc(value) !== void 0 ? true : asTranslate(req.t)(keys.validationCalcExpressionInvalid);
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* A calculation is derived and read-only: it renders disabled with no text affordance (no
|
|
116
|
+
* `placeholder`), and it is never validated (`runSubmission` stores its computed value and skips
|
|
117
|
+
* `runValidation` entirely), so an authored `required` could never fire. Both are omitted rather
|
|
118
|
+
* than offered as settings that do nothing.
|
|
119
|
+
*/
|
|
5
120
|
const calculationField = defineFormField({
|
|
6
121
|
type: "calculation",
|
|
7
122
|
label: keys.fieldTypeCalculation,
|
|
8
123
|
value: "number",
|
|
124
|
+
omitShared: ["placeholder", "required"],
|
|
9
125
|
config: [{
|
|
10
126
|
name: "expression",
|
|
11
127
|
type: "json",
|
|
12
|
-
label: labelFor(keys.configExpression)
|
|
128
|
+
label: labelFor(keys.configExpression),
|
|
129
|
+
admin: { description: labelFor(keys.configExpressionDescription) },
|
|
130
|
+
jsonSchema: calcExpressionSchema,
|
|
131
|
+
typescriptSchema: [() => ({ type: "object" })],
|
|
132
|
+
validate: validateExpression
|
|
13
133
|
}, {
|
|
14
134
|
name: "calcDisplay",
|
|
15
135
|
type: "checkbox",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculation.js","names":[],"sources":["../../../src/fields/builtin/calculation.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineFormField } from '../defineFormField'\n\nexport const calculationField = defineFormField<'number'>({\n\ttype: 'calculation',\n\tlabel: keys.fieldTypeCalculation,\n\tvalue: 'number',\n\tconfig: [\n\t\t{
|
|
1
|
+
{"version":3,"file":"calculation.js","names":[],"sources":["../../../src/fields/builtin/calculation.ts"],"sourcesContent":["import type { JSONField, PayloadRequest } from 'payload'\nimport { normalizeCalc } from '../../calc/normalizeCalc'\nimport { CALC_FNS, CALC_OPS } from '../../calc/types'\nimport { keys } from '../../translations/keys'\nimport { asTranslate, labelFor } from '../../translations/server'\nimport { defineFormField } from '../defineFormField'\n\ntype CalcExpressionSchema = NonNullable<JSONField['jsonSchema']>\n\n/**\n * Editor-facing JSON schema for `CalcExpression` (src/calc/types.ts), used by the admin JSON\n * field's Monaco editor for autocomplete and inline diagnostics. The real validity gate is\n * `validateExpression`/`normalizeCalc`; this schema is a convenience, not the source of truth.\n */\nconst calcExpressionSchema: CalcExpressionSchema = {\n\turi: 'https://10xmedia.de/schemas/form-builder/calc-expression.json',\n\tfileMatch: ['https://10xmedia.de/schemas/form-builder/calc-expression.json'],\n\tschema: {\n\t\t$ref: '#/definitions/expr',\n\t\tdefinitions: {\n\t\t\texpr: {\n\t\t\t\toneOf: [\n\t\t\t\t\t{ $ref: '#/definitions/lit' },\n\t\t\t\t\t{ $ref: '#/definitions/ref' },\n\t\t\t\t\t{ $ref: '#/definitions/op' },\n\t\t\t\t\t{ $ref: '#/definitions/neg' },\n\t\t\t\t\t{ $ref: '#/definitions/fn' },\n\t\t\t\t\t{ $ref: '#/definitions/weight' },\n\t\t\t\t],\n\t\t\t},\n\t\t\tlit: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: { type: { enum: ['lit'] }, value: { type: 'number' } },\n\t\t\t\trequired: ['type', 'value'],\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t\tref: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: { type: { enum: ['ref'] }, field: { type: 'string' } },\n\t\t\t\trequired: ['type', 'field'],\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t\top: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\ttype: { enum: ['op'] },\n\t\t\t\t\top: { enum: [...CALC_OPS] },\n\t\t\t\t\tleft: { $ref: '#/definitions/expr' },\n\t\t\t\t\tright: { $ref: '#/definitions/expr' },\n\t\t\t\t},\n\t\t\t\trequired: ['type', 'op', 'left', 'right'],\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t\tneg: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: { type: { enum: ['neg'] }, operand: { $ref: '#/definitions/expr' } },\n\t\t\t\trequired: ['type', 'operand'],\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t\tfn: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\ttype: { enum: ['fn'] },\n\t\t\t\t\tfn: { enum: [...CALC_FNS] },\n\t\t\t\t\targs: { type: 'array', items: { $ref: '#/definitions/expr' } },\n\t\t\t\t},\n\t\t\t\trequired: ['type', 'fn', 'args'],\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t\tweight: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\ttype: { enum: ['weight'] },\n\t\t\t\t\tfield: { type: 'string' },\n\t\t\t\t\tweights: { type: 'object', additionalProperties: { type: 'number' } },\n\t\t\t\t},\n\t\t\t\trequired: ['type', 'field', 'weights'],\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t},\n\t},\n}\n\n/**\n * Validates the calculation field's `expression`: unset/empty is fine, otherwise it must\n * normalize into a well-formed `CalcExpression` tree. Exported for unit testing.\n */\nexport const validateExpression = (\n\tvalue: unknown,\n\t{ req }: { data?: unknown; req: PayloadRequest }\n): string | true => {\n\tif (value == null || value === '') {\n\t\treturn true\n\t}\n\treturn normalizeCalc(value) !== undefined\n\t\t? true\n\t\t: asTranslate(req.t)(keys.validationCalcExpressionInvalid)\n}\n\n/**\n * A calculation is derived and read-only: it renders disabled with no text affordance (no\n * `placeholder`), and it is never validated (`runSubmission` stores its computed value and skips\n * `runValidation` entirely), so an authored `required` could never fire. Both are omitted rather\n * than offered as settings that do nothing.\n */\nexport const calculationField = defineFormField<'number'>({\n\ttype: 'calculation',\n\tlabel: keys.fieldTypeCalculation,\n\tvalue: 'number',\n\tomitShared: ['placeholder', 'required'],\n\tconfig: [\n\t\t{\n\t\t\tname: 'expression',\n\t\t\ttype: 'json',\n\t\t\tlabel: labelFor(keys.configExpression),\n\t\t\tadmin: { description: labelFor(keys.configExpressionDescription) },\n\t\t\tjsonSchema: calcExpressionSchema,\n\t\t\t// generate:types embeds jsonSchema.schema into the config-level schema, where its\n\t\t\t// document-root-relative $refs cannot resolve; hand type generation a flat shape instead.\n\t\t\ttypescriptSchema: [() => ({ type: 'object' })],\n\t\t\tvalidate: validateExpression,\n\t\t},\n\t\t{\n\t\t\tname: 'calcDisplay',\n\t\t\ttype: 'checkbox',\n\t\t\tdefaultValue: true,\n\t\t\tlabel: labelFor(keys.configCalcDisplay),\n\t\t},\n\t],\n\tformat: ({ value }) => (value == null ? '' : String(value)),\n})\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,uBAA6C;CAClD,KAAK;CACL,WAAW,CAAC,+DAA+D;CAC3E,QAAQ;EACP,MAAM;EACN,aAAa;GACZ,MAAM,EACL,OAAO;IACN,EAAE,MAAM,oBAAoB;IAC5B,EAAE,MAAM,oBAAoB;IAC5B,EAAE,MAAM,mBAAmB;IAC3B,EAAE,MAAM,oBAAoB;IAC5B,EAAE,MAAM,mBAAmB;IAC3B,EAAE,MAAM,uBAAuB;GAChC,EACD;GACA,KAAK;IACJ,MAAM;IACN,YAAY;KAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE;KAAG,OAAO,EAAE,MAAM,SAAS;IAAE;IACjE,UAAU,CAAC,QAAQ,OAAO;IAC1B,sBAAsB;GACvB;GACA,KAAK;IACJ,MAAM;IACN,YAAY;KAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE;KAAG,OAAO,EAAE,MAAM,SAAS;IAAE;IACjE,UAAU,CAAC,QAAQ,OAAO;IAC1B,sBAAsB;GACvB;GACA,IAAI;IACH,MAAM;IACN,YAAY;KACX,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;KACrB,IAAI,EAAE,MAAM,CAAC,GAAG,QAAQ,EAAE;KAC1B,MAAM,EAAE,MAAM,qBAAqB;KACnC,OAAO,EAAE,MAAM,qBAAqB;IACrC;IACA,UAAU;KAAC;KAAQ;KAAM;KAAQ;IAAO;IACxC,sBAAsB;GACvB;GACA,KAAK;IACJ,MAAM;IACN,YAAY;KAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE;KAAG,SAAS,EAAE,MAAM,qBAAqB;IAAE;IAC/E,UAAU,CAAC,QAAQ,SAAS;IAC5B,sBAAsB;GACvB;GACA,IAAI;IACH,MAAM;IACN,YAAY;KACX,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;KACrB,IAAI,EAAE,MAAM,CAAC,GAAG,QAAQ,EAAE;KAC1B,MAAM;MAAE,MAAM;MAAS,OAAO,EAAE,MAAM,qBAAqB;KAAE;IAC9D;IACA,UAAU;KAAC;KAAQ;KAAM;IAAM;IAC/B,sBAAsB;GACvB;GACA,QAAQ;IACP,MAAM;IACN,YAAY;KACX,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE;KACzB,OAAO,EAAE,MAAM,SAAS;KACxB,SAAS;MAAE,MAAM;MAAU,sBAAsB,EAAE,MAAM,SAAS;KAAE;IACrE;IACA,UAAU;KAAC;KAAQ;KAAS;IAAS;IACrC,sBAAsB;GACvB;EACD;CACD;AACD;;;;;AAMA,MAAa,sBACZ,OACA,EAAE,UACiB;CACnB,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;CAER,OAAO,cAAc,KAAK,MAAM,KAAA,IAC7B,OACA,YAAY,IAAI,CAAC,EAAE,KAAK,+BAA+B;AAC3D;;;;;;;AAQA,MAAa,mBAAmB,gBAA0B;CACzD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,YAAY,CAAC,eAAe,UAAU;CACtC,QAAQ,CACP;EACC,MAAM;EACN,MAAM;EACN,OAAO,SAAS,KAAK,gBAAgB;EACrC,OAAO,EAAE,aAAa,SAAS,KAAK,2BAA2B,EAAE;EACjE,YAAY;EAGZ,kBAAkB,QAAQ,EAAE,MAAM,SAAS,EAAE;EAC7C,UAAU;CACX,GACA;EACC,MAAM;EACN,MAAM;EACN,cAAc;EACd,OAAO,SAAS,KAAK,iBAAiB;CACvC,CACD;CACA,SAAS,EAAE,YAAa,SAAS,OAAO,KAAK,OAAO,KAAK;AAC1D,CAAC"}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { keys } from "../../translations/keys.js";
|
|
2
2
|
import { defineFormField } from "../defineFormField.js";
|
|
3
3
|
//#region src/fields/builtin/checkbox.ts
|
|
4
|
+
/**
|
|
5
|
+
* A checkbox renders as a lone box with no free-text affordance, so `placeholder` is never read.
|
|
6
|
+
* The intrinsic validator owns `required`: the engine's shared required guard only fires on an
|
|
7
|
+
* empty value, and `false` (checked, then unchecked) is a present one, so without this a required
|
|
8
|
+
* checkbox would accept an explicit refusal.
|
|
9
|
+
*/
|
|
4
10
|
const checkboxField = defineFormField({
|
|
5
11
|
type: "checkbox",
|
|
6
12
|
label: keys.fieldTypeCheckbox,
|
|
7
13
|
value: "boolean",
|
|
14
|
+
omitShared: ["placeholder"],
|
|
15
|
+
validate: ({ value, config, t }) => config.required === true && value !== true ? t(keys.validationRequired) : true,
|
|
8
16
|
format: ({ value, t }) => value ? t(keys.formatYes) : t(keys.formatNo)
|
|
9
17
|
});
|
|
10
18
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../src/fields/builtin/checkbox.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { defineFormField } from '../defineFormField'\n\nexport const checkboxField = defineFormField<'boolean'>({\n\ttype: 'checkbox',\n\tlabel: keys.fieldTypeCheckbox,\n\tvalue: 'boolean',\n\tformat: ({ value, t }) => (value ? t(keys.formatYes) : t(keys.formatNo)),\n})\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../src/fields/builtin/checkbox.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { defineFormField } from '../defineFormField'\n\ntype CheckboxConfig = { required?: boolean }\n\n/**\n * A checkbox renders as a lone box with no free-text affordance, so `placeholder` is never read.\n * The intrinsic validator owns `required`: the engine's shared required guard only fires on an\n * empty value, and `false` (checked, then unchecked) is a present one, so without this a required\n * checkbox would accept an explicit refusal.\n */\nexport const checkboxField = defineFormField<'boolean', CheckboxConfig>({\n\ttype: 'checkbox',\n\tlabel: keys.fieldTypeCheckbox,\n\tvalue: 'boolean',\n\tomitShared: ['placeholder'],\n\tvalidate: ({ value, config, t }) =>\n\t\tconfig.required === true && value !== true ? t(keys.validationRequired) : true,\n\tformat: ({ value, t }) => (value ? t(keys.formatYes) : t(keys.formatNo)),\n})\n"],"mappings":";;;;;;;;;AAWA,MAAa,gBAAgB,gBAA2C;CACvE,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,YAAY,CAAC,aAAa;CAC1B,WAAW,EAAE,OAAO,QAAQ,QAC3B,OAAO,aAAa,QAAQ,UAAU,OAAO,EAAE,KAAK,kBAAkB,IAAI;CAC3E,SAAS,EAAE,OAAO,QAAS,QAAQ,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,QAAQ;AACvE,CAAC"}
|
|
@@ -1,29 +1,44 @@
|
|
|
1
1
|
import { keys } from "../../translations/keys.js";
|
|
2
|
-
import {
|
|
2
|
+
import { labelForKey } from "../../translations/server.js";
|
|
3
3
|
import { defineFormField } from "../defineFormField.js";
|
|
4
|
-
//#region src/fields/builtin/consent.ts
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Consent is a reference, so the field is a reference: the author picks a source and nothing else.
|
|
6
|
+
* The statement, the policy page, and its version all live with the source (see
|
|
7
|
+
* `consentSourcesField`), so there is no wording to copy per form, no URL to paste, and no version
|
|
8
|
+
* to type; correcting a statement corrects every form pointing at it. `label` and `placeholder` are
|
|
9
|
+
* dropped for the same reason: the statement is the visible text and the checkbox's accessible name.
|
|
10
|
+
*
|
|
11
|
+
* Registered only when the plugin's `consent.sources` resolver is set, since a consent field with
|
|
12
|
+
* no source to reference has nothing to say and nothing to prove.
|
|
13
|
+
*
|
|
14
|
+
* The intrinsic validator owns `required`: the engine's shared required guard only fires on an
|
|
15
|
+
* empty value, and `false` (the coerced state of both an unchecked box and an absent answer) is a
|
|
16
|
+
* present one, so without this a required consent would accept an explicit refusal.
|
|
9
17
|
*/
|
|
10
18
|
const consentField = defineFormField({
|
|
11
19
|
type: "consent",
|
|
12
20
|
label: keys.fieldTypeConsent,
|
|
13
21
|
value: "boolean",
|
|
22
|
+
omitShared: [
|
|
23
|
+
"label",
|
|
24
|
+
"placeholder",
|
|
25
|
+
"description"
|
|
26
|
+
],
|
|
27
|
+
blockLabel: "@10x-media/form-builder/client#ConsentBlockLabel",
|
|
14
28
|
config: [{
|
|
15
|
-
name: "
|
|
29
|
+
name: "source",
|
|
16
30
|
type: "text",
|
|
17
|
-
label:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
31
|
+
label: labelForKey(keys.consentConfigSource),
|
|
32
|
+
admin: { components: { Field: {
|
|
33
|
+
path: "@10x-media/form-builder/client#EndpointOptionsSelect",
|
|
34
|
+
clientProps: {
|
|
35
|
+
endpoint: "consent-sources",
|
|
36
|
+
descriptionKey: keys.consentConfigSourceDescription,
|
|
37
|
+
isClearable: false
|
|
38
|
+
}
|
|
39
|
+
} } }
|
|
22
40
|
}],
|
|
23
|
-
validate: ({ value, config, t }) =>
|
|
24
|
-
if (!(config.optional === true) && value !== true) return t(keys.validationRequired);
|
|
25
|
-
return true;
|
|
26
|
-
},
|
|
41
|
+
validate: ({ value, config, t }) => config.required === true && value !== true ? t(keys.validationRequired) : true,
|
|
27
42
|
format: ({ value, t }) => t(value === true ? keys.formatYes : keys.formatNo)
|
|
28
43
|
});
|
|
29
44
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent.js","names":[],"sources":["../../../src/fields/builtin/consent.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport {
|
|
1
|
+
{"version":3,"file":"consent.js","names":[],"sources":["../../../src/fields/builtin/consent.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelForKey } from '../../translations/server'\nimport { defineFormField } from '../defineFormField'\n\ntype ConsentConfig = { source?: string; required?: boolean }\n\nconst SOURCE_FIELD_REF = '@10x-media/form-builder/client#EndpointOptionsSelect'\n\n/**\n * Consent is a reference, so the field is a reference: the author picks a source and nothing else.\n * The statement, the policy page, and its version all live with the source (see\n * `consentSourcesField`), so there is no wording to copy per form, no URL to paste, and no version\n * to type; correcting a statement corrects every form pointing at it. `label` and `placeholder` are\n * dropped for the same reason: the statement is the visible text and the checkbox's accessible name.\n *\n * Registered only when the plugin's `consent.sources` resolver is set, since a consent field with\n * no source to reference has nothing to say and nothing to prove.\n *\n * The intrinsic validator owns `required`: the engine's shared required guard only fires on an\n * empty value, and `false` (the coerced state of both an unchecked box and an absent answer) is a\n * present one, so without this a required consent would accept an explicit refusal.\n */\nexport const consentField = defineFormField<'boolean', ConsentConfig>({\n\ttype: 'consent',\n\tlabel: keys.fieldTypeConsent,\n\tvalue: 'boolean',\n\tomitShared: ['label', 'placeholder', 'description'],\n\tblockLabel: '@10x-media/form-builder/client#ConsentBlockLabel',\n\tconfig: [\n\t\t{\n\t\t\tname: 'source',\n\t\t\ttype: 'text',\n\t\t\tlabel: labelForKey(keys.consentConfigSource),\n\t\t\tadmin: {\n\t\t\t\tcomponents: {\n\t\t\t\t\tField: {\n\t\t\t\t\t\tpath: SOURCE_FIELD_REF,\n\t\t\t\t\t\tclientProps: {\n\t\t\t\t\t\t\tendpoint: 'consent-sources',\n\t\t\t\t\t\t\tdescriptionKey: keys.consentConfigSourceDescription,\n\t\t\t\t\t\t\tisClearable: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n\tvalidate: ({ value, config, t }) =>\n\t\tconfig.required === true && value !== true ? t(keys.validationRequired) : true,\n\tformat: ({ value, t }) => t(value === true ? keys.formatYes : keys.formatNo),\n})\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,MAAa,eAAe,gBAA0C;CACrE,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,YAAY;EAAC;EAAS;EAAe;CAAa;CAClD,YAAY;CACZ,QAAQ,CACP;EACC,MAAM;EACN,MAAM;EACN,OAAO,YAAY,KAAK,mBAAmB;EAC3C,OAAO,EACN,YAAY,EACX,OAAO;GACN,MAAM;GACN,aAAa;IACZ,UAAU;IACV,gBAAgB,KAAK;IACrB,aAAa;GACd;EACD,EACD,EACD;CACD,CACD;CACA,WAAW,EAAE,OAAO,QAAQ,QAC3B,OAAO,aAAa,QAAQ,UAAU,OAAO,EAAE,KAAK,kBAAkB,IAAI;CAC3E,SAAS,EAAE,OAAO,QAAQ,EAAE,UAAU,OAAO,KAAK,YAAY,KAAK,QAAQ;AAC5E,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FormFieldConfigValues, FormFieldDefinition } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/fields/builtin/country.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A country picker fronted by the fixed ISO 3166-1 alpha-2 set (see {@link COUNTRIES}). Unlike
|
|
6
|
+
* `select` the author does not author options, so there is no `config`; the stored value is the
|
|
7
|
+
* two-letter code and `format` resolves it to the English name. `resolveOptions` exposes the same
|
|
8
|
+
* set as poll choices so a country field can back a poll despite carrying no authored options.
|
|
9
|
+
*/
|
|
10
|
+
declare const countryField: FormFieldDefinition<"text", FormFieldConfigValues>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { countryField };
|
|
13
|
+
//# sourceMappingURL=country.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { keys } from "../../translations/keys.js";
|
|
2
|
+
import { defineFormField } from "../defineFormField.js";
|
|
3
|
+
import { COUNTRIES, countryLabel, isCountryCode } from "../data/regions.js";
|
|
4
|
+
//#region src/fields/builtin/country.ts
|
|
5
|
+
/**
|
|
6
|
+
* A country picker fronted by the fixed ISO 3166-1 alpha-2 set (see {@link COUNTRIES}). Unlike
|
|
7
|
+
* `select` the author does not author options, so there is no `config`; the stored value is the
|
|
8
|
+
* two-letter code and `format` resolves it to the English name. `resolveOptions` exposes the same
|
|
9
|
+
* set as poll choices so a country field can back a poll despite carrying no authored options.
|
|
10
|
+
*/
|
|
11
|
+
const countryField = defineFormField({
|
|
12
|
+
type: "country",
|
|
13
|
+
label: keys.fieldTypeCountry,
|
|
14
|
+
value: "text",
|
|
15
|
+
conditionType: "select",
|
|
16
|
+
pollEligible: true,
|
|
17
|
+
resolveOptions: () => COUNTRIES,
|
|
18
|
+
validate: ({ value, t }) => {
|
|
19
|
+
if (value == null || value === "") return true;
|
|
20
|
+
return isCountryCode(value) ? true : t(keys.validationCountry);
|
|
21
|
+
},
|
|
22
|
+
format: ({ value }) => {
|
|
23
|
+
if (value == null || value === "") return "";
|
|
24
|
+
return countryLabel(value) ?? String(value);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { countryField };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=country.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country.js","names":[],"sources":["../../../src/fields/builtin/country.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { COUNTRIES, countryLabel, isCountryCode } from '../data/regions'\nimport { defineFormField } from '../defineFormField'\n\n/**\n * A country picker fronted by the fixed ISO 3166-1 alpha-2 set (see {@link COUNTRIES}). Unlike\n * `select` the author does not author options, so there is no `config`; the stored value is the\n * two-letter code and `format` resolves it to the English name. `resolveOptions` exposes the same\n * set as poll choices so a country field can back a poll despite carrying no authored options.\n */\nexport const countryField = defineFormField<'text'>({\n\ttype: 'country',\n\tlabel: keys.fieldTypeCountry,\n\tvalue: 'text',\n\tconditionType: 'select',\n\tpollEligible: true,\n\tresolveOptions: () => COUNTRIES,\n\tvalidate: ({ value, t }) => {\n\t\tif (value == null || value === '') {\n\t\t\treturn true\n\t\t}\n\t\treturn isCountryCode(value) ? true : t(keys.validationCountry)\n\t},\n\tformat: ({ value }) => {\n\t\tif (value == null || value === '') {\n\t\t\treturn ''\n\t\t}\n\t\treturn countryLabel(value) ?? String(value)\n\t},\n})\n"],"mappings":";;;;;;;;;;AAUA,MAAa,eAAe,gBAAwB;CACnD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,eAAe;CACf,cAAc;CACd,sBAAsB;CACtB,WAAW,EAAE,OAAO,QAAQ;EAC3B,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,OAAO,cAAc,KAAK,IAAI,OAAO,EAAE,KAAK,iBAAiB;CAC9D;CACA,SAAS,EAAE,YAAY;EACtB,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,OAAO,aAAa,KAAK,KAAK,OAAO,KAAK;CAC3C;AACD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { keys } from "../../translations/keys.js";
|
|
2
|
+
import { defineFormField } from "../defineFormField.js";
|
|
3
|
+
//#region src/fields/builtin/date.ts
|
|
4
|
+
const DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
5
|
+
/** True calendar-date check for `YYYY-MM-DD` strings (rejects e.g. `2024-02-30`). */
|
|
6
|
+
const isValidCalendarDate = (value) => {
|
|
7
|
+
const match = DATE_PATTERN.exec(value);
|
|
8
|
+
if (!match) return false;
|
|
9
|
+
const [, yearStr, monthStr, dayStr] = match;
|
|
10
|
+
const year = Number(yearStr);
|
|
11
|
+
const month = Number(monthStr);
|
|
12
|
+
const day = Number(dayStr);
|
|
13
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
14
|
+
return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
|
|
15
|
+
};
|
|
16
|
+
/** `placeholder` is omitted: browsers ignore it on `<input type="date">`, which renders its own picker. */
|
|
17
|
+
const dateField = defineFormField({
|
|
18
|
+
type: "date",
|
|
19
|
+
label: keys.fieldTypeDate,
|
|
20
|
+
value: "date",
|
|
21
|
+
omitShared: ["placeholder"],
|
|
22
|
+
validate: ({ value, t }) => {
|
|
23
|
+
if (value == null || value === "") return true;
|
|
24
|
+
return isValidCalendarDate(value) ? true : t(keys.validationDate);
|
|
25
|
+
},
|
|
26
|
+
format: ({ value }) => value == null ? "" : String(value)
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export { dateField, isValidCalendarDate };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.js","names":[],"sources":["../../../src/fields/builtin/date.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { defineFormField } from '../defineFormField'\n\nconst DATE_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/\n\n/** True calendar-date check for `YYYY-MM-DD` strings (rejects e.g. `2024-02-30`). */\nexport const isValidCalendarDate = (value: string): boolean => {\n\tconst match = DATE_PATTERN.exec(value)\n\tif (!match) {\n\t\treturn false\n\t}\n\tconst [, yearStr, monthStr, dayStr] = match\n\tconst year = Number(yearStr)\n\tconst month = Number(monthStr)\n\tconst day = Number(dayStr)\n\tconst date = new Date(Date.UTC(year, month - 1, day))\n\treturn (\n\t\tdate.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day\n\t)\n}\n\n/** `placeholder` is omitted: browsers ignore it on `<input type=\"date\">`, which renders its own picker. */\nexport const dateField = defineFormField<'date'>({\n\ttype: 'date',\n\tlabel: keys.fieldTypeDate,\n\tvalue: 'date',\n\tomitShared: ['placeholder'],\n\tvalidate: ({ value, t }) => {\n\t\tif (value == null || value === '') {\n\t\t\treturn true\n\t\t}\n\t\treturn isValidCalendarDate(value) ? true : t(keys.validationDate)\n\t},\n\tformat: ({ value }) => (value == null ? '' : String(value)),\n})\n"],"mappings":";;;AAGA,MAAM,eAAe;;AAGrB,MAAa,uBAAuB,UAA2B;CAC9D,MAAM,QAAQ,aAAa,KAAK,KAAK;CACrC,IAAI,CAAC,OACJ,OAAO;CAER,MAAM,GAAG,SAAS,UAAU,UAAU;CACtC,MAAM,OAAO,OAAO,OAAO;CAC3B,MAAM,QAAQ,OAAO,QAAQ;CAC7B,MAAM,MAAM,OAAO,MAAM;CACzB,MAAM,OAAO,IAAI,KAAK,KAAK,IAAI,MAAM,QAAQ,GAAG,GAAG,CAAC;CACpD,OACC,KAAK,eAAe,MAAM,QAAQ,KAAK,YAAY,MAAM,QAAQ,KAAK,KAAK,WAAW,MAAM;AAE9F;;AAGA,MAAa,YAAY,gBAAwB;CAChD,MAAM;CACN,OAAO,KAAK;CACZ,OAAO;CACP,YAAY,CAAC,aAAa;CAC1B,WAAW,EAAE,OAAO,QAAQ;EAC3B,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;EAER,OAAO,oBAAoB,KAAK,IAAI,OAAO,EAAE,KAAK,cAAc;CACjE;CACA,SAAS,EAAE,YAAa,SAAS,OAAO,KAAK,OAAO,KAAK;AAC1D,CAAC"}
|