orcs-design-system 3.5.13 → 3.5.15
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/es/components/ActionsMenu/index.js +25 -6
- package/es/components/Grid/index.js +1 -1
- package/es/components/Select/index.js +10 -5
- package/es/components/StatusDot/index.js +31 -4
- package/es/components/Tabs/index.js +6 -6
- package/es/components/TextInput/index.js +19 -4
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
const _excluded = ["as"],
|
|
3
|
+
const _excluded = ["as", "Component", "fullWidth", "ariaLabel", "aria-label"],
|
|
4
4
|
_excluded2 = ["theme", "onToggle", "toggleState", "direction", "menuWidth", "customTriggerComponent", "renderTrigger", "children", "ariaLabel", "onTriggerFocus", "closeMenu", "closeOnClick", "data-testid", "variant", "disabled"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -86,13 +86,23 @@ export const ActionsMenuItem = /*#__PURE__*/styled(props => {
|
|
|
86
86
|
onItemClick,
|
|
87
87
|
actionMenu
|
|
88
88
|
} = useContext(ActionMenuContext);
|
|
89
|
+
|
|
90
|
+
// fullWidth and ariaLabel stripped so they are not forwarded to DOM (use aria-label)
|
|
89
91
|
const {
|
|
90
|
-
as
|
|
92
|
+
as,
|
|
93
|
+
Component: CustomComponent,
|
|
94
|
+
fullWidth,
|
|
95
|
+
ariaLabel,
|
|
96
|
+
"aria-label": ariaLabelProp
|
|
91
97
|
} = props,
|
|
92
98
|
others = _objectWithoutProperties(props, _excluded);
|
|
99
|
+
void fullWidth;
|
|
100
|
+
const ariaLabelValue = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : ariaLabelProp;
|
|
93
101
|
const Component = as ? as : others.href ? "a" : "button";
|
|
94
102
|
const disabled = props.disabled;
|
|
95
|
-
let newProps = _objectSpread(_objectSpread({}, others),
|
|
103
|
+
let newProps = _objectSpread(_objectSpread(_objectSpread({}, others), ariaLabelValue != null ? {
|
|
104
|
+
"aria-label": ariaLabelValue
|
|
105
|
+
} : {}), (actionMenu === null || actionMenu === void 0 || (_actionMenu$getItemPr = actionMenu.getItemProps) === null || _actionMenu$getItemPr === void 0 ? void 0 : _actionMenu$getItemPr.call(actionMenu)) || {});
|
|
96
106
|
const {
|
|
97
107
|
onClick: originalOnClick
|
|
98
108
|
} = newProps;
|
|
@@ -101,10 +111,18 @@ export const ActionsMenuItem = /*#__PURE__*/styled(props => {
|
|
|
101
111
|
originalOnClick === null || originalOnClick === void 0 || originalOnClick(e);
|
|
102
112
|
}, [originalOnClick, onItemClick]);
|
|
103
113
|
if (props.to) {
|
|
104
|
-
|
|
114
|
+
if (CustomComponent) {
|
|
115
|
+
return /*#__PURE__*/_jsx(CustomComponent, _objectSpread(_objectSpread({
|
|
116
|
+
to: props.to
|
|
117
|
+
}, newProps), {}, {
|
|
118
|
+
$fullWidth: Boolean(props.fullWidth),
|
|
119
|
+
onClick: onClick,
|
|
120
|
+
disabled: disabled
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
105
123
|
return /*#__PURE__*/_jsx(StyledNavLink, {
|
|
106
124
|
to: props.to,
|
|
107
|
-
children: /*#__PURE__*/_jsx(
|
|
125
|
+
children: /*#__PURE__*/_jsx(Component, _objectSpread({}, newProps))
|
|
108
126
|
});
|
|
109
127
|
}
|
|
110
128
|
if (Component === "button") {
|
|
@@ -113,7 +131,8 @@ export const ActionsMenuItem = /*#__PURE__*/styled(props => {
|
|
|
113
131
|
["data-action-menu-id"]: id
|
|
114
132
|
});
|
|
115
133
|
}
|
|
116
|
-
if (
|
|
134
|
+
if (CustomComponent) return /*#__PURE__*/_jsx(CustomComponent, _objectSpread(_objectSpread({}, newProps), {}, {
|
|
135
|
+
$fullWidth: Boolean(props.fullWidth),
|
|
117
136
|
onClick: onClick,
|
|
118
137
|
disabled: disabled
|
|
119
138
|
}));
|
|
@@ -12,7 +12,7 @@ import PropTypes from "prop-types";
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
const GridStyles = compose(space, layout, grid, flex, color);
|
|
14
14
|
const GridWrapper = /*#__PURE__*/styled("div").withConfig({
|
|
15
|
-
shouldForwardProp,
|
|
15
|
+
shouldForwardProp: prop => prop !== "loading" && shouldForwardProp(prop),
|
|
16
16
|
displayName: "GridWrapper",
|
|
17
17
|
componentId: "sc-1rlajun-0"
|
|
18
18
|
}).attrs(props => ({
|
|
@@ -31,9 +31,12 @@ const Label = /*#__PURE__*/styled("label").withConfig({
|
|
|
31
31
|
shouldForwardProp,
|
|
32
32
|
displayName: "Label",
|
|
33
33
|
componentId: "sc-bfi43f-1"
|
|
34
|
-
}).attrs(props =>
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
}).attrs(props => {
|
|
35
|
+
var _props$htmlFor;
|
|
36
|
+
return {
|
|
37
|
+
htmlFor: (_props$htmlFor = props.htmlFor) !== null && _props$htmlFor !== void 0 ? _props$htmlFor : props.id
|
|
38
|
+
};
|
|
39
|
+
})(props => css({
|
|
37
40
|
display: "block",
|
|
38
41
|
color: props.inverted ? themeGet("colors.white")(props) : props.invalid ? themeGet("colors.dangerDark")(props) : themeGet("colors.greyDarkest")(props),
|
|
39
42
|
fontSize: themeGet("fontSizes.0")(props),
|
|
@@ -370,7 +373,8 @@ const Select = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
370
373
|
"data-testid": props["data-testid"],
|
|
371
374
|
"data-select-wrapper": "true"
|
|
372
375
|
}, SelectStyles), {}, {
|
|
373
|
-
children: [props.label && /*#__PURE__*/_jsxs(Label, {
|
|
376
|
+
children: [props.label && props.inputId && /*#__PURE__*/_jsxs(Label, {
|
|
377
|
+
id: "".concat(props.inputId, "-label"),
|
|
374
378
|
inverted: props.inverted,
|
|
375
379
|
bold: props.bold,
|
|
376
380
|
htmlFor: props.inputId,
|
|
@@ -389,7 +393,8 @@ const Select = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
389
393
|
isMulti: props.isMulti,
|
|
390
394
|
classNamePrefix: props.classNamePrefix,
|
|
391
395
|
onChange: props.onChange,
|
|
392
|
-
"aria-label": props.ariaLabel
|
|
396
|
+
"aria-label": props.ariaLabel,
|
|
397
|
+
"aria-labelledby": props.label && props.inputId ? "".concat(props.inputId, "-label") : undefined
|
|
393
398
|
}, props), {}, {
|
|
394
399
|
components: components
|
|
395
400
|
}))]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["icon", "children"]
|
|
3
|
+
const _excluded = ["icon", "children", "data-testId"],
|
|
4
|
+
_excluded2 = ["data-testid"];
|
|
4
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
7
|
import React from "react";
|
|
@@ -66,12 +67,21 @@ const StatusDotItem = /*#__PURE__*/styled("div").withConfig({
|
|
|
66
67
|
}
|
|
67
68
|
}), StatusDotStyles);
|
|
68
69
|
export default function StatusDot(_ref) {
|
|
70
|
+
var _props$dataTestid;
|
|
69
71
|
let {
|
|
70
72
|
icon,
|
|
71
|
-
children
|
|
73
|
+
children,
|
|
74
|
+
"data-testId": dataTestIdCamel
|
|
72
75
|
} = _ref,
|
|
73
76
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
74
|
-
|
|
77
|
+
const dataTestid = (_props$dataTestid = props["data-testid"]) !== null && _props$dataTestid !== void 0 ? _props$dataTestid : dataTestIdCamel;
|
|
78
|
+
const {
|
|
79
|
+
"data-testid": stripDataTestid
|
|
80
|
+
} = props,
|
|
81
|
+
rest = _objectWithoutProperties(props, _excluded2);
|
|
82
|
+
void stripDataTestid;
|
|
83
|
+
return /*#__PURE__*/_jsx(StatusDotItem, _objectSpread(_objectSpread({}, rest), {}, {
|
|
84
|
+
"data-testid": dataTestid,
|
|
75
85
|
icon: icon,
|
|
76
86
|
children: children
|
|
77
87
|
}));
|
|
@@ -84,7 +94,10 @@ StatusDot.propTypes = {
|
|
|
84
94
|
/** Can specify an Icon componet as a child item */
|
|
85
95
|
children: PropTypes.node,
|
|
86
96
|
/** Specifies the system design theme. */
|
|
87
|
-
theme: PropTypes.object
|
|
97
|
+
theme: PropTypes.object,
|
|
98
|
+
/** data-testid for testing (accepts data-testid or data-testId; only data-testid is forwarded to DOM) */
|
|
99
|
+
"data-testid": PropTypes.string,
|
|
100
|
+
"data-testId": PropTypes.string
|
|
88
101
|
};
|
|
89
102
|
StatusDot.__docgenInfo = {
|
|
90
103
|
"description": "",
|
|
@@ -137,6 +150,20 @@ StatusDot.__docgenInfo = {
|
|
|
137
150
|
"name": "object"
|
|
138
151
|
},
|
|
139
152
|
"required": false
|
|
153
|
+
},
|
|
154
|
+
"data-testid": {
|
|
155
|
+
"description": "data-testid for testing (accepts data-testid or data-testId; only data-testid is forwarded to DOM)",
|
|
156
|
+
"type": {
|
|
157
|
+
"name": "string"
|
|
158
|
+
},
|
|
159
|
+
"required": false
|
|
160
|
+
},
|
|
161
|
+
"data-testId": {
|
|
162
|
+
"description": "",
|
|
163
|
+
"type": {
|
|
164
|
+
"name": "string"
|
|
165
|
+
},
|
|
166
|
+
"required": false
|
|
140
167
|
}
|
|
141
168
|
}
|
|
142
169
|
};
|
|
@@ -26,14 +26,14 @@ const VisibleTabs = /*#__PURE__*/styled.div.withConfig({
|
|
|
26
26
|
const activeTabStyle = /*#__PURE__*/css(["background-color:", ";color:", ";border-bottom:2px solid ", ";cursor:default;font-weight:", ";&:hover,&:focus{background-color:", ";color:", ";border-bottom:2px solid ", ";box-shadow:none;}"], themeGet("colors.white"), themeGet("colors.primary"), themeGet("colors.primary"), themeGet("fontWeights.3"), themeGet("colors.white"), themeGet("colors.primary"), themeGet("colors.primary"));
|
|
27
27
|
const TabStyles = /*#__PURE__*/css(["width:", ";display:block;transition:background 200ms ease-in-out,color 200ms ease-in-out,border-bottom 200ms ease-in-out;border-bottom:2px solid ", ";padding:0 ", ";height:", ";display:flex;align-items:center;font-size:", ";font-weight:", ";position:relative;white-space:nowrap;text-decoration:none;text-align:center;background-color:", ";color:", ";cursor:pointer;", " &:hover:not(.active){background-color:", ";color:", ";border-bottom:2px solid ", ";box-shadow:none;}&:focus{outline:0;box-shadow:inset 0 2px 5px 0 ", ";}&.active{", "}"], _ref => {
|
|
28
28
|
let {
|
|
29
|
-
fullWidth
|
|
29
|
+
$fullWidth
|
|
30
30
|
} = _ref;
|
|
31
|
-
return fullWidth ? "100%" : "fit-content";
|
|
31
|
+
return $fullWidth ? "100%" : "fit-content";
|
|
32
32
|
}, themeGet("colors.greyLighter"), themeGet("space.4"), themeGet("appScale.tabsHeight"), themeGet("fontSizes.1"), themeGet("fontWeights.2"), themeGet("colors.white"), themeGet("colors.greyDark"), _ref2 => {
|
|
33
33
|
let {
|
|
34
|
-
tabInShowMore
|
|
34
|
+
$tabInShowMore
|
|
35
35
|
} = _ref2;
|
|
36
|
-
return tabInShowMore ? css(["position:absolute;visibility:hidden;"]) : "";
|
|
36
|
+
return $tabInShowMore ? css(["position:absolute;visibility:hidden;"]) : "";
|
|
37
37
|
}, themeGet("colors.white"), themeGet("colors.primary"), themeGet("colors.primaryLight"), themeGet("colors.primaryLightest"), activeTabStyle);
|
|
38
38
|
const NavTab = /*#__PURE__*/styled(NavLink).withConfig({
|
|
39
39
|
displayName: "NavTab",
|
|
@@ -79,9 +79,9 @@ const getTabSharedProps = function (tab) {
|
|
|
79
79
|
id: tab.id,
|
|
80
80
|
"data-testid": tab["data-testid"]
|
|
81
81
|
}, tabInShowMore && {
|
|
82
|
-
tabInShowMore
|
|
82
|
+
$tabInShowMore: true
|
|
83
83
|
}), fullWidth && {
|
|
84
|
-
fullWidth
|
|
84
|
+
fullWidth: true
|
|
85
85
|
}), {}, {
|
|
86
86
|
role: "tab"
|
|
87
87
|
});
|
|
@@ -14,7 +14,12 @@ import { themeGet } from "@styled-system/theme-get";
|
|
|
14
14
|
import useInputFocus from "../../hooks/useInputFocus";
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
const InputStyles = compose(space, layout);
|
|
17
|
+
|
|
18
|
+
// For Group (div): block styled-system props and input-specific props so they don't leak to DOM
|
|
17
19
|
const shouldForwardProp = createShouldForwardProp([...props, "type", "placeholder", "defaultValue", "disabled", "maxLength", "pattern", "required", "autocomplete", "autofocus", "step", "readonly"]);
|
|
20
|
+
|
|
21
|
+
// For Input/NumberInput: only block styled-system props + invalid/valid (so type, placeholder, value reach the DOM)
|
|
22
|
+
const inputShouldForwardProp = prop => prop !== "invalid" && prop !== "valid" && createShouldForwardProp(props)(prop);
|
|
18
23
|
const Group = /*#__PURE__*/styled("div").withConfig({
|
|
19
24
|
shouldForwardProp,
|
|
20
25
|
displayName: "Group",
|
|
@@ -38,13 +43,17 @@ const InputStyle = /*#__PURE__*/css(["display:block;cursor:text;-moz-appearance:
|
|
|
38
43
|
let bottom = 6;
|
|
39
44
|
return "".concat(top, "px ").concat(right, "px ").concat(bottom, "px ").concat(left, "px");
|
|
40
45
|
}, props => props.invalid ? themeGet("colors.danger")(props) : props.valid ? themeGet("colors.success")(props) : themeGet("colors.black30")(props), props => props.floating ? css(["&::placeholder{color:transparent;}&:not(:placeholder-shown){~ label{transform:translateY(-10px);font-size:", ";}}&:-ms-input-placeholder:not(:focus){~ label{transform:translateY(-10px);font-size:", ";}}&:not(:-ms-input-placeholder){~ label{transform:translateY(-10px);font-size:", ";}}"], themeGet("fontSizes.0")(props), themeGet("fontSizes.0")(props), themeGet("fontSizes.0")(props)) : css(["&::placeholder{color:", ";}"], themeGet("colors.grey")(props)), props => props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.primary")(props), props => props.invalid ? themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.danger30")(props) : props.valid ? themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.success30")(props) : themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.primary30")(props), props => props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.primary")(props), props => props.floating ? css(["&::placeholder{color:", ";}~ label{transform:translateY(-10px);font-size:", ";color:", ";}"], themeGet("colors.greyLight")(props), themeGet("fontSizes.0")(props), props => props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.primary")(props)) : css([""]));
|
|
41
|
-
const Input = /*#__PURE__*/styled("input").
|
|
46
|
+
const Input = /*#__PURE__*/styled("input").withConfig({
|
|
47
|
+
shouldForwardProp: inputShouldForwardProp
|
|
48
|
+
}).attrs(props => ({
|
|
42
49
|
"data-testid": props["data-testid"] ? props["data-testid"] : null
|
|
43
50
|
})).withConfig({
|
|
44
51
|
displayName: "Input",
|
|
45
52
|
componentId: "sc-shde0o-2"
|
|
46
53
|
})(["", ""], InputStyle);
|
|
47
|
-
const NumberInput = /*#__PURE__*/styled(NumericFormat).
|
|
54
|
+
const NumberInput = /*#__PURE__*/styled(NumericFormat).withConfig({
|
|
55
|
+
shouldForwardProp: inputShouldForwardProp
|
|
56
|
+
}).attrs(props => ({
|
|
48
57
|
"data-testid": props["data-testid"] ? props["data-testid"] : null
|
|
49
58
|
})).withConfig({
|
|
50
59
|
displayName: "NumberInput",
|
|
@@ -107,7 +116,10 @@ const TextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
107
116
|
getInputRef: getNumberInputRef,
|
|
108
117
|
"data-testid": props["data-testid"],
|
|
109
118
|
id: id,
|
|
110
|
-
"aria-label": ariaLabel
|
|
119
|
+
"aria-label": ariaLabel,
|
|
120
|
+
"aria-invalid": invalid !== null && invalid !== void 0 ? invalid : undefined,
|
|
121
|
+
invalid: invalid,
|
|
122
|
+
valid: valid
|
|
111
123
|
}, rest), {}, {
|
|
112
124
|
height: height
|
|
113
125
|
}, numberProps)) : /*#__PURE__*/_jsx(Input, _objectSpread({
|
|
@@ -115,7 +127,10 @@ const TextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
115
127
|
height: height,
|
|
116
128
|
ref: inputRef,
|
|
117
129
|
id: id,
|
|
118
|
-
"aria-label": ariaLabel
|
|
130
|
+
"aria-label": ariaLabel,
|
|
131
|
+
"aria-invalid": invalid !== null && invalid !== void 0 ? invalid : undefined,
|
|
132
|
+
invalid: invalid,
|
|
133
|
+
valid: valid
|
|
119
134
|
}, rest)), label && floating ? /*#__PURE__*/_jsx(Label, {
|
|
120
135
|
floating: floating,
|
|
121
136
|
invalid: invalid,
|