@thecb/components 5.0.0-beta.0 → 5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "5.0.0-beta.0",
3
+ "version": "5.0.0-beta.11",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -18,9 +18,14 @@
18
18
  "bugs": {
19
19
  "url": "https://github.com/CityBaseInc/cb-components/issues"
20
20
  },
21
+ "files": [
22
+ "dist",
23
+ "src"
24
+ ],
21
25
  "homepage": "https://github.com/CityBaseInc/cb-components#readme",
22
26
  "devDependencies": {
23
27
  "@babel/core": "^7.0.0-0",
28
+ "@babel/eslint-parser": "^7.15.8",
24
29
  "@babel/preset-env": "^7.6.0",
25
30
  "@babel/preset-react": "^7.0.0",
26
31
  "@babel/register": "^7.6.2",
@@ -34,7 +39,6 @@
34
39
  "@storybook/addon-viewport": "^5.3.14",
35
40
  "@storybook/react": "^5.3.14",
36
41
  "babel-core": "^6.26.3",
37
- "babel-eslint": "^10.1.0",
38
42
  "babel-loader": "^8.1.0",
39
43
  "babel-preset-env": "^1.7.0",
40
44
  "babel-preset-react": "^6.24.1",
@@ -73,6 +77,7 @@
73
77
  }
74
78
  },
75
79
  "dependencies": {
80
+ "@babel/runtime": "^7.15.4",
76
81
  "formatted-input": "^0.1.3",
77
82
  "framer-motion": "^1.11.0",
78
83
  "numeral": "^2.0.6",
@@ -80,6 +85,6 @@
80
85
  "ramda": "^0.27.0",
81
86
  "react-aria-modal": "^4.0.0",
82
87
  "react-pose": "^4.0.10",
83
- "redux-freeform": "^5.1.0-beta.1"
88
+ "redux-freeform": "^5.1.0-beta.5"
84
89
  }
85
90
  }
package/src/.DS_Store ADDED
Binary file
Binary file
Binary file
@@ -1,59 +1,61 @@
1
- //
1
+ //
2
2
 
3
- import safeConcat from '../safeConcat';
3
+ import safeConcat from "../safeConcat";
4
4
 
5
- describe('safeConcat', () => {
5
+ describe("safeConcat", () => {
6
6
  beforeEach(() => {
7
7
  console.error = jest.fn();
8
8
  });
9
9
 
10
- describe('arg validation', () => {
11
- describe('when values not an array', () => {
12
- it('throws console error', () => {
13
- const result = safeConcat('a', '-');
10
+ describe("arg validation", () => {
11
+ describe("when values not an array", () => {
12
+ it("throws console error", () => {
13
+ const result = safeConcat("a", "-");
14
14
 
15
15
  const errors = console.error.mock.calls;
16
16
  expect(errors.length).toEqual(1);
17
17
 
18
18
  const firstError = errors[0][0];
19
- expect(firstError).toEqual('\'values\' needs to be an array. Recieved string');
19
+ expect(firstError).toEqual(
20
+ "'values' needs to be an array. Recieved string"
21
+ );
20
22
 
21
23
  expect(result).toEqual(undefined);
22
24
  });
23
25
  });
24
26
  });
25
27
 
26
- describe('with valid values', () => {
27
- it('concatinates strings with concatinator', () => {
28
- const result = safeConcat(['a', 'b', 'c'], '-');
29
- expect(result).toEqual('a-b-c');
28
+ describe("with valid values", () => {
29
+ it("concatinates strings with concatinator", () => {
30
+ const result = safeConcat(["a", "b", "c"], "-");
31
+ expect(result).toEqual("a-b-c");
30
32
  });
31
33
 
32
- it('stringifies the concatinator', () => {
33
- const result = safeConcat(['a', 'b', 'c'], 1);
34
- expect(result).toEqual('a1b1c');
34
+ it("stringifies the concatinator", () => {
35
+ const result = safeConcat(["a", "b", "c"], 1);
36
+ expect(result).toEqual("a1b1c");
35
37
  });
36
38
 
37
- it('removes falsey string values from values array', () => {
38
- const result = safeConcat(['a', undefined, 'b', ''], '-');
39
- expect(result).toEqual('a-b');
39
+ it("removes falsey string values from values array", () => {
40
+ const result = safeConcat(["a", undefined, "b", ""], "-");
41
+ expect(result).toEqual("a-b");
40
42
  });
41
43
 
42
- it('does not append concatinator single values arrays', () => {
43
- const result = safeConcat(['a'], '-');
44
- expect(result).toEqual('a');
44
+ it("does not append concatinator single values arrays", () => {
45
+ const result = safeConcat(["a"], "-");
46
+ expect(result).toEqual("a");
45
47
  });
46
48
 
47
- it('does not append concatinator to single truthy values', () => {
48
- const result = safeConcat(['a', undefined], '-');
49
- expect(result).toEqual('a');
49
+ it("does not append concatinator to single truthy values", () => {
50
+ const result = safeConcat(["a", undefined], "-");
51
+ expect(result).toEqual("a");
50
52
  });
51
53
  });
52
54
 
53
- describe('with no valid values', () => {
54
- it('returns empty string when no valid values', () => {
55
- const result = safeConcat([undefined], '-');
56
- expect(result).toEqual('');
55
+ describe("with no valid values", () => {
56
+ it("returns empty string when no valid values", () => {
57
+ const result = safeConcat([undefined], "-");
58
+ expect(result).toEqual("");
57
59
  });
58
60
  });
59
61
  });
@@ -1,112 +1,128 @@
1
- //
1
+ //
2
2
 
3
- import validateKeyType from '../validateKeyType';
3
+ import validateKeyType from "../validateKeyType";
4
4
 
5
- describe('validateKeyType', () => {
5
+ describe("validateKeyType", () => {
6
6
  const objParam = {
7
7
  aArray: [1],
8
8
  aBoolean: true,
9
9
  aFunction: jest.fn(),
10
10
  aNumber: 1,
11
- aObject: { foo: 'bar' },
12
- aString: 'bar'
11
+ aObject: { foo: "bar" },
12
+ aString: "bar"
13
13
  };
14
14
 
15
- describe('when obj param does not contain key param', () => {
16
- it('returns false', () => {
17
- const result = validateKeyType(objParam, 'wrong-key', 'string');
15
+ describe("when obj param does not contain key param", () => {
16
+ it("returns false", () => {
17
+ const result = validateKeyType(objParam, "wrong-key", "string");
18
18
  expect(result).toEqual(false);
19
19
  });
20
20
  });
21
21
 
22
- describe('when obj param contains key param', () => {
23
- describe('when obj[key] type', () => {
24
- describe('matches type param', () => {
25
- describe('of Array', () => {
26
- it('returns true', () => {
27
- const arrayResult = validateKeyType(objParam, 'aArray', 'array');
22
+ describe("when obj param contains key param", () => {
23
+ describe("when obj[key] type", () => {
24
+ describe("matches type param", () => {
25
+ describe("of Array", () => {
26
+ it("returns true", () => {
27
+ const arrayResult = validateKeyType(objParam, "aArray", "array");
28
28
  expect(arrayResult).toEqual(true);
29
29
  });
30
30
  });
31
31
 
32
- describe('of Boolean', () => {
33
- it('returns true', () => {
34
- const arrayResult = validateKeyType(objParam, 'aBoolean', 'boolean');
32
+ describe("of Boolean", () => {
33
+ it("returns true", () => {
34
+ const arrayResult = validateKeyType(
35
+ objParam,
36
+ "aBoolean",
37
+ "boolean"
38
+ );
35
39
  expect(arrayResult).toEqual(true);
36
40
  });
37
41
  });
38
42
 
39
- describe('of Function', () => {
40
- it('returns true', () => {
41
- const arrayResult = validateKeyType(objParam, 'aFunction', 'function');
43
+ describe("of Function", () => {
44
+ it("returns true", () => {
45
+ const arrayResult = validateKeyType(
46
+ objParam,
47
+ "aFunction",
48
+ "function"
49
+ );
42
50
  expect(arrayResult).toEqual(true);
43
51
  });
44
52
  });
45
53
 
46
- describe('of Number', () => {
47
- it('returns true', () => {
48
- const arrayResult = validateKeyType(objParam, 'aNumber', 'number');
54
+ describe("of Number", () => {
55
+ it("returns true", () => {
56
+ const arrayResult = validateKeyType(objParam, "aNumber", "number");
49
57
  expect(arrayResult).toEqual(true);
50
58
  });
51
59
  });
52
60
 
53
- describe('of Object', () => {
54
- it('returns true', () => {
55
- const arrayResult = validateKeyType(objParam, 'aObject', 'object');
61
+ describe("of Object", () => {
62
+ it("returns true", () => {
63
+ const arrayResult = validateKeyType(objParam, "aObject", "object");
56
64
  expect(arrayResult).toEqual(true);
57
65
  });
58
66
  });
59
67
 
60
- describe('of String', () => {
61
- it('returns true', () => {
62
- const arrayResult = validateKeyType(objParam, 'aString', 'string');
68
+ describe("of String", () => {
69
+ it("returns true", () => {
70
+ const arrayResult = validateKeyType(objParam, "aString", "string");
63
71
  expect(arrayResult).toEqual(true);
64
72
  });
65
73
  });
66
74
  });
67
75
 
68
- describe('does not match type param', () => {
69
- describe('of Array', () => {
70
- it('returns false', () => {
71
- const arrayResult = validateKeyType(objParam, 'aArray', 'string');
76
+ describe("does not match type param", () => {
77
+ describe("of Array", () => {
78
+ it("returns false", () => {
79
+ const arrayResult = validateKeyType(objParam, "aArray", "string");
72
80
  expect(arrayResult).toEqual(false);
73
81
 
74
- const arrayObjResult = validateKeyType(objParam, 'aArray', 'object');
82
+ const arrayObjResult = validateKeyType(
83
+ objParam,
84
+ "aArray",
85
+ "object"
86
+ );
75
87
  expect(arrayObjResult).toEqual(false);
76
88
  });
77
89
  });
78
90
 
79
- describe('of Boolean', () => {
80
- it('returns false', () => {
81
- const arrayResult = validateKeyType(objParam, 'aBoolean', 'string');
91
+ describe("of Boolean", () => {
92
+ it("returns false", () => {
93
+ const arrayResult = validateKeyType(objParam, "aBoolean", "string");
82
94
  expect(arrayResult).toEqual(false);
83
95
  });
84
96
  });
85
97
 
86
- describe('of Function', () => {
87
- it('returns false', () => {
88
- const arrayResult = validateKeyType(objParam, 'aFunction', 'string');
98
+ describe("of Function", () => {
99
+ it("returns false", () => {
100
+ const arrayResult = validateKeyType(
101
+ objParam,
102
+ "aFunction",
103
+ "string"
104
+ );
89
105
  expect(arrayResult).toEqual(false);
90
106
  });
91
107
  });
92
108
 
93
- describe('of Number', () => {
94
- it('returns false', () => {
95
- const arrayResult = validateKeyType(objParam, 'aNumber', 'string');
109
+ describe("of Number", () => {
110
+ it("returns false", () => {
111
+ const arrayResult = validateKeyType(objParam, "aNumber", "string");
96
112
  expect(arrayResult).toEqual(false);
97
113
  });
98
114
  });
99
115
 
100
- describe('of Object', () => {
101
- it('returns false', () => {
102
- const arrayResult = validateKeyType(objParam, 'aObject', 'string');
116
+ describe("of Object", () => {
117
+ it("returns false", () => {
118
+ const arrayResult = validateKeyType(objParam, "aObject", "string");
103
119
  expect(arrayResult).toEqual(false);
104
120
  });
105
121
  });
106
122
 
107
- describe('of String', () => {
108
- it('returns false', () => {
109
- const arrayResult = validateKeyType(objParam, 'aString', 'number');
123
+ describe("of String", () => {
124
+ it("returns false", () => {
125
+ const arrayResult = validateKeyType(objParam, "aString", "number");
110
126
  expect(arrayResult).toEqual(false);
111
127
  });
112
128
  });
@@ -1,2 +1,2 @@
1
- export { default as safeConcat } from './safeConcat';
2
- export { default as validateKeyType } from './validateKeyType';
1
+ export { default as safeConcat } from "./safeConcat";
2
+ export { default as validateKeyType } from "./validateKeyType";
@@ -1,10 +1,10 @@
1
- //
1
+ //
2
2
 
3
- export default function safeConcat(values , concatinator ) {
3
+ export default function safeConcat(values, concatinator) {
4
4
  if (!Array.isArray(values)) {
5
5
  console.error(`'values' needs to be an array. Recieved ${typeof values}`);
6
6
  return;
7
7
  }
8
8
 
9
- return values.filter((val ) => !!val).join(String(concatinator));
9
+ return values.filter(val => !!val).join(String(concatinator));
10
10
  }
@@ -1,17 +1,15 @@
1
- //
1
+ //
2
2
 
3
- export default function validateKeyType(obj ,
4
- expectedKey ,
5
- expectedType ) {
3
+ export default function validateKeyType(obj, expectedKey, expectedType) {
6
4
  if (!(expectedKey in obj)) {
7
5
  return false;
8
6
  }
9
7
 
10
- if (expectedType === 'object' && Array.isArray(obj[expectedKey])) {
8
+ if (expectedType === "object" && Array.isArray(obj[expectedKey])) {
11
9
  return false;
12
10
  }
13
11
 
14
- if (expectedType === 'array' && Array.isArray(obj[expectedKey])) {
12
+ if (expectedType === "array" && Array.isArray(obj[expectedKey])) {
15
13
  return true;
16
14
  }
17
15
 
package/.eslintrc.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "extends": ["plugin:prettier/recommended", "plugin:react/recommended"],
3
- "plugins": ["babel", "prettier"],
4
- "settings": {
5
- "react": {
6
- "version": "detect"
7
- }
8
- },
9
- "parser": "babel-eslint",
10
- "rules": {
11
- "react/jsx-filename-extension": 0,
12
- "react/prop-types": 0,
13
- "react/display-name": 0,
14
- "prettier/prettier": "error",
15
- "no-unused-vars": 2,
16
- "babel/camelcase": 0,
17
- "camelcase": ["off"]
18
- },
19
- "env": {
20
- "browser": true
21
- },
22
- "parserOptions": {
23
- "ecmaVersion": 11,
24
- "sourceType": "module",
25
- "ecmaFeatures": {
26
- "jsx": true
27
- }
28
- }
29
- }
@@ -1,18 +0,0 @@
1
- ## Description
2
- A brief description of the changes and purpose of the PR.
3
-
4
- ## List of changes to be aware of:
5
- - [x] ....
6
- - [x] ....
7
-
8
- ## Dev Tasks
9
- - [ ] specs
10
- - [ ] storys
11
- - [ ] lint
12
- - [ ] export component in ~/src/index.js
13
-
14
- ## JIRA Task
15
- [ABCD-123](https://citybase.atlassian.net/browse/ABCD-123)
16
-
17
- ## Screenshots
18
- (optional)
package/.github/stale.yml DELETED
@@ -1,17 +0,0 @@
1
- # Number of days of inactivity before an issue becomes stale
2
- daysUntilStale: 30
3
- # Number of days of inactivity before a stale issue is closed
4
- daysUntilClose: 7
5
- # Issues with these labels will never be considered stale
6
- exemptLabels:
7
- - "Don't close"
8
- # Label to use when marking an issue as stale
9
- staleLabel: stale
10
- # Comment to post when marking an issue as stale. Set to `false` to disable
11
- markComment: >
12
- This issue has been automatically marked as stale because it has not had
13
- recent activity. It will be closed within seven days if no further activity
14
- occurs. If it needs to remain open, add the "Don't close" label.
15
- # Comment to post when closing a stale issue. Set to `false` to disable
16
- closeComment: >
17
- This issue has been automatically closed because it was stale.
@@ -1,30 +0,0 @@
1
- name: Bump Package Version
2
- on:
3
- push:
4
- branches:
5
- - "master"
6
-
7
- jobs:
8
- bump-version:
9
- name: Bump version on master
10
- runs-on: ubuntu-latest
11
-
12
- steps:
13
- - name: Checkout source code
14
- uses: actions/checkout@v2
15
- with:
16
- ref: ${{ github.ref }}
17
- - name: "cat package.json"
18
- run: cat ./package.json
19
- - name: Setup Node.js
20
- uses: actions/setup-node@v1
21
- with:
22
- node-version: 12
23
- - name: Automated version bump
24
- uses: phips28/gh-action-bump-version@master
25
- with:
26
- tag-prefix: ''
27
- env:
28
- GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
29
- - name: "cat package.json"
30
- run: cat ./package.json
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # The output is a Markdown table with columns for the PR (with a link),
4
- # a branch, and JIRA ticket with link (if available).
5
- #
6
- # If the branch name starts with an id for a JIRA ticket (e.g.,
7
- # PLAT-123), then a link to the ticket is created. Otherwise this
8
- # column is blank.
9
- #
10
- # A link to the branch isn't valuable because they are usually
11
- # deleted after merging.
12
-
13
- from_tag=${FROM_TAG}
14
- to_tag=${TAG##*/}
15
-
16
- echo "## Changes"
17
- echo ""
18
- echo "### PRs"
19
- # all merge commits, only merge commits
20
- git --no-pager log --merges --format='%s' ${from_tag}..${to_tag} | \
21
- # only pull-request merges
22
- grep "Merge pull request" | \
23
- gawk 'BEGIN { print "| PR | Branch | Ticket |" ;
24
- print "| -- | ------ | ------ |" }
25
- {if (match($0,/(#[0-9]+).*CityBaseInc\/(([A-Z]+-[0-9]+)\S+)/,m))
26
- printf "| %s | %s | [%s](https://citybase.atlassian.net/browse/%s) |\n", m[1], m[2], m[3], m[3] }
27
- {if (match($0,/(#[0-9]+).*CityBaseInc\/([a-z]\S+)/,m))
28
- print "|", m[1], "|", m[2], "|", "|"}'
29
-
30
- echo ""
31
- echo "### Code Diff"
32
- echo "https://github.com/${REPO}/compare/${from_tag}..${to_tag}"
33
- echo ""
34
-
35
- git show ${to_tag} --format=short | grep Tagger
@@ -1,52 +0,0 @@
1
- on:
2
- push:
3
- tags:
4
- - '*'
5
-
6
-
7
- name: Create Release
8
-
9
- jobs:
10
- build:
11
- name: Create Release
12
- runs-on: ubuntu-latest
13
- env:
14
- REPO: ${{ github.repository }}
15
- TAG: ${{ github.ref }}
16
- steps:
17
- - uses: actions/checkout@v2
18
- - name: Get latest release
19
- id: get_latest
20
- run: |
21
- tag_name=$(curl --silent --request GET \
22
- --url https://api.github.com/repos/${{ github.repository }}/releases/latest \
23
- --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
24
- --header "content-type: applicatoin/json" | jq -r .tag_name)
25
- echo "::set-output name=tag_name::$tag_name"
26
- - name: Fetch branches
27
- run: git fetch --all --prune --unshallow
28
- - name: Fetch tags
29
- run: git fetch --unshallow origin +refs/tags/*:refs/tags/*
30
- - name: Checkout master
31
- run: git checkout master
32
- - name: Build body
33
- id: build_body
34
- env:
35
- FROM_TAG: ${{ steps.get_latest.outpus.tag_name}}
36
- run: |
37
- body=$(sh ./.github/workflows/create-release/build-body.sh)
38
- body="${body//'%'/'%25'}"
39
- body="${body//$'\n'/'%0A'}"
40
- body="${body//$'\r'/'%0D'}"
41
- echo "::set-output name=body::$body"
42
- - name: Create Release
43
- id: create_release
44
- uses: actions/create-release@4d1b6075ce7561b672b8552148edec2f27584fe9
45
- env:
46
- GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
47
- with:
48
- tag_name: ${{ github.ref }}
49
- release_name: Release ${{ github.ref }}
50
- body: ${{ steps.build_body.outputs.body }}
51
- draft: false
52
- prerelease: false
@@ -1,73 +0,0 @@
1
- name: Publish and Update
2
-
3
- on:
4
- release:
5
- types: [published]
6
-
7
- jobs:
8
- build:
9
- name: Build
10
- runs-on: ubuntu-latest
11
-
12
- steps:
13
- - name: Checkout repository
14
- uses: actions/checkout@v2
15
- with:
16
- ref: master
17
-
18
- - name: Set up Node.js
19
- uses: actions/setup-node@v1.2.0
20
- with:
21
- node-version: "10.x"
22
-
23
- - name: Install dependencies
24
- run: yarn install --silent
25
-
26
- - name: Compile build
27
- run: yarn build --silent
28
-
29
- - name: Commit changes
30
- uses: EndBug/add-and-commit@v2.1.0
31
- with:
32
- author_name: CB Feeps
33
- author_email: feeps@thecitybase.com
34
- message: "[auto] Update dist"
35
- path: dist
36
- pattern: "*.*"
37
- force: true
38
- ref: deploy
39
- env:
40
- GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
41
-
42
- publish:
43
- name: Publish to NPM Registry
44
- runs-on: ubuntu-latest
45
- needs: build
46
-
47
- steps:
48
- - name: Checkout repository
49
- uses: actions/checkout@v2
50
- with:
51
- ref: deploy
52
-
53
- - name: Set up Node.js for NPM
54
- if: steps.check.outputs.changed == 'true'
55
- uses: actions/setup-node@v1.2.0
56
- with:
57
- node-version: "10.x"
58
- registry-url: "https://registry.npmjs.org"
59
- scope: "@thecb"
60
-
61
- - name: Install dependencies
62
- if: steps.check.outputs.changed == 'true'
63
- run: yarn install
64
-
65
- - name: Create build
66
- if: steps.check.outputs.changed == 'true'
67
- run: yarn build
68
-
69
- - name: Publish package to NPM
70
- if: steps.check.outputs.changed == 'true'
71
- run: yarn publish
72
- env:
73
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/.prettierignore DELETED
@@ -1,3 +0,0 @@
1
- node_modules/
2
- dist/
3
- .storybook/
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- stories: ['../src/**/*.stories.[tj]s'],
3
- addons: ['@storybook/addon-knobs/register', '@storybook/addon-a11y']
4
- };