all files / src/stepper/ stepLabel.vue

100% Statements 0/0
100% Branches 0/0
100% Functions 0/0
100% Lines 0/0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101                                                                                                                                                                                                         
<template>
<span class="mu-step-label" :class="{'active': active, 'completed': completed, 'disabled': disabled}">
  <span class="mu-step-label-icon-container" v-if="num || ($slots.icon && $slots.length > 0)">
    <slot name="icon">
      <svg v-if="completed" class="mu-step-label-icon" viewBox="0 0 24 24">
        <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
      </svg>
      <div v-if="!completed" class="mu-step-label-circle">
        {{num}}
      </div>
    </slot>
  </span>
  <slot></slot>
</span>
</template>
 
<script>
export default {
  name: 'mu-step-label',
  props: {
    active: {
      type: Boolean
    },
    completed: {
      type: Boolean
    },
    disabled: {
      type: Boolean
    },
    num: {
      type: [String, Number]
    }
  }
}
</script>
 
<style lang="less">
@import "../styles/import.less";
.mu-step-label{
  height: 72px;
  color: @textColor;
  display: flex;
  align-items: center;
  font-size: 14px;
  padding-left: 14px;
  padding-right: 14px;
  .mu-stepper-vertical & {
    height: 64px;
  }
  &.disabled {
    color: @disabledColor;
    cursor: not-allowed;
  }
  &.active {
    font-weight: 500;
  }
}
 
.mu-step-label-icon-container{
  display: flex;
  align-items: center;
  margin-right: 8px;
  width: 24px;
}
 
.mu-step-label-icon {
  display: block;
  font-size: 24px;
  width: 24px;
  height: 24px;
  color: @grey500;
  fill: currentColor;
  .mu-step-label.disabled &{
    color: @grey500;
  }
  .mu-step-label.completed &,
  .mu-step-label.active & {
    color: @primaryColor;
  }
}
 
.mu-step-label-circle{
  width: 20px;
  height: 20px;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  overflow: hidden;
  border-radius: 100%;
  background-color: @grey500;
  color: @alternateTextColor;
  .mu-step-label.disabled &{
    background-color: @grey500;
  }
  .mu-step-label.completed &,
  .mu-step-label.active & {
    background-color: @primaryColor;
  }
}
</style>