|
|
@@ -2,6 +2,7 @@
|
|
|
<label :class="{ filled }" :for="id">
|
|
|
<input :id="id" type="checkbox" v-model="checked" />
|
|
|
<span>{{ label }}</span>
|
|
|
+ <span v-if="help" class="help" :aria-label="help"><i class="material-icons">info</i></span>
|
|
|
</label>
|
|
|
</template>
|
|
|
|
|
|
@@ -17,6 +18,7 @@ export default defineComponent({
|
|
|
label: String,
|
|
|
id: String,
|
|
|
filled: Boolean,
|
|
|
+ help: String,
|
|
|
},
|
|
|
watch: {
|
|
|
modelValue(value: boolean) {
|
|
|
@@ -96,4 +98,51 @@ input[type="checkbox"]:checked {
|
|
|
width: 8px;
|
|
|
height: 14px;
|
|
|
}
|
|
|
+.help .material-icons {
|
|
|
+ vertical-align: text-top;
|
|
|
+ font-size: 1em;
|
|
|
+}
|
|
|
+.help {
|
|
|
+ font-size: 1em;
|
|
|
+ color: var(--color-accent-400);
|
|
|
+ position: relative;
|
|
|
+ margin-left: 4px;
|
|
|
+}
|
|
|
+.help::after,
|
|
|
+.help::before {
|
|
|
+ pointer-events: none;
|
|
|
+ transition: all 0.18s ease-out 0.18s;
|
|
|
+ position: absolute;
|
|
|
+ z-index: 10;
|
|
|
+ bottom: 100%;
|
|
|
+ left: 50%;
|
|
|
+ transform-origin: top;
|
|
|
+ transform: translate(-50%, 4px);
|
|
|
+ opacity: 0;
|
|
|
+}
|
|
|
+.help::after {
|
|
|
+ content: attr(aria-label);
|
|
|
+ background: var(--color-neutral-200);
|
|
|
+ padding: 0.5em 1em;
|
|
|
+ border-radius: 4px;
|
|
|
+ color: #fff;
|
|
|
+ line-height: 1em;
|
|
|
+ font-weight: normal;
|
|
|
+ white-space: normal;
|
|
|
+ width: 160px;
|
|
|
+ text-align: center;
|
|
|
+ margin-bottom: 10px;
|
|
|
+}
|
|
|
+.help::before {
|
|
|
+ content: "";
|
|
|
+ width: 0;
|
|
|
+ height: 0;
|
|
|
+ border: 5px solid transparent;
|
|
|
+ border-top-color: var(--color-neutral-200);
|
|
|
+}
|
|
|
+.help:hover::before,
|
|
|
+.help:hover::after {
|
|
|
+ transform: translate(-50%, 0);
|
|
|
+ opacity: 1;
|
|
|
+}
|
|
|
</style>
|