@surdeddd/bottom-sheet 0.23.3 → 0.24.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.
Files changed (80) hide show
  1. package/README.md +513 -525
  2. package/README.ru.md +685 -0
  3. package/dist/{BottomSheetCore-COvILxmR.d.ts → BottomSheetCore-B_r4KCQL.d.cts} +48 -12
  4. package/dist/{BottomSheetCore-CaJwHnxY.d.cts → BottomSheetCore-B_r4KCQL.d.ts} +48 -12
  5. package/dist/{BottomSheetEngine-C_1aPJsU.d.cts → BottomSheetEngine-0F7mjyvF.d.cts} +1 -1
  6. package/dist/{BottomSheetEngine-CsgCcCSO.d.ts → BottomSheetEngine-CJV_DDrM.d.ts} +1 -1
  7. package/dist/core.cjs +810 -436
  8. package/dist/core.d.cts +2 -3
  9. package/dist/core.d.ts +2 -3
  10. package/dist/core.js +810 -436
  11. package/dist/debug.d.cts +3 -3
  12. package/dist/debug.d.ts +3 -3
  13. package/dist/{default-features-BJx7J0NH.d.ts → default-features-4Xwv6aVt.d.ts} +4 -2
  14. package/dist/{default-features-CTJb8Wdk.d.cts → default-features-DX2NOxP6.d.cts} +4 -2
  15. package/dist/element.cjs +1428 -699
  16. package/dist/element.d.cts +15 -5
  17. package/dist/element.d.ts +15 -5
  18. package/dist/element.iife.global.js +2 -2
  19. package/dist/element.js +1428 -699
  20. package/dist/features.cjs +334 -190
  21. package/dist/features.d.cts +3 -4
  22. package/dist/features.d.ts +3 -4
  23. package/dist/features.js +334 -191
  24. package/dist/{index-CXN7t3rr.d.ts → index-2shlxhcG.d.cts} +3 -2
  25. package/dist/{index-BBrJJjy5.d.cts → index-CNCRQnpc.d.ts} +3 -2
  26. package/dist/index.cjs +1129 -631
  27. package/dist/index.d.cts +13 -7
  28. package/dist/index.d.ts +13 -7
  29. package/dist/index.js +1129 -632
  30. package/dist/integrations/formik.cjs +21 -10
  31. package/dist/integrations/formik.d.cts +3 -3
  32. package/dist/integrations/formik.d.ts +3 -3
  33. package/dist/integrations/formik.js +22 -11
  34. package/dist/integrations/react-hook-form.cjs +21 -12
  35. package/dist/integrations/react-hook-form.d.cts +3 -3
  36. package/dist/integrations/react-hook-form.d.ts +3 -3
  37. package/dist/integrations/react-hook-form.js +21 -12
  38. package/dist/option-keys-DItuAjUw.d.cts +6 -0
  39. package/dist/option-keys-a5DYNwwO.d.ts +6 -0
  40. package/dist/overlay.cjs +386 -189
  41. package/dist/overlay.d.cts +3 -4
  42. package/dist/overlay.d.ts +3 -4
  43. package/dist/overlay.js +386 -189
  44. package/dist/preact.d.cts +3 -4
  45. package/dist/preact.d.ts +3 -4
  46. package/dist/qwik-lib/index.qwik.cjs +1306 -671
  47. package/dist/qwik-lib/index.qwik.mjs +1306 -671
  48. package/dist/qwik.cjs +1326 -701
  49. package/dist/qwik.d.cts +14 -30
  50. package/dist/qwik.d.ts +14 -30
  51. package/dist/qwik.js +1326 -701
  52. package/dist/react.cjs +1373 -750
  53. package/dist/react.d.cts +31 -14
  54. package/dist/react.d.ts +31 -14
  55. package/dist/react.js +1375 -752
  56. package/dist/solid.cjs +1332 -727
  57. package/dist/solid.d.cts +13 -437
  58. package/dist/solid.d.ts +13 -437
  59. package/dist/solid.js +1334 -729
  60. package/dist/solid.source.jsx +1374 -751
  61. package/dist/styles.css +20 -6
  62. package/dist/svelte-core.cjs +1211 -676
  63. package/dist/svelte-core.js +1207 -677
  64. package/dist/svelte-src/BottomSheet.svelte +102 -59
  65. package/dist/svelte.cjs +1324 -707
  66. package/dist/svelte.d.cts +45 -25
  67. package/dist/svelte.d.ts +45 -25
  68. package/dist/svelte.js +1324 -707
  69. package/dist/vue.cjs +1354 -773
  70. package/dist/vue.d.cts +20 -3
  71. package/dist/vue.d.ts +20 -3
  72. package/dist/vue.js +1354 -773
  73. package/dist/webgl.cjs +38 -7
  74. package/dist/webgl.d.cts +3 -3
  75. package/dist/webgl.d.ts +3 -3
  76. package/dist/webgl.js +38 -7
  77. package/llms.txt +330 -0
  78. package/package.json +62 -42
  79. package/dist/transform-jVfAikE9.d.cts +0 -3
  80. package/dist/transform-jVfAikE9.d.ts +0 -3
@@ -4,22 +4,33 @@ var react = require('react');
4
4
 
5
5
  // src/integrations/formik.ts
6
6
  function useFormikGuard(sheetRef, formikRef, _tag) {
7
+ const boundTo = react.useRef(null);
8
+ const release = react.useRef(null);
7
9
  react.useEffect(() => {
8
- const target = sheetRef.current;
9
- if (!target) return;
10
- const off = target.on("before-snap", (payload) => {
10
+ const target = sheetRef.current ?? null;
11
+ if (target === boundTo.current) return;
12
+ release.current?.();
13
+ boundTo.current = target;
14
+ if (!target) {
15
+ release.current = null;
16
+ return;
17
+ }
18
+ release.current = target.on("before-snap", (payload) => {
11
19
  const formik = formikRef.current;
12
20
  if (!formik) return;
13
- if (formik.isSubmitting) {
14
- payload.cancel();
15
- return;
16
- }
17
- if (payload.id === "closed" && formik.dirty) {
21
+ if (formik.isSubmitting || payload.size === 0 && formik.dirty) {
18
22
  payload.cancel();
19
23
  }
20
24
  });
21
- return off;
22
- }, [sheetRef, formikRef]);
25
+ });
26
+ react.useEffect(
27
+ () => () => {
28
+ release.current?.();
29
+ release.current = null;
30
+ boundTo.current = null;
31
+ },
32
+ []
33
+ );
23
34
  }
24
35
 
25
36
  exports.useFormikGuard = useFormikGuard;
@@ -1,5 +1,4 @@
1
- import { S as SheetEventMap } from '../BottomSheetCore-CaJwHnxY.cjs';
2
- import '../transform-jVfAikE9.cjs';
1
+ import { SheetEventMap } from '../core.cjs';
3
2
 
4
3
  type FormikStateLike = {
5
4
  dirty: boolean;
@@ -18,4 +17,5 @@ type FormikRefLike = {
18
17
  };
19
18
  declare function useFormikGuard<Values extends Record<string, unknown> = Record<string, unknown>>(sheetRef: SheetGuardRef, formikRef: FormikRefLike, _tag?: Values): void;
20
19
 
21
- export { type FormikRefLike, type FormikStateLike, type SheetEventTarget, type SheetGuardRef, useFormikGuard };
20
+ export { useFormikGuard };
21
+ export type { FormikRefLike, FormikStateLike, SheetEventTarget, SheetGuardRef };
@@ -1,5 +1,4 @@
1
- import { S as SheetEventMap } from '../BottomSheetCore-COvILxmR.js';
2
- import '../transform-jVfAikE9.js';
1
+ import { SheetEventMap } from '../core.js';
3
2
 
4
3
  type FormikStateLike = {
5
4
  dirty: boolean;
@@ -18,4 +17,5 @@ type FormikRefLike = {
18
17
  };
19
18
  declare function useFormikGuard<Values extends Record<string, unknown> = Record<string, unknown>>(sheetRef: SheetGuardRef, formikRef: FormikRefLike, _tag?: Values): void;
20
19
 
21
- export { type FormikRefLike, type FormikStateLike, type SheetEventTarget, type SheetGuardRef, useFormikGuard };
20
+ export { useFormikGuard };
21
+ export type { FormikRefLike, FormikStateLike, SheetEventTarget, SheetGuardRef };
@@ -1,23 +1,34 @@
1
- import { useEffect } from 'react';
1
+ import { useRef, useEffect } from 'react';
2
2
 
3
3
  // src/integrations/formik.ts
4
4
  function useFormikGuard(sheetRef, formikRef, _tag) {
5
+ const boundTo = useRef(null);
6
+ const release = useRef(null);
5
7
  useEffect(() => {
6
- const target = sheetRef.current;
7
- if (!target) return;
8
- const off = target.on("before-snap", (payload) => {
8
+ const target = sheetRef.current ?? null;
9
+ if (target === boundTo.current) return;
10
+ release.current?.();
11
+ boundTo.current = target;
12
+ if (!target) {
13
+ release.current = null;
14
+ return;
15
+ }
16
+ release.current = target.on("before-snap", (payload) => {
9
17
  const formik = formikRef.current;
10
18
  if (!formik) return;
11
- if (formik.isSubmitting) {
12
- payload.cancel();
13
- return;
14
- }
15
- if (payload.id === "closed" && formik.dirty) {
19
+ if (formik.isSubmitting || payload.size === 0 && formik.dirty) {
16
20
  payload.cancel();
17
21
  }
18
22
  });
19
- return off;
20
- }, [sheetRef, formikRef]);
23
+ });
24
+ useEffect(
25
+ () => () => {
26
+ release.current?.();
27
+ release.current = null;
28
+ boundTo.current = null;
29
+ },
30
+ []
31
+ );
21
32
  }
22
33
 
23
34
  export { useFormikGuard };
@@ -6,21 +6,30 @@ var react = require('react');
6
6
  function useFormGuard(sheetRef, methods, _tag) {
7
7
  const methodsRef = react.useRef(methods);
8
8
  methodsRef.current = methods;
9
+ const boundTo = react.useRef(null);
10
+ const release = react.useRef(null);
9
11
  react.useEffect(() => {
10
- const target = sheetRef.current;
11
- if (!target) return;
12
- const off = target.on("before-snap", (payload) => {
12
+ const target = sheetRef.current ?? null;
13
+ if (target === boundTo.current) return;
14
+ release.current?.();
15
+ boundTo.current = target;
16
+ if (!target) {
17
+ release.current = null;
18
+ return;
19
+ }
20
+ release.current = target.on("before-snap", (payload) => {
13
21
  const { isDirty, isSubmitting } = methodsRef.current.formState;
14
- if (isSubmitting) {
15
- payload.cancel();
16
- return;
17
- }
18
- if (payload.id === "closed" && isDirty) {
19
- payload.cancel();
20
- }
22
+ if (isSubmitting || payload.size === 0 && isDirty) payload.cancel();
21
23
  });
22
- return off;
23
- }, [sheetRef]);
24
+ });
25
+ react.useEffect(
26
+ () => () => {
27
+ release.current?.();
28
+ release.current = null;
29
+ boundTo.current = null;
30
+ },
31
+ []
32
+ );
24
33
  }
25
34
 
26
35
  exports.useFormGuard = useFormGuard;
@@ -1,5 +1,4 @@
1
- import { S as SheetEventMap } from '../BottomSheetCore-CaJwHnxY.cjs';
2
- import '../transform-jVfAikE9.cjs';
1
+ import { SheetEventMap } from '../core.cjs';
3
2
 
4
3
  type RhfFormStateLike = {
5
4
  formState: {
@@ -18,4 +17,5 @@ type SheetGuardRef = {
18
17
  };
19
18
  declare function useFormGuard<TFieldValues extends Record<string, unknown> = Record<string, unknown>>(sheetRef: SheetGuardRef, methods: RhfFormStateLike, _tag?: TFieldValues): void;
20
19
 
21
- export { type RhfFormStateLike, type SheetEventTarget, type SheetGuardRef, useFormGuard };
20
+ export { useFormGuard };
21
+ export type { RhfFormStateLike, SheetEventTarget, SheetGuardRef };
@@ -1,5 +1,4 @@
1
- import { S as SheetEventMap } from '../BottomSheetCore-COvILxmR.js';
2
- import '../transform-jVfAikE9.js';
1
+ import { SheetEventMap } from '../core.js';
3
2
 
4
3
  type RhfFormStateLike = {
5
4
  formState: {
@@ -18,4 +17,5 @@ type SheetGuardRef = {
18
17
  };
19
18
  declare function useFormGuard<TFieldValues extends Record<string, unknown> = Record<string, unknown>>(sheetRef: SheetGuardRef, methods: RhfFormStateLike, _tag?: TFieldValues): void;
20
19
 
21
- export { type RhfFormStateLike, type SheetEventTarget, type SheetGuardRef, useFormGuard };
20
+ export { useFormGuard };
21
+ export type { RhfFormStateLike, SheetEventTarget, SheetGuardRef };
@@ -4,21 +4,30 @@ import { useRef, useEffect } from 'react';
4
4
  function useFormGuard(sheetRef, methods, _tag) {
5
5
  const methodsRef = useRef(methods);
6
6
  methodsRef.current = methods;
7
+ const boundTo = useRef(null);
8
+ const release = useRef(null);
7
9
  useEffect(() => {
8
- const target = sheetRef.current;
9
- if (!target) return;
10
- const off = target.on("before-snap", (payload) => {
10
+ const target = sheetRef.current ?? null;
11
+ if (target === boundTo.current) return;
12
+ release.current?.();
13
+ boundTo.current = target;
14
+ if (!target) {
15
+ release.current = null;
16
+ return;
17
+ }
18
+ release.current = target.on("before-snap", (payload) => {
11
19
  const { isDirty, isSubmitting } = methodsRef.current.formState;
12
- if (isSubmitting) {
13
- payload.cancel();
14
- return;
15
- }
16
- if (payload.id === "closed" && isDirty) {
17
- payload.cancel();
18
- }
20
+ if (isSubmitting || payload.size === 0 && isDirty) payload.cancel();
19
21
  });
20
- return off;
21
- }, [sheetRef]);
22
+ });
23
+ useEffect(
24
+ () => () => {
25
+ release.current?.();
26
+ release.current = null;
27
+ boundTo.current = null;
28
+ },
29
+ []
30
+ );
22
31
  }
23
32
 
24
33
  export { useFormGuard };
@@ -0,0 +1,6 @@
1
+ import { f as EngineOptions } from './BottomSheetCore-B_r4KCQL.cjs';
2
+
3
+ declare const ENGINE_OPTION_KEYS: readonly ["mode", "snapPoints", "allowed", "initial", "duration", "easing", "respectReducedMotion", "flickVelocity", "dragThreshold", "dragFrom", "dragFromContent", "fitContentToSnap", "rubberBand", "backdropRange", "backdropOpacity", "backdropColor", "screenRange", "scrimMode", "scrimColor", "scrimBlur", "scrimInteractive", "scrimTapToClose", "scrimPreset", "animation", "settleAnimation", "spring", "focusTrap", "initialFocus", "closeOnEscape", "lockBodyScroll", "closeOnBack", "routedTo", "inertSiblings", "persistent", "disableClose", "disableDrag", "closeOnRouteChange", "radius", "maxHeight", "returnFocusTo", "persistKey", "autoCollapseAfter", "linkedSheets", "viewTransitions", "stackEffect", "features"];
4
+ type EngineConfig = Pick<EngineOptions, (typeof ENGINE_OPTION_KEYS)[number]>;
5
+
6
+ export type { EngineConfig as E };
@@ -0,0 +1,6 @@
1
+ import { f as EngineOptions } from './BottomSheetCore-B_r4KCQL.js';
2
+
3
+ declare const ENGINE_OPTION_KEYS: readonly ["mode", "snapPoints", "allowed", "initial", "duration", "easing", "respectReducedMotion", "flickVelocity", "dragThreshold", "dragFrom", "dragFromContent", "fitContentToSnap", "rubberBand", "backdropRange", "backdropOpacity", "backdropColor", "screenRange", "scrimMode", "scrimColor", "scrimBlur", "scrimInteractive", "scrimTapToClose", "scrimPreset", "animation", "settleAnimation", "spring", "focusTrap", "initialFocus", "closeOnEscape", "lockBodyScroll", "closeOnBack", "routedTo", "inertSiblings", "persistent", "disableClose", "disableDrag", "closeOnRouteChange", "radius", "maxHeight", "returnFocusTo", "persistKey", "autoCollapseAfter", "linkedSheets", "viewTransitions", "stackEffect", "features"];
4
+ type EngineConfig = Pick<EngineOptions, (typeof ENGINE_OPTION_KEYS)[number]>;
5
+
6
+ export type { EngineConfig as E };