cleek 2.2.4 → 2.3.2

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
@@ -18,6 +18,20 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { defineComponent, ref, openBlock, createElementBlock, createElementVNode, renderSlot, normalizeClass, createCommentVNode, computed as computed$2, normalizeStyle, unref as unref$1, watch, h, createBlock, Teleport, createVNode, createTextVNode, toDisplayString, withCtx, onMounted, nextTick as nextTick$1, onBeforeUnmount, getCurrentInstance, withDirectives, isRef as isRef$1, vModelDynamic, Fragment, renderList, mergeProps, withKeys, withModifiers, pushScopeId, popScopeId, vModelRadio, vModelSelect, vModelCheckbox, vModelText } from "vue";
21
+ var defaultCleekOptions = {
22
+ colors: {
23
+ primary: "#559933",
24
+ secondary: "#559933",
25
+ success: "#559933",
26
+ warning: "#559933",
27
+ danger: "#559933",
28
+ dark: "#559933",
29
+ light: "#559933"
30
+ },
31
+ button: {
32
+ type: "filled"
33
+ }
34
+ };
21
35
  var ckDropdown_vue_vue_type_style_index_0_scoped_true_lang = "";
22
36
  var _export_sfc = (sfc, props) => {
23
37
  const target = sfc.__vccOpts || sfc;
@@ -11542,7 +11556,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
11542
11556
  props: {
11543
11557
  title: { type: String, default: void 0 },
11544
11558
  disabled: { type: Boolean, default: false },
11545
- type: { type: String, default: "outlined", validator: validators.buttonType },
11559
+ type: { type: String, default: void 0, validator: validators.buttonType },
11546
11560
  color: { type: String, default: "primary" },
11547
11561
  align: { type: String, default: "left", validator: validators.align },
11548
11562
  size: { type: String, default: "m", validator: validators.size },
@@ -11560,12 +11574,24 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
11560
11574
  setup(__props, { emit: emits }) {
11561
11575
  const props = __props;
11562
11576
  const { windowWidth } = useWindowWidth();
11577
+ const defaultButtonType = "outlined";
11578
+ let $cleekOptions;
11563
11579
  const isMounted = ref(false);
11580
+ const realButtonType = computed$2(() => {
11581
+ if (props.type)
11582
+ return props.type;
11583
+ if (isMounted.value) {
11584
+ console.log("$cleekOptions", $cleekOptions);
11585
+ if ($cleekOptions)
11586
+ return $cleekOptions.button.type;
11587
+ }
11588
+ return defaultButtonType;
11589
+ });
11564
11590
  const computedClass = computed$2(() => {
11565
11591
  const classList2 = [];
11566
11592
  classList2.push(functions.getGroupClass(props));
11567
11593
  if (props.color !== "primary") {
11568
- if (props.type === "filled") {
11594
+ if (realButtonType.value === "filled") {
11569
11595
  classList2.push(`ck-component__bg-color--${props.color}`);
11570
11596
  } else {
11571
11597
  classList2.push(`ck-component__border-color--${props.color}`);
@@ -11574,12 +11600,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
11574
11600
  if (props.align === "center" || props.align === "right") {
11575
11601
  classList2.push(`ck-button__align--${props.align}`);
11576
11602
  }
11577
- if (isMounted.value)
11578
- ;
11579
- let type = props.type;
11580
- if (!validators.buttonType(props.type))
11581
- type = "outlined";
11582
- classList2.push(`type-${type}`);
11603
+ classList2.push(`type-${realButtonType.value}`);
11583
11604
  if (props.size)
11584
11605
  classList2.push(`rs-component-size__${props.size}`);
11585
11606
  return classList2;
@@ -11596,7 +11617,10 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
11596
11617
  }
11597
11618
  onMounted(() => {
11598
11619
  getCurrentInstance().ctx;
11599
- isMounted.value = true;
11620
+ $cleekOptions = functions.getCleekOptions(getCurrentInstance);
11621
+ setTimeout(() => {
11622
+ isMounted.value = true;
11623
+ }, 3e3);
11600
11624
  });
11601
11625
  return (_ctx, _cache) => {
11602
11626
  return openBlock(), createElementBlock("button", {
@@ -11610,22 +11634,22 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
11610
11634
  }, [
11611
11635
  __props.icon ? (openBlock(), createBlock(ckIcon, {
11612
11636
  key: 0,
11613
- class: "ck-button__icon-left",
11637
+ class: normalizeClass(["ck-button__icon-left", { "just-icon": !_ctx.$slots.default }]),
11614
11638
  icon: __props.icon,
11615
11639
  "icon-pack": __props.iconPack
11616
- }, null, 8, ["icon", "icon-pack"])) : createCommentVNode("", true),
11640
+ }, null, 8, ["icon", "icon-pack", "class"])) : createCommentVNode("", true),
11617
11641
  renderSlot(_ctx.$slots, "default", {}, void 0, true),
11618
11642
  __props.iconRight ? (openBlock(), createBlock(ckIcon, {
11619
11643
  key: 1,
11620
- class: "ck-button__icon-right",
11644
+ class: normalizeClass(["ck-button__icon-right", { "just-icon": !_ctx.$slots.default }]),
11621
11645
  icon: __props.iconRight,
11622
11646
  "icon-pack": __props.iconPack
11623
- }, null, 8, ["icon", "icon-pack"])) : createCommentVNode("", true)
11647
+ }, null, 8, ["icon", "icon-pack", "class"])) : createCommentVNode("", true)
11624
11648
  ], 14, _hoisted_1$g);
11625
11649
  };
11626
11650
  }
11627
11651
  });
11628
- var ckButton = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-6a5f73e9"]]);
11652
+ var ckButton = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-32d90b96"]]);
11629
11653
  var ckLabel_vue_vue_type_style_index_0_scoped_true_lang = "";
11630
11654
  const _hoisted_1$f = ["for"];
11631
11655
  const _sfc_main$g = /* @__PURE__ */ defineComponent({
@@ -16781,33 +16805,31 @@ var components = /* @__PURE__ */ Object.freeze({
16781
16805
  lockScroll,
16782
16806
  unlockScroll
16783
16807
  });
16784
- function setDefaultColors(options) {
16785
- if (!options)
16786
- return;
16808
+ function setRootColors(colors) {
16787
16809
  var r = document.querySelector(":root");
16788
- const colorList = [
16789
- "primary",
16790
- "secondary",
16791
- "primary",
16792
- "secondary",
16793
- "success",
16794
- "warning",
16795
- "danger",
16796
- "dark",
16797
- "light"
16798
- ];
16799
- if (options.colors) {
16800
- colorList.forEach((colorName) => {
16801
- const colorValue = options.colors[colorName];
16802
- if (colorValue)
16803
- r.style.setProperty(`--${colorName}`, colorValue);
16804
- });
16810
+ for (const key in colors) {
16811
+ const colorValue = colors[key];
16812
+ r.style.setProperty(`--${key}`, colorValue);
16813
+ }
16814
+ }
16815
+ function getCleekOptions(userOptions) {
16816
+ console.log("userOptions", userOptions);
16817
+ const options = defaultCleekOptions;
16818
+ for (const category in defaultCleekOptions) {
16819
+ if (userOptions[category]) {
16820
+ for (const key in category) {
16821
+ const value = userOptions[category][key];
16822
+ if (value)
16823
+ options[category][key] = value;
16824
+ }
16825
+ }
16805
16826
  }
16827
+ setRootColors(options);
16828
+ console.log("options", options);
16829
+ return options;
16806
16830
  }
16807
16831
  const install = function installCleek(app, options) {
16808
- app.config.globalProperties.$cleekOptions = options;
16809
- console.log("arranco paquete", options);
16810
- setDefaultColors(options);
16832
+ app.config.globalProperties.$cleekOptions = getCleekOptions(options);
16811
16833
  Object.entries(components).forEach(([componentName, component]) => {
16812
16834
  app.component(componentName, component);
16813
16835
  });