@ncino/styles 9.0.0-preview.6 → 9.0.0-preview.9

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.
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Gator Design System - Complete MUI Theme Configuration
3
+ *
4
+ * Maps all Gator primitive and semantic tokens to MUI theme structure.
5
+ * Uses hard-coded hex values in palette (MUI requirement) and CSS variables
6
+ * in styleOverrides for runtime token synchronization.
7
+ */
8
+ import { createTheme, Palette, PaletteColor, Shadows, ThemeOptions } from '@mui/material/styles';
9
+ import '../tokens/primitive.tokens.css';
10
+ import '../tokens/semantic.tokens.css';
11
+ import { gatorColorValues, gatorTypography, gatorSpacing, gatorBorderRadius, gatorShadows } from './utils/themeConfig';
12
+
13
+ // TypeScript declaration for Webpack's require.context
14
+ declare const require: {
15
+ context: (
16
+ directory: string,
17
+ useSubdirectories: boolean,
18
+ regExp: RegExp
19
+ ) => {
20
+ keys(): string[];
21
+ (id: string): any;
22
+ };
23
+ };
24
+
25
+ /**
26
+ * Automatically import all component override files from the components directory
27
+ * This uses Webpack's require.context to dynamically discover and load all .ts files
28
+ */
29
+ function importAllComponentOverrides() {
30
+ // Check if require.context is available (Webpack environment)
31
+ if (typeof require !== 'undefined' && require.context) {
32
+ const req = require.context('./components', false, /\.ts$/);
33
+ const overrides = {};
34
+
35
+ req.keys().forEach((fileName) => {
36
+ // Skip any index files or utility files
37
+ if (fileName.includes('index') || fileName.includes('utils')) return;
38
+
39
+ try {
40
+ const componentModule = req(fileName);
41
+
42
+ // Merge all exported overrides from each module
43
+ Object.keys(componentModule).forEach((exportName) => {
44
+ if (exportName.includes('Override')) {
45
+ Object.assign(overrides, componentModule[exportName]);
46
+ }
47
+ });
48
+ } catch (error) {
49
+ console.warn(`Failed to load component override from ${fileName}:`, error);
50
+ }
51
+ });
52
+
53
+ return overrides;
54
+ }
55
+
56
+ // Fallback for non-Webpack environments (like Node.js testing)
57
+ console.warn('require.context not available - component overrides not automatically loaded');
58
+ return {};
59
+ }
60
+
61
+ interface ExtendedPalette extends Palette {
62
+ ai: PaletteColor;
63
+ neutral: PaletteColor;
64
+ }
65
+
66
+ interface ExtendedThemeOptions extends ThemeOptions {
67
+ palette: ExtendedPalette;
68
+ }
69
+
70
+ const themeOptions: ExtendedThemeOptions = {
71
+ palette: {
72
+ mode: 'light',
73
+ primary: gatorColorValues.brand,
74
+ secondary: gatorColorValues.secondary,
75
+ neutral: {
76
+ main: gatorColorValues.neutral[70],
77
+ light: gatorColorValues.neutral[40],
78
+ dark: gatorColorValues.neutral[80],
79
+ contrastText: '#FFFFFF',
80
+ },
81
+ error: gatorColorValues.error,
82
+ success: gatorColorValues.success,
83
+ warning: gatorColorValues.warning,
84
+ info: gatorColorValues.info,
85
+ ai: gatorColorValues.ai,
86
+ text: gatorColorValues.text,
87
+ background: gatorColorValues.background,
88
+ divider: gatorColorValues.divider,
89
+ action: {
90
+ active: gatorColorValues.neutral[70],
91
+ hover: gatorColorValues.neutral[10],
92
+ selected: gatorColorValues.neutral[20],
93
+ disabled: gatorColorValues.neutral[40],
94
+ disabledBackground: gatorColorValues.neutral[30],
95
+ focus: gatorColorValues.neutral[20],
96
+ },
97
+ },
98
+
99
+ typography: {
100
+ fontFamily: gatorTypography.fontFamily.body,
101
+ fontWeightLight: gatorTypography.fontWeight.regular,
102
+ fontWeightRegular: gatorTypography.fontWeight.regular,
103
+ fontWeightMedium: gatorTypography.fontWeight.medium,
104
+ fontWeightBold: gatorTypography.fontWeight.semiBold,
105
+
106
+ // Display styles (using CSS variables for dynamic sizing)
107
+ h1: {
108
+ fontFamily: gatorTypography.fontFamily.headings,
109
+ fontSize: 'var(--font-size-display-1)',
110
+ lineHeight: 'var(--line-height-display-1)',
111
+ fontWeight: gatorTypography.fontWeight.bold,
112
+ letterSpacing: 'var(--letter-spacing-narrow)',
113
+ },
114
+ h2: {
115
+ fontFamily: gatorTypography.fontFamily.headings,
116
+ fontSize: 'var(--font-size-display-2)',
117
+ lineHeight: 'var(--line-height-display-2)',
118
+ fontWeight: gatorTypography.fontWeight.bold,
119
+ letterSpacing: 'var(--letter-spacing-narrow)',
120
+ },
121
+
122
+ // Heading styles
123
+ h3: {
124
+ fontFamily: gatorTypography.fontFamily.headings,
125
+ fontSize: 'var(--font-size-heading-1)',
126
+ lineHeight: 'var(--line-height-heading-1)',
127
+ fontWeight: gatorTypography.fontWeight.semiBold,
128
+ letterSpacing: 'var(--letter-spacing-default)',
129
+ },
130
+ h4: {
131
+ fontFamily: gatorTypography.fontFamily.headings,
132
+ fontSize: 'var(--font-size-heading-2)',
133
+ lineHeight: 'var(--line-height-heading-2)',
134
+ fontWeight: gatorTypography.fontWeight.semiBold,
135
+ letterSpacing: 'var(--letter-spacing-default)',
136
+ },
137
+ h5: {
138
+ fontFamily: gatorTypography.fontFamily.headings,
139
+ fontSize: 'var(--font-size-heading-3)',
140
+ lineHeight: 'var(--line-height-heading-3)',
141
+ fontWeight: gatorTypography.fontWeight.semiBold,
142
+ letterSpacing: 'var(--letter-spacing-default)',
143
+ },
144
+ h6: {
145
+ fontFamily: gatorTypography.fontFamily.headings,
146
+ fontSize: 'var(--font-size-heading-4)',
147
+ lineHeight: 'var(--line-height-heading-4)',
148
+ fontWeight: gatorTypography.fontWeight.semiBold,
149
+ letterSpacing: 'var(--letter-spacing-default)',
150
+ },
151
+
152
+ // Subtitle styles
153
+ subtitle1: {
154
+ fontFamily: gatorTypography.fontFamily.body,
155
+ fontSize: 'var(--font-size-subtitle-1)',
156
+ lineHeight: 'var(--line-height-subtitle-1)',
157
+ fontWeight: gatorTypography.fontWeight.semiBold,
158
+ letterSpacing: 'var(--letter-spacing-default)',
159
+ },
160
+ subtitle2: {
161
+ fontFamily: gatorTypography.fontFamily.body,
162
+ fontSize: 'var(--font-size-subtitle-2)',
163
+ lineHeight: 'var(--line-height-subtitle-2)',
164
+ fontWeight: gatorTypography.fontWeight.semiBold,
165
+ letterSpacing: 'var(--letter-spacing-default)',
166
+ },
167
+
168
+ // Body styles
169
+ body1: {
170
+ fontFamily: gatorTypography.fontFamily.body,
171
+ fontSize: 'var(--font-size-body-1)',
172
+ lineHeight: 'var(--line-height-body-1)',
173
+ fontWeight: gatorTypography.fontWeight.regular,
174
+ letterSpacing: 'var(--letter-spacing-default)',
175
+ },
176
+ body2: {
177
+ fontFamily: gatorTypography.fontFamily.body,
178
+ fontSize: 'var(--font-size-body-2)',
179
+ lineHeight: 'var(--line-height-body-2)',
180
+ fontWeight: gatorTypography.fontWeight.regular,
181
+ letterSpacing: 'var(--letter-spacing-default)',
182
+ },
183
+
184
+ // Button text
185
+ button: {
186
+ fontFamily: gatorTypography.fontFamily.body,
187
+ fontSize: 'var(--font-size-body-2)',
188
+ lineHeight: 'var(--line-height-body-2)',
189
+ fontWeight: gatorTypography.fontWeight.semiBold,
190
+ textTransform: 'none',
191
+ letterSpacing: 'var(--letter-spacing-default)',
192
+ },
193
+
194
+ // Caption and overline
195
+ caption: {
196
+ fontFamily: gatorTypography.fontFamily.body,
197
+ fontSize: 'var(--font-size-body-3)',
198
+ lineHeight: 'var(--line-height-body-3)',
199
+ fontWeight: gatorTypography.fontWeight.regular,
200
+ letterSpacing: 'var(--letter-spacing-default)',
201
+ },
202
+ },
203
+
204
+ spacing: gatorSpacing,
205
+
206
+ shape: {
207
+ borderRadius: gatorBorderRadius.xsmall,
208
+ },
209
+
210
+ shadows: gatorShadows as Shadows,
211
+
212
+ // Component-specific default props
213
+ components: {
214
+ // Automatically discover and merge all component overrides
215
+ ...importAllComponentOverrides(),
216
+
217
+ // Additional component overrides not in separate files
218
+ MuiLink: {
219
+ styleOverrides: {
220
+ root: {
221
+ color: 'var(--color-text-brand)',
222
+ textDecorationColor: 'var(--color-underline-brand)',
223
+ '&:hover': {
224
+ color: 'var(--color-text-brand)',
225
+ textDecorationColor: 'var(--color-underline-brand-secondary)',
226
+ },
227
+ },
228
+ },
229
+ },
230
+ },
231
+ };
232
+
233
+ // ============================================================================
234
+ // CREATE AND EXPORT THEME
235
+ // ============================================================================
236
+ export const gatorMUITheme = createTheme(themeOptions);
237
+ export default gatorMUITheme;
@@ -0,0 +1,67 @@
1
+ import { getCSSVar } from '../utils/cssUtils';
2
+
3
+ export const MUIGatorAccordionOverrides = {
4
+ MuiAccordion: {
5
+ defaultProps: {
6
+ disableGutters: true,
7
+ elevation: 0,
8
+ },
9
+ styleOverrides: {
10
+ root: {
11
+ borderRadius: 'var(--border-radius-small)',
12
+ '&:not(:last-child)': {
13
+ borderBottom: '1px solid var(--color-border-tertiary)',
14
+ },
15
+ '&:before': {
16
+ display: 'none',
17
+ },
18
+ '&.Mui-expanded': {
19
+ '&:before': {
20
+ opacity: 1,
21
+ }
22
+ },
23
+ },
24
+ },
25
+ },
26
+ MuiAccordionSummary: {
27
+ styleOverrides: {
28
+ root: {
29
+ padding: '16px',
30
+ minHeight: '56px',
31
+ transition: 'background-color 0.2s ease',
32
+ '&:hover': {
33
+ backgroundColor: 'var(--color-surface-hover)',
34
+ },
35
+ '&.Mui-focusVisible': {
36
+ 'outline': '2px solid var(--color-border-focus)',
37
+ 'outlineOffset': '-1px',
38
+ },
39
+ '&.Mui-expanded': {
40
+ minHeight: '56px',
41
+ },
42
+ },
43
+ content: {
44
+ margin: '0',
45
+ '&.Mui-expanded': {
46
+ margin: '0',
47
+ },
48
+ },
49
+ expandIconWrapper: {
50
+ color: 'var(--color-icon-primary)',
51
+ '&.Mui-expanded': {
52
+ transform: 'rotate(180deg)',
53
+ },
54
+ },
55
+ },
56
+ },
57
+ MuiAccordionDetails: {
58
+ styleOverrides: {
59
+ root: {
60
+ padding: '16px 16px 24px 16px',
61
+ fontSize: 'var(--font-size-body-2)',
62
+ lineHeight: 'var(--line-height-body-2)',
63
+ color: 'var(--color-text-primary)',
64
+ },
65
+ },
66
+ },
67
+ };
@@ -0,0 +1,53 @@
1
+ import { gatorTypography } from '../utils/themeConfig';
2
+
3
+ export const MUIGatorAlertOverrides = {
4
+ MuiAlert: {
5
+ styleOverrides: {
6
+ root: {
7
+ borderRadius: 'var(--border-radius-x-large)',
8
+ padding: '1.5rem',
9
+ fontSize: 'var(--font-size-body-1)',
10
+ border: '1px solid var(--color-border-primary)',
11
+ },
12
+ standardSuccess: {
13
+ backgroundColor: 'var(--color-surface-success)',
14
+ color: 'var(--color-text-primary)',
15
+ borderColor: 'var(--color-border-success)',
16
+ '& .MuiAlert-icon': {
17
+ color: 'var(--color-icon-success)',
18
+ },
19
+ },
20
+ standardError: {
21
+ backgroundColor: 'var(--color-surface-error)',
22
+ color: 'var(--color-text-primary)',
23
+ borderColor: 'var(--color-border-error)',
24
+ '& .MuiAlert-icon': {
25
+ color: 'var(--color-icon-error)',
26
+ },
27
+ },
28
+ standardWarning: {
29
+ backgroundColor: 'var(--color-surface-warning)',
30
+ color: 'var(--color-text-primary)',
31
+ borderColor: 'var(--color-border-warning)',
32
+ '& .MuiAlert-icon': {
33
+ color: 'var(--color-icon-warning)',
34
+ },
35
+ },
36
+ standardInfo: {
37
+ backgroundColor: 'var(--color-surface-secondary)',
38
+ color: 'var(--color-text-primary)',
39
+ borderColor: 'var(--color-border-secondary)',
40
+ '& .MuiAlert-icon': {
41
+ color: 'var(--color-icon-primary)',
42
+ },
43
+ },
44
+ },
45
+ },
46
+ MuiAlertTitle: {
47
+ styleOverrides: {
48
+ root: {
49
+ fontWeight: gatorTypography.fontWeight.bold,
50
+ },
51
+ },
52
+ },
53
+ };
@@ -0,0 +1,156 @@
1
+ import { gatorTypography } from '../utils/themeConfig';
2
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
3
+ import React from 'react';
4
+
5
+ export const MUIGatorAutocompleteOverrides = {
6
+ MuiAutocomplete: {
7
+ defaultProps: {
8
+ componentsProps: {
9
+ paper: {
10
+ elevation: 3,
11
+ },
12
+ },
13
+ popupIcon: React.createElement(ExpandMoreIcon),
14
+ },
15
+ styleOverrides: {
16
+ root: {
17
+ // Override the input field styling
18
+ '& .MuiInputBase-root': {
19
+ padding: 'var(--spacing-7) var(--spacing-8)',
20
+ minHeight: '48px',
21
+ fontFamily: gatorTypography.fontFamily.body,
22
+ fontSize: 'var(--font-size-body-1)',
23
+ lineHeight: 'var(--line-height-body-1)',
24
+ },
25
+
26
+ '& .MuiAutocomplete-input': {
27
+ padding: '0 !important',
28
+ },
29
+
30
+ '& .MuiAutocomplete-endAdornment': {
31
+ right: 'var(--spacing-8)',
32
+ },
33
+
34
+ '& .MuiAutocomplete-clearIndicator': {
35
+ visibility: 'visible',
36
+ marginRight: 'var(--spacing-3)',
37
+ color: 'var(--color-icon-primary)',
38
+ '&:hover': {
39
+ color: 'var(--color-icon-secondary)',
40
+ backgroundColor: 'transparent',
41
+ },
42
+ },
43
+
44
+ '& .MuiAutocomplete-popupIndicator': {
45
+ color: 'var(--color-icon-primary)',
46
+ '&:hover': {
47
+ backgroundColor: 'transparent',
48
+ },
49
+ },
50
+
51
+ '.MuiCircularProgress-root': {
52
+ marginRight: 'var(--spacing-8)',
53
+ },
54
+ },
55
+
56
+ // Dropdown popup/menu styling
57
+ paper: {
58
+ marginTop: 'var(--spacing-3)',
59
+ borderRadius: 'var(--border-radius-medium)',
60
+ boxShadow: 'var(--shadow-3-dropdown)',
61
+ backgroundColor: 'var(--color-surface-primary)',
62
+ },
63
+
64
+ // List container
65
+ listbox: {
66
+ padding: 'var(--spacing-5) 0',
67
+ maxHeight: '300px',
68
+ fontFamily: gatorTypography.fontFamily.body,
69
+ fontSize: 'var(--font-size-body-1)',
70
+ lineHeight: 'var(--line-height-body-1)',
71
+
72
+ '& .MuiAutocomplete-option': {
73
+ padding: ' var(--spacing-5) var(--spacing-8) var(--spacing-5) var(--spacing-12)',
74
+ minHeight: '40px',
75
+ color: 'var(--color-text-primary)',
76
+
77
+ '&:hover': {
78
+ backgroundColor: 'var(--color-surface-hover)',
79
+ },
80
+
81
+ '&.Mui-focused': {
82
+ backgroundColor: 'var(--color-surface-hover)',
83
+ },
84
+
85
+ '&[aria-selected="true"]': {
86
+ backgroundColor: 'var(--color-surface-brand)',
87
+ color: 'var(--color-text-primary)',
88
+ fontWeight: gatorTypography.fontWeight.bold,
89
+ paddingLeft: 'var(--spacing-8)',
90
+ '::before': {
91
+ content: '"\u2713"',
92
+ display: 'inline-block',
93
+ marginRight: 'var(--spacing-6)',
94
+ color: 'var(--color-icon-on-brand)',
95
+ fontWeight: gatorTypography.fontWeight.regular,
96
+ },
97
+
98
+ '&:hover': {
99
+ backgroundColor: 'var(--color-surface-brand-secondary)',
100
+ },
101
+
102
+ '&.Mui-focused': {
103
+ backgroundColor: 'var(--color-surface-brand-secondary)',
104
+ },
105
+ },
106
+
107
+ '&[aria-disabled="true"]': {
108
+ opacity: 1,
109
+ color: 'var(--color-text-disabled)',
110
+ pointerEvents: 'none',
111
+ },
112
+ },
113
+ },
114
+
115
+ // No options message
116
+ noOptions: {
117
+ padding: 'var(--spacing-5) var(--spacing-8)',
118
+ color: 'var(--color-text-secondary)',
119
+ fontFamily: gatorTypography.fontFamily.body,
120
+ fontSize: 'var(--font-size-body-1)',
121
+ lineHeight: 'var(--line-height-body-1)',
122
+ },
123
+
124
+ // Loading text
125
+ loading: {
126
+ padding: 'var(--spacing-5) var(--spacing-8)',
127
+ color: 'var(--color-text-secondary)',
128
+ fontFamily: gatorTypography.fontFamily.body,
129
+ fontSize: 'var(--font-size-body-1)',
130
+ lineHeight: 'var(--line-height-body-1)',
131
+ },
132
+
133
+ // Grouping
134
+ groupLabel: {
135
+ padding: 'var(--spacing-5) var(--spacing-8)',
136
+ fontFamily: gatorTypography.fontFamily.body,
137
+ fontSize: 'var(--font-size-body-2)',
138
+ lineHeight: 'var(--line-height-body-2)',
139
+ fontWeight: gatorTypography.fontWeight.semiBold,
140
+ color: 'var(--color-text-secondary)',
141
+ top: 0,
142
+ zIndex: 1,
143
+ },
144
+
145
+ groupUl: {
146
+ padding: 0,
147
+ },
148
+
149
+ // Chips for multiselect
150
+ tag: {
151
+ margin: '-5px 4px',
152
+ fontSize: 'var(--font-size-body-3)',
153
+ },
154
+ },
155
+ },
156
+ };
@@ -0,0 +1,65 @@
1
+ import { getCSSVar } from '../utils/cssUtils';
2
+ import { gatorTypography } from '../utils/themeConfig';
3
+
4
+ /**
5
+ * Gator Avatar Component - MUI Theme Overrides
6
+ *
7
+ * Sizes from Figma:
8
+ * - xxx-small: 16px
9
+ * - xx-small: 24px
10
+ * - x-small: 32px
11
+ * - small (default): 40px
12
+ * - medium: 48px
13
+ * - large: 64px
14
+ * - x-large: 80px
15
+ *
16
+ * Colors:
17
+ * - Background: --color-surface-brand-tertiary (#BDCDDC)
18
+ * - Text: --color-text-brand (#103656)
19
+ */
20
+
21
+ export const MUIGatorAvatarOverrides = {
22
+ MuiAvatar: {
23
+ styleOverrides: {
24
+ root: {
25
+ fontFamily: gatorTypography.fontFamily.body,
26
+ fontWeight: gatorTypography.fontWeight.bold,
27
+ fontSize: 'var(--font-size-body-1)',
28
+ },
29
+ colorDefault: {
30
+ backgroundColor: 'var(--color-surface-brand-tertiary)',
31
+ color: 'var(--color-text-brand)',
32
+ },
33
+ },
34
+ variants: [
35
+ {
36
+ props: { variant: 'circular' },
37
+ style: {
38
+ borderRadius: 'var(--border-radius-circle)',
39
+ },
40
+ },
41
+ {
42
+ props: { variant: 'rounded' },
43
+ style: {
44
+ borderRadius: 'var(--border-radius-medium)',
45
+ },
46
+ },
47
+ {
48
+ props: { variant: 'square' },
49
+ style: {
50
+ borderRadius: 'var(--border-radius-no-radius)',
51
+ },
52
+ },
53
+ ],
54
+ },
55
+ MuiAvatarGroup: {
56
+ styleOverrides: {
57
+ avatar: {
58
+ border: '2px solid var(--color-background-primary)',
59
+ fontSize: 'var(--font-size-body-1)',
60
+ width: 40,
61
+ height: 40,
62
+ },
63
+ },
64
+ },
65
+ };
@@ -0,0 +1,55 @@
1
+ import { gatorTypography } from '../utils/themeConfig';
2
+ export const MUIGatorBadgeOverrides = {
3
+ MuiBadge: {
4
+ defaultProps: {
5
+ color: 'error', // Default to error color to match NGC
6
+ },
7
+ styleOverrides: {
8
+ badge: {
9
+ fontFamily: gatorTypography.fontFamily.body,
10
+ fontSize: 'var(--font-size-body-3)', // 13px
11
+ lineHeight: 'var(--line-height-body-3)', // 18px
12
+ fontWeight: gatorTypography.fontWeight.regular, // 400 - matches NGC
13
+ height: 'auto',
14
+ minWidth: 'auto',
15
+ padding: 'var(--spacing-1) var(--spacing-5)', // 1px 8px - matches NGC text padding
16
+ borderRadius: 'var(--border-radius-circle)',
17
+
18
+ '& .MuiSvgIcon-root': {
19
+ margin: '3px -4px', // Adjust icon margin to better center within badge
20
+ },
21
+ },
22
+
23
+ dot: {
24
+ height: '9px', // 0.5625rem from NGC
25
+ minWidth: '9px',
26
+ borderRadius: 'var(--border-radius-circle)',
27
+ padding: 0,
28
+ },
29
+
30
+ tile: {
31
+ borderRadius: 'var(--border-radius-x-small)',
32
+ },
33
+
34
+ colorError: {
35
+ backgroundColor: 'var(--color-feedback-error-secondary)',
36
+ color: 'var(--color-text-inverse)',
37
+ },
38
+
39
+ colorWarning: {
40
+ backgroundColor: 'var(--color-feedback-warning-secondary)',
41
+ color: 'var(--color-text-inverse)',
42
+ },
43
+
44
+ colorSuccess: {
45
+ backgroundColor: 'var(--color-feedback-success-secondary)',
46
+ },
47
+ },
48
+ },
49
+ };
50
+
51
+ declare module '@mui/material/Badge' {
52
+ interface BadgePropsVariantOverrides {
53
+ tile: true;
54
+ }
55
+ }