@pingux/astro 2.141.0 → 2.142.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/AIComponents/PromptInput/PromptInput.js +3 -7
- package/lib/cjs/hooks/useGetTheme/useGetTheme.d.ts +2 -2
- package/lib/cjs/hooks/useGetTheme/useGetTheme.js +6 -18
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/input.js +3 -0
- package/lib/components/AIComponents/PromptInput/PromptInput.js +3 -7
- package/lib/hooks/useGetTheme/useGetTheme.js +6 -17
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/input.js +3 -0
- package/package.json +1 -1
@@ -63,10 +63,6 @@ var PromptInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
63
63
|
_useProgressiveState2 = (0, _slicedToArray2["default"])(_useProgressiveState, 2),
|
64
64
|
value = _useProgressiveState2[0],
|
65
65
|
setValue = _useProgressiveState2[1];
|
66
|
-
var countLineBreaks = function countLineBreaks(str) {
|
67
|
-
var lineBreaks = str.match(/\r\n|\r|\n/g);
|
68
|
-
return lineBreaks ? lineBreaks.length : 0;
|
69
|
-
};
|
70
66
|
var handleFileSelect = function handleFileSelect(_event, files) {
|
71
67
|
var arrayWithNewFiles = (0, _from["default"])(files);
|
72
68
|
var filesWithIdAndLink = (0, _map["default"])(arrayWithNewFiles).call(arrayWithNewFiles, function (newFile) {
|
@@ -124,9 +120,8 @@ var PromptInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
124
120
|
var inputRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
125
121
|
(0, _react.useEffect)(function () {
|
126
122
|
if (inputRef.current && value) {
|
127
|
-
var lb = countLineBreaks(value);
|
128
123
|
inputRef.current.style.height = 'auto';
|
129
|
-
inputRef.current.style.height = "
|
124
|
+
inputRef.current.style.height = "".concat(inputRef.current.scrollHeight, "px");
|
130
125
|
} else if (value === '') {
|
131
126
|
inputRef.current.style.height = 'auto';
|
132
127
|
inputRef.current.style.height = '26px';
|
@@ -186,7 +181,8 @@ var PromptInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
186
181
|
}, fileInputButtonProps))), (0, _react2.jsx)(_index.TextArea, (0, _extends2["default"])({
|
187
182
|
ref: inputRef,
|
188
183
|
variant: "forms.input.promptInput",
|
189
|
-
"data-testid": "prompt-input"
|
184
|
+
"data-testid": "prompt-input",
|
185
|
+
rows: 1
|
190
186
|
}, fieldControlInputProps, {
|
191
187
|
onKeyUp: onKeyUp,
|
192
188
|
onKeyDown: onKeyDown
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
import React from 'react';
|
2
2
|
export declare const baseState: {
|
3
3
|
isOnyx: boolean;
|
4
4
|
isAstro: boolean;
|
@@ -10,7 +10,7 @@ declare const useGetTheme: () => {
|
|
10
10
|
[x: number]: import("@pingux/mdi-react").MdiReactIconComponentType;
|
11
11
|
MenuDown: import("@pingux/mdi-react").MdiReactIconComponentType;
|
12
12
|
MenuUp: import("@pingux/mdi-react").MdiReactIconComponentType;
|
13
|
-
pingLogoHorizontalSmall:
|
13
|
+
pingLogoHorizontalSmall: React.JSX.Element;
|
14
14
|
listViewMenu: import("@pingux/mdi-react").MdiReactIconComponentType;
|
15
15
|
Ascending: import("@pingux/mdi-react").MdiReactIconComponentType;
|
16
16
|
Descending: import("@pingux/mdi-react").MdiReactIconComponentType;
|
@@ -13,10 +13,8 @@ _Object$defineProperty(exports, "__esModule", {
|
|
13
13
|
value: true
|
14
14
|
});
|
15
15
|
exports["default"] = exports.baseState = void 0;
|
16
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
17
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
18
|
-
var _react = require("react");
|
19
|
-
var _react2 = require("@emotion/react");
|
17
|
+
var _react = require("@emotion/react");
|
20
18
|
var _customProperties = require("../../styles/themeOverrides/nextGenDarkMode/customProperties");
|
21
19
|
var _customProperties2 = require("../../styles/themes/astro/customProperties");
|
22
20
|
var _customProperties3 = require("../../styles/themes/next-gen/customProperties");
|
@@ -55,28 +53,18 @@ var customThemeState = _objectSpread({
|
|
55
53
|
}),
|
56
54
|
name: 'custom'
|
57
55
|
}, _customProperties2.astroThemeValues);
|
58
|
-
var
|
59
|
-
|
56
|
+
var useGetTheme = function useGetTheme() {
|
57
|
+
var theme = (0, _react.useTheme)();
|
58
|
+
if (theme.name === _themes.themes.NEXT_GEN) {
|
60
59
|
return _objectSpread({}, onyxState);
|
61
60
|
}
|
62
|
-
if (theme === _themes.themes.ASTRO) {
|
61
|
+
if (theme.name === _themes.themes.ASTRO) {
|
63
62
|
return _objectSpread({}, astroState);
|
64
63
|
}
|
65
|
-
if (theme === _themes.themes.NEXT_GEN_DARK) {
|
64
|
+
if (theme.name === _themes.themes.NEXT_GEN_DARK) {
|
66
65
|
return _objectSpread({}, onyxDarkState);
|
67
66
|
}
|
68
67
|
return _objectSpread({}, customThemeState);
|
69
68
|
};
|
70
|
-
var useGetTheme = function useGetTheme() {
|
71
|
-
var theme = (0, _react2.useTheme)();
|
72
|
-
var _useState = (0, _react.useState)(getTheme(theme.name)),
|
73
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
74
|
-
themeObject = _useState2[0],
|
75
|
-
setThemeObject = _useState2[1];
|
76
|
-
(0, _react.useEffect)(function () {
|
77
|
-
setThemeObject(getTheme(theme.name));
|
78
|
-
}, [theme.name]);
|
79
|
-
return themeObject;
|
80
|
-
};
|
81
69
|
var _default = useGetTheme;
|
82
70
|
exports["default"] = _default;
|
@@ -51,10 +51,6 @@ var PromptInput = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
51
51
|
_useProgressiveState2 = _slicedToArray(_useProgressiveState, 2),
|
52
52
|
value = _useProgressiveState2[0],
|
53
53
|
setValue = _useProgressiveState2[1];
|
54
|
-
var countLineBreaks = function countLineBreaks(str) {
|
55
|
-
var lineBreaks = str.match(/\r\n|\r|\n/g);
|
56
|
-
return lineBreaks ? lineBreaks.length : 0;
|
57
|
-
};
|
58
54
|
var handleFileSelect = function handleFileSelect(_event, files) {
|
59
55
|
var arrayWithNewFiles = _Array$from(files);
|
60
56
|
var filesWithIdAndLink = _mapInstanceProperty(arrayWithNewFiles).call(arrayWithNewFiles, function (newFile) {
|
@@ -112,9 +108,8 @@ var PromptInput = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
112
108
|
var inputRef = useLocalOrForwardRef(ref);
|
113
109
|
useEffect(function () {
|
114
110
|
if (inputRef.current && value) {
|
115
|
-
var lb = countLineBreaks(value);
|
116
111
|
inputRef.current.style.height = 'auto';
|
117
|
-
inputRef.current.style.height = "
|
112
|
+
inputRef.current.style.height = "".concat(inputRef.current.scrollHeight, "px");
|
118
113
|
} else if (value === '') {
|
119
114
|
inputRef.current.style.height = 'auto';
|
120
115
|
inputRef.current.style.height = '26px';
|
@@ -174,7 +169,8 @@ var PromptInput = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
174
169
|
}, fileInputButtonProps))), ___EmotionJSX(TextArea, _extends({
|
175
170
|
ref: inputRef,
|
176
171
|
variant: "forms.input.promptInput",
|
177
|
-
"data-testid": "prompt-input"
|
172
|
+
"data-testid": "prompt-input",
|
173
|
+
rows: 1
|
178
174
|
}, fieldControlInputProps, {
|
179
175
|
onKeyUp: onKeyUp,
|
180
176
|
onKeyDown: onKeyDown
|
@@ -6,12 +6,11 @@ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
|
|
6
6
|
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
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
|
-
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
10
9
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
10
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
12
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
13
12
|
/* eslint-disable no-else-return */
|
14
|
-
|
13
|
+
|
15
14
|
import { useTheme } from '@emotion/react';
|
16
15
|
import { nextGenDarkThemeValues } from '../../styles/themeOverrides/nextGenDarkMode/customProperties';
|
17
16
|
import { astroThemeValues } from '../../styles/themes/astro/customProperties';
|
@@ -48,27 +47,17 @@ var customThemeState = _objectSpread({
|
|
48
47
|
}),
|
49
48
|
name: 'custom'
|
50
49
|
}, astroThemeValues);
|
51
|
-
var
|
52
|
-
|
50
|
+
var useGetTheme = function useGetTheme() {
|
51
|
+
var theme = useTheme();
|
52
|
+
if (theme.name === themes.NEXT_GEN) {
|
53
53
|
return _objectSpread({}, onyxState);
|
54
54
|
}
|
55
|
-
if (theme === themes.ASTRO) {
|
55
|
+
if (theme.name === themes.ASTRO) {
|
56
56
|
return _objectSpread({}, astroState);
|
57
57
|
}
|
58
|
-
if (theme === themes.NEXT_GEN_DARK) {
|
58
|
+
if (theme.name === themes.NEXT_GEN_DARK) {
|
59
59
|
return _objectSpread({}, onyxDarkState);
|
60
60
|
}
|
61
61
|
return _objectSpread({}, customThemeState);
|
62
62
|
};
|
63
|
-
var useGetTheme = function useGetTheme() {
|
64
|
-
var theme = useTheme();
|
65
|
-
var _useState = useState(getTheme(theme.name)),
|
66
|
-
_useState2 = _slicedToArray(_useState, 2),
|
67
|
-
themeObject = _useState2[0],
|
68
|
-
setThemeObject = _useState2[1];
|
69
|
-
useEffect(function () {
|
70
|
-
setThemeObject(getTheme(theme.name));
|
71
|
-
}, [theme.name]);
|
72
|
-
return themeObject;
|
73
|
-
};
|
74
63
|
export default useGetTheme;
|