@citizenplane/pimp 7.0.1 → 8.0.1

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 (42) hide show
  1. package/.eslintrc.js +1 -0
  2. package/.lintstagedrc.json +2 -2
  3. package/README.md +18 -6
  4. package/dist/pimp.es.js +10669 -0
  5. package/dist/pimp.umd.js +9 -0
  6. package/dist/style.css +1 -0
  7. package/package-lock.json +2295 -1775
  8. package/package.json +27 -20
  9. package/src/App.vue +0 -1
  10. package/src/README.md +23 -9
  11. package/src/assets/styles/base/_base.scss +2 -15
  12. package/src/assets/styles/helpers/_functions.scss +1 -1
  13. package/src/assets/styles/helpers/_keyframes.scss +25 -0
  14. package/src/assets/styles/lib/_normalize.scss +19 -41
  15. package/src/assets/styles/variables/_colors.scss +16 -16
  16. package/src/assets/styles/variables/_sizing.scss +1 -1
  17. package/src/assets/styles/variables/_spacing.scss +2 -2
  18. package/src/components/atomic-elements/CpBadge.vue +41 -29
  19. package/src/components/buttons/CpButton.vue +1 -1
  20. package/src/components/core/BaseInputLabel/index.vue +0 -1
  21. package/src/components/core/playground-sections/SectionAtomicElements.vue +20 -4
  22. package/src/components/core/playground-sections/SectionDatePickers.vue +26 -1
  23. package/src/components/core/playground-sections/SectionSimpleInputs.vue +6 -1
  24. package/src/components/date-pickers/CpCalendar.vue +49 -2
  25. package/src/components/date-pickers/CpDate.vue +61 -39
  26. package/src/components/date-pickers/CpDatepicker.vue +50 -3
  27. package/src/components/feedback-indicators/CpAlert.vue +4 -4
  28. package/src/components/index.js +15 -0
  29. package/src/components/inputs/CpInput.vue +59 -75
  30. package/src/components/inputs/CpTextarea.vue +19 -2
  31. package/src/components/lists-and-table/CpTable/index.scss +15 -9
  32. package/src/components/selects/CpSelect.vue +21 -2
  33. package/src/components/toggles/CpCheckbox/index.scss +1 -1
  34. package/src/components/toggles/CpRadio/index.scss +2 -2
  35. package/src/components/visual/CpIcon.vue +9 -2
  36. package/src/libs/CoreDatepicker.vue +101 -118
  37. package/vite.config.js +19 -0
  38. package/dist/assets/chevron-down-icon.1e5b69a2.svg +0 -3
  39. package/dist/assets/index.2be314eb.css +0 -1
  40. package/dist/assets/index.e3e1e2b7.js +0 -1
  41. package/dist/assets/vendor.ed632372.js +0 -9
  42. package/dist/index.html +0 -20
package/package.json CHANGED
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "name": "@citizenplane/pimp",
3
- "version": "7.0.1",
3
+ "version": "8.0.1",
4
4
  "scripts": {
5
- "dev": "vite",
5
+ "dev": "vite --host",
6
6
  "build": "vite build",
7
7
  "preview": "vite preview",
8
8
  "lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
9
9
  "format": "prettier . --write",
10
10
  "test": "jest tests"
11
11
  },
12
- "main": "dist/pimp.common.js",
13
12
  "files": [
14
13
  "dist/*",
15
14
  "src/*",
@@ -17,33 +16,41 @@
17
16
  "*.json",
18
17
  "*.js"
19
18
  ],
19
+ "main": "./dist/pimp.umd.js",
20
+ "module": "./dist/pimp.es.js",
21
+ "exports": {
22
+ ".": {
23
+ "import": "./dist/pimp.es.js",
24
+ "require": "./dist/pimp.umd.js"
25
+ }
26
+ },
20
27
  "dependencies": {
21
- "vue": "^3.1.0",
28
+ "vue": "^3.2.29",
22
29
  "animejs": "^3.2.0",
23
- "core-js": "^3.18.1",
30
+ "core-js": "^3.20.3",
24
31
  "feather-icons": "^4.28.0",
25
- "luxon": "^2.0.2",
26
- "maska": "^1.4.6"
32
+ "luxon": "^2.3.0",
33
+ "maska": "^1.5.0"
27
34
  },
28
35
  "devDependencies": {
29
- "@babel/core": "^7.15.8",
30
- "@vitejs/plugin-vue": "^1.9.2",
31
- "@vue/babel-preset-app": "^4.5.14",
32
- "@vue/eslint-config-prettier": "^6.0.0",
33
- "@vue/test-utils": "^2.0.0-rc.16",
36
+ "@babel/core": "^7.16.12",
37
+ "@vitejs/plugin-vue": "^2.1.0",
38
+ "@vue/babel-preset-app": "^4.5.15",
39
+ "@vue/eslint-config-prettier": "^7.0.0",
40
+ "@vue/test-utils": "^2.0.0-rc.18",
34
41
  "babel-core": "^7.0.0-bridge.0",
35
- "eslint": "^7.32.0",
42
+ "eslint": "^8.7.0",
36
43
  "eslint-plugin-prettier": "^4.0.0",
37
- "eslint-plugin-vue": "^7.18.0",
44
+ "eslint-plugin-vue": "^8.4.0",
38
45
  "husky": "^7.0.4",
39
46
  "jest": "^26.6.3",
40
- "lint-staged": "^11.2.4",
41
- "prettier": "^2.4.1",
42
- "sass": "~1.42.1",
43
- "sass-loader": "^10.1.1",
44
- "stylus": "^0.55.0",
47
+ "lint-staged": "^12.3.2",
48
+ "prettier": "^2.5.1",
49
+ "sass": "~1.49.0",
50
+ "sass-loader": "^12.4.0",
51
+ "stylus": "^0.56.0",
45
52
  "stylus-loader": "^3.0.2",
46
- "vite": "^2.6.0",
53
+ "vite": "^2.7.13",
47
54
  "vue-jest": "^5.0.0-alpha.10"
48
55
  }
49
56
  }
package/src/App.vue CHANGED
@@ -38,7 +38,6 @@ import SectionFeedbackIndicators from './components/core/playground-sections/Sec
38
38
  import SectionListsAndTables from './components/core/playground-sections/SectionListsAndTables.vue'
39
39
 
40
40
  export default {
41
- name: 'Pimp',
42
41
  components: {
43
42
  PimpLogo,
44
43
  SectionAtomicElements,
package/src/README.md CHANGED
@@ -1,29 +1,36 @@
1
1
  # Developing
2
+
2
3
  You're a maintainer of Pimp, and a member of CitizenPlane engineering team? **Here's how you can help**.
3
4
 
4
5
  Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
5
6
 
6
7
  There is 4 different ways you can contribute & improve Pimp components library. These mostly follow [Semantic Versioning](https://docs.npmjs.com/about-semantic-versioning) convention:
8
+
7
9
  - 🌟 Major update: changes that break backward compatibility
8
10
  - 💅 Minor update: backward compatible new features
9
11
  - 🐛 Patch update: backward compatible bug fixes
10
12
  - 📚 Documentation update: make the documentation up-to-date with last releases
11
13
 
12
- These 4 different contributions have their own specific processes that will be described in the following sections.
14
+ These 4 different contributions have their own specific processes that will be described in the following sections.
13
15
 
14
- > ℹ️ Components library and documentation updates are done independently. You can't include both updates in the same merge request. It should be done one after the other.
16
+ > ℹ️ Components library and documentation updates are done independently. You can't include both updates in the same merge request. It should be done one after the other.
15
17
 
16
18
  ## Contribution types
19
+
17
20
  ### 🌟 Major update
21
+
18
22
  Your update is a major one if your changes break the previous version.
19
23
 
20
- > 💡 If your changes need a documentation update (new component, updated props), add a ticket in the [Product Roadmap on Notion](https://www.notion.so/citizenplane/e23d1b492dc04c85be2416102634e3b5?v=c7ff85f676f74b6ebf31989e56614518) that describes what to update.
24
+ > 💡 If your changes need a documentation update (new component, updated props), add a ticket in the [Product Roadmap on Notion](https://www.notion.so/citizenplane/e23d1b492dc04c85be2416102634e3b5?v=c7ff85f676f74b6ebf31989e56614518) that describes what to update.
21
25
 
22
26
  See the [release](#release) section for instructions on how to release properly the new package version
27
+
23
28
  ### 💅 Minor update
29
+
24
30
  You're doing a minor update if you want to add a new component to the library or improve an existing one.
25
31
 
26
32
  If you're adding a new component to the library, here is what you should do:
33
+
27
34
  1. Create the new `.vue` component in corresponding `/src` folder
28
35
  2. Add it to the `index.js` file, located in `~/src/components/index.js`
29
36
  3. Create a new component that materializes a new section in the playground, put it in `~/src/components/core/playgorund-sections`
@@ -33,16 +40,18 @@ If you're adding a new component to the library, here is what you should do:
33
40
  Once you're done with the implementation, see the [release](#release) section for instructions on how to release properly the new package version.
34
41
 
35
42
  > 💡 If your changes need a documentation update (new component, updated props), add a ticket in the [Product Roadmap on Notion](https://www.notion.so/citizenplane/e23d1b492dc04c85be2416102634e3b5?v=c7ff85f676f74b6ebf31989e56614518) that describes what to update.
36
-
43
+
37
44
  See the [release](#release) section for instructions on how to release properly the new package version
38
45
 
39
46
  ### 🐛 Patch update
47
+
40
48
  Your update is a patch one if your changes concern a bug in the current version that needs to be fixed.
41
49
 
42
50
  See the [release](#release) section for instructions on how to release properly the new package version
43
51
 
44
52
  ### 📚 Documentation update
45
- Documentation update are done so developers who are using the `@citizenplane/pimp` package can use components without any pain. Contrarily to other updates types, this one happens in the `/docs` directory.
53
+
54
+ Documentation update are done so developers who are using the `@citizenplane/pimp` package can use components without any pain. Contrarily to other updates types, this one happens in the `/docs` directory.
46
55
 
47
56
  In order to run the documentation, move into `/docs` folder and run the `npm run dev` command.
48
57
 
@@ -57,8 +66,10 @@ Then, you can update the different sections that needs to.
57
66
  Once you've finished, create the corresponding MR and see the corresponding [release](#documentation-release) section
58
67
 
59
68
  ## Release
69
+
60
70
  ### Components release
61
- Once you've done your changes, you'll want to submit them via a new merge request. All the unit tests should pass and pipelines should be green.
71
+
72
+ Once you've done your changes, you'll want to submit them via a new merge request. All the unit tests should pass and pipelines should be green.
62
73
 
63
74
  When these are approved, you will merge your branch into `master`.
64
75
 
@@ -75,11 +86,12 @@ Once it's finished, you'll get the last version of the package.
75
86
  You'll be able to use last components updates just by upgrading the package in corresponding projects.
76
87
 
77
88
  ### Documentation release
78
- The release process is the classical one; when CI has passed, you can deploy to production the new documentation version.
79
89
 
90
+ The release process is the classical one; when CI has passed, you can deploy to production the new documentation version.
80
91
 
81
92
  ## Visuals 🖼
82
- ![Documentation mode](https://i.imgur.com/d5VbXFm.png) *Documentation mode*
93
+
94
+ ![Documentation mode](https://i.imgur.com/d5VbXFm.png) _Documentation mode_
83
95
 
84
96
  <details>
85
97
  <summary>Playground page, development mode</summary>
@@ -87,12 +99,14 @@ The release process is the classical one; when CI has passed, you can deploy to
87
99
  </details>
88
100
 
89
101
  ## Resources 📖
102
+
90
103
  - Vue.js style guide: [link](https://v3.vuejs.org/style-guide/#tightly-coupled-component-names-strongly-recommended)
91
104
  - Vue.js documentation: [link](https://vuejs.org/v2/guide/)
92
105
  - Notion epic ticket: [link](https://www.notion.so/citizenplane/Pimp-improvements-4b2b12e49aca466980066f7101db50ff)
93
- - Figma project: [link]( https://www.figma.com/file/GzZSPWxb0AOM0COc7IYHoXNn/%F0%9F%92%85-Pimp)
106
+ - Figma project: [link](https://www.figma.com/file/GzZSPWxb0AOM0COc7IYHoXNn/%F0%9F%92%85-Pimp)
94
107
  - Tech team Notion documentation page: [link](https://www.notion.so/citizenplane/TECH-74cb42d97c254b64a564932c4bf40faa#7ddbdc9962e9473b8f480ccec508da1d)
95
108
 
96
109
  ## Maintainers 👷
110
+
97
111
  - Lead maintainer: @vincent
98
112
  - Other maintainers: @benoit, @alexis
@@ -7,9 +7,8 @@ html {
7
7
  /* border-box box model allows us to add padding and border to our elements without increasing their size */
8
8
  box-sizing: border-box;
9
9
  /* A system font stack so things load nice and quick! */
10
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
11
- Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
12
- 'Segoe UI Symbol';
10
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji',
11
+ 'Segoe UI Emoji', 'Segoe UI Symbol';
13
12
  font-size: 100%;
14
13
  color: $neutral-dark;
15
14
  -webkit-font-smoothing: antialiased;
@@ -36,7 +35,6 @@ body {
36
35
  }
37
36
 
38
37
  // Secondary Elements
39
-
40
38
  button {
41
39
  border-style: none;
42
40
  padding: 0;
@@ -45,17 +43,6 @@ button {
45
43
  &:hover {
46
44
  cursor: pointer;
47
45
  }
48
-
49
- &:focus-visible {
50
- outline: none !important;
51
- box-shadow: 0 0 0 pxToEm(3) scale-color($secondary-color, $lightness: 80%);
52
- }
53
- }
54
-
55
- a {
56
- text-decoration: none;
57
- -moz-appearance: none !important;
58
- -webkit-appearance: none !important;
59
46
  }
60
47
 
61
48
  ul,
@@ -1,5 +1,5 @@
1
1
  // Sass function to convert px into rem
2
- @use "sass:math";
2
+ @use 'sass:math';
3
3
 
4
4
  // Defining base font size
5
5
  // The default font size for html is 16px
@@ -10,6 +10,31 @@
10
10
  transform: scale(0.9);
11
11
  }
12
12
 
13
+ // popover
14
+ @mixin popover-desktop($transitionName) {
15
+ .#{$transitionName}-enter-active,
16
+ .#{$transitionName}-leave-active {
17
+ transition: 200ms cubic-bezier(0.175, 0.885, 0.32, 1.175);
18
+ transition-property: opacity, transform;
19
+ }
20
+
21
+ .#{$transitionName}-enter-from {
22
+ transform: scale(0.8);
23
+ }
24
+
25
+ .#{$transitionName}-enter-to {
26
+ transform: scale(1);
27
+ }
28
+
29
+ .#{$transitionName}-leave-to {
30
+ opacity: 0;
31
+ }
32
+
33
+ .#{$transitionName}-leave-from {
34
+ opacity: 1;
35
+ }
36
+ }
37
+
13
38
  // Components
14
39
  // cp-select-menu
15
40
  @keyframes cp-select-menu-dropdown-enter {
@@ -164,7 +164,8 @@ textarea {
164
164
  */
165
165
 
166
166
  button,
167
- input { /* 1 */
167
+ input {
168
+ /* 1 */
168
169
  overflow: visible;
169
170
  }
170
171
 
@@ -174,7 +175,8 @@ input { /* 1 */
174
175
  */
175
176
 
176
177
  button,
177
- select { /* 1 */
178
+ select {
179
+ /* 1 */
178
180
  text-transform: none;
179
181
  }
180
182
 
@@ -183,9 +185,9 @@ select { /* 1 */
183
185
  */
184
186
 
185
187
  button,
186
- [type="button"],
187
- [type="reset"],
188
- [type="submit"] {
188
+ [type='button'],
189
+ [type='reset'],
190
+ [type='submit'] {
189
191
  -webkit-appearance: button;
190
192
  }
191
193
 
@@ -194,9 +196,9 @@ button,
194
196
  */
195
197
 
196
198
  button::-moz-focus-inner,
197
- [type="button"]::-moz-focus-inner,
198
- [type="reset"]::-moz-focus-inner,
199
- [type="submit"]::-moz-focus-inner {
199
+ [type='button']::-moz-focus-inner,
200
+ [type='reset']::-moz-focus-inner,
201
+ [type='submit']::-moz-focus-inner {
200
202
  border-style: none;
201
203
  padding: 0;
202
204
  }
@@ -206,36 +208,12 @@ button::-moz-focus-inner,
206
208
  */
207
209
 
208
210
  button:-moz-focusring,
209
- [type="button"]:-moz-focusring,
210
- [type="reset"]:-moz-focusring,
211
- [type="submit"]:-moz-focusring {
211
+ [type='button']:-moz-focusring,
212
+ [type='reset']:-moz-focusring,
213
+ [type='submit']:-moz-focusring {
212
214
  outline: 1px dotted ButtonText;
213
215
  }
214
216
 
215
- /**
216
- * Correct the padding in Firefox.
217
- */
218
-
219
- fieldset {
220
- padding: 0.35em 0.75em 0.625em;
221
- }
222
-
223
- /**
224
- * 1. Correct the text wrapping in Edge and IE.
225
- * 2. Correct the color inheritance from `fieldset` elements in IE.
226
- * 3. Remove the padding so developers are not caught out when they zero out
227
- * `fieldset` elements in all browsers.
228
- */
229
-
230
- legend {
231
- box-sizing: border-box; /* 1 */
232
- color: inherit; /* 2 */
233
- display: table; /* 1 */
234
- max-width: 100%; /* 1 */
235
- padding: 0; /* 3 */
236
- white-space: normal; /* 1 */
237
- }
238
-
239
217
  /**
240
218
  * Add the correct vertical alignment in Chrome, Firefox, and Opera.
241
219
  */
@@ -257,8 +235,8 @@ textarea {
257
235
  * 2. Remove the padding in IE 10.
258
236
  */
259
237
 
260
- [type="checkbox"],
261
- [type="radio"] {
238
+ [type='checkbox'],
239
+ [type='radio'] {
262
240
  box-sizing: border-box; /* 1 */
263
241
  padding: 0; /* 2 */
264
242
  }
@@ -267,8 +245,8 @@ textarea {
267
245
  * Correct the cursor style of increment and decrement buttons in Chrome.
268
246
  */
269
247
 
270
- [type="number"]::-webkit-inner-spin-button,
271
- [type="number"]::-webkit-outer-spin-button {
248
+ [type='number']::-webkit-inner-spin-button,
249
+ [type='number']::-webkit-outer-spin-button {
272
250
  height: auto;
273
251
  }
274
252
 
@@ -277,7 +255,7 @@ textarea {
277
255
  * 2. Correct the outline style in Safari.
278
256
  */
279
257
 
280
- [type="search"] {
258
+ [type='search'] {
281
259
  -webkit-appearance: textfield; /* 1 */
282
260
  outline-offset: -2px; /* 2 */
283
261
  }
@@ -286,7 +264,7 @@ textarea {
286
264
  * Remove the inner padding in Chrome and Safari on macOS.
287
265
  */
288
266
 
289
- [type="search"]::-webkit-search-decoration {
267
+ [type='search']::-webkit-search-decoration {
290
268
  -webkit-appearance: none;
291
269
  }
292
270
 
@@ -1,21 +1,21 @@
1
1
  // CitizenPlane colors
2
- $astronaut: #3E3E5B;
3
- $gray-1: #8B8B9D;
4
- $gray-2: #B2B2BD;
5
- $gray-3: #C6C6CE;
6
- $gray-4: #D8D8DE;
7
- $gray-5: #ECECEF;
2
+ $astronaut: #3e3e5b;
3
+ $gray-1: #8b8b9d;
4
+ $gray-2: #b2b2bd;
5
+ $gray-3: #c6c6ce;
6
+ $gray-4: #d8d8de;
7
+ $gray-5: #ececef;
8
8
 
9
- $red: #FC5959;
10
- $orange: #FFA800;
11
- $yellow: #FFD00B;
12
- $green-2: #00C582;
13
- $green-1: #00F8A4;
9
+ $red: #eb0505;
10
+ $orange: #ffa800;
11
+ $yellow: #ffd00b;
12
+ $green-2: #00c582;
13
+ $green-1: #00f8a4;
14
14
 
15
- $purple: #5341F9;
16
- $blue: #144DC2;
17
- $blue-1: #56C1FE;
18
- $pink: #FF7DC1;
15
+ $purple: #5341f9;
16
+ $blue: #144dc2;
17
+ $blue-1: #56c1fe;
18
+ $pink: #ff7dc1;
19
19
 
20
20
  // Main colors
21
21
  $primary-color: $purple;
@@ -38,7 +38,7 @@ $neutral-dark-3: $gray-3;
38
38
  $neutral-dark-4: $gray-4;
39
39
  $neutral-dark-5: $gray-5;
40
40
  // White
41
- $neutral-light: #FFFFFF;
41
+ $neutral-light: #ffffff;
42
42
  $neutral-light-1: #f8faff;
43
43
 
44
44
  // Border colors
@@ -1,4 +1,4 @@
1
- @import "../helpers/functions";
1
+ @import '../helpers/functions';
2
2
 
3
3
  $component-size-default: pxToEm(44);
4
4
  $component-size-large: pxToEm(54);
@@ -1,5 +1,5 @@
1
- @use "sass:math";
2
- @import "../helpers/functions";
1
+ @use 'sass:math';
2
+ @import '../helpers/functions';
3
3
 
4
4
  $space: pxToRem(8);
5
5
 
@@ -1,6 +1,8 @@
1
1
  <template>
2
2
  <div class="cpBadge" :class="computedClasses">
3
- <span class="cpBadge__label">{{ label }}</span>
3
+ <span v-if="hasIconSlot" class="cpBadge__icon"> <slot name="icon" /></span>
4
+ <cp-icon v-else-if="icon" :type="icon" class="cpBadge__icon" />
5
+ <span class="cpBadge__label"><slot /></span>
4
6
  </div>
5
7
  </template>
6
8
 
@@ -13,14 +15,8 @@ export default {
13
15
  props: {
14
16
  color: {
15
17
  type: String,
16
- required: true,
17
- validator: (value) => {
18
- return badgeColors.includes(value)
19
- },
20
- },
21
- label: {
22
- type: [String, Number],
23
- required: true,
18
+ default: '',
19
+ validator: (value) => Object.values(badgeColors).includes(value) || value === '',
24
20
  },
25
21
  isSolid: {
26
22
  type: Boolean,
@@ -32,18 +28,29 @@ export default {
32
28
  default: false,
33
29
  required: false,
34
30
  },
31
+ icon: {
32
+ type: String,
33
+ default: '',
34
+ required: false,
35
+ },
35
36
  },
36
37
  computed: {
37
38
  capitalizedColor() {
38
39
  return capitalizeFirstLetter(this.color)
39
40
  },
40
41
  computedClasses() {
42
+ const hasIcon = this.icon !== '' || this.hasIconSlot
43
+
41
44
  return [
42
45
  this.isSolid ? 'cpBadge--isSolid' : '',
43
46
  this.isPlain ? 'cpBadge--isPlain' : '',
44
- `cpBadge--is${this.capitalizedColor}`,
47
+ hasIcon ? 'cpBadge--hasIcon' : '',
48
+ this.capitalizedColor ? `cpBadge--is${this.capitalizedColor}` : '',
45
49
  ]
46
50
  },
51
+ hasIconSlot() {
52
+ return !!this.$slots.icon
53
+ },
47
54
  },
48
55
  }
49
56
  </script>
@@ -51,36 +58,23 @@ export default {
51
58
  <style lang="scss">
52
59
  @mixin cp-badge-color-default($color) {
53
60
  background-color: rgba($color, 0.14);
61
+ border-color: transparent;
54
62
  color: $color;
55
-
56
- &:before {
57
- background-color: $color;
58
- }
59
63
  }
60
64
 
61
65
  @mixin cp-badge-color-solid($color) {
62
66
  background-color: $color;
63
- color: $neutral-light;
64
-
65
- &:before {
66
- background-color: $neutral-light;
67
- }
67
+ border-color: transparent;
68
68
  }
69
69
 
70
70
  @mixin cp-badge-style($color, $className) {
71
- &--is#{$className} {
71
+ &--is#{$className}:not(#{&}--isSolid) {
72
72
  @include cp-badge-color-default($color);
73
73
  }
74
74
 
75
75
  &--is#{$className}#{&}--isSolid {
76
76
  @include cp-badge-color-solid($color);
77
77
  }
78
-
79
- &--is#{$className}#{&}--isPlain {
80
- &:before {
81
- content: none;
82
- }
83
- }
84
78
  }
85
79
 
86
80
  .cpBadge {
@@ -88,22 +82,40 @@ export default {
88
82
  align-items: center;
89
83
  padding: pxToRem(4) pxToRem(8);
90
84
  font-size: pxToEm(14);
91
- text-transform: capitalize;
92
85
  font-weight: 500;
93
86
  border-radius: pxToRem(1000);
87
+ border: pxToRem(1) solid $border-color;
94
88
 
95
- &::before {
89
+ &:not(#{&}--isPlain):not(#{&}--hasIcon)::before {
96
90
  content: '';
97
91
  width: pxToRem(6);
98
92
  height: pxToRem(6);
99
93
  margin-right: pxToRem(6);
100
94
  border-radius: 100%;
101
95
  flex-shrink: 0;
96
+ background-color: currentColor;
97
+ }
98
+
99
+ &--isSolid {
100
+ color: $neutral-light;
102
101
  }
103
102
 
104
103
  &__label {
105
- flex: 1;
106
104
  @extend %u-text-ellipsis;
105
+ flex: 1;
106
+ }
107
+
108
+ &__icon {
109
+ width: pxToRem(16);
110
+ height: pxToRem(16);
111
+ margin-right: $space-sm;
112
+ color: currentColor;
113
+ stroke: currentColor;
114
+
115
+ svg {
116
+ width: 100%;
117
+ height: 100%;
118
+ }
107
119
  }
108
120
 
109
121
  @include cp-badge-style($neutral-dark, 'Neutral');
@@ -200,7 +200,7 @@ export default {
200
200
  padding: pxToEm(12) pxToEm(16);
201
201
  min-width: 10ch;
202
202
  height: $component-size-default;
203
- font-size: pxToRem(16);
203
+ font-size: inherit;
204
204
  line-height: 1.1;
205
205
  text-decoration: none;
206
206
  color: $neutral-dark;
@@ -19,7 +19,6 @@ export default {
19
19
 
20
20
  <style lang="scss">
21
21
  .baseInputLabel {
22
- padding: pxToEm(6) 0;
23
22
  display: block;
24
23
  font-size: pxToEm(14);
25
24
  color: $neutral-dark;
@@ -4,12 +4,16 @@
4
4
  <h3>Badge</h3>
5
5
  <div class="sectionAtomicElements__badges">
6
6
  <cp-badge
7
- v-for="{ color, label } in badgeList"
8
- :key="label"
7
+ v-for="{ color, label, icon, plain, solid } in badgeList"
8
+ :key="color"
9
9
  :color="color"
10
- :label="label"
10
+ :icon="icon"
11
+ :is-plain="plain"
12
+ :is-solid="solid"
11
13
  class="sectionAtomicElements__badge"
12
- />
14
+ >
15
+ {{ label }}
16
+ </cp-badge>
13
17
  </div>
14
18
  </div>
15
19
  </section-container>
@@ -25,6 +29,15 @@ export default {
25
29
  data() {
26
30
  return {
27
31
  badgeList: [
32
+ {
33
+ color: '',
34
+ label: 'Default plain',
35
+ },
36
+ {
37
+ color: '',
38
+ label: 'Default plain',
39
+ icon: 'copy',
40
+ },
28
41
  {
29
42
  color: 'neutral',
30
43
  label: 'Beta',
@@ -32,6 +45,7 @@ export default {
32
45
  {
33
46
  color: 'green',
34
47
  label: 'Processed',
48
+ solid: true,
35
49
  },
36
50
  {
37
51
  color: 'red',
@@ -44,6 +58,8 @@ export default {
44
58
  {
45
59
  color: 'purple',
46
60
  label: 'trial',
61
+ icon: 'copy',
62
+ solid: true,
47
63
  },
48
64
  ],
49
65
  }