@uxland/primary-shell 3.4.1 → 3.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 (113) hide show
  1. package/dist/index.js +11579 -13387
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.umd.cjs +795 -1064
  4. package/dist/index.umd.cjs.map +1 -1
  5. package/dist/primary/shell/src/UI/components/primaria-error-view/component.d.ts +9 -0
  6. package/dist/primary/shell/src/UI/components/primaria-error-view/template.d.ts +3 -0
  7. package/dist/primary/shell/src/UI/components/primaria-shell/constants.d.ts +4 -0
  8. package/dist/primary/shell/src/UI/components/primaria-shell/primaria-shell.d.ts +10 -0
  9. package/dist/primary/shell/src/UI/{shared-components/primaria-menu/primaria-menu.d.ts → components/quick-actions-menu/quick-actions-menu.d.ts} +1 -1
  10. package/dist/primary/shell/src/UI/components/quick-actions-menu/template.d.ts +3 -0
  11. package/dist/primary/shell/src/UI/shared-components/primaria-nav-item/template.d.ts +3 -0
  12. package/dist/primary/shell/src/UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu.d.ts +13 -0
  13. package/dist/primary/shell/src/UI/shared-components/primaria-nav-tree-menu/template.d.ts +3 -0
  14. package/dist/primary/shell/src/UI/shared-components/typings.d.ts +16 -0
  15. package/dist/primary/shell/src/api/broker/primaria-broker.d.ts +1 -0
  16. package/dist/primary/shell/src/api/region-manager/region-manager.d.ts +3 -2
  17. package/dist/primary/shell/src/bootstrapper.d.ts +2 -0
  18. package/dist/primary/shell/src/constants.d.ts +1 -0
  19. package/dist/primary/shell/src/disposer.d.ts +2 -0
  20. package/dist/primary/shell/src/events.d.ts +2 -0
  21. package/dist/primary/shell/src/features/bootstrapper.d.ts +1 -1
  22. package/dist/primary/shell/src/features/utils.d.ts +3 -2
  23. package/dist/primary/shell/src/{plugin.d.ts → handle-plugins.d.ts} +2 -1
  24. package/dist/primary/shell/src/handle-views.d.ts +2 -0
  25. package/dist/primary/shell/src/index.d.ts +5 -3
  26. package/dist/primary/shell/src/{UI/shared-components/dss-container/dss-container.d.ts → internal-plugins/activity-history/components/activity-history/activity-history-search-header/activity-history-search-header.d.ts} +2 -2
  27. package/dist/primary/shell/src/internal-plugins/activity-history/components/activity-history/activity-history-search-header/template.d.ts +3 -0
  28. package/dist/primary/shell/src/internal-plugins/activity-history/components/activity-history/activity-history-timeline/activity-history-timeline.d.ts +6 -0
  29. package/dist/primary/shell/src/internal-plugins/activity-history/components/activity-history/activity-history.d.ts +4 -3
  30. package/dist/primary/shell/src/internal-plugins/activity-history/constants.d.ts +3 -0
  31. package/dist/primary/shell/src/internal-plugins/activity-history/domain/is-valid-history-item/is-valid-history-item.d.ts +1 -0
  32. package/dist/primary/shell/src/internal-plugins/activity-history/features/search-items/handler.d.ts +3 -1
  33. package/dist/primary/shell/src/internal-plugins/activity-history/localization.d.ts +2 -0
  34. package/dist/primary/shell/src/locales.d.ts +14 -3
  35. package/dist/style.css +1 -1
  36. package/package.json +2 -3
  37. package/src/UI/components/index.ts +1 -0
  38. package/src/UI/components/primaria-error-view/component.ts +18 -0
  39. package/src/UI/components/primaria-error-view/styles.css +27 -0
  40. package/src/UI/components/primaria-error-view/template.ts +12 -0
  41. package/src/UI/components/primaria-shell/constants.ts +4 -0
  42. package/src/UI/components/primaria-shell/primaria-shell.ts +38 -1
  43. package/src/UI/components/primaria-shell/styles.css +24 -54
  44. package/src/UI/components/primaria-shell/template.ts +43 -50
  45. package/src/UI/{shared-components/primaria-menu/primaria-menu.ts → components/quick-actions-menu/quick-actions-menu.ts} +3 -3
  46. package/src/UI/components/quick-actions-menu/template.ts +10 -0
  47. package/src/UI/images/not-found.svg +9 -0
  48. package/src/UI/shared-components/index.ts +1 -3
  49. package/src/UI/shared-components/primaria-nav-item/primaria-nav-item.ts +54 -0
  50. package/src/UI/shared-components/{primaria-menu-item → primaria-nav-item}/styles.css +4 -0
  51. package/src/UI/shared-components/primaria-nav-item/template.ts +27 -0
  52. package/src/UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu.ts +41 -0
  53. package/src/UI/shared-components/primaria-nav-tree-menu/styles.css +11 -0
  54. package/src/UI/shared-components/primaria-nav-tree-menu/template.ts +30 -0
  55. package/src/UI/shared-components/typings.ts +17 -0
  56. package/src/api/api.ts +1 -1
  57. package/src/api/broker/factory.ts +29 -12
  58. package/src/api/broker/primaria-broker.ts +2 -0
  59. package/src/api/ecap-event-manager/ecap-event-manager.ts +1 -1
  60. package/src/api/region-manager/region-manager.ts +12 -2
  61. package/src/api/token-manager/token-manager.test.ts +1 -1
  62. package/src/bootstrapper.ts +16 -0
  63. package/src/constants.ts +1 -0
  64. package/src/disposer.ts +10 -0
  65. package/src/events.ts +2 -0
  66. package/src/features/bootstrapper.ts +4 -1
  67. package/src/features/get-user-info/bootstrapper.ts +6 -3
  68. package/src/features/utils.ts +7 -5
  69. package/src/{plugin.ts → handle-plugins.ts} +8 -3
  70. package/src/handle-views.ts +284 -0
  71. package/src/index.ts +5 -3
  72. package/src/internal-plugins/activity-history/components/activity-history/activity-history-search-header/activity-history-search-header.ts +20 -0
  73. package/src/internal-plugins/activity-history/components/activity-history/activity-history-search-header/styles.css +14 -0
  74. package/src/internal-plugins/activity-history/components/activity-history/activity-history-search-header/template.ts +8 -0
  75. package/src/internal-plugins/activity-history/components/activity-history/activity-history-timeline/activity-history-timeline.ts +27 -1
  76. package/src/internal-plugins/activity-history/components/activity-history/activity-history-timeline/styles.css +21 -2
  77. package/src/internal-plugins/activity-history/components/activity-history/activity-history-timeline/template.ts +38 -19
  78. package/src/internal-plugins/activity-history/components/activity-history/activity-history.ts +17 -26
  79. package/src/internal-plugins/activity-history/components/activity-history/styles.css +2 -24
  80. package/src/internal-plugins/activity-history/components/activity-history/template.ts +37 -69
  81. package/src/internal-plugins/activity-history/constants.ts +3 -0
  82. package/src/internal-plugins/activity-history/domain/filter-by-search-string/filter-by-search-string.ts +6 -1
  83. package/src/internal-plugins/activity-history/domain/is-valid-history-item/is-valid-history-item.ts +19 -5
  84. package/src/internal-plugins/activity-history/features/add-history-item/bootstrapper.ts +5 -2
  85. package/src/internal-plugins/activity-history/features/add-history-items/bootstrapper.ts +5 -2
  86. package/src/internal-plugins/activity-history/features/export-to-pdf/bootstrapper.ts +5 -2
  87. package/src/internal-plugins/activity-history/features/inject-async-history-items/bootstrapper.ts +5 -2
  88. package/src/internal-plugins/activity-history/features/inject-async-history-items/handler.ts +3 -3
  89. package/src/internal-plugins/activity-history/features/search-items/bootstrapper.ts +5 -2
  90. package/src/internal-plugins/activity-history/features/search-items/handler.ts +9 -1
  91. package/src/internal-plugins/activity-history/features/update-history-item/bootstrapper.ts +5 -2
  92. package/src/internal-plugins/activity-history/localization.ts +2 -0
  93. package/src/locales.ts +25 -5
  94. package/dist/primary/shell/src/UI/shared-components/primaria-menu/template.d.ts +0 -3
  95. package/dist/primary/shell/src/UI/shared-components/primaria-menu-item/primaria-menu-item.d.ts +0 -15
  96. package/dist/primary/shell/src/UI/shared-components/primaria-menu-item/template.d.ts +0 -3
  97. package/dist/primary/shell/src/UI/shared-components/primaria-nav-menu/primaria-nav-menu.d.ts +0 -26
  98. package/dist/primary/shell/src/UI/shared-components/primaria-nav-menu/template.d.ts +0 -3
  99. package/dist/primary/shell/src/UI/shared-components/primaria-wrapper-menu/primaria-wrapper-menu.d.ts +0 -19
  100. package/dist/primary/shell/src/UI/shared-components/primaria-wrapper-menu/template.d.ts +0 -3
  101. package/dist/primary/shell/src/initializer.d.ts +0 -1
  102. package/src/UI/shared-components/dss-container/dss-container.ts +0 -32
  103. package/src/UI/shared-components/dss-container/styles.css +0 -23
  104. package/src/UI/shared-components/primaria-menu/template.ts +0 -9
  105. package/src/UI/shared-components/primaria-menu-item/primaria-menu-item.ts +0 -51
  106. package/src/UI/shared-components/primaria-menu-item/template.ts +0 -11
  107. package/src/UI/shared-components/primaria-nav-menu/primaria-nav-menu.ts +0 -66
  108. package/src/UI/shared-components/primaria-nav-menu/styles.css +0 -26
  109. package/src/UI/shared-components/primaria-nav-menu/template.ts +0 -30
  110. package/src/UI/shared-components/primaria-wrapper-menu/primaria-wrapper-menu.ts +0 -41
  111. package/src/UI/shared-components/primaria-wrapper-menu/styles.css +0 -5
  112. package/src/UI/shared-components/primaria-wrapper-menu/template.ts +0 -28
  113. package/src/initializer.ts +0 -327
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxland/primary-shell",
3
- "version": "3.4.1",
3
+ "version": "3.5.0",
4
4
  "description": "Primaria Shell",
5
5
  "author": "UXLand <dev@uxland.es>",
6
6
  "homepage": "https://github.com/uxland/harmonix/tree/app#readme",
@@ -25,7 +25,6 @@
25
25
  "url": "https://github.com/uxland/harmonix/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@material/web": "^2.1.0",
29
28
  "@reduxjs/toolkit": "^2.2.5",
30
29
  "@uxland/harmonix": "^1.0.0",
31
30
  "@uxland/harmonix-adapters": "^1.0.1",
@@ -45,7 +44,7 @@
45
44
  "axios-mock-adapter": "^2.0.0",
46
45
  "inversify": "^6.0.2",
47
46
  "inversify-inject-decorators": "^3.1.0",
48
- "@salut/design-system-salut": "../../design-system-salut-2.0.3.tgz",
47
+ "@salut/design-system-salut": "../../design-system-salut-2.0.5.tgz",
49
48
  "jwt-decode": "^4.0.0",
50
49
  "lit": "^3.1.0",
51
50
  "mediatr-ts": "^1.2.1",
@@ -2,3 +2,4 @@ import "./primaria-shell/primaria-shell";
2
2
  import "./clinical-monitoring/clinical-monitoring";
3
3
  import "../shared-components";
4
4
  import "../components/shell-header/shell-header";
5
+ import "../components/quick-actions-menu/quick-actions-menu";
@@ -0,0 +1,18 @@
1
+ import { LitElement, css, html, unsafeCSS } from "lit";
2
+ import { customElement, property } from "lit/decorators.js";
3
+ import styles from "./styles.css?inline";
4
+ import { template } from "./template";
5
+
6
+ @customElement("primaria-error-view")
7
+ export class PrimariaErrorView extends LitElement {
8
+ render() {
9
+ return html`${template(this)}`;
10
+ }
11
+
12
+ static styles = css`
13
+ ${unsafeCSS(styles)}
14
+ `;
15
+
16
+ @property()
17
+ error: {message: string};
18
+ }
@@ -0,0 +1,27 @@
1
+ :host{
2
+ width: 100%;
3
+ height: 100%;
4
+ min-height: 1px;
5
+ display: flex;
6
+ }
7
+
8
+ .container{
9
+ width: 100%;
10
+ min-height: 1px;
11
+ height: 100%;
12
+ display: flex;
13
+ flex-direction: column;
14
+ align-items: center;
15
+ justify-content: center;
16
+ background: #60A8F0;
17
+ }
18
+
19
+ svg{
20
+ width: 45px;
21
+ height: 45px;
22
+ fill: #D36262;
23
+ }
24
+
25
+ h1{
26
+ color: white;
27
+ }
@@ -0,0 +1,12 @@
1
+ import { html } from "lit";
2
+ import { PrimariaErrorView } from "./component";
3
+
4
+ export const template = (props: PrimariaErrorView) => {
5
+
6
+ return html`
7
+ <div class="container">
8
+ <svg height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>
9
+ <h1>${props.error?.message}</h1>
10
+ </div>
11
+ `;
12
+ };
@@ -0,0 +1,4 @@
1
+ export enum shellViews {
2
+ shell = "primaria-shell",
3
+ error = "primaria-error-view",
4
+ }
@@ -1,10 +1,13 @@
1
1
  import { IRegion, region } from "@uxland/regions";
2
2
  import { LitElement, css, html, unsafeCSS } from "lit";
3
- import { PrimariaRegionHost } from "../../../api/api";
3
+ import { PrimariaRegionHost, shellApi } from "../../../api/api";
4
4
  import { customElement, state } from "lit/decorators.js";
5
5
  import { shellRegions } from "../../../api/region-manager/regions";
6
6
  import styles from "./styles.css?inline";
7
7
  import { template } from "./template";
8
+ import { shellViews } from "./constants";
9
+ import { shellEvents } from "../../../events";
10
+ import { activateDefaultView } from "../../../handle-views";
8
11
 
9
12
  //@ts-ignore
10
13
  @customElement("primaria-shell")
@@ -17,6 +20,23 @@ export class PrimariaShell extends PrimariaRegionHost(LitElement) {
17
20
  ${unsafeCSS(styles)}
18
21
  `;
19
22
 
23
+ connectedCallback() {
24
+ super.connectedCallback();
25
+ this._subscribeEvents();
26
+ }
27
+
28
+ disconnectedCallback() {
29
+ super.disconnectedCallback();
30
+ this._unsubscribeEvents();
31
+ }
32
+
33
+ firstUpdated() {
34
+ super.firstUpdated();
35
+ setTimeout(() => {
36
+ activateDefaultView();
37
+ }, 300);
38
+ }
39
+
20
40
  @region({ targetId: "menu-region-container", name: shellRegions.navigationMenu })
21
41
  navigationMenuRegion: IRegion | undefined;
22
42
 
@@ -38,7 +58,24 @@ export class PrimariaShell extends PrimariaRegionHost(LitElement) {
38
58
  @state()
39
59
  sidebarExpanded = false;
40
60
 
61
+ @state()
62
+ viewSelected = shellViews.shell;
63
+
64
+ @state()
65
+ error: { message: string };
66
+
41
67
  _toggleSidebar() {
42
68
  this.sidebarExpanded = !this.sidebarExpanded;
43
69
  }
70
+
71
+ _subscribeEvents() {
72
+ shellApi.broker.subscribe(shellEvents.appCrashed, (error: { message: string }) => {
73
+ this.viewSelected = shellViews.error;
74
+ this.error = error;
75
+ });
76
+ }
77
+
78
+ _unsubscribeEvents() {
79
+ //TODO unsubscribe when broker accept unsuscribe
80
+ }
44
81
  }
@@ -2,6 +2,11 @@
2
2
  width: 100%;
3
3
  overflow: hidden;
4
4
  }
5
+
6
+ #main-switcher{
7
+ display: inherit;
8
+ }
9
+
5
10
  .container {
6
11
  width: 100%;
7
12
  height: 100%;
@@ -15,18 +20,22 @@
15
20
  height: 100%;
16
21
  display: flex;
17
22
  .sidebar {
18
- padding-inline: 2px;
23
+ padding-inline: 16px;
19
24
  display: flex;
20
25
  flex-direction: column;
21
26
  justify-content: space-between;
22
27
  align-items: center;
23
28
  background: var(--color-primary-700);
24
- width: 72px;
29
+ width: 40px;
25
30
  height: 100%;
26
31
  color: white;
27
32
  .top-content {
28
33
  padding-top: 24px;
29
34
  padding-bottom: 24px;
35
+ border-radius: 8px;
36
+ }
37
+ .icon {
38
+ margin-left: 8px;
30
39
  }
31
40
  #menu-region-container {
32
41
  min-height: 1px;
@@ -53,28 +62,11 @@
53
62
  &[expanded] {
54
63
  width: 252px;
55
64
  align-items: flex-start;
56
- padding-inline: 16px;
57
- }
58
- md-menu {
59
- cursor: pointer;
60
- --md-menu-container-color: white;
61
- min-width: 239px;
62
- .menu-item {
63
- display: flex;
64
- flex-direction: row;
65
- align-items: center;
66
- justify-content: space-between;
67
- padding: 1rem;
68
- gap: 50px;
69
- &:hover {
70
- background-color: #f0f0f0;
71
- }
72
- }
73
- color: var(--color-neutral-900);
74
65
  }
75
66
  .create-button-closed {
76
67
  cursor: pointer;
77
68
  background-color: #f0f0f0;
69
+ color: var(--color-primary-700);
78
70
  border-radius: 8px;
79
71
  width: 40px;
80
72
  height: 40px;
@@ -82,11 +74,17 @@
82
74
  flex-direction: row;
83
75
  align-items: center;
84
76
  justify-content: center;
77
+ transition: background-color 0.3s ease;
78
+ &:hover {
79
+ background-color: var(--color-primary-900);
80
+ color: white;
81
+ }
85
82
  }
86
83
  .create-button-opened {
87
84
  padding: 1px;
88
85
  cursor: pointer;
89
86
  background-color: #f0f0f0;
87
+ color: var(--color-primary-700);
90
88
  border-radius: 8px;
91
89
  gap: 8px;
92
90
  font-weight: 600;
@@ -95,7 +93,11 @@
95
93
  display: flex;
96
94
  flex-direction: row;
97
95
  align-items: center;
98
- padding-left: 9px;
96
+ transition: background-color 0.3s ease;
97
+ &:hover {
98
+ background-color: var(--color-primary-900);
99
+ color: white;
100
+ }
99
101
  }
100
102
  }
101
103
  .content {
@@ -129,38 +131,6 @@
129
131
  .divider-closed {
130
132
  width: 40px;
131
133
  }
132
- .actions-bottom {
133
- display: flex;
134
- flex-direction: column;
135
- gap: 24px;
136
- width: 100%;
137
- }
138
- primaria-menu {
139
- border-radius: 8px;
140
- color: var(--color-primary-700);
141
- }
142
- .toggle-opened,
143
- .toggle-closed {
144
- cursor: pointer;
145
- display: flex;
134
+ .toggle-button {
146
135
  margin-bottom: 24px;
147
- padding: 8px;
148
- gap: 8px;
149
- border-radius: 8px;
150
- border: 1px;
151
- transition: background-color 0.3s ease;
152
- &:hover {
153
- background-color: var(--color-primary-900);
154
- }
155
- }
156
- .toggle-opened {
157
- justify-content: flex-start;
158
- }
159
- .toggle-closed {
160
- justify-content: center;
161
- }
162
- .close-menu {
163
- display: flex;
164
- flex-direction: row-reverse;
165
- align-items: center;
166
136
  }
@@ -4,64 +4,57 @@ import "../../fonts/fonts.css";
4
4
  import { html, nothing } from "lit";
5
5
  import gencatLogo from "../../../UI/images/Gencat_Logotip.svg";
6
6
  import { PrimariaShell } from "./primaria-shell";
7
- import "@material/web/menu/menu.js";
8
- import "@material/web/menu/menu-item.js";
9
- import "@material/web/button/filled-button.js";
7
+ import { shellViews } from "./constants";
8
+ import {translate} from '../../../locales';
10
9
 
11
10
  export const template = (props: PrimariaShell) => html`
12
- <div class="container">
13
- <shell-header></shell-header>
14
- <div class="main-container">
15
- <div class="sidebar" ?expanded=${props.sidebarExpanded}>
16
- <!-- <div class="top-content"> -->
11
+ <primaria-content-switcher id="main-switcher" attrForSelected="view" .selected=${props.viewSelected}>
12
+ <div class="container" view=${shellViews.shell}>
13
+ <shell-header></shell-header>
14
+ <div class="main-container">
15
+ <div class="sidebar" ?expanded=${props.sidebarExpanded}>
17
16
  <div class="top-content">
18
- <primaria-menu>
17
+ <quick-actions-menu>
19
18
  <div class="${props.sidebarExpanded ? "create-button-opened" : "create-button-closed"} " slot="anchor" id="usage-anchor">
20
- <dss-icon icon="add_circle_outline" size="md"></dss-icon>${props.sidebarExpanded ? "Crear" : nothing}
19
+ <dss-icon class="${props.sidebarExpanded ? "icon" : ""}" icon="add_circle_outline" size="md"></dss-icon>${props.sidebarExpanded ? translate('actions.create') : nothing}
20
+ ${!props.sidebarExpanded ? html`<dss-tooltip position="right">
21
+ ${translate('actions.create')}
22
+ </dss-tooltip>` : nothing}
21
23
  </div>
22
- <md-menu slot="content" id="content" anchor="usage-anchor">
23
- <div id="quick-actions-region-container"></div>
24
- </md-menu>
25
- </primaria-menu>
24
+ <dss-action-menu id="quick-actions-region-container" slot="content" id="content" anchor="usage-anchor"></dss-action-menu>
25
+ </quick-actions-menu>
26
26
  </div>
27
27
  <div id="menu-region-container"></div>
28
- <!-- </div> -->
29
- <div class="bottom-content">
30
- <div class="bottom-content-first">
31
- <hr class="dss-divider--bold ${props.sidebarExpanded ? "divider-opened" : "divider-closed"}" />
32
- <!-- <primaria-menu-item
33
- icon="add_box"
34
- label="Menu Item"
35
- ></primaria-menu-item>
36
- <primaria-menu-item
37
- icon="add_box"
38
- label="Menu Item"
39
- ></primaria-menu-item>
40
- <primaria-menu-item
41
- icon="add_box"
42
- label="Menu Item"
43
- ></primaria-menu-item>
44
- <primaria-menu-item
45
- icon="add_box"
46
- label="Menu Item"
47
- ></primaria-menu-item> -->
48
- <div id="navigation-menu-lower-region-container"></div>
49
- </div>
50
- <div @click=${() => props._toggleSidebar()} class="${props.sidebarExpanded ? "toggle-opened" : "toggle-closed"}">
51
- ${!props.sidebarExpanded ? html`<dss-container><span class="dss-icon white dss-icon--fill dss-icon-button--md">expand_circle_right</span></dss-container>` : html`<dss-container class="close-menu"><span class="dss-icon white dss-icon--fill dss-icon-button--md" style="transform: rotate(180deg);">expand_circle_right</span>Tancar Menu</dss-container>`}
28
+ <div class="bottom-content">
29
+ <div class="bottom-content-first">
30
+ <hr class="dss-divider--bold ${props.sidebarExpanded ? "divider-opened" : "divider-closed"}" />
31
+ <div id="navigation-menu-lower-region-container"></div>
32
+ </div>
33
+ <primaria-nav-item
34
+ .config=${{
35
+ icon: "expand_circle_right",
36
+ label: props.sidebarExpanded ? translate('actions.toggleMenuClose') : translate('actions.toggleMenuOpen'),
37
+ fill: true,
38
+ rotateIcon: props.sidebarExpanded,
39
+ callbackFn: () => props._toggleSidebar(),
40
+ }}
41
+ class="toggle-button"
42
+ ></primaria-nav-item>
52
43
  </div>
53
44
  </div>
45
+ <div class="content">
46
+ <div id="floating-region-container"></div>
47
+ <primaria-content-switcher id="main-region-container"></primaria-content-switcher>
48
+ </div>
54
49
  </div>
55
- <div class="content">
56
- <div id="floating-region-container"></div>
57
- <primaria-content-switcher id="main-region-container"></primaria-content-switcher>
58
- </div>
50
+ <!-- <div class="footer">
51
+ <div class="footer-logo">
52
+ <img src=${gencatLogo} alt="logo" />
53
+ <span>|</span>
54
+ <span>Historial Electrònic de Salut (HES)</span>
55
+ </div>
56
+ </div> -->
59
57
  </div>
60
- <!-- <div class="footer">
61
- <div class="footer-logo">
62
- <img src=${gencatLogo} alt="logo" />
63
- <span>|</span>
64
- <span>Historial Electrònic de Salut (HES)</span>
65
- </div>
66
- </div> -->
67
- </div>`;
58
+ <primaria-error-view .error=${props.error} view=${shellViews.error}></primaria-error-view>
59
+ </primaria-content-switcher>
60
+ `;
@@ -2,8 +2,8 @@ import { LitElement, html } from "lit";
2
2
  import { customElement } from "lit/decorators.js";
3
3
  import { template } from "./template";
4
4
 
5
- @customElement("primaria-menu")
6
- export class PrimariaMenu extends LitElement {
5
+ @customElement("quick-actions-menu")
6
+ export class QuickActionsMenu extends LitElement {
7
7
  render() {
8
8
  return html`${template(this)}`;
9
9
  }
@@ -43,4 +43,4 @@ export class PrimariaMenu extends LitElement {
43
43
  targetElement.show();
44
44
  }
45
45
  }
46
- }
46
+ }
@@ -0,0 +1,10 @@
1
+
2
+ import { html } from "lit";
3
+ import { QuickActionsMenu } from "./quick-actions-menu";
4
+
5
+ export const template = (props: QuickActionsMenu) => html`
6
+ <span >
7
+ <slot name="anchor"></slot>
8
+ <slot name="content"></slot>
9
+ </span>
10
+ `;
@@ -0,0 +1,9 @@
1
+ <svg width="215" height="150" viewBox="0 0 215 150" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path opacity="0.9" d="M135.132 57.43C96.9221 47.658 83.3815 -29.7048 26.9734 12.5083C-13.0511 42.4595 11.4691 115.499 61.6878 107.019C92.0822 101.867 87.3917 101.341 113.129 115.244C139.231 129.308 167.972 136.397 195.855 111.436C210.28 98.5179 215.939 67.0352 201.939 50.7417C184.388 30.3592 158.485 63.4098 135.132 57.43Z" fill="#EFF7FF"/>
3
+ <ellipse cx="120.5" cy="143.5" rx="52.5" ry="3.5" fill="#F5F5F5"/>
4
+ <path d="M121.387 80.2184C121.995 79.5948 122.563 78.953 123.09 78.2959L134.396 89.3383C135.09 90.0177 134.851 91.389 133.861 92.4024C132.872 93.4159 131.505 93.6888 130.811 93.0094L119.505 81.967C120.148 81.424 120.777 80.8407 121.385 80.2171L121.387 80.2184Z" fill="#1D1D1D"/>
5
+ <path opacity="0.6" d="M121.127 79.9896C132.157 68.6986 131.888 50.5485 120.527 39.4502C109.166 28.3519 91.0149 28.5081 79.9849 39.799C68.955 51.09 69.2233 69.2401 80.5843 80.3385C91.9453 91.4368 110.097 91.2806 121.127 79.9896Z" fill="#8FC2F5"/>
6
+ <path d="M78.0382 83.0622C90.8729 95.6382 111.378 95.4578 123.835 82.6609C136.293 69.8625 135.986 49.2932 123.15 36.7173C110.316 24.1413 89.8107 24.3217 77.3538 37.1186C64.8956 49.9169 65.2022 70.4862 78.0382 83.0622ZM80.642 80.387C69.289 69.264 69.0172 51.0692 80.037 39.749C91.0569 28.4288 109.194 28.2694 120.547 39.3938C131.9 50.5182 132.171 68.713 121.152 80.0332C110.132 91.3534 91.9949 91.5128 80.642 80.3884V80.387Z" fill="#7BACFC"/>
7
+ <path d="M169.953 128.522L171.714 126.696C173.474 124.871 173.421 121.964 171.595 120.205L135.013 84.9265C133.187 83.1661 130.281 83.2205 128.522 85.0451L126.761 86.8711C125.001 88.6957 125.055 91.6028 126.88 93.3619L163.462 128.64C165.287 130.401 168.194 130.346 169.953 128.522Z" fill="#656565"/>
8
+ <path opacity="0.35" d="M88.8399 71.2315C96.506 79.2245 101.258 78.1642 100.757 82.4547C100.256 86.7452 91.398 85.7448 82.7698 76.0396C74.1415 66.3344 75.0893 54.9166 79.8491 55.2485C84.6089 55.5803 80.129 62.1492 88.8399 71.2315Z" fill="white"/>
9
+ </svg>
@@ -1,6 +1,4 @@
1
1
  import "./primaria-content-switcher/primaria-content-switcher";
2
- import "./primaria-menu-item/primaria-menu-item";
3
- import "./primaria-menu/primaria-menu";
2
+ import "./primaria-nav-item/primaria-nav-item";
4
3
  import "./primaria-text-editor/primaria-rich-text-editor";
5
4
  export * from "./primaria-interaction";
6
- import "./dss-container/dss-container";
@@ -0,0 +1,54 @@
1
+ import { LitElement, html, css, unsafeCSS, PropertyValues } from "lit";
2
+ import { template } from "./template";
3
+ import styles from "./styles.css?inline";
4
+ import { customElement, property, state } from "lit/decorators.js";
5
+ import { shellApi } from "../../../api/api";
6
+ import { shellEvents } from "../../../events";
7
+ import { PrimariaNavItemConfig } from "../typings";
8
+ import { regionView } from "@uxland/regions";
9
+
10
+ @customElement("primaria-nav-item")
11
+ export class PrimariaNavItem extends regionView(LitElement) {
12
+ static styles = css`
13
+ ${unsafeCSS(styles)}
14
+ `;
15
+
16
+ constructor(config: PrimariaNavItemConfig) {
17
+ super();
18
+ this.config = config;
19
+ }
20
+
21
+ connectedCallback(): void {
22
+ super.connectedCallback();
23
+ shellApi.broker.subscribe(shellEvents.mainViewChanged, (payload: { viewId: string }) => {
24
+ this.isActive = payload.viewId === this.view?.id;
25
+ });
26
+ }
27
+
28
+ firstUpdated(_changedProps: PropertyValues<PrimariaNavItem>) {
29
+ super.firstUpdated(_changedProps);
30
+ this.observeHostResize();
31
+ }
32
+
33
+ observeHostResize() {
34
+ const parentElement = this.parentElement;
35
+ const observer = new ResizeObserver((entries) => {
36
+ for (const entry of entries) {
37
+ const width = entry.target.clientWidth; // Obtenemos el ancho del host
38
+ this.showText = width > 100; // Mostrar texto si el ancho del host es mayor que 150px
39
+ }
40
+ });
41
+
42
+ observer.observe(parentElement as HTMLElement);
43
+ }
44
+
45
+ render() {
46
+ return html`${template(this)}`;
47
+ }
48
+
49
+ @property({ type: Number }) containerWidth = 0;
50
+ @state() showText = false;
51
+ @state() isActive = false;
52
+
53
+ @property({ type: Object }) config: PrimariaNavItemConfig;
54
+ }
@@ -18,3 +18,7 @@
18
18
  transition: background-color 0.3s;
19
19
  }
20
20
  }
21
+
22
+ .item.active{
23
+ outline: 2px solid white;
24
+ }
@@ -0,0 +1,27 @@
1
+ import { html, nothing } from "lit";
2
+ import { PrimariaNavItem } from "./primaria-nav-item";
3
+ import { classMap } from "lit/directives/class-map.js";
4
+
5
+ export const template = (props: PrimariaNavItem) => {
6
+ return html`
7
+ <div
8
+ class=${classMap({ item: true, active: props.isActive })}
9
+ @click=${props.config.callbackFn}
10
+ ?expanded=${props.showText}
11
+ >
12
+ <div class="icon-label">
13
+ <dss-icon icon=${props.config.icon} size="md" ?fill=${props.config.fill} style=${props.config.rotateIcon ? "transform: rotate(180deg);" : ""}></dss-icon>
14
+ ${props.showText ? html`<span>${props.config.label}</span>` : ""}
15
+ </div>
16
+ ${props.showText && props.config.showArrow ? html`<dss-icon icon="chevron_right" size="md"></dss-icon>` : ""}
17
+ ${
18
+ !props.showText
19
+ ? html`
20
+ <dss-tooltip position="right">
21
+ ${props.config.label}
22
+ </dss-tooltip>`
23
+ : nothing
24
+ }
25
+ </div>
26
+ `;
27
+ };
@@ -0,0 +1,41 @@
1
+ import { LitElement, html, css, unsafeCSS } from "lit";
2
+ import styles from "./styles.css?inline";
3
+ import { customElement, property, state } from "lit/decorators.js";
4
+ import { template } from "./template";
5
+ import { PrimariaNavItemConfig, PrimariaNavTreeMenuConfig } from "../typings";
6
+
7
+ @customElement("primaria-nav-tree-menu")
8
+ export class PrimariaNavTreeMenu extends LitElement {
9
+ static styles = css`
10
+ ${unsafeCSS(styles)}
11
+ `;
12
+
13
+ @property({ type: Object }) config: PrimariaNavTreeMenuConfig;
14
+ @state() primariaNavItemConfig: PrimariaNavItemConfig;
15
+
16
+ @state() showActionMenu = false;
17
+
18
+ constructor(config: PrimariaNavTreeMenuConfig) {
19
+ super();
20
+ this.config = config;
21
+ this.primariaNavItemConfig = {
22
+ icon: config.icon,
23
+ label: config.label,
24
+ showArrow: true,
25
+ callbackFn: this.handleItemClick,
26
+ };
27
+ }
28
+
29
+ handleItemClick = () => {
30
+ this.showActionMenu = true;
31
+ this.requestUpdate();
32
+ };
33
+
34
+ handleCloseMenu = () => {
35
+ this.showActionMenu = false;
36
+ };
37
+
38
+ render() {
39
+ return html`${template(this)}`;
40
+ }
41
+ }
@@ -0,0 +1,11 @@
1
+ .wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 8px;
5
+ }
6
+
7
+ .menu-active {
8
+ background-color: var(--color-primary-900);
9
+ color: white;
10
+ border-radius: 8px;
11
+ }
@@ -0,0 +1,30 @@
1
+ import { html, nothing } from "lit";
2
+ import { PrimariaNavTreeMenu } from "./primaria-nav-tree-menu";
3
+ import { classMap } from "lit/directives/class-map.js";
4
+
5
+ export const template = (props: PrimariaNavTreeMenu) => html`
6
+ <div class="wrapper">
7
+ <primaria-nav-item
8
+ .config=${props.primariaNavItemConfig}
9
+ @click=${props.handleItemClick}
10
+ class="${classMap({ "menu-active": props.showActionMenu })}"
11
+ ></primaria-nav-item>
12
+ ${
13
+ props.showActionMenu
14
+ ? html`
15
+ <dss-action-menu @onCloseActionMenu=${props.handleCloseMenu}>
16
+ ${props.config.actionMenuItems?.map(
17
+ (item) => html`
18
+ <dss-action-menu-item
19
+ righticon=${item.icon}
20
+ .label=${item.label}
21
+ @click=${item.callbackFn}
22
+ ></dss-action-menu-item>
23
+ `,
24
+ )}
25
+ </dss-action-menu>
26
+ `
27
+ : nothing
28
+ }
29
+ </div>
30
+ `;
@@ -0,0 +1,17 @@
1
+ interface MenuItem {
2
+ icon: string;
3
+ label: string;
4
+ }
5
+
6
+ export interface PrimariaNavItemConfig extends MenuItem {
7
+ callbackFn: () => void;
8
+ showArrow?: boolean;
9
+ fill?: boolean;
10
+ rotateIcon?: boolean;
11
+ }
12
+
13
+ export interface PrimariaNavTreeMenuConfig {
14
+ icon: string;
15
+ label: string;
16
+ actionMenuItems: PrimariaNavItemConfig[];
17
+ }
package/src/api/api.ts CHANGED
@@ -47,7 +47,7 @@ export const primariaApiFactory: ApiFactory<PrimariaApi> = (
47
47
  ): PrimariaApi => {
48
48
  return {
49
49
  pluginInfo: pluginInfo,
50
- regionManager: createRegionManagerProxy(pluginInfo, regionManager),
50
+ regionManager: createRegionManagerProxy(pluginInfo, regionManager, broker),
51
51
  httpClient: createHttpClient(tokenManager),
52
52
  interactionManager: { ...createInteractionManager() },
53
53
  broker: broker,