@liguelead/design-system 0.0.36 → 0.0.37

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.
@@ -13,7 +13,7 @@ export const AlertContainer = styled.div<{ $variant: string }>`
13
13
 
14
14
  export const AlertContent = styled.div`
15
15
  display: flex;
16
- gap: 8px;
16
+ gap: ${spacing.spacing8}px;
17
17
  `;
18
18
 
19
19
  export const AlertButtonContainer = styled.div`
@@ -1,3 +1,4 @@
1
+ import { useTheme } from 'styled-components'
1
2
  import Text from '../Text'
2
3
  import LinkButton from '../LinkButton'
3
4
 
@@ -21,7 +22,8 @@ const Alert = ({
21
22
  title,
22
23
  hasButton
23
24
  }: TAlertProps) => {
24
- const alertVariant = AlertVariant(variant)
25
+ const theme = useTheme()
26
+ const alertVariant = AlertVariant(variant, theme)
25
27
 
26
28
  return (
27
29
  <AlertContainer $variant={alertVariant} className={className}>
@@ -1,11 +1,9 @@
1
1
  import { parseColor } from '../../utils'
2
- import { useTheme } from 'styled-components'
2
+ import { DefaultTheme } from 'styled-components'
3
3
 
4
4
  type TVariant = 'success' | 'danger' | 'warning' | 'info' | 'default'
5
5
 
6
- export const AlertVariant = (variant: TVariant) => {
7
- const theme = useTheme()
8
-
6
+ export const AlertVariant = (variant: TVariant, theme: DefaultTheme) => {
9
7
  const variants = {
10
8
  success: `
11
9
  border-left: 8px solid ${parseColor(theme.colors.success100)};
@@ -1,15 +1,14 @@
1
1
  import { ButtonVariantTypes } from './Button.types'
2
2
  import { colorType } from '../../types'
3
- import { useTheme } from 'styled-components'
3
+ import { DefaultTheme } from 'styled-components'
4
4
  import { darkenOrLighten, getTextColor, parseColor, getHoverColor } from '../../utils'
5
5
 
6
6
 
7
7
  export const ButtonVariant = (
8
8
  color: colorType,
9
- variant: ButtonVariantTypes
9
+ variant: ButtonVariantTypes,
10
+ theme: DefaultTheme
10
11
  ) => {
11
- const theme = useTheme();
12
-
13
12
  const colorValue = theme.colors[color];
14
13
 
15
14
  if (!colorValue) {
@@ -11,7 +11,6 @@ export interface StyledButtonProps extends ButtonProps {
11
11
  export const StyledButton = styled.button<StyledButtonProps>`
12
12
  position: relative;
13
13
  display: flex;
14
- outline: none !important;
15
14
  justify-content: center;
16
15
  align-items: center;
17
16
  width: ${({ $fullWidth }) => ($fullWidth ? '100%' : 'auto')};
@@ -1,4 +1,5 @@
1
1
  import { useState } from 'react'
2
+ import { useTheme } from 'styled-components'
2
3
  import { StyledButton, RippleContainer } from './Button.styles'
3
4
  import { RippleInterface, ButtonProps } from './Button.types'
4
5
  import { ButtonSizes } from './Button.sizes'
@@ -16,14 +17,11 @@ const Button: React.FC<ButtonProps> = ({
16
17
  type = 'button',
17
18
  ...rest
18
19
  }) => {
20
+ const theme = useTheme()
19
21
  const [ripples, setRipples] = useState<RippleInterface[]>([])
20
22
 
21
23
  const buttonSize = ButtonSizes(size)
22
- const buttonVariant = ButtonVariant(color, variant)
23
-
24
- const removeRipple = (ripples: RippleInterface[], rippleId: string) => {
25
- return ripples.filter(r => r.id !== rippleId)
26
- }
24
+ const buttonVariant = ButtonVariant(color, variant, theme)
27
25
 
28
26
  const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
29
27
  const rect = e.currentTarget.getBoundingClientRect()
@@ -37,7 +35,6 @@ const Button: React.FC<ButtonProps> = ({
37
35
  }
38
36
  setRipples(prev => [...prev, newRipple])
39
37
 
40
- // Chama o onClick fornecido
41
38
  if (onClick) {
42
39
  onClick(e)
43
40
  }
@@ -65,7 +62,7 @@ const Button: React.FC<ButtonProps> = ({
65
62
  height: 20
66
63
  }}
67
64
  onAnimationEnd={() =>
68
- setRipples(prev => removeRipple(prev, ripple.id))
65
+ setRipples(prev => prev.filter(r => r.id !== ripple.id))
69
66
  }
70
67
  />
71
68
  ))}
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { CheckboxProps } from './Checkbox.types'
3
3
  import {
4
4
  CheckboxWrapper,
@@ -31,9 +31,9 @@ const Checkbox: React.FC<CheckboxProps> = ({
31
31
  )
32
32
  const [ripples, setRipples] = useState<RippleInterface[]>([])
33
33
 
34
- const removeRipple = (ripples: RippleInterface[], rippleId: string) => {
35
- return ripples.filter(r => r.id !== rippleId)
36
- }
34
+ useEffect(() => {
35
+ if (checked !== undefined) setInternalChecked(checked)
36
+ }, [checked])
37
37
 
38
38
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
39
39
  onChange?.(e)
@@ -78,7 +78,7 @@ const Checkbox: React.FC<CheckboxProps> = ({
78
78
  height: 20
79
79
  }}
80
80
  onAnimationEnd={() =>
81
- setRipples(prev => removeRipple(prev, ripple.id))
81
+ setRipples(prev => prev.filter(r => r.id !== ripple.id))
82
82
  }
83
83
  />
84
84
  ))}
@@ -9,6 +9,7 @@ export const Overlay = styled(DialogPrimitive.Overlay)`
9
9
  background: rgba(0, 0, 0, 0.3);
10
10
  position: fixed;
11
11
  inset: 0;
12
+ z-index: 9999;
12
13
  `
13
14
 
14
15
  export const Content = styled(DialogPrimitive.Content)<{$centerContent?: boolean}>`
@@ -27,7 +28,7 @@ export const Content = styled(DialogPrimitive.Content)<{$centerContent?: boolean
27
28
  top: 8vh;
28
29
  left: 50%;
29
30
  transform: translateX(-50%);
30
- z-index: 99999;
31
+ z-index: 10000;
31
32
  `
32
33
 
33
34
  export const TitleDescriptionContainer = styled.div<{$centerContent?: boolean, $variant?: variant}>`
@@ -40,7 +40,7 @@ export const Dialog: React.FC<TDialogProps> = ({
40
40
  onOpenChange={onOpenChange}
41
41
  >
42
42
  {trigger
43
- && <DialogPrimitive.Trigger asChild className={className} >
43
+ && <DialogPrimitive.Trigger asChild>
44
44
  {trigger}
45
45
  </DialogPrimitive.Trigger>
46
46
  }
@@ -85,15 +85,13 @@ export const Dialog: React.FC<TDialogProps> = ({
85
85
  )}
86
86
 
87
87
  <ButtonContainer $centerContent={centerContent}>
88
- <DialogPrimitive.Close asChild>
89
- {cancelButton && (
90
- <Button
91
- variant="neutralOutline"
92
- >
88
+ {cancelButton && (
89
+ <DialogPrimitive.Close asChild>
90
+ <Button variant="neutralOutline">
93
91
  {cancelLabel}
94
92
  </Button>
95
- )}
96
- </DialogPrimitive.Close>
93
+ </DialogPrimitive.Close>
94
+ )}
97
95
 
98
96
  {confirmButton && (
99
97
  <Button
@@ -1,4 +1,5 @@
1
1
  import { useState } from 'react'
2
+ import { useTheme } from 'styled-components'
2
3
  import { ButtonProps, RippleInterface } from '../Button/Button.types'
3
4
  import { ButtonVariant } from '../Button/Button.appearance'
4
5
  import { IconButtonSizes } from './IconButton.sizes'
@@ -15,10 +16,11 @@ const IconButton: React.FC<ButtonProps> = ({
15
16
  onClick,
16
17
  ...rest
17
18
  }) => {
19
+ const theme = useTheme()
18
20
  const [ripples, setRipples] = useState<RippleInterface[]>([])
19
21
 
20
22
  const buttonSize = IconButtonSizes(size)
21
- const buttonVariant = ButtonVariant(color, variant)
23
+ const buttonVariant = ButtonVariant(color, variant, theme)
22
24
 
23
25
  const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
24
26
  const rect = e.currentTarget.getBoundingClientRect()
@@ -1,4 +1,5 @@
1
1
  import React, { useState } from 'react'
2
+ import { useTheme } from 'styled-components'
2
3
  import { LinkAnchor, StyledLinkButton } from './LinkButton.style'
3
4
  import { RippleContainer } from '../Button/Button.styles'
4
5
  import { RippleInterface } from '../Button/Button.types'
@@ -19,8 +20,9 @@ const LinkButton: React.FC<LinkButtonProps> = ({
19
20
  size = 'md',
20
21
  ...rest
21
22
  }) => {
23
+ const theme = useTheme()
22
24
  const [ripples, setRipples] = useState<RippleInterface[]>([])
23
- const buttonVariant = ButtonVariant(color, variant)
25
+ const buttonVariant = ButtonVariant(color, variant, theme)
24
26
  const buttonSize = LinkButtonSizes(size)
25
27
 
26
28
  const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
@@ -16,7 +16,7 @@ const PageWrapper = styled.div.withConfig({
16
16
  })<WrapperProps>`
17
17
  width: 100%;
18
18
  height: 100%;
19
- max-width: ${({width}) => width + 'px' || '100%'};
19
+ max-width: ${({width}) => width ? width + 'px' : '100%'};
20
20
  margin: 0 auto;
21
21
  padding: ${({padding}) =>
22
22
  padding ? spacing[padding] + 'px' : spacing.spacing16 + 'px'};
@@ -25,7 +25,7 @@ const SplitButton: React.FC<SplitButtonProps> = ({
25
25
  className
26
26
  }) => {
27
27
  const theme = useTheme()
28
- const buttonVariant = ButtonVariant(color, variant)
28
+ const buttonVariant = ButtonVariant(color, variant, theme)
29
29
  const buttonSize = ButtonSizes(size)
30
30
  const triggerSize = SplitButtonTriggerSizes(size)
31
31
 
@@ -15,6 +15,8 @@ const Tabs: React.FC<TabsProps> = ({
15
15
  {items.map(item => (
16
16
  <Button
17
17
  key={item.key}
18
+ aria-controls={`tab-${item.key}`}
19
+ aria-selected={activeKey === item.key}
18
20
  variant={activeKey === item.key ? 'solid' : 'neutralGhost'}
19
21
  color={activeKey === item.key ? 'primary' : undefined}
20
22
  size="sm"
@@ -138,9 +138,11 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
138
138
  className={className}
139
139
  size={textFieldSize}
140
140
  $themefication={textFieldState}>
141
- <Label>
142
- {label} {requiredSymbol && <RequiredAsterisk />}
143
- </Label>
141
+ {label && (
142
+ <Label>
143
+ {label} {requiredSymbol && <RequiredAsterisk />}
144
+ </Label>
145
+ )}
144
146
  <InputWrapper
145
147
  as="label"
146
148
  onDragOver={handleDragOver}
@@ -181,10 +183,13 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
181
183
  <Wrapper
182
184
  className={className}
183
185
  size={textFieldSize}
184
- $themefication={textFieldState}>
185
- <Label>
186
- {label} {requiredSymbol && <RequiredAsterisk />}
187
- </Label>
186
+ $themefication={textFieldState}
187
+ >
188
+ {label && (
189
+ <Label>
190
+ {label} {requiredSymbol && <RequiredAsterisk />}
191
+ </Label>
192
+ )}
188
193
  <InputWrapper>
189
194
  {leftIcon && (
190
195
  <IconWrapper onClick={handleLeftIcon}>
@@ -1,4 +1,4 @@
1
- import { toast, ToastOptions } from "react-toastify"
1
+ import { toast, ToastOptions } from 'react-toastify'
2
2
 
3
3
  const defaultOptions: ToastOptions = {
4
4
  position: 'top-right',
@@ -11,23 +11,6 @@ const defaultOptions: ToastOptions = {
11
11
 
12
12
  export type ToastType = 'success' | 'error' | 'warning' | 'info'
13
13
 
14
- export const triggerToast = (type: ToastType, message: string, options?: ToastOptions) => {
15
- const mergedOptions = { ...defaultOptions, ...options }
16
-
17
- switch (type) {
18
- case 'success':
19
- return toast.success(message, mergedOptions)
20
- case 'error':
21
- return toast.error(message, mergedOptions)
22
- case 'warning':
23
- return toast.warning(message, mergedOptions)
24
- case 'info':
25
- return toast.info(message, mergedOptions)
26
- default:
27
- return toast(message, mergedOptions)
28
- }
29
- }
30
-
31
14
  const Toaster = {
32
15
  success: (message: string, options?: ToastOptions) =>
33
16
  toast.success(message, { ...defaultOptions, ...options }),
@@ -42,4 +25,7 @@ const Toaster = {
42
25
  toast.info(message, { ...defaultOptions, ...options })
43
26
  }
44
27
 
45
- export default Toaster;
28
+ export const triggerToast = (type: ToastType, message: string, options?: ToastOptions) =>
29
+ Toaster[type](message, options)
30
+
31
+ export default Toaster
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liguelead/design-system",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "type": "module",
5
5
  "main": "components/index.ts",
6
6
  "publishConfig": {