From 60a796ea48b17a4e8829b8782aaddb569534c7c4 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 22 May 2023 03:59:53 +1000 Subject: [PATCH] feat(pagination-nav): add `tooltipPosition` prop (#1733) * Add `tooltipPosition` to `PaginationNav` per #1656 * Rebuild test * Update description in documentation Co-authored-by: Enrico Sacchetti * chore: update docs --------- Co-authored-by: Samuel Janda Co-authored-by: Enrico Sacchetti Co-authored-by: Enrico Sacchetti --- COMPONENT_INDEX.md | 17 +++++++++-------- docs/src/COMPONENT_API.json | 12 ++++++++++++ docs/src/pages/components/PaginationNav.svx | 8 +++++++- src/PaginationNav/PaginationNav.svelte | 18 ++++++++++++++++-- types/PaginationNav/PaginationNav.svelte.d.ts | 6 ++++++ 5 files changed, 50 insertions(+), 11 deletions(-) diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 8120fca4..e41dfdc5 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -2696,14 +2696,15 @@ None. ### Props -| Prop name | Required | Kind | Reactive | Type | Default value | Description | -| :----------- | :------- | :--------------- | :------- | -------------------- | ---------------------------- | ----------------------------------------- | -| page | No | let | Yes | number | 1 | Specify the current page index | -| total | No | let | No | number | 10 | Specify the total number of pages | -| shown | No | let | No | number | 10 | Specify the total number of pages to show | -| loop | No | let | No | boolean | false | Set to `true` to loop the navigation | -| forwardText | No | let | No | string | "Next page" | Specify the forward button text | -| backwardText | No | let | No | string | "Previous page" | Specify the backward button text | +| Prop name | Required | Kind | Reactive | Type | Default value | Description | +| :-------------- | :------- | :--------------- | :------- | ------------------------------------------------------------------------------------------------ | ---------------------------- | ------------------------------------------------------------------- | +| page | No | let | Yes | number | 1 | Specify the current page index | +| total | No | let | No | number | 10 | Specify the total number of pages | +| shown | No | let | No | number | 10 | Specify the total number of pages to show | +| loop | No | let | No | boolean | false | Set to `true` to loop the navigation | +| forwardText | No | let | No | string | "Next page" | Specify the forward button text | +| backwardText | No | let | No | string | "Previous page" | Specify the backward button text | +| tooltipPosition | No | let | No | "top" | "right" | "bottom" | "left" | "outside" | "inside" | "bottom" | Set the position of the tooltip relative to the pagination buttons. | ### Slots diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index 907b19bd..40c92155 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -8520,6 +8520,18 @@ "isRequired": false, "constant": false, "reactive": false + }, + { + "name": "tooltipPosition", + "kind": "let", + "description": "Set the position of the tooltip relative to the pagination buttons.", + "type": "\"top\" | \"right\" | \"bottom\" | \"left\" | \"outside\" | \"inside\"", + "value": "\"bottom\"", + "isFunction": false, + "isFunctionDeclaration": false, + "isRequired": false, + "constant": false, + "reactive": false } ], "moduleExports": [], diff --git a/docs/src/pages/components/PaginationNav.svx b/docs/src/pages/components/PaginationNav.svx index 690921fc..e279d4d1 100644 --- a/docs/src/pages/components/PaginationNav.svx +++ b/docs/src/pages/components/PaginationNav.svx @@ -42,4 +42,10 @@ Use the `forwardText` and `backwardText` props to customize the button text. \ No newline at end of file +/> + +## Tooltip Position + +Use the `tooltipPosition` prop to change the alignment of the tooltip. + + \ No newline at end of file diff --git a/src/PaginationNav/PaginationNav.svelte b/src/PaginationNav/PaginationNav.svelte index 4e31aa10..adf06929 100644 --- a/src/PaginationNav/PaginationNav.svelte +++ b/src/PaginationNav/PaginationNav.svelte @@ -23,6 +23,12 @@ /** Specify the backward button text */ export let backwardText = "Previous page"; + /** + * Set the position of the tooltip relative to the pagination buttons. + * @type {"top" | "right" | "bottom" | "left" | "outside" | "inside"} + */ + export let tooltipPosition = "bottom"; + import { createEventDispatcher } from "svelte"; import CaretLeft from "../icons/CaretLeft.svelte"; import CaretRight from "../icons/CaretRight.svelte"; @@ -76,7 +82,11 @@