@gravitee/ui-components 3.25.3-typescript-ad6021f → 3.25.3-typescript-bfd8f67

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 (188) hide show
  1. package/package.json +5 -8
  2. package/src/atoms/gv-autocomplete.js +1 -461
  3. package/src/atoms/gv-button.js +1 -410
  4. package/src/atoms/gv-checkbox.js +1 -187
  5. package/src/atoms/gv-date-picker-calendar.js +1 -894
  6. package/src/atoms/gv-date-picker-cell.js +1 -190
  7. package/src/atoms/gv-date-picker.js +1 -671
  8. package/src/atoms/gv-file-upload.js +1 -367
  9. package/src/atoms/gv-icon.js +1 -103
  10. package/src/atoms/gv-image.js +1 -144
  11. package/src/atoms/gv-input-message.js +1 -84
  12. package/src/atoms/gv-input.js +1 -561
  13. package/src/atoms/gv-link.js +1 -210
  14. package/src/atoms/gv-message.js +1 -128
  15. package/src/atoms/gv-metric.js +1 -117
  16. package/src/atoms/gv-relative-time.js +1 -156
  17. package/src/atoms/gv-select-native.js +1 -388
  18. package/src/atoms/gv-select.js +1 -437
  19. package/src/atoms/gv-spinner.js +1 -57
  20. package/src/atoms/gv-state.js +1 -130
  21. package/src/atoms/gv-switch.js +1 -243
  22. package/src/atoms/gv-tag.js +1 -168
  23. package/src/atoms/gv-text.js +1 -168
  24. package/src/charts/gv-chart-bar.js +1 -103
  25. package/src/charts/gv-chart-gauge.js +1 -100
  26. package/src/charts/gv-chart-histogram.js +1 -83
  27. package/src/charts/gv-chart-line.js +1 -224
  28. package/src/charts/gv-chart-map.js +1 -112
  29. package/src/charts/gv-chart-pie.js +1 -91
  30. package/src/index.js +1 -77
  31. package/src/lib/cron-expression.js +1 -205
  32. package/src/lib/date.js +1 -44
  33. package/src/lib/events.js +1 -26
  34. package/src/lib/http-client-schema-form.js +1 -67
  35. package/src/lib/http.js +1 -237
  36. package/src/lib/i18n.js +1 -103
  37. package/src/lib/item.js +1 -118
  38. package/src/lib/properties.js +1 -189
  39. package/src/lib/schema-form.js +1 -44
  40. package/src/lib/studio.js +1 -141
  41. package/src/lib/style.js +1 -41
  42. package/src/lib/text-format.js +1 -69
  43. package/src/lib/theme.js +1 -63
  44. package/src/lib/utils.js +1 -111
  45. package/src/mixins/chart-element.js +1 -165
  46. package/src/mixins/input-element.js +1 -144
  47. package/src/mixins/item-resource.js +1 -120
  48. package/src/mixins/keyboard-element.js +1 -69
  49. package/src/mixins/update-after-browser.js +1 -30
  50. package/src/mixins/with-resize-observer.js +1 -68
  51. package/src/mixins/with-skeleton-attribute.js +1 -112
  52. package/src/molecules/gv-card-full.js +1 -218
  53. package/src/molecules/gv-card-list.js +1 -113
  54. package/src/molecules/gv-card.js +1 -133
  55. package/src/molecules/gv-category-list.js +1 -60
  56. package/src/molecules/gv-category.js +1 -170
  57. package/src/molecules/gv-code.js +1 -359
  58. package/src/molecules/gv-confirm.js +1 -188
  59. package/src/molecules/gv-cron-editor.js +1 -710
  60. package/src/molecules/gv-dropdown-menu.js +1 -116
  61. package/src/molecules/gv-expandable.js +1 -122
  62. package/src/molecules/gv-expression-language.js +1 -270
  63. package/src/molecules/gv-identity-picture.js +1 -148
  64. package/src/molecules/gv-list.js +1 -227
  65. package/src/molecules/gv-metrics.js +1 -162
  66. package/src/molecules/gv-modal.js +1 -213
  67. package/src/molecules/gv-nav.js +1 -196
  68. package/src/molecules/gv-option.js +1 -242
  69. package/src/molecules/gv-plans.js +1 -429
  70. package/src/molecules/gv-popover.js +1 -351
  71. package/src/molecules/gv-promote.js +1 -209
  72. package/src/molecules/gv-rating-list.js +1 -365
  73. package/src/molecules/gv-rating.js +1 -253
  74. package/src/molecules/gv-row-expandable.js +1 -45
  75. package/src/molecules/gv-row.js +1 -210
  76. package/src/molecules/gv-stats.js +1 -121
  77. package/src/molecules/gv-stepper.js +1 -288
  78. package/src/molecules/gv-table.js +1 -685
  79. package/src/molecules/gv-tree.js +1 -250
  80. package/src/organisms/gv-documentation.js +1 -215
  81. package/src/organisms/gv-header.js +1 -288
  82. package/src/organisms/gv-http-client.js +1 -275
  83. package/src/organisms/gv-menu.js +1 -263
  84. package/src/organisms/gv-newsletter-subscription.js +1 -271
  85. package/src/organisms/gv-pagination.js +1 -198
  86. package/src/organisms/gv-properties.js +1 -920
  87. package/src/organisms/gv-resizable-views.js +1 -396
  88. package/src/organisms/gv-resources.js +1 -535
  89. package/src/organisms/gv-schema-form-array.js +1 -250
  90. package/src/organisms/gv-schema-form-control-object.js +1 -154
  91. package/src/organisms/gv-schema-form-control.js +1 -443
  92. package/src/organisms/gv-schema-form.js +1 -751
  93. package/src/organisms/gv-tabs.js +1 -210
  94. package/src/organisms/gv-user-menu.js +1 -314
  95. package/src/organisms/gv-vertical-menu.js +1 -123
  96. package/src/policy-studio/gv-flow-step.js +1 -464
  97. package/src/policy-studio/gv-flow.js +1 -621
  98. package/src/policy-studio/gv-policy-studio-menu.js +1 -750
  99. package/src/policy-studio/gv-policy-studio.js +1 -1842
  100. package/src/styles/empty.js +1 -36
  101. package/src/styles/input.js +1 -263
  102. package/src/styles/link.js +1 -32
  103. package/src/styles/shapes.js +1 -17
  104. package/src/styles/skeleton.js +1 -53
  105. package/src/styles/zoom.js +1 -40
  106. package/src/theme/gv-theme.js +1 -203
  107. package/wc/gv-autocomplete.js +1 -1
  108. package/wc/gv-button.js +1 -1
  109. package/wc/gv-card-full.js +1 -1
  110. package/wc/gv-card-list.js +1 -1
  111. package/wc/gv-card.js +1 -1
  112. package/wc/gv-category-list.js +1 -1
  113. package/wc/gv-category.js +1 -1
  114. package/wc/gv-chart-bar.js +1 -1
  115. package/wc/gv-chart-gauge.js +1 -1
  116. package/wc/gv-chart-histogram.js +1 -1
  117. package/wc/gv-chart-line.js +1 -1
  118. package/wc/gv-chart-map.js +1 -1
  119. package/wc/gv-chart-pie.js +1 -1
  120. package/wc/gv-checkbox.js +1 -1
  121. package/wc/gv-code.js +1 -1
  122. package/wc/gv-confirm.js +1 -1
  123. package/wc/gv-cron-editor.js +1 -1
  124. package/wc/gv-date-picker-calendar.js +1 -1
  125. package/wc/gv-date-picker-cell.js +1 -1
  126. package/wc/gv-date-picker.js +1 -1
  127. package/wc/gv-documentation.js +1 -1
  128. package/wc/gv-dropdown-menu.js +1 -1
  129. package/wc/gv-expandable.js +1 -1
  130. package/wc/gv-expression-language.js +1 -1
  131. package/wc/gv-file-upload.js +1 -1
  132. package/wc/gv-flow-step.js +1 -1
  133. package/wc/gv-flow.js +1 -1
  134. package/wc/gv-header.js +1 -1
  135. package/wc/gv-http-client.js +1 -1
  136. package/wc/gv-icon.js +1 -1
  137. package/wc/gv-identity-picture.js +1 -1
  138. package/wc/gv-image.js +1 -1
  139. package/wc/gv-input-message.js +1 -1
  140. package/wc/gv-input.js +1 -1
  141. package/wc/gv-link.js +1 -1
  142. package/wc/gv-list.js +1 -1
  143. package/wc/gv-menu.js +1 -1
  144. package/wc/gv-message.js +1 -1
  145. package/wc/gv-metric.js +1 -1
  146. package/wc/gv-metrics.js +1 -1
  147. package/wc/gv-modal.js +1 -1
  148. package/wc/gv-nav.js +1 -1
  149. package/wc/gv-newsletter-subscription.js +1 -1
  150. package/wc/gv-option.js +1 -1
  151. package/wc/gv-pagination.js +1 -1
  152. package/wc/gv-plans.js +1 -1
  153. package/wc/gv-policy-studio-menu.js +1 -1
  154. package/wc/gv-policy-studio.js +1 -1
  155. package/wc/gv-popover.js +1 -1
  156. package/wc/gv-promote.js +1 -1
  157. package/wc/gv-properties.js +1 -1
  158. package/wc/gv-rating-list.js +1 -1
  159. package/wc/gv-rating.js +1 -1
  160. package/wc/gv-relative-time.js +1 -1
  161. package/wc/gv-resizable-views.js +1 -1
  162. package/wc/gv-resources.js +1 -1
  163. package/wc/gv-row-expandable.js +1 -1
  164. package/wc/gv-row.js +1 -1
  165. package/wc/gv-schema-form-array.js +1 -1
  166. package/wc/gv-schema-form-control-object.js +1 -1
  167. package/wc/gv-schema-form-control.js +1 -1
  168. package/wc/gv-schema-form.js +1 -1
  169. package/wc/gv-select-native.js +1 -1
  170. package/wc/gv-select.js +1 -1
  171. package/wc/gv-spinner.js +1 -1
  172. package/wc/gv-state.js +1 -1
  173. package/wc/gv-stats.js +1 -1
  174. package/wc/gv-stepper.js +1 -1
  175. package/wc/gv-switch.js +1 -1
  176. package/wc/gv-table.js +1 -1
  177. package/wc/gv-tabs.js +1 -1
  178. package/wc/gv-tag.js +1 -1
  179. package/wc/gv-text.js +1 -1
  180. package/wc/gv-theme.js +1 -1
  181. package/wc/gv-tree.js +1 -1
  182. package/wc/gv-user-menu.js +1 -1
  183. package/wc/gv-vertical-menu.js +1 -1
  184. package/CHANGELOG.md +0 -1292
  185. package/LICENSE.txt +0 -202
  186. package/README.md +0 -195
  187. package/src/.eslintrc.js +0 -19
  188. package/src/theme/definition.json +0 -1762
@@ -1,210 +1 @@
1
- /*
2
- * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { css, LitElement, html } from 'lit';
17
- import '../molecules/gv-option';
18
- import { dispatchCustomEvent } from '../lib/events';
19
-
20
- /**
21
- * Tabs component
22
- *
23
- * * ## Details
24
- * * This component use gv-option component to generate tabs.
25
- *
26
- * @attr {Array<id: string | {id, title?, icon?, active?, description?, label?}>} options - An array of options for gv-option sub component
27
- * @slot content - List of elements for tabs content. Should have an id related to options.
28
- *
29
- * @attr {String} value - the opened tab id
30
- * @attr {Boolean} disabled - true if disabled
31
- * @attr {Boolean} small - true if you want display tabs below of title
32
- * @attr {Boolean} truncate - true if you want truncate tabs title
33
- * @attr {Function} validator - a function that's calls when user change tab, this is useful to validate tab change.
34
- *
35
- * @cssprop {Length} [--gv-tabs-options--m=0] - Tabs options margin
36
- */
37
- export class GvTabs extends LitElement {
38
- static get properties() {
39
- return {
40
- options: { type: Array },
41
- _options: { type: Array, attribute: false },
42
- value: { type: String, reflect: true },
43
- validator: { type: Function },
44
- disabled: { type: Boolean },
45
- small: { type: Boolean },
46
- truncate: { type: Boolean },
47
- };
48
- }
49
-
50
- static get styles() {
51
- return [
52
- // language=css
53
- css`
54
- :host {
55
- box-sizing: border-box;
56
- }
57
-
58
- ::slotted([slot='content']) {
59
- opacity: 0;
60
- box-sizing: border-box;
61
- transition: opacity 350ms ease-in-out;
62
- visibility: hidden;
63
- position: absolute;
64
- left: -9999px;
65
- top: -9999px;
66
- }
67
-
68
- ::slotted([slot='content'].current) {
69
- opacity: 1;
70
- visibility: visible;
71
- position: relative;
72
- left: auto;
73
- top: auto;
74
- }
75
-
76
- .header {
77
- display: flex;
78
- border-bottom: 1px solid #d9d9d9;
79
- box-sizing: border-box;
80
- }
81
-
82
- .title {
83
- flex: 1;
84
- display: flex;
85
- align-items: center;
86
- }
87
-
88
- .actions {
89
- display: flex;
90
- align-items: center;
91
- }
92
-
93
- .tabs {
94
- flex: 1;
95
- display: flex;
96
- justify-content: flex-end;
97
- --gv-option--bdrs: 0;
98
- }
99
-
100
- :host([small]) .tabs {
101
- flex-direction: column;
102
- }
103
-
104
- :host([small]) gv-option {
105
- align-self: flex-end;
106
- }
107
-
108
- gv-option {
109
- margin: var(--gv-tabs-options--m, 0);
110
- }
111
-
112
- ::slotted(gv-button) {
113
- padding-bottom: 2px;
114
- }
115
- `,
116
- ];
117
- }
118
-
119
- _getContent() {
120
- const content = this.shadowRoot.querySelector('slot[name="content"]');
121
- return content.assignedNodes();
122
- }
123
-
124
- firstUpdated() {
125
- if (this.value == null && this.options != null && this.options.length > 0) {
126
- this.value = this.options[0].id;
127
- }
128
- }
129
-
130
- set options(options) {
131
- if (options && Array.isArray(options)) {
132
- this._options = options.map((option) => {
133
- if (typeof option === 'string') {
134
- return { id: option, title: option };
135
- } else if (typeof option === 'object' && option.title == null) {
136
- return { id: option.id, title: option.id };
137
- }
138
- return option;
139
- });
140
- }
141
- }
142
-
143
- get options() {
144
- return this._options;
145
- }
146
-
147
- updated() {
148
- const content = this._getContent();
149
- content.forEach((c) => c.classList.remove('current'));
150
- if (this.value) {
151
- const target = this.querySelector(`#${this.value}`);
152
- if (target) {
153
- target.classList.add('current');
154
- }
155
- } else {
156
- content[0].classList.add('current');
157
- }
158
- }
159
-
160
- _changeTab(from, content, value) {
161
- from.classList.remove('current');
162
- content.classList.add('current');
163
- this.value = value;
164
- dispatchCustomEvent(this, 'change', { value, from: from.id, to: content.id });
165
- }
166
-
167
- _onClick({ detail }) {
168
- if (!this.disabled) {
169
- const from = this._getContent().find((e) => e.classList.contains('current'));
170
- const content = this.querySelector(`#${detail.id}`);
171
- this.shadowRoot.querySelector('gv-option').value = from.id;
172
- if (this.validator) {
173
- this.validator({ from: from.id, to: content.id })
174
- .then(() => {
175
- this._changeTab(from, content, detail.id);
176
- })
177
- .catch(() => {});
178
- } else {
179
- this._changeTab(from, content, detail.id);
180
- }
181
- }
182
- }
183
-
184
- get _contextualOptions() {
185
- if (this.truncate) {
186
- return this.options.map((option) => {
187
- if (this.value !== option.id) {
188
- const label = option.label || option.title;
189
- return { ...option, label: label.substring(0, 1) };
190
- }
191
- return option;
192
- });
193
- }
194
- return this.options;
195
- }
196
-
197
- render() {
198
- return html`<div>
199
- <div class="header">
200
- <div class="tabs">
201
- <slot name="title" class="title"></slot>
202
- <gv-option small .options="${this._contextualOptions}" @gv-option:select="${this._onClick}" .value="${this.value}"></gv-option>
203
- </div>
204
- </div>
205
- <slot name="content"></slot>
206
- </div>`;
207
- }
208
- }
209
-
210
- window.customElements.define('gv-tabs', GvTabs);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvTabs=void 0;const t=require("lit");require("../molecules/gv-option");const e=require("../lib/events");class i extends t.LitElement{static get properties(){return{options:{type:Array},_options:{type:Array,attribute:!1},value:{type:String,reflect:!0},validator:{type:Function},disabled:{type:Boolean},small:{type:Boolean},truncate:{type:Boolean}}}static get styles(){return[t.css`:host{box-sizing:border-box}::slotted([slot=content]){opacity:0;box-sizing:border-box;transition:opacity 350ms ease-in-out;visibility:hidden;position:absolute;left:-9999px;top:-9999px}::slotted([slot=content].current){opacity:1;visibility:visible;position:relative;left:auto;top:auto}.header{display:flex;border-bottom:1px solid #d9d9d9;box-sizing:border-box}.title{flex:1;display:flex;align-items:center}.actions{display:flex;align-items:center}.tabs{flex:1;display:flex;justify-content:flex-end;--gv-option--bdrs:0}:host([small]) .tabs{flex-direction:column}:host([small]) gv-option{align-self:flex-end}gv-option{margin:var(--gv-tabs-options--m,0)}::slotted(gv-button){padding-bottom:2px}`]}_getContent(){return this.shadowRoot.querySelector('slot[name="content"]').assignedNodes()}firstUpdated(){null==this.value&&null!=this.options&&this.options.length>0&&(this.value=this.options[0].id)}set options(t){t&&Array.isArray(t)&&(this._options=t.map((t=>"string"==typeof t?{id:t,title:t}:"object"==typeof t&&null==t.title?{id:t.id,title:t.id}:t)))}get options(){return this._options}updated(){const t=this._getContent();if(t.forEach((t=>t.classList.remove("current"))),this.value){const t=this.querySelector(`#${this.value}`);t&&t.classList.add("current")}else t[0].classList.add("current")}_changeTab(t,i,s){t.classList.remove("current"),i.classList.add("current"),this.value=s,(0,e.dispatchCustomEvent)(this,"change",{value:s,from:t.id,to:i.id})}_onClick({detail:t}){if(!this.disabled){const e=this._getContent().find((t=>t.classList.contains("current"))),i=this.querySelector(`#${t.id}`);this.shadowRoot.querySelector("gv-option").value=e.id,this.validator?this.validator({from:e.id,to:i.id}).then((()=>{this._changeTab(e,i,t.id)})).catch((()=>{})):this._changeTab(e,i,t.id)}}get _contextualOptions(){return this.truncate?this.options.map((t=>{if(this.value!==t.id){const e=t.label||t.title;return{...t,label:e.substring(0,1)}}return t})):this.options}render(){return t.html`<div><div class="header"><div class="tabs"><slot name="title" class="title"></slot><gv-option small .options="${this._contextualOptions}" @gv-option:select="${this._onClick}" .value="${this.value}"></gv-option></div></div><slot name="content"></slot></div>`}}exports.GvTabs=i,window.customElements.define("gv-tabs",i);
@@ -1,314 +1 @@
1
- /*
2
- * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { LitElement, html, css } from 'lit';
17
- import '../molecules/gv-nav';
18
- import { repeat } from 'lit/directives/repeat';
19
- import { classMap } from 'lit/directives/class-map';
20
- import { isSameRoutes } from '../lib/utils';
21
-
22
- /**
23
- * User menu
24
- *
25
- * ## Details
26
- * * has @theme facet
27
- *
28
- * @fires gv-link:click - Custom event when nav link click
29
- *
30
- * @attr {Array} routes - definition of user routes [{icon: String, path: String, title: Promise<String>, active: Boolean, routes: Array<any>]
31
- * @attr {String} username - name of the user
32
- * @attr {String} avatar - url of the user avatar
33
- *
34
- * @cssprop {Color} [--gv-user-menu--c=var(--gv-theme-font-color-dark, #262626)] - Color
35
- * @cssprop {Color} [--gv-user-menu-hover--c=var(--gv-theme-color-dark, #28444f)] - Hover color
36
- * @cssprop {Color} [--gv-user-menu--bgc=transparent] - Background color
37
- * @cssprop {Color} [--gv-user-menu-list--bgc=var(--gv-theme-neutral-color-lightest, #ffffff)] - List background color
38
- * @cssprop {Color} [--gv-user-menu-hover--bgc=var(--gv-theme-color-light, #86c3d0)] - Hover background color
39
- * @cssprop {Color} [--gv-user-menu--bdc=lightgrey] - Border color
40
- * @cssprop {String} [--gv-user-menu--tsh=none] - Text shadow
41
- * @cssprop {Color} [--gv-user-menu-icon--c=var(--gv-theme-neutral-color-darkest, #000000)] - Icon color
42
- * @cssprop {Length} [--gv-user-menu-icon--s=16px] - Height and icon width
43
- * @cssprop {Length} [--gv-user-menu-link-a--ph=0px] - Link horizontal padding
44
- * @cssprop {String} [--gv-user-menu-link--ta=right] - Text align
45
- */
46
- export class GvUserMenu extends LitElement {
47
- static get properties() {
48
- return {
49
- avatar: { type: String },
50
- routes: { type: Array },
51
- _routes: { type: Array, attribute: false },
52
- _isClosed: { type: Boolean, attribute: false },
53
- username: { type: String },
54
- };
55
- }
56
-
57
- static get styles() {
58
- return [
59
- // language=css
60
- css`
61
- :host {
62
- --bdc: var(--gv-user-menu--bdc, lightgrey);
63
- --c: var(--gv-user-menu--c, var(--gv-theme-font-color-dark, #262626));
64
- --bgc: var(--gv-user-menu--bgc, transparent);
65
- --list-bgc: var(--gv-user-menu-list--bgc, var(--gv-theme-neutral-color-lightest, #ffffff));
66
- --hover-bgc: var(--gv-user-menu-hover--bgc, var(--gv-theme-color-light, #86c3d0));
67
- --gv-link-active--c: var(--gv-user-menu-hover--c, var(--gv-theme-color-dark, #28444f));
68
- --gv-icon--c: var(--gv-user-menu-icon--c, var(--gv-theme-neutral-color-darkest, #000000));
69
- --gv-icon--s: var(--gv-user-menu-icon--s, 16px);
70
- --gv-link-a--ph: var(--gv-user-menu-link-a--ph, 0px);
71
- --gv-link--ta: var(--gv-user-menu-link--ta, right);
72
- user-select: none;
73
- }
74
-
75
- .user-menu {
76
- list-style: none;
77
- margin: 0;
78
- padding: 0;
79
- display: inline-block;
80
- position: relative;
81
- }
82
-
83
- .user-menu__title {
84
- background-color: var(--bgc);
85
- border-left: 1px solid var(--bdc);
86
- color: var(--c);
87
- cursor: pointer;
88
- line-height: 40px;
89
- padding: 8px 24px;
90
- display: inline-flex;
91
- align-items: center;
92
- justify-content: space-between;
93
- min-width: 175px;
94
- text-shadow: var(--gv-user-menu--tsh, none);
95
- }
96
-
97
- ::slotted(*) {
98
- height: 40px;
99
- width: 40px;
100
- }
101
-
102
- .user-menu__title.no-user {
103
- padding: 5px 24px;
104
- }
105
-
106
- .user-menu__title gv-link {
107
- --gv-link-a--ph: 0;
108
- --gv-link-a--pv: 0;
109
- }
110
-
111
- .user-menu__title span {
112
- flex: 1;
113
- text-align: center;
114
- margin: 0 0.4rem;
115
- }
116
-
117
- .user-menu__title > gv-icon {
118
- transition: all 0.3s ease 0s;
119
- }
120
-
121
- .user-menu__list {
122
- position: absolute;
123
- background-color: var(--list-bgc);
124
- list-style: none;
125
- padding: 0;
126
- transition: all 0.3s ease 0s;
127
- width: 100%;
128
- }
129
-
130
- .user-menu__list__item {
131
- border-left: 1px solid var(--bdc);
132
- display: flex;
133
- align-items: center;
134
- transition: all 0.5s ease;
135
- padding: 2px 30px;
136
- }
137
-
138
- .user-menu__list__item:last-child {
139
- border-bottom: 1px solid var(--bdc);
140
- }
141
-
142
- .user-menu__list__item:hover {
143
- background-color: var(--hover-bgc);
144
- border-left: 1px dotted var(--bdc);
145
- font-weight: 500;
146
- }
147
-
148
- gv-link {
149
- margin: 0px;
150
- display: flex;
151
- width: 100%;
152
- }
153
-
154
- .separator {
155
- border-top: 1px solid var(--bdc);
156
- }
157
-
158
- .active {
159
- background-color: var(--gv-theme-neutral-color-dark, #d9d9d9);
160
- font-weight: bold;
161
- }
162
-
163
- /** for animations */
164
- .user-menu__list {
165
- visibility: visible;
166
- opacity: 1;
167
- transform: translateY(0%);
168
- z-index: 100;
169
- transition-delay: 0s, 0s, 0.2s;
170
- }
171
-
172
- .user-menu__list__group {
173
- border-top: 1px solid var(--bdc);
174
- background-color: var(--gv-theme-neutral-color-light, #efefef);
175
- padding-left: 0;
176
- }
177
-
178
- .user-menu__list__group__title {
179
- font-size: small;
180
- color: var(--gv-theme-color-darker, #383e3f);
181
- border-left: 1px solid var(--bdc);
182
- padding-left: 10px;
183
- }
184
-
185
- .closed .user-menu__list {
186
- visibility: hidden;
187
- opacity: 0;
188
- transform: translateY(-2em);
189
- z-index: -1;
190
- }
191
-
192
- gv-icon {
193
- transform: rotate(0deg);
194
- }
195
-
196
- .closed gv-icon {
197
- transform: rotate(-180deg);
198
- }
199
- `,
200
- ];
201
- }
202
-
203
- constructor() {
204
- super();
205
- this._isClosed = true;
206
- }
207
-
208
- _onClick(e) {
209
- e.preventDefault();
210
- this._isClosed = !this._isClosed;
211
- }
212
-
213
- _onMouseLeave() {
214
- this._isClosed = true;
215
- }
216
-
217
- _onSelect() {
218
- this._isClosed = true;
219
- }
220
-
221
- _hasOneItem() {
222
- return this.username == null && this._routes && this._routes.length === 1;
223
- }
224
-
225
- set routes(candidate) {
226
- if (candidate) {
227
- Promise.resolve(candidate).then((candidates) => {
228
- if (candidates) {
229
- Promise.all(candidates).then((futureRoutes) => {
230
- if (!isSameRoutes(this._routes, futureRoutes)) {
231
- this._routes = futureRoutes.filter((r) => r != null);
232
- }
233
- });
234
- } else {
235
- this._routes = null;
236
- }
237
- });
238
- } else {
239
- this._routes = null;
240
- }
241
- }
242
-
243
- _renderFirstItem() {
244
- if (this._routes) {
245
- if (this.username) {
246
- return html`<li class="user-menu__title" @click=${this._onClick}>
247
- <div>
248
- <slot></slot>
249
- </div>
250
- <span>${this.username}</span>
251
- <gv-icon shape="design:triangle"></gv-icon>
252
- </li>`;
253
- } else if (this._hasOneItem()) {
254
- const firstItem = this._routes[0];
255
- return html`<li class="user-menu__title no-user" @click=${this._onClick}>
256
- <gv-link .icon="${firstItem.icon}" .path="${firstItem.path}" .title="${firstItem.title}" @click=${this._onSelect}></gv-link>
257
- </li>`;
258
- }
259
- }
260
- return html``;
261
- }
262
-
263
- render() {
264
- const classes = { closed: this._isClosed };
265
- if (this._routes) {
266
- return html`
267
- <nav class="${classMap(classes)}">
268
- <ul class="user-menu" @mouseleave=${this._onMouseLeave}>
269
- ${this._renderFirstItem()}
270
-
271
- <li class="user-menu__content">
272
- <ul class="user-menu__list">
273
- ${repeat(
274
- this._routes,
275
- (route) => route,
276
- (route, index) => html` ${this._hasOneItem() ? html`` : this._renderItem(route)} `,
277
- )}
278
- </ul>
279
- </li>
280
- </ul>
281
- </nav>
282
- `;
283
- }
284
- return html``;
285
- }
286
-
287
- _renderItem(route) {
288
- if (route.routes) {
289
- return html`<ul class="user-menu__list__group">
290
- <span class="user-menu__list__group__title">${route.title}</span>
291
- ${repeat(
292
- route.routes,
293
- (childRoute) => childRoute,
294
- (childRoute, index) => html` ${this._renderItem(childRoute)} `,
295
- )}
296
- </ul>`;
297
- } else {
298
- return html`<li
299
- class="user-menu__list__item ${route.separator ? 'separator' : ''} ${route.active ? 'active' : ''}"
300
- style="${route.style}"
301
- >
302
- <gv-link
303
- .icon="${route.icon}"
304
- .path="${route.path}"
305
- .title="${route.title}"
306
- .target="${route.target}"
307
- @click=${this._onSelect}
308
- ></gv-link>
309
- </li>`;
310
- }
311
- }
312
- }
313
-
314
- window.customElements.define('gv-user-menu', GvUserMenu);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvUserMenu=void 0;const e=require("lit");require("../molecules/gv-nav");const t=require("lit/directives/repeat"),s=require("lit/directives/class-map"),r=require("../lib/utils");class i extends e.LitElement{static get properties(){return{avatar:{type:String},routes:{type:Array},_routes:{type:Array,attribute:!1},_isClosed:{type:Boolean,attribute:!1},username:{type:String}}}static get styles(){return[e.css`:host{--bdc:var(--gv-user-menu--bdc, lightgrey);--c:var(--gv-user-menu--c, var(--gv-theme-font-color-dark, #262626));--bgc:var(--gv-user-menu--bgc, transparent);--list-bgc:var(--gv-user-menu-list--bgc, var(--gv-theme-neutral-color-lightest, #ffffff));--hover-bgc:var(--gv-user-menu-hover--bgc, var(--gv-theme-color-light, #86c3d0));--gv-link-active--c:var(--gv-user-menu-hover--c, var(--gv-theme-color-dark, #28444f));--gv-icon--c:var(--gv-user-menu-icon--c, var(--gv-theme-neutral-color-darkest, #000000));--gv-icon--s:var(--gv-user-menu-icon--s, 16px);--gv-link-a--ph:var(--gv-user-menu-link-a--ph, 0px);--gv-link--ta:var(--gv-user-menu-link--ta, right);user-select:none}.user-menu{list-style:none;margin:0;padding:0;display:inline-block;position:relative}.user-menu__title{background-color:var(--bgc);border-left:1px solid var(--bdc);color:var(--c);cursor:pointer;line-height:40px;padding:8px 24px;display:inline-flex;align-items:center;justify-content:space-between;min-width:175px;text-shadow:var(--gv-user-menu--tsh,none)}::slotted(*){height:40px;width:40px}.user-menu__title.no-user{padding:5px 24px}.user-menu__title gv-link{--gv-link-a--ph:0;--gv-link-a--pv:0}.user-menu__title span{flex:1;text-align:center;margin:0 .4rem}.user-menu__title>gv-icon{transition:all .3s ease 0s}.user-menu__list{position:absolute;background-color:var(--list-bgc);list-style:none;padding:0;transition:all .3s ease 0s;width:100%}.user-menu__list__item{border-left:1px solid var(--bdc);display:flex;align-items:center;transition:all .5s ease;padding:2px 30px}.user-menu__list__item:last-child{border-bottom:1px solid var(--bdc)}.user-menu__list__item:hover{background-color:var(--hover-bgc);border-left:1px dotted var(--bdc);font-weight:500}gv-link{margin:0;display:flex;width:100%}.separator{border-top:1px solid var(--bdc)}.active{background-color:var(--gv-theme-neutral-color-dark,#d9d9d9);font-weight:700}.user-menu__list{visibility:visible;opacity:1;transform:translateY(0);z-index:100;transition-delay:0s,0s,.2s}.user-menu__list__group{border-top:1px solid var(--bdc);background-color:var(--gv-theme-neutral-color-light,#efefef);padding-left:0}.user-menu__list__group__title{font-size:small;color:var(--gv-theme-color-darker,#383e3f);border-left:1px solid var(--bdc);padding-left:10px}.closed .user-menu__list{visibility:hidden;opacity:0;transform:translateY(-2em);z-index:-1}gv-icon{transform:rotate(0)}.closed gv-icon{transform:rotate(-180deg)}`]}constructor(){super(),this._isClosed=!0}_onClick(e){e.preventDefault(),this._isClosed=!this._isClosed}_onMouseLeave(){this._isClosed=!0}_onSelect(){this._isClosed=!0}_hasOneItem(){return null==this.username&&this._routes&&1===this._routes.length}set routes(e){e?Promise.resolve(e).then((e=>{e?Promise.all(e).then((e=>{(0,r.isSameRoutes)(this._routes,e)||(this._routes=e.filter((e=>null!=e)))})):this._routes=null})):this._routes=null}_renderFirstItem(){if(this._routes){if(this.username)return e.html`<li class="user-menu__title" @click="${this._onClick}"><div><slot></slot></div><span>${this.username}</span><gv-icon shape="design:triangle"></gv-icon></li>`;if(this._hasOneItem()){const t=this._routes[0];return e.html`<li class="user-menu__title no-user" @click="${this._onClick}"><gv-link .icon="${t.icon}" .path="${t.path}" .title="${t.title}" @click="${this._onSelect}"></gv-link></li>`}}return e.html``}render(){const r={closed:this._isClosed};return this._routes?e.html`<nav class="${(0,s.classMap)(r)}"><ul class="user-menu" @mouseleave="${this._onMouseLeave}">${this._renderFirstItem()}<li class="user-menu__content"><ul class="user-menu__list">${(0,t.repeat)(this._routes,(e=>e),((t,s)=>e.html`${this._hasOneItem()?e.html``:this._renderItem(t)}`))}</ul></li></ul></nav>`:e.html``}_renderItem(s){return s.routes?e.html`<ul class="user-menu__list__group"><span class="user-menu__list__group__title">${s.title}</span> ${(0,t.repeat)(s.routes,(e=>e),((t,s)=>e.html`${this._renderItem(t)}`))}</ul>`:e.html`<li class="user-menu__list__item ${s.separator?"separator":""} ${s.active?"active":""}" style="${s.style}"><gv-link .icon="${s.icon}" .path="${s.path}" .title="${s.title}" .target="${s.target}" @click="${this._onSelect}"></gv-link></li>`}}exports.GvUserMenu=i,window.customElements.define("gv-user-menu",i);
@@ -1,123 +1 @@
1
- /*
2
- * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { css, html, LitElement } from 'lit';
17
- import '../molecules/gv-nav';
18
- import '../atoms/gv-image';
19
- import { isSameRoutes } from '../lib/utils';
20
-
21
- /**
22
- * A vertical menu
23
- *
24
- * @fires gv-link:click - Custom event when link click
25
- *
26
- * @attr {Array} routes - definition of routes [{active: Boolean, icon: String, path: String, title: Promise<String>]
27
- *
28
- */
29
- export class GvVerticalMenu extends LitElement {
30
- static get properties() {
31
- return {
32
- /** @required **/
33
- routes: { type: Array },
34
- _routes: { type: Array, attribute: false },
35
- logo: { type: String },
36
- };
37
- }
38
-
39
- static get styles() {
40
- return [
41
- // language=css
42
- css`
43
- :host {
44
- --gv-link--c: var(--gv-menu--c, var(--gv-theme-font-color-light, #ffffff));
45
- --gv-link-active--c: var(--gv-menu--c, var(--gv-theme-font-color-light, #ffffff));
46
- --gv-link--bgc: var(--gv-menu-link--bgc, transparent);
47
- --gv-link-active--bgc: var(--gv-menu-link-active--bgc, transparent);
48
- --gv-link-active--bdw: var(--gv-menu-link-active--bdw, 0 0 0 4px);
49
- --gv-link-active--bdc: var(--gv-menu-link-active--bdc, var(--gv-theme-color-light, #86c3d0));
50
- --gv-link-active--bds: var(--gv-menu-link-active--bds, solid);
51
- --pr: var(--gv-theme-layout--pr, 4rem);
52
- --pl: var(--gv-theme-layout--pl, 4rem);
53
- box-sizing: border-box;
54
- display: block;
55
- font-size: var(--gv-theme-font-size-s, 16px);
56
- width: var(--gv-theme-layout-menu-w, 200px);
57
- }
58
-
59
- .menu-container {
60
- display: flex;
61
- flex-direction: column;
62
- justify-content: space-between;
63
-
64
- background-color: var(--gv-menu--bgc, var(--gv-theme-color-dark, #28444f));
65
- color: var(--gv-menu--c, var(--gv-theme-font-color-light, #ffffff));
66
- }
67
-
68
- gv-image {
69
- height: 200px;
70
- width: 200px;
71
- }
72
-
73
- gv-nav {
74
- transition: width 250ms ease-in-out;
75
- display: flex;
76
- flex-direction: column;
77
- justify-content: space-between;
78
- line-height: 20px;
79
- vertical-align: middle;
80
- width: 100%;
81
- font-size: 16px;
82
- }
83
- `,
84
- ];
85
- }
86
-
87
- constructor() {
88
- super();
89
- /** @protected */
90
- this._routes = [];
91
- }
92
-
93
- set routes(candidate) {
94
- if (candidate) {
95
- Promise.resolve(candidate).then((candidates) => {
96
- if (candidates) {
97
- Promise.all(candidates).then((futureRoutes) => {
98
- if (!isSameRoutes(this._routes, futureRoutes)) {
99
- this._routes = futureRoutes.filter((r) => r != null);
100
- }
101
- });
102
- } else {
103
- this._routes = null;
104
- }
105
- });
106
- } else {
107
- this._routes = null;
108
- }
109
- }
110
-
111
- render() {
112
- return html`
113
- <div class="menu-container">
114
- ${this.logo ? html`<gv-image .src="${this.logo}"></gv-image>` : ''}
115
- <div class="nav-container">
116
- <gv-nav .routes="${this._routes}" vertical></gv-nav>
117
- </div>
118
- </div>
119
- `;
120
- }
121
- }
122
-
123
- window.customElements.define('gv-vertical-menu', GvVerticalMenu);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvVerticalMenu=void 0;const e=require("lit");require("../molecules/gv-nav"),require("../atoms/gv-image");const t=require("../lib/utils");class i extends e.LitElement{static get properties(){return{routes:{type:Array},_routes:{type:Array,attribute:!1},logo:{type:String}}}static get styles(){return[e.css`:host{--gv-link--c:var(--gv-menu--c, var(--gv-theme-font-color-light, #ffffff));--gv-link-active--c:var(--gv-menu--c, var(--gv-theme-font-color-light, #ffffff));--gv-link--bgc:var(--gv-menu-link--bgc, transparent);--gv-link-active--bgc:var(--gv-menu-link-active--bgc, transparent);--gv-link-active--bdw:var(--gv-menu-link-active--bdw, 0 0 0 4px);--gv-link-active--bdc:var(--gv-menu-link-active--bdc, var(--gv-theme-color-light, #86c3d0));--gv-link-active--bds:var(--gv-menu-link-active--bds, solid);--pr:var(--gv-theme-layout--pr, 4rem);--pl:var(--gv-theme-layout--pl, 4rem);box-sizing:border-box;display:block;font-size:var(--gv-theme-font-size-s,16px);width:var(--gv-theme-layout-menu-w,200px)}.menu-container{display:flex;flex-direction:column;justify-content:space-between;background-color:var(--gv-menu--bgc,var(--gv-theme-color-dark,#28444f));color:var(--gv-menu--c,var(--gv-theme-font-color-light,#fff))}gv-image{height:200px;width:200px}gv-nav{transition:width 250ms ease-in-out;display:flex;flex-direction:column;justify-content:space-between;line-height:20px;vertical-align:middle;width:100%;font-size:16px}`]}constructor(){super(),this._routes=[]}set routes(e){e?Promise.resolve(e).then((e=>{e?Promise.all(e).then((e=>{(0,t.isSameRoutes)(this._routes,e)||(this._routes=e.filter((e=>null!=e)))})):this._routes=null})):this._routes=null}render(){return e.html`<div class="menu-container">${this.logo?e.html`<gv-image .src="${this.logo}"></gv-image>`:""}<div class="nav-container"><gv-nav .routes="${this._routes}" vertical></gv-nav></div></div>`}}exports.GvVerticalMenu=i,window.customElements.define("gv-vertical-menu",i);