@yahoo/uds 3.114.0-beta.2 → 3.114.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automated-config/dist/generated/autoVariants.cjs +3 -0
- package/dist/automated-config/dist/generated/autoVariants.d.cts +3 -0
- package/dist/automated-config/dist/generated/autoVariants.d.ts +3 -0
- package/dist/automated-config/dist/generated/autoVariants.js +3 -0
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +1883 -0
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +175 -1
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +175 -1
- package/dist/automated-config/dist/generated/generatedConfigs.js +1882 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +84 -0
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +3 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +3 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +84 -0
- package/dist/automated-config/dist/mapTextVariantFixtureToValue.cjs +1 -12
- package/dist/automated-config/dist/mapTextVariantFixtureToValue.js +1 -12
- package/dist/automated-config/dist/properties.cjs +58 -12
- package/dist/automated-config/dist/properties.d.cts +8 -0
- package/dist/automated-config/dist/properties.d.ts +8 -0
- package/dist/automated-config/dist/properties.js +58 -12
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +2 -2
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +2 -2
- package/dist/cli/commands/sync.cjs +7 -1
- package/dist/cli/commands/sync.d.cts +1 -1
- package/dist/cli/commands/sync.d.ts +1 -1
- package/dist/cli/commands/sync.js +7 -1
- package/dist/cli/commands/version.cjs +2 -0
- package/dist/cli/commands/version.d.cts +1 -1
- package/dist/cli/commands/version.d.ts +1 -1
- package/dist/cli/commands/version.js +2 -0
- package/dist/cli/dist/cli.cjs +1 -1
- package/dist/cli/dist/cli.js +1 -1
- package/dist/cli/dist/commands/editor-rules.cjs +2 -2
- package/dist/cli/dist/commands/editor-rules.js +2 -2
- package/dist/cli/dist/utils/rules/config.cjs +1 -1
- package/dist/cli/dist/utils/rules/config.js +1 -1
- package/dist/cli/runner.cjs +2 -11
- package/dist/cli/runner.js +2 -11
- package/dist/components/Scrim.cjs +28 -0
- package/dist/components/Scrim.d.cts +14 -0
- package/dist/components/Scrim.d.ts +14 -0
- package/dist/components/Scrim.js +26 -0
- package/dist/components/client/BottomSheet/BottomSheet.cjs +209 -0
- package/dist/components/client/BottomSheet/BottomSheet.d.cts +77 -0
- package/dist/components/client/BottomSheet/BottomSheet.d.ts +77 -0
- package/dist/components/client/BottomSheet/BottomSheet.js +207 -0
- package/dist/components/client/BottomSheet/BottomSheetContent.cjs +26 -0
- package/dist/components/client/BottomSheet/BottomSheetContent.d.cts +15 -0
- package/dist/components/client/BottomSheet/BottomSheetContent.d.ts +15 -0
- package/dist/components/client/BottomSheet/BottomSheetContent.js +24 -0
- package/dist/components/client/BottomSheet/BottomSheetDismiss.cjs +15 -0
- package/dist/components/client/BottomSheet/BottomSheetDismiss.d.cts +12 -0
- package/dist/components/client/BottomSheet/BottomSheetDismiss.d.ts +12 -0
- package/dist/components/client/BottomSheet/BottomSheetDismiss.js +13 -0
- package/dist/components/client/BottomSheet/BottomSheetHandle.cjs +30 -0
- package/dist/components/client/BottomSheet/BottomSheetHandle.d.cts +19 -0
- package/dist/components/client/BottomSheet/BottomSheetHandle.d.ts +19 -0
- package/dist/components/client/BottomSheet/BottomSheetHandle.js +28 -0
- package/dist/components/client/BottomSheet/BottomSheetHeader.cjs +42 -0
- package/dist/components/client/BottomSheet/BottomSheetHeader.d.cts +18 -0
- package/dist/components/client/BottomSheet/BottomSheetHeader.d.ts +18 -0
- package/dist/components/client/BottomSheet/BottomSheetHeader.js +40 -0
- package/dist/components/client/BottomSheet/BottomSheetProvider.cjs +21 -0
- package/dist/components/client/BottomSheet/BottomSheetProvider.d.cts +19 -0
- package/dist/components/client/BottomSheet/BottomSheetProvider.d.ts +19 -0
- package/dist/components/client/BottomSheet/BottomSheetProvider.js +19 -0
- package/dist/components/client/BottomSheet/BottomSheetTrigger.cjs +15 -0
- package/dist/components/client/BottomSheet/BottomSheetTrigger.d.cts +12 -0
- package/dist/components/client/BottomSheet/BottomSheetTrigger.d.ts +12 -0
- package/dist/components/client/BottomSheet/BottomSheetTrigger.js +13 -0
- package/dist/components/client/BottomSheet/UDSBottomSheetConfigProvider.cjs +32 -0
- package/dist/components/client/BottomSheet/UDSBottomSheetConfigProvider.d.cts +22 -0
- package/dist/components/client/BottomSheet/UDSBottomSheetConfigProvider.d.ts +22 -0
- package/dist/components/client/BottomSheet/UDSBottomSheetConfigProvider.js +29 -0
- package/dist/components/client/BottomSheet/index.cjs +22 -0
- package/dist/components/client/BottomSheet/index.d.cts +10 -0
- package/dist/components/client/BottomSheet/index.d.ts +10 -0
- package/dist/components/client/BottomSheet/index.js +12 -0
- package/dist/components/client/BottomSheet/useBottomSheetDrag.cjs +188 -0
- package/dist/components/client/BottomSheet/useBottomSheetDrag.d.cts +44 -0
- package/dist/components/client/BottomSheet/useBottomSheetDrag.d.ts +44 -0
- package/dist/components/client/BottomSheet/useBottomSheetDrag.js +185 -0
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.cjs +138 -0
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.cts +46 -0
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.ts +46 -0
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.js +135 -0
- package/dist/components/client/BottomSheet/useBottomSheetStore.cjs +34 -0
- package/dist/components/client/BottomSheet/useBottomSheetStore.d.cts +38 -0
- package/dist/components/client/BottomSheet/useBottomSheetStore.d.ts +38 -0
- package/dist/components/client/BottomSheet/useBottomSheetStore.js +31 -0
- package/dist/components/client/BottomSheet/useBottomSheetStoreInternal.cjs +17 -0
- package/dist/components/client/BottomSheet/useBottomSheetStoreInternal.d.cts +13 -0
- package/dist/components/client/BottomSheet/useBottomSheetStoreInternal.d.ts +13 -0
- package/dist/components/client/BottomSheet/useBottomSheetStoreInternal.js +15 -0
- package/dist/components/client/BottomSheet/useExpansionMargins.cjs +89 -0
- package/dist/components/client/BottomSheet/useExpansionMargins.d.cts +34 -0
- package/dist/components/client/BottomSheet/useExpansionMargins.d.ts +34 -0
- package/dist/components/client/BottomSheet/useExpansionMargins.js +87 -0
- package/dist/components/client/BottomSheet/useViewportHeight.cjs +32 -0
- package/dist/components/client/BottomSheet/useViewportHeight.d.cts +9 -0
- package/dist/components/client/BottomSheet/useViewportHeight.d.ts +9 -0
- package/dist/components/client/BottomSheet/useViewportHeight.js +30 -0
- package/dist/components/client/BottomSheet/useVirtualKeyboard.cjs +48 -0
- package/dist/components/client/BottomSheet/useVirtualKeyboard.d.cts +10 -0
- package/dist/components/client/BottomSheet/useVirtualKeyboard.d.ts +10 -0
- package/dist/components/client/BottomSheet/useVirtualKeyboard.js +46 -0
- package/dist/components/client/BottomSheet/utils.cjs +128 -0
- package/dist/components/client/BottomSheet/utils.d.cts +61 -0
- package/dist/components/client/BottomSheet/utils.d.ts +61 -0
- package/dist/components/client/BottomSheet/utils.js +118 -0
- package/dist/components/client/Menu/Menu.Content.cjs +1 -1
- package/dist/components/client/Menu/Menu.Content.js +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- package/dist/components/client/Menu/Menu.index.d.cts +1 -1
- package/dist/components/client/index.cjs +16 -0
- package/dist/components/client/index.d.cts +10 -1
- package/dist/components/client/index.d.ts +10 -1
- package/dist/components/client/index.js +9 -1
- package/dist/components/client/providers/UDSConfigProvider.cjs +10 -6
- package/dist/components/client/providers/UDSConfigProvider.d.cts +1 -0
- package/dist/components/client/providers/UDSConfigProvider.d.ts +1 -0
- package/dist/components/client/providers/UDSConfigProvider.js +10 -6
- package/dist/components/index.cjs +24 -0
- package/dist/components/index.d.cts +9 -1
- package/dist/components/index.d.ts +9 -1
- package/dist/components/index.js +17 -1
- package/dist/config/dist/index.cjs +110 -2
- package/dist/config/dist/index.js +110 -2
- package/dist/fixtures/dist/index.cjs +103 -0
- package/dist/fixtures/dist/index.d.cts +3 -2
- package/dist/fixtures/dist/index.d.ts +3 -2
- package/dist/fixtures/dist/index.js +103 -1
- package/dist/fixtures/index.cjs +1 -0
- package/dist/fixtures/index.d.cts +2 -2
- package/dist/fixtures/index.d.ts +2 -2
- package/dist/fixtures/index.js +2 -2
- package/dist/index.cjs +20 -2
- package/dist/index.d.cts +12 -5
- package/dist/index.d.ts +12 -5
- package/dist/index.js +11 -3
- package/dist/runtime/bottomSheetConfig.cjs +11 -0
- package/dist/runtime/bottomSheetConfig.d.cts +15 -0
- package/dist/runtime/bottomSheetConfig.d.ts +15 -0
- package/dist/runtime/bottomSheetConfig.js +9 -0
- package/dist/runtime/index.cjs +2 -0
- package/dist/runtime/index.d.cts +2 -1
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.js +2 -1
- package/dist/runtime/udsConfig.cjs +2 -0
- package/dist/runtime/udsConfig.d.cts +2 -0
- package/dist/runtime/udsConfig.d.ts +2 -0
- package/dist/runtime/udsConfig.js +2 -0
- package/dist/styles/styler.d.cts +33 -30
- package/dist/styles/styler.d.ts +33 -30
- package/dist/styles/variants.cjs +278 -278
- package/dist/styles/variants.d.cts +9 -0
- package/dist/styles/variants.d.ts +9 -0
- package/dist/styles/variants.js +278 -278
- package/dist/tailwind/dist/commands/generateComponentData.cjs +31 -33
- package/dist/tailwind/dist/commands/generateComponentData.d.ts +1 -1
- package/dist/tailwind/dist/commands/generateComponentData.js +31 -33
- package/dist/tailwind/dist/commands/generatePurgeCSSData.d.ts +1 -1
- package/dist/tailwind/dist/commands/purge.cjs +4 -3
- package/dist/tailwind/dist/commands/purge.d.ts +1 -1
- package/dist/tailwind/dist/commands/purge.js +4 -3
- package/dist/tailwind/dist/index.d.cts +0 -1
- package/dist/tailwind/dist/index.d.ts +3 -5
- package/dist/tailwind/dist/purger/legacy/purgeCSS.cjs +3 -4
- package/dist/tailwind/dist/purger/legacy/purgeCSS.js +3 -4
- package/dist/tailwind/dist/purger/optimized/ast/expressions.cjs +125 -122
- package/dist/tailwind/dist/purger/optimized/ast/expressions.js +125 -122
- package/dist/tailwind/dist/purger/optimized/ast/jsx.cjs +8 -1
- package/dist/tailwind/dist/purger/optimized/ast/jsx.js +8 -1
- package/dist/tailwind/dist/purger/optimized/purge.cjs +10 -11
- package/dist/tailwind/dist/purger/optimized/purge.js +9 -10
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.cjs +127 -232
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.js +127 -232
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.cjs +262 -330
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js +262 -329
- package/dist/tailwind/dist/purger/optimized/utils/files.cjs +3 -4
- package/dist/tailwind/dist/purger/optimized/utils/files.js +3 -4
- package/dist/tailwind/dist/purger/optimized/utils/safelist.cjs +21 -13
- package/dist/tailwind/dist/purger/optimized/utils/safelist.js +21 -13
- package/dist/tailwind/dist/tailwind/plugins/components.cjs +2 -0
- package/dist/tailwind/dist/tailwind/plugins/components.js +3 -1
- package/dist/tailwind/dist/tailwind/plugins/typography.cjs +13 -41
- package/dist/tailwind/dist/tailwind/plugins/typography.js +13 -41
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.cjs +2 -4
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.d.cts +1 -10
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.d.ts +1 -10
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.js +2 -4
- package/dist/tailwind/dist/utils/tsMorph.cjs +1 -1
- package/dist/tokens/automation/configs/index.cjs +2 -0
- package/dist/tokens/automation/configs/index.d.cts +2 -2
- package/dist/tokens/automation/configs/index.d.ts +2 -2
- package/dist/tokens/automation/configs/index.js +2 -2
- package/dist/tokens/automation/index.cjs +2 -0
- package/dist/tokens/automation/index.d.cts +2 -2
- package/dist/tokens/automation/index.d.ts +2 -2
- package/dist/tokens/automation/index.js +2 -2
- package/dist/tokens/index.cjs +2 -0
- package/dist/tokens/index.d.cts +3 -3
- package/dist/tokens/index.d.ts +3 -3
- package/dist/tokens/index.js +2 -2
- package/dist/tokens/types.d.cts +2 -2
- package/dist/tokens/types.d.ts +2 -2
- package/dist/types/dist/index.d.cts +76 -1
- package/dist/types/dist/index.d.ts +76 -1
- package/dist/uds/generated/componentData.cjs +1187 -961
- package/dist/uds/generated/componentData.js +1111 -939
- package/dist/uds/generated/tailwindPurge.cjs +57 -29
- package/dist/uds/generated/tailwindPurge.js +57 -29
- package/dist/uds/package.cjs +4 -10
- package/dist/uds/package.js +4 -10
- package/package.json +4 -7
- package/dist/cli/dist/lib/logger.cjs +0 -66
- package/dist/cli/dist/lib/logger.js +0 -66
- package/dist/tailwind/dist/commands/css.cjs +0 -79
- package/dist/tailwind/dist/commands/css.d.ts +0 -3
- package/dist/tailwind/dist/commands/css.helpers.cjs +0 -32
- package/dist/tailwind/dist/commands/css.helpers.js +0 -28
- package/dist/tailwind/dist/commands/css.js +0 -79
- package/dist/tailwind/dist/css/generate.cjs +0 -120
- package/dist/tailwind/dist/css/generate.d.cts +0 -30
- package/dist/tailwind/dist/css/generate.d.ts +0 -31
- package/dist/tailwind/dist/css/generate.helpers.cjs +0 -112
- package/dist/tailwind/dist/css/generate.helpers.js +0 -100
- package/dist/tailwind/dist/css/generate.js +0 -115
- package/dist/tailwind/dist/css/postcss.cjs +0 -35
- package/dist/tailwind/dist/css/postcss.helpers.cjs +0 -27
- package/dist/tailwind/dist/css/postcss.helpers.js +0 -26
- package/dist/tailwind/dist/css/postcss.js +0 -35
- package/dist/tailwind/dist/css/runner.cjs +0 -278
- package/dist/tailwind/dist/css/runner.helpers.cjs +0 -26
- package/dist/tailwind/dist/css/runner.helpers.js +0 -23
- package/dist/tailwind/dist/css/runner.js +0 -275
- package/dist/tailwind/dist/css/theme.cjs +0 -12
- package/dist/tailwind/dist/css/theme.d.cts +0 -66
- package/dist/tailwind/dist/css/theme.d.ts +0 -66
- package/dist/tailwind/dist/css/theme.js +0 -11
- package/dist/tailwind/dist/css/utils.cjs +0 -234
- package/dist/tailwind/dist/css/utils.js +0 -223
- package/dist/tailwind/dist/utils/optimizeCSS.cjs +0 -405
- package/dist/tailwind/dist/utils/optimizeCSS.js +0 -403
- package/dist/tailwind/dist/utils/postcssPreserveVars.cjs +0 -67
- package/dist/tailwind/dist/utils/postcssPreserveVars.js +0 -65
- package/generated/componentData.json +0 -2397
- package/generated/tailwindPurge.ts +0 -4560
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalBottomSheetHeaderProps } from "../../../types/dist/index.js";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/BottomSheet/BottomSheetHeader.d.ts
|
|
6
|
+
type BottomSheetHeaderProps = UniversalBottomSheetHeaderProps;
|
|
7
|
+
declare function BottomSheetHeader({
|
|
8
|
+
children,
|
|
9
|
+
start,
|
|
10
|
+
end,
|
|
11
|
+
variant,
|
|
12
|
+
className
|
|
13
|
+
}: BottomSheetHeaderProps): react_jsx_runtime0.JSX.Element;
|
|
14
|
+
declare namespace BottomSheetHeader {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { BottomSheetHeader, type BottomSheetHeaderProps };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
import { cx, getStyles } from "../../../styles/styler.js";
|
|
4
|
+
import { Box } from "../../Box.js";
|
|
5
|
+
import { Text } from "../../Text.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/BottomSheet/BottomSheetHeader.tsx
|
|
9
|
+
function BottomSheetHeader({ children, start, end, variant = "default", className }) {
|
|
10
|
+
const headerVariantClass = getStyles({ bottomsheetVariantHeader: variant });
|
|
11
|
+
const resolvedStart = start ?? /* @__PURE__ */ jsx(Box, { className: "h-10 w-10 opacity-0 pointer-events-none" });
|
|
12
|
+
const resolvedEnd = end ?? /* @__PURE__ */ jsx(Box, { className: "h-10 w-10 opacity-0 pointer-events-none" });
|
|
13
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
14
|
+
display: "grid",
|
|
15
|
+
className: cx("grid-cols-[40px_1fr_40px]", "items-center", "w-full", "min-h-10", "mt-2", headerVariantClass, className),
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx(Box, {
|
|
18
|
+
display: "flex",
|
|
19
|
+
justifyContent: "flex-start",
|
|
20
|
+
children: resolvedStart
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ jsx(Text, {
|
|
23
|
+
variant: "inherit",
|
|
24
|
+
color: "inherit",
|
|
25
|
+
textAlign: "center",
|
|
26
|
+
className: "w-full",
|
|
27
|
+
children
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ jsx(Box, {
|
|
30
|
+
display: "flex",
|
|
31
|
+
justifyContent: "flex-end",
|
|
32
|
+
children: resolvedEnd
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
BottomSheetHeader.displayName = "BottomSheetHeader";
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { BottomSheetHeader };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
const require_components_client_BottomSheet_useBottomSheetStoreInternal = require('./useBottomSheetStoreInternal.cjs');
|
|
6
|
+
const require_components_client_BottomSheet_useBottomSheetStore = require('./useBottomSheetStore.cjs');
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let _ariakit_react_dialog = require("@ariakit/react/dialog");
|
|
9
|
+
|
|
10
|
+
//#region src/components/client/BottomSheet/BottomSheetProvider.tsx
|
|
11
|
+
const BottomSheetProvider = ({ children, controller: controllerProp }) => {
|
|
12
|
+
const fallbackStore = require_components_client_BottomSheet_useBottomSheetStoreInternal.useBottomSheetStoreInternal();
|
|
13
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react_dialog.DialogProvider, {
|
|
14
|
+
store: controllerProp ? require_components_client_BottomSheet_useBottomSheetStore.getBottomSheetInternal(controllerProp) : fallbackStore,
|
|
15
|
+
children
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
BottomSheetProvider.displayName = "BottomSheetProvider";
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.BottomSheetProvider = BottomSheetProvider;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { BottomSheetController } from "./useBottomSheetStore.cjs";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/BottomSheet/BottomSheetProvider.d.ts
|
|
7
|
+
interface BottomSheetProviderProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
controller?: BottomSheetController;
|
|
10
|
+
}
|
|
11
|
+
declare const BottomSheetProvider: {
|
|
12
|
+
({
|
|
13
|
+
children,
|
|
14
|
+
controller: controllerProp
|
|
15
|
+
}: BottomSheetProviderProps): react_jsx_runtime0.JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { BottomSheetProvider, type BottomSheetProviderProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { BottomSheetController } from "./useBottomSheetStore.js";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/BottomSheet/BottomSheetProvider.d.ts
|
|
7
|
+
interface BottomSheetProviderProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
controller?: BottomSheetController;
|
|
10
|
+
}
|
|
11
|
+
declare const BottomSheetProvider: {
|
|
12
|
+
({
|
|
13
|
+
children,
|
|
14
|
+
controller: controllerProp
|
|
15
|
+
}: BottomSheetProviderProps): react_jsx_runtime0.JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { BottomSheetProvider, type BottomSheetProviderProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
import { useBottomSheetStoreInternal } from "./useBottomSheetStoreInternal.js";
|
|
4
|
+
import { getBottomSheetInternal } from "./useBottomSheetStore.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { DialogProvider } from "@ariakit/react/dialog";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/BottomSheet/BottomSheetProvider.tsx
|
|
9
|
+
const BottomSheetProvider = ({ children, controller: controllerProp }) => {
|
|
10
|
+
const fallbackStore = useBottomSheetStoreInternal();
|
|
11
|
+
return /* @__PURE__ */ jsx(DialogProvider, {
|
|
12
|
+
store: controllerProp ? getBottomSheetInternal(controllerProp) : fallbackStore,
|
|
13
|
+
children
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
BottomSheetProvider.displayName = "BottomSheetProvider";
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { BottomSheetProvider };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
let _ariakit_react_dialog = require("@ariakit/react/dialog");
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/BottomSheet/BottomSheetTrigger.tsx
|
|
9
|
+
function BottomSheetTrigger(props) {
|
|
10
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react_dialog.DialogDisclosure, { ...props });
|
|
11
|
+
}
|
|
12
|
+
BottomSheetTrigger.displayName = "BottomSheetTrigger";
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.BottomSheetTrigger = BottomSheetTrigger;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { DialogDisclosureProps } from "@ariakit/react/dialog";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/BottomSheet/BottomSheetTrigger.d.ts
|
|
6
|
+
type BottomSheetTriggerProps = DialogDisclosureProps;
|
|
7
|
+
declare function BottomSheetTrigger(props: BottomSheetTriggerProps): react_jsx_runtime0.JSX.Element;
|
|
8
|
+
declare namespace BottomSheetTrigger {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { BottomSheetTrigger, type BottomSheetTriggerProps };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { DialogDisclosureProps } from "@ariakit/react/dialog";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/BottomSheet/BottomSheetTrigger.d.ts
|
|
6
|
+
type BottomSheetTriggerProps = DialogDisclosureProps;
|
|
7
|
+
declare function BottomSheetTrigger(props: BottomSheetTriggerProps): react_jsx_runtime0.JSX.Element;
|
|
8
|
+
declare namespace BottomSheetTrigger {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { BottomSheetTrigger, type BottomSheetTriggerProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { DialogDisclosure } from "@ariakit/react/dialog";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/BottomSheet/BottomSheetTrigger.tsx
|
|
7
|
+
function BottomSheetTrigger(props) {
|
|
8
|
+
return /* @__PURE__ */ jsx(DialogDisclosure, { ...props });
|
|
9
|
+
}
|
|
10
|
+
BottomSheetTrigger.displayName = "BottomSheetTrigger";
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { BottomSheetTrigger };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/BottomSheet/UDSBottomSheetConfigProvider.tsx
|
|
9
|
+
const BottomSheetContext = (0, react.createContext)(void 0);
|
|
10
|
+
const UDSBottomSheetConfigProvider = ({ children, value }) => {
|
|
11
|
+
const existingContext = (0, react.useContext)(BottomSheetContext);
|
|
12
|
+
const isMerge = typeof value === "object" && "type" in value && value.type === "merge";
|
|
13
|
+
if (isMerge && !existingContext) throw new Error("Cannot merge context values without an existing BottomSheetContext");
|
|
14
|
+
const finalValue = isMerge ? {
|
|
15
|
+
...existingContext,
|
|
16
|
+
...value.value
|
|
17
|
+
} : value;
|
|
18
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BottomSheetContext.Provider, {
|
|
19
|
+
value: finalValue,
|
|
20
|
+
children
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
UDSBottomSheetConfigProvider.displayName = "UDSBottomSheetConfigProvider";
|
|
24
|
+
function useBottomSheetConfig() {
|
|
25
|
+
const context = (0, react.useContext)(BottomSheetContext);
|
|
26
|
+
if (!context) throw new Error("useBottomSheetConfig must be used within a UDSBottomSheetConfigProvider");
|
|
27
|
+
return context;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.UDSBottomSheetConfigProvider = UDSBottomSheetConfigProvider;
|
|
32
|
+
exports.useBottomSheetConfig = useBottomSheetConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
import { UDSBottomSheetConfigContextType } from "../../../runtime/bottomSheetConfig.cjs";
|
|
3
|
+
import { PropsWithChildren } from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/BottomSheet/UDSBottomSheetConfigProvider.d.ts
|
|
7
|
+
interface UDSBottomSheetConfigProviderProps extends PropsWithChildren {
|
|
8
|
+
value: UDSBottomSheetConfigContextType | {
|
|
9
|
+
type: 'merge';
|
|
10
|
+
value: Partial<UDSBottomSheetConfigContextType>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
declare const UDSBottomSheetConfigProvider: {
|
|
14
|
+
({
|
|
15
|
+
children,
|
|
16
|
+
value
|
|
17
|
+
}: UDSBottomSheetConfigProviderProps): react_jsx_runtime0.JSX.Element;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
20
|
+
declare function useBottomSheetConfig(): UDSBottomSheetConfigContextType;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { type UDSBottomSheetConfigContextType, UDSBottomSheetConfigProvider, type UDSBottomSheetConfigProviderProps, useBottomSheetConfig };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
import { UDSBottomSheetConfigContextType } from "../../../runtime/bottomSheetConfig.js";
|
|
3
|
+
import { PropsWithChildren } from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/BottomSheet/UDSBottomSheetConfigProvider.d.ts
|
|
7
|
+
interface UDSBottomSheetConfigProviderProps extends PropsWithChildren {
|
|
8
|
+
value: UDSBottomSheetConfigContextType | {
|
|
9
|
+
type: 'merge';
|
|
10
|
+
value: Partial<UDSBottomSheetConfigContextType>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
declare const UDSBottomSheetConfigProvider: {
|
|
14
|
+
({
|
|
15
|
+
children,
|
|
16
|
+
value
|
|
17
|
+
}: UDSBottomSheetConfigProviderProps): react_jsx_runtime0.JSX.Element;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
20
|
+
declare function useBottomSheetConfig(): UDSBottomSheetConfigContextType;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { type UDSBottomSheetConfigContextType, UDSBottomSheetConfigProvider, type UDSBottomSheetConfigProviderProps, useBottomSheetConfig };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/BottomSheet/UDSBottomSheetConfigProvider.tsx
|
|
7
|
+
const BottomSheetContext = createContext(void 0);
|
|
8
|
+
const UDSBottomSheetConfigProvider = ({ children, value }) => {
|
|
9
|
+
const existingContext = useContext(BottomSheetContext);
|
|
10
|
+
const isMerge = typeof value === "object" && "type" in value && value.type === "merge";
|
|
11
|
+
if (isMerge && !existingContext) throw new Error("Cannot merge context values without an existing BottomSheetContext");
|
|
12
|
+
const finalValue = isMerge ? {
|
|
13
|
+
...existingContext,
|
|
14
|
+
...value.value
|
|
15
|
+
} : value;
|
|
16
|
+
return /* @__PURE__ */ jsx(BottomSheetContext.Provider, {
|
|
17
|
+
value: finalValue,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
UDSBottomSheetConfigProvider.displayName = "UDSBottomSheetConfigProvider";
|
|
22
|
+
function useBottomSheetConfig() {
|
|
23
|
+
const context = useContext(BottomSheetContext);
|
|
24
|
+
if (!context) throw new Error("useBottomSheetConfig must be used within a UDSBottomSheetConfigProvider");
|
|
25
|
+
return context;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { UDSBottomSheetConfigProvider, useBottomSheetConfig };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_components_client_BottomSheet_UDSBottomSheetConfigProvider = require('./UDSBottomSheetConfigProvider.cjs');
|
|
5
|
+
const require_components_client_BottomSheet_useBottomSheetStore = require('./useBottomSheetStore.cjs');
|
|
6
|
+
const require_components_client_BottomSheet_BottomSheet = require('./BottomSheet.cjs');
|
|
7
|
+
const require_components_client_BottomSheet_BottomSheetContent = require('./BottomSheetContent.cjs');
|
|
8
|
+
const require_components_client_BottomSheet_BottomSheetDismiss = require('./BottomSheetDismiss.cjs');
|
|
9
|
+
const require_components_client_BottomSheet_BottomSheetHeader = require('./BottomSheetHeader.cjs');
|
|
10
|
+
const require_components_client_BottomSheet_BottomSheetProvider = require('./BottomSheetProvider.cjs');
|
|
11
|
+
const require_components_client_BottomSheet_BottomSheetTrigger = require('./BottomSheetTrigger.cjs');
|
|
12
|
+
|
|
13
|
+
exports.BottomSheet = require_components_client_BottomSheet_BottomSheet.BottomSheet;
|
|
14
|
+
exports.BottomSheetContent = require_components_client_BottomSheet_BottomSheetContent.BottomSheetContent;
|
|
15
|
+
exports.BottomSheetDismiss = require_components_client_BottomSheet_BottomSheetDismiss.BottomSheetDismiss;
|
|
16
|
+
exports.BottomSheetHeader = require_components_client_BottomSheet_BottomSheetHeader.BottomSheetHeader;
|
|
17
|
+
exports.BottomSheetProvider = require_components_client_BottomSheet_BottomSheetProvider.BottomSheetProvider;
|
|
18
|
+
exports.BottomSheetTrigger = require_components_client_BottomSheet_BottomSheetTrigger.BottomSheetTrigger;
|
|
19
|
+
exports.UDSBottomSheetConfigProvider = require_components_client_BottomSheet_UDSBottomSheetConfigProvider.UDSBottomSheetConfigProvider;
|
|
20
|
+
exports.getBottomSheetInternal = require_components_client_BottomSheet_useBottomSheetStore.getBottomSheetInternal;
|
|
21
|
+
exports.useBottomSheetConfig = require_components_client_BottomSheet_UDSBottomSheetConfigProvider.useBottomSheetConfig;
|
|
22
|
+
exports.useBottomSheetStore = require_components_client_BottomSheet_useBottomSheetStore.useBottomSheetStore;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import { BottomSheetController, UseBottomSheetStoreProps, getBottomSheetInternal, useBottomSheetStore } from "./useBottomSheetStore.cjs";
|
|
3
|
+
import { BottomSheet, BottomSheetProps } from "./BottomSheet.cjs";
|
|
4
|
+
import { BottomSheetContent, BottomSheetContentProps } from "./BottomSheetContent.cjs";
|
|
5
|
+
import { BottomSheetDismiss, BottomSheetDismissProps } from "./BottomSheetDismiss.cjs";
|
|
6
|
+
import { BottomSheetHeader, BottomSheetHeaderProps } from "./BottomSheetHeader.cjs";
|
|
7
|
+
import { BottomSheetProvider, BottomSheetProviderProps } from "./BottomSheetProvider.cjs";
|
|
8
|
+
import { BottomSheetTrigger, BottomSheetTriggerProps } from "./BottomSheetTrigger.cjs";
|
|
9
|
+
import { UDSBottomSheetConfigProvider, UDSBottomSheetConfigProviderProps, useBottomSheetConfig } from "./UDSBottomSheetConfigProvider.cjs";
|
|
10
|
+
export { BottomSheet, BottomSheetContent, type BottomSheetContentProps, BottomSheetController, BottomSheetDismiss, BottomSheetDismissProps, BottomSheetHeader, BottomSheetHeaderProps, BottomSheetProps, BottomSheetProvider, BottomSheetProviderProps, BottomSheetTrigger, BottomSheetTriggerProps, UDSBottomSheetConfigProvider, type UDSBottomSheetConfigProviderProps, UseBottomSheetStoreProps, getBottomSheetInternal, useBottomSheetConfig, useBottomSheetStore };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import { BottomSheetController, UseBottomSheetStoreProps, getBottomSheetInternal, useBottomSheetStore } from "./useBottomSheetStore.js";
|
|
3
|
+
import { BottomSheet, BottomSheetProps } from "./BottomSheet.js";
|
|
4
|
+
import { BottomSheetContent, BottomSheetContentProps } from "./BottomSheetContent.js";
|
|
5
|
+
import { BottomSheetDismiss, BottomSheetDismissProps } from "./BottomSheetDismiss.js";
|
|
6
|
+
import { BottomSheetHeader, BottomSheetHeaderProps } from "./BottomSheetHeader.js";
|
|
7
|
+
import { BottomSheetProvider, BottomSheetProviderProps } from "./BottomSheetProvider.js";
|
|
8
|
+
import { BottomSheetTrigger, BottomSheetTriggerProps } from "./BottomSheetTrigger.js";
|
|
9
|
+
import { UDSBottomSheetConfigProvider, UDSBottomSheetConfigProviderProps, useBottomSheetConfig } from "./UDSBottomSheetConfigProvider.js";
|
|
10
|
+
export { BottomSheet, BottomSheetContent, type BottomSheetContentProps, BottomSheetController, BottomSheetDismiss, BottomSheetDismissProps, BottomSheetHeader, BottomSheetHeaderProps, BottomSheetProps, BottomSheetProvider, BottomSheetProviderProps, BottomSheetTrigger, BottomSheetTriggerProps, UDSBottomSheetConfigProvider, type UDSBottomSheetConfigProviderProps, UseBottomSheetStoreProps, getBottomSheetInternal, useBottomSheetConfig, useBottomSheetStore };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
import { UDSBottomSheetConfigProvider, useBottomSheetConfig } from "./UDSBottomSheetConfigProvider.js";
|
|
4
|
+
import { getBottomSheetInternal, useBottomSheetStore } from "./useBottomSheetStore.js";
|
|
5
|
+
import { BottomSheet } from "./BottomSheet.js";
|
|
6
|
+
import { BottomSheetContent } from "./BottomSheetContent.js";
|
|
7
|
+
import { BottomSheetDismiss } from "./BottomSheetDismiss.js";
|
|
8
|
+
import { BottomSheetHeader } from "./BottomSheetHeader.js";
|
|
9
|
+
import { BottomSheetProvider } from "./BottomSheetProvider.js";
|
|
10
|
+
import { BottomSheetTrigger } from "./BottomSheetTrigger.js";
|
|
11
|
+
|
|
12
|
+
export { BottomSheet, BottomSheetContent, BottomSheetDismiss, BottomSheetHeader, BottomSheetProvider, BottomSheetTrigger, UDSBottomSheetConfigProvider, getBottomSheetInternal, useBottomSheetConfig, useBottomSheetStore };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
const require_components_client_BottomSheet_utils = require('./utils.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let lodash_clamp_js = require("lodash/clamp.js");
|
|
8
|
+
lodash_clamp_js = require_runtime.__toESM(lodash_clamp_js);
|
|
9
|
+
|
|
10
|
+
//#region src/components/client/BottomSheet/useBottomSheetDrag.ts
|
|
11
|
+
const DEFAULT_SCROLL_LOCK_TIMEOUT_MS = 100;
|
|
12
|
+
const OPEN_SCROLL_LOCK_TIMEOUT_MS = 500;
|
|
13
|
+
/**
|
|
14
|
+
* Drag-to-dismiss velocity threshold in pixels/second. A fast downward swipe
|
|
15
|
+
* exceeding this speed dismisses the sheet (regardless of distance dragged).
|
|
16
|
+
*/
|
|
17
|
+
const DRAG_DISMISS_VELOCITY_PX_PER_SECOND = 400;
|
|
18
|
+
function useBottomSheetDrag({ enableDrag, dismissible, store, sheetRef, isDraggingRef, activeSnapIndex, snapPointTranslatesPx, maxSnapPointPx, resolvedSnapPointsLength, resolvedDismissThresholdPx, emitSnapPointChange, setTranslateImmediate, openTimeRef, lastTimeDragPreventedRef }) {
|
|
19
|
+
const isAllowedToDragRef = (0, react.useRef)(false);
|
|
20
|
+
const dragStartTimeRef = (0, react.useRef)(null);
|
|
21
|
+
const pointerStartRef = (0, react.useRef)(null);
|
|
22
|
+
const dragStartTranslateRef = (0, react.useRef)(0);
|
|
23
|
+
const dragStartIndexRef = (0, react.useRef)(0);
|
|
24
|
+
const shouldDragFromTarget = (0, react.useCallback)((target, isDraggingUp) => {
|
|
25
|
+
if (!sheetRef.current) return false;
|
|
26
|
+
if (require_components_client_BottomSheet_utils.shouldPreventDragFromTarget(target)) return false;
|
|
27
|
+
const selection = window.getSelection();
|
|
28
|
+
if (selection?.toString() && sheetRef.current?.contains(selection.anchorNode)) return false;
|
|
29
|
+
const now = Date.now();
|
|
30
|
+
const openTime = openTimeRef.current;
|
|
31
|
+
if (openTime && now - openTime < OPEN_SCROLL_LOCK_TIMEOUT_MS) return false;
|
|
32
|
+
const currentHeight = sheetRef.current.getBoundingClientRect().height;
|
|
33
|
+
if (currentHeight < maxSnapPointPx) return true;
|
|
34
|
+
const lastPrevented = lastTimeDragPreventedRef.current;
|
|
35
|
+
if (lastPrevented && now - lastPrevented < DEFAULT_SCROLL_LOCK_TIMEOUT_MS && currentHeight >= maxSnapPointPx) return false;
|
|
36
|
+
if (isDraggingUp) {
|
|
37
|
+
lastTimeDragPreventedRef.current = now;
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
let element = target instanceof HTMLElement ? target : null;
|
|
41
|
+
while (element) {
|
|
42
|
+
if (require_components_client_BottomSheet_utils.isScrollable(element)) {
|
|
43
|
+
if (element.scrollTop !== 0) {
|
|
44
|
+
lastTimeDragPreventedRef.current = now;
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (element === sheetRef.current || element.getAttribute("role") === "dialog") return true;
|
|
49
|
+
element = element.parentNode;
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
}, [
|
|
53
|
+
lastTimeDragPreventedRef,
|
|
54
|
+
maxSnapPointPx,
|
|
55
|
+
openTimeRef,
|
|
56
|
+
sheetRef
|
|
57
|
+
]);
|
|
58
|
+
const cancelDrag = (0, react.useCallback)(() => {
|
|
59
|
+
isDraggingRef.current = false;
|
|
60
|
+
isAllowedToDragRef.current = false;
|
|
61
|
+
dragStartTimeRef.current = null;
|
|
62
|
+
pointerStartRef.current = null;
|
|
63
|
+
sheetRef.current?.style.removeProperty("transition");
|
|
64
|
+
}, [isDraggingRef, sheetRef]);
|
|
65
|
+
const onPointerDown = (0, react.useCallback)((event) => {
|
|
66
|
+
if (!enableDrag) return;
|
|
67
|
+
if (event.button !== 0) return;
|
|
68
|
+
if (require_components_client_BottomSheet_utils.shouldPreventDragFromTarget(event.target)) return;
|
|
69
|
+
isDraggingRef.current = false;
|
|
70
|
+
isAllowedToDragRef.current = false;
|
|
71
|
+
dragStartTimeRef.current = performance.now();
|
|
72
|
+
pointerStartRef.current = {
|
|
73
|
+
x: event.pageX,
|
|
74
|
+
y: event.pageY
|
|
75
|
+
};
|
|
76
|
+
dragStartTranslateRef.current = maxSnapPointPx - (sheetRef.current?.getBoundingClientRect().height ?? 0);
|
|
77
|
+
dragStartIndexRef.current = activeSnapIndex;
|
|
78
|
+
}, [
|
|
79
|
+
activeSnapIndex,
|
|
80
|
+
enableDrag,
|
|
81
|
+
isDraggingRef,
|
|
82
|
+
maxSnapPointPx,
|
|
83
|
+
sheetRef
|
|
84
|
+
]);
|
|
85
|
+
const onPointerMove = (0, react.useCallback)((event) => {
|
|
86
|
+
if (!enableDrag) return;
|
|
87
|
+
const startPoint = pointerStartRef.current;
|
|
88
|
+
const sheetEl = sheetRef.current;
|
|
89
|
+
if (!startPoint || !sheetEl) return;
|
|
90
|
+
if (!isAllowedToDragRef.current && event.buttons === 0) {
|
|
91
|
+
cancelDrag();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const { x: startX, y: startY } = startPoint;
|
|
95
|
+
const dx = event.pageX - startX;
|
|
96
|
+
const dy = event.pageY - startY;
|
|
97
|
+
const swipeStartThreshold = event.pointerType === "touch" ? 10 : 2;
|
|
98
|
+
if (!isAllowedToDragRef.current) {
|
|
99
|
+
if (Math.abs(dy) < swipeStartThreshold) return;
|
|
100
|
+
if (Math.abs(dx) > Math.abs(dy)) {
|
|
101
|
+
pointerStartRef.current = null;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const isDraggingUp = startY - event.pageY > 0;
|
|
106
|
+
if (!isAllowedToDragRef.current && !shouldDragFromTarget(event.target, isDraggingUp)) return;
|
|
107
|
+
if (!isAllowedToDragRef.current) {
|
|
108
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
109
|
+
isAllowedToDragRef.current = true;
|
|
110
|
+
isDraggingRef.current = true;
|
|
111
|
+
}
|
|
112
|
+
sheetEl.style.transition = "none";
|
|
113
|
+
setTranslateImmediate((0, lodash_clamp_js.default)(dragStartTranslateRef.current + dy, 0, maxSnapPointPx));
|
|
114
|
+
}, [
|
|
115
|
+
enableDrag,
|
|
116
|
+
isDraggingRef,
|
|
117
|
+
maxSnapPointPx,
|
|
118
|
+
setTranslateImmediate,
|
|
119
|
+
shouldDragFromTarget,
|
|
120
|
+
sheetRef
|
|
121
|
+
]);
|
|
122
|
+
const onPointerUp = (0, react.useCallback)((event) => {
|
|
123
|
+
if (!enableDrag) return;
|
|
124
|
+
if (!pointerStartRef.current || !sheetRef.current) {
|
|
125
|
+
cancelDrag();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (!isAllowedToDragRef.current) {
|
|
129
|
+
cancelDrag();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const { y: startY } = pointerStartRef.current;
|
|
133
|
+
const draggedDistance = startY - event.pageY;
|
|
134
|
+
const timeTakenMs = Math.max(performance.now() - (dragStartTimeRef.current ?? performance.now()), 1);
|
|
135
|
+
const velocityPxPerSecond = Math.abs(draggedDistance) / timeTakenMs * 1e3;
|
|
136
|
+
const currentTranslatePx = maxSnapPointPx - sheetRef.current.getBoundingClientRect().height;
|
|
137
|
+
const draggedDownBeyondLowestPx = currentTranslatePx - (snapPointTranslatesPx[dragStartIndexRef.current] ?? maxSnapPointPx);
|
|
138
|
+
const draggedDown = draggedDistance < 0;
|
|
139
|
+
const draggedUp = draggedDistance > 0;
|
|
140
|
+
const isAtLowestSnapPoint = dragStartIndexRef.current === 0;
|
|
141
|
+
if (dismissible && isAtLowestSnapPoint && draggedDown && (velocityPxPerSecond >= DRAG_DISMISS_VELOCITY_PX_PER_SECOND || draggedDownBeyondLowestPx >= resolvedDismissThresholdPx)) {
|
|
142
|
+
cancelDrag();
|
|
143
|
+
store.hide();
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const lastIndex = resolvedSnapPointsLength - 1;
|
|
147
|
+
const startIndex = dragStartIndexRef.current;
|
|
148
|
+
if (velocityPxPerSecond >= DRAG_DISMISS_VELOCITY_PX_PER_SECOND && (draggedUp || draggedDown)) {
|
|
149
|
+
const nextIndex = require_components_client_BottomSheet_utils.clampIndex(startIndex + (draggedUp ? 1 : -1), resolvedSnapPointsLength);
|
|
150
|
+
cancelDrag();
|
|
151
|
+
emitSnapPointChange(nextIndex);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
let closestIndex = 0;
|
|
155
|
+
let closestDist = Number.POSITIVE_INFINITY;
|
|
156
|
+
for (let i = 0; i <= lastIndex; i++) {
|
|
157
|
+
const dist = Math.abs((snapPointTranslatesPx[i] ?? 0) - currentTranslatePx);
|
|
158
|
+
if (dist < closestDist) {
|
|
159
|
+
closestDist = dist;
|
|
160
|
+
closestIndex = i;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
cancelDrag();
|
|
164
|
+
emitSnapPointChange(closestIndex);
|
|
165
|
+
}, [
|
|
166
|
+
cancelDrag,
|
|
167
|
+
dismissible,
|
|
168
|
+
emitSnapPointChange,
|
|
169
|
+
enableDrag,
|
|
170
|
+
maxSnapPointPx,
|
|
171
|
+
resolvedDismissThresholdPx,
|
|
172
|
+
resolvedSnapPointsLength,
|
|
173
|
+
sheetRef,
|
|
174
|
+
snapPointTranslatesPx,
|
|
175
|
+
store
|
|
176
|
+
]);
|
|
177
|
+
return {
|
|
178
|
+
onPointerDown,
|
|
179
|
+
onPointerMove,
|
|
180
|
+
onPointerUp,
|
|
181
|
+
onPointerCancel: (0, react.useCallback)((event) => {
|
|
182
|
+
onPointerUp(event);
|
|
183
|
+
}, [onPointerUp])
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
//#endregion
|
|
188
|
+
exports.useBottomSheetDrag = useBottomSheetDrag;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
import React, { MutableRefObject } from "react";
|
|
3
|
+
import { DialogStore } from "@ariakit/react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/BottomSheet/useBottomSheetDrag.d.ts
|
|
6
|
+
interface UseBottomSheetDragParams {
|
|
7
|
+
enableDrag: boolean;
|
|
8
|
+
dismissible: boolean;
|
|
9
|
+
store: DialogStore;
|
|
10
|
+
sheetRef: MutableRefObject<HTMLDivElement | null>;
|
|
11
|
+
isDraggingRef: MutableRefObject<boolean>;
|
|
12
|
+
activeSnapIndex: number;
|
|
13
|
+
snapPointTranslatesPx: number[];
|
|
14
|
+
maxSnapPointPx: number;
|
|
15
|
+
resolvedSnapPointsLength: number;
|
|
16
|
+
resolvedDismissThresholdPx: number;
|
|
17
|
+
emitSnapPointChange: (nextIndex: number) => void;
|
|
18
|
+
setTranslateImmediate: (nextTranslatePx: number) => void;
|
|
19
|
+
openTimeRef: MutableRefObject<number | null>;
|
|
20
|
+
lastTimeDragPreventedRef: MutableRefObject<number | null>;
|
|
21
|
+
}
|
|
22
|
+
declare function useBottomSheetDrag({
|
|
23
|
+
enableDrag,
|
|
24
|
+
dismissible,
|
|
25
|
+
store,
|
|
26
|
+
sheetRef,
|
|
27
|
+
isDraggingRef,
|
|
28
|
+
activeSnapIndex,
|
|
29
|
+
snapPointTranslatesPx,
|
|
30
|
+
maxSnapPointPx,
|
|
31
|
+
resolvedSnapPointsLength,
|
|
32
|
+
resolvedDismissThresholdPx,
|
|
33
|
+
emitSnapPointChange,
|
|
34
|
+
setTranslateImmediate,
|
|
35
|
+
openTimeRef,
|
|
36
|
+
lastTimeDragPreventedRef
|
|
37
|
+
}: UseBottomSheetDragParams): {
|
|
38
|
+
onPointerDown: (event: React.PointerEvent<HTMLDivElement>) => void;
|
|
39
|
+
onPointerMove: (event: React.PointerEvent<HTMLDivElement>) => void;
|
|
40
|
+
onPointerUp: (event: React.PointerEvent<HTMLDivElement>) => void;
|
|
41
|
+
onPointerCancel: (event: React.PointerEvent<HTMLDivElement>) => void;
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { useBottomSheetDrag };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
import React, { MutableRefObject } from "react";
|
|
3
|
+
import { DialogStore } from "@ariakit/react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/BottomSheet/useBottomSheetDrag.d.ts
|
|
6
|
+
interface UseBottomSheetDragParams {
|
|
7
|
+
enableDrag: boolean;
|
|
8
|
+
dismissible: boolean;
|
|
9
|
+
store: DialogStore;
|
|
10
|
+
sheetRef: MutableRefObject<HTMLDivElement | null>;
|
|
11
|
+
isDraggingRef: MutableRefObject<boolean>;
|
|
12
|
+
activeSnapIndex: number;
|
|
13
|
+
snapPointTranslatesPx: number[];
|
|
14
|
+
maxSnapPointPx: number;
|
|
15
|
+
resolvedSnapPointsLength: number;
|
|
16
|
+
resolvedDismissThresholdPx: number;
|
|
17
|
+
emitSnapPointChange: (nextIndex: number) => void;
|
|
18
|
+
setTranslateImmediate: (nextTranslatePx: number) => void;
|
|
19
|
+
openTimeRef: MutableRefObject<number | null>;
|
|
20
|
+
lastTimeDragPreventedRef: MutableRefObject<number | null>;
|
|
21
|
+
}
|
|
22
|
+
declare function useBottomSheetDrag({
|
|
23
|
+
enableDrag,
|
|
24
|
+
dismissible,
|
|
25
|
+
store,
|
|
26
|
+
sheetRef,
|
|
27
|
+
isDraggingRef,
|
|
28
|
+
activeSnapIndex,
|
|
29
|
+
snapPointTranslatesPx,
|
|
30
|
+
maxSnapPointPx,
|
|
31
|
+
resolvedSnapPointsLength,
|
|
32
|
+
resolvedDismissThresholdPx,
|
|
33
|
+
emitSnapPointChange,
|
|
34
|
+
setTranslateImmediate,
|
|
35
|
+
openTimeRef,
|
|
36
|
+
lastTimeDragPreventedRef
|
|
37
|
+
}: UseBottomSheetDragParams): {
|
|
38
|
+
onPointerDown: (event: React.PointerEvent<HTMLDivElement>) => void;
|
|
39
|
+
onPointerMove: (event: React.PointerEvent<HTMLDivElement>) => void;
|
|
40
|
+
onPointerUp: (event: React.PointerEvent<HTMLDivElement>) => void;
|
|
41
|
+
onPointerCancel: (event: React.PointerEvent<HTMLDivElement>) => void;
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { useBottomSheetDrag };
|