carbon-react 111.8.5 → 111.9.1
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.
- package/esm/__internal__/focus-trap/focus-trap-utils.js +21 -1
- package/esm/__internal__/focus-trap/focus-trap.component.js +4 -0
- package/esm/components/flat-table/flat-table-cell/flat-table-cell.component.js +11 -1
- package/esm/components/flat-table/flat-table-cell/flat-table-cell.style.js +3 -1
- package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +11 -1
- package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.style.js +3 -2
- package/esm/components/flat-table/flat-table-head/flat-table-head.style.js +8 -7
- package/esm/components/flat-table/flat-table-header/flat-table-header.component.js +11 -1
- package/esm/components/flat-table/flat-table-header/flat-table-header.d.ts +2 -0
- package/esm/components/flat-table/flat-table-header/flat-table-header.style.js +31 -22
- package/esm/components/flat-table/flat-table-row/flat-table-row.component.js +46 -19
- package/esm/components/flat-table/flat-table-row/flat-table-row.style.js +72 -22
- package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +31 -6
- package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.d.ts +2 -0
- package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.style.js +11 -4
- package/esm/components/flat-table/flat-table.style.js +68 -19
- package/esm/components/grouped-character/grouped-character.component.d.ts +30 -0
- package/esm/components/grouped-character/grouped-character.component.js +544 -41
- package/esm/components/grouped-character/grouped-character.utils.d.ts +2 -0
- package/esm/components/grouped-character/index.d.ts +2 -1
- package/lib/__internal__/focus-trap/focus-trap-utils.js +21 -1
- package/lib/__internal__/focus-trap/focus-trap.component.js +4 -0
- package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.js +11 -1
- package/lib/components/flat-table/flat-table-cell/flat-table-cell.style.js +3 -1
- package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +11 -1
- package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.style.js +3 -2
- package/lib/components/flat-table/flat-table-head/flat-table-head.style.js +8 -7
- package/lib/components/flat-table/flat-table-header/flat-table-header.component.js +11 -1
- package/lib/components/flat-table/flat-table-header/flat-table-header.d.ts +2 -0
- package/lib/components/flat-table/flat-table-header/flat-table-header.style.js +34 -23
- package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +47 -19
- package/lib/components/flat-table/flat-table-row/flat-table-row.style.js +72 -22
- package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +35 -6
- package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.d.ts +2 -0
- package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.style.js +11 -4
- package/lib/components/flat-table/flat-table.style.js +69 -20
- package/lib/components/grouped-character/grouped-character.component.d.ts +30 -0
- package/lib/components/grouped-character/grouped-character.component.js +545 -45
- package/lib/components/grouped-character/grouped-character.utils.d.ts +2 -0
- package/lib/components/grouped-character/index.d.ts +2 -1
- package/package.json +1 -1
- package/esm/components/grouped-character/grouped-character.d.ts +0 -23
- package/lib/components/grouped-character/grouped-character.d.ts +0 -23
|
@@ -13,10 +13,12 @@ const StyledFlatTableRowHeader = styled.th`
|
|
|
13
13
|
theme,
|
|
14
14
|
colWidth,
|
|
15
15
|
leftPosition,
|
|
16
|
+
rightPosition,
|
|
16
17
|
isTruncated,
|
|
17
18
|
expandable,
|
|
18
19
|
verticalBorder,
|
|
19
|
-
verticalBorderColor
|
|
20
|
+
verticalBorderColor,
|
|
21
|
+
stickyAlignment
|
|
20
22
|
}) => css`
|
|
21
23
|
background-color: var(--colorsUtilityYang100);
|
|
22
24
|
border: 1px solid var(--colorsUtilityMajor100);
|
|
@@ -52,14 +54,19 @@ const StyledFlatTableRowHeader = styled.th`
|
|
|
52
54
|
${padding}
|
|
53
55
|
}
|
|
54
56
|
|
|
55
|
-
|
|
57
|
+
${leftPosition !== undefined && css`
|
|
58
|
+
left: ${leftPosition}px;
|
|
59
|
+
`}
|
|
60
|
+
${rightPosition !== undefined && css`
|
|
61
|
+
right: ${rightPosition}px;
|
|
62
|
+
`}
|
|
56
63
|
|
|
57
64
|
${verticalBorder && css`
|
|
58
|
-
border
|
|
65
|
+
border-${stickyAlignment === "right" ? "left" : "right"}-width: ${verticalBorderSizes[verticalBorder]};
|
|
59
66
|
`}
|
|
60
67
|
|
|
61
68
|
${verticalBorderColor && css`
|
|
62
|
-
border
|
|
69
|
+
border-${stickyAlignment === "right" ? "left" : "right"}-color: ${toColor(theme, verticalBorderColor)};
|
|
63
70
|
`}
|
|
64
71
|
}
|
|
65
72
|
|
|
@@ -8,6 +8,9 @@ import { baseTheme } from "../../style/themes";
|
|
|
8
8
|
import { StyledFlatTableCell } from "./flat-table-cell/flat-table-cell.style";
|
|
9
9
|
import cellSizes from "./cell-sizes.style";
|
|
10
10
|
import Box from "../box";
|
|
11
|
+
const HEADER_OVERLAY_INCREMENT = 3;
|
|
12
|
+
const STICKY_FOOTER_OVERLAY_INCREMENT = 1;
|
|
13
|
+
const ROW_HEADER_OVERLAY_INCREMENT = 5;
|
|
11
14
|
const StyledTableContainer = styled.div`
|
|
12
15
|
${({
|
|
13
16
|
width,
|
|
@@ -15,7 +18,7 @@ const StyledTableContainer = styled.div`
|
|
|
15
18
|
}) => width && css`
|
|
16
19
|
width: ${width};
|
|
17
20
|
|
|
18
|
-
${overflowX && `overflow-x: ${overflowX}
|
|
21
|
+
${overflowX && `overflow-x: ${overflowX};`}
|
|
19
22
|
`}
|
|
20
23
|
`;
|
|
21
24
|
const StyledFlatTable = styled.table`
|
|
@@ -112,34 +115,49 @@ const StyledFlatTableWrapper = styled(Box)`
|
|
|
112
115
|
case "light":
|
|
113
116
|
return css`
|
|
114
117
|
${StyledFlatTableHeader},
|
|
115
|
-
${StyledFlatTableHead} ${StyledFlatTableRowHeader},
|
|
116
118
|
${StyledFlatTableHead} ${StyledFlatTableCheckbox} {
|
|
117
119
|
background-color: var(--colorsUtilityMajor100);
|
|
118
120
|
border-right: 1px solid var(--colorsUtilityMajor150);
|
|
119
121
|
border-bottom-color: var(--colorsUtilityMajor150);
|
|
120
122
|
}
|
|
123
|
+
${StyledFlatTableHead} ${StyledFlatTableRowHeader} {
|
|
124
|
+
background-color: var(--colorsUtilityMajor100);
|
|
125
|
+
border-bottom-color: var(--colorsUtilityMajor150);
|
|
126
|
+
border-right-color: var(--colorsUtilityMajor150);
|
|
127
|
+
border-left-color: var(--colorsUtilityMajor150);
|
|
128
|
+
}
|
|
121
129
|
`;
|
|
122
130
|
|
|
123
131
|
case "transparent-base":
|
|
124
132
|
return css`
|
|
125
133
|
${StyledFlatTableHeader},
|
|
126
|
-
${StyledFlatTableHead} ${StyledFlatTableRowHeader},
|
|
127
134
|
${StyledFlatTableHead} ${StyledFlatTableCheckbox} {
|
|
128
135
|
background-color: var(--colorsUtilityMajor025);
|
|
129
136
|
border-right: 1px solid var(--colorsUtilityMajor025);
|
|
130
137
|
border-bottom-color: var(--colorsUtilityMajor100);
|
|
131
138
|
}
|
|
139
|
+
${StyledFlatTableHead} ${StyledFlatTableRowHeader} {
|
|
140
|
+
background-color: var(--colorsUtilityMajor025);
|
|
141
|
+
border-bottom-color: var(--colorsUtilityMajor100);
|
|
142
|
+
border-right-color: var(--colorsUtilityMajor025);
|
|
143
|
+
border-left-color: var(--colorsUtilityMajor025);
|
|
144
|
+
}
|
|
132
145
|
`;
|
|
133
146
|
|
|
134
147
|
case "transparent-white":
|
|
135
148
|
return css`
|
|
136
149
|
${StyledFlatTableHeader},
|
|
137
|
-
${StyledFlatTableHead} ${StyledFlatTableRowHeader},
|
|
138
150
|
${StyledFlatTableHead} ${StyledFlatTableCheckbox} {
|
|
139
151
|
background-color: var(--colorsUtilityYang100);
|
|
140
152
|
border-right: 1px solid var(--colorsUtilityYang100);
|
|
141
153
|
border-bottom-color: var(--colorsUtilityMajor100);
|
|
142
154
|
}
|
|
155
|
+
${StyledFlatTableHead} ${StyledFlatTableRowHeader} {
|
|
156
|
+
background-color: var(--colorsUtilityYang100);
|
|
157
|
+
border-bottom-color: var(--colorsUtilityMajor100);
|
|
158
|
+
border-right-color: var(--colorsUtilityYang100);
|
|
159
|
+
border-left-color: var(--colorsUtilityYang100);
|
|
160
|
+
}
|
|
143
161
|
`;
|
|
144
162
|
// default theme is "dark"
|
|
145
163
|
|
|
@@ -147,12 +165,19 @@ const StyledFlatTableWrapper = styled(Box)`
|
|
|
147
165
|
return css`
|
|
148
166
|
${StyledFlatTableHead} ${StyledFlatTableCheckbox},
|
|
149
167
|
${StyledFlatTableHeader},
|
|
150
|
-
${StyledFlatTableHead}
|
|
168
|
+
${StyledFlatTableHead} {
|
|
151
169
|
background-color: var(--colorsUtilityMajor400);
|
|
152
170
|
border-right: 1px solid var(--colorsUtilityMajor300);
|
|
153
171
|
color: var(--colorsUtilityYang100);
|
|
154
172
|
border-bottom-color: var(--colorsUtilityMajor300);
|
|
155
173
|
}
|
|
174
|
+
${StyledFlatTableHead} ${StyledFlatTableRowHeader} {
|
|
175
|
+
background-color: var(--colorsUtilityMajor400);
|
|
176
|
+
color: var(--colorsUtilityYang100);
|
|
177
|
+
border-bottom-color: var(--colorsUtilityMajor300);
|
|
178
|
+
border-right-color: var(--colorsUtilityMajor300);
|
|
179
|
+
border-left-color: var(--colorsUtilityMajor300);
|
|
180
|
+
}
|
|
156
181
|
`;
|
|
157
182
|
}
|
|
158
183
|
}}
|
|
@@ -170,35 +195,59 @@ const StyledFlatTableWrapper = styled(Box)`
|
|
|
170
195
|
`}
|
|
171
196
|
|
|
172
197
|
${({
|
|
173
|
-
hasStickyHead
|
|
198
|
+
hasStickyHead,
|
|
199
|
+
theme
|
|
174
200
|
}) => hasStickyHead && css`
|
|
175
|
-
${StyledFlatTableHead}
|
|
201
|
+
${StyledFlatTableHead} {
|
|
176
202
|
position: sticky;
|
|
177
|
-
z-index: ${({
|
|
178
|
-
theme
|
|
179
|
-
}) => theme.zIndex.overlay};
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
${StyledFlatTableHead} ${StyledFlatTableRowHeader},
|
|
183
|
-
${StyledFlatTableHead} ${StyledFlatTableCheckbox} {
|
|
184
|
-
z-index: ${({
|
|
185
|
-
theme
|
|
186
|
-
}) => theme.zIndex.overlay + 2};
|
|
187
203
|
top: 0;
|
|
188
204
|
left: 0;
|
|
205
|
+
z-index: ${theme.zIndex.overlay + ROW_HEADER_OVERLAY_INCREMENT};
|
|
189
206
|
}
|
|
190
207
|
`}
|
|
208
|
+
|
|
209
|
+
${StyledFlatTableHead} ${StyledFlatTableRowHeader},
|
|
210
|
+
${StyledFlatTableHeader}.isSticky,
|
|
211
|
+
${StyledFlatTableHead} ${StyledFlatTableCheckbox}.isSticky {
|
|
212
|
+
z-index: ${({
|
|
213
|
+
theme
|
|
214
|
+
}) => theme.zIndex.overlay + ROW_HEADER_OVERLAY_INCREMENT};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
thead ${StyledFlatTableHeader}.isSticky, ${StyledFlatTableCheckbox}.isSticky {
|
|
218
|
+
border-right: none;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
${StyledFlatTableHeader}, ${StyledFlatTableCheckbox} {
|
|
222
|
+
z-index: ${({
|
|
223
|
+
theme
|
|
224
|
+
}) => theme.zIndex.overlay + HEADER_OVERLAY_INCREMENT};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
tbody
|
|
228
|
+
${StyledFlatTableRowHeader},
|
|
229
|
+
${StyledFlatTableCell}.isSticky,
|
|
230
|
+
tbody
|
|
231
|
+
${StyledFlatTableCheckbox}.isSticky {
|
|
232
|
+
z-index: ${({
|
|
233
|
+
theme
|
|
234
|
+
}) => theme.zIndex.overlay};
|
|
235
|
+
}
|
|
191
236
|
`;
|
|
192
237
|
StyledFlatTableWrapper.defaultProps = {
|
|
193
238
|
theme: baseTheme
|
|
194
239
|
};
|
|
195
240
|
const StyledFlatTableFooter = styled.div`
|
|
196
241
|
${({
|
|
197
|
-
hasStickyFooter
|
|
242
|
+
hasStickyFooter,
|
|
243
|
+
theme
|
|
198
244
|
}) => hasStickyFooter && css`
|
|
199
245
|
position: sticky;
|
|
200
246
|
bottom: 0px;
|
|
201
|
-
z-index: ${
|
|
247
|
+
z-index: ${theme.zIndex.overlay + STICKY_FOOTER_OVERLAY_INCREMENT};
|
|
202
248
|
`}
|
|
203
249
|
`;
|
|
250
|
+
StyledFlatTableFooter.defaultProps = {
|
|
251
|
+
theme: baseTheme
|
|
252
|
+
};
|
|
204
253
|
export { StyledFlatTableWrapper, StyledFlatTable, StyledFlatTableFooter, StyledTableContainer };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TextboxProps } from "../textbox";
|
|
3
|
+
declare type EventValue = {
|
|
4
|
+
formattedValue: string;
|
|
5
|
+
rawValue: string;
|
|
6
|
+
};
|
|
7
|
+
declare type CustomTarget = {
|
|
8
|
+
name?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
value: EventValue;
|
|
11
|
+
};
|
|
12
|
+
export interface CustomEvent extends Omit<React.ChangeEvent<HTMLInputElement>, "target"> {
|
|
13
|
+
target: CustomTarget;
|
|
14
|
+
}
|
|
15
|
+
export interface GroupedCharacterProps extends Omit<TextboxProps, "onChange" | "onBlur"> {
|
|
16
|
+
/** Default input value if component is meant to be used as an uncontrolled component */
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
/** pattern by which input value should be grouped */
|
|
19
|
+
groups: number[];
|
|
20
|
+
/** Handler for blur event */
|
|
21
|
+
onBlur?: (ev: CustomEvent) => void;
|
|
22
|
+
/** Handler for change event if input is meant to be used as a controlled component */
|
|
23
|
+
onChange?: (ev: CustomEvent) => void;
|
|
24
|
+
/** character to be used as separator - has to be a 1 character string */
|
|
25
|
+
separator: string;
|
|
26
|
+
/** Input value if component is meant to be used as a controlled component */
|
|
27
|
+
value?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const GroupedCharacter: ({ defaultValue, groups, onBlur, onChange, separator: rawSeparator, value: externalValue, ...rest }: GroupedCharacterProps) => JSX.Element;
|
|
30
|
+
export default GroupedCharacter;
|