@servicetitan/anvil2-ext-common 0.0.0-rc-1.48.0-20251104214834 → 0.0.0-toast-open-test-20251112150115
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/CHANGELOG.md +17 -3
- package/README.md +159 -0
- package/dist/ExampleComponent.d.ts +6 -0
- package/dist/ExampleComponent.js +4 -0
- package/dist/ExampleComponent.js.map +1 -0
- package/dist/ExampleProvider.d.ts +6 -0
- package/dist/ExampleProvider.js +4 -0
- package/dist/ExampleProvider.js.map +1 -0
- package/dist/components/ExampleComponent/ExampleComponent.d.ts +1 -0
- package/dist/components/ExampleComponent/index.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +2 -0
- package/dist/providers/ExampleProvider/ExampleProvider.d.ts +1 -0
- package/dist/providers/ExampleProvider/index.d.ts +2 -0
- package/dist/providers/index.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
# @servicetitan/anvil2-ext-common
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-toast-open-test-20251112150115
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Updated dependencies [[`
|
|
8
|
-
- @servicetitan/anvil2@0.0.0-
|
|
7
|
+
- Updated dependencies [[`834507e`](https://github.com/servicetitan/hammer/commit/834507e1ae1b11d46db95131849258f583a59eea), [`7889423`](https://github.com/servicetitan/hammer/commit/788942353ece5412f6c4c7382907489d9861d068), [`7889423`](https://github.com/servicetitan/hammer/commit/788942353ece5412f6c4c7382907489d9861d068), [`ef457b3`](https://github.com/servicetitan/hammer/commit/ef457b36b15049080c4b7a86024a1a955c10fc0f), [`a46d097`](https://github.com/servicetitan/hammer/commit/a46d097bd7b8153aed09bdfd717029e231d4ac0b), [`4a70c88`](https://github.com/servicetitan/hammer/commit/4a70c88392905b3c3de55715eb8d0af05f2f3eef)]:
|
|
8
|
+
- @servicetitan/anvil2@0.0.0-toast-open-test-20251112150115
|
|
9
|
+
|
|
10
|
+
## 0.1.6
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`eec7556`](https://github.com/servicetitan/hammer/commit/eec75569f008fa2df8166b8efd5c5975741ad386)]:
|
|
15
|
+
- @servicetitan/anvil2@1.47.1
|
|
16
|
+
|
|
17
|
+
## 0.1.5
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`32bc784`](https://github.com/servicetitan/hammer/commit/32bc78468278dc7e08a27a5427b6312509d87191), [`9ddafae`](https://github.com/servicetitan/hammer/commit/9ddafaeea62cca4513690f0e8d1bb991a1ea4957), [`db91374`](https://github.com/servicetitan/hammer/commit/db9137443c670eb190eb22fac14188c6e7d7537d), [`db91374`](https://github.com/servicetitan/hammer/commit/db9137443c670eb190eb22fac14188c6e7d7537d), [`54d93cb`](https://github.com/servicetitan/hammer/commit/54d93cb8b0c726fba8815407d800d0c93004aa80), [`6c3e1de`](https://github.com/servicetitan/hammer/commit/6c3e1de13a0d4e881cd497e06c0fe739ebe29fbc), [`db91374`](https://github.com/servicetitan/hammer/commit/db9137443c670eb190eb22fac14188c6e7d7537d), [`db91374`](https://github.com/servicetitan/hammer/commit/db9137443c670eb190eb22fac14188c6e7d7537d)]:
|
|
22
|
+
- @servicetitan/anvil2@1.47.0
|
|
9
23
|
|
|
10
24
|
## 0.1.4
|
|
11
25
|
|
package/README.md
CHANGED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
Anvil2 Extended Common
|
|
3
|
+
</h1>
|
|
4
|
+
|
|
5
|
+
The Anvil2 Extended Common library is an open contribution area for components, hooks, and other code that extends Anvil2. This is maintained by the larger ServiceTitan engineering organization with support from the Design System team.
|
|
6
|
+
|
|
7
|
+
# Getting Started
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
We recommend installing the Common package by running the following `npm` command (or the equivalent `yarn`/`pnpm` command) in your project folder:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
npm install @servicetitan/anvil2-ext-common
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
> [!NOTE]
|
|
18
|
+
> This package requires `@servicetitan/anvil2` as a `peerDependency`, so make sure that is installed as well, and meets the version requirement in this package's `package.json`.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Components and hooks can be imported as named exports from the package root:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { useConfirmDialog } from "@servicetitan/anvil2-ext-common";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
<br />
|
|
29
|
+
|
|
30
|
+
# Contribution Guide
|
|
31
|
+
|
|
32
|
+
This extended common library is meant to be a place for contributions that extend the Anvil2 library, but that don't necessarily make sense to live inside of Anvil2. Do you have a wrapper to connect a component to MobX or formstate or to a specific backend API? Do you have a shorthand to reduce the boilerplate for one of your common use cases? This is the place for those kinds of contributions!
|
|
33
|
+
|
|
34
|
+
This library can also be used as a place to test new ideas and features that are proposed to be added to Anvil2 in the future, but that need more validation or testing. Code in the common library is not required to be 100% stable to allow for these kind of experimental contributions and to serve as a more open area for testing ideas.
|
|
35
|
+
|
|
36
|
+
The Design System team intends to give guidance and help with maintaining contributions here, but contributions to this package aren't intended to meet the same standards as Anvil2 code.
|
|
37
|
+
|
|
38
|
+
## Prerequisites
|
|
39
|
+
|
|
40
|
+
This monorepo requires Node >= 20 and [pnpm](https://pnpm.io/) >= 9.
|
|
41
|
+
<br />
|
|
42
|
+
To install `pnpm`, please follow the installation instructions at: https://pnpm.io/installation
|
|
43
|
+
|
|
44
|
+
## Setting up your local repo
|
|
45
|
+
|
|
46
|
+
Install the dependencies from the top-level project root directory:
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
pnpm install
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
To make sure everything is installed and working properly, we recommend running a build. This command will also build Anvil2 and its dependencies, so it might take a few minutes:
|
|
53
|
+
|
|
54
|
+
```shell
|
|
55
|
+
pnpm build:common
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Development
|
|
59
|
+
|
|
60
|
+
To run our Storybook, you can use the following script from the root of the repo:
|
|
61
|
+
|
|
62
|
+
```shell
|
|
63
|
+
pnpm storybook:common
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Our `ext-common` Storybook will be hosted at http://localhost:8008/.
|
|
67
|
+
|
|
68
|
+
> [!NOTE]
|
|
69
|
+
> For more information about using Storybook, see [their docs](https://storybook.js.org/docs).
|
|
70
|
+
|
|
71
|
+
## Adding a new component or hook
|
|
72
|
+
|
|
73
|
+
### Directory structure
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
- src
|
|
77
|
+
- components
|
|
78
|
+
- MyNewComponent
|
|
79
|
+
- internal
|
|
80
|
+
- SomeInternalCode.ts
|
|
81
|
+
- MyNewComponent.tsx
|
|
82
|
+
- MyNewComponent.stories.tsx
|
|
83
|
+
- MyNewComponent.test.tsx
|
|
84
|
+
- index.ts
|
|
85
|
+
index.ts
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
To add a new component, you would start by added a new folder in the `src/components` directory for your component. Inside that folder, in addition to the files for your component, you'll want to add an `index.ts` file where you export everything you want to be publicly accessible (component, proptypes, context, etc). Code that is not intended to be public can be organized into an `internal` subdirectory.
|
|
89
|
+
|
|
90
|
+
Then in the `src/components/index.ts` file, you'll want to add the export for your new component to make sure it gets exported along with all the other components.
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
export * from "./SomeExistingComponent";
|
|
94
|
+
export * from "./MyNewComponent";
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
To add new stories to the existing Storybook, you'll need to add a file that ends in `*.stories.tsx` or `*.mdx`.
|
|
98
|
+
|
|
99
|
+
To add new unit tests to the existing Vitest run, you'll need to add a file that ends in `*.test.tsx` or `test.ts`.
|
|
100
|
+
|
|
101
|
+
### Adding a new top-level folder in `src`
|
|
102
|
+
|
|
103
|
+
To add a new top-level folder in the `src` directory works very similarly, just another level higher. You would create a new folder under `src`:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
- src
|
|
107
|
+
- components
|
|
108
|
+
- hooks
|
|
109
|
+
- mynewcategory
|
|
110
|
+
index.ts
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
...and then add your new folder's exports to the `src/index.ts` file:
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
export * from "./components";
|
|
117
|
+
export * from "./hooks";
|
|
118
|
+
export * from "./mynewcategory";
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Making a pull request
|
|
122
|
+
|
|
123
|
+
### Changesets
|
|
124
|
+
|
|
125
|
+
We use [Changesets](https://github.com/changesets/changesets/blob/main/README.md) to create release notes and manage our release versioning.
|
|
126
|
+
|
|
127
|
+
When you are ready to create a PR to release a change to this package, run:
|
|
128
|
+
|
|
129
|
+
```shell
|
|
130
|
+
pnpm changeset
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Follow the steps and use appropriate semantic version for your change.
|
|
134
|
+
|
|
135
|
+
#### Changeset message format
|
|
136
|
+
|
|
137
|
+
Please format your changelog with name of the relevant components, hooks, or other code in brackets at the start of the changelog, such as:
|
|
138
|
+
|
|
139
|
+
```md
|
|
140
|
+
---
|
|
141
|
+
"@servicetitan/anvil2": patch
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
[TextField] Update padding for `TextField` `prefix` and `suffix`
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
For more details, see our [internal docs on changeset formatting](https://servicetitan.atlassian.net/wiki/spaces/ADS/pages/3426746698/Changesets+Format).
|
|
148
|
+
|
|
149
|
+
## Other useful scripts
|
|
150
|
+
|
|
151
|
+
From the root of the monorepo, you can run the following to run scripts specifically for the common library:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
pnpm build:common
|
|
155
|
+
pnpm lint:common # run ESLint
|
|
156
|
+
pnpm test:common # run Vitest
|
|
157
|
+
pnpm clean # clear build outputs
|
|
158
|
+
pnpm nuke # clear build outputs and node_modules
|
|
159
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleComponent.js","sources":["../src/components/ExampleComponent/ExampleComponent.tsx"],"sourcesContent":["export const ExampleComponent = {};\n"],"names":[],"mappings":"AAAO,MAAM,mBAAmB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleProvider.js","sources":["../src/providers/ExampleProvider/ExampleProvider.tsx"],"sourcesContent":["export const ExampleProvider = {};\n"],"names":[],"mappings":"AAAO,MAAM,kBAAkB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ExampleComponent: {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ExampleComponent';
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ExampleProvider: {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ExampleProvider';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/anvil2-ext-common",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-toast-open-test-20251112150115",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"tabbable": "^6.2.0",
|
|
29
29
|
"tinycolor2": "^1.6.0",
|
|
30
30
|
"uuid": "^10.0.0",
|
|
31
|
-
"@servicetitan/anvil2": "0.0.0-
|
|
31
|
+
"@servicetitan/anvil2": "0.0.0-toast-open-test-20251112150115"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@types/react": "^18",
|