orcs-design-system 3.3.55 → 3.3.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/TabsAlt/index.js +37 -16
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect, useCallback } from "react";
|
|
1
|
+
import React, { useState, useRef, useEffect, useCallback, createElement as _createElement } from "react";
|
|
2
2
|
import styled, { css } from "styled-components";
|
|
3
3
|
import { NavLink, useLocation } from "react-router-dom";
|
|
4
4
|
import { isEqual } from "lodash";
|
|
@@ -21,10 +21,7 @@ const VisibleTabs = styled.div.withConfig({
|
|
|
21
21
|
componentId: "sc-hkpvfu-2"
|
|
22
22
|
})(["flex-shrink:1;display:flex;align-items:center;justify-content:flex-start;overflow:hidden;height:inherit;"]);
|
|
23
23
|
const activeTabStyle = 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"));
|
|
24
|
-
const
|
|
25
|
-
displayName: "TabsAlt__Tab",
|
|
26
|
-
componentId: "sc-hkpvfu-3"
|
|
27
|
-
})(["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 => {
|
|
24
|
+
const TabStyles = 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
25
|
let {
|
|
29
26
|
fullWidth
|
|
30
27
|
} = _ref;
|
|
@@ -35,9 +32,17 @@ const Tab = styled(NavLink).withConfig({
|
|
|
35
32
|
} = _ref2;
|
|
36
33
|
return tabInShowMore ? css(["position:absolute;visibility:hidden;"]) : "";
|
|
37
34
|
}, themeGet("colors.white"), themeGet("colors.primary"), themeGet("colors.primaryLightest"), themeGet("colors.primaryLightest"), activeTabStyle);
|
|
35
|
+
const NavTab = styled(NavLink).withConfig({
|
|
36
|
+
displayName: "TabsAlt__NavTab",
|
|
37
|
+
componentId: "sc-hkpvfu-3"
|
|
38
|
+
})(["", ""], TabStyles);
|
|
39
|
+
const Tab = styled.div.withConfig({
|
|
40
|
+
displayName: "TabsAlt__Tab",
|
|
41
|
+
componentId: "sc-hkpvfu-4"
|
|
42
|
+
})(["", ""], TabStyles);
|
|
38
43
|
const ShowMoreButton = styled.button.withConfig({
|
|
39
44
|
displayName: "TabsAlt__ShowMoreButton",
|
|
40
|
-
componentId: "sc-hkpvfu-
|
|
45
|
+
componentId: "sc-hkpvfu-5"
|
|
41
46
|
})(["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 => {
|
|
42
47
|
let {
|
|
43
48
|
showMoreVisible
|
|
@@ -46,7 +51,7 @@ const ShowMoreButton = styled.button.withConfig({
|
|
|
46
51
|
}, themeGet("colors.white"), themeGet("colors.primary"), themeGet("colors.primaryLightest"), themeGet("colors.primaryLightest"), activeTabStyle);
|
|
47
52
|
const ShowMoreTabs = styled.div.withConfig({
|
|
48
53
|
displayName: "TabsAlt__ShowMoreTabs",
|
|
49
|
-
componentId: "sc-hkpvfu-
|
|
54
|
+
componentId: "sc-hkpvfu-6"
|
|
50
55
|
})(["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"));
|
|
51
56
|
const tabsGap = 0;
|
|
52
57
|
const TabsAlt = _ref4 => {
|
|
@@ -114,6 +119,9 @@ const TabsAlt = _ref4 => {
|
|
|
114
119
|
const showMoreTabsList = visibleTabsList.filter((_tab, i) => showMoreTabs.includes(i));
|
|
115
120
|
const location = useLocation();
|
|
116
121
|
const showMoreItemActive = showMoreTabsList.find(action => location.pathname.endsWith(action.path));
|
|
122
|
+
console.log({
|
|
123
|
+
visibleTabsList
|
|
124
|
+
});
|
|
117
125
|
return /*#__PURE__*/_jsx(TabsContainer, {
|
|
118
126
|
children: /*#__PURE__*/_jsx(TabWrapper, {
|
|
119
127
|
children: /*#__PURE__*/_jsxs(VisibleTabs, {
|
|
@@ -122,15 +130,28 @@ const TabsAlt = _ref4 => {
|
|
|
122
130
|
},
|
|
123
131
|
ref: containerRef,
|
|
124
132
|
role: "tablist",
|
|
125
|
-
children: [visibleTabsList.map((tab, i) =>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
children: [visibleTabsList.map((tab, i) => {
|
|
134
|
+
const sharedProps = {
|
|
135
|
+
className: tab.className,
|
|
136
|
+
id: tab.id,
|
|
137
|
+
"data-testid": tab["data-testid"],
|
|
138
|
+
key: tab.path,
|
|
139
|
+
tabInShowMore: showMoreTabs.includes(i),
|
|
140
|
+
role: "tab"
|
|
141
|
+
};
|
|
142
|
+
if (tab?.onClick) {
|
|
143
|
+
return /*#__PURE__*/_createElement(Tab, {
|
|
144
|
+
...sharedProps,
|
|
145
|
+
onClick: tab?.onClick,
|
|
146
|
+
key: tab.id
|
|
147
|
+
}, tab.label);
|
|
148
|
+
}
|
|
149
|
+
return /*#__PURE__*/_createElement(NavTab, {
|
|
150
|
+
...sharedProps,
|
|
151
|
+
to: tab.path,
|
|
152
|
+
key: tab.id || tab.path
|
|
153
|
+
}, tab.label);
|
|
154
|
+
}), /*#__PURE__*/_jsx(ActionsMenu, {
|
|
134
155
|
direction: "bottom-end",
|
|
135
156
|
role: "presentation",
|
|
136
157
|
renderTrigger: props => /*#__PURE__*/_jsxs(ShowMoreButton, {
|