@justin_evo/evo-ui 1.1.0 → 1.2.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 (80) hide show
  1. package/README.md +3 -3
  2. package/dist/TopNav/TopNav.d.ts +19 -0
  3. package/dist/declarations.d.ts +6 -6
  4. package/dist/evo-ui.css +1 -1
  5. package/dist/index.cjs.js +1 -1
  6. package/dist/index.es.js +3301 -3197
  7. package/package.json +52 -52
  8. package/src/Alert/Alert.tsx +49 -49
  9. package/src/AutoComplete/AutoComplete.tsx +810 -810
  10. package/src/Badge/Badge.tsx +53 -53
  11. package/src/Breadcrumb/Breadcrumb.tsx +53 -53
  12. package/src/Button/Button.tsx +125 -125
  13. package/src/Card/Card.tsx +257 -257
  14. package/src/Checkbox/Checkbox.tsx +59 -59
  15. package/src/CommandPalette/CommandPalette.tsx +185 -185
  16. package/src/Container/Container.tsx +31 -31
  17. package/src/Divider/Divider.tsx +31 -31
  18. package/src/Form/Form.tsx +185 -185
  19. package/src/Grid/Grid.tsx +66 -66
  20. package/src/ImageCropper/ImageCropper.tsx +911 -911
  21. package/src/Input/Input.tsx +74 -74
  22. package/src/Modal/Modal.tsx +77 -77
  23. package/src/Nav/Nav.tsx +708 -708
  24. package/src/Notification/Notification.tsx +1503 -1503
  25. package/src/Pagination/Pagination.tsx +76 -76
  26. package/src/Radio/Radio.tsx +69 -69
  27. package/src/RichTextArea/RichTextArea.tsx +886 -869
  28. package/src/Select/Select.tsx +515 -515
  29. package/src/Skeleton/Skeleton.tsx +70 -70
  30. package/src/Stack/Stack.tsx +52 -52
  31. package/src/Table/Table.tsx +335 -335
  32. package/src/Tabs/Tabs.tsx +90 -90
  33. package/src/Theme/ThemeProvider.tsx +253 -253
  34. package/src/Theme/ThemeToggle.tsx +79 -79
  35. package/src/Toggle/Toggle.tsx +48 -48
  36. package/src/Tooltip/Tooltip.tsx +38 -38
  37. package/src/TopNav/TopNav.tsx +1163 -994
  38. package/src/TreeSelect/TreeSelect.tsx +825 -825
  39. package/src/css/alert.module.scss +93 -93
  40. package/src/css/autocomplete.module.scss +416 -416
  41. package/src/css/badge.module.scss +82 -82
  42. package/src/css/base/_color.scss +159 -159
  43. package/src/css/base/_theme.scss +237 -237
  44. package/src/css/base/_variables.scss +161 -161
  45. package/src/css/breadcrumb.module.scss +50 -50
  46. package/src/css/button.module.scss +385 -385
  47. package/src/css/card.module.scss +217 -217
  48. package/src/css/checkbox.module.scss +123 -120
  49. package/src/css/commandpalette.module.scss +211 -211
  50. package/src/css/container.module.scss +18 -18
  51. package/src/css/divider.module.scss +41 -41
  52. package/src/css/form.module.scss +245 -245
  53. package/src/css/imagecropper.module.scss +397 -397
  54. package/src/css/input.module.scss +89 -89
  55. package/src/css/modal.module.scss +105 -105
  56. package/src/css/nav.module.scss +494 -494
  57. package/src/css/notification.module.scss +691 -691
  58. package/src/css/pagination.module.scss +63 -63
  59. package/src/css/radio.module.scss +89 -89
  60. package/src/css/richtextarea.module.scss +307 -307
  61. package/src/css/select.module.scss +525 -525
  62. package/src/css/skeleton.module.scss +30 -30
  63. package/src/css/table.module.scss +386 -386
  64. package/src/css/tabs.module.scss +63 -63
  65. package/src/css/theme-toggle.module.scss +83 -83
  66. package/src/css/toggle.module.scss +54 -54
  67. package/src/css/tooltip.module.scss +97 -97
  68. package/src/css/topnav.module.scss +568 -396
  69. package/src/css/treeselect.module.scss +558 -558
  70. package/src/css/utilities/_borders.scss +111 -111
  71. package/src/css/utilities/_colors.scss +66 -66
  72. package/src/css/utilities/_effects.scss +216 -216
  73. package/src/css/utilities/_layout.scss +181 -181
  74. package/src/css/utilities/_position.scss +75 -75
  75. package/src/css/utilities/_sizing.scss +138 -138
  76. package/src/css/utilities/_spacing.scss +99 -99
  77. package/src/css/utilities/_typography.scss +121 -121
  78. package/src/css/utilities/index.scss +24 -24
  79. package/src/declarations.d.ts +6 -6
  80. package/src/index.ts +60 -60
package/src/Form/Form.tsx CHANGED
@@ -1,185 +1,185 @@
1
- import React, { createContext, useContext, useId } from 'react';
2
- import styles from '../css/form.module.scss';
3
-
4
- type FormSize = 'sm' | 'md' | 'lg';
5
- type FormLayout = 'vertical' | 'horizontal';
6
-
7
- interface FormContextType {
8
- disabled?: boolean;
9
- size?: FormSize;
10
- layout?: FormLayout;
11
- }
12
-
13
- const FormContext = createContext<FormContextType>({});
14
-
15
- export const useFormContext = () => useContext(FormContext);
16
-
17
- const cx = (...c: (string | false | null | undefined)[]) => c.filter(Boolean).join(' ');
18
-
19
- // ---------- Root ----------
20
- interface EvoFormProps extends React.FormHTMLAttributes<HTMLFormElement> {
21
- children: React.ReactNode;
22
- disabled?: boolean;
23
- size?: FormSize;
24
- layout?: FormLayout;
25
- maxWidth?: number | string;
26
- className?: string;
27
- }
28
-
29
- export const EvoForm = ({
30
- children,
31
- disabled = false,
32
- size = 'md',
33
- layout = 'vertical',
34
- maxWidth,
35
- className = '',
36
- style,
37
- ...rest
38
- }: EvoFormProps) => (
39
- <FormContext.Provider value={{ disabled, size, layout }}>
40
- <form
41
- className={cx(styles.form, styles[`form_${size}`], styles[`form_${layout}`], className)}
42
- style={maxWidth !== undefined ? { maxWidth, ...style } : style}
43
- {...rest}
44
- >
45
- {children}
46
- </form>
47
- </FormContext.Provider>
48
- );
49
-
50
- // ---------- Header ----------
51
- interface EvoFormHeaderProps {
52
- title?: React.ReactNode;
53
- description?: React.ReactNode;
54
- badge?: React.ReactNode;
55
- children?: React.ReactNode;
56
- className?: string;
57
- }
58
-
59
- const EvoFormHeader = ({ title, description, badge, children, className = '' }: EvoFormHeaderProps) => (
60
- <header className={cx(styles.header, className)}>
61
- {badge && <div className={styles.headerBadge}>{badge}</div>}
62
- {title && <h2 className={styles.headerTitle}>{title}</h2>}
63
- {description && <p className={styles.headerDesc}>{description}</p>}
64
- {children}
65
- </header>
66
- );
67
-
68
- // ---------- Section ----------
69
- interface EvoFormSectionProps {
70
- title?: React.ReactNode;
71
- description?: React.ReactNode;
72
- variant?: 'stacked' | 'split';
73
- children: React.ReactNode;
74
- className?: string;
75
- }
76
-
77
- const EvoFormSection = ({
78
- title,
79
- description,
80
- variant = 'stacked',
81
- children,
82
- className = '',
83
- }: EvoFormSectionProps) => (
84
- <section className={cx(styles.section, styles[`section_${variant}`], className)}>
85
- {(title || description) && (
86
- <div className={styles.sectionHead}>
87
- {title && <h3 className={styles.sectionTitle}>{title}</h3>}
88
- {description && <p className={styles.sectionDesc}>{description}</p>}
89
- </div>
90
- )}
91
- <div className={styles.sectionBody}>{children}</div>
92
- </section>
93
- );
94
-
95
- // ---------- Row (side-by-side fields) ----------
96
- interface EvoFormRowProps {
97
- children: React.ReactNode;
98
- gap?: 'sm' | 'md' | 'lg';
99
- align?: 'start' | 'center' | 'end';
100
- className?: string;
101
- }
102
-
103
- const EvoFormRow = ({ children, gap = 'md', align = 'start', className = '' }: EvoFormRowProps) => (
104
- <div className={cx(styles.row, styles[`row_${gap}`], styles[`row_align_${align}`], className)}>
105
- {children}
106
- </div>
107
- );
108
-
109
- // ---------- Field ----------
110
- interface EvoFormFieldProps {
111
- children: React.ReactNode;
112
- label?: React.ReactNode;
113
- description?: React.ReactNode;
114
- error?: React.ReactNode;
115
- required?: boolean;
116
- htmlFor?: string;
117
- className?: string;
118
- }
119
-
120
- const EvoFormField = ({
121
- children,
122
- label,
123
- description,
124
- error,
125
- required,
126
- htmlFor,
127
- className = '',
128
- }: EvoFormFieldProps) => {
129
- const reactId = useId();
130
- const fieldId = htmlFor ?? `evo-field-${reactId}`;
131
- const hasMeta = label || description || error;
132
-
133
- if (!hasMeta) {
134
- return <div className={cx(styles.field, className)}>{children}</div>;
135
- }
136
-
137
- return (
138
- <div className={cx(styles.field, error ? styles.field_error : '', className)}>
139
- {label && (
140
- <label htmlFor={fieldId} className={styles.fieldLabel}>
141
- {label}
142
- {required && <span className={styles.fieldRequired} aria-hidden="true">*</span>}
143
- </label>
144
- )}
145
- <div className={styles.fieldControl}>{children}</div>
146
- {error ? (
147
- <p className={styles.fieldError} role="alert">{error}</p>
148
- ) : description ? (
149
- <p className={styles.fieldDesc}>{description}</p>
150
- ) : null}
151
- </div>
152
- );
153
- };
154
-
155
- // ---------- Actions (footer) ----------
156
- interface EvoFormActionsProps {
157
- children: React.ReactNode;
158
- align?: 'left' | 'right' | 'between' | 'center';
159
- divider?: boolean;
160
- className?: string;
161
- }
162
-
163
- const EvoFormActions = ({
164
- children,
165
- align = 'right',
166
- divider = true,
167
- className = '',
168
- }: EvoFormActionsProps) => (
169
- <div
170
- className={cx(
171
- styles.actions,
172
- styles[`actions_${align}`],
173
- divider ? styles.actions_divider : '',
174
- className,
175
- )}
176
- >
177
- {children}
178
- </div>
179
- );
180
-
181
- EvoForm.Header = EvoFormHeader;
182
- EvoForm.Section = EvoFormSection;
183
- EvoForm.Row = EvoFormRow;
184
- EvoForm.Field = EvoFormField;
185
- EvoForm.Actions = EvoFormActions;
1
+ import React, { createContext, useContext, useId } from 'react';
2
+ import styles from '../css/form.module.scss';
3
+
4
+ type FormSize = 'sm' | 'md' | 'lg';
5
+ type FormLayout = 'vertical' | 'horizontal';
6
+
7
+ interface FormContextType {
8
+ disabled?: boolean;
9
+ size?: FormSize;
10
+ layout?: FormLayout;
11
+ }
12
+
13
+ const FormContext = createContext<FormContextType>({});
14
+
15
+ export const useFormContext = () => useContext(FormContext);
16
+
17
+ const cx = (...c: (string | false | null | undefined)[]) => c.filter(Boolean).join(' ');
18
+
19
+ // ---------- Root ----------
20
+ interface EvoFormProps extends React.FormHTMLAttributes<HTMLFormElement> {
21
+ children: React.ReactNode;
22
+ disabled?: boolean;
23
+ size?: FormSize;
24
+ layout?: FormLayout;
25
+ maxWidth?: number | string;
26
+ className?: string;
27
+ }
28
+
29
+ export const EvoForm = ({
30
+ children,
31
+ disabled = false,
32
+ size = 'md',
33
+ layout = 'vertical',
34
+ maxWidth,
35
+ className = '',
36
+ style,
37
+ ...rest
38
+ }: EvoFormProps) => (
39
+ <FormContext.Provider value={{ disabled, size, layout }}>
40
+ <form
41
+ className={cx(styles.form, styles[`form_${size}`], styles[`form_${layout}`], className)}
42
+ style={maxWidth !== undefined ? { maxWidth, ...style } : style}
43
+ {...rest}
44
+ >
45
+ {children}
46
+ </form>
47
+ </FormContext.Provider>
48
+ );
49
+
50
+ // ---------- Header ----------
51
+ interface EvoFormHeaderProps {
52
+ title?: React.ReactNode;
53
+ description?: React.ReactNode;
54
+ badge?: React.ReactNode;
55
+ children?: React.ReactNode;
56
+ className?: string;
57
+ }
58
+
59
+ const EvoFormHeader = ({ title, description, badge, children, className = '' }: EvoFormHeaderProps) => (
60
+ <header className={cx(styles.header, className)}>
61
+ {badge && <div className={styles.headerBadge}>{badge}</div>}
62
+ {title && <h2 className={styles.headerTitle}>{title}</h2>}
63
+ {description && <p className={styles.headerDesc}>{description}</p>}
64
+ {children}
65
+ </header>
66
+ );
67
+
68
+ // ---------- Section ----------
69
+ interface EvoFormSectionProps {
70
+ title?: React.ReactNode;
71
+ description?: React.ReactNode;
72
+ variant?: 'stacked' | 'split';
73
+ children: React.ReactNode;
74
+ className?: string;
75
+ }
76
+
77
+ const EvoFormSection = ({
78
+ title,
79
+ description,
80
+ variant = 'stacked',
81
+ children,
82
+ className = '',
83
+ }: EvoFormSectionProps) => (
84
+ <section className={cx(styles.section, styles[`section_${variant}`], className)}>
85
+ {(title || description) && (
86
+ <div className={styles.sectionHead}>
87
+ {title && <h3 className={styles.sectionTitle}>{title}</h3>}
88
+ {description && <p className={styles.sectionDesc}>{description}</p>}
89
+ </div>
90
+ )}
91
+ <div className={styles.sectionBody}>{children}</div>
92
+ </section>
93
+ );
94
+
95
+ // ---------- Row (side-by-side fields) ----------
96
+ interface EvoFormRowProps {
97
+ children: React.ReactNode;
98
+ gap?: 'sm' | 'md' | 'lg';
99
+ align?: 'start' | 'center' | 'end';
100
+ className?: string;
101
+ }
102
+
103
+ const EvoFormRow = ({ children, gap = 'md', align = 'start', className = '' }: EvoFormRowProps) => (
104
+ <div className={cx(styles.row, styles[`row_${gap}`], styles[`row_align_${align}`], className)}>
105
+ {children}
106
+ </div>
107
+ );
108
+
109
+ // ---------- Field ----------
110
+ interface EvoFormFieldProps {
111
+ children: React.ReactNode;
112
+ label?: React.ReactNode;
113
+ description?: React.ReactNode;
114
+ error?: React.ReactNode;
115
+ required?: boolean;
116
+ htmlFor?: string;
117
+ className?: string;
118
+ }
119
+
120
+ const EvoFormField = ({
121
+ children,
122
+ label,
123
+ description,
124
+ error,
125
+ required,
126
+ htmlFor,
127
+ className = '',
128
+ }: EvoFormFieldProps) => {
129
+ const reactId = useId();
130
+ const fieldId = htmlFor ?? `evo-field-${reactId}`;
131
+ const hasMeta = label || description || error;
132
+
133
+ if (!hasMeta) {
134
+ return <div className={cx(styles.field, className)}>{children}</div>;
135
+ }
136
+
137
+ return (
138
+ <div className={cx(styles.field, error ? styles.field_error : '', className)}>
139
+ {label && (
140
+ <label htmlFor={fieldId} className={styles.fieldLabel}>
141
+ {label}
142
+ {required && <span className={styles.fieldRequired} aria-hidden="true">*</span>}
143
+ </label>
144
+ )}
145
+ <div className={styles.fieldControl}>{children}</div>
146
+ {error ? (
147
+ <p className={styles.fieldError} role="alert">{error}</p>
148
+ ) : description ? (
149
+ <p className={styles.fieldDesc}>{description}</p>
150
+ ) : null}
151
+ </div>
152
+ );
153
+ };
154
+
155
+ // ---------- Actions (footer) ----------
156
+ interface EvoFormActionsProps {
157
+ children: React.ReactNode;
158
+ align?: 'left' | 'right' | 'between' | 'center';
159
+ divider?: boolean;
160
+ className?: string;
161
+ }
162
+
163
+ const EvoFormActions = ({
164
+ children,
165
+ align = 'right',
166
+ divider = true,
167
+ className = '',
168
+ }: EvoFormActionsProps) => (
169
+ <div
170
+ className={cx(
171
+ styles.actions,
172
+ styles[`actions_${align}`],
173
+ divider ? styles.actions_divider : '',
174
+ className,
175
+ )}
176
+ >
177
+ {children}
178
+ </div>
179
+ );
180
+
181
+ EvoForm.Header = EvoFormHeader;
182
+ EvoForm.Section = EvoFormSection;
183
+ EvoForm.Row = EvoFormRow;
184
+ EvoForm.Field = EvoFormField;
185
+ EvoForm.Actions = EvoFormActions;
package/src/Grid/Grid.tsx CHANGED
@@ -1,66 +1,66 @@
1
- import React, { CSSProperties } from 'react';
2
-
3
- interface EvoGridProps {
4
- children: React.ReactNode;
5
- cols?: number | string;
6
- rows?: number | string;
7
- gap?: number | string;
8
- colGap?: number | string;
9
- rowGap?: number | string;
10
- className?: string;
11
- style?: CSSProperties;
12
- }
13
-
14
- interface EvoGridItemProps {
15
- children: React.ReactNode;
16
- colSpan?: number;
17
- rowSpan?: number;
18
- className?: string;
19
- style?: CSSProperties;
20
- }
21
-
22
- const toSize = (v: number | string | undefined) =>
23
- v === undefined ? undefined : typeof v === 'number' ? `${v}px` : v;
24
-
25
- const EvoGridItem = ({ children, colSpan, rowSpan, className = '', style }: EvoGridItemProps) => (
26
- <div
27
- className={className}
28
- style={{
29
- gridColumn: colSpan ? `span ${colSpan}` : undefined,
30
- gridRow: rowSpan ? `span ${rowSpan}` : undefined,
31
- ...style,
32
- }}
33
- >
34
- {children}
35
- </div>
36
- );
37
-
38
- export const EvoGrid = ({
39
- children,
40
- cols = 3,
41
- rows,
42
- gap = '1rem',
43
- colGap,
44
- rowGap,
45
- className = '',
46
- style,
47
- }: EvoGridProps) => (
48
- <div
49
- className={className}
50
- style={{
51
- display: 'grid',
52
- gridTemplateColumns: typeof cols === 'number' ? `repeat(${cols}, 1fr)` : cols,
53
- gridTemplateRows: rows
54
- ? typeof rows === 'number' ? `repeat(${rows}, auto)` : rows
55
- : undefined,
56
- gap: toSize(gap),
57
- columnGap: toSize(colGap),
58
- rowGap: toSize(rowGap),
59
- ...style,
60
- }}
61
- >
62
- {children}
63
- </div>
64
- );
65
-
66
- EvoGrid.Item = EvoGridItem;
1
+ import React, { CSSProperties } from 'react';
2
+
3
+ interface EvoGridProps {
4
+ children: React.ReactNode;
5
+ cols?: number | string;
6
+ rows?: number | string;
7
+ gap?: number | string;
8
+ colGap?: number | string;
9
+ rowGap?: number | string;
10
+ className?: string;
11
+ style?: CSSProperties;
12
+ }
13
+
14
+ interface EvoGridItemProps {
15
+ children: React.ReactNode;
16
+ colSpan?: number;
17
+ rowSpan?: number;
18
+ className?: string;
19
+ style?: CSSProperties;
20
+ }
21
+
22
+ const toSize = (v: number | string | undefined) =>
23
+ v === undefined ? undefined : typeof v === 'number' ? `${v}px` : v;
24
+
25
+ const EvoGridItem = ({ children, colSpan, rowSpan, className = '', style }: EvoGridItemProps) => (
26
+ <div
27
+ className={className}
28
+ style={{
29
+ gridColumn: colSpan ? `span ${colSpan}` : undefined,
30
+ gridRow: rowSpan ? `span ${rowSpan}` : undefined,
31
+ ...style,
32
+ }}
33
+ >
34
+ {children}
35
+ </div>
36
+ );
37
+
38
+ export const EvoGrid = ({
39
+ children,
40
+ cols = 3,
41
+ rows,
42
+ gap = '1rem',
43
+ colGap,
44
+ rowGap,
45
+ className = '',
46
+ style,
47
+ }: EvoGridProps) => (
48
+ <div
49
+ className={className}
50
+ style={{
51
+ display: 'grid',
52
+ gridTemplateColumns: typeof cols === 'number' ? `repeat(${cols}, 1fr)` : cols,
53
+ gridTemplateRows: rows
54
+ ? typeof rows === 'number' ? `repeat(${rows}, auto)` : rows
55
+ : undefined,
56
+ gap: toSize(gap),
57
+ columnGap: toSize(colGap),
58
+ rowGap: toSize(rowGap),
59
+ ...style,
60
+ }}
61
+ >
62
+ {children}
63
+ </div>
64
+ );
65
+
66
+ EvoGrid.Item = EvoGridItem;