ingeniuscliq-core 0.4.24 → 0.4.25
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/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +3 -0
- package/dist/_virtual/jsx-runtime.js +5 -0
- package/dist/_virtual/jsx-runtime2.js +3 -0
- package/dist/_virtual/react-jsx-runtime.development.js +3 -0
- package/dist/_virtual/react-jsx-runtime.production.js +3 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +3 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js +3 -0
- package/dist/components/common/carousel/CustomCarousel.tsx +6 -6
- package/dist/components/common/carousel/CustomCarouselSection.tsx +12 -12
- package/dist/components/common/form/CustomFormField.tsx +6 -6
- package/dist/components/common/form/FormCheckbox.tsx +5 -5
- package/dist/components/common/form/FormInput.tsx +3 -3
- package/dist/components/common/form/FormSelect.tsx +5 -5
- package/dist/components/common/form/FormTextArea.tsx +3 -3
- package/dist/components/common/form/FormWrapper.tsx +2 -2
- package/dist/components/common/logo/Logo.tsx +3 -3
- package/dist/components/common/pagination/CustomPagination.tsx +5 -5
- package/dist/components/common/select/CustomSelect.tsx +4 -4
- package/dist/components/common/spinner/Spinner.tsx +14 -14
- package/dist/components/common/stepper/Stepper.tsx +9 -9
- package/dist/components/layouts/CoreBaseLayout.tsx +5 -5
- package/dist/components/templates/CoreHomeLayout.tsx +2 -2
- package/dist/components/templates/CorePreviewLayout.tsx +2 -2
- package/dist/components/ui/accordion.tsx +14 -14
- package/dist/components/ui/alert-dialog.tsx +27 -27
- package/dist/components/ui/alert.tsx +5 -5
- package/dist/components/ui/avatar.tsx +11 -11
- package/dist/components/ui/badge.tsx +3 -3
- package/dist/components/ui/breadcrumb.tsx +14 -13
- package/dist/components/ui/button.tsx +4 -4
- package/dist/components/ui/card.tsx +8 -8
- package/dist/components/ui/carousel.tsx +14 -13
- package/dist/components/ui/checkbox.tsx +9 -9
- package/dist/components/ui/dialog.tsx +26 -26
- package/dist/components/ui/dropdown-menu.tsx +39 -37
- package/dist/components/ui/form.tsx +9 -9
- package/dist/components/ui/input.tsx +2 -2
- package/dist/components/ui/label.tsx +6 -6
- package/dist/components/ui/pagination.tsx +17 -15
- package/dist/components/ui/popover.tsx +8 -8
- package/dist/components/ui/radio-group.tsx +10 -10
- package/dist/components/ui/select.tsx +40 -38
- package/dist/components/ui/separator.tsx +5 -5
- package/dist/components/ui/sheet.tsx +27 -27
- package/dist/components/ui/skeleton.tsx +2 -2
- package/dist/components/ui/slider.tsx +9 -9
- package/dist/components/ui/stepper.tsx +34 -34
- package/dist/components/ui/switch.tsx +7 -7
- package/dist/components/ui/table.tsx +9 -9
- package/dist/components/ui/tabs.tsx +13 -13
- package/dist/components/ui/textarea.tsx +2 -2
- package/dist/components/ui/tooltip.tsx +8 -8
- package/dist/helpers/axiosGlobal.js +2 -1
- package/dist/hooks/useNotification.js +1 -1
- package/dist/lib/utils.js +2 -2
- package/dist/modules/CoreAuth/classes/CoreAuthBuilder.js +1 -1
- package/dist/modules/CoreAuth/context/AuthContext.tsx +1 -1
- package/dist/modules/CoreAuth/index.js +0 -1
- package/dist/modules/CoreCustomization/classes/CoreCustomizationBuilder.js +1 -1
- package/dist/modules/CoreCustomization/index.js +0 -1
- package/dist/modules/CoreOrder/classes/CoreOrderBuilder.js +1 -1
- package/dist/modules/CoreOrder/index.js +0 -1
- package/dist/modules/CorePayForm/classes/CorePayFormBuilder.js +1 -1
- package/dist/modules/CorePayForm/index.js +0 -1
- package/dist/modules/CoreProduct/classes/CoreProductBuilder.js +1 -1
- package/dist/modules/CoreProduct/index.js +0 -1
- package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.js +1 -1
- package/dist/modules/CoreShipment/index.js +0 -1
- package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.js +1 -1
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +814 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +751 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +350 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +161 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +137 -0
- package/dist/node_modules/@radix-ui/number/dist/index.js +6 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +305 -0
- package/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js +147 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
- package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +118 -0
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +270 -0
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +145 -0
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +70 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +79 -0
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +321 -0
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +211 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +267 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +29 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +207 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-label/dist/index.js +24 -0
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +834 -0
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +299 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +283 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +43 -0
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +282 -0
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +223 -0
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +1156 -0
- package/dist/node_modules/@radix-ui/react-separator/dist/index.js +30 -0
- package/dist/node_modules/@radix-ui/react-slider/dist/index.js +554 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +99 -0
- package/dist/node_modules/@radix-ui/react-switch/dist/index.js +152 -0
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +187 -0
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +482 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +70 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +35 -0
- package/dist/node_modules/@stepperize/core/dist/index.js +3 -0
- package/dist/node_modules/@stepperize/react/dist/index.js +6 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +137 -0
- package/dist/node_modules/axios/index.js +25 -0
- package/dist/node_modules/axios/lib/adapters/adapters.js +81 -0
- package/dist/node_modules/axios/lib/adapters/fetch.js +229 -0
- package/dist/node_modules/axios/lib/adapters/xhr.js +199 -0
- package/dist/node_modules/axios/lib/axios.js +86 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +133 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +23 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.js +5 -0
- package/dist/node_modules/axios/lib/core/Axios.js +238 -0
- package/dist/node_modules/axios/lib/core/AxiosError.js +101 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +312 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +69 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.js +22 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +81 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.js +106 -0
- package/dist/node_modules/axios/lib/core/settle.js +27 -0
- package/dist/node_modules/axios/lib/core/transformData.js +28 -0
- package/dist/node_modules/axios/lib/defaults/index.js +159 -0
- package/dist/node_modules/axios/lib/defaults/transitional.js +7 -0
- package/dist/node_modules/axios/lib/env/data.js +3 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +56 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +71 -0
- package/dist/node_modules/axios/lib/helpers/bind.js +7 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.js +69 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +15 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +48 -0
- package/dist/node_modules/axios/lib/helpers/cookies.js +43 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +93 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +15 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +16 -0
- package/dist/node_modules/axios/lib/helpers/null.js +4 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +55 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +46 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +58 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.js +53 -0
- package/dist/node_modules/axios/lib/helpers/spread.js +28 -0
- package/dist/node_modules/axios/lib/helpers/throttle.js +44 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.js +219 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.js +88 -0
- package/dist/node_modules/axios/lib/helpers/validator.js +99 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/index.js +15 -0
- package/dist/node_modules/axios/lib/platform/common/utils.js +45 -0
- package/dist/node_modules/axios/lib/platform/index.js +9 -0
- package/dist/node_modules/axios/lib/utils.js +780 -0
- package/dist/node_modules/class-variance-authority/dist/index.js +44 -0
- package/dist/node_modules/clsx/dist/clsx.js +3 -0
- package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +1669 -0
- package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +37 -0
- package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +38 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +8 -0
- package/dist/node_modules/lucide-react/dist/esm/Icon.js +43 -0
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +30 -0
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +20 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-right.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/check.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-up.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis.js +18 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/x.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +28 -0
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +363 -0
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +44 -0
- package/dist/node_modules/react/jsx-runtime.js +19 -0
- package/dist/node_modules/react-hook-form/dist/index.esm.js +560 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +9 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +167 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +38 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +21 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +110 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +56 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +10 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +31 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +19 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +25 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +51 -0
- package/dist/node_modules/sonner/dist/index.js +299 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +3035 -0
- package/dist/node_modules/tslib/tslib.es6.js +56 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +24 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +48 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +77 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +106 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +77 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js +19 -0
- package/dist/node_modules/zustand/esm/react.js +22 -0
- package/dist/node_modules/zustand/esm/vanilla.js +24 -0
- package/package.json +1 -1
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { computePosition, offset as offset$1, shift as shift$1, flip as flip$1, size as size$1, hide as hide$1, limitShift as limitShift$1, arrow as arrow$2 } from '../../dom/dist/floating-ui.dom.js';
|
|
2
|
+
export { autoUpdate, platform } from '../../dom/dist/floating-ui.dom.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useLayoutEffect } from 'react';
|
|
5
|
+
import * as ReactDOM from 'react-dom';
|
|
6
|
+
|
|
7
|
+
var isClient = typeof document !== 'undefined';
|
|
8
|
+
|
|
9
|
+
var noop = function noop() {};
|
|
10
|
+
var index = isClient ? useLayoutEffect : noop;
|
|
11
|
+
|
|
12
|
+
// Fork of `fast-deep-equal` that only does the comparisons we need and compares
|
|
13
|
+
// functions
|
|
14
|
+
function deepEqual(a, b) {
|
|
15
|
+
if (a === b) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
if (typeof a !== typeof b) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (typeof a === 'function' && a.toString() === b.toString()) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
let length;
|
|
25
|
+
let i;
|
|
26
|
+
let keys;
|
|
27
|
+
if (a && b && typeof a === 'object') {
|
|
28
|
+
if (Array.isArray(a)) {
|
|
29
|
+
length = a.length;
|
|
30
|
+
if (length !== b.length) return false;
|
|
31
|
+
for (i = length; i-- !== 0;) {
|
|
32
|
+
if (!deepEqual(a[i], b[i])) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
keys = Object.keys(a);
|
|
39
|
+
length = keys.length;
|
|
40
|
+
if (length !== Object.keys(b).length) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
for (i = length; i-- !== 0;) {
|
|
44
|
+
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
for (i = length; i-- !== 0;) {
|
|
49
|
+
const key = keys[i];
|
|
50
|
+
if (key === '_owner' && a.$$typeof) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (!deepEqual(a[key], b[key])) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return a !== a && b !== b;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getDPR(element) {
|
|
63
|
+
if (typeof window === 'undefined') {
|
|
64
|
+
return 1;
|
|
65
|
+
}
|
|
66
|
+
const win = element.ownerDocument.defaultView || window;
|
|
67
|
+
return win.devicePixelRatio || 1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function roundByDPR(element, value) {
|
|
71
|
+
const dpr = getDPR(element);
|
|
72
|
+
return Math.round(value * dpr) / dpr;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function useLatestRef(value) {
|
|
76
|
+
const ref = React.useRef(value);
|
|
77
|
+
index(() => {
|
|
78
|
+
ref.current = value;
|
|
79
|
+
});
|
|
80
|
+
return ref;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Provides data to position a floating element.
|
|
85
|
+
* @see https://floating-ui.com/docs/useFloating
|
|
86
|
+
*/
|
|
87
|
+
function useFloating(options) {
|
|
88
|
+
if (options === void 0) {
|
|
89
|
+
options = {};
|
|
90
|
+
}
|
|
91
|
+
const {
|
|
92
|
+
placement = 'bottom',
|
|
93
|
+
strategy = 'absolute',
|
|
94
|
+
middleware = [],
|
|
95
|
+
platform,
|
|
96
|
+
elements: {
|
|
97
|
+
reference: externalReference,
|
|
98
|
+
floating: externalFloating
|
|
99
|
+
} = {},
|
|
100
|
+
transform = true,
|
|
101
|
+
whileElementsMounted,
|
|
102
|
+
open
|
|
103
|
+
} = options;
|
|
104
|
+
const [data, setData] = React.useState({
|
|
105
|
+
x: 0,
|
|
106
|
+
y: 0,
|
|
107
|
+
strategy,
|
|
108
|
+
placement,
|
|
109
|
+
middlewareData: {},
|
|
110
|
+
isPositioned: false
|
|
111
|
+
});
|
|
112
|
+
const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
|
|
113
|
+
if (!deepEqual(latestMiddleware, middleware)) {
|
|
114
|
+
setLatestMiddleware(middleware);
|
|
115
|
+
}
|
|
116
|
+
const [_reference, _setReference] = React.useState(null);
|
|
117
|
+
const [_floating, _setFloating] = React.useState(null);
|
|
118
|
+
const setReference = React.useCallback(node => {
|
|
119
|
+
if (node !== referenceRef.current) {
|
|
120
|
+
referenceRef.current = node;
|
|
121
|
+
_setReference(node);
|
|
122
|
+
}
|
|
123
|
+
}, []);
|
|
124
|
+
const setFloating = React.useCallback(node => {
|
|
125
|
+
if (node !== floatingRef.current) {
|
|
126
|
+
floatingRef.current = node;
|
|
127
|
+
_setFloating(node);
|
|
128
|
+
}
|
|
129
|
+
}, []);
|
|
130
|
+
const referenceEl = externalReference || _reference;
|
|
131
|
+
const floatingEl = externalFloating || _floating;
|
|
132
|
+
const referenceRef = React.useRef(null);
|
|
133
|
+
const floatingRef = React.useRef(null);
|
|
134
|
+
const dataRef = React.useRef(data);
|
|
135
|
+
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
136
|
+
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
137
|
+
const platformRef = useLatestRef(platform);
|
|
138
|
+
const openRef = useLatestRef(open);
|
|
139
|
+
const update = React.useCallback(() => {
|
|
140
|
+
if (!referenceRef.current || !floatingRef.current) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const config = {
|
|
144
|
+
placement,
|
|
145
|
+
strategy,
|
|
146
|
+
middleware: latestMiddleware
|
|
147
|
+
};
|
|
148
|
+
if (platformRef.current) {
|
|
149
|
+
config.platform = platformRef.current;
|
|
150
|
+
}
|
|
151
|
+
computePosition(referenceRef.current, floatingRef.current, config).then(data => {
|
|
152
|
+
const fullData = {
|
|
153
|
+
...data,
|
|
154
|
+
// The floating element's position may be recomputed while it's closed
|
|
155
|
+
// but still mounted (such as when transitioning out). To ensure
|
|
156
|
+
// `isPositioned` will be `false` initially on the next open, avoid
|
|
157
|
+
// setting it to `true` when `open === false` (must be specified).
|
|
158
|
+
isPositioned: openRef.current !== false
|
|
159
|
+
};
|
|
160
|
+
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
|
161
|
+
dataRef.current = fullData;
|
|
162
|
+
ReactDOM.flushSync(() => {
|
|
163
|
+
setData(fullData);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
|
168
|
+
index(() => {
|
|
169
|
+
if (open === false && dataRef.current.isPositioned) {
|
|
170
|
+
dataRef.current.isPositioned = false;
|
|
171
|
+
setData(data => ({
|
|
172
|
+
...data,
|
|
173
|
+
isPositioned: false
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
}, [open]);
|
|
177
|
+
const isMountedRef = React.useRef(false);
|
|
178
|
+
index(() => {
|
|
179
|
+
isMountedRef.current = true;
|
|
180
|
+
return () => {
|
|
181
|
+
isMountedRef.current = false;
|
|
182
|
+
};
|
|
183
|
+
}, []);
|
|
184
|
+
index(() => {
|
|
185
|
+
if (referenceEl) referenceRef.current = referenceEl;
|
|
186
|
+
if (floatingEl) floatingRef.current = floatingEl;
|
|
187
|
+
if (referenceEl && floatingEl) {
|
|
188
|
+
if (whileElementsMountedRef.current) {
|
|
189
|
+
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
|
190
|
+
}
|
|
191
|
+
update();
|
|
192
|
+
}
|
|
193
|
+
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
194
|
+
const refs = React.useMemo(() => ({
|
|
195
|
+
reference: referenceRef,
|
|
196
|
+
floating: floatingRef,
|
|
197
|
+
setReference,
|
|
198
|
+
setFloating
|
|
199
|
+
}), [setReference, setFloating]);
|
|
200
|
+
const elements = React.useMemo(() => ({
|
|
201
|
+
reference: referenceEl,
|
|
202
|
+
floating: floatingEl
|
|
203
|
+
}), [referenceEl, floatingEl]);
|
|
204
|
+
const floatingStyles = React.useMemo(() => {
|
|
205
|
+
const initialStyles = {
|
|
206
|
+
position: strategy,
|
|
207
|
+
left: 0,
|
|
208
|
+
top: 0
|
|
209
|
+
};
|
|
210
|
+
if (!elements.floating) {
|
|
211
|
+
return initialStyles;
|
|
212
|
+
}
|
|
213
|
+
const x = roundByDPR(elements.floating, data.x);
|
|
214
|
+
const y = roundByDPR(elements.floating, data.y);
|
|
215
|
+
if (transform) {
|
|
216
|
+
return {
|
|
217
|
+
...initialStyles,
|
|
218
|
+
transform: "translate(" + x + "px, " + y + "px)",
|
|
219
|
+
...(getDPR(elements.floating) >= 1.5 && {
|
|
220
|
+
willChange: 'transform'
|
|
221
|
+
})
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
position: strategy,
|
|
226
|
+
left: x,
|
|
227
|
+
top: y
|
|
228
|
+
};
|
|
229
|
+
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
230
|
+
return React.useMemo(() => ({
|
|
231
|
+
...data,
|
|
232
|
+
update,
|
|
233
|
+
refs,
|
|
234
|
+
elements,
|
|
235
|
+
floatingStyles
|
|
236
|
+
}), [data, update, refs, elements, floatingStyles]);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Provides data to position an inner element of the floating element so that it
|
|
241
|
+
* appears centered to the reference element.
|
|
242
|
+
* This wraps the core `arrow` middleware to allow React refs as the element.
|
|
243
|
+
* @see https://floating-ui.com/docs/arrow
|
|
244
|
+
*/
|
|
245
|
+
const arrow$1 = options => {
|
|
246
|
+
function isRef(value) {
|
|
247
|
+
return {}.hasOwnProperty.call(value, 'current');
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
name: 'arrow',
|
|
251
|
+
options,
|
|
252
|
+
fn(state) {
|
|
253
|
+
const {
|
|
254
|
+
element,
|
|
255
|
+
padding
|
|
256
|
+
} = typeof options === 'function' ? options(state) : options;
|
|
257
|
+
if (element && isRef(element)) {
|
|
258
|
+
if (element.current != null) {
|
|
259
|
+
return arrow$2({
|
|
260
|
+
element: element.current,
|
|
261
|
+
padding
|
|
262
|
+
}).fn(state);
|
|
263
|
+
}
|
|
264
|
+
return {};
|
|
265
|
+
}
|
|
266
|
+
if (element) {
|
|
267
|
+
return arrow$2({
|
|
268
|
+
element,
|
|
269
|
+
padding
|
|
270
|
+
}).fn(state);
|
|
271
|
+
}
|
|
272
|
+
return {};
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Modifies the placement by translating the floating element along the
|
|
279
|
+
* specified axes.
|
|
280
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
281
|
+
* object may be passed.
|
|
282
|
+
* @see https://floating-ui.com/docs/offset
|
|
283
|
+
*/
|
|
284
|
+
const offset = (options, deps) => ({
|
|
285
|
+
...offset$1(options),
|
|
286
|
+
options: [options, deps]
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
291
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
292
|
+
* @see https://floating-ui.com/docs/shift
|
|
293
|
+
*/
|
|
294
|
+
const shift = (options, deps) => ({
|
|
295
|
+
...shift$1(options),
|
|
296
|
+
options: [options, deps]
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Built-in `limiter` that will stop `shift()` at a certain point.
|
|
301
|
+
*/
|
|
302
|
+
const limitShift = (options, deps) => ({
|
|
303
|
+
...limitShift$1(options),
|
|
304
|
+
options: [options, deps]
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
309
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
310
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
311
|
+
* @see https://floating-ui.com/docs/flip
|
|
312
|
+
*/
|
|
313
|
+
const flip = (options, deps) => ({
|
|
314
|
+
...flip$1(options),
|
|
315
|
+
options: [options, deps]
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Provides data that allows you to change the size of the floating element —
|
|
320
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
321
|
+
* width of the reference element.
|
|
322
|
+
* @see https://floating-ui.com/docs/size
|
|
323
|
+
*/
|
|
324
|
+
const size = (options, deps) => ({
|
|
325
|
+
...size$1(options),
|
|
326
|
+
options: [options, deps]
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
331
|
+
* when it is not in the same clipping context as the reference element.
|
|
332
|
+
* @see https://floating-ui.com/docs/hide
|
|
333
|
+
*/
|
|
334
|
+
const hide = (options, deps) => ({
|
|
335
|
+
...hide$1(options),
|
|
336
|
+
options: [options, deps]
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Provides data to position an inner element of the floating element so that it
|
|
341
|
+
* appears centered to the reference element.
|
|
342
|
+
* This wraps the core `arrow` middleware to allow React refs as the element.
|
|
343
|
+
* @see https://floating-ui.com/docs/arrow
|
|
344
|
+
*/
|
|
345
|
+
const arrow = (options, deps) => ({
|
|
346
|
+
...arrow$1(options),
|
|
347
|
+
options: [options, deps]
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
export { arrow, computePosition, flip, hide, limitShift, offset, shift, size, useFloating };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
function hasWindow() {
|
|
2
|
+
return typeof window !== 'undefined';
|
|
3
|
+
}
|
|
4
|
+
function getNodeName(node) {
|
|
5
|
+
if (isNode(node)) {
|
|
6
|
+
return (node.nodeName || '').toLowerCase();
|
|
7
|
+
}
|
|
8
|
+
// Mocked nodes in testing environments may not be instances of Node. By
|
|
9
|
+
// returning `#document` an infinite loop won't occur.
|
|
10
|
+
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
11
|
+
return '#document';
|
|
12
|
+
}
|
|
13
|
+
function getWindow(node) {
|
|
14
|
+
var _node$ownerDocument;
|
|
15
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
16
|
+
}
|
|
17
|
+
function getDocumentElement(node) {
|
|
18
|
+
var _ref;
|
|
19
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
20
|
+
}
|
|
21
|
+
function isNode(value) {
|
|
22
|
+
if (!hasWindow()) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
26
|
+
}
|
|
27
|
+
function isElement(value) {
|
|
28
|
+
if (!hasWindow()) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
32
|
+
}
|
|
33
|
+
function isHTMLElement(value) {
|
|
34
|
+
if (!hasWindow()) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
38
|
+
}
|
|
39
|
+
function isShadowRoot(value) {
|
|
40
|
+
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
44
|
+
}
|
|
45
|
+
const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
|
|
46
|
+
function isOverflowElement(element) {
|
|
47
|
+
const {
|
|
48
|
+
overflow,
|
|
49
|
+
overflowX,
|
|
50
|
+
overflowY,
|
|
51
|
+
display
|
|
52
|
+
} = getComputedStyle(element);
|
|
53
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
|
|
54
|
+
}
|
|
55
|
+
const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
|
|
56
|
+
function isTableElement(element) {
|
|
57
|
+
return tableElements.has(getNodeName(element));
|
|
58
|
+
}
|
|
59
|
+
const topLayerSelectors = [':popover-open', ':modal'];
|
|
60
|
+
function isTopLayer(element) {
|
|
61
|
+
return topLayerSelectors.some(selector => {
|
|
62
|
+
try {
|
|
63
|
+
return element.matches(selector);
|
|
64
|
+
} catch (_e) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
|
|
70
|
+
const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
|
|
71
|
+
const containValues = ['paint', 'layout', 'strict', 'content'];
|
|
72
|
+
function isContainingBlock(elementOrCss) {
|
|
73
|
+
const webkit = isWebKit();
|
|
74
|
+
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
75
|
+
|
|
76
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
77
|
+
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
78
|
+
return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
|
|
79
|
+
}
|
|
80
|
+
function getContainingBlock(element) {
|
|
81
|
+
let currentNode = getParentNode(element);
|
|
82
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
83
|
+
if (isContainingBlock(currentNode)) {
|
|
84
|
+
return currentNode;
|
|
85
|
+
} else if (isTopLayer(currentNode)) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
currentNode = getParentNode(currentNode);
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
function isWebKit() {
|
|
93
|
+
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
94
|
+
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
95
|
+
}
|
|
96
|
+
const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
|
|
97
|
+
function isLastTraversableNode(node) {
|
|
98
|
+
return lastTraversableNodeNames.has(getNodeName(node));
|
|
99
|
+
}
|
|
100
|
+
function getComputedStyle(element) {
|
|
101
|
+
return getWindow(element).getComputedStyle(element);
|
|
102
|
+
}
|
|
103
|
+
function getNodeScroll(element) {
|
|
104
|
+
if (isElement(element)) {
|
|
105
|
+
return {
|
|
106
|
+
scrollLeft: element.scrollLeft,
|
|
107
|
+
scrollTop: element.scrollTop
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
scrollLeft: element.scrollX,
|
|
112
|
+
scrollTop: element.scrollY
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function getParentNode(node) {
|
|
116
|
+
if (getNodeName(node) === 'html') {
|
|
117
|
+
return node;
|
|
118
|
+
}
|
|
119
|
+
const result =
|
|
120
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
121
|
+
node.assignedSlot ||
|
|
122
|
+
// DOM Element detected.
|
|
123
|
+
node.parentNode ||
|
|
124
|
+
// ShadowRoot detected.
|
|
125
|
+
isShadowRoot(node) && node.host ||
|
|
126
|
+
// Fallback.
|
|
127
|
+
getDocumentElement(node);
|
|
128
|
+
return isShadowRoot(result) ? result.host : result;
|
|
129
|
+
}
|
|
130
|
+
function getNearestOverflowAncestor(node) {
|
|
131
|
+
const parentNode = getParentNode(node);
|
|
132
|
+
if (isLastTraversableNode(parentNode)) {
|
|
133
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
134
|
+
}
|
|
135
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
136
|
+
return parentNode;
|
|
137
|
+
}
|
|
138
|
+
return getNearestOverflowAncestor(parentNode);
|
|
139
|
+
}
|
|
140
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
141
|
+
var _node$ownerDocument2;
|
|
142
|
+
if (list === void 0) {
|
|
143
|
+
list = [];
|
|
144
|
+
}
|
|
145
|
+
if (traverseIframes === void 0) {
|
|
146
|
+
traverseIframes = true;
|
|
147
|
+
}
|
|
148
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
149
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
150
|
+
const win = getWindow(scrollableAncestor);
|
|
151
|
+
if (isBody) {
|
|
152
|
+
const frameElement = getFrameElement(win);
|
|
153
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
154
|
+
}
|
|
155
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
156
|
+
}
|
|
157
|
+
function getFrameElement(win) {
|
|
158
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom positioning reference element.
|
|
3
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
7
|
+
const min = Math.min;
|
|
8
|
+
const max = Math.max;
|
|
9
|
+
const round = Math.round;
|
|
10
|
+
const floor = Math.floor;
|
|
11
|
+
const createCoords = v => ({
|
|
12
|
+
x: v,
|
|
13
|
+
y: v
|
|
14
|
+
});
|
|
15
|
+
const oppositeSideMap = {
|
|
16
|
+
left: 'right',
|
|
17
|
+
right: 'left',
|
|
18
|
+
bottom: 'top',
|
|
19
|
+
top: 'bottom'
|
|
20
|
+
};
|
|
21
|
+
const oppositeAlignmentMap = {
|
|
22
|
+
start: 'end',
|
|
23
|
+
end: 'start'
|
|
24
|
+
};
|
|
25
|
+
function clamp(start, value, end) {
|
|
26
|
+
return max(start, min(value, end));
|
|
27
|
+
}
|
|
28
|
+
function evaluate(value, param) {
|
|
29
|
+
return typeof value === 'function' ? value(param) : value;
|
|
30
|
+
}
|
|
31
|
+
function getSide(placement) {
|
|
32
|
+
return placement.split('-')[0];
|
|
33
|
+
}
|
|
34
|
+
function getAlignment(placement) {
|
|
35
|
+
return placement.split('-')[1];
|
|
36
|
+
}
|
|
37
|
+
function getOppositeAxis(axis) {
|
|
38
|
+
return axis === 'x' ? 'y' : 'x';
|
|
39
|
+
}
|
|
40
|
+
function getAxisLength(axis) {
|
|
41
|
+
return axis === 'y' ? 'height' : 'width';
|
|
42
|
+
}
|
|
43
|
+
const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
|
|
44
|
+
function getSideAxis(placement) {
|
|
45
|
+
return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
|
|
46
|
+
}
|
|
47
|
+
function getAlignmentAxis(placement) {
|
|
48
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
49
|
+
}
|
|
50
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
51
|
+
if (rtl === void 0) {
|
|
52
|
+
rtl = false;
|
|
53
|
+
}
|
|
54
|
+
const alignment = getAlignment(placement);
|
|
55
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
56
|
+
const length = getAxisLength(alignmentAxis);
|
|
57
|
+
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
58
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
59
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
60
|
+
}
|
|
61
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
62
|
+
}
|
|
63
|
+
function getExpandedPlacements(placement) {
|
|
64
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
65
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
66
|
+
}
|
|
67
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
68
|
+
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
69
|
+
}
|
|
70
|
+
const lrPlacement = ['left', 'right'];
|
|
71
|
+
const rlPlacement = ['right', 'left'];
|
|
72
|
+
const tbPlacement = ['top', 'bottom'];
|
|
73
|
+
const btPlacement = ['bottom', 'top'];
|
|
74
|
+
function getSideList(side, isStart, rtl) {
|
|
75
|
+
switch (side) {
|
|
76
|
+
case 'top':
|
|
77
|
+
case 'bottom':
|
|
78
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
79
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
80
|
+
case 'left':
|
|
81
|
+
case 'right':
|
|
82
|
+
return isStart ? tbPlacement : btPlacement;
|
|
83
|
+
default:
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
88
|
+
const alignment = getAlignment(placement);
|
|
89
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
90
|
+
if (alignment) {
|
|
91
|
+
list = list.map(side => side + "-" + alignment);
|
|
92
|
+
if (flipAlignment) {
|
|
93
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return list;
|
|
97
|
+
}
|
|
98
|
+
function getOppositePlacement(placement) {
|
|
99
|
+
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
100
|
+
}
|
|
101
|
+
function expandPaddingObject(padding) {
|
|
102
|
+
return {
|
|
103
|
+
top: 0,
|
|
104
|
+
right: 0,
|
|
105
|
+
bottom: 0,
|
|
106
|
+
left: 0,
|
|
107
|
+
...padding
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function getPaddingObject(padding) {
|
|
111
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
112
|
+
top: padding,
|
|
113
|
+
right: padding,
|
|
114
|
+
bottom: padding,
|
|
115
|
+
left: padding
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function rectToClientRect(rect) {
|
|
119
|
+
const {
|
|
120
|
+
x,
|
|
121
|
+
y,
|
|
122
|
+
width,
|
|
123
|
+
height
|
|
124
|
+
} = rect;
|
|
125
|
+
return {
|
|
126
|
+
width,
|
|
127
|
+
height,
|
|
128
|
+
top: y,
|
|
129
|
+
left: x,
|
|
130
|
+
right: x + width,
|
|
131
|
+
bottom: y + height,
|
|
132
|
+
x,
|
|
133
|
+
y
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export { clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, rectToClientRect, round, sides };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/primitive.tsx
|
|
2
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
3
|
+
return function handleEvent(event) {
|
|
4
|
+
originalEventHandler?.(event);
|
|
5
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
6
|
+
return ourEventHandler?.(event);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { composeEventHandlers };
|