@umituz/web-dashboard 11.12.0 → 11.14.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.
Files changed (41) hide show
  1. package/package.json +17 -1
  2. package/src/domains/activity/activity.css +229 -0
  3. package/src/domains/activity/components/ActivityFeed.test.tsx +61 -0
  4. package/src/domains/activity/components/ActivityFeed.tsx +132 -0
  5. package/src/domains/activity/components/ActivityTimeline.tsx +127 -0
  6. package/src/domains/activity/components/index.ts +2 -0
  7. package/src/domains/activity/index.ts +3 -0
  8. package/src/domains/activity/types.ts +59 -0
  9. package/src/domains/activity/utils.ts +73 -0
  10. package/src/domains/admin/admin.css +187 -0
  11. package/src/domains/admin/components/AdminGate.test.tsx +44 -0
  12. package/src/domains/admin/components/AdminGate.tsx +41 -0
  13. package/src/domains/admin/components/AdminHealthCard.test.tsx +42 -0
  14. package/src/domains/admin/components/AdminHealthCard.tsx +108 -0
  15. package/src/domains/admin/components/AdminOverview.test.tsx +44 -0
  16. package/src/domains/admin/components/AdminOverview.tsx +133 -0
  17. package/src/domains/admin/components/AdminShell.test.tsx +59 -0
  18. package/src/domains/admin/components/AdminShell.tsx +80 -0
  19. package/src/domains/admin/components/AdminUsersTable.test.tsx +79 -0
  20. package/src/domains/admin/components/AdminUsersTable.tsx +239 -0
  21. package/src/domains/admin/components/index.ts +5 -0
  22. package/src/domains/admin/index.ts +2 -0
  23. package/src/domains/admin/types.ts +66 -0
  24. package/src/domains/filters/components/DataToolbar.test.tsx +65 -0
  25. package/src/domains/filters/components/DataToolbar.tsx +119 -0
  26. package/src/domains/filters/components/index.ts +1 -0
  27. package/src/domains/filters/filters.css +128 -0
  28. package/src/domains/filters/index.ts +2 -0
  29. package/src/domains/filters/types.ts +48 -0
  30. package/src/domains/pages/components/DetailPage.test.tsx +96 -0
  31. package/src/domains/pages/components/DetailPage.tsx +227 -0
  32. package/src/domains/pages/components/index.ts +1 -0
  33. package/src/domains/pages/types.ts +60 -0
  34. package/src/domains/stepper/components/Stepper.test.tsx +71 -0
  35. package/src/domains/stepper/components/Stepper.tsx +79 -0
  36. package/src/domains/stepper/components/Wizard.tsx +84 -0
  37. package/src/domains/stepper/components/index.ts +2 -0
  38. package/src/domains/stepper/index.ts +2 -0
  39. package/src/domains/stepper/stepper.css +145 -0
  40. package/src/domains/stepper/types.ts +40 -0
  41. package/src/index.ts +4 -0
@@ -0,0 +1,71 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
3
+ import { Stepper } from './Stepper';
4
+ import { Wizard } from './Wizard';
5
+
6
+ describe('Stepper', () => {
7
+ it('renders steps with numbers and labels', () => {
8
+ render(
9
+ <Stepper
10
+ steps={['General', 'Settings', 'Review']}
11
+ currentStep={1}
12
+ />,
13
+ );
14
+ expect(screen.getByText('General')).toBeTruthy();
15
+ expect(screen.getByText('Settings')).toBeTruthy();
16
+ expect(screen.getByText('Review')).toBeTruthy();
17
+ });
18
+
19
+ it('triggers onStepClick when clickable is true and previous step is clicked', () => {
20
+ const handleClick = vi.fn();
21
+ render(
22
+ <Stepper
23
+ steps={['Step 1', 'Step 2', 'Step 3']}
24
+ currentStep={2}
25
+ clickable={true}
26
+ onStepClick={handleClick}
27
+ />,
28
+ );
29
+ fireEvent.click(screen.getByText('Step 1'));
30
+ expect(handleClick).toHaveBeenCalledWith(0);
31
+ });
32
+ });
33
+
34
+ describe('Wizard', () => {
35
+ it('navigates next and back', () => {
36
+ const handleStepChange = vi.fn();
37
+ render(
38
+ <Wizard
39
+ steps={['Info', 'Billing', 'Confirmation']}
40
+ currentStep={1}
41
+ onStepChange={handleStepChange}
42
+ >
43
+ <div>Billing Form</div>
44
+ </Wizard>,
45
+ );
46
+ expect(screen.getByText('Billing Form')).toBeTruthy();
47
+
48
+ fireEvent.click(screen.getByText('Back'));
49
+ expect(handleStepChange).toHaveBeenCalledWith(0);
50
+
51
+ fireEvent.click(screen.getByText('Next'));
52
+ expect(handleStepChange).toHaveBeenCalledWith(2);
53
+ });
54
+
55
+ it('triggers onFinish on the last step', () => {
56
+ const handleFinish = vi.fn();
57
+ const handleStepChange = vi.fn();
58
+ render(
59
+ <Wizard
60
+ steps={['Info', 'Review']}
61
+ currentStep={1}
62
+ onStepChange={handleStepChange}
63
+ onFinish={handleFinish}
64
+ >
65
+ <div>Review Step</div>
66
+ </Wizard>,
67
+ );
68
+ fireEvent.click(screen.getByText('Finish'));
69
+ expect(handleFinish).toHaveBeenCalled();
70
+ });
71
+ });
@@ -0,0 +1,79 @@
1
+ import { Check, X } from 'lucide-react';
2
+ import { cn } from '@umituz/web-design-system/utils';
3
+ import type { StepItem, StepperProps } from '../types';
4
+
5
+ function normalizeStep(step: StepItem | string, index: number): StepItem {
6
+ if (typeof step === 'string') {
7
+ return { id: `step-${index}`, label: step };
8
+ }
9
+ return step;
10
+ }
11
+
12
+ export function Stepper({
13
+ steps,
14
+ currentStep,
15
+ currentIndex,
16
+ failStep,
17
+ failIndex,
18
+ orientation = 'horizontal',
19
+ clickable = false,
20
+ onStepClick,
21
+ className,
22
+ }: StepperProps) {
23
+ const activeIndex = currentStep ?? currentIndex ?? 0;
24
+ const failureIndex = failStep ?? failIndex;
25
+
26
+ return (
27
+ <div
28
+ className={cn(
29
+ 'udb-stepper',
30
+ `udb-stepper--${orientation}`,
31
+ className,
32
+ )}
33
+ role="list"
34
+ aria-label="Progress steps"
35
+ >
36
+ {steps.map((rawStep, i) => {
37
+ const step = normalizeStep(rawStep, i);
38
+ const state =
39
+ failureIndex === i ? 'fail' : i < activeIndex ? 'done' : i === activeIndex ? 'current' : 'pending';
40
+ const isClickable = clickable && !step.disabled && i <= activeIndex;
41
+
42
+ return (
43
+ <div
44
+ key={step.id}
45
+ className={cn(
46
+ 'udb-step',
47
+ `udb-step--${state}`,
48
+ isClickable && 'udb-step--clickable',
49
+ )}
50
+ onClick={() => {
51
+ if (isClickable && onStepClick) {
52
+ onStepClick(i);
53
+ }
54
+ }}
55
+ role="listitem"
56
+ aria-current={state === 'current' ? 'step' : undefined}
57
+ >
58
+ {i > 0 && <span className="udb-step__connector" aria-hidden="true" />}
59
+ <div className="udb-step__node" aria-hidden="true">
60
+ {state === 'done' ? (
61
+ <Check size={13} strokeWidth={2.5} />
62
+ ) : state === 'fail' ? (
63
+ <X size={13} strokeWidth={2.5} />
64
+ ) : step.icon ? (
65
+ step.icon
66
+ ) : (
67
+ <span>{i + 1}</span>
68
+ )}
69
+ </div>
70
+ <div className="udb-step__content">
71
+ <span className="udb-step__label">{step.label}</span>
72
+ {step.description && <span className="udb-step__desc">{step.description}</span>}
73
+ </div>
74
+ </div>
75
+ );
76
+ })}
77
+ </div>
78
+ );
79
+ }
@@ -0,0 +1,84 @@
1
+ import { Button } from '@umituz/web-design-system/atoms';
2
+ import { cn } from '@umituz/web-design-system/utils';
3
+ import { Stepper } from './Stepper';
4
+ import type { WizardProps } from '../types';
5
+
6
+ export function Wizard({
7
+ title,
8
+ description,
9
+ steps,
10
+ currentStep,
11
+ onStepChange,
12
+ onFinish,
13
+ onCancel,
14
+ orientation = 'horizontal',
15
+ isNextDisabled = false,
16
+ isSubmitting = false,
17
+ nextLabel = 'Next',
18
+ backLabel = 'Back',
19
+ finishLabel = 'Finish',
20
+ children,
21
+ className,
22
+ }: WizardProps) {
23
+ const isFirst = currentStep === 0;
24
+ const isLast = currentStep === steps.length - 1;
25
+
26
+ function handleBack() {
27
+ if (!isFirst) {
28
+ onStepChange(currentStep - 1);
29
+ }
30
+ }
31
+
32
+ function handleNext() {
33
+ if (isLast) {
34
+ onFinish?.();
35
+ } else {
36
+ onStepChange(currentStep + 1);
37
+ }
38
+ }
39
+
40
+ return (
41
+ <div className={cn('udb-wizard', className)}>
42
+ {(title || description) && (
43
+ <header className="flex flex-col gap-1">
44
+ {title && <h2 className="text-xl font-bold tracking-tight text-foreground">{title}</h2>}
45
+ {description && <p className="text-sm text-muted-foreground">{description}</p>}
46
+ </header>
47
+ )}
48
+
49
+ <Stepper
50
+ steps={steps}
51
+ currentStep={currentStep}
52
+ orientation={orientation}
53
+ clickable={true}
54
+ onStepClick={onStepChange}
55
+ />
56
+
57
+ <div className="udb-wizard__body">{children}</div>
58
+
59
+ <footer className="udb-wizard__footer">
60
+ <div>
61
+ {onCancel && (
62
+ <Button variant="ghost" onClick={onCancel} disabled={isSubmitting}>
63
+ Cancel
64
+ </Button>
65
+ )}
66
+ </div>
67
+ <div className="flex items-center gap-2">
68
+ {!isFirst && (
69
+ <Button variant="secondary" onClick={handleBack} disabled={isSubmitting}>
70
+ {backLabel}
71
+ </Button>
72
+ )}
73
+ <Button
74
+ variant="primary"
75
+ onClick={handleNext}
76
+ disabled={isNextDisabled || isSubmitting}
77
+ >
78
+ {isSubmitting ? 'Saving…' : isLast ? finishLabel : nextLabel}
79
+ </Button>
80
+ </div>
81
+ </footer>
82
+ </div>
83
+ );
84
+ }
@@ -0,0 +1,2 @@
1
+ export { Stepper } from './Stepper';
2
+ export { Wizard } from './Wizard';
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './components';
@@ -0,0 +1,145 @@
1
+ .udb-stepper {
2
+ display: flex;
3
+ width: 100%;
4
+ }
5
+
6
+ .udb-stepper--horizontal {
7
+ flex-direction: row;
8
+ align-items: center;
9
+ justify-content: space-between;
10
+ gap: 12px;
11
+ }
12
+
13
+ .udb-stepper--vertical {
14
+ flex-direction: column;
15
+ gap: 0;
16
+ }
17
+
18
+ .udb-step {
19
+ display: flex;
20
+ align-items: center;
21
+ gap: 10px;
22
+ position: relative;
23
+ flex: 1;
24
+ }
25
+
26
+ .udb-stepper--vertical .udb-step {
27
+ flex: none;
28
+ padding-bottom: 24px;
29
+ }
30
+
31
+ .udb-stepper--vertical .udb-step:last-child {
32
+ padding-bottom: 0;
33
+ }
34
+
35
+ .udb-step__node {
36
+ display: inline-flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ width: 28px;
40
+ height: 28px;
41
+ border-radius: 9999px;
42
+ border: 2px solid var(--line-border, rgba(0, 0, 0, 0.15));
43
+ background: var(--surface, #ffffff);
44
+ color: var(--text-tertiary, #94a3b8);
45
+ font-size: 12px;
46
+ font-weight: 700;
47
+ flex-shrink: 0;
48
+ transition: all 0.2s ease;
49
+ z-index: 1;
50
+ }
51
+
52
+ .udb-step--current .udb-step__node {
53
+ border-color: var(--signal-600, #3b82f6);
54
+ background: var(--signal-600, #3b82f6);
55
+ color: #ffffff;
56
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--signal-600, #3b82f6) 20%, transparent);
57
+ }
58
+
59
+ .udb-step--done .udb-step__node {
60
+ border-color: var(--signal-600, #3b82f6);
61
+ background: var(--signal-600, #3b82f6);
62
+ color: #ffffff;
63
+ }
64
+
65
+ .udb-step--fail .udb-step__node {
66
+ border-color: #ef4444;
67
+ background: #ef4444;
68
+ color: #ffffff;
69
+ }
70
+
71
+ .udb-step__content {
72
+ display: flex;
73
+ flex-direction: column;
74
+ gap: 2px;
75
+ }
76
+
77
+ .udb-step__label {
78
+ font-size: 13px;
79
+ font-weight: 600;
80
+ color: var(--text-secondary, #475569);
81
+ transition: color 0.2s ease;
82
+ }
83
+
84
+ .udb-step--current .udb-step__label {
85
+ color: var(--text-primary, #0f172a);
86
+ }
87
+
88
+ .udb-step--done .udb-step__label {
89
+ color: var(--text-primary, #0f172a);
90
+ }
91
+
92
+ .udb-step__desc {
93
+ font-size: 11px;
94
+ color: var(--text-tertiary, #94a3b8);
95
+ }
96
+
97
+ .udb-step__connector {
98
+ position: absolute;
99
+ background: var(--line-border, rgba(0, 0, 0, 0.1));
100
+ z-index: 0;
101
+ }
102
+
103
+ .udb-stepper--horizontal .udb-step__connector {
104
+ top: 14px;
105
+ left: calc(-50% + 14px);
106
+ right: calc(50% + 14px);
107
+ height: 2px;
108
+ }
109
+
110
+ .udb-stepper--vertical .udb-step__connector {
111
+ left: 13px;
112
+ top: 30px;
113
+ bottom: 0;
114
+ width: 2px;
115
+ }
116
+
117
+ .udb-step--clickable {
118
+ cursor: pointer;
119
+ }
120
+
121
+ .udb-step--clickable:hover .udb-step__node {
122
+ border-color: var(--signal-600, #3b82f6);
123
+ }
124
+
125
+ .udb-wizard {
126
+ display: flex;
127
+ flex-direction: column;
128
+ gap: 24px;
129
+ width: 100%;
130
+ }
131
+
132
+ .udb-wizard__body {
133
+ display: flex;
134
+ flex-direction: column;
135
+ min-height: 200px;
136
+ }
137
+
138
+ .udb-wizard__footer {
139
+ display: flex;
140
+ align-items: center;
141
+ justify-content: space-between;
142
+ gap: 12px;
143
+ padding-top: 16px;
144
+ border-top: 1px solid var(--line-border, rgba(0, 0, 0, 0.08));
145
+ }
@@ -0,0 +1,40 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export interface StepItem {
4
+ readonly id: string;
5
+ readonly label: string;
6
+ readonly description?: string;
7
+ readonly icon?: ReactNode;
8
+ readonly optional?: boolean;
9
+ readonly disabled?: boolean;
10
+ }
11
+
12
+ export interface StepperProps {
13
+ readonly steps: readonly StepItem[] | readonly string[];
14
+ readonly currentStep?: number;
15
+ readonly currentIndex?: number;
16
+ readonly failStep?: number;
17
+ readonly failIndex?: number;
18
+ readonly orientation?: 'horizontal' | 'vertical';
19
+ readonly clickable?: boolean;
20
+ readonly onStepClick?: (stepIndex: number) => void;
21
+ readonly className?: string;
22
+ }
23
+
24
+ export interface WizardProps {
25
+ readonly title?: ReactNode;
26
+ readonly description?: ReactNode;
27
+ readonly steps: readonly StepItem[] | readonly string[];
28
+ readonly currentStep: number;
29
+ readonly onStepChange: (nextStep: number) => void;
30
+ readonly onFinish?: () => void;
31
+ readonly onCancel?: () => void;
32
+ readonly orientation?: 'horizontal' | 'vertical';
33
+ readonly isNextDisabled?: boolean;
34
+ readonly isSubmitting?: boolean;
35
+ readonly nextLabel?: string;
36
+ readonly backLabel?: string;
37
+ readonly finishLabel?: string;
38
+ readonly children: ReactNode;
39
+ readonly className?: string;
40
+ }
package/src/index.ts CHANGED
@@ -3,6 +3,10 @@ export * from './domains/pages';
3
3
  export * from './domains/settings';
4
4
  export * from './domains/calendar';
5
5
  export * from './domains/kanban';
6
+ export * from './domains/activity';
7
+ export * from './domains/admin';
8
+ export * from './domains/filters';
9
+ export * from './domains/stepper';
6
10
  export * from './domains/permissions';
7
11
  export * from './domains/organization';
8
12
  export * from './domains/tour';