klun-ui 0.2.2 → 0.4.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/CHANGELOG.md CHANGED
@@ -5,6 +5,188 @@ 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.0] — 2026-09-17
11
+
12
+ ### Added
13
+ - **Internal messaging** (`MessagesScreen`) — a three-pane mailbox for the admin
14
+ demo: folders (Inbox / Starred / Sent / Drafts / Archived) and colour-coded
15
+ labels with live counts, a searchable thread list with unread badges, priority
16
+ flags, stars and message counts, and a conversation pane with the full reply
17
+ chain. Flows: compose to teammates (recipient / cc pickers, `RichEditorToolbar`
18
+ wired to markdown-at-caret, simulated attachments, high priority), send, save
19
+ draft, reply / reply-all, forward, star, archive, mark read / unread, delete
20
+ behind `Confirm` and “mark all read”.
21
+ - The unread count feeds the shell: `MetronicSidebar` gained a `badges` prop so
22
+ the **Messages** entry shows a live badge, and `MessagesScreen` reports through
23
+ `onUnreadChange`.
24
+ - `messagesModel.ts` — threads, messages, attachments, labels, recipients and
25
+ helpers (`snippetOf`, `lastSenderOf`, `participantsOf`, `totalUnread`), exported
26
+ from the templates subpath alongside `MessagesScreen`.
27
+
28
+ ### Added — components
29
+ - `CronEditor` — five-field cron builder with preset chips, per-field selects, a
30
+ free-text expression box and a live human-readable preview; `describeCron` and
31
+ `CRON_PRESETS` are exported as well.
32
+ - `Kanban` — dependency-free HTML5 drag & drop board with column limits, custom
33
+ card rendering, column footers and an `onMove(cardId, from, to, index)` hook.
34
+ - `VirtualTable` — windowed table for very large datasets: only the visible slice
35
+ plus overscan is mounted, so 100k rows scroll smoothly.
36
+ - `RichEditor` — contentEditable editor wired to `RichEditorToolbar`, with a
37
+ placeholder, an optional HTML source view and HTML output through `onChange`.
38
+ - `MetronicSidebar` gains `lockedKeys`, `collapsed`, `onToggleCollapsed` and
39
+ `roleLabel` props.
40
+
41
+ ### Added — admin screens
42
+ - `ApprovalsScreen` — multi-step workflow inbox: KPI strip, scope/type filters,
43
+ row selection with bulk decisions, a step chain on `Timeline`, `DiffViewer` for
44
+ permission changes and rich-text decision notes.
45
+ - `TicketsScreen` — SLA-aware support desk with a live countdown, list and
46
+ `Kanban` board views (drag a card to change its stage), public replies vs
47
+ internal notes in `RichEditor`, and an assignment / resolve flow.
48
+ - `CalendarScreen` — week grid (08:00–19:00) with click-to-create meetings,
49
+ room conflict detection before saving, reschedule, meeting notes and an agenda
50
+ view.
51
+ - `WorkspaceSecurityScreen` — SSO / enforced 2FA / session & idle lifetime, IP
52
+ allowlist with CIDR validation, password policy, a live posture score and a
53
+ revoke-everything danger zone.
54
+ - `IntegrationsScreen` — app directory with connect / disconnect, webhook
55
+ endpoints with events and a signing secret, and a delivery log with retry and
56
+ `CodeViewer` request / response inspection.
57
+ - `FeatureFlagsScreen` — per-environment toggles, rollout steps, department
58
+ targeting via `Cascader`, role allowlists, change history and archive.
59
+ - `TemplatesScreen` — notification templates with variable chips inserted at the
60
+ caret, channel-aware previews (email / SMS / push / Slack), version history and
61
+ a test-send modal.
62
+ - `ImportExportScreen` — four-step import `Wizard` (upload → map → validate → run)
63
+ with a 100k-row `VirtualTable` validation preview, export scheduling and a job
64
+ history with retry.
65
+ - `SearchScreen` — cross-entity search (orders, products, customers, team,
66
+ tickets, approvals, docs) with grouped results and ↑ ↓ ⏎ navigation.
67
+
68
+ ### Added — shell experience
69
+ - Hash deep links (`#/orders/A-1042`) with browser back / forward support.
70
+ - Persisted demo preferences in `localStorage` (theme, density, skin, locale,
71
+ collapsed sidebar, simulated role).
72
+ - Permission-aware navigation driven by `ROLE_PERMISSIONS`: locked entries show a
73
+ lock icon and route to a `Result`-based 403 panel, with a “view as role” group
74
+ in the command palette and a banner to reset.
75
+ - Skeleton loading states between screens, a simulated outage with retry, and a
76
+ keyboard-shortcut sheet (`⌘/` or `?`).
77
+ - `nav` / `pages` demo copy for the nine new screens in all four locales.
78
+
79
+ ### Changed
80
+ - Keyboard shortcuts: `⌘K` / `Ctrl K` opens the palette, `/` jumps to global
81
+ search, `?` / `⌘/` opens the shortcut sheet.
82
+
83
+ ## [0.3.0] — 2026-09-16
84
+
85
+ ### Added
86
+ - **Settings is now a full five-tab page** (`MetronicSettingsTemplate`), each tab
87
+ interactive and exportable on its own:
88
+ - **Profile** (`ProfileSection`) — photo upload with a local preview,
89
+ personal information with validation and dirty tracking, regional
90
+ preferences (language / timezone / date format / week start).
91
+ - **Account** (`AccountSection`) — password change with a live strength meter
92
+ and requirement checklist, two-factor enrolment (setup key + copy button +
93
+ `DigitInput` verification, recovery codes), active-session list with revoke
94
+ and “sign out others”, and a danger zone (deactivate + delete behind typed
95
+ confirmation).
96
+ - **Notifications** (`NotificationsSection`) — channel matrix (email / push /
97
+ SMS × event) with column-level select-all and indeterminate state, digest
98
+ cadence, quiet hours and a test send.
99
+ - **Billing** (`BillingSection`) — current plan with usage meters, plan
100
+ switching, payment methods (add / make default / remove), billing details and
101
+ an invoice history table.
102
+ - **API keys** (`ApiKeysSection`) — usage summary, create dialog with scope
103
+ picker, one-time secret reveal, rotate and revoke.
104
+ - Exports: `ProfileSection`, `AccountSection`, `NotificationsSection`,
105
+ `BillingSection`, `ApiKeysSection`, `SETTINGS_NAV` and `SettingsSectionKey`
106
+ join the templates subpath.
107
+ - Storybook: one story per settings tab under *Templates / Metronic*.
108
+ - **Interactive demo shell** (`MetronicDashboardTemplate`) — the top bar is now
109
+ fully wired instead of decorative:
110
+ - a **⌘K / Ctrl-K command palette** (navigate + actions + recents), also
111
+ opened from the search box and the help menu;
112
+ - a **notification centre** with unread indicator, per-item read state and
113
+ “mark all as read”;
114
+ - an **appearance menu** that live-switches `data-theme` (light / dark),
115
+ `data-density` (comfortable / compact) and `data-mode` (metronic / blue /
116
+ purple / orange / green / slate) across the whole demo;
117
+ - an **account menu** (profile, billing, team & roles, sign out) and a working
118
+ “New order” shortcut that jumps to the orders page and opens its dialog.
119
+ - **Orders is a full CRUD page** — create / edit in a modal with validation,
120
+ a details drawer with a status timeline, advance-status, refund, duplicate and
121
+ “email receipt” actions, delete behind `Confirm`, working bulk actions
122
+ (mark fulfilled / refund) and a search empty state.
123
+ - `DashboardScreen` accepts `onViewAllOrders` — “View all” and recent-order rows
124
+ now jump to the orders page.
125
+ - **Four more back-office screens** (Metronic examples):
126
+ - **`DepartmentsScreen`** — organisation tree on the Table’s tree mode:
127
+ expandable departments with manager, headcount and budget usage, full CRUD
128
+ (deleting a parent reparents its children) and a details drawer that links to
129
+ the team page.
130
+ - **`RoleTreeScreen`** — role hierarchy built on the `Tree` component: two
131
+ panes showing the selected role’s ancestors, the permissions it *owns*
132
+ versus the ones it *inherits*, its members, and a child-role comparison
133
+ table with clone / delete actions.
134
+ - **`TasksScreen`** — cron-style scheduled tasks: human-readable schedule,
135
+ last / next run, inline enable switch, “run now” with a simulated execution,
136
+ a run-history drawer and a create/edit dialog with schedule presets,
137
+ timezone, retries and notify-on-failure.
138
+ - **`AuditScreen`** — audit trail with search, action / severity / range
139
+ filters, severity and result badges, and a drawer exposing the request
140
+ metadata JSON (copyable) plus actor actions.
141
+ - **User management is now a full module** — the members list gained a security
142
+ summary (2FA coverage, flags, pending invites), department / role / status /
143
+ security filters, row selection with bulk actions (activate, suspend, reset
144
+ 2FA, assign role, move department) and a **user detail drawer** with four
145
+ tabs: profile, access (roles plus direct allow/deny overrides and the
146
+ resulting effective permission set), security (account state, 2FA, password
147
+ policy, per-device sessions) and activity (that member’s audit trail, with a
148
+ jump into the audit screen filtered by them).
149
+ - **`DepartmentFilter`** — a cascading department picker built on `Dropdown`:
150
+ branches expand in place (the chevron only toggles, the row selects), every
151
+ row shows the member count of its whole branch, and choosing a parent filters
152
+ the list by that department *and* its sub-departments.
153
+ - **Demo i18n** (`i18n.tsx`) — the shell now renders inside `ConfigProvider`, so
154
+ every component string follows the active locale pack (pagination, filters,
155
+ export, modal buttons, …), while nav labels, page headers and shell copy come
156
+ from a demo dictionary covering en-US, zh-CN, zh-TW and ja-JP. A language menu
157
+ in the top bar switches between all 17 shipped locales and flips the layout to
158
+ RTL (Arabic).
159
+ - `PageHeader`, `useDemoText`, `demoTextFor`, `DEMO_TEXT`, `LOCALE_OPTIONS` and
160
+ `RTL_LOCALES` join the templates subpath.
161
+ - **`Cascader` gained the props it was missing for real-world filters** —
162
+ `clearable` (an inline `×`), `renderOption` (decorate panel rows without
163
+ touching the trigger label) and `defaultValue` (uncontrolled usage). The panel
164
+ is now `role="menu"` with `role="menuitem"` / `aria-selected` rows, and the
165
+ component ships 9 unit tests.
166
+
167
+ ### Changed
168
+ - **The settings page is full width by default** — it now fills the host content
169
+ area instead of being capped at 1000px. Pass `maxWidth={1000}` (or any CSS
170
+ length) to restore a centred column.
171
+ - `MetronicSettingsTemplate` accepts `section` / `defaultSection` /
172
+ `onSectionChange` so the active tab can be controlled from the router.
173
+ - The page header shows a dirty-state badge that flips between
174
+ “All changes saved” and “Unsaved changes”.
175
+ - `MetronicTopBar` now takes props (appearance state, notifications and action
176
+ handlers) instead of rendering static buttons; `OrdersScreen` takes an optional
177
+ `createRequest` counter used by the shell’s “New order” button.
178
+ - `MetronicSidebar` items take an optional `label` (resolved from the demo
179
+ dictionary), support multiple nested groups and hairline section breaks, and
180
+ the top bar gained `localeCode` / `onLocaleChange`.
181
+ - `UsersScreen` accepts `initialDepartment` / `onOpenAudit` / `onOpenRoles` /
182
+ `onOpenDepartments` so the departments and audit screens can drill straight
183
+ into it, and `AuditScreen` accepts `initialActor` for the reverse jump.
184
+ - The department filter in the demo is now the design-system **`Cascader`**
185
+ (multi-column drill-down with per-row member counts) instead of a hand-rolled
186
+ dropdown, and `Cascader` follows the density tokens — heights and padding come
187
+ from `--klun-control-h-*` / `--klun-field-px-*`, so compact density shrinks it
188
+ like every other field.
189
+
8
190
  ## [0.2.2] — 2026-09-16
9
191
 
10
192
  ### Added
package/README.md CHANGED
@@ -100,7 +100,7 @@ All components and their prop types are named exports; the `cx` classnames helpe
100
100
 
101
101
  ## Templates
102
102
 
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` 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):
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):
104
104
 
105
105
  ```tsx
106
106
  import "klun-ui/styles.css";
@@ -0,0 +1,18 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+
4
+ type ChipColor = "gray" | "blue" | "orange" | "red" | "green" | "purple" | "yellow" | "teal" | "sky" | "pink";
5
+ interface ChipProps extends HTMLAttributes<HTMLSpanElement> {
6
+ color?: ChipColor;
7
+ selected?: boolean;
8
+ /** Show a leading color dot. */
9
+ dot?: boolean;
10
+ /** Show a dismiss (×) button; receives the click handler. */
11
+ onDismiss?: () => void;
12
+ disabled?: boolean;
13
+ children?: ReactNode;
14
+ }
15
+ /** Klun UI Chip — compact, optionally-selectable color category pill. */
16
+ declare const Chip: react.ForwardRefExoticComponent<ChipProps & react.RefAttributes<HTMLSpanElement>>;
17
+
18
+ export { type ChipColor as C, Chip as a, type ChipProps as b };
@@ -0,0 +1,18 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+
4
+ type ChipColor = "gray" | "blue" | "orange" | "red" | "green" | "purple" | "yellow" | "teal" | "sky" | "pink";
5
+ interface ChipProps extends HTMLAttributes<HTMLSpanElement> {
6
+ color?: ChipColor;
7
+ selected?: boolean;
8
+ /** Show a leading color dot. */
9
+ dot?: boolean;
10
+ /** Show a dismiss (×) button; receives the click handler. */
11
+ onDismiss?: () => void;
12
+ disabled?: boolean;
13
+ children?: ReactNode;
14
+ }
15
+ /** Klun UI Chip — compact, optionally-selectable color category pill. */
16
+ declare const Chip: react.ForwardRefExoticComponent<ChipProps & react.RefAttributes<HTMLSpanElement>>;
17
+
18
+ export { type ChipColor as C, Chip as a, type ChipProps as b };