@openedx/paragon 22.15.0 → 22.15.2

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": "@openedx/paragon",
3
- "version": "22.15.0",
3
+ "version": "22.15.2",
4
4
  "description": "Accessible, responsive UI component library based on Bootstrap.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,8 +1,12 @@
1
1
  import React, { useContext } from 'react';
2
+ import { useIntl } from 'react-intl';
2
3
  import DataTableContext from './DataTableContext';
3
4
  import Pagination from '../Pagination';
5
+ import messages from './messages';
4
6
 
5
7
  function TablePagination() {
8
+ const intl = useIntl();
9
+
6
10
  const {
7
11
  pageCount, state, gotoPage,
8
12
  } = useContext(DataTableContext);
@@ -19,6 +23,7 @@ function TablePagination() {
19
23
  currentPage={pageIndex + 1}
20
24
  onPageSelect={(pageNum) => gotoPage(pageNum - 1)}
21
25
  pageCount={pageCount}
26
+ paginationLabel={intl.formatMessage(messages.paginationLabel)}
22
27
  icons={{
23
28
  leftIcon: null,
24
29
  rightIcon: null,
@@ -1,9 +1,13 @@
1
1
  import React, { useContext } from 'react';
2
+ import { useIntl } from 'react-intl';
2
3
  import DataTableContext from './DataTableContext';
3
4
  import Pagination from '../Pagination';
4
5
  import { ArrowBackIos, ArrowForwardIos } from '../../icons';
6
+ import messages from './messages';
5
7
 
6
8
  function TablePaginationMinimal() {
9
+ const intl = useIntl();
10
+
7
11
  const {
8
12
  nextPage, pageCount, gotoPage, state,
9
13
  } = useContext(DataTableContext);
@@ -20,7 +24,7 @@ function TablePaginationMinimal() {
20
24
  variant="minimal"
21
25
  currentPage={pageIndex + 1}
22
26
  pageCount={pageCount}
23
- paginationLabel="table pagination"
27
+ paginationLabel={intl.formatMessage(messages.paginationLabel)}
24
28
  onPageSelect={(pageNum) => gotoPage(pageNum - 1)}
25
29
  icons={{
26
30
  leftIcon: ArrowBackIos,
@@ -0,0 +1,11 @@
1
+ import { defineMessages } from 'react-intl';
2
+
3
+ const messages = defineMessages({
4
+ paginationLabel: {
5
+ id: 'pgn.DataTable.paginationLabel',
6
+ defaultMessage: 'table pagination',
7
+ description: 'Accessibile name for the navigation element of a pagination component',
8
+ },
9
+ });
10
+
11
+ export default messages;
@@ -32,7 +32,11 @@ describe('<TableFooter />', () => {
32
32
  it('Renders the default footer', () => {
33
33
  render(<TableFooterWrapper />);
34
34
  expect(screen.getByTestId('row-status')).toBeInTheDocument();
35
- expect(screen.getByLabelText('table pagination')).toBeInTheDocument();
35
+
36
+ // The TableFooter contains two components that have the aria-label
37
+ // "table pagination" - DataTable and DataTableMinimal.
38
+ const tables = screen.getAllByLabelText('table pagination');
39
+ tables.forEach(table => expect(table).toBeInTheDocument());
36
40
  });
37
41
 
38
42
  it('accepts a class name', () => {
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { render, act, screen } from '@testing-library/react';
3
+ import { IntlProvider } from 'react-intl';
3
4
  import userEvent from '@testing-library/user-event';
4
5
 
5
6
  import TablePagination from '../TablePagination';
@@ -14,9 +15,11 @@ const instance = {
14
15
  // eslint-disable-next-line react/prop-types
15
16
  function PaginationWrapper({ value }) {
16
17
  return (
17
- <DataTableContext.Provider value={value}>
18
- <TablePagination />
19
- </DataTableContext.Provider>
18
+ <IntlProvider>
19
+ <DataTableContext.Provider value={value}>
20
+ <TablePagination />
21
+ </DataTableContext.Provider>
22
+ </IntlProvider>
20
23
  );
21
24
  }
22
25
 
@@ -380,6 +380,7 @@ select.form-control {
380
380
  appearance: none;
381
381
  height: $custom-control-indicator-size;
382
382
  width: $custom-control-indicator-size;
383
+ min-width: $custom-control-indicator-size;
383
384
  background-color: $custom-control-indicator-bg;
384
385
  border: solid $custom-control-indicator-border-width $custom-control-indicator-border-color;
385
386
  border-radius: $custom-checkbox-indicator-border-radius;
@@ -437,6 +438,7 @@ select.form-control {
437
438
 
438
439
  .pgn__form-switch-input {
439
440
  width: $custom-switch-width;
441
+ min-width: $custom-switch-width;
440
442
  border-radius: $custom-switch-indicator-border-radius;
441
443
  background-image: escape-svg($custom-switch-indicator-icon-off);
442
444
  background-position: left center;