@loja-integrada/admin-components 0.18.0 → 0.18.2

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": "@loja-integrada/admin-components",
3
- "version": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "author": "Loja Integrada Front-End Team",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -13,7 +13,7 @@ const exampleItems = [
13
13
  timestampTime: '11:18',
14
14
  timestampDate: '11 de abril',
15
15
  itemWrapperProps: { href: '#link' },
16
- withIcon: { class: 'bg-danger-light text-danger-dark', icon: 'close' }
16
+ withIcon: { class: 'bg-danger-light text-danger-dark', icon: 'close', tooltip: {placement: 'right', message: 'I am a tooltip!'} }
17
17
  },
18
18
  {
19
19
  title: 'R$ 3.599,99 cancelada',
@@ -1,3 +1,4 @@
1
+ import { TippyProps } from '@tippyjs/react'
1
2
  import { IconProps } from '../../Icons'
2
3
 
3
4
  export type TableListItemWrapperProp =
@@ -37,6 +38,13 @@ export interface TableListItemProps {
37
38
  * Icon to use
38
39
  */
39
40
  icon?: IconProps['icon']
41
+ /**
42
+ * Tooltip to use
43
+ */
44
+ tooltip?: {
45
+ message: string
46
+ placement?: TippyProps['placement']
47
+ }
40
48
  }
41
49
  /** Force border top at desktop even if is first item
42
50
  * @default false
@@ -71,5 +71,4 @@ describe('TableListItem tests', () => {
71
71
  cy.get('.table-item .table-item-append')
72
72
  .should('not.exist')
73
73
  })
74
-
75
74
  })
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
 
3
3
  import { Icon } from '../../Icons'
4
+ import { Tooltip } from '../../Indicators'
4
5
  import { TableListItemProps } from './TableListItem.interface'
5
6
  import { TableListItemWrapper } from './TableListItemWrapper'
6
7
 
@@ -36,7 +37,18 @@ export const TableListItem: React.FunctionComponent<TableListItemProps> = ({
36
37
  withIcon.class || ''
37
38
  }`}
38
39
  >
39
- <Icon icon={withIcon.icon || 'minus'} block size={5} />
40
+ {withIcon.tooltip ? (
41
+ <Tooltip
42
+ content={withIcon.tooltip.message}
43
+ placement={withIcon.tooltip.placement}
44
+ >
45
+ <span>
46
+ <Icon icon={withIcon.icon || 'minus'} block size={5} />
47
+ </span>
48
+ </Tooltip>
49
+ ) : (
50
+ <Icon icon={withIcon.icon || 'minus'} block size={5} />
51
+ )}
40
52
  </div>
41
53
  </div>
42
54
  )}
@@ -48,4 +48,18 @@ describe('Timeline tests', () => {
48
48
  cy.get('.timeline .timeline-item .timeline-badge svg').should('have.class', 'icon-ban')
49
49
  })
50
50
 
51
+ it('With colors properties on icons', () => {
52
+ mount(<Default/>)
53
+ cy.get('.timeline .timeline-item')
54
+ .should('have.length', 4)
55
+ cy.get('.timeline .timeline-item')
56
+ .last()
57
+ .find('.timeline-badge')
58
+ .should('have.class', 'bg-danger-light')
59
+ cy.get('.timeline .timeline-item')
60
+ .last()
61
+ .find('.timeline-badge svg')
62
+ .should('have.class', 'text-danger')
63
+ })
64
+
51
65
  })
@@ -16,7 +16,7 @@ export default {
16
16
  timestamp: '11/11/2011 às 10:10:10',
17
17
  icon: 'eye',
18
18
  iconBackgroundColor: 'bg-primary',
19
- description: 'Status change: from Cancelling to CancelledStatus change: from Cancelling to CancelledStatus change: from Cancelling to Cancelled',
19
+ description: 'Status change: from Cancelling to CancelledStatus change: from Cancelling to CancelledStatus change: from Cancelling to Cancelled',
20
20
  },
21
21
  {
22
22
  title: 'Venda criada',
@@ -31,6 +31,8 @@ export default {
31
31
  title: 'Venda criada',
32
32
  timestamp: '11/11/2011 às 10:10:10',
33
33
  icon: 'cog',
34
+ iconColor: 'text-danger',
35
+ iconBackgroundColor: 'bg-danger-light',
34
36
  },
35
37
  ]
36
38
  },
@@ -53,4 +55,4 @@ Loading.args = {
53
55
  export const Empty = Template.bind({})
54
56
  Empty.args = {
55
57
  items: [],
56
- }
58
+ }
@@ -21,6 +21,10 @@ export interface TimelineItemInterface {
21
21
  * Background of the current icon (className)
22
22
  */
23
23
  iconBackgroundColor?: string
24
+ /**
25
+ * Color of the current icon (className)
26
+ */
27
+ iconColor?: string
24
28
  /**
25
29
  * Toggle item description
26
30
  */
@@ -6,15 +6,16 @@ import { TimelineItemInterface } from './TimelineItem.interface'
6
6
  export const TimelineItem = ({ item }: TimelineItemProps) => {
7
7
  const [isOpen, setIsOpen] = useState(!item.toggle)
8
8
  const iconBackgroundColor = item.iconBackgroundColor || `bg-inverted-2`
9
+ const iconColor = item.iconColor || `text-base-1`
9
10
  const icon = item.icon || 'minus'
10
11
  const showToggle = item.toggle && item.description
11
12
 
12
13
  return (
13
14
  <li className={`timeline-item relative mb-10 last:mb-0`}>
14
15
  <div
15
- className={`timeline-badge absolute top-0 left-0 flex items-center justify-center text-base-1 w-8 h-8 -ml-3 rounded-full ${iconBackgroundColor}`}
16
+ className={`timeline-badge absolute top-0 left-0 flex items-center justify-center w-8 h-8 -ml-3 rounded-full ${iconBackgroundColor}`}
16
17
  >
17
- <Icon icon={icon} size={4} />
18
+ <Icon icon={icon} size={4} className={iconColor} />
18
19
  </div>
19
20
  <div className="ml-7 pt-px">
20
21
  <div
@@ -0,0 +1,11 @@
1
+ import React from 'react'
2
+
3
+ export const Arrow = () => (
4
+ <>
5
+ <path
6
+ fillRule="evenodd"
7
+ d="m17.808 8.498-2.25-2.5a.75.75 0 1 0-1.115 1.004L15.61 8.3H9.7V2.389l1.296 1.169a.756.756 0 0 0 1.06-.056.752.752 0 0 0-.056-1.06l-2.5-2.25a.75.75 0 0 0-1.003 0l-2.5 2.25a.752.752 0 0 0-.055 1.06.749.749 0 0 0 1.059.056L8.3 2.389V8.3H2.39l1.168-1.298a.751.751 0 0 0-1.115-1.004l-2.25 2.5a.75.75 0 0 0 0 1.004l2.25 2.5a.748.748 0 0 0 1.059.056.751.751 0 0 0 .056-1.06L2.39 9.7H8.3v5.911l-1.298-1.169a.75.75 0 0 0-1.004 1.116l2.5 2.25a.752.752 0 0 0 1.004 0l2.5-2.25a.752.752 0 0 0-1.004-1.116L9.7 15.611V9.7h5.91l-1.168 1.298a.752.752 0 0 0 .556 1.252.75.75 0 0 0 .558-.248l2.25-2.5a.75.75 0 0 0 0-1.004Z"
8
+ clipRule="evenodd"
9
+ />
10
+ </>
11
+ )
@@ -3,6 +3,7 @@ import { AngleLeft } from './AngleLeft'
3
3
  import { AngleRight } from './AngleRight'
4
4
  import { AngleDown } from './AngleDown'
5
5
  import { App } from './App'
6
+ import { Arrow } from './Arrow'
6
7
  import { ArrowLeft } from './ArrowLeft'
7
8
  import { SortDown } from './SortDown'
8
9
  import { ArrowRight } from './ArrowRight'
@@ -74,6 +75,7 @@ export const icons = {
74
75
  angleHeight: AngleHeight,
75
76
  angleWidth: AngleWidth,
76
77
  app: App,
78
+ arrow: Arrow,
77
79
  arrowLeft: ArrowLeft,
78
80
  arrowRight: ArrowRight,
79
81
  sortDown: SortDown,