@umituz/web-dashboard 10.4.0 → 11.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-dashboard",
3
- "version": "10.4.0",
3
+ "version": "11.0.0",
4
4
  "description": "Installable app skeleton for the fleet — layouts, analytics (dependency-free SVG charts), calendar, onboarding flow permissions/module registry; udb-* stylesheet on design-system tokens",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -66,7 +66,7 @@
66
66
  "version:major": "npm version major -m 'chore: release v%s'"
67
67
  },
68
68
  "peerDependencies": {
69
- "@umituz/web-design-system": "^6.0.0",
69
+ "@umituz/web-design-system": "^6.2.0",
70
70
  "framer-motion": "^12.0.0",
71
71
  "react": "^18.0.0 || ^19.0.0",
72
72
  "react-dom": "^18.0.0 || ^19.0.0",
@@ -89,7 +89,7 @@
89
89
  "@types/react-dom": "^19.2.3",
90
90
  "@typescript-eslint/eslint-plugin": "^8.57.2",
91
91
  "@typescript-eslint/parser": "^8.57.2",
92
- "@umituz/web-design-system": "^6.1.0",
92
+ "@umituz/web-design-system": "^6.2.0",
93
93
  "eslint": "^10.0.2",
94
94
  "framer-motion": "^12.23.12",
95
95
  "jsdom": "^29.1.1",
@@ -3,23 +3,3 @@ export { defaultLayoutLabels } from './labels';
3
3
  export { DashboardHeader } from './DashboardHeader';
4
4
  export { DashboardSidebar } from './DashboardSidebar';
5
5
  export { BrandLogo } from './BrandLogo';
6
- export { FilterBar } from './FilterBar';
7
- export type { FilterBarProps, FilterBarSearch } from './FilterBar';
8
- export { FilterSelect } from './FilterSelect';
9
- export type { FilterSelectProps, FilterSelectOption } from './FilterSelect';
10
- export { PageHeader } from './PageHeader';
11
- export type { PageHeaderProps, PageHeaderCrumb } from './PageHeader';
12
- export { SectionHeader } from './SectionHeader';
13
- export type { SectionHeaderProps } from './SectionHeader';
14
- export { TabNav } from './TabNav';
15
- export type { TabNavItem, TabNavProps } from './TabNav';
16
- export { FilterPanel, FilterSection, CheckFilterList, SingleSelectFilterList } from './FilterPanel';
17
- export type {
18
- FilterPanelProps,
19
- FilterSectionProps,
20
- FilterListOption,
21
- CheckFilterListProps,
22
- SingleSelectFilterListProps,
23
- } from './FilterPanel';
24
- export { NextSteps } from './NextSteps';
25
- export type { NextStepsProps, NextStepLink } from './NextSteps';
@@ -561,28 +561,6 @@
561
561
  .udb-scroll-lock {
562
562
  overflow: hidden;
563
563
  }
564
- .udb-filter-bar {
565
- display: flex;
566
- flex-wrap: wrap;
567
- align-items: flex-end;
568
- gap: var(--udb-space-3);
569
- }
570
- .udb-filter-bar__search {
571
- min-width: 200px;
572
- flex: 0 1 240px;
573
- }
574
- .udb-filter-bar__fields {
575
- display: flex;
576
- flex-wrap: wrap;
577
- align-items: center;
578
- gap: var(--udb-space-2);
579
- flex: 1;
580
- }
581
- .udb-filter-bar__actions {
582
- display: flex;
583
- align-items: center;
584
- gap: var(--udb-space-2);
585
- }
586
564
  @keyframes udb-pop {
587
565
  from {
588
566
  opacity: 0;
@@ -1466,159 +1444,6 @@
1466
1444
  color: var(--color-muted-foreground);
1467
1445
  opacity: 0.5;
1468
1446
  }
1469
- .udb-audit {
1470
- display: flex;
1471
- flex-direction: column;
1472
- margin: 0;
1473
- padding: 0;
1474
- list-style: none;
1475
- border: 1px solid var(--color-border);
1476
- border-radius: var(--radius-lg);
1477
- background: var(--color-card);
1478
- overflow: hidden;
1479
- }
1480
- .udb-audit__item {
1481
- display: flex;
1482
- align-items: baseline;
1483
- gap: var(--udb-space-4);
1484
- padding: var(--udb-space-3) var(--udb-space-4);
1485
- border-bottom: 1px solid var(--color-border);
1486
- font-size: var(--udb-font-size-md);
1487
- }
1488
- .udb-audit__item:last-child {
1489
- border-bottom: none;
1490
- }
1491
- .udb-audit__at {
1492
- flex-shrink: 0;
1493
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
1494
- font-size: var(--udb-font-size-sm);
1495
- color: var(--color-muted-foreground);
1496
- }
1497
- .udb-audit__actor {
1498
- flex-shrink: 0;
1499
- font-weight: var(--font-weight-medium);
1500
- color: var(--color-foreground);
1501
- }
1502
- .udb-audit__action {
1503
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
1504
- font-size: var(--udb-font-size-sm);
1505
- color: var(--color-primary);
1506
- }
1507
- .udb-audit__target {
1508
- min-width: 0;
1509
- overflow: hidden;
1510
- text-overflow: ellipsis;
1511
- white-space: nowrap;
1512
- color: var(--color-muted-foreground);
1513
- }
1514
- .udb-pageheader__breadcrumbs .udb-pageheader__crumb + .udb-pageheader__crumb::before {
1515
- content: "/";
1516
- margin-right: 0.375rem;
1517
- color: var(--color-muted-foreground);
1518
- opacity: 0.6;
1519
- }
1520
- .udb-pageheader__breadcrumbs a {
1521
- color: inherit;
1522
- text-decoration: none;
1523
- }
1524
- .udb-pageheader__breadcrumbs a:hover {
1525
- text-decoration: underline;
1526
- }
1527
- .udb-pageheader__breadcrumbs {
1528
- display: flex;
1529
- align-items: center;
1530
- gap: 0.375rem;
1531
- font-size: 0.8125rem;
1532
- color: var(--color-muted-foreground);
1533
- }
1534
- .udb-pageheader {
1535
- display: flex;
1536
- flex-wrap: wrap;
1537
- align-items: flex-start;
1538
- justify-content: space-between;
1539
- gap: 0.75rem;
1540
- margin-bottom: 1.25rem;
1541
- }
1542
- .udb-pageheader__main {
1543
- min-width: 0;
1544
- }
1545
- .udb-pageheader__kicker {
1546
- margin: 0 0 0.25rem;
1547
- font-size: 0.6875rem;
1548
- font-weight: 600;
1549
- letter-spacing: 0.08em;
1550
- text-transform: uppercase;
1551
- color: var(--color-muted-foreground);
1552
- }
1553
- .udb-pageheader__title {
1554
- margin: 0;
1555
- font-size: 1.375rem;
1556
- font-weight: 600;
1557
- line-height: 1.2;
1558
- letter-spacing: -0.01em;
1559
- color: var(--color-foreground);
1560
- }
1561
- .udb-pageheader__subtitle {
1562
- margin: 0.25rem 0 0;
1563
- font-size: 0.875rem;
1564
- line-height: 1.45;
1565
- color: var(--color-muted-foreground);
1566
- }
1567
- .udb-pageheader__actions {
1568
- display: flex;
1569
- flex-wrap: wrap;
1570
- align-items: center;
1571
- gap: 0.5rem;
1572
- }
1573
- .udb-pageheader__meta {
1574
- display: flex;
1575
- flex-wrap: wrap;
1576
- align-items: center;
1577
- gap: 0.5rem;
1578
- margin: 0.5rem 0 0;
1579
- font-size: 0.75rem;
1580
- color: var(--color-muted-foreground);
1581
- }
1582
-
1583
- .udb-sectionheader {
1584
- display: flex;
1585
- flex-wrap: wrap;
1586
- align-items: flex-start;
1587
- justify-content: space-between;
1588
- gap: 0.75rem;
1589
- margin-bottom: 0.875rem;
1590
- }
1591
- .udb-sectionheader__main {
1592
- min-width: 0;
1593
- }
1594
- .udb-sectionheader__kicker {
1595
- margin: 0 0 0.25rem;
1596
- font-size: 0.6875rem;
1597
- font-weight: 600;
1598
- letter-spacing: 0.08em;
1599
- text-transform: uppercase;
1600
- color: var(--color-muted-foreground);
1601
- }
1602
- .udb-sectionheader__title {
1603
- margin: 0;
1604
- font-size: 1.0625rem;
1605
- font-weight: 600;
1606
- line-height: 1.25;
1607
- letter-spacing: -0.01em;
1608
- color: var(--color-foreground);
1609
- }
1610
- .udb-sectionheader__subtitle {
1611
- margin: 0.25rem 0 0;
1612
- font-size: 0.8125rem;
1613
- line-height: 1.45;
1614
- color: var(--color-muted-foreground);
1615
- }
1616
- .udb-sectionheader__actions {
1617
- display: flex;
1618
- flex-wrap: wrap;
1619
- align-items: center;
1620
- gap: 0.5rem;
1621
- }
1622
1447
 
1623
1448
  .udb-onb,
1624
1449
  .udb-onb *,
@@ -2446,174 +2271,6 @@
2446
2271
  font-size: var(--udb-font-size-sm);
2447
2272
  }
2448
2273
 
2449
-
2450
- .udb-tabnav {
2451
- display: flex;
2452
- gap: var(--udb-space-1);
2453
- border-bottom: 1px solid var(--color-border);
2454
- overflow-x: auto;
2455
- scrollbar-width: none;
2456
- }
2457
- .udb-tabnav::-webkit-scrollbar {
2458
- display: none;
2459
- }
2460
- .udb-tabnav__tab {
2461
- position: relative;
2462
- padding: var(--udb-space-3) var(--udb-space-4);
2463
- font-size: var(--udb-font-size-md);
2464
- font-weight: var(--font-weight-medium);
2465
- color: var(--color-muted-foreground);
2466
- white-space: nowrap;
2467
- transition: color 0.15s ease-out;
2468
- }
2469
- .udb-tabnav__tab:hover {
2470
- color: var(--color-foreground);
2471
- }
2472
- .udb-tabnav__tab--active {
2473
- color: var(--color-primary);
2474
- }
2475
- .udb-tabnav__tab--active::after {
2476
- content: '';
2477
- position: absolute;
2478
- left: var(--udb-space-3);
2479
- right: var(--udb-space-3);
2480
- bottom: -1px;
2481
- height: 2px;
2482
- border-radius: var(--udb-radius-pill);
2483
- background: var(--color-primary);
2484
- }
2485
-
2486
-
2487
- .udb-filter-panel {
2488
- background: var(--color-card);
2489
- border: 1px solid var(--color-border);
2490
- border-radius: var(--radius-lg);
2491
- padding: var(--udb-space-4);
2492
- }
2493
- .udb-filter-panel__header {
2494
- display: flex;
2495
- align-items: center;
2496
- justify-content: space-between;
2497
- margin-bottom: var(--udb-space-3);
2498
- }
2499
- .udb-filter-panel__title {
2500
- font-size: var(--udb-font-size-sm);
2501
- font-weight: var(--font-weight-bold);
2502
- }
2503
- .udb-filter-panel__clear {
2504
- border: none;
2505
- background: transparent;
2506
- padding: 0;
2507
- font-family: inherit;
2508
- font-size: var(--udb-font-size-xs);
2509
- font-weight: var(--font-weight-medium);
2510
- color: var(--color-primary);
2511
- cursor: pointer;
2512
- }
2513
- .udb-filter-panel__clear:hover:not(:disabled) {
2514
- text-decoration: underline;
2515
- }
2516
- .udb-filter-panel__clear:disabled {
2517
- opacity: 0.45;
2518
- cursor: default;
2519
- }
2520
- .udb-filter-panel__sections {
2521
- display: flex;
2522
- flex-direction: column;
2523
- gap: var(--udb-space-4);
2524
- }
2525
- .udb-filter-section__title {
2526
- margin: 0 0 var(--udb-space-2);
2527
- font-size: var(--udb-font-size-xs);
2528
- font-weight: var(--font-weight-bold);
2529
- text-transform: uppercase;
2530
- letter-spacing: 0.08em;
2531
- color: var(--color-muted-foreground);
2532
- }
2533
- .udb-filter-section__body {
2534
- display: flex;
2535
- flex-direction: column;
2536
- gap: var(--udb-space-2);
2537
- }
2538
-
2539
-
2540
- .udb-check-filter {
2541
- list-style: none;
2542
- padding: 0;
2543
- margin: 0;
2544
- display: flex;
2545
- flex-direction: column;
2546
- gap: 2px;
2547
- }
2548
- .udb-check-filter__item {
2549
- display: flex;
2550
- align-items: center;
2551
- gap: var(--udb-space-2);
2552
- width: 100%;
2553
- padding: 6px var(--udb-space-2);
2554
- margin-left: calc(var(--udb-space-2) * -1);
2555
- border: none;
2556
- border-radius: var(--radius-sm);
2557
- background: transparent;
2558
- font-family: inherit;
2559
- font-size: var(--udb-font-size-md);
2560
- color: var(--color-muted-foreground);
2561
- text-align: left;
2562
- cursor: pointer;
2563
- transition: background 0.15s ease-out, color 0.15s ease-out;
2564
- }
2565
- .udb-check-filter__item:hover {
2566
- background: var(--color-muted);
2567
- color: var(--color-foreground);
2568
- }
2569
- .udb-check-filter__item--checked {
2570
- color: var(--color-foreground);
2571
- font-weight: var(--font-weight-medium);
2572
- }
2573
- .udb-check-filter__box {
2574
- display: inline-flex;
2575
- align-items: center;
2576
- justify-content: center;
2577
- width: 16px;
2578
- height: 16px;
2579
- border: 1.5px solid var(--color-border);
2580
- border-radius: 4px;
2581
- background: var(--color-card);
2582
- color: var(--color-primary-foreground, #fff);
2583
- flex: none;
2584
- transition: background 0.15s ease-out, border-color 0.15s ease-out;
2585
- }
2586
- .udb-check-filter__item--checked .udb-check-filter__box {
2587
- background: var(--color-primary);
2588
- border-color: var(--color-primary);
2589
- }
2590
- .udb-check-filter__box--radio {
2591
- border-radius: 50%;
2592
- }
2593
- .udb-check-filter__radio-dot {
2594
- width: 6px;
2595
- height: 6px;
2596
- border-radius: 50%;
2597
- background: var(--color-primary-foreground, #fff);
2598
- }
2599
- .udb-check-filter__label {
2600
- flex: 1;
2601
- min-width: 0;
2602
- overflow: hidden;
2603
- text-overflow: ellipsis;
2604
- white-space: nowrap;
2605
- }
2606
- .udb-check-filter__count {
2607
- font-size: var(--udb-font-size-xs);
2608
- color: var(--color-muted-foreground);
2609
- font-variant-numeric: tabular-nums;
2610
- }
2611
- .udb-check-filter__more {
2612
- padding: 2px var(--udb-space-2);
2613
- font-size: var(--udb-font-size-xs);
2614
- color: var(--color-muted-foreground);
2615
- }
2616
-
2617
2274
  .udb-notif-list {
2618
2275
  list-style: none;
2619
2276
  margin: 0;
@@ -1,33 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { renderToString } from "react-dom/server";
3
- import { FilterBar } from "./FilterBar";
4
-
5
- describe("FilterBar", () => {
6
- it("renders search, children and actions in their slots", () => {
7
- const html = renderToString(
8
- <FilterBar
9
- search={{ value: "", onChange: () => {}, placeholder: "Find…" }}
10
- actions={<button type="button">Sort</button>}
11
-
12
- >
13
- <span>a chip</span>
14
-
15
- </FilterBar>
16
-
17
- );
18
- expect(html).toContain("udb-filter-bar");
19
- expect(html).toContain("udb-filter-bar__search");
20
- expect(html).toContain("udb-filter-bar__fields");
21
- expect(html).toContain("a chip");
22
- expect(html).toContain("udb-filter-bar__actions");
23
- expect(html).toContain("Sort");
24
- });
25
-
26
- it("omits absent slots entirely", () => {
27
- const html = renderToString(<FilterBar />);
28
- expect(html).toContain("udb-filter-bar");
29
- expect(html).not.toContain("udb-filter-bar__search");
30
- expect(html).not.toContain("udb-filter-bar__fields");
31
- expect(html).not.toContain("udb-filter-bar__actions");
32
- });
33
- });
@@ -1,38 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import { SearchBox } from "@umituz/web-design-system/molecules";
3
- import { cn } from "@umituz/web-design-system/utils/cn";
4
- import type { BaseProps } from "@umituz/web-design-system/types";
5
-
6
- export interface FilterBarSearch {
7
- value: string;
8
- onChange: (value: string) => void;
9
- placeholder?: string;
10
- }
11
-
12
- export interface FilterBarProps extends BaseProps {
13
- search?: FilterBarSearch;
14
- children?: ReactNode;
15
- actions?: ReactNode;
16
- }
17
-
18
- export const FilterBar = ({ search, children, actions, className, ...props }: FilterBarProps) => {
19
- return (
20
- <div className={cn("udb-filter-bar", className)} {...props}>
21
- {search && (
22
- <SearchBox
23
- value={search.value}
24
- onChange={search.onChange}
25
- placeholder={search.placeholder}
26
- className="udb-filter-bar__search"
27
- />
28
- )}
29
- {children && <div className="udb-filter-bar__fields">{children}</div>}
30
-
31
- {actions && <div className="udb-filter-bar__actions">{actions}</div>}
32
-
33
- </div>
34
-
35
- );
36
- };
37
-
38
- FilterBar.displayName = "FilterBar";
@@ -1,76 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { renderToString } from "react-dom/server";
3
- import {
4
- FilterPanel,
5
- FilterSection,
6
- CheckFilterList,
7
- SingleSelectFilterList,
8
- } from "./FilterPanel";
9
-
10
- describe("FilterPanel", () => {
11
- it("renders the header, clear action and sections", () => {
12
- const html = renderToString(
13
- <FilterPanel title="Program filters" onClear={() => undefined}>
14
- <FilterSection title="Status">
15
- <span>body</span>
16
- </FilterSection>
17
- </FilterPanel>,
18
- );
19
- expect(html).toContain('aria-label="Program filters"');
20
- expect(html).toContain("Program filters");
21
- expect(html).toContain("Clear all");
22
- expect(html).toContain("Status");
23
- });
24
-
25
- it("can disable and label the clear action", () => {
26
- const html = renderToString(
27
- <FilterPanel onClear={() => undefined} clearDisabled clearLabel="Temizle">
28
- <span>body</span>
29
- </FilterPanel>,
30
- );
31
- expect(html).toContain("Temizle");
32
- expect(html).toContain("disabled");
33
- });
34
- });
35
-
36
- describe("CheckFilterList", () => {
37
- const options = Array.from({ length: 10 }, (_, i) => ({
38
- value: `v${i}`,
39
- label: `Option ${i}`,
40
- }));
41
-
42
- it("marks selected options checked", () => {
43
- const html = renderToString(
44
- <CheckFilterList options={options.slice(0, 3)} selected={["v1"]} onToggle={() => undefined} />,
45
- );
46
- expect(html).toContain('aria-checked="true"');
47
- expect(html).toContain("Option 1");
48
- });
49
-
50
- it("caps visible options, keeps hidden selected ones and notes the rest", () => {
51
- const html = renderToString(
52
- <CheckFilterList options={options} selected={["v9"]} onToggle={() => undefined} maxVisible={4} />,
53
- );
54
- expect(html).toContain("Option 3");
55
- expect(html).toContain("Option 9");
56
- expect(html).not.toContain("Option 5<");
57
- expect(html).toContain("+5 more");
58
- });
59
- });
60
-
61
- describe("SingleSelectFilterList", () => {
62
- const options = [
63
- { value: "all", label: "All", count: 42 },
64
- { value: "open", label: "Open", count: 7 },
65
- ];
66
-
67
- it("marks the active option as the checked radio", () => {
68
- const html = renderToString(
69
- <SingleSelectFilterList options={options} value="open" onChange={() => undefined} />,
70
- );
71
- expect(html).toContain('role="radio"');
72
- expect(html).toContain('aria-checked="true"');
73
- expect(html).toContain(">7</span>");
74
- });
75
- });
76
-
@@ -1,129 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import { Check } from 'lucide-react';
3
-
4
- export interface FilterPanelProps {
5
- title?: string;
6
- onClear?: () => void;
7
- clearDisabled?: boolean;
8
- clearLabel?: string;
9
- children: ReactNode;
10
- className?: string;
11
- }
12
-
13
- export function FilterPanel({
14
- title = 'Filters',
15
- onClear,
16
- clearDisabled,
17
- clearLabel = 'Clear all',
18
- children,
19
- className,
20
- }: FilterPanelProps) {
21
- return (
22
- <aside className={className !== undefined ? `udb-filter-panel ${className}` : 'udb-filter-panel'} aria-label={title}>
23
- <div className="udb-filter-panel__header">
24
- <span className="udb-filter-panel__title">{title}</span>
25
- {onClear !== undefined && (
26
- <button type="button" className="udb-filter-panel__clear" onClick={onClear} disabled={clearDisabled}>
27
- {clearLabel}
28
- </button>
29
- )}
30
- </div>
31
- <div className="udb-filter-panel__sections">{children}</div>
32
- </aside>
33
- );
34
- }
35
-
36
- export interface FilterSectionProps {
37
- title: string;
38
- children: ReactNode;
39
- }
40
-
41
- export function FilterSection({ title, children }: FilterSectionProps) {
42
- return (
43
- <section className="udb-filter-section">
44
- <h4 className="udb-filter-section__title">{title}</h4>
45
- <div className="udb-filter-section__body">{children}</div>
46
- </section>
47
- );
48
- }
49
-
50
- export interface FilterListOption {
51
- value: string;
52
- label: string;
53
- count?: number;
54
- }
55
-
56
- export interface CheckFilterListProps {
57
- options: readonly FilterListOption[];
58
- selected: readonly string[];
59
- onToggle: (value: string) => void;
60
- maxVisible?: number;
61
- }
62
-
63
- export function CheckFilterList({ options, selected, onToggle, maxVisible = 8 }: CheckFilterListProps) {
64
- const visible = options.slice(0, maxVisible);
65
- const hasMore = options.length > maxVisible;
66
- const hiddenSelected = options.slice(maxVisible).filter((option) => selected.includes(option.value));
67
- const shown = hasMore ? [...visible, ...hiddenSelected] : visible;
68
-
69
- return (
70
- <ul className="udb-check-filter" role="group">
71
- {shown.map((option) => {
72
- const isSelected = selected.includes(option.value);
73
- return (
74
- <li key={option.value}>
75
- <button
76
- type="button"
77
- role="checkbox"
78
- aria-checked={isSelected}
79
- className={isSelected ? 'udb-check-filter__item udb-check-filter__item--checked' : 'udb-check-filter__item'}
80
- onClick={() => onToggle(option.value)}
81
- >
82
- <span className="udb-check-filter__box" aria-hidden="true">
83
- {isSelected && <Check size={12} strokeWidth={3} />}
84
- </span>
85
- <span className="udb-check-filter__label">{option.label}</span>
86
- {option.count !== undefined && <span className="udb-check-filter__count">{option.count}</span>}
87
- </button>
88
- </li>
89
- );
90
- })}
91
- {hasMore && (
92
- <li className="udb-check-filter__more">{`+${options.length - shown.length} more`}</li>
93
- )}
94
- </ul>
95
- );
96
- }
97
-
98
- export interface SingleSelectFilterListProps {
99
- options: readonly FilterListOption[];
100
- value: string | null;
101
- onChange: (value: string | null) => void;
102
- }
103
-
104
- export function SingleSelectFilterList({ options, value, onChange }: SingleSelectFilterListProps) {
105
- return (
106
- <ul className="udb-check-filter" role="group">
107
- {options.map((option) => {
108
- const isActive = value === option.value;
109
- return (
110
- <li key={option.value}>
111
- <button
112
- type="button"
113
- role="radio"
114
- aria-checked={isActive}
115
- className={isActive ? 'udb-check-filter__item udb-check-filter__item--checked' : 'udb-check-filter__item'}
116
- onClick={() => onChange(isActive ? null : option.value)}
117
- >
118
- <span className="udb-check-filter__box udb-check-filter__box--radio" aria-hidden="true">
119
- {isActive && <span className="udb-check-filter__radio-dot" />}
120
- </span>
121
- <span className="udb-check-filter__label">{option.label}</span>
122
- {option.count !== undefined && <span className="udb-check-filter__count">{option.count}</span>}
123
- </button>
124
- </li>
125
- );
126
- })}
127
- </ul>
128
- );
129
- }
@@ -1,28 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { renderToString } from "react-dom/server";
3
- import { FilterSelect } from "./FilterSelect";
4
-
5
- describe("FilterSelect", () => {
6
- const options = [
7
- { value: "open", label: "Open" },
8
- { value: "closed", label: "Closed" },
9
- ];
10
-
11
- it("renders the all-entry plus options and reports the chosen value", () => {
12
- const chosen: string[] = [];
13
- const html = renderToString(
14
- <FilterSelect
15
- value="open"
16
- options={options}
17
- ariaLabel="Filter by status"
18
- allLabel="Any status"
19
- onChange={(v) => chosen.push(v)}
20
- />,
21
- );
22
- expect(html).toContain('aria-label="Filter by status"');
23
- expect(html).toContain("Any status");
24
- expect(html).toContain("Open");
25
- expect(html).toContain("Closed");
26
- expect(chosen).toEqual([]);
27
- });
28
- });
@@ -1,47 +0,0 @@
1
- import type { SelectHTMLAttributes } from "react";
2
-
3
- export interface FilterSelectOption {
4
- value: string;
5
- label: string;
6
- }
7
-
8
- export interface FilterSelectProps
9
- extends Omit<SelectHTMLAttributes<HTMLSelectElement>, "onChange" | "value" | "size"> {
10
- value: string;
11
- onChange: (value: string) => void;
12
- options: readonly FilterSelectOption[];
13
- ariaLabel: string;
14
- allLabel: string;
15
- }
16
-
17
- export const FilterSelect = ({
18
- value,
19
- onChange,
20
- options,
21
- ariaLabel,
22
- allLabel,
23
- className,
24
- ...props
25
- }: FilterSelectProps) => {
26
- return (
27
- <select
28
- aria-label={ariaLabel}
29
- className={className ? `udb-filter-select ${className}` : "udb-filter-select"}
30
- value={value}
31
- onChange={(event) => onChange(event.target.value)}
32
- {...props}
33
- >
34
- <option value="">{allLabel}</option>
35
-
36
- {options.map((option) => (
37
- <option key={option.value} value={option.value}>
38
- {option.label}
39
- </option>
40
-
41
- ))}
42
- </select>
43
-
44
- );
45
- };
46
-
47
- FilterSelect.displayName = "FilterSelect";
@@ -1,25 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { renderToString } from 'react-dom/server';
3
- import { MemoryRouter } from 'react-router';
4
- import { NextSteps } from './NextSteps';
5
-
6
- describe('NextSteps component', () => {
7
- it('renders lead text and action links', () => {
8
- const html = renderToString(
9
- <MemoryRouter>
10
- <NextSteps
11
- lead="Önerilen Adımlar"
12
- links={[
13
- { to: '/app/practice', label: 'Alıştırma Yap' },
14
- { to: '/app/exams', label: 'Sınavları Gör' },
15
- ]}
16
- />
17
- </MemoryRouter>
18
- );
19
- expect(html).toContain('Önerilen Adımlar');
20
- expect(html).toContain('Alıştırma Yap');
21
- expect(html).toContain('href="/app/practice"');
22
- expect(html).toContain('Sınavları Gör');
23
- expect(html).toContain('href="/app/exams"');
24
- });
25
- });
@@ -1,36 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import { Link } from "react-router";
3
- import { ArrowRight } from "lucide-react";
4
-
5
- export interface NextStepLink {
6
- to: string;
7
- label: ReactNode;
8
- icon?: ReactNode;
9
- }
10
-
11
- export interface NextStepsProps {
12
- lead?: ReactNode;
13
- links: readonly NextStepLink[];
14
- className?: string;
15
- }
16
-
17
- export const NextSteps = ({ lead, links, className }: NextStepsProps) => {
18
- return (
19
- <div className={`flex flex-wrap items-center gap-x-4 gap-y-2${className ? ` ${className}` : ""}`}>
20
- {lead && (
21
- <span className="text-xs font-bold uppercase tracking-wider text-muted-foreground">
22
- {lead}
23
- </span>
24
- )}
25
- {links.map((link) => (
26
- <Link
27
- key={link.to}
28
- to={link.to}
29
- className="inline-flex items-center gap-1.5 rounded-full border border-border bg-card px-3.5 py-2 text-xs font-semibold text-foreground transition-colors hover:border-primary/50 hover:text-primary"
30
- >
31
- {link.label} {link.icon ?? <ArrowRight size={12} aria-hidden="true" />}
32
- </Link>
33
- ))}
34
- </div>
35
- );
36
- };
@@ -1,63 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { renderToString } from 'react-dom/server';
3
- import { render } from '@testing-library/react';
4
- import { MemoryRouter } from 'react-router';
5
- import { PageHeader } from './PageHeader';
6
-
7
- describe('PageHeader markup smoke', () => {
8
- it('renders kicker before title and omits it when undefined', () => {
9
- const html = renderToString(
10
- <PageHeader kicker="Customer area" title="Policies" subtitle="Your coverage at a glance" />,
11
- );
12
- const kickerAt = html.indexOf('udb-pageheader__kicker');
13
- const titleAt = html.indexOf('udb-pageheader__title');
14
- expect(kickerAt).toBeGreaterThan(-1);
15
- expect(kickerAt).toBeLessThan(titleAt);
16
- expect(html).toContain('Customer area');
17
-
18
- const bare = renderToString(<PageHeader title="Policies" />);
19
- expect(bare).not.toContain('udb-pageheader__kicker');
20
- });
21
-
22
- it('renders actions and breadcrumb nodes in their slots', () => {
23
- const html = renderToString(
24
- <PageHeader
25
- title="Claims"
26
- breadcrumbs={<a href="/policies">Policies</a>}
27
-
28
- actions={<button type="button">New claim</button>}
29
-
30
- />,
31
- );
32
- expect(html).toContain('udb-pageheader__breadcrumbs');
33
- expect(html).toContain('udb-pageheader__actions');
34
- expect(html).toContain('New claim');
35
- });
36
-
37
- it('renders crumb lists as in-app links', () => {
38
- const { container } = render(
39
- <MemoryRouter>
40
- <PageHeader
41
- title="Claim 92"
42
- breadcrumbs={[{ label: 'Policies', to: '/policies' }, { label: 'Claim 92' }]}
43
- />
44
- </MemoryRouter>,
45
-
46
- );
47
- expect(container.querySelectorAll("a[href='/policies']")).toHaveLength(1);
48
- expect(container.querySelector('.udb-pageheader__crumb a')?.textContent).toBe('Policies');
49
- });
50
-
51
- it('renders meta under the title block and omits it when undefined', () => {
52
- const html = renderToString(
53
- <PageHeader title="Policy AC-123" meta={<span>Renews 2027-01-15</span>} />,
54
- );
55
- const metaAt = html.indexOf('udb-pageheader__meta');
56
- expect(metaAt).toBeGreaterThan(-1);
57
- expect(html.indexOf('udb-pageheader__subtitle')).toBe(-1);
58
- expect(html).toContain('Renews 2027-01-15');
59
-
60
- const bare = renderToString(<PageHeader title="Policy AC-123" />);
61
- expect(bare).not.toContain('udb-pageheader__meta');
62
- });
63
- });
@@ -1,67 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import { Link } from "react-router";
3
-
4
- export interface PageHeaderCrumb {
5
- label: string;
6
- to?: string;
7
- }
8
-
9
- export interface PageHeaderProps {
10
- kicker?: ReactNode;
11
- title?: ReactNode;
12
- subtitle?: ReactNode;
13
- description?: ReactNode;
14
- meta?: ReactNode;
15
- breadcrumbs?: ReactNode | readonly PageHeaderCrumb[];
16
- actions?: ReactNode;
17
- className?: string;
18
- }
19
-
20
- const isCrumbList = (value: ReactNode | readonly PageHeaderCrumb[]): value is readonly PageHeaderCrumb[] =>
21
- Array.isArray(value) && value.every((item) => typeof item === "object" && item !== null && "label" in item);
22
-
23
- export const PageHeader = ({
24
- kicker,
25
- title,
26
- subtitle,
27
- description,
28
- meta,
29
- breadcrumbs,
30
- actions,
31
- className,
32
- }: PageHeaderProps) => {
33
- const crumbNode =
34
- breadcrumbs === undefined
35
- ? undefined
36
- : isCrumbList(breadcrumbs)
37
- ? breadcrumbs.map((crumb, index) => (
38
- <span key={`${crumb.label}-${index}`} className="udb-pageheader__crumb">
39
- {crumb.to !== undefined ? <Link to={crumb.to}>{crumb.label}</Link> : crumb.label}
40
-
41
- </span>
42
-
43
- ))
44
- : breadcrumbs;
45
- return (
46
- <div className={`udb-pageheader${className ? ` ${className}` : ""}`}>
47
- {crumbNode !== undefined && <div className="udb-pageheader__breadcrumbs">{crumbNode}</div>}
48
-
49
- <div className="udb-pageheader__main">
50
- {kicker !== undefined && <p className="udb-pageheader__kicker">{kicker}</p>}
51
-
52
- {title !== undefined && <h1 className="udb-pageheader__title">{title}</h1>}
53
-
54
- {(subtitle ?? description) !== undefined && (
55
- <p className="udb-pageheader__subtitle">{subtitle ?? description}</p>
56
-
57
- )}
58
- {meta !== undefined && <div className="udb-pageheader__meta">{meta}</div>}
59
-
60
- </div>
61
-
62
- {actions !== undefined && <div className="udb-pageheader__actions">{actions}</div>}
63
-
64
- </div>
65
-
66
- );
67
- };
@@ -1,29 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { renderToString } from 'react-dom/server';
3
- import { SectionHeader } from './SectionHeader';
4
-
5
- describe('SectionHeader markup smoke', () => {
6
- it('renders an h2 title with optional kicker before it', () => {
7
- const html = renderToString(
8
- <SectionHeader kicker="This week" title="Reading" subtitle="Long-form practice" />,
9
- );
10
- const kickerAt = html.indexOf('udb-sectionheader__kicker');
11
- const titleAt = html.indexOf('<h2 class="udb-sectionheader__title"');
12
- expect(kickerAt).toBeGreaterThan(-1);
13
- expect(kickerAt).toBeLessThan(titleAt);
14
- expect(html).toContain('Long-form practice');
15
-
16
- const bare = renderToString(<SectionHeader title="Reading" />);
17
- expect(bare).not.toContain('udb-sectionheader__kicker');
18
- expect(bare).not.toContain('udb-sectionheader__subtitle');
19
- });
20
-
21
- it('renders actions in their slot and accepts description as subtitle alias', () => {
22
- const html = renderToString(
23
- <SectionHeader title="Writing" description="Timed tasks" actions={<button type="button">New</button>} />,
24
- );
25
- expect(html).toContain('udb-sectionheader__actions');
26
- expect(html).toContain('udb-sectionheader__subtitle');
27
- expect(html).toContain('New');
28
- });
29
- });
@@ -1,36 +0,0 @@
1
- import type { ReactNode } from "react";
2
-
3
- export interface SectionHeaderProps {
4
- kicker?: ReactNode;
5
- title?: ReactNode;
6
- subtitle?: ReactNode;
7
- description?: ReactNode;
8
- actions?: ReactNode;
9
- className?: string;
10
- }
11
-
12
- export const SectionHeader = ({
13
- kicker,
14
- title,
15
- subtitle,
16
- description,
17
- actions,
18
- className,
19
- }: SectionHeaderProps) => (
20
- <div className={`udb-sectionheader${className ? ` ${className}` : ""}`}>
21
- <div className="udb-sectionheader__main">
22
- {kicker !== undefined && <p className="udb-sectionheader__kicker">{kicker}</p>}
23
-
24
- {title !== undefined && <h2 className="udb-sectionheader__title">{title}</h2>}
25
-
26
- {(subtitle ?? description) !== undefined && (
27
- <p className="udb-sectionheader__subtitle">{subtitle ?? description}</p>
28
-
29
- )}
30
- </div>
31
-
32
- {actions !== undefined && <div className="udb-sectionheader__actions">{actions}</div>}
33
-
34
- </div>
35
-
36
- );
@@ -1,33 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { renderToString } from "react-dom/server";
3
- import { MemoryRouter } from "react-router";
4
- import { TabNav } from "./TabNav";
5
-
6
- describe("TabNav", () => {
7
- const items = [
8
- { to: "/events", label: "Events", end: true },
9
- { to: "/events/program", label: "Program" },
10
- ];
11
-
12
- it("renders nav links with the accessible label", () => {
13
- const html = renderToString(
14
- <MemoryRouter>
15
- <TabNav items={items} />
16
- </MemoryRouter>,
17
- );
18
- expect(html).toContain('aria-label="Section tabs"');
19
- expect(html).toContain("Events");
20
- expect(html).toContain("Program");
21
- expect(html).toContain('href="/events"');
22
- expect(html).toContain('href="/events/program"');
23
- });
24
-
25
- it("marks the matching route active", () => {
26
- const html = renderToString(
27
- <MemoryRouter initialEntries={["/events/program"]}>
28
- <TabNav items={items} />
29
- </MemoryRouter>,
30
- );
31
- expect(html).toContain("udb-tabnav__tab--active");
32
- });
33
- });
@@ -1,31 +0,0 @@
1
- import { NavLink } from 'react-router';
2
-
3
- export interface TabNavItem {
4
- to: string;
5
- label: string;
6
- end?: boolean;
7
- }
8
-
9
- export interface TabNavProps {
10
- items: readonly TabNavItem[];
11
- className?: string;
12
- }
13
-
14
- export function TabNav({ items, className }: TabNavProps) {
15
- return (
16
- <nav className={className !== undefined ? `udb-tabnav ${className}` : 'udb-tabnav'} aria-label="Section tabs">
17
- {items.map((item) => (
18
- <NavLink
19
- key={item.to}
20
- to={item.to}
21
- end={item.end}
22
- className={({ isActive }) =>
23
- isActive ? 'udb-tabnav__tab udb-tabnav__tab--active' : 'udb-tabnav__tab'
24
- }
25
- >
26
- {item.label}
27
- </NavLink>
28
- ))}
29
- </nav>
30
- );
31
- }