@korsolutions/ui 0.0.86 → 0.0.88
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/alert/variants/default.js +2 -1
- package/dist/module/components/alert/variants/default.js.map +1 -1
- package/dist/module/components/alert/variants/destructive.js +2 -1
- package/dist/module/components/alert/variants/destructive.js.map +1 -1
- package/dist/module/components/alert-dialog/variants/default.js +4 -1
- package/dist/module/components/alert-dialog/variants/default.js.map +1 -1
- package/dist/module/components/avatar/variants/default.js +1 -0
- package/dist/module/components/avatar/variants/default.js.map +1 -1
- package/dist/module/components/badge/variants/default.js +1 -0
- package/dist/module/components/badge/variants/default.js.map +1 -1
- package/dist/module/components/badge/variants/secondary.js +1 -0
- package/dist/module/components/badge/variants/secondary.js.map +1 -1
- package/dist/module/components/button/button.js +3 -2
- package/dist/module/components/button/button.js.map +1 -1
- package/dist/module/components/button/variants/default.js +1 -0
- package/dist/module/components/button/variants/default.js.map +1 -1
- package/dist/module/components/button/variants/ghost.js +1 -0
- package/dist/module/components/button/variants/ghost.js.map +1 -1
- package/dist/module/components/button/variants/secondary.js +1 -0
- package/dist/module/components/button/variants/secondary.js.map +1 -1
- package/dist/module/components/calendar/calendar/variants/default.js +3 -0
- package/dist/module/components/calendar/calendar/variants/default.js.map +1 -1
- package/dist/module/components/calendar/timeline/variants/default.js +1 -0
- package/dist/module/components/calendar/timeline/variants/default.js.map +1 -1
- package/dist/module/components/calendar/week-calendar/variants/default.js +3 -0
- package/dist/module/components/calendar/week-calendar/variants/default.js.map +1 -1
- package/dist/module/components/card/variants/default.js +1 -0
- package/dist/module/components/card/variants/default.js.map +1 -1
- package/dist/module/components/checkbox/variants/default.js +2 -0
- package/dist/module/components/checkbox/variants/default.js.map +1 -1
- package/dist/module/components/checkbox/variants/outlined.js +2 -0
- package/dist/module/components/checkbox/variants/outlined.js.map +1 -1
- package/dist/module/components/combobox/variants/default.js +3 -0
- package/dist/module/components/combobox/variants/default.js.map +1 -1
- package/dist/module/components/empty/variants/default.js +2 -0
- package/dist/module/components/empty/variants/default.js.map +1 -1
- package/dist/module/components/field/variants/default.js +3 -0
- package/dist/module/components/field/variants/default.js.map +1 -1
- package/dist/module/components/index.js +1 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/input/variants/default.js +1 -0
- package/dist/module/components/input/variants/default.js.map +1 -1
- package/dist/module/components/input/variants/secondary.js +1 -0
- package/dist/module/components/input/variants/secondary.js.map +1 -1
- package/dist/module/components/link/variants/default.js +1 -0
- package/dist/module/components/link/variants/default.js.map +1 -1
- package/dist/module/components/menu/variants/default.js +3 -0
- package/dist/module/components/menu/variants/default.js.map +1 -1
- package/dist/module/components/phone-input/variants/default.js +4 -0
- package/dist/module/components/phone-input/variants/default.js.map +1 -1
- package/dist/module/components/portal/portal.web.js +15 -0
- package/dist/module/components/portal/portal.web.js.map +1 -1
- package/dist/module/components/radio-group/variants/default.js +2 -0
- package/dist/module/components/radio-group/variants/default.js.map +1 -1
- package/dist/module/components/radio-group/variants/outlined.js +2 -0
- package/dist/module/components/radio-group/variants/outlined.js.map +1 -1
- package/dist/module/components/select/variants/default.js +3 -0
- package/dist/module/components/select/variants/default.js.map +1 -1
- package/dist/module/components/sidebar/components/sidebar-content.js +19 -0
- package/dist/module/components/sidebar/components/sidebar-content.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-footer.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-footer.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-group-label.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-group-label.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-group.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-group.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-header.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-header.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-menu-item.js +36 -0
- package/dist/module/components/sidebar/components/sidebar-menu-item.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-menu-sub.js +22 -0
- package/dist/module/components/sidebar/components/sidebar-menu-sub.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-menu.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-menu.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-provider.js +47 -0
- package/dist/module/components/sidebar/components/sidebar-provider.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-root.js +27 -0
- package/dist/module/components/sidebar/components/sidebar-root.js.map +1 -0
- package/dist/module/components/sidebar/context.js +12 -0
- package/dist/module/components/sidebar/context.js.map +1 -0
- package/dist/module/components/sidebar/index.js +26 -0
- package/dist/module/components/sidebar/index.js.map +1 -0
- package/dist/module/components/sidebar/types.js +4 -0
- package/dist/module/components/sidebar/types.js.map +1 -0
- package/dist/module/components/sidebar/variants/default.js +102 -0
- package/dist/module/components/sidebar/variants/default.js.map +1 -0
- package/dist/module/components/sidebar/variants/index.js +7 -0
- package/dist/module/components/sidebar/variants/index.js.map +1 -0
- package/dist/module/components/tabs/variants/default.js +1 -0
- package/dist/module/components/tabs/variants/default.js.map +1 -1
- package/dist/module/components/tabs/variants/line.js +1 -0
- package/dist/module/components/tabs/variants/line.js.map +1 -1
- package/dist/module/components/textarea/variants/default.js +1 -0
- package/dist/module/components/textarea/variants/default.js.map +1 -1
- package/dist/module/components/toast/variants/danger.js +2 -0
- package/dist/module/components/toast/variants/danger.js.map +1 -1
- package/dist/module/components/toast/variants/default.js +2 -0
- package/dist/module/components/toast/variants/default.js.map +1 -1
- package/dist/module/components/toast/variants/success.js +2 -0
- package/dist/module/components/toast/variants/success.js.map +1 -1
- package/dist/module/components/typography/typography.js +7 -2
- package/dist/module/components/typography/typography.js.map +1 -1
- package/dist/module/components/typography/variants/body.js +28 -0
- package/dist/module/components/typography/variants/body.js.map +1 -0
- package/dist/module/components/typography/variants/heading.js +29 -0
- package/dist/module/components/typography/variants/heading.js.map +1 -0
- package/dist/module/components/typography/variants/index.js +4 -12
- package/dist/module/components/typography/variants/index.js.map +1 -1
- package/dist/module/utils/size-scale.js +3 -1
- package/dist/module/utils/size-scale.js.map +1 -1
- package/dist/typescript/src/components/alert/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/alert/variants/destructive.d.ts.map +1 -1
- package/dist/typescript/src/components/alert-dialog/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/avatar/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/badge/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/badge/variants/secondary.d.ts.map +1 -1
- package/dist/typescript/src/components/button/button.d.ts.map +1 -1
- package/dist/typescript/src/components/button/types.d.ts +3 -2
- package/dist/typescript/src/components/button/types.d.ts.map +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.map +1 -1
- package/dist/typescript/src/components/button/variants/secondary.d.ts.map +1 -1
- package/dist/typescript/src/components/calendar/calendar/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/calendar/timeline/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/calendar/week-calendar/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/card/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/checkbox/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/checkbox/variants/outlined.d.ts.map +1 -1
- package/dist/typescript/src/components/combobox/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/empty/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/field/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/index.d.ts +1 -0
- package/dist/typescript/src/components/index.d.ts.map +1 -1
- package/dist/typescript/src/components/input/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/input/variants/secondary.d.ts.map +1 -1
- package/dist/typescript/src/components/link/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/menu/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/phone-input/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/portal/portal.web.d.ts.map +1 -1
- package/dist/typescript/src/components/radio-group/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/radio-group/variants/outlined.d.ts.map +1 -1
- package/dist/typescript/src/components/select/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/sidebar/components/sidebar-content.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-content.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-footer.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-footer.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-group-label.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-group-label.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-group.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-group.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-header.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-header.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu-item.d.ts +12 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu-item.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu-sub.d.ts +10 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu-sub.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-provider.d.ts +17 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-provider.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-root.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-root.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/context.d.ts +12 -0
- package/dist/typescript/src/components/sidebar/context.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/index.d.ts +35 -0
- package/dist/typescript/src/components/sidebar/index.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/types.d.ts +29 -0
- package/dist/typescript/src/components/sidebar/types.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/variants/default.d.ts +3 -0
- package/dist/typescript/src/components/sidebar/variants/default.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/variants/index.d.ts +5 -0
- package/dist/typescript/src/components/sidebar/variants/index.d.ts.map +1 -0
- package/dist/typescript/src/components/tabs/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/tabs/variants/line.d.ts.map +1 -1
- package/dist/typescript/src/components/textarea/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/toast/variants/danger.d.ts.map +1 -1
- package/dist/typescript/src/components/toast/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/toast/variants/success.d.ts.map +1 -1
- package/dist/typescript/src/components/typography/typography.d.ts +2 -0
- package/dist/typescript/src/components/typography/typography.d.ts.map +1 -1
- package/dist/typescript/src/components/typography/variants/body.d.ts +4 -0
- package/dist/typescript/src/components/typography/variants/body.d.ts.map +1 -0
- package/dist/typescript/src/components/typography/variants/heading.d.ts +4 -0
- package/dist/typescript/src/components/typography/variants/heading.d.ts.map +1 -0
- package/dist/typescript/src/components/typography/variants/index.d.ts +4 -12
- package/dist/typescript/src/components/typography/variants/index.d.ts.map +1 -1
- package/dist/typescript/src/themes/types.d.ts +4 -0
- package/dist/typescript/src/themes/types.d.ts.map +1 -1
- package/dist/typescript/src/utils/size-scale.d.ts +3 -1
- package/dist/typescript/src/utils/size-scale.d.ts.map +1 -1
- package/package.json +4 -5
- package/src/components/alert/variants/default.tsx +2 -1
- package/src/components/alert/variants/destructive.tsx +2 -1
- package/src/components/alert-dialog/variants/default.tsx +4 -1
- package/src/components/avatar/variants/default.tsx +1 -0
- package/src/components/badge/variants/default.tsx +1 -0
- package/src/components/badge/variants/secondary.tsx +1 -0
- package/src/components/button/button.tsx +2 -2
- package/src/components/button/types.ts +3 -2
- package/src/components/button/variants/default.tsx +1 -0
- package/src/components/button/variants/ghost.tsx +1 -0
- package/src/components/button/variants/secondary.tsx +1 -0
- package/src/components/calendar/calendar/variants/default.tsx +3 -0
- package/src/components/calendar/timeline/variants/default.tsx +1 -0
- package/src/components/calendar/week-calendar/variants/default.tsx +3 -0
- package/src/components/card/variants/default.tsx +1 -0
- package/src/components/checkbox/variants/default.tsx +2 -0
- package/src/components/checkbox/variants/outlined.tsx +2 -0
- package/src/components/combobox/variants/default.tsx +3 -0
- package/src/components/empty/variants/default.tsx +2 -0
- package/src/components/field/variants/default.tsx +3 -0
- package/src/components/index.ts +1 -0
- package/src/components/input/variants/default.tsx +1 -0
- package/src/components/input/variants/secondary.tsx +1 -0
- package/src/components/link/variants/default.tsx +1 -0
- package/src/components/menu/variants/default.tsx +3 -0
- package/src/components/phone-input/variants/default.tsx +4 -0
- package/src/components/portal/portal.web.tsx +15 -0
- package/src/components/radio-group/variants/default.tsx +2 -0
- package/src/components/radio-group/variants/outlined.tsx +2 -0
- package/src/components/select/variants/default.tsx +3 -0
- package/src/components/sidebar/components/sidebar-content.tsx +19 -0
- package/src/components/sidebar/components/sidebar-footer.tsx +15 -0
- package/src/components/sidebar/components/sidebar-group-label.tsx +15 -0
- package/src/components/sidebar/components/sidebar-group.tsx +15 -0
- package/src/components/sidebar/components/sidebar-header.tsx +15 -0
- package/src/components/sidebar/components/sidebar-menu-item.tsx +61 -0
- package/src/components/sidebar/components/sidebar-menu-sub.tsx +23 -0
- package/src/components/sidebar/components/sidebar-menu.tsx +15 -0
- package/src/components/sidebar/components/sidebar-provider.tsx +73 -0
- package/src/components/sidebar/components/sidebar-root.tsx +19 -0
- package/src/components/sidebar/context.ts +21 -0
- package/src/components/sidebar/index.ts +37 -0
- package/src/components/sidebar/types.ts +31 -0
- package/src/components/sidebar/variants/default.tsx +97 -0
- package/src/components/sidebar/variants/index.ts +5 -0
- package/src/components/tabs/variants/default.tsx +1 -0
- package/src/components/tabs/variants/line.tsx +1 -0
- package/src/components/textarea/variants/default.tsx +1 -0
- package/src/components/toast/variants/danger.tsx +2 -0
- package/src/components/toast/variants/default.tsx +2 -0
- package/src/components/toast/variants/success.tsx +2 -0
- package/src/components/typography/typography.tsx +5 -2
- package/src/components/typography/variants/body.tsx +26 -0
- package/src/components/typography/variants/heading.tsx +27 -0
- package/src/components/typography/variants/index.ts +4 -12
- package/src/themes/types.ts +4 -0
- package/src/utils/size-scale.ts +6 -2
- package/README.md +0 -4
- package/dist/module/components/typography/variants/body-lg.js +0 -18
- package/dist/module/components/typography/variants/body-lg.js.map +0 -1
- package/dist/module/components/typography/variants/body-md.js +0 -18
- package/dist/module/components/typography/variants/body-md.js.map +0 -1
- package/dist/module/components/typography/variants/body-sm.js +0 -18
- package/dist/module/components/typography/variants/body-sm.js.map +0 -1
- package/dist/module/components/typography/variants/heading-lg.js +0 -19
- package/dist/module/components/typography/variants/heading-lg.js.map +0 -1
- package/dist/module/components/typography/variants/heading-md.js +0 -19
- package/dist/module/components/typography/variants/heading-md.js.map +0 -1
- package/dist/module/components/typography/variants/heading-sm.js +0 -19
- package/dist/module/components/typography/variants/heading-sm.js.map +0 -1
- package/dist/typescript/src/components/typography/variants/body-lg.d.ts +0 -3
- package/dist/typescript/src/components/typography/variants/body-lg.d.ts.map +0 -1
- package/dist/typescript/src/components/typography/variants/body-md.d.ts +0 -3
- package/dist/typescript/src/components/typography/variants/body-md.d.ts.map +0 -1
- package/dist/typescript/src/components/typography/variants/body-sm.d.ts +0 -3
- package/dist/typescript/src/components/typography/variants/body-sm.d.ts.map +0 -1
- package/dist/typescript/src/components/typography/variants/heading-lg.d.ts +0 -3
- package/dist/typescript/src/components/typography/variants/heading-lg.d.ts.map +0 -1
- package/dist/typescript/src/components/typography/variants/heading-md.d.ts +0 -3
- package/dist/typescript/src/components/typography/variants/heading-md.d.ts.map +0 -1
- package/dist/typescript/src/components/typography/variants/heading-sm.d.ts +0 -3
- package/dist/typescript/src/components/typography/variants/heading-sm.d.ts.map +0 -1
- package/src/components/typography/variants/body-lg.tsx +0 -14
- package/src/components/typography/variants/body-md.tsx +0 -14
- package/src/components/typography/variants/body-sm.tsx +0 -14
- package/src/components/typography/variants/heading-lg.tsx +0 -15
- package/src/components/typography/variants/heading-md.tsx +0 -15
- package/src/components/typography/variants/heading-sm.tsx +0 -15
|
@@ -40,6 +40,7 @@ export const useAlertDialogVariantDefault = (size: Size): AlertDialogStyles => {
|
|
|
40
40
|
},
|
|
41
41
|
title: {
|
|
42
42
|
fontSize: fontSize * 1.25,
|
|
43
|
+
lineHeight: Math.round(fontSize * 1.25 * 1.25),
|
|
43
44
|
fontWeight: "600",
|
|
44
45
|
color: colors.foreground,
|
|
45
46
|
fontFamily,
|
|
@@ -49,7 +50,7 @@ export const useAlertDialogVariantDefault = (size: Size): AlertDialogStyles => {
|
|
|
49
50
|
fontSize,
|
|
50
51
|
color: colors.mutedForeground,
|
|
51
52
|
fontFamily,
|
|
52
|
-
lineHeight: fontSize * 1.
|
|
53
|
+
lineHeight: Math.round(fontSize * 1.25),
|
|
53
54
|
},
|
|
54
55
|
footer: {
|
|
55
56
|
flexDirection: "row",
|
|
@@ -70,6 +71,7 @@ export const useAlertDialogVariantDefault = (size: Size): AlertDialogStyles => {
|
|
|
70
71
|
cancelText: {
|
|
71
72
|
color: colors.foreground,
|
|
72
73
|
fontSize: s.fontSize,
|
|
74
|
+
lineHeight: s.lineHeight,
|
|
73
75
|
fontWeight: "500",
|
|
74
76
|
fontFamily,
|
|
75
77
|
},
|
|
@@ -84,6 +86,7 @@ export const useAlertDialogVariantDefault = (size: Size): AlertDialogStyles => {
|
|
|
84
86
|
actionText: {
|
|
85
87
|
color: colors.primaryForeground,
|
|
86
88
|
fontSize: s.fontSize,
|
|
89
|
+
lineHeight: s.lineHeight,
|
|
87
90
|
fontWeight: "500",
|
|
88
91
|
fontFamily,
|
|
89
92
|
},
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import {
|
|
3
|
-
ActivityIndicator,
|
|
4
3
|
Pressable,
|
|
5
4
|
type PressableProps,
|
|
6
5
|
type StyleProp,
|
|
@@ -11,6 +10,7 @@ import { useOrganizedChildren } from "../../hooks/use-organized-children";
|
|
|
11
10
|
import { useComponentConfig } from "../../themes/provider";
|
|
12
11
|
import { mergeStyles } from "../../utils/calculate-styles";
|
|
13
12
|
import type { Size } from "../../utils/size-scale";
|
|
13
|
+
import { Spinner } from "../spinner";
|
|
14
14
|
import type { ButtonState } from "./types";
|
|
15
15
|
import { ButtonVariants } from "./variants";
|
|
16
16
|
|
|
@@ -69,7 +69,7 @@ export function Button(props: ButtonProps) {
|
|
|
69
69
|
style={[variantStyles.root?.default, variantStyles.root?.[state], props.style]}
|
|
70
70
|
>
|
|
71
71
|
{organizedChildren}
|
|
72
|
-
{props.isLoading && <
|
|
72
|
+
{props.isLoading && <Spinner {...spinnerProps} />}
|
|
73
73
|
</Pressable>
|
|
74
74
|
);
|
|
75
75
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TextStyle, ViewStyle } from "react-native";
|
|
2
2
|
import type { IconProps } from "../icon";
|
|
3
|
+
import type { SpinnerProps } from "../spinner";
|
|
3
4
|
|
|
4
5
|
export type ButtonState = "default" | "disabled" | "loading" | "hovered";
|
|
5
6
|
|
|
@@ -7,5 +8,5 @@ export interface ButtonStyles {
|
|
|
7
8
|
root?: Partial<Record<ButtonState, ViewStyle>>;
|
|
8
9
|
text?: Partial<Record<ButtonState, TextStyle>>;
|
|
9
10
|
icon?: Partial<Record<ButtonState, IconProps>>;
|
|
10
|
-
spinner?: Partial<Record<ButtonState,
|
|
11
|
+
spinner?: Partial<Record<ButtonState, SpinnerProps>>;
|
|
11
12
|
}
|
|
@@ -22,6 +22,7 @@ export const useCalendarVariantDefault = (): CalendarStyles => {
|
|
|
22
22
|
},
|
|
23
23
|
headerTitle: {
|
|
24
24
|
fontSize: fontSize * 1.125,
|
|
25
|
+
lineHeight: Math.round(fontSize * 1.125 * 1.25),
|
|
25
26
|
fontWeight: "600",
|
|
26
27
|
fontFamily,
|
|
27
28
|
color: colors.foreground,
|
|
@@ -72,6 +73,7 @@ export const useCalendarVariantDefault = (): CalendarStyles => {
|
|
|
72
73
|
},
|
|
73
74
|
weekLabel: {
|
|
74
75
|
fontSize: fontSize * 0.875,
|
|
76
|
+
lineHeight: Math.round(fontSize * 0.875 * 1.25),
|
|
75
77
|
fontWeight: "500",
|
|
76
78
|
fontFamily,
|
|
77
79
|
color: colors.mutedForeground,
|
|
@@ -113,6 +115,7 @@ export const useCalendarVariantDefault = (): CalendarStyles => {
|
|
|
113
115
|
dayText: {
|
|
114
116
|
default: {
|
|
115
117
|
fontSize,
|
|
118
|
+
lineHeight: Math.round(fontSize * 1.25),
|
|
116
119
|
fontFamily,
|
|
117
120
|
color: colors.foreground,
|
|
118
121
|
fontWeight: "400",
|
|
@@ -21,6 +21,7 @@ export const useWeekCalendarVariantDefault = (): WeekCalendarStyles => {
|
|
|
21
21
|
},
|
|
22
22
|
headerTitle: {
|
|
23
23
|
fontSize: fontSize * 1.125,
|
|
24
|
+
lineHeight: Math.round(fontSize * 1.125 * 1.25),
|
|
24
25
|
fontWeight: "600",
|
|
25
26
|
fontFamily,
|
|
26
27
|
color: colors.foreground,
|
|
@@ -71,6 +72,7 @@ export const useWeekCalendarVariantDefault = (): WeekCalendarStyles => {
|
|
|
71
72
|
},
|
|
72
73
|
weekLabel: {
|
|
73
74
|
fontSize: fontSize * 0.875,
|
|
75
|
+
lineHeight: Math.round(fontSize * 0.875 * 1.25),
|
|
74
76
|
fontWeight: "500",
|
|
75
77
|
fontFamily,
|
|
76
78
|
color: colors.mutedForeground,
|
|
@@ -111,6 +113,7 @@ export const useWeekCalendarVariantDefault = (): WeekCalendarStyles => {
|
|
|
111
113
|
dayText: {
|
|
112
114
|
default: {
|
|
113
115
|
fontSize,
|
|
116
|
+
lineHeight: Math.round(fontSize * 1.25),
|
|
114
117
|
fontFamily,
|
|
115
118
|
color: colors.foreground,
|
|
116
119
|
fontWeight: "400",
|
|
@@ -48,6 +48,7 @@ export const useCheckboxVariantDefault = (): CheckboxStyles => {
|
|
|
48
48
|
default: {
|
|
49
49
|
color: colors.foreground,
|
|
50
50
|
fontSize,
|
|
51
|
+
lineHeight: Math.round(fontSize * 1.25),
|
|
51
52
|
fontFamily,
|
|
52
53
|
fontWeight: "500",
|
|
53
54
|
},
|
|
@@ -59,6 +60,7 @@ export const useCheckboxVariantDefault = (): CheckboxStyles => {
|
|
|
59
60
|
default: {
|
|
60
61
|
color: colors.mutedForeground,
|
|
61
62
|
fontSize: fontSize * 0.875,
|
|
63
|
+
lineHeight: Math.round(fontSize * 0.875 * 1.25),
|
|
62
64
|
fontFamily,
|
|
63
65
|
marginTop: 2,
|
|
64
66
|
},
|
|
@@ -63,6 +63,7 @@ export const useCheckboxVariantOutlined = (): CheckboxStyles => {
|
|
|
63
63
|
default: {
|
|
64
64
|
color: colors.foreground,
|
|
65
65
|
fontSize,
|
|
66
|
+
lineHeight: Math.round(fontSize * 1.25),
|
|
66
67
|
fontFamily,
|
|
67
68
|
fontWeight: "500",
|
|
68
69
|
},
|
|
@@ -74,6 +75,7 @@ export const useCheckboxVariantOutlined = (): CheckboxStyles => {
|
|
|
74
75
|
default: {
|
|
75
76
|
color: colors.mutedForeground,
|
|
76
77
|
fontSize: fontSize * 0.875,
|
|
78
|
+
lineHeight: Math.round(fontSize * 0.875 * 1.25),
|
|
77
79
|
fontFamily,
|
|
78
80
|
marginTop: 2,
|
|
79
81
|
},
|
|
@@ -27,6 +27,7 @@ export function useComboboxVariantDefault(size: Size): ComboboxStyles {
|
|
|
27
27
|
minHeight: s.height,
|
|
28
28
|
fontFamily,
|
|
29
29
|
fontSize: s.fontSize,
|
|
30
|
+
lineHeight: s.lineHeight,
|
|
30
31
|
color: colors.foreground,
|
|
31
32
|
outlineWidth: 0,
|
|
32
33
|
pointerEvents: "auto",
|
|
@@ -76,6 +77,7 @@ export function useComboboxVariantDefault(size: Size): ComboboxStyles {
|
|
|
76
77
|
paddingHorizontal: s.paddingHorizontal,
|
|
77
78
|
fontFamily,
|
|
78
79
|
fontSize: s.fontSize,
|
|
80
|
+
lineHeight: s.lineHeight,
|
|
79
81
|
color: colors.foreground,
|
|
80
82
|
borderRadius: radius / 2,
|
|
81
83
|
},
|
|
@@ -95,6 +97,7 @@ export function useComboboxVariantDefault(size: Size): ComboboxStyles {
|
|
|
95
97
|
paddingHorizontal: s.paddingHorizontal,
|
|
96
98
|
fontFamily,
|
|
97
99
|
fontSize: s.fontSize,
|
|
100
|
+
lineHeight: s.lineHeight,
|
|
98
101
|
color: colors.mutedForeground,
|
|
99
102
|
textAlign: "center",
|
|
100
103
|
},
|
|
@@ -20,6 +20,7 @@ export function useEmptyVariantDefault(): EmptyStyles {
|
|
|
20
20
|
title: {
|
|
21
21
|
fontFamily: fontFamily,
|
|
22
22
|
fontSize: fontSize,
|
|
23
|
+
lineHeight: Math.round(fontSize * 1.25),
|
|
23
24
|
color: colors.foreground,
|
|
24
25
|
textAlign: "center",
|
|
25
26
|
fontWeight: "600",
|
|
@@ -27,6 +28,7 @@ export function useEmptyVariantDefault(): EmptyStyles {
|
|
|
27
28
|
description: {
|
|
28
29
|
fontFamily: fontFamily,
|
|
29
30
|
fontSize: fontSize * 0.875,
|
|
31
|
+
lineHeight: Math.round(fontSize * 0.875 * 1.25),
|
|
30
32
|
color: colors.mutedForeground,
|
|
31
33
|
textAlign: "center",
|
|
32
34
|
},
|
|
@@ -11,17 +11,20 @@ export const useFieldVariantDefault = (): FieldStyles => {
|
|
|
11
11
|
label: {
|
|
12
12
|
fontFamily,
|
|
13
13
|
fontSize: fontSize * 0.875,
|
|
14
|
+
lineHeight: Math.round(fontSize * 0.875 * 1.25),
|
|
14
15
|
fontWeight: "600",
|
|
15
16
|
color: colors.foreground,
|
|
16
17
|
},
|
|
17
18
|
description: {
|
|
18
19
|
fontFamily,
|
|
19
20
|
fontSize: fontSize * 0.875,
|
|
21
|
+
lineHeight: Math.round(fontSize * 0.875 * 1.25),
|
|
20
22
|
color: colors.mutedForeground,
|
|
21
23
|
},
|
|
22
24
|
error: {
|
|
23
25
|
fontFamily,
|
|
24
26
|
fontSize: fontSize * 0.875,
|
|
27
|
+
lineHeight: Math.round(fontSize * 0.875 * 1.25),
|
|
25
28
|
color: colors.danger,
|
|
26
29
|
},
|
|
27
30
|
}),
|
package/src/components/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export function useLinkVariantDefault(): TextStyle {
|
|
|
6
6
|
({ colors, fontFamily, letterSpacing, fontSize }): TextStyle => ({
|
|
7
7
|
color: colors.primary,
|
|
8
8
|
fontSize,
|
|
9
|
+
lineHeight: Math.round(fontSize * 1.25),
|
|
9
10
|
fontFamily,
|
|
10
11
|
textDecorationLine: "underline",
|
|
11
12
|
letterSpacing,
|
|
@@ -32,6 +32,7 @@ export const useMenuVariantDefault = (): MenuStyles => {
|
|
|
32
32
|
itemText: {
|
|
33
33
|
fontFamily: fontFamily,
|
|
34
34
|
fontSize: fontSize,
|
|
35
|
+
lineHeight: Math.round(fontSize * 1.25),
|
|
35
36
|
color: colors.foreground,
|
|
36
37
|
},
|
|
37
38
|
itemIcon: {
|
|
@@ -43,6 +44,7 @@ export const useMenuVariantDefault = (): MenuStyles => {
|
|
|
43
44
|
paddingHorizontal: 16,
|
|
44
45
|
fontFamily: fontFamily,
|
|
45
46
|
fontSize: fontSize * 0.75,
|
|
47
|
+
lineHeight: Math.round(fontSize * 0.75 * 1.25),
|
|
46
48
|
fontWeight: "600",
|
|
47
49
|
color: colors.mutedForeground,
|
|
48
50
|
},
|
|
@@ -89,6 +91,7 @@ export const useMenuVariantDefault = (): MenuStyles => {
|
|
|
89
91
|
},
|
|
90
92
|
shortcut: {
|
|
91
93
|
fontSize: fontSize * 0.75,
|
|
94
|
+
lineHeight: Math.round(fontSize * 0.75 * 1.25),
|
|
92
95
|
fontFamily: fontFamily,
|
|
93
96
|
color: colors.mutedForeground,
|
|
94
97
|
},
|
|
@@ -41,6 +41,7 @@ export function usePhoneInputVariantDefault(size: Size): PhoneInputStyles {
|
|
|
41
41
|
default: {
|
|
42
42
|
fontFamily,
|
|
43
43
|
fontSize: s.fontSize,
|
|
44
|
+
lineHeight: s.lineHeight,
|
|
44
45
|
color: colors.foreground,
|
|
45
46
|
},
|
|
46
47
|
disabled: {
|
|
@@ -61,6 +62,7 @@ export function usePhoneInputVariantDefault(size: Size): PhoneInputStyles {
|
|
|
61
62
|
paddingHorizontal: s.paddingHorizontal,
|
|
62
63
|
fontFamily,
|
|
63
64
|
fontSize: s.fontSize,
|
|
65
|
+
lineHeight: s.lineHeight,
|
|
64
66
|
color: colors.foreground,
|
|
65
67
|
height: "100%",
|
|
66
68
|
outlineWidth: 0,
|
|
@@ -105,6 +107,7 @@ export function usePhoneInputVariantDefault(size: Size): PhoneInputStyles {
|
|
|
105
107
|
default: {
|
|
106
108
|
fontFamily,
|
|
107
109
|
fontSize: s.fontSize,
|
|
110
|
+
lineHeight: s.lineHeight,
|
|
108
111
|
color: colors.foreground,
|
|
109
112
|
},
|
|
110
113
|
},
|
|
@@ -117,6 +120,7 @@ export function usePhoneInputVariantDefault(size: Size): PhoneInputStyles {
|
|
|
117
120
|
paddingHorizontal: s.paddingHorizontal * 0.75,
|
|
118
121
|
fontFamily,
|
|
119
122
|
fontSize: s.fontSize * 0.875,
|
|
123
|
+
lineHeight: Math.round(s.fontSize * 0.875 * 1.25),
|
|
120
124
|
color: colors.foreground,
|
|
121
125
|
marginBottom: 4,
|
|
122
126
|
outlineWidth: 0,
|
|
@@ -6,6 +6,20 @@ export function PortalHost() {
|
|
|
6
6
|
return <></>;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Prevent scroll-lock libraries (e.g. react-remove-scroll used by Radix/Vaul
|
|
11
|
+
* modals) from blocking scroll events inside the portal. These libraries
|
|
12
|
+
* register document-level wheel/touchmove listeners that call
|
|
13
|
+
* preventDefault() on events originating outside their managed "shards".
|
|
14
|
+
* Stopping propagation at the portal container keeps those handlers from
|
|
15
|
+
* firing while still allowing native scroll within the portal content.
|
|
16
|
+
*/
|
|
17
|
+
function preventScrollLock(container: HTMLElement) {
|
|
18
|
+
const stop = (e: Event) => e.stopPropagation();
|
|
19
|
+
container.addEventListener("wheel", stop);
|
|
20
|
+
container.addEventListener("touchmove", stop);
|
|
21
|
+
}
|
|
22
|
+
|
|
9
23
|
export function Portal({ name, hostName = DEFAULT_PORTAL_HOST, children }: PortalProps) {
|
|
10
24
|
const [container] = useState(() => {
|
|
11
25
|
let container = document.getElementById(hostName);
|
|
@@ -15,6 +29,7 @@ export function Portal({ name, hostName = DEFAULT_PORTAL_HOST, children }: Porta
|
|
|
15
29
|
container.id = hostName;
|
|
16
30
|
container.style.pointerEvents = "auto";
|
|
17
31
|
document.body.appendChild(container);
|
|
32
|
+
preventScrollLock(container);
|
|
18
33
|
}
|
|
19
34
|
return container;
|
|
20
35
|
});
|
|
@@ -55,6 +55,7 @@ export const useRadioGroupVariantDefault = (): RadioGroupStyles => {
|
|
|
55
55
|
default: {
|
|
56
56
|
color: colors.foreground,
|
|
57
57
|
fontSize,
|
|
58
|
+
lineHeight: Math.round(fontSize * 1.25),
|
|
58
59
|
fontFamily,
|
|
59
60
|
fontWeight: "500",
|
|
60
61
|
},
|
|
@@ -66,6 +67,7 @@ export const useRadioGroupVariantDefault = (): RadioGroupStyles => {
|
|
|
66
67
|
default: {
|
|
67
68
|
color: colors.mutedForeground,
|
|
68
69
|
fontSize: fontSize * 0.875,
|
|
70
|
+
lineHeight: Math.round(fontSize * 0.875 * 1.25),
|
|
69
71
|
fontFamily,
|
|
70
72
|
marginTop: 2,
|
|
71
73
|
},
|
|
@@ -67,6 +67,7 @@ export const useRadioGroupVariantOutlined = (): RadioGroupStyles => {
|
|
|
67
67
|
default: {
|
|
68
68
|
color: colors.foreground,
|
|
69
69
|
fontSize,
|
|
70
|
+
lineHeight: Math.round(fontSize * 1.25),
|
|
70
71
|
fontFamily,
|
|
71
72
|
fontWeight: "500",
|
|
72
73
|
},
|
|
@@ -78,6 +79,7 @@ export const useRadioGroupVariantOutlined = (): RadioGroupStyles => {
|
|
|
78
79
|
default: {
|
|
79
80
|
color: colors.mutedForeground,
|
|
80
81
|
fontSize: fontSize * 0.875,
|
|
82
|
+
lineHeight: Math.round(fontSize * 0.875 * 1.25),
|
|
81
83
|
fontFamily,
|
|
82
84
|
marginTop: 2,
|
|
83
85
|
},
|
|
@@ -29,6 +29,7 @@ export function useSelectVariantDefault(size: Size): SelectStyles {
|
|
|
29
29
|
default: {
|
|
30
30
|
fontFamily,
|
|
31
31
|
fontSize: s.fontSize,
|
|
32
|
+
lineHeight: s.lineHeight,
|
|
32
33
|
color: colors.foreground,
|
|
33
34
|
},
|
|
34
35
|
disabled: {
|
|
@@ -39,6 +40,7 @@ export function useSelectVariantDefault(size: Size): SelectStyles {
|
|
|
39
40
|
default: {
|
|
40
41
|
fontFamily,
|
|
41
42
|
fontSize: s.fontSize,
|
|
43
|
+
lineHeight: s.lineHeight,
|
|
42
44
|
color: colors.mutedForeground,
|
|
43
45
|
},
|
|
44
46
|
disabled: {
|
|
@@ -69,6 +71,7 @@ export function useSelectVariantDefault(size: Size): SelectStyles {
|
|
|
69
71
|
paddingHorizontal: s.paddingHorizontal,
|
|
70
72
|
fontFamily,
|
|
71
73
|
fontSize: s.fontSize,
|
|
74
|
+
lineHeight: s.lineHeight,
|
|
72
75
|
color: colors.foreground,
|
|
73
76
|
borderRadius: radius / 2,
|
|
74
77
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ScrollView, type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarContentProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarContent(props: SidebarContentProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const sidebar = useSidebar();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<ScrollView style={[sidebar.styles?.content, style]} showsVerticalScrollIndicator={false}>
|
|
16
|
+
{children}
|
|
17
|
+
</ScrollView>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, View, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarFooterProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarFooter(props: SidebarFooterProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const sidebar = useSidebar();
|
|
13
|
+
|
|
14
|
+
return <View style={[sidebar.styles?.footer, style]}>{children}</View>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, Text, type TextStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarGroupLabelProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<TextStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarGroupLabel(props: SidebarGroupLabelProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const sidebar = useSidebar();
|
|
13
|
+
|
|
14
|
+
return <Text style={[sidebar.styles?.groupLabel, style]}>{children}</Text>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, View, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarGroupProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarGroup(props: SidebarGroupProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const sidebar = useSidebar();
|
|
13
|
+
|
|
14
|
+
return <View style={[sidebar.styles?.group, style]}>{children}</View>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, View, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarHeaderProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarHeader(props: SidebarHeaderProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const sidebar = useSidebar();
|
|
13
|
+
|
|
14
|
+
return <View style={[sidebar.styles?.header, style]}>{children}</View>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Pressable,
|
|
4
|
+
type PressableProps,
|
|
5
|
+
type StyleProp,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
type ViewStyle,
|
|
8
|
+
} from "react-native";
|
|
9
|
+
import { useOrganizedChildren } from "../../../hooks/use-organized-children";
|
|
10
|
+
import { useSidebar } from "../context";
|
|
11
|
+
import type { SidebarMenuButtonState } from "../types";
|
|
12
|
+
|
|
13
|
+
export interface SidebarMenuItemProps extends Omit<PressableProps, "style"> {
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
|
|
16
|
+
/** Mark as active item */
|
|
17
|
+
isActive?: boolean;
|
|
18
|
+
|
|
19
|
+
/** Size variant */
|
|
20
|
+
size?: "default" | "lg";
|
|
21
|
+
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function SidebarMenuItem(props: SidebarMenuItemProps) {
|
|
26
|
+
const { children, isActive, size = "default", style, onPress, ...rest } = props;
|
|
27
|
+
const sidebar = useSidebar();
|
|
28
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
29
|
+
const styles = sidebar.styles;
|
|
30
|
+
|
|
31
|
+
const state: SidebarMenuButtonState = isActive ? "active" : isHovered ? "hovered" : "default";
|
|
32
|
+
|
|
33
|
+
const textStyle = StyleSheet.flatten([
|
|
34
|
+
styles?.menuItemText?.default,
|
|
35
|
+
styles?.menuItemText?.[state],
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
const iconProps = StyleSheet.flatten([
|
|
39
|
+
styles?.menuItemIcon?.default,
|
|
40
|
+
styles?.menuItemIcon?.[state],
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
const organizedChildren = useOrganizedChildren(children, textStyle, iconProps);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<Pressable
|
|
47
|
+
{...rest}
|
|
48
|
+
onPress={onPress}
|
|
49
|
+
onHoverIn={() => setIsHovered(true)}
|
|
50
|
+
onHoverOut={() => setIsHovered(false)}
|
|
51
|
+
style={[
|
|
52
|
+
styles?.menuItem?.default,
|
|
53
|
+
state !== "default" && styles?.menuItem?.[state],
|
|
54
|
+
size === "lg" && { minHeight: 48, paddingVertical: 8 },
|
|
55
|
+
style,
|
|
56
|
+
]}
|
|
57
|
+
>
|
|
58
|
+
{organizedChildren}
|
|
59
|
+
</Pressable>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, View, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarMenuSubProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
|
|
8
|
+
/** Whether the submenu is open (controlled) */
|
|
9
|
+
open?: boolean;
|
|
10
|
+
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function SidebarMenuSub(props: SidebarMenuSubProps) {
|
|
15
|
+
const { children, open = true, style } = props;
|
|
16
|
+
const sidebar = useSidebar();
|
|
17
|
+
|
|
18
|
+
if (!open) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return <View style={[sidebar.styles?.menuSub, style]}>{children}</View>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, View, type ViewStyle } from "react-native";
|
|
3
|
+
import { useSidebar } from "../context";
|
|
4
|
+
|
|
5
|
+
export interface SidebarMenuProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SidebarMenu(props: SidebarMenuProps) {
|
|
11
|
+
const { children, style } = props;
|
|
12
|
+
const sidebar = useSidebar();
|
|
13
|
+
|
|
14
|
+
return <View style={[sidebar.styles?.menu, style]}>{children}</View>;
|
|
15
|
+
}
|