@aspect-ops/exon-ui 0.3.0 → 0.4.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 (37) hide show
  1. package/README.md +0 -45
  2. package/dist/components/BottomNav/BottomNavItem.svelte +4 -3
  3. package/dist/components/BottomNav/BottomNavItem.svelte.d.ts +2 -1
  4. package/dist/components/DoughnutChart/DoughnutChart.svelte +4 -4
  5. package/dist/components/FlexibleGrid/FlexibleGrid.svelte +118 -0
  6. package/dist/components/FlexibleGrid/FlexibleGrid.svelte.d.ts +7 -0
  7. package/dist/components/FlexibleGrid/README.md +212 -0
  8. package/dist/components/FlexibleGrid/index.d.ts +2 -0
  9. package/dist/components/FlexibleGrid/index.js +1 -0
  10. package/dist/components/GlobalHeader/GlobalHeader.svelte +201 -87
  11. package/dist/components/HeroLeftAligned/HeroLeftAligned.svelte +182 -0
  12. package/dist/components/HeroLeftAligned/HeroLeftAligned.svelte.d.ts +8 -0
  13. package/dist/components/HeroLeftAligned/README.md +168 -0
  14. package/dist/components/HeroLeftAligned/index.d.ts +2 -0
  15. package/dist/components/HeroLeftAligned/index.js +1 -0
  16. package/dist/components/IconFeatureCard/IconFeatureCard.svelte +173 -0
  17. package/dist/components/IconFeatureCard/IconFeatureCard.svelte.d.ts +4 -0
  18. package/dist/components/IconFeatureCard/README.md +234 -0
  19. package/dist/components/IconFeatureCard/index.d.ts +2 -0
  20. package/dist/components/IconFeatureCard/index.js +1 -0
  21. package/dist/components/ImageTextCard/ImageTextCard.svelte +149 -0
  22. package/dist/components/ImageTextCard/ImageTextCard.svelte.d.ts +22 -0
  23. package/dist/components/ImageTextCard/README.md +177 -0
  24. package/dist/components/ImageTextCard/index.d.ts +2 -0
  25. package/dist/components/ImageTextCard/index.js +1 -0
  26. package/dist/components/Sidebar/SidebarGroup.svelte +1 -4
  27. package/dist/index.d.ts +7 -1
  28. package/dist/index.js +4 -1
  29. package/dist/types/index.d.ts +49 -1
  30. package/dist/types/layout.d.ts +20 -0
  31. package/dist/types/navigation.d.ts +2 -1
  32. package/package.json +9 -2
  33. package/dist/components/Mermaid/Mermaid.svelte +0 -320
  34. package/dist/components/Mermaid/Mermaid.svelte.d.ts +0 -38
  35. package/dist/components/Mermaid/index.d.ts +0 -1
  36. package/dist/components/Mermaid/index.js +0 -1
  37. package/dist/components/Mermaid/mermaid.d.ts +0 -21
package/README.md CHANGED
@@ -1202,51 +1202,6 @@ Pure SVG doughnut chart with interactive legend (no external dependencies).
1202
1202
  | `showLegend` | `boolean` | `true` | Show legend |
1203
1203
  | `showTotal` | `boolean` | `true` | Show center total |
1204
1204
 
1205
- ### Mermaid
1206
-
1207
- Render Mermaid diagrams with customizable theming.
1208
-
1209
- **Note:** Requires `mermaid` package: `npm install mermaid`
1210
-
1211
- ```svelte
1212
- <script>
1213
- import { Mermaid } from '@aspect-ops/exon-ui';
1214
-
1215
- const diagram = `flowchart TD
1216
- A[Start] --> B{Decision}
1217
- B -->|Yes| C[Action 1]
1218
- B -->|No| D[Action 2]
1219
- C --> E[End]
1220
- D --> E`;
1221
- </script>
1222
-
1223
- <!-- Using code prop -->
1224
- <Mermaid code={diagram} />
1225
-
1226
- <!-- Using slot -->
1227
- <Mermaid>flowchart LR A --> B --> C</Mermaid>
1228
- ```
1229
-
1230
- **Props:**
1231
-
1232
- | Prop | Type | Default | Description |
1233
- | ------- | -------- | ------------- | ---------------------- |
1234
- | `code` | `string` | - | Mermaid diagram code |
1235
- | `theme` | `object` | ExonPro theme | Custom theme variables |
1236
-
1237
- **Theme variables:**
1238
-
1239
- ```javascript
1240
- const theme = {
1241
- primaryColor: '#4654A3',
1242
- primaryTextColor: '#270949',
1243
- primaryBorderColor: '#4654A3',
1244
- lineColor: '#270949',
1245
- secondaryColor: '#FF3131',
1246
- tertiaryColor: '#f3f4f6'
1247
- };
1248
- ```
1249
-
1250
1205
  ## Theming & Customization
1251
1206
 
1252
1207
  ### Quick Setup
@@ -1,7 +1,8 @@
1
1
  <script lang="ts">
2
2
  import type { BottomNavItemProps } from '../../types/index.js';
3
3
 
4
- interface Props extends BottomNavItemProps {
4
+ interface Props extends Omit<BottomNavItemProps, 'icon'> {
5
+ icon: import('svelte').Snippet;
5
6
  onclick?: () => void;
6
7
  children?: import('svelte').Snippet;
7
8
  }
@@ -25,7 +26,7 @@
25
26
  class:bottom-nav-item--active={active}
26
27
  aria-current={active ? 'page' : undefined}
27
28
  >
28
- <span class="bottom-nav-item__icon">{icon}</span>
29
+ <span class="bottom-nav-item__icon">{@render icon()}</span>
29
30
  {#if children}
30
31
  <span class="bottom-nav-item__label">{@render children()}</span>
31
32
  {:else}
@@ -45,7 +46,7 @@
45
46
  aria-current={active ? 'page' : undefined}
46
47
  {onclick}
47
48
  >
48
- <span class="bottom-nav-item__icon">{icon}</span>
49
+ <span class="bottom-nav-item__icon">{@render icon()}</span>
49
50
  {#if children}
50
51
  <span class="bottom-nav-item__label">{@render children()}</span>
51
52
  {:else}
@@ -1,5 +1,6 @@
1
1
  import type { BottomNavItemProps } from '../../types/index.js';
2
- interface Props extends BottomNavItemProps {
2
+ interface Props extends Omit<BottomNavItemProps, 'icon'> {
3
+ icon: import('svelte').Snippet;
3
4
  onclick?: () => void;
4
5
  children?: import('svelte').Snippet;
5
6
  }
@@ -49,6 +49,10 @@
49
49
  // Calculate total
50
50
  const total = $derived(data.reduce((sum, item) => sum + item.value, 0));
51
51
 
52
+ // Calculate inner radius for doughnut (must be before arcs)
53
+ const innerRadius = $derived((size / 2 - 10) * (1 - thickness));
54
+ const outerRadius = $derived(size / 2 - 10);
55
+
52
56
  // Calculate arc data
53
57
  interface ArcData extends DataItem {
54
58
  percentage: number;
@@ -87,10 +91,6 @@
87
91
  return result;
88
92
  });
89
93
 
90
- // Calculate inner radius for doughnut
91
- const innerRadius = $derived((size / 2 - 10) * (1 - thickness));
92
- const outerRadius = $derived(size / 2 - 10);
93
-
94
94
  // Helper to convert polar to cartesian coordinates
95
95
  function polarToCartesian(
96
96
  centerX: number,
@@ -0,0 +1,118 @@
1
+ <script lang="ts">
2
+ import type {
3
+ SpacingToken,
4
+ FlexibleGridCell,
5
+ FlexibleGridRow,
6
+ FlexibleGridProps
7
+ } from '../../types/index.js';
8
+
9
+ interface Props extends Omit<FlexibleGridProps, 'children'> {
10
+ children?: import('svelte').Snippet;
11
+ }
12
+
13
+ let {
14
+ rows,
15
+ gap = 'xs', // Use design token by default
16
+ cellHeight = '80px',
17
+ defaultBgColor = '#6B7A99',
18
+ defaultTextColor = 'white',
19
+ columns = 12,
20
+ class: className = '',
21
+ children
22
+ }: Props = $props();
23
+
24
+ // Convert SpacingToken to CSS value if needed
25
+ const getGapValue = (gapValue: SpacingToken | string): string => {
26
+ const spacingMap: Record<SpacingToken, string> = {
27
+ xs: 'var(--space-xs, 0.25rem)',
28
+ sm: 'var(--space-sm, 0.5rem)',
29
+ md: 'var(--space-md, 1rem)',
30
+ lg: 'var(--space-lg, 1.5rem)',
31
+ xl: 'var(--space-xl, 2rem)',
32
+ '2xl': 'var(--space-2xl, 3rem)',
33
+ '3xl': 'var(--space-3xl, 4rem)'
34
+ };
35
+ return spacingMap[gapValue as SpacingToken] || gapValue;
36
+ };
37
+ </script>
38
+
39
+ <div class="flexible-grid {className}" style="gap: {getGapValue(gap)};">
40
+ {#each rows as row, rowIndex}
41
+ <div
42
+ class="grid-row {row.class || ''}"
43
+ style="gap: {getGapValue(gap)}; grid-template-columns: repeat({columns}, 1fr);"
44
+ >
45
+ {#each row.cells as cell, cellIndex}
46
+ <div
47
+ class="grid-cell {cell.class || ''}"
48
+ style="
49
+ grid-column: span {cell.span};
50
+ height: {cellHeight};
51
+ background-color: {cell.bgColor || defaultBgColor};
52
+ color: {cell.textColor || defaultTextColor};
53
+ "
54
+ >
55
+ {@html cell.content}
56
+ </div>
57
+ {/each}
58
+ </div>
59
+ {/each}
60
+ {#if children}
61
+ {@render children()}
62
+ {/if}
63
+ </div>
64
+
65
+ <style>
66
+ .flexible-grid {
67
+ display: flex;
68
+ flex-direction: column;
69
+ width: 100%;
70
+ background-color: transparent;
71
+ font-family: inherit;
72
+ }
73
+
74
+ .grid-row {
75
+ display: grid;
76
+ width: 100%;
77
+ }
78
+
79
+ .grid-cell {
80
+ display: flex;
81
+ align-items: center;
82
+ justify-content: center;
83
+ font-size: 2rem;
84
+ font-weight: 600;
85
+ border-radius: 4px;
86
+ transition: transform 0.2s ease;
87
+ overflow: hidden;
88
+ box-sizing: border-box;
89
+ }
90
+
91
+ .grid-cell:hover {
92
+ transform: scale(1.02);
93
+ }
94
+
95
+ /* Responsive adjustments */
96
+ @media (max-width: 768px) {
97
+ .grid-cell {
98
+ font-size: 1.5rem;
99
+ min-height: 60px;
100
+ }
101
+ }
102
+
103
+ @media (max-width: 480px) {
104
+ .grid-cell {
105
+ font-size: 1rem;
106
+ min-height: 50px;
107
+ }
108
+
109
+ .grid-row {
110
+ grid-template-columns: repeat(6, 1fr) !important;
111
+ }
112
+
113
+ .grid-cell {
114
+ /* On mobile, adjust span to fit 6 columns */
115
+ grid-column: span min(6, attr(data-span integer, 1)) !important;
116
+ }
117
+ }
118
+ </style>
@@ -0,0 +1,7 @@
1
+ import type { FlexibleGridProps } from '../../types/index.js';
2
+ interface Props extends Omit<FlexibleGridProps, 'children'> {
3
+ children?: import('svelte').Snippet;
4
+ }
5
+ declare const FlexibleGrid: import("svelte").Component<Props, {}, "">;
6
+ type FlexibleGrid = ReturnType<typeof FlexibleGrid>;
7
+ export default FlexibleGrid;
@@ -0,0 +1,212 @@
1
+ # FlexibleGrid Component
2
+
3
+ A dynamic, responsive grid component that allows you to create custom grid layouts with flexible column spans and customizable cells.
4
+
5
+ ## Features
6
+
7
+ - **Flexible Column Spans**: Each cell can span 1-12 columns
8
+ - **Customizable Styling**: Background colors, text colors, and custom classes per cell and row
9
+ - **Responsive**: Automatically adjusts to mobile devices (6 columns on small screens)
10
+ - **Design Tokens**: Supports Exon UI spacing tokens (xs, sm, md, lg, xl, 2xl, 3xl)
11
+ - **Custom Gaps**: Use design tokens or custom CSS values
12
+ - **Hover Effects**: Smooth scale transition on hover
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @aspect-ops/exon-ui
18
+ ```
19
+
20
+ ## Basic Usage
21
+
22
+ ```svelte
23
+ <script lang="ts">
24
+ import { FlexibleGrid } from '@aspect-ops/exon-ui';
25
+ import type { FlexibleGridRow } from '@aspect-ops/exon-ui';
26
+
27
+ const rows: FlexibleGridRow[] = [
28
+ {
29
+ cells: [
30
+ { span: 6, content: 'Half Width' },
31
+ { span: 6, content: 'Half Width' }
32
+ ]
33
+ },
34
+ {
35
+ cells: [
36
+ { span: 4, content: '1/3 Width' },
37
+ { span: 4, content: '1/3 Width' },
38
+ { span: 4, content: '1/3 Width' }
39
+ ]
40
+ },
41
+ {
42
+ cells: [{ span: 12, content: 'Full Width' }]
43
+ }
44
+ ];
45
+ </script>
46
+
47
+ <FlexibleGrid {rows} />
48
+ ```
49
+
50
+ ## Advanced Usage
51
+
52
+ ```svelte
53
+ <script lang="ts">
54
+ import { FlexibleGrid } from '@aspect-ops/exon-ui';
55
+ import type { FlexibleGridRow } from '@aspect-ops/exon-ui';
56
+
57
+ const customRows: FlexibleGridRow[] = [
58
+ {
59
+ cells: [
60
+ {
61
+ span: 8,
62
+ content: '<strong>Main Content</strong>',
63
+ bgColor: '#4654A3',
64
+ textColor: 'white'
65
+ },
66
+ {
67
+ span: 4,
68
+ content: 'Sidebar',
69
+ bgColor: '#FF3131',
70
+ textColor: 'white',
71
+ class: 'custom-cell'
72
+ }
73
+ ],
74
+ class: 'custom-row'
75
+ }
76
+ ];
77
+ </script>
78
+
79
+ <FlexibleGrid
80
+ rows={customRows}
81
+ gap="md"
82
+ cellHeight="120px"
83
+ defaultBgColor="#6B7A99"
84
+ defaultTextColor="white"
85
+ columns={12}
86
+ class="my-custom-grid"
87
+ />
88
+ ```
89
+
90
+ ## Props
91
+
92
+ | Prop | Type | Default | Description |
93
+ | ------------------ | ------------------------ | ------------ | ------------------------------------------------------------------------ |
94
+ | `rows` | `FlexibleGridRow[]` | **Required** | Array of row objects containing cells |
95
+ | `gap` | `SpacingToken \| string` | `'xs'` | Gap between cells and rows (supports design tokens or custom CSS values) |
96
+ | `cellHeight` | `string` | `'80px'` | Default height for all cells |
97
+ | `defaultBgColor` | `string` | `'#6B7A99'` | Default background color for cells |
98
+ | `defaultTextColor` | `string` | `'white'` | Default text color for cells |
99
+ | `columns` | `number` | `12` | Total number of columns in the grid |
100
+ | `class` | `string` | `''` | Additional CSS classes for the grid container |
101
+
102
+ ## Type Definitions
103
+
104
+ ### FlexibleGridCell
105
+
106
+ ```typescript
107
+ interface FlexibleGridCell {
108
+ span: number; // How many columns to span (1-12)
109
+ content: string; // Content to display (can use HTML)
110
+ bgColor?: string; // Optional background color
111
+ textColor?: string; // Optional text color
112
+ class?: string; // Optional custom classes
113
+ }
114
+ ```
115
+
116
+ ### FlexibleGridRow
117
+
118
+ ```typescript
119
+ interface FlexibleGridRow {
120
+ cells: FlexibleGridCell[];
121
+ class?: string; // Optional custom classes for the row
122
+ }
123
+ ```
124
+
125
+ ## Spacing Tokens
126
+
127
+ The `gap` prop accepts the following design tokens:
128
+
129
+ - `xs` - 0.25rem (4px)
130
+ - `sm` - 0.5rem (8px)
131
+ - `md` - 1rem (16px)
132
+ - `lg` - 1.5rem (24px)
133
+ - `xl` - 2rem (32px)
134
+ - `2xl` - 3rem (48px)
135
+ - `3xl` - 4rem (64px)
136
+
137
+ Or you can use any custom CSS value like `'10px'`, `'1.5rem'`, etc.
138
+
139
+ ## Responsive Behavior
140
+
141
+ - **Desktop/Tablet (>768px)**: 12-column grid
142
+ - **Mobile (480-768px)**: Cells maintain height with adjusted font size
143
+ - **Small Mobile (<480px)**: 6-column grid with reduced cell height and font size
144
+
145
+ ## Accessibility
146
+
147
+ - Cells have hover effects with smooth transitions
148
+ - Supports keyboard navigation (inherits from native HTML)
149
+ - Content can include semantic HTML for better accessibility
150
+
151
+ ## Examples
152
+
153
+ ### Dashboard Layout
154
+
155
+ ```svelte
156
+ <script lang="ts">
157
+ const dashboardRows = [
158
+ {
159
+ cells: [{ span: 12, content: '<h2>Dashboard Header</h2>', bgColor: '#270949' }]
160
+ },
161
+ {
162
+ cells: [
163
+ { span: 3, content: 'Stat 1', bgColor: '#4654A3' },
164
+ { span: 3, content: 'Stat 2', bgColor: '#4654A3' },
165
+ { span: 3, content: 'Stat 3', bgColor: '#4654A3' },
166
+ { span: 3, content: 'Stat 4', bgColor: '#4654A3' }
167
+ ]
168
+ },
169
+ {
170
+ cells: [
171
+ { span: 8, content: 'Main Chart', bgColor: '#FF3131' },
172
+ { span: 4, content: 'Summary', bgColor: '#6B7A99' }
173
+ ]
174
+ }
175
+ ];
176
+ </script>
177
+
178
+ <FlexibleGrid rows={dashboardRows} gap="md" cellHeight="150px" />
179
+ ```
180
+
181
+ ### Content Layout
182
+
183
+ ```svelte
184
+ <script lang="ts">
185
+ const contentRows = [
186
+ {
187
+ cells: [
188
+ { span: 9, content: 'Article Content', cellHeight: '300px' },
189
+ { span: 3, content: 'Sidebar Widgets' }
190
+ ]
191
+ },
192
+ {
193
+ cells: [
194
+ { span: 4, content: 'Related 1' },
195
+ { span: 4, content: 'Related 2' },
196
+ { span: 4, content: 'Related 3' }
197
+ ]
198
+ }
199
+ ];
200
+ </script>
201
+
202
+ <FlexibleGrid rows={contentRows} gap="lg" />
203
+ ```
204
+
205
+ ## Browser Support
206
+
207
+ - Modern browsers (Chrome, Firefox, Safari, Edge)
208
+ - IE11+ (with polyfills for CSS Grid)
209
+
210
+ ## License
211
+
212
+ MIT
@@ -0,0 +1,2 @@
1
+ export { default as FlexibleGrid } from './FlexibleGrid.svelte';
2
+ export type { FlexibleGridCell, FlexibleGridRow, FlexibleGridProps } from '../../types/index.js';
@@ -0,0 +1 @@
1
+ export { default as FlexibleGrid } from './FlexibleGrid.svelte';