react-native-timer-picker 2.4.0 → 2.6.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 (171) hide show
  1. package/README.md +35 -25
  2. package/package.json +143 -126
  3. package/dist/commonjs/components/DurationScroll/DurationScroll.js +0 -403
  4. package/dist/commonjs/components/DurationScroll/DurationScroll.js.map +0 -1
  5. package/dist/commonjs/components/DurationScroll/index.js +0 -27
  6. package/dist/commonjs/components/DurationScroll/index.js.map +0 -1
  7. package/dist/commonjs/components/DurationScroll/types.js +0 -6
  8. package/dist/commonjs/components/DurationScroll/types.js.map +0 -1
  9. package/dist/commonjs/components/Modal/Modal.js +0 -107
  10. package/dist/commonjs/components/Modal/Modal.js.map +0 -1
  11. package/dist/commonjs/components/Modal/index.js +0 -27
  12. package/dist/commonjs/components/Modal/index.js.map +0 -1
  13. package/dist/commonjs/components/Modal/styles.js +0 -25
  14. package/dist/commonjs/components/Modal/styles.js.map +0 -1
  15. package/dist/commonjs/components/Modal/types.js +0 -6
  16. package/dist/commonjs/components/Modal/types.js.map +0 -1
  17. package/dist/commonjs/components/PickerItem/PickerItem.js +0 -45
  18. package/dist/commonjs/components/PickerItem/PickerItem.js.map +0 -1
  19. package/dist/commonjs/components/PickerItem/index.js +0 -14
  20. package/dist/commonjs/components/PickerItem/index.js.map +0 -1
  21. package/dist/commonjs/components/TimerPicker/TimerPicker.js +0 -236
  22. package/dist/commonjs/components/TimerPicker/TimerPicker.js.map +0 -1
  23. package/dist/commonjs/components/TimerPicker/index.js +0 -39
  24. package/dist/commonjs/components/TimerPicker/index.js.map +0 -1
  25. package/dist/commonjs/components/TimerPicker/styles.js +0 -121
  26. package/dist/commonjs/components/TimerPicker/styles.js.map +0 -1
  27. package/dist/commonjs/components/TimerPicker/types.js +0 -6
  28. package/dist/commonjs/components/TimerPicker/types.js.map +0 -1
  29. package/dist/commonjs/components/TimerPickerModal/TimerPickerModal.js +0 -153
  30. package/dist/commonjs/components/TimerPickerModal/TimerPickerModal.js.map +0 -1
  31. package/dist/commonjs/components/TimerPickerModal/index.js +0 -39
  32. package/dist/commonjs/components/TimerPickerModal/index.js.map +0 -1
  33. package/dist/commonjs/components/TimerPickerModal/styles.js +0 -89
  34. package/dist/commonjs/components/TimerPickerModal/styles.js.map +0 -1
  35. package/dist/commonjs/components/TimerPickerModal/types.js +0 -6
  36. package/dist/commonjs/components/TimerPickerModal/types.js.map +0 -1
  37. package/dist/commonjs/index.js +0 -57
  38. package/dist/commonjs/index.js.map +0 -1
  39. package/dist/commonjs/tests/DurationScroll.test.js +0 -163
  40. package/dist/commonjs/tests/DurationScroll.test.js.map +0 -1
  41. package/dist/commonjs/tests/Modal.test.js +0 -119
  42. package/dist/commonjs/tests/Modal.test.js.map +0 -1
  43. package/dist/commonjs/tests/TimerPicker.test.js +0 -169
  44. package/dist/commonjs/tests/TimerPicker.test.js.map +0 -1
  45. package/dist/commonjs/tests/TimerPickerModal.test.js +0 -276
  46. package/dist/commonjs/tests/TimerPickerModal.test.js.map +0 -1
  47. package/dist/commonjs/tests/colorToRgba.test.js +0 -176
  48. package/dist/commonjs/tests/colorToRgba.test.js.map +0 -1
  49. package/dist/commonjs/tests/generateNumbers.test.js +0 -350
  50. package/dist/commonjs/tests/generateNumbers.test.js.map +0 -1
  51. package/dist/commonjs/tests/getAdjustedLimit.test.js +0 -324
  52. package/dist/commonjs/tests/getAdjustedLimit.test.js.map +0 -1
  53. package/dist/commonjs/tests/getDurationAndIndexFromScrollOffset.test.js +0 -424
  54. package/dist/commonjs/tests/getDurationAndIndexFromScrollOffset.test.js.map +0 -1
  55. package/dist/commonjs/tests/getInitialScrollIndex.test.js +0 -396
  56. package/dist/commonjs/tests/getInitialScrollIndex.test.js.map +0 -1
  57. package/dist/commonjs/tests/getSafeInitialValue.test.js +0 -497
  58. package/dist/commonjs/tests/getSafeInitialValue.test.js.map +0 -1
  59. package/dist/commonjs/tests/padNumber.test.js +0 -301
  60. package/dist/commonjs/tests/padNumber.test.js.map +0 -1
  61. package/dist/commonjs/utils/colorToRgba.js +0 -87
  62. package/dist/commonjs/utils/colorToRgba.js.map +0 -1
  63. package/dist/commonjs/utils/generateNumbers.js +0 -124
  64. package/dist/commonjs/utils/generateNumbers.js.map +0 -1
  65. package/dist/commonjs/utils/getAdjustedLimit.js +0 -58
  66. package/dist/commonjs/utils/getAdjustedLimit.js.map +0 -1
  67. package/dist/commonjs/utils/getDurationAndIndexFromScrollOffset.js +0 -62
  68. package/dist/commonjs/utils/getDurationAndIndexFromScrollOffset.js.map +0 -1
  69. package/dist/commonjs/utils/getInitialScrollIndex.js +0 -57
  70. package/dist/commonjs/utils/getInitialScrollIndex.js.map +0 -1
  71. package/dist/commonjs/utils/getSafeInitialValue.js +0 -41
  72. package/dist/commonjs/utils/getSafeInitialValue.js.map +0 -1
  73. package/dist/commonjs/utils/padNumber.js +0 -40
  74. package/dist/commonjs/utils/padNumber.js.map +0 -1
  75. package/dist/module/components/DurationScroll/DurationScroll.js +0 -395
  76. package/dist/module/components/DurationScroll/DurationScroll.js.map +0 -1
  77. package/dist/module/components/DurationScroll/index.js +0 -3
  78. package/dist/module/components/DurationScroll/index.js.map +0 -1
  79. package/dist/module/components/DurationScroll/types.js +0 -2
  80. package/dist/module/components/DurationScroll/types.js.map +0 -1
  81. package/dist/module/components/Modal/Modal.js +0 -99
  82. package/dist/module/components/Modal/Modal.js.map +0 -1
  83. package/dist/module/components/Modal/index.js +0 -3
  84. package/dist/module/components/Modal/index.js.map +0 -1
  85. package/dist/module/components/Modal/styles.js +0 -19
  86. package/dist/module/components/Modal/styles.js.map +0 -1
  87. package/dist/module/components/Modal/types.js +0 -2
  88. package/dist/module/components/Modal/types.js.map +0 -1
  89. package/dist/module/components/PickerItem/PickerItem.js +0 -38
  90. package/dist/module/components/PickerItem/PickerItem.js.map +0 -1
  91. package/dist/module/components/PickerItem/index.js +0 -2
  92. package/dist/module/components/PickerItem/index.js.map +0 -1
  93. package/dist/module/components/TimerPicker/TimerPicker.js +0 -228
  94. package/dist/module/components/TimerPicker/TimerPicker.js.map +0 -1
  95. package/dist/module/components/TimerPicker/index.js +0 -4
  96. package/dist/module/components/TimerPicker/index.js.map +0 -1
  97. package/dist/module/components/TimerPicker/styles.js +0 -114
  98. package/dist/module/components/TimerPicker/styles.js.map +0 -1
  99. package/dist/module/components/TimerPicker/types.js +0 -2
  100. package/dist/module/components/TimerPicker/types.js.map +0 -1
  101. package/dist/module/components/TimerPickerModal/TimerPickerModal.js +0 -145
  102. package/dist/module/components/TimerPickerModal/TimerPickerModal.js.map +0 -1
  103. package/dist/module/components/TimerPickerModal/index.js +0 -4
  104. package/dist/module/components/TimerPickerModal/index.js.map +0 -1
  105. package/dist/module/components/TimerPickerModal/styles.js +0 -82
  106. package/dist/module/components/TimerPickerModal/styles.js.map +0 -1
  107. package/dist/module/components/TimerPickerModal/types.js +0 -2
  108. package/dist/module/components/TimerPickerModal/types.js.map +0 -1
  109. package/dist/module/index.js +0 -3
  110. package/dist/module/index.js.map +0 -1
  111. package/dist/module/tests/DurationScroll.test.js +0 -160
  112. package/dist/module/tests/DurationScroll.test.js.map +0 -1
  113. package/dist/module/tests/Modal.test.js +0 -116
  114. package/dist/module/tests/Modal.test.js.map +0 -1
  115. package/dist/module/tests/TimerPicker.test.js +0 -166
  116. package/dist/module/tests/TimerPicker.test.js.map +0 -1
  117. package/dist/module/tests/TimerPickerModal.test.js +0 -273
  118. package/dist/module/tests/TimerPickerModal.test.js.map +0 -1
  119. package/dist/module/tests/colorToRgba.test.js +0 -174
  120. package/dist/module/tests/colorToRgba.test.js.map +0 -1
  121. package/dist/module/tests/generateNumbers.test.js +0 -348
  122. package/dist/module/tests/generateNumbers.test.js.map +0 -1
  123. package/dist/module/tests/getAdjustedLimit.test.js +0 -322
  124. package/dist/module/tests/getAdjustedLimit.test.js.map +0 -1
  125. package/dist/module/tests/getDurationAndIndexFromScrollOffset.test.js +0 -422
  126. package/dist/module/tests/getDurationAndIndexFromScrollOffset.test.js.map +0 -1
  127. package/dist/module/tests/getInitialScrollIndex.test.js +0 -394
  128. package/dist/module/tests/getInitialScrollIndex.test.js.map +0 -1
  129. package/dist/module/tests/getSafeInitialValue.test.js +0 -495
  130. package/dist/module/tests/getSafeInitialValue.test.js.map +0 -1
  131. package/dist/module/tests/padNumber.test.js +0 -299
  132. package/dist/module/tests/padNumber.test.js.map +0 -1
  133. package/dist/module/utils/colorToRgba.js +0 -80
  134. package/dist/module/utils/colorToRgba.js.map +0 -1
  135. package/dist/module/utils/generateNumbers.js +0 -117
  136. package/dist/module/utils/generateNumbers.js.map +0 -1
  137. package/dist/module/utils/getAdjustedLimit.js +0 -51
  138. package/dist/module/utils/getAdjustedLimit.js.map +0 -1
  139. package/dist/module/utils/getDurationAndIndexFromScrollOffset.js +0 -55
  140. package/dist/module/utils/getDurationAndIndexFromScrollOffset.js.map +0 -1
  141. package/dist/module/utils/getInitialScrollIndex.js +0 -50
  142. package/dist/module/utils/getInitialScrollIndex.js.map +0 -1
  143. package/dist/module/utils/getSafeInitialValue.js +0 -34
  144. package/dist/module/utils/getSafeInitialValue.js.map +0 -1
  145. package/dist/module/utils/padNumber.js +0 -33
  146. package/dist/module/utils/padNumber.js.map +0 -1
  147. package/dist/typescript/components/DurationScroll/DurationScroll.d.ts +0 -4
  148. package/dist/typescript/components/DurationScroll/index.d.ts +0 -2
  149. package/dist/typescript/components/DurationScroll/types.d.ts +0 -66
  150. package/dist/typescript/components/Modal/Modal.d.ts +0 -5
  151. package/dist/typescript/components/Modal/index.d.ts +0 -2
  152. package/dist/typescript/components/Modal/styles.d.ts +0 -17
  153. package/dist/typescript/components/Modal/types.d.ts +0 -15
  154. package/dist/typescript/components/PickerItem/PickerItem.d.ts +0 -14
  155. package/dist/typescript/components/PickerItem/index.d.ts +0 -1
  156. package/dist/typescript/components/TimerPicker/TimerPicker.d.ts +0 -4
  157. package/dist/typescript/components/TimerPicker/index.d.ts +0 -3
  158. package/dist/typescript/components/TimerPicker/styles.d.ts +0 -1451
  159. package/dist/typescript/components/TimerPicker/types.d.ts +0 -90
  160. package/dist/typescript/components/TimerPickerModal/TimerPickerModal.d.ts +0 -4
  161. package/dist/typescript/components/TimerPickerModal/index.d.ts +0 -3
  162. package/dist/typescript/components/TimerPickerModal/styles.d.ts +0 -947
  163. package/dist/typescript/components/TimerPickerModal/types.d.ts +0 -55
  164. package/dist/typescript/index.d.ts +0 -2
  165. package/dist/typescript/utils/colorToRgba.d.ts +0 -38
  166. package/dist/typescript/utils/generateNumbers.d.ts +0 -80
  167. package/dist/typescript/utils/getAdjustedLimit.d.ts +0 -30
  168. package/dist/typescript/utils/getDurationAndIndexFromScrollOffset.d.ts +0 -49
  169. package/dist/typescript/utils/getInitialScrollIndex.d.ts +0 -46
  170. package/dist/typescript/utils/getSafeInitialValue.d.ts +0 -38
  171. package/dist/typescript/utils/padNumber.d.ts +0 -28
@@ -1,55 +0,0 @@
1
- import type { RefObject, ReactElement } from "react";
2
- import type { View, TouchableOpacity, Text } from "react-native";
3
- import type Modal from "../Modal";
4
- import type { TimerPickerProps } from "../TimerPicker/types";
5
- import type { CustomTimerPickerModalStyles } from "./styles";
6
- export interface TimerPickerModalRef {
7
- latestDuration: {
8
- days: RefObject<number> | undefined;
9
- hours: RefObject<number> | undefined;
10
- minutes: RefObject<number> | undefined;
11
- seconds: RefObject<number> | undefined;
12
- };
13
- reset: (options?: {
14
- animated?: boolean;
15
- }) => void;
16
- setValue: (value: {
17
- days?: number;
18
- hours?: number;
19
- minutes?: number;
20
- seconds?: number;
21
- }, options?: {
22
- animated?: boolean;
23
- }) => void;
24
- }
25
- export interface TimerPickerModalProps extends TimerPickerProps {
26
- buttonContainerProps?: React.ComponentProps<typeof View>;
27
- buttonTouchableOpacityProps?: React.ComponentProps<typeof TouchableOpacity>;
28
- /** Custom cancel button component. If provided, replaces the default cancel button. */
29
- cancelButton?: ReactElement<{
30
- onPress?: () => void;
31
- }>;
32
- cancelButtonText?: string;
33
- closeOnOverlayPress?: boolean;
34
- /** Custom confirm button component. If provided, replaces the default confirm button. */
35
- confirmButton?: ReactElement<{
36
- onPress?: () => void;
37
- }>;
38
- confirmButtonText?: string;
39
- containerProps?: React.ComponentProps<typeof View>;
40
- contentContainerProps?: React.ComponentProps<typeof View>;
41
- hideCancelButton?: boolean;
42
- modalProps?: React.ComponentProps<typeof Modal>;
43
- modalTitle?: string;
44
- modalTitleProps?: React.ComponentProps<typeof Text>;
45
- onCancel?: () => void;
46
- onConfirm: ({ days, hours, minutes, seconds, }: {
47
- days: number;
48
- hours: number;
49
- minutes: number;
50
- seconds: number;
51
- }) => void;
52
- setIsVisible: (isVisible: boolean) => void;
53
- styles?: CustomTimerPickerModalStyles;
54
- visible: boolean;
55
- }
@@ -1,2 +0,0 @@
1
- export { default as TimerPickerModal, TimerPickerModalProps, TimerPickerModalRef, CustomTimerPickerModalStyles, } from "./components/TimerPickerModal";
2
- export { default as TimerPicker, TimerPickerProps, TimerPickerRef, CustomTimerPickerStyles, } from "./components/TimerPicker";
@@ -1,38 +0,0 @@
1
- /**
2
- * Converts various color formats to RGBA string representation.
3
- * This function is specifically required for expo-linear-gradient on iOS to handle transparent colors correctly.
4
- * It supports named colors, RGB, and hex color formats.
5
- *
6
- * @param {Object} variables - The input variables object
7
- * @param {string} variables.color - The color to convert. Can be:
8
- * - Named color (e.g., 'transparent', 'black', 'white', 'blue', 'green', 'gray', 'red')
9
- * - RGB format (e.g., 'rgb(255, 0, 0)')
10
- * - Hex format (e.g., '#FF0000' or '#F00')
11
- * @param {number} [variables.opacity=1] - The opacity value between 0 and 1
12
- *
13
- * @returns {string} The color in RGBA format (e.g., 'rgba(255, 0, 0, 0.5)')
14
- *
15
- * @example
16
- * // Using named color
17
- * colorToRgba({ color: 'transparent' })
18
- * // Returns: 'rgba(0, 0, 0, 0)'
19
- *
20
- * @example
21
- * // Using RGB with custom opacity
22
- * colorToRgba({ color: 'rgb(255, 0, 0)', opacity: 0.5 })
23
- * // Returns: 'rgba(255, 0, 0, 0.5)'
24
- *
25
- * @example
26
- * // Using hex color
27
- * colorToRgba({ color: '#FF0000' })
28
- * // Returns: 'rgba(255, 0, 0, 1)'
29
- *
30
- * @example
31
- * // Using short hex color
32
- * colorToRgba({ color: '#F00' })
33
- * // Returns: 'rgba(255, 0, 0, 1)'
34
- */
35
- export declare const colorToRgba: (variables: {
36
- color: string;
37
- opacity?: number;
38
- }) => string;
@@ -1,80 +0,0 @@
1
- /**
2
- * Generates an array of formatted numbers for a number picker, with support for infinite scroll,
3
- * padding, and number repetition.
4
- *
5
- * @param {number} numberOfItems - Total number of items to generate
6
- * @param {Object} options - Configuration options for number generation
7
- * @param {boolean} [options.disableInfiniteScroll] - Whether to disable infinite scroll
8
- * @param {number} options.interval - The interval between consecutive numbers
9
- * @param {boolean} [options.padNumbersWithZero] - Whether to pad single-digit numbers with leading zeros
10
- * @param {number} options.padWithNItems - Number of empty items to pad with
11
- * @param {number} options.repeatNTimes - How many times to repeat the number sequence
12
- *
13
- * @returns {string[]} Array of formatted number strings
14
- *
15
- * @example
16
- * // Generate numbers 0-9 with padding
17
- * generateNumbers(10, {
18
- * interval: 1,
19
- * padWithNItems: 2,
20
- * repeatNTimes: 1,
21
- * padNumbersWithZero: true
22
- * })
23
- * // Returns: ['', '', '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '', '']
24
- *
25
- * @example
26
- * // Generate even numbers with infinite scroll
27
- * generateNumbers(5, {
28
- * interval: 2,
29
- * padWithNItems: 2,
30
- * repeatNTimes: 3,
31
- * disableInfiniteScroll: false
32
- * })
33
- * // Returns: ['0', '2', '4', '6', '8', '0', '2', '4', '6', '8', '0', '2', '4', '6', '8']
34
- */
35
- export declare const generateNumbers: (numberOfItems: number, options: {
36
- disableInfiniteScroll?: boolean;
37
- interval: number;
38
- padNumbersWithZero?: boolean;
39
- padWithNItems: number;
40
- repeatNTimes: number;
41
- }) => string[];
42
- /**
43
- * Generates an array of formatted 12-hour time strings (AM/PM) for a time picker.
44
- * Supports infinite scroll, padding, and number repetition.
45
- *
46
- * @param {Object} options - Configuration options for time generation
47
- * @param {boolean} [options.disableInfiniteScroll] - Whether to disable infinite scroll
48
- * @param {number} options.interval - The interval between hours (must be a divisor of 12)
49
- * @param {boolean} [options.padNumbersWithZero] - Whether to pad single-digit hours with leading zeros
50
- * @param {number} options.padWithNItems - Number of empty items to pad with
51
- * @param {number} [options.repeatNTimes] - How many times to repeat the time sequence (defaults to 1)
52
- *
53
- * @returns {string[]} Array of formatted 12-hour time strings
54
- *
55
- * @example
56
- * // Generate hours with 1-hour interval
57
- * generate12HourNumbers({
58
- * interval: 1,
59
- * padWithNItems: 2,
60
- * padNumbersWithZero: true
61
- * })
62
- * // Returns: ['', '', '12 AM', '01 AM', '02 AM', ..., '11 PM', '', '']
63
- *
64
- * @example
65
- * // Generate hours with 2-hour interval and infinite scroll
66
- * generate12HourNumbers({
67
- * interval: 2,
68
- * padWithNItems: 2,
69
- * repeatNTimes: 2,
70
- * disableInfiniteScroll: false
71
- * })
72
- * // Returns: ['12 AM', '2 AM', '4 AM', ..., '10 PM', '12 AM', '2 AM', ...]
73
- */
74
- export declare const generate12HourNumbers: (options: {
75
- disableInfiniteScroll?: boolean;
76
- interval: number;
77
- padNumbersWithZero?: boolean;
78
- padWithNItems: number;
79
- repeatNTimes?: number;
80
- }) => string[];
@@ -1,30 +0,0 @@
1
- import type { Limit } from "../components/DurationScroll/types";
2
- /**
3
- * Adjusts and validates the min/max limits for a scrollable number picker.
4
- * Ensures limits are within valid bounds and handles edge cases.
5
- *
6
- * @param {Limit | undefined} limit - The input limit object containing optional min and max values
7
- * @param {number} numberOfItems - Total number of items in the picker
8
- * @param {number} interval - The interval between consecutive numbers
9
- *
10
- * @returns {{ max: number; min: number }} An object containing the adjusted min and max limits
11
- *
12
- * @example
13
- * // With valid limits
14
- * getAdjustedLimit({ min: 5, max: 15 }, 20, 1)
15
- * // Returns: { max: 15, min: 5 }
16
- *
17
- * @example
18
- * // With out-of-bounds limits
19
- * getAdjustedLimit({ min: -5, max: 25 }, 20, 1)
20
- * // Returns: { max: 19, min: 0 }
21
- *
22
- * @example
23
- * // With invalid limits (max < min)
24
- * getAdjustedLimit({ min: 15, max: 5 }, 20, 1)
25
- * // Returns: { max: 19, min: 0 }
26
- */
27
- export declare const getAdjustedLimit: (limit: Limit | undefined, numberOfItems: number, interval: number) => {
28
- max: number;
29
- min: number;
30
- };
@@ -1,49 +0,0 @@
1
- /**
2
- * Calculates the duration value and index from a scroll offset in a number picker.
3
- * Handles both infinite and non-infinite scroll modes, taking into account padding and item height.
4
- *
5
- * @param {Object} variables - Configuration object for scroll offset calculation
6
- * @param {boolean} variables.disableInfiniteScroll - Whether infinite scroll is disabled
7
- * @param {number} variables.interval - The interval between consecutive numbers
8
- * @param {number} variables.itemHeight - Height of each item in the picker
9
- * @param {number} variables.numberOfItems - Total number of items in the picker
10
- * @param {number} variables.padWithNItems - Number of empty items to pad with
11
- * @param {number} variables.yContentOffset - The vertical scroll offset
12
- *
13
- * @returns {{ duration: number; index: number }} Object containing the calculated duration and index
14
- *
15
- * @example
16
- * // With infinite scroll enabled
17
- * getDurationAndIndexFromScrollOffset({
18
- * disableInfiniteScroll: false,
19
- * interval: 1,
20
- * itemHeight: 50,
21
- * numberOfItems: 24,
22
- * padWithNItems: 2,
23
- * yContentOffset: 100
24
- * })
25
- * // Returns: { duration: 2, index: 2 }
26
- *
27
- * @example
28
- * // With infinite scroll disabled
29
- * getDurationAndIndexFromScrollOffset({
30
- * disableInfiniteScroll: true,
31
- * interval: 1,
32
- * itemHeight: 50,
33
- * numberOfItems: 24,
34
- * padWithNItems: 2,
35
- * yContentOffset: 100
36
- * })
37
- * // Returns: { duration: 2, index: 2 }
38
- */
39
- export declare const getDurationAndIndexFromScrollOffset: (variables: {
40
- disableInfiniteScroll: boolean;
41
- interval: number;
42
- itemHeight: number;
43
- numberOfItems: number;
44
- padWithNItems: number;
45
- yContentOffset: number;
46
- }) => {
47
- duration: number;
48
- index: number;
49
- };
@@ -1,46 +0,0 @@
1
- /**
2
- * Calculates the initial scroll index for a number picker based on the desired value and configuration.
3
- * Handles both infinite and non-infinite scroll modes, taking into account padding and repetition.
4
- *
5
- * @param {Object} variables - Configuration object for scroll index calculation
6
- * @param {boolean} variables.disableInfiniteScroll - Whether infinite scroll is disabled
7
- * @param {number} variables.interval - The interval between consecutive numbers
8
- * @param {number} variables.numberOfItems - Total number of items in the picker
9
- * @param {number} variables.padWithNItems - Number of empty items to pad with
10
- * @param {number} variables.repeatNumbersNTimes - How many times to repeat the number sequence
11
- * @param {number} variables.value - The desired initial value
12
- *
13
- * @returns {number} The calculated initial scroll index
14
- *
15
- * @example
16
- * // With infinite scroll enabled
17
- * getInitialScrollIndex({
18
- * disableInfiniteScroll: false,
19
- * interval: 1,
20
- * numberOfItems: 24,
21
- * padWithNItems: 2,
22
- * repeatNumbersNTimes: 3,
23
- * value: 12
24
- * })
25
- * // Returns: 38
26
- *
27
- * @example
28
- * // With infinite scroll disabled
29
- * getInitialScrollIndex({
30
- * disableInfiniteScroll: true,
31
- * interval: 1,
32
- * numberOfItems: 24,
33
- * padWithNItems: 2,
34
- * repeatNumbersNTimes: 1,
35
- * value: 12
36
- * })
37
- * // Returns: 12
38
- */
39
- export declare const getInitialScrollIndex: (variables: {
40
- disableInfiniteScroll: boolean;
41
- interval: number;
42
- numberOfItems: number;
43
- padWithNItems: number;
44
- repeatNumbersNTimes: number;
45
- value: number;
46
- }) => number;
@@ -1,38 +0,0 @@
1
- /**
2
- * Safely extracts and validates initial duration values, ensuring all values are valid numbers.
3
- * Returns a duration object with safe default values (0) for any invalid or missing inputs.
4
- *
5
- * @param {Object} [initialValue] - Optional initial duration values
6
- * @param {number} [initialValue.days] - Initial days value
7
- * @param {number} [initialValue.hours] - Initial hours value
8
- * @param {number} [initialValue.minutes] - Initial minutes value
9
- * @param {number} [initialValue.seconds] - Initial seconds value
10
- *
11
- * @returns {{ days: number; hours: number; minutes: number; seconds: number }} An object containing safe duration values
12
- *
13
- * @example
14
- * // With valid values
15
- * getSafeInitialValue({ days: 1, hours: 2, minutes: 30, seconds: 45 })
16
- * // Returns: { days: 1, hours: 2, minutes: 30, seconds: 45 }
17
- *
18
- * @example
19
- * // With invalid values
20
- * getSafeInitialValue({ days: NaN, hours: 'invalid', minutes: undefined })
21
- * // Returns: { days: 0, hours: 0, minutes: 0, seconds: 0 }
22
- *
23
- * @example
24
- * // With undefined input
25
- * getSafeInitialValue(undefined)
26
- * // Returns: { days: 0, hours: 0, minutes: 0, seconds: 0 }
27
- */
28
- export declare const getSafeInitialValue: (initialValue: {
29
- days?: number;
30
- hours?: number;
31
- minutes?: number;
32
- seconds?: number;
33
- } | undefined) => {
34
- days: number;
35
- hours: number;
36
- minutes: number;
37
- seconds: number;
38
- };
@@ -1,28 +0,0 @@
1
- /**
2
- * Formats a number by optionally padding it with a leading zero or space.
3
- * Numbers less than 10 are padded based on the options provided.
4
- *
5
- * @param {number} value - The number to format
6
- * @param {Object} [options] - Optional formatting options
7
- * @param {boolean} [options.padWithZero] - Whether to pad with zero (true) or space (false)
8
- *
9
- * @returns {string} The formatted number string
10
- *
11
- * @example
12
- * // Pad with zero
13
- * padNumber(5, { padWithZero: true })
14
- * // Returns: '05'
15
- *
16
- * @example
17
- * // Pad with figure space (same width as zero)
18
- * padNumber(5, { padWithZero: false })
19
- * // Returns: ' 5'
20
- *
21
- * @example
22
- * // No padding needed
23
- * padNumber(15)
24
- * // Returns: '15'
25
- */
26
- export declare const padNumber: (value: number, options?: {
27
- padWithZero?: boolean;
28
- }) => string;