@citizenplane/pimp 8.9.5 → 8.11.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.
Files changed (54) hide show
  1. package/dist/pimp.es.js +5051 -4622
  2. package/dist/pimp.umd.js +9 -2
  3. package/dist/style.css +1 -1
  4. package/package.json +15 -16
  5. package/src/App.vue +9 -9
  6. package/src/assets/styles/base/_base.scss +4 -4
  7. package/src/assets/styles/helpers/_keyframes.scss +0 -25
  8. package/src/assets/styles/helpers/_mixins.scss +23 -2
  9. package/src/assets/styles/main.scss +2 -16
  10. package/src/assets/styles/variables/_colors.scss +2 -0
  11. package/src/assets/styles/variables/_sizing.scss +3 -3
  12. package/src/assets/styles/variables/_spacing.scss +2 -2
  13. package/src/components/atomic-elements/CpBadge.vue +33 -33
  14. package/src/components/atomic-elements/CpDialog.vue +19 -19
  15. package/src/components/atomic-elements/CpTooltip.vue +6 -6
  16. package/src/components/buttons/CpButton.vue +53 -57
  17. package/src/components/core/{BaseInputLabel/index.vue → BaseInputLabel.vue} +3 -3
  18. package/src/components/core/playground-sections/SectionAtomicElements.vue +1 -1
  19. package/src/components/core/playground-sections/SectionButtons.vue +2 -2
  20. package/src/components/core/playground-sections/SectionContainer.vue +5 -5
  21. package/src/components/core/playground-sections/SectionDatePickers.vue +3 -3
  22. package/src/components/core/playground-sections/SectionDialog.vue +1 -1
  23. package/src/components/core/playground-sections/SectionFeedbackIndicators.vue +2 -2
  24. package/src/components/core/playground-sections/SectionInputs.vue +2 -2
  25. package/src/components/core/playground-sections/SectionListsAndTables.vue +9 -9
  26. package/src/components/core/playground-sections/SectionSelects.vue +2 -2
  27. package/src/components/core/playground-sections/SectionSimpleInputs.vue +2 -2
  28. package/src/components/core/playground-sections/SectionToggles.vue +4 -4
  29. package/src/components/date-pickers/CpCalendar.vue +14 -14
  30. package/src/components/date-pickers/{CpDate/index.vue → CpDate.vue} +165 -1
  31. package/src/components/date-pickers/CpDatepicker.vue +1 -1
  32. package/src/components/feedback-indicators/CpAlert.vue +22 -22
  33. package/src/components/feedback-indicators/CpToaster.vue +36 -38
  34. package/src/components/index.js +7 -7
  35. package/src/components/inputs/CpInput.vue +55 -55
  36. package/src/components/inputs/CpTextarea.vue +20 -20
  37. package/src/components/lists-and-table/CpTable.vue +722 -0
  38. package/src/components/lists-and-table/{CpTable/CpTableEmptyState/index.vue → CpTableEmptyState.vue} +9 -9
  39. package/src/components/selects/CpSelect.vue +29 -28
  40. package/src/components/selects/{CpSelectMenu/index.vue → CpSelectMenu.vue} +40 -41
  41. package/src/components/toggles/{CpCheckbox/index.vue → CpCheckbox.vue} +133 -1
  42. package/src/components/toggles/CpRadio.vue +253 -0
  43. package/src/components/toggles/{CpSwitch/index.vue → CpSwitch.vue} +19 -19
  44. package/src/components/typography/{CpHeading/index.vue → CpHeading.vue} +26 -26
  45. package/src/constants/index.js +1 -0
  46. package/src/constants/src/CpTableConfig.js +14 -0
  47. package/src/libs/CoreDatepicker.vue +383 -308
  48. package/src/assets/styl/colors.styl +0 -39
  49. package/src/components/date-pickers/CpDate/index.scss +0 -165
  50. package/src/components/lists-and-table/CpTable/index.scss +0 -325
  51. package/src/components/lists-and-table/CpTable/index.vue +0 -438
  52. package/src/components/toggles/CpCheckbox/index.scss +0 -136
  53. package/src/components/toggles/CpRadio/index.scss +0 -160
  54. package/src/components/toggles/CpRadio/index.vue +0 -97
@@ -0,0 +1,253 @@
1
+ <template>
2
+ <div>
3
+ <label
4
+ v-for="({ label, value, description, additionalData, disabled }, index) in options"
5
+ :key="getRadioId(index)"
6
+ :class="computedClasses({ value, disabled })"
7
+ class="cpRadio"
8
+ :for="getRadioId(index)"
9
+ >
10
+ <input
11
+ :id="getRadioId(index)"
12
+ :checked="isActive(value)"
13
+ :value="value"
14
+ :disabled="disabled"
15
+ type="radio"
16
+ :autofocus="autofocus"
17
+ :name="groupName"
18
+ @input="onChange(value)"
19
+ />
20
+ <span class="cpRadio__content">
21
+ <span class="cpRadio__information">
22
+ <span class="cpRadio__label">{{ label }}</span>
23
+ <span v-if="description" class="cpRadio__description">{{ description }}</span>
24
+ </span>
25
+ <span v-if="additionalData" class="cpRadio__additionalData">{{ additionalData }}</span>
26
+ </span>
27
+ </label>
28
+ </div>
29
+ </template>
30
+
31
+ <script>
32
+ import { capitalizeFirstLetter, randomString } from '@/helpers'
33
+ import { ToggleColors } from '@/constants'
34
+
35
+ export default {
36
+ props: {
37
+ modelValue: {
38
+ type: String,
39
+ default: '',
40
+ required: true,
41
+ },
42
+ options: {
43
+ type: Array,
44
+ required: true,
45
+ },
46
+ groupName: {
47
+ type: String,
48
+ default: '',
49
+ required: false,
50
+ },
51
+ color: {
52
+ type: String,
53
+ required: false,
54
+ default: ToggleColors.BLUE,
55
+ validator: (value) => Object.values(ToggleColors).includes(value),
56
+ },
57
+ autofocus: {
58
+ type: Boolean,
59
+ required: false,
60
+ default: false,
61
+ },
62
+ },
63
+ emits: ['update:modelValue'],
64
+ data() {
65
+ return {
66
+ radioUniqueId: '',
67
+ }
68
+ },
69
+ mounted() {
70
+ this.radioUniqueId = randomString()
71
+ },
72
+ methods: {
73
+ onChange(value) {
74
+ this.$emit('update:modelValue', value)
75
+ },
76
+ getRadioId(index) {
77
+ return `${this.radioUniqueId}${index}`
78
+ },
79
+ isActive(value) {
80
+ return value === this.modelValue
81
+ },
82
+ computedClasses({ value, disabled }) {
83
+ return [
84
+ {
85
+ 'cpRadio--isActive': this.isActive(value),
86
+ 'cpRadio--isDisabled': disabled,
87
+ },
88
+ `cpRadio--is${capitalizeFirstLetter(this.color)}`,
89
+ ]
90
+ },
91
+ },
92
+ }
93
+ </script>
94
+
95
+ <style lang="scss">
96
+ @mixin cp-radio-style($color, $className) {
97
+ &--is#{$className}#{&}--isActive {
98
+ border-color: $color;
99
+ }
100
+
101
+ &--is#{$className} input:checked {
102
+ background-color: $color;
103
+ border-color: $color;
104
+
105
+ & ~ span .cpRadio {
106
+ &__label,
107
+ &__additionalData {
108
+ color: $color;
109
+ }
110
+ }
111
+ }
112
+
113
+ &--is#{$className}:hover,
114
+ &--is#{$className}:focus-within {
115
+ border-color: $color;
116
+ }
117
+
118
+ &--is#{$className}:focus-within {
119
+ box-shadow: 0 0 0 fn.px-to-rem(4) rgba($color, 0.1);
120
+ }
121
+ }
122
+
123
+ .cpRadio {
124
+ $cp-radio-base-width: fn.px-to-em(20);
125
+
126
+ position: relative;
127
+ border: fn.px-to-rem(1) solid colors.$neutral-dark-4;
128
+ border-radius: fn.px-to-rem(10);
129
+ padding: sp.$space-lg sp.$space-md;
130
+ display: grid;
131
+ grid-template-columns: min-content 1fr;
132
+ grid-gap: sp.$space-md;
133
+ align-items: center;
134
+ width: 100%;
135
+
136
+ &:not(#{&}--isDisabled),
137
+ &:not(#{&}--isDisabled) * {
138
+ cursor: pointer;
139
+ }
140
+
141
+ @include cp-radio-style(colors.$secondary-color, 'Blue');
142
+ @include cp-radio-style(colors.$primary-color, 'Purple');
143
+
144
+ &--isDisabled {
145
+ background-color: colors.$neutral-light-1;
146
+ color: colors.$neutral-dark-1;
147
+
148
+ &,
149
+ * {
150
+ cursor: not-allowed;
151
+ }
152
+
153
+ &:hover,
154
+ &:focus {
155
+ box-shadow: none;
156
+ border-color: colors.$neutral-dark-4;
157
+ }
158
+ }
159
+
160
+ &--isActive#{&}--isDisabled,
161
+ &--isActive#{&}--isDisabled:hover {
162
+ border-color: colors.$neutral-dark-4;
163
+ }
164
+
165
+ &:not(:last-of-type) {
166
+ margin-bottom: sp.$space-md;
167
+ }
168
+
169
+ input {
170
+ -webkit-appearance: none;
171
+ -moz-appearance: none;
172
+ appearance: none;
173
+ border: fn.px-to-rem(1) solid colors.$neutral-dark-4;
174
+ border-radius: 100%;
175
+ padding: 25%;
176
+ width: $cp-radio-base-width;
177
+ height: $cp-radio-base-width;
178
+ transition: transform 0.1s linear;
179
+
180
+ &:before {
181
+ content: '';
182
+ display: flex;
183
+ width: 100%;
184
+ height: 100%;
185
+ border-radius: 100%;
186
+ background-color: colors.$neutral-light;
187
+ transition: transform 0.15s linear;
188
+ transform: scale(0);
189
+ }
190
+
191
+ &:active:not(:disabled) {
192
+ transform: scale(0.8);
193
+ }
194
+
195
+ &:checked:before {
196
+ transform: scale(1);
197
+ }
198
+
199
+ &:checked:disabled {
200
+ border-color: colors.$neutral-dark-1;
201
+ background-color: colors.$neutral-dark-1;
202
+ }
203
+
204
+ &:checked:disabled ~ span .cpRadio {
205
+ &__label,
206
+ &__additionalData {
207
+ color: colors.$neutral-dark-1;
208
+ }
209
+ }
210
+ }
211
+
212
+ &__content {
213
+ display: flex;
214
+ align-items: center;
215
+ line-height: 1.3;
216
+ }
217
+
218
+ &__information {
219
+ flex-grow: 2;
220
+ display: flex;
221
+ align-items: center;
222
+ justify-content: space-between;
223
+ flex-wrap: wrap;
224
+ text-transform: capitalize;
225
+ margin: 0 (-(sp.$space));
226
+ }
227
+
228
+ &__label,
229
+ &__description {
230
+ margin: 0 sp.$space;
231
+ flex-grow: 1;
232
+ }
233
+
234
+ &__label,
235
+ &__additionalData {
236
+ font-weight: 500;
237
+ }
238
+
239
+ &__description,
240
+ &__additionalData {
241
+ color: colors.$neutral-dark-1;
242
+ }
243
+
244
+ &__label {
245
+ white-space: nowrap;
246
+ }
247
+
248
+ &__additionalData {
249
+ text-align: right;
250
+ margin-left: sp.$space-lg;
251
+ }
252
+ }
253
+ </style>
@@ -102,25 +102,25 @@ export default {
102
102
  }
103
103
 
104
104
  &--is#{$className} &__switch:focus-within {
105
- box-shadow: 0 0 0 px-to-em(3) scale-color($color, $lightness: 70%);
105
+ box-shadow: 0 0 0 fn.px-to-em(3) color.scale($color, $lightness: 70%);
106
106
  }
107
107
 
108
108
  &--is#{$className}:hover:not(#{&}--isDisabled) &__switch {
109
- background-color: scale-color($color, $lightness: 50%);
109
+ background-color: color.scale($color, $lightness: 50%);
110
110
  }
111
111
 
112
112
  &--is#{$className}#{&}--isActive:hover &__switch {
113
- background-color: darken($color, 10%);
113
+ background-color: color.adjust($color, $lightness: -10%);
114
114
  }
115
115
 
116
116
  &--is#{$className}#{&}--isActive#{&}--isDisabled &__switch,
117
117
  &--is#{$className}#{&}--isActive#{&}--isDisabled:hover &__swtich {
118
- background-color: scale-color($color, $lightness: 65%);
118
+ background-color: color.scale($color, $lightness: 65%);
119
119
  }
120
120
  }
121
121
 
122
122
  .cpSwitch {
123
- $cp-switch-base-height: px-to-em(24);
123
+ $cp-switch-base-height: fn.px-to-em(24);
124
124
  align-items: center;
125
125
 
126
126
  &,
@@ -131,7 +131,7 @@ export default {
131
131
  &--hasLabel {
132
132
  display: grid;
133
133
  grid-template-columns: min-content 1fr;
134
- grid-gap: px-to-rem(12);
134
+ grid-gap: fn.px-to-rem(12);
135
135
  align-items: center;
136
136
  }
137
137
 
@@ -143,7 +143,7 @@ export default {
143
143
  }
144
144
 
145
145
  .cpSwitch__switch {
146
- background-color: $neutral-dark-4;
146
+ background-color: colors.$neutral-dark-4;
147
147
  }
148
148
  }
149
149
 
@@ -156,12 +156,12 @@ export default {
156
156
  }
157
157
 
158
158
  &--isDisabled &__label {
159
- color: $neutral-dark-1;
159
+ color: colors.$neutral-dark-1;
160
160
  }
161
161
 
162
162
  &--isDisabled &__switch,
163
163
  &--isDisabled:hover &__switch {
164
- background-color: $neutral-dark-5;
164
+ background-color: colors.$neutral-dark-5;
165
165
  }
166
166
 
167
167
  &--isActive .cpSwitch {
@@ -175,13 +175,13 @@ export default {
175
175
  }
176
176
  }
177
177
 
178
- @include cp-switch-style($primary-color, 'Purple');
179
- @include cp-switch-style($secondary-color, 'Blue');
178
+ @include cp-switch-style(colors.$primary-color, 'Purple');
179
+ @include cp-switch-style(colors.$secondary-color, 'Blue');
180
180
 
181
181
  &__switch {
182
182
  position: relative;
183
183
  border-radius: 1000px;
184
- background-color: $neutral-dark-1;
184
+ background-color: colors.$neutral-dark-1;
185
185
  overflow: hidden;
186
186
  transition: background-color 0.1s ease-out;
187
187
  display: flex;
@@ -189,7 +189,7 @@ export default {
189
189
  width: $cp-switch-base-height * 2;
190
190
 
191
191
  &:hover {
192
- background-color: $neutral-dark-3;
192
+ background-color: colors.$neutral-dark-3;
193
193
  }
194
194
  }
195
195
 
@@ -209,7 +209,7 @@ export default {
209
209
  top: 50%;
210
210
  transform: translateY(-50%);
211
211
  opacity: 0;
212
- padding-left: px-to-rem(4);
212
+ padding-left: fn.px-to-rem(4);
213
213
  display: flex;
214
214
  align-items: center;
215
215
  justify-content: center;
@@ -224,23 +224,23 @@ export default {
224
224
 
225
225
  svg {
226
226
  stroke-width: 3;
227
- color: $neutral-light;
227
+ color: colors.$neutral-light;
228
228
  }
229
229
  }
230
230
 
231
231
  &__knobContainer {
232
232
  width: 100%;
233
- padding: px-to-rem(2);
233
+ padding: fn.px-to-rem(2);
234
234
  display: flex;
235
235
  align-items: center;
236
236
  transition: transform 0.3s cubic-bezier(0.08, 0.82, 0.17, 1) 0s;
237
237
  }
238
238
 
239
239
  &__knob {
240
- background-color: $neutral-light;
240
+ background-color: colors.$neutral-light;
241
241
  border-radius: 100%;
242
- width: calc(#{$cp-switch-base-height} - #{px-to-rem(4)});
243
- height: calc(#{$cp-switch-base-height} - #{px-to-rem(4)});
242
+ width: calc(#{$cp-switch-base-height} - #{fn.px-to-rem(4)});
243
+ height: calc(#{$cp-switch-base-height} - #{fn.px-to-rem(4)});
244
244
  }
245
245
  }
246
246
  </style>
@@ -38,71 +38,71 @@ export default {
38
38
 
39
39
  <style lang="scss">
40
40
  .cpHeading {
41
- color: $neutral-dark;
41
+ color: colors.$neutral-dark;
42
42
 
43
43
  &:first-letter {
44
44
  text-transform: capitalize;
45
45
  }
46
46
 
47
47
  &--100 {
48
- font-size: px-to-rem(11);
48
+ font-size: fn.px-to-rem(11);
49
49
  font-weight: 400;
50
- line-height: px-to-rem(16);
51
- letter-spacing: px-to-em(0.6);
52
- color: $neutral-dark-1;
50
+ line-height: fn.px-to-rem(16);
51
+ letter-spacing: fn.px-to-em(0.6);
52
+ color: colors.$neutral-dark-1;
53
53
  }
54
54
 
55
55
  &--200 {
56
- font-size: px-to-rem(12);
56
+ font-size: fn.px-to-rem(12);
57
57
  font-weight: 600;
58
- line-height: px-to-rem(16);
59
- color: $neutral-dark-1;
58
+ line-height: fn.px-to-rem(16);
59
+ color: colors.$neutral-dark-1;
60
60
  }
61
61
 
62
62
  &--300 {
63
- font-size: px-to-rem(12);
63
+ font-size: fn.px-to-rem(12);
64
64
  font-weight: 600;
65
- line-height: px-to-rem(16);
65
+ line-height: fn.px-to-rem(16);
66
66
  }
67
67
 
68
68
  &--400 {
69
- font-size: px-to-rem(14);
69
+ font-size: fn.px-to-rem(14);
70
70
  font-weight: 500;
71
- line-height: px-to-rem(18);
71
+ line-height: fn.px-to-rem(18);
72
72
  }
73
73
 
74
74
  &--500 {
75
- font-size: px-to-rem(16);
75
+ font-size: fn.px-to-rem(16);
76
76
  font-weight: 500;
77
- line-height: px-to-rem(20);
77
+ line-height: fn.px-to-rem(20);
78
78
  }
79
79
 
80
80
  &--600 {
81
- font-size: px-to-rem(18);
81
+ font-size: fn.px-to-rem(18);
82
82
  font-weight: 500;
83
- line-height: px-to-rem(23);
84
- letter-spacing: px-to-em(0.4);
83
+ line-height: fn.px-to-rem(23);
84
+ letter-spacing: fn.px-to-em(0.4);
85
85
  }
86
86
 
87
87
  &--700 {
88
- font-size: px-to-rem(20);
88
+ font-size: fn.px-to-rem(20);
89
89
  font-weight: 500;
90
- line-height: px-to-rem(25);
91
- letter-spacing: px-to-em(0.4);
90
+ line-height: fn.px-to-rem(25);
91
+ letter-spacing: fn.px-to-em(0.4);
92
92
  }
93
93
 
94
94
  &--800 {
95
- font-size: px-to-rem(29);
95
+ font-size: fn.px-to-rem(29);
96
96
  font-weight: 500;
97
- line-height: px-to-rem(32);
98
- letter-spacing: px-to-em(0.4);
97
+ line-height: fn.px-to-rem(32);
98
+ letter-spacing: fn.px-to-em(0.4);
99
99
  }
100
100
 
101
101
  &--900 {
102
- font-size: px-to-rem(35);
102
+ font-size: fn.px-to-rem(35);
103
103
  font-weight: 500;
104
- line-height: px-to-rem(40);
105
- letter-spacing: px-to-em(0.4);
104
+ line-height: fn.px-to-rem(40);
105
+ letter-spacing: fn.px-to-em(0.4);
106
106
  }
107
107
  }
108
108
  </style>
@@ -1,3 +1,4 @@
1
1
  export { default as Colors } from './src/colors/Colors'
2
2
  export { default as ToggleColors } from './src/colors/ToggleColors'
3
3
  export { default as Position } from './src/Position'
4
+ export { default as CpTableConfig } from './src/CpTableConfig'
@@ -0,0 +1,14 @@
1
+ const VISIBLE_ROWS_MAX = 100
2
+
3
+ const RESERVED_KEYS = {
4
+ GROUP_BY: 'groupBy',
5
+ FULL_WIDTH: 'fullWidth',
6
+ IS_SELECTED: 'isSelected',
7
+ }
8
+
9
+ const PAGINATION_FORMATS = {
10
+ RESULTS: 'results',
11
+ PAGES: 'pages',
12
+ }
13
+
14
+ export default { VISIBLE_ROWS_MAX, RESERVED_KEYS, PAGINATION_FORMATS }