@forge/react 9.2.0-next.4 → 9.2.0-next.5-experimental-cf84ac7
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/CHANGELOG.md +85 -0
- package/out/__test__/hostConfig.test.js +0 -2
- package/out/__test__/inline.test.js +1 -1
- package/out/__test__/reconciler.test.js +36 -72
- package/out/__test__/stack.test.js +1 -1
- package/out/__test__/testUtils.d.ts.map +1 -1
- package/out/components.d.ts +4 -37
- package/out/components.d.ts.map +1 -1
- package/out/components.js +56 -36
- package/out/hooks/__test__/useForm.test.d.ts +2 -0
- package/out/hooks/__test__/useForm.test.d.ts.map +1 -0
- package/out/hooks/__test__/useForm.test.js +36 -0
- package/out/hooks/useForm.d.ts +34 -0
- package/out/hooks/useForm.d.ts.map +1 -0
- package/out/hooks/useForm.js +67 -0
- package/out/index.d.ts +2 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +4 -1
- package/out/package-types.d.ts +19 -0
- package/out/package-types.d.ts.map +1 -0
- package/out/package-types.js +2 -0
- package/out/reconciler.d.ts +2 -11
- package/out/reconciler.d.ts.map +1 -1
- package/out/reconciler.js +21 -64
- package/out/types/icons.d.ts +1 -1
- package/out/types/icons.d.ts.map +1 -1
- package/out/uikit2-components.d.ts +55 -0
- package/out/uikit2-components.d.ts.map +1 -0
- package/out/uikit2-components.js +55 -0
- package/package.json +7 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/out/__test__/defaultReconciler.test.d.ts +0 -2
- package/out/__test__/defaultReconciler.test.d.ts.map +0 -1
- package/out/__test__/defaultReconciler.test.js +0 -51
- package/out/__test__/table.test.d.ts +0 -2
- package/out/__test__/table.test.d.ts.map +0 -1
- package/out/__test__/table.test.js +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
1
|
# @forge/react
|
|
2
2
|
|
|
3
|
+
## 9.2.0-next.5-experimental-cf84ac7
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 634bc31: new components
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- 0c49f46: Removes @forge/bridge and @forge/ui peer dependencies. These packages are not required.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [d36502b]
|
|
16
|
+
- @forge/bridge@3.3.0-next.0-experimental-cf84ac7
|
|
17
|
+
|
|
18
|
+
## 9.2.0-next.5
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- 0c49f46: Removes @forge/bridge and @forge/ui peer dependencies. These packages are not required.
|
|
23
|
+
|
|
24
|
+
## 10.0.0-next.3
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [c5460df]
|
|
29
|
+
- @forge/ui@1.11.0-next.2
|
|
30
|
+
|
|
31
|
+
## 10.0.0-next.2
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [882be11]
|
|
36
|
+
- @forge/ui@1.10.6-next.1
|
|
37
|
+
|
|
38
|
+
## 10.0.0-next.1
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [a6f5ec0]
|
|
43
|
+
- @forge/ui@1.10.6-next.0
|
|
44
|
+
|
|
45
|
+
## 10.0.0-next.0
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [d36502b]
|
|
50
|
+
- @forge/bridge@3.3.0-next.0
|
|
51
|
+
|
|
52
|
+
## 9.2.0
|
|
53
|
+
|
|
54
|
+
### Minor Changes
|
|
55
|
+
|
|
56
|
+
- f922a25: creates useIssueProperty hook for UI kit 2
|
|
57
|
+
|
|
58
|
+
- useIssueProperty:
|
|
59
|
+
- manages a Jira issue's property (via Jira v2 API)
|
|
60
|
+
- requires the following scopes:
|
|
61
|
+
- read:jira-work
|
|
62
|
+
- write:jira-work
|
|
63
|
+
|
|
64
|
+
- be57ee6: Created hooks for the package:
|
|
65
|
+
- useProductContext: outputs the app's environment context via @forge/bridge's view.getContext()
|
|
66
|
+
- useConfig: requests for product environment context and extracts the app's config (if available)
|
|
67
|
+
- c242040: fixes & improvements to property hooks:
|
|
68
|
+
- useIssueProperty: fix comments, optimise concrete value update, remove update auto-retries
|
|
69
|
+
- useIssueProperty, useSpaceProperty, useContentProperty: handle concurrent create attempts by having failed attempt re-fetch property
|
|
70
|
+
- 0cbc4ee: creates useSpaceProperty and useContentProperty hooks for UI kit 2
|
|
71
|
+
|
|
72
|
+
- useSpaceProperty:
|
|
73
|
+
- manages a Confluence space's property (via Confluence v2 API)
|
|
74
|
+
- requires the following scopes:
|
|
75
|
+
- read:space:confluence
|
|
76
|
+
- write:space:confluence
|
|
77
|
+
- useContentProperty
|
|
78
|
+
- manages a Confluence page's property (via Confluence v2 API)
|
|
79
|
+
- requires the following scopes
|
|
80
|
+
- read:page:confluence
|
|
81
|
+
- write:page:confluence
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- Updated dependencies [e7b0327]
|
|
86
|
+
- @forge/ui@1.10.5
|
|
87
|
+
|
|
3
88
|
## 9.2.0-next.4
|
|
4
89
|
|
|
5
90
|
### Minor Changes
|
|
@@ -4,7 +4,6 @@ let keyCount = 0;
|
|
|
4
4
|
jest.mock('uuid', () => (Object.assign(Object.assign({}, jest.requireActual('uuid')), { v4: () => `${keyCount++}` })));
|
|
5
5
|
const reconciler_1 = require("../reconciler");
|
|
6
6
|
const testUtils_1 = require("./testUtils");
|
|
7
|
-
reconciler_1.ReconciliationCounter.getInstance(false);
|
|
8
7
|
const emptyForgeDoc = (0, reconciler_1.createElement)({ type: 'root', props: {} });
|
|
9
8
|
describe('hostConfig used functions', () => {
|
|
10
9
|
let bridgeCalls = [];
|
|
@@ -70,7 +69,6 @@ describe('hostConfig used functions', () => {
|
|
|
70
69
|
expect(reconciler_1.hostConfig.prepareUpdate(instance, 'test', {}, newProps, emptyForgeDoc, null)).toBe(newProps);
|
|
71
70
|
expect(instance).not.toHaveProperty('oldProps');
|
|
72
71
|
expect(instance).toHaveProperty('props', newProps);
|
|
73
|
-
expect(instance).toHaveProperty('reconciliationCount', 2);
|
|
74
72
|
});
|
|
75
73
|
it('shouldSetTextContent returns false', () => {
|
|
76
74
|
expect(reconciler_1.hostConfig.shouldSetTextContent('test', {})).toBe(false);
|
|
@@ -13,7 +13,7 @@ describe('reconciled output', () => {
|
|
|
13
13
|
});
|
|
14
14
|
it('renders Inline ForgeDoc', async () => {
|
|
15
15
|
const Test = () => {
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsxs)(components_1.Inline, Object.assign({
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsxs)(components_1.Inline, Object.assign({ space: "space.500" }, { children: [(0, jsx_runtime_1.jsxs)(components_1.Inline, Object.assign({ alignInline: "start", space: "space.100" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Heading, Object.assign({ as: "h3" }, { children: "Hug" })), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "greyLight", text: "1" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "blueLight", text: "2" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "greenLight", text: "3" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "red", text: "Really looooooooooooooooooong" }), (0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ appearance: "primary", onClick: jest.fn() }, { children: "Button" }))] })), (0, jsx_runtime_1.jsxs)(components_1.Inline, Object.assign({ alignInline: "start", space: "space.100" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Heading, Object.assign({ as: "h3" }, { children: "Fill" })), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "greyLight", text: "1" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "blueLight", text: "2" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "greenLight", text: "3" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "red", text: "Really looooooooooooooooooong" }), (0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ appearance: "primary", onClick: jest.fn() }, { children: "Button" }))] }))] })) }));
|
|
17
17
|
};
|
|
18
18
|
await reconcilerTestRenderer_1.default.create((0, jsx_runtime_1.jsx)(Test, {}));
|
|
19
19
|
const forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
@@ -4,14 +4,16 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
let keyCount = 0;
|
|
6
6
|
jest.mock('uuid', () => (Object.assign(Object.assign({}, jest.requireActual('uuid')), { v4: () => `${keyCount++}` })));
|
|
7
|
+
const resetKeyCount = () => {
|
|
8
|
+
keyCount = 0;
|
|
9
|
+
};
|
|
7
10
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
8
11
|
const reconcilerTestRenderer_1 = tslib_1.__importDefault(require("./reconcilerTestRenderer"));
|
|
9
12
|
const components_1 = require("../components");
|
|
10
13
|
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
11
14
|
const testUtils_1 = require("./testUtils");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
describe('Reconciliation counting', () => {
|
|
15
|
+
describe('Reconcilation', () => {
|
|
16
|
+
resetKeyCount();
|
|
15
17
|
let bridgeCalls = [];
|
|
16
18
|
const TEXT = 0;
|
|
17
19
|
const BUTTON = 1;
|
|
@@ -21,32 +23,27 @@ describe('Reconciliation counting', () => {
|
|
|
21
23
|
bridgeCalls = (0, testUtils_1.setupBridge)();
|
|
22
24
|
const Test = () => {
|
|
23
25
|
const [bool, setBool] = (0, react_1.useState)(false);
|
|
24
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Text, { children: !bool ? 'Loading...' : 'Now loaded...' }), (0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ onClick: () => setBool(true) }, { children: "Click" })), (0, jsx_runtime_1.jsx)(components_1.
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Text, { children: !bool ? 'Loading...' : 'Now loaded...' }), (0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ onClick: () => setBool(true) }, { children: "Click" })), (0, jsx_runtime_1.jsx)(components_1.Lozenge, Object.assign({ appearance: "inprogress" }, { children: "Test" }))] }));
|
|
25
27
|
};
|
|
28
|
+
resetKeyCount();
|
|
26
29
|
await reconcilerTestRenderer_1.default.create((0, jsx_runtime_1.jsx)(Test, {}));
|
|
27
30
|
});
|
|
28
|
-
it('
|
|
31
|
+
it('forgeDoc is created on initial render', () => {
|
|
29
32
|
const forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
30
|
-
expect(forgeDoc).toHaveProperty('reconciliationCount', 1);
|
|
31
33
|
expect(forgeDoc).toHaveProperty(`children[${TEXT}].type`, 'Text');
|
|
32
|
-
expect(forgeDoc).toHaveProperty(`children[${TEXT}].reconciliationCount`, 1);
|
|
33
34
|
expect(forgeDoc).toHaveProperty(`children[${BUTTON}].type`, 'Button');
|
|
34
|
-
expect(forgeDoc).toHaveProperty(`children[${
|
|
35
|
-
expect(forgeDoc).
|
|
36
|
-
expect(forgeDoc).toHaveProperty(`children[${STATIC_TEXT}].reconciliationCount`, 1);
|
|
35
|
+
expect(forgeDoc).toHaveProperty(`children[${STATIC_TEXT}].type`, 'Lozenge');
|
|
36
|
+
expect(forgeDoc).toMatchSnapshot();
|
|
37
37
|
});
|
|
38
|
-
it('
|
|
38
|
+
it('forgeDoc is updated on state update', () => {
|
|
39
39
|
let forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
40
40
|
const onClick = (0, get_1.default)(forgeDoc, `children[${BUTTON}].props.onClick`);
|
|
41
41
|
expect(onClick).not.toBeUndefined();
|
|
42
42
|
onClick();
|
|
43
43
|
forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
44
|
-
expect(forgeDoc).toHaveProperty('reconciliationCount', 2);
|
|
45
|
-
expect(forgeDoc).toHaveProperty(`children[${TEXT}].reconciliationCount`, 1);
|
|
46
44
|
expect(forgeDoc).toHaveProperty(`children[${TEXT}].children[${STRING}].type`, 'String');
|
|
47
|
-
expect(forgeDoc).toHaveProperty(`children[${TEXT}].children[${STRING}].
|
|
48
|
-
expect(forgeDoc).
|
|
49
|
-
expect(forgeDoc).toHaveProperty(`children[${STATIC_TEXT}].reconciliationCount`, 1);
|
|
45
|
+
expect(forgeDoc).toHaveProperty(`children[${TEXT}].children[${STRING}].props.text`, 'Now loaded...');
|
|
46
|
+
expect(forgeDoc).toMatchSnapshot();
|
|
50
47
|
});
|
|
51
48
|
});
|
|
52
49
|
describe('deep tree reconciliation', () => {
|
|
@@ -60,6 +57,7 @@ describe('deep tree reconciliation', () => {
|
|
|
60
57
|
}
|
|
61
58
|
return ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsxs)(components_1.Inline, { children: [(0, jsx_runtime_1.jsx)(components_1.Stack, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: count }) }), (0, jsx_runtime_1.jsxs)(components_1.Stack, { children: [(0, jsx_runtime_1.jsx)(components_1.Text, { children: "Should not update" }), (0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ onClick: incrementCount }, { children: "Click" }))] })] }) }));
|
|
62
59
|
};
|
|
60
|
+
resetKeyCount();
|
|
63
61
|
await reconcilerTestRenderer_1.default.create((0, jsx_runtime_1.jsx)(Test, {}));
|
|
64
62
|
});
|
|
65
63
|
it('should match the initially rendered ForgeDoc snaphot', () => {
|
|
@@ -70,77 +68,43 @@ describe('deep tree reconciliation', () => {
|
|
|
70
68
|
var _a, _b;
|
|
71
69
|
let forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
72
70
|
expect(forgeDoc).not.toBeNull();
|
|
73
|
-
const button = (0, testUtils_1.findElementInForgeDoc)(forgeDoc, '
|
|
71
|
+
const button = (0, testUtils_1.findElementInForgeDoc)(forgeDoc, '7');
|
|
74
72
|
expect(button).not.toBeUndefined();
|
|
75
73
|
expect((_a = button === null || button === void 0 ? void 0 : button.props) === null || _a === void 0 ? void 0 : _a.onClick).not.toBeUndefined();
|
|
76
74
|
(_b = button === null || button === void 0 ? void 0 : button.props) === null || _b === void 0 ? void 0 : _b.onClick();
|
|
77
75
|
forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
78
76
|
expect(forgeDoc).toMatchSnapshot();
|
|
79
77
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
});
|
|
79
|
+
describe('macro config', () => {
|
|
80
|
+
it('should create forgeDoc tree for macro config', async () => {
|
|
81
|
+
const bridgeCalls = (0, testUtils_1.setupBridge)();
|
|
82
|
+
const App = () => {
|
|
83
|
+
return ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "Hello World" }) }));
|
|
84
|
+
};
|
|
85
|
+
const Config = () => {
|
|
86
|
+
return (0, jsx_runtime_1.jsx)(components_1.Textfield, { name: "age" });
|
|
87
|
+
};
|
|
88
|
+
await reconcilerTestRenderer_1.default.create((0, jsx_runtime_1.jsx)(App, {}));
|
|
89
|
+
await reconcilerTestRenderer_1.default.addConfig((0, jsx_runtime_1.jsx)(Config, {}));
|
|
90
|
+
const configForgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
91
|
+
expect(configForgeDoc === null || configForgeDoc === void 0 ? void 0 : configForgeDoc.type).toEqual('MacroConfig');
|
|
92
|
+
expect(configForgeDoc === null || configForgeDoc === void 0 ? void 0 : configForgeDoc.children[0].type).toEqual('Textfield');
|
|
89
93
|
});
|
|
90
94
|
});
|
|
91
|
-
describe('
|
|
95
|
+
describe('id props', () => {
|
|
92
96
|
let bridgeCalls = [];
|
|
93
97
|
beforeAll(async () => {
|
|
94
98
|
bridgeCalls = (0, testUtils_1.setupBridge)();
|
|
95
99
|
const Test = () => {
|
|
96
|
-
|
|
97
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [bool ? (0, jsx_runtime_1.jsx)(components_1.Text, { children: "Text" }) : (0, jsx_runtime_1.jsx)(components_1.Heading, Object.assign({ size: "medium" }, { children: "Text" })), (0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ onClick: () => setBool(!bool) }, { children: "Click" }))] }));
|
|
100
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Label, Object.assign({ labelFor: "username" }, { children: "username" })), (0, jsx_runtime_1.jsx)(components_1.Textfield, { id: "username" }), (0, jsx_runtime_1.jsx)(components_1.DatePicker, { id: "datepicker" })] }));
|
|
98
101
|
};
|
|
99
102
|
await reconcilerTestRenderer_1.default.create((0, jsx_runtime_1.jsx)(Test, {}));
|
|
100
103
|
});
|
|
101
|
-
it('should
|
|
104
|
+
it('should contain a prefix', () => {
|
|
102
105
|
const forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
103
|
-
expect(forgeDoc).
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var _a, _b;
|
|
107
|
-
let forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
108
|
-
expect(forgeDoc).not.toBeNull();
|
|
109
|
-
if (forgeDoc !== null) {
|
|
110
|
-
const button = (0, testUtils_1.findElementInForgeDoc)(forgeDoc, '21');
|
|
111
|
-
expect(button).not.toBeUndefined();
|
|
112
|
-
expect((_a = button === null || button === void 0 ? void 0 : button.props) === null || _a === void 0 ? void 0 : _a.onClick).not.toBeUndefined();
|
|
113
|
-
(_b = button === null || button === void 0 ? void 0 : button.props) === null || _b === void 0 ? void 0 : _b.onClick();
|
|
114
|
-
forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
115
|
-
expect(forgeDoc).toMatchSnapshot();
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
it('should set accurate reconciliation counts for swapped in text and string components', () => {
|
|
119
|
-
const forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
120
|
-
expect(forgeDoc).not.toBeNull();
|
|
121
|
-
if (forgeDoc !== null) {
|
|
122
|
-
const textComponent = (0, testUtils_1.findElementInForgeDoc)(forgeDoc, '23');
|
|
123
|
-
expect(textComponent).not.toBeUndefined();
|
|
124
|
-
expect(textComponent === null || textComponent === void 0 ? void 0 : textComponent.reconciliationCount).toBe(6);
|
|
125
|
-
const stringComponent = (0, testUtils_1.findElementInForgeDoc)(forgeDoc, '22');
|
|
126
|
-
expect(stringComponent).not.toBeUndefined();
|
|
127
|
-
expect(stringComponent === null || stringComponent === void 0 ? void 0 : stringComponent.reconciliationCount).toBe(6);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
describe('macro config', () => {
|
|
131
|
-
it('should create forgeDoc tree for macro config', async () => {
|
|
132
|
-
const bridgeCalls = (0, testUtils_1.setupBridge)();
|
|
133
|
-
const App = () => {
|
|
134
|
-
return ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "Hello World" }) }));
|
|
135
|
-
};
|
|
136
|
-
const Config = () => {
|
|
137
|
-
return (0, jsx_runtime_1.jsx)(components_1.TextField, { name: "age", label: "Age" });
|
|
138
|
-
};
|
|
139
|
-
await reconcilerTestRenderer_1.default.create((0, jsx_runtime_1.jsx)(App, {}));
|
|
140
|
-
await reconcilerTestRenderer_1.default.addConfig((0, jsx_runtime_1.jsx)(Config, {}));
|
|
141
|
-
const configForgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
142
|
-
expect(configForgeDoc === null || configForgeDoc === void 0 ? void 0 : configForgeDoc.type).toEqual('MacroConfig');
|
|
143
|
-
expect(configForgeDoc === null || configForgeDoc === void 0 ? void 0 : configForgeDoc.children[0].type).toEqual('TextField');
|
|
144
|
-
});
|
|
106
|
+
expect(forgeDoc).toHaveProperty('children[0].props.labelFor', 'forge-app-0-username');
|
|
107
|
+
expect(forgeDoc).toHaveProperty('children[1].props.id', 'forge-app-0-username');
|
|
108
|
+
expect(forgeDoc).toHaveProperty('children[2].props.id', 'forge-app-0-datepicker');
|
|
145
109
|
});
|
|
146
110
|
});
|
|
@@ -13,7 +13,7 @@ describe('reconciled output', () => {
|
|
|
13
13
|
});
|
|
14
14
|
it('renders Stack ForgeDoc', async () => {
|
|
15
15
|
const Test = () => {
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsxs)(components_1.Stack, Object.assign({ space: "space.200" }, { children: [(0, jsx_runtime_1.jsxs)(components_1.Stack, Object.assign({ space: "space.100" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Heading, Object.assign({
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsxs)(components_1.Stack, Object.assign({ space: "space.200" }, { children: [(0, jsx_runtime_1.jsxs)(components_1.Stack, Object.assign({ space: "space.100" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Heading, Object.assign({ as: "h3" }, { children: "default align" })), (0, jsx_runtime_1.jsxs)(components_1.Stack, Object.assign({ space: "space.100" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Tag, { color: "greyLight", text: "1" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "blueLight", text: "2" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "greenLight", text: "3" })] }))] })), (0, jsx_runtime_1.jsxs)(components_1.Stack, Object.assign({ space: "space.100" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Heading, Object.assign({ as: "h3" }, { children: "start align" })), (0, jsx_runtime_1.jsxs)(components_1.Stack, Object.assign({ space: "space.100", alignInline: "start" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Tag, { color: "greyLight", text: "1" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "blueLight", text: "2" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "greenLight", text: "3" })] }))] })), (0, jsx_runtime_1.jsxs)(components_1.Stack, Object.assign({ space: "space.100" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Heading, Object.assign({ as: "h3" }, { children: "center align" })), (0, jsx_runtime_1.jsxs)(components_1.Stack, Object.assign({ space: "space.100", alignInline: "center" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Tag, { color: "greyLight", text: "1" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "blueLight", text: "2" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "greenLight", text: "3" })] }))] })), (0, jsx_runtime_1.jsxs)(components_1.Stack, Object.assign({ space: "space.100" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Heading, Object.assign({ as: "h3" }, { children: "end align" })), (0, jsx_runtime_1.jsxs)(components_1.Stack, Object.assign({ space: "space.100", alignInline: "end" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Tag, { color: "greyLight", text: "1" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "blueLight", text: "2" }), (0, jsx_runtime_1.jsx)(components_1.Tag, { color: "greenLight", text: "3" })] }))] }))] })) }));
|
|
17
17
|
};
|
|
18
18
|
await reconcilerTestRenderer_1.default.create((0, jsx_runtime_1.jsx)(Test, {}));
|
|
19
19
|
const forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../../src/__test__/testUtils.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../../src/__test__/testUtils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,oBAAY,UAAU,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC;AAC/D,aAAK,WAAW,GAAG,MAAM,UAAU,EAAE,CAAC;AAEtC,aAAK,iBAAiB,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,UAAU,GAAG,IAAI,CAAC;AAC1E,aAAK,yBAAyB,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,QAAQ,GAAG,IAAI,CAAC;AAChF,aAAK,qBAAqB,GAAG,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS,CAAC;AAE9F,aAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAMF,eAAO,MAAM,WAAW,EAAE,WAYzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,iBAK/B,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,yBAMvC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,qBAkBnC,CAAC"}
|
package/out/components.d.ts
CHANGED
|
@@ -1,46 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NativeCodeProps, NativeStatusLozengeProps, NativeTagProps } from './types';
|
|
1
|
+
import { ForgeElement, MarkupProps, NativeImageProps as ImageProps, NativeLinkProps as LinkProps, NativeTextProps as TextProps, NativeUserPickerProps as UserPickerProps, UserGroupProps, UserProps } from './types';
|
|
3
2
|
export { UserPickerValue } from './types';
|
|
4
|
-
export declare const Button: (props: ButtonProps) => ForgeElement;
|
|
5
|
-
export declare const Checkbox: (props: CheckboxProps) => ForgeElement;
|
|
6
|
-
export declare const CheckboxGroup: (props: CheckboxGroupProps) => ForgeElement;
|
|
7
|
-
export declare const DatePicker: (props: DatePickerProps) => ForgeElement;
|
|
8
|
-
export declare const Form: <T extends FormData>(props: FormProps<T>) => ForgeElement;
|
|
9
3
|
export declare const Image: (props: ImageProps) => ForgeElement;
|
|
10
|
-
export declare const Inline: (props: InlineProps) => ForgeElement;
|
|
11
4
|
export declare const Link: (props: LinkProps) => ForgeElement;
|
|
12
|
-
export declare const ModalDialog: (props: ModalDialogProps) => ForgeElement;
|
|
13
|
-
export declare const RadioGroup: (props: RadioGroupProps) => ForgeElement;
|
|
14
|
-
export declare const Range: (props: RangeProps) => ForgeElement;
|
|
15
|
-
export declare const Select: (props: SelectProps) => ForgeElement;
|
|
16
|
-
export declare const Stack: (props: StackProps) => ForgeElement;
|
|
17
5
|
export declare const Text: (props: TextProps) => ForgeElement;
|
|
18
|
-
export declare const TextArea: (props: TextAreaProps) => ForgeElement;
|
|
19
|
-
export declare const TextField: (props: TextFieldProps) => ForgeElement;
|
|
20
|
-
export declare const Toggle: (props: ToggleProps) => ForgeElement;
|
|
21
6
|
export declare const UserPicker: (props: UserPickerProps) => ForgeElement;
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
24
|
-
export declare const Code: (props: NativeCodeProps) => ForgeElement;
|
|
25
|
-
export declare const DateLozenge: (props: DateLozengeProps) => ForgeElement;
|
|
26
|
-
export declare const Heading: (props: HeadingProps) => ForgeElement;
|
|
27
|
-
export declare const InlineDialog: (props: InlineDialogProps) => ForgeElement;
|
|
28
|
-
export declare const Option: (props: OptionProps) => ForgeElement;
|
|
29
|
-
export declare const Radio: (props: RadioProps) => ForgeElement;
|
|
30
|
-
export declare const SectionMessage: (props: SectionMessageProps) => ForgeElement;
|
|
31
|
-
export declare const StatusLozenge: (props: NativeStatusLozengeProps) => ForgeElement;
|
|
32
|
-
export declare const Tooltip: (props: TooltipProps) => ForgeElement;
|
|
7
|
+
export declare const User: (props: UserProps) => ForgeElement;
|
|
8
|
+
export declare const UserGroup: (props: UserGroupProps) => ForgeElement;
|
|
33
9
|
export declare const Em: (props: MarkupProps) => ForgeElement;
|
|
34
10
|
export declare const Strike: (props: MarkupProps) => ForgeElement;
|
|
35
11
|
export declare const Strong: (props: MarkupProps) => ForgeElement;
|
|
36
|
-
export
|
|
37
|
-
export declare const Tabs: (props: TabsProps) => ForgeElement;
|
|
38
|
-
export declare const Cell: (props: CellProps) => ForgeElement;
|
|
39
|
-
export declare const Head: (props: HeadProps) => ForgeElement;
|
|
40
|
-
export declare const Row: (props: RowProps) => ForgeElement;
|
|
41
|
-
export declare const Table: (props: TableProps) => ForgeElement;
|
|
42
|
-
export declare const Tag: (props: NativeTagProps) => ForgeElement;
|
|
43
|
-
export declare const TagGroup: (props: TagGroupProps) => ForgeElement;
|
|
44
|
-
export declare const User: (props: UserProps) => ForgeElement;
|
|
45
|
-
export declare const UserGroup: (props: UserGroupProps) => ForgeElement;
|
|
12
|
+
export { Badge, Bleed, Box, Button, ButtonGroup, Checkbox, Code, CodeBlock, DatePicker, DynamicTable, ErrorMessage, Flex, Form, FormFooter, FormHeader, FormSection, Grid, Heading, HelperMessage, Inline, Label, LinkButton, LoadingButton, Lozenge, Modal, ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition, ProgressBar, ProgressTracker, Radio, RadioGroup, Range, RequiredAsterisk, SectionMessage, SectionMessageAction, Spinner, Stack, Tab, TabList, TabPanel, Tabs, Tag, TagGroup, TextArea, Textfield, Toggle, Tooltip, ValidMessage } from './uikit2-components';
|
|
46
13
|
//# sourceMappingURL=components.d.ts.map
|
package/out/components.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,gBAAgB,IAAI,UAAU,EAC9B,eAAe,IAAI,SAAS,EAC5B,eAAe,IAAI,SAAS,EAC5B,qBAAqB,IAAI,eAAe,EACxC,cAAc,EACd,SAAS,EACV,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,KAAK,UAAiC,UAAU,KAAK,YAAY,CAAC;AAC/E,eAAO,MAAM,IAAI,UAAgC,SAAS,KAAK,YAAY,CAAC;AAC5E,eAAO,MAAM,IAAI,UAAgC,SAAS,KAAK,YAAY,CAAC;AAC5E,eAAO,MAAM,UAAU,UAAsC,eAAe,KAAK,YAAY,CAAC;AAC9F,eAAO,MAAM,IAAI,UAAgC,SAAS,KAAK,YAAY,CAAC;AAC5E,eAAO,MAAM,SAAS,UAAqC,cAAc,KAAK,YAAY,CAAC;AAE3F,eAAO,MAAM,EAAE,UAA8B,WAAW,KAAK,YAAY,CAAC;AAC1E,eAAO,MAAM,MAAM,UAAkC,WAAW,KAAK,YAAY,CAAC;AAClF,eAAO,MAAM,MAAM,UAAkC,WAAW,KAAK,YAAY,CAAC;AAKlF,OAAO,EACL,KAAK,EACL,KAAK,EACL,GAAG,EACH,MAAM,EACN,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,UAAU,EACV,WAAW,EACX,IAAI,EACJ,OAAO,EACP,aAAa,EACb,MAAM,EACN,KAAK,EACL,UAAU,EACV,aAAa,EACb,OAAO,EACP,KAAK,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,EACV,eAAe,EACf,WAAW,EACX,eAAe,EACf,KAAK,EACL,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,OAAO,EACP,KAAK,EACL,GAAG,EACH,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,YAAY,EACb,MAAM,qBAAqB,CAAC"}
|
package/out/components.js
CHANGED
|
@@ -1,45 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.Checkbox = 'Checkbox';
|
|
6
|
-
exports.CheckboxGroup = 'CheckboxGroup';
|
|
7
|
-
exports.DatePicker = 'DatePicker';
|
|
8
|
-
exports.Form = 'Form';
|
|
3
|
+
exports.Tab = exports.Stack = exports.Spinner = exports.SectionMessageAction = exports.SectionMessage = exports.RequiredAsterisk = exports.Range = exports.RadioGroup = exports.Radio = exports.ProgressTracker = exports.ProgressBar = exports.ModalTransition = exports.ModalTitle = exports.ModalHeader = exports.ModalFooter = exports.ModalBody = exports.Modal = exports.Lozenge = exports.LoadingButton = exports.LinkButton = exports.Label = exports.Inline = exports.HelperMessage = exports.Heading = exports.Grid = exports.FormSection = exports.FormHeader = exports.FormFooter = exports.Form = exports.Flex = exports.ErrorMessage = exports.DynamicTable = exports.DatePicker = exports.CodeBlock = exports.Code = exports.Checkbox = exports.ButtonGroup = exports.Button = exports.Box = exports.Bleed = exports.Badge = exports.Strong = exports.Strike = exports.Em = exports.UserGroup = exports.User = exports.UserPicker = exports.Text = exports.Link = exports.Image = void 0;
|
|
4
|
+
exports.ValidMessage = exports.Tooltip = exports.Toggle = exports.Textfield = exports.TextArea = exports.TagGroup = exports.Tag = exports.Tabs = exports.TabPanel = exports.TabList = void 0;
|
|
9
5
|
exports.Image = 'Image';
|
|
10
|
-
exports.Inline = 'Inline';
|
|
11
6
|
exports.Link = 'Link';
|
|
12
|
-
exports.ModalDialog = 'ModalDialog';
|
|
13
|
-
exports.RadioGroup = 'RadioGroup';
|
|
14
|
-
exports.Range = 'Range';
|
|
15
|
-
exports.Select = 'Select';
|
|
16
|
-
exports.Stack = 'Stack';
|
|
17
7
|
exports.Text = 'Text';
|
|
18
|
-
exports.TextArea = 'TextArea';
|
|
19
|
-
exports.TextField = 'TextField';
|
|
20
|
-
exports.Toggle = 'Toggle';
|
|
21
8
|
exports.UserPicker = 'UserPicker';
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.Code = 'Code';
|
|
25
|
-
exports.DateLozenge = 'DateLozenge';
|
|
26
|
-
exports.Heading = 'Heading';
|
|
27
|
-
exports.InlineDialog = 'InlineDialog';
|
|
28
|
-
exports.Option = 'Option';
|
|
29
|
-
exports.Radio = 'Radio';
|
|
30
|
-
exports.SectionMessage = 'SectionMessage';
|
|
31
|
-
exports.StatusLozenge = 'StatusLozenge';
|
|
32
|
-
exports.Tooltip = 'Tooltip';
|
|
9
|
+
exports.User = 'User';
|
|
10
|
+
exports.UserGroup = 'UserGroup';
|
|
33
11
|
exports.Em = 'Em';
|
|
34
12
|
exports.Strike = 'Strike';
|
|
35
13
|
exports.Strong = 'Strong';
|
|
36
|
-
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
14
|
+
var uikit2_components_1 = require("./uikit2-components");
|
|
15
|
+
Object.defineProperty(exports, "Badge", { enumerable: true, get: function () { return uikit2_components_1.Badge; } });
|
|
16
|
+
Object.defineProperty(exports, "Bleed", { enumerable: true, get: function () { return uikit2_components_1.Bleed; } });
|
|
17
|
+
Object.defineProperty(exports, "Box", { enumerable: true, get: function () { return uikit2_components_1.Box; } });
|
|
18
|
+
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return uikit2_components_1.Button; } });
|
|
19
|
+
Object.defineProperty(exports, "ButtonGroup", { enumerable: true, get: function () { return uikit2_components_1.ButtonGroup; } });
|
|
20
|
+
Object.defineProperty(exports, "Checkbox", { enumerable: true, get: function () { return uikit2_components_1.Checkbox; } });
|
|
21
|
+
Object.defineProperty(exports, "Code", { enumerable: true, get: function () { return uikit2_components_1.Code; } });
|
|
22
|
+
Object.defineProperty(exports, "CodeBlock", { enumerable: true, get: function () { return uikit2_components_1.CodeBlock; } });
|
|
23
|
+
Object.defineProperty(exports, "DatePicker", { enumerable: true, get: function () { return uikit2_components_1.DatePicker; } });
|
|
24
|
+
Object.defineProperty(exports, "DynamicTable", { enumerable: true, get: function () { return uikit2_components_1.DynamicTable; } });
|
|
25
|
+
Object.defineProperty(exports, "ErrorMessage", { enumerable: true, get: function () { return uikit2_components_1.ErrorMessage; } });
|
|
26
|
+
Object.defineProperty(exports, "Flex", { enumerable: true, get: function () { return uikit2_components_1.Flex; } });
|
|
27
|
+
Object.defineProperty(exports, "Form", { enumerable: true, get: function () { return uikit2_components_1.Form; } });
|
|
28
|
+
Object.defineProperty(exports, "FormFooter", { enumerable: true, get: function () { return uikit2_components_1.FormFooter; } });
|
|
29
|
+
Object.defineProperty(exports, "FormHeader", { enumerable: true, get: function () { return uikit2_components_1.FormHeader; } });
|
|
30
|
+
Object.defineProperty(exports, "FormSection", { enumerable: true, get: function () { return uikit2_components_1.FormSection; } });
|
|
31
|
+
Object.defineProperty(exports, "Grid", { enumerable: true, get: function () { return uikit2_components_1.Grid; } });
|
|
32
|
+
Object.defineProperty(exports, "Heading", { enumerable: true, get: function () { return uikit2_components_1.Heading; } });
|
|
33
|
+
Object.defineProperty(exports, "HelperMessage", { enumerable: true, get: function () { return uikit2_components_1.HelperMessage; } });
|
|
34
|
+
Object.defineProperty(exports, "Inline", { enumerable: true, get: function () { return uikit2_components_1.Inline; } });
|
|
35
|
+
Object.defineProperty(exports, "Label", { enumerable: true, get: function () { return uikit2_components_1.Label; } });
|
|
36
|
+
Object.defineProperty(exports, "LinkButton", { enumerable: true, get: function () { return uikit2_components_1.LinkButton; } });
|
|
37
|
+
Object.defineProperty(exports, "LoadingButton", { enumerable: true, get: function () { return uikit2_components_1.LoadingButton; } });
|
|
38
|
+
Object.defineProperty(exports, "Lozenge", { enumerable: true, get: function () { return uikit2_components_1.Lozenge; } });
|
|
39
|
+
Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return uikit2_components_1.Modal; } });
|
|
40
|
+
Object.defineProperty(exports, "ModalBody", { enumerable: true, get: function () { return uikit2_components_1.ModalBody; } });
|
|
41
|
+
Object.defineProperty(exports, "ModalFooter", { enumerable: true, get: function () { return uikit2_components_1.ModalFooter; } });
|
|
42
|
+
Object.defineProperty(exports, "ModalHeader", { enumerable: true, get: function () { return uikit2_components_1.ModalHeader; } });
|
|
43
|
+
Object.defineProperty(exports, "ModalTitle", { enumerable: true, get: function () { return uikit2_components_1.ModalTitle; } });
|
|
44
|
+
Object.defineProperty(exports, "ModalTransition", { enumerable: true, get: function () { return uikit2_components_1.ModalTransition; } });
|
|
45
|
+
Object.defineProperty(exports, "ProgressBar", { enumerable: true, get: function () { return uikit2_components_1.ProgressBar; } });
|
|
46
|
+
Object.defineProperty(exports, "ProgressTracker", { enumerable: true, get: function () { return uikit2_components_1.ProgressTracker; } });
|
|
47
|
+
Object.defineProperty(exports, "Radio", { enumerable: true, get: function () { return uikit2_components_1.Radio; } });
|
|
48
|
+
Object.defineProperty(exports, "RadioGroup", { enumerable: true, get: function () { return uikit2_components_1.RadioGroup; } });
|
|
49
|
+
Object.defineProperty(exports, "Range", { enumerable: true, get: function () { return uikit2_components_1.Range; } });
|
|
50
|
+
Object.defineProperty(exports, "RequiredAsterisk", { enumerable: true, get: function () { return uikit2_components_1.RequiredAsterisk; } });
|
|
51
|
+
Object.defineProperty(exports, "SectionMessage", { enumerable: true, get: function () { return uikit2_components_1.SectionMessage; } });
|
|
52
|
+
Object.defineProperty(exports, "SectionMessageAction", { enumerable: true, get: function () { return uikit2_components_1.SectionMessageAction; } });
|
|
53
|
+
Object.defineProperty(exports, "Spinner", { enumerable: true, get: function () { return uikit2_components_1.Spinner; } });
|
|
54
|
+
Object.defineProperty(exports, "Stack", { enumerable: true, get: function () { return uikit2_components_1.Stack; } });
|
|
55
|
+
Object.defineProperty(exports, "Tab", { enumerable: true, get: function () { return uikit2_components_1.Tab; } });
|
|
56
|
+
Object.defineProperty(exports, "TabList", { enumerable: true, get: function () { return uikit2_components_1.TabList; } });
|
|
57
|
+
Object.defineProperty(exports, "TabPanel", { enumerable: true, get: function () { return uikit2_components_1.TabPanel; } });
|
|
58
|
+
Object.defineProperty(exports, "Tabs", { enumerable: true, get: function () { return uikit2_components_1.Tabs; } });
|
|
59
|
+
Object.defineProperty(exports, "Tag", { enumerable: true, get: function () { return uikit2_components_1.Tag; } });
|
|
60
|
+
Object.defineProperty(exports, "TagGroup", { enumerable: true, get: function () { return uikit2_components_1.TagGroup; } });
|
|
61
|
+
Object.defineProperty(exports, "TextArea", { enumerable: true, get: function () { return uikit2_components_1.TextArea; } });
|
|
62
|
+
Object.defineProperty(exports, "Textfield", { enumerable: true, get: function () { return uikit2_components_1.Textfield; } });
|
|
63
|
+
Object.defineProperty(exports, "Toggle", { enumerable: true, get: function () { return uikit2_components_1.Toggle; } });
|
|
64
|
+
Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return uikit2_components_1.Tooltip; } });
|
|
65
|
+
Object.defineProperty(exports, "ValidMessage", { enumerable: true, get: function () { return uikit2_components_1.ValidMessage; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForm.test.d.ts","sourceRoot":"","sources":["../../../src/hooks/__test__/useForm.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_hooks_1 = require("@testing-library/react-hooks");
|
|
4
|
+
const useForm_1 = require("../useForm");
|
|
5
|
+
jest.mock('react', () => (Object.assign(Object.assign({}, jest.requireActual('react')), { useId: jest.fn().mockReturnValue('mocked-id') })));
|
|
6
|
+
describe('useForm with no default values', () => {
|
|
7
|
+
const { result } = (0, react_hooks_1.renderHook)(() => (0, useForm_1.useForm)());
|
|
8
|
+
it('register should return an id', () => {
|
|
9
|
+
const { register } = result.current;
|
|
10
|
+
const fieldProps = register('username');
|
|
11
|
+
expect(fieldProps.id).toBe('form-mocked-id-username');
|
|
12
|
+
});
|
|
13
|
+
it('register should return isDisabled as true', () => {
|
|
14
|
+
const { register } = result.current;
|
|
15
|
+
const fieldProps = register('username', { disabled: true });
|
|
16
|
+
expect(fieldProps.isDisabled).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
it('getFieldId should return the correct id', () => {
|
|
19
|
+
const { getFieldId } = result.current;
|
|
20
|
+
const fieldId = getFieldId('username');
|
|
21
|
+
expect(fieldId).toBe('form-mocked-id-username');
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe('useForm with default values', () => {
|
|
25
|
+
const { result } = (0, react_hooks_1.renderHook)(() => (0, useForm_1.useForm)({ defaultValues: { checkbox: true, textfield: 'test' } }));
|
|
26
|
+
it('boolean default values should pass a defaultChecked prop', () => {
|
|
27
|
+
const { register } = result.current;
|
|
28
|
+
const fieldProps = register('checkbox');
|
|
29
|
+
expect(fieldProps.defaultChecked).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
it('non boolean values should pass a defaultValue prop', () => {
|
|
32
|
+
const { register } = result.current;
|
|
33
|
+
const fieldProps = register('textfield');
|
|
34
|
+
expect(fieldProps.defaultValue).toBe('test');
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FieldValues, UseFormProps, FieldPath, RegisterOptions, UseFormRegisterReturn } from 'react-hook-form';
|
|
2
|
+
declare type ForgeOnChangeHandler = (event: {
|
|
3
|
+
target: any;
|
|
4
|
+
type?: string;
|
|
5
|
+
} | any) => void;
|
|
6
|
+
declare type ForgeFormRegister = Omit<UseFormRegisterReturn, 'ref' | 'required' | 'disabled' | 'onChange'> & {
|
|
7
|
+
onChange: ForgeOnChangeHandler;
|
|
8
|
+
id: string;
|
|
9
|
+
defaultValue?: unknown;
|
|
10
|
+
defaultChecked?: boolean;
|
|
11
|
+
isRequired?: boolean;
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
isInvalid?: boolean;
|
|
14
|
+
'aria-invalid'?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function useForm<TFieldValues extends FieldValues = FieldValues>(props?: Pick<UseFormProps<TFieldValues>, 'defaultValues'>): {
|
|
17
|
+
getFieldId: (fieldName: string) => string;
|
|
18
|
+
register: (fieldName: FieldPath<TFieldValues>, options?: Pick<RegisterOptions<TFieldValues, FieldPath<TFieldValues>>, 'disabled' | 'required' | 'maxLength' | 'minLength' | 'max' | 'min' | 'pattern' | 'validate'>) => ForgeFormRegister;
|
|
19
|
+
formState: {
|
|
20
|
+
errors: import("react-hook-form").FieldErrors<TFieldValues>;
|
|
21
|
+
isSubmitted: boolean;
|
|
22
|
+
isSubmitSuccessful: boolean;
|
|
23
|
+
isSubmitting: boolean;
|
|
24
|
+
submitCount: number;
|
|
25
|
+
isValid: boolean;
|
|
26
|
+
dirtyFields: Partial<Readonly<import("react-hook-form").DeepMap<import("react-hook-form").DeepPartial<TFieldValues>, boolean>>>;
|
|
27
|
+
};
|
|
28
|
+
handleSubmit: import("react-hook-form").UseFormHandleSubmit<TFieldValues, TFieldValues>;
|
|
29
|
+
getValues: import("react-hook-form").UseFormGetValues<TFieldValues>;
|
|
30
|
+
trigger: import("react-hook-form").UseFormTrigger<TFieldValues>;
|
|
31
|
+
clearErrors: import("react-hook-form").UseFormClearErrors<TFieldValues>;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=useForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../src/hooks/useForm.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,eAAe,EACf,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAGzB,aAAK,oBAAoB,GAAG,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,GAAG,KAAK,IAAI,CAAC;AAElF,aAAK,iBAAiB,GAAG,IAAI,CAAC,qBAAqB,EAAE,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC,GAAG;IACnG,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAgB,OAAO,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,EACpE,KAAK,GAAE,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,eAAe,CAAM;4BAI9B,MAAM;0BAmBxB,UAAU,YAAY,CAAC,YACxB,KACR,gBAAgB,YAAY,EAAE,UAAU,YAAY,CAAC,CAAC,EACtD,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU,CAC7F,KACA,iBAAiB;;;;;;;;;;;;;;EA4ErB"}
|