@globalbrain/sefirot 2.19.0 → 2.21.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.
- package/lib/components/SButton.vue +2 -2
- package/lib/components/SButtonGroup.vue +9 -140
- package/lib/components/SDropdownSection.vue +10 -0
- package/lib/components/SDropdownSectionActions.vue +61 -0
- package/lib/components/SDropdownSectionComponent.vue +11 -0
- package/lib/components/SDropdownSectionFilter.vue +1 -2
- package/lib/components/SDropdownSectionFilterItemAvatar.vue +1 -1
- package/lib/components/SDropdownSectionFilterItemText.vue +1 -1
- package/lib/components/SDropdownSectionMenu.vue +1 -1
- package/lib/components/SInputBase.vue +4 -4
- package/lib/components/SInputRadio.vue +1 -1
- package/lib/components/SInputSwitch.vue +213 -38
- package/lib/components/SInputSwitches.vue +2 -2
- package/lib/components/SPill.vue +1 -1
- package/lib/composables/Dropdown.ts +19 -1
- package/lib/styles/base.css +5 -8
- package/lib/styles/variables.css +16 -2
- package/lib/validation/validators/hms.ts +3 -3
- package/lib/validation/validators/requiredHms.ts +4 -4
- package/lib/validation/validators/requiredYmd.ts +1 -1
- package/package.json +1 -1
|
@@ -81,7 +81,7 @@ function handleClick(): void {
|
|
|
81
81
|
</component>
|
|
82
82
|
</template>
|
|
83
83
|
|
|
84
|
-
<style lang="postcss"
|
|
84
|
+
<style scoped lang="postcss">
|
|
85
85
|
.SButton {
|
|
86
86
|
position: relative;
|
|
87
87
|
display: inline-flex;
|
|
@@ -156,7 +156,7 @@ function handleClick(): void {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
.SButton.fill {
|
|
159
|
-
font-weight:
|
|
159
|
+
font-weight: 500;
|
|
160
160
|
|
|
161
161
|
&.neutral {
|
|
162
162
|
border-color: var(--button-fill-neutral-border-color);
|
|
@@ -1,148 +1,17 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { PropType, computed } from 'vue'
|
|
3
|
-
|
|
4
|
-
export interface ButtonGroupItem {
|
|
5
|
-
label: string
|
|
6
|
-
value: string
|
|
7
|
-
mode?: Mode
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export type Mode = 'neutral' | 'info' | 'success' | 'warning' | 'danger'
|
|
11
|
-
export type Size = 'mini' | 'small' | 'medium' | 'large' | 'jumbo'
|
|
12
|
-
|
|
13
|
-
const props = defineProps({
|
|
14
|
-
items: { type: Array as PropType<ButtonGroupItem[]>, required: true },
|
|
15
|
-
size: { type: String as PropType<Size>, default: 'medium' },
|
|
16
|
-
modelValue: { type: String, default: null }
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const emit = defineEmits(['update:modelValue'])
|
|
20
|
-
|
|
21
|
-
const classes = computed(() => [props.size])
|
|
22
|
-
|
|
23
|
-
function getButtonClasses(button: ButtonGroupItem) {
|
|
24
|
-
return [
|
|
25
|
-
{ active: button.value === props.modelValue },
|
|
26
|
-
button.mode ?? 'neutral'
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function handleClick(value: string) {
|
|
31
|
-
emit('update:modelValue', value)
|
|
32
|
-
}
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
1
|
<template>
|
|
36
|
-
<div class="SButtonGroup"
|
|
37
|
-
<
|
|
38
|
-
v-for="item in items"
|
|
39
|
-
:key="item.value"
|
|
40
|
-
class="button"
|
|
41
|
-
:class="getButtonClasses(item)"
|
|
42
|
-
@click="handleClick(item.value)"
|
|
43
|
-
>
|
|
44
|
-
<span class="content">
|
|
45
|
-
{{ item.label }}
|
|
46
|
-
</span>
|
|
47
|
-
</button>
|
|
2
|
+
<div class="SButtonGroup">
|
|
3
|
+
<slot />
|
|
48
4
|
</div>
|
|
49
5
|
</template>
|
|
50
6
|
|
|
51
|
-
<style lang="postcss"
|
|
52
|
-
.SButtonGroup {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
border: 1px solid var(--c-divider);
|
|
56
|
-
border-radius: 4px;
|
|
57
|
-
overflow: hidden;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.SButtonGroup.mini {
|
|
61
|
-
height: 28px;
|
|
62
|
-
|
|
63
|
-
.button {
|
|
64
|
-
padding: 0 8px;
|
|
65
|
-
height: 28px;
|
|
66
|
-
font-size: 12px;
|
|
67
|
-
font-weight: 500;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.SButtonGroup.small {
|
|
72
|
-
height: 32px;
|
|
73
|
-
|
|
74
|
-
.button {
|
|
75
|
-
padding: 0 10px;
|
|
76
|
-
height: 32px;
|
|
77
|
-
font-size: 12px;
|
|
78
|
-
font-weight: 500;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.SButtonGroup.medium {
|
|
83
|
-
height: 40px;
|
|
84
|
-
|
|
85
|
-
.button {
|
|
86
|
-
padding: 0 12px;
|
|
87
|
-
height: 40px;
|
|
88
|
-
font-size: 13px;
|
|
89
|
-
font-weight: 500;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.SButtonGroup.large {
|
|
94
|
-
height: 48px;
|
|
95
|
-
|
|
96
|
-
.button {
|
|
97
|
-
padding: 0 14px;
|
|
98
|
-
height: 48px;
|
|
99
|
-
font-size: 14px;
|
|
100
|
-
font-weight: 500;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.SButtonGroup.jumbo {
|
|
105
|
-
height: 64px;
|
|
106
|
-
|
|
107
|
-
.button {
|
|
108
|
-
padding: 0 24px;
|
|
109
|
-
height: 64px;
|
|
110
|
-
font-size: 14px;
|
|
111
|
-
font-weight: 500;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.button {
|
|
116
|
-
border-left: 1px solid transparent;
|
|
117
|
-
letter-spacing: .4px;
|
|
118
|
-
color: var(--c-text-2);
|
|
119
|
-
white-space: nowrap;
|
|
120
|
-
transition: color .25s, background-color .25s;
|
|
121
|
-
|
|
122
|
-
&:hover {
|
|
123
|
-
color: var(--c-text-1);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.button:not(:first-child) {
|
|
128
|
-
border-left: 1px solid var(--c-divider);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.button.active {
|
|
132
|
-
color: var(--c-text-dark-1);
|
|
133
|
-
}
|
|
7
|
+
<style scoped lang="postcss">
|
|
8
|
+
.SButtonGroup :slotted(.SButton) {
|
|
9
|
+
border-left-width: 0;
|
|
10
|
+
border-radius: 0;
|
|
134
11
|
|
|
135
|
-
|
|
136
|
-
.button.info.active { background-color: var(--c-info); }
|
|
137
|
-
.button.success.active { background-color: var(--c-success); }
|
|
138
|
-
.button.warning.active { background-color: var(--c-warning); }
|
|
139
|
-
.button.danger.active { background-color: var(--c-danger); }
|
|
12
|
+
&:first-child { border-left-width: 1px; }
|
|
140
13
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
justify-content: center;
|
|
144
|
-
align-items: center;
|
|
145
|
-
width: 100%;
|
|
146
|
-
height: 100%;
|
|
14
|
+
&:first-child { border-radius: 6px 0 0 6px; }
|
|
15
|
+
&:last-child { border-radius: 0 6px 6px 0; }
|
|
147
16
|
}
|
|
148
17
|
</style>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { DropdownSection } from '../composables/Dropdown'
|
|
3
|
+
import SDropdownSectionActions from './SDropdownSectionActions.vue'
|
|
4
|
+
import SDropdownSectionComponent from './SDropdownSectionComponent.vue'
|
|
3
5
|
import SDropdownSectionFilter from './SDropdownSectionFilter.vue'
|
|
4
6
|
import SDropdownSectionMenu from './SDropdownSectionMenu.vue'
|
|
5
7
|
|
|
@@ -20,6 +22,14 @@ defineProps<{
|
|
|
20
22
|
:options="section.options"
|
|
21
23
|
:on-click="section.onClick"
|
|
22
24
|
/>
|
|
25
|
+
<SDropdownSectionActions
|
|
26
|
+
v-if="section.type === 'actions'"
|
|
27
|
+
:options="section.options"
|
|
28
|
+
/>
|
|
29
|
+
<SDropdownSectionComponent
|
|
30
|
+
v-else-if="section.type === 'component'"
|
|
31
|
+
:comp="section.component"
|
|
32
|
+
/>
|
|
23
33
|
</template>
|
|
24
34
|
|
|
25
35
|
<style scoped lang="postcss">
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { DropdownSectionActionsOption } from '../composables/Dropdown'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
options: DropdownSectionActionsOption[]
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div class="SDropdownSectionActions">
|
|
11
|
+
<div v-for="option in options" :key="option.label" class="item">
|
|
12
|
+
<button class="button" :class="[option.mode ?? 'neutral']" @click="option.onClick">
|
|
13
|
+
{{ option.label }}
|
|
14
|
+
</button>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<style scoped lang="postcss">
|
|
20
|
+
.SDropdownSectionActions {
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: flex-end;
|
|
23
|
+
padding: 8px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.button {
|
|
27
|
+
display: block;
|
|
28
|
+
border-radius: 6px;
|
|
29
|
+
padding: 0 8px;
|
|
30
|
+
width: 100%;
|
|
31
|
+
text-align: left;
|
|
32
|
+
line-height: 32px;
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
font-weight: 500;
|
|
35
|
+
transition: color 0.25s, background-color 0.25s;
|
|
36
|
+
|
|
37
|
+
&.neutral { color: var(--button-text-neutral-text-color); }
|
|
38
|
+
&.neutral:hover { background-color: var(--button-text-neutral-hover-bg-color); }
|
|
39
|
+
&.neutral:active { background-color: var(--button-text-neutral-active-bg-color); }
|
|
40
|
+
|
|
41
|
+
&.mute { color: var(--button-text-mute-text-color); }
|
|
42
|
+
&.mute:hover { background-color: var(--button-text-mute-hover-bg-color); }
|
|
43
|
+
&.mute:active { background-color: var(--button-text-mute-active-bg-color); }
|
|
44
|
+
|
|
45
|
+
&.info { color: var(--button-text-info-text-color); }
|
|
46
|
+
&.info:hover { background-color: var(--button-text-info-hover-bg-color); }
|
|
47
|
+
&.info:active { background-color: var(--button-text-info-active-bg-color); }
|
|
48
|
+
|
|
49
|
+
&.success { color: var(--button-text-success-text-color); }
|
|
50
|
+
&.success:hover { background-color: var(--button-text-success-hover-bg-color); }
|
|
51
|
+
&.success:active { background-color: var(--button-text-success-active-bg-color); }
|
|
52
|
+
|
|
53
|
+
&.warning { color: var(--button-text-warning-text-color); }
|
|
54
|
+
&.warning:hover { background-color: var(--button-text-warning-hover-bg-color); }
|
|
55
|
+
&.warning:active { background-color: var(--button-text-warning-active-bg-color); }
|
|
56
|
+
|
|
57
|
+
&.danger { color: var(--button-text-danger-text-color); }
|
|
58
|
+
&.danger:hover { background-color: var(--button-text-danger-hover-bg-color); }
|
|
59
|
+
&.danger:active { background-color: var(--button-text-danger-active-bg-color); }
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
@@ -102,13 +102,12 @@ function handleClick(option: DropdownSectionFilterOption, value: string | number
|
|
|
102
102
|
border-radius: 6px;
|
|
103
103
|
padding: 0 8px;
|
|
104
104
|
width: 100%;
|
|
105
|
-
font-size:
|
|
105
|
+
font-size: 14px;
|
|
106
106
|
line-height: 32px;
|
|
107
107
|
background-color: var(--c-bg);
|
|
108
108
|
transition: border-color 0.25s;
|
|
109
109
|
|
|
110
110
|
&::placeholder {
|
|
111
|
-
font-weight: 500;
|
|
112
111
|
color: var(--c-text-3);
|
|
113
112
|
}
|
|
114
113
|
|
|
@@ -114,7 +114,6 @@ function getErrorMsg(validation: Validatable) {
|
|
|
114
114
|
align-items: baseline;
|
|
115
115
|
width: 100%;
|
|
116
116
|
line-height: 16px;
|
|
117
|
-
font-weight: 500;
|
|
118
117
|
cursor: pointer;
|
|
119
118
|
transition: color 0.25s;
|
|
120
119
|
}
|
|
@@ -126,6 +125,7 @@ function getErrorMsg(validation: Validatable) {
|
|
|
126
125
|
}
|
|
127
126
|
|
|
128
127
|
.label-text-value {
|
|
128
|
+
font-weight: 500;
|
|
129
129
|
color: var(--input-label-color);
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -144,7 +144,7 @@ function getErrorMsg(validation: Validatable) {
|
|
|
144
144
|
display: inline-block;
|
|
145
145
|
margin-left: 8px;
|
|
146
146
|
font-size: 12px;
|
|
147
|
-
font-weight:
|
|
147
|
+
font-weight: 400;
|
|
148
148
|
color: var(--c-text-2);
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -158,7 +158,7 @@ function getErrorMsg(validation: Validatable) {
|
|
|
158
158
|
padding: 6px 0 0 0;
|
|
159
159
|
line-height: 18px;
|
|
160
160
|
font-size: 12px;
|
|
161
|
-
font-weight:
|
|
161
|
+
font-weight: 400;
|
|
162
162
|
color: var(--input-error-text-color);
|
|
163
163
|
transition: opacity 0.25s, transform 0.25s;
|
|
164
164
|
}
|
|
@@ -168,7 +168,7 @@ function getErrorMsg(validation: Validatable) {
|
|
|
168
168
|
padding: 4px 0 0;
|
|
169
169
|
line-height: 20px;
|
|
170
170
|
font-size: 12px;
|
|
171
|
-
font-weight:
|
|
171
|
+
font-weight: 400;
|
|
172
172
|
color: var(--c-text-2);
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -5,36 +5,53 @@ import { Validatable } from '../composables/Validation'
|
|
|
5
5
|
import SInputBase from './SInputBase.vue'
|
|
6
6
|
|
|
7
7
|
export type Size = 'mini' | 'small' | 'medium'
|
|
8
|
-
export type
|
|
8
|
+
export type ActiveColor = 'info' | 'success' | 'warning' | 'danger'
|
|
9
|
+
export type CheckColor = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
|
|
9
10
|
|
|
10
|
-
const props = defineProps<{
|
|
11
|
+
const props = withDefaults(defineProps<{
|
|
11
12
|
size?: Size
|
|
12
13
|
name?: string
|
|
13
14
|
label?: string
|
|
14
15
|
info?: string
|
|
15
16
|
note?: string
|
|
16
17
|
text?: string
|
|
18
|
+
color?: ActiveColor
|
|
17
19
|
help?: string
|
|
18
20
|
checkIcon?: IconifyIcon | DefineComponent
|
|
19
21
|
checkText?: string
|
|
20
|
-
checkColor?:
|
|
22
|
+
checkColor?: CheckColor
|
|
21
23
|
disabled?: boolean
|
|
22
|
-
|
|
24
|
+
value?: boolean
|
|
25
|
+
modelValue?: boolean
|
|
23
26
|
hideError?: boolean
|
|
24
27
|
validation?: Validatable
|
|
25
|
-
}>()
|
|
28
|
+
}>(), {
|
|
29
|
+
value: undefined,
|
|
30
|
+
modelValue: undefined
|
|
31
|
+
})
|
|
26
32
|
|
|
27
33
|
const emit = defineEmits<{
|
|
28
|
-
(e: 'update:
|
|
34
|
+
(e: 'update:model-value', value: boolean): void
|
|
35
|
+
(e: 'change', value: boolean): void
|
|
29
36
|
}>()
|
|
30
37
|
|
|
38
|
+
const _value = computed(() => {
|
|
39
|
+
return props.modelValue !== undefined
|
|
40
|
+
? props.modelValue
|
|
41
|
+
: props.value !== undefined ? props.value : false
|
|
42
|
+
})
|
|
43
|
+
|
|
31
44
|
const classes = computed(() => [
|
|
32
|
-
|
|
45
|
+
props.size ?? 'small',
|
|
46
|
+
props.color ?? 'info',
|
|
33
47
|
{ disabled: props.disabled }
|
|
34
48
|
])
|
|
35
49
|
|
|
36
50
|
function emitChange(): void {
|
|
37
|
-
|
|
51
|
+
if (!props.disabled) {
|
|
52
|
+
emit('update:model-value', !_value.value)
|
|
53
|
+
emit('change', !_value.value)
|
|
54
|
+
}
|
|
38
55
|
}
|
|
39
56
|
</script>
|
|
40
57
|
|
|
@@ -53,11 +70,10 @@ function emitChange(): void {
|
|
|
53
70
|
:hide-error="hideError"
|
|
54
71
|
>
|
|
55
72
|
<div class="container">
|
|
56
|
-
<div class="input" :class="{ on:
|
|
73
|
+
<div class="input" :class="{ on: _value }" role="button" @click="emitChange">
|
|
57
74
|
<p v-if="text" class="text">{{ text }}</p>
|
|
58
|
-
|
|
59
75
|
<div class="box">
|
|
60
|
-
<div class="
|
|
76
|
+
<div class="toggle" />
|
|
61
77
|
</div>
|
|
62
78
|
</div>
|
|
63
79
|
</div>
|
|
@@ -65,7 +81,185 @@ function emitChange(): void {
|
|
|
65
81
|
</SInputBase>
|
|
66
82
|
</template>
|
|
67
83
|
|
|
68
|
-
<style lang="postcss"
|
|
84
|
+
<style scoped lang="postcss">
|
|
85
|
+
.SInputSwitch.mini {
|
|
86
|
+
.input {
|
|
87
|
+
height: 32px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.text {
|
|
91
|
+
line-height: 20px;
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.box {
|
|
96
|
+
border-radius: 9px;
|
|
97
|
+
width: 32px;
|
|
98
|
+
height: 18px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.toggle {
|
|
102
|
+
top: 1px;
|
|
103
|
+
left: 1px;
|
|
104
|
+
width: 14px;
|
|
105
|
+
height: 14px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.input.on .toggle {
|
|
109
|
+
transform: translateX(14px);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.SInputSwitch.small {
|
|
114
|
+
.input {
|
|
115
|
+
height: 32px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.text {
|
|
119
|
+
line-height: 20px;
|
|
120
|
+
font-size: 14px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.box {
|
|
124
|
+
border-radius: 11px;
|
|
125
|
+
width: 40px;
|
|
126
|
+
height: 22px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.toggle {
|
|
130
|
+
top: 2px;
|
|
131
|
+
left: 2px;
|
|
132
|
+
width: 16px;
|
|
133
|
+
height: 16px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.input.on .toggle {
|
|
137
|
+
transform: translateX(18px);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.SInputSwitch.medium {
|
|
142
|
+
.input {
|
|
143
|
+
height: 32px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.text {
|
|
147
|
+
line-height: 20px;
|
|
148
|
+
font-size: 14px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.box {
|
|
152
|
+
border-radius: 13px;
|
|
153
|
+
width: 46px;
|
|
154
|
+
height: 26px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.toggle {
|
|
158
|
+
top: 3px;
|
|
159
|
+
left: 3px;
|
|
160
|
+
width: 18px;
|
|
161
|
+
height: 18px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.input.on .toggle {
|
|
165
|
+
transform: translateX(20px);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.SInputSwitch.info {
|
|
170
|
+
.box:hover {
|
|
171
|
+
border-color: var(--c-info-light);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.input.on .box {
|
|
175
|
+
border-color: var(--c-info-light);
|
|
176
|
+
background-color: var(--c-info);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.SInputSwitch.success {
|
|
181
|
+
.box:hover {
|
|
182
|
+
border-color: var(--c-success-light);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.input.on .box {
|
|
186
|
+
border-color: var(--c-success-light);
|
|
187
|
+
background-color: var(--c-success);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.SInputSwitch.warning {
|
|
192
|
+
.box:hover {
|
|
193
|
+
border-color: var(--c-warning-light);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.input.on .box {
|
|
197
|
+
border-color: var(--c-warning-light);
|
|
198
|
+
background-color: var(--c-warning);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.SInputSwitch.danger {
|
|
203
|
+
.box:hover {
|
|
204
|
+
border-color: var(--c-danger-light);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.input.on .box {
|
|
208
|
+
border-color: var(--c-danger-light);
|
|
209
|
+
background-color: var(--c-danger);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.SInputSwitch.disabled {
|
|
214
|
+
.input {
|
|
215
|
+
cursor: not-allowed;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.box {
|
|
219
|
+
background-color: var(--input-switch-disabled-bg-color);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.box:hover {
|
|
223
|
+
border-color: var(--c-divider-1);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.toggle {
|
|
227
|
+
background-color: var(--input-switch-disabled-toggle-color);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.input.on .toggle {
|
|
231
|
+
opacity: 0.5;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
&.info {
|
|
235
|
+
.input.on .box {
|
|
236
|
+
border-color: var(--c-info);
|
|
237
|
+
background-color: var(--c-info-dark);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&.success {
|
|
242
|
+
.input.on .box {
|
|
243
|
+
border-color: var(--c-success);
|
|
244
|
+
background-color: var(--c-success-dark);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
&.warning {
|
|
249
|
+
.input.on .box {
|
|
250
|
+
border-color: var(--c-warning);
|
|
251
|
+
background-color: var(--c-warning-dark);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
&.danger {
|
|
256
|
+
.input.on .box {
|
|
257
|
+
border-color: var(--c-danger);
|
|
258
|
+
background-color: var(--c-danger-dark);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
69
263
|
.container {
|
|
70
264
|
display: flex;
|
|
71
265
|
}
|
|
@@ -76,11 +270,7 @@ function emitChange(): void {
|
|
|
76
270
|
justify-content: space-between;
|
|
77
271
|
align-items: center;
|
|
78
272
|
width: 100%;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
&:hover {
|
|
82
|
-
.box { border-color: var(--c-info); }
|
|
83
|
-
}
|
|
273
|
+
cursor: pointer;
|
|
84
274
|
}
|
|
85
275
|
|
|
86
276
|
.input.on .box {
|
|
@@ -88,43 +278,28 @@ function emitChange(): void {
|
|
|
88
278
|
background-color: var(--c-info);
|
|
89
279
|
}
|
|
90
280
|
|
|
91
|
-
.input.on .
|
|
281
|
+
.input.on .toggle {
|
|
92
282
|
background-color: var(--c-white);
|
|
93
|
-
transform: translateX(18px);
|
|
94
283
|
}
|
|
95
284
|
|
|
96
285
|
.text {
|
|
97
286
|
flex-grow: 1;
|
|
98
287
|
margin: 0;
|
|
99
288
|
padding-right: 16px;
|
|
100
|
-
line-height: 20px;
|
|
101
|
-
font-size: 14px;
|
|
102
|
-
font-weight: 500;
|
|
103
289
|
}
|
|
104
290
|
|
|
105
291
|
.box {
|
|
106
292
|
position: relative;
|
|
107
293
|
flex-shrink: 0;
|
|
108
|
-
border: 1px solid var(--c-divider);
|
|
109
|
-
|
|
110
|
-
width: 40px;
|
|
111
|
-
height: 22px;
|
|
112
|
-
background-color: var(--c-bg-elv-down);
|
|
294
|
+
border: 1px solid var(--c-divider-1);
|
|
295
|
+
background-color: var(--input-switch-bg-color);
|
|
113
296
|
transition: border-color 0.25s, background-color 0.25s, box-shadow 0.25s;
|
|
114
297
|
}
|
|
115
298
|
|
|
116
|
-
.
|
|
299
|
+
.toggle {
|
|
117
300
|
position: absolute;
|
|
118
301
|
border-radius: 50%;
|
|
119
|
-
background-color: var(--
|
|
120
|
-
|
|
121
|
-
left: 2px;
|
|
122
|
-
width: 16px;
|
|
123
|
-
height: 16px;
|
|
124
|
-
transition: background-color .25s, transform .25s;
|
|
125
|
-
|
|
126
|
-
.dark & {
|
|
127
|
-
background-color: var(--c-white);
|
|
128
|
-
}
|
|
302
|
+
background-color: var(--input-switch-toggle-color);
|
|
303
|
+
transition: background-color 0.25s, transform 0.25s;
|
|
129
304
|
}
|
|
130
305
|
</style>
|
|
@@ -6,7 +6,7 @@ import SInputBase from './SInputBase.vue'
|
|
|
6
6
|
import SInputSwitch from './SInputSwitch.vue'
|
|
7
7
|
|
|
8
8
|
export type Size = 'mini' | 'small' | 'medium'
|
|
9
|
-
export type
|
|
9
|
+
export type CheckColor = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
|
|
10
10
|
|
|
11
11
|
export interface Option {
|
|
12
12
|
label: string
|
|
@@ -22,7 +22,7 @@ const props = defineProps<{
|
|
|
22
22
|
help?: string
|
|
23
23
|
checkIcon?: IconifyIcon | DefineComponent
|
|
24
24
|
checkText?: string
|
|
25
|
-
checkColor?:
|
|
25
|
+
checkColor?: CheckColor
|
|
26
26
|
options: Option[]
|
|
27
27
|
disabled?: boolean
|
|
28
28
|
modelValue: (string | number | boolean)[]
|
package/lib/components/SPill.vue
CHANGED
|
@@ -4,8 +4,10 @@ import { Ref, ref, unref } from 'vue'
|
|
|
4
4
|
export type DropdownSection =
|
|
5
5
|
| DropdownSectionMenu
|
|
6
6
|
| DropdownSectionFilter
|
|
7
|
+
| DropdownSectionComponent
|
|
8
|
+
| DropdownSectionActions
|
|
7
9
|
|
|
8
|
-
export type DropdownSectionType = 'menu' | 'filter'
|
|
10
|
+
export type DropdownSectionType = 'menu' | 'filter' | 'actions' | 'component'
|
|
9
11
|
|
|
10
12
|
export interface DropdownSectionBase {
|
|
11
13
|
type: DropdownSectionType
|
|
@@ -56,6 +58,22 @@ export interface DropdownSectionFilterOptionAvatar extends DropdownSectionFilter
|
|
|
56
58
|
image?: string | null
|
|
57
59
|
}
|
|
58
60
|
|
|
61
|
+
export interface DropdownSectionActions extends DropdownSectionBase {
|
|
62
|
+
type: 'actions'
|
|
63
|
+
options: DropdownSectionActionsOption[]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface DropdownSectionActionsOption {
|
|
67
|
+
mode?: 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
|
|
68
|
+
label: string
|
|
69
|
+
onClick(): void
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface DropdownSectionComponent extends DropdownSectionBase {
|
|
73
|
+
type: 'component'
|
|
74
|
+
component: any
|
|
75
|
+
}
|
|
76
|
+
|
|
59
77
|
export interface ManualDropdownPosition {
|
|
60
78
|
container: Ref<any>
|
|
61
79
|
position: Ref<'top' | 'bottom'>
|
package/lib/styles/base.css
CHANGED
|
@@ -9,17 +9,11 @@ body {
|
|
|
9
9
|
min-width: 320px;
|
|
10
10
|
min-height: 100vh;
|
|
11
11
|
font-family: var(--font-family-base);
|
|
12
|
-
letter-spacing: .4px;
|
|
13
12
|
line-height: 24px;
|
|
14
13
|
font-size: 16px;
|
|
15
14
|
font-weight: 400;
|
|
16
15
|
color: var(--c-text-1);
|
|
17
16
|
background-color: var(--c-bg);
|
|
18
|
-
direction: ltr;
|
|
19
|
-
font-synthesis: none;
|
|
20
|
-
text-rendering: optimizeLegibility;
|
|
21
|
-
-webkit-font-smoothing: antialiased;
|
|
22
|
-
-moz-osx-font-smoothing: grayscale;
|
|
23
17
|
}
|
|
24
18
|
|
|
25
19
|
blockquote,
|
|
@@ -103,7 +97,6 @@ iframe,
|
|
|
103
97
|
embed,
|
|
104
98
|
object {
|
|
105
99
|
display: block;
|
|
106
|
-
vertical-align: middle;
|
|
107
100
|
}
|
|
108
101
|
|
|
109
102
|
img,
|
|
@@ -119,6 +112,7 @@ select,
|
|
|
119
112
|
textarea {
|
|
120
113
|
border: 0;
|
|
121
114
|
padding: 0;
|
|
115
|
+
letter-spacing: inherit;
|
|
122
116
|
line-height: inherit;
|
|
123
117
|
color: inherit;
|
|
124
118
|
}
|
|
@@ -171,17 +165,20 @@ textarea {
|
|
|
171
165
|
|
|
172
166
|
input[type="number"] {
|
|
173
167
|
-moz-appearance: textfield;
|
|
168
|
+
appearance: textfield;
|
|
174
169
|
}
|
|
175
170
|
|
|
176
171
|
input[type="number"]::-webkit-outer-spin-button,
|
|
177
172
|
input[type="number"]::-webkit-inner-spin-button {
|
|
178
|
-
-webkit-appearance: none;
|
|
179
173
|
margin: 0;
|
|
174
|
+
-webkit-appearance: none;
|
|
175
|
+
appearance: none;
|
|
180
176
|
}
|
|
181
177
|
|
|
182
178
|
input[type="select"],
|
|
183
179
|
select {
|
|
184
180
|
-webkit-appearance: none;
|
|
181
|
+
appearance: none;
|
|
185
182
|
}
|
|
186
183
|
|
|
187
184
|
fieldset {
|
package/lib/styles/variables.css
CHANGED
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
--c-neutral-dark-dimm-2: rgba(255, 255, 255, 0.24);
|
|
59
59
|
|
|
60
60
|
--c-text-light-1: #1f1f1f;
|
|
61
|
-
--c-text-light-2: rgba(60, 60, 67, 0.
|
|
62
|
-
--c-text-light-3: rgba(60, 60, 67, 0.
|
|
61
|
+
--c-text-light-2: rgba(60, 60, 67, 0.72);
|
|
62
|
+
--c-text-light-3: rgba(60, 60, 67, 0.39);
|
|
63
63
|
|
|
64
64
|
--c-text-dark-1: rgba(235, 235, 245, 0.98);
|
|
65
65
|
--c-text-dark-2: rgba(235, 235, 245, 0.6);
|
|
@@ -198,6 +198,8 @@
|
|
|
198
198
|
--c-text-inverse-2: var(--c-text-dark-2);
|
|
199
199
|
--c-text-inverse-3: var(--c-text-dark-3);
|
|
200
200
|
|
|
201
|
+
--c-soft: var(--c-white-soft);
|
|
202
|
+
|
|
201
203
|
--c-mute: #f1f1f1;
|
|
202
204
|
--c-mute-light: #f9f9f9;
|
|
203
205
|
--c-mute-lighter: #ffffff;
|
|
@@ -251,6 +253,8 @@
|
|
|
251
253
|
--c-text-inverse-2: var(--c-text-light-2);
|
|
252
254
|
--c-text-inverse-3: var(--c-text-light-3);
|
|
253
255
|
|
|
256
|
+
--c-soft: #222226;
|
|
257
|
+
|
|
254
258
|
--c-mute: #2c2c2e;
|
|
255
259
|
--c-mute-light: #3a3a3c;
|
|
256
260
|
--c-mute-lighter: #505053;
|
|
@@ -662,4 +666,14 @@
|
|
|
662
666
|
--input-mini-label-font-size: 12px;
|
|
663
667
|
--input-small-label-font-size: 14px;
|
|
664
668
|
--input-medium-label-font-size: 14px;
|
|
669
|
+
|
|
670
|
+
--input-switch-toggle-color: var(--c-neutral-1);
|
|
671
|
+
--input-switch-bg-color: var(--c-mute);
|
|
672
|
+
--input-switch-disabled-toggle-color: var(--c-gray);
|
|
673
|
+
--input-switch-disabled-bg-color: var(--c-mute);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
.dark {
|
|
677
|
+
--input-switch-bg-color: var(--c-bg-elv-1);
|
|
678
|
+
--input-switch-disabled-bg-color: var(--c-mute);
|
|
665
679
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface Hms {
|
|
2
|
-
hour?: string
|
|
3
|
-
minute?: string
|
|
4
|
-
second?: string
|
|
2
|
+
hour?: string | null
|
|
3
|
+
minute?: string | null
|
|
4
|
+
second?: string | null
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export type HmsType = 'h' | 'm' | 's'
|
|
@@ -13,5 +13,5 @@ export const HmsMap = {
|
|
|
13
13
|
} as const
|
|
14
14
|
|
|
15
15
|
export function requiredHms(hms: Hms, required: HmsType[] = ['h', 'm', 's']): boolean {
|
|
16
|
-
return required.every((r) => hms[HmsMap[r]]
|
|
16
|
+
return required.every((r) => hms[HmsMap[r]] != null)
|
|
17
17
|
}
|
|
@@ -3,5 +3,5 @@ import { Ymd, YmdMap, YmdType } from './ymd'
|
|
|
3
3
|
export type { Ymd, YmdType, YmdMap }
|
|
4
4
|
|
|
5
5
|
export function requiredYmd(ymd: Ymd, required: YmdType[] = ['y', 'm', 'd']): boolean {
|
|
6
|
-
return required.every((r) => ymd[YmdMap[r]]
|
|
6
|
+
return required.every((r) => ymd[YmdMap[r]] != null)
|
|
7
7
|
}
|