@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,88 @@
1
+ # IbDropdown
2
+
3
+ import { Story, Canvas } from "@storybook/addon-docs";
4
+
5
+ ### Default
6
+
7
+ <Canvas>
8
+ <Story id="dropdown--default" />
9
+ </Canvas>
10
+
11
+ ### Props
12
+
13
+ | Prop name | Type | Default | Description |
14
+ | ------------- | ------- | -------- | ----------------------------------------------------------------------------------- |
15
+ | vertical | String | 'bottom' | The vertical position of the dropdown. Can be either 'top' or 'bottom. |
16
+ | horizontal | String | 'left' | The horizontal position of the dropdown. Can be either 'left', 'right' or 'center'. |
17
+ | triggerClass | String | '' | Custom classes for the trigger element. |
18
+ | isOpened | Boolean | false | Whether the dropdown is initially open or closed. |
19
+ | showCloseIcon | Boolean | false | Whether to show the close icon on the dropdown. |
20
+ | closeOnClick | Boolean | false | Whether to close the dropdown on click inside the dropdown. |
21
+ | disabled | Boolean | false | Whether the dropdown is disabled. |
22
+ | triggerType | String | 'click' | The type of the trigger event. Can be either 'click' or 'hover'. |
23
+ | destroyOnHide | Boolean | false | Whether to destroy the dropdown content when the dropdown is hidden. |
24
+
25
+ ### Slots
26
+
27
+ | Slot name | Description |
28
+ | ---------- | ------------------------------------------------------------------------------------------------------------ |
29
+ | trigger | The content of the trigger element. |
30
+ | body | The content of the dropdown body. The slot scope has isOpenedState to know if the dropdown is opened or not. |
31
+ | close | The content of the close button, is show when a is true. |
32
+ | footerslot | The content that will be displayed as the footer of the dropdown. |
33
+ | before | The content that will be displayed before the dropdown. |
34
+
35
+ ### Events
36
+
37
+ | Event name | Parameters | Description |
38
+ | ---------- | ---------- | ------------------------------------ |
39
+ | open | | Emitted when the dropdown is opened. |
40
+ | close | | Emitted when the dropdown is closed. |
41
+
42
+ ### Global Events
43
+
44
+ | Event name | Parameters | Description |
45
+ | ------------- | ------------------------ | ------------------------------------ |
46
+ | dropdown:open | this (dropdown instanse) | Emitted when the dropdown is opened. |
47
+
48
+ # IbDropdownList
49
+
50
+ Dropdowns present a list of options from which a user can select one option, or several. A selected option can represent a value in a form, or can be used as an action to filter or sort existing content.
51
+
52
+ There are two different variants of drop-downs that support various kinds of functionality— Single-Select Drop-Down, Multi-Select.
53
+
54
+ ### When to use:
55
+
56
+ - Dropdowns can be used in forms on full pages, in modals, or on side panels. The dropdown component is used to filter or sort contents on a page. It is a stylized version of the select component, and can be styled as needed.
57
+
58
+ ### When not to use:
59
+
60
+ - It is best practice not to use a dropdown if there are two options to choose from. In this case, use a radio button group instead.
61
+ Do not nest dropdowns or use them to display overly complex information. Keep option selections as straight forward as possible.
62
+
63
+ <Canvas>
64
+ <Story id="dropdown--dropdown-list" />
65
+ </Canvas>
66
+
67
+ ### Props
68
+
69
+ | Prop name | Type | Default | Description |
70
+ | ------------- | ------- | -------- | ----------------------------------------------------------------------------------- |
71
+ | vertical | String | 'bottom' | The vertical position of the dropdown. Can be either 'top' or 'bottom. |
72
+ | horizontal | String | 'left' | The horizontal position of the dropdown. Can be either 'left', 'right' or 'center'. |
73
+ | isOpened | Boolean | false | Whether the dropdown is initially open or closed. |
74
+ | disabled | Boolean | false | Whether the dropdown is disabled. |
75
+ | closeOnClick | Boolean | false | Whether to close the dropdown on click inside the dropdown. |
76
+
77
+
78
+ ### Events
79
+ This component duplicate all dropdown events
80
+
81
+ ### Slots
82
+
83
+ | Slot name | Description |
84
+ | ---------- | ------------------------------------------------------------------------------------------------------------ |
85
+ | trigger | The content of the trigger element. |
86
+ | body | The content of the dropdown body. The slot scope has isOpenedState to know if the dropdown is opened or not. |
87
+
88
+ TODO: Add docs for diveder and dropdown-item.
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <div class="character-count">
3
+ <template v-if="!characterLength">
4
+ <p class="val-limit">Max {{ characterLimit }}</p>
5
+ </template>
6
+ <template v-else-if="characterLimit > characterLength">
7
+ <p class="val-length">{{ characterLimit - characterLength }}</p>
8
+ /
9
+ <p class="val-limit">{{ characterLimit }}</p>
10
+ </template>
11
+ <template v-else-if="characterLimit === characterLength">0</template>
12
+
13
+ <template v-else>
14
+ <p class="val-length val-limited">
15
+ {{ characterLimit - characterLength }}
16
+ </p>
17
+ </template>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ export default {
23
+ props: {
24
+ characterLimit: {
25
+ type: [String, Number],
26
+ required: true,
27
+ },
28
+ characterLength: {
29
+ type: [String, Number],
30
+ required: true,
31
+ },
32
+ },
33
+ };
34
+ </script>
35
+
36
+ <style lang="scss" scoped>
37
+ @import "../../assets/scss/variables/colors.scss";
38
+ @import "../../assets/scss/typography.scss";
39
+
40
+ $textarea-character-count-color: $gray-600;
41
+ $textarea-character-count-limited-color: $red-900;
42
+
43
+ .character-count {
44
+ display: flex;
45
+ color: $textarea-character-count-color;
46
+
47
+ p {
48
+ @include Ib-H4-medium;
49
+
50
+ &.val-limited {
51
+ color: $textarea-character-count-limited-color;
52
+ }
53
+ }
54
+ }
55
+ </style>
@@ -0,0 +1,226 @@
1
+ @import "../../../assets/scss/variables/colors.scss";
2
+ @import "../../../assets/scss/typography.scss";
3
+ @import "../../../assets/scss/mixins.scss";
4
+
5
+ $checkbox-bg-disabled: $gray-100;
6
+ $checkbox-border-disabled: $neutral-500;
7
+ $checkbox-border: $gray-500;
8
+ $checkbox-bg: transparent;
9
+ $checkbox-checkmark: $neutral-900;
10
+ $checkbox-border-hover: $blue-300;
11
+ $checkbox-bg-hover: $blue-100;
12
+ $checkbox-border-active: transparent;
13
+ $checkbox-bg-active: $blue-300;
14
+ $checkbox-text-color-disabled: $neutral-500;
15
+ $checkbox-bg-error: transparent;
16
+ $checkbox-border-error: $red-800;
17
+ $checkbox-bg-error-hover: $red-50;
18
+ $checkbox-border-error-hover: $red-700;
19
+ $checkbox-bg-error-active: $blue-300;
20
+ $checkbox-border-error-active: $blue-300;
21
+ $checkbox-bg-filed: $blue-800;
22
+ $checkbox-border-filed: $blue-800;
23
+ $checkbox-bg-filed-hover: $blue-700;
24
+ $checkbox-border-filed-hover: $blue-700;
25
+ $checkbox-bg-filed-active: $blue-900;
26
+ $checkbox-border-filed-active: $blue-900;
27
+ $checkbox-bg-filed-disabled: $neutral-500;
28
+ $checkbox-border-filed-disabled: $neutral-500;
29
+ $checkbox-border-indeterminate: $blue-800;
30
+ $checkbox-bg-indeterminate: $blue-800;
31
+
32
+ .ib-checkbox {
33
+ outline: none;
34
+
35
+ &:focus {
36
+ .ib-checkbox-body {
37
+ border-radius: 4px;
38
+ @include outline(2px);
39
+ }
40
+ }
41
+
42
+ .ib-checkbox-body {
43
+ display: inline-flex;
44
+ align-items: center;
45
+ cursor: pointer;
46
+ }
47
+
48
+ /* Hide default HTML checkbox */
49
+ input {
50
+ display: none;
51
+ }
52
+
53
+ &-label {
54
+ @include Ib-H4-regular;
55
+ margin-left: 15px;
56
+
57
+ span.required {
58
+ color: $red-800;
59
+ }
60
+
61
+ &.ib-checkbox-label-left {
62
+ margin-left: 0;
63
+ margin-right: 13px;
64
+ }
65
+ }
66
+
67
+ &-input {
68
+ border-radius: 2px;
69
+ height: 16px;
70
+ width: 16px;
71
+ border: 1.25px solid;
72
+ border-color: $checkbox-border;
73
+ background-color: $checkbox-bg;
74
+ color: $checkbox-checkmark;
75
+ transition: border 0.3s, background-color 0.3s, border 0.3s;
76
+ position: relative;
77
+
78
+ ion-icon {
79
+ position: absolute;
80
+ top: 50%;
81
+ left: 50%;
82
+ transform: translate(-50%, -50%);
83
+ font-size: 12px;
84
+ }
85
+ }
86
+
87
+ .ib-checkbox-body {
88
+ &:hover {
89
+ .ib-checkbox-input {
90
+ border-width: 2px;
91
+ border-color: $checkbox-border-hover;
92
+ background-color: $checkbox-bg-hover;
93
+ }
94
+ }
95
+
96
+ &:active {
97
+ .ib-checkbox-input {
98
+ border-color: $checkbox-border-active;
99
+ background-color: $checkbox-bg-active;
100
+ }
101
+ }
102
+ }
103
+
104
+ &.ib-checkbox-disabled {
105
+ cursor: not-allowed;
106
+
107
+ .ib-checkbox-input {
108
+ background-color: $checkbox-bg-disabled;
109
+ border-color: $checkbox-border-disabled;
110
+ }
111
+
112
+ &:focus {
113
+ .ib-checkbox-body {
114
+ outline: none!important;
115
+ }
116
+ }
117
+
118
+ .ib-checkbox-body {
119
+ cursor: default;
120
+
121
+ &:hover {
122
+ .ib-checkbox-input {
123
+ border-width: 1.25px;
124
+ background-color: $checkbox-bg-disabled;
125
+ border-color: $checkbox-border-disabled;
126
+ }
127
+ }
128
+
129
+ &:active {
130
+ .ib-checkbox-input {
131
+ background-color: $checkbox-bg-disabled;
132
+ border-color: $checkbox-border-disabled;
133
+ }
134
+ }
135
+ }
136
+
137
+ .ib-checkbox-label {
138
+ color: $checkbox-text-color-disabled;
139
+ }
140
+ }
141
+
142
+ &.ib-has-error {
143
+ .ib-checkbox-input {
144
+ border-width: 2px;
145
+ background-color: $checkbox-bg-error;
146
+ border-color: $checkbox-border-error;
147
+ }
148
+
149
+ .ib-checkbox-body {
150
+ &:hover {
151
+ .ib-checkbox-input {
152
+ border-color: $checkbox-border-error-hover;
153
+ background-color: $checkbox-bg-error-hover;
154
+ }
155
+ }
156
+
157
+ &:active {
158
+ .ib-checkbox-input {
159
+ border-color: $checkbox-border-error-active;
160
+ background-color: $checkbox-bg-error-active;
161
+ }
162
+ }
163
+ }
164
+ }
165
+
166
+ &.ib-checkbox-filled {
167
+ .ib-checkbox-input {
168
+ border-color: $checkbox-border-filed;
169
+ background-color: $checkbox-bg-filed;
170
+
171
+ ion-icon {
172
+ color: $white;
173
+ }
174
+ }
175
+
176
+ .ib-checkbox-body {
177
+ &:hover {
178
+ .ib-checkbox-input {
179
+ border-color: $checkbox-border-filed-hover;
180
+ background-color: $checkbox-bg-filed-hover;
181
+ }
182
+ }
183
+
184
+ &:active {
185
+ .ib-checkbox-input {
186
+ border-color: $checkbox-border-filed-active;
187
+ background-color: $checkbox-bg-filed-active;
188
+ }
189
+ }
190
+ }
191
+
192
+ &.checkbox-disabled {
193
+ .checkbox-input {
194
+ background-color: $checkbox-bg-filed-disabled;
195
+ border-color: $checkbox-border-filed-disabled;
196
+ }
197
+ }
198
+ }
199
+
200
+ &.ib-checkbox-indeterminate {
201
+ .ib-checkbox-input {
202
+ border-color: $checkbox-border-indeterminate;
203
+ background-color: $checkbox-bg-indeterminate;
204
+
205
+ ion-icon {
206
+ color: $white;
207
+ }
208
+ }
209
+
210
+ .ib-checkbox-body {
211
+ &:hover {
212
+ .ib-checkbox-input {
213
+ border-color: $checkbox-border-filed-hover;
214
+ background-color: $checkbox-bg-filed-hover;
215
+ }
216
+ }
217
+
218
+ &:active {
219
+ .ib-checkbox-input {
220
+ border-color: $checkbox-border-filed-active;
221
+ background-color: $checkbox-bg-filed-active;
222
+ }
223
+ }
224
+ }
225
+ }
226
+ }
@@ -0,0 +1,63 @@
1
+ import IbCheckbox from "./Checkbox.vue";
2
+ import readme from "./readme.mdx";
3
+
4
+ export default {
5
+ title: "Form/Checkbox",
6
+ component: IbCheckbox,
7
+ argTypes: {
8
+ onInput: {},
9
+ labelPosition: {
10
+ control: { type: "select" },
11
+ options: ["right", "left"],
12
+ },
13
+ },
14
+ parameters: {
15
+ docs: {
16
+ page: readme,
17
+ },
18
+ },
19
+ };
20
+
21
+ const Template = (args) => ({
22
+ components: { IbCheckbox },
23
+ setup() {
24
+ return { args };
25
+ },
26
+ template: '<ib-checkbox v-bind="args" />',
27
+ });
28
+
29
+ export const Default = Template.bind({});
30
+ Default.args = {
31
+ label: "Default",
32
+ };
33
+
34
+ const IndeterminateTemplate = (args) => ({
35
+ components: { IbCheckbox },
36
+ setup() {
37
+ return { args };
38
+ },
39
+ template: '<ib-checkbox :is-checked="null" label="Indeterminate" />',
40
+ });
41
+
42
+ export const Indeterminate = IndeterminateTemplate.bind({});
43
+ Indeterminate.args = {};
44
+
45
+ Indeterminate.parameters = {
46
+ docs: {
47
+ description: {
48
+ story:
49
+ "To get **Indeterminate** state need set `isChecked` props to `null`",
50
+ },
51
+ },
52
+ };
53
+
54
+ const ErrorTemplate = (args) => ({
55
+ components: { IbCheckbox },
56
+ setup() {
57
+ return { args };
58
+ },
59
+ template: '<ib-checkbox :error="true" label="Remember me" />',
60
+ });
61
+
62
+ export const Error = ErrorTemplate.bind({});
63
+ Indeterminate.args = {};
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <label
3
+ :class="classes"
4
+ :for="id"
5
+ :tabindex="disabled ? -1 : 0"
6
+ @keypress.prevent="onChange"
7
+ >
8
+ <input
9
+ tabindex="-1"
10
+ type="checkbox"
11
+ :name="name"
12
+ :id="id"
13
+ :value="value"
14
+ :checked="checked"
15
+ :disabled="disabled"
16
+ :required="required"
17
+ @click="onChange"
18
+ />
19
+ <div class="ib-checkbox-body">
20
+ <span
21
+ v-if="labelPosition === 'left' && label.length"
22
+ class="ib-checkbox-label"
23
+ :class="{ 'ib-checkbox-label-left': labelPosition === 'left' }"
24
+ >
25
+ <span v-if="required" class="required">*</span>
26
+ {{ label }}
27
+ </span>
28
+
29
+ <span class="ib-checkbox-input">
30
+ <ib-icon name="checkmark-sharp" v-show="checked && !indeterminate" />
31
+ <ib-icon
32
+ :class="'checkbox-undeterminate-icon'"
33
+ name="remove-sharp"
34
+ v-show="indeterminate"
35
+ />
36
+ </span>
37
+
38
+ <span
39
+ v-if="labelPosition === 'right' && label?.length"
40
+ class="ib-checkbox-label"
41
+ >
42
+ <span v-if="required" class="required">*</span>
43
+ {{ label }}
44
+ </span>
45
+ </div>
46
+ </label>
47
+ </template>
48
+ <script>
49
+ import generateUID from "../../../helpers/generateUID";
50
+ import IbIcon from "../../Icon.vue";
51
+
52
+ export default {
53
+ name: "IbCheckbox",
54
+ model: {
55
+ event: "input",
56
+ },
57
+ props: {
58
+ label: String,
59
+ error: {
60
+ type: [Boolean, null],
61
+ default: false,
62
+ },
63
+ name: String,
64
+ id: {
65
+ type: String,
66
+ default() {
67
+ return generateUID();
68
+ },
69
+ },
70
+ value: {
71
+ default: 1,
72
+ },
73
+ isChecked: {
74
+ type: Boolean,
75
+ default: false,
76
+ },
77
+ disabled: {
78
+ type: Boolean,
79
+ default: false,
80
+ },
81
+ required: {
82
+ type: Boolean,
83
+ default: false,
84
+ },
85
+ labelPosition: {
86
+ type: String,
87
+ default: "right",
88
+ },
89
+ },
90
+ watch: {
91
+ isChecked(value) {
92
+ this.checked = value;
93
+ },
94
+ },
95
+ data() {
96
+ return {
97
+ checked: this.isChecked,
98
+ };
99
+ },
100
+ methods: {
101
+ onChange() {
102
+ this.checked = !this.checked;
103
+ this.$emit("input", this.checked);
104
+ },
105
+ },
106
+ computed: {
107
+ classes() {
108
+ return {
109
+ "ib-checkbox": true,
110
+ "ib-has-error": this.error,
111
+ "ib-checkbox-filled": this.checked,
112
+ "ib-checkbox-disabled": this.disabled,
113
+ "ib-checkbox-indeterminate": this.indeterminate,
114
+ };
115
+ },
116
+ indeterminate() {
117
+ return this.isChecked === null;
118
+ },
119
+ },
120
+ components: {
121
+ IbIcon,
122
+ },
123
+ };
124
+ </script>
125
+
126
+ <style lang="scss">
127
+ @import "./Checkbox.scss";
128
+ </style>
@@ -0,0 +1,69 @@
1
+ # IbCheckbox
2
+
3
+ import { Story, Canvas } from "@storybook/addon-docs";
4
+
5
+ Checkboxes are used when there are multiple items to select in a list. Users can select zero, one, or any number of items.
6
+
7
+ ## Overview
8
+
9
+ Checkboxes are used for multiple choices, not for mutually exclusive choices. Each checkbox works independently from other checkboxes in the list, therefore checking an additional box does not affect any other selections.
10
+
11
+ ### Form
12
+
13
+ Can be used in forms on a full page, in modals, or on side panels.
14
+
15
+ ### Filtering and batch action
16
+
17
+ Used to filter data either on a page, in a menu, or within a component. Checkboxes are found in Data table for batch editing purposes.
18
+
19
+ ### Terms and conditions
20
+
21
+ Turning the checkbox input on or off can indicate whether you agree to the terms.
22
+
23
+ ### Lists with sub-selections
24
+
25
+ Used when there is a parent and child relationship. You can use a parent checkbox to make a bulk selection of all list items. Unchecking the parent deselects all of the list items. Alternatively, you can select children individually when the parent is not selected, which is where the indeterminate state comes in to play.
26
+
27
+ ### Default
28
+
29
+ <Canvas>
30
+ <Story id="form-checkbox--default" />
31
+ </Canvas>
32
+
33
+ ### Props
34
+
35
+ | Prop name | Type | Default | Description |
36
+ | ------------- | ------- | ------------------------ | ----------------------------------------------------------------------------------------- |
37
+ | label | String | '' | The text to display as the label for the checkbox. |
38
+ | error | Boolean | false | Indicates if the checkbox has an error state. |
39
+ | name | String | undefined | The name attribute of the input element. |
40
+ | id | String | auto-generated unique ID | The ID attribute of the input element. |
41
+ | value | any | 1 | The value attribute of the input element. |
42
+ | isChecked | Boolean | false | The initial checked state of the checkbox. |
43
+ | disabled | Boolean | false | Indicates if the checkbox is disabled |
44
+ | required | Boolean | false | Indicates if the checkbox is required. |
45
+ | labelPosition | String | 'right' | The position of the label relative to the checkbox. Possible values are "left" or "right" |
46
+
47
+ ### Slots
48
+
49
+ The component has no named slots, but you can place any content inside the component, and it will be displayed before or after the checkbox and the label, depending on the value of the labelPosition prop.
50
+
51
+ ### Events
52
+
53
+ | Event name | Parameters | Description |
54
+ | ---------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
55
+ | input | Boolean | The event emitted when the checkbox is changes, and the checked state changes. The event is emitted with the new value of the checked property. |
56
+
57
+ ### Indeterminate
58
+
59
+ To get the indeterminate state, need isChecked prop set to null. The indeterminate state is visually represented by a horizontal line inside the checkbox.
60
+
61
+ <Canvas>
62
+ <Story id="form-checkbox--indeterminate" />
63
+ </Canvas>
64
+
65
+ ### Error state
66
+
67
+ <Canvas>
68
+ <Story id="form-checkbox--error" />
69
+ </Canvas>
@@ -0,0 +1,64 @@
1
+ import IbCheckboxGroup from "./CheckboxGroup.vue";
2
+ import IbCheckbox from "../Checkbox/Checkbox.vue";
3
+ import IbRadio from "../Radio/Radio.vue";
4
+ import readme from "./readme.mdx";
5
+
6
+ export default {
7
+ title: "Form/Checkbox group",
8
+ component: IbCheckboxGroup,
9
+ parameters: {
10
+ docs: {
11
+ page: readme,
12
+ },
13
+ },
14
+ };
15
+
16
+ const TemplateCheckbox = (args) => ({
17
+ components: { IbCheckboxGroup, IbCheckbox },
18
+ setup() {
19
+ return { args };
20
+ },
21
+ template: `
22
+ <ib-checkbox-group v-bind="args">
23
+ <ib-checkbox label="Item 1"/>
24
+ <ib-checkbox label="Item 2"/>
25
+ <ib-checkbox label="Item 3"/>
26
+ </ib-checkbox-group>
27
+ `,
28
+ });
29
+
30
+ export const Default = TemplateCheckbox.bind({});
31
+ Default.args = {
32
+ labelText: "Group Label:",
33
+ };
34
+
35
+ export const HorizontalAlignment = TemplateCheckbox.bind({});
36
+ Default.args = {
37
+ labelText: "Group Label:",
38
+ };
39
+
40
+ export const CheckboxGroupError = TemplateCheckbox.bind({});
41
+ CheckboxGroupError.args = {
42
+ labelText: "Group Label:",
43
+ required: true,
44
+ errorMessage: "This checkbox is required",
45
+ };
46
+
47
+ const TemplateRadio = (args) => ({
48
+ components: { IbCheckboxGroup, IbRadio },
49
+ setup() {
50
+ return { args };
51
+ },
52
+ template: `
53
+ <ib-checkbox-group v-bind="args">
54
+ <ib-radio isChecked name="checkbox" label="Item 1"/>
55
+ <ib-radio name="checkbox" label="Item 2"/>
56
+ <ib-radio name="checkbox" label="Item 3"/>
57
+ </ib-checkbox-group>
58
+ `,
59
+ });
60
+
61
+ export const RadioGroup = TemplateRadio.bind({});
62
+ RadioGroup.args = {
63
+ labelText: "Group Label:",
64
+ };