@loja-integrada/admin-components 0.19.2 → 0.19.3

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.19.2",
3
+ "version": "0.19.3",
4
4
  "author": "Loja Integrada Front-End Team",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -81,5 +81,5 @@ export const Toggle = React.memo(ToggleWithForwardRef)
81
81
 
82
82
  export interface ToggleProps
83
83
  extends React.InputHTMLAttributes<HTMLInputElement> {
84
- label?: string
84
+ label?: React.ReactNode | string
85
85
  }
@@ -6,7 +6,6 @@ import { Badge } from "./Badge"
6
6
 
7
7
  const { Default, Small, Expanded } = composeStories(stories)
8
8
  const badgeClass = '.badge'
9
- const badgeTextClass = '.badgeText'
10
9
 
11
10
  const specTitle = require('cypress-sonarqube-reporter/specTitle');
12
11
  describe(specTitle('Badge tests'), () => {
@@ -49,25 +48,27 @@ describe(specTitle('Badge tests'), () => {
49
48
 
50
49
  it('Variants', () => {
51
50
  mount(<Default type="neutral" />)
52
- cy.get(badgeClass).should('have.class', 'bg-inverted-2')
51
+ cy.get(badgeClass).should('have.class', 'bg-inverted-2 text-base-1')
53
52
 
54
53
  mount(<Default type="neutralLight" />)
55
- cy.get(badgeClass).should('have.class', 'bg-inverted-3')
56
- cy.get(badgeTextClass).should('have.class', 'text-tertiary')
54
+ cy.get(badgeClass).should('have.class', 'bg-inverted-3 text-tertiary')
57
55
 
58
56
  mount(<Default type="primary" />)
59
- cy.get(badgeClass).should('have.class', 'bg-primary-dark')
57
+ cy.get(badgeClass).should('have.class', 'bg-primary-dark text-base-1')
58
+
59
+ mount(<Default type="primaryLight" />)
60
+ cy.get(badgeClass).should('have.class', 'bg-primary-light text-primary-bold')
60
61
 
61
62
  mount(<Default type="success" />)
62
- cy.get(badgeClass).should('have.class', 'bg-success-dark')
63
+ cy.get(badgeClass).should('have.class', 'bg-success-dark text-base-1')
63
64
 
64
65
  mount(<Default type="warning" />)
65
- cy.get(badgeClass).should('have.class', 'bg-warning-dark')
66
+ cy.get(badgeClass).should('have.class', 'bg-warning-dark text-base-1')
66
67
 
67
68
  mount(<Default type="danger" />)
68
- cy.get(badgeClass).should('have.class', 'bg-danger-dark')
69
+ cy.get(badgeClass).should('have.class', 'bg-danger-dark text-base-1')
69
70
 
70
71
  mount(<Default type="focus" />)
71
- cy.get(badgeClass).should('have.class', 'bg-focus')
72
+ cy.get(badgeClass).should('have.class', 'bg-focus text-base-1')
72
73
  })
73
74
  })
@@ -1,13 +1,14 @@
1
1
  import React from 'react'
2
2
 
3
3
  const badgeTypes = {
4
- neutral: 'bg-inverted-2',
5
- neutralLight: 'bg-inverted-3',
6
- primary: 'bg-primary-dark',
7
- danger: 'bg-danger-dark',
8
- success: 'bg-success-dark',
9
- warning: 'bg-warning-dark',
10
- focus: 'bg-focus',
4
+ neutral: 'bg-inverted-2 text-base-1',
5
+ neutralLight: 'bg-inverted-3 text-tertiary',
6
+ primary: 'bg-primary-dark text-base-1',
7
+ primaryLight: 'bg-primary-light text-primary-bold',
8
+ danger: 'bg-danger-dark text-base-1',
9
+ success: 'bg-success-dark text-base-1',
10
+ warning: 'bg-warning-dark text-base-1',
11
+ focus: 'bg-focus text-base-1',
11
12
  }
12
13
 
13
14
  const badgeRounded = {
@@ -43,13 +44,7 @@ const BadgeComponent = ({
43
44
  expanded ? 'flex w-full' : 'inline-flex'
44
45
  }`}
45
46
  >
46
- <span
47
- className={`badgeText tracking-4 font-semibold ${
48
- type === 'neutralLight' ? 'text-tertiary' : 'text-base-1'
49
- }`}
50
- >
51
- {text}
52
- </span>
47
+ <span className="badgeText tracking-4 font-semibold">{text}</span>
53
48
  </div>
54
49
  )
55
50
  }
@@ -13,19 +13,24 @@ describe(specTitle('InformationBox tests'), () => {
13
13
  })
14
14
 
15
15
  it('Variants', () => {
16
+ mount(<Default type="success" />)
17
+ cy.get('.InformationBox-title').should('have.class', 'text-success-dark')
18
+ cy.get('.InformationBox-icon').should('have.class', 'icon-check')
19
+ cy.get('.InformationBox').should('have.class', 'bg-success-light')
20
+
16
21
  mount(<Default type="warning" />)
22
+ cy.get('.InformationBox-title').should('have.class', 'text-warning-bold')
17
23
  cy.get('.InformationBox-icon').should('have.class', 'icon-infoCircle')
18
24
  cy.get('.InformationBox').should('have.class', 'bg-warning-light')
19
25
 
20
26
  mount(<Default type="danger" />)
21
- cy.get('.InformationBox-icon').should(
22
- 'have.class',
23
- 'icon-exclamationTriangle'
24
- )
27
+ cy.get('.InformationBox-title').should('have.class', 'text-danger-dark')
28
+ cy.get('.InformationBox-icon').should('have.class', 'icon-exclamationTriangle')
25
29
  cy.get('.InformationBox').should('have.class', 'bg-danger-light')
26
30
 
27
- mount(<Default type="success" />)
28
- cy.get('.InformationBox-icon').should('have.class', 'icon-check')
29
- cy.get('.InformationBox').should('have.class', 'bg-success-light')
31
+ mount(<Default type="info" />)
32
+ cy.get('.InformationBox-title').should('have.class', 'text-focus-dark')
33
+ cy.get('.InformationBox-icon').should('have.class', 'icon-lightbulb')
34
+ cy.get('.InformationBox').should('have.class', 'bg-focus-light')
30
35
  })
31
36
  })
@@ -7,6 +7,7 @@ const InformationBoxTypes: Record<
7
7
  InformationBoxTypesOptions,
8
8
  {
9
9
  title: string
10
+ titleClass: string
10
11
  class: string
11
12
  icon: IconProps['icon']
12
13
  iconClass: string
@@ -14,24 +15,28 @@ const InformationBoxTypes: Record<
14
15
  > = {
15
16
  success: {
16
17
  title: 'Sucesso!',
18
+ titleClass: 'text-success-dark',
17
19
  class: 'bg-success-light dark:bg-success border-success',
18
20
  icon: 'check',
19
21
  iconClass: 'text-success-dark',
20
22
  },
21
23
  warning: {
22
24
  title: 'Atenção!',
25
+ titleClass: 'text-warning-bold',
23
26
  class: 'bg-warning-light border-warning',
24
27
  icon: 'infoCircle',
25
28
  iconClass: 'text-warning-dark',
26
29
  },
27
30
  danger: {
28
31
  title: 'Cuidado!',
32
+ titleClass: 'text-danger-dark',
29
33
  class: 'bg-danger-light border-danger',
30
34
  icon: 'exclamationTriangle',
31
35
  iconClass: 'text-danger-dark',
32
36
  },
33
37
  info: {
34
38
  title: 'Informação',
39
+ titleClass: 'text-focus-dark',
35
40
  class: 'bg-focus-light border-focus-dark',
36
41
  icon: 'lightbulb',
37
42
  iconClass: 'text-focus-dark',
@@ -60,7 +65,7 @@ const InformationBoxComponent = ({
60
65
  <div className="flex-grow flex flex-col sm:flex-row items-start justify-between min-w-0">
61
66
  <div className="flex flex-col justify-center min-w-0 break-words tracking-4 leading-6 text-on-base">
62
67
  <span
63
- className={`InformationBox-title text-f5 font-bold ${InformationBoxTypes[type].iconClass}`}
68
+ className={`InformationBox-title text-f5 font-bold ${InformationBoxTypes[type].titleClass}`}
64
69
  >
65
70
  {title || InformationBoxTypes[type].title}
66
71
  </span>