@farm-investimentos/front-mfe-components 11.9.1 → 11.10.1

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": "@farm-investimentos/front-mfe-components",
3
- "version": "11.9.1",
3
+ "version": "11.10.1",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -31,6 +31,12 @@
31
31
  color: var(--farm-text-secondary);
32
32
  }
33
33
 
34
+ &.farm-typography--ellipsis {
35
+ overflow: hidden;
36
+ white-space: nowrap;
37
+ text-overflow: ellipsis;
38
+ }
39
+
34
40
  @each $k in $theme-colors-list {
35
41
  &#{'[color=' + $k + ']'} {
36
42
  color: var(--farm-#{$k}-base);
@@ -178,3 +178,9 @@ export const LineHeight = () => ({
178
178
  </farm-typography>
179
179
  </div>`,
180
180
  });
181
+
182
+ export const Ellipsis = () => ({
183
+ template: `<div style="width: 100px;">
184
+ <farm-typography ellipsis>sample text for css text ellipsis</farm-typography>
185
+ </div>`,
186
+ });
@@ -7,6 +7,7 @@
7
7
  ['farm-typography--weight-' + weight]: weight !== undefined,
8
8
  'farm-typography--lighten': colorVariation === 'lighten',
9
9
  'farm-typography--darken': colorVariation === 'darken',
10
+ 'farm-typography--ellipsis': ellipsis,
10
11
  }"
11
12
  :style="style"
12
13
  :color="color"
@@ -76,6 +77,13 @@ export default Vue.extend({
76
77
  type: String,
77
78
  default: '',
78
79
  },
80
+ /**
81
+ * Add css ellipsis
82
+ */
83
+ ellipsis: {
84
+ type: Boolean,
85
+ default: false,
86
+ },
79
87
  },
80
88
  setup(props) {
81
89
  const { size, lineHeight } = toRefs(props);
@@ -0,0 +1,19 @@
1
+ .farm-valuecaption {
2
+ display: flex;
3
+
4
+ .farm-icon-box {
5
+ margin-right: 8px;
6
+ }
7
+
8
+ div.farm-valuecaption__content {
9
+ display: flex;
10
+ flex-direction: column;
11
+ justify-content: space-between;
12
+
13
+ p {
14
+ margin-bottom: 0;
15
+ word-break: break-word;
16
+ }
17
+ }
18
+
19
+ }
@@ -0,0 +1,33 @@
1
+ import { withDesign } from 'storybook-addon-designs';
2
+ import ValueCaption from '.';
3
+
4
+ export default {
5
+ title: 'Display/ValueCaption',
6
+ component: ValueCaption,
7
+ decorators: [withDesign],
8
+ parameters: {
9
+ docs: {
10
+ description: {
11
+ component: `Value Caption<br />
12
+ selector: <em>farm-valuecaption</em>
13
+ `,
14
+ },
15
+ },
16
+ viewMode: 'docs',
17
+ },
18
+ };
19
+
20
+ export const Primary = () => ({
21
+ template: `
22
+ <farm-valuecaption
23
+ icon="account-box-outline"
24
+ >
25
+ <template v-slot:title>
26
+ Upper Line Text
27
+ </template>
28
+ <template v-slot:subtitle>
29
+ R$ 1.000.000,00
30
+ </template>
31
+ </farm-valuecaption>
32
+ `,
33
+ });
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <div class="farm-valuecaption">
3
+ <farm-icon-box v-if="icon" :icon="icon" :color="iconBoxColor" size="md" />
4
+ <div class="farm-valuecaption__content">
5
+ <farm-caption variation="regular" color="gray" v-if="hasTitle">
6
+ <slot name="title"></slot>
7
+ </farm-caption>
8
+
9
+ <farm-bodytext bodytext type="1" variation="bold" v-if="hasSubtitle">
10
+ <slot name="subtitle"></slot>
11
+ </farm-bodytext>
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script lang="ts">
17
+ import Vue, { computed, PropType } from 'vue';
18
+ export default Vue.extend({
19
+ name: 'farm-valuecaption',
20
+ props: {
21
+ /**
22
+ * Icon (from Material Icons)
23
+ * Example: chart-bar
24
+ */
25
+ icon: {
26
+ type: String,
27
+ },
28
+ /**
29
+ * IconBox Color
30
+ */
31
+ iconBoxColor: {
32
+ type: String as PropType<
33
+ | 'primary'
34
+ | 'secondary'
35
+ | 'neutral'
36
+ | 'info'
37
+ | 'success'
38
+ | 'error'
39
+ | 'warning'
40
+ | 'success'
41
+ | 'extra-1'
42
+ | 'extra-2'
43
+ | 'gray'
44
+ >,
45
+ default: 'primary',
46
+ },
47
+ },
48
+
49
+ setup(_, { slots }) {
50
+ const hasTitle = computed(() => slots.title);
51
+ const hasSubtitle = computed(() => slots.subtitle);
52
+
53
+ return { hasSubtitle, hasTitle };
54
+ },
55
+ });
56
+ </script>
57
+
58
+ <style lang="scss" scoped>
59
+ @import './ValueCaption';
60
+ </style>
@@ -0,0 +1,14 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import ValueCaption from '../ValueCaption.vue';
3
+
4
+ describe('ValueCaption component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(ValueCaption);
9
+ });
10
+
11
+ test('Created hook', () => {
12
+ expect(wrapper).toBeDefined();
13
+ });
14
+ });
@@ -0,0 +1,4 @@
1
+ import ValueCaption from './ValueCaption.vue';
2
+
3
+ export { ValueCaption };
4
+ export default ValueCaption;
package/src/main.ts CHANGED
@@ -91,6 +91,7 @@ export * from './components/TextField';
91
91
  export * from './components/TextFieldV2';
92
92
  export * from './components/Tooltip';
93
93
  export * from './components/Typography';
94
+ export * from './components/ValueCaption';
94
95
 
95
96
  export * from './components/layout/Box';
96
97
  export * from './components/layout/Col';