@tak-ps/vue-tabler 4.7.0 → 4.8.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
@@ -10,6 +10,10 @@
10
10
 
11
11
  ## Version History
12
12
 
13
+ ### v4.8.0
14
+
15
+ - :rocket: Allow setting button colour via prop
16
+
13
17
  ### v4.7.0
14
18
 
15
19
  - :arrow_up: Remove Babel
@@ -2,6 +2,7 @@
2
2
  <button
3
3
  tabindex='0'
4
4
  :disabled='props.disabled'
5
+ :style='buttonStyle'
5
6
  class='btn'
6
7
  >
7
8
  <slot />
@@ -9,9 +10,18 @@
9
10
  </template>
10
11
 
11
12
  <script setup lang="ts">
13
+ import { computed } from 'vue';
14
+
12
15
  export interface ButtonProps {
16
+ color?: string;
13
17
  disabled?: boolean;
14
18
  }
15
19
 
16
20
  const props = defineProps<ButtonProps>();
21
+
22
+ const buttonStyle = computed(() => {
23
+ return {
24
+ backgroundColor: props.color
25
+ };
26
+ });
17
27
  </script>
@@ -7,8 +7,9 @@
7
7
  :class='{
8
8
  "cursor-pointer": props.disabled === false,
9
9
  "cursor-default disabled": props.disabled === true,
10
- "custom-hover": props.hover,
10
+ "custom-hover": props.hover && !props.color,
11
11
  }'
12
+ :style='iconButtonStyle'
12
13
  class='rounded'
13
14
  @keyup.enter='icon?.click()'
14
15
  >
@@ -17,13 +18,14 @@
17
18
  </template>
18
19
 
19
20
  <script setup lang="ts">
20
- import { useId, useTemplateRef } from 'vue'
21
+ import { computed, useId, useTemplateRef } from 'vue'
21
22
 
22
23
  const iconid = useId();
23
24
 
24
25
  const icon = useTemplateRef<HTMLElement>(iconid);
25
26
 
26
27
  export interface IconButtonProps {
28
+ color?: string;
27
29
  title: string;
28
30
  hover?: boolean;
29
31
  disabled?: boolean;
@@ -33,6 +35,12 @@ const props = withDefaults(defineProps<IconButtonProps>(), {
33
35
  hover: true,
34
36
  disabled: false
35
37
  });
38
+
39
+ const iconButtonStyle = computed(() => {
40
+ return {
41
+ backgroundColor: props.color
42
+ };
43
+ });
36
44
  </script>
37
45
 
38
46
  <style scoped>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/vue-tabler",
3
3
  "type": "module",
4
- "version": "4.7.0",
4
+ "version": "4.8.0",
5
5
  "lib": "lib.ts",
6
6
  "main": "lib.ts",
7
7
  "module": "lib.ts",