klun-ui 0.4.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
@@ -7,6 +7,36 @@ small breaking changes).
7
7
 
8
8
  ## [Unreleased]
9
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
+
10
40
  ## [0.4.0] — 2026-09-17
11
41
 
12
42
  ### 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: