@alume/alume-design-system 4.13.21 → 4.13.22

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.
Files changed (67) hide show
  1. package/dist/assets/icons/email.js +3 -3
  2. package/dist/assets/icons/index.d.ts +2 -0
  3. package/dist/assets/icons/index.js +2 -0
  4. package/dist/assets/icons/send-email.d.ts +2 -0
  5. package/dist/assets/icons/send-email.js +4 -0
  6. package/dist/assets/icons/whatsapp-support.d.ts +2 -0
  7. package/dist/assets/icons/whatsapp-support.js +4 -0
  8. package/dist/assets/icons/whatsapp.js +3 -3
  9. package/dist/components/autocomplete-input/autocompleteInput.component.d.ts +3 -1
  10. package/dist/components/autocomplete-input/autocompleteInput.component.js +5 -4
  11. package/dist/components/autocomplete-input/autocompleteInput.styled.d.ts +2 -0
  12. package/dist/components/autocomplete-input/autocompleteInput.styled.js +15 -2
  13. package/dist/components/button/button.component.d.ts +1 -1
  14. package/dist/components/button/button.styled.d.ts +1 -1
  15. package/dist/components/chart/chart.component.d.ts +10 -0
  16. package/dist/components/chart/chart.component.js +37 -0
  17. package/dist/components/chart/index.d.ts +1 -0
  18. package/dist/components/chart/index.js +1 -0
  19. package/dist/components/datepicker/datepicker.component.d.ts +34 -0
  20. package/dist/components/datepicker/datepicker.component.js +11 -0
  21. package/dist/components/datepicker/datepicker.style.css +103 -0
  22. package/dist/components/datepicker/index.d.ts +1 -0
  23. package/dist/components/datepicker/index.js +1 -0
  24. package/dist/components/disclaimer/disclaimer.component.d.ts +1 -1
  25. package/dist/components/disclaimer/disclaimer.component.js +14 -2
  26. package/dist/components/dropdown/dropdown.component.d.ts +7 -0
  27. package/dist/components/dropdown/dropdown.component.js +48 -0
  28. package/dist/components/dropdown/dropdown.styled.d.ts +5 -0
  29. package/dist/components/dropdown/dropdown.styled.js +43 -0
  30. package/dist/components/dropdown/index.d.ts +1 -0
  31. package/dist/components/dropdown/index.js +1 -0
  32. package/dist/components/feedback-input/feedbackInput.styled.js +7 -6
  33. package/dist/components/grid/grid.component.d.ts +2 -2
  34. package/dist/components/grid/grid.styled.d.ts +2 -2
  35. package/dist/components/horizontal-timeline/horizontalTimeline.component.d.ts +1 -1
  36. package/dist/components/index.d.ts +4 -0
  37. package/dist/components/index.js +4 -0
  38. package/dist/components/large-selector/largeSelector.component.d.ts +1 -1
  39. package/dist/components/link/link.component.d.ts +1 -1
  40. package/dist/components/list/list.component.d.ts +3 -3
  41. package/dist/components/menu/index.d.ts +1 -0
  42. package/dist/components/menu/index.js +1 -0
  43. package/dist/components/menu/menu.component.d.ts +15 -0
  44. package/dist/components/menu/menu.component.js +15 -0
  45. package/dist/components/menu/menu.styled.d.ts +10 -0
  46. package/dist/components/menu/menu.styled.js +86 -0
  47. package/dist/components/multiselect/multiselect.style.js +1 -1
  48. package/dist/components/radio/radio.component.d.ts +2 -1
  49. package/dist/components/radio/radio.component.js +2 -2
  50. package/dist/components/range-input/rangeInput.component.d.ts +3 -4
  51. package/dist/components/range-input/rangeInput.component.js +8 -8
  52. package/dist/components/select/select.component.d.ts +1 -0
  53. package/dist/components/select/select.component.js +13 -11
  54. package/dist/components/select/select.styled.d.ts +4 -1
  55. package/dist/components/select/select.styled.js +21 -4
  56. package/dist/components/table/table.component.d.ts +1 -1
  57. package/dist/components/table/table.styled.d.ts +4 -2
  58. package/dist/components/table/table.styled.js +13 -2
  59. package/dist/components/text-area-input/textAreaInput.component.js +3 -2
  60. package/dist/components/text-area-input/textAreaInput.styled.js +5 -1
  61. package/dist/components/text-input/textInput.component.d.ts +1 -1
  62. package/dist/components/text-input/textInput.styled.js +1 -1
  63. package/dist/components/vertical-timeline/verticalTimeline.component.d.ts +1 -1
  64. package/dist/constants/styles.d.ts +2 -2
  65. package/dist/helpers/currency.d.ts +1 -0
  66. package/dist/helpers/currency.js +7 -0
  67. package/package.json +6 -15
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { StyledLargeSelectorItemProps } from "./largeSelector.styled";
3
- declare type LargeSelectorType = {
3
+ type LargeSelectorType = {
4
4
  Item: React.FunctionComponent<StyledLargeSelectorItemProps>;
5
5
  };
6
6
  export declare const LargeSelector: React.FunctionComponent & LargeSelectorType;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
- declare type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement>;
2
+ type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement>;
3
3
  export declare const Link: React.FunctionComponent<LinkProps>;
4
4
  export {};
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- declare type ListProps = React.OlHTMLAttributes<HTMLOListElement>;
3
- declare type ItemProps = React.LiHTMLAttributes<HTMLLIElement>;
4
- declare type ListType = {
2
+ type ListProps = React.OlHTMLAttributes<HTMLOListElement>;
3
+ type ItemProps = React.LiHTMLAttributes<HTMLLIElement>;
4
+ type ListType = {
5
5
  Item: React.FunctionComponent<ItemProps>;
6
6
  };
7
7
  export declare const List: React.FunctionComponent<ListProps> & ListType;
@@ -0,0 +1 @@
1
+ export * from "./menu.component";
@@ -0,0 +1 @@
1
+ export * from "./menu.component";
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
3
+ export declare const Menu: {
4
+ Root: import("react").FC<DropdownMenu.DropdownMenuProps>;
5
+ Trigger: import("react").ForwardRefExoticComponent<DropdownMenu.DropdownMenuTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
6
+ TriggerItem: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<DropdownMenu.DropdownMenuTriggerItemProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
7
+ Content: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<DropdownMenu.DropdownMenuContentProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
8
+ Item: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<DropdownMenu.DropdownMenuItemProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
9
+ CheckboxItem: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<DropdownMenu.DropdownMenuCheckboxItemProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
10
+ Separator: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<DropdownMenu.DropdownMenuSeparatorProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
11
+ Label: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<DropdownMenu.DropdownMenuLabelProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
12
+ RadioGroup: import("react").ForwardRefExoticComponent<DropdownMenu.DropdownMenuRadioGroupProps & import("react").RefAttributes<HTMLDivElement>>;
13
+ RadioItem: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<DropdownMenu.DropdownMenuRadioItemProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
14
+ ItemIndicator: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<DropdownMenu.DropdownMenuItemIndicatorProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
15
+ };
@@ -0,0 +1,15 @@
1
+ import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
2
+ import { StyledCheckboxItem, StyledContent, StyledItem, StyledItemIndicator, StyledLabel, StyledRadioItem, StyledSeparator, StyledTriggerItem, } from "./menu.styled";
3
+ export const Menu = {
4
+ Root: DropdownMenu.Root,
5
+ Trigger: DropdownMenu.Trigger,
6
+ TriggerItem: StyledTriggerItem,
7
+ Content: StyledContent,
8
+ Item: StyledItem,
9
+ CheckboxItem: StyledCheckboxItem,
10
+ Separator: StyledSeparator,
11
+ Label: StyledLabel,
12
+ RadioGroup: DropdownMenu.RadioGroup,
13
+ RadioItem: StyledRadioItem,
14
+ ItemIndicator: StyledItemIndicator,
15
+ };
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import * as Menu from "@radix-ui/react-dropdown-menu";
3
+ export declare const StyledContent: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Menu.DropdownMenuContentProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
4
+ export declare const StyledItem: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Menu.DropdownMenuItemProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
5
+ export declare const StyledCheckboxItem: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Menu.DropdownMenuCheckboxItemProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
6
+ export declare const StyledRadioItem: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Menu.DropdownMenuRadioItemProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
7
+ export declare const StyledTriggerItem: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Menu.DropdownMenuTriggerItemProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
8
+ export declare const StyledLabel: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Menu.DropdownMenuLabelProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
9
+ export declare const StyledSeparator: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Menu.DropdownMenuSeparatorProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
10
+ export declare const StyledItemIndicator: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Menu.DropdownMenuItemIndicatorProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
@@ -0,0 +1,86 @@
1
+ import styled, { css, keyframes } from "styled-components";
2
+ import * as Menu from "@radix-ui/react-dropdown-menu";
3
+ import { colors } from "../../constants";
4
+ const upSize = keyframes `
5
+ from { transform: scale(0.9); }
6
+ to { transform: scale(1); }
7
+ `;
8
+ export const StyledContent = styled(Menu.Content) `
9
+ background-color: #fff;
10
+ border-radius: 8px;
11
+ border: 1px solid ${colors.cardBorderGrey};
12
+ box-shadow: 0 3px 10px 0px rgb(0 0 0 / 14%);
13
+ overflow: hidden;
14
+
15
+ @media (prefers-reduced-motion: no-preference) {
16
+ animation-duration: 400ms;
17
+ animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
18
+ animation-fill-mode: forwards;
19
+ will-change: transform, opacity;
20
+ &[data-state="open"] {
21
+ &[data-side="top"],
22
+ &[data-side="right"],
23
+ &[data-side="bottom"],
24
+ &[data-side="left"] {
25
+ animation-name: ${upSize};
26
+ }
27
+ }
28
+ }
29
+ `;
30
+ const itemStyles = css `
31
+ all: unset;
32
+ color: ${colors.textGreen};
33
+ display: flex;
34
+ align-items: center;
35
+ height: 40px;
36
+ padding-right: 20px;
37
+ padding-left: 26px;
38
+ position: relative;
39
+ user-select: none;
40
+ cursor: pointer;
41
+
42
+ :hover {
43
+ background: ${colors.backgroundGreen};
44
+ }
45
+
46
+ &[data-disabled] {
47
+ color: ${colors.grey};
48
+ pointer-events: none;
49
+ }
50
+
51
+ &:focus: {
52
+ background-color: ${colors.backgroundGreen};
53
+ color: #fff;
54
+ }
55
+ `;
56
+ export const StyledItem = styled(Menu.Item) `
57
+ ${itemStyles}
58
+ `;
59
+ export const StyledCheckboxItem = styled(Menu.CheckboxItem) `
60
+ ${itemStyles}
61
+ `;
62
+ export const StyledRadioItem = styled(Menu.RadioItem) `
63
+ ${itemStyles}
64
+ `;
65
+ export const StyledTriggerItem = styled(Menu.TriggerItem) `
66
+ ${itemStyles}
67
+ `;
68
+ export const StyledLabel = styled(Menu.Label) `
69
+ padding-left: 26px;
70
+ font-size: 14px;
71
+ color: ${colors.green};
72
+ background: ${colors.lightGrey};
73
+ `;
74
+ export const StyledSeparator = styled(Menu.Separator) `
75
+ height: 1px;
76
+ background-color: ${colors.green};
77
+ margin: 4px 8px;
78
+ `;
79
+ export const StyledItemIndicator = styled(Menu.ItemIndicator) `
80
+ position: absolute;
81
+ left: 0;
82
+ width: 24px;
83
+ display: inline-flex;
84
+ align-items: center;
85
+ justify-content: center;
86
+ `;
@@ -28,7 +28,7 @@ export const MultiselectSearchContainer = styled.div `
28
28
  `;
29
29
  export const MultiselectLabel = styled.label `
30
30
  position: absolute;
31
- color: ${colors.textLightGreen};
31
+ color: ${colors.textGreen};
32
32
  cursor: pointer;
33
33
  transition: transform 0.4s, font-size 0.4s;
34
34
  transition-timing-function: ease;
@@ -3,9 +3,10 @@ interface RadioItemProps {
3
3
  label: string;
4
4
  itemValue: string | boolean | number;
5
5
  value: string | boolean | number;
6
+ name?: string;
6
7
  onClick?: (event: React.MouseEvent<HTMLInputElement, MouseEvent>) => void;
7
8
  }
8
- declare type RadioType = {
9
+ type RadioType = {
9
10
  Item: React.FunctionComponent<RadioItemProps>;
10
11
  };
11
12
  export declare const Radio: React.FunctionComponent & RadioType;
@@ -3,11 +3,11 @@ import { GroupContainer, InputRadio, ItemContainer, CircleButton, LabelText, } f
3
3
  export const Radio = ({ children }) => {
4
4
  return React.createElement(GroupContainer, null, children);
5
5
  };
6
- const Item = ({ itemValue, label, value, onClick, }) => {
6
+ const Item = ({ itemValue, label, value, onClick, name, }) => {
7
7
  const isSelected = value === itemValue;
8
8
  const handleRadioClick = (event) => onClick && onClick(event);
9
9
  return (React.createElement(ItemContainer, null,
10
- React.createElement(InputRadio, { id: itemValue.toString(), type: "radio", onClick: handleRadioClick, checked: isSelected }),
10
+ React.createElement(InputRadio, { id: itemValue.toString(), type: "radio", onClick: handleRadioClick, checked: isSelected, name: name }),
11
11
  React.createElement(CircleButton, { checked: isSelected },
12
12
  React.createElement("div", null)),
13
13
  React.createElement(LabelText, null, label)));
@@ -1,11 +1,10 @@
1
- import React from "react";
2
- interface RangeInputProps {
1
+ import React, { InputHTMLAttributes } from "react";
2
+ interface RangeInputProps extends InputHTMLAttributes<HTMLInputElement> {
3
3
  value?: string;
4
- onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
5
4
  max: number;
6
5
  step?: number;
7
6
  min?: number;
8
- disabled?: boolean;
7
+ type?: "currency";
9
8
  }
10
9
  export declare const RangeInput: React.FunctionComponent<RangeInputProps>;
11
10
  export {};
@@ -11,14 +11,14 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React from "react";
13
13
  import { Input, InputContainer, Title } from "./rangeInput.styled";
14
+ import { formatCurrency } from "../../helpers";
14
15
  export const RangeInput = (_a) => {
15
- var { value, onChange, max, min = 0, step = 1, disabled } = _a, rest = __rest(_a, ["value", "onChange", "max", "min", "step", "disabled"]);
16
- const handleChange = (event) => {
17
- const { value } = event.currentTarget;
18
- Number(value) >= min && Number(value) <= max && onChange(event);
19
- };
20
- const verifiedValue = Number(value) || min;
16
+ var { value, min = 0, step = 1, type } = _a, props = __rest(_a, ["value", "min", "step", "type"]);
17
+ const newValue = Number(value) || min;
18
+ const displayedValue = type === "currency"
19
+ ? formatCurrency(newValue)
20
+ : new Intl.NumberFormat("pt-BR").format(newValue);
21
21
  return (React.createElement(InputContainer, null,
22
- React.createElement(Title, { disabled: disabled }, `R$ ${verifiedValue},00`),
23
- React.createElement(Input, Object.assign({ type: "range", step: step, sliderValue: verifiedValue, value: verifiedValue, max: max, min: min, disabled: disabled, onChange: handleChange }, rest))));
22
+ React.createElement(Title, { disabled: props.disabled }, displayedValue),
23
+ React.createElement(Input, Object.assign({ type: "range", step: step, value: newValue, sliderValue: newValue, min: min }, props))));
24
24
  };
@@ -8,6 +8,7 @@ interface SelectProps extends React.InputHTMLAttributes<HTMLSelectElement> {
8
8
  value?: string;
9
9
  label?: string;
10
10
  stretch?: boolean;
11
+ error?: string;
11
12
  }
12
13
  export declare const Select: React.FunctionComponent<SelectProps>;
13
14
  export {};
@@ -10,10 +10,10 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import React, { useState, useRef, useEffect } from "react";
13
- import { DropdownSelectIcon, OptionsContainer, OptionStyled, SelectLabel, SelectContainerStyled, ContainerText, FocusInput, } from "./select.styled";
13
+ import { DropdownSelectIcon, OptionsContainer, OptionStyled, SelectLabel, ContainerText, FocusInput, StyleErrorSpan, StyledSelectContainer, SelectStyled, } from "./select.styled";
14
14
  export const Select = (_a) => {
15
15
  var _b;
16
- var { options, value, onChange, label, name, disabled } = _a, props = __rest(_a, ["options", "value", "onChange", "label", "name", "disabled"]);
16
+ var { options, value, onChange, label, name, disabled, error } = _a, props = __rest(_a, ["options", "value", "onChange", "label", "name", "disabled", "error"]);
17
17
  const selectorRef = useRef(null);
18
18
  const hasLabel = label && label !== "";
19
19
  const [isOpen, setIsOpen] = useState(false);
@@ -43,13 +43,15 @@ export const Select = (_a) => {
43
43
  return () => document.removeEventListener("mousedown", handleClickOutside);
44
44
  }, [selectorRef]);
45
45
  const optionLabel = ((_b = options.find((option) => option.value === value)) === null || _b === void 0 ? void 0 : _b.label) || "";
46
- return (React.createElement(SelectContainerStyled, Object.assign({ onClick: handleSelectClick, ref: selectorRef, hasLabel: hasLabel, disabled: disabled }, props),
47
- hasLabel && (React.createElement(SelectLabel, { disabled: disabled, riseLabel: isOpen || validateValue(value) }, label)),
48
- React.createElement(DropdownSelectIcon, { changeDirection: isOpen }),
49
- React.createElement(ContainerText, null, optionLabel),
50
- React.createElement(FocusInput, { onFocus: handleInputFocus }),
51
- React.createElement(OptionsContainer, { isOpen: isOpen }, options.map((option, index) => (React.createElement(OptionStyled, { onClick: (event) => {
52
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
- handleOptionClick(event, option.value);
54
- }, key: index }, option.label))))));
46
+ return (React.createElement(StyledSelectContainer, { hasError: !!error },
47
+ React.createElement(SelectStyled, Object.assign({ onClick: handleSelectClick, ref: selectorRef, hasLabel: hasLabel, disabled: disabled, hasError: !!error }, props),
48
+ hasLabel && (React.createElement(SelectLabel, { disabled: disabled, riseLabel: isOpen || validateValue(value), hasError: !!error }, label)),
49
+ React.createElement(DropdownSelectIcon, { changeDirection: isOpen }),
50
+ React.createElement(ContainerText, null, optionLabel),
51
+ React.createElement(FocusInput, { onFocus: handleInputFocus }),
52
+ React.createElement(OptionsContainer, { isOpen: isOpen }, options.map((option, index) => (React.createElement(OptionStyled, { onClick: (event) => {
53
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
54
+ handleOptionClick(event, option.value);
55
+ }, key: index }, option.label))))),
56
+ error && React.createElement(StyleErrorSpan, null, error)));
55
57
  };
@@ -3,9 +3,11 @@ export interface SelectStyledProps {
3
3
  stretch?: boolean;
4
4
  hasLabel?: boolean;
5
5
  disabled?: boolean;
6
+ hasError?: boolean;
6
7
  [key: string]: unknown;
7
8
  }
8
- export declare const SelectContainerStyled: import("styled-components").StyledComponent<"div", any, SelectStyledProps, never>;
9
+ export declare const StyledSelectContainer: import("styled-components").StyledComponent<"div", any, SelectStyledProps, never>;
10
+ export declare const SelectStyled: import("styled-components").StyledComponent<"div", any, SelectStyledProps, never>;
9
11
  interface OptionsContainerProps {
10
12
  isOpen?: boolean;
11
13
  }
@@ -23,4 +25,5 @@ interface DropdownSelectIconProps {
23
25
  export declare const DropdownSelectIcon: import("styled-components").StyledComponent<import("react").FunctionComponent<import("react").SVGAttributes<HTMLOrSVGElement>>, any, DropdownSelectIconProps, never>;
24
26
  export declare const ContainerText: import("styled-components").StyledComponent<"span", any, {}, never>;
25
27
  export declare const FocusInput: import("styled-components").StyledComponent<"select", any, {}, never>;
28
+ export declare const StyleErrorSpan: import("styled-components").StyledComponent<"span", any, {}, never>;
26
29
  export {};
@@ -1,19 +1,29 @@
1
1
  import styled from "styled-components";
2
2
  import { colors } from "../../constants";
3
3
  import { DropdownIcon } from "../../assets/icons";
4
- export const SelectContainerStyled = styled.div `
4
+ export const StyledSelectContainer = styled.div `
5
+ display: flex;
6
+ flex-direction: column;
7
+ justify-content: flex-end;
8
+
9
+ height: 28px;
10
+ width: ${({ stretch }) => (stretch ? "100%" : "auto")};
11
+
12
+ ${({ hasError }) => hasError && `color: ${colors.red};`}
13
+ `;
14
+ export const SelectStyled = styled.div `
5
15
  -webkit-appearance: none;
6
16
  -moz-appearance: none;
7
17
  background-color: transparent;
8
18
  border: 0;
19
+ border-bottom: ${({ hasError }) => `1px solid ${hasError ? colors.red : colors.lightGrey}`};
20
+ color: ${({ hasError }) => (hasError ? colors.red : colors.textGreen)};
9
21
  &:focus {
10
22
  outline: none;
11
23
  }
12
24
  position: relative;
13
25
  top: 2px;
14
26
  font-size: 16px;
15
- color: ${colors.textGreen};
16
- border-bottom: 1px solid ${colors.lightGrey};
17
27
  width: ${({ stretch }) => (stretch ? "100%" : "auto")};
18
28
  box-sizing: content-box;
19
29
  height: 26px;
@@ -37,6 +47,7 @@ export const OptionsContainer = styled.div `
37
47
  border-radius: 4px;
38
48
  `;
39
49
  export const OptionStyled = styled.div `
50
+ color: ${colors.textGreen};
40
51
  -webkit-appearance: none;
41
52
  -moz-appearance: none;
42
53
  padding: 8px;
@@ -47,7 +58,7 @@ export const OptionStyled = styled.div `
47
58
  `;
48
59
  export const SelectLabel = styled.span `
49
60
  position: absolute;
50
- color: ${colors.textLightGreen};
61
+ color: ${colors.textGreen};
51
62
  cursor: ${({ disabled }) => (disabled ? "default" : "pointer")};
52
63
  transition: transform 0.4s, font-size 0.4s;
53
64
  transition-timing-function: ease;
@@ -84,3 +95,9 @@ export const FocusInput = styled.select `
84
95
  outline: none;
85
96
  }
86
97
  `;
98
+ export const StyleErrorSpan = styled.span `
99
+ position: absolute;
100
+ align-self: flex-end;
101
+ transform: translateY(20px);
102
+ font-size: 12px;
103
+ `;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { StyledHeaderCellProps, StyledCellProps, StyledRowProps } from "./table.styled";
3
- declare type TableType = {
3
+ type TableType = {
4
4
  Header: React.FunctionComponent;
5
5
  Row: React.FunctionComponent<StyledRowProps>;
6
6
  HeaderCell: React.FunctionComponent<StyledHeaderCellProps>;
@@ -1,9 +1,11 @@
1
- declare type CellAlignment = "left" | "center" | "right";
2
- declare type TextBehaviour = "nowrap" | "ellipsis" | "normal";
1
+ /// <reference types="react" />
2
+ type CellAlignment = "left" | "center" | "right";
3
+ type TextBehaviour = "nowrap" | "ellipsis" | "normal";
3
4
  export declare const StyledTable: import("styled-components").StyledComponent<"table", any, {}, never>;
4
5
  export declare const StyledHeader: import("styled-components").StyledComponent<"thead", any, {}, never>;
5
6
  export interface StyledRowProps {
6
7
  customColor?: string;
8
+ onClick?: React.MouseEventHandler<HTMLTableRowElement>;
7
9
  }
8
10
  export declare const StyledRow: import("styled-components").StyledComponent<"tr", any, StyledRowProps, never>;
9
11
  export interface StyledHeaderCellProps {
@@ -18,14 +18,25 @@ export const StyledTable = styled.table `
18
18
  font-size: 12px;
19
19
  `;
20
20
  export const StyledHeader = styled.thead `
21
- background-color: ${colors.floatingNav};
21
+ background-color: ${colors.timelineGrey};
22
+ color: ${colors.tableText};
23
+
24
+ > tr:hover {
25
+ background-color: initial;
26
+ }
22
27
  `;
23
28
  export const StyledRow = styled.tr `
24
29
  color: ${({ customColor }) => customColor || colors.tableText};
30
+
31
+ cursor: ${({ onClick }) => (onClick ? "pointer" : "initial")};
32
+
33
+ :hover {
34
+ background-color: ${colors.floatingNav};
35
+ }
25
36
  `;
26
37
  export const StyledHeaderCell = styled.th `
27
38
  border: none;
28
- font-weight: normal;
39
+ font-weight: 500;
29
40
  padding: ${cellsPadding};
30
41
  text-align: ${({ alignment }) => alignment || cellsDefaultAlignment};
31
42
  white-space: nowrap;
@@ -9,13 +9,14 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
+ /* eslint-disable no-debugger */
12
13
  import React, { useState } from "react";
13
14
  import { StyledCharQuantitySpan, StyledTextAreaInputContainer, StyleErrorSpan, StyledTextAreaInput, } from "./textAreaInput.styled";
14
15
  export const TextAreaInput = (_a) => {
15
16
  var { label, error, disabled, value, name, onChange, rows = 5, maxChars = 500 } = _a, props = __rest(_a, ["label", "error", "disabled", "value", "name", "onChange", "rows", "maxChars"]);
16
17
  const [charactersQuantity, setCharactersQuantity] = useState(0);
17
18
  const handleOnChange = (event) => {
18
- const eventCharQuantity = event.currentTarget.value.length;
19
+ const eventCharQuantity = event.target.value.length;
19
20
  if (eventCharQuantity > maxChars)
20
21
  return;
21
22
  setCharactersQuantity(eventCharQuantity);
@@ -23,6 +24,6 @@ export const TextAreaInput = (_a) => {
23
24
  };
24
25
  return (React.createElement(StyledTextAreaInputContainer, { hasError: !!error },
25
26
  React.createElement(StyledCharQuantitySpan, null, ` ${charactersQuantity}/${maxChars}`),
26
- React.createElement(StyledTextAreaInput, Object.assign({}, props, { name: name, value: value, hasError: !!error, disabled: disabled, autoComplete: "off", rows: rows, onChange: handleOnChange, placeholder: label })),
27
+ React.createElement(StyledTextAreaInput, Object.assign({}, props, { name: name, value: value || "", hasError: !!error, disabled: disabled, autoComplete: "off", rows: rows, onChange: handleOnChange, placeholder: label })),
27
28
  error && React.createElement(StyleErrorSpan, null, error)));
28
29
  };
@@ -8,7 +8,7 @@ export const StyledTextAreaInputContainer = styled.div `
8
8
  ${({ hasError }) => hasError && `color: ${colors.red};`}
9
9
  `;
10
10
  export const StyledCharQuantitySpan = styled.span `
11
- color: grey;
11
+ color: ${colors.textGreen};
12
12
  position: relative;
13
13
  top: 20px;
14
14
  text-align: right;
@@ -33,6 +33,10 @@ export const StyledTextAreaInput = styled.textarea `
33
33
  background-color: transparent;
34
34
  }
35
35
 
36
+ &::placeholder {
37
+ color: ${colors.textGreen};
38
+ }
39
+
36
40
  ${({ hasError }) => hasError &&
37
41
  `
38
42
  border-color: ${colors.red};
@@ -5,7 +5,7 @@ export interface ValueInterceptor {
5
5
  onChange?: (value?: string | number | readonly string[]) => string;
6
6
  onKeyDown?: (value?: string | number | readonly string[], event?: React.KeyboardEvent<HTMLInputElement>) => string;
7
7
  }
8
- declare type InputValueCase = "lowercase" | "uppercase";
8
+ type InputValueCase = "lowercase" | "uppercase";
9
9
  interface TextInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
10
10
  label: string;
11
11
  error?: string;
@@ -13,7 +13,7 @@ export const StyledTextInputContainer = styled.div `
13
13
  export const StyledTextInputLabel = styled.label `
14
14
  position: relative;
15
15
 
16
- color: ${colors.textLightGreen};
16
+ color: ${colors.textGreen};
17
17
  cursor: ${({ disabled }) => (disabled ? "normal" : "text")};
18
18
  transition: transform 0.4s, font-size 0.4s;
19
19
  transition-timing-function: ease;
@@ -5,7 +5,7 @@ interface VerticalTimelineItemProps extends React.HTMLProps<HTMLDivElement> {
5
5
  isActive?: boolean;
6
6
  setRef?: (instance: HTMLDivElement) => void;
7
7
  }
8
- declare type VerticalTimelineType = {
8
+ type VerticalTimelineType = {
9
9
  Item: React.FunctionComponent<VerticalTimelineItemProps>;
10
10
  };
11
11
  export declare const VerticalTimeline: React.FunctionComponent & VerticalTimelineType;
@@ -1,5 +1,5 @@
1
- export declare type BorderRadiusKey = "small" | "medium" | "large" | "round";
2
- export declare type FontSizeKey = "extraSmall" | "small" | "medium" | "large" | "extraLarge";
1
+ export type BorderRadiusKey = "small" | "medium" | "large" | "round";
2
+ export type FontSizeKey = "extraSmall" | "small" | "medium" | "large" | "extraLarge";
3
3
  export declare const styles: {
4
4
  borderRadius: Record<BorderRadiusKey, string>;
5
5
  fontSize: Record<FontSizeKey, string>;
@@ -1,2 +1,3 @@
1
1
  import type { ValueInterceptor } from "../components";
2
+ export declare const formatCurrency: (number: number) => string;
2
3
  export declare const currencyInterceptors: ValueInterceptor;
@@ -1,3 +1,10 @@
1
+ export const formatCurrency = (number) => {
2
+ return new Intl.NumberFormat("pt-BR", {
3
+ style: "currency",
4
+ currency: "BRL",
5
+ maximumFractionDigits: 2,
6
+ }).format(number);
7
+ };
1
8
  const addCurrencyMask = (value) => {
2
9
  const cleanValue = value.toString().replace(/\D/g, "") || ""; // clean all non numeric digits
3
10
  let firstPart = cleanValue
package/package.json CHANGED
@@ -1,16 +1,7 @@
1
1
  {
2
2
  "name": "@alume/alume-design-system",
3
- "description": "Compose of React components displayed at Storybook for Alume company",
4
- "version": "4.13.21",
5
3
  "homepage": "https://alume-com.github.io/design-system/",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/alume-com/design-system.git"
9
- },
10
- "author": "",
11
- "bugs": {
12
- "url": "https://github.com/alume-com/design-system/issues"
13
- },
4
+ "version": "4.13.22",
14
5
  "license": "UNLICENSED",
15
6
  "main": "dist/index.js",
16
7
  "types": "dist/index.d.ts",
@@ -57,9 +48,9 @@
57
48
  "copyfiles:fonts": "copyfiles -V -u 1 src/assets/fonts/*.ttf dist",
58
49
  "copyfiles:icons": "copyfiles -V -u 1 src/assets/icons/*.svg dist",
59
50
  "copyfiles:css": "copyfiles -V -u 1 src/components/**/*.css dist",
60
- "copyfiles:package": "yarn copyfiles:fonts && yarn copyfiles:icons && yarn copyfiles:css",
61
- "build:package": "tsc --build \"./tsconfig.json\" && yarn copyfiles:package",
62
- "prepare:package": "yarn clean:package && yarn build:package",
51
+ "copyfiles:package": "npm run copyfiles:fonts && npm run copyfiles:icons && npm run copyfiles:css",
52
+ "build:package": "tsc --build \"./tsconfig.json\" && npm run copyfiles:package",
53
+ "prepare:package": "npm run clean:package && npm run build:package",
63
54
  "publish:package": "yarn prepare:package && yarn publish --registry http://ec2-18-228-219-90.sa-east-1.compute.amazonaws.com:4873/ && git push",
64
55
  "build:site": "yarn && yarn build-storybook -o ./storybook-static",
65
56
  "publish:site": "yarn build:site && yarn chromatic",
@@ -96,7 +87,7 @@
96
87
  "copyfiles": "^2.4.0",
97
88
  "eslint": "^7.12.0",
98
89
  "eslint-config-prettier": "^6.14.0",
99
- "eslint-plugin-import": "^2.x.x",
90
+ "eslint-plugin-import": "^2.22.1",
100
91
  "eslint-plugin-prettier": "^3.1.4",
101
92
  "eslint-plugin-react": "^7.21.5",
102
93
  "gh-pages": "^3.1.0",
@@ -104,4 +95,4 @@
104
95
  "lint-staged": ">=10",
105
96
  "prettier": "^2.1.2"
106
97
  }
107
- }
98
+ }