@hero-design/rn-work-uikit 1.9.5 → 1.10.0
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 +21 -0
- package/README.md +219 -63
- package/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/es/index.js +55337 -0
- package/lib/index.js +7173 -21259
- package/package.json +22 -22
- package/src/components/FormGroup/index.tsx +21 -10
- package/src/components/FormGroup/utils.ts +3 -3
- package/src/components/TextInput/InputRow.tsx +3 -6
- package/src/components/TextInput/index.tsx +4 -4
- package/src/components/TextInput/types.ts +4 -8
- package/types/index.d.ts +525 -0
- package/src/__tests__/index-export.spec.ts +0 -64
- package/src/__tests__/index.spec.tsx +0 -14
- package/src/components/DatePicker/__tests__/__snapshots__/index.spec.tsx.snap +0 -1649
- package/src/components/DatePicker/__tests__/index.spec.tsx +0 -56
- package/src/components/FormGroup/__tests__/__snapshots__/index.spec.tsx.snap +0 -908
- package/src/components/FormGroup/__tests__/index.spec.tsx +0 -319
- package/src/components/FormGroup/__tests__/utils.spec.ts +0 -73
- package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +0 -154
- package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +0 -105
- package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +0 -81
- package/src/components/RichTextEditor/__tests__/RichTextEditorInput.spec.tsx +0 -174
- package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +0 -407
- package/src/components/RichTextEditor/__tests__/__snapshots__/MentionList.spec.tsx.snap +0 -13
- package/src/components/Select/__tests__/__snapshots__/index.spec.tsx.snap +0 -1324
- package/src/components/Select/__tests__/index.spec.tsx +0 -43
- package/src/components/TextInput/__tests__/ErrorOrHelpText.spec.tsx +0 -20
- package/src/components/TextInput/__tests__/FloatingLabel.spec.tsx +0 -190
- package/src/components/TextInput/__tests__/InputComponent.spec.tsx +0 -41
- package/src/components/TextInput/__tests__/InputRow.spec.tsx +0 -233
- package/src/components/TextInput/__tests__/MaxLengthMessage.spec.tsx +0 -17
- package/src/components/TextInput/__tests__/PrefixComponent.spec.tsx +0 -14
- package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +0 -114
- package/src/components/TextInput/__tests__/SuffixComponent.spec.tsx +0 -20
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +0 -583
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +0 -5835
- package/src/components/TextInput/__tests__/getState.spec.tsx +0 -89
- package/src/components/TextInput/__tests__/index.spec.tsx +0 -679
- package/src/components/TimePicker/__tests__/index.spec.tsx +0 -34
- package/src/theme/__tests__/ThemeProvider.spec.tsx +0 -32
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +0 -2042
- package/src/theme/__tests__/index.spec.ts +0 -7
- package/src/utils/__tests__/helpers.spec.ts +0 -92
- package/stats/1.3.0/rn-work-uikit-stats.html +0 -4842
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { getState } from '../index';
|
|
2
|
-
|
|
3
|
-
describe('getState', () => {
|
|
4
|
-
it.each`
|
|
5
|
-
disabled | error | editable | loading | isEmptyValue | expected
|
|
6
|
-
${false} | ${undefined} | ${true} | ${false} | ${true} | ${'default'}
|
|
7
|
-
${false} | ${undefined} | ${true} | ${false} | ${false} | ${'filled'}
|
|
8
|
-
${false} | ${undefined} | ${false} | ${true} | ${true} | ${'readonly'}
|
|
9
|
-
${false} | ${undefined} | ${false} | ${true} | ${false} | ${'readonly'}
|
|
10
|
-
${false} | ${undefined} | ${true} | ${true} | ${true} | ${'readonly'}
|
|
11
|
-
${false} | ${'This field is required'} | ${false} | ${false} | ${true} | ${'error'}
|
|
12
|
-
${false} | ${'This field is required'} | ${false} | ${false} | ${false} | ${'error'}
|
|
13
|
-
${false} | ${'This field is required'} | ${true} | ${false} | ${false} | ${'error'}
|
|
14
|
-
${true} | ${'This field is required'} | ${false} | ${false} | ${true} | ${'disabled'}
|
|
15
|
-
${true} | ${'This field is required'} | ${false} | ${false} | ${false} | ${'disabled'}
|
|
16
|
-
${true} | ${undefined} | ${true} | ${false} | ${true} | ${'disabled'}
|
|
17
|
-
${true} | ${undefined} | ${true} | ${false} | ${false} | ${'disabled'}
|
|
18
|
-
`(
|
|
19
|
-
'should return "$expected" when disabled: $disabled, error: $error, editable: $editable, loading: $loading, isEmptyValue: $isEmptyValue',
|
|
20
|
-
({ disabled, error, editable, loading, isEmptyValue, expected }) => {
|
|
21
|
-
expect(
|
|
22
|
-
getState({
|
|
23
|
-
disabled,
|
|
24
|
-
error,
|
|
25
|
-
editable,
|
|
26
|
-
loading,
|
|
27
|
-
isEmptyValue,
|
|
28
|
-
})
|
|
29
|
-
).toBe(expected);
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
it('should prioritize states in correct order', () => {
|
|
34
|
-
// Disabled takes highest priority
|
|
35
|
-
expect(
|
|
36
|
-
getState({
|
|
37
|
-
disabled: true,
|
|
38
|
-
error: 'Some error',
|
|
39
|
-
editable: false,
|
|
40
|
-
loading: true,
|
|
41
|
-
isEmptyValue: false,
|
|
42
|
-
})
|
|
43
|
-
).toBe('disabled');
|
|
44
|
-
|
|
45
|
-
// Error takes priority over readonly and filled
|
|
46
|
-
expect(
|
|
47
|
-
getState({
|
|
48
|
-
disabled: false,
|
|
49
|
-
error: 'Some error',
|
|
50
|
-
editable: false,
|
|
51
|
-
loading: false,
|
|
52
|
-
isEmptyValue: false,
|
|
53
|
-
})
|
|
54
|
-
).toBe('error');
|
|
55
|
-
|
|
56
|
-
// Readonly takes priority over filled
|
|
57
|
-
expect(
|
|
58
|
-
getState({
|
|
59
|
-
disabled: false,
|
|
60
|
-
error: undefined,
|
|
61
|
-
editable: false,
|
|
62
|
-
loading: false,
|
|
63
|
-
isEmptyValue: false,
|
|
64
|
-
})
|
|
65
|
-
).toBe('readonly');
|
|
66
|
-
|
|
67
|
-
// Filled takes priority over default
|
|
68
|
-
expect(
|
|
69
|
-
getState({
|
|
70
|
-
disabled: false,
|
|
71
|
-
error: undefined,
|
|
72
|
-
editable: true,
|
|
73
|
-
loading: false,
|
|
74
|
-
isEmptyValue: false,
|
|
75
|
-
})
|
|
76
|
-
).toBe('filled');
|
|
77
|
-
|
|
78
|
-
// Default is the fallback
|
|
79
|
-
expect(
|
|
80
|
-
getState({
|
|
81
|
-
disabled: false,
|
|
82
|
-
error: undefined,
|
|
83
|
-
editable: true,
|
|
84
|
-
loading: false,
|
|
85
|
-
isEmptyValue: true,
|
|
86
|
-
})
|
|
87
|
-
).toBe('default');
|
|
88
|
-
});
|
|
89
|
-
});
|