@citizenplane/pimp 8.11.2 → 8.12.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 (52) hide show
  1. package/README.md +0 -2
  2. package/dist/pimp.es.js +1146 -1139
  3. package/dist/pimp.umd.js +3 -3
  4. package/dist/style.css +1 -1
  5. package/package.json +26 -4
  6. package/src/README.md +0 -25
  7. package/src/assets/styles/base/_base.scss +1 -5
  8. package/src/assets/styles/utilities/_index.scss +19 -0
  9. package/src/components/core/BaseInputLabel.vue +0 -2
  10. package/src/components/date-pickers/CpDate.vue +8 -5
  11. package/src/components/inputs/CpInput.vue +5 -16
  12. package/src/components/inputs/CpTextarea.vue +4 -6
  13. package/src/components/selects/CpSelect.vue +5 -5
  14. package/src/stories/BaseInputLabel.stories.ts +35 -0
  15. package/src/stories/CpAlert.stories.ts +90 -0
  16. package/src/stories/CpBadge.stories.ts +158 -0
  17. package/src/stories/CpButton.stories.ts +134 -0
  18. package/src/stories/CpCheckbox.stories.ts +184 -0
  19. package/src/stories/CpDate.stories.ts +110 -0
  20. package/src/stories/CpDatepicker.stories.ts +162 -0
  21. package/src/stories/CpDialog.stories.ts +53 -0
  22. package/src/stories/CpHeading.stories.ts +77 -0
  23. package/src/stories/CpIcon.stories.ts +79 -0
  24. package/src/stories/CpInput.stories.ts +155 -0
  25. package/src/stories/CpLoader.stories.ts +29 -0
  26. package/src/stories/CpRadio.stories.ts +139 -0
  27. package/src/stories/CpSelect.stories.ts +147 -0
  28. package/src/stories/CpSelectMenu.stories.ts +132 -0
  29. package/src/stories/CpSwitch.stories.ts +137 -0
  30. package/src/stories/CpTable.stories.ts +192 -0
  31. package/src/stories/CpTableEmptyState.stories.ts +34 -0
  32. package/src/stories/CpTextarea.stories.ts +112 -0
  33. package/src/stories/CpToaster.stories.ts +147 -0
  34. package/src/stories/CpTooltip.stories.ts +101 -0
  35. package/src/stories/TransitionExpand.stories.ts +85 -0
  36. package/vitest.workspace.js +31 -0
  37. package/src/App.vue +0 -110
  38. package/src/components/core/playground-sections/SectionAtomicElements.vue +0 -83
  39. package/src/components/core/playground-sections/SectionButtons.vue +0 -142
  40. package/src/components/core/playground-sections/SectionContainer.vue +0 -50
  41. package/src/components/core/playground-sections/SectionDatePickers.vue +0 -160
  42. package/src/components/core/playground-sections/SectionDialog.vue +0 -47
  43. package/src/components/core/playground-sections/SectionFeedbackIndicators.vue +0 -47
  44. package/src/components/core/playground-sections/SectionInputs.vue +0 -46
  45. package/src/components/core/playground-sections/SectionListsAndTables.vue +0 -268
  46. package/src/components/core/playground-sections/SectionSelectMenus.vue +0 -98
  47. package/src/components/core/playground-sections/SectionSelects.vue +0 -120
  48. package/src/components/core/playground-sections/SectionSimpleInputs.vue +0 -305
  49. package/src/components/core/playground-sections/SectionToasters.vue +0 -68
  50. package/src/components/core/playground-sections/SectionToggles.vue +0 -158
  51. package/src/components/core/playground-sections/SectionTypography.vue +0 -40
  52. package/src/main.js +0 -15
@@ -1,268 +0,0 @@
1
- <template>
2
- <section-container section-title="List and tables" class="sectionListAndTables">
3
- <div class="sectionListAndTables">
4
- <cp-table
5
- :caption="caption"
6
- :data="computedRows"
7
- :columns="computedColumns"
8
- class="tableExample__table"
9
- :pagination="computedPagination"
10
- :is-loading="isLoading"
11
- enable-row-options
12
- are-rows-clickable
13
- @on-row-right-click="handleRightClick"
14
- >
15
- <template #row-quick-actions>
16
- <button @click.stop="testAlert">
17
- <cp-icon type="download" />
18
- </button>
19
- </template>
20
- </cp-table>
21
- <ul ref="menu" class="sectionListAndTables__menu hidden">
22
- <li>First option</li>
23
- <li>Second option</li>
24
- <li>Third option</li>
25
- </ul>
26
- </div>
27
- </section-container>
28
- </template>
29
-
30
- <script>
31
- import SectionContainer from '@/components/core/playground-sections/SectionContainer.vue'
32
-
33
- export default {
34
- components: {
35
- SectionContainer,
36
- },
37
- data() {
38
- return {
39
- objectColumns: [
40
- {
41
- name: 'Line number (300px width)',
42
- id: 'line_number',
43
- width: 300,
44
- },
45
- 'name',
46
- {
47
- name: 'Firstname (right aligned)',
48
- id: 'firstname',
49
- textAlign: 'right',
50
- },
51
- {
52
- name: 'Job title',
53
- id: 'job_title',
54
- },
55
- {
56
- name: 'Username (center aligned, 400px width)',
57
- id: 'username',
58
- width: 400,
59
- textAlign: 'center',
60
- },
61
- 'email',
62
- {
63
- name: 'Address (300px width)',
64
- id: 'address',
65
- width: 300,
66
- },
67
- 'zip code',
68
- {
69
- name: 'City',
70
- id: 'city',
71
- },
72
- {
73
- name: 'State',
74
- id: 'state',
75
- },
76
- {
77
- name: 'Country',
78
- id: 'country',
79
- },
80
- {
81
- name: 'Phone number',
82
- id: 'phone_number',
83
- },
84
- ],
85
- caption: 'Table caption',
86
- pagination: {
87
- enabled: true,
88
- limit: this.rowsPerPage,
89
- },
90
- rowsPerPage: 4,
91
- numberOfColumns: 12,
92
- rowData: '',
93
- cellData: '',
94
- isLoading: false,
95
- }
96
- },
97
- computed: {
98
- objectRows() {
99
- return [
100
- {
101
- groupBy: 'January',
102
- rows: [
103
- {
104
- line_number: '0',
105
- firstname: 'Vincent',
106
- job_title: 'software engineer',
107
- username: 'pseudodeVincent',
108
- address: '34 rue de la Solidarité',
109
- state: 'Nevada',
110
- },
111
- [
112
- '1',
113
- 'Ohayon',
114
- 'Alexis',
115
- 'CTO',
116
- 'aloha',
117
- 'alexis@citizenplane.com',
118
- '23 rue de Cléry',
119
- '75002',
120
- 'Paris',
121
- 'Ile de France',
122
- 'France',
123
- '0101010110',
124
- ],
125
- ],
126
- },
127
- {
128
- groupBy: 'February',
129
- rows: [
130
- {
131
- line_number: '0',
132
- firstname: 'Vincent',
133
- job_title: 'software engineer',
134
- username: 'pseudodeVincent',
135
- address: '34 rue de la Solidarité',
136
- state: 'Nevada',
137
- },
138
- [
139
- '1',
140
- 'Ohayon',
141
- 'Alexis',
142
- 'CTO',
143
- 'aloha',
144
- 'alexis@citizenplane.com',
145
- '23 rue de Cléry',
146
- '75002',
147
- 'Paris',
148
- 'Ile de France',
149
- 'France',
150
- '0101010110',
151
- ],
152
- ],
153
- },
154
- {
155
- groupBy: 'March',
156
- rows: [
157
- {
158
- line_number: '0',
159
- firstname: 'Vincent',
160
- job_title: 'software engineer',
161
- username: 'pseudodeVincent',
162
- address: '34 rue de la Solidarité',
163
- state: 'Nevada',
164
- },
165
- [
166
- '1',
167
- 'Ohayon',
168
- 'Alexis',
169
- 'CTO',
170
- 'aloha',
171
- 'alexis@citizenplane.com',
172
- '23 rue de Cléry',
173
- '75002',
174
- 'Paris',
175
- 'Ile de France',
176
- 'France',
177
- '0101010110',
178
- ],
179
- ],
180
- },
181
- ]
182
- },
183
- computedPagination() {
184
- return {
185
- enabled: true,
186
- limit: Number(this.rowsPerPage),
187
- }
188
- },
189
- computedColumns() {
190
- return this.objectColumns.slice(0, this.numberOfColumns)
191
- },
192
- computedRows() {
193
- return this.objectRows
194
- },
195
- },
196
- methods: {
197
- testAlert() {
198
- this.$toaster.success({ title: 'Custom action on option row click' })
199
- },
200
- handleRightClick({ event }) {
201
- // Prevent event default here to hide default contextual menu
202
- // when right-click is not used, default menu is displayed
203
- event.preventDefault()
204
-
205
- document.addEventListener('click', this.documentClickHandler)
206
-
207
- const viewportWidth = window.innerWidth
208
- const mouseClickXPosition = event.clientX
209
- const mouseClickYPosition = event.clientY
210
- const isMenuDisplayable = mouseClickXPosition + 250 <= viewportWidth
211
- const computedXPosition = isMenuDisplayable ? event.clientX : event.clientX - 250
212
-
213
- // Set the position for menu
214
- this.$refs.menu.style.top = `${mouseClickYPosition}px`
215
- this.$refs.menu.style.left = `${computedXPosition}px`
216
-
217
- // Show the menu
218
- this.$refs.menu.classList.remove('hidden')
219
- },
220
- documentClickHandler(event) {
221
- const isClickedInside = this.$refs?.menu.contains(event.target)
222
- if (isClickedInside) return
223
-
224
- // Hide the menu
225
- this.$refs.menu.classList.add('hidden')
226
-
227
- // Remove the event handler
228
- document.removeEventListener('click', this.documentClickHandler)
229
- },
230
- },
231
- }
232
- </script>
233
-
234
- <style lang="scss">
235
- .sectionListAndTables {
236
- &__alertMessage {
237
- width: 100%;
238
-
239
- > *:not(:last-of-type) {
240
- margin-bottom: sp.$space;
241
- }
242
- }
243
-
244
- &__title {
245
- margin-bottom: sp.$space-lg;
246
- }
247
-
248
- &__menu {
249
- position: absolute;
250
- box-shadow:
251
- 0 9px 24px rgba(colors.$neutral-dark, 0.2),
252
- 0 4px 4px rgba(colors.$neutral-dark, 0.1);
253
- border: fn.px-to-rem(1) solid colors.$neutral-dark-4;
254
- border-radius: fn.px-to-rem(10);
255
- background-color: colors.$neutral-light;
256
- padding: sp.$space 0;
257
- min-width: 250px;
258
-
259
- li {
260
- padding: sp.$space sp.$space-md;
261
- }
262
- }
263
-
264
- .hidden {
265
- display: none;
266
- }
267
- }
268
- </style>
@@ -1,98 +0,0 @@
1
- <template>
2
- <section-container section-title="Select menu">
3
- <div class="item">
4
- <h3>Simple select menu without filter</h3>
5
- <span>selected value: {{ firstMenuSelectedValue }}</span>
6
- <cp-select-menu
7
- v-model:selected-value="firstMenuSelectedValue"
8
- :values="firstMenuSelectMenuValues"
9
- :selected-value="firstMenuSelectedValue"
10
- />
11
- </div>
12
- <div class="item">
13
- <h3>Select menu with title and filter</h3>
14
- <span>selected value: {{ secondMenuSelectedValue }}</span>
15
- <cp-select-menu
16
- v-model:selected-value="secondMenuSelectedValue"
17
- :values="secondMenuFilteredList"
18
- :selected-value="secondMenuSelectedValue"
19
- :has-filter="true"
20
- dropdown-title="Select value"
21
- dropdown-filter-placeholder="Search value..."
22
- dropdown-list-placeholder="No option found"
23
- @on-filter-change="filterValues"
24
- />
25
- </div>
26
- </section-container>
27
- </template>
28
-
29
- <script>
30
- import SectionContainer from '@/components/core/playground-sections/SectionContainer.vue'
31
-
32
- export default {
33
- components: {
34
- SectionContainer,
35
- },
36
- data() {
37
- return {
38
- firstMenuSelectedValue: {
39
- label: 'Banana',
40
- value: 'first_value',
41
- },
42
- firstMenuSelectMenuValues: [
43
- {
44
- label: 'Banana',
45
- value: 'first_value',
46
- },
47
- {
48
- label: 'Kiwi',
49
- value: 'second_value',
50
- },
51
- {
52
- label: 'Orange',
53
- value: 'third_value',
54
- },
55
- {
56
- label: 'Pineapple',
57
- value: 'fourth_value',
58
- },
59
- ],
60
- secondMenuSelectedValue: {
61
- label: 'Dog',
62
- value: 'first_value',
63
- },
64
- secondMenuSelectMenuValues: [
65
- {
66
- label: 'Dog',
67
- value: 'first_value',
68
- },
69
- {
70
- label: 'Cat',
71
- value: 'second_value',
72
- },
73
- {
74
- label: 'Snake',
75
- value: 'third_value',
76
- },
77
- {
78
- label: 'Dragon',
79
- value: 'fourth_value',
80
- },
81
- ],
82
- secondMenuFilterValue: '',
83
- }
84
- },
85
- computed: {
86
- secondMenuFilteredList() {
87
- return this.secondMenuSelectMenuValues.filter((menuValue) => {
88
- return menuValue.label.toLowerCase().includes(this.secondMenuFilterValue.toLowerCase())
89
- })
90
- },
91
- },
92
- methods: {
93
- filterValues(inputValue) {
94
- this.secondMenuFilterValue = inputValue
95
- },
96
- },
97
- }
98
- </script>
@@ -1,120 +0,0 @@
1
- <template>
2
- <section-container section-title="Selects" class="sectionSelects">
3
- <div class="sectionSelects__type">
4
- <cp-heading heading-level="h3" :size="600" class="sectionSelects__title">Default</cp-heading>
5
- <div class="sectionSelects__selects">
6
- <cp-select v-model="selects.default" label="Default select" :options="selects.options" />
7
- </div>
8
- </div>
9
- <div class="sectionSelects__type">
10
- <cp-heading heading-level="h3" :size="600" class="sectionSelects__title">Sizes</cp-heading>
11
- <div class="sectionSelects__selects">
12
- <cp-select
13
- v-model="selects.sizes"
14
- label="Select 18px font-sized"
15
- :options="selects.options"
16
- style="font-size: 18px"
17
- />
18
- <cp-select v-model="selects.sizes" label="Select 16px font-sized" :options="selects.options" />
19
- <cp-select
20
- v-model="selects.sizes"
21
- label="Select 14px font-sized"
22
- :options="selects.options"
23
- style="font-size: 14px"
24
- />
25
- <cp-select
26
- v-model="selects.sizes"
27
- label="Select 12px font-sized"
28
- :options="selects.options"
29
- style="font-size: 12px"
30
- />
31
- </div>
32
- </div>
33
- <div class="sectionSelects__type">
34
- <cp-heading heading-level="h3" :size="600" class="sectionSelects__title">Disabled</cp-heading>
35
- <div class="sectionSelects__selects">
36
- <cp-select v-model="selects.disabled" disabled label="Disabled select" :options="selects.options" />
37
- </div>
38
- </div>
39
- <div class="sectionSelects__type">
40
- <cp-heading heading-level="h3" :size="600" class="sectionSelects__title">With error</cp-heading>
41
- <div class="sectionSelects__selects">
42
- <cp-select v-model="selects.disabled" label="Select with error" :options="selects.options" is-invalid />
43
- <cp-select
44
- v-model="selects.disabled"
45
- label="Select with error message"
46
- :options="selects.options"
47
- is-invalid
48
- error-message="This select has an error message"
49
- />
50
- <cp-select
51
- v-model="selects.disabled"
52
- disabled
53
- label="Disabled select with error"
54
- :options="selects.options"
55
- is-invalid
56
- error-message="This select has an error message"
57
- />
58
- </div>
59
- </div>
60
- <div class="sectionSelects__type">
61
- <cp-heading heading-level="h3" :size="600" class="sectionSelects__title">Large</cp-heading>
62
- <div class="sectionSelects__selects">
63
- <cp-select v-model="selects.large" is-large label="Select with error" :options="selects.options" is-invalid />
64
- </div>
65
- </div>
66
- </section-container>
67
- </template>
68
-
69
- <script>
70
- import SectionContainer from './SectionContainer.vue'
71
-
72
- export default {
73
- components: {
74
- SectionContainer,
75
- },
76
- data() {
77
- return {
78
- selects: {
79
- default: '',
80
- sizes: '',
81
- disabled: '',
82
- large: '',
83
- error: '',
84
- options: [
85
- {
86
- label: 'very very long option 1',
87
- value: 'first_option',
88
- },
89
- {
90
- label: 'option 2',
91
- value: 'second_option',
92
- },
93
- {
94
- label: 'option 3',
95
- value: 'third_option',
96
- },
97
- ],
98
- },
99
- }
100
- },
101
- }
102
- </script>
103
-
104
- <style lang="scss">
105
- .sectionSelects {
106
- &__title {
107
- margin-bottom: sp.$space-lg;
108
- }
109
-
110
- &__selects {
111
- display: flex;
112
- align-items: flex-end;
113
- flex-wrap: wrap;
114
-
115
- > * {
116
- margin: 0 sp.$space-lg sp.$space-lg 0;
117
- }
118
- }
119
- }
120
- </style>