orcs-design-system 3.2.37 → 3.2.40
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/assets/Colour/index.js +1 -1
- package/es/components/ActionsMenu/index.js +12 -17
- package/es/components/ActionsMenu/useActionMenu.js +2 -2
- package/es/components/Avatar/index.js +5 -5
- package/es/components/Badge/index.js +1 -1
- package/es/components/Button/index.js +5 -5
- package/es/components/ButtonGroup/index.js +1 -1
- package/es/components/Checkbox/index.js +3 -3
- package/es/components/DatePicker/index.js +2 -2
- package/es/components/Divider/index.js +1 -1
- package/es/components/Header/Header.stories.js +6 -6
- package/es/components/Header/index.js +2 -2
- package/es/components/HeaderSimple/HeaderSimple.stories.js +2 -2
- package/es/components/Icon/index.js +1 -1
- package/es/components/Modal/Modal.stories.js +226 -4
- package/es/components/Modal/index.js +1 -1
- package/es/components/Popover/index.js +7 -5
- package/es/components/ProgressBar/index.js +2 -2
- package/es/components/RadioButton/index.js +2 -2
- package/es/components/Range/index.js +17 -2
- package/es/components/Select/index.js +11 -12
- package/es/components/SideNav/SideNav.stories.js +1 -1
- package/es/components/SideNav/index.js +9 -30
- package/es/components/Sidebar/index.js +1 -1
- package/es/components/Table/Table.stories.js +2 -2
- package/es/components/Table/getExpandColumnConfig.js +5 -5
- package/es/components/Table/muiStyleOverrides.js +1 -2
- package/es/components/Tabs/index.js +3 -3
- package/es/components/Tag/index.js +4 -4
- package/es/components/TextArea/index.js +2 -2
- package/es/components/TextInput/index.js +11 -11
- package/es/components.test.js +72 -1
- package/es/systemThemeCollapsed.js +9 -9
- package/es/systemtheme.js +9 -9
- package/es/utils/floatingUiHelpers.js +3 -8
- package/package.json +18 -13
|
@@ -8,7 +8,7 @@ export const Colour = styled("div").withConfig({
|
|
|
8
8
|
componentId: "sc-uyvdow-0"
|
|
9
9
|
})(props => {
|
|
10
10
|
return css({
|
|
11
|
-
backgroundColor: themeGet(
|
|
11
|
+
backgroundColor: themeGet(`colors.${props.bg}`)(props),
|
|
12
12
|
width: "75px",
|
|
13
13
|
height: "75px"
|
|
14
14
|
});
|
|
@@ -14,7 +14,7 @@ const crossTransform2 = keyframes(["0%{transform:translate(0,6px);border-radius:
|
|
|
14
14
|
const StyledActionsMenuContainer = styled.div.withConfig({
|
|
15
15
|
displayName: "ActionsMenu__StyledActionsMenuContainer",
|
|
16
16
|
componentId: "sc-yvbni2-0"
|
|
17
|
-
})(["pointer-events:none;opacity:0;visibility:hidden;&.hack-for-legacy-tests{position:absolute;pointer-events:none;
|
|
17
|
+
})(["pointer-events:none;opacity:0;visibility:hidden;&.hack-for-legacy-tests{position:absolute;pointer-events:none;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border-width:0;}&.visible{visibility:visible;opacity:1;pointer-events:auto;}"]);
|
|
18
18
|
const Wrapper = styled.div.withConfig({
|
|
19
19
|
displayName: "ActionsMenu__Wrapper",
|
|
20
20
|
componentId: "sc-yvbni2-1"
|
|
@@ -40,18 +40,14 @@ export const ActionsMenuHeading = styled(props => {
|
|
|
40
40
|
// // Only sets `aria-labelledby` on the Popover root element
|
|
41
41
|
// // if this component is mounted inside it.
|
|
42
42
|
useLayoutEffect(() => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return () => {
|
|
46
|
-
var _actionMenu$setLabelI2;
|
|
47
|
-
return actionMenu === null || actionMenu === void 0 || (_actionMenu$setLabelI2 = actionMenu.setLabelId) === null || _actionMenu$setLabelI2 === void 0 ? void 0 : _actionMenu$setLabelI2.call(actionMenu, undefined);
|
|
48
|
-
};
|
|
43
|
+
actionMenu?.setLabelId?.(id);
|
|
44
|
+
return () => actionMenu?.setLabelId?.(undefined);
|
|
49
45
|
}, [id, actionMenu]);
|
|
50
46
|
return /*#__PURE__*/_jsx("div", {
|
|
51
47
|
...props,
|
|
52
48
|
onKeyUp: e => {
|
|
53
|
-
if (e.key === commonKeys.ENTER && props
|
|
54
|
-
props
|
|
49
|
+
if (e.key === commonKeys.ENTER && props?.canClick) {
|
|
50
|
+
props?.onClick();
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
});
|
|
@@ -63,7 +59,6 @@ export const ActionsMenuHeading = styled(props => {
|
|
|
63
59
|
componentId: "sc-yvbni2-5"
|
|
64
60
|
})(["color:", ";padding:8px;width:100%;font-size:", ";font-weight:", ";border-bottom:solid 1px ", ";white-space:nowrap;cursor:", ";"], props => themeGet("colors.white")(props), props => themeGet("fontSizes.1")(props), props => themeGet("fontWeights.1")(props), props => themeGet("colors.greyDarkest")(props), props => props.canClick ? "pointer" : "default");
|
|
65
61
|
export const ActionsMenuItem = styled(props => {
|
|
66
|
-
var _actionMenu$getItemPr;
|
|
67
62
|
const {
|
|
68
63
|
id,
|
|
69
64
|
onItemClick,
|
|
@@ -77,14 +72,14 @@ export const ActionsMenuItem = styled(props => {
|
|
|
77
72
|
const disabled = props.disabled;
|
|
78
73
|
let newProps = {
|
|
79
74
|
...others,
|
|
80
|
-
...(
|
|
75
|
+
...(actionMenu?.getItemProps?.() || {})
|
|
81
76
|
};
|
|
82
77
|
const {
|
|
83
78
|
onClick: originalOnClick
|
|
84
79
|
} = newProps;
|
|
85
80
|
const onClick = useMemo(() => e => {
|
|
86
|
-
onItemClick
|
|
87
|
-
originalOnClick
|
|
81
|
+
onItemClick?.(e);
|
|
82
|
+
originalOnClick?.(e);
|
|
88
83
|
}, [originalOnClick, onItemClick]);
|
|
89
84
|
if (Component === "button") {
|
|
90
85
|
newProps = {
|
|
@@ -127,7 +122,7 @@ export const ActionsMenuBody = _ref => {
|
|
|
127
122
|
open: toggleState,
|
|
128
123
|
onOpenChange: (_, e) => {
|
|
129
124
|
if (e) {
|
|
130
|
-
onToggle
|
|
125
|
+
onToggle?.(e);
|
|
131
126
|
}
|
|
132
127
|
}
|
|
133
128
|
});
|
|
@@ -154,9 +149,9 @@ export const ActionsMenuBody = _ref => {
|
|
|
154
149
|
})
|
|
155
150
|
});
|
|
156
151
|
if (customTriggerComponent) {
|
|
157
|
-
triggerComponent = /*#__PURE__*/
|
|
152
|
+
triggerComponent = /*#__PURE__*/_jsx("div", {
|
|
158
153
|
...triggerProps,
|
|
159
|
-
|
|
154
|
+
children: customTriggerComponent
|
|
160
155
|
});
|
|
161
156
|
}
|
|
162
157
|
const value = useMemo(() => ({
|
|
@@ -172,7 +167,7 @@ export const ActionsMenuBody = _ref => {
|
|
|
172
167
|
...actionMenu.floatingStyles,
|
|
173
168
|
zIndex: getFloatingUiZIndex(actionMenu.refs.reference)
|
|
174
169
|
}), [actionMenu.floatingStyles, actionMenu.refs.reference]);
|
|
175
|
-
const menuDataTestId = useMemo(() =>
|
|
170
|
+
const menuDataTestId = useMemo(() => `${dataTestId}__menu`, [dataTestId]);
|
|
176
171
|
const {
|
|
177
172
|
getFloatingProps
|
|
178
173
|
} = actionMenu;
|
|
@@ -14,8 +14,8 @@ export default function useActionMenu(_ref) {
|
|
|
14
14
|
const [labelId, setLabelId] = useState();
|
|
15
15
|
const [descriptionId, setDescriptionId] = useState();
|
|
16
16
|
const arrowRef = useRef();
|
|
17
|
-
const open = controlledOpen
|
|
18
|
-
const setOpen = setControlledOpen
|
|
17
|
+
const open = controlledOpen ?? uncontrolledOpen;
|
|
18
|
+
const setOpen = setControlledOpen ?? setUncontrolledOpen;
|
|
19
19
|
const data = useFloating({
|
|
20
20
|
placement,
|
|
21
21
|
open,
|
|
@@ -114,7 +114,7 @@ const Shape = styled("div").withConfig({
|
|
|
114
114
|
alignItems: "center",
|
|
115
115
|
justifyContent: "center",
|
|
116
116
|
textAlign: "center",
|
|
117
|
-
textTransform:
|
|
117
|
+
textTransform: `${props => props.uppercase ? "uppercase" : "none"}`,
|
|
118
118
|
a: {
|
|
119
119
|
color: themeGet("colors.greyDarkest")(props)
|
|
120
120
|
},
|
|
@@ -166,7 +166,7 @@ const Title = styled(_ref => {
|
|
|
166
166
|
...props
|
|
167
167
|
} = _ref;
|
|
168
168
|
const Heading = Header[titleLevel];
|
|
169
|
-
return /*#__PURE__*/React.cloneElement(
|
|
169
|
+
return /*#__PURE__*/React.cloneElement(/*#__PURE__*/_jsx(Heading, {}), props);
|
|
170
170
|
}).withConfig({
|
|
171
171
|
displayName: "Avatar__Title",
|
|
172
172
|
componentId: "sc-1wtet2j-4"
|
|
@@ -276,7 +276,7 @@ const Avatar = _ref2 => {
|
|
|
276
276
|
if (imageAlt) {
|
|
277
277
|
return imageAlt;
|
|
278
278
|
} else if (typeof title === "string") {
|
|
279
|
-
return
|
|
279
|
+
return `Avatar for ${title}`;
|
|
280
280
|
}
|
|
281
281
|
}, [imageAlt, title]);
|
|
282
282
|
const component = /*#__PURE__*/_jsxs(AvatarWrapper, {
|
|
@@ -351,10 +351,10 @@ Avatar.propTypes = {
|
|
|
351
351
|
/** Specifies the alt text for an image. This must be specified if image prop is used and title prop is not a string. */
|
|
352
352
|
imageAlt: (props, propName) => {
|
|
353
353
|
if (props.image && props.title && typeof props.title !== "string" && (props[propName] == null || props[propName] === "")) {
|
|
354
|
-
return new Error(
|
|
354
|
+
return new Error(`Missing prop \`${propName}\` not specified for Avatar component. When \`image\` is provided, \`${propName}\` is required.`);
|
|
355
355
|
}
|
|
356
356
|
if (props[propName] && typeof props[propName] !== "string") {
|
|
357
|
-
return new Error(
|
|
357
|
+
return new Error(`Invalid propType \`${propName}\` supplied to Avatar component. Expected \`string\`, received \`${typeof props[propName]}\`.`);
|
|
358
358
|
}
|
|
359
359
|
return null;
|
|
360
360
|
},
|
|
@@ -20,7 +20,7 @@ const Item = styled("span").withConfig({
|
|
|
20
20
|
display: "inline-block",
|
|
21
21
|
position: "relative",
|
|
22
22
|
pt: themeGet("space.2")(props),
|
|
23
|
-
pb:
|
|
23
|
+
pb: `calc(${themeGet("space.2")(props)} + 1px)`,
|
|
24
24
|
px: themeGet("space.3")(props),
|
|
25
25
|
cursor: "default",
|
|
26
26
|
borderRadius: 1,
|
|
@@ -109,18 +109,18 @@ const getVariantStyle = props => {
|
|
|
109
109
|
if (props.disabled) return styles.disabled;
|
|
110
110
|
return styles[props.variant] || styles.default;
|
|
111
111
|
};
|
|
112
|
-
const getSpace = getter => props => themeGet(
|
|
112
|
+
const getSpace = getter => props => themeGet(`space.${getter(props)}`)(props);
|
|
113
113
|
const buttonStyles = css(["background:", ";color:", ";border-color:", ";display:flex;align-items:center;justify-content:center;appearance:none;box-shadow:none;margin:0;text-decoration:none;text-align:center;font-family:", ";font-weight:", ";border-radius:", ";transition:", ";border-width:", ";cursor:", ";width:", ";height:auto;font-size:", ";padding:", " ", ";svg{margin-right:", ";margin-left:", ";}&:hover{background:", ";border-color:", ";border-width:", ";border-style:solid;}&:focus{outline:0;box-shadow:", " ", ";}", " ", ""], themeGet(VARIANT_COLORS.default.background), themeGet(VARIANT_COLORS.default.color), themeGet("colors.primary"), themeGet("fonts.main"), themeGet("fontWeights.2"), themeGet("radii.2"), themeGet("transition.transitionDefault"), themeGet("borderWidths.1"), props => props.disabled ? "not-allowed" : props.isLoading ? "progress" : "pointer", props => props.fullWidth ? "100%" : "auto", props => {
|
|
114
114
|
let fontSize = 2;
|
|
115
115
|
if (props.large && props.iconOnly) fontSize = 5;
|
|
116
116
|
if (props.large) fontSize = 3;
|
|
117
117
|
if (props.small) fontSize = 1;
|
|
118
|
-
return themeGet(
|
|
118
|
+
return themeGet(`fontSizes.${fontSize}`)(props);
|
|
119
119
|
}, getSpace(props => props.large ? "s" : props.small ? "xxs" : "xs"), getSpace(props => props.large ? "r" : props.small ? "s" : "between"), getSpace(props => !props.iconLeft ? "" : props.small ? "xs" : "s"), getSpace(props => !props.iconRight ? "" : props.small ? "xs" : "s"), themeGet(VARIANT_COLORS.default.hovered.background), themeGet("colors.primaryDark"), themeGet("borderWidths.1"), themeGet("shadows.thinOutline"), themeGet("colors.primaryDarker"), getVariantStyle, compose(space, layout, color, border));
|
|
120
120
|
const attrs = props => ({
|
|
121
121
|
"data-testid": props.dataTestId || props["data-testid"],
|
|
122
122
|
disabled: props.disabled || props.variant == "disabled",
|
|
123
|
-
className:
|
|
123
|
+
className: `${props.className || ""} variant-${props.variant || "default"}`
|
|
124
124
|
});
|
|
125
125
|
const StyledButton = styled("button").withConfig({
|
|
126
126
|
shouldForwardProp
|
|
@@ -173,10 +173,10 @@ const buttonPropTypes = {
|
|
|
173
173
|
/** Specifies aria-label for iconOnly buttons. This is only required if the iconOnly button is used, as it doesn't have supporting text for accessibility.*/
|
|
174
174
|
ariaLabel: (props, propName) => {
|
|
175
175
|
if (props.iconOnly && (props[propName] == null || props[propName] === "")) {
|
|
176
|
-
return new Error(
|
|
176
|
+
return new Error(`Missing prop \`${propName}\` not specified for Button component. When \`iconOnly\` is true, \`${propName}\` is required.`);
|
|
177
177
|
}
|
|
178
178
|
if (props[propName] && typeof props[propName] !== "string") {
|
|
179
|
-
return new Error(
|
|
179
|
+
return new Error(`Invalid propType for \`${propName}\` supplied to Button component. Expected \`string\`, received \`${typeof props[propName]}\`.`);
|
|
180
180
|
}
|
|
181
181
|
return null;
|
|
182
182
|
},
|
|
@@ -56,7 +56,7 @@ const ButtonGroupLabel = styled("label").withConfig({
|
|
|
56
56
|
borderRadius: themeGet("radii.2")(props),
|
|
57
57
|
display: "flex",
|
|
58
58
|
alignItems: "center",
|
|
59
|
-
padding:
|
|
59
|
+
padding: `0 ${themeGet("space.3")(props)}`,
|
|
60
60
|
transition: themeGet("transition.transitionDefault")(props),
|
|
61
61
|
fontSize: themeGet("fontSizes.1")(props),
|
|
62
62
|
fontWeight: themeGet("fontWeights.2")(props),
|
|
@@ -24,7 +24,7 @@ const Control = styled.input.attrs({
|
|
|
24
24
|
}).withConfig({
|
|
25
25
|
displayName: "Checkbox__Control",
|
|
26
26
|
componentId: "sc-p4d19b-2"
|
|
27
|
-
})(["opacity:0;position:absolute;margin:0;z-index:-1;width:0;height:0;overflow:hidden;pointer-events:none;&:focus{+ div{border-radius:2px;box-shadow:", ";}}+ div{transition:", ";&:before{background-color:", ";}> div{color:", ";}}:focus + div div:after{opacity:0.2;}:checked{+ div div:before{box-shadow:0 0 0 10px,10px -10px 0 10px,32px 0px 0 20px,0px 32px 0 20px,-5px 5px 0 10px,20px -12px 0 11px;.animate&{animation:", " 300ms forwards ease-out;}}}&:not(:checked) + div div:before{.animate&{animation:", " 300ms forwards ease-out;}}"], props => props.colour ? themeGet("shadows.thickOutline")(props) + " " + themeGet("colors." + props.colour + "30")(props) : themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.black20")(props), themeGet("transition.transitionDefault"), props => props.colour ? themeGet(
|
|
27
|
+
})(["opacity:0;position:absolute;margin:0;z-index:-1;width:0;height:0;overflow:hidden;pointer-events:none;&:focus{+ div{border-radius:2px;box-shadow:", ";}}+ div{transition:", ";&:before{background-color:", ";}> div{color:", ";}}:focus + div div:after{opacity:0.2;}:checked{+ div div:before{box-shadow:0 0 0 10px,10px -10px 0 10px,32px 0px 0 20px,0px 32px 0 20px,-5px 5px 0 10px,20px -12px 0 11px;.animate&{animation:", " 300ms forwards ease-out;}}}&:not(:checked) + div div:before{.animate&{animation:", " 300ms forwards ease-out;}}"], props => props.colour ? themeGet("shadows.thickOutline")(props) + " " + themeGet("colors." + props.colour + "30")(props) : themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.black20")(props), themeGet("transition.transitionDefault"), props => props.colour ? themeGet(`colors.${props.colour}`)(props) : themeGet("colors.greyDarker")(props), props => props.colour ? themeGet(`colors.${props.colour}`)(props) : themeGet("colors.greyDarker")(props), checkboxOn, checkboxOff);
|
|
28
28
|
const Box = styled.div.withConfig({
|
|
29
29
|
displayName: "Checkbox__Box",
|
|
30
30
|
componentId: "sc-p4d19b-3"
|
|
@@ -114,10 +114,10 @@ Checkbox.propTypes = {
|
|
|
114
114
|
// ariaLabel prop must be specified if label is not provided
|
|
115
115
|
ariaLabel: (props, propName) => {
|
|
116
116
|
if (!props.label && (props[propName] == null || props[propName] === "")) {
|
|
117
|
-
return new Error(
|
|
117
|
+
return new Error(`Missing prop \`${propName}\` not specified for Checkbox component. When \`label\` is not provided, \`${propName}\` is required.`);
|
|
118
118
|
}
|
|
119
119
|
if (props[propName] && typeof props[propName] !== "string") {
|
|
120
|
-
return new Error(
|
|
120
|
+
return new Error(`Invalid propType \`${propName}\` supplied to Checkbox component. Expected \`string\`, received \`${typeof props[propName]}\`.`);
|
|
121
121
|
}
|
|
122
122
|
return null;
|
|
123
123
|
},
|
|
@@ -77,12 +77,12 @@ const DatePickerContainer = styled.div.withConfig({
|
|
|
77
77
|
if (props.width) {
|
|
78
78
|
if (props.width.includes("px")) {
|
|
79
79
|
const widthValue = parseInt(props.width, 10);
|
|
80
|
-
return
|
|
80
|
+
return `${widthValue * 2}px`;
|
|
81
81
|
}
|
|
82
82
|
return props.width;
|
|
83
83
|
}
|
|
84
84
|
return "calc(134px * 2)";
|
|
85
|
-
}, props => props.width ? props.width : "134px", props => themeGet("colors.greyLight")(props), props => props.zIndex ? props.zIndex : "1", props => themeGet("fontSizes.2")(props), props => themeGet("fontWeights.1")(props), props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.white")(props), props => themeGet("colors.greyDarkest")(props), props => props.height ? props.height : "40px", props => props.width ? props.width : "134px", props => themeGet("radii.2")(props), props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.black30")(props), props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props), props => themeGet("shadows.thinOutline")(props), props => themeGet("colors.primary30")(props), props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props), props => themeGet("colors.grey")(props), props => themeGet("colors.greyLightest")(props), props => themeGet("colors.grey")(props), props => themeGet("shadows.thinOutline")(props), props => themeGet("colors.primary30")(props), props => themeGet("colors.primary")(props), props =>
|
|
85
|
+
}, props => props.width ? props.width : "134px", props => themeGet("colors.greyLight")(props), props => props.zIndex ? props.zIndex : "1", props => themeGet("fontSizes.2")(props), props => themeGet("fontWeights.1")(props), props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.white")(props), props => themeGet("colors.greyDarkest")(props), props => props.height ? props.height : "40px", props => props.width ? props.width : "134px", props => themeGet("radii.2")(props), props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.black30")(props), props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props), props => themeGet("shadows.thinOutline")(props), props => themeGet("colors.primary30")(props), props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props), props => themeGet("colors.grey")(props), props => themeGet("colors.greyLightest")(props), props => themeGet("colors.grey")(props), props => themeGet("shadows.thinOutline")(props), props => themeGet("colors.primary30")(props), props => themeGet("colors.primary")(props), props => `${themeGet("radii.2")(props)} 0 0 ${themeGet("radii.2")(props)}`, props => `0 ${themeGet("radii.2")(props)} ${themeGet("radii.2")(props)} 0`, props => `0 ${themeGet("radii.2")(props)} ${themeGet("radii.2")(props)} 0`, props => `0 ${themeGet("radii.2")(props)} ${themeGet("radii.2")(props)} 0`, props => props.height ? props.height : "40px", props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props), props => themeGet("colors.greyDarkest")(props), props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.primary")(props), props => themeGet("colors.primary")(props), props => themeGet("colors.primary")(props), props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.primaryDark")(props), props => themeGet("colors.primaryLight")(props), props => themeGet("colors.primaryLight")(props), props => themeGet("colors.white")(props), props => themeGet("colors.primary")(props), props => themeGet("colors.primary")(props), props => themeGet("colors.white")(props), props => themeGet("colors.primaryDarker")(props), props => themeGet("colors.primaryDarker")(props), props => props.zIndex ? props.zIndex + 1 : "2");
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
88
|
*
|
|
@@ -10,7 +10,7 @@ const Item = styled.div.withConfig({
|
|
|
10
10
|
}).withConfig({
|
|
11
11
|
displayName: "Divider__Item",
|
|
12
12
|
componentId: "sc-106mlj-0"
|
|
13
|
-
})(["", " ", " ", " display:block;width:100%;height:", ";grid-column:", ";border-bottom:", ";background-color:", ";"], space, layout, color, props => props.thick ? "3px" : "1px", props => props.spanGrid ? "1 / -1" : "auto", props => props.dash && props.thick && props.light ?
|
|
13
|
+
})(["", " ", " ", " display:block;width:100%;height:", ";grid-column:", ";border-bottom:", ";background-color:", ";"], space, layout, color, props => props.thick ? "3px" : "1px", props => props.spanGrid ? "1 / -1" : "auto", props => props.dash && props.thick && props.light ? `dashed 3px ${themeGet("colors.black10")(props)}` : props.dash && props.thick && props.inverted ? `dashed 3px ${themeGet("colors.white20")(props)}` : props.dash && props.inverted ? `dashed 1px ${themeGet("colors.white20")(props)}` : props.dash && props.light ? `dashed 1px ${themeGet("colors.black10")(props)}` : props.dash && props.thick ? `dashed 3px ${themeGet("colors.black20")(props)}` : props.dash ? `dashed 1px ${themeGet("colors.black20")(props)}` : "none", props => props.dash ? "transparent" : props.inverted ? themeGet("colors.white20")(props) : props.light ? themeGet("colors.black10")(props) : themeGet("colors.black20")(props));
|
|
14
14
|
export default function Divider(_ref) {
|
|
15
15
|
let {
|
|
16
16
|
light,
|
|
@@ -17,10 +17,10 @@ export default {
|
|
|
17
17
|
component: Header
|
|
18
18
|
};
|
|
19
19
|
export const defaultHeader = () => /*#__PURE__*/_jsxs(Header, {
|
|
20
|
-
appName:
|
|
21
|
-
userName:
|
|
20
|
+
appName: `App Name`,
|
|
21
|
+
userName: `Michael`,
|
|
22
22
|
avatarSource: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png",
|
|
23
|
-
clientInfo:
|
|
23
|
+
clientInfo: `Tenant: ci2153 Workspace: 20k-v5 [lb5ctx] UI_Version: 8c315c2 [4412] Backend_Version: dabc261 [3578]`,
|
|
24
24
|
logoutFunction: action("clicked-logout"),
|
|
25
25
|
sideMenuContent: /*#__PURE__*/_jsxs(StyledLink, {
|
|
26
26
|
href: "#",
|
|
@@ -150,11 +150,11 @@ export const headerWithWorkspaceSwitching = () => {
|
|
|
150
150
|
})]
|
|
151
151
|
});
|
|
152
152
|
return /*#__PURE__*/_jsx(Header, {
|
|
153
|
-
appName:
|
|
153
|
+
appName: `App Name`,
|
|
154
154
|
currentWorkspace: currentWorkspace,
|
|
155
|
-
userName:
|
|
155
|
+
userName: `Michael`,
|
|
156
156
|
avatarSource: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png",
|
|
157
|
-
clientInfo:
|
|
157
|
+
clientInfo: `Tenant: ci2153 Workspace: 20k-v5 [lb5ctx] UI_Version: 8c315c2 [4412] Backend_Version: dabc261 [3578]`,
|
|
158
158
|
logoutFunction: action("clicked-logout"),
|
|
159
159
|
workspaceSwitcherContent: select,
|
|
160
160
|
navToggleId: "headerWithWorkspaceSwitching",
|
|
@@ -381,7 +381,7 @@ const MobileNavToggle = styled("input").withConfig({
|
|
|
381
381
|
}
|
|
382
382
|
}));
|
|
383
383
|
const MobileNavMenu = styled("div").attrs(props => ({
|
|
384
|
-
"aria-hidden":
|
|
384
|
+
"aria-hidden": `${!props.isOpen}`
|
|
385
385
|
})).withConfig({
|
|
386
386
|
displayName: "Header__MobileNavMenu",
|
|
387
387
|
componentId: "sc-yf04b-20"
|
|
@@ -596,7 +596,7 @@ export default function Header(_ref) {
|
|
|
596
596
|
}), /*#__PURE__*/_jsx(MobileMenuToggle, {
|
|
597
597
|
theme: theme,
|
|
598
598
|
onClick: toggleMobileMenu,
|
|
599
|
-
"aria-expanded":
|
|
599
|
+
"aria-expanded": `${mobileMenuIsOpen}`,
|
|
600
600
|
"aria-label": "Menu",
|
|
601
601
|
children: /*#__PURE__*/_jsx(Hamburger, {
|
|
602
602
|
id: "hamburger-menu-icon"
|
|
@@ -7,8 +7,8 @@ export default {
|
|
|
7
7
|
component: HeaderSimple
|
|
8
8
|
};
|
|
9
9
|
export const defaultHeader = () => /*#__PURE__*/_jsx(HeaderSimple, {
|
|
10
|
-
appName:
|
|
11
|
-
userName:
|
|
10
|
+
appName: `App Name`,
|
|
11
|
+
userName: `Michael`,
|
|
12
12
|
avatarSource: "https://api.dicebear.com/7.x/personas/svg?seed=mike",
|
|
13
13
|
avatarAlt: "Avatar for Michael",
|
|
14
14
|
currentWorskapce: "Org Design Workspace"
|
|
@@ -65,7 +65,7 @@ const Icon = /*#__PURE__*/React.forwardRef(function Icon(_ref, ref) {
|
|
|
65
65
|
spin: spin,
|
|
66
66
|
symbol: symbol,
|
|
67
67
|
transform: transform,
|
|
68
|
-
title: title &&
|
|
68
|
+
title: title && `Icon-${title}`
|
|
69
69
|
})
|
|
70
70
|
});
|
|
71
71
|
return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
|
|
@@ -47,7 +47,43 @@ export const basicModal = () => /*#__PURE__*/_jsx(Basic, {});
|
|
|
47
47
|
basicModal.parameters = {
|
|
48
48
|
docs: {
|
|
49
49
|
source: {
|
|
50
|
-
code:
|
|
50
|
+
code: `
|
|
51
|
+
const Basic = () => {
|
|
52
|
+
const [visible, setVisible] = useState(false);
|
|
53
|
+
|
|
54
|
+
const handleOnButtonClick = () => {
|
|
55
|
+
setVisible(true);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const handleOnConfirm = () => {
|
|
59
|
+
setVisible(false);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const onToggleModal = (visible) => () => {
|
|
63
|
+
setVisible(visible);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
<Button onClick={handleOnButtonClick}>
|
|
69
|
+
Open basic modal
|
|
70
|
+
</Button>
|
|
71
|
+
<Modal
|
|
72
|
+
ariaLabel="Modal Title"
|
|
73
|
+
visible={visible}
|
|
74
|
+
handleOnConfirm={handleOnConfirm}
|
|
75
|
+
onClose={onToggleModal(false)}
|
|
76
|
+
>
|
|
77
|
+
<Spacer mb="r">
|
|
78
|
+
<H3>Modal Title</H3>
|
|
79
|
+
<P>
|
|
80
|
+
Content of the modal. Modal accepts any child components or content.
|
|
81
|
+
</P>
|
|
82
|
+
</Spacer>
|
|
83
|
+
</Modal>
|
|
84
|
+
</>
|
|
85
|
+
);
|
|
86
|
+
};`
|
|
51
87
|
}
|
|
52
88
|
}
|
|
53
89
|
};
|
|
@@ -100,7 +136,80 @@ export const advancedModal = () => /*#__PURE__*/_jsx(Advanced, {});
|
|
|
100
136
|
advancedModal.parameters = {
|
|
101
137
|
docs: {
|
|
102
138
|
source: {
|
|
103
|
-
code:
|
|
139
|
+
code: `
|
|
140
|
+
const Advanced = () => {
|
|
141
|
+
const [visible, setVisible] = useState(false);
|
|
142
|
+
|
|
143
|
+
const handleOnButtonClick = () => {
|
|
144
|
+
setVisible(true);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const handleOnConfirm = () => {
|
|
148
|
+
setVisible(false);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const onToggleModal = (visible) => () => {
|
|
152
|
+
setVisible(visible);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const modalHeader = <H3>Modal Title</H3>;
|
|
156
|
+
|
|
157
|
+
const modalFooter = (
|
|
158
|
+
<Button onClick={handleOnConfirm}>Go to full article</Button>
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<>
|
|
163
|
+
<Button onClick={handleOnButtonClick}>
|
|
164
|
+
Open advanced modal
|
|
165
|
+
</Button>
|
|
166
|
+
<Modal
|
|
167
|
+
maxWidth="500px"
|
|
168
|
+
maxHeight="400px"
|
|
169
|
+
height="90vh"
|
|
170
|
+
width="90vw"
|
|
171
|
+
visible={visible}
|
|
172
|
+
handleOnConfirm={handleOnConfirm}
|
|
173
|
+
onClose={onToggleModal(false)}
|
|
174
|
+
headerContent={modalHeader}
|
|
175
|
+
footerContent={modalFooter}
|
|
176
|
+
>
|
|
177
|
+
<Spacer my="r">
|
|
178
|
+
<P>
|
|
179
|
+
Content of the modal. Modal accepts any child components or content.
|
|
180
|
+
This content will be scrollable if it exeeds the height of the
|
|
181
|
+
modal.
|
|
182
|
+
</P>
|
|
183
|
+
<P>
|
|
184
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
185
|
+
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
|
|
186
|
+
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
187
|
+
aliquip ex ea commodo consequat. Duis aute irure dolor in
|
|
188
|
+
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
189
|
+
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
|
|
190
|
+
culpa qui officia deserunt mollit anim id est laborum.
|
|
191
|
+
</P>
|
|
192
|
+
<P>
|
|
193
|
+
Sed ut perspiciatis unde omnis iste natus error sit voluptatem
|
|
194
|
+
accusantium doloremque laudantium, totam rem aperiam, eaque ipsa
|
|
195
|
+
quae ab illo inventore veritatis et quasi architecto beatae vitae
|
|
196
|
+
dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit
|
|
197
|
+
aspernatur aut odit aut fugit, sed quia consequuntur magni dolores
|
|
198
|
+
eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est,
|
|
199
|
+
qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit,
|
|
200
|
+
sed quia non numquam eius modi tempora incidunt ut labore et dolore
|
|
201
|
+
magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis
|
|
202
|
+
nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut
|
|
203
|
+
aliquid ex ea commodi consequatur? Quis autem vel eum iure
|
|
204
|
+
reprehenderit qui in ea voluptate velit esse quam nihil molestiae
|
|
205
|
+
consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla
|
|
206
|
+
pariatur?
|
|
207
|
+
</P>
|
|
208
|
+
</Spacer>
|
|
209
|
+
</Modal>
|
|
210
|
+
</>
|
|
211
|
+
);
|
|
212
|
+
};`
|
|
104
213
|
}
|
|
105
214
|
}
|
|
106
215
|
};
|
|
@@ -159,7 +268,61 @@ export const basicDialogueModal = () => /*#__PURE__*/_jsx(BasicDialogue, {});
|
|
|
159
268
|
basicDialogueModal.parameters = {
|
|
160
269
|
docs: {
|
|
161
270
|
source: {
|
|
162
|
-
code:
|
|
271
|
+
code: `
|
|
272
|
+
const BasicDialogue = () => {
|
|
273
|
+
const [visible, setVisible] = useState(false);
|
|
274
|
+
|
|
275
|
+
const handleOnButtonClick = () => {
|
|
276
|
+
setVisible(true);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const handleOnConfirm = () => {
|
|
280
|
+
setVisible(false);
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const onToggleModal = (visible) => () => {
|
|
284
|
+
setVisible(visible);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const modalFooter = (
|
|
288
|
+
<Flex>
|
|
289
|
+
<Spacer mr="s">
|
|
290
|
+
<Button onClick={handleOnConfirm} px="l">
|
|
291
|
+
OK
|
|
292
|
+
</Button>
|
|
293
|
+
<Button variant="ghost" onClick={onToggleModal(false)}>
|
|
294
|
+
Cancel
|
|
295
|
+
</Button>
|
|
296
|
+
</Spacer>
|
|
297
|
+
</Flex>
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
return (
|
|
301
|
+
<>
|
|
302
|
+
<Button
|
|
303
|
+
onClick={handleOnButtonClick}
|
|
304
|
+
variant="danger"
|
|
305
|
+
iconLeft
|
|
306
|
+
>
|
|
307
|
+
<Icon icon={["fas", "trash"]} />
|
|
308
|
+
Delete data
|
|
309
|
+
</Button>
|
|
310
|
+
<Modal
|
|
311
|
+
visible={visible}
|
|
312
|
+
handleOnConfirm={handleOnConfirm}
|
|
313
|
+
onClose={onToggleModal(false)}
|
|
314
|
+
footerContent={modalFooter}
|
|
315
|
+
>
|
|
316
|
+
<Spacer mb="r">
|
|
317
|
+
<P weight="bold" marginBottom="sm">
|
|
318
|
+
This will remove all data from the application.
|
|
319
|
+
</P>
|
|
320
|
+
<P>Do you wish to continue?</P>
|
|
321
|
+
</Spacer>
|
|
322
|
+
</Modal>
|
|
323
|
+
</>
|
|
324
|
+
);
|
|
325
|
+
};`
|
|
163
326
|
}
|
|
164
327
|
}
|
|
165
328
|
};
|
|
@@ -231,7 +394,66 @@ export const editDialogueModal = () => /*#__PURE__*/_jsx(EditDialogue, {});
|
|
|
231
394
|
editDialogueModal.parameters = {
|
|
232
395
|
docs: {
|
|
233
396
|
source: {
|
|
234
|
-
code:
|
|
397
|
+
code: `
|
|
398
|
+
const EditDialogue = () => {
|
|
399
|
+
const [visible, setVisible] = useState(false);
|
|
400
|
+
|
|
401
|
+
const handleOnButtonClick = () => {
|
|
402
|
+
setVisible(true);
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
const handleOnConfirm = () => {
|
|
406
|
+
setVisible(false);
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
const onToggleModal = (visible) => () => {
|
|
410
|
+
setVisible(visible);
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
const modalHeader = <H3>Modify Details</H3>;
|
|
414
|
+
|
|
415
|
+
const modalFooter = (
|
|
416
|
+
<Flex>
|
|
417
|
+
<Spacer mr="s">
|
|
418
|
+
<Button onClick={handleOnConfirm} variant="success" iconLeft>
|
|
419
|
+
<Icon icon={["fas", "save"]} />
|
|
420
|
+
Save
|
|
421
|
+
</Button>
|
|
422
|
+
<Button variant="ghost" onClick={onToggleModal(false)} iconLeft>
|
|
423
|
+
<Icon icon={["fas", "times"]} />
|
|
424
|
+
Cancel
|
|
425
|
+
</Button>
|
|
426
|
+
</Spacer>
|
|
427
|
+
</Flex>
|
|
428
|
+
);
|
|
429
|
+
return (
|
|
430
|
+
<>
|
|
431
|
+
<Button onClick={handleOnButtonClick} iconLeft>
|
|
432
|
+
<Icon icon={["fas", "edit"]} />
|
|
433
|
+
Modify Details
|
|
434
|
+
</Button>
|
|
435
|
+
<Modal
|
|
436
|
+
visible={visible}
|
|
437
|
+
handleOnConfirm={handleOnConfirm}
|
|
438
|
+
onClose={onToggleModal(false)}
|
|
439
|
+
headerContent={modalHeader}
|
|
440
|
+
footerContent={modalFooter}
|
|
441
|
+
>
|
|
442
|
+
<Spacer my="r">
|
|
443
|
+
<TextInput
|
|
444
|
+
id="textInput1"
|
|
445
|
+
key="textInput1"
|
|
446
|
+
type="text"
|
|
447
|
+
fullWidth
|
|
448
|
+
label="Name"
|
|
449
|
+
placeholder="E.g. Awesome Project"
|
|
450
|
+
/>
|
|
451
|
+
<TextArea id="TextArea01" label="Description" fullWidth />
|
|
452
|
+
</Spacer>
|
|
453
|
+
</Modal>
|
|
454
|
+
</>
|
|
455
|
+
);
|
|
456
|
+
};`
|
|
235
457
|
}
|
|
236
458
|
}
|
|
237
459
|
};
|
|
@@ -81,7 +81,7 @@ const Modal = _ref => {
|
|
|
81
81
|
}, [restProps.ariaLabel, headerContent]);
|
|
82
82
|
const focusLastActiveElement = useCallback(() => {
|
|
83
83
|
if (!lastActiveElement) return;
|
|
84
|
-
if (lastActiveElement
|
|
84
|
+
if (lastActiveElement?.dataset.actionMenuId && isHidden(lastActiveElement?.parentNode)) {
|
|
85
85
|
const actionMenu = document.getElementById(lastActiveElement.dataset.actionMenuId);
|
|
86
86
|
actionMenu.focus();
|
|
87
87
|
} else {
|