@globalbrain/sefirot 2.30.0 → 2.31.1

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%;
@@ -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,12 +16,19 @@ 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
@@ -55,6 +62,14 @@ const padValue = computed(() => {
55
62
  }
56
63
  })
57
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
+
58
73
  const isFocused = ref(false)
59
74
 
60
75
  const touched = {
@@ -145,7 +160,7 @@ function createRequiredTouched(): boolean[] {
145
160
  v-if="!noYear"
146
161
  class="input year"
147
162
  :value="padValue?.year"
148
- placeholder="1998"
163
+ :placeholder="padPlaceholder.year"
149
164
  :maxlength="4"
150
165
  :disabled="disabled"
151
166
  @focus="onFocus"
@@ -159,7 +174,7 @@ function createRequiredTouched(): boolean[] {
159
174
  v-if="!noMonth"
160
175
  class="input month"
161
176
  :value="padValue?.month"
162
- placeholder="01"
177
+ :placeholder="padPlaceholder.month"
163
178
  :maxlength="2"
164
179
  :disabled="disabled"
165
180
  @focus="onFocus"
@@ -173,7 +188,7 @@ function createRequiredTouched(): boolean[] {
173
188
  v-if="!noDate"
174
189
  class="input date"
175
190
  :value="padValue?.date"
176
- placeholder="14"
191
+ :placeholder="padPlaceholder.date"
177
192
  :maxlength="2"
178
193
  :disabled="disabled"
179
194
  @focus="onFocus"
@@ -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>