@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,284 @@
1
+ <template>
2
+ <div
3
+ class="flatpickr-wrapper"
4
+ :class="{
5
+ 'has-labels': label.length || endDateLabel.length,
6
+ 'has-label': label.length,
7
+ 'has-error': errorMessage.length,
8
+ 'is-range': mode === 'range',
9
+ }"
10
+ >
11
+ <ib-alert class="error-message" v-if="errorMessage.length">{{
12
+ errorMessage
13
+ }}</ib-alert>
14
+
15
+ <div class="inputs-wrapper">
16
+ <div class="input-group-wrapper">
17
+ <ib-label class="label" v-if="label.length" :required="required">
18
+ {{ label }}
19
+ </ib-label>
20
+ <div class="input-wrapper" @click="open" :class="{ active: isOpen }">
21
+ <input
22
+ :placeholder="placeholder"
23
+ ref="date"
24
+ class="date-picker-input"
25
+ />
26
+
27
+ <ib-icon name="today-outline" class="calendar-icon" />
28
+ </div>
29
+
30
+ <div ref="dropdown" class="dropdown"></div>
31
+
32
+ <p v-if="supportText.length" class="support-text">
33
+ {{ supportText }}
34
+ </p>
35
+ </div>
36
+
37
+ <div v-if="mode === 'range'" class="input-group-wrapper">
38
+ <ib-label
39
+ class="end-date-label label"
40
+ v-if="endDateLabel.length"
41
+ :required="required"
42
+ >{{ endDateLabel }}</ib-label
43
+ >
44
+ <div
45
+ class="input-wrapper"
46
+ @click="openEndDate"
47
+ :class="{ active: isOpenEndDate }"
48
+ >
49
+ <input
50
+ class="date-picker-input"
51
+ :placeholder="placeholder"
52
+ ref="toDate"
53
+ />
54
+
55
+ <ib-icon name="today-outline" class="calendar-icon" />
56
+ </div>
57
+
58
+ <p v-if="endDateSupportText.length" class="support-text">
59
+ {{ endDateSupportText }}
60
+ </p>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </template>
65
+
66
+ <script>
67
+ import Flatpickr from "flatpickr";
68
+
69
+ import IbIcon from "../../Icon.vue";
70
+ import IbLabel from "../Label/Label.vue";
71
+ import IbAlert from "../../Alert/Alert.vue";
72
+ import "flatpickr/dist/flatpickr.css";
73
+ import rangePlugin from "flatpickr/dist/plugins/rangePlugin";
74
+ import chevronBackIcon from "./Icons/chevron-back";
75
+ import chevronForwardIcon from "./Icons/chevron-forward";
76
+ import { ESC_KEY_CODE } from "../../../constants/keyCodes";
77
+
78
+ export const SINGLE_MODE = "single";
79
+ export const RANGE_MODE = "range";
80
+
81
+ export default {
82
+ props: {
83
+ name: {
84
+ type: String,
85
+ default: "Date",
86
+ },
87
+ modelValue: [String, Array],
88
+ value: [String, Array],
89
+ placeholder: {
90
+ type: String,
91
+ default: "",
92
+ },
93
+ required: {
94
+ type: Boolean,
95
+ default: false,
96
+ },
97
+ config: {
98
+ type: Object,
99
+ default: () => {},
100
+ },
101
+ mode: {
102
+ type: String,
103
+ default: SINGLE_MODE,
104
+ },
105
+ label: {
106
+ type: String,
107
+ default: "",
108
+ },
109
+ endDateLabel: {
110
+ type: String,
111
+ default: "",
112
+ },
113
+ supportText: {
114
+ type: String,
115
+ default: "",
116
+ },
117
+ endDateSupportText: {
118
+ type: String,
119
+ default: "",
120
+ },
121
+ errorMessage: {
122
+ type: String,
123
+ default: "",
124
+ },
125
+ },
126
+ mounted() {
127
+ document.addEventListener("keyup", this.onDocumentKeyDown, true);
128
+
129
+ this.$nextTick(() => {
130
+ this.initFlatpickr();
131
+ });
132
+ },
133
+ watch: {
134
+ config() {
135
+ this.initFlatpickr();
136
+ },
137
+ value() {
138
+ this.initFlatpickr();
139
+ },
140
+ modelValue() {
141
+ this.initFlatpickr();
142
+ },
143
+ },
144
+ data() {
145
+ return {
146
+ pickerOptions: {},
147
+ data: this.modelValue,
148
+ flat: null,
149
+ isOpen: false,
150
+ isOpenEndDate: false,
151
+ };
152
+ },
153
+ methods: {
154
+ initFlatpickr() {
155
+ this.flat = new Flatpickr(this.$refs.date, this.pickerConfigs());
156
+ },
157
+ pickerConfigs() {
158
+ const ignoredFocusElements = document.querySelectorAll(".calendar-icon");
159
+
160
+ let defaultConfig = {
161
+ dateFormat: "Y-m-d",
162
+ altInput: true,
163
+ altFormat: "Y-m-d",
164
+ position: "left",
165
+ mode: this.mode,
166
+ appendTo: this.$refs.dropdown,
167
+ prevArrow: chevronBackIcon,
168
+ nextArrow: chevronForwardIcon,
169
+ ignoredFocusElements: Array.from(ignoredFocusElements),
170
+ locale: {
171
+ weekdays: {
172
+ shorthand: ["S", "M", "T", "W", "T", "F", "S"],
173
+ longhand: [
174
+ "Sunday",
175
+ "Monday",
176
+ "Tuesday",
177
+ "Wednesday",
178
+ "Thursday",
179
+ "Friday",
180
+ "Saturday",
181
+ ],
182
+ },
183
+ },
184
+ onReady(dates, value, instance) {
185
+ instance.setDate(value, true);
186
+ },
187
+ onChange: (str, value) => this.onChange(value),
188
+ onClose: () => this.onClose(),
189
+ };
190
+
191
+ if (this.mode === RANGE_MODE) {
192
+ defaultConfig.plugins = [new rangePlugin({ input: this.$refs.toDate })];
193
+ }
194
+
195
+ if (this.value || this.modelValue) {
196
+ if (this.mode === RANGE_MODE) {
197
+ defaultConfig.defaultDate = this.modelValue.length
198
+ ? [this.modelValue[0], this.modelValue[1]]
199
+ : [this.value[0], this.value[1]];
200
+ } else {
201
+ defaultConfig.defaultDate = this.modelValue
202
+ ? this.modelValue
203
+ : this.value;
204
+ }
205
+ }
206
+
207
+ const config = Object.assign({}, defaultConfig, this.config);
208
+ this.pickerOptions = config;
209
+ return config;
210
+ },
211
+ onClose() {
212
+ this.triggerChange();
213
+ this.$nextTick(() => {
214
+ this.isOpen = false;
215
+ this.isOpenEndDate = false;
216
+ });
217
+ },
218
+ onChange(value) {
219
+ if (this.mode === RANGE_MODE) {
220
+ this.data = value.split(" to ");
221
+ } else {
222
+ this.data = value;
223
+ }
224
+ },
225
+ onDocumentKeyDown(e) {
226
+ if (e.keyCode === ESC_KEY_CODE) {
227
+ this.close();
228
+ }
229
+ },
230
+ triggerChange() {
231
+ setTimeout(() => {
232
+ if (this.pickerOptions.mode === "range") {
233
+ let values = this.data;
234
+
235
+ if (values.length < 2) {
236
+ this.$emit("input", "");
237
+ this.$emit("update:modelValue", this.data);
238
+ } else {
239
+ this.$emit("input", [values[0], values[1]]);
240
+ this.$emit("update:modelValue", this.data);
241
+ }
242
+ } else {
243
+ if (this.data === "") {
244
+ this.$emit("input", "");
245
+ this.$emit("update:modelValue", this.data);
246
+ } else {
247
+ this.$emit("input", this.data);
248
+ this.$emit("update:modelValue", this.data);
249
+ }
250
+ }
251
+ });
252
+ },
253
+ open() {
254
+ if (!this.isOpen) {
255
+ this.isOpen = true;
256
+ this.isOpenEndDate = false;
257
+ this.flat.open();
258
+ }
259
+ },
260
+ openEndDate() {
261
+ this.isOpen = false;
262
+ this.isOpenEndDate = true;
263
+ this.$refs.toDate.click();
264
+ },
265
+ },
266
+ computed: {
267
+ values() {
268
+ if (!this.data) return [];
269
+ return this.data?.split(" to ");
270
+ },
271
+ },
272
+ beforeUnmount() {
273
+ document.removeEventListener("keyup", this.onDocumentKeyDown);
274
+ },
275
+ components: {
276
+ IbIcon,
277
+ IbLabel,
278
+ IbAlert,
279
+ },
280
+ };
281
+ </script>
282
+ <style lang="scss">
283
+ @import "./DatePicker.scss";
284
+ </style>
@@ -0,0 +1,5 @@
1
+ export default `
2
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M10.25 3.5L5.75 8L10.25 12.5" stroke="#1A1A1A" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
+ </svg>
5
+ `;
@@ -0,0 +1,5 @@
1
+ export default `
2
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M5.75 3.5L10.25 8L5.75 12.5" stroke="#1A1A1A" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
+ </svg>
5
+ `;
@@ -0,0 +1,115 @@
1
+ # IbDatePicker
2
+
3
+ import { Story, Canvas } from "@storybook/addon-docs";
4
+
5
+ Date and time pickers allow users to select a single instance or range of dates and times.
6
+
7
+ ## Overview
8
+
9
+ Date pickers allow users to select past, present, or future dates. The type of date you are asking the user for will determine which date picker is best to use. The time picker helps users to select a specific time.
10
+
11
+ ### When to use
12
+
13
+ - When asking the user for an exact, approximate, or memorable date or time.
14
+ - For scheduling tasks.
15
+
16
+ ### DateControllers
17
+
18
+ - Date Input
19
+ - Date Select
20
+
21
+ ### Date format (Date Input)
22
+
23
+ - The date format can be displayed differently depending on your location. For example, some countries use month/day/year while other use day/month/year.
24
+ - Include the format as supporting text below the input field.
25
+ - When using calendar picker the date format will be automated if the user selects from the calendar menu.
26
+ - Only including the date format as placeholder text inside the field is problematic because it will disappear from view once the user begins typing.
27
+
28
+ ### Future update: Time format
29
+
30
+ (At the moment we do not have a new component for using time, it will be made in the future. If the development team needs this component, please contact the design team.)
31
+
32
+ - Both the 12-hour and 24-hour time systems are allowed.
33
+ - If using the 12-hour format it must be accompanied by an AM/PM selection.
34
+ - Use uppercase letters and no periods for the abbreviations AM and PM.
35
+ - Specific times should specify a timezone.
36
+
37
+ ### Internationalization
38
+
39
+ Internationalization, also referred to as globalization, refers to software adapting to different languages, regional peculiarities, and technical requirements of a target locale without additional code changes. This means that if the location is known, then formatting of a date or time can automatically change to the acceptable local format. You should always try to design for internationalization.
40
+
41
+ <Canvas>
42
+ <Story id="form-date-picker--default" />
43
+ </Canvas>
44
+
45
+ ### Props
46
+
47
+ | Prop name | Type | Default | Description |
48
+ | ------------------ | ------- | -------- | ----------------------------------------------------------------- |
49
+ | name | String | 'Date' | The name attribute for the input element. |
50
+ | modelValue | String | | Used to support v-model. |
51
+ | value | String | | The value of the input element. |
52
+ | placeholder | String | '' | The placeholder text for the input element. |
53
+ | required | Bollean | '' | Whether the input is required or not. |
54
+ | config | Object | {} | The configuration object for Flatpickr. |
55
+ | mode | String | 'single' | The mode of the date picker. Can be either 'single' or 'range'. |
56
+ | label | String | '' | The label for the input element. |
57
+ | endDateLabel | String | '' | The label for the second input element when in range mode. |
58
+ | supportText | String | '' | The support text for the input element. |
59
+ | endDateSupportText | String | '' | The support text for the second input element when in range mode. |
60
+ | errorMesage | String | '' | The error message to display. |
61
+
62
+ ### Slots
63
+
64
+ This component does not support any slots
65
+
66
+ ### Events
67
+
68
+ | Event name | Parameters | Description |
69
+ | ---------- | ---------- | ----------------------------------------- |
70
+ | input | String | Emitted when the user changes the input.. |
71
+
72
+ ## Simple date input
73
+
74
+ The simple date input provides the user with only a text field in which they can manually input a date. It allows dates to be entered without adding unnecessary interactions that come with the calendar menu or a dropdown.
75
+
76
+ The simple date input can include month/year or month/day/year. The formatting may be localized and rearranged in sequence of appearance.
77
+
78
+ <Canvas>
79
+ <Story id="form-date-picker--single-max" />
80
+ </Canvas>
81
+
82
+ #### When to use
83
+
84
+ **Use for memorable dates**
85
+
86
+ Simple date select are typically used when the date is known by the user, such as a date of birth or credit card expiration.
87
+
88
+ **Use for memorable dates**
89
+
90
+ Simple date select are best for when asking the user for an approximate date instead of an exact date, especially in regards to past dates. For example, when was asking a user when a purchase was made they will most likely easily recall the month and year (November 2019) versus the specific date (November 22, 2019).
91
+
92
+ **Entering a date**
93
+
94
+ A date can be selected by manually entering a date in the text input field.
95
+
96
+ **Example single date picker width error**
97
+
98
+ <Canvas>
99
+ <Story id="form-date-picker--single-with-error" />
100
+ </Canvas>
101
+
102
+ ## Range Input
103
+
104
+ Date range picker
105
+ The date range picker functions much like the single date picker but instead of choosing just one date the user can choose a start and end date. For each date in the range, users have the option to manually enter the date in a text field or select the date in the calendar. Each point requires a day, month, and year to be selected.
106
+
107
+ <Canvas>
108
+ <Story id="form-date-picker--range-max" />
109
+ </Canvas>
110
+
111
+ **Example range date picker width error**
112
+
113
+ <Canvas>
114
+ <Story id="form-date-picker--range-with-error" />
115
+ </Canvas>
@@ -0,0 +1,48 @@
1
+ import IbFormGroup from "./FormGroup.vue";
2
+ import IbInput from "../Input/Input.vue";
3
+ import IbLabel from "../Label/Label.vue";
4
+
5
+ export default {
6
+ title: "Form/Form Group",
7
+ component: IbFormGroup,
8
+ };
9
+
10
+ const Template = (args) => ({
11
+ components: { IbFormGroup, IbInput, IbLabel },
12
+ setup() {
13
+ return { args };
14
+ },
15
+ template: `
16
+ <ib-form-group v-bind="args">
17
+ <ib-label>Full Name</ib-label>
18
+ <ib-input disabled placeholder="Surname Name" />
19
+ </ib-form-group>
20
+ `,
21
+ });
22
+
23
+ export const Default = Template.bind({});
24
+
25
+ const TemplateMax = (args) => ({
26
+ components: { IbFormGroup, IbInput, IbLabel },
27
+ setup() {
28
+ return { args };
29
+ },
30
+ template: `
31
+ <ib-form-group
32
+ support-text="Supporting text"
33
+ v-bind="args"
34
+ >
35
+ <ib-label required info-text="Some information text">
36
+ Full Name
37
+ </ib-label>
38
+ <ib-input required placeholder="Surname Name" />
39
+ </ib-form-group>
40
+ `,
41
+ });
42
+
43
+ export const Max = TemplateMax.bind({});
44
+ Max.decorators = [
45
+ () => ({
46
+ template: '<div style="padding-top: 30px"><story /></div>',
47
+ }),
48
+ ];
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <div class="ib-form-group" :class="{ disable: disable }">
3
+ <slot></slot>
4
+ <p class="support-text" v-if="supportText.length">{{ supportText }}</p>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ export default {
10
+ name: "IbInputGroup",
11
+ props: {
12
+ supportText: {
13
+ type: String,
14
+ default: "",
15
+ },
16
+ disable: {
17
+ type: Boolean,
18
+ default: false,
19
+ },
20
+ },
21
+ };
22
+ </script>
23
+
24
+ <style lang="scss">
25
+ @import "../../../assets/scss/typography.scss";
26
+ @import "../../../assets/scss/variables/colors.scss";
27
+
28
+ .ib-form-group {
29
+ display: flex;
30
+ flex-direction: column;
31
+
32
+ .support-text {
33
+ @include Ib-H5-regular;
34
+ margin-top: 5px;
35
+ }
36
+
37
+ &.disable {
38
+ .support-text {
39
+ color: $neutral-500;
40
+ }
41
+
42
+ .ib-label {
43
+ color: $neutral-500;
44
+
45
+ .info-button {
46
+ background-color: transparent;
47
+ border-color: transparent;
48
+
49
+ .ib-icon {
50
+ color: $neutral-500;
51
+ }
52
+ &:hover {
53
+ .ib-icon {
54
+ color: $neutral-500;
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ </style>
@@ -0,0 +1,32 @@
1
+ import IbFormGroupSet from "./FormGroupSet.vue";
2
+ import IbFormGroup from "../FormGroup/FormGroup.vue";
3
+ import IbInput from "../Input/Input.vue";
4
+ import IbLabel from "../Label/Label.vue";
5
+
6
+ export default {
7
+ title: "Form/Form Group Set",
8
+ component: IbFormGroupSet,
9
+ };
10
+
11
+ const Template = (args) => ({
12
+ components: { IbFormGroupSet, IbFormGroup, IbInput, IbLabel },
13
+ setup() {
14
+ return { args };
15
+ },
16
+ template: `
17
+
18
+ <ib-form-group-set v-bind="args">
19
+ <ib-form-group>
20
+ <ib-label required>Password</ib-label>
21
+ <ib-input required type="password" placeholder="Password" />
22
+ </ib-form-group>
23
+ <ib-form-group>
24
+ <ib-label required>Confirm password</ib-label>
25
+ <ib-input required type="password" placeholder="Confirm password" />
26
+ </ib-form-group>
27
+ </ib-form-group-set>
28
+
29
+ `,
30
+ });
31
+
32
+ export const Default = Template.bind({});
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <div class="ib-form-group-set" :class="{ 'has-error': errorMessage.length }">
3
+ <ib-alert class="error-message" v-show="errorMessage.length">
4
+ {{ errorMessage }}
5
+ </ib-alert>
6
+
7
+ <div class="group-set-content">
8
+ <slot></slot>
9
+ </div>
10
+
11
+ <p class="support-text" v-if="supportText.length">
12
+ {{ supportText }}
13
+ </p>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ import IbAlert from "../../Alert/Alert.vue";
19
+
20
+ export default {
21
+ props: {
22
+ errorMessage: {
23
+ type: String,
24
+ default: "",
25
+ },
26
+ supportText: {
27
+ type: String,
28
+ default: "",
29
+ },
30
+ },
31
+ components: {
32
+ IbAlert,
33
+ },
34
+ };
35
+ </script>
36
+
37
+ <style lang="scss">
38
+ @import "../../../assets/scss/typography.scss";
39
+ .ib-form-group-set {
40
+ max-width: 476px;
41
+ width: fit-content;
42
+
43
+ .ib-label {
44
+ transition: margin 0.3s;
45
+ }
46
+
47
+ .group-set-content {
48
+ display: flex;
49
+ justify-content: space-between;
50
+ .ib-form-group {
51
+ width: calc(50% - 7.5px);
52
+ }
53
+ }
54
+
55
+ .support-text {
56
+ @include Ib-H5-regular;
57
+ margin-top: 5px;
58
+ }
59
+
60
+ &.has-error {
61
+ position: relative;
62
+ padding-top: 24px;
63
+
64
+ .error-message {
65
+ margin-bottom: 5px;
66
+ }
67
+
68
+ .ib-label {
69
+ position: absolute;
70
+ top: 0;
71
+ margin-bottom: 0px;
72
+ }
73
+ }
74
+ }
75
+ </style>