ingeniuscliq-core 0.4.18 → 0.4.20
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/common/carousel/CustomCarousel.d.ts +1 -1
- package/dist/components/common/carousel/CustomCarousel.d.ts.map +1 -1
- package/dist/components/common/carousel/CustomCarouselSection.d.ts +1 -1
- package/dist/components/common/carousel/CustomCarouselSection.d.ts.map +1 -1
- package/dist/components/common/form/FormCheckbox.d.ts +1 -1
- package/dist/components/common/form/FormCheckbox.d.ts.map +1 -1
- package/dist/components/common/form/FormInput.d.ts +1 -1
- package/dist/components/common/form/FormInput.d.ts.map +1 -1
- package/dist/components/common/form/FormSelect.d.ts +1 -1
- package/dist/components/common/form/FormSelect.d.ts.map +1 -1
- package/dist/components/common/form/FormTextArea.d.ts +1 -1
- package/dist/components/common/form/FormTextArea.d.ts.map +1 -1
- package/dist/components/common/form/FormWrapper.d.ts +1 -1
- package/dist/components/common/form/FormWrapper.d.ts.map +1 -1
- package/dist/components/common/logo/Logo.d.ts +1 -1
- package/dist/components/common/logo/Logo.d.ts.map +1 -1
- package/dist/components/common/pagination/CustomPagination.d.ts +1 -1
- package/dist/components/common/pagination/CustomPagination.d.ts.map +1 -1
- package/dist/components/common/select/CustomSelect.d.ts +1 -1
- package/dist/components/common/select/CustomSelect.d.ts.map +1 -1
- package/dist/components/common/spinner/Spinner.d.ts +1 -1
- package/dist/components/common/spinner/Spinner.d.ts.map +1 -1
- package/dist/components/common/stepper/Stepper.d.ts +1 -1
- package/dist/components/common/stepper/Stepper.d.ts.map +1 -1
- package/dist/components/common/stepper/Stepper.tsx +1 -1
- package/dist/components/layouts/CoreBaseLayout.d.ts +1 -1
- package/dist/components/layouts/CoreBaseLayout.d.ts.map +1 -1
- package/dist/components/templates/CoreHomeLayout.d.ts +1 -1
- package/dist/components/templates/CoreHomeLayout.d.ts.map +1 -1
- package/dist/components/templates/CorePreviewLayout.d.ts +1 -1
- package/dist/components/templates/CorePreviewLayout.d.ts.map +1 -1
- package/dist/components/ui/accordion.tsx +9 -9
- package/dist/components/ui/alert-dialog.d.ts +2 -2
- package/dist/components/ui/alert-dialog.tsx +16 -16
- package/dist/components/ui/alert.d.ts +3 -3
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.tsx +1 -1
- package/dist/components/ui/avatar.tsx +7 -7
- package/dist/components/ui/badge.d.ts +4 -4
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.tsx +1 -1
- package/dist/components/ui/breadcrumb.d.ts +2 -2
- package/dist/components/ui/breadcrumb.tsx +3 -4
- package/dist/components/ui/button.d.ts +4 -4
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.tsx +2 -2
- package/dist/components/ui/carousel.tsx +2 -3
- package/dist/components/ui/checkbox.tsx +5 -5
- package/dist/components/ui/dialog.d.ts +2 -2
- package/dist/components/ui/dialog.tsx +15 -15
- package/dist/components/ui/dropdown-menu.d.ts +1 -1
- package/dist/components/ui/dropdown-menu.tsx +27 -29
- package/dist/components/ui/form.d.ts +1 -1
- package/dist/components/ui/form.d.ts.map +1 -1
- package/dist/components/ui/form.tsx +2 -2
- package/dist/components/ui/label.d.ts +1 -1
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/label.tsx +4 -4
- package/dist/components/ui/pagination.d.ts +5 -5
- package/dist/components/ui/pagination.tsx +2 -4
- package/dist/components/ui/popover.tsx +7 -7
- package/dist/components/ui/radio-group.tsx +7 -7
- package/dist/components/ui/select.tsx +25 -27
- package/dist/components/ui/separator.tsx +3 -3
- package/dist/components/ui/sheet.d.ts +5 -5
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.tsx +16 -16
- package/dist/components/ui/skeleton.d.ts +1 -1
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/slider.tsx +6 -6
- package/dist/components/ui/stepper.tsx +4 -4
- package/dist/components/ui/switch.tsx +4 -4
- package/dist/components/ui/tabs.tsx +9 -9
- package/dist/components/ui/tooltip.tsx +6 -6
- package/dist/helpers/axiosGlobal.js +1 -2
- package/dist/hooks/useLanguage.js +2 -5
- package/dist/hooks/useNotification.js +1 -1
- package/dist/i18n/config.js +1 -5
- package/dist/lib/utils.js +1 -1
- package/dist/modules/CoreAuth/classes/CoreAuthBuilder.d.ts +2 -2
- package/dist/modules/CoreAuth/classes/CoreAuthBuilder.js +1 -1
- package/dist/modules/CoreAuth/context/AuthContext.d.ts +2 -2
- package/dist/modules/CoreAuth/context/AuthContext.d.ts.map +1 -1
- package/dist/modules/CoreAuth/hooks/useAuth.d.ts +3 -3
- package/dist/modules/CoreAuth/index.js +1 -0
- package/dist/modules/CoreAuth/stores/authStore.d.ts +2 -2
- package/dist/modules/CoreCustomization/classes/CoreCustomizationBuilder.d.ts +8 -8
- package/dist/modules/CoreCustomization/classes/CoreCustomizationBuilder.js +1 -1
- package/dist/modules/CoreCustomization/index.js +1 -0
- package/dist/modules/CoreOrder/classes/CoreOrderBuilder.js +1 -1
- package/dist/modules/CoreOrder/index.js +1 -0
- package/dist/modules/CorePayForm/classes/CorePayFormBuilder.d.ts +2 -2
- package/dist/modules/CorePayForm/classes/CorePayFormBuilder.js +1 -1
- package/dist/modules/CorePayForm/index.js +1 -0
- package/dist/modules/CoreProduct/classes/CoreProductBuilder.d.ts +8 -8
- package/dist/modules/CoreProduct/classes/CoreProductBuilder.js +1 -1
- package/dist/modules/CoreProduct/index.js +1 -0
- package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.d.ts +6 -6
- package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.js +1 -1
- package/dist/modules/CoreShipment/index.js +1 -0
- package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.d.ts +4 -4
- package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.js +1 -1
- package/package.json +21 -13
- package/src/commands/common/constants.js +10 -0
- package/src/commands/helpers/index.js +15 -0
- package/src/commands/helpers/strings.js +4 -0
- package/src/commands/templates/locale.js +14 -0
- package/src/commands/templates/service.js +12 -0
- package/src/commands/templates/type.js +10 -0
- package/README.md +0 -417
- package/dist/_virtual/index.js +0 -5
- package/dist/_virtual/index2.js +0 -3
- package/dist/_virtual/use-sync-external-store-shim.development.js +0 -3
- package/dist/_virtual/use-sync-external-store-shim.production.js +0 -3
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -814
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -751
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -350
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -161
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -137
- package/dist/node_modules/@radix-ui/number/dist/index.js +0 -6
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -11
- package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +0 -305
- package/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js +0 -147
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +0 -25
- package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +0 -118
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +0 -270
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +0 -145
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +0 -70
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -39
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -79
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +0 -321
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js +0 -11
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -211
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +0 -267
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -29
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -207
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -15
- package/dist/node_modules/@radix-ui/react-label/dist/index.js +0 -24
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +0 -834
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +0 -299
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +0 -283
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -17
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -130
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -43
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +0 -282
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +0 -223
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +0 -1156
- package/dist/node_modules/@radix-ui/react-separator/dist/index.js +0 -30
- package/dist/node_modules/@radix-ui/react-slider/dist/index.js +0 -554
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -99
- package/dist/node_modules/@radix-ui/react-switch/dist/index.js +0 -152
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +0 -187
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +0 -482
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -12
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -70
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -18
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +0 -16
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -7
- package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +0 -15
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +0 -40
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +0 -35
- package/dist/node_modules/@stepperize/core/dist/index.js +0 -3
- package/dist/node_modules/@stepperize/react/dist/index.js +0 -6
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -137
- package/dist/node_modules/axios/index.js +0 -25
- package/dist/node_modules/axios/lib/adapters/adapters.js +0 -81
- package/dist/node_modules/axios/lib/adapters/fetch.js +0 -229
- package/dist/node_modules/axios/lib/adapters/xhr.js +0 -199
- package/dist/node_modules/axios/lib/axios.js +0 -86
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +0 -133
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +0 -23
- package/dist/node_modules/axios/lib/cancel/isCancel.js +0 -5
- package/dist/node_modules/axios/lib/core/Axios.js +0 -238
- package/dist/node_modules/axios/lib/core/AxiosError.js +0 -101
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +0 -312
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +0 -69
- package/dist/node_modules/axios/lib/core/buildFullPath.js +0 -22
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +0 -81
- package/dist/node_modules/axios/lib/core/mergeConfig.js +0 -106
- package/dist/node_modules/axios/lib/core/settle.js +0 -27
- package/dist/node_modules/axios/lib/core/transformData.js +0 -28
- package/dist/node_modules/axios/lib/defaults/index.js +0 -159
- package/dist/node_modules/axios/lib/defaults/transitional.js +0 -7
- package/dist/node_modules/axios/lib/env/data.js +0 -3
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -56
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -71
- package/dist/node_modules/axios/lib/helpers/bind.js +0 -7
- package/dist/node_modules/axios/lib/helpers/buildURL.js +0 -69
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +0 -15
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +0 -48
- package/dist/node_modules/axios/lib/helpers/cookies.js +0 -43
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +0 -93
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -15
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -16
- package/dist/node_modules/axios/lib/helpers/null.js +0 -4
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +0 -55
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +0 -46
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +0 -58
- package/dist/node_modules/axios/lib/helpers/speedometer.js +0 -53
- package/dist/node_modules/axios/lib/helpers/spread.js +0 -28
- package/dist/node_modules/axios/lib/helpers/throttle.js +0 -44
- package/dist/node_modules/axios/lib/helpers/toFormData.js +0 -219
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -19
- package/dist/node_modules/axios/lib/helpers/trackStream.js +0 -88
- package/dist/node_modules/axios/lib/helpers/validator.js +0 -99
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -5
- package/dist/node_modules/axios/lib/platform/browser/index.js +0 -15
- package/dist/node_modules/axios/lib/platform/common/utils.js +0 -45
- package/dist/node_modules/axios/lib/platform/index.js +0 -9
- package/dist/node_modules/axios/lib/utils.js +0 -780
- package/dist/node_modules/class-variance-authority/dist/index.js +0 -44
- package/dist/node_modules/clsx/dist/clsx.js +0 -3
- package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +0 -1669
- package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +0 -37
- package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +0 -38
- package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -8
- package/dist/node_modules/lucide-react/dist/esm/Icon.js +0 -43
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +0 -30
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +0 -20
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left.js +0 -17
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-right.js +0 -17
- package/dist/node_modules/lucide-react/dist/esm/icons/check.js +0 -14
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.js +0 -14
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.js +0 -14
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js +0 -14
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-up.js +0 -14
- package/dist/node_modules/lucide-react/dist/esm/icons/circle.js +0 -14
- package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis.js +0 -18
- package/dist/node_modules/lucide-react/dist/esm/icons/x.js +0 -17
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +0 -28
- package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -560
- package/dist/node_modules/react-i18next/dist/es/IcuTransUtils/htmlEntityDecoder.js +0 -210
- package/dist/node_modules/react-i18next/dist/es/context.js +0 -18
- package/dist/node_modules/react-i18next/dist/es/defaults.js +0 -22
- package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +0 -7
- package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +0 -12
- package/dist/node_modules/react-i18next/dist/es/unescape.js +0 -27
- package/dist/node_modules/react-i18next/dist/es/useTranslation.js +0 -157
- package/dist/node_modules/react-i18next/dist/es/utils.js +0 -63
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -9
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -167
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -38
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -21
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -110
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -56
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -10
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -31
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -19
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -25
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -51
- package/dist/node_modules/sonner/dist/index.js +0 -299
- package/dist/node_modules/tslib/tslib.es6.js +0 -56
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -24
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -48
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -42
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -21
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -77
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -106
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -77
- package/dist/node_modules/use-sync-external-store/shim/index.js +0 -19
- package/dist/node_modules/zustand/esm/react.js +0 -22
- package/dist/node_modules/zustand/esm/vanilla.js +0 -24
- /package/src/{core/commands → commands}/create-core-module.js +0 -0
- /package/src/{core/commands → commands}/create-module.js +0 -0
- /package/src/{core/commands → commands}/create-template.js +0 -0
- /package/src/{core/commands → commands}/rollback-core-module.js +0 -0
- /package/src/{core/commands → commands}/rollback-module.js +0 -0
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { composeEventHandlers } from '../../primitive/dist/index.js';
|
|
3
|
-
import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
|
|
4
|
-
import { createContextScope, createContext as createContext2 } from '../../react-context/dist/index.js';
|
|
5
|
-
import { useId } from '../../react-id/dist/index.js';
|
|
6
|
-
import { useControllableState } from '../../react-use-controllable-state/dist/index.js';
|
|
7
|
-
import { DismissableLayer } from '../../react-dismissable-layer/dist/index.js';
|
|
8
|
-
import { FocusScope } from '../../react-focus-scope/dist/index.js';
|
|
9
|
-
import { Portal as Portal$1 } from '../../react-portal/dist/index.js';
|
|
10
|
-
import { Presence } from '../../react-presence/dist/index.js';
|
|
11
|
-
import { Primitive } from '../../react-primitive/dist/index.js';
|
|
12
|
-
import { useFocusGuards } from '../../react-focus-guards/dist/index.js';
|
|
13
|
-
import ReactRemoveScroll from '../../../react-remove-scroll/dist/es2015/Combination.js';
|
|
14
|
-
import { hideOthers } from '../../../aria-hidden/dist/es2015/index.js';
|
|
15
|
-
import { createSlot } from '../../react-slot/dist/index.js';
|
|
16
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
17
|
-
|
|
18
|
-
var DIALOG_NAME = "Dialog";
|
|
19
|
-
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
20
|
-
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
21
|
-
var Dialog = (props) => {
|
|
22
|
-
const {
|
|
23
|
-
__scopeDialog,
|
|
24
|
-
children,
|
|
25
|
-
open: openProp,
|
|
26
|
-
defaultOpen,
|
|
27
|
-
onOpenChange,
|
|
28
|
-
modal = true
|
|
29
|
-
} = props;
|
|
30
|
-
const triggerRef = React.useRef(null);
|
|
31
|
-
const contentRef = React.useRef(null);
|
|
32
|
-
const [open, setOpen] = useControllableState({
|
|
33
|
-
prop: openProp,
|
|
34
|
-
defaultProp: defaultOpen ?? false,
|
|
35
|
-
onChange: onOpenChange,
|
|
36
|
-
caller: DIALOG_NAME
|
|
37
|
-
});
|
|
38
|
-
return /* @__PURE__ */ jsx(
|
|
39
|
-
DialogProvider,
|
|
40
|
-
{
|
|
41
|
-
scope: __scopeDialog,
|
|
42
|
-
triggerRef,
|
|
43
|
-
contentRef,
|
|
44
|
-
contentId: useId(),
|
|
45
|
-
titleId: useId(),
|
|
46
|
-
descriptionId: useId(),
|
|
47
|
-
open,
|
|
48
|
-
onOpenChange: setOpen,
|
|
49
|
-
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
50
|
-
modal,
|
|
51
|
-
children
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
Dialog.displayName = DIALOG_NAME;
|
|
56
|
-
var TRIGGER_NAME = "DialogTrigger";
|
|
57
|
-
var DialogTrigger = React.forwardRef(
|
|
58
|
-
(props, forwardedRef) => {
|
|
59
|
-
const { __scopeDialog, ...triggerProps } = props;
|
|
60
|
-
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
61
|
-
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
62
|
-
return /* @__PURE__ */ jsx(
|
|
63
|
-
Primitive.button,
|
|
64
|
-
{
|
|
65
|
-
type: "button",
|
|
66
|
-
"aria-haspopup": "dialog",
|
|
67
|
-
"aria-expanded": context.open,
|
|
68
|
-
"aria-controls": context.contentId,
|
|
69
|
-
"data-state": getState(context.open),
|
|
70
|
-
...triggerProps,
|
|
71
|
-
ref: composedTriggerRef,
|
|
72
|
-
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
DialogTrigger.displayName = TRIGGER_NAME;
|
|
78
|
-
var PORTAL_NAME = "DialogPortal";
|
|
79
|
-
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
|
|
80
|
-
forceMount: void 0
|
|
81
|
-
});
|
|
82
|
-
var DialogPortal = (props) => {
|
|
83
|
-
const { __scopeDialog, forceMount, children, container } = props;
|
|
84
|
-
const context = useDialogContext(PORTAL_NAME, __scopeDialog);
|
|
85
|
-
return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React.Children.map(children, (child) => /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$1, { asChild: true, container, children: child }) })) });
|
|
86
|
-
};
|
|
87
|
-
DialogPortal.displayName = PORTAL_NAME;
|
|
88
|
-
var OVERLAY_NAME = "DialogOverlay";
|
|
89
|
-
var DialogOverlay = React.forwardRef(
|
|
90
|
-
(props, forwardedRef) => {
|
|
91
|
-
const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
|
|
92
|
-
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
93
|
-
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
94
|
-
return context.modal ? /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
DialogOverlay.displayName = OVERLAY_NAME;
|
|
98
|
-
var Slot = createSlot("DialogOverlay.RemoveScroll");
|
|
99
|
-
var DialogOverlayImpl = React.forwardRef(
|
|
100
|
-
(props, forwardedRef) => {
|
|
101
|
-
const { __scopeDialog, ...overlayProps } = props;
|
|
102
|
-
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
103
|
-
return (
|
|
104
|
-
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
105
|
-
// ie. when `Overlay` and `Content` are siblings
|
|
106
|
-
/* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(
|
|
107
|
-
Primitive.div,
|
|
108
|
-
{
|
|
109
|
-
"data-state": getState(context.open),
|
|
110
|
-
...overlayProps,
|
|
111
|
-
ref: forwardedRef,
|
|
112
|
-
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
113
|
-
}
|
|
114
|
-
) })
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
);
|
|
118
|
-
var CONTENT_NAME = "DialogContent";
|
|
119
|
-
var DialogContent = React.forwardRef(
|
|
120
|
-
(props, forwardedRef) => {
|
|
121
|
-
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
|
|
122
|
-
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
123
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
124
|
-
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
125
|
-
}
|
|
126
|
-
);
|
|
127
|
-
DialogContent.displayName = CONTENT_NAME;
|
|
128
|
-
var DialogContentModal = React.forwardRef(
|
|
129
|
-
(props, forwardedRef) => {
|
|
130
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
131
|
-
const contentRef = React.useRef(null);
|
|
132
|
-
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
133
|
-
React.useEffect(() => {
|
|
134
|
-
const content = contentRef.current;
|
|
135
|
-
if (content) return hideOthers(content);
|
|
136
|
-
}, []);
|
|
137
|
-
return /* @__PURE__ */ jsx(
|
|
138
|
-
DialogContentImpl,
|
|
139
|
-
{
|
|
140
|
-
...props,
|
|
141
|
-
ref: composedRefs,
|
|
142
|
-
trapFocus: context.open,
|
|
143
|
-
disableOutsidePointerEvents: true,
|
|
144
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
145
|
-
event.preventDefault();
|
|
146
|
-
context.triggerRef.current?.focus();
|
|
147
|
-
}),
|
|
148
|
-
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
149
|
-
const originalEvent = event.detail.originalEvent;
|
|
150
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
151
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
152
|
-
if (isRightClick) event.preventDefault();
|
|
153
|
-
}),
|
|
154
|
-
onFocusOutside: composeEventHandlers(
|
|
155
|
-
props.onFocusOutside,
|
|
156
|
-
(event) => event.preventDefault()
|
|
157
|
-
)
|
|
158
|
-
}
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
);
|
|
162
|
-
var DialogContentNonModal = React.forwardRef(
|
|
163
|
-
(props, forwardedRef) => {
|
|
164
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
165
|
-
const hasInteractedOutsideRef = React.useRef(false);
|
|
166
|
-
const hasPointerDownOutsideRef = React.useRef(false);
|
|
167
|
-
return /* @__PURE__ */ jsx(
|
|
168
|
-
DialogContentImpl,
|
|
169
|
-
{
|
|
170
|
-
...props,
|
|
171
|
-
ref: forwardedRef,
|
|
172
|
-
trapFocus: false,
|
|
173
|
-
disableOutsidePointerEvents: false,
|
|
174
|
-
onCloseAutoFocus: (event) => {
|
|
175
|
-
props.onCloseAutoFocus?.(event);
|
|
176
|
-
if (!event.defaultPrevented) {
|
|
177
|
-
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
178
|
-
event.preventDefault();
|
|
179
|
-
}
|
|
180
|
-
hasInteractedOutsideRef.current = false;
|
|
181
|
-
hasPointerDownOutsideRef.current = false;
|
|
182
|
-
},
|
|
183
|
-
onInteractOutside: (event) => {
|
|
184
|
-
props.onInteractOutside?.(event);
|
|
185
|
-
if (!event.defaultPrevented) {
|
|
186
|
-
hasInteractedOutsideRef.current = true;
|
|
187
|
-
if (event.detail.originalEvent.type === "pointerdown") {
|
|
188
|
-
hasPointerDownOutsideRef.current = true;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
const target = event.target;
|
|
192
|
-
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
193
|
-
if (targetIsTrigger) event.preventDefault();
|
|
194
|
-
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
195
|
-
event.preventDefault();
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
);
|
|
202
|
-
var DialogContentImpl = React.forwardRef(
|
|
203
|
-
(props, forwardedRef) => {
|
|
204
|
-
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
|
|
205
|
-
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
206
|
-
const contentRef = React.useRef(null);
|
|
207
|
-
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
208
|
-
useFocusGuards();
|
|
209
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
210
|
-
/* @__PURE__ */ jsx(
|
|
211
|
-
FocusScope,
|
|
212
|
-
{
|
|
213
|
-
asChild: true,
|
|
214
|
-
loop: true,
|
|
215
|
-
trapped: trapFocus,
|
|
216
|
-
onMountAutoFocus: onOpenAutoFocus,
|
|
217
|
-
onUnmountAutoFocus: onCloseAutoFocus,
|
|
218
|
-
children: /* @__PURE__ */ jsx(
|
|
219
|
-
DismissableLayer,
|
|
220
|
-
{
|
|
221
|
-
role: "dialog",
|
|
222
|
-
id: context.contentId,
|
|
223
|
-
"aria-describedby": context.descriptionId,
|
|
224
|
-
"aria-labelledby": context.titleId,
|
|
225
|
-
"data-state": getState(context.open),
|
|
226
|
-
...contentProps,
|
|
227
|
-
ref: composedRefs,
|
|
228
|
-
onDismiss: () => context.onOpenChange(false)
|
|
229
|
-
}
|
|
230
|
-
)
|
|
231
|
-
}
|
|
232
|
-
),
|
|
233
|
-
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
234
|
-
/* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }),
|
|
235
|
-
/* @__PURE__ */ jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
|
|
236
|
-
] })
|
|
237
|
-
] });
|
|
238
|
-
}
|
|
239
|
-
);
|
|
240
|
-
var TITLE_NAME = "DialogTitle";
|
|
241
|
-
var DialogTitle = React.forwardRef(
|
|
242
|
-
(props, forwardedRef) => {
|
|
243
|
-
const { __scopeDialog, ...titleProps } = props;
|
|
244
|
-
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
245
|
-
return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
246
|
-
}
|
|
247
|
-
);
|
|
248
|
-
DialogTitle.displayName = TITLE_NAME;
|
|
249
|
-
var DESCRIPTION_NAME = "DialogDescription";
|
|
250
|
-
var DialogDescription = React.forwardRef(
|
|
251
|
-
(props, forwardedRef) => {
|
|
252
|
-
const { __scopeDialog, ...descriptionProps } = props;
|
|
253
|
-
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
254
|
-
return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
255
|
-
}
|
|
256
|
-
);
|
|
257
|
-
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
258
|
-
var CLOSE_NAME = "DialogClose";
|
|
259
|
-
var DialogClose = React.forwardRef(
|
|
260
|
-
(props, forwardedRef) => {
|
|
261
|
-
const { __scopeDialog, ...closeProps } = props;
|
|
262
|
-
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
263
|
-
return /* @__PURE__ */ jsx(
|
|
264
|
-
Primitive.button,
|
|
265
|
-
{
|
|
266
|
-
type: "button",
|
|
267
|
-
...closeProps,
|
|
268
|
-
ref: forwardedRef,
|
|
269
|
-
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
);
|
|
274
|
-
DialogClose.displayName = CLOSE_NAME;
|
|
275
|
-
function getState(open) {
|
|
276
|
-
return open ? "open" : "closed";
|
|
277
|
-
}
|
|
278
|
-
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
279
|
-
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
280
|
-
contentName: CONTENT_NAME,
|
|
281
|
-
titleName: TITLE_NAME,
|
|
282
|
-
docsSlug: "dialog"
|
|
283
|
-
});
|
|
284
|
-
var TitleWarning = ({ titleId }) => {
|
|
285
|
-
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
286
|
-
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
287
|
-
|
|
288
|
-
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
289
|
-
|
|
290
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
291
|
-
React.useEffect(() => {
|
|
292
|
-
if (titleId) {
|
|
293
|
-
const hasTitle = document.getElementById(titleId);
|
|
294
|
-
if (!hasTitle) console.error(MESSAGE);
|
|
295
|
-
}
|
|
296
|
-
}, [MESSAGE, titleId]);
|
|
297
|
-
return null;
|
|
298
|
-
};
|
|
299
|
-
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
300
|
-
var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
301
|
-
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
302
|
-
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
303
|
-
React.useEffect(() => {
|
|
304
|
-
const describedById = contentRef.current?.getAttribute("aria-describedby");
|
|
305
|
-
if (descriptionId && describedById) {
|
|
306
|
-
const hasDescription = document.getElementById(descriptionId);
|
|
307
|
-
if (!hasDescription) console.warn(MESSAGE);
|
|
308
|
-
}
|
|
309
|
-
}, [MESSAGE, contentRef, descriptionId]);
|
|
310
|
-
return null;
|
|
311
|
-
};
|
|
312
|
-
var Root = Dialog;
|
|
313
|
-
var Trigger = DialogTrigger;
|
|
314
|
-
var Portal = DialogPortal;
|
|
315
|
-
var Overlay = DialogOverlay;
|
|
316
|
-
var Content = DialogContent;
|
|
317
|
-
var Title = DialogTitle;
|
|
318
|
-
var Description = DialogDescription;
|
|
319
|
-
var Close = DialogClose;
|
|
320
|
-
|
|
321
|
-
export { Close, Content, Description, Dialog, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Overlay, Portal, Root, Title, Trigger, WarningProvider, createDialogScope };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
// packages/react/direction/src/direction.tsx
|
|
5
|
-
var DirectionContext = React.createContext(void 0);
|
|
6
|
-
function useDirection(localDir) {
|
|
7
|
-
const globalDir = React.useContext(DirectionContext);
|
|
8
|
-
return localDir || globalDir || "ltr";
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { useDirection };
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { composeEventHandlers } from '../../primitive/dist/index.js';
|
|
3
|
-
import { Primitive, dispatchDiscreteCustomEvent } from '../../react-primitive/dist/index.js';
|
|
4
|
-
import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
|
|
5
|
-
import { useCallbackRef } from '../../react-use-callback-ref/dist/index.js';
|
|
6
|
-
import { useEscapeKeydown } from '../../react-use-escape-keydown/dist/index.js';
|
|
7
|
-
import { jsx } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
10
|
-
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
11
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
12
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
13
|
-
var originalBodyPointerEvents;
|
|
14
|
-
var DismissableLayerContext = React.createContext({
|
|
15
|
-
layers: /* @__PURE__ */ new Set(),
|
|
16
|
-
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
17
|
-
branches: /* @__PURE__ */ new Set()
|
|
18
|
-
});
|
|
19
|
-
var DismissableLayer = React.forwardRef(
|
|
20
|
-
(props, forwardedRef) => {
|
|
21
|
-
const {
|
|
22
|
-
disableOutsidePointerEvents = false,
|
|
23
|
-
onEscapeKeyDown,
|
|
24
|
-
onPointerDownOutside,
|
|
25
|
-
onFocusOutside,
|
|
26
|
-
onInteractOutside,
|
|
27
|
-
onDismiss,
|
|
28
|
-
...layerProps
|
|
29
|
-
} = props;
|
|
30
|
-
const context = React.useContext(DismissableLayerContext);
|
|
31
|
-
const [node, setNode] = React.useState(null);
|
|
32
|
-
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
33
|
-
const [, force] = React.useState({});
|
|
34
|
-
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
35
|
-
const layers = Array.from(context.layers);
|
|
36
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
37
|
-
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
38
|
-
const index = node ? layers.indexOf(node) : -1;
|
|
39
|
-
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
40
|
-
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
41
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
42
|
-
const target = event.target;
|
|
43
|
-
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
44
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
45
|
-
onPointerDownOutside?.(event);
|
|
46
|
-
onInteractOutside?.(event);
|
|
47
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
48
|
-
}, ownerDocument);
|
|
49
|
-
const focusOutside = useFocusOutside((event) => {
|
|
50
|
-
const target = event.target;
|
|
51
|
-
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
52
|
-
if (isFocusInBranch) return;
|
|
53
|
-
onFocusOutside?.(event);
|
|
54
|
-
onInteractOutside?.(event);
|
|
55
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
56
|
-
}, ownerDocument);
|
|
57
|
-
useEscapeKeydown((event) => {
|
|
58
|
-
const isHighestLayer = index === context.layers.size - 1;
|
|
59
|
-
if (!isHighestLayer) return;
|
|
60
|
-
onEscapeKeyDown?.(event);
|
|
61
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
62
|
-
event.preventDefault();
|
|
63
|
-
onDismiss();
|
|
64
|
-
}
|
|
65
|
-
}, ownerDocument);
|
|
66
|
-
React.useEffect(() => {
|
|
67
|
-
if (!node) return;
|
|
68
|
-
if (disableOutsidePointerEvents) {
|
|
69
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
70
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
71
|
-
ownerDocument.body.style.pointerEvents = "none";
|
|
72
|
-
}
|
|
73
|
-
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
74
|
-
}
|
|
75
|
-
context.layers.add(node);
|
|
76
|
-
dispatchUpdate();
|
|
77
|
-
return () => {
|
|
78
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
79
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
83
|
-
React.useEffect(() => {
|
|
84
|
-
return () => {
|
|
85
|
-
if (!node) return;
|
|
86
|
-
context.layers.delete(node);
|
|
87
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
88
|
-
dispatchUpdate();
|
|
89
|
-
};
|
|
90
|
-
}, [node, context]);
|
|
91
|
-
React.useEffect(() => {
|
|
92
|
-
const handleUpdate = () => force({});
|
|
93
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
94
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
95
|
-
}, []);
|
|
96
|
-
return /* @__PURE__ */ jsx(
|
|
97
|
-
Primitive.div,
|
|
98
|
-
{
|
|
99
|
-
...layerProps,
|
|
100
|
-
ref: composedRefs,
|
|
101
|
-
style: {
|
|
102
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
103
|
-
...props.style
|
|
104
|
-
},
|
|
105
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
106
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
107
|
-
onPointerDownCapture: composeEventHandlers(
|
|
108
|
-
props.onPointerDownCapture,
|
|
109
|
-
pointerDownOutside.onPointerDownCapture
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
);
|
|
115
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
116
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
117
|
-
var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
|
|
118
|
-
const context = React.useContext(DismissableLayerContext);
|
|
119
|
-
const ref = React.useRef(null);
|
|
120
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
121
|
-
React.useEffect(() => {
|
|
122
|
-
const node = ref.current;
|
|
123
|
-
if (node) {
|
|
124
|
-
context.branches.add(node);
|
|
125
|
-
return () => {
|
|
126
|
-
context.branches.delete(node);
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
}, [context.branches]);
|
|
130
|
-
return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
131
|
-
});
|
|
132
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
133
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
134
|
-
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
135
|
-
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
136
|
-
const handleClickRef = React.useRef(() => {
|
|
137
|
-
});
|
|
138
|
-
React.useEffect(() => {
|
|
139
|
-
const handlePointerDown = (event) => {
|
|
140
|
-
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
141
|
-
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
142
|
-
handleAndDispatchCustomEvent(
|
|
143
|
-
POINTER_DOWN_OUTSIDE,
|
|
144
|
-
handlePointerDownOutside,
|
|
145
|
-
eventDetail,
|
|
146
|
-
{ discrete: true }
|
|
147
|
-
);
|
|
148
|
-
};
|
|
149
|
-
const eventDetail = { originalEvent: event };
|
|
150
|
-
if (event.pointerType === "touch") {
|
|
151
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
152
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
153
|
-
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
154
|
-
} else {
|
|
155
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
156
|
-
}
|
|
157
|
-
} else {
|
|
158
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
159
|
-
}
|
|
160
|
-
isPointerInsideReactTreeRef.current = false;
|
|
161
|
-
};
|
|
162
|
-
const timerId = window.setTimeout(() => {
|
|
163
|
-
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
164
|
-
}, 0);
|
|
165
|
-
return () => {
|
|
166
|
-
window.clearTimeout(timerId);
|
|
167
|
-
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
168
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
169
|
-
};
|
|
170
|
-
}, [ownerDocument, handlePointerDownOutside]);
|
|
171
|
-
return {
|
|
172
|
-
// ensures we check React component tree (not just DOM tree)
|
|
173
|
-
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
177
|
-
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
178
|
-
const isFocusInsideReactTreeRef = React.useRef(false);
|
|
179
|
-
React.useEffect(() => {
|
|
180
|
-
const handleFocus = (event) => {
|
|
181
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
182
|
-
const eventDetail = { originalEvent: event };
|
|
183
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
184
|
-
discrete: false
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
ownerDocument.addEventListener("focusin", handleFocus);
|
|
189
|
-
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
190
|
-
}, [ownerDocument, handleFocusOutside]);
|
|
191
|
-
return {
|
|
192
|
-
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
193
|
-
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
function dispatchUpdate() {
|
|
197
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
198
|
-
document.dispatchEvent(event);
|
|
199
|
-
}
|
|
200
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
201
|
-
const target = detail.originalEvent.target;
|
|
202
|
-
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
203
|
-
if (handler) target.addEventListener(name, handler, { once: true });
|
|
204
|
-
if (discrete) {
|
|
205
|
-
dispatchDiscreteCustomEvent(target, event);
|
|
206
|
-
} else {
|
|
207
|
-
target.dispatchEvent(event);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export { DismissableLayer, DismissableLayerBranch };
|