@korsolutions/ui 0.0.77 → 0.0.80
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/menu/index.js +0 -4
- package/dist/module/components/menu/index.js.map +1 -1
- package/dist/module/components/menu/variants/default.js +0 -6
- package/dist/module/components/menu/variants/default.js.map +1 -1
- package/dist/module/hooks/use-color-scheme.js +34 -0
- package/dist/module/hooks/use-color-scheme.js.map +1 -0
- package/dist/module/themes/provider.js +8 -9
- package/dist/module/themes/provider.js.map +1 -1
- package/dist/typescript/src/components/menu/index.d.ts +0 -6
- package/dist/typescript/src/components/menu/index.d.ts.map +1 -1
- package/dist/typescript/src/components/menu/types.d.ts +0 -1
- package/dist/typescript/src/components/menu/types.d.ts.map +1 -1
- package/dist/typescript/src/components/menu/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/hooks/use-color-scheme.d.ts +10 -0
- package/dist/typescript/src/hooks/use-color-scheme.d.ts.map +1 -0
- package/dist/typescript/src/themes/provider.d.ts +4 -1
- package/dist/typescript/src/themes/provider.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/package.json +1 -1
- package/src/components/menu/index.ts +0 -6
- package/src/components/menu/types.ts +0 -2
- package/src/components/menu/variants/default.tsx +0 -6
- package/src/hooks/use-color-scheme.ts +44 -0
- package/src/themes/provider.tsx +9 -19
- package/src/themes/types.ts +5 -0
- package/dist/module/components/menu/components/menu-group.js +0 -18
- package/dist/module/components/menu/components/menu-group.js.map +0 -1
- package/dist/module/components/menu/components/menu-separator.js +0 -17
- package/dist/module/components/menu/components/menu-separator.js.map +0 -1
- package/dist/typescript/src/components/menu/components/menu-group.d.ts +0 -9
- package/dist/typescript/src/components/menu/components/menu-group.d.ts.map +0 -1
- package/dist/typescript/src/components/menu/components/menu-separator.d.ts +0 -8
- package/dist/typescript/src/components/menu/components/menu-separator.d.ts.map +0 -1
- package/src/components/menu/components/menu-group.tsx +0 -25
- package/src/components/menu/components/menu-separator.tsx +0 -22
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { MenuCheckboxItem } from "./components/menu-checkbox-item.js";
|
|
4
4
|
import { MenuContent } from "./components/menu-content.js";
|
|
5
|
-
import { MenuGroup } from "./components/menu-group.js";
|
|
6
5
|
import { MenuItem } from "./components/menu-item.js";
|
|
7
6
|
import { MenuLabel } from "./components/menu-label.js";
|
|
8
7
|
import { MenuOverlay } from "./components/menu-overlay.js";
|
|
@@ -10,7 +9,6 @@ import { MenuPortal } from "./components/menu-portal.js";
|
|
|
10
9
|
import { MenuRadioGroup } from "./components/menu-radio-group.js";
|
|
11
10
|
import { MenuRadioItem } from "./components/menu-radio-item.js";
|
|
12
11
|
import { MenuRoot } from "./components/menu-root.js";
|
|
13
|
-
import { MenuSeparator } from "./components/menu-separator.js";
|
|
14
12
|
import { MenuShortcut } from "./components/menu-shortcut.js";
|
|
15
13
|
import { MenuTrigger } from "./components/menu-trigger.js";
|
|
16
14
|
export const Menu = {
|
|
@@ -20,9 +18,7 @@ export const Menu = {
|
|
|
20
18
|
Overlay: MenuOverlay,
|
|
21
19
|
Content: MenuContent,
|
|
22
20
|
Item: MenuItem,
|
|
23
|
-
Group: MenuGroup,
|
|
24
21
|
Label: MenuLabel,
|
|
25
|
-
Separator: MenuSeparator,
|
|
26
22
|
CheckboxItem: MenuCheckboxItem,
|
|
27
23
|
RadioGroup: MenuRadioGroup,
|
|
28
24
|
RadioItem: MenuRadioItem,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MenuCheckboxItem","MenuContent","
|
|
1
|
+
{"version":3,"names":["MenuCheckboxItem","MenuContent","MenuItem","MenuLabel","MenuOverlay","MenuPortal","MenuRadioGroup","MenuRadioItem","MenuRoot","MenuShortcut","MenuTrigger","Menu","Root","Trigger","Portal","Overlay","Content","Item","Label","CheckboxItem","RadioGroup","RadioItem","Shortcut"],"sourceRoot":"../../../../src","sources":["components/menu/index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,oCAAiC;AAClE,SAASC,WAAW,QAAQ,8BAA2B;AACvD,SAASC,QAAQ,QAAQ,2BAAwB;AACjD,SAASC,SAAS,QAAQ,4BAAyB;AACnD,SAASC,WAAW,QAAQ,8BAA2B;AACvD,SAASC,UAAU,QAAQ,6BAA0B;AACrD,SAASC,cAAc,QAAQ,kCAA+B;AAC9D,SAASC,aAAa,QAAQ,iCAA8B;AAC5D,SAASC,QAAQ,QAAQ,2BAAwB;AACjD,SAASC,YAAY,QAAQ,+BAA4B;AACzD,SAASC,WAAW,QAAQ,8BAA2B;AAEvD,OAAO,MAAMC,IAAI,GAAG;EAClBC,IAAI,EAAEJ,QAAQ;EACdK,OAAO,EAAEH,WAAW;EACpBI,MAAM,EAAET,UAAU;EAClBU,OAAO,EAAEX,WAAW;EACpBY,OAAO,EAAEf,WAAW;EACpBgB,IAAI,EAAEf,QAAQ;EACdgB,KAAK,EAAEf,SAAS;EAChBgB,YAAY,EAAEnB,gBAAgB;EAC9BoB,UAAU,EAAEd,cAAc;EAC1Be,SAAS,EAAEd,aAAa;EACxBe,QAAQ,EAAEb;AACZ,CAAC","ignoreList":[]}
|
|
@@ -53,12 +53,6 @@ export const useMenuVariantDefault = () => {
|
|
|
53
53
|
fontWeight: "600",
|
|
54
54
|
color: colors.mutedForeground
|
|
55
55
|
},
|
|
56
|
-
separator: {
|
|
57
|
-
height: 1,
|
|
58
|
-
backgroundColor: colors.border,
|
|
59
|
-
marginVertical: 4,
|
|
60
|
-
marginHorizontal: 8
|
|
61
|
-
},
|
|
62
56
|
checkboxItem: {
|
|
63
57
|
default: {
|
|
64
58
|
flexDirection: "row",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useThemedStyles","useMenuVariantDefault","colors","radius","fontFamily","fontSize","overlay","content","overflow","backgroundColor","surface","borderRadius","borderWidth","borderColor","border","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","item","default","flexDirection","alignItems","paddingVertical","paddingHorizontal","gap","hovered","muted","itemText","color","foreground","itemIcon","size","label","fontWeight","mutedForeground","
|
|
1
|
+
{"version":3,"names":["useThemedStyles","useMenuVariantDefault","colors","radius","fontFamily","fontSize","overlay","content","overflow","backgroundColor","surface","borderRadius","borderWidth","borderColor","border","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","item","default","flexDirection","alignItems","paddingVertical","paddingHorizontal","gap","hovered","muted","itemText","color","foreground","itemIcon","size","label","fontWeight","mutedForeground","checkboxItem","disabled","opacity","selectionIndicator","strokeWidth","marginLeft","style","radioItem","shortcut"],"sourceRoot":"../../../../../src","sources":["components/menu/variants/default.tsx"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KAAkB;EACrD,OAAOD,eAAe,CACpB,CAAC;IAAEE,MAAM;IAAEC,MAAM;IAAEC,UAAU;IAAEC;EAAS,CAAC,MAAkB;IACzDC,OAAO,EAAE,CAAC,CAAC;IACXC,OAAO,EAAE;MACPC,QAAQ,EAAE,QAAQ;MAClBC,eAAe,EAAEP,MAAM,CAACQ,OAAO;MAC/BC,YAAY,EAAER,MAAM;MACpBS,WAAW,EAAE,CAAC;MACdC,WAAW,EAAEX,MAAM,CAACY,MAAM;MAC1BC,WAAW,EAAE,MAAM;MACnBC,YAAY,EAAE;QAAEC,KAAK,EAAE,CAAC;QAAEC,MAAM,EAAE;MAAE,CAAC;MACrCC,aAAa,EAAE,IAAI;MACnBC,YAAY,EAAE,EAAE;MAChBC,SAAS,EAAE;IACb,CAAC;IACDC,IAAI,EAAE;MACJC,OAAO,EAAE;QACPC,aAAa,EAAE,KAAK;QACpBC,UAAU,EAAE,QAAQ;QACpBC,eAAe,EAAE,EAAE;QACnBC,iBAAiB,EAAE,EAAE;QACrBC,GAAG,EAAE;MACP,CAAC;MACDC,OAAO,EAAE;QACPp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AAe,EAAEP,MAAM,CAAC4B;MAC1B,CAAC;MACDU,QAAQ,EAAE;QACRC,OAAO,EAAE;MACX;IACF,CAAC;IACDM,QAAQ,EAAE;MACR1C,QAAQ,EAAEA,QAAQ,GAAG,IAAI;MACzBD,UAAU,EAAEA,UAAU;MACtB4B,KAAK,EAAE9B,MAAM,CAACoC;IAChB;EACF,CAAC,CACH,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { useColorScheme as useSystemColorScheme } from "react-native";
|
|
5
|
+
const getColorScheme = (storageGetCallback, systemColorScheme) => {
|
|
6
|
+
if (storageGetCallback) {
|
|
7
|
+
const storedScheme = storageGetCallback();
|
|
8
|
+
if (storedScheme) return storedScheme;
|
|
9
|
+
}
|
|
10
|
+
if (systemColorScheme) {
|
|
11
|
+
return systemColorScheme === "dark" ? "dark" : "light";
|
|
12
|
+
}
|
|
13
|
+
return "light";
|
|
14
|
+
};
|
|
15
|
+
export function useColorScheme({
|
|
16
|
+
colorSchemeStorage
|
|
17
|
+
}) {
|
|
18
|
+
const systemColorScheme = useSystemColorScheme();
|
|
19
|
+
const [_colorScheme, _setColorScheme] = useState(getColorScheme(colorSchemeStorage?.get, systemColorScheme));
|
|
20
|
+
const setColorScheme = scheme => {
|
|
21
|
+
_setColorScheme(scheme);
|
|
22
|
+
colorSchemeStorage?.set(scheme);
|
|
23
|
+
};
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const newScheme = getColorScheme(colorSchemeStorage?.get, systemColorScheme);
|
|
26
|
+
if (newScheme === _colorScheme) return;
|
|
27
|
+
setColorScheme(newScheme);
|
|
28
|
+
}, [systemColorScheme]);
|
|
29
|
+
return {
|
|
30
|
+
colorScheme: _colorScheme,
|
|
31
|
+
setColorScheme
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=use-color-scheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useState","useColorScheme","useSystemColorScheme","getColorScheme","storageGetCallback","systemColorScheme","storedScheme","colorSchemeStorage","_colorScheme","_setColorScheme","get","setColorScheme","scheme","set","newScheme","colorScheme"],"sourceRoot":"../../../src","sources":["hooks/use-color-scheme.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,cAAc,IAAIC,oBAAoB,QAAQ,cAAc;AAGrE,MAAMC,cAAc,GAAGA,CACrBC,kBAA6C,EAC7CC,iBAA2D,KAC3C;EAChB,IAAID,kBAAkB,EAAE;IACtB,MAAME,YAAY,GAAGF,kBAAkB,CAAC,CAAC;IACzC,IAAIE,YAAY,EAAE,OAAOA,YAAY;EACvC;EACA,IAAID,iBAAiB,EAAE;IACrB,OAAOA,iBAAiB,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;EACxD;EACA,OAAO,OAAO;AAChB,CAAC;AAMD,OAAO,SAASJ,cAAcA,CAAC;EAAEM;AAAwC,CAAC,EAAE;EAC1E,MAAMF,iBAAiB,GAAGH,oBAAoB,CAAC,CAAC;EAChD,MAAM,CAACM,YAAY,EAAEC,eAAe,CAAC,GAAGT,QAAQ,CAC9CG,cAAc,CAACI,kBAAkB,EAAEG,GAAG,EAAEL,iBAAiB,CAC3D,CAAC;EAED,MAAMM,cAAc,GAAIC,MAAmB,IAAK;IAC9CH,eAAe,CAACG,MAAM,CAAC;IACvBL,kBAAkB,EAAEM,GAAG,CAACD,MAAM,CAAC;EACjC,CAAC;EAEDb,SAAS,CAAC,MAAM;IACd,MAAMe,SAAS,GAAGX,cAAc,CAC9BI,kBAAkB,EAAEG,GAAG,EACvBL,iBACF,CAAC;IACD,IAAIS,SAAS,KAAKN,YAAY,EAAE;IAChCG,cAAc,CAACG,SAAS,CAAC;EAC3B,CAAC,EAAE,CAACT,iBAAiB,CAAC,CAAC;EAEvB,OAAO;IAAEU,WAAW,EAAEP,YAAY;IAAEG;EAAe,CAAC;AACtD","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { createContext, useContext
|
|
4
|
-
import { useColorScheme } from "
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { useColorScheme } from "../hooks/use-color-scheme.js";
|
|
5
5
|
import { defaultThemeAssets } from "./default/index.js";
|
|
6
6
|
import { mergeThemeAssets } from "./utils.js";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -12,15 +12,14 @@ export const ThemeProvider = props => {
|
|
|
12
12
|
theme,
|
|
13
13
|
components
|
|
14
14
|
} = props;
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const {
|
|
16
|
+
colorScheme,
|
|
17
|
+
setColorScheme
|
|
18
|
+
} = useColorScheme({
|
|
19
|
+
colorSchemeStorage: components?.colorScheme?.storage
|
|
20
|
+
});
|
|
17
21
|
const themeAssets = theme ? mergeThemeAssets(defaultThemeAssets, theme) : defaultThemeAssets;
|
|
18
22
|
const colors = themeAssets.colors[colorScheme];
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (systemColorScheme) {
|
|
21
|
-
setColorScheme(systemColorScheme === "dark" ? "dark" : "light");
|
|
22
|
-
}
|
|
23
|
-
}, [systemColorScheme]);
|
|
24
23
|
return /*#__PURE__*/_jsx(ThemeContext.Provider, {
|
|
25
24
|
value: {
|
|
26
25
|
colorScheme,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useContext","
|
|
1
|
+
{"version":3,"names":["createContext","useContext","useColorScheme","defaultThemeAssets","mergeThemeAssets","jsx","_jsx","ThemeContext","ThemeProvider","props","children","theme","components","colorScheme","setColorScheme","colorSchemeStorage","storage","themeAssets","colors","Provider","value","radius","fontFamily","letterSpacing","fontSize","useTheme","context","Error","useComponentsConfig"],"sourceRoot":"../../../src","sources":["themes/provider.ts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AAmB,GAAGA,CAAA,KAAM;EACvC,MAAMF,OAAO,GAAGzB,UAAU,CAACM,YAAY,CAAC;EACxC,IAAI,CAACmB,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,yDAAyD,CAAC;EAC5E;EACA,OAAOD,OAAO,CAACd,UAAU;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MenuCheckboxItem } from "./components/menu-checkbox-item";
|
|
2
2
|
import { MenuContent } from "./components/menu-content";
|
|
3
|
-
import { MenuGroup } from "./components/menu-group";
|
|
4
3
|
import { MenuItem } from "./components/menu-item";
|
|
5
4
|
import { MenuLabel } from "./components/menu-label";
|
|
6
5
|
import { MenuOverlay } from "./components/menu-overlay";
|
|
@@ -8,7 +7,6 @@ import { MenuPortal } from "./components/menu-portal";
|
|
|
8
7
|
import { MenuRadioGroup } from "./components/menu-radio-group";
|
|
9
8
|
import { MenuRadioItem } from "./components/menu-radio-item";
|
|
10
9
|
import { MenuRoot } from "./components/menu-root";
|
|
11
|
-
import { MenuSeparator } from "./components/menu-separator";
|
|
12
10
|
import { MenuShortcut } from "./components/menu-shortcut";
|
|
13
11
|
export declare const Menu: {
|
|
14
12
|
Root: typeof MenuRoot;
|
|
@@ -17,9 +15,7 @@ export declare const Menu: {
|
|
|
17
15
|
Overlay: typeof MenuOverlay;
|
|
18
16
|
Content: typeof MenuContent;
|
|
19
17
|
Item: typeof MenuItem;
|
|
20
|
-
Group: typeof MenuGroup;
|
|
21
18
|
Label: typeof MenuLabel;
|
|
22
|
-
Separator: typeof MenuSeparator;
|
|
23
19
|
CheckboxItem: typeof MenuCheckboxItem;
|
|
24
20
|
RadioGroup: typeof MenuRadioGroup;
|
|
25
21
|
RadioItem: typeof MenuRadioItem;
|
|
@@ -27,7 +23,6 @@ export declare const Menu: {
|
|
|
27
23
|
};
|
|
28
24
|
export type { MenuCheckboxItemProps } from "./components/menu-checkbox-item";
|
|
29
25
|
export type { MenuContentProps } from "./components/menu-content";
|
|
30
|
-
export type { MenuGroupProps } from "./components/menu-group";
|
|
31
26
|
export type { MenuItemProps } from "./components/menu-item";
|
|
32
27
|
export type { MenuLabelProps } from "./components/menu-label";
|
|
33
28
|
export type { MenuOverlayProps } from "./components/menu-overlay";
|
|
@@ -35,7 +30,6 @@ export type { MenuPortalProps } from "./components/menu-portal";
|
|
|
35
30
|
export type { MenuRadioGroupProps } from "./components/menu-radio-group";
|
|
36
31
|
export type { MenuRadioItemProps } from "./components/menu-radio-item";
|
|
37
32
|
export type { MenuRootProps } from "./components/menu-root";
|
|
38
|
-
export type { MenuSeparatorProps } from "./components/menu-separator";
|
|
39
33
|
export type { MenuShortcutProps } from "./components/menu-shortcut";
|
|
40
34
|
export type { MenuTriggerProps } from "./components/menu-trigger";
|
|
41
35
|
export type { MenuStyles } from "./types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,eAAO,MAAM,IAAI;;;;;;;;;;;;CAYhB,CAAC;AAEF,YAAY,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC7E,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,YAAY,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,YAAY,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -14,7 +14,6 @@ export interface MenuStyles {
|
|
|
14
14
|
overlay?: MenuOverlayProps["style"];
|
|
15
15
|
group?: StyleProp<ViewStyle>;
|
|
16
16
|
label?: StyleProp<TextStyle>;
|
|
17
|
-
separator?: StyleProp<ViewStyle>;
|
|
18
17
|
checkboxItem?: Partial<Record<MenuCheckboxItemState, StyleProp<ViewStyle>>>;
|
|
19
18
|
selectionIndicator?: TextStyle & SvgProps;
|
|
20
19
|
radioGroup?: StyleProp<ViewStyle>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/menu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KA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,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu/variants/default.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAC;AAGxC,eAAO,MAAM,qBAAqB,QAAO,UA6FxC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ColorScheme, StorageClient } from "../themes/types";
|
|
2
|
+
interface UseColorSchemeProps {
|
|
3
|
+
colorSchemeStorage?: StorageClient<ColorScheme>;
|
|
4
|
+
}
|
|
5
|
+
export declare function useColorScheme({ colorSchemeStorage }: UseColorSchemeProps): {
|
|
6
|
+
colorScheme: ColorScheme;
|
|
7
|
+
setColorScheme: (scheme: ColorScheme) => void;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=use-color-scheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-color-scheme.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-color-scheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAgBlE,UAAU,mBAAmB;IAC3B,kBAAkB,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACjD;AAED,wBAAgB,cAAc,CAAC,EAAE,kBAAkB,EAAE,EAAE,mBAAmB;;6BAMxC,WAAW;EAe5C"}
|
|
@@ -2,7 +2,7 @@ import { type PropsWithChildren } from "react";
|
|
|
2
2
|
import type { ToastVariants } from "../components/toast/variants";
|
|
3
3
|
import type { SvgProps } from "../types/props.types";
|
|
4
4
|
import type { DeepPartial } from "../types/util.types";
|
|
5
|
-
import type { Colors, ColorScheme, FontFamily, FontSize, LetterSpacing, Radius, ThemeAssets } from "./types";
|
|
5
|
+
import type { Colors, ColorScheme, FontFamily, FontSize, LetterSpacing, Radius, StorageClient, ThemeAssets } from "./types";
|
|
6
6
|
interface ThemeContext {
|
|
7
7
|
colors: Colors;
|
|
8
8
|
radius: Radius;
|
|
@@ -14,6 +14,9 @@ interface ThemeContext {
|
|
|
14
14
|
components?: ComponentsConfig;
|
|
15
15
|
}
|
|
16
16
|
export interface ComponentsConfig {
|
|
17
|
+
colorScheme?: {
|
|
18
|
+
storage?: StorageClient<ColorScheme>;
|
|
19
|
+
};
|
|
17
20
|
toast?: {
|
|
18
21
|
icons?: Partial<Record<keyof typeof ToastVariants, React.ComponentType<SvgProps>>>;
|
|
19
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/themes/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/themes/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EACV,MAAM,EACN,WAAW,EACX,UAAU,EACV,QAAQ,EACR,aAAa,EACb,MAAM,EACN,aAAa,EACb,WAAW,EACZ,MAAM,SAAS,CAAC;AAGjB,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE;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AAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;CACb;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAChC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AACnC,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC7B,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MenuCheckboxItem } from "./components/menu-checkbox-item";
|
|
2
2
|
import { MenuContent } from "./components/menu-content";
|
|
3
|
-
import { MenuGroup } from "./components/menu-group";
|
|
4
3
|
import { MenuItem } from "./components/menu-item";
|
|
5
4
|
import { MenuLabel } from "./components/menu-label";
|
|
6
5
|
import { MenuOverlay } from "./components/menu-overlay";
|
|
@@ -8,7 +7,6 @@ import { MenuPortal } from "./components/menu-portal";
|
|
|
8
7
|
import { MenuRadioGroup } from "./components/menu-radio-group";
|
|
9
8
|
import { MenuRadioItem } from "./components/menu-radio-item";
|
|
10
9
|
import { MenuRoot } from "./components/menu-root";
|
|
11
|
-
import { MenuSeparator } from "./components/menu-separator";
|
|
12
10
|
import { MenuShortcut } from "./components/menu-shortcut";
|
|
13
11
|
import { MenuTrigger } from "./components/menu-trigger";
|
|
14
12
|
|
|
@@ -19,9 +17,7 @@ export const Menu = {
|
|
|
19
17
|
Overlay: MenuOverlay,
|
|
20
18
|
Content: MenuContent,
|
|
21
19
|
Item: MenuItem,
|
|
22
|
-
Group: MenuGroup,
|
|
23
20
|
Label: MenuLabel,
|
|
24
|
-
Separator: MenuSeparator,
|
|
25
21
|
CheckboxItem: MenuCheckboxItem,
|
|
26
22
|
RadioGroup: MenuRadioGroup,
|
|
27
23
|
RadioItem: MenuRadioItem,
|
|
@@ -30,7 +26,6 @@ export const Menu = {
|
|
|
30
26
|
|
|
31
27
|
export type { MenuCheckboxItemProps } from "./components/menu-checkbox-item";
|
|
32
28
|
export type { MenuContentProps } from "./components/menu-content";
|
|
33
|
-
export type { MenuGroupProps } from "./components/menu-group";
|
|
34
29
|
export type { MenuItemProps } from "./components/menu-item";
|
|
35
30
|
export type { MenuLabelProps } from "./components/menu-label";
|
|
36
31
|
export type { MenuOverlayProps } from "./components/menu-overlay";
|
|
@@ -38,7 +33,6 @@ export type { MenuPortalProps } from "./components/menu-portal";
|
|
|
38
33
|
export type { MenuRadioGroupProps } from "./components/menu-radio-group";
|
|
39
34
|
export type { MenuRadioItemProps } from "./components/menu-radio-item";
|
|
40
35
|
export type { MenuRootProps } from "./components/menu-root";
|
|
41
|
-
export type { MenuSeparatorProps } from "./components/menu-separator";
|
|
42
36
|
export type { MenuShortcutProps } from "./components/menu-shortcut";
|
|
43
37
|
export type { MenuTriggerProps } from "./components/menu-trigger";
|
|
44
38
|
export type { MenuStyles } from "./types";
|
|
@@ -18,10 +18,8 @@ export interface MenuStyles {
|
|
|
18
18
|
itemText?: StyleProp<TextStyle>;
|
|
19
19
|
itemIcon?: IconProps;
|
|
20
20
|
overlay?: MenuOverlayProps["style"];
|
|
21
|
-
|
|
22
21
|
group?: StyleProp<ViewStyle>;
|
|
23
22
|
label?: StyleProp<TextStyle>;
|
|
24
|
-
separator?: StyleProp<ViewStyle>;
|
|
25
23
|
checkboxItem?: Partial<Record<MenuCheckboxItemState, StyleProp<ViewStyle>>>;
|
|
26
24
|
selectionIndicator?: TextStyle & SvgProps;
|
|
27
25
|
radioGroup?: StyleProp<ViewStyle>;
|
|
@@ -46,12 +46,6 @@ export const useMenuVariantDefault = (): MenuStyles => {
|
|
|
46
46
|
fontWeight: "600",
|
|
47
47
|
color: colors.mutedForeground,
|
|
48
48
|
},
|
|
49
|
-
separator: {
|
|
50
|
-
height: 1,
|
|
51
|
-
backgroundColor: colors.border,
|
|
52
|
-
marginVertical: 4,
|
|
53
|
-
marginHorizontal: 8,
|
|
54
|
-
},
|
|
55
49
|
checkboxItem: {
|
|
56
50
|
default: {
|
|
57
51
|
flexDirection: "row",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { useColorScheme as useSystemColorScheme } from "react-native";
|
|
3
|
+
import type { ColorScheme, StorageClient } from "../themes/types";
|
|
4
|
+
|
|
5
|
+
const getColorScheme = (
|
|
6
|
+
storageGetCallback?: () => ColorScheme | null,
|
|
7
|
+
systemColorScheme?: ReturnType<typeof useSystemColorScheme>,
|
|
8
|
+
): ColorScheme => {
|
|
9
|
+
if (storageGetCallback) {
|
|
10
|
+
const storedScheme = storageGetCallback();
|
|
11
|
+
if (storedScheme) return storedScheme;
|
|
12
|
+
}
|
|
13
|
+
if (systemColorScheme) {
|
|
14
|
+
return systemColorScheme === "dark" ? "dark" : "light";
|
|
15
|
+
}
|
|
16
|
+
return "light";
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
interface UseColorSchemeProps {
|
|
20
|
+
colorSchemeStorage?: StorageClient<ColorScheme>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function useColorScheme({ colorSchemeStorage }: UseColorSchemeProps) {
|
|
24
|
+
const systemColorScheme = useSystemColorScheme();
|
|
25
|
+
const [_colorScheme, _setColorScheme] = useState<ColorScheme>(
|
|
26
|
+
getColorScheme(colorSchemeStorage?.get, systemColorScheme),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const setColorScheme = (scheme: ColorScheme) => {
|
|
30
|
+
_setColorScheme(scheme);
|
|
31
|
+
colorSchemeStorage?.set(scheme);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const newScheme = getColorScheme(
|
|
36
|
+
colorSchemeStorage?.get,
|
|
37
|
+
systemColorScheme,
|
|
38
|
+
);
|
|
39
|
+
if (newScheme === _colorScheme) return;
|
|
40
|
+
setColorScheme(newScheme);
|
|
41
|
+
}, [systemColorScheme]);
|
|
42
|
+
|
|
43
|
+
return { colorScheme: _colorScheme, setColorScheme };
|
|
44
|
+
}
|
package/src/themes/provider.tsx
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createContext,
|
|
3
|
-
type PropsWithChildren,
|
|
4
|
-
useContext,
|
|
5
|
-
useEffect,
|
|
6
|
-
useState,
|
|
7
|
-
} from "react";
|
|
8
|
-
import { useColorScheme } from "react-native";
|
|
1
|
+
import { createContext, type PropsWithChildren, useContext } from "react";
|
|
9
2
|
import type { ToastVariants } from "../components/toast/variants";
|
|
3
|
+
import { useColorScheme } from "../hooks/use-color-scheme";
|
|
10
4
|
import type { SvgProps } from "../types/props.types";
|
|
11
5
|
import type { DeepPartial } from "../types/util.types";
|
|
12
6
|
import { defaultThemeAssets } from "./default";
|
|
@@ -17,6 +11,7 @@ import type {
|
|
|
17
11
|
FontSize,
|
|
18
12
|
LetterSpacing,
|
|
19
13
|
Radius,
|
|
14
|
+
StorageClient,
|
|
20
15
|
ThemeAssets,
|
|
21
16
|
} from "./types";
|
|
22
17
|
import { mergeThemeAssets } from "./utils";
|
|
@@ -33,6 +28,9 @@ interface ThemeContext {
|
|
|
33
28
|
}
|
|
34
29
|
|
|
35
30
|
export interface ComponentsConfig {
|
|
31
|
+
colorScheme?: {
|
|
32
|
+
storage?: StorageClient<ColorScheme>;
|
|
33
|
+
};
|
|
36
34
|
toast?: {
|
|
37
35
|
icons?: Partial<
|
|
38
36
|
Record<keyof typeof ToastVariants, React.ComponentType<SvgProps>>
|
|
@@ -56,11 +54,9 @@ export interface ThemeProviderProps extends PropsWithChildren {
|
|
|
56
54
|
|
|
57
55
|
export const ThemeProvider = (props: ThemeProviderProps) => {
|
|
58
56
|
const { children, theme, components } = props;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
systemColorScheme === "dark" ? "dark" : "light",
|
|
63
|
-
);
|
|
57
|
+
const { colorScheme, setColorScheme } = useColorScheme({
|
|
58
|
+
colorSchemeStorage: components?.colorScheme?.storage,
|
|
59
|
+
});
|
|
64
60
|
|
|
65
61
|
const themeAssets = theme
|
|
66
62
|
? mergeThemeAssets(defaultThemeAssets, theme)
|
|
@@ -68,12 +64,6 @@ export const ThemeProvider = (props: ThemeProviderProps) => {
|
|
|
68
64
|
|
|
69
65
|
const colors = themeAssets.colors[colorScheme];
|
|
70
66
|
|
|
71
|
-
useEffect(() => {
|
|
72
|
-
if (systemColorScheme) {
|
|
73
|
-
setColorScheme(systemColorScheme === "dark" ? "dark" : "light");
|
|
74
|
-
}
|
|
75
|
-
}, [systemColorScheme]);
|
|
76
|
-
|
|
77
67
|
return (
|
|
78
68
|
<ThemeContext.Provider
|
|
79
69
|
value={{
|
package/src/themes/types.ts
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { View } from "react-native";
|
|
5
|
-
import { useMenu } from "../context.js";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
export function MenuGroup(props) {
|
|
8
|
-
const menu = useMenu();
|
|
9
|
-
const composedStyle = [menu.styles?.group, props.style];
|
|
10
|
-
const Component = props.render ?? View;
|
|
11
|
-
return /*#__PURE__*/_jsx(Component, {
|
|
12
|
-
...props,
|
|
13
|
-
role: "group",
|
|
14
|
-
style: composedStyle,
|
|
15
|
-
children: props.children
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=menu-group.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","useMenu","jsx","_jsx","MenuGroup","props","menu","composedStyle","styles","group","style","Component","render","role","children"],"sourceRoot":"../../../../../src","sources":["components/menu/components/menu-group.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAwC,cAAc;AACnE,SAASC,OAAO,QAAQ,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQrC,OAAO,SAASC,SAASA,CAACC,KAAqB,EAAE;EAC/C,MAAMC,IAAI,GAAGL,OAAO,CAAC,CAAC;EACtB,MAAMM,aAAa,GAAG,CAACD,IAAI,CAACE,MAAM,EAAEC,KAAK,EAAEJ,KAAK,CAACK,KAAK,CAAC;EAEvD,MAAMC,SAAS,GAAGN,KAAK,CAACO,MAAM,IAAIZ,IAAI;EACtC,oBACEG,IAAA,CAACQ,SAAS;IAAA,GACJN,KAAK;IACTQ,IAAI,EAAC,OAAO;IACZH,KAAK,EAAEH,aAAc;IAAAO,QAAA,EAEpBT,KAAK,CAACS;EAAQ,CACN,CAAC;AAEhB","ignoreList":[]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { View } from "react-native";
|
|
5
|
-
import { useMenu } from "../context.js";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
export function MenuSeparator(props) {
|
|
8
|
-
const menu = useMenu();
|
|
9
|
-
const composedStyle = [menu.styles?.separator, props.style];
|
|
10
|
-
const Component = props.render ?? View;
|
|
11
|
-
return /*#__PURE__*/_jsx(Component, {
|
|
12
|
-
...props,
|
|
13
|
-
role: "separator",
|
|
14
|
-
style: composedStyle
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=menu-separator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","useMenu","jsx","_jsx","MenuSeparator","props","menu","composedStyle","styles","separator","style","Component","render","role"],"sourceRoot":"../../../../../src","sources":["components/menu/components/menu-separator.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAwC,cAAc;AACnE,SAASC,OAAO,QAAQ,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAOrC,OAAO,SAASC,aAAaA,CAACC,KAAyB,EAAE;EACvD,MAAMC,IAAI,GAAGL,OAAO,CAAC,CAAC;EACtB,MAAMM,aAAa,GAAG,CAACD,IAAI,CAACE,MAAM,EAAEC,SAAS,EAAEJ,KAAK,CAACK,KAAK,CAAC;EAE3D,MAAMC,SAAS,GAAGN,KAAK,CAACO,MAAM,IAAIZ,IAAI;EACtC,oBACEG,IAAA,CAACQ,SAAS;IAAA,GACJN,KAAK;IACTQ,IAAI,EAAC,WAAW;IAChBH,KAAK,EAAEH;EAAc,CACtB,CAAC;AAEN","ignoreList":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
-
export interface MenuGroupProps {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
render?: (props: MenuGroupProps) => React.ReactNode;
|
|
6
|
-
style?: StyleProp<ViewStyle>;
|
|
7
|
-
}
|
|
8
|
-
export declare function MenuGroup(props: MenuGroupProps): React.JSX.Element;
|
|
9
|
-
//# sourceMappingURL=menu-group.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menu-group.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu/components/menu-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,KAAK,CAAC,SAAS,CAAC;IACpD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qBAc9C"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
-
export interface MenuSeparatorProps {
|
|
4
|
-
render?: (props: MenuSeparatorProps) => React.ReactNode;
|
|
5
|
-
style?: StyleProp<ViewStyle>;
|
|
6
|
-
}
|
|
7
|
-
export declare function MenuSeparator(props: MenuSeparatorProps): React.JSX.Element;
|
|
8
|
-
//# sourceMappingURL=menu-separator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menu-separator.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu/components/menu-separator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,KAAK,CAAC,SAAS,CAAC;IACxD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBAYtD"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View, type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
-
import { useMenu } from "../context";
|
|
4
|
-
|
|
5
|
-
export interface MenuGroupProps {
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
render?: (props: MenuGroupProps) => React.ReactNode;
|
|
8
|
-
style?: StyleProp<ViewStyle>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function MenuGroup(props: MenuGroupProps) {
|
|
12
|
-
const menu = useMenu();
|
|
13
|
-
const composedStyle = [menu.styles?.group, props.style];
|
|
14
|
-
|
|
15
|
-
const Component = props.render ?? View;
|
|
16
|
-
return (
|
|
17
|
-
<Component
|
|
18
|
-
{...props}
|
|
19
|
-
role="group"
|
|
20
|
-
style={composedStyle}
|
|
21
|
-
>
|
|
22
|
-
{props.children}
|
|
23
|
-
</Component>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View, type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
-
import { useMenu } from "../context";
|
|
4
|
-
|
|
5
|
-
export interface MenuSeparatorProps {
|
|
6
|
-
render?: (props: MenuSeparatorProps) => React.ReactNode;
|
|
7
|
-
style?: StyleProp<ViewStyle>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function MenuSeparator(props: MenuSeparatorProps) {
|
|
11
|
-
const menu = useMenu();
|
|
12
|
-
const composedStyle = [menu.styles?.separator, props.style];
|
|
13
|
-
|
|
14
|
-
const Component = props.render ?? View;
|
|
15
|
-
return (
|
|
16
|
-
<Component
|
|
17
|
-
{...props}
|
|
18
|
-
role="separator"
|
|
19
|
-
style={composedStyle}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
}
|