react-native-timer-picker 2.1.1 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +250 -174
- package/dist/commonjs/components/DurationScroll/DurationScroll.js +417 -0
- package/dist/commonjs/components/DurationScroll/DurationScroll.js.map +1 -0
- package/dist/commonjs/components/DurationScroll/index.js +20 -392
- package/dist/commonjs/components/DurationScroll/index.js.map +1 -1
- package/dist/commonjs/components/DurationScroll/types.js.map +1 -1
- package/dist/commonjs/components/Modal/Modal.js +107 -0
- package/dist/commonjs/components/Modal/Modal.js.map +1 -0
- package/dist/commonjs/components/Modal/index.js +20 -101
- package/dist/commonjs/components/Modal/index.js.map +1 -1
- package/dist/commonjs/components/TimerPicker/TimerPicker.js +225 -0
- package/dist/commonjs/components/TimerPicker/TimerPicker.js.map +1 -0
- package/dist/commonjs/components/TimerPicker/index.js +29 -166
- package/dist/commonjs/components/TimerPicker/index.js.map +1 -1
- package/dist/commonjs/components/TimerPicker/styles.js.map +1 -1
- package/dist/commonjs/components/TimerPicker/types.js.map +1 -1
- package/dist/commonjs/components/TimerPickerModal/TimerPickerModal.js +143 -0
- package/dist/commonjs/components/TimerPickerModal/TimerPickerModal.js.map +1 -0
- package/dist/commonjs/components/TimerPickerModal/index.js +30 -131
- package/dist/commonjs/components/TimerPickerModal/index.js.map +1 -1
- package/dist/commonjs/components/TimerPickerModal/types.js.map +1 -1
- package/dist/commonjs/index.js +9 -13
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/tests/DurationScroll.test.js +94 -0
- package/dist/commonjs/tests/DurationScroll.test.js.map +1 -1
- package/dist/commonjs/tests/Modal.test.js +79 -2
- package/dist/commonjs/tests/Modal.test.js.map +1 -1
- package/dist/commonjs/tests/TimerPicker.test.js +119 -1
- package/dist/commonjs/tests/TimerPicker.test.js.map +1 -1
- package/dist/commonjs/tests/TimerPickerModal.test.js +120 -0
- package/dist/commonjs/tests/TimerPickerModal.test.js.map +1 -1
- package/dist/commonjs/tests/colorToRgba.test.js +176 -0
- package/dist/commonjs/tests/colorToRgba.test.js.map +1 -0
- package/dist/commonjs/tests/generateNumbers.test.js +350 -0
- package/dist/commonjs/tests/generateNumbers.test.js.map +1 -0
- package/dist/commonjs/tests/getAdjustedLimit.test.js +324 -0
- package/dist/commonjs/tests/getAdjustedLimit.test.js.map +1 -0
- package/dist/commonjs/tests/getDurationAndIndexFromScrollOffset.test.js +424 -0
- package/dist/commonjs/tests/getDurationAndIndexFromScrollOffset.test.js.map +1 -0
- package/dist/commonjs/tests/getInitialScrollIndex.test.js +396 -0
- package/dist/commonjs/tests/getInitialScrollIndex.test.js.map +1 -0
- package/dist/commonjs/tests/getSafeInitialValue.test.js +497 -0
- package/dist/commonjs/tests/getSafeInitialValue.test.js.map +1 -0
- package/dist/commonjs/tests/padNumber.test.js +301 -0
- package/dist/commonjs/tests/padNumber.test.js.map +1 -0
- package/dist/commonjs/utils/colorToRgba.js +40 -4
- package/dist/commonjs/utils/colorToRgba.js.map +1 -1
- package/dist/commonjs/utils/generateNumbers.js +67 -0
- package/dist/commonjs/utils/generateNumbers.js.map +1 -1
- package/dist/commonjs/utils/getAdjustedLimit.js +28 -3
- package/dist/commonjs/utils/getAdjustedLimit.js.map +1 -1
- package/dist/commonjs/utils/getDurationAndIndexFromScrollOffset.js +38 -0
- package/dist/commonjs/utils/getDurationAndIndexFromScrollOffset.js.map +1 -1
- package/dist/commonjs/utils/getInitialScrollIndex.js +38 -0
- package/dist/commonjs/utils/getInitialScrollIndex.js.map +1 -1
- package/dist/commonjs/utils/getSafeInitialValue.js +28 -0
- package/dist/commonjs/utils/getSafeInitialValue.js.map +1 -1
- package/dist/commonjs/utils/padNumber.js +25 -0
- package/dist/commonjs/utils/padNumber.js.map +1 -1
- package/dist/module/components/DurationScroll/DurationScroll.js +410 -0
- package/dist/module/components/DurationScroll/DurationScroll.js.map +1 -0
- package/dist/module/components/DurationScroll/index.js +2 -390
- package/dist/module/components/DurationScroll/index.js.map +1 -1
- package/dist/module/components/DurationScroll/types.js.map +1 -1
- package/dist/module/components/Modal/Modal.js +99 -0
- package/dist/module/components/Modal/Modal.js.map +1 -0
- package/dist/module/components/Modal/index.js +2 -98
- package/dist/module/components/Modal/index.js.map +1 -1
- package/dist/module/components/TimerPicker/TimerPicker.js +217 -0
- package/dist/module/components/TimerPicker/TimerPicker.js.map +1 -0
- package/dist/module/components/TimerPicker/index.js +3 -166
- package/dist/module/components/TimerPicker/index.js.map +1 -1
- package/dist/module/components/TimerPicker/styles.js.map +1 -1
- package/dist/module/components/TimerPicker/types.js.map +1 -1
- package/dist/module/components/TimerPickerModal/TimerPickerModal.js +135 -0
- package/dist/module/components/TimerPickerModal/TimerPickerModal.js.map +1 -0
- package/dist/module/components/TimerPickerModal/index.js +3 -130
- package/dist/module/components/TimerPickerModal/index.js.map +1 -1
- package/dist/module/components/TimerPickerModal/types.js.map +1 -1
- package/dist/module/index.js +2 -6
- package/dist/module/index.js.map +1 -1
- package/dist/module/tests/DurationScroll.test.js +94 -0
- package/dist/module/tests/DurationScroll.test.js.map +1 -1
- package/dist/module/tests/Modal.test.js +80 -3
- package/dist/module/tests/Modal.test.js.map +1 -1
- package/dist/module/tests/TimerPicker.test.js +119 -1
- package/dist/module/tests/TimerPicker.test.js.map +1 -1
- package/dist/module/tests/TimerPickerModal.test.js +121 -1
- package/dist/module/tests/TimerPickerModal.test.js.map +1 -1
- package/dist/module/tests/colorToRgba.test.js +174 -0
- package/dist/module/tests/colorToRgba.test.js.map +1 -0
- package/dist/module/tests/generateNumbers.test.js +348 -0
- package/dist/module/tests/generateNumbers.test.js.map +1 -0
- package/dist/module/tests/getAdjustedLimit.test.js +322 -0
- package/dist/module/tests/getAdjustedLimit.test.js.map +1 -0
- package/dist/module/tests/getDurationAndIndexFromScrollOffset.test.js +422 -0
- package/dist/module/tests/getDurationAndIndexFromScrollOffset.test.js.map +1 -0
- package/dist/module/tests/getInitialScrollIndex.test.js +394 -0
- package/dist/module/tests/getInitialScrollIndex.test.js.map +1 -0
- package/dist/module/tests/getSafeInitialValue.test.js +495 -0
- package/dist/module/tests/getSafeInitialValue.test.js.map +1 -0
- package/dist/module/tests/padNumber.test.js +299 -0
- package/dist/module/tests/padNumber.test.js.map +1 -0
- package/dist/module/utils/colorToRgba.js +40 -4
- package/dist/module/utils/colorToRgba.js.map +1 -1
- package/dist/module/utils/generateNumbers.js +68 -0
- package/dist/module/utils/generateNumbers.js.map +1 -1
- package/dist/module/utils/getAdjustedLimit.js +28 -3
- package/dist/module/utils/getAdjustedLimit.js.map +1 -1
- package/dist/module/utils/getDurationAndIndexFromScrollOffset.js +38 -0
- package/dist/module/utils/getDurationAndIndexFromScrollOffset.js.map +1 -1
- package/dist/module/utils/getInitialScrollIndex.js +38 -0
- package/dist/module/utils/getInitialScrollIndex.js.map +1 -1
- package/dist/module/utils/getSafeInitialValue.js +28 -0
- package/dist/module/utils/getSafeInitialValue.js.map +1 -1
- package/dist/module/utils/padNumber.js +25 -0
- package/dist/module/utils/padNumber.js.map +1 -1
- package/dist/typescript/components/DurationScroll/DurationScroll.d.ts +4 -0
- package/dist/typescript/components/DurationScroll/index.d.ts +2 -4
- package/dist/typescript/components/DurationScroll/types.d.ts +13 -9
- package/dist/typescript/components/Modal/Modal.d.ts +5 -0
- package/dist/typescript/components/Modal/index.d.ts +2 -5
- package/dist/typescript/components/TimerPicker/TimerPicker.d.ts +4 -0
- package/dist/typescript/components/TimerPicker/index.d.ts +3 -4
- package/dist/typescript/components/TimerPicker/styles.d.ts +922 -771
- package/dist/typescript/components/TimerPicker/types.d.ts +26 -10
- package/dist/typescript/components/TimerPickerModal/TimerPickerModal.d.ts +4 -0
- package/dist/typescript/components/TimerPickerModal/index.d.ts +3 -4
- package/dist/typescript/components/TimerPickerModal/styles.d.ts +570 -474
- package/dist/typescript/components/TimerPickerModal/types.d.ts +8 -5
- package/dist/typescript/index.d.ts +2 -6
- package/dist/typescript/utils/colorToRgba.d.ts +34 -0
- package/dist/typescript/utils/generateNumbers.d.ts +66 -0
- package/dist/typescript/utils/getAdjustedLimit.d.ts +27 -2
- package/dist/typescript/utils/getDurationAndIndexFromScrollOffset.d.ts +38 -0
- package/dist/typescript/utils/getInitialScrollIndex.d.ts +38 -0
- package/dist/typescript/utils/getSafeInitialValue.d.ts +29 -0
- package/dist/typescript/utils/padNumber.d.ts +25 -0
- package/package.json +12 -30
|
@@ -1,3 +1,41 @@
|
|
|
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
|
+
*/
|
|
1
39
|
export const getInitialScrollIndex = variables => {
|
|
2
40
|
const {
|
|
3
41
|
disableInfiniteScroll,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getInitialScrollIndex","variables","disableInfiniteScroll","interval","numberOfItems","padWithNItems","repeatNumbersNTimes","value","Math","max","floor"],"sources":["getInitialScrollIndex.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["getInitialScrollIndex","variables","disableInfiniteScroll","interval","numberOfItems","padWithNItems","repeatNumbersNTimes","value","Math","max","floor"],"sources":["getInitialScrollIndex.ts"],"sourcesContent":["/**\n * Calculates the initial scroll index for a number picker based on the desired value and configuration.\n * Handles both infinite and non-infinite scroll modes, taking into account padding and repetition.\n * \n * @param {Object} variables - Configuration object for scroll index calculation\n * @param {boolean} variables.disableInfiniteScroll - Whether infinite scroll is disabled\n * @param {number} variables.interval - The interval between consecutive numbers\n * @param {number} variables.numberOfItems - Total number of items in the picker\n * @param {number} variables.padWithNItems - Number of empty items to pad with\n * @param {number} variables.repeatNumbersNTimes - How many times to repeat the number sequence\n * @param {number} variables.value - The desired initial value\n * \n * @returns {number} The calculated initial scroll index\n * \n * @example\n * // With infinite scroll enabled\n * getInitialScrollIndex({\n * disableInfiniteScroll: false,\n * interval: 1,\n * numberOfItems: 24,\n * padWithNItems: 2,\n * repeatNumbersNTimes: 3,\n * value: 12\n * })\n * // Returns: 38\n * \n * @example\n * // With infinite scroll disabled\n * getInitialScrollIndex({\n * disableInfiniteScroll: true,\n * interval: 1,\n * numberOfItems: 24,\n * padWithNItems: 2,\n * repeatNumbersNTimes: 1,\n * value: 12\n * })\n * // Returns: 12\n */\nexport const getInitialScrollIndex = (variables: {\n disableInfiniteScroll: boolean;\n interval: number;\n numberOfItems: number;\n padWithNItems: number;\n repeatNumbersNTimes: number;\n value: number;\n}) => {\n const {\n disableInfiniteScroll,\n interval,\n numberOfItems,\n padWithNItems,\n repeatNumbersNTimes,\n value,\n } = variables;\n\n return Math.max(\n numberOfItems * Math.floor(repeatNumbersNTimes / 2) +\n ((value / interval + numberOfItems) % numberOfItems) -\n (!disableInfiniteScroll ? padWithNItems : 0),\n 0\n );\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,qBAAqB,GAAIC,SAOrC,IAAK;EACF,MAAM;IACFC,qBAAqB;IACrBC,QAAQ;IACRC,aAAa;IACbC,aAAa;IACbC,mBAAmB;IACnBC;EACJ,CAAC,GAAGN,SAAS;EAEb,OAAOO,IAAI,CAACC,GAAG,CACXL,aAAa,GAAGI,IAAI,CAACE,KAAK,CAACJ,mBAAmB,GAAG,CAAC,CAAC,GAC9C,CAACC,KAAK,GAAGJ,QAAQ,GAAGC,aAAa,IAAIA,aAAc,IACnD,CAACF,qBAAqB,GAAGG,aAAa,GAAG,CAAC,CAAC,EAChD,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,32 @@
|
|
|
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
|
+
*/
|
|
1
28
|
export const getSafeInitialValue = initialValue => ({
|
|
29
|
+
days: typeof (initialValue === null || initialValue === void 0 ? void 0 : initialValue.days) === "number" && !isNaN(initialValue === null || initialValue === void 0 ? void 0 : initialValue.days) ? initialValue.days : 0,
|
|
2
30
|
hours: typeof (initialValue === null || initialValue === void 0 ? void 0 : initialValue.hours) === "number" && !isNaN(initialValue === null || initialValue === void 0 ? void 0 : initialValue.hours) ? initialValue.hours : 0,
|
|
3
31
|
minutes: typeof (initialValue === null || initialValue === void 0 ? void 0 : initialValue.minutes) === "number" && !isNaN(initialValue === null || initialValue === void 0 ? void 0 : initialValue.minutes) ? initialValue.minutes : 0,
|
|
4
32
|
seconds: typeof (initialValue === null || initialValue === void 0 ? void 0 : initialValue.seconds) === "number" && !isNaN(initialValue === null || initialValue === void 0 ? void 0 : initialValue.seconds) ? initialValue.seconds : 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getSafeInitialValue","initialValue","
|
|
1
|
+
{"version":3,"names":["getSafeInitialValue","initialValue","days","isNaN","hours","minutes","seconds"],"sources":["getSafeInitialValue.ts"],"sourcesContent":["/**\n * Safely extracts and validates initial duration values, ensuring all values are valid numbers.\n * Returns a duration object with safe default values (0) for any invalid or missing inputs.\n * \n * @param {Object} [initialValue] - Optional initial duration values\n * @param {number} [initialValue.days] - Initial days value\n * @param {number} [initialValue.hours] - Initial hours value\n * @param {number} [initialValue.minutes] - Initial minutes value\n * @param {number} [initialValue.seconds] - Initial seconds value\n * \n * @returns {{ days: number; hours: number; minutes: number; seconds: number }} An object containing safe duration values\n * \n * @example\n * // With valid values\n * getSafeInitialValue({ days: 1, hours: 2, minutes: 30, seconds: 45 })\n * // Returns: { days: 1, hours: 2, minutes: 30, seconds: 45 }\n * \n * @example\n * // With invalid values\n * getSafeInitialValue({ days: NaN, hours: 'invalid', minutes: undefined })\n * // Returns: { days: 0, hours: 0, minutes: 0, seconds: 0 }\n * \n * @example\n * // With undefined input\n * getSafeInitialValue(undefined)\n * // Returns: { days: 0, hours: 0, minutes: 0, seconds: 0 }\n */\nexport const getSafeInitialValue = (\n initialValue:\n | {\n days?: number;\n hours?: number;\n minutes?: number;\n seconds?: number;\n }\n | undefined\n) => ({\n days:\n typeof initialValue?.days === \"number\" && !isNaN(initialValue?.days)\n ? initialValue.days\n : 0,\n hours:\n typeof initialValue?.hours === \"number\" && !isNaN(initialValue?.hours)\n ? initialValue.hours\n : 0,\n minutes:\n typeof initialValue?.minutes === \"number\" &&\n !isNaN(initialValue?.minutes)\n ? initialValue.minutes\n : 0,\n seconds:\n typeof initialValue?.seconds === \"number\" &&\n !isNaN(initialValue?.seconds)\n ? initialValue.seconds\n : 0,\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,mBAAmB,GAC5BC,YAOe,KACb;EACFC,IAAI,EACA,QAAOD,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEC,IAAI,MAAK,QAAQ,IAAI,CAACC,KAAK,CAACF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEC,IAAI,CAAC,GAC9DD,YAAY,CAACC,IAAI,GACjB,CAAC;EACXE,KAAK,EACD,QAAOH,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEG,KAAK,MAAK,QAAQ,IAAI,CAACD,KAAK,CAACF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEG,KAAK,CAAC,GAChEH,YAAY,CAACG,KAAK,GAClB,CAAC;EACXC,OAAO,EACH,QAAOJ,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEI,OAAO,MAAK,QAAQ,IACzC,CAACF,KAAK,CAACF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEI,OAAO,CAAC,GACvBJ,YAAY,CAACI,OAAO,GACpB,CAAC;EACXC,OAAO,EACH,QAAOL,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEK,OAAO,MAAK,QAAQ,IACzC,CAACH,KAAK,CAACF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEK,OAAO,CAAC,GACvBL,YAAY,CAACK,OAAO,GACpB;AACd,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,28 @@
|
|
|
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 space
|
|
18
|
+
* padNumber(5, { padWithZero: false })
|
|
19
|
+
* // Returns: ' 5'
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // No padding needed
|
|
23
|
+
* padNumber(15)
|
|
24
|
+
* // Returns: '15'
|
|
25
|
+
*/
|
|
1
26
|
export const padNumber = (value, options) => {
|
|
2
27
|
if (value < 10) {
|
|
3
28
|
return (options !== null && options !== void 0 && options.padWithZero ? "0" : " ") + value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["padNumber","value","options","padWithZero","String"],"sources":["padNumber.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["padNumber","value","options","padWithZero","String"],"sources":["padNumber.ts"],"sourcesContent":["/**\n * Formats a number by optionally padding it with a leading zero or space.\n * Numbers less than 10 are padded based on the options provided.\n * \n * @param {number} value - The number to format\n * @param {Object} [options] - Optional formatting options\n * @param {boolean} [options.padWithZero] - Whether to pad with zero (true) or space (false)\n * \n * @returns {string} The formatted number string\n * \n * @example\n * // Pad with zero\n * padNumber(5, { padWithZero: true })\n * // Returns: '05'\n * \n * @example\n * // Pad with space\n * padNumber(5, { padWithZero: false })\n * // Returns: ' 5'\n * \n * @example\n * // No padding needed\n * padNumber(15)\n * // Returns: '15'\n */\nexport const padNumber = (\n value: number,\n options?: { padWithZero?: boolean }\n): string => {\n if (value < 10) {\n return (options?.padWithZero ? \"0\" : \" \") + value;\n } else {\n return String(value);\n }\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAGA,CACrBC,KAAa,EACbC,OAAmC,KAC1B;EACT,IAAID,KAAK,GAAG,EAAE,EAAE;IACZ,OAAO,CAACC,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEC,WAAW,GAAG,GAAG,GAAG,GAAG,IAAIF,KAAK;EACrD,CAAC,MAAM;IACH,OAAOG,MAAM,CAACH,KAAK,CAAC;EACxB;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<DurationScrollProps & React.RefAttributes<DurationScrollRef>>>;
|
|
4
|
-
export default _default;
|
|
1
|
+
export { default } from "./DurationScroll";
|
|
2
|
+
export * from "./types";
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { View
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
|
+
import type { View } from "react-native";
|
|
3
3
|
import type { generateStyles } from "../TimerPicker/styles";
|
|
4
|
-
export type CustomFlatList = <ItemT = any>(props: React.PropsWithChildren<RNFlatListProps<ItemT> & React.RefAttributes<RNFlatList<ItemT>>>, ref: React.ForwardedRef<RNFlatList<ItemT>>) => React.ReactElement | null;
|
|
5
4
|
export interface DurationScrollProps {
|
|
6
5
|
Audio?: any;
|
|
7
|
-
FlatList?:
|
|
6
|
+
FlatList?: any;
|
|
8
7
|
Haptics?: any;
|
|
9
8
|
LinearGradient?: any;
|
|
10
9
|
MaskedView?: any;
|
|
11
10
|
aggressivelyGetLatestDuration: boolean;
|
|
12
11
|
allowFontScaling?: boolean;
|
|
13
12
|
amLabel?: string;
|
|
14
|
-
clickSoundAsset?:
|
|
13
|
+
clickSoundAsset?: SoundAsset;
|
|
14
|
+
decelerationRate?: number | "normal" | "fast";
|
|
15
15
|
disableInfiniteScroll?: boolean;
|
|
16
16
|
initialValue?: number;
|
|
17
17
|
interval: number;
|
|
18
18
|
is12HourPicker?: boolean;
|
|
19
19
|
isDisabled?: boolean;
|
|
20
20
|
label?: string | React.ReactElement;
|
|
21
|
-
limit?:
|
|
21
|
+
limit?: Limit;
|
|
22
22
|
maximumValue: number;
|
|
23
23
|
onDurationChange: (duration: number) => void;
|
|
24
24
|
padNumbersWithZero?: boolean;
|
|
@@ -32,7 +32,7 @@ export interface DurationScrollProps {
|
|
|
32
32
|
testID?: string;
|
|
33
33
|
}
|
|
34
34
|
export interface DurationScrollRef {
|
|
35
|
-
latestDuration:
|
|
35
|
+
latestDuration: RefObject<number>;
|
|
36
36
|
reset: (options?: {
|
|
37
37
|
animated?: boolean;
|
|
38
38
|
}) => void;
|
|
@@ -50,13 +50,17 @@ export type LinearGradientProps = React.ComponentProps<typeof View> & {
|
|
|
50
50
|
locations?: number[] | null;
|
|
51
51
|
start?: LinearGradientPoint | null;
|
|
52
52
|
};
|
|
53
|
-
export type
|
|
53
|
+
export type Limit = {
|
|
54
54
|
max?: number;
|
|
55
55
|
min?: number;
|
|
56
56
|
};
|
|
57
|
-
export type
|
|
57
|
+
export type SoundAsset = number | {
|
|
58
58
|
headers?: Record<string, string>;
|
|
59
59
|
overrideFileExtensionAndroid?: string;
|
|
60
60
|
uri: string;
|
|
61
61
|
};
|
|
62
|
+
export type ExpoAvAudioInstance = {
|
|
63
|
+
replayAsync: () => Promise<void>;
|
|
64
|
+
unloadAsync: () => Promise<void>;
|
|
65
|
+
};
|
|
62
66
|
export {};
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const Modal: (props: ModalProps) => React.JSX.Element;
|
|
4
|
-
declare const _default: React.MemoExoticComponent<(props: ModalProps) => React.JSX.Element>;
|
|
5
|
-
export default _default;
|
|
1
|
+
export { default } from "./Modal";
|
|
2
|
+
export * from "./types";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default _default;
|
|
1
|
+
export { default } from "./TimerPicker";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
export * from "./styles";
|