@pingux/astro 2.207.0 → 2.208.0-alpha.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.
- package/lib/cjs/components/Badge/Badge.styles.d.ts +152 -0
- package/lib/cjs/components/Badge/Badge.styles.js +9 -1
- package/lib/cjs/components/Checkbox/CheckboxBase.js +4 -2
- package/lib/cjs/components/CheckboxField/CheckboxField.js +18 -1
- package/lib/cjs/components/CheckboxField/CheckboxField.test.js +82 -0
- package/lib/cjs/components/LinkSelectField/LinkSelectField.js +0 -6
- package/lib/cjs/components/Pagination/Pagination.js +4 -2
- package/lib/cjs/components/Pagination/Pagination.styles.js +1 -1
- package/lib/cjs/components/TableBase/TableBase.js +4 -1
- package/lib/cjs/components/TableBase/TableBase.stories.js +8 -8
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/badges.d.ts +42 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/badges.js +38 -1
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/cards.d.ts +3 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/cards.js +4 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/text.d.ts +3 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/text.js +3 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +26 -3
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +27 -5
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +220 -18
- package/lib/cjs/styles/themes/next-gen/next-gen.js +1 -1
- package/lib/cjs/styles/themes/next-gen/variants/badges.d.ts +202 -0
- package/lib/cjs/styles/themes/next-gen/variants/badges.js +42 -1
- package/lib/cjs/styles/themes/next-gen/variants/cards.d.ts +1 -1
- package/lib/cjs/styles/themes/next-gen/variants/cards.js +3 -1
- package/lib/cjs/styles/themes/next-gen/variants/tableBase.d.ts +11 -17
- package/lib/cjs/styles/themes/next-gen/variants/tableBase.js +13 -17
- package/lib/cjs/styles/themes/next-gen/variants/text.d.ts +6 -0
- package/lib/cjs/styles/themes/next-gen/variants/text.js +6 -0
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +11 -17
- package/lib/components/Badge/Badge.styles.js +9 -1
- package/lib/components/Checkbox/CheckboxBase.js +4 -2
- package/lib/components/CheckboxField/CheckboxField.js +19 -2
- package/lib/components/CheckboxField/CheckboxField.test.js +83 -1
- package/lib/components/LinkSelectField/LinkSelectField.js +0 -6
- package/lib/components/Pagination/Pagination.js +4 -2
- package/lib/components/Pagination/Pagination.styles.js +1 -1
- package/lib/components/TableBase/TableBase.js +4 -1
- package/lib/components/TableBase/TableBase.stories.js +8 -8
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/badges.js +38 -1
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/cards.js +4 -0
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/text.js +3 -0
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +27 -5
- package/lib/styles/themes/next-gen/next-gen.js +1 -1
- package/lib/styles/themes/next-gen/variants/badges.js +42 -1
- package/lib/styles/themes/next-gen/variants/cards.js +3 -1
- package/lib/styles/themes/next-gen/variants/tableBase.js +13 -17
- package/lib/styles/themes/next-gen/variants/text.js +6 -0
- package/package.json +1 -1
|
@@ -36,50 +36,47 @@ export declare const tableBase: {
|
|
|
36
36
|
caption: {
|
|
37
37
|
backgroundColor: string;
|
|
38
38
|
px: string;
|
|
39
|
-
color:
|
|
39
|
+
color: any;
|
|
40
40
|
borderBottom: string;
|
|
41
|
-
borderBottomColor:
|
|
41
|
+
borderBottomColor: any;
|
|
42
42
|
borderTopLeftRadius: string;
|
|
43
43
|
borderTopRightRadius: string;
|
|
44
44
|
};
|
|
45
45
|
row: {
|
|
46
46
|
borderBottom: string;
|
|
47
|
-
borderBottomColor:
|
|
47
|
+
borderBottomColor: any;
|
|
48
48
|
'&.is-focused': {
|
|
49
49
|
outlineOffset: string;
|
|
50
50
|
outline: string;
|
|
51
51
|
outlineColor: string;
|
|
52
52
|
};
|
|
53
53
|
'&.is-hovered': {
|
|
54
|
-
bg:
|
|
54
|
+
bg: any;
|
|
55
55
|
'& > td:last-of-type': {
|
|
56
|
-
bg:
|
|
56
|
+
bg: any;
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
'&:nth-of-type(odd)': {
|
|
60
|
-
bg:
|
|
60
|
+
bg: any;
|
|
61
61
|
'&.is-hovered': {
|
|
62
|
-
bg:
|
|
62
|
+
bg: any;
|
|
63
63
|
};
|
|
64
64
|
'& > td:last-of-type': {
|
|
65
|
-
bg:
|
|
65
|
+
bg: any;
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
69
|
thead: {
|
|
70
|
-
borderBottomColor:
|
|
70
|
+
borderBottomColor: any;
|
|
71
71
|
backgroundColor: string;
|
|
72
72
|
'&.is-sticky': {
|
|
73
|
+
border: string;
|
|
73
74
|
boxShadow: string;
|
|
74
75
|
};
|
|
75
76
|
};
|
|
76
77
|
head: {
|
|
77
78
|
px: string;
|
|
78
79
|
py: string;
|
|
79
|
-
fontSize: string;
|
|
80
|
-
fontWeight: string;
|
|
81
|
-
color: string;
|
|
82
|
-
lineHeight: string;
|
|
83
80
|
'&.is-focused': {
|
|
84
81
|
outlineOffset: string;
|
|
85
82
|
outline: string;
|
|
@@ -90,7 +87,7 @@ export declare const tableBase: {
|
|
|
90
87
|
};
|
|
91
88
|
};
|
|
92
89
|
tbody: {
|
|
93
|
-
borderTopColor:
|
|
90
|
+
borderTopColor: any;
|
|
94
91
|
borderBottom: string;
|
|
95
92
|
backgroundColor: string;
|
|
96
93
|
borderBottomLeftRadius: string;
|
|
@@ -104,9 +101,6 @@ export declare const tableBase: {
|
|
|
104
101
|
zIndex: number;
|
|
105
102
|
};
|
|
106
103
|
px: string;
|
|
107
|
-
fontSize: string;
|
|
108
|
-
color: string;
|
|
109
|
-
lineHeight: string;
|
|
110
104
|
'&.is-focused': {
|
|
111
105
|
outlineOffset: string;
|
|
112
106
|
outline: string;
|
|
@@ -15,7 +15,6 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
15
15
|
exports.tableBase = void 0;
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
17
17
|
var _onyxTokens = require("@pingux/onyx-tokens");
|
|
18
|
-
var _colors = _interopRequireDefault(require("../colors/colors"));
|
|
19
18
|
var _button = require("./button");
|
|
20
19
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
20
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -60,37 +59,38 @@ var container = {
|
|
|
60
59
|
var caption = {
|
|
61
60
|
backgroundColor: 'backgroundBase',
|
|
62
61
|
px: 'lg',
|
|
63
|
-
color:
|
|
62
|
+
color: _onyxTokens.astroTokens.color.font.base,
|
|
64
63
|
borderBottom: '1px solid',
|
|
65
|
-
borderBottomColor:
|
|
64
|
+
borderBottomColor: _onyxTokens.astroTokens.color.common.border,
|
|
66
65
|
borderTopLeftRadius: borderRadius,
|
|
67
66
|
borderTopRightRadius: borderRadius
|
|
68
67
|
};
|
|
69
68
|
var row = {
|
|
70
69
|
borderBottom: '1px solid',
|
|
71
|
-
borderBottomColor:
|
|
70
|
+
borderBottomColor: _onyxTokens.astroTokens.color.common.border,
|
|
72
71
|
'&.is-focused': _objectSpread({}, defaultFocus),
|
|
73
72
|
'&.is-hovered': {
|
|
74
|
-
bg: '
|
|
73
|
+
bg: _onyxTokens.astroTokens.color['table-row'].hover.bg,
|
|
75
74
|
'& > td:last-of-type': {
|
|
76
|
-
bg: '
|
|
75
|
+
bg: _onyxTokens.astroTokens.color['table-row'].hover.bg
|
|
77
76
|
}
|
|
78
77
|
},
|
|
79
78
|
'&:nth-of-type(odd)': {
|
|
80
|
-
bg:
|
|
79
|
+
bg: _onyxTokens.astroTokens.color.common.bg.base,
|
|
81
80
|
'&.is-hovered': {
|
|
82
|
-
bg: '
|
|
81
|
+
bg: _onyxTokens.astroTokens.color['table-row'].hover.bg
|
|
83
82
|
},
|
|
84
83
|
'& > td:last-of-type': {
|
|
85
|
-
bg:
|
|
84
|
+
bg: _onyxTokens.astroTokens.color.common.bg.base
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
};
|
|
89
88
|
var thead = {
|
|
90
|
-
borderBottomColor:
|
|
89
|
+
borderBottomColor: _onyxTokens.astroTokens.color.common.border,
|
|
91
90
|
backgroundColor: 'backgroundBase',
|
|
92
91
|
'&.is-sticky': {
|
|
93
|
-
|
|
92
|
+
border: 'none',
|
|
93
|
+
boxShadow: "0 1px 0 ".concat(_onyxTokens.astroTokens.color.common.border)
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
var resizer = {
|
|
@@ -99,17 +99,13 @@ var resizer = {
|
|
|
99
99
|
var head = {
|
|
100
100
|
px: 'lg',
|
|
101
101
|
py: 'sm',
|
|
102
|
-
fontSize: 'md',
|
|
103
|
-
fontWeight: '2',
|
|
104
|
-
color: 'text.primary',
|
|
105
|
-
lineHeight: 'body',
|
|
106
102
|
'&.is-focused': _objectSpread({}, defaultFocus),
|
|
107
103
|
'&:last-of-type': {
|
|
108
104
|
backgroundColor: 'backgroundBase'
|
|
109
105
|
}
|
|
110
106
|
};
|
|
111
107
|
var tbody = {
|
|
112
|
-
borderTopColor:
|
|
108
|
+
borderTopColor: _onyxTokens.astroTokens.color.common.border,
|
|
113
109
|
borderBottom: 'unset',
|
|
114
110
|
backgroundColor: 'backgroundBase',
|
|
115
111
|
borderBottomLeftRadius: borderRadius,
|
|
@@ -117,7 +113,7 @@ var tbody = {
|
|
|
117
113
|
};
|
|
118
114
|
var data = _objectSpread(_objectSpread({}, head), {}, {
|
|
119
115
|
py: 'md',
|
|
120
|
-
fontWeight: '
|
|
116
|
+
fontWeight: '0',
|
|
121
117
|
'&:last-of-type': {
|
|
122
118
|
backgroundColor: 'backgroundBase',
|
|
123
119
|
zIndex: 1
|
|
@@ -262,6 +262,12 @@ var text = exports.text = _objectSpread(_objectSpread({
|
|
|
262
262
|
},
|
|
263
263
|
stepperTabContent: stepperTabContent,
|
|
264
264
|
stepperTabContentHeader: stepperTabContentHeader,
|
|
265
|
+
headText: {
|
|
266
|
+
fontSize: 'md',
|
|
267
|
+
fontWeight: '2',
|
|
268
|
+
color: _onyxTokens.astroTokens.color.font.base,
|
|
269
|
+
lineHeight: 'xs'
|
|
270
|
+
},
|
|
265
271
|
label: label,
|
|
266
272
|
linkSelectFieldLabel: _objectSpread(_objectSpread({}, label), {}, {
|
|
267
273
|
color: _onyxTokens.astroTokens.color.font.link
|
|
@@ -2130,50 +2130,47 @@ declare const _default: {
|
|
|
2130
2130
|
caption: {
|
|
2131
2131
|
backgroundColor: string;
|
|
2132
2132
|
px: string;
|
|
2133
|
-
color:
|
|
2133
|
+
color: any;
|
|
2134
2134
|
borderBottom: string;
|
|
2135
|
-
borderBottomColor:
|
|
2135
|
+
borderBottomColor: any;
|
|
2136
2136
|
borderTopLeftRadius: string;
|
|
2137
2137
|
borderTopRightRadius: string;
|
|
2138
2138
|
};
|
|
2139
2139
|
row: {
|
|
2140
2140
|
borderBottom: string;
|
|
2141
|
-
borderBottomColor:
|
|
2141
|
+
borderBottomColor: any;
|
|
2142
2142
|
'&.is-focused': {
|
|
2143
2143
|
outlineOffset: string;
|
|
2144
2144
|
outline: string;
|
|
2145
2145
|
outlineColor: string;
|
|
2146
2146
|
};
|
|
2147
2147
|
'&.is-hovered': {
|
|
2148
|
-
bg:
|
|
2148
|
+
bg: any;
|
|
2149
2149
|
'& > td:last-of-type': {
|
|
2150
|
-
bg:
|
|
2150
|
+
bg: any;
|
|
2151
2151
|
};
|
|
2152
2152
|
};
|
|
2153
2153
|
'&:nth-of-type(odd)': {
|
|
2154
|
-
bg:
|
|
2154
|
+
bg: any;
|
|
2155
2155
|
'&.is-hovered': {
|
|
2156
|
-
bg:
|
|
2156
|
+
bg: any;
|
|
2157
2157
|
};
|
|
2158
2158
|
'& > td:last-of-type': {
|
|
2159
|
-
bg:
|
|
2159
|
+
bg: any;
|
|
2160
2160
|
};
|
|
2161
2161
|
};
|
|
2162
2162
|
};
|
|
2163
2163
|
thead: {
|
|
2164
|
-
borderBottomColor:
|
|
2164
|
+
borderBottomColor: any;
|
|
2165
2165
|
backgroundColor: string;
|
|
2166
2166
|
'&.is-sticky': {
|
|
2167
|
+
border: string;
|
|
2167
2168
|
boxShadow: string;
|
|
2168
2169
|
};
|
|
2169
2170
|
};
|
|
2170
2171
|
head: {
|
|
2171
2172
|
px: string;
|
|
2172
2173
|
py: string;
|
|
2173
|
-
fontSize: string;
|
|
2174
|
-
fontWeight: string;
|
|
2175
|
-
color: string;
|
|
2176
|
-
lineHeight: string;
|
|
2177
2174
|
'&.is-focused': {
|
|
2178
2175
|
outlineOffset: string;
|
|
2179
2176
|
outline: string;
|
|
@@ -2184,7 +2181,7 @@ declare const _default: {
|
|
|
2184
2181
|
};
|
|
2185
2182
|
};
|
|
2186
2183
|
tbody: {
|
|
2187
|
-
borderTopColor:
|
|
2184
|
+
borderTopColor: any;
|
|
2188
2185
|
borderBottom: string;
|
|
2189
2186
|
backgroundColor: string;
|
|
2190
2187
|
borderBottomLeftRadius: string;
|
|
@@ -2198,9 +2195,6 @@ declare const _default: {
|
|
|
2198
2195
|
zIndex: number;
|
|
2199
2196
|
};
|
|
2200
2197
|
px: string;
|
|
2201
|
-
fontSize: string;
|
|
2202
|
-
color: string;
|
|
2203
|
-
lineHeight: string;
|
|
2204
2198
|
'&.is-focused': {
|
|
2205
2199
|
outlineOffset: string;
|
|
2206
2200
|
outline: string;
|
|
@@ -258,6 +258,13 @@ var dataTable = {
|
|
|
258
258
|
borderColor: 'success.dark'
|
|
259
259
|
})
|
|
260
260
|
};
|
|
261
|
+
var tableBaseBadge = {
|
|
262
|
+
active: _objectSpread({}, infoCalloutBadge),
|
|
263
|
+
warning: _objectSpread({}, warningStatusBadge),
|
|
264
|
+
critical: _objectSpread({}, criticalStatusBadge),
|
|
265
|
+
healthy: _objectSpread({}, healthyStatusBadge),
|
|
266
|
+
secondary: _objectSpread({}, secondaryStatusBadge)
|
|
267
|
+
};
|
|
261
268
|
export default {
|
|
262
269
|
activeStatusBadge: activeStatusBadge,
|
|
263
270
|
badgeDeleteButton: badgeDeleteButton,
|
|
@@ -284,5 +291,6 @@ export default {
|
|
|
284
291
|
secondaryStatusBadge: secondaryStatusBadge,
|
|
285
292
|
removableBadge: removableBadge,
|
|
286
293
|
invertedRemovableBadge: invertedRemovableBadge,
|
|
287
|
-
dataTable: dataTable
|
|
294
|
+
dataTable: dataTable,
|
|
295
|
+
tableBaseBadge: tableBaseBadge
|
|
288
296
|
};
|
|
@@ -21,13 +21,14 @@ var DefaultCheckbox = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
21
21
|
}, props));
|
|
22
22
|
});
|
|
23
23
|
var IndeterminateCheckboxIcon = function IndeterminateCheckboxIcon(props) {
|
|
24
|
+
console.log('🚀 ~ IndeterminateCheckboxIcon ~ props:', props);
|
|
24
25
|
return ___EmotionJSX("svg", _extends({
|
|
25
26
|
viewBox: "0 0 24 24",
|
|
26
27
|
fill: "none",
|
|
27
28
|
xmlns: "http://www.w3.org/2000/svg",
|
|
28
29
|
"aria-labelledby": "checkbox-icon-title",
|
|
29
30
|
"data-testid": "checkbox-icon-indeterminate"
|
|
30
|
-
}, omit(props, 'id', 'aria-checked', 'data-testid')), ___EmotionJSX("title", {
|
|
31
|
+
}, omit(props, 'id', 'aria-checked', 'data-testid', 'onFocus')), ___EmotionJSX("title", {
|
|
31
32
|
id: "checkbox-icon-title"
|
|
32
33
|
}, "Indeterminate Checkbox Icon"), ___EmotionJSX("rect", {
|
|
33
34
|
x: "3.5",
|
|
@@ -65,7 +66,8 @@ var IndeterminateCheckbox = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
65
66
|
variant: "variants.box.indeterminateCheckboxIcon",
|
|
66
67
|
mr: 2
|
|
67
68
|
}, props, {
|
|
68
|
-
opacity: 1
|
|
69
|
+
opacity: 1,
|
|
70
|
+
tabIndex: -1
|
|
69
71
|
})));
|
|
70
72
|
});
|
|
71
73
|
var CheckboxBase = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
@@ -7,10 +7,12 @@ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-st
|
|
|
7
7
|
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
8
8
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
9
9
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
10
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
|
10
11
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
12
|
+
var _excluded = ["onKeyDown", "onKeyUp"];
|
|
11
13
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
-
import React, { forwardRef, useEffect, useMemo } from 'react';
|
|
15
|
+
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
14
16
|
import { mergeProps, useCheckbox } from 'react-aria';
|
|
15
17
|
import { useToggleState } from 'react-stately';
|
|
16
18
|
import { usePress } from '@react-aria/interactions';
|
|
@@ -46,16 +48,31 @@ var CheckboxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
46
48
|
ref: checkboxRef
|
|
47
49
|
})),
|
|
48
50
|
containerPressProps = _usePress.pressProps;
|
|
51
|
+
// usePress onKeyDown registers a global keyup listener and when isIndeterminate changes during
|
|
52
|
+
// a press, usePress creates a new state machine instance but old global keyup
|
|
53
|
+
// listener never fires cleanly and the state machine gets out of sync, causing
|
|
54
|
+
// subsequent Space presses to be ignored. The checkbox input already handles Space natively.
|
|
55
|
+
var _kd = containerPressProps.onKeyDown,
|
|
56
|
+
_ku = containerPressProps.onKeyUp,
|
|
57
|
+
safeContainerPressProps = _objectWithoutProperties(containerPressProps, _excluded);
|
|
58
|
+
var prevIsIndeterminate = useRef(isIndeterminate);
|
|
49
59
|
useEffect(function () {
|
|
50
60
|
if (checkboxRef.current && isIndeterminate) {
|
|
51
61
|
checkboxRef.current.indeterminate = true;
|
|
52
62
|
} else if (checkboxRef.current && !isIndeterminate) {
|
|
53
63
|
checkboxRef.current.indeterminate = false;
|
|
64
|
+
|
|
65
|
+
// Restore focus to the new input when the transition from indeterminate to default
|
|
66
|
+
// occurs and focus has landed on <body> (meaning it was on the old input before the swap).
|
|
67
|
+
if (prevIsIndeterminate.current && document.activeElement === document.body) {
|
|
68
|
+
checkboxRef.current.focus();
|
|
69
|
+
}
|
|
54
70
|
}
|
|
71
|
+
prevIsIndeterminate.current = isIndeterminate;
|
|
55
72
|
}, [isIndeterminate]);
|
|
56
73
|
var _useCheckbox = useCheckbox(checkboxProps, state, checkboxRef),
|
|
57
74
|
inputProps = _useCheckbox.inputProps;
|
|
58
|
-
var _useField = useField(_objectSpread(_objectSpread(_objectSpread({},
|
|
75
|
+
var _useField = useField(_objectSpread(_objectSpread(_objectSpread({}, safeContainerPressProps), props), {}, {
|
|
59
76
|
statusClasses: {
|
|
60
77
|
isIndeterminate: isIndeterminate
|
|
61
78
|
},
|
|
@@ -9,6 +9,7 @@ import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
|
9
9
|
import _Symbol$iterator from "@babel/runtime-corejs3/core-js-stable/symbol/iterator";
|
|
10
10
|
import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reverse";
|
|
11
11
|
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
|
12
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
12
13
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
|
13
14
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
14
15
|
function _regeneratorRuntime() { "use strict"; var r = _regenerator(), e = r.m(_regeneratorRuntime), t = (_Object$getPrototypeOf ? _Object$getPrototypeOf(e) : e.__proto__).constructor; function n(r) { var e = "function" == typeof r && r.constructor; return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name)); } var o = { "throw": 1, "return": 2, "break": 3, "continue": 3 }; function a(r) { var e, t; return function (n) { e || (e = { stop: function stop() { return t(n.a, 2); }, "catch": function _catch() { return n.v; }, abrupt: function abrupt(r, e) { return t(n.a, o[r], e); }, delegateYield: function delegateYield(r, o, a) { return e.resultName = o, t(n.d, _regeneratorValues(r), a); }, finish: function finish(r) { return t(n.f, r); } }, t = function t(r, _t, o) { n.p = e.prev, n.n = e.next; try { return r(_t, o); } finally { e.next = n.n; } }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; try { return r.call(this, e); } finally { n.p = e.prev, n.n = e.next; } }; } return (_regeneratorRuntime = function _regeneratorRuntime() { return { wrap: function wrap(e, t, n, o) { return r.w(a(e), t, n, o && _reverseInstanceProperty(o).call(o)); }, isGeneratorFunction: n, mark: r.m, awrap: function awrap(r, e) { return new _OverloadYield(r, e); }, AsyncIterator: _regeneratorAsyncIterator, async: function async(r, e, t, o, u) { return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u); }, keys: _regeneratorKeys, values: _regeneratorValues }; })(); }
|
|
@@ -23,7 +24,7 @@ function _OverloadYield(e, d) { this.v = e, this.k = d; }
|
|
|
23
24
|
import React from 'react';
|
|
24
25
|
import userEvent from '@testing-library/user-event';
|
|
25
26
|
import statuses from '../../utils/devUtils/constants/statuses';
|
|
26
|
-
import { render, screen } from '../../utils/testUtils/testWrapper';
|
|
27
|
+
import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
|
27
28
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
|
28
29
|
import { universalFieldComponentTests } from '../../utils/testUtils/universalFormSubmitTest';
|
|
29
30
|
import CheckboxField from '.';
|
|
@@ -332,4 +333,85 @@ test('indeterminate checkbox, clicking svg', /*#__PURE__*/_asyncToGenerator(/*#_
|
|
|
332
333
|
return _context8.stop();
|
|
333
334
|
}
|
|
334
335
|
}, _callee8);
|
|
336
|
+
})));
|
|
337
|
+
test('controlled indeterminate checkbox retains focus and toggles correctly across keyboard Space presses', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
338
|
+
var onChange, IndeterminateParent, input, input2;
|
|
339
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
340
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
341
|
+
case 0:
|
|
342
|
+
onChange = jest.fn();
|
|
343
|
+
IndeterminateParent = function IndeterminateParent() {
|
|
344
|
+
var _React$useState = React.useState(true),
|
|
345
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
346
|
+
isIndeterminate = _React$useState2[0],
|
|
347
|
+
setIsIndeterminate = _React$useState2[1];
|
|
348
|
+
var _React$useState3 = React.useState(false),
|
|
349
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
350
|
+
isSelected = _React$useState4[0],
|
|
351
|
+
setIsSelected = _React$useState4[1];
|
|
352
|
+
var handleChange = function handleChange(selected) {
|
|
353
|
+
onChange(selected);
|
|
354
|
+
setIsIndeterminate(false);
|
|
355
|
+
setIsSelected(selected);
|
|
356
|
+
};
|
|
357
|
+
return ___EmotionJSX(CheckboxField, {
|
|
358
|
+
label: testLabel,
|
|
359
|
+
isIndeterminate: isIndeterminate,
|
|
360
|
+
isSelected: isSelected,
|
|
361
|
+
onChange: handleChange
|
|
362
|
+
});
|
|
363
|
+
};
|
|
364
|
+
render(___EmotionJSX(IndeterminateParent, null));
|
|
365
|
+
|
|
366
|
+
// Initial: indeterminate
|
|
367
|
+
expect(screen.getByRole('checkbox')).toHaveAttribute('aria-checked', 'mixed');
|
|
368
|
+
|
|
369
|
+
// First Space: focus the input, then simulate Space press
|
|
370
|
+
input = screen.getByRole('checkbox');
|
|
371
|
+
act(function () {
|
|
372
|
+
input.focus();
|
|
373
|
+
});
|
|
374
|
+
expect(input).toHaveFocus();
|
|
375
|
+
|
|
376
|
+
// Simulate keyboard Space: keydown triggers native change on checkbox, then keyup
|
|
377
|
+
fireEvent.keyDown(input, {
|
|
378
|
+
key: ' ',
|
|
379
|
+
code: 'Space',
|
|
380
|
+
charCode: 32
|
|
381
|
+
});
|
|
382
|
+
fireEvent.click(input); // keyboard Space on checkbox fires a click event in browsers
|
|
383
|
+
fireEvent.keyUp(input, {
|
|
384
|
+
key: ' ',
|
|
385
|
+
code: 'Space',
|
|
386
|
+
charCode: 32
|
|
387
|
+
});
|
|
388
|
+
expect(onChange).toHaveBeenNthCalledWith(1, true);
|
|
389
|
+
// Re-query after re-render: isIndeterminate=false now
|
|
390
|
+
expect(screen.getByRole('checkbox')).not.toHaveAttribute('aria-checked', 'mixed');
|
|
391
|
+
expect(screen.getByRole('checkbox')).toBeChecked();
|
|
392
|
+
|
|
393
|
+
// After the indeterminate->checked transition, the input should still have focus
|
|
394
|
+
// (the old IndeterminateCheckbox input was unmounted, so focus may be lost)
|
|
395
|
+
expect(screen.getByRole('checkbox')).toHaveFocus();
|
|
396
|
+
|
|
397
|
+
// Second Space: checked -> unchecked
|
|
398
|
+
input2 = screen.getByRole('checkbox');
|
|
399
|
+
fireEvent.keyDown(input2, {
|
|
400
|
+
key: ' ',
|
|
401
|
+
code: 'Space',
|
|
402
|
+
charCode: 32
|
|
403
|
+
});
|
|
404
|
+
fireEvent.click(input2);
|
|
405
|
+
fireEvent.keyUp(input2, {
|
|
406
|
+
key: ' ',
|
|
407
|
+
code: 'Space',
|
|
408
|
+
charCode: 32
|
|
409
|
+
});
|
|
410
|
+
expect(onChange).toHaveBeenNthCalledWith(2, false);
|
|
411
|
+
expect(screen.getByRole('checkbox')).not.toBeChecked();
|
|
412
|
+
case 20:
|
|
413
|
+
case "end":
|
|
414
|
+
return _context9.stop();
|
|
415
|
+
}
|
|
416
|
+
}, _callee9);
|
|
335
417
|
})));
|
|
@@ -83,16 +83,10 @@ var LinkSelectField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
83
83
|
variant: "forms.select.arrow"
|
|
84
84
|
}, ___EmotionJSX(Icon, _extends({
|
|
85
85
|
icon: MenuDown,
|
|
86
|
-
title: {
|
|
87
|
-
name: 'Menu Down Icon'
|
|
88
|
-
},
|
|
89
86
|
sx: _objectSpread(_objectSpread({}, state.isOpen ? {
|
|
90
87
|
transform: 'rotate(180deg)'
|
|
91
88
|
} : null), iconPropsSx)
|
|
92
89
|
}, restIconProps, {
|
|
93
|
-
title: {
|
|
94
|
-
name: ''
|
|
95
|
-
},
|
|
96
90
|
color: isOnyx ? 'font.link' : 'active',
|
|
97
91
|
size: linkSelectFieldIcon,
|
|
98
92
|
"aria-hidden": "true"
|
|
@@ -61,12 +61,14 @@ var Pagination = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
61
61
|
icon: ChevronLeftIcon,
|
|
62
62
|
title: {
|
|
63
63
|
name: 'Previous'
|
|
64
|
-
}
|
|
64
|
+
},
|
|
65
|
+
size: "md"
|
|
65
66
|
}, previousButtonIconProps))), ___EmotionJSX(IconButton, nextButtonProps, ___EmotionJSX(Icon, _extends({
|
|
66
67
|
icon: ChevronRightIcon,
|
|
67
68
|
title: {
|
|
68
69
|
name: 'Next'
|
|
69
|
-
}
|
|
70
|
+
},
|
|
71
|
+
size: "md"
|
|
70
72
|
}, nextButtonIconProps))))));
|
|
71
73
|
});
|
|
72
74
|
export default Pagination;
|
|
@@ -328,7 +328,10 @@ function TableColumnHeader(props) {
|
|
|
328
328
|
isRow: true,
|
|
329
329
|
gap: "sm",
|
|
330
330
|
alignItems: "center"
|
|
331
|
-
}, ___EmotionJSX(Text,
|
|
331
|
+
}, ___EmotionJSX(Text, {
|
|
332
|
+
as: "h4",
|
|
333
|
+
variant: "headText"
|
|
334
|
+
}, column.rendered), allowsSorting && sortIcon), allowsResizing && ___EmotionJSX(Resizer, {
|
|
332
335
|
column: column,
|
|
333
336
|
layoutState: layoutState,
|
|
334
337
|
onResizeStart: onResizeStart,
|
|
@@ -79,11 +79,11 @@ var objects = [{
|
|
|
79
79
|
total_grant: '75,000'
|
|
80
80
|
}];
|
|
81
81
|
var statusVariant = {
|
|
82
|
-
Pending: '
|
|
83
|
-
Failed: '
|
|
84
|
-
Rejected: '
|
|
85
|
-
Active: '
|
|
86
|
-
Inactive: '
|
|
82
|
+
Pending: 'tableBaseBadge.secondary',
|
|
83
|
+
Failed: 'tableBaseBadge.critical',
|
|
84
|
+
Rejected: 'tableBaseBadge.critical',
|
|
85
|
+
Active: 'tableBaseBadge.healthy',
|
|
86
|
+
Inactive: 'tableBaseBadge.secondary'
|
|
87
87
|
};
|
|
88
88
|
export var Default = function Default() {
|
|
89
89
|
return ___EmotionJSX(Card, {
|
|
@@ -246,11 +246,11 @@ export var DynamicWithSorting = function DynamicWithSorting() {
|
|
|
246
246
|
}, {
|
|
247
247
|
name: 'Population',
|
|
248
248
|
key: 'population',
|
|
249
|
-
isSortable:
|
|
249
|
+
isSortable: false
|
|
250
250
|
}, {
|
|
251
251
|
name: 'Continent',
|
|
252
252
|
key: 'continent',
|
|
253
|
-
isSortable:
|
|
253
|
+
isSortable: false
|
|
254
254
|
}];
|
|
255
255
|
var rows = [{
|
|
256
256
|
id: 1,
|
|
@@ -357,7 +357,7 @@ export var DynamicWithSorting = function DynamicWithSorting() {
|
|
|
357
357
|
}, function (column) {
|
|
358
358
|
return ___EmotionJSX(Column, {
|
|
359
359
|
minWidth: 155,
|
|
360
|
-
allowsSorting:
|
|
360
|
+
allowsSorting: column.isSortable
|
|
361
361
|
}, column.name);
|
|
362
362
|
}), ___EmotionJSX(TBody, {
|
|
363
363
|
items: list.items,
|
|
@@ -103,6 +103,42 @@ var itemBadgeWithSlot = _objectSpread(_objectSpread({}, selectedItemBadge), {},
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
|
+
var tableBaseBadgeSpanStyle = {
|
|
107
|
+
fontSize: '11.25px',
|
|
108
|
+
lineHeight: '1'
|
|
109
|
+
};
|
|
110
|
+
var tableBaseBadge = {
|
|
111
|
+
active: {
|
|
112
|
+
backgroundColor: "".concat(astroTokensDark.color.blue[500], " !important"),
|
|
113
|
+
'& > span': _objectSpread(_objectSpread({}, tableBaseBadgeSpanStyle), {}, {
|
|
114
|
+
color: astroTokensDark.color.black
|
|
115
|
+
})
|
|
116
|
+
},
|
|
117
|
+
warning: {
|
|
118
|
+
backgroundColor: "".concat(astroTokensDark.color.yellow[500], " !important"),
|
|
119
|
+
'& > span': _objectSpread(_objectSpread({}, tableBaseBadgeSpanStyle), {}, {
|
|
120
|
+
color: astroTokensDark.color.black
|
|
121
|
+
})
|
|
122
|
+
},
|
|
123
|
+
critical: {
|
|
124
|
+
backgroundColor: "".concat(astroTokensDark.color.red[500], " !important"),
|
|
125
|
+
'& > span': _objectSpread(_objectSpread({}, tableBaseBadgeSpanStyle), {}, {
|
|
126
|
+
color: astroTokensDark.color.black
|
|
127
|
+
})
|
|
128
|
+
},
|
|
129
|
+
healthy: {
|
|
130
|
+
backgroundColor: "".concat(astroTokensDark.color.green[500], " !important"),
|
|
131
|
+
'& > span': _objectSpread(_objectSpread({}, tableBaseBadgeSpanStyle), {}, {
|
|
132
|
+
color: astroTokensDark.color.black
|
|
133
|
+
})
|
|
134
|
+
},
|
|
135
|
+
secondary: {
|
|
136
|
+
backgroundColor: "".concat(astroTokensDark.color.gray[500], " !important"),
|
|
137
|
+
'& > span': _objectSpread(_objectSpread({}, tableBaseBadgeSpanStyle), {}, {
|
|
138
|
+
color: astroTokensDark.color.black
|
|
139
|
+
})
|
|
140
|
+
}
|
|
141
|
+
};
|
|
106
142
|
var badges = {
|
|
107
143
|
baseBadge: baseBadge,
|
|
108
144
|
primary: primary,
|
|
@@ -147,6 +183,7 @@ var badges = {
|
|
|
147
183
|
'& span': {
|
|
148
184
|
color: 'font.base'
|
|
149
185
|
}
|
|
150
|
-
}
|
|
186
|
+
},
|
|
187
|
+
tableBaseBadge: tableBaseBadge
|
|
151
188
|
};
|
|
152
189
|
export default badges;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { astroTokensDark } from '@pingux/onyx-tokens';
|
|
1
2
|
var cards = {
|
|
2
3
|
dark: {
|
|
3
4
|
border: '1px solid',
|
|
@@ -24,6 +25,9 @@ var cards = {
|
|
|
24
25
|
},
|
|
25
26
|
activeCard: {
|
|
26
27
|
borderColor: 'border.attachment'
|
|
28
|
+
},
|
|
29
|
+
tableWrapper: {
|
|
30
|
+
borderColor: astroTokensDark.color.common.border
|
|
27
31
|
}
|
|
28
32
|
};
|
|
29
33
|
export default cards;
|