@wise/dynamic-flow-client-internal 3.16.2 → 3.16.3-experimental-c0e84f1
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/build/dynamicFlow/DynamicFlow.js +104 -0
- package/build/dynamicFlow/DynamicFlow.test.js +116 -0
- package/build/i18n/index.js +62 -0
- package/build/index.js +5 -0
- package/build/main.js +6 -12
- package/build/main.mjs +6 -12
- package/build/stories/DynamicFlow.story.js +52 -0
- package/build/stories/DynamicFragment.story.js +131 -0
- package/build/stories/Editable.story.js +70 -0
- package/build/stories/Examples.story.js +29 -0
- package/build/stories/Features.story.js +33 -0
- package/build/stories/utils/DynamicFlowSideBySide.js +30 -0
- package/build/stories/utils/fixtureHttpClient.js +119 -0
- package/build/stories/visual-tests/generated.story.js +216 -0
- package/build/stories/visual-tests/layouts.story.js +108 -0
- package/build/stories/visual-tests/schemas.story.js +84 -0
- package/build/stories/visual-tests/step.story.js +30 -0
- package/build/test-utils/NeptuneProviders.js +23 -0
- package/build/test-utils/rtl-utils.js +20 -0
- package/build/tests/renderers/RadioInputRendererComponent.test.js +76 -0
- package/build/tests/renderers/value-utils.test.js +33 -0
- package/build/types/stories/visual-tests/generated.story.d.ts +39 -0
- package/build/types/stories/visual-tests/layouts.story.d.ts +21 -0
- package/build/types/stories/visual-tests/schemas.story.d.ts +17 -0
- package/build/types/stories/visual-tests/step.story.d.ts +8 -0
- package/package.json +6 -6
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { screen } from '@testing-library/react';
|
|
14
|
+
import { RadioInputRendererComponent } from '@wise/dynamic-flow-renderers/src/SelectInputRenderer/RadioInputRendererComponent';
|
|
15
|
+
import { renderWithProviders } from '../../test-utils/rtl-utils';
|
|
16
|
+
describe('RadioInputRendererComponent', function () {
|
|
17
|
+
var getProps = function () { return ({
|
|
18
|
+
type: 'input-select',
|
|
19
|
+
id: 'id',
|
|
20
|
+
children: [],
|
|
21
|
+
description: 'description',
|
|
22
|
+
autoComplete: 'off',
|
|
23
|
+
required: false,
|
|
24
|
+
disabled: false,
|
|
25
|
+
error: 'error',
|
|
26
|
+
help: 'help',
|
|
27
|
+
label: 'label',
|
|
28
|
+
options: [
|
|
29
|
+
{
|
|
30
|
+
title: 'Option A',
|
|
31
|
+
disabled: false,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: 'Option B',
|
|
35
|
+
disabled: false,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
selectedIndex: null,
|
|
39
|
+
onSelect: jest.fn(),
|
|
40
|
+
onFocus: jest.fn(),
|
|
41
|
+
onBlur: jest.fn(),
|
|
42
|
+
}); };
|
|
43
|
+
describe('When the value is updated from outside the UI component', function () {
|
|
44
|
+
it('should update the selected value', function () {
|
|
45
|
+
var props = getProps();
|
|
46
|
+
var rerender = renderWithProviders(_jsx(RadioInputRendererComponent, __assign({}, props))).rerender;
|
|
47
|
+
expect(screen.getByLabelText('Option A')).not.toBeChecked();
|
|
48
|
+
expect(screen.getByLabelText('Option B')).not.toBeChecked();
|
|
49
|
+
rerender(_jsx(RadioInputRendererComponent, __assign({}, props, { selectedIndex: 1 })));
|
|
50
|
+
expect(screen.getByLabelText('Option B')).toBeChecked();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
describe('When the options are updated (e.g. refresh-on-change)', function () {
|
|
54
|
+
it('should update the options', function () {
|
|
55
|
+
var props = __assign(__assign({}, getProps()), { selectedIndex: 1 });
|
|
56
|
+
var rerender = renderWithProviders(_jsx(RadioInputRendererComponent, __assign({}, props))).rerender;
|
|
57
|
+
expect(screen.getByLabelText('Option B')).toBeChecked();
|
|
58
|
+
var updatedProps = __assign(__assign({}, props), { options: [
|
|
59
|
+
{
|
|
60
|
+
title: 'Option A',
|
|
61
|
+
disabled: false,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: 'Option NEW',
|
|
65
|
+
disabled: false,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: 'Option B',
|
|
69
|
+
disabled: false,
|
|
70
|
+
},
|
|
71
|
+
] });
|
|
72
|
+
rerender(_jsx(RadioInputRendererComponent, __assign({}, updatedProps)));
|
|
73
|
+
expect(screen.getByLabelText('Option NEW')).toBeChecked();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { dateStringToDateOrNull, dateToDateString, numericValueOrNull, } from '@wise/dynamic-flow-renderers/src/utils/value-utils';
|
|
2
|
+
describe('numericValueOrNull', function () {
|
|
3
|
+
it('should return null if the input is not a valid number', function () {
|
|
4
|
+
expect(numericValueOrNull('abc')).toBeNull();
|
|
5
|
+
expect(numericValueOrNull('123abc')).toBeNull();
|
|
6
|
+
});
|
|
7
|
+
it('should return the input value if it is a valid number', function () {
|
|
8
|
+
expect(numericValueOrNull('123')).toBe('123');
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
describe('dateStringToDateOrNull', function () {
|
|
12
|
+
it('should return null if the input is nullish', function () {
|
|
13
|
+
expect(dateStringToDateOrNull(undefined)).toBeNull();
|
|
14
|
+
expect(dateStringToDateOrNull('')).toBeNull();
|
|
15
|
+
expect(dateStringToDateOrNull(null)).toBeNull();
|
|
16
|
+
});
|
|
17
|
+
it('should return null if the input is not a valid date', function () {
|
|
18
|
+
expect(dateStringToDateOrNull('Jan-06-2022')).toBeNull();
|
|
19
|
+
expect(dateStringToDateOrNull('Jan 06 2022')).toBeNull();
|
|
20
|
+
});
|
|
21
|
+
it('should return a Date object if the input is a valid date string', function () {
|
|
22
|
+
var date = dateStringToDateOrNull('2022-01-31');
|
|
23
|
+
expect(date === null || date === void 0 ? void 0 : date.getFullYear()).toBe(2022);
|
|
24
|
+
expect(date === null || date === void 0 ? void 0 : date.getMonth()).toBe(0);
|
|
25
|
+
expect(date === null || date === void 0 ? void 0 : date.getDate()).toBe(31);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
describe('dateToDateString', function () {
|
|
29
|
+
it('should return a formatted date string when passed a date', function () {
|
|
30
|
+
var date = new Date('2022-01-01');
|
|
31
|
+
expect(dateToDateString(date)).toBe('2022-01-01');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import DynamicFlowSideBySide from '../utils/DynamicFlowSideBySide';
|
|
3
|
+
declare const meta: Meta<typeof DynamicFlowSideBySide>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof DynamicFlowSideBySide>;
|
|
6
|
+
export declare const alert: Story;
|
|
7
|
+
export declare const align: Story;
|
|
8
|
+
export declare const arraytuple: Story;
|
|
9
|
+
export declare const box: Story;
|
|
10
|
+
export declare const button: Story;
|
|
11
|
+
export declare const checkbox: Story;
|
|
12
|
+
export declare const columns: Story;
|
|
13
|
+
export declare const copyable: Story;
|
|
14
|
+
export declare const date: Story;
|
|
15
|
+
export declare const datelookup: Story;
|
|
16
|
+
export declare const decision: Story;
|
|
17
|
+
export declare const heading: Story;
|
|
18
|
+
export declare const image: Story;
|
|
19
|
+
export declare const instructions: Story;
|
|
20
|
+
export declare const integer: Story;
|
|
21
|
+
export declare const list: Story;
|
|
22
|
+
export declare const margin: Story;
|
|
23
|
+
export declare const markdown: Story;
|
|
24
|
+
export declare const modal: Story;
|
|
25
|
+
export declare const multiselect: Story;
|
|
26
|
+
export declare const number: Story;
|
|
27
|
+
export declare const paragraph: Story;
|
|
28
|
+
export declare const password: Story;
|
|
29
|
+
export declare const phonenumber: Story;
|
|
30
|
+
export declare const radio: Story;
|
|
31
|
+
export declare const repeatable: Story;
|
|
32
|
+
export declare const review: Story;
|
|
33
|
+
export declare const search: Story;
|
|
34
|
+
export declare const segmented: Story;
|
|
35
|
+
export declare const select: Story;
|
|
36
|
+
export declare const tabs: Story;
|
|
37
|
+
export declare const text: Story;
|
|
38
|
+
export declare const textarea: Story;
|
|
39
|
+
export declare const upload: Story;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import DynamicFlowSideBySide from '../utils/DynamicFlowSideBySide';
|
|
3
|
+
declare const meta: Meta<typeof DynamicFlowSideBySide>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof DynamicFlowSideBySide>;
|
|
6
|
+
export declare const alert: Story;
|
|
7
|
+
export declare const box: Story;
|
|
8
|
+
export declare const button: Story;
|
|
9
|
+
export declare const columns: Story;
|
|
10
|
+
export declare const decision: Story;
|
|
11
|
+
export declare const divider: Story;
|
|
12
|
+
export declare const form: Story;
|
|
13
|
+
export declare const heading: Story;
|
|
14
|
+
export declare const image: Story;
|
|
15
|
+
export declare const instructions: Story;
|
|
16
|
+
export declare const loadingIndicator: Story;
|
|
17
|
+
export declare const margin: Story;
|
|
18
|
+
export declare const markdown: Story;
|
|
19
|
+
export declare const paragraph: Story;
|
|
20
|
+
export declare const review: Story;
|
|
21
|
+
export declare const statusList: Story;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import DynamicFlowSideBySide from '../utils/DynamicFlowSideBySide';
|
|
3
|
+
declare const meta: Meta<typeof DynamicFlowSideBySide>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof DynamicFlowSideBySide>;
|
|
6
|
+
export declare const allOf: Story;
|
|
7
|
+
export declare const array: Story;
|
|
8
|
+
export declare const arrayUpload: Story;
|
|
9
|
+
export declare const blob: Story;
|
|
10
|
+
export declare const boolean: Story;
|
|
11
|
+
export declare const hidden: Story;
|
|
12
|
+
export declare const integer: Story;
|
|
13
|
+
export declare const multiSelect: Story;
|
|
14
|
+
export declare const number: Story;
|
|
15
|
+
export declare const object: Story;
|
|
16
|
+
export declare const oneOf: Story;
|
|
17
|
+
export declare const string: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import DynamicFlowSideBySide from '../utils/DynamicFlowSideBySide';
|
|
3
|
+
declare const meta: Meta<typeof DynamicFlowSideBySide>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof DynamicFlowSideBySide>;
|
|
6
|
+
export declare const basic: Story;
|
|
7
|
+
export declare const globalError: Story;
|
|
8
|
+
export declare const validationError: Story;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client-internal",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.3-experimental-c0e84f1",
|
|
4
4
|
"description": "Dynamic Flow web client for Wise",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.min.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@wise/components-theming": "^1.5.0",
|
|
61
61
|
"babel-jest": "29.7.0",
|
|
62
62
|
"currency-flags": "4.0.7",
|
|
63
|
-
"esbuild": "0.
|
|
63
|
+
"esbuild": "0.23.0",
|
|
64
64
|
"jest": "29.7.0",
|
|
65
65
|
"jest-environment-jsdom": "29.7.0",
|
|
66
66
|
"jest-fetch-mock": "^3.0.3",
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"tsx": "4.15.6",
|
|
81
81
|
"typescript": "5.4.5",
|
|
82
82
|
"webpack": "5.92.0",
|
|
83
|
-
"@wise/dynamic-flow-
|
|
83
|
+
"@wise/dynamic-flow-types": "2.18.3-experimental-c0e84f1",
|
|
84
84
|
"@wise/dynamic-flow-renderers": "0.0.0",
|
|
85
|
-
"@wise/dynamic-flow-
|
|
85
|
+
"@wise/dynamic-flow-fixtures": "0.0.1"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@transferwise/components": "^46.31",
|
|
@@ -96,8 +96,8 @@
|
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"classnames": "2.5.1",
|
|
99
|
-
"@wise/dynamic-flow-client": "3.16.
|
|
100
|
-
"@wise/dynamic-flow-types": "2.18.
|
|
99
|
+
"@wise/dynamic-flow-client": "3.16.3-experimental-c0e84f1",
|
|
100
|
+
"@wise/dynamic-flow-types": "2.18.3-experimental-c0e84f1"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"dev": "pnpm build:visual-tests && storybook dev -p 3005",
|