@pareto-engineering/design-system 2.0.0-alpha.55 → 2.0.0-alpha.56
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/Alert/Alert.js +141 -0
- package/dist/cjs/a/Alert/index.js +15 -0
- package/dist/cjs/a/Alert/styles.scss +74 -0
- package/dist/cjs/a/index.js +9 -1
- package/dist/cjs/f/fields/IntlTelInput/IntlTelInput.js +170 -0
- package/dist/cjs/f/fields/IntlTelInput/index.js +15 -0
- package/dist/cjs/f/fields/IntlTelInput/styles.scss +37 -0
- package/dist/es/a/Alert/Alert.js +118 -0
- package/dist/es/a/Alert/index.js +2 -0
- package/dist/es/a/Alert/styles.scss +74 -0
- package/dist/es/a/index.js +2 -1
- package/dist/es/f/fields/IntlTelInput/IntlTelInput.js +152 -0
- package/dist/es/f/fields/IntlTelInput/index.js +2 -0
- package/dist/es/f/fields/IntlTelInput/styles.scss +37 -0
- package/package.json +2 -2
- package/src/__snapshots__/Storyshots.test.js.snap +323 -25
- package/src/stories/a/Alert.stories.jsx +75 -0
- package/src/stories/a/DotInfo.stories.jsx +2 -1
- package/src/stories/a/ProgressBar.stories.jsx +4 -1
- package/src/stories/a/Timestamp.stories.jsx +3 -1
- package/src/stories/b/Logo.stories.jsx +2 -1
- package/src/stories/b/QuestionDropdown.stories.jsx +3 -0
- package/src/stories/b/SocialMediaButton.stories.jsx +2 -1
- package/src/stories/b/Title.stories.jsx +2 -2
- package/src/stories/c/ContentSlides.stories.jsx +3 -1
- package/src/stories/c/Shortener.stories.jsx +9 -3
- package/src/stories/c/SocialMediaShareButton.stories.jsx +14 -6
- package/src/stories/f/ChoicesInput.stories.jsx +4 -1
- package/src/stories/f/Description.stories.jsx +11 -3
- package/src/stories/f/QueryCombobox.stories.jsx +2 -1
- package/src/stories/f/QuerySelect.stories.jsx +2 -1
- package/src/stories/f/RatingsInput.stories.jsx +8 -1
- package/src/stories/f/SelectInput.stories.jsx +2 -1
- package/src/stories/f/TextInput.stories.jsx +7 -1
- package/src/stories/f/TextareaInput.stories.jsx +6 -1
- package/src/ui/a/Alert/Alert.jsx +144 -0
- package/src/ui/a/Alert/index.js +2 -0
- package/src/ui/a/Alert/styles.scss +74 -0
- package/src/ui/a/index.js +1 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _b = require("../../b");
|
|
13
|
+
|
|
14
|
+
var _bem = _interopRequireDefault(require("@pareto-engineering/bem"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
21
|
+
|
|
22
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
|
|
28
|
+
// Local Definitions
|
|
29
|
+
var baseClassName = _bem.default.base;
|
|
30
|
+
var componentClassName = 'alert';
|
|
31
|
+
/**
|
|
32
|
+
* This is the component description.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
var Alert = _ref => {
|
|
36
|
+
var {
|
|
37
|
+
id,
|
|
38
|
+
className: userClassName,
|
|
39
|
+
style,
|
|
40
|
+
children,
|
|
41
|
+
type,
|
|
42
|
+
withCloseIcon,
|
|
43
|
+
primaryPosition,
|
|
44
|
+
secondaryPosition,
|
|
45
|
+
autoCloseMs,
|
|
46
|
+
width // ...otherProps
|
|
47
|
+
|
|
48
|
+
} = _ref;
|
|
49
|
+
(0, React.useLayoutEffect)(() => {
|
|
50
|
+
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
51
|
+
}, []);
|
|
52
|
+
var [hideAlert, setHideAlert] = (0, React.useState)(false);
|
|
53
|
+
|
|
54
|
+
var handleCloseAlert = () => setHideAlert(true);
|
|
55
|
+
|
|
56
|
+
(0, React.useEffect)(() => {
|
|
57
|
+
if (autoCloseMs) {
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
setHideAlert(true);
|
|
60
|
+
}, autoCloseMs);
|
|
61
|
+
}
|
|
62
|
+
}, [autoCloseMs]);
|
|
63
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
id: id,
|
|
65
|
+
className: [baseClassName, componentClassName, userClassName, "x-".concat(type), hideAlert && 'hide', primaryPosition, secondaryPosition].filter(e => e).join(' '),
|
|
66
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
67
|
+
'--width': width
|
|
68
|
+
}) // {...otherProps}
|
|
69
|
+
|
|
70
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: "bar"
|
|
72
|
+
}), withCloseIcon && /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "close"
|
|
74
|
+
}, /*#__PURE__*/React.createElement(_b.Button, {
|
|
75
|
+
isSimple: true,
|
|
76
|
+
color: "heading",
|
|
77
|
+
onClick: handleCloseAlert
|
|
78
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
79
|
+
className: "f-icons"
|
|
80
|
+
}, "Y"))), /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: "content"
|
|
82
|
+
}, children));
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
Alert.propTypes = {
|
|
86
|
+
/**
|
|
87
|
+
* The HTML id for this element
|
|
88
|
+
*/
|
|
89
|
+
id: _propTypes.default.string,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The HTML class names for this element
|
|
93
|
+
*/
|
|
94
|
+
className: _propTypes.default.string,
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The React-written, css properties for this element.
|
|
98
|
+
*/
|
|
99
|
+
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The children JSX
|
|
103
|
+
*/
|
|
104
|
+
children: _propTypes.default.node,
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Whether the alert should have a close Icon
|
|
108
|
+
*/
|
|
109
|
+
withCloseIcon: _propTypes.default.bool,
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The primary position of the alert
|
|
113
|
+
*/
|
|
114
|
+
primaryPosition: _propTypes.default.oneOf(['top', 'bottom', 'center']),
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The secondary position of the alert
|
|
118
|
+
*/
|
|
119
|
+
secondaryPosition: _propTypes.default.oneOf(['left', 'right']),
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The number milisseconds to wait for before closing the alert
|
|
123
|
+
*/
|
|
124
|
+
autoCloseMs: _propTypes.default.number,
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The type of the alert
|
|
128
|
+
*/
|
|
129
|
+
type: _propTypes.default.oneOf(['success', 'warning', 'error']),
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The width of the alert
|
|
133
|
+
*/
|
|
134
|
+
width: _propTypes.default.number
|
|
135
|
+
};
|
|
136
|
+
Alert.defaultProps = {
|
|
137
|
+
withCloseIcon: true,
|
|
138
|
+
primaryPosition: 'top'
|
|
139
|
+
};
|
|
140
|
+
var _default = Alert;
|
|
141
|
+
exports.default = _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Alert", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _Alert.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _Alert = _interopRequireDefault(require("./Alert"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
@use "@pareto-engineering/bem";
|
|
3
|
+
@use "@aztlan/stylebook/src/mixins";
|
|
4
|
+
@use "@aztlan/stylebook/src/globals" as *;
|
|
5
|
+
|
|
6
|
+
$default-padding: 1em;
|
|
7
|
+
$default-bar-height: .3em;
|
|
8
|
+
$default-alert-desktop-width: var(--width, 30em);
|
|
9
|
+
|
|
10
|
+
.#{bem.$base}.alert {
|
|
11
|
+
border: var(--theme-border);
|
|
12
|
+
padding-bottom: $default-padding * 1.5;
|
|
13
|
+
width: 100%;
|
|
14
|
+
position: absolute;
|
|
15
|
+
z-index: 1;
|
|
16
|
+
|
|
17
|
+
&.center {
|
|
18
|
+
top: 50%;
|
|
19
|
+
left: 50%;
|
|
20
|
+
transform: translate(-50%, -50%);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.top {
|
|
24
|
+
top: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.bottom {
|
|
28
|
+
bottom: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.right {
|
|
32
|
+
right: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.left {
|
|
36
|
+
left: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.hide {
|
|
40
|
+
display: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
>.bar {
|
|
44
|
+
background-color: var(--x);
|
|
45
|
+
height: $default-bar-height;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
>.close {
|
|
49
|
+
display: flex;
|
|
50
|
+
justify-content: flex-end;
|
|
51
|
+
|
|
52
|
+
span {
|
|
53
|
+
padding: $default-padding / 2;
|
|
54
|
+
font-size: calc(var(--s-2) * 1em);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.bar+.content {
|
|
59
|
+
padding-top: $default-padding * 1.5;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
>.content {
|
|
63
|
+
padding-inline: $default-padding;
|
|
64
|
+
|
|
65
|
+
.icon {
|
|
66
|
+
color: var(--x)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Desktop styles
|
|
71
|
+
@include mixins.media($from: $sm-md) {
|
|
72
|
+
width: $default-alert-desktop-width;
|
|
73
|
+
}
|
|
74
|
+
}
|
package/dist/cjs/a/index.js
CHANGED
|
@@ -177,6 +177,12 @@ Object.defineProperty(exports, "Popover", {
|
|
|
177
177
|
return _Popover.Popover;
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
|
+
Object.defineProperty(exports, "Alert", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function get() {
|
|
183
|
+
return _Alert.Alert;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
180
186
|
|
|
181
187
|
var _SVG = require("./SVG");
|
|
182
188
|
|
|
@@ -228,4 +234,6 @@ var _BackgroundGradient = require("./BackgroundGradient");
|
|
|
228
234
|
|
|
229
235
|
var _ContentTree = require("./ContentTree");
|
|
230
236
|
|
|
231
|
-
var _Popover = require("./Popover");
|
|
237
|
+
var _Popover = require("./Popover");
|
|
238
|
+
|
|
239
|
+
var _Alert = require("./Alert");
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _intlTelInput = _interopRequireDefault(require("intl-tel-input"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _bem = _interopRequireDefault(require("@pareto-engineering/bem"));
|
|
15
|
+
|
|
16
|
+
var _formik = require("formik");
|
|
17
|
+
|
|
18
|
+
var _common = require("../../common");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
+
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
|
|
28
|
+
var baseClassName = _bem.default.base;
|
|
29
|
+
var componentClassName = 'intl-tel-input';
|
|
30
|
+
/**
|
|
31
|
+
* This is the component description.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
var IntlTelInput = _ref => {
|
|
35
|
+
var {
|
|
36
|
+
id,
|
|
37
|
+
className: userClassName,
|
|
38
|
+
style,
|
|
39
|
+
name,
|
|
40
|
+
label,
|
|
41
|
+
color,
|
|
42
|
+
labelColor,
|
|
43
|
+
validate,
|
|
44
|
+
oneInputLabel,
|
|
45
|
+
description,
|
|
46
|
+
disabled,
|
|
47
|
+
// placeholder,
|
|
48
|
+
optional,
|
|
49
|
+
autoComplete // ...otherProps
|
|
50
|
+
|
|
51
|
+
} = _ref;
|
|
52
|
+
(0, React.useLayoutEffect)(() => {
|
|
53
|
+
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
54
|
+
Promise.resolve().then(() => _interopRequireWildcard(require('intl-tel-input/build/css/intlTelInput.css')));
|
|
55
|
+
}, []);
|
|
56
|
+
var [field] = (0, _formik.useField)({
|
|
57
|
+
name,
|
|
58
|
+
validate
|
|
59
|
+
});
|
|
60
|
+
var input = (0, React.useRef)(null);
|
|
61
|
+
(0, React.useEffect)(() => {
|
|
62
|
+
var iti = (0, _intlTelInput.default)(input.current, {
|
|
63
|
+
separateDialCode: true,
|
|
64
|
+
customContainer: 'input-wrapper'
|
|
65
|
+
});
|
|
66
|
+
return () => iti.destroy();
|
|
67
|
+
}, [input.current]);
|
|
68
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
id: id,
|
|
70
|
+
className: [baseClassName, componentClassName, userClassName, "y-".concat(color)].filter(e => e).join(' '),
|
|
71
|
+
style: style // {...otherProps}
|
|
72
|
+
|
|
73
|
+
}, /*#__PURE__*/React.createElement(_common.FormLabel, {
|
|
74
|
+
className: [oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
|
|
75
|
+
name: name,
|
|
76
|
+
color: labelColor,
|
|
77
|
+
optional: optional
|
|
78
|
+
}, label), /*#__PURE__*/React.createElement("input", _extends({
|
|
79
|
+
id: name,
|
|
80
|
+
className: "input",
|
|
81
|
+
type: "tel",
|
|
82
|
+
disabled: disabled // placeholder={placeholder}
|
|
83
|
+
,
|
|
84
|
+
autoComplete: autoComplete,
|
|
85
|
+
ref: input
|
|
86
|
+
}, field)), /*#__PURE__*/React.createElement(_common.FormDescription, {
|
|
87
|
+
className: "v50 mt-v s-1",
|
|
88
|
+
description: description,
|
|
89
|
+
name: name
|
|
90
|
+
}));
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
IntlTelInput.propTypes = {
|
|
94
|
+
/**
|
|
95
|
+
* The HTML id for this element
|
|
96
|
+
*/
|
|
97
|
+
id: _propTypes.default.string,
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The HTML class names for this element
|
|
101
|
+
*/
|
|
102
|
+
className: _propTypes.default.string,
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The React-written, css properties for this element.
|
|
106
|
+
*/
|
|
107
|
+
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The input name (html - and Formik state)
|
|
111
|
+
*/
|
|
112
|
+
name: _propTypes.default.string.isRequired,
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The input label
|
|
116
|
+
*/
|
|
117
|
+
label: _propTypes.default.string.isRequired,
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The input label color
|
|
121
|
+
*/
|
|
122
|
+
labelColor: _propTypes.default.string,
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The input field validator function
|
|
126
|
+
*/
|
|
127
|
+
validate: _propTypes.default.func,
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* If the slide will only have one input
|
|
131
|
+
*/
|
|
132
|
+
oneInputLabel: _propTypes.default.bool,
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Input description
|
|
136
|
+
*/
|
|
137
|
+
description: _propTypes.default.string,
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Whether the text input should be disabled
|
|
141
|
+
*/
|
|
142
|
+
disabled: _propTypes.default.bool,
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The placeholder text for the input
|
|
146
|
+
*/
|
|
147
|
+
placeholder: _propTypes.default.string,
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The text input color
|
|
151
|
+
*/
|
|
152
|
+
color: _propTypes.default.string,
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Whether the input is optional or not
|
|
156
|
+
*/
|
|
157
|
+
optional: _propTypes.default.bool,
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The autoComplete value that the browser should watch for the input
|
|
161
|
+
* `https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete`
|
|
162
|
+
*/
|
|
163
|
+
autoComplete: _propTypes.default.string
|
|
164
|
+
};
|
|
165
|
+
IntlTelInput.defaultProps = {
|
|
166
|
+
color: 'background2',
|
|
167
|
+
disabled: false
|
|
168
|
+
};
|
|
169
|
+
var _default = IntlTelInput;
|
|
170
|
+
exports.default = _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "IntlTelInput", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _IntlTelInput.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _IntlTelInput = _interopRequireDefault(require("./IntlTelInput"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
@use "@pareto-engineering/bem";
|
|
3
|
+
|
|
4
|
+
$default-padding: 0.75em 0.75em 0.55em;
|
|
5
|
+
|
|
6
|
+
.#{bem.$base}.intl-tel-input {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
|
|
10
|
+
.input-wrapper {
|
|
11
|
+
width: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.input {
|
|
15
|
+
border: var(--theme-border-style) var(--dark-y);
|
|
16
|
+
background: var(--light-y);
|
|
17
|
+
color: var(--on-y);
|
|
18
|
+
padding: $default-padding;
|
|
19
|
+
width: 100%;
|
|
20
|
+
|
|
21
|
+
&::placeholder {
|
|
22
|
+
color: var(--metadata);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:not(:disabled):hover {
|
|
26
|
+
border: var(--theme-border-style) var(--light-background4);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:disabled {
|
|
30
|
+
background-color: var(--dark-y);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:focus {
|
|
34
|
+
background: var(--light-background4);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useState, useEffect, useLayoutEffect } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { Button } from "../../b";
|
|
6
|
+
import styleNames from '@pareto-engineering/bem'; // Local Definitions
|
|
7
|
+
|
|
8
|
+
const baseClassName = styleNames.base;
|
|
9
|
+
const componentClassName = 'alert';
|
|
10
|
+
/**
|
|
11
|
+
* This is the component description.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const Alert = ({
|
|
15
|
+
id,
|
|
16
|
+
className: userClassName,
|
|
17
|
+
style,
|
|
18
|
+
children,
|
|
19
|
+
type,
|
|
20
|
+
withCloseIcon,
|
|
21
|
+
primaryPosition,
|
|
22
|
+
secondaryPosition,
|
|
23
|
+
autoCloseMs,
|
|
24
|
+
width // ...otherProps
|
|
25
|
+
|
|
26
|
+
}) => {
|
|
27
|
+
useLayoutEffect(() => {
|
|
28
|
+
import("./styles.scss");
|
|
29
|
+
}, []);
|
|
30
|
+
const [hideAlert, setHideAlert] = useState(false);
|
|
31
|
+
|
|
32
|
+
const handleCloseAlert = () => setHideAlert(true);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (autoCloseMs) {
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
setHideAlert(true);
|
|
38
|
+
}, autoCloseMs);
|
|
39
|
+
}
|
|
40
|
+
}, [autoCloseMs]);
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
id: id,
|
|
43
|
+
className: [baseClassName, componentClassName, userClassName, `x-${type}`, hideAlert && 'hide', primaryPosition, secondaryPosition].filter(e => e).join(' '),
|
|
44
|
+
style: { ...style,
|
|
45
|
+
'--width': width
|
|
46
|
+
} // {...otherProps}
|
|
47
|
+
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "bar"
|
|
50
|
+
}), withCloseIcon && /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "close"
|
|
52
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
53
|
+
isSimple: true,
|
|
54
|
+
color: "heading",
|
|
55
|
+
onClick: handleCloseAlert
|
|
56
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
57
|
+
className: "f-icons"
|
|
58
|
+
}, "Y"))), /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: "content"
|
|
60
|
+
}, children));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
Alert.propTypes = {
|
|
64
|
+
/**
|
|
65
|
+
* The HTML id for this element
|
|
66
|
+
*/
|
|
67
|
+
id: PropTypes.string,
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The HTML class names for this element
|
|
71
|
+
*/
|
|
72
|
+
className: PropTypes.string,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The React-written, css properties for this element.
|
|
76
|
+
*/
|
|
77
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The children JSX
|
|
81
|
+
*/
|
|
82
|
+
children: PropTypes.node,
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Whether the alert should have a close Icon
|
|
86
|
+
*/
|
|
87
|
+
withCloseIcon: PropTypes.bool,
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The primary position of the alert
|
|
91
|
+
*/
|
|
92
|
+
primaryPosition: PropTypes.oneOf(['top', 'bottom', 'center']),
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The secondary position of the alert
|
|
96
|
+
*/
|
|
97
|
+
secondaryPosition: PropTypes.oneOf(['left', 'right']),
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The number milisseconds to wait for before closing the alert
|
|
101
|
+
*/
|
|
102
|
+
autoCloseMs: PropTypes.number,
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The type of the alert
|
|
106
|
+
*/
|
|
107
|
+
type: PropTypes.oneOf(['success', 'warning', 'error']),
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The width of the alert
|
|
111
|
+
*/
|
|
112
|
+
width: PropTypes.number
|
|
113
|
+
};
|
|
114
|
+
Alert.defaultProps = {
|
|
115
|
+
withCloseIcon: true,
|
|
116
|
+
primaryPosition: 'top'
|
|
117
|
+
};
|
|
118
|
+
export default Alert;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
@use "@pareto-engineering/bem";
|
|
3
|
+
@use "@aztlan/stylebook/src/mixins";
|
|
4
|
+
@use "@aztlan/stylebook/src/globals" as *;
|
|
5
|
+
|
|
6
|
+
$default-padding: 1em;
|
|
7
|
+
$default-bar-height: .3em;
|
|
8
|
+
$default-alert-desktop-width: var(--width, 30em);
|
|
9
|
+
|
|
10
|
+
.#{bem.$base}.alert {
|
|
11
|
+
border: var(--theme-border);
|
|
12
|
+
padding-bottom: $default-padding * 1.5;
|
|
13
|
+
width: 100%;
|
|
14
|
+
position: absolute;
|
|
15
|
+
z-index: 1;
|
|
16
|
+
|
|
17
|
+
&.center {
|
|
18
|
+
top: 50%;
|
|
19
|
+
left: 50%;
|
|
20
|
+
transform: translate(-50%, -50%);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.top {
|
|
24
|
+
top: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.bottom {
|
|
28
|
+
bottom: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.right {
|
|
32
|
+
right: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.left {
|
|
36
|
+
left: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.hide {
|
|
40
|
+
display: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
>.bar {
|
|
44
|
+
background-color: var(--x);
|
|
45
|
+
height: $default-bar-height;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
>.close {
|
|
49
|
+
display: flex;
|
|
50
|
+
justify-content: flex-end;
|
|
51
|
+
|
|
52
|
+
span {
|
|
53
|
+
padding: $default-padding / 2;
|
|
54
|
+
font-size: calc(var(--s-2) * 1em);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.bar+.content {
|
|
59
|
+
padding-top: $default-padding * 1.5;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
>.content {
|
|
63
|
+
padding-inline: $default-padding;
|
|
64
|
+
|
|
65
|
+
.icon {
|
|
66
|
+
color: var(--x)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Desktop styles
|
|
71
|
+
@include mixins.media($from: $sm-md) {
|
|
72
|
+
width: $default-alert-desktop-width;
|
|
73
|
+
}
|
|
74
|
+
}
|
package/dist/es/a/index.js
CHANGED
|
@@ -23,4 +23,5 @@ export { OvalIllustration } from "./OvalIllustration";
|
|
|
23
23
|
export { SnapScroller } from "./SnapScroller";
|
|
24
24
|
export { BackgroundGradient } from "./BackgroundGradient";
|
|
25
25
|
export { ContentTree } from "./ContentTree";
|
|
26
|
-
export { Popover } from "./Popover";
|
|
26
|
+
export { Popover } from "./Popover";
|
|
27
|
+
export { Alert } from "./Alert";
|