@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,132 @@
1
+ <template>
2
+ <div :class="classes">
3
+ <button
4
+ :disabled="disabled"
5
+ v-if="!isLink"
6
+ class="split-button-main"
7
+ v-bind="mainButtonAttrs"
8
+ >
9
+ {{ content }}
10
+ </button>
11
+
12
+ <a
13
+ v-else
14
+ :disabled="disabled"
15
+ class="split-button-main"
16
+ :class="{ disabled }"
17
+ v-bind="mainButtonAttrs"
18
+ >
19
+ {{ content }}
20
+ </a>
21
+
22
+ <ib-dropdown-list :disabled="disabled" :closeOnClick="true">
23
+ <template #trigger>
24
+ <button :disabled="disabled" class="split-button-menu-trigger">
25
+ <ib-icon name="chevron-down-outline" />
26
+ </button>
27
+ </template>
28
+
29
+ <template #body>
30
+ <div ref="list">
31
+ <slot></slot>
32
+ </div>
33
+ </template>
34
+ </ib-dropdown-list>
35
+ </div>
36
+ </template>
37
+
38
+ <script>
39
+ import { splitButtonKindOptions } from "./constants";
40
+ import generateUID from "../../helpers/generateUID"
41
+ import IbDropdownList from "../Dropdown/DropdownList.vue";
42
+ import IbIcon from "../Icon.vue";
43
+
44
+ export default {
45
+ name: "IbSplitButton",
46
+ props: {
47
+ id: {
48
+ type: String,
49
+ default: () => generateUID(),
50
+ },
51
+ kind: {
52
+ type: String,
53
+ default: splitButtonKindOptions.common,
54
+ },
55
+ disabled: {
56
+ type: Boolean,
57
+ default: false,
58
+ },
59
+ saveSelected: {
60
+ type: Boolean,
61
+ default: false,
62
+ },
63
+ },
64
+ mounted() {
65
+ this.childList = Array.from(this.$refs.list.children);
66
+
67
+ this.childList?.forEach((element, idx) => {
68
+ element.addEventListener("click", () => {
69
+ this.childList[this.activeElemIdx].classList.remove("active");
70
+
71
+ if (this.saveSelected) {
72
+ this.activeElemIdx = idx;
73
+ localStorage.setItem(`split-button-${this.id}`, idx);
74
+ }
75
+ });
76
+ });
77
+
78
+ if (this.saveSelected) {
79
+ const activeItemIdx = localStorage.getItem(`split-button-${this.id}`);
80
+ if (activeItemIdx) {
81
+ this.activeElemIdx = activeItemIdx;
82
+ }
83
+ }
84
+
85
+ this.setActiveItem();
86
+ },
87
+ data() {
88
+ return {
89
+ activeElemIdx: 0,
90
+ content: "",
91
+ mainButtonAttrs: {},
92
+ isLink: false,
93
+ childList: [],
94
+ };
95
+ },
96
+ components: {
97
+ IbIcon,
98
+ IbDropdownList,
99
+ },
100
+ methods: {
101
+ setActiveItem() {
102
+ this.mainButtonAttrs = this.$slots.default()[this.activeElemIdx].props;
103
+
104
+ if (this.mainButtonAttrs && "href" in this.mainButtonAttrs) {
105
+ this.isLink = true;
106
+ } else {
107
+ this.isLink = false;
108
+ }
109
+
110
+ this.childList[this.activeElemIdx].classList.add("active");
111
+ this.content = this.childList[this.activeElemIdx].textContent;
112
+ },
113
+ },
114
+ computed: {
115
+ classes() {
116
+ const classList = ["split-button"];
117
+ classList.push(`split-button-${this.kind}`);
118
+
119
+ return classList;
120
+ },
121
+ },
122
+ watch: {
123
+ activeElemIdx() {
124
+ this.setActiveItem();
125
+ },
126
+ },
127
+ };
128
+ </script>
129
+
130
+ <style lang="scss">
131
+ @import "./splitButton.scss";
132
+ </style>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <component
3
+ :is="href.length ? 'a' : 'button'"
4
+ v-bind="attrs"
5
+ class="ib-dropdown-item"
6
+ >
7
+ <slot></slot>
8
+ </component>
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ props: {
14
+ href: {
15
+ type: String,
16
+ default: "",
17
+ },
18
+ },
19
+ computed: {
20
+ attrs() {
21
+ const attrsList = {};
22
+ if (this.href.length) {
23
+ attrsList.href = this.href;
24
+ }
25
+
26
+ return attrsList;
27
+ },
28
+ },
29
+ };
30
+ </script>
31
+ <style lang="scss" scoped>
32
+ @import "../../assets/scss/mixins/dropdown-list-item.scss";
33
+ @include DropdownListItem;
34
+ </style>
@@ -0,0 +1,4 @@
1
+ export const splitButtonKindOptions = {
2
+ common: "common",
3
+ danger: "danger",
4
+ };
@@ -0,0 +1,77 @@
1
+ # IbSplitButton
2
+
3
+ import { Story, Canvas } from "@storybook/addon-docs";
4
+
5
+ Split buttons are for presenting several related tools if one option is used most frequently. Making the most commonly accessed option a default lowers the interaction cost to use that option since it removes the need to open the menu before selecting the item.
6
+
7
+ A split button is a button with two components: a label and an arrow; clicking on the label selects a default action, and clicking on the arrow opens up a list of other possible actions.
8
+
9
+ It is a hybrid between a [button](?path=/docs/button--default) and a [drop-down menu](?path=/docs/dropdown--default): it groups related commands together into a dropdown, but also offers one-click access to a default choice that doesn’t require opening the menu.
10
+
11
+ ### When to use
12
+
13
+ - Use Split Button for grouping commands and tools.
14
+
15
+ ### When not to use
16
+
17
+ - A Split Buttons should not be used for navigation.
18
+
19
+ ### Default
20
+
21
+ <Canvas>
22
+ <Story id="splitbutton--default" />
23
+ </Canvas>
24
+
25
+ ### Props
26
+
27
+ | Name | type | Default Value | Description |
28
+ | ------------ | ------- | ------------------------ | --------------------------------------------------------------------------------------------------- |
29
+ | kind | String | primary | The kind of button to be displayed. Possible values are: `common` or `danger`. |
30
+ | disabled | Boolean | false | Whether the button is disabled or not. |
31
+ | saveSelected | Boolean | false | Change main button to last clicked options. Vety import set unique id |
32
+ | id | String | auto-generated unique ID | It is necessary that the button has a unique identifier, it's very important to save Selected logic |
33
+
34
+ ### Slots
35
+
36
+ | Slot name | Description |
37
+ | --------- | -------------------------------------------- |
38
+ | default | This slot accepts `<ib-split-button-item>`-s |
39
+
40
+ ### Events
41
+
42
+ This component not suports events.
43
+
44
+ ## IbSplitButtonItem
45
+
46
+ This component need used inside of Split-button.
47
+
48
+ ### Props
49
+
50
+ | Name | type | Default Value | Description |
51
+ | ---- | ------ | ------------- | -------------------------------------------------------------------- |
52
+ | href | String | '' | Defines the element type as a link and adds the href attribute to it. |
53
+
54
+ ### Example
55
+ ```html
56
+ <script>
57
+ export default {
58
+ methods: {
59
+ onClick(event) {
60
+ console.log("click on first item");
61
+ },
62
+ onClick2(event) {
63
+ console.log("click on second item");
64
+ },
65
+ },
66
+ components: { IbSplitButton, IbSplitButtonItem}
67
+ };
68
+ </script>
69
+
70
+ <template>
71
+ <ib-split-button>
72
+ <ib-split-button-item @click="onClick">Button 1</ib-split-button-item>
73
+ <ib-split-button-item @click="onClick2">Button 2</ib-split-button-item>
74
+ <ib-split-button-item href="#">Link 3</ib-split-button-item>
75
+ </ib-split-button>`,
76
+ </template>
77
+ ```
@@ -0,0 +1,161 @@
1
+ @import "../../assets/scss/variables/colors.scss";
2
+ @import "../../assets/scss/typography.scss";
3
+ @import "../../assets/scss/mixins.scss";
4
+
5
+ $split-button-color: $white;
6
+ $split-button-disabled-color: $neutral-500;
7
+ $split-button-disabled-bg: $gray-100;
8
+
9
+ // Common styles
10
+ $common-split-button-bg: $blue-800;
11
+ $common-split-button-focus-bg: $blue-800;
12
+ $common-split-button-hover-bg: $blue-700;
13
+ $common-split-button-active-bg: $blue-900;
14
+
15
+ $danger-split-button-bg: $red-800;
16
+ $danger-split-button-focus-bg: $red-800;
17
+ $danger-split-button-hover-bg: $red-700;
18
+ $danger-split-button-active-bg: $red-900;
19
+
20
+ .split-button {
21
+ display: flex;
22
+ align-items: center;
23
+ position: relative;
24
+ width: fit-content;
25
+
26
+ .ib-dropdown {
27
+ position: initial;
28
+ }
29
+
30
+ &-menu-trigger {
31
+ border: none;
32
+ border-radius: 0 4px 4px 0;
33
+ cursor: pointer;
34
+ height: 36px;
35
+ width: 36px;
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ padding: 0;
40
+ margin: 0;
41
+ margin-left: 1px;
42
+ color: $split-button-color;
43
+ font-size: 16px;
44
+ transition: background-color 0.3s;
45
+
46
+ &:focus {
47
+ @include focus(1px);
48
+ position: relative;
49
+ z-index: 100;
50
+ }
51
+ }
52
+
53
+
54
+ &-main {
55
+ @include Ib-H4-medium;
56
+ color: $split-button-color;
57
+ height: 36px;
58
+ display: flex;
59
+ align-items: center;
60
+ text-decoration: none;
61
+ padding: 0 15px;
62
+ border-radius: 4px 0 0 4px;
63
+ border: none;
64
+ transition: background-color 0.3s;
65
+
66
+ &:focus {
67
+ @include focus(2px);
68
+ position: relative;
69
+ z-index: 100;
70
+ }
71
+ }
72
+
73
+ &.split-button-common {
74
+ .split-button-main {
75
+ background-color: $common-split-button-bg;
76
+
77
+ &:hover {
78
+ background-color: $common-split-button-hover-bg;
79
+ }
80
+
81
+ &:active {
82
+ background-color: $common-split-button-active-bg;
83
+ }
84
+
85
+ &:focus {
86
+ background-color: $common-split-button-focus-bg;
87
+ }
88
+
89
+ &.disabled,
90
+ &:disabled {
91
+ background-color: $split-button-disabled-bg;
92
+ color: $split-button-disabled-color;
93
+ }
94
+ }
95
+
96
+ .split-button-menu-trigger {
97
+ background-color: $common-split-button-bg;
98
+
99
+ &:hover {
100
+ background-color: $common-split-button-hover-bg;
101
+ }
102
+
103
+ &:active {
104
+ background-color: $common-split-button-active-bg;
105
+ }
106
+
107
+ &:focus {
108
+ background-color: $common-split-button-focus-bg;
109
+ }
110
+ &.disabled,
111
+ &:disabled {
112
+ background-color: $split-button-disabled-bg;
113
+ color: $split-button-disabled-color;
114
+ }
115
+ }
116
+ }
117
+
118
+ &.split-button-danger {
119
+ .split-button-main {
120
+ background-color: $danger-split-button-bg;
121
+
122
+ &:hover {
123
+ background-color: $danger-split-button-hover-bg;
124
+ }
125
+
126
+ &:active {
127
+ background-color: $danger-split-button-active-bg;
128
+ }
129
+
130
+ &:focus {
131
+ background-color: $danger-split-button-focus-bg;
132
+ }
133
+ &.disabled,
134
+ &:disabled {
135
+ background-color: $split-button-disabled-bg;
136
+ color: $split-button-disabled-color;
137
+ }
138
+ }
139
+
140
+ .split-button-menu-trigger {
141
+ background-color: $danger-split-button-bg;
142
+
143
+ &:hover {
144
+ background-color: $danger-split-button-hover-bg;
145
+ }
146
+
147
+ &:active {
148
+ background-color: $danger-split-button-active-bg;
149
+ }
150
+
151
+ &:focus {
152
+ background-color: $danger-split-button-focus-bg;
153
+ }
154
+
155
+ &:disabled{
156
+ background-color: $split-button-disabled-bg;
157
+ color: $split-button-disabled-color;
158
+ }
159
+ }
160
+ }
161
+ }
@@ -0,0 +1,40 @@
1
+ import IbStatusIndicator from "./StatusIndicator.vue";
2
+ import { StatusIndicatorType } from "./constants";
3
+ import readme from "./readme.mdx";
4
+
5
+ export default {
6
+ title: "Status Indicator",
7
+ component: IbStatusIndicator,
8
+ argTypes: {
9
+ type: {
10
+ control: { type: "select" },
11
+ options: Object.values(StatusIndicatorType),
12
+ description:
13
+ 'The type of status indicator to display. This prop determines the color and icon of the status indicator. Possible values are "new", "success", "error", "warning", "incomplete", "inProgress", "loading" and "disconnect".',
14
+ },
15
+ default: {
16
+ description:
17
+ "The component includes a default slot that can be used to provide additional content to display alongside the status indicator.",
18
+ },
19
+ },
20
+ parameters: {
21
+ docs: {
22
+ page: readme,
23
+ },
24
+ },
25
+ };
26
+
27
+ export const Default = {
28
+ render: (args) => ({
29
+ components: { IbStatusIndicator },
30
+ setup() {
31
+ return { args };
32
+ },
33
+ template: `<ib-status-indicator v-bind="args">
34
+ <span v-html="args.default"></span>
35
+ </ib-status-indicator>`,
36
+ }),
37
+ args: {
38
+ default: "default",
39
+ },
40
+ };
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <div class="status-indicator">
3
+ <div class="status-indicator-icon" :class="type" v-html="icons[type]"></div>
4
+ <slot></slot>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ import { icons } from "./icons";
10
+
11
+ export default {
12
+ props: {
13
+ type: {
14
+ type: String,
15
+ default: "success",
16
+ },
17
+ },
18
+ data() {
19
+ return {
20
+ icons: icons,
21
+ };
22
+ },
23
+ };
24
+ </script>
25
+
26
+ <style lang="scss" scoped>
27
+ @import "../../assets/scss/variables/colors.scss";
28
+ @import "../../assets/scss//typography.scss";
29
+
30
+ @keyframes loader {
31
+ from {
32
+ transform: rotate(0deg);
33
+ }
34
+ to {
35
+ transform: rotate(-360deg);
36
+ }
37
+ }
38
+
39
+ .status-indicator {
40
+ @include Ib-H4-regular;
41
+ display: inline-flex;
42
+ align-items: center;
43
+
44
+ .status-indicator-icon {
45
+ margin-right: 5px;
46
+
47
+ &.loading {
48
+ animation: loader 1.5s linear infinite;
49
+ }
50
+ }
51
+ }
52
+ </style>
@@ -0,0 +1,10 @@
1
+ export const StatusIndicatorType = {
2
+ new: "new",
3
+ success: "success",
4
+ error: "error",
5
+ warning: "warning",
6
+ incomplete: "incomplete",
7
+ inProgress: "inProgress",
8
+ loading: "loading",
9
+ disconnect: "disconnect",
10
+ };
@@ -0,0 +1,48 @@
1
+ export const icons = {
2
+ new: `<svg width="9" height="9" viewBox="0 0 9 9" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <circle cx="4.5" cy="4.5" r="4" fill="#0369E8"/>
4
+ </svg>
5
+ `,
6
+
7
+ success: `
8
+ <svg width="9" height="9" viewBox="0 0 9 9" fill="none" xmlns="http://www.w3.org/2000/svg">
9
+ <circle cx="4.5" cy="4.5" r="4" fill="#0D7F39"/>
10
+ </svg>
11
+ `,
12
+
13
+ error: `
14
+ <svg width="8" height="9" viewBox="0 0 8 9" fill="none" xmlns="http://www.w3.org/2000/svg">
15
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.30688 6.75114C7.74427 6.10987 8 5.3348 8 4.5C8 2.29086 6.20914 0.5 4 0.5C3.1652 0.5 2.39013 0.755729 1.74885 1.19312L7.30688 6.75114ZM0.693121 2.24885C0.255729 2.89013 0 3.6652 0 4.5C0 6.70914 1.79086 8.5 4 8.5C4.8348 8.5 5.60987 8.24427 6.25114 7.80688L0.693121 2.24885Z" fill="#C8182E"/>
16
+ </svg>
17
+ `,
18
+
19
+ warning: `
20
+ <svg width="10" height="9" viewBox="0 0 10 9" fill="none" xmlns="http://www.w3.org/2000/svg">
21
+ <path d="M5 0.5L10 8.5H0L5 0.5Z" fill="#F1BC19"/>
22
+ </svg>
23
+ `,
24
+
25
+ incomplete: `
26
+ <svg width="11" height="11" viewBox="0 0 11 11" fill="none" xmlns="http://www.w3.org/2000/svg">
27
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 2.5C3.84315 2.5 2.5 3.84315 2.5 5.5C2.5 7.15685 3.84315 8.5 5.5 8.5C7.15685 8.5 8.5 7.15685 8.5 5.5C8.5 3.84315 7.15685 2.5 5.5 2.5ZM0.5 5.5C0.5 2.73858 2.73858 0.5 5.5 0.5C8.26142 0.5 10.5 2.73858 10.5 5.5C10.5 8.26142 8.26142 10.5 5.5 10.5C2.73858 10.5 0.5 8.26142 0.5 5.5Z" fill="#677788"/>
28
+ </svg>
29
+ `,
30
+
31
+ inProgress: `
32
+ <svg width="11" height="11" viewBox="0 0 11 11" fill="none" xmlns="http://www.w3.org/2000/svg">
33
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 0.5C2.73858 0.5 0.5 2.73858 0.5 5.5C0.5 8.26142 2.73858 10.5 5.5 10.5C8.26142 10.5 10.5 8.26142 10.5 5.5C10.5 2.73858 8.26142 0.5 5.5 0.5ZM2.5 5.5C2.5 3.84315 3.84315 2.5 5.5 2.5V5.5L7.62132 7.62132C7.07843 8.16421 6.32843 8.5 5.5 8.5C3.84315 8.5 2.5 7.15685 2.5 5.5Z" fill="#0060D6"/>
34
+ </svg>
35
+ `,
36
+
37
+ loading: `
38
+ <svg width="10" height="11" viewBox="0 0 10 11" fill="none" xmlns="http://www.w3.org/2000/svg">
39
+ <path d="M5 2.5C3.34315 2.5 2 3.84315 2 5.5C2 7.15685 3.34315 8.5 5 8.5C6.65685 8.5 8 7.15685 8 5.5H10C10 8.26142 7.76142 10.5 5 10.5C2.23858 10.5 0 8.26142 0 5.5C0 2.73858 2.23858 0.5 5 0.5V2.5Z" fill="#0060D6"/>
40
+ </svg>
41
+ `,
42
+
43
+ disconnect: `
44
+ <svg width="11" height="11" viewBox="0 0 11 11" fill="none" xmlns="http://www.w3.org/2000/svg">
45
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M4.20658 2.79237C4.59822 2.60495 5.03685 2.5 5.5 2.5C7.15685 2.5 8.5 3.84315 8.5 5.5C8.5 5.96315 8.39505 6.40178 8.20763 6.79342L9.6716 8.25739C10.1951 7.46696 10.5 6.51908 10.5 5.5C10.5 2.73858 8.26142 0.5 5.5 0.5C4.48092 0.5 3.53304 0.804877 2.74261 1.3284L4.20658 2.79237ZM2.79237 4.20658L1.3284 2.74261C0.804877 3.53304 0.5 4.48092 0.5 5.5C0.5 8.26142 2.73858 10.5 5.5 10.5C6.51908 10.5 7.46696 10.1951 8.25739 9.6716L6.79342 8.20763C6.40178 8.39505 5.96315 8.5 5.5 8.5C3.84315 8.5 2.5 7.15685 2.5 5.5C2.5 5.03685 2.60495 4.59822 2.79237 4.20658Z" fill="#677788"/>
46
+ </svg>
47
+ `,
48
+ };
@@ -0,0 +1,21 @@
1
+ import { Story, Canvas, Controls } from "@storybook/addon-docs";
2
+ import * as StatusIndicatorStories from "./StatusIndicator.stories";
3
+
4
+ # IbStatusIndicator
5
+
6
+ Shape indicators combine color shape and text to indicate the status. The shape depends on the status type.
7
+
8
+ ### Same shape, different color
9
+
10
+ The status shapes naturally allow more room for interpretation than the status icons. Certain shapes can take on different colors for different circumstances. However, NEVER use the same shape, in different colors, within the same experience.
11
+
12
+ ### Best practice
13
+
14
+ - Do place shape indicators before labels. Do not place shape indicators after the labels to avoid pushing them out of alignment.
15
+ - Do use shape, color, and status labels to improve scannability. Avoid using only color and status labels to differentiate your content.
16
+
17
+
18
+ ### Default
19
+ <Canvas of={StatusIndicatorStories.Default} />
20
+
21
+ <Controls />
@@ -0,0 +1,71 @@
1
+ <template>
2
+ <td
3
+ @resize="freezeCol"
4
+ class="ib-cell"
5
+ v-bind="this.attr"
6
+ >
7
+ <div class="cell">
8
+ <slot></slot>
9
+ </div>
10
+ </td>
11
+ </template>
12
+
13
+ <script>
14
+ export default {
15
+ name: "IbCell",
16
+ props: {
17
+ fixed: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+ },
22
+ data() {
23
+ return {
24
+ attr: {},
25
+ };
26
+ },
27
+ mounted() {
28
+ if (this.fixed) {
29
+ this.freezeCol();
30
+ }
31
+ },
32
+ methods: {
33
+ freezeCol() {
34
+ const elRect = this.$el.getBoundingClientRect();
35
+ const trRect = this.$el.closest("tr").getBoundingClientRect();
36
+ if (!this.attr.style) this.attr.style = {};
37
+ this.attr.style.minWidth = `${elRect.width}px`;
38
+ this.attr.style.left = `${elRect.left - trRect.left}px`;
39
+ this.attr.class += " fixed";
40
+ },
41
+ },
42
+ };
43
+ </script>
44
+
45
+ <style lang="scss" scoped>
46
+ @import "../../../assets/scss/typography.scss";
47
+ @import "../../../assets/scss/variables/colors.scss";
48
+
49
+ .ib-cell {
50
+ @include Ib-H4-regular;
51
+ padding: 0 15px;
52
+ height: 60px;
53
+ color: $neutral-900;
54
+ border-bottom: 1px solid $gray-200;
55
+ &.fixed {
56
+ position: sticky;
57
+ box-shadow: 2px 0px 2px rgba(80, 80, 80, 0.1);
58
+ }
59
+
60
+ &:last-child {
61
+ &.fixed {
62
+ box-shadow: -2px 0px 2px rgba(80, 80, 80, 0.1);
63
+ }
64
+ }
65
+ .cell {
66
+ display: flex;
67
+ justify-content: center;
68
+ width: max-content;
69
+ }
70
+ }
71
+ </style>