@servicetitan/docs-anvil-uikit-contrib 40.3.0 → 41.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.
@@ -0,0 +1,41 @@
1
+ ---
2
+ title: createIntl
3
+ ---
4
+
5
+ `createIntl` creates the imperative internationalization API without requiring React context.
6
+
7
+ Use this API in plain JavaScript, service classes, workers, or other non-React code where the React [`useIntl`](./use-intl.mdx) hook and providers are not available.
8
+
9
+ ## Import
10
+
11
+ ```ts
12
+ import { createIntl } from '@servicetitan/intl/core';
13
+ ```
14
+
15
+ The `/core` entrypoint does not require `react`, `react-dom`, or `react-intl` to be installed.
16
+
17
+ ## Basic Usage
18
+
19
+ ```ts
20
+ import { createIntl } from '@servicetitan/intl/core';
21
+
22
+ const intl = createIntl({
23
+ currency: 'USD',
24
+ locale: 'en-US',
25
+ timeZone: 'America/Los_Angeles',
26
+ });
27
+
28
+ intl.formatNumber(1234.56); // '1,234.56'
29
+ intl.formatCurrency(1234.56); // '$1,234.56'
30
+ intl.formatDate(new Date('2026-01-09T21:00:00.000Z'));
31
+ ```
32
+
33
+ ## Available Functions
34
+
35
+ The returned `intl` object provides the same imperative formatter API used by [`useIntl`](./use-intl.mdx), including standard Format.js formatting functions and ServiceTitan custom formatters.
36
+
37
+ See [`useIntl`](./use-intl.mdx#available-functions) for the full list of available functions and properties.
38
+
39
+ ## React Usage
40
+
41
+ Inside React components, prefer [`useIntl`](./use-intl.mdx) or the formatted components from `@servicetitan/intl`. Use `createIntl` when there is no React context or when you are intentionally formatting outside React.
@@ -19,6 +19,12 @@ This library has `peerDependencies` for:
19
19
  - `"@servicetitan/react-ioc": ">=22.0.0"`
20
20
  - `"react-intl": ">=7.1.11"`
21
21
 
22
+ :::tip
23
+
24
+ For non-React JavaScript usage, import [`createIntl`](./API/create-intl.mdx) from `@servicetitan/intl/core`. Consumers that only need imperative formatting can use this entrypoint without installing `react`, `react-dom`, or `react-intl`.
25
+
26
+ :::
27
+
22
28
  ### Provider
23
29
 
24
30
  Wrap your application with [`<IntlProvider>`](./API/intl-provider.mdx) or [`<MobxIntlProvider>`](./API/mobx-intl-provider.mdx), providing `locale`, `timeZone`, and `currency` through the `config` prop:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/docs-anvil-uikit-contrib",
3
- "version": "40.3.0",
3
+ "version": "41.0.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,5 +37,5 @@
37
37
  "cli": {
38
38
  "webpack": false
39
39
  },
40
- "gitHead": "da17654a172fa74e9168b5b15a81049108158db9"
40
+ "gitHead": "9bf5eb2634c17330d1251d431ed5b60b28b56c21"
41
41
  }