@whity/ui 0.0.0-stage → 0.5.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/README.md +107 -3
- package/package.json +192 -6
- package/src/access-denied.stories.tsx +179 -0
- package/src/access-denied.tsx +305 -0
- package/src/action-proposal.tsx +302 -0
- package/src/actor-chip.tsx +71 -0
- package/src/agent-activity.tsx +163 -0
- package/src/agent-collaboration.stories.tsx +156 -0
- package/src/agent-run-status.tsx +196 -0
- package/src/alert-dialog.stories.tsx +45 -0
- package/src/alert-dialog.tsx +147 -0
- package/src/alert.stories.tsx +91 -0
- package/src/alert.tsx +89 -0
- package/src/app-sidebar.stories.tsx +195 -0
- package/src/app-sidebar.tsx +500 -0
- package/src/approval-queue.tsx +108 -0
- package/src/audience-group-picker.stories.tsx +198 -0
- package/src/audience-group-picker.tsx +362 -0
- package/src/audience-people-picker.stories.tsx +102 -0
- package/src/audience-people-picker.tsx +279 -0
- package/src/avatar.tsx +83 -0
- package/src/badge.stories.tsx +105 -0
- package/src/badge.tsx +68 -0
- package/src/beta-warning.stories.tsx +79 -0
- package/src/beta-warning.tsx +189 -0
- package/src/bilingual-input.stories.tsx +82 -0
- package/src/bilingual-input.tsx +183 -0
- package/src/breadcrumb.stories.tsx +51 -0
- package/src/breadcrumb.tsx +90 -0
- package/src/button.stories.tsx +87 -0
- package/src/button.tsx +118 -0
- package/src/card.stories.tsx +423 -0
- package/src/card.tsx +180 -0
- package/src/chart.stories.tsx +66 -0
- package/src/chart.tsx +228 -0
- package/src/checkbox.stories.tsx +62 -0
- package/src/checkbox.tsx +54 -0
- package/src/collapsible.stories.tsx +48 -0
- package/src/collapsible.tsx +34 -0
- package/src/color-card.stories.tsx +61 -0
- package/src/color-card.tsx +270 -0
- package/src/color-picker.stories.tsx +65 -0
- package/src/color-picker.tsx +425 -0
- package/src/command-palette.tsx +306 -0
- package/src/copy-block.stories.tsx +38 -0
- package/src/copy-block.tsx +85 -0
- package/src/data-table.stories.tsx +200 -0
- package/src/data-table.tsx +1106 -0
- package/src/date-picker.stories.tsx +61 -0
- package/src/date-picker.tsx +422 -0
- package/src/design-cards.stories.tsx +458 -0
- package/src/dialog.stories.tsx +48 -0
- package/src/dialog.tsx +166 -0
- package/src/documents/barcode-svg.stories.tsx +72 -0
- package/src/documents/barcode-svg.tsx +79 -0
- package/src/dropdown-menu.stories.tsx +77 -0
- package/src/dropdown-menu.tsx +271 -0
- package/src/editor/behaviour.ts +279 -0
- package/src/editor/block-ids.ts +44 -0
- package/src/editor/block-list.tsx +101 -0
- package/src/editor/block-toolbar.tsx +477 -0
- package/src/editor/bubble.tsx +93 -0
- package/src/editor/catalogue.ts +103 -0
- package/src/editor/collab-rail.tsx +746 -0
- package/src/editor/collab.stories.tsx +207 -0
- package/src/editor/collab.ts +87 -0
- package/src/editor/contract.ts +408 -0
- package/src/editor/convert.ts +362 -0
- package/src/editor/doc-editor.stories.tsx +98 -0
- package/src/editor/doc-editor.tsx +1287 -0
- package/src/editor/editor.css +536 -0
- package/src/editor/extensions.ts +86 -0
- package/src/editor/field-picker.tsx +107 -0
- package/src/editor/fields.ts +100 -0
- package/src/editor/gutter.tsx +367 -0
- package/src/editor/index.ts +22 -0
- package/src/editor/label-sheet.tsx +289 -0
- package/src/editor/labels.ts +310 -0
- package/src/editor/link-tools.tsx +141 -0
- package/src/editor/node-views.tsx +450 -0
- package/src/editor/page-view.tsx +353 -0
- package/src/editor/publish-check.tsx +182 -0
- package/src/editor/rich-blocks.stories.tsx +146 -0
- package/src/editor/sample.ts +40 -0
- package/src/editor/schema-rich.ts +150 -0
- package/src/editor/schema.ts +315 -0
- package/src/editor/services.tsx +127 -0
- package/src/editor/slash.ts +64 -0
- package/src/editor/suggesting.ts +372 -0
- package/src/editor/suggestions.ts +763 -0
- package/src/editor/table-keys.ts +66 -0
- package/src/editor/templates.stories.tsx +324 -0
- package/src/editor/toolbar.tsx +358 -0
- package/src/empty-state.stories.tsx +51 -0
- package/src/empty-state.tsx +100 -0
- package/src/empty-state.usage-notes.md +30 -0
- package/src/form.stories.tsx +112 -0
- package/src/form.tsx +176 -0
- package/src/globals.css +20 -0
- package/src/icon-button.tsx +85 -0
- package/src/icon-map.ts +244 -0
- package/src/icon.tsx +41 -0
- package/src/index.ts +67 -0
- package/src/input.stories.tsx +157 -0
- package/src/input.tsx +759 -0
- package/src/locked-screen.stories.tsx +29 -0
- package/src/locked-screen.tsx +61 -0
- package/src/mark.tsx +62 -0
- package/src/math-text.stories.tsx +33 -0
- package/src/math-text.tsx +43 -0
- package/src/menu-bar.stories.tsx +198 -0
- package/src/menu-bar.tsx +373 -0
- package/src/money/currency.ts +230 -0
- package/src/page-header.stories.tsx +95 -0
- package/src/page-header.tsx +122 -0
- package/src/page-shell.stories.tsx +42 -0
- package/src/page-shell.tsx +32 -0
- package/src/pagination.stories.tsx +45 -0
- package/src/pagination.tsx +98 -0
- package/src/plugin-card.stories.tsx +180 -0
- package/src/plugin-card.tsx +848 -0
- package/src/popover.stories.tsx +48 -0
- package/src/popover.tsx +55 -0
- package/src/radio-group.stories.tsx +26 -0
- package/src/radio-group.tsx +44 -0
- package/src/route-flow/editor.tsx +1014 -0
- package/src/route-flow/model.ts +716 -0
- package/src/scope-grant.tsx +139 -0
- package/src/screen-too-small.stories.tsx +61 -0
- package/src/screen-too-small.tsx +104 -0
- package/src/select.stories.tsx +44 -0
- package/src/select.tsx +197 -0
- package/src/separator.stories.tsx +34 -0
- package/src/separator.tsx +34 -0
- package/src/sheet.stories.tsx +49 -0
- package/src/sheet.tsx +168 -0
- package/src/skeleton.stories.tsx +28 -0
- package/src/skeleton.tsx +19 -0
- package/src/slider.stories.tsx +78 -0
- package/src/slider.tsx +300 -0
- package/src/spinner.stories.tsx +33 -0
- package/src/spinner.tsx +55 -0
- package/src/switch.stories.tsx +42 -0
- package/src/switch.tsx +41 -0
- package/src/switcher.stories.tsx +111 -0
- package/src/switcher.tsx +131 -0
- package/src/table.stories.tsx +48 -0
- package/src/table.tsx +121 -0
- package/src/tabs.stories.tsx +74 -0
- package/src/tabs.tsx +90 -0
- package/src/tag-input.stories.tsx +67 -0
- package/src/tag-input.tsx +117 -0
- package/src/tenant-logo.tsx +63 -0
- package/src/tenant-switcher.stories.tsx +38 -0
- package/src/tenant-switcher.tsx +164 -0
- package/src/textarea.stories.tsx +27 -0
- package/src/textarea.tsx +18 -0
- package/src/theme-mode.ts +52 -0
- package/src/time-picker.stories.tsx +62 -0
- package/src/time-picker.tsx +615 -0
- package/src/toggle-group.tsx +138 -0
- package/src/tooltip.stories.tsx +43 -0
- package/src/tooltip.tsx +73 -0
- package/src/top-nav.stories.tsx +58 -0
- package/src/top-nav.tsx +324 -0
- package/src/undo-bar.tsx +107 -0
- package/src/utils.ts +45 -0
- package/src/view-toggle.stories.tsx +84 -0
- package/src/view-toggle.tsx +110 -0
package/README.md
CHANGED
|
@@ -1,3 +1,107 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @whity/ui
|
|
2
|
+
|
|
3
|
+
Shared UI primitives for Whity products, built on Radix + Tailwind v4.
|
|
4
|
+
|
|
5
|
+
## Consuming from a non-Next.js client (Tauri, plain Vite SPA, etc.)
|
|
6
|
+
|
|
7
|
+
Every component in `src/` is plain React with zero Next.js dependency —
|
|
8
|
+
confirmed by a CI guard (`.github/workflows/publish-ui.yml`) that fails the
|
|
9
|
+
build if a `next/*` import ever appears here. `"use client"` directives exist
|
|
10
|
+
on the components below for Next.js/RSC's benefit only; they're inert
|
|
11
|
+
(harmless no-ops) outside Next, so a plain Vite/Tauri SPA can import and use
|
|
12
|
+
every component in this package as-is:
|
|
13
|
+
|
|
14
|
+
`alert-dialog`, `checkbox`, `data-table`, `dialog`, `dropdown-menu`, `select`,
|
|
15
|
+
`sheet`, `switch`, `tabs`, `tooltip`.
|
|
16
|
+
|
|
17
|
+
Everything else has no directive at all (nothing RSC-sensitive to mark).
|
|
18
|
+
|
|
19
|
+
### Getting the components
|
|
20
|
+
|
|
21
|
+
Two ways to consume this package, matching how it's used inside whity-core
|
|
22
|
+
itself:
|
|
23
|
+
|
|
24
|
+
1. **npm package** — `npm install @whity/ui` (published to public npm
|
|
25
|
+
under the `@whity` scope, no token needed) for the components' compiled
|
|
26
|
+
exports and the theme (`@whity/ui/globals.css`, itself built on top of
|
|
27
|
+
`@whity/tokens` — see below).
|
|
28
|
+
2. **shadcn registry** — for a locally-customizable, re-pullable copy of a
|
|
29
|
+
component's actual source (the same mechanism whity-core's own `web/`
|
|
30
|
+
package uses): add a `registries` entry to your own project's
|
|
31
|
+
`components.json`:
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"registries": {
|
|
35
|
+
"@whity": "https://whity.jameedium.org/r/{name}.json"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
then `npx shadcn add @whity/button` (or any other component name from
|
|
40
|
+
`web/registry.json`). Re-run the same command to pull updates.
|
|
41
|
+
|
|
42
|
+
### Design tokens without the component library
|
|
43
|
+
|
|
44
|
+
If a client only needs the design tokens (colors, typography, spacing,
|
|
45
|
+
radius) — not the React components — depend on `@whity/tokens` directly
|
|
46
|
+
instead:
|
|
47
|
+
|
|
48
|
+
```css
|
|
49
|
+
@import "tailwindcss";
|
|
50
|
+
@import "@whity/tokens/css"; /* colors + typography theme */
|
|
51
|
+
@import "@whity/tokens/base.css"; /* shadcn/Tailwind base-reset layer */
|
|
52
|
+
@import "@whity/tokens/fonts.css"; /* self-hosted Noto Sans, Noto Sans Arabic, Geist Mono */
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import tokens from "@whity/tokens"; // tokens.json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`./css` gives you the color/typography custom properties and the Tailwind v4
|
|
60
|
+
`@theme inline` mapping. `./base.css` is the same border/ring reset,
|
|
61
|
+
`body` background/foreground, and default font that `web/app/globals.css`
|
|
62
|
+
and this package's own `src/globals.css` used to hand-duplicate — import it
|
|
63
|
+
once instead of re-typing that `@layer base` block per client. `./fonts.css`
|
|
64
|
+
declares `@font-face` rules for the three type families `--font-sans` /
|
|
65
|
+
`--font-mono` reference, backed by the woff2 binaries in this package's
|
|
66
|
+
`fonts/` directory (OFL-licensed, see `fonts/LICENSE-*.txt`) — no network
|
|
67
|
+
fetch, no Next.js font-loader dependency. A Next.js app can skip `fonts.css`
|
|
68
|
+
and keep using `next/font` (as `web/` does) since it gets equivalent
|
|
69
|
+
self-hosting plus build-time optimization for free; `fonts.css` exists for
|
|
70
|
+
every client that doesn't have that pipeline (Tauri, plain Vite, Storybook).
|
|
71
|
+
|
|
72
|
+
Flutter clients use the same color/typography source of truth via a git
|
|
73
|
+
dependency — see `flutter/whity_tokens/README.md` in this repo. Font
|
|
74
|
+
*binaries* aren't bundled there yet; a Flutter app should declare its own
|
|
75
|
+
font assets in `pubspec.yaml` (family names must match
|
|
76
|
+
`typography.fontFamilyDart` in `src/design/tokens/base.json`: `Noto Sans`,
|
|
77
|
+
`Noto Sans Arabic`, `Geist Mono`).
|
|
78
|
+
|
|
79
|
+
All three (`@whity/ui`, `@whity/tokens`, `flutter/whity_tokens`) are
|
|
80
|
+
generated from the same single source of truth,
|
|
81
|
+
`src/design/tokens/base.json` — run `npm run tokens:generate` (from `web/`)
|
|
82
|
+
after changing it to regenerate every target.
|
|
83
|
+
|
|
84
|
+
### Theme mode (light/dark/system) contract
|
|
85
|
+
|
|
86
|
+
Every client should implement light/dark switching the same way so a toggle
|
|
87
|
+
built in one client looks and behaves identically in another:
|
|
88
|
+
|
|
89
|
+
- **Strategy**: apply/remove a `.dark` class on the root element (`<html>` on
|
|
90
|
+
web) — the exact selector `@custom-variant dark (&:is(.dark *));` (in
|
|
91
|
+
`@whity/tokens/css`) and every `.dark { ... }` token block target. No
|
|
92
|
+
class means light mode.
|
|
93
|
+
- **Persistence key**: `whity.theme`, storing the raw preference —
|
|
94
|
+
`'light' | 'dark' | 'system'`, not the resolved value.
|
|
95
|
+
- **Default**: `'system'` when nothing is stored yet, resolved against the
|
|
96
|
+
OS/platform light-dark setting.
|
|
97
|
+
- **FOUC**: apply the class before first paint. On web this is a small
|
|
98
|
+
blocking inline `<script>` in `<head>`, before any stylesheet.
|
|
99
|
+
|
|
100
|
+
`src/theme-mode.ts` (exported as `@whity/ui/theme-mode`, also available
|
|
101
|
+
via the shadcn registry as `@whity/theme-mode`) is the framework-agnostic
|
|
102
|
+
(no React) half of this contract — the storage key constant, the
|
|
103
|
+
`resolveIsDark()` resolution rule, and `buildThemeInitScript()` for the
|
|
104
|
+
anti-FOUC script source. `web/lib/theme-mode-context.tsx` is the React
|
|
105
|
+
provider built on top of it. A non-JS client (Flutter) can't import this file
|
|
106
|
+
directly but should replicate the same key, values, and resolution rule by
|
|
107
|
+
hand.
|
package/package.json
CHANGED
|
@@ -1,6 +1,192 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@whity/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@whity/ui",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Shared UI primitives for Whity products",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/whity-org/whity-core.git",
|
|
9
|
+
"directory": "packages/ui"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
13
|
+
"storybook": "storybook dev -p 6006",
|
|
14
|
+
"build-storybook": "storybook build"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": "./src/index.ts",
|
|
18
|
+
"./access-denied": "./src/access-denied.tsx",
|
|
19
|
+
"./actor-chip": "./src/actor-chip.tsx",
|
|
20
|
+
"./agent-run-status": "./src/agent-run-status.tsx",
|
|
21
|
+
"./alert": "./src/alert.tsx",
|
|
22
|
+
"./alert-dialog": "./src/alert-dialog.tsx",
|
|
23
|
+
"./action-proposal": "./src/action-proposal.tsx",
|
|
24
|
+
"./agent-activity": "./src/agent-activity.tsx",
|
|
25
|
+
"./approval-queue": "./src/approval-queue.tsx",
|
|
26
|
+
"./scope-grant": "./src/scope-grant.tsx",
|
|
27
|
+
"./undo-bar": "./src/undo-bar.tsx",
|
|
28
|
+
"./app-sidebar": "./src/app-sidebar.tsx",
|
|
29
|
+
"./audience-group-picker": "./src/audience-group-picker.tsx",
|
|
30
|
+
"./audience-people-picker": "./src/audience-people-picker.tsx",
|
|
31
|
+
"./avatar": "./src/avatar.tsx",
|
|
32
|
+
"./badge": "./src/badge.tsx",
|
|
33
|
+
"./beta-warning": "./src/beta-warning.tsx",
|
|
34
|
+
"./bilingual-input": "./src/bilingual-input.tsx",
|
|
35
|
+
"./breadcrumb": "./src/breadcrumb.tsx",
|
|
36
|
+
"./button": "./src/button.tsx",
|
|
37
|
+
"./card": "./src/card.tsx",
|
|
38
|
+
"./chart": "./src/chart.tsx",
|
|
39
|
+
"./checkbox": "./src/checkbox.tsx",
|
|
40
|
+
"./collapsible": "./src/collapsible.tsx",
|
|
41
|
+
"./color-card": "./src/color-card.tsx",
|
|
42
|
+
"./color-picker": "./src/color-picker.tsx",
|
|
43
|
+
"./command-palette": "./src/command-palette.tsx",
|
|
44
|
+
"./copy-block": "./src/copy-block.tsx",
|
|
45
|
+
"./data-table": "./src/data-table.tsx",
|
|
46
|
+
"./date-picker": "./src/date-picker.tsx",
|
|
47
|
+
"./dialog": "./src/dialog.tsx",
|
|
48
|
+
"./documents/barcode-svg": "./src/documents/barcode-svg.tsx",
|
|
49
|
+
"./dropdown-menu": "./src/dropdown-menu.tsx",
|
|
50
|
+
"./editor": "./src/editor/index.ts",
|
|
51
|
+
"./editor/behaviour": "./src/editor/behaviour.ts",
|
|
52
|
+
"./editor/block-ids": "./src/editor/block-ids.ts",
|
|
53
|
+
"./editor/block-list": "./src/editor/block-list.tsx",
|
|
54
|
+
"./editor/block-toolbar": "./src/editor/block-toolbar.tsx",
|
|
55
|
+
"./editor/bubble": "./src/editor/bubble.tsx",
|
|
56
|
+
"./editor/catalogue": "./src/editor/catalogue.ts",
|
|
57
|
+
"./editor/collab": "./src/editor/collab.ts",
|
|
58
|
+
"./editor/collab-rail": "./src/editor/collab-rail.tsx",
|
|
59
|
+
"./editor/contract": "./src/editor/contract.ts",
|
|
60
|
+
"./editor/convert": "./src/editor/convert.ts",
|
|
61
|
+
"./editor/doc-editor": "./src/editor/doc-editor.tsx",
|
|
62
|
+
"./editor/editor.css": "./src/editor/editor.css",
|
|
63
|
+
"./editor/extensions": "./src/editor/extensions.ts",
|
|
64
|
+
"./editor/field-picker": "./src/editor/field-picker.tsx",
|
|
65
|
+
"./editor/fields": "./src/editor/fields.ts",
|
|
66
|
+
"./editor/gutter": "./src/editor/gutter.tsx",
|
|
67
|
+
"./editor/label-sheet": "./src/editor/label-sheet.tsx",
|
|
68
|
+
"./editor/labels": "./src/editor/labels.ts",
|
|
69
|
+
"./editor/link-tools": "./src/editor/link-tools.tsx",
|
|
70
|
+
"./editor/node-views": "./src/editor/node-views.tsx",
|
|
71
|
+
"./editor/page-view": "./src/editor/page-view.tsx",
|
|
72
|
+
"./editor/publish-check": "./src/editor/publish-check.tsx",
|
|
73
|
+
"./editor/sample": "./src/editor/sample.ts",
|
|
74
|
+
"./editor/schema": "./src/editor/schema.ts",
|
|
75
|
+
"./editor/schema-rich": "./src/editor/schema-rich.ts",
|
|
76
|
+
"./editor/services": "./src/editor/services.tsx",
|
|
77
|
+
"./editor/slash": "./src/editor/slash.ts",
|
|
78
|
+
"./editor/suggesting": "./src/editor/suggesting.ts",
|
|
79
|
+
"./editor/suggestions": "./src/editor/suggestions.ts",
|
|
80
|
+
"./editor/table-keys": "./src/editor/table-keys.ts",
|
|
81
|
+
"./editor/toolbar": "./src/editor/toolbar.tsx",
|
|
82
|
+
"./empty-state": "./src/empty-state.tsx",
|
|
83
|
+
"./form": "./src/form.tsx",
|
|
84
|
+
"./globals.css": "./src/globals.css",
|
|
85
|
+
"./icon": "./src/icon.tsx",
|
|
86
|
+
"./icon-button": "./src/icon-button.tsx",
|
|
87
|
+
"./icon-map": "./src/icon-map.ts",
|
|
88
|
+
"./input": "./src/input.tsx",
|
|
89
|
+
"./locked-screen": "./src/locked-screen.tsx",
|
|
90
|
+
"./mark": "./src/mark.tsx",
|
|
91
|
+
"./math-text": "./src/math-text.tsx",
|
|
92
|
+
"./menu-bar": "./src/menu-bar.tsx",
|
|
93
|
+
"./money/currency": "./src/money/currency.ts",
|
|
94
|
+
"./page-header": "./src/page-header.tsx",
|
|
95
|
+
"./page-shell": "./src/page-shell.tsx",
|
|
96
|
+
"./pagination": "./src/pagination.tsx",
|
|
97
|
+
"./plugin-card": "./src/plugin-card.tsx",
|
|
98
|
+
"./popover": "./src/popover.tsx",
|
|
99
|
+
"./radio-group": "./src/radio-group.tsx",
|
|
100
|
+
"./route-flow/editor": "./src/route-flow/editor.tsx",
|
|
101
|
+
"./route-flow/model": "./src/route-flow/model.ts",
|
|
102
|
+
"./screen-too-small": "./src/screen-too-small.tsx",
|
|
103
|
+
"./select": "./src/select.tsx",
|
|
104
|
+
"./separator": "./src/separator.tsx",
|
|
105
|
+
"./sheet": "./src/sheet.tsx",
|
|
106
|
+
"./skeleton": "./src/skeleton.tsx",
|
|
107
|
+
"./slider": "./src/slider.tsx",
|
|
108
|
+
"./spinner": "./src/spinner.tsx",
|
|
109
|
+
"./switch": "./src/switch.tsx",
|
|
110
|
+
"./switcher": "./src/switcher.tsx",
|
|
111
|
+
"./table": "./src/table.tsx",
|
|
112
|
+
"./tabs": "./src/tabs.tsx",
|
|
113
|
+
"./tag-input": "./src/tag-input.tsx",
|
|
114
|
+
"./tenant-logo": "./src/tenant-logo.tsx",
|
|
115
|
+
"./tenant-switcher": "./src/tenant-switcher.tsx",
|
|
116
|
+
"./textarea": "./src/textarea.tsx",
|
|
117
|
+
"./theme-mode": "./src/theme-mode.ts",
|
|
118
|
+
"./time-picker": "./src/time-picker.tsx",
|
|
119
|
+
"./toggle-group": "./src/toggle-group.tsx",
|
|
120
|
+
"./tooltip": "./src/tooltip.tsx",
|
|
121
|
+
"./top-nav": "./src/top-nav.tsx",
|
|
122
|
+
"./utils": "./src/utils.ts",
|
|
123
|
+
"./view-toggle": "./src/view-toggle.tsx"
|
|
124
|
+
},
|
|
125
|
+
"files": [
|
|
126
|
+
"src"
|
|
127
|
+
],
|
|
128
|
+
"peerDependencies": {
|
|
129
|
+
"@tabler/icons-react": ">=3",
|
|
130
|
+
"katex": ">=0.16",
|
|
131
|
+
"radix-ui": ">=1",
|
|
132
|
+
"react": ">=19",
|
|
133
|
+
"react-dom": ">=19",
|
|
134
|
+
"react-hook-form": ">=7"
|
|
135
|
+
},
|
|
136
|
+
"dependencies": {
|
|
137
|
+
"@whity/tokens": "^0.2.0",
|
|
138
|
+
"@tanstack/react-table": "^9.2.4",
|
|
139
|
+
"@tiptap/core": "3.32.1",
|
|
140
|
+
"@tiptap/extension-blockquote": "3.32.1",
|
|
141
|
+
"@tiptap/extension-bold": "3.32.1",
|
|
142
|
+
"@tiptap/extension-bubble-menu": "3.32.1",
|
|
143
|
+
"@tiptap/extension-code": "3.32.1",
|
|
144
|
+
"@tiptap/extension-code-block": "3.32.1",
|
|
145
|
+
"@tiptap/extension-document": "3.32.1",
|
|
146
|
+
"@tiptap/extension-hard-break": "3.32.1",
|
|
147
|
+
"@tiptap/extension-heading": "3.32.1",
|
|
148
|
+
"@tiptap/extension-highlight": "3.32.1",
|
|
149
|
+
"@tiptap/extension-horizontal-rule": "3.32.1",
|
|
150
|
+
"@tiptap/extension-italic": "3.32.1",
|
|
151
|
+
"@tiptap/extension-link": "3.32.1",
|
|
152
|
+
"@tiptap/extension-paragraph": "3.32.1",
|
|
153
|
+
"@tiptap/extension-strike": "3.32.1",
|
|
154
|
+
"@tiptap/extension-text": "3.32.1",
|
|
155
|
+
"@tiptap/extension-underline": "3.32.1",
|
|
156
|
+
"@tiptap/extensions": "3.32.1",
|
|
157
|
+
"@tiptap/pm": "3.32.1",
|
|
158
|
+
"@tiptap/react": "3.32.1",
|
|
159
|
+
"@tiptap/suggestion": "3.32.1",
|
|
160
|
+
"@xyflow/react": "^12.12.0",
|
|
161
|
+
"bwip-js": "^4.11.3",
|
|
162
|
+
"class-variance-authority": "^0.7.1",
|
|
163
|
+
"clsx": "^2.1.1",
|
|
164
|
+
"recharts": "^3.10.1",
|
|
165
|
+
"tailwind-merge": "^3.7.0"
|
|
166
|
+
},
|
|
167
|
+
"devDependencies": {
|
|
168
|
+
"@storybook/addon-docs": "^10.6.5",
|
|
169
|
+
"@storybook/react-vite": "^10.4.6",
|
|
170
|
+
"@tabler/icons-react": "^3.50.0",
|
|
171
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
172
|
+
"@types/katex": "^0.16.8",
|
|
173
|
+
"@types/node": "^26.6.5",
|
|
174
|
+
"@types/react": "^19.3.0",
|
|
175
|
+
"@types/react-dom": "^19.3.0",
|
|
176
|
+
"katex": "^0.19.1",
|
|
177
|
+
"radix-ui": "^1.8.1",
|
|
178
|
+
"react": "19.3.1",
|
|
179
|
+
"react-dom": "19.3.1",
|
|
180
|
+
"react-hook-form": "^7.91.0",
|
|
181
|
+
"shadcn": "^4.23.0",
|
|
182
|
+
"storybook": "^10.4.6",
|
|
183
|
+
"tailwindcss": "^4",
|
|
184
|
+
"tw-animate-css": "^1.4.0",
|
|
185
|
+
"typescript": "^5",
|
|
186
|
+
"vite": "^8.3.5"
|
|
187
|
+
},
|
|
188
|
+
"publishConfig": {
|
|
189
|
+
"access": "public",
|
|
190
|
+
"registry": "https://registry.npmjs.org"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import { IconArrowLeft, IconBuilding, IconHome, IconRefresh, IconSettings, IconUsers } from "@tabler/icons-react"
|
|
4
|
+
|
|
5
|
+
import { AccessDenied, type SearchResultItem } from "./access-denied"
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Primitives/AccessDenied",
|
|
9
|
+
component: AccessDenied,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
parameters: { layout: "padded" },
|
|
12
|
+
argTypes: {
|
|
13
|
+
variant: {
|
|
14
|
+
control: "select",
|
|
15
|
+
options: ["forbidden", "unauthorized", "not-found", "error", "success", "maintenance"],
|
|
16
|
+
},
|
|
17
|
+
showSearch: { control: "boolean" },
|
|
18
|
+
},
|
|
19
|
+
} satisfies Meta<typeof AccessDenied>
|
|
20
|
+
|
|
21
|
+
export default meta
|
|
22
|
+
type Story = StoryObj<typeof meta>
|
|
23
|
+
|
|
24
|
+
const SAMPLE_RESULTS: SearchResultItem[] = [
|
|
25
|
+
{
|
|
26
|
+
id: "1",
|
|
27
|
+
title: "Organization Unit Settings",
|
|
28
|
+
description: "Manage OU hierarchy, permissions, and tenant scope.",
|
|
29
|
+
href: "/settings/ou",
|
|
30
|
+
category: "Settings",
|
|
31
|
+
icon: <IconBuilding />,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "2",
|
|
35
|
+
title: "User Management & Governance",
|
|
36
|
+
description: "Invite users, assign roles, and review approval requests.",
|
|
37
|
+
href: "/admin/users",
|
|
38
|
+
category: "Admin",
|
|
39
|
+
icon: <IconUsers />,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "3",
|
|
43
|
+
title: "General Preferences",
|
|
44
|
+
description: "Configure workspace theme, default language, and branding.",
|
|
45
|
+
href: "/settings/general",
|
|
46
|
+
category: "Preferences",
|
|
47
|
+
icon: <IconSettings />,
|
|
48
|
+
},
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
export const NotFoundWithSiteSearch: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
variant: "not-found",
|
|
54
|
+
title: "Page Not Found",
|
|
55
|
+
description: "The page or resource you requested could not be found. Try searching our site or head back to the dashboard.",
|
|
56
|
+
showSearch: true,
|
|
57
|
+
searchPlaceholder: "Search documentation, resources, or settings...",
|
|
58
|
+
onSearch: (query) => alert(`Searching for: ${query}`),
|
|
59
|
+
primaryAction: {
|
|
60
|
+
label: "Back to Home",
|
|
61
|
+
icon: <IconHome />,
|
|
62
|
+
href: "/",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const NotFoundWithSearchResults: Story = {
|
|
68
|
+
args: {
|
|
69
|
+
variant: "not-found",
|
|
70
|
+
title: "Page Not Found",
|
|
71
|
+
description: "The page you requested could not be found. Here are relevant resources matching your site search:",
|
|
72
|
+
showSearch: true,
|
|
73
|
+
searchResults: SAMPLE_RESULTS,
|
|
74
|
+
primaryAction: {
|
|
75
|
+
label: "Back to Home",
|
|
76
|
+
icon: <IconHome />,
|
|
77
|
+
href: "/",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const NotFoundInteractiveSearch: Story = {
|
|
83
|
+
args: {
|
|
84
|
+
variant: "not-found",
|
|
85
|
+
title: "Page Not Found",
|
|
86
|
+
description: "Try searching for settings, users, or general options:",
|
|
87
|
+
showSearch: true,
|
|
88
|
+
searchPlaceholder: "Type 'users' or 'settings'...",
|
|
89
|
+
primaryAction: {
|
|
90
|
+
label: "Back to Home",
|
|
91
|
+
icon: <IconHome />,
|
|
92
|
+
href: "/",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
render: (args) => {
|
|
96
|
+
const [query, setQuery] = React.useState("")
|
|
97
|
+
const filtered = query.trim()
|
|
98
|
+
? SAMPLE_RESULTS.filter(
|
|
99
|
+
(item) =>
|
|
100
|
+
item.title.toLowerCase().includes(query.toLowerCase()) ||
|
|
101
|
+
item.description?.toLowerCase().includes(query.toLowerCase())
|
|
102
|
+
)
|
|
103
|
+
: []
|
|
104
|
+
|
|
105
|
+
return <AccessDenied {...args} onSearch={setQuery} searchResults={filtered} />
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const ForbiddenWithActions: Story = {
|
|
110
|
+
args: {
|
|
111
|
+
variant: "forbidden",
|
|
112
|
+
description: (
|
|
113
|
+
<>
|
|
114
|
+
You do not have the required permission (<code>settings:read</code>) to view
|
|
115
|
+
System Settings. Contact your tenant administrator to request access.
|
|
116
|
+
</>
|
|
117
|
+
),
|
|
118
|
+
primaryAction: {
|
|
119
|
+
label: "Go to Dashboard",
|
|
120
|
+
icon: <IconHome />,
|
|
121
|
+
href: "/",
|
|
122
|
+
},
|
|
123
|
+
secondaryAction: {
|
|
124
|
+
label: "Go Back",
|
|
125
|
+
icon: <IconArrowLeft />,
|
|
126
|
+
onClick: () => window.history.back(),
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export const Unauthorized: Story = {
|
|
132
|
+
args: {
|
|
133
|
+
variant: "unauthorized",
|
|
134
|
+
title: "Session Expired",
|
|
135
|
+
description: "Your session has timed out. Please sign in again to continue accessing this workspace.",
|
|
136
|
+
primaryAction: {
|
|
137
|
+
label: "Sign In Again",
|
|
138
|
+
href: "/login",
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export const SystemError: Story = {
|
|
144
|
+
args: {
|
|
145
|
+
variant: "error",
|
|
146
|
+
title: "Internal Server Error",
|
|
147
|
+
description: "Something went wrong on our end while processing your request. Please try refreshing the page.",
|
|
148
|
+
primaryAction: {
|
|
149
|
+
label: "Refresh Page",
|
|
150
|
+
icon: <IconRefresh />,
|
|
151
|
+
onClick: () => window.location.reload(),
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export const SuccessState: Story = {
|
|
157
|
+
args: {
|
|
158
|
+
variant: "success",
|
|
159
|
+
title: "Setup Completed",
|
|
160
|
+
description: "Your workspace and tenant governance settings have been initialized successfully.",
|
|
161
|
+
primaryAction: {
|
|
162
|
+
label: "View Dashboard",
|
|
163
|
+
icon: <IconHome />,
|
|
164
|
+
href: "/",
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export const MaintenanceState: Story = {
|
|
170
|
+
args: {
|
|
171
|
+
variant: "maintenance",
|
|
172
|
+
title: "Scheduled Maintenance",
|
|
173
|
+
description: "This service is currently undergoing scheduled platform upgrades. We will be back online shortly.",
|
|
174
|
+
primaryAction: {
|
|
175
|
+
label: "Check Status",
|
|
176
|
+
onClick: () => {},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
}
|