@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,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ib-cell :fixed="fixed" class="ib-checkbox-cell">
|
|
3
|
+
<ib-checkbox :is-checked="isChecked"></ib-checkbox>
|
|
4
|
+
</ib-cell>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import IbCell from "./Cell.vue";
|
|
9
|
+
import IbCheckbox from "../../Form/Checkbox/Checkbox.vue";
|
|
10
|
+
export default {
|
|
11
|
+
name: "IbCheckboxCell",
|
|
12
|
+
props: {
|
|
13
|
+
isChecked: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false,
|
|
16
|
+
},
|
|
17
|
+
fixed: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
components: {
|
|
23
|
+
IbCell,
|
|
24
|
+
IbCheckbox,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<style lang="scss">
|
|
30
|
+
.ib-checkbox-cell {
|
|
31
|
+
width: 50px;
|
|
32
|
+
max-width: 50px;
|
|
33
|
+
|
|
34
|
+
.ib-checkbox {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
+ .ib-cell {
|
|
41
|
+
padding-left: 0;
|
|
42
|
+
|
|
43
|
+
.cell {
|
|
44
|
+
justify-content: flex-start;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tr class="ib-tr">
|
|
3
|
+
<slot ref="row"></slot>
|
|
4
|
+
</tr>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: "IbRow",
|
|
10
|
+
};
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<style lang="scss">
|
|
14
|
+
@import "../../assets/scss/variables/colors.scss";
|
|
15
|
+
.ib-tr {
|
|
16
|
+
.ib-cell {
|
|
17
|
+
background-color: $white;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&:nth-child(even) {
|
|
21
|
+
.ib-cell {
|
|
22
|
+
background-color: $gray-50;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import IbTable from "./Table.vue";
|
|
2
|
+
import IbRow from "./Row.vue";
|
|
3
|
+
import IbCell from "./Cells/Cell.vue";
|
|
4
|
+
import IbCheckboxCell from "./Cells/CheckboxCell.vue";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Table/Table",
|
|
8
|
+
component: IbTable,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const Template = (args) => ({
|
|
12
|
+
components: { IbTable, IbRow, IbCell, IbCheckboxCell },
|
|
13
|
+
setup() {
|
|
14
|
+
const users = ["user1", "user2", "user3", "user4", "user5"];
|
|
15
|
+
return { users, args };
|
|
16
|
+
},
|
|
17
|
+
template: `
|
|
18
|
+
<ib-table v-bind="args">
|
|
19
|
+
<template #tbody>
|
|
20
|
+
<ib-row v-for="(user, index) in users">
|
|
21
|
+
<ib-checkbox-cell />
|
|
22
|
+
<ib-cell>{{user}}</ib-cell>
|
|
23
|
+
<ib-cell>
|
|
24
|
+
<a href="#" class="ib-standalone-link">{{user}}@email.com</a>
|
|
25
|
+
</ib-cell>
|
|
26
|
+
<ib-cell>Teacher</ib-cell>
|
|
27
|
+
<ib-cell>2021-11-16</ib-cell>
|
|
28
|
+
</ib-row>
|
|
29
|
+
</template>
|
|
30
|
+
</ib-table>`,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const Default = Template.bind({});
|
|
34
|
+
|
|
35
|
+
const TemplateWithFreeze = (args) => ({
|
|
36
|
+
components: { IbTable, IbRow, IbCell, IbCheckboxCell },
|
|
37
|
+
setup() {
|
|
38
|
+
const users = ["user1", "user2", "user3", "user4", "user5"];
|
|
39
|
+
return { users, args };
|
|
40
|
+
},
|
|
41
|
+
template: `
|
|
42
|
+
<ib-table v-bind="args">
|
|
43
|
+
<template #tbody>
|
|
44
|
+
<ib-row v-for="(user, index) in users">
|
|
45
|
+
<ib-checkbox-cell fixed/>
|
|
46
|
+
<ib-cell fixed>{{user}}</ib-cell>
|
|
47
|
+
<ib-cell>
|
|
48
|
+
<a href="#" class="ib-standalone-link">{{user}}@email.com</a>
|
|
49
|
+
</ib-cell>
|
|
50
|
+
<ib-cell>Teacher</ib-cell>
|
|
51
|
+
<ib-cell>Synced</ib-cell>
|
|
52
|
+
<ib-cell>Non editing teacher</ib-cell>
|
|
53
|
+
<ib-cell>2021-11-16</ib-cell>
|
|
54
|
+
</ib-row>
|
|
55
|
+
</template>
|
|
56
|
+
</ib-table>`,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const DefaultWithFixedCol = TemplateWithFreeze.bind({});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ib-table-wrapper">
|
|
3
|
+
<table class="ib-table">
|
|
4
|
+
<template v-if="hasThead">
|
|
5
|
+
<slot name="thead"></slot>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<tbody>
|
|
9
|
+
<slot name="tbody"></slot>
|
|
10
|
+
</tbody>
|
|
11
|
+
</table>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
export default {
|
|
17
|
+
name: "IbTable",
|
|
18
|
+
computed: {
|
|
19
|
+
hasThead() {
|
|
20
|
+
return !!this.$slots.thead;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<style lang="scss" scoped>
|
|
27
|
+
.ib-table-wrapper {
|
|
28
|
+
overflow: auto;
|
|
29
|
+
}
|
|
30
|
+
.ib-table {
|
|
31
|
+
overflow: auto;
|
|
32
|
+
width: 100%;
|
|
33
|
+
border-collapse: unset;
|
|
34
|
+
border-spacing: 0;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="isTabActive">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
export default {
|
|
8
|
+
name: "IbTab",
|
|
9
|
+
props: {
|
|
10
|
+
title: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
id: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
disabled: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
initialized: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
26
|
+
name: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: null,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
computed: {
|
|
32
|
+
isTabActive() {
|
|
33
|
+
return this.$parent.selectedTab === this.id;
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="wrapper-tab-link dropdown-tab">
|
|
3
|
+
<ib-dropdown-list :disabled="isDisabledDropdown" :close-on-click="true">
|
|
4
|
+
<template #trigger>
|
|
5
|
+
<span
|
|
6
|
+
class="tab-link"
|
|
7
|
+
:class="{
|
|
8
|
+
active: selectedTabByDropdown === selectedTab || isActive,
|
|
9
|
+
disabled: isDisabledDropdown,
|
|
10
|
+
}"
|
|
11
|
+
:tabindex="isDisabledDropdown ? -1 : 0"
|
|
12
|
+
>
|
|
13
|
+
{{ tabs.name }}
|
|
14
|
+
<ib-icon name="chevron-down"></ib-icon>
|
|
15
|
+
</span>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<template #body>
|
|
19
|
+
<ib-dropdown-item
|
|
20
|
+
v-for="(tab, index) in tabs.tabs"
|
|
21
|
+
:key="index"
|
|
22
|
+
:checked="tab.id === selectedTab"
|
|
23
|
+
:href="createHref(tab.id)"
|
|
24
|
+
:tabindex="tab.disabled ? -1 : 0"
|
|
25
|
+
:class="{
|
|
26
|
+
disabled: tab.disabled,
|
|
27
|
+
}"
|
|
28
|
+
class="dropdown-tab-item"
|
|
29
|
+
target="_self"
|
|
30
|
+
@click="selectTab(tab.id)"
|
|
31
|
+
>
|
|
32
|
+
{{ tab.title }}
|
|
33
|
+
</ib-dropdown-item>
|
|
34
|
+
</template>
|
|
35
|
+
</ib-dropdown-list>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
<script>
|
|
39
|
+
import IbDropdownList from "../Dropdown/DropdownList.vue";
|
|
40
|
+
import IbDropdownItem from "../Dropdown/DropdownItem.vue";
|
|
41
|
+
import IbIcon from "../Icon.vue";
|
|
42
|
+
import getHrefFromId from "../../helpers/getHrefFromID";
|
|
43
|
+
|
|
44
|
+
export default {
|
|
45
|
+
name: "IbTabDropdown",
|
|
46
|
+
props: {
|
|
47
|
+
tabs: {
|
|
48
|
+
rype: Object,
|
|
49
|
+
default: {},
|
|
50
|
+
},
|
|
51
|
+
selectedTab: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
selectedTabByDropdown: "",
|
|
59
|
+
isDisabledDropdown: this.setDisabledTab(),
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
methods: {
|
|
63
|
+
createHref(id) {
|
|
64
|
+
return getHrefFromId(id);
|
|
65
|
+
},
|
|
66
|
+
selectTab(id) {
|
|
67
|
+
this.selectedTabByDropdown = id;
|
|
68
|
+
this.$emit("select-tab", id);
|
|
69
|
+
},
|
|
70
|
+
setDisabledTab() {
|
|
71
|
+
return this.tabs.tabs.every((item) => item.disabled);
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
computed: {
|
|
75
|
+
isActive() {
|
|
76
|
+
for (let tab of this.tabs.tabs) {
|
|
77
|
+
if (tab.id === this.selectedTab) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
components: {
|
|
85
|
+
IbDropdownList,
|
|
86
|
+
IbDropdownItem,
|
|
87
|
+
IbIcon,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
</script>
|
|
91
|
+
<style lang="scss">
|
|
92
|
+
@import "./tabs.scss";
|
|
93
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import IbTabs from "./Tabs.vue";
|
|
2
|
+
import IbTab from "./Tab.vue";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Tabs",
|
|
6
|
+
component: IbTab,
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component:
|
|
11
|
+
"We must paste our component with content in our tabs wrapper - <ib-tabs>, if there value props name - than tab creted dobdown item",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const Template = (args) => ({
|
|
18
|
+
components: { IbTabs, IbTab },
|
|
19
|
+
setup() {
|
|
20
|
+
return { args };
|
|
21
|
+
},
|
|
22
|
+
template: `
|
|
23
|
+
<ib-tabs>
|
|
24
|
+
<ib-tab v-bind="args" id="my-profile" title="My profile">
|
|
25
|
+
<p>My profile content</p>
|
|
26
|
+
</ib-tab>
|
|
27
|
+
<ib-tab
|
|
28
|
+
id="account-settings"
|
|
29
|
+
title="Account settings"
|
|
30
|
+
>
|
|
31
|
+
<p>Account settings content</p>
|
|
32
|
+
</ib-tab>
|
|
33
|
+
<ib-tab id="connections" title="Connections" disabled="true">
|
|
34
|
+
<p>Connections</p>
|
|
35
|
+
</ib-tab>
|
|
36
|
+
<ib-tab
|
|
37
|
+
name="Users and Roles"
|
|
38
|
+
id="users"
|
|
39
|
+
title="Users"
|
|
40
|
+
dropdown="true"
|
|
41
|
+
>
|
|
42
|
+
<p>Users content</p>
|
|
43
|
+
</ib-tab>
|
|
44
|
+
<ib-tab
|
|
45
|
+
name="Users and Roles"
|
|
46
|
+
id="roles"
|
|
47
|
+
title="Roles"
|
|
48
|
+
dropdown="true"
|
|
49
|
+
disabled="true"
|
|
50
|
+
>
|
|
51
|
+
<p>Roles content 2</p>
|
|
52
|
+
</ib-tab>
|
|
53
|
+
</ib-tabs>
|
|
54
|
+
`,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tabs">
|
|
3
|
+
<ul class="tabs-list">
|
|
4
|
+
<li class="tab-item" v-for="(tab, index) in tabs" :key="index">
|
|
5
|
+
<div v-if="!tab.name" class="wrapper-tab-link">
|
|
6
|
+
<a
|
|
7
|
+
class="tab-link"
|
|
8
|
+
:class="{
|
|
9
|
+
active: selectedTab === tab.id,
|
|
10
|
+
disabled: tab.disabled,
|
|
11
|
+
}"
|
|
12
|
+
:href="createHref(tab.id)"
|
|
13
|
+
:tabindex="tab.disabled ? -1 : 0"
|
|
14
|
+
@click="selectTab(tab.id)"
|
|
15
|
+
target="_self"
|
|
16
|
+
>
|
|
17
|
+
{{ tab.title }}
|
|
18
|
+
</a>
|
|
19
|
+
</div>
|
|
20
|
+
<ib-tab-dropdown
|
|
21
|
+
v-else
|
|
22
|
+
:selected-tab="selectedTab"
|
|
23
|
+
:tabs="tab"
|
|
24
|
+
@select-tab="selectTab"
|
|
25
|
+
>
|
|
26
|
+
</ib-tab-dropdown>
|
|
27
|
+
</li>
|
|
28
|
+
</ul>
|
|
29
|
+
<div class="tabs-content" ref="tabHandler">
|
|
30
|
+
<slot></slot>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
<script>
|
|
35
|
+
import IbTabDropdown from "./TabDropdown.vue";
|
|
36
|
+
import getHrefFromId from "../../helpers/getHrefFromID";
|
|
37
|
+
export default {
|
|
38
|
+
name: "IbTabs",
|
|
39
|
+
data() {
|
|
40
|
+
return {
|
|
41
|
+
tabs: [],
|
|
42
|
+
selectedTab: "",
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
created() {
|
|
46
|
+
this.$slots.default().forEach((item) => {
|
|
47
|
+
if (!item.props.name) {
|
|
48
|
+
this.tabs.push(item.props);
|
|
49
|
+
} else {
|
|
50
|
+
const findIndex = this.tabs.findIndex(
|
|
51
|
+
(tab) => tab.name === item.props.name
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
if (findIndex !== -1) {
|
|
55
|
+
this.tabs[findIndex].tabs.push(item.props);
|
|
56
|
+
} else {
|
|
57
|
+
const itemProps = { name: item.props.name, tabs: [item.props] };
|
|
58
|
+
this.tabs.push(itemProps);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
for (let tab of this.tabs) {
|
|
64
|
+
if (!tab.disabled) {
|
|
65
|
+
if (tab.tabs) {
|
|
66
|
+
for (let tabItem of tab.tabs) {
|
|
67
|
+
if (!tabItem.disabled) {
|
|
68
|
+
this.selectTab(tabItem.id);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
this.selectTab(tab.id);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
methods: {
|
|
80
|
+
createHref(id) {
|
|
81
|
+
return getHrefFromId(id);
|
|
82
|
+
},
|
|
83
|
+
selectTab(id) {
|
|
84
|
+
this.selectedTab = id;
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
components: {
|
|
88
|
+
IbTabDropdown,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
</script>
|
|
92
|
+
<style lang="scss" scoped>
|
|
93
|
+
@import "./tabs.scss";
|
|
94
|
+
</style>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
@import "../../assets/scss/variables/colors.scss";
|
|
2
|
+
@import "../../assets/scss/typography.scss";
|
|
3
|
+
@import "../../assets/scss/mixins.scss";
|
|
4
|
+
@import "../../assets/scss/reset.scss";
|
|
5
|
+
|
|
6
|
+
.tabs {
|
|
7
|
+
|
|
8
|
+
.tabs-list {
|
|
9
|
+
display: flex;
|
|
10
|
+
list-style: none;
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
@include Ib-H4-medium;
|
|
14
|
+
position: relative;
|
|
15
|
+
margin-bottom: 100px;
|
|
16
|
+
|
|
17
|
+
&::after {
|
|
18
|
+
content: '';
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 1px;
|
|
21
|
+
bottom: 0;
|
|
22
|
+
position: absolute;
|
|
23
|
+
background-color: $gray-300;
|
|
24
|
+
z-index: -1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.tab-item {
|
|
28
|
+
position: relative;
|
|
29
|
+
margin: 0 15px;
|
|
30
|
+
|
|
31
|
+
.ib-dropdown-item.disabled.dropdown-tab-item {
|
|
32
|
+
color: $neutral-500;
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
opacity: 0.5;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:nth-child(1) {
|
|
38
|
+
margin-left: 0;
|
|
39
|
+
}
|
|
40
|
+
&:nth-last-child(1) {
|
|
41
|
+
margin-right: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.tab-link:not(.dropdown-tab-item) {
|
|
45
|
+
height: 36px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.tab-link:not(.dropdown-tab-item) {
|
|
49
|
+
color: $neutral-600;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.tab-link {
|
|
53
|
+
color: inherit;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.tab-link {
|
|
57
|
+
text-decoration: none;
|
|
58
|
+
position: relative;
|
|
59
|
+
transition: color .3s;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
position: relative;
|
|
63
|
+
|
|
64
|
+
.ib-icon {
|
|
65
|
+
color: $neutral-900;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&::after {
|
|
69
|
+
content: '';
|
|
70
|
+
width: 100%;
|
|
71
|
+
height: 3px;
|
|
72
|
+
bottom: 0;
|
|
73
|
+
z-index: 2;
|
|
74
|
+
left: 50%;
|
|
75
|
+
transform: translateX(-50%);
|
|
76
|
+
position: absolute;
|
|
77
|
+
background-color: transparent;
|
|
78
|
+
border-radius: 2px 2px 0px 0px;
|
|
79
|
+
transition: background-color .3s;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&:hover{
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
color: $blue-700;
|
|
85
|
+
transition: all .3s;
|
|
86
|
+
|
|
87
|
+
.ib-icon {
|
|
88
|
+
color: $blue-700;
|
|
89
|
+
transition: color .3s;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&:active {
|
|
94
|
+
color: $blue-900;
|
|
95
|
+
transition: color .3s;
|
|
96
|
+
|
|
97
|
+
.ib-icon {
|
|
98
|
+
color: $blue-900;
|
|
99
|
+
transition: color .3s;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&.active{
|
|
104
|
+
color: $neutral-900;
|
|
105
|
+
|
|
106
|
+
&::after {
|
|
107
|
+
background-color: $blue-700;
|
|
108
|
+
transition: color .3s;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ib-icon {
|
|
112
|
+
transition: color .3s;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&.disabled {
|
|
117
|
+
color: $neutral-500;
|
|
118
|
+
pointer-events: none;
|
|
119
|
+
opacity: 0.5;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&:focus {
|
|
123
|
+
@include focus(2px, $blue-700);
|
|
124
|
+
border-radius: 4px;
|
|
125
|
+
|
|
126
|
+
.tab-link .ib-icon {
|
|
127
|
+
.ib-icon {
|
|
128
|
+
color: $blue-700;
|
|
129
|
+
transition: color .3s;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.wrapper-tab-link.dropdown-tab {
|
|
136
|
+
|
|
137
|
+
.dropdown-trigger {
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
|
|
141
|
+
&.active {
|
|
142
|
+
.tab-link .ib-icon {
|
|
143
|
+
transform: rotate(-180deg);
|
|
144
|
+
transition: all .3s;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.tab-link .ib-icon {
|
|
149
|
+
margin-top: 3px;
|
|
150
|
+
margin-left: 6px;
|
|
151
|
+
transition: all .3s;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import ibTagPill from "./TagPill.vue";
|
|
2
|
+
import { tagPillSTatuses } from "./constants";
|
|
3
|
+
import readme from "./readme.mdx";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Tag Pill",
|
|
7
|
+
component: ibTagPill,
|
|
8
|
+
argTypes: {
|
|
9
|
+
status: {
|
|
10
|
+
control: { type: "select" },
|
|
11
|
+
options: Object.values(tagPillSTatuses),
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
page: readme,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const Template = (args) => ({
|
|
22
|
+
components: { ibTagPill },
|
|
23
|
+
setup() {
|
|
24
|
+
return { args };
|
|
25
|
+
},
|
|
26
|
+
template: '<ib-tag-pill v-bind="args">Signs with</ib-tag-pill>',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const Default = Template.bind({});
|
|
30
|
+
Default.args = {};
|