@wso2/oxygen-ui 0.5.0 → 0.6.0
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.
- package/.ai/AGENTS.md +17 -15
- package/.ai/components.md +706 -73
- package/.ai/migration.md +4 -2
- package/.ai/patterns.md +20 -8
- package/.ai/theming.md +15 -2
- package/.claude/components.md +706 -73
- package/.claude/migration.md +4 -2
- package/.claude/patterns.md +20 -8
- package/.claude/skills/oxygen-component/SKILL.md +12 -6
- package/.claude/skills/oxygen-migrate/SKILL.md +5 -2
- package/.claude/skills/oxygen-sync/SKILL.md +157 -0
- package/.claude/theming.md +15 -2
- package/bin/cli.js +32 -19
- package/dist/index.js +121 -101
- package/dist/index.js.map +3 -3
- package/dist/utils/pxToRem.d.ts +1 -1
- package/package.json +2 -2
package/.claude/components.md
CHANGED
|
@@ -7,13 +7,19 @@ Complete API reference for custom Oxygen UI components. For MUI components, refe
|
|
|
7
7
|
- [OxygenUIThemeProvider](#oxygenuitthemeprovider)
|
|
8
8
|
- [ListingTable](#listingtable)
|
|
9
9
|
- [AppShell](#appshell)
|
|
10
|
+
- [Layout](#layout)
|
|
10
11
|
- [Header](#header)
|
|
11
12
|
- [Sidebar](#sidebar)
|
|
13
|
+
- [Footer](#footer)
|
|
14
|
+
- [UserMenu](#usermenu)
|
|
12
15
|
- [Form](#form)
|
|
13
16
|
- [NotificationPanel](#notificationpanel)
|
|
17
|
+
- [NotificationBanner](#notificationbanner)
|
|
18
|
+
- [ParticleBackground](#particlebackground)
|
|
14
19
|
- [Other Components](#other-components)
|
|
15
20
|
- [MUI X Namespaces](#mui-x-namespaces)
|
|
16
21
|
- [Hooks](#hooks)
|
|
22
|
+
- [Utilities](#utilities)
|
|
17
23
|
|
|
18
24
|
---
|
|
19
25
|
|
|
@@ -300,6 +306,45 @@ import { AppShell } from '@wso2/oxygen-ui';
|
|
|
300
306
|
|
|
301
307
|
---
|
|
302
308
|
|
|
309
|
+
## Layout
|
|
310
|
+
|
|
311
|
+
Lightweight layout compound component for building flex-based page structures.
|
|
312
|
+
|
|
313
|
+
```tsx
|
|
314
|
+
import { Layout } from '@wso2/oxygen-ui';
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Sub-components
|
|
318
|
+
|
|
319
|
+
| Component | Description |
|
|
320
|
+
|-----------|-------------|
|
|
321
|
+
| `Layout.Sidebar` | Sidebar area |
|
|
322
|
+
| `Layout.Navbar` | Top navigation area |
|
|
323
|
+
| `Layout.Content` | Main content area |
|
|
324
|
+
| `Layout.Header` | Header area |
|
|
325
|
+
|
|
326
|
+
### Props
|
|
327
|
+
|
|
328
|
+
Extends MUI `BoxProps`. The root component renders a flex row container.
|
|
329
|
+
|
|
330
|
+
### Usage
|
|
331
|
+
|
|
332
|
+
```tsx
|
|
333
|
+
<Layout>
|
|
334
|
+
<Layout.Navbar>
|
|
335
|
+
<Header>...</Header>
|
|
336
|
+
</Layout.Navbar>
|
|
337
|
+
<Layout.Sidebar>
|
|
338
|
+
<Sidebar>...</Sidebar>
|
|
339
|
+
</Layout.Sidebar>
|
|
340
|
+
<Layout.Content>
|
|
341
|
+
{/* Page content */}
|
|
342
|
+
</Layout.Content>
|
|
343
|
+
</Layout>
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
303
348
|
## Header
|
|
304
349
|
|
|
305
350
|
Top navigation bar compound component.
|
|
@@ -436,7 +481,7 @@ import { HomeIcon, SettingsIcon } from '@wso2/oxygen-ui-icons-react';
|
|
|
436
481
|
|
|
437
482
|
## Form
|
|
438
483
|
|
|
439
|
-
Form components namespace with
|
|
484
|
+
Form components namespace for building forms with card-based layouts and wizards.
|
|
440
485
|
|
|
441
486
|
```tsx
|
|
442
487
|
import { Form } from '@wso2/oxygen-ui';
|
|
@@ -446,17 +491,19 @@ import { Form } from '@wso2/oxygen-ui';
|
|
|
446
491
|
|
|
447
492
|
| Component | Description |
|
|
448
493
|
|-----------|-------------|
|
|
449
|
-
| `Form.
|
|
450
|
-
| `Form.
|
|
451
|
-
| `Form.
|
|
452
|
-
| `Form.
|
|
453
|
-
| `Form.
|
|
454
|
-
| `Form.
|
|
494
|
+
| `Form.CardButton` | Clickable card button for selection |
|
|
495
|
+
| `Form.DisappearingCardButtonContent` | Content that fades when card is selected |
|
|
496
|
+
| `Form.CardHeader` | Card header section |
|
|
497
|
+
| `Form.CardContent` | Card content section |
|
|
498
|
+
| `Form.CardActions` | Card action buttons section |
|
|
499
|
+
| `Form.CardMedia` | Card media/image section |
|
|
500
|
+
| `Form.Stack` | Form field stack layout |
|
|
455
501
|
| `Form.Header` | Section header text |
|
|
456
502
|
| `Form.Subheader` | Section subheader text |
|
|
457
503
|
| `Form.Body` | Section body text |
|
|
458
|
-
| `Form.
|
|
504
|
+
| `Form.Section` | Form section with heading |
|
|
459
505
|
| `Form.Wizard` | Multi-step form wizard |
|
|
506
|
+
| `Form.ElementWrapper` | Wrapper for form elements |
|
|
460
507
|
|
|
461
508
|
### Wizard Props
|
|
462
509
|
|
|
@@ -479,26 +526,28 @@ interface WizardProps {
|
|
|
479
526
|
### Usage
|
|
480
527
|
|
|
481
528
|
```tsx
|
|
529
|
+
// Card-based selection form
|
|
530
|
+
<Form.Stack spacing={2}>
|
|
531
|
+
<Form.CardButton selected={selected === 'option1'} onClick={() => setSelected('option1')}>
|
|
532
|
+
<Form.CardHeader title="Option 1" />
|
|
533
|
+
<Form.CardContent>
|
|
534
|
+
<Form.Body>Description of option 1</Form.Body>
|
|
535
|
+
</Form.CardContent>
|
|
536
|
+
</Form.CardButton>
|
|
537
|
+
|
|
538
|
+
<Form.CardButton selected={selected === 'option2'} onClick={() => setSelected('option2')}>
|
|
539
|
+
<Form.CardHeader title="Option 2" />
|
|
540
|
+
<Form.CardContent>
|
|
541
|
+
<Form.Body>Description of option 2</Form.Body>
|
|
542
|
+
</Form.CardContent>
|
|
543
|
+
</Form.CardButton>
|
|
544
|
+
</Form.Stack>
|
|
545
|
+
|
|
546
|
+
// Section with typography
|
|
482
547
|
<Form.Section>
|
|
483
548
|
<Form.Header>User Details</Form.Header>
|
|
484
549
|
<Form.Subheader>Enter your information</Form.Subheader>
|
|
485
|
-
|
|
486
|
-
<Form.Stack spacing={2}>
|
|
487
|
-
<Form.TextInput
|
|
488
|
-
label="Name"
|
|
489
|
-
value={name}
|
|
490
|
-
onChange={(e) => setName(e.target.value)}
|
|
491
|
-
/>
|
|
492
|
-
|
|
493
|
-
<Form.SelectInput
|
|
494
|
-
label="Role"
|
|
495
|
-
value={role}
|
|
496
|
-
onChange={(e) => setRole(e.target.value)}
|
|
497
|
-
>
|
|
498
|
-
<Form.MenuItem value="admin">Admin</Form.MenuItem>
|
|
499
|
-
<Form.MenuItem value="user">User</Form.MenuItem>
|
|
500
|
-
</Form.SelectInput>
|
|
501
|
-
</Form.Stack>
|
|
550
|
+
<Form.Body>Additional context about the form section.</Form.Body>
|
|
502
551
|
</Form.Section>
|
|
503
552
|
```
|
|
504
553
|
|
|
@@ -506,50 +555,321 @@ interface WizardProps {
|
|
|
506
555
|
|
|
507
556
|
## NotificationPanel
|
|
508
557
|
|
|
509
|
-
Slide-out notification panel with tabs.
|
|
558
|
+
Slide-out notification panel with tabs and compound component pattern.
|
|
510
559
|
|
|
511
560
|
```tsx
|
|
512
561
|
import { NotificationPanel } from '@wso2/oxygen-ui';
|
|
513
562
|
```
|
|
514
563
|
|
|
564
|
+
### Sub-components
|
|
565
|
+
|
|
566
|
+
| Component | Description |
|
|
567
|
+
|-----------|-------------|
|
|
568
|
+
| `NotificationPanel.Header` | Panel header container |
|
|
569
|
+
| `NotificationPanel.HeaderIcon` | Header icon |
|
|
570
|
+
| `NotificationPanel.HeaderTitle` | Header title text |
|
|
571
|
+
| `NotificationPanel.HeaderBadge` | Unread count badge |
|
|
572
|
+
| `NotificationPanel.HeaderClose` | Close button |
|
|
573
|
+
| `NotificationPanel.Tabs` | Tab navigation |
|
|
574
|
+
| `NotificationPanel.Actions` | Action buttons container |
|
|
575
|
+
| `NotificationPanel.List` | Notification list container |
|
|
576
|
+
| `NotificationPanel.Item` | Individual notification item |
|
|
577
|
+
| `NotificationPanel.ItemAvatar` | Item avatar |
|
|
578
|
+
| `NotificationPanel.ItemTitle` | Item title |
|
|
579
|
+
| `NotificationPanel.ItemMessage` | Item message text |
|
|
580
|
+
| `NotificationPanel.ItemTimestamp` | Item timestamp |
|
|
581
|
+
| `NotificationPanel.ItemAction` | Item action button |
|
|
582
|
+
| `NotificationPanel.EmptyState` | Empty state display |
|
|
583
|
+
|
|
515
584
|
### Props
|
|
516
585
|
|
|
517
586
|
| Prop | Type | Default | Description |
|
|
518
587
|
|------|------|---------|-------------|
|
|
519
588
|
| `open` | `boolean` | required | Panel visibility |
|
|
520
589
|
| `onClose` | `() => void` | required | Close handler |
|
|
521
|
-
|
|
590
|
+
|
|
591
|
+
### Tabs Props
|
|
592
|
+
|
|
593
|
+
```tsx
|
|
594
|
+
interface NotificationTabConfig {
|
|
595
|
+
id: string;
|
|
596
|
+
label: string;
|
|
597
|
+
badge?: number;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
interface NotificationTabsProps {
|
|
601
|
+
tabs: NotificationTabConfig[];
|
|
602
|
+
activeTab: string;
|
|
603
|
+
onTabChange: (tabId: string) => void;
|
|
604
|
+
}
|
|
605
|
+
```
|
|
522
606
|
|
|
523
607
|
### Usage
|
|
524
608
|
|
|
525
609
|
```tsx
|
|
526
610
|
<NotificationPanel open={open} onClose={() => setOpen(false)}>
|
|
527
611
|
<NotificationPanel.Header>
|
|
528
|
-
<NotificationPanel.
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
<NotificationPanel.Actions>
|
|
533
|
-
<Button onClick={markAllRead}>Mark all read</Button>
|
|
534
|
-
</NotificationPanel.Actions>
|
|
612
|
+
<NotificationPanel.HeaderIcon />
|
|
613
|
+
<NotificationPanel.HeaderTitle>Notifications</NotificationPanel.HeaderTitle>
|
|
614
|
+
<NotificationPanel.HeaderBadge count={unreadCount} />
|
|
615
|
+
<NotificationPanel.HeaderClose />
|
|
535
616
|
</NotificationPanel.Header>
|
|
536
617
|
|
|
618
|
+
<NotificationPanel.Tabs
|
|
619
|
+
tabs={[
|
|
620
|
+
{ id: 'all', label: 'All' },
|
|
621
|
+
{ id: 'unread', label: 'Unread', badge: 3 },
|
|
622
|
+
]}
|
|
623
|
+
activeTab={activeTab}
|
|
624
|
+
onTabChange={setActiveTab}
|
|
625
|
+
/>
|
|
626
|
+
|
|
627
|
+
<NotificationPanel.Actions>
|
|
628
|
+
<Button onClick={markAllRead}>Mark all read</Button>
|
|
629
|
+
</NotificationPanel.Actions>
|
|
630
|
+
|
|
537
631
|
<NotificationPanel.List>
|
|
538
632
|
{notifications.map((n) => (
|
|
539
|
-
<NotificationPanel.Item
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
633
|
+
<NotificationPanel.Item key={n.id}>
|
|
634
|
+
<NotificationPanel.ItemAvatar src={n.avatar} />
|
|
635
|
+
<NotificationPanel.ItemTitle>{n.title}</NotificationPanel.ItemTitle>
|
|
636
|
+
<NotificationPanel.ItemMessage>{n.message}</NotificationPanel.ItemMessage>
|
|
637
|
+
<NotificationPanel.ItemTimestamp>{n.timestamp}</NotificationPanel.ItemTimestamp>
|
|
638
|
+
<NotificationPanel.ItemAction onClick={() => handleAction(n.id)}>
|
|
639
|
+
View
|
|
640
|
+
</NotificationPanel.ItemAction>
|
|
641
|
+
</NotificationPanel.Item>
|
|
546
642
|
))}
|
|
547
643
|
</NotificationPanel.List>
|
|
548
644
|
|
|
549
|
-
|
|
645
|
+
{notifications.length === 0 && (
|
|
646
|
+
<NotificationPanel.EmptyState message="No notifications" />
|
|
647
|
+
)}
|
|
550
648
|
</NotificationPanel>
|
|
551
649
|
```
|
|
552
650
|
|
|
651
|
+
### Hooks
|
|
652
|
+
|
|
653
|
+
```tsx
|
|
654
|
+
import { useNotificationPanel } from '@wso2/oxygen-ui';
|
|
655
|
+
|
|
656
|
+
// Access panel context inside NotificationPanel
|
|
657
|
+
const { open, onClose } = useNotificationPanel();
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
---
|
|
661
|
+
|
|
662
|
+
## SearchBar
|
|
663
|
+
|
|
664
|
+
Search input components with optional advanced filtering.
|
|
665
|
+
|
|
666
|
+
```tsx
|
|
667
|
+
import { SearchBar, SearchBarWithAdvancedFilter } from '@wso2/oxygen-ui';
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
### SearchBar Props
|
|
671
|
+
|
|
672
|
+
| Prop | Type | Default | Description |
|
|
673
|
+
|------|------|---------|-------------|
|
|
674
|
+
| `value` | `string` | - | Search input value |
|
|
675
|
+
| `onChange` | `(value: string) => void` | - | Change handler |
|
|
676
|
+
| `placeholder` | `string` | `'Search...'` | Placeholder text |
|
|
677
|
+
|
|
678
|
+
### SearchBarWithAdvancedFilter Props
|
|
679
|
+
|
|
680
|
+
| Prop | Type | Default | Description |
|
|
681
|
+
|------|------|---------|-------------|
|
|
682
|
+
| `value` | `string` | - | Search input value |
|
|
683
|
+
| `onChange` | `(value: string) => void` | - | Change handler |
|
|
684
|
+
| `advancedFilters` | `AdvancedFilterState` | - | Filter state |
|
|
685
|
+
| `onAdvancedFilterChange` | `(filters: AdvancedFilterState) => void` | - | Filter change handler |
|
|
686
|
+
|
|
687
|
+
### Usage
|
|
688
|
+
|
|
689
|
+
```tsx
|
|
690
|
+
// Basic search
|
|
691
|
+
<SearchBar
|
|
692
|
+
value={search}
|
|
693
|
+
onChange={setSearch}
|
|
694
|
+
placeholder="Search users..."
|
|
695
|
+
/>
|
|
696
|
+
|
|
697
|
+
// With advanced filters
|
|
698
|
+
<SearchBarWithAdvancedFilter
|
|
699
|
+
value={search}
|
|
700
|
+
onChange={setSearch}
|
|
701
|
+
advancedFilters={filters}
|
|
702
|
+
onAdvancedFilterChange={setFilters}
|
|
703
|
+
/>
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
---
|
|
707
|
+
|
|
708
|
+
## StatCard
|
|
709
|
+
|
|
710
|
+
Statistics display card for dashboards.
|
|
711
|
+
|
|
712
|
+
```tsx
|
|
713
|
+
import { StatCard } from '@wso2/oxygen-ui';
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
### Props
|
|
717
|
+
|
|
718
|
+
| Prop | Type | Default | Description |
|
|
719
|
+
|------|------|---------|-------------|
|
|
720
|
+
| `title` | `string` | required | Stat label |
|
|
721
|
+
| `value` | `string \| number` | required | Stat value |
|
|
722
|
+
| `icon` | `ReactNode` | - | Optional icon |
|
|
723
|
+
| `change` | `number` | - | Percentage change |
|
|
724
|
+
| `trend` | `'up' \| 'down'` | - | Trend direction |
|
|
725
|
+
|
|
726
|
+
### Usage
|
|
727
|
+
|
|
728
|
+
```tsx
|
|
729
|
+
<StatCard
|
|
730
|
+
title="Total Users"
|
|
731
|
+
value="12,345"
|
|
732
|
+
change={12.5}
|
|
733
|
+
trend="up"
|
|
734
|
+
/>
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
---
|
|
738
|
+
|
|
739
|
+
## PageContent
|
|
740
|
+
|
|
741
|
+
Page content wrapper with consistent padding and max-width.
|
|
742
|
+
|
|
743
|
+
```tsx
|
|
744
|
+
import { PageContent } from '@wso2/oxygen-ui';
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
### Props
|
|
748
|
+
|
|
749
|
+
| Prop | Type | Default | Description |
|
|
750
|
+
|------|------|---------|-------------|
|
|
751
|
+
| `children` | `ReactNode` | required | Page content |
|
|
752
|
+
| `maxWidth` | `string \| number` | - | Maximum width |
|
|
753
|
+
|
|
754
|
+
### Usage
|
|
755
|
+
|
|
756
|
+
```tsx
|
|
757
|
+
<PageContent>
|
|
758
|
+
<PageTitle>Dashboard</PageTitle>
|
|
759
|
+
{/* Page content */}
|
|
760
|
+
</PageContent>
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
---
|
|
764
|
+
|
|
765
|
+
## ComplexSelect
|
|
766
|
+
|
|
767
|
+
Enhanced select component with search and multi-select capabilities.
|
|
768
|
+
|
|
769
|
+
```tsx
|
|
770
|
+
import { ComplexSelect } from '@wso2/oxygen-ui';
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
### Props
|
|
774
|
+
|
|
775
|
+
| Prop | Type | Default | Description |
|
|
776
|
+
|------|------|---------|-------------|
|
|
777
|
+
| `options` | `Option[]` | required | Select options |
|
|
778
|
+
| `value` | `string \| string[]` | - | Selected value(s) |
|
|
779
|
+
| `onChange` | `(value) => void` | - | Change handler |
|
|
780
|
+
| `multiple` | `boolean` | `false` | Enable multi-select |
|
|
781
|
+
| `searchable` | `boolean` | `false` | Enable search |
|
|
782
|
+
|
|
783
|
+
### Usage
|
|
784
|
+
|
|
785
|
+
```tsx
|
|
786
|
+
<ComplexSelect
|
|
787
|
+
options={[
|
|
788
|
+
{ value: 'us', label: 'United States' },
|
|
789
|
+
{ value: 'uk', label: 'United Kingdom' },
|
|
790
|
+
{ value: 'ca', label: 'Canada' },
|
|
791
|
+
]}
|
|
792
|
+
value={country}
|
|
793
|
+
onChange={setCountry}
|
|
794
|
+
searchable
|
|
795
|
+
/>
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
---
|
|
799
|
+
|
|
800
|
+
## NotificationBanner
|
|
801
|
+
|
|
802
|
+
Dismissible system alert banner for top-level announcements.
|
|
803
|
+
|
|
804
|
+
```tsx
|
|
805
|
+
import { NotificationBanner } from '@wso2/oxygen-ui';
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
### Props
|
|
809
|
+
|
|
810
|
+
| Prop | Type | Default | Description |
|
|
811
|
+
|------|------|---------|-------------|
|
|
812
|
+
| `visible` | `boolean` | `true` | Whether the banner is visible |
|
|
813
|
+
| `severity` | `'info' \| 'warning' \| 'error' \| 'success'` | `'info'` | Banner severity/type |
|
|
814
|
+
| `title` | `string` | - | Optional banner title |
|
|
815
|
+
| `message` | `string` | required | Banner message text |
|
|
816
|
+
| `actionLabel` | `string` | - | Optional action button label |
|
|
817
|
+
| `onAction` | `() => void` | - | Action button callback |
|
|
818
|
+
| `onDismiss` | `() => void` | - | Dismiss callback |
|
|
819
|
+
| `sx` | `SxProps` | - | Custom styles |
|
|
820
|
+
|
|
821
|
+
### Usage
|
|
822
|
+
|
|
823
|
+
```tsx
|
|
824
|
+
<NotificationBanner
|
|
825
|
+
visible={showBanner}
|
|
826
|
+
severity="info"
|
|
827
|
+
title="Scheduled Maintenance"
|
|
828
|
+
message="The system will be undergoing maintenance on Dec 20th."
|
|
829
|
+
actionLabel="Learn More"
|
|
830
|
+
onAction={() => openMaintenanceInfo()}
|
|
831
|
+
onDismiss={() => setShowBanner(false)}
|
|
832
|
+
/>
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
---
|
|
836
|
+
|
|
837
|
+
## ParticleBackground
|
|
838
|
+
|
|
839
|
+
Animated particle canvas background with mouse interaction. Adapts to light/dark color scheme.
|
|
840
|
+
|
|
841
|
+
```tsx
|
|
842
|
+
import { ParticleBackground } from '@wso2/oxygen-ui';
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
### Props
|
|
846
|
+
|
|
847
|
+
| Prop | Type | Default | Description |
|
|
848
|
+
|------|------|---------|-------------|
|
|
849
|
+
| `opacity` | `number` | `0.5` | Canvas opacity |
|
|
850
|
+
| `baseDensity` | `number` | `0.12` | Particles per 10,000 px² |
|
|
851
|
+
| `maxSpeed` | `number` | `0.3` | Maximum speed in px per frame |
|
|
852
|
+
| `radius` | `[number, number]` | `[2.0, 3.2]` | Min and max particle radius |
|
|
853
|
+
| `linkDist` | `number` | `210` | Maximum distance to draw lines between particles |
|
|
854
|
+
| `linkAlpha` | `number` | `0.2` | Base opacity of the lines |
|
|
855
|
+
| `mouseInfluence` | `number` | `110` | Radius of mouse influence |
|
|
856
|
+
| `repelStrength` | `number` | `0.35` | Strength of the repel effect |
|
|
857
|
+
| `clickBurst` | `number` | `120` | Impulse on click |
|
|
858
|
+
|
|
859
|
+
### Usage
|
|
860
|
+
|
|
861
|
+
```tsx
|
|
862
|
+
// Fixed background behind content
|
|
863
|
+
<ParticleBackground opacity={0.3} />
|
|
864
|
+
|
|
865
|
+
// Higher density with stronger interaction
|
|
866
|
+
<ParticleBackground
|
|
867
|
+
baseDensity={0.2}
|
|
868
|
+
mouseInfluence={150}
|
|
869
|
+
repelStrength={0.5}
|
|
870
|
+
/>
|
|
871
|
+
```
|
|
872
|
+
|
|
553
873
|
---
|
|
554
874
|
|
|
555
875
|
## Other Components
|
|
@@ -574,34 +894,131 @@ import { ThemeSwitcher } from '@wso2/oxygen-ui';
|
|
|
574
894
|
<ThemeSwitcher /> // Requires OxygenUIThemeProvider with themes
|
|
575
895
|
```
|
|
576
896
|
|
|
577
|
-
|
|
897
|
+
---
|
|
898
|
+
|
|
899
|
+
## Footer
|
|
578
900
|
|
|
579
|
-
Application footer component.
|
|
901
|
+
Application footer compound component with composition pattern.
|
|
580
902
|
|
|
581
903
|
```tsx
|
|
582
904
|
import { Footer } from '@wso2/oxygen-ui';
|
|
905
|
+
```
|
|
583
906
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
907
|
+
### Sub-components
|
|
908
|
+
|
|
909
|
+
| Component | Description |
|
|
910
|
+
|-----------|-------------|
|
|
911
|
+
| `Footer.Copyright` | Copyright text display |
|
|
912
|
+
| `Footer.Version` | Version number display (monospace, muted) |
|
|
913
|
+
| `Footer.Link` | Footer link (auto-placed in right section) |
|
|
914
|
+
| `Footer.Divider` | Visual divider between footer items |
|
|
915
|
+
|
|
916
|
+
### Footer Props
|
|
917
|
+
|
|
918
|
+
| Prop | Type | Default | Description |
|
|
919
|
+
|------|------|---------|-------------|
|
|
920
|
+
| `children` | `ReactNode` | required | Footer sub-components |
|
|
921
|
+
| `sx` | `SxProps` | - | Custom styles |
|
|
922
|
+
|
|
923
|
+
### Usage
|
|
924
|
+
|
|
925
|
+
```tsx
|
|
926
|
+
<Footer>
|
|
927
|
+
<Footer.Copyright>© 2025 WSO2 LLC. All rights reserved.</Footer.Copyright>
|
|
928
|
+
<Footer.Divider />
|
|
929
|
+
<Footer.Version>v2.1.0</Footer.Version>
|
|
930
|
+
<Footer.Link href="/terms">Terms & Conditions</Footer.Link>
|
|
931
|
+
<Footer.Link href="/privacy">Privacy Policy</Footer.Link>
|
|
932
|
+
</Footer>
|
|
592
933
|
```
|
|
593
934
|
|
|
594
|
-
|
|
935
|
+
> **Note:** `Footer.Copyright`, `Footer.Version`, and `Footer.Divider` are placed in the left section. `Footer.Link` elements are placed in the right section. Layout is responsive (stacks on mobile).
|
|
936
|
+
|
|
937
|
+
---
|
|
938
|
+
|
|
939
|
+
## UserMenu
|
|
595
940
|
|
|
596
|
-
User profile dropdown menu.
|
|
941
|
+
User profile dropdown menu compound component.
|
|
597
942
|
|
|
598
943
|
```tsx
|
|
599
944
|
import { UserMenu } from '@wso2/oxygen-ui';
|
|
945
|
+
```
|
|
600
946
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
947
|
+
### Sub-components
|
|
948
|
+
|
|
949
|
+
| Component | Description |
|
|
950
|
+
|-----------|-------------|
|
|
951
|
+
| `UserMenu.Trigger` | Avatar button that opens the menu |
|
|
952
|
+
| `UserMenu.Header` | User info section (name, email, avatar, role badge) |
|
|
953
|
+
| `UserMenu.Item` | Menu item with icon, label, and optional badge |
|
|
954
|
+
| `UserMenu.Logout` | Destructive logout menu item |
|
|
955
|
+
| `UserMenu.Divider` | Menu divider |
|
|
956
|
+
|
|
957
|
+
### UserMenu Props
|
|
958
|
+
|
|
959
|
+
| Prop | Type | Default | Description |
|
|
960
|
+
|------|------|---------|-------------|
|
|
961
|
+
| `children` | `ReactNode` | required | Menu sub-components |
|
|
962
|
+
|
|
963
|
+
### UserMenuTrigger Props
|
|
964
|
+
|
|
965
|
+
| Prop | Type | Default | Description |
|
|
966
|
+
|------|------|---------|-------------|
|
|
967
|
+
| `name` | `string` | required | User display name |
|
|
968
|
+
| `avatar` | `string \| null` | - | Avatar image URL |
|
|
969
|
+
| `showName` | `boolean` | `false` | Show name text after avatar |
|
|
970
|
+
|
|
971
|
+
### UserMenuHeader Props
|
|
972
|
+
|
|
973
|
+
| Prop | Type | Default | Description |
|
|
974
|
+
|------|------|---------|-------------|
|
|
975
|
+
| `name` | `string` | required | User display name |
|
|
976
|
+
| `email` | `string` | required | User email address |
|
|
977
|
+
| `avatar` | `string \| null` | - | Avatar image URL |
|
|
978
|
+
| `role` | `string` | - | Role badge text (e.g., "Pro", "Admin") |
|
|
979
|
+
|
|
980
|
+
### UserMenuItem Props
|
|
981
|
+
|
|
982
|
+
| Prop | Type | Default | Description |
|
|
983
|
+
|------|------|---------|-------------|
|
|
984
|
+
| `icon` | `ReactNode` | - | Left-side icon |
|
|
985
|
+
| `label` | `string` | required | Item label text |
|
|
986
|
+
| `badge` | `string` | - | Right-side badge/chip |
|
|
987
|
+
| `onClick` | `() => void` | - | Click handler |
|
|
988
|
+
|
|
989
|
+
### UserMenuLogout Props
|
|
990
|
+
|
|
991
|
+
| Prop | Type | Default | Description |
|
|
992
|
+
|------|------|---------|-------------|
|
|
993
|
+
| `icon` | `ReactNode` | - | Left-side icon |
|
|
994
|
+
| `label` | `string` | `'Log out'` | Item label text |
|
|
995
|
+
| `onClick` | `() => void` | - | Click handler |
|
|
996
|
+
|
|
997
|
+
### UserMenuUser Type
|
|
998
|
+
|
|
999
|
+
```tsx
|
|
1000
|
+
interface UserMenuUser {
|
|
1001
|
+
name: string;
|
|
1002
|
+
email: string;
|
|
1003
|
+
avatar?: string;
|
|
1004
|
+
role?: string;
|
|
1005
|
+
}
|
|
1006
|
+
```
|
|
1007
|
+
|
|
1008
|
+
### Usage
|
|
1009
|
+
|
|
1010
|
+
```tsx
|
|
1011
|
+
import { UserMenu } from '@wso2/oxygen-ui';
|
|
1012
|
+
import { UserIcon, SettingsIcon, LogOutIcon } from '@wso2/oxygen-ui-icons-react';
|
|
1013
|
+
|
|
1014
|
+
<UserMenu>
|
|
1015
|
+
<UserMenu.Trigger name="John Doe" avatar="/avatar.png" />
|
|
1016
|
+
<UserMenu.Header name="John Doe" email="john@example.com" role="Admin" />
|
|
1017
|
+
<UserMenu.Item icon={<UserIcon size={20} />} label="Profile" onClick={() => {}} />
|
|
1018
|
+
<UserMenu.Item icon={<SettingsIcon size={20} />} label="Settings" onClick={() => {}} />
|
|
1019
|
+
<UserMenu.Divider />
|
|
1020
|
+
<UserMenu.Logout icon={<LogOutIcon size={20} />} onClick={() => signOut()} />
|
|
1021
|
+
</UserMenu>
|
|
605
1022
|
```
|
|
606
1023
|
|
|
607
1024
|
### PageTitle
|
|
@@ -637,9 +1054,11 @@ import { CodeBlock } from '@wso2/oxygen-ui';
|
|
|
637
1054
|
MUI X components are exported as namespaces to avoid naming conflicts.
|
|
638
1055
|
|
|
639
1056
|
```tsx
|
|
640
|
-
import { DataGrid,
|
|
1057
|
+
import { DataGrid, DatePickers, TreeView, AdapterDateFns } from '@wso2/oxygen-ui';
|
|
641
1058
|
```
|
|
642
1059
|
|
|
1060
|
+
> **Note:** Charts are available in a separate package `@wso2/oxygen-ui-charts-react` built on Recharts.
|
|
1061
|
+
|
|
643
1062
|
### DataGrid
|
|
644
1063
|
|
|
645
1064
|
```tsx
|
|
@@ -657,19 +1076,6 @@ import { DataGrid, Charts, DatePickers, TreeView, AdapterDateFns } from '@wso2/o
|
|
|
657
1076
|
/>
|
|
658
1077
|
```
|
|
659
1078
|
|
|
660
|
-
### Charts
|
|
661
|
-
|
|
662
|
-
```tsx
|
|
663
|
-
<Charts.LineChart
|
|
664
|
-
series={[{ data: [1, 2, 3, 4], label: 'Sales' }]}
|
|
665
|
-
xAxis={[{ data: ['Jan', 'Feb', 'Mar', 'Apr'], scaleType: 'band' }]}
|
|
666
|
-
/>
|
|
667
|
-
|
|
668
|
-
<Charts.BarChart series={series} />
|
|
669
|
-
<Charts.PieChart series={series} />
|
|
670
|
-
<Charts.ScatterChart series={series} />
|
|
671
|
-
```
|
|
672
|
-
|
|
673
1079
|
### DatePickers
|
|
674
1080
|
|
|
675
1081
|
```tsx
|
|
@@ -732,6 +1138,71 @@ function ThemeSelector() {
|
|
|
732
1138
|
}
|
|
733
1139
|
```
|
|
734
1140
|
|
|
1141
|
+
### useThemeContent
|
|
1142
|
+
|
|
1143
|
+
Get content based on current color scheme (light/dark).
|
|
1144
|
+
|
|
1145
|
+
```tsx
|
|
1146
|
+
import { useThemeContent } from '@wso2/oxygen-ui';
|
|
1147
|
+
|
|
1148
|
+
function AdaptiveContent() {
|
|
1149
|
+
const content = useThemeContent({
|
|
1150
|
+
light: 'Light mode content',
|
|
1151
|
+
dark: 'Dark mode content',
|
|
1152
|
+
});
|
|
1153
|
+
|
|
1154
|
+
return <Typography>{content}</Typography>;
|
|
1155
|
+
}
|
|
1156
|
+
```
|
|
1157
|
+
|
|
1158
|
+
### useAppShell
|
|
1159
|
+
|
|
1160
|
+
Manage AppShell state (sidebar collapsed, notifications open, etc.).
|
|
1161
|
+
|
|
1162
|
+
```tsx
|
|
1163
|
+
import { useAppShell } from '@wso2/oxygen-ui';
|
|
1164
|
+
|
|
1165
|
+
function MyComponent() {
|
|
1166
|
+
const {
|
|
1167
|
+
sidebarCollapsed,
|
|
1168
|
+
setSidebarCollapsed,
|
|
1169
|
+
notificationPanelOpen,
|
|
1170
|
+
setNotificationPanelOpen,
|
|
1171
|
+
} = useAppShell();
|
|
1172
|
+
|
|
1173
|
+
return (
|
|
1174
|
+
<Button onClick={() => setSidebarCollapsed(!sidebarCollapsed)}>
|
|
1175
|
+
Toggle Sidebar
|
|
1176
|
+
</Button>
|
|
1177
|
+
);
|
|
1178
|
+
}
|
|
1179
|
+
```
|
|
1180
|
+
|
|
1181
|
+
### useNotifications
|
|
1182
|
+
|
|
1183
|
+
Manage notification state and actions.
|
|
1184
|
+
|
|
1185
|
+
```tsx
|
|
1186
|
+
import { useNotifications } from '@wso2/oxygen-ui';
|
|
1187
|
+
|
|
1188
|
+
function NotificationManager() {
|
|
1189
|
+
const {
|
|
1190
|
+
notifications,
|
|
1191
|
+
unreadCount,
|
|
1192
|
+
addNotification,
|
|
1193
|
+
markAsRead,
|
|
1194
|
+
markAllAsRead,
|
|
1195
|
+
removeNotification,
|
|
1196
|
+
} = useNotifications();
|
|
1197
|
+
|
|
1198
|
+
return (
|
|
1199
|
+
<Badge badgeContent={unreadCount}>
|
|
1200
|
+
<NotificationIcon />
|
|
1201
|
+
</Badge>
|
|
1202
|
+
);
|
|
1203
|
+
}
|
|
1204
|
+
```
|
|
1205
|
+
|
|
735
1206
|
### useListingTable
|
|
736
1207
|
|
|
737
1208
|
Access ListingTable context (returns null outside Provider).
|
|
@@ -765,6 +1236,54 @@ function TableControls() {
|
|
|
765
1236
|
}
|
|
766
1237
|
```
|
|
767
1238
|
|
|
1239
|
+
### Component Context Hooks
|
|
1240
|
+
|
|
1241
|
+
```tsx
|
|
1242
|
+
// Header context
|
|
1243
|
+
import { useHeader } from '@wso2/oxygen-ui';
|
|
1244
|
+
const headerContext = useHeader();
|
|
1245
|
+
|
|
1246
|
+
// Sidebar context
|
|
1247
|
+
import { useSidebar } from '@wso2/oxygen-ui';
|
|
1248
|
+
const sidebarContext = useSidebar();
|
|
1249
|
+
|
|
1250
|
+
// NotificationPanel context
|
|
1251
|
+
import { useNotificationPanel } from '@wso2/oxygen-ui';
|
|
1252
|
+
const panelContext = useNotificationPanel();
|
|
1253
|
+
```
|
|
1254
|
+
|
|
1255
|
+
---
|
|
1256
|
+
|
|
1257
|
+
## Utilities
|
|
1258
|
+
|
|
1259
|
+
### formatRelativeTime
|
|
1260
|
+
|
|
1261
|
+
Format a date as a relative time string.
|
|
1262
|
+
|
|
1263
|
+
```tsx
|
|
1264
|
+
import { formatRelativeTime } from '@wso2/oxygen-ui';
|
|
1265
|
+
|
|
1266
|
+
formatRelativeTime(new Date(Date.now() - 1000 * 60 * 5));
|
|
1267
|
+
// Returns: "5 minutes ago"
|
|
1268
|
+
|
|
1269
|
+
formatRelativeTime(new Date(Date.now() - 1000 * 60 * 60 * 2));
|
|
1270
|
+
// Returns: "2 hours ago"
|
|
1271
|
+
```
|
|
1272
|
+
|
|
1273
|
+
Returns: `"Just now"` | `"X minute(s) ago"` | `"X hour(s) ago"` | `"X day(s) ago"` | locale date string (after 7 days).
|
|
1274
|
+
|
|
1275
|
+
### pxToRem
|
|
1276
|
+
|
|
1277
|
+
Convert pixel values to rem based on 14px base font size.
|
|
1278
|
+
|
|
1279
|
+
```tsx
|
|
1280
|
+
import { pxToRem } from '@wso2/oxygen-ui';
|
|
1281
|
+
|
|
1282
|
+
pxToRem(14); // "1rem"
|
|
1283
|
+
pxToRem(28); // "2rem"
|
|
1284
|
+
pxToRem(7); // "0.5rem"
|
|
1285
|
+
```
|
|
1286
|
+
|
|
768
1287
|
---
|
|
769
1288
|
|
|
770
1289
|
## Type Exports
|
|
@@ -779,20 +1298,134 @@ import type {
|
|
|
779
1298
|
|
|
780
1299
|
// ListingTable
|
|
781
1300
|
ListingTableProps,
|
|
1301
|
+
ListingTableContainerProps,
|
|
1302
|
+
ListingTableHeadProps,
|
|
1303
|
+
ListingTableBodyProps,
|
|
1304
|
+
ListingTableFooterProps,
|
|
1305
|
+
ListingTableRowProps,
|
|
1306
|
+
ListingTableCellProps,
|
|
782
1307
|
ListingTableProviderProps,
|
|
783
1308
|
ListingTableContextValue,
|
|
784
1309
|
ListingTableToolbarProps,
|
|
1310
|
+
ListingTableEmptyStateProps,
|
|
1311
|
+
ListingTableDensityControlProps,
|
|
1312
|
+
ListingTableSortLabelProps,
|
|
1313
|
+
ListingTableRowActionsProps,
|
|
1314
|
+
ListingTableCellIconProps,
|
|
785
1315
|
ListingTableDensity,
|
|
786
1316
|
ListingTableVariant,
|
|
787
1317
|
ListingTableSortDirection,
|
|
1318
|
+
ListingSortDirection,
|
|
788
1319
|
|
|
789
|
-
//
|
|
1320
|
+
// AppShell
|
|
790
1321
|
AppShellProps,
|
|
1322
|
+
AppShellNavbarProps,
|
|
1323
|
+
AppShellSidebarProps,
|
|
1324
|
+
AppShellMainProps,
|
|
1325
|
+
AppShellFooterProps,
|
|
1326
|
+
AppShellNotificationPanelProps,
|
|
1327
|
+
|
|
1328
|
+
// Header
|
|
791
1329
|
HeaderProps,
|
|
1330
|
+
HeaderSpacerProps,
|
|
1331
|
+
HeaderToggleProps,
|
|
1332
|
+
HeaderBrandProps,
|
|
1333
|
+
HeaderBrandLogoProps,
|
|
1334
|
+
HeaderBrandTitleProps,
|
|
1335
|
+
HeaderSwitchersProps,
|
|
1336
|
+
HeaderActionsProps,
|
|
1337
|
+
HeaderContextValue,
|
|
1338
|
+
|
|
1339
|
+
// Sidebar
|
|
792
1340
|
SidebarProps,
|
|
1341
|
+
SidebarNavProps,
|
|
1342
|
+
SidebarCategoryProps,
|
|
1343
|
+
SidebarCategoryLabelProps,
|
|
1344
|
+
SidebarItemProps,
|
|
1345
|
+
SidebarItemIconProps,
|
|
1346
|
+
SidebarItemLabelProps,
|
|
1347
|
+
SidebarItemBadgeProps,
|
|
1348
|
+
SidebarFooterProps,
|
|
1349
|
+
SidebarUserProps,
|
|
1350
|
+
SidebarUserAvatarProps,
|
|
1351
|
+
SidebarUserNameProps,
|
|
1352
|
+
SidebarUserEmailProps,
|
|
1353
|
+
SidebarContextValue,
|
|
1354
|
+
SidebarItemContextValue,
|
|
1355
|
+
|
|
1356
|
+
// NotificationPanel
|
|
1357
|
+
NotificationPanelProps,
|
|
1358
|
+
NotificationHeaderProps,
|
|
1359
|
+
NotificationHeaderIconProps,
|
|
1360
|
+
NotificationHeaderTitleProps,
|
|
1361
|
+
NotificationHeaderBadgeProps,
|
|
1362
|
+
NotificationHeaderCloseProps,
|
|
1363
|
+
NotificationTabsProps,
|
|
1364
|
+
NotificationTabConfig,
|
|
1365
|
+
NotificationActionsProps,
|
|
1366
|
+
NotificationListProps,
|
|
1367
|
+
NotificationItemProps,
|
|
1368
|
+
NotificationItemAvatarProps,
|
|
1369
|
+
NotificationItemTitleProps,
|
|
1370
|
+
NotificationItemMessageProps,
|
|
1371
|
+
NotificationItemTimestampProps,
|
|
1372
|
+
NotificationItemActionProps,
|
|
1373
|
+
NotificationItemContextValue,
|
|
1374
|
+
NotificationEmptyStateProps,
|
|
1375
|
+
NotificationPanelContextValue,
|
|
1376
|
+
NotificationType,
|
|
1377
|
+
NotificationTypeProps,
|
|
1378
|
+
|
|
1379
|
+
// Footer
|
|
1380
|
+
FooterProps,
|
|
1381
|
+
FooterCopyrightProps,
|
|
1382
|
+
FooterVersionProps,
|
|
1383
|
+
FooterLinkProps,
|
|
1384
|
+
|
|
1385
|
+
// UserMenu
|
|
1386
|
+
UserMenuProps,
|
|
1387
|
+
UserMenuUser,
|
|
1388
|
+
UserMenuTriggerProps,
|
|
1389
|
+
UserMenuHeaderProps,
|
|
1390
|
+
UserMenuItemProps,
|
|
1391
|
+
UserMenuLogoutProps,
|
|
1392
|
+
|
|
1393
|
+
// NotificationBanner
|
|
1394
|
+
NotificationBannerProps,
|
|
1395
|
+
|
|
1396
|
+
// ParticleBackground
|
|
1397
|
+
ParticleBackgroundProps,
|
|
1398
|
+
|
|
1399
|
+
// Other components
|
|
1400
|
+
CodeBlockProps,
|
|
1401
|
+
ColorSchemeImageProps,
|
|
1402
|
+
ColorSchemeImageAttribute,
|
|
1403
|
+
ComplexSelectProps,
|
|
1404
|
+
PageContentProps,
|
|
1405
|
+
PageTitleProps,
|
|
1406
|
+
PageTitleAvatarProps,
|
|
1407
|
+
PageTitleHeaderProps,
|
|
1408
|
+
PageTitleSubHeaderProps,
|
|
1409
|
+
PageTitleLinkProps,
|
|
1410
|
+
StatCardProps,
|
|
1411
|
+
ThemeSwitcherProps,
|
|
1412
|
+
ThemeSelectProps,
|
|
1413
|
+
SearchBarProps,
|
|
1414
|
+
SearchBarWithAdvancedFilterProps,
|
|
1415
|
+
AdvancedFilterState,
|
|
793
1416
|
|
|
794
1417
|
// Form
|
|
795
1418
|
WizardProps,
|
|
796
1419
|
WizardStep,
|
|
1420
|
+
|
|
1421
|
+
// Hooks
|
|
1422
|
+
AppShellState,
|
|
1423
|
+
AppShellActions,
|
|
1424
|
+
UseAppShellOptions,
|
|
1425
|
+
UseAppShellReturn,
|
|
1426
|
+
NotificationItem,
|
|
1427
|
+
NotificationActions,
|
|
1428
|
+
UseNotificationsOptions,
|
|
1429
|
+
UseNotificationsReturn,
|
|
797
1430
|
} from '@wso2/oxygen-ui';
|
|
798
1431
|
```
|