wjec-one 4.2.0-alpha.0 → 4.2.0-alpha.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/README.md +21 -12
- package/auth/index.d.ts +14 -7
- package/config/eslint.config.mjs +65 -25
- package/config/jest.config.js +2 -0
- package/config/webpack.standalone.config.js +1 -1
- package/index.d.ts +28 -55
- package/index.js +5 -5
- package/layout/index.js +1 -1
- package/localization/index.d.ts +15 -7
- package/package.json +8 -2
- package/portal/index.d.ts +91 -43
- package/portal/index.js +3 -3
- package/services/index.d.ts +2 -2
- package/store/index.d.ts +11 -11
- package/store/index.js +1 -1
- package/store/utils/index.d.ts +3 -1
- package/test/index.ts +85 -148
- package/test/legacyTestUtils.ts +151 -0
- package/test/mocks/api/index.ts +69 -0
- package/test/mocks/auth/index.ts +119 -0
- package/test/setupTests.ts +4 -1
- package/test/setupTestsAfterEnv.ts +6 -5
- package/test/setupTestsAfterEnvForProject.ts +42 -0
- package/test/setupTestsForProject.ts +10 -0
- package/test/{setupTestsForPackage.ts → setupTestsForWjecOne.ts} +2 -8
- package/test/wjecOneMocks.ts +1 -3
- package/theme/index.d.ts +1 -1
- package/umd/index.js +5 -5
- package/umd/layout/index.js +1 -1
- package/umd/portal/index.js +3 -3
- package/umd/store/index.js +1 -1
- package/umd/utils/index.js +1 -1
- package/utils/index.d.ts +51 -26
- package/utils/index.js +1 -1
package/README.md
CHANGED
|
@@ -1155,7 +1155,7 @@ Here is a list of our components along with some documentation for them.
|
|
|
1155
1155
|
<tbody>
|
|
1156
1156
|
<tr>
|
|
1157
1157
|
<td>ref</td>
|
|
1158
|
-
<td><code>
|
|
1158
|
+
<td><code>Ref<CarouselControls></code></td>
|
|
1159
1159
|
<td>false</td>
|
|
1160
1160
|
<td><code>-</code></td>
|
|
1161
1161
|
<td>Allows getting a ref to the component instance.
|
|
@@ -1311,7 +1311,7 @@ Once the component unmounts, React will set `ref.current` to `null`
|
|
|
1311
1311
|
<tbody>
|
|
1312
1312
|
<tr>
|
|
1313
1313
|
<td>toggle</td>
|
|
1314
|
-
<td><code>string , ReactElement<
|
|
1314
|
+
<td><code>string , ReactElement<unknown, string , JSXElementConstructor<any>></code></td>
|
|
1315
1315
|
<td>false</td>
|
|
1316
1316
|
<td><code><HelpIcon css={styles.defaultToggle} /></code></td>
|
|
1317
1317
|
<td>The string or component to use as the Popup's toggle</td>
|
|
@@ -1419,7 +1419,7 @@ Once the component unmounts, React will set `ref.current` to `null`
|
|
|
1419
1419
|
<tbody>
|
|
1420
1420
|
<tr>
|
|
1421
1421
|
<td>toggle</td>
|
|
1422
|
-
<td><code>string , ReactElement<
|
|
1422
|
+
<td><code>string , ReactElement<unknown, string , JSXElementConstructor<any>></code></td>
|
|
1423
1423
|
<td>false</td>
|
|
1424
1424
|
<td><code><IconButton icon={MoreIcon} ariaLabel={ariaLabel} /></code></td>
|
|
1425
1425
|
<td>-</td>
|
|
@@ -4490,7 +4490,7 @@ The identifier that will be passed through to the underlying HTML element</td>
|
|
|
4490
4490
|
<tbody>
|
|
4491
4491
|
<tr>
|
|
4492
4492
|
<td>otherActions</td>
|
|
4493
|
-
<td><code>ReactElement<
|
|
4493
|
+
<td><code>ReactElement<unknown, string , JSXElementConstructor<any>> , ContextMenuOption[] , ContextMenuSection[]</code></td>
|
|
4494
4494
|
<td>false</td>
|
|
4495
4495
|
<td><code>-</code></td>
|
|
4496
4496
|
<td>A set of custom controls that will be rendered in the Modal's footer. Can be either a React element or a configuration object for a ContextMenu</td>
|
|
@@ -5606,7 +5606,7 @@ The identifier that will be passed through to the underlying HTML element</td>
|
|
|
5606
5606
|
<tbody>
|
|
5607
5607
|
<tr>
|
|
5608
5608
|
<td>toggle</td>
|
|
5609
|
-
<td><code>string , ReactElement<
|
|
5609
|
+
<td><code>string , ReactElement<unknown, string , JSXElementConstructor<any>></code></td>
|
|
5610
5610
|
<td>true</td>
|
|
5611
5611
|
<td><code>-</code></td>
|
|
5612
5612
|
<td>The string or component to use as the Popup's toggle</td>
|
|
@@ -6005,7 +6005,7 @@ The identifier that will be passed through to the underlying HTML element</td>
|
|
|
6005
6005
|
<td>element</td>
|
|
6006
6006
|
<td><code>keyof HTMLElementTagNameMap</code></td>
|
|
6007
6007
|
<td>false</td>
|
|
6008
|
-
<td><code
|
|
6008
|
+
<td><code>-</code></td>
|
|
6009
6009
|
<td>-</td>
|
|
6010
6010
|
</tr>
|
|
6011
6011
|
</tbody>
|
|
@@ -6020,19 +6020,28 @@ The identifier that will be passed through to the underlying HTML element</td>
|
|
|
6020
6020
|
</tbody>
|
|
6021
6021
|
<tbody>
|
|
6022
6022
|
<tr>
|
|
6023
|
-
<td>
|
|
6024
|
-
<td><code>
|
|
6023
|
+
<td>vertical</td>
|
|
6024
|
+
<td><code>boolean</code></td>
|
|
6025
6025
|
<td>false</td>
|
|
6026
|
-
<td><code
|
|
6026
|
+
<td><code>true</code></td>
|
|
6027
6027
|
<td>-</td>
|
|
6028
6028
|
</tr>
|
|
6029
6029
|
</tbody>
|
|
6030
6030
|
<tbody>
|
|
6031
6031
|
<tr>
|
|
6032
|
-
<td>
|
|
6033
|
-
<td><code>
|
|
6032
|
+
<td>id</td>
|
|
6033
|
+
<td><code>string</code></td>
|
|
6034
6034
|
<td>false</td>
|
|
6035
|
-
<td><code
|
|
6035
|
+
<td><code>-</code></td>
|
|
6036
|
+
<td>The identifier that will be passed through to the underlying HTML element</td>
|
|
6037
|
+
</tr>
|
|
6038
|
+
</tbody>
|
|
6039
|
+
<tbody>
|
|
6040
|
+
<tr>
|
|
6041
|
+
<td>ref</td>
|
|
6042
|
+
<td><code>Ref<HTMLElementTagNameMap[T]></code></td>
|
|
6043
|
+
<td>false</td>
|
|
6044
|
+
<td><code>-</code></td>
|
|
6036
6045
|
<td>-</td>
|
|
6037
6046
|
</tr>
|
|
6038
6047
|
</tbody>
|
package/auth/index.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { CognitoUserSession, CognitoUser } from 'amazon-cognito-identity-js';
|
|
2
2
|
import { LocalizationState } from 'wjec-one/localization';
|
|
3
|
+
import { CentreNumber, AccountType as AccountType$1 } from 'wjec-one/portal';
|
|
3
4
|
import { ServiceCallStatus as ServiceCallStatus$1 } from 'wjec-one/services';
|
|
4
5
|
|
|
5
6
|
type ServiceCallStatus = 'done' | 'failed' | 'idle' | 'loading';
|
|
6
7
|
|
|
8
|
+
declare enum AccountType {
|
|
9
|
+
EXAMS_OFFICER = "EXAMS_OFFICER",
|
|
10
|
+
PRIMARY = "PRIMARY",
|
|
11
|
+
SECONDARY = "SECONDARY"
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
declare enum AuthAction {
|
|
8
15
|
CHANGE_PASSWORD = "changePassword",
|
|
9
16
|
COMPLETE_PASSWORD_RESET = "completePasswordReset",
|
|
@@ -60,7 +67,7 @@ interface EditablePrivateUserAttributes {
|
|
|
60
67
|
middleName: string;
|
|
61
68
|
}
|
|
62
69
|
interface ReadonlyCognitoUserAttributes {
|
|
63
|
-
centrePermissions: Record<
|
|
70
|
+
centrePermissions: Record<CentreNumber, AccountType$1>;
|
|
64
71
|
emailAddress: string;
|
|
65
72
|
emailAddressVerified: boolean;
|
|
66
73
|
groups: string[];
|
|
@@ -129,12 +136,12 @@ type UserPreferences = {
|
|
|
129
136
|
};
|
|
130
137
|
|
|
131
138
|
interface Props {
|
|
132
|
-
amplifyConfig?: Record<string,
|
|
139
|
+
amplifyConfig?: Record<string, unknown>;
|
|
133
140
|
debug?: boolean;
|
|
134
|
-
oAuthConfig?: Record<string,
|
|
141
|
+
oAuthConfig?: Record<string, unknown>;
|
|
135
142
|
onChallenge?: (challenge: Challenge) => void;
|
|
136
143
|
onCompletePasswordReset?: () => void;
|
|
137
|
-
onError?: (errorType: AuthAction, errorDetails?:
|
|
144
|
+
onError?: (errorType: AuthAction, errorDetails?: unknown) => void;
|
|
138
145
|
onInit?: (session: CognitoUserSession) => void;
|
|
139
146
|
onRefreshSession?: (session: CognitoUserSession) => void;
|
|
140
147
|
onRequestPasswordReset?: (emailAddress: string) => void;
|
|
@@ -151,7 +158,7 @@ declare const completePasswordReset: (username: string, code: string, newPasswor
|
|
|
151
158
|
declare const externalSignIn: (provider: string) => void;
|
|
152
159
|
declare const getAuthorizationToken: () => Promise<string>;
|
|
153
160
|
declare const getUserSession: () => Promise<CognitoUserSession>;
|
|
154
|
-
declare const init: (amplifyConfig: Record<string,
|
|
161
|
+
declare const init: (amplifyConfig: Record<string, unknown>, oAuthConfig: Record<string, unknown>, usersEndpointOrOptions: string | {
|
|
155
162
|
debug?: boolean;
|
|
156
163
|
usersEndpoint?: string;
|
|
157
164
|
}) => Promise<CognitoUserSession>;
|
|
@@ -172,7 +179,7 @@ declare const updateUserPreferences: (preferences: Partial<UserPreferences>) =>
|
|
|
172
179
|
declare const verifyTelephoneNumber: () => Promise<Challenge>;
|
|
173
180
|
declare const verifyTotp: (code: string) => Promise<boolean>;
|
|
174
181
|
declare const state: Readonly<{
|
|
175
|
-
readonly centrePermissions: Record
|
|
182
|
+
readonly centrePermissions: Record<`${number}`, AccountType>;
|
|
176
183
|
readonly emailAddress: string;
|
|
177
184
|
readonly emailAddressVerified: boolean;
|
|
178
185
|
readonly familyName: string;
|
|
@@ -182,7 +189,7 @@ declare const state: Readonly<{
|
|
|
182
189
|
readonly id: string;
|
|
183
190
|
readonly isInitialized: boolean;
|
|
184
191
|
readonly isSignedIn: boolean;
|
|
185
|
-
readonly languagePreference:
|
|
192
|
+
readonly languagePreference: string;
|
|
186
193
|
readonly mfaType: MFAType;
|
|
187
194
|
readonly middleName: string;
|
|
188
195
|
readonly preferences: UserPreferences;
|
package/config/eslint.config.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineConfig } from 'eslint/config';
|
|
2
|
-
import tsEslintPlugin from '@typescript-eslint/eslint-plugin';
|
|
3
|
-
import tsEslint from 'typescript-eslint';
|
|
4
1
|
import jsEslint from '@eslint/js';
|
|
2
|
+
import tsEslintPlugin from '@typescript-eslint/eslint-plugin';
|
|
5
3
|
import tsParser from '@typescript-eslint/parser';
|
|
4
|
+
import importPlugin from 'eslint-plugin-import';
|
|
6
5
|
import reactPlugin from 'eslint-plugin-react';
|
|
7
6
|
import reactRules from 'eslint-plugin-react-hooks';
|
|
8
|
-
import
|
|
7
|
+
import { defineConfig } from 'eslint/config';
|
|
8
|
+
import globals from 'globals';
|
|
9
9
|
import path from 'node:path';
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
|
-
import
|
|
11
|
+
import tsEslint from 'typescript-eslint';
|
|
12
12
|
|
|
13
13
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
-
const PROJECT_ROOT = path.resolve(__dirname, '
|
|
14
|
+
const PROJECT_ROOT = path.resolve(__dirname, './');
|
|
15
15
|
|
|
16
16
|
const mainConfig = {
|
|
17
17
|
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
@@ -55,6 +55,7 @@ const mainConfig = {
|
|
|
55
55
|
'comma-dangle': ['error', 'never'],
|
|
56
56
|
'comma-spacing': 'error',
|
|
57
57
|
'comma-style': 'error',
|
|
58
|
+
'complexity': ['warn', { max: 15 }],
|
|
58
59
|
'computed-property-spacing': 'error',
|
|
59
60
|
'consistent-return': ['error', { treatUndefinedAsUnspecified: true }],
|
|
60
61
|
curly: 'error',
|
|
@@ -69,7 +70,9 @@ const mainConfig = {
|
|
|
69
70
|
'max-len': ['error', {
|
|
70
71
|
code: 140,
|
|
71
72
|
ignoreComments: true,
|
|
72
|
-
ignoreRegExpLiterals: true
|
|
73
|
+
ignoreRegExpLiterals: true,
|
|
74
|
+
ignoreStrings: true
|
|
75
|
+
// check string template
|
|
73
76
|
}],
|
|
74
77
|
'multiline-ternary': ['error', 'always-multiline'],
|
|
75
78
|
'new-parens': 'error',
|
|
@@ -85,6 +88,7 @@ const mainConfig = {
|
|
|
85
88
|
'no-mixed-operators': 'error',
|
|
86
89
|
'no-multi-assign': 'error',
|
|
87
90
|
'no-multi-spaces': 'error',
|
|
91
|
+
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 1 }],
|
|
88
92
|
'no-negated-condition': 'error',
|
|
89
93
|
'no-param-reassign': 'error',
|
|
90
94
|
// 'no-restricted-imports': ['error', { patterns: ['!./*', '!../*', '../../*', 'wjec-one/auth', 'wjec-one/localization', 'wjec-one/portal', 'wjec-one/services', 'wjec-one/store', 'wjec-one/test', 'wjec-one/theme', 'wjec-one/utils'] }],
|
|
@@ -127,6 +131,7 @@ const mainConfig = {
|
|
|
127
131
|
quotes: ['error', 'single'],
|
|
128
132
|
'quote-props': ['error', 'as-needed'],
|
|
129
133
|
radix: ['error', 'as-needed'],
|
|
134
|
+
'react/jsx-no-leaked-render': ['error', { validStrategies: ['ternary', 'coerce'] }],
|
|
130
135
|
'require-atomic-updates': 'error',
|
|
131
136
|
'require-await': 'error',
|
|
132
137
|
'rest-spread-spacing': 'error',
|
|
@@ -153,24 +158,40 @@ const mainConfig = {
|
|
|
153
158
|
'import/no-named-as-default-member': 'off',
|
|
154
159
|
'import/no-self-import': 'error',
|
|
155
160
|
'import/no-unresolved': 'off',
|
|
161
|
+
'import/order': ['error', {
|
|
162
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
163
|
+
pathGroups: [
|
|
164
|
+
{
|
|
165
|
+
pattern: 'wjec-one{,/**}',
|
|
166
|
+
group: 'external',
|
|
167
|
+
position: 'after'
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
pattern: '**/assets/**',
|
|
171
|
+
group: 'sibling',
|
|
172
|
+
position: 'after'
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
'newlines-between': 'always',
|
|
176
|
+
alphabetize: { order: 'asc', caseInsensitive: true }
|
|
177
|
+
}],
|
|
156
178
|
// Would like to have an unused exports check, but unfortunately this doesn't work well with TypeScript...
|
|
157
179
|
// Will replace with appropriate alternative once identified
|
|
158
180
|
// 'import/no-unused-modules': ['error', { unusedExports: true }],
|
|
159
181
|
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
|
|
160
182
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
161
183
|
'@typescript-eslint/member-ordering': 'error',
|
|
162
|
-
'@typescript-eslint/no-explicit-any': '
|
|
184
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
163
185
|
'@typescript-eslint/no-shadow': ['error', { hoist: 'all' }],
|
|
164
186
|
'@typescript-eslint/no-unused-vars': ['error', {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
],
|
|
187
|
+
args: 'all',
|
|
188
|
+
argsIgnorePattern: '^_',
|
|
189
|
+
caughtErrors: 'all',
|
|
190
|
+
caughtErrorsIgnorePattern: '^_',
|
|
191
|
+
destructuredArrayIgnorePattern: '^_',
|
|
192
|
+
varsIgnorePattern: '^React$|^_|^jsx$',
|
|
193
|
+
ignoreRestSiblings: true
|
|
194
|
+
}],
|
|
174
195
|
'@typescript-eslint/no-use-before-define': ['error', { classes: true, functions: false, variables: false }],
|
|
175
196
|
'@typescript-eslint/prefer-includes': 'error',
|
|
176
197
|
'@typescript-eslint/prefer-interface': 'off',
|
|
@@ -187,12 +208,36 @@ const testConfig = {
|
|
|
187
208
|
code: 140,
|
|
188
209
|
ignoreComments: true,
|
|
189
210
|
ignoreRegExpLiterals: true,
|
|
190
|
-
ignoreStrings: true
|
|
211
|
+
ignoreStrings: true,
|
|
212
|
+
ignoreTemplateLiterals: true
|
|
191
213
|
}],
|
|
192
214
|
'no-console': 'off',
|
|
193
215
|
'no-restricted-imports': 'off',
|
|
194
216
|
'padding-line-between-statements': 'off',
|
|
195
217
|
'import/first': 'off',
|
|
218
|
+
// 'import/order': ['error', {
|
|
219
|
+
// groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
220
|
+
// pathGroups: [
|
|
221
|
+
// {
|
|
222
|
+
// pattern: 'test',
|
|
223
|
+
// group: 'builtin'
|
|
224
|
+
// },
|
|
225
|
+
// {
|
|
226
|
+
// pattern: 'wjec-one{,/**}',
|
|
227
|
+
// group: 'external',
|
|
228
|
+
// position: 'after'
|
|
229
|
+
// },
|
|
230
|
+
// {
|
|
231
|
+
// pattern: 'src/assets/**',
|
|
232
|
+
// group: 'sibling',
|
|
233
|
+
// position: 'after'
|
|
234
|
+
// }
|
|
235
|
+
// ],
|
|
236
|
+
// 'newlines-between': 'ignore',
|
|
237
|
+
// alphabetize: { order: 'asc', caseInsensitive: true }
|
|
238
|
+
// }],
|
|
239
|
+
'import/order': 'off',
|
|
240
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
196
241
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
197
242
|
'@typescript-eslint/no-object-literal-type-assertion': 'off'
|
|
198
243
|
}
|
|
@@ -212,10 +257,8 @@ const scratchpadConfig = {
|
|
|
212
257
|
};
|
|
213
258
|
|
|
214
259
|
const scriptsConfig = {
|
|
215
|
-
files: ['scripts/*.js'],
|
|
216
|
-
languageOptions: {
|
|
217
|
-
globals: { node: true }
|
|
218
|
-
},
|
|
260
|
+
files: ['scripts/*.js', 'config/**', 'rollup.config.mjs', 'jest.config.js','webpack.config.js'],
|
|
261
|
+
languageOptions: { globals: { ...globals.node } },
|
|
219
262
|
rules: {
|
|
220
263
|
'no-console': 'off',
|
|
221
264
|
'@typescript-eslint/no-var-requires': 'off'
|
|
@@ -226,9 +269,6 @@ export default defineConfig([
|
|
|
226
269
|
tsEslint.configs.eslintRecommended,
|
|
227
270
|
jsEslint.configs.recommended,
|
|
228
271
|
reactRules.configs.flat.recommended,
|
|
229
|
-
{
|
|
230
|
-
languageOptions: { globals: { ...globals.node }}
|
|
231
|
-
},
|
|
232
272
|
mainConfig,
|
|
233
273
|
testConfig,
|
|
234
274
|
scratchpadConfig,
|
package/config/jest.config.js
CHANGED
|
@@ -44,10 +44,12 @@ module.exports = {
|
|
|
44
44
|
],
|
|
45
45
|
setupFiles: [
|
|
46
46
|
path.join(testPath, 'setupTests.ts'),
|
|
47
|
+
path.join(testPath, 'setupTestsForProject.ts'),
|
|
47
48
|
fs.existsSync(projectTestSetupFilePath) && projectTestSetupFilePath
|
|
48
49
|
].filter(Boolean),
|
|
49
50
|
setupFilesAfterEnv: [
|
|
50
51
|
path.join(testPath, 'setupTestsAfterEnv.ts'),
|
|
52
|
+
path.join(testPath, 'setupTestsAfterEnvForProject.ts'),
|
|
51
53
|
fs.existsSync(projectTestSetupAfterEnvFilePath) && projectTestSetupAfterEnvFilePath
|
|
52
54
|
].filter(Boolean),
|
|
53
55
|
snapshotSerializers: ['@emotion/jest/serializer'],
|
|
@@ -11,7 +11,7 @@ const standaloneComponents =
|
|
|
11
11
|
fs.readdirSync(`${appPath}/standalone`, { withFileTypes: true })
|
|
12
12
|
.map((dirent) => ({
|
|
13
13
|
filePath: dirent.isDirectory()
|
|
14
|
-
? glob.sync(`${appPath}/standalone/${dirent.name}/index.{js,jsx,ts,tsx}
|
|
14
|
+
? glob.sync(`${appPath}/standalone/${dirent.name}/index.{js,jsx,ts,tsx}`.replaceAll(path.sep, path.posix.sep))?.[0]
|
|
15
15
|
: `${appPath}/standalone/${dirent.name}`,
|
|
16
16
|
fileType: dirent.isDirectory() ? 'dir' : 'file',
|
|
17
17
|
name: dirent.name
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as _emotion_react from '@emotion/react';
|
|
2
|
-
import { Interpolation, ArrayInterpolation } from '@emotion/react';
|
|
3
2
|
import * as React$1 from 'react';
|
|
4
|
-
import React__default, { PropsWithChildren, FunctionComponent, ButtonHTMLAttributes, SVGProps, CSSProperties, FC, InputHTMLAttributes, MouseEvent, ReactNode, Key, MutableRefObject } from 'react';
|
|
3
|
+
import React__default, { PropsWithChildren, FunctionComponent, ButtonHTMLAttributes, SVGProps, CSSProperties, FC, InputHTMLAttributes, MouseEvent, ReactNode, Ref, Key, MutableRefObject, EffectCallback, DependencyList } from 'react';
|
|
5
4
|
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
6
5
|
import { KeyExtractor, ContentExtractor, SVGComponent } from 'wjec-one/utils';
|
|
7
6
|
import { AriaButtonProps } from 'react-aria';
|
|
@@ -114,6 +113,8 @@ type DeepMerge<S, O> = S extends Primitive ? O : O extends Primitive ? S : {
|
|
|
114
113
|
type DeepPartial<T extends object> = Partial<{
|
|
115
114
|
[K in keyof T]: T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
116
115
|
}>;
|
|
116
|
+
type FixedLengthArray<T, N extends number> = GrowToSize<T, N, []>;
|
|
117
|
+
type GrowToSize<T, N extends number, A extends T[]> = A['length'] extends N ? A : GrowToSize<T, N, [...A, T]>;
|
|
117
118
|
type Implements<T, U extends T> = U;
|
|
118
119
|
type ObjectLeaves<T> = T extends object ? {
|
|
119
120
|
[K in keyof T]: `${Exclude<K, symbol>}${ObjectLeaves<T[K]> extends never ? '' : `.${ObjectLeaves<T[K]>}`}`;
|
|
@@ -121,6 +122,9 @@ type ObjectLeaves<T> = T extends object ? {
|
|
|
121
122
|
type ObjectPaths<T> = T extends object ? {
|
|
122
123
|
[K in keyof T]: `${Exclude<K, symbol>}${'' | `.${ObjectPaths<T[K]>}`}`;
|
|
123
124
|
}[keyof T] : never;
|
|
125
|
+
type Optional<T extends object> = {
|
|
126
|
+
-readonly [K in keyof T]: T[K];
|
|
127
|
+
};
|
|
124
128
|
type UnionToIntersection<T> = {
|
|
125
129
|
[K in T as K & string]: K;
|
|
126
130
|
}[any];
|
|
@@ -319,8 +323,6 @@ type ButtonProps$1 = React__default.ComponentProps<typeof Button>;
|
|
|
319
323
|
type SecondaryButtonProps = Omit<ButtonProps$1, 'activeColor' | 'borderColor' | 'color' | 'focusColor' | 'hoverColor' | 'iconColor' | 'iconColorActive' | 'labelColor' | 'labelColorActive' | 'outlineColor'>;
|
|
320
324
|
declare const SecondaryButton: FC<SecondaryButtonProps>;
|
|
321
325
|
|
|
322
|
-
/** @jsx jsx */
|
|
323
|
-
|
|
324
326
|
type CardProps = {
|
|
325
327
|
borderColor?: CSSProperties['color'];
|
|
326
328
|
padding?: CSSProperties['padding'];
|
|
@@ -527,14 +529,10 @@ type Position = {
|
|
|
527
529
|
|
|
528
530
|
declare const Popup: WjecOneComponent<PopupProps$2>;
|
|
529
531
|
|
|
530
|
-
/** @jsx jsx */
|
|
531
|
-
|
|
532
532
|
type PopupProps$1 = React__default.ComponentProps<typeof Popup>;
|
|
533
533
|
type ContextHelpProps = Pick<Partial<PopupProps$1>, 'ariaDescription' | 'ariaLabel' | 'border' | 'maxWidth' | 'onHide' | 'onShow' | 'open' | 'placement' | 'toggle' | 'trigger'>;
|
|
534
534
|
declare const ContextHelp: WjecOneComponent<ContextHelpProps>;
|
|
535
535
|
|
|
536
|
-
/** @jsx jsx */
|
|
537
|
-
|
|
538
536
|
type PopupProps = React__default.ComponentProps<typeof Popup>;
|
|
539
537
|
type ContextMenuOption = {
|
|
540
538
|
additionalInfo?: string | React__default.ReactElement;
|
|
@@ -559,8 +557,6 @@ type ContextMenuProps$2 = {
|
|
|
559
557
|
} & Pick<AriaProperties, 'ariaLabel'>;
|
|
560
558
|
declare const ContextMenu: WjecOneComponent<ContextMenuProps$2>;
|
|
561
559
|
|
|
562
|
-
/** @jsx jsx */
|
|
563
|
-
|
|
564
560
|
type EmphasisProps = {
|
|
565
561
|
color?: CSSProperties['color'];
|
|
566
562
|
};
|
|
@@ -696,9 +692,7 @@ type FilterListProps<T> = Pick<InputProps, 'icon' | 'label' | 'onChange' | 'plac
|
|
|
696
692
|
}>;
|
|
697
693
|
options: T[];
|
|
698
694
|
} & Pick<AriaProperties, 'ariaCloseLabel' | 'ariaLabel' | 'ariaMultiselectable'>;
|
|
699
|
-
declare const FilterList: <T extends
|
|
700
|
-
|
|
701
|
-
/** @jsx jsx */
|
|
695
|
+
declare const FilterList: <T extends unknown>({ clearButtonBehaviour, expanded, filter, floatingList, floatingListPosition, icon, id, label, loading, maxHeight, noMatchesMessage, onChange, onFilter, optionKeyExtractor, optionTemplate, options, placeholder, value, ariaLabel, ariaCloseLabel, ariaMultiselectable }: WjecOneComponentProps<FilterListProps<T>>) => _emotion_react_jsx_runtime.JSX.Element;
|
|
702
696
|
|
|
703
697
|
type ContextMenuProps$1 = React__default.ComponentProps<typeof ContextMenu>;
|
|
704
698
|
type FormProps = {
|
|
@@ -713,8 +707,6 @@ type FormProps = {
|
|
|
713
707
|
} & Pick<AriaProperties, 'ariaDescription' | 'ariaLabel'>;
|
|
714
708
|
declare const Form: WjecOneComponent<FormProps>;
|
|
715
709
|
|
|
716
|
-
/** @jsx jsx */
|
|
717
|
-
|
|
718
710
|
type Props$c = {
|
|
719
711
|
ariaLabel?: AriaProperties;
|
|
720
712
|
/**
|
|
@@ -790,8 +782,6 @@ interface DateTimeProps extends Omit<DateProps, 'type'>, Omit<TimeProps, 'type'>
|
|
|
790
782
|
type DateTimePickerProps = DateProps | DateTimeProps | TimeProps;
|
|
791
783
|
declare const DateTimePicker: WjecOneComponent<DateTimePickerProps>;
|
|
792
784
|
|
|
793
|
-
/** @jsx jsx */
|
|
794
|
-
|
|
795
785
|
type Props$b = React__default.ComponentProps<typeof Input>;
|
|
796
786
|
declare const Email: WjecOneComponent<Props$b>;
|
|
797
787
|
|
|
@@ -822,7 +812,7 @@ type Props$a = {
|
|
|
822
812
|
onError?: (errors: Array<{
|
|
823
813
|
code: string;
|
|
824
814
|
details?: {
|
|
825
|
-
[key: string]:
|
|
815
|
+
[key: string]: unknown;
|
|
826
816
|
};
|
|
827
817
|
}>) => void;
|
|
828
818
|
/** A function that will be triggered when the list of selected files is changed */
|
|
@@ -982,6 +972,7 @@ declare const RadioGroup: <T extends {}>({ ariaLabel, description, disabled, gri
|
|
|
982
972
|
|
|
983
973
|
type OptionsComparator<T> = (optionA: T, optionB: T) => number;
|
|
984
974
|
type OptionsGroup<T> = {
|
|
975
|
+
key?: React.Key;
|
|
985
976
|
label: string;
|
|
986
977
|
options: T[];
|
|
987
978
|
};
|
|
@@ -1073,9 +1064,7 @@ type SelectProps<T> = {
|
|
|
1073
1064
|
statusMessage?: FormattedString;
|
|
1074
1065
|
};
|
|
1075
1066
|
|
|
1076
|
-
declare const Select: <T extends
|
|
1077
|
-
|
|
1078
|
-
/** @jsx jsx */
|
|
1067
|
+
declare const Select: <T extends unknown>(props: WjecOneComponentProps<SelectProps<T>>) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1079
1068
|
|
|
1080
1069
|
type Props$8 = {
|
|
1081
1070
|
disabled?: boolean;
|
|
@@ -1210,8 +1199,6 @@ type WarningCardProps = React__default.ComponentProps<typeof InformationCard>;
|
|
|
1210
1199
|
type Props$3 = Omit<WarningCardProps, 'borderColor' | 'icon' | 'iconColor' | 'titleColor'>;
|
|
1211
1200
|
declare const WarningCard: FC<Props$3>;
|
|
1212
1201
|
|
|
1213
|
-
/** @jsx jsx */
|
|
1214
|
-
|
|
1215
1202
|
type SVGFC$1 = (props: SVGProps<SVGSVGElement>) => SVGComponent;
|
|
1216
1203
|
type Props$2 = {
|
|
1217
1204
|
copyrightMessage?: FormattedString;
|
|
@@ -1220,8 +1207,6 @@ type Props$2 = {
|
|
|
1220
1207
|
};
|
|
1221
1208
|
declare const Footer: FC<Props$2>;
|
|
1222
1209
|
|
|
1223
|
-
/** @jsx jsx */
|
|
1224
|
-
|
|
1225
1210
|
type SVGFC = (props: SVGProps<SVGSVGElement>) => SVGComponent;
|
|
1226
1211
|
type Props$1 = {
|
|
1227
1212
|
logo?: SVGFC | {
|
|
@@ -1243,8 +1228,6 @@ type Props$1 = {
|
|
|
1243
1228
|
};
|
|
1244
1229
|
declare const Header: FC<Props$1>;
|
|
1245
1230
|
|
|
1246
|
-
/** @jsx jsx */
|
|
1247
|
-
|
|
1248
1231
|
type FooterProps = React__default.ComponentProps<typeof Footer>;
|
|
1249
1232
|
type HeaderProps = React__default.ComponentProps<typeof Header>;
|
|
1250
1233
|
type Props = {
|
|
@@ -1254,8 +1237,6 @@ type Props = {
|
|
|
1254
1237
|
};
|
|
1255
1238
|
declare const Page: FC<PropsWithChildren<Props>>;
|
|
1256
1239
|
|
|
1257
|
-
/** @jsx jsx */
|
|
1258
|
-
|
|
1259
1240
|
type LinearProgressProps = {
|
|
1260
1241
|
/** The background color of the progress bar
|
|
1261
1242
|
* @default ColorPalette.Neutral
|
|
@@ -1355,12 +1336,12 @@ type NotificationProps$4 = {
|
|
|
1355
1336
|
declare const Notification: WjecOneComponent<NotificationProps$4>;
|
|
1356
1337
|
|
|
1357
1338
|
type NotificationProps$3 = React__default.ComponentProps<typeof Notification>;
|
|
1358
|
-
type
|
|
1359
|
-
declare const
|
|
1339
|
+
type ErrorNotificationProps = Omit<NotificationProps$3, 'actionColor' | 'actionTextColor' | 'borderColor' | 'icon' | 'titleColor'>;
|
|
1340
|
+
declare const ErrorNotification: FC<ErrorNotificationProps>;
|
|
1360
1341
|
|
|
1361
1342
|
type NotificationProps$2 = React__default.ComponentProps<typeof Notification>;
|
|
1362
|
-
type
|
|
1363
|
-
declare const
|
|
1343
|
+
type InfoNotificationProps = Omit<NotificationProps$2, 'actionColor' | 'actionTextColor' | 'borderColor' | 'icon' | 'iconColor' | 'titleColor'>;
|
|
1344
|
+
declare const InfoNotification: FC<InfoNotificationProps>;
|
|
1364
1345
|
|
|
1365
1346
|
type NotificationProps$1 = React__default.ComponentProps<typeof Notification>;
|
|
1366
1347
|
type SuccessNotificationProps = Omit<NotificationProps$1, 'actionColor' | 'actionTextColor' | 'borderColor' | 'icon' | 'iconColor' | 'titleColor'>;
|
|
@@ -1487,8 +1468,6 @@ type ModalProps = {
|
|
|
1487
1468
|
|
|
1488
1469
|
declare const Modal: WjecOneComponent<ModalProps>;
|
|
1489
1470
|
|
|
1490
|
-
/** @jsx jsx */
|
|
1491
|
-
|
|
1492
1471
|
type PageTitleProps = {
|
|
1493
1472
|
color?: CSSProperties['color'];
|
|
1494
1473
|
};
|
|
@@ -1502,8 +1481,6 @@ type PaginationProps = {
|
|
|
1502
1481
|
} & Pick<AriaProperties, 'ariaCurrent' | 'ariaLabel'>;
|
|
1503
1482
|
declare const Pagination: WjecOneComponent<PaginationProps>;
|
|
1504
1483
|
|
|
1505
|
-
/** @jsx jsx */
|
|
1506
|
-
|
|
1507
1484
|
type ParagraphProps = {
|
|
1508
1485
|
color?: CSSProperties['color'];
|
|
1509
1486
|
};
|
|
@@ -1535,8 +1512,6 @@ type PopupWindowProps$1 = {
|
|
|
1535
1512
|
};
|
|
1536
1513
|
declare const PopupWindow: WjecOneComponent<PopupWindowProps$1>;
|
|
1537
1514
|
|
|
1538
|
-
/** @jsx jsx */
|
|
1539
|
-
|
|
1540
1515
|
type PrintLayoutProps$1 = {
|
|
1541
1516
|
footer?: FC;
|
|
1542
1517
|
header?: FC;
|
|
@@ -1555,32 +1530,28 @@ type PrintWindowProps = PopupWindowProps & PrintLayoutProps & {
|
|
|
1555
1530
|
} & Pick<AriaProperties, 'ariaLabel'>;
|
|
1556
1531
|
declare const PrintWindow: WjecOneComponent<PrintWindowProps>;
|
|
1557
1532
|
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
type ScrollableContainerProps = {
|
|
1561
|
-
element?: keyof HTMLElementTagNameMap;
|
|
1533
|
+
type ScrollableContainerProps<T extends keyof HTMLElementTagNameMap> = {
|
|
1534
|
+
element?: T;
|
|
1562
1535
|
horizontal?: boolean;
|
|
1563
|
-
styles?: Interpolation | ArrayInterpolation<any>;
|
|
1564
1536
|
vertical?: boolean;
|
|
1565
1537
|
};
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1538
|
+
interface ScrollableContainerComponent extends WjecOneComponent<ScrollableContainerProps<keyof HTMLElementTagNameMap>> {
|
|
1539
|
+
<T extends keyof HTMLElementTagNameMap = 'div'>(props: WjecOneComponentProps<ScrollableContainerProps<T>> & {
|
|
1540
|
+
ref?: Ref<HTMLElementTagNameMap[T]>;
|
|
1541
|
+
}): ReturnType<WjecOneComponent<ScrollableContainerProps<T>>>;
|
|
1542
|
+
}
|
|
1543
|
+
declare const ScrollableContainer: ScrollableContainerComponent;
|
|
1569
1544
|
|
|
1570
1545
|
type SectionHeadingProps = {
|
|
1571
1546
|
color?: CSSProperties['color'];
|
|
1572
1547
|
};
|
|
1573
1548
|
declare const SectionHeading: WjecOneComponent<SectionHeadingProps>;
|
|
1574
1549
|
|
|
1575
|
-
/** @jsx jsx */
|
|
1576
|
-
|
|
1577
1550
|
type SectionTitleProps = {
|
|
1578
1551
|
color?: CSSProperties['color'];
|
|
1579
1552
|
};
|
|
1580
1553
|
declare const SectionTitle: WjecOneComponent<SectionTitleProps>;
|
|
1581
1554
|
|
|
1582
|
-
/** @jsx jsx */
|
|
1583
|
-
|
|
1584
1555
|
type SubParagraphProps = {
|
|
1585
1556
|
color?: CSSProperties['color'];
|
|
1586
1557
|
};
|
|
@@ -1700,7 +1671,7 @@ type TabsProps<T> = {
|
|
|
1700
1671
|
selectedTabColor?: CSSProperties['color'];
|
|
1701
1672
|
tabs: T[];
|
|
1702
1673
|
} & Pick<AriaProperties, 'ariaLabel'>;
|
|
1703
|
-
declare const Tabs: <T extends
|
|
1674
|
+
declare const Tabs: <T extends unknown>({ ariaLabel, backgroundStyle, disabledTabs, id, keyExtractor, labelExtractor, onSelect, selectedTab, selectedTabColor, tabs }: WjecOneComponentProps<TabsProps<T>>) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1704
1675
|
|
|
1705
1676
|
type ExtractKeyframeParams<T extends string> = T extends `${string}{${infer Param}}${infer Rest}` ? Param extends `${infer Key}:${infer Type}` ? Type extends keyof CSSProperties ? {
|
|
1706
1677
|
[K in Key]: CSSProperties[Type];
|
|
@@ -1735,7 +1706,7 @@ declare const useAnimation: <T extends KeyframeParams>(elementRef: MutableRefObj
|
|
|
1735
1706
|
type EventListenerCallback<E extends keyof HTMLElementEventMap> = (event: HTMLElementEventMap[E]) => void;
|
|
1736
1707
|
type EventListenerHook = <E extends keyof HTMLElementEventMap>(eventName: E, callback: EventListenerCallback<E>, options?: EventListenerHookOptions) => void;
|
|
1737
1708
|
type EventListenerHookOptions = {
|
|
1738
|
-
dependencies?:
|
|
1709
|
+
dependencies?: unknown[];
|
|
1739
1710
|
eventOptions?: AddEventListenerOptions;
|
|
1740
1711
|
eventTarget?: HTMLElement | Window | MutableRefObject<HTMLElement | Window>;
|
|
1741
1712
|
shouldAddListener?: boolean | (() => boolean);
|
|
@@ -1743,7 +1714,7 @@ type EventListenerHookOptions = {
|
|
|
1743
1714
|
declare const useEventListener: EventListenerHook;
|
|
1744
1715
|
|
|
1745
1716
|
type FocusTrapOptions = {
|
|
1746
|
-
dependencies?:
|
|
1717
|
+
dependencies?: unknown[];
|
|
1747
1718
|
focusElement?: false | HTMLElement | number | string;
|
|
1748
1719
|
shouldTrapFocus?: boolean | (() => boolean);
|
|
1749
1720
|
};
|
|
@@ -1755,6 +1726,8 @@ declare const useKeydownEvent: (code: Lowercase<KeyboardEvent["code"] | Keyboard
|
|
|
1755
1726
|
|
|
1756
1727
|
declare const useMediaQuery: (query: string) => boolean;
|
|
1757
1728
|
|
|
1729
|
+
declare const useStateEffect: (effect: EffectCallback, deps?: DependencyList) => void;
|
|
1730
|
+
|
|
1758
1731
|
declare const useRefById: <T extends HTMLElement>(id: string) => React$1.RefObject<T>;
|
|
1759
1732
|
|
|
1760
|
-
export { Accordion, Breadcrumb, Button, Card, Carousel, CheckBox, CircularProgress, _default$2 as ColorPalette, _default$1 as ColorPaletteEduqas, ColumnOptions, ContextHelp, ContextMenu, DateTimePicker, DeepMerge, DeepPartial, DestructiveButton, Email, Emphasis, ErrorCard, ErrorNotification, EventListenerHookOptions, FileInput, FilterList, FocusTrapOptions, Footer, Form, Header, IconButton, Implements, InfoNotification, InformationCard, Input, LinearProgress, Link, LinkButton, Modal, Notification, ObjectLeaves, ObjectPaths, Page, PageTitle, Pagination, Paragraph, Password, Pill, Popup, PopupWindow, PrimaryButton, PrintLayout, PrintWindow, RadioGroup, RowOptions, ScrollableContainer, SecondaryButton, SectionHeading, SectionTitle, Select, SortDirection, _default as StylePalette, SubParagraph, SubTitle, SuccessCard, SuccessNotification, Table, TableColumn, Tabs, TextArea, Toggle, UnionToIntersection, VerificationCodeInput, WarningCard, WithKeys, Writable, useAnimation, useEventListener, useFocusTrap, useIsMounted, useKeydownEvent, useMediaQuery, useRefById };
|
|
1733
|
+
export { Accordion, Breadcrumb, Button, Card, Carousel, CheckBox, CircularProgress, _default$2 as ColorPalette, _default$1 as ColorPaletteEduqas, ColumnOptions, ContextHelp, ContextMenu, DateTimePicker, DeepMerge, DeepPartial, DestructiveButton, Email, Emphasis, ErrorCard, ErrorNotification, EventListenerHookOptions, FileInput, FilterList, FixedLengthArray, FocusTrapOptions, Footer, Form, Header, IconButton, Implements, InfoNotification, InformationCard, Input, LinearProgress, Link, LinkButton, Modal, Notification, ObjectLeaves, ObjectPaths, Optional, Page, PageTitle, Pagination, Paragraph, Password, Pill, Popup, PopupWindow, PrimaryButton, PrintLayout, PrintWindow, RadioGroup, RowOptions, ScrollableContainer, SecondaryButton, SectionHeading, SectionTitle, Select, SortDirection, _default as StylePalette, SubParagraph, SubTitle, SuccessCard, SuccessNotification, Table, TableColumn, Tabs, TextArea, Toggle, UnionToIntersection, VerificationCodeInput, WarningCard, WithKeys, Writable, useAnimation, useEventListener, useFocusTrap, useIsMounted, useKeydownEvent, useMediaQuery, useRefById, useStateEffect };
|