@rebilly/revel 4.5.0 → 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,17 @@
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
+
8
+ ## [4.5.1](https://github.com/Rebilly/rebilly/compare/revel-v4.5.0...revel-v4.5.1) (2023-05-12)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **revel:** Update button style condition ([#240](https://github.com/Rebilly/rebilly/issues/240)) ([334d5dc](https://github.com/Rebilly/rebilly/commit/334d5dc3e0814712dbf96be537f2c7f1d8fc89e9))
14
+
1
15
  ## [4.5.0](https://github.com/Rebilly/rebilly/compare/revel-v4.4.0...revel-v4.5.0) (2023-05-10)
2
16
 
3
17
 
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 {
@@ -1788,18 +1809,24 @@ const _sfc_main$t = {
1788
1809
  };
1789
1810
  },
1790
1811
  computed: {
1791
- isHrefLink() {
1792
- return this.link && Boolean(this.href);
1793
- },
1794
1812
  classes() {
1795
- if (this.isHrefLink) {
1796
- return 'r-button-type-link';
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
+ };
1818
+ if (this.link && this.type === 'unstyled') {
1819
+ return {
1820
+ 'r-button-type-link': true,
1821
+ ...iconStyles,
1822
+ };
1797
1823
  }
1798
1824
  return {
1799
1825
  [`r-button-size-${this.size}`]: !!this.size,
1800
1826
  [`r-button-type-${this.type}`]: !!this.type,
1801
1827
  'r-button-fluid': !!this.fluid,
1802
1828
  'r-is-active': !!this.active,
1829
+ ...iconStyles,
1803
1830
  };
1804
1831
  },
1805
1832
  title() {
@@ -1832,7 +1859,7 @@ const _hoisted_2$i = {
1832
1859
  };
1833
1860
  const _hoisted_3$c = ["role", "disabled", "title"];
1834
1861
  const _hoisted_4$c = {
1835
- key: 1,
1862
+ key: 0,
1836
1863
  class: "r-capitalize-first-letter",
1837
1864
  role: "button"
1838
1865
  };
@@ -1843,20 +1870,39 @@ function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
1843
1870
  return ($props.link)
1844
1871
  ? (openBlock(), createElementBlock("a", {
1845
1872
  key: 0,
1846
- role: "button",
1873
+ role: "link",
1847
1874
  class: normalizeClass(["r-button", $options.classes]),
1848
1875
  href: $options.href,
1849
1876
  target: _ctx.$attrs.href ? '_target' : _ctx.$attrs.target || ''
1850
1877
  }, [
1851
- ($props.capitalizeFirstLetter)
1852
- ? (openBlock(), createElementBlock("div", _hoisted_2$i, [
1853
- renderSlot(_ctx.$slots, "default", {}, () => [
1854
- createTextVNode("Link")
1855
- ])
1856
- ]))
1857
- : renderSlot(_ctx.$slots, "default", { key: 1 }, () => [
1858
- createTextVNode("Apply")
1859
- ])
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)
1860
1906
  ], 10, _hoisted_1$o))
1861
1907
  : (openBlock(), createElementBlock("button", mergeProps({
1862
1908
  key: 1,
@@ -1871,15 +1917,34 @@ function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
1871
1917
  class: "r-is-spinning r-icon-light-gray r-inline-3"
1872
1918
  }))
1873
1919
  : createCommentVNode("", true),
1874
- ($props.capitalizeFirstLetter)
1875
- ? (openBlock(), createElementBlock("div", _hoisted_4$c, [
1876
- renderSlot(_ctx.$slots, "default", {}, () => [
1877
- createTextVNode("Apply")
1878
- ])
1879
- ]))
1880
- : renderSlot(_ctx.$slots, "default", { key: 2 }, () => [
1881
- createTextVNode("Apply")
1882
- ])
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)
1883
1948
  ], 16, _hoisted_3$c))
1884
1949
  }
1885
1950
  var RButton = /*#__PURE__*/_export_sfc$1(_sfc_main$t, [['render',_sfc_render$t]]);