onecart-ui 1.0.1

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.
Files changed (82) hide show
  1. package/README.md +351 -0
  2. package/dist/components/Button/Button.d.ts +4 -0
  3. package/dist/components/Button/Button.d.ts.map +1 -0
  4. package/dist/components/Button/index.d.ts +3 -0
  5. package/dist/components/Button/index.d.ts.map +1 -0
  6. package/dist/components/Heading/Heading.d.ts +5 -0
  7. package/dist/components/Heading/Heading.d.ts.map +1 -0
  8. package/dist/components/Heading/index.d.ts +3 -0
  9. package/dist/components/Heading/index.d.ts.map +1 -0
  10. package/dist/components/Paragraph/Paragraph.d.ts +5 -0
  11. package/dist/components/Paragraph/Paragraph.d.ts.map +1 -0
  12. package/dist/components/Paragraph/index.d.ts +3 -0
  13. package/dist/components/Paragraph/index.d.ts.map +1 -0
  14. package/dist/components/Text/Text.d.ts +5 -0
  15. package/dist/components/Text/Text.d.ts.map +1 -0
  16. package/dist/components/Text/index.d.ts +3 -0
  17. package/dist/components/Text/index.d.ts.map +1 -0
  18. package/dist/components/Typography/Typography.d.ts +5 -0
  19. package/dist/components/Typography/Typography.d.ts.map +1 -0
  20. package/dist/components/Typography/index.d.ts +3 -0
  21. package/dist/components/Typography/index.d.ts.map +1 -0
  22. package/dist/index.d.ts +13 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.esm.js +2 -0
  25. package/dist/index.esm.js.map +1 -0
  26. package/dist/index.js +2 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/styles/tokens/index.d.ts +107 -0
  29. package/dist/styles/tokens/index.d.ts.map +1 -0
  30. package/dist/styles/tokens/tokens.d.ts +350 -0
  31. package/dist/styles/tokens/tokens.d.ts.map +1 -0
  32. package/dist/styles/tokens/typography.d.ts +154 -0
  33. package/dist/styles/tokens/typography.d.ts.map +1 -0
  34. package/dist/styles/tokens/utils/fontUtils.d.ts +26 -0
  35. package/dist/styles/tokens/utils/fontUtils.d.ts.map +1 -0
  36. package/dist/styles/tokens/utils/utils.d.ts +13 -0
  37. package/dist/styles/tokens/utils/utils.d.ts.map +1 -0
  38. package/dist/theme/ThemeProvider.d.ts +14 -0
  39. package/dist/theme/ThemeProvider.d.ts.map +1 -0
  40. package/dist/theme/index.d.ts +55 -0
  41. package/dist/theme/index.d.ts.map +1 -0
  42. package/dist/types/Button.d.ts +47 -0
  43. package/dist/types/Button.d.ts.map +1 -0
  44. package/dist/types/Heading.d.ts +24 -0
  45. package/dist/types/Heading.d.ts.map +1 -0
  46. package/dist/types/Paragraph.d.ts +35 -0
  47. package/dist/types/Paragraph.d.ts.map +1 -0
  48. package/dist/types/Text.d.ts +32 -0
  49. package/dist/types/Text.d.ts.map +1 -0
  50. package/dist/types/Typography.d.ts +64 -0
  51. package/dist/types/Typography.d.ts.map +1 -0
  52. package/package.json +72 -0
  53. package/src/components/Button/Button.tsx +155 -0
  54. package/src/components/Button/index.ts +2 -0
  55. package/src/components/Heading/Heading.tsx +48 -0
  56. package/src/components/Heading/index.ts +2 -0
  57. package/src/components/Paragraph/Paragraph.tsx +93 -0
  58. package/src/components/Paragraph/index.ts +6 -0
  59. package/src/components/Text/Text.tsx +96 -0
  60. package/src/components/Text/index.ts +2 -0
  61. package/src/components/Typography/Typography.tsx +123 -0
  62. package/src/components/Typography/index.ts +7 -0
  63. package/src/index.ts +34 -0
  64. package/src/styles/tokens/index.ts +130 -0
  65. package/src/styles/tokens/tokens-autocomplete-config.json +2417 -0
  66. package/src/styles/tokens/tokens.css +352 -0
  67. package/src/styles/tokens/tokens.js +350 -0
  68. package/src/styles/tokens/tokens.json +427 -0
  69. package/src/styles/tokens/tokens.less +349 -0
  70. package/src/styles/tokens/tokens.scss +349 -0
  71. package/src/styles/tokens/tokens.ts +350 -0
  72. package/src/styles/tokens/tokensMap.scss +353 -0
  73. package/src/styles/tokens/typography.ts +172 -0
  74. package/src/styles/tokens/utils/fontUtils.ts +63 -0
  75. package/src/styles/tokens/utils/utils.ts +19 -0
  76. package/src/theme/ThemeProvider.tsx +71 -0
  77. package/src/theme/index.ts +107 -0
  78. package/src/types/Button.ts +56 -0
  79. package/src/types/Heading.ts +27 -0
  80. package/src/types/Paragraph.ts +40 -0
  81. package/src/types/Text.ts +40 -0
  82. package/src/types/Typography.ts +94 -0
@@ -0,0 +1,107 @@
1
+ export interface ThemeColors {
2
+ primary: string;
3
+ secondary: string;
4
+ background: string;
5
+ surface: string;
6
+ text: string;
7
+ textSecondary: string;
8
+ border: string;
9
+ error: string;
10
+ warning: string;
11
+ success: string;
12
+ }
13
+
14
+ export interface ThemeSpacing {
15
+ xs: number;
16
+ sm: number;
17
+ md: number;
18
+ lg: number;
19
+ xl: number;
20
+ }
21
+
22
+ export interface ThemeBorderRadius {
23
+ none: number;
24
+ sm: number;
25
+ md: number;
26
+ lg: number;
27
+ full: number;
28
+ }
29
+
30
+ export interface ThemeTypography {
31
+ fontSize: {
32
+ xs: number;
33
+ sm: number;
34
+ md: number;
35
+ lg: number;
36
+ xl: number;
37
+ xxl: number;
38
+ };
39
+ fontWeight: {
40
+ normal: '400' | 'normal';
41
+ medium: '500' | 'medium';
42
+ semibold: '600' | 'semibold';
43
+ bold: '700' | 'bold';
44
+ };
45
+ lineHeight: {
46
+ tight: number;
47
+ normal: number;
48
+ relaxed: number;
49
+ };
50
+ }
51
+
52
+ export interface Theme {
53
+ colors: ThemeColors;
54
+ spacing: ThemeSpacing;
55
+ borderRadius: ThemeBorderRadius;
56
+ typography: ThemeTypography;
57
+ }
58
+
59
+ export const defaultTheme: Theme = {
60
+ colors: {
61
+ primary: '#007AFF',
62
+ secondary: '#5856D6',
63
+ background: '#FFFFFF',
64
+ surface: '#F2F2F7',
65
+ text: '#000000',
66
+ textSecondary: '#8E8E93',
67
+ border: '#E5E5EA',
68
+ error: '#FF3B30',
69
+ warning: '#FF9500',
70
+ success: '#34C759',
71
+ },
72
+ spacing: {
73
+ xs: 4,
74
+ sm: 8,
75
+ md: 16,
76
+ lg: 24,
77
+ xl: 32,
78
+ },
79
+ borderRadius: {
80
+ none: 0,
81
+ sm: 4,
82
+ md: 8,
83
+ lg: 12,
84
+ full: 9999,
85
+ },
86
+ typography: {
87
+ fontSize: {
88
+ xs: 12,
89
+ sm: 14,
90
+ md: 16,
91
+ lg: 18,
92
+ xl: 20,
93
+ xxl: 24,
94
+ },
95
+ fontWeight: {
96
+ normal: '400',
97
+ medium: '500',
98
+ semibold: '600',
99
+ bold: '700',
100
+ },
101
+ lineHeight: {
102
+ tight: 1.2,
103
+ normal: 1.5,
104
+ relaxed: 1.8,
105
+ },
106
+ },
107
+ };
@@ -0,0 +1,56 @@
1
+ export interface ButtonProps {
2
+ /**
3
+ * The content to display inside the button
4
+ */
5
+ children: React.ReactNode;
6
+
7
+ /**
8
+ * The variant of the button
9
+ */
10
+ variant?: "primary" | "secondary" | "outline" | "ghost";
11
+
12
+ /**
13
+ * The size of the button
14
+ */
15
+ size?: "sm" | "md" | "lg";
16
+
17
+ /**
18
+ * Whether the button is disabled
19
+ */
20
+ disabled?: boolean;
21
+
22
+ /**
23
+ * Whether the button should take full width
24
+ */
25
+ fullWidth?: boolean;
26
+
27
+ /**
28
+ * Loading state
29
+ */
30
+ loading?: boolean;
31
+
32
+ /**
33
+ * Custom style override
34
+ */
35
+ style?: import("react-native").ViewStyle;
36
+
37
+ /**
38
+ * Custom text style override
39
+ */
40
+ textStyle?: import("react-native").TextStyle;
41
+
42
+ /**
43
+ * Accessibility label
44
+ */
45
+ accessibilityLabel?: string;
46
+
47
+ /**
48
+ * Test ID for testing
49
+ */
50
+ testID?: string;
51
+
52
+ /**
53
+ * Press handler
54
+ */
55
+ onPress?: () => void;
56
+ }
@@ -0,0 +1,27 @@
1
+ import { TypographyProps } from "./Typography";
2
+
3
+ /**
4
+ * Heading levels corresponding to HTML heading elements
5
+ */
6
+ export type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
7
+
8
+ /**
9
+ * Heading component props
10
+ */
11
+ export interface HeadingProps extends Omit<TypographyProps, "variant"> {
12
+ /**
13
+ * The heading level
14
+ * @default 'h2'
15
+ */
16
+ level?: HeadingLevel;
17
+
18
+ /**
19
+ * Optional subtitle to display below the heading
20
+ */
21
+ subtitle?: React.ReactNode;
22
+
23
+ /**
24
+ * Props to pass to the subtitle Typography component
25
+ */
26
+ subtitleProps?: Omit<TypographyProps, "children">;
27
+ }
@@ -0,0 +1,40 @@
1
+ import { TextProps } from "./Text";
2
+
3
+ /**
4
+ * Paragraph size options
5
+ */
6
+ export type ParagraphSize = "xs" | "sm" | "md" | "lg";
7
+
8
+ /**
9
+ * Paragraph spacing options
10
+ */
11
+ export type ParagraphSpacing = "none" | "xs" | "sm" | "md" | "lg" | "xl";
12
+
13
+ /**
14
+ * Paragraph component props
15
+ */
16
+ export interface ParagraphProps extends TextProps {
17
+ /**
18
+ * Size of the paragraph text
19
+ * @default 'md'
20
+ */
21
+ size?: ParagraphSize;
22
+
23
+ /**
24
+ * Spacing below the paragraph
25
+ * @default 'md'
26
+ */
27
+ spacing?: ParagraphSpacing;
28
+
29
+ /**
30
+ * Whether to indent the first line of the paragraph
31
+ * @default false
32
+ */
33
+ firstLineIndent?: boolean;
34
+
35
+ /**
36
+ * Whether to apply a drop cap style to the first letter
37
+ * @default false
38
+ */
39
+ dropCap?: boolean;
40
+ }
@@ -0,0 +1,40 @@
1
+ import { TypographyProps } from "./Typography";
2
+
3
+ /**
4
+ * Text component props extending Typography props with additional features
5
+ */
6
+ export interface TextProps extends TypographyProps {
7
+ /**
8
+ * Whether the text should be underlined
9
+ * @default false
10
+ */
11
+ underline?: boolean;
12
+
13
+ /**
14
+ * Whether the text should have a strikethrough line
15
+ * @default false
16
+ */
17
+ strikethrough?: boolean;
18
+
19
+ /**
20
+ * Whether the text should be italic
21
+ * @default false
22
+ */
23
+ italic?: boolean;
24
+
25
+ /**
26
+ * Whether the text should be styled as a link
27
+ * @default false
28
+ */
29
+ link?: boolean;
30
+
31
+ /**
32
+ * Callback function when the link is pressed
33
+ * Only used when link prop is true
34
+ */
35
+ onLinkPress?: () => void;
36
+
37
+ /**
38
+ * Additional props from Typography component are inherited
39
+ */
40
+ }
@@ -0,0 +1,94 @@
1
+ import { TextProps } from "react-native";
2
+
3
+ /**
4
+ * Typography variants
5
+ */
6
+ export type TypographyVariant =
7
+ // Display variants - Used for large headlines and intro sections
8
+ | "display2xl"
9
+ | "displayXl"
10
+ // Heading variants - Used for section headings
11
+ | "headingXl"
12
+ | "headingLg"
13
+ | "headingMd"
14
+ | "headingSm"
15
+ | "headingXs"
16
+ // Body text variants - Used for paragraphs and content
17
+ | "bodyLg"
18
+ | "bodyMd"
19
+ | "bodySm"
20
+ | "bodyXs"
21
+ // Label variants - Used for form labels, captions, etc.
22
+ | "labelLg"
23
+ | "labelMd"
24
+ | "labelSm";
25
+
26
+ /**
27
+ * Text alignment options
28
+ */
29
+ export type TypographyAlign = "left" | "center" | "right";
30
+
31
+ /**
32
+ * Font weight options
33
+ */
34
+ export type TypographyWeight = "normal" | "medium" | "semibold" | "bold";
35
+
36
+ /**
37
+ * Typography component props
38
+ */
39
+ export interface TypographyProps extends Omit<TextProps, "children"> {
40
+ /**
41
+ * The content to display
42
+ */
43
+ children?: React.ReactNode;
44
+
45
+ /**
46
+ * The typography variant to use
47
+ * @default 'bodyMd'
48
+ */
49
+ variant?: TypographyVariant;
50
+
51
+ /**
52
+ * Text alignment
53
+ * @default 'left'
54
+ */
55
+ align?: TypographyAlign;
56
+
57
+ /**
58
+ * Font weight
59
+ */
60
+ weight?: TypographyWeight;
61
+
62
+ /**
63
+ * Text color
64
+ * If not provided, uses variant's default color from theme
65
+ */
66
+ color?: string;
67
+
68
+ /**
69
+ * Whether to truncate text with ellipsis if it overflows
70
+ * @default false
71
+ */
72
+ truncate?: boolean;
73
+
74
+ /**
75
+ * Maximum number of lines before truncating
76
+ * If not provided, text will not be truncated
77
+ */
78
+ numberOfLines?: number;
79
+
80
+ /**
81
+ * Additional custom styles for the text
82
+ */
83
+ style?: TextProps["style"];
84
+
85
+ /**
86
+ * Accessibility label for screen readers
87
+ */
88
+ accessibilityLabel?: string;
89
+
90
+ /**
91
+ * Test ID for testing
92
+ */
93
+ testID?: string;
94
+ }