@rededor/cura 0.3.6 → 0.3.8

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.
Files changed (106) hide show
  1. package/dist/cjs/{app-globals-a41d7f40.js → app-globals-ecab0d49.js} +43 -80
  2. package/dist/cjs/app-globals-ecab0d49.js.map +1 -0
  3. package/dist/cjs/cura-button_9.cjs.entry.js +519 -0
  4. package/dist/cjs/cura-button_9.cjs.entry.js.map +1 -0
  5. package/dist/cjs/cura.cjs.js +2 -2
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/collection/api/modules/cura-theme-colors-module.js +7 -2
  8. package/dist/collection/api/modules/cura-theme-colors-module.js.map +1 -1
  9. package/dist/collection/api/theme-presets/static.js +20 -62
  10. package/dist/collection/api/theme-presets/static.js.map +1 -1
  11. package/dist/collection/api/theme-presets/theme-maternity.js +15 -15
  12. package/dist/collection/api/theme-presets/theme-maternity.js.map +1 -1
  13. package/dist/collection/collection-manifest.json +3 -0
  14. package/dist/collection/components/buttons/cura-button/cura-button.css +128 -125
  15. package/dist/collection/components/buttons/cura-button/cura-button.js +36 -33
  16. package/dist/collection/components/buttons/cura-button/cura-button.js.map +1 -1
  17. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.css +220 -0
  18. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js +308 -0
  19. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js.map +1 -0
  20. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.css +204 -0
  21. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js +308 -0
  22. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js.map +1 -0
  23. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.css +33 -0
  24. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js +77 -0
  25. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js.map +1 -0
  26. package/dist/collection/components/text/cura-display/cura-display.js +3 -3
  27. package/dist/collection/components/text/cura-display/cura-display.js.map +1 -1
  28. package/dist/collection/components/text/cura-heading/cura-heading.js +3 -3
  29. package/dist/collection/components/text/cura-heading/cura-heading.js.map +1 -1
  30. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +3 -3
  31. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js.map +1 -1
  32. package/dist/components/cura-button-outline.d.ts +11 -0
  33. package/dist/components/cura-button-outline.js +123 -0
  34. package/dist/components/cura-button-outline.js.map +1 -0
  35. package/dist/components/cura-button-transparent.d.ts +11 -0
  36. package/dist/components/cura-button-transparent.js +123 -0
  37. package/dist/components/cura-button-transparent.js.map +1 -0
  38. package/dist/components/cura-button.js +28 -18
  39. package/dist/components/cura-button.js.map +1 -1
  40. package/dist/components/cura-display.js +3 -3
  41. package/dist/components/cura-display.js.map +1 -1
  42. package/dist/components/cura-heading.js +3 -3
  43. package/dist/components/cura-heading.js.map +1 -1
  44. package/dist/components/cura-loader-circle.d.ts +11 -0
  45. package/dist/components/cura-loader-circle.js +8 -0
  46. package/dist/components/cura-loader-circle.js.map +1 -0
  47. package/dist/components/cura-loader-circle2.js +51 -0
  48. package/dist/components/cura-loader-circle2.js.map +1 -0
  49. package/dist/components/cura-paragraph.js +3 -3
  50. package/dist/components/cura-paragraph.js.map +1 -1
  51. package/dist/components/index.js +48 -79
  52. package/dist/components/index.js.map +1 -1
  53. package/dist/cura/cura.esm.js +1 -1
  54. package/dist/cura/cura.esm.js.map +1 -1
  55. package/dist/cura/cura.js +1 -1
  56. package/dist/cura/p-25345c98.system.entry.js +2 -0
  57. package/dist/cura/p-25345c98.system.entry.js.map +1 -0
  58. package/dist/cura/p-57041fe8.js +2 -0
  59. package/dist/cura/p-57041fe8.js.map +1 -0
  60. package/dist/cura/p-ae80dcbd.system.js +2 -0
  61. package/dist/cura/p-ae80dcbd.system.js.map +1 -0
  62. package/dist/cura/p-bb730a40.entry.js +2 -0
  63. package/dist/cura/p-bb730a40.entry.js.map +1 -0
  64. package/dist/cura/p-fb838a73.system.js +2 -0
  65. package/dist/cura/p-fb838a73.system.js.map +1 -0
  66. package/dist/esm/{app-globals-8ed931e6.js → app-globals-51eaad0e.js} +43 -80
  67. package/dist/esm/app-globals-51eaad0e.js.map +1 -0
  68. package/dist/esm/cura-button_9.entry.js +507 -0
  69. package/dist/esm/cura-button_9.entry.js.map +1 -0
  70. package/dist/esm/cura.js +2 -2
  71. package/dist/esm/loader.js +2 -2
  72. package/dist/esm-es5/app-globals-51eaad0e.js +2 -0
  73. package/dist/esm-es5/app-globals-51eaad0e.js.map +1 -0
  74. package/dist/esm-es5/cura-button_9.entry.js +2 -0
  75. package/dist/esm-es5/cura-button_9.entry.js.map +1 -0
  76. package/dist/esm-es5/cura.js +1 -1
  77. package/dist/esm-es5/cura.js.map +1 -1
  78. package/dist/esm-es5/loader.js +1 -1
  79. package/dist/esm-es5/loader.js.map +1 -1
  80. package/dist/types/api/theme-presets/static.d.ts +20 -40
  81. package/dist/types/components/buttons/cura-button/cura-button.d.ts +6 -4
  82. package/dist/types/components/buttons/cura-button-outline/cura-button-outline.d.ts +61 -0
  83. package/dist/types/components/buttons/cura-button-transparent/cura-button-transparent.d.ts +61 -0
  84. package/dist/types/components/loaders/cura-loader-circle/cura-loader-circle.d.ts +23 -0
  85. package/dist/types/components.d.ts +251 -4
  86. package/package.json +2 -2
  87. package/dist/cjs/app-globals-a41d7f40.js.map +0 -1
  88. package/dist/cjs/cura-button_6.cjs.entry.js +0 -336
  89. package/dist/cjs/cura-button_6.cjs.entry.js.map +0 -1
  90. package/dist/cura/p-36c8b693.system.js +0 -2
  91. package/dist/cura/p-36c8b693.system.js.map +0 -1
  92. package/dist/cura/p-4e3b7ddf.entry.js +0 -2
  93. package/dist/cura/p-4e3b7ddf.entry.js.map +0 -1
  94. package/dist/cura/p-4fc49972.system.js +0 -2
  95. package/dist/cura/p-4fc49972.system.js.map +0 -1
  96. package/dist/cura/p-8cd9f935.system.entry.js +0 -2
  97. package/dist/cura/p-8cd9f935.system.entry.js.map +0 -1
  98. package/dist/cura/p-bac0b4ab.js +0 -2
  99. package/dist/cura/p-bac0b4ab.js.map +0 -1
  100. package/dist/esm/app-globals-8ed931e6.js.map +0 -1
  101. package/dist/esm/cura-button_6.entry.js +0 -327
  102. package/dist/esm/cura-button_6.entry.js.map +0 -1
  103. package/dist/esm-es5/app-globals-8ed931e6.js +0 -2
  104. package/dist/esm-es5/app-globals-8ed931e6.js.map +0 -1
  105. package/dist/esm-es5/cura-button_6.entry.js +0 -2
  106. package/dist/esm-es5/cura-button_6.entry.js.map +0 -1
@@ -1,75 +1,142 @@
1
+ /**
2
+ * Global Button Definitions.
3
+ * Required CSS Properties:
4
+ * --font-size
5
+ * --base-spacing
6
+ * --font-family
7
+ * --font-weight-medium
8
+ * --text-align
9
+ */
10
+ /**
11
+ * Buttons Host element definitions.
12
+ * Use: @include button-host() { ... }
13
+ */
14
+ /**
15
+ * Buttons base definitions.
16
+ * Use: @include button-element() { ... }
17
+ */
18
+ /**
19
+ * Button sizes definitions.
20
+ * Use: @include button-sizes() { ... }
21
+ */
22
+ /**
23
+ * Button container definitions.
24
+ * Use: @include button-container() { ... }
25
+ */
26
+ /**
27
+ * Button label definitions.
28
+ * Use: @include button-label() { ... }
29
+ */
30
+ /**
31
+ * Button shadow definitions.
32
+ * Use: @include button-label() { ... }
33
+ */
34
+ /**
35
+ * Button disabled state definitions
36
+ * Use: @include button-disabled() { ... }
37
+ */
38
+ /**
39
+ * Button loading state definitions
40
+ * Use: @include button-loading() { ... }
41
+ */
42
+ /**
43
+ * Button icon definitions
44
+ * Use: @include button-icon() { ... }
45
+ */
46
+ /**
47
+ * Button icon only behavior definitions
48
+ * Use: @include button-icon-only-behavior() { ... }
49
+ */
1
50
  :host {
51
+ --border-radius: 4px;
2
52
  display: inline-block;
3
53
  vertical-align: middle;
4
54
  }
5
55
  :host button, :host a {
6
- --shadown-color: 38, 38, 38;
7
- --shadow-opacity: 0.16;
8
56
  outline: none;
9
57
  box-shadow: none;
10
58
  box-sizing: border-box;
11
- padding: calc(var(--base-spacing) * 3.5px) calc(var(--base-spacing) * 4px);
12
- min-height: calc(var(--base-spacing) * 13px);
13
59
  display: flex;
14
60
  width: 100%;
15
61
  align-items: center;
16
62
  justify-content: center;
17
- border-radius: 4px;
18
- transition: background-color 0.05s linear, box-shadow 0.05s linear, border-color 0.05s linear;
63
+ text-decoration: none !important;
19
64
  font-size: var(--font-size);
20
65
  cursor: pointer;
66
+ transition: background-color 0.07s linear, box-shadow 0.07s linear, border-color 0.07s linear;
67
+ border-radius: var(--border-radius);
68
+ background-color: var(--color-base);
69
+ border: none;
70
+ padding: calc(var(--base-spacing) * 3.5px) calc(var(--base-spacing) * 4px);
71
+ min-height: calc(var(--base-spacing) * 13px);
72
+ min-width: calc(var(--base-spacing) * 13px);
73
+ }
74
+ :host button:not(.isLoading):not(.disabled):hover, :host a:not(.isLoading):not(.disabled):hover {
75
+ background-color: var(--color-light);
76
+ }
77
+ :host button:not(.isLoading):not(.disabled):active, :host a:not(.isLoading):not(.disabled):active {
78
+ background-color: var(--color-dark);
79
+ }
80
+ :host button:hover, :host a:hover {
81
+ box-shadow: 0 4px 8px 0 rgba(38, 38, 38, 0.16);
82
+ }
83
+ :host button.medium:hover, :host a.medium:hover {
84
+ box-shadow: 0 3px 6px 0 rgba(38, 38, 38, 0.16);
85
+ }
86
+ :host button.small:hover, :host a.small:hover {
87
+ box-shadow: 0 2px 5px 0 rgba(38, 38, 38, 0.16);
88
+ }
89
+ :host button:active, :host button.disabled:hover, :host button.isLoading:hover, :host a:active, :host a.disabled:hover, :host a.isLoading:hover {
90
+ box-shadow: none !important;
91
+ }
92
+ :host button.medium, :host a.medium {
93
+ padding: calc(var(--base-spacing) * 2.75px) calc(var(--base-spacing) * 4px);
94
+ min-height: calc(var(--base-spacing) * 11px);
95
+ min-width: calc(var(--base-spacing) * 11px);
96
+ }
97
+ :host button.small, :host a.small {
98
+ padding: calc(var(--base-spacing) * 1.5px) calc(var(--base-spacing) * 3px);
99
+ min-height: calc(var(--base-spacing) * 8px);
100
+ min-width: calc(var(--base-spacing) * 8px);
21
101
  }
22
102
  :host button .button-container, :host a .button-container {
23
103
  display: flex;
24
104
  align-items: center;
105
+ opacity: 1;
106
+ transition: opacity 0.2s linear;
25
107
  }
26
- :host button:hover, :host a:hover {
27
- box-shadow: 0 4px 8px 0 RGBA(var(--shadown-color), var(--shadow-opacity));
28
- }
29
- :host button:active, :host a:active {
30
- box-shadow: none;
108
+ :host button.icon-right .button-container, :host a.icon-right .button-container {
109
+ flex-direction: row-reverse;
31
110
  }
32
111
  :host button .label, :host a .label {
33
112
  flex: 1;
34
- color: var(--neutral-black);
35
113
  font-family: var(--font-family);
36
114
  font-weight: var(--font-weight-medium);
37
115
  font-size: 1.43em;
38
- line-height: 1.1em;
116
+ line-height: 1.2em;
39
117
  text-align: var(--text-align, "left");
118
+ color: var(--neutral-black);
119
+ }
120
+ :host button .label.inverted, :host a .label.inverted {
121
+ color: var(--neutral-white);
122
+ }
123
+ :host button.medium .label, :host a.medium .label {
124
+ font-size: 1.14em;
125
+ }
126
+ :host button.small .label, :host a.small .label {
127
+ font-size: 1em;
40
128
  }
41
129
  :host button.icon-left cura-icon, :host a.icon-left cura-icon {
42
130
  margin-right: calc(var(--base-spacing) * 3px);
43
131
  }
44
- :host button.icon-right .button-container, :host a.icon-right .button-container {
45
- flex-direction: row-reverse;
46
- }
47
132
  :host button.icon-right cura-icon, :host a.icon-right cura-icon {
48
133
  margin-left: calc(var(--base-spacing) * 3px);
49
134
  }
50
- :host button.medium, :host a.medium {
51
- padding: calc(var(--base-spacing) * 2.75px) calc(var(--base-spacing) * 4px);
52
- min-height: calc(var(--base-spacing) * 11px);
53
- }
54
- :host button.medium:hover, :host a.medium:hover {
55
- box-shadow: 0 3px 6px 0 RGBA(var(--shadown-color), var(--shadow-opacity));
56
- }
57
- :host button.medium:active, :host a.medium:active {
58
- box-shadow: none;
59
- }
60
- :host button.medium .label, :host a.medium .label {
61
- font-size: 1.14em;
62
- letter-spacing: 2%;
63
- }
64
- :host button.small, :host a.small {
65
- padding: calc(var(--base-spacing) * 1.5px) calc(var(--base-spacing) * 3px);
66
- min-height: calc(var(--base-spacing) * 8px);
135
+ :host button.medium.icon-left cura-icon, :host a.medium.icon-left cura-icon {
136
+ margin-right: calc(var(--base-spacing) * 2.7px);
67
137
  }
68
- :host button.small:hover, :host a.small:hover {
69
- box-shadow: 0 2px 5px 0 RGBA(var(--shadown-color), var(--shadow-opacity));
70
- }
71
- :host button.small:active, :host a.small:active {
72
- box-shadow: none;
138
+ :host button.medium.icon-right cura-icon, :host a.medium.icon-right cura-icon {
139
+ margin-left: calc(var(--base-spacing) * 2.7px);
73
140
  }
74
141
  :host button.small.icon-left cura-icon, :host a.small.icon-left cura-icon {
75
142
  margin-right: calc(var(--base-spacing) * 2.5px);
@@ -77,106 +144,42 @@
77
144
  :host button.small.icon-right cura-icon, :host a.small.icon-right cura-icon {
78
145
  margin-left: calc(var(--base-spacing) * 2.5px);
79
146
  }
80
- :host button.small .label, :host a.small .label {
81
- font-size: 1em;
82
- letter-spacing: 2%;
83
- }
84
147
  :host button.disabled, :host a.disabled {
85
148
  cursor: not-allowed;
86
- }
87
- :host button.disabled:hover, :host a.disabled:hover {
88
- box-shadow: none;
89
- }
90
- :host button.button-solid, :host a.button-solid {
91
- background-color: var(--color-base);
92
- /* border-width: 1px;
93
- border-color: var(--color-dark);
94
- border-style: solid; */
95
- border: none;
96
- }
97
- :host button.button-solid:hover, :host a.button-solid:hover {
98
- background-color: var(--color-light);
99
- }
100
- :host button.button-solid:active, :host a.button-solid:active {
101
- background-color: var(--color-dark);
102
- }
103
- :host button.button-solid .label, :host a.button-solid .label {
104
- color: var(--neutral-black);
105
- }
106
- :host button.button-solid .label.inverted, :host a.button-solid .label.inverted {
107
- color: var(--neutral-white);
108
- }
109
- :host button.button-solid.disabled, :host a.button-solid.disabled {
110
149
  background-color: var(--neutral-light);
111
150
  }
112
- :host button.button-solid.disabled .label, :host button.button-solid.disabled .label.inverted, :host a.button-solid.disabled .label, :host a.button-solid.disabled .label.inverted {
151
+ :host button.disabled .label, :host button.disabled .label.inverted, :host a.disabled .label, :host a.disabled .label.inverted {
113
152
  color: var(--neutral-dark);
114
153
  }
115
- :host button.button-outline, :host a.button-outline {
116
- background-color: transparent;
117
- border-width: 2px;
118
- border-color: var(--color-base);
119
- border-style: solid;
120
- }
121
- :host button.button-outline:hover, :host a.button-outline:hover {
122
- border-color: var(--color-light);
154
+ :host button.icon-only, :host a.icon-only {
155
+ padding: calc(var(--base-spacing) * 3.5px);
123
156
  }
124
- :host button.button-outline:not(.disabled):hover .label, :host a.button-outline:not(.disabled):hover .label {
125
- color: var(--color-light);
157
+ :host button.icon-only .label, :host a.icon-only .label {
158
+ display: none;
126
159
  }
127
- :host button.button-outline:not(.disabled):hover cura-icon, :host a.button-outline:not(.disabled):hover cura-icon {
128
- --color: var(--color-light) !important;
160
+ :host button.icon-only cura-icon, :host a.icon-only cura-icon {
161
+ margin-left: 0 !important;
162
+ margin-right: 0 !important;
129
163
  }
130
- :host button.button-outline .label, :host a.button-outline .label {
131
- color: var(--color-base);
164
+ :host button.icon-only.medium, :host a.icon-only.medium {
165
+ padding: calc(var(--base-spacing) * 2.75px);
132
166
  }
133
- :host button.button-outline .label.inverted, :host a.button-outline .label.inverted {
134
- color: var(--neutral-white);
135
- }
136
- :host button.button-outline:not(.disabled):not(.inverted):active, :host a.button-outline:not(.disabled):not(.inverted):active {
137
- border-color: var(--color-dark);
167
+ :host button.icon-only.small, :host a.icon-only.small {
168
+ padding: calc(var(--base-spacing) * 1.5px);
138
169
  }
139
- :host button.button-outline:not(.disabled):not(.inverted):active .label, :host a.button-outline:not(.disabled):not(.inverted):active .label {
140
- color: var(--color-dark);
170
+ :host button cura-loader-circle, :host a cura-loader-circle {
171
+ position: absolute;
172
+ display: none;
141
173
  }
142
- :host button.button-outline:not(.disabled):not(.inverted):active cura-icon, :host a.button-outline:not(.disabled):not(.inverted):active cura-icon {
143
- --color: var(--color-dark) !important;
174
+ :host button.isLoading, :host a.isLoading {
175
+ cursor: wait;
144
176
  }
145
- :host button.button-outline.disabled, :host a.button-outline.disabled {
146
- border-color: var(--neutral-base);
177
+ :host button.isLoading .button-container, :host a.isLoading .button-container {
178
+ opacity: 0.3;
147
179
  }
148
- :host button.button-outline.disabled .label, :host button.button-outline.disabled .label.inverted, :host a.button-outline.disabled .label, :host a.button-outline.disabled .label.inverted {
149
- color: var(--neutral-dark);
150
- }
151
- :host button.button-outline.inverted, :host a.button-outline.inverted {
152
- border-color: var(--neutral-white);
153
- }
154
- :host button.button-outline.inverted:hover, :host a.button-outline.inverted:hover {
155
- border-color: var(--color-lighter);
156
- box-shadow: none;
157
- }
158
- :host button.button-outline.inverted:hover .label, :host a.button-outline.inverted:hover .label {
159
- color: var(--color-lighter);
160
- }
161
- :host button.button-outline.inverted:hover cura-icon, :host a.button-outline.inverted:hover cura-icon {
162
- --color: var(--color-lighter) !important;
163
- }
164
- :host button.button-outline.inverted:not(.disabled):active, :host a.button-outline.inverted:not(.disabled):active {
165
- border-color: var(--color-light);
166
- }
167
- :host button.button-outline.inverted:not(.disabled):active .label, :host a.button-outline.inverted:not(.disabled):active .label {
168
- color: var(--color-light);
169
- }
170
- :host button.button-outline.inverted:not(.disabled):active cura-icon, :host a.button-outline.inverted:not(.disabled):active cura-icon {
171
- --color: var(--color-light) !important;
172
- }
173
- :host button.button-outline.inverted.disabled, :host a.button-outline.inverted.disabled {
174
- opacity: 0.6;
175
- border-color: var(--neutral-white);
176
- }
177
- :host button.button-outline.inverted.disabled .label, :host button.button-outline.inverted.disabled .label.inverted, :host a.button-outline.inverted.disabled .label, :host a.button-outline.inverted.disabled .label.inverted {
178
- color: var(--neutral-white);
180
+ :host button.isLoading.icon-only .button-container, :host a.isLoading.icon-only .button-container {
181
+ opacity: 0;
179
182
  }
180
- :host button.button-outline.inverted.disabled cura-icon, :host a.button-outline.inverted.disabled cura-icon {
181
- --color: var(--neutral-white) !important;
183
+ :host button.isLoading cura-loader-circle, :host a.isLoading cura-loader-circle {
184
+ display: block;
182
185
  }
@@ -1,13 +1,13 @@
1
1
  import { Host, h } from '@stencil/core';
2
2
  export class CuraButton {
3
3
  constructor() {
4
- this.type = 'solid';
5
- this.size = 'large';
4
+ this.size = 'medium';
6
5
  this.disabled = false;
7
6
  this.isLoading = false;
8
7
  this.iconName = undefined;
9
8
  this.iconset = 'default';
10
9
  this.iconPosition = 'left';
10
+ this.iconOnly = undefined;
11
11
  this.href = undefined;
12
12
  this.target = "_self";
13
13
  this.color = 'accent';
@@ -23,9 +23,7 @@ export class CuraButton {
23
23
  this.styles['--base-spacing'] = window.CuraAPI.theme.spacing.getSpacing();
24
24
  this.styles['--neutral-white'] = window.CuraAPI.theme.colors.getColor(`neutral-white`);
25
25
  this.styles['--neutral-light'] = window.CuraAPI.theme.colors.getColor(`neutral-light`);
26
- this.styles['--neutral-base'] = window.CuraAPI.theme.colors.getColor(`neutral-base`);
27
26
  this.styles['--neutral-dark'] = window.CuraAPI.theme.colors.getColor(`neutral-dark`);
28
- this.styles['--neutral-black'] = window.CuraAPI.theme.colors.getColor(`neutral-black`);
29
27
  this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();
30
28
  this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();
31
29
  this.styles['--font-weight-medium'] = this.weights.medium;
@@ -34,31 +32,37 @@ export class CuraButton {
34
32
  }
35
33
  getClasses() {
36
34
  const classes = {};
37
- classes[`button-${this.type.toLowerCase()}`] = true;
38
35
  classes[`${this.size.toLowerCase()}`] = true;
39
36
  classes[`icon-${this.iconPosition.toLowerCase()}`] = true;
37
+ classes[`icon-only`] = this.iconOnly;
40
38
  classes['inverted'] = this.fontColor === 'light';
41
39
  classes['disabled'] = this.disabled;
40
+ classes['isLoading'] = this.isLoading;
42
41
  return classes;
43
42
  }
44
43
  setColors() {
45
- this.styles = Object.assign(Object.assign({}, this.styles), { '--color-lighter': window.CuraAPI.theme.colors.getColor(`${this.color}-lighter`), '--color-light': window.CuraAPI.theme.colors.getColor(`${this.color}-light`), '--color-base': window.CuraAPI.theme.colors.getColor(`${this.color}-base`), '--color-dark': window.CuraAPI.theme.colors.getColor(`${this.color}-dark`) });
44
+ this.styles = Object.assign(Object.assign({}, this.styles), { '--color-light': window.CuraAPI.theme.colors.getColor(`${this.color}-light`), '--color-base': window.CuraAPI.theme.colors.getColor(`${this.color}-base`), '--color-dark': window.CuraAPI.theme.colors.getColor(`${this.color}-dark`) });
46
45
  }
47
46
  getIcon() {
48
47
  if (!this.iconName)
49
48
  return '';
50
49
  const iconSize = this.size === 'small' ? 16 : this.size === 'medium' ? 20 : 24;
51
- const color = this.disabled
50
+ const color = this.getSymbolColor();
51
+ return h("cura-icon", { name: this.iconName, iconset: this.iconset, size: iconSize, color: color });
52
+ }
53
+ getSymbolColor() {
54
+ return this.disabled
52
55
  ? 'neutral-dark'
53
56
  : this.fontColor === 'light'
54
57
  ? 'neutral-white'
55
- : this.type === 'solid'
56
- ? 'neutral-black'
57
- : `${this.color}-base`;
58
- return h("cura-icon", { name: this.iconName, iconset: this.iconset, size: iconSize, color: color });
58
+ : 'neutral-black';
59
+ }
60
+ handleClick(e) {
61
+ if (this.disabled || this.isLoading)
62
+ e.preventDefault();
59
63
  }
60
64
  render() {
61
- return (h(Host, null, this.href ? (h("a", { href: this.disabled ? '' : this.href, target: this.target, class: this.getClasses(), style: this.styles }, h("span", { class: "button-container" }, this.getIcon(), h("span", { class: { label: true, inverted: this.fontColor === 'light' } }, h("slot", null))))) : (h("button", { class: this.getClasses(), style: this.styles, disabled: this.disabled || null }, h("span", { class: "button-container" }, this.getIcon(), h("span", { class: { label: true, inverted: this.fontColor === 'light' } }, h("slot", null)))))));
65
+ return (h(Host, null, this.href ? (h("a", { href: this.disabled ? '' : this.href, target: this.target, class: this.getClasses(), style: this.styles, onClick: (e) => this.handleClick(e) }, h("span", { class: "button-container" }, this.getIcon(), h("span", { class: { label: true, inverted: this.fontColor === 'light' } }, h("slot", null))), h("cura-loader-circle", { size: this.size, color: this.getSymbolColor() }))) : (h("button", { class: this.getClasses(), style: this.styles, disabled: this.disabled || null, onClick: (e) => this.handleClick(e) }, h("span", { class: "button-container" }, this.getIcon(), h("span", { class: { label: true, inverted: this.fontColor === 'light' } }, h("slot", null))), h("cura-loader-circle", { size: this.size, color: this.getSymbolColor() })))));
62
66
  }
63
67
  static get is() { return "cura-button"; }
64
68
  static get encapsulation() { return "shadow"; }
@@ -74,24 +78,6 @@ export class CuraButton {
74
78
  }
75
79
  static get properties() {
76
80
  return {
77
- "type": {
78
- "type": "string",
79
- "mutable": false,
80
- "complexType": {
81
- "original": "'solid' | 'outline' | 'transparent' | 'icon'",
82
- "resolved": "\"icon\" | \"outline\" | \"solid\" | \"transparent\"",
83
- "references": {}
84
- },
85
- "required": false,
86
- "optional": false,
87
- "docs": {
88
- "tags": [],
89
- "text": "Button type: solid (default) | outline | transparent | icon."
90
- },
91
- "attribute": "type",
92
- "reflect": true,
93
- "defaultValue": "'solid'"
94
- },
95
81
  "size": {
96
82
  "type": "string",
97
83
  "mutable": false,
@@ -108,7 +94,7 @@ export class CuraButton {
108
94
  },
109
95
  "attribute": "size",
110
96
  "reflect": true,
111
- "defaultValue": "'large'"
97
+ "defaultValue": "'medium'"
112
98
  },
113
99
  "disabled": {
114
100
  "type": "boolean",
@@ -199,6 +185,23 @@ export class CuraButton {
199
185
  "reflect": true,
200
186
  "defaultValue": "'left'"
201
187
  },
188
+ "iconOnly": {
189
+ "type": "boolean",
190
+ "mutable": false,
191
+ "complexType": {
192
+ "original": "false",
193
+ "resolved": "boolean",
194
+ "references": {}
195
+ },
196
+ "required": false,
197
+ "optional": false,
198
+ "docs": {
199
+ "tags": [],
200
+ "text": "Set button to FAB/icon only."
201
+ },
202
+ "attribute": "icon-only",
203
+ "reflect": true
204
+ },
202
205
  "href": {
203
206
  "type": "string",
204
207
  "mutable": false,
@@ -231,7 +234,7 @@ export class CuraButton {
231
234
  "text": "Set target if link."
232
235
  },
233
236
  "attribute": "target",
234
- "reflect": false,
237
+ "reflect": true,
235
238
  "defaultValue": "\"_self\""
236
239
  },
237
240
  "color": {
@@ -285,7 +288,7 @@ export class CuraButton {
285
288
  "text": "Set text aligment for the button label.\nVales: left (default) | center | right."
286
289
  },
287
290
  "attribute": "text-align",
288
- "reflect": false,
291
+ "reflect": true,
289
292
  "defaultValue": "'left'"
290
293
  }
291
294
  };
@@ -1 +1 @@
1
- {"version":3,"file":"cura-button.js","sourceRoot":"","sources":["../../../../src/components/buttons/cura-button/cura-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAOvE,MAAM,OAAO,UAAU;;gBAKuD,OAAO;gBAIvB,OAAO;oBAKjC,KAAK;qBAIJ,KAAK;;mBASP,SAAS;wBAIc,MAAM;;kBAS7C,OAAO;iBAKR,QAAQ;qBAQ6B,MAAM;qBAKV,MAAM;kBAGrC,EAAE;;EAdpB,iBAAiB;IACf,IAAI,CAAC,SAAS,EAAE,CAAC;EACnB,CAAC;EAgBD,iBAAiB;IACf,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IACvD,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;IAC1E,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IACvF,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Prop, Watch, State } from '@stencil/core';\n\n@Component({\n tag: 'cura-button',\n styleUrl: 'cura-button.scss',\n shadow: true,\n})\nexport class CuraButton {\n\n /**\n * Button type: solid (default) | outline | transparent | icon.\n */\n @Prop({reflect: true}) type: 'solid' | 'outline' | 'transparent' | 'icon' = 'solid';\n /**\n * Button size: small | medium | large (default)\n */\n @Prop({reflect: true}) size: 'small' | 'medium' | 'large' = 'large';\n\n /**\n * Disabled state. Boolean.\n */\n @Prop({reflect: true}) disabled = false;\n /**\n * Loading state. Boolean.\n */\n @Prop({reflect: true}) isLoading = false;\n \n /**\n * Name of the icon to be used from iconset.\n */\n @Prop({reflect: true}) iconName: string;\n /**\n * Custom iconset if needed.\n */\n @Prop({reflect: true}) iconset = 'default';\n /**\n * Icon position: left (default) | right.\n */\n @Prop({reflect: true}) iconPosition: 'left' | 'right' = 'left';\n\n /**\n * Property href switch button to link.\n */\n @Prop({reflect: true}) href: string;\n /**\n * Set target if link.\n */\n @Prop() target = \"_self\";\n\n /**\n * Color base from color scheme. Default: accent.\n */\n @Prop() color = 'accent';\n @Watch('color')\n handleChangeColor() {\n this.setColors();\n }\n /**\n * Set the font color to dark or light.\n */\n @Prop({reflect: true}) fontColor: 'dark' | 'light' = 'dark';\n /**\n * Set text aligment for the button label.\n * Vales: left (default) | center | right.\n */\n @Prop() textAlign: 'left' | 'center' | 'right' = 'left';\n\n\n @State() styles = {};\n\n weights;\n\n connectedCallback() {\n this.weights = window.CuraAPI.theme.fonts.getWeights();\n this.styles['--base-spacing'] = window.CuraAPI.theme.spacing.getSpacing();\n this.styles['--neutral-white'] = window.CuraAPI.theme.colors.getColor(`neutral-white`);\n this.styles['--neutral-light'] = window.CuraAPI.theme.colors.getColor(`neutral-light`);\n this.styles['--neutral-base'] = window.CuraAPI.theme.colors.getColor(`neutral-base`);\n this.styles['--neutral-dark'] = window.CuraAPI.theme.colors.getColor(`neutral-dark`);\n this.styles['--neutral-black'] = window.CuraAPI.theme.colors.getColor(`neutral-black`);\n this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();\n this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();\n this.styles['--font-weight-medium'] = this.weights.medium;\n this.styles['--text-align'] = this.textAlign;\n this.setColors();\n }\n \n getClasses() {\n const classes = {};\n classes[`button-${this.type.toLowerCase()}`] = true;\n classes[`${this.size.toLowerCase()}`] = true;\n classes[`icon-${this.iconPosition.toLowerCase()}`] = true;\n classes['inverted'] = this.fontColor === 'light';\n classes['disabled'] = this.disabled;\n return classes;\n }\n\n setColors() {\n this.styles = {\n ...this.styles,\n '--color-lighter': window.CuraAPI.theme.colors.getColor(`${this.color}-lighter`),\n '--color-light': window.CuraAPI.theme.colors.getColor(`${this.color}-light`),\n '--color-base': window.CuraAPI.theme.colors.getColor(`${this.color}-base`),\n '--color-dark': window.CuraAPI.theme.colors.getColor(`${this.color}-dark`)\n };\n }\n\n getIcon() {\n if (!this.iconName) return '';\n const iconSize = this.size === 'small' ? 16 : this.size === 'medium' ? 20 : 24;\n const color = this.disabled \n ? 'neutral-dark' \n : this.fontColor === 'light' \n ? 'neutral-white' \n : this.type === 'solid'\n ? 'neutral-black'\n : `${this.color}-base`;\n return <cura-icon name={this.iconName} iconset={this.iconset} size={iconSize} color={color}></cura-icon>;\n }\n\n render() {\n return (\n <Host>\n { this.href ? (\n <a href={this.disabled ? '' : this.href} target={this.target} class={this.getClasses()} style={this.styles}>\n <span class=\"button-container\">\n { this.getIcon() }\n <span class={{label: true, inverted: this.fontColor === 'light'}}><slot></slot></span>\n </span>\n </a>\n ) : (\n <button class={this.getClasses()} style={this.styles} disabled={this.disabled || null}>\n <span class=\"button-container\">\n { this.getIcon() }\n <span class={{label: true, inverted: this.fontColor === 'light'}}><slot></slot></span>\n </span>\n </button>\n )}\n </Host>\n );\n }\n\n}\n"]}
1
+ {"version":3,"file":"cura-button.js","sourceR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AQ,EAAE,IAAI,CAAC,SAAS,KAAK,OAAO,EAAC;UAAE,eAAa,CAAO,CACjF;MACP,0BAAoB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,GAAuB,CACtF,CACL,CAAC,CAAC,CAAC,CACF,cAAQ,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,EAC9B,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,EAC/B,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;MACnC,YAAM,KAAK,EAAC,kBAAkB;QAC1B,IAAI,CAAC,OAAO,EAAE;QAChB,YAAM,KAAK,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,KAAK,OAAO,EAAC;UAAE,eAAa,CAAO,CACjF;MACP,0BAAoB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,GAAuB,CACjF,CACV,CACM,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Prop, Watch, State } from '@stencil/core';\n\n@Component({\n tag: 'cura-button',\n styleUrl: 'cura-button.scss',\n shadow: true,\n})\nexport class CuraButton {\n\n /**\n * Button size: small | medium | large (default)\n */\n @Prop({reflect: true}) size: 'small' | 'medium' | 'large' = 'medium';\n\n /**\n * Disabled state. Boolean.\n */\n @Prop({reflect: true}) disabled = false;\n /**\n * Loading state. Boolean.\n */\n @Prop({reflect: true}) isLoading = false;\n \n /**\n * Name of the icon to be used from iconset.\n */\n @Prop({reflect: true}) iconName: string;\n /**\n * Custom iconset if needed.\n */\n @Prop({reflect: true}) iconset = 'default';\n /**\n * Icon position: left (default) | right.\n */\n @Prop({reflect: true}) iconPosition: 'left' | 'right' = 'left';\n /**\n * Set button to FAB/icon only.\n */\n @Prop({reflect: true}) iconOnly: false;\n\n /**\n * Property href switch button to link.\n */\n @Prop({reflect: true}) href: string;\n /**\n * Set target if link.\n */\n @Prop({reflect: true}) target = \"_self\";\n\n /**\n * Color base from color scheme. Default: accent.\n */\n @Prop() color = 'accent';\n @Watch('color')\n handleChangeColor() {\n this.setColors();\n }\n /**\n * Set the font color to dark or light.\n */\n @Prop({reflect: true}) fontColor: 'dark' | 'light' = 'dark';\n /**\n * Set text aligment for the button label.\n * Vales: left (default) | center | right.\n */\n @Prop({reflect: true}) textAlign: 'left' | 'center' | 'right' = 'left';\n\n\n @State() styles = {};\n\n weights;\n\n connectedCallback() {\n this.weights = window.CuraAPI.theme.fonts.getWeights();\n this.styles['--base-spacing'] = window.CuraAPI.theme.spacing.getSpacing();\n this.styles['--neutral-white'] = window.CuraAPI.theme.colors.getColor(`neutral-white`);\n this.styles['--neutral-light'] = window.CuraAPI.theme.colors.getColor(`neutral-light`);\n this.styles['--neutral-dark'] = window.CuraAPI.theme.colors.getColor(`neutral-dark`);\n this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();\n this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();\n this.styles['--font-weight-medium'] = this.weights.medium;\n this.styles['--text-align'] = this.textAlign;\n this.setColors();\n }\n \n getClasses() {\n const classes = {};\n classes[`${this.size.toLowerCase()}`] = true;\n classes[`icon-${this.iconPosition.toLowerCase()}`] = true;\n classes[`icon-only`] = this.iconOnly;\n classes['inverted'] = this.fontColor === 'light';\n classes['disabled'] = this.disabled;\n classes['isLoading'] = this.isLoading;\n return classes;\n }\n\n setColors() {\n this.styles = {\n ...this.styles,\n '--color-light': window.CuraAPI.theme.colors.getColor(`${this.color}-light`),\n '--color-base': window.CuraAPI.theme.colors.getColor(`${this.color}-base`),\n '--color-dark': window.CuraAPI.theme.colors.getColor(`${this.color}-dark`)\n };\n }\n\n getIcon() {\n if (!this.iconName) return '';\n const iconSize = this.size === 'small' ? 16 : this.size === 'medium' ? 20 : 24;\n const color = this.getSymbolColor();\n return <cura-icon name={this.iconName} iconset={this.iconset} size={iconSize} color={color}></cura-icon>;\n }\n\n getSymbolColor() {\n return this.disabled \n ? 'neutral-dark' \n : this.fontColor === 'light' \n ? 'neutral-white' \n : 'neutral-black';\n }\n\n handleClick(e: Event) {\n if (this.disabled || this.isLoading) e.preventDefault();\n }\n\n render() {\n return (\n <Host>\n { this.href ? (\n <a href={this.disabled ? '' : this.href} \n target={this.target}\n class={this.getClasses()}\n style={this.styles}\n onClick={(e) => this.handleClick(e)}>\n <span class=\"button-container\">\n { this.getIcon() }\n <span class={{label: true, inverted: this.fontColor === 'light'}}><slot></slot></span>\n </span>\n <cura-loader-circle size={this.size} color={this.getSymbolColor()}></cura-loader-circle>\n </a>\n ) : (\n <button class={this.getClasses()}\n style={this.styles} \n disabled={this.disabled || null}\n onClick={(e) => this.handleClick(e)}>\n <span class=\"button-container\">\n { this.getIcon() }\n <span class={{label: true, inverted: this.fontColor === 'light'}}><slot></slot></span>\n </span>\n <cura-loader-circle size={this.size} color={this.getSymbolColor()}></cura-loader-circle>\n </button>\n )}\n </Host>\n );\n }\n\n}\n"]}