@superdispatch/ui-lab 0.15.0 → 0.16.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/dist-node/index.js +1497 -140
- package/dist-node/index.js.map +1 -1
- package/dist-src/index.js +3 -1
- package/dist-src/v5/alert/Alert.js +43 -0
- package/dist-src/v5/banner/Banner.js +61 -0
- package/dist-src/v5/box/Box.js +153 -0
- package/dist-src/v5/button/Button.js +227 -0
- package/dist-src/v5/button-area/ButtonArea.js +48 -0
- package/dist-src/v5/description-item/DescriptionItem.js +75 -0
- package/dist-src/v5/file-drop-zone/FileDropZone.js +132 -0
- package/dist-src/v5/file-list-item/FileListItem.js +136 -0
- package/dist-src/v5/index.js +16 -0
- package/dist-src/v5/sidebar/Sidebar.js +66 -0
- package/dist-src/v5/sidebar/SidebarContainer.js +25 -0
- package/dist-src/v5/sidebar/SidebarDivider.js +15 -0
- package/dist-src/v5/sidebar/SidebarMenuItem.js +124 -0
- package/dist-src/v5/sidebar/SidebarMenuItemAction.js +26 -0
- package/dist-src/v5/sidebar/SidebarMenuItemAvatar.js +53 -0
- package/dist-src/v5/sidebar/SidebarMenuItemContext.js +21 -0
- package/dist-src/v5/sidebar/SidebarSubheader.js +41 -0
- package/dist-src/v5/text-box/TextBox.js +133 -0
- package/dist-src/v5/utils/RuleNormalizer.js +17 -0
- package/dist-src/v5/utils/mergeStyles.js +24 -0
- package/dist-types/index.d.ts +329 -9
- package/dist-web/index.js +1487 -130
- package/dist-web/index.js.map +1 -1
- package/package.json +3 -3
package/dist-src/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as v5 from "./v5/index.js";
|
|
1
2
|
export * from "./alert/Alert.js";
|
|
2
3
|
export * from "./banner/Banner.js";
|
|
3
4
|
export * from "./box/Box.js";
|
|
@@ -13,4 +14,5 @@ export * from "./sidebar/SidebarMenuItem.js";
|
|
|
13
14
|
export * from "./sidebar/SidebarMenuItemAction.js";
|
|
14
15
|
export * from "./sidebar/SidebarMenuItemAvatar.js";
|
|
15
16
|
export * from "./sidebar/SidebarSubheader.js";
|
|
16
|
-
export * from "./text-box/TextBox.js";
|
|
17
|
+
export * from "./text-box/TextBox.js";
|
|
18
|
+
export { v5 };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CheckCircle, Error, Info } from '@mui/icons-material';
|
|
2
|
+
import { Alert as MaterialAlert } from '@mui/lab';
|
|
3
|
+
import { Color } from '@superdispatch/ui';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import styled, { css } from 'styled-components';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
function colorMixin(textColor, backgroundColor, buttonHoverColor) {
|
|
9
|
+
return css(["color:", ";background-color:", ";& .MuiAlert-icon{color:", ";}& .MuiAlert-action{& .MuiIconButton-root{&:hover,&:active{color:", ";}}}"], textColor, backgroundColor, textColor, buttonHoverColor);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
var StyledAlert = /*#__PURE__*/styled(MaterialAlert).withConfig({
|
|
13
|
+
displayName: "Alert__StyledAlert",
|
|
14
|
+
componentId: "SD__sc-ahws81-0"
|
|
15
|
+
})(["&.MuiAlert-outlinedSuccess{", ";}&.MuiAlert-outlinedInfo{", ";}&.MuiAlert-outlinedWarning{", ";}&.MuiAlert-outlinedError{", ";}& .MuiAlert-icon{opacity:1;padding:8px 0;font-size:24px;}& .MuiAlert-action{display:block;padding-top:5px;margin-right:-3px;& .MuiIconButton-root{& .MuiSvgIcon-root{font-size:24px;}}}"], /*#__PURE__*/colorMixin(Color.Green500, Color.Green50, Color.Green400), /*#__PURE__*/colorMixin(Color.Blue500, Color.Blue50, Color.Blue400), /*#__PURE__*/colorMixin(Color.Yellow500, Color.Yellow50, Color.Yellow400), /*#__PURE__*/colorMixin(Color.Red500, Color.Red50, Color.Red400));
|
|
16
|
+
|
|
17
|
+
function toMaterialSeverity(severity) {
|
|
18
|
+
return severity === 'info' ? 'info' : severity === 'caution' ? 'warning' : severity === 'critical' ? 'error' : 'success';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var iconMapping = {
|
|
22
|
+
success: /*#__PURE__*/_jsx(CheckCircle, {}),
|
|
23
|
+
info: /*#__PURE__*/_jsx(Info, {}),
|
|
24
|
+
error: /*#__PURE__*/_jsx(Error, {})
|
|
25
|
+
};
|
|
26
|
+
export var Alert = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
27
|
+
var {
|
|
28
|
+
children,
|
|
29
|
+
onClose: _onClose,
|
|
30
|
+
severity = 'positive'
|
|
31
|
+
} = _ref;
|
|
32
|
+
return /*#__PURE__*/_jsx(StyledAlert, {
|
|
33
|
+
ref: ref,
|
|
34
|
+
variant: "outlined",
|
|
35
|
+
iconMapping: iconMapping,
|
|
36
|
+
severity: toMaterialSeverity(severity),
|
|
37
|
+
onClose: () => {
|
|
38
|
+
_onClose === null || _onClose === void 0 ? void 0 : _onClose();
|
|
39
|
+
},
|
|
40
|
+
children: children
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
if (process.env.NODE_ENV !== "production") Alert.displayName = "Alert";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children"],
|
|
4
|
+
_excluded2 = ["in"];
|
|
5
|
+
import { Color } from '@superdispatch/ui';
|
|
6
|
+
import { forwardRef, useEffect, useState } from 'react';
|
|
7
|
+
import { CSSTransition } from 'react-transition-group'; // eslint-disable-next-line import/no-internal-modules
|
|
8
|
+
|
|
9
|
+
import styled, { css, keyframes } from 'styled-components';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
|
|
12
|
+
function enterMixin(border) {
|
|
13
|
+
return css(["min-height:56px;color:", ";background-color:", ";border-", ":1px #dfe3e8 solid;"], Color.Dark500, Color.White, border);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function enterAnimation(border) {
|
|
17
|
+
return keyframes(["0%{min-height:0;color:", ";background-color:", ";}50%{min-height:56px;color:", ";background-color:", ";}70%{min-height:56px;color:", ";background-color:", ";}100%{", "}"], Color.White, Color.Dark500, Color.White, Color.Dark500, Color.White, Color.Dark500, enterMixin(border));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var CustomTransition = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
21
|
+
var {
|
|
22
|
+
children
|
|
23
|
+
} = _ref,
|
|
24
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
|
|
26
|
+
return /*#__PURE__*/_jsx(CSSTransition, _objectSpread(_objectSpread({}, props), {}, {
|
|
27
|
+
ref: ref,
|
|
28
|
+
timeout: 3000,
|
|
29
|
+
classNames: props.className,
|
|
30
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
31
|
+
children: children
|
|
32
|
+
})
|
|
33
|
+
}));
|
|
34
|
+
});
|
|
35
|
+
if (process.env.NODE_ENV !== "production") CustomTransition.displayName = "CustomTransition";
|
|
36
|
+
var BannerContent = /*#__PURE__*/styled(CustomTransition).withConfig({
|
|
37
|
+
displayName: "Banner__BannerContent",
|
|
38
|
+
componentId: "SD__sc-1y16295-0"
|
|
39
|
+
})(_ref2 => {
|
|
40
|
+
var {
|
|
41
|
+
border = 'bottom'
|
|
42
|
+
} = _ref2;
|
|
43
|
+
return css(["height:0;width:100%;overflow:hidden;display:flex;align-items:center;justify-content:center;color:", ";background-color:", ";&-enter-active{animation:", " 2s 1s forwards;}&-enter-done{", ";}&-exit{", ";}&-exit-active{min-height:0;transition:min-height 2s 1s;}"], Color.White, Color.White, enterAnimation(border), enterMixin(border), enterMixin(border));
|
|
44
|
+
});
|
|
45
|
+
export var Banner = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
46
|
+
var {
|
|
47
|
+
in: inProp
|
|
48
|
+
} = _ref3,
|
|
49
|
+
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
50
|
+
|
|
51
|
+
var [isIn, setIn] = useState(false); // transition is not triggered on initial render with `in: true`
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
setIn(!!inProp);
|
|
55
|
+
}, [inProp]);
|
|
56
|
+
return /*#__PURE__*/_jsx(BannerContent, _objectSpread({
|
|
57
|
+
ref: ref,
|
|
58
|
+
in: isIn
|
|
59
|
+
}, props));
|
|
60
|
+
});
|
|
61
|
+
if (process.env.NODE_ENV !== "production") Banner.displayName = "Banner";
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { v5 } from '@superdispatch/ui';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { createRuleNormalizer } from "../utils/RuleNormalizer.js";
|
|
4
|
+
var {
|
|
5
|
+
Color,
|
|
6
|
+
isColorProp,
|
|
7
|
+
parseResponsiveProp,
|
|
8
|
+
parseSpaceProp
|
|
9
|
+
} = v5;
|
|
10
|
+
|
|
11
|
+
//
|
|
12
|
+
// Colors
|
|
13
|
+
//
|
|
14
|
+
function normalizeColor(input) {
|
|
15
|
+
return isColorProp(input) ? Color[input] : undefined;
|
|
16
|
+
} //
|
|
17
|
+
// Space
|
|
18
|
+
//
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
function parseSpace(space) {
|
|
22
|
+
return "".concat(parseSpaceProp(space), "px");
|
|
23
|
+
} //
|
|
24
|
+
// Margins
|
|
25
|
+
//
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
function parseMargin(input) {
|
|
29
|
+
if (input === 'auto') return input;
|
|
30
|
+
var prefix = '';
|
|
31
|
+
|
|
32
|
+
if (typeof input == 'string' && input.startsWith('-')) {
|
|
33
|
+
prefix = '-';
|
|
34
|
+
input = input.slice(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return prefix + parseSpace(input);
|
|
38
|
+
} //
|
|
39
|
+
// Borders
|
|
40
|
+
//
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
var normalizeBorderRadius = /*#__PURE__*/createRuleNormalizer({
|
|
44
|
+
none: 0,
|
|
45
|
+
small: 4
|
|
46
|
+
});
|
|
47
|
+
var normalizeBorderWidth = /*#__PURE__*/createRuleNormalizer({
|
|
48
|
+
none: 0,
|
|
49
|
+
small: 1,
|
|
50
|
+
medium: 2,
|
|
51
|
+
large: 4
|
|
52
|
+
}); //
|
|
53
|
+
// Rules
|
|
54
|
+
//
|
|
55
|
+
|
|
56
|
+
var normalizers = {
|
|
57
|
+
display: undefined,
|
|
58
|
+
color: normalizeColor,
|
|
59
|
+
backgroundColor: normalizeColor,
|
|
60
|
+
borderColor: normalizeColor,
|
|
61
|
+
borderTopColor: normalizeColor,
|
|
62
|
+
borderLeftColor: normalizeColor,
|
|
63
|
+
borderRightColor: normalizeColor,
|
|
64
|
+
borderBottomColor: normalizeColor,
|
|
65
|
+
borderWidth: normalizeBorderWidth,
|
|
66
|
+
borderTopWidth: normalizeBorderWidth,
|
|
67
|
+
borderLeftWidth: normalizeBorderWidth,
|
|
68
|
+
borderRightWidth: normalizeBorderWidth,
|
|
69
|
+
borderBottomWidth: normalizeBorderWidth,
|
|
70
|
+
margin: parseMargin,
|
|
71
|
+
marginTop: parseMargin,
|
|
72
|
+
marginLeft: parseMargin,
|
|
73
|
+
marginRight: parseMargin,
|
|
74
|
+
marginBottom: parseMargin,
|
|
75
|
+
padding: parseSpace,
|
|
76
|
+
paddingTop: parseSpace,
|
|
77
|
+
paddingLeft: parseSpace,
|
|
78
|
+
paddingRight: parseSpace,
|
|
79
|
+
paddingBottom: parseSpace,
|
|
80
|
+
borderRadius: normalizeBorderRadius,
|
|
81
|
+
borderTopLeftRadius: normalizeBorderRadius,
|
|
82
|
+
borderTopRightRadius: normalizeBorderRadius,
|
|
83
|
+
borderBottomLeftRadius: normalizeBorderRadius,
|
|
84
|
+
borderBottomRightRadius: normalizeBorderRadius,
|
|
85
|
+
fontSize: undefined,
|
|
86
|
+
width: undefined,
|
|
87
|
+
maxWidth: undefined,
|
|
88
|
+
minWidth: undefined,
|
|
89
|
+
height: undefined,
|
|
90
|
+
maxHeight: undefined,
|
|
91
|
+
minHeight: undefined,
|
|
92
|
+
overflow: undefined,
|
|
93
|
+
overflowY: undefined,
|
|
94
|
+
overflowX: undefined,
|
|
95
|
+
top: undefined,
|
|
96
|
+
left: undefined,
|
|
97
|
+
right: undefined,
|
|
98
|
+
bottom: undefined,
|
|
99
|
+
position: undefined
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
function injectRule(styles, key, breakpoint, value, normalizer) {
|
|
103
|
+
if (normalizer != null) value = normalizer(value);
|
|
104
|
+
|
|
105
|
+
if (value != null) {
|
|
106
|
+
var rules = styles[breakpoint];
|
|
107
|
+
|
|
108
|
+
if (typeof rules != 'object') {
|
|
109
|
+
rules = {};
|
|
110
|
+
styles[breakpoint] = rules;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
rules[key] = String(value);
|
|
114
|
+
}
|
|
115
|
+
} //
|
|
116
|
+
// Box
|
|
117
|
+
//
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
export var Box = /*#__PURE__*/styled.div.withConfig({
|
|
121
|
+
displayName: "Box",
|
|
122
|
+
componentId: "SD__sc-1cy411s-0"
|
|
123
|
+
})(props => {
|
|
124
|
+
var {
|
|
125
|
+
breakpoints
|
|
126
|
+
} = props.theme;
|
|
127
|
+
var xs = breakpoints.up('xs');
|
|
128
|
+
var sm = breakpoints.up('sm');
|
|
129
|
+
var md = breakpoints.up('md');
|
|
130
|
+
var styles = {
|
|
131
|
+
margin: 0,
|
|
132
|
+
padding: 0,
|
|
133
|
+
borderWidth: 0,
|
|
134
|
+
borderStyle: 'solid'
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
for (var k in props) {
|
|
138
|
+
if (Object.prototype.hasOwnProperty.call(props, k) && k in normalizers) {
|
|
139
|
+
var key = k;
|
|
140
|
+
var prop = props[key];
|
|
141
|
+
|
|
142
|
+
if (prop != null) {
|
|
143
|
+
var [mobile, tablet, desktop] = parseResponsiveProp(prop);
|
|
144
|
+
var normalizer = normalizers[key];
|
|
145
|
+
injectRule(styles, key, xs, mobile, normalizer);
|
|
146
|
+
injectRule(styles, key, sm, tablet, normalizer);
|
|
147
|
+
injectRule(styles, key, md, desktop, normalizer);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return styles;
|
|
153
|
+
});
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children", "endIcon", "startIcon", "tabIndex", "active", "pending", "disabled", "size", "fullWidth", "variant"],
|
|
4
|
+
_excluded2 = ["type"],
|
|
5
|
+
_excluded3 = ["href", "target"];
|
|
6
|
+
import { CircularProgress } from '@mui/material';
|
|
7
|
+
import { Color } from '@superdispatch/ui';
|
|
8
|
+
import { forwardRef } from 'react';
|
|
9
|
+
import styled, { css } from 'styled-components';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
|
|
13
|
+
function createButtonVariables(size, _ref) {
|
|
14
|
+
var {
|
|
15
|
+
fontSize = size === 'large' ? 16 : 14,
|
|
16
|
+
lineHeight = size === 'large' ? 24 : 20,
|
|
17
|
+
fontSizeMobile = size === 'large' ? 18 : 16,
|
|
18
|
+
lineHeightMobile = size === 'large' ? 28 : 24,
|
|
19
|
+
paddingX = size === 'large' ? 32 : 16,
|
|
20
|
+
paddingY = size === 'large' ? 8 : size === 'small' ? 2 : 6,
|
|
21
|
+
paddingXMobile = size === 'large' ? 64 : 24,
|
|
22
|
+
paddingYMobile = size === 'large' ? 14 : size === 'small' ? 4 : 10,
|
|
23
|
+
textColor = Color.Transparent,
|
|
24
|
+
textColorHovered = textColor,
|
|
25
|
+
textColorDisabled = textColor,
|
|
26
|
+
outlineColor = Color.Transparent,
|
|
27
|
+
borderColor = Color.Transparent,
|
|
28
|
+
borderColorHovered = borderColor,
|
|
29
|
+
borderColorDisabled = borderColor,
|
|
30
|
+
backgroundColor = Color.Transparent,
|
|
31
|
+
backgroundColorHovered = backgroundColor,
|
|
32
|
+
backgroundColorActive = backgroundColorHovered,
|
|
33
|
+
backgroundColorDisabled = backgroundColor
|
|
34
|
+
} = _ref;
|
|
35
|
+
return {
|
|
36
|
+
paddingX,
|
|
37
|
+
paddingY,
|
|
38
|
+
fontSize,
|
|
39
|
+
lineHeight,
|
|
40
|
+
paddingXMobile,
|
|
41
|
+
paddingYMobile,
|
|
42
|
+
fontSizeMobile,
|
|
43
|
+
lineHeightMobile,
|
|
44
|
+
textColor,
|
|
45
|
+
borderColor,
|
|
46
|
+
outlineColor,
|
|
47
|
+
backgroundColor,
|
|
48
|
+
textColorHovered,
|
|
49
|
+
borderColorHovered,
|
|
50
|
+
backgroundColorHovered,
|
|
51
|
+
backgroundColorActive,
|
|
52
|
+
textColorDisabled,
|
|
53
|
+
borderColorDisabled,
|
|
54
|
+
backgroundColorDisabled
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getDefaultVariables(size) {
|
|
59
|
+
return createButtonVariables(size, {
|
|
60
|
+
textColor: Color.White,
|
|
61
|
+
outlineColor: Color.Blue100,
|
|
62
|
+
backgroundColor: Color.Blue300,
|
|
63
|
+
textColorHovered: Color.White,
|
|
64
|
+
backgroundColorHovered: Color.Blue500,
|
|
65
|
+
backgroundColorActive: Color.Blue400,
|
|
66
|
+
backgroundColorDisabled: Color.Blue100
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function getPrimaryVariables(size) {
|
|
71
|
+
return getDefaultVariables(size);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function getNeutralVariables(size) {
|
|
75
|
+
return createButtonVariables(size, {
|
|
76
|
+
textColor: Color.Dark500,
|
|
77
|
+
borderColor: Color.Silver500,
|
|
78
|
+
outlineColor: Color.Blue100,
|
|
79
|
+
backgroundColor: Color.White,
|
|
80
|
+
textColorHovered: Color.Blue300,
|
|
81
|
+
borderColorHovered: Color.Blue300,
|
|
82
|
+
backgroundColorHovered: Color.Blue50,
|
|
83
|
+
backgroundColorActive: Color.Blue75,
|
|
84
|
+
textColorDisabled: Color.Silver500
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function getCriticalVariables(size) {
|
|
89
|
+
return createButtonVariables(size, {
|
|
90
|
+
textColor: Color.Red300,
|
|
91
|
+
borderColor: Color.Red300,
|
|
92
|
+
outlineColor: Color.Red75,
|
|
93
|
+
backgroundColor: Color.Red50,
|
|
94
|
+
backgroundColorHovered: Color.Red75,
|
|
95
|
+
backgroundColorActive: Color.Red100,
|
|
96
|
+
textColorDisabled: Color.Red100,
|
|
97
|
+
borderColorDisabled: Color.Red100,
|
|
98
|
+
backgroundColorDisabled: Color.Red50
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function getTextVariables(size) {
|
|
103
|
+
return createButtonVariables(size, {
|
|
104
|
+
textColor: Color.Blue400,
|
|
105
|
+
outlineColor: Color.Blue100,
|
|
106
|
+
textColorHovered: Color.Blue500,
|
|
107
|
+
backgroundColorHovered: Color.Blue50,
|
|
108
|
+
backgroundColorActive: Color.Blue75,
|
|
109
|
+
textColorDisabled: Color.Blue100
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function getInvertedVariables(size) {
|
|
114
|
+
return createButtonVariables(size, {
|
|
115
|
+
textColor: Color.White,
|
|
116
|
+
outlineColor: Color.White40,
|
|
117
|
+
backgroundColor: Color.White20,
|
|
118
|
+
textColorHovered: Color.White,
|
|
119
|
+
backgroundColorHovered: Color.White40,
|
|
120
|
+
backgroundColorActive: Color.White20,
|
|
121
|
+
textColorDisabled: Color.White50,
|
|
122
|
+
backgroundColorDisabled: Color.White08
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
var ButtonRoot = /*#__PURE__*/styled.button.withConfig({
|
|
127
|
+
displayName: "Button__ButtonRoot",
|
|
128
|
+
componentId: "SD__sc-1yjd62w-0"
|
|
129
|
+
})(_ref2 => {
|
|
130
|
+
var {
|
|
131
|
+
size,
|
|
132
|
+
theme,
|
|
133
|
+
variant,
|
|
134
|
+
fullWidth
|
|
135
|
+
} = _ref2;
|
|
136
|
+
var variables = variant === 'primary' ? getPrimaryVariables(size) : variant === 'neutral' ? getNeutralVariables(size) : variant === 'critical' ? getCriticalVariables(size) : variant === 'text' ? getTextVariables(size) : variant === 'inverted' ? getInvertedVariables(size) : getDefaultVariables(size);
|
|
137
|
+
return css(JSON.parse('["border:0;margin:0;outline:0;position:relative;vertical-align:middle;cursor:pointer;text-decoration:none;&[aria-disabled=\'true\']{cursor:default;pointer-events:none;}-moz-appearance:none;&::-moz-focus-inner{border-style:none;}-webkit-appearance:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;@media print{-webkit-print-color-adjust:exact;}--button-visibility:visible;--button-text-color:",";--button-border-color:",";--button-outline-color:",";--button-background-color:",";--button-padding-x:","px;--button-padding-y:","px;--button-font-size:","px;--button-line-height:","px;","{--button-padding-x:","px;--button-padding-y:","px;--button-font-size:","px;--button-line-height:","px;}&[aria-disabled=\'true\']{--button-text-color:",";--button-border-color:",";--button-background-color:",";&[aria-busy=\'true\']{--button-visibility:hidden;}}&[aria-disabled=\'false\']{&[aria-expanded=\'true\']{--button-text-color:",";--button-border-color:",";--button-background-color:",";}&,&[aria-expanded=\'true\']{&:focus{--button-outline-color:",";}@media (hover:hover) and (pointer:fine){&:hover{--button-text-color:",";--button-border-color:",";--button-background-color:",";}}&:active{--button-background-color:",";}}}display:inline-flex;align-items:center;justify-content:center;min-width:48px;width:",";border-radius:4px;font-family:",";font-weight:",";color:var(--button-text-color);background-color:var(--button-background-color);font-size:var(--button-font-size);line-height:var(--button-line-height);padding:var(--button-padding-y) var(--button-padding-x);box-shadow:inset 0 0 0 1px var(--button-border-color),0 0 0 2px var(--button-outline-color);transition:",";"]'), variables.textColor, variables.borderColor, Color.Transparent, variables.backgroundColor, variables.paddingXMobile, variables.paddingYMobile, variables.fontSizeMobile, variables.lineHeightMobile, theme.breakpoints.up('sm'), variables.paddingX, variables.paddingY, variables.fontSize, variables.lineHeight, variables.textColorDisabled, variables.borderColorDisabled, variables.backgroundColorDisabled, variables.textColorHovered, variables.borderColorHovered, variables.backgroundColorHovered, variables.outlineColor, variables.textColorHovered, variables.borderColorHovered, variables.backgroundColorHovered, variables.backgroundColorActive, fullWidth ? '100%' : 'auto', theme.typography.fontFamily, theme.typography.fontWeightBold, theme.transitions.create(['color', 'box-shadow', 'background-color']));
|
|
138
|
+
});
|
|
139
|
+
var ButtonLabel = /*#__PURE__*/styled.span.withConfig({
|
|
140
|
+
displayName: "Button__ButtonLabel",
|
|
141
|
+
componentId: "SD__sc-1yjd62w-1"
|
|
142
|
+
})(["display:inherit;align-items:inherit;justify-content:inherit;visibility:var(--button-visibility);--mui-svg-icon-size:var(--button-line-height);"]);
|
|
143
|
+
var ButtonStartIcon = /*#__PURE__*/styled.span.withConfig({
|
|
144
|
+
displayName: "Button__ButtonStartIcon",
|
|
145
|
+
componentId: "SD__sc-1yjd62w-2"
|
|
146
|
+
})(["margin-right:4px;"]);
|
|
147
|
+
var ButtonEndIcon = /*#__PURE__*/styled.span.withConfig({
|
|
148
|
+
displayName: "Button__ButtonEndIcon",
|
|
149
|
+
componentId: "SD__sc-1yjd62w-3"
|
|
150
|
+
})(["margin-left:4px;"]);
|
|
151
|
+
var ButtonPendingIndicator = /*#__PURE__*/styled.span.withConfig({
|
|
152
|
+
displayName: "Button__ButtonPendingIndicator",
|
|
153
|
+
componentId: "SD__sc-1yjd62w-4"
|
|
154
|
+
})(["left:50%;display:flex;position:absolute;visibility:visible;transform:translate(-50%);"]);
|
|
155
|
+
|
|
156
|
+
function useButtonProps(_ref3) {
|
|
157
|
+
var {
|
|
158
|
+
children,
|
|
159
|
+
endIcon,
|
|
160
|
+
startIcon,
|
|
161
|
+
tabIndex: tabIndexProp = 0,
|
|
162
|
+
active = false,
|
|
163
|
+
pending = false,
|
|
164
|
+
disabled: disabledProp = false,
|
|
165
|
+
size = 'medium',
|
|
166
|
+
fullWidth = false,
|
|
167
|
+
variant = 'default'
|
|
168
|
+
} = _ref3,
|
|
169
|
+
props = _objectWithoutProperties(_ref3, _excluded);
|
|
170
|
+
|
|
171
|
+
var disabled = pending || disabledProp;
|
|
172
|
+
var tabIndex = disabled ? -1 : tabIndexProp;
|
|
173
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
174
|
+
size,
|
|
175
|
+
variant,
|
|
176
|
+
fullWidth,
|
|
177
|
+
tabIndex,
|
|
178
|
+
disabled,
|
|
179
|
+
'aria-busy': pending,
|
|
180
|
+
'aria-expanded': active,
|
|
181
|
+
'aria-disabled': disabled,
|
|
182
|
+
children: /*#__PURE__*/_jsxs(ButtonLabel, {
|
|
183
|
+
children: [!!startIcon && /*#__PURE__*/_jsx(ButtonStartIcon, {
|
|
184
|
+
children: startIcon
|
|
185
|
+
}), children, !!endIcon && /*#__PURE__*/_jsx(ButtonEndIcon, {
|
|
186
|
+
children: endIcon
|
|
187
|
+
}), pending && /*#__PURE__*/_jsx(ButtonPendingIndicator, {
|
|
188
|
+
children: /*#__PURE__*/_jsx(CircularProgress, {
|
|
189
|
+
size: "1em",
|
|
190
|
+
color: "inherit"
|
|
191
|
+
})
|
|
192
|
+
})]
|
|
193
|
+
})
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export var Button = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
198
|
+
var {
|
|
199
|
+
type = 'button'
|
|
200
|
+
} = _ref4,
|
|
201
|
+
props = _objectWithoutProperties(_ref4, _excluded2);
|
|
202
|
+
|
|
203
|
+
var buttonProps = useButtonProps(props);
|
|
204
|
+
return /*#__PURE__*/_jsx(ButtonRoot, _objectSpread(_objectSpread({}, buttonProps), {}, {
|
|
205
|
+
ref: ref,
|
|
206
|
+
type: type
|
|
207
|
+
}));
|
|
208
|
+
});
|
|
209
|
+
if (process.env.NODE_ENV !== "production") Button.displayName = "Button";
|
|
210
|
+
export var AnchorButton = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
211
|
+
var {
|
|
212
|
+
href,
|
|
213
|
+
target
|
|
214
|
+
} = _ref5,
|
|
215
|
+
props = _objectWithoutProperties(_ref5, _excluded3);
|
|
216
|
+
|
|
217
|
+
var buttonProps = useButtonProps(props);
|
|
218
|
+
var rel = target === '_blank' ? 'noopener noreferrer' : undefined;
|
|
219
|
+
return /*#__PURE__*/_jsx(ButtonRoot, _objectSpread(_objectSpread({}, buttonProps), {}, {
|
|
220
|
+
as: "a",
|
|
221
|
+
ref: ref,
|
|
222
|
+
rel: rel,
|
|
223
|
+
href: href,
|
|
224
|
+
target: target
|
|
225
|
+
}));
|
|
226
|
+
});
|
|
227
|
+
if (process.env.NODE_ENV !== "production") AnchorButton.displayName = "AnchorButton";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["icon", "children", "variant", "active", "disabled", "fullWidth"];
|
|
4
|
+
import { ButtonBase, Typography } from '@mui/material';
|
|
5
|
+
import { v5 } from '@superdispatch/ui';
|
|
6
|
+
import { forwardRef } from 'react';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
var {
|
|
11
|
+
Color,
|
|
12
|
+
Stack
|
|
13
|
+
} = v5;
|
|
14
|
+
var ButtonRoot = /*#__PURE__*/styled(ButtonBase).withConfig({
|
|
15
|
+
displayName: "ButtonArea__ButtonRoot",
|
|
16
|
+
componentId: "SD__sc-5sq1bg-0"
|
|
17
|
+
})(["padding:12px 32px;border-width:1px;border-radius:4px;border-style:solid;border-color:", ";color:", ";background-color:", ";& svg{color:inherit;font-size:24px;}&[data-full-width='true']{width:100%;}&[data-disabled='true']{color:", ";border-color:", ";}&[data-variant='success']{&:hover{color:", ";box-shadow:0 0 0 2px ", ";border-color:", ";}&[data-active='true']{color:", ";border-color:", ";background-color:", ";}}&[data-variant='danger']{&:hover{color:", ";box-shadow:0 0 0 2px ", ";border-color:", ";}&[data-active='true']{color:", ";border-color:", ";background-color:", ";}}"], Color.Silver500, Color.Dark100, Color.White, Color.Silver500, Color.Silver400, Color.Green300, Color.Green100, Color.Green300, Color.Green300, Color.Green300, Color.Green50, Color.Red300, Color.Red100, Color.Red300, Color.Red300, Color.Red300, Color.Red50);
|
|
18
|
+
export var ButtonArea = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
19
|
+
var {
|
|
20
|
+
icon,
|
|
21
|
+
children,
|
|
22
|
+
variant,
|
|
23
|
+
active,
|
|
24
|
+
disabled,
|
|
25
|
+
fullWidth
|
|
26
|
+
} = _ref,
|
|
27
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
|
|
29
|
+
return /*#__PURE__*/_jsx(ButtonRoot, _objectSpread(_objectSpread({
|
|
30
|
+
ref: ref,
|
|
31
|
+
disabled: disabled,
|
|
32
|
+
"data-active": active,
|
|
33
|
+
"data-disabled": disabled,
|
|
34
|
+
"data-variant": variant,
|
|
35
|
+
"data-full-width": fullWidth
|
|
36
|
+
}, props), {}, {
|
|
37
|
+
children: /*#__PURE__*/_jsxs(Stack, {
|
|
38
|
+
align: "center",
|
|
39
|
+
space: "xxsmall",
|
|
40
|
+
children: [icon, /*#__PURE__*/_jsx(Typography, {
|
|
41
|
+
variant: "h4",
|
|
42
|
+
color: disabled ? 'inherit' : 'textPrimary',
|
|
43
|
+
children: children
|
|
44
|
+
})]
|
|
45
|
+
})
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
if (process.env.NODE_ENV !== "production") ButtonArea.displayName = "ButtonArea";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { v5 } from '@superdispatch/ui';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { TextBox } from "../text-box/TextBox.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
var {
|
|
8
|
+
Color,
|
|
9
|
+
Column,
|
|
10
|
+
Columns,
|
|
11
|
+
Inline,
|
|
12
|
+
isEmptyReactNode,
|
|
13
|
+
useUID
|
|
14
|
+
} = v5;
|
|
15
|
+
|
|
16
|
+
function descriptionItemIconMixin(size) {
|
|
17
|
+
return css(["width:", "px;height:", "px;& > .MuiSvgIcon-root{font-size:", "px;}"], size, size + 4, size);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var DescriptionItemIcon = /*#__PURE__*/styled.div.withConfig({
|
|
21
|
+
displayName: "DescriptionItem__DescriptionItemIcon",
|
|
22
|
+
componentId: "SD__sc-l1c918-0"
|
|
23
|
+
})(_ref => {
|
|
24
|
+
var {
|
|
25
|
+
theme
|
|
26
|
+
} = _ref;
|
|
27
|
+
return css(["display:flex;align-items:center;& > .MuiSvgIcon-root{color:", ";}", ";", "{", ";}"], Color.Dark100, descriptionItemIconMixin(20), theme.breakpoints.up('sm'), descriptionItemIconMixin(16));
|
|
28
|
+
});
|
|
29
|
+
export var DescriptionItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
30
|
+
var {
|
|
31
|
+
icon,
|
|
32
|
+
wrap,
|
|
33
|
+
inset,
|
|
34
|
+
label,
|
|
35
|
+
children,
|
|
36
|
+
fallback,
|
|
37
|
+
id: idProp,
|
|
38
|
+
'aria-label': ariaLabel
|
|
39
|
+
} = _ref2;
|
|
40
|
+
var id = useUID(idProp);
|
|
41
|
+
var labelID = "".concat(id, "-label");
|
|
42
|
+
var isEmptyChildren = isEmptyReactNode(children);
|
|
43
|
+
return /*#__PURE__*/_jsxs(Columns, {
|
|
44
|
+
id: id,
|
|
45
|
+
ref: ref,
|
|
46
|
+
space: "xsmall",
|
|
47
|
+
"aria-label": ariaLabel,
|
|
48
|
+
children: [!!(icon || inset) && /*#__PURE__*/_jsx(Column, {
|
|
49
|
+
width: "content",
|
|
50
|
+
children: /*#__PURE__*/_jsx(DescriptionItemIcon, {
|
|
51
|
+
children: icon
|
|
52
|
+
})
|
|
53
|
+
}), /*#__PURE__*/_jsx(Column, {
|
|
54
|
+
width: "adaptive",
|
|
55
|
+
children: /*#__PURE__*/_jsxs(Inline, {
|
|
56
|
+
space: "xxsmall",
|
|
57
|
+
noWrap: !wrap,
|
|
58
|
+
children: [!!label && /*#__PURE__*/_jsx(TextBox, {
|
|
59
|
+
as: "label",
|
|
60
|
+
id: labelID,
|
|
61
|
+
color: "secondary",
|
|
62
|
+
children: label
|
|
63
|
+
}), /*#__PURE__*/_jsx(TextBox, {
|
|
64
|
+
as: "div",
|
|
65
|
+
noWrap: !wrap,
|
|
66
|
+
wrapOverflow: !!wrap,
|
|
67
|
+
"aria-labelledby": label == null ? undefined : labelID,
|
|
68
|
+
color: isEmptyChildren && label == null ? 'secondary' : 'primary',
|
|
69
|
+
children: isEmptyChildren ? fallback : children
|
|
70
|
+
})]
|
|
71
|
+
})
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
if (process.env.NODE_ENV !== "production") DescriptionItem.displayName = "DescriptionItem";
|