@pedidopago/ui 1.7.25 → 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.d.ts.map +1 -1
- package/dist/components/NewSelect/multiple/index.js +1 -247
- 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,163 +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.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _Button = _interopRequireDefault(require("../Button"));
|
|
10
|
-
var _styles = require("./styles");
|
|
11
|
-
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
12
|
-
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
var _excluded = ["placeholder", "type", "disabled", "label", "labelBackground", "hiddenContent", "helperText", "alert", "withAddon", "addonContent", "withIcon", "onLeftIconClick", "onRightIconClick", "leftIcon", "rightIcon"];
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
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; }
|
|
17
|
-
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; }
|
|
18
|
-
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; }
|
|
19
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
20
|
-
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); }
|
|
21
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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."); }
|
|
23
|
-
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); }
|
|
24
|
-
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; }
|
|
25
|
-
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; } }
|
|
26
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
|
-
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; }
|
|
28
|
-
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; }
|
|
29
|
-
var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
30
|
-
var placeholder = _ref.placeholder,
|
|
31
|
-
type = _ref.type,
|
|
32
|
-
disabled = _ref.disabled,
|
|
33
|
-
label = _ref.label,
|
|
34
|
-
labelBackground = _ref.labelBackground,
|
|
35
|
-
hiddenContent = _ref.hiddenContent,
|
|
36
|
-
helperText = _ref.helperText,
|
|
37
|
-
alert = _ref.alert,
|
|
38
|
-
withAddon = _ref.withAddon,
|
|
39
|
-
addonContent = _ref.addonContent,
|
|
40
|
-
withIcon = _ref.withIcon,
|
|
41
|
-
onLeftIconClick = _ref.onLeftIconClick,
|
|
42
|
-
onRightIconClick = _ref.onRightIconClick,
|
|
43
|
-
leftIcon = _ref.leftIcon,
|
|
44
|
-
rightIcon = _ref.rightIcon,
|
|
45
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
-
var _useState = (0, _react.useState)(false),
|
|
47
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
-
hasValueOnInput = _useState2[0],
|
|
49
|
-
setHasValueOnInput = _useState2[1];
|
|
50
|
-
var _useState3 = (0, _react.useState)(hiddenContent || false),
|
|
51
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
52
|
-
hiddenInfo = _useState4[0],
|
|
53
|
-
setHiddenInfo = _useState4[1];
|
|
54
|
-
function handleInputChange(value) {
|
|
55
|
-
setHasValueOnInput(value.length > 0);
|
|
56
|
-
}
|
|
57
|
-
function handleHiddenChange() {
|
|
58
|
-
setHiddenInfo(!hiddenInfo);
|
|
59
|
-
}
|
|
60
|
-
var inputRef = (0, _react.useRef)(null);
|
|
61
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
|
62
|
-
return inputRef.current;
|
|
63
|
-
});
|
|
64
|
-
(0, _react.useEffect)(function () {
|
|
65
|
-
var _inputRef$current;
|
|
66
|
-
setHasValueOnInput(!!((_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value));
|
|
67
|
-
});
|
|
68
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.InputGroupElement, {
|
|
69
|
-
withIcon: !!withIcon,
|
|
70
|
-
hasValueOnInput: placeholder || rest.value ? true : hasValueOnInput,
|
|
71
|
-
alert: alert,
|
|
72
|
-
withAddon: withAddon,
|
|
73
|
-
hasDisabled: disabled,
|
|
74
|
-
labelBackground: labelBackground,
|
|
75
|
-
className: rest.className,
|
|
76
|
-
style: rest.style,
|
|
77
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.InputColumn, {
|
|
78
|
-
children: [withAddon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.AddonElement, {
|
|
79
|
-
alert: alert,
|
|
80
|
-
hasDisabled: disabled,
|
|
81
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
82
|
-
fontSize: "xs",
|
|
83
|
-
children: addonContent
|
|
84
|
-
})
|
|
85
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.InputContent, {
|
|
86
|
-
withAddon: withAddon,
|
|
87
|
-
children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.InputLabel, {
|
|
88
|
-
withIcon: !!withIcon,
|
|
89
|
-
hasDisabled: disabled,
|
|
90
|
-
children: label
|
|
91
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Fieldset, {
|
|
92
|
-
"aria-hidden": true,
|
|
93
|
-
hasDisabled: disabled,
|
|
94
|
-
withAddon: withAddon,
|
|
95
|
-
alert: alert,
|
|
96
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Legend, {
|
|
97
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.LegendText, {
|
|
98
|
-
children: label
|
|
99
|
-
})
|
|
100
|
-
})
|
|
101
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.InputContentRow, {
|
|
102
|
-
children: [(withIcon || leftIcon) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.InputIcon, {
|
|
103
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
104
|
-
type: "button",
|
|
105
|
-
variant: "ghost",
|
|
106
|
-
style: {
|
|
107
|
-
padding: 0,
|
|
108
|
-
cursor: onLeftIconClick ? 'pointer' : 'default'
|
|
109
|
-
},
|
|
110
|
-
onClick: onLeftIconClick,
|
|
111
|
-
tabIndex: onLeftIconClick ? 0 : -1,
|
|
112
|
-
children: withIcon || leftIcon
|
|
113
|
-
})
|
|
114
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Input, _objectSpread(_objectSpread({
|
|
115
|
-
"data-input": "input",
|
|
116
|
-
type: hiddenInfo ? 'password' : type,
|
|
117
|
-
"aria-label": label,
|
|
118
|
-
withIcon: withIcon,
|
|
119
|
-
leftIcon: leftIcon,
|
|
120
|
-
rightIcon: rightIcon,
|
|
121
|
-
hiddenContent: hiddenContent,
|
|
122
|
-
disabled: disabled,
|
|
123
|
-
alert: alert,
|
|
124
|
-
placeholder: placeholder,
|
|
125
|
-
ref: inputRef
|
|
126
|
-
}, rest), {}, {
|
|
127
|
-
onChange: function onChange(e) {
|
|
128
|
-
var _rest$onChange;
|
|
129
|
-
handleInputChange(e.currentTarget.value);
|
|
130
|
-
(_rest$onChange = rest.onChange) === null || _rest$onChange === void 0 ? void 0 : _rest$onChange.call(rest, e);
|
|
131
|
-
}
|
|
132
|
-
})), hiddenContent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.InputIcon, {
|
|
133
|
-
clickable: true,
|
|
134
|
-
onClick: handleHiddenChange,
|
|
135
|
-
children: hiddenInfo ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
136
|
-
name: "eye"
|
|
137
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
138
|
-
name: "eye-off"
|
|
139
|
-
})
|
|
140
|
-
}), rightIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.InputIcon, {
|
|
141
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
142
|
-
type: "button",
|
|
143
|
-
variant: "ghost",
|
|
144
|
-
style: {
|
|
145
|
-
padding: 0,
|
|
146
|
-
cursor: onRightIconClick ? 'pointer' : 'default'
|
|
147
|
-
},
|
|
148
|
-
onClick: onRightIconClick,
|
|
149
|
-
tabIndex: onRightIconClick ? 0 : -1,
|
|
150
|
-
children: rightIcon
|
|
151
|
-
})
|
|
152
|
-
})]
|
|
153
|
-
})]
|
|
154
|
-
})]
|
|
155
|
-
}), helperText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.HelperText, {
|
|
156
|
-
alert: alert,
|
|
157
|
-
children: helperText
|
|
158
|
-
})]
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
Input.displayName = 'Input';
|
|
162
|
-
var _default = Input;
|
|
163
|
-
exports.default = _default;
|
|
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.default=void 0;var _react=require("react"),_Button=_interopRequireDefault(require("../Button")),_styles=require("./styles"),_Typography=_interopRequireDefault(require("../Typography")),_Icon=_interopRequireDefault(require("../Icon")),_jsxRuntime=require("react/jsx-runtime"),_excluded=["placeholder","type","disabled","label","labelBackground","hiddenContent","helperText","alert","withAddon","addonContent","withIcon","onLeftIconClick","onRightIconClick","leftIcon","rightIcon"];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 Input=/*#__PURE__*/(0,_react.forwardRef)(function(_ref,ref){function handleInputChange(value){setHasValueOnInput(0<value.length)}var placeholder=_ref.placeholder,type=_ref.type,disabled=_ref.disabled,label=_ref.label,labelBackground=_ref.labelBackground,hiddenContent=_ref.hiddenContent,helperText=_ref.helperText,alert=_ref.alert,withAddon=_ref.withAddon,addonContent=_ref.addonContent,withIcon=_ref.withIcon,onLeftIconClick=_ref.onLeftIconClick,onRightIconClick=_ref.onRightIconClick,leftIcon=_ref.leftIcon,rightIcon=_ref.rightIcon,rest=_objectWithoutProperties(_ref,_excluded),_useState=(0,_react.useState)(!1),_useState2=_slicedToArray(_useState,2),hasValueOnInput=_useState2[0],setHasValueOnInput=_useState2[1],_useState3=(0,_react.useState)(hiddenContent||!1),_useState4=_slicedToArray(_useState3,2),hiddenInfo=_useState4[0],setHiddenInfo=_useState4[1],inputRef=(0,_react.useRef)(null);return(0,_react.useImperativeHandle)(ref,function(){return inputRef.current}),(0,_react.useEffect)(function(){var _inputRef$current;setHasValueOnInput(!!(null!==(_inputRef$current=inputRef.current)&&void 0!==_inputRef$current&&_inputRef$current.value))}),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.InputGroupElement,{withIcon:!!withIcon,hasValueOnInput:!!(placeholder||rest.value)||hasValueOnInput,alert:alert,withAddon:withAddon,hasDisabled:disabled,labelBackground:labelBackground,className:rest.className,style:rest.style,children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.InputColumn,{children:[withAddon&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.AddonElement,{alert:alert,hasDisabled:disabled,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Typography.default,{fontSize:"xs",children:addonContent})}),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.InputContent,{withAddon:withAddon,children:[label&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.InputLabel,{withIcon:!!withIcon,hasDisabled:disabled,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Fieldset,{"aria-hidden":!0,hasDisabled:disabled,withAddon:withAddon,alert:alert,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Legend,{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.LegendText,{children:label})})}),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.InputContentRow,{children:[(withIcon||leftIcon)&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.InputIcon,{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Button.default,{type:"button",variant:"ghost",style:{padding:0,cursor:onLeftIconClick?"pointer":"default"},onClick:onLeftIconClick,tabIndex:onLeftIconClick?0:-1,children:withIcon||leftIcon})}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Input,_objectSpread(_objectSpread({"data-input":"input",type:hiddenInfo?"password":type,"aria-label":label,withIcon:withIcon,leftIcon:leftIcon,rightIcon:rightIcon,hiddenContent:hiddenContent,disabled:disabled,alert:alert,placeholder:placeholder,ref:inputRef},rest),{},{onChange:function onChange(e){var _rest$onChange;handleInputChange(e.currentTarget.value),null===(_rest$onChange=rest.onChange)||void 0===_rest$onChange?void 0:_rest$onChange.call(rest,e)}})),hiddenContent&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.InputIcon,{clickable:!0,onClick:function(){setHiddenInfo(!hiddenInfo)},children:hiddenInfo?/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"eye"}):/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"eye-off"})}),rightIcon&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.InputIcon,{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Button.default,{type:"button",variant:"ghost",style:{padding:0,cursor:onRightIconClick?"pointer":"default"},onClick:onRightIconClick,tabIndex:onRightIconClick?0:-1,children:rightIcon})})]})]})]}),helperText&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.HelperText,{alert:alert,children:helperText})]})});Input.displayName="Input";var _default=Input;exports.default=_default;
|
|
@@ -1,120 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _testUtils = require("../../shared/tests/test-utils");
|
|
4
|
-
var _react = require("@testing-library/react");
|
|
5
|
-
require("@testing-library/jest-dom/extend-expect");
|
|
6
|
-
var _ = _interopRequireDefault(require("."));
|
|
7
|
-
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
8
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
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); }
|
|
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
|
-
var setup = function setup(props) {
|
|
17
|
-
var utils = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, _objectSpread({
|
|
18
|
-
"data-testid": "input-component"
|
|
19
|
-
}, props)));
|
|
20
|
-
var input = utils.getByLabelText(props.label);
|
|
21
|
-
return _objectSpread({
|
|
22
|
-
input: input
|
|
23
|
-
}, utils);
|
|
24
|
-
};
|
|
25
|
-
describe('Input', function () {
|
|
26
|
-
it('should render the input', function () {
|
|
27
|
-
var _setup = setup({
|
|
28
|
-
label: 'E-mail'
|
|
29
|
-
}),
|
|
30
|
-
input = _setup.input;
|
|
31
|
-
expect(input.getAttribute('aria-label')).toEqual('E-mail');
|
|
32
|
-
});
|
|
33
|
-
it('should render the input and receives a value', function () {
|
|
34
|
-
var _setup2 = setup({
|
|
35
|
-
label: 'E-mail'
|
|
36
|
-
}),
|
|
37
|
-
input = _setup2.input;
|
|
38
|
-
_react.fireEvent.change(input, {
|
|
39
|
-
target: {
|
|
40
|
-
value: 'teste@teste.com'
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
expect(input.value).toEqual('teste@teste.com');
|
|
44
|
-
});
|
|
45
|
-
it('should render the input with an icon', function () {
|
|
46
|
-
var _input$parentElement;
|
|
47
|
-
var _setup3 = setup({
|
|
48
|
-
label: 'E-mail',
|
|
49
|
-
withIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
50
|
-
name: "search",
|
|
51
|
-
color: "neutral.neutral4"
|
|
52
|
-
})
|
|
53
|
-
}),
|
|
54
|
-
input = _setup3.input;
|
|
55
|
-
expect((_input$parentElement = input.parentElement) === null || _input$parentElement === void 0 ? void 0 : _input$parentElement.querySelectorAll('svg').length).not.toBe(0);
|
|
56
|
-
});
|
|
57
|
-
it('should render input with placeholder', function () {
|
|
58
|
-
var _setup4 = setup({
|
|
59
|
-
label: 'E-mail',
|
|
60
|
-
placeholder: 'Digite seu e-mail'
|
|
61
|
-
}),
|
|
62
|
-
input = _setup4.input;
|
|
63
|
-
expect(input.getAttribute('placeholder')).toEqual('Digite seu e-mail');
|
|
64
|
-
});
|
|
65
|
-
it('should render the input with an addon', function () {
|
|
66
|
-
var _input$parentElement2, _input$parentElement3, _input$parentElement4, _input$parentElement5;
|
|
67
|
-
var _setup5 = setup({
|
|
68
|
-
label: 'E-mail',
|
|
69
|
-
withAddon: true,
|
|
70
|
-
addonContent: 'R$'
|
|
71
|
-
}),
|
|
72
|
-
input = _setup5.input;
|
|
73
|
-
expect((_input$parentElement2 = input.parentElement) === null || _input$parentElement2 === void 0 ? void 0 : (_input$parentElement3 = _input$parentElement2.parentElement) === null || _input$parentElement3 === void 0 ? void 0 : (_input$parentElement4 = _input$parentElement3.parentElement) === null || _input$parentElement4 === void 0 ? void 0 : (_input$parentElement5 = _input$parentElement4.querySelectorAll('div')[0].firstChild) === null || _input$parentElement5 === void 0 ? void 0 : _input$parentElement5.textContent).toBe('R$');
|
|
74
|
-
});
|
|
75
|
-
it('should render the input and hide your value', function () {
|
|
76
|
-
var _setup6 = setup({
|
|
77
|
-
label: 'Senha',
|
|
78
|
-
hiddenContent: true
|
|
79
|
-
}),
|
|
80
|
-
input = _setup6.input;
|
|
81
|
-
expect(input.getAttribute('type')).toEqual('password');
|
|
82
|
-
});
|
|
83
|
-
it('should focus the input', function () {
|
|
84
|
-
var focusCallback = jest.fn();
|
|
85
|
-
var _setup7 = setup({
|
|
86
|
-
label: 'E-mail',
|
|
87
|
-
onFocus: function onFocus() {
|
|
88
|
-
return focusCallback();
|
|
89
|
-
}
|
|
90
|
-
}),
|
|
91
|
-
input = _setup7.input;
|
|
92
|
-
input.focus();
|
|
93
|
-
expect(focusCallback).toHaveBeenCalled();
|
|
94
|
-
});
|
|
95
|
-
it('should focus the input with addon', function () {
|
|
96
|
-
var focusCallback = jest.fn();
|
|
97
|
-
var _setup8 = setup({
|
|
98
|
-
label: 'E-mail',
|
|
99
|
-
withAddon: true,
|
|
100
|
-
onFocus: function onFocus() {
|
|
101
|
-
return focusCallback();
|
|
102
|
-
}
|
|
103
|
-
}),
|
|
104
|
-
input = _setup8.input;
|
|
105
|
-
input.focus();
|
|
106
|
-
expect(focusCallback).toHaveBeenCalled();
|
|
107
|
-
});
|
|
108
|
-
it('should hover the input', function () {
|
|
109
|
-
var hoverCallback = jest.fn();
|
|
110
|
-
var _setup9 = setup({
|
|
111
|
-
label: 'E-mail',
|
|
112
|
-
onMouseMove: function onMouseMove() {
|
|
113
|
-
return hoverCallback();
|
|
114
|
-
}
|
|
115
|
-
}),
|
|
116
|
-
input = _setup9.input;
|
|
117
|
-
_react.fireEvent.mouseMove(input);
|
|
118
|
-
expect(hoverCallback).toHaveBeenCalled();
|
|
119
|
-
});
|
|
120
|
-
});
|
|
1
|
+
"use strict";var _testUtils=require("../../shared/tests/test-utils"),_react=require("@testing-library/react");require("@testing-library/jest-dom/extend-expect");var _=_interopRequireDefault(require(".")),_Icon=_interopRequireDefault(require("../Icon")),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}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)}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)}var setup=function(props){var utils=(0,_testUtils.render)(/*#__PURE__*/(0,_jsxRuntime.jsx)(_.default,_objectSpread({"data-testid":"input-component"},props))),input=utils.getByLabelText(props.label);return _objectSpread({input:input},utils)};describe("Input",function(){it("should render the input",function(){var _setup=setup({label:"E-mail"}),input=_setup.input;expect(input.getAttribute("aria-label")).toEqual("E-mail")}),it("should render the input and receives a value",function(){var _setup2=setup({label:"E-mail"}),input=_setup2.input;_react.fireEvent.change(input,{target:{value:"teste@teste.com"}}),expect(input.value).toEqual("teste@teste.com")}),it("should render the input with an icon",function(){var _input$parentElement,_setup3=setup({label:"E-mail",withIcon:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"search",color:"neutral.neutral4"})}),input=_setup3.input;expect(null===(_input$parentElement=input.parentElement)||void 0===_input$parentElement?void 0:_input$parentElement.querySelectorAll("svg").length).not.toBe(0)}),it("should render input with placeholder",function(){var _setup4=setup({label:"E-mail",placeholder:"Digite seu e-mail"}),input=_setup4.input;expect(input.getAttribute("placeholder")).toEqual("Digite seu e-mail")}),it("should render the input with an addon",function(){var _input$parentElement2,_input$parentElement3,_input$parentElement4,_input$parentElement5,_setup5=setup({label:"E-mail",withAddon:!0,addonContent:"R$"}),input=_setup5.input;expect(null===(_input$parentElement2=input.parentElement)||void 0===_input$parentElement2||null===(_input$parentElement3=_input$parentElement2.parentElement)||void 0===_input$parentElement3||null===(_input$parentElement4=_input$parentElement3.parentElement)||void 0===_input$parentElement4||null===(_input$parentElement5=_input$parentElement4.querySelectorAll("div")[0].firstChild)||void 0===_input$parentElement5?void 0:_input$parentElement5.textContent).toBe("R$")}),it("should render the input and hide your value",function(){var _setup6=setup({label:"Senha",hiddenContent:!0}),input=_setup6.input;expect(input.getAttribute("type")).toEqual("password")}),it("should focus the input",function(){var focusCallback=jest.fn(),_setup7=setup({label:"E-mail",onFocus:function onFocus(){return focusCallback()}}),input=_setup7.input;input.focus(),expect(focusCallback).toHaveBeenCalled()}),it("should focus the input with addon",function(){var focusCallback=jest.fn(),_setup8=setup({label:"E-mail",withAddon:!0,onFocus:function onFocus(){return focusCallback()}}),input=_setup8.input;input.focus(),expect(focusCallback).toHaveBeenCalled()}),it("should hover the input",function(){var hoverCallback=jest.fn(),_setup9=setup({label:"E-mail",onMouseMove:function onMouseMove(){return hoverCallback()}}),input=_setup9.input;_react.fireEvent.mouseMove(input),expect(hoverCallback).toHaveBeenCalled()})});
|
|
@@ -1,177 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.LegendText = exports.Legend = exports.InputLabel = exports.InputIcon = exports.InputGroupElement = exports.InputContentRow = exports.InputContent = exports.InputColumn = exports.Input = exports.HelperText = exports.Fieldset = exports.AddonElement = void 0;
|
|
7
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
8
|
-
var _react = require("@emotion/react");
|
|
9
|
-
var _invertColor = require("../../utils//invertColor");
|
|
10
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
13
|
-
var InputGroupElement = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n border-radius: ", ";\n font-weight: ", ";\n transition: all 0.2s ease-in-out;\n\n &:hover fieldset {\n border-color: ", ";\n }\n\n &:hover > div > div:first-of-type {\n border-color: ", ";\n &:hover label {\n color: ", ";\n }\n }\n\n &:focus-within > div > div:first-of-type {\n background: ", ";\n border-color: ", ";\n }\n\n > div > div:first-of-type span {\n color: ", ";\n }\n\n &:focus-within {\n border-radius: 2px solid ", ";\n }\n &:focus-within label {\n color: ", ";\n }\n\n &:focus-within > div {\n box-shadow: 0 0 0 2px\n ", ";\n }\n\n &:focus-within label {\n transform: translate(19px, -11px) scale(0.8);\n\n background-color: ", ";\n\n height: 20px;\n }\n\n &:focus-within fieldset {\n border-width: 2px;\n border-color: ", ";\n }\n\n ", "\n\n & label {\n transform: ", ";\n height: ", ";\n background: ", ";\n }\n"])), function (props) {
|
|
14
|
-
return props.theme.borderRadius.default;
|
|
15
|
-
}, function (props) {
|
|
16
|
-
return props.theme.fontWeight[400];
|
|
17
|
-
}, function (_ref) {
|
|
18
|
-
var theme = _ref.theme,
|
|
19
|
-
alert = _ref.alert,
|
|
20
|
-
hasDisabled = _ref.hasDisabled;
|
|
21
|
-
if (alert && !hasDisabled) {
|
|
22
|
-
return theme.colors[alert].default + '66';
|
|
23
|
-
}
|
|
24
|
-
if (hasDisabled) {
|
|
25
|
-
return 'none';
|
|
26
|
-
}
|
|
27
|
-
return theme.colors.primary.hover;
|
|
28
|
-
}, function (_ref2) {
|
|
29
|
-
var theme = _ref2.theme,
|
|
30
|
-
alert = _ref2.alert,
|
|
31
|
-
hasDisabled = _ref2.hasDisabled;
|
|
32
|
-
if (alert && !hasDisabled) {
|
|
33
|
-
return theme.colors[alert].default + '66';
|
|
34
|
-
}
|
|
35
|
-
if (hasDisabled) {
|
|
36
|
-
return 'none';
|
|
37
|
-
}
|
|
38
|
-
return theme.colors.primary.hover;
|
|
39
|
-
}, function (_ref3) {
|
|
40
|
-
var theme = _ref3.theme,
|
|
41
|
-
hasDisabled = _ref3.hasDisabled;
|
|
42
|
-
return !hasDisabled && theme.colors.neutral.neutral5;
|
|
43
|
-
}, function (props) {
|
|
44
|
-
return !props.alert && props.withAddon && props.theme.colors.primary.disabled;
|
|
45
|
-
}, function (props) {
|
|
46
|
-
return !props.alert && props.withAddon && props.theme.colors.primary.hover;
|
|
47
|
-
}, function (props) {
|
|
48
|
-
return props.alert ? (0, _invertColor.invertColor)(props.theme.colors[props.alert].default, true) : props.theme.colors.neutral.black;
|
|
49
|
-
}, function (props) {
|
|
50
|
-
return props.theme.colors.primary.disabled;
|
|
51
|
-
}, function (_ref4) {
|
|
52
|
-
var theme = _ref4.theme;
|
|
53
|
-
return theme.colors.neutral.neutral5;
|
|
54
|
-
}, function (props) {
|
|
55
|
-
return props.alert ? "".concat(props.theme.colors[props.alert].blurred, "33") : props.theme.colors.primary.disabled;
|
|
56
|
-
}, function (_ref5) {
|
|
57
|
-
var theme = _ref5.theme;
|
|
58
|
-
return theme.colors.neutral.white;
|
|
59
|
-
}, function (props) {
|
|
60
|
-
return !props.alert && props.theme.colors.primary.hover;
|
|
61
|
-
}, function (props) {
|
|
62
|
-
return props.addonContent && (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &:focus-within > div > div:first-of-type {\n border-color: ", ";\n background-color: ", ";\n }\n "])), props.alert ? 'transparent' : props.theme.colors.primary.focus, props.alert && props.alert === 'success' ? props.theme.colors.primary.focus : '');
|
|
63
|
-
}, function (_ref6) {
|
|
64
|
-
var hasValueOnInput = _ref6.hasValueOnInput,
|
|
65
|
-
withIcon = _ref6.withIcon;
|
|
66
|
-
return hasValueOnInput ? 'translate(19px, -11px) scale(0.8) !important' : withIcon ? 'translate(60px, calc(100% - 10px))' : 'translate(20px, calc(100% - 10px))';
|
|
67
|
-
}, function (_ref7) {
|
|
68
|
-
var hasValueOnInput = _ref7.hasValueOnInput;
|
|
69
|
-
return hasValueOnInput ? '20px' : 'unset';
|
|
70
|
-
}, function (_ref8) {
|
|
71
|
-
var hasValueOnInput = _ref8.hasValueOnInput,
|
|
72
|
-
theme = _ref8.theme;
|
|
73
|
-
return hasValueOnInput ? theme.colors.neutral.white : 'transparent';
|
|
74
|
-
});
|
|
75
|
-
exports.InputGroupElement = InputGroupElement;
|
|
76
|
-
var InputColumn = _styled.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n display: grid;\n grid-template-columns: repeat(12, 1fr);\n align-items: center;\n border-radius: ", ";\n width: 100%;\n min-height: 56px;\n"])), function (props) {
|
|
77
|
-
return props.theme.borderRadius.default;
|
|
78
|
-
});
|
|
79
|
-
exports.InputColumn = InputColumn;
|
|
80
|
-
var InputContent = _styled.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 100%;\n position: relative;\n grid-column: ", ";\n height: 100%;\n"])), function (props) {
|
|
81
|
-
return props.withAddon ? '2 / end' : '1 / end';
|
|
82
|
-
});
|
|
83
|
-
exports.InputContent = InputContent;
|
|
84
|
-
var InputContentRow = _styled.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n position: relative;\n align-items: center;\n height: 100%;\n"])));
|
|
85
|
-
exports.InputContentRow = InputContentRow;
|
|
86
|
-
var InputIcon = _styled.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: relative;\n z-index: ", ";\n display: flex;\n margin: auto;\n padding: 0 20px;\n align-items: center;\n justify-content: center;\n cursor: ", ";\n color: ", ";\n"])), function (props) {
|
|
87
|
-
return props.theme.zIndex.level1;
|
|
88
|
-
}, function (props) {
|
|
89
|
-
return props.clickable ? 'pointer' : 'default';
|
|
90
|
-
}, function (props) {
|
|
91
|
-
return props.theme.colors.neutral.neutral5;
|
|
92
|
-
});
|
|
93
|
-
exports.InputIcon = InputIcon;
|
|
94
|
-
function inputPadding(props) {
|
|
95
|
-
var leftIcon = props.leftIcon,
|
|
96
|
-
withIcon = props.withIcon;
|
|
97
|
-
if (leftIcon || withIcon) return '0 0';
|
|
98
|
-
return '0 20px';
|
|
99
|
-
}
|
|
100
|
-
var Input = _styled.default.input(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n width: 100%;\n padding: ", ";\n flex: 1;\n height: 100%;\n border: none;\n color: ", ";\n &:disabled {\n color: ", ";\n }\n\n &::placeholder {\n color: ", ";\n }\n\n font-family: inherit;\n outline: none;\n font-size: ", ";\n background-color: transparent;\n position: relative;\n font-weight: 500;\n"])), inputPadding, function (props) {
|
|
101
|
-
return props.theme.colors.neutral.black;
|
|
102
|
-
}, function (_ref9) {
|
|
103
|
-
var theme = _ref9.theme;
|
|
104
|
-
return theme.colors.neutral.neutral5;
|
|
105
|
-
}, function (_ref10) {
|
|
106
|
-
var theme = _ref10.theme;
|
|
107
|
-
return theme.colors.neutral.neutral5;
|
|
108
|
-
}, function (props) {
|
|
109
|
-
return props.theme.fontSizes.xs;
|
|
110
|
-
});
|
|
111
|
-
exports.Input = Input;
|
|
112
|
-
var InputLabel = _styled.default.label(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n top: 0;\n left: 0;\n height: auto;\n padding: 0 6px;\n position: absolute;\n z-index: ", ";\n pointer-events: none;\n color: ", ";\n background-color: transparent;\n transform-origin: left;\n transition: all ease 0.2s;\n font-weight: 500;\n\n white-space: nowrap;\n max-width: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n"])), function (props) {
|
|
113
|
-
return props.theme.zIndex.level1;
|
|
114
|
-
}, function (props) {
|
|
115
|
-
return props.theme.colors.neutral.neutral3;
|
|
116
|
-
}, function (_ref11) {
|
|
117
|
-
var withIcon = _ref11.withIcon;
|
|
118
|
-
return withIcon ? '65%' : '85%';
|
|
119
|
-
});
|
|
120
|
-
exports.InputLabel = InputLabel;
|
|
121
|
-
var Fieldset = _styled.default.fieldset(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n margin: 0;\n top: 0;\n pointer-events: none;\n padding: 0 17px;\n overflow: hidden;\n\n background-color: ", ";\n\n border-radius: ", ";\n border: 2px solid\n ", ";\n border-left: ", ";\n\n transition: all 0.2s ease;\n"])), function (_ref12) {
|
|
122
|
-
var alert = _ref12.alert,
|
|
123
|
-
theme = _ref12.theme,
|
|
124
|
-
hasDisabled = _ref12.hasDisabled;
|
|
125
|
-
if (alert && !hasDisabled) {
|
|
126
|
-
return "".concat(theme.colors[alert].blurred, "33");
|
|
127
|
-
}
|
|
128
|
-
if (hasDisabled) {
|
|
129
|
-
return theme.colors.neutral.neutral1;
|
|
130
|
-
}
|
|
131
|
-
return 'transparent';
|
|
132
|
-
}, function (props) {
|
|
133
|
-
return props.withAddon ? "0 ".concat(props.theme.borderRadius.default, " ").concat(props.theme.borderRadius.default, " 0") : props.theme.borderRadius.default;
|
|
134
|
-
}, function (_ref13) {
|
|
135
|
-
var theme = _ref13.theme,
|
|
136
|
-
hasDisabled = _ref13.hasDisabled,
|
|
137
|
-
alert = _ref13.alert;
|
|
138
|
-
if (alert && !hasDisabled) {
|
|
139
|
-
return theme.colors[alert].default;
|
|
140
|
-
}
|
|
141
|
-
return theme.colors.neutral.neutral2;
|
|
142
|
-
}, function (props) {
|
|
143
|
-
return props.withAddon ? 'none !important' : 'auto';
|
|
144
|
-
});
|
|
145
|
-
exports.Fieldset = Fieldset;
|
|
146
|
-
var Legend = _styled.default.legend(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n padding: 0;\n width: auto;\n max-width: 0.01px;\n font-size: 14px;\n height: 0px;\n visibility: hidden;\n transition: all 0.1s;\n"])));
|
|
147
|
-
exports.Legend = Legend;
|
|
148
|
-
var LegendText = _styled.default.span(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n padding: 0 2px;\n display: inline-block;\n visibility: hidden;\n"])));
|
|
149
|
-
exports.LegendText = LegendText;
|
|
150
|
-
var HelperText = _styled.default.span(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n font-size: ", ";\n\n color: ", ";\n padding: 0 20px;\n"])), function (props) {
|
|
151
|
-
return props.theme.fontSizes.xxs;
|
|
152
|
-
}, function (props) {
|
|
153
|
-
return props.alert && props.alert !== 'success' ? props.theme.colors[props.alert].default : props.theme.colors.neutral.neutral4;
|
|
154
|
-
});
|
|
155
|
-
exports.HelperText = HelperText;
|
|
156
|
-
var AddonElement = _styled.default.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n padding: 0 20px;\n height: 100%;\n\n background-color: ", ";\n\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ease;\n border: 2px solid\n ", ";\n border-right: none;\n\n border-radius: ", " 0 0\n ", ";\n"])), function (props) {
|
|
157
|
-
if (props.alert && !props.hasDisabled) {
|
|
158
|
-
return props.theme.colors[props.alert].default;
|
|
159
|
-
}
|
|
160
|
-
if (props.hasDisabled) {
|
|
161
|
-
return props.theme.colors.neutral.neutral2;
|
|
162
|
-
}
|
|
163
|
-
return props.theme.colors.neutral.neutral1;
|
|
164
|
-
}, function (_ref14) {
|
|
165
|
-
var theme = _ref14.theme,
|
|
166
|
-
hasDisabled = _ref14.hasDisabled,
|
|
167
|
-
alert = _ref14.alert;
|
|
168
|
-
if (alert && !hasDisabled) {
|
|
169
|
-
return theme.colors[alert].default;
|
|
170
|
-
}
|
|
171
|
-
return theme.colors.neutral.neutral2;
|
|
172
|
-
}, function (props) {
|
|
173
|
-
return props.theme.borderRadius.default;
|
|
174
|
-
}, function (props) {
|
|
175
|
-
return props.theme.borderRadius.default;
|
|
176
|
-
});
|
|
177
|
-
exports.AddonElement = AddonElement;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LegendText=exports.Legend=exports.InputLabel=exports.InputIcon=exports.InputGroupElement=exports.InputContentRow=exports.InputContent=exports.InputColumn=exports.Input=exports.HelperText=exports.Fieldset=exports.AddonElement=void 0;var _templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10,_templateObject11,_templateObject12,_templateObject13,_styled=_interopRequireDefault(require("@emotion/styled")),_react=require("@emotion/react"),_invertColor=require("../../utils//invertColor");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 InputGroupElement=_styled.default.div(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n width: 100%;\n border-radius: ",";\n font-weight: ",";\n transition: all 0.2s ease-in-out;\n\n &:hover fieldset {\n border-color: ",";\n }\n\n &:hover > div > div:first-of-type {\n border-color: ",";\n &:hover label {\n color: ",";\n }\n }\n\n &:focus-within > div > div:first-of-type {\n background: ",";\n border-color: ",";\n }\n\n > div > div:first-of-type span {\n color: ",";\n }\n\n &:focus-within {\n border-radius: 2px solid ",";\n }\n &:focus-within label {\n color: ",";\n }\n\n &:focus-within > div {\n box-shadow: 0 0 0 2px\n ",";\n }\n\n &:focus-within label {\n transform: translate(19px, -11px) scale(0.8);\n\n background-color: ",";\n\n height: 20px;\n }\n\n &:focus-within fieldset {\n border-width: 2px;\n border-color: ",";\n }\n\n ","\n\n & label {\n transform: ",";\n height: ",";\n background: ",";\n }\n"])),function(props){return props.theme.borderRadius.default},function(props){return props.theme.fontWeight[400]},function(_ref){var theme=_ref.theme,alert=_ref.alert,hasDisabled=_ref.hasDisabled;return alert&&!hasDisabled?theme.colors[alert].default+"66":hasDisabled?"none":theme.colors.primary.hover},function(_ref2){var theme=_ref2.theme,alert=_ref2.alert,hasDisabled=_ref2.hasDisabled;return alert&&!hasDisabled?theme.colors[alert].default+"66":hasDisabled?"none":theme.colors.primary.hover},function(_ref3){var theme=_ref3.theme,hasDisabled=_ref3.hasDisabled;return!hasDisabled&&theme.colors.neutral.neutral5},function(props){return!props.alert&&props.withAddon&&props.theme.colors.primary.disabled},function(props){return!props.alert&&props.withAddon&&props.theme.colors.primary.hover},function(props){return props.alert?(0,_invertColor.invertColor)(props.theme.colors[props.alert].default,!0):props.theme.colors.neutral.black},function(props){return props.theme.colors.primary.disabled},function(_ref4){var theme=_ref4.theme;return theme.colors.neutral.neutral5},function(props){return props.alert?"".concat(props.theme.colors[props.alert].blurred,"33"):props.theme.colors.primary.disabled},function(_ref5){var theme=_ref5.theme;return theme.colors.neutral.white},function(props){return!props.alert&&props.theme.colors.primary.hover},function(props){return props.addonContent&&(0,_react.css)(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n &:focus-within > div > div:first-of-type {\n border-color: ",";\n background-color: ",";\n }\n "])),props.alert?"transparent":props.theme.colors.primary.focus,props.alert&&"success"===props.alert?props.theme.colors.primary.focus:"")},function(_ref6){var hasValueOnInput=_ref6.hasValueOnInput,withIcon=_ref6.withIcon;return hasValueOnInput?"translate(19px, -11px) scale(0.8) !important":withIcon?"translate(60px, calc(100% - 10px))":"translate(20px, calc(100% - 10px))"},function(_ref7){var hasValueOnInput=_ref7.hasValueOnInput;return hasValueOnInput?"20px":"unset"},function(_ref8){var hasValueOnInput=_ref8.hasValueOnInput,theme=_ref8.theme;return hasValueOnInput?theme.colors.neutral.white:"transparent"});exports.InputGroupElement=InputGroupElement;var InputColumn=_styled.default.div(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n position: relative;\n display: grid;\n grid-template-columns: repeat(12, 1fr);\n align-items: center;\n border-radius: ",";\n width: 100%;\n min-height: 56px;\n"])),function(props){return props.theme.borderRadius.default});exports.InputColumn=InputColumn;var InputContent=_styled.default.div(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n width: 100%;\n position: relative;\n grid-column: ",";\n height: 100%;\n"])),function(props){return props.withAddon?"2 / end":"1 / end"});exports.InputContent=InputContent;var InputContentRow=_styled.default.div(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n display: flex;\n position: relative;\n align-items: center;\n height: 100%;\n"])));exports.InputContentRow=InputContentRow;var InputIcon=_styled.default.div(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n position: relative;\n z-index: ",";\n display: flex;\n margin: auto;\n padding: 0 20px;\n align-items: center;\n justify-content: center;\n cursor: ",";\n color: ",";\n"])),function(props){return props.theme.zIndex.level1},function(props){return props.clickable?"pointer":"default"},function(props){return props.theme.colors.neutral.neutral5});exports.InputIcon=InputIcon;function inputPadding(props){var leftIcon=props.leftIcon,withIcon=props.withIcon;return leftIcon||withIcon?"0 0":"0 20px"}var Input=_styled.default.input(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n width: 100%;\n padding: ",";\n flex: 1;\n height: 100%;\n border: none;\n color: ",";\n &:disabled {\n color: ",";\n }\n\n &::placeholder {\n color: ",";\n }\n\n font-family: inherit;\n outline: none;\n font-size: ",";\n background-color: transparent;\n position: relative;\n font-weight: 500;\n"])),inputPadding,function(props){return props.theme.colors.neutral.black},function(_ref9){var theme=_ref9.theme;return theme.colors.neutral.neutral5},function(_ref10){var theme=_ref10.theme;return theme.colors.neutral.neutral5},function(props){return props.theme.fontSizes.xs});exports.Input=Input;var InputLabel=_styled.default.label(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["\n top: 0;\n left: 0;\n height: auto;\n padding: 0 6px;\n position: absolute;\n z-index: ",";\n pointer-events: none;\n color: ",";\n background-color: transparent;\n transform-origin: left;\n transition: all ease 0.2s;\n font-weight: 500;\n\n white-space: nowrap;\n max-width: ",";\n overflow: hidden;\n text-overflow: ellipsis;\n"])),function(props){return props.theme.zIndex.level1},function(props){return props.theme.colors.neutral.neutral3},function(_ref11){var withIcon=_ref11.withIcon;return withIcon?"65%":"85%"});exports.InputLabel=InputLabel;var Fieldset=_styled.default.fieldset(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n margin: 0;\n top: 0;\n pointer-events: none;\n padding: 0 17px;\n overflow: hidden;\n\n background-color: ",";\n\n border-radius: ",";\n border: 2px solid\n ",";\n border-left: ",";\n\n transition: all 0.2s ease;\n"])),function(_ref12){var alert=_ref12.alert,theme=_ref12.theme,hasDisabled=_ref12.hasDisabled;return alert&&!hasDisabled?"".concat(theme.colors[alert].blurred,"33"):hasDisabled?theme.colors.neutral.neutral1:"transparent"},function(props){return props.withAddon?"0 ".concat(props.theme.borderRadius.default," ").concat(props.theme.borderRadius.default," 0"):props.theme.borderRadius.default},function(_ref13){var theme=_ref13.theme,hasDisabled=_ref13.hasDisabled,alert=_ref13.alert;return alert&&!hasDisabled?theme.colors[alert].default:theme.colors.neutral.neutral2},function(props){return props.withAddon?"none !important":"auto"});exports.Fieldset=Fieldset;var Legend=_styled.default.legend(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n padding: 0;\n width: auto;\n max-width: 0.01px;\n font-size: 14px;\n height: 0px;\n visibility: hidden;\n transition: all 0.1s;\n"])));exports.Legend=Legend;var LegendText=_styled.default.span(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["\n padding: 0 2px;\n display: inline-block;\n visibility: hidden;\n"])));exports.LegendText=LegendText;var HelperText=_styled.default.span(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n font-size: ",";\n\n color: ",";\n padding: 0 20px;\n"])),function(props){return props.theme.fontSizes.xxs},function(props){return props.alert&&"success"!==props.alert?props.theme.colors[props.alert].default:props.theme.colors.neutral.neutral4});exports.HelperText=HelperText;var AddonElement=_styled.default.div(_templateObject13||(_templateObject13=_taggedTemplateLiteral(["\n padding: 0 20px;\n height: 100%;\n\n background-color: ",";\n\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ease;\n border: 2px solid\n ",";\n border-right: none;\n\n border-radius: "," 0 0\n ",";\n"])),function(props){return props.alert&&!props.hasDisabled?props.theme.colors[props.alert].default:props.hasDisabled?props.theme.colors.neutral.neutral2:props.theme.colors.neutral.neutral1},function(_ref14){var theme=_ref14.theme,hasDisabled=_ref14.hasDisabled,alert=_ref14.alert;return alert&&!hasDisabled?theme.colors[alert].default:theme.colors.neutral.neutral2},function(props){return props.theme.borderRadius.default},function(props){return props.theme.borderRadius.default});exports.AddonElement=AddonElement;
|
|
@@ -1,45 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = LabelInput;
|
|
7
|
-
var _react = require("@emotion/react");
|
|
8
|
-
var _getColorValue = require("../../utils/getColorValue");
|
|
9
|
-
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
10
|
-
var _styles = require("./styles");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
function LabelInput(_ref) {
|
|
14
|
-
var label = _ref.label,
|
|
15
|
-
_ref$labelType = _ref.labelType,
|
|
16
|
-
labelType = _ref$labelType === void 0 ? 'success' : _ref$labelType,
|
|
17
|
-
Icon = _ref.icon,
|
|
18
|
-
_ref$iconSide = _ref.iconSide,
|
|
19
|
-
iconSide = _ref$iconSide === void 0 ? 'left' : _ref$iconSide,
|
|
20
|
-
_ref$textColor = _ref.textColor,
|
|
21
|
-
textColor = _ref$textColor === void 0 ? '' : _ref$textColor,
|
|
22
|
-
_ref$backgroundColor = _ref.backgroundColor,
|
|
23
|
-
backgroundColor = _ref$backgroundColor === void 0 ? '' : _ref$backgroundColor;
|
|
24
|
-
var theme = (0, _react.useTheme)();
|
|
25
|
-
var parsedTextColor = (0, _getColorValue.getColorValue)(textColor, theme, theme.colors[labelType].default);
|
|
26
|
-
var parsedBackgroundColor = (0, _getColorValue.getColorValue)(backgroundColor, theme, theme.colors[labelType].blurred);
|
|
27
|
-
if (parsedTextColor.includes('.')) {
|
|
28
|
-
parsedTextColor = (0, _getColorValue.getThemeHex)(parsedTextColor, theme);
|
|
29
|
-
}
|
|
30
|
-
if (parsedBackgroundColor.includes('.')) {
|
|
31
|
-
parsedBackgroundColor = (0, _getColorValue.getThemeHex)(parsedTextColor, theme);
|
|
32
|
-
}
|
|
33
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.LabelWrapper, {
|
|
34
|
-
backgroundColor: parsedBackgroundColor,
|
|
35
|
-
color: parsedTextColor,
|
|
36
|
-
"data-testid": "label-wrapper",
|
|
37
|
-
children: [Icon && iconSide === 'left' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
38
|
-
name: Icon,
|
|
39
|
-
size: "16px"
|
|
40
|
-
}), label || 'default', Icon && iconSide === 'right' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
41
|
-
name: Icon,
|
|
42
|
-
size: "16px"
|
|
43
|
-
})]
|
|
44
|
-
});
|
|
45
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=LabelInput;var _react=require("@emotion/react"),_getColorValue=require("../../utils/getColorValue"),_Icon=_interopRequireDefault(require("../Icon")),_styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function LabelInput(_ref){var label=_ref.label,_ref$labelType=_ref.labelType,labelType=void 0===_ref$labelType?"success":_ref$labelType,Icon=_ref.icon,_ref$iconSide=_ref.iconSide,iconSide=void 0===_ref$iconSide?"left":_ref$iconSide,_ref$textColor=_ref.textColor,textColor=void 0===_ref$textColor?"":_ref$textColor,_ref$backgroundColor=_ref.backgroundColor,backgroundColor=void 0===_ref$backgroundColor?"":_ref$backgroundColor,theme=(0,_react.useTheme)(),parsedTextColor=(0,_getColorValue.getColorValue)(textColor,theme,theme.colors[labelType].default),parsedBackgroundColor=(0,_getColorValue.getColorValue)(backgroundColor,theme,theme.colors[labelType].blurred);return parsedTextColor.includes(".")&&(parsedTextColor=(0,_getColorValue.getThemeHex)(parsedTextColor,theme)),parsedBackgroundColor.includes(".")&&(parsedBackgroundColor=(0,_getColorValue.getThemeHex)(parsedTextColor,theme)),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.LabelWrapper,{backgroundColor:parsedBackgroundColor,color:parsedTextColor,"data-testid":"label-wrapper",children:[Icon&&"left"===iconSide&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:Icon,size:"16px"}),label||"default",Icon&&"right"===iconSide&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:Icon,size:"16px"})]})}
|