@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.
@@ -1 +1 @@
1
- {"version":3,"file":"ContentCard.d.ts","sourceRoot":"","sources":["../../../../src/composites/layout/ContentCard/ContentCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAK5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAoB,EACpB,IAAI,EACJ,OAAO,EACP,OAAY,EACZ,GAAO,EACP,QAAgB,EAChB,KAAK,GACN,EAAE,gBAAgB,qBA0BlB"}
1
+ {"version":3,"file":"ContentCard.d.ts","sourceRoot":"","sources":["../../../../src/composites/layout/ContentCard/ContentCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAK5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAoB,EACpB,IAAI,EACJ,OAAO,EACP,OAAY,EACZ,GAAO,EACP,QAAgB,EAChB,KAAK,GACN,EAAE,gBAAgB,qBAuBlB"}
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { SidebarProps } from './Sidebar.types';
3
- export declare function Sidebar({ children, header, footer, width, bordered, }: SidebarProps): React.JSX.Element;
3
+ export declare function Sidebar({ children, footer, }: SidebarProps): React.JSX.Element;
4
4
  //# sourceMappingURL=Sidebar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../src/composites/layout/Sidebar/Sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIpD,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAW,EACX,QAAe,GAChB,EAAE,YAAY,qBAed"}
1
+ {"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../src/composites/layout/Sidebar/Sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAmBpD,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,MAAM,GACP,EAAE,YAAY,qBAOd"}
@@ -1,32 +1,17 @@
1
- import type { ResolvedTokens, ThemeName, AppearanceName } from 'newtone-api';
2
1
  interface SidebarStyleInput {
3
- readonly tokens: ResolvedTokens;
4
2
  readonly width: number;
5
- readonly bordered: boolean;
6
- readonly theme?: ThemeName;
7
- readonly appearance?: AppearanceName;
8
3
  }
9
- export declare function getSidebarStyles({ tokens, width, bordered, theme, appearance }: SidebarStyleInput): {
4
+ export declare function getSidebarStyles({ width }: SidebarStyleInput): {
10
5
  container: {
11
6
  width: number;
12
7
  flexShrink: number;
13
8
  flexDirection: "column";
14
- backgroundColor: string;
15
- borderRightWidth: number;
16
- borderRightColor: string;
17
- };
18
- header: {
19
- flexShrink: number;
20
- borderBottomWidth: number;
21
- borderBottomColor: string;
22
9
  };
23
10
  body: {
24
11
  flex: number;
25
12
  };
26
13
  footer: {
27
14
  flexShrink: number;
28
- borderTopWidth: number;
29
- borderTopColor: string;
30
15
  };
31
16
  };
32
17
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/layout/Sidebar/Sidebar.styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAoB,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/F,UAAU,iBAAiB;IACzB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;CACtC;AAED,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAiB,EAAE,UAAmB,EAAE,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;EA2BtH"}
1
+ {"version":3,"file":"Sidebar.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/layout/Sidebar/Sidebar.styles.ts"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,iBAAiB;;;;;;;;;;;;EAc5D"}
@@ -2,13 +2,7 @@ import type { ReactNode } from 'react';
2
2
  export interface SidebarProps {
3
3
  /** Scrollable body content (navigation items, etc.) */
4
4
  readonly children?: ReactNode;
5
- /** Sticky header slot (logo, brand) */
6
- readonly header?: ReactNode;
7
5
  /** Sticky footer slot (user menu, settings) */
8
6
  readonly footer?: ReactNode;
9
- /** Fixed width in pixels. @default 260 */
10
- readonly width?: number;
11
- /** Show right border. @default true */
12
- readonly bordered?: boolean;
13
7
  }
14
8
  //# sourceMappingURL=Sidebar.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.types.d.ts","sourceRoot":"","sources":["../../../../src/composites/layout/Sidebar/Sidebar.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,YAAY;IAC3B,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,uCAAuC;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B"}
1
+ {"version":3,"file":"Sidebar.types.d.ts","sourceRoot":"","sources":["../../../../src/composites/layout/Sidebar/Sidebar.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,YAAY;IAC3B,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;CAC7B"}
package/dist/index.cjs CHANGED
@@ -748,25 +748,47 @@ var Text3 = Object.assign(TextBase, {
748
748
  Underline: TextUnderline,
749
749
  Highlight: TextHighlight
750
750
  });
751
- var styles = reactNative.StyleSheet.create({
751
+ var baseStyles = reactNative.StyleSheet.create({
752
752
  root: {
753
753
  flex: 1,
754
+ flexDirection: "row",
755
+ ...reactNative.Platform.OS === "web" ? { height: "100vh", overflow: "hidden" } : {}
756
+ },
757
+ navigation: {
758
+ width: 256,
759
+ flexShrink: 0,
754
760
  flexDirection: "column",
755
- ...reactNative.Platform.OS === "web" ? { minHeight: "100vh" } : {}
761
+ overflow: "hidden"
756
762
  },
757
- body: {
758
- flex: 1,
759
- flexDirection: "row"
763
+ navHeader: {
764
+ flexShrink: 0,
765
+ height: 64
760
766
  },
761
767
  content: {
762
- flex: 1
768
+ flex: 1,
769
+ flexDirection: "column",
770
+ overflow: "hidden"
771
+ },
772
+ header: {
773
+ flexShrink: 0,
774
+ height: 64,
775
+ ...reactNative.Platform.OS === "web" ? { position: "sticky", top: 0, zIndex: 10 } : {}
776
+ },
777
+ navFooter: {
778
+ flexShrink: 0
779
+ },
780
+ footer: {
781
+ flexShrink: 0
763
782
  }
764
783
  });
765
784
  function Page({
766
785
  children,
767
786
  scheme,
768
- navbar,
769
- sidebar,
787
+ header,
788
+ navHeader,
789
+ navFooter,
790
+ footer,
791
+ navContent,
770
792
  testID,
771
793
  nativeID,
772
794
  ref,
@@ -783,6 +805,37 @@ function Page({
783
805
  activeScheme: scheme
784
806
  };
785
807
  }, [scheme, themeCtx]);
808
+ const resolvedConfig = schemeThemeCtx?.config ?? themeCtx.config;
809
+ const { mode, gamut } = themeCtx;
810
+ const { dividerBg, sunkenBg, groundedBg } = React19.useMemo(() => {
811
+ const groundedTokens = newtoneApi.computeTokens(
812
+ resolvedConfig.colorSystem,
813
+ mode,
814
+ gamut,
815
+ "grounded",
816
+ resolvedConfig.spacing,
817
+ resolvedConfig.radius,
818
+ resolvedConfig.typography,
819
+ resolvedConfig.icons,
820
+ resolvedConfig.themeMappings
821
+ );
822
+ const sunkenTokens = newtoneApi.computeTokens(
823
+ resolvedConfig.colorSystem,
824
+ mode,
825
+ gamut,
826
+ "sunken",
827
+ resolvedConfig.spacing,
828
+ resolvedConfig.radius,
829
+ resolvedConfig.typography,
830
+ resolvedConfig.icons,
831
+ resolvedConfig.themeMappings
832
+ );
833
+ return {
834
+ dividerBg: groundedTokens.colors.primary.main.divider,
835
+ sunkenBg: sunkenTokens.colors.primary.main.background,
836
+ groundedBg: groundedTokens.colors.primary.main.background
837
+ };
838
+ }, [resolvedConfig, mode, gamut]);
786
839
  const userStyles = Array.isArray(style) ? style : style ? [style] : [];
787
840
  const content = /* @__PURE__ */ React19__default.default.createElement(
788
841
  reactNative.View,
@@ -791,17 +844,17 @@ function Page({
791
844
  testID,
792
845
  nativeID,
793
846
  accessibilityRole: "none",
794
- style: [styles.root, ...userStyles]
847
+ style: [baseStyles.root, { backgroundColor: dividerBg, gap: 1 }, ...userStyles]
795
848
  },
796
- navbar,
797
- sidebar ? /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles.body }, sidebar, /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles.content }, children)) : children
849
+ navHeader || navContent || navFooter ? /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [baseStyles.navigation, { backgroundColor: dividerBg, gap: 1 }] }, navHeader ? /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [baseStyles.navHeader, { backgroundColor: sunkenBg }] }, navHeader) : null, /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: { flex: 1, backgroundColor: sunkenBg, overflow: "hidden" } }, navContent), navFooter ? /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [baseStyles.navFooter, { backgroundColor: sunkenBg }] }, navFooter) : null) : null,
850
+ /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [baseStyles.content, { backgroundColor: dividerBg, gap: 1 }] }, header ? /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [baseStyles.header, { backgroundColor: groundedBg }] }, header) : null, /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: { flex: 1, backgroundColor: groundedBg, overflow: "hidden" } }, children), footer ? /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [baseStyles.footer, { backgroundColor: groundedBg }] }, footer) : null)
798
851
  );
799
852
  if (schemeThemeCtx) {
800
853
  return /* @__PURE__ */ React19__default.default.createElement(newtoneApi._ThemeContext.Provider, { value: schemeThemeCtx }, content);
801
854
  }
802
855
  return content;
803
856
  }
804
- var styles2 = reactNative.StyleSheet.create({
857
+ var styles = reactNative.StyleSheet.create({
805
858
  root: {
806
859
  flex: 1
807
860
  },
@@ -823,8 +876,8 @@ function Viewport({
823
876
  ref,
824
877
  testID,
825
878
  nativeID,
826
- style: styles2.root,
827
- contentContainerStyle: [styles2.content, ...userStyles]
879
+ style: styles.root,
880
+ contentContainerStyle: [styles.content, ...userStyles]
828
881
  },
829
882
  children
830
883
  );
@@ -1782,9 +1835,6 @@ function ContentCard({
1782
1835
  {
1783
1836
  elevation: variant === "elevated" ? 2 : void 0,
1784
1837
  appearance: variant === "elevated" ? "tinted" : void 0,
1785
- href,
1786
- onPress,
1787
- disabled,
1788
1838
  padding,
1789
1839
  gap,
1790
1840
  style: [
@@ -3055,49 +3105,27 @@ function AppShell({ sidebar, children }) {
3055
3105
  );
3056
3106
  return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.container }, sidebar, /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.main }, children));
3057
3107
  }
3058
- function getSidebarStyles({ tokens, width, bordered, theme = "primary", appearance = "main" }) {
3059
- const at = tokens.colors[theme][appearance];
3060
- const borderColor = at.fontSecondary;
3061
- return reactNative.StyleSheet.create({
3062
- container: {
3063
- width,
3064
- flexShrink: 0,
3065
- flexDirection: "column",
3066
- backgroundColor: at.background,
3067
- borderRightWidth: bordered ? 1 : 0,
3068
- borderRightColor: borderColor
3069
- },
3070
- header: {
3071
- flexShrink: 0,
3072
- borderBottomWidth: 1,
3073
- borderBottomColor: borderColor
3074
- },
3075
- body: {
3076
- flex: 1
3077
- },
3078
- footer: {
3079
- flexShrink: 0,
3080
- borderTopWidth: 1,
3081
- borderTopColor: borderColor
3082
- }
3083
- });
3084
- }
3085
-
3086
- // src/composites/layout/Sidebar/Sidebar.tsx
3108
+ var styles2 = reactNative.StyleSheet.create({
3109
+ container: {
3110
+ flex: 1,
3111
+ flexDirection: "column"
3112
+ },
3113
+ body: {
3114
+ flex: 1,
3115
+ padding: 8
3116
+ },
3117
+ bodyContent: {
3118
+ gap: 8
3119
+ },
3120
+ footer: {
3121
+ flexShrink: 0
3122
+ }
3123
+ });
3087
3124
  function Sidebar({
3088
3125
  children,
3089
- header,
3090
- footer,
3091
- width = 260,
3092
- bordered = true
3126
+ footer
3093
3127
  }) {
3094
- const tokens = newtoneApi.useTokens();
3095
- const frameCtx = newtoneApi.useFrameContext();
3096
- const styles3 = React19__default.default.useMemo(
3097
- () => getSidebarStyles({ tokens, width, bordered, theme: frameCtx?.theme, appearance: frameCtx?.appearance }),
3098
- [tokens, width, bordered, frameCtx?.theme, frameCtx?.appearance]
3099
- );
3100
- return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.container }, header && /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.header }, header), /* @__PURE__ */ React19__default.default.createElement(reactNative.ScrollView, { style: styles3.body }, children), footer && /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.footer }, footer));
3128
+ return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles2.container }, /* @__PURE__ */ React19__default.default.createElement(reactNative.ScrollView, { style: styles2.body, contentContainerStyle: styles2.bodyContent }, children), footer && /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles2.footer }, footer));
3101
3129
  }
3102
3130
  function getNavbarStyles({ tokens, height, bordered, theme = "primary", appearance = "main" }) {
3103
3131
  const at = tokens.colors[theme][appearance];