@fvc/provider 3.0.1 → 3.0.2-next-ec65dfb844e6183b3d7f417eee613cfe5ecfd997
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 +107 -0
- package/package.json +15 -3
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# @fvc/provider
|
|
2
|
+
|
|
3
|
+
`@fvc/provider` is the application-level configuration wrapper for FE-VIS. It extends Ant Design's `ConfigProvider` with the Azerbaijani locale, dayjs locale, FE-VIS design tokens, and the global CSS stylesheet — so every application starts from a consistent base without additional configuration. Any prop accepted by antd's `ConfigProvider` passes through unchanged.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @fvc/provider
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Peer Dependencies
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bun add react antd dayjs @fvc/utils
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Import
|
|
18
|
+
|
|
19
|
+
> `@fvc/provider` uses a **default** export, not a named export.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import ConfigProvider from '@fvc/provider';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
Place `ConfigProvider` at the root of your application, above any component that uses antd or `@fvc/*` packages. It must wrap the full tree to apply locale and design tokens globally.
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import ConfigProvider from '@fvc/provider';
|
|
31
|
+
|
|
32
|
+
function App() {
|
|
33
|
+
return (
|
|
34
|
+
<ConfigProvider>
|
|
35
|
+
<Router>
|
|
36
|
+
<AppRoutes />
|
|
37
|
+
</Router>
|
|
38
|
+
</ConfigProvider>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## What It Configures
|
|
44
|
+
|
|
45
|
+
| Setting | Value |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| antd locale | `az_AZ` (Azerbaijani) |
|
|
48
|
+
| dayjs locale | `az` — set globally when the package is first imported |
|
|
49
|
+
| Primary colour | `var(--blue-600)` |
|
|
50
|
+
| Border radius | `0` |
|
|
51
|
+
| DatePicker shadow | `none` |
|
|
52
|
+
| DatePicker active border | `var(--blue-600)` |
|
|
53
|
+
| DatePicker cell hover | `var(--gray-50)` |
|
|
54
|
+
| DatePicker hover border | `var(--gray-200)` |
|
|
55
|
+
| DatePicker range cell bg | `var(--blue-gray-200)` |
|
|
56
|
+
| CSS utilities | `antd-css-utilities` + `@fvc/utils` global stylesheet |
|
|
57
|
+
|
|
58
|
+
The dayjs locale is set at import time via `dayjs.locale('az')` — it applies to the entire application as a side effect, regardless of where `ConfigProvider` is rendered in the tree.
|
|
59
|
+
|
|
60
|
+
## Overriding Tokens
|
|
61
|
+
|
|
62
|
+
Pass `theme` to extend or override the default design tokens. Your values are merged on top of the FE-VIS defaults.
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<ConfigProvider
|
|
66
|
+
theme={{
|
|
67
|
+
token: { borderRadius: 4 },
|
|
68
|
+
components: {
|
|
69
|
+
Button: { borderRadius: 2 },
|
|
70
|
+
},
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
<App />
|
|
74
|
+
</ConfigProvider>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Props
|
|
78
|
+
|
|
79
|
+
All antd [`ConfigProviderProps`](https://ant.design/components/config-provider#api) are accepted and forwarded. The FE-VIS defaults for `locale` and `theme` can be overridden by passing these props explicitly.
|
|
80
|
+
|
|
81
|
+
## Consumer Example
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import ConfigProvider from '@fvc/provider';
|
|
85
|
+
import { RouterProvider } from 'react-router-dom';
|
|
86
|
+
import { router } from './router';
|
|
87
|
+
|
|
88
|
+
export function Root() {
|
|
89
|
+
return (
|
|
90
|
+
<ConfigProvider
|
|
91
|
+
theme={{
|
|
92
|
+
token: { colorPrimary: 'var(--green-600)' },
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
<RouterProvider router={router} />
|
|
96
|
+
</ConfigProvider>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Development
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
bun run lint
|
|
105
|
+
bun run type-check
|
|
106
|
+
bun run build
|
|
107
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fvc/provider",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2-next-ec65dfb844e6183b3d7f417eee613cfe5ecfd997",
|
|
4
4
|
"main": "./dist/lib/index.js",
|
|
5
5
|
"types": "./dist/lib/provider/src/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -18,9 +18,21 @@
|
|
|
18
18
|
"test": "find src -name '*.test.*' -o -name '*.spec.*' | grep -q . && bun test || echo 'No tests found - skipping'"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@fvc/utils": "
|
|
21
|
+
"@fvc/utils": "3.0.2-next-ec65dfb844e6183b3d7f417eee613cfe5ecfd997",
|
|
22
22
|
"dayjs": "^1.11.11",
|
|
23
23
|
"react": "^18.0.0",
|
|
24
24
|
"antd": "^5.0.0"
|
|
25
|
-
}
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"react",
|
|
28
|
+
"react-component",
|
|
29
|
+
"fvc",
|
|
30
|
+
"fe-vis-core",
|
|
31
|
+
"provider",
|
|
32
|
+
"config-provider",
|
|
33
|
+
"locale",
|
|
34
|
+
"theme",
|
|
35
|
+
"design-system",
|
|
36
|
+
"antd"
|
|
37
|
+
]
|
|
26
38
|
}
|