@rebilly/revel 4.5.1 → 4.6.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [4.6.0](https://github.com/Rebilly/rebilly/compare/revel-v4.5.1...revel-v4.6.0) (2023-05-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * **revel:** Add icon to r-button component ([#254](https://github.com/Rebilly/rebilly/issues/254)) ([e1aa0c6](https://github.com/Rebilly/rebilly/commit/e1aa0c6ff545f4f14caf8990cedea44bdc4583a5))
7
+
1
8
  ## [4.5.1](https://github.com/Rebilly/rebilly/compare/revel-v4.5.0...revel-v4.5.1) (2023-05-12)
2
9
 
3
10
 
package/dist/revel.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { openBlock, createElementBlock, normalizeClass, createElementVNode, resolveDirective, mergeProps, withDirectives, renderSlot, vShow, resolveComponent, toDisplayString, createCommentVNode, createVNode, createTextVNode, createBlock, withKeys, withModifiers, reactive, computed, h, Transition, withCtx, normalizeStyle, Fragment, renderList, resolveDynamicComponent, toHandlers, vModelText, inject, toRefs, ref, render } from 'vue';
1
+ import { openBlock, createElementBlock, normalizeClass, createElementVNode, resolveDirective, mergeProps, withDirectives, renderSlot, vShow, resolveComponent, toDisplayString, createCommentVNode, createVNode, createTextVNode, createBlock, withKeys, withModifiers, Fragment, reactive, computed, h, Transition, withCtx, normalizeStyle, renderList, resolveDynamicComponent, toHandlers, vModelText, inject, toRefs, ref, render } from 'vue';
2
2
  import moment$2 from 'moment';
3
3
 
4
4
  var tokens$1 = '';
@@ -1778,6 +1778,27 @@ const _sfc_main$t = {
1778
1778
  type: Boolean,
1779
1779
  default: true,
1780
1780
  },
1781
+ /**
1782
+ * Append icon to the left side of the button
1783
+ */
1784
+ iconLeft: {
1785
+ type: String,
1786
+ default: null,
1787
+ },
1788
+ /**
1789
+ * Append icon to the right side of the button
1790
+ */
1791
+ iconRight: {
1792
+ type: String,
1793
+ default: null,
1794
+ },
1795
+ /**
1796
+ * Displays only icon
1797
+ */
1798
+ icon: {
1799
+ type: String,
1800
+ default: null,
1801
+ },
1781
1802
  },
1782
1803
  data() {
1783
1804
  return {
@@ -1789,14 +1810,23 @@ const _sfc_main$t = {
1789
1810
  },
1790
1811
  computed: {
1791
1812
  classes() {
1813
+ const iconStyles = {
1814
+ 'r-has-icon-left': Boolean(this.iconLeft),
1815
+ 'r-has-icon-right': Boolean(this.iconRight),
1816
+ 'r-has-icon': Boolean(this.icon),
1817
+ };
1792
1818
  if (this.link && this.type === 'unstyled') {
1793
- return 'r-button-type-link';
1819
+ return {
1820
+ 'r-button-type-link': true,
1821
+ ...iconStyles,
1822
+ };
1794
1823
  }
1795
1824
  return {
1796
1825
  [`r-button-size-${this.size}`]: !!this.size,
1797
1826
  [`r-button-type-${this.type}`]: !!this.type,
1798
1827
  'r-button-fluid': !!this.fluid,
1799
1828
  'r-is-active': !!this.active,
1829
+ ...iconStyles,
1800
1830
  };
1801
1831
  },
1802
1832
  title() {
@@ -1829,7 +1859,7 @@ const _hoisted_2$i = {
1829
1859
  };
1830
1860
  const _hoisted_3$c = ["role", "disabled", "title"];
1831
1861
  const _hoisted_4$c = {
1832
- key: 1,
1862
+ key: 0,
1833
1863
  class: "r-capitalize-first-letter",
1834
1864
  role: "button"
1835
1865
  };
@@ -1840,20 +1870,39 @@ function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
1840
1870
  return ($props.link)
1841
1871
  ? (openBlock(), createElementBlock("a", {
1842
1872
  key: 0,
1843
- role: "button",
1873
+ role: "link",
1844
1874
  class: normalizeClass(["r-button", $options.classes]),
1845
1875
  href: $options.href,
1846
1876
  target: _ctx.$attrs.href ? '_target' : _ctx.$attrs.target || ''
1847
1877
  }, [
1848
- ($props.capitalizeFirstLetter)
1849
- ? (openBlock(), createElementBlock("div", _hoisted_2$i, [
1850
- renderSlot(_ctx.$slots, "default", {}, () => [
1851
- createTextVNode("Link")
1852
- ])
1853
- ]))
1854
- : renderSlot(_ctx.$slots, "default", { key: 1 }, () => [
1855
- createTextVNode("Apply")
1856
- ])
1878
+ ($props.iconLeft)
1879
+ ? (openBlock(), createBlock(_component_r_icon, {
1880
+ key: 0,
1881
+ icon: $props.iconLeft
1882
+ }, null, 8, ["icon"]))
1883
+ : createCommentVNode("", true),
1884
+ ($props.icon)
1885
+ ? (openBlock(), createBlock(_component_r_icon, {
1886
+ key: 1,
1887
+ icon: $props.icon
1888
+ }, null, 8, ["icon"]))
1889
+ : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
1890
+ ($props.capitalizeFirstLetter)
1891
+ ? (openBlock(), createElementBlock("div", _hoisted_2$i, [
1892
+ renderSlot(_ctx.$slots, "default", {}, () => [
1893
+ createTextVNode("Link")
1894
+ ])
1895
+ ]))
1896
+ : renderSlot(_ctx.$slots, "default", { key: 1 }, () => [
1897
+ createTextVNode("Apply")
1898
+ ])
1899
+ ], 64)),
1900
+ ($props.iconRight)
1901
+ ? (openBlock(), createBlock(_component_r_icon, {
1902
+ key: 3,
1903
+ icon: $props.iconRight
1904
+ }, null, 8, ["icon"]))
1905
+ : createCommentVNode("", true)
1857
1906
  ], 10, _hoisted_1$o))
1858
1907
  : (openBlock(), createElementBlock("button", mergeProps({
1859
1908
  key: 1,
@@ -1868,15 +1917,34 @@ function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
1868
1917
  class: "r-is-spinning r-icon-light-gray r-inline-3"
1869
1918
  }))
1870
1919
  : createCommentVNode("", true),
1871
- ($props.capitalizeFirstLetter)
1872
- ? (openBlock(), createElementBlock("div", _hoisted_4$c, [
1873
- renderSlot(_ctx.$slots, "default", {}, () => [
1874
- createTextVNode("Apply")
1875
- ])
1876
- ]))
1877
- : renderSlot(_ctx.$slots, "default", { key: 2 }, () => [
1878
- createTextVNode("Apply")
1879
- ])
1920
+ ($props.iconLeft && !$props.loading)
1921
+ ? (openBlock(), createBlock(_component_r_icon, {
1922
+ key: 1,
1923
+ icon: $props.iconLeft
1924
+ }, null, 8, ["icon"]))
1925
+ : createCommentVNode("", true),
1926
+ ($props.icon)
1927
+ ? (openBlock(), createBlock(_component_r_icon, {
1928
+ key: 2,
1929
+ icon: $props.icon
1930
+ }, null, 8, ["icon"]))
1931
+ : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
1932
+ ($props.capitalizeFirstLetter)
1933
+ ? (openBlock(), createElementBlock("div", _hoisted_4$c, [
1934
+ renderSlot(_ctx.$slots, "default", {}, () => [
1935
+ createTextVNode("Apply")
1936
+ ])
1937
+ ]))
1938
+ : renderSlot(_ctx.$slots, "default", { key: 1 }, () => [
1939
+ createTextVNode("Apply")
1940
+ ])
1941
+ ], 64)),
1942
+ ($props.iconRight)
1943
+ ? (openBlock(), createBlock(_component_r_icon, {
1944
+ key: 4,
1945
+ icon: $props.iconRight
1946
+ }, null, 8, ["icon"]))
1947
+ : createCommentVNode("", true)
1880
1948
  ], 16, _hoisted_3$c))
1881
1949
  }
1882
1950
  var RButton = /*#__PURE__*/_export_sfc$1(_sfc_main$t, [['render',_sfc_render$t]]);