@descope/flow-components 2.0.38
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/.eslintrc +119 -0
- package/.github/actions/setup/action.yml +42 -0
- package/.github/workflows/ci.yml +105 -0
- package/.github/workflows/publish.yml +41 -0
- package/.github/workflows/release.yml +44 -0
- package/.husky/pre-commit +1 -0
- package/.prettierrc +8 -0
- package/.storybook/main.js +23 -0
- package/.storybook/manager.js +10 -0
- package/.storybook/preview-head.html +29 -0
- package/.storybook/preview.js +44 -0
- package/LICENSE +21 -0
- package/README.md +20 -0
- package/babel.config.js +7 -0
- package/dist/index.cjs.js +360 -0
- package/dist/index.d.ts +397 -0
- package/dist/index.esm.js +314 -0
- package/jest.config.js +33 -0
- package/jest.setup.js +2 -0
- package/package.json +110 -0
- package/renovate.json +4 -0
- package/rollup.config.mjs +47 -0
- package/src/Boolean/Boolean.tsx +24 -0
- package/src/Boolean/index.ts +1 -0
- package/src/Button/Button.tsx +49 -0
- package/src/Button/index.ts +1 -0
- package/src/Checkbox/Checkbox.tsx +16 -0
- package/src/Checkbox/index.ts +1 -0
- package/src/Code/Code.tsx +21 -0
- package/src/Code/index.ts +1 -0
- package/src/Container/Container.tsx +111 -0
- package/src/Container/index.ts +1 -0
- package/src/CssVarImage/CssVarImage.tsx +38 -0
- package/src/CssVarImage/index.ts +1 -0
- package/src/Divider/Divider.tsx +33 -0
- package/src/Divider/index.ts +1 -0
- package/src/EmailField/EmailField.tsx +20 -0
- package/src/EmailField/index.ts +1 -0
- package/src/Image/Image.tsx +32 -0
- package/src/Image/index.ts +1 -0
- package/src/Input/Input.tsx +27 -0
- package/src/Input/index.ts +1 -0
- package/src/Link/Link.tsx +33 -0
- package/src/Link/index.ts +1 -0
- package/src/Loader/Loader.tsx +40 -0
- package/src/Loader/index.ts +1 -0
- package/src/Logo/Logo.tsx +27 -0
- package/src/Logo/index.ts +1 -0
- package/src/NewPassword/NewPassword.tsx +25 -0
- package/src/NewPassword/index.ts +1 -0
- package/src/NumberField/NumberField.tsx +20 -0
- package/src/NumberField/index.ts +1 -0
- package/src/Password/Password.tsx +20 -0
- package/src/Password/index.ts +1 -0
- package/src/Phone/Phone.tsx +22 -0
- package/src/Phone/index.ts +1 -0
- package/src/Select/Select.tsx +29 -0
- package/src/Select/index.ts +1 -0
- package/src/Switch/Switch.tsx +21 -0
- package/src/Switch/index.ts +1 -0
- package/src/TOTPImage/TOTPImage.tsx +18 -0
- package/src/TOTPImage/index.ts +1 -0
- package/src/TOTPLink/TOTPLink.tsx +16 -0
- package/src/TOTPLink/index.ts +1 -0
- package/src/Text/Text.tsx +36 -0
- package/src/Text/index.ts +1 -0
- package/src/TextField/TextField.tsx +20 -0
- package/src/TextField/index.ts +1 -0
- package/src/Textarea/Textarea.tsx +20 -0
- package/src/Textarea/index.ts +1 -0
- package/src/icons/apple.tsx +14 -0
- package/src/icons/discord.tsx +14 -0
- package/src/icons/facebook.tsx +14 -0
- package/src/icons/fingerprint.tsx +14 -0
- package/src/icons/github.tsx +14 -0
- package/src/icons/gitlab.tsx +41 -0
- package/src/icons/google.tsx +29 -0
- package/src/icons/index.ts +11 -0
- package/src/icons/input-hidden.tsx +17 -0
- package/src/icons/input-visible.tsx +17 -0
- package/src/icons/linkedin.tsx +18 -0
- package/src/icons/microsoft.tsx +41 -0
- package/src/icons/passkey.tsx +16 -0
- package/src/icons/sso.tsx +14 -0
- package/src/index.ts +29 -0
- package/src/inputHelpers.ts +41 -0
- package/src/themeToCssVars/constants.ts +13 -0
- package/src/themeToCssVars/index.ts +153 -0
- package/src/themeToCssVars/types.ts +56 -0
- package/src/types.ts +52 -0
- package/src/utils.tsx +69 -0
- package/stories/Boolean.stories.jsx +37 -0
- package/stories/Button.stories.jsx +71 -0
- package/stories/Checkbox.stories.jsx +29 -0
- package/stories/Code.stories.jsx +60 -0
- package/stories/Container.stories.jsx +53 -0
- package/stories/Divider.stories.jsx +23 -0
- package/stories/EmailField.stories.jsx +36 -0
- package/stories/Image.stories.jsx +16 -0
- package/stories/Input.stories.jsx +63 -0
- package/stories/Link.stories.jsx +21 -0
- package/stories/Loader.stories.jsx +34 -0
- package/stories/Logo.stories.jsx +14 -0
- package/stories/NewPassword.stories.jsx +52 -0
- package/stories/NumberField.stories.jsx +35 -0
- package/stories/Password.stories.jsx +37 -0
- package/stories/Phone.stories.jsx +61 -0
- package/stories/Switch.stories.jsx +29 -0
- package/stories/TOTPImage.stories.jsx +22 -0
- package/stories/TOTPLink.stories.jsx +20 -0
- package/stories/Text.stories.jsx +35 -0
- package/stories/TextField.stories.jsx +39 -0
- package/stories/Textarea.stories.jsx +25 -0
- package/storybook-static/favicon.ico +0 -0
- package/test/__snapshots__/boolean.test.tsx.snap +47 -0
- package/test/__snapshots__/buttons.test.tsx.snap +843 -0
- package/test/__snapshots__/checkbox.test.tsx.snap +51 -0
- package/test/__snapshots__/code.test.tsx.snap +1184 -0
- package/test/__snapshots__/container.test.tsx.snap +218 -0
- package/test/__snapshots__/divider.test.tsx.snap +73 -0
- package/test/__snapshots__/image.test.tsx.snap +62 -0
- package/test/__snapshots__/input.test.tsx.snap +80 -0
- package/test/__snapshots__/link.test.tsx.snap +120 -0
- package/test/__snapshots__/loader.test.tsx.snap +53 -0
- package/test/__snapshots__/logo.test.tsx.snap +10 -0
- package/test/__snapshots__/newPassword.test.tsx.snap +69 -0
- package/test/__snapshots__/numeric-input.test.tsx.snap +21 -0
- package/test/__snapshots__/password.test.tsx.snap +26 -0
- package/test/__snapshots__/phone.test.tsx.snap +504 -0
- package/test/__snapshots__/switch.test.tsx.snap +51 -0
- package/test/__snapshots__/text.test.tsx.snap +89 -0
- package/test/__snapshots__/textarea.test.tsx.snap +73 -0
- package/test/__snapshots__/themeToCssVars.test.ts.snap +45 -0
- package/test/__snapshots__/totpImage.test.tsx.snap +10 -0
- package/test/__snapshots__/totpLink.test.tsx.snap +13 -0
- package/test/boolean.test.tsx +28 -0
- package/test/buttons.test.tsx +66 -0
- package/test/checkbox.test.tsx +67 -0
- package/test/code.test.tsx +182 -0
- package/test/container.test.tsx +91 -0
- package/test/divider.test.tsx +50 -0
- package/test/image.test.tsx +40 -0
- package/test/input.test.tsx +82 -0
- package/test/inputHelpers.test.tsx +58 -0
- package/test/link.test.tsx +71 -0
- package/test/loader.test.tsx +25 -0
- package/test/logo.test.tsx +10 -0
- package/test/newPassword.test.tsx +132 -0
- package/test/numeric-input.test.tsx +114 -0
- package/test/password.test.tsx +55 -0
- package/test/phone.test.tsx +158 -0
- package/test/switch.test.tsx +67 -0
- package/test/text.test.tsx +60 -0
- package/test/textarea.test.tsx +64 -0
- package/test/themeToCssVars.test.ts +82 -0
- package/test/totpImage.test.tsx +10 -0
- package/test/totpLink.test.tsx +10 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,111 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Container } from './Container';
|
|
@@ -0,0 +1,38 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CssVarImage } from './CssVarImage';
|
|
@@ -0,0 +1,33 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Divider } from './Divider';
|
|
@@ -0,0 +1,20 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as EmailField } from './EmailField';
|
|
@@ -0,0 +1,32 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Image } from './Image';
|
|
@@ -0,0 +1,27 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Input } from './Input';
|
|
@@ -0,0 +1,33 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Link } from './Link';
|
|
@@ -0,0 +1,40 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Loader } from './Loader';
|
|
@@ -0,0 +1,27 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Logo } from './Logo';
|
|
@@ -0,0 +1,25 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NewPassword } from './NewPassword';
|
|
@@ -0,0 +1,20 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NumberField } from './NumberField';
|
|
@@ -0,0 +1,20 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as PasswordField } from './Password';
|
|
@@ -0,0 +1,22 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Phone } from './Phone';
|
|
@@ -0,0 +1,29 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Select } from './Select';
|
|
@@ -0,0 +1,21 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Switch } from './Switch';
|
|
@@ -0,0 +1,18 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TOTPImage } from './TOTPImage';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from '../Link';
|
|
3
|
+
|
|
4
|
+
type Props = Omit<React.ComponentProps<typeof Link>, 'href'>;
|
|
5
|
+
|
|
6
|
+
// The reason we define TOTPLink as a component, and not injecting the style from another place,
|
|
7
|
+
// is to restrict the dependency between the code that injects this variable style (web-component) to this place only
|
|
8
|
+
// Note: be careful when changing variables here, this can affect other packages implicitly
|
|
9
|
+
const TOTPLink = React.forwardRef<HTMLAnchorElement, Props>(
|
|
10
|
+
({ ...props }, ref) => {
|
|
11
|
+
const readyProps = { ...props, 'data-type': 'totp-link' };
|
|
12
|
+
return <Link ref={ref} {...readyProps} />;
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export default TOTPLink;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TOTPLink } from './TOTPLink';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextAlign, TypographyVariants } from '../types';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
italic?: boolean;
|
|
6
|
+
variant?: string;
|
|
7
|
+
mode?: string;
|
|
8
|
+
'full-width'?: boolean;
|
|
9
|
+
'text-align'?: TextAlign;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
declare global {
|
|
13
|
+
namespace JSX {
|
|
14
|
+
interface IntrinsicElements {
|
|
15
|
+
'descope-text': React.DetailedHTMLProps<
|
|
16
|
+
React.HTMLAttributes<HTMLElement>,
|
|
17
|
+
HTMLElement
|
|
18
|
+
> &
|
|
19
|
+
Props;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const Text = React.forwardRef<
|
|
25
|
+
HTMLElement,
|
|
26
|
+
Props & { typography?: TypographyVariants } & Omit<
|
|
27
|
+
React.HTMLProps<HTMLSpanElement>,
|
|
28
|
+
'mode'
|
|
29
|
+
>
|
|
30
|
+
>((props, ref) => (
|
|
31
|
+
<descope-text {...props} ref={ref}>
|
|
32
|
+
{props.children}
|
|
33
|
+
</descope-text>
|
|
34
|
+
));
|
|
35
|
+
|
|
36
|
+
export default Text;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Text } from './Text';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DescopeInputProps } from '../types';
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
namespace JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
'descope-text-field': DescopeInputProps;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const TextField = React.forwardRef<HTMLInputElement, DescopeInputProps>(
|
|
13
|
+
(props, ref) => <descope-text-field {...props} ref={ref} />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
TextField.defaultProps = {
|
|
17
|
+
size: 'md'
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default TextField;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TextField } from './TextField';
|