cleek 2.4.39 → 2.4.40

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