cleek 2.4.39 → 2.4.42

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/cleek.es.js CHANGED
@@ -2890,6 +2890,7 @@ const plugin = {
2890
2890
  options: config$2
2891
2891
  };
2892
2892
  const cleekOptions = {
2893
+ lang: "en",
2893
2894
  colors: {
2894
2895
  primary: "#559933",
2895
2896
  secondary: "#559933"
@@ -22437,6 +22438,22 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
22437
22438
  return false;
22438
22439
  return true;
22439
22440
  });
22441
+ const realAcceptBtnText = computed$2(() => {
22442
+ var _a;
22443
+ if (props.acceptBtnText)
22444
+ return props.acceptBtnText;
22445
+ if (((_a = cleekOptions2.value) == null ? void 0 : _a.lang) === "es")
22446
+ return "Aceptar";
22447
+ return "Accept";
22448
+ });
22449
+ const realCancelBtnText = computed$2(() => {
22450
+ var _a;
22451
+ if (props.cancelBtnText)
22452
+ return props.cancelBtnText;
22453
+ if (((_a = cleekOptions2.value) == null ? void 0 : _a.lang) === "es")
22454
+ return "Cancelar";
22455
+ return "Cancel";
22456
+ });
22440
22457
  function onCancel() {
22441
22458
  emits("cancel");
22442
22459
  if (!props.preventCloseOnCancel)
@@ -22484,27 +22501,29 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
22484
22501
  ]),
22485
22502
  _ctx.$slots.footer || __props.confirmButtons || __props.acceptButton || __props.cancelButton ? (openBlock(), createElementBlock("div", _hoisted_5$2, [
22486
22503
  renderSlot(_ctx.$slots, "footer"),
22487
- __props.confirmButtons ? (openBlock(), createElementBlock("div", _hoisted_6$2, [
22488
- createVNode(CkButton, {
22504
+ __props.confirmButtons || __props.acceptButton || __props.cancelButton ? (openBlock(), createElementBlock("div", _hoisted_6$2, [
22505
+ __props.confirmButtons || __props.cancelButton ? (openBlock(), createBlock(CkButton, {
22506
+ key: 0,
22489
22507
  class: "cancel-button",
22490
- onClick: _cache[1] || (_cache[1] = ($event) => onCancel()),
22491
22508
  color: "danger",
22492
- type: unref$1(realCancelBtnType)
22509
+ type: unref$1(realCancelBtnType),
22510
+ onClick: _cache[1] || (_cache[1] = ($event) => onCancel())
22493
22511
  }, {
22494
22512
  default: withCtx(() => [
22495
- createTextVNode(toDisplayString(__props.cancelBtnText || "Cancel"), 1)
22513
+ createTextVNode(toDisplayString(unref$1(realCancelBtnText)), 1)
22496
22514
  ]),
22497
22515
  _: 1
22498
- }, 8, ["type"]),
22499
- createVNode(CkButton, {
22500
- onClick: _cache[2] || (_cache[2] = ($event) => onAccept()),
22501
- type: unref$1(realAcceptBtnType)
22516
+ }, 8, ["type"])) : createCommentVNode("", true),
22517
+ __props.confirmButtons || __props.acceptButton ? (openBlock(), createBlock(CkButton, {
22518
+ key: 1,
22519
+ type: unref$1(realAcceptBtnType),
22520
+ onClick: _cache[2] || (_cache[2] = ($event) => onAccept())
22502
22521
  }, {
22503
22522
  default: withCtx(() => [
22504
- createTextVNode(toDisplayString(__props.acceptBtnText || "Accept"), 1)
22523
+ createTextVNode(toDisplayString(unref$1(realAcceptBtnText)), 1)
22505
22524
  ]),
22506
22525
  _: 1
22507
- }, 8, ["type"])
22526
+ }, 8, ["type"])) : createCommentVNode("", true)
22508
22527
  ])) : createCommentVNode("", true)
22509
22528
  ])) : createCommentVNode("", true)
22510
22529
  ], 6)
@@ -23677,7 +23696,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
23677
23696
  });
23678
23697
  var ckTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-6f36045c"]]);
23679
23698
  var CkConfirm_vue_vue_type_style_index_0_scoped_true_lang = "";
23680
- const _withScopeId = (n) => (pushScopeId("data-v-7e7afc17"), n = n(), popScopeId(), n);
23699
+ const _withScopeId = (n) => (pushScopeId("data-v-5d01d37a"), n = n(), popScopeId(), n);
23681
23700
  const _hoisted_1$1 = { class: "ck-confirm--background" };
23682
23701
  const _hoisted_2$1 = { class: "ck-confirm" };
23683
23702
  const _hoisted_3$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "ck-confirm__icon" }, [
@@ -23692,20 +23711,42 @@ const _hoisted_5 = { class: "ck-confirm__message" };
23692
23711
  const _hoisted_6 = { class: "ck-confirm__buttons-container" };
23693
23712
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23694
23713
  setup(__props, { expose }) {
23714
+ let cleekOptions2 = ref();
23695
23715
  const title = ref("");
23696
23716
  const msg = ref("");
23697
- const acceptText = ref("Aceptar");
23698
- const cancelText = ref("Cancelar");
23717
+ const acceptText = ref("");
23718
+ const cancelText = ref("");
23699
23719
  const responseSuccess = ref(() => {
23700
23720
  });
23701
23721
  const responseFailure = ref(() => {
23702
23722
  });
23723
+ const defaultTitle = computed$2(() => {
23724
+ var _a;
23725
+ if (((_a = cleekOptions2.value) == null ? void 0 : _a.lang) === "es")
23726
+ return "\xBFEst\xE1s seguro?";
23727
+ return "\xBFAre you sure?";
23728
+ });
23729
+ const defaultAcceptText = computed$2(() => {
23730
+ var _a;
23731
+ if (((_a = cleekOptions2.value) == null ? void 0 : _a.lang) === "es")
23732
+ return "Aceptar";
23733
+ return "Accept";
23734
+ });
23735
+ const defaultCancelText = computed$2(() => {
23736
+ var _a;
23737
+ if (((_a = cleekOptions2.value) == null ? void 0 : _a.lang) === "es")
23738
+ return "Cancelar";
23739
+ return "Cancel";
23740
+ });
23703
23741
  function onCancel() {
23704
23742
  responseFailure.value();
23705
23743
  }
23706
23744
  function onAccept() {
23707
23745
  responseSuccess.value();
23708
23746
  }
23747
+ onMounted(() => {
23748
+ cleekOptions2.value = hooks8.getCleekOptions(getCurrentInstance);
23749
+ });
23709
23750
  expose({
23710
23751
  title,
23711
23752
  msg,
@@ -23718,24 +23759,24 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23718
23759
  return openBlock(), createElementBlock("div", _hoisted_1$1, [
23719
23760
  createElementVNode("div", _hoisted_2$1, [
23720
23761
  _hoisted_3$1,
23721
- createElementVNode("div", _hoisted_4$1, toDisplayString(title.value), 1),
23762
+ createElementVNode("div", _hoisted_4$1, toDisplayString(title.value || unref$1(defaultTitle)), 1),
23722
23763
  createElementVNode("div", _hoisted_5, toDisplayString(msg.value), 1),
23723
23764
  createElementVNode("div", _hoisted_6, [
23724
23765
  createElementVNode("button", {
23725
23766
  class: "ck-confirm__button--cancel",
23726
23767
  onClick: _cache[0] || (_cache[0] = ($event) => onCancel())
23727
- }, toDisplayString(cancelText.value), 1),
23768
+ }, toDisplayString(cancelText.value || unref$1(defaultCancelText)), 1),
23728
23769
  createElementVNode("button", {
23729
23770
  class: "ck-confirm__button--accept",
23730
23771
  onClick: _cache[1] || (_cache[1] = ($event) => onAccept())
23731
- }, toDisplayString(acceptText.value), 1)
23772
+ }, toDisplayString(acceptText.value || unref$1(defaultAcceptText)), 1)
23732
23773
  ])
23733
23774
  ])
23734
23775
  ]);
23735
23776
  };
23736
23777
  }
23737
23778
  });
23738
- var CkConfirmComponent = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-7e7afc17"]]);
23779
+ var CkConfirmComponent = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-5d01d37a"]]);
23739
23780
  var CkNotify_vue_vue_type_style_index_0_scoped_true_lang = "";
23740
23781
  const _hoisted_1 = { class: "ck-notify__container" };
23741
23782
  const _hoisted_2 = { class: "ck-notify__title" };
@@ -23743,6 +23784,7 @@ const _hoisted_3 = { class: "close-btn" };
23743
23784
  const _hoisted_4 = { class: "ck-notify__text" };
23744
23785
  const _sfc_main = /* @__PURE__ */ defineComponent({
23745
23786
  setup(__props, { expose }) {
23787
+ let cleekOptions2 = ref();
23746
23788
  const isActive = ref(true);
23747
23789
  const title = ref("");
23748
23790
  const text2 = ref("");
@@ -23757,7 +23799,39 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23757
23799
  duration,
23758
23800
  closeCallback
23759
23801
  });
23802
+ const defaultTitle = computed$2(() => {
23803
+ switch (color.value) {
23804
+ case "success":
23805
+ if (lang === "es")
23806
+ return "\xC9xito";
23807
+ return "Success";
23808
+ case "danger":
23809
+ if (lang === "es")
23810
+ return "Error";
23811
+ return "Error";
23812
+ case "warning":
23813
+ if (lang === "es")
23814
+ return "Atenci\xF3n";
23815
+ return "Alert";
23816
+ }
23817
+ return "";
23818
+ });
23819
+ const computedClass = computed$2(() => {
23820
+ const list = [];
23821
+ if (color.value && hooks8.isColorTemplateVariable(color.value)) {
23822
+ list.push(`ck-component__bg-color--${color.value}`);
23823
+ }
23824
+ return list;
23825
+ });
23826
+ const computedStyle = computed$2(() => {
23827
+ const list = [];
23828
+ if (color.value && !hooks8.isColorTemplateVariable(color.value)) {
23829
+ list.push({ "background-color": color.value });
23830
+ }
23831
+ return list;
23832
+ });
23760
23833
  onMounted(() => {
23834
+ cleekOptions2.value = hooks8.getCleekOptions(getCurrentInstance);
23761
23835
  setTimeout(() => {
23762
23836
  closeCallback.value();
23763
23837
  }, duration.value);
@@ -23769,8 +23843,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23769
23843
  }, [
23770
23844
  createElementVNode("div", _hoisted_1, [
23771
23845
  createElementVNode("div", {
23772
- class: "ck-notify",
23773
- style: normalizeStyle({ "background-color": color.value }),
23846
+ class: normalizeClass(["ck-notify", unref$1(computedClass)]),
23847
+ style: normalizeStyle(unref$1(computedStyle)),
23774
23848
  onClick: _cache[0] || (_cache[0] = ($event) => {
23775
23849
  isActive.value = false;
23776
23850
  closeCallback.value();
@@ -23780,23 +23854,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23780
23854
  createElementVNode("div", _hoisted_3, [
23781
23855
  createVNode(CkIcon, { icon: "times" })
23782
23856
  ]),
23783
- createTextVNode(toDisplayString(title.value), 1)
23857
+ createTextVNode(toDisplayString(title.value || unref$1(defaultTitle)), 1)
23784
23858
  ]),
23785
23859
  createElementVNode("div", _hoisted_4, toDisplayString(text2.value), 1)
23786
- ], 4)
23860
+ ], 6)
23787
23861
  ])
23788
23862
  ])) : createCommentVNode("", true);
23789
23863
  };
23790
23864
  }
23791
23865
  });
23792
- var CkNotifyComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2522350d"]]);
23866
+ var CkNotifyComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-04e2d5fe"]]);
23793
23867
  const defaultDuration = 2e3;
23794
23868
  var ckNotify = {
23795
23869
  confirmOptions({
23796
- title = "\xBFEst\xE1s seguro?",
23870
+ title = "",
23797
23871
  msg = "",
23798
- acceptText = "Aceptar",
23799
- cancelText = "Cancelar",
23872
+ acceptText = "",
23873
+ cancelText = "",
23800
23874
  success = () => {
23801
23875
  },
23802
23876
  failure = () => {
@@ -23825,7 +23899,7 @@ var ckNotify = {
23825
23899
  failure
23826
23900
  });
23827
23901
  },
23828
- notify({ text: text2 = "", title = "", color = "#ccc", duration = defaultDuration }) {
23902
+ notify({ text: text2 = "", title = "", color = "", duration = defaultDuration }) {
23829
23903
  const tempDiv = document.createElement("div");
23830
23904
  const instance = createApp(CkNotifyComponent).mount(tempDiv);
23831
23905
  instance.title = title;
@@ -23836,14 +23910,14 @@ var ckNotify = {
23836
23910
  instance.$el.remove();
23837
23911
  };
23838
23912
  },
23839
- notifySuccess(text2 = "", title = "\xC9xito") {
23840
- this.notify({ text: text2, title, color: "#66CC00" });
23913
+ notifySuccess(text2, title = "") {
23914
+ this.notify({ text: text2, title, color: "success" });
23841
23915
  },
23842
- notifyError(text2 = "", title = "Error") {
23843
- this.notify({ text: text2, title, color: "#FF3333" });
23916
+ notifyError(text2, title = "") {
23917
+ this.notify({ text: text2, title, color: "danger" });
23844
23918
  },
23845
- notifyWarning(text2 = "", title = "Atenci\xF3n") {
23846
- this.notify({ text: text2, title, color: "#FFDD33" });
23919
+ notifyWarning(text2, title = "") {
23920
+ this.notify({ text: text2, title, color: "warning" });
23847
23921
  }
23848
23922
  };
23849
23923
  var components = /* @__PURE__ */ Object.freeze({
@@ -23884,12 +23958,16 @@ function setRootColors(colors) {
23884
23958
  }
23885
23959
  function getCleekOptions(userOptions) {
23886
23960
  const options = cleekOptions;
23887
- for (const category in cleekOptions) {
23888
- if (userOptions[category]) {
23889
- for (const key in userOptions[category]) {
23890
- const value = userOptions[category][key];
23891
- if (value)
23892
- options[category][key] = value;
23961
+ for (const categoryName in cleekOptions) {
23962
+ if (userOptions[categoryName]) {
23963
+ if (typeof userOptions[categoryName] === "string") {
23964
+ options[categoryName] = userOptions[categoryName];
23965
+ } else {
23966
+ for (const key in userOptions[categoryName]) {
23967
+ const value = userOptions[categoryName][key];
23968
+ if (value)
23969
+ options[categoryName][key] = value;
23970
+ }
23893
23971
  }
23894
23972
  }
23895
23973
  }