@bethinkpl/design-system 22.0.5 → 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 +243 -206
- package/dist/design-system.umd.js.map +1 -1
- package/dist/lib/js/components/Banner/Banner.vue.d.ts +7 -6
- package/dist/lib/js/components/Buttons/Button/Button.vue.d.ts +7 -6
- package/dist/lib/js/components/Buttons/IconButton/IconButton.vue.d.ts +7 -6
- package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +7 -6
- package/dist/lib/js/components/Chip/Chip.vue.d.ts +7 -6
- package/dist/lib/js/components/Drawer/DrawerHeader/DrawerHeader.vue.d.ts +7 -6
- package/dist/lib/js/components/Drawer/DrawerListItem/DrawerListItem.vue.d.ts +7 -6
- package/dist/lib/js/components/Drawer/DrawerSection/DrawerSection.vue.d.ts +7 -6
- package/dist/lib/js/components/Form/Checkbox/Checkbox.vue.d.ts +7 -6
- package/dist/lib/js/components/Form/RadioButton/RadioButton.vue.d.ts +7 -6
- package/dist/lib/js/components/Headers/OverlayHeader/OverlayHeader.vue.d.ts +7 -6
- package/dist/lib/js/components/Headers/SectionHeader/SectionHeader.vue.d.ts +7 -6
- package/dist/lib/js/components/Icons/Icon/Icon.consts.d.ts +7 -7
- package/dist/lib/js/components/Modal/Modal.vue.d.ts +7 -6
- package/dist/lib/js/components/Modals/Modal/Modal.vue.d.ts +7 -6
- package/dist/lib/js/components/Outline/OutlineItem/OutlineItem.vue.d.ts +7 -6
- package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +7 -6
- package/dist/lib/js/components/ProgressBar/ProgressBar.vue.d.ts +7 -6
- package/dist/lib/js/components/ProgressDonutChart/ProgressDonutChart.vue.d.ts +7 -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 +8 -7
- package/dist/lib/js/components/SectionTitle/SectionTitle.vue.d.ts +3 -19
- package/dist/lib/js/components/SelectList/SelectListItem/SelectListItem.vue.d.ts +7 -6
- package/dist/lib/js/components/SelectionTile/SelectionTile.vue.d.ts +9 -8
- package/dist/lib/js/components/Statuses/AccessStatus/AccessStatus.vue.d.ts +7 -6
- package/dist/lib/js/components/Statuses/BlockadeStatus/BlockadeStatus.vue.d.ts +7 -6
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +7 -6
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +7 -6
- package/dist/lib/js/components/Switch/Switch.vue.d.ts +9 -8
- package/dist/lib/js/components/Tile/Tile.sb.shared.d.ts +7 -6
- package/dist/lib/js/components/Tile/Tile.vue.d.ts +7 -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 +10 -9
- package/dist/lib/js/icons/fontawesome.d.ts +1 -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 +2 -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/851.9039ec09.iframe.bundle.js +0 -2
- package/docs/main.335b57db.iframe.bundle.js +0 -1
- /package/docs/{851.9039ec09.iframe.bundle.js.LICENSE.txt → 54.c8325f44.iframe.bundle.js.LICENSE.txt} +0 -0
package/docs/project.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"generatedAt":
|
|
1
|
+
{"generatedAt":1719584425466,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"metaFramework":{"name":"vue-cli","packageName":"@vue/cli-service","version":"5.0.8"},"packageManager":{"type":"yarn","version":"1.22.22"},"storybookVersion":"6.5.13","language":"typescript","storybookPackages":{"@storybook/builder-webpack5":{"version":"6.5.13"},"@storybook/manager-webpack5":{"version":"6.5.13"},"@storybook/vue3":{"version":"6.5.13"},"eslint-plugin-storybook":{"version":"0.6.6"}},"framework":{"name":"vue3"},"addons":{"@storybook/addon-actions":{"version":"6.5.16"},"@storybook/addon-docs":{"version":"6.5.15"},"@storybook/addon-controls":{"version":"6.5.15"},"@storybook/addon-storysource":{"version":"6.5.15"},"@storybook/addon-viewport":{"version":"6.5.15"},"storybook-addon-designs":{"version":"6.3.1"}}}
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
&.-ds-border-size-small {
|
|
62
62
|
border-radius: $radius-xs;
|
|
63
|
-
border-width: $border-s;
|
|
63
|
+
border-top-width: $border-s;
|
|
64
64
|
|
|
65
65
|
#{$root}__loadingBar {
|
|
66
66
|
border-radius: $radius-xs $radius-xs 0 0;
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
|
|
71
71
|
&.-ds-border-size-medium {
|
|
72
72
|
border-radius: $radius-s;
|
|
73
|
-
border-width: $border-m;
|
|
73
|
+
border-top-width: $border-m;
|
|
74
74
|
|
|
75
75
|
#{$root}__loadingBar {
|
|
76
76
|
border-radius: $radius-s $radius-s 0 0;
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
|
|
81
81
|
&.-ds-border-size-large {
|
|
82
82
|
border-radius: $radius-m;
|
|
83
|
-
border-width: $border-l;
|
|
83
|
+
border-top-width: $border-l;
|
|
84
84
|
|
|
85
85
|
#{$root}__loadingBar {
|
|
86
86
|
border-radius: $radius-m $radius-m 0 0;
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
:eyebrow="eyebrow"
|
|
15
15
|
:supporting-text="supportingText"
|
|
16
16
|
:has-divider="hasDivider"
|
|
17
|
-
@
|
|
18
|
-
@update:
|
|
17
|
+
@info-click="onInfoClick"
|
|
18
|
+
@update:is-expanded="onExpandableHeaderClick"
|
|
19
19
|
/>
|
|
20
20
|
|
|
21
21
|
<div v-if="isExpandedInternal || !isExpandable">
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:not-selected-icon="ICONS.FA_SQUARE"
|
|
8
8
|
:state="state"
|
|
9
9
|
:type="SELECTION_CONTROL_TYPE.CHECKBOX"
|
|
10
|
-
@update:
|
|
10
|
+
@update:is-selected="$emit('update:is-selected', $event)"
|
|
11
11
|
@input:focus="$emit('input:focus')"
|
|
12
12
|
@input:blur="$emit('input:blur')"
|
|
13
13
|
/>
|
|
@@ -49,7 +49,7 @@ export default {
|
|
|
49
49
|
},
|
|
50
50
|
// TODO fix me when touching this file
|
|
51
51
|
// eslint-disable-next-line vue/require-emit-validator
|
|
52
|
-
emits: ['update:
|
|
52
|
+
emits: ['update:is-selected', 'input:focus', 'input:blur'],
|
|
53
53
|
data() {
|
|
54
54
|
return {
|
|
55
55
|
SELECTION_CONTROL_TYPE: Object.freeze(SELECTION_CONTROL_TYPE),
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:not-selected-icon="ICONS.FA_CIRCLE"
|
|
8
8
|
:state="state"
|
|
9
9
|
:type="SELECTION_CONTROL_TYPE.RADIO_BUTTON"
|
|
10
|
-
@update:
|
|
10
|
+
@update:is-selected="$emit('update:is-selected', $event)"
|
|
11
11
|
@input:focus="$emit('input:focus')"
|
|
12
12
|
@input:blur="$emit('input:blur')"
|
|
13
13
|
/>
|
|
@@ -54,7 +54,7 @@ export default {
|
|
|
54
54
|
},
|
|
55
55
|
// TODO fix me when touching this file
|
|
56
56
|
// eslint-disable-next-line vue/require-emit-validator
|
|
57
|
-
emits: ['update:
|
|
57
|
+
emits: ['update:is-selected', 'input:focus', 'input:blur'],
|
|
58
58
|
data() {
|
|
59
59
|
return {
|
|
60
60
|
ICONS: Object.freeze(ICONS),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Args, ArgTypes } from '@storybook/vue3';
|
|
2
2
|
|
|
3
3
|
export const template = (componentTag: string) => `
|
|
4
|
-
<${componentTag} v-bind="args" @update:
|
|
4
|
+
<${componentTag} v-bind="args" @update:is-selected="onIsSelectedUpdated"/>`;
|
|
5
5
|
|
|
6
6
|
export const argTypes = (size, state) =>
|
|
7
7
|
({
|
|
@@ -290,7 +290,7 @@ export default {
|
|
|
290
290
|
},
|
|
291
291
|
// TODO fix me when touching this file
|
|
292
292
|
// eslint-disable-next-line vue/require-emit-validator
|
|
293
|
-
emits: ['update:
|
|
293
|
+
emits: ['update:is-selected', 'input:focus', 'input:blur'],
|
|
294
294
|
data() {
|
|
295
295
|
return {
|
|
296
296
|
isFocused: false,
|
|
@@ -323,7 +323,7 @@ export default {
|
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
this.$emit('update:
|
|
326
|
+
this.$emit('update:is-selected', !this.isSelected);
|
|
327
327
|
},
|
|
328
328
|
onFocus() {
|
|
329
329
|
this.isFocused = true;
|
|
@@ -1,52 +1,50 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
<slot v-if="triggerAction === POP_OVER_TRIGGER_ACTIONS.NONE" name="reference" />
|
|
3
|
+
<vue-popper
|
|
4
|
+
v-else
|
|
5
|
+
ref="popper"
|
|
6
|
+
:key="key"
|
|
7
|
+
:boundaries-selector="boundariesSelector"
|
|
8
|
+
:force-show="forceShow"
|
|
9
|
+
:options="{ placement, modifiers }"
|
|
10
|
+
:trigger="triggerAction"
|
|
11
|
+
:delay-on-mouse-over="300"
|
|
12
|
+
:delay-on-mouse-out="300"
|
|
13
|
+
:append-to-body="appendToBody"
|
|
14
|
+
:visible-arrow="isPointerVisible"
|
|
15
|
+
:root-class="rootClass"
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
class="popper ds-popOver"
|
|
19
|
+
:class="{
|
|
20
|
+
'-ds-color-neutral': color === POP_OVER_COLORS.NEUTRAL,
|
|
21
|
+
'-ds-small': size === POP_OVER_SIZES.SMALL,
|
|
22
|
+
'-ds-medium': size === POP_OVER_SIZES.MEDIUM,
|
|
23
|
+
}"
|
|
17
24
|
>
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}"
|
|
25
|
-
>
|
|
26
|
-
<img v-if="headerImageUrl" class="ds-popOver__image" :src="headerImageUrl" alt="" />
|
|
27
|
-
<div class="ds-popOver__content">
|
|
28
|
-
<div v-if="titleText" class="ds-popOver__title"> {{ titleText }} </div>
|
|
29
|
-
<div v-if="subtitleText" class="ds-popOver__subtitle"> {{ subtitleText }} </div>
|
|
30
|
-
<div class="ds-popOver__contentSlot" :class="{ '-ds-maxHeight': maxHeight }">
|
|
31
|
-
<slot :close="close" />
|
|
32
|
-
</div>
|
|
25
|
+
<img v-if="headerImageUrl" class="ds-popOver__image" :src="headerImageUrl" alt="" />
|
|
26
|
+
<div class="ds-popOver__content">
|
|
27
|
+
<div v-if="titleText" class="ds-popOver__title"> {{ titleText }} </div>
|
|
28
|
+
<div v-if="subtitleText" class="ds-popOver__subtitle"> {{ subtitleText }} </div>
|
|
29
|
+
<div class="ds-popOver__contentSlot" :class="{ '-ds-maxHeight': maxHeight }">
|
|
30
|
+
<slot :close="close" />
|
|
33
31
|
</div>
|
|
34
|
-
<ds-button
|
|
35
|
-
v-if="buttonText"
|
|
36
|
-
class="ds-popOver__button"
|
|
37
|
-
:type="BUTTON_TYPES.TEXT"
|
|
38
|
-
:size="BUTTON_SIZES.LARGE"
|
|
39
|
-
@click="$emit('button-click')"
|
|
40
|
-
>
|
|
41
|
-
{{ buttonText }}
|
|
42
|
-
</ds-button>
|
|
43
32
|
</div>
|
|
33
|
+
<ds-button
|
|
34
|
+
v-if="buttonText"
|
|
35
|
+
class="ds-popOver__button"
|
|
36
|
+
:type="BUTTON_TYPES.TEXT"
|
|
37
|
+
:size="BUTTON_SIZES.LARGE"
|
|
38
|
+
@click="$emit('button-click')"
|
|
39
|
+
>
|
|
40
|
+
{{ buttonText }}
|
|
41
|
+
</ds-button>
|
|
42
|
+
</div>
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</span>
|
|
44
|
+
<template #reference>
|
|
45
|
+
<slot name="reference" />
|
|
46
|
+
</template>
|
|
47
|
+
</vue-popper>
|
|
50
48
|
</template>
|
|
51
49
|
|
|
52
50
|
<style lang="scss" scoped>
|
|
@@ -59,7 +59,7 @@ const StoryTemplate: StoryFn<typeof BasicRichListItem> = (args, { updateArgs })
|
|
|
59
59
|
:has-actions-slot-divider="hasActionsSlotDivider"
|
|
60
60
|
:is-selectable="isSelectable"
|
|
61
61
|
:is-selected="isSelected"
|
|
62
|
-
@update:
|
|
62
|
+
@update:is-selected="updateIsSelected"
|
|
63
63
|
>
|
|
64
64
|
<template v-if="meta" #meta>
|
|
65
65
|
<div v-html="meta" />
|
|
@@ -161,7 +161,7 @@ Interactive.args = args;
|
|
|
161
161
|
|
|
162
162
|
Interactive.parameters = {
|
|
163
163
|
actions: {
|
|
164
|
-
handles: ['icon-click', 'click', 'update:
|
|
164
|
+
handles: ['icon-click', 'click', 'update:is-selected'],
|
|
165
165
|
},
|
|
166
166
|
layout: 'fullscreen',
|
|
167
167
|
design: {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
:class="{
|
|
22
22
|
'-ds-small': size === RICH_LIST_ITEM_SIZE.SMALL,
|
|
23
23
|
}"
|
|
24
|
-
@update:is-selected="$emit('update:
|
|
24
|
+
@update:is-selected="$emit('update:is-selected', $event)"
|
|
25
25
|
>
|
|
26
26
|
<template #content>
|
|
27
27
|
<div class="ds-basicRichListItem__content">
|
|
@@ -239,7 +239,7 @@ export default {
|
|
|
239
239
|
},
|
|
240
240
|
},
|
|
241
241
|
emits: {
|
|
242
|
-
'update:
|
|
242
|
+
'update:is-selected': (value: boolean) => true,
|
|
243
243
|
},
|
|
244
244
|
data() {
|
|
245
245
|
return {
|
|
@@ -57,7 +57,7 @@ const StoryTemplate: StoryFn<typeof RichListItem> = (args, { updateArgs }) => ({
|
|
|
57
57
|
:has-actions-slot-divider="hasActionsSlotDivider"
|
|
58
58
|
:is-selectable="isSelectable"
|
|
59
59
|
:is-selected="isSelected"
|
|
60
|
-
@update:
|
|
60
|
+
@update:is-selected="updateIsSelected"
|
|
61
61
|
>
|
|
62
62
|
<template v-if="content" #content>
|
|
63
63
|
<div v-html="content" />
|
|
@@ -156,7 +156,7 @@ Interactive.args = args;
|
|
|
156
156
|
|
|
157
157
|
Interactive.parameters = {
|
|
158
158
|
actions: {
|
|
159
|
-
handles: ['icon-click', 'click', 'update:
|
|
159
|
+
handles: ['icon-click', 'click', 'update:is-selected'],
|
|
160
160
|
},
|
|
161
161
|
layout: 'fullscreen',
|
|
162
162
|
design: {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
<ds-divider is-vertical class="-ds-hideOnMobile" />
|
|
48
48
|
<ds-checkbox
|
|
49
49
|
:is-selected="isSelected"
|
|
50
|
-
@update:is-selected="$emit('update:
|
|
50
|
+
@update:is-selected="$emit('update:is-selected', $event)"
|
|
51
51
|
@click.stop
|
|
52
52
|
/>
|
|
53
53
|
</div>
|
|
@@ -532,7 +532,7 @@ export default {
|
|
|
532
532
|
emits: {
|
|
533
533
|
'icon-click': () => true,
|
|
534
534
|
click: () => true,
|
|
535
|
-
'update:
|
|
535
|
+
'update:is-selected': (isSelected: boolean) => true,
|
|
536
536
|
},
|
|
537
537
|
data() {
|
|
538
538
|
return {
|
|
@@ -44,7 +44,7 @@ const StoryTemplate: StoryFn<typeof SelectionTile> = (args, { updateArgs }) => (
|
|
|
44
44
|
:is-selected="isSelected"
|
|
45
45
|
:state="state"
|
|
46
46
|
@icon-click="onIconClick"
|
|
47
|
-
@update:
|
|
47
|
+
@update:is-selected="onIsSelectedUpdated"
|
|
48
48
|
/>`,
|
|
49
49
|
});
|
|
50
50
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
:size="SELECTION_CONTROL_SIZE.X_SMALL"
|
|
19
19
|
:is-selected="isSelected"
|
|
20
20
|
:state="SELECTION_CONTROL_STATE_MAP[state]"
|
|
21
|
-
@update:
|
|
21
|
+
@update:is-selected="updateIsSelected($event)"
|
|
22
22
|
@input:focus="onInputFocus"
|
|
23
23
|
@input:blur="onInputBlur"
|
|
24
24
|
/>
|
|
@@ -219,7 +219,7 @@ export default defineComponent({
|
|
|
219
219
|
},
|
|
220
220
|
// TODO fix me when touching this file
|
|
221
221
|
// eslint-disable-next-line vue/require-emit-validator
|
|
222
|
-
emits: ['update:
|
|
222
|
+
emits: ['update:is-selected', 'icon-click'],
|
|
223
223
|
data() {
|
|
224
224
|
return {
|
|
225
225
|
ICONS: Object.freeze(ICONS),
|
|
@@ -242,7 +242,7 @@ export default defineComponent({
|
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
this.$emit('update:
|
|
245
|
+
this.$emit('update:is-selected', value);
|
|
246
246
|
},
|
|
247
247
|
onIconClick(event: Event) {
|
|
248
248
|
if (!this.isLoading) {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Value } from '../../utils/type.utils';
|
|
2
|
+
|
|
3
|
+
export const TOAST_SIZES = {
|
|
4
|
+
SMALL: 'small',
|
|
5
|
+
MEDIUM: 'medium',
|
|
6
|
+
} as const;
|
|
7
|
+
|
|
8
|
+
export type ToastSizes = Value<typeof TOAST_SIZES>;
|
|
9
|
+
|
|
10
|
+
export const TOAST_COLORS = {
|
|
11
|
+
NEUTRAL_HEAVY: 'neutralHeavy',
|
|
12
|
+
NEUTRAL_STRONG: 'neutralStrong',
|
|
13
|
+
SUCCESS: 'success',
|
|
14
|
+
WARNING: 'warning',
|
|
15
|
+
DANGER: 'danger',
|
|
16
|
+
INFO: 'info',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type ToastColors = Value<typeof TOAST_COLORS>;
|
|
20
|
+
|
|
21
|
+
export const TOAST_POSITIONS = {
|
|
22
|
+
LEFT: 'left',
|
|
23
|
+
CENTER: 'center',
|
|
24
|
+
RIGHT: 'right',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type ToastPositions = Value<typeof TOAST_POSITIONS>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
|
|
2
|
+
import DsToast from './Toast.vue';
|
|
3
|
+
import { TOAST_COLORS, TOAST_POSITIONS, TOAST_SIZES } from './Toast.consts';
|
|
4
|
+
import { ICONS } from '../Icons/Icon';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/Toast',
|
|
8
|
+
component: DsToast,
|
|
9
|
+
} as Meta<typeof DsToast>;
|
|
10
|
+
|
|
11
|
+
const StoryTemplate: StoryFn<typeof DsToast> = (args) => ({
|
|
12
|
+
components: { DsToast },
|
|
13
|
+
setup() {
|
|
14
|
+
return { ...args };
|
|
15
|
+
},
|
|
16
|
+
data() {
|
|
17
|
+
return {
|
|
18
|
+
ICONS: Object.freeze(ICONS),
|
|
19
|
+
isVisible: true,
|
|
20
|
+
boundariesSelectorId:
|
|
21
|
+
this.boundariesSelector != null ? `#${this.boundariesSelector}` : null,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
template: `<div style="display: flex; justify-content: space-around; height: 1200px; width: 100%;">
|
|
25
|
+
<ds-toast
|
|
26
|
+
v-if="isVisible"
|
|
27
|
+
:size="size"
|
|
28
|
+
:position="position"
|
|
29
|
+
:boundaries-selector="boundariesSelectorId"
|
|
30
|
+
:color="color"
|
|
31
|
+
:footer-primary-button-text="footerPrimaryButtonText"
|
|
32
|
+
:footer-primary-button-icon="ICONS[footerPrimaryButtonIcon]"
|
|
33
|
+
:footer-secondary-button-text="footerSecondaryButtonText"
|
|
34
|
+
:footer-secondary-button-icon="ICONS[footerSecondaryButtonIcon]"
|
|
35
|
+
:is-disappearing="isDisappearing"
|
|
36
|
+
:disappearing-timeout="disappearingTimeout"
|
|
37
|
+
@close="isVisible = false"
|
|
38
|
+
>
|
|
39
|
+
<template #content>
|
|
40
|
+
<span v-html="content" />
|
|
41
|
+
</template>
|
|
42
|
+
</ds-toast>
|
|
43
|
+
<div id="left" style="width: 25%; height: 100%; border: 1px black solid;"></div>
|
|
44
|
+
<div id="right" style="width: 25%; height: 100%; border: 1px black solid;"></div>
|
|
45
|
+
</div>`,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const Interactive = StoryTemplate.bind({});
|
|
49
|
+
|
|
50
|
+
const args = {
|
|
51
|
+
size: TOAST_SIZES.MEDIUM,
|
|
52
|
+
position: TOAST_POSITIONS.CENTER,
|
|
53
|
+
boundariesSelector: null,
|
|
54
|
+
color: TOAST_COLORS.INFO,
|
|
55
|
+
footerPrimaryButtonText: 'primary',
|
|
56
|
+
footerPrimaryButtonIcon: null,
|
|
57
|
+
footerSecondaryButtonText: 'secondary',
|
|
58
|
+
footerSecondaryButtonIcon: null,
|
|
59
|
+
isDisappearing: false,
|
|
60
|
+
disappearingTimeout: '0',
|
|
61
|
+
content: 'Wpłynąłem na suchego przestwór oceanu',
|
|
62
|
+
} as Args;
|
|
63
|
+
|
|
64
|
+
const argTypes = {
|
|
65
|
+
size: {
|
|
66
|
+
control: { type: 'select' },
|
|
67
|
+
options: Object.values(TOAST_SIZES),
|
|
68
|
+
defaultValue: TOAST_SIZES.MEDIUM,
|
|
69
|
+
},
|
|
70
|
+
position: {
|
|
71
|
+
control: { type: 'select' },
|
|
72
|
+
options: Object.values(TOAST_POSITIONS),
|
|
73
|
+
defaultValue: TOAST_POSITIONS.CENTER,
|
|
74
|
+
},
|
|
75
|
+
boundariesSelector: {
|
|
76
|
+
control: { type: 'select' },
|
|
77
|
+
options: [null, 'left', 'right'],
|
|
78
|
+
defaultValue: null,
|
|
79
|
+
},
|
|
80
|
+
color: {
|
|
81
|
+
control: { type: 'select' },
|
|
82
|
+
options: Object.values(TOAST_COLORS),
|
|
83
|
+
defaultValue: TOAST_COLORS.INFO,
|
|
84
|
+
},
|
|
85
|
+
footerPrimaryButtonIcon: {
|
|
86
|
+
control: { type: 'select' },
|
|
87
|
+
options: [null, ...Object.keys(ICONS)],
|
|
88
|
+
},
|
|
89
|
+
footerSecondaryButtonIcon: {
|
|
90
|
+
control: { type: 'select' },
|
|
91
|
+
options: [null, ...Object.keys(ICONS)],
|
|
92
|
+
},
|
|
93
|
+
content: {
|
|
94
|
+
control: { type: 'text' },
|
|
95
|
+
},
|
|
96
|
+
} as ArgTypes;
|
|
97
|
+
|
|
98
|
+
Interactive.argTypes = argTypes;
|
|
99
|
+
Interactive.args = args;
|
|
100
|
+
|
|
101
|
+
Interactive.parameters = {
|
|
102
|
+
actions: {
|
|
103
|
+
handles: ['close', 'primary-button-click', 'secondary-button-click'],
|
|
104
|
+
},
|
|
105
|
+
design: {
|
|
106
|
+
type: 'figma',
|
|
107
|
+
url: 'https://www.figma.com/design/izQdYyiBR1GQgFkaOIfIJI/LMS---DS-Components?node-id=8091-108960',
|
|
108
|
+
},
|
|
109
|
+
};
|