@grupalia/rn-ui-kit 0.18.0 → 0.20.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/README.md +27 -0
- package/lib/commonjs/UIKitProvider.js +41 -0
- package/lib/commonjs/UIKitProvider.js.map +1 -0
- package/lib/commonjs/assets/illustrations/warning.svg +1 -0
- package/lib/commonjs/components/AppView.js +64 -0
- package/lib/commonjs/components/AppView.js.map +1 -0
- package/lib/commonjs/components/BaseDatesScrollView.js +13 -7
- package/lib/commonjs/components/BaseDatesScrollView.js.map +1 -1
- package/lib/commonjs/components/BaseErrorBox.js +92 -0
- package/lib/commonjs/components/BaseErrorBox.js.map +1 -0
- package/lib/commonjs/components/BaseErrorScreen.js +41 -0
- package/lib/commonjs/components/BaseErrorScreen.js.map +1 -0
- package/lib/commonjs/components/BaseStickyFooter.js +19 -0
- package/lib/commonjs/components/BaseStickyFooter.js.map +1 -0
- package/lib/commonjs/components/DateSelector.js +10 -5
- package/lib/commonjs/components/DateSelector.js.map +1 -1
- package/lib/commonjs/components/DateTimeSelector.js +56 -41
- package/lib/commonjs/components/DateTimeSelector.js.map +1 -1
- package/lib/commonjs/components/NetworkBanner.js +73 -0
- package/lib/commonjs/components/NetworkBanner.js.map +1 -0
- package/lib/commonjs/components/index.js +28 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/svgs/Warning.js +15 -0
- package/lib/commonjs/components/svgs/Warning.js.map +1 -0
- package/lib/commonjs/hooks/index.js +22 -13
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useInternetConnectionStatus.js +24 -14
- package/lib/commonjs/hooks/useInternetConnectionStatus.js.map +1 -1
- package/lib/commonjs/hooks/useTimezonedDate.js +73 -0
- package/lib/commonjs/hooks/useTimezonedDate.js.map +1 -0
- package/lib/commonjs/index.js +36 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/test-setup.js +11 -0
- package/lib/commonjs/test-setup.js.map +1 -0
- package/lib/commonjs/utils/filters.js +52 -0
- package/lib/commonjs/utils/filters.js.map +1 -0
- package/lib/commonjs/utils/index.js +11 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/UIKitProvider.js +34 -0
- package/lib/module/UIKitProvider.js.map +1 -0
- package/lib/module/assets/illustrations/warning.svg +1 -0
- package/lib/module/components/AppView.js +59 -0
- package/lib/module/components/AppView.js.map +1 -0
- package/lib/module/components/BaseDatesScrollView.js +15 -9
- package/lib/module/components/BaseDatesScrollView.js.map +1 -1
- package/lib/module/components/BaseErrorBox.js +87 -0
- package/lib/module/components/BaseErrorBox.js.map +1 -0
- package/lib/module/components/BaseErrorScreen.js +36 -0
- package/lib/module/components/BaseErrorScreen.js.map +1 -0
- package/lib/module/components/BaseStickyFooter.js +15 -0
- package/lib/module/components/BaseStickyFooter.js.map +1 -0
- package/lib/module/components/DateSelector.js +11 -6
- package/lib/module/components/DateSelector.js.map +1 -1
- package/lib/module/components/DateTimeSelector.js +57 -41
- package/lib/module/components/DateTimeSelector.js.map +1 -1
- package/lib/module/components/NetworkBanner.js +67 -0
- package/lib/module/components/NetworkBanner.js.map +1 -0
- package/lib/module/components/index.js +4 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/svgs/Warning.js +10 -0
- package/lib/module/components/svgs/Warning.js.map +1 -0
- package/lib/module/hooks/index.js +2 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useInternetConnectionStatus.js +23 -13
- package/lib/module/hooks/useInternetConnectionStatus.js.map +1 -1
- package/lib/module/hooks/useTimezonedDate.js +70 -0
- package/lib/module/hooks/useTimezonedDate.js.map +1 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/test-setup.js +10 -0
- package/lib/module/test-setup.js.map +1 -0
- package/lib/module/utils/filters.js +48 -0
- package/lib/module/utils/filters.js.map +1 -0
- package/lib/module/utils/index.js +1 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/commonjs/UIKitProvider.d.ts +15 -0
- package/lib/typescript/commonjs/UIKitProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/__tests__/smoke.test.d.ts +2 -0
- package/lib/typescript/commonjs/__tests__/smoke.test.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/AppView.d.ts +19 -0
- package/lib/typescript/commonjs/components/AppView.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/BaseDatesScrollView.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/BaseErrorBox.d.ts +14 -0
- package/lib/typescript/commonjs/components/BaseErrorBox.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/BaseErrorScreen.d.ts +13 -0
- package/lib/typescript/commonjs/components/BaseErrorScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/BaseStickyFooter.d.ts +11 -0
- package/lib/typescript/commonjs/components/BaseStickyFooter.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/DateSelector.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/DateTimeSelector.d.ts +8 -3
- package/lib/typescript/commonjs/components/DateTimeSelector.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/FormikDateTimeSelector.d.ts +1 -1
- package/lib/typescript/commonjs/components/FormikDateTimeSelectorBottomSheet.d.ts +1 -1
- package/lib/typescript/commonjs/components/NetworkBanner.d.ts +10 -0
- package/lib/typescript/commonjs/components/NetworkBanner.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/svgs/Warning.d.ts +6 -0
- package/lib/typescript/commonjs/components/svgs/Warning.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/index.d.ts +2 -1
- package/lib/typescript/commonjs/hooks/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/useInternetConnectionStatus.d.ts +4 -4
- package/lib/typescript/commonjs/hooks/useInternetConnectionStatus.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/useTimezonedDate.d.ts +59 -0
- package/lib/typescript/commonjs/hooks/useTimezonedDate.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +3 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/test-setup.d.ts +2 -0
- package/lib/typescript/commonjs/test-setup.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/filters.d.ts +4 -0
- package/lib/typescript/commonjs/utils/filters.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/index.d.ts +1 -0
- package/lib/typescript/commonjs/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/UIKitProvider.d.ts +15 -0
- package/lib/typescript/module/UIKitProvider.d.ts.map +1 -0
- package/lib/typescript/module/__tests__/smoke.test.d.ts +2 -0
- package/lib/typescript/module/__tests__/smoke.test.d.ts.map +1 -0
- package/lib/typescript/module/components/AppView.d.ts +19 -0
- package/lib/typescript/module/components/AppView.d.ts.map +1 -0
- package/lib/typescript/module/components/BaseDatesScrollView.d.ts.map +1 -1
- package/lib/typescript/module/components/BaseErrorBox.d.ts +14 -0
- package/lib/typescript/module/components/BaseErrorBox.d.ts.map +1 -0
- package/lib/typescript/module/components/BaseErrorScreen.d.ts +13 -0
- package/lib/typescript/module/components/BaseErrorScreen.d.ts.map +1 -0
- package/lib/typescript/module/components/BaseStickyFooter.d.ts +11 -0
- package/lib/typescript/module/components/BaseStickyFooter.d.ts.map +1 -0
- package/lib/typescript/module/components/DateSelector.d.ts.map +1 -1
- package/lib/typescript/module/components/DateTimeSelector.d.ts +8 -3
- package/lib/typescript/module/components/DateTimeSelector.d.ts.map +1 -1
- package/lib/typescript/module/components/FormikDateTimeSelector.d.ts +1 -1
- package/lib/typescript/module/components/FormikDateTimeSelectorBottomSheet.d.ts +1 -1
- package/lib/typescript/module/components/NetworkBanner.d.ts +10 -0
- package/lib/typescript/module/components/NetworkBanner.d.ts.map +1 -0
- package/lib/typescript/module/components/index.d.ts +4 -0
- package/lib/typescript/module/components/index.d.ts.map +1 -1
- package/lib/typescript/module/components/svgs/Warning.d.ts +6 -0
- package/lib/typescript/module/components/svgs/Warning.d.ts.map +1 -0
- package/lib/typescript/module/hooks/index.d.ts +2 -1
- package/lib/typescript/module/hooks/index.d.ts.map +1 -1
- package/lib/typescript/module/hooks/useInternetConnectionStatus.d.ts +4 -4
- package/lib/typescript/module/hooks/useInternetConnectionStatus.d.ts.map +1 -1
- package/lib/typescript/module/hooks/useTimezonedDate.d.ts +59 -0
- package/lib/typescript/module/hooks/useTimezonedDate.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +3 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/test-setup.d.ts +2 -0
- package/lib/typescript/module/test-setup.d.ts.map +1 -0
- package/lib/typescript/module/utils/filters.d.ts +4 -0
- package/lib/typescript/module/utils/filters.d.ts.map +1 -0
- package/lib/typescript/module/utils/index.d.ts +1 -0
- package/lib/typescript/module/utils/index.d.ts.map +1 -1
- package/package.json +19 -9
- package/src/components/BaseAlert.tsx +0 -181
- package/src/components/BaseBadge.tsx +0 -192
- package/src/components/BaseBottomSheetModal.tsx +0 -50
- package/src/components/BaseButton.tsx +0 -317
- package/src/components/BaseConfirmationModal.tsx +0 -66
- package/src/components/BaseDateInput.tsx +0 -153
- package/src/components/BaseDatesScrollView.tsx +0 -123
- package/src/components/BaseHorizontalTabs.tsx +0 -225
- package/src/components/BaseIcon.tsx +0 -41
- package/src/components/BaseIconBox.tsx +0 -75
- package/src/components/BaseRadioGroup.tsx +0 -75
- package/src/components/BaseSelect.tsx +0 -170
- package/src/components/BaseSelectionItem.tsx +0 -85
- package/src/components/BaseSpinner.tsx +0 -21
- package/src/components/BaseStackedList.tsx +0 -146
- package/src/components/BaseSwitch.tsx +0 -48
- package/src/components/BaseText.tsx +0 -34
- package/src/components/CameraImageInput.tsx +0 -610
- package/src/components/CameraWrapperModal.tsx +0 -309
- package/src/components/DateSelector.tsx +0 -91
- package/src/components/DateTimeSelector.tsx +0 -305
- package/src/components/FormikCameraImageInput.tsx +0 -39
- package/src/components/FormikDateInput.tsx +0 -53
- package/src/components/FormikDateSelector.tsx +0 -36
- package/src/components/FormikDateTimeSelector.tsx +0 -49
- package/src/components/FormikDateTimeSelectorBottomSheet.tsx +0 -129
- package/src/components/FormikRadioGroup.tsx +0 -35
- package/src/components/FormikSelect.tsx +0 -49
- package/src/components/ImagePickerBottomSheet.tsx +0 -109
- package/src/components/PhotoPickerModal.tsx +0 -116
- package/src/components/PressableOpacity.tsx +0 -88
- package/src/components/Toasts.tsx +0 -200
- package/src/components/index.ts +0 -30
- package/src/components/svgs/Camera.tsx +0 -14
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useBreakpoints.ts +0 -20
- package/src/hooks/useInternetConnectionStatus.ts +0 -221
- package/src/hooks/useIsAboveBreakpoint.ts +0 -8
- package/src/utils/clabe.ts +0 -31
- package/src/utils/date.ts +0 -1
- package/src/utils/fileDirectoryUtils.ts +0 -12
- package/src/utils/fonts.ts +0 -118
- package/src/utils/index.ts +0 -3
- package/src/utils/mx-banks.json +0 -492
- package/src/utils/mx-banks.ts +0 -9
- package/src/utils/timeConstants.ts +0 -19
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
|
+
interface DayHourRestriction {
|
|
4
|
+
minHour: number;
|
|
5
|
+
maxHour: number;
|
|
6
|
+
}
|
|
3
7
|
export interface DateTimeSelectorProps extends ViewProps {
|
|
4
8
|
value: Date | undefined;
|
|
5
9
|
onChange: (date?: Date) => void;
|
|
@@ -7,6 +11,7 @@ export interface DateTimeSelectorProps extends ViewProps {
|
|
|
7
11
|
maxDate?: Date;
|
|
8
12
|
minHour?: number;
|
|
9
13
|
maxHour?: number;
|
|
14
|
+
dayHourRestrictions?: Record<number, DayHourRestriction>;
|
|
10
15
|
timeSlotIntervalMinutes?: number;
|
|
11
16
|
timeSlotDurationMinutes?: number;
|
|
12
17
|
disabledWeekDays?: number[];
|
|
@@ -19,11 +24,11 @@ export interface DateTimeSelectorProps extends ViewProps {
|
|
|
19
24
|
error?: string;
|
|
20
25
|
allowPastDatetimes?: boolean;
|
|
21
26
|
}
|
|
22
|
-
declare const _default:
|
|
27
|
+
declare const _default: import("react").ForwardRefExoticComponent<DateTimeSelectorProps & {
|
|
23
28
|
className?: string | undefined;
|
|
24
29
|
tw?: string | undefined;
|
|
25
30
|
baseClassName?: string | undefined;
|
|
26
31
|
baseTw?: string | undefined;
|
|
27
|
-
} &
|
|
32
|
+
} & import("react").RefAttributes<unknown>>;
|
|
28
33
|
export default _default;
|
|
29
34
|
//# sourceMappingURL=DateTimeSelector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTimeSelector.tsx"],"names":[],"mappings":"AAYA,OAAO,
|
|
1
|
+
{"version":3,"file":"DateTimeSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTimeSelector.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAsFzC,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACtD,KAAK,EAAE,IAAI,GAAG,SAAS,CAAC;IACxB,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACzD,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;;;;;;;AAkOD,wBAAwC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
3
|
import { DateTimeSelectorProps } from './DateTimeSelector';
|
|
4
|
-
declare const _default: import("react").ForwardRefExoticComponent<ViewProps & Omit<DateTimeSelectorProps, "
|
|
4
|
+
declare const _default: import("react").ForwardRefExoticComponent<ViewProps & Omit<DateTimeSelectorProps, "value" | "onChange" | "error"> & {
|
|
5
5
|
name: string;
|
|
6
6
|
label?: string | undefined;
|
|
7
7
|
} & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
3
|
import { DateTimeSelectorProps } from './DateTimeSelector';
|
|
4
|
-
declare const _default: import("react").ForwardRefExoticComponent<ViewProps & Omit<DateTimeSelectorProps, "
|
|
4
|
+
declare const _default: import("react").ForwardRefExoticComponent<ViewProps & Omit<DateTimeSelectorProps, "value" | "onChange" | "description" | "error"> & {
|
|
5
5
|
name: string;
|
|
6
6
|
label?: string | undefined;
|
|
7
7
|
dateLabel?: string | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<ViewProps & {
|
|
4
|
+
className?: string | undefined;
|
|
5
|
+
tw?: string | undefined;
|
|
6
|
+
baseClassName?: string | undefined;
|
|
7
|
+
baseTw?: string | undefined;
|
|
8
|
+
} & React.RefAttributes<unknown>>;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=NetworkBanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkBanner.d.ts","sourceRoot":"","sources":["../../../../src/components/NetworkBanner.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;;;;;;;AAwEzC,wBAAqC"}
|
|
@@ -28,4 +28,8 @@ export { default as FormikDateSelector } from './FormikDateSelector';
|
|
|
28
28
|
export { default as DateTimeSelector } from './DateTimeSelector';
|
|
29
29
|
export { default as FormikDateTimeSelector } from './FormikDateTimeSelector';
|
|
30
30
|
export { default as FormikDateTimeSelectorBottomSheet } from './FormikDateTimeSelectorBottomSheet';
|
|
31
|
+
export { default as NetworkBanner } from './NetworkBanner';
|
|
32
|
+
export { default as BaseErrorScreen } from './BaseErrorScreen';
|
|
33
|
+
export { default as BaseErrorBox } from './BaseErrorBox';
|
|
34
|
+
export { default as AppView } from './AppView';
|
|
31
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,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AAC;AAC7E,OAAO,EAAE,OAAO,IAAI,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACnG,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import WarningSvg from '../../assets/illustrations/warning.svg';
|
|
3
|
+
type Props = ComponentProps<typeof WarningSvg>;
|
|
4
|
+
export default function Warning(props: Props): import("react").JSX.Element;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=Warning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Warning.d.ts","sourceRoot":"","sources":["../../../../../src/components/svgs/Warning.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,UAAU,MAAM,wCAAwC,CAAC;AAEhE,KAAK,KAAK,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/C,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,KAAK,+BAI3C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './useBreakpoints';
|
|
2
2
|
export * from './useIsAboveBreakpoint';
|
|
3
|
-
export
|
|
3
|
+
export * from './useInternetConnectionStatus';
|
|
4
|
+
export * from './useTimezonedDate';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC"}
|
|
@@ -4,14 +4,14 @@ export interface InternetConnectionStatus {
|
|
|
4
4
|
lastChecked: Date | null;
|
|
5
5
|
isWeakConnection: boolean;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
8
|
-
checkInterval
|
|
9
|
-
timeout
|
|
7
|
+
export interface InternetConnectionStatusConfig {
|
|
8
|
+
checkInterval: number;
|
|
9
|
+
timeout: number;
|
|
10
10
|
checkHealth: () => Promise<{
|
|
11
11
|
ok: boolean;
|
|
12
12
|
}>;
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export declare function useInternetConnectionStatus(config?: InternetConnectionStatusConfig): {
|
|
15
15
|
isConnected: boolean | null;
|
|
16
16
|
isLoading: boolean;
|
|
17
17
|
lastChecked: Date | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInternetConnectionStatus.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useInternetConnectionStatus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useInternetConnectionStatus.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useInternetConnectionStatus.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,8BAA8B;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC7C;AAyDD,wBAAgB,2BAA2B,CAAC,MAAM,CAAC,EAAE,8BAA8B;;;;;EA+JlF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { TZDate } from '@date-fns/tz';
|
|
2
|
+
/**
|
|
3
|
+
* Hook that provides timezone-aware TZDate creation using the timezone from UIKitProvider.
|
|
4
|
+
*
|
|
5
|
+
* The returned TZDate instances work natively with all date-fns functions.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const { tz, fromWallClock } = useTimezonedDate();
|
|
9
|
+
*
|
|
10
|
+
* // Create a TZDate for current time in the configured timezone
|
|
11
|
+
* const now = tz();
|
|
12
|
+
*
|
|
13
|
+
* // Create a TZDate from an existing date
|
|
14
|
+
* const date = tz(new Date('2025-07-01T18:00:00Z'));
|
|
15
|
+
*
|
|
16
|
+
* // Use with date-fns functions
|
|
17
|
+
* import { format, startOfDay, isSameDay } from 'date-fns';
|
|
18
|
+
* console.log(format(date, 'yyyy-MM-dd HH:mm:ss zzz'));
|
|
19
|
+
* console.log(startOfDay(date));
|
|
20
|
+
*
|
|
21
|
+
* // Create a date from wall clock time
|
|
22
|
+
* const meeting = fromWallClock({
|
|
23
|
+
* year: 2025,
|
|
24
|
+
* month: 7,
|
|
25
|
+
* day: 1,
|
|
26
|
+
* hour: 14,
|
|
27
|
+
* minute: 30
|
|
28
|
+
* });
|
|
29
|
+
*/
|
|
30
|
+
export declare function useTimezonedDate(): {
|
|
31
|
+
/**
|
|
32
|
+
* Create a TZDate instance in the configured timezone.
|
|
33
|
+
*
|
|
34
|
+
* @param date - Optional date to convert. If not provided, creates current time.
|
|
35
|
+
* @returns TZDate instance that works with all date-fns functions
|
|
36
|
+
*/
|
|
37
|
+
tz: (date?: Date | string | number) => Date;
|
|
38
|
+
/**
|
|
39
|
+
* Interpret a wall-clock date/time as occurring in the configured timezone.
|
|
40
|
+
* Returns a TZDate instance.
|
|
41
|
+
*
|
|
42
|
+
* @param fields - Wall clock time components (month is 1-based)
|
|
43
|
+
* @returns TZDate instance in the configured timezone
|
|
44
|
+
*/
|
|
45
|
+
fromWallClock: (fields: {
|
|
46
|
+
year: number;
|
|
47
|
+
month: number;
|
|
48
|
+
day: number;
|
|
49
|
+
hour?: number;
|
|
50
|
+
minute?: number;
|
|
51
|
+
second?: number;
|
|
52
|
+
millisecond?: number;
|
|
53
|
+
}) => TZDate;
|
|
54
|
+
/**
|
|
55
|
+
* The current configured timezone.
|
|
56
|
+
*/
|
|
57
|
+
timezone: string;
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=useTimezonedDate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTimezonedDate.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTimezonedDate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAKtC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gBAAgB;IAI5B;;;;;OAKG;gBACS,IAAI,GAAG,MAAM,GAAG,MAAM,KAAG,IAAI;IAazC;;;;;;OAMG;4BACqB;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;IAWD;;OAEG;;EAGN"}
|
|
@@ -3,4 +3,7 @@ export { default as preset } from './preset';
|
|
|
3
3
|
export { default as foregroundColors } from './styles/foreground-colors';
|
|
4
4
|
export { default as utilityColors } from './styles/utility-colors';
|
|
5
5
|
export { default as colors } from './styles/colors';
|
|
6
|
+
export * from './hooks';
|
|
7
|
+
export * from './UIKitProvider';
|
|
8
|
+
export * from './utils';
|
|
6
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../../../src/test-setup.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../../src/utils/filters.ts"],"names":[],"mappings":"AAAA,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,KAAK,GAAG,MAAM,CA6BnE;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgB/C;AAED,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grupalia/rn-ui-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Grupalia React Native UI Kit",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/module/index.d.ts",
|
|
@@ -8,15 +8,14 @@
|
|
|
8
8
|
"lib",
|
|
9
9
|
"src/preset.ts",
|
|
10
10
|
"src/preset.cjs",
|
|
11
|
-
"src/styles"
|
|
12
|
-
"src/components",
|
|
13
|
-
"src/utils",
|
|
14
|
-
"src/hooks"
|
|
11
|
+
"src/styles"
|
|
15
12
|
],
|
|
16
13
|
"scripts": {
|
|
17
14
|
"dev": "chokidar \"src/**/*\" -c \"yarn bob build\"",
|
|
18
15
|
"build": "bob build",
|
|
19
16
|
"typecheck": "tsc --noEmit",
|
|
17
|
+
"test": "vitest",
|
|
18
|
+
"test:run": "vitest run",
|
|
20
19
|
"prepare": "bob build",
|
|
21
20
|
"publish-local": "npx yalc publish",
|
|
22
21
|
"bump-minor-version": "npm version minor --message 'chore(release): bump version'",
|
|
@@ -32,8 +31,10 @@
|
|
|
32
31
|
"@tanstack/react-query": "^5.63.0",
|
|
33
32
|
"clsx": "^2.1.1",
|
|
34
33
|
"date-fns": "^4.1.0",
|
|
34
|
+
"@date-fns/tz": "^1.3.1",
|
|
35
35
|
"expo-constants": "~16.0.1",
|
|
36
36
|
"expo-file-system": "17",
|
|
37
|
+
"expo-linear-gradient": "~13.0.2",
|
|
37
38
|
"formik": "^2",
|
|
38
39
|
"nativewind": "^2.0.11",
|
|
39
40
|
"react": "*",
|
|
@@ -46,8 +47,7 @@
|
|
|
46
47
|
"react-native-image-picker": "^7.2.3",
|
|
47
48
|
"react-native-svg": "*",
|
|
48
49
|
"react-native-vision-camera": "^4.6.3",
|
|
49
|
-
"tailwindcss": "3.3.2"
|
|
50
|
-
"expo-linear-gradient": "~13.0.2"
|
|
50
|
+
"tailwindcss": "3.3.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@babel/core": "^7.20.0",
|
|
@@ -61,9 +61,12 @@
|
|
|
61
61
|
"@types/react": "~18.2.45",
|
|
62
62
|
"@typescript-eslint/eslint-plugin": "^7.10.0",
|
|
63
63
|
"@typescript-eslint/parser": "^7.10.0",
|
|
64
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
65
|
+
"@vitest/ui": "^3.2.4",
|
|
64
66
|
"chokidar-cli": "^3.0.0",
|
|
65
67
|
"clsx": "^2.1.1",
|
|
66
68
|
"date-fns": "^4.1.0",
|
|
69
|
+
"@date-fns/tz": "^1.3.1",
|
|
67
70
|
"eslint": "^8.29.0",
|
|
68
71
|
"eslint-config-airbnb": "^19.0.4",
|
|
69
72
|
"eslint-plugin-import": "^2.29.1",
|
|
@@ -73,7 +76,9 @@
|
|
|
73
76
|
"eslint-plugin-tailwindcss": "^3.17.4",
|
|
74
77
|
"expo-constants": "~16.0.1",
|
|
75
78
|
"expo-file-system": "17",
|
|
79
|
+
"expo-linear-gradient": "~13.0.2",
|
|
76
80
|
"formik": "^2",
|
|
81
|
+
"jsdom": "^26.1.0",
|
|
77
82
|
"nativewind": "^2.0.11",
|
|
78
83
|
"react": "18.2.0",
|
|
79
84
|
"react-hot-toast": "^2.5.1",
|
|
@@ -88,7 +93,7 @@
|
|
|
88
93
|
"react-native-vision-camera": "^4.6.3",
|
|
89
94
|
"tailwindcss": "3.3.2",
|
|
90
95
|
"typescript": "~5.3.3",
|
|
91
|
-
"
|
|
96
|
+
"vitest": "^3.2.4"
|
|
92
97
|
},
|
|
93
98
|
"exports": {
|
|
94
99
|
".": {
|
|
@@ -123,7 +128,12 @@
|
|
|
123
128
|
"esm": true
|
|
124
129
|
}
|
|
125
130
|
],
|
|
126
|
-
|
|
131
|
+
[
|
|
132
|
+
"typescript",
|
|
133
|
+
{
|
|
134
|
+
"tsc": "./node_modules/.bin/tsc"
|
|
135
|
+
}
|
|
136
|
+
]
|
|
127
137
|
]
|
|
128
138
|
},
|
|
129
139
|
"eslintIgnore": [
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
import { styled } from 'nativewind';
|
|
3
|
-
import { InformationCircleIcon as OutlinedInformationCircleIcon } from 'react-native-heroicons/outline';
|
|
4
|
-
import {
|
|
5
|
-
ExclamationTriangleIcon,
|
|
6
|
-
CheckCircleIcon,
|
|
7
|
-
XCircleIcon,
|
|
8
|
-
InformationCircleIcon as SolidInformationCircleIcon,
|
|
9
|
-
} from 'react-native-heroicons/solid';
|
|
10
|
-
|
|
11
|
-
import { View } from '../hoc-components';
|
|
12
|
-
import BaseIcon from './BaseIcon';
|
|
13
|
-
import BaseText from './BaseText';
|
|
14
|
-
import { useIsAboveBreakpoint } from '../hooks/useIsAboveBreakpoint';
|
|
15
|
-
|
|
16
|
-
interface IconComponentProps {
|
|
17
|
-
type: 'error' | 'success' | 'alert' | 'brand';
|
|
18
|
-
variant?: 'primary' | 'secondary';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function IconComponent({ type, variant = 'primary' }: IconComponentProps) {
|
|
22
|
-
const iconColors = {
|
|
23
|
-
brand: {
|
|
24
|
-
primary: 'fg-white',
|
|
25
|
-
secondary: 'fg-brand-primary',
|
|
26
|
-
},
|
|
27
|
-
error: {
|
|
28
|
-
primary: 'fg-white',
|
|
29
|
-
secondary: 'fg-error-primary',
|
|
30
|
-
},
|
|
31
|
-
success: {
|
|
32
|
-
primary: 'fg-white',
|
|
33
|
-
secondary: 'fg-success-primary',
|
|
34
|
-
},
|
|
35
|
-
alert: {
|
|
36
|
-
primary: 'fg-white',
|
|
37
|
-
secondary: 'fg-warning-primary',
|
|
38
|
-
},
|
|
39
|
-
} as const;
|
|
40
|
-
|
|
41
|
-
const icons = {
|
|
42
|
-
brand: SolidInformationCircleIcon,
|
|
43
|
-
error: XCircleIcon,
|
|
44
|
-
success: CheckCircleIcon,
|
|
45
|
-
alert: ExclamationTriangleIcon,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
if (variant === 'secondary') {
|
|
49
|
-
icons.brand = OutlinedInformationCircleIcon;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<BaseIcon
|
|
54
|
-
icon={icons[type]}
|
|
55
|
-
size={18}
|
|
56
|
-
color={iconColors[type][variant]}
|
|
57
|
-
className="mr-1"
|
|
58
|
-
/>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
interface Props extends React.ComponentProps<typeof View> {
|
|
63
|
-
type: 'brand' | 'error' | 'success' | 'alert';
|
|
64
|
-
message: string;
|
|
65
|
-
description?: string;
|
|
66
|
-
variant?: 'primary' | 'secondary';
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function BaseAlert({
|
|
70
|
-
type,
|
|
71
|
-
message,
|
|
72
|
-
description,
|
|
73
|
-
variant = 'primary',
|
|
74
|
-
children,
|
|
75
|
-
...props
|
|
76
|
-
}: Props) {
|
|
77
|
-
const largePhone = useIsAboveBreakpoint('xs');
|
|
78
|
-
const alertClasses = () => {
|
|
79
|
-
if (variant === 'primary') {
|
|
80
|
-
switch (type) {
|
|
81
|
-
case 'error':
|
|
82
|
-
return 'bg-error-solid';
|
|
83
|
-
case 'success':
|
|
84
|
-
return 'bg-success-solid';
|
|
85
|
-
case 'alert':
|
|
86
|
-
return 'bg-warning-solid';
|
|
87
|
-
case 'brand':
|
|
88
|
-
default:
|
|
89
|
-
return 'bg-brand-solid';
|
|
90
|
-
}
|
|
91
|
-
} else {
|
|
92
|
-
switch (type) {
|
|
93
|
-
case 'error':
|
|
94
|
-
return 'bg-white border border-error';
|
|
95
|
-
case 'success':
|
|
96
|
-
case 'alert':
|
|
97
|
-
return 'bg-white border border-primary';
|
|
98
|
-
case 'brand':
|
|
99
|
-
default:
|
|
100
|
-
return 'bg-white border border-brand';
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const messageTextColor = () => {
|
|
106
|
-
if (variant === 'primary') {
|
|
107
|
-
return 'text-white';
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
switch (type) {
|
|
111
|
-
case 'error':
|
|
112
|
-
return 'text-error-primary';
|
|
113
|
-
case 'success':
|
|
114
|
-
return 'text-success-primary';
|
|
115
|
-
case 'alert':
|
|
116
|
-
return 'text-warning-primary';
|
|
117
|
-
case 'brand':
|
|
118
|
-
default:
|
|
119
|
-
return 'text-brand-secondary';
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const descriptionTextColor = () => {
|
|
124
|
-
if (variant === 'primary') {
|
|
125
|
-
return 'text-utility-gray-100';
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
switch (type) {
|
|
129
|
-
case 'error':
|
|
130
|
-
return 'text-error-primary';
|
|
131
|
-
case 'success':
|
|
132
|
-
return 'text-success-primary';
|
|
133
|
-
case 'alert':
|
|
134
|
-
return 'text-warning-primary';
|
|
135
|
-
case 'brand':
|
|
136
|
-
default:
|
|
137
|
-
return 'text-brand-tertiary';
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
<View
|
|
143
|
-
className={clsx(
|
|
144
|
-
'flex flex-row rounded-lg',
|
|
145
|
-
alertClasses(),
|
|
146
|
-
largePhone ? 'px-2 py-4' : 'px-1 py-2',
|
|
147
|
-
)}
|
|
148
|
-
{...props}
|
|
149
|
-
>
|
|
150
|
-
<View className="shrink-0">
|
|
151
|
-
<IconComponent
|
|
152
|
-
type={type}
|
|
153
|
-
variant={variant}
|
|
154
|
-
/>
|
|
155
|
-
</View>
|
|
156
|
-
<View className={clsx('flex flex-1 flex-col pr-2', largePhone ? 'ml-3' : 'ml-1')}>
|
|
157
|
-
<BaseText className={clsx(
|
|
158
|
-
'flex-1 font-semibold',
|
|
159
|
-
messageTextColor(),
|
|
160
|
-
largePhone ? 'text-base' : 'text-sm',
|
|
161
|
-
)}
|
|
162
|
-
>
|
|
163
|
-
{message}
|
|
164
|
-
</BaseText>
|
|
165
|
-
{description && (
|
|
166
|
-
<BaseText className={clsx(
|
|
167
|
-
'flex-1 text-sm',
|
|
168
|
-
descriptionTextColor(),
|
|
169
|
-
largePhone ? 'mt-3' : 'mt-1',
|
|
170
|
-
)}
|
|
171
|
-
>
|
|
172
|
-
{description}
|
|
173
|
-
</BaseText>
|
|
174
|
-
)}
|
|
175
|
-
{children}
|
|
176
|
-
</View>
|
|
177
|
-
</View>
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export default styled(BaseAlert);
|