klun-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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,111 @@ All notable changes to **klun-ui** are documented here. The format follows
5
5
  [Semantic Versioning](https://semver.org/) (pre-1.0: minor/patch bumps may carry
6
6
  small breaking changes).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ## [0.4.1] — 2026-09-17
11
+
12
+ ### Added
13
+ - `Table` stories — a **form-embedded editable table** demo
14
+ (`Data Display/Table → FormTable`): a `Form.List` object-array field rendered
15
+ as a `Table` row-per-item, with a `TimePicker` / `CompactSelect` /
16
+ `CounterInput` / `Checkbox` / `Switch` in each cell, drag-to-reorder, an
17
+ "+ 新增行" toolbar button, per-row delete, validated save / reset, and
18
+ “external” insert-row / delete-first-row buttons that mutate the array through
19
+ `form.setFieldValue`.
20
+ - **Touch and keyboard dragging** in `Table` (`rowDraggable`) and `Kanban`:
21
+ pointer sensors drive mouse *and* touch, and the keyboard sensor makes the drag
22
+ handle / card a focusable activator (Space to pick up, arrows to move, Space to
23
+ drop) with screen-reader instructions.
24
+
25
+ ### Changed
26
+ - Drag & drop engine — `Table` row reordering and `Kanban` now run on `@dnd-kit/core`
27
+ + `@dnd-kit/sortable` instead of hand-rolled native HTML5 DnD. New runtime
28
+ dependencies (external in the bundle). The dragged row/card follows the pointer,
29
+ containers auto-scroll while dragging, and the table's drag handle is the whole
30
+ util cell (previously only the 22px grip icon inside it was draggable).
31
+ - `Kanban` — same-column reordering now reports through `onMove` too, and
32
+ `onMove`'s `toIndex` is documented as the position **after** the card is removed
33
+ from its old slot, so consumers can simply `splice(toIndex, 0, card)`.
34
+ - README — npm version / license / types badges, a “latest release” pointer to
35
+ this changelog, the 0.4.0 components added to the component table and a
36
+ **Demo shell** section documenting the interactive template (command palette,
37
+ deep links, persisted preferences, role simulation with 403 handling,
38
+ skeletons and the shortcut sheet).
39
+
40
+ ## [0.4.0] — 2026-09-17
41
+
42
+ ### Added
43
+ - **Internal messaging** (`MessagesScreen`) — a three-pane mailbox for the admin
44
+ demo: folders (Inbox / Starred / Sent / Drafts / Archived) and colour-coded
45
+ labels with live counts, a searchable thread list with unread badges, priority
46
+ flags, stars and message counts, and a conversation pane with the full reply
47
+ chain. Flows: compose to teammates (recipient / cc pickers, `RichEditorToolbar`
48
+ wired to markdown-at-caret, simulated attachments, high priority), send, save
49
+ draft, reply / reply-all, forward, star, archive, mark read / unread, delete
50
+ behind `Confirm` and “mark all read”.
51
+ - The unread count feeds the shell: `MetronicSidebar` gained a `badges` prop so
52
+ the **Messages** entry shows a live badge, and `MessagesScreen` reports through
53
+ `onUnreadChange`.
54
+ - `messagesModel.ts` — threads, messages, attachments, labels, recipients and
55
+ helpers (`snippetOf`, `lastSenderOf`, `participantsOf`, `totalUnread`), exported
56
+ from the templates subpath alongside `MessagesScreen`.
57
+
58
+ ### Added — components
59
+ - `CronEditor` — five-field cron builder with preset chips, per-field selects, a
60
+ free-text expression box and a live human-readable preview; `describeCron` and
61
+ `CRON_PRESETS` are exported as well.
62
+ - `Kanban` — dependency-free HTML5 drag & drop board with column limits, custom
63
+ card rendering, column footers and an `onMove(cardId, from, to, index)` hook.
64
+ - `VirtualTable` — windowed table for very large datasets: only the visible slice
65
+ plus overscan is mounted, so 100k rows scroll smoothly.
66
+ - `RichEditor` — contentEditable editor wired to `RichEditorToolbar`, with a
67
+ placeholder, an optional HTML source view and HTML output through `onChange`.
68
+ - `MetronicSidebar` gains `lockedKeys`, `collapsed`, `onToggleCollapsed` and
69
+ `roleLabel` props.
70
+
71
+ ### Added — admin screens
72
+ - `ApprovalsScreen` — multi-step workflow inbox: KPI strip, scope/type filters,
73
+ row selection with bulk decisions, a step chain on `Timeline`, `DiffViewer` for
74
+ permission changes and rich-text decision notes.
75
+ - `TicketsScreen` — SLA-aware support desk with a live countdown, list and
76
+ `Kanban` board views (drag a card to change its stage), public replies vs
77
+ internal notes in `RichEditor`, and an assignment / resolve flow.
78
+ - `CalendarScreen` — week grid (08:00–19:00) with click-to-create meetings,
79
+ room conflict detection before saving, reschedule, meeting notes and an agenda
80
+ view.
81
+ - `WorkspaceSecurityScreen` — SSO / enforced 2FA / session & idle lifetime, IP
82
+ allowlist with CIDR validation, password policy, a live posture score and a
83
+ revoke-everything danger zone.
84
+ - `IntegrationsScreen` — app directory with connect / disconnect, webhook
85
+ endpoints with events and a signing secret, and a delivery log with retry and
86
+ `CodeViewer` request / response inspection.
87
+ - `FeatureFlagsScreen` — per-environment toggles, rollout steps, department
88
+ targeting via `Cascader`, role allowlists, change history and archive.
89
+ - `TemplatesScreen` — notification templates with variable chips inserted at the
90
+ caret, channel-aware previews (email / SMS / push / Slack), version history and
91
+ a test-send modal.
92
+ - `ImportExportScreen` — four-step import `Wizard` (upload → map → validate → run)
93
+ with a 100k-row `VirtualTable` validation preview, export scheduling and a job
94
+ history with retry.
95
+ - `SearchScreen` — cross-entity search (orders, products, customers, team,
96
+ tickets, approvals, docs) with grouped results and ↑ ↓ ⏎ navigation.
97
+
98
+ ### Added — shell experience
99
+ - Hash deep links (`#/orders/A-1042`) with browser back / forward support.
100
+ - Persisted demo preferences in `localStorage` (theme, density, skin, locale,
101
+ collapsed sidebar, simulated role).
102
+ - Permission-aware navigation driven by `ROLE_PERMISSIONS`: locked entries show a
103
+ lock icon and route to a `Result`-based 403 panel, with a “view as role” group
104
+ in the command palette and a banner to reset.
105
+ - Skeleton loading states between screens, a simulated outage with retry, and a
106
+ keyboard-shortcut sheet (`⌘/` or `?`).
107
+ - `nav` / `pages` demo copy for the nine new screens in all four locales.
108
+
109
+ ### Changed
110
+ - Keyboard shortcuts: `⌘K` / `Ctrl K` opens the palette, `/` jumps to global
111
+ search, `?` / `⌘/` opens the shortcut sheet.
112
+
8
113
  ## [0.3.0] — 2026-09-16
9
114
 
10
115
  ### Added
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # klun-ui
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/klun-ui)](https://www.npmjs.com/package/klun-ui)
4
+ [![license](https://img.shields.io/npm/l/klun-ui)](./LICENSE)
5
+ [![types included](https://img.shields.io/npm/types/klun-ui)](https://www.npmjs.com/package/klun-ui)
6
+
3
7
  A themeable **React + TypeScript** component library and design system — 120+ components, light/dark modes, and six accent themes (incl. the full Metronic 9.0 skin), all driven by a deep `--klun-*` CSS design-token layer.
4
8
 
5
9
  - **Standard architecture** — every component is a thin `forwardRef` wrapper that maps props to CSS classes (`className` and `style` pass through, `displayName` set). Styling lives in one stylesheet driven by design tokens, so real `:hover` / `:focus-visible` / `:disabled` states work and consumers can override with their own CSS.
@@ -13,7 +17,13 @@ pnpm add klun-ui react react-dom
13
17
  # npm i klun-ui react react-dom / yarn add klun-ui react react-dom
14
18
  ```
15
19
 
16
- `react` and `react-dom` (>=18) are peer dependencies.
20
+ `react` and `react-dom` (>=18) are peer dependencies. `@dnd-kit/core` + `@dnd-kit/sortable`
21
+ ship as regular dependencies — they power dragging in `Table` (`rowDraggable`) and
22
+ `Kanban`, so those drags work with mouse, touch and keyboard. Nothing else is pulled in.
23
+
24
+ Latest release: **0.4.0** — new components (`CronEditor`, `Kanban`, `VirtualTable`, `RichEditor`),
25
+ nine admin screens and the interactive demo shell. Full details in the
26
+ [changelog](./CHANGELOG.md).
17
27
 
18
28
  ## Quick start
19
29
 
@@ -87,8 +97,8 @@ For extra-fine control, the button family adds a `size="tiny"` tier (28px, icon-
87
97
  | Group | Components |
88
98
  |---|---|
89
99
  | **Buttons** | Button (kinds: default / fancy / compact / link), ButtonGroup, CopyButton |
90
- | **Forms** | AutoComplete, Cascader, CharacterCounter, Checkbox, CheckboxGroup, CheckboxCard, ColorDot, ColorPicker, ColorSlider, CompactSelect, CompactSelectForInput, CounterInput, DatePicker, DateRangePicker, DateTimePicker, DigitInput, FileUpload, Form (+ FormItem, FormList, useForm), Hint, ImageUpload, InlineInput, InlineSelect, Input, Label, PasswordStrength, Radio, RadioCard, RangeSlider, RichEditorToolbar, Select, SelectMenu, Slider, Switch, Textarea, TimePicker |
91
- | **Data display** | Avatar, AvatarGroup, Badge, BulkActionBar (+ BulkAction), Carousel, ChartLegend, ChartTooltip, Chip, CodeViewer (+ LogViewer), ContentLabel, CrossRefBadge, Descriptions, DiffViewer, Kbd, KeyIcon, List (+ ListItem), Markdown, Money, Rating, RelativeTime (+ ExpiryCountdown), StatCard, Statistic, StatusBadge, StatusDot (+ LiveDot), Table, Tag, Timeline, Tooltip, Tree |
100
+ | **Forms** | AutoComplete, Cascader, CharacterCounter, Checkbox, CheckboxGroup, CheckboxCard, ColorDot, ColorPicker, ColorSlider, CompactSelect, CompactSelectForInput, CounterInput, CronEditor, DatePicker, DateRangePicker, DateTimePicker, DigitInput, FileUpload, Form (+ FormItem, FormList, useForm), Hint, ImageUpload, InlineInput, InlineSelect, Input, Label, PasswordStrength, Radio, RadioCard, RangeSlider, RichEditor, RichEditorToolbar, Select, SelectMenu, Slider, Switch, Textarea, TimePicker |
101
+ | **Data display** | Avatar, AvatarGroup, Badge, BulkActionBar (+ BulkAction), Carousel, ChartLegend, ChartTooltip, Chip, CodeViewer (+ LogViewer), ContentLabel, CrossRefBadge, Descriptions, DiffViewer, Kbd, Kanban, KeyIcon, List (+ ListItem), Markdown, Money, Rating, RelativeTime (+ ExpiryCountdown), StatCard, Statistic, StatusBadge, StatusDot (+ LiveDot), Table, Tag, Timeline, Tooltip, Tree, VirtualTable |
92
102
  | **Feedback** | Alert, Banner, CircularProgress, EmptyState, GaugeBar, Message (useMessage), Notification (useNotification), ProgressBar, Result, SegmentedProgress, Skeleton, Spinner, Toast, Toaster (+ toast) |
93
103
  | **Navigation** | Breadcrumb, Divider, HorizontalFilter, Menu, PageHeader, Pagination, SegmentedControl, StepIndicator, Tabs, Wizard |
94
104
  | **Overlays** | CommandMenu, Confirm, ContextMenu, Drawer, Dropdown, ImageViewer, Modal, Popconfirm, Popover |
@@ -100,7 +110,7 @@ All components and their prop types are named exports; the `cx` classnames helpe
100
110
 
101
111
  ## Templates
102
112
 
103
- Full-screen example compositions are available from the `klun-ui/templates` subpath — copy-and-go starting points built entirely from klun-ui components (`DashboardTemplate`, `AIAssistantTemplate`, `AgentChatTemplate`, `CryptoTemplate`, `MarketingTemplate`, `CalendarTemplate`, `PricingTemplate`, `SettingsTemplate`, plus the Metronic examples — `MetronicDashboardTemplate` / `MetronicSettingsTemplate` (five interactive tabs: profile, account security, notifications, billing, API keys — also exported individually as `ProfileSection`, `AccountSection`, `NotificationsSection`, `BillingSection`, `ApiKeysSection`) and the back-office screens `OrdersScreen`, `ProductsScreen` (CRUD with modal + full-page wizard editors), `CustomersScreen`, `UsersScreen`, `RolesScreen` (RBAC), `ReportsScreen` — which render inside the Metronic 9.0 skin at compact density):
113
+ Full-screen example compositions are available from the `klun-ui/templates` subpath — copy-and-go starting points built entirely from klun-ui components (`DashboardTemplate`, `AIAssistantTemplate`, `AgentChatTemplate`, `CryptoTemplate`, `MarketingTemplate`, `CalendarTemplate`, `PricingTemplate`, `SettingsTemplate`, plus the Metronic examples — `MetronicDashboardTemplate` / `MetronicSettingsTemplate` (five interactive tabs: profile, account security, notifications, billing, API keys — also exported individually as `ProfileSection`, `AccountSection`, `NotificationsSection`, `BillingSection`, `ApiKeysSection`) and the back-office screens — `OrdersScreen`, `ProductsScreen` (CRUD with modal + full-page wizard editors), `CustomersScreen`, `UsersScreen`, `RolesScreen` (RBAC), `RoleTreeScreen`, `DepartmentsScreen`, `TasksScreen`, `AuditScreen`, `MessagesScreen` (internal mailbox), `ApprovalsScreen` (multi-step workflow with diffs), `TicketsScreen` (SLA queue with a `Kanban` board), `CalendarScreen` (week grid with room conflicts), `SearchScreen` (cross-entity search), `IntegrationsScreen` (webhooks + delivery log), `FeatureFlagsScreen`, `TemplatesScreen` (notification templates), `ImportExportScreen` (wizard + 100k-row preview), `WorkspaceSecurityScreen` and `ReportsScreen` — which render inside the Metronic 9.0 skin at compact density):
104
114
 
105
115
  ```tsx
106
116
  import "klun-ui/styles.css";
@@ -111,6 +121,16 @@ export default function App() {
111
121
  }
112
122
  ```
113
123
 
124
+ ### Demo shell
125
+
126
+ `MetronicDashboardTemplate` wires the whole demo together, so the examples behave like a real admin app:
127
+
128
+ - `⌘K` / `Ctrl K` command palette (navigate, act, switch the simulated role, simulate an outage), `/` jumps to search, `?` / `⌘/` opens the shortcut sheet.
129
+ - Hash deep links (`#/orders/A-1042`) with working browser back / forward.
130
+ - Preferences persist in `localStorage` (theme, density, skin, locale, collapsed sidebar, simulated role).
131
+ - Permission-aware navigation driven by `ROLE_PERMISSIONS`: locked entries show a lock and route to a `Result`-based 403 panel.
132
+ - Skeleton loading between screens, a simulated outage with retry, a collapsible sidebar and full i18n copy for the new screens in all four demo locales.
133
+
114
134
  ## Charts
115
135
 
116
136
  Chart components live on the `klun-ui/charts` subpath and use the optional `recharts` peer dependency — kept out of the main entry so the core bundle stays chart-free: