webcoreui 0.4.1 → 0.6.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.
Files changed (92) hide show
  1. package/README.md +237 -227
  2. package/astro.d.ts +115 -62
  3. package/astro.js +14 -0
  4. package/components/Avatar/Avatar.astro +9 -2
  5. package/components/Avatar/Avatar.svelte +3 -1
  6. package/components/Avatar/Avatar.tsx +4 -2
  7. package/components/Avatar/avatar.ts +1 -0
  8. package/components/Badge/Badge.astro +4 -0
  9. package/components/Badge/Badge.svelte +5 -1
  10. package/components/Badge/Badge.tsx +4 -0
  11. package/components/Badge/badge.module.scss +8 -0
  12. package/components/Badge/badge.ts +7 -3
  13. package/components/Breadcrumb/Breadcrumb.astro +51 -0
  14. package/components/Breadcrumb/Breadcrumb.svelte +45 -0
  15. package/components/Breadcrumb/Breadcrumb.tsx +51 -0
  16. package/components/Breadcrumb/breadcrumb.module.scss +26 -0
  17. package/components/Breadcrumb/breadcrumb.ts +12 -0
  18. package/components/Button/button.module.scss +6 -1
  19. package/components/Button/button.ts +13 -3
  20. package/components/Carousel/Carousel.astro +198 -0
  21. package/components/Carousel/Carousel.svelte +161 -0
  22. package/components/Carousel/Carousel.tsx +172 -0
  23. package/components/Carousel/carousel.module.scss +58 -0
  24. package/components/Carousel/carousel.ts +26 -0
  25. package/components/Checkbox/checkbox.ts +4 -2
  26. package/components/DataTable/DataTable.astro +332 -0
  27. package/components/DataTable/DataTable.svelte +272 -0
  28. package/components/DataTable/DataTable.tsx +287 -0
  29. package/components/DataTable/datatable.module.scss +102 -0
  30. package/components/DataTable/datatable.ts +41 -0
  31. package/components/Footer/Footer.astro +91 -0
  32. package/components/Footer/Footer.svelte +94 -0
  33. package/components/Footer/Footer.tsx +107 -0
  34. package/components/Footer/footer.module.scss +61 -0
  35. package/components/Footer/footer.ts +29 -0
  36. package/components/Icon/Icon.svelte +1 -1
  37. package/components/Icon/icon.ts +18 -1
  38. package/components/Icon/map.ts +14 -0
  39. package/components/Input/input.module.scss +6 -0
  40. package/components/List/List.astro +1 -1
  41. package/components/List/List.svelte +1 -1
  42. package/components/List/List.tsx +1 -2
  43. package/components/List/list.ts +3 -1
  44. package/components/Masonry/Masonry.astro +54 -0
  45. package/components/Masonry/Masonry.svelte +54 -0
  46. package/components/Masonry/Masonry.tsx +62 -0
  47. package/components/Masonry/masonry.module.scss +18 -0
  48. package/components/Masonry/masonry.ts +36 -0
  49. package/components/Menu/Menu.astro +1 -1
  50. package/components/Menu/Menu.svelte +1 -1
  51. package/components/Menu/Menu.tsx +1 -1
  52. package/components/Menu/menu.ts +4 -2
  53. package/components/Modal/Modal.astro +2 -0
  54. package/components/Modal/Modal.svelte +2 -0
  55. package/components/Modal/Modal.tsx +2 -0
  56. package/components/Modal/modal.module.scss +29 -22
  57. package/components/Modal/modal.ts +1 -0
  58. package/components/Pagination/Pagination.astro +189 -0
  59. package/components/Pagination/Pagination.svelte +144 -0
  60. package/components/Pagination/Pagination.tsx +162 -0
  61. package/components/Pagination/pagination.module.scss +49 -0
  62. package/components/Pagination/pagination.ts +35 -0
  63. package/components/Rating/rating.ts +3 -1
  64. package/components/Select/Select.astro +8 -4
  65. package/components/Select/Select.svelte +15 -6
  66. package/components/Select/Select.tsx +15 -8
  67. package/components/Select/select.ts +7 -2
  68. package/components/Sidebar/Sidebar.astro +61 -0
  69. package/components/Sidebar/Sidebar.svelte +50 -0
  70. package/components/Sidebar/Sidebar.tsx +58 -0
  71. package/components/Sidebar/sidebar.module.scss +43 -0
  72. package/components/Sidebar/sidebar.ts +21 -0
  73. package/components/Switch/switch.ts +4 -2
  74. package/components/Table/Table.svelte +1 -1
  75. package/components/Table/table.ts +1 -1
  76. package/icons/arrow-left.svg +3 -0
  77. package/icons/arrow-right.svg +3 -0
  78. package/icons/circle-close.svg +3 -0
  79. package/icons/components.svg +3 -0
  80. package/icons/file.svg +3 -0
  81. package/icons/home.svg +4 -0
  82. package/icons/order.svg +3 -0
  83. package/icons/sun.svg +1 -1
  84. package/icons.d.ts +7 -0
  85. package/icons.js +7 -0
  86. package/index.d.ts +6 -6
  87. package/package.json +8 -10
  88. package/react.d.ts +115 -62
  89. package/react.js +14 -0
  90. package/scss/resets.scss +27 -1
  91. package/svelte.d.ts +116 -62
  92. package/svelte.js +14 -0
@@ -28,28 +28,11 @@
28
28
  }
29
29
  }
30
30
 
31
- .close {
32
- @include position(absolute, t10px, r10px);
33
- @include spacing(p-xs);
34
-
35
- svg {
36
- @include size(10px);
37
- }
38
- }
39
-
40
- .title {
41
- @include typography(lg);
42
- @include spacing(mb-xs);
43
- @include layout(flex, v-center, xs);
44
-
45
- svg {
46
- @include size(20px);
47
- }
48
- }
49
-
50
- .subTitle {
51
- @include typography(primary-20);
52
- @include spacing(mb-xs);
31
+ &.transparent {
32
+ @include border(0);
33
+ @include spacing(p0);
34
+ @include size('wfit-content');
35
+ @include background(transparent);
53
36
  }
54
37
 
55
38
  &.info {
@@ -83,6 +66,30 @@
83
66
  @include typography(alert);
84
67
  }
85
68
  }
69
+
70
+ .close {
71
+ @include position(absolute, t10px, r10px);
72
+ @include spacing(p-xs);
73
+
74
+ svg {
75
+ @include size(10px);
76
+ }
77
+ }
78
+
79
+ .title {
80
+ @include typography(lg);
81
+ @include spacing(mb-xs);
82
+ @include layout(flex, v-center, xs);
83
+
84
+ svg {
85
+ @include size(20px);
86
+ }
87
+ }
88
+
89
+ .subTitle {
90
+ @include typography(primary-20);
91
+ @include spacing(mb-xs);
92
+ }
86
93
  }
87
94
 
88
95
  .overlay {
@@ -4,6 +4,7 @@ export type ModalProps = {
4
4
  showCloseIcon?: boolean
5
5
  closeOnEsc?: boolean
6
6
  closeOnOverlay?: boolean
7
+ transparent?: boolean
7
8
  id?: string
8
9
  className?: string
9
10
  theme?: 'info'
@@ -0,0 +1,189 @@
1
+ ---
2
+ import type { PaginationProps } from './pagination'
3
+
4
+ import Button from '../Button/Button.astro'
5
+
6
+ import ArrowLeft from '../../icons/arrow-left.svg?raw'
7
+ import ArrowRight from '../../icons/arrow-right.svg?raw'
8
+
9
+ import styles from './pagination.module.scss'
10
+
11
+ interface Props extends PaginationProps {}
12
+
13
+ const {
14
+ type,
15
+ showChevrons,
16
+ showDots,
17
+ disablePrevious,
18
+ disableNext,
19
+ previousLink,
20
+ nextLink,
21
+ previousPageLabel = 'Previous',
22
+ nextPageLabel = 'Next',
23
+ pages,
24
+ theme = 'outline',
25
+ totalPages,
26
+ currentPage,
27
+ className
28
+ } = Astro.props
29
+
30
+ const classes = [
31
+ styles.pagination,
32
+ theme !== 'outline' && (theme === null ? styles.primary : styles[theme]),
33
+ type === 'dots' && styles.dots,
34
+ className
35
+ ]
36
+
37
+ const calculatedCurrentPage = currentPage
38
+ || (pages?.findIndex(page => page.active) || -1) + 1
39
+ || 1
40
+
41
+ const calculatedTotalPages = totalPages
42
+ || pages?.length
43
+ || 0
44
+
45
+ const generatedPages = pages?.length
46
+ ? pages
47
+ : Array(totalPages || 0).fill(0).map((_, index) => ({
48
+ ...(index === 0 && { active: true }),
49
+ label: index + 1
50
+ }))
51
+ ---
52
+
53
+ <ul
54
+ class:list={classes}
55
+ data-id="w-pagination"
56
+ data-total-pages={calculatedTotalPages}
57
+ data-current-page={calculatedCurrentPage}
58
+ >
59
+ {type === 'dots' ? (
60
+ <Fragment>
61
+ {generatedPages?.map(page => (
62
+ <li>
63
+ <button
64
+ data-active={page.active ? 'true' : undefined}
65
+ data-page={page.label}
66
+ />
67
+ </li>
68
+ ))}
69
+ </Fragment>
70
+ ) : (
71
+ <li>
72
+ <Button
73
+ disabled={disablePrevious || (calculatedCurrentPage === 1 && !previousLink)}
74
+ href={!disablePrevious ? previousLink : undefined}
75
+ theme={theme}
76
+ data-page="prev"
77
+ >
78
+ {(showChevrons || type === 'arrows') && <Fragment set:html={ArrowLeft} />}
79
+ {type !== 'arrows' && previousPageLabel}
80
+ </Button>
81
+ </li>
82
+ <Fragment>
83
+ {type !== 'arrows' && pages?.slice(0, calculatedTotalPages)?.map((page, index) =>
84
+ <li>
85
+ <Button
86
+ href={page.link}
87
+ data-active={calculatedCurrentPage === index + 1 ? 'true' : null}
88
+ theme={theme}
89
+ data-page={page.label}
90
+ >
91
+ {page.label}
92
+ </Button>
93
+ </li>
94
+ )}
95
+ {showDots && (
96
+ <li>
97
+ <Button theme={theme} className={styles.inactive}>
98
+ ...
99
+ </Button>
100
+ </li>
101
+ )}
102
+ </Fragment>
103
+ <li>
104
+ <Button
105
+ disabled={disableNext || (calculatedCurrentPage === calculatedTotalPages && !nextLink)}
106
+ href={!disableNext ? nextLink : undefined}
107
+ theme={theme}
108
+ data-page="next"
109
+ >
110
+ {type !== 'arrows' && nextPageLabel}
111
+ {(showChevrons || type === 'arrows') && <Fragment set:html={ArrowRight} />}
112
+ </Button>
113
+ </li>
114
+ )}
115
+ </ul>
116
+
117
+ <script>
118
+ import { dispatch } from '../../utils/event'
119
+
120
+ const getCurrentPage = (pageElements: Element[], current: number, next: string) => {
121
+ if (next === 'prev') {
122
+ return current - 1
123
+ }
124
+
125
+ if (next === 'next') {
126
+ return current + 1
127
+ }
128
+
129
+ return pageElements?.findIndex(child => {
130
+ const button = child.children[0] as HTMLButtonElement
131
+
132
+ return button.dataset.page === next
133
+ }) + 1
134
+ }
135
+
136
+ const paginations = document.querySelectorAll('[data-id="w-pagination"]')
137
+
138
+ Array.from(paginations).forEach(element => {
139
+ const pagination = element as HTMLUListElement
140
+ const totalPages = Number(pagination.dataset.totalPages)
141
+ let currentPage = Number(pagination.dataset.currentPage)
142
+
143
+ element.addEventListener('click', event => {
144
+ const target = event.target as HTMLButtonElement
145
+ const navigated = target.nodeName === 'BUTTON'
146
+ && !target.dataset.active
147
+ && !target.disabled
148
+
149
+ if (navigated) {
150
+ const prevPageButton = element.querySelector('[data-page="prev"]') as HTMLButtonElement
151
+ const nextPageButton = element.querySelector('[data-page="next"]') as HTMLButtonElement
152
+ const currentPageButton = element.querySelector('[data-active]') as HTMLButtonElement
153
+
154
+ const pageElements = Array
155
+ .from(pagination.children)
156
+ .filter(child => {
157
+ const button = child.children[0] as HTMLButtonElement
158
+
159
+ return button.dataset.page && !['prev', 'next'].includes(button.dataset.page)
160
+ })
161
+
162
+ currentPage = getCurrentPage(pageElements, currentPage, target.dataset.page || '')
163
+ currentPageButton?.removeAttribute('data-active')
164
+
165
+ pagination.dataset.currentPage = String(currentPage)
166
+
167
+ const activeButton = pageElements
168
+ .find((_, index) => index + 1 === currentPage)
169
+ ?.children[0] as HTMLButtonElement
170
+
171
+ if (activeButton) {
172
+ activeButton.dataset.active = 'true'
173
+ }
174
+
175
+ if (prevPageButton && nextPageButton) {
176
+ prevPageButton.disabled = currentPage === 1
177
+ nextPageButton.disabled = currentPage === totalPages
178
+ }
179
+
180
+ dispatch('paginate', {
181
+ page: currentPage,
182
+ ...(activeButton?.dataset.page && { label: activeButton?.dataset.page }),
183
+ target: element,
184
+ trusted: event.isTrusted
185
+ })
186
+ }
187
+ })
188
+ })
189
+ </script>
@@ -0,0 +1,144 @@
1
+ <script lang="ts">
2
+ import type { SveltePaginationProps } from './pagination'
3
+
4
+ import Button from '../Button/Button.svelte'
5
+
6
+ import { classNames } from '../../utils/classNames'
7
+
8
+ import ArrowLeft from '../../icons/arrow-left.svg?raw'
9
+ import ArrowRight from '../../icons/arrow-right.svg?raw'
10
+
11
+ import styles from './pagination.module.scss'
12
+
13
+ export let type: SveltePaginationProps['type'] = null
14
+ export let showChevrons: SveltePaginationProps['showChevrons'] = false
15
+ export let showDots: SveltePaginationProps['showDots'] = false
16
+ export let disablePrevious: SveltePaginationProps['disablePrevious'] = false
17
+ export let disableNext: SveltePaginationProps['disableNext'] = false
18
+ export let previousLink: SveltePaginationProps['previousLink'] = ''
19
+ export let nextLink: SveltePaginationProps['nextLink'] = ''
20
+ export let previousPageLabel: SveltePaginationProps['previousPageLabel'] = 'Previous'
21
+ export let nextPageLabel: SveltePaginationProps['nextPageLabel'] = 'Next'
22
+ export let pages: SveltePaginationProps['pages'] = []
23
+ export let theme: SveltePaginationProps['theme'] = 'outline'
24
+ export let totalPages: SveltePaginationProps['totalPages'] = null
25
+ export let currentPage: SveltePaginationProps['currentPage'] = null
26
+ export let className: SveltePaginationProps['className'] = ''
27
+ export let onChange: SveltePaginationProps['onChange'] = () => {}
28
+
29
+ const classes = classNames([
30
+ styles.pagination,
31
+ theme !== 'outline' && (theme === null || theme === undefined ? styles.primary : styles[theme]),
32
+ type === 'dots' && styles.dots,
33
+ className
34
+ ])
35
+
36
+ const calculatedTotalPages = totalPages
37
+ || pages?.length
38
+ || 0
39
+
40
+ const generatedPages = pages?.length
41
+ ? pages
42
+ : Array(totalPages || 0).fill(0).map((_, index) => ({
43
+ ...(index === 0 && { active: true }),
44
+ label: index + 1
45
+ }))
46
+
47
+ const paginate = (to: string | number) => {
48
+ if (to === 'prev') {
49
+ calculatedCurrentPage = calculatedCurrentPage - 1
50
+ } else if (to === 'next') {
51
+ calculatedCurrentPage = calculatedCurrentPage + 1
52
+ } else {
53
+ calculatedCurrentPage = to as number
54
+ }
55
+
56
+ const label = pages?.[calculatedCurrentPage - 1]?.label
57
+
58
+ onChange?.({
59
+ page: calculatedCurrentPage,
60
+ ...(label && { label })
61
+ })
62
+ }
63
+
64
+ $: calculatedCurrentPage = currentPage
65
+ || (pages?.findIndex(page => page.active) || -1) + 1
66
+ || 1
67
+ </script>
68
+
69
+ <ul class={classes}>
70
+ {#if type === 'dots' && generatedPages?.length}
71
+ {#each generatedPages as _, index}
72
+ <li>
73
+ <button
74
+ data-active={calculatedCurrentPage === index + 1 ? 'true' : null}
75
+ on:click={calculatedCurrentPage !== index + 1
76
+ ? () => paginate(index + 1)
77
+ : null
78
+ }
79
+ />
80
+ </li>
81
+ {/each}
82
+ {:else}
83
+ <li>
84
+ <Button
85
+ disabled={(disablePrevious || (calculatedCurrentPage === 1 && !previousLink)) ? true : null}
86
+ href={!disablePrevious ? previousLink : undefined}
87
+ theme={theme}
88
+ onClick={!(disablePrevious || (calculatedCurrentPage === 1 && !previousLink))
89
+ ? () => paginate('prev')
90
+ : null
91
+ }
92
+ >
93
+ {#if showChevrons || type === 'arrows'}
94
+ {@html ArrowLeft}
95
+ {/if}
96
+ {#if type !== 'arrows'}
97
+ {previousPageLabel}
98
+ {/if}
99
+ </Button>
100
+ </li>
101
+ {#if type !== 'arrows' && pages?.length}
102
+ {#each pages?.slice(0, calculatedTotalPages) as page, index}
103
+ <li>
104
+ <Button
105
+ href={page.link}
106
+ data-active={calculatedCurrentPage === index + 1 ? 'true' : null}
107
+ theme={theme}
108
+ onClick={calculatedCurrentPage !== index + 1
109
+ ? () => paginate(index + 1)
110
+ : null
111
+ }
112
+ >
113
+ {page.label}
114
+ </Button>
115
+ </li>
116
+ {/each}
117
+ {/if}
118
+ {#if showDots}
119
+ <li>
120
+ <Button theme={theme} className={styles.inactive}>
121
+ ...
122
+ </Button>
123
+ </li>
124
+ {/if}
125
+ <li>
126
+ <Button
127
+ disabled={(disableNext || calculatedCurrentPage === calculatedTotalPages) ? true : null}
128
+ href={!disableNext ? nextLink : undefined}
129
+ theme={theme}
130
+ onClick={!disableNext
131
+ ? () => paginate('next')
132
+ : null
133
+ }
134
+ >
135
+ {#if type !== 'arrows'}
136
+ {nextPageLabel}
137
+ {/if}
138
+ {#if showChevrons || type === 'arrows'}
139
+ {@html ArrowRight}
140
+ {/if}
141
+ </Button>
142
+ </li>
143
+ {/if}
144
+ </ul>
@@ -0,0 +1,162 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import type { ReactPaginationProps } from './pagination'
3
+
4
+ import Button from '../Button/Button.tsx'
5
+
6
+ import { classNames } from '../../utils/classNames'
7
+
8
+ import ArrowLeft from '../../icons/arrow-left.svg?raw'
9
+ import ArrowRight from '../../icons/arrow-right.svg?raw'
10
+
11
+ import styles from './pagination.module.scss'
12
+
13
+ // eslint-disable-next-line complexity
14
+ const Pagination = ({
15
+ type,
16
+ showChevrons,
17
+ showDots,
18
+ disablePrevious,
19
+ disableNext,
20
+ previousLink,
21
+ nextLink,
22
+ previousPageLabel = 'Previous',
23
+ nextPageLabel = 'Next',
24
+ pages,
25
+ theme = 'outline',
26
+ totalPages,
27
+ currentPage,
28
+ onChange,
29
+ className
30
+ }: ReactPaginationProps) => {
31
+ const [calculatedCurrentPage, setCalculatedCurrentPage] = useState(
32
+ currentPage
33
+ || (pages?.findIndex(page => page.active) || -1) + 1
34
+ || 1
35
+ )
36
+
37
+ const classes = classNames([
38
+ styles.pagination,
39
+ theme !== 'outline' && (theme === null || theme === undefined ? styles.primary : styles[theme]),
40
+ type === 'dots' && styles.dots,
41
+ className
42
+ ])
43
+
44
+ const calculatedTotalPages = totalPages
45
+ || pages?.length
46
+ || 0
47
+
48
+ const generatedPages = pages?.length
49
+ ? pages
50
+ : Array(totalPages || 0).fill(0).map((_, index) => ({
51
+ ...(index === 0 && { active: true }),
52
+ label: index + 1
53
+ }))
54
+
55
+ const paginate = (to: string | number) => {
56
+ let currentPage = calculatedCurrentPage
57
+
58
+ if (to === 'prev') {
59
+ currentPage = calculatedCurrentPage - 1
60
+ } else if (to === 'next') {
61
+ currentPage = calculatedCurrentPage + 1
62
+ } else {
63
+ currentPage = to as number
64
+ }
65
+
66
+ const label = pages?.[currentPage - 1]?.label
67
+
68
+ setCalculatedCurrentPage(currentPage)
69
+
70
+ onChange?.({
71
+ page: currentPage,
72
+ ...(label && { label })
73
+ })
74
+ }
75
+
76
+ useEffect(() => {
77
+ if (currentPage) {
78
+ setCalculatedCurrentPage(currentPage)
79
+ }
80
+ }, [currentPage])
81
+
82
+ return (
83
+ <ul className={classes}>
84
+ {type === 'dots' ? (
85
+ <React.Fragment>
86
+ {generatedPages?.map((_, index) => (
87
+ <li key={index}>
88
+ <button
89
+ data-active={calculatedCurrentPage === index + 1 ? 'true' : null}
90
+ onClick={calculatedCurrentPage !== index + 1
91
+ ? () => paginate(index + 1)
92
+ : undefined
93
+ }
94
+ />
95
+ </li>
96
+ ))}
97
+ </React.Fragment>
98
+ ) : (
99
+ <React.Fragment>
100
+ <li>
101
+ <Button
102
+ disabled={disablePrevious || (calculatedCurrentPage === 1 && !previousLink)}
103
+ href={!disablePrevious ? previousLink : undefined}
104
+ theme={theme}
105
+ onClick={!(disablePrevious || (calculatedCurrentPage === 1 && !previousLink))
106
+ ? () => paginate('prev')
107
+ : null
108
+ }
109
+ >
110
+ {(showChevrons || type === 'arrows') && (
111
+ <span dangerouslySetInnerHTML={{ __html: ArrowLeft }} />
112
+ )}
113
+ {type !== 'arrows' && previousPageLabel}
114
+ </Button>
115
+ </li>
116
+ <React.Fragment>
117
+ {type !== 'arrows' && pages?.slice(0, calculatedTotalPages)?.map((page, index) =>
118
+ <li key={index}>
119
+ <Button
120
+ href={page.link}
121
+ data-active={calculatedCurrentPage === index + 1 ? 'true' : null}
122
+ theme={theme}
123
+ onClick={calculatedCurrentPage !== index + 1
124
+ ? () => paginate(index + 1)
125
+ : null
126
+ }
127
+ >
128
+ {page.label}
129
+ </Button>
130
+ </li>
131
+ )}
132
+ {showDots && (
133
+ <li>
134
+ <Button theme={theme} className={styles.inactive}>
135
+ ...
136
+ </Button>
137
+ </li>
138
+ )}
139
+ </React.Fragment>
140
+ <li>
141
+ <Button
142
+ disabled={disableNext || calculatedCurrentPage === calculatedTotalPages}
143
+ href={!disableNext ? nextLink : undefined}
144
+ theme={theme}
145
+ onClick={!disableNext
146
+ ? () => paginate('next')
147
+ : null
148
+ }
149
+ >
150
+ {type !== 'arrows' && nextPageLabel}
151
+ {(showChevrons || type === 'arrows') && (
152
+ <span dangerouslySetInnerHTML={{ __html: ArrowRight }} />
153
+ )}
154
+ </Button>
155
+ </li>
156
+ </React.Fragment>
157
+ )}
158
+ </ul>
159
+ )
160
+ }
161
+
162
+ export default Pagination
@@ -0,0 +1,49 @@
1
+ @import '../../scss/config.scss';
2
+
3
+ .pagination {
4
+ @include layout(flex, xs, wrap);
5
+ @include spacing(0);
6
+
7
+ list-style-type: none;
8
+
9
+ &.primary [data-active] {
10
+ @include typography(primary-70);
11
+ @include background(primary-20);
12
+ }
13
+
14
+ &.dots button {
15
+ @include transition();
16
+ @include border-radius(max);
17
+ @include size(12px);
18
+ @include border(0);
19
+ @include spacing(p0);
20
+ @include background(primary-30);
21
+
22
+ cursor: pointer;
23
+
24
+ &[data-active] {
25
+ @include background(primary);
26
+ @include size(w20px);
27
+ @include border-radius(lg);
28
+ }
29
+ }
30
+
31
+ li {
32
+ @include spacing(m0);
33
+ }
34
+
35
+ svg {
36
+ @include size(10px);
37
+ pointer-events: none;
38
+ }
39
+
40
+ [data-active] {
41
+ @include typography(primary);
42
+ box-shadow: inset 0px 0px 0px 1px var(--w-color-primary);
43
+ }
44
+
45
+ .inactive {
46
+ pointer-events: none;
47
+ box-shadow: none;
48
+ }
49
+ }
@@ -0,0 +1,35 @@
1
+ import type { ButtonProps } from '../Button/button'
2
+
3
+ export type PaginationEventType = {
4
+ page: number
5
+ label?: string | number | undefined
6
+ }
7
+
8
+ export type PaginationProps = {
9
+ type?: 'arrows' | 'dots' | null
10
+ showChevrons?: boolean
11
+ showDots?: boolean
12
+ disablePrevious?: boolean
13
+ disableNext?: boolean
14
+ previousLink?: string
15
+ nextLink?: string
16
+ previousPageLabel?: string
17
+ nextPageLabel?: string
18
+ className?: string
19
+ theme?: ButtonProps['theme']
20
+ totalPages?: number | null
21
+ currentPage?: number | null
22
+ pages?: {
23
+ label: number | string
24
+ active?: boolean
25
+ link?: string
26
+ }[]
27
+ }
28
+
29
+ export type SveltePaginationProps = {
30
+ onChange?: (event: PaginationEventType) => void
31
+ } & PaginationProps
32
+
33
+ export type ReactPaginationProps = {
34
+ onChange?: (event: PaginationEventType) => void
35
+ } & PaginationProps
@@ -1,3 +1,5 @@
1
+ import type { ButtonProps } from '../Button/button'
2
+
1
3
  export type RatingProps = {
2
4
  score: number
3
5
  total?: number
@@ -8,7 +10,7 @@ export type RatingProps = {
8
10
  reviewCount?: number
9
11
  reviewText?: string
10
12
  reviewLink?: string
11
- reviewTarget?: string
13
+ reviewTarget?: ButtonProps['target']
12
14
  color?: string
13
15
  emptyColor?: string
14
16
  size?: number