@circutor/charts-react 0.0.20 → 0.1.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/README.md CHANGED
@@ -1,11 +1,122 @@
1
- # `react`
1
+ ### MYC Charts
2
2
 
3
- > TODO: description
3
+ This repository aims to make the charts used by the Cloud team in their web applications accessible to the rest of the organization. This will facilitate their reuse, standardization, and maintenance across different projects.
4
4
 
5
- ## Usage
5
+ ### How to Use
6
6
 
7
+ **Base Scenario**: We want to use the ITIC curve chart.
8
+
9
+ #### As a Web Component
10
+
11
+ To use the chart as a Web Component, simply import it from the CDN in your HTML code.
12
+
13
+ ```html
14
+ <script
15
+ type="module"
16
+ src="https://unpkg.com/@circutor/charts/dist/charts/charts.esm.js"
17
+ ></script>
18
+ <script
19
+ nomodule
20
+ src="https://unpkg.com/@circutor/charts/dist/charts/charts.js"
21
+ ></script>
22
+ ```
23
+
24
+ Then, you can directly insert the chart into your HTML:
25
+
26
+ ```html
27
+ <itic-chart
28
+ groups='[{"groupName":"L1,L2,L3","points":[{"duration":230,"voltage":93.46,"ts":"2024-06-26T20:23:45.220000+02:00"}],"color":"#00B388"},{"groupName":"L2","points":[{"duration":20,"voltage":0.4000000000000057,"ts":"2025-01-26T23:04:34.840000+01:00"}],"color":"#20262C"}]'
29
+ ></itic-chart>
30
+ ```
31
+
32
+ <details>
33
+ <summary>Complete example</summary>
34
+
35
+ ```html
36
+ <!DOCTYPE html>
37
+ <html lang="es">
38
+ <head>
39
+ <meta charset="UTF-8" />
40
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
41
+ <title>Charts</title>
42
+
43
+ <script
44
+ type="module"
45
+ src="https://unpkg.com/@circutor/charts/dist/charts/charts.esm.js"
46
+ ></script>
47
+ <script
48
+ nomodule
49
+ src="https://unpkg.com/@circutor/charts/dist/charts/charts.js"
50
+ ></script>
51
+
52
+ <style>
53
+ body {
54
+ font-family: Arial, sans-serif;
55
+ text-align: center;
56
+ padding: 20px;
57
+ }
58
+ mi-componente {
59
+ display: block;
60
+ margin-top: 20px;
61
+ }
62
+ </style>
63
+ </head>
64
+ <body>
65
+ <itic-chart
66
+ groups='[{"groupName":"L1,L2,L3","points":[{"duration":230,"voltage":93.46,"ts":"2024-06-26T20:23:45.220000+02:00"}],"color":"#00B388"},{"groupName":"L2","points":[{"duration":20,"voltage":0.4000000000000057,"ts":"2025-01-26T23:04:34.840000+01:00"}],"color":"#20262C"}]'
67
+ ></itic-chart>
68
+ </body>
69
+ </html>
7
70
  ```
8
- const reactLibrary = require('react');
9
71
 
10
- // TODO: DEMONSTRATE API
72
+ </details>
73
+
74
+ #### From a React Application
75
+
76
+ 1. **Install the package**
77
+ First, you need to install the `@circutor/charts-react` package in your project:
78
+
11
79
  ```
80
+ npm install @circutor/charts-react
81
+ ```
82
+
83
+ 2. **Import the component**
84
+ Then, import the component into your React file:
85
+
86
+ ```javascript
87
+ import { IticChart } from '@circutor/charts-react';`>
88
+ ```
89
+
90
+ 3. **Use the component**
91
+ Now, you can use the chart in your application like any other React component. Just pass the necessary data and configurations:
92
+
93
+ ```html
94
+ <IticChart
95
+ groups={[
96
+ {
97
+ groupName: "L1,L2,L3",
98
+ points: [
99
+ {
100
+ duration: 230,
101
+ voltage: 93.46,
102
+ ts: "2024-06-26T20:23:45.220000+02:00",
103
+ },
104
+ ],
105
+ color: "#00B388",
106
+ },
107
+ {
108
+ groupName: "L2",
109
+ points: [
110
+ {
111
+ duration: 20,
112
+ voltage: 0.4000000000000057,
113
+ ts: "2025-01-26T23:04:34.840000+01:00",
114
+ },
115
+ ],
116
+ color: "#20262C",
117
+ },
118
+ ]}
119
+ ></IticChart>
120
+ ```
121
+
122
+ Remember to consult the documentation for each component for more details and configuration options.
@@ -1,8 +1,7 @@
1
1
  'use client';
2
- import { IticChart as IticChartElement, defineCustomElement as defineIticChart } from "@circutor/charts/dist/components/itic-chart.js";
3
- import { MyComponent as MyComponentElement, defineCustomElement as defineMyComponent } from "@circutor/charts/dist/components/my-component.js";
4
2
  import { createComponent } from '@stencil/react-output-target/runtime';
5
3
  import React from 'react';
4
+ import { IticChart as IticChartElement, defineCustomElement as defineIticChart } from "@circutor/charts/dist/components/itic-chart.js";
6
5
  export const IticChart = createComponent({
7
6
  tagName: 'itic-chart',
8
7
  elementClass: IticChartElement,
@@ -10,11 +9,4 @@ export const IticChart = createComponent({
10
9
  events: {},
11
10
  defineCustomElement: defineIticChart
12
11
  });
13
- export const MyComponent = createComponent({
14
- tagName: 'my-component',
15
- elementClass: MyComponentElement,
16
- react: React,
17
- events: {},
18
- defineCustomElement: defineMyComponent
19
- });
20
12
  //# sourceMappingURL=components.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["../../../lib/components/stencil-generated/components.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AASb,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,mBAAmB,IAAI,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACvI,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AAE/I,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,CAAC,MAAM,SAAS,GAA2E,eAAe,CAAoC;IAChJ,OAAO,EAAE,YAAY;IACrB,YAAY,EAAE,gBAAgB;IAE9B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,EAAqB;IAC7B,mBAAmB,EAAE,eAAe;CACvC,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,WAAW,GAA+E,eAAe,CAAwC;IAC1J,OAAO,EAAE,cAAc;IACvB,YAAY,EAAE,kBAAkB;IAEhC,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,EAAuB;IAC/B,mBAAmB,EAAE,iBAAiB;CACzC,CAAC,CAAC"}
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../../../lib/components/stencil-generated/components.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAUb,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,mBAAmB,IAAI,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAIvI,MAAM,CAAC,MAAM,SAAS,GAAiG,eAAe,CAA0D;IAC5L,OAAO,EAAE,YAAY;IACrB,YAAY,EAAE,gBAAgB;IAE9B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,EAAqB;IAC7B,mBAAmB,EAAE,eAAe;CACvC,CAAC,CAAC"}
@@ -1,8 +1,5 @@
1
- import { IticChart as IticChartElement } from "@circutor/charts/dist/components/itic-chart.js";
2
- import { MyComponent as MyComponentElement } from "@circutor/charts/dist/components/my-component.js";
3
1
  import type { StencilReactComponent } from '@stencil/react-output-target/runtime';
4
- type IticChartEvents = NonNullable<unknown>;
5
- export declare const IticChart: StencilReactComponent<IticChartElement, IticChartEvents>;
6
- type MyComponentEvents = NonNullable<unknown>;
7
- export declare const MyComponent: StencilReactComponent<MyComponentElement, MyComponentEvents>;
8
- export {};
2
+ import type { Components } from "@circutor/charts/dist/components";
3
+ import { IticChart as IticChartElement } from "@circutor/charts/dist/components/itic-chart.js";
4
+ export type IticChartEvents = NonNullable<unknown>;
5
+ export declare const IticChart: StencilReactComponent<IticChartElement, IticChartEvents, Components.IticChart>;
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@circutor/charts-react",
3
- "version": "0.0.20",
4
- "description": "",
3
+ "version": "0.1.0",
4
+ "description": "React wrappers for the @circutor/charts Web Components",
5
5
  "author": "apinto <apinto@circutor.com>",
6
- "homepage": "",
7
6
  "license": "ISC",
8
7
  "main": "dist/index.js",
9
8
  "module": "dist/index.js",
@@ -12,8 +11,11 @@
12
11
  "dist"
13
12
  ],
14
13
  "scripts": {
15
- "build": "npm run tsc",
16
- "tsc": "tsc -p . --outDir ./dist"
14
+ "build": "tsc -p . --outDir ./dist"
15
+ },
16
+ "peerDependencies": {
17
+ "react": "^18 || ^19",
18
+ "react-dom": "^18 || ^19"
17
19
  },
18
20
  "devDependencies": {
19
21
  "@types/react": "^19.0.8",
@@ -22,8 +24,8 @@
22
24
  "typescript": "^5.7.3"
23
25
  },
24
26
  "dependencies": {
25
- "@circutor/charts": "^0.0.20",
26
- "@stencil/react-output-target": "^0.8.2"
27
+ "@circutor/charts": "^0.1.0",
28
+ "@stencil/react-output-target": "^1.6.5"
27
29
  },
28
30
  "repository": {
29
31
  "type": "git",
@@ -32,5 +34,5 @@
32
34
  "publishConfig": {
33
35
  "access": "public"
34
36
  },
35
- "gitHead": "7ca8496e18978b80751943374e146a7f10d2aab3"
37
+ "gitHead": "44a514e1c49b34d4ab2a9e52d1354c3753c76e0b"
36
38
  }
@@ -1,13 +0,0 @@
1
- 'use client';
2
- import { IticChart as IticChartElement, defineCustomElement as defineIticChart } from "../../../../stencil/dist/components/itic-chart.js";
3
- import { createComponent } from '@stencil/react-output-target/runtime';
4
- import React from 'react';
5
- const IticChart = createComponent({
6
- tagName: 'itic-chart',
7
- elementClass: IticChartElement,
8
- react: React,
9
- events: {},
10
- defineCustomElement: defineIticChart
11
- });
12
- export default IticChart;
13
- //# sourceMappingURL=IticChart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IticChart.js","sourceRoot":"","sources":["../../../lib/components/stencil-generated/IticChart.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AASb,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,mBAAmB,IAAI,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAE1I,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,SAAS,GAA2E,eAAe,CAAoC;IACzI,OAAO,EAAE,YAAY;IACrB,YAAY,EAAE,gBAAgB;IAE9B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,EAAqB;IAC7B,mBAAmB,EAAE,eAAe;CACvC,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC"}
@@ -1,13 +0,0 @@
1
- 'use client';
2
- import { MyComponent as MyComponentElement, defineCustomElement as defineMyComponent } from "../../../../stencil/dist/components/my-component.js";
3
- import { createComponent } from '@stencil/react-output-target/runtime';
4
- import React from 'react';
5
- const MyComponent = createComponent({
6
- tagName: 'my-component',
7
- elementClass: MyComponentElement,
8
- react: React,
9
- events: {},
10
- defineCustomElement: defineMyComponent
11
- });
12
- export default MyComponent;
13
- //# sourceMappingURL=MyComponent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MyComponent.js","sourceRoot":"","sources":["../../../lib/components/stencil-generated/MyComponent.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AASb,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AAElJ,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,GAA+E,eAAe,CAAwC;IACnJ,OAAO,EAAE,cAAc;IACvB,YAAY,EAAE,kBAAkB;IAEhC,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,EAAuB;IAC/B,mBAAmB,EAAE,iBAAiB;CACzC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -1,5 +0,0 @@
1
- import { IticChart as IticChartElement } from "../../../../stencil/dist/components/itic-chart.js";
2
- import type { StencilReactComponent } from '@stencil/react-output-target/runtime';
3
- type IticChartEvents = NonNullable<unknown>;
4
- declare const IticChart: StencilReactComponent<IticChartElement, IticChartEvents>;
5
- export default IticChart;
@@ -1,5 +0,0 @@
1
- import { MyComponent as MyComponentElement } from "../../../../stencil/dist/components/my-component.js";
2
- import type { StencilReactComponent } from '@stencil/react-output-target/runtime';
3
- type MyComponentEvents = NonNullable<unknown>;
4
- declare const MyComponent: StencilReactComponent<MyComponentElement, MyComponentEvents>;
5
- export default MyComponent;
@@ -1 +0,0 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../lib/components/stencil-generated/components.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAA0C,MAAM,gDAAgD,CAAC;AACvI,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAA4C,MAAM,kDAAkD,CAAC;AAC/I,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAIlF,KAAK,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAE5C,eAAO,MAAM,SAAS,EAAE,qBAAqB,CAAC,gBAAgB,EAAE,eAAe,CAO7E,CAAC;AAEH,KAAK,iBAAiB,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAE9C,eAAO,MAAM,WAAW,EAAE,qBAAqB,CAAC,kBAAkB,EAAE,iBAAiB,CAOnF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC"}