@descope/flow-components 2.0.39 → 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.
- package/package.json +5 -2
- package/.eslintrc +0 -119
- package/.github/actions/setup/action.yml +0 -42
- package/.github/workflows/ci.yml +0 -105
- package/.github/workflows/publish.yml +0 -40
- package/.github/workflows/release.yml +0 -44
- package/.husky/pre-commit +0 -1
- package/.prettierrc +0 -8
- package/.storybook/main.js +0 -23
- package/.storybook/manager.js +0 -10
- package/.storybook/preview-head.html +0 -29
- package/.storybook/preview.js +0 -44
- package/LICENSE +0 -21
- package/babel.config.js +0 -7
- package/jest.config.js +0 -33
- package/jest.setup.js +0 -2
- package/renovate.json +0 -4
- package/rollup.config.mjs +0 -47
- package/src/Boolean/Boolean.tsx +0 -24
- package/src/Boolean/index.ts +0 -1
- package/src/Button/Button.tsx +0 -49
- package/src/Button/index.ts +0 -1
- package/src/Checkbox/Checkbox.tsx +0 -16
- package/src/Checkbox/index.ts +0 -1
- package/src/Code/Code.tsx +0 -21
- package/src/Code/index.ts +0 -1
- package/src/Container/Container.tsx +0 -111
- package/src/Container/index.ts +0 -1
- package/src/CssVarImage/CssVarImage.tsx +0 -38
- package/src/CssVarImage/index.ts +0 -1
- package/src/Divider/Divider.tsx +0 -33
- package/src/Divider/index.ts +0 -1
- package/src/EmailField/EmailField.tsx +0 -20
- package/src/EmailField/index.ts +0 -1
- package/src/Image/Image.tsx +0 -32
- package/src/Image/index.ts +0 -1
- package/src/Input/Input.tsx +0 -27
- package/src/Input/index.ts +0 -1
- package/src/Link/Link.tsx +0 -33
- package/src/Link/index.ts +0 -1
- package/src/Loader/Loader.tsx +0 -40
- package/src/Loader/index.ts +0 -1
- package/src/Logo/Logo.tsx +0 -27
- package/src/Logo/index.ts +0 -1
- package/src/NewPassword/NewPassword.tsx +0 -25
- package/src/NewPassword/index.ts +0 -1
- package/src/NumberField/NumberField.tsx +0 -20
- package/src/NumberField/index.ts +0 -1
- package/src/Password/Password.tsx +0 -20
- package/src/Password/index.ts +0 -1
- package/src/Phone/Phone.tsx +0 -22
- package/src/Phone/index.ts +0 -1
- package/src/Select/Select.tsx +0 -29
- package/src/Select/index.ts +0 -1
- package/src/Switch/Switch.tsx +0 -21
- package/src/Switch/index.ts +0 -1
- package/src/TOTPImage/TOTPImage.tsx +0 -18
- package/src/TOTPImage/index.ts +0 -1
- package/src/TOTPLink/TOTPLink.tsx +0 -16
- package/src/TOTPLink/index.ts +0 -1
- package/src/Text/Text.tsx +0 -36
- package/src/Text/index.ts +0 -1
- package/src/TextField/TextField.tsx +0 -20
- package/src/TextField/index.ts +0 -1
- package/src/Textarea/Textarea.tsx +0 -20
- package/src/Textarea/index.ts +0 -1
- package/src/icons/apple.tsx +0 -14
- package/src/icons/discord.tsx +0 -14
- package/src/icons/facebook.tsx +0 -14
- package/src/icons/fingerprint.tsx +0 -14
- package/src/icons/github.tsx +0 -14
- package/src/icons/gitlab.tsx +0 -41
- package/src/icons/google.tsx +0 -29
- package/src/icons/index.ts +0 -11
- package/src/icons/input-hidden.tsx +0 -17
- package/src/icons/input-visible.tsx +0 -17
- package/src/icons/linkedin.tsx +0 -18
- package/src/icons/microsoft.tsx +0 -41
- package/src/icons/passkey.tsx +0 -16
- package/src/icons/sso.tsx +0 -14
- package/src/index.ts +0 -25
- package/src/inputHelpers.ts +0 -41
- package/src/types.ts +0 -52
- package/src/utils.tsx +0 -69
- package/stories/Boolean.stories.jsx +0 -37
- package/stories/Button.stories.jsx +0 -71
- package/stories/Checkbox.stories.jsx +0 -29
- package/stories/Code.stories.jsx +0 -60
- package/stories/Container.stories.jsx +0 -53
- package/stories/Divider.stories.jsx +0 -23
- package/stories/EmailField.stories.jsx +0 -36
- package/stories/Image.stories.jsx +0 -16
- package/stories/Input.stories.jsx +0 -63
- package/stories/Link.stories.jsx +0 -21
- package/stories/Loader.stories.jsx +0 -34
- package/stories/Logo.stories.jsx +0 -14
- package/stories/NewPassword.stories.jsx +0 -52
- package/stories/NumberField.stories.jsx +0 -35
- package/stories/Password.stories.jsx +0 -37
- package/stories/Phone.stories.jsx +0 -61
- package/stories/Switch.stories.jsx +0 -29
- package/stories/TOTPImage.stories.jsx +0 -22
- package/stories/TOTPLink.stories.jsx +0 -20
- package/stories/Text.stories.jsx +0 -35
- package/stories/TextField.stories.jsx +0 -39
- package/stories/Textarea.stories.jsx +0 -25
- package/storybook-static/favicon.ico +0 -0
- package/test/__snapshots__/boolean.test.tsx.snap +0 -47
- package/test/__snapshots__/buttons.test.tsx.snap +0 -843
- package/test/__snapshots__/checkbox.test.tsx.snap +0 -51
- package/test/__snapshots__/code.test.tsx.snap +0 -1184
- package/test/__snapshots__/container.test.tsx.snap +0 -218
- package/test/__snapshots__/divider.test.tsx.snap +0 -73
- package/test/__snapshots__/image.test.tsx.snap +0 -62
- package/test/__snapshots__/input.test.tsx.snap +0 -80
- package/test/__snapshots__/link.test.tsx.snap +0 -120
- package/test/__snapshots__/loader.test.tsx.snap +0 -53
- package/test/__snapshots__/logo.test.tsx.snap +0 -10
- package/test/__snapshots__/newPassword.test.tsx.snap +0 -69
- package/test/__snapshots__/numeric-input.test.tsx.snap +0 -21
- package/test/__snapshots__/password.test.tsx.snap +0 -26
- package/test/__snapshots__/phone.test.tsx.snap +0 -504
- package/test/__snapshots__/switch.test.tsx.snap +0 -51
- package/test/__snapshots__/text.test.tsx.snap +0 -89
- package/test/__snapshots__/textarea.test.tsx.snap +0 -73
- package/test/__snapshots__/themeToCssVars.test.ts.snap +0 -45
- package/test/__snapshots__/totpImage.test.tsx.snap +0 -10
- package/test/__snapshots__/totpLink.test.tsx.snap +0 -13
- package/test/boolean.test.tsx +0 -28
- package/test/buttons.test.tsx +0 -66
- package/test/checkbox.test.tsx +0 -67
- package/test/code.test.tsx +0 -182
- package/test/container.test.tsx +0 -91
- package/test/divider.test.tsx +0 -50
- package/test/image.test.tsx +0 -40
- package/test/input.test.tsx +0 -82
- package/test/inputHelpers.test.tsx +0 -58
- package/test/link.test.tsx +0 -71
- package/test/loader.test.tsx +0 -25
- package/test/logo.test.tsx +0 -10
- package/test/newPassword.test.tsx +0 -132
- package/test/numeric-input.test.tsx +0 -114
- package/test/password.test.tsx +0 -55
- package/test/phone.test.tsx +0 -158
- package/test/switch.test.tsx +0 -67
- package/test/text.test.tsx +0 -60
- package/test/textarea.test.tsx +0 -64
- package/test/themeToCssVars.test.ts +0 -82
- package/test/totpImage.test.tsx +0 -10
- package/test/totpLink.test.tsx +0 -10
- package/tsconfig.json +0 -20
package/src/Button/Button.tsx
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
// eslint-disable-next-line import/no-namespace
|
|
3
|
-
import * as icons from '../icons';
|
|
4
|
-
|
|
5
|
-
type Props = JSX.IntrinsicElements['button'] & {
|
|
6
|
-
variant?: string;
|
|
7
|
-
color?: string;
|
|
8
|
-
size?: string;
|
|
9
|
-
loading?: boolean;
|
|
10
|
-
startIcon?: string;
|
|
11
|
-
startIconColorText?: boolean;
|
|
12
|
-
'full-width'?: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
declare global {
|
|
16
|
-
namespace JSX {
|
|
17
|
-
interface IntrinsicElements {
|
|
18
|
-
'descope-button': React.DetailedHTMLProps<
|
|
19
|
-
React.HTMLAttributes<HTMLButtonElement>,
|
|
20
|
-
HTMLButtonElement
|
|
21
|
-
> & { mode: string };
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const Button = React.forwardRef<
|
|
27
|
-
HTMLButtonElement,
|
|
28
|
-
JSX.IntrinsicElements['button'] & Props
|
|
29
|
-
>(({ children, startIcon, startIconColorText, color, ...props }, ref) => {
|
|
30
|
-
const icon = useMemo(
|
|
31
|
-
() => icons[startIcon]?.({ noColor: startIconColorText }),
|
|
32
|
-
[startIcon, startIconColorText]
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<descope-button {...props} mode={color} ref={ref}>
|
|
37
|
-
{icon}
|
|
38
|
-
{children}
|
|
39
|
-
</descope-button>
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
Button.defaultProps = {
|
|
44
|
-
size: 'md',
|
|
45
|
-
variant: 'contained',
|
|
46
|
-
color: 'primary'
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export default Button;
|
package/src/Button/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Button } from './Button';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DescopeInputProps } from '../types';
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
namespace JSX {
|
|
6
|
-
interface IntrinsicElements {
|
|
7
|
-
'descope-checkbox': DescopeInputProps;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const Checkbox = React.forwardRef<HTMLInputElement, DescopeInputProps>(
|
|
13
|
-
(props, ref) => <descope-checkbox {...props} ref={ref} />
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
export default Checkbox;
|
package/src/Checkbox/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Checkbox } from './Checkbox';
|
package/src/Code/Code.tsx
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { DescopeInputProps } from '../types';
|
|
4
|
-
|
|
5
|
-
type Props = {
|
|
6
|
-
digits?: number;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
declare global {
|
|
10
|
-
namespace JSX {
|
|
11
|
-
interface IntrinsicElements {
|
|
12
|
-
'descope-passcode': DescopeInputProps & Props;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const Code = React.forwardRef<HTMLInputElement, DescopeInputProps & Props>(
|
|
18
|
-
(props, ref) => <descope-passcode ref={ref} {...props} />
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export default Code;
|
package/src/Code/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Code } from './Code';
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FlexAlignment } from '../types';
|
|
3
|
-
|
|
4
|
-
type Never<T extends Record<string, any>> = { [K in keyof T]: never };
|
|
5
|
-
|
|
6
|
-
type SpaceBetween =
|
|
7
|
-
| '0'
|
|
8
|
-
| '0.5'
|
|
9
|
-
| '1'
|
|
10
|
-
| '1.5'
|
|
11
|
-
| '2'
|
|
12
|
-
| '2.5'
|
|
13
|
-
| '3'
|
|
14
|
-
| '3.5'
|
|
15
|
-
| '4'
|
|
16
|
-
| '5'
|
|
17
|
-
| '6'
|
|
18
|
-
| '7'
|
|
19
|
-
| '8'
|
|
20
|
-
| '9'
|
|
21
|
-
| '10'
|
|
22
|
-
| '11'
|
|
23
|
-
| '12'
|
|
24
|
-
| '14'
|
|
25
|
-
| '16'
|
|
26
|
-
| '20'
|
|
27
|
-
| '24'
|
|
28
|
-
| '28'
|
|
29
|
-
| '32';
|
|
30
|
-
|
|
31
|
-
type Flex = {
|
|
32
|
-
align?: 'start' | 'end' | 'center' | 'baseline' | 'stretch';
|
|
33
|
-
justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
34
|
-
spaceBetween: SpaceBetween;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
type ContainerAlignment = {
|
|
38
|
-
'horizontal-alignment'?: FlexAlignment | 'space-between';
|
|
39
|
-
'vertical-alignment'?: FlexAlignment;
|
|
40
|
-
'space-between'?: 'sm' | 'md' | 'lg';
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
type Props = {
|
|
44
|
-
direction?: 'row' | 'column';
|
|
45
|
-
shadow?: 'md' | 'lg' | 'xl' | '2xl';
|
|
46
|
-
'border-radius'?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
|
47
|
-
paddingX?: string;
|
|
48
|
-
paddingY?: string;
|
|
49
|
-
background?: string;
|
|
50
|
-
width?: string;
|
|
51
|
-
} & ((Flex & Never<ContainerAlignment>) | (ContainerAlignment & Never<Flex>));
|
|
52
|
-
|
|
53
|
-
declare global {
|
|
54
|
-
namespace JSX {
|
|
55
|
-
interface IntrinsicElements {
|
|
56
|
-
'descope-container': React.DetailedHTMLProps<
|
|
57
|
-
React.HTMLAttributes<HTMLElement>,
|
|
58
|
-
HTMLElement
|
|
59
|
-
>;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const justifyContent = {
|
|
65
|
-
start: 'flex-start',
|
|
66
|
-
center: 'center',
|
|
67
|
-
end: 'flex-end',
|
|
68
|
-
between: 'space-between',
|
|
69
|
-
around: 'space-around',
|
|
70
|
-
evenly: 'space-evenly'
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const Container = React.forwardRef<
|
|
74
|
-
HTMLDivElement,
|
|
75
|
-
Props & React.HTMLAttributes<HTMLDivElement>
|
|
76
|
-
>(
|
|
77
|
-
(
|
|
78
|
-
{
|
|
79
|
-
background,
|
|
80
|
-
justify,
|
|
81
|
-
paddingX = '0',
|
|
82
|
-
paddingY = '0',
|
|
83
|
-
shadow,
|
|
84
|
-
width,
|
|
85
|
-
align,
|
|
86
|
-
spaceBetween,
|
|
87
|
-
...props
|
|
88
|
-
},
|
|
89
|
-
ref
|
|
90
|
-
) => {
|
|
91
|
-
const mergedProps = {
|
|
92
|
-
...props,
|
|
93
|
-
shadow,
|
|
94
|
-
'st-horizontal-padding': `${Number.parseInt(paddingX, 10) / 4}rem`,
|
|
95
|
-
'st-vertical-padding': `${Number.parseInt(paddingY, 10) / 4}rem`,
|
|
96
|
-
'st-align-items': align,
|
|
97
|
-
'st-justify-content': justifyContent[justify],
|
|
98
|
-
'st-background-color': background,
|
|
99
|
-
'st-width': width,
|
|
100
|
-
'st-gap': spaceBetween && `${Number.parseInt(spaceBetween, 10) / 4}rem`
|
|
101
|
-
};
|
|
102
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
103
|
-
return <descope-container {...mergedProps} ref={ref} />;
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
Container.defaultProps = {
|
|
108
|
-
direction: 'row'
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export default Container;
|
package/src/Container/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Container } from './Container';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { twMerge } from 'tailwind-merge';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
varName: string;
|
|
6
|
-
fallback?: string;
|
|
7
|
-
width?: number;
|
|
8
|
-
height?: number;
|
|
9
|
-
className?: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const CssVarImage = React.forwardRef<
|
|
13
|
-
HTMLDivElement,
|
|
14
|
-
Props & React.HTMLAttributes<HTMLImageElement>
|
|
15
|
-
>(({ className, width, height, varName, fallback = '', style }, ref) => {
|
|
16
|
-
const divClasses = twMerge(
|
|
17
|
-
className,
|
|
18
|
-
'shrink-0',
|
|
19
|
-
'pointer-events-none',
|
|
20
|
-
'object-contain',
|
|
21
|
-
'max-w-full'
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<div
|
|
26
|
-
className={divClasses}
|
|
27
|
-
ref={ref}
|
|
28
|
-
style={{
|
|
29
|
-
...style,
|
|
30
|
-
content: `var(--${varName}, ${fallback})`,
|
|
31
|
-
width: width || 'initial',
|
|
32
|
-
height: height || 'initial'
|
|
33
|
-
}}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export default CssVarImage;
|
package/src/CssVarImage/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as CssVarImage } from './CssVarImage';
|
package/src/Divider/Divider.tsx
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Mode, TypographyVariants } from '../types';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
vertical?: boolean;
|
|
6
|
-
italic?: boolean;
|
|
7
|
-
variant?: TypographyVariants;
|
|
8
|
-
mode?: Mode;
|
|
9
|
-
children?: JSX.Element;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
declare global {
|
|
13
|
-
namespace JSX {
|
|
14
|
-
interface IntrinsicElements {
|
|
15
|
-
'descope-divider': React.DetailedHTMLProps<
|
|
16
|
-
React.HTMLAttributes<HTMLDivElement>,
|
|
17
|
-
HTMLDivElement
|
|
18
|
-
> &
|
|
19
|
-
Omit<Props, 'children'>;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const Divider = React.forwardRef<
|
|
25
|
-
HTMLDivElement,
|
|
26
|
-
Omit<JSX.IntrinsicElements['div'], 'size'> & Props
|
|
27
|
-
>(({ children, ...restProps }, ref) => (
|
|
28
|
-
<descope-divider {...restProps} ref={ref}>
|
|
29
|
-
{children}
|
|
30
|
-
</descope-divider>
|
|
31
|
-
));
|
|
32
|
-
|
|
33
|
-
export default Divider;
|
package/src/Divider/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Divider } from './Divider';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DescopeInputProps } from '../types';
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
namespace JSX {
|
|
6
|
-
interface IntrinsicElements {
|
|
7
|
-
'descope-email-field': DescopeInputProps;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const EmailField = React.forwardRef<HTMLInputElement, DescopeInputProps>(
|
|
13
|
-
(props, ref) => <descope-email-field {...props} ref={ref} />
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
EmailField.defaultProps = {
|
|
17
|
-
size: 'md'
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default EmailField;
|
package/src/EmailField/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as EmailField } from './EmailField';
|
package/src/Image/Image.tsx
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
type Props = {
|
|
4
|
-
width?: number;
|
|
5
|
-
height?: number;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
declare global {
|
|
9
|
-
namespace JSX {
|
|
10
|
-
interface IntrinsicElements {
|
|
11
|
-
'descope-image': React.DetailedHTMLProps<
|
|
12
|
-
React.HTMLAttributes<HTMLImageElement>,
|
|
13
|
-
HTMLImageElement
|
|
14
|
-
> &
|
|
15
|
-
Props;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const Image = React.forwardRef<
|
|
21
|
-
HTMLImageElement,
|
|
22
|
-
Props & React.HTMLAttributes<HTMLImageElement>
|
|
23
|
-
>(({ width, height, ...restProps }, ref) => (
|
|
24
|
-
<descope-image
|
|
25
|
-
{...restProps}
|
|
26
|
-
ref={ref}
|
|
27
|
-
st-width={`${width}px`}
|
|
28
|
-
st-height={`${height}px`}
|
|
29
|
-
/>
|
|
30
|
-
));
|
|
31
|
-
|
|
32
|
-
export default Image;
|
package/src/Image/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Image } from './Image';
|
package/src/Input/Input.tsx
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { NumberField } from '../NumberField';
|
|
3
|
-
import { EmailField } from '../EmailField';
|
|
4
|
-
import { TextField } from '../TextField';
|
|
5
|
-
import { PasswordField } from '../Password';
|
|
6
|
-
import { DescopeInputProps } from '../types';
|
|
7
|
-
|
|
8
|
-
const Input = React.forwardRef<HTMLInputElement, DescopeInputProps>(
|
|
9
|
-
({ type, ...rest }, ref) => {
|
|
10
|
-
switch (type) {
|
|
11
|
-
case 'email':
|
|
12
|
-
return <EmailField {...rest} ref={ref} />;
|
|
13
|
-
case 'password':
|
|
14
|
-
return <PasswordField {...rest} ref={ref} />;
|
|
15
|
-
case 'number':
|
|
16
|
-
return <NumberField {...rest} ref={ref} />;
|
|
17
|
-
default:
|
|
18
|
-
return <TextField {...rest} ref={ref} />;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
Input.defaultProps = {
|
|
24
|
-
size: 'md'
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default Input;
|
package/src/Input/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Input } from './Input';
|
package/src/Link/Link.tsx
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Mode, TextAlign, TypographyVariants } from '../types';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
italic?: boolean;
|
|
6
|
-
variant?: TypographyVariants;
|
|
7
|
-
mode?: Mode;
|
|
8
|
-
textAlign?: TextAlign;
|
|
9
|
-
'full-width'?: boolean;
|
|
10
|
-
children?: JSX.Element;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
declare global {
|
|
14
|
-
namespace JSX {
|
|
15
|
-
interface IntrinsicElements {
|
|
16
|
-
'descope-link': React.DetailedHTMLProps<
|
|
17
|
-
React.HTMLAttributes<HTMLAnchorElement>,
|
|
18
|
-
HTMLAnchorElement
|
|
19
|
-
> &
|
|
20
|
-
Omit<Props, 'children'>;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const Link = React.forwardRef<HTMLAnchorElement, Props>(
|
|
26
|
-
({ children, ...restProps }, ref) => (
|
|
27
|
-
<descope-link {...restProps} ref={ref}>
|
|
28
|
-
{children}
|
|
29
|
-
</descope-link>
|
|
30
|
-
)
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
export default Link;
|
package/src/Link/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Link } from './Link';
|
package/src/Loader/Loader.tsx
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Mode, PropsToAttrs } from '../types';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
variant?: 'linear' | 'radial';
|
|
6
|
-
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
7
|
-
color?: Mode;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
type LoaderType = React.DetailedHTMLProps<
|
|
11
|
-
React.HTMLAttributes<HTMLElement>,
|
|
12
|
-
HTMLElement
|
|
13
|
-
> &
|
|
14
|
-
PropsToAttrs<Props>;
|
|
15
|
-
|
|
16
|
-
declare global {
|
|
17
|
-
namespace JSX {
|
|
18
|
-
interface IntrinsicElements {
|
|
19
|
-
'descope-loader-linear': LoaderType;
|
|
20
|
-
'descope-loader-radial': LoaderType;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const Loader = React.forwardRef<HTMLDivElement, Props>(
|
|
26
|
-
({ variant, color, ...restProps }, ref) => {
|
|
27
|
-
const props = { mode: color, ...restProps, ref };
|
|
28
|
-
|
|
29
|
-
switch (variant) {
|
|
30
|
-
case 'linear':
|
|
31
|
-
return <descope-loader-linear {...props} />;
|
|
32
|
-
case 'radial':
|
|
33
|
-
return <descope-loader-radial {...props} />;
|
|
34
|
-
default:
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
export default Loader;
|
package/src/Loader/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Loader } from './Loader';
|
package/src/Logo/Logo.tsx
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PropsToAttrs } from '../types';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
width?: string;
|
|
6
|
-
height?: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
declare global {
|
|
10
|
-
namespace JSX {
|
|
11
|
-
interface IntrinsicElements {
|
|
12
|
-
'descope-logo': React.DetailedHTMLProps<
|
|
13
|
-
React.HTMLAttributes<HTMLElement>,
|
|
14
|
-
HTMLElement
|
|
15
|
-
> &
|
|
16
|
-
PropsToAttrs<Props>;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const Logo = React.forwardRef<HTMLDivElement, Props>(
|
|
22
|
-
({ width, height }, ref) => (
|
|
23
|
-
<descope-logo st-width={width} st-height={height} ref={ref} />
|
|
24
|
-
)
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
export default Logo;
|
package/src/Logo/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Logo } from './Logo';
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DescopeInputProps } from '../types';
|
|
3
|
-
|
|
4
|
-
export type Props = {
|
|
5
|
-
'password-label'?: string;
|
|
6
|
-
'password-placeholder'?: string;
|
|
7
|
-
'confirm-label'?: string;
|
|
8
|
-
'confirm-placeholder'?: string;
|
|
9
|
-
'has-confirm'?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
declare global {
|
|
13
|
-
namespace JSX {
|
|
14
|
-
interface IntrinsicElements {
|
|
15
|
-
'descope-new-password': DescopeInputProps & Props;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const NewPassword = React.forwardRef<
|
|
21
|
-
HTMLInputElement,
|
|
22
|
-
DescopeInputProps & Props
|
|
23
|
-
>((props, ref) => <descope-new-password {...props} ref={ref} />);
|
|
24
|
-
|
|
25
|
-
export default NewPassword;
|
package/src/NewPassword/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as NewPassword } from './NewPassword';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DescopeInputProps } from '../types';
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
namespace JSX {
|
|
6
|
-
interface IntrinsicElements {
|
|
7
|
-
'descope-number-field': DescopeInputProps;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const NumberField = React.forwardRef<HTMLInputElement, DescopeInputProps>(
|
|
13
|
-
(props, ref) => <descope-number-field {...props} ref={ref} />
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
NumberField.defaultProps = {
|
|
17
|
-
size: 'md'
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default NumberField;
|
package/src/NumberField/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as NumberField } from './NumberField';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DescopeInputProps } from '../types';
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
namespace JSX {
|
|
6
|
-
interface IntrinsicElements {
|
|
7
|
-
'descope-password-field': DescopeInputProps;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const PasswordField = React.forwardRef<HTMLInputElement, DescopeInputProps>(
|
|
13
|
-
(props, ref) => <descope-password-field {...props} ref={ref} />
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
PasswordField.defaultProps = {
|
|
17
|
-
size: 'md'
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default PasswordField;
|
package/src/Password/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as PasswordField } from './Password';
|
package/src/Phone/Phone.tsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DescopeInputProps } from '../types';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
'default-code'?: string;
|
|
6
|
-
'phone-input-placeholder'?: string;
|
|
7
|
-
'country-input-placeholder'?: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
declare global {
|
|
11
|
-
namespace JSX {
|
|
12
|
-
interface IntrinsicElements {
|
|
13
|
-
'descope-phone-field': DescopeInputProps & Props;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const Phone = React.forwardRef<HTMLInputElement, DescopeInputProps & Props>(
|
|
19
|
-
(props, ref) => <descope-phone-field {...props} ref={ref} />
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export default Phone;
|
package/src/Phone/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Phone } from './Phone';
|
package/src/Select/Select.tsx
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DescopeInputProps } from '../types';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
children?: JSX.Element[];
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
declare global {
|
|
9
|
-
namespace JSX {
|
|
10
|
-
interface IntrinsicElements {
|
|
11
|
-
'descope-combo-box': DescopeInputProps;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const Select = React.forwardRef<HTMLInputElement, DescopeInputProps & Props>(
|
|
17
|
-
({ children, ...restProps }, ref) => (
|
|
18
|
-
<descope-combo-box {...restProps} ref={ref}>
|
|
19
|
-
{children}
|
|
20
|
-
</descope-combo-box>
|
|
21
|
-
)
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
Select.defaultProps = {
|
|
25
|
-
// eslint-disable-next-line react/default-props-match-prop-types
|
|
26
|
-
size: 'md'
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default Select;
|
package/src/Select/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Select } from './Select';
|
package/src/Switch/Switch.tsx
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DescopeInputProps } from '../types';
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
namespace JSX {
|
|
6
|
-
interface IntrinsicElements {
|
|
7
|
-
'descope-switch-toggle': DescopeInputProps;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const Switch = React.forwardRef<HTMLInputElement, DescopeInputProps>(
|
|
13
|
-
(props, ref) => <descope-switch-toggle {...props} ref={ref} />
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
Switch.defaultProps = {
|
|
17
|
-
// eslint-disable-next-line react/default-props-match-prop-types
|
|
18
|
-
size: 'md'
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default Switch;
|
package/src/Switch/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Switch } from './Switch';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CssVarImage } from '../CssVarImage';
|
|
3
|
-
|
|
4
|
-
type Props = Omit<
|
|
5
|
-
React.ComponentProps<typeof CssVarImage>,
|
|
6
|
-
'varName' | 'fallback'
|
|
7
|
-
>;
|
|
8
|
-
|
|
9
|
-
// The reason we define TOTPImage as a component, and not injecting the style from another place,
|
|
10
|
-
// is to restrict the dependency between the code that injects this variable style (web-component) to this place only
|
|
11
|
-
// Note: be careful when changing variables here, this can affect other packages implicitly
|
|
12
|
-
const TOTPImage = React.forwardRef<HTMLDivElement, Props>(
|
|
13
|
-
({ ...props }, ref) => (
|
|
14
|
-
<CssVarImage ref={ref} varName="totp-image" {...props} />
|
|
15
|
-
)
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
export default TOTPImage;
|