@globalbrain/sefirot 2.20.0 → 2.22.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.
Files changed (59) hide show
  1. package/lib/components/SDropdown.vue +1 -1
  2. package/lib/components/SDropdownSection.vue +11 -1
  3. package/lib/components/SDropdownSectionActions.vue +61 -0
  4. package/lib/components/SDropdownSectionComponent.vue +11 -0
  5. package/lib/components/SDropdownSectionFilter.vue +3 -3
  6. package/lib/components/SDropdownSectionFilterItem.vue +1 -1
  7. package/lib/components/SDropdownSectionMenu.vue +1 -1
  8. package/lib/components/SIcon.vue +1 -1
  9. package/lib/components/SInputAddon.vue +1 -1
  10. package/lib/components/SInputBase.vue +6 -3
  11. package/lib/components/SInputCheckbox.vue +3 -3
  12. package/lib/components/SInputCheckboxes.vue +2 -2
  13. package/lib/components/SInputDate.vue +6 -4
  14. package/lib/components/SInputDropdown.vue +6 -4
  15. package/lib/components/SInputFile.vue +4 -3
  16. package/lib/components/SInputHMS.vue +4 -3
  17. package/lib/components/SInputNumber.vue +6 -5
  18. package/lib/components/SInputRadio.vue +3 -3
  19. package/lib/components/SInputRadios.vue +4 -3
  20. package/lib/components/SInputSelect.vue +4 -3
  21. package/lib/components/SInputSwitch.vue +217 -41
  22. package/lib/components/SInputSwitches.vue +6 -5
  23. package/lib/components/SInputText.vue +4 -3
  24. package/lib/components/SInputTextarea.vue +38 -32
  25. package/lib/components/SInputYMD.vue +4 -3
  26. package/lib/components/SMarkdown.vue +2 -1
  27. package/lib/components/SSheetFooterAction.vue +2 -1
  28. package/lib/components/SSnackbar.vue +2 -1
  29. package/lib/components/SStep.vue +2 -2
  30. package/lib/components/SSteps.vue +5 -4
  31. package/lib/components/STable.vue +1 -1
  32. package/lib/components/STableCell.vue +1 -1
  33. package/lib/components/STableCellAvatars.vue +1 -1
  34. package/lib/components/STableCellDay.vue +1 -1
  35. package/lib/components/STableCellPills.vue +1 -1
  36. package/lib/components/STableColumn.vue +1 -1
  37. package/lib/components/STooltip.vue +2 -1
  38. package/lib/composables/Data.ts +2 -1
  39. package/lib/composables/Dropdown.ts +23 -3
  40. package/lib/composables/Flyout.ts +2 -1
  41. package/lib/composables/Form.ts +6 -3
  42. package/lib/composables/Grid.ts +2 -1
  43. package/lib/composables/Markdown.ts +4 -2
  44. package/lib/composables/Table.ts +4 -3
  45. package/lib/composables/Tooltip.ts +2 -1
  46. package/lib/composables/Utils.ts +4 -2
  47. package/lib/composables/Validation.ts +5 -3
  48. package/lib/composables/markdown/LinkPlugin.ts +1 -1
  49. package/lib/mixins/Sheet.ts +1 -1
  50. package/lib/styles/variables.css +20 -10
  51. package/lib/support/Day.ts +2 -1
  52. package/lib/validation/rules/hms.ts +2 -1
  53. package/lib/validation/rules/requiredHms.ts +2 -1
  54. package/lib/validation/rules/requiredYmd.ts +2 -1
  55. package/lib/validation/rules/ymd.ts +2 -1
  56. package/lib/validation/validators/hms.ts +6 -6
  57. package/lib/validation/validators/requiredHms.ts +4 -4
  58. package/lib/validation/validators/requiredYmd.ts +3 -2
  59. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { DropdownSection } from '../composables/Dropdown'
2
+ import type { DropdownSection } from '../composables/Dropdown'
3
3
  import SDropdownSection from './SDropdownSection.vue'
4
4
 
5
5
  defineProps<{
@@ -1,5 +1,7 @@
1
1
  <script setup lang="ts">
2
- import { DropdownSection } from '../composables/Dropdown'
2
+ import type { 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 type { 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>
@@ -0,0 +1,11 @@
1
+ <script setup lang="ts">
2
+ import type { DefineComponent } from 'vue'
3
+
4
+ defineProps<{
5
+ comp: DefineComponent
6
+ }>()
7
+ </script>
8
+
9
+ <template>
10
+ <Component :is="comp" />
11
+ </template>
@@ -1,9 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  import IconCheck from '@iconify-icons/ph/check'
3
- import { MaybeRef } from '@vueuse/core'
3
+ import type { MaybeRef } from '@vueuse/core'
4
4
  import Fuse from 'fuse.js'
5
5
  import { computed, onMounted, ref, unref } from 'vue'
6
- import { DropdownSectionFilterOption, DropdownSectionFilterSelectedValue } from '../composables/Dropdown'
6
+ import type { DropdownSectionFilterOption, DropdownSectionFilterSelectedValue } from '../composables/Dropdown'
7
7
  import { isArray } from '../support/Utils'
8
8
  import SDropdownSectionFilterItem from './SDropdownSectionFilterItem.vue'
9
9
  import SIcon from './SIcon.vue'
@@ -23,7 +23,7 @@ const fuse = computed(() => {
23
23
  })
24
24
 
25
25
  const filteredOptions = computed(() => {
26
- return !props.search || !query.value
26
+ return (!props.search || !query.value)
27
27
  ? unref(props.options)
28
28
  : fuse.value.search(query.value).map((r) => r.item)
29
29
  })
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { DropdownSectionFilterOption } from '../composables/Dropdown'
2
+ import type { DropdownSectionFilterOption } from '../composables/Dropdown'
3
3
  import SDropdownSectionFilterItemAvatar from './SDropdownSectionFilterItemAvatar.vue'
4
4
  import SDropdownSectionFilterItemText from './SDropdownSectionFilterItemText.vue'
5
5
 
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { DropdownSectionMenuOption } from '../composables/Dropdown'
2
+ import type { DropdownSectionMenuOption } from '../composables/Dropdown'
3
3
 
4
4
  defineProps<{
5
5
  options: DropdownSectionMenuOption[]
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { Icon, IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { DefineComponent } from 'vue'
3
+ import type { DefineComponent } from 'vue'
4
4
 
5
5
  defineProps<{
6
6
  icon: IconifyIcon | DefineComponent
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import IconCaretDown from '@iconify-icons/ph/caret-down-bold'
3
+ import type { DropdownSection } from 'sefirot/composables/Dropdown'
3
4
  import {
4
- DropdownSection,
5
5
  getSelectedOption,
6
6
  useManualDropdownPosition
7
7
  } from 'sefirot/composables/Dropdown'
@@ -1,8 +1,9 @@
1
1
  <script setup lang="ts">
2
+ import type { IconifyIcon } from '@iconify/vue/dist/offline'
2
3
  import IconQuestion from '@iconify-icons/ph/question'
3
- import { IconifyIcon } from '@iconify/vue/dist/offline'
4
- import { DefineComponent, computed, unref, useSlots } from 'vue'
5
- import { Validatable } from '../composables/Validation'
4
+ import type { DefineComponent } from 'vue'
5
+ import { computed, unref, useSlots } from 'vue'
6
+ import type { Validatable } from '../composables/Validation'
6
7
  import SIcon from './SIcon.vue'
7
8
  import STooltip from './STooltip.vue'
8
9
 
@@ -122,11 +123,13 @@ function getErrorMsg(validation: Validatable) {
122
123
  display: flex;
123
124
  align-items: center;
124
125
  gap: 4px;
126
+ transition: color 0.25s;
125
127
  }
126
128
 
127
129
  .label-text-value {
128
130
  font-weight: 500;
129
131
  color: var(--input-label-color);
132
+ transition: color 0.25s;
130
133
  }
131
134
 
132
135
  .label-text-info {
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
+ import type { IconifyIcon } from '@iconify/vue/dist/offline'
2
3
  import IconCheck from '@iconify-icons/ph/check'
3
- import { IconifyIcon } from '@iconify/vue/dist/offline'
4
- import { DefineComponent, PropType } from 'vue'
5
- import { Validatable } from '../composables/Validation'
4
+ import type { DefineComponent, PropType } from 'vue'
5
+ import type { Validatable } from '../composables/Validation'
6
6
  import SIcon from './SIcon.vue'
7
7
  import SInputBase from './SInputBase.vue'
8
8
 
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
- import { IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { DefineComponent, PropType } from 'vue'
2
+ import type { IconifyIcon } from '@iconify/vue/dist/offline'
3
+ import type { DefineComponent, PropType } from 'vue'
4
4
  import SInputBase from './SInputBase.vue'
5
5
  import SInputCheckbox from './SInputCheckbox.vue'
6
6
 
@@ -1,9 +1,11 @@
1
1
  <script setup lang="ts">
2
- import { IconifyIcon } from '@iconify/vue/dist/offline'
2
+ import type { IconifyIcon } from '@iconify/vue/dist/offline'
3
3
  import { DatePicker } from 'v-calendar'
4
- import { DefineComponent, computed } from 'vue'
5
- import { Validatable } from '../composables/Validation'
6
- import { Day, day } from '../support/Day'
4
+ import type { DefineComponent } from 'vue'
5
+ import { computed } from 'vue'
6
+ import type { Validatable } from '../composables/Validation'
7
+ import type { Day } from '../support/Day'
8
+ import { day } from '../support/Day'
7
9
  import SInputBase from './SInputBase.vue'
8
10
 
9
11
  export type Color = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
@@ -1,12 +1,14 @@
1
1
  <script setup lang="ts">
2
+ import type { IconifyIcon } from '@iconify/vue/dist/offline'
2
3
  import IconCaretDown from '@iconify-icons/ph/caret-down-bold'
3
4
  import IconCaretUp from '@iconify-icons/ph/caret-up-bold'
4
- import { IconifyIcon } from '@iconify/vue/dist/offline'
5
5
  import xor from 'lodash-es/xor'
6
- import { DefineComponent, computed, ref } from 'vue'
7
- import { DropdownSectionFilter, useManualDropdownPosition } from '../composables/Dropdown'
6
+ import type { DefineComponent } from 'vue'
7
+ import { computed, ref } from 'vue'
8
+ import type { DropdownSectionFilter } from '../composables/Dropdown'
9
+ import { useManualDropdownPosition } from '../composables/Dropdown'
8
10
  import { useFlyout } from '../composables/Flyout'
9
- import { Validatable } from '../composables/Validation'
11
+ import type { Validatable } from '../composables/Validation'
10
12
  import { isArray } from '../support/Utils'
11
13
  import SDropdown from './SDropdown.vue'
12
14
  import SIcon from './SIcon.vue'
@@ -1,7 +1,8 @@
1
1
  <script setup lang="ts">
2
- import { IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { DefineComponent, computed, ref } from 'vue'
4
- import { Validatable } from '../composables/Validation'
2
+ import type { IconifyIcon } from '@iconify/vue/dist/offline'
3
+ import type { DefineComponent } from 'vue'
4
+ import { computed, ref } from 'vue'
5
+ import type { Validatable } from '../composables/Validation'
5
6
  import SInputBase from './SInputBase.vue'
6
7
 
7
8
  export type Size = 'mini' | 'small' | 'medium'
@@ -1,7 +1,8 @@
1
1
  <script setup lang="ts">
2
- import { IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { DefineComponent, computed, ref } from 'vue'
4
- import { Validatable } from '../composables/Validation'
2
+ import type { IconifyIcon } from '@iconify/vue/dist/offline'
3
+ import type { DefineComponent } from 'vue'
4
+ import { computed, ref } from 'vue'
5
+ import type { Validatable } from '../composables/Validation'
5
6
  import SInputBase from './SInputBase.vue'
6
7
 
7
8
  export type Size = 'mini' | 'small' | 'medium'
@@ -1,7 +1,8 @@
1
1
  <script setup lang="ts">
2
- import { IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { DefineComponent, computed } from 'vue'
4
- import { Validatable } from '../composables/Validation'
2
+ import type { IconifyIcon } from '@iconify/vue/dist/offline'
3
+ import type { DefineComponent } from 'vue'
4
+ import { computed } from 'vue'
5
+ import type { Validatable } from '../composables/Validation'
5
6
  import { isNullish, isString } from '../support/Utils'
6
7
  import SInputText from './SInputText.vue'
7
8
 
@@ -40,7 +41,7 @@ const emit = defineEmits<{
40
41
  }>()
41
42
 
42
43
  const _value = computed(() => {
43
- return props.modelValue !== undefined
44
+ return (props.modelValue !== undefined)
44
45
  ? props.modelValue
45
46
  : props.value !== undefined ? props.value : null
46
47
  })
@@ -72,7 +73,7 @@ const displayValue = computed(() => {
72
73
  return props.displayValue
73
74
  }
74
75
 
75
- return !props.separator || valueWithSeparator.value === null
76
+ return (!props.separator || valueWithSeparator.value === null)
76
77
  ? null
77
78
  : valueWithSeparator.value
78
79
  })
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
- import { IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { DefineComponent } from 'vue'
4
- import { Validatable } from '../composables/Validation'
2
+ import type { IconifyIcon } from '@iconify/vue/dist/offline'
3
+ import type { DefineComponent } from 'vue'
4
+ import type { Validatable } from '../composables/Validation'
5
5
  import SInputBase from './SInputBase.vue'
6
6
 
7
7
  export type Size = 'mini' | 'small' | 'medium'
@@ -1,7 +1,8 @@
1
1
  <script setup lang="ts">
2
- import { IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { DefineComponent, computed } from 'vue'
4
- import { Validatable } from '../composables/Validation'
2
+ import type { IconifyIcon } from '@iconify/vue/dist/offline'
3
+ import type { DefineComponent } from 'vue'
4
+ import { computed } from 'vue'
5
+ import type { Validatable } from '../composables/Validation'
5
6
  import SInputBase from './SInputBase.vue'
6
7
  import SInputRadio from './SInputRadio.vue'
7
8
 
@@ -1,9 +1,10 @@
1
1
  <script setup lang="ts">
2
+ import type { IconifyIcon } from '@iconify/vue/dist/offline'
2
3
  import IconCaretDown from '@iconify-icons/ph/caret-down-bold'
3
4
  import IconCaretUp from '@iconify-icons/ph/caret-up-bold'
4
- import { IconifyIcon } from '@iconify/vue/dist/offline'
5
- import { DefineComponent, computed, ref } from 'vue'
6
- import { Validatable } from '../composables/Validation'
5
+ import type { DefineComponent } from 'vue'
6
+ import { computed, ref } from 'vue'
7
+ import type { Validatable } from '../composables/Validation'
7
8
  import SIcon from './SIcon.vue'
8
9
  import SInputBase from './SInputBase.vue'
9
10
 
@@ -1,40 +1,58 @@
1
1
  <script setup lang="ts">
2
- import { IconifyIcon } from '@iconify/vue/dist/offline'
3
- import { DefineComponent, computed } from 'vue'
4
- import { Validatable } from '../composables/Validation'
2
+ import type { IconifyIcon } from '@iconify/vue/dist/offline'
3
+ import type { DefineComponent } from 'vue'
4
+ import { computed } from 'vue'
5
+ import type { Validatable } from '../composables/Validation'
5
6
  import SInputBase from './SInputBase.vue'
6
7
 
7
8
  export type Size = 'mini' | 'small' | 'medium'
8
- export type Color = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
9
+ export type ActiveColor = 'info' | 'success' | 'warning' | 'danger'
10
+ export type CheckColor = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
9
11
 
10
- const props = defineProps<{
12
+ const props = withDefaults(defineProps<{
11
13
  size?: Size
12
14
  name?: string
13
15
  label?: string
14
16
  info?: string
15
17
  note?: string
16
18
  text?: string
19
+ color?: ActiveColor
17
20
  help?: string
18
21
  checkIcon?: IconifyIcon | DefineComponent
19
22
  checkText?: string
20
- checkColor?: Color
23
+ checkColor?: CheckColor
21
24
  disabled?: boolean
22
- modelValue: boolean
25
+ value?: boolean
26
+ modelValue?: boolean
23
27
  hideError?: boolean
24
28
  validation?: Validatable
25
- }>()
29
+ }>(), {
30
+ value: undefined,
31
+ modelValue: undefined
32
+ })
26
33
 
27
34
  const emit = defineEmits<{
28
- (e: 'update:modelValue', value: boolean): void
35
+ (e: 'update:model-value', value: boolean): void
36
+ (e: 'change', value: boolean): void
29
37
  }>()
30
38
 
39
+ const _value = computed(() => {
40
+ return props.modelValue !== undefined
41
+ ? props.modelValue
42
+ : props.value !== undefined ? props.value : false
43
+ })
44
+
31
45
  const classes = computed(() => [
32
- [props.size ?? 'small'],
46
+ props.size ?? 'small',
47
+ props.color ?? 'info',
33
48
  { disabled: props.disabled }
34
49
  ])
35
50
 
36
51
  function emitChange(): void {
37
- !props.disabled && emit('update:modelValue', !props.modelValue)
52
+ if (!props.disabled) {
53
+ emit('update:model-value', !_value.value)
54
+ emit('change', !_value.value)
55
+ }
38
56
  }
39
57
  </script>
40
58
 
@@ -53,11 +71,10 @@ function emitChange(): void {
53
71
  :hide-error="hideError"
54
72
  >
55
73
  <div class="container">
56
- <div class="input" :class="{ on: modelValue }" role="button" @click="emitChange">
74
+ <div class="input" :class="{ on: _value }" role="button" @click="emitChange">
57
75
  <p v-if="text" class="text">{{ text }}</p>
58
-
59
76
  <div class="box">
60
- <div class="check" />
77
+ <div class="toggle" />
61
78
  </div>
62
79
  </div>
63
80
  </div>
@@ -65,7 +82,185 @@ function emitChange(): void {
65
82
  </SInputBase>
66
83
  </template>
67
84
 
68
- <style lang="postcss" scoped>
85
+ <style scoped lang="postcss">
86
+ .SInputSwitch.mini {
87
+ .input {
88
+ height: 32px;
89
+ }
90
+
91
+ .text {
92
+ line-height: 20px;
93
+ font-size: 14px;
94
+ }
95
+
96
+ .box {
97
+ border-radius: 9px;
98
+ width: 32px;
99
+ height: 18px;
100
+ }
101
+
102
+ .toggle {
103
+ top: 1px;
104
+ left: 1px;
105
+ width: 14px;
106
+ height: 14px;
107
+ }
108
+
109
+ .input.on .toggle {
110
+ transform: translateX(14px);
111
+ }
112
+ }
113
+
114
+ .SInputSwitch.small {
115
+ .input {
116
+ height: 32px;
117
+ }
118
+
119
+ .text {
120
+ line-height: 20px;
121
+ font-size: 14px;
122
+ }
123
+
124
+ .box {
125
+ border-radius: 11px;
126
+ width: 40px;
127
+ height: 22px;
128
+ }
129
+
130
+ .toggle {
131
+ top: 2px;
132
+ left: 2px;
133
+ width: 16px;
134
+ height: 16px;
135
+ }
136
+
137
+ .input.on .toggle {
138
+ transform: translateX(18px);
139
+ }
140
+ }
141
+
142
+ .SInputSwitch.medium {
143
+ .input {
144
+ height: 32px;
145
+ }
146
+
147
+ .text {
148
+ line-height: 20px;
149
+ font-size: 14px;
150
+ }
151
+
152
+ .box {
153
+ border-radius: 13px;
154
+ width: 46px;
155
+ height: 26px;
156
+ }
157
+
158
+ .toggle {
159
+ top: 3px;
160
+ left: 3px;
161
+ width: 18px;
162
+ height: 18px;
163
+ }
164
+
165
+ .input.on .toggle {
166
+ transform: translateX(20px);
167
+ }
168
+ }
169
+
170
+ .SInputSwitch.info {
171
+ .box:hover {
172
+ border-color: var(--c-info-light);
173
+ }
174
+
175
+ .input.on .box {
176
+ border-color: var(--c-info-light);
177
+ background-color: var(--c-info);
178
+ }
179
+ }
180
+
181
+ .SInputSwitch.success {
182
+ .box:hover {
183
+ border-color: var(--c-success-light);
184
+ }
185
+
186
+ .input.on .box {
187
+ border-color: var(--c-success-light);
188
+ background-color: var(--c-success);
189
+ }
190
+ }
191
+
192
+ .SInputSwitch.warning {
193
+ .box:hover {
194
+ border-color: var(--c-warning-light);
195
+ }
196
+
197
+ .input.on .box {
198
+ border-color: var(--c-warning-light);
199
+ background-color: var(--c-warning);
200
+ }
201
+ }
202
+
203
+ .SInputSwitch.danger {
204
+ .box:hover {
205
+ border-color: var(--c-danger-light);
206
+ }
207
+
208
+ .input.on .box {
209
+ border-color: var(--c-danger-light);
210
+ background-color: var(--c-danger);
211
+ }
212
+ }
213
+
214
+ .SInputSwitch.disabled {
215
+ .input {
216
+ cursor: not-allowed;
217
+ }
218
+
219
+ .box {
220
+ background-color: var(--input-switch-disabled-bg-color);
221
+ }
222
+
223
+ .box:hover {
224
+ border-color: var(--c-divider-1);
225
+ }
226
+
227
+ .toggle {
228
+ background-color: var(--input-switch-disabled-toggle-color);
229
+ }
230
+
231
+ .input.on .toggle {
232
+ opacity: 0.5;
233
+ }
234
+
235
+ &.info {
236
+ .input.on .box {
237
+ border-color: var(--c-info);
238
+ background-color: var(--c-info-dark);
239
+ }
240
+ }
241
+
242
+ &.success {
243
+ .input.on .box {
244
+ border-color: var(--c-success);
245
+ background-color: var(--c-success-dark);
246
+ }
247
+ }
248
+
249
+ &.warning {
250
+ .input.on .box {
251
+ border-color: var(--c-warning);
252
+ background-color: var(--c-warning-dark);
253
+ }
254
+ }
255
+
256
+ &.danger {
257
+ .input.on .box {
258
+ border-color: var(--c-danger);
259
+ background-color: var(--c-danger-dark);
260
+ }
261
+ }
262
+ }
263
+
69
264
  .container {
70
265
  display: flex;
71
266
  }
@@ -76,11 +271,7 @@ function emitChange(): void {
76
271
  justify-content: space-between;
77
272
  align-items: center;
78
273
  width: 100%;
79
- height: 32px;
80
-
81
- &:hover {
82
- .box { border-color: var(--c-info); }
83
- }
274
+ cursor: pointer;
84
275
  }
85
276
 
86
277
  .input.on .box {
@@ -88,43 +279,28 @@ function emitChange(): void {
88
279
  background-color: var(--c-info);
89
280
  }
90
281
 
91
- .input.on .check {
282
+ .input.on .toggle {
92
283
  background-color: var(--c-white);
93
- transform: translateX(18px);
94
284
  }
95
285
 
96
286
  .text {
97
287
  flex-grow: 1;
98
288
  margin: 0;
99
289
  padding-right: 16px;
100
- line-height: 20px;
101
- font-size: 14px;
102
- font-weight: 500;
103
290
  }
104
291
 
105
292
  .box {
106
293
  position: relative;
107
294
  flex-shrink: 0;
108
- border: 1px solid var(--c-divider);
109
- border-radius: 11px;
110
- width: 40px;
111
- height: 22px;
112
- background-color: var(--c-bg-elv-down);
295
+ border: 1px solid var(--c-divider-1);
296
+ background-color: var(--input-switch-bg-color);
113
297
  transition: border-color 0.25s, background-color 0.25s, box-shadow 0.25s;
114
298
  }
115
299
 
116
- .check {
300
+ .toggle {
117
301
  position: absolute;
118
302
  border-radius: 50%;
119
- background-color: var(--c-black);
120
- top: 2px;
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
- }
303
+ background-color: var(--input-switch-toggle-color);
304
+ transition: background-color 0.25s, transform 0.25s;
129
305
  }
130
306
  </style>