@bagelink/vue 1.0.7 → 1.0.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/NumberInput.vue"],"names":[],"mappings":"AAyOA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAI7C,KAAK,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAA;AAEzD,UAAU,gBAAgB;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,QAAQ,CAAA;IACpB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;CACrB;;;;;;AA8VD,wBAQG"}
1
+ {"version":3,"file":"NumberInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/NumberInput.vue"],"names":[],"mappings":"AAiPA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAI7C,KAAK,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAA;AAEzD,UAAU,gBAAgB;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,QAAQ,CAAA;IACpB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;CACrB;;;;;;AAsWD,wBAQG"}
package/dist/index.cjs CHANGED
@@ -17305,7 +17305,7 @@ const _hoisted_2$o = {
17305
17305
  key: 0,
17306
17306
  class: "block"
17307
17307
  };
17308
- const _hoisted_3$j = ["id", "placeholder", "disabled", "required", "readonly", "onKeydown"];
17308
+ const _hoisted_3$j = ["id", "placeholder", "disabled", "required", "readonly", "pattern", "onKeydown"];
17309
17309
  const _hoisted_4$c = { key: 1 };
17310
17310
  const _hoisted_5$c = {
17311
17311
  key: 5,
@@ -17383,8 +17383,12 @@ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
17383
17383
  let formattedValue = vue.ref("");
17384
17384
  function inputHandler() {
17385
17385
  const numeric = formattedValue.value.replace(/[^\d.-]/g, "");
17386
- const emptyValue = ["", "-", "."].includes(numeric);
17387
- if (numeric === "-." || numeric.endsWith(".") || emptyValue) return;
17386
+ const emptyValue = ["", "-", ".", "-."].includes(numeric);
17387
+ const isTypingDecimal = formattedValue.value.endsWith(".");
17388
+ if (emptyValue || isTypingDecimal) {
17389
+ emit2("update:modelValue", numeric === "-" ? "-" : numeric);
17390
+ return;
17391
+ }
17388
17392
  numberValue.value = Number.parseFloat(numeric);
17389
17393
  formattedValue.value = emptyValue ? "" : formatNumber2(numberValue.value);
17390
17394
  emit2("update:modelValue", numberValue.value);
@@ -17396,8 +17400,11 @@ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
17396
17400
  });
17397
17401
  vue.watch(() => __props.modelValue, (newVal) => {
17398
17402
  if (newVal !== numberValue.value) {
17403
+ if (typeof newVal === "string" && (newVal === "-" || newVal.endsWith("."))) {
17404
+ formattedValue.value = newVal;
17405
+ return;
17406
+ }
17399
17407
  numberValue.value = Number.parseFloat(`${newVal}`) || 0;
17400
- console.log("newVal", numberValue.value);
17401
17408
  }
17402
17409
  }, { immediate: true });
17403
17410
  return (_ctx, _cache) => {
@@ -17436,7 +17443,7 @@ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
17436
17443
  readonly: _ctx.disabled,
17437
17444
  inputmode: "decimal",
17438
17445
  autocomplete: "off",
17439
- pattern: "^-?\\d{1,3}(,\\d{3})*(\\.\\d+)?$",
17446
+ pattern: _ctx.useGrouping ? "^-?\\d{1,3}(,\\d{3})*(.\\d+)?$" : "^-?\\d*.?d*$",
17440
17447
  autocorrect: "off",
17441
17448
  spellcheck: "false",
17442
17449
  onInput: inputHandler,
@@ -17502,7 +17509,7 @@ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
17502
17509
  };
17503
17510
  }
17504
17511
  });
17505
- const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-a3a46563"]]);
17512
+ const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-77950bb7"]]);
17506
17513
  const _hoisted_1$z = ["value", "autofocus", "onKeydown", "onPaste"];
17507
17514
  const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
17508
17515
  __name: "OTP",
package/dist/index.mjs CHANGED
@@ -17303,7 +17303,7 @@ const _hoisted_2$o = {
17303
17303
  key: 0,
17304
17304
  class: "block"
17305
17305
  };
17306
- const _hoisted_3$j = ["id", "placeholder", "disabled", "required", "readonly", "onKeydown"];
17306
+ const _hoisted_3$j = ["id", "placeholder", "disabled", "required", "readonly", "pattern", "onKeydown"];
17307
17307
  const _hoisted_4$c = { key: 1 };
17308
17308
  const _hoisted_5$c = {
17309
17309
  key: 5,
@@ -17381,8 +17381,12 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
17381
17381
  let formattedValue = ref("");
17382
17382
  function inputHandler() {
17383
17383
  const numeric = formattedValue.value.replace(/[^\d.-]/g, "");
17384
- const emptyValue = ["", "-", "."].includes(numeric);
17385
- if (numeric === "-." || numeric.endsWith(".") || emptyValue) return;
17384
+ const emptyValue = ["", "-", ".", "-."].includes(numeric);
17385
+ const isTypingDecimal = formattedValue.value.endsWith(".");
17386
+ if (emptyValue || isTypingDecimal) {
17387
+ emit2("update:modelValue", numeric === "-" ? "-" : numeric);
17388
+ return;
17389
+ }
17386
17390
  numberValue.value = Number.parseFloat(numeric);
17387
17391
  formattedValue.value = emptyValue ? "" : formatNumber2(numberValue.value);
17388
17392
  emit2("update:modelValue", numberValue.value);
@@ -17394,8 +17398,11 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
17394
17398
  });
17395
17399
  watch(() => __props.modelValue, (newVal) => {
17396
17400
  if (newVal !== numberValue.value) {
17401
+ if (typeof newVal === "string" && (newVal === "-" || newVal.endsWith("."))) {
17402
+ formattedValue.value = newVal;
17403
+ return;
17404
+ }
17397
17405
  numberValue.value = Number.parseFloat(`${newVal}`) || 0;
17398
- console.log("newVal", numberValue.value);
17399
17406
  }
17400
17407
  }, { immediate: true });
17401
17408
  return (_ctx, _cache) => {
@@ -17434,7 +17441,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
17434
17441
  readonly: _ctx.disabled,
17435
17442
  inputmode: "decimal",
17436
17443
  autocomplete: "off",
17437
- pattern: "^-?\\d{1,3}(,\\d{3})*(\\.\\d+)?$",
17444
+ pattern: _ctx.useGrouping ? "^-?\\d{1,3}(,\\d{3})*(.\\d+)?$" : "^-?\\d*.?d*$",
17438
17445
  autocorrect: "off",
17439
17446
  spellcheck: "false",
17440
17447
  onInput: inputHandler,
@@ -17500,7 +17507,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
17500
17507
  };
17501
17508
  }
17502
17509
  });
17503
- const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-a3a46563"]]);
17510
+ const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-77950bb7"]]);
17504
17511
  const _hoisted_1$z = ["value", "autofocus", "onKeydown", "onPaste"];
17505
17512
  const _sfc_main$G = /* @__PURE__ */ defineComponent({
17506
17513
  __name: "OTP",
package/dist/style.css CHANGED
@@ -1847,14 +1847,14 @@ pre code.hljs{
1847
1847
  direction: ltr;
1848
1848
  }
1849
1849
 
1850
- .txtInputIconStart .iconStart[data-v-a3a46563] {
1850
+ .txtInputIconStart .iconStart[data-v-77950bb7] {
1851
1851
  color: var(--input-color);
1852
1852
  position: absolute;
1853
1853
  inset-inline-start:calc(var(--input-height) / 3 - 0.25rem);
1854
1854
  margin-top: calc(var(--input-height) / 2 );
1855
1855
  line-height: 0;
1856
1856
  }
1857
- .textInputSpinnerWrap .spinner[data-v-a3a46563] {
1857
+ .textInputSpinnerWrap .spinner[data-v-77950bb7] {
1858
1858
  color: var(--input-color);
1859
1859
  position: absolute;
1860
1860
  inset-inline-end: 0;
@@ -1864,18 +1864,18 @@ pre code.hljs{
1864
1864
  flex-direction: column;
1865
1865
  gap: 0;
1866
1866
  }
1867
- .top-bgl-ctrl-num-btn[data-v-a3a46563]{
1867
+ .top-bgl-ctrl-num-btn[data-v-77950bb7]{
1868
1868
  margin-top: calc(var(--input-height) / 10) !important;
1869
1869
  }
1870
- .bgl-ctrl-num-btn[data-v-a3a46563]{
1870
+ .bgl-ctrl-num-btn[data-v-77950bb7]{
1871
1871
  height: calc(var(--input-height) / 2.5) !important;
1872
1872
  isolation: isolate;
1873
1873
  }
1874
- .bgl-big-ctrl-num-btn[data-v-a3a46563]{
1874
+ .bgl-big-ctrl-num-btn[data-v-77950bb7]{
1875
1875
  width: 100% !important;
1876
1876
  isolation: isolate;
1877
1877
  }
1878
- .bgl-number-input[data-v-a3a46563]{
1878
+ .bgl-number-input[data-v-77950bb7]{
1879
1879
  padding-inline-end: 1.75rem !important;
1880
1880
  }
1881
1881
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.0.7",
4
+ "version": "1.0.9",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -111,8 +111,13 @@ function formatNumber(num: number) {
111
111
  let formattedValue = $ref('')
112
112
  function inputHandler() {
113
113
  const numeric = formattedValue.replace(/[^\d.-]/g, '')
114
- const emptyValue = ['', '-', '.'].includes(numeric)
115
- if (numeric === '-.' || numeric.endsWith('.') || emptyValue) return
114
+ const emptyValue = ['', '-', '.', '-.'].includes(numeric)
115
+ const isTypingDecimal = formattedValue.endsWith('.')
116
+
117
+ if (emptyValue || isTypingDecimal) {
118
+ emit('update:modelValue', numeric === '-' ? '-' : numeric)
119
+ return
120
+ }
116
121
 
117
122
  numberValue = Number.parseFloat(numeric)
118
123
  formattedValue = emptyValue ? '' : formatNumber(numberValue)
@@ -127,8 +132,11 @@ watch(() => numberValue, () => {
127
132
 
128
133
  watch(() => modelValue, (newVal) => {
129
134
  if (newVal !== numberValue) {
135
+ if (typeof newVal === 'string' && (newVal === '-' || newVal.endsWith('.'))) {
136
+ formattedValue = newVal
137
+ return
138
+ }
130
139
  numberValue = Number.parseFloat(`${newVal}`) || 0
131
- console.log('newVal', numberValue)
132
140
  }
133
141
  }, { immediate: true })
134
142
  </script>
@@ -163,7 +171,7 @@ watch(() => modelValue, (newVal) => {
163
171
  :readonly="disabled"
164
172
  inputmode="decimal"
165
173
  autocomplete="off"
166
- pattern="^-?\d{1,3}(,\d{3})*(\.\d+)?$"
174
+ :pattern="useGrouping ? '^-?\\d{1,3}(,\\d{3})*(\.\\d+)?$' : '^-?\\d*\.?\d*$'"
167
175
  autocorrect="off"
168
176
  spellcheck="false"
169
177
  @input="inputHandler"