@ltht-react/table 2.0.192 → 2.0.194

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 (54) hide show
  1. package/README.md +15 -15
  2. package/package.json +8 -8
  3. package/src/atoms/questionnaire-withdrawn-table-cell.tsx +15 -15
  4. package/src/index.tsx +8 -8
  5. package/src/molecules/table-cell.tsx +111 -111
  6. package/src/molecules/table-component.tsx +123 -123
  7. package/src/molecules/table-header.tsx +38 -38
  8. package/src/molecules/table-methods.tsx +238 -238
  9. package/src/molecules/table-styled-components.tsx +249 -249
  10. package/src/molecules/table.tsx +166 -166
  11. package/src/molecules/useDimensionRef.tsx +37 -37
  12. package/src/molecules/useScrollRef.tsx +40 -40
  13. package/src/organisms/generic-table.tsx +34 -34
  14. package/src/organisms/questionnaire-table-methods.tsx +351 -351
  15. package/src/organisms/questionnaire-table.tsx +56 -56
  16. package/lib/atoms/questionnaire-withdrawn-table-cell.d.ts +0 -6
  17. package/lib/atoms/questionnaire-withdrawn-table-cell.js +0 -19
  18. package/lib/atoms/questionnaire-withdrawn-table-cell.js.map +0 -1
  19. package/lib/index.d.ts +0 -7
  20. package/lib/index.js +0 -15
  21. package/lib/index.js.map +0 -1
  22. package/lib/molecules/table-cell.d.ts +0 -17
  23. package/lib/molecules/table-cell.js +0 -109
  24. package/lib/molecules/table-cell.js.map +0 -1
  25. package/lib/molecules/table-component.d.ts +0 -20
  26. package/lib/molecules/table-component.js +0 -78
  27. package/lib/molecules/table-component.js.map +0 -1
  28. package/lib/molecules/table-header.d.ts +0 -12
  29. package/lib/molecules/table-header.js +0 -33
  30. package/lib/molecules/table-header.js.map +0 -1
  31. package/lib/molecules/table-methods.d.ts +0 -14
  32. package/lib/molecules/table-methods.js +0 -198
  33. package/lib/molecules/table-methods.js.map +0 -1
  34. package/lib/molecules/table-styled-components.d.ts +0 -81
  35. package/lib/molecules/table-styled-components.js +0 -112
  36. package/lib/molecules/table-styled-components.js.map +0 -1
  37. package/lib/molecules/table.d.ts +0 -44
  38. package/lib/molecules/table.js +0 -95
  39. package/lib/molecules/table.js.map +0 -1
  40. package/lib/molecules/useDimensionRef.d.ts +0 -5
  41. package/lib/molecules/useDimensionRef.js +0 -31
  42. package/lib/molecules/useDimensionRef.js.map +0 -1
  43. package/lib/molecules/useScrollRef.d.ts +0 -8
  44. package/lib/molecules/useScrollRef.js +0 -30
  45. package/lib/molecules/useScrollRef.js.map +0 -1
  46. package/lib/organisms/generic-table.d.ts +0 -9
  47. package/lib/organisms/generic-table.js +0 -36
  48. package/lib/organisms/generic-table.js.map +0 -1
  49. package/lib/organisms/questionnaire-table-methods.d.ts +0 -9
  50. package/lib/organisms/questionnaire-table-methods.js +0 -247
  51. package/lib/organisms/questionnaire-table-methods.js.map +0 -1
  52. package/lib/organisms/questionnaire-table.d.ts +0 -12
  53. package/lib/organisms/questionnaire-table.js +0 -44
  54. package/lib/organisms/questionnaire-table.js.map +0 -1
@@ -1,249 +1,249 @@
1
- import {
2
- CSS_RESET,
3
- TRANSLUCENT_MID_GREY,
4
- SCROLLBAR,
5
- TRANSLUCENT_BRIGHT_BLUE,
6
- BTN_COLOURS,
7
- TABLE_COLOURS,
8
- StickyTableData,
9
- StickyTableHead,
10
- getZIndex,
11
- } from '@ltht-react/styles'
12
- import styled from '@emotion/styled'
13
- import Icon, { IconButton } from '@ltht-react/icon'
14
- import { Axis } from '@ltht-react/types'
15
-
16
- const setScrollableDisplay = (tableHeaderAxis: Axis, isFlex: boolean) => {
17
- if (isFlex) {
18
- return 'flex'
19
- }
20
-
21
- if (tableHeaderAxis === 'y') {
22
- return 'inline-flex'
23
- }
24
-
25
- return 'inline-block'
26
- }
27
-
28
- const ScrollableContainer = styled.div<IScrollableContainer>`
29
- ${CSS_RESET};
30
- background-color: white;
31
- ${({ tableHeaderAxis, maxWidth, maxHeight, isFlex }) => `
32
- display: ${setScrollableDisplay(tableHeaderAxis, isFlex)};
33
- ${isFlex && 'flex-direction: column'};
34
- max-width: ${maxWidth ?? '100%'};
35
- max-height: ${maxHeight ?? '100%'};
36
- `}
37
- border-radius: 6px;
38
- overflow: auto;
39
- &::-webkit-scrollbar {
40
- width: 7px;
41
- height: 7px;
42
- border: 0;
43
- }
44
- &::-webkit-scrollbar-thumb {
45
- background: ${SCROLLBAR};
46
- border-radius: 10px;
47
- }
48
- `
49
-
50
- const StyledTable = styled.table`
51
- border-spacing: 0;
52
- border-radius: 6px;
53
- `
54
-
55
- const StyledTableHeader = styled.th<IStyledTableCell>`
56
- background-color: ${TABLE_COLOURS.HEADER};
57
- border: thin solid ${TABLE_COLOURS.BORDER};
58
- font-weight: bold;
59
- padding: 0.5rem;
60
-
61
- ${({ stickyWidth }) =>
62
- stickyWidth !== undefined &&
63
- `
64
- position: sticky !important;
65
- left: ${stickyWidth}px;
66
- top: 0;
67
- z-index: ${getZIndex(StickyTableData)};`}
68
- `
69
- const StyledTableData = styled.td<IStyledTableCell>`
70
- border: thin solid ${TABLE_COLOURS.BORDER};
71
- white-space: normal;
72
- text-align: center;
73
- padding: 0.15rem;
74
-
75
- &:first-of-type {
76
- background-color: ${TABLE_COLOURS.HEADER} !important;
77
- font-weight: bold;
78
- }
79
-
80
- ${({ stickyWidth }) =>
81
- stickyWidth !== undefined &&
82
- `
83
- background-color: ${TABLE_COLOURS.STRIPE_LIGHT};
84
- position: sticky !important;
85
- left: ${stickyWidth}px;
86
- top: 0;
87
- z-index: ${getZIndex(StickyTableData)};`}
88
-
89
- ${({ tableHeaderAxis }) =>
90
- tableHeaderAxis === 'y' &&
91
- `
92
- &:nth-of-type(even) {
93
- background-color: ${TABLE_COLOURS.STRIPE_DARK};
94
- }`}
95
- `
96
- const StyledTableRow = styled.tr<IStyledTableCell>`
97
- ${({ tableHeaderAxis }) =>
98
- tableHeaderAxis === 'x' &&
99
- `
100
- &:nth-of-type(odd) {
101
- background-color: ${TABLE_COLOURS.STRIPE_DARK};
102
- }`}
103
- `
104
- const PaginationContainer = styled.div`
105
- ${CSS_RESET};
106
- margin-top: 5px;
107
- display: block;
108
- `
109
- const StyledPaginationPageInput = styled.input`
110
- ${CSS_RESET};
111
- width: 50px;
112
- border: 1px solid gray;
113
- `
114
- const StyledPaginationPageSelect = styled.select`
115
- ${CSS_RESET};
116
- width: 45px;
117
- display: inline-block;
118
- font-size: 0.9rem;
119
- border: 1px solid gray;
120
- `
121
- const StyledHideOnMobile = styled.span`
122
- font-size: 1.1em;
123
- padding: 2px;
124
- @media (max-width: 320px) {
125
- display: none;
126
- }
127
- `
128
- const StyledPaginationButtonDiv = styled.div`
129
- float: right;
130
- display: flex;
131
- justify-content: space-between;
132
- align-items: stretch;
133
- `
134
- const StyledPageCountDiv = styled.div`
135
- margin-right: 5px;
136
- margin-left: 5px;
137
- display: flex;
138
- font-size: 1.1em;
139
- padding: 1px;
140
- `
141
- const StyledStandardButton = styled(IconButton)`
142
- color: ${BTN_COLOURS.STANDARD.TEXT};
143
- background-color: ${BTN_COLOURS.STANDARD.VALUE};
144
- padding: 2px 5px;
145
- border-radius: 5px;
146
- &:hover {
147
- background-color: ${BTN_COLOURS.STANDARD.HOVER};
148
- }
149
-
150
- &:disabled {
151
- background-color: ${BTN_COLOURS.STANDARD.DISABLED};
152
- }
153
- `
154
- const StyledPaginationButton = styled(IconButton)`
155
- padding: 2px 5px;
156
- background-color: ${TRANSLUCENT_BRIGHT_BLUE};
157
- color: black;
158
- border: 1px solid ${TRANSLUCENT_MID_GREY};
159
- margin: 0 2.5px;
160
- border-radius: 3px;
161
-
162
- &:disabled {
163
- background-color: inherit;
164
- color: gray;
165
- border-color: ${TRANSLUCENT_MID_GREY};
166
- pointer-events: none;
167
- }
168
- `
169
- const StyledSpinnerIcon = styled(Icon)`
170
- margin: 3px 0;
171
- font-size: 1.1em;
172
- padding: 1.5px;
173
- `
174
- const StyledNextPageButtonContainer = styled.div<IStyledNextPageButtonContainer>`
175
- display: ${({ hidden, elementPosition }) => {
176
- if (!hidden) {
177
- return elementPosition === 'bottom' ? 'flex' : 'inline-flex'
178
- }
179
-
180
- return 'none'
181
- }};
182
- justify-content: center;
183
- cursor: pointer;
184
- align-items: center;
185
- padding: 10px;
186
- font-size: 1.3em;
187
- border: solid 2px #eeeeee;
188
- border-left: solid 1px #eeeeee;
189
-
190
- :hover {
191
- background-color: #f3f6f6;
192
- }
193
- `
194
-
195
- const StyledSpinnerContainer = styled.div<IStyledNextPageButtonContainer>`
196
- display: ${({ hidden, elementPosition }) => {
197
- if (!hidden) {
198
- return elementPosition === 'bottom' ? 'flex' : 'inline-flex'
199
- }
200
-
201
- return 'none'
202
- }};
203
- justify-content: center;
204
- cursor: pointer;
205
- align-items: center;
206
- padding: 5px;
207
- `
208
- const StyledTHead = styled.thead`
209
- position: sticky;
210
- left: 0;
211
- top: 0;
212
- z-index: ${getZIndex(StickyTableHead)};
213
- `
214
-
215
- interface IStyledTableCell {
216
- stickyWidth?: number
217
- tableHeaderAxis?: string
218
- }
219
-
220
- interface IStyledNextPageButtonContainer {
221
- elementPosition: 'right' | 'bottom'
222
- }
223
-
224
- interface IScrollableContainer {
225
- tableHeaderAxis: Axis
226
- maxHeight?: string
227
- maxWidth?: string
228
- isFlex: boolean
229
- }
230
-
231
- export {
232
- StyledTable,
233
- StyledTableHeader,
234
- StyledTableRow,
235
- StyledTableData,
236
- PaginationContainer,
237
- StyledPaginationPageInput,
238
- StyledPaginationPageSelect,
239
- StyledHideOnMobile,
240
- StyledPaginationButton,
241
- ScrollableContainer,
242
- StyledPaginationButtonDiv,
243
- StyledPageCountDiv,
244
- StyledStandardButton,
245
- StyledSpinnerIcon,
246
- StyledNextPageButtonContainer,
247
- StyledTHead,
248
- StyledSpinnerContainer,
249
- }
1
+ import {
2
+ CSS_RESET,
3
+ TRANSLUCENT_MID_GREY,
4
+ SCROLLBAR,
5
+ TRANSLUCENT_BRIGHT_BLUE,
6
+ BTN_COLOURS,
7
+ TABLE_COLOURS,
8
+ StickyTableData,
9
+ StickyTableHead,
10
+ getZIndex,
11
+ } from '@ltht-react/styles'
12
+ import styled from '@emotion/styled'
13
+ import Icon, { IconButton } from '@ltht-react/icon'
14
+ import { Axis } from '@ltht-react/types'
15
+
16
+ const setScrollableDisplay = (tableHeaderAxis: Axis, isFlex: boolean) => {
17
+ if (isFlex) {
18
+ return 'flex'
19
+ }
20
+
21
+ if (tableHeaderAxis === 'y') {
22
+ return 'inline-flex'
23
+ }
24
+
25
+ return 'inline-block'
26
+ }
27
+
28
+ const ScrollableContainer = styled.div<IScrollableContainer>`
29
+ ${CSS_RESET};
30
+ background-color: white;
31
+ ${({ tableHeaderAxis, maxWidth, maxHeight, isFlex }) => `
32
+ display: ${setScrollableDisplay(tableHeaderAxis, isFlex)};
33
+ ${isFlex && 'flex-direction: column'};
34
+ max-width: ${maxWidth ?? '100%'};
35
+ max-height: ${maxHeight ?? '100%'};
36
+ `}
37
+ border-radius: 6px;
38
+ overflow: auto;
39
+ &::-webkit-scrollbar {
40
+ width: 7px;
41
+ height: 7px;
42
+ border: 0;
43
+ }
44
+ &::-webkit-scrollbar-thumb {
45
+ background: ${SCROLLBAR};
46
+ border-radius: 10px;
47
+ }
48
+ `
49
+
50
+ const StyledTable = styled.table`
51
+ border-spacing: 0;
52
+ border-radius: 6px;
53
+ `
54
+
55
+ const StyledTableHeader = styled.th<IStyledTableCell>`
56
+ background-color: ${TABLE_COLOURS.HEADER};
57
+ border: thin solid ${TABLE_COLOURS.BORDER};
58
+ font-weight: bold;
59
+ padding: 0.5rem;
60
+
61
+ ${({ stickyWidth }) =>
62
+ stickyWidth !== undefined &&
63
+ `
64
+ position: sticky !important;
65
+ left: ${stickyWidth}px;
66
+ top: 0;
67
+ z-index: ${getZIndex(StickyTableData)};`}
68
+ `
69
+ const StyledTableData = styled.td<IStyledTableCell>`
70
+ border: thin solid ${TABLE_COLOURS.BORDER};
71
+ white-space: normal;
72
+ text-align: center;
73
+ padding: 0.15rem;
74
+
75
+ &:first-of-type {
76
+ background-color: ${TABLE_COLOURS.HEADER} !important;
77
+ font-weight: bold;
78
+ }
79
+
80
+ ${({ stickyWidth }) =>
81
+ stickyWidth !== undefined &&
82
+ `
83
+ background-color: ${TABLE_COLOURS.STRIPE_LIGHT};
84
+ position: sticky !important;
85
+ left: ${stickyWidth}px;
86
+ top: 0;
87
+ z-index: ${getZIndex(StickyTableData)};`}
88
+
89
+ ${({ tableHeaderAxis }) =>
90
+ tableHeaderAxis === 'y' &&
91
+ `
92
+ &:nth-of-type(even) {
93
+ background-color: ${TABLE_COLOURS.STRIPE_DARK};
94
+ }`}
95
+ `
96
+ const StyledTableRow = styled.tr<IStyledTableCell>`
97
+ ${({ tableHeaderAxis }) =>
98
+ tableHeaderAxis === 'x' &&
99
+ `
100
+ &:nth-of-type(odd) {
101
+ background-color: ${TABLE_COLOURS.STRIPE_DARK};
102
+ }`}
103
+ `
104
+ const PaginationContainer = styled.div`
105
+ ${CSS_RESET};
106
+ margin-top: 5px;
107
+ display: block;
108
+ `
109
+ const StyledPaginationPageInput = styled.input`
110
+ ${CSS_RESET};
111
+ width: 50px;
112
+ border: 1px solid gray;
113
+ `
114
+ const StyledPaginationPageSelect = styled.select`
115
+ ${CSS_RESET};
116
+ width: 45px;
117
+ display: inline-block;
118
+ font-size: 0.9rem;
119
+ border: 1px solid gray;
120
+ `
121
+ const StyledHideOnMobile = styled.span`
122
+ font-size: 1.1em;
123
+ padding: 2px;
124
+ @media (max-width: 320px) {
125
+ display: none;
126
+ }
127
+ `
128
+ const StyledPaginationButtonDiv = styled.div`
129
+ float: right;
130
+ display: flex;
131
+ justify-content: space-between;
132
+ align-items: stretch;
133
+ `
134
+ const StyledPageCountDiv = styled.div`
135
+ margin-right: 5px;
136
+ margin-left: 5px;
137
+ display: flex;
138
+ font-size: 1.1em;
139
+ padding: 1px;
140
+ `
141
+ const StyledStandardButton = styled(IconButton)`
142
+ color: ${BTN_COLOURS.STANDARD.TEXT};
143
+ background-color: ${BTN_COLOURS.STANDARD.VALUE};
144
+ padding: 2px 5px;
145
+ border-radius: 5px;
146
+ &:hover {
147
+ background-color: ${BTN_COLOURS.STANDARD.HOVER};
148
+ }
149
+
150
+ &:disabled {
151
+ background-color: ${BTN_COLOURS.STANDARD.DISABLED};
152
+ }
153
+ `
154
+ const StyledPaginationButton = styled(IconButton)`
155
+ padding: 2px 5px;
156
+ background-color: ${TRANSLUCENT_BRIGHT_BLUE};
157
+ color: black;
158
+ border: 1px solid ${TRANSLUCENT_MID_GREY};
159
+ margin: 0 2.5px;
160
+ border-radius: 3px;
161
+
162
+ &:disabled {
163
+ background-color: inherit;
164
+ color: gray;
165
+ border-color: ${TRANSLUCENT_MID_GREY};
166
+ pointer-events: none;
167
+ }
168
+ `
169
+ const StyledSpinnerIcon = styled(Icon)`
170
+ margin: 3px 0;
171
+ font-size: 1.1em;
172
+ padding: 1.5px;
173
+ `
174
+ const StyledNextPageButtonContainer = styled.div<IStyledNextPageButtonContainer>`
175
+ display: ${({ hidden, elementPosition }) => {
176
+ if (!hidden) {
177
+ return elementPosition === 'bottom' ? 'flex' : 'inline-flex'
178
+ }
179
+
180
+ return 'none'
181
+ }};
182
+ justify-content: center;
183
+ cursor: pointer;
184
+ align-items: center;
185
+ padding: 10px;
186
+ font-size: 1.3em;
187
+ border: solid 2px #eeeeee;
188
+ border-left: solid 1px #eeeeee;
189
+
190
+ :hover {
191
+ background-color: #f3f6f6;
192
+ }
193
+ `
194
+
195
+ const StyledSpinnerContainer = styled.div<IStyledNextPageButtonContainer>`
196
+ display: ${({ hidden, elementPosition }) => {
197
+ if (!hidden) {
198
+ return elementPosition === 'bottom' ? 'flex' : 'inline-flex'
199
+ }
200
+
201
+ return 'none'
202
+ }};
203
+ justify-content: center;
204
+ cursor: pointer;
205
+ align-items: center;
206
+ padding: 5px;
207
+ `
208
+ const StyledTHead = styled.thead`
209
+ position: sticky;
210
+ left: 0;
211
+ top: 0;
212
+ z-index: ${getZIndex(StickyTableHead)};
213
+ `
214
+
215
+ interface IStyledTableCell {
216
+ stickyWidth?: number
217
+ tableHeaderAxis?: string
218
+ }
219
+
220
+ interface IStyledNextPageButtonContainer {
221
+ elementPosition: 'right' | 'bottom'
222
+ }
223
+
224
+ interface IScrollableContainer {
225
+ tableHeaderAxis: Axis
226
+ maxHeight?: string
227
+ maxWidth?: string
228
+ isFlex: boolean
229
+ }
230
+
231
+ export {
232
+ StyledTable,
233
+ StyledTableHeader,
234
+ StyledTableRow,
235
+ StyledTableData,
236
+ PaginationContainer,
237
+ StyledPaginationPageInput,
238
+ StyledPaginationPageSelect,
239
+ StyledHideOnMobile,
240
+ StyledPaginationButton,
241
+ ScrollableContainer,
242
+ StyledPaginationButtonDiv,
243
+ StyledPageCountDiv,
244
+ StyledStandardButton,
245
+ StyledSpinnerIcon,
246
+ StyledNextPageButtonContainer,
247
+ StyledTHead,
248
+ StyledSpinnerContainer,
249
+ }