@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,133 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classes">
|
|
3
|
+
<ib-icon v-if="showIcon && iconName.length" :name="iconName" />
|
|
4
|
+
<span>
|
|
5
|
+
<slot></slot>
|
|
6
|
+
</span>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import { tagPillSTatuses } from "./constants";
|
|
12
|
+
import IbIcon from "../Icon.vue";
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
props: {
|
|
16
|
+
status: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: tagPillSTatuses.neutral,
|
|
19
|
+
validator: (value) => Object.keys(tagPillSTatuses).includes(value),
|
|
20
|
+
},
|
|
21
|
+
showIcon: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
computed: {
|
|
27
|
+
classes() {
|
|
28
|
+
const classList = ["ib-tag-pill"];
|
|
29
|
+
classList.push(`ib-tag-pill-${this.status}`);
|
|
30
|
+
|
|
31
|
+
return classList;
|
|
32
|
+
},
|
|
33
|
+
iconName() {
|
|
34
|
+
switch (this.status) {
|
|
35
|
+
case tagPillSTatuses.success:
|
|
36
|
+
return "checkmark-outline";
|
|
37
|
+
case tagPillSTatuses.neutral:
|
|
38
|
+
return "time-outline";
|
|
39
|
+
case tagPillSTatuses.info:
|
|
40
|
+
return "information-circle-outline";
|
|
41
|
+
case tagPillSTatuses.error:
|
|
42
|
+
return "close-outline";
|
|
43
|
+
default:
|
|
44
|
+
return "";
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
components: { IbIcon },
|
|
49
|
+
};
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<style lang="scss" scoped>
|
|
53
|
+
@import "../../assets/scss/typography.scss";
|
|
54
|
+
@import "../../assets/scss/variables/colors.scss";
|
|
55
|
+
|
|
56
|
+
$neutral-tag-bg: $gray-100;
|
|
57
|
+
$neutral-tag-color: $neutral-600;
|
|
58
|
+
|
|
59
|
+
$success-tag-bg: $green-100;
|
|
60
|
+
$success-tag-color: $green-800;
|
|
61
|
+
|
|
62
|
+
$info-tag-bg: $blue-200;
|
|
63
|
+
$info-tag-color: $blue-800;
|
|
64
|
+
|
|
65
|
+
$error-tag-bg: $red-100;
|
|
66
|
+
$error-tag-color: $red-800;
|
|
67
|
+
|
|
68
|
+
$new-tag-bg: $navy-600;
|
|
69
|
+
$new-tag-color: $white;
|
|
70
|
+
|
|
71
|
+
$pending-tag-bg: $indigo-400;
|
|
72
|
+
$pending-tag-color: $white;
|
|
73
|
+
|
|
74
|
+
$favorite-tag-bg: $gray-600;
|
|
75
|
+
$favorite-tag-color: $white;
|
|
76
|
+
|
|
77
|
+
.ib-tag-pill {
|
|
78
|
+
@include Ib-H5-regular;
|
|
79
|
+
display: flex;
|
|
80
|
+
align-content: center;
|
|
81
|
+
padding: 0 4px;
|
|
82
|
+
width: fit-content;
|
|
83
|
+
border-radius: 4px;
|
|
84
|
+
|
|
85
|
+
span {
|
|
86
|
+
max-width: 215px;
|
|
87
|
+
display: -webkit-box;
|
|
88
|
+
-webkit-box-orient: vertical;
|
|
89
|
+
-webkit-line-clamp: 1;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
}
|
|
92
|
+
.ib-icon {
|
|
93
|
+
align-self: center;
|
|
94
|
+
font-size: 12px;
|
|
95
|
+
margin-right: 2px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&-neutral {
|
|
99
|
+
background-color: $neutral-tag-bg;
|
|
100
|
+
color: $neutral-tag-color;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&-success {
|
|
104
|
+
background-color: $success-tag-bg;
|
|
105
|
+
color: $success-tag-color;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&-info {
|
|
109
|
+
background-color: $info-tag-bg;
|
|
110
|
+
color: $info-tag-color;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&-error {
|
|
114
|
+
background-color: $error-tag-bg;
|
|
115
|
+
color: $error-tag-color;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&-new {
|
|
119
|
+
background-color: $new-tag-bg;
|
|
120
|
+
color: $new-tag-color;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&-pending {
|
|
124
|
+
background-color: $pending-tag-bg;
|
|
125
|
+
color: $pending-tag-color;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&-favorite {
|
|
129
|
+
background-color: $favorite-tag-bg;
|
|
130
|
+
color: $favorite-tag-color;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# IbTagPill
|
|
2
|
+
|
|
3
|
+
import { Story, Canvas } from "@storybook/addon-docs";
|
|
4
|
+
|
|
5
|
+
A status Pill is a visual indicator used to highlight an item's status for quick recognition.
|
|
6
|
+
|
|
7
|
+
**Best practice**
|
|
8
|
+
Use the icon together with the label in Lozenge to help user quicker understand item status.
|
|
9
|
+
|
|
10
|
+
### Default
|
|
11
|
+
|
|
12
|
+
<Canvas>
|
|
13
|
+
<Story id="tag-pill--default" />
|
|
14
|
+
</Canvas>
|
|
15
|
+
|
|
16
|
+
### Temporary status Pills
|
|
17
|
+
|
|
18
|
+
Status Pills with labels “New” and “Pending” considered as a temporary statuses.
|
|
19
|
+
Pending - status for the analytic datasets that require approving. Once it approved or declined status pill can be removed or changed to “Approved”, “Declined”, or “New” status pills.
|
|
20
|
+
New - status for the analytic datasets that were added to the Library page. It is removed once the user opened data details, or when 30 days pass if the user never opens it.
|
|
21
|
+
|
|
22
|
+
### Props
|
|
23
|
+
|
|
24
|
+
| Prop name | Type | Default | Description |
|
|
25
|
+
| --------- | ------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| status | String | "neutral" | The status prop determines the color of the tag pill. It accepts one of the values: `neutral`, `success`, `info`, `error`, `new`, `favorite` or `pending` |
|
|
27
|
+
| showIcon | Boolean | false | When set to true, an icon is displayed to the left of the text label. |
|
|
28
|
+
|
|
29
|
+
### Events
|
|
30
|
+
|
|
31
|
+
This component not suports events.
|
|
32
|
+
|
|
33
|
+
### Slots
|
|
34
|
+
|
|
35
|
+
| Slot name | Description |
|
|
36
|
+
| --------- | ------------------------------------------------------------------------------------------- |
|
|
37
|
+
| default | The default slot is used to pass the label text that will be displayed inside the tag pill. |
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import IbToggleTip from "./ToggleTip.vue";
|
|
2
|
+
import IbButton from "../Button/Button.vue";
|
|
3
|
+
import IbIconButton from "../IconButton/IconButton.vue";
|
|
4
|
+
import IbIcon from "../Icon.vue";
|
|
5
|
+
import { toggleTipPosition } from "./constants";
|
|
6
|
+
import { ref } from "vue";
|
|
7
|
+
import readme from "./readme.mdx"
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "ToggleTip",
|
|
11
|
+
components: IbToggleTip,
|
|
12
|
+
argTypes: {
|
|
13
|
+
position: {
|
|
14
|
+
control: { type: "select" },
|
|
15
|
+
options: Object.values(toggleTipPosition),
|
|
16
|
+
},
|
|
17
|
+
isActive: { type: "boolean" },
|
|
18
|
+
onClose: { action: "close" },
|
|
19
|
+
onOpen: { action: "open" },
|
|
20
|
+
},
|
|
21
|
+
parameters: {
|
|
22
|
+
docs: {
|
|
23
|
+
page: readme,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const Template = (args) => ({
|
|
29
|
+
components: { IbToggleTip, IbIcon, IbIconButton },
|
|
30
|
+
setup() {
|
|
31
|
+
return { args };
|
|
32
|
+
},
|
|
33
|
+
template: `
|
|
34
|
+
<div>
|
|
35
|
+
<ib-icon-button kind="ghost">
|
|
36
|
+
<ib-icon name="information-circle-outline" />
|
|
37
|
+
</ib-icon-button>
|
|
38
|
+
|
|
39
|
+
<ib-toggle-tip v-bind="args">
|
|
40
|
+
<p>Toggle tip should be used in place of tooltip if your content will contain interactive elements.</p>
|
|
41
|
+
</ib-toggle-tip>
|
|
42
|
+
</div>
|
|
43
|
+
`,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const TemplateWithButtons = (args) => ({
|
|
47
|
+
components: { IbToggleTip, IbButton, IbIcon, IbIconButton },
|
|
48
|
+
setup() {
|
|
49
|
+
const visible = ref(true);
|
|
50
|
+
const onClick = () => (visible.value = true);
|
|
51
|
+
const onClose = () => (visible.value = false);
|
|
52
|
+
|
|
53
|
+
return { args, onClick, onClose, visible };
|
|
54
|
+
},
|
|
55
|
+
template: `
|
|
56
|
+
<div>
|
|
57
|
+
<ib-icon-button @click="onClick" kind="ghost">
|
|
58
|
+
<ib-icon name="information-circle-outline" />
|
|
59
|
+
</ib-icon-button>
|
|
60
|
+
|
|
61
|
+
<ib-toggle-tip v-bind="args" @close="onClose" :is-open="visible">
|
|
62
|
+
<p>Toggle tip should be used in place of tooltip if your content will contain interactive elements.</p>
|
|
63
|
+
|
|
64
|
+
<template #buttons class="button-set">
|
|
65
|
+
<ib-button kind="ghost">
|
|
66
|
+
test
|
|
67
|
+
</ib-button>
|
|
68
|
+
<ib-button kind="tertiary">
|
|
69
|
+
test
|
|
70
|
+
</ib-button>
|
|
71
|
+
</template>
|
|
72
|
+
</ib-toggle-tip>
|
|
73
|
+
</div>
|
|
74
|
+
`,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export const Default = Template.bind({});
|
|
78
|
+
Default.args = {
|
|
79
|
+
title: "Title",
|
|
80
|
+
isActive: true,
|
|
81
|
+
};
|
|
82
|
+
Default.decorators = [
|
|
83
|
+
() => ({
|
|
84
|
+
template:
|
|
85
|
+
'<div style="display: flex; align-items:center; justify-content: center; width: 400px; height: 400px; margin: 0 auto"><story /></div>',
|
|
86
|
+
}),
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
export const HasButtons = TemplateWithButtons.bind({});
|
|
90
|
+
HasButtons.args = {
|
|
91
|
+
title: "Title",
|
|
92
|
+
};
|
|
93
|
+
HasButtons.decorators = [
|
|
94
|
+
() => ({
|
|
95
|
+
template:
|
|
96
|
+
'<div style="display: flex; align-items:center; justify-content: center; width: 400px; height: 400px; margin: 0 auto"><story /></div>',
|
|
97
|
+
}),
|
|
98
|
+
];
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Transition>
|
|
3
|
+
<div :class="classes" v-show="isOpenedState">
|
|
4
|
+
<div class="ib-toggle-tip-head">
|
|
5
|
+
<p>
|
|
6
|
+
{{ title }}
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<ib-icon-button
|
|
10
|
+
class="close-button"
|
|
11
|
+
kind="ghost"
|
|
12
|
+
@click.prevent="close"
|
|
13
|
+
>
|
|
14
|
+
<ib-icon name="close-outline" />
|
|
15
|
+
</ib-icon-button>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="ib-toggle-tip-content">
|
|
19
|
+
<slot></slot>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div class="ib-toggle-tip-button-set">
|
|
23
|
+
<slot name="buttons"></slot>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</Transition>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
import { toggleTipPosition } from "./constants";
|
|
31
|
+
import IbIconButton from "../IconButton/IconButton.vue";
|
|
32
|
+
import IbIcon from "../Icon.vue";
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
name: "IbTooltip",
|
|
36
|
+
props: {
|
|
37
|
+
position: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: toggleTipPosition.topCenter,
|
|
40
|
+
},
|
|
41
|
+
title: {
|
|
42
|
+
type: String,
|
|
43
|
+
},
|
|
44
|
+
isOpen: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
mounted() {
|
|
50
|
+
this.$nextTick(() => {
|
|
51
|
+
this.parentNode = this.$el.parentNode;
|
|
52
|
+
|
|
53
|
+
if (getComputedStyle(this.parentNode).position !== "absolute") {
|
|
54
|
+
this.parentNode.style.position = "relative";
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
isOpenedState: this.isOpen,
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
methods: {
|
|
64
|
+
open() {
|
|
65
|
+
this.isOpenedState = true;
|
|
66
|
+
this.$emit("open");
|
|
67
|
+
},
|
|
68
|
+
close() {
|
|
69
|
+
this.isOpenedState = false;
|
|
70
|
+
this.$emit("close");
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
computed: {
|
|
74
|
+
classes() {
|
|
75
|
+
const classList = ["ib-toggle-tip"];
|
|
76
|
+
classList.push(`ib-${this.position}`);
|
|
77
|
+
|
|
78
|
+
return classList;
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
watch: {
|
|
82
|
+
isOpen(value) {
|
|
83
|
+
if (value) {
|
|
84
|
+
this.open();
|
|
85
|
+
} else {
|
|
86
|
+
this.close();
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
components: {
|
|
91
|
+
IbIconButton,
|
|
92
|
+
IbIcon,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
<style lang="scss">
|
|
98
|
+
@import "./toggleTip.scss";
|
|
99
|
+
</style>
|
|
100
|
+
|
|
101
|
+
<style lang="scss" scoped>
|
|
102
|
+
// Transition
|
|
103
|
+
.v-enter-active,
|
|
104
|
+
.v-leave-active {
|
|
105
|
+
transition: opacity 0.3s ease;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.v-enter-from,
|
|
109
|
+
.v-leave-to {
|
|
110
|
+
opacity: 0;
|
|
111
|
+
}
|
|
112
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const toggleTipPosition = {
|
|
2
|
+
topLeft: "top-Left",
|
|
3
|
+
topCenter: "top-center",
|
|
4
|
+
topRight: "top-right",
|
|
5
|
+
rightTop: "right-top",
|
|
6
|
+
rightCenter: "right-center",
|
|
7
|
+
rightBottom: "right-bottom",
|
|
8
|
+
bottomLeft: "bottom-left",
|
|
9
|
+
bottomCenter: "bottom-center",
|
|
10
|
+
bottomRight: "bottom-right",
|
|
11
|
+
leftTop: "left-top",
|
|
12
|
+
leftCenter: "left-center",
|
|
13
|
+
leftBottom: "left-bottom",
|
|
14
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# IbToggleTip
|
|
2
|
+
|
|
3
|
+
import { Story, Canvas } from "@storybook/addon-docs";
|
|
4
|
+
|
|
5
|
+
Toggletips use the disclosure pattern to toggle the visibility of a popover. They display additional, hidden information upon the click of a UI trigger element and can contain interactive elements.
|
|
6
|
+
Toggletip should be used in place of tooltip if your content will contain interactive elements. If it does not have any interactive content, consider using [Tooltip](?path=/story/tooltip--default) or [Popover](?path=/story/popover--default) instead.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Toggletips reveal supplemental content when a user clicks a button or another UI element and remains actively open until a user dismisses it. Toggletips can include a wide variety of information and interactive elements as long as accessibility requirements are maintained including focus order and ensuring all functionality is operable through a keyboard interface.
|
|
11
|
+
|
|
12
|
+
### When to use
|
|
13
|
+
|
|
14
|
+
Use when an interactive element must be placed within the container
|
|
15
|
+
Use for quick, in context editing
|
|
16
|
+
Use for non-essntial transitional function related to triggered conponent
|
|
17
|
+
|
|
18
|
+
### When to not use
|
|
19
|
+
|
|
20
|
+
Don’t use to present critical information or request required input needed to complete a workflow. Use the [modal component](?path=/story/modal--default) instead.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### States
|
|
25
|
+
|
|
26
|
+
The toggletip component has two states—active and inactive. By default, the toggletip is hidden and inactive.
|
|
27
|
+
|
|
28
|
+
### Props
|
|
29
|
+
|
|
30
|
+
| Name | type | Default Value | Description |
|
|
31
|
+
| -------- | ------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| isOpen | Boolean | false | Controls the visibility of the ToggleTip. |
|
|
33
|
+
| title | String | false | Use this slot to insert a title. |
|
|
34
|
+
| position | String | '`top-center`' | The position of tooltip. Possible values are: '`top-left`', '`top-center`', '`top-right`', '`right-top`', '`right-center`', '`right-bottom`', '`bottom-left`', '`bottom-center`', '`bottom-right`', '`left-top`', '`left-center`', '`left-bottom`'. |
|
|
35
|
+
|
|
36
|
+
### Events
|
|
37
|
+
|
|
38
|
+
| Event name | Parameters | Description |
|
|
39
|
+
| ---------- | ---------- | ------------------------------------- |
|
|
40
|
+
| open | | Emitted when the Toggletip is opened. |
|
|
41
|
+
| close | | Emitted when the Toggletip is closed. |
|
|
42
|
+
|
|
43
|
+
### Default
|
|
44
|
+
<Canvas>
|
|
45
|
+
<Story id="toggletip--has-buttons" />
|
|
46
|
+
</Canvas>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@import "../../assets/scss/typography.scss";
|
|
2
|
+
@import "../../assets/scss/mixins/tooltip-position.scss";
|
|
3
|
+
@import "../../assets/scss/variables/colors.scss";
|
|
4
|
+
@import "../../assets/scss/variables/shadows.scss";
|
|
5
|
+
|
|
6
|
+
$background: $white;
|
|
7
|
+
$textColor: $neutral-900;
|
|
8
|
+
$shadow: $ib-shadow-4;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
.ib-toggle-tip {
|
|
12
|
+
position: absolute;
|
|
13
|
+
padding: 10px;
|
|
14
|
+
width: 240px;
|
|
15
|
+
background-color: $background;
|
|
16
|
+
color: $textColor;
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
box-shadow: $shadow;
|
|
19
|
+
top: auto;
|
|
20
|
+
bottom: auto;
|
|
21
|
+
left: auto;
|
|
22
|
+
right: auto;
|
|
23
|
+
@include TooltipPosition;
|
|
24
|
+
|
|
25
|
+
&-head {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
margin-bottom: 5px;
|
|
30
|
+
|
|
31
|
+
p {
|
|
32
|
+
@include Ib-H4-medium;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.close-button {
|
|
36
|
+
.ib-icon {
|
|
37
|
+
font-size: 20px
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&-content {
|
|
43
|
+
@include Ib-H4-regular;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&-button-set {
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: flex-end;
|
|
49
|
+
margin-top: 5px;
|
|
50
|
+
|
|
51
|
+
.ib-button:not(:first-child) {
|
|
52
|
+
margin-left: 10px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import IbTooltip from "./Tooltip.vue";
|
|
2
|
+
import IbButton from "../Button/Button.vue";
|
|
3
|
+
import { popoverPosition } from "../Popover/constants";
|
|
4
|
+
import readme from "./readme.mdx";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Tooltip",
|
|
8
|
+
component: IbTooltip,
|
|
9
|
+
argTypes: {
|
|
10
|
+
position: {
|
|
11
|
+
control: { type: "select" },
|
|
12
|
+
options: Object.values(popoverPosition),
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
parameters: {
|
|
16
|
+
docs: {
|
|
17
|
+
page: readme,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const Template = (args) => ({
|
|
23
|
+
components: { IbTooltip, IbButton },
|
|
24
|
+
setup() {
|
|
25
|
+
return { args };
|
|
26
|
+
},
|
|
27
|
+
template: `
|
|
28
|
+
<ib-button>
|
|
29
|
+
Test
|
|
30
|
+
<ib-tooltip v-bind="args"></ib-tooltip>
|
|
31
|
+
</ib-button>
|
|
32
|
+
`,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const Default = Template.bind({});
|
|
36
|
+
Default.args = {
|
|
37
|
+
text: "Default text",
|
|
38
|
+
};
|
|
39
|
+
Default.decorators = [
|
|
40
|
+
() => ({
|
|
41
|
+
template:
|
|
42
|
+
'<div style="display: flex; align-items:center; justify-content: center; width: 400px; height: 400px; margin: 0 auto"><story /></div>',
|
|
43
|
+
}),
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
export const Large = Template.bind({});
|
|
47
|
+
Large.args = {
|
|
48
|
+
title: "Title",
|
|
49
|
+
text: "Data type must be one of the following: text, number, int",
|
|
50
|
+
};
|
|
51
|
+
Large.decorators = [
|
|
52
|
+
() => ({
|
|
53
|
+
template:
|
|
54
|
+
'<div style="display: flex; align-items:center; justify-content: center; width: 400px; height: 400px; margin: 0 auto"><story /></div>',
|
|
55
|
+
}),
|
|
56
|
+
];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ib-popover :position="position" class="ib-tooltip">
|
|
3
|
+
<b v-if="title">{{ title }}</b>
|
|
4
|
+
<p>{{ text }}</p>
|
|
5
|
+
</ib-popover>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import IbPopover from "../Popover/Popover.vue";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
name: "IbTooltip",
|
|
13
|
+
props: {
|
|
14
|
+
position: {
|
|
15
|
+
type: String,
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
type: String,
|
|
19
|
+
},
|
|
20
|
+
text: {
|
|
21
|
+
type: String,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
components: { IbPopover },
|
|
25
|
+
};
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<style lang="scss" scoped>
|
|
29
|
+
@import "../../assets/scss/typography.scss";
|
|
30
|
+
@import "../../assets/scss/mixins.scss";
|
|
31
|
+
|
|
32
|
+
.ib-tooltip {
|
|
33
|
+
padding: 10px;
|
|
34
|
+
max-width: 240px;
|
|
35
|
+
|
|
36
|
+
b,
|
|
37
|
+
p {
|
|
38
|
+
@include lineClamp;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
b {
|
|
42
|
+
@include Ib-H4-medium;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
p {
|
|
46
|
+
@include Ib-H4-regular;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# IbTooltip
|
|
2
|
+
|
|
3
|
+
import { Story, Canvas } from "@storybook/addon-docs";
|
|
4
|
+
|
|
5
|
+
Tooltips display additional information upon hover or focus. The information included should be contextual, helpful, and nonessential while providing that extra ability to communicate and give clarity to a user.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
A tooltip is a message box that is displayed when a user hovers over or gives focus to a UI element. The tooltip should be paired with an interactive UI element like a button. Tooltips should be used sparingly and contain succinct, supplementary information. Although tooltips used to allow for interactive elements such as buttons and links, do not include these elements in tooltips and use toggletip instead.
|
|
10
|
+
|
|
11
|
+
### When to use
|
|
12
|
+
|
|
13
|
+
- Describe icon buttons
|
|
14
|
+
- When more information is useful in helping a user make decisions
|
|
15
|
+
- When an element needs more context or explanation
|
|
16
|
+
- Use when defining a term or inline item
|
|
17
|
+
|
|
18
|
+
### When not to use
|
|
19
|
+
|
|
20
|
+
- Since a tooltip disappears when a user hovers away, do not include information that is pertinent for the user to complete their task. Use helper text that is always visible and accessible for vital information such as required fields.
|
|
21
|
+
- Do not include interactive elements within a tooltip. Interactive elements in tooltips are inaccessible for some users and are hard to use for all users since tooltips do not receive focus. If images, buttons, or links need to be included in supplemental information, use the toggletip component
|
|
22
|
+
|
|
23
|
+
### Usage
|
|
24
|
+
For correct use component `<ib-polltip>`, need to insert inside the element that should show this `<ib-polltip>` when hovering and focusing.
|
|
25
|
+
<Canvas>
|
|
26
|
+
<Story id="tooltip--default" />
|
|
27
|
+
</Canvas>
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Props
|
|
31
|
+
| Name | type | Default Value | required | Description |
|
|
32
|
+
| ----- | ------ | -------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
33
|
+
| title | String | | No | The title of the tooltip. |
|
|
34
|
+
| text | String | | No | The text to be displayed in the tooltip. |
|
|
35
|
+
| position | String | '`top-center`' | No | The position of tooltip. Possible values are: '`top-left`', '`top-center`', '`top-right`', '`right-top`', '`right-center`', '`right-bottom`', '`bottom-left`', '`bottom-center`', '`bottom-right`', '`left-top`', '`left-center`', '`left-bottom`'. |
|
|
36
|
+
|
|
37
|
+
### Events
|
|
38
|
+
This component not suports events.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Slots
|
|
42
|
+
This component not suports events.
|
|
43
|
+
|