webcake-ui-kit 1.2.4 → 1.2.6

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": "webcake-ui-kit",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "UI Kit for Vue 2 && 3 - Pure Options API",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -40,6 +40,7 @@
40
40
  "./WkInputCounter": "./src/components/input-counter/InputCounter.vue",
41
41
  "./WkInputNumber": "./src/components/input-number/InputNumber.vue",
42
42
  "./WkMenu": "./src/components/menu/Menu.vue",
43
+ "./WkMenuItem": "./src/components/menuitem/MenuItem.vue",
43
44
  "./WkPagination": "./src/components/pagination/Pagination.vue",
44
45
  "./WkPopover": "./src/components/popover/Popover.vue",
45
46
  "./WkProgress": "./src/components/progress/Progress.vue",
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <div
3
+ class="ui-menuitem"
4
+ :class="{
5
+ 'ui-menuitem--active': active,
6
+ 'ui-menuitem--disabled': disabled,
7
+ 'ui-menuitem--error': type === 'error',
8
+ [`ui-menuitem--${size}`]: size
9
+ }"
10
+ :title="label"
11
+ @click="handleClick"
12
+ >
13
+ <span v-if="$slots.prefix" class="ui-menuitem__prefix">
14
+ <slot name="prefix"></slot>
15
+ </span>
16
+ <span class="ui-menuitem__label">{{ label }}</span>
17
+ <span v-if="$slots.suffix" class="ui-menuitem__suffix">
18
+ <slot name="suffix"></slot>
19
+ </span>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ export default {
25
+ name: 'MenuItem',
26
+
27
+ props: {
28
+ type: {
29
+ type: String,
30
+ default: 'default',
31
+ validator: function (value) {
32
+ return ['default', 'error'].indexOf(value) !== -1
33
+ }
34
+ },
35
+ active: {
36
+ type: Boolean,
37
+ default: false
38
+ },
39
+ disabled: {
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ value: {
44
+ type: String,
45
+ default: null
46
+ },
47
+ label: {
48
+ type: String,
49
+ required: true
50
+ },
51
+ size: {
52
+ type: String,
53
+ default: 'md',
54
+ validator: function (value) {
55
+ return ['sm', 'md', 'lg'].indexOf(value) !== -1
56
+ }
57
+ }
58
+ },
59
+
60
+ emits: ['click'],
61
+
62
+ methods: {
63
+ handleClick() {
64
+ if (!this.disabled) {
65
+ this.$emit('click', this.value)
66
+ }
67
+ }
68
+ }
69
+ }
70
+ </script>
71
+
72
+ <style src="./menuitem.css" scoped></style>
@@ -0,0 +1,104 @@
1
+ .ui-menuitem {
2
+ display: flex;
3
+ align-items: center;
4
+ border-radius: var(--radius-8, 8px);
5
+ font-family: var(--font-family-body);
6
+ font-size: var(--paragraph-small-font-size);
7
+ line-height: var(--paragraph-small-line-height);
8
+ color: var(--primary-fg);
9
+ cursor: pointer;
10
+ user-select: none;
11
+ transition: background 0.1s;
12
+ }
13
+
14
+ .ui-menuitem:hover:not(.ui-menuitem--disabled) {
15
+ background: var(--accent-bg);
16
+ }
17
+
18
+ .ui-menuitem--active {
19
+ background: var(--accent-2);
20
+ font-weight: var(--paragraph-medium-font-weight);
21
+ }
22
+
23
+ .ui-menuitem--disabled {
24
+ opacity: 0.4;
25
+ cursor: not-allowed;
26
+ pointer-events: none;
27
+ }
28
+
29
+ .ui-menuitem--error {
30
+ color: var(--destructive-text);
31
+ }
32
+
33
+ .ui-menuitem--error:hover {
34
+ background: var(--destructive-subtle) !important;
35
+ }
36
+
37
+ .ui-menuitem--error.ui-menuitem--active {
38
+ background: var(--destructive-subtle) !important;
39
+ }
40
+
41
+ /* Sizes */
42
+
43
+ .ui-menuitem--sm {
44
+ height: 28px;
45
+ padding: var(--spacing-2xs) var(--spacing-xs);
46
+ gap: var(--spacing-xs);
47
+ font-size: var(--paragraph-mini-font-size);
48
+ line-height: var(--paragraph-mini-line-height);
49
+ }
50
+
51
+ .ui-menuitem--md {
52
+ height: 32px;
53
+ padding: var(--spacing-5p5) var(--spacing-xs);
54
+ gap: var(--spacing-xs);
55
+ }
56
+
57
+ .ui-menuitem--lg {
58
+ height: 36px;
59
+ padding: var(--spacing-7p5) var(--spacing-sm);
60
+ gap: var(--spacing-sm);
61
+ }
62
+
63
+ /* Slots */
64
+
65
+ .ui-menuitem__prefix {
66
+ display: inline-flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ flex-shrink: 0;
70
+ overflow: hidden;
71
+ width: 20px;
72
+ height: 20px;
73
+ }
74
+
75
+ .ui-menuitem--sm .ui-menuitem__prefix {
76
+ width: 16px;
77
+ height: 16px;
78
+ }
79
+
80
+ .ui-menuitem__label {
81
+ flex: 1;
82
+ min-width: 0;
83
+ overflow: hidden;
84
+ text-overflow: ellipsis;
85
+ white-space: nowrap;
86
+ }
87
+
88
+ .ui-menuitem__suffix {
89
+ display: inline-flex;
90
+ align-items: center;
91
+ justify-content: center;
92
+ font-size: var(--paragraph-small-font-size);
93
+ line-height: var(--paragraph-small-line-height);
94
+ color: var(--muted-fg);
95
+ flex-shrink: 0;
96
+ margin-left: auto;
97
+ padding-left: var(--spacing-sm);
98
+ white-space: nowrap;
99
+ }
100
+
101
+ .ui-menuitem--sm .ui-menuitem__suffix {
102
+ font-size: var(--paragraph-mini-font-size);
103
+ line-height: var(--paragraph-mini-line-height);
104
+ }
package/src/index.js CHANGED
@@ -22,6 +22,7 @@ export { default as WkInput } from './components/input/Input.vue'
22
22
  export { default as WkInputCounter } from './components/input-counter/InputCounter.vue'
23
23
  export { default as WkInputNumber } from './components/input-number/InputNumber.vue'
24
24
  export { default as WkMenu } from './components/menu/Menu.vue'
25
+ export { default as WkMenuItem } from './components/menuitem/MenuItem.vue'
25
26
  export { default as WkPagination } from './components/pagination/Pagination.vue'
26
27
  export { default as WkPopover } from './components/popover/Popover.vue'
27
28
  export { default as WkProgress } from './components/progress/Progress.vue'