@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,120 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _testUtils = require("../../shared/tests/test-utils");
|
|
4
|
-
require("@testing-library/jest-dom");
|
|
5
|
-
var _ = _interopRequireDefault(require("."));
|
|
6
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
|
-
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); }
|
|
9
|
-
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; }
|
|
10
|
-
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; }
|
|
11
|
-
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; }
|
|
12
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
-
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); }
|
|
14
|
-
var setup = function setup(props) {
|
|
15
|
-
return (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, _objectSpread({}, props)));
|
|
16
|
-
};
|
|
17
|
-
describe('DatePicker', function () {
|
|
18
|
-
it('should it render the datepicker component', function () {
|
|
19
|
-
var _setup = setup({
|
|
20
|
-
value: new Date(),
|
|
21
|
-
onChange: jest.fn()
|
|
22
|
-
}),
|
|
23
|
-
container = _setup.container;
|
|
24
|
-
expect(container).toBeInTheDocument();
|
|
25
|
-
});
|
|
26
|
-
it('should it render the datepicker as range type', function () {
|
|
27
|
-
var _setup2 = setup({
|
|
28
|
-
value: new Date(),
|
|
29
|
-
onChange: jest.fn(),
|
|
30
|
-
type: 'range'
|
|
31
|
-
}),
|
|
32
|
-
container = _setup2.container;
|
|
33
|
-
expect(container).toBeInTheDocument();
|
|
34
|
-
});
|
|
35
|
-
it('should it render the datepicker as extended variant', function () {
|
|
36
|
-
var _setup3 = setup({
|
|
37
|
-
value: new Date(),
|
|
38
|
-
onChange: jest.fn(),
|
|
39
|
-
variant: 'extended'
|
|
40
|
-
}),
|
|
41
|
-
container = _setup3.container;
|
|
42
|
-
expect(container).toBeInTheDocument();
|
|
43
|
-
});
|
|
44
|
-
it('should it render the datepicker with minimum and maximum dates', function () {
|
|
45
|
-
var _setup4 = setup({
|
|
46
|
-
value: new Date(),
|
|
47
|
-
onChange: jest.fn(),
|
|
48
|
-
minDate: new Date(),
|
|
49
|
-
maxDate: new Date()
|
|
50
|
-
}),
|
|
51
|
-
container = _setup4.container;
|
|
52
|
-
expect(container).toBeInTheDocument();
|
|
53
|
-
});
|
|
54
|
-
it('should it call the onChange function with one date value', function () {
|
|
55
|
-
var onChange = jest.fn();
|
|
56
|
-
var _setup5 = setup({
|
|
57
|
-
value: new Date(),
|
|
58
|
-
onChange: onChange
|
|
59
|
-
}),
|
|
60
|
-
container = _setup5.container;
|
|
61
|
-
var dateCells = document.querySelectorAll('td[role="gridcell"]');
|
|
62
|
-
dateCells[20].dispatchEvent(new MouseEvent('click', {
|
|
63
|
-
bubbles: true
|
|
64
|
-
}));
|
|
65
|
-
expect(container).toBeInTheDocument();
|
|
66
|
-
expect(onChange).toHaveBeenCalled();
|
|
67
|
-
});
|
|
68
|
-
it('should it call the onChange function with two date values in range type', function () {
|
|
69
|
-
var onChange = jest.fn();
|
|
70
|
-
var _setup6 = setup({
|
|
71
|
-
value: new Date(),
|
|
72
|
-
onChange: onChange,
|
|
73
|
-
type: 'range'
|
|
74
|
-
}),
|
|
75
|
-
container = _setup6.container;
|
|
76
|
-
var dateCells = document.querySelectorAll('td[role="gridcell"]');
|
|
77
|
-
dateCells[20].dispatchEvent(new MouseEvent('click', {
|
|
78
|
-
bubbles: true
|
|
79
|
-
}));
|
|
80
|
-
dateCells[25].dispatchEvent(new MouseEvent('click', {
|
|
81
|
-
bubbles: true
|
|
82
|
-
}));
|
|
83
|
-
expect(container).toBeInTheDocument();
|
|
84
|
-
expect(onChange).toHaveBeenCalled();
|
|
85
|
-
});
|
|
86
|
-
it('should it call the onChange function with one date value in the extended variant', function () {
|
|
87
|
-
var onChange = jest.fn();
|
|
88
|
-
var _setup7 = setup({
|
|
89
|
-
value: new Date(),
|
|
90
|
-
onChange: onChange,
|
|
91
|
-
variant: 'extended'
|
|
92
|
-
}),
|
|
93
|
-
container = _setup7.container;
|
|
94
|
-
var dateCells = document.querySelectorAll('td[role="gridcell"]');
|
|
95
|
-
dateCells[20].dispatchEvent(new MouseEvent('click', {
|
|
96
|
-
bubbles: true
|
|
97
|
-
}));
|
|
98
|
-
expect(container).toBeInTheDocument();
|
|
99
|
-
expect(onChange).toHaveBeenCalled();
|
|
100
|
-
});
|
|
101
|
-
it('should it call the onChange function with two date values in the extended variant', function () {
|
|
102
|
-
var onChange = jest.fn();
|
|
103
|
-
var _setup8 = setup({
|
|
104
|
-
value: new Date(),
|
|
105
|
-
onChange: onChange,
|
|
106
|
-
type: 'range',
|
|
107
|
-
variant: 'extended'
|
|
108
|
-
}),
|
|
109
|
-
container = _setup8.container;
|
|
110
|
-
var dateCells = document.querySelectorAll('td[role="gridcell"]');
|
|
111
|
-
dateCells[20].dispatchEvent(new MouseEvent('click', {
|
|
112
|
-
bubbles: true
|
|
113
|
-
}));
|
|
114
|
-
dateCells[60].dispatchEvent(new MouseEvent('click', {
|
|
115
|
-
bubbles: true
|
|
116
|
-
}));
|
|
117
|
-
expect(container).toBeInTheDocument();
|
|
118
|
-
expect(onChange).toHaveBeenCalled();
|
|
119
|
-
});
|
|
120
|
-
});
|
|
1
|
+
"use strict";var _testUtils=require("../../shared/tests/test-utils");require("@testing-library/jest-dom");var _=_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(0,_testUtils.render)(/*#__PURE__*/(0,_jsxRuntime.jsx)(_.default,_objectSpread({},props)))};describe("DatePicker",function(){it("should it render the datepicker component",function(){var _setup=setup({value:new Date,onChange:jest.fn()}),container=_setup.container;expect(container).toBeInTheDocument()}),it("should it render the datepicker as range type",function(){var _setup2=setup({value:new Date,onChange:jest.fn(),type:"range"}),container=_setup2.container;expect(container).toBeInTheDocument()}),it("should it render the datepicker as extended variant",function(){var _setup3=setup({value:new Date,onChange:jest.fn(),variant:"extended"}),container=_setup3.container;expect(container).toBeInTheDocument()}),it("should it render the datepicker with minimum and maximum dates",function(){var _setup4=setup({value:new Date,onChange:jest.fn(),minDate:new Date,maxDate:new Date}),container=_setup4.container;expect(container).toBeInTheDocument()}),it("should it call the onChange function with one date value",function(){var onChange=jest.fn(),_setup5=setup({value:new Date,onChange:onChange}),container=_setup5.container,dateCells=document.querySelectorAll("td[role=\"gridcell\"]");dateCells[20].dispatchEvent(new MouseEvent("click",{bubbles:!0})),expect(container).toBeInTheDocument(),expect(onChange).toHaveBeenCalled()}),it("should it call the onChange function with two date values in range type",function(){var onChange=jest.fn(),_setup6=setup({value:new Date,onChange:onChange,type:"range"}),container=_setup6.container,dateCells=document.querySelectorAll("td[role=\"gridcell\"]");dateCells[20].dispatchEvent(new MouseEvent("click",{bubbles:!0})),dateCells[25].dispatchEvent(new MouseEvent("click",{bubbles:!0})),expect(container).toBeInTheDocument(),expect(onChange).toHaveBeenCalled()}),it("should it call the onChange function with one date value in the extended variant",function(){var onChange=jest.fn(),_setup7=setup({value:new Date,onChange:onChange,variant:"extended"}),container=_setup7.container,dateCells=document.querySelectorAll("td[role=\"gridcell\"]");dateCells[20].dispatchEvent(new MouseEvent("click",{bubbles:!0})),expect(container).toBeInTheDocument(),expect(onChange).toHaveBeenCalled()}),it("should it call the onChange function with two date values in the extended variant",function(){var onChange=jest.fn(),_setup8=setup({value:new Date,onChange:onChange,type:"range",variant:"extended"}),container=_setup8.container,dateCells=document.querySelectorAll("td[role=\"gridcell\"]");dateCells[20].dispatchEvent(new MouseEvent("click",{bubbles:!0})),dateCells[60].dispatchEvent(new MouseEvent("click",{bubbles:!0})),expect(container).toBeInTheDocument(),expect(onChange).toHaveBeenCalled()})});
|
|
@@ -1,236 +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 _framerMotion = require("framer-motion");
|
|
10
|
-
var _react2 = require("@emotion/react");
|
|
11
|
-
var _DatePickerContent = require("./components/DatePickerContent");
|
|
12
|
-
var _DateYearPicker = require("./components/DateYearPicker");
|
|
13
|
-
var _styles = require("./styles");
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
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; }
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
-
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; }
|
|
18
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
-
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); }
|
|
20
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
-
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."); }
|
|
22
|
-
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); }
|
|
23
|
-
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; }
|
|
24
|
-
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; } }
|
|
25
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
-
var DatePicker = function DatePicker(_ref) {
|
|
27
|
-
var value = _ref.value,
|
|
28
|
-
onChange = _ref.onChange,
|
|
29
|
-
minDateProp = _ref.minDate,
|
|
30
|
-
maxDateProp = _ref.maxDate,
|
|
31
|
-
_ref$variant = _ref.variant,
|
|
32
|
-
variant = _ref$variant === void 0 ? 'compact' : _ref$variant,
|
|
33
|
-
color = _ref.color,
|
|
34
|
-
_ref$type = _ref.type,
|
|
35
|
-
type = _ref$type === void 0 ? 'date' : _ref$type,
|
|
36
|
-
disableWeekendDays = _ref.disableWeekendDays,
|
|
37
|
-
isFirstClickDateInput = _ref.isFirstClickDateInput,
|
|
38
|
-
setIsFirstClickDateInput = _ref.setIsFirstClickDateInput,
|
|
39
|
-
enableYearPicker = _ref.enableYearPicker;
|
|
40
|
-
var date = (0, _react.useMemo)(function () {
|
|
41
|
-
return new Date();
|
|
42
|
-
}, []);
|
|
43
|
-
var minDate = new Date(minDateProp);
|
|
44
|
-
var maxDate = new Date(maxDateProp);
|
|
45
|
-
var _useState = (0, _react.useState)(isFirstClickDateInput || true),
|
|
46
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
-
isFirstClick = _useState2[0],
|
|
48
|
-
setIsFirstClick = _useState2[1];
|
|
49
|
-
var _useState3 = (0, _react.useState)(function () {
|
|
50
|
-
if (value) {
|
|
51
|
-
return Array.isArray(value) ? new Date(value[0]) : new Date(value);
|
|
52
|
-
}
|
|
53
|
-
if (maxDateProp && minDateProp) {
|
|
54
|
-
return maxDate <= date ? new Date(maxDate.getFullYear(), maxDate.getMonth() - 1) : null;
|
|
55
|
-
}
|
|
56
|
-
if (minDateProp) {
|
|
57
|
-
return minDate > date ? minDate : null;
|
|
58
|
-
}
|
|
59
|
-
if (maxDateProp) {
|
|
60
|
-
return maxDate < date ? new Date(maxDate.getFullYear(), maxDate.getMonth() - (variant === 'compact' ? 0 : 1)) : null;
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
}),
|
|
64
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
65
|
-
startDate = _useState4[0],
|
|
66
|
-
setStartDate = _useState4[1];
|
|
67
|
-
var _useState5 = (0, _react.useState)(value ? Array.isArray(value) ? new Date(value[1]) : new Date(value) : startDate),
|
|
68
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
69
|
-
endDate = _useState6[0],
|
|
70
|
-
setEndDate = _useState6[1];
|
|
71
|
-
var endDateMonth = endDate ? endDate.getMonth() : null;
|
|
72
|
-
var startDateMonth = startDate ? startDate.getMonth() : null;
|
|
73
|
-
var _useState7 = (0, _react.useState)(function () {
|
|
74
|
-
if (endDate && endDateMonth && startDateMonth) {
|
|
75
|
-
if (Array.isArray(value) && value !== null && value !== void 0 && value[1]) {
|
|
76
|
-
if (maxDateProp) {
|
|
77
|
-
if (startDateMonth === endDateMonth && endDateMonth === maxDate.getMonth()) return endDate;
|
|
78
|
-
if (startDateMonth === endDateMonth) return new Date(endDate.getFullYear(), endDateMonth + 1);
|
|
79
|
-
return endDate;
|
|
80
|
-
} else {
|
|
81
|
-
return startDateMonth === endDateMonth ? new Date(endDate.getFullYear(), endDateMonth + 1) : endDate;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (maxDateProp && maxDate.getMonth() === startDateMonth) {
|
|
85
|
-
return maxDate;
|
|
86
|
-
}
|
|
87
|
-
if (startDate) {
|
|
88
|
-
return new Date(startDate.getFullYear(), startDateMonth + 1, 1);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1);
|
|
92
|
-
}),
|
|
93
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
94
|
-
secondCalendarDate = _useState8[0],
|
|
95
|
-
setSecondCalendarDate = _useState8[1];
|
|
96
|
-
var _useState9 = (0, _react.useState)(function () {
|
|
97
|
-
if (secondCalendarDate && variant === 'extended' && secondCalendarDate.getMonth() === maxDate.getMonth()) {
|
|
98
|
-
return Array.isArray(value) && startDateMonth !== endDateMonth ? startDate : new Date(secondCalendarDate.getFullYear(), secondCalendarDate.getMonth() - 1);
|
|
99
|
-
}
|
|
100
|
-
if (startDate) {
|
|
101
|
-
return startDateMonth && new Date(startDate.getFullYear(), startDateMonth);
|
|
102
|
-
}
|
|
103
|
-
return new Date();
|
|
104
|
-
}),
|
|
105
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
106
|
-
firstCalendarDate = _useState10[0],
|
|
107
|
-
setFirstCalendarDate = _useState10[1];
|
|
108
|
-
var _useState11 = (0, _react.useState)(false),
|
|
109
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
110
|
-
openYearPicker = _useState12[0],
|
|
111
|
-
setOpenYearPicker = _useState12[1];
|
|
112
|
-
var isInTheRange = function isInTheRange(currentDate) {
|
|
113
|
-
if (startDate && endDate) {
|
|
114
|
-
var start = startDate.getTime();
|
|
115
|
-
var end = endDate.getTime();
|
|
116
|
-
var current = currentDate && currentDate.getTime();
|
|
117
|
-
return current > start && current < end;
|
|
118
|
-
}
|
|
119
|
-
return false;
|
|
120
|
-
};
|
|
121
|
-
var handleMouseOver = function handleMouseOver(currentDate) {
|
|
122
|
-
if (startDate) {
|
|
123
|
-
var tableRows = document.querySelectorAll('tbody tr[role="row"]');
|
|
124
|
-
tableRows.forEach(function (row) {
|
|
125
|
-
var rowCells = row.querySelectorAll('td');
|
|
126
|
-
rowCells.forEach(function (cell) {
|
|
127
|
-
var cellDate = new Date(String(cell.getAttribute('data-date')));
|
|
128
|
-
if (cellDate.getTime() === currentDate.setHours(0, 0, 0, 0) && Number(cellDate) > Number(endDate)) {
|
|
129
|
-
cell.classList.add('is-current');
|
|
130
|
-
} else {
|
|
131
|
-
cell.classList.remove('is-current');
|
|
132
|
-
}
|
|
133
|
-
if (cellDate <= currentDate && cellDate > startDate && !endDate) {
|
|
134
|
-
cell.classList.add('is-hover');
|
|
135
|
-
} else {
|
|
136
|
-
cell.classList.remove('is-hover');
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
function resetFirstClick(value) {
|
|
143
|
-
setIsFirstClick(value);
|
|
144
|
-
setIsFirstClickDateInput === null || setIsFirstClickDateInput === void 0 ? void 0 : setIsFirstClickDateInput(value);
|
|
145
|
-
}
|
|
146
|
-
var handleChange = function handleChange(newDate) {
|
|
147
|
-
if (type === 'date') {
|
|
148
|
-
setStartDate(newDate);
|
|
149
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newDate);
|
|
150
|
-
return resetFirstClick(false);
|
|
151
|
-
}
|
|
152
|
-
if (isFirstClick) {
|
|
153
|
-
setStartDate(newDate);
|
|
154
|
-
setEndDate(null);
|
|
155
|
-
return resetFirstClick(false);
|
|
156
|
-
}
|
|
157
|
-
if (startDate) {
|
|
158
|
-
if (newDate < startDate) return setStartDate(newDate);
|
|
159
|
-
setEndDate(newDate);
|
|
160
|
-
onChange === null || onChange === void 0 ? void 0 : onChange([startDate, newDate]);
|
|
161
|
-
setIsFirstClick(true);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
(0, _react.useEffect)(function () {
|
|
165
|
-
if (isFirstClick && !startDate) {
|
|
166
|
-
setStartDate(null);
|
|
167
|
-
setEndDate(null);
|
|
168
|
-
}
|
|
169
|
-
}, [isFirstClick]);
|
|
170
|
-
var firstCalendarLimit = secondCalendarDate && new Date(secondCalendarDate.getFullYear(), secondCalendarDate.getMonth(), 0);
|
|
171
|
-
var handleToggleYearPicker = function handleToggleYearPicker() {
|
|
172
|
-
setOpenYearPicker(!openYearPicker);
|
|
173
|
-
};
|
|
174
|
-
var DatePickerContentProps = {
|
|
175
|
-
variant: variant,
|
|
176
|
-
type: type,
|
|
177
|
-
startDate: startDate,
|
|
178
|
-
endDate: endDate,
|
|
179
|
-
isInTheRange: isInTheRange,
|
|
180
|
-
handleMouseOver: handleMouseOver,
|
|
181
|
-
handleChange: handleChange,
|
|
182
|
-
minDate: minDate && new Date(minDate),
|
|
183
|
-
maxDate: maxDate && new Date(maxDate),
|
|
184
|
-
showSelectedDate: !isFirstClickDateInput,
|
|
185
|
-
handleToggleYearPicker: handleToggleYearPicker,
|
|
186
|
-
enableYearPicker: enableYearPicker
|
|
187
|
-
};
|
|
188
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.ThemeProvider, {
|
|
189
|
-
theme: {
|
|
190
|
-
colorSelected: color || 'primary.default'
|
|
191
|
-
},
|
|
192
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.DatePickerContentContainer, {
|
|
193
|
-
isExtended: variant === 'extended',
|
|
194
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_framerMotion.AnimatePresence, {
|
|
195
|
-
mode: "wait",
|
|
196
|
-
children: !openYearPicker ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
197
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePickerContent.DatePickerContent, _objectSpread(_objectSpread({}, DatePickerContentProps), {}, {
|
|
198
|
-
date: firstCalendarDate,
|
|
199
|
-
minDate: DatePickerContentProps.minDate,
|
|
200
|
-
maxDate: variant === 'extended' && !maxDate ? firstCalendarLimit : variant === 'extended' ? maxDate && firstCalendarLimit && new Date(maxDate).getTime() < firstCalendarLimit.getTime() ? DatePickerContentProps.maxDate : firstCalendarLimit : DatePickerContentProps.maxDate,
|
|
201
|
-
disableWeekendDays: disableWeekendDays,
|
|
202
|
-
handleChangeDate: function handleChangeDate(newDate) {
|
|
203
|
-
return setFirstCalendarDate(newDate);
|
|
204
|
-
}
|
|
205
|
-
})), variant === 'extended' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePickerContent.DatePickerContent, _objectSpread(_objectSpread({}, DatePickerContentProps), {}, {
|
|
206
|
-
date: secondCalendarDate,
|
|
207
|
-
minDate: DatePickerContentProps.minDate,
|
|
208
|
-
maxDate: DatePickerContentProps.maxDate,
|
|
209
|
-
handleChangeDate: function handleChangeDate(newDate) {
|
|
210
|
-
setSecondCalendarDate(newDate);
|
|
211
|
-
},
|
|
212
|
-
hidePrevMonthButton: function () {
|
|
213
|
-
if (firstCalendarDate && secondCalendarDate) {
|
|
214
|
-
return (secondCalendarDate === null || secondCalendarDate === void 0 ? void 0 : secondCalendarDate.getMonth()) - 1 === (firstCalendarDate === null || firstCalendarDate === void 0 ? void 0 : firstCalendarDate.getMonth()) || (secondCalendarDate === null || secondCalendarDate === void 0 ? void 0 : secondCalendarDate.getMonth()) === 0 && (firstCalendarDate === null || firstCalendarDate === void 0 ? void 0 : firstCalendarDate.getMonth()) === 11;
|
|
215
|
-
}
|
|
216
|
-
return false;
|
|
217
|
-
}(),
|
|
218
|
-
disableWeekendDays: disableWeekendDays
|
|
219
|
-
}))]
|
|
220
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_DateYearPicker.DateYearPicker, {
|
|
221
|
-
date: firstCalendarDate,
|
|
222
|
-
minDate: minDate,
|
|
223
|
-
maxDate: maxDate,
|
|
224
|
-
handleChangeDate: function handleChangeDate(newDate) {
|
|
225
|
-
setFirstCalendarDate(function () {
|
|
226
|
-
return new Date(newDate.getFullYear(), newDate.getMonth(), 1);
|
|
227
|
-
});
|
|
228
|
-
setOpenYearPicker(false);
|
|
229
|
-
}
|
|
230
|
-
})
|
|
231
|
-
})
|
|
232
|
-
})
|
|
233
|
-
});
|
|
234
|
-
};
|
|
235
|
-
var _default = DatePicker;
|
|
236
|
-
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"),_framerMotion=require("framer-motion"),_react2=require("@emotion/react"),_DatePickerContent=require("./components/DatePickerContent"),_DateYearPicker=require("./components/DateYearPicker"),_styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}var DatePicker=function(_ref){function resetFirstClick(value){setIsFirstClick(value),null===setIsFirstClickDateInput||void 0===setIsFirstClickDateInput?void 0:setIsFirstClickDateInput(value)}var value=_ref.value,onChange=_ref.onChange,minDateProp=_ref.minDate,maxDateProp=_ref.maxDate,_ref$variant=_ref.variant,variant=void 0===_ref$variant?"compact":_ref$variant,color=_ref.color,_ref$type=_ref.type,type=void 0===_ref$type?"date":_ref$type,disableWeekendDays=_ref.disableWeekendDays,isFirstClickDateInput=_ref.isFirstClickDateInput,setIsFirstClickDateInput=_ref.setIsFirstClickDateInput,enableYearPicker=_ref.enableYearPicker,date=(0,_react.useMemo)(function(){return new Date},[]),minDate=new Date(minDateProp),maxDate=new Date(maxDateProp),_useState=(0,_react.useState)(isFirstClickDateInput||!0),_useState2=_slicedToArray(_useState,2),isFirstClick=_useState2[0],setIsFirstClick=_useState2[1],_useState3=(0,_react.useState)(function(){return value?Array.isArray(value)?new Date(value[0]):new Date(value):maxDateProp&&minDateProp?maxDate<=date?new Date(maxDate.getFullYear(),maxDate.getMonth()-1):null:minDateProp?minDate>date?minDate:null:maxDateProp?maxDate<date?new Date(maxDate.getFullYear(),maxDate.getMonth()-("compact"===variant?0:1)):null:null}),_useState4=_slicedToArray(_useState3,2),startDate=_useState4[0],setStartDate=_useState4[1],_useState5=(0,_react.useState)(value?Array.isArray(value)?new Date(value[1]):new Date(value):startDate),_useState6=_slicedToArray(_useState5,2),endDate=_useState6[0],setEndDate=_useState6[1],endDateMonth=endDate?endDate.getMonth():null,startDateMonth=startDate?startDate.getMonth():null,_useState7=(0,_react.useState)(function(){if(endDate&&endDateMonth&&startDateMonth){if(Array.isArray(value)&&null!==value&&void 0!==value&&value[1])return maxDateProp?startDateMonth===endDateMonth&&endDateMonth===maxDate.getMonth()?endDate:startDateMonth===endDateMonth?new Date(endDate.getFullYear(),endDateMonth+1):endDate:startDateMonth===endDateMonth?new Date(endDate.getFullYear(),endDateMonth+1):endDate;if(maxDateProp&&maxDate.getMonth()===startDateMonth)return maxDate;if(startDate)return new Date(startDate.getFullYear(),startDateMonth+1,1)}return new Date(new Date().getFullYear(),new Date().getMonth()+1,1)}),_useState8=_slicedToArray(_useState7,2),secondCalendarDate=_useState8[0],setSecondCalendarDate=_useState8[1],_useState9=(0,_react.useState)(function(){return secondCalendarDate&&"extended"===variant&&secondCalendarDate.getMonth()===maxDate.getMonth()?Array.isArray(value)&&startDateMonth!==endDateMonth?startDate:new Date(secondCalendarDate.getFullYear(),secondCalendarDate.getMonth()-1):startDate?startDateMonth&&new Date(startDate.getFullYear(),startDateMonth):new Date}),_useState10=_slicedToArray(_useState9,2),firstCalendarDate=_useState10[0],setFirstCalendarDate=_useState10[1],_useState11=(0,_react.useState)(!1),_useState12=_slicedToArray(_useState11,2),openYearPicker=_useState12[0],setOpenYearPicker=_useState12[1];(0,_react.useEffect)(function(){isFirstClick&&!startDate&&(setStartDate(null),setEndDate(null))},[isFirstClick]);var firstCalendarLimit=secondCalendarDate&&new Date(secondCalendarDate.getFullYear(),secondCalendarDate.getMonth(),0),DatePickerContentProps={variant:variant,type:type,startDate:startDate,endDate:endDate,isInTheRange:function isInTheRange(currentDate){if(startDate&&endDate){var start=startDate.getTime(),end=endDate.getTime(),current=currentDate&¤tDate.getTime();return current>start&¤t<end}return!1},handleMouseOver:function handleMouseOver(currentDate){if(startDate){var tableRows=document.querySelectorAll("tbody tr[role=\"row\"]");tableRows.forEach(function(row){var rowCells=row.querySelectorAll("td");rowCells.forEach(function(cell){var cellDate=new Date(cell.getAttribute("data-date")+"");cellDate.getTime()===currentDate.setHours(0,0,0,0)&&+cellDate>+endDate?cell.classList.add("is-current"):cell.classList.remove("is-current"),cellDate<=currentDate&&cellDate>startDate&&!endDate?cell.classList.add("is-hover"):cell.classList.remove("is-hover")})})}},handleChange:function handleChange(newDate){if("date"===type)return setStartDate(newDate),null===onChange||void 0===onChange?void 0:onChange(newDate),resetFirstClick(!1);if(isFirstClick)return setStartDate(newDate),setEndDate(null),resetFirstClick(!1);if(startDate){if(newDate<startDate)return setStartDate(newDate);setEndDate(newDate),null===onChange||void 0===onChange?void 0:onChange([startDate,newDate]),setIsFirstClick(!0)}},minDate:minDate&&new Date(minDate),maxDate:maxDate&&new Date(maxDate),showSelectedDate:!isFirstClickDateInput,handleToggleYearPicker:function handleToggleYearPicker(){setOpenYearPicker(!openYearPicker)},enableYearPicker:enableYearPicker};return/*#__PURE__*/(0,_jsxRuntime.jsx)(_react2.ThemeProvider,{theme:{colorSelected:color||"primary.default"},children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DatePickerContentContainer,{isExtended:"extended"===variant,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.AnimatePresence,{mode:"wait",children:openYearPicker?/*#__PURE__*/(0,_jsxRuntime.jsx)(_DateYearPicker.DateYearPicker,{date:firstCalendarDate,minDate:minDate,maxDate:maxDate,handleChangeDate:function handleChangeDate(newDate){setFirstCalendarDate(function(){return new Date(newDate.getFullYear(),newDate.getMonth(),1)}),setOpenYearPicker(!1)}}):/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_DatePickerContent.DatePickerContent,_objectSpread(_objectSpread({},DatePickerContentProps),{},{date:firstCalendarDate,minDate:DatePickerContentProps.minDate,maxDate:"extended"!==variant||maxDate?"extended"===variant?maxDate&&firstCalendarLimit&&new Date(maxDate).getTime()<firstCalendarLimit.getTime()?DatePickerContentProps.maxDate:firstCalendarLimit:DatePickerContentProps.maxDate:firstCalendarLimit,disableWeekendDays:disableWeekendDays,handleChangeDate:function handleChangeDate(newDate){return setFirstCalendarDate(newDate)}})),"extended"===variant&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_DatePickerContent.DatePickerContent,_objectSpread(_objectSpread({},DatePickerContentProps),{},{date:secondCalendarDate,minDate:DatePickerContentProps.minDate,maxDate:DatePickerContentProps.maxDate,handleChangeDate:function handleChangeDate(newDate){setSecondCalendarDate(newDate)},hidePrevMonthButton:function(){return!!(firstCalendarDate&&secondCalendarDate)&&((null===secondCalendarDate||void 0===secondCalendarDate?void 0:secondCalendarDate.getMonth())-1===(null===firstCalendarDate||void 0===firstCalendarDate?void 0:firstCalendarDate.getMonth())||0===(null===secondCalendarDate||void 0===secondCalendarDate?void 0:secondCalendarDate.getMonth())&&11===(null===firstCalendarDate||void 0===firstCalendarDate?void 0:firstCalendarDate.getMonth()))}(),disableWeekendDays:disableWeekendDays}))]})})})})},_default=DatePicker;exports.default=_default;
|
|
@@ -1,88 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DateYearPickerContainer = exports.DateYearPickerCell = exports.DateYearPickerBody = exports.DatePickerTableRow = exports.DatePickerTableCellSpan = exports.DatePickerTableCell = exports.DatePickerHeaderTitle = exports.DatePickerHeaderButton = exports.DatePickerHeader = exports.DatePickerContentContainer = exports.DatePickerContainer = exports.DatePickerBodyTable = exports.DatePickerBody = void 0;
|
|
7
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
8
|
-
var _colorCheck = require("../../utils/colorCheck");
|
|
9
|
-
var _getColorValue = require("../../utils/getColorValue");
|
|
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 DatePickerContentContainer = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n max-width: fit-content;\n gap: 20px;\n padding: 24px 18px;\n border-radius: 8px;\n background-color: ", ";\n box-shadow: ", ";\n\n @media (max-width: 750px) {\n flex-wrap: wrap;\n }\n\n & > div {\n width: 290px;\n }\n"])), function (_ref) {
|
|
14
|
-
var colors = _ref.theme.colors;
|
|
15
|
-
return colors.neutral.white;
|
|
16
|
-
}, function (_ref2) {
|
|
17
|
-
var theme = _ref2.theme;
|
|
18
|
-
return "0px 16px 32px ".concat(theme.shadow.level3);
|
|
19
|
-
});
|
|
20
|
-
exports.DatePickerContentContainer = DatePickerContentContainer;
|
|
21
|
-
var DatePickerContainer = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n"])));
|
|
22
|
-
exports.DatePickerContainer = DatePickerContainer;
|
|
23
|
-
var DatePickerHeader = _styled.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 15px;\n width: 100%;\n"])));
|
|
24
|
-
exports.DatePickerHeader = DatePickerHeader;
|
|
25
|
-
var DatePickerHeaderTitle = _styled.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n font-family: inherit;\n font-size: 0.875rem;\n font-weight: 600;\n gap: 0.875rem;\n line-height: 1rem;\n\n color: ", ";\n\n ", "\n\n user-select: none;\n"])), function (_ref3) {
|
|
26
|
-
var colors = _ref3.theme.colors;
|
|
27
|
-
return colors.neutral.black;
|
|
28
|
-
}, function (props) {
|
|
29
|
-
return props.enableYearPicker && "\n cursor: pointer;\n ";
|
|
30
|
-
});
|
|
31
|
-
exports.DatePickerHeaderTitle = DatePickerHeaderTitle;
|
|
32
|
-
var DatePickerHeaderButton = _styled.default.button(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: ", ";\n cursor: pointer;\n border: none;\n outline: 0;\n background-color: transparent;\n\n ", "\n\n & svg {\n stroke-width: 10px;\n }\n"])), function (_ref4) {
|
|
33
|
-
var colors = _ref4.theme.colors;
|
|
34
|
-
return colors.neutral.neutral5;
|
|
35
|
-
}, function (_ref5) {
|
|
36
|
-
var isHidden = _ref5.isHidden;
|
|
37
|
-
return isHidden && "\n visibility: hidden;\n pointer-events: none;\n ";
|
|
38
|
-
});
|
|
39
|
-
exports.DatePickerHeaderButton = DatePickerHeaderButton;
|
|
40
|
-
var DatePickerBody = _styled.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n width: 100%;\n"])));
|
|
41
|
-
exports.DatePickerBody = DatePickerBody;
|
|
42
|
-
var DatePickerBodyTable = _styled.default.table(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n width: 100%;\n border-collapse: collapse;\n border-spacing: 10px;\n table-layout: fixed;\n\n & thead tr th {\n padding: 0.75rem;\n font-family: inherit;\n font-size: 0.75rem;\n font-weight: 500;\n color: ", ";\n user-select: none;\n }\n"])), function (_ref6) {
|
|
43
|
-
var colors = _ref6.theme.colors;
|
|
44
|
-
return colors.neutral.black;
|
|
45
|
-
});
|
|
46
|
-
exports.DatePickerBodyTable = DatePickerBodyTable;
|
|
47
|
-
var DatePickerTableRow = _styled.default.tr(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ", ";\n"])), function (props) {
|
|
48
|
-
return props.isRange && "\n & td:first-of-type:before {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n }\n\n & td:last-of-type:before {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n }\n ";
|
|
49
|
-
});
|
|
50
|
-
exports.DatePickerTableRow = DatePickerTableRow;
|
|
51
|
-
var DatePickerTableCell = _styled.default.td(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n position: relative;\n height: 0;\n padding: 12px;\n text-align: center;\n font-family: inherit;\n font-size: 0.75rem;\n font-weight: 600;\n border-radius: 50%;\n cursor: pointer;\n background-color: ", ";\n\n color: ", ";\n\n user-select: none;\n\n transition: background 150ms ease;\n\n ", "\n\n ", "\n\n ", "\n\n &:hover {\n background-color: ", ";\n }\n\n ", "\n\n &.is-current[aria-selected='false']:before {\n border-radius: 0 50% 50% 0 !important;\n }\n\n &.is-current[aria-selected='true']:before {\n display: none;\n }\n"])), function (props) {
|
|
52
|
-
return !props.isPrevNextMonth && !props.disabled && props.showSelectedDate && (props.isSelected || props.isEndDateOfRange) ? (0, _getColorValue.getColorValue)(props.theme.colorSelected, props.theme) : 'transparent';
|
|
53
|
-
}, function (props) {
|
|
54
|
-
return props.isPrevNextMonth ? props.theme.colors.neutral.neutral2 : props.isSelected || props.isEndDateOfRange ? !props.showSelectedDate ? props.theme.colors.neutral.black : props.theme.lightColors.neutral.white : props['aria-selected'] ? (0, _getColorValue.getColorValue)(props.theme.colorSelected, props.theme) : props.theme.colors.neutral.black;
|
|
55
|
-
}, function (props) {
|
|
56
|
-
return props.disabled && "\n pointer-events: none;\n cursor: default;\n color: ".concat(props.theme.colors.neutral.neutral1, ";\n ");
|
|
57
|
-
}, function (props) {
|
|
58
|
-
return props.isToday && !props.isSelected && !props.isEndDateOfRange && "\n &:after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100%;\n height: 100%;\n border-radius: 50%;\n border: solid 1px ".concat(props.theme.colors.neutral.neutral2, ";\n transform: translate(-50%, -50%);\n }\n ");
|
|
59
|
-
}, function (props) {
|
|
60
|
-
return !props.isTheSameDate && (props.isInTheRange || props.isEndDateOfRange || props.isStartDateOfRange) && "\n \n &:before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100%;\n height: 96%;\n border-radius: ".concat(props.isStartDateOfRange ? '50% 0 0 50% !important' : props.isEndDateOfRange ? '0 50% 50% 0 !important' : props.isFirstDayOfMonth ? '4px 0 0 4px' : props.isLastDayOfMonth ? '0 4px 4px 0' : '0', ";\n \n background-color: ").concat(!props.isPrevNextMonth && !props.disabled ? (0, _colorCheck.parseHexColorToRgba)((0, _getColorValue.getColorValue)(props.theme.colorSelected, props.theme), 0.1) : 'transparent', "; \n\n transform: translate(-50%, -50%);\n }\n ");
|
|
61
|
-
}, function (props) {
|
|
62
|
-
return !props.isSelected && !props.isEndDateOfRange && props.theme.colors.neutral.neutral1;
|
|
63
|
-
}, function (props) {
|
|
64
|
-
return (props['aria-selected'] !== 'true' || props.isStartDateOfRange || props.isFirstDayOfMonth || props.isSelected || props.isLastDayOfMonth) && "\n &.is-hover {\n &:before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100%;\n border-radius: ".concat(props.isStartDateOfRange ? '50% 0 0 50% !important' : props.isEndDateOfRange ? '50%' : props.isFirstDayOfMonth ? '4px 0 0 4px' : props.isLastDayOfMonth ? '0 4px 4px 0' : '0', ";\n height: 96%;\n background-color: ").concat(!props.isPrevNextMonth && !props.disabled && (0, _colorCheck.parseHexColorToRgba)((0, _getColorValue.getColorValue)(props.theme.colorSelected, props.theme), 0.1), "; \n transform: translate(-50%, -50%);\n }\n }\n }");
|
|
65
|
-
});
|
|
66
|
-
exports.DatePickerTableCell = DatePickerTableCell;
|
|
67
|
-
var DatePickerTableCellSpan = _styled.default.span(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n z-index: ", ";\n"])), function (props) {
|
|
68
|
-
return props.theme.zIndex.level24;
|
|
69
|
-
});
|
|
70
|
-
exports.DatePickerTableCellSpan = DatePickerTableCellSpan;
|
|
71
|
-
var DateYearPickerContainer = _styled.default.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n"])));
|
|
72
|
-
exports.DateYearPickerContainer = DateYearPickerContainer;
|
|
73
|
-
var DateYearPickerBody = _styled.default.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n"])));
|
|
74
|
-
exports.DateYearPickerBody = DateYearPickerBody;
|
|
75
|
-
var DateYearPickerCell = _styled.default.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 0.75rem 0;\n font-family: inherit;\n font-size: 0.875rem;\n font-weight: 500;\n cursor: pointer;\n border-radius: 4px;\n color: ", ";\n pointer-events: ", ";\n transition: background 150ms ease;\n\n ", ";\n\n &:hover {\n background-color: ", ";\n }\n"])), function (_ref7) {
|
|
76
|
-
var isSelected = _ref7.isSelected,
|
|
77
|
-
theme = _ref7.theme,
|
|
78
|
-
disabled = _ref7.disabled;
|
|
79
|
-
return isSelected ? theme.colors.neutral.white : disabled ? theme.colors.neutral.neutral2 : theme.colors.neutral.black;
|
|
80
|
-
}, function (_ref8) {
|
|
81
|
-
var disabled = _ref8.disabled;
|
|
82
|
-
return disabled && 'none';
|
|
83
|
-
}, function (props) {
|
|
84
|
-
return props.isSelected && "\n background-color: ".concat((0, _getColorValue.getColorValue)(props.theme.colorSelected, props.theme), ";\n color: white;\n ");
|
|
85
|
-
}, function (props) {
|
|
86
|
-
return !props.isSelected && props.theme.colors.neutral.neutral1;
|
|
87
|
-
});
|
|
88
|
-
exports.DateYearPickerCell = DateYearPickerCell;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DateYearPickerContainer=exports.DateYearPickerCell=exports.DateYearPickerBody=exports.DatePickerTableRow=exports.DatePickerTableCellSpan=exports.DatePickerTableCell=exports.DatePickerHeaderTitle=exports.DatePickerHeaderButton=exports.DatePickerHeader=exports.DatePickerContentContainer=exports.DatePickerContainer=exports.DatePickerBodyTable=exports.DatePickerBody=void 0;var _templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10,_templateObject11,_templateObject12,_templateObject13,_styled=_interopRequireDefault(require("@emotion/styled")),_colorCheck=require("../../utils/colorCheck"),_getColorValue=require("../../utils/getColorValue");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 DatePickerContentContainer=_styled.default.div(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n max-width: fit-content;\n gap: 20px;\n padding: 24px 18px;\n border-radius: 8px;\n background-color: ",";\n box-shadow: ",";\n\n @media (max-width: 750px) {\n flex-wrap: wrap;\n }\n\n & > div {\n width: 290px;\n }\n"])),function(_ref){var colors=_ref.theme.colors;return colors.neutral.white},function(_ref2){var theme=_ref2.theme;return"0px 16px 32px ".concat(theme.shadow.level3)});exports.DatePickerContentContainer=DatePickerContentContainer;var DatePickerContainer=_styled.default.div(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n"])));exports.DatePickerContainer=DatePickerContainer;var DatePickerHeader=_styled.default.div(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 15px;\n width: 100%;\n"])));exports.DatePickerHeader=DatePickerHeader;var DatePickerHeaderTitle=_styled.default.div(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n font-family: inherit;\n font-size: 0.875rem;\n font-weight: 600;\n gap: 0.875rem;\n line-height: 1rem;\n\n color: ",";\n\n ","\n\n user-select: none;\n"])),function(_ref3){var colors=_ref3.theme.colors;return colors.neutral.black},function(props){return props.enableYearPicker&&"\n cursor: pointer;\n "});exports.DatePickerHeaderTitle=DatePickerHeaderTitle;var DatePickerHeaderButton=_styled.default.button(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n color: ",";\n cursor: pointer;\n border: none;\n outline: 0;\n background-color: transparent;\n\n ","\n\n & svg {\n stroke-width: 10px;\n }\n"])),function(_ref4){var colors=_ref4.theme.colors;return colors.neutral.neutral5},function(_ref5){var isHidden=_ref5.isHidden;return isHidden&&"\n visibility: hidden;\n pointer-events: none;\n "});exports.DatePickerHeaderButton=DatePickerHeaderButton;var DatePickerBody=_styled.default.div(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n width: 100%;\n"])));exports.DatePickerBody=DatePickerBody;var DatePickerBodyTable=_styled.default.table(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n width: 100%;\n border-collapse: collapse;\n border-spacing: 10px;\n table-layout: fixed;\n\n & thead tr th {\n padding: 0.75rem;\n font-family: inherit;\n font-size: 0.75rem;\n font-weight: 500;\n color: ",";\n user-select: none;\n }\n"])),function(_ref6){var colors=_ref6.theme.colors;return colors.neutral.black});exports.DatePickerBodyTable=DatePickerBodyTable;var DatePickerTableRow=_styled.default.tr(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["\n ",";\n"])),function(props){return props.isRange&&"\n & td:first-of-type:before {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n }\n\n & td:last-of-type:before {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n }\n "});exports.DatePickerTableRow=DatePickerTableRow;var DatePickerTableCell=_styled.default.td(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n position: relative;\n height: 0;\n padding: 12px;\n text-align: center;\n font-family: inherit;\n font-size: 0.75rem;\n font-weight: 600;\n border-radius: 50%;\n cursor: pointer;\n background-color: ",";\n\n color: ",";\n\n user-select: none;\n\n transition: background 150ms ease;\n\n ","\n\n ","\n\n ","\n\n &:hover {\n background-color: ",";\n }\n\n ","\n\n &.is-current[aria-selected='false']:before {\n border-radius: 0 50% 50% 0 !important;\n }\n\n &.is-current[aria-selected='true']:before {\n display: none;\n }\n"])),function(props){return!props.isPrevNextMonth&&!props.disabled&&props.showSelectedDate&&(props.isSelected||props.isEndDateOfRange)?(0,_getColorValue.getColorValue)(props.theme.colorSelected,props.theme):"transparent"},function(props){return props.isPrevNextMonth?props.theme.colors.neutral.neutral2:props.isSelected||props.isEndDateOfRange?props.showSelectedDate?props.theme.lightColors.neutral.white:props.theme.colors.neutral.black:props["aria-selected"]?(0,_getColorValue.getColorValue)(props.theme.colorSelected,props.theme):props.theme.colors.neutral.black},function(props){return props.disabled&&"\n pointer-events: none;\n cursor: default;\n color: ".concat(props.theme.colors.neutral.neutral1,";\n ")},function(props){return props.isToday&&!props.isSelected&&!props.isEndDateOfRange&&"\n &:after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100%;\n height: 100%;\n border-radius: 50%;\n border: solid 1px ".concat(props.theme.colors.neutral.neutral2,";\n transform: translate(-50%, -50%);\n }\n ")},function(props){return!props.isTheSameDate&&(props.isInTheRange||props.isEndDateOfRange||props.isStartDateOfRange)&&"\n \n &:before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100%;\n height: 96%;\n border-radius: ".concat(props.isStartDateOfRange?"50% 0 0 50% !important":props.isEndDateOfRange?"0 50% 50% 0 !important":props.isFirstDayOfMonth?"4px 0 0 4px":props.isLastDayOfMonth?"0 4px 4px 0":"0",";\n \n background-color: ").concat(props.isPrevNextMonth||props.disabled?"transparent":(0,_colorCheck.parseHexColorToRgba)((0,_getColorValue.getColorValue)(props.theme.colorSelected,props.theme),.1),"; \n\n transform: translate(-50%, -50%);\n }\n ")},function(props){return!props.isSelected&&!props.isEndDateOfRange&&props.theme.colors.neutral.neutral1},function(props){return("true"!==props["aria-selected"]||props.isStartDateOfRange||props.isFirstDayOfMonth||props.isSelected||props.isLastDayOfMonth)&&"\n &.is-hover {\n &:before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100%;\n border-radius: ".concat(props.isStartDateOfRange?"50% 0 0 50% !important":props.isEndDateOfRange?"50%":props.isFirstDayOfMonth?"4px 0 0 4px":props.isLastDayOfMonth?"0 4px 4px 0":"0",";\n height: 96%;\n background-color: ").concat(!props.isPrevNextMonth&&!props.disabled&&(0,_colorCheck.parseHexColorToRgba)((0,_getColorValue.getColorValue)(props.theme.colorSelected,props.theme),.1),"; \n transform: translate(-50%, -50%);\n }\n }\n }")});exports.DatePickerTableCell=DatePickerTableCell;var DatePickerTableCellSpan=_styled.default.span(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n position: relative;\n z-index: ",";\n"])),function(props){return props.theme.zIndex.level24});exports.DatePickerTableCellSpan=DatePickerTableCellSpan;var DateYearPickerContainer=_styled.default.div(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n"])));exports.DateYearPickerContainer=DateYearPickerContainer;var DateYearPickerBody=_styled.default.div(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n"])));exports.DateYearPickerBody=DateYearPickerBody;var DateYearPickerCell=_styled.default.div(_templateObject13||(_templateObject13=_taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 0.75rem 0;\n font-family: inherit;\n font-size: 0.875rem;\n font-weight: 500;\n cursor: pointer;\n border-radius: 4px;\n color: ",";\n pointer-events: ",";\n transition: background 150ms ease;\n\n ",";\n\n &:hover {\n background-color: ",";\n }\n"])),function(_ref7){var isSelected=_ref7.isSelected,theme=_ref7.theme,disabled=_ref7.disabled;return isSelected?theme.colors.neutral.white:disabled?theme.colors.neutral.neutral2:theme.colors.neutral.black},function(_ref8){var disabled=_ref8.disabled;return disabled&&"none"},function(props){return props.isSelected&&"\n background-color: ".concat((0,_getColorValue.getColorValue)(props.theme.colorSelected,props.theme),";\n color: white;\n ")},function(props){return!props.isSelected&&props.theme.colors.neutral.neutral1});exports.DateYearPickerCell=DateYearPickerCell;
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getMonthName = void 0;
|
|
7
|
-
var getMonthName = function getMonthName(month) {
|
|
8
|
-
var months = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'];
|
|
9
|
-
return months[month];
|
|
10
|
-
};
|
|
11
|
-
exports.getMonthName = getMonthName;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getMonthName=void 0;var getMonthName=function(month){return["Janeiro","Fevereiro","Mar\xE7o","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"][month]};exports.getMonthName=getMonthName;
|
|
@@ -1,46 +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 = DialogExample;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _FocusLock = _interopRequireDefault(require("../../shared/components/FocusLock"));
|
|
10
|
-
var _ = require(".");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
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; }
|
|
16
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
-
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); }
|
|
18
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
-
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."); }
|
|
20
|
-
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); }
|
|
21
|
-
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; }
|
|
22
|
-
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; } }
|
|
23
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
-
function DialogExample(props) {
|
|
25
|
-
var _useState = (0, _react.useState)(props.open),
|
|
26
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
-
showDialog = _useState2[0],
|
|
28
|
-
setShowDialog = _useState2[1];
|
|
29
|
-
(0, _react.useEffect)(function () {
|
|
30
|
-
setShowDialog(props.open);
|
|
31
|
-
}, [props.open]);
|
|
32
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_FocusLock.default, {
|
|
33
|
-
isLocked: !props.open,
|
|
34
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Dialog, _objectSpread(_objectSpread({}, props), {}, {
|
|
35
|
-
open: showDialog,
|
|
36
|
-
onClose: function onClose() {
|
|
37
|
-
return setShowDialog(false);
|
|
38
|
-
}
|
|
39
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
40
|
-
onClick: function onClick() {
|
|
41
|
-
return setShowDialog(true);
|
|
42
|
-
},
|
|
43
|
-
children: "Show Dialog"
|
|
44
|
-
})]
|
|
45
|
-
});
|
|
46
|
-
}
|
|
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=DialogExample;var _react=require("react"),_FocusLock=_interopRequireDefault(require("../../shared/components/FocusLock")),_=require("."),_jsxRuntime=require("react/jsx-runtime");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 DialogExample(props){var _useState=(0,_react.useState)(props.open),_useState2=_slicedToArray(_useState,2),showDialog=_useState2[0],setShowDialog=_useState2[1];return(0,_react.useEffect)(function(){setShowDialog(props.open)},[props.open]),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_FocusLock.default,{isLocked:!props.open,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Dialog,_objectSpread(_objectSpread({},props),{},{open:showDialog,onClose:function onClose(){return setShowDialog(!1)}})),/*#__PURE__*/(0,_jsxRuntime.jsx)("button",{onClick:function onClick(){return setShowDialog(!0)},children:"Show Dialog"})]})}
|