caplink-saas-ui-shared-component-library 0.5.5 → 0.5.6
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 +78 -78
- package/dist/components/dag/ui/adjacent-nodes/adjacent-nodes.d.ts +3 -2
- package/dist/index.es.js +12 -11
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +91 -91
package/README.md
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
# caplink-saas-ui-shared-component-library
|
|
2
|
-
|
|
3
|
-
This project is a shared component library for the Caplink SaaS UI. It is built using React and Storybook.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
1. Clone the repository
|
|
8
|
-
2. Run `npm install` to install the dependencies
|
|
9
|
-
3. Run `npm run storybook` to start the Storybook server
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
To use the components in your project, you can install the package from npm:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install @caplink/saas-ui-shared-component-library
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Then import the components you need:
|
|
20
|
-
|
|
21
|
-
```javascript
|
|
22
|
-
import { Button } from '@caplink/saas-ui-shared-component-library';
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Development
|
|
26
|
-
|
|
27
|
-
### Components
|
|
28
|
-
|
|
29
|
-
All the components are located in the 'component-library' folder. Each component should be in its own folder, with the component file and any other files it needs (like styles, tests, etc).
|
|
30
|
-
|
|
31
|
-
An expected component development workflow would be:
|
|
32
|
-
|
|
33
|
-
1. Create a new folder for the component
|
|
34
|
-
2. Create the component file (e.g. MyComponent.js)
|
|
35
|
-
3. Create a story file (e.g. MyComponent.stories.js)
|
|
36
|
-
4. Create a test file (e.g. MyComponent.spec.js)
|
|
37
|
-
5. Create a style file (e.g. MyComponent.css) (if needed, we use tailwindcss for styles)
|
|
38
|
-
6. If it's a complex component, create a Cypress test file (e.g. MyComponent.spec.js in the 'cypress' folder)
|
|
39
|
-
|
|
40
|
-
### Folder structure
|
|
41
|
-
|
|
42
|
-
- All the components are located in the '/component-library' folder.
|
|
43
|
-
- Each component should be in its own folder, with the component file and any other files it needs (like styles, tests, etc).
|
|
44
|
-
- Cypress tests are located in the 'cypress' folder and should follow the same folder structure as the components.
|
|
45
|
-
|
|
46
|
-
### Storybook
|
|
47
|
-
|
|
48
|
-
We use Storybook to develop and test the components. To start the Storybook server, run:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
npm run sb:dev
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npm run sb:build
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
This will start the Storybook server and open a browser window with the Storybook UI. You can use this to develop and test the components.
|
|
59
|
-
|
|
60
|
-
This is the gallery of components that we use to develop and test the components. It's also used to generate the documentation for the components, so it's important to keep it up to date and encompassing relevant states and use cases within the stories.
|
|
61
|
-
|
|
62
|
-
## Testing
|
|
63
|
-
|
|
64
|
-
We use multiple testing libraries to test our components. We use Jest for unit tests and Cypress for more complex integration tests that require a browser.
|
|
65
|
-
|
|
66
|
-
- All unit tests are located in the same folder as the component they are testing. The file name should be the same as the component file name, but with a '.spec.xxx' suffix.
|
|
67
|
-
- All Cypress tests are located in the 'cypress' folder.
|
|
68
|
-
|
|
69
|
-
## Contributing
|
|
70
|
-
|
|
71
|
-
This is a project for the Caplink SaaS UI team. If you are a member of the team, you can contribute to this project by following the standard Git workflow:
|
|
72
|
-
|
|
73
|
-
1. Create a new branch for your feature or bug fix
|
|
74
|
-
2. Make your changes
|
|
75
|
-
3. Push your branch to the remote repository
|
|
76
|
-
4. Create a pull request
|
|
77
|
-
|
|
78
|
-
Developing components with tests is a requirement for contributing to this project.
|
|
1
|
+
# caplink-saas-ui-shared-component-library
|
|
2
|
+
|
|
3
|
+
This project is a shared component library for the Caplink SaaS UI. It is built using React and Storybook.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
1. Clone the repository
|
|
8
|
+
2. Run `npm install` to install the dependencies
|
|
9
|
+
3. Run `npm run storybook` to start the Storybook server
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
To use the components in your project, you can install the package from npm:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @caplink/saas-ui-shared-component-library
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Then import the components you need:
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
import { Button } from '@caplink/saas-ui-shared-component-library';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Development
|
|
26
|
+
|
|
27
|
+
### Components
|
|
28
|
+
|
|
29
|
+
All the components are located in the 'component-library' folder. Each component should be in its own folder, with the component file and any other files it needs (like styles, tests, etc).
|
|
30
|
+
|
|
31
|
+
An expected component development workflow would be:
|
|
32
|
+
|
|
33
|
+
1. Create a new folder for the component
|
|
34
|
+
2. Create the component file (e.g. MyComponent.js)
|
|
35
|
+
3. Create a story file (e.g. MyComponent.stories.js)
|
|
36
|
+
4. Create a test file (e.g. MyComponent.spec.js)
|
|
37
|
+
5. Create a style file (e.g. MyComponent.css) (if needed, we use tailwindcss for styles)
|
|
38
|
+
6. If it's a complex component, create a Cypress test file (e.g. MyComponent.spec.js in the 'cypress' folder)
|
|
39
|
+
|
|
40
|
+
### Folder structure
|
|
41
|
+
|
|
42
|
+
- All the components are located in the '/component-library' folder.
|
|
43
|
+
- Each component should be in its own folder, with the component file and any other files it needs (like styles, tests, etc).
|
|
44
|
+
- Cypress tests are located in the 'cypress' folder and should follow the same folder structure as the components.
|
|
45
|
+
|
|
46
|
+
### Storybook
|
|
47
|
+
|
|
48
|
+
We use Storybook to develop and test the components. To start the Storybook server, run:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm run sb:dev
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm run sb:build
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This will start the Storybook server and open a browser window with the Storybook UI. You can use this to develop and test the components.
|
|
59
|
+
|
|
60
|
+
This is the gallery of components that we use to develop and test the components. It's also used to generate the documentation for the components, so it's important to keep it up to date and encompassing relevant states and use cases within the stories.
|
|
61
|
+
|
|
62
|
+
## Testing
|
|
63
|
+
|
|
64
|
+
We use multiple testing libraries to test our components. We use Jest for unit tests and Cypress for more complex integration tests that require a browser.
|
|
65
|
+
|
|
66
|
+
- All unit tests are located in the same folder as the component they are testing. The file name should be the same as the component file name, but with a '.spec.xxx' suffix.
|
|
67
|
+
- All Cypress tests are located in the 'cypress' folder.
|
|
68
|
+
|
|
69
|
+
## Contributing
|
|
70
|
+
|
|
71
|
+
This is a project for the Caplink SaaS UI team. If you are a member of the team, you can contribute to this project by following the standard Git workflow:
|
|
72
|
+
|
|
73
|
+
1. Create a new branch for your feature or bug fix
|
|
74
|
+
2. Make your changes
|
|
75
|
+
3. Push your branch to the remote repository
|
|
76
|
+
4. Create a pull request
|
|
77
|
+
|
|
78
|
+
Developing components with tests is a requirement for contributing to this project.
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { HandleType, Node } from '@xyflow/react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
2
3
|
|
|
3
|
-
export type AdjacentNodesProps = {
|
|
4
|
+
export type AdjacentNodesProps = PropsWithChildren<{
|
|
4
5
|
title?: string;
|
|
5
6
|
nodeId: string;
|
|
6
7
|
type: HandleType;
|
|
7
8
|
nodeValueKey: string;
|
|
8
9
|
onFindAdjacentNodes?: (nodes: Node[]) => void;
|
|
9
|
-
}
|
|
10
|
+
}>;
|
|
10
11
|
export declare function AdjacentNodes(props: AdjacentNodesProps): import("react/jsx-runtime").JSX.Element | null;
|
package/dist/index.es.js
CHANGED
|
@@ -22935,24 +22935,25 @@ function bV(e) {
|
|
|
22935
22935
|
return /* @__PURE__ */ y.jsx("div", { ...e, className: he("sl-w-full sl-h-full sl-relative sl-flex", e.className), children: /* @__PURE__ */ y.jsx(H2, { children: e.children }) });
|
|
22936
22936
|
}
|
|
22937
22937
|
function xV(e) {
|
|
22938
|
-
const { title: t, type: n, nodeId: r, nodeValueKey: o, onFindAdjacentNodes: i } = e,
|
|
22938
|
+
const { title: t, type: n, nodeId: r, nodeValueKey: o, onFindAdjacentNodes: i, children: s } = e, a = ZE({ type: n, nodeId: r }), { fitView: c } = ar();
|
|
22939
22939
|
return J(() => {
|
|
22940
|
-
i?.(
|
|
22941
|
-
}, [
|
|
22940
|
+
i?.(a);
|
|
22941
|
+
}, [a, i]), a.length ? /* @__PURE__ */ y.jsxs("div", { className: "sl-flex sl-flex-col sl-gap-2", children: [
|
|
22942
22942
|
t && /* @__PURE__ */ y.jsx("p", { className: "sl-text-sm sl-text-primary-600", children: t }),
|
|
22943
|
-
s
|
|
22944
|
-
|
|
22943
|
+
s,
|
|
22944
|
+
a.map((l, u) => {
|
|
22945
|
+
const d = String(l.data[o]);
|
|
22945
22946
|
return /* @__PURE__ */ y.jsxs(
|
|
22946
22947
|
"p",
|
|
22947
22948
|
{
|
|
22948
|
-
className: "sl-flex sl-gap-1 sl-items-center sl-cursor-pointer sl-font-bold sl-text-primary-700 sl-text-md",
|
|
22949
|
-
onClick: () =>
|
|
22949
|
+
className: "sl-flex sl-gap-1 sl-items-center sl-cursor-pointer sl-font-bold sl-text-primary-700 sl-text-md break-all",
|
|
22950
|
+
onClick: () => c({ nodes: [l], duration: 1e3 }),
|
|
22950
22951
|
children: [
|
|
22951
|
-
/* @__PURE__ */ y.jsx("span", { className: "sl-text-sm sl-font-regular sl-text-primary-500", children: (
|
|
22952
|
-
|
|
22952
|
+
/* @__PURE__ */ y.jsx("span", { className: "sl-text-sm sl-font-regular sl-text-primary-500 sl-flex-shrink-0", children: (u + 1).toString().padStart(2, "0") }),
|
|
22953
|
+
d
|
|
22953
22954
|
]
|
|
22954
22955
|
},
|
|
22955
|
-
|
|
22956
|
+
l.id
|
|
22956
22957
|
);
|
|
22957
22958
|
})
|
|
22958
22959
|
] }) : null;
|
|
@@ -23254,7 +23255,7 @@ function $V(e) {
|
|
|
23254
23255
|
return /* @__PURE__ */ y.jsxs(
|
|
23255
23256
|
"p",
|
|
23256
23257
|
{
|
|
23257
|
-
className: "sl-cursor-pointer",
|
|
23258
|
+
className: "sl-cursor-pointer break-all",
|
|
23258
23259
|
onClick: () => a({ nodes: [u], duration: 1e3 }),
|
|
23259
23260
|
children: [
|
|
23260
23261
|
f,
|