@ankhorage/zora 14.0.1 → 16.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 +12 -0
- package/README.md +1 -1
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -1
- package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
- package/dist/features/app-bar/adapters/inbound/AppBar.d.ts.map +1 -1
- package/dist/features/app-bar/adapters/inbound/AppBar.js +28 -27
- package/dist/features/app-bar/adapters/inbound/AppBar.js.map +1 -1
- package/dist/features/app-bar/public.d.ts +1 -1
- package/dist/features/app-bar/public.d.ts.map +1 -1
- package/dist/features/app-bar/public.js.map +1 -1
- package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
- package/dist/features/bottom-sheet/public.d.ts +2 -2
- package/dist/features/bottom-sheet/public.d.ts.map +1 -1
- package/dist/features/bottom-sheet/public.js +1 -1
- package/dist/features/bottom-sheet/public.js.map +1 -1
- package/dist/features/breadcrumbs/adapters/inbound/Breadcrumbs.d.ts +5 -0
- package/dist/features/breadcrumbs/adapters/inbound/Breadcrumbs.d.ts.map +1 -0
- package/dist/features/breadcrumbs/adapters/inbound/Breadcrumbs.js +81 -0
- package/dist/features/breadcrumbs/adapters/inbound/Breadcrumbs.js.map +1 -0
- package/dist/features/breadcrumbs/breadcrumbsMeta.d.ts +119 -0
- package/dist/features/breadcrumbs/breadcrumbsMeta.d.ts.map +1 -0
- package/dist/features/breadcrumbs/breadcrumbsMeta.js +94 -0
- package/dist/features/breadcrumbs/breadcrumbsMeta.js.map +1 -0
- package/dist/features/breadcrumbs/public.d.ts +3 -0
- package/dist/features/breadcrumbs/public.d.ts.map +1 -0
- package/dist/features/breadcrumbs/public.js +2 -0
- package/dist/features/breadcrumbs/public.js.map +1 -0
- 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 +4 -2
- package/dist/features/data-table/adapters/inbound/DataTable.js.map +1 -1
- package/dist/features/dialog/adapters/inbound/Dialog.d.ts +5 -0
- package/dist/features/dialog/adapters/inbound/Dialog.d.ts.map +1 -0
- package/dist/features/dialog/adapters/inbound/Dialog.js +45 -0
- package/dist/features/dialog/adapters/inbound/Dialog.js.map +1 -0
- package/dist/features/dialog/dialogMeta.d.ts +87 -0
- package/dist/features/dialog/dialogMeta.d.ts.map +1 -0
- package/dist/features/dialog/dialogMeta.js +59 -0
- package/dist/features/dialog/dialogMeta.js.map +1 -0
- package/dist/features/dialog/public.d.ts +3 -0
- package/dist/features/dialog/public.d.ts.map +1 -0
- package/dist/features/dialog/public.js +2 -0
- package/dist/features/dialog/public.js.map +1 -0
- package/dist/features/form/formFieldMeta.d.ts +1 -1
- package/dist/features/form/formFieldMeta.d.ts.map +1 -1
- package/dist/features/form/formFieldMeta.js +8 -1
- package/dist/features/form/formFieldMeta.js.map +1 -1
- package/dist/features/form/radio/utils/resolveRadioGroupThemeRecipe.d.ts +1 -1
- package/dist/features/form/search-input/adapters/inbound/SearchInput.d.ts +4 -0
- package/dist/features/form/search-input/adapters/inbound/SearchInput.d.ts.map +1 -0
- package/dist/{components/search-bar/SearchBar.js → features/form/search-input/adapters/inbound/SearchInput.js} +8 -10
- package/dist/features/form/search-input/adapters/inbound/SearchInput.js.map +1 -0
- package/dist/features/form/search-input/public.d.ts +3 -0
- package/dist/features/form/search-input/public.d.ts.map +1 -0
- package/dist/features/form/search-input/public.js +2 -0
- package/dist/features/form/search-input/public.js.map +1 -0
- package/dist/features/form/search-input/searchInputMeta.d.ts +126 -0
- package/dist/features/form/search-input/searchInputMeta.d.ts.map +1 -0
- package/dist/features/form/search-input/searchInputMeta.js +67 -0
- package/dist/features/form/search-input/searchInputMeta.js.map +1 -0
- package/dist/features/form/select/adapters/inbound/Select.d.ts +2 -0
- package/dist/features/form/select/adapters/inbound/Select.d.ts.map +1 -0
- package/dist/features/form/select/adapters/inbound/Select.js +2 -0
- package/dist/features/form/select/adapters/inbound/Select.js.map +1 -0
- package/dist/features/form/select/adapters/inbound/Select.native.d.ts +5 -0
- package/dist/features/form/select/adapters/inbound/Select.native.d.ts.map +1 -0
- package/dist/features/form/select/adapters/inbound/Select.native.js +42 -0
- package/dist/features/form/select/adapters/inbound/Select.native.js.map +1 -0
- package/dist/features/form/select/adapters/inbound/Select.web.d.ts +5 -0
- package/dist/features/form/select/adapters/inbound/Select.web.d.ts.map +1 -0
- package/dist/features/form/select/adapters/inbound/Select.web.js +31 -0
- package/dist/features/form/select/adapters/inbound/Select.web.js.map +1 -0
- package/dist/features/form/select/composition/SelectField.d.ts +10 -0
- package/dist/features/form/select/composition/SelectField.d.ts.map +1 -0
- package/dist/features/form/select/composition/SelectField.js +8 -0
- package/dist/features/form/select/composition/SelectField.js.map +1 -0
- package/dist/features/form/select/composition/SelectOptionRow.d.ts +12 -0
- package/dist/features/form/select/composition/SelectOptionRow.d.ts.map +1 -0
- package/dist/features/form/select/composition/SelectOptionRow.js +9 -0
- package/dist/features/form/select/composition/SelectOptionRow.js.map +1 -0
- package/dist/features/form/select/composition/SelectTrigger.d.ts +10 -0
- package/dist/features/form/select/composition/SelectTrigger.d.ts.map +1 -0
- package/dist/features/form/select/composition/SelectTrigger.js +9 -0
- package/dist/features/form/select/composition/SelectTrigger.js.map +1 -0
- package/dist/features/form/select/composition/useSelectController.d.ts +8 -0
- package/dist/features/form/select/composition/useSelectController.d.ts.map +1 -0
- package/dist/features/form/select/composition/useSelectController.js +15 -0
- package/dist/features/form/select/composition/useSelectController.js.map +1 -0
- package/dist/features/form/select/public.d.ts +3 -0
- package/dist/features/form/select/public.d.ts.map +1 -0
- package/dist/features/form/select/public.js +2 -0
- package/dist/features/form/select/public.js.map +1 -0
- package/dist/features/form/select/selectMeta.d.ts +195 -0
- package/dist/features/form/select/selectMeta.d.ts.map +1 -0
- package/dist/features/form/select/selectMeta.js +152 -0
- package/dist/features/form/select/selectMeta.js.map +1 -0
- package/dist/features/gradient/gradientMeta.d.ts +1 -1
- 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/features/pagination/adapters/inbound/Pagination.d.ts +5 -0
- package/dist/features/pagination/adapters/inbound/Pagination.d.ts.map +1 -0
- package/dist/features/pagination/adapters/inbound/Pagination.js +43 -0
- package/dist/features/pagination/adapters/inbound/Pagination.js.map +1 -0
- package/dist/features/pagination/paginationMeta.d.ts +118 -0
- package/dist/features/pagination/paginationMeta.d.ts.map +1 -0
- package/dist/features/pagination/paginationMeta.js +53 -0
- package/dist/features/pagination/paginationMeta.js.map +1 -0
- package/dist/features/pagination/public.d.ts +3 -0
- package/dist/features/pagination/public.d.ts.map +1 -0
- package/dist/features/pagination/public.js +2 -0
- package/dist/features/pagination/public.js.map +1 -0
- package/dist/features/pagination/utils/resolvePaginationPage.d.ts +3 -0
- package/dist/features/pagination/utils/resolvePaginationPage.d.ts.map +1 -0
- package/dist/features/pagination/utils/resolvePaginationPage.js +7 -0
- package/dist/features/pagination/utils/resolvePaginationPage.js.map +1 -0
- package/dist/features/pagination/utils/resolvePaginationState.d.ts +17 -0
- package/dist/features/pagination/utils/resolvePaginationState.d.ts.map +1 -0
- package/dist/features/pagination/utils/resolvePaginationState.js +34 -0
- package/dist/features/pagination/utils/resolvePaginationState.js.map +1 -0
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts +5 -0
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts.map +1 -0
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js +43 -0
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js.map +1 -0
- package/dist/features/popover-menu/popoverMenuMeta.d.ts +9 -0
- package/dist/features/popover-menu/popoverMenuMeta.d.ts.map +1 -0
- package/dist/features/popover-menu/popoverMenuMeta.js +9 -0
- package/dist/features/popover-menu/popoverMenuMeta.js.map +1 -0
- package/dist/features/popover-menu/public.d.ts +3 -0
- package/dist/features/popover-menu/public.d.ts.map +1 -0
- package/dist/features/popover-menu/public.js +2 -0
- package/dist/features/popover-menu/public.js.map +1 -0
- package/dist/features/rating/adapters/inbound/Rating.d.ts +4 -0
- package/dist/features/rating/adapters/inbound/Rating.d.ts.map +1 -0
- package/dist/features/rating/adapters/inbound/Rating.js +49 -0
- package/dist/features/rating/adapters/inbound/Rating.js.map +1 -0
- package/dist/features/rating/public.d.ts +3 -0
- package/dist/features/rating/public.d.ts.map +1 -0
- package/dist/features/rating/public.js +2 -0
- package/dist/features/rating/public.js.map +1 -0
- package/dist/features/rating/ratingMeta.d.ts +57 -0
- package/dist/features/rating/ratingMeta.d.ts.map +1 -0
- package/dist/features/rating/ratingMeta.js +43 -0
- package/dist/features/rating/ratingMeta.js.map +1 -0
- package/dist/features/rating/utils/resolveRatingSegments.d.ts +9 -0
- package/dist/features/rating/utils/resolveRatingSegments.d.ts.map +1 -0
- package/dist/features/rating/utils/resolveRatingSegments.js +14 -0
- package/dist/features/rating/utils/resolveRatingSegments.js.map +1 -0
- package/dist/features/surface/surfaceMeta.d.ts +1 -1
- package/dist/features/tabs/adapters/inbound/Tab.d.ts +5 -0
- package/dist/features/tabs/adapters/inbound/Tab.d.ts.map +1 -0
- package/dist/features/tabs/adapters/inbound/Tab.js +14 -0
- package/dist/features/tabs/adapters/inbound/Tab.js.map +1 -0
- package/dist/features/tabs/adapters/inbound/TabList.d.ts +4 -0
- package/dist/features/tabs/adapters/inbound/TabList.d.ts.map +1 -0
- package/dist/features/tabs/adapters/inbound/TabList.js +9 -0
- package/dist/features/tabs/adapters/inbound/TabList.js.map +1 -0
- package/dist/features/tabs/adapters/inbound/TabPanel.d.ts +4 -0
- package/dist/features/tabs/adapters/inbound/TabPanel.d.ts.map +1 -0
- package/dist/features/tabs/adapters/inbound/TabPanel.js +11 -0
- package/dist/features/tabs/adapters/inbound/TabPanel.js.map +1 -0
- package/dist/features/tabs/adapters/inbound/Tabs.d.ts +4 -0
- package/dist/features/tabs/adapters/inbound/Tabs.d.ts.map +1 -0
- package/dist/features/tabs/adapters/inbound/Tabs.js +12 -0
- package/dist/features/tabs/adapters/inbound/Tabs.js.map +1 -0
- package/dist/features/tabs/composition/TabsInteractionPolicyContext.d.ts +3 -0
- package/dist/features/tabs/composition/TabsInteractionPolicyContext.d.ts.map +1 -0
- package/dist/features/tabs/composition/TabsInteractionPolicyContext.js +3 -0
- package/dist/features/tabs/composition/TabsInteractionPolicyContext.js.map +1 -0
- package/dist/features/tabs/public.d.ts +6 -0
- package/dist/features/tabs/public.d.ts.map +1 -0
- package/dist/features/tabs/public.js +5 -0
- package/dist/features/tabs/public.js.map +1 -0
- package/dist/features/tabs/tabListMeta.d.ts +9 -0
- package/dist/features/tabs/tabListMeta.d.ts.map +1 -0
- package/dist/features/tabs/tabListMeta.js +9 -0
- package/dist/features/tabs/tabListMeta.js.map +1 -0
- package/dist/features/tabs/tabMeta.d.ts +32 -0
- package/dist/features/tabs/tabMeta.d.ts.map +1 -0
- package/dist/features/tabs/tabMeta.js +14 -0
- package/dist/features/tabs/tabMeta.js.map +1 -0
- package/dist/features/tabs/tabPanelMeta.d.ts +15 -0
- package/dist/features/tabs/tabPanelMeta.d.ts.map +1 -0
- package/dist/features/tabs/tabPanelMeta.js +12 -0
- package/dist/features/tabs/tabPanelMeta.js.map +1 -0
- package/dist/features/tabs/tabsMeta.d.ts +58 -0
- package/dist/features/tabs/tabsMeta.d.ts.map +1 -0
- package/dist/features/tabs/tabsMeta.js +40 -0
- package/dist/features/tabs/tabsMeta.js.map +1 -0
- package/dist/features/toolbar/adapters/inbound/Toolbar.d.ts +4 -0
- package/dist/features/toolbar/adapters/inbound/Toolbar.d.ts.map +1 -0
- package/dist/features/toolbar/adapters/inbound/Toolbar.js +14 -0
- package/dist/features/toolbar/adapters/inbound/Toolbar.js.map +1 -0
- package/dist/features/toolbar/public.d.ts +3 -0
- package/dist/features/toolbar/public.d.ts.map +1 -0
- package/dist/features/toolbar/public.js +2 -0
- package/dist/features/toolbar/public.js.map +1 -0
- package/dist/features/toolbar/toolbarMeta.d.ts +29 -0
- package/dist/features/toolbar/toolbarMeta.d.ts.map +1 -0
- package/dist/features/toolbar/toolbarMeta.js +22 -0
- package/dist/features/toolbar/toolbarMeta.js.map +1 -0
- package/dist/features/typography/utils/resolveHeadingThemeRecipe.d.ts +1 -1
- package/dist/features/typography/utils/resolveTextThemeRecipe.d.ts +1 -1
- package/dist/features/uploader/adapters/inbound/Uploader.d.ts.map +1 -1
- package/dist/features/uploader/adapters/inbound/Uploader.js +3 -3
- package/dist/features/uploader/adapters/inbound/Uploader.js.map +1 -1
- package/dist/index.d.ts +10 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- 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 +6 -0
- package/dist/metadata/allowedChildren.js.map +1 -1
- package/dist/metadata/bindableComponentMeta.d.ts +3 -4
- package/dist/metadata/bindableComponentMeta.d.ts.map +1 -1
- package/dist/metadata/bindableComponentMeta.js +1 -2
- package/dist/metadata/bindableComponentMeta.js.map +1 -1
- package/dist/metadata/componentMeta.d.ts.map +1 -1
- package/dist/metadata/componentMeta.js +18 -14
- package/dist/metadata/componentMeta.js.map +1 -1
- package/dist/patterns/confirm-dialog/ConfirmDialog.js +3 -3
- package/dist/patterns/confirm-dialog/ConfirmDialog.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/patterns/theme-composer/ThemeComposer.d.ts.map +1 -1
- package/dist/patterns/theme-composer/ThemeComposer.js +4 -4
- package/dist/patterns/theme-composer/ThemeComposer.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +15 -14
- package/dist/registry.js.map +1 -1
- package/dist/types/app-bar.d.ts +6 -3
- package/dist/types/app-bar.d.ts.map +1 -1
- package/dist/types/app-bar.js.map +1 -1
- package/dist/{components/breadcrumbs/types.d.ts → types/breadcrumbs.d.ts} +8 -6
- package/dist/types/breadcrumbs.d.ts.map +1 -0
- package/dist/types/breadcrumbs.js +2 -0
- package/dist/types/breadcrumbs.js.map +1 -0
- package/dist/types/data-table.d.ts +2 -2
- package/dist/types/data-table.d.ts.map +1 -1
- package/dist/types/data-table.js.map +1 -1
- package/dist/types/dialog.d.ts +14 -0
- package/dist/types/dialog.d.ts.map +1 -0
- package/dist/types/dialog.js +2 -0
- package/dist/types/dialog.js.map +1 -0
- package/dist/types/pagination.d.ts +16 -0
- package/dist/types/pagination.d.ts.map +1 -0
- package/dist/types/pagination.js +2 -0
- package/dist/types/pagination.js.map +1 -0
- package/dist/types/popover-menu.d.ts +24 -0
- package/dist/types/popover-menu.d.ts.map +1 -0
- package/dist/types/popover-menu.js +2 -0
- package/dist/types/popover-menu.js.map +1 -0
- package/dist/types/rating.d.ts +9 -0
- package/dist/types/rating.d.ts.map +1 -0
- package/dist/types/rating.js +2 -0
- package/dist/types/rating.js.map +1 -0
- package/dist/types/search-input.d.ts +14 -0
- package/dist/types/search-input.d.ts.map +1 -0
- package/dist/types/search-input.js +2 -0
- package/dist/types/search-input.js.map +1 -0
- package/dist/types/select.d.ts +22 -0
- package/dist/types/select.d.ts.map +1 -0
- package/dist/types/select.js +2 -0
- package/dist/types/select.js.map +1 -0
- package/dist/types/tabs.d.ts +21 -0
- package/dist/types/tabs.d.ts.map +1 -0
- package/dist/types/tabs.js +2 -0
- package/dist/types/tabs.js.map +1 -0
- package/dist/types/toolbar.d.ts +8 -0
- package/dist/types/toolbar.d.ts.map +1 -0
- package/dist/types/toolbar.js +2 -0
- package/dist/types/toolbar.js.map +1 -0
- package/package.json +2 -4
- package/src/audit.test.ts +8 -47
- package/src/constants.ts +5 -0
- package/src/featureManifest.test.ts +31 -2
- package/src/features/app-bar/adapters/inbound/AppBar.tsx +50 -42
- package/src/features/app-bar/public.ts +1 -1
- package/src/features/bottom-sheet/public.test.ts +10 -1
- package/src/features/bottom-sheet/public.ts +9 -1
- package/src/features/breadcrumbs/adapters/inbound/Breadcrumbs.tsx +179 -0
- package/src/features/breadcrumbs/breadcrumbsMeta.ts +95 -0
- package/src/features/breadcrumbs/public.test.ts +22 -0
- package/src/features/breadcrumbs/public.ts +6 -0
- package/src/features/data-table/adapters/inbound/DataTable.tsx +9 -5
- package/src/features/dialog/adapters/inbound/Dialog.tsx +70 -0
- package/src/features/dialog/dialogMeta.ts +60 -0
- package/src/features/dialog/public.ts +2 -0
- package/src/features/form/formFieldMeta.ts +8 -1
- package/src/{components/search-bar/SearchBar.tsx → features/form/search-input/adapters/inbound/SearchInput.tsx} +10 -15
- package/src/features/form/search-input/public.ts +2 -0
- package/src/features/form/search-input/searchInputMeta.ts +68 -0
- package/src/features/form/select/adapters/inbound/Select.native.tsx +78 -0
- package/src/features/form/select/adapters/inbound/Select.tsx +1 -0
- package/src/features/form/select/adapters/inbound/Select.web.tsx +63 -0
- package/src/features/form/select/composition/SelectField.tsx +27 -0
- package/src/features/form/select/composition/SelectOptionRow.tsx +36 -0
- package/src/features/form/select/composition/SelectTrigger.tsx +32 -0
- package/src/features/form/select/composition/useSelectController.ts +21 -0
- package/src/features/form/select/public.test.ts +25 -0
- package/src/features/form/select/public.ts +2 -0
- package/src/features/form/select/selectMeta.ts +154 -0
- package/src/features/pagination/adapters/inbound/Pagination.tsx +116 -0
- package/src/features/pagination/paginationMeta.ts +54 -0
- package/src/features/pagination/public.ts +2 -0
- package/src/features/pagination/utils/resolvePaginationPage.ts +6 -0
- package/src/features/pagination/utils/resolvePaginationState.test.ts +29 -0
- package/src/features/pagination/utils/resolvePaginationState.ts +70 -0
- package/src/features/popover-menu/adapters/inbound/PopoverMenu.tsx +60 -0
- package/src/{components/rating/meta.ts → features/popover-menu/popoverMenuMeta.ts} +3 -3
- package/src/features/popover-menu/public.test.ts +11 -0
- package/src/features/popover-menu/public.ts +6 -0
- package/src/features/rating/adapters/inbound/Rating.tsx +70 -0
- package/src/features/rating/public.ts +2 -0
- package/src/features/rating/ratingMeta.ts +44 -0
- package/src/features/rating/utils/resolveRatingSegments.test.ts +20 -0
- package/src/features/rating/utils/resolveRatingSegments.ts +19 -0
- package/src/features/tabs/adapters/inbound/Tab.tsx +26 -0
- package/src/features/tabs/adapters/inbound/TabList.tsx +18 -0
- package/src/features/tabs/adapters/inbound/TabPanel.tsx +23 -0
- package/src/features/tabs/adapters/inbound/Tabs.tsx +23 -0
- package/src/features/tabs/composition/TabsInteractionPolicyContext.ts +4 -0
- package/src/features/tabs/public.ts +5 -0
- package/src/features/tabs/tabListMeta.ts +10 -0
- package/src/features/tabs/tabMeta.ts +15 -0
- package/src/features/tabs/tabPanelMeta.ts +13 -0
- package/src/features/tabs/tabsMeta.ts +41 -0
- package/src/features/toolbar/adapters/inbound/Toolbar.tsx +31 -0
- package/src/features/toolbar/public.ts +2 -0
- package/src/features/toolbar/toolbarMeta.ts +24 -0
- package/src/{components → features/typography}/contentFallback.test.ts +2 -8
- package/src/features/uploader/adapters/inbound/Uploader.tsx +3 -3
- package/src/index.ts +29 -19
- package/src/interactionPolicy.test.ts +19 -21
- package/src/metadata/allowedChildren.ts +6 -0
- package/src/metadata/bindableComponentMeta.test.ts +8 -0
- package/src/metadata/bindableComponentMeta.ts +1 -2
- package/src/metadata/componentMeta.test.ts +21 -1
- package/src/metadata/componentMeta.ts +18 -14
- package/src/nativePeerContract.test.ts +5 -19
- package/src/patterns/confirm-dialog/ConfirmDialog.tsx +3 -3
- package/src/patterns/theme-composer/ThemeComposer.tsx +7 -8
- package/src/platformAcceptance.test.ts +1 -1
- package/src/registry.ts +15 -14
- package/src/showcaseCoverage.test.ts +6 -3
- package/src/theme/themeScopeStructure.test.ts +24 -14
- package/src/types/app-bar.ts +6 -3
- package/src/{components/breadcrumbs/types.ts → types/breadcrumbs.ts} +8 -5
- package/src/types/data-table.ts +2 -2
- package/src/types/dialog.ts +15 -0
- package/src/{components/pagination/types.ts → types/pagination.ts} +5 -8
- package/src/types/popover-menu.ts +31 -0
- package/src/types/rating.ts +9 -0
- package/src/types/search-input.ts +14 -0
- package/src/{components/select/types.ts → types/select.ts} +11 -3
- package/src/types/tabs.ts +25 -0
- package/src/types/toolbar.ts +9 -0
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +0 -7
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts.map +0 -1
- package/dist/components/breadcrumbs/Breadcrumbs.js +0 -80
- package/dist/components/breadcrumbs/Breadcrumbs.js.map +0 -1
- package/dist/components/breadcrumbs/index.d.ts +0 -3
- package/dist/components/breadcrumbs/index.d.ts.map +0 -1
- package/dist/components/breadcrumbs/index.js +0 -2
- package/dist/components/breadcrumbs/index.js.map +0 -1
- package/dist/components/breadcrumbs/meta.d.ts +0 -9
- package/dist/components/breadcrumbs/meta.d.ts.map +0 -1
- package/dist/components/breadcrumbs/meta.js +0 -9
- package/dist/components/breadcrumbs/meta.js.map +0 -1
- package/dist/components/breadcrumbs/types.d.ts.map +0 -1
- package/dist/components/breadcrumbs/types.js +0 -2
- package/dist/components/breadcrumbs/types.js.map +0 -1
- package/dist/components/menu/DropdownMenu.d.ts +0 -7
- package/dist/components/menu/DropdownMenu.d.ts.map +0 -1
- package/dist/components/menu/DropdownMenu.js +0 -9
- package/dist/components/menu/DropdownMenu.js.map +0 -1
- package/dist/components/menu/Menu.d.ts +0 -7
- package/dist/components/menu/Menu.d.ts.map +0 -1
- package/dist/components/menu/Menu.js +0 -46
- package/dist/components/menu/Menu.js.map +0 -1
- package/dist/components/menu/index.d.ts +0 -4
- package/dist/components/menu/index.d.ts.map +0 -1
- package/dist/components/menu/index.js +0 -3
- package/dist/components/menu/index.js.map +0 -1
- package/dist/components/menu/meta.d.ts +0 -17
- package/dist/components/menu/meta.d.ts.map +0 -1
- package/dist/components/menu/meta.js +0 -17
- package/dist/components/menu/meta.js.map +0 -1
- package/dist/components/menu/types.d.ts +0 -22
- package/dist/components/menu/types.d.ts.map +0 -1
- package/dist/components/menu/types.js +0 -2
- package/dist/components/menu/types.js.map +0 -1
- package/dist/components/modal/Modal.d.ts +0 -7
- package/dist/components/modal/Modal.d.ts.map +0 -1
- package/dist/components/modal/Modal.js +0 -39
- package/dist/components/modal/Modal.js.map +0 -1
- package/dist/components/modal/index.d.ts +0 -3
- package/dist/components/modal/index.d.ts.map +0 -1
- package/dist/components/modal/index.js +0 -2
- package/dist/components/modal/index.js.map +0 -1
- package/dist/components/modal/meta.d.ts +0 -9
- package/dist/components/modal/meta.d.ts.map +0 -1
- package/dist/components/modal/meta.js +0 -9
- package/dist/components/modal/meta.js.map +0 -1
- package/dist/components/modal/types.d.ts +0 -12
- package/dist/components/modal/types.d.ts.map +0 -1
- package/dist/components/modal/types.js +0 -2
- package/dist/components/modal/types.js.map +0 -1
- package/dist/components/pagination/Pagination.d.ts +0 -7
- package/dist/components/pagination/Pagination.d.ts.map +0 -1
- package/dist/components/pagination/Pagination.js +0 -96
- package/dist/components/pagination/Pagination.js.map +0 -1
- package/dist/components/pagination/index.d.ts +0 -3
- package/dist/components/pagination/index.d.ts.map +0 -1
- package/dist/components/pagination/index.js +0 -2
- package/dist/components/pagination/index.js.map +0 -1
- package/dist/components/pagination/meta.d.ts +0 -9
- package/dist/components/pagination/meta.d.ts.map +0 -1
- package/dist/components/pagination/meta.js +0 -9
- package/dist/components/pagination/meta.js.map +0 -1
- package/dist/components/pagination/types.d.ts +0 -18
- package/dist/components/pagination/types.d.ts.map +0 -1
- package/dist/components/pagination/types.js +0 -2
- package/dist/components/pagination/types.js.map +0 -1
- package/dist/components/rating/Rating.d.ts +0 -7
- package/dist/components/rating/Rating.d.ts.map +0 -1
- package/dist/components/rating/Rating.js +0 -26
- package/dist/components/rating/Rating.js.map +0 -1
- package/dist/components/rating/index.d.ts +0 -3
- package/dist/components/rating/index.d.ts.map +0 -1
- package/dist/components/rating/index.js +0 -2
- package/dist/components/rating/index.js.map +0 -1
- package/dist/components/rating/meta.d.ts +0 -9
- package/dist/components/rating/meta.d.ts.map +0 -1
- package/dist/components/rating/meta.js +0 -9
- package/dist/components/rating/meta.js.map +0 -1
- package/dist/components/rating/resolveRatingSegments.d.ts +0 -7
- package/dist/components/rating/resolveRatingSegments.d.ts.map +0 -1
- package/dist/components/rating/resolveRatingSegments.js +0 -22
- package/dist/components/rating/resolveRatingSegments.js.map +0 -1
- package/dist/components/rating/types.d.ts +0 -11
- package/dist/components/rating/types.d.ts.map +0 -1
- package/dist/components/rating/types.js +0 -26
- package/dist/components/rating/types.js.map +0 -1
- package/dist/components/search-bar/SearchBar.d.ts +0 -7
- package/dist/components/search-bar/SearchBar.d.ts.map +0 -1
- package/dist/components/search-bar/SearchBar.js.map +0 -1
- package/dist/components/search-bar/index.d.ts +0 -3
- package/dist/components/search-bar/index.d.ts.map +0 -1
- package/dist/components/search-bar/index.js +0 -2
- package/dist/components/search-bar/index.js.map +0 -1
- package/dist/components/search-bar/meta.d.ts +0 -9
- package/dist/components/search-bar/meta.d.ts.map +0 -1
- package/dist/components/search-bar/meta.js +0 -9
- package/dist/components/search-bar/meta.js.map +0 -1
- package/dist/components/search-bar/types.d.ts +0 -14
- package/dist/components/search-bar/types.d.ts.map +0 -1
- package/dist/components/search-bar/types.js +0 -2
- package/dist/components/search-bar/types.js.map +0 -1
- package/dist/components/select/Select.d.ts +0 -7
- package/dist/components/select/Select.d.ts.map +0 -1
- package/dist/components/select/Select.js +0 -32
- package/dist/components/select/Select.js.map +0 -1
- package/dist/components/select/index.d.ts +0 -3
- package/dist/components/select/index.d.ts.map +0 -1
- package/dist/components/select/index.js +0 -3
- package/dist/components/select/index.js.map +0 -1
- package/dist/components/select/meta.d.ts +0 -9
- package/dist/components/select/meta.d.ts.map +0 -1
- package/dist/components/select/meta.js +0 -9
- package/dist/components/select/meta.js.map +0 -1
- package/dist/components/select/types.d.ts +0 -14
- package/dist/components/select/types.d.ts.map +0 -1
- package/dist/components/select/types.js +0 -2
- package/dist/components/select/types.js.map +0 -1
- package/dist/components/tabs/Tabs.d.ts +0 -9
- package/dist/components/tabs/Tabs.d.ts.map +0 -1
- package/dist/components/tabs/Tabs.js +0 -59
- package/dist/components/tabs/Tabs.js.map +0 -1
- package/dist/components/tabs/index.d.ts +0 -3
- package/dist/components/tabs/index.d.ts.map +0 -1
- package/dist/components/tabs/index.js +0 -3
- package/dist/components/tabs/index.js.map +0 -1
- package/dist/components/tabs/meta.d.ts +0 -9
- package/dist/components/tabs/meta.d.ts.map +0 -1
- package/dist/components/tabs/meta.js +0 -9
- package/dist/components/tabs/meta.js.map +0 -1
- package/dist/components/tabs/types.d.ts +0 -22
- package/dist/components/tabs/types.d.ts.map +0 -1
- package/dist/components/tabs/types.js +0 -2
- package/dist/components/tabs/types.js.map +0 -1
- package/dist/components/toolbar/Toolbar.d.ts +0 -9
- package/dist/components/toolbar/Toolbar.d.ts.map +0 -1
- package/dist/components/toolbar/Toolbar.js +0 -26
- package/dist/components/toolbar/Toolbar.js.map +0 -1
- package/dist/components/toolbar/ToolbarAction.d.ts +0 -9
- package/dist/components/toolbar/ToolbarAction.d.ts.map +0 -1
- package/dist/components/toolbar/ToolbarAction.js +0 -13
- package/dist/components/toolbar/ToolbarAction.js.map +0 -1
- package/dist/components/toolbar/index.d.ts +0 -4
- package/dist/components/toolbar/index.d.ts.map +0 -1
- package/dist/components/toolbar/index.js +0 -4
- package/dist/components/toolbar/index.js.map +0 -1
- package/dist/components/toolbar/meta.d.ts +0 -17
- package/dist/components/toolbar/meta.d.ts.map +0 -1
- package/dist/components/toolbar/meta.js +0 -17
- package/dist/components/toolbar/meta.js.map +0 -1
- package/dist/components/toolbar/types.d.ts +0 -18
- package/dist/components/toolbar/types.d.ts.map +0 -1
- package/dist/components/toolbar/types.js +0 -2
- package/dist/components/toolbar/types.js.map +0 -1
- package/src/components/breadcrumbs/Breadcrumbs.tsx +0 -147
- package/src/components/breadcrumbs/index.ts +0 -2
- package/src/components/breadcrumbs/meta.ts +0 -10
- package/src/components/menu/DropdownMenu.tsx +0 -11
- package/src/components/menu/Menu.tsx +0 -59
- package/src/components/menu/index.ts +0 -3
- package/src/components/menu/meta.ts +0 -19
- package/src/components/menu/types.ts +0 -31
- package/src/components/modal/Modal.tsx +0 -63
- package/src/components/modal/index.ts +0 -2
- package/src/components/modal/meta.ts +0 -10
- package/src/components/modal/types.ts +0 -16
- package/src/components/pagination/Pagination.tsx +0 -199
- package/src/components/pagination/index.ts +0 -2
- package/src/components/pagination/meta.ts +0 -10
- package/src/components/rating/Rating.tsx +0 -42
- package/src/components/rating/index.ts +0 -2
- package/src/components/rating/resolveRatingSegments.test.ts +0 -60
- package/src/components/rating/resolveRatingSegments.ts +0 -34
- package/src/components/rating/types.ts +0 -37
- package/src/components/search-bar/index.ts +0 -2
- package/src/components/search-bar/meta.ts +0 -10
- package/src/components/search-bar/types.ts +0 -14
- package/src/components/select/Select.tsx +0 -67
- package/src/components/select/index.ts +0 -2
- package/src/components/select/meta.ts +0 -10
- package/src/components/tabs/Tabs.tsx +0 -129
- package/src/components/tabs/index.ts +0 -2
- package/src/components/tabs/meta.ts +0 -10
- package/src/components/tabs/types.ts +0 -25
- package/src/components/toolbar/Toolbar.tsx +0 -48
- package/src/components/toolbar/ToolbarAction.tsx +0 -28
- package/src/components/toolbar/index.ts +0 -3
- package/src/components/toolbar/meta.ts +0 -19
- package/src/components/toolbar/types.ts +0 -21
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SelectProps } from '../../../../types/select';
|
|
2
|
+
import { Button } from '../../../button/public';
|
|
3
|
+
|
|
4
|
+
const SELECT_CHEVRON_ICON = { name: 'chevron-down' } as const;
|
|
5
|
+
|
|
6
|
+
/*** Renders the shared Select trigger with the resolved option label or placeholder. */
|
|
7
|
+
export function SelectTrigger<TValue extends string>({
|
|
8
|
+
displayLabel,
|
|
9
|
+
onPress,
|
|
10
|
+
props,
|
|
11
|
+
}: SelectTriggerProps<TValue>) {
|
|
12
|
+
return (
|
|
13
|
+
<Button
|
|
14
|
+
color={props.invalid ? 'danger' : 'neutral'}
|
|
15
|
+
disabled={props.disabled}
|
|
16
|
+
fullWidth
|
|
17
|
+
interactionPolicy={props.interactionPolicy}
|
|
18
|
+
onPress={props.readOnly ? undefined : onPress}
|
|
19
|
+
testID={props.testID ? `${props.testID}-trigger` : undefined}
|
|
20
|
+
trailingIcon={SELECT_CHEVRON_ICON}
|
|
21
|
+
variant="outline"
|
|
22
|
+
>
|
|
23
|
+
{displayLabel ?? props.placeholder ?? 'Select'}
|
|
24
|
+
</Button>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface SelectTriggerProps<TValue extends string> {
|
|
29
|
+
displayLabel: string | undefined;
|
|
30
|
+
onPress: () => void;
|
|
31
|
+
props: SelectProps<TValue>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { SelectProps } from '../../../../types/select';
|
|
4
|
+
|
|
5
|
+
/*** Resolves controlled or uncontrolled Select value state and the selected option. */
|
|
6
|
+
export function useSelectController<TValue extends string>(props: SelectProps<TValue>) {
|
|
7
|
+
const { defaultValue, onValueChange, options, value: controlledValue } = props;
|
|
8
|
+
const [localValue, setLocalValue] = React.useState<TValue | undefined>(defaultValue);
|
|
9
|
+
const value = controlledValue ?? localValue;
|
|
10
|
+
const selectedOption = options.find((option) => option.value === value);
|
|
11
|
+
|
|
12
|
+
const select = React.useCallback(
|
|
13
|
+
(nextValue: TValue) => {
|
|
14
|
+
if (controlledValue === undefined) setLocalValue(nextValue);
|
|
15
|
+
onValueChange?.(nextValue);
|
|
16
|
+
},
|
|
17
|
+
[controlledValue, onValueChange],
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return { select, selectedOption, value } as const;
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import { selectMeta } from './selectMeta';
|
|
4
|
+
|
|
5
|
+
test('Select is a direct manifest node with valueChange payload', () => {
|
|
6
|
+
expect(selectMeta.directManifestNode).toBe(true);
|
|
7
|
+
expect(selectMeta.events.valueChange.eventType).toBe('select.valueChange');
|
|
8
|
+
expect(selectMeta.events.valueChange.payloadFields).toEqual([
|
|
9
|
+
{ path: 'value', type: 'string', label: 'Value' },
|
|
10
|
+
]);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('Select uses web Popover and native BottomSheetFlatList presentation', async () => {
|
|
14
|
+
const [neutral, web, native] = await Promise.all([
|
|
15
|
+
Bun.file('src/features/form/select/adapters/inbound/Select.tsx').text(),
|
|
16
|
+
Bun.file('src/features/form/select/adapters/inbound/Select.web.tsx').text(),
|
|
17
|
+
Bun.file('src/features/form/select/adapters/inbound/Select.native.tsx').text(),
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
expect(neutral).toContain("export { Select } from './Select.web';");
|
|
21
|
+
expect(web).toContain("import { Popover } from '@ankhorage/surface';");
|
|
22
|
+
expect(native).toContain('<BottomSheetFlatList');
|
|
23
|
+
expect(native).toContain("contentMode: 'direct'");
|
|
24
|
+
expect(`${neutral}\n${web}\n${native}`).not.toContain('@react-native-picker/picker');
|
|
25
|
+
});
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { ZoraComponentMeta } from '../../../metadata';
|
|
2
|
+
|
|
3
|
+
export const selectMeta = {
|
|
4
|
+
name: 'Select',
|
|
5
|
+
category: 'component',
|
|
6
|
+
description:
|
|
7
|
+
'Single-value form selection with Popover presentation on web and BottomSheet presentation on native.',
|
|
8
|
+
directManifestNode: true,
|
|
9
|
+
allowedChildren: [],
|
|
10
|
+
blueprint: {
|
|
11
|
+
label: 'Select',
|
|
12
|
+
defaultProps: {
|
|
13
|
+
label: 'Option',
|
|
14
|
+
placeholder: 'Select',
|
|
15
|
+
defaultValue: 'option-b',
|
|
16
|
+
options: [
|
|
17
|
+
{ value: 'option-a', label: 'First option' },
|
|
18
|
+
{ value: 'option-b', label: 'Second option' },
|
|
19
|
+
{ value: 'option-c', label: 'Third option' },
|
|
20
|
+
],
|
|
21
|
+
disabled: false,
|
|
22
|
+
readOnly: false,
|
|
23
|
+
invalid: false,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
bindings: {
|
|
27
|
+
props: {
|
|
28
|
+
value: {
|
|
29
|
+
label: 'Value',
|
|
30
|
+
description: 'Currently selected option value.',
|
|
31
|
+
value: { type: 'string' },
|
|
32
|
+
acceptsFallback: true,
|
|
33
|
+
acceptsTransforms: true,
|
|
34
|
+
},
|
|
35
|
+
disabled: {
|
|
36
|
+
label: 'Disabled',
|
|
37
|
+
description: 'Whether the select is disabled.',
|
|
38
|
+
value: { type: 'boolean' },
|
|
39
|
+
acceptsFallback: true,
|
|
40
|
+
acceptsTransforms: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
events: {
|
|
44
|
+
valueChange: {
|
|
45
|
+
label: 'Value change',
|
|
46
|
+
description: 'Runs when the selected option value changes.',
|
|
47
|
+
payload: {
|
|
48
|
+
eventType: 'select.valueChange',
|
|
49
|
+
fields: [{ path: 'value', type: 'string', label: 'Value' }],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
events: {
|
|
55
|
+
valueChange: {
|
|
56
|
+
label: 'Value change',
|
|
57
|
+
eventType: 'select.valueChange',
|
|
58
|
+
description: 'Emitted when the selected option value changes.',
|
|
59
|
+
payloadFields: [{ path: 'value', type: 'string', label: 'Value' }],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
props: {
|
|
63
|
+
defaultValue: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
category: 'State',
|
|
66
|
+
label: 'Initial value',
|
|
67
|
+
authoring: { authority: 'instance' },
|
|
68
|
+
},
|
|
69
|
+
value: {
|
|
70
|
+
type: 'string',
|
|
71
|
+
category: 'State',
|
|
72
|
+
label: 'Value',
|
|
73
|
+
authoring: { authority: 'instance' },
|
|
74
|
+
},
|
|
75
|
+
options: {
|
|
76
|
+
type: 'array',
|
|
77
|
+
category: 'Content',
|
|
78
|
+
label: 'Options',
|
|
79
|
+
itemSchema: [
|
|
80
|
+
{
|
|
81
|
+
key: 'value',
|
|
82
|
+
schema: { type: 'string', category: 'Content', label: 'Value' },
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
key: 'label',
|
|
86
|
+
schema: { type: 'string', category: 'Content', label: 'Label' },
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
key: 'disabled',
|
|
90
|
+
schema: {
|
|
91
|
+
type: 'boolean',
|
|
92
|
+
category: 'State',
|
|
93
|
+
label: 'Disabled',
|
|
94
|
+
default: false,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
authoring: { authority: 'instance' },
|
|
99
|
+
},
|
|
100
|
+
label: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
category: 'Content',
|
|
103
|
+
label: 'Label',
|
|
104
|
+
authoring: { authority: 'instance' },
|
|
105
|
+
},
|
|
106
|
+
helperText: {
|
|
107
|
+
type: 'string',
|
|
108
|
+
category: 'Content',
|
|
109
|
+
label: 'Helper text',
|
|
110
|
+
authoring: { authority: 'instance' },
|
|
111
|
+
},
|
|
112
|
+
errorText: {
|
|
113
|
+
type: 'string',
|
|
114
|
+
category: 'Content',
|
|
115
|
+
label: 'Error text',
|
|
116
|
+
authoring: { authority: 'instance' },
|
|
117
|
+
},
|
|
118
|
+
placeholder: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
category: 'Content',
|
|
121
|
+
label: 'Placeholder',
|
|
122
|
+
default: 'Select',
|
|
123
|
+
authoring: { authority: 'instance' },
|
|
124
|
+
},
|
|
125
|
+
required: {
|
|
126
|
+
type: 'boolean',
|
|
127
|
+
category: 'State',
|
|
128
|
+
label: 'Required',
|
|
129
|
+
default: false,
|
|
130
|
+
authoring: { authority: 'instance' },
|
|
131
|
+
},
|
|
132
|
+
disabled: {
|
|
133
|
+
type: 'boolean',
|
|
134
|
+
category: 'State',
|
|
135
|
+
label: 'Disabled',
|
|
136
|
+
default: false,
|
|
137
|
+
authoring: { authority: 'instance' },
|
|
138
|
+
},
|
|
139
|
+
readOnly: {
|
|
140
|
+
type: 'boolean',
|
|
141
|
+
category: 'State',
|
|
142
|
+
label: 'Read only',
|
|
143
|
+
default: false,
|
|
144
|
+
authoring: { authority: 'instance' },
|
|
145
|
+
},
|
|
146
|
+
invalid: {
|
|
147
|
+
type: 'boolean',
|
|
148
|
+
category: 'State',
|
|
149
|
+
label: 'Invalid',
|
|
150
|
+
default: false,
|
|
151
|
+
authoring: { authority: 'instance' },
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
} as const satisfies ZoraComponentMeta;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { withZoraThemeScope } from '../../../../theme/withZoraThemeScope';
|
|
4
|
+
import type { PaginationProps } from '../../../../types/pagination';
|
|
5
|
+
import { Button } from '../../../button/public';
|
|
6
|
+
import { Stack } from '../../../layout/public';
|
|
7
|
+
import { Text } from '../../../typography/public';
|
|
8
|
+
import { resolvePaginationPage } from '../../utils/resolvePaginationPage';
|
|
9
|
+
import { resolvePaginationState } from '../../utils/resolvePaginationState';
|
|
10
|
+
|
|
11
|
+
/*** Renders controls for navigating between pages of a finite result set. */
|
|
12
|
+
export const Pagination = withZoraThemeScope(PaginationInner);
|
|
13
|
+
|
|
14
|
+
/*** Connects normalized pagination state to visible page navigation controls. */
|
|
15
|
+
function PaginationInner({
|
|
16
|
+
themeId: _themeId,
|
|
17
|
+
mode: _mode,
|
|
18
|
+
page,
|
|
19
|
+
pageCount,
|
|
20
|
+
onPageChange,
|
|
21
|
+
disabled = false,
|
|
22
|
+
siblingCount = 1,
|
|
23
|
+
boundaryCount = 1,
|
|
24
|
+
showFirstLast = false,
|
|
25
|
+
previousLabel = 'Previous',
|
|
26
|
+
nextLabel = 'Next',
|
|
27
|
+
firstLabel = 'First',
|
|
28
|
+
lastLabel = 'Last',
|
|
29
|
+
compact = false,
|
|
30
|
+
testID,
|
|
31
|
+
interactionPolicy,
|
|
32
|
+
}: PaginationProps) {
|
|
33
|
+
const passive = interactionPolicy === 'passive';
|
|
34
|
+
const state = resolvePaginationState({ boundaryCount, compact, page, pageCount, siblingCount });
|
|
35
|
+
const canGoPrevious = state.currentPage > 1;
|
|
36
|
+
const canGoNext = state.currentPage < state.pageCount;
|
|
37
|
+
const navigationDisabled = disabled || state.pageCount <= 1;
|
|
38
|
+
|
|
39
|
+
const changePage = React.useCallback(
|
|
40
|
+
(nextPage: number) => {
|
|
41
|
+
const clampedPage = resolvePaginationPage(nextPage, state.pageCount);
|
|
42
|
+
if (passive || disabled || clampedPage === state.currentPage) return;
|
|
43
|
+
onPageChange?.(clampedPage);
|
|
44
|
+
},
|
|
45
|
+
[disabled, onPageChange, passive, state.currentPage, state.pageCount],
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Stack align="center" direction="row" gap="xs" testID={testID}>
|
|
50
|
+
{showFirstLast ? (
|
|
51
|
+
<Button
|
|
52
|
+
disabled={navigationDisabled || state.currentPage === 1}
|
|
53
|
+
interactionPolicy={interactionPolicy}
|
|
54
|
+
onPress={() => changePage(1)}
|
|
55
|
+
size="s"
|
|
56
|
+
testID={testID ? `${testID}-first` : undefined}
|
|
57
|
+
variant="ghost"
|
|
58
|
+
>
|
|
59
|
+
{firstLabel}
|
|
60
|
+
</Button>
|
|
61
|
+
) : null}
|
|
62
|
+
<Button
|
|
63
|
+
disabled={navigationDisabled || !canGoPrevious}
|
|
64
|
+
interactionPolicy={interactionPolicy}
|
|
65
|
+
onPress={() => changePage(state.currentPage - 1)}
|
|
66
|
+
size="s"
|
|
67
|
+
testID={testID ? `${testID}-previous` : undefined}
|
|
68
|
+
variant="ghost"
|
|
69
|
+
>
|
|
70
|
+
{previousLabel}
|
|
71
|
+
</Button>
|
|
72
|
+
{state.items.map((item, index) =>
|
|
73
|
+
item === 'ellipsis' ? (
|
|
74
|
+
<Text key={`ellipsis-${index}`} emphasis="muted" variant="bodySmall">
|
|
75
|
+
…
|
|
76
|
+
</Text>
|
|
77
|
+
) : (
|
|
78
|
+
<Button
|
|
79
|
+
color={item === state.currentPage ? 'primary' : 'neutral'}
|
|
80
|
+
disabled={disabled}
|
|
81
|
+
interactionPolicy={interactionPolicy}
|
|
82
|
+
key={item}
|
|
83
|
+
onPress={() => changePage(item)}
|
|
84
|
+
size="s"
|
|
85
|
+
testID={testID ? `${testID}-page-${item}` : undefined}
|
|
86
|
+
variant={item === state.currentPage ? 'solid' : 'ghost'}
|
|
87
|
+
>
|
|
88
|
+
{item}
|
|
89
|
+
</Button>
|
|
90
|
+
),
|
|
91
|
+
)}
|
|
92
|
+
<Button
|
|
93
|
+
disabled={navigationDisabled || !canGoNext}
|
|
94
|
+
interactionPolicy={interactionPolicy}
|
|
95
|
+
onPress={() => changePage(state.currentPage + 1)}
|
|
96
|
+
size="s"
|
|
97
|
+
testID={testID ? `${testID}-next` : undefined}
|
|
98
|
+
variant="ghost"
|
|
99
|
+
>
|
|
100
|
+
{nextLabel}
|
|
101
|
+
</Button>
|
|
102
|
+
{showFirstLast ? (
|
|
103
|
+
<Button
|
|
104
|
+
disabled={navigationDisabled || state.currentPage === state.pageCount}
|
|
105
|
+
interactionPolicy={interactionPolicy}
|
|
106
|
+
onPress={() => changePage(state.pageCount)}
|
|
107
|
+
size="s"
|
|
108
|
+
testID={testID ? `${testID}-last` : undefined}
|
|
109
|
+
variant="ghost"
|
|
110
|
+
>
|
|
111
|
+
{lastLabel}
|
|
112
|
+
</Button>
|
|
113
|
+
) : null}
|
|
114
|
+
</Stack>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ZoraComponentMeta } from '../../metadata/types';
|
|
2
|
+
|
|
3
|
+
export const paginationMeta = {
|
|
4
|
+
name: 'Pagination',
|
|
5
|
+
category: 'component',
|
|
6
|
+
directManifestNode: true,
|
|
7
|
+
allowedChildren: [],
|
|
8
|
+
description: 'Navigates between pages of a finite result set without changing app routes.',
|
|
9
|
+
blueprint: {
|
|
10
|
+
label: 'Pagination',
|
|
11
|
+
defaultProps: { boundaryCount: 1, compact: false, page: 1, pageCount: 10, siblingCount: 1 },
|
|
12
|
+
},
|
|
13
|
+
bindings: {
|
|
14
|
+
props: {
|
|
15
|
+
page: {
|
|
16
|
+
label: 'Page',
|
|
17
|
+
description: 'Current one-based page.',
|
|
18
|
+
value: { type: 'number' },
|
|
19
|
+
acceptsFallback: true,
|
|
20
|
+
acceptsTransforms: true,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
events: {
|
|
24
|
+
pageChange: {
|
|
25
|
+
label: 'Page change',
|
|
26
|
+
description: 'Runs when a new page is requested.',
|
|
27
|
+
payload: {
|
|
28
|
+
eventType: 'pagination.pageChange',
|
|
29
|
+
fields: [{ path: 'page', type: 'number', label: 'Page' }],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
events: {
|
|
35
|
+
pageChange: {
|
|
36
|
+
label: 'Page change',
|
|
37
|
+
eventType: 'pagination.pageChange',
|
|
38
|
+
payloadFields: [{ path: 'page', type: 'number', label: 'Page' }],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
props: {
|
|
42
|
+
page: { type: 'number', category: 'State', label: 'Page', default: 1 },
|
|
43
|
+
pageCount: { type: 'number', category: 'Data', label: 'Page count', default: 10 },
|
|
44
|
+
siblingCount: { type: 'number', category: 'Layout', label: 'Sibling count', default: 1 },
|
|
45
|
+
boundaryCount: { type: 'number', category: 'Layout', label: 'Boundary count', default: 1 },
|
|
46
|
+
showFirstLast: { type: 'boolean', category: 'Behavior', label: 'Show first/last' },
|
|
47
|
+
compact: { type: 'boolean', category: 'Layout', label: 'Compact', default: false },
|
|
48
|
+
disabled: { type: 'boolean', category: 'State', label: 'Disabled' },
|
|
49
|
+
previousLabel: { type: 'string', category: 'Content', label: 'Previous label' },
|
|
50
|
+
nextLabel: { type: 'string', category: 'Content', label: 'Next label' },
|
|
51
|
+
firstLabel: { type: 'string', category: 'Content', label: 'First label' },
|
|
52
|
+
lastLabel: { type: 'string', category: 'Content', label: 'Last label' },
|
|
53
|
+
},
|
|
54
|
+
} as const satisfies ZoraComponentMeta;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*** Clamps a requested pagination page to the valid one-based page range. */
|
|
2
|
+
export function resolvePaginationPage(value: number, pageCount: number): number {
|
|
3
|
+
if (!Number.isFinite(value)) return 1;
|
|
4
|
+
|
|
5
|
+
return Math.min(Math.max(Math.trunc(value), 1), Math.max(pageCount, 1));
|
|
6
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import { resolvePaginationState } from './resolvePaginationState';
|
|
4
|
+
|
|
5
|
+
describe('resolvePaginationState', () => {
|
|
6
|
+
it('inserts ellipses between boundaries and siblings', () => {
|
|
7
|
+
expect(
|
|
8
|
+
resolvePaginationState({
|
|
9
|
+
boundaryCount: 1,
|
|
10
|
+
compact: false,
|
|
11
|
+
page: 5,
|
|
12
|
+
pageCount: 10,
|
|
13
|
+
siblingCount: 1,
|
|
14
|
+
}).items,
|
|
15
|
+
).toEqual([1, 'ellipsis', 4, 5, 6, 'ellipsis', 10]);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('returns only the active page in compact mode', () => {
|
|
19
|
+
expect(
|
|
20
|
+
resolvePaginationState({
|
|
21
|
+
boundaryCount: 1,
|
|
22
|
+
compact: true,
|
|
23
|
+
page: 3,
|
|
24
|
+
pageCount: 8,
|
|
25
|
+
siblingCount: 1,
|
|
26
|
+
}).items,
|
|
27
|
+
).toEqual([3]);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { resolvePaginationPage } from './resolvePaginationPage';
|
|
2
|
+
|
|
3
|
+
/*** Normalizes pagination input and resolves visible page and ellipsis items. */
|
|
4
|
+
export function resolvePaginationState({
|
|
5
|
+
page,
|
|
6
|
+
pageCount,
|
|
7
|
+
siblingCount,
|
|
8
|
+
boundaryCount,
|
|
9
|
+
compact,
|
|
10
|
+
}: PaginationStateInput): PaginationState {
|
|
11
|
+
const normalizedPageCount = Math.max(0, Math.trunc(Number.isFinite(pageCount) ? pageCount : 0));
|
|
12
|
+
const currentPage = resolvePaginationPage(page, normalizedPageCount);
|
|
13
|
+
const safeSiblingCount = normalizeCount(siblingCount, 1);
|
|
14
|
+
const safeBoundaryCount = normalizeCount(boundaryCount, 1);
|
|
15
|
+
|
|
16
|
+
if (normalizedPageCount <= 0) {
|
|
17
|
+
return { currentPage, items: [], pageCount: normalizedPageCount };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (compact) {
|
|
21
|
+
return { currentPage, items: [currentPage], pageCount: normalizedPageCount };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const boundaries = createRange(1, Math.min(safeBoundaryCount, normalizedPageCount));
|
|
25
|
+
const trailingBoundaries = createRange(
|
|
26
|
+
Math.max(normalizedPageCount - safeBoundaryCount + 1, 1),
|
|
27
|
+
normalizedPageCount,
|
|
28
|
+
);
|
|
29
|
+
const siblings = createRange(
|
|
30
|
+
Math.max(currentPage - safeSiblingCount, 1),
|
|
31
|
+
Math.min(currentPage + safeSiblingCount, normalizedPageCount),
|
|
32
|
+
);
|
|
33
|
+
const pages = [...new Set([...boundaries, ...siblings, ...trailingBoundaries])].sort(
|
|
34
|
+
(left, right) => left - right,
|
|
35
|
+
);
|
|
36
|
+
const items = pages.flatMap<PaginationItem>((nextPage, index) => {
|
|
37
|
+
const previousPage = index > 0 ? pages.at(index - 1) : undefined;
|
|
38
|
+
return previousPage !== undefined && nextPage - previousPage > 1
|
|
39
|
+
? ['ellipsis', nextPage]
|
|
40
|
+
: [nextPage];
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return { currentPage, items, pageCount: normalizedPageCount };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type PaginationItem = number | 'ellipsis';
|
|
47
|
+
|
|
48
|
+
interface PaginationStateInput {
|
|
49
|
+
page: number;
|
|
50
|
+
pageCount: number;
|
|
51
|
+
siblingCount: number | undefined;
|
|
52
|
+
boundaryCount: number | undefined;
|
|
53
|
+
compact: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface PaginationState {
|
|
57
|
+
currentPage: number;
|
|
58
|
+
pageCount: number;
|
|
59
|
+
items: readonly PaginationItem[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/*** Creates an inclusive numeric range for pagination boundaries and siblings. */
|
|
63
|
+
function createRange(start: number, end: number): number[] {
|
|
64
|
+
return end < start ? [] : Array.from({ length: end - start + 1 }, (_, index) => start + index);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/*** Normalizes optional pagination counts to finite non-negative integers. */
|
|
68
|
+
function normalizeCount(value: number | undefined, fallback: number): number {
|
|
69
|
+
return value === undefined || !Number.isFinite(value) ? fallback : Math.max(0, Math.trunc(value));
|
|
70
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PopoverMenu as SurfacePopoverMenu,
|
|
3
|
+
type PopoverMenuAction as SurfacePopoverMenuAction,
|
|
4
|
+
} from '@ankhorage/surface';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { resolveIconSize } from '../../../../internal/recipes';
|
|
8
|
+
import { useZoraTheme } from '../../../../theme/useZoraTheme';
|
|
9
|
+
import { withZoraThemeScope } from '../../../../theme/withZoraThemeScope';
|
|
10
|
+
import type { PopoverMenuAction, PopoverMenuProps } from '../../../../types/popover-menu';
|
|
11
|
+
import { Icon } from '../../../icon/public';
|
|
12
|
+
import { Box } from '../../../layout/public';
|
|
13
|
+
|
|
14
|
+
/*** Presents a ZORA-styled action list through the Surface PopoverMenu capability. */
|
|
15
|
+
export const PopoverMenu = withZoraThemeScope(PopoverMenuInner);
|
|
16
|
+
|
|
17
|
+
/*** Maps ZORA action presentation into the Surface action-menu boundary. */
|
|
18
|
+
function PopoverMenuInner({
|
|
19
|
+
themeId: _themeId,
|
|
20
|
+
mode: _mode,
|
|
21
|
+
actions,
|
|
22
|
+
onDismiss,
|
|
23
|
+
...props
|
|
24
|
+
}: PopoverMenuProps) {
|
|
25
|
+
const { theme } = useZoraTheme();
|
|
26
|
+
const iconColor = theme.semantics.content.muted;
|
|
27
|
+
const surfaceActions = React.useMemo(
|
|
28
|
+
() => actions.map((action) => toSurfaceAction(action, iconColor)),
|
|
29
|
+
[actions, iconColor],
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return <SurfacePopoverMenu {...props} actions={surfaceActions} dismiss={onDismiss} />;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/*** Maps one ZORA PopoverMenu action to the Surface action contract. */
|
|
36
|
+
function toSurfaceAction(action: PopoverMenuAction, iconColor: string): SurfacePopoverMenuAction {
|
|
37
|
+
return {
|
|
38
|
+
activate: action.onPress,
|
|
39
|
+
description: action.description,
|
|
40
|
+
disabled: action.disabled,
|
|
41
|
+
id: action.id,
|
|
42
|
+
intent: action.intent,
|
|
43
|
+
leading: renderActionLeading(action, iconColor),
|
|
44
|
+
selected: action.selected,
|
|
45
|
+
title: action.title,
|
|
46
|
+
trailing: renderActionTrailing(action),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/*** Resolves explicit leading content or the configured action icon. */
|
|
51
|
+
function renderActionLeading(action: PopoverMenuAction, iconColor: string): React.ReactNode {
|
|
52
|
+
if (action.leading !== undefined) return action.leading;
|
|
53
|
+
if (action.icon === undefined) return undefined;
|
|
54
|
+
return <Icon {...action.icon} color={iconColor} size={resolveIconSize('s')} />;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/*** Wraps optional trailing action content in the ZORA layout boundary. */
|
|
58
|
+
function renderActionTrailing(action: PopoverMenuAction): React.ReactNode {
|
|
59
|
+
return action.trailing === undefined ? undefined : <Box>{action.trailing}</Box>;
|
|
60
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ZoraComponentMeta } from '../../metadata';
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
name: '
|
|
3
|
+
export const popoverMenuMeta = {
|
|
4
|
+
name: 'PopoverMenu',
|
|
5
5
|
category: 'component',
|
|
6
6
|
directManifestNode: false,
|
|
7
7
|
allowedChildren: [],
|
|
8
|
-
note: '
|
|
8
|
+
note: 'Code-facing anchored action menu; the trigger is a render prop and is not serialized as a direct manifest node.',
|
|
9
9
|
props: {},
|
|
10
10
|
} as const satisfies ZoraComponentMeta;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
test('PopoverMenu composes the released Surface PopoverMenu capability', async () => {
|
|
4
|
+
const source = await Bun.file(
|
|
5
|
+
'src/features/popover-menu/adapters/inbound/PopoverMenu.tsx',
|
|
6
|
+
).text();
|
|
7
|
+
|
|
8
|
+
expect(source).toContain('PopoverMenu as SurfacePopoverMenu');
|
|
9
|
+
expect(source).toContain('<SurfacePopoverMenu');
|
|
10
|
+
expect(source).not.toContain('DropdownMenu');
|
|
11
|
+
});
|