summaryrefslogtreecommitdiffstats
path: root/packages/excalidraw/components/TextField.scss
blob: c46cd2fe8c6c71bd070a9b32d3bd9fd9d0ee77f4 (plain) (blame)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
@import "../css/variables.module.scss";

.excalidraw {
  --ExcTextField--color: var(--color-on-surface);
  --ExcTextField--label-color: var(--color-on-surface);
  --ExcTextField--background: var(--color-surface-low);
  --ExcTextField--readonly--background: var(--color-surface-high);
  --ExcTextField--readonly--color: var(--color-on-surface);
  --ExcTextField--border: var(--color-gray-20);
  --ExcTextField--readonly--border: var(--color-border-outline-variant);
  --ExcTextField--border-hover: var(--color-brand-hover);
  --ExcTextField--border-active: var(--color-brand-active);
  --ExcTextField--placeholder: var(--color-border-outline-variant);

  .ExcTextField {
    position: relative;

    svg {
      position: absolute;
      top: 50%; // 50% is not exactly in the center of the input
      transform: translateY(-50%);
      left: 0.75rem;
      width: 1.25rem;
      height: 1.25rem;
      color: var(--color-gray-40);
      z-index: 1;
    }

    &--fullWidth {
      width: 100%;
      flex-grow: 1;
    }

    &__label {
      font-family: "Assistant";
      font-style: normal;
      font-weight: 600;
      font-size: 0.875rem;
      line-height: 150%;

      color: var(--ExcTextField--label-color);

      margin-bottom: 0.25rem;
      user-select: none;
    }

    &__input {
      box-sizing: border-box;

      display: flex;
      flex-direction: row;
      align-items: center;

      height: 3rem;

      background: var(--ExcTextField--background);
      border: 1px solid var(--ExcTextField--border);
      border-radius: 0.5rem;

      padding: 0 0.75rem;

      &:not(&--readonly) {
        &:hover {
          border-color: var(--ExcTextField--border-hover);
        }

        &:active,
        &:focus-within {
          border-color: var(--ExcTextField--border-active);
        }
      }

      & input {
        display: flex;
        align-items: center;

        border: none;
        outline: none;
        padding: 0;
        margin: 0;

        height: 1.5rem;

        color: var(--ExcTextField--color);

        font-family: "Assistant";
        font-style: normal;
        font-weight: 400;
        font-size: 1rem;
        line-height: 150%;
        text-overflow: ellipsis;

        background: transparent;

        width: 100%;

        &:not(:focus) {
          &:hover {
            background-color: initial;
          }
        }

        &:focus {
          outline: initial;
          box-shadow: initial;
        }
      }

      &--readonly {
        background: var(--ExcTextField--readonly--background);
        border-color: var(--ExcTextField--readonly--border);

        & input {
          color: var(--ExcTextField--readonly--color);
        }
      }
    }

    &--hasIcon .ExcTextField__input {
      padding-left: 2.5rem;
    }
  }
}