@bagelink/vue 1.4.10 → 1.4.14

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.
@@ -50,7 +50,6 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
50
50
  clearable: boolean;
51
51
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
52
52
  vCanvas: HTMLCanvasElement;
53
- requiredInput: HTMLInputElement;
54
53
  }, HTMLDivElement>;
55
54
  export default _default;
56
55
  //# sourceMappingURL=SignaturePad.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignaturePad.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/SignaturePad.vue"],"names":[],"mappings":"AAoRA,OAAO,KAAK,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAKnE,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACb;AAED,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,eAAe,CAAA;AAEnF,KAAK,WAAW,GAAG;IAClB,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,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AAO,CAAA;IACvB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB,CAAC;AAcF,iBAAS,KAAK,SAIb;AAED,iBAAS,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,sBAGhC;AAgCD,iBAAS,WAAW,CAAC,GAAG,EAAE,MAAM,6BAQ/B;AAGD,iBAAS,IAAI,SAMZ;AAiBD,iBAAS,YAAY,CAAC,IAAI,EAAE,SAAS,QA0BpC;AAgFD,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,MAAM,CAAC,EAAE,IAAI,CAAC;CACb,GAAG,WAAW,CAAC;;;;;;;;;;;;;;;eAxMH,OAAO;;;;AAmSpB,wBAWG"}
package/dist/index.cjs CHANGED
@@ -19564,7 +19564,6 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
19564
19564
  const sigData = vue.useModel(__props, "modelValue");
19565
19565
  const fileData = vue.useModel(__props, "file");
19566
19566
  const vCanvas = vue.ref();
19567
- const requiredInput = vue.ref();
19568
19567
  let sig = vue.ref();
19569
19568
  let _isEmpty = vue.ref(true);
19570
19569
  function clear() {
@@ -19700,22 +19699,17 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
19700
19699
  }
19701
19700
  function draw() {
19702
19701
  sig.value = new SignaturePad(vCanvas.value, signatureOptions.value);
19703
- window.addEventListener("resize", resizeCanvas);
19704
19702
  resizeCanvas();
19705
19703
  if (props2.disabled) sig.value.off();
19706
19704
  else sig.value.on();
19707
19705
  _isEmpty.value = sig.value.isEmpty();
19708
- sig.value.addEventListener("endStroke", onEndStroke);
19709
19706
  if (fileData.value) {
19710
19707
  void loadFile(fileData.value);
19711
19708
  }
19712
19709
  }
19713
19710
  vue.onMounted(draw);
19714
- vue.onUnmounted(() => {
19715
- var _a;
19716
- (_a = sig.value) == null ? void 0 : _a.removeEventListener("endStroke", onEndStroke);
19717
- window.removeEventListener("resize", resizeCanvas);
19718
- });
19711
+ useResizeObserver(() => vCanvas.value, resizeCanvas);
19712
+ useEventListener(() => sig.value, "endStroke", onEndStroke);
19719
19713
  __expose({
19720
19714
  save: save2,
19721
19715
  clear,
@@ -19727,7 +19721,7 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
19727
19721
  return (_ctx, _cache) => {
19728
19722
  return vue.openBlock(), vue.createElementBlock("div", {
19729
19723
  class: vue.normalizeClass(["bgl_input signature-pad relative", { "bg-transparent": _ctx.disabled }]),
19730
- onTouchmove: _cache[1] || (_cache[1] = vue.withModifiers(() => {
19724
+ onTouchmove: _cache[0] || (_cache[0] = vue.withModifiers(() => {
19731
19725
  }, ["prevent"]))
19732
19726
  }, [
19733
19727
  _ctx.clearable && !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(Btn), {
@@ -19745,19 +19739,12 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
19745
19739
  disabled: _ctx.disabled
19746
19740
  }, null, 8, _hoisted_1$u),
19747
19741
  vue.createElementVNode("input", {
19748
- ref_key: "requiredInput",
19749
- ref: requiredInput,
19750
19742
  placeholder: "required",
19751
19743
  type: "text",
19752
19744
  required: _ctx.required && vue.unref(_isEmpty),
19753
19745
  class: "pixel opacity-0",
19754
- tabindex: "-1",
19755
- "aria-hidden": "true",
19756
- onFocus: _cache[0] || (_cache[0] = (event) => {
19757
- var _a, _b;
19758
- return (_b = (_a = event.target) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
19759
- })
19760
- }, null, 40, _hoisted_2$l)
19746
+ inputMode: "none"
19747
+ }, null, 8, _hoisted_2$l)
19761
19748
  ], 34);
19762
19749
  };
19763
19750
  }
package/dist/index.mjs CHANGED
@@ -19562,7 +19562,6 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
19562
19562
  const sigData = useModel(__props, "modelValue");
19563
19563
  const fileData = useModel(__props, "file");
19564
19564
  const vCanvas = ref();
19565
- const requiredInput = ref();
19566
19565
  let sig = ref();
19567
19566
  let _isEmpty = ref(true);
19568
19567
  function clear() {
@@ -19698,22 +19697,17 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
19698
19697
  }
19699
19698
  function draw() {
19700
19699
  sig.value = new SignaturePad(vCanvas.value, signatureOptions.value);
19701
- window.addEventListener("resize", resizeCanvas);
19702
19700
  resizeCanvas();
19703
19701
  if (props2.disabled) sig.value.off();
19704
19702
  else sig.value.on();
19705
19703
  _isEmpty.value = sig.value.isEmpty();
19706
- sig.value.addEventListener("endStroke", onEndStroke);
19707
19704
  if (fileData.value) {
19708
19705
  void loadFile(fileData.value);
19709
19706
  }
19710
19707
  }
19711
19708
  onMounted(draw);
19712
- onUnmounted(() => {
19713
- var _a;
19714
- (_a = sig.value) == null ? void 0 : _a.removeEventListener("endStroke", onEndStroke);
19715
- window.removeEventListener("resize", resizeCanvas);
19716
- });
19709
+ useResizeObserver(() => vCanvas.value, resizeCanvas);
19710
+ useEventListener(() => sig.value, "endStroke", onEndStroke);
19717
19711
  __expose({
19718
19712
  save: save2,
19719
19713
  clear,
@@ -19725,7 +19719,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
19725
19719
  return (_ctx, _cache) => {
19726
19720
  return openBlock(), createElementBlock("div", {
19727
19721
  class: normalizeClass(["bgl_input signature-pad relative", { "bg-transparent": _ctx.disabled }]),
19728
- onTouchmove: _cache[1] || (_cache[1] = withModifiers(() => {
19722
+ onTouchmove: _cache[0] || (_cache[0] = withModifiers(() => {
19729
19723
  }, ["prevent"]))
19730
19724
  }, [
19731
19725
  _ctx.clearable && !_ctx.disabled ? (openBlock(), createBlock(unref(Btn), {
@@ -19743,19 +19737,12 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
19743
19737
  disabled: _ctx.disabled
19744
19738
  }, null, 8, _hoisted_1$u),
19745
19739
  createElementVNode("input", {
19746
- ref_key: "requiredInput",
19747
- ref: requiredInput,
19748
19740
  placeholder: "required",
19749
19741
  type: "text",
19750
19742
  required: _ctx.required && unref(_isEmpty),
19751
19743
  class: "pixel opacity-0",
19752
- tabindex: "-1",
19753
- "aria-hidden": "true",
19754
- onFocus: _cache[0] || (_cache[0] = (event) => {
19755
- var _a, _b;
19756
- return (_b = (_a = event.target) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
19757
- })
19758
- }, null, 40, _hoisted_2$l)
19744
+ inputMode: "none"
19745
+ }, null, 8, _hoisted_2$l)
19759
19746
  ], 34);
19760
19747
  };
19761
19748
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.4.10",
4
+ "version": "1.4.14",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -1,8 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  import type { Options as SignaturePadOptions } from 'signature_pad'
3
3
  import { Btn } from '@bagelink/vue'
4
+ import { useEventListener, useResizeObserver } from '@vueuse/core'
4
5
  import SignaturePad from 'signature_pad'
5
- import { onMounted, onUnmounted, watch } from 'vue'
6
+ import { onMounted, watch } from 'vue'
6
7
 
7
8
  export interface WaterMark {
8
9
  text: string
@@ -38,7 +39,6 @@ const sigData = defineModel()
38
39
  const fileData = defineModel<File>('file')
39
40
 
40
41
  const vCanvas = $ref<HTMLCanvasElement>()
41
- const requiredInput = $ref<HTMLInputElement>()
42
42
 
43
43
  let sig = $ref<SignaturePad>()
44
44
 
@@ -187,12 +187,10 @@ function resizeCanvas() {
187
187
 
188
188
  function draw() {
189
189
  sig = new SignaturePad(vCanvas!, signatureOptions)
190
- window.addEventListener('resize', resizeCanvas)
191
190
  resizeCanvas()
192
191
  if (props.disabled) sig.off()
193
192
  else sig.on()
194
193
  _isEmpty = sig.isEmpty()
195
- sig.addEventListener('endStroke', onEndStroke)
196
194
 
197
195
  // Load initial file if provided
198
196
  if (fileData.value) {
@@ -201,10 +199,8 @@ function draw() {
201
199
  }
202
200
 
203
201
  onMounted(draw)
204
- onUnmounted(() => {
205
- sig?.removeEventListener('endStroke', onEndStroke)
206
- window.removeEventListener('resize', resizeCanvas)
207
- })
202
+ useResizeObserver(() => vCanvas, resizeCanvas)
203
+ useEventListener(() => sig, 'endStroke', onEndStroke)
208
204
 
209
205
  defineExpose({
210
206
  save,
@@ -236,21 +232,17 @@ defineExpose({
236
232
  :disabled
237
233
  />
238
234
  <input
239
- ref="requiredInput"
240
235
  placeholder="required"
241
236
  type="text"
242
237
  :required="required && _isEmpty"
243
238
  class="pixel opacity-0"
244
- tabindex="-1"
245
- aria-hidden="true"
246
- @focus="event => (event.target as any)?.blur?.()"
239
+ inputMode="none"
247
240
  >
248
241
  <!--
249
242
  we add a hidden input to make the signature pad required
250
- we need to set the tabindex to -1 and aria-hidden to true
251
- to make it not focusable and not visible to screen readers
252
- ! most importantally this prevents the keyboard from opening on mobile
253
- -->
243
+ we need to set inputMode="none"
244
+ ! this prevents the keyboard from opening on mobile
245
+ -->
254
246
  </div>
255
247
  </template>
256
248