blimpui 0.0.25 → 0.0.26
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/ui/date-range-picker.js +1 -2
- package/dist/$/components/ui/datepicker.d.ts.map +1 -1
- package/dist/$/components/ui/datepicker.js +3 -2
- package/dist/$/components/ui/icon/index.d.ts +3 -0
- package/dist/$/components/ui/icon/index.d.ts.map +1 -0
- package/dist/$/components/ui/icon/index.js +14 -0
- package/dist/$/components/ui/icon/index.native.d.ts +2 -0
- package/dist/$/components/ui/icon/index.native.d.ts.map +1 -0
- package/dist/$/components/ui/icon/index.native.js +16 -0
- package/dist/$/components/ui/icon/types.d.ts +8 -0
- package/dist/$/components/ui/icon/types.d.ts.map +1 -0
- package/dist/$/components/ui/icon/types.js +1 -0
- package/dist/$/components/ui/picker.js +2 -3
- package/dist/$/components/ui/select/dialog-select.d.ts +27 -0
- package/dist/$/components/ui/select/dialog-select.d.ts.map +1 -0
- package/dist/$/components/ui/select/dialog-select.js +56 -0
- package/dist/$/components/ui/select/index.d.ts +6 -0
- package/dist/$/components/ui/select/index.d.ts.map +1 -0
- package/dist/$/components/ui/select/index.js +3 -0
- package/dist/$/components/ui/select/option-list.d.ts +15 -0
- package/dist/$/components/ui/select/option-list.d.ts.map +1 -0
- package/dist/$/components/ui/select/option-list.js +34 -0
- package/dist/$/components/ui/select/popover-select.d.ts +52 -0
- package/dist/$/components/ui/select/popover-select.d.ts.map +1 -0
- package/dist/$/components/ui/select/popover-select.js +55 -0
- package/dist/$/components/ui/select/select-field.d.ts +11 -0
- package/dist/$/components/ui/select/select-field.d.ts.map +1 -0
- package/dist/$/components/ui/select/select-field.js +70 -0
- package/dist/$/components/ui/select/select.d.ts +5 -0
- package/dist/$/components/ui/select/select.d.ts.map +1 -0
- package/dist/$/components/ui/select/select.js +42 -0
- package/dist/$/components/ui/select/sheet-select.d.ts +27 -0
- package/dist/$/components/ui/select/sheet-select.d.ts.map +1 -0
- package/dist/$/components/ui/select/sheet-select.js +70 -0
- package/dist/$/components/ui/select/types.d.ts +68 -0
- package/dist/$/components/ui/select/types.d.ts.map +1 -0
- package/dist/$/components/ui/select/types.js +1 -0
- package/dist/$/components/ui/table/MobileTable.d.ts.map +1 -1
- package/dist/$/components/ui/table/MobileTable.js +1 -1
- package/dist/$/components/ui/table/TableSkeleton.d.ts +6 -1
- package/dist/$/components/ui/table/TableSkeleton.d.ts.map +1 -1
- package/dist/$/components/ui/table/TableSkeleton.js +3 -2
- package/dist/$/components/ui/timepicker.d.ts.map +1 -1
- package/dist/$/components/ui/timepicker.js +3 -2
- package/package.json +71 -69
|
@@ -28,7 +28,6 @@ import { FormField } from "./form-field";
|
|
|
28
28
|
import { Icon } from "./icon";
|
|
29
29
|
import { Text } from "./text";
|
|
30
30
|
import { Popover } from "./popover";
|
|
31
|
-
import { Calendar as CalendarIcon } from "lucide-react-native";
|
|
32
31
|
import * as React from "react";
|
|
33
32
|
import { Pressable, useWindowDimensions, View } from "react-native";
|
|
34
33
|
var buildDefaultRangeFormatter = function (locale, formatOptions) {
|
|
@@ -82,7 +81,7 @@ function DateRangePicker(_a) {
|
|
|
82
81
|
var resolvedPopoverContentClassName = cn("border-none bg-transparent p-0 shadow-none", popoverContentProps === null || popoverContentProps === void 0 ? void 0 : popoverContentProps.className);
|
|
83
82
|
return (_jsxs(_Fragment, { children: [_jsx(Popover, { onOpenChange: handleOpenChange, content: _jsx(RangeCalendar, __assign({ value: selectedRange, onValueChange: handleRangeChange }, rangeCalendarProps)), contentProps: __assign(__assign({}, popoverContentProps), { className: resolvedPopoverContentClassName, sideOffset: (_b = popoverContentProps === null || popoverContentProps === void 0 ? void 0 : popoverContentProps.sideOffset) !== null && _b !== void 0 ? _b : 8 }), triggerRef: popoverRef, type: isSmallerScreen ? "floating-sheet" : "popover" }), _jsxs(Pressable, { className: "flex-row items-center justify-between gap-2 py-1.5", disabled: formFieldProps.disabled, accessibilityState: {
|
|
84
83
|
disabled: formFieldProps.disabled,
|
|
85
|
-
}, onPress: function () { var _a; return (_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.open(); }, children: [_jsx(View, { className: "flex-1", children: _jsx(Text, { className: cn("text-base", displayValue ? "text-foreground" : "text-muted-foreground"), numberOfLines: 1, ellipsizeMode: "tail", children: textToShow }) }), _jsx(Icon, {
|
|
84
|
+
}, onPress: function () { var _a; return (_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.open(); }, children: [_jsx(View, { className: "flex-1", children: _jsx(Text, { className: cn("text-base", displayValue ? "text-foreground" : "text-muted-foreground"), numberOfLines: 1, ellipsizeMode: "tail", children: textToShow }) }), _jsx(Icon, { name: "solar:calendar-outline", className: cn("size-5 text-muted-foreground", isFocused && !hasError && !hasSuccess && "text-foreground", hasError && "text-destructive", hasSuccess && "text-primary", iconClassName) })] })] }));
|
|
86
85
|
} })));
|
|
87
86
|
}
|
|
88
87
|
DateRangePicker.displayName = "DateRangePicker";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datepicker.d.ts","sourceRoot":"","sources":["../../../../$/components/ui/datepicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9D,OAAO,EAAW,cAAc,EAAkB,MAAM,WAAW,CAAC;AAGpE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,eAAe,GAAG,IAAI,CAC1B,cAAc,EACZ,UAAU,GACV,OAAO,GACP,cAAc,GACd,eAAe,GACf,SAAS,GACT,QAAQ,GACR,aAAa,CACf,GAAG;IACH,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC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CAAC,EAAE,IAAI,CAAC;IACb,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,KAAK,MAAM,CAAC;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;IAC3C,aAAa,CAAC,EAAE,IAAI,CACnB,aAAa,EACb,OAAO,GAAG,cAAc,GAAG,eAAe,CAC1C,CAAC;IACF,mBAAmB,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,OAAO,cAAc,CAAC,CAAC;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,YAAY,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;CACvC,CAAC;AAcF,iBAAS,UAAU,CAAC,EACnB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,WAA6B,EAC7B,UAAU,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,EACT,cAAc,EACd,GAAG,cAAc,EACjB,EAAE,eAAe,2CAsHjB;kBAvIQ,UAAU;;;AA2InB,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -28,7 +28,6 @@ import { FormField } from "./form-field";
|
|
|
28
28
|
import { Icon } from "./icon";
|
|
29
29
|
import { Text } from "./text";
|
|
30
30
|
import { Popover } from "./popover";
|
|
31
|
-
import { Calendar as CalendarIcon } from "lucide-react-native";
|
|
32
31
|
import * as React from "react";
|
|
33
32
|
import { Pressable, useWindowDimensions, View } from "react-native";
|
|
34
33
|
var buildDefaultFormatter = function (locale, formatOptions) {
|
|
@@ -75,7 +74,9 @@ function DatePicker(_a) {
|
|
|
75
74
|
}, onPress: function () {
|
|
76
75
|
var _a;
|
|
77
76
|
(_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
78
|
-
}, children: [_jsx(View, { className: "flex-1", children: _jsx(Text, { className: cn("text-base", displayValue
|
|
77
|
+
}, children: [_jsx(View, { className: "flex-1", children: _jsx(Text, { className: cn("text-base", displayValue
|
|
78
|
+
? "text-foreground"
|
|
79
|
+
: "text-muted-foreground"), numberOfLines: 1, ellipsizeMode: "tail", children: textToShow }) }), _jsx(Icon, { name: "solar:calendar-outline", className: cn("size-5 text-muted-foreground", isFocused && !hasError && !hasSuccess && "text-foreground", hasError && "text-destructive", hasSuccess && "text-primary", iconClassName) })] }) }));
|
|
79
80
|
} })) }));
|
|
80
81
|
}
|
|
81
82
|
DatePicker.displayName = "DatePicker";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/icon/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,eAAO,MAAM,IAAI,GAAI,OAAO,YAAY,4CAOvC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Icon as DefaultIcon } from "@iconify/react";
|
|
14
|
+
export var Icon = function (props) { return (_jsx(DefaultIcon, __assign({}, props, { width: props.size, height: props.size, icon: props.name }))); };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/icon/index.native.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,GAAI,OAAO,GAAG,4CAAgC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { IconifyIcon } from "@huymobile/react-native-iconify";
|
|
14
|
+
import { withUniwind } from "uniwind";
|
|
15
|
+
var IconifyLocal = withUniwind(IconifyIcon);
|
|
16
|
+
export var Icon = function (props) { return _jsx(IconifyLocal, __assign({}, props)); };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/icon/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -28,7 +28,6 @@ import { FormField } from "./form-field";
|
|
|
28
28
|
import { Icon } from "./icon";
|
|
29
29
|
import { Text } from "./text";
|
|
30
30
|
import { Popover } from "./popover";
|
|
31
|
-
import { ChevronDown } from "lucide-react-native";
|
|
32
31
|
import * as React from "react";
|
|
33
32
|
import { Pressable, useWindowDimensions, View } from "react-native";
|
|
34
33
|
function Picker(_a) {
|
|
@@ -49,7 +48,7 @@ function Picker(_a) {
|
|
|
49
48
|
var isSmallerScreen = dimensions.width < 640;
|
|
50
49
|
var selectedOption = selectedValue !== undefined ? optionsMap.get(selectedValue) : undefined;
|
|
51
50
|
var displayLabel = selectedOption
|
|
52
|
-
? (_b = formatOptionLabel === null || formatOptionLabel === void 0 ? void 0 : formatOptionLabel(selectedOption)) !== null && _b !== void 0 ? _b : selectedOption.label
|
|
51
|
+
? ((_b = formatOptionLabel === null || formatOptionLabel === void 0 ? void 0 : formatOptionLabel(selectedOption)) !== null && _b !== void 0 ? _b : selectedOption.label)
|
|
53
52
|
: "";
|
|
54
53
|
var textToShow = displayLabel || placeholder;
|
|
55
54
|
var resolvedPopoverContentClassName = cn("border-none bg-transparent p-0 shadow-none", popoverContentProps === null || popoverContentProps === void 0 ? void 0 : popoverContentProps.className);
|
|
@@ -78,7 +77,7 @@ function Picker(_a) {
|
|
|
78
77
|
(_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
79
78
|
}, children: [_jsx(View, { className: "flex-1", children: _jsx(Text, { className: cn("text-base", displayLabel
|
|
80
79
|
? "text-foreground"
|
|
81
|
-
: "text-muted-foreground"), numberOfLines: 1, ellipsizeMode: "tail", children: textToShow }) }), _jsx(Icon, {
|
|
80
|
+
: "text-muted-foreground"), numberOfLines: 1, ellipsizeMode: "tail", children: textToShow }) }), _jsx(Icon, { name: "icon-park-outline:down", className: cn("size-5 text-muted-foreground", isFocused &&
|
|
82
81
|
!hasError &&
|
|
83
82
|
!hasSuccess &&
|
|
84
83
|
"text-foreground", hasError && "text-destructive", hasSuccess && "text-primary", iconClassName) })] }) }));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DialogContent } from "../../primitives/dialog";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import type { SelectClassNames, SelectOption, SelectTriggerBaseProps, TriggerRef } from "./types";
|
|
4
|
+
type DialogSelectProps = {
|
|
5
|
+
options: SelectOption[];
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
renderOption?: (option: SelectOption, state: {
|
|
10
|
+
isSelected: boolean;
|
|
11
|
+
isDisabled: boolean;
|
|
12
|
+
}) => React.ReactNode;
|
|
13
|
+
classNames?: SelectClassNames;
|
|
14
|
+
dialogTitle?: string;
|
|
15
|
+
dialogContentProps?: React.ComponentPropsWithoutRef<typeof DialogContent>;
|
|
16
|
+
triggerProps?: SelectTriggerBaseProps & {
|
|
17
|
+
size?: "default" | "sm";
|
|
18
|
+
};
|
|
19
|
+
onValueChange?: (value: string | undefined, option?: SelectOption) => void;
|
|
20
|
+
onOpenChange?: (open: boolean) => void;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
declare const DialogSelect: React.ForwardRefExoticComponent<DialogSelectProps & React.RefAttributes<TriggerRef>>;
|
|
25
|
+
export { DialogSelect };
|
|
26
|
+
export type { DialogSelectProps };
|
|
27
|
+
//# sourceMappingURL=dialog-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-select.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/select/dialog-select.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEN,aAAa,EAGb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAElG,KAAK,iBAAiB,GAAG;IACxB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,CACd,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE;QAAE,UAAU,EAAE,OAAO,CAAC;QAAC,UAAU,EAAE,OAAO,CAAA;KAAE,KAC/C,KAAK,CAAC,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,CAAC;IAC1E,YAAY,CAAC,EAAE,sBAAsB,GAAG;QAAE,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;KAAE,CAAC;IACpE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,QAAA,MAAM,YAAY,sFA0HjB,CAAC;AAIF,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Icon } from "../../../../$/components/primitives/icon";
|
|
14
|
+
import { cn } from "../../../../$/lib/utils";
|
|
15
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, } from "../../primitives/dialog";
|
|
16
|
+
import { ChevronDown } from "lucide-react-native";
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import { Platform, Pressable, ScrollView, Text, View } from "react-native";
|
|
19
|
+
import { StandaloneOptionList } from "./option-list";
|
|
20
|
+
var DialogSelect = React.forwardRef(function (props, ref) {
|
|
21
|
+
var options = props.options, value = props.value, defaultValue = props.defaultValue, _a = props.placeholder, placeholder = _a === void 0 ? "Select an option" : _a, renderOption = props.renderOption, classNames = props.classNames, dialogTitle = props.dialogTitle, dialogContentProps = props.dialogContentProps, triggerProps = props.triggerProps, onValueChange = props.onValueChange, onOpenChange = props.onOpenChange, disabled = props.disabled, className = props.className;
|
|
22
|
+
var _b = React.useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""), internalValue = _b[0], setInternalValue = _b[1];
|
|
23
|
+
var resolvedValue = value !== undefined ? value : internalValue;
|
|
24
|
+
var _c = React.useState(false), open = _c[0], setOpen = _c[1];
|
|
25
|
+
var handleOpenChange = React.useCallback(function (next) {
|
|
26
|
+
setOpen(next);
|
|
27
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(next);
|
|
28
|
+
}, [onOpenChange]);
|
|
29
|
+
React.useImperativeHandle(ref, function () {
|
|
30
|
+
return ({
|
|
31
|
+
open: function () { return handleOpenChange(true); },
|
|
32
|
+
close: function () { return handleOpenChange(false); },
|
|
33
|
+
focus: function () { return handleOpenChange(true); },
|
|
34
|
+
blur: function () { return handleOpenChange(false); },
|
|
35
|
+
});
|
|
36
|
+
}, [handleOpenChange]);
|
|
37
|
+
var handleSelect = React.useCallback(function (option) {
|
|
38
|
+
if (value === undefined) {
|
|
39
|
+
setInternalValue(option.value);
|
|
40
|
+
}
|
|
41
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(option.value, option);
|
|
42
|
+
handleOpenChange(false);
|
|
43
|
+
}, [value, onValueChange, handleOpenChange]);
|
|
44
|
+
var displayLabel = React.useMemo(function () {
|
|
45
|
+
var _a;
|
|
46
|
+
if (!resolvedValue)
|
|
47
|
+
return null;
|
|
48
|
+
var match = options.find(function (o) { return o.value === resolvedValue; });
|
|
49
|
+
return (_a = match === null || match === void 0 ? void 0 : match.label) !== null && _a !== void 0 ? _a : resolvedValue;
|
|
50
|
+
}, [resolvedValue, options]);
|
|
51
|
+
return (_jsxs(View, { className: cn("w-full", className), children: [_jsxs(Pressable, __assign({ onPress: function () { return !disabled && handleOpenChange(true); }, disabled: disabled, className: cn("bg-background flex h-10 flex-row items-center justify-between gap-2 rounded-md w-full sm:h-9", "border-none bg-transparent", (triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.size) === "sm" && "h-8", disabled && "opacity-50", triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.trigger) }, (Platform.OS === "web"
|
|
52
|
+
? { role: "combobox", "aria-expanded": open }
|
|
53
|
+
: {}), { children: [_jsx(Text, { className: cn("text-sm flex-1", displayLabel ? "text-foreground" : "text-muted-foreground", classNames === null || classNames === void 0 ? void 0 : classNames.value), numberOfLines: 1, children: displayLabel !== null && displayLabel !== void 0 ? displayLabel : placeholder }), _jsx(Icon, { as: ChevronDown, className: "text-muted-foreground size-4" })] })), _jsx(Dialog, { open: open, onOpenChange: handleOpenChange, children: _jsxs(DialogContent, __assign({}, dialogContentProps, { className: cn("p-0 overflow-hidden", dialogContentProps === null || dialogContentProps === void 0 ? void 0 : dialogContentProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.content), children: [dialogTitle && (_jsx(DialogHeader, { className: "px-4 pt-4 pb-2", children: _jsx(DialogTitle, { children: dialogTitle }) })), _jsx(ScrollView, { className: cn("max-h-80 p-1", classNames === null || classNames === void 0 ? void 0 : classNames.optionList), children: _jsx(StandaloneOptionList, { options: options, selectedValue: resolvedValue, onSelect: handleSelect, renderOption: renderOption, classNames: classNames }) })] })) })] }));
|
|
54
|
+
});
|
|
55
|
+
DialogSelect.displayName = "DialogSelect";
|
|
56
|
+
export { DialogSelect };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Select as SelectBase } from "./select";
|
|
2
|
+
export { SelectField as Select } from "./select-field";
|
|
3
|
+
export { NativeSelectScrollView, SelectContent, SelectTrigger, SelectValue, } from "../../primitives/select";
|
|
4
|
+
export type { OptionRenderState, SelectClassNames, SelectOption, SelectProps, SelectType, } from "./types";
|
|
5
|
+
export type { SelectFieldProps } from "./select-field";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EACN,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,WAAW,GACX,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,UAAU,GACV,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SelectClassNames, SelectOption, OptionRenderState } from "./types";
|
|
3
|
+
export declare const PrimitiveOptionList: ({ options, renderOption, classNames, }: {
|
|
4
|
+
options: SelectOption[];
|
|
5
|
+
renderOption?: (option: SelectOption, state: OptionRenderState) => React.ReactNode;
|
|
6
|
+
classNames?: SelectClassNames;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const StandaloneOptionList: ({ options, selectedValue, onSelect, renderOption, classNames, }: {
|
|
9
|
+
options: SelectOption[];
|
|
10
|
+
selectedValue?: string;
|
|
11
|
+
onSelect: (option: SelectOption) => void;
|
|
12
|
+
renderOption?: (option: SelectOption, state: OptionRenderState) => React.ReactNode;
|
|
13
|
+
classNames?: SelectClassNames;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=option-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-list.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/select/option-list.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGjF,eAAO,MAAM,mBAAmB,GAAI,wCAIjC;IACF,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,CACd,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,iBAAiB,KACpB,KAAK,CAAC,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC9B,4CAyDA,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAAI,iEAMlC;IACF,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,CACd,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,iBAAiB,KACpB,KAAK,CAAC,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC9B,4CAqDA,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from "../../../../$/components/primitives/icon";
|
|
3
|
+
import { cn } from "../../../../$/lib/utils";
|
|
4
|
+
import * as SelectPrimitive from "@rn-primitives/select";
|
|
5
|
+
import { Check } from "lucide-react-native";
|
|
6
|
+
import { Platform, Pressable, Text, View } from "react-native";
|
|
7
|
+
// Used inside SelectPrimitive.Root (popover variant)
|
|
8
|
+
export var PrimitiveOptionList = function (_a) {
|
|
9
|
+
var options = _a.options, renderOption = _a.renderOption, classNames = _a.classNames;
|
|
10
|
+
var value = SelectPrimitive.useRootContext().value;
|
|
11
|
+
var selectedValue = value === null || value === void 0 ? void 0 : value.value;
|
|
12
|
+
return (_jsx(_Fragment, { children: options.map(function (option) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
var isSelected = selectedValue === option.value;
|
|
15
|
+
var isDisabled = !!option.disabled;
|
|
16
|
+
var renderer = (_a = option.renderOption) !== null && _a !== void 0 ? _a : renderOption;
|
|
17
|
+
var content = (_b = renderer === null || renderer === void 0 ? void 0 : renderer(option, { isSelected: isSelected, isDisabled: isDisabled })) !== null && _b !== void 0 ? _b : (_jsx(SelectPrimitive.ItemText, { className: cn("text-foreground text-sm", classNames === null || classNames === void 0 ? void 0 : classNames.optionItemLabel) }));
|
|
18
|
+
return (_jsxs(SelectPrimitive.Item, { value: option.value, label: option.label, disabled: option.disabled, className: cn("group relative flex w-full flex-row items-center gap-2 rounded-sm py-2 pl-3 pr-8 sm:py-1.5", Platform.select({
|
|
19
|
+
web: cn("focus:bg-accent focus:text-accent-foreground cursor-default outline-none data-[disabled]:pointer-events-none", "[&_svg]:pointer-events-none"),
|
|
20
|
+
}), classNames === null || classNames === void 0 ? void 0 : classNames.optionItemContainer, isSelected && (classNames === null || classNames === void 0 ? void 0 : classNames.optionItemActiveContainer), isDisabled && (classNames === null || classNames === void 0 ? void 0 : classNames.optionItemDisabledContainer)), children: [_jsx(View, { className: cn("absolute right-2 flex size-3.5 items-center justify-center", classNames === null || classNames === void 0 ? void 0 : classNames.optionItemIndicator), children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Icon, { as: Check, className: "text-muted-foreground size-4 shrink-0" }) }) }), content] }, option.value));
|
|
21
|
+
}) }));
|
|
22
|
+
};
|
|
23
|
+
// Standalone option list for sheet/dialog — no SelectPrimitive context needed
|
|
24
|
+
export var StandaloneOptionList = function (_a) {
|
|
25
|
+
var options = _a.options, selectedValue = _a.selectedValue, onSelect = _a.onSelect, renderOption = _a.renderOption, classNames = _a.classNames;
|
|
26
|
+
return (_jsx(_Fragment, { children: options.map(function (option) {
|
|
27
|
+
var _a;
|
|
28
|
+
var isSelected = selectedValue === option.value;
|
|
29
|
+
var isDisabled = !!option.disabled;
|
|
30
|
+
var renderer = (_a = option.renderOption) !== null && _a !== void 0 ? _a : renderOption;
|
|
31
|
+
var label = renderer ? (renderer(option, { isSelected: isSelected, isDisabled: isDisabled })) : (_jsx(Text, { className: cn("text-foreground text-sm", classNames === null || classNames === void 0 ? void 0 : classNames.optionItemLabel), children: option.label }));
|
|
32
|
+
return (_jsxs(Pressable, { onPress: function () { return !isDisabled && onSelect(option); }, disabled: isDisabled, className: cn("group relative flex w-full flex-row items-center gap-2 rounded-sm py-2 pl-3 pr-8 sm:py-1.5", classNames === null || classNames === void 0 ? void 0 : classNames.optionItemContainer, isSelected && (classNames === null || classNames === void 0 ? void 0 : classNames.optionItemActiveContainer), isDisabled && (classNames === null || classNames === void 0 ? void 0 : classNames.optionItemDisabledContainer), isDisabled && "opacity-50"), children: [_jsx(View, { className: cn("absolute right-2 flex size-3.5 items-center justify-center", classNames === null || classNames === void 0 ? void 0 : classNames.optionItemIndicator), children: isSelected && (_jsx(Icon, { as: Check, className: "text-muted-foreground size-4 shrink-0" })) }), label] }, option.value));
|
|
33
|
+
}) }));
|
|
34
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { NativeSelectScrollView, SelectContent, SelectTrigger, SelectValue, type Option as PrimitiveOption, type TriggerRef } from "../../primitives/select";
|
|
2
|
+
import * as SelectPrimitive from "@rn-primitives/select";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import type { SelectOption, SelectClassNames } from "./types";
|
|
5
|
+
type PopoverSelectProps = Omit<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Root>, "children" | "value" | "defaultValue" | "onValueChange"> & {
|
|
6
|
+
options: SelectOption[];
|
|
7
|
+
value?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
renderOption?: (option: SelectOption, state: {
|
|
11
|
+
isSelected: boolean;
|
|
12
|
+
isDisabled: boolean;
|
|
13
|
+
}) => React.ReactNode;
|
|
14
|
+
classNames?: SelectClassNames;
|
|
15
|
+
triggerProps?: React.ComponentPropsWithoutRef<typeof SelectTrigger>;
|
|
16
|
+
contentProps?: React.ComponentPropsWithoutRef<typeof SelectContent>;
|
|
17
|
+
valueProps?: Omit<React.ComponentPropsWithoutRef<typeof SelectValue>, "placeholder">;
|
|
18
|
+
scrollViewProps?: React.ComponentProps<typeof NativeSelectScrollView>;
|
|
19
|
+
onValueChange?: (value: string | undefined, option?: SelectOption) => void;
|
|
20
|
+
onOptionChange?: (option: PrimitiveOption) => void;
|
|
21
|
+
};
|
|
22
|
+
declare const PopoverSelect: React.ForwardRefExoticComponent<Omit<Omit<import("react-native").ViewProps & {
|
|
23
|
+
asChild?: boolean;
|
|
24
|
+
} & {
|
|
25
|
+
value?: import("@rn-primitives/select").Option;
|
|
26
|
+
defaultValue?: import("@rn-primitives/select").Option;
|
|
27
|
+
onValueChange?: (option: import("@rn-primitives/select").Option) => void;
|
|
28
|
+
onOpenChange?: (open: boolean) => void;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
dir?: "ltr" | "rtl";
|
|
31
|
+
name?: string;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
} & React.RefAttributes<import("react-native").View>, "ref">, "children" | "value" | "defaultValue" | "onValueChange"> & {
|
|
34
|
+
options: SelectOption[];
|
|
35
|
+
value?: string;
|
|
36
|
+
defaultValue?: string;
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
renderOption?: (option: SelectOption, state: {
|
|
39
|
+
isSelected: boolean;
|
|
40
|
+
isDisabled: boolean;
|
|
41
|
+
}) => React.ReactNode;
|
|
42
|
+
classNames?: SelectClassNames;
|
|
43
|
+
triggerProps?: React.ComponentPropsWithoutRef<typeof SelectTrigger>;
|
|
44
|
+
contentProps?: React.ComponentPropsWithoutRef<typeof SelectContent>;
|
|
45
|
+
valueProps?: Omit<React.ComponentPropsWithoutRef<typeof SelectValue>, "placeholder">;
|
|
46
|
+
scrollViewProps?: React.ComponentProps<typeof NativeSelectScrollView>;
|
|
47
|
+
onValueChange?: (value: string | undefined, option?: SelectOption) => void;
|
|
48
|
+
onOptionChange?: (option: PrimitiveOption) => void;
|
|
49
|
+
} & React.RefAttributes<TriggerRef>>;
|
|
50
|
+
export { PopoverSelect };
|
|
51
|
+
export type { PopoverSelectProps };
|
|
52
|
+
//# sourceMappingURL=popover-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover-select.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/select/popover-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,WAAW,EACX,KAAK,MAAM,IAAI,eAAe,EAC9B,KAAK,UAAU,EACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE9D,KAAK,kBAAkB,GAAG,IAAI,CAC7B,KAAK,CAAC,wBAAwB,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,EAC3D,UAAU,GAAG,OA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aAAa,CAAC;iBACtD,IAAI,CAChB,KAAK,CAAC,wBAAwB,CAAC,OAAO,WAAW,CAAC,EAClD,aAAa,CACb;sBACiB,KAAK,CAAC,cAAc,CAAC,OAAO,sBAAsB,CAAC;oBACrD,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,YAAY,KAAK,IAAI;qBACzD,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI;oCAwGlD,CAAC;AAIF,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import { NativeSelectScrollView, SelectContent, SelectTrigger, SelectValue, } from "../../primitives/select";
|
|
25
|
+
import { cn } from "../../../../$/lib/utils";
|
|
26
|
+
import * as SelectPrimitive from "@rn-primitives/select";
|
|
27
|
+
import * as React from "react";
|
|
28
|
+
import { PrimitiveOptionList } from "./option-list";
|
|
29
|
+
var toPrimitiveOption = function (optionValue, optionsMap) {
|
|
30
|
+
if (!optionValue)
|
|
31
|
+
return undefined;
|
|
32
|
+
var match = optionsMap.get(optionValue);
|
|
33
|
+
if (match)
|
|
34
|
+
return { value: match.value, label: match.label };
|
|
35
|
+
return { value: optionValue, label: optionValue };
|
|
36
|
+
};
|
|
37
|
+
var PopoverSelect = React.forwardRef(function (props, ref) {
|
|
38
|
+
var options = props.options, value = props.value, defaultValue = props.defaultValue, _a = props.placeholder, placeholder = _a === void 0 ? "Select an option" : _a, renderOption = props.renderOption, classNames = props.classNames, triggerProps = props.triggerProps, contentProps = props.contentProps, valueProps = props.valueProps, scrollViewProps = props.scrollViewProps, onValueChange = props.onValueChange, onOptionChange = props.onOptionChange, rootProps = __rest(props, ["options", "value", "defaultValue", "placeholder", "renderOption", "classNames", "triggerProps", "contentProps", "valueProps", "scrollViewProps", "onValueChange", "onOptionChange"]);
|
|
39
|
+
var optionsMap = React.useMemo(function () { return new Map(options.map(function (opt) { return [opt.value, opt]; })); }, [options]);
|
|
40
|
+
var resolvedValue = React.useMemo(function () { return toPrimitiveOption(value, optionsMap); }, [value, optionsMap]);
|
|
41
|
+
var resolvedDefaultValue = React.useMemo(function () { return toPrimitiveOption(defaultValue, optionsMap); }, [defaultValue, optionsMap]);
|
|
42
|
+
var handleValueChange = React.useCallback(function (option) {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
onOptionChange === null || onOptionChange === void 0 ? void 0 : onOptionChange(option);
|
|
45
|
+
var matchingOption = (option === null || option === void 0 ? void 0 : option.value)
|
|
46
|
+
? (_a = optionsMap.get(option.value)) !== null && _a !== void 0 ? _a : (option
|
|
47
|
+
? { label: (_b = option.label) !== null && _b !== void 0 ? _b : option.value, value: option.value }
|
|
48
|
+
: undefined)
|
|
49
|
+
: undefined;
|
|
50
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(option === null || option === void 0 ? void 0 : option.value, matchingOption);
|
|
51
|
+
}, [onOptionChange, onValueChange, optionsMap]);
|
|
52
|
+
return (_jsxs(SelectPrimitive.Root, __assign({ value: resolvedValue, defaultValue: resolvedDefaultValue, onValueChange: handleValueChange }, rootProps, { className: cn("w-full", rootProps.className), children: [_jsx(SelectTrigger, __assign({ ref: ref }, triggerProps, { className: cn("border-none bg-transparent text-foreground placeholder:text-muted-foreground w-full", triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.trigger), children: _jsx(SelectValue, __assign({ placeholder: placeholder }, valueProps, { className: cn("text-foreground placeholder:text-muted-foreground", valueProps === null || valueProps === void 0 ? void 0 : valueProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.value) })) })), _jsx(SelectContent, __assign({}, contentProps, { className: cn(contentProps === null || contentProps === void 0 ? void 0 : contentProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.content), children: _jsx(NativeSelectScrollView, __assign({}, scrollViewProps, { className: cn(scrollViewProps === null || scrollViewProps === void 0 ? void 0 : scrollViewProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.optionList), children: _jsx(PrimitiveOptionList, { options: options, renderOption: renderOption, classNames: classNames }) })) }))] })));
|
|
53
|
+
});
|
|
54
|
+
PopoverSelect.displayName = "PopoverSelect";
|
|
55
|
+
export { PopoverSelect };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FormFieldProps } from "../form-field";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import type { SelectProps, TriggerRef } from "./types";
|
|
4
|
+
type SelectFieldProps = SelectProps & Omit<FormFieldProps, "children" | "value" | "defaultValue" | "onValueChange" | "onFocus" | "onBlur" | "placeholder"> & {
|
|
5
|
+
onFieldFocus?: FormFieldProps["onFocus"];
|
|
6
|
+
onFieldBlur?: FormFieldProps["onBlur"];
|
|
7
|
+
};
|
|
8
|
+
declare const SelectField: React.ForwardRefExoticComponent<SelectFieldProps & React.RefAttributes<TriggerRef>>;
|
|
9
|
+
export { SelectField };
|
|
10
|
+
export type { SelectFieldProps };
|
|
11
|
+
//# sourceMappingURL=select-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-field.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/select/select-field.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACX,WAAW,EACX,UAAU,EAGV,MAAM,SAAS,CAAC;AAEjB,KAAK,gBAAgB,GAAG,WAAW,GAClC,IAAI,CACH,cAAc,EACZ,UAAU,GACV,OAAO,GACP,cAAc,GACd,eAAe,GACf,SAAS,GACT,QAAQ,GACR,aAAa,CACf,GAAG;IACH,YAAY,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;CACvC,CAAC;AAEH,QAAA,MAAM,WAAW,qFA2HhB,CAAC;AAIF,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { cn } from "../../../../$/lib/utils";
|
|
25
|
+
import { FormField } from "../form-field";
|
|
26
|
+
import * as React from "react";
|
|
27
|
+
import { Select } from "./select";
|
|
28
|
+
var SelectField = React.forwardRef(function (props, ref) {
|
|
29
|
+
var onFieldFocus = props.onFieldFocus, onFieldBlur = props.onFieldBlur, className = props.className, fieldClassName = props.fieldClassName, labelClassName = props.labelClassName, contentClassName = props.contentClassName, messageClassName = props.messageClassName, errorClassName = props.errorClassName, successClassName = props.successClassName, variant = props.variant, label = props.label, helperText = props.helperText, error = props.error, success = props.success, startContent = props.startContent, endContent = props.endContent, required = props.required, labelPlacement = props.labelPlacement, placeholder = props.placeholder, disabled = props.disabled, classNames = props.classNames, selectProps = __rest(props, ["onFieldFocus", "onFieldBlur", "className", "fieldClassName", "labelClassName", "contentClassName", "messageClassName", "errorClassName", "successClassName", "variant", "label", "helperText", "error", "success", "startContent", "endContent", "required", "labelPlacement", "placeholder", "disabled", "classNames"]);
|
|
30
|
+
var resolvedPlaceholder = placeholder !== null && placeholder !== void 0 ? placeholder : "Select an option";
|
|
31
|
+
// Holds the Select's TriggerRef so both FormField and the forwarded ref can use it
|
|
32
|
+
var triggerRef = React.useRef(null);
|
|
33
|
+
React.useImperativeHandle(ref, function () { return triggerRef.current; }, []);
|
|
34
|
+
return (_jsx(FormField, { className: className, fieldClassName: cn("h-16", fieldClassName), labelClassName: labelClassName, contentClassName: contentClassName, messageClassName: messageClassName, errorClassName: errorClassName, successClassName: successClassName, variant: variant, label: label, required: required, labelPlacement: labelPlacement, placeholder: resolvedPlaceholder, helperText: helperText, error: error, success: success, startContent: startContent, endContent: endContent, value: selectProps.value, defaultValue: selectProps.defaultValue, onFocus: onFieldFocus, onBlur: onFieldBlur, disabled: disabled, children: function (_a) {
|
|
35
|
+
var _b, _c;
|
|
36
|
+
var inputProps = _a.inputProps, isFocused = _a.isFocused, hasError = _a.hasError, hasSuccess = _a.hasSuccess, inputRef = _a.inputRef;
|
|
37
|
+
// Merge the forwarded ref with FormField's inputRef so pressing the
|
|
38
|
+
// field container (focusInput) programmatically opens the select.
|
|
39
|
+
var setRef = function (node) {
|
|
40
|
+
triggerRef.current = node;
|
|
41
|
+
inputRef.current =
|
|
42
|
+
node;
|
|
43
|
+
};
|
|
44
|
+
var statefulTriggerClassName = cn(hasError && "border-destructive/70 ring-1 ring-destructive/20", hasSuccess &&
|
|
45
|
+
!hasError &&
|
|
46
|
+
"border-primary/70 ring-1 ring-primary/20", !hasError &&
|
|
47
|
+
!hasSuccess &&
|
|
48
|
+
isFocused &&
|
|
49
|
+
"border-primary/80 ring-1 ring-primary/10", disabled && "opacity-60");
|
|
50
|
+
var handleValueChange = function (selectedValue, option) {
|
|
51
|
+
var _a;
|
|
52
|
+
inputProps.onChangeText(selectedValue !== null && selectedValue !== void 0 ? selectedValue : "");
|
|
53
|
+
(_a = selectProps.onValueChange) === null || _a === void 0 ? void 0 : _a.call(selectProps, selectedValue, option);
|
|
54
|
+
};
|
|
55
|
+
var handleOpenChange = function (nextOpen) {
|
|
56
|
+
if (nextOpen)
|
|
57
|
+
inputProps.onFocus();
|
|
58
|
+
else
|
|
59
|
+
inputProps.onBlur();
|
|
60
|
+
};
|
|
61
|
+
var mergedClassNames = __assign(__assign({}, classNames), { trigger: cn(statefulTriggerClassName, classNames === null || classNames === void 0 ? void 0 : classNames.trigger) });
|
|
62
|
+
// Build the merged triggerProps — only override what we control.
|
|
63
|
+
// aria-invalid is only meaningful on the popover trigger element.
|
|
64
|
+
var isPopover = !selectProps.type || selectProps.type === "popover";
|
|
65
|
+
var mergedTriggerProps = __assign(__assign(__assign({}, selectProps.triggerProps), { disabled: (_c = (_b = selectProps.triggerProps) === null || _b === void 0 ? void 0 : _b.disabled) !== null && _c !== void 0 ? _c : disabled }), (isPopover && { "aria-invalid": hasError || undefined }));
|
|
66
|
+
return (_jsx(Select, __assign({}, selectProps, { placeholder: resolvedPlaceholder, classNames: mergedClassNames, onValueChange: handleValueChange, onOpenChange: handleOpenChange, triggerProps: mergedTriggerProps, ref: setRef })));
|
|
67
|
+
} }));
|
|
68
|
+
});
|
|
69
|
+
SelectField.displayName = "SelectField";
|
|
70
|
+
export { SelectField };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/select/select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEvD,QAAA,MAAM,MAAM,gFAcV,CAAC;AAIH,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import * as React from "react";
|
|
25
|
+
import { DialogSelect } from "./dialog-select";
|
|
26
|
+
import { PopoverSelect } from "./popover-select";
|
|
27
|
+
import { SheetSelect } from "./sheet-select";
|
|
28
|
+
var Select = React.forwardRef(function (props, ref) {
|
|
29
|
+
if (props.type === "sheet") {
|
|
30
|
+
var _type_1 = props.type, rest_1 = __rest(props, ["type"]);
|
|
31
|
+
return _jsx(SheetSelect, __assign({ ref: ref }, rest_1));
|
|
32
|
+
}
|
|
33
|
+
if (props.type === "dialog") {
|
|
34
|
+
var _type_2 = props.type, rest_2 = __rest(props, ["type"]);
|
|
35
|
+
return _jsx(DialogSelect, __assign({ ref: ref }, rest_2));
|
|
36
|
+
}
|
|
37
|
+
// TypeScript narrows props to SelectPopoverProps here
|
|
38
|
+
var _type = props.type, rest = __rest(props, ["type"]);
|
|
39
|
+
return _jsx(PopoverSelect, __assign({ ref: ref }, rest));
|
|
40
|
+
});
|
|
41
|
+
Select.displayName = "Select";
|
|
42
|
+
export { Select };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ActionSheetProps } from "react-native-actions-sheet";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import type { SelectClassNames, SelectOption, SelectTriggerBaseProps, TriggerRef } from "./types";
|
|
4
|
+
type SheetSelectProps = {
|
|
5
|
+
options: SelectOption[];
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
renderOption?: (option: SelectOption, state: {
|
|
10
|
+
isSelected: boolean;
|
|
11
|
+
isDisabled: boolean;
|
|
12
|
+
}) => React.ReactNode;
|
|
13
|
+
classNames?: SelectClassNames;
|
|
14
|
+
sheetTitle?: string;
|
|
15
|
+
sheetProps?: Partial<ActionSheetProps>;
|
|
16
|
+
triggerProps?: SelectTriggerBaseProps & {
|
|
17
|
+
size?: "default" | "sm";
|
|
18
|
+
};
|
|
19
|
+
onValueChange?: (value: string | undefined, option?: SelectOption) => void;
|
|
20
|
+
onOpenChange?: (open: boolean) => void;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
declare const SheetSelect: React.ForwardRefExoticComponent<SheetSelectProps & React.RefAttributes<TriggerRef>>;
|
|
25
|
+
export { SheetSelect };
|
|
26
|
+
export type { SheetSelectProps };
|
|
27
|
+
//# sourceMappingURL=sheet-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet-select.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/select/sheet-select.tsx"],"names":[],"mappings":"AAEA,OAAoB,EAEnB,KAAK,gBAAgB,EACrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAElG,KAAK,gBAAgB,GAAG;IACvB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,CACd,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE;QAAE,UAAU,EAAE,OAAO,CAAC;QAAC,UAAU,EAAE,OAAO,CAAA;KAAE,KAC/C,KAAK,CAAC,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,sBAAsB,GAAG;QAAE,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;KAAE,CAAC;IACpE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,QAAA,MAAM,WAAW,qFAsIhB,CAAC;AAIF,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Icon } from "../../../../$/components/primitives/icon";
|
|
14
|
+
import { cn } from "../../../../$/lib/utils";
|
|
15
|
+
import ActionSheet from "react-native-actions-sheet";
|
|
16
|
+
import { ChevronDown } from "lucide-react-native";
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import { Platform, Pressable, ScrollView, Text, View } from "react-native";
|
|
19
|
+
import { StandaloneOptionList } from "./option-list";
|
|
20
|
+
var SheetSelect = React.forwardRef(function (props, ref) {
|
|
21
|
+
var options = props.options, value = props.value, defaultValue = props.defaultValue, _a = props.placeholder, placeholder = _a === void 0 ? "Select an option" : _a, renderOption = props.renderOption, classNames = props.classNames, sheetTitle = props.sheetTitle, sheetProps = props.sheetProps, triggerProps = props.triggerProps, onValueChange = props.onValueChange, onOpenChange = props.onOpenChange, disabled = props.disabled, className = props.className;
|
|
22
|
+
var _b = React.useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""), internalValue = _b[0], setInternalValue = _b[1];
|
|
23
|
+
var resolvedValue = value !== undefined ? value : internalValue;
|
|
24
|
+
var sheetRef = React.useRef(null);
|
|
25
|
+
React.useImperativeHandle(ref, function () {
|
|
26
|
+
return ({
|
|
27
|
+
open: function () { var _a; return (_a = sheetRef.current) === null || _a === void 0 ? void 0 : _a.show(); },
|
|
28
|
+
close: function () { var _a; return (_a = sheetRef.current) === null || _a === void 0 ? void 0 : _a.hide(); },
|
|
29
|
+
focus: function () { var _a; return (_a = sheetRef.current) === null || _a === void 0 ? void 0 : _a.show(); },
|
|
30
|
+
blur: function () { var _a; return (_a = sheetRef.current) === null || _a === void 0 ? void 0 : _a.hide(); },
|
|
31
|
+
});
|
|
32
|
+
}, []);
|
|
33
|
+
var handleSelect = React.useCallback(function (option) {
|
|
34
|
+
var _a;
|
|
35
|
+
if (value === undefined) {
|
|
36
|
+
setInternalValue(option.value);
|
|
37
|
+
}
|
|
38
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(option.value, option);
|
|
39
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false);
|
|
40
|
+
(_a = sheetRef.current) === null || _a === void 0 ? void 0 : _a.hide();
|
|
41
|
+
}, [value, onValueChange, onOpenChange]);
|
|
42
|
+
var displayLabel = React.useMemo(function () {
|
|
43
|
+
var _a;
|
|
44
|
+
if (!resolvedValue)
|
|
45
|
+
return null;
|
|
46
|
+
var match = options.find(function (o) { return o.value === resolvedValue; });
|
|
47
|
+
return (_a = match === null || match === void 0 ? void 0 : match.label) !== null && _a !== void 0 ? _a : resolvedValue;
|
|
48
|
+
}, [resolvedValue, options]);
|
|
49
|
+
return (_jsxs(View, { className: cn("w-full", className), children: [_jsxs(Pressable, __assign({ onPress: function () {
|
|
50
|
+
var _a;
|
|
51
|
+
if (!disabled) {
|
|
52
|
+
(_a = sheetRef.current) === null || _a === void 0 ? void 0 : _a.show();
|
|
53
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(true);
|
|
54
|
+
}
|
|
55
|
+
}, disabled: disabled, className: cn("bg-background flex h-10 flex-row items-center justify-between gap-2 rounded-md w-full sm:h-9", "border-none bg-transparent", (triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.size) === "sm" && "h-8", disabled && "opacity-50", triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.trigger) }, (Platform.OS === "web"
|
|
56
|
+
? { role: "combobox", "aria-expanded": false }
|
|
57
|
+
: {}), { children: [_jsx(Text, { className: cn("text-sm flex-1", displayLabel ? "text-foreground" : "text-muted-foreground", classNames === null || classNames === void 0 ? void 0 : classNames.value), numberOfLines: 1, children: displayLabel !== null && displayLabel !== void 0 ? displayLabel : placeholder }), _jsx(Icon, { as: ChevronDown, className: "text-muted-foreground size-4" })] })), _jsx(ActionSheet, __assign({ ref: sheetRef, gestureEnabled: true, indicatorStyle: { display: "none" }, zIndex: 99999, elevation: 999, containerStyle: {
|
|
58
|
+
paddingHorizontal: 12,
|
|
59
|
+
backgroundColor: "transparent",
|
|
60
|
+
paddingBottom: 30,
|
|
61
|
+
bottom: 20,
|
|
62
|
+
} }, sheetProps, { children: _jsxs(View, __assign({ className: "bg-background border-border rounded-xl border overflow-hidden" }, (Platform.OS === "web"
|
|
63
|
+
? {
|
|
64
|
+
onWheel: function (e) { var _a; return (_a = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _a === void 0 ? void 0 : _a.call(e); },
|
|
65
|
+
onTouchMove: function (e) { var _a; return (_a = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _a === void 0 ? void 0 : _a.call(e); },
|
|
66
|
+
}
|
|
67
|
+
: {}), { children: [sheetTitle && (_jsx(View, { className: "border-border border-b px-4 py-3", children: _jsx(Text, { className: "text-foreground text-sm font-medium", children: sheetTitle }) })), _jsx(ScrollView, { className: cn("max-h-72 p-1", classNames === null || classNames === void 0 ? void 0 : classNames.optionList), children: _jsx(StandaloneOptionList, { options: options, selectedValue: resolvedValue, onSelect: handleSelect, renderOption: renderOption, classNames: classNames }) })] })) }))] }));
|
|
68
|
+
});
|
|
69
|
+
SheetSelect.displayName = "SheetSelect";
|
|
70
|
+
export { SheetSelect };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { NativeSelectScrollView, SelectContent, SelectTrigger, SelectValue, Option as PrimitiveOption, TriggerRef } from "../../primitives/select";
|
|
2
|
+
import type * as SelectPrimitive from "@rn-primitives/select";
|
|
3
|
+
import type { ActionSheetProps } from "react-native-actions-sheet";
|
|
4
|
+
import type * as React from "react";
|
|
5
|
+
import type { DialogContent } from "../../primitives/dialog";
|
|
6
|
+
export type SelectOption = {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
renderOption?: (option: SelectOption, state: OptionRenderState) => React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export type OptionRenderState = {
|
|
13
|
+
isSelected: boolean;
|
|
14
|
+
isDisabled: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type SelectClassNames = {
|
|
17
|
+
trigger?: string;
|
|
18
|
+
value?: string;
|
|
19
|
+
content?: string;
|
|
20
|
+
optionList?: string;
|
|
21
|
+
optionItemContainer?: string;
|
|
22
|
+
optionItemLabel?: string;
|
|
23
|
+
optionItemActiveContainer?: string;
|
|
24
|
+
optionItemDisabledContainer?: string;
|
|
25
|
+
optionItemIndicator?: string;
|
|
26
|
+
};
|
|
27
|
+
export type SelectType = "popover" | "sheet" | "dialog";
|
|
28
|
+
export type SelectTriggerBaseProps = {
|
|
29
|
+
className?: string;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
};
|
|
32
|
+
type SelectBaseProps = {
|
|
33
|
+
options: SelectOption[];
|
|
34
|
+
value?: string;
|
|
35
|
+
defaultValue?: string;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
renderOption?: (option: SelectOption, state: OptionRenderState) => React.ReactNode;
|
|
38
|
+
classNames?: SelectClassNames;
|
|
39
|
+
onValueChange?: (value: string | undefined, option?: SelectOption) => void;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
className?: string;
|
|
42
|
+
triggerProps?: SelectTriggerBaseProps;
|
|
43
|
+
};
|
|
44
|
+
type SelectPopoverProps = SelectBaseProps & {
|
|
45
|
+
type?: "popover";
|
|
46
|
+
triggerProps?: React.ComponentPropsWithoutRef<typeof SelectTrigger>;
|
|
47
|
+
contentProps?: React.ComponentPropsWithoutRef<typeof SelectContent>;
|
|
48
|
+
valueProps?: Omit<React.ComponentPropsWithoutRef<typeof SelectValue>, "placeholder">;
|
|
49
|
+
scrollViewProps?: React.ComponentProps<typeof NativeSelectScrollView>;
|
|
50
|
+
onOptionChange?: (option: PrimitiveOption) => void;
|
|
51
|
+
} & Omit<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Root>, "children" | "value" | "defaultValue" | "onValueChange">;
|
|
52
|
+
type SelectSheetProps = SelectBaseProps & {
|
|
53
|
+
type: "sheet";
|
|
54
|
+
sheetTitle?: string;
|
|
55
|
+
sheetProps?: Partial<ActionSheetProps>;
|
|
56
|
+
triggerProps?: Omit<React.ComponentPropsWithoutRef<typeof SelectTrigger>, "ref">;
|
|
57
|
+
onOpenChange?: (open: boolean) => void;
|
|
58
|
+
};
|
|
59
|
+
type SelectDialogProps = SelectBaseProps & {
|
|
60
|
+
type: "dialog";
|
|
61
|
+
dialogTitle?: string;
|
|
62
|
+
dialogContentProps?: React.ComponentPropsWithoutRef<typeof DialogContent>;
|
|
63
|
+
triggerProps?: Omit<React.ComponentPropsWithoutRef<typeof SelectTrigger>, "ref">;
|
|
64
|
+
onOpenChange?: (open: boolean) => void;
|
|
65
|
+
};
|
|
66
|
+
export type SelectProps = SelectPopoverProps | SelectSheetProps | SelectDialogProps;
|
|
67
|
+
export type { PrimitiveOption, TriggerRef };
|
|
68
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/select/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,WAAW,EACX,MAAM,IAAI,eAAe,EACzB,UAAU,EACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,KAAK,eAAe,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,MAAM,YAAY,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,CACd,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,iBAAiB,KACpB,KAAK,CAAC,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CA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
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileTable.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/table/MobileTable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,wBAAgB,WAAW,CAAC,CAAC,EAAE,EAC9B,IAAI,EACJ,OAAO,EACP,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,cAAqB,EACrB,eAAe,GACf,EAAE,IAAI,CACN,UAAU,CAAC,CAAC,CAAC,EACX,MAAM,GACN,SAAS,GACT,cAAc,GACd,eAAe,GACf,cAAc,GACd,qBAAqB,GACrB,uBAAuB,GACvB,qBAAqB,GACrB,cAAc,GACd,uBAAuB,GACvB,WAAW,GACX,gBAAgB,GAChB,kBAAkB,GAClB,gBAAgB,GAChB,iBAAiB,CACnB,GAAG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;CAC/B,
|
|
1
|
+
{"version":3,"file":"MobileTable.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/table/MobileTable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,wBAAgB,WAAW,CAAC,CAAC,EAAE,EAC9B,IAAI,EACJ,OAAO,EACP,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,cAAqB,EACrB,eAAe,GACf,EAAE,IAAI,CACN,UAAU,CAAC,CAAC,CAAC,EACX,MAAM,GACN,SAAS,GACT,cAAc,GACd,eAAe,GACf,cAAc,GACd,qBAAqB,GACrB,uBAAuB,GACvB,qBAAqB,GACrB,cAAc,GACd,uBAAuB,GACvB,WAAW,GACX,gBAAgB,GAChB,kBAAkB,GAClB,gBAAgB,GAChB,iBAAiB,CACnB,GAAG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;CAC/B,mRAiGA"}
|
|
@@ -19,7 +19,7 @@ import { MobileSkeleton } from "./TableSkeleton";
|
|
|
19
19
|
export function MobileTable(_a) {
|
|
20
20
|
var data = _a.data, columns = _a.columns, handlePress = _a.handlePress, keyExtractor = _a.keyExtractor, bodyClassName = _a.bodyClassName, rowClassName = _a.rowClassName, mobileCardClassName = _a.mobileCardClassName, mobileHeaderClassName = _a.mobileHeaderClassName, mobileBodyClassName = _a.mobileBodyClassName, onEndReached = _a.onEndReached, onEndReachedThreshold = _a.onEndReachedThreshold, isLoading = _a.isLoading, renderSkeleton = _a.renderSkeleton, renderEmptyState = _a.renderEmptyState, _b = _a.showEmptyState, showEmptyState = _b === void 0 ? true : _b, emptyStateProps = _a.emptyStateProps;
|
|
21
21
|
if (isLoading) {
|
|
22
|
-
return renderSkeleton ? renderSkeleton() : _jsx(MobileSkeleton, {});
|
|
22
|
+
return renderSkeleton ? (renderSkeleton()) : (_jsx(MobileSkeleton, { mobileBodyClassName: mobileBodyClassName, mobileCardClassName: mobileCardClassName }));
|
|
23
23
|
}
|
|
24
24
|
if (!isLoading && data.length === 0) {
|
|
25
25
|
if (showEmptyState === false)
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export declare function DesktopSkeleton({ columns }: {
|
|
2
2
|
columns: any[];
|
|
3
3
|
}): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export declare function MobileSkeleton(
|
|
4
|
+
export declare function MobileSkeleton({ mobileCardClassName, mobileHeaderClassName, mobileBodyClassName, rowClassName, }: {
|
|
5
|
+
mobileCardClassName?: string;
|
|
6
|
+
mobileHeaderClassName?: string;
|
|
7
|
+
mobileBodyClassName?: string;
|
|
8
|
+
rowClassName?: string | ((item: any, index: number) => string);
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
10
|
//# sourceMappingURL=TableSkeleton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableSkeleton.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/table/TableSkeleton.tsx"],"names":[],"mappings":"AAMA,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,GAAG,EAAE,CAAA;CAAE,2CAwB9D;AAED,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"TableSkeleton.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/table/TableSkeleton.tsx"],"names":[],"mappings":"AAMA,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,GAAG,EAAE,CAAA;CAAE,2CAwB9D;AAED,wBAAgB,cAAc,CAAC,EAC9B,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,GACZ,EAAE;IACF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;CAC/D,2CA8BA"}
|
|
@@ -7,6 +7,7 @@ export function DesktopSkeleton(_a) {
|
|
|
7
7
|
var columns = _a.columns;
|
|
8
8
|
return (_jsx(_Fragment, { children: Array.from({ length: 5 }).map(function (_, i) { return (_jsx(TablePrimitive.Row, { className: "flex-row border-b border-border hover:bg-transparent", children: columns.map(function (col, j) { return (_jsx(TablePrimitive.Cell, { className: cn("flex-1 px-4 py-4", col.className, col.cellClassName), children: _jsx(Skeleton, { className: "h-4 w-full" }) }, "skeleton-cell-".concat(i, "-").concat(j))); }) }, "skeleton-row-".concat(i))); }) }));
|
|
9
9
|
}
|
|
10
|
-
export function MobileSkeleton() {
|
|
11
|
-
|
|
10
|
+
export function MobileSkeleton(_a) {
|
|
11
|
+
var mobileCardClassName = _a.mobileCardClassName, mobileHeaderClassName = _a.mobileHeaderClassName, mobileBodyClassName = _a.mobileBodyClassName, rowClassName = _a.rowClassName;
|
|
12
|
+
return (_jsx(View, { className: mobileBodyClassName, children: Array.from({ length: 3 }).map(function (_, i) { return (_jsxs(View, { className: cn("mb-4 rounded-xl border border-border bg-card p-4", mobileCardClassName), children: [_jsxs(View, { className: "mb-4 flex-row items-center justify-between border-b border-border pb-4", children: [_jsx(Skeleton, { className: "h-4 w-1/3" }), _jsx(Skeleton, { className: "h-4 w-1/4" })] }), _jsx(View, { className: "gap-4", children: Array.from({ length: 3 }).map(function (__, j) { return (_jsxs(View, { className: "flex-row items-center justify-between", children: [_jsx(Skeleton, { className: "h-3 w-1/4" }), _jsx(Skeleton, { className: "h-3 w-1/2" })] }, "mobile-skeleton-row-".concat(i, "-").concat(j))); }) })] }, "mobile-skeleton-".concat(i))); }) }));
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timepicker.d.ts","sourceRoot":"","sources":["../../../../$/components/ui/timepicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEN,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,IAAI,gBAAgB,EAC7C,KAAK,oBAAoB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9D,OAAO,EAAW,cAAc,EAAE,MAAM,WAAW,CAAC;AAGpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,eAAe,GAAG,IAAI,CAC1B,cAAc,EACZ,UAAU,GAC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AAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,EACT,cAAc,EACd,GAAG,cAAc,EACjB,EAAE,eAAe,2CAyHjB;kBA1IQ,UAAU;;;AA8InB,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -28,7 +28,6 @@ import { FormField } from "./form-field";
|
|
|
28
28
|
import { Icon } from "./icon";
|
|
29
29
|
import { Text } from "./text";
|
|
30
30
|
import { Popover } from "./popover";
|
|
31
|
-
import { Clock3 } from "lucide-react-native";
|
|
32
31
|
import * as React from "react";
|
|
33
32
|
import { Pressable, useWindowDimensions, View } from "react-native";
|
|
34
33
|
var pad2 = function (value) {
|
|
@@ -85,7 +84,9 @@ function TimePicker(_a) {
|
|
|
85
84
|
var textToShow = displayValue || placeholder;
|
|
86
85
|
return (_jsx(_Fragment, { children: _jsxs(Pressable, { className: "flex-row items-center justify-between gap-2 py-1.5", disabled: formFieldProps.disabled, accessibilityState: {
|
|
87
86
|
disabled: formFieldProps.disabled,
|
|
88
|
-
}, onPress: function () { var _a; return (_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.open(); }, children: [_jsx(View, { className: "flex-1", children: _jsx(Text, { className: cn("text-base", displayValue
|
|
87
|
+
}, onPress: function () { var _a; return (_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.open(); }, children: [_jsx(View, { className: "flex-1", children: _jsx(Text, { className: cn("text-base", displayValue
|
|
88
|
+
? "text-foreground"
|
|
89
|
+
: "text-muted-foreground"), numberOfLines: 1, ellipsizeMode: "tail", children: textToShow }) }), _jsx(Icon, { name: "iconoir:clock", className: cn("size-5 text-muted-foreground", isFocused && !hasError && !hasSuccess && "text-foreground", hasError && "text-destructive", hasSuccess && "text-primary", iconClassName) })] }) }));
|
|
89
90
|
} })) }));
|
|
90
91
|
}
|
|
91
92
|
TimePicker.displayName = "TimePicker";
|
package/package.json
CHANGED
|
@@ -1,69 +1,71 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "blimpui",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"private": false,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
14
|
-
"import": "./dist/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./package.json": "./package.json"
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
20
|
-
"prepublishOnly": "npm run build"
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@
|
|
24
|
-
"@
|
|
25
|
-
"@rn-primitives/
|
|
26
|
-
"@rn-primitives/
|
|
27
|
-
"@rn-primitives/
|
|
28
|
-
"@rn-primitives/
|
|
29
|
-
"@rn-primitives/
|
|
30
|
-
"@rn-primitives/
|
|
31
|
-
"@rn-primitives/
|
|
32
|
-
"@rn-primitives/
|
|
33
|
-
"@rn-primitives/
|
|
34
|
-
"@rn-primitives/
|
|
35
|
-
"@rn-primitives/
|
|
36
|
-
"@rn-primitives/
|
|
37
|
-
"@rn-primitives/
|
|
38
|
-
"@rn-primitives/
|
|
39
|
-
"@rn-primitives/
|
|
40
|
-
"@rn-primitives/
|
|
41
|
-
"@rn-primitives/
|
|
42
|
-
"@rn-primitives/
|
|
43
|
-
"@rn-primitives/
|
|
44
|
-
"@rn-primitives/
|
|
45
|
-
"@rn-primitives/
|
|
46
|
-
"@rn-primitives/
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"react-native
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
"react": "19.1.
|
|
61
|
-
"
|
|
62
|
-
"react
|
|
63
|
-
"react-native
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "blimpui",
|
|
3
|
+
"version": "0.0.26",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@huymobile/react-native-iconify": "^1.0.9",
|
|
24
|
+
"@iconify/react": "^6.0.2",
|
|
25
|
+
"@rn-primitives/accordion": "^1.2.0",
|
|
26
|
+
"@rn-primitives/alert-dialog": "^1.2.0",
|
|
27
|
+
"@rn-primitives/aspect-ratio": "^1.2.0",
|
|
28
|
+
"@rn-primitives/avatar": "^1.2.0",
|
|
29
|
+
"@rn-primitives/checkbox": "^1.2.0",
|
|
30
|
+
"@rn-primitives/collapsible": "^1.2.0",
|
|
31
|
+
"@rn-primitives/context-menu": "^1.2.0",
|
|
32
|
+
"@rn-primitives/dialog": "^1.2.0",
|
|
33
|
+
"@rn-primitives/dropdown-menu": "^1.2.0",
|
|
34
|
+
"@rn-primitives/hover-card": "^1.2.0",
|
|
35
|
+
"@rn-primitives/label": "^1.2.0",
|
|
36
|
+
"@rn-primitives/menubar": "^1.2.0",
|
|
37
|
+
"@rn-primitives/popover": "^1.2.0",
|
|
38
|
+
"@rn-primitives/portal": "^1.3.0",
|
|
39
|
+
"@rn-primitives/progress": "^1.2.0",
|
|
40
|
+
"@rn-primitives/radio-group": "^1.2.0",
|
|
41
|
+
"@rn-primitives/select": "^1.2.0",
|
|
42
|
+
"@rn-primitives/separator": "^1.2.0",
|
|
43
|
+
"@rn-primitives/slot": "^1.2.0",
|
|
44
|
+
"@rn-primitives/switch": "^1.2.0",
|
|
45
|
+
"@rn-primitives/tabs": "^1.2.0",
|
|
46
|
+
"@rn-primitives/toggle": "^1.2.0",
|
|
47
|
+
"@rn-primitives/toggle-group": "^1.2.0",
|
|
48
|
+
"@rn-primitives/tooltip": "^1.2.0",
|
|
49
|
+
"class-variance-authority": "^0.7.1",
|
|
50
|
+
"clsx": "^2.1.1",
|
|
51
|
+
"lucide-react-native": "^0.555.0",
|
|
52
|
+
"pressto": "^0.6.0",
|
|
53
|
+
"react-native-actions-sheet": "^10.1.1",
|
|
54
|
+
"sonner": "^2.0.7",
|
|
55
|
+
"sonner-native": "^0.22.2",
|
|
56
|
+
"tailwind-merge": "^3.3.1"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@legendapp/list": "^2.0.18",
|
|
60
|
+
"@types/react": "~19.1.10",
|
|
61
|
+
"expo-haptics": "^15.0.8",
|
|
62
|
+
"react": "19.1.0",
|
|
63
|
+
"react-native": "0.81.5",
|
|
64
|
+
"react-native-reanimated": "~4.1.1",
|
|
65
|
+
"react-native-screens": "~4.16.0",
|
|
66
|
+
"tailwindcss": "^4.1.17",
|
|
67
|
+
"tsc-alias": "^1.8.10",
|
|
68
|
+
"typescript": "^5.7.3",
|
|
69
|
+
"uniwind": "^1.2.2"
|
|
70
|
+
}
|
|
71
|
+
}
|