@korsolutions/ui 0.0.63 → 0.0.65
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/module/components/button/button.js +44 -0
- package/dist/module/components/button/button.js.map +1 -0
- package/dist/module/components/button/index.js +1 -8
- package/dist/module/components/button/index.js.map +1 -1
- package/dist/module/components/button/variants/default.js +15 -10
- package/dist/module/components/button/variants/default.js.map +1 -1
- package/dist/module/components/button/variants/ghost.js +19 -4
- package/dist/module/components/button/variants/ghost.js.map +1 -1
- package/dist/module/components/button/variants/secondary.js +19 -4
- package/dist/module/components/button/variants/secondary.js.map +1 -1
- package/dist/module/components/menu/components/menu-trigger.js +2 -7
- package/dist/module/components/menu/components/menu-trigger.js.map +1 -1
- package/dist/module/components/popover/components/popover-trigger.js +3 -8
- package/dist/module/components/popover/components/popover-trigger.js.map +1 -1
- package/dist/module/components/portal/portal.js +5 -4
- package/dist/module/components/portal/portal.js.map +1 -1
- package/dist/module/components/select/components/select-overlay.js +1 -0
- package/dist/module/components/select/components/select-overlay.js.map +1 -1
- package/dist/module/components/select/variants/default.js +5 -2
- package/dist/module/components/select/variants/default.js.map +1 -1
- package/dist/module/hooks/use-is-react-navigation-modal.js +41 -0
- package/dist/module/hooks/use-is-react-navigation-modal.js.map +1 -0
- package/dist/module/hooks/use-organized-children.js.map +1 -1
- package/dist/module/hooks/use-relative-position.js +20 -12
- package/dist/module/hooks/use-relative-position.js.map +1 -1
- package/dist/module/index.js +3 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/utils/normalize-layout.js +10 -0
- package/dist/module/utils/normalize-layout.js.map +1 -1
- package/dist/typescript/src/components/button/{components/button-root.d.ts → button.d.ts} +4 -4
- package/dist/typescript/src/components/button/button.d.ts.map +1 -0
- package/dist/typescript/src/components/button/index.d.ts +1 -11
- package/dist/typescript/src/components/button/index.d.ts.map +1 -1
- package/dist/typescript/src/components/button/types.d.ts +6 -6
- package/dist/typescript/src/components/button/types.d.ts.map +1 -1
- package/dist/typescript/src/components/button/variants/default.d.ts +1 -1
- package/dist/typescript/src/components/button/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/button/variants/ghost.d.ts +1 -1
- package/dist/typescript/src/components/button/variants/ghost.d.ts.map +1 -1
- package/dist/typescript/src/components/button/variants/secondary.d.ts +1 -1
- package/dist/typescript/src/components/button/variants/secondary.d.ts.map +1 -1
- package/dist/typescript/src/components/menu/components/menu-trigger.d.ts.map +1 -1
- package/dist/typescript/src/components/popover/components/popover-trigger.d.ts +1 -1
- package/dist/typescript/src/components/popover/components/popover-trigger.d.ts.map +1 -1
- package/dist/typescript/src/components/portal/portal.d.ts.map +1 -1
- package/dist/typescript/src/components/select/components/select-overlay.d.ts.map +1 -1
- package/dist/typescript/src/components/select/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/hooks/use-is-react-navigation-modal.d.ts +3 -0
- package/dist/typescript/src/hooks/use-is-react-navigation-modal.d.ts.map +1 -0
- package/dist/typescript/src/hooks/use-organized-children.d.ts +1 -1
- package/dist/typescript/src/hooks/use-organized-children.d.ts.map +1 -1
- package/dist/typescript/src/hooks/use-relative-position.d.ts +1 -1
- package/dist/typescript/src/hooks/use-relative-position.d.ts.map +1 -1
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/utils/normalize-layout.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/button/button.tsx +85 -0
- package/src/components/button/index.ts +1 -13
- package/src/components/button/types.ts +10 -6
- package/src/components/button/variants/default.tsx +12 -6
- package/src/components/button/variants/ghost.tsx +18 -2
- package/src/components/button/variants/secondary.tsx +18 -2
- package/src/components/menu/components/menu-trigger.tsx +2 -7
- package/src/components/popover/components/popover-trigger.tsx +8 -10
- package/src/components/portal/portal.tsx +4 -3
- package/src/components/select/components/select-overlay.tsx +1 -0
- package/src/components/select/variants/default.tsx +4 -1
- package/src/hooks/use-is-react-navigation-modal.ts +56 -0
- package/src/hooks/use-organized-children.tsx +1 -1
- package/src/hooks/use-relative-position.ts +33 -18
- package/src/index.tsx +4 -0
- package/src/utils/normalize-layout.ts +10 -0
- package/dist/module/components/button/components/button-label.js +0 -18
- package/dist/module/components/button/components/button-label.js.map +0 -1
- package/dist/module/components/button/components/button-root.js +0 -60
- package/dist/module/components/button/components/button-root.js.map +0 -1
- package/dist/module/components/button/components/button-spinner.js +0 -15
- package/dist/module/components/button/components/button-spinner.js.map +0 -1
- package/dist/module/components/button/context.js +0 -12
- package/dist/module/components/button/context.js.map +0 -1
- package/dist/typescript/src/components/button/components/button-label.d.ts +0 -9
- package/dist/typescript/src/components/button/components/button-label.d.ts.map +0 -1
- package/dist/typescript/src/components/button/components/button-root.d.ts.map +0 -1
- package/dist/typescript/src/components/button/components/button-spinner.d.ts +0 -8
- package/dist/typescript/src/components/button/components/button-spinner.d.ts.map +0 -1
- package/dist/typescript/src/components/button/context.d.ts +0 -8
- package/dist/typescript/src/components/button/context.d.ts.map +0 -1
- package/src/components/button/components/button-label.tsx +0 -25
- package/src/components/button/components/button-root.tsx +0 -76
- package/src/components/button/components/button-spinner.tsx +0 -14
- package/src/components/button/context.ts +0 -17
package/dist/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AsyncAlertDialogManager","PortalHost","ToastContainer","SafeAreaProvider","ThemeProvider","jsx","_jsx","jsxs","_jsxs","UIProvider","children","portalContainer","theme","safeAreaInsets","components","insets","container","useTheme"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,uBAAuB,QAAQ,iDAA8C;AACtF,SAASC,UAAU,QAAQ,8BAAqB;AAEhD,SAASC,cAAc,QAAQ,+BAA4B;AAC3D,SAASC,gBAAgB,QAA6B,sBAAa;AACnE,SACEC,aAAa,QAGR,mBAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUlB,OAAO,MAAMC,UAAU,GAAGA,CAAC;EACzBC,QAAQ;EACRC,eAAe;EACfC,KAAK;EACLC,cAAc;EACdC;AACa,CAAC,KAAK;EACnB,
|
|
1
|
+
{"version":3,"names":["AsyncAlertDialogManager","PortalHost","ToastContainer","useInitializeNavigationContainerRef","SafeAreaProvider","ThemeProvider","jsx","_jsx","jsxs","_jsxs","UIProvider","children","portalContainer","theme","safeAreaInsets","components","insets","container","useTheme"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,uBAAuB,QAAQ,iDAA8C;AACtF,SAASC,UAAU,QAAQ,8BAAqB;AAEhD,SAASC,cAAc,QAAQ,+BAA4B;AAC3D,SAASC,mCAAmC,QAAQ,0CAAuC;AAC3F,SAASC,gBAAgB,QAA6B,sBAAa;AACnE,SACEC,aAAa,QAGR,mBAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUlB,OAAO,MAAMC,UAAU,GAAGA,CAAC;EACzBC,QAAQ;EACRC,eAAe;EACfC,KAAK;EACLC,cAAc;EACdC;AACa,CAAC,KAAK;EACnB;EACAZ,mCAAmC,CAAC,CAAC;EAErC,oBACEI,IAAA,CAACH,gBAAgB;IAACY,MAAM,EAAEF,cAAe;IAAAH,QAAA,eACvCF,KAAA,CAACJ,aAAa;MAACQ,KAAK,EAAEA,KAAM;MAACE,UAAU,EAAEA,UAAW;MAAAJ,QAAA,gBAClDJ,IAAA,CAACL,cAAc,IAAE,CAAC,EACjBS,QAAQ,eACTJ,IAAA,CAACN,UAAU;QAACgB,SAAS,EAAEL;MAAgB,CAAE,CAAC,eAC1CL,IAAA,CAACP,uBAAuB,IAAE,CAAC;IAAA,CACd;EAAC,CACA,CAAC;AAEvB,CAAC;AAED,cAAc,4BAAyB;AAEvC,cAAc,4BAAmB;AACjC,cAAc,2BAAkB;AAChC,SAASkB,QAAQ,QAA+B,sBAAmB;AACnE,cAAc,mBAAgB;AAE9B,cAAc,uBAAc;AAE5B,cAAc,sBAAa","ignoreList":[]}
|
|
@@ -21,6 +21,16 @@ const isValidNumber = value => {
|
|
|
21
21
|
return isValid;
|
|
22
22
|
};
|
|
23
23
|
export const measureLayoutPosition = (ref, callback) => {
|
|
24
|
+
if (ref && "getBoundingClientRect" in ref) {
|
|
25
|
+
const rect = ref.getBoundingClientRect();
|
|
26
|
+
callback({
|
|
27
|
+
height: isValidNumber(rect.height) ? rect.height : 0,
|
|
28
|
+
width: isValidNumber(rect.width) ? rect.width : 0,
|
|
29
|
+
pageX: isValidNumber(rect.x) ? rect.x : 0,
|
|
30
|
+
pageY: isValidNumber(rect.y) ? rect.y : 0
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
24
34
|
ref?.measureInWindow((pageX, pageY, width, height) => {
|
|
25
35
|
callback({
|
|
26
36
|
height: isValidNumber(height) ? height : 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["normalizeLayout","layout","_layout","y","top","x","left","isValidNumber","value","isValid","isNaN","isFinite","console","warn","measureLayoutPosition","ref","callback","
|
|
1
|
+
{"version":3,"names":["normalizeLayout","layout","_layout","y","top","x","left","isValidNumber","value","isValid","isNaN","isFinite","console","warn","measureLayoutPosition","ref","callback","rect","getBoundingClientRect","height","width","pageX","pageY","measureInWindow"],"sourceRoot":"../../../src","sources":["utils/normalize-layout.ts"],"mappings":";;AAGA,OAAO,MAAMA,eAAe,GAAIC,MAAuB,IAAK;EAC1D,MAAMC,OAAO,GAAG;IAAE,GAAGD;EAAO,CAAC;EAC7B;EACA,IAAI,CAACA,MAAM,CAACE,CAAC,IAAI,KAAK,IAAIF,MAAM,IAAI,OAAOA,MAAM,CAACG,GAAG,KAAK,QAAQ,EAAE;IAClEF,OAAO,CAACC,CAAC,GAAGF,MAAM,CAACG,GAAG;EACxB;EACA,IAAI,CAACH,MAAM,CAACI,CAAC,IAAI,MAAM,IAAIJ,MAAM,IAAI,OAAOA,MAAM,CAACK,IAAI,KAAK,QAAQ,EAAE;IACpEJ,OAAO,CAACG,CAAC,GAAGJ,MAAM,CAACK,IAAI;EACzB;EACA,OAAOJ,OAAO;AAChB,CAAC;AAED,MAAMK,aAAa,GAAIC,KAAc,IAAsB;EACzD,MAAMC,OAAO,GAAG,OAAOD,KAAK,KAAK,QAAQ,IAAI,CAACE,KAAK,CAACF,KAAK,CAAC,IAAIG,QAAQ,CAACH,KAAK,CAAC;EAC7E,IAAI,CAACC,OAAO,EAAE;IACZG,OAAO,CAACC,IAAI,CAAC,yCAAyCL,KAAK,EAAE,CAAC;EAChE;EACA,OAAOC,OAAO;AAChB,CAAC;AAED,OAAO,MAAMK,qBAAqB,GAAGA,CACnCC,GAAwB,EACxBC,QAA0C,KACvC;EACH,IAAID,GAAG,IAAI,uBAAuB,IAAIA,GAAG,EAAE;IACzC,MAAME,IAAI,GAAIF,GAAG,CAAyDG,qBAAqB,CAAC,CAAC;IACjGF,QAAQ,CAAC;MACPG,MAAM,EAAEZ,aAAa,CAACU,IAAI,CAACE,MAAM,CAAC,GAAGF,IAAI,CAACE,MAAM,GAAG,CAAC;MACpDC,KAAK,EAAEb,aAAa,CAACU,IAAI,CAACG,KAAK,CAAC,GAAGH,IAAI,CAACG,KAAK,GAAG,CAAC;MACjDC,KAAK,EAAEd,aAAa,CAACU,IAAI,CAACZ,CAAC,CAAC,GAAGY,IAAI,CAACZ,CAAC,GAAG,CAAC;MACzCiB,KAAK,EAAEf,aAAa,CAACU,IAAI,CAACd,CAAC,CAAC,GAAGc,IAAI,CAACd,CAAC,GAAG;IAC1C,CAAC,CAAC;IACF;EACF;EACAY,GAAG,EAAEQ,eAAe,CAAC,CAACF,KAAK,EAAEC,KAAK,EAAEF,KAAK,EAAED,MAAM,KAAK;IACpDH,QAAQ,CAAC;MACPG,MAAM,EAAEZ,aAAa,CAACY,MAAM,CAAC,GAAGA,MAAM,GAAG,CAAC;MAC1CC,KAAK,EAAEb,aAAa,CAACa,KAAK,CAAC,GAAGA,KAAK,GAAG,CAAC;MACvCC,KAAK,EAAEd,aAAa,CAACc,KAAK,CAAC,GAAGA,KAAK,GAAG,CAAC;MACvCC,KAAK,EAAEf,aAAa,CAACe,KAAK,CAAC,GAAGA,KAAK,GAAG;IACxC,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type PressableProps, type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
-
import { ButtonVariants } from "
|
|
4
|
-
export interface
|
|
3
|
+
import { ButtonVariants } from "./variants";
|
|
4
|
+
export interface ButtonProps extends PressableProps {
|
|
5
5
|
variant?: keyof typeof ButtonVariants;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
isDisabled?: boolean;
|
|
8
8
|
isLoading?: boolean;
|
|
9
9
|
style?: StyleProp<ViewStyle>;
|
|
10
10
|
}
|
|
11
|
-
export declare function
|
|
12
|
-
//# sourceMappingURL=button
|
|
11
|
+
export declare function Button(props: ButtonProps): React.JSX.Element;
|
|
12
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,OAAO,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAYD,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,qBAmDxC"}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import { ButtonRoot } from "./components/button-root";
|
|
3
|
-
import { ButtonSpinner } from "./components/button-spinner";
|
|
4
|
-
export declare const Button: {
|
|
5
|
-
Root: typeof ButtonRoot;
|
|
6
|
-
Label: typeof ButtonLabel;
|
|
7
|
-
Spinner: typeof ButtonSpinner;
|
|
8
|
-
};
|
|
9
|
-
export type { ButtonLabelProps } from "./components/button-label";
|
|
10
|
-
export type { ButtonRootProps } from "./components/button-root";
|
|
11
|
-
export type { ButtonSpinnerProps } from "./components/button-spinner";
|
|
1
|
+
export { Button, type ButtonProps } from "./button";
|
|
12
2
|
export type { ButtonStyles } from "./types";
|
|
13
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { ButtonSpinnerProps } from "./components/button-spinner";
|
|
1
|
+
import type { ActivityIndicatorProps, TextStyle, ViewStyle } from "react-native";
|
|
2
|
+
import type { IconProps } from "../icon";
|
|
4
3
|
export type ButtonState = "default" | "disabled" | "loading" | "hovered";
|
|
5
4
|
export interface ButtonStyles {
|
|
6
|
-
root?: Partial<Record<ButtonState,
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
root?: Partial<Record<ButtonState, ViewStyle>>;
|
|
6
|
+
text?: Partial<Record<ButtonState, TextStyle>>;
|
|
7
|
+
icon?: Partial<Record<ButtonState, IconProps>>;
|
|
8
|
+
spinner?: Partial<Record<ButtonState, ActivityIndicatorProps>>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAEzE,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IAC/C,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IAC/C,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC,CAAC;CAChE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/button/variants/default.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/button/variants/default.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,uBAAuB,QAAO,YAiD1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ghost.d.ts","sourceRoot":"","sources":["../../../../../../src/components/button/variants/ghost.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ghost.d.ts","sourceRoot":"","sources":["../../../../../../src/components/button/variants/ghost.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,qBAAqB,QAAO,YAiExC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secondary.d.ts","sourceRoot":"","sources":["../../../../../../src/components/button/variants/secondary.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"secondary.d.ts","sourceRoot":"","sources":["../../../../../../src/components/button/variants/secondary.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,yBAAyB,QAAO,YAmE5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-trigger.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu/components/menu-trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAI5D,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;CAC7E;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"menu-trigger.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu/components/menu-trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAI5D,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;CAC7E;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,eAAO,MAAM,WAAW,yFAoCvB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ViewRef } from "../../../types/element.types";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { type PressableProps } from "react-native";
|
|
3
|
+
import type { ViewRef } from "../../../types/element.types";
|
|
4
4
|
export interface PopoverTriggerProps extends PressableProps {
|
|
5
5
|
children: React.ReactElement<React.RefAttributes<ViewRef> & PressableProps>;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-trigger.d.ts","sourceRoot":"","sources":["../../../../../../src/components/popover/components/popover-trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"popover-trigger.d.ts","sourceRoot":"","sources":["../../../../../../src/components/popover/components/popover-trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAI5D,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC,CAAC;CAC7E;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,+FAqCzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../../../src/components/portal/portal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../../../src/components/portal/portal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAIf,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,WAAW,EACjB,MAAM,oBAAoB,CAAC;AA0F5B,wBAAgB,UAAU,CAAC,EACzB,IAA0B,EAC1B,SAAS,GACV,EAAE,eAAe,4BAcjB;AAED,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,QAA8B,EAC9B,QAAQ,GACT,EAAE,WAAW,qBAYb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-overlay.d.ts","sourceRoot":"","sources":["../../../../../../src/components/select/components/select-overlay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,KAAK,SAAS,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGrF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,KAAK,CAAC,YAAY,CAAC;CAC5D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"select-overlay.d.ts","sourceRoot":"","sources":["../../../../../../src/components/select/components/select-overlay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,KAAK,SAAS,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGrF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,KAAK,CAAC,YAAY,CAAC;CAC5D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBAiBtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/select/variants/default.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,wBAAgB,uBAAuB,IAAI,YAAY,
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/select/variants/default.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,wBAAgB,uBAAuB,IAAI,YAAY,CAiFtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-is-react-navigation-modal.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-is-react-navigation-modal.ts"],"names":[],"mappings":"AAQA,wBAAgB,mCAAmC,SAoBlD;AAwBD,wBAAgB,yBAAyB,YAGxC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type StyleProp, type TextStyle } from "react-native";
|
|
3
3
|
import { type IconProps } from "../components/icon";
|
|
4
|
-
export declare function useOrganizedChildren(children: React.ReactNode, textStyle: StyleProp<TextStyle> | undefined, iconProps: IconProps | undefined): React.ReactNode;
|
|
4
|
+
export declare function useOrganizedChildren(children: React.ReactNode, textStyle: StyleProp<TextStyle> | undefined, iconProps: IconProps | undefined | null): React.ReactNode;
|
|
5
5
|
//# sourceMappingURL=use-organized-children.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-organized-children.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-organized-children.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG1D,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,EAC3C,SAAS,EAAE,SAAS,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"use-organized-children.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-organized-children.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG1D,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,EAC3C,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI,GACtC,KAAK,CAAC,SAAS,CA2BjB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type DisplayMetrics, type LayoutRectangle, type ViewStyle } from "react-native";
|
|
2
2
|
import { type SafeAreaInsets } from "../safe-area";
|
|
3
3
|
type UseRelativePositionArgs = Omit<GetContentStyleArgs, "dimensions" | "insets">;
|
|
4
|
+
type GetContentStyleArgs = GetPositionArgs & GetSidePositionArgs & GetAlignPositionArgs;
|
|
4
5
|
export declare function useRelativePosition({ align, triggerPosition, contentLayout, alignOffset, sideOffset, preferredSide, }: UseRelativePositionArgs): ViewStyle;
|
|
5
6
|
export interface LayoutPosition {
|
|
6
7
|
pageY: number;
|
|
@@ -24,6 +25,5 @@ interface GetAlignPositionArgs extends GetPositionArgs {
|
|
|
24
25
|
align: "start" | "center" | "end";
|
|
25
26
|
alignOffset: number;
|
|
26
27
|
}
|
|
27
|
-
type GetContentStyleArgs = GetPositionArgs & GetSidePositionArgs & GetAlignPositionArgs;
|
|
28
28
|
export {};
|
|
29
29
|
//# sourceMappingURL=use-relative-position.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-relative-position.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-relative-position.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-relative-position.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-relative-position.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAGtE,KAAK,uBAAuB,GAAG,IAAI,CACjC,mBAAmB,EACnB,YAAY,GAAG,QAAQ,CACxB,CAAC;AAEF,KAAK,mBAAmB,GAAG,eAAe,GACxC,mBAAmB,GACnB,oBAAoB,CAAC;AAEvB,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,eAAe,EACf,aAAa,EACb,WAAW,EACX,UAAU,EACV,aAAa,GACd,EAAE,uBAAuB,GAAG,SAAS,CA4ErC;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,eAAe;IACvB,UAAU,EAAE,cAAc,CAAC;IAC3B,eAAe,EAAE,cAAc,CAAC;IAChC,aAAa,EAAE,eAAe,CAAC;IAC/B,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,UAAU,mBAAoB,SAAQ,eAAe;IACnD,aAAa,EAAE,KAAK,GAAG,QAAQ,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,eAK5B,CAAC;AACF,eAAO,MAAM,gBAAgB,EAAE,cAK9B,CAAC;AAkFF,UAAU,oBAAqB,SAAQ,eAAe;IACpD,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAG5E,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IAC/C,KAAK,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED,eAAO,MAAM,UAAU,GAAI,mEAMxB,aAAa,gCAcf,CAAC;AAEF,cAAc,yBAAyB,CAAC;AAExC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACpE,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAE7B,cAAc,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-layout.d.ts","sourceRoot":"","sources":["../../../../src/utils/normalize-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,eAAe,GAAI,QAAQ,eAAe;;;;;CAUtD,CAAC;AAUF,eAAO,MAAM,qBAAqB,GAChC,KAAK,YAAY,GAAG,IAAI,EACxB,UAAU,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"normalize-layout.d.ts","sourceRoot":"","sources":["../../../../src/utils/normalize-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,eAAe,GAAI,QAAQ,eAAe;;;;;CAUtD,CAAC;AAUF,eAAO,MAAM,qBAAqB,GAChC,KAAK,YAAY,GAAG,IAAI,EACxB,UAAU,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,SAoB3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
ActivityIndicator,
|
|
4
|
+
Pressable,
|
|
5
|
+
type PressableProps,
|
|
6
|
+
type StyleProp,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
type ViewStyle,
|
|
9
|
+
} from "react-native";
|
|
10
|
+
import { useOrganizedChildren } from "../../hooks/use-organized-children";
|
|
11
|
+
import type { ButtonState } from "./types";
|
|
12
|
+
import { ButtonVariants } from "./variants";
|
|
13
|
+
|
|
14
|
+
export interface ButtonProps extends PressableProps {
|
|
15
|
+
variant?: keyof typeof ButtonVariants;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
|
|
18
|
+
isDisabled?: boolean;
|
|
19
|
+
isLoading?: boolean;
|
|
20
|
+
|
|
21
|
+
style?: StyleProp<ViewStyle>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const calculateState = (
|
|
25
|
+
props: ButtonProps,
|
|
26
|
+
isHovered: boolean,
|
|
27
|
+
): ButtonState => {
|
|
28
|
+
if (props.isDisabled) return "disabled";
|
|
29
|
+
if (props.isLoading) return "loading";
|
|
30
|
+
if (isHovered) return "hovered";
|
|
31
|
+
return "default";
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export function Button(props: ButtonProps) {
|
|
35
|
+
const variantStyles = ButtonVariants[props.variant ?? "default"]();
|
|
36
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
37
|
+
|
|
38
|
+
const state = calculateState(props, isHovered);
|
|
39
|
+
|
|
40
|
+
const textStyle = StyleSheet.flatten([
|
|
41
|
+
variantStyles.text?.default,
|
|
42
|
+
variantStyles.text?.[state],
|
|
43
|
+
]);
|
|
44
|
+
const iconProps = StyleSheet.flatten([
|
|
45
|
+
variantStyles.icon?.default,
|
|
46
|
+
variantStyles.icon?.[state],
|
|
47
|
+
]);
|
|
48
|
+
|
|
49
|
+
const organizedChildren = useOrganizedChildren(
|
|
50
|
+
props.children,
|
|
51
|
+
textStyle,
|
|
52
|
+
iconProps,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const handlePress: PressableProps["onPress"] = (event) => {
|
|
56
|
+
if (props.isDisabled || props.isLoading) {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
props.onPress?.(event);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const spinnerProps = {
|
|
64
|
+
...variantStyles.spinner?.[state],
|
|
65
|
+
...variantStyles.spinner?.default,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<Pressable
|
|
70
|
+
{...props}
|
|
71
|
+
onPress={handlePress}
|
|
72
|
+
onHoverIn={() => setIsHovered(true)}
|
|
73
|
+
onHoverOut={() => setIsHovered(false)}
|
|
74
|
+
disabled={props.isDisabled}
|
|
75
|
+
style={[
|
|
76
|
+
variantStyles.root?.default,
|
|
77
|
+
variantStyles.root?.[state],
|
|
78
|
+
props.style,
|
|
79
|
+
]}
|
|
80
|
+
>
|
|
81
|
+
{organizedChildren}
|
|
82
|
+
{props.isLoading && <ActivityIndicator {...spinnerProps} />}
|
|
83
|
+
</Pressable>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { ButtonRoot } from "./components/button-root";
|
|
3
|
-
import { ButtonSpinner } from "./components/button-spinner";
|
|
4
|
-
|
|
5
|
-
export const Button = {
|
|
6
|
-
Root: ButtonRoot,
|
|
7
|
-
Label: ButtonLabel,
|
|
8
|
-
Spinner: ButtonSpinner,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type { ButtonLabelProps } from "./components/button-label";
|
|
12
|
-
export type { ButtonRootProps } from "./components/button-root";
|
|
13
|
-
export type { ButtonSpinnerProps } from "./components/button-spinner";
|
|
1
|
+
export { Button, type ButtonProps } from "./button";
|
|
14
2
|
export type { ButtonStyles } from "./types";
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type {
|
|
2
|
+
ActivityIndicatorProps,
|
|
3
|
+
TextStyle,
|
|
4
|
+
ViewStyle,
|
|
5
|
+
} from "react-native";
|
|
6
|
+
import type { IconProps } from "../icon";
|
|
4
7
|
|
|
5
8
|
export type ButtonState = "default" | "disabled" | "loading" | "hovered";
|
|
6
9
|
|
|
7
10
|
export interface ButtonStyles {
|
|
8
|
-
root?: Partial<Record<ButtonState,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
root?: Partial<Record<ButtonState, ViewStyle>>;
|
|
12
|
+
text?: Partial<Record<ButtonState, TextStyle>>;
|
|
13
|
+
icon?: Partial<Record<ButtonState, IconProps>>;
|
|
14
|
+
spinner?: Partial<Record<ButtonState, ActivityIndicatorProps>>;
|
|
11
15
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CursorValue } from "react-native";
|
|
2
2
|
import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
|
|
3
3
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
4
|
+
import type { ButtonStyles } from "../types";
|
|
4
5
|
|
|
5
6
|
export const useButtonVariantDefault = (): ButtonStyles => {
|
|
6
7
|
return useThemedStyles(
|
|
@@ -17,32 +18,37 @@ export const useButtonVariantDefault = (): ButtonStyles => {
|
|
|
17
18
|
backgroundColor: colors.primary,
|
|
18
19
|
borderWidth: 1,
|
|
19
20
|
borderColor: colors.border,
|
|
21
|
+
cursor: "pointer",
|
|
20
22
|
},
|
|
21
23
|
disabled: {
|
|
22
24
|
opacity: 0.5,
|
|
25
|
+
cursor: "not-allowed" as CursorValue,
|
|
23
26
|
},
|
|
24
27
|
loading: {
|
|
25
28
|
opacity: 0.5,
|
|
29
|
+
cursor: "wait" as CursorValue,
|
|
26
30
|
},
|
|
27
31
|
hovered: {
|
|
28
32
|
backgroundColor: hslaSetRelativeLightness(colors.primary, -10),
|
|
29
33
|
},
|
|
30
34
|
},
|
|
31
|
-
|
|
35
|
+
text: {
|
|
32
36
|
default: {
|
|
33
37
|
color: colors.primaryForeground,
|
|
34
38
|
fontSize,
|
|
35
39
|
fontFamily,
|
|
36
40
|
},
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
},
|
|
42
|
+
icon: {
|
|
43
|
+
default: {
|
|
44
|
+
color: colors.primaryForeground,
|
|
45
|
+
size: fontSize,
|
|
46
|
+
},
|
|
39
47
|
},
|
|
40
48
|
spinner: {
|
|
41
49
|
default: {
|
|
42
50
|
color: colors.primaryForeground,
|
|
43
51
|
},
|
|
44
|
-
disabled: {},
|
|
45
|
-
loading: {},
|
|
46
52
|
},
|
|
47
53
|
}),
|
|
48
54
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CursorValue } from "react-native";
|
|
2
2
|
import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
|
|
3
3
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
4
|
+
import type { ButtonStyles } from "../types";
|
|
4
5
|
|
|
5
6
|
export const useButtonVariantGhost = (): ButtonStyles => {
|
|
6
7
|
return useThemedStyles(
|
|
@@ -15,18 +16,21 @@ export const useButtonVariantGhost = (): ButtonStyles => {
|
|
|
15
16
|
alignItems: "center",
|
|
16
17
|
justifyContent: "center",
|
|
17
18
|
backgroundColor: "transparent",
|
|
19
|
+
cursor: "pointer",
|
|
18
20
|
},
|
|
19
21
|
disabled: {
|
|
20
22
|
opacity: 0.5,
|
|
23
|
+
cursor: "not-allowed" as CursorValue,
|
|
21
24
|
},
|
|
22
25
|
loading: {
|
|
23
26
|
opacity: 0.5,
|
|
27
|
+
cursor: "wait" as CursorValue,
|
|
24
28
|
},
|
|
25
29
|
hovered: {
|
|
26
30
|
backgroundColor: hslaSetRelativeLightness(colors.secondary, -1),
|
|
27
31
|
},
|
|
28
32
|
},
|
|
29
|
-
|
|
33
|
+
text: {
|
|
30
34
|
default: {
|
|
31
35
|
color: colors.foreground,
|
|
32
36
|
fontSize,
|
|
@@ -39,6 +43,18 @@ export const useButtonVariantGhost = (): ButtonStyles => {
|
|
|
39
43
|
color: colors.mutedForeground,
|
|
40
44
|
},
|
|
41
45
|
},
|
|
46
|
+
icon: {
|
|
47
|
+
default: {
|
|
48
|
+
color: colors.foreground,
|
|
49
|
+
size: fontSize,
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
color: colors.mutedForeground,
|
|
53
|
+
},
|
|
54
|
+
loading: {
|
|
55
|
+
color: colors.mutedForeground,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
42
58
|
spinner: {
|
|
43
59
|
default: {
|
|
44
60
|
color: colors.foreground,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CursorValue } from "react-native";
|
|
2
2
|
import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
|
|
3
3
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
4
|
+
import type { ButtonStyles } from "../types";
|
|
4
5
|
|
|
5
6
|
export const useButtonVariantSecondary = (): ButtonStyles => {
|
|
6
7
|
return useThemedStyles(
|
|
@@ -17,18 +18,21 @@ export const useButtonVariantSecondary = (): ButtonStyles => {
|
|
|
17
18
|
borderWidth: 1,
|
|
18
19
|
borderColor: colors.border,
|
|
19
20
|
backgroundColor: colors.secondary,
|
|
21
|
+
cursor: "pointer",
|
|
20
22
|
},
|
|
21
23
|
disabled: {
|
|
22
24
|
opacity: 0.5,
|
|
25
|
+
cursor: "not-allowed" as CursorValue,
|
|
23
26
|
},
|
|
24
27
|
loading: {
|
|
25
28
|
opacity: 0.5,
|
|
29
|
+
cursor: "wait" as CursorValue,
|
|
26
30
|
},
|
|
27
31
|
hovered: {
|
|
28
32
|
backgroundColor: hslaSetRelativeLightness(colors.secondary, -1),
|
|
29
33
|
},
|
|
30
34
|
},
|
|
31
|
-
|
|
35
|
+
text: {
|
|
32
36
|
default: {
|
|
33
37
|
color: colors.secondaryForeground,
|
|
34
38
|
fontSize,
|
|
@@ -41,6 +45,18 @@ export const useButtonVariantSecondary = (): ButtonStyles => {
|
|
|
41
45
|
color: colors.mutedForeground,
|
|
42
46
|
},
|
|
43
47
|
},
|
|
48
|
+
icon: {
|
|
49
|
+
default: {
|
|
50
|
+
color: colors.secondaryForeground,
|
|
51
|
+
size: fontSize,
|
|
52
|
+
},
|
|
53
|
+
disabled: {
|
|
54
|
+
color: colors.mutedForeground,
|
|
55
|
+
},
|
|
56
|
+
loading: {
|
|
57
|
+
color: colors.mutedForeground,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
44
60
|
spinner: {
|
|
45
61
|
default: {
|
|
46
62
|
color: colors.secondaryForeground,
|
|
@@ -31,13 +31,8 @@ export const MenuTrigger = forwardRef<MenuTriggerRef, MenuTriggerProps>(
|
|
|
31
31
|
|
|
32
32
|
useImperativeHandle(ref, () => ({
|
|
33
33
|
open: () => {
|
|
34
|
-
triggerRef.current
|
|
35
|
-
menu.setTriggerPosition(
|
|
36
|
-
height,
|
|
37
|
-
width,
|
|
38
|
-
pageX,
|
|
39
|
-
pageY,
|
|
40
|
-
});
|
|
34
|
+
measureLayoutPosition(triggerRef.current, (layout) => {
|
|
35
|
+
menu.setTriggerPosition(layout);
|
|
41
36
|
menu.setIsOpen(true);
|
|
42
37
|
});
|
|
43
38
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ViewRef } from "../../../types/element.types";
|
|
2
|
-
import { measureLayoutPosition } from "../../../utils/normalize-layout";
|
|
3
1
|
import React, { forwardRef, useImperativeHandle, useRef } from "react";
|
|
4
2
|
import { type PressableProps } from "react-native";
|
|
3
|
+
import type { ViewRef } from "../../../types/element.types";
|
|
4
|
+
import { measureLayoutPosition } from "../../../utils/normalize-layout";
|
|
5
5
|
import { usePopover } from "../context";
|
|
6
6
|
|
|
7
7
|
export interface PopoverTriggerProps extends PressableProps {
|
|
@@ -13,7 +13,10 @@ export interface PopoverTriggerRef {
|
|
|
13
13
|
close: () => void;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export const PopoverTrigger = forwardRef<
|
|
16
|
+
export const PopoverTrigger = forwardRef<
|
|
17
|
+
PopoverTriggerRef,
|
|
18
|
+
PopoverTriggerProps
|
|
19
|
+
>((props, ref) => {
|
|
17
20
|
const popover = usePopover();
|
|
18
21
|
const triggerRef = useRef<ViewRef>(null);
|
|
19
22
|
|
|
@@ -30,13 +33,8 @@ export const PopoverTrigger = forwardRef<PopoverTriggerRef, PopoverTriggerProps>
|
|
|
30
33
|
|
|
31
34
|
useImperativeHandle(ref, () => ({
|
|
32
35
|
open: () => {
|
|
33
|
-
triggerRef.current
|
|
34
|
-
popover.setTriggerPosition(
|
|
35
|
-
height,
|
|
36
|
-
width,
|
|
37
|
-
pageX,
|
|
38
|
-
pageY,
|
|
39
|
-
});
|
|
36
|
+
measureLayoutPosition(triggerRef.current, (layout) => {
|
|
37
|
+
popover.setTriggerPosition(layout);
|
|
40
38
|
popover.setIsOpen(true);
|
|
41
39
|
});
|
|
42
40
|
},
|
|
@@ -7,6 +7,7 @@ import React, {
|
|
|
7
7
|
useSyncExternalStore,
|
|
8
8
|
} from "react";
|
|
9
9
|
import { Platform, View, type HostInstance } from "react-native";
|
|
10
|
+
import { measureLayoutPosition } from "../../utils/normalize-layout";
|
|
10
11
|
import { PortalOffsetContext, type PortalOffset } from "./portal-offset";
|
|
11
12
|
import {
|
|
12
13
|
DEFAULT_PORTAL_HOST,
|
|
@@ -72,10 +73,10 @@ function DefaultContainer(props: React.PropsWithChildren) {
|
|
|
72
73
|
const [offset, setOffset] = useState<PortalOffset | null>(null);
|
|
73
74
|
|
|
74
75
|
const onLayout = useCallback(() => {
|
|
75
|
-
containerRef.current
|
|
76
|
+
measureLayoutPosition(containerRef.current, (layout) => {
|
|
76
77
|
setOffset((prev) => {
|
|
77
|
-
if (prev?.x === pageX && prev?.y === pageY) return prev;
|
|
78
|
-
return { x: pageX, y: pageY };
|
|
78
|
+
if (prev?.x === layout.pageX && prev?.y === layout.pageY) return prev;
|
|
79
|
+
return { x: layout.pageX, y: layout.pageY };
|
|
79
80
|
});
|
|
80
81
|
});
|
|
81
82
|
}, []);
|