@10x-media/form-builder 0.1.0-beta.0 → 0.1.0-beta.1
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 +52 -0
- package/README.md +43 -1402
- package/dist/actions/buildActionBlocks.js +19 -0
- package/dist/actions/buildActionBlocks.js.map +1 -0
- package/dist/actions/builtin/confirmation.js +49 -0
- package/dist/actions/builtin/confirmation.js.map +1 -0
- package/dist/actions/builtin/emailTeam.js +46 -0
- package/dist/actions/builtin/emailTeam.js.map +1 -0
- package/dist/actions/builtin/index.d.ts +7 -0
- package/dist/actions/builtin/index.js +13 -0
- package/dist/actions/builtin/index.js.map +1 -0
- package/dist/actions/builtin/signedWebhook.js +49 -0
- package/dist/actions/builtin/signedWebhook.js.map +1 -0
- package/dist/actions/defineAction.d.ts +36 -0
- package/dist/actions/defineAction.js +6 -0
- package/dist/actions/defineAction.js.map +1 -0
- package/dist/actions/dispatch.js +48 -0
- package/dist/actions/dispatch.js.map +1 -0
- package/dist/actions/registry.d.ts +16 -0
- package/dist/actions/registry.js +16 -0
- package/dist/actions/registry.js.map +1 -0
- package/dist/actions/runActions.d.ts +9 -0
- package/dist/actions/runActions.js +34 -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 +82 -0
- package/dist/actions/task.js.map +1 -0
- package/dist/aggregation/aggregateResponses.d.ts +31 -0
- package/dist/aggregation/aggregateResponses.js +86 -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 +32 -0
- package/dist/aggregation/resolveResultsRequest.js +56 -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 +27 -0
- package/dist/calc/computeCalcFields.js.map +1 -0
- package/dist/calc/evaluate.d.ts +8 -0
- package/dist/calc/evaluate.js +59 -0
- package/dist/calc/evaluate.js.map +1 -0
- package/dist/calc/normalizeCalc.d.ts +8 -0
- package/dist/calc/normalizeCalc.js +100 -0
- package/dist/calc/normalizeCalc.js.map +1 -0
- package/dist/calc/types.d.ts +28 -0
- package/dist/client/ConditionBuilder.js +121 -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/FlowBuilder.d.ts +15 -0
- package/dist/client/FlowBuilder.js +408 -0
- package/dist/client/FlowBuilder.js.map +1 -0
- package/dist/client/FormConditionField.d.ts +21 -0
- package/dist/client/FormConditionField.js +33 -0
- package/dist/client/FormConditionField.js.map +1 -0
- package/dist/client/synthesizeClientField.js +46 -0
- package/dist/client/synthesizeClientField.js.map +1 -0
- package/dist/collections/formSubmissions.js +138 -0
- package/dist/collections/formSubmissions.js.map +1 -0
- package/dist/collections/forms.js +187 -0
- package/dist/collections/forms.js.map +1 -0
- package/dist/collections/uploads.d.ts +29 -0
- package/dist/collections/uploads.js +46 -0
- package/dist/collections/uploads.js.map +1 -0
- package/dist/conditions/conditionType.js +14 -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 +9 -0
- package/dist/{fieldTypes-CzhhJXjg.js → conditions/fieldTypes.js} +2 -2
- package/dist/conditions/fieldTypes.js.map +1 -0
- package/dist/conditions/normalizeConditions.js +47 -0
- package/dist/conditions/normalizeConditions.js.map +1 -0
- package/dist/conditions/types.d.ts +8 -0
- package/dist/consent/buildConsentSourceConfig.js +49 -0
- package/dist/consent/buildConsentSourceConfig.js.map +1 -0
- package/dist/consent/builtin/index.d.ts +7 -0
- package/dist/consent/builtin/index.js +11 -0
- package/dist/consent/builtin/index.js.map +1 -0
- package/dist/consent/builtin/pageReference.js +75 -0
- package/dist/consent/builtin/pageReference.js.map +1 -0
- package/dist/consent/builtin/static.js +44 -0
- package/dist/consent/builtin/static.js.map +1 -0
- package/dist/consent/captureConsent.d.ts +28 -0
- package/dist/consent/captureConsent.js +26 -0
- package/dist/consent/captureConsent.js.map +1 -0
- package/dist/consent/defineConsentSource.d.ts +35 -0
- package/dist/consent/defineConsentSource.js +6 -0
- package/dist/consent/defineConsentSource.js.map +1 -0
- package/dist/consent/registry.d.ts +16 -0
- package/dist/consent/registry.js +16 -0
- package/dist/consent/registry.js.map +1 -0
- package/dist/consent/resolveConsentLinks.d.ts +19 -0
- package/dist/consent/resolveConsentLinks.js +26 -0
- package/dist/consent/resolveConsentLinks.js.map +1 -0
- package/dist/consent/resolvePublishedVersionRef.d.ts +17 -0
- package/dist/consent/resolvePublishedVersionRef.js +27 -0
- package/dist/consent/resolvePublishedVersionRef.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 +3 -21
- package/dist/exports/client.js +3 -319
- package/dist/exports/i18n.d.ts +3 -138
- package/dist/exports/i18n.js +2 -2
- package/dist/exports/react.d.ts +45 -550
- package/dist/exports/react.js +39 -1563
- package/dist/exports/rsc.d.ts +2 -16
- package/dist/exports/rsc.js +1 -54
- package/dist/exports/types.d.ts +27 -5
- package/dist/fields/buildFieldBlocks.js +46 -0
- package/dist/fields/buildFieldBlocks.js.map +1 -0
- package/dist/fields/builtin/calculation.js +24 -0
- package/dist/fields/builtin/calculation.js.map +1 -0
- package/dist/fields/builtin/checkbox.js +13 -0
- package/dist/fields/builtin/checkbox.js.map +1 -0
- package/dist/fields/builtin/consent.js +32 -0
- package/dist/fields/builtin/consent.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.js +40 -0
- package/dist/fields/builtin/file.js.map +1 -0
- package/dist/fields/builtin/index.js +25 -0
- package/dist/fields/builtin/index.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/select.js +44 -0
- package/dist/fields/builtin/select.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/defineFormField.d.ts +13 -0
- package/dist/fields/defineFormField.js +12 -0
- package/dist/fields/defineFormField.js.map +1 -0
- package/dist/fields/registry.d.ts +10 -0
- package/dist/fields/registry.js +24 -0
- package/dist/fields/registry.js.map +1 -0
- package/dist/fields/sharedConfig.js +89 -0
- package/dist/fields/sharedConfig.js.map +1 -0
- package/dist/fields/types.d.ts +88 -0
- package/dist/flow/engine.d.ts +17 -0
- package/dist/flow/engine.js +24 -0
- package/dist/flow/engine.js.map +1 -0
- package/dist/flow/normalizeFlow.js +35 -0
- package/dist/flow/normalizeFlow.js.map +1 -0
- package/dist/{types-DsJ_6kGJ.d.ts → flow/types.d.ts} +2 -2
- package/dist/index.d.ts +74 -4
- package/dist/index.js +40 -1889
- package/dist/index.js.map +1 -1
- package/dist/plugin/access.js +12 -0
- package/dist/plugin/access.js.map +1 -0
- package/dist/plugin/registerCollections.js +40 -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/prefill/valuesFromSearchParams.d.ts +18 -0
- package/dist/prefill/valuesFromSearchParams.js +45 -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/registry.d.ts +15 -0
- package/dist/presentations/registry.js +15 -0
- package/dist/presentations/registry.js.map +1 -0
- package/dist/presentations/types.d.ts +18 -0
- package/dist/react/Form.d.ts +81 -0
- package/dist/react/Form.js +457 -0
- package/dist/react/Form.js.map +1 -0
- package/dist/react/FormContext.d.ts +16 -0
- package/dist/react/FormContext.js +14 -0
- package/dist/react/FormContext.js.map +1 -0
- package/dist/react/FormLayout.d.ts +20 -0
- package/dist/react/FormLayout.js +14 -0
- package/dist/react/FormLayout.js.map +1 -0
- package/dist/react/FormResults.d.ts +25 -0
- package/dist/react/FormResults.js +85 -0
- package/dist/react/FormResults.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 +32 -0
- package/dist/react/Poll.js +77 -0
- package/dist/react/Poll.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 +32 -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 +56 -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 +26 -0
- package/dist/react/primitives/Checkbox.js +20 -0
- package/dist/react/primitives/Checkbox.js.map +1 -0
- package/dist/react/primitives/FieldShell.d.ts +31 -0
- package/dist/react/primitives/FieldShell.js +51 -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 +30 -0
- package/dist/react/renderers/calculation.js.map +1 -0
- package/dist/react/renderers/checkbox.js +35 -0
- package/dist/react/renderers/checkbox.js.map +1 -0
- package/dist/react/renderers/consent.js +54 -0
- package/dist/react/renderers/consent.js.map +1 -0
- package/dist/react/renderers/email.js +37 -0
- package/dist/react/renderers/email.js.map +1 -0
- package/dist/react/renderers/file.js +92 -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 +26 -0
- package/dist/react/renderers/index.js.map +1 -0
- package/dist/react/renderers/number.js +40 -0
- package/dist/react/renderers/number.js.map +1 -0
- package/dist/react/renderers/select.js +38 -0
- package/dist/react/renderers/select.js.map +1 -0
- package/dist/react/renderers/text.js +37 -0
- package/dist/react/renderers/text.js.map +1 -0
- package/dist/react/renderers/textarea.js +36 -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 +15 -0
- package/dist/react/state.js +70 -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/toFormDocument.d.ts +24 -0
- package/dist/react/toFormDocument.js +22 -0
- package/dist/react/toFormDocument.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 +14 -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 +30 -0
- package/dist/react/validateField.js.map +1 -0
- package/dist/recall/interpolate.d.ts +10 -0
- package/dist/recall/interpolate.js +16 -0
- package/dist/recall/interpolate.js.map +1 -0
- package/dist/recall/resolver.d.ts +22 -0
- package/dist/recall/resolver.js +36 -0
- package/dist/recall/resolver.js.map +1 -0
- package/dist/spam/captcha.d.ts +12 -0
- package/dist/spam/captcha.js +11 -0
- package/dist/spam/captcha.js.map +1 -0
- package/dist/spam/constants.d.ts +12 -0
- package/dist/spam/constants.js +15 -0
- package/dist/spam/constants.js.map +1 -0
- package/dist/spam/identify.d.ts +12 -0
- package/dist/spam/identify.js +20 -0
- package/dist/spam/identify.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 +42 -0
- package/dist/spam/resolveSpam.js.map +1 -0
- package/dist/spam/spamGuard.js +68 -0
- package/dist/spam/spamGuard.js.map +1 -0
- package/dist/spam/types.d.ts +73 -0
- package/dist/spam/uploadHooks.js +33 -0
- package/dist/spam/uploadHooks.js.map +1 -0
- package/dist/submissions/SubmissionAnswers.d.ts +16 -0
- package/dist/submissions/SubmissionAnswers.js +57 -0
- package/dist/submissions/SubmissionAnswers.js.map +1 -0
- package/dist/submissions/runSubmission.js +205 -0
- package/dist/submissions/runSubmission.js.map +1 -0
- package/dist/submissions/types.d.ts +33 -0
- package/dist/submissions/validateSubmission.js +59 -0
- package/dist/submissions/validateSubmission.js.map +1 -0
- package/dist/translations/en.d.ts +12 -0
- package/dist/{translations-edMqq_2e.js → translations/en.js} +3 -22
- package/dist/translations/en.js.map +1 -0
- package/dist/translations/index.d.ts +14 -0
- package/dist/translations/index.js +26 -0
- package/dist/translations/index.js.map +1 -0
- package/dist/translations/keys.d.ts +132 -0
- package/dist/{keys-N5xGiUsh.js → translations/keys.js} +2 -2
- package/dist/translations/keys.js.map +1 -0
- package/dist/translations/makeTranslate.d.ts +11 -0
- package/dist/translations/makeTranslate.js +11 -0
- package/dist/translations/makeTranslate.js.map +1 -0
- package/dist/translations/server.js +25 -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 +27 -0
- package/dist/uploads/captureFileRef.js +34 -0
- package/dist/uploads/captureFileRef.js.map +1 -0
- package/dist/uploads/resolveFileRef.d.ts +26 -0
- package/dist/uploads/resolveFileRef.js +44 -0
- package/dist/uploads/resolveFileRef.js.map +1 -0
- package/dist/uploads/types.d.ts +20 -0
- package/dist/validation/buildRuleBlocks.js +46 -0
- package/dist/validation/buildRuleBlocks.js.map +1 -0
- package/dist/validation/builtin/email.js +19 -0
- package/dist/validation/builtin/email.js.map +1 -0
- package/dist/validation/builtin/index.js +27 -0
- package/dist/validation/builtin/index.js.map +1 -0
- package/dist/validation/builtin/matchesField.js +20 -0
- package/dist/validation/builtin/matchesField.js.map +1 -0
- package/dist/validation/builtin/max.js +21 -0
- package/dist/validation/builtin/max.js.map +1 -0
- package/dist/validation/builtin/maxLength.js +26 -0
- package/dist/validation/builtin/maxLength.js.map +1 -0
- package/dist/validation/builtin/min.js +21 -0
- package/dist/validation/builtin/min.js.map +1 -0
- package/dist/validation/builtin/minLength.js +26 -0
- package/dist/validation/builtin/minLength.js.map +1 -0
- package/dist/validation/builtin/notAlreadySubmitted.js +32 -0
- package/dist/validation/builtin/notAlreadySubmitted.js.map +1 -0
- package/dist/validation/builtin/oneOf.js +34 -0
- package/dist/validation/builtin/oneOf.js.map +1 -0
- package/dist/validation/builtin/pattern.js +41 -0
- package/dist/validation/builtin/pattern.js.map +1 -0
- package/dist/validation/builtin/url.js +22 -0
- package/dist/validation/builtin/url.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/message.js +14 -0
- package/dist/validation/message.js.map +1 -0
- package/dist/validation/registry.d.ts +10 -0
- package/dist/validation/registry.js +20 -0
- package/dist/validation/registry.js.map +1 -0
- package/dist/validation/runValidation.js +111 -0
- package/dist/validation/runValidation.js.map +1 -0
- package/dist/validation/types.d.ts +76 -0
- package/package.json +8 -5
- package/styles/form-builder.css +201 -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.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.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/react/presentation/Backdrop.d.ts
|
|
2
|
+
type BackdropProps = {
|
|
3
|
+
onClick?: () => void;
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
/** A full-viewport backdrop behind an overlay surface. Styling comes from the `data-fb-backdrop` hook. */
|
|
7
|
+
declare const Backdrop: ({
|
|
8
|
+
onClick,
|
|
9
|
+
className
|
|
10
|
+
}: BackdropProps) => import("react").DetailedReactHTMLElement<{
|
|
11
|
+
'data-fb-backdrop': string;
|
|
12
|
+
className: string | undefined;
|
|
13
|
+
onClick: (() => void) | undefined;
|
|
14
|
+
'aria-hidden': true;
|
|
15
|
+
}, HTMLElement>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Backdrop, BackdropProps };
|
|
18
|
+
//# sourceMappingURL=Backdrop.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
//#region src/react/presentation/Backdrop.tsx
|
|
4
|
+
/** A full-viewport backdrop behind an overlay surface. Styling comes from the `data-fb-backdrop` hook. */
|
|
5
|
+
const Backdrop = ({ onClick, className }) => createElement("div", {
|
|
6
|
+
"data-fb-backdrop": "",
|
|
7
|
+
className,
|
|
8
|
+
onClick,
|
|
9
|
+
"aria-hidden": true
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Backdrop };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=Backdrop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Backdrop.js","names":[],"sources":["../../../src/react/presentation/Backdrop.tsx"],"sourcesContent":["'use client'\n\nimport { createElement } from 'react'\n\nexport type BackdropProps = {\n\tonClick?: () => void\n\tclassName?: string\n}\n\n/** A full-viewport backdrop behind an overlay surface. Styling comes from the `data-fb-backdrop` hook. */\nexport const Backdrop = ({ onClick, className }: BackdropProps) =>\n\tcreateElement('div', { 'data-fb-backdrop': '', className, onClick, 'aria-hidden': true })\n"],"mappings":";;;;AAUA,MAAa,YAAY,EAAE,SAAS,gBACnC,cAAc,OAAO;CAAE,oBAAoB;CAAI;CAAW;CAAS,eAAe;AAAK,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/react/presentation/DialogSurface.d.ts
|
|
4
|
+
type DialogSurfaceProps = {
|
|
5
|
+
open: boolean;
|
|
6
|
+
onClose: () => void; /** Accessible name; pass either label or labelledBy. */
|
|
7
|
+
label?: string;
|
|
8
|
+
labelledBy?: string; /** CSS data hook, e.g. 'modal' | 'drawer'. */
|
|
9
|
+
surface?: string;
|
|
10
|
+
closeLabel?: string;
|
|
11
|
+
closeOnEscape?: boolean;
|
|
12
|
+
closeOnOutsideClick?: boolean;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Accessible, dependency-free overlay surface: backdrop + role=dialog/aria-modal, focus-trap,
|
|
17
|
+
* scroll-lock, Escape/outside-click dismiss, initial focus, and focus restore on close. Composes the
|
|
18
|
+
* exported primitives so a consumer can rebuild it from the same parts.
|
|
19
|
+
*/
|
|
20
|
+
declare const DialogSurface: ({
|
|
21
|
+
open,
|
|
22
|
+
onClose,
|
|
23
|
+
label,
|
|
24
|
+
labelledBy,
|
|
25
|
+
surface,
|
|
26
|
+
closeLabel,
|
|
27
|
+
closeOnEscape,
|
|
28
|
+
closeOnOutsideClick,
|
|
29
|
+
children
|
|
30
|
+
}: DialogSurfaceProps) => import("react").ReactElement<{
|
|
31
|
+
'data-fb-overlay': string;
|
|
32
|
+
}, string | import("react").JSXElementConstructor<any>> | null;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { DialogSurface, DialogSurfaceProps };
|
|
35
|
+
//# sourceMappingURL=DialogSurface.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Backdrop } from "./Backdrop.js";
|
|
3
|
+
import { useDismiss } from "./useDismiss.js";
|
|
4
|
+
import { useFocusTrap } from "./useFocusTrap.js";
|
|
5
|
+
import { useScrollLock } from "./useScrollLock.js";
|
|
6
|
+
import { createElement, useEffect, useRef } from "react";
|
|
7
|
+
//#region src/react/presentation/DialogSurface.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Accessible, dependency-free overlay surface: backdrop + role=dialog/aria-modal, focus-trap,
|
|
10
|
+
* scroll-lock, Escape/outside-click dismiss, initial focus, and focus restore on close. Composes the
|
|
11
|
+
* exported primitives so a consumer can rebuild it from the same parts.
|
|
12
|
+
*/
|
|
13
|
+
const DialogSurface = ({ open, onClose, label, labelledBy, surface, closeLabel = "Close", closeOnEscape, closeOnOutsideClick, children }) => {
|
|
14
|
+
const ref = useRef(null);
|
|
15
|
+
const restoreRef = useRef(null);
|
|
16
|
+
useScrollLock(open);
|
|
17
|
+
useFocusTrap(ref, open);
|
|
18
|
+
useDismiss({
|
|
19
|
+
active: open,
|
|
20
|
+
onDismiss: onClose,
|
|
21
|
+
closeOnEscape,
|
|
22
|
+
closeOnOutsideClick
|
|
23
|
+
}, ref);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!open) return;
|
|
26
|
+
restoreRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
27
|
+
ref.current?.focus();
|
|
28
|
+
return () => {
|
|
29
|
+
restoreRef.current?.focus();
|
|
30
|
+
};
|
|
31
|
+
}, [open]);
|
|
32
|
+
if (!open) return null;
|
|
33
|
+
return createElement("div", { "data-fb-overlay": surface ?? "" }, [createElement(Backdrop, {
|
|
34
|
+
key: "backdrop",
|
|
35
|
+
onClick: onClose
|
|
36
|
+
}), createElement("div", {
|
|
37
|
+
key: "surface",
|
|
38
|
+
ref,
|
|
39
|
+
role: "dialog",
|
|
40
|
+
"aria-modal": true,
|
|
41
|
+
"aria-label": labelledBy ? void 0 : label,
|
|
42
|
+
"aria-labelledby": labelledBy,
|
|
43
|
+
"data-fb-dialog": surface ?? "",
|
|
44
|
+
tabIndex: -1
|
|
45
|
+
}, [createElement("button", {
|
|
46
|
+
key: "close",
|
|
47
|
+
type: "button",
|
|
48
|
+
"data-fb-dialog-close": "",
|
|
49
|
+
"aria-label": closeLabel,
|
|
50
|
+
onClick: onClose
|
|
51
|
+
}, "×"), createElement("div", { key: "body" }, children)])]);
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { DialogSurface };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=DialogSurface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogSurface.js","names":[],"sources":["../../../src/react/presentation/DialogSurface.tsx"],"sourcesContent":["'use client'\n\nimport { createElement, type ReactNode, useEffect, useRef } from 'react'\nimport { Backdrop } from './Backdrop'\nimport { useDismiss } from './useDismiss'\nimport { useFocusTrap } from './useFocusTrap'\nimport { useScrollLock } from './useScrollLock'\n\nexport type DialogSurfaceProps = {\n\topen: boolean\n\tonClose: () => void\n\t/** Accessible name; pass either label or labelledBy. */\n\tlabel?: string\n\tlabelledBy?: string\n\t/** CSS data hook, e.g. 'modal' | 'drawer'. */\n\tsurface?: string\n\tcloseLabel?: string\n\tcloseOnEscape?: boolean\n\tcloseOnOutsideClick?: boolean\n\tchildren?: ReactNode\n}\n\n/**\n * Accessible, dependency-free overlay surface: backdrop + role=dialog/aria-modal, focus-trap,\n * scroll-lock, Escape/outside-click dismiss, initial focus, and focus restore on close. Composes the\n * exported primitives so a consumer can rebuild it from the same parts.\n */\nexport const DialogSurface = ({\n\topen,\n\tonClose,\n\tlabel,\n\tlabelledBy,\n\tsurface,\n\tcloseLabel = 'Close',\n\tcloseOnEscape,\n\tcloseOnOutsideClick,\n\tchildren,\n}: DialogSurfaceProps) => {\n\tconst ref = useRef<HTMLDivElement>(null)\n\tconst restoreRef = useRef<HTMLElement | null>(null)\n\n\tuseScrollLock(open)\n\tuseFocusTrap(ref, open)\n\tuseDismiss({ active: open, onDismiss: onClose, closeOnEscape, closeOnOutsideClick }, ref)\n\n\tuseEffect(() => {\n\t\tif (!open) {\n\t\t\treturn\n\t\t}\n\t\trestoreRef.current =\n\t\t\tdocument.activeElement instanceof HTMLElement ? document.activeElement : null\n\t\tref.current?.focus()\n\t\treturn () => {\n\t\t\trestoreRef.current?.focus()\n\t\t}\n\t}, [open])\n\n\tif (!open) {\n\t\treturn null\n\t}\n\n\treturn createElement('div', { 'data-fb-overlay': surface ?? '' }, [\n\t\tcreateElement(Backdrop, { key: 'backdrop', onClick: onClose }),\n\t\tcreateElement(\n\t\t\t'div',\n\t\t\t{\n\t\t\t\tkey: 'surface',\n\t\t\t\tref,\n\t\t\t\trole: 'dialog',\n\t\t\t\t'aria-modal': true,\n\t\t\t\t'aria-label': labelledBy ? undefined : label,\n\t\t\t\t'aria-labelledby': labelledBy,\n\t\t\t\t'data-fb-dialog': surface ?? '',\n\t\t\t\ttabIndex: -1,\n\t\t\t},\n\t\t\t[\n\t\t\t\tcreateElement(\n\t\t\t\t\t'button',\n\t\t\t\t\t{\n\t\t\t\t\t\tkey: 'close',\n\t\t\t\t\t\ttype: 'button',\n\t\t\t\t\t\t'data-fb-dialog-close': '',\n\t\t\t\t\t\t'aria-label': closeLabel,\n\t\t\t\t\t\tonClick: onClose,\n\t\t\t\t\t},\n\t\t\t\t\t'\\xd7'\n\t\t\t\t),\n\t\t\t\tcreateElement('div', { key: 'body' }, children),\n\t\t\t]\n\t\t),\n\t])\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,MAAa,iBAAiB,EAC7B,MACA,SACA,OACA,YACA,SACA,aAAa,SACb,eACA,qBACA,eACyB;CACzB,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,aAAa,OAA2B,IAAI;CAElD,cAAc,IAAI;CAClB,aAAa,KAAK,IAAI;CACtB,WAAW;EAAE,QAAQ;EAAM,WAAW;EAAS;EAAe;CAAoB,GAAG,GAAG;CAExF,gBAAgB;EACf,IAAI,CAAC,MACJ;EAED,WAAW,UACV,SAAS,yBAAyB,cAAc,SAAS,gBAAgB;EAC1E,IAAI,SAAS,MAAM;EACnB,aAAa;GACZ,WAAW,SAAS,MAAM;EAC3B;CACD,GAAG,CAAC,IAAI,CAAC;CAET,IAAI,CAAC,MACJ,OAAO;CAGR,OAAO,cAAc,OAAO,EAAE,mBAAmB,WAAW,GAAG,GAAG,CACjE,cAAc,UAAU;EAAE,KAAK;EAAY,SAAS;CAAQ,CAAC,GAC7D,cACC,OACA;EACC,KAAK;EACL;EACA,MAAM;EACN,cAAc;EACd,cAAc,aAAa,KAAA,IAAY;EACvC,mBAAmB;EACnB,kBAAkB,WAAW;EAC7B,UAAU;CACX,GACA,CACC,cACC,UACA;EACC,KAAK;EACL,MAAM;EACN,wBAAwB;EACxB,cAAc;EACd,SAAS;CACV,GACA,GACD,GACA,cAAc,OAAO,EAAE,KAAK,OAAO,GAAG,QAAQ,CAC/C,CACD,CACD,CAAC;AACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FormPresentation } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/react/presentation/presentations.d.ts
|
|
4
|
+
declare const defaultPresentations: Record<string, FormPresentation>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { defaultPresentations };
|
|
7
|
+
//# sourceMappingURL=presentations.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defaultPresentationDescriptors } from "../../presentations/defaults.js";
|
|
3
|
+
import { DialogSurface } from "./DialogSurface.js";
|
|
4
|
+
import { createElement } from "react";
|
|
5
|
+
//#region src/react/presentation/presentations.tsx
|
|
6
|
+
const overlayWrapper = (surface) => {
|
|
7
|
+
const Wrapper = ({ open, onClose, title, closeLabel, children }) => createElement(DialogSurface, {
|
|
8
|
+
open,
|
|
9
|
+
onClose,
|
|
10
|
+
label: title,
|
|
11
|
+
surface,
|
|
12
|
+
closeLabel
|
|
13
|
+
}, children);
|
|
14
|
+
Wrapper.displayName = `${surface}Wrapper`;
|
|
15
|
+
return Wrapper;
|
|
16
|
+
};
|
|
17
|
+
const defaultPresentations = {
|
|
18
|
+
page: defaultPresentationDescriptors.page,
|
|
19
|
+
inline: defaultPresentationDescriptors.inline,
|
|
20
|
+
modal: {
|
|
21
|
+
...defaultPresentationDescriptors.modal,
|
|
22
|
+
Wrapper: overlayWrapper("modal")
|
|
23
|
+
},
|
|
24
|
+
drawer: {
|
|
25
|
+
...defaultPresentationDescriptors.drawer,
|
|
26
|
+
Wrapper: overlayWrapper("drawer")
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { defaultPresentations };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=presentations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentations.js","names":[],"sources":["../../../src/react/presentation/presentations.tsx"],"sourcesContent":["'use client'\n\nimport { createElement } from 'react'\nimport { defaultPresentationDescriptors } from '../../presentations/defaults'\nimport { DialogSurface } from './DialogSurface'\nimport type { FormPresentation, PresentationWrapperProps } from './types'\n\nconst overlayWrapper = (surface: 'modal' | 'drawer') => {\n\tconst Wrapper = ({ open, onClose, title, closeLabel, children }: PresentationWrapperProps) =>\n\t\tcreateElement(DialogSurface, { open, onClose, label: title, surface, closeLabel }, children)\n\tWrapper.displayName = `${surface}Wrapper`\n\treturn Wrapper\n}\n\nexport const defaultPresentations: Record<string, FormPresentation> = {\n\tpage: defaultPresentationDescriptors.page,\n\tinline: defaultPresentationDescriptors.inline,\n\tmodal: { ...defaultPresentationDescriptors.modal, Wrapper: overlayWrapper('modal') },\n\tdrawer: { ...defaultPresentationDescriptors.drawer, Wrapper: overlayWrapper('drawer') },\n}\n"],"mappings":";;;;;AAOA,MAAM,kBAAkB,YAAgC;CACvD,MAAM,WAAW,EAAE,MAAM,SAAS,OAAO,YAAY,eACpD,cAAc,eAAe;EAAE;EAAM;EAAS,OAAO;EAAO;EAAS;CAAW,GAAG,QAAQ;CAC5F,QAAQ,cAAc,GAAG,QAAQ;CACjC,OAAO;AACR;AAEA,MAAa,uBAAyD;CACrE,MAAM,+BAA+B;CACrC,QAAQ,+BAA+B;CACvC,OAAO;EAAE,GAAG,+BAA+B;EAAO,SAAS,eAAe,OAAO;CAAE;CACnF,QAAQ;EAAE,GAAG,+BAA+B;EAAQ,SAAS,eAAe,QAAQ;CAAE;AACvF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FormPresentation } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/react/presentation/registry.d.ts
|
|
4
|
+
type PresentationRegistry = Map<string, FormPresentation>;
|
|
5
|
+
/** `false` removes, `true` keeps the default, a presentation adds or replaces one. */
|
|
6
|
+
type PresentationOption = boolean | FormPresentation;
|
|
7
|
+
type PresentationsConfig = Record<string, PresentationOption>;
|
|
8
|
+
declare const resolvePresentations: (defaults?: Record<string, FormPresentation>, config?: PresentationsConfig) => PresentationRegistry;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { PresentationOption, PresentationRegistry, PresentationsConfig, resolvePresentations };
|
|
11
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defaultPresentations } from "./presentations.js";
|
|
2
|
+
//#region src/react/presentation/registry.ts
|
|
3
|
+
const resolvePresentations = (defaults = defaultPresentations, config = {}) => {
|
|
4
|
+
const registry = new Map(Object.entries(defaults));
|
|
5
|
+
for (const [name, option] of Object.entries(config)) if (option === false) registry.delete(name);
|
|
6
|
+
else if (option === true) {} else registry.set(name, option);
|
|
7
|
+
return registry;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { resolvePresentations };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","names":[],"sources":["../../../src/react/presentation/registry.ts"],"sourcesContent":["import { defaultPresentations } from './presentations'\nimport type { FormPresentation } from './types'\n\nexport type PresentationRegistry = Map<string, FormPresentation>\n\n/** `false` removes, `true` keeps the default, a presentation adds or replaces one. */\nexport type PresentationOption = boolean | FormPresentation\n\nexport type PresentationsConfig = Record<string, PresentationOption>\n\nexport const resolvePresentations = (\n\tdefaults: Record<string, FormPresentation> = defaultPresentations,\n\tconfig: PresentationsConfig = {}\n): PresentationRegistry => {\n\tconst registry: PresentationRegistry = new Map(Object.entries(defaults))\n\tfor (const [name, option] of Object.entries(config)) {\n\t\tif (option === false) {\n\t\t\tregistry.delete(name)\n\t\t} else if (option === true) {\n\t\t\t// keep the default\n\t\t} else {\n\t\t\tregistry.set(name, option)\n\t\t}\n\t}\n\treturn registry\n}\n"],"mappings":";;AAUA,MAAa,wBACZ,WAA6C,sBAC7C,SAA8B,CAAC,MACL;CAC1B,MAAM,WAAiC,IAAI,IAAI,OAAO,QAAQ,QAAQ,CAAC;CACvE,KAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,MAAM,GACjD,IAAI,WAAW,OACd,SAAS,OAAO,IAAI;MACd,IAAI,WAAW,MAAM,CAE5B,OACC,SAAS,IAAI,MAAM,MAAM;CAG3B,OAAO;AACR"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PresentationDescriptor } from "../../presentations/types.js";
|
|
2
|
+
import { ComponentType, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/react/presentation/types.d.ts
|
|
5
|
+
type PresentationWrapperProps = {
|
|
6
|
+
presentation: FormPresentation;
|
|
7
|
+
open: boolean;
|
|
8
|
+
onClose: () => void; /** Accessible name for an overlay surface (e.g. the form title). */
|
|
9
|
+
title?: string; /** Label for the overlay close control. */
|
|
10
|
+
closeLabel?: string;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/** A descriptor plus an optional React wrapper. page/inline omit the wrapper; modal/drawer provide one. */
|
|
14
|
+
type FormPresentation = PresentationDescriptor & {
|
|
15
|
+
Wrapper?: ComponentType<PresentationWrapperProps>;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { FormPresentation, PresentationWrapperProps };
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/react/presentation/useDismiss.d.ts
|
|
4
|
+
type UseDismissOptions = {
|
|
5
|
+
active: boolean;
|
|
6
|
+
onDismiss: () => void;
|
|
7
|
+
closeOnEscape?: boolean;
|
|
8
|
+
closeOnOutsideClick?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/** Dismiss-on-Escape and dismiss-on-outside-pointerdown for an overlay surface. */
|
|
11
|
+
declare const useDismiss: ({
|
|
12
|
+
active,
|
|
13
|
+
onDismiss,
|
|
14
|
+
closeOnEscape,
|
|
15
|
+
closeOnOutsideClick
|
|
16
|
+
}: UseDismissOptions, ref: RefObject<HTMLElement | null>) => void;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { UseDismissOptions, useDismiss };
|
|
19
|
+
//# sourceMappingURL=useDismiss.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
//#region src/react/presentation/useDismiss.ts
|
|
4
|
+
/** Dismiss-on-Escape and dismiss-on-outside-pointerdown for an overlay surface. */
|
|
5
|
+
const useDismiss = ({ active, onDismiss, closeOnEscape = true, closeOnOutsideClick = true }, ref) => {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!active) return;
|
|
8
|
+
const onKeyDown = (event) => {
|
|
9
|
+
if (closeOnEscape && event.key === "Escape") onDismiss();
|
|
10
|
+
};
|
|
11
|
+
const onPointerDown = (event) => {
|
|
12
|
+
if (!closeOnOutsideClick) return;
|
|
13
|
+
const node = ref.current;
|
|
14
|
+
if (node && event.target instanceof Node && !node.contains(event.target)) onDismiss();
|
|
15
|
+
};
|
|
16
|
+
document.addEventListener("keydown", onKeyDown);
|
|
17
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
18
|
+
return () => {
|
|
19
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
20
|
+
document.removeEventListener("pointerdown", onPointerDown);
|
|
21
|
+
};
|
|
22
|
+
}, [
|
|
23
|
+
active,
|
|
24
|
+
onDismiss,
|
|
25
|
+
closeOnEscape,
|
|
26
|
+
closeOnOutsideClick,
|
|
27
|
+
ref
|
|
28
|
+
]);
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { useDismiss };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=useDismiss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDismiss.js","names":[],"sources":["../../../src/react/presentation/useDismiss.ts"],"sourcesContent":["'use client'\n\nimport { type RefObject, useEffect } from 'react'\n\nexport type UseDismissOptions = {\n\tactive: boolean\n\tonDismiss: () => void\n\tcloseOnEscape?: boolean\n\tcloseOnOutsideClick?: boolean\n}\n\n/** Dismiss-on-Escape and dismiss-on-outside-pointerdown for an overlay surface. */\nexport const useDismiss = (\n\t{ active, onDismiss, closeOnEscape = true, closeOnOutsideClick = true }: UseDismissOptions,\n\tref: RefObject<HTMLElement | null>\n): void => {\n\tuseEffect(() => {\n\t\tif (!active) {\n\t\t\treturn\n\t\t}\n\t\tconst onKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (closeOnEscape && event.key === 'Escape') {\n\t\t\t\tonDismiss()\n\t\t\t}\n\t\t}\n\t\tconst onPointerDown = (event: Event) => {\n\t\t\tif (!closeOnOutsideClick) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst node = ref.current\n\t\t\tif (node && event.target instanceof Node && !node.contains(event.target)) {\n\t\t\t\tonDismiss()\n\t\t\t}\n\t\t}\n\t\tdocument.addEventListener('keydown', onKeyDown)\n\t\tdocument.addEventListener('pointerdown', onPointerDown)\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('keydown', onKeyDown)\n\t\t\tdocument.removeEventListener('pointerdown', onPointerDown)\n\t\t}\n\t}, [active, onDismiss, closeOnEscape, closeOnOutsideClick, ref])\n}\n"],"mappings":";;;;AAYA,MAAa,cACZ,EAAE,QAAQ,WAAW,gBAAgB,MAAM,sBAAsB,QACjE,QACU;CACV,gBAAgB;EACf,IAAI,CAAC,QACJ;EAED,MAAM,aAAa,UAAyB;GAC3C,IAAI,iBAAiB,MAAM,QAAQ,UAClC,UAAU;EAEZ;EACA,MAAM,iBAAiB,UAAiB;GACvC,IAAI,CAAC,qBACJ;GAED,MAAM,OAAO,IAAI;GACjB,IAAI,QAAQ,MAAM,kBAAkB,QAAQ,CAAC,KAAK,SAAS,MAAM,MAAM,GACtE,UAAU;EAEZ;EACA,SAAS,iBAAiB,WAAW,SAAS;EAC9C,SAAS,iBAAiB,eAAe,aAAa;EACtD,aAAa;GACZ,SAAS,oBAAoB,WAAW,SAAS;GACjD,SAAS,oBAAoB,eAAe,aAAa;EAC1D;CACD,GAAG;EAAC;EAAQ;EAAW;EAAe;EAAqB;CAAG,CAAC;AAChE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/react/presentation/useFocusTrap.d.ts
|
|
4
|
+
/** Trap Tab focus within the container while active. */
|
|
5
|
+
declare const useFocusTrap: (ref: RefObject<HTMLElement | null>, active: boolean) => void;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { useFocusTrap };
|
|
8
|
+
//# sourceMappingURL=useFocusTrap.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
//#region src/react/presentation/useFocusTrap.ts
|
|
4
|
+
const FOCUSABLE = "a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex=\"-1\"])";
|
|
5
|
+
/** Trap Tab focus within the container while active. */
|
|
6
|
+
const useFocusTrap = (ref, active) => {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (!active) return;
|
|
9
|
+
const node = ref.current;
|
|
10
|
+
if (!node) return;
|
|
11
|
+
const onKeyDown = (event) => {
|
|
12
|
+
if (event.key !== "Tab") return;
|
|
13
|
+
const focusable = Array.from(node.querySelectorAll(FOCUSABLE));
|
|
14
|
+
if (focusable.length === 0) return;
|
|
15
|
+
const first = focusable[0];
|
|
16
|
+
const last = focusable[focusable.length - 1];
|
|
17
|
+
const activeEl = document.activeElement;
|
|
18
|
+
if (event.shiftKey && activeEl === first) {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
last.focus();
|
|
21
|
+
} else if (!event.shiftKey && activeEl === last) {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
first.focus();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
node.addEventListener("keydown", onKeyDown);
|
|
27
|
+
return () => {
|
|
28
|
+
node.removeEventListener("keydown", onKeyDown);
|
|
29
|
+
};
|
|
30
|
+
}, [ref, active]);
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { useFocusTrap };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=useFocusTrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFocusTrap.js","names":[],"sources":["../../../src/react/presentation/useFocusTrap.ts"],"sourcesContent":["'use client'\n\nimport { type RefObject, useEffect } from 'react'\n\nconst FOCUSABLE =\n\t'a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex=\"-1\"])'\n\n/** Trap Tab focus within the container while active. */\nexport const useFocusTrap = (ref: RefObject<HTMLElement | null>, active: boolean): void => {\n\tuseEffect(() => {\n\t\tif (!active) {\n\t\t\treturn\n\t\t}\n\t\tconst node = ref.current\n\t\tif (!node) {\n\t\t\treturn\n\t\t}\n\t\tconst onKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (event.key !== 'Tab') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst focusable = Array.from(node.querySelectorAll<HTMLElement>(FOCUSABLE))\n\t\t\tif (focusable.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst first = focusable[0] as HTMLElement\n\t\t\tconst last = focusable[focusable.length - 1] as HTMLElement\n\t\t\tconst activeEl = document.activeElement\n\t\t\tif (event.shiftKey && activeEl === first) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tlast.focus()\n\t\t\t} else if (!event.shiftKey && activeEl === last) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tfirst.focus()\n\t\t\t}\n\t\t}\n\t\tnode.addEventListener('keydown', onKeyDown)\n\t\treturn () => {\n\t\t\tnode.removeEventListener('keydown', onKeyDown)\n\t\t}\n\t}, [ref, active])\n}\n"],"mappings":";;;AAIA,MAAM,YACL;;AAGD,MAAa,gBAAgB,KAAoC,WAA0B;CAC1F,gBAAgB;EACf,IAAI,CAAC,QACJ;EAED,MAAM,OAAO,IAAI;EACjB,IAAI,CAAC,MACJ;EAED,MAAM,aAAa,UAAyB;GAC3C,IAAI,MAAM,QAAQ,OACjB;GAED,MAAM,YAAY,MAAM,KAAK,KAAK,iBAA8B,SAAS,CAAC;GAC1E,IAAI,UAAU,WAAW,GACxB;GAED,MAAM,QAAQ,UAAU;GACxB,MAAM,OAAO,UAAU,UAAU,SAAS;GAC1C,MAAM,WAAW,SAAS;GAC1B,IAAI,MAAM,YAAY,aAAa,OAAO;IACzC,MAAM,eAAe;IACrB,KAAK,MAAM;GACZ,OAAO,IAAI,CAAC,MAAM,YAAY,aAAa,MAAM;IAChD,MAAM,eAAe;IACrB,MAAM,MAAM;GACb;EACD;EACA,KAAK,iBAAiB,WAAW,SAAS;EAC1C,aAAa;GACZ,KAAK,oBAAoB,WAAW,SAAS;EAC9C;CACD,GAAG,CAAC,KAAK,MAAM,CAAC;AACjB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/react/presentation/useScrollLock.d.ts
|
|
2
|
+
/** Lock body scroll while active; restores the prior value on cleanup. */
|
|
3
|
+
declare const useScrollLock: (active: boolean) => void;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { useScrollLock };
|
|
6
|
+
//# sourceMappingURL=useScrollLock.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
//#region src/react/presentation/useScrollLock.ts
|
|
4
|
+
/** Lock body scroll while active; restores the prior value on cleanup. */
|
|
5
|
+
const useScrollLock = (active) => {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!active) return;
|
|
8
|
+
const previous = document.body.style.overflow;
|
|
9
|
+
document.body.style.overflow = "hidden";
|
|
10
|
+
return () => {
|
|
11
|
+
document.body.style.overflow = previous;
|
|
12
|
+
};
|
|
13
|
+
}, [active]);
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { useScrollLock };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=useScrollLock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollLock.js","names":[],"sources":["../../../src/react/presentation/useScrollLock.ts"],"sourcesContent":["'use client'\n\nimport { useEffect } from 'react'\n\n/** Lock body scroll while active; restores the prior value on cleanup. */\nexport const useScrollLock = (active: boolean): void => {\n\tuseEffect(() => {\n\t\tif (!active) {\n\t\t\treturn\n\t\t}\n\t\tconst previous = document.body.style.overflow\n\t\tdocument.body.style.overflow = 'hidden'\n\t\treturn () => {\n\t\t\tdocument.body.style.overflow = previous\n\t\t}\n\t}, [active])\n}\n"],"mappings":";;;;AAKA,MAAa,iBAAiB,WAA0B;CACvD,gBAAgB;EACf,IAAI,CAAC,QACJ;EAED,MAAM,WAAW,SAAS,KAAK,MAAM;EACrC,SAAS,KAAK,MAAM,WAAW;EAC/B,aAAa;GACZ,SAAS,KAAK,MAAM,WAAW;EAChC;CACD,GAAG,CAAC,MAAM,CAAC;AACZ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/react/primitives/Checkbox.d.ts
|
|
2
|
+
type CheckboxProps = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
checked: boolean;
|
|
6
|
+
onChange: (checked: boolean) => void;
|
|
7
|
+
onBlur?: () => void;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
invalid?: boolean;
|
|
11
|
+
describedById?: string;
|
|
12
|
+
};
|
|
13
|
+
declare const Checkbox: ({
|
|
14
|
+
id,
|
|
15
|
+
name,
|
|
16
|
+
checked,
|
|
17
|
+
onChange,
|
|
18
|
+
onBlur,
|
|
19
|
+
required,
|
|
20
|
+
disabled,
|
|
21
|
+
invalid,
|
|
22
|
+
describedById
|
|
23
|
+
}: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Checkbox, CheckboxProps };
|
|
26
|
+
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/react/primitives/Checkbox.tsx
|
|
4
|
+
const Checkbox = ({ id, name, checked, onChange, onBlur, required, disabled, invalid, describedById }) => /* @__PURE__ */ jsx("input", {
|
|
5
|
+
type: "checkbox",
|
|
6
|
+
className: "fb-checkbox",
|
|
7
|
+
id,
|
|
8
|
+
name,
|
|
9
|
+
checked,
|
|
10
|
+
required,
|
|
11
|
+
disabled,
|
|
12
|
+
"aria-invalid": invalid || void 0,
|
|
13
|
+
"aria-describedby": describedById,
|
|
14
|
+
onChange: (e) => onChange(e.target.checked),
|
|
15
|
+
onBlur
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Checkbox };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":[],"sources":["../../../src/react/primitives/Checkbox.tsx"],"sourcesContent":["'use client'\n\nexport type CheckboxProps = {\n\tid: string\n\tname: string\n\tchecked: boolean\n\tonChange: (checked: boolean) => void\n\tonBlur?: () => void\n\trequired?: boolean\n\tdisabled?: boolean\n\tinvalid?: boolean\n\tdescribedById?: string\n}\n\nexport const Checkbox = ({\n\tid,\n\tname,\n\tchecked,\n\tonChange,\n\tonBlur,\n\trequired,\n\tdisabled,\n\tinvalid,\n\tdescribedById,\n}: CheckboxProps) => (\n\t<input\n\t\ttype=\"checkbox\"\n\t\tclassName=\"fb-checkbox\"\n\t\tid={id}\n\t\tname={name}\n\t\tchecked={checked}\n\t\trequired={required}\n\t\tdisabled={disabled}\n\t\taria-invalid={invalid || undefined}\n\t\taria-describedby={describedById}\n\t\tonChange={(e) => onChange(e.target.checked)}\n\t\tonBlur={onBlur}\n\t/>\n)\n"],"mappings":";;;AAcA,MAAa,YAAY,EACxB,IACA,MACA,SACA,UACA,QACA,UACA,UACA,SACA,oBAEA,oBAAC,SAAD;CACC,MAAK;CACL,WAAU;CACN;CACE;CACG;CACC;CACA;CACV,gBAAc,WAAW,KAAA;CACzB,oBAAkB;CAClB,WAAW,MAAM,SAAS,EAAE,OAAO,OAAO;CAClC;AACR,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/react/primitives/FieldShell.d.ts
|
|
4
|
+
type FieldShellProps = {
|
|
5
|
+
/** The control id this shell labels and describes. */id: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
errors?: string[];
|
|
10
|
+
warnings?: string[]; /** id used for aria-describedby on the control; the shell renders description + messages under it. */
|
|
11
|
+
describedById: string;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Accessible wrapper for a single field: a `<label>` bound to the control, the control slot, an optional
|
|
16
|
+
* description, and error/warning messages. The control inside must set `aria-describedby={describedById}`
|
|
17
|
+
* and `aria-invalid` when errors exist; this shell renders the matching `id={describedById}` region.
|
|
18
|
+
*/
|
|
19
|
+
declare const FieldShell: ({
|
|
20
|
+
id,
|
|
21
|
+
label,
|
|
22
|
+
description,
|
|
23
|
+
required,
|
|
24
|
+
errors,
|
|
25
|
+
warnings,
|
|
26
|
+
describedById,
|
|
27
|
+
children
|
|
28
|
+
}: FieldShellProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { FieldShell, FieldShellProps };
|
|
31
|
+
//# sourceMappingURL=FieldShell.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/react/primitives/FieldShell.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Accessible wrapper for a single field: a `<label>` bound to the control, the control slot, an optional
|
|
6
|
+
* description, and error/warning messages. The control inside must set `aria-describedby={describedById}`
|
|
7
|
+
* and `aria-invalid` when errors exist; this shell renders the matching `id={describedById}` region.
|
|
8
|
+
*/
|
|
9
|
+
const FieldShell = ({ id, label, description, required, errors = [], warnings = [], describedById, children }) => /* @__PURE__ */ jsxs("div", {
|
|
10
|
+
className: "fb-field",
|
|
11
|
+
"data-invalid": errors.length > 0 ? "" : void 0,
|
|
12
|
+
children: [
|
|
13
|
+
label ? /* @__PURE__ */ jsxs("label", {
|
|
14
|
+
className: "fb-field__label",
|
|
15
|
+
htmlFor: id,
|
|
16
|
+
children: [label, required ? /* @__PURE__ */ jsx("span", {
|
|
17
|
+
className: "fb-field__required",
|
|
18
|
+
"aria-hidden": "true",
|
|
19
|
+
children: " *"
|
|
20
|
+
}) : null]
|
|
21
|
+
}) : null,
|
|
22
|
+
children,
|
|
23
|
+
/* @__PURE__ */ jsxs("div", {
|
|
24
|
+
id: describedById,
|
|
25
|
+
className: "fb-field__messages",
|
|
26
|
+
children: [
|
|
27
|
+
description ? /* @__PURE__ */ jsx("p", {
|
|
28
|
+
className: "fb-field__description",
|
|
29
|
+
children: description
|
|
30
|
+
}) : null,
|
|
31
|
+
errors.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
32
|
+
role: "alert",
|
|
33
|
+
"aria-atomic": "true",
|
|
34
|
+
className: "fb-field__errors",
|
|
35
|
+
children: errors.map((message) => /* @__PURE__ */ jsx("p", {
|
|
36
|
+
className: "fb-field__error",
|
|
37
|
+
children: message
|
|
38
|
+
}, message))
|
|
39
|
+
}) : null,
|
|
40
|
+
warnings.map((message) => /* @__PURE__ */ jsx("p", {
|
|
41
|
+
className: "fb-field__warning",
|
|
42
|
+
children: message
|
|
43
|
+
}, message))
|
|
44
|
+
]
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
export { FieldShell };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=FieldShell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldShell.js","names":[],"sources":["../../../src/react/primitives/FieldShell.tsx"],"sourcesContent":["'use client'\n\nimport type { ReactNode } from 'react'\n\nexport type FieldShellProps = {\n\t/** The control id this shell labels and describes. */\n\tid: string\n\tlabel?: string\n\tdescription?: string\n\trequired?: boolean\n\terrors?: string[]\n\twarnings?: string[]\n\t/** id used for aria-describedby on the control; the shell renders description + messages under it. */\n\tdescribedById: string\n\tchildren: ReactNode\n}\n\n/**\n * Accessible wrapper for a single field: a `<label>` bound to the control, the control slot, an optional\n * description, and error/warning messages. The control inside must set `aria-describedby={describedById}`\n * and `aria-invalid` when errors exist; this shell renders the matching `id={describedById}` region.\n */\nexport const FieldShell = ({\n\tid,\n\tlabel,\n\tdescription,\n\trequired,\n\terrors = [],\n\twarnings = [],\n\tdescribedById,\n\tchildren,\n}: FieldShellProps) => (\n\t<div className=\"fb-field\" data-invalid={errors.length > 0 ? '' : undefined}>\n\t\t{label ? (\n\t\t\t<label className=\"fb-field__label\" htmlFor={id}>\n\t\t\t\t{label}\n\t\t\t\t{required ? (\n\t\t\t\t\t<span className=\"fb-field__required\" aria-hidden=\"true\">\n\t\t\t\t\t\t{' *'}\n\t\t\t\t\t</span>\n\t\t\t\t) : null}\n\t\t\t</label>\n\t\t) : null}\n\t\t{children}\n\t\t<div id={describedById} className=\"fb-field__messages\">\n\t\t\t{description ? <p className=\"fb-field__description\">{description}</p> : null}\n\t\t\t{errors.length > 0 ? (\n\t\t\t\t<div role=\"alert\" aria-atomic=\"true\" className=\"fb-field__errors\">\n\t\t\t\t\t{errors.map((message) => (\n\t\t\t\t\t\t<p key={message} className=\"fb-field__error\">\n\t\t\t\t\t\t\t{message}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t{warnings.map((message) => (\n\t\t\t\t<p key={message} className=\"fb-field__warning\">\n\t\t\t\t\t{message}\n\t\t\t\t</p>\n\t\t\t))}\n\t\t</div>\n\t</div>\n)\n"],"mappings":";;;;;;;;AAsBA,MAAa,cAAc,EAC1B,IACA,OACA,aACA,UACA,SAAS,CAAC,GACV,WAAW,CAAC,GACZ,eACA,eAEA,qBAAC,OAAD;CAAK,WAAU;CAAW,gBAAc,OAAO,SAAS,IAAI,KAAK,KAAA;WAAjE;EACE,QACA,qBAAC,SAAD;GAAO,WAAU;GAAkB,SAAS;aAA5C,CACE,OACA,WACA,oBAAC,QAAD;IAAM,WAAU;IAAqB,eAAY;cAC/C;GACI,CAAA,IACH,IACE;OACJ;EACH;EACD,qBAAC,OAAD;GAAK,IAAI;GAAe,WAAU;aAAlC;IACE,cAAc,oBAAC,KAAD;KAAG,WAAU;eAAyB;IAAe,CAAA,IAAI;IACvE,OAAO,SAAS,IAChB,oBAAC,OAAD;KAAK,MAAK;KAAQ,eAAY;KAAO,WAAU;eAC7C,OAAO,KAAK,YACZ,oBAAC,KAAD;MAAiB,WAAU;gBACzB;KACC,GAFK,OAEL,CACH;IACG,CAAA,IACF;IACH,SAAS,KAAK,YACd,oBAAC,KAAD;KAAiB,WAAU;eACzB;IACC,GAFK,OAEL,CACH;GACG;;CACD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/react/primitives/Input.d.ts
|
|
2
|
+
type InputProps = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type?: 'text' | 'email' | 'number';
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
onBlur?: () => void;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
invalid?: boolean;
|
|
13
|
+
describedById?: string;
|
|
14
|
+
};
|
|
15
|
+
declare const Input: ({
|
|
16
|
+
id,
|
|
17
|
+
name,
|
|
18
|
+
type,
|
|
19
|
+
value,
|
|
20
|
+
onChange,
|
|
21
|
+
onBlur,
|
|
22
|
+
placeholder,
|
|
23
|
+
required,
|
|
24
|
+
disabled,
|
|
25
|
+
invalid,
|
|
26
|
+
describedById
|
|
27
|
+
}: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Input, InputProps };
|
|
30
|
+
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/react/primitives/Input.tsx
|
|
4
|
+
const Input = ({ id, name, type = "text", value, onChange, onBlur, placeholder, required, disabled, invalid, describedById }) => /* @__PURE__ */ jsx("input", {
|
|
5
|
+
id,
|
|
6
|
+
name,
|
|
7
|
+
type,
|
|
8
|
+
className: "fb-input",
|
|
9
|
+
value,
|
|
10
|
+
placeholder,
|
|
11
|
+
required,
|
|
12
|
+
disabled,
|
|
13
|
+
"aria-invalid": invalid || void 0,
|
|
14
|
+
"aria-describedby": describedById,
|
|
15
|
+
onChange: (event) => onChange(event.target.value),
|
|
16
|
+
onBlur
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Input };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","names":[],"sources":["../../../src/react/primitives/Input.tsx"],"sourcesContent":["'use client'\n\nexport type InputProps = {\n\tid: string\n\tname: string\n\ttype?: 'text' | 'email' | 'number'\n\tvalue: string\n\tonChange: (value: string) => void\n\tonBlur?: () => void\n\tplaceholder?: string\n\trequired?: boolean\n\tdisabled?: boolean\n\tinvalid?: boolean\n\tdescribedById?: string\n}\n\nexport const Input = ({\n\tid,\n\tname,\n\ttype = 'text',\n\tvalue,\n\tonChange,\n\tonBlur,\n\tplaceholder,\n\trequired,\n\tdisabled,\n\tinvalid,\n\tdescribedById,\n}: InputProps) => (\n\t<input\n\t\tid={id}\n\t\tname={name}\n\t\ttype={type}\n\t\tclassName=\"fb-input\"\n\t\tvalue={value}\n\t\tplaceholder={placeholder}\n\t\trequired={required}\n\t\tdisabled={disabled}\n\t\taria-invalid={invalid || undefined}\n\t\taria-describedby={describedById}\n\t\tonChange={(event) => onChange(event.target.value)}\n\t\tonBlur={onBlur}\n\t/>\n)\n"],"mappings":";;;AAgBA,MAAa,SAAS,EACrB,IACA,MACA,OAAO,QACP,OACA,UACA,QACA,aACA,UACA,UACA,SACA,oBAEA,oBAAC,SAAD;CACK;CACE;CACA;CACN,WAAU;CACH;CACM;CACH;CACA;CACV,gBAAc,WAAW,KAAA;CACzB,oBAAkB;CAClB,WAAW,UAAU,SAAS,MAAM,OAAO,KAAK;CACxC;AACR,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/react/primitives/Select.d.ts
|
|
2
|
+
type SelectOption = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
type SelectProps = {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
value: string;
|
|
10
|
+
options: SelectOption[];
|
|
11
|
+
onChange: (value: string) => void;
|
|
12
|
+
onBlur?: () => void;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
invalid?: boolean;
|
|
16
|
+
describedById?: string;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
};
|
|
19
|
+
declare const Select: ({
|
|
20
|
+
id,
|
|
21
|
+
name,
|
|
22
|
+
value,
|
|
23
|
+
options,
|
|
24
|
+
onChange,
|
|
25
|
+
onBlur,
|
|
26
|
+
required,
|
|
27
|
+
disabled,
|
|
28
|
+
invalid,
|
|
29
|
+
describedById,
|
|
30
|
+
placeholder
|
|
31
|
+
}: SelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Select, SelectOption, SelectProps };
|
|
34
|
+
//# sourceMappingURL=Select.d.ts.map
|