@bethinkpl/design-system 14.1.2 → 15.0.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/dist/design-system.umd.js +496 -223
- package/dist/design-system.umd.js.map +1 -1
- package/dist/lib/js/components/Banner/Banner.stories.d.ts +56 -8
- package/dist/lib/js/components/Banner/Banner.vue.d.ts +28 -4
- package/dist/lib/js/components/Buttons/Button/Button.stories.d.ts +14 -2
- package/dist/lib/js/components/Buttons/Button/Button.vue.d.ts +7 -1
- package/dist/lib/js/components/Buttons/IconButton/IconButton.stories.d.ts +98 -14
- package/dist/lib/js/components/Buttons/IconButton/IconButton.vue.d.ts +14 -2
- package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.stories.d.ts +14 -2
- package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +7 -1
- package/dist/lib/js/components/Icons/Icon/Icon.consts.d.ts +7 -1
- package/dist/lib/js/components/Modal/Modal.vue.d.ts +7 -1
- package/dist/lib/js/components/Modals/Modal/Modal.stories.d.ts +140 -20
- package/dist/lib/js/components/Modals/Modal/Modal.vue.d.ts +28 -4
- package/dist/lib/js/components/Modals/ModalDialog/ModalDialog.stories.d.ts +112 -16
- package/dist/lib/js/components/Modals/ModalDialog/ModalDialog.vue.d.ts +28 -4
- package/dist/lib/js/components/OverlayHeader/OverlayHeader.stories.d.ts +42 -6
- package/dist/lib/js/components/OverlayHeader/OverlayHeader.vue.d.ts +21 -3
- package/dist/lib/js/components/Pagination/Pagination.stories.d.ts +42 -6
- package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +21 -3
- package/dist/lib/js/components/Pill/Pill.stories.d.ts +42 -6
- package/dist/lib/js/components/Pill/Pill.vue.d.ts +21 -3
- package/dist/lib/js/components/ProgressBar/ProgressBar.consts.d.ts +34 -13
- package/dist/lib/js/components/ProgressBar/ProgressBar.stories.d.ts +1477 -169
- package/dist/lib/js/components/ProgressBar/ProgressBar.vue.d.ts +246 -28
- package/dist/lib/js/components/SectionHeader/SectionHeader.stories.d.ts +14 -2
- package/dist/lib/js/components/SectionHeader/SectionHeader.vue.d.ts +7 -1
- package/dist/lib/js/components/SelectList/SelectListItem/SelectListItem.stories.d.ts +14 -2
- package/dist/lib/js/components/SelectList/SelectListItem/SelectListItem.vue.d.ts +7 -1
- package/dist/lib/js/components/SelectList/SelectListItemToggle/SelectListItemToggle.stories.d.ts +14 -2
- package/dist/lib/js/components/SelectList/SelectListItemToggle/SelectListItemToggle.vue.d.ts +7 -1
- package/dist/lib/js/components/Statuses/AccessStatus/AccessStatus.stories.d.ts +14 -2
- package/dist/lib/js/components/Statuses/AccessStatus/AccessStatus.vue.d.ts +7 -1
- package/dist/lib/js/components/Statuses/BlockadeStatus/BlockadeStatus.vue.d.ts +7 -1
- package/dist/lib/js/components/Statuses/BlockadeStatus/BlockedeStatus.stories.d.ts +14 -2
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.stories.d.ts +70 -10
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +35 -5
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.stories.d.ts +140 -20
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +35 -5
- package/dist/lib/js/components/Tile/Tile.consts.d.ts +1 -0
- package/dist/lib/js/components/Tile/Tile.stories.d.ts +21 -3
- package/dist/lib/js/components/Tile/Tile.vue.d.ts +7 -1
- package/dist/lib/js/icons/fontawesome.d.ts +7 -0
- package/docs/iframe.html +1 -1
- package/docs/main.a0d19173.iframe.bundle.js +1 -0
- package/docs/project.json +1 -1
- package/docs/vendors~main.09187a93.iframe.bundle.js +3 -0
- package/docs/vendors~main.09187a93.iframe.bundle.js.map +1 -0
- package/lib/js/components/Icons/Icon/Icon.consts.ts +0 -2
- package/lib/js/components/ProgressBar/ProgressBar.consts.ts +41 -15
- package/lib/js/components/ProgressBar/ProgressBar.stories.ts +37 -49
- package/lib/js/components/ProgressBar/ProgressBar.vue +169 -113
- package/lib/js/components/Tile/Tile.consts.ts +1 -0
- package/lib/js/components/Tile/Tile.vue +16 -0
- package/lib/js/icons/fontawesome.ts +14 -0
- package/package.json +1 -1
- package/docs/main.2e6f520b.iframe.bundle.js +0 -1
- package/docs/vendors~main.3e958b34.iframe.bundle.js +0 -3
- package/docs/vendors~main.3e958b34.iframe.bundle.js.map +0 -1
- package/lib/images/icons/clipboard-add.svg +0 -1
- /package/docs/{vendors~main.3e958b34.iframe.bundle.js.LICENSE.txt → vendors~main.09187a93.iframe.bundle.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendors~main.09187a93.iframe.bundle.js","sources":[],"mappings":";A","sourceRoot":""}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import ClipboardAdd from '../../../../images/icons/clipboard-add.svg';
|
|
2
1
|
import HeadWithQuestionMark from '../../../../images/icons/head-with-question-mark.svg';
|
|
3
2
|
import Ribbon from '../../../../images/icons/ribbon.svg';
|
|
4
3
|
import SlidersSearch from '../../../../images/icons/sliders-search.svg';
|
|
@@ -16,7 +15,6 @@ export const ICON_SIZES = {
|
|
|
16
15
|
};
|
|
17
16
|
|
|
18
17
|
const BETHINK_ICONS = {
|
|
19
|
-
CLIPBOARD_ADD: ClipboardAdd,
|
|
20
18
|
HEAD_WITH_QUESTION_MARK: HeadWithQuestionMark,
|
|
21
19
|
RIBBON: Ribbon,
|
|
22
20
|
SLIDERS_SEARCH: SlidersSearch,
|
|
@@ -1,7 +1,39 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const PROGRESS_BAR_RANGE_COLORS = {
|
|
2
|
+
PRIMARY_MEDIUM: 'primaryMedium',
|
|
3
|
+
PRIMARY: 'primary',
|
|
4
|
+
PRIMARY_WEAK: 'primaryWeak',
|
|
5
|
+
PRIMARY_GHOST: 'primaryGhost',
|
|
6
|
+
|
|
7
|
+
NEUTRAL_MEDIUM: 'neutralMedium',
|
|
2
8
|
NEUTRAL: 'neutral',
|
|
9
|
+
NEUTRAL_WEAK: 'neutralWeak',
|
|
10
|
+
NEUTRAL_GHOST: 'neutralGhost',
|
|
11
|
+
|
|
12
|
+
INFO_MEDIUM: 'infoMedium',
|
|
3
13
|
INFO: 'info',
|
|
14
|
+
INFO_WEAK: 'infoWeak',
|
|
15
|
+
INFO_GHOST: 'infoGhost',
|
|
16
|
+
|
|
17
|
+
SUCCESS_MEDIUM: 'successMedium',
|
|
18
|
+
SUCCESS: 'success',
|
|
19
|
+
SUCCESS_WEAK: 'successWeak',
|
|
20
|
+
SUCCESS_GHOST: 'successGhost',
|
|
21
|
+
|
|
22
|
+
WARNING_MEDIUM: 'warningMedium',
|
|
23
|
+
WARNING: 'warning',
|
|
24
|
+
WARNING_WEAK: 'warningWeak',
|
|
25
|
+
WARNING_GHOST: 'warningGhost',
|
|
26
|
+
|
|
27
|
+
FAIL_MEDIUM: 'failMedium',
|
|
28
|
+
FAIL: 'fail',
|
|
29
|
+
FAIL_WEAK: 'failWeak',
|
|
30
|
+
FAIL_GHOST: 'failGhost',
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
export const PROGRESS_BAR_BADGE_COLORS = {
|
|
4
34
|
PRIMARY: 'primary',
|
|
35
|
+
NEUTRAL: 'neutral',
|
|
36
|
+
INFO: 'info',
|
|
5
37
|
SUCCESS: 'success',
|
|
6
38
|
WARNING: 'warning',
|
|
7
39
|
FAIL: 'fail',
|
|
@@ -13,6 +45,11 @@ export const PROGRESS_BAR_SIZES = {
|
|
|
13
45
|
XSMALL: 'extra small',
|
|
14
46
|
} as const;
|
|
15
47
|
|
|
48
|
+
export const PROGRESS_BAR_LABEL_TEXT_SIZES = {
|
|
49
|
+
MEDIUM: 'medium',
|
|
50
|
+
SMALL: 'small',
|
|
51
|
+
} as const;
|
|
52
|
+
|
|
16
53
|
export const PROGRESS_BAR_RADII = {
|
|
17
54
|
DEFAULT: 'default',
|
|
18
55
|
NONE: 'none',
|
|
@@ -23,19 +60,8 @@ export const PROGRESS_BAR_LAYOUTS = {
|
|
|
23
60
|
COMPACT: 'compact',
|
|
24
61
|
};
|
|
25
62
|
|
|
26
|
-
export const PROGRESS_BAR_LAYERS = {
|
|
27
|
-
ONE: 1,
|
|
28
|
-
TWO: 2,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const PROGRESS_BAR_COLOR_SCHEMES = {
|
|
32
|
-
DEFAULT: 'default',
|
|
33
|
-
MEDIUM: 'medium',
|
|
34
|
-
MEDIUM_NEUTRAL: 'medium-neutral',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
63
|
export interface ProgressBarRange {
|
|
38
|
-
|
|
39
|
-
start:
|
|
40
|
-
length:
|
|
64
|
+
color: typeof PROGRESS_BAR_RANGE_COLORS[keyof typeof PROGRESS_BAR_RANGE_COLORS];
|
|
65
|
+
start: number;
|
|
66
|
+
length: number;
|
|
41
67
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import ProgressBar from './ProgressBar.vue';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
PROGRESS_BAR_RANGE_COLORS,
|
|
4
4
|
PROGRESS_BAR_SIZES,
|
|
5
5
|
PROGRESS_BAR_LAYOUTS,
|
|
6
6
|
PROGRESS_BAR_RADII,
|
|
7
|
-
PROGRESS_BAR_LAYERS,
|
|
8
|
-
PROGRESS_BAR_COLOR_SCHEMES,
|
|
9
7
|
ProgressBarRange,
|
|
8
|
+
PROGRESS_BAR_LABEL_TEXT_SIZES,
|
|
9
|
+
PROGRESS_BAR_BADGE_COLORS,
|
|
10
10
|
} from './ProgressBar.consts';
|
|
11
11
|
|
|
12
12
|
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue';
|
|
@@ -19,43 +19,39 @@ export default {
|
|
|
19
19
|
const StoryTemplate: StoryFn<typeof ProgressBar> = (argTypes) => ({
|
|
20
20
|
components: { ProgressBar },
|
|
21
21
|
props: Object.keys(argTypes),
|
|
22
|
-
template:
|
|
22
|
+
template: `
|
|
23
|
+
<ProgressBar
|
|
24
|
+
v-bind=$props
|
|
25
|
+
:badge-position="(typeof ($props.badgePosition) === 'undefined' || $props.badgePosition === '') ? null : parseInt($props.badgePosition, 10)"
|
|
26
|
+
/>`,
|
|
23
27
|
});
|
|
24
28
|
|
|
25
29
|
export const Interactive = StoryTemplate.bind({});
|
|
26
30
|
|
|
27
31
|
const argTypes = {
|
|
28
|
-
numberOfLayers: {
|
|
29
|
-
control: { type: 'select', options: Object.values(PROGRESS_BAR_LAYERS) },
|
|
30
|
-
defaultValue: PROGRESS_BAR_LAYERS.ONE,
|
|
31
|
-
},
|
|
32
|
-
colorScheme: {
|
|
33
|
-
control: { type: 'select', options: Object.values(PROGRESS_BAR_COLOR_SCHEMES) },
|
|
34
|
-
defaultValue: PROGRESS_BAR_COLOR_SCHEMES.DEFAULT,
|
|
35
|
-
},
|
|
36
|
-
color: {
|
|
37
|
-
control: { type: 'select', options: Object.values(PROGRESS_BAR_COLORS) },
|
|
38
|
-
defaultValue: PROGRESS_BAR_COLORS.INFO,
|
|
39
|
-
},
|
|
40
32
|
size: {
|
|
41
33
|
control: { type: 'select', options: Object.values(PROGRESS_BAR_SIZES) },
|
|
42
|
-
defaultValue: PROGRESS_BAR_SIZES.
|
|
34
|
+
defaultValue: PROGRESS_BAR_SIZES.SMALL,
|
|
35
|
+
},
|
|
36
|
+
labelTextSize: {
|
|
37
|
+
control: { type: 'select', options: Object.values(PROGRESS_BAR_LABEL_TEXT_SIZES) },
|
|
38
|
+
defaultValue: PROGRESS_BAR_LABEL_TEXT_SIZES.SMALL,
|
|
43
39
|
},
|
|
44
40
|
ranges: {
|
|
45
41
|
control: { type: 'array' },
|
|
46
42
|
defaultValue: [
|
|
47
43
|
{
|
|
48
|
-
|
|
44
|
+
color: PROGRESS_BAR_RANGE_COLORS.INFO,
|
|
49
45
|
start: 0,
|
|
50
46
|
length: 30,
|
|
51
47
|
} as ProgressBarRange,
|
|
52
48
|
{
|
|
53
|
-
|
|
49
|
+
color: PROGRESS_BAR_RANGE_COLORS.INFO_WEAK,
|
|
54
50
|
start: 30,
|
|
55
51
|
length: 10,
|
|
56
52
|
} as ProgressBarRange,
|
|
57
53
|
{
|
|
58
|
-
|
|
54
|
+
color: PROGRESS_BAR_RANGE_COLORS.INFO_GHOST,
|
|
59
55
|
start: 40,
|
|
60
56
|
length: 10,
|
|
61
57
|
} as ProgressBarRange,
|
|
@@ -85,6 +81,15 @@ const argTypes = {
|
|
|
85
81
|
control: { type: 'text' },
|
|
86
82
|
defaultValue: '(%)',
|
|
87
83
|
},
|
|
84
|
+
badgePosition: {
|
|
85
|
+
// we use `text` type, because Storybook doesn't allow empty field in `number` type which imitates null
|
|
86
|
+
control: { type: 'text' },
|
|
87
|
+
defaultValue: '50',
|
|
88
|
+
},
|
|
89
|
+
badgeColor: {
|
|
90
|
+
control: { type: 'select', options: Object.values(PROGRESS_BAR_BADGE_COLORS) },
|
|
91
|
+
defaultValue: PROGRESS_BAR_BADGE_COLORS.INFO,
|
|
92
|
+
},
|
|
88
93
|
} as ArgTypes;
|
|
89
94
|
|
|
90
95
|
Interactive.argTypes = argTypes;
|
|
@@ -96,90 +101,74 @@ Interactive.parameters = {
|
|
|
96
101
|
},
|
|
97
102
|
};
|
|
98
103
|
|
|
99
|
-
const argTypesColorOnly = {
|
|
100
|
-
color: {
|
|
101
|
-
control: { type: 'select', options: Object.values(PROGRESS_BAR_COLORS) },
|
|
102
|
-
defaultValue: PROGRESS_BAR_COLORS.INFO,
|
|
103
|
-
},
|
|
104
|
-
} as ArgTypes;
|
|
105
|
-
|
|
106
104
|
export const WithoutLabels = StoryTemplate.bind({});
|
|
107
105
|
|
|
108
106
|
WithoutLabels.args = {
|
|
109
|
-
color: PROGRESS_BAR_COLORS.PRIMARY,
|
|
110
107
|
ranges: [
|
|
111
108
|
{
|
|
112
|
-
|
|
109
|
+
color: PROGRESS_BAR_RANGE_COLORS.INFO,
|
|
113
110
|
start: 0,
|
|
114
111
|
length: 30,
|
|
115
112
|
} as ProgressBarRange,
|
|
116
113
|
],
|
|
117
114
|
} as Args;
|
|
118
|
-
WithoutLabels.argTypes = argTypesColorOnly;
|
|
119
115
|
|
|
120
|
-
export const
|
|
116
|
+
export const TwoColors = StoryTemplate.bind({});
|
|
121
117
|
|
|
122
|
-
|
|
123
|
-
color: PROGRESS_BAR_COLORS.PRIMARY,
|
|
124
|
-
numberOfLayers: 2,
|
|
118
|
+
TwoColors.args = {
|
|
125
119
|
ranges: [
|
|
126
120
|
{
|
|
127
|
-
|
|
121
|
+
color: PROGRESS_BAR_RANGE_COLORS.INFO,
|
|
128
122
|
start: 0,
|
|
129
123
|
length: 30,
|
|
130
124
|
} as ProgressBarRange,
|
|
131
125
|
{
|
|
132
|
-
|
|
126
|
+
color: PROGRESS_BAR_RANGE_COLORS.WARNING,
|
|
133
127
|
start: 30,
|
|
134
128
|
length: 30,
|
|
135
129
|
} as ProgressBarRange,
|
|
136
130
|
],
|
|
137
131
|
} as Args;
|
|
138
|
-
TwoLayers.argTypes = argTypesColorOnly;
|
|
139
132
|
|
|
140
133
|
export const WithGaps = StoryTemplate.bind({});
|
|
141
134
|
|
|
142
135
|
WithGaps.args = {
|
|
143
|
-
color: PROGRESS_BAR_COLORS.PRIMARY,
|
|
144
|
-
numberOfLayers: 2,
|
|
145
136
|
ranges: [
|
|
146
137
|
{
|
|
147
|
-
|
|
138
|
+
color: PROGRESS_BAR_RANGE_COLORS.INFO,
|
|
148
139
|
start: 0,
|
|
149
140
|
length: 10,
|
|
150
141
|
} as ProgressBarRange,
|
|
151
142
|
{
|
|
152
|
-
|
|
143
|
+
color: PROGRESS_BAR_RANGE_COLORS.INFO_WEAK,
|
|
153
144
|
start: 20,
|
|
154
145
|
length: 10,
|
|
155
146
|
} as ProgressBarRange,
|
|
156
147
|
{
|
|
157
|
-
|
|
148
|
+
color: PROGRESS_BAR_RANGE_COLORS.INFO,
|
|
158
149
|
start: 40,
|
|
159
150
|
length: 10,
|
|
160
151
|
} as ProgressBarRange,
|
|
161
152
|
{
|
|
162
|
-
|
|
153
|
+
color: PROGRESS_BAR_RANGE_COLORS.INFO_WEAK,
|
|
163
154
|
start: 50,
|
|
164
155
|
length: 10,
|
|
165
156
|
} as ProgressBarRange,
|
|
166
157
|
{
|
|
167
|
-
|
|
158
|
+
color: PROGRESS_BAR_RANGE_COLORS.INFO,
|
|
168
159
|
start: 70,
|
|
169
|
-
length:
|
|
160
|
+
length: 30,
|
|
170
161
|
} as ProgressBarRange,
|
|
171
162
|
],
|
|
172
163
|
} as Args;
|
|
173
|
-
WithGaps.argTypes = argTypesColorOnly;
|
|
174
164
|
|
|
175
165
|
export const Compact = StoryTemplate.bind({});
|
|
176
166
|
|
|
177
167
|
Compact.args = {
|
|
178
|
-
color: PROGRESS_BAR_COLORS.PRIMARY,
|
|
179
168
|
layout: PROGRESS_BAR_LAYOUTS.COMPACT,
|
|
180
169
|
ranges: [
|
|
181
170
|
{
|
|
182
|
-
|
|
171
|
+
color: PROGRESS_BAR_RANGE_COLORS.INFO,
|
|
183
172
|
start: 0,
|
|
184
173
|
length: 30,
|
|
185
174
|
} as ProgressBarRange,
|
|
@@ -189,4 +178,3 @@ Compact.args = {
|
|
|
189
178
|
labelDataSupporting: '100',
|
|
190
179
|
labelDataSuffix: '(%)',
|
|
191
180
|
} as Args;
|
|
192
|
-
Compact.argTypes = argTypesColorOnly;
|
|
@@ -2,19 +2,16 @@
|
|
|
2
2
|
<div
|
|
3
3
|
:class="{
|
|
4
4
|
progressBar: true,
|
|
5
|
-
'-primary': color === PROGRESS_BAR_COLORS.PRIMARY,
|
|
6
|
-
'-warning': color === PROGRESS_BAR_COLORS.WARNING,
|
|
7
|
-
'-fail': color === PROGRESS_BAR_COLORS.FAIL,
|
|
8
|
-
'-success': color === PROGRESS_BAR_COLORS.SUCCESS,
|
|
9
|
-
'-neutral': color === PROGRESS_BAR_COLORS.NEUTRAL,
|
|
10
|
-
'-info': color === PROGRESS_BAR_COLORS.INFO,
|
|
11
|
-
'-schemeMedium': colorScheme === PROGRESS_BAR_COLOR_SCHEMES.MEDIUM,
|
|
12
|
-
'-schemeMediumNeutral': colorScheme === PROGRESS_BAR_COLOR_SCHEMES.MEDIUM_NEUTRAL,
|
|
13
5
|
'-compact': layout === PROGRESS_BAR_LAYOUTS.COMPACT,
|
|
14
6
|
}"
|
|
15
7
|
>
|
|
16
8
|
<div class="progressBar__label">
|
|
17
|
-
<div
|
|
9
|
+
<div
|
|
10
|
+
class="progressBar__labelText"
|
|
11
|
+
:class="{ '-medium': labelTextSize === PROGRESS_BAR_LABEL_TEXT_SIZES.MEDIUM }"
|
|
12
|
+
>
|
|
13
|
+
{{ labelText }}
|
|
14
|
+
</div>
|
|
18
15
|
<div v-if="labelDataExists" class="progressBar__labelDataWrapper">
|
|
19
16
|
<span v-if="labelData" class="progressBar__labelData">{{ labelData }}</span>
|
|
20
17
|
<span v-if="labelDataSupporting" class="progressBar__labelDataSupporting">
|
|
@@ -27,21 +24,38 @@
|
|
|
27
24
|
</div>
|
|
28
25
|
</div>
|
|
29
26
|
<div
|
|
27
|
+
class="progressBar__barWrapper"
|
|
30
28
|
:class="{
|
|
31
|
-
progressBar__bar: true,
|
|
32
29
|
'-small': size === PROGRESS_BAR_SIZES.SMALL,
|
|
33
30
|
'-xsmall': size === PROGRESS_BAR_SIZES.XSMALL,
|
|
34
|
-
'-noRadius': radius === PROGRESS_BAR_RADII.NONE,
|
|
35
31
|
}"
|
|
36
32
|
>
|
|
37
33
|
<div
|
|
38
|
-
|
|
39
|
-
:
|
|
34
|
+
class="progressBar__bar"
|
|
35
|
+
:class="{
|
|
36
|
+
'-noRadius': radius === PROGRESS_BAR_RADII.NONE,
|
|
37
|
+
}"
|
|
38
|
+
>
|
|
39
|
+
<div
|
|
40
|
+
v-for="(range, index) in ranges"
|
|
41
|
+
:key="index"
|
|
42
|
+
class="progressBar__range"
|
|
43
|
+
:class="`-${range.color}`"
|
|
44
|
+
:style="{ left: range.start + '%', width: range.length + '%' }"
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
<ds-icon
|
|
48
|
+
v-if="badgePosition !== null"
|
|
49
|
+
class="progressBar__badge"
|
|
40
50
|
:class="{
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
'-small': size !== PROGRESS_BAR_SIZES.MEDIUM,
|
|
52
|
+
[`-${badgeColor}`]: true,
|
|
43
53
|
}"
|
|
44
|
-
:style="
|
|
54
|
+
:style="`left: ${badgePosition}%`"
|
|
55
|
+
:icon="ICONS.FA_LOCATION_DOT"
|
|
56
|
+
:size="
|
|
57
|
+
size === PROGRESS_BAR_SIZES.MEDIUM ? ICON_SIZES.XX_SMALL : ICON_SIZES.XXX_SMALL
|
|
58
|
+
"
|
|
45
59
|
/>
|
|
46
60
|
</div>
|
|
47
61
|
</div>
|
|
@@ -63,100 +77,82 @@ $progress-bar-border-radius: 8px;
|
|
|
63
77
|
$progress-bar-label-text-max-width: 70%;
|
|
64
78
|
$progress-bar-label-data-max-width: 30%;
|
|
65
79
|
|
|
66
|
-
$progress-bar-
|
|
80
|
+
$progress-bar-badge-size: 24px;
|
|
81
|
+
$progress-bar-badge-size-small: 16px;
|
|
82
|
+
|
|
83
|
+
$progress-bar-range-colors: (
|
|
84
|
+
'primaryMedium': $color-primary-data-medium,
|
|
85
|
+
'primary': $color-primary-data,
|
|
86
|
+
'primaryWeak': $color-primary-data-weak,
|
|
87
|
+
'primaryGhost': $color-primary-data-ghost,
|
|
88
|
+
'neutralMedium': $color-neutral-data-medium,
|
|
89
|
+
'neutral': $color-neutral-data,
|
|
90
|
+
'neutralWeak': $color-neutral-data-weak,
|
|
91
|
+
'neutralGhost': $color-neutral-data-ghost,
|
|
92
|
+
'infoMedium': $color-info-data-medium,
|
|
93
|
+
'info': $color-info-data,
|
|
94
|
+
'infoWeak': $color-info-data-weak,
|
|
95
|
+
'infoGhost': $color-info-data-ghost,
|
|
96
|
+
'successMedium': $color-success-data-medium,
|
|
97
|
+
'success': $color-success-data,
|
|
98
|
+
'successWeak': $color-success-data-weak,
|
|
99
|
+
'successGhost': $color-success-data-ghost,
|
|
100
|
+
'warningMedium': $color-warning-data-medium,
|
|
101
|
+
'warning': $color-warning-data,
|
|
102
|
+
'warningWeak': $color-warning-data-weak,
|
|
103
|
+
'warningGhost': $color-warning-data-ghost,
|
|
104
|
+
'failMedium': $color-fail-data-medium,
|
|
105
|
+
'fail': $color-fail-data,
|
|
106
|
+
'failWeak': $color-fail-data-weak,
|
|
107
|
+
'failGhost': $color-fail-data-ghost,
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
$progress-bar-badge-colors: (
|
|
67
111
|
'primary': (
|
|
68
|
-
'
|
|
69
|
-
'
|
|
70
|
-
'medium-color-scheme-first-layer': $color-primary-data-medium,
|
|
71
|
-
'medium-color-scheme-second-layer': $color-primary-data-weak,
|
|
72
|
-
'medium-neutral-color-scheme-second-layer': $color-neutral-data-weak,
|
|
73
|
-
),
|
|
74
|
-
'info': (
|
|
75
|
-
'default-color-scheme-first-layer': $color-info-data,
|
|
76
|
-
'default-color-scheme-second-layer': $color-info-data-ghost,
|
|
77
|
-
'medium-color-scheme-first-layer': $color-info-data-medium,
|
|
78
|
-
'medium-color-scheme-second-layer': $color-info-data-weak,
|
|
79
|
-
'medium-neutral-color-scheme-second-layer': $color-neutral-data-weak,
|
|
112
|
+
'background': $color-primary-background-medium,
|
|
113
|
+
'icon': $color-primary-icon,
|
|
80
114
|
),
|
|
81
115
|
'neutral': (
|
|
82
|
-
'
|
|
83
|
-
'
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
'
|
|
116
|
+
'background': $color-neutral-background-medium,
|
|
117
|
+
'icon': $color-neutral-icon,
|
|
118
|
+
),
|
|
119
|
+
'info': (
|
|
120
|
+
'background': $color-info-background-medium,
|
|
121
|
+
'icon': $color-info-icon,
|
|
87
122
|
),
|
|
88
123
|
'success': (
|
|
89
|
-
'
|
|
90
|
-
'
|
|
91
|
-
'medium-color-scheme-first-layer': $color-success-data-medium,
|
|
92
|
-
'medium-color-scheme-second-layer': $color-success-data-weak,
|
|
93
|
-
'medium-neutral-color-scheme-second-layer': $color-neutral-data-weak,
|
|
124
|
+
'background': $color-success-background-medium,
|
|
125
|
+
'icon': $color-success-icon,
|
|
94
126
|
),
|
|
95
127
|
'warning': (
|
|
96
|
-
'
|
|
97
|
-
'
|
|
98
|
-
'medium-color-scheme-first-layer': $color-warning-data-medium,
|
|
99
|
-
'medium-color-scheme-second-layer': $color-warning-data-weak,
|
|
100
|
-
'medium-neutral-color-scheme-second-layer': $color-neutral-data-weak,
|
|
128
|
+
'background': $color-warning-background-medium,
|
|
129
|
+
'icon': $color-warning-icon,
|
|
101
130
|
),
|
|
102
131
|
'fail': (
|
|
103
|
-
'
|
|
104
|
-
'
|
|
105
|
-
'medium-color-scheme-first-layer': $color-fail-data-medium,
|
|
106
|
-
'medium-color-scheme-second-layer': $color-fail-data-weak,
|
|
107
|
-
'medium-neutral-color-scheme-second-layer': $color-neutral-data-weak,
|
|
132
|
+
'background': $color-fail-background-medium,
|
|
133
|
+
'icon': $color-fail-icon,
|
|
108
134
|
),
|
|
109
135
|
);
|
|
110
136
|
|
|
111
137
|
.progressBar {
|
|
112
138
|
$self: &;
|
|
113
139
|
|
|
114
|
-
@each $color-name, $color-map in $progress-bar-layers {
|
|
115
|
-
&.-#{$color-name} {
|
|
116
|
-
#{$self}__result {
|
|
117
|
-
background: map-get($color-map, 'default-color-scheme-first-layer');
|
|
118
|
-
|
|
119
|
-
&.-secondary {
|
|
120
|
-
background: map-get($color-map, 'default-color-scheme-second-layer');
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
&.-schemeMedium {
|
|
125
|
-
#{$self}__result {
|
|
126
|
-
background: map-get($color-map, 'medium-color-scheme-first-layer');
|
|
127
|
-
|
|
128
|
-
&.-secondary {
|
|
129
|
-
background: map-get($color-map, 'medium-color-scheme-second-layer');
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
&.-schemeMediumNeutral {
|
|
135
|
-
#{$self}__result {
|
|
136
|
-
background: map-get($color-map, 'medium-color-scheme-first-layer');
|
|
137
|
-
|
|
138
|
-
&.-secondary {
|
|
139
|
-
background: map-get($color-map, 'medium-neutral-color-scheme-second-layer');
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
140
|
&.-compact {
|
|
147
141
|
#{$self}__labelText {
|
|
148
142
|
@include label-m-default-bold;
|
|
143
|
+
|
|
144
|
+
&.-medium {
|
|
145
|
+
@include label-l-default-bold;
|
|
146
|
+
}
|
|
149
147
|
}
|
|
148
|
+
|
|
150
149
|
#{$self}__label {
|
|
151
150
|
margin-bottom: $space-xxxs;
|
|
152
151
|
}
|
|
153
152
|
}
|
|
154
153
|
|
|
155
|
-
&
|
|
156
|
-
background-color: $color-default-background;
|
|
157
|
-
border-radius: $progress-bar-border-radius;
|
|
154
|
+
&__barWrapper {
|
|
158
155
|
height: $progress-bar-height;
|
|
159
|
-
overflow: hidden;
|
|
160
156
|
position: relative;
|
|
161
157
|
|
|
162
158
|
&.-small {
|
|
@@ -166,10 +162,18 @@ $progress-bar-layers: (
|
|
|
166
162
|
&.-xsmall {
|
|
167
163
|
height: $progress-bar-xs-height;
|
|
168
164
|
|
|
169
|
-
|
|
165
|
+
#{$self}__bar::after {
|
|
170
166
|
box-shadow: $shadow-inset-s;
|
|
171
167
|
}
|
|
172
168
|
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&__bar {
|
|
172
|
+
background-color: $color-default-background;
|
|
173
|
+
border-radius: $progress-bar-border-radius;
|
|
174
|
+
height: 100%;
|
|
175
|
+
overflow: hidden;
|
|
176
|
+
position: relative;
|
|
173
177
|
|
|
174
178
|
&.-noRadius {
|
|
175
179
|
border-radius: 0;
|
|
@@ -207,6 +211,14 @@ $progress-bar-layers: (
|
|
|
207
211
|
@media #{breakpoint-s()} {
|
|
208
212
|
@include label-l-default-bold;
|
|
209
213
|
}
|
|
214
|
+
|
|
215
|
+
&.-medium {
|
|
216
|
+
@include label-l-default-bold;
|
|
217
|
+
|
|
218
|
+
@media #{breakpoint-s()} {
|
|
219
|
+
@include label-xl-default-bold;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
210
222
|
}
|
|
211
223
|
|
|
212
224
|
&__labelDataWrapper {
|
|
@@ -239,60 +251,90 @@ $progress-bar-layers: (
|
|
|
239
251
|
margin-left: $space-xxxxs;
|
|
240
252
|
}
|
|
241
253
|
|
|
242
|
-
&
|
|
254
|
+
&__range {
|
|
255
|
+
@each $class, $color-name in $progress-bar-range-colors {
|
|
256
|
+
&.-#{$class} {
|
|
257
|
+
background: $color-name;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
243
261
|
height: 100%;
|
|
244
262
|
position: absolute;
|
|
245
263
|
top: 0;
|
|
246
264
|
}
|
|
265
|
+
|
|
266
|
+
&__badge {
|
|
267
|
+
@each $class, $colors-map in $progress-bar-badge-colors {
|
|
268
|
+
&.-#{$class} {
|
|
269
|
+
background: map-get($colors-map, 'background');
|
|
270
|
+
color: map-get($colors-map, 'icon');
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
align-items: center;
|
|
275
|
+
border-radius: 50%;
|
|
276
|
+
border: 1px solid $color-inverted-border;
|
|
277
|
+
display: flex;
|
|
278
|
+
height: $progress-bar-badge-size;
|
|
279
|
+
justify-content: center;
|
|
280
|
+
margin-left: -$progress-bar-badge-size / 2;
|
|
281
|
+
margin-top: -$progress-bar-badge-size / 2;
|
|
282
|
+
position: absolute;
|
|
283
|
+
top: 50%;
|
|
284
|
+
width: $progress-bar-badge-size;
|
|
285
|
+
|
|
286
|
+
&.-small {
|
|
287
|
+
height: $progress-bar-badge-size-small;
|
|
288
|
+
margin-left: -$progress-bar-badge-size-small / 2;
|
|
289
|
+
margin-top: -$progress-bar-badge-size-small / 2;
|
|
290
|
+
width: $progress-bar-badge-size-small;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
247
293
|
}
|
|
248
294
|
</style>
|
|
249
295
|
|
|
250
296
|
<script lang="ts">
|
|
251
297
|
import { PropType } from 'vue';
|
|
252
298
|
import {
|
|
253
|
-
PROGRESS_BAR_COLORS,
|
|
254
299
|
PROGRESS_BAR_SIZES,
|
|
255
300
|
PROGRESS_BAR_RADII,
|
|
256
301
|
PROGRESS_BAR_LAYOUTS,
|
|
257
|
-
PROGRESS_BAR_COLOR_SCHEMES,
|
|
258
|
-
PROGRESS_BAR_LAYERS,
|
|
259
302
|
ProgressBarRange,
|
|
303
|
+
PROGRESS_BAR_LABEL_TEXT_SIZES,
|
|
304
|
+
PROGRESS_BAR_BADGE_COLORS,
|
|
260
305
|
} from './ProgressBar.consts';
|
|
261
306
|
|
|
307
|
+
import DsIcon, { ICONS, ICON_SIZES } from '../Icons/Icon';
|
|
308
|
+
|
|
262
309
|
export default {
|
|
263
310
|
name: 'ProgressBar',
|
|
311
|
+
components: {
|
|
312
|
+
DsIcon,
|
|
313
|
+
},
|
|
264
314
|
props: {
|
|
265
|
-
|
|
266
|
-
type: Number,
|
|
267
|
-
default: PROGRESS_BAR_LAYERS.ONE,
|
|
268
|
-
validator(size) {
|
|
269
|
-
return Object.values(PROGRESS_BAR_LAYERS).includes(size);
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
colorScheme: {
|
|
315
|
+
size: {
|
|
273
316
|
type: String,
|
|
274
|
-
default:
|
|
317
|
+
default: PROGRESS_BAR_SIZES.SMALL,
|
|
275
318
|
validator(size) {
|
|
276
|
-
return Object.values(
|
|
277
|
-
},
|
|
278
|
-
},
|
|
279
|
-
color: {
|
|
280
|
-
type: String,
|
|
281
|
-
default: PROGRESS_BAR_COLORS.INFO,
|
|
282
|
-
validator(color) {
|
|
283
|
-
return Object.values(PROGRESS_BAR_COLORS).includes(color);
|
|
319
|
+
return Object.values(PROGRESS_BAR_SIZES).includes(size);
|
|
284
320
|
},
|
|
285
321
|
},
|
|
286
|
-
|
|
322
|
+
labelTextSize: {
|
|
287
323
|
type: String,
|
|
288
|
-
default:
|
|
324
|
+
default: PROGRESS_BAR_LABEL_TEXT_SIZES.SMALL,
|
|
289
325
|
validator(size) {
|
|
290
|
-
return Object.values(
|
|
326
|
+
return Object.values(PROGRESS_BAR_LABEL_TEXT_SIZES).includes(size);
|
|
291
327
|
},
|
|
292
328
|
},
|
|
293
329
|
ranges: {
|
|
294
330
|
type: Array as PropType<Array<ProgressBarRange>>,
|
|
295
331
|
required: true,
|
|
332
|
+
validator(ranges) {
|
|
333
|
+
return ranges.every(
|
|
334
|
+
(range: ProgressBarRange) =>
|
|
335
|
+
range.start >= 0 && range.length >= 0 && range.start + range.length <= 100,
|
|
336
|
+
);
|
|
337
|
+
},
|
|
296
338
|
},
|
|
297
339
|
radius: {
|
|
298
340
|
type: String,
|
|
@@ -324,15 +366,29 @@ export default {
|
|
|
324
366
|
type: String,
|
|
325
367
|
default: null,
|
|
326
368
|
},
|
|
369
|
+
badgePosition: {
|
|
370
|
+
type: Number,
|
|
371
|
+
default: null,
|
|
372
|
+
validator(position) {
|
|
373
|
+
return position >= 0 && position <= 100;
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
badgeColor: {
|
|
377
|
+
type: String,
|
|
378
|
+
default: PROGRESS_BAR_BADGE_COLORS.INFO,
|
|
379
|
+
validator(color) {
|
|
380
|
+
return Object.values(PROGRESS_BAR_BADGE_COLORS).includes(color);
|
|
381
|
+
},
|
|
382
|
+
},
|
|
327
383
|
},
|
|
328
384
|
data() {
|
|
329
385
|
return {
|
|
330
|
-
PROGRESS_BAR_COLORS: Object.freeze(PROGRESS_BAR_COLORS),
|
|
331
386
|
PROGRESS_BAR_SIZES: Object.freeze(PROGRESS_BAR_SIZES),
|
|
332
387
|
PROGRESS_BAR_RADII: Object.freeze(PROGRESS_BAR_RADII),
|
|
333
388
|
PROGRESS_BAR_LAYOUTS: Object.freeze(PROGRESS_BAR_LAYOUTS),
|
|
334
|
-
|
|
335
|
-
|
|
389
|
+
PROGRESS_BAR_LABEL_TEXT_SIZES: Object.freeze(PROGRESS_BAR_LABEL_TEXT_SIZES),
|
|
390
|
+
ICONS: Object.freeze(ICONS),
|
|
391
|
+
ICON_SIZES: Object.freeze(ICON_SIZES),
|
|
336
392
|
};
|
|
337
393
|
},
|
|
338
394
|
computed: {
|