@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,137 @@
|
|
|
1
|
+
import IbInput from "../Input/Input.vue";
|
|
2
|
+
import IbCheckbox from "../Checkbox/Checkbox.vue";
|
|
3
|
+
import IbCheckboxGroup from "../CheckboxGroup/CheckboxGroup.vue";
|
|
4
|
+
import { inputTypeOptions } from "./constants";
|
|
5
|
+
import { horizontalPosition, verticalPosition } from "../../Dropdown/constants";
|
|
6
|
+
import readme from "./readme.mdx";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Form/Input",
|
|
10
|
+
component: IbInput,
|
|
11
|
+
argTypes: {
|
|
12
|
+
onBlur: {},
|
|
13
|
+
onInput: {},
|
|
14
|
+
type: {
|
|
15
|
+
control: { type: "select" },
|
|
16
|
+
options: Object.values(inputTypeOptions),
|
|
17
|
+
},
|
|
18
|
+
settingsVerticalPosition: {
|
|
19
|
+
control: { type: "select" },
|
|
20
|
+
options: Object.values(verticalPosition),
|
|
21
|
+
},
|
|
22
|
+
settingsHorizontalPosition: {
|
|
23
|
+
control: { type: "select" },
|
|
24
|
+
options: Object.values(horizontalPosition),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
parameters: {
|
|
28
|
+
docs: {
|
|
29
|
+
page: readme,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const Template = (args) => ({
|
|
35
|
+
components: { IbInput },
|
|
36
|
+
setup() {
|
|
37
|
+
return { args };
|
|
38
|
+
},
|
|
39
|
+
template: '<ib-input placeholder="Placeholder" v-bind="args" />',
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const Text = Template.bind({});
|
|
43
|
+
Text.decorators = [
|
|
44
|
+
() => ({
|
|
45
|
+
template: '<div style="padding-top: 50px"><story /></div>',
|
|
46
|
+
}),
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
export const Password = Template.bind({});
|
|
50
|
+
Password.args = {
|
|
51
|
+
type: inputTypeOptions.password,
|
|
52
|
+
showPasswordMessage: "Show password",
|
|
53
|
+
hidePasswordMessage: "Hide password",
|
|
54
|
+
};
|
|
55
|
+
Password.decorators = [
|
|
56
|
+
() => ({
|
|
57
|
+
template: '<div style="padding: 50px"><story /></div>',
|
|
58
|
+
}),
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
const TemplateSearch = (args) => ({
|
|
62
|
+
components: { IbInput, IbCheckbox, IbCheckboxGroup },
|
|
63
|
+
setup() {
|
|
64
|
+
return { args };
|
|
65
|
+
},
|
|
66
|
+
template: `
|
|
67
|
+
<ib-input v-bind="args">
|
|
68
|
+
<template #settings>
|
|
69
|
+
<div style="display: flex;">
|
|
70
|
+
<ib-checkbox-group label-text="Group Label:" style="margin-right: 15px;">
|
|
71
|
+
<ib-checkbox label="Item 1" />
|
|
72
|
+
<ib-checkbox label="Item 2" />
|
|
73
|
+
<ib-checkbox label="Item 3" />
|
|
74
|
+
</ib-checkbox-group>
|
|
75
|
+
|
|
76
|
+
<ib-checkbox-group label-text="Group Label:">
|
|
77
|
+
<ib-checkbox label="Item 1" />
|
|
78
|
+
<ib-checkbox label="Item 2" />
|
|
79
|
+
<ib-checkbox label="Item 3" />
|
|
80
|
+
</ib-checkbox-group>
|
|
81
|
+
</div>
|
|
82
|
+
</template>
|
|
83
|
+
</ib-input>`,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export const Search = TemplateSearch.bind({});
|
|
87
|
+
Search.args = {
|
|
88
|
+
showIcon: true,
|
|
89
|
+
};
|
|
90
|
+
Search.decorators = [
|
|
91
|
+
() => ({
|
|
92
|
+
template:
|
|
93
|
+
'<div style="display: flex; align-items:center; justify-content: center; width: 400px; height: 400px; margin: 0 auto"><story /></div>',
|
|
94
|
+
}),
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
const TemplateSearchLarge = (args) => ({
|
|
98
|
+
components: { IbInput, IbCheckbox, IbCheckboxGroup },
|
|
99
|
+
setup() {
|
|
100
|
+
return { args };
|
|
101
|
+
},
|
|
102
|
+
template: `
|
|
103
|
+
<ib-input v-bind="args">
|
|
104
|
+
<template #settings>
|
|
105
|
+
<div style="display: flex;">
|
|
106
|
+
<ib-checkbox-group label-text="Group Label:" style="margin-right: 15px;">
|
|
107
|
+
<ib-checkbox label="Item 1" />
|
|
108
|
+
<ib-checkbox label="Item 2" />
|
|
109
|
+
<ib-checkbox label="Item 3" />
|
|
110
|
+
</ib-checkbox-group>
|
|
111
|
+
|
|
112
|
+
<ib-checkbox-group style="margin-right: 15px;" label-text="Group Label:">
|
|
113
|
+
<ib-checkbox label="Item 1" />
|
|
114
|
+
<ib-checkbox label="Item 2" />
|
|
115
|
+
<ib-checkbox label="Item 3" />
|
|
116
|
+
</ib-checkbox-group>
|
|
117
|
+
|
|
118
|
+
<ib-checkbox-group label-text="Group Label:">
|
|
119
|
+
<ib-checkbox label="Item 1" />
|
|
120
|
+
<ib-checkbox label="Item 2" />
|
|
121
|
+
<ib-checkbox label="Item 3" />
|
|
122
|
+
</ib-checkbox-group>
|
|
123
|
+
</div>
|
|
124
|
+
</template>
|
|
125
|
+
</ib-input>`,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export const SearchLarge = TemplateSearchLarge.bind({});
|
|
129
|
+
SearchLarge.args = {
|
|
130
|
+
showIcon: true,
|
|
131
|
+
};
|
|
132
|
+
SearchLarge.decorators = [
|
|
133
|
+
() => ({
|
|
134
|
+
template:
|
|
135
|
+
'<div style="display: flex; align-items:center; justify-content: center; width: 400px; height: 400px; margin: 0 auto"><story /></div>',
|
|
136
|
+
}),
|
|
137
|
+
];
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<ib-alert v-if="errorMessage">{{ errorMessage }}</ib-alert>
|
|
4
|
+
|
|
5
|
+
<div class="ib-input-wrapper" :class="{ 'has-settings': hasSettings }">
|
|
6
|
+
<input
|
|
7
|
+
v-bind="attrs"
|
|
8
|
+
v-model="actualValue"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
:id="id"
|
|
11
|
+
:class="classes"
|
|
12
|
+
@input="onInput($event)"
|
|
13
|
+
@blur="onBlur($event)"
|
|
14
|
+
@focus="onFocus($event)"
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
<ib-icon v-if="showIcon" class="icon-search" name="search-outline" />
|
|
18
|
+
|
|
19
|
+
<ib-icon-button
|
|
20
|
+
kind="ghost"
|
|
21
|
+
class="button-clear"
|
|
22
|
+
@click.prevent="clearInput"
|
|
23
|
+
:help-text="clearButtonMessage"
|
|
24
|
+
v-if="actualValue?.length && type !== 'password' && showClearButton"
|
|
25
|
+
>
|
|
26
|
+
<ib-icon name="close-outline"></ib-icon>
|
|
27
|
+
</ib-icon-button>
|
|
28
|
+
|
|
29
|
+
<ib-icon-button
|
|
30
|
+
kind="ghost"
|
|
31
|
+
class="toggle-password"
|
|
32
|
+
:help-text="showPassword ? hidePasswordMessage : showPasswordMessage"
|
|
33
|
+
@click.prevent="toggleShowPassword"
|
|
34
|
+
v-if="actualValue?.length && type === 'password'"
|
|
35
|
+
>
|
|
36
|
+
<ib-icon
|
|
37
|
+
:name="showPassword ? 'eye-off-outline' : 'eye-outline'"
|
|
38
|
+
></ib-icon>
|
|
39
|
+
</ib-icon-button>
|
|
40
|
+
|
|
41
|
+
<ib-dropdown
|
|
42
|
+
v-if="hasSettings"
|
|
43
|
+
class="settings-dropdown-wrapper"
|
|
44
|
+
:horizontal="settingsHorizontalPosition"
|
|
45
|
+
:vertical="settingsVerticalPosition"
|
|
46
|
+
>
|
|
47
|
+
<template #trigger>
|
|
48
|
+
<ib-icon-button
|
|
49
|
+
:help-text="settingsButtonMessage"
|
|
50
|
+
class="options-trigger"
|
|
51
|
+
kind="ghost"
|
|
52
|
+
>
|
|
53
|
+
<ib-icon name="options" />
|
|
54
|
+
</ib-icon-button>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<template #body>
|
|
58
|
+
<div class="settings-wrapper">
|
|
59
|
+
<slot name="settings"></slot>
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
62
|
+
</ib-dropdown>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script>
|
|
68
|
+
import IbAlert from "../../Alert/Alert.vue";
|
|
69
|
+
import IbIconButton from "../../IconButton/IconButton.vue";
|
|
70
|
+
import IbIcon from "../../Icon.vue";
|
|
71
|
+
import IbDropdown from "../../Dropdown/Dropdown.vue";
|
|
72
|
+
import { inputTypeOptions } from "./constants";
|
|
73
|
+
import generateUID from "../../../helpers/generateUID";
|
|
74
|
+
import removeEvents from "../../../helpers/removeEvents";
|
|
75
|
+
import {
|
|
76
|
+
verticalPosition,
|
|
77
|
+
horizontalPosition,
|
|
78
|
+
} from "./../../Dropdown/constants";
|
|
79
|
+
|
|
80
|
+
export default {
|
|
81
|
+
name: "IbInput",
|
|
82
|
+
props: {
|
|
83
|
+
type: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: inputTypeOptions.text,
|
|
86
|
+
validator: (value) => Object.keys(inputTypeOptions).includes(value),
|
|
87
|
+
},
|
|
88
|
+
disabled: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
required: false,
|
|
91
|
+
default: false,
|
|
92
|
+
},
|
|
93
|
+
error: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: false,
|
|
96
|
+
},
|
|
97
|
+
errorMessage: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: "",
|
|
100
|
+
},
|
|
101
|
+
id: {
|
|
102
|
+
type: [String],
|
|
103
|
+
default() {
|
|
104
|
+
return generateUID();
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
debounce: {
|
|
108
|
+
type: [Number, String],
|
|
109
|
+
},
|
|
110
|
+
showIcon: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: false,
|
|
113
|
+
},
|
|
114
|
+
showClearButton: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: true,
|
|
117
|
+
},
|
|
118
|
+
clearButtonMessage: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: "",
|
|
121
|
+
},
|
|
122
|
+
settingsButtonMessage: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: "",
|
|
125
|
+
},
|
|
126
|
+
showPasswordMessage: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: "",
|
|
129
|
+
},
|
|
130
|
+
hidePasswordMessage: {
|
|
131
|
+
type: String,
|
|
132
|
+
default: "",
|
|
133
|
+
},
|
|
134
|
+
value: {
|
|
135
|
+
type: [String, Number],
|
|
136
|
+
default: "",
|
|
137
|
+
},
|
|
138
|
+
settingsVerticalPosition: {
|
|
139
|
+
type: String,
|
|
140
|
+
default: verticalPosition.bottom,
|
|
141
|
+
},
|
|
142
|
+
settingsHorizontalPosition: {
|
|
143
|
+
type: String,
|
|
144
|
+
default: horizontalPosition.right,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
data() {
|
|
148
|
+
return {
|
|
149
|
+
actualValue: this.value,
|
|
150
|
+
showPassword: false,
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
methods: {
|
|
154
|
+
toggleShowPassword() {
|
|
155
|
+
this.showPassword = !this.showPassword;
|
|
156
|
+
},
|
|
157
|
+
clearInput() {
|
|
158
|
+
this.actualValue = "";
|
|
159
|
+
this.$emit("input", this.actualValue);
|
|
160
|
+
},
|
|
161
|
+
onBlur(e) {
|
|
162
|
+
this.$emit("blur", e.target.value);
|
|
163
|
+
},
|
|
164
|
+
onFocus(e) {
|
|
165
|
+
this.$emit("focus", e.target.value);
|
|
166
|
+
},
|
|
167
|
+
onInput(e) {
|
|
168
|
+
if (this.debounce) {
|
|
169
|
+
this.delayedInput(e.target.value);
|
|
170
|
+
} else {
|
|
171
|
+
this.$emit("input", e.target.value);
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
delayedInput(value) {
|
|
175
|
+
if (this.timer) {
|
|
176
|
+
clearTimeout(this.timer);
|
|
177
|
+
this.timer = null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
this.timer = setTimeout(() => {
|
|
181
|
+
this.$emit("input", value);
|
|
182
|
+
}, this.debounce);
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
computed: {
|
|
186
|
+
hasSettings() {
|
|
187
|
+
return !!this.$slots.settings;
|
|
188
|
+
},
|
|
189
|
+
classes() {
|
|
190
|
+
const classList = ["ib-input"];
|
|
191
|
+
|
|
192
|
+
if (this.error || this.errorMessage.length) {
|
|
193
|
+
classList.push("ib-error");
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (this.showIcon) {
|
|
197
|
+
classList.push("ib-input-has-icon");
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return classList;
|
|
201
|
+
},
|
|
202
|
+
attrs() {
|
|
203
|
+
let attrs = removeEvents({ ...this.$attrs });
|
|
204
|
+
|
|
205
|
+
attrs.type =
|
|
206
|
+
this.type === inputTypeOptions.password
|
|
207
|
+
? inputTypeOptions.password && this.showPassword
|
|
208
|
+
? "text"
|
|
209
|
+
: "password"
|
|
210
|
+
: this.type;
|
|
211
|
+
return attrs;
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
watch: {
|
|
215
|
+
value(newVal) {
|
|
216
|
+
this.actualValue = newVal;
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
components: {
|
|
220
|
+
IbAlert,
|
|
221
|
+
IbIconButton,
|
|
222
|
+
IbIcon,
|
|
223
|
+
IbDropdown,
|
|
224
|
+
},
|
|
225
|
+
inheritAttrs: false,
|
|
226
|
+
};
|
|
227
|
+
</script>
|
|
228
|
+
|
|
229
|
+
<style lang="scss" scoped>
|
|
230
|
+
@import "./input.scss";
|
|
231
|
+
</style>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
@import "../../../assets/scss/variables/colors.scss";
|
|
2
|
+
@import "../../../assets/scss/typography.scss";
|
|
3
|
+
@import "../../../assets/scss/mixins.scss";
|
|
4
|
+
|
|
5
|
+
$input-bg: $gray-100;
|
|
6
|
+
$input-color: $neutral-900;
|
|
7
|
+
$input-border-color: $gray-500;
|
|
8
|
+
$input-placeholder-color: $neutral-600;
|
|
9
|
+
$input-disabled-color: $neutral-500;
|
|
10
|
+
$input-disabled-bg: $gray-100;
|
|
11
|
+
$input-disabled-border-color: $neutral-500;
|
|
12
|
+
$input-disabled-placeholder-color: $neutral-500;
|
|
13
|
+
$input-hover-color: $neutral-900;
|
|
14
|
+
$input-hover-bg: $blue-200;
|
|
15
|
+
$input-hover-border-color: $blue-700;
|
|
16
|
+
$input-hover-placeholder-color: $neutral-600;
|
|
17
|
+
$input-hover-error-color: $red-800;
|
|
18
|
+
|
|
19
|
+
.ib-input-wrapper {
|
|
20
|
+
position: relative;
|
|
21
|
+
|
|
22
|
+
.toggle-password,
|
|
23
|
+
.button-clear {
|
|
24
|
+
position: absolute;
|
|
25
|
+
right: 5px;
|
|
26
|
+
top: 50%;
|
|
27
|
+
transform: translateY(-50%);
|
|
28
|
+
z-index: 11;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.icon-search {
|
|
32
|
+
font-size: 12px;
|
|
33
|
+
position: absolute;
|
|
34
|
+
color: $neutral-900;
|
|
35
|
+
left: 14px;
|
|
36
|
+
top: 50%;
|
|
37
|
+
transform: translateY(-50%);
|
|
38
|
+
z-index: 11;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.has-settings {
|
|
42
|
+
input {
|
|
43
|
+
position: relative;
|
|
44
|
+
z-index: 10;
|
|
45
|
+
padding-right: 55px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.settings-dropdown-wrapper {
|
|
49
|
+
position: absolute;
|
|
50
|
+
right: 0;
|
|
51
|
+
top: 0;
|
|
52
|
+
height: 100%;
|
|
53
|
+
min-width: 100%;
|
|
54
|
+
width: fit-content;
|
|
55
|
+
|
|
56
|
+
.options-trigger {
|
|
57
|
+
position: absolute;
|
|
58
|
+
right: 5px;
|
|
59
|
+
top: 50%;
|
|
60
|
+
transform: translateY(-50%);
|
|
61
|
+
z-index: 11;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.settings-wrapper {
|
|
65
|
+
padding: 20px;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.button-clear {
|
|
70
|
+
right: 29px;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.ib-input {
|
|
75
|
+
width: 100%;
|
|
76
|
+
@include Ib-H4-regular;
|
|
77
|
+
padding: 0 30px 0 15px;
|
|
78
|
+
height: 36px;
|
|
79
|
+
border-radius: 4px 4px 0 0;
|
|
80
|
+
background-color: $input-bg;
|
|
81
|
+
color: $input-color;
|
|
82
|
+
border: none;
|
|
83
|
+
outline: none;
|
|
84
|
+
border-bottom: 1px solid $input-border-color;
|
|
85
|
+
transition: color 0.3s, border-radius 0.3s, border-bottom-color 0.3s,
|
|
86
|
+
background-color 0.3s;
|
|
87
|
+
|
|
88
|
+
&::placeholder {
|
|
89
|
+
@include Ib-H4-regular-italic;
|
|
90
|
+
color: $input-placeholder-color;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&:hover {
|
|
94
|
+
color: $input-hover-color;
|
|
95
|
+
background-color: $input-hover-bg;
|
|
96
|
+
border-bottom-color: $input-hover-border-color;
|
|
97
|
+
|
|
98
|
+
&::placeholder {
|
|
99
|
+
color: $input-hover-placeholder-color;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:disabled {
|
|
104
|
+
color: $input-disabled-color;
|
|
105
|
+
background-color: $input-disabled-bg;
|
|
106
|
+
border-bottom-color: $input-disabled-border-color;
|
|
107
|
+
|
|
108
|
+
&::placeholder {
|
|
109
|
+
color: $input-disabled-placeholder-color;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&:focus {
|
|
114
|
+
border-radius: 4px;
|
|
115
|
+
border-color: transparent;
|
|
116
|
+
@include focus();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&-has-icon {
|
|
120
|
+
padding-left: 35px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&.ib-error {
|
|
124
|
+
border-radius: 4px;
|
|
125
|
+
border-color: transparent;
|
|
126
|
+
@include outline(-2px, $input-hover-error-color);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.ib-alert {
|
|
132
|
+
margin-bottom: 5px;
|
|
133
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# IbInput
|
|
2
|
+
|
|
3
|
+
import { Story, Canvas } from "@storybook/addon-docs";
|
|
4
|
+
|
|
5
|
+
Text inputs enable users to enter free-form text data. The type of text field used should reflect the length of the content you expect the user to enter. The default text input is for short, one-line content, whereas text area is for longer, multi-line entries.
|
|
6
|
+
|
|
7
|
+
### When to use:
|
|
8
|
+
|
|
9
|
+
- A user needs to input unique information that cannot be predicted with a preset of options.
|
|
10
|
+
- A user needs to input memorable data that can be entered more quickly in a free-hand format versus a more complex control.
|
|
11
|
+
|
|
12
|
+
### When not to use:
|
|
13
|
+
|
|
14
|
+
- If a user can only enter an option from a predefined list then avoid using a free-form text input as it is likely to result in an error. Consider using a selection control such as a select dropdown, or radio button group instead.
|
|
15
|
+
|
|
16
|
+
<Canvas>
|
|
17
|
+
<Story id="form-input--text" />
|
|
18
|
+
</Canvas>
|
|
19
|
+
|
|
20
|
+
### Props
|
|
21
|
+
|
|
22
|
+
| Prop name | Type | Default | Description |
|
|
23
|
+
| -------------------------- | ---------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
+
| type | String | 'text' | The type of input field. Valid options are 'text', 'password', and 'number'. |
|
|
25
|
+
| disabled | Boolean | false | Whether the input is disabled |
|
|
26
|
+
| error | Boolean | false | Whether the input has error state |
|
|
27
|
+
| errorMessage | String | '' | Show error message and input has error state |
|
|
28
|
+
| id | String | auto generate unique id | The ID of the input field. |
|
|
29
|
+
| debounse | Number or string | | The debounce time in milliseconds for the input event. If not provided, the input event will fire immediately after the user types. |
|
|
30
|
+
| showIcon | Boolean | false | If true, shows an icon inside the input field. |
|
|
31
|
+
| showClearButton | Boolean | true | If true, shows a clear button when the input field is not empty. |
|
|
32
|
+
| clearButtonMessage | String | '' | The tooltip text for the clear button. |
|
|
33
|
+
| settingsButtonMessage | String | '' | The tooltip text for the settings button. |
|
|
34
|
+
| showPasswordMessage | String | '' | The tooltip text for the show password button when the password is hidden. |
|
|
35
|
+
| hidePasswordMessage | String | '' | The tooltip text for the hide password button when the password is visible. |
|
|
36
|
+
| value | String | '' | The value of the input field. |
|
|
37
|
+
| settingsVerticalPosition | String | 'bottom' | The vertical position of the settings dropdown. Valid options are 'top' and 'bottom'. |
|
|
38
|
+
| settingsHorizontalPosition | String | 'right' | The horizontal position of the settings dropdown. Valid options are 'left' and 'right' |
|
|
39
|
+
|
|
40
|
+
### Events
|
|
41
|
+
|
|
42
|
+
| Event name | Parameters | Description |
|
|
43
|
+
| ---------- | ------------- | --------------------------------------------------- |
|
|
44
|
+
| input | value: String | The event emitted when the input value changes. |
|
|
45
|
+
| focus | value: String | The event emitted when the input field loses focus. |
|
|
46
|
+
| blur | value: String | The event emitted when the input field gains focus. |
|
|
47
|
+
|
|
48
|
+
### Slots
|
|
49
|
+
|
|
50
|
+
| Slot name | Description |
|
|
51
|
+
| --------- | ---------------------------------------------------- |
|
|
52
|
+
| settings | Content that will be displayed in the dropdown menu. |
|
|
53
|
+
|
|
54
|
+
## Hass custom dropdown
|
|
55
|
+
|
|
56
|
+
<Canvas>
|
|
57
|
+
<Story id="form-input--search" />
|
|
58
|
+
</Canvas>
|
|
59
|
+
|
|
60
|
+
<Canvas>
|
|
61
|
+
<Story id="form-input--search-large" />
|
|
62
|
+
</Canvas>
|
|
63
|
+
|
|
64
|
+
## Password
|
|
65
|
+
|
|
66
|
+
<Canvas>
|
|
67
|
+
<Story id="form-input--password" />
|
|
68
|
+
</Canvas>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import IbLabel from "./Label.vue";
|
|
2
|
+
import readme from "./readme.mdx";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Form/Label",
|
|
6
|
+
component: IbLabel,
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
page: readme,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Template = (args) => ({
|
|
15
|
+
components: { IbLabel },
|
|
16
|
+
setup() {
|
|
17
|
+
return { args };
|
|
18
|
+
},
|
|
19
|
+
template: '<ib-label v-bind="args">Full Name</ib-label>',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const Default = Template.bind({});
|
|
23
|
+
// TODO: move this to storybook helpers
|
|
24
|
+
Default.decorators = [
|
|
25
|
+
() => ({
|
|
26
|
+
template:
|
|
27
|
+
'<div style="display: flex; align-items:center; justify-content: center; width: 400px; height: 400px; margin: 0 auto"><story /></div>',
|
|
28
|
+
}),
|
|
29
|
+
];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label :class="classes">
|
|
3
|
+
<span v-if="required" class="required">* </span>
|
|
4
|
+
<slot></slot>
|
|
5
|
+
|
|
6
|
+
<ib-icon-button
|
|
7
|
+
v-if="infoText.length"
|
|
8
|
+
size="xs"
|
|
9
|
+
class="info-button"
|
|
10
|
+
kind="ghost"
|
|
11
|
+
>
|
|
12
|
+
<ib-icon name="information-circle-outline" />
|
|
13
|
+
<ib-tooltip :text="infoText"></ib-tooltip>
|
|
14
|
+
</ib-icon-button>
|
|
15
|
+
</label>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
import IbIconButton from "../../IconButton/IconButton.vue";
|
|
20
|
+
import IbTooltip from "../../Tooltip/Tooltip.vue";
|
|
21
|
+
import IbIcon from "../../Icon.vue";
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name: "IbLabel",
|
|
25
|
+
props: {
|
|
26
|
+
required: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
infoText: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
classes() {
|
|
37
|
+
const classList = ["ib-label"];
|
|
38
|
+
|
|
39
|
+
if (this.infoText.length) {
|
|
40
|
+
classList.push("has-info-text");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return classList;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
components: {
|
|
47
|
+
IbIconButton,
|
|
48
|
+
IbIcon,
|
|
49
|
+
IbTooltip,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<style lang="scss" scoped>
|
|
55
|
+
@import "../../../assets/scss/typography.scss";
|
|
56
|
+
@import "../../../assets/scss/variables/colors.scss";
|
|
57
|
+
|
|
58
|
+
.ib-label {
|
|
59
|
+
@include Ib-H4-regular;
|
|
60
|
+
color: $neutral-900;
|
|
61
|
+
margin-bottom: 5px;
|
|
62
|
+
span.required {
|
|
63
|
+
color: $red-800;
|
|
64
|
+
display: contents;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.has-info-text {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.info-button {
|
|
73
|
+
display: inline-block;
|
|
74
|
+
margin-left: 3px;
|
|
75
|
+
.ib-icon {
|
|
76
|
+
color: $gray-600;
|
|
77
|
+
font-size: 16px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:hover {
|
|
81
|
+
.ib-icon {
|
|
82
|
+
color: $blue-700;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
</style>
|