@citizenplane/pimp 9.5.11 → 9.5.13

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.
@@ -3,21 +3,21 @@
3
3
  <base-input-label
4
4
  v-if="label"
5
5
  v-bind-once="{ for: inputIdentifier }"
6
+ class="cpTextarea__label"
6
7
  :is-invalid="isInvalid"
7
8
  :required="required"
8
- class="cpTextarea__label"
9
9
  >
10
10
  {{ capitalizedLabel }}
11
11
  </base-input-label>
12
12
  <textarea
13
13
  v-model="textareaModel"
14
14
  v-bind-once="{ id: inputIdentifier }"
15
+ class="cpTextarea__input"
16
+ :class="{ 'cpTextarea__input--isInvalid': isInvalid }"
15
17
  :disabled="disabled"
16
18
  :placeholder="placeholder"
17
19
  :required="required"
18
20
  :style="`min-height: ${height}px`"
19
- :class="{ 'cpTextarea__input--isInvalid': isInvalid }"
20
- class="cpTextarea__input"
21
21
  />
22
22
  <transition-expand>
23
23
  <p v-if="displayErrorMessage" class="cpTextarea__error">
@@ -28,12 +28,12 @@
28
28
  </template>
29
29
 
30
30
  <script setup lang="ts">
31
- import { ref, computed } from 'vue'
31
+ import { ref, computed, useId } from 'vue'
32
32
 
33
33
  import BaseInputLabel from '@/components/BaseInputLabel.vue'
34
34
  import TransitionExpand from '@/components/TransitionExpand.vue'
35
35
 
36
- import { randomString, capitalizeFirstLetter } from '@/helpers'
36
+ import { capitalizeFirstLetter } from '@/helpers'
37
37
 
38
38
  interface Emits {
39
39
  (e: 'update:modelValue', value: string): void
@@ -75,7 +75,7 @@ const textareaModel = defineModel<string>({
75
75
  },
76
76
  })
77
77
 
78
- const inputIdentifier = ref(props.inputId || randomString())
78
+ const inputIdentifier = ref(props.inputId || useId())
79
79
 
80
80
  const capitalizedLabel = computed(() => capitalizeFirstLetter(props.label))
81
81
 
@@ -11,15 +11,15 @@
11
11
  @mouseleave="setHoverState(false)"
12
12
  >
13
13
  <div class="cpToaster__content">
14
- <cp-icon :type="toasterIcon" class="cpToaster__icon" />
14
+ <cp-icon class="cpToaster__icon" :type="toasterIcon" />
15
15
  <div class="cpToaster__body">
16
- <cp-heading :heading-level="HeadingLevels.H4" :size="400" class="cpToaster__title">{{ title }}</cp-heading>
16
+ <cp-heading class="cpToaster__title" :heading-level="HeadingLevels.H4" :size="400">{{ title }}</cp-heading>
17
17
  <p v-if="description" class="cpToaster__description">{{ description }}</p>
18
18
  </div>
19
19
  </div>
20
- <button type="button" class="cpToaster__close" @click="closeToaster"><cp-icon type="x" /></button>
20
+ <button class="cpToaster__close" type="button" @click="closeToaster"><cp-icon type="x" /></button>
21
21
  <div v-if="actionLabel" class="cpToaster__footer">
22
- <button type="button" class="cpToaster__button" @click="handleActionMethod">
22
+ <button class="cpToaster__button" type="button" @click="handleActionMethod">
23
23
  {{ actionLabel }}
24
24
  </button>
25
25
  </div>
@@ -29,13 +29,12 @@
29
29
 
30
30
  <script setup lang="ts">
31
31
  import { animate } from 'animejs'
32
- import { ref, computed, watch, onBeforeMount, onMounted, nextTick, getCurrentInstance } from 'vue'
32
+ import { ref, computed, watch, onBeforeMount, onMounted, nextTick, getCurrentInstance, useId } from 'vue'
33
33
 
34
34
  import CpHeading from '@/components/CpHeading.vue'
35
35
  import CpIcon from '@/components/CpIcon.vue'
36
36
 
37
37
  import { HeadingLevels, Intent } from '@/constants'
38
- import { randomString } from '@/helpers'
39
38
 
40
39
  interface Props {
41
40
  actionLabel?: string
@@ -69,7 +68,7 @@ if (!validateType(props.type)) {
69
68
  console.warn(`Type de toaster invalide: ${props.type}`)
70
69
  }
71
70
 
72
- const toasterId = ref<string>()
71
+ const toasterId = useId()
73
72
  const toastersContainer = ref<HTMLElement | null>(null)
74
73
  const isOpen = ref<boolean>(false)
75
74
  const isHovered = ref<boolean>(false)
@@ -121,10 +120,6 @@ const removeSiblings = (): void => {
121
120
  siblings.forEach(removeElement)
122
121
  }
123
122
 
124
- const setToasterId = (): void => {
125
- toasterId.value = randomString()
126
- }
127
-
128
123
  const showToaster = (): void => {
129
124
  isOpen.value = true
130
125
 
@@ -225,7 +220,6 @@ onBeforeMount(() => {
225
220
  createContainer()
226
221
  setupContainer()
227
222
  removeSiblings()
228
- setToasterId()
229
223
  })
230
224
 
231
225
  onMounted(() => {
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <svg
3
+ fill="none"
4
+ height="16"
5
+ stroke="currentColor"
6
+ stroke-linecap="round"
7
+ stroke-linejoin="round"
8
+ stroke-width="1.5"
9
+ viewBox="0 0 16 16"
10
+ width="16"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ >
13
+ <path
14
+ d="M2.0011 4.86629V4.60307C2.0011 3.62495 2.79402 2.83203 3.77214 2.83203H12.2301C13.2082 2.83203 14.0011 3.62495 14.0011 4.60307V11.3966C14.0011 12.3748 13.2082 13.1677 12.2301 13.1677H10.4052M9.58093 5.32658H11.5191V7.26479M9.45274 7.40582L11.532 5.32658M3.51706 13.1677H5.81639C6.65478 13.1677 7.33442 12.488 7.33442 11.6496V9.35031C7.33442 8.51192 6.65478 7.83228 5.81639 7.83228H3.51706C2.67867 7.83228 1.99902 8.51192 1.99902 9.35031V11.6496C1.99902 12.488 2.67867 13.1677 3.51706 13.1677Z"
15
+ />
16
+ </svg>
17
+ </template>
@@ -78,6 +78,7 @@ import IconTicket from '@/components/icons/IconTicket.vue'
78
78
  import IconTimer from '@/components/icons/IconTimer.vue'
79
79
  import IconTooltip from '@/components/icons/IconTooltip.vue'
80
80
  import IconTrafficControl from '@/components/icons/IconTrafficControl.vue'
81
+ import IconWindowExpand from '@/components/icons/IconWindowExpand.vue'
81
82
 
82
83
  export const CustomCpIcons = {
83
84
  'accompanied-minor-each': IconAccompaniedMinorEach,
@@ -160,4 +161,5 @@ export const CustomCpIcons = {
160
161
  timer: IconTimer,
161
162
  tooltip: IconTooltip,
162
163
  'traffic-control': IconTrafficControl,
164
+ 'window-expand': IconWindowExpand,
163
165
  }
@@ -1,9 +1,5 @@
1
1
  import { DateTime } from 'luxon'
2
2
 
3
- export const randomString = (): string => {
4
- return `_${Math.random().toString(36).substr(2, 9)}`
5
- }
6
-
7
3
  export const formatDates = ({
8
4
  dateOne,
9
5
  dateTwo,
@@ -18,17 +18,17 @@
18
18
  </div>
19
19
  <div class="asd__datepicker-header">
20
20
  <button
21
- type="button"
22
- class="asd__change-month-button asd__change-month-button--previous"
23
21
  aria-label="previous month"
22
+ class="asd__change-month-button asd__change-month-button--previous"
23
+ type="button"
24
24
  @click="previousMonth"
25
25
  >
26
26
  <cp-icon type="chevron-left" />
27
27
  </button>
28
28
  <button
29
- type="button"
30
- class="asd__change-month-button asd__change-month-button--next"
31
29
  aria-label="next month"
30
+ class="asd__change-month-button asd__change-month-button--next"
31
+ type="button"
32
32
  @click="nextMonth"
33
33
  >
34
34
  <cp-icon type="chevron-right" />
@@ -63,8 +63,8 @@
63
63
  <option
64
64
  v-for="(monthName, idx) in monthNames"
65
65
  :key="`month-${monthIndex}-${monthName}`"
66
- :value="monthName"
67
66
  :disabled="isMonthDisabled(month.year, idx)"
67
+ :value="monthName"
68
68
  >
69
69
  {{ monthName }}
70
70
  </option>
@@ -80,8 +80,8 @@
80
80
  <option
81
81
  v-if="years.indexOf(month.year) === -1"
82
82
  :key="`month-${monthIndex}-${month.year}`"
83
- :value="month.year"
84
83
  :disabled="true"
84
+ :value="month.year"
85
85
  >
86
86
  {{ month.year }}
87
87
  </option>
@@ -99,17 +99,17 @@
99
99
  :key="dayIndex + '_' + dayNumber"
100
100
  :ref="`date-${dayDate}`"
101
101
  class="asd__day"
102
- :data-date="dayDate"
103
102
  :class="getDayClasses(dayNumber, dayDate)"
103
+ :data-date="dayDate"
104
104
  @mouseover="setHoverDate(dayDate)"
105
105
  >
106
106
  <button
107
107
  v-if="dayNumber"
108
108
  class="asd__day-button"
109
- type="button"
110
- tabindex="-1"
111
109
  :date="dayDate"
112
110
  :disabled="isDisabled(dayDate)"
111
+ tabindex="-1"
112
+ type="button"
113
113
  @click="selectDate(dayDate)"
114
114
  >
115
115
  <span class="asd__day-number">{{ dayNumber }}</span>
@@ -128,11 +128,11 @@
128
128
 
129
129
  <script lang="ts">
130
130
  import { DateTime, Info } from 'luxon'
131
+ import { useId } from 'vue'
131
132
 
132
133
  import CpIcon from '@/components/CpIcon.vue'
133
134
 
134
135
  import ResizeSelect from '@/directives/ResizeSelect'
135
- import { randomString } from '@/helpers'
136
136
 
137
137
  export default {
138
138
  name: 'CoreDatepicker',
@@ -263,7 +263,7 @@ export default {
263
263
  ],
264
264
  data() {
265
265
  return {
266
- wrapperId: 'datepicker-wrapper-' + randomString(5),
266
+ wrapperId: 'datepicker-wrapper-' + useId(),
267
267
  dateLabelFormat: 'dddd, MMMM D, YYYY',
268
268
  showDatepicker: false,
269
269
  showKeyboardShortcutsMenu: false,