maru_design2 0.0.3 → 0.1.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/atoms/checkbox/Checkbox.d.ts +1 -2
- package/dist/components/atoms/chip/Chip.d.ts +1 -2
- package/dist/components/atoms/icon/Icon.d.ts +1 -2
- package/dist/components/atoms/input/Input.d.ts +1 -2
- package/dist/components/atoms/popover/Popover.d.ts +1 -2
- package/dist/components/atoms/radio/Radio.d.ts +1 -2
- package/dist/components/atoms/toggle/Toggle.d.ts +1 -2
- package/dist/components/atoms/tooltip/Tooltip.d.ts +1 -2
- package/dist/components/molecules/dropdown/Dropdown.d.ts +7 -11
- package/dist/components/molecules/dropdown/Menu.d.ts +1 -2
- package/dist/components/molecules/dropdown/toggles/Arrow.d.ts +2 -1
- package/dist/components/molecules/modal/Modal.d.ts +1 -2
- package/dist/components/molecules/pagination/Pagination.d.ts +3 -4
- package/dist/index.js +3073 -49
- package/package.json +1 -1
- package/.babelrc.json +0 -18
- package/.eslintrc.json +0 -110
- package/.github/workflows/chromatic.yml +0 -19
- package/.prettierrc +0 -8
- package/build-storybook.log +0 -29
- package/scripts/svg-parser.js +0 -224
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useMemo, forwardRef, useRef, useEffect } from 'react';
|
|
3
|
-
import 'react-dom';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
4
4
|
|
|
5
5
|
/******************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation.
|
|
@@ -40,6 +40,16 @@ function __rest(s, e) {
|
|
|
40
40
|
return t;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
function __spreadArray(to, from, pack) {
|
|
44
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
45
|
+
if (ar || !(i in from)) {
|
|
46
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
47
|
+
ar[i] = from[i];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
51
|
+
}
|
|
52
|
+
|
|
43
53
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
44
54
|
var e = new Error(message);
|
|
45
55
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -3021,7 +3031,7 @@ function uuidv4(length) {
|
|
|
3021
3031
|
}
|
|
3022
3032
|
}
|
|
3023
3033
|
|
|
3024
|
-
var css_248z$9 = ".maru-checkbox-wrapper-4px {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n gap: 4px;\n}\n\n.maru-checkbox-wrapper-8px {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n gap: 8px;\n}\n\n.maru-checkbox-inner-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n\n.maru-checkbox {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n}\n\n.maru-checkbox-label {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n color: #5c5c5c;\n cursor: pointer;\n}\n.maru-checkbox-label.label-disabled {\n color: #8c8c8c;\n}\n\n.maru-checkbox:disabled,\n.label-disabled {\n cursor: default;\n}";
|
|
3034
|
+
var css_248z$9 = ".maru-checkbox-wrapper-4px {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n gap: 4px;\n}\n\n.maru-checkbox-wrapper-8px {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n gap: 8px;\n}\n\n.maru-checkbox-inner-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n position: relative;\n}\n\n.maru-checkbox {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n}\n\n.maru-checkbox-label {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n color: #5c5c5c;\n cursor: pointer;\n}\n.maru-checkbox-label.label-disabled {\n color: #8c8c8c;\n}\n\n.maru-checkbox:disabled,\n.label-disabled {\n cursor: default;\n}";
|
|
3025
3035
|
styleInject(css_248z$9);
|
|
3026
3036
|
|
|
3027
3037
|
var Checkbox = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
@@ -3076,6 +3086,28 @@ Checkbox.displayName = 'Checkbox';
|
|
|
3076
3086
|
var css_248z$8 = ".maru-chip {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n border-radius: 10px;\n}\n.maru-chip-primary-default {\n background-color: var(--p-10);\n color: var(--p);\n}\n.maru-chip-primary-default.maru-chip-warning-default, .maru-chip-primary-default.maru-chip-positive-default {\n background-color: var(--p-20);\n}\n.maru-chip-primary-outline {\n background-color: var(--p-10);\n border: 1px solid var(--p);\n color: var(--p);\n}\n.maru-chip-primary-outline.maru-chip-warning-default, .maru-chip-primary-outline.maru-chip-positive-default {\n background-color: var(--p-20);\n}\n.maru-chip-primary-dot {\n color: var(--p);\n}\n.maru-chip-secondary-default {\n background-color: #fafafa;\n color: #8c8c8c;\n}\n.maru-chip-secondary-default.maru-chip-warning-default, .maru-chip-secondary-default.maru-chip-positive-default {\n background-color: #e4e4e4;\n}\n.maru-chip-secondary-outline {\n background-color: #fafafa;\n border: 1px solid #8c8c8c;\n color: #8c8c8c;\n}\n.maru-chip-secondary-outline.maru-chip-warning-default, .maru-chip-secondary-outline.maru-chip-positive-default {\n background-color: #e4e4e4;\n}\n.maru-chip-secondary-dot {\n color: #8c8c8c;\n}\n.maru-chip-positive-default {\n color: #58c5a6;\n}\n.maru-chip-positive-default.maru-chip-warning-default, .maru-chip-positive-default.maru-chip-positive-default {\n background-color: #def3ed;\n}\n.maru-chip-positive-outline {\n border: 1px solid #58c5a6;\n color: #58c5a6;\n}\n.maru-chip-positive-outline.maru-chip-warning-default, .maru-chip-positive-outline.maru-chip-positive-default {\n background-color: #def3ed;\n}\n.maru-chip-positive-dot {\n color: #58c5a6;\n}\n.maru-chip-warning-default {\n background-color: #fff7e9;\n color: #ffb020;\n}\n.maru-chip-warning-default.maru-chip-warning-default, .maru-chip-warning-default.maru-chip-positive-default {\n background-color: #ffefd2;\n}\n.maru-chip-warning-outline {\n background-color: #fff7e9;\n border: 1px solid #ffb020;\n color: #ffb020;\n}\n.maru-chip-warning-outline.maru-chip-warning-default, .maru-chip-warning-outline.maru-chip-positive-default {\n background-color: #ffefd2;\n}\n.maru-chip-warning-dot {\n color: #ffb020;\n}\n.maru-chip-danger-default {\n background-color: #fcecec;\n color: #e53e3e;\n}\n.maru-chip-danger-default.maru-chip-warning-default, .maru-chip-danger-default.maru-chip-positive-default {\n background-color: #fad8d8;\n}\n.maru-chip-danger-outline {\n background-color: #fcecec;\n border: 1px solid #e53e3e;\n color: #e53e3e;\n}\n.maru-chip-danger-outline.maru-chip-warning-default, .maru-chip-danger-outline.maru-chip-positive-default {\n background-color: #fad8d8;\n}\n.maru-chip-danger-dot {\n color: #e53e3e;\n}\n.maru-chip-size-small {\n padding: 1.5px 8px;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 12px;\n letter-spacing: -0.48px;\n font-weight: 500;\n}\n.maru-chip-size-normal {\n padding: 2px 10px;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n}";
|
|
3077
3087
|
styleInject(css_248z$8);
|
|
3078
3088
|
|
|
3089
|
+
function Chip(_a) {
|
|
3090
|
+
var content = _a.content,
|
|
3091
|
+
className = _a.className,
|
|
3092
|
+
_b = _a.color,
|
|
3093
|
+
color = _b === void 0 ? 'primary' : _b,
|
|
3094
|
+
_c = _a.size,
|
|
3095
|
+
size = _c === void 0 ? 'normal' : _c,
|
|
3096
|
+
_d = _a.variant,
|
|
3097
|
+
variant = _d === void 0 ? 'default' : _d;
|
|
3098
|
+
return jsxs("div", __assign({
|
|
3099
|
+
className: classNames('maru-chip', "maru-chip-".concat(color, "-").concat(variant), "maru-chip-size-".concat(size), className)
|
|
3100
|
+
}, {
|
|
3101
|
+
children: [variant === 'dot' && jsx(Icon, {
|
|
3102
|
+
name: ICONS.StateThin,
|
|
3103
|
+
size: 16,
|
|
3104
|
+
color: color
|
|
3105
|
+
}), jsx("span", {
|
|
3106
|
+
children: content.toLocaleString('en')
|
|
3107
|
+
})]
|
|
3108
|
+
}));
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3079
3111
|
var css_248z$7 = ".maru-input-wrapper .maru-input-label {\n margin-bottom: 8px;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 600;\n}\n.maru-input-wrapper .maru-input {\n border: 1px solid #e4e4e4;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n height: 37px;\n padding: 8px 10px 8px 14px;\n border-radius: 8px;\n}\n.maru-input-wrapper .maru-input:focus-visible, .maru-input-wrapper .maru-input:focus-within {\n border: 2px solid #e4e4e4;\n background-color: #fafafa;\n}\n.maru-input-wrapper .maru-input.errored {\n border: 2px solid #e53e3e;\n}\n.maru-input-wrapper .maru-input.errored:focus-visible, .maru-input-wrapper .maru-input.errored:focus-within {\n border: 2px solid #e4e4e4;\n background-color: #fafafa;\n}\n.maru-input-wrapper .maru-input:hover {\n border: 2px solid #e4e4e4;\n background-color: #fafafa;\n}\n.maru-input-wrapper .maru-input > input {\n width: 100%;\n border: unset;\n outline: unset;\n background-color: transparent;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n color: #5c5c5c;\n}\n.maru-input-wrapper .maru-input > input::-webkit-input-placeholder {\n color: #bdbdbd;\n}\n.maru-input-wrapper .maru-input > input::-moz-placeholder {\n color: #bdbdbd;\n}\n.maru-input-wrapper .maru-input > input:-ms-input-placeholder {\n color: #bdbdbd;\n}\n.maru-input-wrapper .maru-input > input::-ms-input-placeholder {\n color: #bdbdbd;\n}\n.maru-input-wrapper .maru-input > input::placeholder {\n color: #bdbdbd;\n}\n.maru-input-wrapper .maru-input-start-node {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n margin-right: 10px;\n}\n.maru-input-wrapper .maru-input-end-node-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-input-wrapper .maru-input-end-node-wrapper > button {\n padding: unset;\n margin: unset;\n border: unset;\n background-color: unset;\n cursor: pointer;\n}\n.maru-input-wrapper .maru-input-end-node-wrapper > button:last-of-type {\n margin-left: 0.25em;\n}\n.maru-input-wrapper .maru-input-end-node-wrapper .maru-input-end-icon-wrapper {\n width: 16px;\n height: 16px;\n}\n.maru-input-wrapper .maru-input-end-node-wrapper .maru-input-end-node {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n margin-left: 10px;\n}\n.maru-input-wrapper .maru-input-footer {\n display: block;\n margin-top: 4px;\n}\n.maru-input-wrapper .maru-input-footer > span {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 12px;\n letter-spacing: -0.48px;\n font-weight: 500;\n color: #e53e3e;\n}\n.maru-input-wrapper.maru-input-disabled input {\n opacity: 0.5;\n pointer-events: none;\n}\n.maru-input-wrapper.maru-input-disabled .maru-input-default:hover,\n.maru-input-wrapper.maru-input-disabled .maru-input-default:focus-within,\n.maru-input-wrapper.maru-input-disabled .maru-input-underline:hover,\n.maru-input-wrapper.maru-input-disabled .maru-input-underline:focus-within {\n border-color: transparent;\n outline: transparent;\n}";
|
|
3080
3112
|
styleInject(css_248z$7);
|
|
3081
3113
|
|
|
@@ -3265,59 +3297,3051 @@ Input.defaultProps = {
|
|
|
3265
3297
|
};
|
|
3266
3298
|
Input.displayName = 'Input';
|
|
3267
3299
|
|
|
3268
|
-
var
|
|
3269
|
-
|
|
3300
|
+
var top = 'top';
|
|
3301
|
+
var bottom = 'bottom';
|
|
3302
|
+
var right = 'right';
|
|
3303
|
+
var left = 'left';
|
|
3304
|
+
var auto = 'auto';
|
|
3305
|
+
var basePlacements = [top, bottom, right, left];
|
|
3306
|
+
var start = 'start';
|
|
3307
|
+
var end = 'end';
|
|
3308
|
+
var clippingParents = 'clippingParents';
|
|
3309
|
+
var viewport = 'viewport';
|
|
3310
|
+
var popper = 'popper';
|
|
3311
|
+
var reference = 'reference';
|
|
3312
|
+
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
|
3313
|
+
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
|
3314
|
+
}, []);
|
|
3315
|
+
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
|
3316
|
+
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
|
3317
|
+
}, []); // modifiers that need to read the DOM
|
|
3270
3318
|
|
|
3271
|
-
var
|
|
3272
|
-
|
|
3319
|
+
var beforeRead = 'beforeRead';
|
|
3320
|
+
var read = 'read';
|
|
3321
|
+
var afterRead = 'afterRead'; // pure-logic modifiers
|
|
3273
3322
|
|
|
3274
|
-
var
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3323
|
+
var beforeMain = 'beforeMain';
|
|
3324
|
+
var main = 'main';
|
|
3325
|
+
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
|
3326
|
+
|
|
3327
|
+
var beforeWrite = 'beforeWrite';
|
|
3328
|
+
var write = 'write';
|
|
3329
|
+
var afterWrite = 'afterWrite';
|
|
3330
|
+
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
3331
|
+
|
|
3332
|
+
function getNodeName(element) {
|
|
3333
|
+
return element ? (element.nodeName || '').toLowerCase() : null;
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
function getWindow(node) {
|
|
3337
|
+
if (node == null) {
|
|
3338
|
+
return window;
|
|
3339
|
+
}
|
|
3340
|
+
|
|
3341
|
+
if (node.toString() !== '[object Window]') {
|
|
3342
|
+
var ownerDocument = node.ownerDocument;
|
|
3343
|
+
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3346
|
+
return node;
|
|
3347
|
+
}
|
|
3348
|
+
|
|
3349
|
+
function isElement(node) {
|
|
3350
|
+
var OwnElement = getWindow(node).Element;
|
|
3351
|
+
return node instanceof OwnElement || node instanceof Element;
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
function isHTMLElement(node) {
|
|
3355
|
+
var OwnElement = getWindow(node).HTMLElement;
|
|
3356
|
+
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3359
|
+
function isShadowRoot(node) {
|
|
3360
|
+
// IE 11 has no ShadowRoot
|
|
3361
|
+
if (typeof ShadowRoot === 'undefined') {
|
|
3362
|
+
return false;
|
|
3363
|
+
}
|
|
3364
|
+
|
|
3365
|
+
var OwnElement = getWindow(node).ShadowRoot;
|
|
3366
|
+
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
// and applies them to the HTMLElements such as popper and arrow
|
|
3370
|
+
|
|
3371
|
+
function applyStyles(_ref) {
|
|
3372
|
+
var state = _ref.state;
|
|
3373
|
+
Object.keys(state.elements).forEach(function (name) {
|
|
3374
|
+
var style = state.styles[name] || {};
|
|
3375
|
+
var attributes = state.attributes[name] || {};
|
|
3376
|
+
var element = state.elements[name]; // arrow is optional + virtual elements
|
|
3377
|
+
|
|
3378
|
+
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
3379
|
+
return;
|
|
3380
|
+
} // Flow doesn't support to extend this property, but it's the most
|
|
3381
|
+
// effective way to apply styles to an HTMLElement
|
|
3382
|
+
// $FlowFixMe[cannot-write]
|
|
3383
|
+
|
|
3384
|
+
|
|
3385
|
+
Object.assign(element.style, style);
|
|
3386
|
+
Object.keys(attributes).forEach(function (name) {
|
|
3387
|
+
var value = attributes[name];
|
|
3388
|
+
|
|
3389
|
+
if (value === false) {
|
|
3390
|
+
element.removeAttribute(name);
|
|
3391
|
+
} else {
|
|
3392
|
+
element.setAttribute(name, value === true ? '' : value);
|
|
3393
|
+
}
|
|
3394
|
+
});
|
|
3395
|
+
});
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3398
|
+
function effect$2(_ref2) {
|
|
3399
|
+
var state = _ref2.state;
|
|
3400
|
+
var initialStyles = {
|
|
3401
|
+
popper: {
|
|
3402
|
+
position: state.options.strategy,
|
|
3403
|
+
left: '0',
|
|
3404
|
+
top: '0',
|
|
3405
|
+
margin: '0'
|
|
3406
|
+
},
|
|
3407
|
+
arrow: {
|
|
3408
|
+
position: 'absolute'
|
|
3409
|
+
},
|
|
3410
|
+
reference: {}
|
|
3411
|
+
};
|
|
3412
|
+
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
3413
|
+
state.styles = initialStyles;
|
|
3414
|
+
|
|
3415
|
+
if (state.elements.arrow) {
|
|
3416
|
+
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
return function () {
|
|
3420
|
+
Object.keys(state.elements).forEach(function (name) {
|
|
3421
|
+
var element = state.elements[name];
|
|
3422
|
+
var attributes = state.attributes[name] || {};
|
|
3423
|
+
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
|
|
3424
|
+
|
|
3425
|
+
var style = styleProperties.reduce(function (style, property) {
|
|
3426
|
+
style[property] = '';
|
|
3427
|
+
return style;
|
|
3428
|
+
}, {}); // arrow is optional + virtual elements
|
|
3429
|
+
|
|
3430
|
+
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
3431
|
+
return;
|
|
3432
|
+
}
|
|
3433
|
+
|
|
3434
|
+
Object.assign(element.style, style);
|
|
3435
|
+
Object.keys(attributes).forEach(function (attribute) {
|
|
3436
|
+
element.removeAttribute(attribute);
|
|
3437
|
+
});
|
|
3438
|
+
});
|
|
3439
|
+
};
|
|
3440
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
3441
|
+
|
|
3442
|
+
|
|
3443
|
+
var applyStyles$1 = {
|
|
3444
|
+
name: 'applyStyles',
|
|
3445
|
+
enabled: true,
|
|
3446
|
+
phase: 'write',
|
|
3447
|
+
fn: applyStyles,
|
|
3448
|
+
effect: effect$2,
|
|
3449
|
+
requires: ['computeStyles']
|
|
3305
3450
|
};
|
|
3306
|
-
Radio.displayName = 'Radio';
|
|
3307
3451
|
|
|
3308
|
-
|
|
3309
|
-
|
|
3452
|
+
function getBasePlacement(placement) {
|
|
3453
|
+
return placement.split('-')[0];
|
|
3454
|
+
}
|
|
3310
3455
|
|
|
3311
|
-
var
|
|
3312
|
-
|
|
3456
|
+
var max = Math.max;
|
|
3457
|
+
var min = Math.min;
|
|
3458
|
+
var round = Math.round;
|
|
3313
3459
|
|
|
3314
|
-
var css_248z$2 = ".maru-dropdown .maru-dropdown-label {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 600;\n color: #5c5c5c;\n display: block;\n margin-bottom: 4px;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper {\n width: 100%;\n border-radius: 8px;\n border: 1px solid #e4e4e4;\n cursor: pointer;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:hover {\n border: 1px solid var(--p);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:hover .maru-dropdown-input > input {\n color: var(--p);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:focus-within {\n border: 1px solid var(--p);\n outline: none;\n background-color: var(--p-10);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:focus-within .maru-dropdown-input > input {\n color: var(--p);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:hover {\n border: 1px solid #8c8c8c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:hover .maru-dropdown-input > input {\n color: #8c8c8c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:focus-within {\n border: 1px solid #8c8c8c;\n outline: none;\n background-color: #fafafa;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:focus-within .maru-dropdown-input > input {\n color: #8c8c8c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:hover {\n border: 1px solid #58c5a6;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:hover .maru-dropdown-input > input {\n color: #58c5a6;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:focus-within {\n border: 1px solid #58c5a6;\n outline: none;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:focus-within .maru-dropdown-input > input {\n color: #58c5a6;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:hover {\n border: 1px solid #ffb020;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:hover .maru-dropdown-input > input {\n color: #ffb020;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:focus-within {\n border: 1px solid #ffb020;\n outline: none;\n background-color: #fff7e9;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:focus-within .maru-dropdown-input > input {\n color: #ffb020;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:hover {\n border: 1px solid #e53e3e;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:hover .maru-dropdown-input > input {\n color: #e53e3e;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:focus-within {\n border: 1px solid #e53e3e;\n outline: none;\n background-color: #fcecec;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:focus-within .maru-dropdown-input > input {\n color: #e53e3e;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.inline-label-wrapper .maru-dropdown-button {\n padding: 2px 10px 2px 14px;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .inline-label {\n display: block;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 10px;\n letter-spacing: -0.4px;\n font-weight: 500;\n color: #bdbdbd;\n padding: 2px 10px 0 14px;\n transform: translateY(3px);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-button {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n width: 100%;\n height: 37px;\n border: unset;\n border-radius: 8px;\n background-color: transparent;\n cursor: pointer;\n padding: 8px 10px 8px 14px;\n color: #5c5c5c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-button .maru-dropdown-button-contents {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-button .maru-dropdown-button-contents.placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n width: 100%;\n height: 37px;\n border: unset;\n border-radius: 8px;\n background-color: transparent;\n cursor: pointer;\n padding: 8px 10px 8px 14px;\n color: #5c5c5c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input {\n width: 100%;\n height: 100%;\n border: unset;\n outline: unset;\n background-color: unset;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input::-webkit-input-placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input::-moz-placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input:-ms-input-placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input::-ms-input-placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input::placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-toggle-arrow {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.errored {\n border: 2px solid #e53e3e;\n}\n.maru-dropdown .maru-dropdown-error-message {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 12px;\n letter-spacing: -0.48px;\n font-weight: 500;\n color: #e53e3e;\n display: block;\n margin-top: 4px;\n}\n\n.maru-dropdown-menu-wrapper {\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n position: fixed;\n z-index: 1600;\n display: none;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu {\n margin-top: 4px;\n position: absolute;\n z-index: 1601;\n border-radius: 8px;\n box-shadow: 0px 0px 6px #e4e4e4;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper {\n overflow-y: auto;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n border-bottom-left-radius: 8px;\n border-bottom-right-radius: 8px;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n width: 100%;\n background-color: white;\n border: unset;\n cursor: pointer;\n height: 37px;\n padding: 8px 14px;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n color: #5c5c5c;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item-selected, .maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item:hover {\n background-color: #fafafa;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item-span {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 1;\n text-align: start;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item-span em {\n font-style: unset;\n background-color: var(--p-20-per);\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-no-data {\n background-color: transparent;\n border: unset;\n}";
|
|
3315
|
-
|
|
3460
|
+
function getUAString() {
|
|
3461
|
+
var uaData = navigator.userAgentData;
|
|
3316
3462
|
|
|
3317
|
-
|
|
3318
|
-
|
|
3463
|
+
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
|
3464
|
+
return uaData.brands.map(function (item) {
|
|
3465
|
+
return item.brand + "/" + item.version;
|
|
3466
|
+
}).join(' ');
|
|
3467
|
+
}
|
|
3319
3468
|
|
|
3320
|
-
|
|
3321
|
-
|
|
3469
|
+
return navigator.userAgent;
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
function isLayoutViewport() {
|
|
3473
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
3474
|
+
}
|
|
3475
|
+
|
|
3476
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
3477
|
+
if (includeScale === void 0) {
|
|
3478
|
+
includeScale = false;
|
|
3479
|
+
}
|
|
3480
|
+
|
|
3481
|
+
if (isFixedStrategy === void 0) {
|
|
3482
|
+
isFixedStrategy = false;
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3485
|
+
var clientRect = element.getBoundingClientRect();
|
|
3486
|
+
var scaleX = 1;
|
|
3487
|
+
var scaleY = 1;
|
|
3488
|
+
|
|
3489
|
+
if (includeScale && isHTMLElement(element)) {
|
|
3490
|
+
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
3491
|
+
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
3492
|
+
}
|
|
3493
|
+
|
|
3494
|
+
var _ref = isElement(element) ? getWindow(element) : window,
|
|
3495
|
+
visualViewport = _ref.visualViewport;
|
|
3496
|
+
|
|
3497
|
+
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
3498
|
+
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
|
3499
|
+
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
|
3500
|
+
var width = clientRect.width / scaleX;
|
|
3501
|
+
var height = clientRect.height / scaleY;
|
|
3502
|
+
return {
|
|
3503
|
+
width: width,
|
|
3504
|
+
height: height,
|
|
3505
|
+
top: y,
|
|
3506
|
+
right: x + width,
|
|
3507
|
+
bottom: y + height,
|
|
3508
|
+
left: x,
|
|
3509
|
+
x: x,
|
|
3510
|
+
y: y
|
|
3511
|
+
};
|
|
3512
|
+
}
|
|
3513
|
+
|
|
3514
|
+
// means it doesn't take into account transforms.
|
|
3515
|
+
|
|
3516
|
+
function getLayoutRect(element) {
|
|
3517
|
+
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
|
3518
|
+
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
|
3519
|
+
|
|
3520
|
+
var width = element.offsetWidth;
|
|
3521
|
+
var height = element.offsetHeight;
|
|
3522
|
+
|
|
3523
|
+
if (Math.abs(clientRect.width - width) <= 1) {
|
|
3524
|
+
width = clientRect.width;
|
|
3525
|
+
}
|
|
3526
|
+
|
|
3527
|
+
if (Math.abs(clientRect.height - height) <= 1) {
|
|
3528
|
+
height = clientRect.height;
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3531
|
+
return {
|
|
3532
|
+
x: element.offsetLeft,
|
|
3533
|
+
y: element.offsetTop,
|
|
3534
|
+
width: width,
|
|
3535
|
+
height: height
|
|
3536
|
+
};
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
function contains(parent, child) {
|
|
3540
|
+
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
|
3541
|
+
|
|
3542
|
+
if (parent.contains(child)) {
|
|
3543
|
+
return true;
|
|
3544
|
+
} // then fallback to custom implementation with Shadow DOM support
|
|
3545
|
+
else if (rootNode && isShadowRoot(rootNode)) {
|
|
3546
|
+
var next = child;
|
|
3547
|
+
|
|
3548
|
+
do {
|
|
3549
|
+
if (next && parent.isSameNode(next)) {
|
|
3550
|
+
return true;
|
|
3551
|
+
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
|
3552
|
+
|
|
3553
|
+
|
|
3554
|
+
next = next.parentNode || next.host;
|
|
3555
|
+
} while (next);
|
|
3556
|
+
} // Give up, the result is false
|
|
3557
|
+
|
|
3558
|
+
|
|
3559
|
+
return false;
|
|
3560
|
+
}
|
|
3561
|
+
|
|
3562
|
+
function getComputedStyle(element) {
|
|
3563
|
+
return getWindow(element).getComputedStyle(element);
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3566
|
+
function isTableElement(element) {
|
|
3567
|
+
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
|
|
3568
|
+
}
|
|
3569
|
+
|
|
3570
|
+
function getDocumentElement(element) {
|
|
3571
|
+
// $FlowFixMe[incompatible-return]: assume body is always available
|
|
3572
|
+
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
|
3573
|
+
element.document) || window.document).documentElement;
|
|
3574
|
+
}
|
|
3575
|
+
|
|
3576
|
+
function getParentNode(element) {
|
|
3577
|
+
if (getNodeName(element) === 'html') {
|
|
3578
|
+
return element;
|
|
3579
|
+
}
|
|
3580
|
+
|
|
3581
|
+
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
|
3582
|
+
// $FlowFixMe[incompatible-return]
|
|
3583
|
+
// $FlowFixMe[prop-missing]
|
|
3584
|
+
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
|
3585
|
+
element.parentNode || ( // DOM Element detected
|
|
3586
|
+
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
|
3587
|
+
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
|
3588
|
+
getDocumentElement(element) // fallback
|
|
3589
|
+
|
|
3590
|
+
);
|
|
3591
|
+
}
|
|
3592
|
+
|
|
3593
|
+
function getTrueOffsetParent(element) {
|
|
3594
|
+
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
|
3595
|
+
getComputedStyle(element).position === 'fixed') {
|
|
3596
|
+
return null;
|
|
3597
|
+
}
|
|
3598
|
+
|
|
3599
|
+
return element.offsetParent;
|
|
3600
|
+
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
|
3601
|
+
// return the containing block
|
|
3602
|
+
|
|
3603
|
+
|
|
3604
|
+
function getContainingBlock(element) {
|
|
3605
|
+
var isFirefox = /firefox/i.test(getUAString());
|
|
3606
|
+
var isIE = /Trident/i.test(getUAString());
|
|
3607
|
+
|
|
3608
|
+
if (isIE && isHTMLElement(element)) {
|
|
3609
|
+
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
|
3610
|
+
var elementCss = getComputedStyle(element);
|
|
3611
|
+
|
|
3612
|
+
if (elementCss.position === 'fixed') {
|
|
3613
|
+
return null;
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3617
|
+
var currentNode = getParentNode(element);
|
|
3618
|
+
|
|
3619
|
+
if (isShadowRoot(currentNode)) {
|
|
3620
|
+
currentNode = currentNode.host;
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3623
|
+
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
|
3624
|
+
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
|
3625
|
+
// create a containing block.
|
|
3626
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
3627
|
+
|
|
3628
|
+
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
|
|
3629
|
+
return currentNode;
|
|
3630
|
+
} else {
|
|
3631
|
+
currentNode = currentNode.parentNode;
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
|
|
3635
|
+
return null;
|
|
3636
|
+
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
|
3637
|
+
// such as table ancestors and cross browser bugs.
|
|
3638
|
+
|
|
3639
|
+
|
|
3640
|
+
function getOffsetParent(element) {
|
|
3641
|
+
var window = getWindow(element);
|
|
3642
|
+
var offsetParent = getTrueOffsetParent(element);
|
|
3643
|
+
|
|
3644
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
|
3645
|
+
offsetParent = getTrueOffsetParent(offsetParent);
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3648
|
+
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
|
|
3649
|
+
return window;
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3652
|
+
return offsetParent || getContainingBlock(element) || window;
|
|
3653
|
+
}
|
|
3654
|
+
|
|
3655
|
+
function getMainAxisFromPlacement(placement) {
|
|
3656
|
+
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
|
3657
|
+
}
|
|
3658
|
+
|
|
3659
|
+
function within(min$1, value, max$1) {
|
|
3660
|
+
return max(min$1, min(value, max$1));
|
|
3661
|
+
}
|
|
3662
|
+
function withinMaxClamp(min, value, max) {
|
|
3663
|
+
var v = within(min, value, max);
|
|
3664
|
+
return v > max ? max : v;
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3667
|
+
function getFreshSideObject() {
|
|
3668
|
+
return {
|
|
3669
|
+
top: 0,
|
|
3670
|
+
right: 0,
|
|
3671
|
+
bottom: 0,
|
|
3672
|
+
left: 0
|
|
3673
|
+
};
|
|
3674
|
+
}
|
|
3675
|
+
|
|
3676
|
+
function mergePaddingObject(paddingObject) {
|
|
3677
|
+
return Object.assign({}, getFreshSideObject(), paddingObject);
|
|
3678
|
+
}
|
|
3679
|
+
|
|
3680
|
+
function expandToHashMap(value, keys) {
|
|
3681
|
+
return keys.reduce(function (hashMap, key) {
|
|
3682
|
+
hashMap[key] = value;
|
|
3683
|
+
return hashMap;
|
|
3684
|
+
}, {});
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3687
|
+
var toPaddingObject = function toPaddingObject(padding, state) {
|
|
3688
|
+
padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
|
|
3689
|
+
placement: state.placement
|
|
3690
|
+
})) : padding;
|
|
3691
|
+
return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
|
3692
|
+
};
|
|
3693
|
+
|
|
3694
|
+
function arrow(_ref) {
|
|
3695
|
+
var _state$modifiersData$;
|
|
3696
|
+
|
|
3697
|
+
var state = _ref.state,
|
|
3698
|
+
name = _ref.name,
|
|
3699
|
+
options = _ref.options;
|
|
3700
|
+
var arrowElement = state.elements.arrow;
|
|
3701
|
+
var popperOffsets = state.modifiersData.popperOffsets;
|
|
3702
|
+
var basePlacement = getBasePlacement(state.placement);
|
|
3703
|
+
var axis = getMainAxisFromPlacement(basePlacement);
|
|
3704
|
+
var isVertical = [left, right].indexOf(basePlacement) >= 0;
|
|
3705
|
+
var len = isVertical ? 'height' : 'width';
|
|
3706
|
+
|
|
3707
|
+
if (!arrowElement || !popperOffsets) {
|
|
3708
|
+
return;
|
|
3709
|
+
}
|
|
3710
|
+
|
|
3711
|
+
var paddingObject = toPaddingObject(options.padding, state);
|
|
3712
|
+
var arrowRect = getLayoutRect(arrowElement);
|
|
3713
|
+
var minProp = axis === 'y' ? top : left;
|
|
3714
|
+
var maxProp = axis === 'y' ? bottom : right;
|
|
3715
|
+
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
|
|
3716
|
+
var startDiff = popperOffsets[axis] - state.rects.reference[axis];
|
|
3717
|
+
var arrowOffsetParent = getOffsetParent(arrowElement);
|
|
3718
|
+
var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
3719
|
+
var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
|
|
3720
|
+
// outside of the popper bounds
|
|
3721
|
+
|
|
3722
|
+
var min = paddingObject[minProp];
|
|
3723
|
+
var max = clientSize - arrowRect[len] - paddingObject[maxProp];
|
|
3724
|
+
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
|
|
3725
|
+
var offset = within(min, center, max); // Prevents breaking syntax highlighting...
|
|
3726
|
+
|
|
3727
|
+
var axisProp = axis;
|
|
3728
|
+
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
|
|
3729
|
+
}
|
|
3730
|
+
|
|
3731
|
+
function effect$1(_ref2) {
|
|
3732
|
+
var state = _ref2.state,
|
|
3733
|
+
options = _ref2.options;
|
|
3734
|
+
var _options$element = options.element,
|
|
3735
|
+
arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
|
|
3736
|
+
|
|
3737
|
+
if (arrowElement == null) {
|
|
3738
|
+
return;
|
|
3739
|
+
} // CSS selector
|
|
3740
|
+
|
|
3741
|
+
|
|
3742
|
+
if (typeof arrowElement === 'string') {
|
|
3743
|
+
arrowElement = state.elements.popper.querySelector(arrowElement);
|
|
3744
|
+
|
|
3745
|
+
if (!arrowElement) {
|
|
3746
|
+
return;
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
|
|
3750
|
+
if (!contains(state.elements.popper, arrowElement)) {
|
|
3751
|
+
return;
|
|
3752
|
+
}
|
|
3753
|
+
|
|
3754
|
+
state.elements.arrow = arrowElement;
|
|
3755
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
3756
|
+
|
|
3757
|
+
|
|
3758
|
+
var arrow$1 = {
|
|
3759
|
+
name: 'arrow',
|
|
3760
|
+
enabled: true,
|
|
3761
|
+
phase: 'main',
|
|
3762
|
+
fn: arrow,
|
|
3763
|
+
effect: effect$1,
|
|
3764
|
+
requires: ['popperOffsets'],
|
|
3765
|
+
requiresIfExists: ['preventOverflow']
|
|
3766
|
+
};
|
|
3767
|
+
|
|
3768
|
+
function getVariation(placement) {
|
|
3769
|
+
return placement.split('-')[1];
|
|
3770
|
+
}
|
|
3771
|
+
|
|
3772
|
+
var unsetSides = {
|
|
3773
|
+
top: 'auto',
|
|
3774
|
+
right: 'auto',
|
|
3775
|
+
bottom: 'auto',
|
|
3776
|
+
left: 'auto'
|
|
3777
|
+
}; // Round the offsets to the nearest suitable subpixel based on the DPR.
|
|
3778
|
+
// Zooming can change the DPR, but it seems to report a value that will
|
|
3779
|
+
// cleanly divide the values into the appropriate subpixels.
|
|
3780
|
+
|
|
3781
|
+
function roundOffsetsByDPR(_ref, win) {
|
|
3782
|
+
var x = _ref.x,
|
|
3783
|
+
y = _ref.y;
|
|
3784
|
+
var dpr = win.devicePixelRatio || 1;
|
|
3785
|
+
return {
|
|
3786
|
+
x: round(x * dpr) / dpr || 0,
|
|
3787
|
+
y: round(y * dpr) / dpr || 0
|
|
3788
|
+
};
|
|
3789
|
+
}
|
|
3790
|
+
|
|
3791
|
+
function mapToStyles(_ref2) {
|
|
3792
|
+
var _Object$assign2;
|
|
3793
|
+
|
|
3794
|
+
var popper = _ref2.popper,
|
|
3795
|
+
popperRect = _ref2.popperRect,
|
|
3796
|
+
placement = _ref2.placement,
|
|
3797
|
+
variation = _ref2.variation,
|
|
3798
|
+
offsets = _ref2.offsets,
|
|
3799
|
+
position = _ref2.position,
|
|
3800
|
+
gpuAcceleration = _ref2.gpuAcceleration,
|
|
3801
|
+
adaptive = _ref2.adaptive,
|
|
3802
|
+
roundOffsets = _ref2.roundOffsets,
|
|
3803
|
+
isFixed = _ref2.isFixed;
|
|
3804
|
+
var _offsets$x = offsets.x,
|
|
3805
|
+
x = _offsets$x === void 0 ? 0 : _offsets$x,
|
|
3806
|
+
_offsets$y = offsets.y,
|
|
3807
|
+
y = _offsets$y === void 0 ? 0 : _offsets$y;
|
|
3808
|
+
|
|
3809
|
+
var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
|
|
3810
|
+
x: x,
|
|
3811
|
+
y: y
|
|
3812
|
+
}) : {
|
|
3813
|
+
x: x,
|
|
3814
|
+
y: y
|
|
3815
|
+
};
|
|
3816
|
+
|
|
3817
|
+
x = _ref3.x;
|
|
3818
|
+
y = _ref3.y;
|
|
3819
|
+
var hasX = offsets.hasOwnProperty('x');
|
|
3820
|
+
var hasY = offsets.hasOwnProperty('y');
|
|
3821
|
+
var sideX = left;
|
|
3822
|
+
var sideY = top;
|
|
3823
|
+
var win = window;
|
|
3824
|
+
|
|
3825
|
+
if (adaptive) {
|
|
3826
|
+
var offsetParent = getOffsetParent(popper);
|
|
3827
|
+
var heightProp = 'clientHeight';
|
|
3828
|
+
var widthProp = 'clientWidth';
|
|
3829
|
+
|
|
3830
|
+
if (offsetParent === getWindow(popper)) {
|
|
3831
|
+
offsetParent = getDocumentElement(popper);
|
|
3832
|
+
|
|
3833
|
+
if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
|
|
3834
|
+
heightProp = 'scrollHeight';
|
|
3835
|
+
widthProp = 'scrollWidth';
|
|
3836
|
+
}
|
|
3837
|
+
} // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
|
|
3838
|
+
|
|
3839
|
+
|
|
3840
|
+
offsetParent = offsetParent;
|
|
3841
|
+
|
|
3842
|
+
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
3843
|
+
sideY = bottom;
|
|
3844
|
+
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
|
3845
|
+
offsetParent[heightProp];
|
|
3846
|
+
y -= offsetY - popperRect.height;
|
|
3847
|
+
y *= gpuAcceleration ? 1 : -1;
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
3851
|
+
sideX = right;
|
|
3852
|
+
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
|
3853
|
+
offsetParent[widthProp];
|
|
3854
|
+
x -= offsetX - popperRect.width;
|
|
3855
|
+
x *= gpuAcceleration ? 1 : -1;
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
|
|
3859
|
+
var commonStyles = Object.assign({
|
|
3860
|
+
position: position
|
|
3861
|
+
}, adaptive && unsetSides);
|
|
3862
|
+
|
|
3863
|
+
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
3864
|
+
x: x,
|
|
3865
|
+
y: y
|
|
3866
|
+
}, getWindow(popper)) : {
|
|
3867
|
+
x: x,
|
|
3868
|
+
y: y
|
|
3869
|
+
};
|
|
3870
|
+
|
|
3871
|
+
x = _ref4.x;
|
|
3872
|
+
y = _ref4.y;
|
|
3873
|
+
|
|
3874
|
+
if (gpuAcceleration) {
|
|
3875
|
+
var _Object$assign;
|
|
3876
|
+
|
|
3877
|
+
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
|
3878
|
+
}
|
|
3879
|
+
|
|
3880
|
+
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
|
3881
|
+
}
|
|
3882
|
+
|
|
3883
|
+
function computeStyles(_ref5) {
|
|
3884
|
+
var state = _ref5.state,
|
|
3885
|
+
options = _ref5.options;
|
|
3886
|
+
var _options$gpuAccelerat = options.gpuAcceleration,
|
|
3887
|
+
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
|
3888
|
+
_options$adaptive = options.adaptive,
|
|
3889
|
+
adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
|
|
3890
|
+
_options$roundOffsets = options.roundOffsets,
|
|
3891
|
+
roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
|
3892
|
+
var commonStyles = {
|
|
3893
|
+
placement: getBasePlacement(state.placement),
|
|
3894
|
+
variation: getVariation(state.placement),
|
|
3895
|
+
popper: state.elements.popper,
|
|
3896
|
+
popperRect: state.rects.popper,
|
|
3897
|
+
gpuAcceleration: gpuAcceleration,
|
|
3898
|
+
isFixed: state.options.strategy === 'fixed'
|
|
3899
|
+
};
|
|
3900
|
+
|
|
3901
|
+
if (state.modifiersData.popperOffsets != null) {
|
|
3902
|
+
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
|
3903
|
+
offsets: state.modifiersData.popperOffsets,
|
|
3904
|
+
position: state.options.strategy,
|
|
3905
|
+
adaptive: adaptive,
|
|
3906
|
+
roundOffsets: roundOffsets
|
|
3907
|
+
})));
|
|
3908
|
+
}
|
|
3909
|
+
|
|
3910
|
+
if (state.modifiersData.arrow != null) {
|
|
3911
|
+
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
|
3912
|
+
offsets: state.modifiersData.arrow,
|
|
3913
|
+
position: 'absolute',
|
|
3914
|
+
adaptive: false,
|
|
3915
|
+
roundOffsets: roundOffsets
|
|
3916
|
+
})));
|
|
3917
|
+
}
|
|
3918
|
+
|
|
3919
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
3920
|
+
'data-popper-placement': state.placement
|
|
3921
|
+
});
|
|
3922
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
3923
|
+
|
|
3924
|
+
|
|
3925
|
+
var computeStyles$1 = {
|
|
3926
|
+
name: 'computeStyles',
|
|
3927
|
+
enabled: true,
|
|
3928
|
+
phase: 'beforeWrite',
|
|
3929
|
+
fn: computeStyles,
|
|
3930
|
+
data: {}
|
|
3931
|
+
};
|
|
3932
|
+
|
|
3933
|
+
var passive = {
|
|
3934
|
+
passive: true
|
|
3935
|
+
};
|
|
3936
|
+
|
|
3937
|
+
function effect(_ref) {
|
|
3938
|
+
var state = _ref.state,
|
|
3939
|
+
instance = _ref.instance,
|
|
3940
|
+
options = _ref.options;
|
|
3941
|
+
var _options$scroll = options.scroll,
|
|
3942
|
+
scroll = _options$scroll === void 0 ? true : _options$scroll,
|
|
3943
|
+
_options$resize = options.resize,
|
|
3944
|
+
resize = _options$resize === void 0 ? true : _options$resize;
|
|
3945
|
+
var window = getWindow(state.elements.popper);
|
|
3946
|
+
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
|
3947
|
+
|
|
3948
|
+
if (scroll) {
|
|
3949
|
+
scrollParents.forEach(function (scrollParent) {
|
|
3950
|
+
scrollParent.addEventListener('scroll', instance.update, passive);
|
|
3951
|
+
});
|
|
3952
|
+
}
|
|
3953
|
+
|
|
3954
|
+
if (resize) {
|
|
3955
|
+
window.addEventListener('resize', instance.update, passive);
|
|
3956
|
+
}
|
|
3957
|
+
|
|
3958
|
+
return function () {
|
|
3959
|
+
if (scroll) {
|
|
3960
|
+
scrollParents.forEach(function (scrollParent) {
|
|
3961
|
+
scrollParent.removeEventListener('scroll', instance.update, passive);
|
|
3962
|
+
});
|
|
3963
|
+
}
|
|
3964
|
+
|
|
3965
|
+
if (resize) {
|
|
3966
|
+
window.removeEventListener('resize', instance.update, passive);
|
|
3967
|
+
}
|
|
3968
|
+
};
|
|
3969
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
3970
|
+
|
|
3971
|
+
|
|
3972
|
+
var eventListeners = {
|
|
3973
|
+
name: 'eventListeners',
|
|
3974
|
+
enabled: true,
|
|
3975
|
+
phase: 'write',
|
|
3976
|
+
fn: function fn() {},
|
|
3977
|
+
effect: effect,
|
|
3978
|
+
data: {}
|
|
3979
|
+
};
|
|
3980
|
+
|
|
3981
|
+
var hash$1 = {
|
|
3982
|
+
left: 'right',
|
|
3983
|
+
right: 'left',
|
|
3984
|
+
bottom: 'top',
|
|
3985
|
+
top: 'bottom'
|
|
3986
|
+
};
|
|
3987
|
+
function getOppositePlacement(placement) {
|
|
3988
|
+
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
3989
|
+
return hash$1[matched];
|
|
3990
|
+
});
|
|
3991
|
+
}
|
|
3992
|
+
|
|
3993
|
+
var hash = {
|
|
3994
|
+
start: 'end',
|
|
3995
|
+
end: 'start'
|
|
3996
|
+
};
|
|
3997
|
+
function getOppositeVariationPlacement(placement) {
|
|
3998
|
+
return placement.replace(/start|end/g, function (matched) {
|
|
3999
|
+
return hash[matched];
|
|
4000
|
+
});
|
|
4001
|
+
}
|
|
4002
|
+
|
|
4003
|
+
function getWindowScroll(node) {
|
|
4004
|
+
var win = getWindow(node);
|
|
4005
|
+
var scrollLeft = win.pageXOffset;
|
|
4006
|
+
var scrollTop = win.pageYOffset;
|
|
4007
|
+
return {
|
|
4008
|
+
scrollLeft: scrollLeft,
|
|
4009
|
+
scrollTop: scrollTop
|
|
4010
|
+
};
|
|
4011
|
+
}
|
|
4012
|
+
|
|
4013
|
+
function getWindowScrollBarX(element) {
|
|
4014
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
4015
|
+
// incorrect for RTL.
|
|
4016
|
+
// Popper 1 is broken in this case and never had a bug report so let's assume
|
|
4017
|
+
// it's not an issue. I don't think anyone ever specifies width on <html>
|
|
4018
|
+
// anyway.
|
|
4019
|
+
// Browsers where the left scrollbar doesn't cause an issue report `0` for
|
|
4020
|
+
// this (e.g. Edge 2019, IE11, Safari)
|
|
4021
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
|
4022
|
+
}
|
|
4023
|
+
|
|
4024
|
+
function getViewportRect(element, strategy) {
|
|
4025
|
+
var win = getWindow(element);
|
|
4026
|
+
var html = getDocumentElement(element);
|
|
4027
|
+
var visualViewport = win.visualViewport;
|
|
4028
|
+
var width = html.clientWidth;
|
|
4029
|
+
var height = html.clientHeight;
|
|
4030
|
+
var x = 0;
|
|
4031
|
+
var y = 0;
|
|
4032
|
+
|
|
4033
|
+
if (visualViewport) {
|
|
4034
|
+
width = visualViewport.width;
|
|
4035
|
+
height = visualViewport.height;
|
|
4036
|
+
var layoutViewport = isLayoutViewport();
|
|
4037
|
+
|
|
4038
|
+
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
|
4039
|
+
x = visualViewport.offsetLeft;
|
|
4040
|
+
y = visualViewport.offsetTop;
|
|
4041
|
+
}
|
|
4042
|
+
}
|
|
4043
|
+
|
|
4044
|
+
return {
|
|
4045
|
+
width: width,
|
|
4046
|
+
height: height,
|
|
4047
|
+
x: x + getWindowScrollBarX(element),
|
|
4048
|
+
y: y
|
|
4049
|
+
};
|
|
4050
|
+
}
|
|
4051
|
+
|
|
4052
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
|
4053
|
+
|
|
4054
|
+
function getDocumentRect(element) {
|
|
4055
|
+
var _element$ownerDocumen;
|
|
4056
|
+
|
|
4057
|
+
var html = getDocumentElement(element);
|
|
4058
|
+
var winScroll = getWindowScroll(element);
|
|
4059
|
+
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
4060
|
+
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
4061
|
+
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
4062
|
+
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
|
4063
|
+
var y = -winScroll.scrollTop;
|
|
4064
|
+
|
|
4065
|
+
if (getComputedStyle(body || html).direction === 'rtl') {
|
|
4066
|
+
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
4067
|
+
}
|
|
4068
|
+
|
|
4069
|
+
return {
|
|
4070
|
+
width: width,
|
|
4071
|
+
height: height,
|
|
4072
|
+
x: x,
|
|
4073
|
+
y: y
|
|
4074
|
+
};
|
|
4075
|
+
}
|
|
4076
|
+
|
|
4077
|
+
function isScrollParent(element) {
|
|
4078
|
+
// Firefox wants us to check `-x` and `-y` variations as well
|
|
4079
|
+
var _getComputedStyle = getComputedStyle(element),
|
|
4080
|
+
overflow = _getComputedStyle.overflow,
|
|
4081
|
+
overflowX = _getComputedStyle.overflowX,
|
|
4082
|
+
overflowY = _getComputedStyle.overflowY;
|
|
4083
|
+
|
|
4084
|
+
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4087
|
+
function getScrollParent(node) {
|
|
4088
|
+
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
|
4089
|
+
// $FlowFixMe[incompatible-return]: assume body is always available
|
|
4090
|
+
return node.ownerDocument.body;
|
|
4091
|
+
}
|
|
4092
|
+
|
|
4093
|
+
if (isHTMLElement(node) && isScrollParent(node)) {
|
|
4094
|
+
return node;
|
|
4095
|
+
}
|
|
4096
|
+
|
|
4097
|
+
return getScrollParent(getParentNode(node));
|
|
4098
|
+
}
|
|
4099
|
+
|
|
4100
|
+
/*
|
|
4101
|
+
given a DOM element, return the list of all scroll parents, up the list of ancesors
|
|
4102
|
+
until we get to the top window object. This list is what we attach scroll listeners
|
|
4103
|
+
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
|
4104
|
+
reference element's position.
|
|
4105
|
+
*/
|
|
4106
|
+
|
|
4107
|
+
function listScrollParents(element, list) {
|
|
4108
|
+
var _element$ownerDocumen;
|
|
4109
|
+
|
|
4110
|
+
if (list === void 0) {
|
|
4111
|
+
list = [];
|
|
4112
|
+
}
|
|
4113
|
+
|
|
4114
|
+
var scrollParent = getScrollParent(element);
|
|
4115
|
+
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
|
4116
|
+
var win = getWindow(scrollParent);
|
|
4117
|
+
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
4118
|
+
var updatedList = list.concat(target);
|
|
4119
|
+
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
|
4120
|
+
updatedList.concat(listScrollParents(getParentNode(target)));
|
|
4121
|
+
}
|
|
4122
|
+
|
|
4123
|
+
function rectToClientRect(rect) {
|
|
4124
|
+
return Object.assign({}, rect, {
|
|
4125
|
+
left: rect.x,
|
|
4126
|
+
top: rect.y,
|
|
4127
|
+
right: rect.x + rect.width,
|
|
4128
|
+
bottom: rect.y + rect.height
|
|
4129
|
+
});
|
|
4130
|
+
}
|
|
4131
|
+
|
|
4132
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
4133
|
+
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
|
|
4134
|
+
rect.top = rect.top + element.clientTop;
|
|
4135
|
+
rect.left = rect.left + element.clientLeft;
|
|
4136
|
+
rect.bottom = rect.top + element.clientHeight;
|
|
4137
|
+
rect.right = rect.left + element.clientWidth;
|
|
4138
|
+
rect.width = element.clientWidth;
|
|
4139
|
+
rect.height = element.clientHeight;
|
|
4140
|
+
rect.x = rect.left;
|
|
4141
|
+
rect.y = rect.top;
|
|
4142
|
+
return rect;
|
|
4143
|
+
}
|
|
4144
|
+
|
|
4145
|
+
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
|
4146
|
+
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
4147
|
+
} // A "clipping parent" is an overflowable container with the characteristic of
|
|
4148
|
+
// clipping (or hiding) overflowing elements with a position different from
|
|
4149
|
+
// `initial`
|
|
4150
|
+
|
|
4151
|
+
|
|
4152
|
+
function getClippingParents(element) {
|
|
4153
|
+
var clippingParents = listScrollParents(getParentNode(element));
|
|
4154
|
+
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
|
|
4155
|
+
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
|
4156
|
+
|
|
4157
|
+
if (!isElement(clipperElement)) {
|
|
4158
|
+
return [];
|
|
4159
|
+
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
|
4160
|
+
|
|
4161
|
+
|
|
4162
|
+
return clippingParents.filter(function (clippingParent) {
|
|
4163
|
+
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
|
4164
|
+
});
|
|
4165
|
+
} // Gets the maximum area that the element is visible in due to any number of
|
|
4166
|
+
// clipping parents
|
|
4167
|
+
|
|
4168
|
+
|
|
4169
|
+
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
|
4170
|
+
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
|
4171
|
+
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
|
4172
|
+
var firstClippingParent = clippingParents[0];
|
|
4173
|
+
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
|
4174
|
+
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
|
4175
|
+
accRect.top = max(rect.top, accRect.top);
|
|
4176
|
+
accRect.right = min(rect.right, accRect.right);
|
|
4177
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
4178
|
+
accRect.left = max(rect.left, accRect.left);
|
|
4179
|
+
return accRect;
|
|
4180
|
+
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
|
4181
|
+
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
4182
|
+
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
|
4183
|
+
clippingRect.x = clippingRect.left;
|
|
4184
|
+
clippingRect.y = clippingRect.top;
|
|
4185
|
+
return clippingRect;
|
|
4186
|
+
}
|
|
4187
|
+
|
|
4188
|
+
function computeOffsets(_ref) {
|
|
4189
|
+
var reference = _ref.reference,
|
|
4190
|
+
element = _ref.element,
|
|
4191
|
+
placement = _ref.placement;
|
|
4192
|
+
var basePlacement = placement ? getBasePlacement(placement) : null;
|
|
4193
|
+
var variation = placement ? getVariation(placement) : null;
|
|
4194
|
+
var commonX = reference.x + reference.width / 2 - element.width / 2;
|
|
4195
|
+
var commonY = reference.y + reference.height / 2 - element.height / 2;
|
|
4196
|
+
var offsets;
|
|
4197
|
+
|
|
4198
|
+
switch (basePlacement) {
|
|
4199
|
+
case top:
|
|
4200
|
+
offsets = {
|
|
4201
|
+
x: commonX,
|
|
4202
|
+
y: reference.y - element.height
|
|
4203
|
+
};
|
|
4204
|
+
break;
|
|
4205
|
+
|
|
4206
|
+
case bottom:
|
|
4207
|
+
offsets = {
|
|
4208
|
+
x: commonX,
|
|
4209
|
+
y: reference.y + reference.height
|
|
4210
|
+
};
|
|
4211
|
+
break;
|
|
4212
|
+
|
|
4213
|
+
case right:
|
|
4214
|
+
offsets = {
|
|
4215
|
+
x: reference.x + reference.width,
|
|
4216
|
+
y: commonY
|
|
4217
|
+
};
|
|
4218
|
+
break;
|
|
4219
|
+
|
|
4220
|
+
case left:
|
|
4221
|
+
offsets = {
|
|
4222
|
+
x: reference.x - element.width,
|
|
4223
|
+
y: commonY
|
|
4224
|
+
};
|
|
4225
|
+
break;
|
|
4226
|
+
|
|
4227
|
+
default:
|
|
4228
|
+
offsets = {
|
|
4229
|
+
x: reference.x,
|
|
4230
|
+
y: reference.y
|
|
4231
|
+
};
|
|
4232
|
+
}
|
|
4233
|
+
|
|
4234
|
+
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
|
4235
|
+
|
|
4236
|
+
if (mainAxis != null) {
|
|
4237
|
+
var len = mainAxis === 'y' ? 'height' : 'width';
|
|
4238
|
+
|
|
4239
|
+
switch (variation) {
|
|
4240
|
+
case start:
|
|
4241
|
+
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
|
|
4242
|
+
break;
|
|
4243
|
+
|
|
4244
|
+
case end:
|
|
4245
|
+
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
|
|
4246
|
+
break;
|
|
4247
|
+
}
|
|
4248
|
+
}
|
|
4249
|
+
|
|
4250
|
+
return offsets;
|
|
4251
|
+
}
|
|
4252
|
+
|
|
4253
|
+
function detectOverflow(state, options) {
|
|
4254
|
+
if (options === void 0) {
|
|
4255
|
+
options = {};
|
|
4256
|
+
}
|
|
4257
|
+
|
|
4258
|
+
var _options = options,
|
|
4259
|
+
_options$placement = _options.placement,
|
|
4260
|
+
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
|
4261
|
+
_options$strategy = _options.strategy,
|
|
4262
|
+
strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
|
|
4263
|
+
_options$boundary = _options.boundary,
|
|
4264
|
+
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
|
4265
|
+
_options$rootBoundary = _options.rootBoundary,
|
|
4266
|
+
rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
|
|
4267
|
+
_options$elementConte = _options.elementContext,
|
|
4268
|
+
elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
|
|
4269
|
+
_options$altBoundary = _options.altBoundary,
|
|
4270
|
+
altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
|
|
4271
|
+
_options$padding = _options.padding,
|
|
4272
|
+
padding = _options$padding === void 0 ? 0 : _options$padding;
|
|
4273
|
+
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
|
4274
|
+
var altContext = elementContext === popper ? reference : popper;
|
|
4275
|
+
var popperRect = state.rects.popper;
|
|
4276
|
+
var element = state.elements[altBoundary ? altContext : elementContext];
|
|
4277
|
+
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
|
4278
|
+
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
|
4279
|
+
var popperOffsets = computeOffsets({
|
|
4280
|
+
reference: referenceClientRect,
|
|
4281
|
+
element: popperRect,
|
|
4282
|
+
strategy: 'absolute',
|
|
4283
|
+
placement: placement
|
|
4284
|
+
});
|
|
4285
|
+
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
|
4286
|
+
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
|
4287
|
+
// 0 or negative = within the clipping rect
|
|
4288
|
+
|
|
4289
|
+
var overflowOffsets = {
|
|
4290
|
+
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
4291
|
+
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
4292
|
+
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
4293
|
+
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
4294
|
+
};
|
|
4295
|
+
var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
|
|
4296
|
+
|
|
4297
|
+
if (elementContext === popper && offsetData) {
|
|
4298
|
+
var offset = offsetData[placement];
|
|
4299
|
+
Object.keys(overflowOffsets).forEach(function (key) {
|
|
4300
|
+
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
|
4301
|
+
var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
|
|
4302
|
+
overflowOffsets[key] += offset[axis] * multiply;
|
|
4303
|
+
});
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4306
|
+
return overflowOffsets;
|
|
4307
|
+
}
|
|
4308
|
+
|
|
4309
|
+
function computeAutoPlacement(state, options) {
|
|
4310
|
+
if (options === void 0) {
|
|
4311
|
+
options = {};
|
|
4312
|
+
}
|
|
4313
|
+
|
|
4314
|
+
var _options = options,
|
|
4315
|
+
placement = _options.placement,
|
|
4316
|
+
boundary = _options.boundary,
|
|
4317
|
+
rootBoundary = _options.rootBoundary,
|
|
4318
|
+
padding = _options.padding,
|
|
4319
|
+
flipVariations = _options.flipVariations,
|
|
4320
|
+
_options$allowedAutoP = _options.allowedAutoPlacements,
|
|
4321
|
+
allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
|
|
4322
|
+
var variation = getVariation(placement);
|
|
4323
|
+
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
|
|
4324
|
+
return getVariation(placement) === variation;
|
|
4325
|
+
}) : basePlacements;
|
|
4326
|
+
var allowedPlacements = placements$1.filter(function (placement) {
|
|
4327
|
+
return allowedAutoPlacements.indexOf(placement) >= 0;
|
|
4328
|
+
});
|
|
4329
|
+
|
|
4330
|
+
if (allowedPlacements.length === 0) {
|
|
4331
|
+
allowedPlacements = placements$1;
|
|
4332
|
+
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
|
|
4333
|
+
|
|
4334
|
+
|
|
4335
|
+
var overflows = allowedPlacements.reduce(function (acc, placement) {
|
|
4336
|
+
acc[placement] = detectOverflow(state, {
|
|
4337
|
+
placement: placement,
|
|
4338
|
+
boundary: boundary,
|
|
4339
|
+
rootBoundary: rootBoundary,
|
|
4340
|
+
padding: padding
|
|
4341
|
+
})[getBasePlacement(placement)];
|
|
4342
|
+
return acc;
|
|
4343
|
+
}, {});
|
|
4344
|
+
return Object.keys(overflows).sort(function (a, b) {
|
|
4345
|
+
return overflows[a] - overflows[b];
|
|
4346
|
+
});
|
|
4347
|
+
}
|
|
4348
|
+
|
|
4349
|
+
function getExpandedFallbackPlacements(placement) {
|
|
4350
|
+
if (getBasePlacement(placement) === auto) {
|
|
4351
|
+
return [];
|
|
4352
|
+
}
|
|
4353
|
+
|
|
4354
|
+
var oppositePlacement = getOppositePlacement(placement);
|
|
4355
|
+
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
|
4356
|
+
}
|
|
4357
|
+
|
|
4358
|
+
function flip(_ref) {
|
|
4359
|
+
var state = _ref.state,
|
|
4360
|
+
options = _ref.options,
|
|
4361
|
+
name = _ref.name;
|
|
4362
|
+
|
|
4363
|
+
if (state.modifiersData[name]._skip) {
|
|
4364
|
+
return;
|
|
4365
|
+
}
|
|
4366
|
+
|
|
4367
|
+
var _options$mainAxis = options.mainAxis,
|
|
4368
|
+
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
|
4369
|
+
_options$altAxis = options.altAxis,
|
|
4370
|
+
checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
|
|
4371
|
+
specifiedFallbackPlacements = options.fallbackPlacements,
|
|
4372
|
+
padding = options.padding,
|
|
4373
|
+
boundary = options.boundary,
|
|
4374
|
+
rootBoundary = options.rootBoundary,
|
|
4375
|
+
altBoundary = options.altBoundary,
|
|
4376
|
+
_options$flipVariatio = options.flipVariations,
|
|
4377
|
+
flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
|
|
4378
|
+
allowedAutoPlacements = options.allowedAutoPlacements;
|
|
4379
|
+
var preferredPlacement = state.options.placement;
|
|
4380
|
+
var basePlacement = getBasePlacement(preferredPlacement);
|
|
4381
|
+
var isBasePlacement = basePlacement === preferredPlacement;
|
|
4382
|
+
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
|
4383
|
+
var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
|
|
4384
|
+
return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
|
|
4385
|
+
placement: placement,
|
|
4386
|
+
boundary: boundary,
|
|
4387
|
+
rootBoundary: rootBoundary,
|
|
4388
|
+
padding: padding,
|
|
4389
|
+
flipVariations: flipVariations,
|
|
4390
|
+
allowedAutoPlacements: allowedAutoPlacements
|
|
4391
|
+
}) : placement);
|
|
4392
|
+
}, []);
|
|
4393
|
+
var referenceRect = state.rects.reference;
|
|
4394
|
+
var popperRect = state.rects.popper;
|
|
4395
|
+
var checksMap = new Map();
|
|
4396
|
+
var makeFallbackChecks = true;
|
|
4397
|
+
var firstFittingPlacement = placements[0];
|
|
4398
|
+
|
|
4399
|
+
for (var i = 0; i < placements.length; i++) {
|
|
4400
|
+
var placement = placements[i];
|
|
4401
|
+
|
|
4402
|
+
var _basePlacement = getBasePlacement(placement);
|
|
4403
|
+
|
|
4404
|
+
var isStartVariation = getVariation(placement) === start;
|
|
4405
|
+
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
|
4406
|
+
var len = isVertical ? 'width' : 'height';
|
|
4407
|
+
var overflow = detectOverflow(state, {
|
|
4408
|
+
placement: placement,
|
|
4409
|
+
boundary: boundary,
|
|
4410
|
+
rootBoundary: rootBoundary,
|
|
4411
|
+
altBoundary: altBoundary,
|
|
4412
|
+
padding: padding
|
|
4413
|
+
});
|
|
4414
|
+
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
|
|
4415
|
+
|
|
4416
|
+
if (referenceRect[len] > popperRect[len]) {
|
|
4417
|
+
mainVariationSide = getOppositePlacement(mainVariationSide);
|
|
4418
|
+
}
|
|
4419
|
+
|
|
4420
|
+
var altVariationSide = getOppositePlacement(mainVariationSide);
|
|
4421
|
+
var checks = [];
|
|
4422
|
+
|
|
4423
|
+
if (checkMainAxis) {
|
|
4424
|
+
checks.push(overflow[_basePlacement] <= 0);
|
|
4425
|
+
}
|
|
4426
|
+
|
|
4427
|
+
if (checkAltAxis) {
|
|
4428
|
+
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
|
|
4429
|
+
}
|
|
4430
|
+
|
|
4431
|
+
if (checks.every(function (check) {
|
|
4432
|
+
return check;
|
|
4433
|
+
})) {
|
|
4434
|
+
firstFittingPlacement = placement;
|
|
4435
|
+
makeFallbackChecks = false;
|
|
4436
|
+
break;
|
|
4437
|
+
}
|
|
4438
|
+
|
|
4439
|
+
checksMap.set(placement, checks);
|
|
4440
|
+
}
|
|
4441
|
+
|
|
4442
|
+
if (makeFallbackChecks) {
|
|
4443
|
+
// `2` may be desired in some cases – research later
|
|
4444
|
+
var numberOfChecks = flipVariations ? 3 : 1;
|
|
4445
|
+
|
|
4446
|
+
var _loop = function _loop(_i) {
|
|
4447
|
+
var fittingPlacement = placements.find(function (placement) {
|
|
4448
|
+
var checks = checksMap.get(placement);
|
|
4449
|
+
|
|
4450
|
+
if (checks) {
|
|
4451
|
+
return checks.slice(0, _i).every(function (check) {
|
|
4452
|
+
return check;
|
|
4453
|
+
});
|
|
4454
|
+
}
|
|
4455
|
+
});
|
|
4456
|
+
|
|
4457
|
+
if (fittingPlacement) {
|
|
4458
|
+
firstFittingPlacement = fittingPlacement;
|
|
4459
|
+
return "break";
|
|
4460
|
+
}
|
|
4461
|
+
};
|
|
4462
|
+
|
|
4463
|
+
for (var _i = numberOfChecks; _i > 0; _i--) {
|
|
4464
|
+
var _ret = _loop(_i);
|
|
4465
|
+
|
|
4466
|
+
if (_ret === "break") break;
|
|
4467
|
+
}
|
|
4468
|
+
}
|
|
4469
|
+
|
|
4470
|
+
if (state.placement !== firstFittingPlacement) {
|
|
4471
|
+
state.modifiersData[name]._skip = true;
|
|
4472
|
+
state.placement = firstFittingPlacement;
|
|
4473
|
+
state.reset = true;
|
|
4474
|
+
}
|
|
4475
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
4476
|
+
|
|
4477
|
+
|
|
4478
|
+
var flip$1 = {
|
|
4479
|
+
name: 'flip',
|
|
4480
|
+
enabled: true,
|
|
4481
|
+
phase: 'main',
|
|
4482
|
+
fn: flip,
|
|
4483
|
+
requiresIfExists: ['offset'],
|
|
4484
|
+
data: {
|
|
4485
|
+
_skip: false
|
|
4486
|
+
}
|
|
4487
|
+
};
|
|
4488
|
+
|
|
4489
|
+
function getSideOffsets(overflow, rect, preventedOffsets) {
|
|
4490
|
+
if (preventedOffsets === void 0) {
|
|
4491
|
+
preventedOffsets = {
|
|
4492
|
+
x: 0,
|
|
4493
|
+
y: 0
|
|
4494
|
+
};
|
|
4495
|
+
}
|
|
4496
|
+
|
|
4497
|
+
return {
|
|
4498
|
+
top: overflow.top - rect.height - preventedOffsets.y,
|
|
4499
|
+
right: overflow.right - rect.width + preventedOffsets.x,
|
|
4500
|
+
bottom: overflow.bottom - rect.height + preventedOffsets.y,
|
|
4501
|
+
left: overflow.left - rect.width - preventedOffsets.x
|
|
4502
|
+
};
|
|
4503
|
+
}
|
|
4504
|
+
|
|
4505
|
+
function isAnySideFullyClipped(overflow) {
|
|
4506
|
+
return [top, right, bottom, left].some(function (side) {
|
|
4507
|
+
return overflow[side] >= 0;
|
|
4508
|
+
});
|
|
4509
|
+
}
|
|
4510
|
+
|
|
4511
|
+
function hide(_ref) {
|
|
4512
|
+
var state = _ref.state,
|
|
4513
|
+
name = _ref.name;
|
|
4514
|
+
var referenceRect = state.rects.reference;
|
|
4515
|
+
var popperRect = state.rects.popper;
|
|
4516
|
+
var preventedOffsets = state.modifiersData.preventOverflow;
|
|
4517
|
+
var referenceOverflow = detectOverflow(state, {
|
|
4518
|
+
elementContext: 'reference'
|
|
4519
|
+
});
|
|
4520
|
+
var popperAltOverflow = detectOverflow(state, {
|
|
4521
|
+
altBoundary: true
|
|
4522
|
+
});
|
|
4523
|
+
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
|
4524
|
+
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
|
4525
|
+
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
|
4526
|
+
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
|
4527
|
+
state.modifiersData[name] = {
|
|
4528
|
+
referenceClippingOffsets: referenceClippingOffsets,
|
|
4529
|
+
popperEscapeOffsets: popperEscapeOffsets,
|
|
4530
|
+
isReferenceHidden: isReferenceHidden,
|
|
4531
|
+
hasPopperEscaped: hasPopperEscaped
|
|
4532
|
+
};
|
|
4533
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
4534
|
+
'data-popper-reference-hidden': isReferenceHidden,
|
|
4535
|
+
'data-popper-escaped': hasPopperEscaped
|
|
4536
|
+
});
|
|
4537
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
4538
|
+
|
|
4539
|
+
|
|
4540
|
+
var hide$1 = {
|
|
4541
|
+
name: 'hide',
|
|
4542
|
+
enabled: true,
|
|
4543
|
+
phase: 'main',
|
|
4544
|
+
requiresIfExists: ['preventOverflow'],
|
|
4545
|
+
fn: hide
|
|
4546
|
+
};
|
|
4547
|
+
|
|
4548
|
+
function distanceAndSkiddingToXY(placement, rects, offset) {
|
|
4549
|
+
var basePlacement = getBasePlacement(placement);
|
|
4550
|
+
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
|
4551
|
+
|
|
4552
|
+
var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
|
|
4553
|
+
placement: placement
|
|
4554
|
+
})) : offset,
|
|
4555
|
+
skidding = _ref[0],
|
|
4556
|
+
distance = _ref[1];
|
|
4557
|
+
|
|
4558
|
+
skidding = skidding || 0;
|
|
4559
|
+
distance = (distance || 0) * invertDistance;
|
|
4560
|
+
return [left, right].indexOf(basePlacement) >= 0 ? {
|
|
4561
|
+
x: distance,
|
|
4562
|
+
y: skidding
|
|
4563
|
+
} : {
|
|
4564
|
+
x: skidding,
|
|
4565
|
+
y: distance
|
|
4566
|
+
};
|
|
4567
|
+
}
|
|
4568
|
+
|
|
4569
|
+
function offset(_ref2) {
|
|
4570
|
+
var state = _ref2.state,
|
|
4571
|
+
options = _ref2.options,
|
|
4572
|
+
name = _ref2.name;
|
|
4573
|
+
var _options$offset = options.offset,
|
|
4574
|
+
offset = _options$offset === void 0 ? [0, 0] : _options$offset;
|
|
4575
|
+
var data = placements.reduce(function (acc, placement) {
|
|
4576
|
+
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
|
|
4577
|
+
return acc;
|
|
4578
|
+
}, {});
|
|
4579
|
+
var _data$state$placement = data[state.placement],
|
|
4580
|
+
x = _data$state$placement.x,
|
|
4581
|
+
y = _data$state$placement.y;
|
|
4582
|
+
|
|
4583
|
+
if (state.modifiersData.popperOffsets != null) {
|
|
4584
|
+
state.modifiersData.popperOffsets.x += x;
|
|
4585
|
+
state.modifiersData.popperOffsets.y += y;
|
|
4586
|
+
}
|
|
4587
|
+
|
|
4588
|
+
state.modifiersData[name] = data;
|
|
4589
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
4590
|
+
|
|
4591
|
+
|
|
4592
|
+
var offset$1 = {
|
|
4593
|
+
name: 'offset',
|
|
4594
|
+
enabled: true,
|
|
4595
|
+
phase: 'main',
|
|
4596
|
+
requires: ['popperOffsets'],
|
|
4597
|
+
fn: offset
|
|
4598
|
+
};
|
|
4599
|
+
|
|
4600
|
+
function popperOffsets(_ref) {
|
|
4601
|
+
var state = _ref.state,
|
|
4602
|
+
name = _ref.name;
|
|
4603
|
+
// Offsets are the actual position the popper needs to have to be
|
|
4604
|
+
// properly positioned near its reference element
|
|
4605
|
+
// This is the most basic placement, and will be adjusted by
|
|
4606
|
+
// the modifiers in the next step
|
|
4607
|
+
state.modifiersData[name] = computeOffsets({
|
|
4608
|
+
reference: state.rects.reference,
|
|
4609
|
+
element: state.rects.popper,
|
|
4610
|
+
strategy: 'absolute',
|
|
4611
|
+
placement: state.placement
|
|
4612
|
+
});
|
|
4613
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
4614
|
+
|
|
4615
|
+
|
|
4616
|
+
var popperOffsets$1 = {
|
|
4617
|
+
name: 'popperOffsets',
|
|
4618
|
+
enabled: true,
|
|
4619
|
+
phase: 'read',
|
|
4620
|
+
fn: popperOffsets,
|
|
4621
|
+
data: {}
|
|
4622
|
+
};
|
|
4623
|
+
|
|
4624
|
+
function getAltAxis(axis) {
|
|
4625
|
+
return axis === 'x' ? 'y' : 'x';
|
|
4626
|
+
}
|
|
4627
|
+
|
|
4628
|
+
function preventOverflow(_ref) {
|
|
4629
|
+
var state = _ref.state,
|
|
4630
|
+
options = _ref.options,
|
|
4631
|
+
name = _ref.name;
|
|
4632
|
+
var _options$mainAxis = options.mainAxis,
|
|
4633
|
+
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
|
4634
|
+
_options$altAxis = options.altAxis,
|
|
4635
|
+
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
|
|
4636
|
+
boundary = options.boundary,
|
|
4637
|
+
rootBoundary = options.rootBoundary,
|
|
4638
|
+
altBoundary = options.altBoundary,
|
|
4639
|
+
padding = options.padding,
|
|
4640
|
+
_options$tether = options.tether,
|
|
4641
|
+
tether = _options$tether === void 0 ? true : _options$tether,
|
|
4642
|
+
_options$tetherOffset = options.tetherOffset,
|
|
4643
|
+
tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
|
4644
|
+
var overflow = detectOverflow(state, {
|
|
4645
|
+
boundary: boundary,
|
|
4646
|
+
rootBoundary: rootBoundary,
|
|
4647
|
+
padding: padding,
|
|
4648
|
+
altBoundary: altBoundary
|
|
4649
|
+
});
|
|
4650
|
+
var basePlacement = getBasePlacement(state.placement);
|
|
4651
|
+
var variation = getVariation(state.placement);
|
|
4652
|
+
var isBasePlacement = !variation;
|
|
4653
|
+
var mainAxis = getMainAxisFromPlacement(basePlacement);
|
|
4654
|
+
var altAxis = getAltAxis(mainAxis);
|
|
4655
|
+
var popperOffsets = state.modifiersData.popperOffsets;
|
|
4656
|
+
var referenceRect = state.rects.reference;
|
|
4657
|
+
var popperRect = state.rects.popper;
|
|
4658
|
+
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
|
|
4659
|
+
placement: state.placement
|
|
4660
|
+
})) : tetherOffset;
|
|
4661
|
+
var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
|
|
4662
|
+
mainAxis: tetherOffsetValue,
|
|
4663
|
+
altAxis: tetherOffsetValue
|
|
4664
|
+
} : Object.assign({
|
|
4665
|
+
mainAxis: 0,
|
|
4666
|
+
altAxis: 0
|
|
4667
|
+
}, tetherOffsetValue);
|
|
4668
|
+
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
|
4669
|
+
var data = {
|
|
4670
|
+
x: 0,
|
|
4671
|
+
y: 0
|
|
4672
|
+
};
|
|
4673
|
+
|
|
4674
|
+
if (!popperOffsets) {
|
|
4675
|
+
return;
|
|
4676
|
+
}
|
|
4677
|
+
|
|
4678
|
+
if (checkMainAxis) {
|
|
4679
|
+
var _offsetModifierState$;
|
|
4680
|
+
|
|
4681
|
+
var mainSide = mainAxis === 'y' ? top : left;
|
|
4682
|
+
var altSide = mainAxis === 'y' ? bottom : right;
|
|
4683
|
+
var len = mainAxis === 'y' ? 'height' : 'width';
|
|
4684
|
+
var offset = popperOffsets[mainAxis];
|
|
4685
|
+
var min$1 = offset + overflow[mainSide];
|
|
4686
|
+
var max$1 = offset - overflow[altSide];
|
|
4687
|
+
var additive = tether ? -popperRect[len] / 2 : 0;
|
|
4688
|
+
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
|
4689
|
+
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
|
|
4690
|
+
// outside the reference bounds
|
|
4691
|
+
|
|
4692
|
+
var arrowElement = state.elements.arrow;
|
|
4693
|
+
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
|
|
4694
|
+
width: 0,
|
|
4695
|
+
height: 0
|
|
4696
|
+
};
|
|
4697
|
+
var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
|
|
4698
|
+
var arrowPaddingMin = arrowPaddingObject[mainSide];
|
|
4699
|
+
var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
|
|
4700
|
+
// to include its full size in the calculation. If the reference is small
|
|
4701
|
+
// and near the edge of a boundary, the popper can overflow even if the
|
|
4702
|
+
// reference is not overflowing as well (e.g. virtual elements with no
|
|
4703
|
+
// width or height)
|
|
4704
|
+
|
|
4705
|
+
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
|
4706
|
+
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
|
4707
|
+
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
|
4708
|
+
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
|
4709
|
+
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
|
4710
|
+
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
|
4711
|
+
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
|
|
4712
|
+
var tetherMax = offset + maxOffset - offsetModifierValue;
|
|
4713
|
+
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
|
|
4714
|
+
popperOffsets[mainAxis] = preventedOffset;
|
|
4715
|
+
data[mainAxis] = preventedOffset - offset;
|
|
4716
|
+
}
|
|
4717
|
+
|
|
4718
|
+
if (checkAltAxis) {
|
|
4719
|
+
var _offsetModifierState$2;
|
|
4720
|
+
|
|
4721
|
+
var _mainSide = mainAxis === 'x' ? top : left;
|
|
4722
|
+
|
|
4723
|
+
var _altSide = mainAxis === 'x' ? bottom : right;
|
|
4724
|
+
|
|
4725
|
+
var _offset = popperOffsets[altAxis];
|
|
4726
|
+
|
|
4727
|
+
var _len = altAxis === 'y' ? 'height' : 'width';
|
|
4728
|
+
|
|
4729
|
+
var _min = _offset + overflow[_mainSide];
|
|
4730
|
+
|
|
4731
|
+
var _max = _offset - overflow[_altSide];
|
|
4732
|
+
|
|
4733
|
+
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
|
4734
|
+
|
|
4735
|
+
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
|
4736
|
+
|
|
4737
|
+
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
|
4738
|
+
|
|
4739
|
+
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
|
4740
|
+
|
|
4741
|
+
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
|
4742
|
+
|
|
4743
|
+
popperOffsets[altAxis] = _preventedOffset;
|
|
4744
|
+
data[altAxis] = _preventedOffset - _offset;
|
|
4745
|
+
}
|
|
4746
|
+
|
|
4747
|
+
state.modifiersData[name] = data;
|
|
4748
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
4749
|
+
|
|
4750
|
+
|
|
4751
|
+
var preventOverflow$1 = {
|
|
4752
|
+
name: 'preventOverflow',
|
|
4753
|
+
enabled: true,
|
|
4754
|
+
phase: 'main',
|
|
4755
|
+
fn: preventOverflow,
|
|
4756
|
+
requiresIfExists: ['offset']
|
|
4757
|
+
};
|
|
4758
|
+
|
|
4759
|
+
function getHTMLElementScroll(element) {
|
|
4760
|
+
return {
|
|
4761
|
+
scrollLeft: element.scrollLeft,
|
|
4762
|
+
scrollTop: element.scrollTop
|
|
4763
|
+
};
|
|
4764
|
+
}
|
|
4765
|
+
|
|
4766
|
+
function getNodeScroll(node) {
|
|
4767
|
+
if (node === getWindow(node) || !isHTMLElement(node)) {
|
|
4768
|
+
return getWindowScroll(node);
|
|
4769
|
+
} else {
|
|
4770
|
+
return getHTMLElementScroll(node);
|
|
4771
|
+
}
|
|
4772
|
+
}
|
|
4773
|
+
|
|
4774
|
+
function isElementScaled(element) {
|
|
4775
|
+
var rect = element.getBoundingClientRect();
|
|
4776
|
+
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
|
4777
|
+
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
|
4778
|
+
return scaleX !== 1 || scaleY !== 1;
|
|
4779
|
+
} // Returns the composite rect of an element relative to its offsetParent.
|
|
4780
|
+
// Composite means it takes into account transforms as well as layout.
|
|
4781
|
+
|
|
4782
|
+
|
|
4783
|
+
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
4784
|
+
if (isFixed === void 0) {
|
|
4785
|
+
isFixed = false;
|
|
4786
|
+
}
|
|
4787
|
+
|
|
4788
|
+
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
4789
|
+
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
4790
|
+
var documentElement = getDocumentElement(offsetParent);
|
|
4791
|
+
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
|
4792
|
+
var scroll = {
|
|
4793
|
+
scrollLeft: 0,
|
|
4794
|
+
scrollTop: 0
|
|
4795
|
+
};
|
|
4796
|
+
var offsets = {
|
|
4797
|
+
x: 0,
|
|
4798
|
+
y: 0
|
|
4799
|
+
};
|
|
4800
|
+
|
|
4801
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
4802
|
+
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
|
|
4803
|
+
isScrollParent(documentElement)) {
|
|
4804
|
+
scroll = getNodeScroll(offsetParent);
|
|
4805
|
+
}
|
|
4806
|
+
|
|
4807
|
+
if (isHTMLElement(offsetParent)) {
|
|
4808
|
+
offsets = getBoundingClientRect(offsetParent, true);
|
|
4809
|
+
offsets.x += offsetParent.clientLeft;
|
|
4810
|
+
offsets.y += offsetParent.clientTop;
|
|
4811
|
+
} else if (documentElement) {
|
|
4812
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
4813
|
+
}
|
|
4814
|
+
}
|
|
4815
|
+
|
|
4816
|
+
return {
|
|
4817
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
4818
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
|
4819
|
+
width: rect.width,
|
|
4820
|
+
height: rect.height
|
|
4821
|
+
};
|
|
4822
|
+
}
|
|
4823
|
+
|
|
4824
|
+
function order(modifiers) {
|
|
4825
|
+
var map = new Map();
|
|
4826
|
+
var visited = new Set();
|
|
4827
|
+
var result = [];
|
|
4828
|
+
modifiers.forEach(function (modifier) {
|
|
4829
|
+
map.set(modifier.name, modifier);
|
|
4830
|
+
}); // On visiting object, check for its dependencies and visit them recursively
|
|
4831
|
+
|
|
4832
|
+
function sort(modifier) {
|
|
4833
|
+
visited.add(modifier.name);
|
|
4834
|
+
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
|
4835
|
+
requires.forEach(function (dep) {
|
|
4836
|
+
if (!visited.has(dep)) {
|
|
4837
|
+
var depModifier = map.get(dep);
|
|
4838
|
+
|
|
4839
|
+
if (depModifier) {
|
|
4840
|
+
sort(depModifier);
|
|
4841
|
+
}
|
|
4842
|
+
}
|
|
4843
|
+
});
|
|
4844
|
+
result.push(modifier);
|
|
4845
|
+
}
|
|
4846
|
+
|
|
4847
|
+
modifiers.forEach(function (modifier) {
|
|
4848
|
+
if (!visited.has(modifier.name)) {
|
|
4849
|
+
// check for visited object
|
|
4850
|
+
sort(modifier);
|
|
4851
|
+
}
|
|
4852
|
+
});
|
|
4853
|
+
return result;
|
|
4854
|
+
}
|
|
4855
|
+
|
|
4856
|
+
function orderModifiers(modifiers) {
|
|
4857
|
+
// order based on dependencies
|
|
4858
|
+
var orderedModifiers = order(modifiers); // order based on phase
|
|
4859
|
+
|
|
4860
|
+
return modifierPhases.reduce(function (acc, phase) {
|
|
4861
|
+
return acc.concat(orderedModifiers.filter(function (modifier) {
|
|
4862
|
+
return modifier.phase === phase;
|
|
4863
|
+
}));
|
|
4864
|
+
}, []);
|
|
4865
|
+
}
|
|
4866
|
+
|
|
4867
|
+
function debounce(fn) {
|
|
4868
|
+
var pending;
|
|
4869
|
+
return function () {
|
|
4870
|
+
if (!pending) {
|
|
4871
|
+
pending = new Promise(function (resolve) {
|
|
4872
|
+
Promise.resolve().then(function () {
|
|
4873
|
+
pending = undefined;
|
|
4874
|
+
resolve(fn());
|
|
4875
|
+
});
|
|
4876
|
+
});
|
|
4877
|
+
}
|
|
4878
|
+
|
|
4879
|
+
return pending;
|
|
4880
|
+
};
|
|
4881
|
+
}
|
|
4882
|
+
|
|
4883
|
+
function mergeByName(modifiers) {
|
|
4884
|
+
var merged = modifiers.reduce(function (merged, current) {
|
|
4885
|
+
var existing = merged[current.name];
|
|
4886
|
+
merged[current.name] = existing ? Object.assign({}, existing, current, {
|
|
4887
|
+
options: Object.assign({}, existing.options, current.options),
|
|
4888
|
+
data: Object.assign({}, existing.data, current.data)
|
|
4889
|
+
}) : current;
|
|
4890
|
+
return merged;
|
|
4891
|
+
}, {}); // IE11 does not support Object.values
|
|
4892
|
+
|
|
4893
|
+
return Object.keys(merged).map(function (key) {
|
|
4894
|
+
return merged[key];
|
|
4895
|
+
});
|
|
4896
|
+
}
|
|
4897
|
+
|
|
4898
|
+
var DEFAULT_OPTIONS = {
|
|
4899
|
+
placement: 'bottom',
|
|
4900
|
+
modifiers: [],
|
|
4901
|
+
strategy: 'absolute'
|
|
4902
|
+
};
|
|
4903
|
+
|
|
4904
|
+
function areValidElements() {
|
|
4905
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4906
|
+
args[_key] = arguments[_key];
|
|
4907
|
+
}
|
|
4908
|
+
|
|
4909
|
+
return !args.some(function (element) {
|
|
4910
|
+
return !(element && typeof element.getBoundingClientRect === 'function');
|
|
4911
|
+
});
|
|
4912
|
+
}
|
|
4913
|
+
|
|
4914
|
+
function popperGenerator(generatorOptions) {
|
|
4915
|
+
if (generatorOptions === void 0) {
|
|
4916
|
+
generatorOptions = {};
|
|
4917
|
+
}
|
|
4918
|
+
|
|
4919
|
+
var _generatorOptions = generatorOptions,
|
|
4920
|
+
_generatorOptions$def = _generatorOptions.defaultModifiers,
|
|
4921
|
+
defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
|
|
4922
|
+
_generatorOptions$def2 = _generatorOptions.defaultOptions,
|
|
4923
|
+
defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
|
4924
|
+
return function createPopper(reference, popper, options) {
|
|
4925
|
+
if (options === void 0) {
|
|
4926
|
+
options = defaultOptions;
|
|
4927
|
+
}
|
|
4928
|
+
|
|
4929
|
+
var state = {
|
|
4930
|
+
placement: 'bottom',
|
|
4931
|
+
orderedModifiers: [],
|
|
4932
|
+
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
|
4933
|
+
modifiersData: {},
|
|
4934
|
+
elements: {
|
|
4935
|
+
reference: reference,
|
|
4936
|
+
popper: popper
|
|
4937
|
+
},
|
|
4938
|
+
attributes: {},
|
|
4939
|
+
styles: {}
|
|
4940
|
+
};
|
|
4941
|
+
var effectCleanupFns = [];
|
|
4942
|
+
var isDestroyed = false;
|
|
4943
|
+
var instance = {
|
|
4944
|
+
state: state,
|
|
4945
|
+
setOptions: function setOptions(setOptionsAction) {
|
|
4946
|
+
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
|
4947
|
+
cleanupModifierEffects();
|
|
4948
|
+
state.options = Object.assign({}, defaultOptions, state.options, options);
|
|
4949
|
+
state.scrollParents = {
|
|
4950
|
+
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
|
4951
|
+
popper: listScrollParents(popper)
|
|
4952
|
+
}; // Orders the modifiers based on their dependencies and `phase`
|
|
4953
|
+
// properties
|
|
4954
|
+
|
|
4955
|
+
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
|
|
4956
|
+
|
|
4957
|
+
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
|
4958
|
+
return m.enabled;
|
|
4959
|
+
});
|
|
4960
|
+
runModifierEffects();
|
|
4961
|
+
return instance.update();
|
|
4962
|
+
},
|
|
4963
|
+
// Sync update – it will always be executed, even if not necessary. This
|
|
4964
|
+
// is useful for low frequency updates where sync behavior simplifies the
|
|
4965
|
+
// logic.
|
|
4966
|
+
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
|
4967
|
+
// prefer the async Popper#update method
|
|
4968
|
+
forceUpdate: function forceUpdate() {
|
|
4969
|
+
if (isDestroyed) {
|
|
4970
|
+
return;
|
|
4971
|
+
}
|
|
4972
|
+
|
|
4973
|
+
var _state$elements = state.elements,
|
|
4974
|
+
reference = _state$elements.reference,
|
|
4975
|
+
popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
|
|
4976
|
+
// anymore
|
|
4977
|
+
|
|
4978
|
+
if (!areValidElements(reference, popper)) {
|
|
4979
|
+
return;
|
|
4980
|
+
} // Store the reference and popper rects to be read by modifiers
|
|
4981
|
+
|
|
4982
|
+
|
|
4983
|
+
state.rects = {
|
|
4984
|
+
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
|
|
4985
|
+
popper: getLayoutRect(popper)
|
|
4986
|
+
}; // Modifiers have the ability to reset the current update cycle. The
|
|
4987
|
+
// most common use case for this is the `flip` modifier changing the
|
|
4988
|
+
// placement, which then needs to re-run all the modifiers, because the
|
|
4989
|
+
// logic was previously ran for the previous placement and is therefore
|
|
4990
|
+
// stale/incorrect
|
|
4991
|
+
|
|
4992
|
+
state.reset = false;
|
|
4993
|
+
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
|
|
4994
|
+
// is filled with the initial data specified by the modifier. This means
|
|
4995
|
+
// it doesn't persist and is fresh on each update.
|
|
4996
|
+
// To ensure persistent data, use `${name}#persistent`
|
|
4997
|
+
|
|
4998
|
+
state.orderedModifiers.forEach(function (modifier) {
|
|
4999
|
+
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
|
5000
|
+
});
|
|
5001
|
+
|
|
5002
|
+
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
|
5003
|
+
if (state.reset === true) {
|
|
5004
|
+
state.reset = false;
|
|
5005
|
+
index = -1;
|
|
5006
|
+
continue;
|
|
5007
|
+
}
|
|
5008
|
+
|
|
5009
|
+
var _state$orderedModifie = state.orderedModifiers[index],
|
|
5010
|
+
fn = _state$orderedModifie.fn,
|
|
5011
|
+
_state$orderedModifie2 = _state$orderedModifie.options,
|
|
5012
|
+
_options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
|
|
5013
|
+
name = _state$orderedModifie.name;
|
|
5014
|
+
|
|
5015
|
+
if (typeof fn === 'function') {
|
|
5016
|
+
state = fn({
|
|
5017
|
+
state: state,
|
|
5018
|
+
options: _options,
|
|
5019
|
+
name: name,
|
|
5020
|
+
instance: instance
|
|
5021
|
+
}) || state;
|
|
5022
|
+
}
|
|
5023
|
+
}
|
|
5024
|
+
},
|
|
5025
|
+
// Async and optimistically optimized update – it will not be executed if
|
|
5026
|
+
// not necessary (debounced to run at most once-per-tick)
|
|
5027
|
+
update: debounce(function () {
|
|
5028
|
+
return new Promise(function (resolve) {
|
|
5029
|
+
instance.forceUpdate();
|
|
5030
|
+
resolve(state);
|
|
5031
|
+
});
|
|
5032
|
+
}),
|
|
5033
|
+
destroy: function destroy() {
|
|
5034
|
+
cleanupModifierEffects();
|
|
5035
|
+
isDestroyed = true;
|
|
5036
|
+
}
|
|
5037
|
+
};
|
|
5038
|
+
|
|
5039
|
+
if (!areValidElements(reference, popper)) {
|
|
5040
|
+
return instance;
|
|
5041
|
+
}
|
|
5042
|
+
|
|
5043
|
+
instance.setOptions(options).then(function (state) {
|
|
5044
|
+
if (!isDestroyed && options.onFirstUpdate) {
|
|
5045
|
+
options.onFirstUpdate(state);
|
|
5046
|
+
}
|
|
5047
|
+
}); // Modifiers have the ability to execute arbitrary code before the first
|
|
5048
|
+
// update cycle runs. They will be executed in the same order as the update
|
|
5049
|
+
// cycle. This is useful when a modifier adds some persistent data that
|
|
5050
|
+
// other modifiers need to use, but the modifier is run after the dependent
|
|
5051
|
+
// one.
|
|
5052
|
+
|
|
5053
|
+
function runModifierEffects() {
|
|
5054
|
+
state.orderedModifiers.forEach(function (_ref) {
|
|
5055
|
+
var name = _ref.name,
|
|
5056
|
+
_ref$options = _ref.options,
|
|
5057
|
+
options = _ref$options === void 0 ? {} : _ref$options,
|
|
5058
|
+
effect = _ref.effect;
|
|
5059
|
+
|
|
5060
|
+
if (typeof effect === 'function') {
|
|
5061
|
+
var cleanupFn = effect({
|
|
5062
|
+
state: state,
|
|
5063
|
+
name: name,
|
|
5064
|
+
instance: instance,
|
|
5065
|
+
options: options
|
|
5066
|
+
});
|
|
5067
|
+
|
|
5068
|
+
var noopFn = function noopFn() {};
|
|
5069
|
+
|
|
5070
|
+
effectCleanupFns.push(cleanupFn || noopFn);
|
|
5071
|
+
}
|
|
5072
|
+
});
|
|
5073
|
+
}
|
|
5074
|
+
|
|
5075
|
+
function cleanupModifierEffects() {
|
|
5076
|
+
effectCleanupFns.forEach(function (fn) {
|
|
5077
|
+
return fn();
|
|
5078
|
+
});
|
|
5079
|
+
effectCleanupFns = [];
|
|
5080
|
+
}
|
|
5081
|
+
|
|
5082
|
+
return instance;
|
|
5083
|
+
};
|
|
5084
|
+
}
|
|
5085
|
+
|
|
5086
|
+
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
|
|
5087
|
+
var createPopper = /*#__PURE__*/popperGenerator({
|
|
5088
|
+
defaultModifiers: defaultModifiers
|
|
5089
|
+
}); // eslint-disable-next-line import/no-unused-modules
|
|
5090
|
+
|
|
5091
|
+
var CreatePortal = function CreatePortal(_a) {
|
|
5092
|
+
var parent = _a.parent,
|
|
5093
|
+
children = _a.children;
|
|
5094
|
+
var container = useRef(parent);
|
|
5095
|
+
return /*#__PURE__*/ReactDOM.createPortal(children, container.current);
|
|
5096
|
+
};
|
|
5097
|
+
|
|
5098
|
+
var css_248z$6 = ".maru-popover-background {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n z-index: 1611;\n}\n\n.maru-popover {\n border-radius: 8px;\n background-color: white;\n outline: none;\n box-shadow: 0px 0px 6px #e4e4e4;\n}";
|
|
5099
|
+
styleInject(css_248z$6);
|
|
5100
|
+
|
|
5101
|
+
function Popover(_a) {
|
|
5102
|
+
var anchorEl = _a.anchorEl,
|
|
5103
|
+
children = _a.children,
|
|
5104
|
+
open = _a.open,
|
|
5105
|
+
_b = _a.backdrop,
|
|
5106
|
+
backdrop = _b === void 0 ? true : _b,
|
|
5107
|
+
className = _a.className,
|
|
5108
|
+
_c = _a.direction,
|
|
5109
|
+
direction = _c === void 0 ? 'right' : _c,
|
|
5110
|
+
onClose = _a.onClose,
|
|
5111
|
+
_d = _a.portal,
|
|
5112
|
+
portal = _d === void 0 ? false : _d;
|
|
5113
|
+
var popoverRef = useRef(null);
|
|
5114
|
+
useEffect(function () {
|
|
5115
|
+
if (anchorEl && popoverRef.current && open) {
|
|
5116
|
+
/**
|
|
5117
|
+
* instance를 useMemo로 선언하면 레퍼런스의 DOM을 찾지 못 하고,
|
|
5118
|
+
* useCallback으로 선언하면 함수라서 호출 될 때 마다 새로운 객체가 생성되어 .update가 동작하지 않음
|
|
5119
|
+
*/
|
|
5120
|
+
var instance_1 = createPopper(anchorEl, popoverRef.current, {
|
|
5121
|
+
placement: direction,
|
|
5122
|
+
modifiers: [{
|
|
5123
|
+
name: 'flip',
|
|
5124
|
+
options: {
|
|
5125
|
+
padding: 10
|
|
5126
|
+
}
|
|
5127
|
+
}, {
|
|
5128
|
+
name: 'offset',
|
|
5129
|
+
options: {
|
|
5130
|
+
offset: [0, 4]
|
|
5131
|
+
}
|
|
5132
|
+
}]
|
|
5133
|
+
});
|
|
5134
|
+
var instanceSetOptions = function instanceSetOptions(isEnabled) {
|
|
5135
|
+
return instance_1.setOptions(function (options) {
|
|
5136
|
+
return __assign(__assign({}, options), {
|
|
5137
|
+
modifiers: __spreadArray(__spreadArray([], options.modifiers, true), [{
|
|
5138
|
+
name: 'eventListeners',
|
|
5139
|
+
enabled: isEnabled,
|
|
5140
|
+
options: {
|
|
5141
|
+
resize: isEnabled,
|
|
5142
|
+
scroll: isEnabled
|
|
5143
|
+
}
|
|
5144
|
+
}], false)
|
|
5145
|
+
});
|
|
5146
|
+
});
|
|
5147
|
+
};
|
|
5148
|
+
instanceSetOptions(true);
|
|
5149
|
+
instance_1.update();
|
|
5150
|
+
popoverRef.current.focus();
|
|
5151
|
+
}
|
|
5152
|
+
}, [open]);
|
|
5153
|
+
var handleBackgroundClick = function handleBackgroundClick() {
|
|
5154
|
+
if (backdrop) {
|
|
5155
|
+
onClose();
|
|
5156
|
+
}
|
|
5157
|
+
};
|
|
5158
|
+
var handleKeyUp = function handleKeyUp(e) {
|
|
5159
|
+
if (backdrop && e.key === 'Escape') {
|
|
5160
|
+
onClose();
|
|
5161
|
+
}
|
|
5162
|
+
};
|
|
5163
|
+
var handlePopoverClick = function handlePopoverClick(e) {
|
|
5164
|
+
e.preventDefault();
|
|
5165
|
+
e.stopPropagation();
|
|
5166
|
+
};
|
|
5167
|
+
var PopoverBody = open ? jsx("div", __assign({
|
|
5168
|
+
className: "maru-popover-background",
|
|
5169
|
+
onClick: handleBackgroundClick,
|
|
5170
|
+
tabIndex: -1,
|
|
5171
|
+
"aria-hidden": true
|
|
5172
|
+
}, {
|
|
5173
|
+
children: jsx("div", __assign({
|
|
5174
|
+
ref: popoverRef,
|
|
5175
|
+
className: classNames('maru-popover', className),
|
|
5176
|
+
role: "tooltip",
|
|
5177
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
5178
|
+
tabIndex: 0,
|
|
5179
|
+
onKeyUp: handleKeyUp,
|
|
5180
|
+
onClick: handlePopoverClick,
|
|
5181
|
+
"aria-hidden": true
|
|
5182
|
+
}, {
|
|
5183
|
+
children: children
|
|
5184
|
+
}))
|
|
5185
|
+
})) : null;
|
|
5186
|
+
return portal ? jsx(CreatePortal, __assign({
|
|
5187
|
+
parent: document.body
|
|
5188
|
+
}, {
|
|
5189
|
+
children: PopoverBody
|
|
5190
|
+
})) : PopoverBody;
|
|
5191
|
+
}
|
|
5192
|
+
|
|
5193
|
+
var css_248z$5 = ".maru-radio-wrapper-8px {\n display: flex;\n gap: 8px;\n}\n\n.maru-radio-wrapper-4px {\n display: flex;\n gap: 4px;\n}\n\n.maru-radio {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n border: 2px solid #5c5c5c;\n position: relative;\n display: inline-block;\n cursor: pointer;\n}\n.maru-radio:hover::before, .maru-radio:checked::before {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background-color: #5c5c5c;\n}\n\n.maru-radio-label {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n color: #5c5c5c;\n cursor: pointer;\n}\n\n.maru-radio:disabled,\n.label-disabled {\n cursor: default;\n opacity: 0.5;\n}";
|
|
5194
|
+
styleInject(css_248z$5);
|
|
5195
|
+
|
|
5196
|
+
var Radio = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
5197
|
+
var checked = _a.checked,
|
|
5198
|
+
_b = _a.gap,
|
|
5199
|
+
gap = _b === void 0 ? '8px' : _b,
|
|
5200
|
+
label = _a.label,
|
|
5201
|
+
props = __rest(_a, ["checked", "gap", "label"]);
|
|
5202
|
+
var hashId = uuidv4(4);
|
|
5203
|
+
var combineRef = useCombineRef(ref);
|
|
5204
|
+
return jsxs("div", __assign({
|
|
5205
|
+
className: classNames("maru-radio-wrapper-".concat(gap), props.className)
|
|
5206
|
+
}, {
|
|
5207
|
+
children: [jsx("input", __assign({
|
|
5208
|
+
ref: combineRef,
|
|
5209
|
+
id: "maru-radio-id-".concat(hashId),
|
|
5210
|
+
type: "radio",
|
|
5211
|
+
checked: checked == null ? undefined : !!checked,
|
|
5212
|
+
className: "maru-radio"
|
|
5213
|
+
}, props)), label && jsx("label", __assign({
|
|
5214
|
+
htmlFor: "maru-radio-id-".concat(hashId),
|
|
5215
|
+
className: classNames('maru-radio-label', {
|
|
5216
|
+
'label-disabled': props.disabled
|
|
5217
|
+
})
|
|
5218
|
+
}, {
|
|
5219
|
+
children: label
|
|
5220
|
+
}))]
|
|
5221
|
+
}));
|
|
5222
|
+
});
|
|
5223
|
+
Radio.defaultProps = {
|
|
5224
|
+
checked: undefined,
|
|
5225
|
+
gap: '8px',
|
|
5226
|
+
label: undefined
|
|
5227
|
+
};
|
|
5228
|
+
Radio.displayName = 'Radio';
|
|
5229
|
+
|
|
5230
|
+
var css_248z$4 = ".maru-toggle-wrapper {\n display: inline-block;\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper {\n position: relative;\n width: 30.67px;\n height: 18px;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper .maru-toggle {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n width: 100%;\n height: 100%;\n position: absolute;\n z-index: 11;\n cursor: pointer;\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper .maru-toggle:not(:checked) ~ .maru-toggle-rail {\n background-color: #bdbdbd;\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper .maru-toggle-rail {\n position: absolute;\n width: 30.67px;\n height: 18px;\n border-radius: 17.5px;\n background-color: var(--p);\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper .maru-toggle-rail-primary {\n background-color: var(--p);\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper .maru-toggle-rail-secondary {\n background-color: #8c8c8c;\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper .maru-toggle-rail-positive {\n background-color: #58c5a6;\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper .maru-toggle-rail-warning {\n background-color: #ffb020;\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper .maru-toggle-rail-danger {\n background-color: #e53e3e;\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper .maru-toggle-thumb {\n position: absolute;\n width: 15.33px;\n height: 15.33px;\n border-radius: 50%;\n transition: all 0.2s ease-in-out;\n background-color: white;\n top: 1.33px;\n right: 14px;\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper .maru-toggle:checked ~ .maru-toggle-thumb {\n transform: translateX(12.67px);\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper.toggle-disabled .maru-toggle {\n cursor: default;\n}\n.maru-toggle-wrapper .maru-toggle-inner-wrapper.toggle-disabled .maru-toggle-rail {\n background-color: #e4e4e4 !important;\n}\n\n.maru-toggle-text {\n position: relative;\n width: 66px;\n height: 23px;\n background-color: white;\n border-radius: 62px;\n overflow: hidden;\n}\n.maru-toggle-text-primary {\n box-shadow: 0 0 0 1px var(--p) inset;\n}\n.maru-toggle-text-primary .maru-toggle-text-thumb {\n background-color: var(--p);\n}\n.maru-toggle-text-primary .maru-toggle-text-thumb.shadow-before {\n box-shadow: -4px 0px 4px 0px var(--p-20);\n}\n.maru-toggle-text-primary .maru-toggle-text-thumb.shadow-after {\n box-shadow: 4px 0px 4px 0px var(--p-20);\n}\n.maru-toggle-text-primary .maru-toggle-text-button {\n color: var(--p);\n}\n.maru-toggle-text-primary .toggle-active {\n color: white;\n}\n.maru-toggle-text-primary.maru-toggle-text-disabled {\n box-shadow: 0 0 0 1px var(--p-50) inset;\n}\n.maru-toggle-text-primary.maru-toggle-text-disabled .maru-toggle-text-thumb {\n background-color: var(--p-50);\n}\n.maru-toggle-text-primary.maru-toggle-text-disabled .maru-toggle-text-thumb.shadow-before {\n box-shadow: -4px 0px 4px 0px var(--p-10);\n}\n.maru-toggle-text-primary.maru-toggle-text-disabled .maru-toggle-text-thumb.shadow-after {\n box-shadow: 4px 0px 4px 0px var(--p-10);\n}\n.maru-toggle-text-primary.maru-toggle-text-disabled .maru-toggle-text-button {\n color: var(--p-50);\n cursor: default;\n}\n.maru-toggle-text-primary.maru-toggle-text-disabled .toggle-active {\n color: white;\n}\n.maru-toggle-text-secondary {\n box-shadow: 0 0 0 1px #8c8c8c inset;\n}\n.maru-toggle-text-secondary .maru-toggle-text-thumb {\n background-color: #8c8c8c;\n}\n.maru-toggle-text-secondary .maru-toggle-text-thumb.shadow-before {\n box-shadow: -4px 0px 4px 0px #e4e4e4;\n}\n.maru-toggle-text-secondary .maru-toggle-text-thumb.shadow-after {\n box-shadow: 4px 0px 4px 0px #e4e4e4;\n}\n.maru-toggle-text-secondary .maru-toggle-text-button {\n color: #8c8c8c;\n}\n.maru-toggle-text-secondary .toggle-active {\n color: white;\n}\n.maru-toggle-text-secondary.maru-toggle-text-disabled {\n box-shadow: 0 0 0 1px #bdbdbd inset;\n}\n.maru-toggle-text-secondary.maru-toggle-text-disabled .maru-toggle-text-thumb {\n background-color: #bdbdbd;\n}\n.maru-toggle-text-secondary.maru-toggle-text-disabled .maru-toggle-text-thumb.shadow-before {\n box-shadow: -4px 0px 4px 0px #fafafa;\n}\n.maru-toggle-text-secondary.maru-toggle-text-disabled .maru-toggle-text-thumb.shadow-after {\n box-shadow: 4px 0px 4px 0px #fafafa;\n}\n.maru-toggle-text-secondary.maru-toggle-text-disabled .maru-toggle-text-button {\n color: #bdbdbd;\n cursor: default;\n}\n.maru-toggle-text-secondary.maru-toggle-text-disabled .toggle-active {\n color: white;\n}\n.maru-toggle-text-positive {\n box-shadow: 0 0 0 1px #58c5a6 inset;\n}\n.maru-toggle-text-positive .maru-toggle-text-thumb {\n background-color: #58c5a6;\n}\n.maru-toggle-text-positive .maru-toggle-text-thumb.shadow-before {\n box-shadow: -4px 0px 4px 0px #def3ed;\n}\n.maru-toggle-text-positive .maru-toggle-text-thumb.shadow-after {\n box-shadow: 4px 0px 4px 0px #def3ed;\n}\n.maru-toggle-text-positive .maru-toggle-text-button {\n color: #58c5a6;\n}\n.maru-toggle-text-positive .toggle-active {\n color: white;\n}\n.maru-toggle-text-positive.maru-toggle-text-disabled {\n box-shadow: 0 0 0 1px #abe1d2 inset;\n}\n.maru-toggle-text-positive.maru-toggle-text-disabled .maru-toggle-text-thumb {\n background-color: #abe1d2;\n}\n.maru-toggle-text-positive.maru-toggle-text-disabled .maru-toggle-text-thumb.shadow-before {\n box-shadow: -4px 0px 4px 0px;\n}\n.maru-toggle-text-positive.maru-toggle-text-disabled .maru-toggle-text-thumb.shadow-after {\n box-shadow: 4px 0px 4px 0px;\n}\n.maru-toggle-text-positive.maru-toggle-text-disabled .maru-toggle-text-button {\n color: #abe1d2;\n cursor: default;\n}\n.maru-toggle-text-positive.maru-toggle-text-disabled .toggle-active {\n color: white;\n}\n.maru-toggle-text-warning {\n box-shadow: 0 0 0 1px #ffb020 inset;\n}\n.maru-toggle-text-warning .maru-toggle-text-thumb {\n background-color: #ffb020;\n}\n.maru-toggle-text-warning .maru-toggle-text-thumb.shadow-before {\n box-shadow: -4px 0px 4px 0px #ffefd2;\n}\n.maru-toggle-text-warning .maru-toggle-text-thumb.shadow-after {\n box-shadow: 4px 0px 4px 0px #ffefd2;\n}\n.maru-toggle-text-warning .maru-toggle-text-button {\n color: #ffb020;\n}\n.maru-toggle-text-warning .toggle-active {\n color: white;\n}\n.maru-toggle-text-warning.maru-toggle-text-disabled {\n box-shadow: 0 0 0 1px #ffd78f inset;\n}\n.maru-toggle-text-warning.maru-toggle-text-disabled .maru-toggle-text-thumb {\n background-color: #ffd78f;\n}\n.maru-toggle-text-warning.maru-toggle-text-disabled .maru-toggle-text-thumb.shadow-before {\n box-shadow: -4px 0px 4px 0px #fff7e9;\n}\n.maru-toggle-text-warning.maru-toggle-text-disabled .maru-toggle-text-thumb.shadow-after {\n box-shadow: 4px 0px 4px 0px #fff7e9;\n}\n.maru-toggle-text-warning.maru-toggle-text-disabled .maru-toggle-text-button {\n color: #ffd78f;\n cursor: default;\n}\n.maru-toggle-text-warning.maru-toggle-text-disabled .toggle-active {\n color: white;\n}\n.maru-toggle-text-danger {\n box-shadow: 0 0 0 1px #e53e3e inset;\n}\n.maru-toggle-text-danger .maru-toggle-text-thumb {\n background-color: #e53e3e;\n}\n.maru-toggle-text-danger .maru-toggle-text-thumb.shadow-before {\n box-shadow: -4px 0px 4px 0px #fad8d8;\n}\n.maru-toggle-text-danger .maru-toggle-text-thumb.shadow-after {\n box-shadow: 4px 0px 4px 0px #fad8d8;\n}\n.maru-toggle-text-danger .maru-toggle-text-button {\n color: #e53e3e;\n}\n.maru-toggle-text-danger .toggle-active {\n color: white;\n}\n.maru-toggle-text-danger.maru-toggle-text-disabled {\n box-shadow: 0 0 0 1px #f29e9e inset;\n}\n.maru-toggle-text-danger.maru-toggle-text-disabled .maru-toggle-text-thumb {\n background-color: #f29e9e;\n}\n.maru-toggle-text-danger.maru-toggle-text-disabled .maru-toggle-text-thumb.shadow-before {\n box-shadow: -4px 0px 4px 0px #fcecec;\n}\n.maru-toggle-text-danger.maru-toggle-text-disabled .maru-toggle-text-thumb.shadow-after {\n box-shadow: 4px 0px 4px 0px #fcecec;\n}\n.maru-toggle-text-danger.maru-toggle-text-disabled .maru-toggle-text-button {\n color: #f29e9e;\n cursor: default;\n}\n.maru-toggle-text-danger.maru-toggle-text-disabled .toggle-active {\n color: white;\n}\n.maru-toggle-text .maru-toggle-text-thumb {\n top: 0;\n left: 0;\n position: absolute;\n width: 33px;\n height: 23px;\n border-radius: 62px;\n transition: all 0.2s ease-in-out;\n z-index: 1;\n}\n\n.slide-after {\n transform: translateX(33px);\n}\n\n.maru-toggle-text-button-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n\n.maru-toggle-text-button {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 10px;\n letter-spacing: -0.4px;\n font-weight: 700;\n position: relative;\n width: 33px;\n height: 23px;\n cursor: pointer;\n z-index: 2;\n background-color: transparent;\n border: 0;\n transition: color 0.4s ease;\n}";
|
|
5231
|
+
styleInject(css_248z$4);
|
|
5232
|
+
|
|
5233
|
+
function Toggle(_a) {
|
|
5234
|
+
var checked = _a.checked,
|
|
5235
|
+
onChange = _a.onChange,
|
|
5236
|
+
className = _a.className,
|
|
5237
|
+
_b = _a.color,
|
|
5238
|
+
color = _b === void 0 ? 'primary' : _b,
|
|
5239
|
+
disabled = _a.disabled,
|
|
5240
|
+
text = _a.text;
|
|
5241
|
+
var _c = useState(false),
|
|
5242
|
+
buttonToggle = _c[0],
|
|
5243
|
+
setButtonToggle = _c[1];
|
|
5244
|
+
useEffect(function () {
|
|
5245
|
+
setButtonToggle(checked);
|
|
5246
|
+
}, [checked]);
|
|
5247
|
+
var handleInputChange = function handleInputChange(e) {
|
|
5248
|
+
onChange(e.currentTarget.checked);
|
|
5249
|
+
};
|
|
5250
|
+
var handleClick = function handleClick() {
|
|
5251
|
+
setButtonToggle(function (prev) {
|
|
5252
|
+
onChange(!prev);
|
|
5253
|
+
return !prev;
|
|
5254
|
+
});
|
|
5255
|
+
};
|
|
5256
|
+
return jsx("div", {
|
|
5257
|
+
children: text ? jsxs("div", __assign({
|
|
5258
|
+
className: classNames('maru-toggle-text', "maru-toggle-text-".concat(color), {
|
|
5259
|
+
'maru-toggle-text-disabled': disabled
|
|
5260
|
+
}, className)
|
|
5261
|
+
}, {
|
|
5262
|
+
children: [jsx("span", {
|
|
5263
|
+
className: classNames('maru-toggle-text-thumb', {
|
|
5264
|
+
'slide-after': buttonToggle,
|
|
5265
|
+
'shadow-before': buttonToggle,
|
|
5266
|
+
'shadow-after': !buttonToggle
|
|
5267
|
+
})
|
|
5268
|
+
}), jsxs("div", __assign({
|
|
5269
|
+
className: "maru-toggle-text-button-wrapper"
|
|
5270
|
+
}, {
|
|
5271
|
+
children: [jsx("button", __assign({
|
|
5272
|
+
type: "button",
|
|
5273
|
+
value: text.left,
|
|
5274
|
+
onClick: handleClick,
|
|
5275
|
+
className: classNames('maru-toggle-text-button', {
|
|
5276
|
+
'toggle-active': !buttonToggle
|
|
5277
|
+
}),
|
|
5278
|
+
disabled: disabled
|
|
5279
|
+
}, {
|
|
5280
|
+
children: text.left
|
|
5281
|
+
})), jsx("button", __assign({
|
|
5282
|
+
type: "button",
|
|
5283
|
+
value: text.right,
|
|
5284
|
+
onClick: handleClick,
|
|
5285
|
+
className: classNames('maru-toggle-text-button', {
|
|
5286
|
+
'toggle-active': buttonToggle
|
|
5287
|
+
}),
|
|
5288
|
+
disabled: disabled
|
|
5289
|
+
}, {
|
|
5290
|
+
children: text.right
|
|
5291
|
+
}))]
|
|
5292
|
+
}))]
|
|
5293
|
+
})) : jsx("div", __assign({
|
|
5294
|
+
className: classNames('maru-toggle-wrapper', className)
|
|
5295
|
+
}, {
|
|
5296
|
+
children: jsxs("div", __assign({
|
|
5297
|
+
className: classNames('maru-toggle-inner-wrapper', {
|
|
5298
|
+
'toggle-disabled': disabled
|
|
5299
|
+
})
|
|
5300
|
+
}, {
|
|
5301
|
+
children: [jsx("input", {
|
|
5302
|
+
type: "checkbox",
|
|
5303
|
+
className: "maru-toggle",
|
|
5304
|
+
disabled: disabled,
|
|
5305
|
+
checked: checked == null ? undefined : !!checked,
|
|
5306
|
+
onChange: handleInputChange
|
|
5307
|
+
}), jsx("span", {
|
|
5308
|
+
className: classNames('maru-toggle-rail', "maru-toggle-rail-".concat(color))
|
|
5309
|
+
}), jsx("span", {
|
|
5310
|
+
className: "maru-toggle-thumb"
|
|
5311
|
+
})]
|
|
5312
|
+
}))
|
|
5313
|
+
}))
|
|
5314
|
+
});
|
|
5315
|
+
}
|
|
5316
|
+
|
|
5317
|
+
var css_248z$3 = ".maru-tooltip {\n z-index: 1612;\n border-radius: 5px;\n padding: 2px 4px;\n display: none;\n}\n.maru-tooltip[data-open=true] {\n display: block;\n}\n.maru-tooltip[data-open=false] {\n display: none;\n}\n\n.maru-tooltip-default {\n background-color: rgba(92, 92, 92, 0.5019607843);\n}\n.maru-tooltip-default,\n.maru-tooltip-default span,\n.maru-tooltip-default p,\n.maru-tooltip-default pre {\n color: white;\n white-space: pre-wrap;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n}\n\n.maru-tooltip-danger {\n background-color: rgba(229, 62, 62, 0.1019607843);\n}\n.maru-tooltip-danger,\n.maru-tooltip-danger span,\n.maru-tooltip-danger p,\n.maru-tooltip-danger pre {\n color: #e53e3e;\n white-space: pre-wrap;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n}";
|
|
5318
|
+
styleInject(css_248z$3);
|
|
5319
|
+
|
|
5320
|
+
function Tooltip(_a) {
|
|
5321
|
+
var children = _a.children,
|
|
5322
|
+
content = _a.content,
|
|
5323
|
+
className = _a.className,
|
|
5324
|
+
_b = _a.color,
|
|
5325
|
+
color = _b === void 0 ? 'default' : _b,
|
|
5326
|
+
_c = _a.direction,
|
|
5327
|
+
direction = _c === void 0 ? 'right' : _c,
|
|
5328
|
+
_d = _a.portal,
|
|
5329
|
+
portal = _d === void 0 ? false : _d;
|
|
5330
|
+
var _e = useState(false),
|
|
5331
|
+
open = _e[0],
|
|
5332
|
+
setOpen = _e[1];
|
|
5333
|
+
var wrapperRef = useRef(null);
|
|
5334
|
+
var tooltipRef = useRef(null);
|
|
5335
|
+
useEffect(function () {
|
|
5336
|
+
if (wrapperRef.current && tooltipRef.current && open) {
|
|
5337
|
+
/**
|
|
5338
|
+
* instance를 useMemo로 선언하면 레퍼런스의 DOM을 찾지 못 하고,
|
|
5339
|
+
* useCallback으로 선언하면 함수라서 호출 될 때 마다 새로운 객체가 생성되어 .update가 동작하지 않음
|
|
5340
|
+
*/
|
|
5341
|
+
var instance_1 = createPopper(wrapperRef.current, tooltipRef.current, {
|
|
5342
|
+
placement: direction,
|
|
5343
|
+
modifiers: [{
|
|
5344
|
+
name: 'flip',
|
|
5345
|
+
options: {
|
|
5346
|
+
padding: 10
|
|
5347
|
+
}
|
|
5348
|
+
}, {
|
|
5349
|
+
name: 'offset',
|
|
5350
|
+
options: {
|
|
5351
|
+
offset: [0, 2]
|
|
5352
|
+
}
|
|
5353
|
+
}]
|
|
5354
|
+
});
|
|
5355
|
+
var instanceSetOptions = function instanceSetOptions() {
|
|
5356
|
+
return instance_1.setOptions(function (options) {
|
|
5357
|
+
var modifiers = __spreadArray([], options.modifiers, true);
|
|
5358
|
+
return __assign(__assign({}, options), {
|
|
5359
|
+
modifiers: modifiers
|
|
5360
|
+
});
|
|
5361
|
+
});
|
|
5362
|
+
};
|
|
5363
|
+
instanceSetOptions();
|
|
5364
|
+
instance_1.update();
|
|
5365
|
+
}
|
|
5366
|
+
}, [open]);
|
|
5367
|
+
var Tootip = useMemo(function () {
|
|
5368
|
+
return jsx("div", __assign({
|
|
5369
|
+
className: classNames('maru-tooltip', "maru-tooltip-".concat(color)),
|
|
5370
|
+
ref: tooltipRef,
|
|
5371
|
+
role: "tooltip",
|
|
5372
|
+
"data-open": open
|
|
5373
|
+
}, {
|
|
5374
|
+
children: content
|
|
5375
|
+
}));
|
|
5376
|
+
}, [open]);
|
|
5377
|
+
return jsxs("div", __assign({
|
|
5378
|
+
className: className,
|
|
5379
|
+
ref: wrapperRef,
|
|
5380
|
+
onMouseOver: function onMouseOver() {
|
|
5381
|
+
return setOpen(true);
|
|
5382
|
+
},
|
|
5383
|
+
onMouseLeave: function onMouseLeave() {
|
|
5384
|
+
return setOpen(false);
|
|
5385
|
+
},
|
|
5386
|
+
onFocus: function onFocus() {
|
|
5387
|
+
return setOpen(true);
|
|
5388
|
+
},
|
|
5389
|
+
onBlur: function onBlur() {
|
|
5390
|
+
return setOpen(false);
|
|
5391
|
+
}
|
|
5392
|
+
}, {
|
|
5393
|
+
children: [children, portal ? jsx(CreatePortal, __assign({
|
|
5394
|
+
parent: document.body
|
|
5395
|
+
}, {
|
|
5396
|
+
children: Tootip
|
|
5397
|
+
})) : Tootip]
|
|
5398
|
+
}));
|
|
5399
|
+
}
|
|
5400
|
+
|
|
5401
|
+
var noSpace = function noSpace(text) {
|
|
5402
|
+
if (text) {
|
|
5403
|
+
return text.replace(/\s/g, '');
|
|
5404
|
+
}
|
|
5405
|
+
return '';
|
|
5406
|
+
};
|
|
5407
|
+
|
|
5408
|
+
// text char 하나씩 비교하는 경우 (띄워쓰기 무시, 검색할 때 띄워쓰기 무시해야함)
|
|
5409
|
+
var setHighlightTextOnDataExceptSpace = function setHighlightTextOnDataExceptSpace(data, targetKey, compareText, autoExcept) {
|
|
5410
|
+
if (autoExcept === void 0) {
|
|
5411
|
+
autoExcept = false;
|
|
5412
|
+
}
|
|
5413
|
+
var setHighlightIdx = function setHighlightIdx(dt) {
|
|
5414
|
+
var pqi = 0;
|
|
5415
|
+
var idx = [-1, -1];
|
|
5416
|
+
for (var i = 0; i <= dt[targetKey].length; i += 1) {
|
|
5417
|
+
if (dt[targetKey][i] !== ' ') {
|
|
5418
|
+
if (pqi === compareText.length) {
|
|
5419
|
+
idx[1] = i;
|
|
5420
|
+
break;
|
|
5421
|
+
}
|
|
5422
|
+
if (dt[targetKey][i].toLowerCase() === compareText[pqi]) {
|
|
5423
|
+
if (pqi === 0) {
|
|
5424
|
+
idx[0] = i;
|
|
5425
|
+
}
|
|
5426
|
+
pqi += 1;
|
|
5427
|
+
} else {
|
|
5428
|
+
pqi = 0;
|
|
5429
|
+
}
|
|
5430
|
+
}
|
|
5431
|
+
}
|
|
5432
|
+
return idx;
|
|
5433
|
+
};
|
|
5434
|
+
return data.reduce(function (acc, curr) {
|
|
5435
|
+
var _a;
|
|
5436
|
+
if (noSpace(curr[targetKey]).toLowerCase().includes(compareText)) {
|
|
5437
|
+
var highlightIdx = setHighlightIdx(curr);
|
|
5438
|
+
if (highlightIdx.every(function (el) {
|
|
5439
|
+
return el !== -1;
|
|
5440
|
+
})) {
|
|
5441
|
+
var highlightText = "".concat(curr[targetKey].slice(0, highlightIdx[0]), "<em>").concat(curr[targetKey].slice(highlightIdx[0], highlightIdx[1]), "</em>").concat(curr[targetKey].slice(highlightIdx[1]));
|
|
5442
|
+
acc.push(__assign(__assign({}, curr), (_a = {}, _a[targetKey] = highlightText, _a)));
|
|
5443
|
+
return acc;
|
|
5444
|
+
}
|
|
5445
|
+
}
|
|
5446
|
+
if (!autoExcept) {
|
|
5447
|
+
acc.push(curr);
|
|
5448
|
+
}
|
|
5449
|
+
return acc;
|
|
5450
|
+
}, []);
|
|
5451
|
+
};
|
|
5452
|
+
|
|
5453
|
+
function Arrow(_a) {
|
|
5454
|
+
var open = _a.open,
|
|
5455
|
+
focus = _a.focus,
|
|
5456
|
+
color = _a.color;
|
|
5457
|
+
return jsx("span", __assign({
|
|
5458
|
+
className: "maru-dropdown-toggle-arrow"
|
|
5459
|
+
}, {
|
|
5460
|
+
children: jsx(Icon, {
|
|
5461
|
+
name: open ? ICONS.ChevronUp : ICONS.ChevronDown,
|
|
5462
|
+
color: focus || open ? color : '#e4e4e4',
|
|
5463
|
+
size: 16
|
|
5464
|
+
})
|
|
5465
|
+
}));
|
|
5466
|
+
}
|
|
5467
|
+
|
|
5468
|
+
function Clear(_a) {
|
|
5469
|
+
var clearSelected = _a.clearSelected,
|
|
5470
|
+
initInputValue = _a.initInputValue,
|
|
5471
|
+
onClear = _a.onClear,
|
|
5472
|
+
initFilteredData = _a.initFilteredData;
|
|
5473
|
+
var handleClick = function handleClick(e) {
|
|
5474
|
+
e.preventDefault();
|
|
5475
|
+
e.stopPropagation();
|
|
5476
|
+
clearSelected();
|
|
5477
|
+
initInputValue();
|
|
5478
|
+
onClear();
|
|
5479
|
+
initFilteredData();
|
|
5480
|
+
};
|
|
5481
|
+
return (
|
|
5482
|
+
// eslint-disable-next-line jsx-a11y/control-has-associated-label
|
|
5483
|
+
jsx("button", __assign({
|
|
5484
|
+
type: "button",
|
|
5485
|
+
className: "maru-dropdown-toggle-clear",
|
|
5486
|
+
onClick: handleClick
|
|
5487
|
+
}, {
|
|
5488
|
+
children: jsx(Icon, {
|
|
5489
|
+
name: ICONS.XSmallThin,
|
|
5490
|
+
size: 20
|
|
5491
|
+
})
|
|
5492
|
+
}))
|
|
5493
|
+
);
|
|
5494
|
+
}
|
|
5495
|
+
|
|
5496
|
+
function DropdownToggleButton(_a) {
|
|
5497
|
+
var open = _a.open,
|
|
5498
|
+
selected = _a.selected,
|
|
5499
|
+
displayKey = _a.displayKey,
|
|
5500
|
+
color = _a.color,
|
|
5501
|
+
width = _a.width,
|
|
5502
|
+
disabled = _a.disabled,
|
|
5503
|
+
placeholder = _a.placeholder,
|
|
5504
|
+
errored = _a.errored,
|
|
5505
|
+
inlineLabel = _a.inlineLabel,
|
|
5506
|
+
startArrow = _a.startArrow,
|
|
5507
|
+
toggleEndNode = _a.toggleEndNode,
|
|
5508
|
+
customButton = _a.customButton,
|
|
5509
|
+
initFilteredData = _a.initFilteredData,
|
|
5510
|
+
toggleMenuOpen = _a.toggleMenuOpen,
|
|
5511
|
+
initInputValue = _a.initInputValue,
|
|
5512
|
+
clearSelected = _a.clearSelected,
|
|
5513
|
+
onClear = _a.onClear,
|
|
5514
|
+
onKeyDown = _a.onKeyDown;
|
|
5515
|
+
var _b = useState(false),
|
|
5516
|
+
focus = _b[0],
|
|
5517
|
+
setFocus = _b[1];
|
|
5518
|
+
var handleClick = function handleClick() {
|
|
5519
|
+
if (disabled) return;
|
|
5520
|
+
initFilteredData();
|
|
5521
|
+
toggleMenuOpen();
|
|
5522
|
+
};
|
|
5523
|
+
return jsxs("div", __assign({
|
|
5524
|
+
className: classNames('maru-dropdown-toggle-wrapper', "maru-dropdown-toggle-wrapper-".concat(color), {
|
|
5525
|
+
errored: errored,
|
|
5526
|
+
'inline-label-wrapper': inlineLabel
|
|
5527
|
+
}),
|
|
5528
|
+
style: {
|
|
5529
|
+
width: width || '100%'
|
|
5530
|
+
},
|
|
5531
|
+
onMouseOver: function onMouseOver() {
|
|
5532
|
+
return setFocus(true);
|
|
5533
|
+
},
|
|
5534
|
+
onMouseLeave: function onMouseLeave() {
|
|
5535
|
+
return setFocus(open);
|
|
5536
|
+
},
|
|
5537
|
+
onFocus: function onFocus() {
|
|
5538
|
+
return setFocus(true);
|
|
5539
|
+
},
|
|
5540
|
+
onBlur: function onBlur() {
|
|
5541
|
+
return setFocus(false);
|
|
5542
|
+
}
|
|
5543
|
+
}, {
|
|
5544
|
+
children: [inlineLabel && jsx("span", __assign({
|
|
5545
|
+
className: "inline-label"
|
|
5546
|
+
}, {
|
|
5547
|
+
children: inlineLabel
|
|
5548
|
+
})), jsxs("button", __assign({
|
|
5549
|
+
type: "button",
|
|
5550
|
+
className: "maru-dropdown-button",
|
|
5551
|
+
disabled: disabled,
|
|
5552
|
+
onClick: handleClick,
|
|
5553
|
+
onKeyDown: onKeyDown
|
|
5554
|
+
}, {
|
|
5555
|
+
children: [startArrow && !disabled && jsx(Arrow, {
|
|
5556
|
+
open: open,
|
|
5557
|
+
focus: focus,
|
|
5558
|
+
color: color
|
|
5559
|
+
}), jsx("span", __assign({
|
|
5560
|
+
className: classNames('maru-dropdown-button-contents', {
|
|
5561
|
+
placeholder: !customButton && !selected && placeholder
|
|
5562
|
+
})
|
|
5563
|
+
}, {
|
|
5564
|
+
children: customButton || (selected ? selected[displayKey] : placeholder)
|
|
5565
|
+
})), toggleEndNode && jsx("div", {
|
|
5566
|
+
children: toggleEndNode
|
|
5567
|
+
}), !disabled && selected && onClear && jsx(Clear, {
|
|
5568
|
+
clearSelected: clearSelected,
|
|
5569
|
+
initInputValue: initInputValue,
|
|
5570
|
+
onClear: onClear,
|
|
5571
|
+
initFilteredData: initFilteredData
|
|
5572
|
+
}), !startArrow && !disabled && jsx(Arrow, {
|
|
5573
|
+
open: open,
|
|
5574
|
+
focus: focus,
|
|
5575
|
+
color: color
|
|
5576
|
+
})]
|
|
5577
|
+
}))]
|
|
5578
|
+
}));
|
|
5579
|
+
}
|
|
5580
|
+
|
|
5581
|
+
function DropdownToggleInput(_a) {
|
|
5582
|
+
var open = _a.open,
|
|
5583
|
+
value = _a.value,
|
|
5584
|
+
selected = _a.selected,
|
|
5585
|
+
color = _a.color,
|
|
5586
|
+
width = _a.width,
|
|
5587
|
+
disabled = _a.disabled,
|
|
5588
|
+
placeholder = _a.placeholder,
|
|
5589
|
+
errored = _a.errored,
|
|
5590
|
+
inlineLabel = _a.inlineLabel,
|
|
5591
|
+
startArrow = _a.startArrow,
|
|
5592
|
+
toggleEndNode = _a.toggleEndNode,
|
|
5593
|
+
onChange = _a.onChange,
|
|
5594
|
+
initFilteredData = _a.initFilteredData,
|
|
5595
|
+
toggleMenuOpen = _a.toggleMenuOpen,
|
|
5596
|
+
initInputValue = _a.initInputValue,
|
|
5597
|
+
clearSelected = _a.clearSelected,
|
|
5598
|
+
onClear = _a.onClear,
|
|
5599
|
+
onKeyDown = _a.onKeyDown;
|
|
5600
|
+
var _b = useState(false),
|
|
5601
|
+
focus = _b[0],
|
|
5602
|
+
setFocus = _b[1];
|
|
5603
|
+
var handleClick = function handleClick() {
|
|
5604
|
+
if (disabled) return;
|
|
5605
|
+
initFilteredData();
|
|
5606
|
+
toggleMenuOpen();
|
|
5607
|
+
};
|
|
5608
|
+
return jsxs("div", __assign({
|
|
5609
|
+
className: classNames('maru-dropdown-toggle-wrapper', "maru-dropdown-toggle-wrapper-".concat(color), {
|
|
5610
|
+
errored: errored,
|
|
5611
|
+
'inline-label-wrapper': inlineLabel
|
|
5612
|
+
}),
|
|
5613
|
+
onClick: handleClick,
|
|
5614
|
+
tabIndex: -1,
|
|
5615
|
+
"aria-hidden": true,
|
|
5616
|
+
"data-disabled": disabled,
|
|
5617
|
+
style: {
|
|
5618
|
+
width: width || '100%'
|
|
5619
|
+
},
|
|
5620
|
+
onKeyDown: onKeyDown,
|
|
5621
|
+
onMouseOver: function onMouseOver() {
|
|
5622
|
+
return setFocus(true);
|
|
5623
|
+
},
|
|
5624
|
+
onMouseLeave: function onMouseLeave() {
|
|
5625
|
+
return setFocus(open);
|
|
5626
|
+
},
|
|
5627
|
+
onFocus: function onFocus() {
|
|
5628
|
+
return setFocus(true);
|
|
5629
|
+
},
|
|
5630
|
+
onBlur: function onBlur() {
|
|
5631
|
+
return setFocus(false);
|
|
5632
|
+
}
|
|
5633
|
+
}, {
|
|
5634
|
+
children: [inlineLabel && jsx("span", __assign({
|
|
5635
|
+
className: "inline-label"
|
|
5636
|
+
}, {
|
|
5637
|
+
children: inlineLabel
|
|
5638
|
+
})), jsxs("div", __assign({
|
|
5639
|
+
className: "maru-dropdown-input"
|
|
5640
|
+
}, {
|
|
5641
|
+
children: [startArrow && !disabled && jsx(Arrow, {
|
|
5642
|
+
open: open,
|
|
5643
|
+
focus: focus,
|
|
5644
|
+
color: color
|
|
5645
|
+
}), jsx("input", {
|
|
5646
|
+
"aria-autocomplete": "none",
|
|
5647
|
+
value: value,
|
|
5648
|
+
onChange: onChange,
|
|
5649
|
+
disabled: disabled,
|
|
5650
|
+
placeholder: placeholder
|
|
5651
|
+
}), toggleEndNode && jsx("div", {
|
|
5652
|
+
children: toggleEndNode
|
|
5653
|
+
}), !disabled && selected && onClear && jsx(Clear, {
|
|
5654
|
+
clearSelected: clearSelected,
|
|
5655
|
+
initInputValue: initInputValue,
|
|
5656
|
+
onClear: onClear,
|
|
5657
|
+
initFilteredData: initFilteredData
|
|
5658
|
+
}), !startArrow && !disabled && jsx(Arrow, {
|
|
5659
|
+
open: open,
|
|
5660
|
+
focus: focus,
|
|
5661
|
+
color: color
|
|
5662
|
+
})]
|
|
5663
|
+
}))]
|
|
5664
|
+
}));
|
|
5665
|
+
}
|
|
5666
|
+
|
|
5667
|
+
function DropdownMenu(_a) {
|
|
5668
|
+
var parent = _a.parent,
|
|
5669
|
+
menuItemEls = _a.menuItemEls,
|
|
5670
|
+
selectedId = _a.selectedId,
|
|
5671
|
+
idKey = _a.idKey,
|
|
5672
|
+
displayKey = _a.displayKey,
|
|
5673
|
+
filteredData = _a.filteredData,
|
|
5674
|
+
width = _a.width,
|
|
5675
|
+
height = _a.height,
|
|
5676
|
+
noMessage = _a.noMessage,
|
|
5677
|
+
CustomMenuItem = _a.customMenuItem,
|
|
5678
|
+
onSelect = _a.onSelect,
|
|
5679
|
+
closeMenu = _a.closeMenu;
|
|
5680
|
+
var menuWrapperRef = useRef(null);
|
|
5681
|
+
var menuRef = useRef(null);
|
|
5682
|
+
// 메뉴의 사이즈와 위치 설정
|
|
5683
|
+
useEffect(function () {
|
|
5684
|
+
var menu = menuRef.current;
|
|
5685
|
+
if (menu) {
|
|
5686
|
+
var _a = parent.getClientRects()[0],
|
|
5687
|
+
pw = _a.width,
|
|
5688
|
+
ph = _a.height,
|
|
5689
|
+
pt = _a.top,
|
|
5690
|
+
pl = _a.left;
|
|
5691
|
+
var newWidth = width || pw;
|
|
5692
|
+
menu.style.width = "".concat(newWidth, "px");
|
|
5693
|
+
// if (!horizonMenu) {
|
|
5694
|
+
menu.style.left = "".concat(pl, "px");
|
|
5695
|
+
// } else {
|
|
5696
|
+
// TODO: horizon menu test
|
|
5697
|
+
// menu.style.left = `${pl + pw - newWidth}px`;
|
|
5698
|
+
// }
|
|
5699
|
+
// FIXME: 무슨 조건인지 잘 모르겠음
|
|
5700
|
+
if (ph + pt + menu.offsetHeight + 10 > document.body.offsetHeight) {
|
|
5701
|
+
menu.style.top = "".concat(pt - menu.offsetHeight - 4, "px");
|
|
5702
|
+
} else {
|
|
5703
|
+
menu.style.top = "".concat(pt + ph, "px");
|
|
5704
|
+
}
|
|
5705
|
+
if (menuWrapperRef === null || menuWrapperRef === void 0 ? void 0 : menuWrapperRef.current) {
|
|
5706
|
+
menuWrapperRef.current.style.display = 'block';
|
|
5707
|
+
}
|
|
5708
|
+
}
|
|
5709
|
+
}, [width]);
|
|
5710
|
+
// }, [horizonMenu]);
|
|
5711
|
+
var handleWrapperClick = function handleWrapperClick(e) {
|
|
5712
|
+
e.stopPropagation();
|
|
5713
|
+
closeMenu();
|
|
5714
|
+
};
|
|
5715
|
+
var handleMenuItemClick = function handleMenuItemClick(id) {
|
|
5716
|
+
return function () {
|
|
5717
|
+
onSelect(id);
|
|
5718
|
+
closeMenu();
|
|
5719
|
+
};
|
|
5720
|
+
};
|
|
5721
|
+
// TODO:
|
|
5722
|
+
// const handleMenuBottomButtonClick = (
|
|
5723
|
+
// e: React.MouseEvent<HTMLButtonElement>,
|
|
5724
|
+
// ) => {
|
|
5725
|
+
// e.preventDefault();
|
|
5726
|
+
// e.stopPropagation();
|
|
5727
|
+
// menuBottomButton?.onClick?.();
|
|
5728
|
+
// closeMenu();
|
|
5729
|
+
// };
|
|
5730
|
+
return jsx("div", __assign({
|
|
5731
|
+
ref: menuWrapperRef,
|
|
5732
|
+
className: "maru-dropdown-menu-wrapper",
|
|
5733
|
+
"aria-hidden": true,
|
|
5734
|
+
onClick: handleWrapperClick
|
|
5735
|
+
}, {
|
|
5736
|
+
children: jsx("div", __assign({
|
|
5737
|
+
ref: menuRef,
|
|
5738
|
+
className: classNames('maru-dropdown-menu', {
|
|
5739
|
+
// TODO:
|
|
5740
|
+
// footer: menuBottomButton,
|
|
5741
|
+
})
|
|
5742
|
+
}, {
|
|
5743
|
+
children: jsx("div", __assign({
|
|
5744
|
+
className: classNames('maru-dropdown-menu-item-wrapper', {
|
|
5745
|
+
// TODO:
|
|
5746
|
+
// horizon: horizonMenu,
|
|
5747
|
+
}),
|
|
5748
|
+
style: {
|
|
5749
|
+
maxHeight: height ? "".concat(height, "px") : 'auto'
|
|
5750
|
+
}
|
|
5751
|
+
}, {
|
|
5752
|
+
children: filteredData.length > 0 ? filteredData.map(function (item) {
|
|
5753
|
+
return jsx("button", __assign({
|
|
5754
|
+
type: "button",
|
|
5755
|
+
className: classNames('maru-dropdown-menu-item', {
|
|
5756
|
+
'maru-dropdown-menu-item-selected': item[idKey] === selectedId
|
|
5757
|
+
}),
|
|
5758
|
+
value: item[idKey],
|
|
5759
|
+
onClick: handleMenuItemClick(item[idKey]),
|
|
5760
|
+
ref: function ref(el) {
|
|
5761
|
+
if (el) {
|
|
5762
|
+
menuItemEls.push(el);
|
|
5763
|
+
}
|
|
5764
|
+
},
|
|
5765
|
+
tabIndex: -1
|
|
5766
|
+
}, {
|
|
5767
|
+
children: CustomMenuItem ? jsx(CustomMenuItem, __assign({
|
|
5768
|
+
rowId: item[idKey]
|
|
5769
|
+
}, {
|
|
5770
|
+
children: jsx("span", {
|
|
5771
|
+
className: "maru-dropdown-menu-item-span",
|
|
5772
|
+
dangerouslySetInnerHTML: {
|
|
5773
|
+
__html: item[displayKey]
|
|
5774
|
+
}
|
|
5775
|
+
})
|
|
5776
|
+
})) : jsx("span", {
|
|
5777
|
+
className: "maru-dropdown-menu-item-span",
|
|
5778
|
+
dangerouslySetInnerHTML: {
|
|
5779
|
+
__html: item[displayKey]
|
|
5780
|
+
}
|
|
5781
|
+
})
|
|
5782
|
+
}), "maru-dropdown-menu-item-".concat(item[idKey]));
|
|
5783
|
+
}) : jsx("div", __assign({
|
|
5784
|
+
className: "maru-dropdown-menu-no-data"
|
|
5785
|
+
}, {
|
|
5786
|
+
children: jsx("span", {
|
|
5787
|
+
children: noMessage
|
|
5788
|
+
})
|
|
5789
|
+
}))
|
|
5790
|
+
}))
|
|
5791
|
+
}))
|
|
5792
|
+
}));
|
|
5793
|
+
}
|
|
5794
|
+
|
|
5795
|
+
var css_248z$2 = ".maru-dropdown .maru-dropdown-label {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 600;\n color: #5c5c5c;\n display: block;\n margin-bottom: 4px;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper {\n width: 100%;\n border-radius: 8px;\n border: 1px solid #e4e4e4;\n cursor: pointer;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:hover {\n border: 1px solid var(--p);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:hover .maru-dropdown-input > input {\n color: var(--p);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:focus-within {\n border: 1px solid var(--p);\n outline: none;\n background-color: var(--p-10);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-primary:focus-within .maru-dropdown-input > input {\n color: var(--p);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:hover {\n border: 1px solid #8c8c8c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:hover .maru-dropdown-input > input {\n color: #8c8c8c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:focus-within {\n border: 1px solid #8c8c8c;\n outline: none;\n background-color: #fafafa;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-secondary:focus-within .maru-dropdown-input > input {\n color: #8c8c8c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:hover {\n border: 1px solid #58c5a6;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:hover .maru-dropdown-input > input {\n color: #58c5a6;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:focus-within {\n border: 1px solid #58c5a6;\n outline: none;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-positive:focus-within .maru-dropdown-input > input {\n color: #58c5a6;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:hover {\n border: 1px solid #ffb020;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:hover .maru-dropdown-input > input {\n color: #ffb020;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:focus-within {\n border: 1px solid #ffb020;\n outline: none;\n background-color: #fff7e9;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-warning:focus-within .maru-dropdown-input > input {\n color: #ffb020;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:hover {\n border: 1px solid #e53e3e;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:hover .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:hover .maru-dropdown-input > input {\n color: #e53e3e;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:active, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:focus-within {\n border: 1px solid #e53e3e;\n outline: none;\n background-color: #fcecec;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:active .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:active .maru-dropdown-input > input, .maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:focus-within .maru-dropdown-button,\n.maru-dropdown .maru-dropdown-toggle-wrapper.maru-dropdown-toggle-wrapper-danger:focus-within .maru-dropdown-input > input {\n color: #e53e3e;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.inline-label-wrapper .maru-dropdown-button {\n padding: 2px 10px 2px 14px;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .inline-label {\n display: block;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 10px;\n letter-spacing: -0.4px;\n font-weight: 500;\n color: #bdbdbd;\n padding: 2px 10px 0 14px;\n transform: translateY(3px);\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-button {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n width: 100%;\n height: 37px;\n border: unset;\n border-radius: 8px;\n background-color: transparent;\n cursor: pointer;\n padding: 8px 10px 8px 14px;\n color: #5c5c5c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-button .maru-dropdown-button-contents {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-button .maru-dropdown-button-contents.placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n width: 100%;\n height: 37px;\n border: unset;\n border-radius: 8px;\n background-color: transparent;\n cursor: pointer;\n padding: 8px 10px 8px 14px;\n color: #5c5c5c;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input {\n width: 100%;\n height: 100%;\n border: unset;\n outline: unset;\n background-color: unset;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input::-webkit-input-placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input::-moz-placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input:-ms-input-placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input::-ms-input-placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-input > input::placeholder {\n color: #bdbdbd;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper .maru-dropdown-toggle-arrow {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-dropdown .maru-dropdown-toggle-wrapper.errored {\n border: 2px solid #e53e3e;\n}\n.maru-dropdown .maru-dropdown-error-message {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 12px;\n letter-spacing: -0.48px;\n font-weight: 500;\n color: #e53e3e;\n display: block;\n margin-top: 4px;\n}\n\n.maru-dropdown-menu-wrapper {\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n position: fixed;\n z-index: 1600;\n display: none;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu {\n margin-top: 4px;\n position: absolute;\n z-index: 1601;\n border-radius: 8px;\n box-shadow: 0px 0px 6px #e4e4e4;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper {\n overflow-y: auto;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n border-bottom-left-radius: 8px;\n border-bottom-right-radius: 8px;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n width: 100%;\n background-color: white;\n border: unset;\n cursor: pointer;\n height: 37px;\n padding: 8px 14px;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 500;\n color: #5c5c5c;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item-selected, .maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item:hover {\n background-color: #fafafa;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item-span {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 1;\n text-align: start;\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-item-span em {\n font-style: unset;\n background-color: var(--p-20-per);\n}\n.maru-dropdown-menu-wrapper .maru-dropdown-menu .maru-dropdown-menu-item-wrapper .maru-dropdown-menu-no-data {\n background-color: transparent;\n border: unset;\n}";
|
|
5796
|
+
styleInject(css_248z$2);
|
|
5797
|
+
|
|
5798
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
5799
|
+
function Dropdown(_a) {
|
|
5800
|
+
var data = _a.data,
|
|
5801
|
+
selectedId = _a.selectedId,
|
|
5802
|
+
onSelect = _a.onSelect,
|
|
5803
|
+
idKey = _a.idKey,
|
|
5804
|
+
displayKey = _a.displayKey,
|
|
5805
|
+
anchorEl = _a.anchorEl,
|
|
5806
|
+
className = _a.className,
|
|
5807
|
+
_b = _a.color,
|
|
5808
|
+
color = _b === void 0 ? 'primary' : _b,
|
|
5809
|
+
customButton = _a.customButton,
|
|
5810
|
+
customMenuItem = _a.customMenuItem,
|
|
5811
|
+
disabled = _a.disabled,
|
|
5812
|
+
errorMessage = _a.errorMessage,
|
|
5813
|
+
inlineLabel = _a.inlineLabel,
|
|
5814
|
+
label = _a.label,
|
|
5815
|
+
noDataMessage = _a.noDataMessage,
|
|
5816
|
+
noSearchedMessage = _a.noSearchedMessage,
|
|
5817
|
+
onClear = _a.onClear,
|
|
5818
|
+
placeholder = _a.placeholder,
|
|
5819
|
+
startArrow = _a.startArrow,
|
|
5820
|
+
toggleEndNode = _a.toggleEndNode,
|
|
5821
|
+
_c = _a.type,
|
|
5822
|
+
type = _c === void 0 ? 'button' : _c,
|
|
5823
|
+
width = _a.width,
|
|
5824
|
+
height = _a.height;
|
|
5825
|
+
var _d = useState(false),
|
|
5826
|
+
open = _d[0],
|
|
5827
|
+
setOpen = _d[1];
|
|
5828
|
+
var _e = useState(data),
|
|
5829
|
+
filteredData = _e[0],
|
|
5830
|
+
setFilteredData = _e[1];
|
|
5831
|
+
var _f = useState(''),
|
|
5832
|
+
inputValue = _f[0],
|
|
5833
|
+
setInputValue = _f[1];
|
|
5834
|
+
var _g = useState([]),
|
|
5835
|
+
menuItemEls = _g[0],
|
|
5836
|
+
setMenuItemEls = _g[1];
|
|
5837
|
+
var wrapperRef = useRef(null);
|
|
5838
|
+
var selected = useMemo(function () {
|
|
5839
|
+
return data.find(function (d) {
|
|
5840
|
+
return d[idKey] === selectedId;
|
|
5841
|
+
});
|
|
5842
|
+
}, [data, idKey, selectedId]);
|
|
5843
|
+
var initFilteredData = function initFilteredData() {
|
|
5844
|
+
return setFilteredData(data);
|
|
5845
|
+
};
|
|
5846
|
+
var toggleMenuOpen = function toggleMenuOpen() {
|
|
5847
|
+
return setOpen(function (prev) {
|
|
5848
|
+
return !prev;
|
|
5849
|
+
});
|
|
5850
|
+
};
|
|
5851
|
+
var initInputValue = function initInputValue() {
|
|
5852
|
+
return setInputValue('');
|
|
5853
|
+
};
|
|
5854
|
+
var clearSelected = function clearSelected() {
|
|
5855
|
+
return onSelect(undefined);
|
|
5856
|
+
};
|
|
5857
|
+
var closeMenu = function closeMenu() {
|
|
5858
|
+
setOpen(false);
|
|
5859
|
+
initFilteredData();
|
|
5860
|
+
initInputValue();
|
|
5861
|
+
};
|
|
5862
|
+
useEffect(function () {
|
|
5863
|
+
if (selected === null || selected === void 0 ? void 0 : selected[displayKey]) {
|
|
5864
|
+
setInputValue(selected[displayKey]);
|
|
5865
|
+
}
|
|
5866
|
+
}, [selected]);
|
|
5867
|
+
// type=input 일때, inputValue 변경 시(사용자가 타이핑) 메뉴 아이템 파싱하여 표시하기 위한 useEffect
|
|
5868
|
+
useEffect(function () {
|
|
5869
|
+
var pretreatedQeury = noSpace(inputValue).toLowerCase();
|
|
5870
|
+
if (pretreatedQeury !== '') {
|
|
5871
|
+
setFilteredData(setHighlightTextOnDataExceptSpace(data, displayKey, pretreatedQeury));
|
|
5872
|
+
} else {
|
|
5873
|
+
initFilteredData();
|
|
5874
|
+
}
|
|
5875
|
+
}, [inputValue]);
|
|
5876
|
+
var handleInputChange = function handleInputChange(e) {
|
|
5877
|
+
setInputValue(e.currentTarget.value);
|
|
5878
|
+
};
|
|
5879
|
+
var handleToggleKeyDown = function handleToggleKeyDown(e) {
|
|
5880
|
+
var _a;
|
|
5881
|
+
setMenuItemEls([]);
|
|
5882
|
+
if (e.key === 'Tab' || e.key === 'Escape') {
|
|
5883
|
+
setOpen(false);
|
|
5884
|
+
return;
|
|
5885
|
+
}
|
|
5886
|
+
var CN_SELECTED_MENU_ITEM = 'maru-dropdown-menu-item-selected';
|
|
5887
|
+
if (!!data.length && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
|
|
5888
|
+
var scrollMenu_1 = function scrollMenu_1(idx) {
|
|
5889
|
+
menuItemEls[idx].classList.add(CN_SELECTED_MENU_ITEM);
|
|
5890
|
+
menuItemEls[idx].scrollIntoView({
|
|
5891
|
+
behavior: 'smooth',
|
|
5892
|
+
block: 'center'
|
|
5893
|
+
});
|
|
5894
|
+
};
|
|
5895
|
+
if (open) {
|
|
5896
|
+
if (!menuItemEls.some(function (ref, idx) {
|
|
5897
|
+
if (ref.className.includes(CN_SELECTED_MENU_ITEM)) {
|
|
5898
|
+
ref.classList.remove(CN_SELECTED_MENU_ITEM);
|
|
5899
|
+
if (e.key === 'ArrowDown' && idx !== menuItemEls.length - 1) {
|
|
5900
|
+
scrollMenu_1(idx + 1);
|
|
5901
|
+
}
|
|
5902
|
+
if (e.key === 'ArrowUp' && idx > 0) {
|
|
5903
|
+
scrollMenu_1(idx - 1);
|
|
5904
|
+
}
|
|
5905
|
+
return true;
|
|
5906
|
+
}
|
|
5907
|
+
return false;
|
|
5908
|
+
})) {
|
|
5909
|
+
if (e.key === 'ArrowDown') {
|
|
5910
|
+
scrollMenu_1(0);
|
|
5911
|
+
} else {
|
|
5912
|
+
scrollMenu_1(menuItemEls.length - 1);
|
|
5913
|
+
}
|
|
5914
|
+
}
|
|
5915
|
+
} else {
|
|
5916
|
+
setOpen(true);
|
|
5917
|
+
}
|
|
5918
|
+
e.preventDefault();
|
|
5919
|
+
}
|
|
5920
|
+
if (e.key === 'Enter') {
|
|
5921
|
+
if (open) {
|
|
5922
|
+
var activeValue = (_a = menuItemEls.find(function (ref) {
|
|
5923
|
+
return ref.className.includes(CN_SELECTED_MENU_ITEM);
|
|
5924
|
+
})) === null || _a === void 0 ? void 0 : _a.value;
|
|
5925
|
+
if (activeValue !== undefined) {
|
|
5926
|
+
onSelect(activeValue);
|
|
5927
|
+
closeMenu();
|
|
5928
|
+
}
|
|
5929
|
+
} else {
|
|
5930
|
+
setOpen(true);
|
|
5931
|
+
}
|
|
5932
|
+
e.preventDefault();
|
|
5933
|
+
}
|
|
5934
|
+
};
|
|
5935
|
+
return jsxs("div", __assign({
|
|
5936
|
+
ref: wrapperRef,
|
|
5937
|
+
className: classNames('maru-dropdown', className)
|
|
5938
|
+
}, {
|
|
5939
|
+
children: [label && jsx("label", __assign({
|
|
5940
|
+
className: "maru-dropdown-label"
|
|
5941
|
+
}, {
|
|
5942
|
+
children: label
|
|
5943
|
+
})), type === 'button' ? jsx(DropdownToggleButton, {
|
|
5944
|
+
open: open,
|
|
5945
|
+
selected: selected,
|
|
5946
|
+
displayKey: displayKey,
|
|
5947
|
+
color: color,
|
|
5948
|
+
width: width,
|
|
5949
|
+
disabled: disabled,
|
|
5950
|
+
placeholder: placeholder,
|
|
5951
|
+
errored: errorMessage != null,
|
|
5952
|
+
inlineLabel: inlineLabel,
|
|
5953
|
+
startArrow: startArrow,
|
|
5954
|
+
toggleEndNode: toggleEndNode,
|
|
5955
|
+
customButton: customButton,
|
|
5956
|
+
initFilteredData: initFilteredData,
|
|
5957
|
+
toggleMenuOpen: toggleMenuOpen,
|
|
5958
|
+
initInputValue: initInputValue,
|
|
5959
|
+
clearSelected: clearSelected,
|
|
5960
|
+
onClear: onClear,
|
|
5961
|
+
onKeyDown: handleToggleKeyDown
|
|
5962
|
+
}) : jsx(DropdownToggleInput, {
|
|
5963
|
+
open: open,
|
|
5964
|
+
value: inputValue,
|
|
5965
|
+
selected: selected,
|
|
5966
|
+
color: color,
|
|
5967
|
+
width: width,
|
|
5968
|
+
disabled: disabled,
|
|
5969
|
+
placeholder: placeholder,
|
|
5970
|
+
errored: errorMessage != null,
|
|
5971
|
+
inlineLabel: inlineLabel,
|
|
5972
|
+
startArrow: startArrow,
|
|
5973
|
+
toggleEndNode: toggleEndNode,
|
|
5974
|
+
onChange: handleInputChange,
|
|
5975
|
+
initFilteredData: initFilteredData,
|
|
5976
|
+
toggleMenuOpen: toggleMenuOpen,
|
|
5977
|
+
initInputValue: initInputValue,
|
|
5978
|
+
clearSelected: clearSelected,
|
|
5979
|
+
onClear: onClear,
|
|
5980
|
+
onKeyDown: handleToggleKeyDown
|
|
5981
|
+
}), errorMessage && jsx("span", __assign({
|
|
5982
|
+
className: "maru-dropdown-error-message"
|
|
5983
|
+
}, {
|
|
5984
|
+
children: errorMessage
|
|
5985
|
+
})), open && jsx(CreatePortal, __assign({
|
|
5986
|
+
parent: anchorEl || wrapperRef.current
|
|
5987
|
+
}, {
|
|
5988
|
+
children: jsx(DropdownMenu, {
|
|
5989
|
+
parent: anchorEl || wrapperRef.current,
|
|
5990
|
+
menuItemEls: menuItemEls,
|
|
5991
|
+
selectedId: selectedId,
|
|
5992
|
+
idKey: idKey,
|
|
5993
|
+
displayKey: displayKey,
|
|
5994
|
+
filteredData: filteredData,
|
|
5995
|
+
width: width,
|
|
5996
|
+
height: height,
|
|
5997
|
+
noMessage: type === 'button' ? noDataMessage : noSearchedMessage,
|
|
5998
|
+
customMenuItem: customMenuItem,
|
|
5999
|
+
onSelect: onSelect,
|
|
6000
|
+
closeMenu: closeMenu
|
|
6001
|
+
})
|
|
6002
|
+
}))]
|
|
6003
|
+
}));
|
|
6004
|
+
}
|
|
6005
|
+
|
|
6006
|
+
var css_248z$1 = ".maru-modal-wrapper {\n width: 100vw;\n height: 100vh;\n position: fixed;\n top: 0;\n left: 0;\n background-color: rgba(92, 92, 92, 0.5019607843);\n z-index: 6006;\n display: block;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-modal-wrapper .maru-modal {\n background-color: white;\n padding: 40px;\n border-radius: 20px;\n box-shadow: 0px 5px 20px 5px #8c8c8c;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-xs {\n width: 300px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-s {\n width: 400px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-m {\n width: 550px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-m .maru-modal-header {\n padding-bottom: 8px;\n border-bottom: 1px solid #e4e4e4;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-l {\n width: 860px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-l .maru-modal-header {\n padding-bottom: 8px;\n border-bottom: 1px solid #e4e4e4;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-xl {\n width: 1160px;\n}\n.maru-modal-wrapper .maru-modal.maru-modal-xl .maru-modal-header {\n padding-bottom: 8px;\n border-bottom: 1px solid #e4e4e4;\n}\n.maru-modal-wrapper .maru-modal .maru-modal-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n margin-bottom: 24px;\n}\n.maru-modal-wrapper .maru-modal .maru-modal-header > h1 {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 16px;\n letter-spacing: -0.64px;\n font-weight: 700;\n color: #5c5c5c;\n}\n.maru-modal-wrapper .maru-modal .maru-modal-footer {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n flex-direction: row;\n margin-top: 24px;\n}\n.maru-modal-wrapper .maru-modal .maru-modal-footer button {\n margin: 0 0 0 8px;\n}";
|
|
6007
|
+
styleInject(css_248z$1);
|
|
6008
|
+
|
|
6009
|
+
function Modal(_a) {
|
|
6010
|
+
var children = _a.children,
|
|
6011
|
+
onClose = _a.onClose,
|
|
6012
|
+
open = _a.open,
|
|
6013
|
+
_b = _a.backdrop,
|
|
6014
|
+
backdrop = _b === void 0 ? true : _b,
|
|
6015
|
+
cancelButton = _a.cancelButton,
|
|
6016
|
+
className = _a.className,
|
|
6017
|
+
disabledEnter = _a.disabledEnter,
|
|
6018
|
+
hiddenCloseButton = _a.hiddenCloseButton,
|
|
6019
|
+
okButton = _a.okButton,
|
|
6020
|
+
_c = _a.size,
|
|
6021
|
+
size = _c === void 0 ? 's' : _c,
|
|
6022
|
+
title = _a.title;
|
|
6023
|
+
var wrapperRef = useRef(null);
|
|
6024
|
+
useEffect(function () {
|
|
6025
|
+
if (open) {
|
|
6026
|
+
if (wrapperRef.current) {
|
|
6027
|
+
wrapperRef.current.focus();
|
|
6028
|
+
}
|
|
6029
|
+
}
|
|
6030
|
+
}, [open]);
|
|
6031
|
+
var handleWrapperClick = function handleWrapperClick() {
|
|
6032
|
+
if (backdrop) {
|
|
6033
|
+
onClose();
|
|
6034
|
+
}
|
|
6035
|
+
};
|
|
6036
|
+
var handleWrapperKeyDown = function handleWrapperKeyDown(e) {
|
|
6037
|
+
var _a;
|
|
6038
|
+
if (e.key === 'Escape') {
|
|
6039
|
+
onClose();
|
|
6040
|
+
}
|
|
6041
|
+
if (!disabledEnter && e.key === 'Enter') {
|
|
6042
|
+
(_a = okButton === null || okButton === void 0 ? void 0 : okButton.onClick) === null || _a === void 0 ? void 0 : _a.call(okButton);
|
|
6043
|
+
}
|
|
6044
|
+
};
|
|
6045
|
+
var handleClose = function handleClose() {
|
|
6046
|
+
onClose();
|
|
6047
|
+
};
|
|
6048
|
+
var handleModalClick = function handleModalClick(e) {
|
|
6049
|
+
e.stopPropagation();
|
|
6050
|
+
};
|
|
6051
|
+
var handleFooterKeyDown = function handleFooterKeyDown(e) {
|
|
6052
|
+
e.stopPropagation();
|
|
6053
|
+
};
|
|
6054
|
+
// FIXME: 취소에서 탭 > 엔터하면 confirm 동작. 확인 필요
|
|
6055
|
+
var handleOkButtonClick = function handleOkButtonClick() {
|
|
6056
|
+
var _a;
|
|
6057
|
+
(_a = okButton === null || okButton === void 0 ? void 0 : okButton.onClick) === null || _a === void 0 ? void 0 : _a.call(okButton);
|
|
6058
|
+
};
|
|
6059
|
+
return jsx(CreatePortal, __assign({
|
|
6060
|
+
parent: document.body
|
|
6061
|
+
}, {
|
|
6062
|
+
children: open && jsx("div", __assign({
|
|
6063
|
+
ref: wrapperRef,
|
|
6064
|
+
className: "maru-modal-wrapper",
|
|
6065
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
6066
|
+
tabIndex: 0,
|
|
6067
|
+
onClick: handleWrapperClick,
|
|
6068
|
+
onKeyDown: handleWrapperKeyDown,
|
|
6069
|
+
role: "presentation"
|
|
6070
|
+
}, {
|
|
6071
|
+
children: jsxs("div", __assign({
|
|
6072
|
+
className: classNames('maru-modal', "maru-modal-".concat(size), className),
|
|
6073
|
+
onClick: handleModalClick,
|
|
6074
|
+
role: "dialog",
|
|
6075
|
+
"aria-modal": true,
|
|
6076
|
+
"aria-hidden": true
|
|
6077
|
+
}, {
|
|
6078
|
+
children: [(title || !hiddenCloseButton) && jsxs("header", __assign({
|
|
6079
|
+
className: "maru-modal-header"
|
|
6080
|
+
}, {
|
|
6081
|
+
children: [title && jsx("h1", {
|
|
6082
|
+
children: title
|
|
6083
|
+
}), !hiddenCloseButton && jsx(Button, {
|
|
6084
|
+
startIcon: {
|
|
6085
|
+
name: ICONS.XLarge,
|
|
6086
|
+
size: 20,
|
|
6087
|
+
color: '#5c5c5c'
|
|
6088
|
+
},
|
|
6089
|
+
color: "secondary",
|
|
6090
|
+
onClick: handleClose
|
|
6091
|
+
})]
|
|
6092
|
+
})), jsx("main", __assign({
|
|
6093
|
+
className: "maru-modal-body"
|
|
6094
|
+
}, {
|
|
6095
|
+
children: children
|
|
6096
|
+
})), (cancelButton || okButton) && jsxs("footer", __assign({
|
|
6097
|
+
className: "maru-modal-footer"
|
|
6098
|
+
}, {
|
|
6099
|
+
children: [cancelButton && jsx(Button, __assign({
|
|
6100
|
+
color: "secondary",
|
|
6101
|
+
onClick: handleClose,
|
|
6102
|
+
onKeyDown: handleFooterKeyDown,
|
|
6103
|
+
disabled: cancelButton.disabled
|
|
6104
|
+
}, {
|
|
6105
|
+
children: cancelButton.content
|
|
6106
|
+
})), okButton &&
|
|
6107
|
+
// FIXME: 이게 맞아..?
|
|
6108
|
+
jsx(StyleProvider, __assign({
|
|
6109
|
+
theme: "blue"
|
|
6110
|
+
}, {
|
|
6111
|
+
children: jsx(Button, __assign({
|
|
6112
|
+
color: okButton.color || 'primary',
|
|
6113
|
+
onClick: handleOkButtonClick,
|
|
6114
|
+
onKeyDown: handleFooterKeyDown,
|
|
6115
|
+
disabled: okButton.disabled
|
|
6116
|
+
}, {
|
|
6117
|
+
children: okButton.content
|
|
6118
|
+
}))
|
|
6119
|
+
}))]
|
|
6120
|
+
}))]
|
|
6121
|
+
}))
|
|
6122
|
+
}))
|
|
6123
|
+
}));
|
|
6124
|
+
}
|
|
6125
|
+
|
|
6126
|
+
var css_248z = ".maru-pagination-wrapper .maru-pagination {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-pagination-wrapper .maru-pagination button {\n cursor: pointer;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 12px;\n letter-spacing: -0.48px;\n font-weight: 500;\n color: #8c8c8c;\n padding: unset;\n margin: unset;\n background-color: unset;\n border: unset;\n min-width: 30px;\n min-height: 30px;\n border-radius: 6px;\n}\n.maru-pagination-wrapper .maru-pagination button > span {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-pagination-wrapper .maru-pagination button:hover {\n background-color: #e4e4e4;\n font-weight: 700;\n}\n.maru-pagination-wrapper .maru-pagination button:disabled {\n cursor: default;\n}\n.maru-pagination-wrapper .maru-pagination .maru-pagination-default-wrapper {\n display: flex;\n justify-content: space-evenly;\n align-items: center;\n flex-direction: row;\n flex: 1;\n}\n.maru-pagination-wrapper .maru-pagination .maru-pagination-default-wrapper .maru-pagination-page-button {\n line-height: 140%;\n padding: 6px 12px;\n}\n.maru-pagination-wrapper .maru-pagination .maru-pagination-default-wrapper .maru-pagination-page-button.selected {\n font-weight: 700;\n color: white;\n background-color: #bdbdbd;\n}\n.maru-pagination-wrapper .maru-pagination .maru-pagination-input-wrapper .maru-pagination-input {\n border: 1px solid #e4e4e4;\n border-radius: 6px;\n padding: 2px 20px;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 12px;\n letter-spacing: -0.48px;\n font-weight: 700;\n margin: 0 8px;\n color: #5c5c5c;\n text-align: center;\n}\n.maru-pagination-wrapper .maru-pagination .maru-pagination-input-wrapper .maru-pagination-input::-webkit-outer-spin-button, .maru-pagination-wrapper .maru-pagination .maru-pagination-input-wrapper .maru-pagination-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n.maru-pagination-wrapper .maru-pagination .maru-pagination-input-wrapper .maru-pagination-input:disabled {\n pointer-events: none;\n border: none;\n background-color: transparent;\n width: auto;\n margin-right: 0;\n padding: 0;\n}\n.maru-pagination-wrapper .maru-pagination .maru-pagination-input-wrapper > span {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 12px;\n letter-spacing: -0.48px;\n font-weight: 500;\n color: #8c8c8c;\n}";
|
|
6127
|
+
styleInject(css_248z);
|
|
6128
|
+
|
|
6129
|
+
function Pagination(_a) {
|
|
6130
|
+
var page = _a.page,
|
|
6131
|
+
onPageChange = _a.onPageChange,
|
|
6132
|
+
totalPage = _a.totalPage,
|
|
6133
|
+
className = _a.className,
|
|
6134
|
+
_b = _a.buttonVisibility,
|
|
6135
|
+
buttonVisibility = _b === void 0 ? 'visible' : _b,
|
|
6136
|
+
_c = _a.type,
|
|
6137
|
+
type = _c === void 0 ? 'button' : _c;
|
|
6138
|
+
var _d = useState(false),
|
|
6139
|
+
prevDisabled = _d[0],
|
|
6140
|
+
setPrevDisabled = _d[1];
|
|
6141
|
+
var _e = useState(false),
|
|
6142
|
+
nextDisabled = _e[0],
|
|
6143
|
+
setNextDisabled = _e[1];
|
|
6144
|
+
var _f = useState(-1),
|
|
6145
|
+
inputValue = _f[0],
|
|
6146
|
+
setInputValue = _f[1];
|
|
6147
|
+
var prevVisibility = useMemo(function () {
|
|
6148
|
+
if (totalPage > 1 && !prevDisabled) {
|
|
6149
|
+
return 'visible';
|
|
6150
|
+
}
|
|
6151
|
+
if (buttonVisibility === 'hidden') {
|
|
6152
|
+
return 'hidden';
|
|
6153
|
+
}
|
|
6154
|
+
return undefined;
|
|
6155
|
+
}, [totalPage, prevDisabled, buttonVisibility]);
|
|
6156
|
+
var nextVisibility = useMemo(function () {
|
|
6157
|
+
if (totalPage > 1 && !nextDisabled) {
|
|
6158
|
+
return 'visible';
|
|
6159
|
+
}
|
|
6160
|
+
if (buttonVisibility === 'hidden') {
|
|
6161
|
+
return 'hidden';
|
|
6162
|
+
}
|
|
6163
|
+
return undefined;
|
|
6164
|
+
}, [totalPage, nextDisabled, buttonVisibility]);
|
|
6165
|
+
var defaultRange = useMemo(function () {
|
|
6166
|
+
var pageRange = [];
|
|
6167
|
+
var start = Math.floor((page - 1) / 10) * 10;
|
|
6168
|
+
for (var i = 1; i <= 10; i += 1) {
|
|
6169
|
+
if (start + i <= totalPage) {
|
|
6170
|
+
pageRange.push(start + i);
|
|
6171
|
+
}
|
|
6172
|
+
}
|
|
6173
|
+
return pageRange;
|
|
6174
|
+
}, [page, totalPage]);
|
|
6175
|
+
var checkPage = function checkPage(p) {
|
|
6176
|
+
var checkedPage = p;
|
|
6177
|
+
if (p > totalPage) {
|
|
6178
|
+
checkedPage = totalPage;
|
|
6179
|
+
} else if (p < 1) {
|
|
6180
|
+
checkedPage = 1;
|
|
6181
|
+
}
|
|
6182
|
+
return checkedPage;
|
|
6183
|
+
};
|
|
6184
|
+
var disabledCheck = function disabledCheck(p, total) {
|
|
6185
|
+
setPrevDisabled(total === 1 || p === 1);
|
|
6186
|
+
setNextDisabled(total === 1 || p === total);
|
|
6187
|
+
};
|
|
6188
|
+
var setPageAndCheckDisabled = function setPageAndCheckDisabled(p) {
|
|
6189
|
+
if (totalPage) {
|
|
6190
|
+
onPageChange(p);
|
|
6191
|
+
disabledCheck(p, totalPage);
|
|
6192
|
+
if (type === 'input') {
|
|
6193
|
+
setInputValue(p);
|
|
6194
|
+
}
|
|
6195
|
+
}
|
|
6196
|
+
};
|
|
6197
|
+
useEffect(function () {
|
|
6198
|
+
disabledCheck(page, totalPage);
|
|
6199
|
+
if (type === 'input') {
|
|
6200
|
+
setInputValue(page);
|
|
6201
|
+
}
|
|
6202
|
+
}, [page, totalPage, type]);
|
|
6203
|
+
var handlePrevClick = function handlePrevClick(all) {
|
|
6204
|
+
return function () {
|
|
6205
|
+
if (all) {
|
|
6206
|
+
setPageAndCheckDisabled(1);
|
|
6207
|
+
} else {
|
|
6208
|
+
setPageAndCheckDisabled(page - 1);
|
|
6209
|
+
}
|
|
6210
|
+
};
|
|
6211
|
+
};
|
|
6212
|
+
var handleNextClick = function handleNextClick(all) {
|
|
6213
|
+
return function () {
|
|
6214
|
+
if (all) {
|
|
6215
|
+
setPageAndCheckDisabled(totalPage);
|
|
6216
|
+
} else {
|
|
6217
|
+
setPageAndCheckDisabled(page + 1);
|
|
6218
|
+
}
|
|
6219
|
+
};
|
|
6220
|
+
};
|
|
6221
|
+
var handlePageClick = function handlePageClick(p) {
|
|
6222
|
+
return function () {
|
|
6223
|
+
setPageAndCheckDisabled(p);
|
|
6224
|
+
};
|
|
6225
|
+
};
|
|
6226
|
+
var handleEnterKeyUp = function handleEnterKeyUp(e) {
|
|
6227
|
+
if (e.key === 'Enter') {
|
|
6228
|
+
var newValue = checkPage(+e.currentTarget.value);
|
|
6229
|
+
setPageAndCheckDisabled(newValue);
|
|
6230
|
+
}
|
|
6231
|
+
};
|
|
6232
|
+
var handleBlur = function handleBlur(e) {
|
|
6233
|
+
var newValue = checkPage(+e.currentTarget.value);
|
|
6234
|
+
setPageAndCheckDisabled(newValue);
|
|
6235
|
+
};
|
|
6236
|
+
var handleInputChange = function handleInputChange(e) {
|
|
6237
|
+
setInputValue(+e.currentTarget.value);
|
|
6238
|
+
};
|
|
6239
|
+
return jsx("div", __assign({
|
|
6240
|
+
className: classNames('maru-pagination-wrapper', className)
|
|
6241
|
+
}, {
|
|
6242
|
+
children: jsxs("div", __assign({
|
|
6243
|
+
className: "maru-pagination"
|
|
6244
|
+
}, {
|
|
6245
|
+
children: [jsx("button", __assign({
|
|
6246
|
+
className: "maru-pagination-prev-all",
|
|
6247
|
+
type: "button",
|
|
6248
|
+
style: {
|
|
6249
|
+
display: !prevVisibility ? 'none' : 'block',
|
|
6250
|
+
visibility: prevVisibility
|
|
6251
|
+
},
|
|
6252
|
+
onClick: handlePrevClick(true)
|
|
6253
|
+
}, {
|
|
6254
|
+
children: jsx("span", {
|
|
6255
|
+
children: jsx(Icon, {
|
|
6256
|
+
name: ICONS.ChevronLeftDoubleThin,
|
|
6257
|
+
color: "#bdbdbd",
|
|
6258
|
+
size: 16
|
|
6259
|
+
})
|
|
6260
|
+
})
|
|
6261
|
+
})), jsx("button", __assign({
|
|
6262
|
+
className: "maru-pagination-prev",
|
|
6263
|
+
type: "button",
|
|
6264
|
+
style: {
|
|
6265
|
+
display: !prevVisibility ? 'none' : 'block',
|
|
6266
|
+
visibility: prevVisibility
|
|
6267
|
+
},
|
|
6268
|
+
onClick: handlePrevClick(false)
|
|
6269
|
+
}, {
|
|
6270
|
+
children: jsx("span", {
|
|
6271
|
+
children: jsx(Icon, {
|
|
6272
|
+
name: ICONS.ChevronLeft,
|
|
6273
|
+
color: "#bdbdbd",
|
|
6274
|
+
size: 16
|
|
6275
|
+
})
|
|
6276
|
+
})
|
|
6277
|
+
})), type === 'button' ? jsx("div", __assign({
|
|
6278
|
+
className: "maru-pagination-default-wrapper"
|
|
6279
|
+
}, {
|
|
6280
|
+
children: defaultRange.map(function (p) {
|
|
6281
|
+
return jsx("button", __assign({
|
|
6282
|
+
type: "button",
|
|
6283
|
+
className: classNames('maru-pagination-page-button', {
|
|
6284
|
+
selected: page === p
|
|
6285
|
+
}),
|
|
6286
|
+
disabled: totalPage === 1,
|
|
6287
|
+
onClick: handlePageClick(p)
|
|
6288
|
+
}, {
|
|
6289
|
+
children: jsx("span", {
|
|
6290
|
+
children: p
|
|
6291
|
+
})
|
|
6292
|
+
}), p);
|
|
6293
|
+
})
|
|
6294
|
+
})) : jsxs("div", __assign({
|
|
6295
|
+
className: "maru-pagination-input-wrapper"
|
|
6296
|
+
}, {
|
|
6297
|
+
children: [jsx("input", {
|
|
6298
|
+
className: "maru-pagination-input",
|
|
6299
|
+
type: "number",
|
|
6300
|
+
min: 1,
|
|
6301
|
+
max: totalPage,
|
|
6302
|
+
value: inputValue,
|
|
6303
|
+
onChange: handleInputChange,
|
|
6304
|
+
disabled: totalPage === 1,
|
|
6305
|
+
onKeyUp: handleEnterKeyUp,
|
|
6306
|
+
onBlur: handleBlur
|
|
6307
|
+
}), jsx("span", {
|
|
6308
|
+
children: "of ".concat(totalPage, " pages")
|
|
6309
|
+
})]
|
|
6310
|
+
})), jsx("button", __assign({
|
|
6311
|
+
className: "maru-pagination-next",
|
|
6312
|
+
type: "button",
|
|
6313
|
+
style: {
|
|
6314
|
+
display: !nextVisibility ? 'none' : 'block',
|
|
6315
|
+
visibility: nextVisibility
|
|
6316
|
+
},
|
|
6317
|
+
onClick: handleNextClick(false)
|
|
6318
|
+
}, {
|
|
6319
|
+
children: jsx("span", {
|
|
6320
|
+
children: jsx(Icon, {
|
|
6321
|
+
name: ICONS.ChevronRight,
|
|
6322
|
+
color: "#bdbdbd",
|
|
6323
|
+
size: 16
|
|
6324
|
+
})
|
|
6325
|
+
})
|
|
6326
|
+
})), jsx("button", __assign({
|
|
6327
|
+
className: "maru-pagination-next-all",
|
|
6328
|
+
type: "button",
|
|
6329
|
+
style: {
|
|
6330
|
+
display: !nextVisibility ? 'none' : 'block',
|
|
6331
|
+
visibility: nextVisibility
|
|
6332
|
+
},
|
|
6333
|
+
onClick: handleNextClick(true)
|
|
6334
|
+
}, {
|
|
6335
|
+
children: jsx("span", {
|
|
6336
|
+
children: jsx(Icon, {
|
|
6337
|
+
name: ICONS.ChevronRightDoubleThin,
|
|
6338
|
+
color: "#bdbdbd",
|
|
6339
|
+
size: 16
|
|
6340
|
+
})
|
|
6341
|
+
})
|
|
6342
|
+
}))]
|
|
6343
|
+
}))
|
|
6344
|
+
}));
|
|
6345
|
+
}
|
|
3322
6346
|
|
|
3323
|
-
export { Button, StyleProvider };
|
|
6347
|
+
export { Button, Checkbox, Chip, Dropdown, Icon, Input, Modal, Pagination, Popover, Radio, StyleProvider, Toggle, Tooltip };
|