@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.
Files changed (194) hide show
  1. package/.babelrc.json +14 -0
  2. package/.eslintrc.cjs +15 -0
  3. package/.nvmrc +1 -0
  4. package/.prettierrc.json +1 -0
  5. package/.storybook/intelliboardTheme.js +10 -0
  6. package/.storybook/main.js +25 -0
  7. package/.storybook/manager.js +7 -0
  8. package/.storybook/preview-head.html +11 -0
  9. package/.storybook/preview.js +24 -0
  10. package/.storybook/scss-loader.scss +6 -0
  11. package/.storybook/withSource.js +97 -0
  12. package/README.md +35 -0
  13. package/dist/favicon.ico +0 -0
  14. package/dist/index.mjs +19366 -0
  15. package/dist/index.umd.js +209 -0
  16. package/dist/style.css +1 -0
  17. package/index.html +21 -0
  18. package/package.json +63 -0
  19. package/public/favicon.ico +0 -0
  20. package/src/App.vue +37 -0
  21. package/src/EventEmmiter.js +19 -0
  22. package/src/assets/scss/mixins/dropdown-list-item.scss +45 -0
  23. package/src/assets/scss/mixins/tooltip-position.scss +147 -0
  24. package/src/assets/scss/mixins.scss +21 -0
  25. package/src/assets/scss/reset.scss +12 -0
  26. package/src/assets/scss/style.scss +73 -0
  27. package/src/assets/scss/typography.scss +155 -0
  28. package/src/assets/scss/variables/colors.scss +115 -0
  29. package/src/assets/scss/variables/shadows.scss +17 -0
  30. package/src/components/Accordion/Accordion.scss +94 -0
  31. package/src/components/Accordion/Accordion.stories.js +41 -0
  32. package/src/components/Accordion/Accordion.vue +104 -0
  33. package/src/components/Accordion/readme.mdx +38 -0
  34. package/src/components/Alert/Alert.stories.js +69 -0
  35. package/src/components/Alert/Alert.vue +131 -0
  36. package/src/components/Alert/alert.scss +166 -0
  37. package/src/components/Alert/constants.js +6 -0
  38. package/src/components/Alert/readme.mdx +63 -0
  39. package/src/components/Badge/Badge.stories.js +53 -0
  40. package/src/components/Badge/Badge.vue +58 -0
  41. package/src/components/Badge/readme.mdx +38 -0
  42. package/src/components/Breadcrumbs/Breadcrumbs.vue +98 -0
  43. package/src/components/Breadcrumbs/breadcrumbs.scss +77 -0
  44. package/src/components/Breadcrumbs/breadcrumbs.stories.js +37 -0
  45. package/src/components/Button/Button.stories.js +124 -0
  46. package/src/components/Button/Button.vue +165 -0
  47. package/src/components/Button/button.scss +217 -0
  48. package/src/components/Button/constants.js +8 -0
  49. package/src/components/Button/readme.mdx +118 -0
  50. package/src/components/ButtonGroup/ButtonGroup.stories.js +27 -0
  51. package/src/components/ButtonGroup/ButtonGroup.vue +24 -0
  52. package/src/components/ButtonGroup/readme.mdx +10 -0
  53. package/src/components/Dropdown/Dropdown.spec.js +90 -0
  54. package/src/components/Dropdown/Dropdown.stories.js +48 -0
  55. package/src/components/Dropdown/Dropdown.vue +313 -0
  56. package/src/components/Dropdown/DropdownDivider.vue +15 -0
  57. package/src/components/Dropdown/DropdownItem.vue +59 -0
  58. package/src/components/Dropdown/DropdownList.stories.js +174 -0
  59. package/src/components/Dropdown/DropdownList.vue +93 -0
  60. package/src/components/Dropdown/constants.js +10 -0
  61. package/src/components/Dropdown/readme.mdx +88 -0
  62. package/src/components/Form/CharactersCount.vue +55 -0
  63. package/src/components/Form/Checkbox/Checkbox.scss +226 -0
  64. package/src/components/Form/Checkbox/Checkbox.stories.js +63 -0
  65. package/src/components/Form/Checkbox/Checkbox.vue +128 -0
  66. package/src/components/Form/Checkbox/readme.mdx +69 -0
  67. package/src/components/Form/CheckboxGroup/CheckboxGroup.stories.js +64 -0
  68. package/src/components/Form/CheckboxGroup/CheckboxGroup.vue +87 -0
  69. package/src/components/Form/CheckboxGroup/readme.mdx +56 -0
  70. package/src/components/Form/DatePicker/DatePicker.scss +479 -0
  71. package/src/components/Form/DatePicker/DatePicker.stories.js +78 -0
  72. package/src/components/Form/DatePicker/DatePicker.vue +284 -0
  73. package/src/components/Form/DatePicker/Icons/chevron-back.js +5 -0
  74. package/src/components/Form/DatePicker/Icons/chevron-forward.js +5 -0
  75. package/src/components/Form/DatePicker/readme.mdx +115 -0
  76. package/src/components/Form/FormGroup/FormGroup.stories.js +48 -0
  77. package/src/components/Form/FormGroup/FormGroup.vue +61 -0
  78. package/src/components/Form/FormGroup/FormGroupSet.stories.js +32 -0
  79. package/src/components/Form/FormGroup/FormGroupSet.vue +75 -0
  80. package/src/components/Form/Input/Input.stories.js +137 -0
  81. package/src/components/Form/Input/Input.vue +231 -0
  82. package/src/components/Form/Input/constants.js +5 -0
  83. package/src/components/Form/Input/input.scss +133 -0
  84. package/src/components/Form/Input/readme.mdx +68 -0
  85. package/src/components/Form/Label/Label.stories.js +29 -0
  86. package/src/components/Form/Label/Label.vue +87 -0
  87. package/src/components/Form/Label/readme.mdx +25 -0
  88. package/src/components/Form/PhoneInput/PhoneInput.stories.js +43 -0
  89. package/src/components/Form/PhoneInput/PhoneInput.vue +105 -0
  90. package/src/components/Form/PhoneInput/phoneInput.scss +197 -0
  91. package/src/components/Form/PhoneInput/readme.mdx +37 -0
  92. package/src/components/Form/Radio/Radio.stories.js +34 -0
  93. package/src/components/Form/Radio/Radio.vue +109 -0
  94. package/src/components/Form/Radio/radio.scss +187 -0
  95. package/src/components/Form/Radio/readme.mdx +48 -0
  96. package/src/components/Form/TextEditor/TextEditor.stories.js +58 -0
  97. package/src/components/Form/TextEditor/TextEditor.vue +305 -0
  98. package/src/components/Form/TextEditor/icons/svg/chevron-down.svg +3 -0
  99. package/src/components/Form/TextEditor/icons/toolbarIcons.js +111 -0
  100. package/src/components/Form/TextEditor/plugins/alphabetList.js +43 -0
  101. package/src/components/Form/TextEditor/readme.mdx +59 -0
  102. package/src/components/Form/TextEditor/textEditor.scss +684 -0
  103. package/src/components/Form/Textarea/Textarea.spec.js +107 -0
  104. package/src/components/Form/Textarea/Textarea.stories.js +68 -0
  105. package/src/components/Form/Textarea/Textarea.vue +102 -0
  106. package/src/components/Form/Textarea/readme.mdx +45 -0
  107. package/src/components/Form/Textarea/textarea.scss +84 -0
  108. package/src/components/Form/Toggle/Toggle.stories.js +44 -0
  109. package/src/components/Form/Toggle/Toggle.vue +122 -0
  110. package/src/components/Form/Toggle/readme.mdx +39 -0
  111. package/src/components/Form/Toggle/toggle.scss +166 -0
  112. package/src/components/Icon.vue +41 -0
  113. package/src/components/IconButton/IconButton.scss +91 -0
  114. package/src/components/IconButton/IconButton.stories.js +115 -0
  115. package/src/components/IconButton/IconButton.vue +100 -0
  116. package/src/components/IconButton/constants.js +14 -0
  117. package/src/components/IconButton/readme.mdx +66 -0
  118. package/src/components/List.vue +150 -0
  119. package/src/components/Modal/Modal.stories.js +48 -0
  120. package/src/components/Modal/Modal.vue +231 -0
  121. package/src/components/Modal/readme.mdx +76 -0
  122. package/src/components/Pagination/LimitSelector.vue +73 -0
  123. package/src/components/Pagination/Pagination.stories.js +54 -0
  124. package/src/components/Pagination/Pagination.vue +227 -0
  125. package/src/components/Pagination/pagination.scss +189 -0
  126. package/src/components/Popover/Popover.stories.js +46 -0
  127. package/src/components/Popover/Popover.vue +81 -0
  128. package/src/components/Popover/constants.js +14 -0
  129. package/src/components/Popover/popover.scss +26 -0
  130. package/src/components/Popover/readme.mdx +42 -0
  131. package/src/components/ProgressBar/ProgressBar.stories.js +90 -0
  132. package/src/components/ProgressBar/ProgressBar.vue +58 -0
  133. package/src/components/ProgressBar/constants.js +6 -0
  134. package/src/components/ProgressBar/progressBar.scss +116 -0
  135. package/src/components/ProgressBar/readme.mdx +67 -0
  136. package/src/components/Sorting/Sorting.stories.js +35 -0
  137. package/src/components/Sorting/Sorting.vue +128 -0
  138. package/src/components/Sorting/constants.js +10 -0
  139. package/src/components/Sorting/sorting.scss +87 -0
  140. package/src/components/SplitButton/SplitButton.stories.js +39 -0
  141. package/src/components/SplitButton/SplitButton.vue +132 -0
  142. package/src/components/SplitButton/SplitButtonItem.vue +34 -0
  143. package/src/components/SplitButton/constants.js +4 -0
  144. package/src/components/SplitButton/readme.mdx +77 -0
  145. package/src/components/SplitButton/splitButton.scss +161 -0
  146. package/src/components/StatusIndicator/StatusIndicator.stories.js +40 -0
  147. package/src/components/StatusIndicator/StatusIndicator.vue +52 -0
  148. package/src/components/StatusIndicator/constants.js +10 -0
  149. package/src/components/StatusIndicator/icons.js +48 -0
  150. package/src/components/StatusIndicator/readme.mdx +21 -0
  151. package/src/components/Table/Cells/Cell.vue +71 -0
  152. package/src/components/Table/Cells/CheckboxCell.vue +48 -0
  153. package/src/components/Table/Row.vue +26 -0
  154. package/src/components/Table/Table.stories.js +59 -0
  155. package/src/components/Table/Table.vue +36 -0
  156. package/src/components/Tabs/Tab.vue +37 -0
  157. package/src/components/Tabs/TabDropdown.vue +93 -0
  158. package/src/components/Tabs/Tabs.stories.js +57 -0
  159. package/src/components/Tabs/Tabs.vue +94 -0
  160. package/src/components/Tabs/tabs.scss +157 -0
  161. package/src/components/TagPill/TagPill.stories.js +30 -0
  162. package/src/components/TagPill/TagPill.vue +133 -0
  163. package/src/components/TagPill/constants.js +9 -0
  164. package/src/components/TagPill/readme.mdx +37 -0
  165. package/src/components/ToggleTip/ToggleTip.stories.js +98 -0
  166. package/src/components/ToggleTip/ToggleTip.vue +112 -0
  167. package/src/components/ToggleTip/constants.js +14 -0
  168. package/src/components/ToggleTip/readme.mdx +46 -0
  169. package/src/components/ToggleTip/toggleTip.scss +55 -0
  170. package/src/components/Tooltip/Tooltip.stories.js +56 -0
  171. package/src/components/Tooltip/Tooltip.vue +49 -0
  172. package/src/components/Tooltip/readme.mdx +43 -0
  173. package/src/components/TreeSelect/Option.vue +325 -0
  174. package/src/components/TreeSelect/Select.stories.js +349 -0
  175. package/src/components/TreeSelect/Select.vue +909 -0
  176. package/src/components/TreeSelect/TreeSelect.stories.js +270 -0
  177. package/src/components/TreeSelect/scss/option.scss +204 -0
  178. package/src/components/TreeSelect/scss/select.scss +166 -0
  179. package/src/constants/events.js +2 -0
  180. package/src/constants/keyCodes.js +8 -0
  181. package/src/directives/outside/outside.js +81 -0
  182. package/src/directives/outside/outside.stories.js +29 -0
  183. package/src/directives/outside/readme.mdx +24 -0
  184. package/src/helpers/generateUID.js +3 -0
  185. package/src/helpers/getHrefFromID.js +3 -0
  186. package/src/helpers/multiLineOverflows.js +3 -0
  187. package/src/helpers/removeEvents.js +9 -0
  188. package/src/index.js +49 -0
  189. package/src/main.js +12 -0
  190. package/src/stories/link.readme.mdx +57 -0
  191. package/src/stories/link.stories.js +59 -0
  192. package/static/Logo.svg +25 -0
  193. package/static/docks/button.pdf +147566 -0
  194. package/vite.config.js +47 -0
@@ -0,0 +1,166 @@
1
+ @import "../../../assets/scss/variables/colors.scss";
2
+ @import "../../../assets/scss/typography.scss";
3
+ @import "../../../assets/scss/mixins.scss";
4
+
5
+ $switcher-slider-on: $blue-800;
6
+ $switcher-slider-on-hover: $blue-700;
7
+ $switcher-slider-on-active: $blue-900;
8
+ $switcher-slider-off: $gray-600;
9
+ $switcher-slider-off-hover: $gray-500;
10
+ $switcher-slider-off-active: $neutral-600;
11
+ $switcher-slider-disabled: $neutral-500;
12
+ $switcher-circle: $white;
13
+
14
+ .ib-toggle-container {
15
+ display: flex;
16
+ justify-content: space-between;
17
+ align-items: center;
18
+
19
+ &.label-position-left {
20
+ flex-direction: row-reverse;
21
+
22
+ .toggle-label {
23
+ padding-right: 15px;
24
+ padding-left: 0;
25
+ }
26
+ }
27
+
28
+ .toggle-label {
29
+ @include Ib-H4-regular;
30
+ padding-left: 15px;
31
+ cursor: pointer;
32
+ }
33
+
34
+ .toggle-wrapper {
35
+ display: inline-block;
36
+ vertical-align: middle;
37
+ width: 32px;
38
+ height: 18px;
39
+
40
+ .toggle {
41
+ position: relative;
42
+ display: inline-block;
43
+ margin-bottom: 0 !important;
44
+ width: 32px;
45
+ height: 18px;
46
+ z-index: 10;
47
+ cursor: pointer;
48
+
49
+ .ib-icon {
50
+ position: absolute;
51
+ top: 50%;
52
+ transform: translateY(-50%);
53
+ font-size: 12px;
54
+ color: #fff;
55
+ z-index: 11;
56
+ }
57
+
58
+ .unchecked-icon {
59
+ right: 2px;
60
+ }
61
+
62
+ .checked-icon {
63
+ left: 2px;
64
+ }
65
+ }
66
+
67
+ /* Hide default HTML checkbox */
68
+ .toggle input {
69
+ display: none;
70
+ }
71
+
72
+ /* The slider */
73
+ .toggle-slider {
74
+ position: absolute;
75
+ cursor: pointer;
76
+ top: 0;
77
+ left: 0;
78
+ right: 0;
79
+ bottom: 0;
80
+ background-color: $switcher-slider-off;
81
+ -webkit-transition: 0.4s;
82
+ transition: background-color 0.4s;
83
+ }
84
+
85
+ .toggle-slider:before {
86
+ position: absolute;
87
+ content: "";
88
+ height: 14px;
89
+ width: 14px;
90
+ left: 2px;
91
+ bottom: 2px;
92
+ background-color: $switcher-circle;
93
+ -webkit-transition: 0.4s;
94
+ transition: 0.4s;
95
+ }
96
+ }
97
+
98
+ input:checked + .toggle-slider {
99
+ background-color: $switcher-slider-on;
100
+ }
101
+
102
+ input:disabled + .toggle-slider {
103
+ background-color: $switcher-slider-disabled;
104
+ }
105
+
106
+ input:checked + .toggle-slider:before {
107
+ transform: translateX(14px);
108
+ }
109
+
110
+ /* Rounded sliders */
111
+ .toggle-slider.round {
112
+ border-radius: 100px;
113
+ }
114
+
115
+ .toggle-slider.round:before {
116
+ border-radius: 50%;
117
+ }
118
+
119
+ &:hover {
120
+ .toggle-slider {
121
+ background-color: $switcher-slider-off-hover;
122
+ }
123
+ }
124
+
125
+ &:active {
126
+ .toggle-slider {
127
+ background-color: $switcher-slider-off-active;
128
+ }
129
+ }
130
+
131
+ &:focus {
132
+ border-radius: 4px;
133
+ @include outline(2px);
134
+ }
135
+
136
+ &.toggle-on {
137
+ &:hover {
138
+ .toggle-slider {
139
+ background-color: $switcher-slider-on-hover;
140
+ }
141
+ }
142
+
143
+ &:active {
144
+ .toggle-slider {
145
+ background-color: $switcher-slider-on-active;
146
+ }
147
+ }
148
+ }
149
+
150
+ &.toggle-disabled {
151
+ &:hover {
152
+ .toggle-slider,
153
+ .toggle,
154
+ .toggle-label {
155
+ cursor: default;
156
+ }
157
+ }
158
+
159
+ &:focus {
160
+ outline: none!important;
161
+ }
162
+ .toggle-label {
163
+ color: $switcher-slider-disabled;
164
+ }
165
+ }
166
+ }
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <ion-icon
3
+ :style="styles"
4
+ :name="name"
5
+ :class="classes + ' ib-icon' + ' icon-' + name"
6
+ ref="icon"
7
+ ></ion-icon>
8
+ </template>
9
+
10
+ <script>
11
+ export default {
12
+ name: "IbIcon",
13
+ props: {
14
+ name: {
15
+ type: String,
16
+ required: true,
17
+ },
18
+ classes: {
19
+ type: String,
20
+ default: "",
21
+ },
22
+ styles: {
23
+ type: [String, Object],
24
+ default: "",
25
+ },
26
+ },
27
+ mounted() {
28
+ const interval = setInterval(() => {
29
+ if (this.$refs.icon?.shadowRoot?.querySelector("title")) {
30
+ this.$refs.icon.shadowRoot.querySelector("title").innerHTML = "";
31
+ clearInterval(interval);
32
+ }
33
+ }, 1000);
34
+ },
35
+ };
36
+ </script>
37
+ <style>
38
+ .ib-icon {
39
+ visibility: visible;
40
+ }
41
+ </style>
@@ -0,0 +1,91 @@
1
+ @import "../../assets/scss/variables/colors.scss";
2
+ @import "../../assets/scss/mixins.scss";
3
+
4
+ .ib-icon-button {
5
+ padding: 0;
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ font-size: 16px;
10
+
11
+ &.ib-icon {
12
+ &-btn-rounded {
13
+ border-radius: 100%;
14
+ }
15
+
16
+ &-btn-m {
17
+ width: 36px;
18
+ height: 36px;
19
+ }
20
+
21
+ &-btn-s {
22
+ width: 24px;
23
+ height: 24px;
24
+ }
25
+
26
+ &-btn-xs {
27
+ width: 16px;
28
+ height: 16px;
29
+
30
+ .ib-icon {
31
+ position: absolute;
32
+ top: 50%;
33
+ left: 50%;
34
+ transform: translate(-50%, -50%);
35
+ }
36
+
37
+ &:focus {
38
+ outline-offset: 2px;
39
+ }
40
+ }
41
+
42
+ &-btn-tertiary {
43
+ border: 2px solid transparent;
44
+ transition: border 0.3s;
45
+
46
+ &:hover {
47
+ border-color: $blue-300;
48
+ }
49
+
50
+ &:active {
51
+ border-color: transparent;
52
+ color: $blue-900;
53
+ background-color: $blue-200;
54
+ }
55
+ }
56
+
57
+ &-btn-ghost {
58
+ border: 2px solid transparent;
59
+ transition: border 0.3s;
60
+ color: $neutral-900;
61
+
62
+ &:hover {
63
+ border-color: $blue-300;
64
+ }
65
+
66
+ &:active {
67
+ border-color: transparent;
68
+ color: $blue-900;
69
+ background-color: $blue-200;
70
+ }
71
+ }
72
+
73
+ &-btn-white {
74
+ border: 2px solid transparent;
75
+ background-color: $white;
76
+ color: $neutral-900;
77
+
78
+ &:hover {
79
+ color: $blue-700;
80
+ background-color: $blue-100;
81
+ border-color: $blue-300;
82
+ }
83
+
84
+ &:active {
85
+ border-color: transparent;
86
+ color: $blue-900;
87
+ background-color: $blue-200;
88
+ }
89
+ }
90
+ }
91
+ }
@@ -0,0 +1,115 @@
1
+ import IbIconButton from "./IconButton.vue";
2
+ import IbIcon from "../Icon.vue";
3
+ import { iconButtonKindOptions, iconButtonSize } from "./constants";
4
+ import readme from "./readme.mdx";
5
+
6
+ export default {
7
+ title: "Icon Button",
8
+ component: IbIconButton,
9
+ argTypes: {
10
+ onClick: { action: "click" },
11
+ kind: {
12
+ control: { type: "select" },
13
+ options: Object.values(iconButtonKindOptions),
14
+ },
15
+ size: {
16
+ control: { type: "select" },
17
+ options: Object.values(iconButtonSize),
18
+ },
19
+ },
20
+ parameters: {
21
+ docs: {
22
+ page: readme,
23
+ },
24
+ },
25
+ };
26
+
27
+ const storyWrapper = '<div style="display: flex; align-items:center; justify-content: center; width: 200px; height: 200px; margin: 0 auto"><story /></div>';
28
+
29
+ const Template = (args) => ({
30
+ components: { IbIconButton },
31
+ setup() {
32
+ return { args };
33
+ },
34
+ template: `
35
+ <ib-icon-button v-bind="args">
36
+ <ion-icon style="font-size=20px" name="add"></ion-icon>
37
+ </ib-icon-button>
38
+ `,
39
+ });
40
+
41
+ export const Default = Template.bind({});
42
+ Default.args = {
43
+ kind: iconButtonKindOptions.primary,
44
+ };
45
+ Default.decorators = [
46
+ () => ({
47
+ template: storyWrapper,
48
+ }),
49
+ ];
50
+ export const RoundedButton = Template.bind({});
51
+ RoundedButton.args = {
52
+ rounded: true,
53
+ };
54
+ RoundedButton.decorators = [
55
+ () => ({
56
+ template: storyWrapper,
57
+ }),
58
+ ];
59
+ const ButtonWithTooltipTemplate = (args) => ({
60
+ components: { IbIconButton, IbIcon },
61
+ setup() {
62
+ return { args };
63
+ },
64
+ template: `
65
+ <ib-icon-button v-bind="args">
66
+ <ib-icon style="font-size=20px" name="information-circle-outline"></ib-icon>
67
+ </ib-icon-button>
68
+ `,
69
+ });
70
+
71
+ export const ButtonWithTooltip = ButtonWithTooltipTemplate.bind({});
72
+ ButtonWithTooltip.args = {
73
+ helpText: "Test",
74
+ kind: "ghost",
75
+ };
76
+ ButtonWithTooltip.decorators = [
77
+ () => ({
78
+ template: storyWrapper,
79
+ }),
80
+ ];
81
+
82
+ const SizesTemplate = (args) => ({
83
+ components: { IbIconButton },
84
+ setup() {
85
+ return { args };
86
+ },
87
+ template: `
88
+ <ib-icon-button size="xs">
89
+ <ion-icon name="add"></ion-icon>
90
+ </ib-icon-button>
91
+
92
+ <ib-icon-button size="s">
93
+ <ion-icon name="add"></ion-icon>
94
+ </ib-icon-button>
95
+
96
+ <ib-icon-button size="m">
97
+ <ion-icon name="add"></ion-icon>
98
+ </ib-icon-button>
99
+ `,
100
+ });
101
+
102
+ export const Sizes = SizesTemplate.bind({});
103
+ Sizes.decorators = [
104
+ () => ({
105
+ template:
106
+ '<div style="display: flex; gap: 10px; padding: 20px;"><story /></div>',
107
+ }),
108
+ ];
109
+ Sizes.parameters = {
110
+ docs: {
111
+ description: {
112
+ story: `All sizes: ${Object.keys(iconButtonSize)}`,
113
+ },
114
+ },
115
+ };
@@ -0,0 +1,100 @@
1
+ <template>
2
+ <ib-button
3
+ @click="onClick"
4
+ v-bind="attrs"
5
+ :href="href"
6
+ :kind="kind"
7
+ :disabled="disabled"
8
+ :tabindex="disabledFocus ? -1 : 0"
9
+ >
10
+ <slot></slot>
11
+ <ib-tooltip v-if="helpText.length" :text="helpText" />
12
+ </ib-button>
13
+ </template>
14
+
15
+ <script>
16
+ import IbButton from "../Button/Button.vue";
17
+ import IbTooltip from "../Tooltip/Tooltip.vue";
18
+ import { iconButtonKindOptions, iconButtonSize } from "./constants.js";
19
+ import removeEvents from "../../helpers/removeEvents";
20
+
21
+ export default {
22
+ name: "IbIconButton",
23
+ props: {
24
+ kind: {
25
+ type: String,
26
+ default: iconButtonKindOptions.primary,
27
+ validator: (value) => Object.keys(iconButtonKindOptions).includes(value),
28
+ },
29
+ size: {
30
+ type: String,
31
+ default: iconButtonSize.s,
32
+ validator: (value) => Object.keys(iconButtonSize).includes(value),
33
+ },
34
+ rounded: {
35
+ type: Boolean,
36
+ required: false,
37
+ default: false,
38
+ },
39
+ disabled: {
40
+ type: Boolean,
41
+ required: false,
42
+ default: false,
43
+ },
44
+ href: {
45
+ type: String,
46
+ default: "",
47
+ },
48
+ helpText: {
49
+ type: String,
50
+ default: "",
51
+ },
52
+ disabledFocus: {
53
+ type: Boolean,
54
+ default: false,
55
+ },
56
+ },
57
+ data() {
58
+ return {
59
+ tooltipVisible: false,
60
+ };
61
+ },
62
+ methods: {
63
+ onClick(e) {
64
+ this.$emit("click", e);
65
+ },
66
+ },
67
+ computed: {
68
+ classes() {
69
+ const classList = ["ib-icon-button"];
70
+ classList.push(`ib-icon-btn-${this.kind}`);
71
+ classList.push(`ib-icon-btn-${this.size}`);
72
+
73
+ if (this.rounded) {
74
+ classList.push(`ib-icon-btn-rounded`);
75
+ }
76
+
77
+ if (this.disabled) {
78
+ classList.push(`ib-icon-btn-disabled`);
79
+ }
80
+
81
+ return classList;
82
+ },
83
+ attrs() {
84
+ const attrsList = { ...removeEvents({ ...this.$attrs }) };
85
+ attrsList.class = [...this.classes, attrsList.class];
86
+
87
+ return attrsList;
88
+ },
89
+ },
90
+ components: {
91
+ IbButton,
92
+ IbTooltip,
93
+ },
94
+ inheritAttrs: false,
95
+ };
96
+ </script>
97
+
98
+ <style lang="scss">
99
+ @import "./IconButton.scss";
100
+ </style>
@@ -0,0 +1,14 @@
1
+ import { buttonKindOptions } from "../Button/constants";
2
+
3
+ export const iconButtonKindOptions = {
4
+ [buttonKindOptions.primary]: buttonKindOptions.primary,
5
+ [buttonKindOptions.tertiary]: buttonKindOptions.tertiary,
6
+ [buttonKindOptions.ghost]: buttonKindOptions.ghost,
7
+ white: "white",
8
+ };
9
+
10
+ export const iconButtonSize = {
11
+ xs: "xs",
12
+ s: "s",
13
+ m: "m",
14
+ };
@@ -0,0 +1,66 @@
1
+ # IbIconButton
2
+
3
+ import { Story, Canvas } from "@storybook/addon-docs";
4
+
5
+ Icon buttons allow users to take actions, and make choices, with a single tap. The icon Button should always have a tooltip.
6
+
7
+ ## Overview
8
+
9
+ Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. This button type has no label, so you must use a [tooltip](?path=/story/tooltip--default) when hovering and focusing on this button.
10
+
11
+ ### When to use
12
+
13
+ Use buttons to communicate actions users can take and to allow users to interact with the page. Each page should have only one primary button, and any remaining calls to action should be represented as lower emphasis buttons.
14
+
15
+ ### When not to use
16
+
17
+ Do not use buttons as navigational elements. Instead, use [links](?path=/story/links--inline-link) when the desired action is to take the user to a new page.
18
+
19
+ ### Props
20
+
21
+ | Name | type | Default Value | Description |
22
+ | ------------- | ------- | ------------- | ------------------------------------------------------------------------------------------------ |
23
+ | kind | String | primary | Specifies the kind of button. Possible options are: `primary`, `tertiary`, `ghost`, and `white`. |
24
+ | size | String | s | Specifies the size of the button. Possible options are xs, s, m. |
25
+ | rounded | Boolean | false | Determines if the button should be displayed with circle. |
26
+ | disabled | Boolean | false | Determines if the button should be disabled or not. |
27
+ | href | String | '' | Specifies the URL that the button should navigate to when clicked. |
28
+ | helpText | String | '' | Displays tooltip text when hovering or focus over the button. |
29
+ | disabledFocus | Boolean | false | Determines if the button should be focusable.. |
30
+
31
+ ### Slots
32
+
33
+ | Slot name | Description |
34
+ | --------- | ------------------------------------- |
35
+ | default | The default slot for the button icon. |
36
+
37
+ ### Events
38
+
39
+ | Event name | Parameters | Description |
40
+ | ---------- | ---------- | ----------------------------------- |
41
+ | click | event | Emitted when the button is clicked. |
42
+
43
+ ### Default
44
+
45
+ <Canvas>
46
+ <Story id="icon-button--default" />
47
+ </Canvas>
48
+
49
+ ### Rounded
50
+
51
+ <Canvas>
52
+ <Story id="icon-button--rounded-button" />
53
+ </Canvas>
54
+
55
+ ### With tooltip
56
+
57
+ <Canvas>
58
+ <Story id="icon-button--button-with-tooltip" />
59
+ </Canvas>
60
+
61
+
62
+ ### All sizes
63
+
64
+ <Canvas>
65
+ <Story id="icon-button--sizes" />
66
+ </Canvas>