@authing/react-ui-components 3.1.1 → 3.1.3

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 (144) hide show
  1. package/lib/index.d.ts +2573 -201
  2. package/lib/index.min.css +2 -1
  3. package/lib/index.min.js +1 -1
  4. package/lib/index.min.js.LICENSE.txt +42 -0
  5. package/lib/static/media/loading.4a67a5f3.svg +29 -0
  6. package/package.json +54 -18
  7. package/.eslintignore +0 -6
  8. package/.eslintrc.js +0 -7
  9. package/.prettierrc +0 -5
  10. package/.vscode/settings.json +0 -31
  11. package/LICENSE +0 -21
  12. package/config/antdReplacer.js +0 -51
  13. package/config/env.js +0 -106
  14. package/config/getHttpsConfig.js +0 -66
  15. package/config/jest/cssTransform.js +0 -14
  16. package/config/jest/fileTransform.js +0 -40
  17. package/config/modules.js +0 -134
  18. package/config/paths.js +0 -71
  19. package/config/pnpTs.js +0 -35
  20. package/config/webpack.config.js +0 -857
  21. package/config/webpackDevServer.config.js +0 -130
  22. package/public/favicon.ico +0 -0
  23. package/public/index.html +0 -43
  24. package/public/logo192.png +0 -0
  25. package/public/logo512.png +0 -0
  26. package/public/manifest.json +0 -25
  27. package/public/robots.txt +0 -3
  28. package/scripts/build.js +0 -212
  29. package/scripts/lib.js +0 -200
  30. package/scripts/start.js +0 -166
  31. package/scripts/test.js +0 -53
  32. package/src/common/AuthingDropdown/index.tsx +0 -52
  33. package/src/common/AuthingDropdown/style.less +0 -43
  34. package/src/common/AuthingTabs/index.tsx +0 -98
  35. package/src/common/AuthingTabs/style.less +0 -135
  36. package/src/common/CopyAbleText/index.tsx +0 -54
  37. package/src/common/CopyAbleText/style.less +0 -13
  38. package/src/common/VerifyCodeInput/index.tsx +0 -76
  39. package/src/common/VerifyCodeInput/style.less +0 -24
  40. package/src/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
  41. package/src/components/AuthingGuard/AppMFALayout/style.less +0 -12
  42. package/src/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
  43. package/src/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
  44. package/src/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
  45. package/src/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
  46. package/src/components/AuthingGuard/Forms/Agreements/style.less +0 -44
  47. package/src/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
  48. package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -86
  49. package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
  50. package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
  51. package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  52. package/src/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
  53. package/src/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  54. package/src/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -161
  55. package/src/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  56. package/src/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
  57. package/src/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
  58. package/src/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
  59. package/src/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
  60. package/src/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
  61. package/src/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
  62. package/src/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
  63. package/src/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
  64. package/src/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
  65. package/src/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
  66. package/src/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
  67. package/src/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -61
  68. package/src/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
  69. package/src/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
  70. package/src/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  71. package/src/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
  72. package/src/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
  73. package/src/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
  74. package/src/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
  75. package/src/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
  76. package/src/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
  77. package/src/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
  78. package/src/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
  79. package/src/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
  80. package/src/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
  81. package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
  82. package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
  83. package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
  84. package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
  85. package/src/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
  86. package/src/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
  87. package/src/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
  88. package/src/components/AuthingGuard/Forms/index.ts +0 -13
  89. package/src/components/AuthingGuard/GuardLayout/index.tsx +0 -488
  90. package/src/components/AuthingGuard/GuardLayout/style.less +0 -111
  91. package/src/components/AuthingGuard/Header/index.tsx +0 -28
  92. package/src/components/AuthingGuard/Header/style.less +0 -64
  93. package/src/components/AuthingGuard/IconFont/iconfont.js +0 -74
  94. package/src/components/AuthingGuard/IconFont/index.tsx +0 -19
  95. package/src/components/AuthingGuard/IconFont/style.less +0 -6
  96. package/src/components/AuthingGuard/IconFont/svg.js +0 -2
  97. package/src/components/AuthingGuard/LoginLayout/index.tsx +0 -205
  98. package/src/components/AuthingGuard/LoginLayout/style.less +0 -0
  99. package/src/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
  100. package/src/components/AuthingGuard/MfaLayout/index.tsx +0 -49
  101. package/src/components/AuthingGuard/MfaLayout/style.less +0 -3
  102. package/src/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
  103. package/src/components/AuthingGuard/RegisterLayout/style.less +0 -0
  104. package/src/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
  105. package/src/components/AuthingGuard/ToggleLang/index.tsx +0 -51
  106. package/src/components/AuthingGuard/api/appConfig.ts +0 -154
  107. package/src/components/AuthingGuard/api/http.ts +0 -88
  108. package/src/components/AuthingGuard/api/index.ts +0 -3
  109. package/src/components/AuthingGuard/api/sso.ts +0 -29
  110. package/src/components/AuthingGuard/api/userPoolConfig.ts +0 -112
  111. package/src/components/AuthingGuard/constants.ts +0 -107
  112. package/src/components/AuthingGuard/hooks/index.tsx +0 -70
  113. package/src/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
  114. package/src/components/AuthingGuard/index.tsx +0 -134
  115. package/src/components/AuthingGuard/locales/en/common.json +0 -185
  116. package/src/components/AuthingGuard/locales/en/index.ts +0 -6
  117. package/src/components/AuthingGuard/locales/en/login.json +0 -94
  118. package/src/components/AuthingGuard/locales/en/map.json +0 -4
  119. package/src/components/AuthingGuard/locales/en/user.json +0 -81
  120. package/src/components/AuthingGuard/locales/index.ts +0 -45
  121. package/src/components/AuthingGuard/locales/zh/common.json +0 -185
  122. package/src/components/AuthingGuard/locales/zh/index.ts +0 -6
  123. package/src/components/AuthingGuard/locales/zh/login.json +0 -94
  124. package/src/components/AuthingGuard/locales/zh/map.json +0 -4
  125. package/src/components/AuthingGuard/locales/zh/user.json +0 -81
  126. package/src/components/AuthingGuard/style.less +0 -104
  127. package/src/components/AuthingGuard/types/Forms.ts +0 -95
  128. package/src/components/AuthingGuard/types/GuardConfig.ts +0 -424
  129. package/src/components/AuthingGuard/types/GuardState.ts +0 -7
  130. package/src/components/AuthingGuard/types/Locales.ts +0 -12
  131. package/src/components/AuthingGuard/types/index.ts +0 -4
  132. package/src/components/index.ts +0 -7
  133. package/src/context/base.tsx +0 -28
  134. package/src/context/global/context.tsx +0 -39
  135. package/src/context/global/reducer.tsx +0 -56
  136. package/src/index.tsx +0 -142
  137. package/src/logo.svg +0 -7
  138. package/src/react-app-env.d.ts +0 -71
  139. package/src/reportWebVitals.ts +0 -15
  140. package/src/setupTests.ts +0 -5
  141. package/src/utils/clipboard.ts +0 -27
  142. package/src/utils/index.ts +0 -180
  143. package/src/utils/popupCenter.ts +0 -48
  144. package/tsconfig.json +0 -24
package/scripts/start.js DELETED
@@ -1,166 +0,0 @@
1
- 'use strict';
2
-
3
- // Do this as the first thing so that any code reading it knows the right env.
4
- process.env.BABEL_ENV = 'development';
5
- process.env.NODE_ENV = 'development';
6
-
7
- // Makes the script crash on unhandled rejections instead of silently
8
- // ignoring them. In the future, promise rejections that are not handled will
9
- // terminate the Node.js process with a non-zero exit code.
10
- process.on('unhandledRejection', err => {
11
- throw err;
12
- });
13
-
14
- // Ensure environment variables are read.
15
- require('../config/env');
16
-
17
-
18
- const fs = require('fs');
19
- const chalk = require('react-dev-utils/chalk');
20
- const webpack = require('webpack');
21
- const WebpackDevServer = require('webpack-dev-server');
22
- const clearConsole = require('react-dev-utils/clearConsole');
23
- const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
24
- const {
25
- choosePort,
26
- createCompiler,
27
- prepareProxy,
28
- prepareUrls,
29
- } = require('react-dev-utils/WebpackDevServerUtils');
30
- const openBrowser = require('react-dev-utils/openBrowser');
31
- const semver = require('semver');
32
- const paths = require('../config/paths');
33
- const configFactory = require('../config/webpack.config');
34
- const createDevServerConfig = require('../config/webpackDevServer.config');
35
- const getClientEnvironment = require('../config/env');
36
- const react = require(require.resolve('react', { paths: [paths.appPath] }));
37
-
38
- const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
39
- const useYarn = fs.existsSync(paths.yarnLockFile);
40
- const isInteractive = process.stdout.isTTY;
41
-
42
- // Warn and crash if required files are missing
43
- if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
44
- process.exit(1);
45
- }
46
-
47
- // Tools like Cloud9 rely on this.
48
- const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
49
- const HOST = process.env.HOST || '0.0.0.0';
50
-
51
- if (process.env.HOST) {
52
- console.log(
53
- chalk.cyan(
54
- `Attempting to bind to HOST environment variable: ${chalk.yellow(
55
- chalk.bold(process.env.HOST)
56
- )}`
57
- )
58
- );
59
- console.log(
60
- `If this was unintentional, check that you haven't mistakenly set it in your shell.`
61
- );
62
- console.log(
63
- `Learn more here: ${chalk.yellow('https://cra.link/advanced-config')}`
64
- );
65
- console.log();
66
- }
67
-
68
- // We require that you explicitly set browsers and do not fall back to
69
- // browserslist defaults.
70
- const { checkBrowsers } = require('react-dev-utils/browsersHelper');
71
- checkBrowsers(paths.appPath, isInteractive)
72
- .then(() => {
73
- // We attempt to use the default port but if it is busy, we offer the user to
74
- // run on a different port. `choosePort()` Promise resolves to the next free port.
75
- return choosePort(HOST, DEFAULT_PORT);
76
- })
77
- .then(port => {
78
- if (port == null) {
79
- // We have not found a port.
80
- return;
81
- }
82
-
83
- const config = configFactory('development');
84
- const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
85
- const appName = require(paths.appPackageJson).name;
86
-
87
- const useTypeScript = fs.existsSync(paths.appTsConfig);
88
- const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
89
- const urls = prepareUrls(
90
- protocol,
91
- HOST,
92
- port,
93
- paths.publicUrlOrPath.slice(0, -1)
94
- );
95
- const devSocket = {
96
- warnings: warnings =>
97
- devServer.sockWrite(devServer.sockets, 'warnings', warnings),
98
- errors: errors =>
99
- devServer.sockWrite(devServer.sockets, 'errors', errors),
100
- };
101
- // Create a webpack compiler that is configured with custom messages.
102
- const compiler = createCompiler({
103
- appName,
104
- config,
105
- devSocket,
106
- urls,
107
- useYarn,
108
- useTypeScript,
109
- tscCompileOnError,
110
- webpack,
111
- });
112
- // Load proxy config
113
- const proxySetting = require(paths.appPackageJson).proxy;
114
- const proxyConfig = prepareProxy(
115
- proxySetting,
116
- paths.appPublic,
117
- paths.publicUrlOrPath
118
- );
119
- // Serve webpack assets generated by the compiler over a web server.
120
- const serverConfig = createDevServerConfig(
121
- proxyConfig,
122
- urls.lanUrlForConfig
123
- );
124
- const devServer = new WebpackDevServer(compiler, serverConfig);
125
- // Launch WebpackDevServer.
126
- devServer.listen(port, HOST, err => {
127
- if (err) {
128
- return console.log(err);
129
- }
130
- if (isInteractive) {
131
- clearConsole();
132
- }
133
-
134
- if (env.raw.FAST_REFRESH && semver.lt(react.version, '16.10.0')) {
135
- console.log(
136
- chalk.yellow(
137
- `Fast Refresh requires React 16.10 or higher. You are using React ${react.version}.`
138
- )
139
- );
140
- }
141
-
142
- console.log(chalk.cyan('Starting the development server...\n'));
143
- openBrowser(urls.localUrlForBrowser);
144
- });
145
-
146
- ['SIGINT', 'SIGTERM'].forEach(function (sig) {
147
- process.on(sig, function () {
148
- devServer.close();
149
- process.exit();
150
- });
151
- });
152
-
153
- if (process.env.CI !== 'true') {
154
- // Gracefully exit when stdin ends
155
- process.stdin.on('end', function () {
156
- devServer.close();
157
- process.exit();
158
- });
159
- }
160
- })
161
- .catch(err => {
162
- if (err && err.message) {
163
- console.log(err.message);
164
- }
165
- process.exit(1);
166
- });
package/scripts/test.js DELETED
@@ -1,53 +0,0 @@
1
- 'use strict';
2
-
3
- // Do this as the first thing so that any code reading it knows the right env.
4
- process.env.BABEL_ENV = 'test';
5
- process.env.NODE_ENV = 'test';
6
- process.env.PUBLIC_URL = '';
7
-
8
- // Makes the script crash on unhandled rejections instead of silently
9
- // ignoring them. In the future, promise rejections that are not handled will
10
- // terminate the Node.js process with a non-zero exit code.
11
- process.on('unhandledRejection', err => {
12
- throw err;
13
- });
14
-
15
- // Ensure environment variables are read.
16
- require('../config/env');
17
-
18
-
19
- const jest = require('jest');
20
- const execSync = require('child_process').execSync;
21
- let argv = process.argv.slice(2);
22
-
23
- function isInGitRepository() {
24
- try {
25
- execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' });
26
- return true;
27
- } catch (e) {
28
- return false;
29
- }
30
- }
31
-
32
- function isInMercurialRepository() {
33
- try {
34
- execSync('hg --cwd . root', { stdio: 'ignore' });
35
- return true;
36
- } catch (e) {
37
- return false;
38
- }
39
- }
40
-
41
- // Watch unless on CI or explicitly running all tests
42
- if (
43
- !process.env.CI &&
44
- argv.indexOf('--watchAll') === -1 &&
45
- argv.indexOf('--watchAll=false') === -1
46
- ) {
47
- // https://github.com/facebook/create-react-app/issues/5210
48
- const hasSourceControl = isInGitRepository() || isInMercurialRepository();
49
- argv.push(hasSourceControl ? '--watch' : '--watchAll');
50
- }
51
-
52
-
53
- jest.run(argv);
@@ -1,52 +0,0 @@
1
- import { DownOutlined } from '@ant-design/icons'
2
- import React, { FC, useState } from 'react'
3
- import { getClassnames } from '../../utils'
4
-
5
- import './style.less'
6
-
7
- /**
8
- * 不使用 antd 的 dropdown,因为里面会用 tooltip,体积过大
9
- */
10
- export const AuthingDropdown: FC<{
11
- className?: string
12
- menus: {
13
- label: React.ReactNode
14
- key: string | number
15
- onClick?: (
16
- key: string | number,
17
- evt: React.MouseEvent<HTMLDivElement, MouseEvent>
18
- ) => void
19
- }[]
20
- }> = ({ menus, children, className }) => {
21
- const [visible, setVisible] = useState(false)
22
-
23
- return (
24
- <div
25
- className={getClassnames(['authing-dropdown', className])}
26
- onMouseEnter={() => setVisible(true)}
27
- onMouseLeave={() => setVisible(false)}
28
- >
29
- <div className="authing-dropdown-trigger">{children}</div>
30
- <div
31
- className={getClassnames([
32
- 'authing-dropdown-menu-container',
33
- visible && 'authing-dropdown-menu-container__visible',
34
- ])}
35
- >
36
- {menus.map((item) => (
37
- <div
38
- className="authing-dropdown-menu-item"
39
- onClick={(evt) => {
40
- setVisible(false)
41
- item.onClick?.(item.key, evt)
42
- }}
43
- key={item.key}
44
- >
45
- {item.label}
46
- </div>
47
- ))}
48
- </div>
49
- <DownOutlined className="authing-dropdown-icon" />
50
- </div>
51
- )
52
- }
@@ -1,43 +0,0 @@
1
- .authing-dropdown {
2
- display: inline-flex;
3
- position: relative;
4
- align-items: center;
5
- }
6
-
7
- .authing-dropdown-trigger {
8
- cursor: pointer;
9
- }
10
-
11
- .authing-dropdown-menu-container {
12
- height: 0;
13
- opacity: 0;
14
- position: absolute;
15
- top: 100%;
16
- left: 0;
17
- transition: all 0.3s;
18
- cursor: pointer;
19
- background-color: #fff;
20
- padding: 4px 0;
21
- border-radius: 2px;
22
- box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12),
23
- 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
24
- pointer-events: none;
25
- }
26
-
27
- .authing-dropdown-menu-container__visible {
28
- height: auto;
29
- opacity: 1;
30
- pointer-events: unset;
31
- }
32
-
33
- .authing-dropdown-menu-item {
34
- padding: 5px 12px;
35
- transition: all 0.3s;
36
- &:hover {
37
- background-color: #f5f5f5;
38
- }
39
- }
40
-
41
- .authing-dropdown-icon {
42
- margin-left: 8px;
43
- }
@@ -1,98 +0,0 @@
1
- import { Button } from 'antd'
2
- import React, { FC, useMemo } from 'react'
3
- import { EllipsisOutlined } from '@ant-design/icons'
4
-
5
- import { getClassnames } from '../../utils'
6
-
7
- import './style.less'
8
-
9
- export interface AuthingTabsProps extends React.HTMLAttributes<HTMLDivElement> {
10
- activeKey?: string
11
- onTabClick: (key: string) => void
12
- showLen?: number
13
- tabs: {
14
- key: string
15
- label: string
16
- component: JSX.Element
17
- }[]
18
- }
19
-
20
- export const AuthingTabs: FC<AuthingTabsProps> = ({
21
- tabs,
22
- showLen = 3,
23
- className,
24
- activeKey,
25
- onTabClick,
26
- }) => {
27
- const activeIndex = useMemo(
28
- () => tabs.findIndex((item) => item.key === activeKey),
29
- [tabs, activeKey]
30
- )
31
-
32
- const showTabs = useMemo(() => {
33
- if (tabs.length <= showLen) {
34
- return [...tabs]
35
- }
36
-
37
- let startIndex = Math.max(activeIndex - 1, 0)
38
- if (startIndex + showLen > tabs.length - 1) {
39
- startIndex = tabs.length - showLen
40
- }
41
-
42
- return tabs.slice(startIndex, startIndex + showLen)
43
- }, [showLen, activeIndex, tabs])
44
-
45
- const hideTabs = useMemo(() => {
46
- const showKeys = showTabs.map((item) => item.key)
47
- return tabs.filter((item) => !showKeys.find((key) => item.key === key))
48
- }, [tabs, showTabs])
49
-
50
- return (
51
- <>
52
- <div className={getClassnames(['authing-tabs', className])}>
53
- <div
54
- className={getClassnames([
55
- 'authing-tabs-inner',
56
- Boolean(hideTabs.length) && 'authing-tabs-inner--more',
57
- ])}
58
- >
59
- {showTabs.map((item, index) => (
60
- <div
61
- onClick={() => onTabClick(item.key)}
62
- className={getClassnames([
63
- 'authing-tab-item',
64
- activeKey === item.key && 'authing-tab-item__active',
65
- ])}
66
- key={item.key}
67
- >
68
- {item.label}
69
- </div>
70
- ))}
71
- </div>
72
- {Boolean(hideTabs.length) && (
73
- <Button
74
- className="authing-tabs-show-more"
75
- type="text"
76
- icon={<EllipsisOutlined />}
77
- >
78
- <ul className="authing-tabs-more-panel">
79
- {hideTabs.map((item) => (
80
- <li
81
- key={item.key}
82
- onClick={() => onTabClick(item.key)}
83
- className="authing-tabs-more-panel-item"
84
- >
85
- {item.label}
86
- </li>
87
- ))}
88
- </ul>
89
- </Button>
90
- )}
91
- </div>
92
-
93
- <div className="authing-tab-pane">
94
- {tabs.find((item) => item.key === activeKey)?.component}
95
- </div>
96
- </>
97
- )
98
- }
@@ -1,135 +0,0 @@
1
- .authing-tabs {
2
- display: flex;
3
- margin-bottom: 36px;
4
- align-items: center;
5
- }
6
- .authing-tabs-inner {
7
- display: flex;
8
- justify-content: space-around;
9
- align-items: center;
10
- flex: 1;
11
- }
12
- .authing-tabs-inner--more {
13
- box-shadow: inset -10px 0 8px -8px rgba(0, 0, 0, 0.08);
14
- }
15
- .authing-tab-item {
16
- color: #aeb9d4;
17
- font-size: 16px;
18
- transition: all 0.3s ease-in-out;
19
- white-space: nowrap;
20
- cursor: pointer;
21
- position: relative;
22
- height: 28px;
23
- margin-right: 32px;
24
- &:last-child {
25
- margin-right: 12px;
26
- }
27
- &:only-child {
28
- margin-right: 0;
29
- }
30
- &::after {
31
- content: '';
32
- width: 0;
33
- height: 2px;
34
- display: block;
35
- position: absolute;
36
- left: 50%;
37
- bottom: -4px;
38
- transform: translateX(-50%);
39
- background-color: transparent;
40
- transition: all 0.3s ease-in-out;
41
- }
42
- }
43
- .authing-tab-item__active {
44
- color: #396aff;
45
- font-size: 18px;
46
- &::after {
47
- width: 26px;
48
- background-color: #396aff;
49
- }
50
- }
51
- .authing-tabs-show-more {
52
- position: relative;
53
- z-index: 2;
54
- &.ant-btn {
55
- padding: 0 12px;
56
- }
57
- &:hover,
58
- &:focus,
59
- &:active {
60
- background-color: #fff;
61
- }
62
- &:hover {
63
- .authing-tabs-more-panel {
64
- height: auto;
65
- opacity: 1;
66
- padding: 4px 0;
67
- }
68
- }
69
-
70
- &:after {
71
- content: '';
72
- display: block;
73
- width: 100%;
74
- height: 6px;
75
- top: 100%;
76
- left: 0;
77
- position: absolute;
78
- }
79
- }
80
- .authing-tabs-more-panel {
81
- position: absolute;
82
- box-sizing: border-box;
83
- transition: all 0.3s;
84
- height: 0;
85
- opacity: 0;
86
- right: 0;
87
- top: 100%;
88
- transform: translateY(6px);
89
- background-color: #fff;
90
- max-height: 200px;
91
- margin: 0;
92
- padding: 0;
93
- overflow-x: hidden;
94
- overflow-y: auto;
95
- text-align: left;
96
- list-style-type: none;
97
- background-clip: padding-box;
98
- border-radius: 2px;
99
- outline: none;
100
- box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12),
101
- 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
102
- }
103
- .authing-tabs-more-panel-item {
104
- min-width: 120px;
105
- margin: 0;
106
- padding: 5px 12px;
107
- overflow: hidden;
108
- color: rgba(0, 0, 0, 0.85);
109
- font-weight: 400;
110
- font-size: 14px;
111
- line-height: 22px;
112
- white-space: nowrap;
113
- text-overflow: ellipsis;
114
- cursor: pointer;
115
- transition: all 0.3s;
116
- &:hover {
117
- background-color: #f5f5f5;
118
- }
119
- }
120
-
121
- @media only screen and (max-width: 719px) {
122
- .authing-tabs-inner {
123
- justify-content: flex-start;
124
- }
125
- .authing-tab-item {
126
- margin-right: 40px;
127
- font-size: 14px;
128
- }
129
- .authing-tab-item__active {
130
- font-size: 16px;
131
- }
132
- .authing-tab-pane {
133
- padding-bottom: 70px;
134
- }
135
- }
@@ -1,54 +0,0 @@
1
- import React, { FC, useCallback, useEffect, useRef, useState } from 'react'
2
- import { CopyOutlined, CheckOutlined } from '@ant-design/icons'
3
- import { copyToClipboard, getClassnames } from '../../utils'
4
-
5
- import './style.less'
6
- import { useTranslation } from 'react-i18next'
7
-
8
- export interface CopyTextProps extends React.HTMLAttributes<HTMLDivElement> {}
9
-
10
- export const CopyAbleText: FC<CopyTextProps> = ({ children, className }) => {
11
- const { t } = useTranslation()
12
- const divRef = useRef<HTMLDivElement>(null)
13
- const [copied, setCopied] = useState(false)
14
- const timer = useRef(-1)
15
-
16
- const startTimer = useCallback(() => {
17
- setCopied(true)
18
- clearTimeout(timer.current)
19
- timer.current = (setTimeout(
20
- () => setCopied(false),
21
- 3000
22
- ) as unknown) as number
23
- }, [timer])
24
-
25
- useEffect(() => {
26
- return () => clearTimeout(timer.current)
27
- }, [])
28
-
29
- const handleCopy = () => {
30
- copyToClipboard(divRef.current!.innerText)
31
- startTimer()
32
- }
33
-
34
- return (
35
- <div
36
- className={getClassnames(['authing-copy-text', className])}
37
- ref={divRef}
38
- >
39
- {children}
40
- {copied ? (
41
- <CheckOutlined
42
- className="authing-data-tips authing-data-tips__top authing-guard-pointer authing-copy-text-icon authing-copy-text-icon__success"
43
- data-tips={t('common.copied')}
44
- />
45
- ) : (
46
- <CopyOutlined
47
- className="authing-data-tips authing-data-tips__top authing-guard-pointer authing-copy-text-icon"
48
- data-tips={t('common.copy')}
49
- onClick={handleCopy}
50
- />
51
- )}
52
- </div>
53
- )
54
- }
@@ -1,13 +0,0 @@
1
- .authing-copy-text {
2
- display: flex;
3
- align-items: center;
4
- }
5
-
6
- .authing-copy-text-icon {
7
- margin-left: 4px;
8
- color: #396aff;
9
- }
10
-
11
- .authing-copy-text-icon__success {
12
- color: #b7eb8f;
13
- }
@@ -1,76 +0,0 @@
1
- import { Divider, Input } from 'antd'
2
- import React, { FC, Fragment, useRef } from 'react'
3
-
4
- import './style.less'
5
-
6
- interface VerifyCodeInputProps extends React.HTMLAttributes<HTMLDivElement> {
7
- verifyCode: string[]
8
- setVerifyCode: (code: string[]) => void
9
- length?: number
10
- onEnter?: Function
11
- }
12
-
13
- export const VerifyCodeInput: FC<VerifyCodeInputProps> = ({
14
- verifyCode,
15
- setVerifyCode,
16
- length = 6,
17
- onEnter,
18
- }) => {
19
- const inputRef = useRef<any[]>([])
20
-
21
- const handleChange = (val: string | undefined = '', index: number) => {
22
- const num = parseInt(val)
23
- if (isNaN(num)) {
24
- val = ''
25
- } else {
26
- val = String(num)
27
- }
28
- const codes = [...verifyCode]
29
- codes[index] = val.split('').slice(-1)[0] || ''
30
- setVerifyCode(codes)
31
-
32
- if (val && inputRef.current[index + 1]) {
33
- inputRef.current[index + 1].focus()
34
- }
35
- }
36
-
37
- const handleKeyDown = (evt: any, index: number) => {
38
- const currentVal = verifyCode[index]
39
-
40
- switch (evt.keyCode) {
41
- case 8:
42
- if (!currentVal && inputRef.current[index - 1]) {
43
- handleChange('', index - 1)
44
- inputRef.current[index - 1].focus()
45
- }
46
- break
47
-
48
- case 13:
49
- onEnter?.()
50
- break
51
- default:
52
- break
53
- }
54
- }
55
-
56
- return (
57
- <div className="authing-code-input">
58
- {new Array(length).fill(0).map((_, index) => (
59
- <Fragment key={index}>
60
- <Input
61
- ref={(el) => (inputRef.current[index] = el)}
62
- className="authing-code-input-item"
63
- size="large"
64
- autoFocus={index === 0}
65
- onKeyDown={(evt) => handleKeyDown(evt, index)}
66
- value={verifyCode[index]}
67
- onChange={(evt) => handleChange(evt.target.value, index)}
68
- />
69
- {index === Math.floor(length / 2 - 1) && (
70
- <Divider className="authing-code-input-divider" />
71
- )}
72
- </Fragment>
73
- ))}
74
- </div>
75
- )
76
- }