@pedidopago/ui 1.7.26 → 1.8.0
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 +1 -85
- package/dist/components/Alert/index.js +1 -63
- package/dist/components/Alert/styles.js +1 -32
- package/dist/components/Avatar/avatar.test.js +1 -67
- package/dist/components/Avatar/index.js +1 -94
- package/dist/components/Avatar/styles.js +1 -51
- package/dist/components/Badge/badge.test.js +1 -71
- package/dist/components/Badge/index.js +2 -43
- package/dist/components/Badge/styles.js +1 -33
- package/dist/components/Button/Button.test.js +1 -154
- package/dist/components/Button/index.js +1 -87
- package/dist/components/Button/styles.js +1 -112
- package/dist/components/Card/card.test.js +1 -30
- package/dist/components/Card/index.js +1 -44
- package/dist/components/Card/styles.js +1 -16
- package/dist/components/CheckboxInput/checkbox-input.test.js +1 -170
- package/dist/components/CheckboxInput/components/MultipleCheckbox.js +1 -205
- package/dist/components/CheckboxInput/index.js +1 -94
- package/dist/components/CheckboxInput/styles.js +1 -34
- package/dist/components/ChoiceList/index.d.ts +6 -0
- package/dist/components/ChoiceList/index.d.ts.map +1 -0
- package/dist/components/ChoiceList/index.js +1 -0
- package/dist/components/ChoiceList/styles.d.ts +22 -0
- package/dist/components/ChoiceList/styles.d.ts.map +1 -0
- package/dist/components/ChoiceList/styles.js +1 -0
- package/dist/components/ChoiceList/types.d.ts +24 -0
- package/dist/components/ChoiceList/types.d.ts.map +1 -0
- package/dist/components/ChoiceList/types.js +1 -0
- package/dist/components/CollapseCard/ExpandButton/index.js +1 -40
- package/dist/components/CollapseCard/ExpandButton/styles.js +1 -16
- package/dist/components/CollapseCard/expand-button.test.js +1 -161
- package/dist/components/CollapseCard/index.js +1 -98
- package/dist/components/CollapseCard/styles.js +1 -26
- package/dist/components/ColorPicker/colorpicker.test.js +1 -64
- package/dist/components/ColorPicker/components/ColorHue.js +1 -44
- package/dist/components/ColorPicker/components/ColorInput.js +1 -63
- package/dist/components/ColorPicker/components/ColorPickerBox.js +1 -52
- package/dist/components/ColorPicker/components/ColorPointer.js +1 -25
- package/dist/components/ColorPicker/components/ColorSelector.js +1 -107
- package/dist/components/ColorPicker/hooks/useCachedCallback.js +1 -16
- package/dist/components/ColorPicker/hooks/useHsva.js +1 -53
- package/dist/components/ColorPicker/index.js +1 -93
- package/dist/components/ColorPicker/styles.js +1 -46
- package/dist/components/ColorPicker/utils/checkers.js +1 -55
- package/dist/components/ColorPicker/utils/conversors.js +2 -243
- package/dist/components/ColorPicker/utils/parsers.js +10 -108
- package/dist/components/ComposeIcon/index.js +2 -48
- package/dist/components/ComposeIcon/styles.js +1 -53
- package/dist/components/DateInput/DateInput-example.js +7 -45
- package/dist/components/DateInput/components/ModalWrapper/index.js +1 -35
- package/dist/components/DateInput/components/ModalWrapper/styles.js +1 -21
- package/dist/components/DateInput/dateInput.test.js +2 -43
- package/dist/components/DateInput/index.js +2 -104
- package/dist/components/DateInput/styles.js +1 -18
- package/dist/components/DatePicker/components/DatePickerContent.js +2 -222
- package/dist/components/DatePicker/components/DateYearPicker.js +1 -102
- package/dist/components/DatePicker/datepicker.test.js +1 -120
- package/dist/components/DatePicker/index.js +1 -236
- package/dist/components/DatePicker/styles.js +1 -88
- package/dist/components/DatePicker/utils/getMonthName.js +1 -11
- package/dist/components/Dialog/dialog-example.js +1 -46
- package/dist/components/Dialog/dialog.test.js +1 -68
- package/dist/components/Dialog/index.js +2 -100
- package/dist/components/Dialog/styles.js +1 -31
- package/dist/components/Dropzone/dropzone.test.js +1 -69
- package/dist/components/Dropzone/index.js +1 -289
- package/dist/components/Dropzone/styles.js +1 -75
- package/dist/components/Dropzone/utils/accepts.js +2 -27
- package/dist/components/EmojiPicker/Emote/index.js +2 -24
- package/dist/components/EmojiPicker/Emote/styles.js +1 -27
- package/dist/components/EmojiPicker/EmotePickerData/constants.js +1 -51
- package/dist/components/EmojiPicker/EmotePickerData/index.js +2 -159
- package/dist/components/EmojiPicker/EmotePickerData/styles.js +1 -57
- package/dist/components/EmojiPicker/EmotePickerData/utils.js +1 -41
- package/dist/components/EmojiPicker/Example/EmotePickerExample.js +1 -43
- package/dist/components/EmojiPicker/animation.js +1 -43
- package/dist/components/EmojiPicker/index.js +1 -169
- package/dist/components/EmojiPicker/styles.js +1 -21
- package/dist/components/Flex/flex.test.js +1 -336
- package/dist/components/Flex/index.js +1 -49
- package/dist/components/Flex/styles.js +1 -25
- package/dist/components/Grid/grid.test.js +1 -134
- package/dist/components/Grid/index.js +1 -51
- package/dist/components/Grid/styles.js +1 -48
- package/dist/components/Icon/data/beauty.js +2 -206
- package/dist/components/Icon/data/dash.js +2 -2
- package/dist/components/Icon/data/ecommerce.js +2 -94
- package/dist/components/Icon/data/form.js +2 -248
- package/dist/components/Icon/data/health.js +2 -255
- package/dist/components/Icon/data/illustrations.js +2 -318
- package/dist/components/Icon/data/men.js +2 -52
- package/dist/components/Icon/data/payment.js +2 -94
- package/dist/components/Icon/data/pedidoPago.js +2 -45
- package/dist/components/Icon/data/physicalPerfomance.js +2 -283
- package/dist/components/Icon/data/social.js +2 -24
- package/dist/components/Icon/data/status.js +2 -115
- package/dist/components/Icon/data/summer.js +2 -52
- package/dist/components/Icon/data/woman.js +2 -80
- package/dist/components/Icon/icon.test.js +1 -57
- package/dist/components/Icon/index.js +1 -53
- package/dist/components/Icon/scripts/build.js +9 -104
- package/dist/components/Icon/scripts/extractor.js +2 -33
- package/dist/components/Icon/scripts/run-build.js +2 -7
- package/dist/components/Icon/scripts/writers.js +3 -34
- package/dist/components/Icon/styles.js +1 -22
- package/dist/components/Icon/utils/allIcons.js +1 -28
- package/dist/components/Icon/utils/iconExists.js +1 -13
- package/dist/components/IconItem/IconItem.test.js +1 -58
- package/dist/components/IconItem/index.js +1 -52
- package/dist/components/IconItem/styles.js +1 -43
- package/dist/components/Illustration/illustration.test.js +4 -50
- package/dist/components/Illustration/index.js +2 -65
- package/dist/components/Illustration/styles.js +1 -65
- package/dist/components/ImageItem/imageFake.js +1 -25
- package/dist/components/ImageItem/index.js +2 -66
- package/dist/components/ImageItem/input.test.js +1 -85
- package/dist/components/ImageItem/styles.js +1 -61
- package/dist/components/Input/index.js +1 -163
- package/dist/components/Input/input.test.js +1 -120
- package/dist/components/Input/styles.js +1 -177
- package/dist/components/Label/index.js +1 -45
- package/dist/components/Label/label.test.js +1 -83
- package/dist/components/Label/styles.js +1 -21
- package/dist/components/List/index.js +1 -39
- package/dist/components/List/list.test.js +1 -64
- package/dist/components/List/styles.js +1 -23
- package/dist/components/Modal/ModalExample.js +1 -70
- package/dist/components/Modal/index.js +1 -145
- package/dist/components/Modal/modal.test.js +1 -179
- package/dist/components/Modal/styles.js +1 -33
- package/dist/components/MultipleSelect/MultipleSelect.test.js +1 -334
- package/dist/components/MultipleSelect/animations.js +1 -25
- package/dist/components/MultipleSelect/components/InputWrapper/index.js +1 -26
- package/dist/components/MultipleSelect/components/OptionsArea/index.js +1 -244
- package/dist/components/MultipleSelect/components/OptionsArea/styles.js +1 -68
- package/dist/components/MultipleSelect/components/SelectArea/ButtonsArea.js +1 -27
- package/dist/components/MultipleSelect/components/SelectArea/SelectAreaWrapper.js +1 -37
- package/dist/components/MultipleSelect/components/SelectArea/SelectedOptionsArea.js +1 -49
- package/dist/components/MultipleSelect/components/SelectArea/index.js +1 -100
- package/dist/components/MultipleSelect/components/SelectArea/styles.js +1 -36
- package/dist/components/MultipleSelect/components/index.js +1 -38
- package/dist/components/MultipleSelect/index.js +1 -209
- package/dist/components/NewSelect/Examples/constants.js +1 -56
- package/dist/components/NewSelect/Examples/index.js +1 -161
- package/dist/components/NewSelect/components/Chip/index.js +1 -36
- package/dist/components/NewSelect/components/Chip/styles.js +1 -24
- package/dist/components/NewSelect/components/OptionsSelect/styles.js +1 -21
- package/dist/components/NewSelect/components/SelectInputSearch/index.js +1 -24
- package/dist/components/NewSelect/components/SelectItem/index.js +1 -22
- package/dist/components/NewSelect/components/SelectItem/styles.js +1 -24
- package/dist/components/NewSelect/index.js +1 -18
- package/dist/components/NewSelect/multiple/index.js +1 -246
- package/dist/components/NewSelect/newSelect.test.js +1 -108
- package/dist/components/NewSelect/single/index.js +1 -183
- package/dist/components/NewSelect/styles.js +1 -44
- package/dist/components/Observer/index.js +1 -59
- package/dist/components/Observer/observer.test.js +2 -43
- package/dist/components/Pagination/hooks/usePagination.js +1 -57
- package/dist/components/Pagination/index.js +1 -174
- package/dist/components/Pagination/pagination.test.js +1 -118
- package/dist/components/Pagination/styles.js +1 -78
- package/dist/components/Progress/Circle/index.js +1 -102
- package/dist/components/Progress/Circle/styles.js +1 -69
- package/dist/components/Progress/Linear/index.js +1 -62
- package/dist/components/Progress/Linear/styles.js +1 -66
- package/dist/components/Progress/getSteps.js +1 -17
- package/dist/components/Progress/index.js +1 -39
- package/dist/components/Progress/progress.test.js +1 -109
- package/dist/components/Radio/components/RadioGroup/index.d.ts +5 -0
- package/dist/components/Radio/components/RadioGroup/index.d.ts.map +1 -0
- package/dist/components/Radio/components/RadioGroup/index.js +1 -0
- package/dist/components/Radio/components/RadioGroup/styles.d.ts +19 -0
- package/dist/components/Radio/components/RadioGroup/styles.d.ts.map +1 -0
- package/dist/components/Radio/components/RadioGroup/styles.js +1 -0
- package/dist/components/Radio/components/RadioGroup/types.d.ts +17 -0
- package/dist/components/Radio/components/RadioGroup/types.d.ts.map +1 -0
- package/dist/components/Radio/components/RadioGroup/types.js +1 -0
- package/dist/components/Radio/index.d.ts +5 -0
- package/dist/components/Radio/index.d.ts.map +1 -0
- package/dist/components/Radio/index.js +1 -0
- package/dist/components/Radio/styles.d.ts +10 -0
- package/dist/components/Radio/styles.d.ts.map +1 -0
- package/dist/components/Radio/styles.js +1 -0
- package/dist/components/Radio/types.d.ts +6 -0
- package/dist/components/Radio/types.d.ts.map +1 -0
- package/dist/components/Radio/types.js +1 -0
- package/dist/components/Rating/index.js +1 -133
- package/dist/components/Rating/rating.test.js +1 -63
- package/dist/components/Rating/styles.js +1 -27
- package/dist/components/ReactPortal/index.js +1 -43
- package/dist/components/ReactPortal/reactPortal.test.js +1 -21
- package/dist/components/ReactPortal/utils/createWrapperAndApprendToBody.js +1 -12
- package/dist/components/Select/components/OptionsSelect/index.js +1 -73
- package/dist/components/Select/components/OptionsSelect/styles.js +1 -21
- package/dist/components/Select/index.js +4 -247
- package/dist/components/Select/select.test.js +1 -58
- package/dist/components/Select/styles.js +1 -46
- package/dist/components/Skeleton/index.js +1 -28
- package/dist/components/Skeleton/skeleton.test.js +1 -90
- package/dist/components/Skeleton/styles.js +1 -27
- package/dist/components/Slider/SliderExample.js +1 -52
- package/dist/components/Slider/components/SliderPointer.js +1 -39
- package/dist/components/Slider/components/SliderRail.js +1 -116
- package/dist/components/Slider/components/SliderSelector.js +1 -173
- package/dist/components/Slider/hooks/useEventCallback.js +1 -16
- package/dist/components/Slider/index.js +1 -137
- package/dist/components/Slider/slider.test.js +1 -121
- package/dist/components/Slider/styles.js +1 -69
- package/dist/components/Spinner/index.js +1 -26
- package/dist/components/Spinner/spinner.test.js +1 -45
- package/dist/components/Spinner/styles.js +1 -23
- package/dist/components/Steps/components/StepIcon/index.js +1 -50
- package/dist/components/Steps/components/StepIcon/styles.js +1 -42
- package/dist/components/Steps/components/StepIcon/utils.js +1 -22
- package/dist/components/Steps/index.js +1 -116
- package/dist/components/Steps/steps.test.js +1 -53
- package/dist/components/Steps/styles.js +1 -96
- package/dist/components/Steps/utils.js +1 -15
- package/dist/components/Switch/index.js +1 -73
- package/dist/components/Switch/styles.js +1 -58
- package/dist/components/Switch/switch.test.js +2 -115
- package/dist/components/Table/components/MenuItem.js +1 -59
- package/dist/components/Table/components/TableSkeleton.js +1 -39
- package/dist/components/Table/components/animations.js +1 -24
- package/dist/components/Table/index.js +2 -253
- package/dist/components/Table/styles.js +1 -49
- package/dist/components/Table/table.test.js +1 -114
- package/dist/components/Tabs/TabsExample.js +1 -64
- package/dist/components/Tabs/components/Tab.js +1 -49
- package/dist/components/Tabs/components/TabPanel.js +1 -25
- package/dist/components/Tabs/components/Tabs.js +1 -107
- package/dist/components/Tabs/index.js +1 -26
- package/dist/components/Tabs/styles.js +1 -61
- package/dist/components/Tabs/tabs.test.js +1 -146
- package/dist/components/Tag/index.js +1 -53
- package/dist/components/Tag/styles.js +1 -34
- package/dist/components/Tag/tag.test.js +1 -64
- package/dist/components/TextAreaInput/index.js +1 -74
- package/dist/components/TextAreaInput/styles.js +1 -53
- package/dist/components/TextAreaInput/text-area-input.test.js +1 -81
- package/dist/components/Thumbnail/index.js +1 -125
- package/dist/components/Thumbnail/styles.js +1 -47
- package/dist/components/Thumbnail/thumbnail.test.js +1 -66
- package/dist/components/Thumbnail/utils/index.js +1 -27
- package/dist/components/Thumbnail/utils/validate-file-size.js +1 -10
- package/dist/components/Thumbnail/utils/validate-file-type.js +1 -9
- package/dist/components/TimeInput/constants.js +1 -29
- package/dist/components/TimeInput/index.js +1 -288
- package/dist/components/TimeInput/styles.js +1 -34
- package/dist/components/TimeInput/utils.js +1 -94
- package/dist/components/Timeline/components/Timeline.js +1 -17
- package/dist/components/Timeline/components/TimelineContent.js +1 -61
- package/dist/components/Timeline/components/TimelineItem.js +1 -25
- package/dist/components/Timeline/components/TimelineSeparator.js +1 -20
- package/dist/components/Timeline/index.js +1 -33
- package/dist/components/Timeline/styles.js +1 -37
- package/dist/components/Timeline/timeline.test.js +1 -138
- package/dist/components/Toast/button-example.js +1 -31
- package/dist/components/Toast/components/Toast.js +1 -79
- package/dist/components/Toast/contexts/ToastProvider.js +1 -72
- package/dist/components/Toast/hooks/useToast.js +1 -18
- package/dist/components/Toast/index.js +1 -111
- package/dist/components/Toast/styles.js +1 -36
- package/dist/components/Toast/toast.test.js +1 -129
- package/dist/components/Tooltip/components/TooltipLabel.js +1 -71
- package/dist/components/Tooltip/example.js +1 -27
- package/dist/components/Tooltip/index.js +1 -187
- package/dist/components/Tooltip/styles.js +1 -20
- package/dist/components/Typography/index.js +1 -37
- package/dist/components/Typography/styles.js +1 -15
- package/dist/components/Typography/typography.test.js +1 -288
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -548
- package/dist/shared/animations/opacityAnimation.js +1 -21
- package/dist/shared/assets/emotes.js +1 -1
- package/dist/shared/components/FocusLock/index.js +5 -86
- package/dist/shared/formatters/format-number.js +5 -41
- package/dist/shared/global.js +1 -8
- package/dist/shared/hooks/devices.js +1 -14
- package/dist/shared/hooks/useBreakpoints.js +2 -95
- package/dist/shared/hooks/useDebounce.js +1 -35
- package/dist/shared/hooks/useDevices.js +2 -42
- package/dist/shared/hooks/useDisableBodyScroll.js +5 -52
- package/dist/shared/hooks/useDraggableScroll/index.js +5 -65
- package/dist/shared/hooks/useKeyPress.js +1 -18
- package/dist/shared/hooks/useObserver.js +2 -29
- package/dist/shared/hooks/useOnClickOutside.js +1 -30
- package/dist/shared/hooks/useReposition/index.js +2 -53
- package/dist/shared/hooks/useSystemTheme.js +1 -38
- package/dist/shared/hooks/useWindowSize.js +1 -36
- package/dist/shared/tests/test-utils.js +1 -31
- package/dist/shared/theme/button-example.js +1 -31
- package/dist/shared/theme/contexts/ThemeContext.js +1 -90
- package/dist/shared/theme/hooks/useColorMode.js +1 -18
- package/dist/shared/theme/hooks/useColorModeValue.js +1 -13
- package/dist/shared/theme/hooks/useTheme.js +1 -17
- package/dist/shared/theme/index.js +1 -67
- package/dist/shared/theme/objects/breakpoints.js +1 -15
- package/dist/shared/theme/objects/colors.js +1 -177
- package/dist/shared/theme/objects/shadows.js +1 -19
- package/dist/shared/theme/objects/sizes.js +6 -33
- package/dist/shared/theme/objects/spaces.js +1 -75
- package/dist/shared/theme/objects/transitions.js +1 -10
- package/dist/shared/theme/objects/typography.js +1 -20
- package/dist/shared/theme/objects/z-indexes.js +1 -20
- package/dist/shared/theme/theme.js +1 -36
- package/dist/shared/theme/theme.test.js +1 -94
- package/dist/shared/theme/utils/extendTheme.js +1 -25
- package/dist/shared/theme/utils/localStorageController.js +1 -21
- package/dist/styled.d.js +1 -3
- package/dist/utils/GenerateKey.js +3 -18
- package/dist/utils/brightnessColorChange.js +2 -17
- package/dist/utils/colorCheck.js +6 -64
- package/dist/utils/colorFunctions.js +1 -39
- package/dist/utils/colorToGray.js +2 -64
- package/dist/utils/customColorMode.js +1 -11
- package/dist/utils/file.js +5 -124
- package/dist/utils/formatters/bytes.js +2 -17
- package/dist/utils/formatters/capitalize.js +2 -11
- package/dist/utils/formatters/cep.js +3 -18
- package/dist/utils/formatters/cnpj.js +4 -38
- package/dist/utils/formatters/color.js +12 -101
- package/dist/utils/formatters/cpf.js +16 -85
- package/dist/utils/formatters/credit-card.js +5 -54
- package/dist/utils/formatters/email.js +1 -8
- package/dist/utils/formatters/index.js +1 -170
- package/dist/utils/formatters/name.js +4 -31
- package/dist/utils/formatters/number.js +5 -14
- package/dist/utils/formatters/passport.js +5 -33
- package/dist/utils/formatters/phone.js +17 -214
- package/dist/utils/formatters/price.js +3 -21
- package/dist/utils/formatters/rg.js +3 -18
- package/dist/utils/formatters/strings.js +4 -27
- package/dist/utils/fuctionsColors.js +1 -39
- package/dist/utils/generateUUID.js +1 -13
- package/dist/utils/getColorValue.js +2 -23
- package/dist/utils/getSvg.js +1 -17
- package/dist/utils/getValuesBySize.js +1 -9
- package/dist/utils/invertColor.js +4 -40
- package/package.json +2 -1
|
@@ -1,64 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.TabsExample = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _ = require(".");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
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
|
-
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; }
|
|
13
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
-
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."); }
|
|
18
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
19
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
20
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
21
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
-
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
23
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
24
|
-
var TabsExample = function TabsExample(_ref) {
|
|
25
|
-
var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
26
|
-
var _useState = (0, _react.useState)(props.value),
|
|
27
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
-
currentTab = _useState2[0],
|
|
29
|
-
setCurrentTab = _useState2[1];
|
|
30
|
-
(0, _react.useEffect)(function () {
|
|
31
|
-
setCurrentTab(props.value);
|
|
32
|
-
}, [props.value]);
|
|
33
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
34
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Tabs, _objectSpread(_objectSpread({}, props), {}, {
|
|
35
|
-
onChangeTab: function onChangeTab(value) {
|
|
36
|
-
return setCurrentTab(value);
|
|
37
|
-
},
|
|
38
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
39
|
-
value: 1,
|
|
40
|
-
label: "Item 1"
|
|
41
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
42
|
-
value: 2,
|
|
43
|
-
label: "Item 2"
|
|
44
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
45
|
-
value: 3,
|
|
46
|
-
label: "Item 3"
|
|
47
|
-
})]
|
|
48
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.TabPanel, {
|
|
49
|
-
value: currentTab,
|
|
50
|
-
index: 1,
|
|
51
|
-
children: "Item 1 content"
|
|
52
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.TabPanel, {
|
|
53
|
-
value: currentTab,
|
|
54
|
-
index: 2,
|
|
55
|
-
noPadding: true,
|
|
56
|
-
children: "Item 2 content"
|
|
57
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.TabPanel, {
|
|
58
|
-
value: currentTab,
|
|
59
|
-
index: 3,
|
|
60
|
-
children: "Item 3 content"
|
|
61
|
-
})]
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
exports.TabsExample = TabsExample;
|
|
1
|
+
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.TabsExample=void 0;var _react=require("react"),_=require("."),_jsxRuntime=require("react/jsx-runtime");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}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)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}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}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.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectDestructuringEmpty(obj){if(null==obj)throw new TypeError("Cannot destructure "+obj)}function _extends(){return _extends=Object.assign?Object.assign.bind():function(target){for(var source,i=1;i<arguments.length;i++)for(var key in source=arguments[i],source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);return target},_extends.apply(this,arguments)}var TabsExample=function(_ref){var props=_extends({},(_objectDestructuringEmpty(_ref),_ref)),_useState=(0,_react.useState)(props.value),_useState2=_slicedToArray(_useState,2),currentTab=_useState2[0],setCurrentTab=_useState2[1];return(0,_react.useEffect)(function(){setCurrentTab(props.value)},[props.value]),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.Tabs,_objectSpread(_objectSpread({},props),{},{onChangeTab:function onChangeTab(value){return setCurrentTab(value)},children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{value:1,label:"Item 1"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{value:2,label:"Item 2"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{value:3,label:"Item 3"})]})),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.TabPanel,{value:currentTab,index:1,children:"Item 1 content"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.TabPanel,{value:currentTab,index:2,noPadding:!0,children:"Item 2 content"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.TabPanel,{value:currentTab,index:3,children:"Item 3 content"})]})};exports.TabsExample=TabsExample;
|
|
@@ -1,49 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Tab = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _Tabs = require("./Tabs");
|
|
9
|
-
var _styles = require("../styles");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
var Tab = function Tab(_ref) {
|
|
12
|
-
var label = _ref.label,
|
|
13
|
-
value = _ref.value,
|
|
14
|
-
icon = _ref.icon,
|
|
15
|
-
_ref$iconPosition = _ref.iconPosition,
|
|
16
|
-
iconPosition = _ref$iconPosition === void 0 ? 'left' : _ref$iconPosition,
|
|
17
|
-
disabled = _ref.disabled;
|
|
18
|
-
var _useContext = (0, _react.useContext)(_Tabs.TabsContext),
|
|
19
|
-
activeTabRef = _useContext.activeTabRef,
|
|
20
|
-
activeTab = _useContext.activeTab,
|
|
21
|
-
changeTab = _useContext.changeTab,
|
|
22
|
-
squeeze = _useContext.squeeze,
|
|
23
|
-
indicatorColor = _useContext.indicatorColor,
|
|
24
|
-
textColor = _useContext.textColor,
|
|
25
|
-
isLoading = _useContext.isLoading;
|
|
26
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabButton, {
|
|
27
|
-
id: "simple-tab-".concat(value),
|
|
28
|
-
type: "button",
|
|
29
|
-
role: "tab",
|
|
30
|
-
ref: activeTab === Number(value) ? activeTabRef : undefined,
|
|
31
|
-
active: activeTab === Number(value),
|
|
32
|
-
tabIndex: activeTab === Number(value) ? 0 : -1,
|
|
33
|
-
onClick: function onClick(event) {
|
|
34
|
-
return changeTab(event, Number(value));
|
|
35
|
-
},
|
|
36
|
-
disabled: disabled || isLoading,
|
|
37
|
-
squeeze: squeeze,
|
|
38
|
-
indicatorColor: indicatorColor,
|
|
39
|
-
textColor: textColor,
|
|
40
|
-
children: isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabLoadingSkeleton, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
41
|
-
children: [iconPosition === 'left' && icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabButtonIcon, {
|
|
42
|
-
children: icon
|
|
43
|
-
}), label, iconPosition === 'right' && icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabButtonIcon, {
|
|
44
|
-
children: icon
|
|
45
|
-
})]
|
|
46
|
-
})
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
exports.Tab = Tab;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Tab=void 0;var _react=require("react"),_Tabs=require("./Tabs"),_styles=require("../styles"),_jsxRuntime=require("react/jsx-runtime"),Tab=function(_ref){var label=_ref.label,value=_ref.value,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=void 0===_ref$iconPosition?"left":_ref$iconPosition,disabled=_ref.disabled,_useContext=(0,_react.useContext)(_Tabs.TabsContext),activeTabRef=_useContext.activeTabRef,activeTab=_useContext.activeTab,changeTab=_useContext.changeTab,squeeze=_useContext.squeeze,indicatorColor=_useContext.indicatorColor,textColor=_useContext.textColor,isLoading=_useContext.isLoading;return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.TabButton,{id:"simple-tab-".concat(value),type:"button",role:"tab",ref:activeTab===+value?activeTabRef:void 0,active:activeTab===+value,tabIndex:activeTab===+value?0:-1,onClick:function onClick(event){return changeTab(event,+value)},disabled:disabled||isLoading,squeeze:squeeze,indicatorColor:indicatorColor,textColor:textColor,children:isLoading?/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.TabLoadingSkeleton,{}):/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:["left"===iconPosition&&icon&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.TabButtonIcon,{children:icon}),label,"right"===iconPosition&&icon&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.TabButtonIcon,{children:icon})]})})};exports.Tab=Tab;
|
|
@@ -1,25 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TabPanel = void 0;
|
|
7
|
-
var _styles = require("../styles");
|
|
8
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
-
var TabPanel = function TabPanel(_ref) {
|
|
10
|
-
var children = _ref.children,
|
|
11
|
-
index = _ref.index,
|
|
12
|
-
value = _ref.value,
|
|
13
|
-
noPadding = _ref.noPadding;
|
|
14
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabPanelContainer, {
|
|
15
|
-
id: "simple-tabpanel-".concat(index),
|
|
16
|
-
hidden: Number(value) !== Number(index),
|
|
17
|
-
role: "tabpanel",
|
|
18
|
-
"aria-labelledby": "simple-tabpanel-".concat(index),
|
|
19
|
-
children: Number(value) === Number(index) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabPanelWrapper, {
|
|
20
|
-
noPadding: noPadding,
|
|
21
|
-
children: children
|
|
22
|
-
})
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
exports.TabPanel = TabPanel;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TabPanel=void 0;var _styles=require("../styles"),_jsxRuntime=require("react/jsx-runtime"),TabPanel=function(_ref){var children=_ref.children,index=_ref.index,value=_ref.value,noPadding=_ref.noPadding;return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.TabPanelContainer,{id:"simple-tabpanel-".concat(index),hidden:+value!==+index,role:"tabpanel","aria-labelledby":"simple-tabpanel-".concat(index),children:+value===+index&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.TabPanelWrapper,{noPadding:noPadding,children:children})})};exports.TabPanel=TabPanel;
|
|
@@ -1,107 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.TabsContext = exports.Tabs = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _Flex = _interopRequireDefault(require("../../Flex"));
|
|
10
|
-
var _styles = require("../styles");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
var _excluded = ["children", "direction", "centered", "onChangeTab", "value", "fullWidth", "indicatorColor", "textColor", "isLoading", "squeeze"];
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
|
-
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; }
|
|
16
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
|
-
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."); }
|
|
21
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
22
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
23
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
24
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
26
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
27
|
-
var TabsContext = /*#__PURE__*/(0, _react.createContext)({
|
|
28
|
-
activeTabRef: undefined,
|
|
29
|
-
activeTab: 0,
|
|
30
|
-
changeTab: function changeTab() {},
|
|
31
|
-
indicatorWidth: 0,
|
|
32
|
-
indicatorLeft: 0,
|
|
33
|
-
indicatorColor: 'primary.default',
|
|
34
|
-
textColor: 'primary.default',
|
|
35
|
-
isLoading: false,
|
|
36
|
-
squeeze: false
|
|
37
|
-
});
|
|
38
|
-
exports.TabsContext = TabsContext;
|
|
39
|
-
var Tabs = function Tabs(_ref) {
|
|
40
|
-
var children = _ref.children,
|
|
41
|
-
direction = _ref.direction,
|
|
42
|
-
centered = _ref.centered,
|
|
43
|
-
onChangeTab = _ref.onChangeTab,
|
|
44
|
-
value = _ref.value,
|
|
45
|
-
fullWidth = _ref.fullWidth,
|
|
46
|
-
indicatorColor = _ref.indicatorColor,
|
|
47
|
-
textColor = _ref.textColor,
|
|
48
|
-
isLoading = _ref.isLoading,
|
|
49
|
-
squeeze = _ref.squeeze,
|
|
50
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
51
|
-
var activeTabRef = /*#__PURE__*/(0, _react.createRef)();
|
|
52
|
-
var _useState = (0, _react.useState)(Number(value) || 0),
|
|
53
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
54
|
-
activeTab = _useState2[0],
|
|
55
|
-
setActiveTab = _useState2[1];
|
|
56
|
-
var _useState3 = (0, _react.useState)(0),
|
|
57
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
58
|
-
indicatorWidth = _useState4[0],
|
|
59
|
-
setIndicatorWidth = _useState4[1];
|
|
60
|
-
var _useState5 = (0, _react.useState)(0),
|
|
61
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
62
|
-
indicatorLeft = _useState6[0],
|
|
63
|
-
setIndicatorLeft = _useState6[1];
|
|
64
|
-
function handleChangeTab(event, value) {
|
|
65
|
-
setActiveTab(value);
|
|
66
|
-
setIndicatorWidth(event.currentTarget.offsetWidth);
|
|
67
|
-
setIndicatorLeft(event.currentTarget.offsetLeft);
|
|
68
|
-
onChangeTab && onChangeTab(value);
|
|
69
|
-
}
|
|
70
|
-
(0, _react.useEffect)(function () {
|
|
71
|
-
setActiveTab(Number(value) || 0);
|
|
72
|
-
if (activeTabRef !== null && activeTabRef !== void 0 && activeTabRef.current) {
|
|
73
|
-
setIndicatorWidth(activeTabRef.current.offsetWidth);
|
|
74
|
-
setIndicatorLeft(activeTabRef.current.offsetLeft);
|
|
75
|
-
}
|
|
76
|
-
}, [value, activeTabRef]);
|
|
77
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.TabsContainer, {
|
|
78
|
-
fullWidth: fullWidth || squeeze,
|
|
79
|
-
indicatorColor: indicatorColor,
|
|
80
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Flex.default, _objectSpread(_objectSpread({
|
|
81
|
-
direction: direction || 'row',
|
|
82
|
-
justifyContent: centered ? 'center' : 'flex-start',
|
|
83
|
-
role: "tablist"
|
|
84
|
-
}, rest), {}, {
|
|
85
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TabsContext.Provider, {
|
|
86
|
-
value: {
|
|
87
|
-
activeTabRef: activeTabRef,
|
|
88
|
-
activeTab: activeTab,
|
|
89
|
-
changeTab: handleChangeTab,
|
|
90
|
-
textColor: textColor,
|
|
91
|
-
indicatorColor: indicatorColor,
|
|
92
|
-
indicatorWidth: indicatorWidth,
|
|
93
|
-
indicatorLeft: indicatorLeft,
|
|
94
|
-
isLoading: isLoading,
|
|
95
|
-
squeeze: squeeze
|
|
96
|
-
},
|
|
97
|
-
children: children
|
|
98
|
-
})
|
|
99
|
-
})), direction === 'row' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabIndicator, {
|
|
100
|
-
isLoading: isLoading,
|
|
101
|
-
indicatorColor: indicatorColor,
|
|
102
|
-
indicatorWidth: indicatorWidth,
|
|
103
|
-
indicatorLeft: indicatorLeft
|
|
104
|
-
})]
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
exports.Tabs = Tabs;
|
|
1
|
+
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.TabsContext=exports.Tabs=void 0;var _react=require("react"),_Flex=_interopRequireDefault(require("../../Flex")),_styles=require("../styles"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["children","direction","centered","onChangeTab","value","fullWidth","indicatorColor","textColor","isLoading","squeeze"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}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}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)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}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}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.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}var TabsContext=/*#__PURE__*/(0,_react.createContext)({activeTabRef:void 0,activeTab:0,changeTab:function changeTab(){},indicatorWidth:0,indicatorLeft:0,indicatorColor:"primary.default",textColor:"primary.default",isLoading:!1,squeeze:!1});exports.TabsContext=TabsContext;var Tabs=function(_ref){var children=_ref.children,direction=_ref.direction,centered=_ref.centered,onChangeTab=_ref.onChangeTab,value=_ref.value,fullWidth=_ref.fullWidth,indicatorColor=_ref.indicatorColor,textColor=_ref.textColor,isLoading=_ref.isLoading,squeeze=_ref.squeeze,rest=_objectWithoutProperties(_ref,_excluded),activeTabRef=/*#__PURE__*/(0,_react.createRef)(),_useState=(0,_react.useState)(+value||0),_useState2=_slicedToArray(_useState,2),activeTab=_useState2[0],setActiveTab=_useState2[1],_useState3=(0,_react.useState)(0),_useState4=_slicedToArray(_useState3,2),indicatorWidth=_useState4[0],setIndicatorWidth=_useState4[1],_useState5=(0,_react.useState)(0),_useState6=_slicedToArray(_useState5,2),indicatorLeft=_useState6[0],setIndicatorLeft=_useState6[1];return(0,_react.useEffect)(function(){setActiveTab(+value||0),null!==activeTabRef&&void 0!==activeTabRef&&activeTabRef.current&&(setIndicatorWidth(activeTabRef.current.offsetWidth),setIndicatorLeft(activeTabRef.current.offsetLeft))},[value,activeTabRef]),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.TabsContainer,{fullWidth:fullWidth||squeeze,indicatorColor:indicatorColor,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_Flex.default,_objectSpread(_objectSpread({direction:direction||"row",justifyContent:centered?"center":"flex-start",role:"tablist"},rest),{},{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(TabsContext.Provider,{value:{activeTabRef:activeTabRef,activeTab:activeTab,changeTab:function(event,value){setActiveTab(value),setIndicatorWidth(event.currentTarget.offsetWidth),setIndicatorLeft(event.currentTarget.offsetLeft),onChangeTab&&onChangeTab(value)},textColor:textColor,indicatorColor:indicatorColor,indicatorWidth:indicatorWidth,indicatorLeft:indicatorLeft,isLoading:isLoading,squeeze:squeeze},children:children})})),"row"===direction&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.TabIndicator,{isLoading:isLoading,indicatorColor:indicatorColor,indicatorWidth:indicatorWidth,indicatorLeft:indicatorLeft})]})};exports.Tabs=Tabs;
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Tab", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Tab.Tab;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "TabPanel", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _TabPanel.TabPanel;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "Tabs", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _Tabs.Tabs;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
var _TabPanel = require("./components/TabPanel");
|
|
25
|
-
var _Tabs = require("./components/Tabs");
|
|
26
|
-
var _Tab = require("./components/Tab");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Tab",{enumerable:!0,get:function get(){return _Tab.Tab}}),Object.defineProperty(exports,"TabPanel",{enumerable:!0,get:function get(){return _TabPanel.TabPanel}}),Object.defineProperty(exports,"Tabs",{enumerable:!0,get:function get(){return _Tabs.Tabs}});var _TabPanel=require("./components/TabPanel"),_Tabs=require("./components/Tabs"),_Tab=require("./components/Tab");
|
|
@@ -1,61 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TabsContainer = exports.TabPanelWrapper = exports.TabPanelContainer = exports.TabLoadingSkeleton = exports.TabIndicator = exports.TabButtonIcon = exports.TabButton = void 0;
|
|
7
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
8
|
-
var _getColorValue = require("../../utils/getColorValue");
|
|
9
|
-
var _colorToGray = require("../../utils/colorToGray");
|
|
10
|
-
var _customColorMode = require("../../utils/customColorMode");
|
|
11
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
14
|
-
var TabsContainer = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n\n > div[role='tablist'] {\n width: ", ";\n border-bottom: 2px solid\n ", ";\n }\n"])), function (_ref) {
|
|
15
|
-
var fullWidth = _ref.fullWidth;
|
|
16
|
-
return fullWidth ? '100%' : 'fit-content';
|
|
17
|
-
}, function () {
|
|
18
|
-
return (0, _customColorMode.customColorMode)('rgba(0, 0, 0, 0.2)', 'rgba(255, 255, 255, 0.4)');
|
|
19
|
-
});
|
|
20
|
-
exports.TabsContainer = TabsContainer;
|
|
21
|
-
var TabButton = _styled.default.button(function (_ref2) {
|
|
22
|
-
var squeeze = _ref2.squeeze,
|
|
23
|
-
theme = _ref2.theme,
|
|
24
|
-
active = _ref2.active,
|
|
25
|
-
textColor = _ref2.textColor,
|
|
26
|
-
disabled = _ref2.disabled,
|
|
27
|
-
indicatorColor = _ref2.indicatorColor;
|
|
28
|
-
var colorProps = (0, _colorToGray.convertColor)((0, _getColorValue.getColorValue)(indicatorColor || 'primary.default', theme));
|
|
29
|
-
var grayColor = colorProps.neutral2;
|
|
30
|
-
var whiteColor = colorProps.neutral1;
|
|
31
|
-
return "\n display: flex;\n ".concat(squeeze && 'flex: 1;', "\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 1rem 2rem;\n\n font-family: inherit;\n font-weight: 600;\n font-size: ").concat(theme.fontSizes.xxs, ";\n\n color: ").concat(active ? (0, _customColorMode.customColorMode)("hsl(".concat(grayColor[0], ", ").concat(grayColor[1], "%, 30%)"), "hsl(".concat(whiteColor[0], ", ").concat(whiteColor[1], "%, ").concat(whiteColor[2], "%)")) : disabled ? theme.colors.neutral.neutral1 : "hsl(".concat(grayColor[0], ", ").concat(grayColor[1], "%, 75%)"), ";\n background: transparent;\n\n border: none;\n border-radius: 0;\n outline: 0;\n margin: 0;\n\n cursor: ").concat(disabled ? 'default' : 'pointer', ";\n vertical-align: middle;\n\n user-select: none;\n appearance: none;\n text-decoration: none;\n\n transition: all 250ms ease 0ms;\n\n & > span {\n ").concat(active && "\n color: ".concat((0, _getColorValue.getColorValue)(textColor || 'primary.default', theme), ";\n "), "\n }\n\n &:hover {\n color: ").concat(disabled ? 'none' : theme.colors.neutral.black, ";\n background: ").concat(disabled ? 'transparent' : 'rgba(0, 0, 0, 0.04)', ";\n }\n\n &:active {\n background: rgba(0, 0, 0, .1);\n }\n");
|
|
32
|
-
});
|
|
33
|
-
exports.TabButton = TabButton;
|
|
34
|
-
var TabButtonIcon = _styled.default.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n line-height: 0;\n transition: all 250ms ease 0ms;\n"])));
|
|
35
|
-
exports.TabButtonIcon = TabButtonIcon;
|
|
36
|
-
var TabPanelWrapper = _styled.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: ", "px;\n"])), function (props) {
|
|
37
|
-
return props.noPadding ? 0 : 20;
|
|
38
|
-
});
|
|
39
|
-
exports.TabPanelWrapper = TabPanelWrapper;
|
|
40
|
-
var TabLoadingSkeleton = _styled.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n width: 58px;\n height: 14px;\n border-radius: 4px;\n overflow: hidden;\n background: ", ";\n\n &::after {\n content: '';\n inset: 0px;\n width: 100%;\n height: 100%;\n display: block;\n animation: 1.6s linear 0.5s infinite normal none running move;\n transform: translateX(-100%);\n background: linear-gradient(\n 90deg,\n transparent,\n ", ",\n transparent\n );\n }\n\n @keyframes move {\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(100%);\n }\n }\n"])), function (_ref3) {
|
|
41
|
-
var theme = _ref3.theme;
|
|
42
|
-
return theme.colors.neutral.neutral1;
|
|
43
|
-
}, function (_ref4) {
|
|
44
|
-
var theme = _ref4.theme;
|
|
45
|
-
return theme.colors.neutral.neutral2;
|
|
46
|
-
});
|
|
47
|
-
exports.TabLoadingSkeleton = TabLoadingSkeleton;
|
|
48
|
-
var TabPanelContainer = _styled.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: ", ";\n"])), function (_ref5) {
|
|
49
|
-
var hidden = _ref5.hidden;
|
|
50
|
-
return hidden ? 'none' : 'block';
|
|
51
|
-
});
|
|
52
|
-
exports.TabPanelContainer = TabPanelContainer;
|
|
53
|
-
var TabIndicator = _styled.default.div(function (_ref6) {
|
|
54
|
-
var indicatorWidth = _ref6.indicatorWidth,
|
|
55
|
-
indicatorLeft = _ref6.indicatorLeft,
|
|
56
|
-
theme = _ref6.theme,
|
|
57
|
-
indicatorColor = _ref6.indicatorColor,
|
|
58
|
-
isLoading = _ref6.isLoading;
|
|
59
|
-
return "\n display: block;\n position: absolute;\n margin-top: -2px;\n height: 2px;\n width: ".concat(indicatorWidth, "px;\n left: ").concat(indicatorLeft, "px;\n background: ").concat(isLoading ? theme.colors.neutral.neutral1 : (0, _getColorValue.getColorValue)(indicatorColor || 'primary.default', theme), ";\n animation-name: indicator;\n animation-duration: .5s;\n transition: 0.3s all;\n ");
|
|
60
|
-
});
|
|
61
|
-
exports.TabIndicator = TabIndicator;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TabsContainer=exports.TabPanelWrapper=exports.TabPanelContainer=exports.TabLoadingSkeleton=exports.TabIndicator=exports.TabButtonIcon=exports.TabButton=void 0;var _templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_styled=_interopRequireDefault(require("@emotion/styled")),_getColorValue=require("../../utils/getColorValue"),_colorToGray=require("../../utils/colorToGray"),_customColorMode=require("../../utils/customColorMode");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _taggedTemplateLiteral(strings,raw){return raw||(raw=strings.slice(0)),Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}))}var TabsContainer=_styled.default.div(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n\n > div[role='tablist'] {\n width: ",";\n border-bottom: 2px solid\n ",";\n }\n"])),function(_ref){var fullWidth=_ref.fullWidth;return fullWidth?"100%":"fit-content"},function(){return(0,_customColorMode.customColorMode)("rgba(0, 0, 0, 0.2)","rgba(255, 255, 255, 0.4)")});exports.TabsContainer=TabsContainer;var TabButton=_styled.default.button(function(_ref2){var squeeze=_ref2.squeeze,theme=_ref2.theme,active=_ref2.active,textColor=_ref2.textColor,disabled=_ref2.disabled,indicatorColor=_ref2.indicatorColor,colorProps=(0,_colorToGray.convertColor)((0,_getColorValue.getColorValue)(indicatorColor||"primary.default",theme)),grayColor=colorProps.neutral2,whiteColor=colorProps.neutral1;return"\n display: flex;\n ".concat(squeeze&&"flex: 1;","\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 1rem 2rem;\n\n font-family: inherit;\n font-weight: 600;\n font-size: ").concat(theme.fontSizes.xxs,";\n\n color: ").concat(active?(0,_customColorMode.customColorMode)("hsl(".concat(grayColor[0],", ").concat(grayColor[1],"%, 30%)"),"hsl(".concat(whiteColor[0],", ").concat(whiteColor[1],"%, ").concat(whiteColor[2],"%)")):disabled?theme.colors.neutral.neutral1:"hsl(".concat(grayColor[0],", ").concat(grayColor[1],"%, 75%)"),";\n background: transparent;\n\n border: none;\n border-radius: 0;\n outline: 0;\n margin: 0;\n\n cursor: ").concat(disabled?"default":"pointer",";\n vertical-align: middle;\n\n user-select: none;\n appearance: none;\n text-decoration: none;\n\n transition: all 250ms ease 0ms;\n\n & > span {\n ").concat(active&&"\n color: ".concat((0,_getColorValue.getColorValue)(textColor||"primary.default",theme),";\n "),"\n }\n\n &:hover {\n color: ").concat(disabled?"none":theme.colors.neutral.black,";\n background: ").concat(disabled?"transparent":"rgba(0, 0, 0, 0.04)",";\n }\n\n &:active {\n background: rgba(0, 0, 0, .1);\n }\n")});exports.TabButton=TabButton;var TabButtonIcon=_styled.default.span(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n line-height: 0;\n transition: all 250ms ease 0ms;\n"])));exports.TabButtonIcon=TabButtonIcon;var TabPanelWrapper=_styled.default.div(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n padding: ","px;\n"])),function(props){return props.noPadding?0:20});exports.TabPanelWrapper=TabPanelWrapper;var TabLoadingSkeleton=_styled.default.div(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n display: flex;\n width: 58px;\n height: 14px;\n border-radius: 4px;\n overflow: hidden;\n background: ",";\n\n &::after {\n content: '';\n inset: 0px;\n width: 100%;\n height: 100%;\n display: block;\n animation: 1.6s linear 0.5s infinite normal none running move;\n transform: translateX(-100%);\n background: linear-gradient(\n 90deg,\n transparent,\n ",",\n transparent\n );\n }\n\n @keyframes move {\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(100%);\n }\n }\n"])),function(_ref3){var theme=_ref3.theme;return theme.colors.neutral.neutral1},function(_ref4){var theme=_ref4.theme;return theme.colors.neutral.neutral2});exports.TabLoadingSkeleton=TabLoadingSkeleton;var TabPanelContainer=_styled.default.div(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n display: ",";\n"])),function(_ref5){var hidden=_ref5.hidden;return hidden?"none":"block"});exports.TabPanelContainer=TabPanelContainer;var TabIndicator=_styled.default.div(function(_ref6){var indicatorWidth=_ref6.indicatorWidth,indicatorLeft=_ref6.indicatorLeft,theme=_ref6.theme,indicatorColor=_ref6.indicatorColor,isLoading=_ref6.isLoading;return"\n display: block;\n position: absolute;\n margin-top: -2px;\n height: 2px;\n width: ".concat(indicatorWidth,"px;\n left: ").concat(indicatorLeft,"px;\n background: ").concat(isLoading?theme.colors.neutral.neutral1:(0,_getColorValue.getColorValue)(indicatorColor||"primary.default",theme),";\n animation-name: indicator;\n animation-duration: .5s;\n transition: 0.3s all;\n ")});exports.TabIndicator=TabIndicator;
|
|
@@ -1,146 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _testUtils = require("../../shared/tests/test-utils");
|
|
4
|
-
require("@testing-library/jest-dom");
|
|
5
|
-
var _ = require(".");
|
|
6
|
-
var _TabsExample = require("./TabsExample");
|
|
7
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
describe('Tabs', function () {
|
|
9
|
-
it('should it render tabs components', function () {
|
|
10
|
-
var _render = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_TabsExample.TabsExample, {
|
|
11
|
-
value: 1,
|
|
12
|
-
onChangeTab: function onChangeTab() {}
|
|
13
|
-
})),
|
|
14
|
-
container = _render.container;
|
|
15
|
-
expect(container).toBeInTheDocument();
|
|
16
|
-
});
|
|
17
|
-
it('should it render with initial value', function () {
|
|
18
|
-
var _render2 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
19
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Tabs, {
|
|
20
|
-
value: 1,
|
|
21
|
-
onChangeTab: jest.fn(),
|
|
22
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
23
|
-
label: "Tab 1",
|
|
24
|
-
value: "1"
|
|
25
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
26
|
-
label: "Tab 2",
|
|
27
|
-
value: "2"
|
|
28
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
29
|
-
label: "Tab 3",
|
|
30
|
-
value: "3"
|
|
31
|
-
})]
|
|
32
|
-
})
|
|
33
|
-
})),
|
|
34
|
-
container = _render2.container;
|
|
35
|
-
expect(container).toBeInTheDocument();
|
|
36
|
-
});
|
|
37
|
-
it('should it render with disabled prop', function () {
|
|
38
|
-
var _render3 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
39
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Tabs, {
|
|
40
|
-
value: 1,
|
|
41
|
-
onChangeTab: jest.fn(),
|
|
42
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
43
|
-
label: "Tab 1",
|
|
44
|
-
value: "1",
|
|
45
|
-
disabled: true
|
|
46
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
47
|
-
label: "Tab 2",
|
|
48
|
-
value: "2"
|
|
49
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
50
|
-
label: "Tab 3",
|
|
51
|
-
value: "3"
|
|
52
|
-
})]
|
|
53
|
-
})
|
|
54
|
-
})),
|
|
55
|
-
container = _render3.container;
|
|
56
|
-
expect(container).toBeInTheDocument();
|
|
57
|
-
expect(container.querySelector('#simple-tab-1')).toBeDisabled();
|
|
58
|
-
});
|
|
59
|
-
it('should it render with loading prop', function () {
|
|
60
|
-
var _render4 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
61
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Tabs, {
|
|
62
|
-
value: 1,
|
|
63
|
-
onChangeTab: jest.fn(),
|
|
64
|
-
isLoading: true,
|
|
65
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
66
|
-
label: "Tab 1",
|
|
67
|
-
value: "1"
|
|
68
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
69
|
-
label: "Tab 2",
|
|
70
|
-
value: "2"
|
|
71
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
72
|
-
label: "Tab 3",
|
|
73
|
-
value: "3"
|
|
74
|
-
})]
|
|
75
|
-
})
|
|
76
|
-
})),
|
|
77
|
-
container = _render4.container;
|
|
78
|
-
expect(container).toBeInTheDocument();
|
|
79
|
-
});
|
|
80
|
-
it('should it render with centered prop', function () {
|
|
81
|
-
var _render5 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
82
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Tabs, {
|
|
83
|
-
value: 1,
|
|
84
|
-
onChangeTab: jest.fn(),
|
|
85
|
-
centered: true,
|
|
86
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
87
|
-
label: "Tab 1",
|
|
88
|
-
value: "1"
|
|
89
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
90
|
-
label: "Tab 2",
|
|
91
|
-
value: "2"
|
|
92
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
93
|
-
label: "Tab 3",
|
|
94
|
-
value: "3"
|
|
95
|
-
})]
|
|
96
|
-
})
|
|
97
|
-
})),
|
|
98
|
-
container = _render5.container;
|
|
99
|
-
expect(container).toBeInTheDocument();
|
|
100
|
-
});
|
|
101
|
-
it('should it render with fullWidth prop', function () {
|
|
102
|
-
var _render6 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
103
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Tabs, {
|
|
104
|
-
value: 1,
|
|
105
|
-
onChangeTab: jest.fn(),
|
|
106
|
-
fullWidth: true,
|
|
107
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
108
|
-
label: "Tab 1",
|
|
109
|
-
value: "1"
|
|
110
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
111
|
-
label: "Tab 2",
|
|
112
|
-
value: "2"
|
|
113
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
114
|
-
label: "Tab 3",
|
|
115
|
-
value: "3"
|
|
116
|
-
})]
|
|
117
|
-
})
|
|
118
|
-
})),
|
|
119
|
-
container = _render6.container;
|
|
120
|
-
expect(container).toBeInTheDocument();
|
|
121
|
-
});
|
|
122
|
-
it('should it call the on change function when the tab is clicked', function () {
|
|
123
|
-
var onChangeTab = jest.fn();
|
|
124
|
-
var _render7 = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
125
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Tabs, {
|
|
126
|
-
value: 1,
|
|
127
|
-
onChangeTab: onChangeTab,
|
|
128
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
129
|
-
label: "Tab 1",
|
|
130
|
-
value: "1"
|
|
131
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
132
|
-
label: "Tab 2",
|
|
133
|
-
value: "2"
|
|
134
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tab, {
|
|
135
|
-
label: "Tab 3",
|
|
136
|
-
value: "3"
|
|
137
|
-
})]
|
|
138
|
-
})
|
|
139
|
-
})),
|
|
140
|
-
container = _render7.container;
|
|
141
|
-
var tab = container.querySelector('#simple-tab-2');
|
|
142
|
-
tab === null || tab === void 0 ? void 0 : tab.click();
|
|
143
|
-
expect(onChangeTab).toHaveBeenCalled();
|
|
144
|
-
expect(onChangeTab).toHaveBeenCalledWith(2);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
1
|
+
"use strict";var _testUtils=require("../../shared/tests/test-utils");require("@testing-library/jest-dom");var _=require("."),_TabsExample=require("./TabsExample"),_jsxRuntime=require("react/jsx-runtime");describe("Tabs",function(){it("should it render tabs components",function(){var _render=(0,_testUtils.render)(/*#__PURE__*/(0,_jsxRuntime.jsx)(_TabsExample.TabsExample,{value:1,onChangeTab:function onChangeTab(){}})),container=_render.container;expect(container).toBeInTheDocument()}),it("should it render with initial value",function(){var _render2=(0,_testUtils.render)(/*#__PURE__*/(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.Tabs,{value:1,onChangeTab:jest.fn(),children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 1",value:"1"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 2",value:"2"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 3",value:"3"})]})})),container=_render2.container;expect(container).toBeInTheDocument()}),it("should it render with disabled prop",function(){var _render3=(0,_testUtils.render)(/*#__PURE__*/(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.Tabs,{value:1,onChangeTab:jest.fn(),children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 1",value:"1",disabled:!0}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 2",value:"2"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 3",value:"3"})]})})),container=_render3.container;expect(container).toBeInTheDocument(),expect(container.querySelector("#simple-tab-1")).toBeDisabled()}),it("should it render with loading prop",function(){var _render4=(0,_testUtils.render)(/*#__PURE__*/(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.Tabs,{value:1,onChangeTab:jest.fn(),isLoading:!0,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 1",value:"1"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 2",value:"2"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 3",value:"3"})]})})),container=_render4.container;expect(container).toBeInTheDocument()}),it("should it render with centered prop",function(){var _render5=(0,_testUtils.render)(/*#__PURE__*/(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.Tabs,{value:1,onChangeTab:jest.fn(),centered:!0,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 1",value:"1"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 2",value:"2"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 3",value:"3"})]})})),container=_render5.container;expect(container).toBeInTheDocument()}),it("should it render with fullWidth prop",function(){var _render6=(0,_testUtils.render)(/*#__PURE__*/(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.Tabs,{value:1,onChangeTab:jest.fn(),fullWidth:!0,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 1",value:"1"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 2",value:"2"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 3",value:"3"})]})})),container=_render6.container;expect(container).toBeInTheDocument()}),it("should it call the on change function when the tab is clicked",function(){var onChangeTab=jest.fn(),_render7=(0,_testUtils.render)(/*#__PURE__*/(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.Tabs,{value:1,onChangeTab:onChangeTab,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 1",value:"1"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 2",value:"2"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Tab,{label:"Tab 3",value:"3"})]})})),container=_render7.container,tab=container.querySelector("#simple-tab-2");null===tab||void 0===tab?void 0:tab.click(),expect(onChangeTab).toHaveBeenCalled(),expect(onChangeTab).toHaveBeenCalledWith(2)})});
|
|
@@ -1,53 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _invertColor = require("../../utils/invertColor");
|
|
8
|
-
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
9
|
-
var _styles = require("./styles");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
var Tag = function Tag(_ref) {
|
|
13
|
-
var label = _ref.label,
|
|
14
|
-
leftIcon = _ref.leftIcon,
|
|
15
|
-
rightIcon = _ref.rightIcon,
|
|
16
|
-
fillColor = _ref.fillColor,
|
|
17
|
-
onClick = _ref.onClick,
|
|
18
|
-
_ref$size = _ref.size,
|
|
19
|
-
size = _ref$size === void 0 ? 'sm' : _ref$size,
|
|
20
|
-
_ref$variant = _ref.variant,
|
|
21
|
-
variant = _ref$variant === void 0 ? 'square' : _ref$variant;
|
|
22
|
-
var padding = {
|
|
23
|
-
sm: '2px',
|
|
24
|
-
md: '4px',
|
|
25
|
-
lg: '8px'
|
|
26
|
-
};
|
|
27
|
-
if (!label) return null;
|
|
28
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Wrapper, {
|
|
29
|
-
fillColor: fillColor,
|
|
30
|
-
overtoneHue: fillColor && (0, _invertColor.invertColor)(fillColor, true),
|
|
31
|
-
padding: size ? padding[size] : padding.md,
|
|
32
|
-
onClick: onClick,
|
|
33
|
-
variant: variant,
|
|
34
|
-
children: [leftIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
35
|
-
name: leftIcon,
|
|
36
|
-
size: size === 'lg' ? '15' : '13'
|
|
37
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Text, {
|
|
38
|
-
overtoneHue: fillColor && (0, _invertColor.invertColor)(fillColor, true),
|
|
39
|
-
isLarge: size === 'lg',
|
|
40
|
-
children: label
|
|
41
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Close, {
|
|
42
|
-
type: "button",
|
|
43
|
-
overtoneHue: fillColor && (0, _invertColor.invertColor)(fillColor, true),
|
|
44
|
-
fillColor: fillColor,
|
|
45
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
46
|
-
name: rightIcon || 'x-circle',
|
|
47
|
-
size: size === 'lg' ? '15' : '13'
|
|
48
|
-
})
|
|
49
|
-
})]
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
var _default = Tag;
|
|
53
|
-
exports.default = _default;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _invertColor=require("../../utils/invertColor"),_Icon=_interopRequireDefault(require("../Icon")),_styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var Tag=function(_ref){var label=_ref.label,leftIcon=_ref.leftIcon,rightIcon=_ref.rightIcon,fillColor=_ref.fillColor,onClick=_ref.onClick,_ref$size=_ref.size,size=void 0===_ref$size?"sm":_ref$size,_ref$variant=_ref.variant,variant=void 0===_ref$variant?"square":_ref$variant,padding={sm:"2px",md:"4px",lg:"8px"};return label?/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.Wrapper,{fillColor:fillColor,overtoneHue:fillColor&&(0,_invertColor.invertColor)(fillColor,!0),padding:size?padding[size]:padding.md,onClick:onClick,variant:variant,children:[leftIcon&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:leftIcon,size:"lg"===size?"15":"13"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Text,{overtoneHue:fillColor&&(0,_invertColor.invertColor)(fillColor,!0),isLarge:"lg"===size,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Close,{type:"button",overtoneHue:fillColor&&(0,_invertColor.invertColor)(fillColor,!0),fillColor:fillColor,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:rightIcon||"x-circle",size:"lg"===size?"15":"13"})})]}):null},_default=Tag;exports.default=_default;
|