alicia-design-system 1.0.1 → 1.2.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.
Files changed (154) hide show
  1. package/index.ts +1 -0
  2. package/package.json +1 -1
  3. package/src/types/index.ts +0 -7
  4. package/src/legacy_agos/common/Accordion/Accordion.stories.tsx +0 -13
  5. package/src/legacy_agos/common/Accordion/Accordion.styled.ts +0 -41
  6. package/src/legacy_agos/common/Accordion/Accordion.tsx +0 -58
  7. package/src/legacy_agos/common/Accordion/index.ts +0 -1
  8. package/src/legacy_agos/common/Button/Button.stories.tsx +0 -96
  9. package/src/legacy_agos/common/Button/Button.styled.ts +0 -206
  10. package/src/legacy_agos/common/Button/Button.tsx +0 -94
  11. package/src/legacy_agos/common/Button/index.ts +0 -1
  12. package/src/legacy_agos/common/Button/types.ts +0 -34
  13. package/src/legacy_agos/common/ConfirmModal/ConfirmModal.stories.tsx +0 -28
  14. package/src/legacy_agos/common/ConfirmModal/ConfirmModal.styled.ts +0 -15
  15. package/src/legacy_agos/common/ConfirmModal/ConfirmModal.tsx +0 -49
  16. package/src/legacy_agos/common/ConfirmModal/index.ts +0 -1
  17. package/src/legacy_agos/common/Dropdown/MultiSelectDropdown/MultiSelectDropdown.stories.tsx +0 -52
  18. package/src/legacy_agos/common/Dropdown/MultiSelectDropdown/MultiSelectDropdown.styled.ts +0 -10
  19. package/src/legacy_agos/common/Dropdown/MultiSelectDropdown/MultiSelectDropdown.tsx +0 -198
  20. package/src/legacy_agos/common/Dropdown/MultiSelectDropdown/index.ts +0 -1
  21. package/src/legacy_agos/common/Dropdown/SelectDropdown/SelectDropdown.stories.tsx +0 -53
  22. package/src/legacy_agos/common/Dropdown/SelectDropdown/SelectDropdown.tsx +0 -83
  23. package/src/legacy_agos/common/Dropdown/SelectDropdown/customStyles.ts +0 -138
  24. package/src/legacy_agos/common/Dropdown/SelectDropdown/index.ts +0 -1
  25. package/src/legacy_agos/common/Dropdown/SelectDropdown/types.ts +0 -67
  26. package/src/legacy_agos/common/Label/Label.stories.tsx +0 -16
  27. package/src/legacy_agos/common/Label/Label.styled.ts +0 -23
  28. package/src/legacy_agos/common/Label/Label.tsx +0 -10
  29. package/src/legacy_agos/common/Label/index.ts +0 -1
  30. package/src/legacy_agos/common/ListItem/ListItem.stories.tsx +0 -25
  31. package/src/legacy_agos/common/ListItem/ListItem.styled.ts +0 -46
  32. package/src/legacy_agos/common/ListItem/ListItem.tsx +0 -24
  33. package/src/legacy_agos/common/ListItem/index.ts +0 -1
  34. package/src/legacy_agos/common/Loading/Loading.stories.tsx +0 -29
  35. package/src/legacy_agos/common/Loading/Loading.styled.ts +0 -59
  36. package/src/legacy_agos/common/Loading/Loading.tsx +0 -24
  37. package/src/legacy_agos/common/Loading/index.ts +0 -1
  38. package/src/legacy_agos/common/Modal/Modal.stories.tsx +0 -48
  39. package/src/legacy_agos/common/Modal/Modal.styled.ts +0 -100
  40. package/src/legacy_agos/common/Modal/Modal.tsx +0 -77
  41. package/src/legacy_agos/common/Modal/index.ts +0 -1
  42. package/src/legacy_agos/common/Notifcation/Notification.stories.tsx +0 -25
  43. package/src/legacy_agos/common/Notifcation/Notification.styled.ts +0 -47
  44. package/src/legacy_agos/common/Notifcation/Notification.tsx +0 -27
  45. package/src/legacy_agos/common/Notifcation/index.ts +0 -1
  46. package/src/legacy_agos/common/StatusLabel/StatusLabel.stories.tsx +0 -31
  47. package/src/legacy_agos/common/StatusLabel/StatusLabel.styled.tsx +0 -26
  48. package/src/legacy_agos/common/StatusLabel/StatusLabel.tsx +0 -14
  49. package/src/legacy_agos/common/StatusLabel/index.ts +0 -1
  50. package/src/legacy_agos/common/Tab/Tab.styled.tsx +0 -29
  51. package/src/legacy_agos/common/Tab/Tab.tsx +0 -6
  52. package/src/legacy_agos/common/Tab/index.ts +0 -1
  53. package/src/legacy_agos/common/TabGroup/TabGroup.stories.tsx +0 -24
  54. package/src/legacy_agos/common/TabGroup/TabGroup.styled.tsx +0 -11
  55. package/src/legacy_agos/common/TabGroup/TabGroup.tsx +0 -21
  56. package/src/legacy_agos/common/TabGroup/index.ts +0 -1
  57. package/src/legacy_agos/common/TestButton/TestButton.stories.tsx +0 -21
  58. package/src/legacy_agos/common/TestButton/TestButton.tsx +0 -8
  59. package/src/legacy_agos/common/TestButton/index.ts +0 -1
  60. package/src/legacy_agos/common/index.ts +0 -6
  61. package/src/legacy_agos/common/types.ts +0 -5
  62. package/src/legacy_agos/form/Checkbox/Checkbox.stories.tsx +0 -38
  63. package/src/legacy_agos/form/Checkbox/Checkbox.styled.ts +0 -74
  64. package/src/legacy_agos/form/Checkbox/Checkbox.tsx +0 -32
  65. package/src/legacy_agos/form/Checkbox/index.ts +0 -1
  66. package/src/legacy_agos/form/FormContainer/index.tsx +0 -41
  67. package/src/legacy_agos/form/FormContainer/styled.ts +0 -5
  68. package/src/legacy_agos/form/FormField/FormField.stories.tsx +0 -26
  69. package/src/legacy_agos/form/FormField/FormField.tsx +0 -37
  70. package/src/legacy_agos/form/FormField/index.ts +0 -1
  71. package/src/legacy_agos/form/FormField/styled.ts +0 -68
  72. package/src/legacy_agos/form/Input/Input.stories.tsx +0 -30
  73. package/src/legacy_agos/form/Input/Input.styled.ts +0 -125
  74. package/src/legacy_agos/form/Input/Input.tsx +0 -54
  75. package/src/legacy_agos/form/Input/index.ts +0 -1
  76. package/src/legacy_agos/form/InputCheckbox/InputCheckbox.stories.tsx +0 -41
  77. package/src/legacy_agos/form/InputCheckbox/InputCheckbox.tsx +0 -35
  78. package/src/legacy_agos/form/InputCheckbox/index.ts +0 -1
  79. package/src/legacy_agos/form/InputPassword/InputPassword.stories.tsx +0 -31
  80. package/src/legacy_agos/form/InputPassword/InputPassword.styled.ts +0 -12
  81. package/src/legacy_agos/form/InputPassword/InputPassword.tsx +0 -29
  82. package/src/legacy_agos/form/InputPassword/index.ts +0 -1
  83. package/src/legacy_agos/form/SelectDropdown/customStyles.ts +0 -124
  84. package/src/legacy_agos/form/SelectDropdown/index.tsx +0 -84
  85. package/src/legacy_agos/form/SelectDropdown/types.ts +0 -63
  86. package/src/legacy_agos/form/Textarea/TextArea.stories.tsx +0 -41
  87. package/src/legacy_agos/form/Textarea/TextArea.styled.ts +0 -7
  88. package/src/legacy_agos/form/Textarea/TextArea.tsx +0 -40
  89. package/src/legacy_agos/form/Textarea/index.ts +0 -1
  90. package/src/legacy_agos/form/dates/translations.ts +0 -23
  91. package/src/legacy_agos/form/index.ts +0 -9
  92. package/src/legacy_agos/form/types.ts +0 -64
  93. package/src/legacy_agos/icon/ActionIcon/index.tsx +0 -62
  94. package/src/legacy_agos/icon/CheckmarkIcon/index.ts +0 -8
  95. package/src/legacy_agos/icon/PenIcon/index.ts +0 -8
  96. package/src/legacy_agos/icon/PlusIcon/index.ts +0 -8
  97. package/src/legacy_agos/icon/SearchIcon/index.ts +0 -8
  98. package/src/legacy_agos/icon/index.ts +0 -5
  99. package/src/legacy_agos/layout/Card/Card.stories.tsx +0 -28
  100. package/src/legacy_agos/layout/Card/Card.styled.ts +0 -33
  101. package/src/legacy_agos/layout/Card/Card.tsx +0 -11
  102. package/src/legacy_agos/layout/Card/index.ts +0 -1
  103. package/src/legacy_agos/layout/DataField/DataField.stories.tsx +0 -18
  104. package/src/legacy_agos/layout/DataField/DataField.styled.ts +0 -45
  105. package/src/legacy_agos/layout/DataField/DataField.tsx +0 -26
  106. package/src/legacy_agos/layout/DataField/index.ts +0 -1
  107. package/src/legacy_agos/layout/Dropdown/Dropdown.styled.ts +0 -79
  108. package/src/legacy_agos/layout/Dropdown/Dropdown.tsx +0 -14
  109. package/src/legacy_agos/layout/Dropdown/index.ts +0 -1
  110. package/src/legacy_agos/layout/Row/Row.stories.tsx +0 -11
  111. package/src/legacy_agos/layout/Row/Row.styled.ts +0 -44
  112. package/src/legacy_agos/layout/Row/Row.tsx +0 -12
  113. package/src/legacy_agos/layout/Row/index.ts +0 -1
  114. package/src/legacy_agos/layout/SimplePage/SimplePage.stories.tsx +0 -11
  115. package/src/legacy_agos/layout/SimplePage/SimplePage.styled.ts +0 -22
  116. package/src/legacy_agos/layout/SimplePage/SimplePage.tsx +0 -12
  117. package/src/legacy_agos/layout/SimplePage/index.ts +0 -1
  118. package/src/legacy_agos/layout/index.ts +0 -5
  119. package/src/legacy_agos/table/Table.stories.tsx +0 -29
  120. package/src/legacy_agos/table/TableActions/TableActions.styled.tsx +0 -41
  121. package/src/legacy_agos/table/TableActions/TableActions.tsx +0 -10
  122. package/src/legacy_agos/table/TableActions/index.ts +0 -1
  123. package/src/legacy_agos/table/TableCell/TableCell.styled.tsx +0 -62
  124. package/src/legacy_agos/table/TableCell/TableCell.tsx +0 -23
  125. package/src/legacy_agos/table/TableCell/index.ts +0 -1
  126. package/src/legacy_agos/table/TableExpandableCell/TableExpandableCell.styled.tsx +0 -7
  127. package/src/legacy_agos/table/TableExpandableCell/TableExpandableCell.tsx +0 -9
  128. package/src/legacy_agos/table/TableExpandableCell/index.ts +0 -1
  129. package/src/legacy_agos/table/TableHeadCell/TableHeadCell.styled.tsx +0 -41
  130. package/src/legacy_agos/table/TableHeadCell/TableHeadCell.tsx +0 -21
  131. package/src/legacy_agos/table/TableHeadCell/index.ts +0 -1
  132. package/src/legacy_agos/table/TableHeadIcon/TableHeadIcon.styled.tsx +0 -23
  133. package/src/legacy_agos/table/TableHeadIcon/TableHeadIcon.tsx +0 -15
  134. package/src/legacy_agos/table/TableHeadIcon/index.ts +0 -1
  135. package/src/legacy_agos/table/TableRow/TableRow.styled.tsx +0 -48
  136. package/src/legacy_agos/table/TableRow/TableRow.tsx +0 -19
  137. package/src/legacy_agos/table/TableRow/index.ts +0 -1
  138. package/src/legacy_agos/table/TableTextCell/TableTextCell.styled.tsx +0 -45
  139. package/src/legacy_agos/table/TableTextCell/TableTextCell.tsx +0 -24
  140. package/src/legacy_agos/table/TableTextCell/index.ts +0 -1
  141. package/src/legacy_agos/table/TableWrapper/TableWrapper.styled.tsx +0 -9
  142. package/src/legacy_agos/table/TableWrapper/TableWrapper.tsx +0 -9
  143. package/src/legacy_agos/table/TableWrapper/index.ts +0 -1
  144. package/src/legacy_agos/table/index.ts +0 -8
  145. package/src/legacy_agos/table/types.ts +0 -22
  146. package/src/legacy_agos/typography/Heading/Heading.stories.tsx +0 -20
  147. package/src/legacy_agos/typography/Heading/Heading.styled.tsx +0 -51
  148. package/src/legacy_agos/typography/Heading/Heading.tsx +0 -14
  149. package/src/legacy_agos/typography/Heading/index.ts +0 -1
  150. package/src/legacy_agos/typography/Text/Text.stories.tsx +0 -32
  151. package/src/legacy_agos/typography/Text/Text.styled.tsx +0 -56
  152. package/src/legacy_agos/typography/Text/Text.tsx +0 -6
  153. package/src/legacy_agos/typography/Text/index.ts +0 -1
  154. package/src/legacy_agos/typography/types.ts +0 -21
package/index.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./src/legacy_agos/common";
2
2
  export * from "./src/legacy_agos/form";
3
3
  export * from "./src/legacy_agos/layout";
4
4
  export * from "./src/legacy_agos/table";
5
+ export * from "./src/styles/index";
5
6
  export * from "./src/alicia/common/Buttons";
6
7
  export * from "./src/alicia/common/Checkbox";
7
8
  export * from "./src/alicia/common/DateInput";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alicia-design-system",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@chakra-ui/icons": "^2.0.17",
@@ -1,10 +1,3 @@
1
1
  // Modules
2
2
  export * from "./general";
3
-
4
- export * from "legacy_agos/form/types";
5
- export * from "legacy_agos/form/SelectDropdown/types";
6
- export * from "legacy_agos/common/types";
7
- export * from "legacy_agos/table/types";
8
- export * from "legacy_agos/typography/types";
9
-
10
3
  export * from "styles/types";
@@ -1,13 +0,0 @@
1
- import { ComponentStory, ComponentMeta } from "@storybook/react";
2
- import { Accordion } from "./Accordion";
3
-
4
- export default {
5
- title: "Agos/Components/Accordion",
6
- component: Accordion,
7
- } as ComponentMeta<typeof Accordion>;
8
-
9
- const Template: ComponentStory<typeof Accordion> = (args) => (
10
- <Accordion {...args} />
11
- );
12
-
13
- export const Primary = Template.bind({});
@@ -1,41 +0,0 @@
1
- import styled from "styled-components";
2
-
3
- import { ReactComponent as ArrowDown } from "assets/vectors/arrow-down.svg";
4
- import { ReactComponent as ArrowRight } from "assets/vectors/arrow-right.svg";
5
-
6
- export const Accordion = styled.div`
7
- box-shadow: ${({ theme }) => theme.shadows.overlay};
8
- `;
9
-
10
- export const IconDown = styled(ArrowDown)`
11
- width: 26px;
12
- height: 26px;
13
- fill: ${({ theme }) => theme.colors.green};
14
- `;
15
-
16
- export const IconRight = styled(ArrowRight)`
17
- width: 26px;
18
- height: 26px;
19
- fill: ${({ theme }) => theme.colors.green};
20
- `;
21
-
22
- export const AccordionItem = styled.div``;
23
-
24
- export const AccordionHeading = styled.div`
25
- border-bottom: 1px solid ${({ theme }) => theme.colors.gray.light};
26
- cursor: pointer;
27
- display: flex;
28
- justify-content: space-between;
29
- font-family: ${({ theme }) => theme.fonts.notoSans};
30
- padding: 16px;
31
-
32
- &:hover {
33
- background-color: ${({ theme }) => theme.colors.gray.light};
34
- }
35
- `;
36
-
37
- export const AccordionContent = styled.div`
38
- font-family: ${({ theme }) => theme.fonts?.notoSans};
39
- font-size: 12px;
40
- padding: 16px;
41
- `;
@@ -1,58 +0,0 @@
1
- import React, { useState } from "react";
2
-
3
- import * as Styled from "./Accordion.styled";
4
-
5
- export const Accordion: React.FC = () => {
6
- const [openItem, setOpenItem] = useState<number[]>([]);
7
-
8
- const accordionData = [
9
- {
10
- id: 1,
11
- title: "Heading 1",
12
- content: `Lorem, ipsum dolor sit amet consectetur adipisicing elit.
13
- Quibusdam, sapiente!`,
14
- },
15
- {
16
- id: 2,
17
- title: "Heading 2",
18
- content: `Lorem, ipsum dolor sit amet consectetur adipisicing elit.
19
- Quibusdam, sapiente!`,
20
- },
21
- {
22
- id: 3,
23
- title: "Heading 3",
24
- content: `Lorem, ipsum dolor sit amet consectetur adipisicing elit.
25
- Quibusdam, sapiente!`,
26
- },
27
- ];
28
-
29
- const toggleAccordion = (index: number) => {
30
- if (openItem.includes(index)) {
31
- setOpenItem(openItem.filter((i) => i !== index));
32
- } else {
33
- setOpenItem(openItem.concat(index));
34
- }
35
- };
36
-
37
- return (
38
- <>
39
- <Styled.Accordion>
40
- {accordionData.map(({ title, content, id }, i) => (
41
- <Styled.AccordionItem key={id}>
42
- <Styled.AccordionHeading onClick={() => toggleAccordion(i)}>
43
- {title}
44
- {openItem.includes(i) ? (
45
- <Styled.IconDown />
46
- ) : (
47
- <Styled.IconRight />
48
- )}
49
- </Styled.AccordionHeading>
50
- {openItem.includes(i) && (
51
- <Styled.AccordionContent>{content}</Styled.AccordionContent>
52
- )}
53
- </Styled.AccordionItem>
54
- ))}
55
- </Styled.Accordion>
56
- </>
57
- );
58
- };
@@ -1 +0,0 @@
1
- export { Accordion } from "./Accordion";
@@ -1,96 +0,0 @@
1
- import { ComponentStory, ComponentMeta } from "@storybook/react";
2
-
3
- import { Button } from "./Button";
4
-
5
- import { ReactComponent as AddIcon } from "assets/vectors/action-menu/add.svg";
6
- import { ReactComponent as ArrowLeftIcon } from "assets/vectors/arrow-left.svg";
7
- import { ReactComponent as ArrowRightIcon } from "assets/vectors/arrow-right.svg";
8
- import { ReactComponent as EditIcon } from "assets/vectors/action-menu/edit.svg";
9
- import { ReactComponent as CheckmarkIcon } from "assets/vectors/checkmark.svg";
10
- import { ReactComponent as SearchIcon } from "assets/vectors/search.svg";
11
-
12
- const icon = {
13
- Empty: null,
14
- Add: <AddIcon />,
15
- ArrowLeft: <ArrowLeftIcon />,
16
- ArrowRight: <ArrowRightIcon />,
17
- Edit: <EditIcon />,
18
- Checkmark: <CheckmarkIcon />,
19
- Search: <SearchIcon />,
20
- };
21
-
22
- export default {
23
- title: "Agos/Components/Button",
24
- component: Button,
25
- argTypes: {
26
- disabled: {
27
- control: {
28
- type: "boolean",
29
- },
30
- defaultValue: false,
31
- },
32
- icon: {
33
- options: Object.keys(icon),
34
- mapping: icon,
35
- control: {
36
- type: "select",
37
- },
38
- },
39
- isLoading: {
40
- control: {
41
- type: "boolean",
42
- },
43
- defaultValue: false,
44
- },
45
- as: {
46
- table: {
47
- disable: true,
48
- },
49
- },
50
- size: {
51
- table: {
52
- disable: true,
53
- },
54
- },
55
- to: {
56
- table: {
57
- disable: true,
58
- },
59
- },
60
- urlTarget: {
61
- table: {
62
- disable: true,
63
- },
64
- },
65
- },
66
- } as ComponentMeta<typeof Button>;
67
-
68
- const Template: ComponentStory<typeof Button> = ({ ...args }) => {
69
- return <Button {...args} />;
70
- };
71
-
72
- export const Primary = Template.bind({});
73
- export const Secondary = Template.bind({});
74
- export const Tertiary = Template.bind({});
75
- export const Warning = Template.bind({});
76
-
77
- Primary.args = {
78
- children: "Primary",
79
- variant: "primary",
80
- onChange: () => ({ variant: "primary" }),
81
- };
82
-
83
- Secondary.args = {
84
- children: "Secondary",
85
- variant: "secondary",
86
- };
87
-
88
- Tertiary.args = {
89
- children: "Tertiary",
90
- variant: "tertiary",
91
- };
92
-
93
- Warning.args = {
94
- children: "Warning",
95
- variant: "warning",
96
- };
@@ -1,206 +0,0 @@
1
- import styled, { css, keyframes } from "styled-components";
2
- import { media } from "styles/utils";
3
-
4
- import { ButtonProps } from "./types";
5
-
6
- export const buttonLoaderAnimation = keyframes`
7
- 0%, 80%, 100% {
8
- transform: scale(0);
9
- } 40% {
10
- transform: scale(1.0);
11
- }
12
- `;
13
-
14
- export const StyledButtonLoader = styled.div`
15
- width: 70px;
16
- display: flex;
17
- align-items: center;
18
- justify-content: center;
19
-
20
- & > div {
21
- width: 6px;
22
- height: 6px;
23
- margin-right: 3px;
24
- background-color: ${({ theme }) => theme.colors?.white};
25
- border-radius: 100%;
26
- animation: ${buttonLoaderAnimation} 1.4s infinite ease-in-out both;
27
-
28
- &:nth-child(1) {
29
- animation-delay: -0.32s;
30
- }
31
-
32
- &:nth-child(2) {
33
- animation-delay: -0.16s;
34
- }
35
- }
36
- `;
37
-
38
- export const ButtonIcon = styled.div`
39
- margin: 0 8px 0 0;
40
- display: flex;
41
- align-items: center;
42
- width: 24px;
43
- height: 24px;
44
- `;
45
-
46
- export const StyledButton = styled.button<ButtonProps>`
47
- color: ${({ theme }) => theme.colors?.white};
48
- background-color: ${({ theme }) => theme.colors?.primary};
49
- font-family: ${({ theme }) => theme.fonts?.notoSans};
50
- font-size: 16px;
51
- font-weight: 600;
52
- width: auto;
53
- height: 48px;
54
- padding: 12px 16px;
55
- position: relative;
56
- display: flex;
57
- align-items: center;
58
- justify-content: center;
59
- flex-direction: row;
60
- line-height: normal;
61
- text-align: center;
62
- text-decoration: none;
63
- cursor: pointer;
64
- outline: none;
65
- border-radius: 4px;
66
- border: 0;
67
- transition: background-color 300ms, color 300ms;
68
-
69
- svg {
70
- fill: ${({ theme }) => theme.colors?.white};
71
- max-width: 24px;
72
- max-height: 24px;
73
- }
74
-
75
- &:hover {
76
- color: ${({ theme }) => theme.colors?.white};
77
- background-color: ${({ theme }) => theme.colors?.primaryHover};
78
- }
79
-
80
- &:focus {
81
- background-color: ${({ theme }) => theme.colors?.primaryHover};
82
- }
83
-
84
- ${media.desktop`
85
- transition: background-color .2s, border-color .2s;
86
-
87
- + button {
88
- margin: 0 0 0 8px;
89
- }
90
- `}
91
-
92
- ${({ iconOnly }) =>
93
- iconOnly &&
94
- css`
95
- width: 48px;
96
-
97
- ${ButtonIcon} {
98
- margin: 0;
99
- }
100
- `}
101
-
102
- ${({ iconOnlyOnMobile }) =>
103
- iconOnlyOnMobile &&
104
- css`
105
- width: 48px;
106
-
107
- ${ButtonIcon} {
108
- margin: 0;
109
- }
110
-
111
- > span {
112
- display: none;
113
- }
114
-
115
- ${media.tablet`
116
- width: auto;
117
-
118
- > span {
119
- display: block;
120
- }
121
- `}
122
- `}
123
-
124
- ${({ iconPosition }) =>
125
- iconPosition === "right" &&
126
- css<ButtonProps>`
127
- flex-direction: row-reverse;
128
-
129
- ${ButtonIcon} {
130
- margin: 0 0 0 8px;
131
-
132
- ${({ iconOnlyOnMobile }) =>
133
- iconOnlyOnMobile &&
134
- css`
135
- margin: 0;
136
-
137
- ${media.tablet`
138
- margin: 0 0 0 8px;
139
- `}
140
- `}
141
- }
142
- `}
143
-
144
- ${({ variant }) =>
145
- variant === "secondary" &&
146
- css`
147
- background-color: ${({ theme }) => theme.colors?.secondary};
148
-
149
- &:hover {
150
- background-color: ${({ theme }) => theme.colors?.secondaryHover};
151
- }
152
- `}
153
-
154
- ${({ variant }) =>
155
- variant === "tertiary" &&
156
- css`
157
- background-color: ${({ theme }) => theme.colors?.gray};
158
-
159
- &:hover {
160
- background-color: ${({ theme }) => theme.colors?.gray.light};
161
- }
162
- `}
163
-
164
- ${({ variant }) =>
165
- variant === "warning" &&
166
- css`
167
- background-color: ${({ theme }) => theme.colors?.red};
168
- `}
169
-
170
- ${({ size }) =>
171
- size === "auto" &&
172
- css`
173
- width: auto;
174
- `}
175
-
176
- ${({ isLoading }) =>
177
- isLoading &&
178
- css`
179
- cursor: not-allowed;
180
-
181
- &:hover,
182
- &:focus {
183
- background-color: ${({ theme }) => theme.colors?.black.light};
184
- }
185
- `}
186
-
187
- ${({ disabled }) =>
188
- disabled &&
189
- css`
190
- color: ${({ theme }) => theme.colors?.white}};
191
- background-color: ${({ theme }) => theme.colors?.gray};
192
- cursor: not-allowed;
193
-
194
- &:focus {
195
- background-color: ${({ theme }) => theme.colors?.gray};
196
- }
197
-
198
- ${media.desktop`
199
- transition: none;
200
-
201
- &:hover {
202
- background-color: ${({ theme }) => theme.colors?.gray};;
203
- }
204
- `}
205
- `};
206
- `;
@@ -1,94 +0,0 @@
1
- import * as React from "react";
2
- import { Link } from "react-router-dom";
3
-
4
- import { ButtonProps } from "./types";
5
- import { StyledButton, StyledButtonLoader, ButtonIcon } from "./Button.styled";
6
-
7
- const ButtonLoader = () => (
8
- <StyledButtonLoader>
9
- <div />
10
- <div />
11
- <div />
12
- </StyledButtonLoader>
13
- );
14
-
15
- const ButtonContent: React.FC<ButtonProps> = ({
16
- children,
17
- icon,
18
- isLoading,
19
- }) => (
20
- <>
21
- {isLoading ? (
22
- <ButtonLoader />
23
- ) : (
24
- <>
25
- {icon && <ButtonIcon>{icon}</ButtonIcon>}
26
- <span>{children}</span>
27
- </>
28
- )}
29
- </>
30
- );
31
-
32
- export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
33
- (
34
- {
35
- children,
36
- href,
37
- icon,
38
- iconPosition = "left",
39
- isLoading,
40
- onClick,
41
- to,
42
- urlTarget,
43
- disabled,
44
- variant,
45
- iconOnlyOnMobile,
46
- ...otherProps
47
- },
48
- ref
49
- ) => {
50
- const styledButtonProps = {
51
- disabled,
52
- iconOnly: !children && icon,
53
- iconOnlyOnMobile,
54
- iconPosition,
55
- isLoading,
56
- variant,
57
- ref,
58
- };
59
-
60
- const buttonContentProps = {
61
- children,
62
- icon,
63
- isLoading,
64
- };
65
-
66
- if (href) {
67
- return (
68
- <StyledButton
69
- as="a"
70
- href={href}
71
- target={`_${urlTarget ?? "self"}`}
72
- {...styledButtonProps}
73
- {...otherProps}
74
- >
75
- <ButtonContent {...buttonContentProps} />
76
- </StyledButton>
77
- );
78
- }
79
-
80
- if (to) {
81
- return (
82
- <StyledButton as={Link} to={to} {...styledButtonProps} {...otherProps}>
83
- <ButtonContent {...buttonContentProps} />
84
- </StyledButton>
85
- );
86
- }
87
-
88
- return (
89
- <StyledButton onClick={onClick} {...styledButtonProps} {...otherProps}>
90
- <ButtonContent {...buttonContentProps} />
91
- </StyledButton>
92
- );
93
- }
94
- );
@@ -1 +0,0 @@
1
- export { Button as AgosButton } from "./Button";
@@ -1,34 +0,0 @@
1
- import * as i from "types";
2
-
3
- export type ButtonType = React.ButtonHTMLAttributes<HTMLButtonElement> &
4
- React.AnchorHTMLAttributes<HTMLAnchorElement> & {
5
- as?: any;
6
- children?: React.ReactNode;
7
- disabled?: boolean;
8
- href?: string;
9
- iconOnly?: boolean;
10
- iconOnlyOnMobile?: boolean;
11
- isLoading?: boolean;
12
- onClick?: i.OnClick<HTMLButtonElement>;
13
- ref?: React.RefObject<HTMLButtonElement>;
14
- to?: string;
15
- urlTarget?: "blank" | "self" | "parent" | "top";
16
- };
17
-
18
- export type IconType = {
19
- icon?: React.ReactNode;
20
- iconPosition?: "left" | "right";
21
- };
22
-
23
- export type ButtonVariantsType = {
24
- variant?: "primary" | "secondary" | "tertiary" | "warning";
25
- };
26
-
27
- export type ButtonSizeType = {
28
- size?: "auto";
29
- };
30
-
31
- export type ButtonProps = ButtonType &
32
- ButtonSizeType &
33
- ButtonVariantsType &
34
- IconType;
@@ -1,28 +0,0 @@
1
- import { ComponentStory, ComponentMeta } from "@storybook/react";
2
- import { ConfirmModal } from "./ConfirmModal";
3
-
4
- export default {
5
- title: "Agos/Components/ConfirmModal",
6
- component: ConfirmModal,
7
- } as ComponentMeta<typeof ConfirmModal>;
8
-
9
- const Template: ComponentStory<typeof ConfirmModal> = (args) => (
10
- <ConfirmModal {...args} />
11
- );
12
-
13
- export const Primary = Template.bind({});
14
-
15
- Primary.args = {
16
- closeModal: () => {
17
- console.log("Close");
18
- },
19
- closeButtonVariant: "warning",
20
- closeText: "Close",
21
- confirmButtonVariant: "warning",
22
- confirmText: "Confirm",
23
- text: "Do you want to confirm this action?",
24
- title: "Confirm this action",
25
- onConfirm: () => {
26
- console.log("Confirm");
27
- },
28
- };
@@ -1,15 +0,0 @@
1
- import styled from "styled-components";
2
-
3
- export const ModalFooter = styled.div`
4
- align-items: center;
5
- display: flex;
6
- flex-direction: row;
7
- justify-content: flex-end;
8
- padding: 24px;
9
-
10
- & > button {
11
- + button {
12
- margin: 0 0 0 8px;
13
- }
14
- }
15
- `;
@@ -1,49 +0,0 @@
1
- import * as React from "react";
2
-
3
- import { Text } from "legacy_agos/typography/Text";
4
- import { AgosButton as Button, Modal } from "legacy_agos/common";
5
-
6
- export const ConfirmModal: React.FC<ConfirmModalProps> = ({
7
- closeButtonVariant,
8
- closeModal,
9
- closeText,
10
- confirmButtonVariant,
11
- confirmText,
12
- onConfirm,
13
- text,
14
- title,
15
- }) => {
16
- return (
17
- <Modal.Container
18
- onClose={closeModal}
19
- title={title ?? "Confirm"}
20
- withoutCloseButton
21
- >
22
- <Modal.Content>
23
- <Text>{text}</Text>
24
- </Modal.Content>
25
- <Modal.Footer>
26
- <Button
27
- onClick={closeModal}
28
- variant={closeButtonVariant ?? "secondary"}
29
- >
30
- {closeText ?? "Cancel"}
31
- </Button>
32
- <Button onClick={onConfirm} variant={confirmButtonVariant ?? "primary"}>
33
- {confirmText ?? "Confirm"}
34
- </Button>
35
- </Modal.Footer>
36
- </Modal.Container>
37
- );
38
- };
39
-
40
- type ConfirmModalProps = {
41
- closeButtonVariant?: "warning" | "tertiary";
42
- closeModal: () => void;
43
- closeText?: string;
44
- confirmButtonVariant?: "warning" | "secondary";
45
- confirmText?: string;
46
- onConfirm: () => void;
47
- text: string;
48
- title?: string;
49
- };
@@ -1 +0,0 @@
1
- export { ConfirmModal } from "./ConfirmModal";