@pingux/astro 1.0.0-alpha.6 → 1.0.0-alpha.7
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/CHANGELOG.md +17 -0
- package/lib/cjs/components/Tab/Tab.js +10 -3
- package/lib/cjs/components/Tabs/Tabs.js +4 -1
- package/lib/cjs/components/Tabs/Tabs.stories.js +57 -2
- package/lib/cjs/components/Tabs/Tabs.test.js +34 -0
- package/lib/cjs/recipes/RadioButtonsWithLinks.stories.js +146 -0
- package/lib/cjs/styles/variants/tabs.js +1 -0
- package/lib/components/Tab/Tab.js +10 -3
- package/lib/components/Tabs/Tabs.js +4 -1
- package/lib/components/Tabs/Tabs.stories.js +53 -0
- package/lib/components/Tabs/Tabs.test.js +38 -0
- package/lib/recipes/RadioButtonsWithLinks.stories.js +120 -0
- package/lib/styles/variants/tabs.js +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,23 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [1.0.0-alpha.7](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.0.0-alpha.6...@pingux/astro@1.0.0-alpha.7) (2021-12-30)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-5064] Upgrade lodash version to 4.17.21 ([427286a](https://gitlab.corp.pingidentity.com/ux/pingux/commit/427286a9b3bbb940f7193c793e70e66770ee4ae0))
|
12
|
+
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
* [UIP-5004] RadioButtonsWithLinks Recipe ([dd7f2e9](https://gitlab.corp.pingidentity.com/ux/pingux/commit/dd7f2e9f3b30e9790de289b71739323cb6cd1328))
|
17
|
+
* [UIP-5037] Add slots props to Tab Component ([a7571a2](https://gitlab.corp.pingidentity.com/ux/pingux/commit/a7571a27568b63c4a0fffed1d9dd1ea21ba1f724))
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
6
23
|
# [1.0.0-alpha.6](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.0.0-alpha.5...@pingux/astro@1.0.0-alpha.6) (2021-12-30)
|
7
24
|
|
8
25
|
|
@@ -52,6 +52,7 @@ var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
52
52
|
tabsDisabled = props.isDisabled,
|
53
53
|
orientation = props.orientation,
|
54
54
|
mode = props.mode,
|
55
|
+
slots = props.slots,
|
55
56
|
tooltipTriggerProps = props.tooltipTriggerProps;
|
56
57
|
var key = item.key,
|
57
58
|
rendered = item.rendered,
|
@@ -99,14 +100,16 @@ var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
99
100
|
}, state, tabRef),
|
100
101
|
tabProps = _useTab.tabProps;
|
101
102
|
|
102
|
-
var tab = (0, _react2.jsx)(_Box["default"],
|
103
|
+
var tab = (0, _react2.jsx)(_Box["default"], {
|
104
|
+
isRow: true
|
105
|
+
}, slots === null || slots === void 0 ? void 0 : slots.beforeTab, (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
103
106
|
className: classNames,
|
104
107
|
variant: "tab"
|
105
108
|
}, (0, _utils.mergeProps)(focusProps, hoverProps, tabProps), otherItemProps, {
|
106
109
|
ref: tabRef
|
107
110
|
}), icon, (0, _react2.jsx)(_Text["default"], (0, _extends2["default"])({
|
108
111
|
variant: "tabLabel"
|
109
|
-
}, tabLabelProps), rendered), isSelected && !isDisabled && (0, _react2.jsx)(TabLine, tabLineProps));
|
112
|
+
}, tabLabelProps), rendered), isSelected && !isDisabled && (0, _react2.jsx)(TabLine, tabLineProps)), slots === null || slots === void 0 ? void 0 : slots.afterTab);
|
110
113
|
|
111
114
|
if (mode === 'tooltip') {
|
112
115
|
return (0, _react2.jsx)(_react["default"].Fragment, null, separator, (0, _react2.jsx)(_TooltipTrigger["default"], (0, _extends2["default"])({}, tooltipTriggerProps, {
|
@@ -130,7 +133,11 @@ CollectionTab.propTypes = {
|
|
130
133
|
}),
|
131
134
|
mode: _propTypes["default"].oneOf(['default', 'tooltip']),
|
132
135
|
orientation: _propTypes["default"].oneOf(['horizontal', 'vertical']),
|
133
|
-
tooltipTriggerProps: _propTypes["default"].shape({})
|
136
|
+
tooltipTriggerProps: _propTypes["default"].shape({}),
|
137
|
+
slots: _propTypes["default"].shape({
|
138
|
+
beforeTab: _propTypes["default"].node,
|
139
|
+
afterTab: _propTypes["default"].node
|
140
|
+
})
|
134
141
|
};
|
135
142
|
|
136
143
|
var TabLine = function TabLine(props) {
|
@@ -107,12 +107,15 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
107
107
|
}, tabListProps, raTabListProps, {
|
108
108
|
ref: tabListRef
|
109
109
|
}), (0, _map["default"])(_context = (0, _from["default"])(state.collection)).call(_context, function (item) {
|
110
|
+
var _item$props;
|
111
|
+
|
110
112
|
return (0, _react2.jsx)(_Tab.CollectionTab, {
|
111
113
|
key: item.key,
|
112
114
|
item: item,
|
113
115
|
isDisabled: isDisabled,
|
114
116
|
orientation: orientation,
|
115
|
-
mode: mode
|
117
|
+
mode: mode,
|
118
|
+
slots: item === null || item === void 0 ? void 0 : (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.slots
|
116
119
|
});
|
117
120
|
})), (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
118
121
|
variant: "tabPanel",
|
@@ -10,7 +10,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
10
10
|
value: true
|
11
11
|
});
|
12
12
|
|
13
|
-
exports.TabPanelProps = exports.Orientation = exports.CustomTabLine = exports.DisabledAllTabs = exports.DisabledSingleTab = exports.Centered = exports.WithTooltips = exports.WithIcon = exports.Controlled = exports.Uncontrolled = exports["default"] = void 0;
|
13
|
+
exports.ContentSlots = exports.TabPanelProps = exports.Orientation = exports.CustomTabLine = exports.DisabledAllTabs = exports.DisabledSingleTab = exports.Centered = exports.WithTooltips = exports.WithIcon = exports.Controlled = exports.Uncontrolled = exports["default"] = void 0;
|
14
14
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
16
16
|
|
@@ -20,6 +20,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
20
20
|
|
21
21
|
var _GlobeModelIcon = _interopRequireDefault(require("mdi-react/GlobeModelIcon"));
|
22
22
|
|
23
|
+
var _LockIcon = _interopRequireDefault(require("mdi-react/LockIcon"));
|
24
|
+
|
23
25
|
var _Tabs = _interopRequireDefault(require("./Tabs"));
|
24
26
|
|
25
27
|
var _Tab = _interopRequireDefault(require("../Tab"));
|
@@ -28,6 +30,8 @@ var _Icon = _interopRequireDefault(require("../Icon"));
|
|
28
30
|
|
29
31
|
var _Text = _interopRequireDefault(require("../Text"));
|
30
32
|
|
33
|
+
var _index = require("../../index");
|
34
|
+
|
31
35
|
var _react2 = require("@emotion/react");
|
32
36
|
|
33
37
|
var _default = {
|
@@ -238,4 +242,55 @@ var TabPanelProps = function TabPanelProps() {
|
|
238
242
|
});
|
239
243
|
};
|
240
244
|
|
241
|
-
exports.TabPanelProps = TabPanelProps;
|
245
|
+
exports.TabPanelProps = TabPanelProps;
|
246
|
+
|
247
|
+
var ContentSlots = function ContentSlots() {
|
248
|
+
var beforeTabNode = (0, _react2.jsx)(_Icon["default"], {
|
249
|
+
icon: _LockIcon["default"],
|
250
|
+
sx: {
|
251
|
+
marginTop: 10,
|
252
|
+
marginRight: 5
|
253
|
+
}
|
254
|
+
});
|
255
|
+
var nodeSx = {
|
256
|
+
alignItems: 'center',
|
257
|
+
backgroundColor: 'neutral.95',
|
258
|
+
borderRadius: '50%',
|
259
|
+
color: 'neutral.30',
|
260
|
+
fontSize: 'sm',
|
261
|
+
height: 20,
|
262
|
+
justifyContent: 'center',
|
263
|
+
marginLeft: 6,
|
264
|
+
marginTop: 10,
|
265
|
+
minWidth: 20
|
266
|
+
};
|
267
|
+
var afterTabNode = (0, _react2.jsx)(_index.Chip, {
|
268
|
+
sx: nodeSx
|
269
|
+
}, "14");
|
270
|
+
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_Tabs["default"], {
|
271
|
+
items: tabs,
|
272
|
+
mb: 50
|
273
|
+
}, (0, _react2.jsx)(_Tab["default"], {
|
274
|
+
key: "tab1",
|
275
|
+
title: "Tab 1",
|
276
|
+
slots: {
|
277
|
+
beforeTab: beforeTabNode
|
278
|
+
}
|
279
|
+
}, (0, _react2.jsx)(_Text["default"], null, "This is content for Tab 1")), (0, _react2.jsx)(_Tab["default"], {
|
280
|
+
key: "tab2",
|
281
|
+
title: "Tab 2"
|
282
|
+
}, (0, _react2.jsx)(_Text["default"], null, "This is content for Tab 2"))), (0, _react2.jsx)(_Tabs["default"], {
|
283
|
+
items: tabs
|
284
|
+
}, (0, _react2.jsx)(_Tab["default"], {
|
285
|
+
key: "tab1",
|
286
|
+
title: "Tab 1"
|
287
|
+
}, (0, _react2.jsx)(_Text["default"], null, "Compose Filter")), (0, _react2.jsx)(_Tab["default"], {
|
288
|
+
key: "tab2",
|
289
|
+
title: "Tab 2",
|
290
|
+
slots: {
|
291
|
+
afterTab: afterTabNode
|
292
|
+
}
|
293
|
+
}, (0, _react2.jsx)(_Text["default"], null, "Users Matched"))));
|
294
|
+
};
|
295
|
+
|
296
|
+
exports.ContentSlots = ContentSlots;
|
@@ -394,4 +394,38 @@ test('hover tab style', function () {
|
|
394
394
|
_userEvent["default"].hover(tab0);
|
395
395
|
|
396
396
|
expect(tab0).toHaveClass('is-hovered');
|
397
|
+
});
|
398
|
+
test('will render slots.beforeTab if provided', function () {
|
399
|
+
var testText = 'test-text';
|
400
|
+
var testComponent = (0, _react2.jsx)("div", null, testText);
|
401
|
+
var tabs = [{
|
402
|
+
name: 'Tab 1',
|
403
|
+
children: 'Tab 1 body',
|
404
|
+
props: {
|
405
|
+
slots: {
|
406
|
+
beforeTab: testComponent
|
407
|
+
}
|
408
|
+
}
|
409
|
+
}];
|
410
|
+
getComponent({}, {
|
411
|
+
tabs: tabs
|
412
|
+
});
|
413
|
+
expect(_testWrapper.screen.getByText(testText)).toBeInTheDocument();
|
414
|
+
});
|
415
|
+
test('will render slots.afterTab if provided', function () {
|
416
|
+
var testText = 'test-text';
|
417
|
+
var testComponent = (0, _react2.jsx)("div", null, testText);
|
418
|
+
var tabs = [{
|
419
|
+
name: 'Tab 1',
|
420
|
+
children: 'Tab 1 body',
|
421
|
+
props: {
|
422
|
+
slots: {
|
423
|
+
afterTab: testComponent
|
424
|
+
}
|
425
|
+
}
|
426
|
+
}];
|
427
|
+
getComponent({}, {
|
428
|
+
tabs: tabs
|
429
|
+
});
|
430
|
+
expect(_testWrapper.screen.getByText(testText)).toBeInTheDocument();
|
397
431
|
});
|
@@ -0,0 +1,146 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard");
|
4
|
+
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
6
|
+
|
7
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
8
|
+
|
9
|
+
_Object$defineProperty(exports, "__esModule", {
|
10
|
+
value: true
|
11
|
+
});
|
12
|
+
|
13
|
+
exports.Default = exports["default"] = void 0;
|
14
|
+
|
15
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
16
|
+
|
17
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
18
|
+
|
19
|
+
var _react = _interopRequireWildcard(require("react"));
|
20
|
+
|
21
|
+
var _CloseIcon = _interopRequireDefault(require("mdi-react/CloseIcon"));
|
22
|
+
|
23
|
+
var _index = require("../index");
|
24
|
+
|
25
|
+
var _RadioField = _interopRequireDefault(require("../components/RadioField"));
|
26
|
+
|
27
|
+
var _RadioGroupField = _interopRequireDefault(require("../components/RadioGroupField"));
|
28
|
+
|
29
|
+
var _react2 = require("@emotion/react");
|
30
|
+
|
31
|
+
var _default = {
|
32
|
+
title: 'Recipes/RadioButtonsWithLinks'
|
33
|
+
};
|
34
|
+
exports["default"] = _default;
|
35
|
+
|
36
|
+
var Default = function Default() {
|
37
|
+
var roles = [{
|
38
|
+
name: 'Client Application Developer'
|
39
|
+
}, {
|
40
|
+
name: 'Environment Admin',
|
41
|
+
isDisabled: true
|
42
|
+
}, {
|
43
|
+
name: 'Identity Data Admin',
|
44
|
+
isDisabled: true
|
45
|
+
}, {
|
46
|
+
name: 'Organization Admin'
|
47
|
+
}];
|
48
|
+
var titleSx = {
|
49
|
+
fontSize: 'md',
|
50
|
+
color: 'neutral.20',
|
51
|
+
fontWeight: 2
|
52
|
+
};
|
53
|
+
var subtitleSx = {
|
54
|
+
fontSize: 'md',
|
55
|
+
color: 'neutral.10'
|
56
|
+
};
|
57
|
+
|
58
|
+
var RadioFieldWithButton = function RadioFieldWithButton(_ref) {
|
59
|
+
var fieldName = _ref.fieldName,
|
60
|
+
isDisabled = _ref.isDisabled;
|
61
|
+
|
62
|
+
var _useState = (0, _react.useState)(false),
|
63
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
64
|
+
isOpen = _useState2[0],
|
65
|
+
setIsOpen = _useState2[1];
|
66
|
+
|
67
|
+
return (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Box, {
|
68
|
+
isRow: true,
|
69
|
+
alignItems: "center"
|
70
|
+
}, (0, _react2.jsx)(_RadioField["default"], {
|
71
|
+
value: fieldName,
|
72
|
+
label: fieldName,
|
73
|
+
isDisabled: isDisabled
|
74
|
+
}), (0, _react2.jsx)(_index.Button, {
|
75
|
+
variant: "text",
|
76
|
+
mb: "xs",
|
77
|
+
ml: "md",
|
78
|
+
onPress: function onPress() {
|
79
|
+
return setIsOpen(function (prev) {
|
80
|
+
return !prev;
|
81
|
+
});
|
82
|
+
},
|
83
|
+
isDisabled: isDisabled
|
84
|
+
}, "".concat(isOpen ? 'Hide' : 'Show', " Permissions"))), isOpen && (0, _react2.jsx)(PermissionsList, {
|
85
|
+
onPress: function onPress() {
|
86
|
+
return setIsOpen(false);
|
87
|
+
}
|
88
|
+
}));
|
89
|
+
};
|
90
|
+
|
91
|
+
var PermissionsList = function PermissionsList(_ref2) {
|
92
|
+
var onPress = _ref2.onPress;
|
93
|
+
return (0, _react2.jsx)(_index.Box, {
|
94
|
+
p: "md",
|
95
|
+
bg: "neutral.95"
|
96
|
+
}, (0, _react2.jsx)(_index.Box, {
|
97
|
+
isRow: true,
|
98
|
+
justifyContent: "space-between",
|
99
|
+
mb: "sm"
|
100
|
+
}, (0, _react2.jsx)(_index.Text, {
|
101
|
+
sx: {
|
102
|
+
fontWeight: 2
|
103
|
+
}
|
104
|
+
}, "Permissions"), (0, _react2.jsx)(_index.IconButton, {
|
105
|
+
onPress: onPress
|
106
|
+
}, (0, _react2.jsx)(_index.Icon, {
|
107
|
+
icon: _CloseIcon["default"]
|
108
|
+
}))), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Text, {
|
109
|
+
sx: titleSx,
|
110
|
+
mb: "xs"
|
111
|
+
}, "Resource"), (0, _react2.jsx)(_index.Text, {
|
112
|
+
sx: subtitleSx,
|
113
|
+
mb: "sm"
|
114
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."), (0, _react2.jsx)(_index.Text, {
|
115
|
+
sx: titleSx,
|
116
|
+
mb: "xs"
|
117
|
+
}, "Push Credentials"), (0, _react2.jsx)(_index.Text, {
|
118
|
+
sx: subtitleSx,
|
119
|
+
mb: "sm"
|
120
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod"), (0, _react2.jsx)(_index.Text, {
|
121
|
+
sx: titleSx,
|
122
|
+
mb: "xs"
|
123
|
+
}, "Organization"), (0, _react2.jsx)(_index.Text, {
|
124
|
+
sx: subtitleSx,
|
125
|
+
mb: "sm"
|
126
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco"), (0, _react2.jsx)(_index.Text, {
|
127
|
+
sx: titleSx,
|
128
|
+
mb: "xs"
|
129
|
+
}, "Image"), (0, _react2.jsx)(_index.Text, {
|
130
|
+
sx: subtitleSx,
|
131
|
+
mb: "sm"
|
132
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod")));
|
133
|
+
};
|
134
|
+
|
135
|
+
return (0, _react2.jsx)(_RadioGroupField["default"], null, (0, _map["default"])(roles).call(roles, function (_ref3) {
|
136
|
+
var name = _ref3.name,
|
137
|
+
isDisabled = _ref3.isDisabled;
|
138
|
+
return (0, _react2.jsx)(RadioFieldWithButton, {
|
139
|
+
fieldName: name,
|
140
|
+
isDisabled: isDisabled,
|
141
|
+
key: name
|
142
|
+
});
|
143
|
+
}));
|
144
|
+
};
|
145
|
+
|
146
|
+
exports.Default = Default;
|
@@ -21,6 +21,7 @@ export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
21
21
|
tabsDisabled = props.isDisabled,
|
22
22
|
orientation = props.orientation,
|
23
23
|
mode = props.mode,
|
24
|
+
slots = props.slots,
|
24
25
|
tooltipTriggerProps = props.tooltipTriggerProps;
|
25
26
|
var key = item.key,
|
26
27
|
rendered = item.rendered,
|
@@ -70,14 +71,16 @@ export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
70
71
|
}, state, tabRef),
|
71
72
|
tabProps = _useTab.tabProps;
|
72
73
|
|
73
|
-
var tab = ___EmotionJSX(Box,
|
74
|
+
var tab = ___EmotionJSX(Box, {
|
75
|
+
isRow: true
|
76
|
+
}, slots === null || slots === void 0 ? void 0 : slots.beforeTab, ___EmotionJSX(Box, _extends({
|
74
77
|
className: classNames,
|
75
78
|
variant: "tab"
|
76
79
|
}, mergeProps(focusProps, hoverProps, tabProps), otherItemProps, {
|
77
80
|
ref: tabRef
|
78
81
|
}), icon, ___EmotionJSX(Text, _extends({
|
79
82
|
variant: "tabLabel"
|
80
|
-
}, tabLabelProps), rendered), isSelected && !isDisabled && ___EmotionJSX(TabLine, tabLineProps));
|
83
|
+
}, tabLabelProps), rendered), isSelected && !isDisabled && ___EmotionJSX(TabLine, tabLineProps)), slots === null || slots === void 0 ? void 0 : slots.afterTab);
|
81
84
|
|
82
85
|
if (mode === 'tooltip') {
|
83
86
|
return ___EmotionJSX(React.Fragment, null, separator, ___EmotionJSX(TooltipTrigger, _extends({}, tooltipTriggerProps, {
|
@@ -100,7 +103,11 @@ CollectionTab.propTypes = {
|
|
100
103
|
}),
|
101
104
|
mode: PropTypes.oneOf(['default', 'tooltip']),
|
102
105
|
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
103
|
-
tooltipTriggerProps: PropTypes.shape({})
|
106
|
+
tooltipTriggerProps: PropTypes.shape({}),
|
107
|
+
slots: PropTypes.shape({
|
108
|
+
beforeTab: PropTypes.node,
|
109
|
+
afterTab: PropTypes.node
|
110
|
+
})
|
104
111
|
};
|
105
112
|
|
106
113
|
var TabLine = function TabLine(props) {
|
@@ -71,12 +71,15 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
71
71
|
}, tabListProps, raTabListProps, {
|
72
72
|
ref: tabListRef
|
73
73
|
}), _mapInstanceProperty(_context = _Array$from(state.collection)).call(_context, function (item) {
|
74
|
+
var _item$props;
|
75
|
+
|
74
76
|
return ___EmotionJSX(CollectionTab, {
|
75
77
|
key: item.key,
|
76
78
|
item: item,
|
77
79
|
isDisabled: isDisabled,
|
78
80
|
orientation: orientation,
|
79
|
-
mode: mode
|
81
|
+
mode: mode,
|
82
|
+
slots: item === null || item === void 0 ? void 0 : (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.slots
|
80
83
|
});
|
81
84
|
})), ___EmotionJSX(Box, _extends({
|
82
85
|
variant: "tabPanel",
|
@@ -2,10 +2,12 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
3
3
|
import React, { useState } from 'react';
|
4
4
|
import Earth from 'mdi-react/GlobeModelIcon';
|
5
|
+
import LockIcon from 'mdi-react/LockIcon';
|
5
6
|
import Tabs from './Tabs';
|
6
7
|
import Tab from '../Tab';
|
7
8
|
import Icon from '../Icon';
|
8
9
|
import Text from '../Text';
|
10
|
+
import { Chip } from '../../index';
|
9
11
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
12
|
export default {
|
11
13
|
title: 'Tabs',
|
@@ -184,4 +186,55 @@ export var TabPanelProps = function TabPanelProps() {
|
|
184
186
|
title: item.name
|
185
187
|
}, item.children);
|
186
188
|
});
|
189
|
+
};
|
190
|
+
export var ContentSlots = function ContentSlots() {
|
191
|
+
var beforeTabNode = ___EmotionJSX(Icon, {
|
192
|
+
icon: LockIcon,
|
193
|
+
sx: {
|
194
|
+
marginTop: 10,
|
195
|
+
marginRight: 5
|
196
|
+
}
|
197
|
+
});
|
198
|
+
|
199
|
+
var nodeSx = {
|
200
|
+
alignItems: 'center',
|
201
|
+
backgroundColor: 'neutral.95',
|
202
|
+
borderRadius: '50%',
|
203
|
+
color: 'neutral.30',
|
204
|
+
fontSize: 'sm',
|
205
|
+
height: 20,
|
206
|
+
justifyContent: 'center',
|
207
|
+
marginLeft: 6,
|
208
|
+
marginTop: 10,
|
209
|
+
minWidth: 20
|
210
|
+
};
|
211
|
+
|
212
|
+
var afterTabNode = ___EmotionJSX(Chip, {
|
213
|
+
sx: nodeSx
|
214
|
+
}, "14");
|
215
|
+
|
216
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Tabs, {
|
217
|
+
items: tabs,
|
218
|
+
mb: 50
|
219
|
+
}, ___EmotionJSX(Tab, {
|
220
|
+
key: "tab1",
|
221
|
+
title: "Tab 1",
|
222
|
+
slots: {
|
223
|
+
beforeTab: beforeTabNode
|
224
|
+
}
|
225
|
+
}, ___EmotionJSX(Text, null, "This is content for Tab 1")), ___EmotionJSX(Tab, {
|
226
|
+
key: "tab2",
|
227
|
+
title: "Tab 2"
|
228
|
+
}, ___EmotionJSX(Text, null, "This is content for Tab 2"))), ___EmotionJSX(Tabs, {
|
229
|
+
items: tabs
|
230
|
+
}, ___EmotionJSX(Tab, {
|
231
|
+
key: "tab1",
|
232
|
+
title: "Tab 1"
|
233
|
+
}, ___EmotionJSX(Text, null, "Compose Filter")), ___EmotionJSX(Tab, {
|
234
|
+
key: "tab2",
|
235
|
+
title: "Tab 2",
|
236
|
+
slots: {
|
237
|
+
afterTab: afterTabNode
|
238
|
+
}
|
239
|
+
}, ___EmotionJSX(Text, null, "Users Matched"))));
|
187
240
|
};
|
@@ -351,4 +351,42 @@ test('hover tab style', function () {
|
|
351
351
|
expect(tab0).not.toHaveClass('is-hovered');
|
352
352
|
userEvent.hover(tab0);
|
353
353
|
expect(tab0).toHaveClass('is-hovered');
|
354
|
+
});
|
355
|
+
test('will render slots.beforeTab if provided', function () {
|
356
|
+
var testText = 'test-text';
|
357
|
+
|
358
|
+
var testComponent = ___EmotionJSX("div", null, testText);
|
359
|
+
|
360
|
+
var tabs = [{
|
361
|
+
name: 'Tab 1',
|
362
|
+
children: 'Tab 1 body',
|
363
|
+
props: {
|
364
|
+
slots: {
|
365
|
+
beforeTab: testComponent
|
366
|
+
}
|
367
|
+
}
|
368
|
+
}];
|
369
|
+
getComponent({}, {
|
370
|
+
tabs: tabs
|
371
|
+
});
|
372
|
+
expect(screen.getByText(testText)).toBeInTheDocument();
|
373
|
+
});
|
374
|
+
test('will render slots.afterTab if provided', function () {
|
375
|
+
var testText = 'test-text';
|
376
|
+
|
377
|
+
var testComponent = ___EmotionJSX("div", null, testText);
|
378
|
+
|
379
|
+
var tabs = [{
|
380
|
+
name: 'Tab 1',
|
381
|
+
children: 'Tab 1 body',
|
382
|
+
props: {
|
383
|
+
slots: {
|
384
|
+
afterTab: testComponent
|
385
|
+
}
|
386
|
+
}
|
387
|
+
}];
|
388
|
+
getComponent({}, {
|
389
|
+
tabs: tabs
|
390
|
+
});
|
391
|
+
expect(screen.getByText(testText)).toBeInTheDocument();
|
354
392
|
});
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
2
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
3
|
+
import React, { useState } from 'react';
|
4
|
+
import CloseIcon from 'mdi-react/CloseIcon';
|
5
|
+
import { Box, Button, Icon, IconButton, Text } from '../index';
|
6
|
+
import RadioField from '../components/RadioField';
|
7
|
+
import RadioGroupField from '../components/RadioGroupField';
|
8
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
9
|
+
export default {
|
10
|
+
title: 'Recipes/RadioButtonsWithLinks'
|
11
|
+
};
|
12
|
+
export var Default = function Default() {
|
13
|
+
var roles = [{
|
14
|
+
name: 'Client Application Developer'
|
15
|
+
}, {
|
16
|
+
name: 'Environment Admin',
|
17
|
+
isDisabled: true
|
18
|
+
}, {
|
19
|
+
name: 'Identity Data Admin',
|
20
|
+
isDisabled: true
|
21
|
+
}, {
|
22
|
+
name: 'Organization Admin'
|
23
|
+
}];
|
24
|
+
var titleSx = {
|
25
|
+
fontSize: 'md',
|
26
|
+
color: 'neutral.20',
|
27
|
+
fontWeight: 2
|
28
|
+
};
|
29
|
+
var subtitleSx = {
|
30
|
+
fontSize: 'md',
|
31
|
+
color: 'neutral.10'
|
32
|
+
};
|
33
|
+
|
34
|
+
var RadioFieldWithButton = function RadioFieldWithButton(_ref) {
|
35
|
+
var fieldName = _ref.fieldName,
|
36
|
+
isDisabled = _ref.isDisabled;
|
37
|
+
|
38
|
+
var _useState = useState(false),
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
40
|
+
isOpen = _useState2[0],
|
41
|
+
setIsOpen = _useState2[1];
|
42
|
+
|
43
|
+
return ___EmotionJSX(Box, null, ___EmotionJSX(Box, {
|
44
|
+
isRow: true,
|
45
|
+
alignItems: "center"
|
46
|
+
}, ___EmotionJSX(RadioField, {
|
47
|
+
value: fieldName,
|
48
|
+
label: fieldName,
|
49
|
+
isDisabled: isDisabled
|
50
|
+
}), ___EmotionJSX(Button, {
|
51
|
+
variant: "text",
|
52
|
+
mb: "xs",
|
53
|
+
ml: "md",
|
54
|
+
onPress: function onPress() {
|
55
|
+
return setIsOpen(function (prev) {
|
56
|
+
return !prev;
|
57
|
+
});
|
58
|
+
},
|
59
|
+
isDisabled: isDisabled
|
60
|
+
}, "".concat(isOpen ? 'Hide' : 'Show', " Permissions"))), isOpen && ___EmotionJSX(PermissionsList, {
|
61
|
+
onPress: function onPress() {
|
62
|
+
return setIsOpen(false);
|
63
|
+
}
|
64
|
+
}));
|
65
|
+
};
|
66
|
+
|
67
|
+
var PermissionsList = function PermissionsList(_ref2) {
|
68
|
+
var onPress = _ref2.onPress;
|
69
|
+
return ___EmotionJSX(Box, {
|
70
|
+
p: "md",
|
71
|
+
bg: "neutral.95"
|
72
|
+
}, ___EmotionJSX(Box, {
|
73
|
+
isRow: true,
|
74
|
+
justifyContent: "space-between",
|
75
|
+
mb: "sm"
|
76
|
+
}, ___EmotionJSX(Text, {
|
77
|
+
sx: {
|
78
|
+
fontWeight: 2
|
79
|
+
}
|
80
|
+
}, "Permissions"), ___EmotionJSX(IconButton, {
|
81
|
+
onPress: onPress
|
82
|
+
}, ___EmotionJSX(Icon, {
|
83
|
+
icon: CloseIcon
|
84
|
+
}))), ___EmotionJSX(Box, null, ___EmotionJSX(Text, {
|
85
|
+
sx: titleSx,
|
86
|
+
mb: "xs"
|
87
|
+
}, "Resource"), ___EmotionJSX(Text, {
|
88
|
+
sx: subtitleSx,
|
89
|
+
mb: "sm"
|
90
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."), ___EmotionJSX(Text, {
|
91
|
+
sx: titleSx,
|
92
|
+
mb: "xs"
|
93
|
+
}, "Push Credentials"), ___EmotionJSX(Text, {
|
94
|
+
sx: subtitleSx,
|
95
|
+
mb: "sm"
|
96
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod"), ___EmotionJSX(Text, {
|
97
|
+
sx: titleSx,
|
98
|
+
mb: "xs"
|
99
|
+
}, "Organization"), ___EmotionJSX(Text, {
|
100
|
+
sx: subtitleSx,
|
101
|
+
mb: "sm"
|
102
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco"), ___EmotionJSX(Text, {
|
103
|
+
sx: titleSx,
|
104
|
+
mb: "xs"
|
105
|
+
}, "Image"), ___EmotionJSX(Text, {
|
106
|
+
sx: subtitleSx,
|
107
|
+
mb: "sm"
|
108
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod")));
|
109
|
+
};
|
110
|
+
|
111
|
+
return ___EmotionJSX(RadioGroupField, null, _mapInstanceProperty(roles).call(roles, function (_ref3) {
|
112
|
+
var name = _ref3.name,
|
113
|
+
isDisabled = _ref3.isDisabled;
|
114
|
+
return ___EmotionJSX(RadioFieldWithButton, {
|
115
|
+
fieldName: name,
|
116
|
+
isDisabled: isDisabled,
|
117
|
+
key: name
|
118
|
+
});
|
119
|
+
}));
|
120
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pingux/astro",
|
3
|
-
"version": "1.0.0-alpha.
|
3
|
+
"version": "1.0.0-alpha.7",
|
4
4
|
"description": "PingUX themeable React component library",
|
5
5
|
"author": "uxdev@pingidentity.com",
|
6
6
|
"license": "Apache-2.0",
|
@@ -129,7 +129,7 @@
|
|
129
129
|
"chroma-js": "^2.1.0",
|
130
130
|
"classnames": "^2.2.6",
|
131
131
|
"emotion-normalize": "^11.0.1",
|
132
|
-
"lodash": "^4.17.
|
132
|
+
"lodash": "^4.17.21",
|
133
133
|
"mdi-react": "^7.4.0",
|
134
134
|
"moment": "^2.29.1",
|
135
135
|
"prop-types": "^15.7.2",
|