@bagelink/vue 0.0.211 → 0.0.216

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.
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <div
3
+ class="bagel-input bgl-checkbox"
4
+ :title="title"
5
+ :class="{ small: small, 'no-edit': !editMode }"
6
+ >
7
+ <div class="switch">
8
+ <input
9
+ :id="id"
10
+ type="checkbox"
11
+ v-model="inputVal"
12
+ :class="{ 'no-edit': !editMode }"
13
+ >
14
+ <span class="slider round" />
15
+ </div>
16
+ <label :for="id">
17
+ {{ label }}
18
+ </label>
19
+ </div>
20
+ </template>
21
+
22
+ <script setup lang="ts">
23
+ withDefaults(
24
+ defineProps<{
25
+ label: string;
26
+ id?: string;
27
+ title?: string;
28
+ editMode?: boolean;
29
+ small?: boolean;
30
+ }>(),
31
+ {
32
+ editMode: true,
33
+ id: Math.random().toString(36).substring(7),
34
+ },
35
+ );
36
+
37
+ const inputVal = defineModel<boolean>('modelValue', { default: false });
38
+ </script>
39
+
40
+ <style scoped>
41
+ .bgl-checkbox{
42
+ position: relative;
43
+ }
44
+ .bgl-checkbox input[type=checkbox]{
45
+ display: none;
46
+ }
47
+ .bgl-checkbox label{
48
+ padding-inline-start: calc(var(--input-height) + 0.25rem);
49
+ transition: var(--bgl-transition);
50
+ cursor: pointer;
51
+ user-select: none;
52
+ }
53
+ .bgl-checkbox:hover{
54
+ filter: brightness(90%);
55
+ }
56
+ .bgl-checkbox:active{
57
+ filter: var(--bgl-active-filter);
58
+ }
59
+
60
+ .switch {
61
+ position: absolute;
62
+ display: inline-block;
63
+ height: calc(var(--input-height) / 2);
64
+ width: var(--input-height);
65
+ border-radius: var(--input-height);
66
+ background: var(--bgl-gray);
67
+ outline: 1px solid var(--bgl-black);
68
+ margin-top: 0.15rem;
69
+ pointer-events: none;
70
+ }
71
+
72
+ .switch input {
73
+ opacity: 0;
74
+ width: 0;
75
+ height: 0;
76
+ }
77
+
78
+ .slider {
79
+ position: absolute;
80
+ cursor: pointer;
81
+ top: 0;
82
+ left: 0;
83
+ right: 0;
84
+ bottom: 0;
85
+ background: var(--input-bg);
86
+ -webkit-transition: 0.4s;
87
+ transition: 0.4s;
88
+ border-radius: calc(var(--input-height) / 2);
89
+ box-shadow: inset 0 0 10px #00000020;
90
+ }
91
+
92
+ .slider:before {
93
+ position: absolute;
94
+ content: "";
95
+ height: calc(var(--input-height) / 2 - 4px);
96
+ width: calc(var(--input-height) / 2 - 4px);
97
+ left: 2px;
98
+ bottom: 2px;
99
+ border-radius: 50%;
100
+ background: var(--bgl-white);
101
+ -webkit-transition: 0.4s;
102
+ transition: 0.4s;
103
+ }
104
+
105
+ input:checked + .slider {
106
+ background: var(--bgl-primary);
107
+ }
108
+
109
+ input:checked + .slider:before {
110
+ transform: translateX(calc(var(--input-height) / 2));
111
+ }
112
+ </style>
@@ -1,36 +1,36 @@
1
1
  <template>
2
- <div
3
- class="bagel-input checkbox"
4
- :class="{ check: context?.attrs.isCheckbox }"
5
- :title="context?.help"
6
- >
7
- <label class="switch">
8
- <input
9
- @change="() => props.context?.node.input(inputVal)"
10
- type="checkbox"
11
- v-model="inputVal"
12
- :id="context?.id"
13
- />
14
- <span class="slider round" />
15
- </label>
16
- </div>
2
+ <div
3
+ class="bagel-input checkbox"
4
+ :class="{ check: context?.attrs.isCheckbox }"
5
+ :title="context?.help"
6
+ >
7
+ <label class="switch">
8
+ <input
9
+ @change="() => props.context?.node.input(inputVal)"
10
+ type="checkbox"
11
+ v-model="inputVal"
12
+ :id="context?.id"
13
+ >
14
+ <span class="slider round" />
15
+ </label>
16
+ </div>
17
17
  </template>
18
18
 
19
19
  <script setup lang="ts">
20
- import { watch } from "vue";
20
+ import { watch } from 'vue';
21
21
 
22
22
  const props = defineProps({
23
- context: Object,
23
+ context: Object,
24
24
  });
25
25
 
26
26
  let inputVal = $ref(false);
27
27
 
28
28
  watch(
29
- () => props.context?.value,
30
- (newVal) => {
31
- inputVal = newVal;
32
- },
33
- { immediate: true }
29
+ () => props.context?.value,
30
+ (newVal) => {
31
+ inputVal = newVal;
32
+ },
33
+ { immediate: true },
34
34
  );
35
35
  </script>
36
36
 
@@ -8,7 +8,6 @@
8
8
  --bgl-primary: #2E5BFF;
9
9
  --bgl-primary-tint: #2E5BFF80;
10
10
  --bgl-primary-light: #eef6ff;
11
-
12
11
  --bgl-blue-20: rgba(46, 91, 255, 20%);
13
12
  --bgl-blue-dark: #191c30;
14
13
  --bgl-blue-light: #eef6ff;
@@ -107,13 +106,6 @@
107
106
  justify-content: flex-end;
108
107
  }
109
108
 
110
- body {
111
- background-color: var(--bgl-bg);
112
- color: var(--bgl-black);
113
- font-family: var(--bgl-font);
114
- overflow: hidden;
115
- }
116
-
117
109
  * {
118
110
  box-sizing: border-box;
119
111
  }