@pingux/astro 2.121.1-alpha.3 → 2.122.0-alpha.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/lib/cjs/components/CodeEditor/CodeEditor.d.ts +4 -0
- package/lib/cjs/components/CodeEditor/CodeEditor.js +55 -0
- package/lib/cjs/components/CodeEditor/CodeEditor.mdx +35 -0
- package/lib/cjs/components/CodeEditor/CodeEditor.stories.d.ts +27 -0
- package/lib/cjs/components/CodeEditor/CodeEditor.stories.js +66 -0
- package/lib/cjs/components/CodeEditor/CodeEditor.styles.d.ts +10 -0
- package/lib/cjs/components/CodeEditor/CodeEditor.styles.js +30 -0
- package/lib/cjs/components/CodeEditor/CodeEditor.test.d.ts +1 -0
- package/lib/cjs/components/CodeEditor/CodeEditor.test.js +82 -0
- package/lib/cjs/components/CodeEditor/index.d.ts +1 -0
- package/lib/cjs/components/CodeEditor/index.js +14 -0
- package/lib/cjs/components/CodeView/CodeView.mdx +4 -1
- package/lib/cjs/components/PopoverMenu/PopoverMenu.styles.js +6 -6
- package/lib/cjs/components/TooltipTrigger/TooltipTrigger.js +7 -3
- package/lib/cjs/components/TooltipTrigger/TooltipTrigger.test.js +34 -3
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +8 -0
- package/lib/cjs/styles/colors.d.ts +2 -0
- package/lib/cjs/styles/colors.js +3 -1
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.d.ts +2 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +2 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +5 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +6 -0
- package/lib/cjs/styles/themes/next-gen/colors/colors.d.ts +1 -0
- package/lib/cjs/styles/themes/next-gen/colors/colors.js +3 -1
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +26 -0
- package/lib/cjs/styles/themes/next-gen/variants/popoverMenu.d.ts +19 -0
- package/lib/cjs/styles/themes/next-gen/variants/popoverMenu.js +28 -0
- package/lib/cjs/styles/themes/next-gen/variants/tooltip.d.ts +8 -0
- package/lib/cjs/styles/themes/next-gen/variants/tooltip.js +16 -0
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +25 -0
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +4 -0
- package/lib/cjs/styles/variants/variants.js +2 -0
- package/lib/cjs/types/codeEditor.d.ts +15 -0
- package/lib/cjs/types/codeEditor.js +6 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +60 -49
- package/lib/components/CodeEditor/CodeEditor.js +41 -0
- package/lib/components/CodeEditor/CodeEditor.mdx +35 -0
- package/lib/components/CodeEditor/CodeEditor.stories.js +54 -0
- package/lib/components/CodeEditor/CodeEditor.styles.js +22 -0
- package/lib/components/CodeEditor/CodeEditor.test.js +79 -0
- package/lib/components/CodeEditor/index.js +1 -0
- package/lib/components/CodeView/CodeView.mdx +4 -1
- package/lib/components/PopoverMenu/PopoverMenu.styles.js +6 -6
- package/lib/components/TooltipTrigger/TooltipTrigger.js +8 -4
- package/lib/components/TooltipTrigger/TooltipTrigger.test.js +35 -4
- package/lib/index.js +1 -0
- package/lib/styles/colors.js +3 -1
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +2 -0
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +6 -0
- package/lib/styles/themes/next-gen/colors/colors.js +3 -1
- package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/styles/themes/next-gen/variants/popoverMenu.js +20 -0
- package/lib/styles/themes/next-gen/variants/tooltip.js +8 -0
- package/lib/styles/themes/next-gen/variants/variants.js +4 -0
- package/lib/styles/variants/variants.js +2 -0
- package/lib/types/codeEditor.js +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +3 -1
@@ -0,0 +1,79 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
3
|
+
import _JSON$stringify from "@babel/runtime-corejs3/core-js-stable/json/stringify";
|
4
|
+
import React from 'react';
|
5
|
+
import { CodeEditor } from '../../index';
|
6
|
+
import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
7
|
+
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
8
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
9
|
+
var testId = 'test-code-sample';
|
10
|
+
var defaultProps = {
|
11
|
+
'data-testid': testId
|
12
|
+
};
|
13
|
+
var jsCode = "\n function helloWorld() {\n console.log(\"Hello, World!\");\n }\n";
|
14
|
+
|
15
|
+
// Needs to be added to each components test file
|
16
|
+
universalComponentTests({
|
17
|
+
rules: {
|
18
|
+
'color-contrast': {
|
19
|
+
enabled: false
|
20
|
+
}
|
21
|
+
},
|
22
|
+
renderComponent: function renderComponent(props) {
|
23
|
+
return ___EmotionJSX(CodeEditor, _extends({}, defaultProps, props, {
|
24
|
+
value: jsCode,
|
25
|
+
language: "javascript"
|
26
|
+
}));
|
27
|
+
}
|
28
|
+
});
|
29
|
+
jest.mock('@monaco-editor/react', function () {
|
30
|
+
return {
|
31
|
+
__esModule: true,
|
32
|
+
"default": function _default(_ref) {
|
33
|
+
var _context;
|
34
|
+
var language = _ref.language,
|
35
|
+
value = _ref.value,
|
36
|
+
_onChange = _ref.onChange;
|
37
|
+
return ___EmotionJSX("textarea", {
|
38
|
+
"data-testid": "mock-monaco-editor",
|
39
|
+
onChange: function onChange(e) {
|
40
|
+
return _onChange(e.target.value);
|
41
|
+
},
|
42
|
+
value: _concatInstanceProperty(_context = "Editor Language: ".concat(language, ", Code:")).call(_context, value),
|
43
|
+
"aria-label": "Code editor"
|
44
|
+
});
|
45
|
+
}
|
46
|
+
};
|
47
|
+
});
|
48
|
+
describe('CodeEditor', function () {
|
49
|
+
it('renders with initial value', function () {
|
50
|
+
var value = 'console.log("Hello, World!");';
|
51
|
+
render(___EmotionJSX(CodeEditor, {
|
52
|
+
language: "javascript",
|
53
|
+
value: value
|
54
|
+
}));
|
55
|
+
expect(screen.getByTestId('mock-monaco-editor')).toBeInTheDocument();
|
56
|
+
expect(screen.getByText('Editor Language: javascript, Code:console.log("Hello, World!");')).toBeInTheDocument();
|
57
|
+
});
|
58
|
+
it('calls onChange when code changes', function () {
|
59
|
+
var value = 'console.log("Hello, World!");';
|
60
|
+
var mockOnChange = jest.fn();
|
61
|
+
render(___EmotionJSX(CodeEditor, {
|
62
|
+
language: "javascript",
|
63
|
+
value: value,
|
64
|
+
onChange: mockOnChange
|
65
|
+
}));
|
66
|
+
var editor = screen.getByTestId('mock-monaco-editor');
|
67
|
+
var newValue = _JSON$stringify([{
|
68
|
+
key: false
|
69
|
+
}]);
|
70
|
+
act(function () {
|
71
|
+
fireEvent.change(editor, {
|
72
|
+
target: {
|
73
|
+
value: newValue
|
74
|
+
}
|
75
|
+
});
|
76
|
+
});
|
77
|
+
expect(mockOnChange).toHaveBeenCalled();
|
78
|
+
});
|
79
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './CodeEditor';
|
@@ -5,7 +5,10 @@ import { Meta } from '@storybook/addon-docs';
|
|
5
5
|
# CodeView
|
6
6
|
|
7
7
|
This component is used for code syntax highlighting and is built on [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer).
|
8
|
-
It should contain the language title and be formatted with indentations, line breaks, and comments, and should not contain complex code snippets.
|
8
|
+
It should contain the language title and be formatted with indentations, line breaks, and comments, and should not contain complex code snippets.
|
9
|
+
|
10
|
+
The CodeView component should be used for code snippets that need to be presented in a read-only format.
|
11
|
+
For more complex use cases that require an interactive environment, support for various programming languages, functionalities like linting, keyboard interactions, and real-time updates, use [CodeEditor](./?path=/docs/experimental-codeeditor--docs).
|
9
12
|
|
10
13
|
### Required Components
|
11
14
|
|
@@ -8,23 +8,23 @@ var container = {
|
|
8
8
|
lineHeight: 1.4,
|
9
9
|
outline: 'none',
|
10
10
|
transitionProperty: 'transform,visibility,opacity',
|
11
|
-
'WebkitBoxShadow': '0px 0px 12px
|
11
|
+
'WebkitBoxShadow': '0px 0px 12px 2pxrgba(158, 134, 134, 0.18)',
|
12
12
|
'MozBoxShadow': '0px 0px 12px 2px #0000002e',
|
13
13
|
'boxShadow': '0px 0px 12px 2px #0000002e',
|
14
14
|
'&.is-dark-mode': {
|
15
15
|
color: 'white',
|
16
|
-
bg: '
|
16
|
+
bg: 'tooltip',
|
17
17
|
'&[data-popover-placement^=top] > [data-popover-arrow="arrow"]:before': {
|
18
|
-
borderTopColor: '
|
18
|
+
borderTopColor: 'tooltip'
|
19
19
|
},
|
20
20
|
'&[data-popover-placement^=bottom] > [data-popover-arrow="arrow"]:before': {
|
21
|
-
borderBottomColor: '
|
21
|
+
borderBottomColor: 'tooltip'
|
22
22
|
},
|
23
23
|
'&[data-popover-placement^=left] > [data-popover-arrow="arrow"]:before': {
|
24
|
-
borderLeftColor: '
|
24
|
+
borderLeftColor: 'tooltip'
|
25
25
|
},
|
26
26
|
'&[data-popover-placement^=right] > [data-popover-arrow="arrow"]:before': {
|
27
|
-
borderRightColor: '
|
27
|
+
borderRightColor: 'tooltip'
|
28
28
|
}
|
29
29
|
},
|
30
30
|
'&[data-popover-placement^=top] > [data-popover-arrow="arrow"]': {
|
@@ -7,7 +7,7 @@ import { useOverlayPosition, useTooltipTrigger } from 'react-aria';
|
|
7
7
|
import { useTooltipTriggerState } from 'react-stately';
|
8
8
|
import { PressResponder } from '@react-aria/interactions';
|
9
9
|
import { TooltipContext } from '../../context/TooltipContext/index';
|
10
|
-
import { usePropWarning, useStatusClasses } from '../../hooks';
|
10
|
+
import { useGetTheme, useMountTransition, usePropWarning, useStatusClasses } from '../../hooks';
|
11
11
|
import PopoverContainer from '../PopoverContainer';
|
12
12
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
13
13
|
var TooltipTrigger = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -45,6 +45,10 @@ var TooltipTrigger = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
45
45
|
}, state, tooltipRef),
|
46
46
|
triggerProps = _useTooltipTrigger.triggerProps,
|
47
47
|
tooltipProps = _useTooltipTrigger.tooltipProps;
|
48
|
+
var _useGetTheme = useGetTheme(),
|
49
|
+
themeState = _useGetTheme.themeState;
|
50
|
+
var isTransitioning = useMountTransition(state.isOpen, 200);
|
51
|
+
var isOpen = state.isOpen || themeState.isOnyx && isTransitioning;
|
48
52
|
var _useOverlayPosition = useOverlayPosition({
|
49
53
|
placement: _concatInstanceProperty(_context = "".concat(direction, " ")).call(_context, align),
|
50
54
|
targetRef: tooltipRef,
|
@@ -53,15 +57,15 @@ var TooltipTrigger = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
53
57
|
// Our API preference is for default false so we invert this since it should be default true
|
54
58
|
shouldFlip: !isNotFlippable,
|
55
59
|
crossOffset: crossOffset,
|
56
|
-
isOpen:
|
60
|
+
isOpen: isOpen
|
57
61
|
}),
|
58
62
|
positionProps = _useOverlayPosition.overlayProps,
|
59
63
|
arrowProps = _useOverlayPosition.arrowProps,
|
60
64
|
placement = _useOverlayPosition.placement;
|
61
|
-
var _useStatusClasses = useStatusClasses(className, (_useStatusClasses2 = {}, _defineProperty(_useStatusClasses2, "is-".concat(direction), direction), _defineProperty(_useStatusClasses2, "isDarkMode", isDarkMode), _useStatusClasses2)),
|
65
|
+
var _useStatusClasses = useStatusClasses(className, (_useStatusClasses2 = {}, _defineProperty(_useStatusClasses2, "is-".concat(direction), direction), _defineProperty(_useStatusClasses2, "isDarkMode", isDarkMode), _defineProperty(_useStatusClasses2, "isTransitioning", isTransitioning), _defineProperty(_useStatusClasses2, "isMounted", state.isOpen), _useStatusClasses2)),
|
62
66
|
classNames = _useStatusClasses.classNames;
|
63
67
|
var overlay = ___EmotionJSX(PopoverContainer, _extends({
|
64
|
-
isOpen:
|
68
|
+
isOpen: isOpen,
|
65
69
|
ref: overlayRef,
|
66
70
|
placement: placement,
|
67
71
|
arrowProps: arrowProps,
|
@@ -10,11 +10,12 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
10
10
|
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
11
11
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
12
12
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
13
|
-
var _excluded = ["buttonProps"]
|
13
|
+
var _excluded = ["buttonProps"],
|
14
|
+
_excluded2 = ["buttonProps"];
|
14
15
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof _Symbol ? _Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return _Object$defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = _Object$create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = _Object$getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype); function defineIteratorMethods(prototype) { var _context3; _forEachInstanceProperty(_context3 = ["next", "throw", "return"]).call(_context3, function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = _Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { var _context4; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context4 = this.tryEntries).call(_context4, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
15
16
|
import React from 'react';
|
16
17
|
import userEvent from '@testing-library/user-event';
|
17
|
-
import { Button, Tooltip, TooltipTrigger } from '../../index';
|
18
|
+
import { AstroProvider, Button, OnyxTheme, Tooltip, TooltipTrigger } from '../../index';
|
18
19
|
import theme from '../../styles/theme';
|
19
20
|
import { act, fireEvent, render, screen, waitFor } from '../../utils/testUtils/testWrapper';
|
20
21
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
@@ -25,6 +26,14 @@ var getComponent = function getComponent() {
|
|
25
26
|
others = _objectWithoutProperties(_ref, _excluded);
|
26
27
|
return render(___EmotionJSX(TooltipTrigger, others, ___EmotionJSX(Button, buttonProps, "Mock Button"), ___EmotionJSX(Tooltip, null, "Tooltip Content")));
|
27
28
|
};
|
29
|
+
var getOnyxComponent = function getOnyxComponent() {
|
30
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
31
|
+
buttonProps = _ref2.buttonProps,
|
32
|
+
others = _objectWithoutProperties(_ref2, _excluded2);
|
33
|
+
return render(___EmotionJSX(AstroProvider, {
|
34
|
+
theme: OnyxTheme
|
35
|
+
}, ___EmotionJSX(TooltipTrigger, others, ___EmotionJSX(Button, buttonProps, "Mock Button"), ___EmotionJSX(Tooltip, null, "Tooltip Content"))));
|
36
|
+
};
|
28
37
|
beforeAll(function () {
|
29
38
|
jest.useFakeTimers();
|
30
39
|
});
|
@@ -112,13 +121,13 @@ test('tooltip closes after closeDelay when mouse leaves trigger', /*#__PURE__*/_
|
|
112
121
|
expect(screen.queryByRole('tooltip')).toBeInTheDocument();
|
113
122
|
fireEvent.mouseLeave(button);
|
114
123
|
act(function () {
|
115
|
-
jest.advanceTimersByTime(
|
124
|
+
jest.advanceTimersByTime(300);
|
116
125
|
});
|
117
126
|
_context.next = 9;
|
118
127
|
return act(function () {
|
119
128
|
expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
120
129
|
}, {
|
121
|
-
timeout: closeDelay +
|
130
|
+
timeout: closeDelay + 301
|
122
131
|
});
|
123
132
|
case 9:
|
124
133
|
case "end":
|
@@ -151,6 +160,28 @@ test('tooltip stays open until closeDelay after mouse leaves trigger', /*#__PURE
|
|
151
160
|
}
|
152
161
|
}, _callee2);
|
153
162
|
})));
|
163
|
+
test('tooltip uses mount transition when Onyx theme is applied', function () {
|
164
|
+
getOnyxComponent();
|
165
|
+
var button = screen.getByRole('button');
|
166
|
+
expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
167
|
+
fireEvent.mouseMove(button);
|
168
|
+
fireEvent.mouseEnter(button);
|
169
|
+
|
170
|
+
// Tooltip should be transitioning
|
171
|
+
expect(screen.queryByRole('tooltip')).toBeInTheDocument();
|
172
|
+
expect(screen.queryByRole('presentation')).toHaveClass('is-transitioning');
|
173
|
+
|
174
|
+
// Tooltip should now be fully mounted
|
175
|
+
userEvent.click(button);
|
176
|
+
expect(screen.queryByRole('tooltip')).toBeInTheDocument();
|
177
|
+
expect(screen.queryByRole('presentation')).not.toHaveClass('is-mounted');
|
178
|
+
expect(screen.queryByRole('presentation')).toHaveClass('is-transitioning');
|
179
|
+
act(function () {
|
180
|
+
jest.advanceTimersByTime(201); // Simulate the transition duration
|
181
|
+
});
|
182
|
+
|
183
|
+
expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
184
|
+
});
|
154
185
|
|
155
186
|
// Needs to be added to each components test file
|
156
187
|
universalComponentTests({
|
package/lib/index.js
CHANGED
@@ -63,6 +63,7 @@ export { default as Checkbox } from './components/Checkbox';
|
|
63
63
|
export * from './components/Checkbox';
|
64
64
|
export { default as CheckboxField } from './components/CheckboxField';
|
65
65
|
export * from './components/CheckboxField';
|
66
|
+
export { default as CodeEditor } from './components/CodeEditor';
|
66
67
|
export { default as CodeView } from './components/CodeView';
|
67
68
|
export { default as CollapsiblePanel } from './components/CollapsiblePanel';
|
68
69
|
export * from './components/CollapsiblePanel';
|
package/lib/styles/colors.js
CHANGED
@@ -118,6 +118,7 @@ export var text = {
|
|
118
118
|
active: active
|
119
119
|
};
|
120
120
|
export var shadow = chroma(neutral[10]).alpha(0.25).hex();
|
121
|
+
var tooltip = accent[20];
|
121
122
|
var allColors = {
|
122
123
|
black: black,
|
123
124
|
white: white,
|
@@ -134,7 +135,8 @@ var allColors = {
|
|
134
135
|
line: line,
|
135
136
|
button: button,
|
136
137
|
warning: warning,
|
137
|
-
slider: slider
|
138
|
+
slider: slider,
|
139
|
+
tooltip: tooltip
|
138
140
|
};
|
139
141
|
export default allColors;
|
140
142
|
function flattenColors(obj) {
|
@@ -61,6 +61,11 @@ var attachment = {
|
|
61
61
|
borderColor: 'border.attachment'
|
62
62
|
}
|
63
63
|
};
|
64
|
+
var tooltip = {
|
65
|
+
inline: {
|
66
|
+
color: 'blue-400'
|
67
|
+
}
|
68
|
+
};
|
64
69
|
export default {
|
65
70
|
attachment: attachment,
|
66
71
|
avatar: avatar,
|
@@ -77,6 +82,7 @@ export default {
|
|
77
82
|
iconBadge: iconBadge,
|
78
83
|
skeleton: skeleton,
|
79
84
|
footer: footer,
|
85
|
+
tooltip: tooltip,
|
80
86
|
dataTable: {
|
81
87
|
selectableTableRow: {
|
82
88
|
'&.is-selected': {
|
@@ -105,6 +105,7 @@ var card = {
|
|
105
105
|
blue: nextGenColors['blue-100'],
|
106
106
|
gray: nextGenColors['gray-100']
|
107
107
|
};
|
108
|
+
var tooltip = 'black';
|
108
109
|
var colors = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, subColors), nextGenColors), overrides), {}, {
|
109
110
|
card: card,
|
110
111
|
critical: critical,
|
@@ -115,6 +116,7 @@ var colors = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, subColo
|
|
115
116
|
active: colorsObject.blue,
|
116
117
|
primary: colorsObject.blue,
|
117
118
|
background: background,
|
118
|
-
iconWrapper: iconWrapper
|
119
|
+
iconWrapper: iconWrapper,
|
120
|
+
tooltip: tooltip
|
119
121
|
});
|
120
122
|
export default colors;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var nextGenConvertedComponents = ['DataTable', 'Message', 'Button', 'Badge', 'IconButton', 'CheckboxField', 'Messages', 'PopoverMenu', 'TextField', 'PasswordField', 'SearchField', 'SelectField', 'Modal', 'RadioField', 'MultiValuesField', 'TextAreaField', 'RadioGroupField', 'Tabs', 'ProgressBar', 'NavBar', 'OverlayPanel', 'AstroProvider', 'ListView', 'NavigationHeader', 'Avatar', 'MultivaluesField', 'Text', 'Link', 'Card', 'IconWrapper', 'ComboBoxField', 'CodeView', 'Sticker Sheet', 'NextGen ListViewItem', 'Skeleton', 'ListViewItem', 'Pagination'];
|
1
|
+
var nextGenConvertedComponents = ['DataTable', 'Message', 'Button', 'Badge', 'IconButton', 'CheckboxField', 'Messages', 'PopoverMenu', 'TextField', 'PasswordField', 'SearchField', 'SelectField', 'Modal', 'RadioField', 'MultiValuesField', 'TextAreaField', 'RadioGroupField', 'Tabs', 'ProgressBar', 'NavBar', 'OverlayPanel', 'AstroProvider', 'ListView', 'NavigationHeader', 'Avatar', 'MultivaluesField', 'Text', 'Link', 'Card', 'IconWrapper', 'ComboBoxField', 'CodeView', 'Sticker Sheet', 'NextGen ListViewItem', 'Skeleton', 'TooltipTrigger', 'ListViewItem', 'Pagination'];
|
2
2
|
export var componentSpecificNextGenBlacklist = {
|
3
3
|
AstroProvider: ['Default', 'With Custom Theme Override'],
|
4
4
|
Badge: ['Status Badge Variants', 'Badge With Left Slot And Icon', 'Callout Badges', 'Removable'],
|
@@ -0,0 +1,20 @@
|
|
1
|
+
var container = {
|
2
|
+
transition: 'opacity 200ms ease',
|
3
|
+
opacity: 0,
|
4
|
+
'&.is-mounted.is-transitioning': {
|
5
|
+
opacity: '100%'
|
6
|
+
}
|
7
|
+
};
|
8
|
+
var arrow = {
|
9
|
+
color: 'white',
|
10
|
+
'&:before': {
|
11
|
+
content: '""',
|
12
|
+
position: 'absolute',
|
13
|
+
borderColor: 'transparent',
|
14
|
+
borderStyle: 'solid'
|
15
|
+
}
|
16
|
+
};
|
17
|
+
export default {
|
18
|
+
container: container,
|
19
|
+
arrow: arrow
|
20
|
+
};
|
@@ -21,11 +21,13 @@ import { listView, listViewItem, lisViewItemChart } from './listview';
|
|
21
21
|
import { menu, menuItem } from './menu';
|
22
22
|
import { message } from './messages';
|
23
23
|
import { navBar } from './navbar';
|
24
|
+
import popoverMenu from './popoverMenu';
|
24
25
|
import prompt from './prompt';
|
25
26
|
import response from './response';
|
26
27
|
import suggestion from './suggestion';
|
27
28
|
import suggestions from './suggestions';
|
28
29
|
import { menuTab, tab, tabs } from './tabs';
|
30
|
+
import tooltip from './tooltip';
|
29
31
|
var fieldHelperText = {
|
30
32
|
title: {
|
31
33
|
fontSize: 'sm',
|
@@ -316,6 +318,7 @@ export default {
|
|
316
318
|
lisViewItemChart: lisViewItemChart,
|
317
319
|
dataTable: dataTable,
|
318
320
|
codeView: codeView,
|
321
|
+
popoverMenu: popoverMenu,
|
319
322
|
prompt: prompt,
|
320
323
|
tabs: tabs,
|
321
324
|
menu: menu,
|
@@ -325,6 +328,7 @@ export default {
|
|
325
328
|
suggestion: suggestion,
|
326
329
|
response: response,
|
327
330
|
skeleton: skeleton,
|
331
|
+
tooltip: tooltip,
|
328
332
|
footer: footer,
|
329
333
|
loader: loader
|
330
334
|
};
|
@@ -17,6 +17,7 @@ import breadcrumb from '../../components/Breadcrumbs/Breadcrumb.styles';
|
|
17
17
|
import buttonBar from '../../components/ButtonBar/ButtonBar.styles';
|
18
18
|
import calendar from '../../components/Calendar/Calendar.styles';
|
19
19
|
import callout from '../../components/Callout/Callout.styles';
|
20
|
+
import codeEditor from '../../components/CodeEditor/CodeEditor.styles';
|
20
21
|
import codeView from '../../components/CodeView/CodeView.styles';
|
21
22
|
import collapsiblePanel from '../../components/CollapsiblePanel/CollapsiblePanel.styles';
|
22
23
|
import copyText from '../../components/CopyText/CopyText.styles';
|
@@ -66,6 +67,7 @@ export default _objectSpread({
|
|
66
67
|
calendar: calendar,
|
67
68
|
rangeCalendar: rangeCalendar,
|
68
69
|
callout: callout,
|
70
|
+
codeEditor: codeEditor,
|
69
71
|
codeView: codeView,
|
70
72
|
collapsiblePanel: collapsiblePanel,
|
71
73
|
copyText: copyText,
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/lib/types/index.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pingux/astro",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.122.0-alpha.1",
|
4
4
|
"description": "React component library for Ping Identity's design system",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -49,6 +49,7 @@
|
|
49
49
|
"@internationalized/date": "^3.5.3",
|
50
50
|
"@internationalized/number": "^3.6.0",
|
51
51
|
"@mdx-js/react": "^1.6.22",
|
52
|
+
"@monaco-editor/react": "4.4.0",
|
52
53
|
"@pingux/mdi-react": "^1.2.0",
|
53
54
|
"@react-aria/accordion": "~3.0.0-alpha.11",
|
54
55
|
"@react-aria/breadcrumbs": "^3.1.4",
|
@@ -116,6 +117,7 @@
|
|
116
117
|
"lodash": "^4.17.21",
|
117
118
|
"markdown-to-jsx": "^7.7.4",
|
118
119
|
"moment": "^2.29.4",
|
120
|
+
"monaco-editor": "0.34.1",
|
119
121
|
"pluralize": "^8.0.0",
|
120
122
|
"prism-react-renderer": "1.2.1",
|
121
123
|
"prismjs": "^1.27.0",
|