diff --git a/apps/docs/src/data/components/pagination.data.ts b/apps/docs/src/data/components/pagination.data.ts index 2ff823a91..ca3ba9d10 100644 --- a/apps/docs/src/data/components/pagination.data.ts +++ b/apps/docs/src/data/components/pagination.data.ts @@ -2,6 +2,24 @@ import type {BvnComponentProps} from 'bootstrap-vue-next' import type {ComponentReference, PropertyReference} from '../../types' import {buildCommonProps, pick} from '../../utils' +const sharedScope = [ + { + prop: 'disabled', + type: 'Boolean', + description: 'Will be `true` if this button is disabled (non-clickable)', + }, + { + prop: 'index', + type: 'Number', + description: 'Page number (indexed from `0` to `numberOfPages - 1`)', + }, + { + prop: 'page', + type: 'Number', + description: 'Page number (from `1` to `numberOfPages`)', + }, +] + export default { load: (): ComponentReference[] => [ { @@ -26,17 +44,17 @@ export default { firstClass: { type: 'ClassValue', default: undefined, - description: "Class(es) to apply to the 'Go to first page' button", + description: 'Class(es) to apply to the go to first page button', }, firstNumber: { type: 'boolean', default: false, - description: 'Display first page number instead of Goto First button', + description: 'Display first page number instead of go to first page button', }, firstText: { type: 'string', default: '\u00AB', - description: 'Content to place in the goto first page button', + description: 'Content to place in the go to first page button', }, hideEllipsis: { type: 'boolean', @@ -46,52 +64,52 @@ export default { hideGotoEndButtons: { type: 'boolean', default: false, - description: 'Hides the goto first and goto last page buttons', + description: 'Hides the go to first and go to last page buttons', }, labelFirstPage: { type: 'string', default: 'Go to first page', description: - "Value to place in the 'aria-label' attribute of the goto first page button", + "Value to place in the 'aria-label' attribute of the go to first page button", }, labelLastPage: { type: 'string', default: 'Go to last page', description: - "Value to place in the 'aria-label' attribute of the goto last page button", + "Value to place in the 'aria-label' attribute of the go to last page button", }, labelNextPage: { type: 'string', default: 'Go to next page', description: - "Value to place in the 'aria-label' attribute of the goto next page button", + "Value to place in the 'aria-label' attribute of the go to next page button", }, labelPage: { type: 'string', default: 'Go to page', description: - "Value to place in the 'aria-label' attribute of the goto page button. Page number will be prepended automatically", + "Value to place in the 'aria-label' attribute of the go to page button. Page number will be appended automatically", }, labelPrevPage: { type: 'string', default: 'Go to previous page', description: - "Value to place in the 'aria-label' attribute of the goto previous page button", + "Value to place in the 'aria-label' attribute of the go to previous page button", }, lastClass: { type: 'ClassValue', default: undefined, - description: "Class(es) to apply to the 'Go to last page' button", + description: 'Class(es) to apply to the go to last page button', }, lastNumber: { type: 'boolean', default: false, - description: 'Display last page number instead of Goto Last button', + description: 'Display last page number instead of go to Last button', }, lastText: { type: 'string', default: '\u00BB', - description: 'Content to place in the goto last page button', + description: 'Content to place in the go to last page button', }, limit: { type: 'Numberish', @@ -107,17 +125,17 @@ export default { nextClass: { type: 'ClassValue', default: undefined, - description: "Class(es) to apply to the 'Go to next page' button", + description: 'Class(es) to apply to the go to next page button', }, nextText: { type: 'string', default: '\u203A', - description: 'Content to place in the goto next page button', + description: 'Content to place in the go to next page button', }, pageClass: { type: 'ClassValue', default: undefined, - description: "Class(es) to apply to the 'Go to page #' buttons", + description: 'Class(es) to apply to the go to page # buttons', }, perPage: { type: 'Numberish', @@ -137,7 +155,7 @@ export default { prevText: { type: 'string', default: '\u2039', - description: 'Content to place in the goto previous page button', + description: 'Content to place in the go to previous page button', }, totalRows: { type: 'Numberish', @@ -195,71 +213,24 @@ export default { }, { name: 'first-text', - description: "The 'Go to first page' button content", - scope: [ - { - prop: 'disabled', - type: 'Boolean', - description: 'Will be `true` if this button is disabled (non-clickable)', - }, - { - prop: 'index', - type: 'Number', - description: 'Page number (indexed from `0` to `numberOfPages - 1`)', - }, - { - prop: 'page', - type: 'Number', - description: 'Page number (from `1` to `numberOfPages`)', - }, - ], + description: 'The go to first page button content', + scope: sharedScope, }, { name: 'last-text', - description: "The 'Go to last page' button content", - scope: [ - { - prop: 'disabled', - type: 'Boolean', - description: 'Will be `true` if this button is disabled (non-clickable)', - }, - { - prop: 'index', - type: 'Number', - description: 'Page number (indexed from `0` to `numberOfPages - 1`)', - }, - { - prop: 'page', - type: 'Number', - description: 'Page number (from `1` to `numberOfPages`)', - }, - ], + description: 'The go to last page button content', + scope: sharedScope, }, { name: 'next-text', - description: "The 'Go to next page' button content", - scope: [ - { - prop: 'disabled', - type: 'Boolean', - description: 'Will be `true` if this button is disabled (non-clickable)', - }, - { - prop: 'index', - type: 'Number', - description: 'Page number (indexed from `0` to `numberOfPages - 1`)', - }, - { - prop: 'page', - type: 'Number', - description: 'Page number (from `1` to `numberOfPages`)', - }, - ], + description: 'The go to next page button content', + scope: sharedScope, }, { name: 'page', description: 'Page number button content', scope: [ + ...sharedScope, { prop: 'active', type: 'Boolean', @@ -270,43 +241,12 @@ export default { type: 'String', description: 'Default button content', }, - { - prop: 'disabled', - type: 'Boolean', - description: 'Will be `true` if this button is disabled (non-clickable)', - }, - { - prop: 'index', - type: 'Number', - description: 'Page number (indexed from `0` to `numberOfPages - 1`)', - }, - { - prop: 'page', - type: 'Number', - description: 'Page number (from `1` to `numberOfPages`)', - }, ], }, { name: 'prev-text', - description: "The 'Go to previous page' button content", - scope: [ - { - prop: 'disabled', - type: 'Boolean', - description: 'Will be `true` if this button is disabled (non-clickable)', - }, - { - prop: 'index', - type: 'Number', - description: 'Page number (indexed from `0` to `numberOfPages - 1`)', - }, - { - prop: 'page', - type: 'Number', - description: 'Page number (from `1` to `numberOfPages`)', - }, - ], + description: 'The go to previous page button content', + scope: sharedScope, }, ], }, diff --git a/apps/docs/src/docs/components/demo/PaginationAlignment.vue b/apps/docs/src/docs/components/demo/PaginationAlignment.vue new file mode 100644 index 000000000..54e10ea4c --- /dev/null +++ b/apps/docs/src/docs/components/demo/PaginationAlignment.vue @@ -0,0 +1,24 @@ + + diff --git a/apps/docs/src/docs/components/demo/PaginationButtonContent.vue b/apps/docs/src/docs/components/demo/PaginationButtonContent.vue new file mode 100644 index 000000000..b9d5c8a95 --- /dev/null +++ b/apps/docs/src/docs/components/demo/PaginationButtonContent.vue @@ -0,0 +1,50 @@ + + + diff --git a/apps/docs/src/docs/components/demo/PaginationButtonSize.vue b/apps/docs/src/docs/components/demo/PaginationButtonSize.vue new file mode 100644 index 000000000..5732add61 --- /dev/null +++ b/apps/docs/src/docs/components/demo/PaginationButtonSize.vue @@ -0,0 +1,17 @@ + + + diff --git a/apps/docs/src/docs/components/demo/PaginationFirstLast.vue b/apps/docs/src/docs/components/demo/PaginationFirstLast.vue new file mode 100644 index 000000000..6167ab53f --- /dev/null +++ b/apps/docs/src/docs/components/demo/PaginationFirstLast.vue @@ -0,0 +1,24 @@ + + + diff --git a/apps/docs/src/docs/components/demo/PaginationOverview.vue b/apps/docs/src/docs/components/demo/PaginationOverview.vue new file mode 100644 index 000000000..c66cf65a4 --- /dev/null +++ b/apps/docs/src/docs/components/demo/PaginationOverview.vue @@ -0,0 +1,44 @@ + + + diff --git a/apps/docs/src/docs/components/demo/PaginationPillStyle.vue b/apps/docs/src/docs/components/demo/PaginationPillStyle.vue new file mode 100644 index 000000000..1b181c9a3 --- /dev/null +++ b/apps/docs/src/docs/components/demo/PaginationPillStyle.vue @@ -0,0 +1,17 @@ + + + diff --git a/apps/docs/src/docs/components/pagination.md b/apps/docs/src/docs/components/pagination.md index b055d9566..ee3169272 100644 --- a/apps/docs/src/docs/components/pagination.md +++ b/apps/docs/src/docs/components/pagination.md @@ -13,6 +13,16 @@ Quick first, previous, next, last, and page buttons for pagination control of an +## Overview + +`` is a custom input component that provides a current page number input control. The +value should be bound via `v-model` in your app. Page numbers are indexed from 1. The number of +pages is computed from the provided prop values for `total-rows` and `per-page`. + +**Example Usage with ``:** + +<<< DEMO ./demo/PaginationOverview.vue + ## Customizing appearance `BPagination` supports several props/slots that allow you to customize the appearance. All @@ -32,6 +42,8 @@ The showing of the `ellipsis` can be optionally disabled by setting the `hide-el #### Small screen support + + On smaller screens (i.e. mobile), some of the `BPagination` buttons will be hidden to minimize the potential of the pagination interface wrapping onto multiple lines: @@ -43,102 +55,9 @@ _prev_, _next_, and _last_ buttons. ### Button content -For a full list of all available slots see the [Slots](#comp-ref-b-pagination-slots) section below. - - - - - - - - - - - - - - - - Current page : {{ ex1CurrentPage }} - - +<<< DEMO ./demo/PaginationButtonContent.vue The slot `page` is always scoped, while the slots `first-text`, `prev-text`, `next-text` and `last-text` are optionally scoped. The `ellipsis-text` slot is not scoped. @@ -167,145 +86,20 @@ The slot `page` is always scoped, while the slots `first-text`, `prev-text`, `ne If you prefer to have buttons with the first and last page number to go to the corresponding page, use the `first-number` and `last-number` props. - -
-
Goto first button number
- -
-
-
Goto last button number
- -
-
-
Goto first and last button number
- -
- -
+<<< DEMO ./demo/PaginationFirstLast.vue ### Button size Optionally change from the default button size by setting the `size` prop to either `'sm'` for smaller buttons or `'lg'` for larger buttons. - -
-
Small
- -
-
-
Default
- -
-
-
Large
- -
- -
+<<< DEMO ./demo/PaginationButtonSize.vue ### Pill style Easily switch to pill style buttons by setting the `pills` prop. - -
-
Small Pills
- -
-
-
Default Pills
- -
-
-
Large Pills
- -
- -
+<<< DEMO ./demo/PaginationPillStyle.vue **Note:** Pill styling requires bootstrap-vue-next's custom CSS/SCSS. @@ -314,45 +108,7 @@ const ex4Rows = ref(100) By default, the pagination component is left aligned. Change the alignment to `center`, `end` or `fill` by setting the prop `align` to the appropriate value. - -
-
Left alignment (default)
- -
-
-
Center alignment
- -
-
-
Right (end) alignment
- -
-
-
Fill alignment
- -
- -
+<<< DEMO ./demo/PaginationAlignment.vue ## Preventing a page from being selected @@ -380,9 +136,9 @@ know what component is being updated/controlled. ### ARIA labels -`BPagination` provides various `*-label-*` props which are used to set the `aria-label` -attributes on the various elements within the component, which will help users of assistive -technology. +`BPagination` provides various `label-*` props which are used to set the `aria-label` +attributes on the various elements within the component as well as the common `aria-label` prop +on the outer container, which will help users of assistive technology. | Prop | `aria-label` content default | | ------------------ | ------------------------------------------------------- | @@ -401,30 +157,10 @@ recommended unless the content of the button textually conveys its purpose. ### Keyboard navigation support + + diff --git a/apps/docs/src/docs/migration-guide.md b/apps/docs/src/docs/migration-guide.md index e2c18512b..13f49555f 100644 --- a/apps/docs/src/docs/migration-guide.md +++ b/apps/docs/src/docs/migration-guide.md @@ -390,6 +390,14 @@ const confirmBox = async () => { The `show` and `confirm` `props` object accespts all of the properties that are defined on [BModal](/docs/components/modal#component-reference) excpet for `modelValue`. +## BPagination + +Keyboard Navigation and Small Screen Support. + +## BPaginationNav + +This component is not yet implemented +