@layerfi/components 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +40 -0
- package/.prettierrc.json +21 -0
- package/README.md +114 -10
- package/dist/esm/index.js +2094 -526
- package/dist/esm/index.js.map +4 -4
- package/dist/index.d.ts +902 -188
- package/dist/index.js +2153 -605
- package/dist/index.js.map +4 -4
- package/dist/styles/index.css +1317 -317
- package/dist/styles/index.css.map +3 -3
- package/index.d.ts +1309 -0
- package/package.json +13 -18
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es2021: true,
|
|
5
|
+
node: true,
|
|
6
|
+
},
|
|
7
|
+
extends: [
|
|
8
|
+
'eslint:recommended',
|
|
9
|
+
'plugin:react/recommended',
|
|
10
|
+
'plugin:@typescript-eslint/recommended',
|
|
11
|
+
],
|
|
12
|
+
ignorePatterns: ['build/*', 'dist/*', 'bin/*'],
|
|
13
|
+
parser: '@typescript-eslint/parser',
|
|
14
|
+
parserOptions: {
|
|
15
|
+
ecmaFeatures: {
|
|
16
|
+
jsx: true,
|
|
17
|
+
},
|
|
18
|
+
ecmaVersion: 'latest',
|
|
19
|
+
sourceType: 'module',
|
|
20
|
+
},
|
|
21
|
+
plugins: ['react', '@typescript-eslint', 'prettier'],
|
|
22
|
+
rules: {
|
|
23
|
+
'prettier/prettier': 'error',
|
|
24
|
+
indent: ['off', 2, { SwitchCase: 1 }],
|
|
25
|
+
'linebreak-style': ['error', 'unix'],
|
|
26
|
+
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
27
|
+
quotes: ['error', 'single'],
|
|
28
|
+
'react/react-in-jsx-scope': 'off',
|
|
29
|
+
semi: ['error', 'never'],
|
|
30
|
+
'object-curly-spacing': ['error', 'always', { objectsInObjects: true }],
|
|
31
|
+
'@typescript-eslint/no-unused-vars': [
|
|
32
|
+
'warn',
|
|
33
|
+
{
|
|
34
|
+
argsIgnorePattern: '^_',
|
|
35
|
+
varsIgnorePattern: '^_',
|
|
36
|
+
caughtErrorsIgnorePattern: '^_',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
}
|
package/.prettierrc.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"semi": false,
|
|
3
|
+
"printWidth": 80,
|
|
4
|
+
"tabWidth": 2,
|
|
5
|
+
"singleQuote": true,
|
|
6
|
+
"bracketSpacing": true,
|
|
7
|
+
"bracketSameLine": false,
|
|
8
|
+
"useTabs": false,
|
|
9
|
+
"arrowParens": "avoid",
|
|
10
|
+
"jsxSingleQuote": true,
|
|
11
|
+
"trailingComma": "all",
|
|
12
|
+
"importOrder": [
|
|
13
|
+
"^react.*",
|
|
14
|
+
"<THIRD_PARTY_MODULES>",
|
|
15
|
+
"^src",
|
|
16
|
+
"^\\.\\./', ^\\./"
|
|
17
|
+
],
|
|
18
|
+
"plugins": [
|
|
19
|
+
"@trivago/prettier-plugin-sort-imports"
|
|
20
|
+
]
|
|
21
|
+
}
|
package/README.md
CHANGED
|
@@ -3,27 +3,34 @@
|
|
|
3
3
|
This is a Javascript library that provides easy access to Layer Financial's
|
|
4
4
|
acounting offering through React components.
|
|
5
5
|
|
|
6
|
+
<br />
|
|
7
|
+
|
|
6
8
|
## Installation
|
|
7
9
|
|
|
8
10
|
```
|
|
9
11
|
npm install --save @layerfi/components
|
|
10
12
|
```
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
or
|
|
15
|
+
|
|
12
16
|
```
|
|
13
17
|
yarn install @layerfi/components
|
|
14
18
|
```
|
|
15
19
|
|
|
20
|
+
<br />
|
|
21
|
+
|
|
16
22
|
## Usage
|
|
17
23
|
|
|
18
24
|
Nest the components you want to use under the `LayerProvider` component. You
|
|
19
25
|
need to provide the component with a few props, though:
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
- `appId` Your appId
|
|
28
|
+
- `appSecret` A secret for signing in to Layer
|
|
29
|
+
- `businessId` The ID of the business whose infomation you're showing.
|
|
30
|
+
- `clientId` The ID of the application you're writing
|
|
31
|
+
- `envronment` (Optional, defaults to "production") the Layer environment you're
|
|
26
32
|
attempting to access ["staging" or "production"]
|
|
33
|
+
- `theme` (Optional) to customize the look of components
|
|
27
34
|
|
|
28
35
|
```
|
|
29
36
|
import { LayerProvider } from "@layerfi/components";
|
|
@@ -38,15 +45,22 @@ import { LayerProvider } from "@layerfi/components";
|
|
|
38
45
|
</LayerProvider>
|
|
39
46
|
```
|
|
40
47
|
|
|
41
|
-
|
|
48
|
+
<br />
|
|
49
|
+
<br />
|
|
50
|
+
|
|
51
|
+
## Components
|
|
52
|
+
|
|
53
|
+
### Bank Transactions
|
|
42
54
|
|
|
43
55
|
```
|
|
44
56
|
import { BankTransactions } from "@layerfi/components";
|
|
45
57
|
…
|
|
46
|
-
<BankTransactions/>
|
|
58
|
+
<BankTransactions />
|
|
47
59
|
```
|
|
48
60
|
|
|
49
|
-
|
|
61
|
+
<br />
|
|
62
|
+
|
|
63
|
+
### Profit And Loss
|
|
50
64
|
|
|
51
65
|
You can rearrange the order as you like.
|
|
52
66
|
|
|
@@ -61,10 +75,100 @@ import { ProfitAndLoss } from "@layerfi/components";
|
|
|
61
75
|
</ProfitAndLoss>
|
|
62
76
|
```
|
|
63
77
|
|
|
64
|
-
|
|
78
|
+
<br />
|
|
79
|
+
|
|
80
|
+
### Balance Sheet
|
|
65
81
|
|
|
66
82
|
```
|
|
67
83
|
import { BalanceSheet } from "@layerfi/components";
|
|
68
84
|
…
|
|
69
85
|
<BalanceSheet/>
|
|
70
86
|
```
|
|
87
|
+
|
|
88
|
+
<br />
|
|
89
|
+
<br />
|
|
90
|
+
|
|
91
|
+
## Styling
|
|
92
|
+
|
|
93
|
+
Components can be customized:
|
|
94
|
+
|
|
95
|
+
- using `theme` attribute of `LayerProvider`,
|
|
96
|
+
- setting CSS variables,
|
|
97
|
+
- overwriting CSS classes.
|
|
98
|
+
|
|
99
|
+
<br />
|
|
100
|
+
|
|
101
|
+
### Using `theme` attribute
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
<LayerProvider
|
|
105
|
+
businessId="..."
|
|
106
|
+
environment="..."
|
|
107
|
+
appId="..."
|
|
108
|
+
clientId="..."
|
|
109
|
+
appSecret="..."
|
|
110
|
+
theme={{
|
|
111
|
+
colors: {
|
|
112
|
+
// Base colors:
|
|
113
|
+
dark: { h: '28', s: '26%', l: '11%' },
|
|
114
|
+
light: { h: '52', s: '100%', l: '55%' },
|
|
115
|
+
},
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
{...}
|
|
119
|
+
</LayerProvider>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The `colors` can be defined in `HSL`, `RGB` or `HEX`:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
// HSL:
|
|
126
|
+
colors: {
|
|
127
|
+
dark: { h: '28', s: '26%', l: '11%' },
|
|
128
|
+
light: { h: '52', s: '100%', l: '55%' },
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
// RGB:
|
|
132
|
+
colors: {
|
|
133
|
+
dark: { r: '36', g: '28', b: '21' },
|
|
134
|
+
light: { r: '255', g: '224', b: '27' },
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
// HEX:
|
|
138
|
+
colors: {
|
|
139
|
+
dark: { hex: '#241C15' },
|
|
140
|
+
light: { hex: '#FFE01B' },
|
|
141
|
+
},
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
<br />
|
|
145
|
+
|
|
146
|
+
### CSS variables
|
|
147
|
+
|
|
148
|
+
```css
|
|
149
|
+
body .Layer__component {
|
|
150
|
+
--color-dark-h: 167;
|
|
151
|
+
--color-dark-s: 38%;
|
|
152
|
+
--color-dark-l: 15%;
|
|
153
|
+
|
|
154
|
+
--text-color-primary: #333;
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
See [`variables.scss`](https://github.com/Layer-Fi/layer-react/blob/main/src/styles/variables.scss) to find more CSS variables available to customize.
|
|
159
|
+
|
|
160
|
+
<br />
|
|
161
|
+
|
|
162
|
+
### CSS classes
|
|
163
|
+
|
|
164
|
+
For example:
|
|
165
|
+
|
|
166
|
+
```css
|
|
167
|
+
body .Layer__table-cell-content {
|
|
168
|
+
background: white;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
body .Layer__bank-transaction-row .Layer__table-cell-content {
|
|
172
|
+
background: gray;
|
|
173
|
+
}
|
|
174
|
+
```
|