@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
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
3
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
4
4
|
const require_defaultTokensConfig = require('../../defaultTokensConfig.cjs');
|
|
5
|
+
const require_runtime_bottomSheetConfig = require('../../runtime/bottomSheetConfig.cjs');
|
|
5
6
|
const require_runtime_breakpointsConfig = require('../../runtime/breakpointsConfig.cjs');
|
|
6
7
|
const require_runtime_toastConfig = require('../../runtime/toastConfig.cjs');
|
|
7
8
|
const require_runtime_tooltipConfig = require('../../runtime/tooltipConfig.cjs');
|
|
9
|
+
const require_analytics = require('../dist/utils/analytics.cjs');
|
|
8
10
|
const require_colors = require('../dist/lib/colors.cjs');
|
|
9
11
|
const require_print = require('../dist/lib/print.cjs');
|
|
10
12
|
const require_box = require('../dist/lib/box.cjs');
|
|
11
13
|
const require_config = require('../dist/utils/rules/config.cjs');
|
|
12
14
|
const require_cli_commands_utils_sortKeys = require('./utils/sortKeys.cjs');
|
|
13
|
-
let node_fs = require("node:fs");
|
|
14
15
|
let node_path = require("node:path");
|
|
15
16
|
node_path = require_runtime.__toESM(node_path);
|
|
17
|
+
let node_fs = require("node:fs");
|
|
16
18
|
|
|
17
19
|
//#region src/cli/commands/sync.ts
|
|
18
20
|
const PRODUCTION_ENDPOINT = "https://config.uds.build/api/config";
|
|
@@ -61,6 +63,7 @@ const syncCommand = {
|
|
|
61
63
|
const exportsTS = [`export const config: UniversalTokensConfig = ${JSON.stringify(sortedConfig, null, 2)} as UniversalTokensConfig;`];
|
|
62
64
|
const exportsJS = [`export const config = ${JSON.stringify(sortedConfig, null, 2)};`];
|
|
63
65
|
const runtimeConfigs = {
|
|
66
|
+
bottomSheet: [require_runtime_bottomSheetConfig.configToBottomSheetConfigContext(sortedConfig), "UDSBottomSheetConfigContextType"],
|
|
64
67
|
breakpoints: [require_runtime_breakpointsConfig.configToBreakpointsConfigContext(sortedConfig), "UDSBreakpointsConfigContextType"],
|
|
65
68
|
toast: [require_runtime_toastConfig.configToToastConfigContext(sortedConfig), "UDSToastConfigContextType"],
|
|
66
69
|
tooltip: [require_runtime_tooltipConfig.configToTooltipConfigContext(sortedConfig), "UDSTooltipConfigContextType"]
|
|
@@ -75,11 +78,13 @@ const syncCommand = {
|
|
|
75
78
|
runtimeTypeImports.push("UDSConfigContextType");
|
|
76
79
|
importsTS.push(`import type { ${runtimeTypeImports.sort().join(", ")} } from '@yahoo/uds/runtime';`);
|
|
77
80
|
exportsTS.push(`export const runtimeConfig: UDSConfigContextType = {
|
|
81
|
+
bottomSheet: bottomSheetRuntimeConfig,
|
|
78
82
|
breakpoints: breakpointsRuntimeConfig,
|
|
79
83
|
toast: toastRuntimeConfig,
|
|
80
84
|
tooltip: tooltipRuntimeConfig,
|
|
81
85
|
};`);
|
|
82
86
|
exportsJS.push(`export const runtimeConfig = {
|
|
87
|
+
bottomSheet: bottomSheetRuntimeConfig,
|
|
83
88
|
breakpoints: breakpointsRuntimeConfig,
|
|
84
89
|
toast: toastRuntimeConfig,
|
|
85
90
|
tooltip: tooltipRuntimeConfig,
|
|
@@ -90,6 +95,7 @@ const syncCommand = {
|
|
|
90
95
|
require_print.print(require_colors.green(`✅ Synced UDS config ${id} to ${fullPath}`));
|
|
91
96
|
const staleEditors = require_config.getEditorsWithStaleRules(process.cwd());
|
|
92
97
|
if (staleEditors.length > 0) require_box.printBox([require_colors.bold(`Updated UDS rules are available for ${staleEditors.join(" and ")}.`), `Run ${require_colors.cyan("`uds editor-rules`")} to update.`]);
|
|
98
|
+
await require_analytics.trackEvent("sync", { id });
|
|
93
99
|
} catch (error) {
|
|
94
100
|
require_print.print(require_colors.red(`❌ ${error.message}`));
|
|
95
101
|
require_print.print(require_colors.yellow("Please reach out to #uds-ask channel for support."));
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
import { defaultTokensConfig } from "../../defaultTokensConfig.js";
|
|
3
|
+
import { configToBottomSheetConfigContext } from "../../runtime/bottomSheetConfig.js";
|
|
3
4
|
import { configToBreakpointsConfigContext } from "../../runtime/breakpointsConfig.js";
|
|
4
5
|
import { configToToastConfigContext } from "../../runtime/toastConfig.js";
|
|
5
6
|
import { configToTooltipConfigContext } from "../../runtime/tooltipConfig.js";
|
|
7
|
+
import { trackEvent } from "../dist/utils/analytics.js";
|
|
6
8
|
import { bold, cyan, green, magenta, red, yellow } from "../dist/lib/colors.js";
|
|
7
9
|
import { print } from "../dist/lib/print.js";
|
|
8
10
|
import { printBox } from "../dist/lib/box.js";
|
|
9
11
|
import { getEditorsWithStaleRules } from "../dist/utils/rules/config.js";
|
|
10
12
|
import { sortKeys } from "./utils/sortKeys.js";
|
|
11
|
-
import { writeFileSync } from "node:fs";
|
|
12
13
|
import path from "node:path";
|
|
14
|
+
import { writeFileSync } from "node:fs";
|
|
13
15
|
|
|
14
16
|
//#region src/cli/commands/sync.ts
|
|
15
17
|
const PRODUCTION_ENDPOINT = "https://config.uds.build/api/config";
|
|
@@ -58,6 +60,7 @@ const syncCommand = {
|
|
|
58
60
|
const exportsTS = [`export const config: UniversalTokensConfig = ${JSON.stringify(sortedConfig, null, 2)} as UniversalTokensConfig;`];
|
|
59
61
|
const exportsJS = [`export const config = ${JSON.stringify(sortedConfig, null, 2)};`];
|
|
60
62
|
const runtimeConfigs = {
|
|
63
|
+
bottomSheet: [configToBottomSheetConfigContext(sortedConfig), "UDSBottomSheetConfigContextType"],
|
|
61
64
|
breakpoints: [configToBreakpointsConfigContext(sortedConfig), "UDSBreakpointsConfigContextType"],
|
|
62
65
|
toast: [configToToastConfigContext(sortedConfig), "UDSToastConfigContextType"],
|
|
63
66
|
tooltip: [configToTooltipConfigContext(sortedConfig), "UDSTooltipConfigContextType"]
|
|
@@ -72,11 +75,13 @@ const syncCommand = {
|
|
|
72
75
|
runtimeTypeImports.push("UDSConfigContextType");
|
|
73
76
|
importsTS.push(`import type { ${runtimeTypeImports.sort().join(", ")} } from '@yahoo/uds/runtime';`);
|
|
74
77
|
exportsTS.push(`export const runtimeConfig: UDSConfigContextType = {
|
|
78
|
+
bottomSheet: bottomSheetRuntimeConfig,
|
|
75
79
|
breakpoints: breakpointsRuntimeConfig,
|
|
76
80
|
toast: toastRuntimeConfig,
|
|
77
81
|
tooltip: tooltipRuntimeConfig,
|
|
78
82
|
};`);
|
|
79
83
|
exportsJS.push(`export const runtimeConfig = {
|
|
84
|
+
bottomSheet: bottomSheetRuntimeConfig,
|
|
80
85
|
breakpoints: breakpointsRuntimeConfig,
|
|
81
86
|
toast: toastRuntimeConfig,
|
|
82
87
|
tooltip: tooltipRuntimeConfig,
|
|
@@ -87,6 +92,7 @@ const syncCommand = {
|
|
|
87
92
|
print(green(`✅ Synced UDS config ${id} to ${fullPath}`));
|
|
88
93
|
const staleEditors = getEditorsWithStaleRules(process.cwd());
|
|
89
94
|
if (staleEditors.length > 0) printBox([bold(`Updated UDS rules are available for ${staleEditors.join(" and ")}.`), `Run ${cyan("`uds editor-rules`")} to update.`]);
|
|
95
|
+
await trackEvent("sync", { id });
|
|
90
96
|
} catch (error) {
|
|
91
97
|
print(red(`❌ ${error.message}`));
|
|
92
98
|
print(yellow("Please reach out to #uds-ask channel for support."));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
3
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
4
|
+
const require_analytics = require('../dist/utils/analytics.cjs');
|
|
4
5
|
const require_print = require('../dist/lib/print.cjs');
|
|
5
6
|
let _yahoo_uds_package_json = require("@yahoo/uds/package.json");
|
|
6
7
|
_yahoo_uds_package_json = require_runtime.__toESM(_yahoo_uds_package_json);
|
|
@@ -12,6 +13,7 @@ const versionCommand = {
|
|
|
12
13
|
description: `Display CLI version (${version})`,
|
|
13
14
|
run: async () => {
|
|
14
15
|
require_print.print(version);
|
|
16
|
+
await require_analytics.trackEvent("version", { version });
|
|
15
17
|
}
|
|
16
18
|
};
|
|
17
19
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { trackEvent } from "../dist/utils/analytics.js";
|
|
2
3
|
import { print } from "../dist/lib/print.js";
|
|
3
4
|
import pkg from "@yahoo/uds/package.json" with { type: "json" };
|
|
4
5
|
|
|
@@ -9,6 +10,7 @@ const versionCommand = {
|
|
|
9
10
|
description: `Display CLI version (${version})`,
|
|
10
11
|
run: async () => {
|
|
11
12
|
print(version);
|
|
13
|
+
await trackEvent("version", { version });
|
|
12
14
|
}
|
|
13
15
|
};
|
|
14
16
|
|
package/dist/cli/dist/cli.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
const require_analytics = require('./utils/analytics.cjs');
|
|
2
3
|
const require_args = require('./lib/args.cjs');
|
|
3
4
|
const require_colors = require('./lib/colors.cjs');
|
|
4
5
|
const require_print = require('./lib/print.cjs');
|
|
5
|
-
const require_analytics = require('./utils/analytics.cjs');
|
|
6
6
|
const require_getCommandHelp = require('./utils/getCommandHelp.cjs');
|
|
7
7
|
const require_codemod = require('./commands/codemod/codemod.cjs');
|
|
8
8
|
const require_editor_rules = require('./commands/editor-rules.cjs');
|
package/dist/cli/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { trackEvent } from "./utils/analytics.js";
|
|
2
3
|
import { parseArgs } from "./lib/args.js";
|
|
3
4
|
import { cyan, gray, green, magenta, red, white } from "./lib/colors.js";
|
|
4
5
|
import { print } from "./lib/print.js";
|
|
5
|
-
import { trackEvent } from "./utils/analytics.js";
|
|
6
6
|
import { CODEMOD_SUBCOMMANDS } from "./utils/getCommandHelp.js";
|
|
7
7
|
import { codemod_default } from "./commands/codemod/codemod.js";
|
|
8
8
|
import { editor_rules_default } from "./commands/editor-rules.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_analytics = require('../utils/analytics.cjs');
|
|
3
4
|
const require_colors = require('../lib/colors.cjs');
|
|
4
5
|
const require_print = require('../lib/print.cjs');
|
|
5
|
-
const require_analytics = require('../utils/analytics.cjs');
|
|
6
6
|
const require_config = require('../utils/rules/config.cjs');
|
|
7
|
-
let node_fs = require("node:fs");
|
|
8
7
|
let node_path = require("node:path");
|
|
8
|
+
let node_fs = require("node:fs");
|
|
9
9
|
|
|
10
10
|
//#region ../cli/dist/commands/editor-rules.mjs
|
|
11
11
|
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { trackEvent } from "../utils/analytics.js";
|
|
2
3
|
import { blue, green, red, yellow } from "../lib/colors.js";
|
|
3
4
|
import { print } from "../lib/print.js";
|
|
4
|
-
import { trackEvent } from "../utils/analytics.js";
|
|
5
5
|
import { getAvailableEditors, getEditorConfig, getRuleContent } from "../utils/rules/config.js";
|
|
6
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
6
|
import { join } from "node:path";
|
|
7
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
8
|
|
|
9
9
|
//#region ../cli/dist/commands/editor-rules.mjs
|
|
10
10
|
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
const require_runtime = require('../../../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let node_fs = require("node:fs");
|
|
4
3
|
let node_path = require("node:path");
|
|
4
|
+
let node_fs = require("node:fs");
|
|
5
5
|
let node_url = require("node:url");
|
|
6
6
|
|
|
7
7
|
//#region ../cli/dist/utils/rules/config.mjs
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
3
2
|
import { dirname, join } from "node:path";
|
|
3
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
6
6
|
//#region ../cli/dist/utils/rules/config.mjs
|
package/dist/cli/runner.cjs
CHANGED
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_styles_variants = require('../styles/variants.cjs');
|
|
4
4
|
const require_components_index = require('../components/index.cjs');
|
|
5
|
-
const
|
|
5
|
+
const require_cli = require('./dist/cli.cjs');
|
|
6
6
|
const require_generateComponentData = require('../tailwind/dist/commands/generateComponentData.cjs');
|
|
7
7
|
const require_generatePurgeCSSData = require('../tailwind/dist/commands/generatePurgeCSSData.cjs');
|
|
8
8
|
const require_purge = require('../tailwind/dist/commands/purge.cjs');
|
|
9
|
-
const require_cli = require('./dist/cli.cjs');
|
|
10
9
|
const require_package = require('../uds/package.cjs');
|
|
11
10
|
const require_components_experimental_index = require('../components/experimental/index.cjs');
|
|
12
11
|
const require_cli_commands_sync = require('./commands/sync.cjs');
|
|
13
12
|
const require_cli_commands_version = require('./commands/version.cjs');
|
|
14
|
-
let ts_morph = require("ts-morph");
|
|
15
13
|
let node_path = require("node:path");
|
|
14
|
+
let ts_morph = require("ts-morph");
|
|
16
15
|
|
|
17
16
|
//#region src/cli/runner.ts
|
|
18
17
|
require_cli.run([
|
|
@@ -45,14 +44,6 @@ require_cli.run([
|
|
|
45
44
|
outputFile: (0, node_path.join)(process.cwd(), "generated/componentData.json")
|
|
46
45
|
};
|
|
47
46
|
}),
|
|
48
|
-
require_css.makeCSSCommand(async () => {
|
|
49
|
-
const componentData = await Promise.resolve().then(() => require("../uds/generated/componentData.cjs"));
|
|
50
|
-
return {
|
|
51
|
-
variants: require_styles_variants.variants,
|
|
52
|
-
autoVariants: (await Promise.resolve().then(() => require("../automated-config/dist/generated/autoVariants.cjs"))).autoVariants,
|
|
53
|
-
componentData
|
|
54
|
-
};
|
|
55
|
-
}),
|
|
56
47
|
require_cli_commands_sync.syncCommand
|
|
57
48
|
]);
|
|
58
49
|
|
package/dist/cli/runner.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
import { variants } from "../styles/variants.js";
|
|
3
3
|
import { components_exports } from "../components/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { run } from "./dist/cli.js";
|
|
5
5
|
import { makeGenerateComponentDataCommand } from "../tailwind/dist/commands/generateComponentData.js";
|
|
6
6
|
import { makeGeneratePurgeCSSDataCommand } from "../tailwind/dist/commands/generatePurgeCSSData.js";
|
|
7
7
|
import { makePurgeCommand } from "../tailwind/dist/commands/purge.js";
|
|
8
|
-
import { run } from "./dist/cli.js";
|
|
9
8
|
import package_default from "../uds/package.js";
|
|
10
9
|
import { experimental_exports } from "../components/experimental/index.js";
|
|
11
10
|
import { syncCommand } from "./commands/sync.js";
|
|
12
11
|
import { versionCommand } from "./commands/version.js";
|
|
13
|
-
import { Project } from "ts-morph";
|
|
14
12
|
import { join } from "node:path";
|
|
13
|
+
import { Project } from "ts-morph";
|
|
15
14
|
|
|
16
15
|
//#region src/cli/runner.ts
|
|
17
16
|
run([
|
|
@@ -44,14 +43,6 @@ run([
|
|
|
44
43
|
outputFile: join(process.cwd(), "generated/componentData.json")
|
|
45
44
|
};
|
|
46
45
|
}),
|
|
47
|
-
makeCSSCommand(async () => {
|
|
48
|
-
const componentData = await import("../uds/generated/componentData.js");
|
|
49
|
-
return {
|
|
50
|
-
variants,
|
|
51
|
-
autoVariants: (await import("../automated-config/dist/generated/autoVariants.js")).autoVariants,
|
|
52
|
-
componentData
|
|
53
|
-
};
|
|
54
|
-
}),
|
|
55
46
|
syncCommand
|
|
56
47
|
]);
|
|
57
48
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
6
|
+
const require_styles_styler = require('../styles/styler.cjs');
|
|
7
|
+
const require_components_Box = require('./Box.cjs');
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
|
|
11
|
+
//#region src/components/Scrim.tsx
|
|
12
|
+
const Scrim = (0, react.forwardRef)(function Scrim({ className, style, variant = "default", position = "fixed", animateOpacity = false, ...props }, ref) {
|
|
13
|
+
const rootVariantClass = require_styles_styler.getStyles({ scrimVariantRoot: variant });
|
|
14
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
15
|
+
ref,
|
|
16
|
+
display: "block",
|
|
17
|
+
className: require_styles_styler.cx(position === "fixed" ? "fixed" : "absolute", "inset-0 z-40", animateOpacity ? "transition-opacity duration-150 data-[enter]:opacity-100 [&:not([data-enter])]:opacity-0" : "opacity-100", "uds-bgBlurFallback", rootVariantClass, className),
|
|
18
|
+
...props,
|
|
19
|
+
style: {
|
|
20
|
+
...style,
|
|
21
|
+
backgroundColor: "rgb(var(--uds-scrim-background-color) / var(--uds-scrim-opacity))"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
Scrim.displayName = "Scrim";
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.Scrim = Scrim;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import { DivProps } from "./Box.cjs";
|
|
3
|
+
import * as react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Scrim.d.ts
|
|
6
|
+
interface ScrimProps extends DivProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
variant?: 'default';
|
|
9
|
+
position?: 'fixed' | 'absolute';
|
|
10
|
+
animateOpacity?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const Scrim: react.ForwardRefExoticComponent<ScrimProps & react.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Scrim, type ScrimProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import { DivProps } from "./Box.js";
|
|
3
|
+
import * as react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Scrim.d.ts
|
|
6
|
+
interface ScrimProps extends DivProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
variant?: 'default';
|
|
9
|
+
position?: 'fixed' | 'absolute';
|
|
10
|
+
animateOpacity?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const Scrim: react.ForwardRefExoticComponent<ScrimProps & react.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Scrim, type ScrimProps };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
import { cx, getStyles } from "../styles/styler.js";
|
|
5
|
+
import { Box } from "./Box.js";
|
|
6
|
+
import { forwardRef } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/components/Scrim.tsx
|
|
10
|
+
const Scrim = forwardRef(function Scrim({ className, style, variant = "default", position = "fixed", animateOpacity = false, ...props }, ref) {
|
|
11
|
+
const rootVariantClass = getStyles({ scrimVariantRoot: variant });
|
|
12
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
13
|
+
ref,
|
|
14
|
+
display: "block",
|
|
15
|
+
className: cx(position === "fixed" ? "fixed" : "absolute", "inset-0 z-40", animateOpacity ? "transition-opacity duration-150 data-[enter]:opacity-100 [&:not([data-enter])]:opacity-0" : "opacity-100", "uds-bgBlurFallback", rootVariantClass, className),
|
|
16
|
+
...props,
|
|
17
|
+
style: {
|
|
18
|
+
...style,
|
|
19
|
+
backgroundColor: "rgb(var(--uds-scrim-background-color) / var(--uds-scrim-opacity))"
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
Scrim.displayName = "Scrim";
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { Scrim };
|
|
@@ -0,0 +1,209 @@
|
|
|
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_styles_styler = require('../../../styles/styler.cjs');
|
|
6
|
+
const require_components_Box = require('../../Box.cjs');
|
|
7
|
+
const require_components_Scrim = require('../../Scrim.cjs');
|
|
8
|
+
const require_components_client_BottomSheet_BottomSheetHandle = require('./BottomSheetHandle.cjs');
|
|
9
|
+
const require_components_client_BottomSheet_UDSBottomSheetConfigProvider = require('./UDSBottomSheetConfigProvider.cjs');
|
|
10
|
+
const require_components_client_BottomSheet_useBottomSheetDrag = require('./useBottomSheetDrag.cjs');
|
|
11
|
+
const require_components_client_BottomSheet_useBottomSheetSnapModel = require('./useBottomSheetSnapModel.cjs');
|
|
12
|
+
const require_components_client_BottomSheet_useBottomSheetStore = require('./useBottomSheetStore.cjs');
|
|
13
|
+
const require_components_client_BottomSheet_useExpansionMargins = require('./useExpansionMargins.cjs');
|
|
14
|
+
const require_components_client_BottomSheet_useViewportHeight = require('./useViewportHeight.cjs');
|
|
15
|
+
const require_components_client_BottomSheet_useVirtualKeyboard = require('./useVirtualKeyboard.cjs');
|
|
16
|
+
let react = require("react");
|
|
17
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
18
|
+
let _ariakit_react = require("@ariakit/react");
|
|
19
|
+
|
|
20
|
+
//#region src/components/client/BottomSheet/BottomSheet.tsx
|
|
21
|
+
/**
|
|
22
|
+
* Drag-to-dismiss distance threshold as a ratio of the lowest snap point's
|
|
23
|
+
* visible height. Dragging down past this fraction of the height dismisses
|
|
24
|
+
* the sheet (regardless of velocity).
|
|
25
|
+
*
|
|
26
|
+
* Velocity and distance are OR conditions — exceeding either one triggers dismissal.
|
|
27
|
+
*/
|
|
28
|
+
const DRAG_DISMISS_THRESHOLD_RATIO = .25;
|
|
29
|
+
/**
|
|
30
|
+
* Top inset reserved when calculating max sheet height.
|
|
31
|
+
* Keeps a visible sliver of page content so the fully expanded state still reads as a bottom sheet.
|
|
32
|
+
*/
|
|
33
|
+
const SHEET_MAX_HEIGHT_TOP_OFFSET_PX = 26;
|
|
34
|
+
function BottomSheet({ children, className: sheetClassName, controller: controllerProp, variant = "default", snapPoints: snapPointsProp, defaultSnapPointIndex = 0, snapPointIndex: snapPointIndexProp, onSnapPointChange, height, modal = true, portal = true, portalElement, dismissible = true, enableDrag = true, showHandleIndicator = true, hideOnEscape = true, onClose, backdrop, preventBodyScroll, slotProps, fullWidthAtMaxSnap = false }) {
|
|
35
|
+
const storeFromContext = (0, _ariakit_react.useDialogContext)();
|
|
36
|
+
const dialogStore = controllerProp ? require_components_client_BottomSheet_useBottomSheetStore.getBottomSheetInternal(controllerProp) : storeFromContext;
|
|
37
|
+
const { backgroundColor: configBackgroundColor } = require_components_client_BottomSheet_UDSBottomSheetConfigProvider.useBottomSheetConfig();
|
|
38
|
+
if (!dialogStore) throw new Error("BottomSheet must be wrapped in BottomSheetProvider or provided a controller prop.");
|
|
39
|
+
const isOpen = dialogStore.useState().open;
|
|
40
|
+
const keyboardHeightPx = require_components_client_BottomSheet_useVirtualKeyboard.useVirtualKeyboard(isOpen);
|
|
41
|
+
const viewportHeightPx = require_components_client_BottomSheet_useViewportHeight.useViewportHeight();
|
|
42
|
+
const isDraggingRef = (0, react.useRef)(false);
|
|
43
|
+
const forceZeroMarginsRef = (0, react.useRef)(false);
|
|
44
|
+
forceZeroMarginsRef.current = keyboardHeightPx > 0;
|
|
45
|
+
const sheetRef = (0, react.useRef)(null);
|
|
46
|
+
const maxSnapPxRef = (0, react.useRef)(0);
|
|
47
|
+
const maxHeightPx = Math.max(viewportHeightPx - SHEET_MAX_HEIGHT_TOP_OFFSET_PX, 0);
|
|
48
|
+
const rootVariantClass = require_styles_styler.getStyles({ bottomsheetVariantRoot: variant });
|
|
49
|
+
const { applyExpansionMargins, thresholdRef: expansionThresholdRef } = require_components_client_BottomSheet_useExpansionMargins.useExpansionMargins({
|
|
50
|
+
sheetRef,
|
|
51
|
+
maxSnapPxRef,
|
|
52
|
+
fullWidthAtMaxSnap,
|
|
53
|
+
snapPointsLength: snapPointsProp?.length ?? 1,
|
|
54
|
+
isOpen,
|
|
55
|
+
forceZeroRef: forceZeroMarginsRef
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Applies drag-time position updates with no animation.
|
|
59
|
+
* We model the sheet by height, so translate is converted to height:
|
|
60
|
+
* `height = maxSnapPointPx - translatePx`.
|
|
61
|
+
*/
|
|
62
|
+
const setTranslateImmediate = (0, react.useCallback)((nextTranslatePx) => {
|
|
63
|
+
const el = sheetRef.current;
|
|
64
|
+
if (!el) return;
|
|
65
|
+
el.style.height = `${maxSnapPxRef.current - nextTranslatePx}px`;
|
|
66
|
+
applyExpansionMargins(el, nextTranslatePx);
|
|
67
|
+
}, [applyExpansionMargins]);
|
|
68
|
+
const { resolvedSnapPoints, snapPointsPx, maxSnapPointPx, snapPointTranslatesPx, activeSnapIndex, restTranslatePx, emitSnapPointChange, openTimeRef, lastTimeDragPreventedRef, isEnteringRef } = require_components_client_BottomSheet_useBottomSheetSnapModel.useBottomSheetSnapModel({
|
|
69
|
+
isOpen,
|
|
70
|
+
snapPointsProp,
|
|
71
|
+
height,
|
|
72
|
+
defaultSnapPointIndex,
|
|
73
|
+
snapPointIndexProp,
|
|
74
|
+
onSnapPointChange,
|
|
75
|
+
viewportHeightPx,
|
|
76
|
+
maxHeightPx,
|
|
77
|
+
setTranslateAnimated: (0, react.useCallback)((nextTranslatePx) => {
|
|
78
|
+
const el = sheetRef.current;
|
|
79
|
+
if (!el) return;
|
|
80
|
+
const nextHeightPx = maxSnapPxRef.current - nextTranslatePx;
|
|
81
|
+
if (!el.style.height) {
|
|
82
|
+
el.style.height = `${nextHeightPx}px`;
|
|
83
|
+
applyExpansionMargins(el, nextTranslatePx);
|
|
84
|
+
} else {
|
|
85
|
+
const easing = "cubic-bezier(0.32, 0.72, 0, 1)";
|
|
86
|
+
let transition = `height 500ms ${easing}`;
|
|
87
|
+
if (expansionThresholdRef.current != null) transition += `, margin-left 500ms ${easing}, margin-right 500ms ${easing}, margin-bottom 500ms ${easing}`;
|
|
88
|
+
el.style.transition = transition;
|
|
89
|
+
el.style.height = `${nextHeightPx}px`;
|
|
90
|
+
applyExpansionMargins(el, nextTranslatePx);
|
|
91
|
+
const cleanup = () => {
|
|
92
|
+
el.style.removeProperty("transition");
|
|
93
|
+
el.removeEventListener("transitionend", cleanup);
|
|
94
|
+
};
|
|
95
|
+
el.addEventListener("transitionend", cleanup);
|
|
96
|
+
}
|
|
97
|
+
}, [applyExpansionMargins, expansionThresholdRef]),
|
|
98
|
+
isDraggingRef
|
|
99
|
+
});
|
|
100
|
+
maxSnapPxRef.current = maxSnapPointPx;
|
|
101
|
+
expansionThresholdRef.current = fullWidthAtMaxSnap && (snapPointsProp?.length ?? 1) >= 2 ? snapPointsPx[snapPointsPx.length - 2] ?? 0 : null;
|
|
102
|
+
const visibleTranslatePx = isOpen && !isEnteringRef.current ? 0 : viewportHeightPx;
|
|
103
|
+
const resolvedDismissThresholdPx = (snapPointsPx[0] ?? maxSnapPointPx) * DRAG_DISMISS_THRESHOLD_RATIO;
|
|
104
|
+
const shouldShowHandleIndicator = showHandleIndicator && enableDrag;
|
|
105
|
+
const isAtMaxSnapPoint = activeSnapIndex === resolvedSnapPoints.length - 1;
|
|
106
|
+
const shouldHideEdgeBordersAtMaxSnap = fullWidthAtMaxSnap && resolvedSnapPoints.length >= 2 && isAtMaxSnapPoint;
|
|
107
|
+
const handleHandleIndicatorKeyDown = (0, react.useCallback)((event) => {
|
|
108
|
+
if (!shouldShowHandleIndicator || resolvedSnapPoints.length <= 1) return;
|
|
109
|
+
if (event.key === "ArrowUp") {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
emitSnapPointChange(activeSnapIndex + 1);
|
|
112
|
+
}
|
|
113
|
+
if (event.key === "ArrowDown") {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
if (activeSnapIndex === 0 && dismissible) {
|
|
116
|
+
dialogStore.hide();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
emitSnapPointChange(activeSnapIndex - 1);
|
|
120
|
+
}
|
|
121
|
+
}, [
|
|
122
|
+
activeSnapIndex,
|
|
123
|
+
dismissible,
|
|
124
|
+
emitSnapPointChange,
|
|
125
|
+
resolvedSnapPoints.length,
|
|
126
|
+
shouldShowHandleIndicator,
|
|
127
|
+
dialogStore
|
|
128
|
+
]);
|
|
129
|
+
const { onPointerDown, onPointerMove, onPointerUp, onPointerCancel } = require_components_client_BottomSheet_useBottomSheetDrag.useBottomSheetDrag({
|
|
130
|
+
enableDrag,
|
|
131
|
+
dismissible,
|
|
132
|
+
store: dialogStore,
|
|
133
|
+
sheetRef,
|
|
134
|
+
isDraggingRef,
|
|
135
|
+
activeSnapIndex,
|
|
136
|
+
snapPointTranslatesPx,
|
|
137
|
+
maxSnapPointPx,
|
|
138
|
+
resolvedSnapPointsLength: resolvedSnapPoints.length,
|
|
139
|
+
resolvedDismissThresholdPx,
|
|
140
|
+
emitSnapPointChange,
|
|
141
|
+
setTranslateImmediate,
|
|
142
|
+
openTimeRef,
|
|
143
|
+
lastTimeDragPreventedRef
|
|
144
|
+
});
|
|
145
|
+
(0, react.useEffect)(() => {
|
|
146
|
+
if (!fullWidthAtMaxSnap || !isOpen) return;
|
|
147
|
+
const el = sheetRef.current;
|
|
148
|
+
if (!el || !el.style.height) return;
|
|
149
|
+
applyExpansionMargins(el, restTranslatePx);
|
|
150
|
+
}, [
|
|
151
|
+
restTranslatePx,
|
|
152
|
+
fullWidthAtMaxSnap,
|
|
153
|
+
isOpen,
|
|
154
|
+
applyExpansionMargins
|
|
155
|
+
]);
|
|
156
|
+
const dialogBackdrop = modal ? backdrop ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Scrim.Scrim, {
|
|
157
|
+
className: slotProps?.scrim?.className,
|
|
158
|
+
animateOpacity: true
|
|
159
|
+
}) : false;
|
|
160
|
+
const hideOnInteractOutside = modal && dismissible ? void 0 : false;
|
|
161
|
+
const isElevationBackgroundColor = configBackgroundColor[variant].startsWith("elevation-");
|
|
162
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_ariakit_react.Dialog, {
|
|
163
|
+
ref: sheetRef,
|
|
164
|
+
store: dialogStore,
|
|
165
|
+
modal,
|
|
166
|
+
unmountOnHide: true,
|
|
167
|
+
hideOnEscape: dismissible ? hideOnEscape : false,
|
|
168
|
+
hideOnInteractOutside,
|
|
169
|
+
onClose,
|
|
170
|
+
backdrop: dialogBackdrop,
|
|
171
|
+
portal,
|
|
172
|
+
portalElement,
|
|
173
|
+
preventBodyScroll: preventBodyScroll ?? (modal ? void 0 : false),
|
|
174
|
+
"data-testid": "bottom-sheet",
|
|
175
|
+
className: require_styles_styler.cx("fixed overflow-hidden inset-x-0 bottom-0 z-50", keyboardHeightPx > 0 ? void 0 : "bottom-0", "[will-change:transform] touch-none", "[transform:translate3d(0,var(--uds-bottomsheet-hidden-translate),0)]", "data-[enter]:[transform:translate3d(0,var(--uds-bottomsheet-visible-translate),0)]", "transition-transform duration-500 ease-[cubic-bezier(0.32,0.72,0,1)]", "motion-reduce:transition-none", sheetClassName, rootVariantClass),
|
|
176
|
+
style: {
|
|
177
|
+
maxHeight: maxHeightPx ? `${maxHeightPx}px` : void 0,
|
|
178
|
+
...shouldHideEdgeBordersAtMaxSnap ? {
|
|
179
|
+
borderBottomWidth: 0,
|
|
180
|
+
borderLeftWidth: 0,
|
|
181
|
+
borderRightWidth: 0
|
|
182
|
+
} : {},
|
|
183
|
+
["--uds-bottomsheet-hidden-translate"]: `${viewportHeightPx}px`,
|
|
184
|
+
["--uds-bottomsheet-visible-translate"]: `${visibleTranslatePx}px`,
|
|
185
|
+
...isElevationBackgroundColor && {
|
|
186
|
+
backdropFilter: `var(--uds-background-blur-radius-${configBackgroundColor[variant]})`,
|
|
187
|
+
WebkitBackdropFilter: `var(--uds-background-blur-radius-${configBackgroundColor[variant]})`
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
onPointerDown,
|
|
191
|
+
onPointerMove,
|
|
192
|
+
onPointerUp,
|
|
193
|
+
onPointerCancel,
|
|
194
|
+
children: [shouldShowHandleIndicator && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
195
|
+
display: "block",
|
|
196
|
+
position: "absolute",
|
|
197
|
+
className: require_styles_styler.cx("inset-x-0 top-[-4px] z-[1] touch-pan-y"),
|
|
198
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_BottomSheet_BottomSheetHandle.BottomSheetHandle, {
|
|
199
|
+
onKeyDown: handleHandleIndicatorKeyDown,
|
|
200
|
+
ariaLabel: "Resize sheet",
|
|
201
|
+
className: slotProps?.handleIndicator?.className
|
|
202
|
+
})
|
|
203
|
+
}), children]
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
BottomSheet.displayName = "BottomSheet";
|
|
207
|
+
|
|
208
|
+
//#endregion
|
|
209
|
+
exports.BottomSheet = BottomSheet;
|