@citizenplane/pimp 6.4.0 → 7.0.4

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 (70) hide show
  1. package/.eslintrc.js +3 -6
  2. package/.lintstagedrc.json +4 -0
  3. package/dist/favicon.ico +0 -0
  4. package/dist/pimp.es.js +10617 -0
  5. package/dist/pimp.umd.js +9 -35597
  6. package/dist/style.css +1 -0
  7. package/jest.config.js +11 -11
  8. package/package-lock.json +7966 -13664
  9. package/package.json +37 -41
  10. package/src/App.vue +12 -17
  11. package/src/assets/styles/base/_base.scss +3 -16
  12. package/src/assets/styles/helpers/_keyframes.scss +26 -29
  13. package/src/components/buttons/CpButton.vue +10 -6
  14. package/src/components/core/BaseInputLabel/index.vue +2 -2
  15. package/src/components/core/playground-sections/SectionAtomicElements.vue +1 -1
  16. package/src/components/core/playground-sections/SectionButtons.vue +14 -11
  17. package/src/components/core/playground-sections/SectionDatePickers.vue +31 -17
  18. package/src/components/core/playground-sections/SectionFeedbackIndicators.vue +1 -1
  19. package/src/components/core/playground-sections/SectionInputs.vue +3 -3
  20. package/src/components/core/playground-sections/SectionListsAndTables.vue +2 -2
  21. package/src/components/core/playground-sections/SectionSelectMenus.vue +13 -13
  22. package/src/components/core/playground-sections/SectionSelects.vue +1 -1
  23. package/src/components/core/playground-sections/SectionSimpleInputs.vue +20 -18
  24. package/src/components/core/playground-sections/SectionToasters.vue +1 -1
  25. package/src/components/core/playground-sections/SectionToggles.vue +23 -36
  26. package/src/components/core/playground-sections/SectionTypography.vue +1 -1
  27. package/src/components/date-pickers/CpCalendar.vue +60 -14
  28. package/src/components/date-pickers/CpDate.vue +11 -13
  29. package/src/components/date-pickers/CpDatepicker.vue +55 -8
  30. package/src/components/feedback-indicators/CpAlert.vue +5 -15
  31. package/src/components/feedback-indicators/CpToaster.vue +299 -86
  32. package/src/components/helpers-utilities/TransitionExpand.vue +52 -58
  33. package/src/components/index.js +38 -73
  34. package/src/components/inputs/CpInput.vue +20 -55
  35. package/src/components/inputs/CpTextarea.vue +8 -9
  36. package/src/components/lists-and-table/CpTable/CpTableEmptyState/index.vue +1 -6
  37. package/src/components/lists-and-table/CpTable/index.scss +16 -9
  38. package/src/components/lists-and-table/CpTable/index.vue +6 -5
  39. package/src/components/selects/CpSelect.vue +10 -11
  40. package/src/components/selects/CpSelectMenu/index.vue +13 -23
  41. package/src/components/toggles/CpCheckbox/index.scss +8 -5
  42. package/src/components/toggles/CpCheckbox/index.vue +3 -7
  43. package/src/components/toggles/CpRadio/index.scss +14 -11
  44. package/src/components/toggles/CpRadio/index.vue +34 -47
  45. package/src/components/toggles/CpSwitch/index.vue +18 -17
  46. package/src/components/typography/CpHeading/index.vue +2 -2
  47. package/src/components/visual/CpIcon.vue +156 -0
  48. package/src/directives/ClickOutside.js +13 -0
  49. package/src/directives/ResizeSelect.js +1 -1
  50. package/src/libs/CoreDatepicker.vue +127 -133
  51. package/src/main.js +16 -10
  52. package/src/plugins/toaster.js +69 -0
  53. package/src/utils/constants/src/Intent.js +4 -4
  54. package/vite.config.js +45 -0
  55. package/dist/demo.html +0 -10
  56. package/dist/img/chevron-down-icon.dd31db33.svg +0 -3
  57. package/dist/pimp.common.js +0 -35587
  58. package/dist/pimp.common.js.map +0 -1
  59. package/dist/pimp.css +0 -1
  60. package/dist/pimp.umd.js.map +0 -1
  61. package/dist/pimp.umd.min.js +0 -2
  62. package/dist/pimp.umd.min.js.map +0 -1
  63. package/public/index.html +0 -17
  64. package/src/components/core/playground-sections/SectionMultiSelects.vue +0 -57
  65. package/src/components/selects/CpMultiselect.vue +0 -211
  66. package/src/helpers/multiselectMixin.js +0 -765
  67. package/src/helpers/pointerMixin.js +0 -135
  68. package/src/libs/CoreMultiSelect.vue +0 -618
  69. package/src/libs/CoreToaster.vue +0 -269
  70. package/vue.config.js +0 -20
@@ -49,10 +49,10 @@
49
49
  placeholder="Input placeholder"
50
50
  style="font-size: 18px"
51
51
  >
52
- <map-pin-icon slot="input-icon" />
52
+ <template #input-icon><cp-icon type="map-pin" /></template>
53
53
  </cp-input>
54
54
  <cp-input v-model="inputs.icons" label="Input with icon before" type="text" placeholder="Input placeholder">
55
- <map-pin-icon slot="input-icon" />
55
+ <template #input-icon><cp-icon type="map-pin" /></template>
56
56
  </cp-input>
57
57
  <cp-input
58
58
  v-model="inputs.icons"
@@ -61,7 +61,9 @@
61
61
  placeholder="Input placeholder"
62
62
  style="font-size: 14px"
63
63
  >
64
- <span slot="input-icon-after">cm</span>
64
+ <template #input-icon-after>
65
+ <span>cm</span>
66
+ </template>
65
67
  </cp-input>
66
68
  </div>
67
69
  </div>
@@ -69,7 +71,7 @@
69
71
  <cp-heading heading-level="h3" :size="600" class="sectionSimpleInputs__title">Disabled</cp-heading>
70
72
  <div class="sectionSimpleInputs__inputs">
71
73
  <cp-input label="Empty disabled input with icon before" type="text" placeholder="Input placeholder" disabled>
72
- <map-pin-icon slot="input-icon" />
74
+ <template #input-icon><cp-icon type="map-pin" /></template>
73
75
  </cp-input>
74
76
  <cp-input
75
77
  v-model="inputs.disabled"
@@ -78,7 +80,7 @@
78
80
  placeholder="Input placeholder"
79
81
  disabled
80
82
  >
81
- <map-pin-icon slot="input-icon" />
83
+ <template #input-icon><cp-icon type="map-pin" /></template>
82
84
  </cp-input>
83
85
  <cp-input
84
86
  v-model="inputs.disabled"
@@ -88,7 +90,9 @@
88
90
  disabled
89
91
  is-invalid
90
92
  >
91
- <span slot="input-icon-after">cm</span>
93
+ <template #input-icon-after>
94
+ <span>cm</span>
95
+ </template>
92
96
  </cp-input>
93
97
  </div>
94
98
  </div>
@@ -103,7 +107,7 @@
103
107
  is-invalid
104
108
  error-message="This input has an error"
105
109
  >
106
- <map-pin-icon slot="input-icon" />
110
+ <template #input-icon><cp-icon type="map-pin" /></template>
107
111
  </cp-input>
108
112
  <cp-input
109
113
  v-model="inputs.error"
@@ -113,7 +117,7 @@
113
117
  is-invalid
114
118
  error-message="This input has an error"
115
119
  >
116
- <map-pin-icon slot="input-icon" />
120
+ <template #input-icon><cp-icon type="map-pin" /></template>
117
121
  </cp-input>
118
122
  <cp-input
119
123
  v-model="inputs.error"
@@ -123,7 +127,9 @@
123
127
  is-invalid
124
128
  error-message="This input has an error"
125
129
  >
126
- <span slot="input-icon-after">cm</span>
130
+ <template #input-icon-after>
131
+ <span>cm</span>
132
+ </template>
127
133
  </cp-input>
128
134
  </div>
129
135
  </div>
@@ -144,10 +150,9 @@
144
150
  <div class="sectionSimpleInputs__inputs">
145
151
  <cp-input
146
152
  v-model="inputs.poop"
147
- label="This input generates a console error due to vue-the-mask"
153
+ label="Type number, masked ###"
148
154
  type="number"
149
155
  placeholder="Input placeholder"
150
- :masked="true"
151
156
  mask="###"
152
157
  />
153
158
  <cp-input v-model="inputs.number" label="Input type number" type="number" placeholder="Input placeholder" />
@@ -174,7 +179,6 @@
174
179
  v-model="inputs.mask"
175
180
  label="Date masked input"
176
181
  type="text"
177
- :masked="true"
178
182
  placeholder="00/00/0000"
179
183
  mask="##/##/####"
180
184
  />
@@ -205,8 +209,10 @@
205
209
  <div class="sectionSimpleInputs__inputs">
206
210
  <cp-input v-model="inputs.large" label="Large input" type="text" placeholder="Input placeholder" is-large />
207
211
  <cp-input v-model="inputs.large" label="Large input" type="text" placeholder="Input placeholder" is-large>
208
- <map-pin-icon slot="input-icon" />
209
- <span slot="input-icon-after">cm</span>
212
+ <template #input-icon><cp-icon type="map-pin" /></template>
213
+ <template #input-icon-after>
214
+ <span>cm</span>
215
+ </template>
210
216
  </cp-input>
211
217
  </div>
212
218
  </div>
@@ -214,11 +220,7 @@
214
220
  </template>
215
221
 
216
222
  <script>
217
- import { MapPinIcon } from 'vue-feather-icons'
218
223
  export default {
219
- components: {
220
- MapPinIcon,
221
- },
222
224
  data() {
223
225
  return {
224
226
  inputs: {
@@ -16,7 +16,7 @@
16
16
  </template>
17
17
 
18
18
  <script>
19
- import SectionContainer from '@/components/core/playground-sections/SectionContainer'
19
+ import SectionContainer from '@/components/core/playground-sections/SectionContainer.vue'
20
20
 
21
21
  export default {
22
22
  components: {
@@ -30,7 +30,7 @@
30
30
  <cp-checkbox
31
31
  v-for="({ label, value, disabled }, index) in checkboxGroup"
32
32
  :key="`checkbox${index}`"
33
- v-model="checkboxGroupSelectOption"
33
+ v-model:value="checkboxGroupSelectOption"
34
34
  :checkbox-value="value"
35
35
  :checkbox-label="label"
36
36
  group-name="cp-checkbox"
@@ -42,11 +42,11 @@
42
42
  <h3>Simple checkbox</h3>
43
43
  <span>Selected value: {{ simpleCheckbox }}</span>
44
44
  <div class="sectionToggles__toggle">
45
- <cp-checkbox v-model="simpleCheckbox" checkbox-label="label" group-name="simple-checkbox" />
45
+ <cp-checkbox v-model:value="simpleCheckbox" checkbox-label="label" group-name="simple-checkbox" />
46
46
  </div>
47
47
  <div class="sectionToggles__toggle">
48
48
  <cp-checkbox
49
- v-model="simpleCheckbox"
49
+ v-model:value="simpleCheckbox"
50
50
  checkbox-label="Purple reversed label checkbox"
51
51
  group-name="simple-checkbox"
52
52
  :color="Colors.PURPLE"
@@ -58,26 +58,14 @@
58
58
  <h3>Radio</h3>
59
59
  <span>Selected value: {{ radioGroupSelectedOption }}</span>
60
60
  <div class="sectionToggles__toggle">
61
- <cp-radio
62
- v-for="({ label, value, dimensions, price, disabled, color }, index) in radioGroup"
63
- :key="index"
64
- v-model="radioGroupSelectedOption"
65
- :radio-value="value"
66
- :radio-label="label"
67
- :radio-description="dimensions"
68
- :additional-data="price"
69
- group-name="cp-radio"
70
- :is-selected="isRadioSelected(value)"
71
- :is-disabled="disabled"
72
- :color="color"
73
- />
61
+ <cp-radio v-model="radioGroupSelectedOption" :options="radioGroup" group-name="cp-radio" color="purple" />
74
62
  </div>
75
63
  </div>
76
64
  </section-container>
77
65
  </template>
78
66
 
79
67
  <script>
80
- import SectionContainer from '@/components/core/playground-sections/SectionContainer'
68
+ import SectionContainer from '@/components/core/playground-sections/SectionContainer.vue'
81
69
 
82
70
  import { Colors } from '@/constants'
83
71
 
@@ -91,41 +79,40 @@ export default {
91
79
  cpSwitchState: true,
92
80
  radioGroup: [
93
81
  {
94
- value: 'first_value',
95
- label: 'first value',
96
- dimensions: 'default',
97
- price: 'default color',
82
+ value: 'basketball',
83
+ label: 'Basketball',
84
+ description: 'default',
85
+ additionalData: 'default color',
98
86
  },
99
87
  {
100
- value: 'second_value',
101
- label: 'second value',
102
- price: 'disabled',
88
+ value: 'football',
89
+ label: 'Football',
90
+ additionalData: 'disabled',
103
91
  disabled: true,
104
92
  },
105
93
  {
106
- value: 'third_value',
107
- label: 'third value',
108
- price: Colors.PURPLE,
109
- color: Colors.PURPLE,
94
+ value: 'handball',
95
+ label: 'Handball',
96
+ additionalData: 'More data',
110
97
  },
111
98
  ],
112
99
  checkboxGroup: [
113
100
  {
114
- value: 'first_value',
115
- label: 'first value',
101
+ value: 'ski',
102
+ label: 'Ski',
116
103
  },
117
104
  {
118
- value: 'second_value',
119
- label: 'second value',
105
+ value: 'snowboard',
106
+ label: 'Snowboard',
120
107
  disabled: true,
121
108
  },
122
109
  {
123
- value: 'third_value',
124
- label: 'third value',
110
+ value: 'wakeboard',
111
+ label: 'Wake board',
125
112
  },
126
113
  ],
127
- radioGroupSelectedOption: 'second_value',
128
- checkboxGroupSelectOption: ['second_value'],
114
+ radioGroupSelectedOption: 'football',
115
+ checkboxGroupSelectOption: ['snowboard'],
129
116
  simpleCheckbox: true,
130
117
  }
131
118
  },
@@ -16,7 +16,7 @@
16
16
  </template>
17
17
 
18
18
  <script>
19
- import SectionContainer from '@/components/core/playground-sections/SectionContainer'
19
+ import SectionContainer from '@/components/core/playground-sections/SectionContainer.vue'
20
20
 
21
21
  export default {
22
22
  components: {
@@ -3,7 +3,7 @@
3
3
  <cp-input
4
4
  type="text"
5
5
  :input-id="triggerElementId"
6
- :value="humanDateFormat(dateOne, dateTwo)"
6
+ :model-value="humanDateFormat(dateOne, dateTwo)"
7
7
  placeholder="Select a date"
8
8
  :is-invalid="isError"
9
9
  :error-message="errorMessage"
@@ -15,12 +15,13 @@
15
15
  :date-one="dateOne"
16
16
  :date-two="dateTwo"
17
17
  :customized-dates="[{ cssClass: 'recurency', dates: datesToStringArray(recurenceDates) }]"
18
- :is-recurcive="isDaysDisplayed"
19
18
  :trigger-element-id="triggerElementId"
20
19
  :mode="mode"
21
20
  :close-after-select="closeAfterSelect"
22
21
  :close-calendar="triggerCalendar"
23
22
  :inline="isInline"
23
+ class="cpCalendar__datepicker"
24
+ :class="dynamicClasses"
24
25
  @date-one-selected="(date) => selectDate('dateOne', date)"
25
26
  @date-two-selected="(date) => selectDate('dateTwo', date)"
26
27
  @is-inline="(value) => (isInline = value)"
@@ -41,8 +42,8 @@
41
42
  >
42
43
  <div class="checkbox">
43
44
  <transition name="fade" mode="out-in">
44
- <div v-if="!selected" class="checkbox--border"></div>
45
- <check-icon v-if="selected"></check-icon>
45
+ <div v-if="!selected" class="checkbox--border" />
46
+ <cp-icon v-else type="check" />
46
47
  </transition>
47
48
  </div>
48
49
  <span>{{ day }}</span>
@@ -51,7 +52,7 @@
51
52
  </div>
52
53
  <div class="asd__recurency--summary">
53
54
  <div class="asd__recurency--text">
54
- <refresh-cw-icon v-if="recurenceDates.length > 0" />
55
+ <cp-icon v-if="recurenceDates.length > 0" type="refresh-cw" />
55
56
  <span v-if="recurenceDates.length > 0">
56
57
  Between the
57
58
  <strong>{{ summary.start }}</strong> and the
@@ -85,12 +86,12 @@
85
86
  </template>
86
87
 
87
88
  <script>
88
- import { CheckIcon, RefreshCwIcon } from 'vue-feather-icons'
89
89
  import { DateTime, Info, Interval } from 'luxon'
90
90
 
91
- import CpButton from '@/components/buttons/CpButton'
92
- import CpInput from '@/components/inputs/CpInput'
93
- import CoreDatepicker from '@/libs/CoreDatepicker'
91
+ import CpButton from '@/components/buttons/CpButton.vue'
92
+ import CpInput from '@/components/inputs/CpInput.vue'
93
+ import CpIcon from '@/components/visual/CpIcon.vue'
94
+ import CoreDatepicker from '@/libs/CoreDatepicker.vue'
94
95
 
95
96
  import { randomString, formatDates } from '@/helpers'
96
97
 
@@ -98,9 +99,8 @@ export default {
98
99
  name: 'CpCalendar',
99
100
  components: {
100
101
  CoreDatepicker,
101
- CheckIcon,
102
- RefreshCwIcon,
103
102
  CpInput,
103
+ CpIcon,
104
104
  CpButton,
105
105
  },
106
106
  props: {
@@ -132,6 +132,7 @@ export default {
132
132
  },
133
133
  },
134
134
  },
135
+ emits: ['dates'],
135
136
  data() {
136
137
  return {
137
138
  humanFormat: 'EEE DD',
@@ -144,7 +145,7 @@ export default {
144
145
  mode: 'single',
145
146
  triggerCalendar: false,
146
147
  isInline: false,
147
- isDisabled: false,
148
+ isDisabled: null,
148
149
  }
149
150
  },
150
151
  computed: {
@@ -163,6 +164,9 @@ export default {
163
164
  isDaysDisplayed() {
164
165
  return this.mode === 'range'
165
166
  },
167
+ dynamicClasses() {
168
+ return { 'cpCalendar__datepicker--isInline': this.isInline }
169
+ },
166
170
  },
167
171
  watch: {
168
172
  isInline(value) {
@@ -249,12 +253,54 @@ export default {
249
253
  .fade-leave-active {
250
254
  transition: opacity 100ms;
251
255
  }
252
- .fade-enter,
256
+ .fade-enter-from,
253
257
  .fade-leave-to {
254
258
  opacity: 0;
255
259
  }
256
260
  .cpCalendar {
257
- position: relative;
261
+ // Opening transition layout adaptation
262
+ .asd__fade-enter-from {
263
+ transform: translateX(-50%) scale(0.8);
264
+ }
265
+
266
+ .asd__fade-enter-to {
267
+ transform: translateX(-50%) scale(1);
268
+ }
269
+
270
+ &__datepicker {
271
+ position: absolute;
272
+ left: 50%;
273
+ transform: translateX(-50%);
274
+ }
275
+
276
+ &__datepicker:not(&__datepicker--isInline) {
277
+ margin-top: 10px;
278
+ }
279
+
280
+ @media (min-width: 350px) {
281
+ position: relative;
282
+ }
283
+
284
+ @media (max-width: 767px) and (min-width: 350px) {
285
+ &__datepicker {
286
+ left: 0;
287
+ right: 0;
288
+ transform: initial;
289
+ }
290
+
291
+ &__datepicker:not(&__datepicker--isInline) {
292
+ margin-top: 16px;
293
+ }
294
+
295
+ // Opening transition layout adaptation
296
+ .asd__fade-enter-from {
297
+ transform: scale(0.8);
298
+ }
299
+
300
+ .asd__fade-enter-to {
301
+ transform: scale(1);
302
+ }
303
+ }
258
304
 
259
305
  &__input input:disabled {
260
306
  background-color: $neutral-light;
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="cpDate" :class="dynamicClasses">
3
3
  <label v-if="label" class="cpDate__label" :for="cpDateId">
4
- {{ formattedLabel }} <alert-circle-icon v-if="!isDateValid" />
4
+ {{ formattedLabel }} <cp-icon v-if="!isDateValid" type="alert-circle" />
5
5
  </label>
6
6
  <div class="cpDate__inputs">
7
7
  <input
@@ -49,20 +49,16 @@
49
49
 
50
50
  <script>
51
51
  import { Info, DateTime } from 'luxon'
52
- import { AlertCircleIcon } from 'vue-feather-icons'
53
52
 
54
53
  import { randomString } from '@/helpers'
55
54
 
56
55
  const HUMAN_MAX_AGE = 120
57
56
 
58
57
  export default {
59
- components: {
60
- AlertCircleIcon,
61
- },
62
58
  props: {
63
- value: {
59
+ modelValue: {
64
60
  type: [String, Date],
65
- required: true,
61
+ default: '',
66
62
  },
67
63
  minDate: {
68
64
  type: [String, Date],
@@ -85,6 +81,7 @@ export default {
85
81
  default: false,
86
82
  },
87
83
  },
84
+ emits: ['update:modelValue', 'on-validation'],
88
85
  data() {
89
86
  return {
90
87
  day: this.initDateToken('day'),
@@ -222,13 +219,14 @@ export default {
222
219
  },
223
220
  methods: {
224
221
  initDateToken(token) {
225
- if (DateTime.fromISO(this.value).invalid) return ''
226
- return DateTime.fromISO(this.value)[token]
222
+ if (DateTime.fromISO(this.modelValue).invalid) return ''
223
+
224
+ return DateTime.fromISO(this.modelValue)[token]
227
225
  },
228
226
  handleUpdate() {
229
- const value = this.isDateValid ? this.isoDate : 'Invalid Datetime'
227
+ const dateValue = this.isDateValid ? this.isoDate : 'Invalid Datetime'
230
228
 
231
- this.$emit('input', value)
229
+ this.$emit('update:modelValue', dateValue)
232
230
  },
233
231
  focusOnFirstEmptyInput() {
234
232
  if (!this.isDayValid) {
@@ -284,7 +282,7 @@ export default {
284
282
  margin: pxToRem(6) 0;
285
283
  font-size: pxToRem(14);
286
284
 
287
- > svg {
285
+ svg {
288
286
  margin-left: $space-sm;
289
287
  width: pxToRem(16);
290
288
  height: pxToRem(16);
@@ -335,7 +333,7 @@ export default {
335
333
  right: pxToEm(12);
336
334
  width: pxToRem(20);
337
335
  height: pxToRem(20);
338
- background-image: url('~@/assets/images/icons/chevron-down-icon.svg');
336
+ background-image: url('@/assets/images/icons/chevron-down-icon.svg');
339
337
  background-size: cover;
340
338
  transform: translateY(-50%);
341
339
  content: '';
@@ -2,10 +2,9 @@
2
2
  <div class="cpDatepicker">
3
3
  <cp-input
4
4
  v-show="!isInline"
5
- :ref="datePickerReferenceId"
5
+ :model-value="inputComputedValue"
6
6
  type="text"
7
7
  :input-id="datePickerReferenceId"
8
- :value="inputComputedValue"
9
8
  :placeholder="placeholder"
10
9
  :is-invalid="isError"
11
10
  :error-message="errorMessage"
@@ -23,17 +22,19 @@
23
22
  :months-to-show="numberOfMonths"
24
23
  :min-date="computedMinDate"
25
24
  :max-date="maxDate"
25
+ class="cpDatepicker__datepicker"
26
+ :class="{ 'cpDatepicker__datepicker--isInline': isInline }"
26
27
  @date-one-selected="(date) => selectDate('dateOne', date)"
27
28
  @date-two-selected="(date) => selectDate('dateTwo', date)"
28
29
  @opened="() => (isDisabled = true)"
29
- @closed="() => (isDisabled = false)"
30
+ @closed="() => (isDisabled = null)"
30
31
  />
31
32
  </div>
32
33
  </template>
33
34
 
34
35
  <script>
35
- import CoreDatepicker from '@/libs/CoreDatepicker'
36
- import CpInput from '@/components/inputs/CpInput'
36
+ import CoreDatepicker from '@/libs/CoreDatepicker.vue'
37
+ import CpInput from '@/components/inputs/CpInput.vue'
37
38
  import { randomString, formatDates } from '@/helpers'
38
39
  import { DateTime } from 'luxon'
39
40
 
@@ -114,13 +115,14 @@ export default {
114
115
  default: false,
115
116
  },
116
117
  },
118
+ emits: ['dates'],
117
119
  data() {
118
120
  return {
119
121
  calendarFormat: 'YYYY-MM-DD',
120
122
  humanFormat: 'EEE DD',
121
123
  dateOne: this.initDateOne || '',
122
124
  dateTwo: this.mode === 'range' ? this.initDateTwo : '',
123
- isDisabled: false,
125
+ isDisabled: null,
124
126
  datePickerReferenceId: this.triggerElementId || randomString(),
125
127
  }
126
128
  },
@@ -134,6 +136,9 @@ export default {
134
136
  computedMinDate() {
135
137
  return this.allowPastDates ? '' : this.minDate
136
138
  },
139
+ dynamicClasses() {
140
+ return { 'cpDatepicker__datepicker--isInline': this.isInline }
141
+ },
137
142
  },
138
143
  watch: {
139
144
  initDateOne(newValue, oldValue) {
@@ -146,7 +151,7 @@ export default {
146
151
  methods: {
147
152
  selectDate(dateType, dateValue) {
148
153
  this[dateType] = dateValue
149
- this.$emit('dates', [this.dateOne, ...(this.dateTwo && this.dateTwo)])
154
+ this.$emit('dates', [this.dateOne, ...(this.dateTwo && [this.dateTwo])])
150
155
  },
151
156
  updateDateValue(date, newValue, oldValue) {
152
157
  if (newValue !== oldValue) {
@@ -159,10 +164,52 @@ export default {
159
164
 
160
165
  <style lang="scss">
161
166
  .cpDatepicker {
162
- position: relative;
167
+ // Opening transition layout adaptation
168
+ .asd__fade-enter-from {
169
+ transform: translateX(-50%) scale(0.8);
170
+ }
171
+
172
+ .asd__fade-enter-to {
173
+ transform: translateX(-50%) scale(1);
174
+ }
163
175
 
164
176
  &__input input:disabled {
165
177
  background-color: $neutral-light;
166
178
  }
179
+
180
+ &__datepicker {
181
+ position: absolute;
182
+ left: 50%;
183
+ transform: translateX(-50%);
184
+ }
185
+
186
+ &__datepicker:not(&__datepicker--isInline) {
187
+ margin-top: 10px;
188
+ }
189
+
190
+ @media (min-width: 350px) {
191
+ position: relative;
192
+ }
193
+
194
+ @media (max-width: 767px) and (min-width: 350px) {
195
+ &__datepicker {
196
+ left: 0;
197
+ right: 0;
198
+ transform: initial;
199
+ }
200
+
201
+ &__datepicker:not(&__datepicker--isInline) {
202
+ margin-top: 16px;
203
+ }
204
+
205
+ // Opening transition layout adaptation
206
+ .asd__fade-enter-from {
207
+ transform: scale(0.8);
208
+ }
209
+
210
+ .asd__fade-enter-to {
211
+ transform: scale(1);
212
+ }
213
+ }
167
214
  }
168
215
  </style>
@@ -1,29 +1,20 @@
1
1
  <template>
2
2
  <div v-if="isDisplayed" class="cpAlert" :class="`cpAlert--${intent}`">
3
- <div :is="alertIcon" class="cpAlert__icon" />
3
+ <cp-icon :type="alertIcon" class="cpAlert__icon" />
4
4
  <div class="cpAlert__body">
5
5
  <cp-heading v-if="title" heading-level="h4" :size="400" class="cpAlert__title">{{ title }}</cp-heading>
6
6
  <div v-if="hasContent" class="cpAlert__content">
7
7
  <slot />
8
8
  </div>
9
9
  </div>
10
- <button v-if="isClosable" class="cpAlert__button" @click="dismissAlert"><x-icon /></button>
10
+ <button v-if="isClosable" class="cpAlert__button" @click="dismissAlert"><cp-icon type="x" /></button>
11
11
  </div>
12
12
  </template>
13
13
 
14
14
  <script>
15
- import { CheckCircleIcon, InfoIcon, AlertTriangleIcon, AlertOctagonIcon, XIcon } from 'vue-feather-icons'
16
-
17
15
  import { Intent } from '@/utils/constants'
18
16
 
19
17
  export default {
20
- components: {
21
- CheckCircleIcon,
22
- InfoIcon,
23
- AlertTriangleIcon,
24
- AlertOctagonIcon,
25
- XIcon,
26
- },
27
18
  props: {
28
19
  intent: {
29
20
  type: String,
@@ -77,9 +68,8 @@ export default {
77
68
  }
78
69
  }
79
70
 
80
- &--is#{$className} &__button:focus {
81
- outline: none;
82
- box-shadow: 0 0 0 pxToEm(3) scale-color($color, $lightness: 70%);
71
+ &--#{$className} button:focus-visible {
72
+ outline: pxToRem(2) solid $color;
83
73
  }
84
74
  }
85
75
 
@@ -136,7 +126,7 @@ export default {
136
126
  padding: $space-sm;
137
127
  color: inherit;
138
128
 
139
- > svg {
129
+ svg {
140
130
  margin: 0;
141
131
  width: pxToRem(18);
142
132
  height: pxToRem(18);