@databricks/design-system 1.8.0 → 1.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/dist/Typography-52abe0b7.js +1142 -0
- package/dist/Typography-52abe0b7.js.map +1 -0
- package/dist/Typography-84a00e02.js +1465 -0
- package/dist/Typography-84a00e02.js.map +1 -0
- package/dist/design-system/Checkbox/Checkbox.d.ts +6 -2
- package/dist/design-system/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/design-system/DesignSystemProvider/DesignSystemProvider.d.ts +1 -0
- package/dist/design-system/DesignSystemProvider/DesignSystemProvider.d.ts.map +1 -1
- package/dist/design-system/Drawer/Drawer.d.ts +1 -1
- package/dist/design-system/Drawer/Drawer.d.ts.map +1 -1
- package/dist/design-system/Empty/Empty.d.ts.map +1 -1
- package/dist/design-system/FormMessage/FormMessage.d.ts +1 -1
- package/dist/design-system/FormMessage/FormMessage.d.ts.map +1 -1
- package/dist/design-system/Icon/__generated/icons/BookmarkIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/BookmarkIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/BracketsCurlyIcon.v2.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/BracketsCurlyIcon.v2.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/BracketsSquareIcon.v2.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/BracketsSquareIcon.v2.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/CheckCircleIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/CheckCircleIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/DangerFillIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/DangerFillIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/DangerIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/DangerIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/FolderFillIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/FolderFillIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/FolderIcon.d.ts.map +1 -1
- package/dist/design-system/Icon/__generated/icons/GearFillIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/GearFillIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/GearIcon.d.ts.map +1 -1
- package/dist/design-system/Icon/__generated/icons/InfoIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/InfoIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/LinkOffIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/LinkOffIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/LockIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/LockIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/MinusCircleIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/MinusCircleIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/NotificationOffIcon.v2.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/NotificationOffIcon.v2.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/PinIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/PinIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/PlayCircleIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/PlayCircleIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/PlusCircleIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/PlusCircleIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/QuestionMarkIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/QuestionMarkIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/RedoIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/RedoIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/Refresh.v2.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/Refresh.v2.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/RefreshIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/RefreshIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/StarIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/StarIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/StopCircleFillIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/StopCircleFillIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/StopCircleIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/StopCircleIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/StorefrontIcon.v2.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/StorefrontIcon.v2.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/UndoIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/UndoIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/VisibleIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/VisibleIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/VisibleOffIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/VisibleOffIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/WarningIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/WarningIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/XCircleIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/XCircleIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/index.d.ts +29 -37
- package/dist/design-system/Icon/__generated/icons/index.d.ts.map +1 -1
- package/dist/design-system/NotificationV2/NotificationV2.d.ts +23 -0
- package/dist/design-system/NotificationV2/NotificationV2.d.ts.map +1 -0
- package/dist/design-system/NotificationV2/index.d.ts +2 -0
- package/dist/design-system/NotificationV2/index.d.ts.map +1 -0
- package/dist/design-system/Select/Select.d.ts.map +1 -1
- package/dist/design-system/Sidebar/Sidebar.d.ts +3 -1
- package/dist/design-system/Sidebar/Sidebar.d.ts.map +1 -1
- package/dist/design-system/Tag/index.d.ts.map +1 -1
- package/dist/design-system/ToggleButton/ToggleButton.d.ts +4 -0
- package/dist/design-system/ToggleButton/ToggleButton.d.ts.map +1 -0
- package/dist/design-system/index.d.ts +1 -0
- package/dist/design-system/index.d.ts.map +1 -1
- package/dist/development/Slider/Slider.d.ts +11 -0
- package/dist/development/Slider/Slider.d.ts.map +1 -0
- package/dist/development/Slider/index.d.ts +2 -0
- package/dist/development/Slider/index.d.ts.map +1 -0
- package/dist/development/TableUI/TableUI.test.d.ts +2 -0
- package/dist/development/TableUI/TableUI.test.d.ts.map +1 -0
- package/dist/development/TableUI/index.d.ts +42 -0
- package/dist/development/TableUI/index.d.ts.map +1 -0
- package/dist/development/index.d.ts +3 -0
- package/dist/development/index.d.ts.map +1 -0
- package/dist/development.js +789 -0
- package/dist/development.js.map +1 -0
- package/dist/flags.d.ts +2 -1
- package/dist/flags.d.ts.map +1 -1
- package/dist/index.js +1097 -2606
- package/dist/index.js.map +1 -1
- package/dist/rollup-less-tilde-importer.d.ts.map +1 -1
- package/dist/test-utils/enzyme/index.d.ts +8 -0
- package/dist/test-utils/enzyme/index.d.ts.map +1 -0
- package/dist/test-utils/enzyme.d.ts +8 -0
- package/dist/test-utils/enzyme.d.ts.map +1 -0
- package/dist/test-utils/enzyme.js +16 -0
- package/dist/test-utils/enzyme.js.map +1 -0
- package/dist/test-utils/rtl/index.d.ts +7 -0
- package/dist/test-utils/rtl/index.d.ts.map +1 -0
- package/dist/test-utils/rtl.d.ts +7 -0
- package/dist/test-utils/rtl.d.ts.map +1 -0
- package/dist/test-utils/rtl.js +13 -0
- package/dist/test-utils/rtl.js.map +1 -0
- package/dist/test-utils/types.d.ts +15 -0
- package/dist/test-utils/types.d.ts.map +1 -0
- package/dist/theme/colorList.d.ts +2 -0
- package/dist/theme/colorList.d.ts.map +1 -1
- package/dist/theme/colors.d.ts +2 -0
- package/dist/theme/colors.d.ts.map +1 -1
- package/package.json +15 -7
|
@@ -0,0 +1,789 @@
|
|
|
1
|
+
import { useTheme, css } from '@emotion/react';
|
|
2
|
+
import { useContext, createContext, forwardRef } from 'react';
|
|
3
|
+
import { jsx, Fragment, jsxs } from '@emotion/react/jsx-runtime';
|
|
4
|
+
import { u as useDesignSystemTheme$1, T as Typography, S as SortAscendingIcon, n as SortDescendingIcon, o as SortUnsortedIcon, C as Checkbox } from './Typography-84a00e02.js';
|
|
5
|
+
import * as RadixSlider from '@radix-ui/react-slider';
|
|
6
|
+
import 'antd';
|
|
7
|
+
import 'classnames';
|
|
8
|
+
import chroma from 'chroma-js';
|
|
9
|
+
import '@ant-design/icons';
|
|
10
|
+
import 'lodash/isNil';
|
|
11
|
+
import 'lodash/endsWith';
|
|
12
|
+
import 'lodash/isBoolean';
|
|
13
|
+
import 'lodash/isNumber';
|
|
14
|
+
import 'lodash/isString';
|
|
15
|
+
import 'lodash/mapValues';
|
|
16
|
+
import '@emotion/unitless';
|
|
17
|
+
|
|
18
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__$1() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
19
|
+
// For performance, these styles are defined outside of the component so they are not redefined on every render.
|
|
20
|
+
// We're also using CSS Variables rather than any dynamic styles so that the style object remains static.
|
|
21
|
+
const tableStyles = {
|
|
22
|
+
row: process.env.NODE_ENV === "production" ? {
|
|
23
|
+
name: "q4mdqg",
|
|
24
|
+
styles: "display:flex;border-bottom:1px solid;border-color:var(--table-border);.table-row-select-cell input[type=\"checkbox\"] ~ *{opacity:var(--row-checkbox-opacity, 0);}&:hover{[role=\"cell\"]{background-color:var(--table-row-hover);}.table-row-select-cell input[type=\"checkbox\"] ~ *{opacity:1;}}.table-row-select-cell input[type=\"checkbox\"]:focus ~ *{opacity:1;}"
|
|
25
|
+
} : {
|
|
26
|
+
name: "1218dqd-row",
|
|
27
|
+
styles: "display:flex;border-bottom:1px solid;border-color:var(--table-border);.table-row-select-cell input[type=\"checkbox\"] ~ *{opacity:var(--row-checkbox-opacity, 0);}&:hover{[role=\"cell\"]{background-color:var(--table-row-hover);}.table-row-select-cell input[type=\"checkbox\"] ~ *{opacity:1;}}.table-row-select-cell input[type=\"checkbox\"]:focus ~ *{opacity:1;};label:row;",
|
|
28
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
29
|
+
},
|
|
30
|
+
cell: process.env.NODE_ENV === "production" ? {
|
|
31
|
+
name: "1844uvd",
|
|
32
|
+
styles: "display:inline-grid;align-items:var(--table-row-vertical-alignment, flex-start);flex:1;line-height:initial;padding:6px 8px;&[role=\"columnheader\"]{padding:8px;}"
|
|
33
|
+
} : {
|
|
34
|
+
name: "oqyg7z-cell",
|
|
35
|
+
styles: "display:inline-grid;align-items:var(--table-row-vertical-alignment, flex-start);flex:1;line-height:initial;padding:6px 8px;&[role=\"columnheader\"]{padding:8px;};label:cell;",
|
|
36
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
37
|
+
},
|
|
38
|
+
cellSmall: process.env.NODE_ENV === "production" ? {
|
|
39
|
+
name: "t4u7cz",
|
|
40
|
+
styles: "padding:4px 8px;&[role=\"columnheader\"]{padding:4px 8px;}"
|
|
41
|
+
} : {
|
|
42
|
+
name: "1cnl65h-cellSmall",
|
|
43
|
+
styles: "padding:4px 8px;&[role=\"columnheader\"]{padding:4px 8px;};label:cellSmall;",
|
|
44
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
45
|
+
},
|
|
46
|
+
header: process.env.NODE_ENV === "production" ? {
|
|
47
|
+
name: "1kkin30",
|
|
48
|
+
styles: "font-weight:bold;align-items:flex-end;display:flex;overflow:hidden;&[aria-sort]{cursor:pointer;user-select:none;}[role=\"img\"]{margin-left:4px;}"
|
|
49
|
+
} : {
|
|
50
|
+
name: "a29sg0-header",
|
|
51
|
+
styles: "font-weight:bold;align-items:flex-end;display:flex;overflow:hidden;&[aria-sort]{cursor:pointer;user-select:none;}[role=\"img\"]{margin-left:4px;};label:header;",
|
|
52
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
53
|
+
},
|
|
54
|
+
headerButtonTarget: process.env.NODE_ENV === "production" ? {
|
|
55
|
+
name: "16jw3zf",
|
|
56
|
+
styles: "align-items:flex-end;display:flex;overflow:hidden;width:100%"
|
|
57
|
+
} : {
|
|
58
|
+
name: "1xje8dv-headerButtonTarget",
|
|
59
|
+
styles: "align-items:flex-end;display:flex;overflow:hidden;width:100%;label:headerButtonTarget;",
|
|
60
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
61
|
+
},
|
|
62
|
+
checkboxCell: process.env.NODE_ENV === "production" ? {
|
|
63
|
+
name: "yjqp7o",
|
|
64
|
+
styles: "padding:0 0 0 8px;display:flex;align-items:center;flex:0"
|
|
65
|
+
} : {
|
|
66
|
+
name: "177274n-checkboxCell",
|
|
67
|
+
styles: "padding:0 0 0 8px;display:flex;align-items:center;flex:0;label:checkboxCell;",
|
|
68
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const TableContext = /*#__PURE__*/createContext({
|
|
72
|
+
size: 'default'
|
|
73
|
+
});
|
|
74
|
+
const Table = _ref => {
|
|
75
|
+
let {
|
|
76
|
+
children,
|
|
77
|
+
size = 'default',
|
|
78
|
+
someRowsSelected
|
|
79
|
+
} = _ref;
|
|
80
|
+
const {
|
|
81
|
+
theme
|
|
82
|
+
} = useDesignSystemTheme$1();
|
|
83
|
+
return jsx(TableContext.Provider, {
|
|
84
|
+
value: {
|
|
85
|
+
size,
|
|
86
|
+
someRowsSelected
|
|
87
|
+
},
|
|
88
|
+
children: jsx("div", {
|
|
89
|
+
role: "table" // This is a performance optimization; we want to statically create the styles for the table,
|
|
90
|
+
// but for the dynamic theme values, we need to use CSS variables.
|
|
91
|
+
// See: https://emotion.sh/docs/best-practices#advanced-css-variables-with-style
|
|
92
|
+
,
|
|
93
|
+
style: {
|
|
94
|
+
['--table-border']: theme.colors.tableBorder,
|
|
95
|
+
['--table-row-hover']: theme.colors.tableRowHover
|
|
96
|
+
},
|
|
97
|
+
children: children
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
const TableRowContext = /*#__PURE__*/createContext({
|
|
102
|
+
isHeader: false
|
|
103
|
+
});
|
|
104
|
+
const TableRow = _ref2 => {
|
|
105
|
+
let {
|
|
106
|
+
children,
|
|
107
|
+
isHeader = false,
|
|
108
|
+
verticalAlignment = 'top'
|
|
109
|
+
} = _ref2;
|
|
110
|
+
return jsx(TableRowContext.Provider, {
|
|
111
|
+
value: {
|
|
112
|
+
isHeader
|
|
113
|
+
},
|
|
114
|
+
children: jsx("div", {
|
|
115
|
+
css: tableStyles.row,
|
|
116
|
+
role: "row",
|
|
117
|
+
style: {
|
|
118
|
+
['--table-row-vertical-alignment']: verticalAlignment === 'top' ? 'flex-start' : 'center'
|
|
119
|
+
},
|
|
120
|
+
children: children
|
|
121
|
+
})
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
const TableCell = _ref3 => {
|
|
125
|
+
let {
|
|
126
|
+
children,
|
|
127
|
+
ellipsis = false
|
|
128
|
+
} = _ref3;
|
|
129
|
+
const {
|
|
130
|
+
size
|
|
131
|
+
} = useContext(TableContext);
|
|
132
|
+
let typographySize = 'md';
|
|
133
|
+
if (size === 'small') {
|
|
134
|
+
typographySize = 'sm';
|
|
135
|
+
}
|
|
136
|
+
return jsx("div", {
|
|
137
|
+
css: [tableStyles.cell, size === 'small' && tableStyles.cellSmall, process.env.NODE_ENV === "production" ? "" : ";label:TableCell;"],
|
|
138
|
+
role: "cell",
|
|
139
|
+
children: jsx(Typography.Text, {
|
|
140
|
+
ellipsis: ellipsis,
|
|
141
|
+
size: typographySize,
|
|
142
|
+
title: ellipsis && typeof children === 'string' && children || undefined,
|
|
143
|
+
children: children
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const TableHeader = _ref4 => {
|
|
148
|
+
let {
|
|
149
|
+
children,
|
|
150
|
+
ellipsis = false,
|
|
151
|
+
sortable,
|
|
152
|
+
sortDirection,
|
|
153
|
+
onToggleSort
|
|
154
|
+
} = _ref4;
|
|
155
|
+
const {
|
|
156
|
+
theme
|
|
157
|
+
} = useDesignSystemTheme$1();
|
|
158
|
+
const {
|
|
159
|
+
size
|
|
160
|
+
} = useContext(TableContext);
|
|
161
|
+
const {
|
|
162
|
+
isHeader
|
|
163
|
+
} = useContext(TableRowContext);
|
|
164
|
+
if (!isHeader) {
|
|
165
|
+
throw new Error('`TableHeader` must be used within a `TableRow` with `isHeader` set to true.');
|
|
166
|
+
}
|
|
167
|
+
let sortIcon = jsx(Fragment, {});
|
|
168
|
+
// While most libaries use `asc` and `desc` for the sort value, the ARIA spec
|
|
169
|
+
// uses `ascending` and `descending`.
|
|
170
|
+
let ariaSort;
|
|
171
|
+
if (sortable) {
|
|
172
|
+
if (sortDirection === 'asc') {
|
|
173
|
+
sortIcon = jsx(SortAscendingIcon, {});
|
|
174
|
+
ariaSort = 'ascending';
|
|
175
|
+
} else if (sortDirection === 'desc') {
|
|
176
|
+
sortIcon = jsx(SortDescendingIcon, {});
|
|
177
|
+
ariaSort = 'descending';
|
|
178
|
+
} else if (sortDirection === 'none') {
|
|
179
|
+
sortIcon = jsx(SortUnsortedIcon, {});
|
|
180
|
+
ariaSort = 'none';
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
let typographySize = 'md';
|
|
184
|
+
if (size === 'small') {
|
|
185
|
+
typographySize = 'sm';
|
|
186
|
+
}
|
|
187
|
+
const textContents = jsx(Typography.Text, {
|
|
188
|
+
// If sortable, we must use ellipsis to prevent wrapping and misalignment.
|
|
189
|
+
ellipsis: ellipsis || sortable,
|
|
190
|
+
size: typographySize,
|
|
191
|
+
title: ellipsis && typeof children === 'string' && children || undefined,
|
|
192
|
+
children: children
|
|
193
|
+
});
|
|
194
|
+
return jsx("div", {
|
|
195
|
+
css: [tableStyles.cell, tableStyles.header, size === 'small' && tableStyles.cellSmall, process.env.NODE_ENV === "production" ? "" : ";label:TableHeader;"],
|
|
196
|
+
role: "columnheader",
|
|
197
|
+
"aria-sort": sortable && ariaSort || undefined,
|
|
198
|
+
children: sortable ? jsxs("div", {
|
|
199
|
+
css: [tableStyles.headerButtonTarget, process.env.NODE_ENV === "production" ? "" : ";label:TableHeader;"],
|
|
200
|
+
role: "button",
|
|
201
|
+
tabIndex: 0,
|
|
202
|
+
onClick: onToggleSort,
|
|
203
|
+
onKeyDown: event => {
|
|
204
|
+
if (sortable && (event.key === 'Enter' || event.key === ' ')) {
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
return onToggleSort === null || onToggleSort === void 0 ? void 0 : onToggleSort(event);
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
children: [textContents, jsx("span", {
|
|
210
|
+
style: {
|
|
211
|
+
color: theme.colors.textSecondary
|
|
212
|
+
},
|
|
213
|
+
children: sortIcon
|
|
214
|
+
})]
|
|
215
|
+
}) : textContents
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
const TableRowSelectCell = _ref5 => {
|
|
219
|
+
let {
|
|
220
|
+
onChange,
|
|
221
|
+
checked,
|
|
222
|
+
indeterminate,
|
|
223
|
+
noCheckbox
|
|
224
|
+
} = _ref5;
|
|
225
|
+
const {
|
|
226
|
+
isHeader
|
|
227
|
+
} = useContext(TableRowContext);
|
|
228
|
+
const {
|
|
229
|
+
someRowsSelected
|
|
230
|
+
} = useContext(TableContext);
|
|
231
|
+
if (typeof someRowsSelected === 'undefined') {
|
|
232
|
+
throw new Error('`TableRowSelectCell` cannot be used unless `someRowsSelected` has been provided to the `Table` component, see documentation.');
|
|
233
|
+
}
|
|
234
|
+
if (!isHeader && indeterminate) {
|
|
235
|
+
throw new Error('`TableRowSelectCell` cannot be used with `indeterminate` in a non-header row.');
|
|
236
|
+
}
|
|
237
|
+
return jsx("div", {
|
|
238
|
+
css: tableStyles.checkboxCell,
|
|
239
|
+
style: {
|
|
240
|
+
paddingLeft: 8,
|
|
241
|
+
paddingTop: 0,
|
|
242
|
+
paddingBottom: 0,
|
|
243
|
+
flex: 0,
|
|
244
|
+
minWidth: 16,
|
|
245
|
+
maxWidth: 16,
|
|
246
|
+
['--row-checkbox-opacity']: someRowsSelected ? 1 : 0
|
|
247
|
+
},
|
|
248
|
+
role: isHeader ? 'columnheader' : 'cell'
|
|
249
|
+
// TODO: Ideally we shouldn't need to specify this `className`, but it allows for row-hovering to reveal
|
|
250
|
+
// the checkbox in `TableRow`'s CSS without extra JS pointerin/out events.
|
|
251
|
+
,
|
|
252
|
+
className: "table-row-select-cell",
|
|
253
|
+
children: !noCheckbox && jsx(Checkbox, {
|
|
254
|
+
isChecked: checked || indeterminate && null,
|
|
255
|
+
onChange: (_checked, event) => onChange === null || onChange === void 0 ? void 0 : onChange(event.nativeEvent)
|
|
256
|
+
})
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// Border variables
|
|
261
|
+
const borders = {
|
|
262
|
+
borderRadiusMd: 4
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
266
|
+
var borders$1 = {
|
|
267
|
+
...borders
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
// Exported from go/designsystem/colorsheet
|
|
271
|
+
const colorPalettePrimary = {
|
|
272
|
+
primary: '#2272B4',
|
|
273
|
+
blue100: '#F0F8FF',
|
|
274
|
+
blue200: '#D7EDFE',
|
|
275
|
+
blue300: '#BAE1FC',
|
|
276
|
+
blue400: '#8ACAFF',
|
|
277
|
+
blue500: '#4299E0',
|
|
278
|
+
blue600: '#2272B4',
|
|
279
|
+
blue700: '#0E538B',
|
|
280
|
+
blue800: '#04355D',
|
|
281
|
+
green100: '#F3FCF6',
|
|
282
|
+
green200: '#D4F7DF',
|
|
283
|
+
green300: '#B1ECC5',
|
|
284
|
+
green400: '#8DDDA8',
|
|
285
|
+
green500: '#3CAA60',
|
|
286
|
+
green600: '#277C43',
|
|
287
|
+
green700: '#115026',
|
|
288
|
+
green800: '#093919',
|
|
289
|
+
white: '#FFFFFF',
|
|
290
|
+
grey100: '#F2F5F7',
|
|
291
|
+
grey200: '#E4ECF1',
|
|
292
|
+
grey300: '#CDDAE5',
|
|
293
|
+
grey400: '#BDCDDB',
|
|
294
|
+
grey500: '#8196A7',
|
|
295
|
+
grey600: '#5D7283',
|
|
296
|
+
grey700: '#44535F',
|
|
297
|
+
grey800: '#1F272D',
|
|
298
|
+
red100: '#FFF5F7',
|
|
299
|
+
red200: '#FDE2E8',
|
|
300
|
+
red300: '#FBD0D8',
|
|
301
|
+
red400: '#F792A6',
|
|
302
|
+
red500: '#E65B77',
|
|
303
|
+
red600: '#C82D4C',
|
|
304
|
+
red700: '#9E102C',
|
|
305
|
+
red800: '#630316',
|
|
306
|
+
yellow100: '#FFF9EB',
|
|
307
|
+
yellow200: '#FCEACA',
|
|
308
|
+
yellow300: '#F8D4A5',
|
|
309
|
+
yellow400: '#F2BE88',
|
|
310
|
+
yellow500: '#DE7921',
|
|
311
|
+
yellow600: '#BE501E',
|
|
312
|
+
yellow700: '#93320B',
|
|
313
|
+
yellow800: '#5F1B02'
|
|
314
|
+
};
|
|
315
|
+
const colorPaletteSecondary = {
|
|
316
|
+
brown: '#A6630C',
|
|
317
|
+
coral: '#C83243',
|
|
318
|
+
charcoal: '#5D7283',
|
|
319
|
+
indigo: '#434A93',
|
|
320
|
+
lemon: '#FACB66',
|
|
321
|
+
lime: '#308613',
|
|
322
|
+
pink: '#B45091',
|
|
323
|
+
purple: '#8A63BF',
|
|
324
|
+
teal: '#04867D',
|
|
325
|
+
turquoise: '#157CBC'
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// Colors taken from figma designs but not part of official list (yet)
|
|
329
|
+
const unstableColors = {
|
|
330
|
+
textValidationInfo: '#64727D',
|
|
331
|
+
backgroundValidationDanger: colorPalettePrimary.red100,
|
|
332
|
+
backgroundValidationSuccess: colorPalettePrimary.blue100,
|
|
333
|
+
backgroundValidationWarning: colorPalettePrimary.yellow100,
|
|
334
|
+
borderValidationDanger: colorPalettePrimary.red300,
|
|
335
|
+
borderValidationSuccess: colorPalettePrimary.blue300,
|
|
336
|
+
borderValidationWarning: colorPalettePrimary.yellow300
|
|
337
|
+
};
|
|
338
|
+
const lightColorList = {
|
|
339
|
+
backgroundPrimary: colorPalettePrimary.white,
|
|
340
|
+
actionDangerPrimaryBackgroundDefault: colorPalettePrimary.red600,
|
|
341
|
+
actionDangerPrimaryBackgroundHover: colorPalettePrimary.red700,
|
|
342
|
+
actionDangerPrimaryBackgroundPress: colorPalettePrimary.red800,
|
|
343
|
+
actionDangerDefaultBackgroundDefault: chroma(colorPalettePrimary.red600).alpha(0).hex(),
|
|
344
|
+
actionDangerDefaultBackgroundHover: chroma(colorPalettePrimary.red600).alpha(0.08).hex(),
|
|
345
|
+
actionDangerDefaultBackgroundPress: chroma(colorPalettePrimary.red600).alpha(0.16).hex(),
|
|
346
|
+
actionDangerDefaultBorderDefault: colorPalettePrimary.red600,
|
|
347
|
+
actionDangerDefaultBorderHover: colorPalettePrimary.red700,
|
|
348
|
+
actionDangerDefaultBorderPress: colorPalettePrimary.red800,
|
|
349
|
+
actionDangerDefaultTextDefault: colorPalettePrimary.red600,
|
|
350
|
+
actionDangerDefaultTextHover: colorPalettePrimary.red700,
|
|
351
|
+
actionDangerDefaultTextPress: colorPalettePrimary.red800,
|
|
352
|
+
actionDefaultBackgroundDefault: chroma(colorPalettePrimary.blue800).alpha(0).hex(),
|
|
353
|
+
actionDefaultBackgroundHover: chroma(colorPalettePrimary.blue600).alpha(0.08).hex(),
|
|
354
|
+
actionDefaultBackgroundPress: chroma(colorPalettePrimary.blue600).alpha(0.16).hex(),
|
|
355
|
+
actionDefaultBorderDefault: colorPalettePrimary.grey300,
|
|
356
|
+
actionDefaultBorderFocus: colorPalettePrimary.blue600,
|
|
357
|
+
actionDefaultBorderHover: colorPalettePrimary.blue700,
|
|
358
|
+
actionDefaultBorderPress: colorPalettePrimary.blue800,
|
|
359
|
+
actionDefaultTextDefault: colorPalettePrimary.grey800,
|
|
360
|
+
actionDefaultTextHover: colorPalettePrimary.blue700,
|
|
361
|
+
actionDefaultTextPress: colorPalettePrimary.blue800,
|
|
362
|
+
actionDisabledBackground: colorPalettePrimary.grey200,
|
|
363
|
+
actionDisabledText: colorPalettePrimary.grey400,
|
|
364
|
+
actionPrimaryBackgroundDefault: colorPalettePrimary.blue600,
|
|
365
|
+
actionPrimaryBackgroundHover: colorPalettePrimary.blue700,
|
|
366
|
+
actionPrimaryBackgroundPress: colorPalettePrimary.blue800,
|
|
367
|
+
actionPrimaryTextDefault: colorPalettePrimary.white,
|
|
368
|
+
actionPrimaryTextHover: colorPalettePrimary.white,
|
|
369
|
+
actionPrimaryTextPress: colorPalettePrimary.white,
|
|
370
|
+
actionTertiaryBackgroundDefault: chroma(colorPalettePrimary.blue600).alpha(0).hex(),
|
|
371
|
+
actionTertiaryBackgroundHover: chroma(colorPalettePrimary.blue600).alpha(0.08).hex(),
|
|
372
|
+
actionTertiaryBackgroundPress: chroma(colorPalettePrimary.blue600).alpha(0.16).hex(),
|
|
373
|
+
actionTertiaryTextDefault: colorPalettePrimary.blue600,
|
|
374
|
+
actionTertiaryTextHover: colorPalettePrimary.blue700,
|
|
375
|
+
actionTertiaryTextPress: colorPalettePrimary.blue800,
|
|
376
|
+
backgroundDanger: chroma(colorPalettePrimary.red100).alpha(0.08).hex(),
|
|
377
|
+
backgroundSecondary: colorPalettePrimary.grey100,
|
|
378
|
+
backgroundWarning: chroma(colorPalettePrimary.yellow100).alpha(0.08).hex(),
|
|
379
|
+
border: colorPalettePrimary.grey300,
|
|
380
|
+
borderDecorative: colorPalettePrimary.grey300,
|
|
381
|
+
textPrimary: colorPalettePrimary.grey800,
|
|
382
|
+
textSecondary: colorPalettePrimary.grey600,
|
|
383
|
+
textPlaceholder: colorPalettePrimary.grey400,
|
|
384
|
+
textValidationDanger: colorPalettePrimary.red600,
|
|
385
|
+
textValidationSuccess: colorPalettePrimary.green600,
|
|
386
|
+
textValidationWarning: colorPalettePrimary.yellow600,
|
|
387
|
+
overlayOverlay: chroma(colorPalettePrimary.grey100).alpha(0.72).hex(),
|
|
388
|
+
// Tags
|
|
389
|
+
tagDefault: chroma(colorPalettePrimary.grey600).alpha(0.08).hex(),
|
|
390
|
+
tagBrown: colorPaletteSecondary.brown,
|
|
391
|
+
tagCoral: colorPaletteSecondary.coral,
|
|
392
|
+
tagCharcoal: colorPalettePrimary.grey600,
|
|
393
|
+
tagIndigo: colorPaletteSecondary.indigo,
|
|
394
|
+
tagLemon: colorPaletteSecondary.lemon,
|
|
395
|
+
tagLime: colorPaletteSecondary.lime,
|
|
396
|
+
tagPink: colorPaletteSecondary.pink,
|
|
397
|
+
tagPurple: colorPaletteSecondary.purple,
|
|
398
|
+
tagTeal: colorPaletteSecondary.teal,
|
|
399
|
+
tagTurquoise: colorPaletteSecondary.turquoise,
|
|
400
|
+
tagText: colorPalettePrimary.white,
|
|
401
|
+
tagHover: chroma(colorPalettePrimary.blue400).alpha(0.08).hex(),
|
|
402
|
+
tagPress: chroma(colorPalettePrimary.blue400).alpha(0.16).hex(),
|
|
403
|
+
tagIconHover: chroma(colorPalettePrimary.white).alpha(0.8).hex(),
|
|
404
|
+
tagIconPress: chroma(colorPalettePrimary.white).alpha(0.76).hex(),
|
|
405
|
+
// Typography
|
|
406
|
+
typographyCodeBg: chroma(colorPalettePrimary.grey600).alpha(0.08).hex(),
|
|
407
|
+
// Table
|
|
408
|
+
tableBorder: colorPalettePrimary.grey200,
|
|
409
|
+
tableRowHover: chroma(colorPalettePrimary.grey600).alpha(0.04).hex(),
|
|
410
|
+
tooltipBackgroundTooltip: colorPalettePrimary.grey800,
|
|
411
|
+
...unstableColors
|
|
412
|
+
};
|
|
413
|
+
const darkColorList = {
|
|
414
|
+
actionDangerPrimaryBackgroundDefault: chroma(colorPalettePrimary.red400).alpha(0.84).hex(),
|
|
415
|
+
actionDangerPrimaryBackgroundHover: chroma(colorPalettePrimary.red400).alpha(0.72).hex(),
|
|
416
|
+
actionDangerPrimaryBackgroundPress: chroma(colorPalettePrimary.red400).alpha(0.6).hex(),
|
|
417
|
+
actionDangerDefaultBackgroundDefault: chroma(colorPalettePrimary.red400).alpha(0).hex(),
|
|
418
|
+
actionDangerDefaultBackgroundHover: chroma(colorPalettePrimary.red400).alpha(0.08).hex(),
|
|
419
|
+
actionDangerDefaultBackgroundPress: chroma(colorPalettePrimary.red400).alpha(0.16).hex(),
|
|
420
|
+
actionDangerDefaultBorderDefault: colorPalettePrimary.red400,
|
|
421
|
+
actionDangerDefaultBorderHover: chroma(colorPalettePrimary.red400).alpha(0.72).hex(),
|
|
422
|
+
actionDangerDefaultBorderPress: chroma(colorPalettePrimary.red400).alpha(0.6).hex(),
|
|
423
|
+
actionDangerDefaultTextDefault: colorPalettePrimary.red400,
|
|
424
|
+
actionDangerDefaultTextHover: chroma(colorPalettePrimary.red400).alpha(0.72).hex(),
|
|
425
|
+
actionDangerDefaultTextPress: chroma(colorPalettePrimary.red400).alpha(0.6).hex(),
|
|
426
|
+
actionDefaultBackgroundDefault: chroma(colorPalettePrimary.blue400).alpha(0).hex(),
|
|
427
|
+
actionDefaultBackgroundHover: chroma(colorPalettePrimary.blue400).alpha(0.08).hex(),
|
|
428
|
+
actionDefaultBackgroundPress: chroma(colorPalettePrimary.blue400).alpha(0.16).hex(),
|
|
429
|
+
actionDefaultBorderDefault: chroma(colorPalettePrimary.white).alpha(0.6).hex(),
|
|
430
|
+
actionDefaultBorderFocus: chroma(colorPalettePrimary.blue400).alpha(0.84).hex(),
|
|
431
|
+
actionDefaultBorderHover: chroma(colorPalettePrimary.blue400).alpha(0.8).hex(),
|
|
432
|
+
actionDefaultBorderPress: chroma(colorPalettePrimary.blue400).alpha(0.76).hex(),
|
|
433
|
+
actionDefaultTextDefault: chroma(colorPalettePrimary.white).alpha(0.84).hex(),
|
|
434
|
+
actionDefaultTextHover: chroma(colorPalettePrimary.blue400).alpha(0.8).hex(),
|
|
435
|
+
actionDefaultTextPress: chroma(colorPalettePrimary.blue400).alpha(0.76).hex(),
|
|
436
|
+
actionDisabledBackground: chroma(colorPalettePrimary.white).alpha(0.24).hex(),
|
|
437
|
+
actionDisabledText: chroma(colorPalettePrimary.white).alpha(0.4).hex(),
|
|
438
|
+
actionPrimaryBackgroundDefault: chroma(colorPalettePrimary.blue400).alpha(0.84).hex(),
|
|
439
|
+
actionPrimaryBackgroundHover: chroma(colorPalettePrimary.blue400).alpha(0.8).hex(),
|
|
440
|
+
actionPrimaryBackgroundPress: chroma(colorPalettePrimary.blue400).alpha(0.76).hex(),
|
|
441
|
+
actionPrimaryTextDefault: colorPalettePrimary.grey800,
|
|
442
|
+
actionPrimaryTextHover: colorPalettePrimary.grey800,
|
|
443
|
+
actionPrimaryTextPress: colorPalettePrimary.grey800,
|
|
444
|
+
actionTertiaryBackgroundDefault: chroma(colorPalettePrimary.blue400).alpha(0).hex(),
|
|
445
|
+
actionTertiaryBackgroundHover: chroma(colorPalettePrimary.blue400).alpha(0.08).hex(),
|
|
446
|
+
actionTertiaryBackgroundPress: chroma(colorPalettePrimary.blue400).alpha(0.16).hex(),
|
|
447
|
+
actionTertiaryTextDefault: chroma(colorPalettePrimary.blue400).alpha(0.84).hex(),
|
|
448
|
+
actionTertiaryTextHover: chroma(colorPalettePrimary.blue400).alpha(0.8).hex(),
|
|
449
|
+
actionTertiaryTextPress: chroma(colorPalettePrimary.blue400).alpha(0.76).hex(),
|
|
450
|
+
backgroundPrimary: colorPalettePrimary.grey800,
|
|
451
|
+
backgroundSecondary: chroma(colorPalettePrimary.white).alpha(0.04).hex(),
|
|
452
|
+
border: chroma(colorPalettePrimary.white).alpha(0.48).hex(),
|
|
453
|
+
borderDecorative: chroma(colorPalettePrimary.white).alpha(0.24).hex(),
|
|
454
|
+
textPrimary: chroma(colorPalettePrimary.white).alpha(0.84).hex(),
|
|
455
|
+
textSecondary: chroma(colorPalettePrimary.white).alpha(0.6).hex(),
|
|
456
|
+
textPlaceholder: chroma(colorPalettePrimary.grey400).alpha(0.84).hex(),
|
|
457
|
+
textValidationDanger: chroma(colorPalettePrimary.red400).alpha(0.84).hex(),
|
|
458
|
+
textValidationSuccess: chroma(colorPalettePrimary.green400).alpha(0.84).hex(),
|
|
459
|
+
textValidationWarning: chroma(colorPalettePrimary.yellow400).alpha(0.84).hex(),
|
|
460
|
+
overlayOverlay: chroma(colorPalettePrimary.grey800).alpha(0.72).hex(),
|
|
461
|
+
// Tags
|
|
462
|
+
tagDefault: chroma(colorPalettePrimary.white).alpha(0.16).hex(),
|
|
463
|
+
tagBrown: chroma(colorPaletteSecondary.brown).alpha(0.84).hex(),
|
|
464
|
+
tagCoral: chroma(colorPaletteSecondary.coral).alpha(0.84).hex(),
|
|
465
|
+
tagCharcoal: chroma(colorPalettePrimary.grey600).alpha(0.84).hex(),
|
|
466
|
+
tagIndigo: chroma(colorPaletteSecondary.indigo).alpha(0.84).hex(),
|
|
467
|
+
tagLemon: chroma(colorPaletteSecondary.lemon).alpha(0.84).hex(),
|
|
468
|
+
tagLime: chroma(colorPaletteSecondary.lime).alpha(0.84).hex(),
|
|
469
|
+
tagPink: chroma(colorPaletteSecondary.pink).alpha(0.84).hex(),
|
|
470
|
+
tagPurple: chroma(colorPaletteSecondary.purple).alpha(0.84).hex(),
|
|
471
|
+
tagTeal: chroma(colorPaletteSecondary.teal).alpha(0.84).hex(),
|
|
472
|
+
tagTurquoise: chroma(colorPaletteSecondary.turquoise).alpha(0.84).hex(),
|
|
473
|
+
tagText: chroma(colorPalettePrimary.white).alpha(0.84).hex(),
|
|
474
|
+
tagHover: chroma(colorPalettePrimary.blue400).alpha(0.08).hex(),
|
|
475
|
+
tagPress: chroma(colorPalettePrimary.blue400).alpha(0.16).hex(),
|
|
476
|
+
tagIconHover: chroma(colorPalettePrimary.white).alpha(0.8).hex(),
|
|
477
|
+
tagIconPress: chroma(colorPalettePrimary.white).alpha(0.76).hex(),
|
|
478
|
+
// Typography
|
|
479
|
+
typographyCodeBg: chroma(colorPalettePrimary.white).alpha(0.16).hex(),
|
|
480
|
+
// Table
|
|
481
|
+
tableBorder: chroma(colorPalettePrimary.white).alpha(0.24).hex(),
|
|
482
|
+
tableRowHover: chroma(colorPalettePrimary.white).alpha(0.16).hex(),
|
|
483
|
+
tooltipBackgroundTooltip: chroma(colorPalettePrimary.white).alpha(0.6).hex(),
|
|
484
|
+
// Missing in list
|
|
485
|
+
backgroundDanger: 'rgba(200,45,76,0.08)',
|
|
486
|
+
backgroundWarning: 'rgba(222,121,33,0.08)',
|
|
487
|
+
// Missing in light list
|
|
488
|
+
// "background-validation-danger": "rgba(229,110,134,0)",
|
|
489
|
+
// "background-validation-warning": "rgba(252,234,202,0)",
|
|
490
|
+
...unstableColors
|
|
491
|
+
};
|
|
492
|
+
const darkColors = {
|
|
493
|
+
...darkColorList,
|
|
494
|
+
...colorPalettePrimary,
|
|
495
|
+
...colorPaletteSecondary
|
|
496
|
+
};
|
|
497
|
+
const lightColors = {
|
|
498
|
+
...lightColorList,
|
|
499
|
+
...colorPalettePrimary,
|
|
500
|
+
...colorPaletteSecondary
|
|
501
|
+
};
|
|
502
|
+
function getSemanticColors(theme) {
|
|
503
|
+
switch (theme) {
|
|
504
|
+
case 'dark':
|
|
505
|
+
return {
|
|
506
|
+
...darkColors
|
|
507
|
+
};
|
|
508
|
+
default:
|
|
509
|
+
return {
|
|
510
|
+
...lightColors
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// TODO (FEINF-1674): Remove when removing USE_NEW_RADIO_STYLES
|
|
516
|
+
/*
|
|
517
|
+
Colors that need to be replaced by semantic colors.
|
|
518
|
+
*/
|
|
519
|
+
const deprecatedColors = {
|
|
520
|
+
// Radio Colors
|
|
521
|
+
radioInteractiveAvailable: colorPalettePrimary.primary,
|
|
522
|
+
radioInteractiveHover: '#186099',
|
|
523
|
+
radioInteractivePress: '#0D4F85',
|
|
524
|
+
radioDisabled: '#A2AEB8',
|
|
525
|
+
radioDefaultBorder: '#64727D',
|
|
526
|
+
radioDefaultBackground: '#FFFFFF',
|
|
527
|
+
radioInteractiveHoverSecondary: 'rgba(34, 115, 181, 0.08)',
|
|
528
|
+
// Fade of Interactive Available
|
|
529
|
+
radioInteractivePressSecondary: 'rgba(34, 115, 181, 0.16)' // Fade of Interactive Available
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
function getColors(theme) {
|
|
533
|
+
return {
|
|
534
|
+
...deprecatedColors,
|
|
535
|
+
...getSemanticColors(theme)
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
540
|
+
var antdVars = {
|
|
541
|
+
// IMPORTANT: Do not read this directly from components. Use `React.useContext`.
|
|
542
|
+
'ant-prefix': 'du-bois'
|
|
543
|
+
};
|
|
544
|
+
const DEFAULT_SPACING_UNIT = 8;
|
|
545
|
+
const MODAL_PADDING = 40;
|
|
546
|
+
const spacing = {
|
|
547
|
+
xs: DEFAULT_SPACING_UNIT / 2,
|
|
548
|
+
sm: DEFAULT_SPACING_UNIT,
|
|
549
|
+
md: DEFAULT_SPACING_UNIT * 2,
|
|
550
|
+
lg: DEFAULT_SPACING_UNIT * 3
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
// Less variables that are used by AntD
|
|
554
|
+
({
|
|
555
|
+
defaultPaddingLg: spacing.lg,
|
|
556
|
+
defaultPaddingMd: spacing.md,
|
|
557
|
+
defaultPaddingSm: spacing.sm,
|
|
558
|
+
defaultPaddingXs: spacing.sm,
|
|
559
|
+
defaultPaddingXss: spacing.xs,
|
|
560
|
+
paddingLg: spacing.md,
|
|
561
|
+
// TODO: Check if there is a better alternative with team
|
|
562
|
+
paddingMd: spacing.sm,
|
|
563
|
+
paddingSm: spacing.sm,
|
|
564
|
+
paddingXs: spacing.xs,
|
|
565
|
+
paddingXss: 0,
|
|
566
|
+
marginSm: 12,
|
|
567
|
+
marginLg: spacing.lg,
|
|
568
|
+
// Button
|
|
569
|
+
btnPaddingHorizontalBase: DEFAULT_SPACING_UNIT * 2,
|
|
570
|
+
btnPaddingHorizontalLg: DEFAULT_SPACING_UNIT * 2,
|
|
571
|
+
btnPaddingHorizontalSm: DEFAULT_SPACING_UNIT * 2,
|
|
572
|
+
// Input
|
|
573
|
+
inputPaddingHorizontal: DEFAULT_SPACING_UNIT * 1.5,
|
|
574
|
+
inputPaddingHorizontalBase: DEFAULT_SPACING_UNIT * 1.5,
|
|
575
|
+
inputPaddingHorizontalSm: DEFAULT_SPACING_UNIT * 1.5,
|
|
576
|
+
inputPaddingHorizontalLg: DEFAULT_SPACING_UNIT * 1.5,
|
|
577
|
+
inputPaddingVertical: spacing.xs + 1,
|
|
578
|
+
inputPaddingVerticalBase: spacing.xs + 1,
|
|
579
|
+
inputPaddingVerticalSm: spacing.xs + 1,
|
|
580
|
+
inputPaddingVerticalLg: spacing.xs + 1,
|
|
581
|
+
// Modal
|
|
582
|
+
modalPadding: MODAL_PADDING,
|
|
583
|
+
modalLessPadding: MODAL_PADDING - 20,
|
|
584
|
+
modalHeaderPadding: "".concat(MODAL_PADDING, "px ").concat(MODAL_PADDING, "px ").concat(MODAL_PADDING - 20, "px"),
|
|
585
|
+
modalHeaderCloseSize: MODAL_PADDING * 2 + 22,
|
|
586
|
+
modalHeaderBorderWidth: 0,
|
|
587
|
+
modalBodyPadding: "0 ".concat(MODAL_PADDING, "px"),
|
|
588
|
+
modalFooterPaddingVertical: 0,
|
|
589
|
+
modalFooterPaddingHorizontal: 0,
|
|
590
|
+
modalFooterBorderWidth: 0,
|
|
591
|
+
// Switch
|
|
592
|
+
switchPadding: 0,
|
|
593
|
+
switchHeight: 16,
|
|
594
|
+
switchMinWidth: 28,
|
|
595
|
+
switchPinSize: 14
|
|
596
|
+
});
|
|
597
|
+
var spacing$1 = spacing;
|
|
598
|
+
const heightBase = 40;
|
|
599
|
+
const borderWidth = 1;
|
|
600
|
+
const antdGeneralVariables = {
|
|
601
|
+
classnamePrefix: antdVars['ant-prefix'],
|
|
602
|
+
iconfontCssPrefix: 'anticon',
|
|
603
|
+
borderRadiusBase: 4,
|
|
604
|
+
borderWidth: borderWidth,
|
|
605
|
+
heightSm: 32,
|
|
606
|
+
heightBase: heightBase,
|
|
607
|
+
iconSize: 24,
|
|
608
|
+
// TODO (FEINF-1545): Update with icon overhaul to 16px
|
|
609
|
+
iconFontSize: 13,
|
|
610
|
+
iconFontSizeNew: 16,
|
|
611
|
+
buttonHeight: heightBase,
|
|
612
|
+
// Height available within button (for label and icon). Same for middle and small buttons.
|
|
613
|
+
buttonInnerHeight: heightBase - spacing$1.sm * 2 - borderWidth * 2
|
|
614
|
+
};
|
|
615
|
+
var generalVariables = antdGeneralVariables;
|
|
616
|
+
const FONT_SIZE_BASE = 13;
|
|
617
|
+
|
|
618
|
+
// Less variables that are used by AntD
|
|
619
|
+
const antdTypography = {
|
|
620
|
+
fontSizeSm: 12,
|
|
621
|
+
fontSizeBase: FONT_SIZE_BASE,
|
|
622
|
+
fontSizeMd: FONT_SIZE_BASE,
|
|
623
|
+
fontSizeLg: 18,
|
|
624
|
+
fontSizeXl: 22,
|
|
625
|
+
fontSizeXxl: 32,
|
|
626
|
+
lineHeightSm: '16px',
|
|
627
|
+
lineHeightBase: '20px',
|
|
628
|
+
lineHeightMd: '20px',
|
|
629
|
+
lineHeightLg: '24px',
|
|
630
|
+
lineHeightXl: '28px',
|
|
631
|
+
lineHeightXxl: '40px',
|
|
632
|
+
typographyBoldFontWeight: 600
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
636
|
+
var typography = {
|
|
637
|
+
...antdTypography
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
// TODO(giles): fix this
|
|
641
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
642
|
+
|
|
643
|
+
const defaultOptions = {
|
|
644
|
+
enableAnimation: false,
|
|
645
|
+
zIndexBase: 1000
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
// Function to get variables for a certain theme.
|
|
649
|
+
// End users should use useDesignSystemTheme instead.
|
|
650
|
+
function getTheme(themeName) {
|
|
651
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
|
|
652
|
+
return {
|
|
653
|
+
colors: getColors(themeName),
|
|
654
|
+
spacing: spacing$1,
|
|
655
|
+
general: generalVariables,
|
|
656
|
+
typography,
|
|
657
|
+
borders: borders$1,
|
|
658
|
+
themeName,
|
|
659
|
+
options
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
const themeNameToAntdName = {
|
|
663
|
+
dark: 'dark',
|
|
664
|
+
default: 'light'
|
|
665
|
+
};
|
|
666
|
+
function getClassNamePrefix(theme) {
|
|
667
|
+
const antdThemeName = themeNameToAntdName[theme.themeName];
|
|
668
|
+
return "".concat(theme.general.classnamePrefix, "-").concat(antdThemeName);
|
|
669
|
+
}
|
|
670
|
+
function getPrefixedClassNameFromTheme(theme, className) {
|
|
671
|
+
return [getClassNamePrefix(theme), className].filter(Boolean).join('-');
|
|
672
|
+
}
|
|
673
|
+
function useDesignSystemTheme() {
|
|
674
|
+
const emotionTheme = useTheme();
|
|
675
|
+
// Graceful fallback to default theme in case a test or developer forgot context.
|
|
676
|
+
const theme = emotionTheme && emotionTheme.general ? emotionTheme : getTheme('default');
|
|
677
|
+
return {
|
|
678
|
+
theme: theme,
|
|
679
|
+
classNamePrefix: getClassNamePrefix(theme),
|
|
680
|
+
getPrefixedClassName: className => getPrefixedClassNameFromTheme(theme, className)
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
685
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
686
|
+
name: "1tciq3q",
|
|
687
|
+
styles: "position:relative;display:flex;align-items:center;&[data-orientation=\"vertical\"]{flex-direction:column;width:20px;height:100px;}&[data-orientation=\"horizontal\"]{height:20px;width:200px;}"
|
|
688
|
+
} : {
|
|
689
|
+
name: "18im58f-getRootStyles",
|
|
690
|
+
styles: "position:relative;display:flex;align-items:center;&[data-orientation=\"vertical\"]{flex-direction:column;width:20px;height:100px;}&[data-orientation=\"horizontal\"]{height:20px;width:200px;};label:getRootStyles;",
|
|
691
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
692
|
+
};
|
|
693
|
+
const getRootStyles = () => {
|
|
694
|
+
return _ref;
|
|
695
|
+
};
|
|
696
|
+
const Root = /*#__PURE__*/forwardRef((props, ref) => {
|
|
697
|
+
return jsx(RadixSlider.Root, {
|
|
698
|
+
css: getRootStyles(),
|
|
699
|
+
...props,
|
|
700
|
+
ref: ref
|
|
701
|
+
});
|
|
702
|
+
});
|
|
703
|
+
const getTrackStyles = theme => {
|
|
704
|
+
return /*#__PURE__*/css({
|
|
705
|
+
backgroundColor: theme.colors.grey100,
|
|
706
|
+
position: 'relative',
|
|
707
|
+
flexGrow: 1,
|
|
708
|
+
borderRadius: 9999,
|
|
709
|
+
'&[data-orientation="vertical"]': {
|
|
710
|
+
width: 3
|
|
711
|
+
},
|
|
712
|
+
'&[data-orientation="horizontal"]': {
|
|
713
|
+
height: 3
|
|
714
|
+
}
|
|
715
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getTrackStyles;");
|
|
716
|
+
};
|
|
717
|
+
const Track = /*#__PURE__*/forwardRef((props, ref) => {
|
|
718
|
+
const {
|
|
719
|
+
theme
|
|
720
|
+
} = useDesignSystemTheme();
|
|
721
|
+
return jsx(RadixSlider.Track, {
|
|
722
|
+
css: getTrackStyles(theme),
|
|
723
|
+
...props,
|
|
724
|
+
ref: ref
|
|
725
|
+
});
|
|
726
|
+
});
|
|
727
|
+
const getRangeStyles = theme => {
|
|
728
|
+
return /*#__PURE__*/css({
|
|
729
|
+
backgroundColor: theme.colors.primary,
|
|
730
|
+
position: 'absolute',
|
|
731
|
+
borderRadius: 9999,
|
|
732
|
+
height: '100%',
|
|
733
|
+
'&[data-disabled]': {
|
|
734
|
+
backgroundColor: theme.colors.grey100
|
|
735
|
+
}
|
|
736
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getRangeStyles;");
|
|
737
|
+
};
|
|
738
|
+
const Range = /*#__PURE__*/forwardRef((props, ref) => {
|
|
739
|
+
const {
|
|
740
|
+
theme
|
|
741
|
+
} = useDesignSystemTheme();
|
|
742
|
+
return jsx(RadixSlider.Range, {
|
|
743
|
+
css: getRangeStyles(theme),
|
|
744
|
+
...props,
|
|
745
|
+
ref: ref
|
|
746
|
+
});
|
|
747
|
+
});
|
|
748
|
+
const getThumbStyles = theme => {
|
|
749
|
+
return /*#__PURE__*/css({
|
|
750
|
+
display: 'block',
|
|
751
|
+
width: 20,
|
|
752
|
+
height: 20,
|
|
753
|
+
backgroundColor: theme.colors.actionPrimaryBackgroundDefault,
|
|
754
|
+
boxShadow: "0 2px 4px 0 ".concat(theme.colors.grey400),
|
|
755
|
+
borderRadius: 10,
|
|
756
|
+
outline: 'none',
|
|
757
|
+
'&:hover': {
|
|
758
|
+
backgroundColor: theme.colors.actionPrimaryBackgroundHover
|
|
759
|
+
},
|
|
760
|
+
'&:focus': {
|
|
761
|
+
backgroundColor: theme.colors.actionPrimaryBackgroundPress
|
|
762
|
+
},
|
|
763
|
+
'&[data-disabled]': {
|
|
764
|
+
backgroundColor: theme.colors.grey200,
|
|
765
|
+
boxShadow: 'none'
|
|
766
|
+
}
|
|
767
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getThumbStyles;");
|
|
768
|
+
};
|
|
769
|
+
const Thumb = /*#__PURE__*/forwardRef((props, ref) => {
|
|
770
|
+
const {
|
|
771
|
+
theme
|
|
772
|
+
} = useDesignSystemTheme();
|
|
773
|
+
return jsx(RadixSlider.Thumb, {
|
|
774
|
+
css: getThumbStyles(theme),
|
|
775
|
+
...props,
|
|
776
|
+
ref: ref
|
|
777
|
+
});
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
var Slider = /*#__PURE__*/Object.freeze({
|
|
781
|
+
__proto__: null,
|
|
782
|
+
Root: Root,
|
|
783
|
+
Track: Track,
|
|
784
|
+
Range: Range,
|
|
785
|
+
Thumb: Thumb
|
|
786
|
+
});
|
|
787
|
+
|
|
788
|
+
export { Slider, Table, TableCell, TableHeader, TableRow, TableRowSelectCell };
|
|
789
|
+
//# sourceMappingURL=development.js.map
|