@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.
- package/.babelrc.json +14 -0
- package/.eslintrc.cjs +15 -0
- package/.nvmrc +1 -0
- package/.prettierrc.json +1 -0
- package/.storybook/intelliboardTheme.js +10 -0
- package/.storybook/main.js +25 -0
- package/.storybook/manager.js +7 -0
- package/.storybook/preview-head.html +11 -0
- package/.storybook/preview.js +24 -0
- package/.storybook/scss-loader.scss +6 -0
- package/.storybook/withSource.js +97 -0
- package/README.md +35 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.mjs +19366 -0
- package/dist/index.umd.js +209 -0
- package/dist/style.css +1 -0
- package/index.html +21 -0
- package/package.json +63 -0
- package/public/favicon.ico +0 -0
- package/src/App.vue +37 -0
- package/src/EventEmmiter.js +19 -0
- package/src/assets/scss/mixins/dropdown-list-item.scss +45 -0
- package/src/assets/scss/mixins/tooltip-position.scss +147 -0
- package/src/assets/scss/mixins.scss +21 -0
- package/src/assets/scss/reset.scss +12 -0
- package/src/assets/scss/style.scss +73 -0
- package/src/assets/scss/typography.scss +155 -0
- package/src/assets/scss/variables/colors.scss +115 -0
- package/src/assets/scss/variables/shadows.scss +17 -0
- package/src/components/Accordion/Accordion.scss +94 -0
- package/src/components/Accordion/Accordion.stories.js +41 -0
- package/src/components/Accordion/Accordion.vue +104 -0
- package/src/components/Accordion/readme.mdx +38 -0
- package/src/components/Alert/Alert.stories.js +69 -0
- package/src/components/Alert/Alert.vue +131 -0
- package/src/components/Alert/alert.scss +166 -0
- package/src/components/Alert/constants.js +6 -0
- package/src/components/Alert/readme.mdx +63 -0
- package/src/components/Badge/Badge.stories.js +53 -0
- package/src/components/Badge/Badge.vue +58 -0
- package/src/components/Badge/readme.mdx +38 -0
- package/src/components/Breadcrumbs/Breadcrumbs.vue +98 -0
- package/src/components/Breadcrumbs/breadcrumbs.scss +77 -0
- package/src/components/Breadcrumbs/breadcrumbs.stories.js +37 -0
- package/src/components/Button/Button.stories.js +124 -0
- package/src/components/Button/Button.vue +165 -0
- package/src/components/Button/button.scss +217 -0
- package/src/components/Button/constants.js +8 -0
- package/src/components/Button/readme.mdx +118 -0
- package/src/components/ButtonGroup/ButtonGroup.stories.js +27 -0
- package/src/components/ButtonGroup/ButtonGroup.vue +24 -0
- package/src/components/ButtonGroup/readme.mdx +10 -0
- package/src/components/Dropdown/Dropdown.spec.js +90 -0
- package/src/components/Dropdown/Dropdown.stories.js +48 -0
- package/src/components/Dropdown/Dropdown.vue +313 -0
- package/src/components/Dropdown/DropdownDivider.vue +15 -0
- package/src/components/Dropdown/DropdownItem.vue +59 -0
- package/src/components/Dropdown/DropdownList.stories.js +174 -0
- package/src/components/Dropdown/DropdownList.vue +93 -0
- package/src/components/Dropdown/constants.js +10 -0
- package/src/components/Dropdown/readme.mdx +88 -0
- package/src/components/Form/CharactersCount.vue +55 -0
- package/src/components/Form/Checkbox/Checkbox.scss +226 -0
- package/src/components/Form/Checkbox/Checkbox.stories.js +63 -0
- package/src/components/Form/Checkbox/Checkbox.vue +128 -0
- package/src/components/Form/Checkbox/readme.mdx +69 -0
- package/src/components/Form/CheckboxGroup/CheckboxGroup.stories.js +64 -0
- package/src/components/Form/CheckboxGroup/CheckboxGroup.vue +87 -0
- package/src/components/Form/CheckboxGroup/readme.mdx +56 -0
- package/src/components/Form/DatePicker/DatePicker.scss +479 -0
- package/src/components/Form/DatePicker/DatePicker.stories.js +78 -0
- package/src/components/Form/DatePicker/DatePicker.vue +284 -0
- package/src/components/Form/DatePicker/Icons/chevron-back.js +5 -0
- package/src/components/Form/DatePicker/Icons/chevron-forward.js +5 -0
- package/src/components/Form/DatePicker/readme.mdx +115 -0
- package/src/components/Form/FormGroup/FormGroup.stories.js +48 -0
- package/src/components/Form/FormGroup/FormGroup.vue +61 -0
- package/src/components/Form/FormGroup/FormGroupSet.stories.js +32 -0
- package/src/components/Form/FormGroup/FormGroupSet.vue +75 -0
- package/src/components/Form/Input/Input.stories.js +137 -0
- package/src/components/Form/Input/Input.vue +231 -0
- package/src/components/Form/Input/constants.js +5 -0
- package/src/components/Form/Input/input.scss +133 -0
- package/src/components/Form/Input/readme.mdx +68 -0
- package/src/components/Form/Label/Label.stories.js +29 -0
- package/src/components/Form/Label/Label.vue +87 -0
- package/src/components/Form/Label/readme.mdx +25 -0
- package/src/components/Form/PhoneInput/PhoneInput.stories.js +43 -0
- package/src/components/Form/PhoneInput/PhoneInput.vue +105 -0
- package/src/components/Form/PhoneInput/phoneInput.scss +197 -0
- package/src/components/Form/PhoneInput/readme.mdx +37 -0
- package/src/components/Form/Radio/Radio.stories.js +34 -0
- package/src/components/Form/Radio/Radio.vue +109 -0
- package/src/components/Form/Radio/radio.scss +187 -0
- package/src/components/Form/Radio/readme.mdx +48 -0
- package/src/components/Form/TextEditor/TextEditor.stories.js +58 -0
- package/src/components/Form/TextEditor/TextEditor.vue +305 -0
- package/src/components/Form/TextEditor/icons/svg/chevron-down.svg +3 -0
- package/src/components/Form/TextEditor/icons/toolbarIcons.js +111 -0
- package/src/components/Form/TextEditor/plugins/alphabetList.js +43 -0
- package/src/components/Form/TextEditor/readme.mdx +59 -0
- package/src/components/Form/TextEditor/textEditor.scss +684 -0
- package/src/components/Form/Textarea/Textarea.spec.js +107 -0
- package/src/components/Form/Textarea/Textarea.stories.js +68 -0
- package/src/components/Form/Textarea/Textarea.vue +102 -0
- package/src/components/Form/Textarea/readme.mdx +45 -0
- package/src/components/Form/Textarea/textarea.scss +84 -0
- package/src/components/Form/Toggle/Toggle.stories.js +44 -0
- package/src/components/Form/Toggle/Toggle.vue +122 -0
- package/src/components/Form/Toggle/readme.mdx +39 -0
- package/src/components/Form/Toggle/toggle.scss +166 -0
- package/src/components/Icon.vue +41 -0
- package/src/components/IconButton/IconButton.scss +91 -0
- package/src/components/IconButton/IconButton.stories.js +115 -0
- package/src/components/IconButton/IconButton.vue +100 -0
- package/src/components/IconButton/constants.js +14 -0
- package/src/components/IconButton/readme.mdx +66 -0
- package/src/components/List.vue +150 -0
- package/src/components/Modal/Modal.stories.js +48 -0
- package/src/components/Modal/Modal.vue +231 -0
- package/src/components/Modal/readme.mdx +76 -0
- package/src/components/Pagination/LimitSelector.vue +73 -0
- package/src/components/Pagination/Pagination.stories.js +54 -0
- package/src/components/Pagination/Pagination.vue +227 -0
- package/src/components/Pagination/pagination.scss +189 -0
- package/src/components/Popover/Popover.stories.js +46 -0
- package/src/components/Popover/Popover.vue +81 -0
- package/src/components/Popover/constants.js +14 -0
- package/src/components/Popover/popover.scss +26 -0
- package/src/components/Popover/readme.mdx +42 -0
- package/src/components/ProgressBar/ProgressBar.stories.js +90 -0
- package/src/components/ProgressBar/ProgressBar.vue +58 -0
- package/src/components/ProgressBar/constants.js +6 -0
- package/src/components/ProgressBar/progressBar.scss +116 -0
- package/src/components/ProgressBar/readme.mdx +67 -0
- package/src/components/Sorting/Sorting.stories.js +35 -0
- package/src/components/Sorting/Sorting.vue +128 -0
- package/src/components/Sorting/constants.js +10 -0
- package/src/components/Sorting/sorting.scss +87 -0
- package/src/components/SplitButton/SplitButton.stories.js +39 -0
- package/src/components/SplitButton/SplitButton.vue +132 -0
- package/src/components/SplitButton/SplitButtonItem.vue +34 -0
- package/src/components/SplitButton/constants.js +4 -0
- package/src/components/SplitButton/readme.mdx +77 -0
- package/src/components/SplitButton/splitButton.scss +161 -0
- package/src/components/StatusIndicator/StatusIndicator.stories.js +40 -0
- package/src/components/StatusIndicator/StatusIndicator.vue +52 -0
- package/src/components/StatusIndicator/constants.js +10 -0
- package/src/components/StatusIndicator/icons.js +48 -0
- package/src/components/StatusIndicator/readme.mdx +21 -0
- package/src/components/Table/Cells/Cell.vue +71 -0
- package/src/components/Table/Cells/CheckboxCell.vue +48 -0
- package/src/components/Table/Row.vue +26 -0
- package/src/components/Table/Table.stories.js +59 -0
- package/src/components/Table/Table.vue +36 -0
- package/src/components/Tabs/Tab.vue +37 -0
- package/src/components/Tabs/TabDropdown.vue +93 -0
- package/src/components/Tabs/Tabs.stories.js +57 -0
- package/src/components/Tabs/Tabs.vue +94 -0
- package/src/components/Tabs/tabs.scss +157 -0
- package/src/components/TagPill/TagPill.stories.js +30 -0
- package/src/components/TagPill/TagPill.vue +133 -0
- package/src/components/TagPill/constants.js +9 -0
- package/src/components/TagPill/readme.mdx +37 -0
- package/src/components/ToggleTip/ToggleTip.stories.js +98 -0
- package/src/components/ToggleTip/ToggleTip.vue +112 -0
- package/src/components/ToggleTip/constants.js +14 -0
- package/src/components/ToggleTip/readme.mdx +46 -0
- package/src/components/ToggleTip/toggleTip.scss +55 -0
- package/src/components/Tooltip/Tooltip.stories.js +56 -0
- package/src/components/Tooltip/Tooltip.vue +49 -0
- package/src/components/Tooltip/readme.mdx +43 -0
- package/src/components/TreeSelect/Option.vue +325 -0
- package/src/components/TreeSelect/Select.stories.js +349 -0
- package/src/components/TreeSelect/Select.vue +909 -0
- package/src/components/TreeSelect/TreeSelect.stories.js +270 -0
- package/src/components/TreeSelect/scss/option.scss +204 -0
- package/src/components/TreeSelect/scss/select.scss +166 -0
- package/src/constants/events.js +2 -0
- package/src/constants/keyCodes.js +8 -0
- package/src/directives/outside/outside.js +81 -0
- package/src/directives/outside/outside.stories.js +29 -0
- package/src/directives/outside/readme.mdx +24 -0
- package/src/helpers/generateUID.js +3 -0
- package/src/helpers/getHrefFromID.js +3 -0
- package/src/helpers/multiLineOverflows.js +3 -0
- package/src/helpers/removeEvents.js +9 -0
- package/src/index.js +49 -0
- package/src/main.js +12 -0
- package/src/stories/link.readme.mdx +57 -0
- package/src/stories/link.stories.js +59 -0
- package/static/Logo.svg +25 -0
- package/static/docks/button.pdf +147566 -0
- package/vite.config.js +47 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# IbLabel
|
|
2
|
+
|
|
3
|
+
import { Story, Canvas } from "@storybook/addon-docs";
|
|
4
|
+
|
|
5
|
+
This component styles the default `<label>` component
|
|
6
|
+
|
|
7
|
+
### Default
|
|
8
|
+
|
|
9
|
+
<Canvas>
|
|
10
|
+
<Story id="form-label--default" />
|
|
11
|
+
</Canvas>
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Props
|
|
15
|
+
|
|
16
|
+
| Name | type | Default Value | Description |
|
|
17
|
+
| -------- | ------- | ------------- | ------------------------------------------------------------------------------------------------------ |
|
|
18
|
+
| required | Boolean | false | If true, display a required indicator with a red asterisk. |
|
|
19
|
+
| infoText | String | '' | The text that will be displayed inside the tooltip when the information button is hover or have focus. |
|
|
20
|
+
|
|
21
|
+
### Events
|
|
22
|
+
This component does not emit any events.
|
|
23
|
+
|
|
24
|
+
### Slots
|
|
25
|
+
This component does not emit any events.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import IbPhoneInput from "./PhoneInput.vue";
|
|
2
|
+
import IbFormGroup from "../FormGroup/FormGroup.vue";
|
|
3
|
+
import IbLabel from "../Label/Label.vue";
|
|
4
|
+
import IbAlert from "../../Alert/Alert.vue";
|
|
5
|
+
import readme from "./readme.mdx";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Form/Phone Input",
|
|
9
|
+
component: IbPhoneInput,
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
page: readme,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const Template = (args) => ({
|
|
18
|
+
components: { IbPhoneInput },
|
|
19
|
+
setup() {
|
|
20
|
+
return { args };
|
|
21
|
+
},
|
|
22
|
+
template: '<ib-phone-input v-bind="args" />',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const Default = Template.bind({});
|
|
26
|
+
|
|
27
|
+
const TemplateWithError = (args) => ({
|
|
28
|
+
components: { IbFormGroup, IbPhoneInput, IbLabel, IbAlert },
|
|
29
|
+
setup() {
|
|
30
|
+
return { args };
|
|
31
|
+
},
|
|
32
|
+
template: `
|
|
33
|
+
<ib-form-group>
|
|
34
|
+
<ib-label required>Phone</ib-label>
|
|
35
|
+
<ib-phone-input v-bind="args" />
|
|
36
|
+
</ib-form-group>
|
|
37
|
+
`,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const Error = TemplateWithError.bind({});
|
|
41
|
+
Error.args = {
|
|
42
|
+
errorMessage: "Error message",
|
|
43
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ib-alert class="ib-phone-error-message" v-if="errorMessage.length">
|
|
3
|
+
{{ errorMessage }}
|
|
4
|
+
</ib-alert>
|
|
5
|
+
|
|
6
|
+
<vue-tel-input
|
|
7
|
+
v-outside="clickOutside"
|
|
8
|
+
v-model="phone"
|
|
9
|
+
v-bind="$attrs"
|
|
10
|
+
@country-changed="countryChanged"
|
|
11
|
+
:input-options="{ name: inputName, id: inputName }"
|
|
12
|
+
:auto-default-country="autoDefaultCountry"
|
|
13
|
+
:dropdown-options="{ showSearchBox: true, showFlags: true }"
|
|
14
|
+
:defaultCountry="defaultCountry"
|
|
15
|
+
:ignoredCountries="ignoredCountries"
|
|
16
|
+
:class="{ error: error || errorMessage.length }"
|
|
17
|
+
style-classes="ib-phone-input"
|
|
18
|
+
ref="vueTel"
|
|
19
|
+
>
|
|
20
|
+
<template #arrow-icon>
|
|
21
|
+
<ib-icon name="chevron-down-outline"></ib-icon>
|
|
22
|
+
</template>
|
|
23
|
+
</vue-tel-input>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import { VueTelInput } from "vue-tel-input";
|
|
28
|
+
import IbIcon from "../../Icon.vue";
|
|
29
|
+
import IbAlert from "../../Alert/Alert.vue";
|
|
30
|
+
import { OutsideDirective as Outside } from "../../../directives/outside/outside";
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
directives: { Outside },
|
|
34
|
+
props: {
|
|
35
|
+
inputName: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "phone",
|
|
38
|
+
},
|
|
39
|
+
autoDefaultCountry: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: true,
|
|
42
|
+
},
|
|
43
|
+
value: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "",
|
|
46
|
+
},
|
|
47
|
+
ignoredCountries: {
|
|
48
|
+
type: Array,
|
|
49
|
+
default: () => [],
|
|
50
|
+
},
|
|
51
|
+
error: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
55
|
+
errorMessage: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
components: {
|
|
61
|
+
VueTelInput,
|
|
62
|
+
IbAlert,
|
|
63
|
+
IbIcon,
|
|
64
|
+
},
|
|
65
|
+
data() {
|
|
66
|
+
return {
|
|
67
|
+
vueTel: null,
|
|
68
|
+
phone: "",
|
|
69
|
+
dialCode: "",
|
|
70
|
+
defaultCountry: "US",
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
mounted() {
|
|
74
|
+
this.vueTel = this.$refs.vueTel;
|
|
75
|
+
|
|
76
|
+
if (this.value) {
|
|
77
|
+
this.phone = this.value[0] === "+" ? this.value : "+" + this.value;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
methods: {
|
|
81
|
+
countryChanged(data) {
|
|
82
|
+
this.$globalEvents.$on("countrySelectValue", (value) => {
|
|
83
|
+
this.vueTel.choose(value);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
if (!this.phone || this.phone.length - 1 < this.dialCode.length) {
|
|
87
|
+
this.phone = "+" + data.dialCode;
|
|
88
|
+
} else if (this.dialCode) {
|
|
89
|
+
this.phone = this.phone.replace(this.dialCode, data.dialCode);
|
|
90
|
+
}
|
|
91
|
+
this.dialCode = data.dialCode;
|
|
92
|
+
},
|
|
93
|
+
clickOutside() {
|
|
94
|
+
if (this.vueTel.open) {
|
|
95
|
+
this.vueTel.clickedOutside();
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<style lang="scss">
|
|
103
|
+
@import "./phoneInput.scss";
|
|
104
|
+
</style>
|
|
105
|
+
<style src="vue-tel-input/vue-tel-input.css"></style>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
@import "../../../assets/scss/variables/colors.scss";
|
|
2
|
+
@import "../../../assets/scss/variables/shadows.scss";
|
|
3
|
+
@import "../../../assets/scss/typography.scss";
|
|
4
|
+
@import "../../../assets/scss/mixins.scss";
|
|
5
|
+
|
|
6
|
+
$input-bg: $gray-100;
|
|
7
|
+
$input-color: $neutral-900;
|
|
8
|
+
$input-placeholder-color: $neutral-600;
|
|
9
|
+
$input-hover-color: $neutral-900;
|
|
10
|
+
$input-hover-bg: $blue-200;
|
|
11
|
+
$input-hover-border-color: $blue-800;
|
|
12
|
+
$input-border-color: $gray-500;
|
|
13
|
+
$input-active-border: $blue-900;
|
|
14
|
+
$input-hover-error-color: $red-800;
|
|
15
|
+
|
|
16
|
+
$dropdown-bg: $gray-100;
|
|
17
|
+
$dropdown-hover-bg: $blue-100;
|
|
18
|
+
$dropdown-focus-bg: $blue-50;
|
|
19
|
+
$dropdown-active-bg: $blue-50;
|
|
20
|
+
$dropdown-active-icon-color: $blue-900;
|
|
21
|
+
|
|
22
|
+
$dropdown-item-color: $neutral-900;
|
|
23
|
+
$dropdown-item-hover-color: $gray-100;
|
|
24
|
+
$dropdown-item-selected-color: $gray-100;
|
|
25
|
+
$dropdown-item-selected-border-color: $blue-900;
|
|
26
|
+
|
|
27
|
+
.ib-phone-error-message {
|
|
28
|
+
margin-bottom: 5px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ib-phone-input.vue-tel-input {
|
|
32
|
+
position: relative;
|
|
33
|
+
border: none;
|
|
34
|
+
|
|
35
|
+
&:focus-within {
|
|
36
|
+
box-shadow: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.error {
|
|
40
|
+
.vti__input {
|
|
41
|
+
border-radius: 4px;
|
|
42
|
+
@include outline(-2px, $input-hover-error-color);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.vti__dropdown {
|
|
47
|
+
padding: 0;
|
|
48
|
+
border-radius: 4px 4px 0 0;
|
|
49
|
+
position: initial;
|
|
50
|
+
|
|
51
|
+
&:focus {
|
|
52
|
+
outline: none;
|
|
53
|
+
|
|
54
|
+
.vti__selection {
|
|
55
|
+
background-color: $dropdown-focus-bg;
|
|
56
|
+
@include outline();
|
|
57
|
+
border-radius: 4px;
|
|
58
|
+
border-color: transparent;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.ib-icon {
|
|
63
|
+
transition: transform 0.3s, color 0.3s;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:hover {
|
|
67
|
+
.vti__selection {
|
|
68
|
+
background-color: $dropdown-hover-bg;
|
|
69
|
+
border-color: $input-hover-border-color;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&.open {
|
|
74
|
+
.vti__selection {
|
|
75
|
+
background-color: $dropdown-active-bg;
|
|
76
|
+
border-bottom-color: $input-active-border;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.ib-icon {
|
|
80
|
+
color: $dropdown-active-icon-color;
|
|
81
|
+
transform: rotate(180deg);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.vti__selection {
|
|
86
|
+
height: 36px;
|
|
87
|
+
padding: 0 10px;
|
|
88
|
+
position: relative;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
border-radius: 4px 4px 0 0;
|
|
91
|
+
background-color: $dropdown-bg;
|
|
92
|
+
transition: border 0.3s, border-radius 0.3s, background-color 0.3s;
|
|
93
|
+
border-bottom: 1px solid $input-border-color;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.vti__flag {
|
|
97
|
+
margin-left: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.vti__input {
|
|
101
|
+
background-color: transparent;
|
|
102
|
+
width: 100%;
|
|
103
|
+
margin: 0;
|
|
104
|
+
margin-bottom: 6.5px;
|
|
105
|
+
border-left: 0px;
|
|
106
|
+
border-right: 0px;
|
|
107
|
+
border-top: 0px;
|
|
108
|
+
border-radius: 0;
|
|
109
|
+
|
|
110
|
+
&::placeholder {
|
|
111
|
+
@include Ib-H4-regular-italic;
|
|
112
|
+
color: $input-placeholder-color;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:focus {
|
|
116
|
+
border-radius: 0;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.vti__input {
|
|
122
|
+
@include Ib-H4-regular;
|
|
123
|
+
background-color: $input-bg;
|
|
124
|
+
padding: 0 15px;
|
|
125
|
+
border-radius: 4px 4px 0 0;
|
|
126
|
+
height: 36px;
|
|
127
|
+
margin-left: 2px;
|
|
128
|
+
color: $input-color;
|
|
129
|
+
transition: color 0.3s, border 0.3s, border-radius 0.3s, background-color 0.3s;
|
|
130
|
+
border-bottom: 1px solid $input-border-color;
|
|
131
|
+
|
|
132
|
+
&::placeholder {
|
|
133
|
+
@include Ib-H4-regular-italic;
|
|
134
|
+
color: $input-placeholder-color;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&:hover {
|
|
138
|
+
color: $input-hover-color;
|
|
139
|
+
background-color: $input-hover-bg;
|
|
140
|
+
border-color: $input-hover-border-color;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&:focus {
|
|
144
|
+
@include focus();
|
|
145
|
+
border-radius: 4px;
|
|
146
|
+
border-color: transparent;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.vti__dropdown-list {
|
|
151
|
+
width: 100%;
|
|
152
|
+
padding: 6.5px 0;
|
|
153
|
+
max-height: 373px;
|
|
154
|
+
|
|
155
|
+
&.below {
|
|
156
|
+
top: 41px;
|
|
157
|
+
border: none;
|
|
158
|
+
border-radius: 4px;
|
|
159
|
+
box-shadow: $ib-shadow-3;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.vti__dropdown-item {
|
|
163
|
+
padding: 0 15px 0 13px;
|
|
164
|
+
height: 36px;
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
border-left: 2px solid transparent;
|
|
168
|
+
|
|
169
|
+
.vti__flag {
|
|
170
|
+
margin-right: 15px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
strong,
|
|
174
|
+
span {
|
|
175
|
+
@include Ib-H4-regular;
|
|
176
|
+
color: $dropdown-item-color;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&:focus {
|
|
180
|
+
@include focus();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&.highlighted {
|
|
184
|
+
background-color: inherit;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&:hover {
|
|
188
|
+
background-color: $dropdown-item-hover-color;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&[aria-selected="true"] {
|
|
192
|
+
border-left-color: $dropdown-item-selected-border-color;
|
|
193
|
+
background-color: $dropdown-item-selected-color;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# IbPhoneInput
|
|
2
|
+
|
|
3
|
+
import { Story, Canvas } from "@storybook/addon-docs";
|
|
4
|
+
|
|
5
|
+
This component provides a phone input field with country code selection functionality. It utilizes the VueTelInput library for the phone input and allows users to select a country from a dropdown menu.
|
|
6
|
+
|
|
7
|
+
### Default
|
|
8
|
+
|
|
9
|
+
<Canvas>
|
|
10
|
+
<Story id="form-phone-input--default" />
|
|
11
|
+
</Canvas>
|
|
12
|
+
|
|
13
|
+
### Props
|
|
14
|
+
|
|
15
|
+
| Name | type | Default Value | Description |
|
|
16
|
+
| ------------------ | ------- | ------------- | ----------------------------------------------------- |
|
|
17
|
+
| inputName | String | "phone" | The name of the phone input field. |
|
|
18
|
+
| autoDefaultCountry | Boolean | true | To fetch default country based on IP address of user. |
|
|
19
|
+
| value | String | '' | The value of the phone input field. |
|
|
20
|
+
| ignoredCountries | Array | [] | List of countries will NOT be shown on the dropdown. |
|
|
21
|
+
| error | Boolean | false | Whether the input has an error. |
|
|
22
|
+
| errorMessage | string | '' | The error message to display. |
|
|
23
|
+
|
|
24
|
+
### Slots
|
|
25
|
+
|
|
26
|
+
This component has no slots.
|
|
27
|
+
|
|
28
|
+
### Events
|
|
29
|
+
This component has no default events but has global events `countrySelectValue` and return input values. Fires when country changed (even for the first time).
|
|
30
|
+
|
|
31
|
+
#
|
|
32
|
+
|
|
33
|
+
### Error state
|
|
34
|
+
|
|
35
|
+
<Canvas>
|
|
36
|
+
<Story id="form-phone-input--error" />
|
|
37
|
+
</Canvas>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import IbRadio from "./Radio.vue";
|
|
2
|
+
import readme from "./readme.mdx";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Form/Radio",
|
|
6
|
+
component: IbRadio,
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
page: readme,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Template = (args) => ({
|
|
15
|
+
components: { IbRadio },
|
|
16
|
+
setup() {
|
|
17
|
+
return { args };
|
|
18
|
+
},
|
|
19
|
+
template: `
|
|
20
|
+
<div>
|
|
21
|
+
<ib-radio value="a" label="Item 1" name="Checkbox" v-bind="args"/>
|
|
22
|
+
<ib-radio isChecked style="margin-left: 15px" value="b" label="Item 2" name="Checkbox" v-bind="args"/>
|
|
23
|
+
</div>
|
|
24
|
+
`,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const Default = Template.bind({});
|
|
28
|
+
Default.args = {};
|
|
29
|
+
Default.decorators = [
|
|
30
|
+
() => ({
|
|
31
|
+
template:
|
|
32
|
+
'<div style="display: flex; flex-direction: column;"><story/></div>',
|
|
33
|
+
}),
|
|
34
|
+
];
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label :class="classes" :for="id">
|
|
3
|
+
<input
|
|
4
|
+
type="radio"
|
|
5
|
+
:name="name"
|
|
6
|
+
:id="id"
|
|
7
|
+
:value="value"
|
|
8
|
+
:checked="checked"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
ref="radio"
|
|
11
|
+
@input.stop
|
|
12
|
+
@click="onClick"
|
|
13
|
+
@change="onChange"
|
|
14
|
+
/>
|
|
15
|
+
<span class="ib-radio-body" :class="{ 'without-text': !label?.length }">
|
|
16
|
+
<span class="ib-radio-input"></span>
|
|
17
|
+
<span class="ib-radio-label" v-if="label?.length">{{ label }}</span>
|
|
18
|
+
</span>
|
|
19
|
+
</label>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import generateUID from "../../../helpers/generateUID";
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
name: "IbRadio",
|
|
27
|
+
model: {
|
|
28
|
+
prop: "isChecked",
|
|
29
|
+
event: "input",
|
|
30
|
+
},
|
|
31
|
+
props: {
|
|
32
|
+
label: String,
|
|
33
|
+
error: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
name: {
|
|
38
|
+
type: String,
|
|
39
|
+
},
|
|
40
|
+
id: {
|
|
41
|
+
type: String,
|
|
42
|
+
default() {
|
|
43
|
+
return generateUID();
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
value: {
|
|
47
|
+
type: String,
|
|
48
|
+
required: true,
|
|
49
|
+
},
|
|
50
|
+
isChecked: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false,
|
|
53
|
+
},
|
|
54
|
+
disabled: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
watch: {
|
|
60
|
+
isChecked(value) {
|
|
61
|
+
this.checked = value;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
mounted() {
|
|
65
|
+
this.$globalEvents.$on("radio:update", (name) => {
|
|
66
|
+
if (name === this.name) {
|
|
67
|
+
this.checked = this.$refs.radio?.checked;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
data() {
|
|
72
|
+
return {
|
|
73
|
+
checked: this.isChecked,
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
methods: {
|
|
77
|
+
onClick() {
|
|
78
|
+
if (!this.disabled) {
|
|
79
|
+
this.checked = this.$refs.radio?.checked;
|
|
80
|
+
this.$emit("input", this.checked);
|
|
81
|
+
this.$emit("change", this.checked);
|
|
82
|
+
this.$globalEvents.$emit("radio:update", this.name);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
onChange() {
|
|
86
|
+
if (!this.disabled) {
|
|
87
|
+
this.checked = this.$refs.radio?.checked;
|
|
88
|
+
this.$emit("change", this.checked);
|
|
89
|
+
this.$emit("input", this.checked);
|
|
90
|
+
this.$globalEvents.$emit("radio:update", this.name);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
computed: {
|
|
95
|
+
classes() {
|
|
96
|
+
return {
|
|
97
|
+
"ib-radio": true,
|
|
98
|
+
"has-error": this.error,
|
|
99
|
+
"radio-filled": this.checked,
|
|
100
|
+
"radio-disabled": this.disabled,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<style scoped lang="scss">
|
|
108
|
+
@import "./radio.scss";
|
|
109
|
+
</style>
|