@itfin/components 1.2.49 → 1.2.51
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/package.json +1 -1
- package/src/assets/scss/components/_tabs.scss +3 -0
- package/src/assets/scss/components/_toaster.scss +4 -0
- package/src/assets/scss/directives/tooltip.scss +6 -6
- package/src/components/checkbox/RadioBox.vue +94 -0
- package/src/components/checkbox/index.stories.js +23 -5
- package/src/components/tabs/TabContent.vue +8 -1
- package/src/components/tabs/Tabs.vue +5 -1
- package/src/components/tabs/index.stories.js +22 -0
- package/src/helpers/formatters.js +4 -4
package/package.json
CHANGED
|
@@ -25,27 +25,27 @@ $dark-tooltip-color: #7b52eb;
|
|
|
25
25
|
cursor: default;
|
|
26
26
|
|
|
27
27
|
&[data-placement^=top] > .tippy-arrow:before {
|
|
28
|
-
border-top-color:
|
|
28
|
+
border-top-color: var(--itf-tooltip-bg-color);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
&[data-placement^=bottom] > .tippy-arrow:before {
|
|
32
|
-
border-bottom-color:
|
|
32
|
+
border-bottom-color: var(--itf-tooltip-bg-color);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
&[data-placement^=left] > .tippy-arrow:before {
|
|
36
|
-
border-left-color:
|
|
36
|
+
border-left-color: var(--itf-tooltip-bg-color);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
&[data-placement^=right] > .tippy-arrow:before {
|
|
40
|
-
border-right-color:
|
|
40
|
+
border-right-color: var(--itf-tooltip-bg-color);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
& > .tippy-backdrop {
|
|
44
|
-
background-color:
|
|
44
|
+
background-color: var(--itf-tooltip-bg-color);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
& > .tippy-svg-arrow {
|
|
48
|
-
fill:
|
|
48
|
+
fill: var(--itf-tooltip-bg-color);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="itf-radio-box form-check card" :class="{ 'itf-radio__large': large, 'itf-radio__medium': medium, 'active': isChecked }">
|
|
3
|
+
<input class="form-check-input" :id="id" type="radio" :name="radioName" v-model="isChecked" :value="true" :disabled="disabled" />
|
|
4
|
+
<label :for="id" slot="label" class="form-check-label card-body">
|
|
5
|
+
|
|
6
|
+
<slot></slot>
|
|
7
|
+
|
|
8
|
+
</label>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
<style lang="scss">
|
|
12
|
+
.itf-radio-box.card {
|
|
13
|
+
padding: 0;
|
|
14
|
+
margin-bottom: .5rem;
|
|
15
|
+
position: relative;
|
|
16
|
+
|
|
17
|
+
&.active {
|
|
18
|
+
background-color: rgba(var(--bs-primary-rgb),.1) !important;
|
|
19
|
+
}
|
|
20
|
+
&:hover {
|
|
21
|
+
background-color: rgba(0,0,0,.05);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.form-check-label {
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.form-check-input {
|
|
29
|
+
position: absolute;
|
|
30
|
+
right: 0.5rem;
|
|
31
|
+
top: 0.5rem;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
35
|
+
<script>
|
|
36
|
+
import { Vue, Component, Prop, Model, Inject } from 'vue-property-decorator';
|
|
37
|
+
|
|
38
|
+
let globalRadioId = 0;
|
|
39
|
+
|
|
40
|
+
export default @Component({
|
|
41
|
+
name: 'itfRadio',
|
|
42
|
+
components: {
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
class itfRadio extends Vue {
|
|
46
|
+
@Inject({ default: null }) radioGroup;
|
|
47
|
+
|
|
48
|
+
@Model('input') checked;
|
|
49
|
+
@Prop(String) label;
|
|
50
|
+
@Prop() value;
|
|
51
|
+
@Prop({ type: String }) name;
|
|
52
|
+
|
|
53
|
+
@Prop(Boolean) disabled;
|
|
54
|
+
@Prop(Boolean) medium;
|
|
55
|
+
@Prop(Boolean) large;
|
|
56
|
+
|
|
57
|
+
id = '';
|
|
58
|
+
|
|
59
|
+
created() {
|
|
60
|
+
globalRadioId += 1;
|
|
61
|
+
this.id = `radio${globalRadioId}`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
get radioName() {
|
|
65
|
+
if (this.radioGroup) {
|
|
66
|
+
return this.radioGroup.getGroupName();
|
|
67
|
+
}
|
|
68
|
+
if (!this.name) {
|
|
69
|
+
throw new Error('Name for radio should be not empty');
|
|
70
|
+
}
|
|
71
|
+
return this.name;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
set isChecked(val) {
|
|
75
|
+
if (this.radioGroup) {
|
|
76
|
+
this.radioGroup.onToggleOption(this.value, val);
|
|
77
|
+
}
|
|
78
|
+
this.$emit('input', this.value);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
get isChecked() {
|
|
82
|
+
if (this.radioGroup) {
|
|
83
|
+
return this.radioGroup.isChecked(this.value);
|
|
84
|
+
}
|
|
85
|
+
if (this.itemKey) {
|
|
86
|
+
if (!this.checked || !this.value) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
return this.checked[this.itemKey] === this.value[this.itemKey];
|
|
90
|
+
}
|
|
91
|
+
return this.checked === this.value;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
</script>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { storiesOf } from '@storybook/vue';
|
|
2
2
|
import itfCheckbox from './Checkbox';
|
|
3
3
|
import itfCheckboxGroup from './CheckboxGroup';
|
|
4
|
+
import itfRadioGroup from './RadioGroup';
|
|
5
|
+
import itfRadioBox from './RadioBox';
|
|
4
6
|
import itfForm from '../form/Form.vue';
|
|
5
7
|
import itfLabel from '../form/Label.vue';
|
|
6
|
-
import itfDatePicker from '../datepicker/DatePicker.vue';
|
|
7
|
-
import itfDateRangePicker from '../datepicker/DateRangePicker.vue';
|
|
8
8
|
import itfApp from '../app/App.vue';
|
|
9
9
|
|
|
10
10
|
storiesOf('Common', module)
|
|
@@ -15,13 +15,14 @@ storiesOf('Common', module)
|
|
|
15
15
|
itfCheckboxGroup,
|
|
16
16
|
itfForm,
|
|
17
17
|
itfLabel,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
itfRadioGroup,
|
|
19
|
+
itfRadioBox,
|
|
20
20
|
},
|
|
21
21
|
data() {
|
|
22
22
|
return {
|
|
23
23
|
test: false,
|
|
24
|
-
group: []
|
|
24
|
+
group: [],
|
|
25
|
+
radioValue: null
|
|
25
26
|
}
|
|
26
27
|
},
|
|
27
28
|
methods: {
|
|
@@ -68,6 +69,23 @@ storiesOf('Common', module)
|
|
|
68
69
|
<itf-checkbox large switch label="Test" v-model="test" />
|
|
69
70
|
|
|
70
71
|
|
|
72
|
+
<h3>Radio box</h3>
|
|
73
|
+
|
|
74
|
+
<p>Value: {{radioValue}}</p>
|
|
75
|
+
<itf-radio-group v-model="radioValue">
|
|
76
|
+
|
|
77
|
+
<itf-radio-box :value="1">
|
|
78
|
+
<h4>Test</h4>
|
|
79
|
+
<div class="text-muted">Шаблон для відпусток</div>
|
|
80
|
+
</itf-radio-box>
|
|
81
|
+
|
|
82
|
+
<itf-radio-box :value="2">
|
|
83
|
+
<h4>Test2</h4>
|
|
84
|
+
<div class="text-muted">Шаблон для лікарняних</div>
|
|
85
|
+
</itf-radio-box>
|
|
86
|
+
|
|
87
|
+
</itf-radio-group>
|
|
88
|
+
|
|
71
89
|
|
|
72
90
|
</itf-form>
|
|
73
91
|
</div>`,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
v-if="active || (tabsManager && tabsManager.getValue() === id)"
|
|
4
|
+
:class="{ filled, 'itf-tab-content': !simple }"
|
|
5
|
+
:data-test="`itf-tab-content-${id || _uid}`">
|
|
3
6
|
<slot />
|
|
4
7
|
</div>
|
|
5
8
|
</template>
|
|
@@ -16,5 +19,9 @@ class itfTabContent extends Vue {
|
|
|
16
19
|
@Prop() id;
|
|
17
20
|
@Prop(Boolean) filled;
|
|
18
21
|
@Prop(Boolean) active;
|
|
22
|
+
|
|
23
|
+
get simple() {
|
|
24
|
+
return this.tabsManager && this.tabsManager.simple;
|
|
25
|
+
}
|
|
19
26
|
}
|
|
20
27
|
</script>
|
|
@@ -18,6 +18,7 @@ export default @Component({
|
|
|
18
18
|
class itfTabs extends Vue {
|
|
19
19
|
@Model('input') value;
|
|
20
20
|
@Prop(Boolean) vertical;
|
|
21
|
+
@Prop(Boolean) simple;
|
|
21
22
|
|
|
22
23
|
tabNodes;
|
|
23
24
|
|
|
@@ -29,6 +30,9 @@ class itfTabs extends Vue {
|
|
|
29
30
|
if (this.vertical) {
|
|
30
31
|
staticClass += ' itf-tabs__vertical';
|
|
31
32
|
}
|
|
33
|
+
if (this.simple) {
|
|
34
|
+
staticClass += ' itf-tabs__simple';
|
|
35
|
+
}
|
|
32
36
|
|
|
33
37
|
const list = (this.vertical ? tabNodes : [...tabNodes].reverse());
|
|
34
38
|
const tabs = list.map((node) => createElement('a', this.createTab(node), [node]));
|
|
@@ -86,7 +90,7 @@ class itfTabs extends Vue {
|
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
return {
|
|
89
|
-
staticClass: 'itf-tab',
|
|
93
|
+
staticClass: this.simple ? 'text-decoration-none pe-3' : 'itf-tab',
|
|
90
94
|
class: {
|
|
91
95
|
'active': this.isActive(node)
|
|
92
96
|
},
|
|
@@ -63,5 +63,27 @@ storiesOf('Common', module)
|
|
|
63
63
|
asd123
|
|
64
64
|
</itf-tab-content>
|
|
65
65
|
</itf-tabs>
|
|
66
|
+
|
|
67
|
+
<itf-tabs v-model="tab" simple>
|
|
68
|
+
<itf-tab id="Test1">
|
|
69
|
+
Content 1
|
|
70
|
+
<div class="text-muted">Coming soon...</div>
|
|
71
|
+
</itf-tab>
|
|
72
|
+
<itf-tab id="Test2">
|
|
73
|
+
Content 2
|
|
74
|
+
</itf-tab>
|
|
75
|
+
<itf-tab id="Test3">
|
|
76
|
+
Content 3
|
|
77
|
+
</itf-tab>
|
|
78
|
+
<itf-tab id="Test4">
|
|
79
|
+
Content 4
|
|
80
|
+
</itf-tab>
|
|
81
|
+
<itf-tab-content id="Test1" filled>
|
|
82
|
+
asd
|
|
83
|
+
</itf-tab-content>
|
|
84
|
+
<itf-tab-content id="Test2" filled>
|
|
85
|
+
asd123
|
|
86
|
+
</itf-tab-content>
|
|
87
|
+
</itf-tabs>
|
|
66
88
|
</div>`,
|
|
67
89
|
}));
|
|
@@ -62,8 +62,8 @@ export function formatRangeDates(begin, end = null) {
|
|
|
62
62
|
|
|
63
63
|
export function firstLetters(name) {
|
|
64
64
|
let [first, second] = (name || '').trim()
|
|
65
|
-
.replace(/[\u0250-\u0400\u04FF-\
|
|
66
|
-
.replace(/ +/g, ' ')
|
|
65
|
+
.replace(/[\u0250-\u0400\u04FF-\ue007]/g, '')
|
|
66
|
+
.replace(/[ \.,_!@#$%^&*()«»]+/g, ' ')
|
|
67
67
|
.split(' ');
|
|
68
68
|
|
|
69
69
|
if (first === 'undefined') {
|
|
@@ -73,7 +73,7 @@ export function firstLetters(name) {
|
|
|
73
73
|
second = '';
|
|
74
74
|
}
|
|
75
75
|
if (!second) {
|
|
76
|
-
return first[0] || '';
|
|
76
|
+
return (first[0] || '').toUpperCase();
|
|
77
77
|
}
|
|
78
|
-
return (first[0] || '') + (second[0] || '');
|
|
78
|
+
return ((first[0] || '') + (second[0] || '')).toUpperCase();
|
|
79
79
|
}
|