@ankhorage/zora 10.0.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +2 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
- package/dist/features/card/cardMeta.d.ts +1 -1
- package/dist/features/card/mediaCardMeta.d.ts +1 -1
- package/dist/features/card/postCardMeta.d.ts +1 -1
- package/dist/features/data-table/adapters/inbound/DataTable.d.ts.map +1 -1
- package/dist/features/data-table/adapters/inbound/DataTable.js +1 -1
- package/dist/features/data-table/adapters/inbound/DataTable.js.map +1 -1
- package/dist/{components/date-picker → features/date-picker/adapters/inbound}/DatePicker.d.ts +1 -1
- package/dist/features/date-picker/adapters/inbound/DatePicker.d.ts.map +1 -0
- package/dist/{components/date-picker → features/date-picker/adapters/inbound}/DatePicker.js +23 -26
- package/dist/features/date-picker/adapters/inbound/DatePicker.js.map +1 -0
- package/dist/features/date-picker/datePickerMeta.d.ts +83 -0
- package/dist/features/date-picker/datePickerMeta.d.ts.map +1 -0
- package/dist/features/date-picker/datePickerMeta.js +57 -0
- package/dist/features/date-picker/datePickerMeta.js.map +1 -0
- package/dist/features/date-picker/public.d.ts +3 -0
- package/dist/features/date-picker/public.d.ts.map +1 -0
- package/dist/features/date-picker/public.js +2 -0
- package/dist/features/date-picker/public.js.map +1 -0
- package/dist/features/date-picker/utils/localDate.d.ts +5 -0
- package/dist/features/date-picker/utils/localDate.d.ts.map +1 -0
- package/dist/features/date-picker/utils/localDate.js +27 -0
- package/dist/features/date-picker/utils/localDate.js.map +1 -0
- package/dist/features/form/adapters/inbound/Form.d.ts +5 -0
- package/dist/features/form/adapters/inbound/Form.d.ts.map +1 -0
- package/dist/features/form/adapters/inbound/Form.js +18 -0
- package/dist/features/form/adapters/inbound/Form.js.map +1 -0
- package/dist/{components/form → features/form/adapters/inbound}/FormActions.d.ts +1 -1
- package/dist/features/form/adapters/inbound/FormActions.d.ts.map +1 -0
- package/dist/{components/form → features/form/adapters/inbound}/FormActions.js +3 -3
- package/dist/features/form/adapters/inbound/FormActions.js.map +1 -0
- package/dist/features/form/adapters/inbound/FormError.d.ts +5 -0
- package/dist/features/form/adapters/inbound/FormError.d.ts.map +1 -0
- package/dist/features/form/adapters/inbound/FormError.js +18 -0
- package/dist/features/form/adapters/inbound/FormError.js.map +1 -0
- package/dist/features/form/adapters/inbound/FormField.d.ts +5 -0
- package/dist/features/form/adapters/inbound/FormField.d.ts.map +1 -0
- package/dist/{patterns/form-field → features/form/adapters/inbound}/FormField.js +5 -4
- package/dist/features/form/adapters/inbound/FormField.js.map +1 -0
- package/dist/features/form/formActionsMeta.d.ts +9 -0
- package/dist/features/form/formActionsMeta.d.ts.map +1 -0
- package/dist/features/form/formActionsMeta.js +9 -0
- package/dist/features/form/formActionsMeta.js.map +1 -0
- package/dist/features/form/formErrorMeta.d.ts +32 -0
- package/dist/features/form/formErrorMeta.d.ts.map +1 -0
- package/dist/features/form/formErrorMeta.js +19 -0
- package/dist/features/form/formErrorMeta.js.map +1 -0
- package/dist/{components/form/meta.d.ts → features/form/formFieldMeta.d.ts} +28 -39
- package/dist/features/form/formFieldMeta.d.ts.map +1 -0
- package/dist/features/form/formFieldMeta.js +35 -0
- package/dist/features/form/formFieldMeta.js.map +1 -0
- package/dist/features/form/formMeta.d.ts +61 -0
- package/dist/features/form/formMeta.d.ts.map +1 -0
- package/dist/features/form/formMeta.js +34 -0
- package/dist/features/form/formMeta.js.map +1 -0
- package/dist/features/form/public.d.ts +8 -0
- package/dist/features/form/public.d.ts.map +1 -0
- package/dist/features/form/public.js +7 -0
- package/dist/features/form/public.js.map +1 -0
- package/dist/{components → features}/form/useFormController.d.ts +1 -1
- package/dist/features/form/useFormController.d.ts.map +1 -0
- package/dist/{components → features}/form/useFormController.js +1 -1
- package/dist/features/form/useFormController.js.map +1 -0
- package/dist/{components/form → features/form/utils}/validation.d.ts +1 -1
- package/dist/features/form/utils/validation.d.ts.map +1 -0
- package/dist/{components/form → features/form/utils}/validation.js +2 -4
- package/dist/features/form/utils/validation.js.map +1 -0
- package/dist/{patterns/hero → features/hero/adapters/inbound}/Hero.d.ts +1 -1
- package/dist/features/hero/adapters/inbound/Hero.d.ts.map +1 -0
- package/dist/{patterns/hero → features/hero/adapters/inbound}/Hero.js +5 -6
- package/dist/features/hero/adapters/inbound/Hero.js.map +1 -0
- package/dist/{patterns/hero/meta.d.ts → features/hero/heroMeta.d.ts} +1 -1
- package/dist/features/hero/heroMeta.d.ts.map +1 -0
- package/dist/{patterns/hero/meta.js → features/hero/heroMeta.js} +1 -1
- package/dist/features/hero/heroMeta.js.map +1 -0
- package/dist/features/hero/public.d.ts +3 -0
- package/dist/features/hero/public.d.ts.map +1 -0
- package/dist/features/hero/public.js +2 -0
- package/dist/features/hero/public.js.map +1 -0
- package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
- package/dist/features/layout/boxMeta.d.ts +1 -1
- package/dist/features/layout/containerMeta.d.ts +1 -1
- package/dist/features/layout/gridMeta.d.ts +1 -1
- package/dist/features/layout/stackMeta.d.ts +1 -1
- package/dist/features/list/flatListMeta.d.ts +1 -1
- package/dist/features/list/sectionListMeta.d.ts +1 -1
- package/dist/{patterns/missing-element → features/missing-element/adapters/inbound}/MissingElement.d.ts +1 -1
- package/dist/features/missing-element/adapters/inbound/MissingElement.d.ts.map +1 -0
- package/dist/{patterns/missing-element → features/missing-element/adapters/inbound}/MissingElement.js +5 -5
- package/dist/features/missing-element/adapters/inbound/MissingElement.js.map +1 -0
- package/dist/{patterns/missing-element/meta.d.ts → features/missing-element/missingElementMeta.d.ts} +1 -1
- package/dist/features/missing-element/missingElementMeta.d.ts.map +1 -0
- package/dist/{patterns/missing-element/meta.js → features/missing-element/missingElementMeta.js} +1 -1
- package/dist/features/missing-element/missingElementMeta.js.map +1 -0
- package/dist/features/missing-element/public.d.ts +3 -0
- package/dist/features/missing-element/public.d.ts.map +1 -0
- package/dist/features/missing-element/public.js +2 -0
- package/dist/features/missing-element/public.js.map +1 -0
- package/dist/{components/skeleton → features/skeleton/adapters/inbound}/Skeleton.d.ts +1 -1
- package/dist/features/skeleton/adapters/inbound/Skeleton.d.ts.map +1 -0
- package/dist/{components/skeleton → features/skeleton/adapters/inbound}/Skeleton.js +3 -3
- package/dist/features/skeleton/adapters/inbound/Skeleton.js.map +1 -0
- package/dist/{components/skeleton → features/skeleton/adapters/inbound}/SkeletonCard.d.ts +1 -1
- package/dist/features/skeleton/adapters/inbound/SkeletonCard.d.ts.map +1 -0
- package/dist/{components/skeleton → features/skeleton/adapters/inbound}/SkeletonCard.js +4 -4
- package/dist/features/skeleton/adapters/inbound/SkeletonCard.js.map +1 -0
- package/dist/{components/skeleton → features/skeleton/adapters/inbound}/SkeletonList.d.ts +1 -1
- package/dist/features/skeleton/adapters/inbound/SkeletonList.d.ts.map +1 -0
- package/dist/{components/skeleton → features/skeleton/adapters/inbound}/SkeletonList.js +2 -2
- package/dist/features/skeleton/adapters/inbound/SkeletonList.js.map +1 -0
- package/dist/{components/skeleton → features/skeleton/adapters/inbound}/SkeletonText.d.ts +1 -1
- package/dist/features/skeleton/adapters/inbound/SkeletonText.d.ts.map +1 -0
- package/dist/{components/skeleton → features/skeleton/adapters/inbound}/SkeletonText.js +2 -2
- package/dist/features/skeleton/adapters/inbound/SkeletonText.js.map +1 -0
- package/dist/features/skeleton/public.d.ts +6 -0
- package/dist/features/skeleton/public.d.ts.map +1 -0
- package/dist/features/skeleton/public.js +5 -0
- package/dist/features/skeleton/public.js.map +1 -0
- package/dist/features/skeleton/skeletonMeta.d.ts +178 -0
- package/dist/features/skeleton/skeletonMeta.d.ts.map +1 -0
- package/dist/features/skeleton/skeletonMeta.js +84 -0
- package/dist/features/skeleton/skeletonMeta.js.map +1 -0
- package/dist/features/surface/surfaceMeta.d.ts +1 -1
- package/dist/{components/time-picker → features/time-picker/adapters/inbound}/TimePicker.d.ts +1 -1
- package/dist/features/time-picker/adapters/inbound/TimePicker.d.ts.map +1 -0
- package/dist/{components/time-picker → features/time-picker/adapters/inbound}/TimePicker.js +8 -11
- package/dist/features/time-picker/adapters/inbound/TimePicker.js.map +1 -0
- package/dist/features/time-picker/public.d.ts +3 -0
- package/dist/features/time-picker/public.d.ts.map +1 -0
- package/dist/features/time-picker/public.js +2 -0
- package/dist/features/time-picker/public.js.map +1 -0
- package/dist/features/time-picker/timePickerMeta.d.ts +90 -0
- package/dist/features/time-picker/timePickerMeta.d.ts.map +1 -0
- package/dist/features/time-picker/timePickerMeta.js +64 -0
- package/dist/features/time-picker/timePickerMeta.js.map +1 -0
- package/dist/features/uploader/adapters/inbound/Uploader.d.ts.map +1 -1
- package/dist/features/uploader/adapters/inbound/Uploader.js +1 -1
- package/dist/features/uploader/adapters/inbound/Uploader.js.map +1 -1
- package/dist/index.d.ts +7 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/layout/screen/meta.d.ts +1 -1
- package/dist/layout/screen-section/meta.d.ts +1 -1
- package/dist/metadata/allowedChildren.d.ts +3 -3
- package/dist/metadata/allowedChildren.d.ts.map +1 -1
- package/dist/metadata/allowedChildren.js +8 -1
- package/dist/metadata/allowedChildren.js.map +1 -1
- package/dist/metadata/bindableComponentMeta.d.ts +2 -2
- package/dist/metadata/componentMeta.d.ts.map +1 -1
- package/dist/metadata/componentMeta.js +9 -6
- package/dist/metadata/componentMeta.js.map +1 -1
- package/dist/patterns/auth/AuthForm.d.ts +21 -0
- package/dist/patterns/auth/AuthForm.d.ts.map +1 -0
- package/dist/patterns/auth/AuthForm.js +19 -0
- package/dist/patterns/auth/AuthForm.js.map +1 -0
- package/dist/patterns/auth/AuthFormField.d.ts +16 -0
- package/dist/patterns/auth/AuthFormField.d.ts.map +1 -0
- package/dist/patterns/auth/AuthFormField.js +38 -0
- package/dist/patterns/auth/AuthFormField.js.map +1 -0
- package/dist/patterns/auth/ForgotPasswordForm.d.ts.map +1 -1
- package/dist/patterns/auth/ForgotPasswordForm.js +2 -2
- package/dist/patterns/auth/ForgotPasswordForm.js.map +1 -1
- package/dist/patterns/auth/OtpForm.d.ts.map +1 -1
- package/dist/patterns/auth/OtpForm.js +2 -2
- package/dist/patterns/auth/OtpForm.js.map +1 -1
- package/dist/patterns/auth/SignInForm.d.ts.map +1 -1
- package/dist/patterns/auth/SignInForm.js +2 -2
- package/dist/patterns/auth/SignInForm.js.map +1 -1
- package/dist/patterns/auth/SignUpForm.d.ts.map +1 -1
- package/dist/patterns/auth/SignUpForm.js +2 -2
- package/dist/patterns/auth/SignUpForm.js.map +1 -1
- package/dist/patterns/auth/types.d.ts +1 -1
- package/dist/patterns/auth/types.d.ts.map +1 -1
- package/dist/patterns/auth/types.js.map +1 -1
- package/dist/patterns/auth/utils.d.ts +1 -1
- package/dist/patterns/auth/utils.d.ts.map +1 -1
- package/dist/patterns/auth/utils.js.map +1 -1
- package/dist/patterns/inspector-field/InspectorField.js +1 -1
- package/dist/patterns/inspector-field/InspectorField.js.map +1 -1
- package/dist/patterns/message-bubble/meta.d.ts +1 -1
- package/dist/patterns/notice/meta.d.ts +1 -1
- package/dist/patterns/panel/meta.d.ts +1 -1
- package/dist/patterns/reader/meta.d.ts +2 -2
- package/dist/patterns/scanner/meta.d.ts +2 -2
- package/dist/registry.js +6 -6
- package/dist/registry.js.map +1 -1
- package/dist/{components/date-picker/types.d.ts → types/date-picker.d.ts} +6 -6
- package/dist/types/date-picker.d.ts.map +1 -0
- package/dist/types/date-picker.js +2 -0
- package/dist/types/date-picker.js.map +1 -0
- package/dist/{components/form/types.d.ts → types/form.d.ts} +12 -28
- package/dist/types/form.d.ts.map +1 -0
- package/dist/types/form.js +2 -0
- package/dist/types/form.js.map +1 -0
- package/dist/{patterns/hero/types.d.ts → types/hero.d.ts} +3 -3
- package/dist/types/hero.d.ts.map +1 -0
- package/dist/types/hero.js +2 -0
- package/dist/types/hero.js.map +1 -0
- package/dist/{patterns/missing-element/types.d.ts → types/missing-element.d.ts} +2 -2
- package/dist/types/missing-element.d.ts.map +1 -0
- package/dist/types/missing-element.js +2 -0
- package/dist/types/missing-element.js.map +1 -0
- package/dist/{components/skeleton/types.d.ts → types/skeleton.d.ts} +3 -3
- package/dist/types/skeleton.d.ts.map +1 -0
- package/dist/types/skeleton.js +2 -0
- package/dist/types/skeleton.js.map +1 -0
- package/dist/{components/time-picker/types.d.ts → types/time-picker.d.ts} +2 -2
- package/dist/types/time-picker.d.ts.map +1 -0
- package/dist/types/time-picker.js +2 -0
- package/dist/types/time-picker.js.map +1 -0
- package/package.json +2 -1
- package/src/audit.test.ts +2 -4
- package/src/constants.ts +4 -0
- package/src/featureManifest.test.ts +19 -0
- package/src/features/bottom-sheet/public.test.ts +2 -2
- package/src/features/data-table/adapters/inbound/DataTable.tsx +1 -1
- package/src/{components/date-picker → features/date-picker/adapters/inbound}/DatePicker.tsx +41 -32
- package/src/features/date-picker/datePickerMeta.ts +58 -0
- package/src/features/date-picker/public.test.ts +15 -0
- package/src/features/date-picker/public.ts +2 -0
- package/src/features/date-picker/utils/localDate.test.ts +18 -0
- package/src/features/date-picker/utils/localDate.ts +29 -0
- package/src/features/form/adapters/inbound/Form.tsx +39 -0
- package/src/{components/form → features/form/adapters/inbound}/FormActions.tsx +4 -4
- package/src/features/form/adapters/inbound/FormError.tsx +22 -0
- package/src/{patterns/form-field → features/form/adapters/inbound}/FormField.tsx +6 -4
- package/src/{components/date-picker/meta.ts → features/form/formActionsMeta.ts} +3 -4
- package/src/features/form/formErrorMeta.ts +19 -0
- package/src/features/form/formFieldMeta.ts +35 -0
- package/src/features/form/formMeta.ts +34 -0
- package/src/{components/form/index.ts → features/form/public.ts} +6 -7
- package/src/{components → features}/form/useFormController.ts +2 -2
- package/src/{components/form → features/form/utils}/validation.test.ts +4 -1
- package/src/{components/form → features/form/utils}/validation.ts +4 -8
- package/src/{patterns/hero → features/hero/adapters/inbound}/Hero.tsx +6 -7
- package/src/features/hero/public.ts +2 -0
- package/src/{patterns → features}/missing-element/MissingElement.test.ts +6 -4
- package/src/{patterns/missing-element → features/missing-element/adapters/inbound}/MissingElement.tsx +6 -6
- package/src/features/missing-element/public.ts +2 -0
- package/src/{components/skeleton → features/skeleton/adapters/inbound}/Skeleton.tsx +4 -4
- package/src/{components/skeleton → features/skeleton/adapters/inbound}/SkeletonCard.tsx +5 -5
- package/src/{components/skeleton → features/skeleton/adapters/inbound}/SkeletonList.tsx +3 -3
- package/src/{components/skeleton → features/skeleton/adapters/inbound}/SkeletonText.tsx +3 -3
- package/src/features/skeleton/public.test.ts +24 -0
- package/src/features/skeleton/public.ts +13 -0
- package/src/features/skeleton/skeletonMeta.ts +88 -0
- package/src/{components/time-picker → features/time-picker/adapters/inbound}/TimePicker.tsx +9 -12
- package/src/features/time-picker/public.test.ts +14 -0
- package/src/features/time-picker/public.ts +2 -0
- package/src/features/time-picker/timePickerMeta.ts +65 -0
- package/src/features/uploader/adapters/inbound/Uploader.tsx +1 -1
- package/src/index.ts +58 -45
- package/src/interactionPolicy.test.ts +3 -3
- package/src/metadata/allowedChildren.ts +8 -1
- package/src/metadata/componentMeta.test.ts +24 -1
- package/src/metadata/componentMeta.ts +14 -11
- package/src/patterns/auth/AuthForm.tsx +68 -0
- package/src/patterns/auth/AuthFormField.tsx +81 -0
- package/src/patterns/auth/ForgotPasswordForm.tsx +3 -2
- package/src/patterns/auth/OtpForm.tsx +3 -2
- package/src/patterns/auth/SignInForm.tsx +3 -2
- package/src/patterns/auth/SignUpForm.tsx +3 -2
- package/src/patterns/auth/types.ts +1 -1
- package/src/patterns/auth/utils.ts +1 -1
- package/src/patterns/inspector-field/InspectorField.tsx +1 -1
- package/src/registry.ts +6 -6
- package/src/theme/themeScopeStructure.test.ts +5 -7
- package/src/{components/date-picker/types.ts → types/date-picker.ts} +5 -5
- package/src/{components/form/types.ts → types/form.ts} +12 -36
- package/src/{patterns/hero/types.ts → types/hero.ts} +2 -2
- package/src/{patterns/missing-element/types.ts → types/missing-element.ts} +1 -1
- package/src/{components/skeleton/types.ts → types/skeleton.ts} +2 -2
- package/src/{components/time-picker/types.ts → types/time-picker.ts} +1 -1
- package/dist/components/date-picker/DatePicker.d.ts.map +0 -1
- package/dist/components/date-picker/DatePicker.js.map +0 -1
- package/dist/components/date-picker/index.d.ts +0 -3
- package/dist/components/date-picker/index.d.ts.map +0 -1
- package/dist/components/date-picker/index.js +0 -2
- package/dist/components/date-picker/index.js.map +0 -1
- package/dist/components/date-picker/meta.d.ts +0 -9
- package/dist/components/date-picker/meta.d.ts.map +0 -1
- package/dist/components/date-picker/meta.js +0 -9
- package/dist/components/date-picker/meta.js.map +0 -1
- package/dist/components/date-picker/types.d.ts.map +0 -1
- package/dist/components/date-picker/types.js +0 -2
- package/dist/components/date-picker/types.js.map +0 -1
- package/dist/components/form/Form.d.ts +0 -7
- package/dist/components/form/Form.d.ts.map +0 -1
- package/dist/components/form/Form.js +0 -34
- package/dist/components/form/Form.js.map +0 -1
- package/dist/components/form/FormActions.d.ts.map +0 -1
- package/dist/components/form/FormActions.js.map +0 -1
- package/dist/components/form/FormError.d.ts +0 -7
- package/dist/components/form/FormError.d.ts.map +0 -1
- package/dist/components/form/FormError.js +0 -21
- package/dist/components/form/FormError.js.map +0 -1
- package/dist/components/form/FormField.d.ts +0 -7
- package/dist/components/form/FormField.d.ts.map +0 -1
- package/dist/components/form/FormField.js +0 -81
- package/dist/components/form/FormField.js.map +0 -1
- package/dist/components/form/index.d.ts +0 -8
- package/dist/components/form/index.d.ts.map +0 -1
- package/dist/components/form/index.js +0 -7
- package/dist/components/form/index.js.map +0 -1
- package/dist/components/form/meta.d.ts.map +0 -1
- package/dist/components/form/meta.js +0 -94
- package/dist/components/form/meta.js.map +0 -1
- package/dist/components/form/types.d.ts.map +0 -1
- package/dist/components/form/types.js +0 -2
- package/dist/components/form/types.js.map +0 -1
- package/dist/components/form/useFormController.d.ts.map +0 -1
- package/dist/components/form/useFormController.js.map +0 -1
- package/dist/components/form/validation.d.ts.map +0 -1
- package/dist/components/form/validation.js.map +0 -1
- package/dist/components/skeleton/Skeleton.d.ts.map +0 -1
- package/dist/components/skeleton/Skeleton.js.map +0 -1
- package/dist/components/skeleton/SkeletonCard.d.ts.map +0 -1
- package/dist/components/skeleton/SkeletonCard.js.map +0 -1
- package/dist/components/skeleton/SkeletonList.d.ts.map +0 -1
- package/dist/components/skeleton/SkeletonList.js.map +0 -1
- package/dist/components/skeleton/SkeletonText.d.ts.map +0 -1
- package/dist/components/skeleton/SkeletonText.js.map +0 -1
- package/dist/components/skeleton/index.d.ts +0 -6
- package/dist/components/skeleton/index.d.ts.map +0 -1
- package/dist/components/skeleton/index.js +0 -5
- package/dist/components/skeleton/index.js.map +0 -1
- package/dist/components/skeleton/meta.d.ts +0 -33
- package/dist/components/skeleton/meta.d.ts.map +0 -1
- package/dist/components/skeleton/meta.js +0 -33
- package/dist/components/skeleton/meta.js.map +0 -1
- package/dist/components/skeleton/types.d.ts.map +0 -1
- package/dist/components/skeleton/types.js +0 -2
- package/dist/components/skeleton/types.js.map +0 -1
- package/dist/components/time-picker/TimePicker.d.ts.map +0 -1
- package/dist/components/time-picker/TimePicker.js.map +0 -1
- package/dist/components/time-picker/index.d.ts +0 -3
- package/dist/components/time-picker/index.d.ts.map +0 -1
- package/dist/components/time-picker/index.js +0 -2
- package/dist/components/time-picker/index.js.map +0 -1
- package/dist/components/time-picker/meta.d.ts +0 -9
- package/dist/components/time-picker/meta.d.ts.map +0 -1
- package/dist/components/time-picker/meta.js +0 -9
- package/dist/components/time-picker/meta.js.map +0 -1
- package/dist/components/time-picker/types.d.ts.map +0 -1
- package/dist/components/time-picker/types.js +0 -2
- package/dist/components/time-picker/types.js.map +0 -1
- package/dist/patterns/form-field/FormField.d.ts +0 -4
- package/dist/patterns/form-field/FormField.d.ts.map +0 -1
- package/dist/patterns/form-field/FormField.js.map +0 -1
- package/dist/patterns/form-field/index.d.ts +0 -2
- package/dist/patterns/form-field/index.d.ts.map +0 -1
- package/dist/patterns/form-field/index.js +0 -2
- package/dist/patterns/form-field/index.js.map +0 -1
- package/dist/patterns/form-field/types.d.ts +0 -9
- package/dist/patterns/form-field/types.d.ts.map +0 -1
- package/dist/patterns/form-field/types.js +0 -2
- package/dist/patterns/form-field/types.js.map +0 -1
- package/dist/patterns/hero/Hero.d.ts.map +0 -1
- package/dist/patterns/hero/Hero.js.map +0 -1
- package/dist/patterns/hero/index.d.ts +0 -3
- package/dist/patterns/hero/index.d.ts.map +0 -1
- package/dist/patterns/hero/index.js +0 -2
- package/dist/patterns/hero/index.js.map +0 -1
- package/dist/patterns/hero/meta.d.ts.map +0 -1
- package/dist/patterns/hero/meta.js.map +0 -1
- package/dist/patterns/hero/types.d.ts.map +0 -1
- package/dist/patterns/hero/types.js +0 -2
- package/dist/patterns/hero/types.js.map +0 -1
- package/dist/patterns/missing-element/MissingElement.d.ts.map +0 -1
- package/dist/patterns/missing-element/MissingElement.js.map +0 -1
- package/dist/patterns/missing-element/index.d.ts +0 -3
- package/dist/patterns/missing-element/index.d.ts.map +0 -1
- package/dist/patterns/missing-element/index.js +0 -2
- package/dist/patterns/missing-element/index.js.map +0 -1
- package/dist/patterns/missing-element/meta.d.ts.map +0 -1
- package/dist/patterns/missing-element/meta.js.map +0 -1
- package/dist/patterns/missing-element/types.d.ts.map +0 -1
- package/dist/patterns/missing-element/types.js +0 -2
- package/dist/patterns/missing-element/types.js.map +0 -1
- package/src/components/date-picker/index.ts +0 -2
- package/src/components/form/Form.tsx +0 -74
- package/src/components/form/FormError.tsx +0 -34
- package/src/components/form/FormField.tsx +0 -157
- package/src/components/form/meta.ts +0 -98
- package/src/components/skeleton/index.ts +0 -13
- package/src/components/skeleton/meta.ts +0 -37
- package/src/components/time-picker/index.ts +0 -2
- package/src/components/time-picker/meta.ts +0 -10
- package/src/patterns/form-field/index.ts +0 -1
- package/src/patterns/form-field/types.ts +0 -16
- package/src/patterns/hero/index.ts +0 -2
- package/src/patterns/missing-element/index.ts +0 -2
- /package/src/{patterns/hero/meta.ts → features/hero/heroMeta.ts} +0 -0
- /package/src/{patterns/missing-element/meta.ts → features/missing-element/missingElementMeta.ts} +0 -0
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { appBarMeta } from '../components/app-bar/meta';
|
|
2
2
|
import { breadcrumbsMeta } from '../components/breadcrumbs/meta';
|
|
3
|
-
import { datePickerMeta } from '../components/date-picker/meta';
|
|
4
|
-
import { formActionsMeta, formErrorMeta, formFieldMeta, formMeta } from '../components/form/meta';
|
|
5
3
|
import { gradientMeta } from '../components/gradient/meta';
|
|
6
4
|
import { dropdownMenuMeta, menuMeta } from '../components/menu/meta';
|
|
7
5
|
import { modalMeta } from '../components/modal/meta';
|
|
@@ -9,14 +7,7 @@ import { paginationMeta } from '../components/pagination/meta';
|
|
|
9
7
|
import { ratingMeta } from '../components/rating/meta';
|
|
10
8
|
import { searchBarMeta } from '../components/search-bar/meta';
|
|
11
9
|
import { selectMeta } from '../components/select/meta';
|
|
12
|
-
import {
|
|
13
|
-
skeletonCardMeta,
|
|
14
|
-
skeletonListMeta,
|
|
15
|
-
skeletonMeta,
|
|
16
|
-
skeletonTextMeta,
|
|
17
|
-
} from '../components/skeleton/meta';
|
|
18
10
|
import { tabsMeta } from '../components/tabs/meta';
|
|
19
|
-
import { timePickerMeta } from '../components/time-picker/meta';
|
|
20
11
|
import { toastMeta, toastProviderMeta } from '../components/toast/meta';
|
|
21
12
|
import { toolbarActionMeta, toolbarMeta } from '../components/toolbar/meta';
|
|
22
13
|
import { activityIndicatorMeta } from '../features/activity-indicator/activityIndicatorMeta';
|
|
@@ -35,10 +26,16 @@ import { productCardMeta } from '../features/card/productCardMeta';
|
|
|
35
26
|
import { chipGroupMeta } from '../features/chip/chipGroupMeta';
|
|
36
27
|
import { chipMeta } from '../features/chip/chipMeta';
|
|
37
28
|
import { dataTableMeta } from '../features/data-table/dataTableMeta';
|
|
29
|
+
import { datePickerMeta } from '../features/date-picker/datePickerMeta';
|
|
38
30
|
import { emptyStateMeta } from '../features/empty-state/emptyStateMeta';
|
|
39
31
|
import { checkboxGroupMeta, checkboxMeta } from '../features/form/checkbox/checkboxMeta';
|
|
32
|
+
import { formActionsMeta } from '../features/form/formActionsMeta';
|
|
33
|
+
import { formErrorMeta } from '../features/form/formErrorMeta';
|
|
34
|
+
import { formFieldMeta } from '../features/form/formFieldMeta';
|
|
35
|
+
import { formMeta } from '../features/form/formMeta';
|
|
40
36
|
import { radioGroupMeta, radioMeta } from '../features/form/radio/radioMeta';
|
|
41
37
|
import { textInputMeta } from '../features/form/text-input/textInputMeta';
|
|
38
|
+
import { heroMeta } from '../features/hero/heroMeta';
|
|
42
39
|
import { iconMeta } from '../features/icon/iconMeta';
|
|
43
40
|
import { imageMeta } from '../features/image/imageMeta';
|
|
44
41
|
import { keyboardAvoidingViewMeta } from '../features/keyboard-avoiding-view/keyboardAvoidingViewMeta';
|
|
@@ -50,8 +47,16 @@ import { gridMeta } from '../features/layout/gridMeta';
|
|
|
50
47
|
import { stackMeta } from '../features/layout/stackMeta';
|
|
51
48
|
import { flatListMeta } from '../features/list/flatListMeta';
|
|
52
49
|
import { sectionListMeta } from '../features/list/sectionListMeta';
|
|
50
|
+
import { missingElementMeta } from '../features/missing-element/missingElementMeta';
|
|
53
51
|
import { progressMeta, progressRingMeta } from '../features/progress/progressMeta';
|
|
52
|
+
import {
|
|
53
|
+
skeletonCardMeta,
|
|
54
|
+
skeletonListMeta,
|
|
55
|
+
skeletonMeta,
|
|
56
|
+
skeletonTextMeta,
|
|
57
|
+
} from '../features/skeleton/skeletonMeta';
|
|
54
58
|
import { surfaceMeta } from '../features/surface/surfaceMeta';
|
|
59
|
+
import { timePickerMeta } from '../features/time-picker/timePickerMeta';
|
|
55
60
|
import { headingMeta } from '../features/typography/headingMeta';
|
|
56
61
|
import { textMeta } from '../features/typography/textMeta';
|
|
57
62
|
import { uploaderMeta } from '../features/uploader/uploaderMeta';
|
|
@@ -75,11 +80,9 @@ import { collectionEditorMeta } from '../patterns/collection-editor/meta';
|
|
|
75
80
|
import { confirmDialogMeta } from '../patterns/confirm-dialog/meta';
|
|
76
81
|
import { disclosureSectionMeta } from '../patterns/disclosure-section/meta';
|
|
77
82
|
import { filterBarMeta } from '../patterns/filter-bar/meta';
|
|
78
|
-
import { heroMeta } from '../patterns/hero/meta';
|
|
79
83
|
import { inspectorFieldMeta } from '../patterns/inspector-field/meta';
|
|
80
84
|
import { listMeta, listRowMeta, listSectionMeta } from '../patterns/list/meta';
|
|
81
85
|
import { messageBubbleMeta } from '../patterns/message-bubble/meta';
|
|
82
|
-
import { missingElementMeta } from '../patterns/missing-element/meta';
|
|
83
86
|
import { noticeMeta } from '../patterns/notice/meta';
|
|
84
87
|
import { panelMeta } from '../patterns/panel/meta';
|
|
85
88
|
import { readerSurfaceMeta } from '../patterns/reader/meta';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { FormActions, FormError, useFormController } from '../../features/form/public';
|
|
4
|
+
import { Stack } from '../../features/layout/public';
|
|
5
|
+
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
6
|
+
import type { FormErrors, FormFieldConfig, FormValues } from '../../types/form';
|
|
7
|
+
import { AuthFormField } from './AuthFormField';
|
|
8
|
+
|
|
9
|
+
interface AuthFormProps<TName extends string> {
|
|
10
|
+
fields: readonly FormFieldConfig<TName>[];
|
|
11
|
+
values: FormValues<TName>;
|
|
12
|
+
onChange: (values: FormValues<TName>) => void;
|
|
13
|
+
onSubmit: (values: FormValues<TName>) => void | Promise<void>;
|
|
14
|
+
errors?: FormErrors<TName>;
|
|
15
|
+
error?: React.ReactNode;
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
submitLabel?: React.ReactNode;
|
|
19
|
+
actions?: React.ReactNode;
|
|
20
|
+
testID?: string;
|
|
21
|
+
interactionPolicy?: ZoraBaseProps['interactionPolicy'];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/*** Keeps config-driven field orchestration private to the auth patterns that own it. */
|
|
25
|
+
export function AuthForm<TName extends string>({
|
|
26
|
+
fields,
|
|
27
|
+
values,
|
|
28
|
+
onChange,
|
|
29
|
+
onSubmit,
|
|
30
|
+
errors,
|
|
31
|
+
error,
|
|
32
|
+
loading = false,
|
|
33
|
+
disabled = false,
|
|
34
|
+
submitLabel = 'Submit',
|
|
35
|
+
actions,
|
|
36
|
+
testID,
|
|
37
|
+
interactionPolicy,
|
|
38
|
+
}: AuthFormProps<TName>) {
|
|
39
|
+
const controller = useFormController({ fields, values, errors, onChange, onSubmit });
|
|
40
|
+
return (
|
|
41
|
+
<Stack gap="m" testID={testID}>
|
|
42
|
+
<FormError error={error} />
|
|
43
|
+
{fields.map((field) => (
|
|
44
|
+
<AuthFormField
|
|
45
|
+
key={field.name}
|
|
46
|
+
disabled={disabled}
|
|
47
|
+
error={controller.errors[field.name]}
|
|
48
|
+
field={field}
|
|
49
|
+
interactionPolicy={interactionPolicy}
|
|
50
|
+
loading={loading}
|
|
51
|
+
onChange={controller.setFieldValue}
|
|
52
|
+
value={values[field.name]}
|
|
53
|
+
/>
|
|
54
|
+
))}
|
|
55
|
+
<FormActions
|
|
56
|
+
disabled={disabled}
|
|
57
|
+
interactionPolicy={interactionPolicy}
|
|
58
|
+
loading={loading}
|
|
59
|
+
onSubmit={() => {
|
|
60
|
+
if (interactionPolicy !== 'passive') void controller.handleSubmit();
|
|
61
|
+
}}
|
|
62
|
+
submitLabel={submitLabel}
|
|
63
|
+
>
|
|
64
|
+
{actions}
|
|
65
|
+
</FormActions>
|
|
66
|
+
</Stack>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { FormField, hasRequiredRule } from '../../features/form/public';
|
|
4
|
+
import { TextInput } from '../../features/form/text-input/public';
|
|
5
|
+
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
6
|
+
import type { FormFieldConfig, FormFieldValue } from '../../types/form';
|
|
7
|
+
|
|
8
|
+
interface AuthFormFieldProps<TName extends string> {
|
|
9
|
+
field: FormFieldConfig<TName>;
|
|
10
|
+
value: FormFieldValue;
|
|
11
|
+
onChange: (name: TName, value: FormFieldValue) => void;
|
|
12
|
+
error?: React.ReactNode;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
interactionPolicy?: ZoraBaseProps['interactionPolicy'];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/*** Adapts an auth field configuration to the public compositional form primitives. */
|
|
19
|
+
export function AuthFormField<TName extends string>({
|
|
20
|
+
field,
|
|
21
|
+
value,
|
|
22
|
+
onChange,
|
|
23
|
+
error,
|
|
24
|
+
disabled = false,
|
|
25
|
+
loading = false,
|
|
26
|
+
interactionPolicy,
|
|
27
|
+
}: AuthFormFieldProps<TName>) {
|
|
28
|
+
const fieldDisabled = disabled || loading || field.disabled;
|
|
29
|
+
return (
|
|
30
|
+
<FormField
|
|
31
|
+
description={field.description}
|
|
32
|
+
disabled={fieldDisabled}
|
|
33
|
+
errorText={error}
|
|
34
|
+
helperText={field.helperText}
|
|
35
|
+
invalid={Boolean(error)}
|
|
36
|
+
label={field.label}
|
|
37
|
+
readOnly={field.readOnly}
|
|
38
|
+
required={field.required ?? hasRequiredRule(field.rules)}
|
|
39
|
+
testID={field.testID}
|
|
40
|
+
>
|
|
41
|
+
<TextInput
|
|
42
|
+
accessibilityLabel={typeof field.label === 'string' ? field.label : undefined}
|
|
43
|
+
autoCapitalize={
|
|
44
|
+
field.autoCapitalize ??
|
|
45
|
+
(['email', 'password', 'url'].includes(field.type ?? 'text') ? 'none' : undefined)
|
|
46
|
+
}
|
|
47
|
+
autoComplete={field.autoComplete}
|
|
48
|
+
disabled={fieldDisabled}
|
|
49
|
+
interactionPolicy={interactionPolicy}
|
|
50
|
+
invalid={Boolean(error)}
|
|
51
|
+
keyboardType={resolveKeyboardType(field)}
|
|
52
|
+
maxLength={field.maxLength}
|
|
53
|
+
onChangeText={(nextValue) => onChange(field.name, nextValue)}
|
|
54
|
+
placeholder={field.placeholder}
|
|
55
|
+
readOnly={field.readOnly}
|
|
56
|
+
secureTextEntry={field.secureTextEntry ?? field.type === 'password'}
|
|
57
|
+
textContentType={resolveTextContentType(field)}
|
|
58
|
+
value={value}
|
|
59
|
+
/>
|
|
60
|
+
</FormField>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/*** Resolves the native keyboard for an auth field configuration. */
|
|
65
|
+
function resolveKeyboardType(field: FormFieldConfig) {
|
|
66
|
+
if (field.keyboardType) return field.keyboardType;
|
|
67
|
+
if (field.type === 'email') return 'email-address';
|
|
68
|
+
if (field.type === 'number' || field.type === 'otp') return 'number-pad';
|
|
69
|
+
if (field.type === 'tel') return 'phone-pad';
|
|
70
|
+
if (field.type === 'url') return 'url';
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/*** Resolves platform text-content hints for an auth field configuration. */
|
|
75
|
+
function resolveTextContentType(field: FormFieldConfig) {
|
|
76
|
+
if (field.textContentType) return field.textContentType;
|
|
77
|
+
if (field.type === 'email') return 'emailAddress';
|
|
78
|
+
if (field.type === 'password') return 'password';
|
|
79
|
+
if (field.type === 'otp') return 'oneTimeCode';
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Form, type FormFieldConfig, type FormValues } from '../../components/form';
|
|
4
3
|
import { Button } from '../../features/button/public';
|
|
5
4
|
import { Stack } from '../../features/layout/public';
|
|
6
5
|
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
6
|
+
import type { FormFieldConfig, FormValues } from '../../types/form';
|
|
7
|
+
import { AuthForm } from './AuthForm';
|
|
7
8
|
import type { ForgotPasswordFormProps } from './types';
|
|
8
9
|
import {
|
|
9
10
|
defaultIdentifiers,
|
|
@@ -56,7 +57,7 @@ function ForgotPasswordFormInner({
|
|
|
56
57
|
);
|
|
57
58
|
|
|
58
59
|
return (
|
|
59
|
-
<
|
|
60
|
+
<AuthForm
|
|
60
61
|
actions={
|
|
61
62
|
onSignIn ? (
|
|
62
63
|
<Stack direction="row" gap="s" wrap="wrap">
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Form, type FormFieldConfig, type FormValues } from '../../components/form';
|
|
4
3
|
import { Button } from '../../features/button/public';
|
|
5
4
|
import { Stack } from '../../features/layout/public';
|
|
6
5
|
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
6
|
+
import type { FormFieldConfig, FormValues } from '../../types/form';
|
|
7
|
+
import { AuthForm } from './AuthForm';
|
|
7
8
|
import type { OtpFormProps } from './types';
|
|
8
9
|
|
|
9
10
|
type OtpFieldName = 'otp';
|
|
@@ -51,7 +52,7 @@ function OtpFormInner({
|
|
|
51
52
|
);
|
|
52
53
|
|
|
53
54
|
return (
|
|
54
|
-
<
|
|
55
|
+
<AuthForm
|
|
55
56
|
actions={
|
|
56
57
|
onResend ? (
|
|
57
58
|
<Stack direction="row" gap="s" wrap="wrap">
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Form, type FormFieldConfig, type FormValues } from '../../components/form';
|
|
4
3
|
import { Button } from '../../features/button/public';
|
|
5
4
|
import { Stack } from '../../features/layout/public';
|
|
6
5
|
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
6
|
+
import type { FormFieldConfig, FormValues } from '../../types/form';
|
|
7
|
+
import { AuthForm } from './AuthForm';
|
|
7
8
|
import type { SignInFormProps } from './types';
|
|
8
9
|
import {
|
|
9
10
|
defaultIdentifiers,
|
|
@@ -68,7 +69,7 @@ function SignInFormInner({
|
|
|
68
69
|
);
|
|
69
70
|
|
|
70
71
|
return (
|
|
71
|
-
<
|
|
72
|
+
<AuthForm
|
|
72
73
|
actions={
|
|
73
74
|
hasActions ? (
|
|
74
75
|
<Stack direction="row" gap="s" wrap="wrap">
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Form, type FormFieldConfig, type FormValues } from '../../components/form';
|
|
4
3
|
import { Button } from '../../features/button/public';
|
|
5
4
|
import { Stack } from '../../features/layout/public';
|
|
6
5
|
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
6
|
+
import type { FormFieldConfig, FormValues } from '../../types/form';
|
|
7
|
+
import { AuthForm } from './AuthForm';
|
|
7
8
|
import type { SignUpFormProps } from './types';
|
|
8
9
|
|
|
9
10
|
const defaultSignUpFields = [
|
|
@@ -48,7 +49,7 @@ function SignUpFormInner({
|
|
|
48
49
|
const [values, setValues] = React.useState<FormValues>(() => createValues(fields));
|
|
49
50
|
|
|
50
51
|
return (
|
|
51
|
-
<
|
|
52
|
+
<AuthForm
|
|
52
53
|
actions={
|
|
53
54
|
onSignIn ? (
|
|
54
55
|
<Stack direction="row" gap="s" wrap="wrap">
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ButtonIconSpec } from '@ankhorage/surface';
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
|
|
4
|
-
import type { FormFieldConfig, FormValues } from '../../components/form';
|
|
5
4
|
import type { ButtonProps } from '../../features/button/public';
|
|
6
5
|
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
6
|
+
import type { FormFieldConfig, FormValues } from '../../types/form';
|
|
7
7
|
|
|
8
8
|
export type AuthIdentifierKind = 'email' | 'phone' | 'username';
|
|
9
9
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FormFieldConfig, ValidationRule } from '../../
|
|
1
|
+
import type { FormFieldConfig, ValidationRule } from '../../types/form';
|
|
2
2
|
import type { AuthIdentifierKind } from './types';
|
|
3
3
|
|
|
4
4
|
export const defaultIdentifiers = ['email'] as const satisfies readonly AuthIdentifierKind[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import { FormField } from '../../features/form/public';
|
|
3
4
|
import { Box, Stack } from '../../features/layout/public';
|
|
4
5
|
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
5
|
-
import { FormField } from '../form-field';
|
|
6
6
|
import type { InspectorFieldProps } from './types';
|
|
7
7
|
|
|
8
8
|
function InspectorFieldInner({
|
package/src/registry.ts
CHANGED
|
@@ -3,8 +3,6 @@ import type React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { AppBar } from './components/app-bar';
|
|
5
5
|
import { Breadcrumbs } from './components/breadcrumbs';
|
|
6
|
-
import { DatePicker } from './components/date-picker';
|
|
7
|
-
import { Form, FormActions, FormError, FormField } from './components/form';
|
|
8
6
|
import { Gradient } from './components/gradient';
|
|
9
7
|
import { DropdownMenu, Menu } from './components/menu';
|
|
10
8
|
import { Modal } from './components/modal';
|
|
@@ -12,9 +10,7 @@ import { Pagination } from './components/pagination';
|
|
|
12
10
|
import { Rating } from './components/rating';
|
|
13
11
|
import { SearchBar } from './components/search-bar';
|
|
14
12
|
import { Select } from './components/select';
|
|
15
|
-
import { Skeleton, SkeletonCard, SkeletonList, SkeletonText } from './components/skeleton';
|
|
16
13
|
import { Tabs } from './components/tabs';
|
|
17
|
-
import { TimePicker } from './components/time-picker';
|
|
18
14
|
import { Toast } from './components/toast';
|
|
19
15
|
import { Toolbar, ToolbarAction } from './components/toolbar';
|
|
20
16
|
import { ActivityIndicator } from './features/activity-indicator/public';
|
|
@@ -33,18 +29,24 @@ import { ProductCard } from './features/card/public';
|
|
|
33
29
|
import { Chip } from './features/chip/public';
|
|
34
30
|
import { ChipGroup } from './features/chip/public';
|
|
35
31
|
import { DataTable } from './features/data-table/public';
|
|
32
|
+
import { DatePicker } from './features/date-picker/public';
|
|
36
33
|
import { EmptyState } from './features/empty-state/public';
|
|
37
34
|
import { Checkbox, CheckboxGroup } from './features/form/checkbox/public';
|
|
35
|
+
import { Form, FormActions, FormError, FormField } from './features/form/public';
|
|
38
36
|
import { Radio, RadioGroup } from './features/form/radio/public';
|
|
39
37
|
import { TextInput } from './features/form/text-input/public';
|
|
38
|
+
import { Hero } from './features/hero/public';
|
|
40
39
|
import { Icon } from './features/icon/public';
|
|
41
40
|
import { Image } from './features/image/public';
|
|
42
41
|
import { KeyboardAvoidingView } from './features/keyboard-avoiding-view/public';
|
|
43
42
|
import { Box, Container, Divider, Grid, Stack } from './features/layout/public';
|
|
44
43
|
import { ContentRail } from './features/layout/public';
|
|
45
44
|
import { FlatList, SectionList } from './features/list/public';
|
|
45
|
+
import { MissingElement } from './features/missing-element/public';
|
|
46
46
|
import { Progress, ProgressRing } from './features/progress/public';
|
|
47
|
+
import { Skeleton, SkeletonCard, SkeletonList, SkeletonText } from './features/skeleton/public';
|
|
47
48
|
import { Surface } from './features/surface/public';
|
|
49
|
+
import { TimePicker } from './features/time-picker/public';
|
|
48
50
|
import { Heading } from './features/typography/public';
|
|
49
51
|
import { Text } from './features/typography/public';
|
|
50
52
|
import { Uploader } from './features/uploader/public';
|
|
@@ -68,11 +70,9 @@ import { CollectionEditor } from './patterns/collection-editor';
|
|
|
68
70
|
import { ConfirmDialog } from './patterns/confirm-dialog';
|
|
69
71
|
import { DisclosureSection } from './patterns/disclosure-section';
|
|
70
72
|
import { FilterBar } from './patterns/filter-bar';
|
|
71
|
-
import { Hero } from './patterns/hero';
|
|
72
73
|
import { InspectorField } from './patterns/inspector-field';
|
|
73
74
|
import { List, ListRow, ListSection } from './patterns/list';
|
|
74
75
|
import { MessageBubble } from './patterns/message-bubble';
|
|
75
|
-
import { MissingElement } from './patterns/missing-element';
|
|
76
76
|
import { Notice } from './patterns/notice';
|
|
77
77
|
import { Panel } from './patterns/panel';
|
|
78
78
|
import { ReaderSurface } from './patterns/reader';
|
|
@@ -65,10 +65,10 @@ const scopedComponentFiles = [
|
|
|
65
65
|
join(srcDir, 'features', 'card', 'adapters', 'inbound', 'MetricCard.tsx'),
|
|
66
66
|
join(srcDir, 'features', 'form', 'checkbox', 'adapters', 'inbound', 'Checkbox.tsx'),
|
|
67
67
|
join(srcDir, 'features', 'form', 'checkbox', 'adapters', 'inbound', 'CheckboxGroup.tsx'),
|
|
68
|
-
join(srcDir, '
|
|
69
|
-
join(srcDir, '
|
|
70
|
-
join(srcDir, '
|
|
71
|
-
join(srcDir, '
|
|
68
|
+
join(srcDir, 'features', 'form', 'adapters', 'inbound', 'Form.tsx'),
|
|
69
|
+
join(srcDir, 'features', 'form', 'adapters', 'inbound', 'FormActions.tsx'),
|
|
70
|
+
join(srcDir, 'features', 'form', 'adapters', 'inbound', 'FormError.tsx'),
|
|
71
|
+
join(srcDir, 'features', 'form', 'adapters', 'inbound', 'FormField.tsx'),
|
|
72
72
|
join(srcDir, 'features', 'typography', 'adapters', 'inbound', 'Heading.tsx'),
|
|
73
73
|
join(srcDir, 'features', 'icon', 'adapters', 'inbound', 'Icon.tsx'),
|
|
74
74
|
join(srcDir, 'features', 'button', 'adapters', 'inbound', 'IconButton.tsx'),
|
|
@@ -99,7 +99,6 @@ const scopedComponentFiles = [
|
|
|
99
99
|
join(srcDir, 'patterns', 'confirm-dialog', 'ConfirmDialog.tsx'),
|
|
100
100
|
join(srcDir, 'patterns', 'disclosure-section', 'DisclosureSection.tsx'),
|
|
101
101
|
join(srcDir, 'features', 'empty-state', 'adapters', 'inbound', 'EmptyState.tsx'),
|
|
102
|
-
join(srcDir, 'patterns', 'form-field', 'FormField.tsx'),
|
|
103
102
|
join(srcDir, 'patterns', 'inspector-field', 'InspectorField.tsx'),
|
|
104
103
|
join(srcDir, 'patterns', 'list', 'List.tsx'),
|
|
105
104
|
join(srcDir, 'patterns', 'list', 'ListRow.tsx'),
|
|
@@ -136,7 +135,7 @@ const scopedPropTypeFiles = [
|
|
|
136
135
|
join(srcDir, 'types', 'media-card.ts'),
|
|
137
136
|
join(srcDir, 'types', 'metric-card.ts'),
|
|
138
137
|
join(srcDir, 'types', 'checkbox.ts'),
|
|
139
|
-
join(srcDir, '
|
|
138
|
+
join(srcDir, 'types', 'form.ts'),
|
|
140
139
|
join(srcDir, 'types', 'heading.ts'),
|
|
141
140
|
join(srcDir, 'types', 'icon.ts'),
|
|
142
141
|
join(srcDir, 'types', 'icon-button.ts'),
|
|
@@ -162,7 +161,6 @@ const scopedPropTypeFiles = [
|
|
|
162
161
|
join(srcDir, 'patterns', 'confirm-dialog', 'types.ts'),
|
|
163
162
|
join(srcDir, 'patterns', 'disclosure-section', 'types.ts'),
|
|
164
163
|
join(srcDir, 'types', 'empty-state.ts'),
|
|
165
|
-
join(srcDir, 'patterns', 'form-field', 'types.ts'),
|
|
166
164
|
join(srcDir, 'patterns', 'inspector-field', 'types.ts'),
|
|
167
165
|
join(srcDir, 'patterns', 'list', 'types.ts'),
|
|
168
166
|
join(srcDir, 'patterns', 'notice', 'types.ts'),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
import type { ZoraBaseProps } from '
|
|
3
|
+
import type { ZoraBaseProps } from '../theme/ZoraBaseProps';
|
|
4
4
|
|
|
5
|
-
export type DatePickerValue =
|
|
5
|
+
export type DatePickerValue = string | null;
|
|
6
6
|
|
|
7
7
|
export interface DatePickerProps extends ZoraBaseProps {
|
|
8
8
|
value: DatePickerValue;
|
|
@@ -11,10 +11,10 @@ export interface DatePickerProps extends ZoraBaseProps {
|
|
|
11
11
|
description?: React.ReactNode;
|
|
12
12
|
error?: React.ReactNode;
|
|
13
13
|
placeholder?: React.ReactNode;
|
|
14
|
-
minDate?:
|
|
15
|
-
maxDate?:
|
|
14
|
+
minDate?: string;
|
|
15
|
+
maxDate?: string;
|
|
16
16
|
disabled?: boolean;
|
|
17
17
|
required?: boolean;
|
|
18
|
-
formatDate?: (value:
|
|
18
|
+
formatDate?: (value: string) => React.ReactNode;
|
|
19
19
|
testID?: string;
|
|
20
20
|
}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import type { FieldProps as SurfaceFieldProps } from '@ankhorage/surface';
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
|
|
4
|
-
import type { ZoraBaseProps } from '
|
|
5
|
-
import type { TextInputProps } from '
|
|
4
|
+
import type { ZoraBaseProps } from '../theme/ZoraBaseProps';
|
|
5
|
+
import type { TextInputProps } from './text-input';
|
|
6
6
|
|
|
7
7
|
export type ValidationRule =
|
|
8
8
|
| { kind: 'required'; message?: string }
|
|
9
9
|
| { kind: 'email'; message?: string }
|
|
10
10
|
| { kind: 'minLength'; value: number; message?: string }
|
|
11
11
|
| { kind: 'pattern'; value: string; message?: string };
|
|
12
|
-
|
|
13
12
|
export type FormFieldValue = string;
|
|
14
13
|
export type FormValues<TName extends string = string> = Record<TName, FormFieldValue>;
|
|
15
14
|
export type FormErrors<TName extends string = string> = Partial<Record<TName, React.ReactNode>>;
|
|
16
15
|
export type FormValidationErrors<TName extends string = string> = Partial<Record<TName, string>>;
|
|
17
|
-
|
|
18
16
|
export type FormFieldInputType = 'email' | 'number' | 'otp' | 'password' | 'tel' | 'text' | 'url';
|
|
19
17
|
|
|
20
18
|
export interface FormFieldConfig<TName extends string = string> {
|
|
@@ -37,7 +35,16 @@ export interface FormFieldConfig<TName extends string = string> {
|
|
|
37
35
|
testID?: string;
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
interface
|
|
38
|
+
export interface FormProps extends ZoraBaseProps {
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
onSubmit?: () => void | Promise<void>;
|
|
41
|
+
loading?: boolean;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
submitLabel?: React.ReactNode;
|
|
44
|
+
actions?: React.ReactNode;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface FormFieldProps
|
|
41
48
|
extends
|
|
42
49
|
ZoraBaseProps,
|
|
43
50
|
Pick<
|
|
@@ -49,18 +56,6 @@ interface FormFieldWrapperProps
|
|
|
49
56
|
helperText?: React.ReactNode;
|
|
50
57
|
}
|
|
51
58
|
|
|
52
|
-
export interface FormFieldControlProps<TName extends string = string> extends ZoraBaseProps {
|
|
53
|
-
field: FormFieldConfig<TName>;
|
|
54
|
-
value: FormFieldValue;
|
|
55
|
-
onChange: (name: TName, value: FormFieldValue) => void;
|
|
56
|
-
error?: React.ReactNode;
|
|
57
|
-
disabled?: boolean;
|
|
58
|
-
loading?: boolean;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export type FormFieldProps<TName extends string = string> =
|
|
62
|
-
FormFieldControlProps<TName> | FormFieldWrapperProps;
|
|
63
|
-
|
|
64
59
|
export interface FormActionsProps extends ZoraBaseProps {
|
|
65
60
|
submitLabel?: React.ReactNode;
|
|
66
61
|
loading?: boolean;
|
|
@@ -68,31 +63,13 @@ export interface FormActionsProps extends ZoraBaseProps {
|
|
|
68
63
|
onSubmit?: () => void;
|
|
69
64
|
children?: React.ReactNode;
|
|
70
65
|
}
|
|
71
|
-
|
|
72
66
|
export interface FormErrorProps extends ZoraBaseProps {
|
|
73
67
|
error?: React.ReactNode;
|
|
74
68
|
}
|
|
75
|
-
|
|
76
|
-
export interface FormProps<TName extends string = string> extends ZoraBaseProps {
|
|
77
|
-
fields: readonly FormFieldConfig<TName>[];
|
|
78
|
-
values: FormValues<TName>;
|
|
79
|
-
onChange: (values: FormValues<TName>) => void;
|
|
80
|
-
onSubmit: (values: FormValues<TName>) => void | Promise<void>;
|
|
81
|
-
errors?: FormErrors<TName>;
|
|
82
|
-
error?: React.ReactNode;
|
|
83
|
-
loading?: boolean;
|
|
84
|
-
disabled?: boolean;
|
|
85
|
-
submitLabel?: React.ReactNode;
|
|
86
|
-
actions?: React.ReactNode;
|
|
87
|
-
footer?: React.ReactNode;
|
|
88
|
-
validateOnChange?: boolean;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
69
|
export interface FormValidationResult<TName extends string = string> {
|
|
92
70
|
errors: FormValidationErrors<TName>;
|
|
93
71
|
valid: boolean;
|
|
94
72
|
}
|
|
95
|
-
|
|
96
73
|
export interface UseFormControllerOptions<TName extends string = string> {
|
|
97
74
|
fields: readonly FormFieldConfig<TName>[];
|
|
98
75
|
initialValues?: Partial<FormValues<TName>>;
|
|
@@ -102,7 +79,6 @@ export interface UseFormControllerOptions<TName extends string = string> {
|
|
|
102
79
|
onSubmit?: (values: FormValues<TName>) => void | Promise<void>;
|
|
103
80
|
validateOnChange?: boolean;
|
|
104
81
|
}
|
|
105
|
-
|
|
106
82
|
export interface UseFormControllerResult<TName extends string = string> {
|
|
107
83
|
values: FormValues<TName>;
|
|
108
84
|
errors: FormErrors<TName>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
import type { ZoraButtonVariant, ZoraColor } from '
|
|
4
|
-
import type { ZoraBaseProps } from '
|
|
3
|
+
import type { ZoraButtonVariant, ZoraColor } from '../internal/recipes';
|
|
4
|
+
import type { ZoraBaseProps } from '../theme/ZoraBaseProps';
|
|
5
5
|
|
|
6
6
|
export type HeroAlign = 'start' | 'center';
|
|
7
7
|
export type HeroLayout = 'stack' | 'split' | 'mediaFirst';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BoxProps, StackProps } from '
|
|
2
|
-
import type { ZoraBaseProps } from '
|
|
1
|
+
import type { BoxProps, StackProps } from '../features/layout/public';
|
|
2
|
+
import type { ZoraBaseProps } from '../theme/ZoraBaseProps';
|
|
3
3
|
|
|
4
4
|
export type SkeletonRadius = BoxProps['radius'];
|
|
5
5
|
export type SkeletonDimension = BoxProps['width'];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/DatePicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA+U/C;;GAEG;AACH,eAAO,MAAM,UAAU,uDAAsC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../src/components/date-picker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AAClF,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,mEAAmE;AACnE,SAAS,WAAW,CAAC,KAAsB,EAAE,WAAwC;IACnF,OAAO,CACL,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CACb;MAAA,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CACrC;QAAA,CAAC,KAAK,CACR;MAAA,EAAE,IAAI,CACN;MAAA,CAAC,WAAW,CAAC,CAAC,CAAC,CACb,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CACxC;UAAA,CAAC,WAAW,CACd;QAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,I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CAAC,CAAC,CAAC,SAAS,CAAC,CAC9D,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAEtC;cAAA,CAAC,GAAG,CAAC,OAAO,EAAE,CAChB;YAAA,EAAE,MAAM,CACV;UAAA,EAAE,GAAG,CAAC,CACP,CAAC;QACJ,CAAC,CAAC,CACJ;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import { Field } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { useBottomSheet } from '../../features/bottom-sheet/public';\nimport { Button } from '../../features/button/public';\nimport { Box, Stack } from '../../features/layout/public';\nimport { Text } from '../../features/typography/public';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport type { DatePickerProps } from './types';\n\nconst WEEKDAY_LABELS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] as const;\nconst DAY_CELL_WIDTH = 42;\n\n/*** Render the field label and optional supporting description. */\nfunction renderLabel(label: React.ReactNode, description: React.ReactNode | undefined) {\n return (\n <Stack gap=\"xs\">\n <Text variant=\"label\" weight=\"semiBold\">\n {label}\n </Text>\n {description ? (\n <Text emphasis=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n );\n}\n\n/*** Normalize a date to the start of its local calendar day. */\nfunction startOfLocalDay(value: Date): Date {\n return new Date(value.getFullYear(), value.getMonth(), value.getDate());\n}\n\n/*** Compare two values by local calendar day. */\nfunction isSameLocalDay(left: Date | null, right: Date): boolean {\n if (!left) return false;\n return startOfLocalDay(left).getTime() === startOfLocalDay(right).getTime();\n}\n\n/*** Report whether one local calendar day precedes another. */\nfunction isBeforeLocalDay(left: Date, right: Date): boolean {\n return startOfLocalDay(left).getTime() < startOfLocalDay(right).getTime();\n}\n\n/*** Report whether one local calendar day follows another. */\nfunction isAfterLocalDay(left: Date, right: Date): boolean {\n return startOfLocalDay(left).getTime() > startOfLocalDay(right).getTime();\n}\n\n/*** Resolve whether a date falls outside the configured picker range. */\nfunction isDateDisabled(\n value: Date,\n minDate: Date | undefined,\n maxDate: Date | undefined,\n): boolean {\n if (minDate && isBeforeLocalDay(value, minDate)) return true;\n if (maxDate && isAfterLocalDay(value, maxDate)) return true;\n return false;\n}\n\n/*** Format the current calendar month for the picker heading. */\nfunction formatMonthLabel(value: Date): string {\n return value.toLocaleDateString(undefined, { month: 'long', year: 'numeric' });\n}\n\n/*** Format a selected date with the platform locale defaults. */\nfunction formatDefaultDate(value: Date): string {\n return value.toLocaleDateString();\n}\n\n/*** Build the padded calendar grid for one month. */\nfunction createMonthDays(month: Date): (Date | null)[] {\n const firstDay = new Date(month.getFullYear(), month.getMonth(), 1);\n const dayCount = new Date(month.getFullYear(), month.getMonth() + 1, 0).getDate();\n const days: (Date | null)[] = [];\n\n for (let offset = 0; offset < firstDay.getDay(); offset += 1) days.push(null);\n for (let day = 1; day <= dayCount; day += 1) {\n days.push(new Date(month.getFullYear(), month.getMonth(), day));\n }\n while (days.length % 7 !== 0) days.push(null);\n\n return days;\n}\n\n/*** Resolve the month initially shown by the calendar sheet. */\nfunction resolveInitialMonth(value: Date | null, minDate: Date | undefined): Date {\n const base = value ?? minDate ?? new Date();\n return new Date(base.getFullYear(), base.getMonth(), 1);\n}\n\n/*** Report whether the configured range intersects a candidate month. */\nfunction canNavigateToMonth(\n month: Date,\n minDate: Date | undefined,\n maxDate: Date | undefined,\n): boolean {\n const firstDay = new Date(month.getFullYear(), month.getMonth(), 1);\n const lastDay = new Date(month.getFullYear(), month.getMonth() + 1, 0);\n\n if (maxDate && isAfterLocalDay(firstDay, maxDate)) return false;\n if (minDate && isBeforeLocalDay(lastDay, minDate)) return false;\n return true;\n}\n\nfunction DatePickerInner({\n themeId: _themeId,\n mode: _mode,\n value,\n onValueChange,\n label,\n description,\n error,\n placeholder = 'Choose date',\n minDate,\n maxDate,\n disabled = false,\n required = false,\n formatDate,\n testID,\n interactionPolicy,\n}: DatePickerProps) {\n const { dismiss, present } = useBottomSheet();\n const passive = interactionPolicy === 'passive';\n const displayValue = value\n ? formatDate\n ? formatDate(value)\n : formatDefaultDate(value)\n : placeholder;\n\n /*** Present the calendar content through the shared BottomSheet controller. */\n function openPicker() {\n if (passive) return;\n present({\n content: (\n <DatePickerSheet\n description={description}\n interactionPolicy={interactionPolicy}\n label={label}\n maxDate={maxDate}\n minDate={minDate}\n onDismiss={dismiss}\n onSelect={(date) => {\n onValueChange?.(startOfLocalDay(date));\n dismiss();\n }}\n testID={testID}\n value={value}\n />\n ),\n });\n }\n\n return (\n <Field\n disabled={disabled}\n errorText={error}\n invalid={Boolean(error)}\n label={label ? renderLabel(label, description) : undefined}\n required={required}\n testID={testID}\n >\n <Button\n disabled={disabled}\n interactionPolicy={interactionPolicy}\n onPress={openPicker}\n testID={testID ? `${testID}-trigger` : undefined}\n trailingIcon={{ name: 'calendar-outline' }}\n variant=\"outline\"\n >\n {displayValue}\n </Button>\n </Field>\n );\n}\n\ninterface DatePickerSheetProps extends Pick<\n DatePickerProps,\n 'description' | 'interactionPolicy' | 'label' | 'maxDate' | 'minDate' | 'testID' | 'value'\n> {\n onDismiss: () => void;\n onSelect: (value: Date) => void;\n}\n\n/*** Render the calendar-specific content inside the shared BottomSheet host. */\nfunction DatePickerSheet({\n description,\n interactionPolicy,\n label,\n maxDate,\n minDate,\n onDismiss,\n onSelect,\n testID,\n value,\n}: DatePickerSheetProps) {\n const [displayMonth, setDisplayMonth] = React.useState(() => resolveInitialMonth(value, minDate));\n const monthDays = React.useMemo(() => createMonthDays(displayMonth), [displayMonth]);\n\n return (\n <Stack gap=\"m\" p=\"m\" testID={testID ? `${testID}-sheet` : undefined}>\n <PickerSheetHeader description={description} title={label ?? 'Choose date'} />\n <DatePickerMonthNavigation\n displayMonth={displayMonth}\n interactionPolicy={interactionPolicy}\n maxDate={maxDate}\n minDate={minDate}\n onMonthChange={setDisplayMonth}\n />\n <DatePickerWeekdays />\n <DatePickerCalendar\n interactionPolicy={interactionPolicy}\n maxDate={maxDate}\n minDate={minDate}\n monthDays={monthDays}\n onSelect={onSelect}\n testID={testID}\n value={value}\n />\n <Button fullWidth interactionPolicy={interactionPolicy} onPress={onDismiss} variant=\"ghost\">\n Cancel\n </Button>\n </Stack>\n );\n}\n\n/*** Render the shared title block used by the calendar sheet. */\nfunction PickerSheetHeader({\n description,\n title,\n}: {\n description: React.ReactNode | undefined;\n title: React.ReactNode;\n}) {\n return (\n <Stack gap=\"xxs\">\n <Text align=\"center\" variant=\"label\" weight=\"semiBold\">\n {title}\n </Text>\n {description ? (\n <Text align=\"center\" emphasis=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n );\n}\n\n/*** Render previous/next month controls for the calendar sheet. */\nfunction DatePickerMonthNavigation({\n displayMonth,\n interactionPolicy,\n maxDate,\n minDate,\n onMonthChange,\n}: Pick<DatePickerSheetProps, 'interactionPolicy' | 'maxDate' | 'minDate'> & {\n displayMonth: Date;\n onMonthChange: (month: Date) => void;\n}) {\n const previousMonth = new Date(displayMonth.getFullYear(), displayMonth.getMonth() - 1, 1);\n const nextMonth = new Date(displayMonth.getFullYear(), displayMonth.getMonth() + 1, 1);\n\n return (\n <Stack align=\"center\" direction=\"row\" justify=\"space-between\">\n <Button\n disabled={!canNavigateToMonth(previousMonth, minDate, maxDate)}\n interactionPolicy={interactionPolicy}\n onPress={() => onMonthChange(previousMonth)}\n size=\"s\"\n variant=\"ghost\"\n >\n Previous\n </Button>\n <Text align=\"center\" variant=\"label\" weight=\"semiBold\">\n {formatMonthLabel(displayMonth)}\n </Text>\n <Button\n disabled={!canNavigateToMonth(nextMonth, minDate, maxDate)}\n interactionPolicy={interactionPolicy}\n onPress={() => onMonthChange(nextMonth)}\n size=\"s\"\n variant=\"ghost\"\n >\n Next\n </Button>\n </Stack>\n );\n}\n\n/*** Render weekday headings for the calendar grid. */\nfunction DatePickerWeekdays() {\n return (\n <Stack direction=\"row\" justify=\"space-between\">\n {WEEKDAY_LABELS.map((weekday) => (\n <Box key={weekday} width={DAY_CELL_WIDTH}>\n <Text align=\"center\" emphasis=\"muted\" variant=\"caption\" weight=\"semiBold\">\n {weekday}\n </Text>\n </Box>\n ))}\n </Stack>\n );\n}\n\n/*** Render selectable day cells for the current calendar month. */\nfunction DatePickerCalendar({\n interactionPolicy,\n maxDate,\n minDate,\n monthDays,\n onSelect,\n testID,\n value,\n}: Pick<DatePickerSheetProps, 'interactionPolicy' | 'maxDate' | 'minDate' | 'testID' | 'value'> & {\n monthDays: readonly (Date | null)[];\n onSelect: (value: Date) => void;\n}) {\n return (\n <Stack direction=\"row\" gap=\"xs\" wrap=\"wrap\">\n {monthDays.map((day, index) => {\n if (!day) return <Box key={`empty-${index}`} width={DAY_CELL_WIDTH} />;\n const selected = isSameLocalDay(value, day);\n return (\n <Box key={day.toISOString()} width={DAY_CELL_WIDTH}>\n <Button\n color={selected ? 'primary' : 'neutral'}\n disabled={isDateDisabled(day, minDate, maxDate)}\n interactionPolicy={interactionPolicy}\n onPress={() => onSelect(day)}\n size=\"s\"\n testID={testID ? `${testID}-day-${day.getDate()}` : undefined}\n variant={selected ? 'solid' : 'ghost'}\n >\n {day.getDate()}\n </Button>\n </Box>\n );\n })}\n </Stack>\n );\n}\n\n/***\n * Date input control with calendar selection and formatted display value.\n */\nexport const DatePicker = withZoraThemeScope(DatePickerInner);\n"]}
|