@servicetitan/docs-anvil-uikit-contrib 25.8.1 → 26.0.0

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/docs/culture.mdx CHANGED
@@ -37,47 +37,45 @@ const App: React.FC = () => {
37
37
  // Somewhere later in the component tree you can consume culture settings via CULTURE_TOKEN
38
38
  const DisplayCulture: React.FC = () => {
39
39
  const [culture] = useDependencies(CULTURE_TOKEN);
40
- return <span>culture.Name</span>;
40
+ return <span>{culture.Name}</span>;
41
41
  };
42
42
  ```
43
43
 
44
+ ## Automatic provide
45
+
46
+ Could be used in MFEs to automatically fetch culture settings. Uses CultureStore from `@servicetitan/application-data/culture` package
47
+
48
+ ```tsx
49
+ import React from 'react';
50
+ import { useDependencies } from '@servicetitan/react-ioc';
51
+ import { CULTURE_TOKEN, provideWithCulture } from '@servicetitan/culture';
52
+
53
+ const App: React.FC = provideWithCulture()(() => {
54
+ const [culture] = useDependencies(CULTURE_TOKEN);
55
+
56
+ return <span>{culture.Name}</span>;
57
+ });
58
+ ```
59
+
44
60
  ## Package contents
45
61
 
46
62
  ### CultureProvider
47
63
 
48
- React Component that passes culture setttings to `@servicetitan/react-ioc` container.
64
+ React Component that passes culture settings to `@servicetitan/react-ioc` container.
49
65
 
50
66
  #### Props
51
67
 
52
68
  | Name | Type | Description | Required |
53
69
  | :-----: | :-------: | :---------------------: | :------: |
54
- | `value` | `Culture` | Culture settings object | Yes |
70
+ | `value` | `Culture` | Culture settings object | No |
55
71
 
56
72
  ### Culture
57
73
 
58
- TS inteface of culture setttings.
59
-
60
- ```ts
61
- interface Culture {
62
- Name: string;
63
- DateTimeFormat: {
64
- MomentShortDatePattern: string;
65
- MomentShortYearDatePattern: string;
66
- MomentShortYearDateTimePattern: string;
67
- };
68
- NumberFormat: {
69
- NumberDecimalSeparator: string;
70
- NumberGroupSeparator: string;
71
- };
72
- PhoneFormat: {
73
- PhoneFormatInfo: {
74
- Pattern: RegExp;
75
- };
76
- PhoneMask: string;
77
- SimplePhoneMask: string;
78
- };
79
- }
80
- ```
74
+ TS interface of culture settings. See `@servicetitan/application-data/culture`
75
+
76
+ ### provideWithCulture
77
+
78
+ Helper for automatic culture initialization. It adds CultureStore, initialize it and wraps content by CultureProvider. Has the same interface as `provide` from `@servicetitan/react-ioc`.
81
79
 
82
80
  ### CULTURE_TOKEN
83
81
 
@@ -15,8 +15,8 @@ npm install --save-dev @servicetitan/testing-library
15
15
  This library has `peerDependencies` for:
16
16
 
17
17
  - `@servicetitan/react-ioc`: >=22.0.0
18
- - `@testing-library/react`: ^12.0.0
19
- - `@testing-library/react-hooks`: ^7.0.0
18
+ - `@testing-library/react`: >=12.0.0
19
+ - `@testing-library/react-hooks`: >=7.0.0 (only if using `@testing-library/react` v12)
20
20
  - `react`: >=17.0.0
21
21
 
22
22
  **Note:** This library is not compatible with React Testing Library versions 13+.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/docs-anvil-uikit-contrib",
3
- "version": "25.8.1",
3
+ "version": "26.0.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,5 +16,5 @@
16
16
  "cli": {
17
17
  "webpack": false
18
18
  },
19
- "gitHead": "7ff86e7a40bab18082b6d972addbab9f4b2ff88c"
19
+ "gitHead": "2027b0cb3bb4a06b8e381e3e9af8469a30b20f11"
20
20
  }