@loja-integrada/admin-components 0.21.0 → 0.21.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.21.0",
3
+ "version": "0.21.2",
4
4
  "author": "Loja Integrada Front-End Team",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -48,10 +48,16 @@ const listOfStylesDisabled = {
48
48
  onlyText: `bg-transparent text-on-base-3 shadow-none ring-0 border-0 `,
49
49
  }
50
50
 
51
+ const listOfSizePaddings = {
52
+ small: `komea:px-3`,
53
+ default: ``,
54
+ large: `komea:px-6`,
55
+ }
56
+
51
57
  const listOfSizes = {
52
- small: `text-f6 komea:h-8 komea:px-3 h-10`,
58
+ small: `text-f6 komea:h-8 h-10`,
53
59
  default: `text-f6 komea:h-9 h-12`,
54
- large: `text-f5 komea:h-10 komea:px-6 h-14`,
60
+ large: `text-f5 komea:h-10 h-14`,
55
61
  }
56
62
 
57
63
  const ButtonType = React.forwardRef(
@@ -97,7 +103,13 @@ const ButtonComponent = (
97
103
  ;(!disabled || !loading) && onClick && onClick(event)
98
104
  }
99
105
 
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 `
106
+ // `onlyText` é o único que não tem caixa, e o padding horizontal fica fora dele. Não dá para
107
+ // apenas parear com `komea:px-0`: as duas classes empatam em especificidade e o Tailwind emite
108
+ // `px-0` antes de `px-3`/`px-4`/`px-6`, então o zero perderia pela ordem.
109
+ const horizontalPadding =
110
+ variant === 'onlyText' ? '' : `px-5 komea:px-4 ${listOfSizePaddings[size]}`
111
+
112
+ let classes = `inline-flex font-semibold komea:font-medium items-center justify-center ${horizontalPadding} text-center no-underline cursor-pointer transition rounded-md after:align-middle focus:outline-none `
101
113
 
102
114
  if (loading) {
103
115
  classes +=
@@ -211,7 +211,7 @@ const TableComponent = ({
211
211
  <tr>
212
212
  <td colSpan={columnsLength || 1} className={`${TdClasses}`}>
213
213
  <TdWrapper>
214
- <div className="text-center py-16 text-xl font-medium text-on-base-2">
214
+ <div className="text-center py-16 text-xl font-semibold komea:font-medium text-on-base-2">
215
215
  {emptyText}
216
216
  </div>
217
217
  </TdWrapper>
@@ -60,7 +60,7 @@ const TableListComponent = ({
60
60
  {empty.illustration}
61
61
  </div>
62
62
  )}
63
- <div className="table-list-empty-title text-center text-f4 font-medium text-primary-bold">
63
+ <div className="table-list-empty-title text-center text-f4 font-semibold komea:font-medium text-primary-bold">
64
64
  {empty.title}
65
65
  </div>
66
66
  {empty.subTitle && (
@@ -54,7 +54,7 @@ const CheckboxComponent = (
54
54
  disabled
55
55
  ? 'bg-base-4'
56
56
  : isChecked || isIndeterminate
57
- ? 'bg-primary border-primary'
57
+ ? 'bg-primary border-primary komea:border-primary'
58
58
  : 'bg-base-1'
59
59
  }
60
60
  ${isCenterBoxAlign ? 'items-center' : ''}
@@ -9,7 +9,9 @@ import {
9
9
  defaultBorderClasses,
10
10
  inputContainerClasses,
11
11
  variantClasses,
12
+ prefixBorderlessKomeaClasses,
12
13
  prefixClasses,
14
+ sufixBorderlessKomeaClasses,
13
15
  sufixClasses,
14
16
  focusClass,
15
17
  } from '../commonStyles'
@@ -42,11 +44,11 @@ const InputComponent = (
42
44
 
43
45
  const prefixClass = `${prefixClasses} ${variantClasses[variant]} ${
44
46
  hasErrorState ? errorBorderClasses : ''
45
- }`
47
+ } ${prefixBorder ? '' : prefixBorderlessKomeaClasses}`
46
48
 
47
49
  const sufixClass = `${sufixClasses} ${variantClasses[variant]} ${
48
50
  hasErrorState ? errorBorderClasses : ''
49
- }`
51
+ } ${sufixBorder ? '' : sufixBorderlessKomeaClasses}`
50
52
 
51
53
  let inputContainerClass = `${inputContainerClasses} ${variantClasses[variant]}`
52
54
  if (disabled) {
@@ -63,8 +65,8 @@ const InputComponent = (
63
65
  hasErrorState ? errorBorderClasses : defaultBorderClasses
64
66
  } ${prefix && prefixBorder ? 'border-l' : ''} ${
65
67
  sufix && sufixBorder ? 'border-r' : ''
66
- } ${prefix && !prefixBorder ? 'pl-0' : ''} ${
67
- sufix && !sufixBorder ? 'pr-0' : ''
68
+ } ${prefix && !prefixBorder ? 'pl-0 komea:pl-2' : ''} ${
69
+ sufix && !sufixBorder ? 'pr-0 komea:pr-2' : ''
68
70
  }`
69
71
 
70
72
  const LabelComponent = (
@@ -12,7 +12,7 @@ export const InputLabel = React.memo(
12
12
  if (!label) return null
13
13
  return (
14
14
  <label
15
- className={`input-label text-f6 font-medium inline-flex items-center mb-0.5 ${
15
+ className={`input-label text-f6 font-semibold komea:font-medium inline-flex items-center mb-0.5 ${
16
16
  hasError ? 'text-danger' : 'text-on-base'
17
17
  } ${className}`}
18
18
  htmlFor={htmlFor}
@@ -1,23 +1,44 @@
1
1
  export const inputPlaceholderClasses = 'placeholder-on-base-2'
2
2
 
3
3
  export const inputContainerDisabledClasses =
4
- '!bg-base-3 !pointer-events-none !text-on-base-2'
4
+ '!bg-base-3 !pointer-events-none !text-on-base-2 komea:!bg-base-1 komea:!text-on-base komea:opacity-50'
5
5
 
6
6
  export const inputContainerReadonlyClasses = '!bg-base-2'
7
7
 
8
8
  export const errorBorderClasses =
9
- 'border-danger focus:border-danger komea:focus:ring-danger/20'
9
+ 'border-danger focus:border-danger komea:focus-within:border-danger komea:focus-within:ring-danger/20'
10
10
 
11
- export const defaultBorderClasses = 'border-card-stroke komea:border-input-stroke'
11
+ export const defaultBorderClasses =
12
+ 'border-card-stroke komea:border-input-stroke komea:focus-within:border-focus komea:focus-within:ring-focus/50'
12
13
 
13
14
  export const focusClass = 'focus:border-inverted-1'
14
15
 
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}`
16
+ 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:px-3 komea:shadow-sm komea:text-body-large md:komea:text-body komea:focus-within:ring-[3px] ${focusClass} ${inputPlaceholderClasses}`
16
17
 
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}`
18
+ 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:shadow-sm komea:text-body-large md:komea:text-body komea:focus-within:ring-[3px] ${inputPlaceholderClasses}`
18
19
 
19
20
  const adornmentClasses = `adornment flex justify-center items-center relative w-16 text-f6 text-inverted-2 -mt-px`
20
21
 
22
+ // Sem borda o adorno não é uma caixa, é o addon do komea-ds: 12px de recuo, ícone de 16px e 8px até
23
+ // o valor.
24
+ //
25
+ // O ícone é normalizado porque o default do nosso `Icon` é 5 (20px) e o DS usa 16 nos campos — é o
26
+ // que torna a geometria determinística em vez de depender do `size` que a app passou. Descendente e
27
+ // não filho direto (`[&_svg]`, não `[&>svg]`) porque a app pode embrulhar o ícone: o campo de busca
28
+ // põe um `<button>` no meio. E `h-4 w-4` em vez de `size-4`, porque `size-*` só existe do Tailwind
29
+ // 3.4 em diante e há app desta linha pinada em 3.3.0, onde a classe não seria gerada.
30
+ //
31
+ // Os 8px até o valor saem do padding do **campo**, não do adorno: um filho `w-full` — o botão do
32
+ // campo de busca — ocuparia a caixa de conteúdo inteira e comeria um padding posto aqui.
33
+ //
34
+ // `shrink-0` porque o adorno é item flex: sem ele o `w-7` é só uma base e o navegador comprime a
35
+ // caixa quando o campo é estreito, levando a geometria junto.
36
+ const borderlessKomeaIcon = 'komea:[&_svg]:h-4 komea:[&_svg]:w-4'
37
+
38
+ export const prefixBorderlessKomeaClasses = `komea:w-7 komea:shrink-0 komea:justify-start komea:pl-3 ${borderlessKomeaIcon}`
39
+
40
+ export const sufixBorderlessKomeaClasses = `komea:w-7 komea:shrink-0 komea:justify-end komea:pr-3 ${borderlessKomeaIcon}`
41
+
21
42
  export const prefixClasses = `${adornmentClasses} rounded-l left-0`
22
43
 
23
44
  export const sufixClasses = `${adornmentClasses} rounded-r right-0`
@@ -34,7 +34,7 @@ const Container = () => {
34
34
  return (
35
35
  <ToastContainer
36
36
  toastClassName={(props) =>
37
- `mb-3 border flex items-top justify-between p-3 pb-4 pr-4 relative rounded shadow-md ${
37
+ `mb-3 border flex items-top justify-between p-3 pb-4 pr-4 relative rounded shadow-md overflow-hidden ${
38
38
  contextClass[props?.type || 'info']
39
39
  }`
40
40
  }
@@ -30,7 +30,7 @@ export const BoxHeader = React.memo(
30
30
  >
31
31
  <div className="flex-1 min-w-0 mr-2">
32
32
  {title && (
33
- <h3 className="text-f5 font-medium break-words lg:text-f4">
33
+ <h3 className="text-f5 font-semibold komea:font-medium break-words lg:text-f4">
34
34
  {title}
35
35
  </h3>
36
36
  )}