@gravitee/ui-components 3.25.3-typescript-8a53edf → 3.25.3-typescript-e7256ca
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -4
- package/src/atoms/gv-autocomplete.d.ts +104 -0
- package/src/atoms/gv-autocomplete.js +1 -461
- package/src/atoms/gv-button.d.ts +109 -0
- package/src/atoms/gv-button.js +1 -410
- package/src/atoms/gv-checkbox.d.ts +114 -0
- package/src/atoms/gv-checkbox.js +1 -187
- package/src/atoms/gv-date-picker-calendar.d.ts +190 -0
- package/src/atoms/gv-date-picker-calendar.js +1 -894
- package/src/atoms/gv-date-picker-cell.d.ts +80 -0
- package/src/atoms/gv-date-picker-cell.js +1 -190
- package/src/atoms/gv-date-picker.d.ts +194 -0
- package/src/atoms/gv-date-picker.js +1 -671
- package/src/atoms/gv-file-upload.d.ts +64 -0
- package/src/atoms/gv-file-upload.js +1 -367
- package/src/atoms/gv-icon.d.ts +26 -0
- package/src/atoms/gv-icon.js +1 -103
- package/src/atoms/gv-image.d.ts +45 -0
- package/src/atoms/gv-image.js +1 -144
- package/src/atoms/gv-input-message.d.ts +20 -0
- package/src/atoms/gv-input-message.js +1 -84
- package/src/atoms/gv-input.d.ts +246 -0
- package/src/atoms/gv-input.js +1 -561
- package/src/atoms/gv-link.d.ts +67 -0
- package/src/atoms/gv-link.js +1 -210
- package/src/atoms/gv-message.d.ts +23 -0
- package/src/atoms/gv-message.js +1 -128
- package/src/atoms/gv-metric.d.ts +32 -0
- package/src/atoms/gv-metric.js +1 -117
- package/src/atoms/gv-relative-time.d.ts +45 -0
- package/src/atoms/gv-relative-time.js +1 -156
- package/src/atoms/gv-select-native.d.ts +174 -0
- package/src/atoms/gv-select-native.js +1 -388
- package/src/atoms/gv-select.d.ts +71 -0
- package/src/atoms/gv-select.js +1 -437
- package/src/atoms/gv-spinner.d.ts +10 -0
- package/src/atoms/gv-spinner.js +1 -57
- package/src/atoms/gv-state.d.ts +50 -0
- package/src/atoms/gv-state.js +1 -130
- package/src/atoms/gv-switch.d.ts +60 -0
- package/src/atoms/gv-switch.js +1 -243
- package/src/atoms/gv-tag.d.ts +69 -0
- package/src/atoms/gv-tag.js +1 -168
- package/src/atoms/gv-text.d.ts +110 -0
- package/src/atoms/gv-text.js +1 -168
- package/src/charts/gv-chart-bar.d.ts +50 -0
- package/src/charts/gv-chart-bar.js +1 -103
- package/src/charts/gv-chart-gauge.d.ts +58 -0
- package/src/charts/gv-chart-gauge.js +1 -100
- package/src/charts/gv-chart-histogram.d.ts +48 -0
- package/src/charts/gv-chart-histogram.js +1 -83
- package/src/charts/gv-chart-line.d.ts +52 -0
- package/src/charts/gv-chart-line.js +1 -224
- package/src/charts/gv-chart-map.d.ts +50 -0
- package/src/charts/gv-chart-map.js +1 -112
- package/src/charts/gv-chart-pie.d.ts +50 -0
- package/src/charts/gv-chart-pie.js +1 -91
- package/src/index.d.ts +77 -0
- package/src/index.js +1 -77
- package/src/lib/cron-expression.d.ts +1 -0
- package/src/lib/cron-expression.js +1 -205
- package/src/lib/date.d.ts +1 -0
- package/src/lib/date.js +1 -44
- package/src/lib/events.d.ts +1 -0
- package/src/lib/events.js +1 -26
- package/src/lib/http-client-schema-form.d.ts +68 -0
- package/src/lib/http-client-schema-form.js +1 -67
- package/src/lib/http.d.ts +222 -0
- package/src/lib/http.js +1 -237
- package/src/lib/i18n.d.ts +30 -0
- package/src/lib/i18n.js +1 -103
- package/src/lib/item.d.ts +12 -0
- package/src/lib/item.js +1 -118
- package/src/lib/properties.d.ts +42 -0
- package/src/lib/properties.js +1 -189
- package/src/lib/schema-form.d.ts +5 -0
- package/src/lib/schema-form.js +1 -44
- package/src/lib/studio.d.ts +2 -0
- package/src/lib/studio.js +1 -141
- package/src/lib/style.d.ts +6 -0
- package/src/lib/style.js +1 -41
- package/src/lib/text-format.d.ts +6 -0
- package/src/lib/text-format.js +1 -69
- package/src/lib/theme.d.ts +4 -0
- package/src/lib/theme.js +1 -63
- package/src/lib/utils.d.ts +9 -0
- package/src/lib/utils.js +1 -111
- package/src/mixins/chart-element.d.ts +39 -0
- package/src/mixins/chart-element.js +1 -165
- package/src/mixins/input-element.d.ts +64 -0
- package/src/mixins/input-element.js +1 -144
- package/src/mixins/item-resource.d.ts +56 -0
- package/src/mixins/item-resource.js +1 -120
- package/src/mixins/keyboard-element.d.ts +25 -0
- package/src/mixins/keyboard-element.js +1 -69
- package/src/mixins/update-after-browser.d.ts +11 -0
- package/src/mixins/update-after-browser.js +1 -30
- package/src/mixins/with-resize-observer.d.ts +12 -0
- package/src/mixins/with-resize-observer.js +1 -68
- package/src/mixins/with-skeleton-attribute.d.ts +35 -0
- package/src/mixins/with-skeleton-attribute.js +1 -112
- package/src/molecules/gv-card-full.d.ts +78 -0
- package/src/molecules/gv-card-full.js +1 -218
- package/src/molecules/gv-card-list.d.ts +33 -0
- package/src/molecules/gv-card-list.js +1 -113
- package/src/molecules/gv-card.d.ts +65 -0
- package/src/molecules/gv-card.js +1 -133
- package/src/molecules/gv-category-list.d.ts +17 -0
- package/src/molecules/gv-category-list.js +1 -60
- package/src/molecules/gv-category.d.ts +64 -0
- package/src/molecules/gv-category.js +1 -170
- package/src/molecules/gv-code.d.ts +192 -0
- package/src/molecules/gv-code.js +1 -359
- package/src/molecules/gv-confirm.d.ts +60 -0
- package/src/molecules/gv-confirm.js +1 -188
- package/src/molecules/gv-cron-editor.d.ts +115 -0
- package/src/molecules/gv-cron-editor.js +1 -710
- package/src/molecules/gv-dropdown-menu.d.ts +28 -0
- package/src/molecules/gv-dropdown-menu.js +1 -116
- package/src/molecules/gv-expandable.d.ts +37 -0
- package/src/molecules/gv-expandable.js +1 -122
- package/src/molecules/gv-expression-language.d.ts +150 -0
- package/src/molecules/gv-expression-language.js +1 -270
- package/src/molecules/gv-identity-picture.d.ts +44 -0
- package/src/molecules/gv-identity-picture.js +1 -148
- package/src/molecules/gv-list.d.ts +123 -0
- package/src/molecules/gv-list.js +1 -227
- package/src/molecules/gv-metrics.d.ts +65 -0
- package/src/molecules/gv-metrics.js +1 -162
- package/src/molecules/gv-modal.d.ts +64 -0
- package/src/molecules/gv-modal.js +1 -213
- package/src/molecules/gv-nav.d.ts +41 -0
- package/src/molecules/gv-nav.js +1 -196
- package/src/molecules/gv-option.d.ts +65 -0
- package/src/molecules/gv-option.js +1 -242
- package/src/molecules/gv-plans.d.ts +73 -0
- package/src/molecules/gv-plans.js +1 -429
- package/src/molecules/gv-popover.d.ts +91 -0
- package/src/molecules/gv-popover.js +1 -351
- package/src/molecules/gv-promote.d.ts +108 -0
- package/src/molecules/gv-promote.js +1 -209
- package/src/molecules/gv-rating-list.d.ts +77 -0
- package/src/molecules/gv-rating-list.js +1 -365
- package/src/molecules/gv-rating.d.ts +55 -0
- package/src/molecules/gv-rating.js +1 -253
- package/src/molecules/gv-row-expandable.d.ts +8 -0
- package/src/molecules/gv-row-expandable.js +1 -45
- package/src/molecules/gv-row.d.ts +37 -0
- package/src/molecules/gv-row.js +1 -210
- package/src/molecules/gv-stats.d.ts +53 -0
- package/src/molecules/gv-stats.js +1 -121
- package/src/molecules/gv-stepper.d.ts +46 -0
- package/src/molecules/gv-stepper.js +1 -288
- package/src/molecules/gv-table.d.ts +159 -0
- package/src/molecules/gv-table.js +1 -685
- package/src/molecules/gv-tree.d.ts +44 -0
- package/src/molecules/gv-tree.js +1 -250
- package/src/organisms/gv-documentation.d.ts +52 -0
- package/src/organisms/gv-documentation.js +1 -215
- package/src/organisms/gv-header.d.ts +60 -0
- package/src/organisms/gv-header.js +1 -288
- package/src/organisms/gv-http-client.d.ts +57 -0
- package/src/organisms/gv-http-client.js +1 -275
- package/src/organisms/gv-menu.d.ts +74 -0
- package/src/organisms/gv-menu.js +1 -263
- package/src/organisms/gv-newsletter-subscription.d.ts +82 -0
- package/src/organisms/gv-newsletter-subscription.js +1 -271
- package/src/organisms/gv-pagination.d.ts +63 -0
- package/src/organisms/gv-pagination.js +1 -198
- package/src/organisms/gv-properties.d.ts +229 -0
- package/src/organisms/gv-properties.js +1 -920
- package/src/organisms/gv-resizable-views.d.ts +33 -0
- package/src/organisms/gv-resizable-views.js +1 -396
- package/src/organisms/gv-resources.d.ts +125 -0
- package/src/organisms/gv-resources.js +1 -535
- package/src/organisms/gv-schema-form-array.d.ts +55 -0
- package/src/organisms/gv-schema-form-array.js +1 -250
- package/src/organisms/gv-schema-form-control-object.d.ts +64 -0
- package/src/organisms/gv-schema-form-control-object.js +1 -154
- package/src/organisms/gv-schema-form-control.d.ts +90 -0
- package/src/organisms/gv-schema-form-control.js +1 -443
- package/src/organisms/gv-schema-form.d.ts +156 -0
- package/src/organisms/gv-schema-form.js +1 -751
- package/src/organisms/gv-tabs.d.ts +56 -0
- package/src/organisms/gv-tabs.js +1 -210
- package/src/organisms/gv-user-menu.d.ts +56 -0
- package/src/organisms/gv-user-menu.js +1 -314
- package/src/organisms/gv-vertical-menu.d.ts +28 -0
- package/src/organisms/gv-vertical-menu.js +1 -123
- package/src/policy-studio/gv-flow-step.d.ts +142 -0
- package/src/policy-studio/gv-flow-step.js +1 -464
- package/src/policy-studio/gv-flow.d.ts +89 -0
- package/src/policy-studio/gv-flow.js +1 -621
- package/src/policy-studio/gv-policy-studio-menu.d.ts +94 -0
- package/src/policy-studio/gv-policy-studio-menu.js +1 -750
- package/src/policy-studio/gv-policy-studio.d.ts +464 -0
- package/src/policy-studio/gv-policy-studio.js +1 -1842
- package/src/styles/empty.d.ts +1 -0
- package/src/styles/empty.js +1 -36
- package/src/styles/input.d.ts +1 -0
- package/src/styles/input.js +1 -263
- package/src/styles/link.d.ts +1 -0
- package/src/styles/link.js +1 -32
- package/src/styles/shapes.d.ts +2 -0
- package/src/styles/shapes.js +1 -17
- package/src/styles/skeleton.d.ts +1 -0
- package/src/styles/skeleton.js +1 -53
- package/src/styles/zoom.d.ts +1 -0
- package/src/styles/zoom.js +1 -40
- package/src/theme/gv-theme.d.ts +81 -0
- package/src/theme/gv-theme.js +1 -203
- package/wc/gv-autocomplete.d.ts +1 -0
- package/wc/gv-autocomplete.js +1 -1
- package/wc/gv-button.d.ts +1 -0
- package/wc/gv-button.js +1 -1
- package/wc/gv-card-full.d.ts +1 -0
- package/wc/gv-card-full.js +1 -1
- package/wc/gv-card-list.d.ts +1 -0
- package/wc/gv-card-list.js +1 -1
- package/wc/gv-card.d.ts +1 -0
- package/wc/gv-card.js +1 -1
- package/wc/gv-category-list.d.ts +1 -0
- package/wc/gv-category-list.js +1 -1
- package/wc/gv-category.d.ts +1 -0
- package/wc/gv-category.js +1 -1
- package/wc/gv-chart-bar.d.ts +1 -0
- package/wc/gv-chart-bar.js +1 -1
- package/wc/gv-chart-gauge.d.ts +1 -0
- package/wc/gv-chart-gauge.js +1 -1
- package/wc/gv-chart-histogram.d.ts +1 -0
- package/wc/gv-chart-histogram.js +1 -1
- package/wc/gv-chart-line.d.ts +1 -0
- package/wc/gv-chart-line.js +1 -1
- package/wc/gv-chart-map.d.ts +1 -0
- package/wc/gv-chart-map.js +1 -1
- package/wc/gv-chart-pie.d.ts +1 -0
- package/wc/gv-chart-pie.js +1 -1
- package/wc/gv-checkbox.d.ts +1 -0
- package/wc/gv-checkbox.js +1 -1
- package/wc/gv-code.d.ts +1 -0
- package/wc/gv-code.js +1 -1
- package/wc/gv-confirm.d.ts +1 -0
- package/wc/gv-confirm.js +1 -1
- package/wc/gv-cron-editor.d.ts +1 -0
- package/wc/gv-cron-editor.js +1 -1
- package/wc/gv-date-picker-calendar.d.ts +1 -0
- package/wc/gv-date-picker-calendar.js +1 -1
- package/wc/gv-date-picker-cell.d.ts +1 -0
- package/wc/gv-date-picker-cell.js +1 -1
- package/wc/gv-date-picker.d.ts +1 -0
- package/wc/gv-date-picker.js +1 -1
- package/wc/gv-documentation.d.ts +1 -0
- package/wc/gv-documentation.js +1 -1
- package/wc/gv-dropdown-menu.d.ts +1 -0
- package/wc/gv-dropdown-menu.js +1 -1
- package/wc/gv-expandable.d.ts +1 -0
- package/wc/gv-expandable.js +1 -1
- package/wc/gv-expression-language.d.ts +1 -0
- package/wc/gv-expression-language.js +1 -1
- package/wc/gv-file-upload.d.ts +1 -0
- package/wc/gv-file-upload.js +1 -1
- package/wc/gv-flow-step.d.ts +1 -0
- package/wc/gv-flow-step.js +1 -1
- package/wc/gv-flow.d.ts +1 -0
- package/wc/gv-flow.js +1 -1
- package/wc/gv-header.d.ts +1 -0
- package/wc/gv-header.js +1 -1
- package/wc/gv-http-client.d.ts +1 -0
- package/wc/gv-http-client.js +1 -1
- package/wc/gv-icon.d.ts +1 -0
- package/wc/gv-icon.js +1 -1
- package/wc/gv-identity-picture.d.ts +1 -0
- package/wc/gv-identity-picture.js +1 -1
- package/wc/gv-image.d.ts +1 -0
- package/wc/gv-image.js +1 -1
- package/wc/gv-input-message.d.ts +1 -0
- package/wc/gv-input-message.js +1 -1
- package/wc/gv-input.d.ts +1 -0
- package/wc/gv-input.js +1 -1
- package/wc/gv-link.d.ts +1 -0
- package/wc/gv-link.js +1 -1
- package/wc/gv-list.d.ts +1 -0
- package/wc/gv-list.js +1 -1
- package/wc/gv-menu.d.ts +1 -0
- package/wc/gv-menu.js +1 -1
- package/wc/gv-message.d.ts +1 -0
- package/wc/gv-message.js +1 -1
- package/wc/gv-metric.d.ts +1 -0
- package/wc/gv-metric.js +1 -1
- package/wc/gv-metrics.d.ts +1 -0
- package/wc/gv-metrics.js +1 -1
- package/wc/gv-modal.d.ts +1 -0
- package/wc/gv-modal.js +1 -1
- package/wc/gv-nav.d.ts +1 -0
- package/wc/gv-nav.js +1 -1
- package/wc/gv-newsletter-subscription.d.ts +1 -0
- package/wc/gv-newsletter-subscription.js +1 -1
- package/wc/gv-option.d.ts +1 -0
- package/wc/gv-option.js +1 -1
- package/wc/gv-pagination.d.ts +1 -0
- package/wc/gv-pagination.js +1 -1
- package/wc/gv-plans.d.ts +1 -0
- package/wc/gv-plans.js +1 -1
- package/wc/gv-policy-studio-menu.d.ts +1 -0
- package/wc/gv-policy-studio-menu.js +1 -1
- package/wc/gv-policy-studio.d.ts +1 -0
- package/wc/gv-policy-studio.js +1 -1
- package/wc/gv-popover.d.ts +1 -0
- package/wc/gv-popover.js +1 -1
- package/wc/gv-promote.d.ts +1 -0
- package/wc/gv-promote.js +1 -1
- package/wc/gv-properties.d.ts +1 -0
- package/wc/gv-properties.js +1 -1
- package/wc/gv-rating-list.d.ts +1 -0
- package/wc/gv-rating-list.js +1 -1
- package/wc/gv-rating.d.ts +1 -0
- package/wc/gv-rating.js +1 -1
- package/wc/gv-relative-time.d.ts +1 -0
- package/wc/gv-relative-time.js +1 -1
- package/wc/gv-resizable-views.d.ts +1 -0
- package/wc/gv-resizable-views.js +1 -1
- package/wc/gv-resources.d.ts +1 -0
- package/wc/gv-resources.js +1 -1
- package/wc/gv-row-expandable.d.ts +1 -0
- package/wc/gv-row-expandable.js +1 -1
- package/wc/gv-row.d.ts +1 -0
- package/wc/gv-row.js +1 -1
- package/wc/gv-schema-form-array.d.ts +1 -0
- package/wc/gv-schema-form-array.js +1 -1
- package/wc/gv-schema-form-control-object.d.ts +1 -0
- package/wc/gv-schema-form-control-object.js +1 -1
- package/wc/gv-schema-form-control.d.ts +1 -0
- package/wc/gv-schema-form-control.js +1 -1
- package/wc/gv-schema-form.d.ts +1 -0
- package/wc/gv-schema-form.js +1 -1
- package/wc/gv-select-native.d.ts +1 -0
- package/wc/gv-select-native.js +1 -1
- package/wc/gv-select.d.ts +1 -0
- package/wc/gv-select.js +1 -1
- package/wc/gv-spinner.d.ts +1 -0
- package/wc/gv-spinner.js +1 -1
- package/wc/gv-state.d.ts +1 -0
- package/wc/gv-state.js +1 -1
- package/wc/gv-stats.d.ts +1 -0
- package/wc/gv-stats.js +1 -1
- package/wc/gv-stepper.d.ts +1 -0
- package/wc/gv-stepper.js +1 -1
- package/wc/gv-switch.d.ts +1 -0
- package/wc/gv-switch.js +1 -1
- package/wc/gv-table.d.ts +1 -0
- package/wc/gv-table.js +1 -1
- package/wc/gv-tabs.d.ts +1 -0
- package/wc/gv-tabs.js +1 -1
- package/wc/gv-tag.d.ts +1 -0
- package/wc/gv-tag.js +1 -1
- package/wc/gv-text.d.ts +1 -0
- package/wc/gv-text.js +1 -1
- package/wc/gv-theme.d.ts +1 -0
- package/wc/gv-theme.js +1 -1
- package/wc/gv-tree.d.ts +1 -0
- package/wc/gv-tree.js +1 -1
- package/wc/gv-user-menu.d.ts +1 -0
- package/wc/gv-user-menu.js +1 -1
- package/wc/gv-vertical-menu.d.ts +1 -0
- package/wc/gv-vertical-menu.js +1 -1
- package/CHANGELOG.md +0 -1292
- package/LICENSE.txt +0 -202
- package/README.md +0 -195
- package/src/.eslintrc.js +0 -19
- package/src/theme/definition.json +0 -1762
package/src/atoms/gv-state.js
CHANGED
|
@@ -1,130 +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
|
-
|
|
20
|
-
/**
|
|
21
|
-
* A State
|
|
22
|
-
*
|
|
23
|
-
* ## Details
|
|
24
|
-
* * has @theme facet
|
|
25
|
-
*
|
|
26
|
-
* @fires click - Native click event
|
|
27
|
-
*
|
|
28
|
-
* @slot - The content of the state (text or HTML)
|
|
29
|
-
*
|
|
30
|
-
* @attr {Boolean} error - enable error mode
|
|
31
|
-
* @attr {Boolean} major - enable major mode
|
|
32
|
-
* @attr {Boolean} success - enable success mode
|
|
33
|
-
* @attr {Boolean} warn - enable warn mode
|
|
34
|
-
* @attr {Boolean} skeleton - enable skeleton screen UI pattern (loading hint)
|
|
35
|
-
*
|
|
36
|
-
* @cssprop {Length} [--gv-state--bdr=17px] - Border radius
|
|
37
|
-
* @cssprop {Length} [--gv-state--fz=var(--gv-theme-font-size-s, 12px)] - Font size
|
|
38
|
-
* @cssprop {String} [--gv-state--fw=bold] - Font weight
|
|
39
|
-
* @cssprop {String} [--gv-state--tt=uppercase] - Text transform
|
|
40
|
-
* @cssprop {Length} [--gv-state--p=4px 8px] - Padding
|
|
41
|
-
* @cssprop {Color} [--gv-state--bgc=#f0f5ff] - Background color
|
|
42
|
-
* @cssprop {Color} [--gv-state--c=#597ef7] - Color
|
|
43
|
-
* @cssprop {Color} [--gv-state-major--bgc=var(--gv-theme-color-light, #d5fdcb)] - Major background color
|
|
44
|
-
* @cssprop {Color} [--gv-state-major--c=var(--gv-theme-color, #009b5b)] - Major color
|
|
45
|
-
*/
|
|
46
|
-
export class GvState extends LitElement {
|
|
47
|
-
static get properties() {
|
|
48
|
-
return {
|
|
49
|
-
default: { type: Boolean },
|
|
50
|
-
error: { type: Boolean },
|
|
51
|
-
major: { type: Boolean },
|
|
52
|
-
skeleton: { type: Boolean },
|
|
53
|
-
success: { type: Boolean },
|
|
54
|
-
warn: { type: Boolean },
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
static get styles() {
|
|
59
|
-
return [
|
|
60
|
-
skeleton,
|
|
61
|
-
// language=CSS
|
|
62
|
-
css`
|
|
63
|
-
:host {
|
|
64
|
-
box-sizing: border-box;
|
|
65
|
-
display: inline-block;
|
|
66
|
-
margin: 0.2rem;
|
|
67
|
-
vertical-align: middle;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
div.default {
|
|
71
|
-
--bgc: var(--gv-state--bgc, #f0f5ff);
|
|
72
|
-
--c: var(--gv-state--c, #597ef7);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
div.error {
|
|
76
|
-
--bgc: var(--gv-theme-color-error-light, #e57373);
|
|
77
|
-
--c: var(--gv-theme-neutral-color-lightest, #ffffff);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
div.major {
|
|
81
|
-
--bgc: var(--gv-state-major--bgc, var(--gv-theme-color-light, #d5fdcb));
|
|
82
|
-
--c: var(--gv-state-major--c, var(--gv-theme-color, #009b5b));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
div.success {
|
|
86
|
-
--bgc: var(--gv-theme-color-success-light, #81c784);
|
|
87
|
-
--c: var(--gv-theme-neutral-color-lightest, #ffffff);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
div.warn {
|
|
91
|
-
--bgc: var(--gv-theme-color-warning-light, #ffb74d);
|
|
92
|
-
--c: var(--gv-theme-neutral-color-lightest, #ffffff);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
div {
|
|
96
|
-
background-color: var(--bgc);
|
|
97
|
-
border-radius: var(--gv-state--bdr, 17px);
|
|
98
|
-
color: var(--c);
|
|
99
|
-
|
|
100
|
-
--fz: var(--gv-state--fz, var(--gv-theme-font-size-s, 12px));
|
|
101
|
-
font-size: var(--fz);
|
|
102
|
-
|
|
103
|
-
font-weight: var(--gv-state--fw, bold);
|
|
104
|
-
text-transform: var(--gv-state--tt, uppercase);
|
|
105
|
-
line-height: var(--fz);
|
|
106
|
-
padding: var(--gv-state--p, 4px 8px);
|
|
107
|
-
}
|
|
108
|
-
`,
|
|
109
|
-
];
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
render() {
|
|
113
|
-
const modes = {
|
|
114
|
-
default: !this.major && !this.error && !this.success && !this.warn,
|
|
115
|
-
error: this.error,
|
|
116
|
-
major: this.major,
|
|
117
|
-
skeleton: this.skeleton,
|
|
118
|
-
success: this.success,
|
|
119
|
-
warn: this.warn,
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
return html`
|
|
123
|
-
<div class=${classMap(modes)}>
|
|
124
|
-
<slot></slot>
|
|
125
|
-
</div>
|
|
126
|
-
`;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
window.customElements.define('gv-state', GvState);
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvState=void 0;const e=require("lit/directives/class-map"),t=require("lit"),r=require("../styles/skeleton");class s extends t.LitElement{static get properties(){return{default:{type:Boolean},error:{type:Boolean},major:{type:Boolean},skeleton:{type:Boolean},success:{type:Boolean},warn:{type:Boolean}}}static get styles(){return[r.skeleton,t.css`:host{box-sizing:border-box;display:inline-block;margin:.2rem;vertical-align:middle}div.default{--bgc:var(--gv-state--bgc, #f0f5ff);--c:var(--gv-state--c, #597ef7)}div.error{--bgc:var(--gv-theme-color-error-light, #e57373);--c:var(--gv-theme-neutral-color-lightest, #ffffff)}div.major{--bgc:var(--gv-state-major--bgc, var(--gv-theme-color-light, #d5fdcb));--c:var(--gv-state-major--c, var(--gv-theme-color, #009b5b))}div.success{--bgc:var(--gv-theme-color-success-light, #81c784);--c:var(--gv-theme-neutral-color-lightest, #ffffff)}div.warn{--bgc:var(--gv-theme-color-warning-light, #ffb74d);--c:var(--gv-theme-neutral-color-lightest, #ffffff)}div{background-color:var(--bgc);border-radius:var(--gv-state--bdr,17px);color:var(--c);--fz:var(--gv-state--fz, var(--gv-theme-font-size-s, 12px));font-size:var(--fz);font-weight:var(--gv-state--fw,bold);text-transform:var(--gv-state--tt,uppercase);line-height:var(--fz);padding:var(--gv-state--p,4px 8px)}`]}render(){const r={default:!(this.major||this.error||this.success||this.warn),error:this.error,major:this.major,skeleton:this.skeleton,success:this.success,warn:this.warn};return t.html`<div class="${(0,e.classMap)(r)}"><slot></slot></div>`}}exports.GvState=s,window.customElements.define("gv-state",s);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A wrapper of a <switch> component.
|
|
3
|
+
*
|
|
4
|
+
* ## Details
|
|
5
|
+
* * has @theme facet
|
|
6
|
+
*
|
|
7
|
+
* @fires gv-switch:input - mirrors native input events with the `value` on `detail`
|
|
8
|
+
*
|
|
9
|
+
* @attr {Boolean} disabled - same as native switch element `disabled` attribute
|
|
10
|
+
* @attr {Boolean} skeleton - enable skeleton screen UI pattern (loading hint)
|
|
11
|
+
* @attr {Boolean|String} value - true if the switch is checked, false otherwise
|
|
12
|
+
* @attr {String} label - label of the switch
|
|
13
|
+
* @attr {String} description - description of the switch
|
|
14
|
+
* @attr {Boolean} checked - same as native switch element `checked` attribute
|
|
15
|
+
* @attr {Boolean} readonly - true if readonly
|
|
16
|
+
*
|
|
17
|
+
* @cssprop {Color} [--gv-switch-on--bgc=var(--gv-theme-color, #5a7684)] - On background color
|
|
18
|
+
* @cssprop {Color} [--gv-switch-off--bgc=var(--gv-theme-neutral-color-dark, #bfbfbf)] - Off background color
|
|
19
|
+
* @cssprop {Color} [--gv-switch--bgc=var(--gv-theme-neutral-color-lightest, #ffffff)] - Switch background color
|
|
20
|
+
* @cssprop {String} [--gv-switch--ta=left] - Switch label text alignment
|
|
21
|
+
*/
|
|
22
|
+
export class GvSwitch extends LitElement {
|
|
23
|
+
static get properties(): {
|
|
24
|
+
disabled: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
reflect: boolean;
|
|
27
|
+
};
|
|
28
|
+
skeleton: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
};
|
|
31
|
+
value: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
reflect: boolean;
|
|
34
|
+
};
|
|
35
|
+
label: {
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
};
|
|
38
|
+
description: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
};
|
|
41
|
+
small: {
|
|
42
|
+
type: BooleanConstructor;
|
|
43
|
+
reflect: boolean;
|
|
44
|
+
};
|
|
45
|
+
checked: {
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
reflect: boolean;
|
|
48
|
+
};
|
|
49
|
+
readonly: {
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
reflect: boolean;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
static get styles(): import("lit").CSSResult[];
|
|
55
|
+
_id: string;
|
|
56
|
+
checked: boolean;
|
|
57
|
+
_onInput(): void;
|
|
58
|
+
value: boolean | undefined;
|
|
59
|
+
}
|
|
60
|
+
import { LitElement } from "lit-element/lit-element";
|
package/src/atoms/gv-switch.js
CHANGED
|
@@ -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);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Tag
|
|
3
|
+
*
|
|
4
|
+
* ## Details
|
|
5
|
+
* * has @theme facet
|
|
6
|
+
*
|
|
7
|
+
* @fires click - Native click event
|
|
8
|
+
*
|
|
9
|
+
* @slot - The content of the tag (text or HTML)
|
|
10
|
+
*
|
|
11
|
+
* @attr {String} icon - name of shape
|
|
12
|
+
* @attr {String} icon-right - name of shape
|
|
13
|
+
* @attr {Boolean} major - set tag UI as major
|
|
14
|
+
* @attr {Boolean} minor - set tag UI as minor
|
|
15
|
+
* @attr {Boolean} skeleton - enable skeleton screen UI pattern (loading hint)
|
|
16
|
+
* @attr {Boolean} clickable - If true, tag has link style
|
|
17
|
+
*
|
|
18
|
+
* @cssprop {Length} [--gv-tag--fz=var(--gv-theme-font-size-s, 12px)] - Font size
|
|
19
|
+
* @cssprop {Length} [--gv-tag--p=4px 8px] - Padding
|
|
20
|
+
* @cssprop {Length} [--gv-tag--bdr=4px] - Border radius
|
|
21
|
+
* @cssprop {String} [--gv-tag--bsw=none] - Box shadow
|
|
22
|
+
*
|
|
23
|
+
* @cssprop {Color} [--gv-tag--bgc=var(--gv-theme-neutral-color-lighter, #fafafa)] - Background color
|
|
24
|
+
* @cssprop {Color} [--gv-tag-major--bgc=var(--gv-theme-color, #5a7684)] - Major background color
|
|
25
|
+
* @cssprop {Color} [--gv-tag-minor--bgc=var(--gv-theme-neutral-color-lightest, #ffffff)] - Minor background color
|
|
26
|
+
*
|
|
27
|
+
* @cssprop {Color} [--gv-tag--bdc=var(--gv-theme-neutral-color-dark, #d9d9d9)] - Border color
|
|
28
|
+
* @cssprop {Color} [--gv-tag-major--bdc=var(--gv-theme-color, #5a7684)] - Major border color
|
|
29
|
+
* @cssprop {Color} [--gv-tag-minor--bdc=var(--gv-theme-neutral-color-dark, #d9d9d9)] - Minor border color
|
|
30
|
+
|
|
31
|
+
* @cssprop {String} [--gv-tag--bds=solid] - Border style
|
|
32
|
+
* @cssprop {String} [--gv-tag-major--bds=solid] - Major border style
|
|
33
|
+
* @cssprop {String} [--gv-tag-minor--bds=dashed] - Minor border style
|
|
34
|
+
*
|
|
35
|
+
* @cssprop {Length} [--gv-tag--bdw=1px] - Border width
|
|
36
|
+
* @cssprop {Length} [--gv-tag-major--bdw=1px] - Major border width
|
|
37
|
+
* @cssprop {Length} [--gv-tag-minor--bdw=1px] - Minor border width
|
|
38
|
+
*
|
|
39
|
+
* @cssprop {Color} [--gv-tag--c=var(--gv-theme-font-color-dark, #262626)] - Color
|
|
40
|
+
* @cssprop {Color} [--gv-tag-major--c=var(--gv-theme-font-color-light, #ffffff)] - Major color
|
|
41
|
+
* @cssprop {Color} [--gv-tag-minor--c=var(--gv-theme-font-color-dark, #262626)] - Minor color
|
|
42
|
+
* @cssprop {Length} [--gv-tag-icon--s=18px] - Height and icon width
|
|
43
|
+
*/
|
|
44
|
+
export class GvTag extends LitElement {
|
|
45
|
+
static get properties(): {
|
|
46
|
+
icon: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
};
|
|
49
|
+
iconRight: {
|
|
50
|
+
type: StringConstructor;
|
|
51
|
+
attribute: string;
|
|
52
|
+
};
|
|
53
|
+
major: {
|
|
54
|
+
type: BooleanConstructor;
|
|
55
|
+
};
|
|
56
|
+
minor: {
|
|
57
|
+
type: BooleanConstructor;
|
|
58
|
+
};
|
|
59
|
+
skeleton: {
|
|
60
|
+
type: BooleanConstructor;
|
|
61
|
+
};
|
|
62
|
+
clickable: {
|
|
63
|
+
type: BooleanConstructor;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
static get styles(): import("lit").CSSResult[];
|
|
67
|
+
_onTagClick(e: any): void;
|
|
68
|
+
}
|
|
69
|
+
import { LitElement } from "lit-element/lit-element";
|
package/src/atoms/gv-tag.js
CHANGED
|
@@ -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);
|