@globalbrain/sefirot 2.29.0 → 2.31.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.
@@ -24,7 +24,9 @@ const props = defineProps<{
24
24
  type?: Type
25
25
  mode?: Mode
26
26
  icon?: any
27
+ iconMode?: Mode
27
28
  label?: string
29
+ labelMode?: Mode
28
30
  href?: string
29
31
  rounded?: boolean
30
32
  block?: boolean
@@ -60,7 +62,7 @@ function handleClick(): void {
60
62
  </script>
61
63
 
62
64
  <template>
63
- <component
65
+ <Component
64
66
  :is="computedTag"
65
67
  class="SButton"
66
68
  :class="classes"
@@ -69,16 +71,20 @@ function handleClick(): void {
69
71
  @click="handleClick"
70
72
  >
71
73
  <span class="content">
72
- <span v-if="icon" class="icon"><SIcon :icon="icon" class="icon-svg" /></span>
73
- <span v-if="label" class="label">{{ label }}</span>
74
+ <span v-if="icon" class="icon" :class="iconMode">
75
+ <SIcon :icon="icon" class="icon-svg" />
76
+ </span>
77
+ <span v-if="label" class="label" :class="labelMode">
78
+ {{ label }}
79
+ </span>
74
80
  </span>
75
81
 
76
- <transition name="fade">
82
+ <Transition name="fade">
77
83
  <span v-if="loading" key="loading" class="loader">
78
84
  <SSpinner class="loader-icon" />
79
85
  </span>
80
- </transition>
81
- </component>
86
+ </Transition>
87
+ </Component>
82
88
  </template>
83
89
 
84
90
  <style scoped lang="postcss">
@@ -247,6 +253,18 @@ function handleClick(): void {
247
253
  }
248
254
  }
249
255
 
256
+ .SButton.fill .icon,
257
+ .SButton.fill .label {
258
+ &.neutral { color: var(--button-fill-neutral-content-color);}
259
+ &.mute { color: var(--button-fill-mute-content-color); }
260
+ &.white { color: var(--button-fill-white-content-color); }
261
+ &.black { color: var(--button-fill-black-content-color); }
262
+ &.info { color: var(--button-fill-info-content-color); }
263
+ &.success { color: var(--button-fill-success-content-color); }
264
+ &.warning { color: var(--button-fill-warning-content-color); }
265
+ &.danger { color: var(--button-fill-danger-content-color); }
266
+ }
267
+
250
268
  .SButton.fill.disabled {
251
269
  &.neutral {
252
270
  border-color: var(--button-fill-neutral-disabled-border-color);
@@ -321,6 +339,18 @@ function handleClick(): void {
321
339
  }
322
340
  }
323
341
 
342
+ .SButton.fill.disabled .icon,
343
+ .SButton.fill.disabled .label {
344
+ &.neutral { color: var(--button-fill-neutral-disabled-content-color); }
345
+ &.white { color: var(--button-fill-white-disabled-content-color); }
346
+ &.black { color: var(--button-fill-black-disabled-content-color); }
347
+ &.mute { color: var(--button-fill-mute-disabled-content-color); }
348
+ &.info { color: var(--button-fill-info-disabled-content-color); }
349
+ &.success { color: var(--button-fill-success-disabled-content-color); }
350
+ &.warning { color: var(--button-fill-warning-disabled-content-color); }
351
+ &.danger { color: var(--button-fill-danger-disabled-content-color); }
352
+ }
353
+
324
354
  .SButton.outline {
325
355
  font-weight: 500;
326
356
 
@@ -405,6 +435,18 @@ function handleClick(): void {
405
435
  }
406
436
  }
407
437
 
438
+ .SButton.outline .icon,
439
+ .SButton.outline .label {
440
+ &.neutral { color: var(--button-outline-neutral-content-color); }
441
+ &.white { color: var(--button-outline-white-content-color); }
442
+ &.black { color: var(--button-outline-black-content-color); }
443
+ &.mute { color: var(--button-outline-mute-content-color); }
444
+ &.info { color: var(--button-outline-info-content-color); }
445
+ &.success { color: var(--button-outline-success-content-color); }
446
+ &.warning { color: var(--button-outline-warning-content-color); }
447
+ &.danger { color: var(--button-outline-danger-content-color); }
448
+ }
449
+
408
450
  .SButton.outline.disabled {
409
451
  &.neutral {
410
452
  border-color: var(--button-outline-neutral-disabled-border-color);
@@ -471,6 +513,18 @@ function handleClick(): void {
471
513
  }
472
514
  }
473
515
 
516
+ .SButton.outline.disabled .icon,
517
+ .SButton.outline.disabled .label {
518
+ &.neutral { color: var(--button-outline-neutral-disabled-content-color); }
519
+ &.white { color: var(--button-outline-white-disabled-content-color); }
520
+ &.black { color: var(--button-outline-black-disabled-content-color); }
521
+ &.mute { color: var(--button-outline-mute-disabled-content-color); }
522
+ &.info { color: var(--button-outline-info-disabled-content-color); }
523
+ &.success { color: var(--button-outline-success-disabled-content-color); }
524
+ &.warning { color: var(--button-outline-warning-disabled-content-color); }
525
+ &.danger { color: var(--button-outline-danger-disabled-content-color); }
526
+ }
527
+
474
528
  .SButton.text {
475
529
  font-weight: 500;
476
530
 
@@ -533,6 +587,18 @@ function handleClick(): void {
533
587
  }
534
588
  }
535
589
 
590
+ .SButton.text .icon,
591
+ .SButton.text .label {
592
+ &.neutral { color: var(--button-text-neutral-content-color); }
593
+ &.white { color: var(--button-text-white-content-color); }
594
+ &.black { color: var(--button-text-black-content-color); }
595
+ &.mute { color: var(--button-text-mute-content-color); }
596
+ &.info { color: var(--button-text-info-content-color); }
597
+ &.success { color: var(--button-text-success-content-color); }
598
+ &.warning { color: var(--button-text-warning-content-color); }
599
+ &.danger { color: var(--button-text-danger-content-color); }
600
+ }
601
+
536
602
  .SButton.text.disabled {
537
603
  &.neutral {
538
604
  color: var(--button-text-neutral-disabled-text-color);
@@ -591,6 +657,18 @@ function handleClick(): void {
591
657
  }
592
658
  }
593
659
 
660
+ .SButton.text.disabled .icon,
661
+ .SButton.text.disabled .label {
662
+ &.neutral { color: var(--button-text-neutral-disabled-content-color); }
663
+ &.white { color: var(--button-text-white-disabled-content-color); }
664
+ &.black { color: var(--button-text-black-disabled-content-color); }
665
+ &.mute { color: var(--button-text-mute-disabled-content-color); }
666
+ &.info { color: var(--button-text-info-disabled-content-color); }
667
+ &.success { color: var(--button-text-success-disabled-content-color); }
668
+ &.warning { color: var(--button-text-warning-disabled-content-color); }
669
+ &.danger { color: var(--button-text-danger-disabled-content-color); }
670
+ }
671
+
594
672
  .SButton.block {
595
673
  display: flex;
596
674
  width: 100%;
@@ -20,6 +20,7 @@ const props = defineProps<{
20
20
  checkText?: string
21
21
  checkColor?: Color
22
22
  block?: boolean
23
+ disabled?: boolean
23
24
  modelValue: Day | null
24
25
  validation?: Validatable
25
26
  hideError?: boolean
@@ -79,12 +80,13 @@ function emitBlur() {
79
80
  <input
80
81
  :id="name"
81
82
  class="input"
82
- :class="{ block }"
83
+ :class="{ block, disabled }"
83
84
  type="text"
84
85
  placeholder="YYYY-MM-DD"
85
- :value="inputValue"
86
86
  autocomplete="off"
87
- v-on="inputEvents"
87
+ :value="inputValue"
88
+ :disabled="disabled"
89
+ v-on="disabled || inputEvents"
88
90
  @blur="emitBlur"
89
91
  >
90
92
  </DatePicker>
@@ -97,31 +99,43 @@ function emitBlur() {
97
99
  .SInputDate.mini {
98
100
  .input {
99
101
  padding: 3px 8px;
100
- max-width: 120px;
102
+ max-width: 114px;
101
103
  height: 32px;
102
104
  line-height: 24px;
103
105
  font-size: var(--input-font-size, var(--input-mini-font-size));
104
106
  }
107
+
108
+ .input.block {
109
+ max-width: 100%;
110
+ }
105
111
  }
106
112
 
107
113
  .SInputDate.small {
108
114
  .input {
109
115
  padding: 5px 12px;
110
- max-width: 128px;
116
+ max-width: 136px;
111
117
  height: 40px;
112
118
  line-height: 24px;
113
119
  font-size: var(--input-font-size, var(--input-small-font-size));
114
120
  }
121
+
122
+ .input.block {
123
+ max-width: 100%;
124
+ }
115
125
  }
116
126
 
117
127
  .SInputDate.medium {
118
128
  .input {
119
129
  padding: 11px 12px;
120
- max-width: 160px;
130
+ max-width: 136px;
121
131
  height: 48px;
122
132
  line-height: 24px;
123
133
  font-size: var(--input-font-size, var(--input-medium-font-size));
124
134
  }
135
+
136
+ .input.block {
137
+ max-width: 100%;
138
+ }
125
139
  }
126
140
 
127
141
  .SInputDate.has-error {
@@ -139,8 +153,8 @@ function emitBlur() {
139
153
  border: 1px solid var(--input-border-color);
140
154
  border-radius: 6px;
141
155
  width: 100%;
142
- font-family: var(--font-family-number);
143
156
  font-weight: 400;
157
+ font-feature-settings: 'tnum';
144
158
  background-color: var(--input-bg-color);
145
159
  transition: border-color 0.25s, background-color 0.25s;
146
160
 
@@ -148,8 +162,10 @@ function emitBlur() {
148
162
  color: var(--input-placeholder-color);
149
163
  }
150
164
 
151
- &.block {
152
- max-width: none;
165
+ &.disabled {
166
+ border-color: var(--input-disabled-border-color);
167
+ background-color: var(--input-disabled-bg-color);
168
+ cursor: not-allowed;
153
169
  }
154
170
  }
155
171
  </style>
@@ -241,11 +241,12 @@ function handleArray(value: OptionValue) {
241
241
 
242
242
  .SInputDropdown.disabled {
243
243
  .box {
244
- background-color: var(--c-bg);
244
+ border-color: var(--input-disabled-border-color);
245
+ background-color: var(--input-disabled-bg-color);
245
246
  cursor: not-allowed;
246
247
 
247
- &:hover { border-color: var(--c-divider); }
248
- &:focus:not(:focus-visible) { border-color: var(--c-divider); }
248
+ &:hover { border-color: var(--input-disabled-border-color); }
249
+ &:focus:not(:focus-visible) { border-color: var(--input-disabled-border-color); }
249
250
  }
250
251
 
251
252
  .box-icon {
@@ -14,6 +14,12 @@ export interface Value {
14
14
  second: string | null
15
15
  }
16
16
 
17
+ export interface Placeholder {
18
+ hour: string
19
+ minute: string
20
+ second: string
21
+ }
22
+
17
23
  export type ValueType = 'hour' | 'minute' | 'second'
18
24
 
19
25
  const props = defineProps<{
@@ -22,6 +28,7 @@ const props = defineProps<{
22
28
  info?: string
23
29
  note?: string
24
30
  help?: string
31
+ placeholder?: Placeholder
25
32
  checkIcon?: IconifyIcon | DefineComponent
26
33
  checkText?: string
27
34
  checkColor?: Color
@@ -46,6 +53,22 @@ const _value = computed(() => {
46
53
  : props.value !== undefined ? props.value : null
47
54
  })
48
55
 
56
+ const padValue = computed(() => {
57
+ return {
58
+ hour: _value.value?.hour?.padStart(2, '0') ?? null,
59
+ minute: _value.value?.minute?.padStart(2, '0') ?? null,
60
+ second: _value.value?.second?.padStart(2, '0') ?? null
61
+ }
62
+ })
63
+
64
+ const padPlaceholder = computed(() => {
65
+ return {
66
+ hour: props.placeholder?.hour.toString().padStart(2, '0') ?? '00',
67
+ minute: props.placeholder?.minute.toString().padStart(2, '0') ?? '00',
68
+ second: props.placeholder?.second.toString().padStart(2, '0') ?? '00'
69
+ }
70
+ })
71
+
49
72
  const isFocused = ref(false)
50
73
 
51
74
  const touched = {
@@ -81,7 +104,7 @@ function update(type: ValueType, value: string | null) {
81
104
 
82
105
  const newValue = {
83
106
  ..._value.value,
84
- [type]: value !== null ? value.padStart(2, '0') : null
107
+ [type]: value ?? null
85
108
  }
86
109
 
87
110
  emit('update:model-value', newValue)
@@ -145,8 +168,8 @@ function createRequiredTouched(): boolean[] {
145
168
  <input
146
169
  v-if="!noHour"
147
170
  class="input hour"
148
- :value="_value?.hour"
149
- placeholder="00"
171
+ :value="padValue?.hour"
172
+ :placeholder="padPlaceholder.hour"
150
173
  :maxlength="2"
151
174
  :disabled="disabled"
152
175
  @focus="onFocus"
@@ -156,8 +179,8 @@ function createRequiredTouched(): boolean[] {
156
179
  <input
157
180
  v-if="!noMinute"
158
181
  class="input minute"
159
- :value="_value?.minute"
160
- placeholder="00"
182
+ :value="padValue?.minute"
183
+ :placeholder="padPlaceholder.minute"
161
184
  :maxlength="2"
162
185
  :disabled="disabled"
163
186
  @focus="onFocus"
@@ -167,8 +190,8 @@ function createRequiredTouched(): boolean[] {
167
190
  <input
168
191
  v-if="!noSecond"
169
192
  class="input second"
170
- :value="_value?.second"
171
- placeholder="00"
193
+ :value="padValue?.second"
194
+ :placeholder="padPlaceholder.second"
172
195
  :maxlength="2"
173
196
  :disabled="disabled"
174
197
  @focus="onFocus"
@@ -417,6 +417,7 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
417
417
  bottom: 0;
418
418
  left: 0;
419
419
  width: 100%;
420
+ overflow: hidden;
420
421
  }
421
422
 
422
423
  .unit {
@@ -16,18 +16,26 @@ export interface Value {
16
16
 
17
17
  export type ValueType = 'year' | 'month' | 'date'
18
18
 
19
+ export interface Placeholder {
20
+ year: number
21
+ month: number
22
+ date: number
23
+ }
24
+
19
25
  const props = defineProps<{
20
26
  size?: Size
21
27
  label?: string
22
28
  info?: string
23
29
  note?: string
24
30
  help?: string
31
+ placeholder?: Placeholder
25
32
  checkIcon?: IconifyIcon | DefineComponent
26
33
  checkText?: string
27
34
  checkColor?: Color
28
35
  noYear?: boolean
29
36
  noMonth?: boolean
30
37
  noDate?: boolean
38
+ block?: boolean
31
39
  disabled?: boolean
32
40
  value?: Value
33
41
  modelValue?: Value
@@ -54,6 +62,14 @@ const padValue = computed(() => {
54
62
  }
55
63
  })
56
64
 
65
+ const padPlaceholder = computed(() => {
66
+ return {
67
+ year: props.placeholder?.year.toString().padStart(4, '0') ?? '1998',
68
+ month: props.placeholder?.month.toString().padStart(2, '0') ?? '01',
69
+ date: props.placeholder?.date.toString().padStart(2, '0') ?? '14'
70
+ }
71
+ })
72
+
57
73
  const isFocused = ref(false)
58
74
 
59
75
  const touched = {
@@ -139,12 +155,12 @@ function createRequiredTouched(): boolean[] {
139
155
  :hide-error="hideError"
140
156
  :validation="validation"
141
157
  >
142
- <div class="container" :class="{ focus: isFocused }">
158
+ <div class="container" :class="{ focus: isFocused, block }">
143
159
  <input
144
160
  v-if="!noYear"
145
161
  class="input year"
146
162
  :value="padValue?.year"
147
- placeholder="1998"
163
+ :placeholder="padPlaceholder.year"
148
164
  :maxlength="4"
149
165
  :disabled="disabled"
150
166
  @focus="onFocus"
@@ -158,7 +174,7 @@ function createRequiredTouched(): boolean[] {
158
174
  v-if="!noMonth"
159
175
  class="input month"
160
176
  :value="padValue?.month"
161
- placeholder="01"
177
+ :placeholder="padPlaceholder.month"
162
178
  :maxlength="2"
163
179
  :disabled="disabled"
164
180
  @focus="onFocus"
@@ -172,7 +188,7 @@ function createRequiredTouched(): boolean[] {
172
188
  v-if="!noDate"
173
189
  class="input date"
174
190
  :value="padValue?.date"
175
- placeholder="14"
191
+ :placeholder="padPlaceholder.date"
176
192
  :maxlength="2"
177
193
  :disabled="disabled"
178
194
  @focus="onFocus"
@@ -278,11 +294,15 @@ function createRequiredTouched(): boolean[] {
278
294
 
279
295
  &:hover { border-color: var(--input-hover-border-color); }
280
296
  &.focus { border-color: var(--input-focus-border-color); }
297
+
298
+ &.block {
299
+ width: 100%;
300
+ }
281
301
  }
282
302
 
283
303
  .input {
284
- font-family: var(--font-family-number);
285
304
  line-height: 24px;
305
+ font-feature-settings: "tnum";
286
306
  background-color: transparent;
287
307
 
288
308
  &::placeholder {
@@ -0,0 +1,135 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+
4
+ export type Size = 'mini' | 'small' | 'medium' | 'large'
5
+ export type Mode = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
6
+
7
+ const props = defineProps<{
8
+ as?: string
9
+ size?: Size
10
+ mode?: Mode
11
+ label: string
12
+ }>()
13
+
14
+ const classes = computed(() => [
15
+ props.size ?? 'small',
16
+ props.mode ?? 'neutral'
17
+ ])
18
+ </script>
19
+
20
+ <template>
21
+ <component :is="as ?? 'span'" class="SState" :class="classes">
22
+ <span class="indicator" />
23
+ <span class="label">{{ label }}</span>
24
+ </component>
25
+ </template>
26
+
27
+ <style scoped lang="postcss">
28
+ .SState {
29
+ display: inline-flex;
30
+ align-items: center;
31
+ border: 1px solid var(--c-divider-2);
32
+ border-radius: 6px;
33
+ font-weight: 500;
34
+ white-space: nowrap;
35
+ background-color: var(--c-mute);
36
+ }
37
+
38
+ .SState.mini {
39
+ gap: 6px;
40
+ padding: 0 6px;
41
+ height: 20px;
42
+
43
+ .indicator {
44
+ border-radius: 2px;
45
+ width: 8px;
46
+ height: 8px;
47
+ }
48
+
49
+ .label {
50
+ font-size: 12px;
51
+ }
52
+ }
53
+
54
+ .SState.small {
55
+ gap: 8px;
56
+ padding: 0 8px;
57
+ height: 24px;
58
+
59
+ .indicator {
60
+ border-radius: 3px;
61
+ width: 10px;
62
+ height: 10px;
63
+ }
64
+
65
+ .label {
66
+ font-size: 12px;
67
+ }
68
+ }
69
+
70
+ .SState.medium {
71
+ gap: 8px;
72
+ padding: 0 8px;
73
+ height: 28px;
74
+
75
+ .indicator {
76
+ border-radius: 3px;
77
+ width: 10px;
78
+ height: 10px;
79
+ }
80
+
81
+ .label {
82
+ font-size: 12px;
83
+ }
84
+ }
85
+
86
+ .SState.large {
87
+ gap: 10px;
88
+ padding: 0 10px;
89
+ height: 32px;
90
+
91
+ .indicator {
92
+ border-radius: 4px;
93
+ width: 12px;
94
+ height: 12px;
95
+ }
96
+
97
+ .label {
98
+ font-size: 14px;
99
+ }
100
+ }
101
+
102
+ .SState.neutral {
103
+ .indicator { background-color: var(--c-neutral-1); }
104
+ }
105
+
106
+ .SState.mute {
107
+ .label { color: var(--c-text-2); }
108
+ .indicator { background-color: var(--c-mute-darker); }
109
+ }
110
+
111
+ .SState.info {
112
+ .indicator { background-color: var(--c-info-text); }
113
+ }
114
+
115
+ .SState.success {
116
+ .indicator { background-color: var(--c-success-text); }
117
+ }
118
+
119
+ .SState.warning {
120
+ .indicator { background-color: var(--c-warning-text); }
121
+ }
122
+
123
+ .SState.danger {
124
+ .indicator { background-color: var(--c-danger-text); }
125
+ }
126
+
127
+ .label {
128
+ transition: color 0.25s;
129
+ }
130
+
131
+ .indicator {
132
+ display: block;
133
+ transition: background-color 0.25s;
134
+ }
135
+ </style>