@globalbrain/sefirot 2.15.0 → 2.16.0

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.
@@ -17,6 +17,8 @@ const props = defineProps<{
17
17
  note?: string
18
18
  help?: string
19
19
  placeholder?: string
20
+ unitBefore?: string
21
+ unitAfter?: string
20
22
  checkIcon?: IconifyIcon | DefineComponent
21
23
  checkText?: string
22
24
  checkColor?: Color
@@ -79,6 +81,8 @@ function emitUpdate(value: string | null) {
79
81
  :info="info"
80
82
  :help="help"
81
83
  :placeholder="placeholder"
84
+ :unit-before="unitBefore"
85
+ :unit-after="unitAfter"
82
86
  :check-icon="checkIcon"
83
87
  :check-text="checkText"
84
88
  :check-color="checkColor"
@@ -18,6 +18,8 @@ const props = defineProps<{
18
18
  help?: string
19
19
  type?: string
20
20
  placeholder?: string
21
+ unitBefore?: string
22
+ unitAfter?: string
21
23
  checkIcon?: IconifyIcon | DefineComponent
22
24
  checkText?: string
23
25
  checkColor?: Color
@@ -116,22 +118,32 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
116
118
  </div>
117
119
 
118
120
  <div class="value">
119
- <input
120
- class="input entity"
121
- :class="{ hide: showDisplay }"
122
- :id="name"
123
- :type="type ?? 'text'"
124
- :placeholder="placeholder"
125
- :disabled="disabled"
126
- :value="modelValue"
127
- ref="input"
128
- @focus="onFocus"
129
- @blur="emitBlur"
130
- @input="emitInput"
131
- @keypress.enter="emitEnter"
132
- >
133
- <div v-if="showDisplay" class="input display">
134
- {{ displayValue }}
121
+ <div v-if="props.unitBefore" class="unit before">
122
+ {{ props.unitBefore }}
123
+ </div>
124
+
125
+ <div class="area">
126
+ <input
127
+ class="input entity"
128
+ :class="{ hide: showDisplay }"
129
+ :id="name"
130
+ :type="type ?? 'text'"
131
+ :placeholder="placeholder"
132
+ :disabled="disabled"
133
+ :value="modelValue"
134
+ ref="input"
135
+ @focus="onFocus"
136
+ @blur="emitBlur"
137
+ @input="emitInput"
138
+ @keypress.enter="emitEnter"
139
+ >
140
+ <div v-if="showDisplay" class="input display">
141
+ {{ displayValue }}
142
+ </div>
143
+ </div>
144
+
145
+ <div v-if="props.unitAfter" class="unit after">
146
+ {{ props.unitAfter }}
135
147
  </div>
136
148
  </div>
137
149
 
@@ -147,6 +159,7 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
147
159
  .SInputText.mini {
148
160
  .box { min-height: 32px; }
149
161
  .value { min-height: 30px; }
162
+ .area { min-height: 30px; }
150
163
 
151
164
  .input {
152
165
  padding: 3px 8px;
@@ -155,6 +168,18 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
155
168
  font-size: var(--input-font-size, var(--input-mini-font-size));
156
169
  }
157
170
 
171
+ .unit + .area .input { padding-left: 6px; }
172
+ .area:has(+ .unit) .input { padding-right: 6px; }
173
+
174
+ .unit {
175
+ padding: 3px 8px;
176
+ line-height: 24px;
177
+ font-size: var(--input-font-size, var(--input-mini-font-size));
178
+ }
179
+
180
+ .unit.before { padding-right: 0; }
181
+ .unit.after { padding-left: 0; }
182
+
158
183
  .icon {
159
184
  width: 22px;
160
185
  height: 30px;
@@ -187,6 +212,7 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
187
212
  .SInputText.small {
188
213
  .box { min-height: 40px; }
189
214
  .value { min-height: 38px; }
215
+ .area { min-height: 38px; }
190
216
 
191
217
  .input {
192
218
  padding: 7px 12px;
@@ -195,6 +221,18 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
195
221
  font-size: var(--input-font-size, var(--input-small-font-size));
196
222
  }
197
223
 
224
+ .unit + .area .input { padding-left: 8px; }
225
+ .area:has(+ .unit) .input { padding-right: 8px; }
226
+
227
+ .unit {
228
+ padding: 7px 12px;
229
+ line-height: 24px;
230
+ font-size: var(--input-font-size, var(--input-small-font-size));
231
+ }
232
+
233
+ .unit.before { padding-right: 0; }
234
+ .unit.after { padding-left: 0; }
235
+
198
236
  .icon {
199
237
  width: 26px;
200
238
  height: 38px;
@@ -227,6 +265,7 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
227
265
  .SInputText.medium {
228
266
  .box { min-height: 48px; }
229
267
  .value { min-height: 46px; }
268
+ .area { min-height: 46px; }
230
269
 
231
270
  .input {
232
271
  padding: 11px 12px;
@@ -235,6 +274,18 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
235
274
  font-size: var(--input-font-size, var(--input-medium-font-size));
236
275
  }
237
276
 
277
+ .unit + .area .input { padding-left: 8px; }
278
+ .area:has(+ .unit) .input { padding-right: 8px; }
279
+
280
+ .unit {
281
+ padding: 11px 12px;
282
+ line-height: 24px;
283
+ font-size: var(--input-font-size, var(--input-medium-font-size));
284
+ }
285
+
286
+ .unit.before { padding-right: 0; }
287
+ .unit.after { padding-left: 0; }
288
+
238
289
  .icon {
239
290
  width: 28px;
240
291
  height: 46px;
@@ -275,7 +326,8 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
275
326
  background-color: var(--input-disabled-bg-color);
276
327
  }
277
328
 
278
- .box:hover .input {
329
+ .box:hover .input,
330
+ .box:hover .unit {
279
331
  cursor: not-allowed;
280
332
  }
281
333
  }
@@ -318,8 +370,11 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
318
370
  }
319
371
  }
320
372
 
321
- .value {
373
+ .value,
374
+ .area {
322
375
  position: relative;
376
+ display: flex;
377
+ align-items: center;
323
378
  flex-grow: 1;
324
379
  }
325
380
 
@@ -353,6 +408,11 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
353
408
  width: 100%;
354
409
  }
355
410
 
411
+ .unit {
412
+ font-weight: 500;
413
+ color: var(--c-text-2);
414
+ }
415
+
356
416
  .icon {
357
417
  display: flex;
358
418
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
4
4
  "packageManager": "pnpm@7.26.0",
5
5
  "description": "Vue Components for Global Brain Design System.",
6
6
  "author": "Kia Ishii <ka.ishii@globalbrains.com>",