@monimesl/dot-renderer-react 0.1.0-alpha.7 → 0.1.0-alpha.9
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/README.md +39 -1
- package/dist/LICENSE-PHOSPHOR +21 -21
- package/dist/_virtual/_rolldown/runtime.js +14 -0
- package/dist/_virtual/builtin_esm-external-require-react.js +9 -0
- package/dist/color.js +105 -0
- package/dist/components/amount-input.d.ts +6 -0
- package/dist/components/amount-input.js +106 -0
- package/dist/components/button.d.ts +6 -0
- package/dist/components/button.js +42 -0
- package/dist/components/carousel.d.ts +6 -0
- package/dist/components/carousel.js +254 -0
- package/dist/components/chip.d.ts +6 -0
- package/dist/components/chip.js +41 -0
- package/dist/components/code-input.d.ts +6 -0
- package/dist/components/code-input.js +97 -0
- package/dist/components/detail-row.d.ts +6 -0
- package/dist/components/detail-row.js +40 -0
- package/dist/components/divider.d.ts +6 -0
- package/dist/components/divider.js +18 -0
- package/dist/components/empty-state.d.ts +6 -0
- package/dist/components/empty-state.js +66 -0
- package/dist/components/feedback.d.ts +8 -0
- package/dist/components/feedback.js +85 -0
- package/dist/components/field-box.js +44 -0
- package/dist/components/field.js +43 -0
- package/dist/components/footer.d.ts +6 -0
- package/dist/components/footer.js +24 -0
- package/dist/components/grid.d.ts +7 -0
- package/dist/components/grid.js +98 -0
- package/dist/components/icon-artwork.js +74 -0
- package/dist/components/icon.d.ts +6 -0
- package/dist/components/icon.js +40 -0
- package/dist/components/image.d.ts +6 -0
- package/dist/components/image.js +40 -0
- package/dist/components/index.d.ts +30 -0
- package/dist/components/index.js +72 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +86 -0
- package/dist/components/link.d.ts +6 -0
- package/dist/components/link.js +39 -0
- package/dist/components/list.d.ts +7 -0
- package/dist/components/list.js +143 -0
- package/dist/components/option-place.js +9 -0
- package/dist/components/option.d.ts +6 -0
- package/dist/components/option.js +43 -0
- package/dist/components/padding.d.ts +2 -0
- package/dist/components/padding.js +27 -0
- package/dist/components/pressable.js +17 -0
- package/dist/components/qr-code.d.ts +6 -0
- package/dist/components/qr-code.js +58 -0
- package/dist/components/scroll.d.ts +6 -0
- package/dist/components/scroll.js +55 -0
- package/dist/components/select.d.ts +6 -0
- package/dist/components/select.js +92 -0
- package/dist/components/sheet.d.ts +8 -0
- package/dist/components/sheet.js +105 -0
- package/dist/components/skeleton.d.ts +6 -0
- package/dist/components/skeleton.js +55 -0
- package/dist/components/spinner.d.ts +6 -0
- package/dist/components/spinner.js +48 -0
- package/dist/components/tabs.d.ts +7 -0
- package/dist/components/tabs.js +91 -0
- package/dist/components/text-area.d.ts +6 -0
- package/dist/components/text-area.js +42 -0
- package/dist/components/text.d.ts +6 -0
- package/dist/components/text.js +46 -0
- package/dist/components/toast.d.ts +6 -0
- package/dist/components/toast.js +56 -0
- package/dist/components/toggles.d.ts +9 -0
- package/dist/components/toggles.js +149 -0
- package/dist/components/tokens.js +37 -0
- package/dist/components/tones.js +24 -0
- package/dist/components/typed-text.js +28 -0
- package/dist/components/view.d.ts +6 -0
- package/dist/components/view.js +51 -0
- package/dist/index.d.ts +35 -64
- package/dist/index.js +32 -22636
- package/dist/page-root.d.ts +2 -0
- package/dist/page-root.js +20 -0
- package/dist/portal.js +8 -0
- package/dist/renderer.d.ts +17 -0
- package/dist/renderer.js +33 -0
- package/dist/root.d.ts +10 -0
- package/dist/root.js +51 -0
- package/dist/styles.css +95 -1
- package/dist/theme.d.ts +25 -0
- package/dist/theme.js +84 -0
- package/dist/types.d.ts +7 -0
- package/dist/vendor/@base-ui/react/checkbox/indicator/CheckboxIndicator.js +51 -0
- package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRoot.js +265 -0
- package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRootDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/checkbox/utils/getCheckboxStateAttributesMapping.js +15 -0
- package/dist/vendor/@base-ui/react/checkbox-group/CheckboxGroupContext.js +10 -0
- package/dist/vendor/@base-ui/react/dialog/backdrop/DialogBackdrop.js +40 -0
- package/dist/vendor/@base-ui/react/dialog/close/DialogClose.js +39 -0
- package/dist/vendor/@base-ui/react/dialog/popup/DialogPopup.js +92 -0
- package/dist/vendor/@base-ui/react/dialog/popup/DialogPopupCssVars.js +8 -0
- package/dist/vendor/@base-ui/react/dialog/popup/DialogPopupDataAttributes.js +7 -0
- package/dist/vendor/@base-ui/react/dialog/portal/DialogPortal.js +38 -0
- package/dist/vendor/@base-ui/react/dialog/portal/DialogPortalContext.js +13 -0
- package/dist/vendor/@base-ui/react/dialog/root/DialogRoot.js +16 -0
- package/dist/vendor/@base-ui/react/dialog/root/DialogRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/dialog/root/useDialogRoot.js +77 -0
- package/dist/vendor/@base-ui/react/dialog/root/useRenderDialogRoot.js +65 -0
- package/dist/vendor/@base-ui/react/dialog/store/DialogStore.js +70 -0
- package/dist/vendor/@base-ui/react/dialog/title/DialogTitle.js +25 -0
- package/dist/vendor/@base-ui/react/dialog/utils/stateAttributesMapping.js +17 -0
- package/dist/vendor/@base-ui/react/field/control/FieldControlDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/field/item/FieldItemContext.js +10 -0
- package/dist/vendor/@base-ui/react/field/root/useFieldValidation.js +18 -0
- package/dist/vendor/@base-ui/react/fieldset/root/FieldsetRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingFocusManager.js +477 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingPortal.js +165 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingRootStore.js +65 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingTree.js +22 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/hooks/useDismiss.js +373 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.js +58 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/composite.js +40 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/constants.js +5 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/createAttribute.js +6 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/createEventEmitter.js +18 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/element.js +26 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/enqueueFocus.js +25 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/event.js +25 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/markOthers.js +116 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/nodes.js +16 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/tabbable.js +135 -0
- package/dist/vendor/@base-ui/react/internals/TransitionStatusDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/internals/composite/composite.js +89 -0
- package/dist/vendor/@base-ui/react/internals/composite/constants.js +4 -0
- package/dist/vendor/@base-ui/react/internals/composite/item/CompositeItem.js +21 -0
- package/dist/vendor/@base-ui/react/internals/composite/item/useCompositeItem.js +31 -0
- package/dist/vendor/@base-ui/react/internals/composite/list/CompositeList.js +180 -0
- package/dist/vendor/@base-ui/react/internals/composite/list/CompositeListContext.js +15 -0
- package/dist/vendor/@base-ui/react/internals/composite/list/useCompositeListItem.js +54 -0
- package/dist/vendor/@base-ui/react/internals/composite/root/CompositeRoot.js +62 -0
- package/dist/vendor/@base-ui/react/internals/composite/root/CompositeRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/internals/composite/root/useCompositeRoot.js +170 -0
- package/dist/vendor/@base-ui/react/internals/constants.js +18 -0
- package/dist/vendor/@base-ui/react/internals/createBaseUIEventDetails.js +40 -0
- package/dist/vendor/@base-ui/react/internals/direction-context/DirectionContext.js +10 -0
- package/dist/vendor/@base-ui/react/internals/field-constants/constants.js +33 -0
- package/dist/vendor/@base-ui/react/internals/field-register-control/useRegisterFieldControl.js +40 -0
- package/dist/vendor/@base-ui/react/internals/field-root-context/FieldRootContext.js +45 -0
- package/dist/vendor/@base-ui/react/internals/form-context/FormContext.js +18 -0
- package/dist/vendor/@base-ui/react/internals/getStateAttributesProps.js +17 -0
- package/dist/vendor/@base-ui/react/internals/labelable-provider/LabelableContext.js +24 -0
- package/dist/vendor/@base-ui/react/internals/labelable-provider/useAriaLabelledBy.js +35 -0
- package/dist/vendor/@base-ui/react/internals/labelable-provider/useLabelableId.js +57 -0
- package/dist/vendor/@base-ui/react/internals/reason-parts.js +14 -0
- package/dist/vendor/@base-ui/react/internals/serializeValue.js +12 -0
- package/dist/vendor/@base-ui/react/internals/stateAttributesMapping.js +11 -0
- package/dist/vendor/@base-ui/react/internals/use-button/useButton.js +137 -0
- package/dist/vendor/@base-ui/react/internals/useAnimationsFinished.js +94 -0
- package/dist/vendor/@base-ui/react/internals/useBaseUiId.js +13 -0
- package/dist/vendor/@base-ui/react/internals/useOpenChangeComplete.js +28 -0
- package/dist/vendor/@base-ui/react/internals/useRenderElement.js +109 -0
- package/dist/vendor/@base-ui/react/internals/useTransitionStatus.js +70 -0
- package/dist/vendor/@base-ui/react/internals/useValueChanged.js +15 -0
- package/dist/vendor/@base-ui/react/merge-props/mergeProps.js +153 -0
- package/dist/vendor/@base-ui/react/radio/indicator/RadioIndicator.js +46 -0
- package/dist/vendor/@base-ui/react/radio/root/RadioRoot.js +179 -0
- package/dist/vendor/@base-ui/react/radio/root/RadioRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/radio/root/RadioRootDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/radio/utils/stateAttributesMapping.js +14 -0
- package/dist/vendor/@base-ui/react/radio-group/RadioGroup.js +170 -0
- package/dist/vendor/@base-ui/react/radio-group/RadioGroupContext.js +10 -0
- package/dist/vendor/@base-ui/react/switch/root/SwitchRoot.js +170 -0
- package/dist/vendor/@base-ui/react/switch/root/SwitchRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/switch/root/SwitchRootDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/switch/stateAttributesMapping.js +12 -0
- package/dist/vendor/@base-ui/react/switch/thumb/SwitchThumb.js +25 -0
- package/dist/vendor/@base-ui/react/tabs/list/TabsList.js +98 -0
- package/dist/vendor/@base-ui/react/tabs/list/TabsListContext.js +13 -0
- package/dist/vendor/@base-ui/react/tabs/root/TabsRoot.js +213 -0
- package/dist/vendor/@base-ui/react/tabs/root/TabsRootContext.js +16 -0
- package/dist/vendor/@base-ui/react/tabs/root/TabsRootDataAttributes.js +8 -0
- package/dist/vendor/@base-ui/react/tabs/root/stateAttributesMapping.js +5 -0
- package/dist/vendor/@base-ui/react/tabs/tab/TabsTab.js +137 -0
- package/dist/vendor/@base-ui/react/utils/CommonPopupDataAttributes.js +24 -0
- package/dist/vendor/@base-ui/react/utils/CommonTriggerDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/utils/FocusGuard.js +32 -0
- package/dist/vendor/@base-ui/react/utils/InternalBackdrop.js +30 -0
- package/dist/vendor/@base-ui/react/utils/dispatchClickWithModifiers.js +25 -0
- package/dist/vendor/@base-ui/react/utils/popupStateMapping.js +22 -0
- package/dist/vendor/@base-ui/react/utils/popups/popupStoreUtils.js +247 -0
- package/dist/vendor/@base-ui/react/utils/popups/popupTriggerMap.js +96 -0
- package/dist/vendor/@base-ui/react/utils/popups/store.js +94 -0
- package/dist/vendor/@base-ui/react/utils/resolveClassName.js +13 -0
- package/dist/vendor/@base-ui/react/utils/resolveRef.js +11 -0
- package/dist/vendor/@base-ui/react/utils/resolveStyle.js +13 -0
- package/dist/vendor/@base-ui/react/utils/useFocusableWhenDisabled.js +30 -0
- package/dist/vendor/@base-ui/utils/addEventListener.js +12 -0
- package/dist/vendor/@base-ui/utils/createLogOnce.js +20 -0
- package/dist/vendor/@base-ui/utils/empty.js +6 -0
- package/dist/vendor/@base-ui/utils/error.js +5 -0
- package/dist/vendor/@base-ui/utils/fastHooks.js +68 -0
- package/dist/vendor/@base-ui/utils/formatErrorMessage.js +27 -0
- package/dist/vendor/@base-ui/utils/getDefaultFormSubmitter.js +25 -0
- package/dist/vendor/@base-ui/utils/getReactElementRef.js +14 -0
- package/dist/vendor/@base-ui/utils/inertValue.js +8 -0
- package/dist/vendor/@base-ui/utils/isElementDisabled.js +6 -0
- package/dist/vendor/@base-ui/utils/mergeCleanups.js +14 -0
- package/dist/vendor/@base-ui/utils/mergeObjects.js +11 -0
- package/dist/vendor/@base-ui/utils/owner.js +7 -0
- package/dist/vendor/@base-ui/utils/platform/engine.js +8 -0
- package/dist/vendor/@base-ui/utils/platform/env.js +6 -0
- package/dist/vendor/@base-ui/utils/platform/os.js +15 -0
- package/dist/vendor/@base-ui/utils/platform/screen-reader.js +9 -0
- package/dist/vendor/@base-ui/utils/platform/shared.js +36 -0
- package/dist/vendor/@base-ui/utils/reactVersion.js +8 -0
- package/dist/vendor/@base-ui/utils/safeReact.js +13 -0
- package/dist/vendor/@base-ui/utils/shadowDom.js +26 -0
- package/dist/vendor/@base-ui/utils/store/ReactStore.js +181 -0
- package/dist/vendor/@base-ui/utils/store/Store.js +102 -0
- package/dist/vendor/@base-ui/utils/store/useStore.js +97 -0
- package/dist/vendor/@base-ui/utils/useAnimationFrame.js +87 -0
- package/dist/vendor/@base-ui/utils/useControlled.js +52 -0
- package/dist/vendor/@base-ui/utils/useId.js +32 -0
- package/dist/vendor/@base-ui/utils/useIsoLayoutEffect.js +7 -0
- package/dist/vendor/@base-ui/utils/useMergedRefs.js +87 -0
- package/dist/vendor/@base-ui/utils/useOnMount.js +12 -0
- package/dist/vendor/@base-ui/utils/useRefWithInit.js +18 -0
- package/dist/vendor/@base-ui/utils/useScrollLock.js +206 -0
- package/dist/vendor/@base-ui/utils/useStableCallback.js +38 -0
- package/dist/vendor/@base-ui/utils/useTimeout.js +43 -0
- package/dist/vendor/@base-ui/utils/useValueAsRef.js +27 -0
- package/dist/vendor/@base-ui/utils/visuallyHidden.js +23 -0
- package/dist/vendor/@base-ui/utils/warn.js +5 -0
- package/dist/vendor/@floating-ui/utils/dist/floating-ui.utils.dom.js +49 -0
- package/dist/vendor/uqr/dist/index.js +858 -0
- package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +74 -0
- package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +77 -0
- package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +69 -0
- package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +64 -0
- package/dist/vendor/use-sync-external-store/shim/index.js +11 -0
- package/dist/vendor/use-sync-external-store/shim/with-selector.js +11 -0
- package/package.json +8 -14
- package/dist/garra-versions.json +0 -7
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRenderElement } from "../../internals/useRenderElement.js";
|
|
3
|
+
import { useSwitchRootContext } from "../root/SwitchRootContext.js";
|
|
4
|
+
import { stateAttributesMapping } from "../stateAttributesMapping.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/switch/thumb/SwitchThumb.mjs
|
|
7
|
+
/**
|
|
8
|
+
* The movable part of the switch that indicates whether the switch is on or off.
|
|
9
|
+
* Renders a `<span>`.
|
|
10
|
+
*
|
|
11
|
+
* Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)
|
|
12
|
+
*/
|
|
13
|
+
const SwitchThumb = /*#__PURE__*/ React.forwardRef(function SwitchThumb(componentProps, forwardedRef) {
|
|
14
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
15
|
+
const state = useSwitchRootContext();
|
|
16
|
+
return useRenderElement("span", componentProps, {
|
|
17
|
+
state,
|
|
18
|
+
ref: forwardedRef,
|
|
19
|
+
stateAttributesMapping,
|
|
20
|
+
props: elementProps
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
if (process.env.NODE_ENV !== "production") SwitchThumb.displayName = "SwitchThumb";
|
|
24
|
+
//#endregion
|
|
25
|
+
export { SwitchThumb };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EMPTY_ARRAY } from "../../../utils/empty.js";
|
|
3
|
+
import { useStableCallback } from "../../../utils/useStableCallback.js";
|
|
4
|
+
import { useIsoLayoutEffect } from "../../../utils/useIsoLayoutEffect.js";
|
|
5
|
+
import { useTabsRootContext } from "../root/TabsRootContext.js";
|
|
6
|
+
import { tabsStateAttributesMapping } from "../root/stateAttributesMapping.js";
|
|
7
|
+
import { TabsListContext } from "./TabsListContext.js";
|
|
8
|
+
import { CompositeRoot } from "../../internals/composite/root/CompositeRoot.js";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/tabs/list/TabsList.mjs
|
|
12
|
+
/**
|
|
13
|
+
* Groups the individual tab buttons.
|
|
14
|
+
* Renders a `<div>` element.
|
|
15
|
+
*
|
|
16
|
+
* Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)
|
|
17
|
+
*/
|
|
18
|
+
const TabsList = /*#__PURE__*/ React.forwardRef(function TabsList(componentProps, forwardedRef) {
|
|
19
|
+
const { activateOnFocus = false, className, loopFocus = true, render, style, ...elementProps } = componentProps;
|
|
20
|
+
const { orientation, setTabMap, tabActivationDirection } = useTabsRootContext();
|
|
21
|
+
const [highlightedTabIndex, setHighlightedTabIndex] = React.useState(0);
|
|
22
|
+
const [tabsListElement, setTabsListElement] = React.useState(null);
|
|
23
|
+
const indicatorUpdateListenersRef = React.useRef(/* @__PURE__ */ new Set());
|
|
24
|
+
const tabResizeObserverElementsRef = React.useRef(/* @__PURE__ */ new Set());
|
|
25
|
+
const resizeObserverRef = React.useRef(null);
|
|
26
|
+
useIsoLayoutEffect(() => {
|
|
27
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
28
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
29
|
+
indicatorUpdateListenersRef.current.forEach((listener) => {
|
|
30
|
+
listener();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
resizeObserverRef.current = resizeObserver;
|
|
34
|
+
if (tabsListElement) resizeObserver.observe(tabsListElement);
|
|
35
|
+
tabResizeObserverElementsRef.current.forEach((element) => {
|
|
36
|
+
resizeObserver.observe(element);
|
|
37
|
+
});
|
|
38
|
+
return () => {
|
|
39
|
+
resizeObserver.disconnect();
|
|
40
|
+
resizeObserverRef.current = null;
|
|
41
|
+
};
|
|
42
|
+
}, [tabsListElement]);
|
|
43
|
+
const registerIndicatorUpdateListener = useStableCallback((listener) => {
|
|
44
|
+
indicatorUpdateListenersRef.current.add(listener);
|
|
45
|
+
return () => {
|
|
46
|
+
indicatorUpdateListenersRef.current.delete(listener);
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
const registerTabResizeObserverElement = useStableCallback((element) => {
|
|
50
|
+
tabResizeObserverElementsRef.current.add(element);
|
|
51
|
+
resizeObserverRef.current?.observe(element);
|
|
52
|
+
return () => {
|
|
53
|
+
tabResizeObserverElementsRef.current.delete(element);
|
|
54
|
+
resizeObserverRef.current?.unobserve(element);
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
const state = {
|
|
58
|
+
orientation,
|
|
59
|
+
tabActivationDirection
|
|
60
|
+
};
|
|
61
|
+
const defaultProps = {
|
|
62
|
+
"aria-orientation": orientation === "vertical" ? "vertical" : void 0,
|
|
63
|
+
role: "tablist"
|
|
64
|
+
};
|
|
65
|
+
const tabsListContextValue = React.useMemo(() => ({
|
|
66
|
+
activateOnFocus,
|
|
67
|
+
registerIndicatorUpdateListener,
|
|
68
|
+
registerTabResizeObserverElement,
|
|
69
|
+
tabsListElement
|
|
70
|
+
}), [
|
|
71
|
+
activateOnFocus,
|
|
72
|
+
registerIndicatorUpdateListener,
|
|
73
|
+
registerTabResizeObserverElement,
|
|
74
|
+
tabsListElement
|
|
75
|
+
]);
|
|
76
|
+
return /*#__PURE__*/ jsx(TabsListContext.Provider, {
|
|
77
|
+
value: tabsListContextValue,
|
|
78
|
+
children: /*#__PURE__*/ jsx(CompositeRoot, {
|
|
79
|
+
render,
|
|
80
|
+
className,
|
|
81
|
+
style,
|
|
82
|
+
state,
|
|
83
|
+
refs: [forwardedRef, setTabsListElement],
|
|
84
|
+
props: [defaultProps, elementProps],
|
|
85
|
+
stateAttributesMapping: tabsStateAttributesMapping,
|
|
86
|
+
highlightedIndex: highlightedTabIndex,
|
|
87
|
+
enableHomeAndEndKeys: true,
|
|
88
|
+
loopFocus,
|
|
89
|
+
orientation,
|
|
90
|
+
onHighlightedIndexChange: setHighlightedTabIndex,
|
|
91
|
+
onMapChange: setTabMap,
|
|
92
|
+
disabledIndices: EMPTY_ARRAY
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
if (process.env.NODE_ENV !== "production") TabsList.displayName = "TabsList";
|
|
97
|
+
//#endregion
|
|
98
|
+
export { TabsList };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import formatErrorMessage from "../../../utils/formatErrorMessage.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/tabs/list/TabsListContext.mjs
|
|
5
|
+
const TabsListContext = /*#__PURE__*/ React.createContext(void 0);
|
|
6
|
+
if (process.env.NODE_ENV !== "production") TabsListContext.displayName = "TabsListContext";
|
|
7
|
+
function useTabsListContext() {
|
|
8
|
+
const context = React.useContext(TabsListContext);
|
|
9
|
+
if (context === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>." : formatErrorMessage(65));
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { TabsListContext, useTabsListContext };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRenderElement } from "../../internals/useRenderElement.js";
|
|
3
|
+
import { useStableCallback } from "../../../utils/useStableCallback.js";
|
|
4
|
+
import { useIsoLayoutEffect } from "../../../utils/useIsoLayoutEffect.js";
|
|
5
|
+
import { disabled, initial, missing } from "../../internals/reason-parts.js";
|
|
6
|
+
import { createChangeEventDetails } from "../../internals/createBaseUIEventDetails.js";
|
|
7
|
+
import { useControlled } from "../../../utils/useControlled.js";
|
|
8
|
+
import { CompositeList } from "../../internals/composite/list/CompositeList.js";
|
|
9
|
+
import { TabsRootContext } from "./TabsRootContext.js";
|
|
10
|
+
import { tabsStateAttributesMapping } from "./stateAttributesMapping.js";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/tabs/root/TabsRoot.mjs
|
|
14
|
+
/**
|
|
15
|
+
* Groups the tabs and the corresponding panels.
|
|
16
|
+
* Renders a `<div>` element.
|
|
17
|
+
*
|
|
18
|
+
* Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)
|
|
19
|
+
*/
|
|
20
|
+
const TabsRoot = /*#__PURE__*/ React.forwardRef(function TabsRoot(componentProps, forwardedRef) {
|
|
21
|
+
const { className, defaultValue: defaultValueProp = 0, onValueChange: onValueChangeProp, orientation = "horizontal", render, value: valueProp, style, ...elementProps } = componentProps;
|
|
22
|
+
const hasExplicitDefaultValueProp = componentProps.defaultValue !== void 0;
|
|
23
|
+
const tabPanelRefs = React.useRef([]);
|
|
24
|
+
const [mountedTabPanels, setMountedTabPanels] = React.useState(() => /* @__PURE__ */ new Map());
|
|
25
|
+
const [value, setValue] = useControlled({
|
|
26
|
+
controlled: valueProp,
|
|
27
|
+
default: defaultValueProp,
|
|
28
|
+
name: "Tabs",
|
|
29
|
+
state: "value"
|
|
30
|
+
});
|
|
31
|
+
const isControlled = valueProp !== void 0;
|
|
32
|
+
const [tabMap, setTabMap] = React.useState(() => /* @__PURE__ */ new Map());
|
|
33
|
+
const lastKnownTabElementRef = React.useRef(void 0);
|
|
34
|
+
const getTabElementBySelectedValue = React.useCallback((selectedValue) => findTabElement(tabMap, selectedValue), [tabMap]);
|
|
35
|
+
const [activationDirectionState, setActivationDirectionState] = React.useState(() => ({
|
|
36
|
+
previousValue: value,
|
|
37
|
+
tabActivationDirection: "none"
|
|
38
|
+
}));
|
|
39
|
+
const { previousValue, tabActivationDirection: committedTabActivationDirection } = activationDirectionState;
|
|
40
|
+
let tabActivationDirection = committedTabActivationDirection;
|
|
41
|
+
let directionComputationIncomplete = false;
|
|
42
|
+
if (previousValue !== value) {
|
|
43
|
+
tabActivationDirection = computeActivationDirection(previousValue, value, orientation, tabMap);
|
|
44
|
+
directionComputationIncomplete = previousValue != null && value != null && getTabElementBySelectedValue(value) == null;
|
|
45
|
+
}
|
|
46
|
+
const nextPreviousValue = directionComputationIncomplete ? previousValue : value;
|
|
47
|
+
const shouldSyncActivationDirectionState = previousValue !== nextPreviousValue || committedTabActivationDirection !== tabActivationDirection;
|
|
48
|
+
useIsoLayoutEffect(() => {
|
|
49
|
+
if (!shouldSyncActivationDirectionState) return;
|
|
50
|
+
setActivationDirectionState({
|
|
51
|
+
previousValue: nextPreviousValue,
|
|
52
|
+
tabActivationDirection
|
|
53
|
+
});
|
|
54
|
+
}, [
|
|
55
|
+
nextPreviousValue,
|
|
56
|
+
shouldSyncActivationDirectionState,
|
|
57
|
+
tabActivationDirection
|
|
58
|
+
]);
|
|
59
|
+
const onValueChange = useStableCallback((newValue, eventDetails) => {
|
|
60
|
+
eventDetails.activationDirection = computeActivationDirection(value, newValue, orientation, tabMap);
|
|
61
|
+
onValueChangeProp?.(newValue, eventDetails);
|
|
62
|
+
if (eventDetails.isCanceled) return;
|
|
63
|
+
setValue(newValue);
|
|
64
|
+
});
|
|
65
|
+
const notifyAutomaticValueChange = useStableCallback((nextValue, reason) => {
|
|
66
|
+
onValueChangeProp?.(nextValue, createChangeEventDetails(reason, void 0, void 0, { activationDirection: "none" }));
|
|
67
|
+
});
|
|
68
|
+
const registerMountedTabPanel = useStableCallback((panelValue, panelId) => {
|
|
69
|
+
setMountedTabPanels((prev) => {
|
|
70
|
+
const next = new Map(prev);
|
|
71
|
+
next.set(panelValue, panelId);
|
|
72
|
+
return next;
|
|
73
|
+
});
|
|
74
|
+
return () => {
|
|
75
|
+
setMountedTabPanels((prev) => {
|
|
76
|
+
if (prev.get(panelValue) !== panelId) return prev;
|
|
77
|
+
const next = new Map(prev);
|
|
78
|
+
next.delete(panelValue);
|
|
79
|
+
return next;
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
const getTabPanelIdByValue = React.useCallback((tabValue) => {
|
|
84
|
+
return mountedTabPanels.get(tabValue);
|
|
85
|
+
}, [mountedTabPanels]);
|
|
86
|
+
const getTabIdByPanelValue = React.useCallback((tabPanelValue) => {
|
|
87
|
+
for (const tabMetadata of tabMap.values()) if (tabPanelValue === tabMetadata.value) return tabMetadata.id;
|
|
88
|
+
}, [tabMap]);
|
|
89
|
+
const tabsContextValue = React.useMemo(() => ({
|
|
90
|
+
getTabElementBySelectedValue,
|
|
91
|
+
getTabIdByPanelValue,
|
|
92
|
+
getTabPanelIdByValue,
|
|
93
|
+
onValueChange,
|
|
94
|
+
orientation,
|
|
95
|
+
registerMountedTabPanel,
|
|
96
|
+
setTabMap,
|
|
97
|
+
tabActivationDirection,
|
|
98
|
+
value
|
|
99
|
+
}), [
|
|
100
|
+
getTabElementBySelectedValue,
|
|
101
|
+
getTabIdByPanelValue,
|
|
102
|
+
getTabPanelIdByValue,
|
|
103
|
+
onValueChange,
|
|
104
|
+
orientation,
|
|
105
|
+
registerMountedTabPanel,
|
|
106
|
+
setTabMap,
|
|
107
|
+
tabActivationDirection,
|
|
108
|
+
value
|
|
109
|
+
]);
|
|
110
|
+
const selectedTabMetadata = React.useMemo(() => {
|
|
111
|
+
for (const tabMetadata of tabMap.values()) if (tabMetadata.value === value) return tabMetadata;
|
|
112
|
+
}, [tabMap, value]);
|
|
113
|
+
const firstEnabledTabValue = React.useMemo(() => {
|
|
114
|
+
for (const tabMetadata of tabMap.values()) if (!tabMetadata.disabled) return tabMetadata.value;
|
|
115
|
+
}, [tabMap]);
|
|
116
|
+
const shouldNotifyInitialValueChangeRef = React.useRef(!hasExplicitDefaultValueProp);
|
|
117
|
+
const initialDefaultValueRef = React.useRef(defaultValueProp);
|
|
118
|
+
const shouldHonorDisabledDefaultValueRef = React.useRef(hasExplicitDefaultValueProp);
|
|
119
|
+
const didRegisterTabsRef = React.useRef(false);
|
|
120
|
+
useIsoLayoutEffect(() => {
|
|
121
|
+
if (isControlled) return;
|
|
122
|
+
function commitAutomaticValueChange(fallbackValue, fallbackReason) {
|
|
123
|
+
setValue(fallbackValue);
|
|
124
|
+
setActivationDirectionState({
|
|
125
|
+
previousValue: fallbackValue,
|
|
126
|
+
tabActivationDirection: "none"
|
|
127
|
+
});
|
|
128
|
+
notifyAutomaticValueChange(fallbackValue, fallbackReason);
|
|
129
|
+
shouldNotifyInitialValueChangeRef.current = false;
|
|
130
|
+
}
|
|
131
|
+
if (tabMap.size === 0) {
|
|
132
|
+
if (didRegisterTabsRef.current && value !== null && !lastKnownTabElementRef.current?.isConnected) commitAutomaticValueChange(null, missing);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
didRegisterTabsRef.current = true;
|
|
136
|
+
lastKnownTabElementRef.current = tabMap.keys().next().value;
|
|
137
|
+
const selectionIsDisabled = selectedTabMetadata?.disabled;
|
|
138
|
+
const selectionIsMissing = selectedTabMetadata == null && value !== null;
|
|
139
|
+
if (!selectionIsDisabled && value === initialDefaultValueRef.current) shouldHonorDisabledDefaultValueRef.current = false;
|
|
140
|
+
if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value === initialDefaultValueRef.current) return;
|
|
141
|
+
const shouldNotifyInitialValueChange = shouldNotifyInitialValueChangeRef.current;
|
|
142
|
+
if (selectionIsDisabled || selectionIsMissing) {
|
|
143
|
+
const fallbackValue = firstEnabledTabValue ?? null;
|
|
144
|
+
if (value === fallbackValue) {
|
|
145
|
+
shouldNotifyInitialValueChangeRef.current = false;
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
let fallbackReason = missing;
|
|
149
|
+
if (shouldNotifyInitialValueChange) fallbackReason = initial;
|
|
150
|
+
else if (selectionIsDisabled) fallbackReason = disabled;
|
|
151
|
+
commitAutomaticValueChange(fallbackValue, fallbackReason);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (shouldNotifyInitialValueChange && selectedTabMetadata != null) {
|
|
155
|
+
notifyAutomaticValueChange(value, initial);
|
|
156
|
+
shouldNotifyInitialValueChangeRef.current = false;
|
|
157
|
+
}
|
|
158
|
+
}, [
|
|
159
|
+
firstEnabledTabValue,
|
|
160
|
+
isControlled,
|
|
161
|
+
notifyAutomaticValueChange,
|
|
162
|
+
selectedTabMetadata,
|
|
163
|
+
setValue,
|
|
164
|
+
tabMap,
|
|
165
|
+
value
|
|
166
|
+
]);
|
|
167
|
+
const element = useRenderElement("div", componentProps, {
|
|
168
|
+
state: {
|
|
169
|
+
orientation,
|
|
170
|
+
tabActivationDirection
|
|
171
|
+
},
|
|
172
|
+
ref: forwardedRef,
|
|
173
|
+
props: elementProps,
|
|
174
|
+
stateAttributesMapping: tabsStateAttributesMapping
|
|
175
|
+
});
|
|
176
|
+
return /*#__PURE__*/ jsx(TabsRootContext.Provider, {
|
|
177
|
+
value: tabsContextValue,
|
|
178
|
+
children: /*#__PURE__*/ jsx(CompositeList, {
|
|
179
|
+
elementsRef: tabPanelRefs,
|
|
180
|
+
children: element
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
if (process.env.NODE_ENV !== "production") TabsRoot.displayName = "TabsRoot";
|
|
185
|
+
function findTabElement(tabMap, value) {
|
|
186
|
+
for (const [tabElement, tabMetadata] of tabMap.entries()) if (value === tabMetadata.value) return tabElement;
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
function computeActivationDirection(oldValue, newValue, orientation, tabMap) {
|
|
190
|
+
if (oldValue == null || newValue == null) return "none";
|
|
191
|
+
const [positionProp, backward, forward] = orientation === "horizontal" ? [
|
|
192
|
+
"left",
|
|
193
|
+
"left",
|
|
194
|
+
"right"
|
|
195
|
+
] : [
|
|
196
|
+
"top",
|
|
197
|
+
"up",
|
|
198
|
+
"down"
|
|
199
|
+
];
|
|
200
|
+
const oldTab = findTabElement(tabMap, oldValue);
|
|
201
|
+
const newTab = findTabElement(tabMap, newValue);
|
|
202
|
+
if (oldTab == null || newTab == null) {
|
|
203
|
+
if (oldTab !== newTab && (typeof oldValue === "number" || typeof oldValue === "string") && typeof oldValue === typeof newValue) return newValue > oldValue ? forward : backward;
|
|
204
|
+
return "none";
|
|
205
|
+
}
|
|
206
|
+
const oldPosition = oldTab.getBoundingClientRect()[positionProp];
|
|
207
|
+
const newPosition = newTab.getBoundingClientRect()[positionProp];
|
|
208
|
+
if (newPosition < oldPosition) return backward;
|
|
209
|
+
if (newPosition > oldPosition) return forward;
|
|
210
|
+
return "none";
|
|
211
|
+
}
|
|
212
|
+
//#endregion
|
|
213
|
+
export { TabsRoot };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import formatErrorMessage from "../../../utils/formatErrorMessage.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/tabs/root/TabsRootContext.mjs
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
const TabsRootContext = /*#__PURE__*/ React.createContext(void 0);
|
|
9
|
+
if (process.env.NODE_ENV !== "production") TabsRootContext.displayName = "TabsRootContext";
|
|
10
|
+
function useTabsRootContext() {
|
|
11
|
+
const context = React.useContext(TabsRootContext);
|
|
12
|
+
if (context === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>." : formatErrorMessage(64));
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { TabsRootContext, useTabsRootContext };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/tabs/root/TabsRootDataAttributes.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Indicates the direction of the activation (based on the previous active tab).
|
|
4
|
+
* @type {'left' | 'right' | 'up' | 'down' | 'none'}
|
|
5
|
+
*/
|
|
6
|
+
const activationDirection = "data-activation-direction";
|
|
7
|
+
//#endregion
|
|
8
|
+
export { activationDirection };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { activationDirection } from "./TabsRootDataAttributes.js";
|
|
2
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/tabs/root/stateAttributesMapping.mjs
|
|
3
|
+
const tabsStateAttributesMapping = { tabActivationDirection: (dir) => ({ [activationDirection]: dir }) };
|
|
4
|
+
//#endregion
|
|
5
|
+
export { tabsStateAttributesMapping };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRenderElement } from "../../internals/useRenderElement.js";
|
|
3
|
+
import { useStableCallback } from "../../../utils/useStableCallback.js";
|
|
4
|
+
import { useIsoLayoutEffect } from "../../../utils/useIsoLayoutEffect.js";
|
|
5
|
+
import { useCompositeRootContext } from "../../internals/composite/root/CompositeRootContext.js";
|
|
6
|
+
import { ownerDocument } from "../../../utils/owner.js";
|
|
7
|
+
import { useButton } from "../../internals/use-button/useButton.js";
|
|
8
|
+
import { none } from "../../internals/reason-parts.js";
|
|
9
|
+
import { createChangeEventDetails } from "../../internals/createBaseUIEventDetails.js";
|
|
10
|
+
import { useBaseUiId } from "../../internals/useBaseUiId.js";
|
|
11
|
+
import { activeElement, contains } from "../../../utils/shadowDom.js";
|
|
12
|
+
import { useTabsRootContext } from "../root/TabsRootContext.js";
|
|
13
|
+
import { tabsStateAttributesMapping } from "../root/stateAttributesMapping.js";
|
|
14
|
+
import { ACTIVE_COMPOSITE_ITEM } from "../../internals/composite/constants.js";
|
|
15
|
+
import { useCompositeItem } from "../../internals/composite/item/useCompositeItem.js";
|
|
16
|
+
import { useTabsListContext } from "../list/TabsListContext.js";
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/tabs/tab/TabsTab.mjs
|
|
19
|
+
/**
|
|
20
|
+
* An individual interactive tab button that toggles the corresponding panel.
|
|
21
|
+
* Renders a `<button>` element.
|
|
22
|
+
*
|
|
23
|
+
* Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)
|
|
24
|
+
*/
|
|
25
|
+
const TabsTab = /*#__PURE__*/ React.forwardRef(function TabsTab(componentProps, forwardedRef) {
|
|
26
|
+
const { className, disabled = false, render, value, id: idProp, nativeButton = true, style, ...elementProps } = componentProps;
|
|
27
|
+
const { value: activeTabValue, getTabPanelIdByValue, onValueChange, orientation, tabActivationDirection } = useTabsRootContext();
|
|
28
|
+
const { activateOnFocus, registerTabResizeObserverElement, tabsListElement } = useTabsListContext();
|
|
29
|
+
const { highlightedIndex, onHighlightedIndexChange } = useCompositeRootContext();
|
|
30
|
+
const id = useBaseUiId(idProp);
|
|
31
|
+
const tabMetadata = React.useMemo(() => ({
|
|
32
|
+
disabled,
|
|
33
|
+
id,
|
|
34
|
+
value
|
|
35
|
+
}), [
|
|
36
|
+
disabled,
|
|
37
|
+
id,
|
|
38
|
+
value
|
|
39
|
+
]);
|
|
40
|
+
const { compositeProps, compositeRef, index } = useCompositeItem({ metadata: tabMetadata });
|
|
41
|
+
const active = value === activeTabValue;
|
|
42
|
+
const isNavigatingRef = React.useRef(false);
|
|
43
|
+
const unobserveTabElementRef = React.useRef(null);
|
|
44
|
+
const observeTabElement = useStableCallback((element) => {
|
|
45
|
+
unobserveTabElementRef.current?.();
|
|
46
|
+
unobserveTabElementRef.current = element ? registerTabResizeObserverElement(element) : null;
|
|
47
|
+
});
|
|
48
|
+
useIsoLayoutEffect(() => {
|
|
49
|
+
if (isNavigatingRef.current) {
|
|
50
|
+
isNavigatingRef.current = false;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (!(active && index > -1 && highlightedIndex !== index)) return;
|
|
54
|
+
const listElement = tabsListElement;
|
|
55
|
+
if (listElement != null) {
|
|
56
|
+
const activeEl = activeElement(ownerDocument(listElement));
|
|
57
|
+
if (activeEl && contains(listElement, activeEl)) return;
|
|
58
|
+
}
|
|
59
|
+
if (!disabled) onHighlightedIndexChange(index);
|
|
60
|
+
}, [
|
|
61
|
+
active,
|
|
62
|
+
index,
|
|
63
|
+
highlightedIndex,
|
|
64
|
+
onHighlightedIndexChange,
|
|
65
|
+
disabled,
|
|
66
|
+
tabsListElement
|
|
67
|
+
]);
|
|
68
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
69
|
+
disabled,
|
|
70
|
+
native: nativeButton,
|
|
71
|
+
focusableWhenDisabled: true
|
|
72
|
+
});
|
|
73
|
+
const tabPanelId = getTabPanelIdByValue(value);
|
|
74
|
+
const isPressingRef = React.useRef(false);
|
|
75
|
+
const isMainButtonRef = React.useRef(false);
|
|
76
|
+
function activate(event) {
|
|
77
|
+
onValueChange(value, createChangeEventDetails(none, event.nativeEvent, void 0, { activationDirection: "none" }));
|
|
78
|
+
}
|
|
79
|
+
function onClick(event) {
|
|
80
|
+
if (active || disabled) return;
|
|
81
|
+
activate(event);
|
|
82
|
+
}
|
|
83
|
+
function onFocus(event) {
|
|
84
|
+
if (active || disabled) return;
|
|
85
|
+
if (activateOnFocus && (!isPressingRef.current || isMainButtonRef.current)) activate(event);
|
|
86
|
+
}
|
|
87
|
+
function onPointerDown(event) {
|
|
88
|
+
if (active || disabled) return;
|
|
89
|
+
isPressingRef.current = true;
|
|
90
|
+
isMainButtonRef.current = event.button === 0;
|
|
91
|
+
const doc = ownerDocument(event.currentTarget);
|
|
92
|
+
function handlePointerEnd() {
|
|
93
|
+
isPressingRef.current = false;
|
|
94
|
+
isMainButtonRef.current = false;
|
|
95
|
+
doc.removeEventListener("pointerup", handlePointerEnd);
|
|
96
|
+
doc.removeEventListener("pointercancel", handlePointerEnd);
|
|
97
|
+
}
|
|
98
|
+
doc.addEventListener("pointerup", handlePointerEnd);
|
|
99
|
+
doc.addEventListener("pointercancel", handlePointerEnd);
|
|
100
|
+
}
|
|
101
|
+
return useRenderElement("button", componentProps, {
|
|
102
|
+
state: {
|
|
103
|
+
disabled,
|
|
104
|
+
active,
|
|
105
|
+
orientation,
|
|
106
|
+
tabActivationDirection
|
|
107
|
+
},
|
|
108
|
+
ref: [
|
|
109
|
+
forwardedRef,
|
|
110
|
+
buttonRef,
|
|
111
|
+
compositeRef,
|
|
112
|
+
observeTabElement
|
|
113
|
+
],
|
|
114
|
+
props: [
|
|
115
|
+
compositeProps,
|
|
116
|
+
{
|
|
117
|
+
role: "tab",
|
|
118
|
+
"aria-controls": tabPanelId,
|
|
119
|
+
"aria-selected": active,
|
|
120
|
+
id,
|
|
121
|
+
onClick,
|
|
122
|
+
onFocus,
|
|
123
|
+
onPointerDown,
|
|
124
|
+
[ACTIVE_COMPOSITE_ITEM]: active ? "" : void 0,
|
|
125
|
+
onKeyDownCapture() {
|
|
126
|
+
isNavigatingRef.current = true;
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
elementProps,
|
|
130
|
+
getButtonProps
|
|
131
|
+
],
|
|
132
|
+
stateAttributesMapping: tabsStateAttributesMapping
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
if (process.env.NODE_ENV !== "production") TabsTab.displayName = "TabsTab";
|
|
136
|
+
//#endregion
|
|
137
|
+
export { TabsTab };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { endingStyle as endingStyle$1, startingStyle as startingStyle$1 } from "../internals/TransitionStatusDataAttributes.js";
|
|
2
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Present when the popup is open.
|
|
5
|
+
*/
|
|
6
|
+
const open = "data-open";
|
|
7
|
+
/**
|
|
8
|
+
* Present when the popup is closed.
|
|
9
|
+
*/
|
|
10
|
+
const closed = "data-closed";
|
|
11
|
+
/**
|
|
12
|
+
* Present when the popup begins animating in.
|
|
13
|
+
*/
|
|
14
|
+
const startingStyle = startingStyle$1;
|
|
15
|
+
/**
|
|
16
|
+
* Present when the popup is animating out.
|
|
17
|
+
*/
|
|
18
|
+
const endingStyle = endingStyle$1;
|
|
19
|
+
/**
|
|
20
|
+
* Present when the anchor is hidden.
|
|
21
|
+
*/
|
|
22
|
+
const anchorHidden = "data-anchor-hidden";
|
|
23
|
+
//#endregion
|
|
24
|
+
export { anchorHidden, closed, endingStyle, open, startingStyle };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Present when the popup is open.
|
|
4
|
+
*/
|
|
5
|
+
const popupOpen = "data-popup-open";
|
|
6
|
+
/**
|
|
7
|
+
* Present when a pressable trigger is pressed.
|
|
8
|
+
*/
|
|
9
|
+
const pressed = "data-pressed";
|
|
10
|
+
//#endregion
|
|
11
|
+
export { popupOpen, pressed };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useIsoLayoutEffect } from "../../utils/useIsoLayoutEffect.js";
|
|
3
|
+
import { webkit } from "../../utils/platform/engine.js";
|
|
4
|
+
import { voiceOver } from "../../utils/platform/screen-reader.js";
|
|
5
|
+
import { visuallyHidden } from "../../utils/visuallyHidden.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/FocusGuard.mjs
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
const FocusGuard = /*#__PURE__*/ React.forwardRef(function FocusGuard(props, ref) {
|
|
13
|
+
const [role, setRole] = React.useState();
|
|
14
|
+
useIsoLayoutEffect(() => {
|
|
15
|
+
if (voiceOver && webkit) setRole("button");
|
|
16
|
+
}, []);
|
|
17
|
+
const restProps = {
|
|
18
|
+
tabIndex: 0,
|
|
19
|
+
role
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/ jsx("span", {
|
|
22
|
+
...props,
|
|
23
|
+
ref,
|
|
24
|
+
style: visuallyHidden,
|
|
25
|
+
"aria-hidden": role ? void 0 : true,
|
|
26
|
+
...restProps,
|
|
27
|
+
"data-base-ui-focus-guard": ""
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
if (process.env.NODE_ENV !== "production") FocusGuard.displayName = "FocusGuard";
|
|
31
|
+
//#endregion
|
|
32
|
+
export { FocusGuard };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/InternalBackdrop.mjs
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
const InternalBackdrop = /*#__PURE__*/ React.forwardRef(function InternalBackdrop(props, ref) {
|
|
8
|
+
const { cutout, ...otherProps } = props;
|
|
9
|
+
let clipPath;
|
|
10
|
+
if (cutout) {
|
|
11
|
+
const rect = cutout.getBoundingClientRect();
|
|
12
|
+
clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;
|
|
13
|
+
}
|
|
14
|
+
return /*#__PURE__*/ jsx("div", {
|
|
15
|
+
ref,
|
|
16
|
+
role: "presentation",
|
|
17
|
+
"data-base-ui-inert": "",
|
|
18
|
+
...otherProps,
|
|
19
|
+
style: {
|
|
20
|
+
position: "fixed",
|
|
21
|
+
inset: 0,
|
|
22
|
+
userSelect: "none",
|
|
23
|
+
WebkitUserSelect: "none",
|
|
24
|
+
clipPath
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
if (process.env.NODE_ENV !== "production") InternalBackdrop.displayName = "InternalBackdrop";
|
|
29
|
+
//#endregion
|
|
30
|
+
export { InternalBackdrop };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getWindow } from "../../../@floating-ui/utils/dist/floating-ui.utils.dom.js";
|
|
2
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.8.0_@date-fns+tz@1.5.0_@types+react@19.3.0_date-fns@4.4.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Dispatches a constructed click on the target so it carries the source event's
|
|
5
|
+
* modifier state, which `click()` always reports as unpressed. Like `click()`,
|
|
6
|
+
* the untrusted click still runs native activation behavior (form submission,
|
|
7
|
+
* link navigation).
|
|
8
|
+
* `detail` defaults to 0 (the native convention for keyboard-generated clicks);
|
|
9
|
+
* pass `detail: 1` when the click represents a mouse gesture so consumers keying
|
|
10
|
+
* off `detail === 0` don't classify it as a keyboard activation.
|
|
11
|
+
*/
|
|
12
|
+
function dispatchClickWithModifiers(target, sourceEvent, { detail = 0 } = {}) {
|
|
13
|
+
target.dispatchEvent(new (getWindow(target)).PointerEvent("click", {
|
|
14
|
+
bubbles: true,
|
|
15
|
+
cancelable: true,
|
|
16
|
+
composed: true,
|
|
17
|
+
detail,
|
|
18
|
+
shiftKey: sourceEvent.shiftKey,
|
|
19
|
+
ctrlKey: sourceEvent.ctrlKey,
|
|
20
|
+
altKey: sourceEvent.altKey,
|
|
21
|
+
metaKey: sourceEvent.metaKey
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { dispatchClickWithModifiers };
|