@pedidopago/ui 1.1.0 → 1.1.1
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/dist/components/Alert/alert.test.js +9 -1
- package/dist/components/Alert/index.js +47 -35
- package/dist/components/Avatar/avatar.test.js +9 -1
- package/dist/components/Avatar/index.js +47 -27
- package/dist/components/Badge/badge.test.js +9 -1
- package/dist/components/Badge/index.js +24 -15
- package/dist/components/Button/Button.test.js +19 -7
- package/dist/components/Button/index.js +28 -16
- package/dist/components/Card/ButtonCard/index.js +24 -10
- package/dist/components/Card/Expansion/index.js +24 -17
- package/dist/components/Card/card.test.js +9 -1
- package/dist/components/Card/index.js +43 -19
- package/dist/components/CheckboxInput/checkbox-input.test.js +9 -1
- package/dist/components/CheckboxInput/components/MultipleCheckbox.js +58 -43
- package/dist/components/CheckboxInput/index.js +29 -18
- package/dist/components/ColorPicker/colorpicker.test.js +9 -1
- package/dist/components/ColorPicker/components/ColorHue.js +17 -10
- package/dist/components/ColorPicker/components/ColorInput.js +3 -1
- package/dist/components/ColorPicker/components/ColorPickerBox.js +13 -9
- package/dist/components/ColorPicker/components/ColorPointer.js +3 -1
- package/dist/components/ColorPicker/components/ColorSelector.js +8 -2
- package/dist/components/ColorPicker/index.js +44 -34
- package/dist/components/DatePicker/components/DatePickerContent.js +113 -79
- package/dist/components/DatePicker/components/DateYearPicker.js +45 -32
- package/dist/components/DatePicker/datepicker.test.js +9 -1
- package/dist/components/DatePicker/index.js +40 -29
- package/dist/components/Dialog/dialog-example.js +21 -13
- package/dist/components/Dialog/dialog.test.js +5 -1
- package/dist/components/Dialog/index.js +59 -46
- package/dist/components/Dropzone/dropzone.test.js +9 -1
- package/dist/components/Dropzone/index.js +122 -97
- package/dist/components/Flex/flex.test.js +128 -14
- package/dist/components/Flex/index.js +11 -3
- package/dist/components/Grid/grid.test.js +86 -81
- package/dist/components/Grid/index.js +11 -3
- package/dist/components/Icon/icon.test.js +3 -3
- package/dist/components/Icon/index.js +8 -2
- package/dist/components/IconItem/IconItem.test.js +9 -1
- package/dist/components/IconItem/index.js +33 -18
- package/dist/components/ImageItem/imageFake.js +13 -9
- package/dist/components/ImageItem/index.js +36 -24
- package/dist/components/ImageItem/input.test.js +10 -7
- package/dist/components/Input/index.js +67 -40
- package/dist/components/Input/input.test.js +4 -4
- package/dist/components/Label/index.js +12 -9
- package/dist/components/Label/input.test.js +3 -1
- package/dist/components/List/index.js +15 -4
- package/dist/components/List/list.test.js +36 -18
- package/dist/components/Menu/components/Submenu.js +49 -26
- package/dist/components/Menu/index.js +19 -10
- package/dist/components/Menu/menu.test.js +14 -14
- package/dist/components/Modal/index.js +24 -19
- package/dist/components/Modal/modal.test.js +44 -12
- package/dist/components/Pagination/index.js +54 -45
- package/dist/components/Pagination/pagination.test.js +13 -11
- package/dist/components/Progress/Circle/index.js +38 -29
- package/dist/components/Progress/Linear/index.js +24 -17
- package/dist/components/Progress/index.js +4 -2
- package/dist/components/Progress/progress.test.js +9 -1
- package/dist/components/RadioInput/components/ChoiceList/index.js +28 -20
- package/dist/components/RadioInput/index.js +27 -22
- package/dist/components/RadioInput/radio-input.test.js +118 -87
- package/dist/components/Rating/components/GradientIcon/index.js +24 -17
- package/dist/components/Rating/components/RatingWithMultipleValues/RatingWithMultipleValues.js +24 -22
- package/dist/components/Rating/components/RatingWithSingleValue/RatingWithSingleValue.js +21 -17
- package/dist/components/Rating/index.js +29 -26
- package/dist/components/Rating/rating.test.js +3 -1
- package/dist/components/SelectInput/components/OptionsArea/index.js +37 -32
- package/dist/components/SelectInput/components/SelectArea/index.js +46 -34
- package/dist/components/SelectInput/index.js +26 -23
- package/dist/components/SelectInput/selectInput.test.js +10 -4
- package/dist/components/Skeleton/index.js +11 -1
- package/dist/components/Skeleton/skeleton.test.js +3 -1
- package/dist/components/Slider/components/SliderPointer.js +23 -17
- package/dist/components/Slider/components/SliderRail.js +8 -2
- package/dist/components/Slider/components/SliderSelector.js +86 -78
- package/dist/components/Slider/index.js +28 -16
- package/dist/components/Slider/slider.test.js +9 -1
- package/dist/components/Spinner/index.js +3 -1
- package/dist/components/Spinner/spinner.test.js +9 -1
- package/dist/components/Steps/index.js +25 -17
- package/dist/components/Steps/steps.test.js +3 -1
- package/dist/components/Switch/index.js +23 -17
- package/dist/components/Switch/input.test.js +3 -1
- package/dist/components/Table/components/MenuItem.js +16 -13
- package/dist/components/Table/index.js +139 -99
- package/dist/components/Table/table.test.js +3 -1
- package/dist/components/Tabs/TabsExample.js +37 -23
- package/dist/components/Tabs/components/Tab.js +12 -3
- package/dist/components/Tabs/components/TabPanel.js +8 -3
- package/dist/components/Tabs/components/Tabs.js +33 -23
- package/dist/components/Tabs/tabs.test.js +103 -83
- package/dist/components/Tag/index.js +21 -16
- package/dist/components/Tag/tag.test.js +9 -7
- package/dist/components/TextAreaInput/index.js +25 -15
- package/dist/components/TextAreaInput/text-area-input.test.js +8 -2
- package/dist/components/Thumbnail/index.js +71 -60
- package/dist/components/Thumbnail/thumbnail.test.js +9 -1
- package/dist/components/Timeline/components/Timeline.js +9 -5
- package/dist/components/Timeline/components/TimelineContent.js +31 -15
- package/dist/components/Timeline/components/TimelineItem.js +11 -1
- package/dist/components/Timeline/components/TimelineSeparator.js +9 -4
- package/dist/components/Timeline/timeline.test.js +105 -76
- package/dist/components/Toast/button-example.js +10 -5
- package/dist/components/Toast/components/Toast.js +16 -11
- package/dist/components/Toast/contexts/ToastProvider.js +6 -3
- package/dist/components/Toast/index.js +90 -62
- package/dist/components/Toast/toast.test.js +11 -1
- package/dist/components/Tooltip/componenteTeste.js +42 -14
- package/dist/components/Tooltip/index.js +56 -46
- package/dist/components/Tooltip/tooltip.test.js +13 -8
- package/dist/components/Typography/index.js +11 -3
- package/dist/components/Typography/typography.test.js +3 -1
- package/dist/shared/components/FocusLock/index.js +11 -4
- package/dist/shared/tests/test-utils.js +6 -3
- package/dist/shared/theme/button-example.js +6 -3
- package/dist/shared/theme/contexts/ThemeContext.js +12 -6
- package/dist/shared/theme/theme.test.js +25 -11
- package/package.json +1 -1
|
@@ -23,10 +23,18 @@ var _useColorMode2 = require("../../shared/theme/hooks/useColorMode");
|
|
|
23
23
|
|
|
24
24
|
var _GenerateKey = require("../../utils/GenerateKey");
|
|
25
25
|
|
|
26
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
+
|
|
26
28
|
var _excluded = ["selectable", "primaryActions", "secondaryActions", "header", "rows", "rowMenuActions"];
|
|
27
29
|
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
31
|
|
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
|
+
|
|
36
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
37
|
+
|
|
30
38
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
31
39
|
|
|
32
40
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -129,103 +137,135 @@ function Table(_ref) {
|
|
|
129
137
|
setAllSelected(!allSelected);
|
|
130
138
|
};
|
|
131
139
|
|
|
132
|
-
return /*#__PURE__*/
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
140
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.StyledTable, _objectSpread(_objectSpread({}, rest), {}, {
|
|
141
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("thead", {
|
|
142
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("tr", {
|
|
143
|
+
children: [selectedRows.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
|
|
144
|
+
colSpan: header.length + 1,
|
|
145
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.SelectedHeader, {
|
|
146
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ActionsButton, {
|
|
147
|
+
onClick: function onClick() {
|
|
148
|
+
return toggleSelectAll();
|
|
149
|
+
},
|
|
150
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckboxInput.default, {
|
|
151
|
+
isInderteminate: selectedRows.length > 0 && !allSelected,
|
|
152
|
+
defaultIsChecked: allSelected || selectedRows.length > 0,
|
|
153
|
+
onChangeValue: function onChangeValue(checked) {
|
|
154
|
+
if (!checked && selectedRows.length > 0) {
|
|
155
|
+
setSelectedRows([]);
|
|
156
|
+
setAllSelected(false);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
|
|
160
|
+
fontSize: "xs",
|
|
161
|
+
fontWeight: "500",
|
|
162
|
+
children: [selectedRows.length, " ", selectedRows.length > 1 ? 'selecionados' : 'selecionado']
|
|
163
|
+
})]
|
|
164
|
+
}), !!primaryActions && primaryActions.map(function (action) {
|
|
165
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ActionsButton, {
|
|
166
|
+
onClick: function onClick() {
|
|
167
|
+
return action.handler(selectedRows, allSelected);
|
|
168
|
+
},
|
|
169
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
170
|
+
fontSize: "xs",
|
|
171
|
+
fontWeight: "500",
|
|
172
|
+
children: action.label
|
|
173
|
+
})
|
|
174
|
+
}, (0, _GenerateKey.generateKey)());
|
|
175
|
+
}), !!secondaryActions && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ActionsButton, {
|
|
176
|
+
onClick: function onClick() {
|
|
177
|
+
return setOpenSelectDropDownMenu(!openSelectDropDownMenu);
|
|
178
|
+
},
|
|
179
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
|
|
180
|
+
fontSize: "xs",
|
|
181
|
+
fontWeight: "500",
|
|
182
|
+
children: ["Mais ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
183
|
+
name: "chevron-down"
|
|
184
|
+
})]
|
|
185
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.MenuItemWrapper, {
|
|
186
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.MenuItem, {
|
|
187
|
+
isOpen: openSelectDropDownMenu,
|
|
188
|
+
items: secondaryActions,
|
|
189
|
+
onClickOutside: function onClickOutside() {
|
|
190
|
+
return setOpenSelectDropDownMenu(false);
|
|
191
|
+
},
|
|
192
|
+
top: 25,
|
|
193
|
+
right: -30
|
|
194
|
+
})
|
|
195
|
+
})]
|
|
196
|
+
})]
|
|
197
|
+
})
|
|
198
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
199
|
+
children: [selectable && /*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
|
|
200
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckboxInput.default, {
|
|
201
|
+
onChangeValue: function onChangeValue() {
|
|
202
|
+
return toggleSelectAll();
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
}), header.map(function (label) {
|
|
206
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
|
|
207
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
208
|
+
fontSize: "xxs",
|
|
209
|
+
fontWeight: "600",
|
|
210
|
+
children: label
|
|
211
|
+
})
|
|
212
|
+
}, (0, _GenerateKey.generateKey)());
|
|
213
|
+
})]
|
|
214
|
+
}), !!rowMenuActions && /*#__PURE__*/(0, _jsxRuntime.jsx)("th", {})]
|
|
215
|
+
})
|
|
216
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
|
|
217
|
+
children: rowsWithKey.map(function (row) {
|
|
218
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("tr", {
|
|
219
|
+
tabIndex: selectable ? 0 : undefined,
|
|
220
|
+
"data-selected": selectedRows.includes(row.key),
|
|
221
|
+
children: [selectable && /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
|
|
222
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckboxInput.default, {
|
|
223
|
+
defaultIsChecked: selectedRows.includes(row.key),
|
|
224
|
+
onChangeValue: function onChangeValue(checked) {
|
|
225
|
+
return rowCheckboxHandler(row.key, checked);
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
}), row.item.map(function (cell) {
|
|
229
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
|
|
230
|
+
children: typeof cell === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
231
|
+
fontSize: "xxs",
|
|
232
|
+
fontWeight: "500",
|
|
233
|
+
children: cell
|
|
234
|
+
}) : cell
|
|
235
|
+
}, (0, _GenerateKey.generateKey)());
|
|
236
|
+
}), !!rowMenuActions && /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
|
|
237
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FocusLock.default, {
|
|
238
|
+
isLocked: isMenuOpen.rowId === row.key && isMenuOpen.state,
|
|
239
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.MenuItemWrapper, {
|
|
240
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.VerticalPointsButton, {
|
|
241
|
+
onClick: function onClick() {
|
|
242
|
+
return setIsMenuOpen({
|
|
243
|
+
state: isMenuOpen.rowId === row.key ? !isMenuOpen.state : true,
|
|
244
|
+
rowId: row.key
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
248
|
+
name: "more-vertical",
|
|
249
|
+
color: colorMode === 'dark' ? 'neutral.white' : 'neutral.black'
|
|
250
|
+
})
|
|
251
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.MenuItem, {
|
|
252
|
+
onClickOutside: function onClickOutside() {
|
|
253
|
+
if (isMenuOpen.rowId === row.key) {
|
|
254
|
+
setIsMenuOpen({
|
|
255
|
+
state: false,
|
|
256
|
+
rowId: ''
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
isOpen: isMenuOpen.rowId === row.key && isMenuOpen.state,
|
|
261
|
+
items: rowMenuActions,
|
|
262
|
+
top: 45
|
|
263
|
+
})]
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
})]
|
|
267
|
+
}, row.key);
|
|
268
|
+
})
|
|
269
|
+
})]
|
|
270
|
+
}));
|
|
231
271
|
}
|
|
@@ -8,6 +8,8 @@ require("@testing-library/jest-dom/extend-expect");
|
|
|
8
8
|
|
|
9
9
|
var _ = require(".");
|
|
10
10
|
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
|
|
11
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
14
|
|
|
13
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -15,7 +17,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
15
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
18
|
|
|
17
19
|
var setup = function setup(props) {
|
|
18
|
-
var utils = (0, _testUtils.render)( /*#__PURE__*/
|
|
20
|
+
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Table, _objectSpread({}, props)));
|
|
19
21
|
return _objectSpread({}, utils);
|
|
20
22
|
};
|
|
21
23
|
|
|
@@ -9,6 +9,14 @@ var _react = require("react");
|
|
|
9
9
|
|
|
10
10
|
var _ = require(".");
|
|
11
11
|
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
+
|
|
18
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
|
|
12
20
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
21
|
|
|
14
22
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -34,29 +42,35 @@ var TabsExample = function TabsExample(_ref) {
|
|
|
34
42
|
(0, _react.useEffect)(function () {
|
|
35
43
|
setCurrentTab(props.value);
|
|
36
44
|
}, [props.value]);
|
|
37
|
-
return /*#__PURE__*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
46
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Tabs, _objectSpread(_objectSpread({}, props), {}, {
|
|
47
|
+
onChangeTab: function onChangeTab(value) {
|
|
48
|
+
return setCurrentTab(value);
|
|
49
|
+
},
|
|
50
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
51
|
+
value: 1,
|
|
52
|
+
label: "Item 1"
|
|
53
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
54
|
+
value: 2,
|
|
55
|
+
label: "Item 2"
|
|
56
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
57
|
+
value: 3,
|
|
58
|
+
label: "Item 3"
|
|
59
|
+
})]
|
|
60
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.TabPanel, {
|
|
61
|
+
value: currentTab,
|
|
62
|
+
index: 1,
|
|
63
|
+
children: "Item 1 content"
|
|
64
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.TabPanel, {
|
|
65
|
+
value: currentTab,
|
|
66
|
+
index: 2,
|
|
67
|
+
children: "Item 2 content"
|
|
68
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.TabPanel, {
|
|
69
|
+
value: currentTab,
|
|
70
|
+
index: 3,
|
|
71
|
+
children: "Item 3 content"
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
60
74
|
};
|
|
61
75
|
|
|
62
76
|
exports.TabsExample = TabsExample;
|
|
@@ -11,6 +11,8 @@ var _Tabs = require("./Tabs");
|
|
|
11
11
|
|
|
12
12
|
var _styles = require("../styles");
|
|
13
13
|
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
14
16
|
var Tab = function Tab(_ref) {
|
|
15
17
|
var label = _ref.label,
|
|
16
18
|
value = _ref.value,
|
|
@@ -28,7 +30,7 @@ var Tab = function Tab(_ref) {
|
|
|
28
30
|
textColor = _useContext.textColor,
|
|
29
31
|
isLoading = _useContext.isLoading;
|
|
30
32
|
|
|
31
|
-
return /*#__PURE__*/
|
|
33
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabButton, {
|
|
32
34
|
id: "simple-tab-".concat(value),
|
|
33
35
|
type: "button",
|
|
34
36
|
role: "tab",
|
|
@@ -41,8 +43,15 @@ var Tab = function Tab(_ref) {
|
|
|
41
43
|
disabled: disabled || isLoading,
|
|
42
44
|
fullWidth: fullWidth,
|
|
43
45
|
indicatorColor: indicatorColor,
|
|
44
|
-
textColor: textColor
|
|
45
|
-
|
|
46
|
+
textColor: textColor,
|
|
47
|
+
children: isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabLoadingSkeleton, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
48
|
+
children: [iconPosition === 'left' && icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabButtonIcon, {
|
|
49
|
+
children: icon
|
|
50
|
+
}), label, iconPosition === 'right' && icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabButtonIcon, {
|
|
51
|
+
children: icon
|
|
52
|
+
})]
|
|
53
|
+
})
|
|
54
|
+
});
|
|
46
55
|
};
|
|
47
56
|
|
|
48
57
|
exports.Tab = Tab;
|
|
@@ -7,16 +7,21 @@ exports.TabPanel = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _styles = require("../styles");
|
|
9
9
|
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
|
|
10
12
|
var TabPanel = function TabPanel(_ref) {
|
|
11
13
|
var children = _ref.children,
|
|
12
14
|
index = _ref.index,
|
|
13
15
|
value = _ref.value;
|
|
14
|
-
return /*#__PURE__*/
|
|
16
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabPanelContainer, {
|
|
15
17
|
id: "simple-tabpanel-".concat(index),
|
|
16
18
|
hidden: Number(value) !== Number(index),
|
|
17
19
|
role: "tabpanel",
|
|
18
|
-
"aria-labelledby": "simple-tabpanel-".concat(index)
|
|
19
|
-
|
|
20
|
+
"aria-labelledby": "simple-tabpanel-".concat(index),
|
|
21
|
+
children: Number(value) === Number(index) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabPanelWrapper, {
|
|
22
|
+
children: children
|
|
23
|
+
})
|
|
24
|
+
});
|
|
20
25
|
};
|
|
21
26
|
|
|
22
27
|
exports.TabPanel = TabPanel;
|
|
@@ -11,11 +11,17 @@ var _Flex = _interopRequireDefault(require("../../Flex"));
|
|
|
11
11
|
|
|
12
12
|
var _styles = require("../styles");
|
|
13
13
|
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
14
16
|
var _excluded = ["children", "direction", "centered", "onChangeTab", "value", "fullWidth", "indicatorColor", "textColor", "isLoading"];
|
|
15
17
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
|
-
function
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
|
|
24
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
25
|
|
|
20
26
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
27
|
|
|
@@ -90,30 +96,34 @@ var Tabs = function Tabs(_ref) {
|
|
|
90
96
|
setIndicatorLeft(activeTabRef.current.offsetLeft);
|
|
91
97
|
}
|
|
92
98
|
}, [value]);
|
|
93
|
-
return /*#__PURE__*/
|
|
94
|
-
indicatorColor: indicatorColor
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.TabsContainer, {
|
|
100
|
+
indicatorColor: indicatorColor,
|
|
101
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Flex.default, _objectSpread(_objectSpread({
|
|
102
|
+
direction: direction || 'row',
|
|
103
|
+
justifyContent: centered ? 'center' : 'flex-start',
|
|
104
|
+
role: "tablist"
|
|
105
|
+
}, rest), {}, {
|
|
106
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TabsContext.Provider, {
|
|
107
|
+
value: {
|
|
108
|
+
activeTabRef: activeTabRef,
|
|
109
|
+
activeTab: activeTab,
|
|
110
|
+
changeTab: handleChangeTab,
|
|
111
|
+
textColor: textColor,
|
|
112
|
+
indicatorColor: indicatorColor,
|
|
113
|
+
indicatorWidth: indicatorWidth,
|
|
114
|
+
indicatorLeft: indicatorLeft,
|
|
115
|
+
fullWidth: fullWidth,
|
|
116
|
+
isLoading: isLoading
|
|
117
|
+
},
|
|
118
|
+
children: children
|
|
119
|
+
})
|
|
120
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabIndicator, {
|
|
121
|
+
isLoading: isLoading,
|
|
105
122
|
indicatorColor: indicatorColor,
|
|
106
123
|
indicatorWidth: indicatorWidth,
|
|
107
|
-
indicatorLeft: indicatorLeft
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
}, children)), /*#__PURE__*/React.createElement(_styles.TabIndicator, {
|
|
112
|
-
isLoading: isLoading,
|
|
113
|
-
indicatorColor: indicatorColor,
|
|
114
|
-
indicatorWidth: indicatorWidth,
|
|
115
|
-
indicatorLeft: indicatorLeft
|
|
116
|
-
}));
|
|
124
|
+
indicatorLeft: indicatorLeft
|
|
125
|
+
})]
|
|
126
|
+
});
|
|
117
127
|
};
|
|
118
128
|
|
|
119
129
|
exports.Tabs = Tabs;
|