@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.
- package/dist/index.cjs.js +1 -93
- package/dist/index.d.ts +2 -54
- package/dist/index.esm.js +2 -92
- package/package.json +8 -9
- 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 -41
- 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 -29
- package/src/inputHelpers.ts +0 -41
- package/src/themeToCssVars/constants.ts +0 -13
- package/src/themeToCssVars/index.ts +0 -153
- package/src/themeToCssVars/types.ts +0 -56
- 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
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
name: 👊 Bump Version & Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- init
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
bump-version:
|
|
10
|
-
name: 👊 Bump Version & Release
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
- name: Checkout source code
|
|
15
|
-
uses: actions/checkout@v3
|
|
16
|
-
with:
|
|
17
|
-
persist-credentials: false
|
|
18
|
-
ref: ${{ github.ref }}
|
|
19
|
-
- name: cat package.json
|
|
20
|
-
run: |
|
|
21
|
-
cat ./package.json
|
|
22
|
-
git config user.name "Descope"
|
|
23
|
-
git config user.email "107609351+descope[bot]@users.noreply.github.com"
|
|
24
|
-
|
|
25
|
-
- name: Get token
|
|
26
|
-
id: get_token
|
|
27
|
-
uses: tibdex/github-app-token@v1
|
|
28
|
-
with:
|
|
29
|
-
private_key: ${{ secrets.APP_PEM }}
|
|
30
|
-
app_id: ${{ secrets.APP_ID }}
|
|
31
|
-
|
|
32
|
-
- name: Automated Version Bump
|
|
33
|
-
id: version-bump
|
|
34
|
-
uses: phips28/gh-action-bump-version@master
|
|
35
|
-
with:
|
|
36
|
-
tag-prefix: release/v
|
|
37
|
-
env:
|
|
38
|
-
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
|
|
39
|
-
- name: cat package.json
|
|
40
|
-
run: cat ./package.json
|
|
41
|
-
- name: Output Step
|
|
42
|
-
env:
|
|
43
|
-
NEW_TAG: ${{ steps.version-bump.outputs.newTag }}
|
|
44
|
-
run: echo "new tag $NEW_TAG"
|
package/.husky/pre-commit
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
npm run format-lint
|
package/.prettierrc
DELETED
package/.storybook/main.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
stories: [
|
|
3
|
-
'../stories/**/*.stories.mdx',
|
|
4
|
-
'../stories/**/*.stories.@(js|jsx|ts|tsx)'
|
|
5
|
-
],
|
|
6
|
-
addons: [
|
|
7
|
-
'@storybook/addon-links',
|
|
8
|
-
'@storybook/addon-essentials',
|
|
9
|
-
'storybook-addon-themes',
|
|
10
|
-
{
|
|
11
|
-
name: '@storybook/addon-postcss',
|
|
12
|
-
options: {
|
|
13
|
-
postcssLoaderOptions: {
|
|
14
|
-
implementation: require('postcss')
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
framework: '@storybook/react',
|
|
20
|
-
core: {
|
|
21
|
-
builder: '@storybook/builder-webpack5'
|
|
22
|
-
}
|
|
23
|
-
};
|
package/.storybook/manager.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
// Handle theme changes
|
|
3
|
-
|
|
4
|
-
// Since the storybook-addon-themes addon sets class, and daisyUI uses data-theme,
|
|
5
|
-
// we have to do some custom handling. Theme changes occur in preview.js and set
|
|
6
|
-
// a local storage value. We will listen to changes to this value and update
|
|
7
|
-
// the data-theme attribute on the storybook preview iframe
|
|
8
|
-
|
|
9
|
-
// Get/use initial or default values
|
|
10
|
-
const defaultTheme = 'light';
|
|
11
|
-
let cachedTheme = window.localStorage.getItem('wcui-theme') ?? defaultTheme;
|
|
12
|
-
document.documentElement.setAttribute('data-theme', cachedTheme);
|
|
13
|
-
|
|
14
|
-
// Listen for changes to localstorage
|
|
15
|
-
window.addEventListener('storage', () => {
|
|
16
|
-
let theme = window.localStorage.getItem('wcui-theme');
|
|
17
|
-
if (theme !== cachedTheme) {
|
|
18
|
-
// Update data-theme attribute
|
|
19
|
-
document.documentElement.setAttribute(
|
|
20
|
-
'data-theme',
|
|
21
|
-
theme ?? defaultTheme
|
|
22
|
-
);
|
|
23
|
-
// update theme variable to the new theme
|
|
24
|
-
cachedTheme = theme || defaultTheme;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<style></style>
|
package/.storybook/preview.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
themeToStyle,
|
|
3
|
-
defaultTheme,
|
|
4
|
-
componentsThemeManager
|
|
5
|
-
} from '@descope/web-components-ui';
|
|
6
|
-
|
|
7
|
-
const style = document.createElement('style');
|
|
8
|
-
style.id = 'gen';
|
|
9
|
-
const lightTheme = themeToStyle(defaultTheme, 'light');
|
|
10
|
-
// todo: fix dark theme
|
|
11
|
-
const darkTheme = themeToStyle(defaultTheme, 'dark');
|
|
12
|
-
|
|
13
|
-
style.innerHTML = lightTheme.globals + darkTheme.globals;
|
|
14
|
-
document.head.append(style);
|
|
15
|
-
componentsThemeManager.themes = {
|
|
16
|
-
light: lightTheme.components,
|
|
17
|
-
dark: darkTheme.components
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const parameters = {
|
|
21
|
-
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
22
|
-
controls: {
|
|
23
|
-
matchers: {
|
|
24
|
-
color: /(background|color)$/i,
|
|
25
|
-
date: /Date$/
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
themes: {
|
|
29
|
-
default: 'light',
|
|
30
|
-
onChange: (theme) => {
|
|
31
|
-
if (theme) {
|
|
32
|
-
window.localStorage.setItem('wcui-theme', theme.class);
|
|
33
|
-
document.body.setAttribute('data-theme', theme.class);
|
|
34
|
-
componentsThemeManager.currentThemeName = theme;
|
|
35
|
-
} else {
|
|
36
|
-
window.localStorage.removeItem('wcui-theme');
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
list: [
|
|
40
|
-
{ name: 'light', class: 'light', color: '#fff' },
|
|
41
|
-
{ name: 'dark', class: 'dark', color: '#000' }
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
};
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Descope
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/babel.config.js
DELETED
package/jest.config.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const { pathsToModuleNameMapper } = require('ts-jest');
|
|
2
|
-
const { compilerOptions } = require('./tsconfig.json');
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
// Automatically clear mock calls, instances, contexts and results before every test
|
|
6
|
-
clearMocks: true,
|
|
7
|
-
|
|
8
|
-
collectCoverage: true,
|
|
9
|
-
coverageDirectory: 'coverage',
|
|
10
|
-
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
|
|
11
|
-
|
|
12
|
-
// A set of global variables that need to be available in all test environments
|
|
13
|
-
globals: {
|
|
14
|
-
'ts-jest': {
|
|
15
|
-
tsconfig: 'tsconfig.json'
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
preset: 'ts-jest',
|
|
20
|
-
testEnvironment: 'jsdom',
|
|
21
|
-
moduleDirectories: ['node_modules', 'src'],
|
|
22
|
-
|
|
23
|
-
testTimeout: 2000,
|
|
24
|
-
|
|
25
|
-
transform: {
|
|
26
|
-
'\\.[jt]sx?$': 'babel-jest'
|
|
27
|
-
},
|
|
28
|
-
roots: ['src', 'test'],
|
|
29
|
-
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
30
|
-
snapshotFormat: {
|
|
31
|
-
escapeString: true
|
|
32
|
-
}
|
|
33
|
-
};
|
package/jest.setup.js
DELETED
package/renovate.json
DELETED
package/rollup.config.mjs
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import typescript from '@rollup/plugin-typescript';
|
|
2
|
-
import del from 'rollup-plugin-delete';
|
|
3
|
-
import autoExternal from 'rollup-plugin-auto-external';
|
|
4
|
-
import dts from 'rollup-plugin-dts';
|
|
5
|
-
|
|
6
|
-
import packageJson from './package.json' assert { type: 'json' };
|
|
7
|
-
|
|
8
|
-
export default [
|
|
9
|
-
{
|
|
10
|
-
input: 'src/index.ts',
|
|
11
|
-
output: {
|
|
12
|
-
file: packageJson.module,
|
|
13
|
-
format: 'esm',
|
|
14
|
-
interop: 'compat'
|
|
15
|
-
},
|
|
16
|
-
plugins: [
|
|
17
|
-
autoExternal(),
|
|
18
|
-
del({ targets: 'dist' }),
|
|
19
|
-
typescript({
|
|
20
|
-
rootDir: './src'
|
|
21
|
-
})
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
input: 'src/index.ts',
|
|
26
|
-
output: {
|
|
27
|
-
file: packageJson.main,
|
|
28
|
-
format: 'cjs',
|
|
29
|
-
interop: 'compat'
|
|
30
|
-
},
|
|
31
|
-
plugins: [
|
|
32
|
-
autoExternal(),
|
|
33
|
-
typescript({
|
|
34
|
-
rootDir: './src'
|
|
35
|
-
})
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
input: './dist/dts/index.d.ts',
|
|
40
|
-
output: [{ file: packageJson.types, format: 'esm' }],
|
|
41
|
-
plugins: [
|
|
42
|
-
dts(),
|
|
43
|
-
del({ hook: 'buildEnd', targets: ['./dist/dts', './dist/cjs/dts'] })
|
|
44
|
-
// cjsPackage(),
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
];
|
package/src/Boolean/Boolean.tsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Checkbox } from '../Checkbox';
|
|
3
|
-
import { Switch } from '../Switch';
|
|
4
|
-
|
|
5
|
-
type BooleanType = { type: 'switch' | 'checkbox' };
|
|
6
|
-
|
|
7
|
-
type Props = React.ComponentProps<typeof Checkbox> &
|
|
8
|
-
React.ComponentProps<typeof Switch> &
|
|
9
|
-
BooleanType;
|
|
10
|
-
|
|
11
|
-
const Boolean = React.forwardRef<HTMLInputElement, Props>(
|
|
12
|
-
({ type, ...props }, ref) => {
|
|
13
|
-
switch (type) {
|
|
14
|
-
case 'checkbox':
|
|
15
|
-
return <Checkbox {...props} ref={ref} />;
|
|
16
|
-
case 'switch':
|
|
17
|
-
return <Switch {...props} ref={ref} />;
|
|
18
|
-
default:
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
export default Boolean;
|
package/src/Boolean/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Boolean } from './Boolean';
|
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';
|