@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,73 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.OptionsSelect = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _useDisableBodyScroll = require("../../../../shared/hooks/useDisableBodyScroll");
|
|
9
|
-
var _useWindowSize2 = require("../../../../shared/hooks/useWindowSize");
|
|
10
|
-
var _styles = require("./styles");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
-
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."); }
|
|
14
|
-
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); }
|
|
15
|
-
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; }
|
|
16
|
-
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; } }
|
|
17
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
-
var OptionsSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
19
|
-
var open = _ref.open,
|
|
20
|
-
_ref$left = _ref.left,
|
|
21
|
-
left = _ref$left === void 0 ? '50vw' : _ref$left,
|
|
22
|
-
_ref$top = _ref.top,
|
|
23
|
-
top = _ref$top === void 0 ? '' : _ref$top,
|
|
24
|
-
_ref$offsetX = _ref.offsetX,
|
|
25
|
-
offsetX = _ref$offsetX === void 0 ? '0px' : _ref$offsetX,
|
|
26
|
-
_ref$disableScrollOnO = _ref.disableScrollOnOpen,
|
|
27
|
-
disableScrollOnOpen = _ref$disableScrollOnO === void 0 ? true : _ref$disableScrollOnO,
|
|
28
|
-
maxWidth = _ref.maxWidth,
|
|
29
|
-
minWidth = _ref.minWidth,
|
|
30
|
-
children = _ref.children;
|
|
31
|
-
var _useWindowSize = (0, _useWindowSize2.useWindowSize)(),
|
|
32
|
-
windowHeight = _useWindowSize.height;
|
|
33
|
-
var optionsContainerRef = (0, _react.useRef)(null);
|
|
34
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
|
35
|
-
return optionsContainerRef.current;
|
|
36
|
-
});
|
|
37
|
-
var _useState = (0, _react.useState)(function () {
|
|
38
|
-
var _optionsContainerRef$, _optionsContainerRef$2;
|
|
39
|
-
if (windowHeight - (((_optionsContainerRef$ = optionsContainerRef.current) === null || _optionsContainerRef$ === void 0 ? void 0 : (_optionsContainerRef$2 = _optionsContainerRef$.getBoundingClientRect()) === null || _optionsContainerRef$2 === void 0 ? void 0 : _optionsContainerRef$2.y) || 0) > 360) {
|
|
40
|
-
return '360px';
|
|
41
|
-
} else {
|
|
42
|
-
var _optionsContainerRef$3, _optionsContainerRef$4;
|
|
43
|
-
return "".concat(windowHeight - (((_optionsContainerRef$3 = optionsContainerRef.current) === null || _optionsContainerRef$3 === void 0 ? void 0 : (_optionsContainerRef$4 = _optionsContainerRef$3.getBoundingClientRect()) === null || _optionsContainerRef$4 === void 0 ? void 0 : _optionsContainerRef$4.y) || 0), "px");
|
|
44
|
-
}
|
|
45
|
-
}),
|
|
46
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
-
positionElement = _useState2[0],
|
|
48
|
-
setPositionElement = _useState2[1];
|
|
49
|
-
(0, _react.useEffect)(function () {
|
|
50
|
-
setPositionElement(function () {
|
|
51
|
-
var _optionsContainerRef$5, _optionsContainerRef$6;
|
|
52
|
-
if (windowHeight - (((_optionsContainerRef$5 = optionsContainerRef.current) === null || _optionsContainerRef$5 === void 0 ? void 0 : (_optionsContainerRef$6 = _optionsContainerRef$5.getBoundingClientRect()) === null || _optionsContainerRef$6 === void 0 ? void 0 : _optionsContainerRef$6.y) || 0) > 360) {
|
|
53
|
-
return '360px';
|
|
54
|
-
} else {
|
|
55
|
-
var _optionsContainerRef$7, _optionsContainerRef$8;
|
|
56
|
-
return "".concat(windowHeight - (((_optionsContainerRef$7 = optionsContainerRef.current) === null || _optionsContainerRef$7 === void 0 ? void 0 : (_optionsContainerRef$8 = _optionsContainerRef$7.getBoundingClientRect()) === null || _optionsContainerRef$8 === void 0 ? void 0 : _optionsContainerRef$8.y) || 0), "px");
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
(0, _useDisableBodyScroll.useDisableBodyScroll)(open && disableScrollOnOpen, 'child_element');
|
|
61
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.OptionsContainer, {
|
|
62
|
-
ref: optionsContainerRef,
|
|
63
|
-
open: open,
|
|
64
|
-
maxWidth: typeof maxWidth === 'number' ? "".concat(maxWidth, "px") : maxWidth,
|
|
65
|
-
minWidth: minWidth,
|
|
66
|
-
maxHeight: positionElement,
|
|
67
|
-
left: "calc(".concat(left, " + ").concat(offsetX, ")"),
|
|
68
|
-
top: top,
|
|
69
|
-
children: children
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
exports.OptionsSelect = OptionsSelect;
|
|
73
|
-
OptionsSelect.displayName = 'OptionsSelect';
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OptionsSelect=void 0;var _react=require("react"),_useDisableBodyScroll=require("../../../../shared/hooks/useDisableBodyScroll"),_useWindowSize2=require("../../../../shared/hooks/useWindowSize"),_styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime");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}var OptionsSelect=/*#__PURE__*/(0,_react.forwardRef)(function(_ref,ref){var open=_ref.open,_ref$left=_ref.left,left=void 0===_ref$left?"50vw":_ref$left,_ref$top=_ref.top,top=void 0===_ref$top?"":_ref$top,_ref$offsetX=_ref.offsetX,offsetX=void 0===_ref$offsetX?"0px":_ref$offsetX,_ref$disableScrollOnO=_ref.disableScrollOnOpen,maxWidth=_ref.maxWidth,minWidth=_ref.minWidth,children=_ref.children,_useWindowSize=(0,_useWindowSize2.useWindowSize)(),windowHeight=_useWindowSize.height,optionsContainerRef=(0,_react.useRef)(null);(0,_react.useImperativeHandle)(ref,function(){return optionsContainerRef.current});var _useState=(0,_react.useState)(function(){var _optionsContainerRef$,_optionsContainerRef$2;if(360<windowHeight-((null===(_optionsContainerRef$=optionsContainerRef.current)||void 0===_optionsContainerRef$||null===(_optionsContainerRef$2=_optionsContainerRef$.getBoundingClientRect())||void 0===_optionsContainerRef$2?void 0:_optionsContainerRef$2.y)||0))return"360px";var _optionsContainerRef$3,_optionsContainerRef$4;return"".concat(windowHeight-((null===(_optionsContainerRef$3=optionsContainerRef.current)||void 0===_optionsContainerRef$3||null===(_optionsContainerRef$4=_optionsContainerRef$3.getBoundingClientRect())||void 0===_optionsContainerRef$4?void 0:_optionsContainerRef$4.y)||0),"px")}),_useState2=_slicedToArray(_useState,2),positionElement=_useState2[0],setPositionElement=_useState2[1];return(0,_react.useEffect)(function(){setPositionElement(function(){var _optionsContainerRef$5,_optionsContainerRef$6;if(360<windowHeight-((null===(_optionsContainerRef$5=optionsContainerRef.current)||void 0===_optionsContainerRef$5||null===(_optionsContainerRef$6=_optionsContainerRef$5.getBoundingClientRect())||void 0===_optionsContainerRef$6?void 0:_optionsContainerRef$6.y)||0))return"360px";var _optionsContainerRef$7,_optionsContainerRef$8;return"".concat(windowHeight-((null===(_optionsContainerRef$7=optionsContainerRef.current)||void 0===_optionsContainerRef$7||null===(_optionsContainerRef$8=_optionsContainerRef$7.getBoundingClientRect())||void 0===_optionsContainerRef$8?void 0:_optionsContainerRef$8.y)||0),"px")})}),(0,_useDisableBodyScroll.useDisableBodyScroll)(open&&(void 0===_ref$disableScrollOnO||_ref$disableScrollOnO),"child_element"),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.OptionsContainer,{ref:optionsContainerRef,open:open,maxWidth:"number"==typeof maxWidth?"".concat(maxWidth,"px"):maxWidth,minWidth:minWidth,maxHeight:positionElement,left:"calc(".concat(left," + ").concat(offsetX,")"),top:top,children:children})});exports.OptionsSelect=OptionsSelect,OptionsSelect.displayName="OptionsSelect";
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.OptionsContainer = void 0;
|
|
7
|
-
var _react = require("@emotion/react");
|
|
8
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
-
var _framerMotion = require("framer-motion");
|
|
10
|
-
var _templateObject;
|
|
11
|
-
var _excluded = ["theme"];
|
|
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
|
-
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; }
|
|
15
|
-
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; }
|
|
16
|
-
var OptionsContainer = (0, _styled.default)(_framerMotion.motion.div)(function (_ref) {
|
|
17
|
-
var theme = _ref.theme,
|
|
18
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
-
return (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: ", ";\n min-width: ", ";\n max-height: calc(", " - 20px);\n position: fixed;\n left: ", ";\n top: ", ";\n z-index: ", ";\n opacity: ", ";\n pointer-events: ", ";\n transition: opacity ease ", ";\n overflow-y: auto;\n overflow-x: hidden;\n background: ", ";\n border: 2px solid ", ";\n border-radius: ", ";\n\n &::-webkit-scrollbar {\n width: 6px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n border-radius: ", ";\n background: ", ";\n }\n li {\n list-style: none;\n }\n "])), props.maxWidth, props.minWidth || 'initial', props.maxHeight, props.left, props.top, theme.zIndex.level24, props.open ? 1 : 0, props.open ? 'auto' : 'none', theme.transition.speed, theme.colors.neutral.white, theme.colors.neutral.neutral1, theme.borderRadius.default, theme.borderRadius.default, theme.colors.primary.default);
|
|
20
|
-
});
|
|
21
|
-
exports.OptionsContainer = OptionsContainer;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OptionsContainer=void 0;var _templateObject,_react=require("@emotion/react"),_styled=_interopRequireDefault(require("@emotion/styled")),_framerMotion=require("framer-motion"),_excluded=["theme"];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)}}))}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 OptionsContainer=(0,_styled.default)(_framerMotion.motion.div)(function(_ref){var theme=_ref.theme,props=_objectWithoutProperties(_ref,_excluded);return(0,_react.css)(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: ",";\n min-width: ",";\n max-height: calc("," - 20px);\n position: fixed;\n left: ",";\n top: ",";\n z-index: ",";\n opacity: ",";\n pointer-events: ",";\n transition: opacity ease ",";\n overflow-y: auto;\n overflow-x: hidden;\n background: ",";\n border: 2px solid ",";\n border-radius: ",";\n\n &::-webkit-scrollbar {\n width: 6px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n border-radius: ",";\n background: ",";\n }\n li {\n list-style: none;\n }\n "])),props.maxWidth,props.minWidth||"initial",props.maxHeight,props.left,props.top,theme.zIndex.level24,props.open?1:0,props.open?"auto":"none",theme.transition.speed,theme.colors.neutral.white,theme.colors.neutral.neutral1,theme.borderRadius.default,theme.borderRadius.default,theme.colors.primary.default)});exports.OptionsContainer=OptionsContainer;
|
|
@@ -1,247 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _useOnClickOutside = require("../../shared/hooks/useOnClickOutside");
|
|
10
|
-
var _Flex = _interopRequireDefault(require("../Flex"));
|
|
11
|
-
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
12
|
-
var _ReactPortal = require("../ReactPortal");
|
|
13
|
-
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
14
|
-
var _OptionsSelect = require("./components/OptionsSelect");
|
|
15
|
-
var _styles = require("./styles");
|
|
16
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
var _excluded = ["label", "placeholder", "options", "alert", "helperText", "width", "sizeSelect", "variant", "optionsMinWidth"];
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
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; }
|
|
20
|
-
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; }
|
|
21
|
-
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; }
|
|
22
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
23
|
-
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); }
|
|
24
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
|
-
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."); }
|
|
26
|
-
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); }
|
|
27
|
-
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; }
|
|
28
|
-
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; } }
|
|
29
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
30
|
-
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; }
|
|
31
|
-
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; }
|
|
32
|
-
var Select = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
33
|
-
var _containerRef$current, _optionsModalRef$curr, _options$selectedOpti2, _containerRef$current3, _containerRef$current4, _containerRef$current5, _containerRef$current6;
|
|
34
|
-
var _ref$label = _ref.label,
|
|
35
|
-
label = _ref$label === void 0 ? '' : _ref$label,
|
|
36
|
-
_ref$placeholder = _ref.placeholder,
|
|
37
|
-
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
38
|
-
options = _ref.options,
|
|
39
|
-
alert = _ref.alert,
|
|
40
|
-
helperText = _ref.helperText,
|
|
41
|
-
width = _ref.width,
|
|
42
|
-
sizeSelect = _ref.sizeSelect,
|
|
43
|
-
variant = _ref.variant,
|
|
44
|
-
optionsMinWidth = _ref.optionsMinWidth,
|
|
45
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
-
var containerRef = (0, _react.useRef)(null);
|
|
47
|
-
var selectRef = (0, _react.useRef)(null);
|
|
48
|
-
var _useState = (0, _react.useState)(false),
|
|
49
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
-
optionsMenuOpen = _useState2[0],
|
|
51
|
-
setOptionsMenuOpen = _useState2[1];
|
|
52
|
-
var _useState3 = (0, _react.useState)(),
|
|
53
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
54
|
-
selectedOption = _useState4[0],
|
|
55
|
-
setSelectedOption = _useState4[1];
|
|
56
|
-
var _useState5 = (0, _react.useState)(false),
|
|
57
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
58
|
-
filled = _useState6[0],
|
|
59
|
-
setFilled = _useState6[1];
|
|
60
|
-
var inputRef = (0, _react.useRef)(null);
|
|
61
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
|
62
|
-
return inputRef.current;
|
|
63
|
-
});
|
|
64
|
-
var isBooleanOptions = options.find(function (option) {
|
|
65
|
-
return typeof option.value === 'boolean';
|
|
66
|
-
});
|
|
67
|
-
var valueProperty = isBooleanOptions ? 'checked' : 'value';
|
|
68
|
-
var selectOption = (0, _react.useCallback)(function (option) {
|
|
69
|
-
if (inputRef.current) {
|
|
70
|
-
var _nativeInputValueSett;
|
|
71
|
-
var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, valueProperty);
|
|
72
|
-
nativeInputValueSetter === null || nativeInputValueSetter === void 0 ? void 0 : (_nativeInputValueSett = nativeInputValueSetter.set) === null || _nativeInputValueSett === void 0 ? void 0 : _nativeInputValueSett.call(inputRef.current, option === undefined ? '' : options[option].value);
|
|
73
|
-
var event = new Event(isBooleanOptions ? 'click' : 'input', {
|
|
74
|
-
bubbles: true
|
|
75
|
-
});
|
|
76
|
-
inputRef.current.dispatchEvent(event);
|
|
77
|
-
}
|
|
78
|
-
setOptionsMenuOpen(false);
|
|
79
|
-
setSelectedOption(option);
|
|
80
|
-
setFilled(option !== undefined);
|
|
81
|
-
}, [isBooleanOptions, options]);
|
|
82
|
-
|
|
83
|
-
// Sets default value
|
|
84
|
-
(0, _react.useEffect)(function () {
|
|
85
|
-
if (rest.defaultValue) {
|
|
86
|
-
var defaultOptionIndex = options === null || options === void 0 ? void 0 : options.findIndex(function (c) {
|
|
87
|
-
return String(c.value) === String(rest.defaultValue);
|
|
88
|
-
});
|
|
89
|
-
if (defaultOptionIndex >= 0) selectOption(defaultOptionIndex);
|
|
90
|
-
}
|
|
91
|
-
return function () {
|
|
92
|
-
selectOption(undefined);
|
|
93
|
-
};
|
|
94
|
-
}, []);
|
|
95
|
-
var updateOption = (0, _react.useCallback)(function () {
|
|
96
|
-
var _inputRef$current, _options$selectedOpti;
|
|
97
|
-
if (selectedOption === undefined || ((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current[valueProperty]) !== ((_options$selectedOpti = options[selectedOption]) === null || _options$selectedOpti === void 0 ? void 0 : _options$selectedOpti.value)) {
|
|
98
|
-
var _inputRef$current2;
|
|
99
|
-
if (!isBooleanOptions && ((_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.value) === '' && selectedOption !== undefined) {
|
|
100
|
-
selectOption();
|
|
101
|
-
} else {
|
|
102
|
-
var optionIndex = options === null || options === void 0 ? void 0 : options.findIndex(function (c) {
|
|
103
|
-
var _inputRef$current3;
|
|
104
|
-
return c.value === ((_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3[valueProperty]);
|
|
105
|
-
});
|
|
106
|
-
if (optionIndex >= 0) selectOption(optionIndex);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}, [isBooleanOptions, options, selectOption, selectedOption]);
|
|
110
|
-
|
|
111
|
-
// Assures the option is selected throughout renders.
|
|
112
|
-
(0, _react.useEffect)(function () {
|
|
113
|
-
updateOption();
|
|
114
|
-
});
|
|
115
|
-
var _useState7 = (0, _react.useState)((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.getBoundingClientRect().top),
|
|
116
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
117
|
-
positionContainer = _useState8[0],
|
|
118
|
-
setPositionContainer = _useState8[1];
|
|
119
|
-
var optionsModalRef = (0, _react.useRef)(null);
|
|
120
|
-
var _useState9 = (0, _react.useState)((_optionsModalRef$curr = optionsModalRef.current) === null || _optionsModalRef$curr === void 0 ? void 0 : _optionsModalRef$curr.getBoundingClientRect().height),
|
|
121
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
122
|
-
heightModal = _useState10[0],
|
|
123
|
-
setHeightModal = _useState10[1];
|
|
124
|
-
function handleRepositionModal() {
|
|
125
|
-
var _containerRef$current2, _optionsModalRef$curr2;
|
|
126
|
-
setPositionContainer((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.getBoundingClientRect().top);
|
|
127
|
-
setHeightModal((_optionsModalRef$curr2 = optionsModalRef.current) === null || _optionsModalRef$curr2 === void 0 ? void 0 : _optionsModalRef$curr2.getBoundingClientRect().height);
|
|
128
|
-
}
|
|
129
|
-
(0, _react.useEffect)(function () {
|
|
130
|
-
var modalParent = document.querySelector('[data-scroll=dispatch-scroll]');
|
|
131
|
-
var handler = function handler() {
|
|
132
|
-
if (optionsMenuOpen) {
|
|
133
|
-
setOptionsMenuOpen(false);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
modalParent === null || modalParent === void 0 ? void 0 : modalParent.addEventListener('scroll', handler);
|
|
137
|
-
return function () {
|
|
138
|
-
return modalParent === null || modalParent === void 0 ? void 0 : modalParent.removeEventListener('scroll', handler);
|
|
139
|
-
};
|
|
140
|
-
}, [optionsMenuOpen]);
|
|
141
|
-
(0, _useOnClickOutside.useOnClickOutside)([selectRef, optionsModalRef], function () {
|
|
142
|
-
setOptionsMenuOpen(false);
|
|
143
|
-
});
|
|
144
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
145
|
-
ref: selectRef,
|
|
146
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Flex.default, {
|
|
147
|
-
direction: "column",
|
|
148
|
-
style: {
|
|
149
|
-
width: '100%'
|
|
150
|
-
},
|
|
151
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.SelectContainer, {
|
|
152
|
-
"data-testid": "select",
|
|
153
|
-
size: sizeSelect || 'md',
|
|
154
|
-
filled: filled || !!placeholder,
|
|
155
|
-
alert: alert,
|
|
156
|
-
disabled: !!rest.disabled,
|
|
157
|
-
width: width,
|
|
158
|
-
tabIndex: rest.disabled ? -1 : 0,
|
|
159
|
-
onMouseOver: handleRepositionModal,
|
|
160
|
-
onClick: function onClick() {
|
|
161
|
-
if (!rest.disabled) setOptionsMenuOpen(!optionsMenuOpen);
|
|
162
|
-
handleRepositionModal();
|
|
163
|
-
},
|
|
164
|
-
className: rest.className,
|
|
165
|
-
style: rest.style,
|
|
166
|
-
variant: variant,
|
|
167
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
168
|
-
ref: containerRef,
|
|
169
|
-
children: [label && variant !== 'unstyled' && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
170
|
-
children: label
|
|
171
|
-
}), selectedOption === undefined ?
|
|
172
|
-
/*#__PURE__*/
|
|
173
|
-
// Value label
|
|
174
|
-
(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
175
|
-
fontSize: "xs",
|
|
176
|
-
fontWeight: "500",
|
|
177
|
-
color: "neutral.neutral3",
|
|
178
|
-
children: placeholder || ''
|
|
179
|
-
}) :
|
|
180
|
-
/*#__PURE__*/
|
|
181
|
-
// Placeholder label
|
|
182
|
-
(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
183
|
-
fontSize: "xs",
|
|
184
|
-
fontWeight: "500",
|
|
185
|
-
color: "inherit",
|
|
186
|
-
children: (_options$selectedOpti2 = options[selectedOption]) === null || _options$selectedOpti2 === void 0 ? void 0 : _options$selectedOpti2.label
|
|
187
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
188
|
-
name: "chevron-down"
|
|
189
|
-
}), variant !== 'unstyled' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
190
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("fieldset", {
|
|
191
|
-
children: !!label && /*#__PURE__*/(0, _jsxRuntime.jsx)("legend", {
|
|
192
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
193
|
-
fontSize: "xxs",
|
|
194
|
-
variant: "span",
|
|
195
|
-
children: label
|
|
196
|
-
})
|
|
197
|
-
})
|
|
198
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("fieldset", {
|
|
199
|
-
children: !!label && /*#__PURE__*/(0, _jsxRuntime.jsx)("legend", {
|
|
200
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
201
|
-
fontSize: "xxs",
|
|
202
|
-
variant: "span",
|
|
203
|
-
children: label
|
|
204
|
-
})
|
|
205
|
-
})
|
|
206
|
-
})]
|
|
207
|
-
})]
|
|
208
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread({
|
|
209
|
-
ref: inputRef,
|
|
210
|
-
type: isBooleanOptions && 'checkbox',
|
|
211
|
-
tabIndex: -1
|
|
212
|
-
}, rest))]
|
|
213
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ReactPortal.ReactPortal, {
|
|
214
|
-
wrapperId: "portal-root",
|
|
215
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OptionsSelect.OptionsSelect, {
|
|
216
|
-
open: optionsMenuOpen,
|
|
217
|
-
left: "".concat((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getBoundingClientRect().left, "px"),
|
|
218
|
-
top: Number(positionContainer) < 470 ? "calc(".concat(((_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.getBoundingClientRect().bottom) || 0, "px + 10px)") : "calc(".concat(((_containerRef$current5 = containerRef.current) === null || _containerRef$current5 === void 0 ? void 0 : _containerRef$current5.getBoundingClientRect().top) || 0, "px - ").concat(heightModal && heightModal + 10, "px)"),
|
|
219
|
-
ref: optionsModalRef,
|
|
220
|
-
maxWidth: "".concat((_containerRef$current6 = containerRef.current) === null || _containerRef$current6 === void 0 ? void 0 : _containerRef$current6.getBoundingClientRect().width, "px"),
|
|
221
|
-
minWidth: optionsMinWidth,
|
|
222
|
-
children: [!!placeholder && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.OptionPlaceholder, {
|
|
223
|
-
item: true,
|
|
224
|
-
onClick: function onClick() {
|
|
225
|
-
return selectOption(undefined);
|
|
226
|
-
},
|
|
227
|
-
children: placeholder
|
|
228
|
-
}), options === null || options === void 0 ? void 0 : options.map(function (option, i) {
|
|
229
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Option, {
|
|
230
|
-
sizeSelect: sizeSelect,
|
|
231
|
-
onClick: function onClick() {
|
|
232
|
-
selectOption(i);
|
|
233
|
-
},
|
|
234
|
-
children: option.label
|
|
235
|
-
}, i);
|
|
236
|
-
})]
|
|
237
|
-
})
|
|
238
|
-
}), !!helperText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.HelperText, {
|
|
239
|
-
alert: alert,
|
|
240
|
-
children: helperText
|
|
241
|
-
})]
|
|
242
|
-
})
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
Select.displayName = 'Select';
|
|
246
|
-
var _default = Select;
|
|
247
|
-
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"),_useOnClickOutside=require("../../shared/hooks/useOnClickOutside"),_Flex=_interopRequireDefault(require("../Flex")),_Icon=_interopRequireDefault(require("../Icon")),_ReactPortal=require("../ReactPortal"),_Typography=_interopRequireDefault(require("../Typography")),_OptionsSelect=require("./components/OptionsSelect"),_styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["label","placeholder","options","alert","helperText","width","sizeSelect","variant","optionsMinWidth"];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 Select=/*#__PURE__*/(0,_react.forwardRef)(function(_ref,ref){function handleRepositionModal(){var _containerRef$current2,_optionsModalRef$curr2;setPositionContainer(null===(_containerRef$current2=containerRef.current)||void 0===_containerRef$current2?void 0:_containerRef$current2.getBoundingClientRect().top),setHeightModal(null===(_optionsModalRef$curr2=optionsModalRef.current)||void 0===_optionsModalRef$curr2?void 0:_optionsModalRef$curr2.getBoundingClientRect().height)}var _containerRef$current,_optionsModalRef$curr,_options$selectedOpti2,_containerRef$current3,_containerRef$current4,_containerRef$current5,_containerRef$current6,_ref$label=_ref.label,label=void 0===_ref$label?"":_ref$label,_ref$placeholder=_ref.placeholder,placeholder=void 0===_ref$placeholder?"":_ref$placeholder,options=_ref.options,alert=_ref.alert,helperText=_ref.helperText,width=_ref.width,sizeSelect=_ref.sizeSelect,variant=_ref.variant,optionsMinWidth=_ref.optionsMinWidth,rest=_objectWithoutProperties(_ref,_excluded),containerRef=(0,_react.useRef)(null),selectRef=(0,_react.useRef)(null),_useState=(0,_react.useState)(!1),_useState2=_slicedToArray(_useState,2),optionsMenuOpen=_useState2[0],setOptionsMenuOpen=_useState2[1],_useState3=(0,_react.useState)(),_useState4=_slicedToArray(_useState3,2),selectedOption=_useState4[0],setSelectedOption=_useState4[1],_useState5=(0,_react.useState)(!1),_useState6=_slicedToArray(_useState5,2),filled=_useState6[0],setFilled=_useState6[1],inputRef=(0,_react.useRef)(null);(0,_react.useImperativeHandle)(ref,function(){return inputRef.current});var isBooleanOptions=options.find(function(option){return"boolean"==typeof option.value}),valueProperty=isBooleanOptions?"checked":"value",selectOption=(0,_react.useCallback)(function(option){if(inputRef.current){var _nativeInputValueSett,nativeInputValueSetter=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,valueProperty);null===nativeInputValueSetter||void 0===nativeInputValueSetter||null===(_nativeInputValueSett=nativeInputValueSetter.set)||void 0===_nativeInputValueSett?void 0:_nativeInputValueSett.call(inputRef.current,void 0===option?"":options[option].value);var event=new Event(isBooleanOptions?"click":"input",{bubbles:!0});inputRef.current.dispatchEvent(event)}setOptionsMenuOpen(!1),setSelectedOption(option),setFilled(void 0!==option)},[isBooleanOptions,options]);(0,_react.useEffect)(function(){if(rest.defaultValue){var defaultOptionIndex=null===options||void 0===options?void 0:options.findIndex(function(c){return c.value+""===rest.defaultValue+""});0<=defaultOptionIndex&&selectOption(defaultOptionIndex)}return function(){selectOption(void 0)}},[]);var updateOption=(0,_react.useCallback)(function(){var _inputRef$current,_options$selectedOpti;if(void 0===selectedOption||(null===(_inputRef$current=inputRef.current)||void 0===_inputRef$current?void 0:_inputRef$current[valueProperty])!==(null===(_options$selectedOpti=options[selectedOption])||void 0===_options$selectedOpti?void 0:_options$selectedOpti.value)){var _inputRef$current2;if(!isBooleanOptions&&""===(null===(_inputRef$current2=inputRef.current)||void 0===_inputRef$current2?void 0:_inputRef$current2.value)&&void 0!==selectedOption)selectOption();else{var optionIndex=null===options||void 0===options?void 0:options.findIndex(function(c){var _inputRef$current3;return c.value===(null===(_inputRef$current3=inputRef.current)||void 0===_inputRef$current3?void 0:_inputRef$current3[valueProperty])});0<=optionIndex&&selectOption(optionIndex)}}},[isBooleanOptions,options,selectOption,selectedOption]);// Assures the option is selected throughout renders.
|
|
2
|
+
(0,_react.useEffect)(function(){updateOption()});var _useState7=(0,_react.useState)(null===(_containerRef$current=containerRef.current)||void 0===_containerRef$current?void 0:_containerRef$current.getBoundingClientRect().top),_useState8=_slicedToArray(_useState7,2),positionContainer=_useState8[0],setPositionContainer=_useState8[1],optionsModalRef=(0,_react.useRef)(null),_useState9=(0,_react.useState)(null===(_optionsModalRef$curr=optionsModalRef.current)||void 0===_optionsModalRef$curr?void 0:_optionsModalRef$curr.getBoundingClientRect().height),_useState10=_slicedToArray(_useState9,2),heightModal=_useState10[0],setHeightModal=_useState10[1];return(0,_react.useEffect)(function(){var modalParent=document.querySelector("[data-scroll=dispatch-scroll]"),handler=function(){optionsMenuOpen&&setOptionsMenuOpen(!1)};return null===modalParent||void 0===modalParent?void 0:modalParent.addEventListener("scroll",handler),function(){return null===modalParent||void 0===modalParent?void 0:modalParent.removeEventListener("scroll",handler)}},[optionsMenuOpen]),(0,_useOnClickOutside.useOnClickOutside)([selectRef,optionsModalRef],function(){setOptionsMenuOpen(!1)}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{ref:selectRef,children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",style:{width:"100%"},children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.SelectContainer,{"data-testid":"select",size:sizeSelect||"md",filled:filled||!!placeholder,alert:alert,disabled:!!rest.disabled,width:width,tabIndex:rest.disabled?-1:0,onMouseOver:handleRepositionModal,onClick:function onClick(){rest.disabled||setOptionsMenuOpen(!optionsMenuOpen),handleRepositionModal()},className:rest.className,style:rest.style,variant:variant,children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{ref:containerRef,children:[label&&"unstyled"!==variant&&/*#__PURE__*/(0,_jsxRuntime.jsx)("label",{children:label}),void 0===selectedOption?/*#__PURE__*/ // Value label
|
|
3
|
+
(0,_jsxRuntime.jsx)(_Typography.default,{fontSize:"xs",fontWeight:"500",color:"neutral.neutral3",children:placeholder||""}):/*#__PURE__*/ // Placeholder label
|
|
4
|
+
(0,_jsxRuntime.jsx)(_Typography.default,{fontSize:"xs",fontWeight:"500",color:"inherit",children:null===(_options$selectedOpti2=options[selectedOption])||void 0===_options$selectedOpti2?void 0:_options$selectedOpti2.label}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"chevron-down"}),"unstyled"!==variant&&/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("fieldset",{children:!!label&&/*#__PURE__*/(0,_jsxRuntime.jsx)("legend",{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Typography.default,{fontSize:"xxs",variant:"span",children:label})})}),/*#__PURE__*/(0,_jsxRuntime.jsx)("fieldset",{children:!!label&&/*#__PURE__*/(0,_jsxRuntime.jsx)("legend",{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Typography.default,{fontSize:"xxs",variant:"span",children:label})})})]})]}),/*#__PURE__*/(0,_jsxRuntime.jsx)("input",_objectSpread({ref:inputRef,type:isBooleanOptions&&"checkbox",tabIndex:-1},rest))]}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_ReactPortal.ReactPortal,{wrapperId:"portal-root",children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_OptionsSelect.OptionsSelect,{open:optionsMenuOpen,left:"".concat(null===(_containerRef$current3=containerRef.current)||void 0===_containerRef$current3?void 0:_containerRef$current3.getBoundingClientRect().left,"px"),top:470>+positionContainer?"calc(".concat((null===(_containerRef$current4=containerRef.current)||void 0===_containerRef$current4?void 0:_containerRef$current4.getBoundingClientRect().bottom)||0,"px + 10px)"):"calc(".concat((null===(_containerRef$current5=containerRef.current)||void 0===_containerRef$current5?void 0:_containerRef$current5.getBoundingClientRect().top)||0,"px - ").concat(heightModal&&heightModal+10,"px)"),ref:optionsModalRef,maxWidth:"".concat(null===(_containerRef$current6=containerRef.current)||void 0===_containerRef$current6?void 0:_containerRef$current6.getBoundingClientRect().width,"px"),minWidth:optionsMinWidth,children:[!!placeholder&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.OptionPlaceholder,{item:!0,onClick:function onClick(){return selectOption(void 0)},children:placeholder}),null===options||void 0===options?void 0:options.map(function(option,i){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Option,{sizeSelect:sizeSelect,onClick:function onClick(){selectOption(i)},children:option.label},i)})]})}),!!helperText&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.HelperText,{alert:alert,children:helperText})]})})});Select.displayName="Select";var _default=Select;exports.default=_default;
|
|
@@ -1,58 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("@testing-library/jest-dom");
|
|
4
|
-
var _react = require("@testing-library/react");
|
|
5
|
-
var _testUtils = require("../../shared/tests/test-utils");
|
|
6
|
-
var _ = _interopRequireDefault(require("."));
|
|
7
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
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); }
|
|
10
|
-
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; }
|
|
11
|
-
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; }
|
|
12
|
-
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; }
|
|
13
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
-
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); }
|
|
15
|
-
var setup = function setup(props) {
|
|
16
|
-
return _objectSpread({}, (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, _objectSpread({}, props))));
|
|
17
|
-
};
|
|
18
|
-
describe('Select', function () {
|
|
19
|
-
it('should render the select component', function () {
|
|
20
|
-
var _setup = setup({
|
|
21
|
-
label: 'Select',
|
|
22
|
-
options: [{
|
|
23
|
-
label: 'Option 1',
|
|
24
|
-
value: 'option-1'
|
|
25
|
-
}]
|
|
26
|
-
}),
|
|
27
|
-
container = _setup.container;
|
|
28
|
-
expect(container).toBeInTheDocument();
|
|
29
|
-
});
|
|
30
|
-
it('should select an option', function () {
|
|
31
|
-
var container = setup({
|
|
32
|
-
label: 'Select',
|
|
33
|
-
options: [{
|
|
34
|
-
label: 'Option 1',
|
|
35
|
-
value: 'option-1'
|
|
36
|
-
}]
|
|
37
|
-
});
|
|
38
|
-
var option = container.getByText('Option 1');
|
|
39
|
-
var input = container.baseElement.querySelector('input');
|
|
40
|
-
_react.fireEvent.click(option);
|
|
41
|
-
expect(input === null || input === void 0 ? void 0 : input.value).toBe('option-1');
|
|
42
|
-
});
|
|
43
|
-
it('Should render a select with sm size', function () {
|
|
44
|
-
var container = setup({
|
|
45
|
-
sizeSelect: 'sm',
|
|
46
|
-
label: 'Select',
|
|
47
|
-
options: [{
|
|
48
|
-
label: 'Option 1',
|
|
49
|
-
value: 'option-1'
|
|
50
|
-
}]
|
|
51
|
-
});
|
|
52
|
-
var select = container.getByTestId('select');
|
|
53
|
-
expect(select).toHaveStyle({
|
|
54
|
-
height: '36px',
|
|
55
|
-
width: '78px'
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|
|
1
|
+
"use strict";require("@testing-library/jest-dom");var _react=require("@testing-library/react"),_testUtils=require("../../shared/tests/test-utils"),_=_interopRequireDefault(require(".")),_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){return _objectSpread({},(0,_testUtils.render)(/*#__PURE__*/(0,_jsxRuntime.jsx)(_.default,_objectSpread({},props))))};describe("Select",function(){it("should render the select component",function(){var _setup=setup({label:"Select",options:[{label:"Option 1",value:"option-1"}]}),container=_setup.container;expect(container).toBeInTheDocument()}),it("should select an option",function(){var container=setup({label:"Select",options:[{label:"Option 1",value:"option-1"}]}),option=container.getByText("Option 1"),input=container.baseElement.querySelector("input");_react.fireEvent.click(option),expect(null===input||void 0===input?void 0:input.value).toBe("option-1")}),it("Should render a select with sm size",function(){var container=setup({sizeSelect:"sm",label:"Select",options:[{label:"Option 1",value:"option-1"}]}),select=container.getByTestId("select");expect(select).toHaveStyle({height:"36px",width:"78px"})})});
|
|
@@ -1,46 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SelectContainer = exports.OptionPlaceholder = exports.Option = exports.HelperText = void 0;
|
|
7
|
-
var _react = require("@emotion/react");
|
|
8
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
-
var _List = _interopRequireDefault(require("../List"));
|
|
10
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
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 SelectContainer = _styled.default.div(function (props) {
|
|
14
|
-
return (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n outline: none;\n user-select: none;\n width: ", ";\n background: ", ";\n\n height: ", ";\n ", ";\n & > div {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n border-radius: ", ";\n padding: 0\n ", ";\n width: 100%;\n height: 100%;\n position: relative;\n cursor: pointer;\n color: ", ";\n transition: background-color ease;\n transition-duration: ", ";\n\n ", ";\n\n ", ";\n\n & > label {\n position: absolute;\n left: 20px;\n top: 50%;\n transform: translateY(-50%);\n font-size: 1rem;\n font-weight: 500;\n color: ", ";\n transition: top ease, left ease, color ease;\n transition-duration: ", ";\n\n background: ", ";\n padding: 0 4px;\n z-index: 1;\n white-space: nowrap;\n max-width: 65%;\n overflow: hidden;\n text-overflow: ellipsis;\n\n ", "\n }\n\n & > .select--placeholder {\n white-space: nowrap;\n max-width: 75%;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n // Chevron Down icon\n & > svg {\n flex-shrink: 0;\n transform: rotate(0deg);\n color: ", ";\n transition: transform ease;\n transition-duration: ", ";\n }\n\n & > fieldset {\n border: 2px solid;\n border-color: ", ";\n border-radius: ", ";\n padding: 0 14px;\n position: absolute;\n left: 0px;\n right: 0px;\n top: 0px;\n bottom: 0px;\n pointer-events: none;\n transition: border-color ease;\n transition-duration: ", ";\n\n &:last-of-type {\n border-radius: calc(", " + 2px);\n padding: 0 16px;\n border-color: transparent;\n left: -2px;\n right: -2px;\n top: -2px;\n bottom: -2px;\n }\n\n & > legend {\n display: ", ";\n line-height: 2px;\n user-select: none;\n padding: 0 4px;\n & > span {\n color: transparent;\n }\n }\n }\n }\n\n & > input {\n appearance: none;\n border: 0;\n width: 0px;\n position: absolute;\n opacity: 0;\n pointer-events: none;\n }\n "])), props.size ? {
|
|
15
|
-
sm: '78px',
|
|
16
|
-
md: '100%'
|
|
17
|
-
}[props.size] : props.width, props.theme.colors.neutral.white, props.variant === 'unstyled' ? 'auto' : props.size ? {
|
|
18
|
-
sm: '36px',
|
|
19
|
-
md: '56px'
|
|
20
|
-
}[props.size] : '56px', !props.disabled && (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &:hover {\n & > div {\n color: ", ";\n\n & > label {\n color: ", ";\n }\n\n & > fieldset {\n &:first-of-type {\n border-color: ", ";\n }\n }\n }\n }\n\n &:focus {\n & > div {\n color: ", ";\n\n & > svg {\n transform: rotate(180deg);\n }\n\n & > fieldset {\n &:first-of-type {\n border-color: ", ";\n }\n &:last-of-type {\n border-color: ", ";\n }\n }\n }\n }\n "])), props.theme.colors.neutral.black, props.theme.colors.neutral.neutral5, props.alert ? props.theme.colors[props.alert].blurred : props.theme.colors.primary.hover, props.theme.colors.neutral.black, props.alert ? props.theme.colors[props.alert].default : props.theme.colors.primary.hover, props.alert ? props.theme.colors[props.alert].blurred : props.theme.colors.primary.disabled), props.theme.borderRadius.default, props.variant === 'unstyled' ? '0' : props.size && {
|
|
21
|
-
sm: '16px',
|
|
22
|
-
md: '20px'
|
|
23
|
-
}[props.size], props.theme.colors.neutral.neutral5, props.theme.transition.speed, props.alert && (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background: ", "33;\n "])), props.theme.colors[props.alert].blurred), props.disabled && (0, _react.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background: ", ";\n cursor: default;\n "])), props.theme.colors.neutral.neutral1), props.theme.colors.neutral.neutral3, props.theme.transition.speed, props.theme.colors.neutral.white, props.filled && (0, _react.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n left: 20px;\n top: -1px;\n font-size: 0.875rem;\n "]))), props.theme.colors.neutral.neutral5, props.theme.transition.speed, props.alert && !props.disabled ? props.theme.colors[props.alert].default : props.theme.colors.neutral.neutral2, props.theme.borderRadius.default, props.theme.transition.speed, props.theme.borderRadius.default, props.filled ? 'block' : 'none');
|
|
24
|
-
});
|
|
25
|
-
exports.SelectContainer = SelectContainer;
|
|
26
|
-
var Option = _styled.default.div(function (props) {
|
|
27
|
-
return (0, _react.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n outline: none;\n padding: ", ";\n text-align: ", ";\n font-weight: ", ";\n font-size: ", ";\n color: ", ";\n background: transparent;\n transition: background-color ease;\n transition-duration: ", ";\n cursor: pointer;\n & > svg:first-of-type {\n margin-right: ", ";\n }\n & > svg:last-of-type:not(:first-of-type) {\n margin-left: ", ";\n }\n &:hover,\n &:focus {\n background: ", ";\n }\n "])), {
|
|
28
|
-
sm: '8px',
|
|
29
|
-
md: '16px 32px'
|
|
30
|
-
}[props.sizeSelect || 'md'], {
|
|
31
|
-
sm: 'center',
|
|
32
|
-
md: 'left'
|
|
33
|
-
}[props.sizeSelect || 'md'], props.theme.fontWeight['500'], props.theme.fontSizes.xs, props.theme.colors.neutral.neutral5, props.theme.transition.speed, props.theme.spacing.xxxs, props.theme.spacing.xxxs, props.theme.colors.neutral.neutral1);
|
|
34
|
-
});
|
|
35
|
-
exports.Option = Option;
|
|
36
|
-
var OptionPlaceholder = (0, _styled.default)(_List.default)(function (_ref) {
|
|
37
|
-
var theme = _ref.theme;
|
|
38
|
-
return (0, _react.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n color: ", ";\n "])), theme.colors.neutral.neutral3);
|
|
39
|
-
});
|
|
40
|
-
exports.OptionPlaceholder = OptionPlaceholder;
|
|
41
|
-
var HelperText = _styled.default.span(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-size: ", ";\n\n color: ", ";\n padding: 0 20px;\n"])), function (props) {
|
|
42
|
-
return props.theme.fontSizes.xxs;
|
|
43
|
-
}, function (props) {
|
|
44
|
-
return props.alert && props.alert !== 'success' ? props.theme.colors[props.alert].default : props.theme.colors.neutral.neutral4;
|
|
45
|
-
});
|
|
46
|
-
exports.HelperText = HelperText;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SelectContainer=exports.OptionPlaceholder=exports.Option=exports.HelperText=void 0;var _templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_react=require("@emotion/react"),_styled=_interopRequireDefault(require("@emotion/styled")),_List=_interopRequireDefault(require("../List"));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 SelectContainer=_styled.default.div(function(props){return(0,_react.css)(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n outline: none;\n user-select: none;\n width: ",";\n background: ",";\n\n height: ",";\n ",";\n & > div {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n border-radius: ",";\n padding: 0\n ",";\n width: 100%;\n height: 100%;\n position: relative;\n cursor: pointer;\n color: ",";\n transition: background-color ease;\n transition-duration: ",";\n\n ",";\n\n ",";\n\n & > label {\n position: absolute;\n left: 20px;\n top: 50%;\n transform: translateY(-50%);\n font-size: 1rem;\n font-weight: 500;\n color: ",";\n transition: top ease, left ease, color ease;\n transition-duration: ",";\n\n background: ",";\n padding: 0 4px;\n z-index: 1;\n white-space: nowrap;\n max-width: 65%;\n overflow: hidden;\n text-overflow: ellipsis;\n\n ","\n }\n\n & > .select--placeholder {\n white-space: nowrap;\n max-width: 75%;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n // Chevron Down icon\n & > svg {\n flex-shrink: 0;\n transform: rotate(0deg);\n color: ",";\n transition: transform ease;\n transition-duration: ",";\n }\n\n & > fieldset {\n border: 2px solid;\n border-color: ",";\n border-radius: ",";\n padding: 0 14px;\n position: absolute;\n left: 0px;\n right: 0px;\n top: 0px;\n bottom: 0px;\n pointer-events: none;\n transition: border-color ease;\n transition-duration: ",";\n\n &:last-of-type {\n border-radius: calc("," + 2px);\n padding: 0 16px;\n border-color: transparent;\n left: -2px;\n right: -2px;\n top: -2px;\n bottom: -2px;\n }\n\n & > legend {\n display: ",";\n line-height: 2px;\n user-select: none;\n padding: 0 4px;\n & > span {\n color: transparent;\n }\n }\n }\n }\n\n & > input {\n appearance: none;\n border: 0;\n width: 0px;\n position: absolute;\n opacity: 0;\n pointer-events: none;\n }\n "])),props.size?{sm:"78px",md:"100%"}[props.size]:props.width,props.theme.colors.neutral.white,"unstyled"===props.variant?"auto":props.size?{sm:"36px",md:"56px"}[props.size]:"56px",!props.disabled&&(0,_react.css)(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n &:hover {\n & > div {\n color: ",";\n\n & > label {\n color: ",";\n }\n\n & > fieldset {\n &:first-of-type {\n border-color: ",";\n }\n }\n }\n }\n\n &:focus {\n & > div {\n color: ",";\n\n & > svg {\n transform: rotate(180deg);\n }\n\n & > fieldset {\n &:first-of-type {\n border-color: ",";\n }\n &:last-of-type {\n border-color: ",";\n }\n }\n }\n }\n "])),props.theme.colors.neutral.black,props.theme.colors.neutral.neutral5,props.alert?props.theme.colors[props.alert].blurred:props.theme.colors.primary.hover,props.theme.colors.neutral.black,props.alert?props.theme.colors[props.alert].default:props.theme.colors.primary.hover,props.alert?props.theme.colors[props.alert].blurred:props.theme.colors.primary.disabled),props.theme.borderRadius.default,"unstyled"===props.variant?"0":props.size&&{sm:"16px",md:"20px"}[props.size],props.theme.colors.neutral.neutral5,props.theme.transition.speed,props.alert&&(0,_react.css)(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n background: ","33;\n "])),props.theme.colors[props.alert].blurred),props.disabled&&(0,_react.css)(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n background: ",";\n cursor: default;\n "])),props.theme.colors.neutral.neutral1),props.theme.colors.neutral.neutral3,props.theme.transition.speed,props.theme.colors.neutral.white,props.filled&&(0,_react.css)(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n left: 20px;\n top: -1px;\n font-size: 0.875rem;\n "]))),props.theme.colors.neutral.neutral5,props.theme.transition.speed,props.alert&&!props.disabled?props.theme.colors[props.alert].default:props.theme.colors.neutral.neutral2,props.theme.borderRadius.default,props.theme.transition.speed,props.theme.borderRadius.default,props.filled?"block":"none")});exports.SelectContainer=SelectContainer;var Option=_styled.default.div(function(props){return(0,_react.css)(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n box-sizing: border-box;\n outline: none;\n padding: ",";\n text-align: ",";\n font-weight: ",";\n font-size: ",";\n color: ",";\n background: transparent;\n transition: background-color ease;\n transition-duration: ",";\n cursor: pointer;\n & > svg:first-of-type {\n margin-right: ",";\n }\n & > svg:last-of-type:not(:first-of-type) {\n margin-left: ",";\n }\n &:hover,\n &:focus {\n background: ",";\n }\n "])),{sm:"8px",md:"16px 32px"}[props.sizeSelect||"md"],{sm:"center",md:"left"}[props.sizeSelect||"md"],props.theme.fontWeight[500],props.theme.fontSizes.xs,props.theme.colors.neutral.neutral5,props.theme.transition.speed,props.theme.spacing.xxxs,props.theme.spacing.xxxs,props.theme.colors.neutral.neutral1)});exports.Option=Option;var OptionPlaceholder=(0,_styled.default)(_List.default)(function(_ref){var theme=_ref.theme;return(0,_react.css)(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n color: ",";\n "])),theme.colors.neutral.neutral3)});exports.OptionPlaceholder=OptionPlaceholder;var HelperText=_styled.default.span(_templateObject8||(_templateObject8=_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;
|
|
@@ -1,28 +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 _styles = require("./styles");
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
var _excluded = ["children", "isLoaded"];
|
|
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 _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; }
|
|
17
|
-
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; }
|
|
18
|
-
var Skeleton = function Skeleton(_ref) {
|
|
19
|
-
var children = _ref.children,
|
|
20
|
-
isLoaded = _ref.isLoaded,
|
|
21
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SkeletonElement, _objectSpread(_objectSpread({}, rest), {}, {
|
|
23
|
-
isLoaded: isLoaded,
|
|
24
|
-
children: children
|
|
25
|
-
}));
|
|
26
|
-
};
|
|
27
|
-
var _default = Skeleton;
|
|
28
|
-
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 _styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["children","isLoaded"];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 _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 Skeleton=function(_ref){var children=_ref.children,isLoaded=_ref.isLoaded,rest=_objectWithoutProperties(_ref,_excluded);return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.SkeletonElement,_objectSpread(_objectSpread({},rest),{},{isLoaded:isLoaded,children:children}))},_default=Skeleton;exports.default=_default;
|