@appscode/design-system 2.5.9 → 2.5.11

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appscode/design-system",
3
- "version": "2.5.9",
3
+ "version": "2.5.11",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -8,8 +8,10 @@ import HeroiconsPencilSquare from "~icons/heroicons/pencil-square";
8
8
  import HeroiconsTrash from "~icons/heroicons/trash";
9
9
  import HeroiconsChevronDownSolid from "~icons/heroicons/chevron-down-solid";
10
10
  import HeroiconsChevronUpSolid from "~icons/heroicons/chevron-up-solid";
11
+ import AcButton from "../button/Button.vue";
11
12
 
12
13
  interface Props {
14
+ isButtonsDisabled?: boolean;
13
15
  disabled?: boolean;
14
16
  isCreateDisabled?: boolean;
15
17
  label: string;
@@ -25,9 +27,13 @@ interface Props {
25
27
  saveNewItem?: Function;
26
28
  onDeleteItem: Function;
27
29
  initiallyHidden?: boolean;
30
+ showCustomMessage?: boolean;
31
+ buttonLabel?: string;
32
+ formLabel?: string;
28
33
  }
29
34
 
30
35
  const prop = withDefaults(defineProps<Props>(), {
36
+ isButtonsDisabled: false,
31
37
  disabled: false,
32
38
  isCreateDisabled: false,
33
39
  label: "",
@@ -42,6 +48,9 @@ const prop = withDefaults(defineProps<Props>(), {
42
48
  saveEditedItem: () => () => ({}),
43
49
  onDeleteItem: () => () => ({}),
44
50
  initiallyHidden: false,
51
+ showCustomMessage: false,
52
+ buttonLabel: "Add New",
53
+ formLabel: "",
45
54
  });
46
55
 
47
56
  const Accordion = defineAsyncComponent(() => import("./Accordion.vue"));
@@ -98,12 +107,12 @@ function collapseForm() {
98
107
  </script>
99
108
 
100
109
  <template>
101
- <div :class="{ 'ac-nested-elements': label }">
110
+ <div>
102
111
  <!-- Add New Form Start -->
103
112
  <template v-if="isSavingNewElement">
104
- <div class="is-flex is-aligned-item-center is-justify-content-space-between">
113
+ <div class="is-flex is-align-items-center is-justify-content-space-between">
105
114
  <accordion
106
- :label="`New ${label}`"
115
+ :label="formLabel || `New ${label}`"
107
116
  :isCollapsible="isCollapsible"
108
117
  :isRequired="isRequired"
109
118
  :errors="errors"
@@ -112,24 +121,25 @@ function collapseForm() {
112
121
  />
113
122
  <div class="buttons pb-5">
114
123
  <!-- save button start -->
115
- <button
116
- class="button ac-button is-small is-primary is-light"
124
+ <ac-button
125
+ modifier-classes="is-small is-primary"
117
126
  :disabled="disabled ? true : false"
118
127
  data-testid="single-step-form-array-item-save-button"
119
- title="Save"
120
128
  @click.prevent="onSaveItem()"
129
+ title="Save"
130
+ icon-class="unplugin"
121
131
  >
122
- <span class="icon"><FluentSave28Regular /></span>
123
- </button>
132
+ <template #icon> <FluentSave28Regular /> </template>
133
+ </ac-button>
124
134
  <!-- save button end -->
125
135
  <!-- CLOSE button start -->
126
- <button
127
- class="button ac-button is-small is-danger is-light"
136
+ <ac-button
137
+ modifier-classes="is-small is-light is-danger"
128
138
  data-testid="single-step-form-array-item-close-button"
129
139
  @click.prevent="resetAllData()"
130
140
  >
131
141
  <span class="icon"><HeroiconsXMark20Solid /></span>
132
- </button>
142
+ </ac-button>
133
143
  <!-- CLOSE button end -->
134
144
  </div>
135
145
  </div>
@@ -146,7 +156,7 @@ function collapseForm() {
146
156
 
147
157
  <!-- Label and Add New Button Start -->
148
158
  <template v-else>
149
- <div class="is-flex is-aligned-item-center is-justify-content-space-between">
159
+ <div class="is-flex is-align-items-center is-justify-content-space-between">
150
160
  <accordion
151
161
  :label="label"
152
162
  :isCollapsible="isCollapsible"
@@ -155,14 +165,14 @@ function collapseForm() {
155
165
  :isFormHidden="isFormHidden"
156
166
  @click="collapseForm()"
157
167
  />
158
- <button
159
- v-if="!disabled && !isCreateDisabled"
160
- class="button ac-button is-primary is-light is-outlined"
168
+ <ac-button
169
+ v-if="!isButtonsDisabled && !isCreateDisabled"
170
+ modifier-classes="is-primary is-small"
161
171
  data-testid="single-step-form-array-item-create-button"
162
172
  @click.prevent="onAddClick()"
163
173
  >
164
- <span class="icon"><HeroiconsPlus /> </span><span>Add New</span>
165
- </button>
174
+ <span class="icon"><HeroiconsPlus /> </span><span>{{ buttonLabel }}</span>
175
+ </ac-button>
166
176
  </div>
167
177
  <!-- Label and Add New Button End -->
168
178
 
@@ -175,8 +185,8 @@ function collapseForm() {
175
185
  >
176
186
  <!-- existing element start -->
177
187
 
178
- <div v-if="dataForTable.length" class="ac-table-container table-container my-4">
179
- <table class="table ac-table ac-striped is-fullwidth" data-testid="ac-table">
188
+ <div v-if="dataForTable.length" class="ac-table-container table-container my-2">
189
+ <table class="table ac-table ac-striped is-fullwidth b-1" data-testid="ac-table">
180
190
  <thead>
181
191
  <tr>
182
192
  <th v-for="(item, idx) in tableHeaders" :key="idx + item.name">
@@ -199,37 +209,34 @@ function collapseForm() {
199
209
  <!-- Action Buttons Start -->
200
210
  <td>
201
211
  <div class="buttons is-justify-content-flex-end">
202
- <button
203
- v-if="!disabled && isEditable"
204
- class="button ac-button has-text-primary is-small"
205
- title="Edit"
212
+ <ac-button
213
+ v-if="!isButtonsDisabled && isEditable"
214
+ modifier-classes="is-small is-light is-primary"
206
215
  data-testid="single-step-form-array-item-edit-button"
207
216
  @click.prevent="onEditClick(idxRow)"
208
217
  >
209
218
  <span class="icon"> <HeroiconsPencilSquare /> </span>
210
- </button>
219
+ </ac-button>
211
220
 
212
- <button
213
- v-if="!disabled"
214
- title="Delete"
215
- class="button ac-button has-text-danger is-small"
221
+ <ac-button
222
+ v-if="!isButtonsDisabled"
223
+ modifier-classes="is-small is-light is-danger"
216
224
  data-testid="single-step-form-array-item-delete-button"
217
225
  @click.prevent="onDeleteItem(idxRow)"
218
226
  >
219
227
  <span class="icon"> <HeroiconsTrash /> </span>
220
- </button>
228
+ </ac-button>
221
229
 
222
- <button
230
+ <ac-button
223
231
  v-if="isExpandable"
224
- class="button ac-button is-small"
225
- title="Expand"
232
+ modifier-classes="is-small is-light"
226
233
  data-testid="single-step-form-array-item-show-details-button"
227
234
  @click.prevent="onDetailsClick(idxRow)"
228
235
  >
229
236
  <span v-if="expandableFieldIndex === idxRow" class="icon"><HeroiconsChevronUpSolid /></span>
230
237
 
231
238
  <span v-else class="icon"><HeroiconsChevronDownSolid /></span>
232
- </button>
239
+ </ac-button>
233
240
  </div>
234
241
  </td>
235
242
  <!-- Action Button End -->
@@ -238,27 +245,29 @@ function collapseForm() {
238
245
  <tr v-if="editFieldIndex === idxRow" style="background-color: #f8f8f8">
239
246
  <td :colspan="itemRow.cells.length + 1">
240
247
  <!-- nested elements start -->
241
- <div class="mt-15 mb-15 is-flex is-aligned-item-center is-justify-content-space-between">
248
+ <div class="mt-15 mb-15 is-flex is-align-items-center is-justify-content-space-between">
242
249
  <accordion :label="`Edit ${label}`" :is-collapsible="false" />
243
250
  <div class="buttons pb-5">
244
251
  <!-- save button start -->
245
- <button
246
- class="button ac-button is-small is-outlined is-light is-primary"
252
+ <ac-button
253
+ modifier-classes="is-small is-primary"
247
254
  :disabled="disabled ? true : false"
248
255
  data-testid="single-step-form-array-item-save-button"
249
256
  @click.prevent="onSaveEditedItem(idxRow)"
257
+ icon-class="unplugin"
258
+ title="Save"
250
259
  >
251
- <span class="icon"> <FluentSave28Regular /> </span>
252
- </button>
260
+ <template #icon> <FluentSave28Regular /> </template>
261
+ </ac-button>
253
262
  <!-- save button end -->
254
263
  <!-- close button start -->
255
- <button
256
- class="button ac-button is-small is-outlined is-light is-danger"
264
+ <ac-button
265
+ modifier-classes="is-small is-danger is-light"
257
266
  data-testid="single-step-form-array-item-close-button"
258
267
  @click.prevent="resetAllData()"
259
268
  >
260
269
  <span class="icon"> <HeroiconsXMark20Solid /> </span>
261
- </button>
270
+ </ac-button>
262
271
  <!-- close button end -->
263
272
  </div>
264
273
  </div>
@@ -281,7 +290,8 @@ function collapseForm() {
281
290
  </table>
282
291
  </div>
283
292
  <div v-else class="label-action is-flex is-flex-wrap-wrap mb-5">
284
- <strong> No Item Found. </strong>
293
+ <slot v-if="showCustomMessage" name="custom-message" />
294
+ <strong v-else> No Item Found. </strong>
285
295
  </div>
286
296
  <!-- existing element end -->
287
297
  </div>
@@ -289,3 +299,11 @@ function collapseForm() {
289
299
  </template>
290
300
  </div>
291
301
  </template>
302
+ <style lang="scss">
303
+ .ac-striped {
304
+ &.table thead td,
305
+ &.table thead th {
306
+ border-width: 0 0 1px;
307
+ }
308
+ }
309
+ </style>