@globalbrain/sefirot 2.15.0 → 2.17.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.
@@ -88,21 +88,19 @@ function getErrorMsg(validation: Validatable) {
88
88
 
89
89
  <style scoped lang="postcss">
90
90
  .SInputBase.mini {
91
- .label { padding-bottom: 6px; }
92
- .label-text-value { font-size: 12px; }
91
+ .label { padding-bottom: 6px; height: 22px; }
92
+ .label-text-value { font-size: var(--input-label-font-size, var(--input-mini-label-font-size)); }
93
93
  .label-text-info { width: 14px; height: 14px; }
94
94
  }
95
95
 
96
96
  .SInputBase.small {
97
- .label { padding-bottom: 8px; }
98
- .label-text-value { font-size: 14px; }
99
- .label-note, .check { transform: translateY(1px); }
97
+ .label { padding-bottom: 8px; height: 24px; }
98
+ .label-text-value { font-size: var(--input-label-font-size, var(--input-small-label-font-size)); }
100
99
  }
101
100
 
102
101
  .SInputBase.medium {
103
- .label { padding-bottom: 8px; }
104
- .label-text-value { font-size: 14px; }
105
- .label-note, .check { transform: translateY(1px); }
102
+ .label { padding-bottom: 8px; height: 24px; }
103
+ .label-text-value { font-size: var(--input-label-font-size, var(--input-medium-label-font-size)); }
106
104
  }
107
105
 
108
106
  .SInputBase.has-error {
@@ -113,7 +111,7 @@ function getErrorMsg(validation: Validatable) {
113
111
 
114
112
  .label {
115
113
  display: flex;
116
- align-items: center;
114
+ align-items: baseline;
117
115
  width: 100%;
118
116
  line-height: 16px;
119
117
  font-weight: 500;
@@ -17,6 +17,7 @@ const props = defineProps<{
17
17
  checkIcon?: IconifyIcon | DefineComponent
18
18
  checkText?: string
19
19
  checkColor?: Color
20
+ block?: boolean
20
21
  modelValue: Day | null
21
22
  validation?: Validatable
22
23
  hideError?: boolean
@@ -71,6 +72,7 @@ function emitBlur() {
71
72
  <input
72
73
  :id="name"
73
74
  class="input"
75
+ :class="{ block }"
74
76
  type="text"
75
77
  placeholder="YYYY-MM-DD"
76
78
  :value="inputValue"
@@ -113,5 +115,9 @@ function emitBlur() {
113
115
  font-weight: 500;
114
116
  color: var(--c-text-3);
115
117
  }
118
+
119
+ &.block {
120
+ max-width: none;
121
+ }
116
122
  }
117
123
  </style>
@@ -17,6 +17,8 @@ const props = defineProps<{
17
17
  note?: string
18
18
  help?: string
19
19
  placeholder?: string
20
+ unitBefore?: any
21
+ unitAfter?: any
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"
@@ -2,6 +2,7 @@
2
2
  import { IconifyIcon } from '@iconify/vue/dist/offline'
3
3
  import { DefineComponent, computed, ref } from 'vue'
4
4
  import { Validatable } from '../composables/Validation'
5
+ import { isString } from '../support/Utils'
5
6
  import SIcon from './SIcon.vue'
6
7
  import SInputBase from './SInputBase.vue'
7
8
 
@@ -18,10 +19,11 @@ const props = defineProps<{
18
19
  help?: string
19
20
  type?: string
20
21
  placeholder?: string
22
+ unitBefore?: any
23
+ unitAfter?: any
21
24
  checkIcon?: IconifyIcon | DefineComponent
22
25
  checkText?: string
23
26
  checkColor?: Color
24
- icon?: any
25
27
  align?: Align
26
28
  disabled?: boolean
27
29
  modelValue: string | null
@@ -111,27 +113,35 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
111
113
  <slot name="addon-before" />
112
114
  </div>
113
115
 
114
- <div v-if="icon" class="icon">
115
- <SIcon :icon="icon" class="icon-svg" />
116
- </div>
117
-
118
116
  <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 }}
117
+ <div v-if="unitBefore" class="unit before">
118
+ <span v-if="isString(unitBefore)" class="unit-text">{{ unitBefore }}</span>
119
+ <SIcon v-else class="unit-icon" :icon="unitBefore" />
120
+ </div>
121
+
122
+ <div class="area">
123
+ <input
124
+ class="input entity"
125
+ :class="{ hide: showDisplay }"
126
+ :id="name"
127
+ :type="type ?? 'text'"
128
+ :placeholder="placeholder"
129
+ :disabled="disabled"
130
+ :value="modelValue"
131
+ ref="input"
132
+ @focus="onFocus"
133
+ @blur="emitBlur"
134
+ @input="emitInput"
135
+ @keypress.enter="emitEnter"
136
+ >
137
+ <div v-if="showDisplay" class="input display">
138
+ {{ displayValue }}
139
+ </div>
140
+ </div>
141
+
142
+ <div v-if="unitAfter" class="unit after">
143
+ <span v-if="isString(unitAfter)" class="unit-text">{{ unitAfter }}</span>
144
+ <SIcon v-else class="unit-icon" :icon="unitAfter" />
135
145
  </div>
136
146
  </div>
137
147
 
@@ -147,6 +157,8 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
147
157
  .SInputText.mini {
148
158
  .box { min-height: 32px; }
149
159
  .value { min-height: 30px; }
160
+ .area { min-height: 30px; }
161
+ .unit { min-height: 30px; }
150
162
 
151
163
  .input {
152
164
  padding: 3px 8px;
@@ -155,12 +167,19 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
155
167
  font-size: var(--input-font-size, var(--input-mini-font-size));
156
168
  }
157
169
 
158
- .icon {
159
- width: 22px;
160
- height: 30px;
170
+ .unit + .area .input { padding-left: 6px; }
171
+ .area:has(+ .unit) .input { padding-right: 6px; }
172
+
173
+ .unit {
174
+ padding: 3px 8px;
175
+ line-height: 24px;
176
+ font-size: var(--input-font-size, var(--input-mini-font-size));
161
177
  }
162
178
 
163
- .icon-svg {
179
+ .unit.before { padding-right: 0; }
180
+ .unit.after { padding-left: 0; }
181
+
182
+ .unit-icon {
164
183
  width: 16px;
165
184
  height: 16px;
166
185
  }
@@ -187,6 +206,8 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
187
206
  .SInputText.small {
188
207
  .box { min-height: 40px; }
189
208
  .value { min-height: 38px; }
209
+ .area { min-height: 38px; }
210
+ .unit { min-height: 38px; }
190
211
 
191
212
  .input {
192
213
  padding: 7px 12px;
@@ -195,12 +216,19 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
195
216
  font-size: var(--input-font-size, var(--input-small-font-size));
196
217
  }
197
218
 
198
- .icon {
199
- width: 26px;
200
- height: 38px;
219
+ .unit + .area .input { padding-left: 8px; }
220
+ .area:has(+ .unit) .input { padding-right: 8px; }
221
+
222
+ .unit {
223
+ padding: 7px 12px;
224
+ line-height: 24px;
225
+ font-size: var(--input-font-size, var(--input-small-font-size));
201
226
  }
202
227
 
203
- .icon-svg {
228
+ .unit.before { padding-right: 0; }
229
+ .unit.after { padding-left: 0; }
230
+
231
+ .unit-icon {
204
232
  width: 16px;
205
233
  height: 16px;
206
234
  }
@@ -227,6 +255,8 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
227
255
  .SInputText.medium {
228
256
  .box { min-height: 48px; }
229
257
  .value { min-height: 46px; }
258
+ .area { min-height: 46px; }
259
+ .unit { min-height: 46px; }
230
260
 
231
261
  .input {
232
262
  padding: 11px 12px;
@@ -235,14 +265,21 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
235
265
  font-size: var(--input-font-size, var(--input-medium-font-size));
236
266
  }
237
267
 
238
- .icon {
239
- width: 28px;
240
- height: 46px;
268
+ .unit + .area .input { padding-left: 8px; }
269
+ .area:has(+ .unit) .input { padding-right: 8px; }
270
+
271
+ .unit {
272
+ padding: 11px 12px;
273
+ line-height: 24px;
274
+ font-size: var(--input-font-size, var(--input-medium-font-size));
241
275
  }
242
276
 
243
- .icon-svg {
244
- width: 18px;
245
- height: 18px;
277
+ .unit.before { padding-right: 0; }
278
+ .unit.after { padding-left: 0; }
279
+
280
+ .unit-icon {
281
+ width: 16px;
282
+ height: 16px;
246
283
  }
247
284
 
248
285
  :slotted(.SInputAddon) .action {
@@ -275,7 +312,8 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
275
312
  background-color: var(--input-disabled-bg-color);
276
313
  }
277
314
 
278
- .box:hover .input {
315
+ .box:hover .input,
316
+ .box:hover .unit {
279
317
  cursor: not-allowed;
280
318
  }
281
319
  }
@@ -318,8 +356,11 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
318
356
  }
319
357
  }
320
358
 
321
- .value {
359
+ .value,
360
+ .area {
322
361
  position: relative;
362
+ display: flex;
363
+ align-items: center;
323
364
  flex-grow: 1;
324
365
  }
325
366
 
@@ -353,15 +394,15 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
353
394
  width: 100%;
354
395
  }
355
396
 
356
- .icon {
397
+ .unit {
357
398
  display: flex;
358
399
  align-items: center;
359
- cursor: text;
400
+ justify-content: center;
360
401
  color: var(--c-text-2);
361
402
  }
362
403
 
363
- .icon-svg {
364
- fill: currentColor;
404
+ .unit-text {
405
+ font-weight: 500;
365
406
  }
366
407
 
367
408
  .addon {
@@ -19,7 +19,7 @@ const props = defineProps<{
19
19
  checkColor?: Color
20
20
  placeholder?: string
21
21
  disabled?: boolean
22
- rows?: number
22
+ rows?: number | 'fill'
23
23
  modelValue: string | null
24
24
  hideError?: boolean
25
25
  validation?: Validatable
@@ -31,7 +31,8 @@ const emit = defineEmits<{
31
31
 
32
32
  const classes = computed(() => [
33
33
  props.size ?? 'small',
34
- { disabled: props.disabled }
34
+ { disabled: props.disabled },
35
+ { fill: props.rows === 'fill' }
35
36
  ])
36
37
 
37
38
  function emitInput(e: Event): void {
@@ -62,6 +63,7 @@ function emitBlur(e: FocusEvent): void {
62
63
  <textarea
63
64
  :id="name"
64
65
  class="input"
66
+ :class="{ fill: rows === 'fill' }"
65
67
  :placeholder="placeholder"
66
68
  :rows="rows ?? 3"
67
69
  :disabled="disabled"
@@ -73,7 +75,7 @@ function emitBlur(e: FocusEvent): void {
73
75
  </SInputBase>
74
76
  </template>
75
77
 
76
- <style lang="postcss" scoped>
78
+ <style scoped lang="postcss">
77
79
  .SInputTextarea.mini {
78
80
  .input {
79
81
  padding: 6px 12px;
@@ -155,5 +157,9 @@ function emitBlur(e: FocusEvent): void {
155
157
  .dark &:hover:focus {
156
158
  border-color: var(--c-info);
157
159
  }
160
+
161
+ &.fill {
162
+ height: 100%;
163
+ }
158
164
  }
159
165
  </style>
@@ -658,4 +658,8 @@
658
658
  --input-mini-font-size: 14px;
659
659
  --input-small-font-size: 16px;
660
660
  --input-medium-font-size: 16px;
661
+
662
+ --input-mini-label-font-size: 12px;
663
+ --input-small-label-font-size: 14px;
664
+ --input-medium-label-font-size: 14px;
661
665
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "version": "2.15.0",
4
- "packageManager": "pnpm@7.26.0",
3
+ "version": "2.17.0",
4
+ "packageManager": "pnpm@7.26.2",
5
5
  "description": "Vue Components for Global Brain Design System.",
6
6
  "author": "Kia Ishii <ka.ishii@globalbrains.com>",
7
7
  "license": "MIT",