@nethserver/ns8-ui-lib 0.0.46 → 0.0.50

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": "@nethserver/ns8-ui-lib",
3
- "version": "0.0.46",
3
+ "version": "0.0.50",
4
4
  "description": "Vue.js library for NethServer 8 UI",
5
5
  "keywords": [
6
6
  "nethserver",
@@ -14,7 +14,7 @@
14
14
  <slot name="pictogram"></slot>
15
15
  </template>
16
16
  <template v-else>
17
- <ExclamationMark />
17
+ <ExclamationMarkPictogram />
18
18
  </template>
19
19
  </NsPictogram>
20
20
  <h5 class="title">{{ title }}</h5>
@@ -30,11 +30,11 @@
30
30
  <script>
31
31
  import NsPictogram from "./NsPictogram.vue";
32
32
  import NsLottieAnimation from "./NsLottieAnimation";
33
- import ExclamationMark from "./pictograms/ExclamationMark";
33
+ import ExclamationMarkPictogram from "./pictograms/ExclamationMarkPictogram";
34
34
 
35
35
  export default {
36
36
  name: "NsEmptyState",
37
- components: { NsPictogram, ExclamationMark, NsLottieAnimation },
37
+ components: { NsPictogram, ExclamationMarkPictogram, NsLottieAnimation },
38
38
  props: {
39
39
  title: {
40
40
  type: String,
@@ -1,38 +1,57 @@
1
1
  <template>
2
2
  <cv-tile kind="standard" :light="light" class="info-card">
3
3
  <!-- overflow menu -->
4
- <slot v-if="showOverflowMenu" name="menu"></slot>
4
+ <slot v-if="hasMenuSlot" name="menu"></slot>
5
5
  <!-- icon -->
6
6
  <div v-if="icon" class="row">
7
7
  <NsSvg :svg="icon" />
8
8
  </div>
9
- <div class="row">
10
- <h3 class="title">{{ title }}</h3>
9
+ <div v-if="isErrorShown" class="row">
10
+ <NsInlineNotification
11
+ kind="error"
12
+ :title="errorTitle"
13
+ :description="errorDescription"
14
+ :showCloseButton="false"
15
+ />
11
16
  </div>
12
- <div v-if="description" class="row">
13
- <div class="description">{{ description }}</div>
17
+ <div v-else-if="loading" class="row">
18
+ <cv-skeleton-text
19
+ :paragraph="true"
20
+ :line-count="3"
21
+ class="skeleton"
22
+ ></cv-skeleton-text>
14
23
  </div>
24
+ <template v-else>
25
+ <div v-if="title" class="row">
26
+ <h3 class="title">{{ title }}</h3>
27
+ </div>
28
+ <div v-if="description" class="row">
29
+ <div class="description">{{ description }}</div>
30
+ </div>
31
+ </template>
15
32
  <div class="row slot">
16
33
  <!-- Extra content -->
17
- <slot name="content"></slot>
34
+ <slot v-if="hasContentSlot" name="content"></slot>
18
35
  </div>
19
36
  </cv-tile>
20
37
  </template>
21
38
 
22
39
  <script>
23
40
  import NsSvg from "./NsSvg.vue";
24
- import { CvTile } from "@carbon/vue";
41
+ import NsInlineNotification from "./NsInlineNotification.vue";
25
42
 
26
43
  export default {
27
44
  name: "NsInfoCard",
28
- //components added for storybook to work
29
- components: { NsSvg, CvTile },
45
+ components: { NsSvg, NsInlineNotification },
30
46
  props: {
31
47
  title: {
32
48
  type: String,
33
- required: true,
49
+ required: false,
50
+ },
51
+ description: {
52
+ type: String,
53
+ required: false,
34
54
  },
35
- description: String,
36
55
  icon: {
37
56
  type: [String, Object],
38
57
  default: undefined,
@@ -43,12 +62,20 @@ export default {
43
62
  return val.render !== null;
44
63
  },
45
64
  },
46
- showOverflowMenu: {
47
- type: Boolean,
48
- default: false,
49
- },
65
+ loading: Boolean,
66
+ isErrorShown: false,
67
+ errorTitle: String,
68
+ errorDescription: String,
50
69
  light: Boolean,
51
70
  },
71
+ computed: {
72
+ hasMenuSlot() {
73
+ return !!this.$slots.menu;
74
+ },
75
+ hasContentSlot() {
76
+ return !!this.$slots.content;
77
+ },
78
+ },
52
79
  };
53
80
  </script>
54
81
 
@@ -62,6 +89,12 @@ export default {
62
89
  position: relative;
63
90
  }
64
91
 
92
+ .skeleton {
93
+ margin-top: 0.5rem;
94
+ margin-left: auto;
95
+ margin-right: auto;
96
+ }
97
+
65
98
  .row {
66
99
  display: flex;
67
100
  align-items: center;
@@ -50,6 +50,7 @@
50
50
  `${carbonPrefix}--btn`,
51
51
  `${carbonPrefix}--btn--sm`,
52
52
  `${carbonPrefix}--btn--ghost`,
53
+ 'action-button',
53
54
  ]"
54
55
  type="button"
55
56
  >
@@ -118,6 +119,10 @@ export default {
118
119
  flex-grow: 0;
119
120
  }
120
121
 
122
+ .action-button {
123
+ margin-right: 0.5rem;
124
+ }
125
+
121
126
  // place close button on the right
122
127
  .bx--inline-notification__close-button {
123
128
  position: absolute !important;
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <cv-side-nav-divider />
3
+ </template>
4
+
5
+ <script>
6
+ import CvSideNavDivider from "@carbon/vue/src/components/cv-ui-shell/cv-side-nav-divider.vue";
7
+
8
+ export default {
9
+ name: "NsMenuDivider",
10
+ components: { CvSideNavDivider },
11
+ };
12
+ </script>
13
+
14
+ <style scoped lang="scss"></style>
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <div class="ns-menu-item">
3
+ <span v-if="icon == 'edit'" class="icon"><Edit20 /></span>
4
+ <span v-else-if="icon == 'trash'" class="icon"><TrashCan20 /></span>
5
+ <span v-else-if="icon == 'power'" class="icon"><Power20 /></span>
6
+ <span v-else-if="icon == 'rocket'" class="icon"><Rocket20 /></span>
7
+ <span v-else-if="icon == 'launch'" class="icon"><Launch20 /></span>
8
+ <span v-else-if="icon == 'star'" class="icon"><Star20 /></span>
9
+ <span v-else-if="hasIconSlot" class="icon">
10
+ <slot name="icon"></slot>
11
+ </span>
12
+ <span>{{ label }}</span>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import Edit20 from "@carbon/icons-vue/es/edit/20";
18
+ import TrashCan20 from "@carbon/icons-vue/es/trash-can/20";
19
+ import Power20 from "@carbon/icons-vue/es/power/20";
20
+ import Rocket20 from "@carbon/icons-vue/es/rocket/20";
21
+ import Launch20 from "@carbon/icons-vue/es/launch/20";
22
+ import Star20 from "@carbon/icons-vue/es/star/20";
23
+
24
+ export default {
25
+ name: "NsMenuItem",
26
+ components: { Edit20, TrashCan20, Power20, Rocket20, Launch20, Star20 },
27
+ props: {
28
+ label: {
29
+ type: String,
30
+ required: true,
31
+ },
32
+ icon: {
33
+ type: String,
34
+ validator: (value) =>
35
+ ["", "edit", "trash", "power", "rocket", "launch", "star"].includes(
36
+ value
37
+ ),
38
+ },
39
+ },
40
+ computed: {
41
+ hasIconSlot() {
42
+ return !!this.$slots.icon;
43
+ },
44
+ },
45
+ };
46
+ </script>
47
+
48
+ <style scoped lang="scss">
49
+ .ns-menu-item {
50
+ display: flex;
51
+ align-items: center;
52
+ }
53
+
54
+ .icon {
55
+ margin-right: 0.5rem;
56
+ }
57
+ </style>
@@ -21,35 +21,55 @@
21
21
  <span
22
22
  :class="[
23
23
  'requirement',
24
- { 'requirement-ok': isLengthOk, 'requirement-light': light },
24
+ {
25
+ 'requirement-ok': isLengthOk,
26
+ 'requirement-light': light,
27
+ 'requirement-disabled': disabled,
28
+ },
25
29
  ]"
26
30
  >{{ lengthLabel }}</span
27
31
  >
28
32
  <span
29
33
  :class="[
30
34
  'requirement',
31
- { 'requirement-ok': isLowercaseOk, 'requirement-light': light },
35
+ {
36
+ 'requirement-ok': isLowercaseOk,
37
+ 'requirement-light': light,
38
+ 'requirement-disabled': disabled,
39
+ },
32
40
  ]"
33
41
  >{{ lowercaseLabel }}</span
34
42
  >
35
43
  <span
36
44
  :class="[
37
45
  'requirement',
38
- { 'requirement-ok': isUppercaseOk, 'requirement-light': light },
46
+ {
47
+ 'requirement-ok': isUppercaseOk,
48
+ 'requirement-light': light,
49
+ 'requirement-disabled': disabled,
50
+ },
39
51
  ]"
40
52
  >{{ uppercaseLabel }}</span
41
53
  >
42
54
  <span
43
55
  :class="[
44
56
  'requirement',
45
- { 'requirement-ok': isNumberOk, 'requirement-light': light },
57
+ {
58
+ 'requirement-ok': isNumberOk,
59
+ 'requirement-light': light,
60
+ 'requirement-disabled': disabled,
61
+ },
46
62
  ]"
47
63
  >{{ numberLabel }}</span
48
64
  >
49
65
  <span
50
66
  :class="[
51
67
  'requirement',
52
- { 'requirement-ok': isSymbolOk, 'requirement-light': light },
68
+ {
69
+ 'requirement-ok': isSymbolOk,
70
+ 'requirement-light': light,
71
+ 'requirement-disabled': disabled,
72
+ },
53
73
  ]"
54
74
  >{{ symbolLabel }}</span
55
75
  >
@@ -75,7 +95,11 @@
75
95
  <span
76
96
  :class="[
77
97
  'requirement',
78
- { 'requirement-ok': isEqualOk, 'requirement-light': light },
98
+ {
99
+ 'requirement-ok': isEqualOk,
100
+ 'requirement-light': light,
101
+ 'requirement-disabled': disabled,
102
+ },
79
103
  ]"
80
104
  >{{ equalLabel }}</span
81
105
  >
@@ -263,4 +287,9 @@ export default {
263
287
  color: white;
264
288
  background-color: #198038;
265
289
  }
290
+
291
+ .requirement-disabled {
292
+ color: #c6c6c6;
293
+ background-color: #f4f4f4;
294
+ }
266
295
  </style>
@@ -24,7 +24,7 @@
24
24
  <cv-interactive-tooltip
25
25
  :alignment="tooltipAlignment"
26
26
  :direction="tooltipDirection"
27
- class="tooltip"
27
+ class="tooltip info"
28
28
  >
29
29
  <template slot="content">
30
30
  <slot name="tooltip"></slot>
@@ -6,6 +6,7 @@
6
6
  { [`${carbonPrefix}--tile--light`]: isLight },
7
7
  'ns-tile',
8
8
  { 'pad-bottom': footerIcon },
9
+ { 'disabled-tile': disabled },
9
10
  ]"
10
11
  :checked="selected"
11
12
  :expanded="expanded"
@@ -75,9 +76,15 @@ export default {
75
76
  centered: Boolean,
76
77
  large: Boolean,
77
78
  light: Boolean,
79
+ disabled: Boolean,
78
80
  },
79
81
  computed: {
80
82
  tagType() {
83
+ if (this.disabled) {
84
+ // not selectable nor clickable
85
+ return "cv-tile-standard";
86
+ }
87
+
81
88
  switch (this.kind) {
82
89
  case "clickable":
83
90
  return "cv-tile-clickable";
@@ -129,4 +136,8 @@ export default {
129
136
  .pad-bottom {
130
137
  padding-bottom: 4rem;
131
138
  }
139
+
140
+ .disabled-tile {
141
+ color: #c6c6c6;
142
+ }
132
143
  </style>