@bagelink/vue 0.0.787 → 0.0.791

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/dist/style.css CHANGED
@@ -914,6 +914,43 @@ data[data-v-5f91f598] {
914
914
  direction: ltr;
915
915
  }
916
916
 
917
+ .otp_wrap[data-v-539a9fdb] {
918
+ display: flex;
919
+ flex-direction: row;
920
+ justify-content: center;
921
+ align-items: center;
922
+ }
923
+ .digit-box[data-v-539a9fdb] {
924
+ height: 3rem;
925
+ flex-grow: 1;
926
+ border: 1px solid var(--bgl-primary-tint);
927
+ display: inline-block;
928
+ background: var(--bgl-gray-light);
929
+ border-radius: 5px;
930
+ margin: 5px;
931
+ text-align: center;
932
+ font-size: 2.4rem;
933
+ -moz-appearance: textfield; /* Firefox */
934
+ caret-color: transparent;
935
+ }
936
+ .digit-box[data-v-539a9fdb]::-webkit-outer-spin-button,
937
+ .digit-box[data-v-539a9fdb]::-webkit-inner-spin-button {
938
+ -webkit-appearance: none; /* Chrome, Safari, Edge, Opera */
939
+ margin: 0;
940
+ }
941
+ .digit-box[data-v-539a9fdb]:focus {
942
+ outline: 1px solid var(--bgl-primary);
943
+ filter: drop-shadow(0 0 0.25rem var(--bgl-primary));
944
+ }
945
+ .digit-box[type="number"][data-v-539a9fdb] {
946
+ -moz-appearance: textfield; /* Firefox */
947
+ }
948
+ @media screen and (max-width: 910px) {
949
+ .digit-box[data-v-539a9fdb] {
950
+ padding: 0.25rem;
951
+ }
952
+ }
953
+
917
954
  .m-password {
918
955
  margin-block: calc(var(--input-height) / 2 - 15px);
919
956
  }
@@ -954,6 +991,50 @@ data[data-v-5f91f598] {
954
991
  color: var(--bgl-light-text);
955
992
  }
956
993
 
994
+ .range-slide input[data-v-d653c76a] {
995
+ -webkit-appearance: none;
996
+ width: 100%;
997
+ height: 8px;
998
+ background: linear-gradient(to right, var(--bgl-primary) 50%, var(--input-bg) 50%);
999
+ border-radius: 5px;
1000
+ outline: none;
1001
+ transition: background 0.3s ease;
1002
+ }
1003
+ .range-slide input[data-v-d653c76a]::-webkit-slider-thumb {
1004
+ -webkit-appearance: none;
1005
+ appearance: none;
1006
+ margin-top: -4px;
1007
+ width: 16px;
1008
+ height: 16px;
1009
+ background: var(--bgl-primary);
1010
+ border: 1px solid var(--input-bg);
1011
+ border-radius: 50%;
1012
+ cursor: pointer;
1013
+ }
1014
+ .range-slide input[data-v-d653c76a]::-moz-range-thumb {
1015
+ width: 16px;
1016
+ height: 16px;
1017
+ margin-top: -4px;
1018
+ background: var(--bgl-primary);
1019
+ border: 1px solid var(--input-bg);
1020
+ border-radius: 50%;
1021
+ cursor: pointer;
1022
+ }
1023
+
1024
+ /* Customize the range track (only progress will show the color) */
1025
+ .range-slide input[data-v-d653c76a]::-webkit-slider-runnable-track {
1026
+ width: 100%;
1027
+ height: 8px;
1028
+ background: transparent;
1029
+ border-radius: 5px;
1030
+ }
1031
+ .range-slide input[data-v-d653c76a]::-moz-range-track {
1032
+ width: 100%;
1033
+ height: 8px;
1034
+ background: transparent;
1035
+ border-radius: 5px;
1036
+ }
1037
+
957
1038
  /* Basic editor styles */
958
1039
  .tiptap > * + * {
959
1040
  margin-top: 0.75em;
@@ -1519,61 +1600,61 @@ p {
1519
1600
  font-size: var(--label-font-size);
1520
1601
  }
1521
1602
 
1522
- .bagel-input textarea[data-v-739e3acb] {
1603
+ .bagel-input textarea[data-v-194260fc] {
1523
1604
  min-height: unset;
1524
1605
  font-size: var(--input-font-size);
1525
1606
  }
1526
- .bagel-input.text-input textarea[data-v-739e3acb] {
1607
+ .bagel-input.text-input textarea[data-v-194260fc] {
1527
1608
  resize: none;
1528
1609
  }
1529
- .code textarea[data-v-739e3acb] {
1610
+ .code textarea[data-v-194260fc] {
1530
1611
  font-family: 'Inconsolata', monospace;
1531
1612
  background: var(--bgl-code-bg) !important;
1532
1613
  color: var(--bgl-light-text) !important;
1533
1614
  }
1534
- .code textarea[data-v-739e3acb]::placeholder {
1615
+ .code textarea[data-v-194260fc]::placeholder {
1535
1616
  color: var(--bgl-light-text) !important;
1536
1617
  opacity: 0.3;
1537
1618
  }
1538
- .bagel-input.small[data-v-739e3acb] {
1619
+ .bagel-input.small[data-v-194260fc] {
1539
1620
  margin-bottom: 0;
1540
1621
  height: 30px;
1541
1622
  }
1542
- .bagel-input.dense label[data-v-739e3acb] {
1623
+ .bagel-input.dense label[data-v-194260fc] {
1543
1624
  display: flex;
1544
1625
  align-items: center;
1545
1626
  gap: 0.5rem;
1546
1627
  }
1547
- .bagel-input input[data-v-739e3acb]:disabled {
1628
+ .bagel-input input[data-v-194260fc]:disabled {
1548
1629
  background: #f5f5f5;
1549
1630
  }
1550
- .bagel-input label[data-v-739e3acb] {
1631
+ .bagel-input label[data-v-194260fc] {
1551
1632
  font-size: var(--label-font-size);
1552
1633
  }
1553
- .textInputIconWrap .bgl_icon-font[data-v-739e3acb] {
1634
+ .textInputIconWrap .bgl_icon-font[data-v-194260fc] {
1554
1635
  color: var(--bgl-gray);
1555
1636
  position: absolute;
1556
1637
  bottom: 0px;
1557
1638
  inset-inline-end: 0.25rem;
1558
- margin-block: calc(var(--input-height) / 2 - 16px);
1639
+ margin-block: calc(var(--input-height) / 2 - 13px);
1559
1640
  }
1560
- .textInputIconWrap input[data-v-739e3acb]{
1641
+ .textInputIconWrap input[data-v-194260fc]{
1561
1642
  padding-inline-end: 2rem;
1562
1643
  }
1563
- .txtInputIconStart .iconStart[data-v-739e3acb] {
1644
+ .txtInputIconStart .iconStart[data-v-194260fc] {
1564
1645
  color: var(--bgl-gray);
1565
1646
  position: absolute;
1566
1647
  bottom: 0px;
1567
1648
  inset-inline-start: 0.25rem;
1568
- margin-block: calc(var(--input-height) / 2 - 16px);
1649
+ margin-block: calc(var(--input-height) / 2 - 13px);
1569
1650
  }
1570
- .txtInputIconStart input[data-v-739e3acb]{
1651
+ .txtInputIconStart input[data-v-194260fc]{
1571
1652
  padding-inline-start: 2rem;
1572
1653
  }
1573
- .txtInputIconStart textarea[data-v-739e3acb] {
1654
+ .txtInputIconStart textarea[data-v-194260fc] {
1574
1655
  padding-inline-start: 2rem;
1575
1656
  }
1576
- .bagel-input.small textarea[data-v-739e3acb] {
1657
+ .bagel-input.small textarea[data-v-194260fc] {
1577
1658
  height: 30px;
1578
1659
  }
1579
1660
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.787",
4
+ "version": "0.0.791",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -0,0 +1,145 @@
1
+ <script setup lang="ts">
2
+ import { reactive } from 'vue'
3
+
4
+ const props = defineProps<{ digitCount: number, default?: string, modelValue?: string }>()
5
+
6
+ const emit = defineEmits(['update:modelValue', 'complete'])
7
+ const digits = reactive<(number | string | null)[]>([])
8
+ const otpCont = $ref<HTMLElement>()
9
+
10
+ function handlePaste(event: ClipboardEvent, index: number) {
11
+ event.preventDefault()
12
+ const { clipboardData } = event
13
+ const pastedText = clipboardData?.getData('text').replace(/\D/g, '') // Ensure only numeric digits are pasted
14
+ const pastedDigits = pastedText?.split('')
15
+ if (!pastedDigits) return
16
+ for (let i = 0; i < pastedDigits.length; i++) {
17
+ const digit = pastedDigits[i]
18
+ if (index + i < digits.length) {
19
+ digits[index + i] = digit
20
+ }
21
+ }
22
+ emitUpdate()
23
+ }
24
+
25
+ function emitUpdate() {
26
+ if (isDigitsFull()) {
27
+ emit('complete', digits.join(''))
28
+ } else {
29
+ emit('update:modelValue', digits.join(''))
30
+ }
31
+ }
32
+
33
+ function handleKeyDown(event: KeyboardEvent, index: number) {
34
+ const noPreventKeys = ['Tab', 'ArrowRight', 'ArrowLeft', 'Control', 'Shift', 'Alt', 'Meta']
35
+ if (noPreventKeys.includes(event.key)) {
36
+ return
37
+ }
38
+
39
+ if (event.key === 'Backspace') {
40
+ digits[index] = null
41
+
42
+ if (index !== 0) {
43
+ const prevDigit = otpCont?.children[index - 1] as any
44
+ prevDigit.focus()
45
+ }
46
+ emitUpdate()
47
+ return
48
+ }
49
+
50
+ const numberRegex = /^\d$/
51
+ if (numberRegex.test(event.key)) {
52
+ digits[index] = event.key
53
+
54
+ if (index !== props.digitCount - 1) {
55
+ setTimeout(() => {
56
+ const nextDigit = otpCont?.children[index + 1] as any
57
+ nextDigit.focus()
58
+ }, 10)
59
+ }
60
+ emitUpdate()
61
+ }
62
+ }
63
+
64
+ if (props.default && props.default.length === props.digitCount) {
65
+ for (let i = 0; i < props.digitCount; i++) {
66
+ digits[i] = props.default.charAt(i)
67
+ }
68
+ } else {
69
+ for (let i = 0; i < props.digitCount; i++) {
70
+ digits[i] = null
71
+ }
72
+ }
73
+
74
+ function isDigitsFull() {
75
+ for (const elem of digits) {
76
+ if (elem == null || elem == undefined) {
77
+ return false
78
+ }
79
+ }
80
+ return true
81
+ }
82
+ </script>
83
+
84
+ <template>
85
+ <div ref="otpCont" class="otp_wrap">
86
+ <input
87
+ v-for="(el, ind) in digits"
88
+ :key="ind"
89
+ :value="digits[ind] || ''"
90
+ type="number"
91
+ inputmode="numeric"
92
+ class="digit-box"
93
+ :autofocus="ind === 0"
94
+ maxlength="1"
95
+ pattern="[0-9]*"
96
+ oninput="this.value = this.value.slice(0, 1);"
97
+ @keydown="handleKeyDown($event, ind)"
98
+ @paste="handlePaste($event, ind)"
99
+ >
100
+ </div>
101
+ </template>
102
+
103
+ <style scoped>
104
+ .otp_wrap {
105
+ display: flex;
106
+ flex-direction: row;
107
+ justify-content: center;
108
+ align-items: center;
109
+ }
110
+
111
+ .digit-box {
112
+ height: 3rem;
113
+ flex-grow: 1;
114
+ border: 1px solid var(--bgl-primary-tint);
115
+ display: inline-block;
116
+ background: var(--bgl-gray-light);
117
+ border-radius: 5px;
118
+ margin: 5px;
119
+ text-align: center;
120
+ font-size: 2.4rem;
121
+ -moz-appearance: textfield; /* Firefox */
122
+ caret-color: transparent;
123
+ }
124
+
125
+ .digit-box::-webkit-outer-spin-button,
126
+ .digit-box::-webkit-inner-spin-button {
127
+ -webkit-appearance: none; /* Chrome, Safari, Edge, Opera */
128
+ margin: 0;
129
+ }
130
+
131
+ .digit-box:focus {
132
+ outline: 1px solid var(--bgl-primary);
133
+ filter: drop-shadow(0 0 0.25rem var(--bgl-primary));
134
+ }
135
+
136
+ .digit-box[type="number"] {
137
+ -moz-appearance: textfield; /* Firefox */
138
+ }
139
+
140
+ @media screen and (max-width: 910px) {
141
+ .digit-box {
142
+ padding: 0.25rem;
143
+ }
144
+ }
145
+ </style>
@@ -0,0 +1,75 @@
1
+ <script lang="ts" setup>
2
+ interface RangeInputProps {
3
+ min?: number
4
+ max?: number
5
+ step?: number
6
+ }
7
+ const { min, max, step } = defineProps<RangeInputProps>()
8
+ const val = defineModel<number>({ default: 0 })
9
+
10
+ const background = $computed(() => {
11
+ const minVal = min ?? 0
12
+ const maxVal = max ?? 100
13
+ const percentage = ((val.value - minVal) / (maxVal - minVal)) * 100
14
+ return `linear-gradient(to right, var(--bgl-primary) ${percentage}%, var(--input-bg) ${percentage}%)`
15
+ })
16
+ </script>
17
+
18
+ <template>
19
+ <div class="flex gap-1 align-center range-slide">
20
+ <p v-if="min !== undefined">
21
+ {{ min }}
22
+ </p><input v-model="val" :style="{ background }" :max :min :step type="range"><p v-if="max !== undefined">
23
+ {{ max }}
24
+ </p>
25
+ </div>
26
+ </template>
27
+
28
+ <style scoped>
29
+ .range-slide input {
30
+ -webkit-appearance: none;
31
+ width: 100%;
32
+ height: 8px;
33
+ background: linear-gradient(to right, var(--bgl-primary) 50%, var(--input-bg) 50%);
34
+ border-radius: 5px;
35
+ outline: none;
36
+ transition: background 0.3s ease;
37
+ }
38
+
39
+ .range-slide input::-webkit-slider-thumb {
40
+ -webkit-appearance: none;
41
+ appearance: none;
42
+ margin-top: -4px;
43
+ width: 16px;
44
+ height: 16px;
45
+ background: var(--bgl-primary);
46
+ border: 1px solid var(--input-bg);
47
+ border-radius: 50%;
48
+ cursor: pointer;
49
+ }
50
+
51
+ .range-slide input::-moz-range-thumb {
52
+ width: 16px;
53
+ height: 16px;
54
+ margin-top: -4px;
55
+ background: var(--bgl-primary);
56
+ border: 1px solid var(--input-bg);
57
+ border-radius: 50%;
58
+ cursor: pointer;
59
+ }
60
+
61
+ /* Customize the range track (only progress will show the color) */
62
+ .range-slide input::-webkit-slider-runnable-track {
63
+ width: 100%;
64
+ height: 8px;
65
+ background: transparent;
66
+ border-radius: 5px;
67
+ }
68
+
69
+ .range-slide input::-moz-range-track {
70
+ width: 100%;
71
+ height: 8px;
72
+ background: transparent;
73
+ border-radius: 5px;
74
+ }
75
+ </style>
@@ -194,7 +194,7 @@ onMounted(() => {
194
194
  position: absolute;
195
195
  bottom: 0px;
196
196
  inset-inline-end: 0.25rem;
197
- margin-block: calc(var(--input-height) / 2 - 16px);
197
+ margin-block: calc(var(--input-height) / 2 - 13px);
198
198
  }
199
199
  .textInputIconWrap input{
200
200
  padding-inline-end: 2rem;
@@ -205,7 +205,7 @@ onMounted(() => {
205
205
  position: absolute;
206
206
  bottom: 0px;
207
207
  inset-inline-start: 0.25rem;
208
- margin-block: calc(var(--input-height) / 2 - 16px);
208
+ margin-block: calc(var(--input-height) / 2 - 13px);
209
209
  }
210
210
  .txtInputIconStart input{
211
211
  padding-inline-start: 2rem;
@@ -5,9 +5,11 @@ export { default as DateInput } from './DateInput.vue'
5
5
  export { default as DatePicker } from './DatePicker.vue'
6
6
  export { default as FileUpload } from './FileUpload.vue'
7
7
  export { default as JSONInput } from './JSONInput.vue'
8
+ export { default as OTP } from './OTP.vue'
8
9
  export { default as PasswordInput } from './PasswordInput.vue'
9
10
  export { default as RadioGroup } from './RadioGroup.vue'
10
11
  export { default as RadioPillsInput } from './RadioPillsInput.vue'
12
+ export { default as RangeInput } from './RangeInput.vue'
11
13
  export { default as RichText } from './RichText.vue'
12
14
  export { default as RichText2 } from './RichText2/index.vue'
13
15
  export { default as SelectInput } from './SelectInput.vue'