@avakhula/ui 0.0.10
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/.babelrc.json +14 -0
- package/.eslintrc.cjs +15 -0
- package/.nvmrc +1 -0
- package/.prettierrc.json +1 -0
- package/.storybook/intelliboardTheme.js +10 -0
- package/.storybook/main.js +25 -0
- package/.storybook/manager.js +7 -0
- package/.storybook/preview-head.html +11 -0
- package/.storybook/preview.js +24 -0
- package/.storybook/scss-loader.scss +6 -0
- package/.storybook/withSource.js +97 -0
- package/README.md +35 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.mjs +19366 -0
- package/dist/index.umd.js +209 -0
- package/dist/style.css +1 -0
- package/index.html +21 -0
- package/package.json +63 -0
- package/public/favicon.ico +0 -0
- package/src/App.vue +37 -0
- package/src/EventEmmiter.js +19 -0
- package/src/assets/scss/mixins/dropdown-list-item.scss +45 -0
- package/src/assets/scss/mixins/tooltip-position.scss +147 -0
- package/src/assets/scss/mixins.scss +21 -0
- package/src/assets/scss/reset.scss +12 -0
- package/src/assets/scss/style.scss +73 -0
- package/src/assets/scss/typography.scss +155 -0
- package/src/assets/scss/variables/colors.scss +115 -0
- package/src/assets/scss/variables/shadows.scss +17 -0
- package/src/components/Accordion/Accordion.scss +94 -0
- package/src/components/Accordion/Accordion.stories.js +41 -0
- package/src/components/Accordion/Accordion.vue +104 -0
- package/src/components/Accordion/readme.mdx +38 -0
- package/src/components/Alert/Alert.stories.js +69 -0
- package/src/components/Alert/Alert.vue +131 -0
- package/src/components/Alert/alert.scss +166 -0
- package/src/components/Alert/constants.js +6 -0
- package/src/components/Alert/readme.mdx +63 -0
- package/src/components/Badge/Badge.stories.js +53 -0
- package/src/components/Badge/Badge.vue +58 -0
- package/src/components/Badge/readme.mdx +38 -0
- package/src/components/Breadcrumbs/Breadcrumbs.vue +98 -0
- package/src/components/Breadcrumbs/breadcrumbs.scss +77 -0
- package/src/components/Breadcrumbs/breadcrumbs.stories.js +37 -0
- package/src/components/Button/Button.stories.js +124 -0
- package/src/components/Button/Button.vue +165 -0
- package/src/components/Button/button.scss +217 -0
- package/src/components/Button/constants.js +8 -0
- package/src/components/Button/readme.mdx +118 -0
- package/src/components/ButtonGroup/ButtonGroup.stories.js +27 -0
- package/src/components/ButtonGroup/ButtonGroup.vue +24 -0
- package/src/components/ButtonGroup/readme.mdx +10 -0
- package/src/components/Dropdown/Dropdown.spec.js +90 -0
- package/src/components/Dropdown/Dropdown.stories.js +48 -0
- package/src/components/Dropdown/Dropdown.vue +313 -0
- package/src/components/Dropdown/DropdownDivider.vue +15 -0
- package/src/components/Dropdown/DropdownItem.vue +59 -0
- package/src/components/Dropdown/DropdownList.stories.js +174 -0
- package/src/components/Dropdown/DropdownList.vue +93 -0
- package/src/components/Dropdown/constants.js +10 -0
- package/src/components/Dropdown/readme.mdx +88 -0
- package/src/components/Form/CharactersCount.vue +55 -0
- package/src/components/Form/Checkbox/Checkbox.scss +226 -0
- package/src/components/Form/Checkbox/Checkbox.stories.js +63 -0
- package/src/components/Form/Checkbox/Checkbox.vue +128 -0
- package/src/components/Form/Checkbox/readme.mdx +69 -0
- package/src/components/Form/CheckboxGroup/CheckboxGroup.stories.js +64 -0
- package/src/components/Form/CheckboxGroup/CheckboxGroup.vue +87 -0
- package/src/components/Form/CheckboxGroup/readme.mdx +56 -0
- package/src/components/Form/DatePicker/DatePicker.scss +479 -0
- package/src/components/Form/DatePicker/DatePicker.stories.js +78 -0
- package/src/components/Form/DatePicker/DatePicker.vue +284 -0
- package/src/components/Form/DatePicker/Icons/chevron-back.js +5 -0
- package/src/components/Form/DatePicker/Icons/chevron-forward.js +5 -0
- package/src/components/Form/DatePicker/readme.mdx +115 -0
- package/src/components/Form/FormGroup/FormGroup.stories.js +48 -0
- package/src/components/Form/FormGroup/FormGroup.vue +61 -0
- package/src/components/Form/FormGroup/FormGroupSet.stories.js +32 -0
- package/src/components/Form/FormGroup/FormGroupSet.vue +75 -0
- package/src/components/Form/Input/Input.stories.js +137 -0
- package/src/components/Form/Input/Input.vue +231 -0
- package/src/components/Form/Input/constants.js +5 -0
- package/src/components/Form/Input/input.scss +133 -0
- package/src/components/Form/Input/readme.mdx +68 -0
- package/src/components/Form/Label/Label.stories.js +29 -0
- package/src/components/Form/Label/Label.vue +87 -0
- package/src/components/Form/Label/readme.mdx +25 -0
- package/src/components/Form/PhoneInput/PhoneInput.stories.js +43 -0
- package/src/components/Form/PhoneInput/PhoneInput.vue +105 -0
- package/src/components/Form/PhoneInput/phoneInput.scss +197 -0
- package/src/components/Form/PhoneInput/readme.mdx +37 -0
- package/src/components/Form/Radio/Radio.stories.js +34 -0
- package/src/components/Form/Radio/Radio.vue +109 -0
- package/src/components/Form/Radio/radio.scss +187 -0
- package/src/components/Form/Radio/readme.mdx +48 -0
- package/src/components/Form/TextEditor/TextEditor.stories.js +58 -0
- package/src/components/Form/TextEditor/TextEditor.vue +305 -0
- package/src/components/Form/TextEditor/icons/svg/chevron-down.svg +3 -0
- package/src/components/Form/TextEditor/icons/toolbarIcons.js +111 -0
- package/src/components/Form/TextEditor/plugins/alphabetList.js +43 -0
- package/src/components/Form/TextEditor/readme.mdx +59 -0
- package/src/components/Form/TextEditor/textEditor.scss +684 -0
- package/src/components/Form/Textarea/Textarea.spec.js +107 -0
- package/src/components/Form/Textarea/Textarea.stories.js +68 -0
- package/src/components/Form/Textarea/Textarea.vue +102 -0
- package/src/components/Form/Textarea/readme.mdx +45 -0
- package/src/components/Form/Textarea/textarea.scss +84 -0
- package/src/components/Form/Toggle/Toggle.stories.js +44 -0
- package/src/components/Form/Toggle/Toggle.vue +122 -0
- package/src/components/Form/Toggle/readme.mdx +39 -0
- package/src/components/Form/Toggle/toggle.scss +166 -0
- package/src/components/Icon.vue +41 -0
- package/src/components/IconButton/IconButton.scss +91 -0
- package/src/components/IconButton/IconButton.stories.js +115 -0
- package/src/components/IconButton/IconButton.vue +100 -0
- package/src/components/IconButton/constants.js +14 -0
- package/src/components/IconButton/readme.mdx +66 -0
- package/src/components/List.vue +150 -0
- package/src/components/Modal/Modal.stories.js +48 -0
- package/src/components/Modal/Modal.vue +231 -0
- package/src/components/Modal/readme.mdx +76 -0
- package/src/components/Pagination/LimitSelector.vue +73 -0
- package/src/components/Pagination/Pagination.stories.js +54 -0
- package/src/components/Pagination/Pagination.vue +227 -0
- package/src/components/Pagination/pagination.scss +189 -0
- package/src/components/Popover/Popover.stories.js +46 -0
- package/src/components/Popover/Popover.vue +81 -0
- package/src/components/Popover/constants.js +14 -0
- package/src/components/Popover/popover.scss +26 -0
- package/src/components/Popover/readme.mdx +42 -0
- package/src/components/ProgressBar/ProgressBar.stories.js +90 -0
- package/src/components/ProgressBar/ProgressBar.vue +58 -0
- package/src/components/ProgressBar/constants.js +6 -0
- package/src/components/ProgressBar/progressBar.scss +116 -0
- package/src/components/ProgressBar/readme.mdx +67 -0
- package/src/components/Sorting/Sorting.stories.js +35 -0
- package/src/components/Sorting/Sorting.vue +128 -0
- package/src/components/Sorting/constants.js +10 -0
- package/src/components/Sorting/sorting.scss +87 -0
- package/src/components/SplitButton/SplitButton.stories.js +39 -0
- package/src/components/SplitButton/SplitButton.vue +132 -0
- package/src/components/SplitButton/SplitButtonItem.vue +34 -0
- package/src/components/SplitButton/constants.js +4 -0
- package/src/components/SplitButton/readme.mdx +77 -0
- package/src/components/SplitButton/splitButton.scss +161 -0
- package/src/components/StatusIndicator/StatusIndicator.stories.js +40 -0
- package/src/components/StatusIndicator/StatusIndicator.vue +52 -0
- package/src/components/StatusIndicator/constants.js +10 -0
- package/src/components/StatusIndicator/icons.js +48 -0
- package/src/components/StatusIndicator/readme.mdx +21 -0
- package/src/components/Table/Cells/Cell.vue +71 -0
- package/src/components/Table/Cells/CheckboxCell.vue +48 -0
- package/src/components/Table/Row.vue +26 -0
- package/src/components/Table/Table.stories.js +59 -0
- package/src/components/Table/Table.vue +36 -0
- package/src/components/Tabs/Tab.vue +37 -0
- package/src/components/Tabs/TabDropdown.vue +93 -0
- package/src/components/Tabs/Tabs.stories.js +57 -0
- package/src/components/Tabs/Tabs.vue +94 -0
- package/src/components/Tabs/tabs.scss +157 -0
- package/src/components/TagPill/TagPill.stories.js +30 -0
- package/src/components/TagPill/TagPill.vue +133 -0
- package/src/components/TagPill/constants.js +9 -0
- package/src/components/TagPill/readme.mdx +37 -0
- package/src/components/ToggleTip/ToggleTip.stories.js +98 -0
- package/src/components/ToggleTip/ToggleTip.vue +112 -0
- package/src/components/ToggleTip/constants.js +14 -0
- package/src/components/ToggleTip/readme.mdx +46 -0
- package/src/components/ToggleTip/toggleTip.scss +55 -0
- package/src/components/Tooltip/Tooltip.stories.js +56 -0
- package/src/components/Tooltip/Tooltip.vue +49 -0
- package/src/components/Tooltip/readme.mdx +43 -0
- package/src/components/TreeSelect/Option.vue +325 -0
- package/src/components/TreeSelect/Select.stories.js +349 -0
- package/src/components/TreeSelect/Select.vue +909 -0
- package/src/components/TreeSelect/TreeSelect.stories.js +270 -0
- package/src/components/TreeSelect/scss/option.scss +204 -0
- package/src/components/TreeSelect/scss/select.scss +166 -0
- package/src/constants/events.js +2 -0
- package/src/constants/keyCodes.js +8 -0
- package/src/directives/outside/outside.js +81 -0
- package/src/directives/outside/outside.stories.js +29 -0
- package/src/directives/outside/readme.mdx +24 -0
- package/src/helpers/generateUID.js +3 -0
- package/src/helpers/getHrefFromID.js +3 -0
- package/src/helpers/multiLineOverflows.js +3 -0
- package/src/helpers/removeEvents.js +9 -0
- package/src/index.js +49 -0
- package/src/main.js +12 -0
- package/src/stories/link.readme.mdx +57 -0
- package/src/stories/link.stories.js +59 -0
- package/static/Logo.svg +25 -0
- package/static/docks/button.pdf +147566 -0
- package/vite.config.js +47 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
$ib-shadow-m1: 0px 0px 1px rgba(0, 0, 0, 0.2);
|
|
2
|
+
$ib-shadow-m2: 0px 0px 1px rgba(0, 0, 0, 0.25);
|
|
3
|
+
$ib-shadow-m3: 0px 0px 1px rgba(0, 0, 0, 0.15), 0px 1px 5px rgba(0, 0, 0, 0.1);
|
|
4
|
+
|
|
5
|
+
$ib-shadow-1: 0px 0px 10px rgba(49, 63, 80, 0.05);
|
|
6
|
+
$ib-shadow-2: 0px 4px 4px rgba(49, 63, 80, 0.1);
|
|
7
|
+
$ib-shadow-3: 0px 3px 10px rgba(49, 63, 80, 0.14);
|
|
8
|
+
$ib-shadow-4: 0px 1px 10px rgba(49, 63, 80, 0.25);
|
|
9
|
+
$ib-shadow-5: 0px 5px 15px rgba(80, 80, 80, 0.15);
|
|
10
|
+
$ib-shadow-6: 0px 7px 20px rgba(49, 63, 80, 0.15);
|
|
11
|
+
$ib-shadow-7: 0px 15px 25px rgba(49, 63, 80, 0.05);
|
|
12
|
+
|
|
13
|
+
$ib-shadow-r: -2px 0px 7px rgba(80, 80, 80, 0.1);
|
|
14
|
+
$ib-shadow-r1: -4px 0px 14px rgba(80, 80, 80, 0.1);
|
|
15
|
+
|
|
16
|
+
$ib-shadow-l: 2px 0px 7px rgba(80, 80, 80, 0.1);
|
|
17
|
+
$ib-shadow-l1: 4px 0px 14px rgba(80, 80, 80, 0.1);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@import "../../assets/scss/variables/colors.scss";
|
|
2
|
+
@import "../../assets/scss/mixins.scss";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
$title-bg: $gray-200;
|
|
6
|
+
$title-color: $neutral-900;
|
|
7
|
+
$title-chevron-color: $neutral-900;
|
|
8
|
+
$title-border-color: transparent;
|
|
9
|
+
|
|
10
|
+
$title-hover-bg: $blue-100;
|
|
11
|
+
$title-hover-color: $blue-700;
|
|
12
|
+
$title-hover-chevron-color: $blue-700;
|
|
13
|
+
$title-hover-border-color: $blue-300;
|
|
14
|
+
|
|
15
|
+
$title-active-bg: $blue-200;
|
|
16
|
+
$title-active-color: $blue-900;
|
|
17
|
+
$title-active-chevron-color: $blue-900;
|
|
18
|
+
$title-active-border-color: transparent;
|
|
19
|
+
|
|
20
|
+
$title-opened-chevron-color: $blue-900;
|
|
21
|
+
|
|
22
|
+
$content-border-color: $gray-200;
|
|
23
|
+
$content-bg: $gray-50;
|
|
24
|
+
|
|
25
|
+
.ib-accordion {
|
|
26
|
+
.accordion-title {
|
|
27
|
+
text-align: start;
|
|
28
|
+
position: relative;
|
|
29
|
+
border-radius: 4px;
|
|
30
|
+
padding: 0 13px;
|
|
31
|
+
height: 36px;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
background-color: $title-bg;
|
|
35
|
+
border: 2px solid $title-border-color;
|
|
36
|
+
color: $title-color;
|
|
37
|
+
transition: border 0.3s, color 0.3s, background-color 0.3s;
|
|
38
|
+
width: 100%;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
|
|
41
|
+
.chevron-icon {
|
|
42
|
+
font-size: 16px;
|
|
43
|
+
color: $title-chevron-color;
|
|
44
|
+
position: absolute;
|
|
45
|
+
right: 15px;
|
|
46
|
+
top: 50%;
|
|
47
|
+
transform: translateY(-50%);
|
|
48
|
+
transition: color 0.3s, transform 0.3s;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:hover {
|
|
52
|
+
color: $title-hover-color;
|
|
53
|
+
background-color: $title-hover-bg;
|
|
54
|
+
border-color: $title-hover-border-color;
|
|
55
|
+
|
|
56
|
+
.chevron-icon {
|
|
57
|
+
color: $title-hover-chevron-color;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&:active {
|
|
62
|
+
color: $title-active-color;
|
|
63
|
+
background-color: $title-active-bg;
|
|
64
|
+
border-color: $title-active-border-color;
|
|
65
|
+
|
|
66
|
+
.chevron-icon {
|
|
67
|
+
color: $title-active-chevron-color;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:focus {
|
|
72
|
+
@include focus(2px);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.accordion-content {
|
|
77
|
+
border-radius: 0 0 4px 4px;
|
|
78
|
+
border: 1px solid $content-border-color;
|
|
79
|
+
padding:10px 15px 15px;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
transition: height 0.3s, padding-top 0.3s, padding-bottom 0.3s;
|
|
82
|
+
background-color: $content-bg;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&.active {
|
|
86
|
+
.accordion-title {
|
|
87
|
+
border-radius: 4px 4px 0 0;
|
|
88
|
+
.chevron-icon {
|
|
89
|
+
color: $title-opened-chevron-color;
|
|
90
|
+
transform: translateY(-50%) rotate(180deg);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import IbAccordion from "./Accordion.vue";
|
|
2
|
+
import readme from "./readme.mdx";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Accordion",
|
|
6
|
+
components: IbAccordion,
|
|
7
|
+
argTypes: {
|
|
8
|
+
isOpen: { control: "boolean" },
|
|
9
|
+
onOpen: { action: "open" },
|
|
10
|
+
onClose: { action: "close" },
|
|
11
|
+
},
|
|
12
|
+
parameters: {
|
|
13
|
+
docs: {
|
|
14
|
+
page: readme,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const Template = (args) => ({
|
|
20
|
+
components: { IbAccordion },
|
|
21
|
+
setup() {
|
|
22
|
+
return { args };
|
|
23
|
+
},
|
|
24
|
+
template: `
|
|
25
|
+
<ib-accordion v-bind="args">
|
|
26
|
+
<template v-slot:title>
|
|
27
|
+
Title
|
|
28
|
+
</template>
|
|
29
|
+
<template v-slot:content>
|
|
30
|
+
<ul style="margin: 0;">
|
|
31
|
+
<li>Item 1</li>
|
|
32
|
+
<li>Item 2</li>
|
|
33
|
+
<li>Item 3</li>
|
|
34
|
+
<li>Item 4</li>
|
|
35
|
+
</ul>
|
|
36
|
+
</template>
|
|
37
|
+
</ib-accordion>
|
|
38
|
+
`,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ib-accordion" :class="{ active: isActive }">
|
|
3
|
+
<button class="accordion-title" @click="onClick">
|
|
4
|
+
<slot name="title"></slot>
|
|
5
|
+
|
|
6
|
+
<ib-icon class="chevron-icon" name="chevron-down-outline" />
|
|
7
|
+
</button>
|
|
8
|
+
|
|
9
|
+
<Transition
|
|
10
|
+
name="expand"
|
|
11
|
+
@enter="enter"
|
|
12
|
+
@after-enter="afterEnter"
|
|
13
|
+
@leave="leave"
|
|
14
|
+
>
|
|
15
|
+
<div v-show="isActive" class="accordion-content">
|
|
16
|
+
<slot name="content"></slot>
|
|
17
|
+
</div>
|
|
18
|
+
</Transition>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import IbIcon from "../Icon.vue";
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
name: "IbAccordion",
|
|
27
|
+
props: {
|
|
28
|
+
isOpen: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
watch: {
|
|
34
|
+
isOpen(val) {
|
|
35
|
+
this.isActive = val;
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
data() {
|
|
39
|
+
return {
|
|
40
|
+
isActive: this.isOpen,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
methods: {
|
|
44
|
+
onClick() {
|
|
45
|
+
this.isActive = !this.isActive;
|
|
46
|
+
if (this.isActive) {
|
|
47
|
+
this.$emit("open", this.isActive);
|
|
48
|
+
} else {
|
|
49
|
+
this.$emit("close", this.isActive);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
enter(element) {
|
|
53
|
+
const width = getComputedStyle(element).width;
|
|
54
|
+
|
|
55
|
+
element.style.width = width;
|
|
56
|
+
element.style.position = "absolute";
|
|
57
|
+
element.style.visibility = "hidden";
|
|
58
|
+
element.style.height = "auto";
|
|
59
|
+
|
|
60
|
+
const height = getComputedStyle(element).height;
|
|
61
|
+
|
|
62
|
+
element.style.width = null;
|
|
63
|
+
element.style.position = null;
|
|
64
|
+
element.style.visibility = null;
|
|
65
|
+
element.style.height = 0;
|
|
66
|
+
getComputedStyle(element).height;
|
|
67
|
+
requestAnimationFrame(() => {
|
|
68
|
+
element.style.height = height;
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
afterEnter(element) {
|
|
72
|
+
element.style.height = "auto";
|
|
73
|
+
},
|
|
74
|
+
leave(element) {
|
|
75
|
+
const height = getComputedStyle(element).height;
|
|
76
|
+
|
|
77
|
+
element.style.height = height;
|
|
78
|
+
getComputedStyle(element).height;
|
|
79
|
+
|
|
80
|
+
requestAnimationFrame(() => {
|
|
81
|
+
element.style.height = 0;
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
components: {
|
|
86
|
+
IbIcon,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<style lang="scss" scoped>
|
|
92
|
+
.expand-enter-active,
|
|
93
|
+
.expand-leave-active {
|
|
94
|
+
transition: height 1s ease-in-out;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.expand-enter,
|
|
99
|
+
.expand-leave-to {
|
|
100
|
+
height: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@import "./Accordion.scss";
|
|
104
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# IbAccordion
|
|
2
|
+
|
|
3
|
+
import { Meta, Story, Canvas } from "@storybook/addon-docs";
|
|
4
|
+
import * as ButtonStories from './Accordion.stories';
|
|
5
|
+
|
|
6
|
+
The expansion panel component delivers large amounts of content in a small space through progressive disclosure. The header title give the user a high level overview of the content allowing the user to decide which sections to read.
|
|
7
|
+
|
|
8
|
+
Expansion panel can make information processing and discovering more effective. However, it does hide content from users and it’s important to account for a user not noticing or reading all of the included content. If a user is likely to read all of the content then don’t use an accordion as it adds the burden of an extra click; instead use a full scrolling page with normal headers.
|
|
9
|
+
|
|
10
|
+
### When to Use
|
|
11
|
+
|
|
12
|
+
- To organize related information.
|
|
13
|
+
- To shorten pages and reduce scrolling when content is not crucial to read in full.
|
|
14
|
+
- When space is at a premium and long content cannot be displayed all at once, like on a mobile interface or in a side panel.
|
|
15
|
+
|
|
16
|
+
### Props
|
|
17
|
+
|
|
18
|
+
| Name | type | Default Value | Description |
|
|
19
|
+
| ------ | ------- | ------------- | ------------------------------------------------------- |
|
|
20
|
+
| isOpen | Boolean | false | Sets whether the accordion is initially open or closed. |
|
|
21
|
+
|
|
22
|
+
### Slots
|
|
23
|
+
|
|
24
|
+
| Slot name | Description |
|
|
25
|
+
| --------- | ---------------------------------------------------------------------------------- |
|
|
26
|
+
| title | Used to provide the title of the accordion. |
|
|
27
|
+
| content | Used to provide the content that will be displayed when the accordion is expanded. |
|
|
28
|
+
|
|
29
|
+
### Events
|
|
30
|
+
|
|
31
|
+
| Event name | Parameters | Description |
|
|
32
|
+
| ---------- | ---------- | ------------------------------------- |
|
|
33
|
+
| open | True | Emitted when the accordion is opened. |
|
|
34
|
+
| close | false | Emitted when the accordion is closed. |
|
|
35
|
+
|
|
36
|
+
### Default
|
|
37
|
+
|
|
38
|
+
<Canvas of={ButtonStories.Default} />
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import IbAlert from "./Alert.vue";
|
|
2
|
+
import { alertTypeOptions } from "./constants";
|
|
3
|
+
import readme from "./readme.mdx";
|
|
4
|
+
export default {
|
|
5
|
+
title: "Alert",
|
|
6
|
+
component: IbAlert,
|
|
7
|
+
argTypes: {
|
|
8
|
+
onClose: { action: "close" },
|
|
9
|
+
type: {
|
|
10
|
+
control: { type: "select" },
|
|
11
|
+
options: Object.values(alertTypeOptions),
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
page: readme,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const Template = (args) => ({
|
|
22
|
+
components: { IbAlert },
|
|
23
|
+
setup() {
|
|
24
|
+
return { args };
|
|
25
|
+
},
|
|
26
|
+
template: `
|
|
27
|
+
<ib-alert v-bind="args">
|
|
28
|
+
Alert message
|
|
29
|
+
</ib-alert>`,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const Default = Template.bind({});
|
|
33
|
+
|
|
34
|
+
const Type = (args) => ({
|
|
35
|
+
components: { IbAlert },
|
|
36
|
+
setup() {
|
|
37
|
+
return { args };
|
|
38
|
+
},
|
|
39
|
+
template: `
|
|
40
|
+
<ib-alert style="margin-bottom: 5px;">Alert message</ib-alert>
|
|
41
|
+
<ib-alert style="margin-bottom: 5px;" type="warning">Warning message</ib-alert>
|
|
42
|
+
<ib-alert style="margin-bottom: 5px;" type="success">Success message</ib-alert>
|
|
43
|
+
<ib-alert type="info">Info message</ib-alert>
|
|
44
|
+
`,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const Types = Type.bind({});
|
|
48
|
+
Type.parameters = { controls: { disable: true } };
|
|
49
|
+
|
|
50
|
+
const LargeTemplate = (args) => ({
|
|
51
|
+
components: { IbAlert },
|
|
52
|
+
setup() {
|
|
53
|
+
return { args };
|
|
54
|
+
},
|
|
55
|
+
template: `
|
|
56
|
+
<ib-alert v-bind="args">
|
|
57
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
58
|
+
<template #link>
|
|
59
|
+
<a href="#" class="ib-standalone-link">View Server</a>
|
|
60
|
+
</template>
|
|
61
|
+
</ib-alert>`,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const LargeAlert = LargeTemplate.bind({});
|
|
65
|
+
LargeAlert.args = {
|
|
66
|
+
showCloseButton: true,
|
|
67
|
+
showIcon: true,
|
|
68
|
+
title: "It is Title",
|
|
69
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div role="alert" :class="classes">
|
|
3
|
+
<div ref="content" class="content">
|
|
4
|
+
<span class="content-head">
|
|
5
|
+
<ib-icon v-if="showIcon" class="ib-alert-icon" :name="iconName" />
|
|
6
|
+
<b v-if="title?.length" class="ib-alert-title">
|
|
7
|
+
{{ title }}
|
|
8
|
+
</b>
|
|
9
|
+
</span>
|
|
10
|
+
|
|
11
|
+
<span class="text-content">
|
|
12
|
+
<slot></slot>
|
|
13
|
+
</span>
|
|
14
|
+
|
|
15
|
+
<div class="link">
|
|
16
|
+
<slot name="link"></slot>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<ib-icon-button
|
|
21
|
+
class="close-button"
|
|
22
|
+
v-if="showCloseButton"
|
|
23
|
+
@click="close"
|
|
24
|
+
kind="ghost"
|
|
25
|
+
>
|
|
26
|
+
<ib-icon class="close-button-icon" name="close-outline" />
|
|
27
|
+
</ib-icon-button>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
import IbIcon from "../Icon.vue";
|
|
33
|
+
import IbIconButton from "../IconButton/IconButton.vue";
|
|
34
|
+
import { alertTypeOptions } from "./constants";
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
name: "IbAlert",
|
|
38
|
+
props: {
|
|
39
|
+
type: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: alertTypeOptions.alert,
|
|
42
|
+
validator: (value) => Object.keys(alertTypeOptions).includes(value),
|
|
43
|
+
},
|
|
44
|
+
showIcon: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false,
|
|
47
|
+
},
|
|
48
|
+
showCloseButton: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false,
|
|
51
|
+
},
|
|
52
|
+
title: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: "",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
mounted() {
|
|
58
|
+
this.checkHeight();
|
|
59
|
+
window.addEventListener("resize", () => this.checkHeight());
|
|
60
|
+
},
|
|
61
|
+
methods: {
|
|
62
|
+
close() {
|
|
63
|
+
this.$emit("close");
|
|
64
|
+
},
|
|
65
|
+
checkHeight() {
|
|
66
|
+
if (!this.$refs.content) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const contentStyle = getComputedStyle(this.$refs.content);
|
|
71
|
+
const parentWidth = this.$refs.content?.parentElement.offsetWidth;
|
|
72
|
+
|
|
73
|
+
if (!parentWidth || !contentStyle) return;
|
|
74
|
+
|
|
75
|
+
if (parseInt(contentStyle.width) <= parentWidth) {
|
|
76
|
+
this.$refs.content.classList.remove("large");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (parseInt(contentStyle.height) > 37) {
|
|
80
|
+
this.$refs.content.classList.add("large");
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
computed: {
|
|
85
|
+
classes() {
|
|
86
|
+
const classList = ["ib-alert"];
|
|
87
|
+
classList.push(`ib-alert-${this.type}`);
|
|
88
|
+
|
|
89
|
+
if (this.title.length) {
|
|
90
|
+
classList.push("has-title");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (this.showIcon) {
|
|
94
|
+
classList.push("has-icon");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (this.showCloseButton) {
|
|
98
|
+
classList.push("has-close-button");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (this.$slots.link) {
|
|
102
|
+
classList.push("has-link");
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return classList;
|
|
106
|
+
},
|
|
107
|
+
iconName() {
|
|
108
|
+
if (this.type === alertTypeOptions.info) {
|
|
109
|
+
return "information-circle-outline";
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (this.type === alertTypeOptions.success) {
|
|
113
|
+
return "checkmark-circle-outline";
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return "alert-circle-outline";
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
beforeUnmount() {
|
|
120
|
+
window.removeEventListener("resize", () => this.checkHeight());
|
|
121
|
+
},
|
|
122
|
+
components: {
|
|
123
|
+
IbIcon,
|
|
124
|
+
IbIconButton,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
<style lang="scss" scoped>
|
|
130
|
+
@import "./alert.scss";
|
|
131
|
+
</style>
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
@import "../../assets/scss/variables/colors.scss";
|
|
2
|
+
@import "../../assets/scss//typography.scss";
|
|
3
|
+
|
|
4
|
+
$alert-content-color: $neutral-900;
|
|
5
|
+
$alert-alert-primary-color: $red-800;
|
|
6
|
+
$alert-alert-secondary-color: $red-50;
|
|
7
|
+
$alert-warning-primary-color: $brown-400;
|
|
8
|
+
$alert-warning-secondary-color: $yellow-50;
|
|
9
|
+
$alert-info-primary-color: $blue-700;
|
|
10
|
+
$alert-info-secondary-color: $blue-50;
|
|
11
|
+
$alert-success-primary-color: $green-800;
|
|
12
|
+
$alert-success-secondary-color: $green-50;
|
|
13
|
+
|
|
14
|
+
.ib-alert {
|
|
15
|
+
padding: 5px;
|
|
16
|
+
color: $alert-content-color;
|
|
17
|
+
border-radius: 2px;
|
|
18
|
+
border-left: 2px solid transparent;
|
|
19
|
+
position: relative;
|
|
20
|
+
|
|
21
|
+
&.has-title {
|
|
22
|
+
.content .text-content {
|
|
23
|
+
@include Ib-H4-regular;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.link {
|
|
28
|
+
padding-left: 10px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.has-icon {
|
|
32
|
+
padding-top: 10px;
|
|
33
|
+
padding-bottom: 10px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.has-close-button {
|
|
37
|
+
padding-right: 44px;
|
|
38
|
+
|
|
39
|
+
.large + .close-button {
|
|
40
|
+
top: 10px;
|
|
41
|
+
transform: translateY(0);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.has-close-button .content {
|
|
46
|
+
min-height: 24px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.has-link {
|
|
50
|
+
.content {
|
|
51
|
+
.link {
|
|
52
|
+
margin-left: auto;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.large {
|
|
56
|
+
.link {
|
|
57
|
+
padding-bottom: 5px;
|
|
58
|
+
display: flex;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
&.has-close-button {
|
|
63
|
+
.content {
|
|
64
|
+
&.large {
|
|
65
|
+
.link {
|
|
66
|
+
margin-right: -24px;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.content {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
width: auto;
|
|
77
|
+
|
|
78
|
+
.content-head {
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.text-content {
|
|
84
|
+
@include Ib-H5-regular;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.large {
|
|
88
|
+
padding-left: 3px;
|
|
89
|
+
padding-right: 5px;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
align-items: flex-start;
|
|
92
|
+
|
|
93
|
+
.text-content {
|
|
94
|
+
@include Ib-P1-regular;
|
|
95
|
+
margin-top: 5px;
|
|
96
|
+
margin-bottom: 5px;
|
|
97
|
+
padding-left: 0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&.has-icon {
|
|
103
|
+
.content.large .text-content {
|
|
104
|
+
padding-left: 25px;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.close-button {
|
|
109
|
+
position: absolute;
|
|
110
|
+
right: 10px;
|
|
111
|
+
top: 50%;
|
|
112
|
+
transform: translateY(-50%);
|
|
113
|
+
|
|
114
|
+
.close-button-icon {
|
|
115
|
+
font-size: 20px;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&-title {
|
|
120
|
+
margin-right: 5px;
|
|
121
|
+
@include Ib-H4-medium;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&-icon {
|
|
125
|
+
display: inline-block;
|
|
126
|
+
font-size: 20px;
|
|
127
|
+
min-width: 20px;
|
|
128
|
+
margin-right: 5px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&-alert {
|
|
132
|
+
border-left-color: $alert-alert-primary-color;
|
|
133
|
+
background-color: $alert-alert-secondary-color;
|
|
134
|
+
|
|
135
|
+
.ib-alert-icon {
|
|
136
|
+
color: $alert-alert-primary-color;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&-warning {
|
|
141
|
+
border-left-color: $alert-warning-primary-color;
|
|
142
|
+
background-color: $alert-warning-secondary-color;
|
|
143
|
+
|
|
144
|
+
.ib-alert-icon {
|
|
145
|
+
color: $alert-warning-primary-color;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&-info {
|
|
150
|
+
border-left-color: $alert-info-primary-color;
|
|
151
|
+
background-color: $alert-info-secondary-color;
|
|
152
|
+
|
|
153
|
+
.ib-alert-icon {
|
|
154
|
+
color: $alert-info-primary-color;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&-success {
|
|
159
|
+
border-left-color: $alert-success-primary-color;
|
|
160
|
+
background-color: $alert-success-secondary-color;
|
|
161
|
+
|
|
162
|
+
.ib-alert-icon {
|
|
163
|
+
color: $alert-success-primary-color;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|