@newtonedev/components 0.1.20 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -743,25 +743,47 @@ var Text3 = Object.assign(TextBase, {
743
743
  Underline: TextUnderline,
744
744
  Highlight: TextHighlight
745
745
  });
746
- var styles = StyleSheet.create({
746
+ var baseStyles = StyleSheet.create({
747
747
  root: {
748
748
  flex: 1,
749
+ flexDirection: "row",
750
+ ...Platform.OS === "web" ? { height: "100vh", overflow: "hidden" } : {}
751
+ },
752
+ navigation: {
753
+ width: 256,
754
+ flexShrink: 0,
749
755
  flexDirection: "column",
750
- ...Platform.OS === "web" ? { minHeight: "100vh" } : {}
756
+ overflow: "hidden"
751
757
  },
752
- body: {
753
- flex: 1,
754
- flexDirection: "row"
758
+ navHeader: {
759
+ flexShrink: 0,
760
+ height: 64
755
761
  },
756
762
  content: {
757
- flex: 1
763
+ flex: 1,
764
+ flexDirection: "column",
765
+ overflow: "hidden"
766
+ },
767
+ header: {
768
+ flexShrink: 0,
769
+ height: 64,
770
+ ...Platform.OS === "web" ? { position: "sticky", top: 0, zIndex: 10 } : {}
771
+ },
772
+ navFooter: {
773
+ flexShrink: 0
774
+ },
775
+ footer: {
776
+ flexShrink: 0
758
777
  }
759
778
  });
760
779
  function Page({
761
780
  children,
762
781
  scheme,
763
- navbar,
764
- sidebar,
782
+ header,
783
+ navHeader,
784
+ navFooter,
785
+ footer,
786
+ navContent,
765
787
  testID,
766
788
  nativeID,
767
789
  ref,
@@ -778,6 +800,37 @@ function Page({
778
800
  activeScheme: scheme
779
801
  };
780
802
  }, [scheme, themeCtx]);
803
+ const resolvedConfig = schemeThemeCtx?.config ?? themeCtx.config;
804
+ const { mode, gamut } = themeCtx;
805
+ const { dividerBg, sunkenBg, groundedBg } = useMemo(() => {
806
+ const groundedTokens = computeTokens(
807
+ resolvedConfig.colorSystem,
808
+ mode,
809
+ gamut,
810
+ "grounded",
811
+ resolvedConfig.spacing,
812
+ resolvedConfig.radius,
813
+ resolvedConfig.typography,
814
+ resolvedConfig.icons,
815
+ resolvedConfig.themeMappings
816
+ );
817
+ const sunkenTokens = computeTokens(
818
+ resolvedConfig.colorSystem,
819
+ mode,
820
+ gamut,
821
+ "sunken",
822
+ resolvedConfig.spacing,
823
+ resolvedConfig.radius,
824
+ resolvedConfig.typography,
825
+ resolvedConfig.icons,
826
+ resolvedConfig.themeMappings
827
+ );
828
+ return {
829
+ dividerBg: groundedTokens.colors.primary.main.divider,
830
+ sunkenBg: sunkenTokens.colors.primary.main.background,
831
+ groundedBg: groundedTokens.colors.primary.main.background
832
+ };
833
+ }, [resolvedConfig, mode, gamut]);
781
834
  const userStyles = Array.isArray(style) ? style : style ? [style] : [];
782
835
  const content = /* @__PURE__ */ React19.createElement(
783
836
  View,
@@ -786,17 +839,17 @@ function Page({
786
839
  testID,
787
840
  nativeID,
788
841
  accessibilityRole: "none",
789
- style: [styles.root, ...userStyles]
842
+ style: [baseStyles.root, { backgroundColor: dividerBg, gap: 1 }, ...userStyles]
790
843
  },
791
- navbar,
792
- sidebar ? /* @__PURE__ */ React19.createElement(View, { style: styles.body }, sidebar, /* @__PURE__ */ React19.createElement(View, { style: styles.content }, children)) : children
844
+ navHeader || navContent || navFooter ? /* @__PURE__ */ React19.createElement(View, { style: [baseStyles.navigation, { backgroundColor: dividerBg, gap: 1 }] }, navHeader ? /* @__PURE__ */ React19.createElement(View, { style: [baseStyles.navHeader, { backgroundColor: sunkenBg }] }, navHeader) : null, /* @__PURE__ */ React19.createElement(View, { style: { flex: 1, backgroundColor: sunkenBg, overflow: "hidden" } }, navContent), navFooter ? /* @__PURE__ */ React19.createElement(View, { style: [baseStyles.navFooter, { backgroundColor: sunkenBg }] }, navFooter) : null) : null,
845
+ /* @__PURE__ */ React19.createElement(View, { style: [baseStyles.content, { backgroundColor: dividerBg, gap: 1 }] }, header ? /* @__PURE__ */ React19.createElement(View, { style: [baseStyles.header, { backgroundColor: groundedBg }] }, header) : null, /* @__PURE__ */ React19.createElement(View, { style: { flex: 1, backgroundColor: groundedBg, overflow: "hidden" } }, children), footer ? /* @__PURE__ */ React19.createElement(View, { style: [baseStyles.footer, { backgroundColor: groundedBg }] }, footer) : null)
793
846
  );
794
847
  if (schemeThemeCtx) {
795
848
  return /* @__PURE__ */ React19.createElement(_ThemeContext.Provider, { value: schemeThemeCtx }, content);
796
849
  }
797
850
  return content;
798
851
  }
799
- var styles2 = StyleSheet.create({
852
+ var styles = StyleSheet.create({
800
853
  root: {
801
854
  flex: 1
802
855
  },
@@ -818,8 +871,8 @@ function Viewport({
818
871
  ref,
819
872
  testID,
820
873
  nativeID,
821
- style: styles2.root,
822
- contentContainerStyle: [styles2.content, ...userStyles]
874
+ style: styles.root,
875
+ contentContainerStyle: [styles.content, ...userStyles]
823
876
  },
824
877
  children
825
878
  );
@@ -1777,9 +1830,6 @@ function ContentCard({
1777
1830
  {
1778
1831
  elevation: variant === "elevated" ? 2 : void 0,
1779
1832
  appearance: variant === "elevated" ? "tinted" : void 0,
1780
- href,
1781
- onPress,
1782
- disabled,
1783
1833
  padding,
1784
1834
  gap,
1785
1835
  style: [
@@ -3050,49 +3100,27 @@ function AppShell({ sidebar, children }) {
3050
3100
  );
3051
3101
  return /* @__PURE__ */ React19.createElement(View, { style: styles3.container }, sidebar, /* @__PURE__ */ React19.createElement(View, { style: styles3.main }, children));
3052
3102
  }
3053
- function getSidebarStyles({ tokens, width, bordered, theme = "primary", appearance = "main" }) {
3054
- const at = tokens.colors[theme][appearance];
3055
- const borderColor = at.fontSecondary;
3056
- return StyleSheet.create({
3057
- container: {
3058
- width,
3059
- flexShrink: 0,
3060
- flexDirection: "column",
3061
- backgroundColor: at.background,
3062
- borderRightWidth: bordered ? 1 : 0,
3063
- borderRightColor: borderColor
3064
- },
3065
- header: {
3066
- flexShrink: 0,
3067
- borderBottomWidth: 1,
3068
- borderBottomColor: borderColor
3069
- },
3070
- body: {
3071
- flex: 1
3072
- },
3073
- footer: {
3074
- flexShrink: 0,
3075
- borderTopWidth: 1,
3076
- borderTopColor: borderColor
3077
- }
3078
- });
3079
- }
3080
-
3081
- // src/composites/layout/Sidebar/Sidebar.tsx
3103
+ var styles2 = StyleSheet.create({
3104
+ container: {
3105
+ flex: 1,
3106
+ flexDirection: "column"
3107
+ },
3108
+ body: {
3109
+ flex: 1,
3110
+ padding: 8
3111
+ },
3112
+ bodyContent: {
3113
+ gap: 8
3114
+ },
3115
+ footer: {
3116
+ flexShrink: 0
3117
+ }
3118
+ });
3082
3119
  function Sidebar({
3083
3120
  children,
3084
- header,
3085
- footer,
3086
- width = 260,
3087
- bordered = true
3121
+ footer
3088
3122
  }) {
3089
- const tokens = useTokens();
3090
- const frameCtx = useFrameContext();
3091
- const styles3 = React19.useMemo(
3092
- () => getSidebarStyles({ tokens, width, bordered, theme: frameCtx?.theme, appearance: frameCtx?.appearance }),
3093
- [tokens, width, bordered, frameCtx?.theme, frameCtx?.appearance]
3094
- );
3095
- return /* @__PURE__ */ React19.createElement(View, { style: styles3.container }, header && /* @__PURE__ */ React19.createElement(View, { style: styles3.header }, header), /* @__PURE__ */ React19.createElement(ScrollView, { style: styles3.body }, children), footer && /* @__PURE__ */ React19.createElement(View, { style: styles3.footer }, footer));
3123
+ return /* @__PURE__ */ React19.createElement(View, { style: styles2.container }, /* @__PURE__ */ React19.createElement(ScrollView, { style: styles2.body, contentContainerStyle: styles2.bodyContent }, children), footer && /* @__PURE__ */ React19.createElement(View, { style: styles2.footer }, footer));
3096
3124
  }
3097
3125
  function getNavbarStyles({ tokens, height, bordered, theme = "primary", appearance = "main" }) {
3098
3126
  const at = tokens.colors[theme][appearance];