@bagelink/vue 0.0.875 → 0.0.878

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":"MapEmbed.vue.d.ts","sourceRoot":"","sources":["../../src/components/MapEmbed.vue"],"names":[],"mappings":"AAAA,OAoMO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,SAAS,CAAA;AAGnE,OAAO,uBAAuB,CAAA;AAI9B,KAAK,SAAS,GAAG;IAChB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAClB,GAAG,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;;aAGxC,gBAAgB;WAClB,MAAM;aACJ,MAAM;kBACD,OAAO;cACX,SAAS,EAAE;iBACR,MAAM;;;;aALV,gBAAgB;WAClB,MAAM;aACJ,MAAM;kBACD,OAAO;cACX,SAAS,EAAE;iBACR,MAAM;;;;YAHV,MAAM;YAFN,gBAAgB;UAClB,MAAM;iBAEC,OAAO;gBAER,MAAM;;AA2JrB,wBAQG"}
1
+ {"version":3,"file":"MapEmbed.vue.d.ts","sourceRoot":"","sources":["../../src/components/MapEmbed.vue"],"names":[],"mappings":"AAoMA,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,SAAS,CAAA;AAG5D,OAAO,uBAAuB,CAAA;AAI9B,KAAK,SAAS,GAAG;IAChB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAClB,GAAG,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;;aAGxC,gBAAgB;WAClB,MAAM;aACJ,MAAM;kBACD,OAAO;cACX,SAAS,EAAE;iBACR,MAAM;;;;aALV,gBAAgB;WAClB,MAAM;aACJ,MAAM;kBACD,OAAO;cACX,SAAS,EAAE;iBACR,MAAM;;;;YAHV,MAAM;YAFN,gBAAgB;UAClB,MAAM;iBAEC,OAAO;gBAER,MAAM;;AA2JrB,wBAQG"}
@@ -10,8 +10,8 @@ export { default as PasswordInput } from './PasswordInput.vue';
10
10
  export { default as RadioGroup } from './RadioGroup.vue';
11
11
  export { default as RadioPillsInput } from './RadioPillsInput.vue';
12
12
  export { default as RangeInput } from './RangeInput.vue';
13
- export { default as RichText2 } from './RichText.vue';
14
- export { default as RichText } from './RichText2/index.vue';
13
+ export { default as RichText } from './RichText.vue';
14
+ export { default as RichText2 } from './RichText2/index.vue';
15
15
  export { default as SelectInput } from './SelectInput.vue';
16
16
  export { default as SignaturePad } from './SignaturePad.vue';
17
17
  export { default as TableField } from './TableField.vue';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA"}
package/dist/index.cjs CHANGED
@@ -9589,7 +9589,7 @@ const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
9589
9589
  if (props2.field.$el === "select") return SelectInput;
9590
9590
  if (props2.field.$el === "toggle") return ToggleInput;
9591
9591
  if (props2.field.$el === "check") return CheckInput;
9592
- if (props2.field.$el === "richtext") return RichText;
9592
+ if (props2.field.$el === "richtext") return _sfc_main$w;
9593
9593
  if (props2.field.$el === "file") return $el;
9594
9594
  if (props2.field.$el === "date") return _sfc_main$F;
9595
9595
  return props2.field.$el ?? "div";
@@ -43960,7 +43960,7 @@ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
43960
43960
  };
43961
43961
  }
43962
43962
  });
43963
- const RichText = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-492bb647"]]);
43963
+ const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-492bb647"]]);
43964
43964
  const _hoisted_1$m = { class: "flex gap-05" };
43965
43965
  const _hoisted_2$e = ["disabled"];
43966
43966
  const _hoisted_3$b = { key: 1 };
@@ -56142,6 +56142,79 @@ const IMAGE_FORMATS = ["jpeg", "png", "webp", "avif", "apng", "gif", "avifs", "s
56142
56142
  const IMAGE_FORMATS_REGEXP = new RegExp(`(${IMAGE_FORMATS.join("|")})$`, "i");
56143
56143
  const VIDEO_FORMATS = ["mp4", "webm", "ogg", "mov", "avi", "flv", "wmv", "mkv", "ts", "m3u8"];
56144
56144
  const VIDEO_FORMATS_REGEXP = new RegExp(`(${VIDEO_FORMATS.join("|")})$`, "i");
56145
+ const translations = {
56146
+ en: {
56147
+ year: "year",
56148
+ month: "month",
56149
+ week: "week",
56150
+ day: "day",
56151
+ hour: "hour",
56152
+ minute: "minute",
56153
+ second: "second",
56154
+ ago: "ago",
56155
+ justNow: "Just now"
56156
+ },
56157
+ es: {
56158
+ year: "año",
56159
+ month: "mes",
56160
+ week: "semana",
56161
+ day: "día",
56162
+ hour: "hora",
56163
+ minute: "minuto",
56164
+ second: "segundo",
56165
+ ago: "hace",
56166
+ justNow: "Justo ahora"
56167
+ },
56168
+ fr: {
56169
+ year: "an",
56170
+ month: "mois",
56171
+ week: "semaine",
56172
+ day: "jour",
56173
+ hour: "heure",
56174
+ minute: "minute",
56175
+ second: "seconde",
56176
+ ago: "il y a",
56177
+ justNow: "À l’instant"
56178
+ },
56179
+ he: {
56180
+ year: "שנה",
56181
+ month: "חודש",
56182
+ week: "שבוע",
56183
+ day: "יום",
56184
+ hour: "שעה",
56185
+ minute: "דקה",
56186
+ second: "שנייה",
56187
+ ago: "לפני",
56188
+ justNow: "זה עתה"
56189
+ }
56190
+ };
56191
+ function timeAgo(date2, lang = "en") {
56192
+ if (!date2) return "";
56193
+ if (typeof date2 === "string") date2 = new Date(date2);
56194
+ const now = /* @__PURE__ */ new Date();
56195
+ const nowNumber = now.getTime();
56196
+ const dateNumber = date2.getTime();
56197
+ const seconds = Math.floor((nowNumber - dateNumber) / 1e3);
56198
+ const intervals = [
56199
+ { label: "year", seconds: 31536e3 },
56200
+ { label: "month", seconds: 2592e3 },
56201
+ { label: "week", seconds: 604800 },
56202
+ { label: "day", seconds: 86400 },
56203
+ { label: "hour", seconds: 3600 },
56204
+ { label: "minute", seconds: 60 },
56205
+ { label: "second", seconds: 1 }
56206
+ ];
56207
+ const selectedLang = translations[lang];
56208
+ for (const interval of intervals) {
56209
+ const count2 = Math.floor(seconds / interval.seconds);
56210
+ if (count2 >= 1) {
56211
+ const suffix = lang === "he" ? "" : ` ${selectedLang.ago}`;
56212
+ const prefix = lang === "he" ? "לפני " : "";
56213
+ return `${prefix}${count2} ${selectedLang[interval.label]}${suffix}`;
56214
+ }
56215
+ }
56216
+ return selectedLang.justNow;
56217
+ }
56145
56218
  exports.Accordion = _sfc_main$Z;
56146
56219
  exports.AccordionItem = AccordionItem;
56147
56220
  exports.AddressSearch = _sfc_main$X;
@@ -56189,8 +56262,8 @@ exports.Pill = Pill;
56189
56262
  exports.RadioGroup = RadioGroup;
56190
56263
  exports.RadioPillsInput = RadioPillsInput;
56191
56264
  exports.RangeInput = RangeInput;
56192
- exports.RichText = RichText;
56193
- exports.RichText2 = _sfc_main$w;
56265
+ exports.RichText = _sfc_main$w;
56266
+ exports.RichText2 = index$1;
56194
56267
  exports.RouterWrapper = RouterWrapper;
56195
56268
  exports.SelectInput = SelectInput;
56196
56269
  exports.SidebarMenu = SidebarMenu;
@@ -56227,6 +56300,7 @@ exports.initials = initials;
56227
56300
  exports.isDate = isDate;
56228
56301
  exports.keyToLabel = keyToLabel;
56229
56302
  exports.sleep = sleep;
56303
+ exports.timeAgo = timeAgo;
56230
56304
  exports.useBagel = useBagel;
56231
56305
  exports.useBglSchema = useBglSchema;
56232
56306
  exports.useEscape = useEscape;
package/dist/index.d.ts CHANGED
@@ -6,4 +6,5 @@ export * from './types';
6
6
  export * from './utils';
7
7
  export * from './utils/allCountries';
8
8
  export * from './utils/constants';
9
+ export * from './utils/timeAgo';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,OAAO,EACN,iBAAiB,EACjB,KAAK,YAAY,EACjB,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,QAAQ,GACR,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACvD,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,OAAO,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,OAAO,EACN,iBAAiB,EACjB,KAAK,YAAY,EACjB,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,QAAQ,GACR,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACvD,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,oBAAoB,CAAA"}
package/dist/index.mjs CHANGED
@@ -9587,7 +9587,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
9587
9587
  if (props2.field.$el === "select") return SelectInput;
9588
9588
  if (props2.field.$el === "toggle") return ToggleInput;
9589
9589
  if (props2.field.$el === "check") return CheckInput;
9590
- if (props2.field.$el === "richtext") return RichText;
9590
+ if (props2.field.$el === "richtext") return _sfc_main$w;
9591
9591
  if (props2.field.$el === "file") return $el;
9592
9592
  if (props2.field.$el === "date") return _sfc_main$F;
9593
9593
  return props2.field.$el ?? "div";
@@ -43958,7 +43958,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
43958
43958
  };
43959
43959
  }
43960
43960
  });
43961
- const RichText = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-492bb647"]]);
43961
+ const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-492bb647"]]);
43962
43962
  const _hoisted_1$m = { class: "flex gap-05" };
43963
43963
  const _hoisted_2$e = ["disabled"];
43964
43964
  const _hoisted_3$b = { key: 1 };
@@ -56140,6 +56140,79 @@ const IMAGE_FORMATS = ["jpeg", "png", "webp", "avif", "apng", "gif", "avifs", "s
56140
56140
  const IMAGE_FORMATS_REGEXP = new RegExp(`(${IMAGE_FORMATS.join("|")})$`, "i");
56141
56141
  const VIDEO_FORMATS = ["mp4", "webm", "ogg", "mov", "avi", "flv", "wmv", "mkv", "ts", "m3u8"];
56142
56142
  const VIDEO_FORMATS_REGEXP = new RegExp(`(${VIDEO_FORMATS.join("|")})$`, "i");
56143
+ const translations = {
56144
+ en: {
56145
+ year: "year",
56146
+ month: "month",
56147
+ week: "week",
56148
+ day: "day",
56149
+ hour: "hour",
56150
+ minute: "minute",
56151
+ second: "second",
56152
+ ago: "ago",
56153
+ justNow: "Just now"
56154
+ },
56155
+ es: {
56156
+ year: "año",
56157
+ month: "mes",
56158
+ week: "semana",
56159
+ day: "día",
56160
+ hour: "hora",
56161
+ minute: "minuto",
56162
+ second: "segundo",
56163
+ ago: "hace",
56164
+ justNow: "Justo ahora"
56165
+ },
56166
+ fr: {
56167
+ year: "an",
56168
+ month: "mois",
56169
+ week: "semaine",
56170
+ day: "jour",
56171
+ hour: "heure",
56172
+ minute: "minute",
56173
+ second: "seconde",
56174
+ ago: "il y a",
56175
+ justNow: "À l’instant"
56176
+ },
56177
+ he: {
56178
+ year: "שנה",
56179
+ month: "חודש",
56180
+ week: "שבוע",
56181
+ day: "יום",
56182
+ hour: "שעה",
56183
+ minute: "דקה",
56184
+ second: "שנייה",
56185
+ ago: "לפני",
56186
+ justNow: "זה עתה"
56187
+ }
56188
+ };
56189
+ function timeAgo(date2, lang = "en") {
56190
+ if (!date2) return "";
56191
+ if (typeof date2 === "string") date2 = new Date(date2);
56192
+ const now = /* @__PURE__ */ new Date();
56193
+ const nowNumber = now.getTime();
56194
+ const dateNumber = date2.getTime();
56195
+ const seconds = Math.floor((nowNumber - dateNumber) / 1e3);
56196
+ const intervals = [
56197
+ { label: "year", seconds: 31536e3 },
56198
+ { label: "month", seconds: 2592e3 },
56199
+ { label: "week", seconds: 604800 },
56200
+ { label: "day", seconds: 86400 },
56201
+ { label: "hour", seconds: 3600 },
56202
+ { label: "minute", seconds: 60 },
56203
+ { label: "second", seconds: 1 }
56204
+ ];
56205
+ const selectedLang = translations[lang];
56206
+ for (const interval of intervals) {
56207
+ const count2 = Math.floor(seconds / interval.seconds);
56208
+ if (count2 >= 1) {
56209
+ const suffix = lang === "he" ? "" : ` ${selectedLang.ago}`;
56210
+ const prefix = lang === "he" ? "לפני " : "";
56211
+ return `${prefix}${count2} ${selectedLang[interval.label]}${suffix}`;
56212
+ }
56213
+ }
56214
+ return selectedLang.justNow;
56215
+ }
56143
56216
  export {
56144
56217
  _sfc_main$Z as Accordion,
56145
56218
  AccordionItem,
@@ -56188,8 +56261,8 @@ export {
56188
56261
  RadioGroup,
56189
56262
  RadioPillsInput,
56190
56263
  RangeInput,
56191
- RichText,
56192
- _sfc_main$w as RichText2,
56264
+ _sfc_main$w as RichText,
56265
+ index$1 as RichText2,
56193
56266
  RouterWrapper,
56194
56267
  SelectInput,
56195
56268
  SidebarMenu,
@@ -56226,6 +56299,7 @@ export {
56226
56299
  isDate,
56227
56300
  keyToLabel,
56228
56301
  sleep,
56302
+ timeAgo,
56229
56303
  useBagel,
56230
56304
  useBglSchema,
56231
56305
  useEscape,
package/dist/style.css CHANGED
@@ -6325,6 +6325,10 @@ to {
6325
6325
  display: flex;
6326
6326
  align-items: center;
6327
6327
  }
6328
+ .inline-flex {
6329
+ display: inline-flex;
6330
+ align-items: center;
6331
+ }
6328
6332
  .flex-stretch {
6329
6333
  display: flex;
6330
6334
  align-items: stretch;
@@ -6837,6 +6841,10 @@ to {
6837
6841
  display: flex !important;
6838
6842
  }
6839
6843
 
6844
+ .inline-flex {
6845
+ display: inline-flex !important;
6846
+ }
6847
+
6840
6848
  .m_grid {
6841
6849
  display: grid !important;
6842
6850
  }
@@ -0,0 +1,4 @@
1
+ type AvailableTimeLanguages = 'en' | 'es' | 'fr' | 'he';
2
+ export declare function timeAgo(date: string | Date, lang?: AvailableTimeLanguages): string;
3
+ export {};
4
+ //# sourceMappingURL=timeAgo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeAgo.d.ts","sourceRoot":"","sources":["../../src/utils/timeAgo.ts"],"names":[],"mappings":"AAAA,KAAK,sBAAsB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAmDvD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,GAAE,sBAA6B,UA8B/E"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.875",
4
+ "version": "0.0.878",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import type { LatLngExpression, Layer, Map, Marker } from 'leaflet'
2
+ import type { LatLngExpression, Map, Marker } from 'leaflet'
3
3
  import { appendScript, sleep } from '@bagelink/vue'
4
4
  import { onMounted, watch } from 'vue'
5
5
  import './leaflet/leaflet.css'
@@ -10,8 +10,8 @@ export { default as PasswordInput } from './PasswordInput.vue'
10
10
  export { default as RadioGroup } from './RadioGroup.vue'
11
11
  export { default as RadioPillsInput } from './RadioPillsInput.vue'
12
12
  export { default as RangeInput } from './RangeInput.vue'
13
- export { default as RichText2 } from './RichText.vue'
14
- export { default as RichText } from './RichText2/index.vue'
13
+ export { default as RichText } from './RichText.vue'
14
+ export { default as RichText2 } from './RichText2/index.vue'
15
15
  export { default as SelectInput } from './SelectInput.vue'
16
16
  export { default as SignaturePad } from './SignaturePad.vue'
17
17
  export { default as TableField } from './TableField.vue'
package/src/index.ts CHANGED
@@ -13,4 +13,5 @@ export * from './types'
13
13
  export * from './utils'
14
14
  export * from './utils/allCountries'
15
15
  export * from './utils/constants'
16
+ export * from './utils/timeAgo'
16
17
  import './styles/bagel.css'
@@ -3630,6 +3630,11 @@
3630
3630
  align-items: center;
3631
3631
  }
3632
3632
 
3633
+ .inline-flex {
3634
+ display: inline-flex;
3635
+ align-items: center;
3636
+ }
3637
+
3633
3638
  .flex-stretch {
3634
3639
  display: flex;
3635
3640
  align-items: stretch;
@@ -15,6 +15,10 @@
15
15
  display: flex !important;
16
16
  }
17
17
 
18
+ .inline-flex {
19
+ display: inline-flex !important;
20
+ }
21
+
18
22
  .m_grid {
19
23
  display: grid !important;
20
24
  }
@@ -0,0 +1,82 @@
1
+ type AvailableTimeLanguages = 'en' | 'es' | 'fr' | 'he'
2
+ interface LanguageTranslations {
3
+ [key: string]: string
4
+ }
5
+ const translations: Record<AvailableTimeLanguages, LanguageTranslations> = {
6
+ en: {
7
+ year: 'year',
8
+ month: 'month',
9
+ week: 'week',
10
+ day: 'day',
11
+ hour: 'hour',
12
+ minute: 'minute',
13
+ second: 'second',
14
+ ago: 'ago',
15
+ justNow: 'Just now'
16
+ },
17
+ es: {
18
+ year: 'año',
19
+ month: 'mes',
20
+ week: 'semana',
21
+ day: 'día',
22
+ hour: 'hora',
23
+ minute: 'minuto',
24
+ second: 'segundo',
25
+ ago: 'hace',
26
+ justNow: 'Justo ahora'
27
+ },
28
+ fr: {
29
+ year: 'an',
30
+ month: 'mois',
31
+ week: 'semaine',
32
+ day: 'jour',
33
+ hour: 'heure',
34
+ minute: 'minute',
35
+ second: 'seconde',
36
+ ago: 'il y a',
37
+ justNow: 'À l’instant'
38
+ },
39
+ he: {
40
+ year: 'שנה',
41
+ month: 'חודש',
42
+ week: 'שבוע',
43
+ day: 'יום',
44
+ hour: 'שעה',
45
+ minute: 'דקה',
46
+ second: 'שנייה',
47
+ ago: 'לפני',
48
+ justNow: 'זה עתה'
49
+ }
50
+ }
51
+
52
+ export function timeAgo(date: string | Date, lang: AvailableTimeLanguages = 'en') {
53
+ if (!date) return ''
54
+ if (typeof date === 'string') date = new Date(date)
55
+ const now: Date = new Date()
56
+ const nowNumber = now.getTime()
57
+ const dateNumber = date.getTime()
58
+ const seconds = Math.floor((nowNumber - dateNumber) / 1000)
59
+
60
+ const intervals = [
61
+ { label: 'year', seconds: 31536000 },
62
+ { label: 'month', seconds: 2592000 },
63
+ { label: 'week', seconds: 604800 },
64
+ { label: 'day', seconds: 86400 },
65
+ { label: 'hour', seconds: 3600 },
66
+ { label: 'minute', seconds: 60 },
67
+ { label: 'second', seconds: 1 }
68
+ ]
69
+
70
+ const selectedLang = translations[lang]
71
+
72
+ for (const interval of intervals) {
73
+ const count = Math.floor(seconds / interval.seconds)
74
+ if (count >= 1) {
75
+ const suffix = lang === 'he' ? '' : ` ${selectedLang.ago}`
76
+ const prefix = lang === 'he' ? 'לפני ' : ''
77
+ return `${prefix}${count} ${selectedLang[interval.label]}${suffix}`
78
+ }
79
+ }
80
+
81
+ return selectedLang.justNow
82
+ }