@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,90 @@
1
+ import IbProgressBar from "./ProgressBar.vue";
2
+ import { progressBarStates } from "./constants";
3
+ import { ref } from "vue";
4
+ import readme from "./readme.mdx";
5
+
6
+ const storyWrapper = '<div style="padding: 30px"><story /></div>';
7
+
8
+ export default {
9
+ title: "Progress Bar",
10
+ component: IbProgressBar,
11
+ argTypes: {
12
+ states: {
13
+ control: { type: "select" },
14
+ options: Object.values(progressBarStates),
15
+ },
16
+ },
17
+ parameters: {
18
+ docs: {
19
+ page: readme,
20
+ },
21
+ },
22
+ };
23
+
24
+ const Template = (args) => ({
25
+ components: { IbProgressBar },
26
+ setup() {
27
+ return { args };
28
+ },
29
+ template: `
30
+ <ib-progress-bar v-bind="args" />
31
+ `,
32
+ });
33
+ export const Default = Template.bind({});
34
+ Default.args = {
35
+ progress: 20,
36
+ };
37
+ Default.decorators = [
38
+ () => ({
39
+ template: storyWrapper,
40
+ }),
41
+ ];
42
+
43
+ const AnimatedTemplate = () => ({
44
+ components: { IbProgressBar },
45
+
46
+ setup() {
47
+ let progress = ref(50);
48
+ let status = ref("progress");
49
+
50
+ const timer = setInterval(() => {
51
+ progress.value += 1;
52
+ if (progress.value >= 100) {
53
+ status.value = "success";
54
+ clearInterval(timer);
55
+ }
56
+ }, 900);
57
+ return { progress, status };
58
+ },
59
+ template: `
60
+ <ib-progress-bar :states="status" :progress="progress" />
61
+ `,
62
+ });
63
+
64
+ export const Animated = AnimatedTemplate.bind({});
65
+ Animated.decorators = [
66
+ () => ({
67
+ template: storyWrapper,
68
+ }),
69
+ ];
70
+ Animated.parameters = { controls: { disable: true } };
71
+
72
+ const AllStatesTemplate = () => ({
73
+ components: { IbProgressBar },
74
+
75
+ setup() {
76
+ const states = Object.values(progressBarStates)
77
+
78
+ return { states };
79
+ },
80
+ template: `
81
+ <ib-progress-bar v-for="status in states" :states="status" :progress="75" style="margin-bottom: 50px" />
82
+ `,
83
+ });
84
+ export const States = AllStatesTemplate.bind({});
85
+ States.decorators = [
86
+ () => ({
87
+ template: storyWrapper,
88
+ }),
89
+ ];
90
+ States.parameters = { controls: { disable: true } };
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <div class="ib-progress-bar-wrapper">
3
+ <div :class="classes">
4
+ <div class="progress" :style="{ width: progress + '%' }">
5
+ <div class="gradient"></div>
6
+ </div>
7
+ <div></div>
8
+ </div>
9
+ <ib-icon v-show="iconName.length" class="status-icon" :name="iconName" />
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import IbIcon from "../Icon.vue";
15
+ import { progressBarStates } from "./constants";
16
+
17
+ export default {
18
+ props: {
19
+ states: {
20
+ type: String,
21
+ default: progressBarStates.PROGRESS,
22
+ },
23
+ progress: {
24
+ type: [String, Number],
25
+ default: 0,
26
+ },
27
+ },
28
+ computed: {
29
+ classes() {
30
+ const classList = ["ib-progress-bar"];
31
+ classList.push(`progress-bar-${this.states}`);
32
+
33
+ return classList;
34
+ },
35
+ iconName() {
36
+ if (this.states === progressBarStates.SUCCESS) {
37
+ return "checkmark-circle";
38
+ }
39
+
40
+ if (
41
+ this.states === progressBarStates.FAILED ||
42
+ this.states === progressBarStates.CANCELED
43
+ ) {
44
+ return "close-circle";
45
+ }
46
+
47
+ return "";
48
+ },
49
+ },
50
+ components: {
51
+ IbIcon,
52
+ },
53
+ };
54
+ </script>
55
+
56
+ <style lang="scss" scoped>
57
+ @import "./progressBar.scss";
58
+ </style>
@@ -0,0 +1,6 @@
1
+ export const progressBarStates = {
2
+ PROGRESS: "progress",
3
+ SUCCESS: "success",
4
+ FAILED: "failed",
5
+ CANCELED: "canceled",
6
+ };
@@ -0,0 +1,116 @@
1
+ @import "../../assets/scss/variables/colors.scss";
2
+
3
+ $progress-bar-bg: $gray-300;
4
+ $progress-bar-gradient: linear-gradient(
5
+ 90deg,
6
+ rgba(255, 255, 255, 0) 0%,
7
+ rgba(255, 255, 255, 0.3) 35.73%,
8
+ rgba(255, 255, 255, 0.3) 64.37%,
9
+ rgba(255, 255, 255, 0) 100%
10
+ );
11
+ $progress-bar-progress-bg: $blue-800;
12
+ $progress-bar-success-bg: $green-800;
13
+ $progress-bar-failed-bg: $red-800;
14
+ $progress-bar-canceled-bg: $gray-500;
15
+
16
+ .ib-progress-bar-wrapper {
17
+ position: relative;
18
+
19
+ .ib-progress-bar {
20
+ position: relative;
21
+ width: 100%;
22
+ background: $progress-bar-bg;
23
+ border-radius: 4px;
24
+ height: 8px;
25
+ overflow: hidden;
26
+ display: flex;
27
+
28
+ @keyframes animation {
29
+ 0% {
30
+ left: -180px;
31
+ }
32
+ 100% {
33
+ left: 100%;
34
+ }
35
+ }
36
+
37
+ .gradient {
38
+ display: none;
39
+ width: 180px;
40
+ height: 8px;
41
+ background: $progress-bar-gradient;
42
+ position: absolute;
43
+ left: 0;
44
+ top: 0;
45
+ animation-name: animation;
46
+ animation-duration: 4s;
47
+ animation-delay: 1s;
48
+ animation-iteration-count: infinite;
49
+ }
50
+
51
+ & + .status-icon {
52
+ font-size: 20px;
53
+ position: absolute;
54
+ right: 0;
55
+ bottom: -35px;
56
+ }
57
+
58
+ .progress {
59
+ border-radius: inherit;
60
+ height: 100%;
61
+ max-width: 100%;
62
+ transition: width 0.4s, background-color 0.4s;
63
+
64
+ & + div {
65
+ width: auto;
66
+ flex: auto;
67
+ background: $progress-bar-bg;
68
+ position: relative;
69
+ z-index: 100;
70
+ }
71
+ }
72
+
73
+ &.progress-bar-progress {
74
+ .progress {
75
+ background-color: $progress-bar-progress-bg;
76
+ }
77
+
78
+ .gradient {
79
+ display: block;
80
+ }
81
+ }
82
+
83
+ &.progress-bar-success {
84
+ .progress {
85
+ background-color: $progress-bar-success-bg;
86
+ min-width: 100%;
87
+ }
88
+
89
+ & + .status-icon {
90
+ color: $progress-bar-success-bg;
91
+ }
92
+ }
93
+
94
+ &.progress-bar-failed {
95
+ .progress {
96
+ background-color: $progress-bar-failed-bg;
97
+ min-width: 100%;
98
+ }
99
+
100
+ & + .status-icon {
101
+ color: $progress-bar-failed-bg;
102
+ }
103
+ }
104
+
105
+ &.progress-bar-canceled {
106
+ .progress {
107
+ min-width: 100%;
108
+ background-color: $progress-bar-canceled-bg;
109
+ }
110
+
111
+ & + .status-icon {
112
+ color: $progress-bar-canceled-bg;
113
+ }
114
+ }
115
+ }
116
+ }
@@ -0,0 +1,67 @@
1
+ # IbProgressBar
2
+
3
+ import { Story, Canvas } from "@storybook/addon-docs";
4
+
5
+ A progress bar provides feedback about the duration and progression of a process, such as a download, file transfer, or installation, to indicate how long a user will be waiting.
6
+
7
+ ## Overview
8
+
9
+ A progress bar indicates that the user’s request has been received and the application is making progress toward completing the requested action. Progress bars inform users about the status of ongoing processes, the estimated time of how long a process will take, or if a request is being executed.
10
+
11
+ ### When to use
12
+
13
+ - For a long operation or a process that can take a considerable or unknown amount of time.
14
+ - When the process can be described with quantitative information, such as a percentage.
15
+ - To visually show the progression of a system operation such as downloading, uploading, loading data, submitting a form, or saving updates.
16
+ - To convey that data is being requested, transferred, or processed.
17
+
18
+ #### When not to use
19
+
20
+ - When the load time is expected to display expanded information, use skeleton states instead (in future updates).
21
+ - When manual user actions are required to progress, use a progress indicator instead (in future updates).
22
+ - When the progress is determined by user actions such as tutorials completed, or storage space, rather than system actions
23
+ - If the process takes less than 5 seconds to load, use loading instead (for future documentation).
24
+
25
+ ### Progress Overview
26
+
27
+ Determinate progress bars are used when the loading progress can be tracked and translated into a bar indicator which fills the track from 0% to 100% and never decreases in value or resets.
28
+ Use a determinate progress bar when the progress can be calculated against a specific goal.
29
+ It’s best to give the user transparency about the process which usually leads to increased trust in the software or platform.
30
+
31
+ <Canvas>
32
+ <Story id="progress-bar--default" />
33
+ </Canvas>
34
+
35
+ ### Props
36
+
37
+ | Name | type | Default Value | Description |
38
+ | -------- | ---------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
39
+ | states | String | progress | The states prop determines the state of the progress bar. It can be one of the following values: <ul><li>**progress:** Indicates that the progress bar is currently in progress.</li><li>**success:** Indicates that the progress bar has completed successfully.</li><li>**failed:** Indicates that the progress bar has failed to complete.</li><li>**canceled:** Indicates that the progress bar has been canceled.</li></ul> |
40
+ | progress | String or Number | false | The progress prop determines the current progress of the progress bar. It can be a value between 0 and 100, which represents the percentage of completion. |
41
+
42
+ when state is **success**, **failed** or **canceled** progress bar is full
43
+
44
+ ### Events
45
+
46
+ This component not suports events.
47
+
48
+ ### Slots
49
+
50
+ This component not suports slots.
51
+
52
+ ### States
53
+ There are four states for the progress bar: in progress, success, error, cancelled.
54
+ - **In Progress.** The active loading state, represented by an animated blue bar indicator, conveys that the action is still in progress.
55
+ - **Success.** The success loading state, conveyed by a full-width green progress bar and checkmark icon, indicates that the action completed successfully.
56
+ - **Error.** The error loading state indicates that the action did not successfully complete. If an error occurs, an inline notification or error handling within the form should appear. As soon as a process fails, the indicator bar’s progress spans full width, turns red, and remains visible. A failed icon is also shown.
57
+ - **Cancelled.** -
58
+ <Canvas>
59
+ <Story id="progress-bar--states" />
60
+ </Canvas>
61
+
62
+ ### Percent-done animation
63
+
64
+ Use for actions that take **10 seconds** or more.
65
+ Percent-done progress indicators are the most informative type of wait-animation feedback. They show the current progress, how much has already been accomplished, and how much is left. They convey important information about (approximately) how long the wait time is. This information gives users control (that is, they can decide whether to wait or not); it decreases uncertainty about the length of the process and may reduce the perceived wait time. Progress bars or circles that fill from 0-100% are examples of this type of feedback.
66
+
67
+ A percent-done indicator may be used for actions that take less than 10 seconds, if the action involves processing a series of documents or registries, because the user understands that the system is working with a set number of records.
@@ -0,0 +1,35 @@
1
+ import IbSorting from "./Sorting.vue";
2
+ import { typesSorting, typesSortingView } from "./constants.js";
3
+
4
+ export default {
5
+ title: "Sorting",
6
+ component: IbSorting,
7
+ argTypes: {
8
+ sort: {
9
+ control: { type: "select" },
10
+ options: Object.values(typesSorting),
11
+ },
12
+ viewSorting: {
13
+ control: { type: "select" },
14
+ options: Object.values(typesSortingView),
15
+ },
16
+ },
17
+ };
18
+
19
+ const Template = (args) => ({
20
+ components: { IbSorting },
21
+ setup() {
22
+ return { args };
23
+ },
24
+ template: `
25
+ <ib-sorting
26
+ v-bind="args"
27
+ />
28
+ `,
29
+ });
30
+
31
+ export const Default = Template.bind({});
32
+ Default.args = {
33
+ viewSorting: typesSortingView.TABLE_VIEW,
34
+ title: "sorting",
35
+ };
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <div class="sorting-wrapper">
3
+ <div
4
+ class="table-sorting-wrapper"
5
+ :class="{
6
+ active: currentTypeSort,
7
+ disabled: disableSorting,
8
+ }"
9
+ v-if="viewSorting === sortingTypesView.TABLE_VIEW"
10
+ >
11
+ <button class="sorting-label" type="button">
12
+ {{ title }}
13
+ <ib-tooltip v-if="tooltipTextSorting" :text="tooltipTextSorting">
14
+ </ib-tooltip>
15
+ </button>
16
+ <ib-icon-button kind="white" size="s" @click="clickHandler">
17
+ <ion-icon :name="iconType"></ion-icon>
18
+ <ib-tooltip v-if="tooltipIconSorting" :text="tooltipIconSorting">
19
+ </ib-tooltip>
20
+ </ib-icon-button>
21
+ </div>
22
+
23
+ <button
24
+ v-else
25
+ class="sorting-button"
26
+ type="button"
27
+ :aria-label="sort"
28
+ @click="clickHandler"
29
+ :class="{
30
+ active: currentTypeSort,
31
+ disabled: disableSorting,
32
+ }"
33
+ >
34
+ {{ title }}
35
+ <ib-icon
36
+ v-if="iconType"
37
+ :name="iconType"
38
+ :style="{
39
+ fontSize: iconSize + 'px',
40
+ }"
41
+ ></ib-icon>
42
+ <ib-tooltip v-if="tooltipTextSorting" :text="tooltipTextSorting">
43
+ </ib-tooltip>
44
+ </button>
45
+ </div>
46
+ </template>
47
+
48
+ <script>
49
+ import IbIcon from "../Icon.vue";
50
+ import IbIconButton from "../IconButton/IconButton.vue";
51
+ import IbTooltip from "../Tooltip/Tooltip.vue";
52
+ import { typesSorting, typesSortingView } from "./constants.js";
53
+
54
+ export default {
55
+ name: "IbSorting",
56
+ props: {
57
+ tooltipTextSorting: {
58
+ type: String,
59
+ },
60
+ tooltipIconSorting: {
61
+ type: String,
62
+ },
63
+ title: {
64
+ type: String,
65
+ default: "",
66
+ },
67
+ sort: {
68
+ type: String,
69
+ default: null,
70
+ },
71
+ viewSorting: {
72
+ type: String,
73
+ required: true,
74
+ },
75
+ disableSorting: {
76
+ type: Boolean,
77
+ default: false,
78
+ },
79
+ },
80
+ data() {
81
+ return {
82
+ sortingTypes: typesSorting,
83
+ sortingTypesView: typesSortingView,
84
+ currentTypeSort: this.sort,
85
+ };
86
+ },
87
+ watch: {
88
+ currentTypeSort: function () {
89
+ this.updateTypeSorting();
90
+ },
91
+ },
92
+ methods: {
93
+ clickHandler() {
94
+ if (!this.currentTypeSort) {
95
+ this.currentTypeSort = this.sortingTypes.TYPE_ASC;
96
+ return;
97
+ } else if (this.currentTypeSort === this.sortingTypes.TYPE_ASC) {
98
+ this.currentTypeSort = this.sortingTypes.TYPE_DESC;
99
+ return;
100
+ }
101
+ this.currentTypeSort = null;
102
+ },
103
+ updateTypeSorting() {
104
+ this.$emit("update-sorting", this.typeSort);
105
+ },
106
+ },
107
+ computed: {
108
+ iconType() {
109
+ if (this.currentTypeSort === this.sortingTypes.TYPE_ASC) {
110
+ return "arrow-up";
111
+ } else if (this.currentTypeSort === this.sortingTypes.TYPE_DESC) {
112
+ return "arrow-down";
113
+ } else if (this.viewSorting !== this.sortingTypesView.GRID_VIEW) {
114
+ return "swap-vertical";
115
+ }
116
+ return null;
117
+ },
118
+ },
119
+ components: {
120
+ IbIcon,
121
+ IbIconButton,
122
+ IbTooltip,
123
+ },
124
+ };
125
+ </script>
126
+ <style lang="scss" scoped>
127
+ @import "./sorting.scss";
128
+ </style>
@@ -0,0 +1,10 @@
1
+ export const typesSortingView = {
2
+ LIST_VIEW: "list-sorting",
3
+ GRID_VIEW: "grid-sorting",
4
+ TABLE_VIEW: "table-sorting",
5
+ };
6
+
7
+ export const typesSorting = {
8
+ TYPE_ASC: "asc",
9
+ TYPE_DESC: "desc",
10
+ };
@@ -0,0 +1,87 @@
1
+ @import "../../assets/scss/typography.scss";
2
+ @import "../../assets/scss/variables/colors.scss";
3
+ @import "../../assets/scss/reset.scss";
4
+ @import "../../assets/scss/mixins.scss";
5
+
6
+ button {
7
+ padding: 0;
8
+ margin: 0;
9
+ border: 0;
10
+ background-color: transparent;
11
+ }
12
+
13
+ .sorting-wrapper {
14
+
15
+ .table-sorting-wrapper{
16
+ display: flex;
17
+ align-items: center;
18
+
19
+ &.disabled {
20
+ pointer-events: none;
21
+ }
22
+
23
+ .sorting-label {
24
+ border: solid 2px transparent;
25
+ padding: 0 4px;
26
+ border-radius: 4px;
27
+ margin-right: 2px;
28
+ @include Ib-H4-regular;
29
+ color: $neutral-900;
30
+ height: 24px;
31
+ display: flex;
32
+ align-items: center;
33
+ transition: background-color .3s;
34
+ transition: color .3s;
35
+
36
+ &:hover {
37
+ color: $blue-700;
38
+ border-color: $blue-300;
39
+ cursor: pointer;
40
+ background-color: $blue-100;
41
+ }
42
+
43
+ &:active {
44
+ border-color: transparent;
45
+ color: $blue-900;
46
+ background-color: $blue-200;
47
+ transition: background-color .3s;
48
+ transition: color .3s;
49
+ }
50
+
51
+ &:focus {
52
+ z-index: 1;
53
+ @include focus(2px);
54
+ }
55
+ }
56
+ }
57
+
58
+ .sorting-button {
59
+ display: flex;
60
+ align-items: center;
61
+ @include Ib-H4-regular;
62
+ color: $neutral-900;
63
+ transition: color .3s;
64
+
65
+ ion-icon {
66
+ margin-left: 2px;
67
+ }
68
+
69
+ &.active {
70
+ color: $blue-900;
71
+ }
72
+
73
+ &:hover {
74
+ color: $blue-700;
75
+ transition: all .3s;
76
+ }
77
+
78
+ &.disabled {
79
+ pointer-events: none;
80
+ }
81
+
82
+ &:focus {
83
+ border-radius: 4px;
84
+ @include focus(2px);
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,39 @@
1
+ import IbSplitButton from "./SplitButton.vue";
2
+ import IbSplitButtonItem from "./SplitButtonItem.vue";
3
+ import { splitButtonKindOptions } from "./constants";
4
+ import readme from "./readme.mdx";
5
+
6
+ export default {
7
+ title: "SplitButton",
8
+ component: IbSplitButton,
9
+ argTypes: {
10
+ kind: {
11
+ control: { type: "select" },
12
+ options: Object.values(splitButtonKindOptions),
13
+ },
14
+ },
15
+ parameters: {
16
+ docs: {
17
+ page: readme,
18
+ },
19
+ },
20
+ };
21
+
22
+ const Template = (args) => ({
23
+ components: { IbSplitButton, IbSplitButtonItem },
24
+ setup() {
25
+ return { args };
26
+ },
27
+ template: `
28
+ <ib-split-button v-bind="args">
29
+ <ib-split-button-item>Button 1</ib-split-button-item>
30
+ <ib-split-button-item>Button 2</ib-split-button-item>
31
+ <ib-split-button-item>Button 3</ib-split-button-item>
32
+ <ib-split-button-item href="#">Link 4</ib-split-button-item>
33
+ </ib-split-button>`,
34
+ });
35
+
36
+ export const Default = Template.bind({});
37
+ Default.args = {
38
+ id: "test",
39
+ };