glints-aries 4.0.387 → 4.0.388
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/@next/Tabs/Tab.d.ts +2 -1
- package/es/@next/Tabs/Tab.js +4 -0
- package/es/@next/Tabs/TabStyle.js +1 -1
- package/es/@next/Tabs/Tabs.d.ts +4 -1
- package/es/@next/Tabs/Tabs.js +8 -6
- package/es/@next/Tabs/Tabs.stories.d.ts +2 -0
- package/lib/@next/Tabs/Tab.d.ts +2 -1
- package/lib/@next/Tabs/Tab.js +4 -0
- package/lib/@next/Tabs/TabStyle.js +1 -1
- package/lib/@next/Tabs/Tabs.d.ts +4 -1
- package/lib/@next/Tabs/Tabs.js +8 -6
- package/lib/@next/Tabs/Tabs.stories.d.ts +2 -0
- package/package.json +1 -1
package/es/@next/Tabs/Tab.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare type TabProps = {
|
|
|
3
3
|
content: React.ReactNode;
|
|
4
4
|
id?: string;
|
|
5
5
|
selected?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
6
7
|
onSelect: () => void;
|
|
7
8
|
};
|
|
8
|
-
export declare const Tab: ({ content, id, selected, onSelect }: TabProps) => JSX.Element;
|
|
9
|
+
export declare const Tab: ({ content, id, selected, disabled, onSelect, }: TabProps) => JSX.Element;
|
package/es/@next/Tabs/Tab.js
CHANGED
|
@@ -5,9 +5,12 @@ export var Tab = function Tab(_ref) {
|
|
|
5
5
|
var content = _ref.content,
|
|
6
6
|
id = _ref.id,
|
|
7
7
|
selected = _ref.selected,
|
|
8
|
+
_ref$disabled = _ref.disabled,
|
|
9
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
8
10
|
onSelect = _ref.onSelect;
|
|
9
11
|
var tabRef = useRef(null);
|
|
10
12
|
var handleClick = function handleClick(event) {
|
|
13
|
+
if (disabled) return;
|
|
11
14
|
event.preventDefault();
|
|
12
15
|
tabRef.current.scrollIntoView({
|
|
13
16
|
behavior: 'smooth'
|
|
@@ -17,6 +20,7 @@ export var Tab = function Tab(_ref) {
|
|
|
17
20
|
return /*#__PURE__*/React.createElement(StyledTabButton, {
|
|
18
21
|
ref: tabRef,
|
|
19
22
|
"data-selected": selected,
|
|
23
|
+
"data-disabled": disabled,
|
|
20
24
|
id: id,
|
|
21
25
|
onClick: handleClick
|
|
22
26
|
}, /*#__PURE__*/React.createElement(StyledSpan, null, /*#__PURE__*/React.createElement(Typography, {
|
|
@@ -25,4 +25,4 @@ export var StyledSpan = styled.span.withConfig({
|
|
|
25
25
|
export var StyledTabButton = styled.button.withConfig({
|
|
26
26
|
displayName: "TabStyle__StyledTabButton",
|
|
27
27
|
componentId: "sc-3xj4eu-5"
|
|
28
|
-
})(["border:0;background:transparent;height:56px;cursor:
|
|
28
|
+
})(["border:0;background:transparent;height:56px;cursor:default;color:", ";width:100%;padding:0 ", ";&[data-disabled='false']{cursor:pointer;&:hover{color:", ";}&:hover span::before{background:", ";}}&&&[data-selected='true']{color:", ";}&&&[data-selected='true'] > span::before{background:", ";}@media (max-width:", "){height:48px;}"], Neutral.B40, space4, Neutral.B18, Blue.S100, Blue.S99, Blue.S99, Breakpoints.large);
|
package/es/@next/Tabs/Tabs.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
export declare type TabModel = {
|
|
3
3
|
/** Id of the tab, a random id will nbe assigned if empty */
|
|
4
4
|
id?: string;
|
|
5
5
|
/** Content of the type header */
|
|
6
6
|
content: React.ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/** The contentWrapper will be a wrapper component for the content */
|
|
9
|
+
contentWrapper?: (children: ReactNode) => ReactNode;
|
|
7
10
|
};
|
|
8
11
|
export declare type TabsProps = {
|
|
9
12
|
/** TabModel has 2 properties
|
package/es/@next/Tabs/Tabs.js
CHANGED
|
@@ -77,18 +77,20 @@ export var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(_ref, ref) {
|
|
|
77
77
|
};
|
|
78
78
|
var renderTabs = tabs.map(function (tab, index) {
|
|
79
79
|
var tabId = tab.id || nextId();
|
|
80
|
-
|
|
81
|
-
key: tabId + "-" + index,
|
|
82
|
-
className: "tab-item"
|
|
83
|
-
}, /*#__PURE__*/React.createElement(Tab, {
|
|
80
|
+
var tabContent = /*#__PURE__*/React.createElement(Tab, {
|
|
84
81
|
id: tabId,
|
|
85
82
|
key: "tab-" + tabId + "-" + index,
|
|
86
83
|
content: tab.content,
|
|
87
84
|
onSelect: function onSelect() {
|
|
88
85
|
return handleSelectedIndexChanged(index);
|
|
89
86
|
},
|
|
90
|
-
selected: index === selectedTabIndex
|
|
91
|
-
|
|
87
|
+
selected: index === selectedTabIndex,
|
|
88
|
+
disabled: tab.disabled
|
|
89
|
+
});
|
|
90
|
+
return /*#__PURE__*/React.createElement(StyledLi, {
|
|
91
|
+
key: tabId + "-" + index,
|
|
92
|
+
className: "tab-item"
|
|
93
|
+
}, tab.contentWrapper ? tab.contentWrapper(tabContent) : tabContent);
|
|
92
94
|
});
|
|
93
95
|
return /*#__PURE__*/React.createElement(StyledTabsContainer, {
|
|
94
96
|
ref: ref,
|
package/lib/@next/Tabs/Tab.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare type TabProps = {
|
|
|
3
3
|
content: React.ReactNode;
|
|
4
4
|
id?: string;
|
|
5
5
|
selected?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
6
7
|
onSelect: () => void;
|
|
7
8
|
};
|
|
8
|
-
export declare const Tab: ({ content, id, selected, onSelect }: TabProps) => JSX.Element;
|
|
9
|
+
export declare const Tab: ({ content, id, selected, disabled, onSelect, }: TabProps) => JSX.Element;
|
package/lib/@next/Tabs/Tab.js
CHANGED
|
@@ -11,9 +11,12 @@ var Tab = function Tab(_ref) {
|
|
|
11
11
|
var content = _ref.content,
|
|
12
12
|
id = _ref.id,
|
|
13
13
|
selected = _ref.selected,
|
|
14
|
+
_ref$disabled = _ref.disabled,
|
|
15
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
14
16
|
onSelect = _ref.onSelect;
|
|
15
17
|
var tabRef = (0, _react.useRef)(null);
|
|
16
18
|
var handleClick = function handleClick(event) {
|
|
19
|
+
if (disabled) return;
|
|
17
20
|
event.preventDefault();
|
|
18
21
|
tabRef.current.scrollIntoView({
|
|
19
22
|
behavior: 'smooth'
|
|
@@ -23,6 +26,7 @@ var Tab = function Tab(_ref) {
|
|
|
23
26
|
return /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledTabButton, {
|
|
24
27
|
ref: tabRef,
|
|
25
28
|
"data-selected": selected,
|
|
29
|
+
"data-disabled": disabled,
|
|
26
30
|
id: id,
|
|
27
31
|
onClick: handleClick
|
|
28
32
|
}, /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledSpan, null, /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
|
|
@@ -37,5 +37,5 @@ exports.StyledSpan = StyledSpan;
|
|
|
37
37
|
var StyledTabButton = _styledComponents["default"].button.withConfig({
|
|
38
38
|
displayName: "TabStyle__StyledTabButton",
|
|
39
39
|
componentId: "sc-3xj4eu-5"
|
|
40
|
-
})(["border:0;background:transparent;height:56px;cursor:
|
|
40
|
+
})(["border:0;background:transparent;height:56px;cursor:default;color:", ";width:100%;padding:0 ", ";&[data-disabled='false']{cursor:pointer;&:hover{color:", ";}&:hover span::before{background:", ";}}&&&[data-selected='true']{color:", ";}&&&[data-selected='true'] > span::before{background:", ";}@media (max-width:", "){height:48px;}"], _colors.Neutral.B40, _spacing.space4, _colors.Neutral.B18, _colors.Blue.S100, _colors.Blue.S99, _colors.Blue.S99, Breakpoints.large);
|
|
41
41
|
exports.StyledTabButton = StyledTabButton;
|
package/lib/@next/Tabs/Tabs.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
export declare type TabModel = {
|
|
3
3
|
/** Id of the tab, a random id will nbe assigned if empty */
|
|
4
4
|
id?: string;
|
|
5
5
|
/** Content of the type header */
|
|
6
6
|
content: React.ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/** The contentWrapper will be a wrapper component for the content */
|
|
9
|
+
contentWrapper?: (children: ReactNode) => ReactNode;
|
|
7
10
|
};
|
|
8
11
|
export declare type TabsProps = {
|
|
9
12
|
/** TabModel has 2 properties
|
package/lib/@next/Tabs/Tabs.js
CHANGED
|
@@ -84,18 +84,20 @@ var Tabs = /*#__PURE__*/_react["default"].forwardRef(function Tabs(_ref, ref) {
|
|
|
84
84
|
};
|
|
85
85
|
var renderTabs = tabs.map(function (tab, index) {
|
|
86
86
|
var tabId = tab.id || (0, _reactIdGenerator["default"])();
|
|
87
|
-
|
|
88
|
-
key: tabId + "-" + index,
|
|
89
|
-
className: "tab-item"
|
|
90
|
-
}, /*#__PURE__*/_react["default"].createElement(_Tab.Tab, {
|
|
87
|
+
var tabContent = /*#__PURE__*/_react["default"].createElement(_Tab.Tab, {
|
|
91
88
|
id: tabId,
|
|
92
89
|
key: "tab-" + tabId + "-" + index,
|
|
93
90
|
content: tab.content,
|
|
94
91
|
onSelect: function onSelect() {
|
|
95
92
|
return handleSelectedIndexChanged(index);
|
|
96
93
|
},
|
|
97
|
-
selected: index === selectedTabIndex
|
|
98
|
-
|
|
94
|
+
selected: index === selectedTabIndex,
|
|
95
|
+
disabled: tab.disabled
|
|
96
|
+
});
|
|
97
|
+
return /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledLi, {
|
|
98
|
+
key: tabId + "-" + index,
|
|
99
|
+
className: "tab-item"
|
|
100
|
+
}, tab.contentWrapper ? tab.contentWrapper(tabContent) : tabContent);
|
|
99
101
|
});
|
|
100
102
|
return /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledTabsContainer, {
|
|
101
103
|
ref: ref,
|