@loja-integrada/admin-components 0.20.0 → 0.21.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loja-integrada/admin-components",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "author": "Loja Integrada Front-End Team",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -134,7 +134,7 @@
134
134
  "tailwindcss": ">=3.1.0"
135
135
  },
136
136
  "dependencies": {
137
- "@loja-integrada/tailwindcss-config": "^2.0.3",
137
+ "@loja-integrada/tailwindcss-config": "^2.4.0",
138
138
  "@tippyjs/react": "^4.2.5",
139
139
  "@types/react-select": "^4.0.17",
140
140
  "babel-jest": "^29.2.2",
@@ -27,12 +27,12 @@ const commonFocus =
27
27
 
28
28
  const listOfStyles = {
29
29
  primary: `bg-primary text-base-1 ${listOfStylesHover['primary']} ${listOfStylesActive['primary']} ${commonFocus}`,
30
- secondary: `bg-primary-light text-primary-bold ${listOfStylesHover['secondary']} ${listOfStylesActive['secondary']} ${commonFocus}`,
30
+ secondary: `bg-primary-light text-primary-bold komea:bg-secondary komea:text-secondary-bold komea:hover:bg-secondary/80 komea:active:bg-secondary/60 komea:active:shadow-none ${listOfStylesHover['secondary']} ${listOfStylesActive['secondary']} ${commonFocus}`,
31
31
  outlineSecondary: `bg-transparent text-primary border border-primary ${listOfStylesHover['outlineSecondary']} ${listOfStylesActive['outlineSecondary']} ${commonFocus}`,
32
32
  tertiary: `bg-inverted-2 text-on-primary ${listOfStylesHover['tertiary']} ${listOfStylesActive['tertiary']} ${commonFocus}`,
33
33
  warning: `bg-warning text-on-base ${listOfStylesHover['warning']} ${listOfStylesActive['warning']} ${commonFocus}`,
34
34
  danger: `bg-danger text-base-1 ${listOfStylesHover['danger']} ${listOfStylesActive['danger']} ${commonFocus}`,
35
- outline: `bg-transparent text-inverted-2 border border-inverted-2 ${listOfStylesHover['outline']} ${listOfStylesActive['outline']} ${commonFocus}`,
35
+ outline: `bg-transparent text-inverted-2 border border-inverted-2 komea:border-card-stroke komea:bg-base-2 komea:text-on-base komea:hover:bg-primary-light komea:active:bg-secondary komea:active:shadow-none ${listOfStylesHover['outline']} ${listOfStylesActive['outline']} ${commonFocus}`,
36
36
  onlyText: `bg-transparent border-transparent text-inverted-2 px-0 ${listOfStylesHover['onlyText']} ${listOfStylesActive['onlyText']} ${commonFocus}`,
37
37
  }
38
38
 
@@ -49,9 +49,9 @@ const listOfStylesDisabled = {
49
49
  }
50
50
 
51
51
  const listOfSizes = {
52
- small: `text-f6 h-10`,
53
- default: `text-f6 h-12`,
54
- large: `text-f5 h-14`,
52
+ small: `text-f6 komea:h-8 komea:px-3 h-10`,
53
+ default: `text-f6 komea:h-9 h-12`,
54
+ large: `text-f5 komea:h-10 komea:px-6 h-14`,
55
55
  }
56
56
 
57
57
  const ButtonType = React.forwardRef(
@@ -97,7 +97,7 @@ const ButtonComponent = (
97
97
  ;(!disabled || !loading) && onClick && onClick(event)
98
98
  }
99
99
 
100
- let classes = `inline-flex font-medium items-center justify-center px-5 text-center no-underline cursor-pointer transition rounded-md after:align-middle focus:outline-none `
100
+ let classes = `inline-flex font-medium items-center justify-center px-5 komea:px-4 text-center no-underline cursor-pointer transition rounded-md after:align-middle focus:outline-none `
101
101
 
102
102
  if (loading) {
103
103
  classes +=
@@ -57,7 +57,7 @@ const ModalComponent = ({
57
57
  <div {...props}>
58
58
  <div className="ReactModal__header w-full flex justify-between items-start">
59
59
  <span
60
- className={`min-w-0 text-inverted-2 text-xs font-semibold uppercase break-words ${
60
+ className={`min-w-0 text-inverted-2 text-xs font-semibold uppercase komea:font-medium komea:normal-case break-words ${
61
61
  headerTitle ? 'pb-3' : ''
62
62
  }`}
63
63
  >
@@ -150,7 +150,7 @@ const TableComponent = ({
150
150
  <table
151
151
  {...getTableProps()}
152
152
  id={id}
153
- className={`w-full bg-base-1 rounded border-separate border border-card-stroke`}
153
+ className={`w-full bg-base-1 rounded komea:rounded-xs border-separate border border-card-stroke`}
154
154
  cellSpacing="0"
155
155
  >
156
156
  <thead className={`text-left`}>
@@ -49,7 +49,7 @@ const CheckboxComponent = (
49
49
  isChecked || isIndeterminate ? 'scale-100' : 'scale-0'
50
50
  }`
51
51
 
52
- const checkboxIconContainerClasses = `border border-card-stroke transition duration-200 ease-in-out
52
+ const checkboxIconContainerClasses = `border border-card-stroke komea:border-input-stroke komea:shadow-sm transition duration-200 ease-in-out
53
53
  ${
54
54
  disabled
55
55
  ? 'bg-base-4'
@@ -87,7 +87,7 @@ const CheckboxComponent = (
87
87
  htmlFor={inputId}
88
88
  className={`inline-flex ${alignOptions[boxAlign]} cursor-pointer`}
89
89
  >
90
- <span className="relative rounded-xs z-10 flex items-center justify-center focus-within:ring-2 ring-focus">
90
+ <span className="relative rounded-xs z-10 flex items-center justify-center focus-within:ring-2 komea:focus-within:ring-[3px] ring-focus komea:ring-focus/50">
91
91
  <input
92
92
  ref={ref || inputRef}
93
93
  type="checkbox"
@@ -13,9 +13,9 @@ import { InputHelpText } from '../InputHelpText'
13
13
  import { InputLabel, InputLabelProps } from '../InputLabel'
14
14
 
15
15
  export const sizeClasses = {
16
- default: 'h-12',
16
+ default: 'komea:h-9 h-12',
17
17
  small: 'h-8',
18
- large: 'h-14',
18
+ large: 'komea:h-10 h-14',
19
19
  xlarge: 'h-24',
20
20
  }
21
21
 
@@ -27,7 +27,8 @@ export const valueFontSizesClasses = {
27
27
  }
28
28
 
29
29
  export const variantControlClasses = {
30
- default: 'border-card-stroke rounded pl-2',
30
+ default:
31
+ 'border-card-stroke rounded pl-2 komea:border-input-stroke komea:shadow-sm',
31
32
  secondary:
32
33
  'border-inverted-2 hover:bg-base-3 rounded-md focus:ring-2 focus:ring-focus focus:ring-offset-2 focus:bg-base-1 pl-2',
33
34
  simple: 'border-0 border-b border-on-base-3',
@@ -59,7 +59,7 @@ const InputComponent = (
59
59
  inputContainerClass += ` ${defaultBorderClasses}`
60
60
  }
61
61
 
62
- const inputClass = `w-full px-4 appearance-none shadow-none outline-none bg-transparent box-border ${focusClass} ${
62
+ const inputClass = `w-full px-4 komea:px-3 appearance-none shadow-none outline-none bg-transparent box-border ${focusClass} ${
63
63
  hasErrorState ? errorBorderClasses : defaultBorderClasses
64
64
  } ${prefix && prefixBorder ? 'border-l' : ''} ${
65
65
  sufix && sufixBorder ? 'border-r' : ''
@@ -51,7 +51,7 @@ const ToggleComponent = (
51
51
 
52
52
  const toggleCircleClasses = `transform ${toggleClasses.circle[toggleCheckText][toggleStatusText]} absolute left-[6px] top-[6px] w-5 h-5 rounded-full transition`
53
53
 
54
- const toggleLabelClasses = `ml-2 text-inverted-1 text-f6 label`
54
+ const toggleLabelClasses = `ml-2 text-inverted-1 text-f6 komea:font-medium label`
55
55
 
56
56
  return (
57
57
  <label
@@ -5,15 +5,16 @@ export const inputContainerDisabledClasses =
5
5
 
6
6
  export const inputContainerReadonlyClasses = '!bg-base-2'
7
7
 
8
- export const errorBorderClasses = 'border-danger focus:border-danger'
8
+ export const errorBorderClasses =
9
+ 'border-danger focus:border-danger komea:focus:ring-danger/20'
9
10
 
10
- export const defaultBorderClasses = 'border-card-stroke'
11
+ export const defaultBorderClasses = 'border-card-stroke komea:border-input-stroke'
11
12
 
12
13
  export const focusClass = 'focus:border-inverted-1'
13
14
 
14
- export const inputClasses = `appearance-none shadow-none outline-none bg-base-1 border px-4 rounded text-on-base text-sm min-w-0 w-full transition-border duration-75 ${focusClass} ${inputPlaceholderClasses}`
15
+ export const inputClasses = `appearance-none shadow-none outline-none bg-base-1 border px-4 rounded text-on-base text-sm min-w-0 w-full transition-border duration-75 komea:border-input-stroke komea:px-3 komea:shadow-sm komea:text-body-large md:komea:text-body komea:focus:border-focus komea:focus:ring-[3px] komea:focus:ring-focus/50 ${focusClass} ${inputPlaceholderClasses}`
15
16
 
16
- export const inputContainerClasses = `flex focus-within:border-inverted-1 bg-base-1 border rounded text-on-base text-sm min-w-0 w-full transition-border duration-75 overflow-hidden ${inputPlaceholderClasses}`
17
+ export const inputContainerClasses = `flex focus-within:border-inverted-1 bg-base-1 border rounded text-on-base text-sm min-w-0 w-full transition-border duration-75 overflow-hidden komea:border-input-stroke komea:shadow-sm komea:text-body-large md:komea:text-body komea:focus-within:border-focus komea:focus-within:ring-[3px] komea:focus-within:ring-focus/50 ${inputPlaceholderClasses}`
17
18
 
18
19
  const adornmentClasses = `adornment flex justify-center items-center relative w-16 text-f6 text-inverted-2 -mt-px`
19
20
 
@@ -22,8 +23,8 @@ export const prefixClasses = `${adornmentClasses} rounded-l left-0`
22
23
  export const sufixClasses = `${adornmentClasses} rounded-r right-0`
23
24
 
24
25
  export const variantClasses = {
25
- default: 'h-12',
26
- small: 'h-10',
27
- large: 'h-14',
26
+ default: 'komea:h-9 h-12',
27
+ small: 'komea:h-8 h-10',
28
+ large: 'komea:h-10 h-14',
28
29
  xlarge: 'h-24',
29
30
  }
@@ -36,7 +36,7 @@ describe(specTitle('Alert tests'), () => {
36
36
  cy.get('.alert').should('have.class', 'bg-danger-light')
37
37
 
38
38
  mount(<Default type="info" />)
39
- cy.get('.alert').should('have.class', 'bg-focus-light')
39
+ cy.get('.alert').should('have.class', 'bg-info-light')
40
40
 
41
41
  mount(<Default type="primary" />)
42
42
  cy.get('.alert').should('have.class', 'bg-primary-light')
@@ -16,42 +16,51 @@ const alertTypes: Record<
16
16
  class: string
17
17
  icon: IconProps['icon']
18
18
  iconClass: string
19
+ textClass: string
19
20
  }
20
21
  > = {
21
22
  success: {
22
- class: 'bg-success-light border-success',
23
+ class: 'bg-success-light border-success komea:border-success-stroke',
23
24
  icon: 'checkCircle',
24
- iconClass: 'text-success',
25
+ iconClass: 'text-success komea:text-success-dark',
26
+ textClass: 'komea:text-success-dark',
25
27
  },
26
28
  warning: {
27
- class: 'bg-warning-light border-warning-dark',
29
+ class: 'bg-warning-light border-warning-dark komea:border-warning-stroke',
28
30
  icon: 'exclamationTriangle',
29
31
  iconClass: 'text-warning-dark',
32
+ textClass: 'komea:text-warning-dark',
30
33
  },
31
34
  danger: {
32
- class: 'bg-danger-light border-danger',
35
+ class: 'bg-danger-light border-danger komea:border-danger-stroke',
33
36
  icon: 'ban',
34
- iconClass: 'text-danger',
37
+ iconClass: 'text-danger komea:text-danger-dark',
38
+ textClass: 'komea:text-danger-dark',
35
39
  },
36
40
  info: {
37
- class: 'bg-focus-light border-focus-dark',
41
+ class: 'bg-info-light border-info-dark komea:border-info-stroke',
38
42
  icon: 'infoCircle',
39
- iconClass: 'text-focus-dark',
43
+ iconClass: 'text-info-dark',
44
+ textClass: 'komea:text-info-dark',
40
45
  },
41
46
  infoOutline: {
42
- class: 'bg-base-1 border-focus-dark',
47
+ class: 'bg-base-1 border-info-dark komea:border-info-stroke',
43
48
  icon: 'infoCircle',
44
- iconClass: 'text-focus-dark',
49
+ iconClass: 'text-info-dark',
50
+ textClass: '',
45
51
  },
46
52
  infoDark: {
47
- class: 'bg-base-1 border-[#607081]',
53
+ // O hex cravado não acompanha o `data-chrome`; na chrome nova cai no neutro do design system.
54
+ class: 'bg-base-1 border-[#607081] komea:border-card-stroke',
48
55
  icon: 'infoCircle',
49
- iconClass: 'text-[#607081]',
56
+ iconClass: 'text-[#607081] komea:text-on-base-2',
57
+ textClass: '',
50
58
  },
51
59
  primary: {
52
- class: 'bg-primary-light border-primary',
60
+ class: 'bg-primary-light border-primary komea:border-card-stroke',
53
61
  icon: 'infoCircle',
54
62
  iconClass: 'text-primary',
63
+ textClass: '',
55
64
  },
56
65
  }
57
66
 
@@ -80,7 +89,7 @@ const AlertComponent = ({
80
89
  if (!alertIsOpen) return null
81
90
  return (
82
91
  <div
83
- className={`alert border-l-4 py-4 pl-6 pr-5 rounded w-full relative flex items-start sm:items-center ${
92
+ className={`alert border-l-4 komea:border-l py-4 pl-6 pr-5 rounded w-full relative flex items-start sm:items-center ${
84
93
  alertTypes[type].class
85
94
  }${hideBorder ? '' : ' border'}`}
86
95
  >
@@ -95,9 +104,17 @@ const AlertComponent = ({
95
104
  </div>
96
105
  )}
97
106
  <div className="flex-grow flex flex-col sm:flex-row items-start sm:items-center justify-between min-w-0">
98
- <div className="flex flex-col justify-center min-w-0 break-words text-f6 text-on-base">
99
- <span className="alert-title font-semibold">{title}</span>
100
- {subtitle && <span className="alert-subtitle mt-1">{subtitle}</span>}
107
+ <div
108
+ className={`flex flex-col justify-center min-w-0 break-words text-f6 text-on-base ${alertTypes[type].textClass}`}
109
+ >
110
+ <span className="alert-title font-semibold komea:font-medium">
111
+ {title}
112
+ </span>
113
+ {subtitle && (
114
+ <span className="alert-subtitle komea:text-caption mt-1">
115
+ {subtitle}
116
+ </span>
117
+ )}
101
118
  </div>
102
119
  {actions && (
103
120
  <div className="alert-actions flex flex-shrink-0 items-center flex-row sm:flex-row-reverse sm:space-x-reverse space-x-3 mt-3 sm:mt-0 sm:ml-5">
@@ -69,6 +69,6 @@ describe(specTitle('Badge tests'), () => {
69
69
  cy.get(badgeClass).should('have.class', 'bg-danger-dark text-base-1')
70
70
 
71
71
  mount(<Default type="focus" />)
72
- cy.get(badgeClass).should('have.class', 'bg-focus text-base-1')
72
+ cy.get(badgeClass).should('have.class', 'bg-info text-base-1')
73
73
  })
74
74
  })
@@ -8,7 +8,7 @@ const badgeTypes = {
8
8
  danger: 'bg-danger-dark text-base-1',
9
9
  success: 'bg-success-dark text-base-1',
10
10
  warning: 'bg-warning-dark text-base-1',
11
- focus: 'bg-focus text-base-1',
11
+ focus: 'bg-info text-base-1',
12
12
  }
13
13
 
14
14
  const badgeRounded = {
@@ -29,9 +29,9 @@ describe(specTitle('InformationBox tests'), () => {
29
29
  cy.get('.InformationBox').should('have.class', 'bg-danger-light')
30
30
 
31
31
  mount(<Default type="info" />)
32
- cy.get('.InformationBox-title').should('have.class', 'text-focus-dark')
32
+ cy.get('.InformationBox-title').should('have.class', 'text-info-dark')
33
33
  cy.get('.InformationBox-icon').should('have.class', 'icon-lightbulb')
34
- cy.get('.InformationBox').should('have.class', 'bg-focus-light')
34
+ cy.get('.InformationBox').should('have.class', 'bg-info-light')
35
35
  })
36
36
 
37
37
  it('Close button', () => {
@@ -36,10 +36,10 @@ const InformationBoxTypes: Record<
36
36
  },
37
37
  info: {
38
38
  title: 'Informação',
39
- titleClass: 'text-focus-dark',
40
- class: 'bg-focus-light border-focus-dark',
39
+ titleClass: 'text-info-dark',
40
+ class: 'bg-info-light border-info-dark komea:border-info-stroke',
41
41
  icon: 'lightbulb',
42
- iconClass: 'text-focus-dark',
42
+ iconClass: 'text-info-dark',
43
43
  },
44
44
  }
45
45
 
package/src/tailwind.scss CHANGED
@@ -2,7 +2,7 @@
2
2
  @tailwind components;
3
3
  @tailwind utilities;
4
4
 
5
- @import '@loja-integrada/tailwindcss-config/styles/_variables.scss';
5
+ @import '@loja-integrada/tailwindcss-config/styles/variables';
6
6
 
7
7
  body {
8
8
  @apply antialiased;