@openfin/ui-library 0.1.40 → 0.2.0-alpha.1657388871
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/README.md +0 -7
- package/dist/openfin.ui.js +660 -0
- package/dist/openfin.ui.js.LICENSE.txt +14 -0
- package/dist/{components → types/components}/elements/Badge/badge.d.ts +2 -1
- package/dist/types/components/elements/Icon/openfin/BellFilledIcon.d.ts +2 -0
- package/dist/{components → types/components}/elements/Icon/openfin/BellIcon.d.ts +0 -1
- package/dist/{components → types/components}/elements/Icon/openfin/BrokenLinkIcon.d.ts +0 -1
- package/dist/{components → types/components}/elements/Icon/openfin/FilterIcon.d.ts +0 -1
- package/dist/{components → types/components}/elements/Icon/openfin/FloppyDiskIcon.d.ts +0 -1
- package/dist/types/components/elements/Icon/openfin/FragmentsIcon.d.ts +2 -0
- package/dist/{components → types/components}/elements/Icon/openfin/LightBulbFilledIcon.d.ts +0 -1
- package/dist/{components → types/components}/elements/Icon/openfin/LightBulbOutlinedIcon.d.ts +0 -1
- package/dist/{components → types/components}/elements/Icon/openfin/LockedClosedFilledIcon.d.ts +0 -1
- package/dist/{components → types/components}/elements/Icon/openfin/MinimizeIcon.d.ts +0 -1
- package/dist/{components → types/components}/elements/Icon/openfin/OpenFinIcon.d.ts +0 -1
- package/dist/types/components/elements/Icon/openfin/StackIcon.d.ts +2 -0
- package/dist/types/components/elements/Icon/openfin/StorefrontIcon.d.ts +2 -0
- package/dist/{components → types/components}/elements/Icon/openfin/WorkspaceIcon.d.ts +0 -1
- package/dist/{components → types/components}/elements/Icon/openfin/index.d.ts +4 -0
- package/dist/types/components/elements/IconWithBadge/iconWithBadge.d.ts +5 -0
- package/dist/types/components/elements/IconWithBadge/index.d.ts +1 -0
- package/dist/types/components/input/RadioGroup/index.d.ts +1 -0
- package/dist/types/components/input/RadioGroup/radioGroup.d.ts +12 -0
- package/dist/types/components/input/RadioInput/index.d.ts +1 -0
- package/dist/types/components/input/RadioInput/radioInput.d.ts +11 -0
- package/dist/{components → types/components}/system/ThemeProvider/lib/colors.d.ts +2 -2
- package/dist/{components → types/components}/system/ThemeProvider/lib/constants.d.ts +4 -2
- package/dist/{components → types/components}/system/ThemeProvider/lib/helpers.d.ts +2 -1
- package/dist/{components → types/components}/typography/Heading/heading.d.ts +24 -24
- package/dist/{index.d.ts → types/index.d.ts} +2 -0
- package/dist/{lib → types/lib}/math.d.ts +5 -1
- package/dist/{storybookHelpers.d.ts → types/storybookHelpers.d.ts} +1 -1
- package/package.json +93 -70
- package/dist/assets/fonts/index.d.ts +0 -6
- package/dist/assets/fonts/index.js +0 -11
- package/dist/components/controls/Button/button.js +0 -83
- package/dist/components/controls/Button/button.variants.js +0 -124
- package/dist/components/controls/Button/index.js +0 -14
- package/dist/components/controls/Toggle/index.js +0 -13
- package/dist/components/controls/Toggle/toggle.js +0 -98
- package/dist/components/elements/Badge/badge.js +0 -41
- package/dist/components/elements/Badge/index.js +0 -13
- package/dist/components/elements/Icon/icon.js +0 -56
- package/dist/components/elements/Icon/icon.variants.js +0 -60
- package/dist/components/elements/Icon/index.js +0 -13
- package/dist/components/elements/Icon/openfin/BellIcon.js +0 -24
- package/dist/components/elements/Icon/openfin/BrokenLinkIcon.js +0 -21
- package/dist/components/elements/Icon/openfin/FilterIcon.js +0 -20
- package/dist/components/elements/Icon/openfin/FloppyDiskIcon.js +0 -23
- package/dist/components/elements/Icon/openfin/LightBulbFilledIcon.js +0 -21
- package/dist/components/elements/Icon/openfin/LightBulbOutlinedIcon.js +0 -20
- package/dist/components/elements/Icon/openfin/LockedClosedFilledIcon.js +0 -23
- package/dist/components/elements/Icon/openfin/MinimizeIcon.js +0 -23
- package/dist/components/elements/Icon/openfin/OpenFinIcon.js +0 -23
- package/dist/components/elements/Icon/openfin/WorkspaceIcon.js +0 -26
- package/dist/components/elements/Icon/openfin/index.js +0 -22
- package/dist/components/elements/Loader/index.js +0 -13
- package/dist/components/elements/Loader/loader.js +0 -25
- package/dist/components/input/BaseInput/baseInput.js +0 -94
- package/dist/components/input/BaseInput/index.js +0 -13
- package/dist/components/input/Checkbox/checkbox.js +0 -96
- package/dist/components/input/Checkbox/index.js +0 -13
- package/dist/components/input/NumberInput/index.js +0 -13
- package/dist/components/input/NumberInput/numberInput.js +0 -108
- package/dist/components/input/RawInput/index.js +0 -13
- package/dist/components/input/RawInput/rawInput.js +0 -12
- package/dist/components/input/TextInput/index.js +0 -13
- package/dist/components/input/TextInput/textInput.js +0 -10
- package/dist/components/layout/Box/box.js +0 -50
- package/dist/components/layout/Box/index.js +0 -13
- package/dist/components/layout/Box/types.js +0 -2
- package/dist/components/layout/DefinitionList/definitionList.js +0 -49
- package/dist/components/layout/DefinitionList/index.js +0 -13
- package/dist/components/system/GlobalStyles/globalStyles.js +0 -53
- package/dist/components/system/GlobalStyles/index.js +0 -13
- package/dist/components/system/HOC/index.js +0 -2
- package/dist/components/system/ThemeProvider/index.js +0 -21
- package/dist/components/system/ThemeProvider/lib/colors.js +0 -21
- package/dist/components/system/ThemeProvider/lib/config.js +0 -6
- package/dist/components/system/ThemeProvider/lib/constants.js +0 -271
- package/dist/components/system/ThemeProvider/lib/createFontFaceCss.js +0 -43
- package/dist/components/system/ThemeProvider/lib/createTheme.js +0 -43
- package/dist/components/system/ThemeProvider/lib/fonts.d.js +0 -1
- package/dist/components/system/ThemeProvider/lib/helpers.js +0 -54
- package/dist/components/system/ThemeProvider/lib/interface.js +0 -2
- package/dist/components/system/ThemeProvider/lib/mixins.js +0 -85
- package/dist/components/system/ThemeProvider/lib/palette.js +0 -38
- package/dist/components/system/ThemeProvider/lib/types.js +0 -2
- package/dist/components/system/ThemeProvider/theme/index.js +0 -13
- package/dist/components/system/ThemeProvider/theme/openfin.js +0 -39
- package/dist/components/system/ThemeProvider/themeProvider.js +0 -20
- package/dist/components/templates/ContactCard/contactCard.js +0 -114
- package/dist/components/templates/ContactCard/index.js +0 -13
- package/dist/components/templates/utils/name.js +0 -22
- package/dist/components/typography/Heading/heading.js +0 -64
- package/dist/components/typography/Heading/index.js +0 -13
- package/dist/components/typography/Text/index.js +0 -13
- package/dist/components/typography/Text/text.js +0 -21
- package/dist/hooks/useColorScheme.js +0 -33
- package/dist/hooks/useMediaQuery.js +0 -39
- package/dist/hooks/usePrevious.js +0 -12
- package/dist/hooks/useTheme.js +0 -34
- package/dist/index.js +0 -46
- package/dist/lib/math.js +0 -24
- package/dist/lib/whenFin.js +0 -13
- package/dist/lib/whenFin.spec.js +0 -39
- package/dist/react-app-env.d.js +0 -2
- package/dist/storybookHelpers.js +0 -58
- /package/dist/{components → types/components}/controls/Button/button.d.ts +0 -0
- /package/dist/{components → types/components}/controls/Button/button.variants.d.ts +0 -0
- /package/dist/{components → types/components}/controls/Button/index.d.ts +0 -0
- /package/dist/{components → types/components}/controls/Toggle/index.d.ts +0 -0
- /package/dist/{components → types/components}/controls/Toggle/toggle.d.ts +0 -0
- /package/dist/{components → types/components}/elements/Badge/index.d.ts +0 -0
- /package/dist/{components → types/components}/elements/Icon/icon.d.ts +0 -0
- /package/dist/{components → types/components}/elements/Icon/icon.variants.d.ts +0 -0
- /package/dist/{components → types/components}/elements/Icon/index.d.ts +0 -0
- /package/dist/{components → types/components}/elements/Loader/index.d.ts +0 -0
- /package/dist/{components → types/components}/elements/Loader/loader.d.ts +0 -0
- /package/dist/{components → types/components}/input/BaseInput/baseInput.d.ts +0 -0
- /package/dist/{components → types/components}/input/BaseInput/index.d.ts +0 -0
- /package/dist/{components → types/components}/input/Checkbox/checkbox.d.ts +0 -0
- /package/dist/{components → types/components}/input/Checkbox/index.d.ts +0 -0
- /package/dist/{components → types/components}/input/NumberInput/index.d.ts +0 -0
- /package/dist/{components → types/components}/input/NumberInput/numberInput.d.ts +0 -0
- /package/dist/{components → types/components}/input/RawInput/index.d.ts +0 -0
- /package/dist/{components → types/components}/input/RawInput/rawInput.d.ts +0 -0
- /package/dist/{components → types/components}/input/TextInput/index.d.ts +0 -0
- /package/dist/{components → types/components}/input/TextInput/textInput.d.ts +0 -0
- /package/dist/{components → types/components}/layout/Box/box.d.ts +0 -0
- /package/dist/{components → types/components}/layout/Box/index.d.ts +0 -0
- /package/dist/{components → types/components}/layout/Box/types.d.ts +0 -0
- /package/dist/{components → types/components}/layout/DefinitionList/definitionList.d.ts +0 -0
- /package/dist/{components → types/components}/layout/DefinitionList/index.d.ts +0 -0
- /package/dist/{components → types/components}/system/GlobalStyles/globalStyles.d.ts +0 -0
- /package/dist/{components → types/components}/system/GlobalStyles/index.d.ts +0 -0
- /package/dist/{components → types/components}/system/HOC/index.d.ts +0 -0
- /package/dist/{components → types/components}/system/ThemeProvider/index.d.ts +0 -0
- /package/dist/{components → types/components}/system/ThemeProvider/lib/config.d.ts +0 -0
- /package/dist/{components → types/components}/system/ThemeProvider/lib/createFontFaceCss.d.ts +0 -0
- /package/dist/{components → types/components}/system/ThemeProvider/lib/createTheme.d.ts +0 -0
- /package/dist/{components → types/components}/system/ThemeProvider/lib/interface.d.ts +0 -0
- /package/dist/{components → types/components}/system/ThemeProvider/lib/mixins.d.ts +0 -0
- /package/dist/{components → types/components}/system/ThemeProvider/lib/palette.d.ts +0 -0
- /package/dist/{components → types/components}/system/ThemeProvider/lib/types.d.ts +0 -0
- /package/dist/{components → types/components}/system/ThemeProvider/theme/index.d.ts +0 -0
- /package/dist/{components → types/components}/system/ThemeProvider/theme/openfin.d.ts +0 -0
- /package/dist/{components → types/components}/system/ThemeProvider/themeProvider.d.ts +0 -0
- /package/dist/{components → types/components}/templates/ContactCard/contactCard.d.ts +0 -0
- /package/dist/{components → types/components}/templates/ContactCard/index.d.ts +0 -0
- /package/dist/{components → types/components}/templates/utils/name.d.ts +0 -0
- /package/dist/{components → types/components}/typography/Heading/index.d.ts +0 -0
- /package/dist/{components → types/components}/typography/Text/index.d.ts +0 -0
- /package/dist/{components → types/components}/typography/Text/text.d.ts +0 -0
- /package/dist/{hooks → types/hooks}/useColorScheme.d.ts +0 -0
- /package/dist/{hooks → types/hooks}/useMediaQuery.d.ts +0 -0
- /package/dist/{hooks → types/hooks}/usePrevious.d.ts +0 -0
- /package/dist/{hooks → types/hooks}/useTheme.d.ts +0 -0
- /package/dist/{lib → types/lib}/whenFin.d.ts +0 -0
- /package/dist/{lib → types/lib}/whenFin.spec.d.ts +0 -0
|
@@ -7,6 +7,8 @@ export * from './components/input/RawInput';
|
|
|
7
7
|
export * from './components/input/TextInput';
|
|
8
8
|
export * from './components/input/NumberInput';
|
|
9
9
|
export * from './components/input/Checkbox';
|
|
10
|
+
export * from './components/input/RadioInput';
|
|
11
|
+
export * from './components/input/RadioGroup';
|
|
10
12
|
export * from './components/layout/Box';
|
|
11
13
|
export * from './components/layout/DefinitionList';
|
|
12
14
|
export * from './components/system/GlobalStyles';
|
|
@@ -6,4 +6,8 @@
|
|
|
6
6
|
* @returns A number in the range [min, max]
|
|
7
7
|
* @type Number
|
|
8
8
|
*/
|
|
9
|
-
export declare const clamp: (num: number, min?: number
|
|
9
|
+
export declare const clamp: (num: number, min?: number, max?: number) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Generates a random integer.
|
|
12
|
+
*/
|
|
13
|
+
export declare const generateRandomInteger: () => number;
|
package/package.json
CHANGED
|
@@ -1,96 +1,95 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfin/ui-library",
|
|
3
3
|
"description": "OpenFin UI Component Library",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"main": "dist/
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
4
|
+
"version": "0.2.0-alpha.1657388871",
|
|
5
|
+
"main": "dist/openfin.ui.js",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
7
|
"repository": "github:openfin/ui-library",
|
|
8
8
|
"homepage": "https://openfin-ui.netlify.app",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/**/*"
|
|
11
11
|
],
|
|
12
12
|
"license": "MIT",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "yarn storybook",
|
|
15
|
+
"build": "yarn build:clean && yarn build:src",
|
|
16
|
+
"build:src": "webpack build --config webpack.config.js --mode production",
|
|
17
|
+
"build:clean": "rimraf dist",
|
|
18
|
+
"build:dev": "webpack build --config webpack.config.js --mode development && yalc push",
|
|
19
|
+
"test": "jest",
|
|
20
|
+
"lint": "yarn lint:typescript && yarn lint:styles",
|
|
21
|
+
"lint:typescript": "eslint \"./src/**/*.{ts,tsx}\"",
|
|
22
|
+
"lint:styles": "stylelint \"./src/**/*.{ts,tsx}\"",
|
|
23
|
+
"storybook": "yarn storybook:cache-clear && start-storybook -p 6006 -s public",
|
|
24
|
+
"storybook:build": "build-storybook -s public",
|
|
25
|
+
"storybook:cache-clear": "rimraf ./node_modules/.cache/storybook"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"styled-components": "=>4.4.1 <6.0.0"
|
|
29
|
+
},
|
|
30
|
+
"resolutions": {
|
|
31
|
+
"@types/react": "^17",
|
|
32
|
+
"@types/react-dom": "^17",
|
|
33
|
+
"react": "^17",
|
|
34
|
+
"react-dom": "^17",
|
|
35
|
+
"react-is": "^17",
|
|
36
|
+
"styled-components": "^5"
|
|
37
|
+
},
|
|
13
38
|
"dependencies": {
|
|
14
39
|
"@modulz/radix-icons": "^4.0.0",
|
|
15
40
|
"tinycolor2": "^1.4.2"
|
|
16
41
|
},
|
|
17
|
-
"peerDependencies": {
|
|
18
|
-
"styled-components": "4.4.1"
|
|
19
|
-
},
|
|
20
42
|
"devDependencies": {
|
|
21
|
-
"@babel/
|
|
22
|
-
"@
|
|
23
|
-
"@
|
|
24
|
-
"@
|
|
25
|
-
"@storybook/addon-
|
|
26
|
-
"@storybook/
|
|
27
|
-
"@storybook/
|
|
28
|
-
"@storybook/node-logger": "^6.
|
|
29
|
-
"@storybook/
|
|
30
|
-
"@
|
|
31
|
-
"@testing-library/jest-dom": "^5.
|
|
32
|
-
"@testing-library/react": "^
|
|
33
|
-
"@testing-library/user-event": "^
|
|
34
|
-
"@
|
|
35
|
-
"@types/
|
|
36
|
-
"@types/
|
|
37
|
-
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
38
|
-
"@types/node": "^14.14.34",
|
|
43
|
+
"@babel/core": "^7.18.6",
|
|
44
|
+
"@storybook/addon-actions": "^6.5.9",
|
|
45
|
+
"@storybook/addon-essentials": "^6.5.9",
|
|
46
|
+
"@storybook/addon-interactions": "^6.5.9",
|
|
47
|
+
"@storybook/addon-links": "^6.5.9",
|
|
48
|
+
"@storybook/builder-webpack5": "^6.5.9",
|
|
49
|
+
"@storybook/manager-webpack5": "^6.5.9",
|
|
50
|
+
"@storybook/node-logger": "^6.5.9",
|
|
51
|
+
"@storybook/react": "^6.5.9",
|
|
52
|
+
"@testing-library/dom": "^8.14.0",
|
|
53
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
54
|
+
"@testing-library/react": "^12.1.5",
|
|
55
|
+
"@testing-library/user-event": "^14.2.1",
|
|
56
|
+
"@types/jest": "^28.1.3",
|
|
57
|
+
"@types/lodash.defaultsdeep": "^4.6.7",
|
|
58
|
+
"@types/node": "^18.0.0",
|
|
39
59
|
"@types/react": "^17.0.3",
|
|
40
60
|
"@types/react-dom": "^17.0.2",
|
|
41
|
-
"@types/styled-components": "^5.1.
|
|
42
|
-
"@types/tinycolor2": "^1.4.
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
44
|
-
"@typescript-eslint/parser": "^
|
|
45
|
-
"babel-
|
|
61
|
+
"@types/styled-components": "^5.1.25",
|
|
62
|
+
"@types/tinycolor2": "^1.4.3",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
|
64
|
+
"@typescript-eslint/parser": "^5.29.0",
|
|
65
|
+
"babel-loader": "^8.2.5",
|
|
66
|
+
"copy-webpack-plugin": "^11.0.0",
|
|
46
67
|
"cross-env": "^7.0.3",
|
|
47
|
-
"eslint": "^
|
|
48
|
-
"eslint-config-prettier": "^8.
|
|
49
|
-
"eslint-plugin-jest": "^
|
|
50
|
-
"eslint-plugin-prettier": "^
|
|
51
|
-
"eslint-plugin-react": "^7.
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"prettier": "^2.
|
|
68
|
+
"eslint": "^8.18.0",
|
|
69
|
+
"eslint-config-prettier": "^8.5.0",
|
|
70
|
+
"eslint-plugin-jest": "^26.5.3",
|
|
71
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
72
|
+
"eslint-plugin-react": "^7.30.0",
|
|
73
|
+
"jest": "^28.1.2",
|
|
74
|
+
"jest-environment-jsdom": "^28.1.2",
|
|
75
|
+
"prettier": "^2.7.1",
|
|
55
76
|
"react": "^17.0.1",
|
|
56
77
|
"react-dom": "^17.0.1",
|
|
57
|
-
"react-
|
|
78
|
+
"react-is": "^17.0.2",
|
|
79
|
+
"react-refresh": "^0.14.0",
|
|
80
|
+
"require-from-string": "^2.0.2",
|
|
58
81
|
"rimraf": "^3.0.2",
|
|
59
82
|
"storybook-addon-performance": "^0.16.1",
|
|
60
|
-
"styled-components": "
|
|
61
|
-
"stylelint": "^
|
|
62
|
-
"stylelint-config-recommended": "^
|
|
83
|
+
"styled-components": "^5.3.5",
|
|
84
|
+
"stylelint": "^14.9.1",
|
|
85
|
+
"stylelint-config-recommended": "^8.0.0",
|
|
63
86
|
"stylelint-config-styled-components": "^0.1.1",
|
|
64
87
|
"stylelint-processor-styled-components": "^1.10.0",
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"start": "yarn storybook",
|
|
71
|
-
"build": "yarn build:clean && yarn build:bundle",
|
|
72
|
-
"build:bundle": "yarn build:scripts && yarn build:types && yarn build:copy-assets",
|
|
73
|
-
"build:clean": "rimraf dist",
|
|
74
|
-
"build:copy-assets": "babel src/assets/ -d dist/assets --ignore \"src/**/*.ts\" --copy-files --no-copy-ignored --extensions .ts",
|
|
75
|
-
"build:dev": "yarn build && yalc push",
|
|
76
|
-
"build:scripts": "cross-env NODE_ENV=production babel src -d dist --extensions '.ts,.tsx'",
|
|
77
|
-
"build:types": "tsc -p tsconfig.bundle.json",
|
|
78
|
-
"test": "react-scripts test",
|
|
79
|
-
"eject": "react-scripts eject",
|
|
80
|
-
"lint": "yarn lint:typescript && yarn lint:styles",
|
|
81
|
-
"lint:typescript": "eslint \"./src/**/*.{ts,tsx}\"",
|
|
82
|
-
"lint:styles": "stylelint \"./src/**/*.{ts,tsx}\"",
|
|
83
|
-
"storybook": "yarn storybook:cache-clear && start-storybook -p 6006 -s public",
|
|
84
|
-
"storybook:build": "build-storybook -s public",
|
|
85
|
-
"storybook:cache-clear": "rimraf ./node_modules/.cache/storybook",
|
|
86
|
-
"git:pre-push": "yarn lint && yarn test --watchAll=false && yarn build",
|
|
87
|
-
"prepare": "husky install"
|
|
88
|
-
},
|
|
89
|
-
"env": {
|
|
90
|
-
"jest/globals": true
|
|
91
|
-
},
|
|
92
|
-
"resolutions": {
|
|
93
|
-
"babel-loader": "8.1.0"
|
|
88
|
+
"ts-jest": "^28.0.5",
|
|
89
|
+
"ts-loader": "^9.3.1",
|
|
90
|
+
"typescript": "^4.7.4",
|
|
91
|
+
"webpack": "^5.73.0",
|
|
92
|
+
"webpack-cli": "^4.10.0"
|
|
94
93
|
},
|
|
95
94
|
"browserslist": {
|
|
96
95
|
"production": [
|
|
@@ -106,16 +105,30 @@
|
|
|
106
105
|
},
|
|
107
106
|
"eslintConfig": {
|
|
108
107
|
"extends": [
|
|
108
|
+
"plugin:@typescript-eslint/recommended",
|
|
109
|
+
"prettier",
|
|
109
110
|
"eslint:recommended",
|
|
110
111
|
"plugin:react/recommended",
|
|
111
112
|
"plugin:jest/recommended"
|
|
112
113
|
],
|
|
113
114
|
"parser": "@typescript-eslint/parser",
|
|
115
|
+
"parserOptions": {
|
|
116
|
+
"project": "./*/tsconfig.json"
|
|
117
|
+
},
|
|
114
118
|
"plugins": [
|
|
115
119
|
"@typescript-eslint",
|
|
116
120
|
"jest"
|
|
117
121
|
],
|
|
118
122
|
"rules": {
|
|
123
|
+
"@typescript-eslint/ban-types": [
|
|
124
|
+
"error",
|
|
125
|
+
{
|
|
126
|
+
"types": {
|
|
127
|
+
"Function": false
|
|
128
|
+
},
|
|
129
|
+
"extendDefaults": true
|
|
130
|
+
}
|
|
131
|
+
],
|
|
119
132
|
"dot-notation": "error",
|
|
120
133
|
"react/prop-types": "off",
|
|
121
134
|
"react/jsx-uses-react": "off",
|
|
@@ -154,5 +167,15 @@
|
|
|
154
167
|
"trailingComma": "es5",
|
|
155
168
|
"arrowParens": "always",
|
|
156
169
|
"printWidth": 100
|
|
170
|
+
},
|
|
171
|
+
"jest": {
|
|
172
|
+
"preset": "ts-jest",
|
|
173
|
+
"setupFilesAfterEnv": [
|
|
174
|
+
"<rootDir>/src/setupTests.ts"
|
|
175
|
+
],
|
|
176
|
+
"testEnvironment": "jsdom",
|
|
177
|
+
"testMatch": [
|
|
178
|
+
"<rootDir>/src/**/*.test.tsx"
|
|
179
|
+
]
|
|
157
180
|
}
|
|
158
181
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
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.Fonts = void 0;
|
|
7
|
-
const Inter_Regular_woff2_1 = __importDefault(require("./Inter-Regular.woff2"));
|
|
8
|
-
const Inter_Italic_woff2_1 = __importDefault(require("./Inter-Italic.woff2"));
|
|
9
|
-
const Inter_SemiBold_woff2_1 = __importDefault(require("./Inter-SemiBold.woff2"));
|
|
10
|
-
const Inter_SemiBoldItalic_woff2_1 = __importDefault(require("./Inter-SemiBoldItalic.woff2"));
|
|
11
|
-
exports.Fonts = { regular: Inter_Regular_woff2_1.default, italic: Inter_Italic_woff2_1.default, semiBold: Inter_SemiBold_woff2_1.default, semiBoldItalic: Inter_SemiBoldItalic_woff2_1.default };
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ButtonTextOnly = exports.ButtonSecondary = exports.ButtonPrimary = exports.Button = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
20
|
-
const Box_1 = require("../../layout/Box");
|
|
21
|
-
const helpers_1 = require("../../system/ThemeProvider/lib/helpers");
|
|
22
|
-
const button_variants_1 = require("./button.variants");
|
|
23
|
-
/**
|
|
24
|
-
* Button as Anchor
|
|
25
|
-
* @example <Button as="a" href="https://..." />
|
|
26
|
-
*
|
|
27
|
-
* Button with Label
|
|
28
|
-
* @example <Button label="..." />
|
|
29
|
-
*
|
|
30
|
-
* Button with Child Element
|
|
31
|
-
* @example <Button><Child /></Button>
|
|
32
|
-
*/
|
|
33
|
-
const Button = (_a) => {
|
|
34
|
-
var { label, children, size = 'base', shape = 'square', kind = 'primary', layout = 'fit', href } = _a, buttonProps = __rest(_a, ["label", "children", "size", "shape", "kind", "layout", "href"]);
|
|
35
|
-
return (jsx_runtime_1.jsx(ButtonElement, Object.assign({ as: href ? 'a' : 'button', size: size, shape: shape, kind: kind, layout: layout }, buttonProps, { children: label ? (jsx_runtime_1.jsx(ButtonLabel, Object.assign({ alignItems: "center", justifyContent: "center" }, { children: label }), void 0)) : (children) }), void 0));
|
|
36
|
-
};
|
|
37
|
-
exports.Button = Button;
|
|
38
|
-
const ButtonElement = styled_components_1.default.button `
|
|
39
|
-
/* Default values that get overridden by variants */
|
|
40
|
-
background: ${({ theme }) => theme.palette.inputBackground};
|
|
41
|
-
border: 1px solid ${({ theme }) => theme.palette.inputBackground};
|
|
42
|
-
color: ${({ theme }) => theme.palette.brandPrimaryText};
|
|
43
|
-
|
|
44
|
-
/* Inject variants */
|
|
45
|
-
${helpers_1.getVariantCSS(button_variants_1.variants, button_variants_1.Variant.size)}
|
|
46
|
-
${helpers_1.getVariantCSS(button_variants_1.variants, button_variants_1.Variant.shape)}
|
|
47
|
-
${helpers_1.getVariantCSS(button_variants_1.variants, button_variants_1.Variant.kind)}
|
|
48
|
-
${helpers_1.getVariantCSS(button_variants_1.variants, button_variants_1.Variant.layout)}
|
|
49
|
-
|
|
50
|
-
display: inline-flex;
|
|
51
|
-
align-items: center;
|
|
52
|
-
gap: ${({ theme }) => theme.px.small};
|
|
53
|
-
outline: none;
|
|
54
|
-
text-decoration: none;
|
|
55
|
-
white-space: nowrap;
|
|
56
|
-
line-height: ${({ theme }) => theme.lineHeight.ui};
|
|
57
|
-
font-weight: ${({ theme }) => theme.fontWeight.bold};
|
|
58
|
-
transition: border-color var(--openfin-ui-globalTransition);
|
|
59
|
-
|
|
60
|
-
&:not(:disabled) {
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&:disabled,
|
|
65
|
-
&:active:disabled {
|
|
66
|
-
background: ${({ theme }) => theme.palette.inputDisabled};
|
|
67
|
-
border-color: ${({ theme }) => theme.palette.inputDisabled};
|
|
68
|
-
color: ${({ theme }) => theme.palette.inputPlaceholder};
|
|
69
|
-
cursor: not-allowed;
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
72
|
-
const ButtonLabel = styled_components_1.default(Box_1.Box) `
|
|
73
|
-
padding: ${({ theme }) => `0 ${theme.px.xsmall}`};
|
|
74
|
-
`;
|
|
75
|
-
/**
|
|
76
|
-
* ## Button Variants
|
|
77
|
-
*/
|
|
78
|
-
const ButtonPrimary = (props) => jsx_runtime_1.jsx(exports.Button, Object.assign({}, props, { kind: "primary" }), void 0);
|
|
79
|
-
exports.ButtonPrimary = ButtonPrimary;
|
|
80
|
-
const ButtonSecondary = (props) => jsx_runtime_1.jsx(exports.Button, Object.assign({}, props, { kind: "secondary" }), void 0);
|
|
81
|
-
exports.ButtonSecondary = ButtonSecondary;
|
|
82
|
-
const ButtonTextOnly = (props) => jsx_runtime_1.jsx(exports.Button, Object.assign({}, props, { kind: "textOnly" }), void 0);
|
|
83
|
-
exports.ButtonTextOnly = ButtonTextOnly;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.variants = exports.ButtonShape = exports.ButtonLayout = exports.ButtonSize = exports.ButtonKind = exports.Variant = void 0;
|
|
4
|
-
const styled_components_1 = require("styled-components");
|
|
5
|
-
/**
|
|
6
|
-
* Define all Button Variants here in one place.
|
|
7
|
-
* Variants should match the variants in Figma
|
|
8
|
-
*/
|
|
9
|
-
exports.Variant = {
|
|
10
|
-
shape: 'shape',
|
|
11
|
-
size: 'size',
|
|
12
|
-
kind: 'kind',
|
|
13
|
-
layout: 'layout',
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Button Type -- Describes the "role" of a button
|
|
17
|
-
*/
|
|
18
|
-
exports.ButtonKind = {
|
|
19
|
-
primary: 'primary',
|
|
20
|
-
secondary: 'secondary',
|
|
21
|
-
textOnly: 'textOnly',
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Button Size
|
|
25
|
-
*/
|
|
26
|
-
exports.ButtonSize = {
|
|
27
|
-
small: 'small',
|
|
28
|
-
base: 'base',
|
|
29
|
-
large: 'large',
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Button Width
|
|
33
|
-
*/
|
|
34
|
-
exports.ButtonLayout = {
|
|
35
|
-
fit: 'fit',
|
|
36
|
-
full: 'full',
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Button Shape
|
|
40
|
-
*/
|
|
41
|
-
exports.ButtonShape = {
|
|
42
|
-
square: 'square',
|
|
43
|
-
pill: 'pill',
|
|
44
|
-
};
|
|
45
|
-
exports.variants = {
|
|
46
|
-
[exports.Variant.size]: {
|
|
47
|
-
[exports.ButtonSize.base]: styled_components_1.css `
|
|
48
|
-
padding: ${({ theme }) => `${theme.px.small} ${theme.px.large}`};
|
|
49
|
-
font-size: ${({ theme }) => theme.fontSize.base};
|
|
50
|
-
`,
|
|
51
|
-
[exports.ButtonSize.small]: styled_components_1.css `
|
|
52
|
-
padding: ${({ theme }) => `${theme.px.xsmall} ${theme.px.base}`};
|
|
53
|
-
font-size: ${({ theme }) => theme.fontSize.small};
|
|
54
|
-
`,
|
|
55
|
-
[exports.ButtonSize.large]: styled_components_1.css `
|
|
56
|
-
padding: ${({ theme }) => `${theme.px.base} ${theme.px.xlarge}`};
|
|
57
|
-
font-size: ${({ theme }) => theme.fontSize.large};
|
|
58
|
-
`,
|
|
59
|
-
},
|
|
60
|
-
[exports.Variant.shape]: {
|
|
61
|
-
[exports.ButtonShape.square]: styled_components_1.css `
|
|
62
|
-
border-radius: ${({ theme }) => theme.radius.small};
|
|
63
|
-
`,
|
|
64
|
-
[exports.ButtonShape.pill]: styled_components_1.css `
|
|
65
|
-
border-radius: ${({ theme }) => theme.radius.pill};
|
|
66
|
-
`,
|
|
67
|
-
},
|
|
68
|
-
[exports.Variant.layout]: {
|
|
69
|
-
[exports.ButtonLayout.fit]: styled_components_1.css `
|
|
70
|
-
width: fit-content;
|
|
71
|
-
`,
|
|
72
|
-
[exports.ButtonLayout.full]: styled_components_1.css `
|
|
73
|
-
width: 100%;
|
|
74
|
-
`,
|
|
75
|
-
},
|
|
76
|
-
[exports.Variant.kind]: {
|
|
77
|
-
[exports.ButtonKind.primary]: styled_components_1.css `
|
|
78
|
-
background: ${({ theme }) => theme.palette.brandPrimary};
|
|
79
|
-
border-color: ${({ theme }) => theme.palette.brandPrimary};
|
|
80
|
-
|
|
81
|
-
&:hover {
|
|
82
|
-
background: ${({ theme }) => theme.palette.brandPrimaryHover};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
&:active {
|
|
86
|
-
background: ${({ theme }) => theme.palette.brandPrimaryActive};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
&:focus {
|
|
90
|
-
border-color: ${({ theme }) => theme.palette.brandPrimaryFocused};
|
|
91
|
-
}
|
|
92
|
-
`,
|
|
93
|
-
[exports.ButtonKind.secondary]: styled_components_1.css `
|
|
94
|
-
background: ${({ theme }) => theme.palette.brandSecondary};
|
|
95
|
-
border-color: ${({ theme }) => theme.palette.brandSecondary};
|
|
96
|
-
color: ${({ theme }) => theme.palette.brandSecondaryText};
|
|
97
|
-
|
|
98
|
-
&:hover {
|
|
99
|
-
background: ${({ theme }) => theme.palette.brandSecondaryHover};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
&:active {
|
|
103
|
-
background: ${({ theme }) => theme.palette.brandSecondaryActive};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
&:focus {
|
|
107
|
-
border-color: ${({ theme }) => theme.palette.brandSecondaryFocused};
|
|
108
|
-
}
|
|
109
|
-
`,
|
|
110
|
-
[exports.ButtonKind.textOnly]: styled_components_1.css `
|
|
111
|
-
background: transparent;
|
|
112
|
-
border-color: transparent;
|
|
113
|
-
color: ${({ theme }) => theme.palette.textDefault};
|
|
114
|
-
|
|
115
|
-
&:active {
|
|
116
|
-
opacity: 0.8;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
&:focus {
|
|
120
|
-
border-color: ${({ theme }) => theme.palette.inputFocused};
|
|
121
|
-
}
|
|
122
|
-
`,
|
|
123
|
-
},
|
|
124
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./button"), exports);
|
|
14
|
-
__exportStar(require("./button.variants"), exports);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./toggle"), exports);
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Toggle = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
const react_1 = require("react");
|
|
20
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
21
|
-
const RawInput_1 = require("../../input/RawInput");
|
|
22
|
-
const Box_1 = require("../../layout/Box");
|
|
23
|
-
const Toggle = (_a) => {
|
|
24
|
-
var { id, label, onChange, labelSide = 'right', type = 'checkbox' } = _a, inputProps = __rest(_a, ["id", "label", "onChange", "labelSide", "type"]);
|
|
25
|
-
const [isChecked, setIsChecked] = react_1.useState(inputProps.checked);
|
|
26
|
-
react_1.useEffect(() => {
|
|
27
|
-
setIsChecked(inputProps.checked);
|
|
28
|
-
}, [inputProps.checked]);
|
|
29
|
-
return (jsx_runtime_1.jsxs(ToggleContainer, Object.assign({ labelSide: labelSide }, { children: [label ? jsx_runtime_1.jsx(ToggleLabel, Object.assign({ htmlFor: id }, { children: label }), void 0) : undefined,
|
|
30
|
-
jsx_runtime_1.jsxs(InputContainer, Object.assign({ isChecked: isChecked }, { children: [jsx_runtime_1.jsx(ToggleInput, Object.assign({}, inputProps, { id: id, type: type, onChange: (event) => {
|
|
31
|
-
setIsChecked(event.target.checked);
|
|
32
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
33
|
-
} }), void 0),
|
|
34
|
-
jsx_runtime_1.jsx(ToggleKnob, { tabIndex: -1, "aria-hidden": "true", isChecked: isChecked }, void 0)] }), void 0)] }), void 0));
|
|
35
|
-
};
|
|
36
|
-
exports.Toggle = Toggle;
|
|
37
|
-
const ToggleContainer = styled_components_1.default.div `
|
|
38
|
-
display: flex;
|
|
39
|
-
gap: ${({ theme }) => theme.px.xlarge};
|
|
40
|
-
flex-direction: ${({ labelSide }) => (labelSide === 'left' ? 'row' : 'row-reverse')};
|
|
41
|
-
line-height: ${({ theme }) => theme.px.xlarge /* Matches height of Input to vertically center text */};
|
|
42
|
-
`;
|
|
43
|
-
const InputContainer = styled_components_1.default(Box_1.Box) `
|
|
44
|
-
--px-toggle: ${({ theme }) => theme.px.xlarge};
|
|
45
|
-
--px-knob: ${({ theme }) => theme.px.base};
|
|
46
|
-
|
|
47
|
-
position: relative;
|
|
48
|
-
height: var(--px-toggle);
|
|
49
|
-
width: calc(2 * var(--px-toggle));
|
|
50
|
-
border: 1px solid
|
|
51
|
-
${({ isChecked, theme }) => isChecked ? theme.palette.brandPrimary : theme.palette.background6};
|
|
52
|
-
border-radius: calc(0.5 * var(--px-toggle));
|
|
53
|
-
|
|
54
|
-
background: ${({ isChecked, theme }) => isChecked ? theme.palette.brandPrimary : theme.palette.background6};
|
|
55
|
-
transition: background var(--openfin-ui-globalTransition),
|
|
56
|
-
border-color var(---openfin-ui-globalTransition);
|
|
57
|
-
|
|
58
|
-
&:focus-within {
|
|
59
|
-
border-color: ${({ theme }) => theme.palette.inputFocused};
|
|
60
|
-
}
|
|
61
|
-
`;
|
|
62
|
-
const ToggleKnob = styled_components_1.default.button `
|
|
63
|
-
position: absolute;
|
|
64
|
-
width: var(--px-knob);
|
|
65
|
-
height: var(--px-knob);
|
|
66
|
-
top: 50%;
|
|
67
|
-
left: ${({ theme }) => theme.px.xsmall};
|
|
68
|
-
transform: translateY(-50%);
|
|
69
|
-
border-radius: 50%;
|
|
70
|
-
background: ${({ isChecked, theme }) => isChecked ? theme.palette.brandPrimaryText : theme.palette.inputColor};
|
|
71
|
-
border: none;
|
|
72
|
-
outline: none;
|
|
73
|
-
transition: left var(--openfin-ui-globalTransition), background var(--openfin-ui-globalTransition);
|
|
74
|
-
pointer-events: none; /* Allow pass-thru for native input */
|
|
75
|
-
`;
|
|
76
|
-
const ToggleInput = styled_components_1.default(RawInput_1.RawInput) `
|
|
77
|
-
position: absolute;
|
|
78
|
-
top: 0;
|
|
79
|
-
left: 0;
|
|
80
|
-
width: 100%;
|
|
81
|
-
height: 100%;
|
|
82
|
-
opacity: 0;
|
|
83
|
-
border: none;
|
|
84
|
-
outline: none;
|
|
85
|
-
appearance: none;
|
|
86
|
-
display: block;
|
|
87
|
-
|
|
88
|
-
&:checked + ${ToggleKnob} {
|
|
89
|
-
left: calc(100% - ${({ theme }) => theme.px.large});
|
|
90
|
-
}
|
|
91
|
-
&:disabled + ${ToggleKnob} {
|
|
92
|
-
background: ${({ theme }) => theme.palette.inputDisabled};
|
|
93
|
-
}
|
|
94
|
-
&:not(:disabled) {
|
|
95
|
-
cursor: pointer;
|
|
96
|
-
}
|
|
97
|
-
`;
|
|
98
|
-
const ToggleLabel = styled_components_1.default.label ``;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Badge = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
20
|
-
const Box_1 = require("../../layout/Box");
|
|
21
|
-
const Badge = (_a) => {
|
|
22
|
-
var { count = 0, max } = _a, rest = __rest(_a, ["count", "max"]);
|
|
23
|
-
let value = count.toString();
|
|
24
|
-
if (max && count > max) {
|
|
25
|
-
value = `${max}+`;
|
|
26
|
-
}
|
|
27
|
-
return jsx_runtime_1.jsx(BadgeElement, Object.assign({}, rest, { children: value }), void 0);
|
|
28
|
-
};
|
|
29
|
-
exports.Badge = Badge;
|
|
30
|
-
const BadgeElement = styled_components_1.default(Box_1.Box) `
|
|
31
|
-
background: ${({ theme }) => theme.palette.statusCritical};
|
|
32
|
-
border-radius: ${({ theme }) => theme.radius.pill};
|
|
33
|
-
color: ${({ theme }) => theme._color.white};
|
|
34
|
-
font-size: ${({ theme }) => theme.fontSize.small};
|
|
35
|
-
min-width: ${({ theme }) => theme.px.xlarge};
|
|
36
|
-
padding: 2px 6px;
|
|
37
|
-
display: inline-flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
justify-content: center;
|
|
40
|
-
box-shadow: ${({ theme }) => theme.shadow.base};
|
|
41
|
-
`;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./badge"), exports);
|