@citizenplane/pimp 17.0.4 → 17.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citizenplane/pimp",
3
- "version": "17.0.4",
3
+ "version": "17.0.6",
4
4
  "scripts": {
5
5
  "dev": "storybook dev -p 8081",
6
6
  "build-storybook": "storybook build --output-dir ./docs",
@@ -5,6 +5,7 @@
5
5
  class="cpButton"
6
6
  :class="dynamicClasses"
7
7
  :disabled="isButtonDisabled"
8
+ :href="hrefValue"
8
9
  role="button"
9
10
  tabindex="0"
10
11
  :type="type"
@@ -44,16 +45,18 @@ export interface Props {
44
45
  color?: 'neutral' | 'accent' | 'error' | 'warning' | 'success'
45
46
  disabled?: boolean
46
47
  enableHaptics?: boolean
48
+ href?: string
47
49
  isLoading?: boolean
48
50
  isSquare?: boolean
49
51
  size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg'
50
- tag?: 'button' | 'a'
52
+ tag?: 'a' | 'button' | 'label'
51
53
  type?: 'button' | 'submit' | 'reset'
52
54
  }
53
55
 
54
56
  const props = withDefaults(defineProps<Props>(), {
55
57
  appearance: 'primary',
56
58
  color: 'neutral',
59
+ href: undefined,
57
60
  tag: 'button',
58
61
  type: 'button',
59
62
  size: 'md',
@@ -78,6 +81,8 @@ const hasIconAfter = computed(() => !!slots['trailing-icon'])
78
81
 
79
82
  const isButtonDisabled = computed(() => props.disabled || props.isLoading)
80
83
 
84
+ const hrefValue = computed(() => (props.tag === 'a' ? props.href : undefined))
85
+
81
86
  const dynamicClasses = computed(() => {
82
87
  return [
83
88
  `cpButton--is${capitalizedAppearance.value}`,
@@ -34,7 +34,7 @@ const meta = {
34
34
  },
35
35
  tag: {
36
36
  control: 'select',
37
- options: ['button', 'a'],
37
+ options: ['a', 'button', 'label'],
38
38
  description: 'The HTML element to render',
39
39
  },
40
40
  type: {