@korsolutions/ui 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.d.mts +50 -2
- package/dist/components/index.mjs +177 -4
- package/dist/hooks/index.d.mts +32 -2
- package/dist/hooks/index.mjs +79 -2
- package/dist/{index-CGY0mO6z.d.mts → index-vgnXBa4Z.d.mts} +98 -10
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -2
- package/dist/primitives/index.d.mts +3 -2
- package/dist/primitives/index.mjs +3 -2
- package/dist/{primitives-P_8clvQr.mjs → primitives-ApsPS0vU.mjs} +335 -118
- package/dist/{toast-manager-DSo9oN8w.mjs → toast-manager-Cdhl1ep0.mjs} +1 -1
- package/dist/use-numeric-mask-B9WZG25o.d.mts +33 -0
- package/dist/use-numeric-mask-BQlz1Pus.mjs +113 -0
- package/dist/use-relative-position-BTKEyT1F.mjs +106 -0
- package/dist/use-relative-position-DBzhrBU7.d.mts +61 -0
- package/package.json +1 -1
- package/src/components/calendar/calendar.tsx +31 -0
- package/src/components/calendar/index.ts +1 -0
- package/src/components/calendar/variants/default.tsx +127 -0
- package/src/components/calendar/variants/index.ts +5 -0
- package/src/components/index.ts +2 -1
- package/src/components/input/index.ts +2 -0
- package/src/components/input/numeric-input.tsx +73 -0
- package/src/hooks/index.ts +4 -1
- package/src/hooks/use-currency-mask.ts +141 -0
- package/src/hooks/use-numeric-mask.ts +202 -0
- package/src/primitives/calendar/calendar-day.tsx +64 -0
- package/src/primitives/calendar/calendar-header.tsx +21 -0
- package/src/primitives/calendar/calendar-nav-button.tsx +60 -0
- package/src/primitives/calendar/calendar-root.tsx +41 -0
- package/src/primitives/calendar/calendar-title.tsx +23 -0
- package/src/primitives/calendar/calendar-week-labels.tsx +45 -0
- package/src/primitives/calendar/calendar-weeks.tsx +47 -0
- package/src/primitives/calendar/context.ts +23 -0
- package/src/primitives/calendar/index.ts +26 -0
- package/src/primitives/calendar/types.ts +39 -0
- package/src/primitives/dropdown-menu/context.ts +1 -1
- package/src/primitives/dropdown-menu/dropdown-menu-content.tsx +1 -1
- package/src/primitives/dropdown-menu/dropdown-menu-root.tsx +1 -1
- package/src/primitives/index.ts +1 -0
- package/src/primitives/popover/context.ts +1 -1
- package/src/primitives/popover/popover-content.tsx +1 -1
- package/src/primitives/popover/popover-root.tsx +1 -1
- package/src/utils/date-utils.ts +113 -0
- /package/src/hooks/{useRelativePosition.ts → use-relative-position.ts} +0 -0
- /package/src/hooks/{useScreenSize.ts → use-screen-size.ts} +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Et as InputStyles, K as AvatarStyles, L as BadgeStyles, M as TextareaPrimitiveBaseProps, P as TextareaStyles, T as DropdownMenuStyles, V as ToastStyles, Z as EmptyStyles, _ as PopoverStyles, a as CalendarStyles, ft as SelectStyles, kt as FieldStyles, rt as CardStyles, ut as SelectRootBaseProps, wt as InputPrimitiveBaseProps, x as PopoverTriggerRef, xt as ButtonStyles, yt as ButtonPrimitiveRootProps } from "../index-vgnXBa4Z.mjs";
|
|
2
|
+
import "../use-relative-position-DBzhrBU7.mjs";
|
|
3
|
+
import { t as NumericMaskFormat } from "../use-numeric-mask-B9WZG25o.mjs";
|
|
2
4
|
import React from "react";
|
|
3
5
|
import { ImageSource, PressableProps, TextProps, TextStyle } from "react-native";
|
|
4
6
|
|
|
@@ -49,6 +51,35 @@ interface InputProps extends InputPrimitiveBaseProps {
|
|
|
49
51
|
}
|
|
50
52
|
declare function Input(props: InputProps): React.JSX.Element;
|
|
51
53
|
//#endregion
|
|
54
|
+
//#region src/components/input/numeric-input.d.ts
|
|
55
|
+
interface NumericInputProps extends Omit<InputPrimitiveBaseProps, "value" | "onChange" | "keyboardType"> {
|
|
56
|
+
variant?: "default";
|
|
57
|
+
value?: number | null;
|
|
58
|
+
onChange?: (value: number | null) => void;
|
|
59
|
+
format?: NumericMaskFormat;
|
|
60
|
+
locale?: string;
|
|
61
|
+
currency?: string;
|
|
62
|
+
precision?: number;
|
|
63
|
+
min?: number;
|
|
64
|
+
max?: number;
|
|
65
|
+
allowNegative?: boolean;
|
|
66
|
+
}
|
|
67
|
+
declare function NumericInput({
|
|
68
|
+
value,
|
|
69
|
+
onChange,
|
|
70
|
+
format,
|
|
71
|
+
locale,
|
|
72
|
+
currency,
|
|
73
|
+
precision,
|
|
74
|
+
min,
|
|
75
|
+
max,
|
|
76
|
+
allowNegative,
|
|
77
|
+
variant,
|
|
78
|
+
onBlur,
|
|
79
|
+
onFocus,
|
|
80
|
+
...props
|
|
81
|
+
}: NumericInputProps): React.JSX.Element;
|
|
82
|
+
//#endregion
|
|
52
83
|
//#region src/components/field/variants/index.d.ts
|
|
53
84
|
declare const FieldVariants: {
|
|
54
85
|
default: () => FieldStyles;
|
|
@@ -262,4 +293,21 @@ interface PopoverProps {
|
|
|
262
293
|
}
|
|
263
294
|
declare const Popover: React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<PopoverTriggerRef>>;
|
|
264
295
|
//#endregion
|
|
265
|
-
|
|
296
|
+
//#region src/components/calendar/variants/index.d.ts
|
|
297
|
+
declare const CalendarVariants: {
|
|
298
|
+
default: () => CalendarStyles;
|
|
299
|
+
};
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/components/calendar/calendar.d.ts
|
|
302
|
+
interface CalendarProps {
|
|
303
|
+
value?: Date;
|
|
304
|
+
onChange?: (date: Date | undefined) => void;
|
|
305
|
+
defaultMonth?: Date;
|
|
306
|
+
minDate?: Date;
|
|
307
|
+
maxDate?: Date;
|
|
308
|
+
variant?: keyof typeof CalendarVariants;
|
|
309
|
+
weekDays?: string[];
|
|
310
|
+
}
|
|
311
|
+
declare function Calendar(props: CalendarProps): React.JSX.Element;
|
|
312
|
+
//#endregion
|
|
313
|
+
export { Avatar, AvatarProps, Badge, Button, Calendar, CalendarProps, Card, DropdownMenu, Empty, EmptyProps, Field, FieldProps, Input, Link, LinkProps, NumericInput, NumericInputProps, Popover, PopoverProps, Select, SelectOption, SelectProps, Textarea, Toast, Typography, TypographyProps };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { i as useThemedStyles, r as ToastComponent, t as ToastAPI } from "../toast-manager-
|
|
2
|
-
import { a as
|
|
3
|
-
import
|
|
1
|
+
import { i as useThemedStyles, r as ToastComponent, t as ToastAPI } from "../toast-manager-Cdhl1ep0.mjs";
|
|
2
|
+
import { a as TextareaPrimitive, c as AvatarPrimitive, d as SelectPrimitive, f as ButtonPrimitive, i as DropdownMenuPrimitive, l as EmptyPrimitive, m as FieldPrimitive, n as PopoverPrimitive, o as BadgePrimitive, p as InputPrimitive, r as usePopover, t as CalendarPrimitive, u as CardPrimitive } from "../primitives-ApsPS0vU.mjs";
|
|
3
|
+
import "../use-relative-position-BTKEyT1F.mjs";
|
|
4
|
+
import { t as useNumericMask } from "../use-numeric-mask-BQlz1Pus.mjs";
|
|
5
|
+
import React, { forwardRef, useEffect, useState } from "react";
|
|
4
6
|
import { Linking, Text } from "react-native";
|
|
5
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
8
|
|
|
@@ -205,6 +207,41 @@ function Input(props) {
|
|
|
205
207
|
});
|
|
206
208
|
}
|
|
207
209
|
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/components/input/numeric-input.tsx
|
|
212
|
+
function NumericInput({ value, onChange, format = "decimal", locale = "en-US", currency = "USD", precision = 2, min, max, allowNegative = true, variant = "default", onBlur, onFocus, ...props }) {
|
|
213
|
+
const numericMask = useNumericMask({
|
|
214
|
+
format,
|
|
215
|
+
locale,
|
|
216
|
+
currency,
|
|
217
|
+
precision,
|
|
218
|
+
min,
|
|
219
|
+
max,
|
|
220
|
+
allowNegative,
|
|
221
|
+
onChange
|
|
222
|
+
});
|
|
223
|
+
useEffect(() => {
|
|
224
|
+
if (value !== numericMask.numericValue) numericMask.setValue(value ?? null);
|
|
225
|
+
}, [value]);
|
|
226
|
+
const handleBlur = (e) => {
|
|
227
|
+
numericMask.onBlur();
|
|
228
|
+
onBlur?.(e);
|
|
229
|
+
};
|
|
230
|
+
const handleFocus = (e) => {
|
|
231
|
+
numericMask.onFocus();
|
|
232
|
+
onFocus?.(e);
|
|
233
|
+
};
|
|
234
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
235
|
+
...props,
|
|
236
|
+
variant,
|
|
237
|
+
value: numericMask.value,
|
|
238
|
+
onChange: numericMask.onChangeText,
|
|
239
|
+
onBlur: handleBlur,
|
|
240
|
+
onFocus: handleFocus,
|
|
241
|
+
keyboardType: numericMask.keyboardType
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
208
245
|
//#endregion
|
|
209
246
|
//#region src/components/field/variants/default.tsx
|
|
210
247
|
const useFieldVariantDefault = () => {
|
|
@@ -790,4 +827,140 @@ PopoverComponent.displayName = "Popover";
|
|
|
790
827
|
const Popover = PopoverComponent;
|
|
791
828
|
|
|
792
829
|
//#endregion
|
|
793
|
-
|
|
830
|
+
//#region src/components/calendar/variants/default.tsx
|
|
831
|
+
const useCalendarVariantDefault = () => {
|
|
832
|
+
return useThemedStyles(({ colors, radius, fontFamily, fontSize }) => ({
|
|
833
|
+
root: {
|
|
834
|
+
padding: 16,
|
|
835
|
+
backgroundColor: colors.background,
|
|
836
|
+
borderRadius: radius,
|
|
837
|
+
borderWidth: 1,
|
|
838
|
+
borderColor: colors.border,
|
|
839
|
+
width: 324
|
|
840
|
+
},
|
|
841
|
+
header: {
|
|
842
|
+
flexDirection: "row",
|
|
843
|
+
justifyContent: "space-between",
|
|
844
|
+
alignItems: "center",
|
|
845
|
+
marginBottom: 16,
|
|
846
|
+
paddingHorizontal: 8
|
|
847
|
+
},
|
|
848
|
+
headerTitle: {
|
|
849
|
+
fontSize: fontSize * 1.125,
|
|
850
|
+
fontWeight: "600",
|
|
851
|
+
fontFamily,
|
|
852
|
+
color: colors.foreground
|
|
853
|
+
},
|
|
854
|
+
navButton: {
|
|
855
|
+
default: {
|
|
856
|
+
width: 32,
|
|
857
|
+
height: 32,
|
|
858
|
+
borderRadius: radius * .5,
|
|
859
|
+
alignItems: "center",
|
|
860
|
+
justifyContent: "center",
|
|
861
|
+
backgroundColor: "transparent"
|
|
862
|
+
},
|
|
863
|
+
disabled: { opacity: .3 }
|
|
864
|
+
},
|
|
865
|
+
navButtonText: {
|
|
866
|
+
default: {
|
|
867
|
+
fontSize: fontSize * 1.5,
|
|
868
|
+
color: colors.foreground,
|
|
869
|
+
fontWeight: "500"
|
|
870
|
+
},
|
|
871
|
+
disabled: { color: colors.mutedForeground }
|
|
872
|
+
},
|
|
873
|
+
weekLabels: {
|
|
874
|
+
flexDirection: "row",
|
|
875
|
+
justifyContent: "space-between",
|
|
876
|
+
marginBottom: 8,
|
|
877
|
+
paddingVertical: 8,
|
|
878
|
+
gap: 2
|
|
879
|
+
},
|
|
880
|
+
weekLabel: {
|
|
881
|
+
fontSize: fontSize * .875,
|
|
882
|
+
fontWeight: "500",
|
|
883
|
+
fontFamily,
|
|
884
|
+
color: colors.mutedForeground,
|
|
885
|
+
width: 40,
|
|
886
|
+
textAlign: "center"
|
|
887
|
+
},
|
|
888
|
+
weeks: {
|
|
889
|
+
flexDirection: "column",
|
|
890
|
+
gap: 2
|
|
891
|
+
},
|
|
892
|
+
week: {
|
|
893
|
+
flexDirection: "row",
|
|
894
|
+
justifyContent: "space-between",
|
|
895
|
+
gap: 2
|
|
896
|
+
},
|
|
897
|
+
dayButton: {
|
|
898
|
+
default: {
|
|
899
|
+
width: 40,
|
|
900
|
+
height: 40,
|
|
901
|
+
borderRadius: radius * .5,
|
|
902
|
+
alignItems: "center",
|
|
903
|
+
justifyContent: "center",
|
|
904
|
+
backgroundColor: "transparent"
|
|
905
|
+
},
|
|
906
|
+
selected: { backgroundColor: colors.primary },
|
|
907
|
+
today: {
|
|
908
|
+
borderWidth: 1,
|
|
909
|
+
borderColor: colors.primary
|
|
910
|
+
},
|
|
911
|
+
disabled: { opacity: .3 },
|
|
912
|
+
deprioritized: { backgroundColor: "transparent" },
|
|
913
|
+
hovered: { backgroundColor: colors.muted }
|
|
914
|
+
},
|
|
915
|
+
dayText: {
|
|
916
|
+
default: {
|
|
917
|
+
fontSize,
|
|
918
|
+
fontFamily,
|
|
919
|
+
color: colors.foreground,
|
|
920
|
+
fontWeight: "400",
|
|
921
|
+
pointerEvents: "none"
|
|
922
|
+
},
|
|
923
|
+
selected: {
|
|
924
|
+
color: colors.primaryForeground,
|
|
925
|
+
fontWeight: "600"
|
|
926
|
+
},
|
|
927
|
+
today: {
|
|
928
|
+
color: colors.primary,
|
|
929
|
+
fontWeight: "600"
|
|
930
|
+
},
|
|
931
|
+
disabled: { color: colors.mutedForeground },
|
|
932
|
+
deprioritized: {
|
|
933
|
+
color: colors.mutedForeground,
|
|
934
|
+
opacity: .5
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
}));
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
//#endregion
|
|
941
|
+
//#region src/components/calendar/variants/index.ts
|
|
942
|
+
const CalendarVariants = { default: useCalendarVariantDefault };
|
|
943
|
+
|
|
944
|
+
//#endregion
|
|
945
|
+
//#region src/components/calendar/calendar.tsx
|
|
946
|
+
function Calendar(props) {
|
|
947
|
+
const { variant = "default", weekDays, ...rootProps } = props;
|
|
948
|
+
const useVariantStyles = CalendarVariants[variant];
|
|
949
|
+
const variantStyles = useVariantStyles();
|
|
950
|
+
return /* @__PURE__ */ jsxs(CalendarPrimitive.Root, {
|
|
951
|
+
...rootProps,
|
|
952
|
+
styles: variantStyles,
|
|
953
|
+
children: [
|
|
954
|
+
/* @__PURE__ */ jsxs(CalendarPrimitive.Header, { children: [
|
|
955
|
+
/* @__PURE__ */ jsx(CalendarPrimitive.NavButton, { direction: "prev" }),
|
|
956
|
+
/* @__PURE__ */ jsx(CalendarPrimitive.Title, {}),
|
|
957
|
+
/* @__PURE__ */ jsx(CalendarPrimitive.NavButton, { direction: "next" })
|
|
958
|
+
] }),
|
|
959
|
+
/* @__PURE__ */ jsx(CalendarPrimitive.CalendarWeekLabels, { weekDays }),
|
|
960
|
+
/* @__PURE__ */ jsx(CalendarPrimitive.Weeks, {})
|
|
961
|
+
]
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
//#endregion
|
|
966
|
+
export { Avatar, Badge, Button, Calendar, Card, DropdownMenu, Empty, Field, Input, Link, NumericInput, Popover, Select, Textarea, Toast, Typography };
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { i as useRelativePosition, n as DEFAULT_POSITION, r as LayoutPosition, t as DEFAULT_LAYOUT } from "../use-relative-position-DBzhrBU7.mjs";
|
|
2
|
+
import { i as useNumericMask, n as UseNumericMaskOptions, r as UseNumericMaskReturn, t as NumericMaskFormat } from "../use-numeric-mask-B9WZG25o.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/hooks/use-screen-size.d.ts
|
|
2
5
|
type ScreenSize = "mobile" | "tablet" | "desktop";
|
|
3
6
|
interface Response {
|
|
4
7
|
readonly size: ScreenSize;
|
|
@@ -14,4 +17,31 @@ interface Response {
|
|
|
14
17
|
}
|
|
15
18
|
declare function useScreenSize(): Response;
|
|
16
19
|
//#endregion
|
|
17
|
-
|
|
20
|
+
//#region src/hooks/use-currency-mask.d.ts
|
|
21
|
+
interface UseCurrencyMaskOptions {
|
|
22
|
+
locale?: string;
|
|
23
|
+
currency?: string;
|
|
24
|
+
precision?: number;
|
|
25
|
+
min?: number;
|
|
26
|
+
max?: number;
|
|
27
|
+
onValueChange?: (value: number | null) => void;
|
|
28
|
+
}
|
|
29
|
+
interface UseCurrencyMaskReturn {
|
|
30
|
+
value: string;
|
|
31
|
+
numericValue: number | null;
|
|
32
|
+
onChangeText: (text: string) => void;
|
|
33
|
+
onBlur: () => void;
|
|
34
|
+
onFocus: () => void;
|
|
35
|
+
keyboardType: "decimal-pad";
|
|
36
|
+
setValue: (value: number | null) => void;
|
|
37
|
+
}
|
|
38
|
+
declare function useCurrencyMask({
|
|
39
|
+
locale,
|
|
40
|
+
currency,
|
|
41
|
+
precision,
|
|
42
|
+
min,
|
|
43
|
+
max,
|
|
44
|
+
onValueChange
|
|
45
|
+
}?: UseCurrencyMaskOptions): UseCurrencyMaskReturn;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { DEFAULT_LAYOUT, DEFAULT_POSITION, LayoutPosition, NumericMaskFormat, ScreenSize, UseCurrencyMaskOptions, UseCurrencyMaskReturn, UseNumericMaskOptions, UseNumericMaskReturn, useCurrencyMask, useNumericMask, useRelativePosition, useScreenSize };
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { n as DEFAULT_POSITION, r as useRelativePosition, t as DEFAULT_LAYOUT } from "../use-relative-position-BTKEyT1F.mjs";
|
|
2
|
+
import { t as useNumericMask } from "../use-numeric-mask-BQlz1Pus.mjs";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
1
4
|
import { useWindowDimensions } from "react-native";
|
|
2
5
|
|
|
3
|
-
//#region src/hooks/
|
|
6
|
+
//#region src/hooks/use-screen-size.ts
|
|
4
7
|
function useScreenSize() {
|
|
5
8
|
const windowDimensions = useWindowDimensions();
|
|
6
9
|
const size = windowDimensions.width < 768 ? "mobile" : windowDimensions.width < 1024 ? "tablet" : "desktop";
|
|
@@ -23,4 +26,78 @@ function useScreenSize() {
|
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
//#endregion
|
|
26
|
-
|
|
29
|
+
//#region src/hooks/use-currency-mask.ts
|
|
30
|
+
function useCurrencyMask({ locale = "en-US", currency = "USD", precision = 2, min, max, onValueChange } = {}) {
|
|
31
|
+
const [numericValue, setNumericValue] = useState(null);
|
|
32
|
+
const [displayValue, setDisplayValue] = useState("");
|
|
33
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
34
|
+
const formatCurrency = useCallback((num) => {
|
|
35
|
+
if (num === null || isNaN(num)) return "";
|
|
36
|
+
return new Intl.NumberFormat(locale, {
|
|
37
|
+
style: "currency",
|
|
38
|
+
currency,
|
|
39
|
+
minimumFractionDigits: precision,
|
|
40
|
+
maximumFractionDigits: precision
|
|
41
|
+
}).format(num);
|
|
42
|
+
}, [
|
|
43
|
+
locale,
|
|
44
|
+
currency,
|
|
45
|
+
precision
|
|
46
|
+
]);
|
|
47
|
+
const parseCurrency = useCallback((text) => {
|
|
48
|
+
const cleaned = text.replace(/[^\d.-]/g, "");
|
|
49
|
+
const parsed = parseFloat(cleaned);
|
|
50
|
+
if (isNaN(parsed) || cleaned === "") return null;
|
|
51
|
+
let constrained = parsed;
|
|
52
|
+
if (min !== void 0 && constrained < min) constrained = min;
|
|
53
|
+
if (max !== void 0 && constrained > max) constrained = max;
|
|
54
|
+
return constrained;
|
|
55
|
+
}, [min, max]);
|
|
56
|
+
return {
|
|
57
|
+
value: displayValue,
|
|
58
|
+
numericValue,
|
|
59
|
+
onChangeText: useCallback((text) => {
|
|
60
|
+
if (isFocused) {
|
|
61
|
+
const cleaned = text.replace(/[^\d.-]/g, "");
|
|
62
|
+
const decimalIndex = cleaned.indexOf(".");
|
|
63
|
+
if (decimalIndex !== -1) {
|
|
64
|
+
if (cleaned.substring(decimalIndex + 1).length > precision) return;
|
|
65
|
+
}
|
|
66
|
+
if ((cleaned.match(/\./g) || []).length > 1) return;
|
|
67
|
+
}
|
|
68
|
+
setDisplayValue(text);
|
|
69
|
+
const value = parseCurrency(text);
|
|
70
|
+
setNumericValue(value);
|
|
71
|
+
onValueChange?.(value);
|
|
72
|
+
}, [
|
|
73
|
+
parseCurrency,
|
|
74
|
+
onValueChange,
|
|
75
|
+
isFocused,
|
|
76
|
+
precision
|
|
77
|
+
]),
|
|
78
|
+
onBlur: useCallback(() => {
|
|
79
|
+
setIsFocused(false);
|
|
80
|
+
if (numericValue !== null) setDisplayValue(formatCurrency(numericValue));
|
|
81
|
+
else setDisplayValue("");
|
|
82
|
+
}, [numericValue, formatCurrency]),
|
|
83
|
+
onFocus: useCallback(() => {
|
|
84
|
+
setIsFocused(true);
|
|
85
|
+
if (numericValue !== null) setDisplayValue(numericValue.toString());
|
|
86
|
+
}, [numericValue]),
|
|
87
|
+
keyboardType: "decimal-pad",
|
|
88
|
+
setValue: useCallback((value) => {
|
|
89
|
+
setNumericValue(value);
|
|
90
|
+
if (value !== null) if (isFocused) setDisplayValue(value.toString());
|
|
91
|
+
else setDisplayValue(formatCurrency(value));
|
|
92
|
+
else setDisplayValue("");
|
|
93
|
+
onValueChange?.(value);
|
|
94
|
+
}, [
|
|
95
|
+
isFocused,
|
|
96
|
+
formatCurrency,
|
|
97
|
+
onValueChange
|
|
98
|
+
])
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
export { DEFAULT_LAYOUT, DEFAULT_POSITION, useCurrencyMask, useNumericMask, useRelativePosition, useScreenSize };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { r as LayoutPosition } from "./use-relative-position-DBzhrBU7.mjs";
|
|
1
2
|
import * as react7 from "react";
|
|
2
3
|
import React$1, { Dispatch, RefAttributes } from "react";
|
|
3
|
-
import { ImageSource, ImageStyle, LayoutRectangle, PressableProps, StyleProp, TextInputProps, TextProps, TextStyle, View, ViewStyle } from "react-native";
|
|
4
|
+
import { ImageSource, ImageStyle, LayoutRectangle, PressableProps, StyleProp, TextInputProps, TextProps, TextStyle, View, ViewProps, ViewStyle } from "react-native";
|
|
4
5
|
|
|
5
6
|
//#region src/primitives/field/field-label.d.ts
|
|
6
7
|
interface FieldLabelProps {
|
|
@@ -567,14 +568,6 @@ interface PopoverCloseProps extends Omit<PressableProps, "onPress"> {
|
|
|
567
568
|
}
|
|
568
569
|
declare function PopoverClose(props: PopoverCloseProps): React$1.JSX.Element;
|
|
569
570
|
//#endregion
|
|
570
|
-
//#region src/hooks/useRelativePosition.d.ts
|
|
571
|
-
interface LayoutPosition {
|
|
572
|
-
pageY: number;
|
|
573
|
-
pageX: number;
|
|
574
|
-
width: number;
|
|
575
|
-
height: number;
|
|
576
|
-
}
|
|
577
|
-
//#endregion
|
|
578
571
|
//#region src/primitives/popover/context.d.ts
|
|
579
572
|
interface PopoverContext {
|
|
580
573
|
isOpen: boolean;
|
|
@@ -598,4 +591,99 @@ declare const PopoverPrimitive: {
|
|
|
598
591
|
Close: typeof PopoverClose;
|
|
599
592
|
};
|
|
600
593
|
//#endregion
|
|
601
|
-
|
|
594
|
+
//#region src/primitives/calendar/calendar-weeks.d.ts
|
|
595
|
+
interface CalendarWeekProps extends ViewProps {
|
|
596
|
+
index: number;
|
|
597
|
+
style?: StyleProp<ViewStyle>;
|
|
598
|
+
}
|
|
599
|
+
interface CalendarWeeksProps extends ViewProps {
|
|
600
|
+
style?: StyleProp<ViewStyle>;
|
|
601
|
+
}
|
|
602
|
+
declare function CalendarWeeks(props: CalendarWeeksProps): React$1.JSX.Element;
|
|
603
|
+
//#endregion
|
|
604
|
+
//#region src/primitives/calendar/calendar-week-labels.d.ts
|
|
605
|
+
interface CalendarWeekLabelProps {
|
|
606
|
+
children: string;
|
|
607
|
+
style?: StyleProp<TextStyle>;
|
|
608
|
+
}
|
|
609
|
+
interface CalendarWeekLabelsProps {
|
|
610
|
+
weekDays?: string[];
|
|
611
|
+
style?: StyleProp<ViewStyle>;
|
|
612
|
+
}
|
|
613
|
+
declare function CalendarWeekLabels(props: CalendarWeekLabelsProps): React$1.JSX.Element;
|
|
614
|
+
//#endregion
|
|
615
|
+
//#region src/primitives/calendar/calendar-day.d.ts
|
|
616
|
+
interface CalendarDayProps {
|
|
617
|
+
date: Date;
|
|
618
|
+
onPress?: () => void;
|
|
619
|
+
style?: StyleProp<ViewStyle>;
|
|
620
|
+
textStyle?: StyleProp<TextStyle>;
|
|
621
|
+
}
|
|
622
|
+
declare function CalendarDay(props: CalendarDayProps): React$1.JSX.Element;
|
|
623
|
+
//#endregion
|
|
624
|
+
//#region src/primitives/calendar/calendar-header.d.ts
|
|
625
|
+
interface CalendarHeaderProps extends ViewProps {
|
|
626
|
+
children?: React$1.ReactNode;
|
|
627
|
+
style?: StyleProp<ViewStyle>;
|
|
628
|
+
}
|
|
629
|
+
declare function CalendarHeader(props: CalendarHeaderProps): React$1.JSX.Element;
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region src/primitives/calendar/calendar-title.d.ts
|
|
632
|
+
interface CalendarTitleProps extends TextProps {
|
|
633
|
+
children?: React$1.ReactNode;
|
|
634
|
+
style?: StyleProp<TextStyle>;
|
|
635
|
+
formatStr?: string;
|
|
636
|
+
}
|
|
637
|
+
declare function CalendarTitle(props: CalendarTitleProps): React$1.JSX.Element;
|
|
638
|
+
//#endregion
|
|
639
|
+
//#region src/primitives/calendar/types.d.ts
|
|
640
|
+
type CalendarDayState = "default" | "selected" | "today" | "disabled" | "deprioritized" | "hovered";
|
|
641
|
+
type CalendarNavButtonState = "default" | "disabled" | "hovered";
|
|
642
|
+
interface CalendarStyles {
|
|
643
|
+
root?: CalendarRootProps["style"];
|
|
644
|
+
header?: CalendarHeaderProps["style"];
|
|
645
|
+
headerTitle?: CalendarTitleProps["style"];
|
|
646
|
+
navButton?: Partial<Record<CalendarNavButtonState, ViewStyle>>;
|
|
647
|
+
navButtonText?: Partial<Record<CalendarNavButtonState, TextStyle>>;
|
|
648
|
+
weekLabels: CalendarWeekLabelsProps["style"];
|
|
649
|
+
weekLabel?: CalendarWeekLabelProps["style"];
|
|
650
|
+
weeks?: CalendarWeekProps["style"];
|
|
651
|
+
week?: CalendarWeeksProps["style"];
|
|
652
|
+
dayButton?: Partial<Record<CalendarDayState, CalendarDayProps["style"]>>;
|
|
653
|
+
dayText?: Partial<Record<CalendarDayState, CalendarDayProps["textStyle"]>>;
|
|
654
|
+
}
|
|
655
|
+
//#endregion
|
|
656
|
+
//#region src/primitives/calendar/calendar-root.d.ts
|
|
657
|
+
interface CalendarRootProps {
|
|
658
|
+
children?: React$1.ReactNode;
|
|
659
|
+
value?: Date;
|
|
660
|
+
onChange?: (date: Date | undefined) => void;
|
|
661
|
+
defaultMonth?: Date;
|
|
662
|
+
minDate?: Date;
|
|
663
|
+
maxDate?: Date;
|
|
664
|
+
style?: StyleProp<ViewStyle>;
|
|
665
|
+
styles?: CalendarStyles;
|
|
666
|
+
}
|
|
667
|
+
declare function CalendarRoot(props: CalendarRootProps): React$1.JSX.Element;
|
|
668
|
+
//#endregion
|
|
669
|
+
//#region src/primitives/calendar/calendar-nav-button.d.ts
|
|
670
|
+
interface CalendarNavButtonProps extends PressableProps {
|
|
671
|
+
children?: React$1.ReactNode;
|
|
672
|
+
direction: "prev" | "next";
|
|
673
|
+
style?: StyleProp<ViewStyle>;
|
|
674
|
+
textStyle?: StyleProp<TextStyle>;
|
|
675
|
+
}
|
|
676
|
+
declare function CalendarNavButton(props: CalendarNavButtonProps): React$1.JSX.Element;
|
|
677
|
+
//#endregion
|
|
678
|
+
//#region src/primitives/calendar/index.d.ts
|
|
679
|
+
declare const CalendarPrimitive: {
|
|
680
|
+
Root: typeof CalendarRoot;
|
|
681
|
+
Header: typeof CalendarHeader;
|
|
682
|
+
Title: typeof CalendarTitle;
|
|
683
|
+
NavButton: typeof CalendarNavButton;
|
|
684
|
+
CalendarWeekLabels: typeof CalendarWeekLabels;
|
|
685
|
+
Weeks: typeof CalendarWeeks;
|
|
686
|
+
Day: typeof CalendarDay;
|
|
687
|
+
};
|
|
688
|
+
//#endregion
|
|
689
|
+
export { EmptyMediaProps as $, DropdownMenuTriggerProps as A, FieldErrorProps as At, ToastRootProps as B, DropdownMenuPortalProps as C, InputPrimitive as Ct, DropdownMenuDividerProps as D, FieldPrimitive as Dt, DropdownMenuOverlayProps as E, InputStyles as Et, BadgePrimitive as F, AvatarRootProps as G, ToastDescriptionProps as H, BadgeRootProps as I, AvatarFallbackProps as J, AvatarStyles as K, BadgeStyles as L, TextareaPrimitiveBaseProps as M, FieldLabelProps as Mt, TextareaPrimitiveProps as N, DropdownMenuButtonProps as O, FieldPrimitiveRootProps as Ot, TextareaStyles as P, EmptyTitleProps as Q, BadgeLabelProps as R, DropdownMenuPrimitive as S, ButtonPrimitiveLabelProps as St, DropdownMenuStyles as T, InputPrimitiveProps as Tt, ToastTitleProps as U, ToastStyles as V, AvatarPrimitive as W, EmptyRootProps as X, EmptyPrimitive as Y, EmptyStyles as Z, PopoverStyles as _, SelectTriggerProps as _t, CalendarStyles as a, CardBodyProps as at, PopoverTriggerProps as b, ButtonState as bt, CalendarDayProps as c, SelectPrimitive as ct, PopoverPrimitive as d, SelectRootProps as dt, EmptyDescriptionProps as et, PopoverContext as f, SelectStyles as ft, PopoverRootProps as g, SelectValueProps as gt, PopoverPortalProps as h, SelectOverlayProps as ht, CalendarDayState as i, CardFooterProps as it, TextareaPrimitive as j, FieldDescriptionProps as jt, DropdownMenuContentProps as k, FieldStyles as kt, CalendarWeekLabelsProps as l, SelectPortalProps as lt, PopoverCloseProps as m, SelectContentProps as mt, CalendarNavButtonProps as n, CardRootProps as nt, CalendarTitleProps as o, CardTitleProps as ot, usePopover as p, SelectOptionProps as pt, AvatarImageProps as q, CalendarRootProps as r, CardStyles as rt, CalendarHeaderProps as s, CardHeaderProps as st, CalendarPrimitive as t, CardPrimitive as tt, CalendarWeeksProps as u, SelectRootBaseProps as ut, PopoverOverlayProps as v, ButtonPrimitive as vt, DropdownMenuRootProps as w, InputPrimitiveBaseProps as wt, PopoverTriggerRef as x, ButtonStyles as xt, PopoverContentProps as y, ButtonPrimitiveRootProps as yt, ToastPrimitive as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react5 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/themes/types.d.ts
|
|
4
4
|
type ThemeName = "default";
|
|
@@ -37,7 +37,7 @@ interface ThemeContext {
|
|
|
37
37
|
setTheme: (themeName: ThemeName) => void;
|
|
38
38
|
themeName: ThemeName;
|
|
39
39
|
}
|
|
40
|
-
declare const ThemeContext:
|
|
40
|
+
declare const ThemeContext: react5.Context<ThemeContext | null>;
|
|
41
41
|
declare const useTheme: () => ThemeContext;
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/index.d.ts
|
|
@@ -45,6 +45,6 @@ declare const UniversalUIProvider: ({
|
|
|
45
45
|
children
|
|
46
46
|
}: {
|
|
47
47
|
children: React.ReactNode;
|
|
48
|
-
}) =>
|
|
48
|
+
}) => react5.JSX.Element;
|
|
49
49
|
//#endregion
|
|
50
50
|
export { UniversalUIProvider, useTheme };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { a as ThemeProvider, n as ToastContainer, o as useTheme } from "./toast-manager-
|
|
2
|
-
import {
|
|
1
|
+
import { a as ThemeProvider, n as ToastContainer, o as useTheme } from "./toast-manager-Cdhl1ep0.mjs";
|
|
2
|
+
import { h as PortalHost } from "./primitives-ApsPS0vU.mjs";
|
|
3
|
+
import "./use-relative-position-BTKEyT1F.mjs";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
|
|
5
6
|
//#region src/index.tsx
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
|
|
1
|
+
import { $ as EmptyMediaProps, A as DropdownMenuTriggerProps, At as FieldErrorProps, B as ToastRootProps, C as DropdownMenuPortalProps, Ct as InputPrimitive, D as DropdownMenuDividerProps, Dt as FieldPrimitive, E as DropdownMenuOverlayProps, Et as InputStyles, F as BadgePrimitive, G as AvatarRootProps, H as ToastDescriptionProps, I as BadgeRootProps, J as AvatarFallbackProps, K as AvatarStyles, L as BadgeStyles, M as TextareaPrimitiveBaseProps, Mt as FieldLabelProps, N as TextareaPrimitiveProps, O as DropdownMenuButtonProps, Ot as FieldPrimitiveRootProps, P as TextareaStyles, Q as EmptyTitleProps, R as BadgeLabelProps, S as DropdownMenuPrimitive, St as ButtonPrimitiveLabelProps, T as DropdownMenuStyles, Tt as InputPrimitiveProps, U as ToastTitleProps, V as ToastStyles, W as AvatarPrimitive, X as EmptyRootProps, Y as EmptyPrimitive, Z as EmptyStyles, _t as SelectTriggerProps, a as CalendarStyles, at as CardBodyProps, b as PopoverTriggerProps, bt as ButtonState, c as CalendarDayProps, ct as SelectPrimitive, d as PopoverPrimitive, dt as SelectRootProps, et as EmptyDescriptionProps, f as PopoverContext, ft as SelectStyles, g as PopoverRootProps, gt as SelectValueProps, h as PopoverPortalProps, ht as SelectOverlayProps, i as CalendarDayState, it as CardFooterProps, j as TextareaPrimitive, jt as FieldDescriptionProps, k as DropdownMenuContentProps, kt as FieldStyles, l as CalendarWeekLabelsProps, lt as SelectPortalProps, m as PopoverCloseProps, mt as SelectContentProps, n as CalendarNavButtonProps, nt as CardRootProps, o as CalendarTitleProps, ot as CardTitleProps, p as usePopover, pt as SelectOptionProps, q as AvatarImageProps, r as CalendarRootProps, rt as CardStyles, s as CalendarHeaderProps, st as CardHeaderProps, t as CalendarPrimitive, tt as CardPrimitive, u as CalendarWeeksProps, ut as SelectRootBaseProps, v as PopoverOverlayProps, vt as ButtonPrimitive, w as DropdownMenuRootProps, wt as InputPrimitiveBaseProps, x as PopoverTriggerRef, xt as ButtonStyles, y as PopoverContentProps, yt as ButtonPrimitiveRootProps, z as ToastPrimitive } from "../index-vgnXBa4Z.mjs";
|
|
2
|
+
import "../use-relative-position-DBzhrBU7.mjs";
|
|
3
|
+
export { AvatarFallbackProps, AvatarImageProps, AvatarPrimitive, AvatarRootProps, AvatarStyles, BadgeLabelProps, BadgePrimitive, BadgeRootProps, BadgeStyles, ButtonPrimitive, ButtonPrimitiveLabelProps, ButtonPrimitiveRootProps, ButtonState, ButtonStyles, CalendarDayProps, CalendarDayState, CalendarHeaderProps, CalendarNavButtonProps, CalendarPrimitive, CalendarRootProps, CalendarStyles, CalendarTitleProps, CalendarWeekLabelsProps, CalendarWeeksProps, CardBodyProps, CardFooterProps, CardHeaderProps, CardPrimitive, CardRootProps, CardStyles, CardTitleProps, DropdownMenuButtonProps, DropdownMenuContentProps, DropdownMenuDividerProps, DropdownMenuOverlayProps, DropdownMenuPortalProps, DropdownMenuPrimitive, DropdownMenuRootProps, DropdownMenuStyles, DropdownMenuTriggerProps, EmptyDescriptionProps, EmptyMediaProps, EmptyPrimitive, EmptyRootProps, EmptyStyles, EmptyTitleProps, FieldDescriptionProps, FieldErrorProps, FieldLabelProps, FieldPrimitive, FieldPrimitiveRootProps, FieldStyles, InputPrimitive, InputPrimitiveBaseProps, InputPrimitiveProps, InputStyles, PopoverCloseProps, PopoverContentProps, PopoverContext, PopoverOverlayProps, PopoverPortalProps, PopoverPrimitive, PopoverRootProps, PopoverTriggerProps, PopoverTriggerRef, SelectContentProps, SelectOptionProps, SelectOverlayProps, SelectPortalProps, SelectPrimitive, SelectRootBaseProps, SelectRootProps, SelectStyles, SelectTriggerProps, SelectValueProps, TextareaPrimitive, TextareaPrimitiveBaseProps, TextareaPrimitiveProps, TextareaStyles, ToastDescriptionProps, ToastPrimitive, ToastRootProps, ToastStyles, ToastTitleProps, usePopover };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as TextareaPrimitive, c as AvatarPrimitive, d as SelectPrimitive, f as ButtonPrimitive, i as DropdownMenuPrimitive, l as EmptyPrimitive, m as FieldPrimitive, n as PopoverPrimitive, o as BadgePrimitive, p as InputPrimitive, r as usePopover, s as ToastPrimitive, t as CalendarPrimitive, u as CardPrimitive } from "../primitives-ApsPS0vU.mjs";
|
|
2
|
+
import "../use-relative-position-BTKEyT1F.mjs";
|
|
2
3
|
|
|
3
|
-
export { AvatarPrimitive, BadgePrimitive, ButtonPrimitive, CardPrimitive, DropdownMenuPrimitive, EmptyPrimitive, FieldPrimitive, InputPrimitive, PopoverPrimitive, SelectPrimitive, TextareaPrimitive, ToastPrimitive, usePopover };
|
|
4
|
+
export { AvatarPrimitive, BadgePrimitive, ButtonPrimitive, CalendarPrimitive, CardPrimitive, DropdownMenuPrimitive, EmptyPrimitive, FieldPrimitive, InputPrimitive, PopoverPrimitive, SelectPrimitive, TextareaPrimitive, ToastPrimitive, usePopover };
|