@mcf/lib-ui 0.0.1

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.
Files changed (62) hide show
  1. package/.browserslistrc +3 -0
  2. package/.gitmodules +3 -0
  3. package/.prettierrc.yaml +10 -0
  4. package/README.md +143 -0
  5. package/dist/@types/Component/BaseButton/BaseButton.d.ts +16 -0
  6. package/dist/@types/Component/BaseButton/index.d.ts +1 -0
  7. package/dist/@types/Component/CheckBox/CheckBox.d.ts +11 -0
  8. package/dist/@types/Component/CheckBox/index.d.ts +1 -0
  9. package/dist/@types/Component/ConfirmationBox/ConfirmationBox.d.ts +18 -0
  10. package/dist/@types/Component/ConfirmationBox/index.d.ts +1 -0
  11. package/dist/@types/Component/Dropdown/Dropdown.d.ts +69 -0
  12. package/dist/@types/Component/Dropdown/index.d.ts +1 -0
  13. package/dist/@types/Component/RadioButtonGroup/RadioButtonGroup.d.ts +29 -0
  14. package/dist/@types/Component/RadioButtonGroup/index.d.ts +1 -0
  15. package/dist/@types/Component/ReactFileReader/ReactFileReader.d.ts +31 -0
  16. package/dist/@types/Component/ReactFileReader/index.d.ts +1 -0
  17. package/dist/@types/Component/StickyHeader/StickyHeader.d.ts +33 -0
  18. package/dist/@types/Component/StickyHeader/index.d.ts +1 -0
  19. package/dist/@types/Component/TextArea/TextArea.d.ts +20 -0
  20. package/dist/@types/Component/TextArea/index.d.ts +1 -0
  21. package/dist/@types/Component/TextInput/TextInput.d.ts +24 -0
  22. package/dist/@types/Component/TextInput/index.d.ts +1 -0
  23. package/dist/@types/Component/Toggle/Toggle.d.ts +6 -0
  24. package/dist/@types/Component/Toggle/index.d.ts +1 -0
  25. package/dist/@types/Component/TypeAhead/TypeAhead.d.ts +44 -0
  26. package/dist/@types/Component/TypeAhead/index.d.ts +1 -0
  27. package/dist/@types/Component/index.d.ts +11 -0
  28. package/dist/@types/Example/ReactFileReader/ReactFileReader.story.d.ts +1 -0
  29. package/dist/@types/Example/ReactFileReader/index.d.ts +14 -0
  30. package/dist/@types/storyguide/Buttons/BaseButton.d.ts +17 -0
  31. package/dist/@types/storyguide/JobCard/Bookmark/BookmarkButton.d.ts +6 -0
  32. package/dist/@types/storyguide/JobCard/CompanyInfo.d.ts +2 -0
  33. package/dist/@types/storyguide/JobCard/JobBenefit.d.ts +2 -0
  34. package/dist/@types/storyguide/JobCard/JobCard.d.ts +2 -0
  35. package/dist/@types/storyguide/JobCard/JobInfo.d.ts +2 -0
  36. package/dist/@types/storyguide/JobCard/JobLastPostedDate.d.ts +2 -0
  37. package/dist/@types/storyguide/JobCard/JobPostStatus.d.ts +2 -0
  38. package/dist/@types/storyguide/JobCard/JobSkillInfo.d.ts +2 -0
  39. package/dist/@types/storyguide/JobCard/JobSponsor.d.ts +2 -0
  40. package/dist/@types/storyguide/JobCard/JobTitle.d.ts +2 -0
  41. package/dist/@types/storyguide/JobCard/SalaryInfo.d.ts +2 -0
  42. package/dist/@types/storyguide/Skills/Score.d.ts +6 -0
  43. package/dist/@types/storyguide/Skills/Scorebar.d.ts +6 -0
  44. package/dist/@types/storyguide/Skills/SkillPill.d.ts +7 -0
  45. package/dist/@types/storyguide/Text/Font.d.ts +12 -0
  46. package/dist/@types/storyguide/Text/TextSize.d.ts +4 -0
  47. package/dist/index.js +2 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/main.css +44 -0
  50. package/jest.config.js +182 -0
  51. package/package.json +114 -0
  52. package/postcss.config.js +11 -0
  53. package/renovate.json +1 -0
  54. package/scripts/deploy/to-mcfui.gds-gov.tech.sh +44 -0
  55. package/scripts/set-npm-version.js +41 -0
  56. package/serve-static.js +9 -0
  57. package/sonar-project.properties +16 -0
  58. package/test/helpers/enzyme.ts +4 -0
  59. package/test/helpers/index.ts +1 -0
  60. package/tsconfig.jest.json +6 -0
  61. package/tsconfig.json +23 -0
  62. package/tslint.json +17 -0
package/jest.config.js ADDED
@@ -0,0 +1,182 @@
1
+ // For a detailed explanation regarding each configuration property, visit:
2
+ // https://jestjs.io/docs/en/configuration.html
3
+
4
+ module.exports = {
5
+ // All imported modules in your tests should be mocked automatically
6
+ // automock: false,
7
+
8
+ // Stop running tests after the first failure
9
+ // bail: false,
10
+
11
+ // Respect "browser" field in package.json when resolving modules
12
+ // browser: false,
13
+
14
+ // The directory where Jest should store its cached dependency information
15
+ // cacheDirectory: "/tmp/jest_rs",
16
+
17
+ // Automatically clear mock calls and instances between every test
18
+ // clearMocks: false,
19
+
20
+ // Indicates whether the coverage information should be collected while executing the test
21
+ // collectCoverage: false,
22
+
23
+ // An array of glob patterns indicating a set of files for which coverage information should be collected
24
+ // collectCoverageFrom: null,
25
+
26
+ // The directory where Jest should output its coverage files
27
+ // coverageDirectory: null,
28
+
29
+ // An array of regexp pattern strings used to skip coverage collection
30
+ // coveragePathIgnorePatterns: [
31
+ // "/node_modules/"
32
+ // ],
33
+
34
+ // A list of reporter names that Jest uses when writing coverage reports
35
+ // coverageReporters: [
36
+ // "json",
37
+ // "text",
38
+ // "lcov",
39
+ // "clover"
40
+ // ],
41
+
42
+ // An object that configures minimum threshold enforcement for coverage results
43
+ // coverageThreshold: null,
44
+
45
+ // Make calling deprecated APIs throw helpful error messages
46
+ // errorOnDeprecated: false,
47
+
48
+ // Force coverage collection from ignored files usin a array of glob patterns
49
+ // forceCoverageMatch: [],
50
+
51
+ // A path to a module which exports an async function that is triggered once before all test suites
52
+ // globalSetup: null,
53
+
54
+ // A path to a module which exports an async function that is triggered once after all test suites
55
+ // globalTeardown: null,
56
+
57
+ // A set of global variables that need to be available in all test environments
58
+ globals: {
59
+ 'ts-jest': {
60
+ tsConfigFile: 'tsconfig.jest.json',
61
+ },
62
+ },
63
+
64
+ // An array of directory names to be searched recursively up from the requiring module's location
65
+ // moduleDirectories: [
66
+ // "node_modules"
67
+ // ],
68
+
69
+ // An array of file extensions your modules use
70
+ moduleFileExtensions: ['ts', 'tsx', 'js'],
71
+
72
+ // A map from regular expressions to module names that allow to stub out resources with a single module
73
+ moduleNameMapper: {
74
+ '~/config': '<rootDir>/src/__mocks__/config.ts',
75
+ '\\.s?css$': 'identity-obj-proxy',
76
+ '~/(.*)': '<rootDir>/src/$1',
77
+ },
78
+
79
+ // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
80
+ // modulePathIgnorePatterns: [],
81
+
82
+ // Activates notifications for test results
83
+ // notify: false,
84
+
85
+ // An enum that specifies notification mode. Requires { notify: true }
86
+ // notifyMode: "always",
87
+
88
+ // A preset that is used as a base for Jest's configuration
89
+ // preset: null,
90
+
91
+ // Run tests from one or more projects
92
+ // projects: null,
93
+
94
+ // Use this configuration option to add custom reporters to Jest
95
+ // reporters: undefined,
96
+
97
+ // Automatically reset mock state between every test
98
+ // resetMocks: false,
99
+
100
+ // Reset the module registry before running each individual test
101
+ // resetModules: false,
102
+
103
+ // A path to a custom resolver
104
+ // resolver: null,
105
+
106
+ // Automatically restore mock state between every test
107
+ // restoreMocks: false,
108
+
109
+ // The root directory that Jest should scan for tests and modules within
110
+ // rootDir: null,
111
+
112
+ // A list of paths to directories that Jest should use to search for files in
113
+ // roots: [
114
+ // "<rootDir>"
115
+ // ],
116
+
117
+ // Allows you to use a custom runner instead of Jest's default test runner
118
+ // runner: "jest-runner",
119
+
120
+ // The paths to modules that run some code to configure or set up the testing environment before each test
121
+ // setupFiles: [],
122
+
123
+ // The path to a module that runs some code to configure or set up the testing framework before each test
124
+ setupTestFrameworkScriptFile: '<rootDir>/test/helpers/index.ts',
125
+
126
+ // A list of paths to snapshot serializer modules Jest should use for snapshot testing
127
+ snapshotSerializers: ['enzyme-to-json/serializer'],
128
+
129
+ // The test environment that will be used for testing
130
+ // testEnvironment: "jest-environment-jsdom",
131
+
132
+ // Options that will be passed to the testEnvironment
133
+ // testEnvironmentOptions: {},
134
+
135
+ // Adds a location field to test results
136
+ // testLocationInResults: false,
137
+
138
+ // The glob patterns Jest uses to detect test files
139
+ testMatch: ['**/__tests__/*.+(ts|tsx|js)'],
140
+
141
+ // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
142
+ // testPathIgnorePatterns: [
143
+ // "/node_modules/"
144
+ // ],
145
+
146
+ // The regexp pattern Jest uses to detect test files
147
+ // testRegex: "",
148
+
149
+ // This option allows the use of a custom results processor
150
+ // testResultsProcessor: null,
151
+
152
+ // This option allows use of a custom test runner
153
+ // testRunner: "jasmine2",
154
+
155
+ // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
156
+ // testURL: "http://localhost",
157
+
158
+ // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
159
+ // timers: "real",
160
+
161
+ // A map from regular expressions to paths to transformers
162
+ transform: {
163
+ '^.+\\.(ts|tsx)$': 'ts-jest',
164
+ },
165
+
166
+ // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
167
+ // transformIgnorePatterns: [
168
+ // "/node_modules/"
169
+ // ],
170
+
171
+ // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
172
+ // unmockedModulePathPatterns: undefined,
173
+
174
+ // Indicates whether each individual test should be reported during the run
175
+ // verbose: null,
176
+
177
+ // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
178
+ // watchPathIgnorePatterns: [],
179
+
180
+ // Whether to use watchman for file crawling
181
+ // watchman: true,
182
+ };
package/package.json ADDED
@@ -0,0 +1,114 @@
1
+ {
2
+ "name": "@mcf/lib-ui",
3
+ "version": "0.0.1",
4
+ "description": "User Interface (UI) components for use in the MCF project.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/@types/Component/index.d.ts",
7
+ "scripts": {
8
+ "build-bundle": "cross-env NODE_ENV=production webpack --mode production",
9
+ "build-css": "cross-env NODE_ENV=production postcss src/style/main.scss --dir dist/ --ext css",
10
+ "build-storybook": "build-storybook -c .storybook -o ./static",
11
+ "build-types": "tsc --module es6 --declaration --emitDeclarationOnly --outDir dist/@types",
12
+ "build-watch": "yarn build-bundle --watch & yarn build-types --watch",
13
+ "build": "yarn clean && yarn build-bundle && yarn build-types && yarn build-css",
14
+ "coverage": "jest --coverage",
15
+ "clean": "rm -rf dist",
16
+ "deploy": "node serve-static.js",
17
+ "eslint": "eslint .",
18
+ "lint-fix": "yarn eslint --fix && yarn tslint --fix",
19
+ "lint": "yarn eslint && yarn tslint",
20
+ "nsp": "mkdir -p ./coverage/nsp && cross-env nsp check --output json > ./coverage/nsp/report.json",
21
+ "start": "yarn storybook",
22
+ "storybook": "start-storybook -p 9001 -c .storybook",
23
+ "test": "jest",
24
+ "test:watch": "jest --watch",
25
+ "tsc-check": "tsc --noEmit --skipLibCheck",
26
+ "tslint": "tslint -c tslint.json -p . -t stylish"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "ssh://git@gitlab.gds-gov.tech:30022/wsg/mcfui.git"
31
+ },
32
+ "author": "MCF",
33
+ "license": "ISC",
34
+ "dependencies": {
35
+ "fuse.js": "3.4.6",
36
+ "lodash": "4.17.21",
37
+ "react-autosuggest": "^9.3.4",
38
+ "react-select-plus": "^1.1.0",
39
+ "scrolling-element": "^1.0.2"
40
+ },
41
+ "devDependencies": {
42
+ "@babel/core": "7.15.8",
43
+ "@babel/plugin-proposal-class-properties": "7.14.5",
44
+ "@babel/plugin-proposal-object-rest-spread": "7.15.6",
45
+ "@babel/preset-env": "7.15.8",
46
+ "@babel/preset-react": "7.14.5",
47
+ "@babel/preset-typescript": "7.15.0",
48
+ "@storybook/react": "5.1.3",
49
+ "@types/enzyme": "3.10.10",
50
+ "@types/enzyme-adapter-react-16": "1.0.6",
51
+ "@types/jest": "23.3.1",
52
+ "@types/lodash": "4.14.177",
53
+ "@types/prop-types": "15.7.4",
54
+ "@types/react": "16.14.21",
55
+ "@types/react-autosuggest": "9.3.14",
56
+ "@types/react-dom": "16.9.14",
57
+ "@types/storybook__react": "4.0.2",
58
+ "babel-eslint": "8.2.5",
59
+ "babel-loader": "8.2.3",
60
+ "babel-plugin-lodash": "3.3.4",
61
+ "cross-env": "5.2.1",
62
+ "css-loader": "0.28.11",
63
+ "cssnano": "4.0.2",
64
+ "enzyme": "3.9.0",
65
+ "enzyme-adapter-react-16": "1.15.6",
66
+ "enzyme-to-json": "3.3.4",
67
+ "eslint": "4.19.1",
68
+ "eslint-config-google": "0.9.1",
69
+ "eslint-config-govtech-mcf": "1.2.0",
70
+ "eslint-config-prettier": "2.9.0",
71
+ "eslint-import-resolver-webpack": "0.10.1",
72
+ "eslint-plugin-babel": "5.1.0",
73
+ "eslint-plugin-import": "2.13.0",
74
+ "eslint-plugin-mocha": "5.0.0",
75
+ "eslint-plugin-no-unsafe-innerhtml": "1.0.16",
76
+ "eslint-plugin-prettier": "2.6.1",
77
+ "eslint-plugin-react": "7.10.0",
78
+ "express": "4.16.3",
79
+ "identity-obj-proxy": "3.0.0",
80
+ "jest": "23.6.0",
81
+ "nsp": "3.2.1",
82
+ "postcss-cli": "5.0.1",
83
+ "postcss-import": "11.1.0",
84
+ "postcss-inline-svg": "3.1.1",
85
+ "postcss-loader": "2.1.5",
86
+ "postcss-preset-env": "5.2.1",
87
+ "prettier": "1.13.7",
88
+ "prop-types": "15.6.2",
89
+ "react": "16.8.6",
90
+ "react-dom": "16.8.6",
91
+ "style-loader": "0.21.0",
92
+ "tachyons": "4.10.0",
93
+ "ts-jest": "23.1.3",
94
+ "tslint": "5.10.0",
95
+ "tslint-config-prettier": "1.13.0",
96
+ "tslint-eslint-rules": "5.3.1",
97
+ "tslint-plugin-prettier": "1.3.0",
98
+ "tslint-react": "3.6.0",
99
+ "typescript": "3.9.10",
100
+ "url-loader": "1.1.2",
101
+ "webpack": "4.15.1",
102
+ "webpack-cli": "2.1.5",
103
+ "webpack-node-externals": "1.7.2"
104
+ },
105
+ "peerDependencies": {
106
+ "react": "16.x"
107
+ },
108
+ "directories": {
109
+ "test": "test"
110
+ },
111
+ "keywords": [
112
+ "lib-ui"
113
+ ]
114
+ }
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ plugins: [
3
+ require('postcss-import'),
4
+ require('postcss-preset-env')({
5
+ stage: 0, // for nesting-rules
6
+ }),
7
+ require('postcss-inline-svg'),
8
+ // skip cssnano for now because the cssPolyfill for IE11 is not working in ui-jobseeker
9
+ // process.env.NODE_ENV === 'production' ? require('cssnano') : null,
10
+ ].filter(Boolean),
11
+ };
package/renovate.json ADDED
@@ -0,0 +1 @@
1
+ {}
@@ -0,0 +1,44 @@
1
+ #!/bin/bash
2
+ IMAGE_REPO_SRC=$1;
3
+
4
+ cat << EOF > temp.yaml
5
+ kind: Deployment
6
+ apiVersion: extensions/v1beta1
7
+ metadata:
8
+ name: mcfui
9
+ namespace: ojmp
10
+ labels:
11
+ app: mcfui
12
+ env: development
13
+ type: storybook
14
+ spec:
15
+ replicas: 1
16
+ strategy:
17
+ type: Recreate
18
+ selector:
19
+ matchLabels:
20
+ app: mcfui
21
+ env: development
22
+ type: storybook
23
+ template:
24
+ metadata:
25
+ name: mcfui
26
+ namespace: ojmp
27
+ labels:
28
+ app: mcfui
29
+ env: development
30
+ type: storybook
31
+ spec:
32
+ containers:
33
+ - name: mcfui
34
+ image: ${IMAGE_REPO_SRC}
35
+ imagePullPolicy: Always
36
+ command: ["npm"]
37
+ args:
38
+ - "run"
39
+ - "deploy"
40
+ ports:
41
+ - containerPort: 9001
42
+ EOF
43
+
44
+ kubectl apply -f temp.yaml
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ const {spawn} = require('child_process');
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ setNpmVersion();
7
+
8
+ /**
9
+ * Grabs the latest version tagged in the Git repository and sets the "version"
10
+ * property in the ../package.json file to it. This requires that the scripts located
11
+ * at ./scripts/verisoning are available. Run `git submodule update --init --remote`
12
+ * to achieve this.
13
+ *
14
+ * @return {void}
15
+ *
16
+ * @author zephinzer
17
+ * @since 2018-01-29
18
+ */
19
+ function setNpmVersion() {
20
+ const packageJsonPath = path.join(__dirname, '../package.json');
21
+ const versionRetrieverPath = path.join(__dirname, './versioning/get-latest');
22
+ const packageJsonData = require(packageJsonPath);
23
+ const gitTagVersionRetriever = spawn(versionRetrieverPath, ['-q']);
24
+ let currentGitTagVersion = null;
25
+
26
+ gitTagVersionRetriever.stdout.on('data', (data) => {
27
+ const gitTagVersion = data.toString().trim();
28
+ currentGitTagVersion = gitTagVersion;
29
+ });
30
+
31
+ gitTagVersionRetriever.on('exit', () => {
32
+ if (currentGitTagVersion !== null) {
33
+ packageJsonData.version = currentGitTagVersion;
34
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonData, null, 2).concat('\n'));
35
+ process.exit(0);
36
+ } else {
37
+ console.warn('FAILED to retrieve the current Git Version... Exiting with status code 1.');
38
+ process.exit(1);
39
+ }
40
+ });
41
+ }
@@ -0,0 +1,9 @@
1
+ const path = require('path');
2
+
3
+ const express = require('express');
4
+
5
+ const server = express();
6
+
7
+ server.use(express.static(path.join(__dirname, './static')));
8
+
9
+ server.listen(9001);
@@ -0,0 +1,16 @@
1
+ sonar.host.url=https://sonarcloud.io/
2
+ sonar.projectKey=${env.CI_PROJECT_NAME}
3
+ sonar.projectName=${env.CI_PROJECT_NAME}
4
+ sonar.projectVersion=1.0
5
+ sonar.organization=mycf-sg
6
+ sonar.sources=.
7
+ sonar.sourceEncoding=UTF-8
8
+ sonar.javascript.lcov.reportPaths=coverage/lcov.info
9
+ sonar.typescript.lcov.reportPaths=coverage/lcov.info
10
+ sonar.inclusions=src/**
11
+ sonar.exclusions=**/*/*.test.ts, **/*/*.test.tsx,
12
+ sonar.login=${env.CI_SONAR_LOGIN_TOKEN}
13
+ sonar.gitlab.project_id=${env.CI_PROJECT_ID}
14
+ sonar.gitlab.ref_name=${env.CI_COMMIT_REF_NAME}
15
+ sonar.gitlab.commit_sha=${env.CI_COMMIT_SHA}
16
+ sonar.branch.name=${env.CI_COMMIT_REF_NAME}
@@ -0,0 +1,4 @@
1
+ import * as Enzyme from 'enzyme';
2
+ import ReactSixteenAdapter from 'enzyme-adapter-react-16';
3
+
4
+ Enzyme.configure({adapter: new ReactSixteenAdapter()});
@@ -0,0 +1 @@
1
+ import './enzyme';
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "commonjs"
5
+ }
6
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowSyntheticDefaultImports": true,
4
+ "baseUrl": "./",
5
+ "esModuleInterop": true,
6
+ "jsx": "react",
7
+ "lib": ["es5", "es2015", "dom"],
8
+ "module": "es6",
9
+ "moduleResolution": "node",
10
+ "noImplicitAny": true,
11
+ "outDir": "./dist/",
12
+ "paths": {
13
+ "~/*": ["src/*"]
14
+ },
15
+ "sourceMap": true,
16
+ "strict": true,
17
+ "target": "es5",
18
+ "pretty": true,
19
+ "typeRoots": ["./node_modules/@types"]
20
+ },
21
+ "include": ["./src/**/*"],
22
+ "exclude": ["**/*.test.tsx", "**/*.test.ts"]
23
+ }
package/tslint.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": [
3
+ "tslint:latest",
4
+ "tslint-react",
5
+ "tslint-eslint-rules",
6
+ "tslint-plugin-prettier",
7
+ "tslint-config-prettier"
8
+ ],
9
+ "rules": {
10
+ "no-submodule-imports": false,
11
+ "jsx-no-lambda": false,
12
+ "jsx-boolean-value": false,
13
+ "prettier": true,
14
+ "no-var-requires": false,
15
+ "no-implicit-dependencies": false
16
+ }
17
+ }