orcs-design-system 3.4.2 → 3.4.4
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/GlobalStyles.js +1 -1
- package/es/components/ActionsMenu/index.js +7 -7
- package/es/components/Checkbox/index.js +3 -3
- package/es/components/CodeBlock/index.js +6 -0
- package/es/components/DatePicker/index.js +1 -1
- package/es/components/Expandable/index.js +1 -1
- package/es/components/Popover/index.js +1 -1
- package/es/components/Range/index.js +1 -1
- package/es/components/SideNavV2/NavItem.js +45 -19
- package/es/components/SideNavV2/components/BaseSection.js +15 -2
- package/es/components/SideNavV2/components/ExpandedPanel.js +1 -1
- package/es/components/SideNavV2/sections/SideNavCurrentViewSection.js +1 -1
- package/es/components/SideNavV2/styles/SideNavV2.styles.js +28 -7
- package/es/components/SideNavV2/styles/sharedHoverStyles.js +1 -1
- package/es/components/Tabs/index.js +1 -1
- package/es/components/TextInput/index.js +1 -1
- package/es/components/Toggle/index.js +2 -2
- package/es/components.test.js +1 -1
- package/es/index.js +0 -2
- package/package.json +7 -3
- package/es/components/TabsAlt/TabsAlt.stories.js +0 -124
- package/es/components/TabsAlt/index.js +0 -279
package/es/GlobalStyles.js
CHANGED
|
@@ -3,5 +3,5 @@ import { themeGet } from "@styled-system/theme-get";
|
|
|
3
3
|
// GLOBAL STYLES
|
|
4
4
|
// For browser reset, setting global box sizing and font sizing etc.
|
|
5
5
|
|
|
6
|
-
const GlobalStyles = /*#__PURE__*/createGlobalStyle(["html{box-sizing:border-box;line-height:1.15;line-height:calc(2px + 2ex + 2px);}html *{line-height:calc(2px + 2ex + 2px);}
|
|
6
|
+
const GlobalStyles = /*#__PURE__*/createGlobalStyle(["html{box-sizing:border-box;line-height:1.15;line-height:calc(2px + 2ex + 2px);}html *{line-height:calc(2px + 2ex + 2px);}*,*::before,*::after{box-sizing:inherit;}html,body{height:100%;width:100%;margin:", ";}body{font-family:", ";color:", ";}html{font-size:62.5%;}body{font-size:", ";}main{display:flex;align-items:stretch;align-content:stretch;width:100%;}section{height:auto;width:100%;overflow-y:auto;}img{border-style:none;}small{font-size:80%;}p{margin:", ";}h1,h2,h3,h4,h5,h6{font-weight:", ";font-family:", ";margin:", ";}h1{font-size:", "}h2{font-size:", "}h3{font-size:", "}h4{font-size:", "}h5{font-size:", "}h6{font-size:", "}a,p,small,li,h1,h2,h3,h4,h5,h6{word-break:break-word;}"], props => themeGet("space.0")(props), props => themeGet("fonts.main")(props), props => themeGet("colors.greyDarkest")(props), props => themeGet("fontSizes.2")(props), props => themeGet("space.0")(props), props => themeGet("fontWeights.1")(props), props => themeGet("fonts.main")(props), props => themeGet("space.0")(props), props => themeGet("fontSizes.6")(props), props => themeGet("fontSizes.5")(props), props => themeGet("fontSizes.4")(props), props => themeGet("fontSizes.3")(props), props => themeGet("fontSizes.2")(props), props => themeGet("fontSizes.1")(props));
|
|
7
7
|
export default GlobalStyles;
|
|
@@ -28,7 +28,7 @@ const Wrapper = /*#__PURE__*/styled.div.withConfig({
|
|
|
28
28
|
const Control = /*#__PURE__*/styled.button.withConfig({
|
|
29
29
|
displayName: "Control",
|
|
30
30
|
componentId: "sc-yvbni2-2"
|
|
31
|
-
})(["position:relative;display:flex;align-items:center;justify-content:center;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;text-decoration:none;text-align:center;transition:", ";cursor:", ";", " &[data-state=\"open\"] .actionsMenu__dots{
|
|
31
|
+
})(["position:relative;display:flex;align-items:center;justify-content:center;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;text-decoration:none;text-align:center;transition:", ";cursor:", ";", " &[data-state=\"open\"] .actionsMenu__dots{&::before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&::after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}&[data-state=\"open\"] .actionsMenu__cross{&::before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&::after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}&[data-state=\"closed\"] .actionsMenu__dots{&::before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&::after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}&[data-state=\"closed\"] .actionsMenu__cross{&::before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&::after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}"], props => themeGet("transition.transitionDefault")(props), props => props.disabled ? "not-allowed" : "pointer", props => variant({
|
|
32
32
|
variants: {
|
|
33
33
|
default: {
|
|
34
34
|
width: "30px",
|
|
@@ -59,17 +59,17 @@ const Control = /*#__PURE__*/styled.button.withConfig({
|
|
|
59
59
|
const Dots = /*#__PURE__*/styled.div.withConfig({
|
|
60
60
|
displayName: "Dots",
|
|
61
61
|
componentId: "sc-yvbni2-3"
|
|
62
|
-
})(["border-radius:2px;height:4px;width:4px
|
|
62
|
+
})(["border-radius:2px;height:4px;width:4px;&::before,&::after{content:\"\";display:block;position:absolute;border-radius:2px;height:4px;width:4px;}&::before{transform:translate(0,-6px);}&::after{transform:translate(0,6px);}", ""], props => variant({
|
|
63
63
|
variants: {
|
|
64
64
|
default: {
|
|
65
65
|
backgroundColor: themeGet("colors.greyDarker")(props),
|
|
66
|
-
"
|
|
66
|
+
"&::before, &::after": {
|
|
67
67
|
backgroundColor: themeGet("colors.greyDarker")(props)
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
circle: {
|
|
71
71
|
backgroundColor: themeGet("colors.white")(props),
|
|
72
|
-
"
|
|
72
|
+
"&::before, &::after": {
|
|
73
73
|
backgroundColor: themeGet("colors.white")(props)
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -78,15 +78,15 @@ const Dots = /*#__PURE__*/styled.div.withConfig({
|
|
|
78
78
|
const Cross = /*#__PURE__*/styled.div.withConfig({
|
|
79
79
|
displayName: "Cross",
|
|
80
80
|
componentId: "sc-yvbni2-4"
|
|
81
|
-
})(["animation:1500ms ", " ease-in-out forwards;opacity:0;position:absolute;left:calc(50% - 2px);top:calc(50% - 2px)
|
|
81
|
+
})(["animation:1500ms ", " ease-in-out forwards;opacity:0;position:absolute;left:calc(50% - 2px);top:calc(50% - 2px);&::before,&::after{content:\"\";display:block;position:absolute;border-radius:2px;height:4px;width:4px;}&::before{transform:rotate(-45deg);}&::after{transform:rotate(45deg);}", ""], crossFadeIn, props => variant({
|
|
82
82
|
variants: {
|
|
83
83
|
default: {
|
|
84
|
-
"
|
|
84
|
+
"&::before, &::after": {
|
|
85
85
|
backgroundColor: themeGet("colors.greyDarker")(props)
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
circle: {
|
|
89
|
-
"
|
|
89
|
+
"&::before, &::after": {
|
|
90
90
|
backgroundColor: themeGet("colors.white")(props)
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -60,7 +60,7 @@ const Control = /*#__PURE__*/styled.input.attrs({
|
|
|
60
60
|
}).withConfig({
|
|
61
61
|
displayName: "Control",
|
|
62
62
|
componentId: "sc-p4d19b-2"
|
|
63
|
-
})(["opacity:0;position:absolute;margin:0;z-index:-1;width:0;height:0;overflow:hidden;pointer-events:none;&:focus{+ div{border-radius:2px;", "}}+ div{transition:", "
|
|
63
|
+
})(["opacity:0;position:absolute;margin:0;z-index:-1;width:0;height:0;overflow:hidden;pointer-events:none;&:focus{+ div{border-radius:2px;", "}}+ div{transition:", ";&::before{", "}> div{", "}}&: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 => {
|
|
64
64
|
const shadow = themeGet("shadows.thickOutline")(props);
|
|
65
65
|
const focusColors = getCheckboxFocusColors(props);
|
|
66
66
|
return variant({
|
|
@@ -137,11 +137,11 @@ const Control = /*#__PURE__*/styled.input.attrs({
|
|
|
137
137
|
const Box = /*#__PURE__*/styled.div.withConfig({
|
|
138
138
|
displayName: "Box",
|
|
139
139
|
componentId: "sc-p4d19b-3"
|
|
140
|
-
})(["position:relative;height:20px;width:20px
|
|
140
|
+
})(["position:relative;height:20px;width:20px;&::before{content:\"\";display:block;position:absolute;left:8px;top:8px;height:4px;width:4px;border-radius:100%;z-index:1;opacity:0;margin:0;pointer-events:none;background-color:", ";}"], props => themeGet("colors.black50")(props));
|
|
141
141
|
const Check = /*#__PURE__*/styled.div.withConfig({
|
|
142
142
|
displayName: "Check",
|
|
143
143
|
componentId: "sc-p4d19b-4"
|
|
144
|
-
})(["position:relative;display:inline-block;width:20px;height:20px;border:2px solid;border-radius:", ";overflow:hidden;z-index:1;color:", ";", "
|
|
144
|
+
})(["position:relative;display:inline-block;width:20px;height:20px;border:2px solid;border-radius:", ";overflow:hidden;z-index:1;color:", ";", " &::before{content:\"\";position:absolute;transform:rotate(45deg);display:block;margin-top:-4px;margin-left:6px;width:0;height:0;box-shadow:0 0 0 0,0 0 0 0,0 0 0 0,0 0 0 0,0 0 0 0,0 0 0 0,0 0 0 0 inset;@media not all and (min-resolution:0.001dpcm){@supports (-webkit-appearance:none){width:1px;height:1px;}}}"], props => themeGet("radii.1")(props), props => themeGet("colors.greyDarker")(props), props => {
|
|
145
145
|
const colors = getCheckboxColors(props);
|
|
146
146
|
return variant({
|
|
147
147
|
variants: createCheckboxVariants({
|
|
@@ -73,7 +73,12 @@ const CopyButton = /*#__PURE__*/styled("button").attrs({
|
|
|
73
73
|
opacity: 0.6
|
|
74
74
|
}
|
|
75
75
|
}));
|
|
76
|
+
const omitMaxHeightProp = (prop, defaultValidatorFn) => {
|
|
77
|
+
const isValidProp = typeof defaultValidatorFn === "function" ? defaultValidatorFn(prop) : true;
|
|
78
|
+
return prop !== "maxHeight" && isValidProp;
|
|
79
|
+
};
|
|
76
80
|
const PreTag = /*#__PURE__*/styled("pre").withConfig({
|
|
81
|
+
shouldForwardProp: omitMaxHeightProp,
|
|
77
82
|
displayName: "PreTag",
|
|
78
83
|
componentId: "sc-1yib7z6-4"
|
|
79
84
|
})(props => css({
|
|
@@ -86,6 +91,7 @@ const PreTag = /*#__PURE__*/styled("pre").withConfig({
|
|
|
86
91
|
fontFamily: "monospace"
|
|
87
92
|
}));
|
|
88
93
|
const EditableCodeContainer = /*#__PURE__*/styled("div").withConfig({
|
|
94
|
+
shouldForwardProp: omitMaxHeightProp,
|
|
89
95
|
displayName: "EditableCodeContainer",
|
|
90
96
|
componentId: "sc-1yib7z6-5"
|
|
91
97
|
})(props => css({
|
|
@@ -78,7 +78,7 @@ const DatePickerLabel = /*#__PURE__*/styled.label.withConfig({
|
|
|
78
78
|
const DatePickerContainer = /*#__PURE__*/styled.div.withConfig({
|
|
79
79
|
displayName: "DatePickerContainer",
|
|
80
80
|
componentId: "sc-15292wq-1"
|
|
81
|
-
})([".SingleDatePicker{width:", ";}.DateRangePicker{width:", ";}.SingleDatePickerInput,.DateRangePickerInput{display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;border:0;border-radius:0;background:transparent;}.SingleDatePickerInput__withBorder,.DateRangePickerInput__withBorder{border:none;border-radius:0;}.DateInput{width:", ";background:none;position:relative;}.DateRangePickerInput_arrow_svg path{fill:", ";}.DateRangePickerInput_arrow{display:none;}.SingleDatePicker_picker,.DateRangePicker_picker{background:none;z-index:", ";}.DateInput_input{display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;font-size:", ";font-weight:", ";z-index:1;transition:", ";background:", ";color:", ";height:", ";width:", ";padding:5px 12px 6px 12px;border-radius:", ";border:1px solid ", ";&:hover{border:1px solid ", ";}&:focus{outline:0;box-shadow:", " ", ";border:1px solid ", ";}&::placeholder{color:", ";}}.DateInput_input[disabled]{background:", ";color:", ";}.DateInput_input__focused{outline:0;box-shadow:", " ", ";border:1px solid ", ";}.DateRangePickerInput .DateInput:first-child .DateInput_input{border-radius:", ";}.DateRangePickerInput .DateInput:last-child .DateInput_input,.DateRangePickerInput__showClearDates .DateInput .DateInput_input,.DateRangePickerInput__showClearDates .DateInput .DateInput_input__disabled{border-radius:", ";}.SingleDatePickerInput__showClearDate,.DateRangePickerInput__showClearDates{padding-right:0;.SingleDatePickerInput_clearDate,.DateRangePickerInput_clearDates{display:none;}.DateInput:has(.DateInput_input:not([value=\"\"])) ~ .SingleDatePickerInput_clearDate,.DateInput:has(.DateInput_input:not([value=\"\"])) ~ .DateRangePickerInput_clearDates{display:flex;}}.SingleDatePickerInput__showClearDate,.DateRangePickerInput__showClearDates{display:flex;align-items:center;}.DateRangePickerInput__showClearDates .DateInput:first-child:has(.DateInput_input:not([value=\"\"])) ~ .DateInput .DateInput_input,.DateRangePickerInput__showClearDates .DateInput:first-child ~ .DateInput .DateInput_input:not([value=\"\"]){border-radius:", ";}.SingleDatePickerInput_clearDate,.DateRangePickerInput_clearDates{background-color:transparent;border-radius:", ";height:", ";display:flex;align-items:center;justify-content:center;margin:0;position:absolute;top:auto;right:0;transform:none;&:hover,&:focus{outline:0;svg path{fill:", ";}}.DayPickerKeyboardShortcuts_panel{color:", ";}.CalendarDay__default{transition:", ";}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:", ";border:1px solid ", ";}.DayPickerKeyboardShortcuts_show__bottomRight{border-radius:0 0 3px 0;overflow:hidden;}.DayPickerKeyboardShortcuts_show__topRight{border-radius:0 3px 0 0;overflow:hidden;}.DayPickerKeyboardShortcuts_show__bottomRight
|
|
81
|
+
})([".SingleDatePicker{width:", ";}.DateRangePicker{width:", ";}.SingleDatePickerInput,.DateRangePickerInput{display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;border:0;border-radius:0;background:transparent;}.SingleDatePickerInput__withBorder,.DateRangePickerInput__withBorder{border:none;border-radius:0;}.DateInput{width:", ";background:none;position:relative;}.DateRangePickerInput_arrow_svg path{fill:", ";}.DateRangePickerInput_arrow{display:none;}.SingleDatePicker_picker,.DateRangePicker_picker{background:none;z-index:", ";}.DateInput_input{display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;font-size:", ";font-weight:", ";z-index:1;transition:", ";background:", ";color:", ";height:", ";width:", ";padding:5px 12px 6px 12px;border-radius:", ";border:1px solid ", ";&:hover{border:1px solid ", ";}&:focus{outline:0;box-shadow:", " ", ";border:1px solid ", ";}&::placeholder{color:", ";}}.DateInput_input[disabled]{background:", ";color:", ";}.DateInput_input__focused{outline:0;box-shadow:", " ", ";border:1px solid ", ";}.DateRangePickerInput .DateInput:first-child .DateInput_input{border-radius:", ";}.DateRangePickerInput .DateInput:last-child .DateInput_input,.DateRangePickerInput__showClearDates .DateInput .DateInput_input,.DateRangePickerInput__showClearDates .DateInput .DateInput_input__disabled{border-radius:", ";}.SingleDatePickerInput__showClearDate,.DateRangePickerInput__showClearDates{padding-right:0;.SingleDatePickerInput_clearDate,.DateRangePickerInput_clearDates{display:none;}.DateInput:has(.DateInput_input:not([value=\"\"])) ~ .SingleDatePickerInput_clearDate,.DateInput:has(.DateInput_input:not([value=\"\"])) ~ .DateRangePickerInput_clearDates{display:flex;}}.SingleDatePickerInput__showClearDate,.DateRangePickerInput__showClearDates{display:flex;align-items:center;}.DateRangePickerInput__showClearDates .DateInput:first-child:has(.DateInput_input:not([value=\"\"])) ~ .DateInput .DateInput_input,.DateRangePickerInput__showClearDates .DateInput:first-child ~ .DateInput .DateInput_input:not([value=\"\"]){border-radius:", ";}.SingleDatePickerInput_clearDate,.DateRangePickerInput_clearDates{background-color:transparent;border-radius:", ";height:", ";display:flex;align-items:center;justify-content:center;margin:0;position:absolute;top:auto;right:0;transform:none;&:hover,&:focus{outline:0;svg path{fill:", ";}}.DayPickerKeyboardShortcuts_panel{color:", ";}.CalendarDay__default{transition:", ";}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:", ";border:1px solid ", ";}.DayPickerKeyboardShortcuts_show__bottomRight{border-radius:0 0 3px 0;overflow:hidden;}.DayPickerKeyboardShortcuts_show__topRight{border-radius:0 3px 0 0;overflow:hidden;}.DayPickerKeyboardShortcuts_show__bottomRight::before,.DayPickerKeyboardShortcuts_show__topRight::before{border-right:33px solid ", ";transition:", ";}.DayPickerKeyboardShortcuts_show__bottomRight:hover::before,.DayPickerKeyboardShortcuts_show__topRight:hover::before{border-right:33px solid ", ";}.CalendarDay__selected_span,.CalendarDay__hovered_span,.CalendarDay__hovered_span:active{background:", ";border:1px solid ", ";color:", ";}.CalendarDay__hovered_span:hover,.CalendarDay__default:hover{background:", ";border:1px double ", ";color:", ";}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:", ";border:1px solid ", ";}.DateInput_fang{margin-top:1px;z-index:", ";}"], props => props.width ? props.width : "134px", props => {
|
|
82
82
|
if (props.width) {
|
|
83
83
|
if (props.width.includes("px")) {
|
|
84
84
|
const widthValue = parseInt(props.width, 10);
|
|
@@ -18,7 +18,7 @@ const Item = /*#__PURE__*/styled.div.withConfig({
|
|
|
18
18
|
const Button = /*#__PURE__*/styled.button.withConfig({
|
|
19
19
|
displayName: "Button",
|
|
20
20
|
componentId: "sc-na4gdb-1"
|
|
21
|
-
})(["position:relative;display:block;border:none;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;cursor:pointer;width:100%;margin:0;font-size:", ";text-align:left;color:", ";padding:", ";}border-left:solid 3px ", ";border-radius:", ";background:", ";transition:", ";&:hover{background:", ";border-left:solid 3px ", ";}&:focus{outline:0;border-left:solid 3px ", ";}
|
|
21
|
+
})(["position:relative;display:block;border:none;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;cursor:pointer;width:100%;margin:0;font-size:", ";text-align:left;color:", ";padding:", ";}border-left:solid 3px ", ";border-radius:", ";background:", ";transition:", ";&:hover{background:", ";border-left:solid 3px ", ";}&:focus{outline:0;border-left:solid 3px ", ";}&::after,&::before{content:\"\";position:absolute;top:50%;transform:translateY(-50%);width:2px;height:12px;right:", ";background-color:", ";transition:", ";}&::before{transform:", ";}&::after{transform:translateY(-50%) rotate(90deg);}"], props => themeGet("fontSizes.3")(props), props => themeGet("colors.greyDarker")(props), props => props.small ? "8px 33px 8px 8px" : "18px 48px 18px 16px", props => themeGet("colors.greyLightest")(props), props => themeGet("radii.1")(props), props => themeGet("colors.greyLightest")(props), props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.greyLighter")(props), props => themeGet("colors.greyLighter")(props), props => themeGet("colors.primary")(props), props => props.small ? "16px" : "24px", props => themeGet("colors.greyDark")(props), props => themeGet("transition.transitionDefault")(props), props => props.open ? "translateY(-50%) rotate(90deg)" : "translateY(-50%)");
|
|
22
22
|
const Text = /*#__PURE__*/styled.div.withConfig({
|
|
23
23
|
displayName: "Text",
|
|
24
24
|
componentId: "sc-na4gdb-2"
|
|
@@ -41,7 +41,7 @@ const TooltipControl = /*#__PURE__*/styled.div.withConfig({
|
|
|
41
41
|
const StyledPopover = /*#__PURE__*/styled.div.withConfig({
|
|
42
42
|
displayName: "StyledPopover",
|
|
43
43
|
componentId: "sc-1bwoak-2"
|
|
44
|
-
})(["font-size:", ";line-height:", ";font-weight:", ";text-align:", ";word-break:break-word;color:", ";outline:0;padding:", ";border-radius:", ";width:", ";background:", ";border:1px solid ", ";box-shadow:", ";user-select:", ";&.hack-for-legacy-tests{position:absolute;pointer-events:none;opacity:0;visibility:hidden;height:0;width:0;padding:0;overflow:hidden;}&.visible{opacity:1;pointer-events:auto;visibility:visible;}& a{font-size:", ";}
|
|
44
|
+
})(["font-size:", ";line-height:", ";font-weight:", ";text-align:", ";word-break:break-word;color:", ";outline:0;padding:", ";border-radius:", ";width:", ";background:", ";border:1px solid ", ";box-shadow:", ";user-select:", ";&.hack-for-legacy-tests{position:absolute;pointer-events:none;opacity:0;visibility:hidden;height:0;width:0;padding:0;overflow:hidden;}&.visible{opacity:1;pointer-events:auto;visibility:visible;}& a{font-size:", ";}&::before{content:\"\";z-index:2;height:0;width:0;border-style:solid;border-width:6px 6px 6px 0;border-color:transparent;border-right-color:", ";left:-6px;top:50%;margin-top:-6px;position:absolute;}&::after{content:\"\";z-index:1;position:absolute;border-color:transparent;border-right-color:", ";height:0;width:0;border-style:solid;border-width:6px 6px 6px 0;left:-7px;top:50%;margin-top:-6px;}&.top{&::before{left:50%;top:auto;margin-top:0;bottom:-9px;margin-left:-3px;transform:rotate(-90deg);}&::after{left:50%;top:auto;margin-top:0;bottom:-10px;margin-left:-3px;transform:rotate(-90deg);}}&.topRight,&.top-end{&::before{left:1px;top:auto;margin-top:0;bottom:-5px;margin-left:-6px;transform:rotate(-45deg);border-width:5px 10px 5px 0;}&::after{left:1px;top:auto;margin-top:0;bottom:-6px;margin-left:-7px;transform:rotate(-45deg);border-width:5px 10px 5px 0;}}&.bottomRight,&.bottom-end{&::before{left:1px;bottom:auto;margin-top:0;top:-5px;margin-left:-6px;transform:rotate(45deg);border-width:5px 10px 5px 0;}&::after{left:1px;bottom:auto;margin-top:0;top:-6px;margin-left:-7px;transform:rotate(45deg);border-width:5px 10px 5px 0;}}&.bottom{&::before{left:50%;top:-9px;margin-top:0;margin-left:-3px;transform:rotate(90deg);}&::after{left:50%;top:-10px;margin-top:0;margin-left:-3px;transform:rotate(90deg);}}&.bottomLeft,&.bottom-start{&::before{right:1px;left:auto;bottom:auto;margin-top:0;top:-5px;margin-right:-6px;transform:rotate(135deg);border-width:5px 10px 5px 0;}&::after{right:1px;left:auto;bottom:auto;margin-top:0;top:-6px;margin-right:-7px;transform:rotate(135deg);border-width:5px 10px 5px 0;}}&.left{&::before{left:auto;right:-6px;transform:rotate(180deg);}&::after{left:auto;right:-7px;transform:rotate(180deg);top:50%;margin-top:-6px;}}&.topLeft,&.top-start{&::before{right:1px;left:auto;top:auto;margin-top:0;bottom:-5px;margin-right:-6px;transform:rotate(225deg);border-width:5px 10px 5px 0;}&::after{right:1px;left:auto;top:auto;margin-top:0;bottom:-6px;margin-right:-7px;transform:rotate(225deg);border-width:5px 10px 5px 0;}}"], themeGet("fontSizes.0"), themeGet("fontSizes.1"), themeGet("fontWeights.1"), props => props.textAlign ? props.textAlign : "left", themeGet("colors.greyDarkest"), themeGet("space.3"), themeGet("radii.1"), props => props.width ? props.width : "200px", themeGet("colors.white"), themeGet("colors.greyLight"), themeGet("shadows.boxDefault"), props => props.enableSelectAll ? "all" : "auto", themeGet("fontSizes.0"), themeGet("colors.white"), themeGet("colors.greyMid"));
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Prevents the browser from scrolling to the previously focused element
|
|
@@ -18,7 +18,7 @@ const track = props => "\n box-sizing: border-box;\n border: none;\n wi
|
|
|
18
18
|
const Wrapper = /*#__PURE__*/styled.div.withConfig({
|
|
19
19
|
displayName: "Wrapper",
|
|
20
20
|
componentId: "sc-zb0zps-0"
|
|
21
|
-
})(["", " ", " position:relative;width:100%;display:flex;flex-wrap:wrap;align-items:center
|
|
21
|
+
})(["", " ", " position:relative;width:100%;display:flex;flex-wrap:wrap;align-items:center;&::before{content:\"", "\";font-size:10px;font-weight:bold;}&::after{content:\"", "\";font-size:10px;font-weight:bold;}", ""], space, layout, props => props.minValue, props => props.maxValue, props => props.inverted ? css(["&::before,&::after{color:", ";}input{&:focus{background:rgba(255,255,255,0.1);}&::-webkit-slider-runnable-track{background:", ";}&::-moz-range-track{background:", ";}&::-ms-track{background:", ";}}output{color:", ";}"], themeGet("colors.white")(props), themeGet("colors.greyDark")(props), themeGet("colors.greyDark")(props), themeGet("colors.greyDark")(props), themeGet("colors.white")(props)) : css([""]));
|
|
22
22
|
const Input = /*#__PURE__*/styled.input.attrs({
|
|
23
23
|
type: "range"
|
|
24
24
|
}).withConfig({
|
|
@@ -20,10 +20,10 @@ const IconWrapper = /*#__PURE__*/styled.span.withConfig({
|
|
|
20
20
|
displayName: "IconWrapper",
|
|
21
21
|
componentId: "sc-1qz1q0h-0"
|
|
22
22
|
})(["display:inline-flex;align-items:center;justify-content:center;width:", ";flex-shrink:0;> *{width:", " !important;max-width:", ";}"], ICON_COLUMN_WIDTH, ICON_COLUMN_WIDTH, ICON_COLUMN_WIDTH);
|
|
23
|
-
const sharedNavItemStyles =
|
|
23
|
+
const sharedNavItemStyles = props => styledCss(["cursor:pointer;text-decoration:none;border-radius:", ";width:100%;position:relative;border:none;path{transition:", ";fill:", ";}font-family:", ";display:grid;grid-template-columns:", ";place-items:center;transition:", ";background-color:transparent;font-size:1.4rem;font-weight:", ";", " @media screen and (max-width:", "px){width:auto;max-height:30px;height:30px;overflow:visible;}&:focus{outline:0;}"], themeGet("radii.2"), themeGet("transition.transitionDefault"), themeGet("colors.greyDarker"), themeGet("fonts.main"), ICON_COLUMN_WIDTH, themeGet("transition.transitionDefault"), themeGet("fontWeights.1"), !props.active && sharedNavItemHoverStyles, BREAKPOINTS.SMALL_SCREEN);
|
|
24
24
|
const expandedNavItemStyles = props => styledCss(["grid-template-columns:", " 1fr;gap:", ";justify-items:start;align-items:center;padding-left:0;.nav-item-text{font-size:", ";line-height:1;font-weight:", ";color:", ";text-align:left;justify-self:start;padding-left:", ";}&:hover .nav-item-text,&:focus .nav-item-text{color:", ";}"], ICON_COLUMN_WIDTH, themeGet("space.s"), themeGet("fontSizes.1"), themeGet("fontWeights.1"), props.active ? themeGet("colors.greyDarkest") : themeGet("colors.greyDarker"), themeGet("space.s"), props.active ? themeGet("colors.greyDarkest") : themeGet("colors.primary"));
|
|
25
25
|
const variantActiveStyles = {
|
|
26
|
-
expandableItem: () => styledCss(["color:", ";path{fill:", ";}
|
|
26
|
+
expandableItem: () => styledCss(["color:", ";path{fill:", ";}&:hover .nav-item-text,&:focus .nav-item-text{color:", ";}@media screen and (max-width:", "px){&::after{content:\"\";position:absolute;top:0;left:0;right:0;width:100%;height:0;border-top:3px solid ", ";transform:translateY(-10px);z-index:10;}}"], themeGet("colors.greyDarkest"), themeGet("colors.greyDarkest"), themeGet("colors.primary"), BREAKPOINTS.SMALL_SCREEN, themeGet("colors.primary")),
|
|
27
27
|
default: styledCss(["", ""], props => sharedNavItemActiveStylesProps(props))
|
|
28
28
|
};
|
|
29
29
|
const getActiveStyles = props => {
|
|
@@ -36,11 +36,11 @@ const getActiveStyles = props => {
|
|
|
36
36
|
const SideNavItemLink = /*#__PURE__*/styled.div.withConfig({
|
|
37
37
|
displayName: "SideNavItemLink",
|
|
38
38
|
componentId: "sc-1qz1q0h-1"
|
|
39
|
-
})(["& > a{", " ", " ", "}"], sharedNavItemStyles, props => props.isExpanded ? expandedNavItemStyles(props) : "", getActiveStyles);
|
|
39
|
+
})(["& > a{", " ", " ", "}"], props => sharedNavItemStyles(props), props => props.isExpanded ? expandedNavItemStyles(props) : "", props => getActiveStyles(props));
|
|
40
40
|
const SideNavItem = /*#__PURE__*/styled("button").withConfig({
|
|
41
41
|
displayName: "SideNavItem",
|
|
42
42
|
componentId: "sc-1qz1q0h-2"
|
|
43
|
-
})(["", " ", " ", ""], sharedNavItemStyles, props => props.isExpanded ? expandedNavItemStyles(props) : "", getActiveStyles);
|
|
43
|
+
})(["", " ", " ", ""], props => sharedNavItemStyles(props), props => props.isExpanded ? expandedNavItemStyles(props) : "", props => getActiveStyles(props));
|
|
44
44
|
const BadgeNumber = /*#__PURE__*/styled("div").withConfig({
|
|
45
45
|
displayName: "BadgeNumber",
|
|
46
46
|
componentId: "sc-1qz1q0h-3"
|
|
@@ -76,22 +76,45 @@ const BadgeDot = /*#__PURE__*/styled("div").withConfig({
|
|
|
76
76
|
const SideNavItemWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
77
77
|
displayName: "SideNavItemWrapper",
|
|
78
78
|
componentId: "sc-1qz1q0h-5"
|
|
79
|
-
})(props => css(_objectSpread(_objectSpread({
|
|
79
|
+
})(props => css(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
80
80
|
padding: themeGet("space.xs")(props),
|
|
81
81
|
borderRadius: themeGet("radii.2")(props),
|
|
82
82
|
width: "100%",
|
|
83
|
+
position: "relative",
|
|
83
84
|
"&:nth-child(1 of .bottom-aligned) ": {
|
|
84
85
|
marginTop: props.bottomAligned && "auto"
|
|
85
|
-
}
|
|
86
|
-
|
|
86
|
+
}
|
|
87
|
+
}, !props.isActive && !props.isLink && {
|
|
88
|
+
"&:has(button:hover)": {
|
|
89
|
+
backgroundColor: themeGet("colors.greyLightest")(props)
|
|
90
|
+
}
|
|
91
|
+
}), !props.isActive && props.isLink && {
|
|
92
|
+
"&:has(a:hover):not(:has(a.active))": {
|
|
87
93
|
backgroundColor: themeGet("colors.greyLightest")(props)
|
|
88
94
|
}
|
|
89
|
-
}, props.isActive && props.isLink && {
|
|
95
|
+
}), props.isActive && props.isLink && {
|
|
90
96
|
backgroundColor: themeGet("colors.primaryLightest")(props)
|
|
97
|
+
}), props.isActive && props.isExpandable && {
|
|
98
|
+
"&::after": {
|
|
99
|
+
content: '""',
|
|
100
|
+
position: "absolute",
|
|
101
|
+
right: "-9px",
|
|
102
|
+
top: "0",
|
|
103
|
+
bottom: "0",
|
|
104
|
+
width: "3px",
|
|
105
|
+
backgroundColor: themeGet("colors.primary")(props),
|
|
106
|
+
zIndex: 5
|
|
107
|
+
}
|
|
91
108
|
}), {}, {
|
|
92
|
-
["@media screen and (max-width: ".concat(BREAKPOINTS.SMALL_SCREEN, "px)")]: {
|
|
109
|
+
["@media screen and (max-width: ".concat(BREAKPOINTS.SMALL_SCREEN, "px)")]: _objectSpread(_objectSpread({
|
|
93
110
|
padding: themeGet("space.xs")(props)
|
|
94
|
-
}
|
|
111
|
+
}, props.isActive && props.isExpandable && {
|
|
112
|
+
"&::after": {
|
|
113
|
+
display: "none"
|
|
114
|
+
}
|
|
115
|
+
}), props.isActive && props.isLink && {
|
|
116
|
+
backgroundColor: themeGet("colors.primaryLightest")(props)
|
|
117
|
+
})
|
|
95
118
|
})));
|
|
96
119
|
|
|
97
120
|
/**
|
|
@@ -139,6 +162,7 @@ const NavItem = _ref => {
|
|
|
139
162
|
ref: el => navItemRefs.current[item.index] = el,
|
|
140
163
|
children: /*#__PURE__*/_jsxs(Component, {
|
|
141
164
|
item: item,
|
|
165
|
+
className: isActive ? "active" : "",
|
|
142
166
|
children: [/*#__PURE__*/_jsx(IconWrapper, {
|
|
143
167
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
144
168
|
icon: ["far", item.iconName],
|
|
@@ -175,19 +199,21 @@ const NavItem = _ref => {
|
|
|
175
199
|
}), item.index);
|
|
176
200
|
}
|
|
177
201
|
}, [item, isActive, isExpanded, isSmallScreen, handleItemClick, navItemRefs]);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
direction: "top",
|
|
181
|
-
textAlign: "center",
|
|
182
|
-
width: "fit-content",
|
|
183
|
-
tabIndex: "-1",
|
|
184
|
-
children: renderedNavItem
|
|
185
|
-
}) : /*#__PURE__*/_jsx(SideNavItemWrapper, {
|
|
202
|
+
const isExpandable = item.actionType === "component";
|
|
203
|
+
return /*#__PURE__*/_jsx(SideNavItemWrapper, {
|
|
186
204
|
className: item.bottomAligned && "bottom-aligned",
|
|
187
205
|
bottomAligned: item.bottomAligned,
|
|
188
206
|
isActive: isActive,
|
|
189
207
|
isLink: item.actionType === "link",
|
|
190
|
-
|
|
208
|
+
isExpandable: isExpandable,
|
|
209
|
+
children: isSmallScreen ? /*#__PURE__*/_jsx(Popover, {
|
|
210
|
+
text: item.name,
|
|
211
|
+
direction: "top",
|
|
212
|
+
textAlign: "center",
|
|
213
|
+
width: "fit-content",
|
|
214
|
+
tabIndex: "-1",
|
|
215
|
+
children: renderedNavItem
|
|
216
|
+
}) : renderedNavItem
|
|
191
217
|
});
|
|
192
218
|
};
|
|
193
219
|
NavItem.propTypes = {
|
|
@@ -12,7 +12,18 @@ import themeGet from "@styled-system/theme-get";
|
|
|
12
12
|
import Divider from "../../Divider";
|
|
13
13
|
import sharedNavItemHoverStyles, { sharedNavItemActiveStyles, sharedNavItemBaseStyles } from "../styles/sharedHoverStyles";
|
|
14
14
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
|
-
const
|
|
15
|
+
const createShouldForwardProp = blockedProps => function shouldForwardProp(prop, defaultValidatorFn) {
|
|
16
|
+
if (blockedProps.includes(prop)) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (typeof defaultValidatorFn === "function") {
|
|
20
|
+
return defaultValidatorFn(prop);
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
};
|
|
24
|
+
const ItemList = /*#__PURE__*/styled("ul").withConfig({
|
|
25
|
+
shouldForwardProp: createShouldForwardProp(["isExpanded"])
|
|
26
|
+
}).withConfig({
|
|
16
27
|
displayName: "ItemList",
|
|
17
28
|
componentId: "sc-1y67u5l-0"
|
|
18
29
|
})(["list-style:none;padding:0;margin:0;align-items:", ";text-align:", ";display:flex;flex-direction:column;gap:", ";"], props => props.isExpanded ? "flex-start" : "center", props => props.isExpanded ? "left" : "center", props => themeGet("space.xs")(props));
|
|
@@ -20,7 +31,9 @@ const ItemName = /*#__PURE__*/styled.span.withConfig({
|
|
|
20
31
|
displayName: "ItemName",
|
|
21
32
|
componentId: "sc-1y67u5l-1"
|
|
22
33
|
})(["font-size:", ";"], props => themeGet("fontSizes.1")(props));
|
|
23
|
-
export const Item = /*#__PURE__*/styled
|
|
34
|
+
export const Item = /*#__PURE__*/styled("li").withConfig({
|
|
35
|
+
shouldForwardProp: createShouldForwardProp(["isExpanded", "alignRight"])
|
|
36
|
+
}).withConfig({
|
|
24
37
|
displayName: "Item",
|
|
25
38
|
componentId: "sc-1y67u5l-2"
|
|
26
39
|
})(["display:flex;width:100%;gap:", ";justify-content:", ";align-items:center;a{display:flex;gap:", ";align-items:center;font-size:", ";text-decoration:none;padding:", " ", ";flex:1;", " ", " ", "}"], props => themeGet("space.xs")(props), props => {
|
|
@@ -65,7 +65,7 @@ const ExpandedPanel = _ref => {
|
|
|
65
65
|
return /*#__PURE__*/_jsxs(Box, {
|
|
66
66
|
position: "relative",
|
|
67
67
|
height: "100%",
|
|
68
|
-
zIndex: "1",
|
|
68
|
+
zIndex: isSmallScreen ? "1000" : "1",
|
|
69
69
|
children: [/*#__PURE__*/_jsxs(SideNavExpanded, {
|
|
70
70
|
ref: el => {
|
|
71
71
|
expandedRef.current = el;
|
|
@@ -28,7 +28,7 @@ const UnstyledNavLink = /*#__PURE__*/styled(NavLink).withConfig({
|
|
|
28
28
|
const ActiveAvatar = /*#__PURE__*/styled(Avatar).withConfig({
|
|
29
29
|
displayName: "ActiveAvatar",
|
|
30
30
|
componentId: "sc-12clz4a-3"
|
|
31
|
-
})(["position:relative
|
|
31
|
+
})(["position:relative;&::before{content:\"\";position:absolute;right:0;transform:translateX(10px);width:0px;height:0px;border-style:solid;border-width:7px 8px 7px 0;border-color:transparent ", " transparent transparent;", "}}"], themeGet("colors.greyLighter"), props => props.isSmallScreen && "\n right: auto;\n top: 0;\n transform: translate(5px, -13px);\n border-width: 8px 7px 0 7px;\n border-color: ".concat(props.theme.colors.greyLighter, " transparent transparent transparent;\n "));
|
|
32
32
|
const CurrentViewContent = _ref => {
|
|
33
33
|
var _subNav$;
|
|
34
34
|
let {
|
|
@@ -6,14 +6,25 @@ import { css } from "@styled-system/css";
|
|
|
6
6
|
import { themeGet } from "@styled-system/theme-get";
|
|
7
7
|
import Popover from "../../Popover";
|
|
8
8
|
import { BREAKPOINTS, EXPANDED_SIZE, SIDENAV_WIDTHS } from "../constants/sideNav";
|
|
9
|
+
const createShouldForwardProp = blockedProps => function shouldForwardProp(prop, defaultValidatorFn) {
|
|
10
|
+
if (blockedProps.includes(prop)) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if (typeof defaultValidatorFn === "function") {
|
|
14
|
+
return defaultValidatorFn(prop);
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
};
|
|
18
|
+
const filterIsExpandedProp = createShouldForwardProp(["isExpanded"]);
|
|
9
19
|
export const SideNavWrapper = /*#__PURE__*/styled("div").withConfig({
|
|
20
|
+
shouldForwardProp: createShouldForwardProp(["sideNavHeight"]),
|
|
10
21
|
displayName: "SideNavWrapper",
|
|
11
22
|
componentId: "sc-y5tsj2-0"
|
|
12
23
|
})(props => css({
|
|
13
24
|
bg: themeGet("colors.white")(props),
|
|
14
25
|
color: themeGet("colors.greyDarkest")(props),
|
|
15
|
-
minHeight: "100%",
|
|
16
|
-
height: "100%",
|
|
26
|
+
minHeight: props.sideNavHeight || "100%",
|
|
27
|
+
height: props.sideNavHeight || "100%",
|
|
17
28
|
maxWidth: "max-content",
|
|
18
29
|
fontFamily: themeGet("fonts.main")(props),
|
|
19
30
|
borderRight: "solid 1px ".concat(themeGet("colors.greyLighter")(props)),
|
|
@@ -36,11 +47,12 @@ export const SideNavWrapper = /*#__PURE__*/styled("div").withConfig({
|
|
|
36
47
|
position: "fixed",
|
|
37
48
|
bottom: "0",
|
|
38
49
|
left: "0",
|
|
39
|
-
zIndex: "
|
|
50
|
+
zIndex: "1000",
|
|
40
51
|
flexDirection: "column-reverse"
|
|
41
52
|
}
|
|
42
53
|
}));
|
|
43
54
|
export const SideNavItems = /*#__PURE__*/styled("div").withConfig({
|
|
55
|
+
shouldForwardProp: filterIsExpandedProp,
|
|
44
56
|
displayName: "SideNavItems",
|
|
45
57
|
componentId: "sc-y5tsj2-1"
|
|
46
58
|
})(props => css(_objectSpread(_objectSpread({
|
|
@@ -70,7 +82,9 @@ export const SideNavItems = /*#__PURE__*/styled("div").withConfig({
|
|
|
70
82
|
flexDirection: "row",
|
|
71
83
|
justifyContent: "space-around",
|
|
72
84
|
alignItems: "center",
|
|
73
|
-
width: "auto"
|
|
85
|
+
width: "auto",
|
|
86
|
+
zIndex: 0,
|
|
87
|
+
position: "relative"
|
|
74
88
|
}
|
|
75
89
|
})));
|
|
76
90
|
export const PanelControlTooltip = /*#__PURE__*/styled(Popover).withConfig({
|
|
@@ -144,6 +158,7 @@ export const ResizeHandle = /*#__PURE__*/styled("div").withConfig({
|
|
|
144
158
|
}
|
|
145
159
|
}));
|
|
146
160
|
export const ToggleHandle = /*#__PURE__*/styled("button").withConfig({
|
|
161
|
+
shouldForwardProp: filterIsExpandedProp,
|
|
147
162
|
displayName: "ToggleHandle",
|
|
148
163
|
componentId: "sc-y5tsj2-5"
|
|
149
164
|
})(props => css({
|
|
@@ -244,13 +259,14 @@ export const SideNavExpanded = /*#__PURE__*/styled("div").withConfig({
|
|
|
244
259
|
// Always inherit height on desktop
|
|
245
260
|
overflowY: "auto",
|
|
246
261
|
overflowX: "hidden",
|
|
247
|
-
padding: "16px",
|
|
262
|
+
padding: "10px 16px 16px 16px",
|
|
248
263
|
borderLeft: "solid 1px ".concat(themeGet("colors.greyLighter")(props)),
|
|
264
|
+
zIndex: 1,
|
|
249
265
|
"&:focus": {
|
|
250
266
|
outline: "0"
|
|
251
267
|
},
|
|
252
268
|
["@media screen and (max-width: ".concat(BREAKPOINTS.SMALL_SCREEN, "px)")]: {
|
|
253
|
-
width: "
|
|
269
|
+
width: "100vw",
|
|
254
270
|
minWidth: "initial",
|
|
255
271
|
maxWidth: "initial",
|
|
256
272
|
borderLeft: "none",
|
|
@@ -258,6 +274,11 @@ export const SideNavExpanded = /*#__PURE__*/styled("div").withConfig({
|
|
|
258
274
|
height: props.height ? "".concat(props.height, "px") : "auto",
|
|
259
275
|
// Only apply height on mobile
|
|
260
276
|
minHeight: props.large ? "".concat(EXPANDED_SIZE.largeMin, "px") : "".concat(EXPANDED_SIZE.normalMin, "px"),
|
|
261
|
-
maxHeight: props.large ? "".concat(EXPANDED_SIZE.largeMax, "px") : "".concat(EXPANDED_SIZE.normalMax, "px")
|
|
277
|
+
maxHeight: props.large ? "".concat(EXPANDED_SIZE.largeMax, "px") : "".concat(EXPANDED_SIZE.normalMax, "px"),
|
|
278
|
+
zIndex: 1001,
|
|
279
|
+
position: "absolute",
|
|
280
|
+
bottom: "100%",
|
|
281
|
+
left: "0",
|
|
282
|
+
right: "0"
|
|
262
283
|
}
|
|
263
284
|
}));
|
|
@@ -6,7 +6,7 @@ import { themeGet } from "@styled-system/theme-get";
|
|
|
6
6
|
* Provides consistent grey background and primary color on hover
|
|
7
7
|
* Works for both collapsed and expanded states
|
|
8
8
|
*/
|
|
9
|
-
const sharedNavItemHoverStyles = /*#__PURE__*/css(["&:hover:not(.active),&:focus:not(.active){outline:none;background-color:", ";color:", ";}path{transition:", ";}&:hover:not(.active) path,&:focus:not(.active) path{fill:", ";}"], themeGet("colors.greyLightest"), themeGet("colors.primary"), themeGet("transition.transitionDefault"), themeGet("colors.primary"));
|
|
9
|
+
const sharedNavItemHoverStyles = /*#__PURE__*/css(["&:hover:not(.active),&:focus:not(.active),&:active:not(.active){outline:none;background-color:", ";color:", ";}path{transition:", ";}&:hover:not(.active) path,&:focus:not(.active) path,&:active:not(.active) path{fill:", ";}"], themeGet("colors.greyLightest"), themeGet("colors.primary"), themeGet("transition.transitionDefault"), themeGet("colors.primary"));
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Shared active state styles for all SideNav menu items
|
|
@@ -14,7 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
const TabsContainer = /*#__PURE__*/styled.div.withConfig({
|
|
15
15
|
displayName: "TabsContainer",
|
|
16
16
|
componentId: "sc-15tpvnt-0"
|
|
17
|
-
})(["position:relative;width:100%;height:", "
|
|
17
|
+
})(["position:relative;width:100%;height:", ";&::after{content:\"\";position:absolute;bottom:0;width:100%;height:100%;background-color:", ";border-bottom:2px solid ", ";z-index:0;}"], themeGet("appScale.tabsHeight"), themeGet("colors.white"), themeGet("colors.greyLighter"));
|
|
18
18
|
const TabWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
19
19
|
displayName: "TabWrapper",
|
|
20
20
|
componentId: "sc-15tpvnt-1"
|
|
@@ -56,7 +56,7 @@ const Label = /*#__PURE__*/styled.label.withConfig({
|
|
|
56
56
|
})(["display:block;z-index:2;text-align:left;font-size:", ";font-weight:", ";transition:", ";padding-right:", ";margin-bottom:", ";color:", ";", ";", ";"], props => themeGet("fontSizes.1")(props), props => props.bold ? themeGet("fontWeights.2")(props) : themeGet("fontWeights.1")(props), props => themeGet("transition.transitionDefault")(props), props => props.floating && props.iconRight ? "40px" : "12px", props => props.floating ? 0 : themeGet("space.xs")(props), props => props.inverted ? themeGet("colors.white")(props) : props.valid ? themeGet("colors.successDark")(props) : props.invalid ? themeGet("colors.dangerDark")(props) : themeGet("colors.greyDarkest")(props), props => props.floating ? css(["padding-left:", ";cursor:text;position:absolute;top:", ";color:", ";"], props => props.iconLeft ? "37px" : "11px", props => {
|
|
57
57
|
let inputHeight = themeGet("appScale.inputHeightLarge")(props);
|
|
58
58
|
return "calc(".concat(inputHeight, " / 3)");
|
|
59
|
-
}, props => props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.greyDark")(props)) : css([""]), props => props.mandatory ? css(["
|
|
59
|
+
}, props => props.invalid ? themeGet("colors.dangerDark")(props) : props.valid ? themeGet("colors.successDark")(props) : themeGet("colors.greyDark")(props)) : css([""]), props => props.mandatory ? css(["&::after{content:\" *\";color:", ";}"], themeGet("colors.danger")(props)) : css([""]));
|
|
60
60
|
const TextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
61
61
|
const {
|
|
62
62
|
inverted,
|
|
@@ -18,11 +18,11 @@ const Input = /*#__PURE__*/styled.input.attrs({
|
|
|
18
18
|
}).withConfig({
|
|
19
19
|
displayName: "Input",
|
|
20
20
|
componentId: "sc-f6l22k-1"
|
|
21
|
-
})(["opacity:0;position:absolute;visibility:", ";margin:0;z-index:-1;width:0;height:0;pointer-events:none;&:focus{+ label{box-shadow:", ";}}&:checked{+ label{background:", "
|
|
21
|
+
})(["opacity:0;position:absolute;visibility:", ";margin:0;z-index:-1;width:0;height:0;pointer-events:none;&:focus{+ label{box-shadow:", ";}}&:checked{+ label{background:", ";&::after{left:calc(100% - 3px);transform:translateX(-100%);}}&:focus{+ label{box-shadow:", ";}}}"], props => props.srHide ? "hidden" : "visible", props => themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.black20")(props), props => themeGet("colors.success")(props), props => themeGet("shadows.thinOutline")(props) + " " + themeGet("colors.success30")(props));
|
|
22
22
|
const Item = /*#__PURE__*/styled.label.withConfig({
|
|
23
23
|
displayName: "Item",
|
|
24
24
|
componentId: "sc-f6l22k-2"
|
|
25
|
-
})(["cursor:pointer;flex:0 0 auto;margin:0;display:block;position:relative;transition:", ";background:", ";width:", ";height:", ";border-radius:", "
|
|
25
|
+
})(["cursor:pointer;flex:0 0 auto;margin:0;display:block;position:relative;transition:", ";background:", ";width:", ";height:", ";border-radius:", ";&::after{content:\"\";position:absolute;top:3px;left:3px;background:", ";transition:", ";width:", ";height:", ";border-radius:", ";}&:active{&::after{width:", ";}}", ";"], props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.greyDarker")(props), props => props.small ? "36px" : "44px", props => props.small ? "20px" : "24px", props => props.small ? "10px" : "12px", props => themeGet("colors.white")(props), props => themeGet("transition.transitionDefault")(props), props => props.small ? "14px" : "18px", props => props.small ? "14px" : "18px", props => props.small ? "7px" : "9px", props => props.small ? "20px" : "24px", props => props.disabled ? css(["opacity:0.5;"]) : css([""]));
|
|
26
26
|
const Label = /*#__PURE__*/styled.label.withConfig({
|
|
27
27
|
displayName: "Label",
|
|
28
28
|
componentId: "sc-f6l22k-3"
|
package/es/components.test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as components from ".";
|
|
2
2
|
test("all components exported", () => {
|
|
3
|
-
expect(Object.keys(components)).
|
|
3
|
+
expect(Object.keys(components)).toEqual(["ActionsMenu", "ActionsMenuBody", "ActionsMenuHeading", "ActionsMenuItem", "Avatar", "Badge", "Box", "Breadcrumbs", "Button", "ButtonGroupContainer", "ButtonGroupItem", "ButtonLink", "Card", "Checkbox", "Code", "CodeBlock", "ColorPicker", "DatePicker", "Divider", "Expandable", "Flex", "FlexItem", "FloatingPanels", "GlobalStyles", "Grid", "GridItem", "H1", "H2", "H3", "H4", "H5", "H6", "Header", "HeaderSimple", "Icon", "Loading", "Modal", "Notification", "P", "PanelLink", "Popover", "ProgressBar", "Quote", "RadioButton", "Range", "RenderCurrentViewSection", "Select", "SideNavStateProvider", "SideNavV2", "Small", "Spacer", "StatusDot", "StyledLink", "SystemThemeProvider", "Table", "Tabs", "Tag", "Text", "TextArea", "TextInput", "Toggle", "TreeNav", "Typography", "VARIANT_COLORS", "getOptionByValue", "styleLink", "systemThemeCollapsed", "systemtheme", "useSideNavStateContext"]);
|
|
4
4
|
});
|
package/es/index.js
CHANGED
|
@@ -41,8 +41,6 @@ export { default as StatusDot } from "./components/StatusDot";
|
|
|
41
41
|
export { default as StyledLink, styleLink } from "./components/StyledLink";
|
|
42
42
|
export { default as Table } from "./components/Table";
|
|
43
43
|
export { default as Tabs } from "./components/Tabs";
|
|
44
|
-
/** @deprecated Use Tabs component instead. TabsAlt will be removed in a future version. */
|
|
45
|
-
export { default as TabsAlt } from "./components/TabsAlt";
|
|
46
44
|
export { default as Tag } from "./components/Tag";
|
|
47
45
|
export { default as TextInput } from "./components/TextInput";
|
|
48
46
|
export { default as TextArea } from "./components/TextArea";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orcs-design-system",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.4",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20.0.0"
|
|
6
6
|
},
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"orcs"
|
|
16
16
|
],
|
|
17
17
|
"homepage": "https://styleguide.orchestrated.io",
|
|
18
|
-
"license": "
|
|
18
|
+
"license": "MIT",
|
|
19
19
|
"module": "es/index.js",
|
|
20
20
|
"main": "es/index.js",
|
|
21
21
|
"repository": {
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"deploy-storybook": "storybook-to-ghpages",
|
|
43
43
|
"playroom": "playroom start",
|
|
44
44
|
"build-playroom": "playroom build",
|
|
45
|
-
"dev": "nodemon --ignore es/ ./scripts/dev.js"
|
|
45
|
+
"dev": "nodemon --ignore es/ ./scripts/dev.js",
|
|
46
|
+
"test:github-packages-auth": "node scripts/test-github-packages-auth.js"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
49
|
"@emotion/react": "^11.14.0",
|
|
@@ -71,12 +72,14 @@
|
|
|
71
72
|
"react-router-dom": "^5.3.4",
|
|
72
73
|
"react-select": "^5.10.2",
|
|
73
74
|
"styled-components": "^6.1.19",
|
|
75
|
+
"stylis": "^4.3.1",
|
|
74
76
|
"styled-system": "^5.1.5"
|
|
75
77
|
},
|
|
76
78
|
"devDependencies": {
|
|
77
79
|
"@babel/cli": "^7.12.10",
|
|
78
80
|
"@babel/core": "^7.12.10",
|
|
79
81
|
"@babel/eslint-parser": "^7.24.7",
|
|
82
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
80
83
|
"@babel/plugin-transform-class-properties": "^7.12.1",
|
|
81
84
|
"@babel/plugin-transform-runtime": "^7.12.10",
|
|
82
85
|
"@babel/preset-env": "^7.12.11",
|
|
@@ -109,6 +112,7 @@
|
|
|
109
112
|
"@testing-library/jest-dom": "^5.17.0",
|
|
110
113
|
"@testing-library/react": "^14.3.1",
|
|
111
114
|
"@types/jest": "^27.5.2",
|
|
115
|
+
"eslint-plugin-local-rules": "^3.0.2",
|
|
112
116
|
"audit-ci": "^7.1.0",
|
|
113
117
|
"babel-core": "^7.0.0-bridge.0",
|
|
114
118
|
"babel-loader": "^8.1.0",
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import TabsAlt from ".";
|
|
3
|
-
import { BrowserRouter, Route, Switch } from "react-router-dom";
|
|
4
|
-
import Box from "../Box";
|
|
5
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
export default {
|
|
7
|
-
title: "Components/TabsAlt",
|
|
8
|
-
decorators: [storyFn => /*#__PURE__*/_jsx(Box, {
|
|
9
|
-
boxBorder: "default",
|
|
10
|
-
shadow: "default",
|
|
11
|
-
pb: "200px",
|
|
12
|
-
children: storyFn()
|
|
13
|
-
})],
|
|
14
|
-
component: TabsAlt
|
|
15
|
-
};
|
|
16
|
-
const tabsList = [{
|
|
17
|
-
label: "Details",
|
|
18
|
-
path: "/details"
|
|
19
|
-
}, {
|
|
20
|
-
label: "Strategy",
|
|
21
|
-
path: "/strategy"
|
|
22
|
-
}, {
|
|
23
|
-
label: "Associations",
|
|
24
|
-
path: "/associations"
|
|
25
|
-
}, {
|
|
26
|
-
label: "Visualisation",
|
|
27
|
-
path: "/visualisation"
|
|
28
|
-
}, {
|
|
29
|
-
label: "Principles",
|
|
30
|
-
path: "/principles"
|
|
31
|
-
}, {
|
|
32
|
-
label: "Planner",
|
|
33
|
-
path: "/planner"
|
|
34
|
-
}, {
|
|
35
|
-
label: "Forecast",
|
|
36
|
-
path: "/forecast"
|
|
37
|
-
}, {
|
|
38
|
-
label: "Team Builder",
|
|
39
|
-
path: "/teambuilder"
|
|
40
|
-
}, {
|
|
41
|
-
label: "History",
|
|
42
|
-
path: "/history",
|
|
43
|
-
isVisible: false
|
|
44
|
-
}];
|
|
45
|
-
export const defaultTabs = () => /*#__PURE__*/_jsxs(BrowserRouter, {
|
|
46
|
-
children: [/*#__PURE__*/_jsx(TabsAlt, {
|
|
47
|
-
tabsList: tabsList
|
|
48
|
-
}), /*#__PURE__*/_jsx(Switch, {
|
|
49
|
-
children: tabsList.map(tab => /*#__PURE__*/_jsx(Route, {
|
|
50
|
-
path: tab.path,
|
|
51
|
-
children: /*#__PURE__*/_jsxs(Box, {
|
|
52
|
-
p: "l",
|
|
53
|
-
mt: "l",
|
|
54
|
-
children: ["ROUTE RENDERED: ", tab.label]
|
|
55
|
-
})
|
|
56
|
-
}, tab.path))
|
|
57
|
-
})]
|
|
58
|
-
});
|
|
59
|
-
defaultTabs.storyName = "Default";
|
|
60
|
-
export const clickableTabs = () => {
|
|
61
|
-
const handleTabClick = tabLabel => {
|
|
62
|
-
alert("Clicked on ".concat(tabLabel, " tab!"));
|
|
63
|
-
};
|
|
64
|
-
const clickableTabsList = [{
|
|
65
|
-
label: "Details",
|
|
66
|
-
path: "/details",
|
|
67
|
-
onClick: () => handleTabClick("Details")
|
|
68
|
-
}, {
|
|
69
|
-
label: "Strategy",
|
|
70
|
-
path: "/strategy",
|
|
71
|
-
onClick: () => handleTabClick("Strategy")
|
|
72
|
-
}, {
|
|
73
|
-
label: "Associations",
|
|
74
|
-
path: "/associations",
|
|
75
|
-
onClick: () => handleTabClick("Associations")
|
|
76
|
-
}, {
|
|
77
|
-
label: "Visualisation",
|
|
78
|
-
path: "/visualisation",
|
|
79
|
-
onClick: () => handleTabClick("Visualisation")
|
|
80
|
-
}, {
|
|
81
|
-
label: "Principles",
|
|
82
|
-
path: "/principles",
|
|
83
|
-
onClick: () => handleTabClick("Principles")
|
|
84
|
-
}, {
|
|
85
|
-
label: "Planner",
|
|
86
|
-
path: "/planner",
|
|
87
|
-
onClick: () => handleTabClick("Planner")
|
|
88
|
-
}, {
|
|
89
|
-
label: "Forecast",
|
|
90
|
-
path: "/forecast",
|
|
91
|
-
onClick: () => handleTabClick("Forecast")
|
|
92
|
-
}, {
|
|
93
|
-
label: "Team Builder",
|
|
94
|
-
path: "/teambuilder",
|
|
95
|
-
onClick: () => handleTabClick("Team Builder")
|
|
96
|
-
}, {
|
|
97
|
-
label: "History",
|
|
98
|
-
path: "/history",
|
|
99
|
-
onClick: () => handleTabClick("History")
|
|
100
|
-
}];
|
|
101
|
-
return /*#__PURE__*/_jsx(BrowserRouter, {
|
|
102
|
-
children: /*#__PURE__*/_jsxs(Box, {
|
|
103
|
-
p: "l",
|
|
104
|
-
children: [/*#__PURE__*/_jsx("h3", {
|
|
105
|
-
children: "Clickable Tabs (including More menu items)"
|
|
106
|
-
}), /*#__PURE__*/_jsx("p", {
|
|
107
|
-
children: "All tabs have onClick handlers. Check the More menu items too!"
|
|
108
|
-
}), /*#__PURE__*/_jsx(TabsAlt, {
|
|
109
|
-
tabsList: clickableTabsList
|
|
110
|
-
})]
|
|
111
|
-
})
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
clickableTabs.storyName = "Clickable Tabs";
|
|
115
|
-
defaultTabs.__docgenInfo = {
|
|
116
|
-
"description": "",
|
|
117
|
-
"methods": [],
|
|
118
|
-
"displayName": "defaultTabs"
|
|
119
|
-
};
|
|
120
|
-
clickableTabs.__docgenInfo = {
|
|
121
|
-
"description": "",
|
|
122
|
-
"methods": [],
|
|
123
|
-
"displayName": "clickableTabs"
|
|
124
|
-
};
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
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; }
|
|
3
|
-
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; }
|
|
4
|
-
import React, { useState, useRef, useEffect, useCallback, createElement as _createElement } from "react";
|
|
5
|
-
import styled, { css } from "styled-components";
|
|
6
|
-
import { NavLink, useLocation } from "react-router-dom";
|
|
7
|
-
import { isEqual } from "lodash";
|
|
8
|
-
import ActionsMenu, { ActionsMenuItem } from "../ActionsMenu";
|
|
9
|
-
import Icon from "../Icon";
|
|
10
|
-
import FlexItem from "../Flex";
|
|
11
|
-
import { themeGet } from "@styled-system/theme-get";
|
|
12
|
-
import PropTypes from "prop-types";
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
const TabsContainer = /*#__PURE__*/styled.div.withConfig({
|
|
15
|
-
displayName: "TabsContainer",
|
|
16
|
-
componentId: "sc-hkpvfu-0"
|
|
17
|
-
})(["position:relative;width:100%;height:", ";&:after{content:\"\";position:absolute;bottom:0;width:100%;height:100%;background-color:", ";border-bottom:2px solid ", ";z-index:0;}"], themeGet("appScale.tabsHeight"), themeGet("colors.white"), themeGet("colors.greyLighter"));
|
|
18
|
-
const TabWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
19
|
-
displayName: "TabWrapper",
|
|
20
|
-
componentId: "sc-hkpvfu-1"
|
|
21
|
-
})(["position:relative;width:100%;z-index:1;height:inherit;"]);
|
|
22
|
-
const VisibleTabs = /*#__PURE__*/styled.div.withConfig({
|
|
23
|
-
displayName: "VisibleTabs",
|
|
24
|
-
componentId: "sc-hkpvfu-2"
|
|
25
|
-
})(["flex-shrink:1;display:flex;align-items:center;justify-content:flex-start;overflow:hidden;height:inherit;"]);
|
|
26
|
-
const activeTabStyle = /*#__PURE__*/css(["background-color:", ";color:", ";border-bottom:2px solid ", ";cursor:default;&:hover,&:focus{background-color:", ";color:", ";box-shadow:none;}"], themeGet("colors.white"), themeGet("colors.primary"), themeGet("colors.primary"), themeGet("colors.white"), themeGet("colors.primary"));
|
|
27
|
-
const TabStyles = /*#__PURE__*/css(["width:", ";display:block;transition:background 200ms ease-in-out,color 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{background-color:", ";color:", ";box-shadow:inset 0 2px 5px 0 ", ";}&:focus{outline:0;box-shadow:inset 0 2px 5px 0 ", ";}&.active{", "}"], _ref => {
|
|
28
|
-
let {
|
|
29
|
-
fullWidth
|
|
30
|
-
} = _ref;
|
|
31
|
-
return fullWidth ? "100%" : "fit-content";
|
|
32
|
-
}, themeGet("colors.greyLighter"), themeGet("space.4"), themeGet("appScale.tabsHeight"), themeGet("fontSizes.1"), themeGet("fontWeights.2"), themeGet("colors.white"), themeGet("colors.greyDark"), _ref2 => {
|
|
33
|
-
let {
|
|
34
|
-
tabInShowMore
|
|
35
|
-
} = _ref2;
|
|
36
|
-
return tabInShowMore ? css(["position:absolute;visibility:hidden;"]) : "";
|
|
37
|
-
}, themeGet("colors.white"), themeGet("colors.primary"), themeGet("colors.primaryLightest"), themeGet("colors.primaryLightest"), activeTabStyle);
|
|
38
|
-
const NavTab = /*#__PURE__*/styled(NavLink).withConfig({
|
|
39
|
-
displayName: "NavTab",
|
|
40
|
-
componentId: "sc-hkpvfu-3"
|
|
41
|
-
})(["", ""], TabStyles);
|
|
42
|
-
const Tab = /*#__PURE__*/styled.div.withConfig({
|
|
43
|
-
displayName: "Tab",
|
|
44
|
-
componentId: "sc-hkpvfu-4"
|
|
45
|
-
})(["", ""], TabStyles);
|
|
46
|
-
const ShowMoreButton = /*#__PURE__*/styled.button.withConfig({
|
|
47
|
-
displayName: "ShowMoreButton",
|
|
48
|
-
componentId: "sc-hkpvfu-5"
|
|
49
|
-
})(["appearance:none;border:none;font-family:", ";font-size:", ";font-weight:", ";background-color:", ";border-bottom:2px solid ", ";transition:", ";padding:0 ", ";height:", ";color:", ";display:", ";align-items:center;cursor:pointer;&:hover{background-color:", ";color:", ";box-shadow:inset 0 2px 5px 0 ", ";}&:focus{outline:0;box-shadow:inset 0 2px 5px 0 ", ";}&.hasActive{", "}"], themeGet("fonts.main"), themeGet("fontSizes.1"), themeGet("fontWeights.2"), themeGet("colors.white"), themeGet("colors.greyLighter"), themeGet("transition.transitionDefault"), themeGet("space.4"), themeGet("appScale.tabsHeight"), themeGet("colors.greyDark"), _ref3 => {
|
|
50
|
-
let {
|
|
51
|
-
showMoreVisible
|
|
52
|
-
} = _ref3;
|
|
53
|
-
return showMoreVisible ? "flex" : "none";
|
|
54
|
-
}, themeGet("colors.white"), themeGet("colors.primary"), themeGet("colors.primaryLightest"), themeGet("colors.primaryLightest"), activeTabStyle);
|
|
55
|
-
const ShowMoreTabs = /*#__PURE__*/styled.div.withConfig({
|
|
56
|
-
displayName: "ShowMoreTabs",
|
|
57
|
-
componentId: "sc-hkpvfu-6"
|
|
58
|
-
})(["border-radius:", ";background-color:", ";width:fit-content;overflow:hidden;display:flex;gap:1px;flex-direction:column;justify-content:flex-start;box-shadow:", ";& [class^=\"TabsAlt__Tab\"]{border:0;padding:", ";text-align:left;}"], themeGet("radii.2"), themeGet("colors.greyLighter"), themeGet("shadows.boxDefault"), themeGet("space.3"));
|
|
59
|
-
const tabsGap = 0;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* TabsAlt Component
|
|
63
|
-
*
|
|
64
|
-
* @deprecated This component is deprecated and will be removed in a future version.
|
|
65
|
-
* Please migrate to the `Tabs` component instead. TabsAlt was an alternative implementation
|
|
66
|
-
* that has been consolidated into Tabs. Both components are currently available during
|
|
67
|
-
* the migration period, but TabsAlt should not be used in new code.
|
|
68
|
-
*
|
|
69
|
-
* Migration: Replace `TabsAlt` with `Tabs` - the API is identical and the styling
|
|
70
|
-
* has been improved in the Tabs component.
|
|
71
|
-
*/
|
|
72
|
-
const TabsAlt = _ref4 => {
|
|
73
|
-
let {
|
|
74
|
-
tabsList
|
|
75
|
-
} = _ref4;
|
|
76
|
-
// Deprecation warning - shown in development mode only
|
|
77
|
-
if (process.env.NODE_ENV !== "production") {
|
|
78
|
-
console.warn("TabsAlt component is deprecated and will be removed in a future version. " + "Please migrate to the Tabs component instead. TabsAlt was an alternative implementation " + "that has been consolidated into Tabs. Both components are available during the migration " + "period, but TabsAlt should not be used in new code.");
|
|
79
|
-
}
|
|
80
|
-
const [isMounted, setIsMounted] = useState(false);
|
|
81
|
-
const containerRef = useRef(null);
|
|
82
|
-
const containerVisibleWidth = useRef(0);
|
|
83
|
-
const [showMoreTabs, setShowMoreTabs] = useState([]);
|
|
84
|
-
const calculateVisibility = useCallback(actionElements => {
|
|
85
|
-
var _showMoreButton$offse;
|
|
86
|
-
const showMoreButton = document.getElementById("show-more-button");
|
|
87
|
-
const showMoreButtonWidth = (_showMoreButton$offse = showMoreButton === null || showMoreButton === void 0 ? void 0 : showMoreButton.offsetWidth) !== null && _showMoreButton$offse !== void 0 ? _showMoreButton$offse : 0;
|
|
88
|
-
// as we loop through the tabs, we need to calculate the width of the visible tabs.
|
|
89
|
-
let calculatedWidth = showMoreTabs.length ? showMoreButtonWidth : 0;
|
|
90
|
-
|
|
91
|
-
// variable for the list of hidden tabs which will be put to react state
|
|
92
|
-
const newShowMoreTabs = [];
|
|
93
|
-
[...actionElements].filter(el => el.tagName === "A") // this ensures that the ShowMore button is not included in this logic
|
|
94
|
-
.forEach((actionEl, i) => {
|
|
95
|
-
// visibleElementsWidth will be increased by
|
|
96
|
-
// the corresponding width of the element + gapWidth
|
|
97
|
-
calculatedWidth += actionEl.offsetWidth + tabsGap;
|
|
98
|
-
|
|
99
|
-
// compare computed widths and push into newShowMoreTabs if current tab width is bigger than container width
|
|
100
|
-
if (calculatedWidth >= containerVisibleWidth.current) {
|
|
101
|
-
newShowMoreTabs.push(i);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
if (!isEqual(showMoreTabs, newShowMoreTabs)) {
|
|
105
|
-
// update React state with the list of hidden tabs
|
|
106
|
-
setShowMoreTabs(newShowMoreTabs);
|
|
107
|
-
}
|
|
108
|
-
}, [showMoreTabs]);
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
var _containerRef$current;
|
|
111
|
-
const actionElements = ((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.children) || [];
|
|
112
|
-
const resizeObserver = new ResizeObserver(entries => {
|
|
113
|
-
for (const entry of entries) {
|
|
114
|
-
if (entry.contentBoxSize) {
|
|
115
|
-
const contentBoxSize = entry.contentBoxSize[0];
|
|
116
|
-
|
|
117
|
-
// Math.ceil is necessary to round up and return
|
|
118
|
-
// the smallest integer for the size of observed element
|
|
119
|
-
containerVisibleWidth.current = Math.ceil(contentBoxSize.inlineSize);
|
|
120
|
-
|
|
121
|
-
// invoke the functions which calculates tabs visibility
|
|
122
|
-
// and sets data to the list of hidden tabs
|
|
123
|
-
calculateVisibility(actionElements);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
// This is to help in cases where useEffect callback is triggered before React repaint.
|
|
129
|
-
if (!isMounted) {
|
|
130
|
-
setTimeout(() => {
|
|
131
|
-
setIsMounted(true);
|
|
132
|
-
calculateVisibility(actionElements);
|
|
133
|
-
}, 500);
|
|
134
|
-
} else {
|
|
135
|
-
// adding ResizeObserver to the observed container
|
|
136
|
-
resizeObserver.observe(containerRef.current);
|
|
137
|
-
}
|
|
138
|
-
}, [calculateVisibility, isMounted]);
|
|
139
|
-
const visibleTabsList = tabsList.filter(tab => {
|
|
140
|
-
var _tab$isVisible;
|
|
141
|
-
return (_tab$isVisible = tab.isVisible) !== null && _tab$isVisible !== void 0 ? _tab$isVisible : true;
|
|
142
|
-
});
|
|
143
|
-
const showMoreTabsList = visibleTabsList.filter((_tab, i) => showMoreTabs.includes(i));
|
|
144
|
-
const location = useLocation();
|
|
145
|
-
const showMoreItemActive = showMoreTabsList.find(action => {
|
|
146
|
-
try {
|
|
147
|
-
return location.pathname.endsWith(action.path);
|
|
148
|
-
} catch (_unused) {
|
|
149
|
-
// Fallback for environments without router context
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
return /*#__PURE__*/_jsx(TabsContainer, {
|
|
154
|
-
children: /*#__PURE__*/_jsx(TabWrapper, {
|
|
155
|
-
children: /*#__PURE__*/_jsxs(VisibleTabs, {
|
|
156
|
-
style: {
|
|
157
|
-
gap: tabsGap
|
|
158
|
-
},
|
|
159
|
-
ref: containerRef,
|
|
160
|
-
role: "tablist",
|
|
161
|
-
children: [visibleTabsList.map((tab, i) => {
|
|
162
|
-
const sharedProps = {
|
|
163
|
-
className: tab.className,
|
|
164
|
-
id: tab.id,
|
|
165
|
-
"data-testid": tab["data-testid"],
|
|
166
|
-
key: tab.path,
|
|
167
|
-
tabInShowMore: showMoreTabs.includes(i),
|
|
168
|
-
role: "tab"
|
|
169
|
-
};
|
|
170
|
-
if (tab !== null && tab !== void 0 && tab.onClick) {
|
|
171
|
-
return /*#__PURE__*/_createElement(Tab, _objectSpread(_objectSpread({}, sharedProps), {}, {
|
|
172
|
-
onClick: tab === null || tab === void 0 ? void 0 : tab.onClick,
|
|
173
|
-
key: tab.id
|
|
174
|
-
}), tab.label);
|
|
175
|
-
}
|
|
176
|
-
return /*#__PURE__*/_createElement(NavTab, _objectSpread(_objectSpread({}, sharedProps), {}, {
|
|
177
|
-
to: tab.path,
|
|
178
|
-
key: tab.id || tab.path
|
|
179
|
-
}), tab.label);
|
|
180
|
-
}), /*#__PURE__*/_jsx(ActionsMenu, {
|
|
181
|
-
direction: "bottom-end",
|
|
182
|
-
role: "presentation",
|
|
183
|
-
renderTrigger: props => /*#__PURE__*/_jsxs(ShowMoreButton, _objectSpread(_objectSpread({}, props), {}, {
|
|
184
|
-
showMoreVisible: showMoreTabsList.length,
|
|
185
|
-
id: "show-more-button",
|
|
186
|
-
className: showMoreItemActive && "hasActive",
|
|
187
|
-
role: "tab",
|
|
188
|
-
children: [/*#__PURE__*/_jsx(FlexItem, {
|
|
189
|
-
flex: "0 0 auto",
|
|
190
|
-
children: "More"
|
|
191
|
-
}), /*#__PURE__*/_jsx(FlexItem, {
|
|
192
|
-
flex: "0 0 auto",
|
|
193
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
194
|
-
icon: ["fas", "chevron-down"],
|
|
195
|
-
title: "Down",
|
|
196
|
-
ml: "xs",
|
|
197
|
-
size: "sm"
|
|
198
|
-
})
|
|
199
|
-
})]
|
|
200
|
-
})),
|
|
201
|
-
closeOnClick: true,
|
|
202
|
-
children: /*#__PURE__*/_jsx(ShowMoreTabs, {
|
|
203
|
-
children: showMoreTabsList.map(tab => {
|
|
204
|
-
const sharedProps = {
|
|
205
|
-
className: tab.className,
|
|
206
|
-
id: tab.id,
|
|
207
|
-
"data-testid": tab["data-testid"],
|
|
208
|
-
fullWidth: true
|
|
209
|
-
};
|
|
210
|
-
if (tab !== null && tab !== void 0 && tab.onClick) {
|
|
211
|
-
return /*#__PURE__*/_jsx(ActionsMenuItem, _objectSpread(_objectSpread({}, sharedProps), {}, {
|
|
212
|
-
Component: Tab,
|
|
213
|
-
onClick: tab.onClick,
|
|
214
|
-
children: tab.label
|
|
215
|
-
}), tab.path);
|
|
216
|
-
}
|
|
217
|
-
return /*#__PURE__*/_jsx(ActionsMenuItem, _objectSpread(_objectSpread({}, sharedProps), {}, {
|
|
218
|
-
Component: NavTab,
|
|
219
|
-
to: tab.path,
|
|
220
|
-
children: tab.label
|
|
221
|
-
}), tab.path);
|
|
222
|
-
})
|
|
223
|
-
})
|
|
224
|
-
})]
|
|
225
|
-
})
|
|
226
|
-
})
|
|
227
|
-
});
|
|
228
|
-
};
|
|
229
|
-
TabsAlt.propTypes = {
|
|
230
|
-
/**
|
|
231
|
-
* Array of tab objects to display.
|
|
232
|
-
* Each tab object should have: label (string, required), path (string, required),
|
|
233
|
-
* isVisible (bool, optional, defaults to true), onClick (function, optional).
|
|
234
|
-
*
|
|
235
|
-
* @deprecated Use Tabs component instead - same API, improved styling.
|
|
236
|
-
*/
|
|
237
|
-
tabsList: PropTypes.arrayOf(PropTypes.shape({
|
|
238
|
-
label: PropTypes.string.isRequired,
|
|
239
|
-
path: PropTypes.string.isRequired,
|
|
240
|
-
isVisible: PropTypes.bool,
|
|
241
|
-
onClick: PropTypes.func
|
|
242
|
-
})).isRequired
|
|
243
|
-
};
|
|
244
|
-
TabsAlt.__docgenInfo = {
|
|
245
|
-
"description": "TabsAlt Component\n\n@deprecated This component is deprecated and will be removed in a future version.\nPlease migrate to the `Tabs` component instead. TabsAlt was an alternative implementation\nthat has been consolidated into Tabs. Both components are currently available during\nthe migration period, but TabsAlt should not be used in new code.\n\nMigration: Replace `TabsAlt` with `Tabs` - the API is identical and the styling\nhas been improved in the Tabs component.",
|
|
246
|
-
"methods": [],
|
|
247
|
-
"displayName": "TabsAlt",
|
|
248
|
-
"props": {
|
|
249
|
-
"tabsList": {
|
|
250
|
-
"description": "Array of tab objects to display.\nEach tab object should have: label (string, required), path (string, required),\nisVisible (bool, optional, defaults to true), onClick (function, optional).\n\n@deprecated Use Tabs component instead - same API, improved styling.",
|
|
251
|
-
"type": {
|
|
252
|
-
"name": "arrayOf",
|
|
253
|
-
"value": {
|
|
254
|
-
"name": "shape",
|
|
255
|
-
"value": {
|
|
256
|
-
"label": {
|
|
257
|
-
"name": "string",
|
|
258
|
-
"required": true
|
|
259
|
-
},
|
|
260
|
-
"path": {
|
|
261
|
-
"name": "string",
|
|
262
|
-
"required": true
|
|
263
|
-
},
|
|
264
|
-
"isVisible": {
|
|
265
|
-
"name": "bool",
|
|
266
|
-
"required": false
|
|
267
|
-
},
|
|
268
|
-
"onClick": {
|
|
269
|
-
"name": "func",
|
|
270
|
-
"required": false
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
"required": true
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
export default TabsAlt;
|