@itfin/components 1.2.49 → 1.2.50

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.2.49",
3
+ "version": "1.2.50",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -9,6 +9,10 @@
9
9
  box-sizing: border-box;
10
10
  padding: 15px;
11
11
 
12
+ .toast-body {
13
+ word-break: break-all;
14
+ }
15
+
12
16
  &.is-top-left,
13
17
  &.is-top-center,
14
18
  &.is-top-right {
@@ -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: $tooltip-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: $tooltip-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: $tooltip-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: $tooltip-color
40
+ border-right-color: var(--itf-tooltip-bg-color);
41
41
  }
42
42
 
43
43
  & > .tippy-backdrop {
44
- background-color: $tooltip-color
44
+ background-color: var(--itf-tooltip-bg-color);
45
45
  }
46
46
 
47
47
  & > .tippy-svg-arrow {
48
- fill: $tooltip-color
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
- itfDatePicker,
19
- itfDateRangePicker,
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>`,