@gravitee/ui-components 3.25.3-typescript-8a53edf → 3.25.3-typescript-9a4271f

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 +1 -1
  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,243 +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 { classMap } from 'lit/directives/class-map';
17
- import { ifDefined } from 'lit/directives/if-defined';
18
-
19
- import { LitElement, html, css } from 'lit';
20
- import { skeleton } from '../styles/skeleton';
21
- import { dispatchCustomEvent } from '../lib/events';
22
-
23
- /**
24
- * A wrapper of a <switch> component.
25
- *
26
- * ## Details
27
- * * has @theme facet
28
- *
29
- * @fires gv-switch:input - mirrors native input events with the `value` on `detail`
30
- *
31
- * @attr {Boolean} disabled - same as native switch element `disabled` attribute
32
- * @attr {Boolean} skeleton - enable skeleton screen UI pattern (loading hint)
33
- * @attr {Boolean|String} value - true if the switch is checked, false otherwise
34
- * @attr {String} label - label of the switch
35
- * @attr {String} description - description of the switch
36
- * @attr {Boolean} checked - same as native switch element `checked` attribute
37
- * @attr {Boolean} readonly - true if readonly
38
- *
39
- * @cssprop {Color} [--gv-switch-on--bgc=var(--gv-theme-color, #5a7684)] - On background color
40
- * @cssprop {Color} [--gv-switch-off--bgc=var(--gv-theme-neutral-color-dark, #bfbfbf)] - Off background color
41
- * @cssprop {Color} [--gv-switch--bgc=var(--gv-theme-neutral-color-lightest, #ffffff)] - Switch background color
42
- * @cssprop {String} [--gv-switch--ta=left] - Switch label text alignment
43
- */
44
- export class GvSwitch extends LitElement {
45
- static get properties() {
46
- return {
47
- disabled: { type: Boolean, reflect: true },
48
- skeleton: { type: Boolean },
49
- value: { type: String, reflect: true },
50
- label: { type: String },
51
- description: { type: String },
52
- small: { type: Boolean, reflect: true },
53
- checked: { type: Boolean, reflect: true },
54
- readonly: { type: Boolean, reflect: true },
55
- };
56
- }
57
-
58
- static get styles() {
59
- return [
60
- skeleton,
61
- // language=CSS
62
- css`
63
- :host {
64
- --off-bgc: var(--gv-switch-off--bgc, var(--gv-theme-neutral-color-dark, #bfbfbf));
65
- --on-bgc: var(--gv-switch-on--bgc, var(--gv-theme-color, #5a7684));
66
- box-sizing: border-box;
67
- margin: 0.2rem;
68
- }
69
-
70
- .container {
71
- display: flex;
72
- }
73
-
74
- .labels {
75
- display: flex;
76
- flex-direction: column;
77
- justify-content: center;
78
- flex: 1;
79
- margin-right: 0.4rem;
80
- box-sizing: border-box;
81
- text-align: var(--gv-switch--ta, left);
82
- }
83
-
84
- .switch-title {
85
- font-weight: 600;
86
- }
87
-
88
- .switch-description {
89
- opacity: 0.6;
90
- }
91
-
92
- .switch-container {
93
- display: flex;
94
- align-items: center;
95
- }
96
-
97
- .switch {
98
- position: relative;
99
- width: 40px;
100
- -webkit-user-select: none;
101
- -moz-user-select: none;
102
- -ms-user-select: none;
103
- border-radius: 16px;
104
- }
105
-
106
- :host([small]) .switch {
107
- width: 25px;
108
- }
109
-
110
- :host([small]) .switch-label:before {
111
- width: 10px;
112
- border-radius: 10px;
113
- right: 10px;
114
- }
115
-
116
- :host([small]) .switch-label {
117
- height: 10px;
118
- line-height: 10px;
119
- border-radius: 10px;
120
- }
121
-
122
- :host([small]) .switch-title {
123
- font-weight: 400;
124
- font-size: 11px;
125
- }
126
-
127
- .switch input {
128
- display: none;
129
- }
130
-
131
- .switch-label {
132
- display: block;
133
- overflow: hidden;
134
- cursor: pointer;
135
- height: 16px;
136
- padding: 0;
137
- line-height: 16px;
138
- border: 2px solid transparent;
139
- border-radius: 16px;
140
- background-color: var(--off-bgc);
141
- transition: background-color 0.3s ease-in;
142
- }
143
-
144
- .switch-label:before {
145
- content: '';
146
- display: block;
147
- width: 16px;
148
- margin: 0;
149
- background: var(--gv-switch--bgc, var(--gv-theme-neutral-color-lightest, #ffffff));
150
- position: absolute;
151
- top: 0;
152
- bottom: 0;
153
- right: 20px;
154
- border: 2px solid var(--off-bgc);
155
- border-radius: 16px;
156
- transition: all 0.3s ease-in 0s;
157
- }
158
-
159
- :host([checked]) .switch-label {
160
- background-color: var(--on-bgc);
161
- }
162
-
163
- :host([checked]) .switch-label,
164
- :host([checked]) .switch-label:before {
165
- border-color: var(--on-bgc);
166
- }
167
-
168
- :host([checked]) .switch-label:before {
169
- right: 0;
170
- }
171
-
172
- :host([disabled]) .switch-label,
173
- :host([readonly]) .switch-label {
174
- cursor: default;
175
- }
176
-
177
- :host([disabled]) .switch-label {
178
- opacity: 0.5;
179
- }
180
- `,
181
- ];
182
- }
183
-
184
- constructor() {
185
- super();
186
- this._id = 'gv-id';
187
- this.checked = false;
188
- }
189
-
190
- _onInput() {
191
- if (!(this.disabled || this.skeleton || this.readonly)) {
192
- this.value = !this.checked;
193
- dispatchCustomEvent(this, 'input', this.value);
194
- }
195
- }
196
-
197
- updated(_changedProperties) {
198
- super.updated(_changedProperties);
199
- if (_changedProperties.has('value')) {
200
- if (this.value != null && this.value.toString() === 'true') {
201
- this.checked = true;
202
- } else {
203
- this.checked = false;
204
- }
205
- }
206
- }
207
-
208
- render() {
209
- const classes = {
210
- skeleton: this.skeleton,
211
- disabled: this.disabled,
212
- small: this.small,
213
- switch: true,
214
- };
215
-
216
- return html`
217
- <div class="container">
218
- ${this.label || this.description
219
- ? html`<div class="${classMap({ labels: true, skeleton: this.skeleton })}">
220
- ${this.label ? html`<label class="switch-title">${this.label}</label>` : ''}
221
- ${this.description ? html`<label class="switch-description" .innerHTML="${this.description}"></label>` : ''}
222
- </div>`
223
- : ''}
224
- <div class="switch-container">
225
- <div class=${classMap(classes)}>
226
- <input
227
- id=${this._id}
228
- type="checkbox"
229
- .title=${ifDefined(this.label || this.description)}
230
- ?disabled=${this.disabled || this.skeleton}
231
- ?readonly="${this.readonly}"
232
- ?checked=${this.checked}
233
- @input=${this._onInput}
234
- />
235
- <label class="switch-label" for="${this._id}"></label>
236
- </div>
237
- </div>
238
- </div>
239
- `;
240
- }
241
- }
242
-
243
- window.customElements.define('gv-switch', GvSwitch);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvSwitch=void 0;const e=require("lit/directives/class-map"),t=require("lit/directives/if-defined"),i=require("lit"),s=require("../styles/skeleton"),l=require("../lib/events");class o extends i.LitElement{static get properties(){return{disabled:{type:Boolean,reflect:!0},skeleton:{type:Boolean},value:{type:String,reflect:!0},label:{type:String},description:{type:String},small:{type:Boolean,reflect:!0},checked:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0}}}static get styles(){return[s.skeleton,i.css`:host{--off-bgc:var(--gv-switch-off--bgc, var(--gv-theme-neutral-color-dark, #bfbfbf));--on-bgc:var(--gv-switch-on--bgc, var(--gv-theme-color, #5a7684));box-sizing:border-box;margin:.2rem}.container{display:flex}.labels{display:flex;flex-direction:column;justify-content:center;flex:1;margin-right:.4rem;box-sizing:border-box;text-align:var(--gv-switch--ta,left)}.switch-title{font-weight:600}.switch-description{opacity:.6}.switch-container{display:flex;align-items:center}.switch{position:relative;width:40px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;border-radius:16px}:host([small]) .switch{width:25px}:host([small]) .switch-label:before{width:10px;border-radius:10px;right:10px}:host([small]) .switch-label{height:10px;line-height:10px;border-radius:10px}:host([small]) .switch-title{font-weight:400;font-size:11px}.switch input{display:none}.switch-label{display:block;overflow:hidden;cursor:pointer;height:16px;padding:0;line-height:16px;border:2px solid transparent;border-radius:16px;background-color:var(--off-bgc);transition:background-color .3s ease-in}.switch-label:before{content:'';display:block;width:16px;margin:0;background:var(--gv-switch--bgc,var(--gv-theme-neutral-color-lightest,#fff));position:absolute;top:0;bottom:0;right:20px;border:2px solid var(--off-bgc);border-radius:16px;transition:all .3s ease-in 0s}:host([checked]) .switch-label{background-color:var(--on-bgc)}:host([checked]) .switch-label,:host([checked]) .switch-label:before{border-color:var(--on-bgc)}:host([checked]) .switch-label:before{right:0}:host([disabled]) .switch-label,:host([readonly]) .switch-label{cursor:default}:host([disabled]) .switch-label{opacity:.5}`]}constructor(){super(),this._id="gv-id",this.checked=!1}_onInput(){this.disabled||this.skeleton||this.readonly||(this.value=!this.checked,(0,l.dispatchCustomEvent)(this,"input",this.value))}updated(e){super.updated(e),e.has("value")&&(null!=this.value&&"true"===this.value.toString()?this.checked=!0:this.checked=!1)}render(){const s={skeleton:this.skeleton,disabled:this.disabled,small:this.small,switch:!0};return i.html`<div class="container">${this.label||this.description?i.html`<div class="${(0,e.classMap)({labels:!0,skeleton:this.skeleton})}">${this.label?i.html`<label class="switch-title">${this.label}</label>`:""} ${this.description?i.html`<label class="switch-description" .innerHTML="${this.description}"></label>`:""}</div>`:""}<div class="switch-container"><div class="${(0,e.classMap)(s)}"><input id="${this._id}" type="checkbox" .title="${(0,t.ifDefined)(this.label||this.description)}" ?disabled="${this.disabled||this.skeleton}" ?readonly="${this.readonly}" ?checked="${this.checked}" @input="${this._onInput}"> <label class="switch-label" for="${this._id}"></label></div></div></div>`}}exports.GvSwitch=o,window.customElements.define("gv-switch",o);
@@ -1,168 +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 { classMap } from 'lit/directives/class-map';
17
- import { LitElement, html, css } from 'lit';
18
- import { skeleton } from '../styles/skeleton';
19
- import { link } from '../styles/link';
20
- import './gv-icon';
21
- import { dispatchCustomEvent } from '../lib/events';
22
-
23
- /**
24
- * A Tag
25
- *
26
- * ## Details
27
- * * has @theme facet
28
- *
29
- * @fires click - Native click event
30
- *
31
- * @slot - The content of the tag (text or HTML)
32
- *
33
- * @attr {String} icon - name of shape
34
- * @attr {String} icon-right - name of shape
35
- * @attr {Boolean} major - set tag UI as major
36
- * @attr {Boolean} minor - set tag UI as minor
37
- * @attr {Boolean} skeleton - enable skeleton screen UI pattern (loading hint)
38
- * @attr {Boolean} clickable - If true, tag has link style
39
- *
40
- * @cssprop {Length} [--gv-tag--fz=var(--gv-theme-font-size-s, 12px)] - Font size
41
- * @cssprop {Length} [--gv-tag--p=4px 8px] - Padding
42
- * @cssprop {Length} [--gv-tag--bdr=4px] - Border radius
43
- * @cssprop {String} [--gv-tag--bsw=none] - Box shadow
44
- *
45
- * @cssprop {Color} [--gv-tag--bgc=var(--gv-theme-neutral-color-lighter, #fafafa)] - Background color
46
- * @cssprop {Color} [--gv-tag-major--bgc=var(--gv-theme-color, #5a7684)] - Major background color
47
- * @cssprop {Color} [--gv-tag-minor--bgc=var(--gv-theme-neutral-color-lightest, #ffffff)] - Minor background color
48
- *
49
- * @cssprop {Color} [--gv-tag--bdc=var(--gv-theme-neutral-color-dark, #d9d9d9)] - Border color
50
- * @cssprop {Color} [--gv-tag-major--bdc=var(--gv-theme-color, #5a7684)] - Major border color
51
- * @cssprop {Color} [--gv-tag-minor--bdc=var(--gv-theme-neutral-color-dark, #d9d9d9)] - Minor border color
52
-
53
- * @cssprop {String} [--gv-tag--bds=solid] - Border style
54
- * @cssprop {String} [--gv-tag-major--bds=solid] - Major border style
55
- * @cssprop {String} [--gv-tag-minor--bds=dashed] - Minor border style
56
- *
57
- * @cssprop {Length} [--gv-tag--bdw=1px] - Border width
58
- * @cssprop {Length} [--gv-tag-major--bdw=1px] - Major border width
59
- * @cssprop {Length} [--gv-tag-minor--bdw=1px] - Minor border width
60
- *
61
- * @cssprop {Color} [--gv-tag--c=var(--gv-theme-font-color-dark, #262626)] - Color
62
- * @cssprop {Color} [--gv-tag-major--c=var(--gv-theme-font-color-light, #ffffff)] - Major color
63
- * @cssprop {Color} [--gv-tag-minor--c=var(--gv-theme-font-color-dark, #262626)] - Minor color
64
- * @cssprop {Length} [--gv-tag-icon--s=18px] - Height and icon width
65
- */
66
- export class GvTag extends LitElement {
67
- static get properties() {
68
- return {
69
- icon: { type: String },
70
- iconRight: { type: String, attribute: 'icon-right' },
71
- major: { type: Boolean },
72
- minor: { type: Boolean },
73
- skeleton: { type: Boolean },
74
- clickable: { type: Boolean },
75
- };
76
- }
77
-
78
- static get styles() {
79
- return [
80
- skeleton,
81
- link,
82
- // language=CSS
83
- css`
84
- :host {
85
- box-sizing: border-box;
86
- display: inline-block;
87
- margin: 0.2rem;
88
- vertical-align: middle;
89
- }
90
-
91
- div.default {
92
- --bgc: var(--gv-tag--bgc, var(--gv-theme-neutral-color-lighter, #fafafa));
93
- --bdc: var(--gv-tag--bdc, var(--gv-theme-neutral-color-dark, #d9d9d9));
94
- --bds: var(--gv-tag--bds, solid);
95
- --bdw: var(--gv-tag--bdw, 1px);
96
- --c: var(--gv-tag--c, var(--gv-theme-font-color-dark, #262626));
97
- }
98
-
99
- div.major {
100
- --bgc: var(--gv-tag-major--bgc, var(--gv-theme-color, #5a7684));
101
- --bdc: var(--gv-tag-major--bdc, var(--gv-theme-color, #5a7684));
102
- --bds: var(--gv-tag-major--bds, solid);
103
- --bdw: var(--gv-tag-major--bdw, 1px);
104
- --c: var(--gv-tag-major--c, var(--gv-theme-font-color-light, #ffffff));
105
- }
106
-
107
- div.minor {
108
- --bgc: var(--gv-tag-minor--bgc, var(--gv-theme-neutral-color-lightest, #ffffff));
109
- --bdc: var(--gv-tag-minor--bdc, var(--gv-theme-neutral-color-dark, #d9d9d9));
110
- --bds: var(--gv-tag-minor--bds, dashed);
111
- --bdw: var(--gv-tag-minor--bdw, 1px);
112
- --c: var(--gv-tag-minor--c, var(--gv-theme-font-color-dark, #262626));
113
- }
114
-
115
- div {
116
- background-color: var(--bgc);
117
- border-color: var(--bdc);
118
- border-radius: var(--gv-tag--bdr, 4px);
119
- border-style: var(--bds);
120
- border-width: var(--bdw);
121
- box-shadow: var(--gv-tag--bsw, none);
122
- color: var(--c);
123
- --fz: var(--gv-tag--fz, var(--gv-theme-font-size-s, 12px));
124
- font-size: var(--fz);
125
- line-height: var(--fz);
126
- padding: var(--gv-tag--p, 4px 8px);
127
- --gv-icon--s: var(--gv-tag-icon--s, 18px);
128
- --gv-icon--c: var(--c);
129
- --gv-icon-opacity--c: var(--c);
130
-
131
- word-break: normal;
132
- }
133
-
134
- div > * {
135
- vertical-align: middle;
136
- display: inline-flex;
137
- }
138
- `,
139
- ];
140
- }
141
-
142
- _onTagClick(e) {
143
- if (this.clickable) {
144
- e.stopPropagation();
145
- dispatchCustomEvent(this, 'click', {});
146
- }
147
- }
148
-
149
- render() {
150
- const modes = {
151
- default: !this.major && !this.minor,
152
- major: this.major,
153
- minor: this.minor && !this.major,
154
- skeleton: this.skeleton,
155
- link: this.clickable,
156
- };
157
-
158
- return html`
159
- <div class=${classMap(modes)} @click="${this._onTagClick}">
160
- ${this.icon ? html`<gv-icon shape="${this.icon}"></gv-icon>` : ''}<slot></slot>${this.iconRight
161
- ? html`<gv-icon shape="${this.iconRight}"></gv-icon>`
162
- : ''}
163
- </div>
164
- `;
165
- }
166
- }
167
-
168
- window.customElements.define('gv-tag', GvTag);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvTag=void 0;const r=require("lit/directives/class-map"),a=require("lit"),t=require("../styles/skeleton"),e=require("../styles/link");require("./gv-icon");const o=require("../lib/events");class i extends a.LitElement{static get properties(){return{icon:{type:String},iconRight:{type:String,attribute:"icon-right"},major:{type:Boolean},minor:{type:Boolean},skeleton:{type:Boolean},clickable:{type:Boolean}}}static get styles(){return[t.skeleton,e.link,a.css`:host{box-sizing:border-box;display:inline-block;margin:.2rem;vertical-align:middle}div.default{--bgc:var(--gv-tag--bgc, var(--gv-theme-neutral-color-lighter, #fafafa));--bdc:var(--gv-tag--bdc, var(--gv-theme-neutral-color-dark, #d9d9d9));--bds:var(--gv-tag--bds, solid);--bdw:var(--gv-tag--bdw, 1px);--c:var(--gv-tag--c, var(--gv-theme-font-color-dark, #262626))}div.major{--bgc:var(--gv-tag-major--bgc, var(--gv-theme-color, #5a7684));--bdc:var(--gv-tag-major--bdc, var(--gv-theme-color, #5a7684));--bds:var(--gv-tag-major--bds, solid);--bdw:var(--gv-tag-major--bdw, 1px);--c:var(--gv-tag-major--c, var(--gv-theme-font-color-light, #ffffff))}div.minor{--bgc:var(--gv-tag-minor--bgc, var(--gv-theme-neutral-color-lightest, #ffffff));--bdc:var(--gv-tag-minor--bdc, var(--gv-theme-neutral-color-dark, #d9d9d9));--bds:var(--gv-tag-minor--bds, dashed);--bdw:var(--gv-tag-minor--bdw, 1px);--c:var(--gv-tag-minor--c, var(--gv-theme-font-color-dark, #262626))}div{background-color:var(--bgc);border-color:var(--bdc);border-radius:var(--gv-tag--bdr,4px);border-style:var(--bds);border-width:var(--bdw);box-shadow:var(--gv-tag--bsw,none);color:var(--c);--fz:var(--gv-tag--fz, var(--gv-theme-font-size-s, 12px));font-size:var(--fz);line-height:var(--fz);padding:var(--gv-tag--p,4px 8px);--gv-icon--s:var(--gv-tag-icon--s, 18px);--gv-icon--c:var(--c);--gv-icon-opacity--c:var(--c);word-break:normal}div>*{vertical-align:middle;display:inline-flex}`]}_onTagClick(r){this.clickable&&(r.stopPropagation(),(0,o.dispatchCustomEvent)(this,"click",{}))}render(){const t={default:!this.major&&!this.minor,major:this.major,minor:this.minor&&!this.major,skeleton:this.skeleton,link:this.clickable};return a.html`<div class="${(0,r.classMap)(t)}" @click="${this._onTagClick}">${this.icon?a.html`<gv-icon shape="${this.icon}"></gv-icon>`:""}<slot></slot>${this.iconRight?a.html`<gv-icon shape="${this.iconRight}"></gv-icon>`:""}</div>`}}exports.GvTag=i,window.customElements.define("gv-tag",i);
@@ -1,168 +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 { classMap } from 'lit/directives/class-map';
17
- import { ifDefined } from 'lit/directives/if-defined';
18
- import { LitElement, css, html } from 'lit';
19
- import { skeleton } from '../styles/skeleton';
20
- import { dispatchCustomEvent } from '../lib/events';
21
- import { InputElement } from '../mixins/input-element';
22
-
23
- /**
24
- * A wrapper of a <text> component.
25
- *
26
- * ## Details
27
- * * has @theme facet
28
- *
29
- * @fires gv-text:input - mirrors native textarea events with the `value` on `detail`
30
- *
31
- * @attr {Boolean} disabled - same as native text element `disabled` attribute
32
- * @attr {Boolean} required - same as native text element `required` attribute
33
- * @attr {Boolean} skeleton - enable skeleton screen UI pattern (loading hint)
34
- * @attr {String} value - the value of the text
35
- * @attr {String} label - label of the text
36
- * @attr {String} title - title of the text
37
- * @attr {String} name - name of the text
38
- * @attr {String} placeholder - an example value to display in the text when empty
39
- * @attr {Length} rows - number of rows of the text element
40
- * @attr {Boolean} autofocus - true to put the focus on the input
41
- * @attr {Boolean} [readonly=false] - true if field is readonly mode
42
- * @attr {Boolean} [autosize=false] - true if field auto resize when content change
43
- *
44
- * @cssprop {Color} [--gv-input--bdc=var(--gv-theme-neutral-color-dark, #d9d9d9)] - Border color
45
- * @cssprop {Length} [--gv-text--fz=var(--gv-theme-font-size-m, 14px)] - Font size
46
- * @cssprop {Length} [--gv-text--lh=var(--gv-theme-font-size-m, 14px)] - Line height
47
- */
48
- export class GvText extends InputElement(LitElement) {
49
- static get properties() {
50
- return {
51
- rows: { type: Number },
52
- minlength: { type: Number },
53
- maxlength: { type: Number },
54
- autosize: { type: Boolean },
55
- };
56
- }
57
-
58
- static get styles() {
59
- return [
60
- ...super.styles,
61
- skeleton,
62
- // language=CSS
63
- css`
64
- .box {
65
- position: relative;
66
- line-height: 0;
67
- }
68
-
69
- /* BASE */
70
- .textarea {
71
- --fz: var(--gv-text--fz, var(--gv-theme-font-size-m, 14px));
72
- --tmp: var(--gv-text--lh, var(--gv-theme-font-size-m, 14px));
73
- --lh: calc(var(--tmp) + 3px);
74
- border: 1px solid var(--gv-input--bdc, var(--gv-theme-neutral-color-dark, #d9d9d9));
75
- box-sizing: border-box;
76
- border-radius: 4px;
77
- outline: none;
78
- padding: 10px 5px;
79
- width: 100%;
80
- resize: none;
81
- font-size: var(--fz);
82
- line-height: var(--lh);
83
- }
84
-
85
- div.textarea {
86
- white-space: pre;
87
- }
88
-
89
- textarea:disabled {
90
- cursor: default;
91
- opacity: 0.5;
92
- }
93
-
94
- textarea:required {
95
- box-shadow: none;
96
- }
97
-
98
- label {
99
- display: block;
100
- line-height: 15px;
101
- padding: 0 0 0.2rem 0;
102
- }
103
-
104
- /* Hack for FF */
105
- textarea {
106
- font-family: inherit;
107
- }
108
- `,
109
- ];
110
- }
111
-
112
- constructor() {
113
- super();
114
- this.rows = 10;
115
- }
116
-
117
- getInputElement() {
118
- return this.shadowRoot.querySelector('textarea');
119
- }
120
-
121
- _onInput(e) {
122
- this.updateState(e.target.value);
123
- this.value = e.target.value;
124
- dispatchCustomEvent(this, 'input', this.value);
125
- }
126
-
127
- render() {
128
- const classes = {
129
- skeleton: this.skeleton,
130
- required: this.required,
131
- textarea: true,
132
- };
133
-
134
- if (this.readonly) {
135
- if (this.value || this.value.trim() !== '') {
136
- return html`
137
- ${this.renderLabel()}
138
- <div class="${classMap(classes)}" .title=${ifDefined(this.title || this.label)}>${ifDefined(this.value)}</div>
139
- `;
140
- }
141
- return '';
142
- }
143
- const rows = this.autosize && this.value ? this.value.split('\n').length : this.rows;
144
- return html`
145
- <div class="box">
146
- ${this.renderLabel()}
147
- <textarea
148
- class="${classMap(classes)}"
149
- id=${this._id}
150
- .name=${ifDefined(this.name)}
151
- .title=${ifDefined(this.title || this.label)}
152
- .required=${this.required}
153
- ?readonly="${this.readonly}"
154
- maxlength="${this.maxlength}"
155
- minlength="${this.minlength}"
156
- aria-required=${!!this.required}
157
- ?disabled=${this.disabled || this.skeleton}
158
- .placeholder=${ifDefined(this.placeholder)}
159
- .value=${ifDefined(this.value)}
160
- rows="${this.rows < rows ? rows : this.rows}"
161
- @input=${this._onInput}
162
- ></textarea>
163
- </div>
164
- `;
165
- }
166
- }
167
-
168
- window.customElements.define('gv-text', GvText);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvText=void 0;const e=require("lit/directives/class-map"),t=require("lit/directives/if-defined"),i=require("lit"),r=require("../styles/skeleton"),s=require("../lib/events"),a=require("../mixins/input-element");class l extends((0,a.InputElement)(i.LitElement)){static get properties(){return{rows:{type:Number},minlength:{type:Number},maxlength:{type:Number},autosize:{type:Boolean}}}static get styles(){return[...super.styles,r.skeleton,i.css`.box{position:relative;line-height:0}.textarea{--fz:var(--gv-text--fz, var(--gv-theme-font-size-m, 14px));--tmp:var(--gv-text--lh, var(--gv-theme-font-size-m, 14px));--lh:calc(var(--tmp) + 3px);border:1px solid var(--gv-input--bdc,var(--gv-theme-neutral-color-dark,#d9d9d9));box-sizing:border-box;border-radius:4px;outline:0;padding:10px 5px;width:100%;resize:none;font-size:var(--fz);line-height:var(--lh)}div.textarea{white-space:pre}textarea:disabled{cursor:default;opacity:.5}textarea:required{box-shadow:none}label{display:block;line-height:15px;padding:0 0 .2rem 0}textarea{font-family:inherit}`]}constructor(){super(),this.rows=10}getInputElement(){return this.shadowRoot.querySelector("textarea")}_onInput(e){this.updateState(e.target.value),this.value=e.target.value,(0,s.dispatchCustomEvent)(this,"input",this.value)}render(){const r={skeleton:this.skeleton,required:this.required,textarea:!0};if(this.readonly)return this.value||""!==this.value.trim()?i.html`${this.renderLabel()}<div class="${(0,e.classMap)(r)}" .title="${(0,t.ifDefined)(this.title||this.label)}">${(0,t.ifDefined)(this.value)}</div>`:"";const s=this.autosize&&this.value?this.value.split("\n").length:this.rows;return i.html`<div class="box">${this.renderLabel()} <textarea class="${(0,e.classMap)(r)}" id="${this._id}" .name="${(0,t.ifDefined)(this.name)}" .title="${(0,t.ifDefined)(this.title||this.label)}" .required="${this.required}" ?readonly="${this.readonly}" maxlength="${this.maxlength}" minlength="${this.minlength}" aria-required="${!!this.required}" ?disabled="${this.disabled||this.skeleton}" .placeholder="${(0,t.ifDefined)(this.placeholder)}" .value="${(0,t.ifDefined)(this.value)}" rows="${this.rows<s?s:this.rows}" @input="${this._onInput}"></textarea></div>`}}exports.GvText=l,window.customElements.define("gv-text",l);