@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
package/.eslintrc
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es2021": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"airbnb",
|
|
8
|
+
"airbnb-typescript",
|
|
9
|
+
"plugin:import/typescript",
|
|
10
|
+
"prettier",
|
|
11
|
+
"plugin:testing-library/react",
|
|
12
|
+
"plugin:jest-dom/recommended"
|
|
13
|
+
],
|
|
14
|
+
"parser": "@typescript-eslint/parser",
|
|
15
|
+
"ignorePatterns": [
|
|
16
|
+
".eslintrc",
|
|
17
|
+
"jest.config.js",
|
|
18
|
+
"babel.config.js",
|
|
19
|
+
"build/*",
|
|
20
|
+
"dist/*",
|
|
21
|
+
"webpack.config.js",
|
|
22
|
+
"bundle/*",
|
|
23
|
+
"coverage/*",
|
|
24
|
+
"testUtils/*"
|
|
25
|
+
],
|
|
26
|
+
"parserOptions": {
|
|
27
|
+
"ecmaFeatures": {
|
|
28
|
+
"jsx": true
|
|
29
|
+
},
|
|
30
|
+
"ecmaVersion": "latest",
|
|
31
|
+
"sourceType": "module",
|
|
32
|
+
"project": "./tsconfig.json"
|
|
33
|
+
},
|
|
34
|
+
"plugins": [
|
|
35
|
+
"react",
|
|
36
|
+
"@typescript-eslint",
|
|
37
|
+
"prettier",
|
|
38
|
+
"testing-library",
|
|
39
|
+
"import",
|
|
40
|
+
"prefer-arrow",
|
|
41
|
+
"jest-dom",
|
|
42
|
+
"jest",
|
|
43
|
+
"jest-formatting",
|
|
44
|
+
"no-only-tests"
|
|
45
|
+
],
|
|
46
|
+
"settings": {
|
|
47
|
+
"import/parsers": {
|
|
48
|
+
"@typescript-eslint/parser": [".ts", ".tsx"]
|
|
49
|
+
},
|
|
50
|
+
"import/resolver": {
|
|
51
|
+
"typescript": {
|
|
52
|
+
"alwaysTryTypes": true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"rules": {
|
|
57
|
+
"no-tabs": ["error", { "allowIndentationTabs": true }],
|
|
58
|
+
"@typescript-eslint/indent": ["off"],
|
|
59
|
+
"react/jsx-indent": [2, "tab"],
|
|
60
|
+
"quotes": [
|
|
61
|
+
"error",
|
|
62
|
+
"single",
|
|
63
|
+
{ "avoidEscape": true, "allowTemplateLiterals": true }
|
|
64
|
+
],
|
|
65
|
+
"@typescript-eslint/quotes": [
|
|
66
|
+
"error",
|
|
67
|
+
"single",
|
|
68
|
+
{ "avoidEscape": true, "allowTemplateLiterals": true }
|
|
69
|
+
],
|
|
70
|
+
"@typescript-eslint/comma-dangle": ["off"],
|
|
71
|
+
"comma-dangle": ["off"],
|
|
72
|
+
"react/function-component-definition": [
|
|
73
|
+
2,
|
|
74
|
+
{
|
|
75
|
+
"namedComponents": "arrow-function",
|
|
76
|
+
"unnamedComponents": "arrow-function"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"import/prefer-default-export": ["off"],
|
|
80
|
+
"react/prop-types": ["off"],
|
|
81
|
+
"react/require-default-props": ["off"],
|
|
82
|
+
"react/jsx-props-no-spreading": ["off"],
|
|
83
|
+
"prefer-arrow/prefer-arrow-functions": [
|
|
84
|
+
2,
|
|
85
|
+
{
|
|
86
|
+
"disallowPrototype": true,
|
|
87
|
+
"singleReturnOnly": false,
|
|
88
|
+
"classPropertiesAllowed": false
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"no-console": 2,
|
|
92
|
+
"no-only-tests/no-only-tests": 2,
|
|
93
|
+
"no-warning-comments": 2,
|
|
94
|
+
"import/no-unresolved": 2,
|
|
95
|
+
"import/named": 2,
|
|
96
|
+
"import/no-relative-packages": 2,
|
|
97
|
+
"import/no-cycle": 2,
|
|
98
|
+
"import/newline-after-import": 2,
|
|
99
|
+
"import/no-namespace": 2,
|
|
100
|
+
"import/no-duplicates": 2,
|
|
101
|
+
"import/first": 2,
|
|
102
|
+
"import/exports-last": 0,
|
|
103
|
+
"import/no-absolute-path": 2,
|
|
104
|
+
"import/no-dynamic-require": 2,
|
|
105
|
+
"import/no-self-import": 2,
|
|
106
|
+
"import/no-useless-path-segments": 2,
|
|
107
|
+
"import/no-extraneous-dependencies": [
|
|
108
|
+
2,
|
|
109
|
+
{
|
|
110
|
+
"devDependencies": [
|
|
111
|
+
"**/*.test.*",
|
|
112
|
+
"**/*.spec.*",
|
|
113
|
+
"**/testUtils/**",
|
|
114
|
+
"jest.config.ts"
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Setup
|
|
2
|
+
description: Setup
|
|
3
|
+
inputs:
|
|
4
|
+
node_version:
|
|
5
|
+
description: Node version to use
|
|
6
|
+
required: true
|
|
7
|
+
repo-token:
|
|
8
|
+
description: Repo token to use
|
|
9
|
+
required: true
|
|
10
|
+
runs:
|
|
11
|
+
using: composite
|
|
12
|
+
steps:
|
|
13
|
+
- name: Setup Node.js 🔠
|
|
14
|
+
uses: actions/setup-node@v3
|
|
15
|
+
with:
|
|
16
|
+
node-version: ${{ inputs.node_version }}
|
|
17
|
+
|
|
18
|
+
- name: Cache node modules 💸
|
|
19
|
+
uses: actions/cache@v3
|
|
20
|
+
env:
|
|
21
|
+
cache-name: cache-node-modules
|
|
22
|
+
with:
|
|
23
|
+
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
24
|
+
path: ~/.npm
|
|
25
|
+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
26
|
+
restore-keys: |
|
|
27
|
+
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
28
|
+
${{ runner.os }}-build-
|
|
29
|
+
${{ runner.os }}-
|
|
30
|
+
|
|
31
|
+
- name: Install Dependencies 🪛
|
|
32
|
+
shell: bash
|
|
33
|
+
# Skip post-install scripts here, as a malicious
|
|
34
|
+
# script could steal NODE_AUTH_TOKEN.
|
|
35
|
+
run: npm ci --ignore-scripts
|
|
36
|
+
env:
|
|
37
|
+
CI: true
|
|
38
|
+
# `npm rebuild` will run all those post-install scripts for us.
|
|
39
|
+
- run: npm rebuild && npm run prepare --if-present
|
|
40
|
+
shell: bash
|
|
41
|
+
env:
|
|
42
|
+
CI: true
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
name: 🎛️ CI
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
env:
|
|
6
|
+
NODE_VERSION: 18.2
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
name: 👷 Build
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout code
|
|
14
|
+
uses: actions/checkout@v3
|
|
15
|
+
- uses: actions/setup-node@v3
|
|
16
|
+
with:
|
|
17
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
18
|
+
registry-url: https://npm.pkg.github.com/
|
|
19
|
+
# Skip post-install scripts here, as a malicious
|
|
20
|
+
# script could steal NODE_AUTH_TOKEN.
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: npm ci --ignore-scripts
|
|
23
|
+
env:
|
|
24
|
+
CI: true
|
|
25
|
+
NODE_AUTH_TOKEN: ${{ secrets.CI_NPM_READ_ORG }}
|
|
26
|
+
# `npm rebuild` will run all those post-install scripts for us.
|
|
27
|
+
- run: npm rebuild && npm run prepare --if-present
|
|
28
|
+
- name: Building
|
|
29
|
+
run: npm run build
|
|
30
|
+
env:
|
|
31
|
+
NODE_AUTH_TOKEN: ${{ secrets.CI_NPM_READ_ORG }}
|
|
32
|
+
|
|
33
|
+
lint:
|
|
34
|
+
name: 🪥 Lint
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
steps:
|
|
37
|
+
- name: Checkout code
|
|
38
|
+
uses: actions/checkout@v3
|
|
39
|
+
- uses: actions/setup-node@v3
|
|
40
|
+
with:
|
|
41
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
42
|
+
registry-url: https://npm.pkg.github.com/
|
|
43
|
+
# Skip post-install scripts here, as a malicious
|
|
44
|
+
# script could steal NODE_AUTH_TOKEN.
|
|
45
|
+
- name: Install dependencies
|
|
46
|
+
run: npm ci --ignore-scripts
|
|
47
|
+
env:
|
|
48
|
+
CI: true
|
|
49
|
+
NODE_AUTH_TOKEN: ${{ secrets.CI_NPM_READ_ORG }}
|
|
50
|
+
# `npm rebuild` will run all those post-install scripts for us.
|
|
51
|
+
- run: npm rebuild && npm run prepare --if-present
|
|
52
|
+
- name: Linting
|
|
53
|
+
run: npm run lint
|
|
54
|
+
|
|
55
|
+
testing:
|
|
56
|
+
name: 👔 Test
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
steps:
|
|
59
|
+
- name: Checkout code
|
|
60
|
+
uses: actions/checkout@v3
|
|
61
|
+
- uses: actions/setup-node@v3
|
|
62
|
+
with:
|
|
63
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
64
|
+
registry-url: https://npm.pkg.github.com/
|
|
65
|
+
# Skip post-install scripts here, as a malicious
|
|
66
|
+
# script could steal NODE_AUTH_TOKEN.
|
|
67
|
+
- name: Install dependencies
|
|
68
|
+
run: npm ci --ignore-scripts
|
|
69
|
+
env:
|
|
70
|
+
CI: true
|
|
71
|
+
NODE_AUTH_TOKEN: ${{ secrets.CI_NPM_READ_ORG }}
|
|
72
|
+
# `npm rebuild` will run all those post-install scripts for us.
|
|
73
|
+
- run: npm rebuild && npm run prepare --if-present
|
|
74
|
+
- name: Testing
|
|
75
|
+
run: npm run test
|
|
76
|
+
# - name: Coverage check
|
|
77
|
+
# uses: devmasx/coverage-check-action@v1.2.0
|
|
78
|
+
# with:
|
|
79
|
+
# type: lcov
|
|
80
|
+
# min_coverage: 95
|
|
81
|
+
# result_path: coverage/lcov.info
|
|
82
|
+
# token: ${{ github.token }}
|
|
83
|
+
|
|
84
|
+
license-validation:
|
|
85
|
+
name: 🪪 License Validation
|
|
86
|
+
runs-on: ubuntu-latest
|
|
87
|
+
steps:
|
|
88
|
+
- name: Checkout code
|
|
89
|
+
uses: actions/checkout@v3
|
|
90
|
+
- uses: actions/setup-node@v3
|
|
91
|
+
with:
|
|
92
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
93
|
+
registry-url: https://npm.pkg.github.com/
|
|
94
|
+
# Skip post-install scripts here, as a malicious
|
|
95
|
+
# script could steal NODE_AUTH_TOKEN.
|
|
96
|
+
- name: Install dependencies
|
|
97
|
+
run: npm ci --ignore-scripts
|
|
98
|
+
env:
|
|
99
|
+
CI: true
|
|
100
|
+
NODE_AUTH_TOKEN: ${{ secrets.CI_NPM_READ_ORG }}
|
|
101
|
+
# `npm rebuild` will run all those post-install scripts for us.
|
|
102
|
+
- run: npm rebuild && npm run prepare --if-present
|
|
103
|
+
- name: License validation
|
|
104
|
+
shell: bash
|
|
105
|
+
run: echo no validation
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: 📢 publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
create:
|
|
5
|
+
tags:
|
|
6
|
+
- 'release/**'
|
|
7
|
+
push:
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
NODE_VERSION: 18.2
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
name: 📢 Publish
|
|
15
|
+
permissions:
|
|
16
|
+
packages: write
|
|
17
|
+
contents: read
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v3
|
|
22
|
+
- uses: actions/setup-node@v3
|
|
23
|
+
with:
|
|
24
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
25
|
+
registry-url: https://registry.npmjs.org/
|
|
26
|
+
# Skip post-install scripts here, as a malicious
|
|
27
|
+
# script could steal NODE_AUTH_TOKEN.
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: npm ci --ignore-scripts
|
|
30
|
+
env:
|
|
31
|
+
CI: true
|
|
32
|
+
NODE_AUTH_TOKEN: ${{ secrets.CI_NPM_READ_ORG }}
|
|
33
|
+
# `npm rebuild` will run all those post-install scripts for us.
|
|
34
|
+
- run: npm run build
|
|
35
|
+
- run: npm rebuild && npm run prepare --if-present
|
|
36
|
+
|
|
37
|
+
- name: Publish to NPM Package Registry
|
|
38
|
+
run: npm publish --access=public
|
|
39
|
+
env:
|
|
40
|
+
CI: true
|
|
41
|
+
NODE_AUTH_TOKEN: ${{ secrets.CI_NPM_REGISTRY }}
|
|
@@ -0,0 +1,44 @@
|
|
|
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"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm run format-lint
|
package/.prettierrc
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
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>
|
|
@@ -0,0 +1,44 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# flow-components
|
|
2
|
+
|
|
3
|
+
A React CSS only UI library based on [DaisyUI](https://daisyui.com/)
|
|
4
|
+
This library provides a collection of components with which users can build login pages by the page editor
|
|
5
|
+
|
|
6
|
+
## Quick start
|
|
7
|
+
|
|
8
|
+
In order to run this project run
|
|
9
|
+
|
|
10
|
+
```script
|
|
11
|
+
npm i
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
and
|
|
15
|
+
|
|
16
|
+
```script
|
|
17
|
+
npm run storybook
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
.
|