|
| 1 | +.input { |
| 2 | + --ui__input__spacing-x: var(--spacing__md); |
| 3 | + --ui__input__spacing-y: var(--spacing__xs); |
| 4 | + --ui__input__text-color: var(--color__current); |
| 5 | + --ui__input__background: transparent; |
| 6 | + --ui__input__border-color: --color__current; |
| 7 | + --ui__input__roundness: var(--roundness); |
| 8 | + --ui__input__shadow: var(--shadow__none); |
| 9 | + --ui__input__grip-color: var(--color__text-400); |
| 10 | + |
| 11 | + box-sizing: border-box; |
| 12 | + position: relative; |
| 13 | + display: flex; |
| 14 | + min-width: 192px; |
| 15 | + max-width: fit-content; |
| 16 | + height: fit-content; |
| 17 | + color: var(--ui__input__text-color); |
| 18 | + background: var(--ui__input__background); |
| 19 | + border-color: var(--ui__input__border-color); |
| 20 | + border-width: 1px; |
| 21 | + border-style: solid; |
| 22 | + border-radius: var(--ui__input__roundness); |
| 23 | + box-shadow: var(--ui__input__shadow); |
| 24 | + transition-property: border-color; |
| 25 | + transition-duration: var(--transition--duration); |
| 26 | + transition-timing-function: var(--transition--easing); |
| 27 | + |
| 28 | + & > input, & > select { |
| 29 | + line-height: 1; |
| 30 | + box-sizing: border-box; |
| 31 | + position: relative; |
| 32 | + font-family: inherit; |
| 33 | + font-size: inherit; |
| 34 | + width: 0; |
| 35 | + min-width: 100%; |
| 36 | + margin: 0; |
| 37 | + padding: var(--ui__input__spacing-y) var(--ui__input__spacing-x); |
| 38 | + color: var(--ui__input__text-color); |
| 39 | + background: transparent; |
| 40 | + border: none; |
| 41 | + |
| 42 | + &::-webkit-input-placeholder { |
| 43 | + font-family: inherit; |
| 44 | + font-weight: inherit; |
| 45 | + font-size: 100%; |
| 46 | + color: var(--color__text-400); |
| 47 | + } |
| 48 | + |
| 49 | + &:focus { |
| 50 | + outline-color: var(--color__current); |
| 51 | + } |
| 52 | + } |
| 53 | + |
| 54 | + & > textarea, & > div[contenteditable] { |
| 55 | + flex: 1 1 auto; |
| 56 | + display: block; |
| 57 | + width: 0; |
| 58 | + min-height: 64px; |
| 59 | + margin: 0; |
| 60 | + padding: var(--ui__input__spacing-y) var(--ui__input__spacing-x); |
| 61 | + } |
| 62 | + |
| 63 | + |
| 64 | + & > textarea { |
| 65 | + resize: none; |
| 66 | + font-family: inherit; |
| 67 | + font-size: inherit; |
| 68 | + height: auto; |
| 69 | + max-height: 256px; |
| 70 | + color: inherit; |
| 71 | + background: none; |
| 72 | + border: none; |
| 73 | + |
| 74 | + &::-webkit-input-placeholder { |
| 75 | + font-family: inherit; |
| 76 | + font-weight: inherit; |
| 77 | + font-size: 100%; |
| 78 | + color: var(--color__text-400); |
| 79 | + } |
| 80 | + |
| 81 | + &:focus { |
| 82 | + outline-color: var(--color__current); |
| 83 | + } |
| 84 | + } |
| 85 | + |
| 86 | + & > div[contenteditable] { |
| 87 | + &:focus { |
| 88 | + outline-color: var(--color__current); |
| 89 | + } |
| 90 | + |
| 91 | + &:empty:before { |
| 92 | + content: attr(placeholder); |
| 93 | + font-family: inherit; |
| 94 | + font-weight: inherit; |
| 95 | + font-size: 100%; |
| 96 | + color: var(--color__text-400); |
| 97 | + } |
| 98 | + } |
| 99 | + |
| 100 | + & > select { |
| 101 | + appearance: none; |
| 102 | + |
| 103 | + & > option { |
| 104 | + font-size: 100%; |
| 105 | + color: var(--color__current); |
| 106 | + background: var(--ui__input__background); |
| 107 | + } |
| 108 | + } |
| 109 | + |
| 110 | + & > label { |
| 111 | + font-size: 75%; |
| 112 | + position: absolute; |
| 113 | + top: -1rem; |
| 114 | + left: 1.25rem; |
| 115 | + } |
| 116 | + |
| 117 | + & > .grip:has(+ textarea), & > textarea + .grip { |
| 118 | + &::before, &::after { |
| 119 | + content: ""; |
| 120 | + display: block; |
| 121 | + position: absolute; |
| 122 | + right: 0; |
| 123 | + bottom: 0; |
| 124 | + width: 12px; |
| 125 | + height: 12px; |
| 126 | + background-color: var(--color__background); |
| 127 | + pointer-events: none; |
| 128 | + } |
| 129 | + |
| 130 | + &::after { |
| 131 | + background-color: var(--ui__input__grip-color); |
| 132 | + mask: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWdyaXAtaG9yaXpvbnRhbCI+PGNpcmNsZSBjeD0iMTIiIGN5PSI5IiByPSIxIi8+PGNpcmNsZSBjeD0iMTkiIGN5PSI5IiByPSIxIi8+PGNpcmNsZSBjeD0iNSIgY3k9IjkiIHI9IjEiLz48Y2lyY2xlIGN4PSIxMiIgY3k9IjE1IiByPSIxIi8+PGNpcmNsZSBjeD0iMTkiIGN5PSIxNSIgcj0iMSIvPjxjaXJjbGUgY3g9IjUiIGN5PSIxNSIgcj0iMSIvPjwvc3ZnPg==") no-repeat 50% 50%; |
| 133 | + mask-size: cover; |
| 134 | + } |
| 135 | + } |
| 136 | + |
| 137 | + & > .grip + textarea, textarea:has(+.grip) { |
| 138 | + resize: vertical; |
| 139 | + } |
| 140 | + |
| 141 | + &:has(> select)::before { |
| 142 | + content: ""; |
| 143 | + display: block; |
| 144 | + position: absolute; |
| 145 | + right: var(--ui__input__spacing-x); |
| 146 | + bottom: 50%; |
| 147 | + width: 1em; |
| 148 | + height: 1em; |
| 149 | + background-color: var(--ui__input__grip-color); |
| 150 | + mask: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNoZXZyb24tZG93biI+PHBhdGggZD0ibTYgOSA2IDYgNi02Ii8+PC9zdmc+") no-repeat 50% 50%; |
| 151 | + mask-size: cover; |
| 152 | + transition-property: transform, color; |
| 153 | + transition-duration: var(--transition--duration); |
| 154 | + transition-timing-function: var(--transition--easing); |
| 155 | + transform: translateY(50%) rotate(0); |
| 156 | + } |
| 157 | + |
| 158 | + &:has(> select:focus)::before { |
| 159 | + transform: translateY(50%) rotate(180deg); |
| 160 | + } |
| 161 | +} |
0 commit comments