@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,187 @@
|
|
|
1
|
+
@import "../../../assets/scss/variables/colors.scss";
|
|
2
|
+
@import "../../../assets/scss/typography.scss";
|
|
3
|
+
@import "../../../assets/scss/mixins.scss";
|
|
4
|
+
|
|
5
|
+
//checkbox
|
|
6
|
+
$radio-text: $neutral-900;
|
|
7
|
+
$radio-text-disabled: $neutral-500;
|
|
8
|
+
$radio-text-error: $neutral-900;
|
|
9
|
+
$radio-bg: transparent;
|
|
10
|
+
$radio-bg-hover: $blue-100;
|
|
11
|
+
$radio-bg-active: $blue-200;
|
|
12
|
+
$radio-bg-disabled: $gray-100;
|
|
13
|
+
$radio-bg-error: transparent;
|
|
14
|
+
$radio-border: $gray-500;
|
|
15
|
+
$radio-border-hover: $blue-300;
|
|
16
|
+
$radio-border-active: $blue-200;
|
|
17
|
+
$radio-border-disabled: $neutral-500;
|
|
18
|
+
$radio-text-disabled: $neutral-500;
|
|
19
|
+
$radio-border-error: $red-800;
|
|
20
|
+
$radio-border-error-hover: $red-800;
|
|
21
|
+
$radio-bg-error-hover: $red-50;
|
|
22
|
+
$radio-text-filled: $neutral-900;
|
|
23
|
+
$radio-bg-filled: transparent;
|
|
24
|
+
$radio-border-filled: $blue-800;
|
|
25
|
+
$radio-border-filled-hover: $blue-700;
|
|
26
|
+
$radio-bg-filled-hover: transparent;
|
|
27
|
+
$radio-border-filled-active: $blue-900;
|
|
28
|
+
$radio-border-filled-disabled: $neutral-500;
|
|
29
|
+
|
|
30
|
+
.ib-radio {
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
|
|
34
|
+
input {
|
|
35
|
+
opacity: 0;
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: -100%;
|
|
38
|
+
right: -100%;
|
|
39
|
+
|
|
40
|
+
&:focus + .ib-radio-body {
|
|
41
|
+
border-radius: 4px;
|
|
42
|
+
@include outline(2px);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&-body {
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
|
|
51
|
+
&.without-text {
|
|
52
|
+
transform: translateY(3px);
|
|
53
|
+
.ib-radio-input {
|
|
54
|
+
transform: translateY(0);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&-label {
|
|
60
|
+
@include Ib-H4-regular;
|
|
61
|
+
color: $radio-text;
|
|
62
|
+
margin-left: 15px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&-input {
|
|
66
|
+
height: 16px;
|
|
67
|
+
width: 16px;
|
|
68
|
+
background-color: $radio-bg;
|
|
69
|
+
border-radius: 50%;
|
|
70
|
+
border: 1.25px solid $radio-border;
|
|
71
|
+
transition: border 0.3s;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&:hover {
|
|
75
|
+
.ib-radio-input {
|
|
76
|
+
border-width: 2px;
|
|
77
|
+
border-color: $radio-border-hover;
|
|
78
|
+
background-color: $radio-bg-hover;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&:active {
|
|
83
|
+
.ib-radio-input {
|
|
84
|
+
border-color: $radio-border-active;
|
|
85
|
+
background-color: $radio-bg-active;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.radio-filled {
|
|
90
|
+
.ib-radio-input {
|
|
91
|
+
border-color: $radio-border-filled;
|
|
92
|
+
position: relative;
|
|
93
|
+
|
|
94
|
+
&::before {
|
|
95
|
+
content: '';
|
|
96
|
+
background-color: $radio-border-filled;
|
|
97
|
+
width: 11.25px;
|
|
98
|
+
height: 11.25px;
|
|
99
|
+
border-radius: 50%;
|
|
100
|
+
position: absolute;
|
|
101
|
+
top: 50%;
|
|
102
|
+
left: 50%;
|
|
103
|
+
transform: translate(-50%, -50%);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&:hover {
|
|
108
|
+
.ib-radio-input {
|
|
109
|
+
border-width: 1.25px;
|
|
110
|
+
border-color: $radio-border-filled-hover;
|
|
111
|
+
background-color: $radio-bg-filled-hover;
|
|
112
|
+
|
|
113
|
+
&::before {
|
|
114
|
+
background-color: $radio-border-filled-hover;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&:active {
|
|
120
|
+
.ib-radio-input {
|
|
121
|
+
border-color: $radio-border-filled-active;
|
|
122
|
+
|
|
123
|
+
&::before {
|
|
124
|
+
background-color: $radio-border-filled-active;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&.radio-disabled {
|
|
130
|
+
.ib-radio-input {
|
|
131
|
+
border-color: $radio-border-filled-disabled;
|
|
132
|
+
|
|
133
|
+
&::before {
|
|
134
|
+
background-color: $radio-border-filled-disabled;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&.radio-disabled {
|
|
141
|
+
.ib-radio-body {
|
|
142
|
+
cursor: default;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.ib-radio-input {
|
|
146
|
+
border-width: 1.25px;
|
|
147
|
+
background-color: $radio-bg-disabled!important;
|
|
148
|
+
border-color: $radio-border-disabled;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.ib-radio-label {
|
|
152
|
+
border-color: $radio-text-disabled;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&.has-error {
|
|
157
|
+
|
|
158
|
+
.ib-radio-input {
|
|
159
|
+
border-width: 2px;
|
|
160
|
+
background-color: $radio-bg-error;
|
|
161
|
+
border-color: $radio-border-error;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&:active {
|
|
165
|
+
.ib-radio-input {
|
|
166
|
+
border-color: $radio-border-active;
|
|
167
|
+
background-color: $radio-bg-active;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&:hover {
|
|
172
|
+
.ib-radio-input {
|
|
173
|
+
border-color: $radio-border-error-hover;
|
|
174
|
+
background-color: $radio-bg-error-hover;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&.radio-filled {
|
|
179
|
+
background-color: $radio-bg-filled;
|
|
180
|
+
|
|
181
|
+
.ib-radio-input {
|
|
182
|
+
border-width: 1.25px;
|
|
183
|
+
border-color: $radio-border-filled;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# IbRadio
|
|
2
|
+
|
|
3
|
+
import { Story, Canvas } from "@storybook/addon-docs";
|
|
4
|
+
|
|
5
|
+
Radio buttons are used for mutually exclusive choices, not for multiple choices. Only one radio button can be selected at a time. When a user chooses a new item, the previous choice is automatically deselected.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
#### Form
|
|
10
|
+
|
|
11
|
+
Can be used in tiles, data tables, modals, side panels, and in forms on full pages.
|
|
12
|
+
|
|
13
|
+
#### Settings
|
|
14
|
+
|
|
15
|
+
Used to change from one setting to another in a menu, page, or component. It can often act as a filtering mechanism.
|
|
16
|
+
|
|
17
|
+
#### When not to use
|
|
18
|
+
|
|
19
|
+
If a user can select from multiple options, use [checkboxes](?path=/story/form-checkbox--default) instead of radio buttons. Radio buttons allow the user to select only one item in a set whereas checkboxes allow the user to select multiple items.
|
|
20
|
+
|
|
21
|
+
### Default
|
|
22
|
+
|
|
23
|
+
<Canvas>
|
|
24
|
+
<Story id="form-radio--default" />
|
|
25
|
+
</Canvas>
|
|
26
|
+
|
|
27
|
+
### Props
|
|
28
|
+
|
|
29
|
+
| Name | type | Default Value | Description |
|
|
30
|
+
| --------- | ------- | ------------- | -------------------------------------- |
|
|
31
|
+
| label | String | '' | The label for the radio input. |
|
|
32
|
+
| error | Boolean | False | The error state of the radio input. |
|
|
33
|
+
| name | String | | The name of the radio input. |
|
|
34
|
+
| id | String | | The id of the radio input. |
|
|
35
|
+
| value | String | | The value of the radio input. |
|
|
36
|
+
| isChecked | Boolean | false | The checked state of the radio input. |
|
|
37
|
+
| disabled | Boolean | false | The disabled state of the radio input. |
|
|
38
|
+
|
|
39
|
+
### Slots
|
|
40
|
+
|
|
41
|
+
The component has no named slots, but you can place any content inside the component.
|
|
42
|
+
|
|
43
|
+
### Events
|
|
44
|
+
|
|
45
|
+
| Event name | Parameters | Description |
|
|
46
|
+
| ---------- | ---------- | -------------------------------------------- |
|
|
47
|
+
| input | Boolean | The event emitted when the radio is changes. |
|
|
48
|
+
| change | Boolean | The event emitted when the radio is changes. |
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import IbTextEditor from "./TextEditor.vue";
|
|
2
|
+
import IbFormGroup from "../FormGroup/FormGroup.vue";
|
|
3
|
+
import IbLabel from "../Label/Label.vue";
|
|
4
|
+
import readme from "./readme.mdx";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Form/Text Editor",
|
|
8
|
+
component: IbTextEditor,
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
page: readme,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const Template = (args) => ({
|
|
17
|
+
components: { IbTextEditor },
|
|
18
|
+
setup() {
|
|
19
|
+
return { args };
|
|
20
|
+
},
|
|
21
|
+
template: `<ib-text-editor style="height: 100px" v-bind="args" />`,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const Default = Template.bind({});
|
|
25
|
+
Default.args = {
|
|
26
|
+
characterLimit: 0,
|
|
27
|
+
};
|
|
28
|
+
Default.decorators = [
|
|
29
|
+
() => ({
|
|
30
|
+
template: '<div style="padding-top: 20px"><story /></div>',
|
|
31
|
+
}),
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const TemplateWidthFormGroup = (args) => ({
|
|
35
|
+
components: { IbTextEditor, IbFormGroup, IbLabel },
|
|
36
|
+
setup() {
|
|
37
|
+
return { args };
|
|
38
|
+
},
|
|
39
|
+
template: `
|
|
40
|
+
<ib-form-group :disable="args.disable" support-text="Supporting text">
|
|
41
|
+
<ib-label required id="description">Description</ib-label>
|
|
42
|
+
<ib-text-editor required for="description" v-bind="args" />
|
|
43
|
+
</ib-form-group>
|
|
44
|
+
`,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const WidthFormGroup = TemplateWidthFormGroup.bind({});
|
|
48
|
+
WidthFormGroup.args = {
|
|
49
|
+
placeholder: "Placeholder Text",
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const ErrorState = TemplateWidthFormGroup.bind({});
|
|
53
|
+
ErrorState.args = {
|
|
54
|
+
placeholder: "Placeholder Text",
|
|
55
|
+
error: true,
|
|
56
|
+
errorMessage: "error",
|
|
57
|
+
characterLimit: 0,
|
|
58
|
+
};
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="textarea-wrapper"
|
|
4
|
+
:class="{
|
|
5
|
+
error: characterOverLimit || error || errorMessage.length,
|
|
6
|
+
focus: isFocus,
|
|
7
|
+
disable: disable,
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<ib-character-count
|
|
11
|
+
v-if="characterLimit"
|
|
12
|
+
:character-limit="characterLimit"
|
|
13
|
+
:character-length="characterLength"
|
|
14
|
+
/>
|
|
15
|
+
<ib-alert class="error-message" v-if="errorMessage.length">
|
|
16
|
+
{{ errorMessage }}
|
|
17
|
+
</ib-alert>
|
|
18
|
+
|
|
19
|
+
<ib-alert
|
|
20
|
+
class="error-message"
|
|
21
|
+
v-show="characterLimitErrorMessage.length && characterOverLimit"
|
|
22
|
+
>
|
|
23
|
+
{{ characterLimitErrorMessage }}
|
|
24
|
+
</ib-alert>
|
|
25
|
+
|
|
26
|
+
<div class="ib-text-editor-wrapper" :class="{ disable: disable }">
|
|
27
|
+
<div
|
|
28
|
+
class="ib-text-editor"
|
|
29
|
+
:style="{ height: height ? height + 'px' : '' }"
|
|
30
|
+
ref="wrapper"
|
|
31
|
+
>
|
|
32
|
+
<QuillEditor
|
|
33
|
+
@textChange="onChange"
|
|
34
|
+
@blur="onBlur"
|
|
35
|
+
@focus="onFocus"
|
|
36
|
+
ref="quill"
|
|
37
|
+
toolbar="#toolbar"
|
|
38
|
+
v-model:content="data"
|
|
39
|
+
contentType="html"
|
|
40
|
+
:options="config"
|
|
41
|
+
:modules="modules"
|
|
42
|
+
></QuillEditor>
|
|
43
|
+
</div>
|
|
44
|
+
<div id="toolbar" class="toolbar" ref="toolbar">
|
|
45
|
+
<div class="toolbar-group header-toolbar-group">
|
|
46
|
+
<select class="ql-header">
|
|
47
|
+
<option value="1"></option>
|
|
48
|
+
<option value="2"></option>
|
|
49
|
+
<option value="3"></option>
|
|
50
|
+
<option value="4"></option>
|
|
51
|
+
<option value="5"></option>
|
|
52
|
+
<option value="6"></option>
|
|
53
|
+
<option selected></option>
|
|
54
|
+
</select>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div class="toolbar-group">
|
|
58
|
+
<ib-icon-button
|
|
59
|
+
class="toolbar-item ql-bold"
|
|
60
|
+
kind="ghost"
|
|
61
|
+
></ib-icon-button>
|
|
62
|
+
<ib-icon-button
|
|
63
|
+
class="toolbar-item ql-italic"
|
|
64
|
+
kind="ghost"
|
|
65
|
+
></ib-icon-button>
|
|
66
|
+
<ib-icon-button
|
|
67
|
+
class="toolbar-item ql-underline"
|
|
68
|
+
kind="ghost"
|
|
69
|
+
></ib-icon-button>
|
|
70
|
+
<ib-icon-button
|
|
71
|
+
class="toolbar-item ql-strike"
|
|
72
|
+
kind="ghost"
|
|
73
|
+
></ib-icon-button>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div class="toolbar-group">
|
|
77
|
+
<select class="ql-background"></select>
|
|
78
|
+
<select class="ql-color"></select>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div class="toolbar-group">
|
|
82
|
+
<ib-icon-button
|
|
83
|
+
class="toolbar-item ql-code-block"
|
|
84
|
+
kind="ghost"
|
|
85
|
+
></ib-icon-button>
|
|
86
|
+
<ib-icon-button
|
|
87
|
+
class="toolbar-item ql-link"
|
|
88
|
+
kind="ghost"
|
|
89
|
+
></ib-icon-button>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div class="toolbar-group">
|
|
93
|
+
<ib-icon-button
|
|
94
|
+
class="toolbar-item ql-align"
|
|
95
|
+
kind="ghost"
|
|
96
|
+
></ib-icon-button>
|
|
97
|
+
<ib-icon-button
|
|
98
|
+
class="ql-align toolbar-item"
|
|
99
|
+
value="center"
|
|
100
|
+
kind="ghost"
|
|
101
|
+
></ib-icon-button>
|
|
102
|
+
<ib-icon-button
|
|
103
|
+
class="ql-align toolbar-item"
|
|
104
|
+
value="right"
|
|
105
|
+
kind="ghost"
|
|
106
|
+
></ib-icon-button>
|
|
107
|
+
<ib-icon-button
|
|
108
|
+
class="ql-align toolbar-item"
|
|
109
|
+
value="justify"
|
|
110
|
+
kind="ghost"
|
|
111
|
+
></ib-icon-button>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<div class="toolbar-group">
|
|
115
|
+
<ib-icon-button
|
|
116
|
+
class="ql-list toolbar-item"
|
|
117
|
+
value="ordered"
|
|
118
|
+
kind="ghost"
|
|
119
|
+
></ib-icon-button>
|
|
120
|
+
<ib-icon-button
|
|
121
|
+
class="ql-list toolbar-item"
|
|
122
|
+
value="bullet"
|
|
123
|
+
kind="ghost"
|
|
124
|
+
></ib-icon-button>
|
|
125
|
+
|
|
126
|
+
<ib-icon-button
|
|
127
|
+
class="ql-alphabet-list alphabet-list toolbar-item"
|
|
128
|
+
kind="ghost"
|
|
129
|
+
></ib-icon-button>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
</template>
|
|
135
|
+
|
|
136
|
+
<script>
|
|
137
|
+
import { QuillEditor, Quill } from "@vueup/vue-quill";
|
|
138
|
+
import IbIconButton from "../../IconButton/IconButton.vue";
|
|
139
|
+
import IbAlert from "../../Alert/Alert.vue";
|
|
140
|
+
import IbCharacterCount from "../CharactersCount.vue";
|
|
141
|
+
import { AlphabetList, AlphabetListItem } from "./plugins/alphabetList";
|
|
142
|
+
import "@vueup/vue-quill/dist/vue-quill.snow.css";
|
|
143
|
+
|
|
144
|
+
import {
|
|
145
|
+
BOLD,
|
|
146
|
+
ITALIC,
|
|
147
|
+
UNDERLINE,
|
|
148
|
+
STRIKE,
|
|
149
|
+
CODE,
|
|
150
|
+
LINK,
|
|
151
|
+
ALIGN_LEFT,
|
|
152
|
+
ALIGN_CENTER,
|
|
153
|
+
ALIGN_RIGHT,
|
|
154
|
+
ALIGN_JUSTIFY,
|
|
155
|
+
LIST_ORDERED,
|
|
156
|
+
LIST_BULLET,
|
|
157
|
+
LIST_ALPHABET,
|
|
158
|
+
} from "./icons/toolbarIcons";
|
|
159
|
+
|
|
160
|
+
const icons = Quill.import("ui/icons");
|
|
161
|
+
icons.bold = BOLD;
|
|
162
|
+
icons.italic = ITALIC;
|
|
163
|
+
icons.underline = UNDERLINE;
|
|
164
|
+
icons.strike = STRIKE;
|
|
165
|
+
icons["code-block"] = CODE;
|
|
166
|
+
icons.link = LINK;
|
|
167
|
+
icons.align[""] = ALIGN_LEFT;
|
|
168
|
+
icons.align.center = ALIGN_CENTER;
|
|
169
|
+
icons.align.right = ALIGN_RIGHT;
|
|
170
|
+
icons.align.justify = ALIGN_JUSTIFY;
|
|
171
|
+
icons.list.ordered = LIST_ORDERED;
|
|
172
|
+
icons.list.bullet = LIST_BULLET;
|
|
173
|
+
icons["alphabet-list"] = LIST_ALPHABET;
|
|
174
|
+
|
|
175
|
+
Quill.register({
|
|
176
|
+
"formats/alphabet-list": AlphabetList,
|
|
177
|
+
"formats/alphabet-list/item": AlphabetListItem,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
Quill.register(icons);
|
|
181
|
+
Quill.debug("error");
|
|
182
|
+
|
|
183
|
+
export default {
|
|
184
|
+
name: "IbTextEditor",
|
|
185
|
+
props: {
|
|
186
|
+
placeholder: {
|
|
187
|
+
type: String,
|
|
188
|
+
default: "",
|
|
189
|
+
},
|
|
190
|
+
modelValue: {
|
|
191
|
+
type: String,
|
|
192
|
+
},
|
|
193
|
+
content: {
|
|
194
|
+
type: String,
|
|
195
|
+
default: "",
|
|
196
|
+
},
|
|
197
|
+
readOnly: {
|
|
198
|
+
type: Boolean,
|
|
199
|
+
default: false,
|
|
200
|
+
},
|
|
201
|
+
enable: {
|
|
202
|
+
type: Boolean,
|
|
203
|
+
default: true,
|
|
204
|
+
},
|
|
205
|
+
modules: {
|
|
206
|
+
type: [Object, Array],
|
|
207
|
+
default: () => {},
|
|
208
|
+
},
|
|
209
|
+
options: {
|
|
210
|
+
type: Object,
|
|
211
|
+
default: () => {},
|
|
212
|
+
},
|
|
213
|
+
characterLimit: {
|
|
214
|
+
type: [String, Number],
|
|
215
|
+
default: null,
|
|
216
|
+
},
|
|
217
|
+
error: {
|
|
218
|
+
type: Boolean,
|
|
219
|
+
default: false,
|
|
220
|
+
},
|
|
221
|
+
disable: {
|
|
222
|
+
type: Boolean,
|
|
223
|
+
default: false,
|
|
224
|
+
},
|
|
225
|
+
errorMessage: {
|
|
226
|
+
type: String,
|
|
227
|
+
default: "",
|
|
228
|
+
},
|
|
229
|
+
characterLimitErrorMessage: {
|
|
230
|
+
type: String,
|
|
231
|
+
default: "",
|
|
232
|
+
},
|
|
233
|
+
height: {
|
|
234
|
+
type: String,
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
mounted() {
|
|
238
|
+
// Reset default styles for toolbar
|
|
239
|
+
this.$refs.toolbar.classList.remove("ql-toolbar");
|
|
240
|
+
|
|
241
|
+
// Change default placeholder for link input
|
|
242
|
+
const input = this.$refs.wrapper.querySelector("input[data-link]");
|
|
243
|
+
input.dataset.link = "Enter Link";
|
|
244
|
+
|
|
245
|
+
this.updateCharacterLength();
|
|
246
|
+
},
|
|
247
|
+
data() {
|
|
248
|
+
return {
|
|
249
|
+
data: this.modelValue ? this.modelValue : this.content,
|
|
250
|
+
characterLength: 0,
|
|
251
|
+
isFocus: false,
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
watch: {
|
|
255
|
+
content(val) {
|
|
256
|
+
this.data = val;
|
|
257
|
+
},
|
|
258
|
+
data(val) {
|
|
259
|
+
this.$emit("update:modelValue", val);
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
methods: {
|
|
263
|
+
onChange() {
|
|
264
|
+
this.updateCharacterLength();
|
|
265
|
+
this.$emit("change", this.data);
|
|
266
|
+
},
|
|
267
|
+
onBlur(instance) {
|
|
268
|
+
this.$emit("blur", this.data, instance);
|
|
269
|
+
this.isFocus = false;
|
|
270
|
+
},
|
|
271
|
+
onFocus() {
|
|
272
|
+
this.isFocus = true;
|
|
273
|
+
},
|
|
274
|
+
updateCharacterLength() {
|
|
275
|
+
this.characterLength = this.$refs.quill.getText().length - 1;
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
computed: {
|
|
279
|
+
config() {
|
|
280
|
+
const config = {
|
|
281
|
+
placeholder: this.data.length ? "" : this.placeholder,
|
|
282
|
+
readOnly: this.readOnly ? this.readOnly : this.disable,
|
|
283
|
+
enable: this.enable,
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
return Object.assign(config, this.options);
|
|
287
|
+
},
|
|
288
|
+
characterOverLimit() {
|
|
289
|
+
return (
|
|
290
|
+
!!this.characterLimit && this.characterLength > this.characterLimit
|
|
291
|
+
);
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
components: {
|
|
295
|
+
QuillEditor,
|
|
296
|
+
IbIconButton,
|
|
297
|
+
IbAlert,
|
|
298
|
+
IbCharacterCount,
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
</script>
|
|
302
|
+
|
|
303
|
+
<style lang="scss">
|
|
304
|
+
@import "./textEditor.scss";
|
|
305
|
+
</style>
|