@mgamadeus/ddd-admin-ui 0.0.0-stage → 0.1.0-rc.2
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/.claude/skills/ddd-admin-ui-specialist/SKILL.md +159 -0
- package/CHANGELOG.md +33 -0
- package/LICENSE +21 -0
- package/README.md +239 -2
- package/STANDARDS.md +385 -0
- package/dist/cli/ddd-admin-ui.d.ts +3 -0
- package/dist/cli/ddd-admin-ui.d.ts.map +1 -0
- package/dist/cli/ddd-admin-ui.js +18 -0
- package/dist/cli/ddd-admin-ui.js.map +1 -0
- package/dist/cli/linkSkills.d.ts +25 -0
- package/dist/cli/linkSkills.d.ts.map +1 -0
- package/dist/cli/linkSkills.js +76 -0
- package/dist/cli/linkSkills.js.map +1 -0
- package/dist/components.css +187 -0
- package/dist/form/DrawerFooter.d.ts +18 -0
- package/dist/form/DrawerFooter.d.ts.map +1 -0
- package/dist/form/DrawerFooter.js +47 -0
- package/dist/form/DrawerFooter.js.map +1 -0
- package/dist/form/Form.d.ts +28 -0
- package/dist/form/Form.d.ts.map +1 -0
- package/dist/form/Form.js +20 -0
- package/dist/form/Form.js.map +1 -0
- package/dist/form/FormActions.d.ts +35 -0
- package/dist/form/FormActions.d.ts.map +1 -0
- package/dist/form/FormActions.js +80 -0
- package/dist/form/FormActions.js.map +1 -0
- package/dist/form/FormDrawer.d.ts +36 -0
- package/dist/form/FormDrawer.d.ts.map +1 -0
- package/dist/form/FormDrawer.js +31 -0
- package/dist/form/FormDrawer.js.map +1 -0
- package/dist/form/FormErrors.d.ts +22 -0
- package/dist/form/FormErrors.d.ts.map +1 -0
- package/dist/form/FormErrors.js +46 -0
- package/dist/form/FormErrors.js.map +1 -0
- package/dist/form/FormField.d.ts +74 -0
- package/dist/form/FormField.d.ts.map +1 -0
- package/dist/form/FormField.js +46 -0
- package/dist/form/FormField.js.map +1 -0
- package/dist/form/FormHeader.d.ts +20 -0
- package/dist/form/FormHeader.d.ts.map +1 -0
- package/dist/form/FormHeader.js +9 -0
- package/dist/form/FormHeader.js.map +1 -0
- package/dist/form/FormJumpBar.d.ts +20 -0
- package/dist/form/FormJumpBar.d.ts.map +1 -0
- package/dist/form/FormJumpBar.js +49 -0
- package/dist/form/FormJumpBar.js.map +1 -0
- package/dist/form/FormSubmitButton.d.ts +17 -0
- package/dist/form/FormSubmitButton.d.ts.map +1 -0
- package/dist/form/FormSubmitButton.js +14 -0
- package/dist/form/FormSubmitButton.js.map +1 -0
- package/dist/form/FormWrapper.d.ts +13 -0
- package/dist/form/FormWrapper.d.ts.map +1 -0
- package/dist/form/FormWrapper.js +15 -0
- package/dist/form/FormWrapper.js.map +1 -0
- package/dist/form/drawerSlots.d.ts +10 -0
- package/dist/form/drawerSlots.d.ts.map +1 -0
- package/dist/form/drawerSlots.js +7 -0
- package/dist/form/drawerSlots.js.map +1 -0
- package/dist/form/fieldLabels.d.ts +17 -0
- package/dist/form/fieldLabels.d.ts.map +1 -0
- package/dist/form/fieldLabels.js +20 -0
- package/dist/form/fieldLabels.js.map +1 -0
- package/dist/form/formPanelClasses.d.ts +3 -0
- package/dist/form/formPanelClasses.d.ts.map +1 -0
- package/dist/form/formPanelClasses.js +3 -0
- package/dist/form/formPanelClasses.js.map +1 -0
- package/dist/form/index.d.ts +58 -0
- package/dist/form/index.d.ts.map +1 -0
- package/dist/form/index.js +34 -0
- package/dist/form/index.js.map +1 -0
- package/dist/form/useConfirmDialog.d.ts +9 -0
- package/dist/form/useConfirmDialog.d.ts.map +1 -0
- package/dist/form/useConfirmDialog.js +29 -0
- package/dist/form/useConfirmDialog.js.map +1 -0
- package/dist/glass/ActionRow.d.ts +27 -0
- package/dist/glass/ActionRow.d.ts.map +1 -0
- package/dist/glass/ActionRow.js +22 -0
- package/dist/glass/ActionRow.js.map +1 -0
- package/dist/glass/CollapsibleCard.d.ts +36 -0
- package/dist/glass/CollapsibleCard.d.ts.map +1 -0
- package/dist/glass/CollapsibleCard.js +27 -0
- package/dist/glass/CollapsibleCard.js.map +1 -0
- package/dist/glass/GlassGroup.d.ts +26 -0
- package/dist/glass/GlassGroup.d.ts.map +1 -0
- package/dist/glass/GlassGroup.js +34 -0
- package/dist/glass/GlassGroup.js.map +1 -0
- package/dist/glass/GlassPill.d.ts +23 -0
- package/dist/glass/GlassPill.d.ts.map +1 -0
- package/dist/glass/GlassPill.js +20 -0
- package/dist/glass/GlassPill.js.map +1 -0
- package/dist/glass/QuickFilterPills.d.ts +38 -0
- package/dist/glass/QuickFilterPills.d.ts.map +1 -0
- package/dist/glass/QuickFilterPills.js +30 -0
- package/dist/glass/QuickFilterPills.js.map +1 -0
- package/dist/glass/index.d.ts +11 -0
- package/dist/glass/index.d.ts.map +1 -0
- package/dist/glass/index.js +7 -0
- package/dist/glass/index.js.map +1 -0
- package/dist/i18n/Translate.d.ts +8 -0
- package/dist/i18n/Translate.d.ts.map +1 -0
- package/dist/i18n/Translate.js +9 -0
- package/dist/i18n/Translate.js.map +1 -0
- package/dist/i18n/format.d.ts +13 -0
- package/dist/i18n/format.d.ts.map +1 -0
- package/dist/i18n/format.js +15 -0
- package/dist/i18n/format.js.map +1 -0
- package/dist/i18n/hints.json +130 -0
- package/dist/i18n/index.d.ts +7 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +7 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/localeFormat.d.ts +10 -0
- package/dist/i18n/localeFormat.d.ts.map +1 -0
- package/dist/i18n/localeFormat.js +36 -0
- package/dist/i18n/localeFormat.js.map +1 -0
- package/dist/i18n/plural.d.ts +15 -0
- package/dist/i18n/plural.d.ts.map +1 -0
- package/dist/i18n/plural.js +95 -0
- package/dist/i18n/plural.js.map +1 -0
- package/dist/i18n/serverMessages.d.ts +26 -0
- package/dist/i18n/serverMessages.d.ts.map +1 -0
- package/dist/i18n/serverMessages.js +146 -0
- package/dist/i18n/serverMessages.js.map +1 -0
- package/dist/i18n/store.d.ts +36 -0
- package/dist/i18n/store.d.ts.map +1 -0
- package/dist/i18n/store.js +36 -0
- package/dist/i18n/store.js.map +1 -0
- package/dist/i18n/useTranslate.d.ts +17 -0
- package/dist/i18n/useTranslate.d.ts.map +1 -0
- package/dist/i18n/useTranslate.js +22 -0
- package/dist/i18n/useTranslate.js.map +1 -0
- package/dist/i18n-keys.json +1069 -0
- package/dist/list/ChipToggleGroup.d.ts +36 -0
- package/dist/list/ChipToggleGroup.d.ts.map +1 -0
- package/dist/list/ChipToggleGroup.js +34 -0
- package/dist/list/ChipToggleGroup.js.map +1 -0
- package/dist/list/Combobox.d.ts +32 -0
- package/dist/list/Combobox.d.ts.map +1 -0
- package/dist/list/Combobox.js +27 -0
- package/dist/list/Combobox.js.map +1 -0
- package/dist/list/EmptyValue.d.ts +14 -0
- package/dist/list/EmptyValue.d.ts.map +1 -0
- package/dist/list/EmptyValue.js +11 -0
- package/dist/list/EmptyValue.js.map +1 -0
- package/dist/list/EntityListBody.d.ts +27 -0
- package/dist/list/EntityListBody.d.ts.map +1 -0
- package/dist/list/EntityListBody.js +24 -0
- package/dist/list/EntityListBody.js.map +1 -0
- package/dist/list/EntityListBulkBar.d.ts +38 -0
- package/dist/list/EntityListBulkBar.d.ts.map +1 -0
- package/dist/list/EntityListBulkBar.js +19 -0
- package/dist/list/EntityListBulkBar.js.map +1 -0
- package/dist/list/EntityListCard.d.ts +22 -0
- package/dist/list/EntityListCard.d.ts.map +1 -0
- package/dist/list/EntityListCard.js +15 -0
- package/dist/list/EntityListCard.js.map +1 -0
- package/dist/list/EntityListEmpty.d.ts +13 -0
- package/dist/list/EntityListEmpty.d.ts.map +1 -0
- package/dist/list/EntityListEmpty.js +11 -0
- package/dist/list/EntityListEmpty.js.map +1 -0
- package/dist/list/EntityListGrid.d.ts +29 -0
- package/dist/list/EntityListGrid.d.ts.map +1 -0
- package/dist/list/EntityListGrid.js +21 -0
- package/dist/list/EntityListGrid.js.map +1 -0
- package/dist/list/EntityListLoadMore.d.ts +15 -0
- package/dist/list/EntityListLoadMore.d.ts.map +1 -0
- package/dist/list/EntityListLoadMore.js +27 -0
- package/dist/list/EntityListLoadMore.js.map +1 -0
- package/dist/list/EntityListStatus.d.ts +11 -0
- package/dist/list/EntityListStatus.d.ts.map +1 -0
- package/dist/list/EntityListStatus.js +22 -0
- package/dist/list/EntityListStatus.js.map +1 -0
- package/dist/list/EntityListTable.d.ts +34 -0
- package/dist/list/EntityListTable.d.ts.map +1 -0
- package/dist/list/EntityListTable.js +43 -0
- package/dist/list/EntityListTable.js.map +1 -0
- package/dist/list/EntityListToolbar.d.ts +39 -0
- package/dist/list/EntityListToolbar.d.ts.map +1 -0
- package/dist/list/EntityListToolbar.js +25 -0
- package/dist/list/EntityListToolbar.js.map +1 -0
- package/dist/list/EntityListViewToggle.d.ts +17 -0
- package/dist/list/EntityListViewToggle.d.ts.map +1 -0
- package/dist/list/EntityListViewToggle.js +38 -0
- package/dist/list/EntityListViewToggle.js.map +1 -0
- package/dist/list/MultiSelect.d.ts +33 -0
- package/dist/list/MultiSelect.d.ts.map +1 -0
- package/dist/list/MultiSelect.js +60 -0
- package/dist/list/MultiSelect.js.map +1 -0
- package/dist/list/SearchField.d.ts +24 -0
- package/dist/list/SearchField.d.ts.map +1 -0
- package/dist/list/SearchField.js +42 -0
- package/dist/list/SearchField.js.map +1 -0
- package/dist/list/StatusBadge.d.ts +34 -0
- package/dist/list/StatusBadge.d.ts.map +1 -0
- package/dist/list/StatusBadge.js +44 -0
- package/dist/list/StatusBadge.js.map +1 -0
- package/dist/list/Tag.d.ts +16 -0
- package/dist/list/Tag.d.ts.map +1 -0
- package/dist/list/Tag.js +15 -0
- package/dist/list/Tag.js.map +1 -0
- package/dist/list/cells.d.ts +53 -0
- package/dist/list/cells.d.ts.map +1 -0
- package/dist/list/cells.js +62 -0
- package/dist/list/cells.js.map +1 -0
- package/dist/list/filterClasses.d.ts +8 -0
- package/dist/list/filterClasses.d.ts.map +1 -0
- package/dist/list/filterClasses.js +8 -0
- package/dist/list/filterClasses.js.map +1 -0
- package/dist/list/filterOptions.d.ts +7 -0
- package/dist/list/filterOptions.d.ts.map +1 -0
- package/dist/list/filterOptions.js +7 -0
- package/dist/list/filterOptions.js.map +1 -0
- package/dist/list/filters.d.ts +78 -0
- package/dist/list/filters.d.ts.map +1 -0
- package/dist/list/filters.js +54 -0
- package/dist/list/filters.js.map +1 -0
- package/dist/list/index.d.ts +89 -0
- package/dist/list/index.d.ts.map +1 -0
- package/dist/list/index.js +51 -0
- package/dist/list/index.js.map +1 -0
- package/dist/list/types.d.ts +59 -0
- package/dist/list/types.d.ts.map +1 -0
- package/dist/list/types.js +3 -0
- package/dist/list/types.js.map +1 -0
- package/dist/logic/browser/prepareImageFile.d.ts +18 -0
- package/dist/logic/browser/prepareImageFile.d.ts.map +1 -0
- package/dist/logic/browser/prepareImageFile.js +26 -0
- package/dist/logic/browser/prepareImageFile.js.map +1 -0
- package/dist/logic/index.d.ts +57 -0
- package/dist/logic/index.d.ts.map +1 -0
- package/dist/logic/index.js +39 -0
- package/dist/logic/index.js.map +1 -0
- package/dist/logic/pure/conditions.d.ts +46 -0
- package/dist/logic/pure/conditions.d.ts.map +1 -0
- package/dist/logic/pure/conditions.js +39 -0
- package/dist/logic/pure/conditions.js.map +1 -0
- package/dist/logic/pure/confirm.d.ts +19 -0
- package/dist/logic/pure/confirm.d.ts.map +1 -0
- package/dist/logic/pure/confirm.js +10 -0
- package/dist/logic/pure/confirm.js.map +1 -0
- package/dist/logic/pure/displayMode.d.ts +12 -0
- package/dist/logic/pure/displayMode.d.ts.map +1 -0
- package/dist/logic/pure/displayMode.js +11 -0
- package/dist/logic/pure/displayMode.js.map +1 -0
- package/dist/logic/pure/entityDrawer.d.ts +24 -0
- package/dist/logic/pure/entityDrawer.d.ts.map +1 -0
- package/dist/logic/pure/entityDrawer.js +3 -0
- package/dist/logic/pure/entityDrawer.js.map +1 -0
- package/dist/logic/pure/fieldPath.d.ts +9 -0
- package/dist/logic/pure/fieldPath.d.ts.map +1 -0
- package/dist/logic/pure/fieldPath.js +17 -0
- package/dist/logic/pure/fieldPath.js.map +1 -0
- package/dist/logic/pure/formValues.d.ts +14 -0
- package/dist/logic/pure/formValues.d.ts.map +1 -0
- package/dist/logic/pure/formValues.js +82 -0
- package/dist/logic/pure/formValues.js.map +1 -0
- package/dist/logic/pure/format.d.ts +15 -0
- package/dist/logic/pure/format.d.ts.map +1 -0
- package/dist/logic/pure/format.js +53 -0
- package/dist/logic/pure/format.js.map +1 -0
- package/dist/logic/pure/locales.d.ts +27 -0
- package/dist/logic/pure/locales.d.ts.map +1 -0
- package/dist/logic/pure/locales.js +50 -0
- package/dist/logic/pure/locales.js.map +1 -0
- package/dist/logic/pure/notify.d.ts +42 -0
- package/dist/logic/pure/notify.d.ts.map +1 -0
- package/dist/logic/pure/notify.js +52 -0
- package/dist/logic/pure/notify.js.map +1 -0
- package/dist/logic/pure/rowActivation.d.ts +6 -0
- package/dist/logic/pure/rowActivation.d.ts.map +1 -0
- package/dist/logic/pure/rowActivation.js +7 -0
- package/dist/logic/pure/rowActivation.js.map +1 -0
- package/dist/logic/pure/runSequential.d.ts +31 -0
- package/dist/logic/pure/runSequential.d.ts.map +1 -0
- package/dist/logic/pure/runSequential.js +47 -0
- package/dist/logic/pure/runSequential.js.map +1 -0
- package/dist/logic/pure/schemas.d.ts +14 -0
- package/dist/logic/pure/schemas.d.ts.map +1 -0
- package/dist/logic/pure/schemas.js +6 -0
- package/dist/logic/pure/schemas.js.map +1 -0
- package/dist/logic/pure/serverViolations.d.ts +35 -0
- package/dist/logic/pure/serverViolations.d.ts.map +1 -0
- package/dist/logic/pure/serverViolations.js +77 -0
- package/dist/logic/pure/serverViolations.js.map +1 -0
- package/dist/logic/pure/status.d.ts +21 -0
- package/dist/logic/pure/status.d.ts.map +1 -0
- package/dist/logic/pure/status.js +3 -0
- package/dist/logic/pure/status.js.map +1 -0
- package/dist/logic/pure/submitError.d.ts +11 -0
- package/dist/logic/pure/submitError.d.ts.map +1 -0
- package/dist/logic/pure/submitError.js +9 -0
- package/dist/logic/pure/submitError.js.map +1 -0
- package/dist/logic/pure/translationState.d.ts +29 -0
- package/dist/logic/pure/translationState.d.ts.map +1 -0
- package/dist/logic/pure/translationState.js +88 -0
- package/dist/logic/pure/translationState.js.map +1 -0
- package/dist/logic/pure/urlListState.d.ts +18 -0
- package/dist/logic/pure/urlListState.d.ts.map +1 -0
- package/dist/logic/pure/urlListState.js +3 -0
- package/dist/logic/pure/urlListState.js.map +1 -0
- package/dist/logic/react/conditionHooks.d.ts +20 -0
- package/dist/logic/react/conditionHooks.d.ts.map +1 -0
- package/dist/logic/react/conditionHooks.js +51 -0
- package/dist/logic/react/conditionHooks.js.map +1 -0
- package/dist/logic/react/useCopyToClipboard.d.ts +9 -0
- package/dist/logic/react/useCopyToClipboard.d.ts.map +1 -0
- package/dist/logic/react/useCopyToClipboard.js +28 -0
- package/dist/logic/react/useCopyToClipboard.js.map +1 -0
- package/dist/logic/react/useDebouncedValue.d.ts +3 -0
- package/dist/logic/react/useDebouncedValue.d.ts.map +1 -0
- package/dist/logic/react/useDebouncedValue.js +12 -0
- package/dist/logic/react/useDebouncedValue.js.map +1 -0
- package/dist/logic/react/useEntityDrawer.d.ts +54 -0
- package/dist/logic/react/useEntityDrawer.d.ts.map +1 -0
- package/dist/logic/react/useEntityDrawer.js +81 -0
- package/dist/logic/react/useEntityDrawer.js.map +1 -0
- package/dist/logic/react/useEntityTranslations.d.ts +57 -0
- package/dist/logic/react/useEntityTranslations.d.ts.map +1 -0
- package/dist/logic/react/useEntityTranslations.js +50 -0
- package/dist/logic/react/useEntityTranslations.js.map +1 -0
- package/dist/logic/react/useFormDirty.d.ts +15 -0
- package/dist/logic/react/useFormDirty.d.ts.map +1 -0
- package/dist/logic/react/useFormDirty.js +17 -0
- package/dist/logic/react/useFormDirty.js.map +1 -0
- package/dist/logic/react/useGrowingWindowList.d.ts +50 -0
- package/dist/logic/react/useGrowingWindowList.d.ts.map +1 -0
- package/dist/logic/react/useGrowingWindowList.js +38 -0
- package/dist/logic/react/useGrowingWindowList.js.map +1 -0
- package/dist/logic/react/useHydrated.d.ts +7 -0
- package/dist/logic/react/useHydrated.d.ts.map +1 -0
- package/dist/logic/react/useHydrated.js +12 -0
- package/dist/logic/react/useHydrated.js.map +1 -0
- package/dist/logic/react/useInfiniteScrollSentinel.d.ts +6 -0
- package/dist/logic/react/useInfiniteScrollSentinel.d.ts.map +1 -0
- package/dist/logic/react/useInfiniteScrollSentinel.js +24 -0
- package/dist/logic/react/useInfiniteScrollSentinel.js.map +1 -0
- package/dist/logic/react/useLocaleName.d.ts +3 -0
- package/dist/logic/react/useLocaleName.d.ts.map +1 -0
- package/dist/logic/react/useLocaleName.js +10 -0
- package/dist/logic/react/useLocaleName.js.map +1 -0
- package/dist/logic/react/useRowActivation.d.ts +12 -0
- package/dist/logic/react/useRowActivation.d.ts.map +1 -0
- package/dist/logic/react/useRowActivation.js +35 -0
- package/dist/logic/react/useRowActivation.js.map +1 -0
- package/dist/logic/react/useRowSelection.d.ts +40 -0
- package/dist/logic/react/useRowSelection.d.ts.map +1 -0
- package/dist/logic/react/useRowSelection.js +70 -0
- package/dist/logic/react/useRowSelection.js.map +1 -0
- package/dist/logic/react/useTranslationRunner.d.ts +27 -0
- package/dist/logic/react/useTranslationRunner.d.ts.map +1 -0
- package/dist/logic/react/useTranslationRunner.js +57 -0
- package/dist/logic/react/useTranslationRunner.js.map +1 -0
- package/dist/logic/react/useUnsavedChangesGuard.d.ts +30 -0
- package/dist/logic/react/useUnsavedChangesGuard.d.ts.map +1 -0
- package/dist/logic/react/useUnsavedChangesGuard.js +66 -0
- package/dist/logic/react/useUnsavedChangesGuard.js.map +1 -0
- package/dist/logic/react/useUrlListState.d.ts +39 -0
- package/dist/logic/react/useUrlListState.d.ts.map +1 -0
- package/dist/logic/react/useUrlListState.js +96 -0
- package/dist/logic/react/useUrlListState.js.map +1 -0
- package/dist/media/FormMediaItemField.d.ts +38 -0
- package/dist/media/FormMediaItemField.d.ts.map +1 -0
- package/dist/media/FormMediaItemField.js +35 -0
- package/dist/media/FormMediaItemField.js.map +1 -0
- package/dist/media/MediaItemField.d.ts +20 -0
- package/dist/media/MediaItemField.d.ts.map +1 -0
- package/dist/media/MediaItemField.js +15 -0
- package/dist/media/MediaItemField.js.map +1 -0
- package/dist/media/MediaItemPickerDialog.d.ts +48 -0
- package/dist/media/MediaItemPickerDialog.d.ts.map +1 -0
- package/dist/media/MediaItemPickerDialog.js +36 -0
- package/dist/media/MediaItemPickerDialog.js.map +1 -0
- package/dist/media/MediaPreview.d.ts +16 -0
- package/dist/media/MediaPreview.d.ts.map +1 -0
- package/dist/media/MediaPreview.js +20 -0
- package/dist/media/MediaPreview.js.map +1 -0
- package/dist/media/index.d.ts +18 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/index.js +9 -0
- package/dist/media/index.js.map +1 -0
- package/dist/media/types.d.ts +24 -0
- package/dist/media/types.d.ts.map +1 -0
- package/dist/media/types.js +2 -0
- package/dist/media/types.js.map +1 -0
- package/dist/next/index.d.ts +8 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +8 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/listViewParam.d.ts +3 -0
- package/dist/next/listViewParam.d.ts.map +1 -0
- package/dist/next/listViewParam.js +3 -0
- package/dist/next/listViewParam.js.map +1 -0
- package/dist/next/searchParamsWriter.d.ts +31 -0
- package/dist/next/searchParamsWriter.d.ts.map +1 -0
- package/dist/next/searchParamsWriter.js +87 -0
- package/dist/next/searchParamsWriter.js.map +1 -0
- package/dist/next/storage.d.ts +11 -0
- package/dist/next/storage.d.ts.map +1 -0
- package/dist/next/storage.js +34 -0
- package/dist/next/storage.js.map +1 -0
- package/dist/next/useListViewParam.d.ts +12 -0
- package/dist/next/useListViewParam.d.ts.map +1 -0
- package/dist/next/useListViewParam.js +45 -0
- package/dist/next/useListViewParam.js.map +1 -0
- package/dist/next/useNextDrawerUrlAdapter.d.ts +11 -0
- package/dist/next/useNextDrawerUrlAdapter.d.ts.map +1 -0
- package/dist/next/useNextDrawerUrlAdapter.js +28 -0
- package/dist/next/useNextDrawerUrlAdapter.js.map +1 -0
- package/dist/next/useNextUrlStateAdapter.d.ts +20 -0
- package/dist/next/useNextUrlStateAdapter.d.ts.map +1 -0
- package/dist/next/useNextUrlStateAdapter.js +28 -0
- package/dist/next/useNextUrlStateAdapter.js.map +1 -0
- package/dist/notify-sonner/Toaster.d.ts +8 -0
- package/dist/notify-sonner/Toaster.d.ts.map +1 -0
- package/dist/notify-sonner/Toaster.js +24 -0
- package/dist/notify-sonner/Toaster.js.map +1 -0
- package/dist/notify-sonner/index.d.ts +3 -0
- package/dist/notify-sonner/index.d.ts.map +1 -0
- package/dist/notify-sonner/index.js +4 -0
- package/dist/notify-sonner/index.js.map +1 -0
- package/dist/notify-sonner/sonnerNotifications.d.ts +4 -0
- package/dist/notify-sonner/sonnerNotifications.d.ts.map +1 -0
- package/dist/notify-sonner/sonnerNotifications.js +29 -0
- package/dist/notify-sonner/sonnerNotifications.js.map +1 -0
- package/dist/page/DefinitionList.d.ts +24 -0
- package/dist/page/DefinitionList.d.ts.map +1 -0
- package/dist/page/DefinitionList.js +20 -0
- package/dist/page/DefinitionList.js.map +1 -0
- package/dist/page/DetailHeader.d.ts +26 -0
- package/dist/page/DetailHeader.d.ts.map +1 -0
- package/dist/page/DetailHeader.js +14 -0
- package/dist/page/DetailHeader.js.map +1 -0
- package/dist/page/EditableCard.d.ts +39 -0
- package/dist/page/EditableCard.d.ts.map +1 -0
- package/dist/page/EditableCard.js +21 -0
- package/dist/page/EditableCard.js.map +1 -0
- package/dist/page/EntityDetailShell.d.ts +48 -0
- package/dist/page/EntityDetailShell.d.ts.map +1 -0
- package/dist/page/EntityDetailShell.js +25 -0
- package/dist/page/EntityDetailShell.js.map +1 -0
- package/dist/page/EntityListPage.d.ts +30 -0
- package/dist/page/EntityListPage.d.ts.map +1 -0
- package/dist/page/EntityListPage.js +12 -0
- package/dist/page/EntityListPage.js.map +1 -0
- package/dist/page/EntityMetadata.d.ts +21 -0
- package/dist/page/EntityMetadata.d.ts.map +1 -0
- package/dist/page/EntityMetadata.js +39 -0
- package/dist/page/EntityMetadata.js.map +1 -0
- package/dist/page/EntityTabs.d.ts +38 -0
- package/dist/page/EntityTabs.d.ts.map +1 -0
- package/dist/page/EntityTabs.js +51 -0
- package/dist/page/EntityTabs.js.map +1 -0
- package/dist/page/PageFrame.d.ts +25 -0
- package/dist/page/PageFrame.d.ts.map +1 -0
- package/dist/page/PageFrame.js +11 -0
- package/dist/page/PageFrame.js.map +1 -0
- package/dist/page/PageHeader.d.ts +27 -0
- package/dist/page/PageHeader.d.ts.map +1 -0
- package/dist/page/PageHeader.js +16 -0
- package/dist/page/PageHeader.js.map +1 -0
- package/dist/page/PageLayout.d.ts +15 -0
- package/dist/page/PageLayout.d.ts.map +1 -0
- package/dist/page/PageLayout.js +10 -0
- package/dist/page/PageLayout.js.map +1 -0
- package/dist/page/PageToolbar.d.ts +73 -0
- package/dist/page/PageToolbar.d.ts.map +1 -0
- package/dist/page/PageToolbar.js +49 -0
- package/dist/page/PageToolbar.js.map +1 -0
- package/dist/page/SectionHeader.d.ts +27 -0
- package/dist/page/SectionHeader.d.ts.map +1 -0
- package/dist/page/SectionHeader.js +14 -0
- package/dist/page/SectionHeader.js.map +1 -0
- package/dist/page/StatusCallout.d.ts +28 -0
- package/dist/page/StatusCallout.d.ts.map +1 -0
- package/dist/page/StatusCallout.js +35 -0
- package/dist/page/StatusCallout.js.map +1 -0
- package/dist/page/index.d.ts +29 -0
- package/dist/page/index.d.ts.map +1 -0
- package/dist/page/index.js +20 -0
- package/dist/page/index.js.map +1 -0
- package/dist/page/links.d.ts +18 -0
- package/dist/page/links.d.ts.map +1 -0
- package/dist/page/links.js +4 -0
- package/dist/page/links.js.map +1 -0
- package/dist/primitives/alert.d.ts +17 -0
- package/dist/primitives/alert.d.ts.map +1 -0
- package/dist/primitives/alert.js +36 -0
- package/dist/primitives/alert.js.map +1 -0
- package/dist/primitives/badge.d.ts +10 -0
- package/dist/primitives/badge.d.ts.map +1 -0
- package/dist/primitives/badge.js +30 -0
- package/dist/primitives/badge.js.map +1 -0
- package/dist/primitives/breadcrumb.d.ts +12 -0
- package/dist/primitives/breadcrumb.d.ts.map +1 -0
- package/dist/primitives/breadcrumb.js +33 -0
- package/dist/primitives/breadcrumb.js.map +1 -0
- package/dist/primitives/button.d.ts +12 -0
- package/dist/primitives/button.d.ts.map +1 -0
- package/dist/primitives/button.js +51 -0
- package/dist/primitives/button.js.map +1 -0
- package/dist/primitives/card.d.ts +10 -0
- package/dist/primitives/card.d.ts.map +1 -0
- package/dist/primitives/card.js +29 -0
- package/dist/primitives/card.js.map +1 -0
- package/dist/primitives/checkbox.d.ts +5 -0
- package/dist/primitives/checkbox.d.ts.map +1 -0
- package/dist/primitives/checkbox.js +11 -0
- package/dist/primitives/checkbox.js.map +1 -0
- package/dist/primitives/cn.d.ts +4 -0
- package/dist/primitives/cn.d.ts.map +1 -0
- package/dist/primitives/cn.js +5 -0
- package/dist/primitives/cn.js.map +1 -0
- package/dist/primitives/collapsible.d.ts +6 -0
- package/dist/primitives/collapsible.d.ts.map +1 -0
- package/dist/primitives/collapsible.js +14 -0
- package/dist/primitives/collapsible.js.map +1 -0
- package/dist/primitives/command.d.ts +19 -0
- package/dist/primitives/command.d.ts.map +1 -0
- package/dist/primitives/command.js +38 -0
- package/dist/primitives/command.js.map +1 -0
- package/dist/primitives/dialog.d.ts +18 -0
- package/dist/primitives/dialog.d.ts.map +1 -0
- package/dist/primitives/dialog.js +44 -0
- package/dist/primitives/dialog.js.map +1 -0
- package/dist/primitives/dropdown-menu.d.ts +23 -0
- package/dist/primitives/dropdown-menu.d.ts.map +1 -0
- package/dist/primitives/dropdown-menu.js +48 -0
- package/dist/primitives/dropdown-menu.js.map +1 -0
- package/dist/primitives/fieldSurface.d.ts +23 -0
- package/dist/primitives/fieldSurface.d.ts.map +1 -0
- package/dist/primitives/fieldSurface.js +23 -0
- package/dist/primitives/fieldSurface.js.map +1 -0
- package/dist/primitives/index.d.ts +26 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +27 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/input.d.ts +12 -0
- package/dist/primitives/input.d.ts.map +1 -0
- package/dist/primitives/input.js +20 -0
- package/dist/primitives/input.js.map +1 -0
- package/dist/primitives/label.d.ts +5 -0
- package/dist/primitives/label.d.ts.map +1 -0
- package/dist/primitives/label.js +10 -0
- package/dist/primitives/label.js.map +1 -0
- package/dist/primitives/listSurface.d.ts +8 -0
- package/dist/primitives/listSurface.d.ts.map +1 -0
- package/dist/primitives/listSurface.js +8 -0
- package/dist/primitives/listSurface.js.map +1 -0
- package/dist/primitives/popover.d.ts +11 -0
- package/dist/primitives/popover.d.ts.map +1 -0
- package/dist/primitives/popover.js +31 -0
- package/dist/primitives/popover.js.map +1 -0
- package/dist/primitives/portal.d.ts +16 -0
- package/dist/primitives/portal.d.ts.map +1 -0
- package/dist/primitives/portal.js +9 -0
- package/dist/primitives/portal.js.map +1 -0
- package/dist/primitives/select.d.ts +21 -0
- package/dist/primitives/select.d.ts.map +1 -0
- package/dist/primitives/select.js +50 -0
- package/dist/primitives/select.js.map +1 -0
- package/dist/primitives/separator.d.ts +5 -0
- package/dist/primitives/separator.d.ts.map +1 -0
- package/dist/primitives/separator.js +10 -0
- package/dist/primitives/separator.js.map +1 -0
- package/dist/primitives/sheet.d.ts +15 -0
- package/dist/primitives/sheet.d.ts.map +1 -0
- package/dist/primitives/sheet.js +46 -0
- package/dist/primitives/sheet.js.map +1 -0
- package/dist/primitives/skeleton.d.ts +3 -0
- package/dist/primitives/skeleton.d.ts.map +1 -0
- package/dist/primitives/skeleton.js +7 -0
- package/dist/primitives/skeleton.js.map +1 -0
- package/dist/primitives/switch.d.ts +7 -0
- package/dist/primitives/switch.d.ts.map +1 -0
- package/dist/primitives/switch.js +10 -0
- package/dist/primitives/switch.js.map +1 -0
- package/dist/primitives/table.d.ts +11 -0
- package/dist/primitives/table.d.ts.map +1 -0
- package/dist/primitives/table.js +30 -0
- package/dist/primitives/table.js.map +1 -0
- package/dist/primitives/textarea.d.ts +4 -0
- package/dist/primitives/textarea.d.ts.map +1 -0
- package/dist/primitives/textarea.js +11 -0
- package/dist/primitives/textarea.js.map +1 -0
- package/dist/primitives/tooltip.d.ts +8 -0
- package/dist/primitives/tooltip.d.ts.map +1 -0
- package/dist/primitives/tooltip.js +21 -0
- package/dist/primitives/tooltip.js.map +1 -0
- package/dist/provider/AdminUiProvider.d.ts +9 -0
- package/dist/provider/AdminUiProvider.d.ts.map +1 -0
- package/dist/provider/AdminUiProvider.js +47 -0
- package/dist/provider/AdminUiProvider.js.map +1 -0
- package/dist/provider/adminUiContext.d.ts +6 -0
- package/dist/provider/adminUiContext.d.ts.map +1 -0
- package/dist/provider/adminUiContext.js +9 -0
- package/dist/provider/adminUiContext.js.map +1 -0
- package/dist/provider/index.d.ts +5 -0
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.js +5 -0
- package/dist/provider/index.js.map +1 -0
- package/dist/provider/storageKey.d.ts +4 -0
- package/dist/provider/storageKey.d.ts.map +1 -0
- package/dist/provider/storageKey.js +3 -0
- package/dist/provider/storageKey.js.map +1 -0
- package/dist/provider/types.d.ts +65 -0
- package/dist/provider/types.d.ts.map +1 -0
- package/dist/provider/types.js +2 -0
- package/dist/provider/types.js.map +1 -0
- package/dist/scripts/build-i18n-manifest.mjs +138 -0
- package/dist/scripts/check-radix.mjs +131 -0
- package/dist/scripts/check-tokens.mjs +236 -0
- package/dist/theme.css +48 -0
- package/dist/tokens.json +401 -0
- package/dist/translations/FormTranslatableFields.d.ts +30 -0
- package/dist/translations/FormTranslatableFields.d.ts.map +1 -0
- package/dist/translations/FormTranslatableFields.js +58 -0
- package/dist/translations/FormTranslatableFields.js.map +1 -0
- package/dist/translations/TranslatableField.d.ts +48 -0
- package/dist/translations/TranslatableField.d.ts.map +1 -0
- package/dist/translations/TranslatableField.js +44 -0
- package/dist/translations/TranslatableField.js.map +1 -0
- package/dist/translations/TranslatableInput.d.ts +14 -0
- package/dist/translations/TranslatableInput.d.ts.map +1 -0
- package/dist/translations/TranslatableInput.js +15 -0
- package/dist/translations/TranslatableInput.js.map +1 -0
- package/dist/translations/TranslatableMarkdown.d.ts +21 -0
- package/dist/translations/TranslatableMarkdown.d.ts.map +1 -0
- package/dist/translations/TranslatableMarkdown.js +12 -0
- package/dist/translations/TranslatableMarkdown.js.map +1 -0
- package/dist/translations/TranslationControls.d.ts +22 -0
- package/dist/translations/TranslationControls.d.ts.map +1 -0
- package/dist/translations/TranslationControls.js +31 -0
- package/dist/translations/TranslationControls.js.map +1 -0
- package/dist/translations/index.d.ts +31 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +18 -0
- package/dist/translations/index.js.map +1 -0
- package/package.json +156 -3
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Structural CSS of the blocks and primitives. Import it after `tailwindcss` (and `theme.css`). Colours come from the
|
|
3
|
+
host's Tailwind theme (`--theme(--color-…)`), alphas and shadows from plain custom properties the host sets on
|
|
4
|
+
`:root` and `.dark` (`--surface-alpha`, `--surface-shadow`, `--glass-alpha`, `--surface-glass-alpha`,
|
|
5
|
+
`--surface-glass-strong-alpha`, `--glass-shadow`, `--glass-control-shadow`).
|
|
6
|
+
*/
|
|
7
|
+
@source './';
|
|
8
|
+
|
|
9
|
+
/* Layer scale. The blocks and primitives stack with `z-(--layer-<name>)`; these are only defaults: zero specificity
|
|
10
|
+
(`:where`) in the lowest cascade layer (`theme`), so any host declaration of a `--layer-*` variable wins, layered or
|
|
11
|
+
not. Equal overlay / popover values: a later portal paints on top. */
|
|
12
|
+
@layer theme {
|
|
13
|
+
:where(:root) {
|
|
14
|
+
--layer-raised: 10;
|
|
15
|
+
--layer-sticky: 20;
|
|
16
|
+
--layer-overlay: 50;
|
|
17
|
+
--layer-popover: 50;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Fluid heading scale: page title 28–36 px, section 20–24 px, card title 18–20 px. */
|
|
22
|
+
@utility text-title-page {
|
|
23
|
+
font-size: clamp(1.75rem, 1.4rem + 0.6vw, 2.25rem);
|
|
24
|
+
line-height: 1.2;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@utility text-title-section {
|
|
28
|
+
font-size: clamp(1.25rem, 1.1rem + 0.3vw, 1.5rem);
|
|
29
|
+
line-height: 1.3;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@utility text-title-card {
|
|
33
|
+
font-size: clamp(1.125rem, 1.05rem + 0.15vw, 1.25rem);
|
|
34
|
+
line-height: 1.4;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@utility animate-shimmer {
|
|
38
|
+
animation: shimmer 2s infinite;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@keyframes shimmer {
|
|
42
|
+
0% {
|
|
43
|
+
transform: translateX(-100%);
|
|
44
|
+
}
|
|
45
|
+
100% {
|
|
46
|
+
transform: translateX(100%);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* The card surface over the page background: translucent card colour, 12 px backdrop blur, three-layer soft shadow,
|
|
51
|
+
no border. The radius comes from the element (`rounded-2xl`). A surface inside a surface (grid cards in the list
|
|
52
|
+
card, cards in a card) skips the blur: its backdrop is already frosted. In `components` so a `shadow-*` / `bg-*`
|
|
53
|
+
utility on the same element still wins. */
|
|
54
|
+
@layer components {
|
|
55
|
+
.surface {
|
|
56
|
+
background-color: color-mix(in oklab, --theme(--color-card) var(--surface-alpha), transparent);
|
|
57
|
+
-webkit-backdrop-filter: blur(12px);
|
|
58
|
+
backdrop-filter: blur(12px);
|
|
59
|
+
box-shadow: var(--surface-shadow);
|
|
60
|
+
}
|
|
61
|
+
.surface .surface {
|
|
62
|
+
-webkit-backdrop-filter: none;
|
|
63
|
+
backdrop-filter: none;
|
|
64
|
+
}
|
|
65
|
+
.surface:has([data-entity-grid]) [data-entity-grid] .surface {
|
|
66
|
+
-webkit-backdrop-filter: blur(12px);
|
|
67
|
+
backdrop-filter: blur(12px);
|
|
68
|
+
}
|
|
69
|
+
/* The glass tone: quick-filter pills, collapsible glass cards, group panels, header pills. A solid surface or a card
|
|
70
|
+
inside keeps its own (stronger) fill. */
|
|
71
|
+
.surface-glass {
|
|
72
|
+
background-color: color-mix(in oklab, --theme(--color-card) var(--surface-glass-alpha), transparent);
|
|
73
|
+
-webkit-backdrop-filter: blur(16px);
|
|
74
|
+
backdrop-filter: blur(16px);
|
|
75
|
+
box-shadow: var(--glass-shadow);
|
|
76
|
+
}
|
|
77
|
+
.surface-glass-strong {
|
|
78
|
+
background-color: color-mix(in oklab, --theme(--color-card) var(--surface-glass-strong-alpha), transparent);
|
|
79
|
+
-webkit-backdrop-filter: blur(16px);
|
|
80
|
+
backdrop-filter: blur(16px);
|
|
81
|
+
box-shadow: var(--glass-shadow);
|
|
82
|
+
}
|
|
83
|
+
/* Glass inside a card (a collapsible group in a form section): no second blur, the quiet ink tint instead of
|
|
84
|
+
white-on-white, no shadow; open a step stronger. */
|
|
85
|
+
.surface .surface-glass {
|
|
86
|
+
background-color: --theme(--color-tint);
|
|
87
|
+
-webkit-backdrop-filter: none;
|
|
88
|
+
backdrop-filter: none;
|
|
89
|
+
box-shadow: none;
|
|
90
|
+
}
|
|
91
|
+
.surface .surface-glass-strong {
|
|
92
|
+
background-color: color-mix(in oklab, --theme(--color-card) 60%, --theme(--color-tint-strong));
|
|
93
|
+
-webkit-backdrop-filter: none;
|
|
94
|
+
backdrop-filter: none;
|
|
95
|
+
box-shadow: inset 0 0 0 1px --theme(--color-tint-strong);
|
|
96
|
+
}
|
|
97
|
+
/* Sticky glass bars (bulk bar, form action bar). */
|
|
98
|
+
/* Form actions at the top of the form: written last, shown first, sticky under the chrome. */
|
|
99
|
+
form:has(> [data-form-actions]) {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
}
|
|
103
|
+
form > [data-form-actions] {
|
|
104
|
+
order: -1;
|
|
105
|
+
}
|
|
106
|
+
.glass-bar {
|
|
107
|
+
background-color: color-mix(in oklab, --theme(--color-card) var(--glass-alpha), transparent);
|
|
108
|
+
-webkit-backdrop-filter: blur(12px);
|
|
109
|
+
backdrop-filter: blur(12px);
|
|
110
|
+
}
|
|
111
|
+
/* Grid view without cards (empty, no results, error): the state sits in a glass panel instead of floating bare on the
|
|
112
|
+
page background. Layered: no utility of the panel sets these properties, and a host's own look rule can win. */
|
|
113
|
+
.surface:has([data-entity-grid]) [data-entity-grid] [data-list-empty] {
|
|
114
|
+
background-color: color-mix(in oklab, --theme(--color-card) var(--surface-glass-alpha), transparent);
|
|
115
|
+
-webkit-backdrop-filter: blur(16px);
|
|
116
|
+
backdrop-filter: blur(16px);
|
|
117
|
+
/* the same shadow as every list card / table card, so grid and table views look alike */
|
|
118
|
+
box-shadow: var(--surface-shadow);
|
|
119
|
+
}
|
|
120
|
+
/* List card in table view: only the table below the toolbar is a card (radius 24 px). Layered: its element carries no
|
|
121
|
+
utility for these properties, and a host's own look rule (a flat card) can win. */
|
|
122
|
+
.surface:has(> [data-list-toolbar]):not(:has([data-entity-grid])) > [data-list-toolbar] + * {
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
border-radius: 1.5rem;
|
|
125
|
+
background-color: color-mix(in oklab, --theme(--color-card) var(--surface-alpha), transparent);
|
|
126
|
+
-webkit-backdrop-filter: blur(12px);
|
|
127
|
+
backdrop-filter: blur(12px);
|
|
128
|
+
box-shadow: var(--surface-shadow);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* List cards: the toolbar and the filter panel sit straight on the page background — no card background, no rule;
|
|
133
|
+
only the table below is a card (radius 24 px). In grid view the grid cards sit on the background as well, each with
|
|
134
|
+
its own frosted surface. Unlayered: it beats the card's and the toolbar's utilities (`overflow-hidden`,
|
|
135
|
+
`rounded-3xl`, `border-b px-4 py-3`); inside `@layer components` those utilities would win. */
|
|
136
|
+
.surface:has(> [data-list-toolbar]) {
|
|
137
|
+
background-color: transparent;
|
|
138
|
+
-webkit-backdrop-filter: none;
|
|
139
|
+
backdrop-filter: none;
|
|
140
|
+
box-shadow: none;
|
|
141
|
+
overflow: visible;
|
|
142
|
+
border-radius: 0;
|
|
143
|
+
}
|
|
144
|
+
.surface:has(> [data-list-toolbar]) > [data-list-toolbar] {
|
|
145
|
+
border-bottom-width: 0;
|
|
146
|
+
padding-inline: 0;
|
|
147
|
+
padding-top: 0;
|
|
148
|
+
padding-bottom: 1rem;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Filter controls on the page background in the glass tone: search, filter fields and the outline buttons of the
|
|
152
|
+
toolbar as frosted fields with a soft glass shadow. Shape by role: the pills — the search (`data-control="pill"`), a
|
|
153
|
+
toolbar menu (`SelectTrigger variant="pill"`) and the pill buttons (Filters, Clear filters) — drop their edge; a form
|
|
154
|
+
field in the Filters panel keeps its quiet edge over the glass. */
|
|
155
|
+
.surface:has(> [data-list-toolbar]) > [data-list-toolbar]
|
|
156
|
+
:is(
|
|
157
|
+
[data-slot="input"],
|
|
158
|
+
[data-slot="select-trigger"],
|
|
159
|
+
[data-slot="multi-select"],
|
|
160
|
+
[role="combobox"]:not([data-slot="multi-select"] *),
|
|
161
|
+
[data-slot="button"][data-variant="outline"]
|
|
162
|
+
) {
|
|
163
|
+
background-color: color-mix(in oklab, --theme(--color-card) var(--surface-glass-strong-alpha), transparent);
|
|
164
|
+
-webkit-backdrop-filter: blur(16px);
|
|
165
|
+
backdrop-filter: blur(16px);
|
|
166
|
+
/* A short glass shadow: the filter panel clips 12 px around its fields (collapse animation). */
|
|
167
|
+
box-shadow: var(--glass-control-shadow);
|
|
168
|
+
}
|
|
169
|
+
.surface:has(> [data-list-toolbar]) > [data-list-toolbar]
|
|
170
|
+
:is([data-control="pill"], [data-slot="button"][data-variant="outline"]) {
|
|
171
|
+
border-color: transparent;
|
|
172
|
+
}
|
|
173
|
+
/* Chips inside the glass multi-select: the quiet ink tint instead of the grey `secondary` block. */
|
|
174
|
+
.surface:has(> [data-list-toolbar]) > [data-list-toolbar] [data-slot="multi-select-chip"] {
|
|
175
|
+
background-color: --theme(--color-tint-strong);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* Grid view: the cards line up flush with the toolbar bar above. The scroll container clips overflow, so it keeps
|
|
179
|
+
room for the card shadow and pulls itself out by the same amount (negative margin) — flush edges, uncut shadows.
|
|
180
|
+
Unlayered so it beats the grid's `p-4`. Room for the full `--surface-shadow` (offset 8 px + blur 24 px) on the sides
|
|
181
|
+
and below. */
|
|
182
|
+
.surface:has([data-entity-grid]) [data-entity-grid] {
|
|
183
|
+
padding-inline: 2rem;
|
|
184
|
+
margin-inline: -2rem;
|
|
185
|
+
padding-bottom: 2.5rem;
|
|
186
|
+
margin-bottom: -2.5rem;
|
|
187
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface DrawerFooterProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/** Classes for the content once it sits in the drawer's pinned footer. */
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Classes for the content where it is written, when there is no drawer footer to move into. */
|
|
7
|
+
inlineClassName?: string;
|
|
8
|
+
/** Extra attributes for the inline wrapper (a `data-*` hook for layout CSS). */
|
|
9
|
+
inlineProps?: Record<`data-${string}`, string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Pins its content (a form's Save and Cancel) to the bottom of the `FormDrawer` it is rendered in; outside a drawer (a page, a dialog opened from the drawer) it renders where it is written.
|
|
13
|
+
*
|
|
14
|
+
* The portalled footer sits outside the `<form>` in the DOM, so every submit button in it is linked back to its form
|
|
15
|
+
* with the `form` attribute: Save, and Enter in a field, still submit the form.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DrawerFooter: ({ children, className, inlineClassName, inlineProps }: DrawerFooterProps) => import("react").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=DrawerFooter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DrawerFooter.d.ts","sourceRoot":"","sources":["../../src/form/DrawerFooter.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAwD,MAAM,OAAO,CAAC;AAK7F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gGAAgG;IAChG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;CAChD;AAOD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,uDAAuD,iBAAiB,gCAoDpG,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useId, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
5
|
+
import { DrawerFooterSlotContext } from "./drawerSlots.js";
|
|
6
|
+
/**
|
|
7
|
+
* Pins its content (a form's Save and Cancel) to the bottom of the `FormDrawer` it is rendered in; outside a drawer (a page, a dialog opened from the drawer) it renders where it is written.
|
|
8
|
+
*
|
|
9
|
+
* The portalled footer sits outside the `<form>` in the DOM, so every submit button in it is linked back to its form
|
|
10
|
+
* with the `form` attribute: Save, and Enter in a field, still submit the form.
|
|
11
|
+
*/
|
|
12
|
+
export const DrawerFooter = ({ children, className, inlineClassName, inlineProps }) => {
|
|
13
|
+
const slot = useContext(DrawerFooterSlotContext);
|
|
14
|
+
const fallbackFormId = useId();
|
|
15
|
+
const anchorRef = useRef(null);
|
|
16
|
+
const contentRef = useRef(null);
|
|
17
|
+
const [target, setTarget] = useState(null);
|
|
18
|
+
useLayoutEffect(() => {
|
|
19
|
+
const anchor = anchorRef.current;
|
|
20
|
+
// A dialog opened from inside the drawer still sees the drawer's context, but its DOM is portalled to <body>.
|
|
21
|
+
if (!slot || !anchor || !slot.bodyElement.contains(anchor)) {
|
|
22
|
+
setTarget(null);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
setTarget({ footerElement: slot.footerElement, formElement: anchor.closest('form') });
|
|
26
|
+
}, [slot]);
|
|
27
|
+
const formElement = target?.formElement ?? null;
|
|
28
|
+
useLayoutEffect(() => {
|
|
29
|
+
const content = contentRef.current;
|
|
30
|
+
if (!formElement || !content)
|
|
31
|
+
return;
|
|
32
|
+
if (!formElement.id)
|
|
33
|
+
formElement.id = fallbackFormId;
|
|
34
|
+
const linkSubmitButtons = () => {
|
|
35
|
+
for (const button of content.querySelectorAll('button')) {
|
|
36
|
+
if (button.type === 'submit' && !button.hasAttribute('form'))
|
|
37
|
+
button.setAttribute('form', formElement.id);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
linkSubmitButtons();
|
|
41
|
+
const observer = new MutationObserver(linkSubmitButtons);
|
|
42
|
+
observer.observe(content, { childList: true, subtree: true });
|
|
43
|
+
return () => observer.disconnect();
|
|
44
|
+
}, [formElement, fallbackFormId]);
|
|
45
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, hidden: true }), target ? (createPortal(_jsx("div", { ref: contentRef, className: className, children: children }), target.footerElement)) : (_jsx("div", { className: inlineClassName, ...inlineProps, children: children }))] }));
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=DrawerFooter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DrawerFooter.js","sourceRoot":"","sources":["../../src/form/DrawerFooter.tsx"],"names":[],"m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nC,IAAI,CAAC,WAAW,IAAI,CAAC,OAAO;YAAE,OAAO;QACrC,IAAI,CAAC,WAAW,CAAC,EAAE;YAAE,WAAW,CAAC,EAAE,GAAG,cAAc,CAAC;QAErD,MAAM,iBAAiB,GAAG,GAAG,EAAE;YAC7B,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACxD,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC;oBAAE,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;YAC5G,CAAC;QACH,CAAC,CAAC;QACF,iBAAiB,EAAE,CAAC;QACpB,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QACzD,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9D,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;IAElC,OAAO,CACL,8BACE,eAAM,GAAG,EAAE,SAAS,EAAE,MAAM,SAAG,EAC9B,MAAM,CAAC,CAAC,CAAC,CACR,YAAY,CACV,cAAK,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,YACvC,QAAQ,GACL,EACN,MAAM,CAAC,aAAa,CACrB,CACF,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAE,eAAe,KAAM,WAAW,YAC7C,QAAQ,GACL,CACP,IACA,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type FieldValues, type SubmitHandler, type UseFormReturn } from 'react-hook-form';
|
|
3
|
+
import type { FormCondition } from '../logic/pure/conditions.js';
|
|
4
|
+
export interface FormProps<TFieldValues extends FieldValues, TTransformed = TFieldValues> {
|
|
5
|
+
/** `useForm({ resolver: zodResolver(schema), mode: 'onTouched', defaultValues })`. */
|
|
6
|
+
form: UseFormReturn<TFieldValues, unknown, TTransformed>;
|
|
7
|
+
/** Called with the parsed values after the schema passed; awaited, so `formState.isSubmitting` covers the save. */
|
|
8
|
+
onSubmit: SubmitHandler<TTransformed>;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
id?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The form element of an entity form (shadcn `Form` = RHF `FormProvider` + `<form>`): provides the form to every
|
|
15
|
+
* bound field (`FormField`, `FormTranslatableInput`, `FormMediaItemField`, the condition hooks), validates through
|
|
16
|
+
* the resolver on submit, `noValidate` so the browser leaves validation to the schema. Enter in a field submits;
|
|
17
|
+
* the primary button is `type="submit"` (`FormSubmitButton`), Cancel `type="button"`. The bound fields register
|
|
18
|
+
* their labels here, so `FormErrors` can attach a server violation to its field and name it by its label.
|
|
19
|
+
*/
|
|
20
|
+
export declare const Form: <TFieldValues extends FieldValues, TTransformed = TFieldValues>({ form, onSubmit, children, id, className, }: FormProps<TFieldValues, TTransformed>) => import("react").JSX.Element;
|
|
21
|
+
export interface VisibleWhenProps<T extends FieldValues> {
|
|
22
|
+
/** Shown while this holds; hidden fields keep their value (no unregister) unless a `resetWhen` clears it. */
|
|
23
|
+
condition: FormCondition<T>;
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/** A block (section, several fields) shown only while `condition` holds — the section-level `visibleWhen`. */
|
|
27
|
+
export declare const VisibleWhen: <T extends FieldValues>({ condition, children }: VisibleWhenProps<T>) => ReactNode;
|
|
28
|
+
//# sourceMappingURL=Form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../src/form/Form.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,KAAK,WAAW,EAAgB,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEzG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAIjE,MAAM,WAAW,SAAS,CAAC,YAAY,SAAS,WAAW,EAAE,YAAY,GAAG,YAAY;IACtF,sFAAsF;IACtF,IAAI,EAAE,aAAa,CAAC,YAAY,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IACzD,mHAAmH;IACnH,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACtC,QAAQ,EAAE,SAAS,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,GAAI,YAAY,SAAS,WAAW,EAAE,YAAY,GAAG,YAAY,EAAE,8CAMjF,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC,gCAWvC,CAAC;AAEF,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,WAAW;IACrD,6GAA6G;IAC7G,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,8GAA8G;AAC9G,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,WAAW,EAAE,yBAAyB,gBAAgB,CAAC,CAAC,CAAC,cAClD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { FormProvider } from 'react-hook-form';
|
|
5
|
+
import { useVisibleWhen } from "../logic/react/conditionHooks.js";
|
|
6
|
+
import { FormFieldLabelsContext } from "./fieldLabels.js";
|
|
7
|
+
/**
|
|
8
|
+
* The form element of an entity form (shadcn `Form` = RHF `FormProvider` + `<form>`): provides the form to every
|
|
9
|
+
* bound field (`FormField`, `FormTranslatableInput`, `FormMediaItemField`, the condition hooks), validates through
|
|
10
|
+
* the resolver on submit, `noValidate` so the browser leaves validation to the schema. Enter in a field submits;
|
|
11
|
+
* the primary button is `type="submit"` (`FormSubmitButton`), Cancel `type="button"`. The bound fields register
|
|
12
|
+
* their labels here, so `FormErrors` can attach a server violation to its field and name it by its label.
|
|
13
|
+
*/
|
|
14
|
+
export const Form = ({ form, onSubmit, children, id, className, }) => {
|
|
15
|
+
const [fieldLabels] = useState(() => new Map());
|
|
16
|
+
return (_jsx(FormProvider, { ...form, children: _jsx(FormFieldLabelsContext.Provider, { value: fieldLabels, children: _jsx("form", { id: id, noValidate: true, onSubmit: form.handleSubmit(onSubmit), className: className, children: children }) }) }));
|
|
17
|
+
};
|
|
18
|
+
/** A block (section, several fields) shown only while `condition` holds — the section-level `visibleWhen`. */
|
|
19
|
+
export const VisibleWhen = ({ condition, children }) => useVisibleWhen(condition) ? children : null;
|
|
20
|
+
//# sourceMappingURL=Form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../src/form/Form.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAkB,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAoB,YAAY,EAA0C,MAAM,iBAAiB,CAAC;AAGzG,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAwB,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAYhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAgE,EAClF,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,EAAE,EACF,SAAS,GAC6B,EAAE,EAAE;IAC1C,MAAM,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAkB,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;IACjE,OAAO,CACL,KAAC,YAAY,OAAK,IAAI,YACpB,KAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,YACjD,eAAM,EAAE,EAAE,EAAE,EAAE,UAAU,QAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,SAAS,YACjF,QAAQ,GACJ,GACyB,GACrB,CAChB,CAAC;AACJ,CAAC,CAAC;AAQF,8GAA8G;AAC9G,MAAM,CAAC,MAAM,WAAW,GAAG,CAAwB,EAAE,SAAS,EAAE,QAAQ,EAAuB,EAAE,EAAE,CACjG,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface FormActionsProps {
|
|
3
|
+
primary?: ReactNode;
|
|
4
|
+
secondary?: ReactNode;
|
|
5
|
+
tertiary?: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* On a page: the glass action pill at the top right of the form, sticky under the header (default);
|
|
8
|
+
* `false` keeps a plain row (a dialog). Ignored in a drawer: its pinned footer gets the plain row with
|
|
9
|
+
* the change status.
|
|
10
|
+
*/
|
|
11
|
+
sticky?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Where the sticky pill sits from `md` up: `auto` (default) moves it up beside the tabs when the page has an
|
|
14
|
+
* `EntityTabs` row (`data-entity-tabs`) and keeps a row of its own on pages without tabs (create pages, plain details),
|
|
15
|
+
* where it would otherwise cover the page header; `row` always keeps its own row (a tab row too wide to share).
|
|
16
|
+
*/
|
|
17
|
+
placement?: 'auto' | 'row';
|
|
18
|
+
/**
|
|
19
|
+
* The change status for a form without react-hook-form (state-based forms): shows "Unsaved changes" / "No changes"
|
|
20
|
+
* like an RHF form does. Ignored inside an RHF form (its own dirty state wins). ⌘S works in either case as long as
|
|
21
|
+
* the actions sit inside a `<form>` with a `type="submit"` primary.
|
|
22
|
+
*/
|
|
23
|
+
isDirty?: boolean;
|
|
24
|
+
/** Applies where the actions are written; dropped once they move into a drawer's footer. */
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A form's Save / Cancel actions — the one standard of every entity create / edit screen. On a
|
|
29
|
+
* page: a glass pill at the top right of the form, sticky under the header, with the change status ("Unsaved
|
|
30
|
+
* changes" / "No changes", from the surrounding RHF form), tertiary, secondary (Cancel) and the primary next to each
|
|
31
|
+
* other, primary last; ⌘S / Ctrl+S submits. Inside a `FormDrawer` the buttons move into the drawer's pinned footer;
|
|
32
|
+
* `sticky={false}` is a plain row.
|
|
33
|
+
*/
|
|
34
|
+
export declare const FormActions: ({ primary, secondary, tertiary, sticky, placement, isDirty, className, }: FormActionsProps) => import("react").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=FormActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormActions.d.ts","sourceRoot":"","sources":["../../src/form/FormActions.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAS1D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAgED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,0EAQzB,gBAAgB,gCAiDlB,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { useFormContext } from 'react-hook-form';
|
|
5
|
+
import { useTranslate } from "../i18n/index.js";
|
|
6
|
+
import { cn } from "../primitives/cn.js";
|
|
7
|
+
import { DrawerFooter } from "./DrawerFooter.js";
|
|
8
|
+
import { useIsInDrawer } from "./drawerSlots.js";
|
|
9
|
+
import { useFormDirty } from "../logic/react/useFormDirty.js";
|
|
10
|
+
/** Below `sm` the buttons share the row; from `sm` up each keeps its own width. */
|
|
11
|
+
const ACTION_CLASS = 'flex-1 min-w-fit *:w-full sm:flex-none sm:*:w-auto';
|
|
12
|
+
/**
|
|
13
|
+
* The page action pill (host CSS `.glass-bar`): compact, right-aligned at the top of the form and sticky under the
|
|
14
|
+
* fixed chrome (`--nav-h`) while the form scrolls. Forms write `<FormActions>` last; `data-form-actions` + the host
|
|
15
|
+
* CSS move it first (`order: -1`), so the DOM / tab order is unchanged everywhere.
|
|
16
|
+
*/
|
|
17
|
+
// No row of its own where the page has tabs: the wrapper is 0 px tall and pulled 3.5 rem up (and as
|
|
18
|
+
// much margin below, so the form does not move), so from `md` the pill sits in the free space right of the tabs; the
|
|
19
|
+
// sticky top keeps it under the chrome while scrolling. Without a tab row it would cover
|
|
20
|
+
// the page header (description, ID / Created / Updated), so it keeps a row there. Below `md` the centred tabs fill the
|
|
21
|
+
// row, so the pill always keeps a row there.
|
|
22
|
+
const STICKY_WRAPPER_CLASS = 'pointer-events-none sticky top-[calc(var(--nav-h)+0.5rem)] z-(--layer-sticky) mb-4 flex justify-end md:items-start';
|
|
23
|
+
const BESIDE_TABS_CLASS = 'md:[body:has([data-entity-tabs])_&]:-mt-14 md:[body:has([data-entity-tabs])_&]:mb-14 md:[body:has([data-entity-tabs])_&]:h-0';
|
|
24
|
+
// Buttons inside follow the pill's shape (round); Cancel and other outline buttons drop their frame (ghost look).
|
|
25
|
+
const STICKY_PILL_CLASS = cn('glass-bar pointer-events-auto flex max-w-full flex-wrap-reverse items-center gap-2 rounded-full py-1.5 pr-1.5 pl-5 shadow-[var(--surface-shadow)] max-sm:w-full max-sm:rounded-2xl max-sm:pl-3', '[&_[data-slot=button]]:rounded-full', '[&_[data-slot=button][data-variant=outline]]:border-transparent [&_[data-slot=button][data-variant=outline]]:bg-transparent [&_[data-slot=button][data-variant=outline]]:shadow-none [&_[data-slot=button][data-variant=outline]:hover]:bg-foreground/5');
|
|
26
|
+
const DirtyStatusLabel = ({ isDirty }) => {
|
|
27
|
+
const { t } = useTranslate();
|
|
28
|
+
return (_jsxs("span", { className: "mr-2 inline-flex items-center gap-2 whitespace-nowrap text-sm text-muted-foreground max-sm:hidden", "aria-live": "polite", children: [_jsx("span", { className: cn('size-2 rounded-full', isDirty ? 'bg-primary' : 'bg-muted-foreground/30'), "aria-hidden": true }), isDirty ? t('Unsaved changes') : t('No changes')] }));
|
|
29
|
+
};
|
|
30
|
+
const DirtyStatus = ({ control }) => _jsx(DirtyStatusLabel, { isDirty: useFormDirty({ control }) });
|
|
31
|
+
/** The change status of an RHF form, else of the `isDirty` prop, else none. */
|
|
32
|
+
const ChangeStatus = ({ control, isDirty }) => {
|
|
33
|
+
if (control)
|
|
34
|
+
return _jsx(DirtyStatus, { control: control });
|
|
35
|
+
if (isDirty !== undefined)
|
|
36
|
+
return _jsx(DirtyStatusLabel, { isDirty: isDirty });
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
/** ⌘S / Ctrl+S inside the form submits it (the primary is `type="submit"`, so the form's own validation runs). */
|
|
40
|
+
const useSaveShortcut = (anchor) => {
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const form = anchor.current?.closest('form');
|
|
43
|
+
if (!form)
|
|
44
|
+
return;
|
|
45
|
+
const onKeyDown = (event) => {
|
|
46
|
+
if (event.key.toLowerCase() !== 's' || !(event.metaKey || event.ctrlKey) || event.altKey)
|
|
47
|
+
return;
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
// In a drawer the buttons sit in the portalled footer, linked back to the form by its `form` attribute.
|
|
50
|
+
const submit = form.querySelector('button[type="submit"]') ??
|
|
51
|
+
(form.id ? document.querySelector(`button[type="submit"][form="${CSS.escape(form.id)}"]`) : null);
|
|
52
|
+
if (submit && !submit.disabled)
|
|
53
|
+
form.requestSubmit(submit);
|
|
54
|
+
};
|
|
55
|
+
form.addEventListener('keydown', onKeyDown);
|
|
56
|
+
return () => form.removeEventListener('keydown', onKeyDown);
|
|
57
|
+
}, [anchor]);
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* A form's Save / Cancel actions — the one standard of every entity create / edit screen. On a
|
|
61
|
+
* page: a glass pill at the top right of the form, sticky under the header, with the change status ("Unsaved
|
|
62
|
+
* changes" / "No changes", from the surrounding RHF form), tertiary, secondary (Cancel) and the primary next to each
|
|
63
|
+
* other, primary last; ⌘S / Ctrl+S submits. Inside a `FormDrawer` the buttons move into the drawer's pinned footer;
|
|
64
|
+
* `sticky={false}` is a plain row.
|
|
65
|
+
*/
|
|
66
|
+
export const FormActions = ({ primary, secondary, tertiary, sticky = true, placement = 'auto', isDirty, className, }) => {
|
|
67
|
+
const formContext = useFormContext();
|
|
68
|
+
const isInDrawer = useIsInDrawer();
|
|
69
|
+
const anchor = useRef(null);
|
|
70
|
+
useSaveShortcut(anchor);
|
|
71
|
+
if (isInDrawer) {
|
|
72
|
+
// The drawer's pinned footer: the change status left, the buttons right, primary last.
|
|
73
|
+
return (_jsx(DrawerFooter, { inlineClassName: cn('pt-6', className), children: _jsxs("div", { ref: anchor, className: "flex flex-wrap-reverse items-center gap-2", children: [(formContext || isDirty !== undefined) && (_jsx("div", { className: "mr-auto", children: _jsx(ChangeStatus, { control: formContext?.control, isDirty: isDirty }) })), tertiary && _jsx("div", { className: ACTION_CLASS, children: tertiary }), secondary && _jsx("div", { className: ACTION_CLASS, children: secondary }), primary && _jsx("div", { className: ACTION_CLASS, children: primary })] }) }));
|
|
74
|
+
}
|
|
75
|
+
if (!sticky) {
|
|
76
|
+
return (_jsx(DrawerFooter, { inlineClassName: cn('pt-6', className), children: _jsxs("div", { ref: anchor, className: "flex flex-wrap-reverse items-center gap-2", children: [secondary && _jsx("div", { className: ACTION_CLASS, children: secondary }), tertiary && _jsx("div", { className: ACTION_CLASS, children: tertiary }), primary && _jsx("div", { className: cn(ACTION_CLASS, 'sm:ml-auto'), children: primary })] }) }));
|
|
77
|
+
}
|
|
78
|
+
return (_jsx(DrawerFooter, { inlineClassName: cn(STICKY_WRAPPER_CLASS, placement === 'auto' && BESIDE_TABS_CLASS, className), inlineProps: { 'data-form-actions': '' }, children: _jsxs("div", { ref: anchor, className: STICKY_PILL_CLASS, children: [_jsx(ChangeStatus, { control: formContext?.control, isDirty: isDirty }), tertiary && _jsx("div", { className: ACTION_CLASS, children: tertiary }), secondary && _jsx("div", { className: ACTION_CLASS, children: secondary }), primary && _jsx("div", { className: ACTION_CLASS, children: primary })] }) }));
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=FormActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormActions.js","sourceRoot":"","sources":["../../src/form/FormActions.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAgB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AA4B9D,mFAAmF;AACnF,MAAM,YAAY,GAAG,oDA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,SAAS,CAAC,EAC/F,WAAW,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,YAExC,eAAK,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,aAC5C,KAAC,YAAY,IAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAI,EAChE,QAAQ,IAAI,cAAK,SAAS,EAAE,YAAY,YAAG,QAAQ,GAAO,EAC1D,SAAS,IAAI,cAAK,SAAS,EAAE,YAAY,YAAG,SAAS,GAAO,EAC5D,OAAO,IAAI,cAAK,SAAS,EAAE,YAAY,YAAG,OAAO,GAAO,IACrD,GACO,CAChB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ChangeHistory } from '@mgamadeus/ddd-web/contract';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type ConfirmFn } from '../logic/react/useUnsavedChangesGuard.js';
|
|
4
|
+
export interface FormDrawerProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* The entity's ID / Created / Updated, one compact line under the title (`EntityMetadata variant="inline"`); nothing
|
|
11
|
+
* renders without an id (create).
|
|
12
|
+
*/
|
|
13
|
+
metadata?: {
|
|
14
|
+
id: number | string | null | undefined;
|
|
15
|
+
changeHistory?: ChangeHistory | null;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Entity actions at the right end of the header (outline `sm` buttons, e.g. "Open as …", "Reset password"): never
|
|
19
|
+
* the save — that stays in the form's `FormActions` footer.
|
|
20
|
+
*/
|
|
21
|
+
headerActions?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* The host's confirmation service for "Discard changes?" (resolves `true` to close). Default: the package dialog
|
|
24
|
+
* (`useConfirmDialog`). Pass a stable function; its dialog must use the same Radix copy as the drawer.
|
|
25
|
+
*/
|
|
26
|
+
confirm?: ConfirmFn;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Right-side drawer for an entity form: sticky header with the
|
|
31
|
+
* ✕ in the corner, a scrolling body, and a footer pinned below it that the form's `FormActions` move into. Esc, an
|
|
32
|
+
* overlay click or the ✕ ask "Discard changes?" when a form inside reported unsaved changes
|
|
33
|
+
* (`useUnsavedChangesGuard`); the form's own close after a save is never asked about.
|
|
34
|
+
*/
|
|
35
|
+
export declare const FormDrawer: ({ open, onClose, title, description, metadata, headerActions, confirm: hostConfirm, children, }: FormDrawerProps) => import("react").JSX.Element;
|
|
36
|
+
//# sourceMappingURL=FormDrawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDrawer.d.ts","sourceRoot":"","sources":["../../src/form/FormDrawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAQ1D,OAAO,EAAE,KAAK,SAAS,EAAoD,MAAM,0CAA0C,CAAC;AAE5H,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;QAAC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;KAAE,CAAC;IAC5F;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,iGASxB,eAAe,gCA+DjB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { XIcon } from 'lucide-react';
|
|
4
|
+
import { useMemo, useState } from 'react';
|
|
5
|
+
import { Button, Sheet, SheetClose, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "../primitives/index.js";
|
|
6
|
+
import { useTranslate } from "../i18n/index.js";
|
|
7
|
+
import { cn } from "../primitives/cn.js";
|
|
8
|
+
import { EntityMetadata } from "../page/EntityMetadata.js";
|
|
9
|
+
import { DrawerFooterSlotContext, DrawerSurfaceContext } from "./drawerSlots.js";
|
|
10
|
+
import { useConfirmDialog } from "./useConfirmDialog.js";
|
|
11
|
+
import { UnsavedChangesContext, useUnsavedChangesBoundary } from "../logic/react/useUnsavedChangesGuard.js";
|
|
12
|
+
/**
|
|
13
|
+
* Right-side drawer for an entity form: sticky header with the
|
|
14
|
+
* ✕ in the corner, a scrolling body, and a footer pinned below it that the form's `FormActions` move into. Esc, an
|
|
15
|
+
* overlay click or the ✕ ask "Discard changes?" when a form inside reported unsaved changes
|
|
16
|
+
* (`useUnsavedChangesGuard`); the form's own close after a save is never asked about.
|
|
17
|
+
*/
|
|
18
|
+
export const FormDrawer = ({ open, onClose, title, description, metadata, headerActions, confirm: hostConfirm, children, }) => {
|
|
19
|
+
const { t } = useTranslate();
|
|
20
|
+
const hasMetadata = metadata !== undefined && metadata.id !== null && metadata.id !== undefined && metadata.id !== '';
|
|
21
|
+
const packageConfirm = useConfirmDialog();
|
|
22
|
+
const { registry, guardClose } = useUnsavedChangesBoundary(hostConfirm ?? packageConfirm.confirm);
|
|
23
|
+
const [bodyElement, setBodyElement] = useState(null);
|
|
24
|
+
const [footerElement, setFooterElement] = useState(null);
|
|
25
|
+
const slot = useMemo(() => (bodyElement && footerElement ? { bodyElement, footerElement } : null), [bodyElement, footerElement]);
|
|
26
|
+
return (_jsxs(_Fragment, { children: [_jsx(Sheet, { open: open, onOpenChange: isOpen => {
|
|
27
|
+
if (!isOpen)
|
|
28
|
+
void guardClose(onClose);
|
|
29
|
+
}, children: _jsxs(SheetContent, { side: "right", showCloseButton: false, className: "flex w-full flex-col gap-0 overflow-hidden bg-card p-0 sm:max-w-[760px]", ...(description ? {} : { 'aria-describedby': undefined }), children: [_jsxs(SheetHeader, { className: "flex shrink-0 flex-row items-start gap-3 space-y-0 border-b p-6 text-left", children: [_jsx(SheetClose, { asChild: true, children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", className: "shrink-0", "aria-label": t('Close', { context: 'drawer-close-button' }), children: _jsx(XIcon, {}) }) }), _jsxs("div", { className: cn('flex min-w-0 flex-1 flex-col gap-0.5', description || hasMetadata ? '-mt-0.5' : 'mt-1.5'), children: [_jsx(SheetTitle, { className: "truncate text-base leading-5 font-semibold", children: title }), description && _jsx(SheetDescription, { className: "text-xs leading-4", children: description }), hasMetadata && (_jsx(EntityMetadata, { variant: "inline", id: metadata?.id, changeHistory: metadata?.changeHistory }))] }), headerActions && _jsx("div", { className: "flex shrink-0 flex-wrap items-center justify-end gap-2", children: headerActions })] }), _jsx("div", { ref: setBodyElement, className: "flex-1 overflow-y-auto px-6 py-6", children: _jsx(DrawerSurfaceContext.Provider, { value: true, children: _jsx(DrawerFooterSlotContext.Provider, { value: slot, children: _jsx(UnsavedChangesContext.Provider, { value: registry, children: children }) }) }) }), _jsx("div", { ref: setFooterElement, className: "shrink-0 border-t bg-card px-6 pt-4 pb-[calc(1rem+env(safe-area-inset-bottom))] empty:hidden" })] }) }), hostConfirm ? null : packageConfirm.dialog] }));
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=FormDrawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDrawer.js","sourceRoot":"","sources":["../../src/form/FormDrawer.tsx"],"names":[],"mappings":"AAAA,YAAY,CA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Ac,IAAC,OAAO,EAAC,QAAQ,EAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,GAAI,CAC9F,IACG,EACL,aAAa,IAAI,cAAK,SAAS,EAAC,wDAAwD,YAAE,aAAa,GAAO,IACnG,EACd,cAAK,GAAG,EAAE,cAAc,EAAE,SAAS,EAAC,kCAAkC,YACpE,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YACxC,KAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YAC3C,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,YAAG,QAAQ,GAAkC,GAC3D,GACL,GAC5B,EACN,cACE,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAC,8FAA8F,GACxG,IACW,GACT,EACP,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,IAC1C,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { FormSubmitError } from '../logic/pure/submitError.js';
|
|
3
|
+
export interface FormErrorsProps {
|
|
4
|
+
error: FormSubmitError | null;
|
|
5
|
+
/**
|
|
6
|
+
* Server path → form field name, for a field named differently from the entity property (`bikeType` →
|
|
7
|
+
* `bikeTypeId`). Fields named like the property (or nested under a form group, `translations.name`) match on
|
|
8
|
+
* their own.
|
|
9
|
+
*/
|
|
10
|
+
fieldPaths?: Readonly<Record<string, string>>;
|
|
11
|
+
/** Server path → label, for a violation on a property no field of the form shows. */
|
|
12
|
+
labels?: Readonly<Record<string, ReactNode>>;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The server's answer to a failed save, kept in the form: its message plus every validation violation (the toast
|
|
17
|
+
* from `notify.submitError` goes away; this list stays until the next submit). Inside a `<Form>`, a violation whose
|
|
18
|
+
* path matches a shown field is also set as that field's error (cleared by the next submit or a valid edit) and is
|
|
19
|
+
* named here by the field's label; any other violation by `labels` or its humanised path, never the raw path.
|
|
20
|
+
*/
|
|
21
|
+
export declare const FormErrors: ({ error, fieldPaths, labels, className }: FormErrorsProps) => import("react").JSX.Element | null;
|
|
22
|
+
//# sourceMappingURL=FormErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormErrors.d.ts","sourceRoot":"","sources":["../../src/form/FormErrors.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAOlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,qFAAqF;IACrF,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,0CAA0C,eAAe,uCA8CnF,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CircleAlert } from 'lucide-react';
|
|
4
|
+
import { useEffect } from 'react';
|
|
5
|
+
import { useFormContext } from 'react-hook-form';
|
|
6
|
+
import { Alert, AlertDescription, AlertTitle } from "../primitives/index.js";
|
|
7
|
+
import { translateText } from "../i18n/index.js";
|
|
8
|
+
import { useFormFieldLabels } from "./fieldLabels.js";
|
|
9
|
+
import { humanizeViolationPath, matchViolationField } from "../logic/pure/serverViolations.js";
|
|
10
|
+
/**
|
|
11
|
+
* The server's answer to a failed save, kept in the form: its message plus every validation violation (the toast
|
|
12
|
+
* from `notify.submitError` goes away; this list stays until the next submit). Inside a `<Form>`, a violation whose
|
|
13
|
+
* path matches a shown field is also set as that field's error (cleared by the next submit or a valid edit) and is
|
|
14
|
+
* named here by the field's label; any other violation by `labels` or its humanised path, never the raw path.
|
|
15
|
+
*/
|
|
16
|
+
export const FormErrors = ({ error, fieldPaths, labels, className }) => {
|
|
17
|
+
// `null` outside a `<Form>`: the banner still lists the violations, nothing is set on fields.
|
|
18
|
+
const form = useFormContext();
|
|
19
|
+
const fieldLabels = useFormFieldLabels();
|
|
20
|
+
const rows = (error?.validationErrors ?? []).map(violation => {
|
|
21
|
+
const fieldName = fieldLabels ? matchViolationField(violation.path, fieldLabels.keys(), fieldPaths) : undefined;
|
|
22
|
+
const label = (fieldName ? fieldLabels?.get(fieldName)?.label : undefined) ??
|
|
23
|
+
labels?.[violation.path] ??
|
|
24
|
+
translateText(humanizeViolationPath(violation.path));
|
|
25
|
+
return { violation, fieldName, label };
|
|
26
|
+
});
|
|
27
|
+
// Each new error puts its violations on their fields (several on one field: one message).
|
|
28
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: applied once per failed save (the error object)
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (!form)
|
|
31
|
+
return;
|
|
32
|
+
const messages = new Map();
|
|
33
|
+
for (const { violation, fieldName } of rows) {
|
|
34
|
+
if (!fieldName)
|
|
35
|
+
continue;
|
|
36
|
+
messages.set(fieldName, [...(messages.get(fieldName) ?? []), violation.errorMessage]);
|
|
37
|
+
}
|
|
38
|
+
for (const [name, fieldMessages] of messages) {
|
|
39
|
+
form.setError(name, { type: 'server', message: fieldMessages.join(' ') });
|
|
40
|
+
}
|
|
41
|
+
}, [error]);
|
|
42
|
+
if (!error)
|
|
43
|
+
return null;
|
|
44
|
+
return (_jsxs(Alert, { variant: "destructive", className: className, children: [_jsx(CircleAlert, { "aria-hidden": true }), _jsx(AlertTitle, { children: error.message }), rows.length > 0 && (_jsx(AlertDescription, { children: _jsx("ul", { className: "list-disc space-y-0.5 pl-4", children: rows.map(({ violation, label }) => (_jsxs("li", { children: [_jsx("span", { className: "font-semibold", children: label }), ": ", violation.errorMessage] }, `${violation.path}:${violation.errorMessage}`))) }) }))] }));
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=FormErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormErrors.js","sourceRoot":"","sources":["../../src/form/FormErrors.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAkB,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAmD,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAElG,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAgB/F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAmB,EAAE,EAAE;IACtF,8FAA8F;IAC9F,MAAM,IAAI,GAAsC,cAAc,EAAe,CAAC;IAC9E,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAC;IAEzC,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,gBAAgB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QAC3D,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,EA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