@pingux/astro 2.193.1-alpha.0 → 2.194.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/ComboBoxField/ComboBoxField.js +6 -1
- package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +98 -7
- package/lib/cjs/index.d.ts +3 -0
- package/lib/cjs/index.js +24 -0
- package/lib/cjs/recipes/CountryPicker.stories.js +0 -1
- package/lib/cjs/styles/themeOverrides/onyxDarkUiLibraryOverride.js +211 -0
- package/lib/cjs/styles/themeOverrides/onyxUiLibraryOverride.d.ts +130 -0
- package/lib/cjs/styles/themeOverrides/onyxUiLibraryOverride.js +217 -0
- package/lib/components/ComboBoxField/ComboBoxField.js +6 -1
- package/lib/components/ComboBoxField/ComboBoxField.test.js +98 -7
- package/lib/index.js +3 -0
- package/lib/recipes/CountryPicker.stories.js +0 -1
- package/lib/styles/themeOverrides/onyxDarkUiLibraryOverride.js +204 -0
- package/lib/styles/themeOverrides/onyxUiLibraryOverride.js +210 -0
- package/package.json +1 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
4
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
5
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
6
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
7
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
8
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
9
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
10
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
11
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
12
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
13
|
+
value: true
|
|
14
|
+
});
|
|
15
|
+
exports["default"] = void 0;
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
17
|
+
var _onyxTokens = require("@pingux/onyx-tokens");
|
|
18
|
+
var _nextGen = _interopRequireDefault(require("../themes/next-gen"));
|
|
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; }
|
|
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; }
|
|
21
|
+
var buttons = {
|
|
22
|
+
critical: {
|
|
23
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, _nextGen["default"].buttons.critical), _nextGen["default"].buttons.defaultHover)
|
|
24
|
+
},
|
|
25
|
+
danger: {
|
|
26
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, _nextGen["default"].buttons.danger), _nextGen["default"].buttons.defaultHover)
|
|
27
|
+
},
|
|
28
|
+
success: {
|
|
29
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, _nextGen["default"].buttons.success), _nextGen["default"].buttons.defaultHover)
|
|
30
|
+
},
|
|
31
|
+
"default": {
|
|
32
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, _nextGen["default"].buttons["default"]), _nextGen["default"].buttons.defaultHover),
|
|
33
|
+
'&:focus': _objectSpread({}, _nextGen["default"].buttons.defaultHover)
|
|
34
|
+
},
|
|
35
|
+
inline: {
|
|
36
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, _nextGen["default"].buttons.inline), _nextGen["default"].buttons.defaultHover)
|
|
37
|
+
},
|
|
38
|
+
inlinePrimary: {
|
|
39
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, _nextGen["default"].buttons.inlinePrimary), _nextGen["default"].buttons.defaultHover)
|
|
40
|
+
},
|
|
41
|
+
text: {
|
|
42
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, _nextGen["default"].buttons.text), _nextGen["default"].buttons.defaultHover)
|
|
43
|
+
},
|
|
44
|
+
inverted: _objectSpread(_objectSpread({}, _nextGen["default"].buttons.inverted), {}, {
|
|
45
|
+
':focus': {
|
|
46
|
+
border: 'none'
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
primary: {
|
|
50
|
+
'&:hover': _objectSpread({}, _nextGen["default"].buttons.primary)
|
|
51
|
+
},
|
|
52
|
+
link: {
|
|
53
|
+
'body &': _nextGen["default"].buttons.link,
|
|
54
|
+
'body &:hover': _nextGen["default"].buttons.link,
|
|
55
|
+
'&:not(.disabled):hover': {
|
|
56
|
+
color: 'active',
|
|
57
|
+
borderColor: 'transparent'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
iconButtons: _objectSpread(_objectSpread({}, _nextGen["default"].buttons.iconButtons), {}, {
|
|
61
|
+
base: _objectSpread(_objectSpread({}, _nextGen["default"].buttons.iconButtons.base), {}, {
|
|
62
|
+
':focus': _objectSpread(_objectSpread({}, _nextGen["default"].buttons.defaultFocus), {}, {
|
|
63
|
+
border: 'none'
|
|
64
|
+
})
|
|
65
|
+
}),
|
|
66
|
+
inverted: _objectSpread(_objectSpread({}, _nextGen["default"].buttons.iconButtons.inverted), {}, {
|
|
67
|
+
':focus': {
|
|
68
|
+
border: 'none'
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
datePicker: {
|
|
72
|
+
containedIcon: {
|
|
73
|
+
'&:not(.disabled):hover': {
|
|
74
|
+
border: 'none'
|
|
75
|
+
},
|
|
76
|
+
'&:focus': {
|
|
77
|
+
border: 'none'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}),
|
|
82
|
+
// not sure what this references/
|
|
83
|
+
filter: {
|
|
84
|
+
'&:not(.disabled):hover': {
|
|
85
|
+
borderColor: 'accent.40',
|
|
86
|
+
color: 'accent.40'
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var forms = {
|
|
91
|
+
input: {
|
|
92
|
+
'&[type=password]': {
|
|
93
|
+
backgroundColor: 'white !important',
|
|
94
|
+
borderColor: '#caced3 !important'
|
|
95
|
+
},
|
|
96
|
+
'&[type=password]:focus': {
|
|
97
|
+
borderColor: "".concat(_onyxTokens.astroTokens.color.blue[500], " !important")
|
|
98
|
+
},
|
|
99
|
+
numberField: _objectSpread(_objectSpread(_objectSpread({}, _nextGen["default"].input), _nextGen["default"].numberFieldStyles), {}, {
|
|
100
|
+
'&[type=text]': _objectSpread(_objectSpread({}, _nextGen["default"].text.inputValue), {}, {
|
|
101
|
+
backgroundColor: 'white',
|
|
102
|
+
borderColor: _onyxTokens.astroTokens.color.input.border
|
|
103
|
+
}),
|
|
104
|
+
'&[type=text]:focus': {
|
|
105
|
+
outline: '1px solid',
|
|
106
|
+
outlineColor: "".concat(_onyxTokens.astroTokens.color.blue[500]),
|
|
107
|
+
outlineOffset: '0px',
|
|
108
|
+
borderColor: "".concat(_onyxTokens.astroTokens.color.blue[500], " !important")
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
},
|
|
112
|
+
select: {
|
|
113
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, _nextGen["default"].text.inputValue), {}, {
|
|
114
|
+
borderColor: _onyxTokens.astroTokens.color.input.border
|
|
115
|
+
})
|
|
116
|
+
},
|
|
117
|
+
search: {
|
|
118
|
+
wrapper: {
|
|
119
|
+
'& input[type=search]': _objectSpread(_objectSpread({}, _nextGen["default"].text.inputValue), {}, {
|
|
120
|
+
borderColor: _onyxTokens.astroTokens.color.input.border,
|
|
121
|
+
fontSize: '15px',
|
|
122
|
+
bg: 'white',
|
|
123
|
+
'::placeholder': _objectSpread(_objectSpread({}, _nextGen["default"].text.placeholder), {}, {
|
|
124
|
+
fontStyle: 'unset',
|
|
125
|
+
fontSize: '15px'
|
|
126
|
+
})
|
|
127
|
+
}),
|
|
128
|
+
'& input[type=search]:focus': {
|
|
129
|
+
outline: '1px solid',
|
|
130
|
+
outlineColor: _onyxTokens.astroTokens.color.blue[500],
|
|
131
|
+
outlineOffset: '0px',
|
|
132
|
+
borderColor: "".concat(_onyxTokens.astroTokens.color.blue[500], " !important")
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
label: {
|
|
137
|
+
'body &': {
|
|
138
|
+
textTransform: 'none'
|
|
139
|
+
},
|
|
140
|
+
checkbox: {
|
|
141
|
+
textTransform: 'none'
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
var links = {
|
|
146
|
+
app: {
|
|
147
|
+
'&:hover': _objectSpread({}, _nextGen["default"].links.app)
|
|
148
|
+
},
|
|
149
|
+
skip: {
|
|
150
|
+
'&:hover': {
|
|
151
|
+
color: 'white',
|
|
152
|
+
textDecoration: 'none',
|
|
153
|
+
'&:focus': {
|
|
154
|
+
outline: '2px solid',
|
|
155
|
+
outlineColor: 'active',
|
|
156
|
+
color: 'white',
|
|
157
|
+
textDecoration: 'none'
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
'&:visited': {
|
|
161
|
+
color: 'white',
|
|
162
|
+
textDecoration: 'none'
|
|
163
|
+
},
|
|
164
|
+
'&.is-pressed': {
|
|
165
|
+
color: 'white',
|
|
166
|
+
textDecoration: 'none'
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
pingLogo: {
|
|
170
|
+
'&:hover': {
|
|
171
|
+
'&.is-focused': {
|
|
172
|
+
outline: '2px solid',
|
|
173
|
+
outlineColor: 'active',
|
|
174
|
+
outlineOffset: '-2px'
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
var variants = {
|
|
180
|
+
accordion: {
|
|
181
|
+
header: _objectSpread(_objectSpread({}, _nextGen["default"].variants.accordion.header), {}, {
|
|
182
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, _nextGen["default"].buttons.defaultHover), {}, {
|
|
183
|
+
color: 'active'
|
|
184
|
+
}),
|
|
185
|
+
'&:focus': _objectSpread(_objectSpread({}, _nextGen["default"].buttons.defaultFocus), {}, {
|
|
186
|
+
border: 'none'
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
},
|
|
190
|
+
rockerButton: {
|
|
191
|
+
thumbSwitch: _objectSpread(_objectSpread({}, _nextGen["default"].variants.rockerButton.thumbSwitch), {}, {
|
|
192
|
+
':focus': {
|
|
193
|
+
border: 'none'
|
|
194
|
+
},
|
|
195
|
+
'&.is-selected:hover': {
|
|
196
|
+
color: 'black'
|
|
197
|
+
},
|
|
198
|
+
':not(.is-selected):hover': {
|
|
199
|
+
color: 'black'
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
},
|
|
203
|
+
environmentBreadcrumb: {
|
|
204
|
+
button: {
|
|
205
|
+
current: {
|
|
206
|
+
'&:hover:not(.disabled)': _objectSpread({}, _nextGen["default"].variants.environmentBreadcrumb.button.current),
|
|
207
|
+
'&:focus': _objectSpread({}, _nextGen["default"].variants.environmentBreadcrumb.button.current)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
var _default = exports["default"] = {
|
|
213
|
+
buttons: buttons,
|
|
214
|
+
forms: forms,
|
|
215
|
+
links: links,
|
|
216
|
+
variants: variants
|
|
217
|
+
};
|
|
@@ -177,7 +177,12 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
177
177
|
ref: inputWrapperRef,
|
|
178
178
|
onResize: onResize
|
|
179
179
|
});
|
|
180
|
-
|
|
180
|
+
|
|
181
|
+
// Re-measure synchronously (before paint) whenever the menu opens or closes,
|
|
182
|
+
// so the Popover renders with the correct width on the first frame.
|
|
183
|
+
// Without state.isOpen in deps, width updates rely solely on ResizeObserver
|
|
184
|
+
// which fires asynchronously after paint, causing a visible flicker.
|
|
185
|
+
useLayoutEffect(onResize, [onResize, state.isOpen]);
|
|
181
186
|
var style = _objectSpread(_objectSpread({}, overlayProps.style), {}, {
|
|
182
187
|
width: menuWidth,
|
|
183
188
|
minWidth: menuWidth
|
|
@@ -19,7 +19,7 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerat
|
|
|
19
19
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
20
20
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
21
21
|
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; }
|
|
22
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context39, _context40; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context39 = ownKeys(Object(t), !0)).call(_context39, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context40 = ownKeys(Object(t))).call(_context40, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
23
|
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 }; })(); }
|
|
24
24
|
function _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof _Symbol && _Symbol$iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); }
|
|
25
25
|
function _regeneratorKeys(e) { var n = Object(e), r = []; for (var t in n) r.unshift(t); return function e() { for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e; return e.done = !0, e; }; }
|
|
@@ -1575,6 +1575,97 @@ test('a blank title does not render', /*#__PURE__*/_asyncToGenerator(/*#__PURE__
|
|
|
1575
1575
|
}
|
|
1576
1576
|
}, _callee33);
|
|
1577
1577
|
})));
|
|
1578
|
+
test('popover width re-measures when the menu opens to prevent flickering', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
1579
|
+
var mockWidth, offsetWidthSpy, button, listbox, popoverContainer;
|
|
1580
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context36) {
|
|
1581
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1582
|
+
case 0:
|
|
1583
|
+
// Simulate a scenario like the Country Picker recipe where the input wrapper
|
|
1584
|
+
// starts narrow (110px) and expands to full width when the menu opens.
|
|
1585
|
+
mockWidth = 110;
|
|
1586
|
+
offsetWidthSpy = jest.spyOn(window.HTMLElement.prototype, 'offsetWidth', 'get').mockImplementation(function () {
|
|
1587
|
+
return mockWidth;
|
|
1588
|
+
});
|
|
1589
|
+
getComponent();
|
|
1590
|
+
|
|
1591
|
+
// Simulate the wrapper expanding before the menu opens
|
|
1592
|
+
// (e.g., parent CSS changes from width: 110px to width: 100%)
|
|
1593
|
+
mockWidth = 500;
|
|
1594
|
+
button = screen.queryByRole('button');
|
|
1595
|
+
_context36.next = 7;
|
|
1596
|
+
return userEvent.click(button);
|
|
1597
|
+
case 7:
|
|
1598
|
+
_context36.next = 9;
|
|
1599
|
+
return findListbox();
|
|
1600
|
+
case 9:
|
|
1601
|
+
listbox = _context36.sent;
|
|
1602
|
+
// The popover container receives the inline style with width/minWidth.
|
|
1603
|
+
// Without the fix, menuWidth would be stale (110) because useLayoutEffect
|
|
1604
|
+
// only ran on mount. With the fix, it re-measures on state.isOpen change.
|
|
1605
|
+
popoverContainer = listbox.closest('[role="presentation"]');
|
|
1606
|
+
expect(popoverContainer).toHaveStyle({
|
|
1607
|
+
width: '500px',
|
|
1608
|
+
'min-width': '500px'
|
|
1609
|
+
});
|
|
1610
|
+
offsetWidthSpy.mockRestore();
|
|
1611
|
+
case 13:
|
|
1612
|
+
case "end":
|
|
1613
|
+
return _context36.stop();
|
|
1614
|
+
}
|
|
1615
|
+
}, _callee34);
|
|
1616
|
+
})));
|
|
1617
|
+
test('popover width stays in sync when closing and reopening at different widths', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
1618
|
+
var mockWidth, offsetWidthSpy, button, listbox, popoverContainer;
|
|
1619
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context37) {
|
|
1620
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1621
|
+
case 0:
|
|
1622
|
+
mockWidth = 500;
|
|
1623
|
+
offsetWidthSpy = jest.spyOn(window.HTMLElement.prototype, 'offsetWidth', 'get').mockImplementation(function () {
|
|
1624
|
+
return mockWidth;
|
|
1625
|
+
});
|
|
1626
|
+
getComponent();
|
|
1627
|
+
button = screen.queryByRole('button'); // Open the menu at 500px
|
|
1628
|
+
_context37.next = 6;
|
|
1629
|
+
return userEvent.click(button);
|
|
1630
|
+
case 6:
|
|
1631
|
+
_context37.next = 8;
|
|
1632
|
+
return findListbox();
|
|
1633
|
+
case 8:
|
|
1634
|
+
listbox = _context37.sent;
|
|
1635
|
+
popoverContainer = listbox.closest('[role="presentation"]');
|
|
1636
|
+
expect(popoverContainer).toHaveStyle({
|
|
1637
|
+
width: '500px'
|
|
1638
|
+
});
|
|
1639
|
+
|
|
1640
|
+
// Close the menu
|
|
1641
|
+
_context37.next = 13;
|
|
1642
|
+
return userEvent.click(button);
|
|
1643
|
+
case 13:
|
|
1644
|
+
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
|
1645
|
+
|
|
1646
|
+
// Simulate wrapper shrinking back
|
|
1647
|
+
mockWidth = 300;
|
|
1648
|
+
|
|
1649
|
+
// Reopen — width should reflect the new measurement
|
|
1650
|
+
_context37.next = 17;
|
|
1651
|
+
return userEvent.click(button);
|
|
1652
|
+
case 17:
|
|
1653
|
+
_context37.next = 19;
|
|
1654
|
+
return findListbox();
|
|
1655
|
+
case 19:
|
|
1656
|
+
listbox = _context37.sent;
|
|
1657
|
+
popoverContainer = listbox.closest('[role="presentation"]');
|
|
1658
|
+
expect(popoverContainer).toHaveStyle({
|
|
1659
|
+
width: '300px',
|
|
1660
|
+
'min-width': '300px'
|
|
1661
|
+
});
|
|
1662
|
+
offsetWidthSpy.mockRestore();
|
|
1663
|
+
case 23:
|
|
1664
|
+
case "end":
|
|
1665
|
+
return _context37.stop();
|
|
1666
|
+
}
|
|
1667
|
+
}, _callee35);
|
|
1668
|
+
})));
|
|
1578
1669
|
describe('when isReadOnly is true', function () {
|
|
1579
1670
|
var testProp = {
|
|
1580
1671
|
isReadOnly: true
|
|
@@ -1599,12 +1690,12 @@ describe('when isReadOnly is true', function () {
|
|
|
1599
1690
|
name: defaultProps.label
|
|
1600
1691
|
})).toHaveValue(TEST_DEFAULT_INPUT_VALUE);
|
|
1601
1692
|
});
|
|
1602
|
-
test('the dropdown does not open when clicked', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1603
|
-
return _regeneratorRuntime().wrap(function
|
|
1604
|
-
while (1) switch (
|
|
1693
|
+
test('the dropdown does not open when clicked', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
1694
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context38) {
|
|
1695
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1605
1696
|
case 0:
|
|
1606
1697
|
getComponent(testProp);
|
|
1607
|
-
|
|
1698
|
+
_context38.next = 3;
|
|
1608
1699
|
return userEvent.click(screen.getByRole('combobox', {
|
|
1609
1700
|
name: defaultProps.label
|
|
1610
1701
|
}));
|
|
@@ -1614,9 +1705,9 @@ describe('when isReadOnly is true', function () {
|
|
|
1614
1705
|
})).not.toBeInTheDocument();
|
|
1615
1706
|
case 4:
|
|
1616
1707
|
case "end":
|
|
1617
|
-
return
|
|
1708
|
+
return _context38.stop();
|
|
1618
1709
|
}
|
|
1619
|
-
},
|
|
1710
|
+
}, _callee36);
|
|
1620
1711
|
})));
|
|
1621
1712
|
});
|
|
1622
1713
|
universalComponentTests({
|
package/lib/index.js
CHANGED
|
@@ -229,7 +229,10 @@ export * from './components/TreeView';
|
|
|
229
229
|
export { PaginationContext } from './context/PaginationContext';
|
|
230
230
|
export { default as NextGenDarkTheme } from './styles/themeOverrides/nextGenDarkMode';
|
|
231
231
|
export { default as OnyxDarkTheme } from './styles/themeOverrides/nextGenDarkMode';
|
|
232
|
+
export { default as OnyxDarkUiLibraryOverride } from './styles/themeOverrides/onyxDarkUiLibraryOverride';
|
|
232
233
|
export { default as OnyxSideNavOverride } from './styles/themeOverrides/onyxSideNav';
|
|
234
|
+
export { default as OnyxUiLibraryOverride } from './styles/themeOverrides/onyxUiLibraryOverride';
|
|
235
|
+
export { default as AstroUiLibraryOverride } from './styles/themeOverrides/uiLibraryOverride';
|
|
233
236
|
export { default as NextGenTheme } from './styles/themes/next-gen';
|
|
234
237
|
export { default as OnyxTheme } from './styles/themes/next-gen';
|
|
235
238
|
export * from './types';
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
import { astroTokens, astroTokensDark } from '@pingux/onyx-tokens';
|
|
13
|
+
import theme from './nextGenDarkMode';
|
|
14
|
+
var buttons = {
|
|
15
|
+
critical: {
|
|
16
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, theme.buttons.critical), theme.buttons.defaultHover)
|
|
17
|
+
},
|
|
18
|
+
danger: {
|
|
19
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, theme.buttons.danger), theme.buttons.defaultHover)
|
|
20
|
+
},
|
|
21
|
+
success: {
|
|
22
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, theme.buttons.success), theme.buttons.defaultHover)
|
|
23
|
+
},
|
|
24
|
+
"default": {
|
|
25
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, theme.buttons["default"]), theme.buttons.defaultHover),
|
|
26
|
+
'&:focus': _objectSpread({}, theme.buttons.defaultHover)
|
|
27
|
+
},
|
|
28
|
+
inline: {
|
|
29
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, theme.buttons.inline), theme.buttons.defaultHover)
|
|
30
|
+
},
|
|
31
|
+
inlinePrimary: {
|
|
32
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, theme.buttons.inlinePrimary), theme.buttons.defaultHover)
|
|
33
|
+
},
|
|
34
|
+
text: {
|
|
35
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, theme.buttons.text), theme.buttons.defaultHover)
|
|
36
|
+
},
|
|
37
|
+
inverted: _objectSpread(_objectSpread({}, theme.buttons.inverted), {}, {
|
|
38
|
+
':focus': {
|
|
39
|
+
border: 'none'
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
primary: {
|
|
43
|
+
'&:hover': _objectSpread({}, theme.buttons.primary)
|
|
44
|
+
},
|
|
45
|
+
link: {
|
|
46
|
+
'body &': theme.buttons.link,
|
|
47
|
+
'body &:hover': theme.buttons.link,
|
|
48
|
+
'&:not(.disabled):hover': {
|
|
49
|
+
color: 'active',
|
|
50
|
+
borderColor: 'transparent'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
iconButtons: _objectSpread(_objectSpread({}, theme.buttons.iconButtons), {}, {
|
|
54
|
+
base: _objectSpread(_objectSpread({}, theme.buttons.iconButtons.base), {}, {
|
|
55
|
+
':focus': _objectSpread(_objectSpread({}, theme.buttons.defaultFocus), {}, {
|
|
56
|
+
border: 'none'
|
|
57
|
+
})
|
|
58
|
+
}),
|
|
59
|
+
inverted: _objectSpread(_objectSpread({}, theme.buttons.iconButtons.inverted), {}, {
|
|
60
|
+
':focus': {
|
|
61
|
+
border: 'none'
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
datePicker: {
|
|
65
|
+
containedIcon: {
|
|
66
|
+
'&:not(.disabled):hover': {
|
|
67
|
+
border: 'none'
|
|
68
|
+
},
|
|
69
|
+
'&:focus': {
|
|
70
|
+
border: 'none'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}),
|
|
75
|
+
// not sure what this references
|
|
76
|
+
filter: {
|
|
77
|
+
'&:not(.disabled):hover': {
|
|
78
|
+
borderColor: 'accent.40',
|
|
79
|
+
color: 'accent.40'
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var forms = {
|
|
84
|
+
input: {
|
|
85
|
+
'&[type=password]': {
|
|
86
|
+
backgroundColor: 'white !important',
|
|
87
|
+
borderColor: '#caced3 !important'
|
|
88
|
+
},
|
|
89
|
+
'&[type=password]:focus': {
|
|
90
|
+
borderColor: "".concat(astroTokens.color.blue[500], " !important")
|
|
91
|
+
},
|
|
92
|
+
numberField: _objectSpread(_objectSpread(_objectSpread({}, theme.input), theme.numberFieldStyles), {}, {
|
|
93
|
+
'&[type=text]': _objectSpread(_objectSpread({}, theme.text.inputValue), {}, {
|
|
94
|
+
backgroundColor: 'white',
|
|
95
|
+
borderColor: astroTokensDark.color.gray[500]
|
|
96
|
+
}),
|
|
97
|
+
'&[type=text]:focus': {
|
|
98
|
+
borderColor: "".concat(astroTokens.color.blue[500], " !important")
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
},
|
|
102
|
+
select: {
|
|
103
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, theme.text.inputValue), {}, {
|
|
104
|
+
borderColor: astroTokensDark.color.gray[500]
|
|
105
|
+
})
|
|
106
|
+
},
|
|
107
|
+
search: {
|
|
108
|
+
wrapper: {
|
|
109
|
+
'& input[type=search]': _objectSpread(_objectSpread({}, theme.text.inputValue), {}, {
|
|
110
|
+
borderColor: astroTokensDark.color.gray[500],
|
|
111
|
+
fontSize: '15px',
|
|
112
|
+
bg: 'white',
|
|
113
|
+
'::placeholder': _objectSpread(_objectSpread({}, theme.text.placeholder), {}, {
|
|
114
|
+
fontStyle: 'unset',
|
|
115
|
+
fontSize: '15px'
|
|
116
|
+
})
|
|
117
|
+
}),
|
|
118
|
+
'& input[type=search]:focus': {
|
|
119
|
+
borderColor: "".concat(astroTokens.color.blue[500], " !important")
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
label: {
|
|
124
|
+
'body &': {
|
|
125
|
+
textTransform: 'none'
|
|
126
|
+
},
|
|
127
|
+
checkbox: {
|
|
128
|
+
textTransform: 'none'
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
var links = {
|
|
133
|
+
app: {
|
|
134
|
+
'&:hover': _objectSpread({}, theme.links.app)
|
|
135
|
+
},
|
|
136
|
+
skip: {
|
|
137
|
+
'&:hover': {
|
|
138
|
+
color: 'white',
|
|
139
|
+
textDecoration: 'none',
|
|
140
|
+
'&:focus': {
|
|
141
|
+
outline: '2px solid',
|
|
142
|
+
outlineColor: 'active',
|
|
143
|
+
color: 'white',
|
|
144
|
+
textDecoration: 'none'
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
'&:visited': {
|
|
148
|
+
color: 'white',
|
|
149
|
+
textDecoration: 'none'
|
|
150
|
+
},
|
|
151
|
+
'&.is-pressed': {
|
|
152
|
+
color: 'white',
|
|
153
|
+
textDecoration: 'none'
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
pingLogo: {
|
|
157
|
+
'&:hover': {
|
|
158
|
+
'&.is-focused': {
|
|
159
|
+
outline: '2px solid',
|
|
160
|
+
outlineColor: 'active',
|
|
161
|
+
outlineOffset: '-2px'
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
var variants = {
|
|
167
|
+
accordion: {
|
|
168
|
+
header: _objectSpread(_objectSpread({}, theme.variants.accordion.header), {}, {
|
|
169
|
+
'&:not(.disabled):hover': _objectSpread(_objectSpread({}, theme.buttons.defaultHover), {}, {
|
|
170
|
+
color: 'active'
|
|
171
|
+
}),
|
|
172
|
+
'&:focus': _objectSpread(_objectSpread({}, theme.buttons.defaultFocus), {}, {
|
|
173
|
+
border: 'none'
|
|
174
|
+
})
|
|
175
|
+
})
|
|
176
|
+
},
|
|
177
|
+
rockerButton: {
|
|
178
|
+
thumbSwitch: _objectSpread(_objectSpread({}, theme.variants.rockerButton.thumbSwitch), {}, {
|
|
179
|
+
':focus': {
|
|
180
|
+
border: 'none'
|
|
181
|
+
},
|
|
182
|
+
'&.is-selected:hover': {
|
|
183
|
+
color: 'white'
|
|
184
|
+
},
|
|
185
|
+
':not(.is-selected):hover': {
|
|
186
|
+
color: 'white'
|
|
187
|
+
}
|
|
188
|
+
})
|
|
189
|
+
},
|
|
190
|
+
environmentBreadcrumb: {
|
|
191
|
+
button: {
|
|
192
|
+
current: {
|
|
193
|
+
'&:hover:not(.disabled)': _objectSpread({}, theme.variants.environmentBreadcrumb.button.current),
|
|
194
|
+
'&:focus': _objectSpread({}, theme.variants.environmentBreadcrumb.button.current)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
export default {
|
|
200
|
+
buttons: buttons,
|
|
201
|
+
forms: forms,
|
|
202
|
+
links: links,
|
|
203
|
+
variants: variants
|
|
204
|
+
};
|