@farm-investimentos/front-mfe-components 14.2.1 → 15.0.0

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.
Files changed (148) hide show
  1. package/dist/front-mfe-components.common.js +4146 -5381
  2. package/dist/front-mfe-components.common.js.map +1 -1
  3. package/dist/front-mfe-components.css +2 -2
  4. package/dist/front-mfe-components.umd.js +4146 -5381
  5. package/dist/front-mfe-components.umd.js.map +1 -1
  6. package/dist/front-mfe-components.umd.min.js +1 -1
  7. package/dist/front-mfe-components.umd.min.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/components/AlertBox/AlertBox.scss +3 -2
  10. package/src/components/AlertBox/AlertBox.vue +2 -0
  11. package/src/components/Buttons/DefaultButton/DefaultButton.scss +57 -18
  12. package/src/components/Buttons/DefaultButton/DefaultButton.stories.js +49 -16
  13. package/src/components/Buttons/DefaultButton/DefaultButton.vue +3 -1
  14. package/src/components/Buttons/ExportButton/ExportButton.vue +2 -1
  15. package/src/components/Card/Card.scss +1 -1
  16. package/src/components/Card/CardComposition.stories.ts +8 -2
  17. package/src/components/Card/CardContent/CardContent.scss +11 -0
  18. package/src/components/Card/CardContent/CardContent.stories.js +11 -0
  19. package/src/components/Card/CardContent/CardContent.vue +9 -1
  20. package/src/components/CardContext/__tests__/CardContext.spec.js +5 -2
  21. package/src/components/Checkbox/Checkbox.scss +2 -2
  22. package/src/components/Checkbox/Checkbox.vue +2 -1
  23. package/src/components/Chip/Chip.scss +15 -15
  24. package/src/components/Chip/Chip.stories.js +13 -13
  25. package/src/components/Chip/Chip.stories.scss +1 -16
  26. package/src/components/Chip/Chip.vue +25 -3
  27. package/src/components/Collapsible/Collapsible.scss +8 -3
  28. package/src/components/Collapsible/Collapsible.stories.js +68 -1
  29. package/src/components/Collapsible/Collapsible.vue +68 -8
  30. package/src/components/ContextMenu/ContextMenu.scss +1 -1
  31. package/src/components/ContextMenu/ContextMenu.stories.js +42 -29
  32. package/src/components/ContextMenu/ContextMenu.vue +20 -1
  33. package/src/components/CopyToClipboard/CopyToClipboard.stories.js +7 -1
  34. package/src/components/CopyToClipboard/CopyToClipboard.vue +15 -3
  35. package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.scss +6 -9
  36. package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.stories.js +4 -0
  37. package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.vue +21 -5
  38. package/src/components/{TextField/__tests__/TextField.spec.js → DataTableEmptyWrapper/__tests__/DataTableEmptyWrapper.spec.js} +3 -3
  39. package/src/components/DataTableHeader/DataTableHeader.scss +10 -12
  40. package/src/components/DataTableHeader/DataTableHeader.vue +5 -4
  41. package/src/components/DataTablePaginator/DataTablePaginator.scss +71 -69
  42. package/src/components/DatePicker/DatePicker.scss +5 -5
  43. package/src/components/DatePicker/DatePicker.vue +2 -3
  44. package/src/components/DatePicker/__tests__/DatePicker.spec.js +1 -1
  45. package/src/components/DatePicker/vDatePicker.scss +214 -0
  46. package/src/components/DialogFooter/DialogFooter.scss +1 -1
  47. package/src/components/DialogFooter/DialogFooter.stories.js +2 -2
  48. package/src/components/DialogFooter/DialogFooter.vue +1 -1
  49. package/src/components/DialogHeader/DialogHeader.scss +2 -3
  50. package/src/components/DialogHeader/DialogHeader.vue +4 -4
  51. package/src/components/Form/Form.stories.js +1 -1
  52. package/src/components/Icon/Icon.scss +6 -0
  53. package/src/components/Icon/Icon.stories.js +19 -1
  54. package/src/components/Icon/Icon.vue +8 -2
  55. package/src/components/IconBox/IconBox.stories.js +16 -0
  56. package/src/components/IconBox/IconBox.vue +17 -7
  57. package/src/components/IdCaption/IdCaption.vue +27 -13
  58. package/src/components/Label/Label.scss +17 -5
  59. package/src/components/Label/Label.stories.js +0 -1
  60. package/src/components/ListItem/ListItem.scss +5 -3
  61. package/src/components/ListItem/ListItem.vue +2 -0
  62. package/src/components/Logger/LoggerItem/LoggerItem.scss +9 -1
  63. package/src/components/Logger/LoggerItem/LoggerItem.vue +25 -8
  64. package/src/components/Logger/LoggerItem/__tests__/LoggerItem.spec.js +1 -1
  65. package/src/components/MainFilter/MainFilter.stories.js +4 -4
  66. package/src/components/Modal/Modal.scss +3 -3
  67. package/src/components/ModalPromptUser/ModalPromptUser.stories.js +26 -0
  68. package/src/components/ModalPromptUser/ModalPromptUser.vue +10 -0
  69. package/src/components/MultipleFilePicker/MultipleFilePicker.scss +19 -12
  70. package/src/components/MultipleFilePicker/MultipleFilePicker.stories.js +12 -0
  71. package/src/components/MultipleFilePicker/MultipleFilePicker.vue +18 -11
  72. package/src/components/MultipleFilePicker/__tests__/MultipleFilePicker.spec.js +9 -0
  73. package/src/components/ProgressBar/ProgressBar.vue +4 -0
  74. package/src/components/Radio/Radio.scss +18 -4
  75. package/src/components/Radio/Radio.stories.js +2 -1
  76. package/src/components/Radio/Radio.vue +3 -1
  77. package/src/components/RangeDatePicker/RangeDatePicker.vue +0 -2
  78. package/src/components/ResourceMetaInfo/ResourceMetaInfo.vue +8 -8
  79. package/src/components/Select/Select.scss +4 -0
  80. package/src/components/Select/Select.vue +9 -1
  81. package/src/components/Stepper/StepperHeader/StepperHeader.scss +7 -7
  82. package/src/components/Stepper/StepperHeader/StepperHeader.vue +35 -36
  83. package/src/components/Switcher/Switcher.scss +24 -8
  84. package/src/components/Switcher/Switcher.stories.js +33 -0
  85. package/src/components/Switcher/Switcher.vue +24 -3
  86. package/src/components/TableContextMenu/TableContextMenu.scss +4 -9
  87. package/src/components/TableContextMenu/TableContextMenu.stories.js +2 -0
  88. package/src/components/TableContextMenu/TableContextMenu.vue +5 -4
  89. package/src/components/Tabs/Tabs.scss +69 -0
  90. package/src/components/Tabs/Tabs.stories.js +51 -4
  91. package/src/components/Tabs/Tabs.vue +59 -32
  92. package/src/components/Tabs/__tests__/Tabs.spec.js +54 -54
  93. package/src/components/Tabs/index.ts +1 -0
  94. package/src/components/TextArea/TextArea.scss +7 -3
  95. package/src/components/TextArea/TextArea.vue +1 -0
  96. package/src/components/TextFieldV2/TextFieldV2.scss +8 -4
  97. package/src/components/TextFieldV2/TextFieldV2.vue +1 -0
  98. package/src/components/Tooltip/Tooltip.scss +8 -10
  99. package/src/components/Tooltip/Tooltip.vue +4 -2
  100. package/src/components/Typography/BodyText/BodyText.scss +7 -7
  101. package/src/components/Typography/Caption/Caption.scss +7 -7
  102. package/src/components/Typography/Caption/Caption.stories.js +1 -1
  103. package/src/components/Typography/Caption/Caption.vue +4 -1
  104. package/src/components/Typography/Caption/configurations.ts +3 -2
  105. package/src/components/Typography/Heading/Heading.scss +19 -19
  106. package/src/components/Typography/Heading/configurations.ts +5 -5
  107. package/src/components/Typography/Small/Small.scss +3 -0
  108. package/src/components/Typography/Small/Small.stories.js +34 -0
  109. package/src/components/Typography/Small/Small.vue +47 -0
  110. package/src/components/Typography/Small/__tests__/Small.spec.js +31 -0
  111. package/src/components/Typography/Small/configurations.ts +7 -0
  112. package/src/components/Typography/Subtitle/Subtitle.scss +7 -7
  113. package/src/components/Typography/Typography.scss +10 -0
  114. package/src/components/Typography/Typography.stories.js +15 -2
  115. package/src/components/Typography/Typography.vue +6 -2
  116. package/src/components/Typography/index.ts +2 -1
  117. package/src/components/ValueCaption/ValueCaption.vue +2 -0
  118. package/src/components/layout/Line/Line.scss +15 -0
  119. package/src/components/layout/Line/Line.stories.js +28 -5
  120. package/src/components/layout/Line/Line.vue +37 -3
  121. package/src/configurations/_mixins.scss +1 -1
  122. package/src/configurations/_theme-colors-background.scss +10 -0
  123. package/src/configurations/_theme-colors-bw.scss +10 -0
  124. package/src/configurations/_theme-colors.scss +79 -48
  125. package/src/configurations/_variables.scss +2 -0
  126. package/src/examples/Colors.stories.js +39 -1
  127. package/src/examples/Colors.stories.scss +1 -1
  128. package/src/helpers/index.ts +2 -1
  129. package/src/helpers/isChildOfFixedElement.js +16 -0
  130. package/src/main.ts +1 -5
  131. package/src/scss/Sticky-table.scss +13 -7
  132. package/src/scss/VuejsDialog.scss +58 -51
  133. package/src/scss/cssVariablesGenerator.scss +17 -14
  134. package/src/scss/utils.scss +17 -251
  135. package/src/components/FilePicker/FilePicker.scss +0 -53
  136. package/src/components/FilePicker/FilePicker.stories.js +0 -14
  137. package/src/components/FilePicker/FilePicker.vue +0 -109
  138. package/src/components/FilePicker/__tests__/FilePicker.spec.js +0 -77
  139. package/src/components/FilePicker/index.ts +0 -3
  140. package/src/components/TextField/TextField.scss +0 -43
  141. package/src/components/TextField/TextField.stories.js +0 -104
  142. package/src/components/TextField/TextField.vue +0 -18
  143. package/src/components/TextField/index.ts +0 -4
  144. package/src/scss/ButtonOverrides.scss +0 -73
  145. package/src/scss/DefaultModal.scss +0 -89
  146. package/src/scss/DialogOverrides.scss +0 -94
  147. package/src/scss/FormOverrides.scss +0 -264
  148. package/src/scss/Status-Chip.scss +0 -34
@@ -14,7 +14,7 @@
14
14
  v-bind="$attrs"
15
15
  @click="onClick"
16
16
  />
17
- <farm-label v-if="label" class="ml-2" :for="id">
17
+ <farm-label v-if="label" :for="id">
18
18
  {{ label }}
19
19
  </farm-label>
20
20
  </div>
@@ -50,6 +50,8 @@ export default Vue.extend({
50
50
  type: String as PropType<
51
51
  | 'primary'
52
52
  | 'secondary'
53
+ | 'secondary-green'
54
+ | 'secondary-golden'
53
55
  | 'neutral'
54
56
  | 'info'
55
57
  | 'success'
@@ -47,8 +47,6 @@
47
47
  readonly
48
48
  :id="inputId"
49
49
  :rules="required ? [requiredRule] : []"
50
- @click="openDatepicker"
51
- @onClickIcon="openDatepicker"
52
50
  />
53
51
  </template>
54
52
  </farm-contextmenu>
@@ -1,28 +1,28 @@
1
1
  <template>
2
2
  <div class="farm-resource-metainfo">
3
3
  <div v-if="showCreate">
4
- <farm-icon color="gray" size="sm">calendar-blank</farm-icon>
5
- <farm-caption color="gray" variation="regular">
4
+ <farm-icon color="black" variation="40" size="sm">calendar-blank</farm-icon>
5
+ <farm-caption color="black" color-variation="40" variation="regular">
6
6
  Data de cadastro:
7
- <farm-caption color="gray" variation="medium" tag="span">
7
+ <farm-caption color="black" color-variation="40" variation="medium" tag="span">
8
8
  {{ formattedCreatedAt }}
9
9
  </farm-caption>
10
10
  </farm-caption>
11
11
  </div>
12
12
  <div v-if="showUpdate">
13
- <farm-icon color="gray" size="sm">history</farm-icon>
13
+ <farm-icon color="black" variation="40" size="sm">history</farm-icon>
14
14
 
15
- <farm-caption color="gray" variation="regular">
15
+ <farm-caption color="black" color-variation="40" variation="regular">
16
16
  Última atualização feita por
17
- <farm-caption color="gray" variation="medium" tag="span">
17
+ <farm-caption color="black" color-variation="40" variation="medium" tag="span">
18
18
  {{ formattedUsername }}
19
19
  </farm-caption>
20
20
  , dia
21
- <farm-caption color="gray" variation="medium" tag="span">
21
+ <farm-caption color="black" color-variation="40" variation="medium" tag="span">
22
22
  {{ formattedUpdatedAt }}
23
23
  </farm-caption>
24
24
  às
25
- <farm-caption color="gray" variation="medium" tag="span">
25
+ <farm-caption color="black" color-variation="40" variation="medium" tag="span">
26
26
  {{ formattedUpdatedHours }}
27
27
  </farm-caption>
28
28
  </farm-caption>
@@ -28,6 +28,10 @@
28
28
  margin-right: 8px;
29
29
  }
30
30
 
31
+ :deep(.farm-listitem:hover .farm-typography) {
32
+ color: var(--farm-primary-base);
33
+ }
34
+
31
35
  :deep(.farm-listitem:hover .farm-checkbox .farm-icon) {
32
36
  color: var(--farm-primary-lighten);
33
37
  }
@@ -7,6 +7,7 @@
7
7
  'farm-textfield--blured': isBlured,
8
8
  'farm-textfield--error': hasError,
9
9
  'farm-textfield--disabled': disabled,
10
+ 'farm-textfield--focused': isFocus || isVisible,
10
11
  'farm-textfield--hiddendetails': hideDetails,
11
12
  }"
12
13
  v-if="!readonly && !disabled"
@@ -81,7 +82,7 @@
81
82
  </template>
82
83
 
83
84
  <script lang="ts">
84
- import Vue, { computed, onBeforeMount, PropType, toRefs, watch } from 'vue';
85
+ import Vue, { computed, onBeforeMount, PropType, ref, toRefs, watch } from 'vue';
85
86
  import validateFormStateBuilder from '../../composition/validateFormStateBuilder';
86
87
  import validateFormFieldBuilder from '../../composition/validateFormFieldBuilder';
87
88
  import validateFormMethodBuilder from '../../composition/validateFormMethodBuilder';
@@ -250,6 +251,9 @@ export default Vue.extend({
250
251
  newValue => {
251
252
  innerValue.value = newValue;
252
253
  errorBucket.value = [];
254
+ if(multiple.value && newValue === null || (Array.isArray(newValue) && newValue.length === 0)) {
255
+ multipleValues.value = [];
256
+ }
253
257
  validate(newValue);
254
258
  updateSelectedTextValue();
255
259
  emit('input', newValue);
@@ -396,6 +400,9 @@ export default Vue.extend({
396
400
  );
397
401
  };
398
402
 
403
+ const contextmenu = ref(null);
404
+
405
+
399
406
  return {
400
407
  items,
401
408
  innerValue,
@@ -410,6 +417,7 @@ export default Vue.extend({
410
417
  isVisible,
411
418
  customId,
412
419
  showErrorText,
420
+ contextmenu,
413
421
  validate,
414
422
  reset,
415
423
  selectItem,
@@ -17,7 +17,7 @@ $step-height: 64px;
17
17
  flex-direction: column;
18
18
  align-items: center;
19
19
  justify-items: center;
20
- color: var(--v-gray-lighten1);
20
+ color: var(--farm-bw-black-5);
21
21
  font-size: 14px;
22
22
  font-weight: 700;
23
23
 
@@ -26,7 +26,7 @@ $step-height: 64px;
26
26
  }
27
27
 
28
28
  &.stepper__header-step--current {
29
- @include stepperHeaderStepColor(#5089de);
29
+ @include stepperHeaderStepColor(var(--farm-info-base));
30
30
  }
31
31
 
32
32
  &.stepper__header-step--error {
@@ -36,7 +36,7 @@ $step-height: 64px;
36
36
  &.stepper__header-step--next {
37
37
  .farm-icon,
38
38
  .farm-icon__number {
39
- color: var(--farm-gray-base);
39
+ color: var(--farm-bw-black-50);
40
40
  }
41
41
  }
42
42
 
@@ -54,7 +54,7 @@ $step-height: 64px;
54
54
 
55
55
  border: none;
56
56
  margin: 16px -16px 0;
57
- background: var(--farm-gray-base);
57
+ background: var(--farm-bw-black-5);
58
58
 
59
59
  &.stepper__divider--previous {
60
60
  background: var(--farm-primary-base);
@@ -96,7 +96,7 @@ $step-height: 64px;
96
96
  height: 32px;
97
97
  margin: -24px 0 8px 16px;
98
98
  width: 1px;
99
- background-color: var(----farm-gray-lighten);
99
+ background-color: var(--farm-bw-black-5);
100
100
 
101
101
  &.stepper__divider--previous {
102
102
  background-color: var(--farm-primary-base);
@@ -109,7 +109,7 @@ $step-height: 64px;
109
109
 
110
110
  .farm-icon,
111
111
  .farm-icon__number {
112
- border: 1px solid var(--farm-gray-base);
112
+ border: 1px solid var(--farm-bw-black-5);
113
113
  border-radius: 50%;
114
114
  width: 32px;
115
115
  height: 32px;
@@ -122,6 +122,6 @@ $step-height: 64px;
122
122
 
123
123
  &:before {
124
124
  font-size: 16px;
125
- color: var(--v-gray-lighten1);
125
+ color: var(--farm-bw-black-50);
126
126
  }
127
127
  }
@@ -64,42 +64,41 @@ export default Vue.extend({
64
64
  */
65
65
  errorCurrentStepStatus: { type: Boolean, default: false },
66
66
  },
67
- methods: {
68
- isStepCurrent(index: number): boolean {
69
- return this.currentStep === index + 1;
70
- },
71
- isStepPrevious(index: number): boolean {
72
- return this.currentStep > index + 1;
73
- },
74
- isStepError(index: number): boolean {
75
- return this.currentStep === index + 1 && this.errorCurrentStepStatus;
76
- },
77
- hasDivider(index: number): boolean {
78
- return index < this.steps.length - 1;
79
- },
80
- isStepPreviousToCurrent(index: number): boolean {
81
- return (
82
- index + 2 == this.currentStep &&
83
- this.isStepCurrent(index + 1) &&
84
- !this.isStepError(index + 1)
85
- );
86
- },
87
- isStepPreviousToError(index: number): boolean {
88
- return (
89
- index + 2 == this.currentStep &&
90
- this.isStepCurrent(index + 1) &&
91
- this.isStepError(index + 1)
92
- );
93
- },
94
- isStepNext(index: number): boolean {
95
- return index + 1 > this.currentStep;
96
- },
97
- isStepErrorToNext(index: number): boolean {
98
- return this.errorCurrentStepStatus && index + 1 === this.currentStep;
99
- },
100
- isStepCurrentToNext(index: number): boolean {
101
- return !this.errorCurrentStepStatus && index + 1 === this.currentStep;
102
- },
67
+ setup(props) {
68
+ const isStepCurrent = (index: number) => props.currentStep === index + 1;
69
+
70
+ const isStepPrevious = (index: number) => props.currentStep > index + 1;
71
+
72
+ const isStepError = (index: number) =>
73
+ props.currentStep === index + 1 && props.errorCurrentStepStatus;
74
+
75
+ const hasDivider = (index: number) => index < props.steps.length - 1;
76
+
77
+ const isStepPreviousToCurrent = (index: number) =>
78
+ index + 2 === props.currentStep && isStepCurrent(index + 1) && !isStepError(index + 1);
79
+
80
+ const isStepPreviousToError = (index: number) =>
81
+ index + 2 === props.currentStep && isStepCurrent(index + 1) && isStepError(index + 1);
82
+
83
+ const isStepNext = (index: number) => index + 1 > props.currentStep;
84
+
85
+ const isStepErrorToNext = (index: number) =>
86
+ props.errorCurrentStepStatus && index + 1 === props.currentStep;
87
+
88
+ const isStepCurrentToNext = (index: number) =>
89
+ !props.errorCurrentStepStatus && index + 1 === props.currentStep;
90
+
91
+ return {
92
+ isStepCurrent,
93
+ isStepPrevious,
94
+ isStepError,
95
+ isStepPreviousToCurrent,
96
+ isStepPreviousToError,
97
+ isStepNext,
98
+ isStepErrorToNext,
99
+ isStepCurrentToNext,
100
+ hasDivider,
101
+ };
103
102
  },
104
103
  });
105
104
  </script>
@@ -1,15 +1,25 @@
1
- .farm-switch--selected {
2
- background-color: var(--farm-primary-base);
1
+ @import '../../configurations/theme-colors';
2
+
3
+
4
+
5
+ .farm-switch {
6
+ @each $color in $theme-colors-list {
7
+ &#{'[color=' + $color + ']'} {
8
+ .farm-switch--selected {
9
+ background-color: themeColor($color);
10
+ }
11
+
12
+ .farm-switch--disabled-on {
13
+ background-color: rgba(themeColor($color), 0.27);
14
+ }
15
+ }
16
+ }
3
17
  }
4
18
 
5
19
  .farm-switch--idle {
6
20
  background-color: var(--farm-neutral-base);
7
21
  }
8
22
 
9
- .farm-switch--disabled-on {
10
- background-color: var(--farm-primary-lighten);
11
- }
12
-
13
23
  .farm-switch--disabled-off {
14
24
  background-color: var(--farm-neutral-lighten);
15
25
  }
@@ -17,7 +27,7 @@
17
27
  .farm-switch {
18
28
  display: inline-block;
19
29
  position: relative;
20
- cursor: pointer;
30
+
21
31
  width: 24px;
22
32
  height: 16px;
23
33
  border-radius: 9999px;
@@ -30,6 +40,13 @@
30
40
  display: block;
31
41
  }
32
42
 
43
+ cursor: pointer;
44
+
45
+ &:has(.farm-switch--disabled-on),
46
+ &:has(.farm-switch--disabled-off) {
47
+ cursor: default;
48
+ }
49
+
33
50
  }
34
51
 
35
52
  .farm-switch__background {
@@ -38,7 +55,6 @@
38
55
  margin-top: 0;
39
56
  height: 12px;
40
57
  width: 100%;
41
- box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
42
58
  transition: background-color .4s ease;
43
59
  }
44
60
 
@@ -1,4 +1,6 @@
1
1
  import Switch from './Switcher';
2
+ import baseThemeColors from '../../configurations/_theme-colors-base.scss';
3
+ const colors = Object.keys(baseThemeColors);
2
4
 
3
5
  export default {
4
6
  title: 'Form/Switcher',
@@ -58,3 +60,34 @@ export const OffDisabled = () => ({
58
60
  <farm-switcher v-model="selectedValue" block :disabled="true" />
59
61
  </div>`,
60
62
  });
63
+
64
+ export const Colors = () => ({
65
+ data() {
66
+ return {
67
+ colors,
68
+ selectedValue: true,
69
+ };
70
+ },
71
+ template: `
72
+ <farm-row>
73
+ <farm-col
74
+ cols="12"
75
+ md="3"
76
+ v-for="color in colors"
77
+ :key="'color_' + color"
78
+ >
79
+ <farm-bodytext>{{ color }}</farm-bodytext>
80
+ <farm-switcher
81
+ v-model="selectedValue"
82
+ :color="color"
83
+ />
84
+ <farm-caption>Desabilitado</farm-caption>
85
+ <farm-switcher
86
+ disabled
87
+ v-model="selectedValue"
88
+ :color="color"
89
+ />
90
+ </farm-col>
91
+
92
+ </farm-row>`,
93
+ });
@@ -2,6 +2,7 @@
2
2
  <div
3
3
  :class="{ 'farm-switch': true }"
4
4
  role="checkbox"
5
+ v-bind="$props"
5
6
  @click="toggle"
6
7
  @keydown.space.prevent="toggle"
7
8
  >
@@ -10,11 +11,31 @@
10
11
  </div>
11
12
  </template>
12
13
  <script lang="ts">
13
- import Vue from 'vue';
14
+ import Vue, { PropType } from 'vue';
14
15
 
15
16
  export default Vue.extend({
16
17
  name: 'farm-switcher',
17
18
  props: {
19
+ /**
20
+ * Color
21
+ */
22
+ color: {
23
+ type: String as PropType<
24
+ | 'primary'
25
+ | 'secondary'
26
+ | 'secondary-green'
27
+ | 'secondary-golden'
28
+ | 'neutral'
29
+ | 'info'
30
+ | 'success'
31
+ | 'error'
32
+ | 'warning'
33
+ | 'extra-1'
34
+ | 'extra-2'
35
+ | 'gray'
36
+ >,
37
+ default: 'primary',
38
+ },
18
39
  /**
19
40
  * v-model binding
20
41
  */
@@ -37,8 +58,8 @@ export default Vue.extend({
37
58
  return {
38
59
  'farm-switch--selected': this.value && !this.isDisabled,
39
60
  'farm-switch--idle': !this.value && !this.isDisabled,
40
- 'farm-switch--disabled-on': this.value && this.isDisabled,
41
- 'farm-switch--disabled-off': !this.value && this.isDisabled,
61
+ 'farm-switch--disabled-on': this.value && this.isDisabled,
62
+ 'farm-switch--disabled-off': !this.value && this.isDisabled,
42
63
  };
43
64
  },
44
65
  indicatorStyles() {
@@ -3,12 +3,7 @@
3
3
  pointer-events: none;
4
4
  }
5
5
  }
6
-
7
- .farm-listitem {
8
- padding: auto 8px;
9
-
10
- .farm-icon {
11
- vertical-align: sub;
12
- margin-right: 8px;
13
- }
14
- }
6
+ :deep(.farm-listitem .farm-icon) {
7
+ vertical-align: sub;
8
+ margin-right: 8px;
9
+ }
@@ -50,6 +50,8 @@ export const Multi = () => ({
50
50
  { label: 'Novo', icon: { type: 'open-in-new' } },
51
51
  { label: 'Editar', icon: { color: 'secondary', type: 'open-in-new' } },
52
52
  { label: 'Remover', icon: { color: 'error', type: 'delete' } },
53
+ { label: 'Outro', icon: { color: 'black', type: 'cog' } },
54
+ { label: 'Book', icon: { color: 'gray', type: 'book' } },
53
55
  ],
54
56
  };
55
57
  },
@@ -6,8 +6,8 @@
6
6
  <template v-slot:activator>
7
7
  <farm-btn
8
8
  icon
9
- title="Abrir opções"
10
- color="secondary"
9
+ title="Ver opções"
10
+ color="secondary-green"
11
11
  :disabled="disabled"
12
12
  @click="toggleValue"
13
13
  >
@@ -26,7 +26,7 @@
26
26
  <farm-icon v-if="item.icon" size="sm" :color="item.icon.color || 'primary'">
27
27
  {{ item.icon.type }}
28
28
  </farm-icon>
29
- <farm-caption bold tag="span">{{ item.label }}</farm-caption>
29
+ <farm-caption bold tag="span" :color="item.icon.color || 'primary'">{{ item.label }}</farm-caption>
30
30
  </farm-listitem>
31
31
  </farm-list>
32
32
  </farm-contextmenu>
@@ -75,8 +75,9 @@ export default Vue.extend({
75
75
  this.$emit(handler);
76
76
  }
77
77
  },
78
- toggleValue() {
78
+ toggleValue(event: MouseEvent) {
79
79
  this.value = !this.value;
80
+ event.stopPropagation();
80
81
  },
81
82
  },
82
83
  });
@@ -0,0 +1,69 @@
1
+ @import '../../configurations/theme-colors';
2
+
3
+ .tabs {
4
+ display: flex;
5
+ margin-bottom: -1px;
6
+
7
+ &__tab {
8
+ border-bottom: 1px solid var(--farm-primary-lighten);
9
+ cursor: pointer;
10
+ display: inline-flex;
11
+ padding: 18px 24px 14px;
12
+ height: 54px;
13
+ transition: all 0.5s ease;
14
+ &:hover {
15
+ background-color: transparentize(themeColor('primary', 'base'), 0.86);
16
+
17
+ div.rounded-circle {
18
+ opacity: 0.86;
19
+ }
20
+ }
21
+
22
+ span {
23
+ font-weight: 400;
24
+ }
25
+
26
+ &--selected {
27
+
28
+ border-bottom: 4px solid var(--farm-primary-base);
29
+
30
+ span {
31
+ font-size: 14px;
32
+ font-weight: 500;
33
+ }
34
+ }
35
+ }
36
+
37
+ &--disabled {
38
+ .tabs__tab {
39
+ cursor: default;
40
+
41
+ &:hover {
42
+ background-color: transparent;
43
+ }
44
+
45
+ &--selected {
46
+ &:hover {
47
+ background-color: transparent;
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+
54
+ .farm-tabs {
55
+ border-bottom: 1px solid var(--farm-primary-lighten);
56
+ }
57
+
58
+
59
+ div.rounded-circle {
60
+ background-color: var(--farm-gray-lighten);
61
+ width: 24px;
62
+ height: 24px;
63
+ margin-top: -2px;
64
+ margin-left: -2px;
65
+
66
+ &.is-selected {
67
+ background-color: var(--farm-primary-base);
68
+ }
69
+ }
@@ -1,9 +1,9 @@
1
1
  import Tabs from './Tabs.vue';
2
2
 
3
3
  export default {
4
- title: 'Display/Tabs',
5
- component: Tabs,
6
- parameters: {
4
+ title: 'Display/Tabs',
5
+ component: Tabs,
6
+ parameters: {
7
7
  docs: {
8
8
  description: {
9
9
  component: `Tabs<br />
@@ -17,5 +17,52 @@ export default {
17
17
  };
18
18
 
19
19
  export const Primary = () => ({
20
- template: '<farm-tabs />',
20
+ data() {
21
+ return {
22
+ v: 'Seleção',
23
+ };
24
+ },
25
+ methods: {
26
+ updateValue(value) {
27
+ this.v = value.name;
28
+ },
29
+ },
30
+ template: `<div>
31
+ <farm-tabs @update="updateValue" />
32
+ <p class="mt-2">selected: {{v}}</p>
33
+ </div>`,
34
+ });
35
+
36
+ export const WithoutCounter = () => ({
37
+ data() {
38
+ return {
39
+ v: 'Seleção',
40
+ };
41
+ },
42
+ methods: {
43
+ updateValue(value) {
44
+ this.v = value.name;
45
+ },
46
+ },
47
+ template: `<div>
48
+ <farm-tabs :showCounter="false" @update="updateValue" />
49
+ <p class="mt-2">selected: {{v}}</p>
50
+ </div>`,
51
+ });
52
+
53
+ export const Disabled = () => ({
54
+ data() {
55
+ return {
56
+ v: 'Seleção',
57
+ };
58
+ },
59
+ methods: {
60
+ updateValue(value) {
61
+ this.v = value.name;
62
+ },
63
+ },
64
+ template: `<div>
65
+ <farm-tabs :showCounter="false" :allow-user-change="false" @update="updateValue" />
66
+ <p class="mt-2">selected: {{v}}</p>
67
+ </div>`,
21
68
  });