@charcoal-ui/react 5.6.0-beta.3 → 5.6.0-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charcoal-ui/react",
3
- "version": "5.6.0-beta.3",
3
+ "version": "5.6.0-beta.4",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -54,10 +54,10 @@
54
54
  "react-compiler-runtime": "1.0.0",
55
55
  "react-stately": "^3.26.0",
56
56
  "warning": "^4.0.3",
57
- "@charcoal-ui/foundation": "5.6.0-beta.3",
58
- "@charcoal-ui/theme": "5.6.0-beta.3",
59
- "@charcoal-ui/icons": "5.6.0-beta.3",
60
- "@charcoal-ui/utils": "5.6.0-beta.3"
57
+ "@charcoal-ui/foundation": "5.6.0-beta.4",
58
+ "@charcoal-ui/icons": "5.6.0-beta.4",
59
+ "@charcoal-ui/theme": "5.6.0-beta.4",
60
+ "@charcoal-ui/utils": "5.6.0-beta.4"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "react": ">=17.0.0"
@@ -2,7 +2,7 @@ import './index.css'
2
2
 
3
3
  import { usePaginationWindow } from './helper'
4
4
  import { useClassNames } from '../../_lib/useClassNames'
5
- import IconButton, { IconButtonProps } from '../IconButton'
5
+ import IconButton from '../IconButton'
6
6
  import {
7
7
  PaginationContext,
8
8
  usePaginationContext,
@@ -14,10 +14,9 @@ import {
14
14
 
15
15
  type NavButtonProps = {
16
16
  direction: 'prev' | 'next'
17
- ariaLabel: IconButtonProps['aria-label']
18
17
  }
19
18
 
20
- function NavButton({ direction, ariaLabel }: NavButtonProps) {
19
+ function NavButton({ direction }: NavButtonProps) {
21
20
  'use memo'
22
21
  const {
23
22
  page,
@@ -45,7 +44,6 @@ function NavButton({ direction, ariaLabel }: NavButtonProps) {
45
44
  icon={isPrev ? '24/Prev' : '24/Next'}
46
45
  size={size}
47
46
  hidden={disabled}
48
- aria-label={ariaLabel}
49
47
  {...(isLinkMode && makeUrl
50
48
  ? {
51
49
  component: LinkComponent as 'a',
@@ -124,13 +122,11 @@ function PageItem({ value }: { value: number | string }) {
124
122
  )
125
123
  }
126
124
 
127
- interface PaginationCommonProps {
125
+ interface CommonProps {
128
126
  page: number
129
127
  pageCount: number
130
128
  pageRangeDisplayed?: PageRangeDisplayed
131
129
  size?: Size
132
- ariaLabelPrev?: string
133
- ariaLabelNext?: string
134
130
  }
135
131
 
136
132
  type NavProps = Omit<React.ComponentPropsWithoutRef<'nav'>, 'onChange'>
@@ -154,33 +150,29 @@ type NavProps = Omit<React.ComponentPropsWithoutRef<'nav'>, 'onChange'>
154
150
  * // Link mode with linkProps (e.g. Next.js scroll)
155
151
  * <Pagination page={1} pageCount={10} makeUrl={(p) => `?page=${p}`} component={Link} linkProps={{ scroll: 'marker' }} />
156
152
  */
157
- export type PaginationProps<T extends React.ElementType = 'a'> =
158
- PaginationCommonProps &
159
- NavProps &
160
- (
161
- | {
162
- onChange(newPage: number): void
163
- makeUrl?: never
164
- component?: never
165
- linkProps?: undefined
166
- }
167
- | {
168
- makeUrl(page: number): string
169
- onChange?: never
170
- /**
171
- * The component used for link elements. Receives `href`, `className`, and `children`.
172
- * @default 'a'
173
- */
174
- component?: T
175
- /**
176
- * Additional props passed to all link elements (e.g. Next.js Link's scroll, prefetch).
177
- */
178
- linkProps?: Omit<
179
- React.ComponentPropsWithoutRef<T>,
180
- 'href' | 'children'
181
- >
182
- }
183
- )
153
+ export type PaginationProps<T extends React.ElementType = 'a'> = CommonProps &
154
+ NavProps &
155
+ (
156
+ | {
157
+ onChange(newPage: number): void
158
+ makeUrl?: never
159
+ component?: never
160
+ linkProps?: undefined
161
+ }
162
+ | {
163
+ makeUrl(page: number): string
164
+ onChange?: never
165
+ /**
166
+ * The component used for link elements. Receives `href`, `className`, and `children`.
167
+ * @default 'a'
168
+ */
169
+ component?: T
170
+ /**
171
+ * Additional props passed to all link elements (e.g. Next.js Link's scroll, prefetch).
172
+ */
173
+ linkProps?: Omit<React.ComponentPropsWithoutRef<T>, 'href' | 'children'>
174
+ }
175
+ )
184
176
 
185
177
  export default function Pagination<T extends React.ElementType = 'a'>({
186
178
  page,
@@ -192,8 +184,6 @@ export default function Pagination<T extends React.ElementType = 'a'>({
192
184
  component: LinkComponent = 'a' as T,
193
185
  linkProps,
194
186
  className,
195
- ariaLabelNext = 'Next',
196
- ariaLabelPrev = 'Previous',
197
187
  ...navProps
198
188
  }: PaginationProps<T>) {
199
189
  'use memo'
@@ -227,11 +217,11 @@ export default function Pagination<T extends React.ElementType = 'a'>({
227
217
  {...navProps}
228
218
  className={classNames}
229
219
  >
230
- <NavButton direction="prev" ariaLabel={ariaLabelPrev} />
220
+ <NavButton direction="prev" />
231
221
  {window.map((p) => (
232
222
  <PageItem key={p} value={p} />
233
223
  ))}
234
- <NavButton direction="next" ariaLabel={ariaLabelNext} />
224
+ <NavButton direction="next" />
235
225
  </nav>
236
226
  </PaginationContext.Provider>
237
227
  )