@logto/core-kit 1.0.0-beta.11

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Silverhand Inc.
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.
@@ -0,0 +1,77 @@
1
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types
2
+ type InputType =
3
+ | 'button'
4
+ | 'checkbox'
5
+ | 'color'
6
+ | 'date'
7
+ | 'datetime-local'
8
+ | 'email'
9
+ | 'file'
10
+ | 'hidden'
11
+ | 'image'
12
+ | 'month'
13
+ | 'number'
14
+ | 'password'
15
+ | 'radio'
16
+ | 'range'
17
+ | 'reset'
18
+ | 'search'
19
+ | 'submit'
20
+ | 'tel'
21
+ | 'text'
22
+ | 'time'
23
+ | 'url'
24
+ | 'week';
25
+
26
+ // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute
27
+ type AutoCompleteType =
28
+ | 'name'
29
+ | 'honorific-prefix'
30
+ | 'given-name'
31
+ | 'additional-name'
32
+ | 'family-name'
33
+ | 'honorific-suffix'
34
+ | 'nickname'
35
+ | 'username'
36
+ | 'new-password'
37
+ | 'current-password'
38
+ | 'one-time-code'
39
+ | 'organization-title'
40
+ | 'organization'
41
+ | 'street-address'
42
+ | 'address-line1'
43
+ | 'address-line2'
44
+ | 'address-line3'
45
+ | 'address-level4'
46
+ | 'address-level3'
47
+ | 'address-level2'
48
+ | 'address-level1'
49
+ | 'country'
50
+ | 'country-name'
51
+ | 'postal-code'
52
+ | 'cc-name'
53
+ | 'cc-given-name'
54
+ | 'cc-additional-name'
55
+ | 'cc-family-name'
56
+ | 'cc-number'
57
+ | 'cc-exp'
58
+ | 'cc-exp-month'
59
+ | 'cc-exp-year'
60
+ | 'cc-csc'
61
+ | 'cc-type'
62
+ | 'transaction-currency'
63
+ | 'transaction-amount'
64
+ | 'language'
65
+ | 'bday'
66
+ | 'bday-day'
67
+ | 'bday-month'
68
+ | 'bday-year'
69
+ | 'sex'
70
+ | 'url'
71
+ | 'photo'
72
+ | 'mobile';
73
+
74
+ // TO-DO: remove me
75
+ interface Body {
76
+ json<T>(): Promise<T>;
77
+ }
@@ -0,0 +1,4 @@
1
+ /* eslint-disable import/no-unassigned-import */
2
+ import './react-app.d';
3
+ import './dom.d';
4
+ /* eslint-enable import/no-unassigned-import */
@@ -0,0 +1,65 @@
1
+ // Copied from react-scripts/lib/react-app.d.ts
2
+
3
+ declare module '*.avif' {
4
+ const source: string;
5
+ export default source;
6
+ }
7
+
8
+ declare module '*.bmp' {
9
+ const source: string;
10
+ export default source;
11
+ }
12
+
13
+ declare module '*.gif' {
14
+ const source: string;
15
+ export default source;
16
+ }
17
+
18
+ declare module '*.jpg' {
19
+ const source: string;
20
+ export default source;
21
+ }
22
+
23
+ declare module '*.jpeg' {
24
+ const source: string;
25
+ export default source;
26
+ }
27
+
28
+ declare module '*.png' {
29
+ const source: string;
30
+ export default source;
31
+ }
32
+
33
+ declare module '*.webp' {
34
+ const source: string;
35
+ export default source;
36
+ }
37
+
38
+ declare module '*.svg' {
39
+ import * as React from 'react';
40
+
41
+ export const ReactComponent: React.FunctionComponent<
42
+ React.SVGProps<SVGSVGElement> & { title?: string }
43
+ >;
44
+
45
+ const source: string;
46
+ export default source;
47
+ }
48
+
49
+ declare module '*.module.css' {
50
+ const classes: Readonly<Record<string, string>>;
51
+ export default classes;
52
+ export = classes;
53
+ }
54
+
55
+ declare module '*.module.scss' {
56
+ const classes: Readonly<Record<string, string>>;
57
+ export default classes;
58
+ export = classes;
59
+ }
60
+
61
+ declare module '*.module.sass' {
62
+ const classes: Readonly<Record<string, string>>;
63
+ export default classes;
64
+ export = classes;
65
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './utilities';
2
+ export * from './regex';
3
+ export * from './language';
4
+ export * from './scope';
package/lib/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./utilities"), exports);
18
+ __exportStar(require("./regex"), exports);
19
+ __exportStar(require("./language"), exports);
20
+ __exportStar(require("./scope"), exports);
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+ export declare const languageKeys: readonly ["en", "fr", "pt-PT", "zh-CN", "tr-TR", "ko-KR"];
3
+ export declare const languageKeyGuard: z.ZodEnum<["en", "fr", "pt-PT", "zh-CN", "tr-TR", "ko-KR"]>;
4
+ export declare type LanguageKey = z.infer<typeof languageKeyGuard>;
5
+ export declare const getDefaultLanguage: (language: string) => LanguageKey;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultLanguage = exports.languageKeyGuard = exports.languageKeys = void 0;
4
+ const zod_1 = require("zod");
5
+ const zod_2 = require("./utilities/zod");
6
+ exports.languageKeys = ['en', 'fr', 'pt-PT', 'zh-CN', 'tr-TR', 'ko-KR'];
7
+ exports.languageKeyGuard = zod_1.z.enum(exports.languageKeys);
8
+ const getDefaultLanguage = (language) => {
9
+ return exports.languageKeyGuard.or((0, zod_2.fallback)('en')).parse(language);
10
+ };
11
+ exports.getDefaultLanguage = getDefaultLanguage;
package/lib/regex.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export declare const emailRegEx: RegExp;
2
+ export declare const phoneRegEx: RegExp;
3
+ export declare const usernameRegEx: RegExp;
4
+ export declare const passwordRegEx: RegExp;
5
+ export declare const redirectUriRegEx: RegExp;
6
+ export declare const hexColorRegEx: RegExp;
7
+ export declare const dateRegex: RegExp;
package/lib/regex.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dateRegex = exports.hexColorRegEx = exports.redirectUriRegEx = exports.passwordRegEx = exports.usernameRegEx = exports.phoneRegEx = exports.emailRegEx = void 0;
4
+ exports.emailRegEx = /^\S+@\S+\.\S+$/;
5
+ exports.phoneRegEx = /^\d+$/;
6
+ exports.usernameRegEx = /^[A-Z_a-z]\w*$/;
7
+ exports.passwordRegEx = /^.{6,}$/;
8
+ exports.redirectUriRegEx = /^https?:\/\//;
9
+ exports.hexColorRegEx = /^#[\da-f]{3}([\da-f]{3})?$/i;
10
+ exports.dateRegex = /^\d{4}(-\d{2}){2}/;
package/lib/scope.d.ts ADDED
@@ -0,0 +1,49 @@
1
+ export declare enum PreservedScope {
2
+ OpenId = "openid",
3
+ OfflineAccess = "offline_access"
4
+ }
5
+ export declare type UserClaim = 'name' | 'picture' | 'username' | 'role_names' | 'email' | 'email_verified' | 'phone_number' | 'phone_number_verified' | 'custom_data' | 'identities';
6
+ /**
7
+ * Scopes for ID Token and Userinfo Endpoint.
8
+ */
9
+ export declare enum UserScope {
10
+ /**
11
+ * Scope for basic user info.
12
+ *
13
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
14
+ */
15
+ Profile = "profile",
16
+ /**
17
+ * Scope for user email address.
18
+ *
19
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
20
+ */
21
+ Email = "email",
22
+ /**
23
+ * Scope for user phone number.
24
+ *
25
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
26
+ */
27
+ Phone = "phone",
28
+ /**
29
+ * Scope for user's custom data.
30
+ *
31
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
32
+ */
33
+ CustomData = "custom_data",
34
+ /**
35
+ * Scope for user's social identity details.
36
+ *
37
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
38
+ */
39
+ Identities = "identities"
40
+ }
41
+ /**
42
+ * Mapped claims that ID Token includes.
43
+ */
44
+ export declare const idTokenClaims: Readonly<Record<UserScope, UserClaim[]>>;
45
+ /**
46
+ * Additional claims that Userinfo Endpoint returns.
47
+ */
48
+ export declare const userinfoClaims: Readonly<Record<UserScope, UserClaim[]>>;
49
+ export declare const userClaims: Readonly<Record<UserScope, UserClaim[]>>;
package/lib/scope.js ADDED
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.userClaims = exports.userinfoClaims = exports.idTokenClaims = exports.UserScope = exports.PreservedScope = void 0;
4
+ var PreservedScope;
5
+ (function (PreservedScope) {
6
+ PreservedScope["OpenId"] = "openid";
7
+ PreservedScope["OfflineAccess"] = "offline_access";
8
+ })(PreservedScope = exports.PreservedScope || (exports.PreservedScope = {}));
9
+ /**
10
+ * Scopes for ID Token and Userinfo Endpoint.
11
+ */
12
+ var UserScope;
13
+ (function (UserScope) {
14
+ /**
15
+ * Scope for basic user info.
16
+ *
17
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
18
+ */
19
+ UserScope["Profile"] = "profile";
20
+ /**
21
+ * Scope for user email address.
22
+ *
23
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
24
+ */
25
+ UserScope["Email"] = "email";
26
+ /**
27
+ * Scope for user phone number.
28
+ *
29
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
30
+ */
31
+ UserScope["Phone"] = "phone";
32
+ /**
33
+ * Scope for user's custom data.
34
+ *
35
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
36
+ */
37
+ UserScope["CustomData"] = "custom_data";
38
+ /**
39
+ * Scope for user's social identity details.
40
+ *
41
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
42
+ */
43
+ UserScope["Identities"] = "identities";
44
+ })(UserScope = exports.UserScope || (exports.UserScope = {}));
45
+ /**
46
+ * Mapped claims that ID Token includes.
47
+ */
48
+ exports.idTokenClaims = Object.freeze({
49
+ [UserScope.Profile]: ['name', 'picture', 'username', 'role_names'],
50
+ [UserScope.Email]: ['email', 'email_verified'],
51
+ [UserScope.Phone]: ['phone_number', 'phone_number_verified'],
52
+ [UserScope.CustomData]: [],
53
+ [UserScope.Identities]: [],
54
+ });
55
+ /**
56
+ * Additional claims that Userinfo Endpoint returns.
57
+ */
58
+ exports.userinfoClaims = Object.freeze({
59
+ [UserScope.Profile]: [],
60
+ [UserScope.Email]: [],
61
+ [UserScope.Phone]: [],
62
+ [UserScope.CustomData]: ['custom_data'],
63
+ [UserScope.Identities]: ['identities'],
64
+ });
65
+ exports.userClaims = Object.freeze(
66
+ // Hard to infer type directly, use `as` for a workaround.
67
+ // eslint-disable-next-line no-restricted-syntax
68
+ Object.fromEntries(Object.values(UserScope).map((current) => [
69
+ current,
70
+ [...exports.idTokenClaims[current], ...exports.userinfoClaims[current]],
71
+ ])));
@@ -0,0 +1,4 @@
1
+ import color from 'color';
2
+ export declare const absoluteLighten: (baseColor: color, delta: number) => color<number[]>;
3
+ export declare const absoluteDarken: (baseColor: color, delta: number) => color<number[]>;
4
+ export declare const generateDarkColor: (lightColor: string) => string;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateDarkColor = exports.absoluteDarken = exports.absoluteLighten = void 0;
7
+ const color_1 = __importDefault(require("color"));
8
+ // Color hsl lighten/darken takes percentage value only, need to implement absolute value update
9
+ const absoluteLighten = (baseColor, delta) => {
10
+ const hslArray = baseColor.hsl().round().array();
11
+ return (0, color_1.default)([hslArray[0] ?? 0, hslArray[1] ?? 0, (hslArray[2] ?? 0) + delta], 'hsl');
12
+ };
13
+ exports.absoluteLighten = absoluteLighten;
14
+ const absoluteDarken = (baseColor, delta) => {
15
+ const hslArray = baseColor.hsl().round().array();
16
+ return (0, color_1.default)([hslArray[0] ?? 0, hslArray[1] ?? 0, (hslArray[2] ?? 0) - delta], 'hsl');
17
+ };
18
+ exports.absoluteDarken = absoluteDarken;
19
+ const generateDarkColor = (lightColor) => (0, exports.absoluteLighten)((0, color_1.default)(lightColor), 10).hex();
20
+ exports.generateDarkColor = generateDarkColor;
@@ -0,0 +1 @@
1
+ export declare const getFileContents: (filePath: string, fallbackContent: string) => string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFileContents = void 0;
4
+ const fs_1 = require("fs");
5
+ const getFileContents = (filePath, fallbackContent) => {
6
+ if ((0, fs_1.existsSync)(filePath)) {
7
+ return (0, fs_1.readFileSync)(filePath, 'utf8');
8
+ }
9
+ return fallbackContent;
10
+ };
11
+ exports.getFileContents = getFileContents;
@@ -0,0 +1,5 @@
1
+ export * from './file';
2
+ export * from './react-router';
3
+ export * from './color';
4
+ export * from './string';
5
+ export * from './zod';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./file"), exports);
18
+ __exportStar(require("./react-router"), exports);
19
+ __exportStar(require("./color"), exports);
20
+ __exportStar(require("./string"), exports);
21
+ __exportStar(require("./zod"), exports);
@@ -0,0 +1 @@
1
+ export declare const getBasename: (prefix: string, developmentPort: string) => string;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBasename = void 0;
4
+ const getBasename = (prefix, developmentPort) => {
5
+ const isBasenameNeeded = process.env.NODE_ENV !== 'development' || process.env.PORT === developmentPort;
6
+ return isBasenameNeeded ? '/' + prefix : '';
7
+ };
8
+ exports.getBasename = getBasename;
@@ -0,0 +1 @@
1
+ export declare const generateRandomString: (size: number, alphabet?: string) => string;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateRandomString = void 0;
4
+ const nanoid_1 = require("nanoid");
5
+ const generateRandomString = (size, alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz') => (0, nanoid_1.customAlphabet)(alphabet, size)();
6
+ exports.generateRandomString = generateRandomString;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * https://github.com/colinhacks/zod/issues/316#issuecomment-850906479
3
+ * Create a schema matches anything and returns a value. Use it with `or`:
4
+ *
5
+ * const schema = zod.number();
6
+ * const tolerant = schema.or(fallback(-1));
7
+ *
8
+ * schema.parse('foo') // => ZodError
9
+ * tolerant.parse('foo') // -1
10
+ */
11
+ export declare function fallback<T>(value: T): import("zod").ZodEffects<import("zod").ZodAny, T, any>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fallback = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * https://github.com/colinhacks/zod/issues/316#issuecomment-850906479
7
+ * Create a schema matches anything and returns a value. Use it with `or`:
8
+ *
9
+ * const schema = zod.number();
10
+ * const tolerant = schema.or(fallback(-1));
11
+ *
12
+ * schema.parse('foo') // => ZodError
13
+ * tolerant.parse('foo') // -1
14
+ */
15
+ function fallback(value) {
16
+ return (0, zod_1.any)().transform(() => value);
17
+ }
18
+ exports.fallback = fallback;
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@logto/core-kit",
3
+ "version": "1.0.0-beta.11",
4
+ "main": "lib/index.js",
5
+ "author": "Silverhand Inc. <contact@silverhand.io>",
6
+ "license": "MIT",
7
+ "files": [
8
+ "declaration",
9
+ "lib",
10
+ "scss"
11
+ ],
12
+ "scripts": {
13
+ "precommit": "lint-staged",
14
+ "build": "rm -rf lib/ && tsc -p tsconfig.build.json",
15
+ "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental",
16
+ "lint": "eslint --ext .ts src",
17
+ "lint:report": "pnpm lint --format json --output-file report.json",
18
+ "prepack": "pnpm build",
19
+ "stylelint": "stylelint \"scss/**/*.scss\""
20
+ },
21
+ "engines": {
22
+ "node": "^16.0.0"
23
+ },
24
+ "dependencies": {
25
+ "color": "^4.2.3",
26
+ "nanoid": "^3.1.23",
27
+ "zod": "^3.18.0"
28
+ },
29
+ "devDependencies": {
30
+ "@silverhand/eslint-config": "1.0.0",
31
+ "@silverhand/eslint-config-react": "1.0.0",
32
+ "@silverhand/essentials": "^1.2.0",
33
+ "@silverhand/ts-config": "1.0.0",
34
+ "@silverhand/ts-config-react": "1.0.0",
35
+ "@types/color": "^3.0.3",
36
+ "@types/node": "^16.3.1",
37
+ "@types/react": "^18.0.20",
38
+ "eslint": "^8.21.0",
39
+ "lint-staged": "^13.0.0",
40
+ "postcss": "^8.4.6",
41
+ "prettier": "^2.7.1",
42
+ "stylelint": "^14.9.1",
43
+ "typescript": "^4.7.4"
44
+ },
45
+ "eslintConfig": {
46
+ "extends": "@silverhand/react"
47
+ },
48
+ "stylelint": {
49
+ "extends": "@silverhand/eslint-config-react/.stylelintrc"
50
+ },
51
+ "prettier": "@silverhand/eslint-config/.prettierrc",
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "gitHead": "a20eabc36dadad4969d2acbf6bac7655257f3f55"
56
+ }
@@ -0,0 +1,339 @@
1
+ @mixin light {
2
+ // tonal palettes
3
+ --color-all-0: #000;
4
+ --color-all-100: #fff;
5
+ --color-primary-10: #190064;
6
+ --color-primary-20: #2d009d;
7
+ --color-primary-30: #4300da;
8
+ --color-primary-40: #5d34f2;
9
+ --color-primary-50: #7958ff;
10
+ --color-primary-60: #947dff;
11
+ --color-primary-70: #af9eff;
12
+ --color-primary-80: #cabeff;
13
+ --color-primary-90: #e6deff;
14
+ --color-primary-95: #f5eeff;
15
+ --color-primary-99: #fffbff;
16
+ --color-secondary-10: #201c00;
17
+ --color-secondary-20: #373100;
18
+ --color-secondary-30: #4f4700;
19
+ --color-secondary-40: #695f00;
20
+ --color-secondary-50: #847900;
21
+ --color-secondary-60: #9f930d;
22
+ --color-secondary-70: #baad2d;
23
+ --color-secondary-80: #d7c947;
24
+ --color-secondary-90: #f4e560;
25
+ --color-secondary-95: #fff480;
26
+ --color-secondary-99: #fffbf7;
27
+ --color-tertiary-10: #350041;
28
+ --color-tertiary-20: #560068;
29
+ --color-tertiary-30: #7b0093;
30
+ --color-tertiary-40: #9927af;
31
+ --color-tertiary-50: #b545ca;
32
+ --color-tertiary-60: #d361e7;
33
+ --color-tertiary-70: #f07eff;
34
+ --color-tertiary-80: #faabff;
35
+ --color-tertiary-90: #ffd5ff;
36
+ --color-tertiary-95: #ffeafe;
37
+ --color-tertiary-99: #fcfcfc;
38
+ --color-error-10: #410001;
39
+ --color-error-20: #680003;
40
+ --color-error-30: #930006;
41
+ --color-error-40: #ba1b1b;
42
+ --color-error-50: #dd3730;
43
+ --color-error-60: #ff5449;
44
+ --color-error-70: #ff897a;
45
+ --color-error-80: #ffb4a9;
46
+ --color-error-90: #ffdad4;
47
+ --color-error-95: #ffede9;
48
+ --color-error-99: #fcfcfc;
49
+ --color-neutral-10: #191c1d;
50
+ --color-neutral-20: #2d3132;
51
+ --color-neutral-30: #444748;
52
+ --color-neutral-40: #5c5f60;
53
+ --color-neutral-50: #747778;
54
+ --color-neutral-60: #8e9192;
55
+ --color-neutral-70: #a9acac;
56
+ --color-neutral-80: #c4c7c7;
57
+ --color-neutral-90: #e0e3e3;
58
+ --color-neutral-95: #eff1f1;
59
+ --color-neutral-99: #f7f8f8;
60
+ --color-neutral-variant-10: #1b1b22;
61
+ --color-neutral-variant-20: #302f38;
62
+ --color-neutral-variant-30: #47464e;
63
+ --color-neutral-variant-40: #5f5d67;
64
+ --color-neutral-variant-50: #78767f;
65
+ --color-neutral-variant-60: #928f9a;
66
+ --color-neutral-variant-70: #adaab4;
67
+ --color-neutral-variant-80: #c9c5d0;
68
+ --color-neutral-variant-90: #e5e1ec;
69
+ --color-neutral-variant-95: #f3effa;
70
+ --color-neutral-variant-99: #fffbff;
71
+ --color-success-10: #002106;
72
+ --color-success-20: #00390b;
73
+ --color-success-30: #005314;
74
+ --color-success-40: #116d26;
75
+ --color-success-50: #32873d;
76
+ --color-success-60: #4ea254;
77
+ --color-success-70: #68be6c;
78
+ --color-success-80: #83da85;
79
+ --color-success-90: #9fe79f;
80
+ --color-success-95: #bdefbd;
81
+ --color-success-99: #ebf9eb;
82
+ --color-alert-10: #2b1700;
83
+ --color-alert-20: #472a00;
84
+ --color-alert-30: #663e00;
85
+ --color-alert-40: #865300;
86
+ --color-alert-50: #a76900;
87
+ --color-alert-60: #ca8000;
88
+ --color-alert-70: #eb9918;
89
+ --color-alert-80: #ffb95a;
90
+ --color-alert-90: #ffddb5;
91
+ --color-alert-95: #ffeedc;
92
+ --color-alert-99: #fff5eb;
93
+
94
+ // color aliases
95
+ --color-primary: var(--color-primary-40);
96
+ --color-on-primary: var(--color-all-100);
97
+ --color-primary-container: var(--color-primary-90);
98
+ --color-on-primary-container: var(--color-primary-10);
99
+ --color-secondary: var(--color-secondary-40);
100
+ --color-on-secondary: var(--color-all-100);
101
+ --color-secondary-container: var(--color-secondary-30);
102
+ --color-on-secondary-container: var(--color-secondary-10);
103
+ --color-tertiary: var(--color-tertiary-40);
104
+ --color-on-tertiary: var(--color-all-100);
105
+ --color-tertiary-container: var(--color-tertiary-90);
106
+ --color-on-tertiary-container: var(--color-tertiary-10);
107
+ --color-error: var(--color-error-40);
108
+ --color-on-error: var(--color-all-100);
109
+ --color-error-container: var(--color-error-90);
110
+ --color-on-error-container: var(--color-error-10);
111
+ --color-background: var(--color-neutral-99);
112
+ --color-on-background: var(--color-neutral-10);
113
+ --color-surface: var(--color-neutral-99);
114
+ --color-surface-1: #ecebf6; // Neutral-99 + 2% Neutral-Variant-50 + 5% Primary-40
115
+ --color-surface-2: #e8e6f6; // Neutral-99 + 2% Neutral-Variant-50 + 8% Primary-40
116
+ --color-surface-3: #e3e0f6; // Neutral-99 + 2% Neutral-Variant-50 + 11% Primary-40
117
+ --color-surface-4: #dfdaf5; // Neutral-99 + 2% Neutral-Variant-50 + 14% Primary-40
118
+ --color-surface-5: #dcd6f5; // Neutral-99 + 2% Neutral-Variant-50 + 16% Primary-40
119
+ --color-on-surface: var(--color-neutral-10);
120
+ --color-surface-variant: var(--color-neutral-variant-90);
121
+ --color-on-surface-variant: var(--color-neutral-variant-30);
122
+ --color-outline: var(--color-neutral-variant-50);
123
+ --color-primary-hover: var(--color-primary-50);
124
+ --color-primary-pressed: var(--color-primary-30);
125
+ --color-danger-hover: var(--color-error-50);
126
+ --color-danger-pressed: var(--color-error-30);
127
+ --color-text: var(--color-neutral-10);
128
+ --color-text-link: var(--color-primary-40);
129
+ --color-icon: var(--color-neutral-50);
130
+ --color-caption: var(--color-neutral-50);
131
+ --color-border: var(--color-neutral-80);
132
+ --color-divider: var(--color-neutral-90);
133
+ --color-disabled: var(--color-neutral-80);
134
+ --color-base: var(--color-surface-1);
135
+ --color-layer-1: var(--color-all-100);
136
+ --color-layer-2: var(--color-neutral-95);
137
+ --color-float: var(--color-all-100);
138
+ --color-layer-light: var(--color-neutral-99);
139
+ --color-inverse-surface: var(--color-neutral-20);
140
+ --color-inverse-on-surface: var(--color-neutral-95);
141
+ --color-inverse-primary: var(--color-primary-50);
142
+ --color-shadow: var(--color-all-100);
143
+ --color-white: #fff;
144
+ --color-button-icon: var(--color-primary-80);
145
+ --color-icon-background: var(--color-neutral-variant-95);
146
+ --color-hover: rgba(25, 28, 29, 8%); // 8% Neutral-10
147
+ --color-pressed: rgba(25, 28, 29, 12%); // 12% Neutral-10
148
+ --color-focused: rgba(25, 28, 29, 16%); // 16% Neutral-10
149
+ --color-hover-variant: rgba(93, 52, 242, 8%); // 8% Primary-40
150
+ --color-pressed-variant: rgba(93, 52, 242, 12%); // 12% Primary-40
151
+ --color-focused-variant: rgba(93, 52, 242, 16%); // 16% Primary-40
152
+
153
+ // Shadows
154
+ --shadow-1: 0 4px 8px rgba(0, 0, 0, 8%);
155
+ --shadow-2: 0 4px 12px rgba(0, 0, 0, 12%);
156
+ --shadow-2-reversed: 0 -4px 12px rgba(0, 0, 0, 12%);
157
+ --shadow-3: 0 4px 16px rgba(0, 0, 0, 20%);
158
+
159
+ // Client specific variables (not available in design system)
160
+ --color-danger-toast-background: var(--color-error-95);
161
+ --color-danger-focused: rgba(186, 27, 27, 16%); // 16% Error-40
162
+ --color-tooltip-background: #34353f; // dark theme Surface-4
163
+ --color-tooltip-text: var(--color-neutral-99);
164
+ --color-overlay: rgba(0, 0, 0, 30%);
165
+ --color-drawer-overlay: rgba(0, 0, 0, 40%);
166
+ --color-guide-dropdown-background: var(--color-white);
167
+ --color-guide-dropdown-border: var(--color-border);
168
+ --color-skeleton-shimmer-rgb: 255, 255, 255; // rgb of Layer-1
169
+ }
170
+
171
+ @mixin dark {
172
+ // tonal palettes
173
+ --color-all-0: #fff;
174
+ --color-all-100: #000;
175
+ --color-primary-10: #fffbff;
176
+ --color-primary-20: #f5eeff;
177
+ --color-primary-30: #e6deff;
178
+ --color-primary-40: #cabeff;
179
+ --color-primary-50: #af9eff;
180
+ --color-primary-60: #947dff;
181
+ --color-primary-70: #7958ff;
182
+ --color-primary-80: #5d34f2;
183
+ --color-primary-90: #4300da;
184
+ --color-primary-95: #2d009d;
185
+ --color-primary-99: #190064;
186
+ --color-secondary-10: #fffbf7;
187
+ --color-secondary-20: #fff480;
188
+ --color-secondary-30: #f4e560;
189
+ --color-secondary-40: #d7c947;
190
+ --color-secondary-50: #baad2d;
191
+ --color-secondary-60: #9f930d;
192
+ --color-secondary-70: #847900;
193
+ --color-secondary-80: #695f00;
194
+ --color-secondary-90: #4f4700;
195
+ --color-secondary-95: #373100;
196
+ --color-secondary-99: #201c00;
197
+ --color-tertiary-10: #fcfcfc;
198
+ --color-tertiary-20: #ffeafe;
199
+ --color-tertiary-30: #ffd5ff;
200
+ --color-tertiary-40: #faabff;
201
+ --color-tertiary-50: #f07eff;
202
+ --color-tertiary-60: #d361e7;
203
+ --color-tertiary-70: #b545ca;
204
+ --color-tertiary-80: #9927af;
205
+ --color-tertiary-90: #7b0093;
206
+ --color-tertiary-95: #560068;
207
+ --color-tertiary-99: #350041;
208
+ --color-error-10: #fcfcfc;
209
+ --color-error-20: #ffede9;
210
+ --color-error-30: #ffdad4;
211
+ --color-error-40: #ffb4a9;
212
+ --color-error-50: #ff897a;
213
+ --color-error-60: #ff5449;
214
+ --color-error-70: #dd3730;
215
+ --color-error-80: #ba1b1b;
216
+ --color-error-90: #930006;
217
+ --color-error-95: #680003;
218
+ --color-error-99: #410001;
219
+ --color-neutral-10: #f7f8f8;
220
+ --color-neutral-20: #eff1f1;
221
+ --color-neutral-30: #e0e3e3;
222
+ --color-neutral-40: #c4c7c7;
223
+ --color-neutral-50: #a9acac;
224
+ --color-neutral-60: #8e9192;
225
+ --color-neutral-70: #747778;
226
+ --color-neutral-80: #5c5f60;
227
+ --color-neutral-90: #444748;
228
+ --color-neutral-95: #2d3132;
229
+ --color-neutral-99: #191c1d;
230
+ --color-neutral-variant-10: #fffbff;
231
+ --color-neutral-variant-20: #f3effa;
232
+ --color-neutral-variant-30: #e5e1ec;
233
+ --color-neutral-variant-40: #c9c5d0;
234
+ --color-neutral-variant-50: #adaab4;
235
+ --color-neutral-variant-60: #928f9a;
236
+ --color-neutral-variant-70: #78767f;
237
+ --color-neutral-variant-80: #5f5d67;
238
+ --color-neutral-variant-90: #47464e;
239
+ --color-neutral-variant-95: #302f38;
240
+ --color-neutral-variant-99: #1b1b22;
241
+ --color-success-10: #ebf9eb;
242
+ --color-success-20: #bdefbd;
243
+ --color-success-30: #9fe79f;
244
+ --color-success-40: #83da85;
245
+ --color-success-50: #68be6c;
246
+ --color-success-60: #4ea254;
247
+ --color-success-70: #32873d;
248
+ --color-success-80: #116d26;
249
+ --color-success-90: #005314;
250
+ --color-success-95: #00390b;
251
+ --color-success-99: #002106;
252
+ --color-alert-10: #fff5eb;
253
+ --color-alert-20: #ffeedc;
254
+ --color-alert-30: #ffddb5;
255
+ --color-alert-40: #ffb95a;
256
+ --color-alert-50: #eb9918;
257
+ --color-alert-60: #ca8000;
258
+ --color-alert-70: #a76900;
259
+ --color-alert-80: #865300;
260
+ --color-alert-90: #663e00;
261
+ --color-alert-95: #472a00;
262
+ --color-alert-99: #2b1700;
263
+
264
+ // color aliases
265
+ --color-primary: var(--color-primary-70);
266
+ --color-on-primary: var(--color-all-0);
267
+ --color-primary-container: var(--color-primary-30);
268
+ --color-on-primary-container: var(--color-primary-30);
269
+ --color-secondary: var(--color-secondary-70);
270
+ --color-on-secondary: var(--color-all-0);
271
+ --color-secondary-container: var(--color-secondary-90);
272
+ --color-on-secondary-container: var(--color-secondary-30);
273
+ --color-tertiary: var(--color-tertiary-70);
274
+ --color-on-tertiary: var(--color-all-0);
275
+ --color-tertiary-container: var(--color-tertiary-90);
276
+ --color-on-tertiary-container: var(--color-tertiary-30);
277
+ --color-error: var(--color-error-70);
278
+ --color-on-error: var(--color-all-0);
279
+ --color-error-container: var(--color-error-90);
280
+ --color-on-error-container: var(--color-error-30);
281
+ --color-background: var(--color-neutral-99);
282
+ --color-on-background: var(--color-neutral-10);
283
+ --color-surface: var(--color-neutral-99);
284
+ --color-surface-1: #25272b; // Neutral-99 + 2% Neutral-40 + 5% Primary-80
285
+ --color-surface-2: #2a2c32; // Neutral-99 + 2% Neutral-40 + 8% Primary-80
286
+ --color-surface-3: #2f3039; // Neutral-99 + 2% Neutral-40 + 11% Primary-80
287
+ --color-surface-4: #34353f; // Neutral-99 + 2% Neutral-40 + 14% Primary-80
288
+ --color-surface-5: #383844; // Neutral-99 + 2% Neutral-40 + 16% Primary-80
289
+ --color-on-surface: var(--color-neutral-10);
290
+ --color-surface-variant: var(--color-neutral-variant-90);
291
+ --color-on-surface-variant: var(--color-neutral-variant-40);
292
+ --color-outline: var(--color-neutral-variant-60);
293
+ --color-primary-hover: var(--color-primary-60);
294
+ --color-primary-pressed: var(--color-primary-80);
295
+ --color-danger-hover: var(--color-error-60);
296
+ --color-danger-pressed: var(--color-error-80);
297
+ --color-text: var(--color-neutral-10);
298
+ --color-text-link: var(--color-primary-40);
299
+ --color-icon: var(--color-neutral-50);
300
+ --color-caption: var(--color-neutral-50);
301
+ --color-border: var(--color-neutral-80);
302
+ --color-divider: var(--color-neutral-90);
303
+ --color-disabled: var(--color-neutral-80);
304
+ --color-base: var(--color-surface);
305
+ --color-layer-1: var(--color-surface-2);
306
+ --color-layer-2: var(--color-surface-4);
307
+ --color-float: var(--color-surface-4);
308
+ --color-layer-light: var(--color-surface-4);
309
+ --color-inverse-surface: var(--color-neutral-20);
310
+ --color-inverse-on-surface: var(--color-neutral-95);
311
+ --color-inverse-primary: var(--color-primary-80);
312
+ --color-shadow: var(--color-all-100);
313
+ --color-white: #fff;
314
+ --color-button-icon: var(--color-primary-20);
315
+ --color-icon-background: #3a3b59;
316
+ --color-hover: rgba(247, 248, 248, 8%); // 8% Neutral-10
317
+ --color-pressed: rgba(247, 248, 248, 12%); // 12% Neutral-10
318
+ --color-focused: rgba(247, 248, 248, 16%); // 16% Neutral-10
319
+ --color-hover-variant: rgba(202, 190, 255, 8%); // 8% Primary-40
320
+ --color-pressed-variant: rgba(202, 190, 255, 12%); // 12% Primary-40
321
+ --color-focused-variant: rgba(202, 190, 255, 16%); // 16% Primary-40
322
+
323
+ // Shadows
324
+ --shadow-1: 0 4px 8px rgba(0, 0, 0, 8%);
325
+ --shadow-2: 0 4px 12px rgba(0, 0, 0, 12%);
326
+ --shadow-2-reversed: 0 -4px 12px rgba(0, 0, 0, 12%);
327
+ --shadow-3: 0 4px 16px rgba(0, 0, 0, 20%);
328
+
329
+ // Client specific variables (not available in design system)
330
+ --color-danger-toast-background: var(--color-error-99);
331
+ --color-danger-focused: rgba(255, 180, 169, 16%); // 16% Error-40
332
+ --color-tooltip-background: var(--color-surface-4);
333
+ --color-tooltip-text: var(--color-neutral-10);
334
+ --color-overlay: rgba(0, 0, 0, 30%);
335
+ --color-drawer-overlay: rgba(0, 0, 0, 60%);
336
+ --color-guide-dropdown-background: var(--color-neutral-variant-80);
337
+ --color-guide-dropdown-border: var(--color-neutral-variant-70);
338
+ --color-skeleton-shimmer-rgb: 42, 44, 50; // rgb of Layer-1
339
+ }
@@ -0,0 +1,32 @@
1
+ $font-family:
2
+ -apple-system,
3
+ system-ui,
4
+ 'BlinkMacSystemFont',
5
+ 'Segoe UI',
6
+ 'Roboto',
7
+ 'Helvetica Neue',
8
+ 'Helvetica',
9
+ 'Arial',
10
+ sans-serif,
11
+ 'Apple Color Emoji';
12
+
13
+ :root {
14
+ --font-family: #{$font-family};
15
+ --font-headline-large: 600 32px/40px #{$font-family};
16
+ --font-headline-medium: 600 28px/36px #{$font-family};
17
+ --font-headline-small: 600 24px/32px #{$font-family};
18
+ --font-title-large: 600 20px/28px #{$font-family};
19
+ --font-title-medium: 600 16px/24px #{$font-family};
20
+ --font-title-small: 600 14px/20px #{$font-family};
21
+ --font-label-large: 500 14px/20px #{$font-family};
22
+ --font-label-medium: 500 12px/16px #{$font-family};
23
+ --font-label-small: 500 11px/16px #{$font-family};
24
+ --font-body-large: 400 16px/24px #{$font-family};
25
+ --font-body-medium: 400 14px/20px #{$font-family};
26
+ --font-body-small: 400 12px/16px #{$font-family};
27
+ --font-subhead-1: 500 16px/24px #{$font-family};
28
+ --font-subhead-2: 500 14px/20px #{$font-family};
29
+ --font-subhead-cap: 700 12px/16px #{$font-family};
30
+ --font-subhead-cap-small: 700 10px/16px #{$font-family};
31
+ --font-button: 500 14px/20px #{$font-family};
32
+ }