@citizenplane/pimp 7.0.4 β†’ 8.0.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/README.md CHANGED
@@ -14,6 +14,7 @@
14
14
  <br />
15
15
 
16
16
  ---
17
+
17
18
  ## Pimp mission
18
19
 
19
20
  Pimp aims to bring order and consistency to all of our products and processes. We elevate user experience and increase the speed and efficiency of how we design and build products.
@@ -33,8 +34,11 @@ yarn add @citizenplane/pimp
33
34
  ```
34
35
 
35
36
  ## Usage
37
+
36
38
  ### In a nuxt project
37
- 1. Add this line to your `nuxt-config.js`:
39
+
40
+ 1. Add this line to your `nuxt-config.js`:
41
+
38
42
  ```javascript
39
43
  // nuxt-config.js
40
44
  ...
@@ -48,20 +52,20 @@ css: [
48
52
 
49
53
  ```vue
50
54
  <template>
51
- <cp-button appearance='primary' color='purple' />
55
+ <cp-button appearance="primary" color="purple" />
52
56
  </template>
53
57
  <script>
54
58
  import CpButton from '@citizenplane/pimp'
55
59
 
56
60
  export default {
57
61
  components: {
58
- CpButton
62
+ CpButton,
59
63
  },
60
64
  }
61
65
  </script>
62
66
  ```
63
67
 
64
- If you want to use any component without having to import them manually, you can create a plugin:
68
+ If you want to use any component without having to import them manually, you can create a plugin:
65
69
 
66
70
  1. Create a plugin called `citizenplane-pimp.js`:
67
71
 
@@ -73,6 +77,7 @@ import Pimp from '@citizenplane/pimp'
73
77
 
74
78
  Vue.use(Pimp)
75
79
  ```
80
+
76
81
  2. Add this line to your `nuxt-config.js`:
77
82
 
78
83
  ```javascript
@@ -83,19 +88,23 @@ plugins: [
83
88
  ]
84
89
  ...
85
90
  ```
91
+
86
92
  3. Use components directly in your project without having to import nor declaring them:
93
+
87
94
  ```vue
88
95
  <template>
89
- <cp-button appearance='primary' color='purple' />
96
+ <cp-button appearance="primary" color="purple" />
90
97
  </template>
91
98
  ```
92
99
 
93
100
  ## Components
101
+
94
102
  Now that you're all set up, you can retrieve components documentation on [pimp.citizenplane.com](https://pimp.citizenplane.com).
95
103
 
96
104
  ![CitizenPlane's design system hero banner](https://i.imgur.com/WFPUfiW.png)
97
105
 
98
106
  ## πŸ§‘β€πŸ’» Contributing to Pimp
107
+
99
108
  We are working on making this project a fully open source. We appreciate any contributions you might make.
100
109
 
101
110
  ### 🍴 Step 1. Fork this repository
@@ -123,7 +132,7 @@ Now go to `http://localhost:8080` in your browser.
123
132
 
124
133
  ### πŸ›  Step 3. Make your changes
125
134
 
126
- Now you can start developing!
135
+ Now you can start developing!
127
136
 
128
137
  All the components are under the `src/components/` directory and associated code changes will automatically be reflected in the playground.
129
138
 
@@ -148,9 +157,11 @@ To be done
148
157
  Congrats, you're officially a Pimp contributor!
149
158
 
150
159
  ## Feedback
160
+
151
161
  We want to provide only components of the highest quality. We can’t do that without your feedback. If you have any suggestions about what we can do to improve components, please report it directly as an issue or drop us a line at <a href="mailto:tech@citizenplane.com">tech@citizenplane.com</a>.
152
162
 
153
163
  ## πŸ‘ Respect earns Respect
164
+
154
165
  Please respect our Code of Conduct, in short:
155
166
 
156
167
  - Using welcoming and inclusive language
@@ -160,6 +171,7 @@ Please respect our Code of Conduct, in short:
160
171
  - Showing empathy towards other community members
161
172
 
162
173
  ## License
174
+
163
175
  Pimp is released under the MIT license.
164
176
 
165
177
  Copyright Β© 2021 CitizenPlane, Inc.
package/dist/pimp.es.js CHANGED
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- import { openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createBlock, resolveDynamicComponent, mergeProps, withCtx, renderSlot, resolveComponent, createVNode, createCommentVNode, createTextVNode, withDirectives, vModelText, Fragment, renderList, vModelSelect, defineComponent, watch, h as h$1, resolveDirective, Transition, normalizeStyle, withKeys, TransitionGroup, vShow, withModifiers, vModelCheckbox } from "vue";
32
+ import { resolveComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createBlock, createCommentVNode, createElementVNode, resolveDynamicComponent, mergeProps, withCtx, createVNode, createTextVNode, toDisplayString, withDirectives, vModelText, Fragment, renderList, vModelSelect, defineComponent, watch, h as h$1, resolveDirective, Transition, normalizeStyle, withKeys, TransitionGroup, vShow, withModifiers, vModelCheckbox } from "vue";
33
33
  function _mergeNamespaces(n2, m) {
34
34
  m.forEach(function(e2) {
35
35
  e2 && typeof e2 !== "string" && !Array.isArray(e2) && Object.keys(e2).forEach(function(k2) {
@@ -4012,14 +4012,8 @@ const _sfc_main$k = {
4012
4012
  props: {
4013
4013
  color: {
4014
4014
  type: String,
4015
- required: true,
4016
- validator: (value) => {
4017
- return badgeColors.includes(value);
4018
- }
4019
- },
4020
- label: {
4021
- type: [String, Number],
4022
- required: true
4015
+ default: "",
4016
+ validator: (value) => Object.values(badgeColors).includes(value) || value === ""
4023
4017
  },
4024
4018
  isSolid: {
4025
4019
  type: Boolean,
@@ -4030,6 +4024,11 @@ const _sfc_main$k = {
4030
4024
  type: Boolean,
4031
4025
  default: false,
4032
4026
  required: false
4027
+ },
4028
+ icon: {
4029
+ type: String,
4030
+ default: "",
4031
+ required: false
4033
4032
  }
4034
4033
  },
4035
4034
  computed: {
@@ -4037,20 +4036,39 @@ const _sfc_main$k = {
4037
4036
  return capitalizeFirstLetter(this.color);
4038
4037
  },
4039
4038
  computedClasses() {
4039
+ const hasIcon = this.icon !== "" || this.hasIconSlot;
4040
4040
  return [
4041
4041
  this.isSolid ? "cpBadge--isSolid" : "",
4042
4042
  this.isPlain ? "cpBadge--isPlain" : "",
4043
- `cpBadge--is${this.capitalizedColor}`
4043
+ hasIcon ? "cpBadge--hasIcon" : "",
4044
+ this.capitalizedColor ? `cpBadge--is${this.capitalizedColor}` : ""
4044
4045
  ];
4046
+ },
4047
+ hasIconSlot() {
4048
+ return !!this.$slots.icon;
4045
4049
  }
4046
4050
  }
4047
4051
  };
4048
- const _hoisted_1$g = { class: "cpBadge__label" };
4052
+ const _hoisted_1$g = {
4053
+ key: 0,
4054
+ class: "cpBadge__icon"
4055
+ };
4056
+ const _hoisted_2$f = { class: "cpBadge__label" };
4049
4057
  function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
4058
+ const _component_cp_icon = resolveComponent("cp-icon");
4050
4059
  return openBlock(), createElementBlock("div", {
4051
4060
  class: normalizeClass(["cpBadge", $options.computedClasses])
4052
4061
  }, [
4053
- createElementVNode("span", _hoisted_1$g, toDisplayString($props.label), 1)
4062
+ $options.hasIconSlot ? (openBlock(), createElementBlock("span", _hoisted_1$g, [
4063
+ renderSlot(_ctx.$slots, "icon")
4064
+ ])) : $props.icon ? (openBlock(), createBlock(_component_cp_icon, {
4065
+ key: 1,
4066
+ type: $props.icon,
4067
+ class: "cpBadge__icon"
4068
+ }, null, 8, ["type"])) : createCommentVNode("", true),
4069
+ createElementVNode("span", _hoisted_2$f, [
4070
+ renderSlot(_ctx.$slots, "default")
4071
+ ])
4054
4072
  ], 2);
4055
4073
  }
4056
4074
  var CpBadge = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$j]]);