@pareto-engineering/design-system 4.0.0-alpha.17 → 4.0.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/a/AnimatedGradient/AnimatedGradient.js +5 -1
- package/dist/cjs/a/AppContext/useTheme.js +0 -4
- package/dist/cjs/a/Conversation/Conversation.js +1 -1
- package/dist/cjs/a/Conversation/common/Message/Message.js +2 -3
- package/dist/cjs/a/Conversation/styles.scss +44 -28
- package/dist/cjs/a/SnapScroller/styles.scss +9 -4
- package/dist/cjs/b/Button/Button.js +10 -2
- package/dist/cjs/b/Button/styles.scss +27 -4
- package/dist/cjs/b/Page/Page.js +5 -1
- package/dist/cjs/b/Page/common/Section/Section.js +2 -2
- package/dist/cjs/b/ThemeSelector/ThemeSelector.js +15 -29
- package/dist/cjs/b/ThemeSelector/styles.scss +2 -7
- package/dist/cjs/f/fields/TextInput/TextInput.js +12 -3
- package/dist/cjs/f/fields/TextInput/styles.scss +20 -0
- package/dist/es/a/AnimatedGradient/AnimatedGradient.js +5 -1
- package/dist/es/a/AppContext/useTheme.js +0 -4
- package/dist/es/a/Conversation/Conversation.js +1 -1
- package/dist/es/a/Conversation/common/Message/Message.js +2 -3
- package/dist/es/a/Conversation/styles.scss +44 -28
- package/dist/es/a/SnapScroller/styles.scss +9 -4
- package/dist/es/b/Button/Button.js +10 -2
- package/dist/es/b/Button/styles.scss +27 -4
- package/dist/es/b/Page/Page.js +5 -1
- package/dist/es/b/Page/common/Section/Section.js +2 -2
- package/dist/es/b/ThemeSelector/ThemeSelector.js +15 -30
- package/dist/es/b/ThemeSelector/styles.scss +2 -7
- package/dist/es/f/fields/TextInput/TextInput.js +12 -3
- package/dist/es/f/fields/TextInput/styles.scss +20 -0
- package/package.json +4 -4
- package/src/stories/a/Conversation.stories.jsx +5 -1
- package/src/stories/f/TextInput.stories.jsx +7 -0
- package/src/ui/a/AnimatedGradient/AnimatedGradient.jsx +5 -1
- package/src/ui/a/AppContext/useTheme.js +0 -4
- package/src/ui/a/Conversation/Conversation.jsx +3 -1
- package/src/ui/a/Conversation/common/Message/Message.jsx +3 -5
- package/src/ui/a/Conversation/styles.scss +44 -28
- package/src/ui/a/SnapScroller/styles.scss +9 -4
- package/src/ui/b/Button/Button.jsx +11 -1
- package/src/ui/b/Button/styles.scss +27 -4
- package/src/ui/b/Page/Page.jsx +4 -0
- package/src/ui/b/Page/common/Section/Section.jsx +2 -2
- package/src/ui/b/ThemeSelector/ThemeSelector.jsx +8 -28
- package/src/ui/b/ThemeSelector/styles.scss +2 -7
- package/src/ui/f/fields/TextInput/TextInput.jsx +12 -1
- package/src/ui/f/fields/TextInput/styles.scss +20 -0
- package/tests/__snapshots__/Storyshots.test.js.snap +1701 -961
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
|
|
10
|
+
var _ = require("./..");
|
|
10
11
|
var _webGIRenderer = require("./webGIRenderer");
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -27,6 +28,9 @@ const AnimatedGradient = _ref => {
|
|
|
27
28
|
(0, React.useInsertionEffect)(() => {
|
|
28
29
|
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
29
30
|
}, []);
|
|
31
|
+
const {
|
|
32
|
+
userTheme
|
|
33
|
+
} = (0, _.useApp)();
|
|
30
34
|
const isClient = typeof window !== 'undefined';
|
|
31
35
|
(0, React.useEffect)(() => {
|
|
32
36
|
// Only initialize the Gradient if we're in the browser
|
|
@@ -34,7 +38,7 @@ const AnimatedGradient = _ref => {
|
|
|
34
38
|
const gradient = new _webGIRenderer.Gradient();
|
|
35
39
|
gradient.initGradient('#gradient-canvas');
|
|
36
40
|
}
|
|
37
|
-
}, []);
|
|
41
|
+
}, [userTheme]);
|
|
38
42
|
return /*#__PURE__*/React.createElement("canvas", {
|
|
39
43
|
id: "gradient-canvas",
|
|
40
44
|
"data-transition-in": true,
|
|
@@ -14,19 +14,15 @@ var _default = function _default(initialTheme) {
|
|
|
14
14
|
const storage = window.localStorage;
|
|
15
15
|
if (isClient) {
|
|
16
16
|
const storedTheme = window.localStorage.getItem(storageKey);
|
|
17
|
-
// console.log(storedTheme, storedTheme != userTheme)
|
|
18
17
|
if (storedTheme && storedTheme !== userTheme) {
|
|
19
|
-
// console.warn('Theme load')
|
|
20
18
|
setPreferredTheme(storedTheme);
|
|
21
19
|
setUserTheme(storedTheme);
|
|
22
20
|
} else if (preferredTheme && preferredTheme.length && preferredTheme !== 'system') {
|
|
23
21
|
setUserTheme(preferredTheme);
|
|
24
22
|
storage.setItem(storageKey, preferredTheme);
|
|
25
|
-
// console.warn('theme change', preferredTheme)
|
|
26
23
|
} else {
|
|
27
24
|
setUserTheme(window.matchMedia('(prefers-color-scheme:dark)').matches ? 'dark' : 'light');
|
|
28
25
|
storage.removeItem(storageKey);
|
|
29
|
-
// console.warn('theme reset')
|
|
30
26
|
}
|
|
31
27
|
} else {
|
|
32
28
|
setUserTheme('light');
|
|
@@ -42,7 +42,7 @@ const Conversation = _ref => {
|
|
|
42
42
|
id: id,
|
|
43
43
|
className: [baseClassName, componentClassName, userClassName, `y-${backgroundColor}`].filter(e => e).join(' '),
|
|
44
44
|
style: style
|
|
45
|
-
}, children));
|
|
45
|
+
}, /*#__PURE__*/React.createElement(_.Card.Section, null, children)));
|
|
46
46
|
};
|
|
47
47
|
Conversation.propTypes = {
|
|
48
48
|
/**
|
|
@@ -7,7 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
|
|
10
|
-
var _ = require("../../../..");
|
|
11
10
|
var _useConversation = _interopRequireDefault(require("../../useConversation"));
|
|
12
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -39,9 +38,9 @@ const Message = _ref => {
|
|
|
39
38
|
ourColor,
|
|
40
39
|
theirColor
|
|
41
40
|
} = (0, _useConversation.default)();
|
|
42
|
-
return /*#__PURE__*/React.createElement(
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
42
|
id: id,
|
|
44
|
-
className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from
|
|
43
|
+
className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from].filter(e => e).join(' '),
|
|
45
44
|
style: style
|
|
46
45
|
}, sender && /*#__PURE__*/React.createElement("p", {
|
|
47
46
|
className: "sender"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
/* stylelint-disable selector-max-compound-selectors -- Required here */
|
|
2
3
|
|
|
3
4
|
@use "@pareto-engineering/bem";
|
|
4
5
|
@use "@pareto-engineering/styles/src/mixins";
|
|
@@ -12,39 +13,54 @@ $default-message-border: 1px solid var(--hard-background-cards);
|
|
|
12
13
|
|
|
13
14
|
.#{bem.$base}.conversation {
|
|
14
15
|
background: var(--y);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
> .message
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
|
|
17
|
+
> .#{bem.$base}.section {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
> .#{bem.$base}.message + .#{bem.$base}.message {
|
|
22
|
+
padding-top: $default-padding;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
> .#{bem.$base}.message.ours + .#{bem.$base}.message.ours,
|
|
26
|
+
> .#{bem.$base}.message.theirs + .#{bem.$base}.message.theirs {
|
|
27
|
+
padding-top: calc($default-padding / 2);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
> .#{bem.$base}.message {
|
|
31
|
+
align-self: flex-start;
|
|
32
|
+
max-width: $default-message-max-width;
|
|
33
|
+
min-width: $default-message-min-width;
|
|
34
|
+
position: relative;
|
|
35
|
+
|
|
36
|
+
> .sender {
|
|
37
|
+
margin: 0;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
> .
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
> .message-content {
|
|
41
|
+
background-color: var(--x);
|
|
42
|
+
border: $default-message-border;
|
|
43
|
+
border-radius: $default-border-radius;
|
|
40
44
|
display: flex;
|
|
41
|
-
flex-direction:
|
|
42
|
-
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
padding: 0 $default-padding;
|
|
47
|
+
|
|
48
|
+
> p {
|
|
49
|
+
color: var(--on-x);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
> .attachment {
|
|
53
|
+
align-items: center;
|
|
54
|
+
align-self: flex-end;
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: row;
|
|
57
|
+
gap: calc($default-padding / 2);
|
|
58
|
+
}
|
|
43
59
|
}
|
|
44
|
-
}
|
|
45
60
|
|
|
46
|
-
|
|
47
|
-
|
|
61
|
+
&.#{bem.$base}.ours {
|
|
62
|
+
align-self: flex-end;
|
|
63
|
+
}
|
|
48
64
|
}
|
|
49
65
|
}
|
|
50
66
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
@use "@pareto-engineering/styles/src/mixins";
|
|
6
6
|
@use "@pareto-engineering/styles/src/globals" as *;
|
|
7
7
|
|
|
8
|
-
$default-spacing: var(--gap
|
|
8
|
+
$default-spacing: var(--gap);
|
|
9
9
|
|
|
10
10
|
.#{bem.$base}.snap-scroller {
|
|
11
11
|
display: flex;
|
|
@@ -27,10 +27,11 @@ $default-spacing: var(--gap, 1em);
|
|
|
27
27
|
&:first-child {
|
|
28
28
|
margin-left: $default-spacing;
|
|
29
29
|
}
|
|
30
|
+
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
&::after {
|
|
33
|
+
content: "";
|
|
34
|
+
min-width: calc($default-spacing / 2);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
@include mixins.media($from: $sm-md) {
|
|
@@ -40,6 +41,10 @@ $default-spacing: var(--gap, 1em);
|
|
|
40
41
|
scroll-snap-type: none;
|
|
41
42
|
scrollbar-width: unset;
|
|
42
43
|
|
|
44
|
+
&::after {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
>* {
|
|
44
49
|
min-width: unset;
|
|
45
50
|
|
|
@@ -29,15 +29,19 @@ const Button = _ref => {
|
|
|
29
29
|
isGhost,
|
|
30
30
|
isSimple,
|
|
31
31
|
isGradient,
|
|
32
|
+
isSpaced,
|
|
32
33
|
arrowDirection,
|
|
33
34
|
...otherProps
|
|
34
35
|
} = _ref;
|
|
35
36
|
(0, React.useInsertionEffect)(() => {
|
|
36
37
|
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
37
38
|
}, []);
|
|
39
|
+
const buttonText = isSimple ? /*#__PURE__*/React.createElement("span", {
|
|
40
|
+
className: _exports.default.modifierUnderlined
|
|
41
|
+
}, children) : children;
|
|
38
42
|
return /*#__PURE__*/React.createElement("button", _extends({
|
|
39
43
|
id: id,
|
|
40
|
-
className: [baseClassName, componentClassName, userClassName, `x-${color}`, isGhost && _exports.default.modifierGhost, isCompact && _exports.default.modifierCompact, isSimple && _exports.default.modifierSimple, isGradient && _exports.default.modifierGradient, arrowDirection && `arrow-${arrowDirection}`].filter(e => e).join(' '),
|
|
44
|
+
className: [baseClassName, componentClassName, userClassName, `x-${color}`, isGhost && _exports.default.modifierGhost, isCompact && _exports.default.modifierCompact, isSimple && _exports.default.modifierSimple, isGradient && _exports.default.modifierGradient, isSpaced && _exports.default.modifierSpaced, arrowDirection && `arrow-${arrowDirection}`].filter(e => e).join(' '),
|
|
41
45
|
style: style,
|
|
42
46
|
type: "button"
|
|
43
47
|
}, otherProps), isLoading ? /*#__PURE__*/React.createElement(_.LoadingCircle, {
|
|
@@ -45,7 +49,7 @@ const Button = _ref => {
|
|
|
45
49
|
'--x': 'var(--on-x)'
|
|
46
50
|
},
|
|
47
51
|
heightWidth: "1.15em"
|
|
48
|
-
}) :
|
|
52
|
+
}) : buttonText);
|
|
49
53
|
};
|
|
50
54
|
Button.propTypes = {
|
|
51
55
|
/**
|
|
@@ -80,6 +84,10 @@ Button.propTypes = {
|
|
|
80
84
|
* Should this button have a gradient
|
|
81
85
|
*/
|
|
82
86
|
isGradient: _propTypes.default.bool,
|
|
87
|
+
/**
|
|
88
|
+
* Should this button be spaced
|
|
89
|
+
*/
|
|
90
|
+
isSpaced: _propTypes.default.bool,
|
|
83
91
|
/**
|
|
84
92
|
* The button color
|
|
85
93
|
*/
|
|
@@ -20,7 +20,8 @@ $default-animation-time: .31s;
|
|
|
20
20
|
font-weight: 400;
|
|
21
21
|
justify-content: space-between;
|
|
22
22
|
padding: $default-padding;
|
|
23
|
-
transition: all .25s
|
|
23
|
+
transition: all .25s;
|
|
24
|
+
white-space: nowrap;//var(--theme-default-paragraph);
|
|
24
25
|
|
|
25
26
|
&.arrow-right {
|
|
26
27
|
&::after {
|
|
@@ -57,7 +58,10 @@ $default-animation-time: .31s;
|
|
|
57
58
|
&:not(:disabled) {
|
|
58
59
|
cursor: pointer;
|
|
59
60
|
|
|
60
|
-
&:hover
|
|
61
|
+
&:hover
|
|
62
|
+
:not(.#{bem.$modifier-gradient})
|
|
63
|
+
:not(.#{bem.$modifier-ghost})
|
|
64
|
+
:not(.#{bem.$modifier-simple}) {
|
|
61
65
|
background: var(--soft-x, var(--soft-#{$default-color}));
|
|
62
66
|
}
|
|
63
67
|
|
|
@@ -67,8 +71,18 @@ $default-animation-time: .31s;
|
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
&.#{bem.$modifier-gradient} {
|
|
70
|
-
background: linear-gradient(
|
|
71
|
-
|
|
74
|
+
background-image: linear-gradient(
|
|
75
|
+
to right,
|
|
76
|
+
var(--hard-x) 30%,
|
|
77
|
+
var(--x) 50%,
|
|
78
|
+
var(--hard-x) 100%
|
|
79
|
+
);
|
|
80
|
+
background-position: left;
|
|
81
|
+
background-size: 200% auto;
|
|
82
|
+
|
|
83
|
+
&:not(:disabled):hover {
|
|
84
|
+
background-position: right center;
|
|
85
|
+
}
|
|
72
86
|
}
|
|
73
87
|
|
|
74
88
|
&.#{bem.$modifier-compact} {
|
|
@@ -104,12 +118,21 @@ $default-animation-time: .31s;
|
|
|
104
118
|
}
|
|
105
119
|
}
|
|
106
120
|
|
|
121
|
+
&.#{bem.$modifier-spaced} {
|
|
122
|
+
margin-bottom: var(--spacing-2);
|
|
123
|
+
margin-top: var(--spacing-2);
|
|
124
|
+
}
|
|
125
|
+
|
|
107
126
|
&.#{bem.$modifier-simple} {
|
|
108
127
|
background: transparent;
|
|
109
128
|
border: 1px solid transparent;
|
|
110
129
|
color: var(--x, var(--#{$default-color}));
|
|
111
130
|
padding: 0;
|
|
112
131
|
|
|
132
|
+
> .#{bem.$modifier-underlined} {
|
|
133
|
+
text-decoration: underline;
|
|
134
|
+
}
|
|
135
|
+
|
|
113
136
|
&:disabled,
|
|
114
137
|
&:hover,
|
|
115
138
|
&:focus {
|
package/dist/cjs/b/Page/Page.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
|
|
10
|
+
var _a = require("../../a");
|
|
10
11
|
var _common = require("./common");
|
|
11
12
|
var _Context = _interopRequireDefault(require("./Context"));
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -37,6 +38,9 @@ const Page = _ref => {
|
|
|
37
38
|
(0, React.useInsertionEffect)(() => {
|
|
38
39
|
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
39
40
|
}, []);
|
|
41
|
+
const {
|
|
42
|
+
userTheme
|
|
43
|
+
} = (0, _a.useApp)();
|
|
40
44
|
(0, React.useEffect)(() => {
|
|
41
45
|
// If we're on the client, we make sure to scroll up when the page loads
|
|
42
46
|
// This is a necessary transform to make react apt for website pages
|
|
@@ -51,7 +55,7 @@ const Page = _ref => {
|
|
|
51
55
|
}
|
|
52
56
|
}, /*#__PURE__*/React.createElement(Wrapper, _extends({
|
|
53
57
|
id: id,
|
|
54
|
-
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
58
|
+
className: [baseClassName, componentClassName, userClassName, userTheme && `ui-${userTheme}`].filter(e => e).join(' '),
|
|
55
59
|
style: style,
|
|
56
60
|
itemType: itemType,
|
|
57
61
|
itemScope: itemType && ' '
|
|
@@ -20,7 +20,7 @@ const Section = _ref => {
|
|
|
20
20
|
className: userClassName,
|
|
21
21
|
style,
|
|
22
22
|
children,
|
|
23
|
-
|
|
23
|
+
isSpaced,
|
|
24
24
|
padded,
|
|
25
25
|
...otherProps
|
|
26
26
|
} = _ref;
|
|
@@ -30,7 +30,7 @@ const Section = _ref => {
|
|
|
30
30
|
const sectionId = userId && `${pageId}_${userId}`;
|
|
31
31
|
return /*#__PURE__*/React.createElement("section", _extends({
|
|
32
32
|
id: sectionId,
|
|
33
|
-
className: [baseClassName, componentClassName, userClassName,
|
|
33
|
+
className: [baseClassName, componentClassName, userClassName, isSpaced && _exports.default.modifierSpaced, padded && 'padded', 'grid'].filter(e => e).join(' '),
|
|
34
34
|
style: style
|
|
35
35
|
}, otherProps), children);
|
|
36
36
|
};
|
|
@@ -24,10 +24,7 @@ const ThemeSelector = _ref => {
|
|
|
24
24
|
id,
|
|
25
25
|
className: userClassName,
|
|
26
26
|
style,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
themes,
|
|
30
|
-
iconMap
|
|
27
|
+
themes
|
|
31
28
|
} = _ref;
|
|
32
29
|
const {
|
|
33
30
|
userTheme,
|
|
@@ -40,15 +37,18 @@ const ThemeSelector = _ref => {
|
|
|
40
37
|
const current = themes.indexOf(userTheme);
|
|
41
38
|
setPreferredTheme(themes[(current + 1) % themes.length]);
|
|
42
39
|
}, [userTheme]);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
const themeText = userTheme && userTheme.charAt(0).toUpperCase() + userTheme.slice(1);
|
|
41
|
+
return (
|
|
42
|
+
/*#__PURE__*/
|
|
43
|
+
// eslint-disable-next-line jsx-a11y/anchor-is-valid, jsx-a11y/no-static-element-interactions
|
|
44
|
+
React.createElement("a", {
|
|
45
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
46
|
+
id: id,
|
|
47
|
+
style: style,
|
|
48
|
+
onClick: loopThemes,
|
|
49
|
+
onKeyDown: loopThemes
|
|
50
|
+
}, themeText)
|
|
51
|
+
);
|
|
52
52
|
};
|
|
53
53
|
ThemeSelector.propTypes = {
|
|
54
54
|
/**
|
|
@@ -63,27 +63,13 @@ ThemeSelector.propTypes = {
|
|
|
63
63
|
* The React-written, css properties for this element.
|
|
64
64
|
*/
|
|
65
65
|
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
66
|
-
/**
|
|
67
|
-
* The children JSX
|
|
68
|
-
*/
|
|
69
|
-
// children: PropTypes.node,
|
|
70
|
-
|
|
71
66
|
/**
|
|
72
67
|
* The themes and the order in which they appear
|
|
73
68
|
*/
|
|
74
|
-
themes: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
75
|
-
/**
|
|
76
|
-
* A map of the theme names with the icons that represent them. Uses the default font icon.
|
|
77
|
-
*/
|
|
78
|
-
iconMap: _propTypes.default.objectOf(_propTypes.default.string)
|
|
69
|
+
themes: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
79
70
|
};
|
|
80
71
|
ThemeSelector.defaultProps = {
|
|
81
|
-
themes: ['light', 'dark']
|
|
82
|
-
iconMap: {
|
|
83
|
-
dark: 'n',
|
|
84
|
-
// sun,
|
|
85
|
-
light: 'm' // moon,
|
|
86
|
-
}
|
|
72
|
+
themes: ['light', 'dark']
|
|
87
73
|
};
|
|
88
74
|
var _default = ThemeSelector;
|
|
89
75
|
exports.default = _default;
|
|
@@ -2,13 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
@use "@pareto-engineering/bem";
|
|
4
4
|
|
|
5
|
-
$default-color:var(--x, var(--contrast));
|
|
6
|
-
|
|
7
5
|
.#{bem.$base}.theme-selector {
|
|
8
|
-
background: transparent;
|
|
9
|
-
border: none;
|
|
10
|
-
color: $default-color;
|
|
11
6
|
cursor: pointer;
|
|
7
|
+
display: block;
|
|
8
|
+
text-decoration: none;
|
|
12
9
|
}
|
|
13
|
-
|
|
14
|
-
|
|
@@ -37,7 +37,8 @@ const TextInput = _ref => {
|
|
|
37
37
|
disabled,
|
|
38
38
|
placeholder,
|
|
39
39
|
optional,
|
|
40
|
-
autoComplete
|
|
40
|
+
autoComplete,
|
|
41
|
+
symbol
|
|
41
42
|
// ...otherProps
|
|
42
43
|
} = _ref;
|
|
43
44
|
(0, React.useInsertionEffect)(() => {
|
|
@@ -47,6 +48,9 @@ const TextInput = _ref => {
|
|
|
47
48
|
name,
|
|
48
49
|
validate
|
|
49
50
|
});
|
|
51
|
+
const symbolStyle = symbol ? {
|
|
52
|
+
'--symbol': symbol
|
|
53
|
+
} : {};
|
|
50
54
|
return /*#__PURE__*/React.createElement("div", {
|
|
51
55
|
id: id,
|
|
52
56
|
className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
|
|
@@ -58,7 +62,8 @@ const TextInput = _ref => {
|
|
|
58
62
|
color: labelColor,
|
|
59
63
|
optional: optional
|
|
60
64
|
}, label), /*#__PURE__*/React.createElement("div", {
|
|
61
|
-
className:
|
|
65
|
+
className: `input-wrapper with-faded-border ${symbol ? 'has-symbol' : ''}`,
|
|
66
|
+
style: symbolStyle
|
|
62
67
|
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
63
68
|
id: name,
|
|
64
69
|
className: "input",
|
|
@@ -133,7 +138,11 @@ TextInput.propTypes = {
|
|
|
133
138
|
* The autoComplete value that the browser should watch for the input
|
|
134
139
|
* `https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete`
|
|
135
140
|
*/
|
|
136
|
-
autoComplete: _propTypes.default.string
|
|
141
|
+
autoComplete: _propTypes.default.string,
|
|
142
|
+
/**
|
|
143
|
+
* A symbol to be set inside the input field
|
|
144
|
+
*/
|
|
145
|
+
symbol: _propTypes.default.string
|
|
137
146
|
};
|
|
138
147
|
TextInput.defaultProps = {
|
|
139
148
|
type: 'text',
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
@use "../../../form.scss";
|
|
5
5
|
|
|
6
6
|
$default-padding: .75em .75em .55em;
|
|
7
|
+
$default-symbol-left: 3em;
|
|
8
|
+
$default-padding-with-symbol:
|
|
9
|
+
.75em
|
|
10
|
+
calc($default-symbol-left - 1em)
|
|
11
|
+
.55em
|
|
12
|
+
calc($default-symbol-left + 1em);
|
|
7
13
|
$default-input-border-radius: var(--theme-default-input-border-radius);
|
|
8
14
|
|
|
9
15
|
|
|
@@ -18,6 +24,20 @@ $default-input-border-radius: var(--theme-default-input-border-radius);
|
|
|
18
24
|
border-radius: $default-input-border-radius;
|
|
19
25
|
}
|
|
20
26
|
|
|
27
|
+
&.has-symbol {
|
|
28
|
+
&::before {
|
|
29
|
+
color: var(--interactive);
|
|
30
|
+
content: var(--symbol);
|
|
31
|
+
left: $default-symbol-left;
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: .5em;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
input {
|
|
37
|
+
padding: $default-padding-with-symbol;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
21
41
|
> input {
|
|
22
42
|
background-color: var(--background-inputs);
|
|
23
43
|
border-radius: $default-input-border-radius;
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { useEffect, useInsertionEffect } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import styleNames from '@pareto-engineering/bem/exports';
|
|
6
|
+
import { useApp } from "./..";
|
|
6
7
|
import { Gradient } from "./webGIRenderer";
|
|
7
8
|
|
|
8
9
|
// Local Definitions
|
|
@@ -20,6 +21,9 @@ const AnimatedGradient = ({
|
|
|
20
21
|
useInsertionEffect(() => {
|
|
21
22
|
import("./styles.scss");
|
|
22
23
|
}, []);
|
|
24
|
+
const {
|
|
25
|
+
userTheme
|
|
26
|
+
} = useApp();
|
|
23
27
|
const isClient = typeof window !== 'undefined';
|
|
24
28
|
useEffect(() => {
|
|
25
29
|
// Only initialize the Gradient if we're in the browser
|
|
@@ -27,7 +31,7 @@ const AnimatedGradient = ({
|
|
|
27
31
|
const gradient = new Gradient();
|
|
28
32
|
gradient.initGradient('#gradient-canvas');
|
|
29
33
|
}
|
|
30
|
-
}, []);
|
|
34
|
+
}, [userTheme]);
|
|
31
35
|
return /*#__PURE__*/React.createElement("canvas", {
|
|
32
36
|
id: "gradient-canvas",
|
|
33
37
|
"data-transition-in": true,
|
|
@@ -7,19 +7,15 @@ export default ((initialTheme, storageKey = 'theme') => {
|
|
|
7
7
|
const storage = window.localStorage;
|
|
8
8
|
if (isClient) {
|
|
9
9
|
const storedTheme = window.localStorage.getItem(storageKey);
|
|
10
|
-
// console.log(storedTheme, storedTheme != userTheme)
|
|
11
10
|
if (storedTheme && storedTheme !== userTheme) {
|
|
12
|
-
// console.warn('Theme load')
|
|
13
11
|
setPreferredTheme(storedTheme);
|
|
14
12
|
setUserTheme(storedTheme);
|
|
15
13
|
} else if (preferredTheme && preferredTheme.length && preferredTheme !== 'system') {
|
|
16
14
|
setUserTheme(preferredTheme);
|
|
17
15
|
storage.setItem(storageKey, preferredTheme);
|
|
18
|
-
// console.warn('theme change', preferredTheme)
|
|
19
16
|
} else {
|
|
20
17
|
setUserTheme(window.matchMedia('(prefers-color-scheme:dark)').matches ? 'dark' : 'light');
|
|
21
18
|
storage.removeItem(storageKey);
|
|
22
|
-
// console.warn('theme reset')
|
|
23
19
|
}
|
|
24
20
|
} else {
|
|
25
21
|
setUserTheme('light');
|
|
@@ -37,7 +37,7 @@ const Conversation = ({
|
|
|
37
37
|
id: id,
|
|
38
38
|
className: [baseClassName, componentClassName, userClassName, `y-${backgroundColor}`].filter(e => e).join(' '),
|
|
39
39
|
style: style
|
|
40
|
-
}, children));
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Card.Section, null, children)));
|
|
41
41
|
};
|
|
42
42
|
Conversation.propTypes = {
|
|
43
43
|
/**
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import styleNames from '@pareto-engineering/bem/exports';
|
|
5
|
-
import { Card } from "../../../..";
|
|
6
5
|
|
|
7
6
|
// Local Definitions
|
|
8
7
|
|
|
@@ -29,9 +28,9 @@ const Message = ({
|
|
|
29
28
|
ourColor,
|
|
30
29
|
theirColor
|
|
31
30
|
} = useConversation();
|
|
32
|
-
return /*#__PURE__*/React.createElement(
|
|
31
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
33
32
|
id: id,
|
|
34
|
-
className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from
|
|
33
|
+
className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from].filter(e => e).join(' '),
|
|
35
34
|
style: style
|
|
36
35
|
}, sender && /*#__PURE__*/React.createElement("p", {
|
|
37
36
|
className: "sender"
|