@integrigo/integrigo-ui 1.6.17 → 1.6.18

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 (79) hide show
  1. package/jest.config.js +1 -1
  2. package/lib/index.d.ts +2 -0
  3. package/lib/index.esm.js +1 -1
  4. package/lib/index.esm.js.map +1 -1
  5. package/lib/index.js +1 -1
  6. package/lib/index.js.map +1 -1
  7. package/lib/src/components/atoms/Chip/Chip.d.ts +5 -4
  8. package/lib/src/components/atoms/Chip/Chip.stories.d.ts +3 -3
  9. package/lib/src/components/atoms/Dot/Dot.stories.d.ts +3 -3
  10. package/lib/src/components/atoms/Icon/Icon.d.ts +11 -1
  11. package/lib/src/components/atoms/Icon/Icon.stories.d.ts +2 -2
  12. package/lib/src/components/atoms/Icon/IconAddition.d.ts +5 -5
  13. package/lib/src/components/atoms/Icon/icons/Calendar.d.ts +3 -0
  14. package/lib/src/components/atoms/Icon/icons/CloseSquare.d.ts +3 -0
  15. package/lib/src/components/atoms/Icon/icons/CommentDots.d.ts +3 -0
  16. package/lib/src/components/atoms/Icon/icons/DiceOne.d.ts +3 -0
  17. package/lib/src/components/atoms/Icon/icons/Eye.d.ts +3 -0
  18. package/lib/src/components/atoms/Icon/icons/Heart.d.ts +3 -0
  19. package/lib/src/components/atoms/Icon/icons/HeartAlt.d.ts +3 -0
  20. package/lib/src/components/atoms/Icon/icons/HourGlass.d.ts +3 -0
  21. package/lib/src/components/atoms/Icon/icons/QuestionCircle.d.ts +3 -0
  22. package/lib/src/components/atoms/Icon/icons/Rocket.d.ts +3 -0
  23. package/lib/src/components/atoms/Icon/icons/Search.d.ts +3 -0
  24. package/lib/src/components/atoms/Typography/Hero.d.ts +1 -1
  25. package/lib/src/components/atoms/index.d.ts +1 -0
  26. package/lib/src/components/molecules/Checkbox/Checkbox.stories.d.ts +4 -4
  27. package/lib/src/components/molecules/Input/Input.d.ts +8 -8
  28. package/lib/src/components/molecules/Input/Input.stories.d.ts +9 -9
  29. package/lib/src/components/molecules/Radio/Radio.stories.d.ts +4 -4
  30. package/lib/src/components/molecules/Switch/Switch.d.ts +13 -0
  31. package/lib/src/components/molecules/Switch/Switch.stories.d.ts +7 -0
  32. package/lib/src/components/molecules/Switch/index.d.ts +1 -0
  33. package/lib/src/components/molecules/index.d.ts +1 -0
  34. package/lib/src/components/organisms/Modal/Divider.d.ts +2 -0
  35. package/lib/src/components/organisms/Modal/Modal.d.ts +5 -1
  36. package/lib/src/components/organisms/Modal/Modal.stories.d.ts +2 -2
  37. package/lib/src/components/organisms/Table/Table.d.ts +12 -0
  38. package/lib/src/components/organisms/Table/Table.stories.d.ts +7 -0
  39. package/lib/src/components/organisms/Table/Table.test.d.ts +1 -0
  40. package/lib/src/components/organisms/Table/index.d.ts +1 -0
  41. package/lib/src/components/organisms/index.d.ts +1 -0
  42. package/lib/src/index.d.ts +4 -4
  43. package/package.json +7 -6
  44. package/src/components/atoms/Chip/Chip.stories.tsx +6 -8
  45. package/src/components/atoms/Chip/Chip.tsx +28 -17
  46. package/src/components/atoms/Icon/Icon.tsx +21 -1
  47. package/src/components/atoms/Icon/IconAddition.tsx +22 -20
  48. package/src/components/atoms/Icon/icons/Calendar.tsx +9 -0
  49. package/src/components/atoms/Icon/icons/CloseSquare.tsx +9 -0
  50. package/src/components/atoms/Icon/icons/CommentDots.tsx +9 -0
  51. package/src/components/atoms/Icon/icons/DiceOne.tsx +9 -0
  52. package/src/components/atoms/Icon/icons/Eye.tsx +9 -0
  53. package/src/components/atoms/Icon/icons/Heart.tsx +9 -0
  54. package/src/components/atoms/Icon/icons/HeartAlt.tsx +9 -0
  55. package/src/components/atoms/Icon/icons/HourGlass.tsx +9 -0
  56. package/src/components/atoms/Icon/icons/QuestionCircle.tsx +9 -0
  57. package/src/components/atoms/Icon/icons/Rocket.tsx +9 -0
  58. package/src/components/atoms/Icon/icons/Search.tsx +9 -0
  59. package/src/components/atoms/Typography/Hero.tsx +3 -2
  60. package/src/components/atoms/index.ts +1 -0
  61. package/src/components/molecules/Button/BasicButton.tsx +2 -1
  62. package/src/components/molecules/Button/Button.tsx +5 -4
  63. package/src/components/molecules/Input/Input.tsx +51 -47
  64. package/src/components/molecules/Profile/Profile.tsx +2 -2
  65. package/src/components/molecules/Switch/Switch.stories.tsx +39 -0
  66. package/src/components/molecules/Switch/Switch.tsx +94 -0
  67. package/src/components/molecules/Switch/index.ts +1 -0
  68. package/src/components/molecules/index.ts +1 -0
  69. package/src/components/organisms/Modal/Divider.tsx +13 -0
  70. package/src/components/organisms/Modal/Modal.stories.tsx +2 -0
  71. package/src/components/organisms/Modal/Modal.tsx +9 -6
  72. package/src/components/organisms/Table/Table.stories.tsx +180 -0
  73. package/src/components/organisms/Table/Table.test.tsx +82 -0
  74. package/src/components/organisms/Table/Table.tsx +162 -0
  75. package/src/components/organisms/Table/__snapshots__/Table.test.tsx.snap +101 -0
  76. package/src/components/organisms/Table/index.ts +1 -0
  77. package/src/components/organisms/index.ts +3 -2
  78. package/src/index.ts +6 -4
  79. package/src/styles/global.ts +7 -1
@@ -0,0 +1,162 @@
1
+ import React from 'react';
2
+ import {
3
+ Column,
4
+ flexRender,
5
+ getCoreRowModel,
6
+ useReactTable,
7
+ } from '@tanstack/react-table';
8
+ import styled from 'styled-components';
9
+
10
+ type Variant = 'primary' | 'secondary';
11
+ type Alignment = 'left' | 'right' | 'center';
12
+
13
+ const colorVariant = {
14
+ primary: {
15
+ backgroundColor: 'var(--color-orange)',
16
+ fontColor: 'var(--color-white)',
17
+ },
18
+ secondary: {
19
+ backgroundColor: 'var(--color-navy)',
20
+ fontColor: 'var(--color-white)',
21
+ },
22
+ };
23
+
24
+ export interface Props <T extends Record<string, unknown>> extends React.TableHTMLAttributes<HTMLTableElement> {
25
+ data: T[];
26
+ columns: Column<T>[];
27
+ variant?: Variant;
28
+ textAlign?: Alignment
29
+ }
30
+
31
+ export const Table = <T extends Record<string, unknown>>({
32
+ data,
33
+ columns,
34
+ variant = 'primary',
35
+ textAlign = 'center',
36
+ ...props
37
+ }: Props<T>) => {
38
+
39
+ const table = useReactTable({
40
+ data,
41
+ columns,
42
+ getCoreRowModel: getCoreRowModel(),
43
+ });
44
+
45
+ return (
46
+ <div>
47
+ <StyledTable cellSpacing={0} {...props}>
48
+ <StyledHead variant={variant} textAlign={textAlign}>
49
+ {table.getHeaderGroups().map(headerGroup => (
50
+ <tr key={headerGroup.id}>
51
+ {headerGroup.headers.map(header => (
52
+ <th key={header.id}>
53
+ {header.isPlaceholder
54
+ ? null
55
+ : flexRender(
56
+ header.column.columnDef.header,
57
+ header.getContext(),
58
+ )}
59
+ </th>
60
+ ))}
61
+ </tr>
62
+ ))}
63
+ </StyledHead>
64
+ <StyledBody textAlign={textAlign}>
65
+ {table.getRowModel().rows.map(row => (
66
+ <tr key={row.id}>
67
+ {row.getVisibleCells().map(cell => (
68
+ <td key={cell.id}>
69
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
70
+ </td>
71
+ ))}
72
+ </tr>
73
+ ))}
74
+ </StyledBody>
75
+ </StyledTable>
76
+ </div>
77
+ );
78
+ };
79
+
80
+ const StyledTable = styled.table`
81
+
82
+ `;
83
+
84
+ StyledTable.displayName = 'StyledTable';
85
+
86
+ const StyledHead = styled.thead<{ variant: Variant, textAlign: Alignment }>`
87
+ padding: 15px 10px;
88
+ height: 54px;
89
+
90
+ & tr th {
91
+ font-weight: 700;
92
+ font-size: 16px;
93
+ line-height: 24px;
94
+ padding: 15px 10px;
95
+ color: white;
96
+ text-align: ${props => props.textAlign};
97
+ }
98
+
99
+ ${(p) => `
100
+ background-color: ${colorVariant[p.variant].backgroundColor};
101
+ color: ${colorVariant[p.variant].fontColor};
102
+
103
+ & th:first-child {
104
+ box-shadow: -10px 0px 10px 1px rgba(0, 0, 0, 0.1);
105
+ border-radius: 5px 0px 0px 0px;
106
+ }
107
+
108
+ & th:last-child {
109
+ box-shadow: 10px 0px 10px 1px rgba(0, 0, 0, 0.1);
110
+ border-radius: 0px 5px 0px 0px;
111
+ }
112
+ `}
113
+ `;
114
+
115
+ StyledHead.displayName = 'StyledHead';
116
+
117
+ const StyledBody = styled.tbody<{ textAlign: Alignment }>`
118
+ tr, td {
119
+ //height for td works like min-height. Table cells will grow when the content does not fit.
120
+ height: 52px;
121
+ }
122
+
123
+ tr td {
124
+ padding: 10px;
125
+ text-align: ${props => props.textAlign};
126
+ }
127
+
128
+ tr:nth-child(even) {
129
+ background-color: var(--shades-of-grey-0);
130
+ }
131
+
132
+ tr:nth-child(odd) {
133
+ background-color: var(--shades-of-grey-20);
134
+ }
135
+
136
+ tr:hover {
137
+ background-color: rgba(224, 154, 51, 0.2);
138
+
139
+ td {
140
+ border-top: solid 2px var(--color-orange);
141
+ border-bottom: solid 2px var(--color-orange);
142
+ }
143
+
144
+ td:first-child {
145
+ border-left: solid 2px var(--color-orange);
146
+ border-bottom: solid 2px var(--color-orange);
147
+ border-top: solid 2px var(--color-orange);
148
+ border-top-left-radius: 10px;
149
+ border-bottom-left-radius: 10px;
150
+ }
151
+
152
+ td:last-child {
153
+ border-right: solid 2px var(--color-orange);
154
+ border-bottom: solid 2px var(--color-orange);
155
+ border-top: solid 2px var(--color-orange);
156
+ border-top-right-radius: 10px;
157
+ border-bottom-right-radius: 10px;
158
+ }
159
+ }
160
+ `;
161
+
162
+ StyledBody.displayName = 'StyledBody';
@@ -0,0 +1,101 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<Table /> enabled - should match snapshot 1`] = `
4
+ <div>
5
+ <div>
6
+ <table
7
+ cellspacing="0"
8
+ class="sc-bcXHqe eCGCkv"
9
+ >
10
+ <thead
11
+ class="sc-gswNZR qcRyf"
12
+ >
13
+ <tr>
14
+ <th>
15
+ firstName
16
+ </th>
17
+ <th>
18
+ Last Name
19
+ </th>
20
+ <th>
21
+ Age
22
+ </th>
23
+ <th>
24
+ Visits
25
+ </th>
26
+ <th>
27
+ Status
28
+ </th>
29
+ <th>
30
+ Profile Progress
31
+ </th>
32
+ </tr>
33
+ </thead>
34
+ <tbody
35
+ class="sc-dkrFOg jkyDVI"
36
+ >
37
+ <tr>
38
+ <td>
39
+ tanner
40
+ </td>
41
+ <td>
42
+ linsley
43
+ </td>
44
+ <td>
45
+ 24
46
+ </td>
47
+ <td>
48
+ 100
49
+ </td>
50
+ <td>
51
+ In Relationship
52
+ </td>
53
+ <td>
54
+ 50
55
+ </td>
56
+ </tr>
57
+ <tr>
58
+ <td>
59
+ tandy
60
+ </td>
61
+ <td>
62
+ miller
63
+ </td>
64
+ <td>
65
+ 40
66
+ </td>
67
+ <td>
68
+ 40
69
+ </td>
70
+ <td>
71
+ Single
72
+ </td>
73
+ <td>
74
+ 80
75
+ </td>
76
+ </tr>
77
+ <tr>
78
+ <td>
79
+ joe
80
+ </td>
81
+ <td>
82
+ dirte
83
+ </td>
84
+ <td>
85
+ 45
86
+ </td>
87
+ <td>
88
+ 20
89
+ </td>
90
+ <td>
91
+ Complicated
92
+ </td>
93
+ <td>
94
+ 10
95
+ </td>
96
+ </tr>
97
+ </tbody>
98
+ </table>
99
+ </div>
100
+ </div>
101
+ `;
@@ -0,0 +1 @@
1
+ export { Table } from './Table';
@@ -1,4 +1,5 @@
1
1
  export { Menu } from './Menu';
2
2
  export { Setting } from './Setting';
3
- export { Modal } from './Modal'
4
- export { Select } from './Select'
3
+ export { Modal } from './Modal';
4
+ export { Select } from './Select';
5
+ export { Table } from './Table';
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@ export {
3
3
  Avatar,
4
4
  Card,
5
5
  Divider,
6
+ DateTime,
6
7
  Icon,
7
8
  Nav,
8
9
  Pill,
@@ -11,7 +12,7 @@ export {
11
12
  Chip,
12
13
  Dot,
13
14
  Gradient,
14
- } from "./components/atoms";
15
+ } from './components/atoms';
15
16
 
16
17
  export {
17
18
  InfoCard,
@@ -23,8 +24,9 @@ export {
23
24
  Profile,
24
25
  Radio,
25
26
  Tile,
26
- } from "./components/molecules";
27
+ Switch,
28
+ } from './components/molecules';
27
29
 
28
- export { Menu, Setting, Modal, Select } from "./components/organisms";
30
+ export { Menu, Setting, Modal, Select, Table } from './components/organisms';
29
31
 
30
- export { GlobalStyles as IntegrigoUI, Color } from "./styles";
32
+ export { GlobalStyles as IntegrigoUI, Color } from './styles';
@@ -50,12 +50,13 @@ export const GlobalStyles = createGlobalStyle`
50
50
  --font-medium: 600;
51
51
  --font-thin: 300;
52
52
 
53
- --font-size-s: 10px;
53
+ --font-size-s: 12px;
54
54
  --font-size-m: 16px;
55
55
  --font-size-l: 20px;
56
56
  --font-size-xl: 32px;
57
57
  --font-size-xxl: 40px;
58
58
 
59
+ --header-size-xs: 12px;
59
60
  --header-size-s: 16px;
60
61
  --header-size-m: 24px;
61
62
  --header-size-l: 32px;
@@ -101,4 +102,9 @@ export const GlobalStyles = createGlobalStyle`
101
102
  font-size: var(--header-size-s);
102
103
  font-weight: var(--font-bold);
103
104
  }
105
+
106
+ h5 {
107
+ font-size: var(--header-size-xs);
108
+ font-weight: var(--font-bold);
109
+ }
104
110
  `;