@bethinkpl/design-system 20.0.1 → 20.1.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.
- package/.github/workflows/build-to-review-on-trigger.yml +68 -0
- package/.yarnrc.yml +1 -0
- package/docs/project.json +1 -1
- package/lib/js/components/RichList/{RichListItemBasic/RichListItemBasic.stories.ts → BasicRichListItem/BasicRichListItem.stories.ts} +51 -17
- package/lib/js/components/RichList/{RichListItemBasic/RichListItemBasic.vue → BasicRichListItem/BasicRichListItem.vue} +90 -16
- package/lib/js/components/RichList/BasicRichListItem/index.ts +3 -0
- package/lib/js/components/RichList/GroupRichListItem/GroupRichListItem.consts.ts +18 -0
- package/lib/js/components/RichList/GroupRichListItem/GroupRichListItem.stories.ts +337 -0
- package/lib/js/components/RichList/{RichListGroupItem/RichListGroupItem.vue → GroupRichListItem/GroupRichListItem.vue} +63 -16
- package/lib/js/components/RichList/GroupRichListItem/index.ts +4 -0
- package/lib/js/components/RichList/RichListItem/RichListItem.consts.ts +15 -18
- package/lib/js/components/RichList/RichListItem/RichListItem.stories.ts +42 -12
- package/lib/js/components/RichList/RichListItem/RichListItem.vue +242 -84
- package/lib/js/index.ts +2 -2
- package/lib/styles/mixins/_scrollbars.scss +9 -0
- package/package.json +1 -1
- package/lib/js/components/RichList/RichListGroupItem/RichListGroupItem.consts.ts +0 -7
- package/lib/js/components/RichList/RichListGroupItem/RichListGroupItem.stories.ts +0 -327
- package/lib/js/components/RichList/RichListGroupItem/index.ts +0 -4
- package/lib/js/components/RichList/RichListItemBasic/index.ts +0 -3
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import GroupRichListItem from './GroupRichListItem.vue';
|
|
2
|
+
import RichListItem, {
|
|
3
|
+
RICH_LIST_ITEM_ELEVATION,
|
|
4
|
+
RICH_LIST_ITEM_SIZE,
|
|
5
|
+
RICH_LIST_ITEM_STATE,
|
|
6
|
+
RICH_LIST_ITEM_TYPE,
|
|
7
|
+
} from '../RichListItem';
|
|
8
|
+
import Divider from '../../Divider';
|
|
9
|
+
|
|
10
|
+
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
|
|
11
|
+
import {
|
|
12
|
+
GROUP_RICH_LIST_ITEM_BACKGROUND_COLOR,
|
|
13
|
+
GROUP_RICH_LIST_ITEM_BORDER_COLOR,
|
|
14
|
+
} from './GroupRichListItem.consts';
|
|
15
|
+
import { ICON_COLORS, ICONS } from '../../Icons/Icon';
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
title: 'Components/RichList/GroupRichListItem',
|
|
19
|
+
component: GroupRichListItem,
|
|
20
|
+
decorators: [
|
|
21
|
+
(story) => ({
|
|
22
|
+
template: `<div style="display: flex;padding: 16px;"><story/></div>`,
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
} as Meta<typeof GroupRichListItem>;
|
|
26
|
+
|
|
27
|
+
const args = {
|
|
28
|
+
isExpanded: false,
|
|
29
|
+
borderColor: null,
|
|
30
|
+
borderColorHex: '',
|
|
31
|
+
backgroundColor: GROUP_RICH_LIST_ITEM_BACKGROUND_COLOR.NEUTRAL,
|
|
32
|
+
|
|
33
|
+
// RLI
|
|
34
|
+
parent_size: RICH_LIST_ITEM_SIZE.MEDIUM,
|
|
35
|
+
parent_elevation: null,
|
|
36
|
+
parent_isDimmed: false,
|
|
37
|
+
parent_hasDraggableHandler: true,
|
|
38
|
+
parent_icon: null,
|
|
39
|
+
parent_iconColor: ICON_COLORS.NEUTRAL_WEAK,
|
|
40
|
+
parent_iconColorHex: '',
|
|
41
|
+
parent_hasActionsSlotDivider: true,
|
|
42
|
+
parent_isSelectable: true,
|
|
43
|
+
parent_isSelected: true,
|
|
44
|
+
parent_state: RICH_LIST_ITEM_STATE.DEFAULT,
|
|
45
|
+
parent_isInteractive: true,
|
|
46
|
+
|
|
47
|
+
child_size: RICH_LIST_ITEM_SIZE.MEDIUM,
|
|
48
|
+
child_elevation: null,
|
|
49
|
+
child_isDimmed: false,
|
|
50
|
+
child_hasDraggableHandler: true,
|
|
51
|
+
child_icon: null,
|
|
52
|
+
child_iconColor: ICON_COLORS.NEUTRAL_WEAK,
|
|
53
|
+
child_iconColorHex: '',
|
|
54
|
+
child_hasActionsSlotDivider: true,
|
|
55
|
+
child_isSelectable: true,
|
|
56
|
+
child_isSelected: true,
|
|
57
|
+
child_state: RICH_LIST_ITEM_STATE.DEFAULT,
|
|
58
|
+
child_isInteractive: true,
|
|
59
|
+
} as Args;
|
|
60
|
+
|
|
61
|
+
const argTypes = {
|
|
62
|
+
borderColor: {
|
|
63
|
+
options: [null, ...Object.values(GROUP_RICH_LIST_ITEM_BORDER_COLOR)],
|
|
64
|
+
control: { type: 'select' },
|
|
65
|
+
},
|
|
66
|
+
borderColorHex: {
|
|
67
|
+
control: { type: 'text' },
|
|
68
|
+
},
|
|
69
|
+
backgroundColor: {
|
|
70
|
+
options: Object.values(GROUP_RICH_LIST_ITEM_BACKGROUND_COLOR),
|
|
71
|
+
control: { type: 'select' },
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
parent_state: {
|
|
75
|
+
options: Object.values(RICH_LIST_ITEM_STATE),
|
|
76
|
+
control: { type: 'select' },
|
|
77
|
+
},
|
|
78
|
+
parent_size: {
|
|
79
|
+
options: Object.values(RICH_LIST_ITEM_SIZE),
|
|
80
|
+
control: { type: 'select' },
|
|
81
|
+
},
|
|
82
|
+
parent_iconColor: {
|
|
83
|
+
options: Object.values(ICON_COLORS),
|
|
84
|
+
control: { type: 'select' },
|
|
85
|
+
},
|
|
86
|
+
parent_icon: {
|
|
87
|
+
options: [null, ...Object.keys(ICONS)],
|
|
88
|
+
control: { type: 'select' },
|
|
89
|
+
},
|
|
90
|
+
parent_iconColorHex: {
|
|
91
|
+
control: { type: 'text' },
|
|
92
|
+
},
|
|
93
|
+
parent_elevation: {
|
|
94
|
+
options: [null, ...Object.values(RICH_LIST_ITEM_ELEVATION)],
|
|
95
|
+
control: { type: 'select' },
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
child_state: {
|
|
99
|
+
options: Object.values(RICH_LIST_ITEM_STATE),
|
|
100
|
+
control: { type: 'select' },
|
|
101
|
+
},
|
|
102
|
+
child_size: {
|
|
103
|
+
options: Object.values(RICH_LIST_ITEM_SIZE),
|
|
104
|
+
control: { type: 'select' },
|
|
105
|
+
},
|
|
106
|
+
child_iconColor: {
|
|
107
|
+
options: Object.values(ICON_COLORS),
|
|
108
|
+
control: { type: 'select' },
|
|
109
|
+
},
|
|
110
|
+
child_icon: {
|
|
111
|
+
options: [null, ...Object.keys(ICONS)],
|
|
112
|
+
control: { type: 'select' },
|
|
113
|
+
},
|
|
114
|
+
child_iconColorHex: {
|
|
115
|
+
control: { type: 'text' },
|
|
116
|
+
},
|
|
117
|
+
child_elevation: {
|
|
118
|
+
options: [null, ...Object.values(RICH_LIST_ITEM_ELEVATION)],
|
|
119
|
+
control: { type: 'select' },
|
|
120
|
+
},
|
|
121
|
+
} as ArgTypes;
|
|
122
|
+
|
|
123
|
+
const slots = `<template #content>Content slot</template><template #meta>Meta slot</template><template #actions>ACS</template>`;
|
|
124
|
+
|
|
125
|
+
const expandStory = (story) => {
|
|
126
|
+
story.argTypes = argTypes;
|
|
127
|
+
story.args = args;
|
|
128
|
+
story.parameters = {
|
|
129
|
+
layout: 'fullscreen',
|
|
130
|
+
design: {
|
|
131
|
+
type: 'figma',
|
|
132
|
+
url: 'https://www.figma.com/file/izQdYyiBR1GQgFkaOIfIJI/LMS---DS-Components?type=design&node-id=8505-126430&mode=design&t=7Ay1DzrwONAPwSGv-4',
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
return story;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// # OneChild
|
|
139
|
+
const OneChildStoryTemplate: StoryFn<typeof GroupRichListItem> = (args, { updateArgs }) => {
|
|
140
|
+
return {
|
|
141
|
+
components: { GroupRichListItem, RichListItem, Divider },
|
|
142
|
+
setup() {
|
|
143
|
+
return { ...args };
|
|
144
|
+
},
|
|
145
|
+
data() {
|
|
146
|
+
return {
|
|
147
|
+
RICH_LIST_ITEM_TYPE: Object.freeze(RICH_LIST_ITEM_TYPE),
|
|
148
|
+
RICH_LIST_ITEM_STATE: Object.freeze(RICH_LIST_ITEM_STATE),
|
|
149
|
+
ICONS: Object.freeze(ICONS),
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
methods: {
|
|
153
|
+
updateParentIsSelected(isSelected) {
|
|
154
|
+
updateArgs({ parent_isSelected: isSelected });
|
|
155
|
+
},
|
|
156
|
+
updateChildIsSelected(isSelected) {
|
|
157
|
+
updateArgs({ child_isSelected: isSelected });
|
|
158
|
+
},
|
|
159
|
+
onClick() {
|
|
160
|
+
updateArgs({
|
|
161
|
+
isExpanded: !this.isExpanded,
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
template: `
|
|
166
|
+
<group-rich-list-item
|
|
167
|
+
:is-expanded="isExpanded"
|
|
168
|
+
:border-color="borderColor"
|
|
169
|
+
:border-color-hex="borderColorHex"
|
|
170
|
+
:background-color="backgroundColor"
|
|
171
|
+
>
|
|
172
|
+
<template #parent>
|
|
173
|
+
<rich-list-item
|
|
174
|
+
:state="parent_state"
|
|
175
|
+
:is-dimmed="parent_isDimmed"
|
|
176
|
+
:type="RICH_LIST_ITEM_TYPE.FLAT"
|
|
177
|
+
:is-selectable="parent_isSelectable"
|
|
178
|
+
:is-selected="parent_isSelected"
|
|
179
|
+
:size="parent_size"
|
|
180
|
+
:is-interactive="parent_isInteractive"
|
|
181
|
+
:is-draggable="parent_isDraggable"
|
|
182
|
+
:icon="ICONS[parent_icon]"
|
|
183
|
+
:icon-color="parent_iconColor"
|
|
184
|
+
:icon-color-hex="parent_iconColorHex"
|
|
185
|
+
:has-draggable-handler="parent_hasDraggableHandler"
|
|
186
|
+
:has-actions-slot-divider="parent_hasActionsSlotDivider"
|
|
187
|
+
@click="onClick"
|
|
188
|
+
@update:is-selected="updateParentIsSelected"
|
|
189
|
+
>
|
|
190
|
+
${slots}
|
|
191
|
+
</rich-list-item>
|
|
192
|
+
</template>
|
|
193
|
+
<template #children>
|
|
194
|
+
<rich-list-item
|
|
195
|
+
:state="child_state"
|
|
196
|
+
:is-dimmed="child_isDimmed"
|
|
197
|
+
:type="RICH_LIST_ITEM_TYPE.FLAT"
|
|
198
|
+
:is-selectable="child_isSelectable"
|
|
199
|
+
:is-selected="child_isSelected"
|
|
200
|
+
:size="child_size"
|
|
201
|
+
:is-interactive="child_isInteractive"
|
|
202
|
+
:is-draggable="child_isDraggable"
|
|
203
|
+
:icon="ICONS[child_icon]"
|
|
204
|
+
:icon-color="child_iconColor"
|
|
205
|
+
:icon-color-hex="child_iconColorHex"
|
|
206
|
+
:has-draggable-handler="child_hasDraggableHandler"
|
|
207
|
+
:has-actions-slot-divider="child_hasActionsSlotDivider"
|
|
208
|
+
@update:is-selected="updateChildIsSelected"
|
|
209
|
+
>
|
|
210
|
+
${slots}
|
|
211
|
+
</rich-list-item>
|
|
212
|
+
</template>
|
|
213
|
+
</group-rich-list-item>
|
|
214
|
+
`,
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
export const OneChild = expandStory(OneChildStoryTemplate.bind({}));
|
|
218
|
+
|
|
219
|
+
// # MultipleChild
|
|
220
|
+
const MultipleChildStoryTemplate: StoryFn<typeof GroupRichListItem> = (args, { updateArgs }) => {
|
|
221
|
+
return {
|
|
222
|
+
components: { GroupRichListItem, RichListItem, Divider },
|
|
223
|
+
setup() {
|
|
224
|
+
return { ...args };
|
|
225
|
+
},
|
|
226
|
+
data() {
|
|
227
|
+
return {
|
|
228
|
+
RICH_LIST_ITEM_TYPE: Object.freeze(RICH_LIST_ITEM_TYPE),
|
|
229
|
+
RICH_LIST_ITEM_STATE: Object.freeze(RICH_LIST_ITEM_STATE),
|
|
230
|
+
ICONS: Object.freeze(ICONS),
|
|
231
|
+
};
|
|
232
|
+
},
|
|
233
|
+
methods: {
|
|
234
|
+
updateParentIsSelected(isSelected) {
|
|
235
|
+
updateArgs({ parent_isSelected: isSelected });
|
|
236
|
+
},
|
|
237
|
+
updateChildIsSelected(isSelected) {
|
|
238
|
+
updateArgs({ child_isSelected: isSelected });
|
|
239
|
+
},
|
|
240
|
+
onClick() {
|
|
241
|
+
updateArgs({
|
|
242
|
+
isExpanded: !this.isExpanded,
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
template: `
|
|
247
|
+
<group-rich-list-item
|
|
248
|
+
:is-expanded="isExpanded"
|
|
249
|
+
:is-dimmed="isDimmed"
|
|
250
|
+
:border-color="borderColor"
|
|
251
|
+
:border-color-hex="borderColorHex"
|
|
252
|
+
:background-color="backgroundColor"
|
|
253
|
+
>
|
|
254
|
+
<template #parent>
|
|
255
|
+
<rich-list-item
|
|
256
|
+
:state="parent_state"
|
|
257
|
+
:is-dimmed="parent_isDimmed"
|
|
258
|
+
:type="RICH_LIST_ITEM_TYPE.FLAT"
|
|
259
|
+
:is-selectable="parent_isSelectable"
|
|
260
|
+
:is-selected="parent_isSelected"
|
|
261
|
+
:size="parent_size"
|
|
262
|
+
:is-interactive="parent_isInteractive"
|
|
263
|
+
:is-draggable="parent_isDraggable"
|
|
264
|
+
:icon="ICONS[parent_icon]"
|
|
265
|
+
:icon-color="parent_iconColor"
|
|
266
|
+
:icon-color-hex="parent_iconColorHex"
|
|
267
|
+
:has-draggable-handler="parent_hasDraggableHandler"
|
|
268
|
+
:has-actions-slot-divider="parent_hasActionsSlotDivider"
|
|
269
|
+
@click="onClick"
|
|
270
|
+
@update:is-selected="updateParentIsSelected"
|
|
271
|
+
>
|
|
272
|
+
${slots}
|
|
273
|
+
</rich-list-item>
|
|
274
|
+
</template>
|
|
275
|
+
<template #children>
|
|
276
|
+
<rich-list-item
|
|
277
|
+
:state="child_state"
|
|
278
|
+
:is-dimmed="child_isDimmed"
|
|
279
|
+
:type="RICH_LIST_ITEM_TYPE.FLAT"
|
|
280
|
+
:is-selectable="child_isSelectable"
|
|
281
|
+
:is-selected="child_isSelected"
|
|
282
|
+
:size="child_size"
|
|
283
|
+
:is-interactive="child_isInteractive"
|
|
284
|
+
:is-draggable="child_isDraggable"
|
|
285
|
+
:icon="ICONS[child_icon]"
|
|
286
|
+
:icon-color="child_iconColor"
|
|
287
|
+
:icon-color-hex="child_iconColorHex"
|
|
288
|
+
:has-draggable-handler="child_hasDraggableHandler"
|
|
289
|
+
:has-actions-slot-divider="child_hasActionsSlotDivider"
|
|
290
|
+
@update:is-selected="updateChildIsSelected"
|
|
291
|
+
>
|
|
292
|
+
${slots}
|
|
293
|
+
</rich-list-item>
|
|
294
|
+
<divider />
|
|
295
|
+
<rich-list-item
|
|
296
|
+
:state="child_state"
|
|
297
|
+
:is-dimmed="child_isDimmed"
|
|
298
|
+
:type="RICH_LIST_ITEM_TYPE.FLAT"
|
|
299
|
+
:is-selectable="child_isSelectable"
|
|
300
|
+
:is-selected="child_isSelected"
|
|
301
|
+
:size="child_size"
|
|
302
|
+
:is-interactive="child_isInteractive"
|
|
303
|
+
:is-draggable="child_isDraggable"
|
|
304
|
+
:icon="ICONS[child_icon]"
|
|
305
|
+
:icon-color="child_iconColor"
|
|
306
|
+
:icon-color-hex="child_iconColorHex"
|
|
307
|
+
:has-draggable-handler="child_hasDraggableHandler"
|
|
308
|
+
:has-actions-slot-divider="child_hasActionsSlotDivider"
|
|
309
|
+
@update:is-selected="updateChildIsSelected"
|
|
310
|
+
>
|
|
311
|
+
${slots}
|
|
312
|
+
</rich-list-item>
|
|
313
|
+
<divider />
|
|
314
|
+
<rich-list-item
|
|
315
|
+
:state="child_state"
|
|
316
|
+
:is-dimmed="child_isDimmed"
|
|
317
|
+
:type="RICH_LIST_ITEM_TYPE.FLAT"
|
|
318
|
+
:is-selectable="child_isSelectable"
|
|
319
|
+
:is-selected="child_isSelected"
|
|
320
|
+
:size="child_size"
|
|
321
|
+
:is-interactive="child_isInteractive"
|
|
322
|
+
:is-draggable="child_isDraggable"
|
|
323
|
+
:icon="ICONS[child_icon]"
|
|
324
|
+
:icon-color="child_iconColor"
|
|
325
|
+
:icon-color-hex="child_iconColorHex"
|
|
326
|
+
:has-draggable-handler="child_hasDraggableHandler"
|
|
327
|
+
:has-actions-slot-divider="child_hasActionsSlotDivider"
|
|
328
|
+
@update:is-selected="updateChildIsSelected"
|
|
329
|
+
>
|
|
330
|
+
${slots}
|
|
331
|
+
</rich-list-item>
|
|
332
|
+
</template>
|
|
333
|
+
</group-rich-list-item>
|
|
334
|
+
`,
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
export const MultipleChild = expandStory(MultipleChildStoryTemplate.bind({}));
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
3
|
-
<div class="
|
|
4
|
-
<div class="
|
|
2
|
+
<div class="groupRichListItem" :class="classList">
|
|
3
|
+
<div class="groupRichListItem__wrapper">
|
|
4
|
+
<div class="groupRichListItem__parent">
|
|
5
5
|
<slot name="parent" />
|
|
6
6
|
</div>
|
|
7
|
-
<div v-if="isExpanded">
|
|
7
|
+
<div v-if="isExpanded" class="groupRichListItem__children">
|
|
8
8
|
<slot name="children" />
|
|
9
9
|
</div>
|
|
10
10
|
</div>
|
|
11
11
|
<div
|
|
12
12
|
v-if="borderColorClass || borderColorStyle"
|
|
13
|
-
class="
|
|
13
|
+
class="groupRichListItem__border"
|
|
14
14
|
:class="borderColorClass"
|
|
15
15
|
:style="borderColorStyle"
|
|
16
16
|
/>
|
|
@@ -23,9 +23,42 @@
|
|
|
23
23
|
@import '../../../../styles/settings/spacings';
|
|
24
24
|
@import '../RichListItem/border-colors';
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
$group-rich-list-background-colors: (
|
|
27
|
+
neutral: (
|
|
28
|
+
parent: $color-neutral-background,
|
|
29
|
+
children: transparent,
|
|
30
|
+
),
|
|
31
|
+
neutral-weak: (
|
|
32
|
+
parent: $color-neutral-background-weak,
|
|
33
|
+
children: $color-neutral-background,
|
|
34
|
+
),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
.groupRichListItem {
|
|
27
38
|
$root: &;
|
|
28
39
|
|
|
40
|
+
@each $color, $value in $group-rich-list-background-colors {
|
|
41
|
+
&.-background-#{$color} {
|
|
42
|
+
#{$root}__children {
|
|
43
|
+
background-color: map-get($value, 'children');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#{$root}__parent {
|
|
47
|
+
background-color: map-get($value, 'parent');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&.-loading {
|
|
51
|
+
#{$root}__children {
|
|
52
|
+
background-color: map-get($value, 'children');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
#{$root}__parent {
|
|
56
|
+
background-color: map-get($value, 'parent');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
29
62
|
border-radius: $radius-s;
|
|
30
63
|
display: flex;
|
|
31
64
|
flex: 1;
|
|
@@ -40,10 +73,6 @@
|
|
|
40
73
|
overflow: hidden;
|
|
41
74
|
}
|
|
42
75
|
|
|
43
|
-
&__parent.-expanded {
|
|
44
|
-
background: $color-neutral-background;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
76
|
&__border {
|
|
48
77
|
@each $color, $value in $rich-list-item-border-colors {
|
|
49
78
|
&.-border-#{$color} {
|
|
@@ -64,30 +93,48 @@
|
|
|
64
93
|
<script lang="ts">
|
|
65
94
|
import { PropType } from 'vue';
|
|
66
95
|
import {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
96
|
+
GROUP_RICH_LIST_ITEM_BACKGROUND_COLOR,
|
|
97
|
+
GROUP_RICH_LIST_ITEM_BORDER_COLOR,
|
|
98
|
+
GroupRichListItemBackgroundColor,
|
|
99
|
+
GroupRichListItemBorderColor,
|
|
100
|
+
} from './GroupRichListItem.consts';
|
|
70
101
|
|
|
71
102
|
export default {
|
|
72
|
-
name: '
|
|
103
|
+
name: 'GroupRichListItem',
|
|
73
104
|
props: {
|
|
74
105
|
isExpanded: {
|
|
75
106
|
type: Boolean,
|
|
76
107
|
default: false,
|
|
77
108
|
},
|
|
78
109
|
borderColor: {
|
|
79
|
-
type: String as PropType<
|
|
110
|
+
type: String as PropType<GroupRichListItemBorderColor>,
|
|
80
111
|
default: null,
|
|
81
112
|
validator(borderColor) {
|
|
82
|
-
return Object.values(
|
|
113
|
+
return Object.values(GROUP_RICH_LIST_ITEM_BORDER_COLOR).includes(borderColor);
|
|
83
114
|
},
|
|
84
115
|
},
|
|
85
116
|
borderColorHex: {
|
|
86
117
|
type: String,
|
|
87
118
|
default: null,
|
|
88
119
|
},
|
|
120
|
+
backgroundColor: {
|
|
121
|
+
type: String as PropType<GroupRichListItemBackgroundColor>,
|
|
122
|
+
default: GROUP_RICH_LIST_ITEM_BACKGROUND_COLOR.NEUTRAL,
|
|
123
|
+
validator(backgroundColor) {
|
|
124
|
+
return Object.values(GROUP_RICH_LIST_ITEM_BACKGROUND_COLOR).includes(
|
|
125
|
+
backgroundColor,
|
|
126
|
+
);
|
|
127
|
+
},
|
|
128
|
+
},
|
|
89
129
|
},
|
|
90
130
|
computed: {
|
|
131
|
+
classList() {
|
|
132
|
+
return {
|
|
133
|
+
...(this.backgroundColor && {
|
|
134
|
+
[`-background-${this.backgroundColor}`]: true,
|
|
135
|
+
}),
|
|
136
|
+
};
|
|
137
|
+
},
|
|
91
138
|
borderColorClass() {
|
|
92
139
|
if (!this.borderColor || (this.borderColor && this.borderColorHex)) {
|
|
93
140
|
return;
|
|
@@ -19,24 +19,6 @@ export const RICH_LIST_ITEM_SIZE = {
|
|
|
19
19
|
|
|
20
20
|
export type RichListItemSize = typeof RICH_LIST_ITEM_SIZE[keyof typeof RICH_LIST_ITEM_SIZE];
|
|
21
21
|
|
|
22
|
-
export const RICH_LIST_ITEM_ICON_COLOR = {
|
|
23
|
-
DEFAULT: 'default',
|
|
24
|
-
INVERTED: 'inverted',
|
|
25
|
-
PRIMARY: 'primary',
|
|
26
|
-
PRIMARY_WEAK: 'primary-weak',
|
|
27
|
-
NEUTRAL: 'neutral',
|
|
28
|
-
NEUTRAL_WEAK: 'neutral-weak',
|
|
29
|
-
DANGER: 'danger',
|
|
30
|
-
FAIL: 'fail',
|
|
31
|
-
WARNING: 'warning',
|
|
32
|
-
SUCCESS: 'success',
|
|
33
|
-
INFO: 'info',
|
|
34
|
-
ACCENT: 'accent',
|
|
35
|
-
} as const;
|
|
36
|
-
|
|
37
|
-
export type RichListItemIconColor =
|
|
38
|
-
typeof RICH_LIST_ITEM_ICON_COLOR[keyof typeof RICH_LIST_ITEM_ICON_COLOR];
|
|
39
|
-
|
|
40
22
|
export const RICH_LIST_ITEM_BORDER_COLOR = {
|
|
41
23
|
DEFAULT: 'default',
|
|
42
24
|
PRIMARY: 'primary',
|
|
@@ -62,3 +44,18 @@ export const RICH_LIST_ITEM_BORDER_COLOR = {
|
|
|
62
44
|
|
|
63
45
|
export type RichListItemBorderColor =
|
|
64
46
|
typeof RICH_LIST_ITEM_BORDER_COLOR[keyof typeof RICH_LIST_ITEM_BORDER_COLOR];
|
|
47
|
+
|
|
48
|
+
export const RICH_LIST_ITEM_BACKGROUND_COLOR = {
|
|
49
|
+
NEUTRAL: 'neutral',
|
|
50
|
+
NEUTRAL_WEAK: 'neutral-weak',
|
|
51
|
+
} as const;
|
|
52
|
+
|
|
53
|
+
export type RichListItemBackgroundColor =
|
|
54
|
+
typeof RICH_LIST_ITEM_BACKGROUND_COLOR[keyof typeof RICH_LIST_ITEM_BACKGROUND_COLOR];
|
|
55
|
+
|
|
56
|
+
export const RICH_LIST_ITEM_ELEVATION = {
|
|
57
|
+
SMALL: 'small',
|
|
58
|
+
} as const;
|
|
59
|
+
|
|
60
|
+
export type RichListItemElevation =
|
|
61
|
+
typeof RICH_LIST_ITEM_ELEVATION[keyof typeof RICH_LIST_ITEM_ELEVATION];
|
|
@@ -2,13 +2,14 @@ import RichListItem from './RichListItem.vue';
|
|
|
2
2
|
|
|
3
3
|
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
|
|
4
4
|
import {
|
|
5
|
+
RICH_LIST_ITEM_BACKGROUND_COLOR,
|
|
5
6
|
RICH_LIST_ITEM_BORDER_COLOR,
|
|
6
|
-
|
|
7
|
+
RICH_LIST_ITEM_ELEVATION,
|
|
7
8
|
RICH_LIST_ITEM_SIZE,
|
|
8
9
|
RICH_LIST_ITEM_STATE,
|
|
9
10
|
RICH_LIST_ITEM_TYPE,
|
|
10
11
|
} from './RichListItem.consts';
|
|
11
|
-
import { ICONS } from '../../Icons/Icon';
|
|
12
|
+
import { ICON_COLORS, ICONS } from '../../Icons/Icon';
|
|
12
13
|
|
|
13
14
|
export default {
|
|
14
15
|
title: 'Components/RichList/RichListItem',
|
|
@@ -21,7 +22,7 @@ export default {
|
|
|
21
22
|
],
|
|
22
23
|
} as Meta<typeof RichListItem>;
|
|
23
24
|
|
|
24
|
-
const StoryTemplate: StoryFn<typeof RichListItem> = (args) => ({
|
|
25
|
+
const StoryTemplate: StoryFn<typeof RichListItem> = (args, { updateArgs }) => ({
|
|
25
26
|
components: { RichListItem },
|
|
26
27
|
setup() {
|
|
27
28
|
return { ...args };
|
|
@@ -31,6 +32,11 @@ const StoryTemplate: StoryFn<typeof RichListItem> = (args) => ({
|
|
|
31
32
|
ICONS: Object.freeze(ICONS),
|
|
32
33
|
};
|
|
33
34
|
},
|
|
35
|
+
methods: {
|
|
36
|
+
updateIsSelected(isSelected) {
|
|
37
|
+
updateArgs({ isSelected });
|
|
38
|
+
},
|
|
39
|
+
},
|
|
34
40
|
template: `
|
|
35
41
|
<rich-list-item
|
|
36
42
|
:size="size"
|
|
@@ -45,6 +51,13 @@ const StoryTemplate: StoryFn<typeof RichListItem> = (args) => ({
|
|
|
45
51
|
:border-color-hex="borderColorHex"
|
|
46
52
|
:draggable-icon-class-name="draggableIconClassName"
|
|
47
53
|
:state="state"
|
|
54
|
+
:background-color="backgroundColor"
|
|
55
|
+
:elevation="elevation"
|
|
56
|
+
:has-draggable-handler="hasDraggableHandler"
|
|
57
|
+
:has-actions-slot-divider="hasActionsSlotDivider"
|
|
58
|
+
:is-selectable="isSelectable"
|
|
59
|
+
:is-selected="isSelected"
|
|
60
|
+
@update:isSelected="updateIsSelected"
|
|
48
61
|
>
|
|
49
62
|
<template v-if="content" #content>
|
|
50
63
|
<div v-html="content" />
|
|
@@ -52,8 +65,8 @@ const StoryTemplate: StoryFn<typeof RichListItem> = (args) => ({
|
|
|
52
65
|
<template v-if="meta" #meta>
|
|
53
66
|
<div v-html="meta" />
|
|
54
67
|
</template>
|
|
55
|
-
<template v-if="
|
|
56
|
-
<div v-html="
|
|
68
|
+
<template v-if="actions" #actions>
|
|
69
|
+
<div v-html="actions" />
|
|
57
70
|
</template>
|
|
58
71
|
</rich-list-item>`,
|
|
59
72
|
});
|
|
@@ -63,20 +76,26 @@ export const Interactive = StoryTemplate.bind({});
|
|
|
63
76
|
const args = {
|
|
64
77
|
size: RICH_LIST_ITEM_SIZE.MEDIUM,
|
|
65
78
|
type: RICH_LIST_ITEM_TYPE.DEFAULT,
|
|
66
|
-
|
|
79
|
+
backgroundColor: RICH_LIST_ITEM_BACKGROUND_COLOR.NEUTRAL,
|
|
80
|
+
elevation: null,
|
|
81
|
+
isDimmed: false,
|
|
67
82
|
isDraggable: true,
|
|
83
|
+
hasDraggableHandler: true,
|
|
68
84
|
icon: null,
|
|
69
|
-
iconColor:
|
|
85
|
+
iconColor: ICON_COLORS.NEUTRAL_WEAK,
|
|
70
86
|
iconColorHex: '',
|
|
71
|
-
|
|
87
|
+
hasActionsSlotDivider: true,
|
|
88
|
+
isSelectable: true,
|
|
89
|
+
isSelected: true,
|
|
72
90
|
borderColor: null,
|
|
73
91
|
borderColorHex: '',
|
|
74
92
|
state: RICH_LIST_ITEM_STATE.DEFAULT,
|
|
93
|
+
isInteractive: true,
|
|
75
94
|
draggableIconClassName: 'draggableIconClassName-1',
|
|
76
95
|
|
|
77
96
|
content: 'Content Slot',
|
|
78
97
|
meta: 'Meta Slot',
|
|
79
|
-
|
|
98
|
+
actions: 'ACS',
|
|
80
99
|
} as Args;
|
|
81
100
|
|
|
82
101
|
const argTypes = {
|
|
@@ -93,7 +112,7 @@ const argTypes = {
|
|
|
93
112
|
control: { type: 'select' },
|
|
94
113
|
},
|
|
95
114
|
iconColor: {
|
|
96
|
-
options:
|
|
115
|
+
options: Object.values(ICON_COLORS),
|
|
97
116
|
control: { type: 'select' },
|
|
98
117
|
},
|
|
99
118
|
borderColor: {
|
|
@@ -116,21 +135,32 @@ const argTypes = {
|
|
|
116
135
|
meta: {
|
|
117
136
|
control: { type: 'text' },
|
|
118
137
|
},
|
|
119
|
-
|
|
138
|
+
actions: {
|
|
120
139
|
control: { type: 'text' },
|
|
121
140
|
},
|
|
122
141
|
draggableIconClassName: {
|
|
123
142
|
control: { type: 'text' },
|
|
124
143
|
},
|
|
144
|
+
backgroundColor: {
|
|
145
|
+
options: [null, ...Object.values(RICH_LIST_ITEM_BACKGROUND_COLOR)],
|
|
146
|
+
control: { type: 'select' },
|
|
147
|
+
},
|
|
148
|
+
elevation: {
|
|
149
|
+
options: [null, ...Object.values(RICH_LIST_ITEM_ELEVATION)],
|
|
150
|
+
control: { type: 'select' },
|
|
151
|
+
},
|
|
125
152
|
} as ArgTypes;
|
|
126
153
|
|
|
127
154
|
Interactive.argTypes = argTypes;
|
|
128
155
|
Interactive.args = args;
|
|
129
156
|
|
|
130
157
|
Interactive.parameters = {
|
|
158
|
+
actions: {
|
|
159
|
+
handles: ['icon-click', 'click', 'update:isSelected'],
|
|
160
|
+
},
|
|
131
161
|
layout: 'fullscreen',
|
|
132
162
|
design: {
|
|
133
163
|
type: 'figma',
|
|
134
|
-
url: 'https://www.figma.com/file/izQdYyiBR1GQgFkaOIfIJI/LMS---DS-Components?type=design&node-id=
|
|
164
|
+
url: 'https://www.figma.com/file/izQdYyiBR1GQgFkaOIfIJI/LMS---DS-Components?type=design&node-id=8507-129603&mode=design&t=dC5vBzU9RlP1j7G2-4',
|
|
135
165
|
},
|
|
136
166
|
};
|