wjec-one 4.0.1-alpha.3 → 4.0.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/config/jest.config.js +26 -26
- package/index.d.ts +83 -54
- package/index.js +1 -1
- package/package.json +1 -1
- package/test/setupTests.ts +1 -4
- package/test/wjecOneMocks.ts +0 -189
- package/umd/index.js +1 -1
package/config/jest.config.js
CHANGED
|
@@ -11,33 +11,33 @@ const coverageThreshold = overrides.coverageThreshold === undefined ? 100 : over
|
|
|
11
11
|
|
|
12
12
|
module.exports = {
|
|
13
13
|
collectCoverageFrom: [
|
|
14
|
-
'auth/**/*.{ts,tsx}',
|
|
15
|
-
'localization/**/*.{ts,tsx}',
|
|
16
|
-
'portal/**/*.{ts,tsx}',
|
|
17
|
-
'services/**/*.{ts,tsx}',
|
|
18
|
-
'src/**/*.{ts,tsx}',
|
|
19
|
-
'store/**/*.{ts,tsx}',
|
|
20
|
-
'theme/**/*.{ts,tsx}',
|
|
21
|
-
'utils/**/*.{ts,tsx}',
|
|
14
|
+
'./auth/**/*.{ts,tsx}',
|
|
15
|
+
'./localization/**/*.{ts,tsx}',
|
|
16
|
+
'./portal/**/*.{ts,tsx}',
|
|
17
|
+
'./services/**/*.{ts,tsx}',
|
|
18
|
+
'./src/**/*.{ts,tsx}',
|
|
19
|
+
'./store/**/*.{ts,tsx}',
|
|
20
|
+
'./theme/**/*.{ts,tsx}',
|
|
21
|
+
'./utils/**/*.{ts,tsx}',
|
|
22
22
|
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
23
|
+
'!./**/*.d.ts',
|
|
24
|
+
'!./localization/index.ts',
|
|
25
|
+
'!./portal/index.ts',
|
|
26
|
+
'!./portal/**/store/state.{ts,tsx}',
|
|
27
|
+
'!./services/index.ts',
|
|
28
|
+
'!./src/ColorPalette*.ts',
|
|
29
|
+
'!./src/components/**/styles.{ts,tsx}',
|
|
30
|
+
'!./src/StylePalette.ts',
|
|
31
|
+
'!./src/styles',
|
|
32
|
+
'!./test/**/*',
|
|
33
|
+
'!./theme/index.ts',
|
|
34
|
+
'!./theme/ThemeContext.ts',
|
|
35
|
+
'!./theme/ThemeState.ts',
|
|
36
|
+
'!./theme/utils.ts',
|
|
37
|
+
'!./**/types',
|
|
38
|
+
'!./types.ts',
|
|
39
|
+
'!./utils/index.ts',
|
|
40
|
+
'!./utils/ConfigUtils.ts'
|
|
41
41
|
],
|
|
42
42
|
coverageReporters: ['cobertura', 'json', 'text'],
|
|
43
43
|
coverageThreshold: {
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Interpolation, ArrayInterpolation } from '@emotion/core';
|
|
3
2
|
import * as _emotion_utils from '@emotion/utils';
|
|
4
|
-
import React$1, { SVGProps, ButtonHTMLAttributes, CSSProperties, FC, PropsWithChildren, InputHTMLAttributes, MouseEvent, Dispatch, Context } from 'react';
|
|
3
|
+
import React$1, { SVGProps, ButtonHTMLAttributes, CSSProperties, FC, PropsWithChildren, InputHTMLAttributes, MouseEvent, Dispatch, Context, ReactNode, Key } from 'react';
|
|
5
4
|
import { AriaButtonProps } from 'react-aria';
|
|
6
5
|
import { GapProperty, BottomProperty, LeftProperty, RightProperty, TopProperty, ColorProperty, WidthProperty, HeightProperty, MarginProperty, PaddingProperty } from 'csstype';
|
|
7
6
|
import { Record } from 'immutable';
|
|
7
|
+
import { Interpolation, ArrayInterpolation } from '@emotion/core';
|
|
8
8
|
|
|
9
9
|
type ColorPalette = {
|
|
10
10
|
border: string;
|
|
@@ -48,8 +48,7 @@ type ColorPalette = {
|
|
|
48
48
|
welshBaccFoundation: string;
|
|
49
49
|
welshBaccNational: string;
|
|
50
50
|
welshBaccKS4: string;
|
|
51
|
-
};
|
|
52
|
-
type Styles = Interpolation | ArrayInterpolation<any>;
|
|
51
|
+
};
|
|
53
52
|
|
|
54
53
|
declare const _default$2: ColorPalette;
|
|
55
54
|
|
|
@@ -1653,72 +1652,102 @@ declare const SubParagraph: WjecOneComponent<SubParagraphProps>;
|
|
|
1653
1652
|
|
|
1654
1653
|
declare const SubTitle: WjecOneComponent;
|
|
1655
1654
|
|
|
1656
|
-
type CellAlignment = 'center' | 'left' | 'right';
|
|
1657
|
-
type CellStyleExtractor<T> = (row: T, cellValue: string | number | JSX.Element, index: number) => Styles;
|
|
1658
1655
|
type ColumnOptions = {
|
|
1656
|
+
/**
|
|
1657
|
+
* Determines the alignment of cell content (may result in unexpected behaviour if a component/element is provided as the cell's content)
|
|
1658
|
+
* @default "left"
|
|
1659
|
+
*/
|
|
1659
1660
|
align?: 'center' | 'left' | 'right';
|
|
1661
|
+
/**
|
|
1662
|
+
* Determines the spacing between columns
|
|
1663
|
+
* @default "16px"
|
|
1664
|
+
*/
|
|
1665
|
+
gap?: CSSProperties['gap'];
|
|
1660
1666
|
};
|
|
1661
|
-
type
|
|
1662
|
-
|
|
1663
|
-
|
|
1667
|
+
type RowOptions = {
|
|
1668
|
+
/**
|
|
1669
|
+
* Determines the spacing between rows
|
|
1670
|
+
* @default "8px"
|
|
1671
|
+
*/
|
|
1672
|
+
gap?: CSSProperties['gap'];
|
|
1673
|
+
/**
|
|
1674
|
+
* Determines the highlight behaviour of the row:
|
|
1675
|
+
* * "hover" - highlight will appear when the cursor moves over a row
|
|
1676
|
+
* * "selected" - highlight will appear when a row is the specified `selectedRow` (also applies for "hover")
|
|
1677
|
+
* * false - no highlighting will be applied
|
|
1678
|
+
* @default false
|
|
1679
|
+
*/
|
|
1680
|
+
highlight?: 'hover' | 'selected' | false;
|
|
1681
|
+
/**
|
|
1682
|
+
* Determines the colour of the row highlight, where applicable
|
|
1683
|
+
* @default ```js
|
|
1684
|
+
* ColorPalette.highlight
|
|
1685
|
+
* ```
|
|
1686
|
+
*/
|
|
1687
|
+
highlightColor?: CSSProperties['color'];
|
|
1664
1688
|
};
|
|
1665
|
-
type RowStyleExtractor<T> = (row: T, index: number) => Styles;
|
|
1666
1689
|
type SortDirection = 'ascending' | 'descending';
|
|
1667
|
-
type
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1690
|
+
type TableColumn<T, N extends string = string> = {
|
|
1691
|
+
/**
|
|
1692
|
+
* Determines the alignment of cell content (may result in unexpected behaviour if a component/element is provided as the cell's content)
|
|
1693
|
+
* @default "left"
|
|
1694
|
+
*/
|
|
1695
|
+
align?: 'center' | 'left' | 'right';
|
|
1696
|
+
/**
|
|
1697
|
+
* Specifies either an explicit value to display, or the return value of a function to which the current row is provided as an argument */
|
|
1698
|
+
displayValue: ReactNode | ((row: T) => ReactNode);
|
|
1699
|
+
/** A unique identifier for each column. Strongly recommended when using dynamically-defined columns and/or sorting */
|
|
1700
|
+
name?: N;
|
|
1701
|
+
/** A handler that will be called when the column header cell is pressed */
|
|
1702
|
+
onPressHeader?: () => void;
|
|
1703
|
+
/** Determines whether this column is sortable (may override/be overridden by top-level `sortable` value) */
|
|
1674
1704
|
sortable?: boolean;
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
title
|
|
1679
|
-
width
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
key: keyof T;
|
|
1686
|
-
}
|
|
1687
|
-
interface TableColumnEntryWithValue<T> extends TableColumnEntryTemplate<T> {
|
|
1688
|
-
value: FormattedString | number | TableColumnValueExtractor<T>;
|
|
1689
|
-
}
|
|
1690
|
-
type TableColumnEntry<T> = TableColumnEntryWithComponent<T> | TableColumnEntryWithKey<T> | TableColumnEntryWithValue<T>;
|
|
1691
|
-
type TableProps<T> = {
|
|
1692
|
-
/** A React styles object or a serialized Emotion styles object (or a function that returns either of these) used to style each cell */
|
|
1693
|
-
cellStyle?: Styles | CellStyleExtractor<T>;
|
|
1694
|
-
/** A list of column configuration objects (or a function that returns the same) used to determine what is displayed by the Table */
|
|
1695
|
-
columns: Array<TableColumnEntry<T>> | TableColumnExtractor<T>;
|
|
1705
|
+
/** Determines the value to be considered by the Table's internal sorting algorithm */
|
|
1706
|
+
sortableValue?: (row: T) => number | string;
|
|
1707
|
+
/** Determines the value to be displayed in the column's header cell */
|
|
1708
|
+
title?: ReactNode;
|
|
1709
|
+
/** Specifies the width of the column */
|
|
1710
|
+
width?: 'max' | 'min' | CSSProperties['width'];
|
|
1711
|
+
};
|
|
1712
|
+
type TableProps<T, N extends string> = {
|
|
1713
|
+
/** A list of column configurations objects used to determine what is displayed by the Table */
|
|
1714
|
+
columns: Array<TableColumn<T, N>>;
|
|
1696
1715
|
/** Options that will be applied to all columns in the Table (some options may be overridden on a per-column basis) */
|
|
1697
1716
|
columnOptions?: ColumnOptions;
|
|
1698
1717
|
/** The array of data that will be used to populate the table */
|
|
1699
1718
|
data: T[];
|
|
1700
|
-
/** A function that will be used to return a unique key for each row; required if data contains non-primitive entries */
|
|
1701
|
-
keyExtractor?: KeyExtractor<T>;
|
|
1702
1719
|
/**
|
|
1703
|
-
* A
|
|
1704
|
-
* @
|
|
1705
|
-
|
|
1706
|
-
|
|
1720
|
+
* A function that will be used to return a unique key for each row; required if data contains non-primitive entries
|
|
1721
|
+
* @default ```ts
|
|
1722
|
+
* (row) => data.indexOf(row)
|
|
1723
|
+
* ```
|
|
1724
|
+
*/
|
|
1725
|
+
keyExtractor?: (row: T) => Key;
|
|
1707
1726
|
/** A handler that will be called when a row in the table is pressed */
|
|
1708
|
-
onPressRow?: (row: T
|
|
1709
|
-
/**
|
|
1710
|
-
|
|
1727
|
+
onPressRow?: (row: T) => void;
|
|
1728
|
+
/** A handler that will be called whenever the sort order is changed as a result of the Table component's internal algorithm */
|
|
1729
|
+
onSort?: (columnName: string, columnIndex: number, direction: SortDirection) => void;
|
|
1711
1730
|
/** Options that will be applied to all rows in the Table */
|
|
1712
|
-
rowOptions?: RowOptions
|
|
1713
|
-
/**
|
|
1714
|
-
rowStyle?: Styles | RowStyleExtractor<T>;
|
|
1715
|
-
/** Determines whether the row for a particular data entry should be visually highlighted */
|
|
1731
|
+
rowOptions?: RowOptions;
|
|
1732
|
+
/** Specifies the active row. May be used to trigger visual highlight depending on rowOptions */
|
|
1716
1733
|
selectedRow?: T;
|
|
1717
|
-
/** Determines whether the Table should present sortable controls (may be overridden on a per-column basis
|
|
1734
|
+
/** Determines whether the Table should present sortable controls (may be overridden on a per-column basis) */
|
|
1718
1735
|
sortable?: boolean;
|
|
1736
|
+
/** Specifies whether the `data` is already sorted. If `true`, the component's sorting algorithm will NOT be used */
|
|
1737
|
+
sorted?: boolean;
|
|
1738
|
+
/**
|
|
1739
|
+
* Specifies the sorted column, by index or column name (using column names is strongly recommended)
|
|
1740
|
+
* @default (First sortable column)
|
|
1741
|
+
*/
|
|
1742
|
+
sortedColumn?: number | N;
|
|
1743
|
+
/**
|
|
1744
|
+
* Specifies the direction of the sort
|
|
1745
|
+
* @default "ascending"
|
|
1746
|
+
*/
|
|
1747
|
+
sortedDirection?: SortDirection;
|
|
1719
1748
|
};
|
|
1720
1749
|
|
|
1721
|
-
declare const Table: <T extends
|
|
1750
|
+
declare const Table: <T extends unknown, N extends string>({ columnOptions, columns, data, id, keyExtractor, onPressRow, onSort, rowOptions, selectedRow, sortable, sorted, sortedColumn: defaultSortedColumn, sortedDirection: defaultSortedDirection }: WjecOneComponentProps<TableProps<T, N>>) => React$1.JSX.Element;
|
|
1722
1751
|
|
|
1723
1752
|
type TabsProps<T> = {
|
|
1724
1753
|
backgroundStyle?: 'filled' | 'transparent';
|
|
@@ -1737,4 +1766,4 @@ type TabsProps<T> = {
|
|
|
1737
1766
|
} & Pick<AriaProperties, 'ariaLabel'>;
|
|
1738
1767
|
declare const Tabs: <T extends unknown>({ ariaLabel, backgroundStyle, disabledTabs, id, keyExtractor, labelExtractor, onSelect, scrollable, selectedTab, selectedTabColor, tabs }: WjecOneComponentProps<TabsProps<T>>) => JSX.Element;
|
|
1739
1768
|
|
|
1740
|
-
export { Accordion, Breadcrumb, Button, Card, Carousel, CheckBox, CircularProgress, _default$2 as ColorPalette, _default$1 as ColorPaletteEduqas, ContextHelp, ContextMenu, DateTimePicker, DestructiveButton, DragAndDropList, Email, Emphasis, ErrorCard, ErrorNotification, FileInput, FilterList, Footer, Form, Header, IconButton, InfoNotification, InformationCard, Input, LinearProgress, Link, LinkButton, LocalizationMenu, Modal, Notification, Page, PageTitle, Pagination, Paragraph, Password, Popup, PopupWindow, PrimaryButton, PrintLayout, PrintWindow, RadioGroup, ScrollableContainer, SecondaryButton, SectionHeading, SectionTitle, Select, SigninForm, SigninMenu, _default as StylePalette, SubParagraph, SubTitle, SuccessCard, SuccessNotification, Table, Tabs, TextArea, Toggle, VerificationCodeInput, WarningCard };
|
|
1769
|
+
export { Accordion, Breadcrumb, Button, Card, Carousel, CheckBox, CircularProgress, _default$2 as ColorPalette, _default$1 as ColorPaletteEduqas, ColumnOptions, ContextHelp, ContextMenu, DateTimePicker, DestructiveButton, DragAndDropList, Email, Emphasis, ErrorCard, ErrorNotification, FileInput, FilterList, Footer, Form, Header, IconButton, InfoNotification, InformationCard, Input, LinearProgress, Link, LinkButton, LocalizationMenu, Modal, Notification, Page, PageTitle, Pagination, Paragraph, Password, Popup, PopupWindow, PrimaryButton, PrintLayout, PrintWindow, RadioGroup, RowOptions, ScrollableContainer, SecondaryButton, SectionHeading, SectionTitle, Select, SigninForm, SigninMenu, SortDirection, _default as StylePalette, SubParagraph, SubTitle, SuccessCard, SuccessNotification, Table, TableColumn, Tabs, TextArea, Toggle, VerificationCodeInput, WarningCard };
|