@itfin/components 1.0.71 → 1.0.75

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itfin/components",
3
- "version": "1.0.71",
3
+ "version": "1.0.75",
4
4
  "main": "dist/itfin-components.umd.js",
5
5
  "unpkg": "dist/itfin-components.common.js",
6
6
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="itf-datepicker" :class="{'with-addon addon-start': prependIcon}">
2
+ <div class="itf-datepicker input-group" :class="{'with-addon addon-start': prependIcon, 'with-addon addon-end': clearable}">
3
3
  <div class="addon" v-if="prependIcon">
4
4
  <slot name="addon">
5
5
  <itf-icon :name="prependIcon" />
@@ -22,6 +22,18 @@
22
22
  :lazy="!focused"
23
23
  :placeholder="placeholder"
24
24
  />
25
+
26
+ <div class="addon-end" v-if="clearable && value">
27
+ <slot name="clear">
28
+ <itf-button
29
+ icon
30
+ small
31
+ @click="$emit('input', '')"
32
+ >
33
+ <itf-icon name="close" />
34
+ </itf-button>
35
+ </slot>
36
+ </div>
25
37
  <div style="display: none">
26
38
  <div ref="dropdown" class="itf-datepicker__dropdown">
27
39
  <itf-date-picker-inline
@@ -42,10 +54,13 @@
42
54
  @import '../../assets/scss/input-addon';
43
55
 
44
56
  .itf-datepicker {
45
- .addon-end {
57
+ &.with-addon .addon-end {
46
58
  pointer-events: all;
47
59
  padding-right: 0.25rem;
48
60
  }
61
+ .form-control {
62
+ border-radius: $input-border-radius !important;
63
+ }
49
64
 
50
65
  &__dropdown {
51
66
  width: max-content;
@@ -75,6 +90,7 @@ import { DateTime } from 'luxon';
75
90
  import { debounce } from '../../helpers/debounce';
76
91
  import tippy from 'tippy.js';
77
92
  import itfIcon from '../icon/Icon.vue';
93
+ import itfButton from '../button/Button.vue';
78
94
  import itfDatePickerInline from './DatePickerInline.vue';
79
95
  import ITFSettings from '../../ITFSettings';
80
96
 
@@ -82,6 +98,7 @@ export default @Component({
82
98
  name: 'itfDatePicker',
83
99
  components: {
84
100
  itfIcon,
101
+ itfButton,
85
102
  itfDatePickerInline,
86
103
  IMaskComponent,
87
104
  },
@@ -97,6 +114,7 @@ class itfDatePicker extends Vue {
97
114
  @Prop({ type: Boolean, default: false }) onlyCalendar;
98
115
  @Prop({ type: String, default: '' }) placeholder;
99
116
  @Prop({ type: String, default: '' }) prependIcon;
117
+ @Prop(Boolean) clearable;
100
118
 
101
119
  focused = false;
102
120
 
@@ -1,10 +1,12 @@
1
1
  <template>
2
2
 
3
3
  <div class="itf-label" :class="{'has-validation': hasState, 'no-details': hideDetails}">
4
- <label class="itf-label__label form-label" v-if="label">
5
- {{label}}
6
- <span class="star" v-if="required">*</span>
7
- </label>
4
+ <slot name="label" v-bind="{ required, label }">
5
+ <label class="itf-label__label form-label" v-if="label">
6
+ {{label}}
7
+ <span class="star" v-if="required">*</span>
8
+ </label>
9
+ </slot>
8
10
 
9
11
  <div :class="{'is-invalid': hasState && hasError, 'is-valid': hasState && hasSuccess}">
10
12
  <slot :validate="doValidation"></slot>
@@ -124,7 +124,7 @@ class itfModal extends Vue {
124
124
  document.body.appendChild(this.$el); // should append only to body
125
125
  }
126
126
  const { default: Modal } = await import('bootstrap/js/src/modal.js');
127
- this.modalEl = new Modal(this.$el);
127
+ this.modalEl = new Modal(this.$el, { backdrop: 'static' });
128
128
  this.onVisibleChanged(this.value);
129
129
  this.bindEvents();
130
130
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <a :href="href" class="itf-tab" :data-test="`itf-tab-${id || _id}`" @click="setActive" :class="{ active }">
2
+ <a :href="href" class="itf-tab" :data-test="`itf-tab-${id || _uid}`" @click="setActive" :class="{ active }">
3
3
  <span><slot /></span>
4
4
  </a>
5
5
  </template>
@@ -42,7 +42,7 @@ class itfTab extends Vue {
42
42
  this.$router.push(this.to);
43
43
  e.preventDefault();
44
44
  }
45
- this.tabsManager.setValue(this.id || this._id);
45
+ this.tabsManager.setValue(this.id || this._uid);
46
46
  }
47
47
  }
48
48
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div v-show="tabsManager && tabsManager.getValue() === id" :class="{ filled }" class="itf-tab-content" :data-test="`itf-tab-content-${id || _id}`">
2
+ <div v-if="tabsManager && tabsManager.getValue() === id" :class="{ filled }" class="itf-tab-content" :data-test="`itf-tab-content-${id || _uid}`">
3
3
  <slot />
4
4
  </div>
5
5
  </template>
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import {
3
- Vue, Component, Provide, Model, Emit,
3
+ Vue, Component, Provide, Model, Emit, Prop
4
4
  } from 'vue-property-decorator';
5
5
  import itfTab from './Tab';
6
6
  import './tabs.scss';
@@ -15,6 +15,7 @@ class itfTabs extends Vue {
15
15
  @Provide() tabsManager = this;
16
16
 
17
17
  @Model('input') value;
18
+ @Prop(Boolean) vertical;
18
19
 
19
20
  tabNodes;
20
21
 
@@ -22,8 +23,12 @@ class itfTabs extends Vue {
22
23
  const [tabNodes, contents] = parseNodes(this.$slots);
23
24
  this.tabNodes = tabNodes;
24
25
 
25
- return createElement('div', { staticClass: 'itf-tabs' }, [
26
- createElement('div', { staticClass: 'itf-tabs-panel' }, tabNodes.reverse()),
26
+ let staticClass = 'itf-tabs';
27
+ if (this.vertical) {
28
+ staticClass += ' itf-tabs__vertical';
29
+ }
30
+ return createElement('div', { staticClass }, [
31
+ createElement('div', { staticClass: 'itf-tabs-panel' }, this.vertical ? tabNodes : tabNodes.reverse()),
27
32
  createElement('div', { staticClass: 'itf-tabs-content' }, contents)
28
33
  ]);
29
34
 
@@ -45,6 +45,7 @@ storiesOf('Common', module)
45
45
  <itf-tabs v-model="tab">
46
46
  <itf-tab id="Test1">
47
47
  Content 1
48
+ <div class="text-muted">Coming soon...</div>
48
49
  </itf-tab>
49
50
  <itf-tab id="Test2">
50
51
  Content 2
@@ -55,10 +56,10 @@ storiesOf('Common', module)
55
56
  <itf-tab id="Test4">
56
57
  Content 4
57
58
  </itf-tab>
58
- <itf-tab-content id="Test1">
59
+ <itf-tab-content id="Test1" filled>
59
60
  asd
60
61
  </itf-tab-content>
61
- <itf-tab-content id="Test2">
62
+ <itf-tab-content id="Test2" filled>
62
63
  asd123
63
64
  </itf-tab-content>
64
65
  </itf-tabs>
@@ -5,7 +5,7 @@
5
5
  :root {
6
6
  --itf-tabs-active-bg: #fff;
7
7
  --itf-tabs-active-color: #222;
8
- --itf-tabs-active-border-color: $primary;
8
+ --itf-tabs-active-border-color: #{$primary};
9
9
  --itf-tabs-inactive-bg: #fafafa;
10
10
  --itf-tabs-inactive-color: #222;
11
11
  --itf-tabs-inactive-border-color: rgba(0, 0, 0, .1);
@@ -15,9 +15,78 @@
15
15
  --itf-tabs-tab-padding: 10px;
16
16
 
17
17
  --itf-tabs-content-bg: #fff;
18
+ --itf-tabs-panel-width: 300px;
18
19
  }
19
20
 
20
21
  .itf-tabs {
22
+
23
+ &.itf-tabs__vertical {
24
+ display: flex;
25
+ flex-direction: row-reverse;
26
+
27
+ .itf-tabs-panel {
28
+ flex-direction: column;
29
+ width: var(--itf-tabs-panel-width);
30
+ padding-top: 6px;
31
+ padding-left: 0;
32
+ margin-right: 0;
33
+ padding-bottom: calc(var(--itf-tabs-tab-padding) * 3);
34
+
35
+ .itf-tab {
36
+ padding: var(--itf-tabs-tab-padding) 10px 0;
37
+ width: calc(100% - 2px);
38
+ margin-bottom: calc(var(--itf-tabs-tab-padding) * 1.5);
39
+
40
+ &, &:before, &:after {
41
+ border-top: 0 none;
42
+ border-right: 1px solid var(--itf-tabs-inactive-border-color);
43
+ }
44
+ &:after {
45
+ border-radius: 0 8px 0 0;
46
+ top: -5px;
47
+ box-shadow: rgb(0,0,0,.05) 1px -2px 1px, inset rgb(255 255 255 / 9%) 0 1px;
48
+ }
49
+ &:before {
50
+ border-radius: 0 0 8px 0;
51
+ transform: skew(0deg, -1deg);
52
+ top: auto;
53
+ bottom: -12px;
54
+ box-shadow: rgba(0,0,0,.05) 1px 2px 1px, inset rgba(255,255,255,.09) 0 -1px;
55
+ }
56
+ &:before, &:after {
57
+ height: calc(var(--itf-tabs-tab-padding) * 4);
58
+ width: calc(100% + 2px);
59
+ left: -1px;
60
+ border-top: 0 none;
61
+ border-right: 1px solid var(--itf-tabs-inactive-border-color);
62
+ }
63
+ &.active {
64
+ &, &:before, &:after {
65
+ border-top: 0 none;
66
+ border-right: 1px solid var(--itf-tabs-active-border-color);
67
+ }
68
+ &:after {
69
+ box-shadow: rgb(0 0 0 / 10%) 2px -3px 5px, inset rgb(255 255 255 / 9%) 0 1px;
70
+ }
71
+ &:before {
72
+ box-shadow: rgba(0,0,0,.1) 2px 3px 5px, inset rgba(255,255,255,.09) 0 -1px;
73
+ }
74
+ }
75
+ &:hover, &:hover:before, &:hover:after,
76
+ &:focus, &:focus:before, &:focus:after {
77
+ border-top: 0 none;
78
+ border-right: 1px solid var(--itf-tabs-hover-border-color);
79
+ }
80
+ }
81
+ }
82
+ .itf-tabs-content {
83
+ flex-grow: 1;
84
+ z-index: 1;
85
+ margin-right: -1px;
86
+ max-width: calc(100% - var(--itf-tabs-panel-width));
87
+ }
88
+ }
89
+
21
90
  .itf-tabs-panel {
22
91
  margin: 0;
23
92
  padding: 0;
@@ -49,6 +118,8 @@
49
118
  & > span {
50
119
  position: relative;
51
120
  z-index: 4;
121
+ opacity: .75;
122
+ display: block;
52
123
  }
53
124
  &:before, &:after {
54
125
  display: block;
@@ -79,10 +150,17 @@
79
150
  background-color: var(--itf-tabs-hover-bg);
80
151
  color: var(--itf-tabs-hover-color);
81
152
  border-top: 1px solid var(--itf-tabs-hover-border-color);
153
+
154
+ & > span {
155
+ opacity: 1;
156
+ }
82
157
  }
83
158
  &.active {
84
159
  z-index: 3;
85
160
 
161
+ & > span {
162
+ opacity: 1;
163
+ }
86
164
  &, &:before, &:after {
87
165
  background-color: var(--itf-tabs-active-bg);
88
166
  color: var(--itf-tabs-active-color);
@@ -93,6 +171,8 @@
93
171
  }
94
172
  .itf-tabs-content {
95
173
  .itf-tab-content {
174
+ height: 100%;
175
+
96
176
  &.filled {
97
177
  background: var(--itf-tabs-content-bg);
98
178
  border: 1px solid var(--itf-tabs-inactive-border-color);
@@ -50,7 +50,7 @@
50
50
  &__autogrow &__autogrow-text {
51
51
  white-space: pre-line;
52
52
  visibility: hidden;
53
- min-height: 3rem;
53
+ min-height: 4rem;
54
54
  }
55
55
  }
56
56
  </style>