@itwin/one-click-lca-react 0.3.0 → 0.5.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.
Files changed (43) hide show
  1. package/lib/cjs/components/ExportModal.js +93 -54
  2. package/lib/cjs/components/ExportModal.js.map +1 -1
  3. package/lib/cjs/components/ExportModal.scss +14 -16
  4. package/lib/cjs/components/OneClickLCA.js +7 -2
  5. package/lib/cjs/components/OneClickLCA.js.map +1 -1
  6. package/lib/cjs/components/Reports.js +49 -21
  7. package/lib/cjs/components/Reports.js.map +1 -1
  8. package/lib/cjs/components/Reports.scss +3 -5
  9. package/lib/cjs/components/utils.d.ts +1 -1
  10. package/lib/cjs/components/utils.js +12 -6
  11. package/lib/cjs/components/utils.js.map +1 -1
  12. package/lib/cjs/components/utils.scss +4 -12
  13. package/lib/cjs/one-click-lca-widget.js +8 -4
  14. package/lib/cjs/one-click-lca-widget.js.map +1 -1
  15. package/lib/cjs/test/ExportModal.test.js +9 -5
  16. package/lib/cjs/test/ExportModal.test.js.map +1 -1
  17. package/lib/cjs/test/WidgetHeader.test.js +20 -16
  18. package/lib/cjs/test/WidgetHeader.test.js.map +1 -1
  19. package/lib/cjs/widgets/OneClickLCAWidget.d.ts +3 -3
  20. package/lib/cjs/widgets/OneClickLCAWidget.js +4 -8
  21. package/lib/cjs/widgets/OneClickLCAWidget.js.map +1 -1
  22. package/lib/esm/components/ExportModal.js +47 -31
  23. package/lib/esm/components/ExportModal.js.map +1 -1
  24. package/lib/esm/components/ExportModal.scss +14 -16
  25. package/lib/esm/components/OneClickLCA.js +7 -2
  26. package/lib/esm/components/OneClickLCA.js.map +1 -1
  27. package/lib/esm/components/Reports.js +16 -11
  28. package/lib/esm/components/Reports.js.map +1 -1
  29. package/lib/esm/components/Reports.scss +3 -5
  30. package/lib/esm/components/utils.d.ts +1 -1
  31. package/lib/esm/components/utils.js +9 -6
  32. package/lib/esm/components/utils.js.map +1 -1
  33. package/lib/esm/components/utils.scss +4 -12
  34. package/lib/esm/one-click-lca-widget.js +3 -3
  35. package/lib/esm/one-click-lca-widget.js.map +1 -1
  36. package/lib/esm/test/ExportModal.test.js +6 -2
  37. package/lib/esm/test/ExportModal.test.js.map +1 -1
  38. package/lib/esm/test/WidgetHeader.test.js +14 -13
  39. package/lib/esm/test/WidgetHeader.test.js.map +1 -1
  40. package/lib/esm/widgets/OneClickLCAWidget.d.ts +3 -3
  41. package/lib/esm/widgets/OneClickLCAWidget.js +4 -8
  42. package/lib/esm/widgets/OneClickLCAWidget.js.map +1 -1
  43. package/package.json +54 -49
@@ -1 +1 @@
1
- {"version":3,"file":"OneClickLCAWidget.js","sourceRoot":"","sources":["../../../src/widgets/OneClickLCAWidget.tsx"],"names":[],"mappings":";AAQA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,WAAW,MAAM,2BAA2B,CAAC;AAGpD,MAAM,OAAO,mBAAmB;IAAhC;QACkB,OAAE,GAAG,qBAAqB,CAAC;IA2B7C,CAAC;IAzBQ,cAAc,CACnB,QAAgB,EAChB,UAAkB,EAClB,QAA4B,EAC5B,OAA2B;QAE3B,MAAM,OAAO,GAA0B,EAAE,CAAC;QAC1C,IACE,QAAQ,KAAK,kBAAkB,CAAC,IAAI;YACpC,OAAO,KAAK,iBAAiB,CAAC,KAAK;YACnC,UAAU,KAAK,UAAU,CAAC,OAAO,EACjC;YACA,MAAM,iBAAiB,GAAwB;gBAC7C,EAAE,EAAE,mBAAmB;gBACvB,KAAK,EAAE,eAAe;gBACtB,gBAAgB;oBACd,OAAO,KAAC,WAAW,aAAG,CAAC;gBACzB,CAAC;aACF,CAAC;YAEF,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;SACjC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type {\n AbstractWidgetProps,\n UiItemsProvider,\n} from \"@itwin/appui-abstract\";\nimport {\n StagePanelLocation,\n StagePanelSection,\n StageUsage,\n} from \"@itwin/appui-abstract\";\nimport OneClickLCA from \"../components/OneClickLCA\";\nimport React from \"react\";\n\nexport class OneClickLCAProvider implements UiItemsProvider {\n public readonly id = \"OneClickLCAProvider\";\n\n public provideWidgets(\n _stageId: string,\n stageUsage: string,\n location: StagePanelLocation,\n section?: StagePanelSection\n ): ReadonlyArray<AbstractWidgetProps> {\n const widgets: AbstractWidgetProps[] = [];\n if (\n location === StagePanelLocation.Left &&\n section === StagePanelSection.Start &&\n stageUsage === StageUsage.General\n ) {\n const OneClickLCAWidget: AbstractWidgetProps = {\n id: \"OneClickLCAWidget\",\n label: \"One Click LCA\",\n getWidgetContent() {\n return <OneClickLCA />;\n },\n };\n\n widgets.push(OneClickLCAWidget);\n }\n\n return widgets;\n }\n}\n"]}
1
+ {"version":3,"file":"OneClickLCAWidget.js","sourceRoot":"","sources":["../../../src/widgets/OneClickLCAWidget.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,OAAO,mBAAmB;IAAhC;QACkB,OAAE,GAAG,qBAAqB,CAAC;IAgB7C,CAAC;IAdQ,cAAc,CAAC,QAAgB,EAAE,UAAkB,EAAE,QAA4B,EAAE,OAA2B;QACnH,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,IAAI,QAAQ,KAAK,kBAAkB,CAAC,IAAI,IAAI,OAAO,KAAK,iBAAiB,CAAC,KAAK,IAAI,UAAU,KAAK,UAAU,CAAC,OAAO,EAAE;YACpH,MAAM,iBAAiB,GAAW;gBAChC,EAAE,EAAE,mBAAmB;gBACvB,KAAK,EAAE,eAAe;gBACtB,OAAO,EAAE,oBAAC,WAAW,OAAG;aACzB,CAAC;YAEF,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;SACjC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { UiItemsProvider, Widget } from \"@itwin/appui-react\";\nimport { StagePanelLocation, StagePanelSection, StageUsage } from \"@itwin/appui-react\";\nimport OneClickLCA from \"../components/OneClickLCA\";\nimport React from \"react\";\n\nexport class OneClickLCAProvider implements UiItemsProvider {\n public readonly id = \"OneClickLCAProvider\";\n\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection): ReadonlyArray<Widget> {\n const widgets: Widget[] = [];\n if (location === StagePanelLocation.Left && section === StagePanelSection.Start && stageUsage === StageUsage.General) {\n const OneClickLCAWidget: Widget = {\n id: \"OneClickLCAWidget\",\n label: \"One Click LCA\",\n content: <OneClickLCA />,\n };\n\n widgets.push(OneClickLCAWidget);\n }\n\n return widgets;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/one-click-lca-react",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "An iTwin.js 3D Viewer Widget that interfaces with the iTwin Carbon Calculation.",
5
5
  "keywords": [
6
6
  "Bentley",
@@ -21,31 +21,49 @@
21
21
  "main": "lib/cjs/one-click-lca-widget.js",
22
22
  "module": "lib/esm/one-click-lca-widget.js",
23
23
  "typings": "lib/cjs/one-click-lca-widget",
24
+ "scripts": {
25
+ "build": "npm run -s dual-build && npm run -s copy:assets",
26
+ "build:cjs": "tsc 1>&2 --outDir lib/cjs",
27
+ "build:esm": "tsc 1>&2 --module ES2020 --outDir lib/esm",
28
+ "clean": "rimraf lib",
29
+ "copy:assets": "npm run -s copy:public && npm run -s copy:cjs && npm run -s copy:esm",
30
+ "copy:cjs": "cpx \"./src/**/*.scss\" ./lib/cjs",
31
+ "copy:esm": "cpx \"./src/**/*.scss\" ./lib/esm",
32
+ "copy:public": "cpx \"./public/**/*\" ./lib/public",
33
+ "dual-build": "npm run -s build:cjs && npm run -s build:esm",
34
+ "lint": "eslint -f visualstudio \"./src/**/*.{ts,tsx}\" 1>&2",
35
+ "lint:fix": "npm run lint -- --fix",
36
+ "rebuild": "npm run clean && npm run build",
37
+ "test": "jest",
38
+ "cover": "nyc npm test"
39
+ },
24
40
  "dependencies": {
25
- "@itwin/insights-client": "^0.4.0",
26
- "@itwin/itwinui-icons-react": "^1.5.1",
27
- "@itwin/itwinui-react": "^1.29.2"
41
+ "@itwin/insights-client": "^0.10.1",
42
+ "@itwin/itwinui-icons-react": "^2.2.0",
43
+ "@itwin/itwinui-react": "^2.11.2"
28
44
  },
29
45
  "devDependencies": {
30
- "@itwin/appui-abstract": "^3.0.0",
31
- "@itwin/appui-layout-react": "^3.0.0",
32
- "@itwin/appui-react": "^3.0.0",
33
- "@itwin/build-tools": "^3.0.0",
34
- "@itwin/certa": "^3.0.0",
35
- "@itwin/components-react": "^3.0.0",
36
- "@itwin/core-bentley": "^3.0.0",
37
- "@itwin/core-common": "^3.0.0",
38
- "@itwin/core-frontend": "^3.0.0",
39
- "@itwin/core-geometry": "^3.0.0",
40
- "@itwin/core-markup": "^3.0.0",
41
- "@itwin/core-orbitgt": "^3.0.0",
42
- "@itwin/core-quantity": "^3.0.0",
43
- "@itwin/core-react": "^3.0.0",
44
- "@itwin/eslint-plugin": "^3.0.0",
45
- "@itwin/imodel-components-react": "^3.0.0",
46
- "@itwin/presentation-common": "^3.0.0",
47
- "@itwin/presentation-frontend": "^3.0.0",
48
- "@itwin/webgl-compatibility": "^3.0.0",
46
+ "@itwin/appui-abstract": "^4.0.0",
47
+ "@itwin/appui-layout-react": "^4.0.0",
48
+ "@itwin/appui-react": "^4.0.0",
49
+ "@itwin/build-tools": "^4.0.0",
50
+ "@itwin/certa": "^3.6.1",
51
+ "@itwin/components-react": "^4.0.0",
52
+ "@itwin/core-bentley": "^4.0.0",
53
+ "@itwin/core-common": "^4.0.0",
54
+ "@itwin/core-frontend": "^4.0.0",
55
+ "@itwin/core-geometry": "^4.0.0",
56
+ "@itwin/core-markup": "^4.0.0",
57
+ "@itwin/core-orbitgt": "^4.0.0",
58
+ "@itwin/core-quantity": "^4.0.0",
59
+ "@itwin/core-react": "^4.0.0",
60
+ "@itwin/core-telemetry": "^4.0.0",
61
+ "@itwin/ecschema-metadata": "^4.0.0",
62
+ "@itwin/eslint-plugin": "^3.7.7",
63
+ "@itwin/imodel-components-react": "^4.0.0",
64
+ "@itwin/presentation-common": "^4.0.0",
65
+ "@itwin/presentation-frontend": "^4.0.0",
66
+ "@itwin/webgl-compatibility": "^4.0.0",
49
67
  "@testing-library/dom": "^8.12.0",
50
68
  "@testing-library/jest-dom": "^5.16.3",
51
69
  "@testing-library/react": "^12.1.4",
@@ -60,8 +78,9 @@
60
78
  "@typescript-eslint/parser": "^5.17.0",
61
79
  "cpx2": "^3.0.0",
62
80
  "eslint": "^7.32.0",
81
+ "eslint-config-prettier": "^9.1.0",
63
82
  "eslint-plugin-node": "^11.1.0",
64
- "eslint-plugin-react": "^7.25.1",
83
+ "eslint-plugin-react": "^7.33.2",
65
84
  "eslint-plugin-react-hooks": "^4.2.0",
66
85
  "jest": "^27.5.1",
67
86
  "jest-cli": "^27.5.1",
@@ -72,13 +91,13 @@
72
91
  "redux": "^4.1.0",
73
92
  "rimraf": "^3.0.2",
74
93
  "ts-jest": "^27.1.3",
75
- "typescript": "~4.3.0"
94
+ "typescript": "~4.6.0"
76
95
  },
77
96
  "peerDependencies": {
78
- "@itwin/appui-abstract": "^3.0.0",
79
- "@itwin/appui-react": "^3.0.0",
80
- "@itwin/core-frontend": "^3.0.0",
81
- "@itwin/core-react": "^3.0.0",
97
+ "@itwin/appui-abstract": "^4.0.0",
98
+ "@itwin/appui-react": "^4.0.0",
99
+ "@itwin/core-frontend": "^4.0.0",
100
+ "@itwin/core-react": "^4.0.0",
82
101
  "react": "^17.0.2",
83
102
  "react-dom": "^17.0.2"
84
103
  },
@@ -94,27 +113,13 @@
94
113
  "plugins": [
95
114
  "@itwin"
96
115
  ],
97
- "extends": "plugin:@itwin/ui",
116
+ "extends": [
117
+ "plugin:@itwin/ui",
118
+ "prettier"
119
+ ],
98
120
  "rules": {
99
121
  "no-duplicate-imports": "off",
100
122
  "@typescript-eslint/consistent-type-imports": "error"
101
123
  }
102
- },
103
- "scripts": {
104
- "build": "npm run -s dual-build && npm run -s copy:assets",
105
- "build:cjs": "tsc 1>&2 --outDir lib/cjs",
106
- "build:esm": "tsc 1>&2 --module ES2020 --outDir lib/esm",
107
- "clean": "rimraf lib",
108
- "copy:assets": "npm run -s copy:public && npm run -s copy:cjs && npm run -s copy:esm",
109
- "copy:cjs": "cpx \"./src/**/*.scss\" ./lib/cjs",
110
- "copy:esm": "cpx \"./src/**/*.scss\" ./lib/esm",
111
- "copy:public": "cpx \"./public/**/*\" ./lib/public",
112
- "dual-build": "npm run -s build:cjs && npm run -s build:esm",
113
- "lint": "eslint -f visualstudio \"./src/**/*.{ts,tsx}\" 1>&2",
114
- "lint:fix": "npm run lint -- --fix",
115
- "rebuild": "npm run clean && npm run build",
116
- "test": "jest",
117
- "cover": "nyc npm test"
118
- },
119
- "readme": "# @itwin/one-click-lca-react\n\nCopyright © Bentley Systems, Incorporated. All rights reserved.\n\nThe One Click LCA widget is a UI component for iTwin Viewer applications that simplifies how users (and developers) interface with the [Carbon Calculation One Click LCA APIs](https://developer.bentley.com/apis/carbon-calculation/overview/).\nThe one-click-lca-react package provides a UiProvider class, `OneClickLCAProvider`, which can be passed into the `uiProviders` prop of the iTwin Viewer's `<Viewer />` component.\n\n## Getting Started\n\nThis is not a standalone UI and requires a parent iTwin Viewer application to work as intended.\nA guide on how to create a basic iTwin Viewer application can be found [here](https://www.itwinjs.org/learning/tutorials/develop-web-viewer).\nThis package provides a viewer _widget_. Documentation on how to add a widget to your application can be found [here](https://developer.bentley.com/tutorials/itwin-viewer-hello-world/#2-your-first-ui-widget).\n\n## Permissions and Scopes\n\nThe SPA client used by your iTwin viewer application must have allowed scopes `insights:read` and `insights:write`, found under the Reporting & Insights category.\nUsers must have the `imodels_read` and `insights_view` [permissions](https://developer.bentley.com/apis/carbon-calculation/operations/create-oneclicklca-job/#authorization) assigned at either the Project or iModel level. Additional instruction on how to create roles and assign permissions can be found in the [iTwin Platform Projects API documentation](https://developer.bentley.com/apis/projects/tutorials/).\n\n## Sample usage\n\n```tsx\nimport { OneClickLCAProvider } from \"@itwin/one-click-lca-react\";\n\n<Viewer\n ...\n uiProviders={[new OneClickLCAProvider()]}\n/>\n```\n"
120
- }
124
+ }
125
+ }