@pareto-engineering/design-system 4.0.0-alpha.16 → 4.0.0-alpha.18
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 +9 -14
- package/dist/cjs/a/Conversation/common/Message/Message.js +11 -12
- package/dist/cjs/a/Conversation/styles.scss +16 -120
- package/dist/cjs/a/SnapScroller/styles.scss +8 -0
- package/dist/cjs/b/Button/Button.js +6 -1
- package/dist/cjs/b/Button/styles.scss +7 -2
- 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 +3 -10
- package/dist/cjs/b/ThemeSelector/styles.scss +3 -2
- 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 +9 -14
- package/dist/es/a/Conversation/common/Message/Message.js +11 -12
- package/dist/es/a/Conversation/styles.scss +16 -120
- package/dist/es/a/SnapScroller/styles.scss +8 -0
- package/dist/es/b/Button/Button.js +6 -1
- package/dist/es/b/Button/styles.scss +7 -2
- 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 +3 -10
- package/dist/es/b/ThemeSelector/styles.scss +3 -2
- package/dist/es/f/fields/TextInput/TextInput.js +12 -3
- package/dist/es/f/fields/TextInput/styles.scss +20 -0
- package/package.json +3 -3
- package/src/stories/a/Conversation.stories.jsx +8 -43
- package/src/stories/b/Button/Button.stories.jsx +11 -8
- package/src/stories/colors.js +17 -5
- 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 +11 -17
- package/src/ui/a/Conversation/common/Message/Message.jsx +11 -8
- package/src/ui/a/Conversation/styles.scss +16 -120
- package/src/ui/a/SnapScroller/styles.scss +8 -0
- package/src/ui/b/Button/Button.jsx +7 -0
- package/src/ui/b/Button/styles.scss +7 -2
- 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 +3 -10
- package/src/ui/b/ThemeSelector/styles.scss +3 -2
- 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 +6073 -2491
|
@@ -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');
|
|
@@ -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 _common = require("./common");
|
|
11
12
|
var _Context = _interopRequireDefault(require("./Context"));
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -23,11 +24,10 @@ const Conversation = _ref => {
|
|
|
23
24
|
id,
|
|
24
25
|
className: userClassName,
|
|
25
26
|
style,
|
|
26
|
-
backgroundColor,
|
|
27
27
|
ourColor,
|
|
28
28
|
theirColor,
|
|
29
29
|
children,
|
|
30
|
-
|
|
30
|
+
backgroundColor
|
|
31
31
|
// ...otherProps
|
|
32
32
|
} = _ref;
|
|
33
33
|
(0, React.useInsertionEffect)(() => {
|
|
@@ -38,9 +38,9 @@ const Conversation = _ref => {
|
|
|
38
38
|
ourColor,
|
|
39
39
|
theirColor
|
|
40
40
|
}
|
|
41
|
-
}, /*#__PURE__*/React.createElement(
|
|
41
|
+
}, /*#__PURE__*/React.createElement(_.Card, {
|
|
42
42
|
id: id,
|
|
43
|
-
className: [baseClassName, componentClassName, userClassName,
|
|
43
|
+
className: [baseClassName, componentClassName, userClassName, `y-${backgroundColor}`].filter(e => e).join(' '),
|
|
44
44
|
style: style
|
|
45
45
|
}, children));
|
|
46
46
|
};
|
|
@@ -65,24 +65,19 @@ Conversation.propTypes = {
|
|
|
65
65
|
* The base color to their messages component
|
|
66
66
|
*/
|
|
67
67
|
theirColor: _propTypes.default.string,
|
|
68
|
-
/**
|
|
69
|
-
* The component background color
|
|
70
|
-
*/
|
|
71
|
-
backgroundColor: _propTypes.default.string,
|
|
72
68
|
/**
|
|
73
69
|
* The children JSX
|
|
74
70
|
*/
|
|
75
71
|
children: _propTypes.default.node,
|
|
76
72
|
/**
|
|
77
|
-
*
|
|
73
|
+
* The background color
|
|
78
74
|
*/
|
|
79
|
-
|
|
75
|
+
backgroundColor: _propTypes.default.string
|
|
80
76
|
};
|
|
81
77
|
Conversation.defaultProps = {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
hasTriangle: false
|
|
78
|
+
ourColor: 'main',
|
|
79
|
+
theirColor: 'main2',
|
|
80
|
+
backgroundColor: 'background-near'
|
|
86
81
|
};
|
|
87
82
|
Conversation.Message = _common.Message;
|
|
88
83
|
var _default = Conversation;
|
|
@@ -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 _useConversation = _interopRequireDefault(require("../../useConversation"));
|
|
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); }
|
|
@@ -38,21 +39,19 @@ const Message = _ref => {
|
|
|
38
39
|
ourColor,
|
|
39
40
|
theirColor
|
|
40
41
|
} = (0, _useConversation.default)();
|
|
41
|
-
return /*#__PURE__*/React.createElement(
|
|
42
|
+
return /*#__PURE__*/React.createElement(_.Card.Section, {
|
|
42
43
|
id: id,
|
|
43
|
-
className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from === 'ours' && 'ours'
|
|
44
|
+
className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from === 'ours' && 'ours'].filter(e => e).join(' '),
|
|
44
45
|
style: style
|
|
45
|
-
}, /*#__PURE__*/React.createElement("
|
|
46
|
-
className:
|
|
47
|
-
}, /*#__PURE__*/React.createElement("
|
|
48
|
-
className: "
|
|
49
|
-
},
|
|
46
|
+
}, sender && /*#__PURE__*/React.createElement("p", {
|
|
47
|
+
className: "sender"
|
|
48
|
+
}, sender, ":"), /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "message-content"
|
|
50
|
+
}, /*#__PURE__*/React.createElement("p", null, message), attachment && /*#__PURE__*/React.createElement("div", {
|
|
50
51
|
className: `attachment y-${attachmentColor}`
|
|
51
52
|
}, /*#__PURE__*/React.createElement("span", {
|
|
52
|
-
className: "
|
|
53
|
-
}, attachmentIcon), /*#__PURE__*/React.createElement("p",
|
|
54
|
-
className: "ml-v"
|
|
55
|
-
}, attachment))));
|
|
53
|
+
className: "icon"
|
|
54
|
+
}, attachmentIcon), /*#__PURE__*/React.createElement("p", null, attachment))));
|
|
56
55
|
};
|
|
57
56
|
Message.propTypes = {
|
|
58
57
|
/**
|
|
@@ -95,7 +94,7 @@ Message.propTypes = {
|
|
|
95
94
|
Message.defaultProps = {
|
|
96
95
|
from: 'theirs',
|
|
97
96
|
attachmentIcon: 'A',
|
|
98
|
-
attachmentColor: '
|
|
97
|
+
attachmentColor: 'interactive'
|
|
99
98
|
};
|
|
100
99
|
var _default = Message;
|
|
101
100
|
exports.default = _default;
|
|
@@ -1,154 +1,50 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
/* stylelint-disable selector-max-compound-selectors -- exception */
|
|
3
2
|
|
|
4
3
|
@use "@pareto-engineering/bem";
|
|
5
4
|
@use "@pareto-engineering/styles/src/mixins";
|
|
6
5
|
@use "@pareto-engineering/styles/src/globals" as *;
|
|
7
6
|
|
|
8
|
-
$default-
|
|
9
|
-
$default-
|
|
7
|
+
$default-border-radius: var(--theme-default-border-radius);
|
|
8
|
+
$default-padding: var(--gap);
|
|
10
9
|
$default-message-max-width: calc(100% - 4 * #{$default-padding});
|
|
11
10
|
$default-message-min-width: 12em;
|
|
12
|
-
$default-message-border: var(--
|
|
13
|
-
$triangle-border-size: 15px;
|
|
14
|
-
$triangle-border-style: $triangle-border-size solid;
|
|
15
|
-
$triangle-border-style-subtracted: ($triangle-border-size - 1px) solid;
|
|
16
|
-
$triangle-border1: $triangle-border-style var(--paragraph);
|
|
17
|
-
$triangle-border2: $triangle-border-style transparent;
|
|
18
|
-
$triangle-border3: $triangle-border-style-subtracted var(--x);
|
|
19
|
-
$triangle-border4: $triangle-border-style-subtracted transparent;
|
|
20
|
-
$triangle-before-side:24px;
|
|
21
|
-
$triangle-before-bottom:-30px;
|
|
22
|
-
$triangle-after-bottom:-27px;
|
|
23
|
-
$triangle-after-side:25px;
|
|
11
|
+
$default-message-border: 1px solid var(--hard-background-cards);
|
|
24
12
|
|
|
25
13
|
.#{bem.$base}.conversation {
|
|
26
|
-
background
|
|
27
|
-
border-radius: var(--theme-border-radius);
|
|
14
|
+
background: var(--y);
|
|
28
15
|
display: flex;
|
|
29
16
|
flex-direction: column;
|
|
30
17
|
padding: $default-padding;
|
|
31
18
|
|
|
32
|
-
|
|
33
|
-
margin-bottom: $default-padding;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// >:nth-child(1) {
|
|
37
|
-
// animation-delay: 1s;
|
|
38
|
-
// }
|
|
39
|
-
// >:nth-child(2) {
|
|
40
|
-
// animation-delay: 3s;
|
|
41
|
-
// }
|
|
42
|
-
|
|
43
|
-
&.has-triangle {
|
|
44
|
-
padding-bottom: calc(#{$default-padding} * 2);
|
|
45
|
-
.#{bem.$base}.message {
|
|
46
|
-
::before {
|
|
47
|
-
border-bottom: $triangle-border2;
|
|
48
|
-
border-left: $triangle-border2;
|
|
49
|
-
border-right: $triangle-border1;
|
|
50
|
-
border-top: $triangle-border1;
|
|
51
|
-
bottom: $triangle-before-bottom;
|
|
52
|
-
content: "";
|
|
53
|
-
height: 0;
|
|
54
|
-
position: absolute;
|
|
55
|
-
right: $triangle-before-side;
|
|
56
|
-
width: 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
::after {
|
|
60
|
-
border-bottom: $triangle-border4;
|
|
61
|
-
border-left: $triangle-border4;
|
|
62
|
-
border-right: $triangle-border3;
|
|
63
|
-
border-top: $triangle-border3;
|
|
64
|
-
bottom: $triangle-after-bottom;
|
|
65
|
-
content: "";
|
|
66
|
-
height: 0;
|
|
67
|
-
position: absolute;
|
|
68
|
-
right: $triangle-after-side;
|
|
69
|
-
width: 0;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&:not(.ours) {
|
|
73
|
-
::before {
|
|
74
|
-
border-bottom: $triangle-border2;
|
|
75
|
-
border-left: $triangle-border1;
|
|
76
|
-
border-right: $triangle-border2;
|
|
77
|
-
border-top: $triangle-border1;
|
|
78
|
-
bottom: $triangle-before-bottom;
|
|
79
|
-
content: "";
|
|
80
|
-
height: 0;
|
|
81
|
-
left: $triangle-before-side;
|
|
82
|
-
position: absolute;
|
|
83
|
-
width: 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
::after {
|
|
87
|
-
border-bottom: $triangle-border4;
|
|
88
|
-
border-left: $triangle-border3;
|
|
89
|
-
border-right: $triangle-border4;
|
|
90
|
-
border-top: $triangle-border3;
|
|
91
|
-
bottom: $triangle-after-bottom;
|
|
92
|
-
content: "";
|
|
93
|
-
height: 0;
|
|
94
|
-
left: $triangle-after-side;
|
|
95
|
-
position: absolute;
|
|
96
|
-
width: 0;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.#{bem.$base}.message {
|
|
19
|
+
> .#{bem.$base}.message {
|
|
103
20
|
align-self: flex-start;
|
|
104
|
-
background-color: var(--x);
|
|
105
|
-
// animation: fadeIn 1s ease-in both;
|
|
106
|
-
border: $default-message-border;
|
|
107
|
-
border-radius: var(--theme-border-radius);
|
|
108
21
|
max-width: $default-message-max-width;
|
|
109
22
|
min-width: $default-message-min-width;
|
|
110
|
-
padding: $default-padding;
|
|
111
23
|
position: relative;
|
|
112
24
|
|
|
113
|
-
|
|
25
|
+
> .message-content {
|
|
26
|
+
background-color: var(--x);
|
|
27
|
+
border: $default-message-border;
|
|
28
|
+
border-radius: $default-border-radius;
|
|
114
29
|
display: flex;
|
|
115
30
|
flex-direction: column;
|
|
31
|
+
padding: 0 $default-padding;
|
|
116
32
|
|
|
117
|
-
>p {
|
|
33
|
+
> p {
|
|
118
34
|
color: var(--on-x);
|
|
119
35
|
}
|
|
120
36
|
|
|
121
|
-
.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.attachment {
|
|
127
|
-
align-self: baseline;
|
|
128
|
-
background-color: var(--y);
|
|
37
|
+
> .attachment {
|
|
38
|
+
align-items: center;
|
|
39
|
+
align-self: flex-end;
|
|
129
40
|
display: flex;
|
|
130
41
|
flex-direction: row;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
> p {
|
|
134
|
-
margin-bottom: 0;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
> img {
|
|
138
|
-
width: 40px;
|
|
139
|
-
}
|
|
42
|
+
gap: calc($default-padding / 2);
|
|
140
43
|
}
|
|
141
44
|
}
|
|
45
|
+
|
|
142
46
|
&.#{bem.$base}.ours {
|
|
143
47
|
align-self: flex-end;
|
|
144
48
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
// mobile style
|
|
148
|
-
@include mixins.media($to:$sm-md) {
|
|
149
|
-
.message {
|
|
150
|
-
margin-top: 2em;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
49
|
}
|
|
154
50
|
}
|
|
@@ -27,6 +27,10 @@ $default-spacing: var(--gap, 1em);
|
|
|
27
27
|
&:first-child {
|
|
28
28
|
margin-left: $default-spacing;
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
&:last-child {
|
|
32
|
+
margin-right: $default-spacing;
|
|
33
|
+
}
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
@include mixins.media($from: $sm-md) {
|
|
@@ -42,6 +46,10 @@ $default-spacing: var(--gap, 1em);
|
|
|
42
46
|
&:first-child {
|
|
43
47
|
margin-left: unset;
|
|
44
48
|
}
|
|
49
|
+
|
|
50
|
+
&:last-child {
|
|
51
|
+
margin-right: unset;
|
|
52
|
+
}
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
}
|
|
@@ -29,6 +29,7 @@ const Button = _ref => {
|
|
|
29
29
|
isGhost,
|
|
30
30
|
isSimple,
|
|
31
31
|
isGradient,
|
|
32
|
+
isSpaced,
|
|
32
33
|
arrowDirection,
|
|
33
34
|
...otherProps
|
|
34
35
|
} = _ref;
|
|
@@ -37,7 +38,7 @@ const Button = _ref => {
|
|
|
37
38
|
}, []);
|
|
38
39
|
return /*#__PURE__*/React.createElement("button", _extends({
|
|
39
40
|
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(' '),
|
|
41
|
+
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
42
|
style: style,
|
|
42
43
|
type: "button"
|
|
43
44
|
}, otherProps), isLoading ? /*#__PURE__*/React.createElement(_.LoadingCircle, {
|
|
@@ -80,6 +81,10 @@ Button.propTypes = {
|
|
|
80
81
|
* Should this button have a gradient
|
|
81
82
|
*/
|
|
82
83
|
isGradient: _propTypes.default.bool,
|
|
84
|
+
/**
|
|
85
|
+
* Should this button be spaced
|
|
86
|
+
*/
|
|
87
|
+
isSpaced: _propTypes.default.bool,
|
|
83
88
|
/**
|
|
84
89
|
* The button color
|
|
85
90
|
*/
|
|
@@ -30,7 +30,7 @@ $default-animation-time: .31s;
|
|
|
30
30
|
vertical-align: middle;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
&:hover {
|
|
33
|
+
&:hover:not(:disabled) {
|
|
34
34
|
&::after {
|
|
35
35
|
--final-position: 50%;
|
|
36
36
|
animation: animateArrow $default-animation-time forwards;
|
|
@@ -46,7 +46,7 @@ $default-animation-time: .31s;
|
|
|
46
46
|
vertical-align: middle;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
&:hover {
|
|
49
|
+
&:hover:not(:disabled) {
|
|
50
50
|
&::before {
|
|
51
51
|
--final-position: -50%;
|
|
52
52
|
animation: animateArrow $default-animation-time forwards;
|
|
@@ -104,6 +104,11 @@ $default-animation-time: .31s;
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
&.#{bem.$modifier-spaced} {
|
|
108
|
+
margin-bottom: var(--spacing-2);
|
|
109
|
+
margin-top: var(--spacing-2);
|
|
110
|
+
}
|
|
111
|
+
|
|
107
112
|
&.#{bem.$modifier-simple} {
|
|
108
113
|
background: transparent;
|
|
109
114
|
border: 1px solid transparent;
|
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,8 +24,6 @@ const ThemeSelector = _ref => {
|
|
|
24
24
|
id,
|
|
25
25
|
className: userClassName,
|
|
26
26
|
style,
|
|
27
|
-
// children
|
|
28
|
-
|
|
29
27
|
themes,
|
|
30
28
|
iconMap
|
|
31
29
|
} = _ref;
|
|
@@ -47,7 +45,7 @@ const ThemeSelector = _ref => {
|
|
|
47
45
|
style: style,
|
|
48
46
|
onClick: loopThemes
|
|
49
47
|
}, /*#__PURE__*/React.createElement("span", {
|
|
50
|
-
className: "
|
|
48
|
+
className: "icon"
|
|
51
49
|
}, iconMap[userTheme]), /*#__PURE__*/React.createElement("span", null, userTheme));
|
|
52
50
|
};
|
|
53
51
|
ThemeSelector.propTypes = {
|
|
@@ -63,11 +61,6 @@ ThemeSelector.propTypes = {
|
|
|
63
61
|
* The React-written, css properties for this element.
|
|
64
62
|
*/
|
|
65
63
|
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
66
|
-
/**
|
|
67
|
-
* The children JSX
|
|
68
|
-
*/
|
|
69
|
-
// children: PropTypes.node,
|
|
70
|
-
|
|
71
64
|
/**
|
|
72
65
|
* The themes and the order in which they appear
|
|
73
66
|
*/
|
|
@@ -80,9 +73,9 @@ ThemeSelector.propTypes = {
|
|
|
80
73
|
ThemeSelector.defaultProps = {
|
|
81
74
|
themes: ['light', 'dark'],
|
|
82
75
|
iconMap: {
|
|
83
|
-
dark: '
|
|
76
|
+
dark: 'd',
|
|
84
77
|
// sun,
|
|
85
|
-
light: '
|
|
78
|
+
light: 'T' // moon,
|
|
86
79
|
}
|
|
87
80
|
};
|
|
88
81
|
var _default = ThemeSelector;
|
|
@@ -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');
|