@bethinkpl/design-system 22.0.4 → 22.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/.eslintrc.js +1 -10
- package/dist/design-system.umd.js +282 -206
- package/dist/design-system.umd.js.map +1 -1
- package/dist/lib/js/components/Banner/Banner.vue.d.ts +8 -6
- package/dist/lib/js/components/Buttons/Button/Button.vue.d.ts +8 -6
- package/dist/lib/js/components/Buttons/IconButton/IconButton.vue.d.ts +8 -6
- package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +8 -6
- package/dist/lib/js/components/Chip/Chip.vue.d.ts +8 -6
- package/dist/lib/js/components/Drawer/DrawerContent/DrawerContent.vue.d.ts +4 -3
- package/dist/lib/js/components/Drawer/DrawerDivider/DrawerDivider.vue.d.ts +20 -3
- package/dist/lib/js/components/Drawer/DrawerHeader/DrawerHeader.vue.d.ts +287 -3
- package/dist/lib/js/components/Drawer/DrawerListItem/DrawerListItem.vue.d.ts +233 -3
- package/dist/lib/js/components/Drawer/DrawerListItemGroup/DrawerListItemGroup.vue.d.ts +4 -3
- package/dist/lib/js/components/Drawer/DrawerSection/DrawerSection.vue.d.ts +292 -3
- package/dist/lib/js/components/Drawer/DrawerTile/DrawerTile.vue.d.ts +63 -3
- package/dist/lib/js/components/Form/Checkbox/Checkbox.vue.d.ts +8 -6
- package/dist/lib/js/components/Form/RadioButton/RadioButton.vue.d.ts +8 -6
- package/dist/lib/js/components/Headers/OverlayHeader/OverlayHeader.vue.d.ts +8 -6
- package/dist/lib/js/components/Headers/SectionHeader/SectionHeader.vue.d.ts +8 -6
- package/dist/lib/js/components/Icons/Icon/Icon.consts.d.ts +8 -7
- package/dist/lib/js/components/Modal/Modal.vue.d.ts +8 -6
- package/dist/lib/js/components/Modals/Modal/Modal.vue.d.ts +8 -6
- package/dist/lib/js/components/Outline/OutlineItem/OutlineItem.vue.d.ts +8 -6
- package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +8 -6
- package/dist/lib/js/components/ProgressBar/ProgressBar.vue.d.ts +8 -6
- package/dist/lib/js/components/ProgressDonutChart/ProgressDonutChart.vue.d.ts +8 -6
- package/dist/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.vue.d.ts +1 -1
- package/dist/lib/js/components/RichList/RichListItem/RichListItem.vue.d.ts +9 -7
- package/dist/lib/js/components/SelectList/SelectList.vue.d.ts +4 -3
- package/dist/lib/js/components/SelectList/SelectListItem/SelectListItem.vue.d.ts +263 -3
- package/dist/lib/js/components/SelectList/SelectListItemDivider/SelectListItemDivider.vue.d.ts +8 -3
- package/dist/lib/js/components/SelectList/SelectListItemTile/SelectListItemTile.vue.d.ts +62 -3
- package/dist/lib/js/components/SelectList/SelectListItemToggle/SelectListItemToggle.vue.d.ts +58 -3
- package/dist/lib/js/components/SelectList/SelectListSectionTitle/SelectListSectionTitle.vue.d.ts +14 -3
- package/dist/lib/js/components/SelectionTile/SelectionTile.vue.d.ts +10 -8
- package/dist/lib/js/components/Statuses/AccessStatus/AccessStatus.vue.d.ts +8 -6
- package/dist/lib/js/components/Statuses/BlockadeStatus/BlockadeStatus.vue.d.ts +8 -6
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +8 -6
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +8 -6
- package/dist/lib/js/components/Switch/Switch.vue.d.ts +10 -8
- package/dist/lib/js/components/Tile/Tile.sb.shared.d.ts +8 -6
- package/dist/lib/js/components/Tile/Tile.vue.d.ts +8 -6
- package/dist/lib/js/components/Toast/Toast.consts.d.ts +21 -0
- package/dist/lib/js/components/Toast/Toast.stories.d.ts +5 -0
- package/dist/lib/js/components/Toggles/ToggleButton/ToggleButton.vue.d.ts +11 -9
- package/dist/lib/js/icons/fontawesome.d.ts +2 -0
- package/dist/lib/js/styles/Borders/BorderSizes.stories.d.ts +4 -0
- package/docs/54.c8325f44.iframe.bundle.js +2 -0
- package/docs/iframe.html +1 -1
- package/docs/main.8dfbddcf.iframe.bundle.js +1 -0
- package/docs/project.json +1 -1
- package/lib/js/components/Cards/Card/Card.vue +3 -3
- package/lib/js/components/Drawer/DrawerSection/DrawerSection.vue +2 -2
- package/lib/js/components/Form/Checkbox/Checkbox.vue +2 -2
- package/lib/js/components/Form/RadioButton/RadioButton.vue +2 -2
- package/lib/js/components/Form/SelectionControl/SelectionControl.sb.shared.ts +1 -1
- package/lib/js/components/Form/SelectionControl/SelectionControl.vue +2 -2
- package/lib/js/components/Headers/OverlayHeader/OverlayHeader.vue +1 -1
- package/lib/js/components/PopOver/PopOver.vue +42 -44
- package/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.stories.ts +2 -2
- package/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.vue +2 -2
- package/lib/js/components/RichList/RichListItem/RichListItem.stories.ts +2 -2
- package/lib/js/components/RichList/RichListItem/RichListItem.vue +2 -2
- package/lib/js/components/SelectionTile/SelectionTile.stories.ts +1 -1
- package/lib/js/components/SelectionTile/SelectionTile.vue +3 -3
- package/lib/js/components/Toast/Toast.consts.ts +27 -0
- package/lib/js/components/Toast/Toast.stories.ts +109 -0
- package/lib/js/components/Toast/Toast.vue +283 -0
- package/lib/js/icons/fontawesome.ts +4 -0
- package/lib/js/styles/Borders/BorderSizes.stories.ts +44 -0
- package/lib/js/typings.d.ts +4 -7
- package/package.json +1 -1
- package/docs/405.28e06a67.iframe.bundle.js +0 -2
- package/docs/main.c3efc488.iframe.bundle.js +0 -1
- /package/docs/{405.28e06a67.iframe.bundle.js.LICENSE.txt → 54.c8325f44.iframe.bundle.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :style="styles" :class="['ds-toast', toastSize, toastPosition]">
|
|
3
|
+
<ds-card :loading-bar-color="color" has-loading-bar :loading-bar-time="disappearingTimeout">
|
|
4
|
+
<template #content>
|
|
5
|
+
<div class="ds-toast__content">
|
|
6
|
+
<slot name="content" />
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
<template
|
|
10
|
+
v-if="footerPrimaryButtonText.length > 0 || footerSecondaryButtonText.length > 0"
|
|
11
|
+
#footer
|
|
12
|
+
>
|
|
13
|
+
<div class="ds-toast__footerButtons">
|
|
14
|
+
<ds-button
|
|
15
|
+
v-if="footerSecondaryButtonText.length"
|
|
16
|
+
:color="buttonSecondaryColor"
|
|
17
|
+
:icon-right="footerSecondaryButtonIcon"
|
|
18
|
+
:type="BUTTON_TYPES.OUTLINED"
|
|
19
|
+
:radius="BUTTON_RADIUSES.ROUNDED"
|
|
20
|
+
@click="$emit('secondary-button-click')"
|
|
21
|
+
>{{ footerSecondaryButtonText }}
|
|
22
|
+
</ds-button>
|
|
23
|
+
<ds-button
|
|
24
|
+
v-if="footerPrimaryButtonText.length"
|
|
25
|
+
:color="buttonPrimaryColor"
|
|
26
|
+
:icon-right="footerPrimaryButtonIcon"
|
|
27
|
+
:radius="BUTTON_RADIUSES.ROUNDED"
|
|
28
|
+
@click="$emit('primary-button-click')"
|
|
29
|
+
>{{ footerPrimaryButtonText }}
|
|
30
|
+
</ds-button>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
</ds-card>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<style scoped lang="scss">
|
|
38
|
+
@import '../../../styles/settings/spacings';
|
|
39
|
+
@import '../../../styles/settings/typography/tokens';
|
|
40
|
+
@import '../../../styles/settings/media-queries';
|
|
41
|
+
|
|
42
|
+
.ds-toast {
|
|
43
|
+
position: fixed;
|
|
44
|
+
width: 100%;
|
|
45
|
+
|
|
46
|
+
&.-ds-size-small {
|
|
47
|
+
max-width: 320px + $space-s * 2;
|
|
48
|
+
padding: $space-s;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.-ds-size-medium {
|
|
52
|
+
max-width: 500px + $space-s * 2;
|
|
53
|
+
padding: $space-s;
|
|
54
|
+
|
|
55
|
+
@media (#{breakpoint-s()}) {
|
|
56
|
+
max-width: 500px + $space-m * 2;
|
|
57
|
+
padding: $space-m;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.-ds-position-left {
|
|
62
|
+
bottom: 0;
|
|
63
|
+
left: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&.-ds-position-right {
|
|
67
|
+
bottom: 0;
|
|
68
|
+
right: 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&.-ds-position-center {
|
|
72
|
+
bottom: 0;
|
|
73
|
+
left: 50%;
|
|
74
|
+
transform: translateX(-50%);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&__content {
|
|
78
|
+
@include text-m-default-regular;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&__footerButtons {
|
|
82
|
+
column-gap: $space-xs;
|
|
83
|
+
display: flex;
|
|
84
|
+
justify-content: flex-end;
|
|
85
|
+
padding: 0 $space-s $space-s;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
89
|
+
|
|
90
|
+
<script lang="ts">
|
|
91
|
+
import DsButton, { BUTTON_COLORS, BUTTON_RADIUSES, BUTTON_TYPES } from '../Buttons/Button';
|
|
92
|
+
import DsCard from '../Cards/Card';
|
|
93
|
+
import {
|
|
94
|
+
TOAST_COLORS,
|
|
95
|
+
TOAST_POSITIONS,
|
|
96
|
+
TOAST_SIZES,
|
|
97
|
+
ToastColors,
|
|
98
|
+
ToastPositions,
|
|
99
|
+
ToastSizes,
|
|
100
|
+
} from './Toast.consts';
|
|
101
|
+
import { PropType, toRaw } from 'vue';
|
|
102
|
+
import { ICONS } from '../Icons/Icon';
|
|
103
|
+
|
|
104
|
+
const TOAST_OFFSET = 24;
|
|
105
|
+
|
|
106
|
+
function calculateBoundariesOffset(boundariesElement: HTMLElement) {
|
|
107
|
+
const borderLeftWidth = window.getComputedStyle(boundariesElement).borderLeftWidth;
|
|
108
|
+
const borderRightWidth = window.getComputedStyle(boundariesElement).borderRightWidth;
|
|
109
|
+
const boundingClientRect = boundariesElement.getBoundingClientRect();
|
|
110
|
+
const boundariesOffsetLeft = boundingClientRect.left + parseInt(borderLeftWidth, 10);
|
|
111
|
+
const boundariesOffsetRight =
|
|
112
|
+
boundingClientRect.right - parseInt(borderRightWidth, 10) - parseInt(borderLeftWidth, 10);
|
|
113
|
+
const boundariesOffsetWidth = boundingClientRect.width;
|
|
114
|
+
return {
|
|
115
|
+
left: {
|
|
116
|
+
left: `${boundariesOffsetLeft}px`,
|
|
117
|
+
},
|
|
118
|
+
right: {
|
|
119
|
+
left: `${boundariesOffsetRight}px`,
|
|
120
|
+
transform: 'translateX(-100%)',
|
|
121
|
+
},
|
|
122
|
+
center: {
|
|
123
|
+
left: `${boundariesOffsetLeft + boundariesOffsetWidth / 2}px`,
|
|
124
|
+
transform: 'translateX(-50%)',
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export default {
|
|
130
|
+
name: 'Toast',
|
|
131
|
+
components: {
|
|
132
|
+
DsButton,
|
|
133
|
+
DsCard,
|
|
134
|
+
},
|
|
135
|
+
props: {
|
|
136
|
+
size: {
|
|
137
|
+
type: String as PropType<ToastSizes>,
|
|
138
|
+
default: TOAST_SIZES.MEDIUM,
|
|
139
|
+
},
|
|
140
|
+
position: {
|
|
141
|
+
type: String as PropType<ToastPositions>,
|
|
142
|
+
default: TOAST_POSITIONS.CENTER,
|
|
143
|
+
},
|
|
144
|
+
boundariesSelector: {
|
|
145
|
+
type: [String, HTMLElement],
|
|
146
|
+
default: null,
|
|
147
|
+
},
|
|
148
|
+
color: {
|
|
149
|
+
type: String as PropType<ToastColors>,
|
|
150
|
+
default: TOAST_COLORS.INFO,
|
|
151
|
+
},
|
|
152
|
+
footerPrimaryButtonText: {
|
|
153
|
+
type: String,
|
|
154
|
+
default: '',
|
|
155
|
+
},
|
|
156
|
+
footerPrimaryButtonIcon: {
|
|
157
|
+
type: Object,
|
|
158
|
+
default: null,
|
|
159
|
+
validator(footerPrimaryButtonIcon: any) {
|
|
160
|
+
return (
|
|
161
|
+
footerPrimaryButtonIcon == null ||
|
|
162
|
+
Object.values(ICONS).includes(toRaw(footerPrimaryButtonIcon))
|
|
163
|
+
);
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
footerSecondaryButtonText: {
|
|
167
|
+
type: String,
|
|
168
|
+
default: '',
|
|
169
|
+
},
|
|
170
|
+
footerSecondaryButtonIcon: {
|
|
171
|
+
type: Object,
|
|
172
|
+
default: null,
|
|
173
|
+
validator(footerSecondaryButtonIcon: any) {
|
|
174
|
+
return (
|
|
175
|
+
footerSecondaryButtonIcon == null ||
|
|
176
|
+
Object.values(ICONS).includes(toRaw(footerSecondaryButtonIcon))
|
|
177
|
+
);
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
isDisappearing: {
|
|
181
|
+
type: Boolean,
|
|
182
|
+
default: true,
|
|
183
|
+
},
|
|
184
|
+
disappearingTimeout: {
|
|
185
|
+
type: String,
|
|
186
|
+
default: '0',
|
|
187
|
+
validator(disappearingTimeout: string) {
|
|
188
|
+
return (
|
|
189
|
+
(disappearingTimeout === '0' || !isNaN(parseInt(disappearingTimeout, 10))) &&
|
|
190
|
+
parseInt(disappearingTimeout, 10) >= 0
|
|
191
|
+
);
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
emits: {
|
|
196
|
+
close: () => true,
|
|
197
|
+
'primary-button-click': () => true,
|
|
198
|
+
'secondary-button-click': () => true,
|
|
199
|
+
},
|
|
200
|
+
data() {
|
|
201
|
+
return {
|
|
202
|
+
boundariesSelectorElement: null,
|
|
203
|
+
boundariesSelectorElementResizeObserver: null,
|
|
204
|
+
styles: {},
|
|
205
|
+
BUTTON_COLORS: Object.freeze(BUTTON_COLORS),
|
|
206
|
+
BUTTON_RADIUSES: Object.freeze(BUTTON_RADIUSES),
|
|
207
|
+
BUTTON_TYPES: Object.freeze(BUTTON_TYPES),
|
|
208
|
+
TOAST_SIZES: Object.freeze(TOAST_SIZES),
|
|
209
|
+
TOAST_POSITIONS: Object.freeze(TOAST_POSITIONS),
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
computed: {
|
|
213
|
+
buttonPrimaryColor() {
|
|
214
|
+
return this.color === TOAST_COLORS.DANGER
|
|
215
|
+
? BUTTON_COLORS.NEUTRAL
|
|
216
|
+
: BUTTON_COLORS.PRIMARY;
|
|
217
|
+
},
|
|
218
|
+
buttonSecondaryColor() {
|
|
219
|
+
return this.color === TOAST_COLORS.DANGER
|
|
220
|
+
? BUTTON_COLORS.DANGER
|
|
221
|
+
: BUTTON_COLORS.NEUTRAL;
|
|
222
|
+
},
|
|
223
|
+
toastPosition() {
|
|
224
|
+
return `-ds-position-${this.position.toLowerCase()}`;
|
|
225
|
+
},
|
|
226
|
+
toastSize() {
|
|
227
|
+
return `-ds-size-${this.size.toLowerCase()}`;
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
mounted() {
|
|
231
|
+
this.setBoundariesSelectorElement();
|
|
232
|
+
this.calculateStyles();
|
|
233
|
+
this.boundariesSelectorElementResizeObserver?.disconnect();
|
|
234
|
+
this.boundariesSelectorElementResizeObserver = new ResizeObserver(() => {
|
|
235
|
+
this.calculateStyles();
|
|
236
|
+
});
|
|
237
|
+
if (this.boundariesSelectorElement) {
|
|
238
|
+
this.boundariesSelectorElementResizeObserver.observe(this.boundariesSelectorElement);
|
|
239
|
+
} else {
|
|
240
|
+
//window resize does not work for some reason, so we observe body
|
|
241
|
+
this.boundariesSelectorElementResizeObserver.observe(document.querySelector('body'));
|
|
242
|
+
}
|
|
243
|
+
if (this.isDisappearing && this.disappearingTimeout !== '0') {
|
|
244
|
+
setTimeout(
|
|
245
|
+
() => this.$emit('close'),
|
|
246
|
+
parseInt(this.disappearingTimeout, 10) * 1000 + 100, // 100 ms is to let loading bar animation to finish
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
beforeUnmount() {
|
|
251
|
+
this.boundariesSelectorElementResizeObserver.disconnect();
|
|
252
|
+
this.boundariesSelectorElementResizeObserver = null;
|
|
253
|
+
},
|
|
254
|
+
updated() {
|
|
255
|
+
const { right, left } = this.$el.getClientRects()[0];
|
|
256
|
+
if (parseInt(left, 10) < 0 || right > document.documentElement.clientWidth) {
|
|
257
|
+
this.styles = {
|
|
258
|
+
left: '50%',
|
|
259
|
+
transform: 'translateX(-50%)',
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
methods: {
|
|
264
|
+
calculateStyles() {
|
|
265
|
+
if (this.boundariesSelectorElement) {
|
|
266
|
+
this.styles = calculateBoundariesOffset(this.boundariesSelectorElement)[
|
|
267
|
+
this.position
|
|
268
|
+
];
|
|
269
|
+
} else {
|
|
270
|
+
this.styles = {};
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
setBoundariesSelectorElement() {
|
|
274
|
+
if (typeof this.boundariesSelector === 'string') {
|
|
275
|
+
this.boundariesSelectorElement =
|
|
276
|
+
document.querySelector(this.boundariesSelector) || null;
|
|
277
|
+
} else if (this.boundariesSelector instanceof HTMLElement) {
|
|
278
|
+
this.boundariesSelectorElement = this.boundariesSelector;
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
</script>
|
|
@@ -86,6 +86,7 @@ import { faHourglass } from '@fortawesome/pro-regular-svg-icons/faHourglass';
|
|
|
86
86
|
import { faHourglassEnd } from '@fortawesome/pro-regular-svg-icons/faHourglassEnd';
|
|
87
87
|
import { faHourglassStart } from '@fortawesome/pro-regular-svg-icons/faHourglassStart';
|
|
88
88
|
import { faHouse } from '@fortawesome/pro-regular-svg-icons/faHouse';
|
|
89
|
+
import { faImages as fasImages } from '@fortawesome/pro-solid-svg-icons/faImages';
|
|
89
90
|
import { faKey } from '@fortawesome/pro-regular-svg-icons/faKey';
|
|
90
91
|
import { faKeyboard } from '@fortawesome/pro-regular-svg-icons/faKeyboard';
|
|
91
92
|
import { faLightbulb } from '@fortawesome/pro-regular-svg-icons/faLightbulb';
|
|
@@ -116,6 +117,7 @@ import { faRotateLeft } from '@fortawesome/pro-regular-svg-icons/faRotateLeft';
|
|
|
116
117
|
import { faShare } from '@fortawesome/pro-regular-svg-icons/faShare';
|
|
117
118
|
import { faShareNodes } from '@fortawesome/pro-regular-svg-icons/faShareNodes';
|
|
118
119
|
import { faShieldHalved } from '@fortawesome/pro-regular-svg-icons/faShieldHalved';
|
|
120
|
+
import { faSidebar } from '@fortawesome/pro-regular-svg-icons/faSidebar';
|
|
119
121
|
import { faSignal } from '@fortawesome/pro-regular-svg-icons/faSignal';
|
|
120
122
|
import { faSitemap } from '@fortawesome/pro-regular-svg-icons/faSitemap';
|
|
121
123
|
import { faSliders } from '@fortawesome/pro-regular-svg-icons/faSliders';
|
|
@@ -302,6 +304,7 @@ export const FONTAWESOME_ICONS = {
|
|
|
302
304
|
FA_HOURGLASS_END: faHourglassEnd,
|
|
303
305
|
FA_HOURGLASS_START: faHourglassStart,
|
|
304
306
|
FA_HOUSE: faHouse,
|
|
307
|
+
FA_IMAGES_SOLID: fasImages,
|
|
305
308
|
FA_INFO_SOLID: fasInfo,
|
|
306
309
|
FA_KEY: faKey,
|
|
307
310
|
FA_KEYBOARD: faKeyboard,
|
|
@@ -336,6 +339,7 @@ export const FONTAWESOME_ICONS = {
|
|
|
336
339
|
FA_SHARE: faShare,
|
|
337
340
|
FA_SHARE_NODES: faShareNodes,
|
|
338
341
|
FA_SHIELD_HALVED: faShieldHalved,
|
|
342
|
+
FA_SIDEBAR: faSidebar,
|
|
339
343
|
FA_SIGNAL: faSignal,
|
|
340
344
|
FA_SITEMAP: faSitemap,
|
|
341
345
|
FA_SITEMAP_SOLID: fasSitemap,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'foundations/Borders',
|
|
5
|
+
} as Meta;
|
|
6
|
+
|
|
7
|
+
const borderSizes = [
|
|
8
|
+
{ name: 'border-xs', value: 1 },
|
|
9
|
+
{ name: 'border-s', value: 2 },
|
|
10
|
+
{ name: 'border-m', value: 4 },
|
|
11
|
+
{ name: 'border-l', value: 6 },
|
|
12
|
+
{ name: 'border-xl', value: 8 },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const StoryTemplate: StoryFn = () => ({
|
|
16
|
+
data() {
|
|
17
|
+
return {
|
|
18
|
+
spacings: Object.freeze(borderSizes),
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
methods: {
|
|
22
|
+
getStyles(spacing) {
|
|
23
|
+
return `border: black solid ${spacing.value}px;`;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
template: `
|
|
27
|
+
<div>
|
|
28
|
+
<div v-for="spacing in spacings" style="margin-bottom: 24px;">
|
|
29
|
+
<code>
|
|
30
|
+
\${{ spacing.name }}: {{ spacing.value }}px
|
|
31
|
+
</code>
|
|
32
|
+
<div :style="getStyles(spacing)">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
`,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const Static = StoryTemplate.bind({});
|
|
39
|
+
Static.parameters = {
|
|
40
|
+
design: {
|
|
41
|
+
type: 'figma',
|
|
42
|
+
url: 'https://www.figma.com/design/izQdYyiBR1GQgFkaOIfIJI/LMS---DS-Components?node-id=8375-32903&t=ItmVGTyxKahcKsdh-4',
|
|
43
|
+
},
|
|
44
|
+
};
|
package/lib/js/typings.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
// TypeScript compiler doesn't read webpack config so we need to tell him how interpret import Vue files
|
|
2
2
|
|
|
3
3
|
declare module '*.vue' {
|
|
4
|
-
import { ConcreteComponent } from '
|
|
4
|
+
import { ConcreteComponent } from 'vue';
|
|
5
5
|
export { ConcreteComponent };
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
declare module '*.svg' {
|
|
9
|
-
import {
|
|
10
|
-
const
|
|
11
|
-
export default
|
|
12
|
-
export * from '@vue/runtime-dom';
|
|
13
|
-
const { configureCompat } = Vue;
|
|
14
|
-
export { configureCompat };
|
|
9
|
+
import Vue, { VueConstructor } from 'vue';
|
|
10
|
+
const content: VueConstructor<Vue>;
|
|
11
|
+
export default content;
|
|
15
12
|
}
|