@descope/flow-components 2.0.38 → 2.0.40

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.
Files changed (157) hide show
  1. package/dist/index.cjs.js +1 -93
  2. package/dist/index.d.ts +2 -54
  3. package/dist/index.esm.js +2 -92
  4. package/package.json +8 -9
  5. package/.eslintrc +0 -119
  6. package/.github/actions/setup/action.yml +0 -42
  7. package/.github/workflows/ci.yml +0 -105
  8. package/.github/workflows/publish.yml +0 -41
  9. package/.github/workflows/release.yml +0 -44
  10. package/.husky/pre-commit +0 -1
  11. package/.prettierrc +0 -8
  12. package/.storybook/main.js +0 -23
  13. package/.storybook/manager.js +0 -10
  14. package/.storybook/preview-head.html +0 -29
  15. package/.storybook/preview.js +0 -44
  16. package/LICENSE +0 -21
  17. package/babel.config.js +0 -7
  18. package/jest.config.js +0 -33
  19. package/jest.setup.js +0 -2
  20. package/renovate.json +0 -4
  21. package/rollup.config.mjs +0 -47
  22. package/src/Boolean/Boolean.tsx +0 -24
  23. package/src/Boolean/index.ts +0 -1
  24. package/src/Button/Button.tsx +0 -49
  25. package/src/Button/index.ts +0 -1
  26. package/src/Checkbox/Checkbox.tsx +0 -16
  27. package/src/Checkbox/index.ts +0 -1
  28. package/src/Code/Code.tsx +0 -21
  29. package/src/Code/index.ts +0 -1
  30. package/src/Container/Container.tsx +0 -111
  31. package/src/Container/index.ts +0 -1
  32. package/src/CssVarImage/CssVarImage.tsx +0 -38
  33. package/src/CssVarImage/index.ts +0 -1
  34. package/src/Divider/Divider.tsx +0 -33
  35. package/src/Divider/index.ts +0 -1
  36. package/src/EmailField/EmailField.tsx +0 -20
  37. package/src/EmailField/index.ts +0 -1
  38. package/src/Image/Image.tsx +0 -32
  39. package/src/Image/index.ts +0 -1
  40. package/src/Input/Input.tsx +0 -27
  41. package/src/Input/index.ts +0 -1
  42. package/src/Link/Link.tsx +0 -33
  43. package/src/Link/index.ts +0 -1
  44. package/src/Loader/Loader.tsx +0 -40
  45. package/src/Loader/index.ts +0 -1
  46. package/src/Logo/Logo.tsx +0 -27
  47. package/src/Logo/index.ts +0 -1
  48. package/src/NewPassword/NewPassword.tsx +0 -25
  49. package/src/NewPassword/index.ts +0 -1
  50. package/src/NumberField/NumberField.tsx +0 -20
  51. package/src/NumberField/index.ts +0 -1
  52. package/src/Password/Password.tsx +0 -20
  53. package/src/Password/index.ts +0 -1
  54. package/src/Phone/Phone.tsx +0 -22
  55. package/src/Phone/index.ts +0 -1
  56. package/src/Select/Select.tsx +0 -29
  57. package/src/Select/index.ts +0 -1
  58. package/src/Switch/Switch.tsx +0 -21
  59. package/src/Switch/index.ts +0 -1
  60. package/src/TOTPImage/TOTPImage.tsx +0 -18
  61. package/src/TOTPImage/index.ts +0 -1
  62. package/src/TOTPLink/TOTPLink.tsx +0 -16
  63. package/src/TOTPLink/index.ts +0 -1
  64. package/src/Text/Text.tsx +0 -36
  65. package/src/Text/index.ts +0 -1
  66. package/src/TextField/TextField.tsx +0 -20
  67. package/src/TextField/index.ts +0 -1
  68. package/src/Textarea/Textarea.tsx +0 -20
  69. package/src/Textarea/index.ts +0 -1
  70. package/src/icons/apple.tsx +0 -14
  71. package/src/icons/discord.tsx +0 -14
  72. package/src/icons/facebook.tsx +0 -14
  73. package/src/icons/fingerprint.tsx +0 -14
  74. package/src/icons/github.tsx +0 -14
  75. package/src/icons/gitlab.tsx +0 -41
  76. package/src/icons/google.tsx +0 -29
  77. package/src/icons/index.ts +0 -11
  78. package/src/icons/input-hidden.tsx +0 -17
  79. package/src/icons/input-visible.tsx +0 -17
  80. package/src/icons/linkedin.tsx +0 -18
  81. package/src/icons/microsoft.tsx +0 -41
  82. package/src/icons/passkey.tsx +0 -16
  83. package/src/icons/sso.tsx +0 -14
  84. package/src/index.ts +0 -29
  85. package/src/inputHelpers.ts +0 -41
  86. package/src/themeToCssVars/constants.ts +0 -13
  87. package/src/themeToCssVars/index.ts +0 -153
  88. package/src/themeToCssVars/types.ts +0 -56
  89. package/src/types.ts +0 -52
  90. package/src/utils.tsx +0 -69
  91. package/stories/Boolean.stories.jsx +0 -37
  92. package/stories/Button.stories.jsx +0 -71
  93. package/stories/Checkbox.stories.jsx +0 -29
  94. package/stories/Code.stories.jsx +0 -60
  95. package/stories/Container.stories.jsx +0 -53
  96. package/stories/Divider.stories.jsx +0 -23
  97. package/stories/EmailField.stories.jsx +0 -36
  98. package/stories/Image.stories.jsx +0 -16
  99. package/stories/Input.stories.jsx +0 -63
  100. package/stories/Link.stories.jsx +0 -21
  101. package/stories/Loader.stories.jsx +0 -34
  102. package/stories/Logo.stories.jsx +0 -14
  103. package/stories/NewPassword.stories.jsx +0 -52
  104. package/stories/NumberField.stories.jsx +0 -35
  105. package/stories/Password.stories.jsx +0 -37
  106. package/stories/Phone.stories.jsx +0 -61
  107. package/stories/Switch.stories.jsx +0 -29
  108. package/stories/TOTPImage.stories.jsx +0 -22
  109. package/stories/TOTPLink.stories.jsx +0 -20
  110. package/stories/Text.stories.jsx +0 -35
  111. package/stories/TextField.stories.jsx +0 -39
  112. package/stories/Textarea.stories.jsx +0 -25
  113. package/storybook-static/favicon.ico +0 -0
  114. package/test/__snapshots__/boolean.test.tsx.snap +0 -47
  115. package/test/__snapshots__/buttons.test.tsx.snap +0 -843
  116. package/test/__snapshots__/checkbox.test.tsx.snap +0 -51
  117. package/test/__snapshots__/code.test.tsx.snap +0 -1184
  118. package/test/__snapshots__/container.test.tsx.snap +0 -218
  119. package/test/__snapshots__/divider.test.tsx.snap +0 -73
  120. package/test/__snapshots__/image.test.tsx.snap +0 -62
  121. package/test/__snapshots__/input.test.tsx.snap +0 -80
  122. package/test/__snapshots__/link.test.tsx.snap +0 -120
  123. package/test/__snapshots__/loader.test.tsx.snap +0 -53
  124. package/test/__snapshots__/logo.test.tsx.snap +0 -10
  125. package/test/__snapshots__/newPassword.test.tsx.snap +0 -69
  126. package/test/__snapshots__/numeric-input.test.tsx.snap +0 -21
  127. package/test/__snapshots__/password.test.tsx.snap +0 -26
  128. package/test/__snapshots__/phone.test.tsx.snap +0 -504
  129. package/test/__snapshots__/switch.test.tsx.snap +0 -51
  130. package/test/__snapshots__/text.test.tsx.snap +0 -89
  131. package/test/__snapshots__/textarea.test.tsx.snap +0 -73
  132. package/test/__snapshots__/themeToCssVars.test.ts.snap +0 -45
  133. package/test/__snapshots__/totpImage.test.tsx.snap +0 -10
  134. package/test/__snapshots__/totpLink.test.tsx.snap +0 -13
  135. package/test/boolean.test.tsx +0 -28
  136. package/test/buttons.test.tsx +0 -66
  137. package/test/checkbox.test.tsx +0 -67
  138. package/test/code.test.tsx +0 -182
  139. package/test/container.test.tsx +0 -91
  140. package/test/divider.test.tsx +0 -50
  141. package/test/image.test.tsx +0 -40
  142. package/test/input.test.tsx +0 -82
  143. package/test/inputHelpers.test.tsx +0 -58
  144. package/test/link.test.tsx +0 -71
  145. package/test/loader.test.tsx +0 -25
  146. package/test/logo.test.tsx +0 -10
  147. package/test/newPassword.test.tsx +0 -132
  148. package/test/numeric-input.test.tsx +0 -114
  149. package/test/password.test.tsx +0 -55
  150. package/test/phone.test.tsx +0 -158
  151. package/test/switch.test.tsx +0 -67
  152. package/test/text.test.tsx +0 -60
  153. package/test/textarea.test.tsx +0 -64
  154. package/test/themeToCssVars.test.ts +0 -82
  155. package/test/totpImage.test.tsx +0 -10
  156. package/test/totpLink.test.tsx +0 -10
  157. package/tsconfig.json +0 -20
@@ -1,158 +0,0 @@
1
- /* eslint-disable testing-library/no-container */
2
- /* eslint-disable testing-library/no-node-access */
3
- import { render } from '@testing-library/react';
4
- import React from 'react';
5
- import userEvent from '@testing-library/user-event';
6
- import { Phone } from '../src';
7
-
8
- jest.mock('../src/Phone/CountryCodes.ts', () => [
9
- {
10
- name: 'Israel',
11
- dialCode: '+972',
12
- code: 'IL'
13
- },
14
- {
15
- name: 'United States',
16
- dialCode: '+1',
17
- code: 'US'
18
- }
19
- ]);
20
-
21
- describe.skip('Phone', () => {
22
- it('rendered with default props', () => {
23
- const { container } = render(<Phone />);
24
- expect(container).toMatchSnapshot();
25
- });
26
-
27
- it('rendered with label', () => {
28
- const { container } = render(<Phone label="label" />);
29
- expect(container).toMatchSnapshot();
30
- });
31
-
32
- it('rendered with label and required', () => {
33
- const { container } = render(<Phone label="label" required />);
34
- expect(container).toMatchSnapshot();
35
- });
36
-
37
- it('rendered with fullWidth', () => {
38
- const { container } = render(<Phone fullWidth />);
39
- expect(container).toMatchSnapshot();
40
- });
41
-
42
- it('rendered with name', () => {
43
- const { container } = render(<Phone name="name" label="label" />);
44
- expect(container).toMatchSnapshot();
45
- });
46
-
47
- it('rendered with className', () => {
48
- const { container } = render(<Phone className="className" />);
49
- expect(container).toMatchSnapshot();
50
- });
51
-
52
- it('rendered with readOnly', () => {
53
- const { container } = render(<Phone readOnly />);
54
- expect(container).toMatchSnapshot();
55
- });
56
-
57
- it('rendered with custom error attributes', () => {
58
- const { container } = render(
59
- <Phone
60
- data-errormessage-pattern-mismatch="pattern"
61
- data-errormessage-value-missing="missing"
62
- />
63
- );
64
- expect(container).toMatchSnapshot();
65
- });
66
-
67
- it('rendered with custom scripts', () => {
68
- global.process.env.SSR = 'true';
69
-
70
- const spyToString = jest.spyOn(Function.prototype, 'toString');
71
-
72
- spyToString.mockReturnValue(
73
- (() => {
74
- const x = 1 + 1;
75
-
76
- return x;
77
- }).toString()
78
- );
79
-
80
- const { container } = render(<Phone />);
81
- expect(container).toMatchSnapshot();
82
-
83
- spyToString.mockRestore();
84
- });
85
-
86
- describe('helpers', () => {
87
- describe('syncInputs', () => {
88
- it('should not allow input non digits characters', async () => {
89
- const { container } = render(<Phone />);
90
-
91
- const phone = container.querySelector('input[data-id]');
92
- const hiddenInput = container.querySelector('input[data-input]');
93
-
94
- await userEvent.type(phone, 'a');
95
-
96
- expect(phone).toHaveValue('');
97
- expect(hiddenInput).toHaveValue('+972-');
98
- });
99
- it('should update input correctly when setting the country code', async () => {
100
- const { container } = render(<Phone />);
101
-
102
- const countryCode = container.querySelector('select[data-id]');
103
- const hiddenInput = container.querySelector('input[data-input]');
104
-
105
- await userEvent.selectOptions(countryCode, 'US');
106
-
107
- expect(hiddenInput).toHaveValue('+1-');
108
- });
109
- it('should update input correctly when setting the phone', async () => {
110
- const { container } = render(<Phone />);
111
-
112
- const phone = container.querySelector('input[data-id]');
113
- const hiddenInput = container.querySelector('input[data-input]');
114
-
115
- await userEvent.type(phone, '123');
116
-
117
- expect(hiddenInput).toHaveValue('+972-123');
118
- });
119
- it('should update input correctly when updating the country code and there is no phone', async () => {
120
- const { container } = render(<Phone />);
121
-
122
- const countryCode = container.querySelector('select[data-id]');
123
- const hiddenInput = container.querySelector('input[data-input]');
124
-
125
- await userEvent.selectOptions(countryCode, 'IL');
126
- await userEvent.selectOptions(countryCode, 'US');
127
-
128
- expect(hiddenInput).toHaveValue('+1-');
129
- });
130
- it('should update input correctly when updating the country code and there is phone', async () => {
131
- const { container } = render(<Phone />);
132
-
133
- const phone = container.querySelector('input[data-id]');
134
- const countryCode = container.querySelector('select[data-id]');
135
- const hiddenInput = container.querySelector('input[data-input]');
136
-
137
- await userEvent.type(phone, '123');
138
- await userEvent.selectOptions(countryCode, 'IL');
139
- await userEvent.selectOptions(countryCode, 'US');
140
-
141
- expect(hiddenInput).toHaveValue('+1-123');
142
- });
143
- });
144
-
145
- describe('withRuntimeDefaultValue', () => {
146
- it('should use context value to set the dial code when auto detect is set to true', () => {
147
- (document as any).context = { geo: 'US' };
148
-
149
- const { container } = render(<Phone autoDetect />);
150
- const hiddenInput = container.querySelector('input[data-input]');
151
-
152
- expect(hiddenInput).toHaveValue('+1-');
153
-
154
- (document as any).context = null;
155
- });
156
- });
157
- });
158
- });
@@ -1,67 +0,0 @@
1
- /* eslint-disable testing-library/no-container */
2
- /* eslint-disable testing-library/no-node-access */
3
- import { render } from '@testing-library/react';
4
- import React from 'react';
5
- import { Switch } from '../src';
6
-
7
- describe('Boolean Input', () => {
8
- it('should render with label', () => {
9
- const { container } = render(<Switch label="some label" name="toggle" />);
10
- const label = container.querySelector('label');
11
- expect(label).toHaveTextContent('some label');
12
- });
13
-
14
- it('should render with toggle component', () => {
15
- const { container } = render(<Switch name="toggle" />);
16
- container.querySelector('input');
17
- expect(container).toMatchSnapshot();
18
- });
19
-
20
- it('should render with value', () => {
21
- const { container } = render(<Switch name="toggle" />);
22
- const checkbox = container.querySelector('input') as HTMLInputElement;
23
-
24
- expect(checkbox.checked).toBeFalsy();
25
-
26
- checkbox.click();
27
- expect(checkbox.checked).toBeTruthy();
28
-
29
- const label = container.querySelector('label');
30
- label.click();
31
- expect(checkbox.checked).toBeFalsy();
32
- });
33
-
34
- it('should render with name', () => {
35
- const { container } = render(<Switch name="toggle" />);
36
- const checkbox = container.querySelector('input') as HTMLInputElement;
37
- expect(checkbox).toHaveAttribute('name', 'toggle');
38
- });
39
-
40
- it('should render with required attribute', () => {
41
- const onSubmit = jest.fn((e) => e.preventDefault());
42
-
43
- const { container } = render(
44
- <form onSubmit={onSubmit}>
45
- <Switch label="some label" name="toggle" required />
46
- <button type="submit">submit</button>
47
- </form>
48
- );
49
-
50
- const checkbox = container.querySelector('input') as HTMLInputElement;
51
- expect(checkbox.required).toEqual(true);
52
-
53
- const label = container.querySelector('label');
54
- expect(label).toHaveTextContent('some label*');
55
-
56
- container.querySelector('button').click();
57
-
58
- expect(checkbox).not.toBeValid();
59
- });
60
-
61
- it('should render with size', () => {
62
- const { container } = render(
63
- <Switch label="some label" name="toggle" required size="sm" />
64
- );
65
- expect(container).toMatchSnapshot();
66
- });
67
- });
@@ -1,60 +0,0 @@
1
- import { render, screen } from '@testing-library/react';
2
- import React from 'react';
3
- import { Text } from '../src';
4
-
5
- describe('Text', () => {
6
- it('rendered with default props', () => {
7
- render(<Text>Text</Text>);
8
- expect(screen.getByText('Text')).toMatchSnapshot();
9
- });
10
-
11
- it('rendered with size', () => {
12
- render(<Text size="9xl">Text</Text>);
13
- expect(screen.getByText('Text')).toMatchSnapshot();
14
- });
15
-
16
- it('rendered with fontWeight', () => {
17
- render(<Text fontWeight="black">Text</Text>);
18
- expect(screen.getByText('Text')).toMatchSnapshot();
19
- });
20
-
21
- it('rendered with fontFamily', () => {
22
- render(<Text fontFamily="mono">Text</Text>);
23
- expect(screen.getByText('Text')).toMatchSnapshot();
24
- });
25
-
26
- it('rendered with align', () => {
27
- render(<Text align="end">Text</Text>);
28
- expect(screen.getByText('Text')).toMatchSnapshot();
29
- });
30
-
31
- it('rendered with italic', () => {
32
- render(<Text italic>Text</Text>);
33
- expect(screen.getByText('Text')).toMatchSnapshot();
34
- });
35
-
36
- it('rendered with fullWidth', () => {
37
- render(<Text fullWidth>Text</Text>);
38
- expect(screen.getByText('Text')).toMatchSnapshot();
39
- });
40
-
41
- it('rendered with color', () => {
42
- render(<Text color="error">Text</Text>);
43
- expect(screen.getByText('Text')).toMatchSnapshot();
44
- });
45
-
46
- it('rendered with custom className', () => {
47
- render(<Text className="kuku">Text</Text>);
48
- expect(screen.getByText('Text')).toMatchSnapshot();
49
- });
50
-
51
- it('rendered with typography', () => {
52
- render(<Text typography="body1">Text</Text>);
53
- expect(screen.getByText('Text')).toMatchSnapshot();
54
- });
55
-
56
- it('rendered with variant', () => {
57
- render(<Text variant="primary">Text</Text>);
58
- expect(screen.getByText('Text')).toMatchSnapshot();
59
- });
60
- });
@@ -1,64 +0,0 @@
1
- import { render } from '@testing-library/react';
2
- import React from 'react';
3
- import { Textarea } from '../src';
4
-
5
- describe('Textarea', () => {
6
- it('rendered with default props', () => {
7
- const { container } = render(<Textarea />);
8
- expect(container).toMatchSnapshot();
9
- });
10
-
11
- it('rendered with label', () => {
12
- const { container } = render(<Textarea label="label" />);
13
- expect(container).toMatchSnapshot();
14
- });
15
-
16
- it('rendered with label and required', () => {
17
- const { container } = render(<Textarea label="label" required />);
18
- expect(container).toMatchSnapshot();
19
- });
20
-
21
- it('rendered with fullWidth', () => {
22
- const { container } = render(<Textarea fullWidth />);
23
- expect(container).toMatchSnapshot();
24
- });
25
-
26
- it('rendered with name', () => {
27
- const { container } = render(<Textarea name="name" />);
28
- expect(container).toMatchSnapshot();
29
- });
30
-
31
- it('rendered with className', () => {
32
- const { container } = render(<Textarea className="className" />);
33
- expect(container).toMatchSnapshot();
34
- });
35
-
36
- it('rendered with custom error attributes', () => {
37
- const { container } = render(
38
- <Textarea
39
- data-errormessage-pattern-mismatch="pattern"
40
- data-errormessage-value-missing="missing"
41
- />
42
- );
43
- expect(container).toMatchSnapshot();
44
- });
45
-
46
- it('rendered with custom scripts', () => {
47
- global.process.env.SSR = 'true';
48
-
49
- const spyToString = jest.spyOn(Function.prototype, 'toString');
50
-
51
- spyToString.mockReturnValue(
52
- (() => {
53
- const x = 1 + 1;
54
-
55
- return x;
56
- }).toString()
57
- );
58
-
59
- const { container } = render(<Textarea />);
60
- expect(container).toMatchSnapshot();
61
-
62
- spyToString.mockRestore();
63
- });
64
- });
@@ -1,82 +0,0 @@
1
- import { Theme } from '../src';
2
- import generateCssVarsFromTheme from '../src/themeToCssVars';
3
-
4
- describe('themeToCssVars', () => {
5
- it('should generate the correct css vars from a given theme', () => {
6
- const theme: Theme = {
7
- colors: {
8
- primary: '#111111',
9
- secondary: '#222222',
10
- error: '#ffffff',
11
- warning: '#000000'
12
- },
13
- components: {
14
- 'input-radius': '10px',
15
- 'input-border-opacity': '0',
16
- 'button-radius': '20px'
17
- },
18
- logo: {
19
- 'logo-url': 'http://any.url'
20
- },
21
- textColors: {},
22
- typography: {
23
- fontFamilies: [
24
- { label: 'Sans', family: ['Arial', 'sans-serif'], url: undefined },
25
- {
26
- label: 'Serif',
27
- family: ['"Times New Roman"', 'serif'],
28
- url: undefined
29
- }
30
- ],
31
- variants: {
32
- h1: {
33
- 'font-family': '0',
34
- 'font-size': '8',
35
- 'font-weight': '100'
36
- },
37
- h2: {
38
- 'font-family': '1',
39
- 'font-size': '10',
40
- 'font-weight': '200'
41
- },
42
- h3: {
43
- 'font-family': '0',
44
- 'font-size': '12',
45
- 'font-weight': '300'
46
- },
47
- subtitle1: {
48
- 'font-family': '1',
49
- 'font-size': '14',
50
- 'font-weight': '400'
51
- },
52
- subtitle2: {
53
- 'font-family': '0',
54
- 'font-size': '16',
55
- 'font-weight': '500'
56
- },
57
- body1: {
58
- 'font-family': '1',
59
- 'font-size': '18',
60
- 'font-weight': '600'
61
- },
62
- body2: {
63
- 'font-family': '0',
64
- 'font-size': '20',
65
- 'font-weight': '700'
66
- },
67
- input: {
68
- 'font-family': '1'
69
- },
70
- button: {
71
- 'font-family': '0'
72
- }
73
- }
74
- }
75
- };
76
-
77
- expect(generateCssVarsFromTheme(theme)).toMatchSnapshot();
78
- });
79
- it('should not throw when no theme', () => {
80
- expect(generateCssVarsFromTheme).not.toThrow();
81
- });
82
- });
@@ -1,10 +0,0 @@
1
- import { render } from '@testing-library/react';
2
- import React from 'react';
3
- import { TOTPImage } from '../src';
4
-
5
- describe('TOTP Image', () => {
6
- it('rendered with default props', () => {
7
- const { container } = render(<TOTPImage />);
8
- expect(container).toMatchSnapshot();
9
- });
10
- });
@@ -1,10 +0,0 @@
1
- import { render } from '@testing-library/react';
2
- import React from 'react';
3
- import { TOTPLink } from '../src/TOTPLink';
4
-
5
- describe('TOTP Link', () => {
6
- it('rendered with default props', () => {
7
- const { container } = render(<TOTPLink>TOTP Link</TOTPLink>);
8
- expect(container).toMatchSnapshot();
9
- });
10
- });
package/tsconfig.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "rootDir": "./",
4
- "target": "es2020",
5
- "lib": ["dom", "dom.iterable", "esnext"],
6
- "allowJs": false,
7
- "skipLibCheck": true,
8
- "strict": false,
9
- "esModuleInterop": true,
10
- "module": "esnext",
11
- "moduleResolution": "node",
12
- "resolveJsonModule": true,
13
- "isolatedModules": true,
14
- "declaration": true,
15
- "declarationDir": "dts",
16
- "jsx": "react",
17
- "typeRoots": ["./node_modules/@types"]
18
- },
19
- "include": ["**/*"]
20
- }