@bethinkpl/design-system 39.1.0 → 40.0.1
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/dist/design-system.css +1 -1
- package/dist/design-system.js +19320 -19133
- package/dist/design-system.js.map +1 -1
- package/dist/lib/js/components/ActionContent/ActionContent.vue.d.ts +42 -0
- package/dist/lib/js/components/ActionContent/index.d.ts +3 -0
- package/dist/lib/js/components/Buttons/IconButton/IconButton.vue.d.ts +4 -1
- package/dist/lib/js/components/Cards/Card/Card.consts.d.ts +13 -8
- package/dist/lib/js/components/Cards/Card/Card.vue.d.ts +22 -9
- package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +78 -21
- package/dist/lib/js/components/Chip/Chip.vue.d.ts +2 -0
- package/dist/lib/js/components/DatePickers/DateBox/DateBox.vue.d.ts +4 -1
- package/dist/lib/js/components/DatePickers/DatePicker/DatePicker.vue.d.ts +8 -5
- package/dist/lib/js/components/DatePickers/DateRangePicker/DateRangePicker.vue.d.ts +5 -2
- package/dist/lib/js/components/Divider/Divider.vue.d.ts +1 -1
- package/dist/lib/js/components/Drawer/DrawerDivider/DrawerDivider.vue.d.ts +1 -1
- package/dist/lib/js/components/Drawer/DrawerHeader/DrawerHeader.vue.d.ts +12 -3
- package/dist/lib/js/components/Drawer/DrawerListItem/DrawerListItem.vue.d.ts +3 -0
- package/dist/lib/js/components/Drawer/DrawerSection/DrawerSection.vue.d.ts +13 -4
- package/dist/lib/js/components/Drawer/DrawerTile/DrawerTile.vue.d.ts +4 -4
- package/dist/lib/js/components/Dropdown/Dropdown.vue.d.ts +1 -1
- package/dist/lib/js/components/Form/FormField/FormField.utils.d.ts +1 -1
- package/dist/lib/js/components/Form/InputField/InputField.vue.d.ts +2 -2
- package/dist/lib/js/components/Form/PasswordField/PasswordField.vue.d.ts +2 -2
- package/dist/lib/js/components/Form/RadioButton/RadioButton.vue.d.ts +3 -0
- package/dist/lib/js/components/Headers/OverlayHeader/OverlayHeader.vue.d.ts +11 -5
- package/dist/lib/js/components/Headers/PageHeader/PageHeader.vue.d.ts +1 -1
- package/dist/lib/js/components/Headers/SectionHeader/SectionHeader.vue.d.ts +9 -3
- package/dist/lib/js/components/IconText/IconText.vue.d.ts +1 -1
- package/dist/lib/js/components/Icons/Icon/Icon.consts.d.ts +3 -0
- package/dist/lib/js/components/Image/Image.vue.d.ts +1 -1
- package/dist/lib/js/components/Menu/MenuDivider/MenuDivider.vue.d.ts +1 -1
- package/dist/lib/js/components/Modal/Modal.vue.d.ts +3 -0
- package/dist/lib/js/components/Modals/Modal/Modal.vue.d.ts +8 -2
- package/dist/lib/js/components/Modals/ModalDialog/ModalDialog.vue.d.ts +8 -2
- package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +8 -2
- package/dist/lib/js/components/ProgressBar/ProgressBar.vue.d.ts +3 -0
- package/dist/lib/js/components/ProgressDonutChart/ProgressDonutChart.vue.d.ts +3 -0
- package/dist/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.vue.d.ts +45 -23
- package/dist/lib/js/components/RichList/RichListItem/RichListItem.vue.d.ts +7 -4
- package/dist/lib/js/components/SelectList/SelectListItemDivider/SelectListItemDivider.vue.d.ts +1 -1
- package/dist/lib/js/components/Skeleton/Skeleton.vue.d.ts +1 -1
- package/dist/lib/js/components/Statuses/AccessStatus/AccessStatus.vue.d.ts +3 -0
- package/dist/lib/js/components/Statuses/BlockadeStatus/BlockadeStatus.vue.d.ts +3 -0
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +85 -22
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +85 -22
- package/dist/lib/js/components/Switch/Switch.vue.d.ts +3 -0
- package/dist/lib/js/components/TextGroup/TextGroup.consts.d.ts +14 -3
- package/dist/lib/js/components/TextGroup/TextGroup.vue.d.ts +8 -3
- package/dist/lib/js/components/Tile/Tile.sb.shared.d.ts +5 -2
- package/dist/lib/js/components/Tile/Tile.vue.d.ts +2 -2
- package/dist/lib/js/components/Toast/Toast.vue.d.ts +76 -22
- package/dist/lib/js/components/Toggles/ToggleButton/ToggleButton.vue.d.ts +5 -2
- package/dist/lib/js/components/Well/Well.consts.d.ts +24 -0
- package/dist/lib/js/components/Well/Well.vue.d.ts +13 -1
- package/dist/lib/js/icons/fontawesome.d.ts +2 -0
- package/dist/lib/js/index.d.ts +2 -0
- package/dist/lib/js/utils/type.utils.d.ts +3 -0
- package/lib/images/icons/comment-lock.svg +1 -0
- package/lib/js/components/ActionContent/ActionContent.spec.ts +99 -0
- package/lib/js/components/ActionContent/ActionContent.stories.ts +141 -0
- package/lib/js/components/ActionContent/ActionContent.vue +104 -0
- package/lib/js/components/ActionContent/index.ts +3 -0
- package/lib/js/components/Cards/Card/Card.consts.ts +15 -8
- package/lib/js/components/Cards/Card/Card.spec.ts +61 -1
- package/lib/js/components/Cards/Card/Card.stories.ts +20 -13
- package/lib/js/components/Cards/Card/Card.vue +65 -34
- package/lib/js/components/Chip/Chip.spec.ts +28 -0
- package/lib/js/components/Chip/Chip.stories.ts +7 -2
- package/lib/js/components/Chip/Chip.vue +14 -3
- package/lib/js/components/Icons/Icon/Icon.consts.ts +2 -0
- package/lib/js/components/ProgressDonutChart/ProgressDonutChart.spec.ts +3 -3
- package/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.vue +8 -1
- package/lib/js/components/TextGroup/TextGroup.consts.ts +15 -1
- package/lib/js/components/TextGroup/TextGroup.stories.ts +14 -5
- package/lib/js/components/TextGroup/TextGroup.vue +51 -28
- package/lib/js/components/Well/Well.consts.ts +16 -0
- package/lib/js/components/Well/Well.spec.ts +112 -0
- package/lib/js/components/Well/Well.stories.ts +90 -1
- package/lib/js/components/Well/Well.vue +135 -4
- package/lib/js/icons/fontawesome.ts +4 -0
- package/lib/js/index.ts +2 -0
- package/lib/js/utils/type.utils.ts +16 -0
- package/package.json +14 -6
|
@@ -4,13 +4,16 @@
|
|
|
4
4
|
:class="{
|
|
5
5
|
'-ds-x-small': size === TEXT_GROUP_SIZES.X_SMALL,
|
|
6
6
|
'-ds-small': size === TEXT_GROUP_SIZES.SMALL,
|
|
7
|
+
'-ds-large': size === TEXT_GROUP_SIZES.LARGE,
|
|
8
|
+
|
|
9
|
+
'-ds-align-center': align === TEXT_GROUP_ALIGNS.CENTER,
|
|
7
10
|
|
|
8
11
|
'-ds-hovered': state === TEXT_GROUP_STATES.HOVERED,
|
|
9
12
|
'-ds-loading': isLoading,
|
|
10
13
|
'-ds-disabled': state === TEXT_GROUP_STATES.DISABLED,
|
|
11
14
|
|
|
12
15
|
'-ds-interactive': isInteractive,
|
|
13
|
-
'-ds-
|
|
16
|
+
'-ds-mainTextColor-primary': mainTextColor === TEXT_GROUP_MAIN_TEXT_COLORS.PRIMARY,
|
|
14
17
|
|
|
15
18
|
[loadingSizeClassName]: isLoading,
|
|
16
19
|
|
|
@@ -100,9 +103,6 @@ $text-group-colors: (
|
|
|
100
103
|
'main-text-color': $color-neutral-text-strong,
|
|
101
104
|
'main-text-color-hovered': $color-neutral-text-strong-hovered,
|
|
102
105
|
'main-text-color-disabled': $color-neutral-text-strong-disabled,
|
|
103
|
-
'main-text-color-selected': $color-primary-text,
|
|
104
|
-
'main-text-color-selected-hovered': $color-primary-text-hovered,
|
|
105
|
-
'main-text-color-selected-disabled': $color-primary-text-disabled,
|
|
106
106
|
'supporting-text-color': $color-neutral-text,
|
|
107
107
|
'supporting-text-color-hovered': $color-neutral-text-hovered,
|
|
108
108
|
'supporting-text-color-disabled': $color-neutral-text-disabled,
|
|
@@ -114,9 +114,6 @@ $text-group-colors: (
|
|
|
114
114
|
'main-text-color': $color-neutral-text-heavy,
|
|
115
115
|
'main-text-color-hovered': $color-neutral-text-heavy-hovered,
|
|
116
116
|
'main-text-color-disabled': $color-neutral-text-heavy-disabled,
|
|
117
|
-
'main-text-color-selected': $color-primary-text,
|
|
118
|
-
'main-text-color-selected-hovered': $color-primary-text-hovered,
|
|
119
|
-
'main-text-color-selected-disabled': $color-primary-text-disabled,
|
|
120
117
|
'supporting-text-color': $color-neutral-text,
|
|
121
118
|
'supporting-text-color-hovered': $color-neutral-text-hovered,
|
|
122
119
|
'supporting-text-color-disabled': $color-neutral-text-disabled,
|
|
@@ -166,25 +163,6 @@ $text-group-colors: (
|
|
|
166
163
|
color: map-get($map, 'supporting-text-color-disabled');
|
|
167
164
|
}
|
|
168
165
|
}
|
|
169
|
-
|
|
170
|
-
&.-ds-selected {
|
|
171
|
-
#{$self}__main {
|
|
172
|
-
color: map-get($map, 'main-text-color-selected');
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
&.-ds-interactive:hover,
|
|
176
|
-
&.-ds-hovered {
|
|
177
|
-
#{$self}__main {
|
|
178
|
-
color: map-get($map, 'main-text-color-selected-hovered');
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
&.-ds-disabled {
|
|
183
|
-
#{$self}__main {
|
|
184
|
-
color: map-get($map, 'main-text-color-selected-disabled');
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
166
|
}
|
|
189
167
|
|
|
190
168
|
.ds-textGroup {
|
|
@@ -302,6 +280,40 @@ $text-group-colors: (
|
|
|
302
280
|
}
|
|
303
281
|
}
|
|
304
282
|
|
|
283
|
+
&.-ds-large {
|
|
284
|
+
#{$self}__main {
|
|
285
|
+
@include text-l-compact-bold;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
#{$self}__supporting {
|
|
289
|
+
@include text-m-compact-regular;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
&.-ds-align-center {
|
|
294
|
+
align-items: center;
|
|
295
|
+
text-align: center;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
&.-ds-mainTextColor-primary {
|
|
299
|
+
#{$self}__main {
|
|
300
|
+
color: $color-primary-text;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
&.-ds-interactive:hover,
|
|
304
|
+
&.-ds-hovered {
|
|
305
|
+
#{$self}__main {
|
|
306
|
+
color: $color-primary-text-hovered;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
&.-ds-disabled {
|
|
311
|
+
#{$self}__main {
|
|
312
|
+
color: $color-primary-text-disabled;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
305
317
|
&.-ds-interactive:hover,
|
|
306
318
|
&.-ds-hovered {
|
|
307
319
|
cursor: pointer;
|
|
@@ -346,9 +358,13 @@ import { throttle } from 'lodash';
|
|
|
346
358
|
import { useElementSize } from '@vueuse/core';
|
|
347
359
|
import DsSkeleton from '../Skeleton/Skeleton.vue';
|
|
348
360
|
import {
|
|
361
|
+
TEXT_GROUP_ALIGNS,
|
|
349
362
|
TEXT_GROUP_LOADING_SIZES,
|
|
363
|
+
TEXT_GROUP_MAIN_TEXT_COLORS,
|
|
350
364
|
TEXT_GROUP_SIZES,
|
|
351
365
|
TEXT_GROUP_STATES,
|
|
366
|
+
TextGroupAlign,
|
|
367
|
+
TextGroupMainTextColor,
|
|
352
368
|
TextGroupProminence,
|
|
353
369
|
TextGroupLoadingSize,
|
|
354
370
|
TextGroupSize,
|
|
@@ -356,9 +372,12 @@ import {
|
|
|
356
372
|
TEXT_GROUP_PROMINENCE,
|
|
357
373
|
} from './TextGroup.consts';
|
|
358
374
|
import DsTooltip from '../Tooltip';
|
|
375
|
+
import { RemovedProp } from '../../utils/type.utils';
|
|
359
376
|
|
|
360
377
|
const {
|
|
361
378
|
size = TEXT_GROUP_SIZES.MEDIUM,
|
|
379
|
+
align = TEXT_GROUP_ALIGNS.LEFT,
|
|
380
|
+
mainTextColor = TEXT_GROUP_MAIN_TEXT_COLORS.NEUTRAL,
|
|
362
381
|
prominence = TEXT_GROUP_PROMINENCE.DEFAULT,
|
|
363
382
|
eyebrowText,
|
|
364
383
|
eyebrowTextEllipsis = false,
|
|
@@ -370,7 +389,6 @@ const {
|
|
|
370
389
|
supportingTextEllipsis = false,
|
|
371
390
|
isInteractive = true,
|
|
372
391
|
skeletonLoadingSize = TEXT_GROUP_LOADING_SIZES.LARGE,
|
|
373
|
-
isSelected = false,
|
|
374
392
|
state = TEXT_GROUP_STATES.DEFAULT,
|
|
375
393
|
isSupportingTextTooltipEnabled = false,
|
|
376
394
|
isSupportingTextTooltipEnabledOnMobile = true,
|
|
@@ -378,6 +396,8 @@ const {
|
|
|
378
396
|
supportingTextTooltipContent,
|
|
379
397
|
} = defineProps<{
|
|
380
398
|
size?: TextGroupSize;
|
|
399
|
+
align?: TextGroupAlign;
|
|
400
|
+
mainTextColor?: TextGroupMainTextColor;
|
|
381
401
|
prominence?: TextGroupProminence;
|
|
382
402
|
eyebrowText?: string | null;
|
|
383
403
|
eyebrowTextEllipsis?: boolean;
|
|
@@ -389,12 +409,15 @@ const {
|
|
|
389
409
|
supportingTextEllipsis?: boolean;
|
|
390
410
|
isInteractive?: boolean;
|
|
391
411
|
skeletonLoadingSize?: TextGroupLoadingSize;
|
|
392
|
-
isSelected?: boolean;
|
|
393
412
|
state?: TextGroupState;
|
|
394
413
|
isSupportingTextTooltipEnabled?: boolean;
|
|
395
414
|
isSupportingTextTooltipEnabledOnMobile?: boolean;
|
|
396
415
|
isSupportingTextTooltipAutoFilledWithContent?: boolean;
|
|
397
416
|
supportingTextTooltipContent?: string;
|
|
417
|
+
|
|
418
|
+
// Removed prop kept as a removal marker so existing usages fail type-checking.
|
|
419
|
+
/** @deprecated use `mainTextColor` set to `primary` instead */
|
|
420
|
+
isSelected?: RemovedProp<'use mainTextColor=primary instead'>;
|
|
398
421
|
}>();
|
|
399
422
|
|
|
400
423
|
const prominenceClassName = computed(() => `-ds-${prominence}`);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Value } from '../../utils/type.utils';
|
|
2
|
+
import { CONTAINER_RIBBON_COLORS, CONTAINER_RIBBON_SIZES } from '../ContainerRibbon';
|
|
2
3
|
|
|
3
4
|
export const WELL_PADDINGS = {
|
|
4
5
|
SMALL: 'small',
|
|
@@ -21,3 +22,18 @@ export const WELL_COLORS = {
|
|
|
21
22
|
export type WellColor = Value<typeof WELL_COLORS>;
|
|
22
23
|
|
|
23
24
|
export const WELL_DEFAULT_COLOR = WELL_COLORS.NEUTRAL;
|
|
25
|
+
|
|
26
|
+
export const WELL_RIBBON_COLORS = CONTAINER_RIBBON_COLORS;
|
|
27
|
+
|
|
28
|
+
export type WellRibbonColor = Value<typeof WELL_RIBBON_COLORS>;
|
|
29
|
+
|
|
30
|
+
export const WELL_RIBBON_SIZES = CONTAINER_RIBBON_SIZES;
|
|
31
|
+
|
|
32
|
+
export type WellRibbonSize = Value<typeof WELL_RIBBON_SIZES>;
|
|
33
|
+
|
|
34
|
+
export const WELL_RIBBON_POSITIONS = {
|
|
35
|
+
TOP: 'top',
|
|
36
|
+
LEFT: 'left',
|
|
37
|
+
} as const;
|
|
38
|
+
|
|
39
|
+
export type WellRibbonPosition = Value<typeof WELL_RIBBON_POSITIONS>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { ComponentMountingOptions, mount } from '@vue/test-utils';
|
|
3
|
+
|
|
4
|
+
import Well from './Well.vue';
|
|
5
|
+
import { WELL_RIBBON_POSITIONS } from './Well.consts';
|
|
6
|
+
|
|
7
|
+
describe('Well', () => {
|
|
8
|
+
const createComponent = (options: ComponentMountingOptions<typeof Well> = {}) => {
|
|
9
|
+
return mount(Well, options);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
it('should create', () => {
|
|
13
|
+
const component = createComponent();
|
|
14
|
+
|
|
15
|
+
expect(component.find('.ds-well').exists()).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should render default slot content', () => {
|
|
19
|
+
const content = 'Wpłynąlem na suchego przestwór oceanu';
|
|
20
|
+
const component = createComponent({
|
|
21
|
+
slots: { default: () => content },
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
expect(component.find('.ds-well__content').text()).toContain(content);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should not set no-radius class by default', () => {
|
|
28
|
+
const component = createComponent();
|
|
29
|
+
|
|
30
|
+
expect(component.find('.ds-well').classes()).not.toContain('-ds-noRadius');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should set no-radius class when hasRadius is false', () => {
|
|
34
|
+
const component = createComponent({
|
|
35
|
+
props: { hasRadius: false },
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
expect(component.find('.ds-well').classes()).toContain('-ds-noRadius');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should not set border class by default', () => {
|
|
42
|
+
const component = createComponent();
|
|
43
|
+
|
|
44
|
+
expect(component.find('.ds-well').classes()).not.toContain('-ds-hasBorder');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should set border class when hasBorder is true', () => {
|
|
48
|
+
const component = createComponent({
|
|
49
|
+
props: { hasBorder: true },
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
expect(component.find('.ds-well').classes()).toContain('-ds-hasBorder');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should not render a ribbon by default', () => {
|
|
56
|
+
const component = createComponent();
|
|
57
|
+
|
|
58
|
+
expect(component.find('.ds-well__ribbon').exists()).toBe(false);
|
|
59
|
+
expect(component.find('.ds-container-ribbon').exists()).toBe(false);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('should render a horizontal ribbon for the top position', () => {
|
|
63
|
+
const component = createComponent({
|
|
64
|
+
props: { hasRibbon: true, ribbonPosition: WELL_RIBBON_POSITIONS.TOP },
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
expect(component.find('.ds-container-ribbon').classes()).toContain('-ds-layout-horizontal');
|
|
68
|
+
expect(component.find('.ds-well').classes()).not.toContain('-ds-leftRibbon');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should render a vertical ribbon and left-ribbon class for the left position', () => {
|
|
72
|
+
const component = createComponent({
|
|
73
|
+
props: { hasRibbon: true, ribbonPosition: WELL_RIBBON_POSITIONS.LEFT },
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
expect(component.find('.ds-container-ribbon').classes()).toContain('-ds-layout-vertical');
|
|
77
|
+
expect(component.find('.ds-well').classes()).toContain('-ds-leftRibbon');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('should not give the ribbon a radius when the well is rounded', () => {
|
|
81
|
+
const component = createComponent({
|
|
82
|
+
props: { hasRibbon: true, hasRadius: true },
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
expect(component.find('.-ds-radius-bottom').exists()).toBe(false);
|
|
86
|
+
expect(component.find('.-ds-radius-right').exists()).toBe(false);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should give a top ribbon a bottom radius when the well is square', () => {
|
|
90
|
+
const component = createComponent({
|
|
91
|
+
props: {
|
|
92
|
+
hasRibbon: true,
|
|
93
|
+
hasRadius: false,
|
|
94
|
+
ribbonPosition: WELL_RIBBON_POSITIONS.TOP,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
expect(component.find('.-ds-radius-bottom').exists()).toBe(true);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('should give a left ribbon a right radius when the well is square', () => {
|
|
102
|
+
const component = createComponent({
|
|
103
|
+
props: {
|
|
104
|
+
hasRibbon: true,
|
|
105
|
+
hasRadius: false,
|
|
106
|
+
ribbonPosition: WELL_RIBBON_POSITIONS.LEFT,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
expect(component.find('.-ds-radius-right').exists()).toBe(true);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import { Args, ArgTypes, Meta, StoryObj } from '@storybook/vue3';
|
|
4
4
|
import Well from './Well.vue';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
WELL_COLORS,
|
|
7
|
+
WELL_DEFAULT_COLOR,
|
|
8
|
+
WELL_PADDINGS,
|
|
9
|
+
WELL_RIBBON_COLORS,
|
|
10
|
+
WELL_RIBBON_POSITIONS,
|
|
11
|
+
WELL_RIBBON_SIZES,
|
|
12
|
+
} from './Well.consts';
|
|
6
13
|
import type { ComponentProps } from 'vue-component-type-helpers';
|
|
7
14
|
import Chip, { CHIP_RADIUSES } from '../Chip';
|
|
8
15
|
|
|
@@ -27,6 +34,27 @@ const meta: Meta<WellProps> = {
|
|
|
27
34
|
control: 'select',
|
|
28
35
|
options: Object.values(WELL_COLORS),
|
|
29
36
|
},
|
|
37
|
+
hasRadius: {
|
|
38
|
+
control: 'boolean',
|
|
39
|
+
},
|
|
40
|
+
hasBorder: {
|
|
41
|
+
control: 'boolean',
|
|
42
|
+
},
|
|
43
|
+
hasRibbon: {
|
|
44
|
+
control: 'boolean',
|
|
45
|
+
},
|
|
46
|
+
ribbonPosition: {
|
|
47
|
+
control: 'select',
|
|
48
|
+
options: Object.values(WELL_RIBBON_POSITIONS),
|
|
49
|
+
},
|
|
50
|
+
ribbonSize: {
|
|
51
|
+
control: 'select',
|
|
52
|
+
options: Object.values(WELL_RIBBON_SIZES),
|
|
53
|
+
},
|
|
54
|
+
ribbonColor: {
|
|
55
|
+
control: 'select',
|
|
56
|
+
options: Object.values(WELL_RIBBON_COLORS),
|
|
57
|
+
},
|
|
30
58
|
content: {
|
|
31
59
|
control: 'text',
|
|
32
60
|
},
|
|
@@ -48,6 +76,13 @@ export const Interactive: Story = {
|
|
|
48
76
|
content:
|
|
49
77
|
'<h3 style="margin-top: 0">Content</h3>' +
|
|
50
78
|
'Voluptatem saepe suscipit optio et delectus esse sed velit. Autem maxime soluta aliquam perspiciatis quidem dolor saepe rerum.',
|
|
79
|
+
hasRadius: true,
|
|
80
|
+
hasBorder: false,
|
|
81
|
+
hasRibbon: false,
|
|
82
|
+
ribbonPosition: WELL_RIBBON_POSITIONS.TOP,
|
|
83
|
+
ribbonColor: WELL_RIBBON_COLORS.NEUTRAL_HEAVY,
|
|
84
|
+
ribbonSize: WELL_RIBBON_SIZES.MEDIUM,
|
|
85
|
+
color: WELL_DEFAULT_COLOR,
|
|
51
86
|
} as Args,
|
|
52
87
|
};
|
|
53
88
|
|
|
@@ -85,5 +120,59 @@ export const WithMultipleChips: Story = {
|
|
|
85
120
|
},
|
|
86
121
|
args: {
|
|
87
122
|
padding: WELL_PADDINGS.SMALL,
|
|
123
|
+
hasRadius: true,
|
|
124
|
+
hasBorder: false,
|
|
125
|
+
hasRibbon: false,
|
|
126
|
+
ribbonPosition: WELL_RIBBON_POSITIONS.TOP,
|
|
127
|
+
ribbonColor: WELL_RIBBON_COLORS.NEUTRAL_HEAVY,
|
|
128
|
+
ribbonSize: WELL_RIBBON_SIZES.MEDIUM,
|
|
129
|
+
color: WELL_DEFAULT_COLOR,
|
|
88
130
|
},
|
|
89
131
|
};
|
|
132
|
+
|
|
133
|
+
export const WithRibbon: Story = {
|
|
134
|
+
args: {
|
|
135
|
+
padding: WELL_PADDINGS.MEDIUM,
|
|
136
|
+
hasRibbon: true,
|
|
137
|
+
ribbonPosition: WELL_RIBBON_POSITIONS.TOP,
|
|
138
|
+
ribbonColor: WELL_RIBBON_COLORS.PRIMARY,
|
|
139
|
+
content:
|
|
140
|
+
'<h3 style="margin-top: 0">Content</h3>' +
|
|
141
|
+
'Voluptatem saepe suscipit optio et delectus esse sed velit. Autem maxime soluta aliquam perspiciatis quidem dolor saepe rerum.',
|
|
142
|
+
hasRadius: true,
|
|
143
|
+
hasBorder: false,
|
|
144
|
+
color: WELL_DEFAULT_COLOR,
|
|
145
|
+
} as Args,
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const WithLeftRibbonNoRadius: Story = {
|
|
149
|
+
args: {
|
|
150
|
+
padding: WELL_PADDINGS.MEDIUM,
|
|
151
|
+
hasRadius: false,
|
|
152
|
+
hasRibbon: true,
|
|
153
|
+
ribbonPosition: WELL_RIBBON_POSITIONS.LEFT,
|
|
154
|
+
ribbonColor: WELL_RIBBON_COLORS.SUCCESS,
|
|
155
|
+
content:
|
|
156
|
+
'<h3 style="margin-top: 0">Content</h3>' +
|
|
157
|
+
'Voluptatem saepe suscipit optio et delectus esse sed velit. Autem maxime soluta aliquam perspiciatis quidem dolor saepe rerum.',
|
|
158
|
+
hasBorder: false,
|
|
159
|
+
ribbonSize: WELL_RIBBON_SIZES.MEDIUM,
|
|
160
|
+
color: WELL_DEFAULT_COLOR,
|
|
161
|
+
} as Args,
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const WithBorder: Story = {
|
|
165
|
+
args: {
|
|
166
|
+
padding: WELL_PADDINGS.MEDIUM,
|
|
167
|
+
hasBorder: true,
|
|
168
|
+
color: WELL_COLORS.PRIMARY,
|
|
169
|
+
content:
|
|
170
|
+
'<h3 style="margin-top: 0">Content</h3>' +
|
|
171
|
+
'Voluptatem saepe suscipit optio et delectus esse sed velit. Autem maxime soluta aliquam perspiciatis quidem dolor saepe rerum.',
|
|
172
|
+
hasRadius: true,
|
|
173
|
+
hasRibbon: false,
|
|
174
|
+
ribbonPosition: WELL_RIBBON_POSITIONS.TOP,
|
|
175
|
+
ribbonColor: WELL_RIBBON_COLORS.NEUTRAL_HEAVY,
|
|
176
|
+
ribbonSize: WELL_RIBBON_SIZES.MEDIUM,
|
|
177
|
+
} as Args,
|
|
178
|
+
};
|
|
@@ -6,53 +6,136 @@
|
|
|
6
6
|
{
|
|
7
7
|
'-ds-medium': WELL_PADDINGS.MEDIUM === padding,
|
|
8
8
|
'-ds-small': WELL_PADDINGS.SMALL === padding,
|
|
9
|
+
'-ds-noRadius': !hasRadius,
|
|
10
|
+
'-ds-hasBorder': hasBorder,
|
|
11
|
+
'-ds-leftRibbon': hasRibbon && ribbonPosition === WELL_RIBBON_POSITIONS.LEFT,
|
|
9
12
|
},
|
|
10
13
|
]"
|
|
11
14
|
>
|
|
15
|
+
<div v-if="hasRibbon" class="ds-well__ribbon">
|
|
16
|
+
<ds-container-ribbon
|
|
17
|
+
:size="ribbonSize"
|
|
18
|
+
:color="ribbonColor"
|
|
19
|
+
:layout="ribbonLayout"
|
|
20
|
+
:radius="ribbonRadius"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
12
24
|
<div v-if="$slots.accessory" class="ds-well__accessorySlot">
|
|
13
25
|
<slot name="accessory" />
|
|
14
26
|
</div>
|
|
15
27
|
|
|
16
|
-
<
|
|
28
|
+
<div class="ds-well__content">
|
|
29
|
+
<slot />
|
|
30
|
+
</div>
|
|
17
31
|
</div>
|
|
18
32
|
</template>
|
|
19
33
|
|
|
20
34
|
<style scoped lang="scss">
|
|
21
35
|
@import '../../../styles/settings/spacings';
|
|
22
36
|
@import '../../../styles/settings/radiuses';
|
|
37
|
+
@import '../../../styles/settings/borders';
|
|
23
38
|
@import '../../../styles/settings/colors/tokens';
|
|
24
39
|
|
|
25
40
|
.ds-well {
|
|
26
41
|
$root: &;
|
|
27
42
|
|
|
28
43
|
border-radius: $radius-m;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
29
46
|
position: relative;
|
|
30
47
|
|
|
48
|
+
&.-ds-noRadius {
|
|
49
|
+
border-radius: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.-ds-leftRibbon {
|
|
53
|
+
flex-direction: row;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// box-shadow is used instead of border so the border doesn't add to the well's size
|
|
57
|
+
&.-ds-hasBorder {
|
|
58
|
+
box-shadow: inset 0 0 0 $border-xs var(--ds-well-border-color);
|
|
59
|
+
|
|
60
|
+
// when the well is square it spans edge-to-edge, so only top/bottom rules are drawn
|
|
61
|
+
&.-ds-noRadius {
|
|
62
|
+
box-shadow:
|
|
63
|
+
inset 0 $border-xs 0 0 var(--ds-well-border-color),
|
|
64
|
+
inset 0 (-$border-xs) 0 0 var(--ds-well-border-color);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
31
68
|
&.-ds-accent {
|
|
69
|
+
--ds-well-border-color: #{$color-accent-border-weak};
|
|
70
|
+
|
|
32
71
|
background-color: $color-accent-background;
|
|
33
72
|
}
|
|
34
73
|
&.-ds-primary {
|
|
74
|
+
--ds-well-border-color: #{$color-primary-border-weak};
|
|
75
|
+
|
|
35
76
|
background-color: $color-primary-background;
|
|
36
77
|
}
|
|
37
78
|
&.-ds-fail {
|
|
79
|
+
--ds-well-border-color: #{$color-fail-border-weak};
|
|
80
|
+
|
|
38
81
|
background-color: $color-fail-background;
|
|
39
82
|
}
|
|
40
83
|
&.-ds-info {
|
|
84
|
+
--ds-well-border-color: #{$color-info-border-weak};
|
|
85
|
+
|
|
41
86
|
background-color: $color-info-background;
|
|
42
87
|
}
|
|
43
88
|
&.-ds-inverted {
|
|
89
|
+
--ds-well-border-color: #{$color-neutral-border-weak};
|
|
90
|
+
|
|
44
91
|
background-color: $color-default-background;
|
|
45
92
|
}
|
|
46
93
|
&.-ds-neutral {
|
|
94
|
+
--ds-well-border-color: #{$color-neutral-border-weak};
|
|
95
|
+
|
|
47
96
|
background-color: $color-neutral-background;
|
|
48
97
|
}
|
|
49
98
|
&.-ds-success {
|
|
99
|
+
--ds-well-border-color: #{$color-success-border-weak};
|
|
100
|
+
|
|
50
101
|
background-color: $color-success-background;
|
|
51
102
|
}
|
|
52
103
|
&.-ds-warning {
|
|
104
|
+
--ds-well-border-color: #{$color-warning-border-weak};
|
|
105
|
+
|
|
53
106
|
background-color: $color-warning-background;
|
|
54
107
|
}
|
|
55
108
|
|
|
109
|
+
// the border container is added to avoid adding overflow hidden to the well itself
|
|
110
|
+
// which would clip the accessory slot rendered above its top edge
|
|
111
|
+
&__ribbon {
|
|
112
|
+
border-top-left-radius: $radius-m;
|
|
113
|
+
border-top-right-radius: $radius-m;
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-shrink: 0;
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
|
|
118
|
+
#{$root}.-ds-leftRibbon & {
|
|
119
|
+
border-bottom-left-radius: $radius-m;
|
|
120
|
+
border-top-left-radius: $radius-m;
|
|
121
|
+
border-top-right-radius: 0;
|
|
122
|
+
height: 100%;
|
|
123
|
+
left: 0;
|
|
124
|
+
position: absolute;
|
|
125
|
+
top: 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
#{$root}.-ds-noRadius & {
|
|
129
|
+
border-radius: 0;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&__content {
|
|
134
|
+
flex: 1;
|
|
135
|
+
// prevents excessive width due to child elements
|
|
136
|
+
min-width: 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
56
139
|
&__accessorySlot {
|
|
57
140
|
display: flex;
|
|
58
141
|
gap: $space-2;
|
|
@@ -62,7 +145,9 @@
|
|
|
62
145
|
}
|
|
63
146
|
|
|
64
147
|
&.-ds-medium {
|
|
65
|
-
|
|
148
|
+
#{$root}__content {
|
|
149
|
+
padding: $space-8;
|
|
150
|
+
}
|
|
66
151
|
|
|
67
152
|
#{$root}__accessorySlot {
|
|
68
153
|
right: $space-8;
|
|
@@ -70,7 +155,9 @@
|
|
|
70
155
|
}
|
|
71
156
|
|
|
72
157
|
&.-ds-small {
|
|
73
|
-
|
|
158
|
+
#{$root}__content {
|
|
159
|
+
padding: $space-6;
|
|
160
|
+
}
|
|
74
161
|
|
|
75
162
|
#{$root}__accessorySlot {
|
|
76
163
|
right: $space-6;
|
|
@@ -81,17 +168,41 @@
|
|
|
81
168
|
|
|
82
169
|
<script lang="ts" setup>
|
|
83
170
|
import { computed } from 'vue';
|
|
171
|
+
|
|
172
|
+
import DsContainerRibbon from '../ContainerRibbon/ContainerRibbon.vue';
|
|
173
|
+
import { CONTAINER_RIBBON_LAYOUTS, CONTAINER_RIBBON_RADIUSES } from '../ContainerRibbon';
|
|
84
174
|
import {
|
|
85
175
|
WELL_PADDINGS,
|
|
86
176
|
WELL_COLORS,
|
|
87
177
|
WELL_DEFAULT_COLOR,
|
|
178
|
+
WELL_RIBBON_POSITIONS,
|
|
88
179
|
WellPadding,
|
|
89
180
|
WellColor,
|
|
181
|
+
WellRibbonPosition,
|
|
182
|
+
WellRibbonSize,
|
|
183
|
+
WellRibbonColor,
|
|
184
|
+
WELL_RIBBON_SIZES,
|
|
185
|
+
WELL_RIBBON_COLORS,
|
|
90
186
|
} from './Well.consts';
|
|
91
187
|
|
|
92
|
-
const {
|
|
188
|
+
const {
|
|
189
|
+
padding = null,
|
|
190
|
+
color = WELL_DEFAULT_COLOR,
|
|
191
|
+
hasRadius = true,
|
|
192
|
+
hasBorder = false,
|
|
193
|
+
hasRibbon = false,
|
|
194
|
+
ribbonPosition = WELL_RIBBON_POSITIONS.TOP,
|
|
195
|
+
ribbonSize = WELL_RIBBON_SIZES.MEDIUM,
|
|
196
|
+
ribbonColor = WELL_RIBBON_COLORS.NEUTRAL_HEAVY,
|
|
197
|
+
} = defineProps<{
|
|
93
198
|
padding?: WellPadding | null;
|
|
94
199
|
color?: WellColor;
|
|
200
|
+
hasRadius?: boolean;
|
|
201
|
+
hasBorder?: boolean;
|
|
202
|
+
hasRibbon?: boolean;
|
|
203
|
+
ribbonPosition?: WellRibbonPosition;
|
|
204
|
+
ribbonSize?: WellRibbonSize;
|
|
205
|
+
ribbonColor?: WellRibbonColor;
|
|
95
206
|
}>();
|
|
96
207
|
|
|
97
208
|
const colorClass = computed(() => {
|
|
@@ -107,4 +218,24 @@ const colorClass = computed(() => {
|
|
|
107
218
|
};
|
|
108
219
|
return colorMap[color];
|
|
109
220
|
});
|
|
221
|
+
|
|
222
|
+
const ribbonLayout = computed(() => {
|
|
223
|
+
const layoutMap = {
|
|
224
|
+
[WELL_RIBBON_POSITIONS.TOP]: CONTAINER_RIBBON_LAYOUTS.HORIZONTAL,
|
|
225
|
+
[WELL_RIBBON_POSITIONS.LEFT]: CONTAINER_RIBBON_LAYOUTS.VERTICAL,
|
|
226
|
+
};
|
|
227
|
+
return layoutMap[ribbonPosition];
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
const ribbonRadius = computed(() => {
|
|
231
|
+
const ribbonPositionToRibbonRadiusMap = {
|
|
232
|
+
[WELL_RIBBON_POSITIONS.TOP]: CONTAINER_RIBBON_RADIUSES.BOTTOM,
|
|
233
|
+
[WELL_RIBBON_POSITIONS.LEFT]: CONTAINER_RIBBON_RADIUSES.RIGHT,
|
|
234
|
+
};
|
|
235
|
+
// when the well is rounded the outer corners are clipped by .ds-well__ribbon,
|
|
236
|
+
// so the ribbon only needs its own radius on the inner edge of a square well
|
|
237
|
+
return hasRadius
|
|
238
|
+
? CONTAINER_RIBBON_RADIUSES.NONE
|
|
239
|
+
: ribbonPositionToRibbonRadiusMap[ribbonPosition];
|
|
240
|
+
});
|
|
110
241
|
</script>
|
|
@@ -69,6 +69,7 @@ import { faCode } from '@fortawesome/pro-regular-svg-icons/faCode';
|
|
|
69
69
|
import { faCodeSimple } from '@fortawesome/pro-regular-svg-icons/faCodeSimple';
|
|
70
70
|
import { faComment } from '@fortawesome/pro-regular-svg-icons/faComment';
|
|
71
71
|
import { faCommentDots } from '@fortawesome/pro-regular-svg-icons/faCommentDots';
|
|
72
|
+
import { faCommentPlus } from '@fortawesome/pro-regular-svg-icons/faCommentPlus';
|
|
72
73
|
import { faComments } from '@fortawesome/pro-regular-svg-icons/faComments';
|
|
73
74
|
import { faCompress } from '@fortawesome/pro-regular-svg-icons/faCompress';
|
|
74
75
|
import { faCopy } from '@fortawesome/pro-regular-svg-icons/faCopy';
|
|
@@ -180,6 +181,7 @@ import { faTrophyStar } from '@fortawesome/pro-regular-svg-icons/faTrophyStar';
|
|
|
180
181
|
import { faUnlockKeyhole } from '@fortawesome/pro-regular-svg-icons/faUnlockKeyhole';
|
|
181
182
|
import { faUpload } from '@fortawesome/pro-regular-svg-icons/faUpload';
|
|
182
183
|
import { faUser } from '@fortawesome/pro-regular-svg-icons/faUser';
|
|
184
|
+
import { faPaste } from '@fortawesome/pro-regular-svg-icons/faPaste';
|
|
183
185
|
import { faWandMagicSparkles } from '@fortawesome/pro-regular-svg-icons/faWandMagicSparkles';
|
|
184
186
|
import { faSparkles } from '@fortawesome/pro-regular-svg-icons/faSparkles';
|
|
185
187
|
import { faWindowMaximize } from '@fortawesome/pro-regular-svg-icons/faWindowMaximize';
|
|
@@ -362,6 +364,7 @@ export const FONTAWESOME_ICONS = {
|
|
|
362
364
|
FA_CODE_SIMPLE: faCodeSimple,
|
|
363
365
|
FA_CODE: faCode,
|
|
364
366
|
FA_COMMENT_DOTS: faCommentDots,
|
|
367
|
+
FA_COMMENT_PLUS: faCommentPlus,
|
|
365
368
|
FA_COMMENT_SOLID: fasComment,
|
|
366
369
|
FA_COMMENT: faComment,
|
|
367
370
|
FA_COMMENTS_QUESTION_CHECK: faCommentsQuestionCheck,
|
|
@@ -464,6 +467,7 @@ export const FONTAWESOME_ICONS = {
|
|
|
464
467
|
FA_PAPER_PLANE: faPaperPlane,
|
|
465
468
|
FA_PAPERCLIP: faPaperclip,
|
|
466
469
|
FA_PARTY_HORN: faPartyHorn,
|
|
470
|
+
FA_PASTE: faPaste,
|
|
467
471
|
FA_PEN_CIRCLE: faPenCircle,
|
|
468
472
|
FA_PEN_FIELD: faPenField,
|
|
469
473
|
FA_PEN_TO_SQUARE: faPenToSquare,
|
package/lib/js/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { default as DsActionContent } from './components/ActionContent';
|
|
1
2
|
export { default as Avatar } from './components/Avatar';
|
|
2
3
|
export * from './components/Avatar/Avatar.consts';
|
|
3
4
|
export { default as Badge } from './components/Badge';
|
|
@@ -84,6 +85,7 @@ export * from './components/Headers/PageHeader/PageHeader.consts';
|
|
|
84
85
|
export { default as SectionTitle } from './components/SectionTitle/SectionTitle.vue';
|
|
85
86
|
export { default as DsSectionTitle } from './components/SectionTitle/SectionTitle.vue';
|
|
86
87
|
export * from './components/SectionTitle/SectionTitle.consts';
|
|
88
|
+
export { default as DsSpinnerLoading } from './components/SpinnerLoading/SpinnerLoading.vue';
|
|
87
89
|
export { default as Drawer } from './components/Drawer';
|
|
88
90
|
export { default as DsDrawer } from './components/Drawer';
|
|
89
91
|
export * from './components/Drawer/Drawer.consts';
|