@dads-framework/ui 0.1.0 → 0.2.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 +36 -6
- package/dist/display/components/ui/permission-decision-table.d.ts +17 -0
- package/dist/display/components/ui/permission-decision-table.d.ts.map +1 -0
- package/dist/display/components/ui/permission-decision-table.js +8 -0
- package/dist/display/components/ui/permission-decision-table.js.map +1 -0
- package/dist/display/index.d.ts +1 -0
- package/dist/display/index.d.ts.map +1 -1
- package/dist/display/index.js +1 -0
- package/dist/display/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,30 +4,57 @@ React controls, data tables, and application layouts with a neutral default them
|
|
|
4
4
|
|
|
5
5
|
## Try it
|
|
6
6
|
|
|
7
|
-
Install
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
Install the components and default theme in a React 19 TypeScript app with
|
|
8
|
+
Tailwind CSS 4 configured.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @dads-framework/ui @dads-framework/styles react@^19 react-dom@^19
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Set your Tailwind CSS entry point to the following. This example assumes the
|
|
15
|
+
stylesheet lives in `src/`. Resolve the source path from your stylesheet to
|
|
16
|
+
the location of the installed UI package.
|
|
10
17
|
|
|
11
18
|
```css
|
|
12
19
|
@import "@dads-framework/styles/index.css";
|
|
13
20
|
@source "../node_modules/@dads-framework/ui/dist";
|
|
14
21
|
```
|
|
15
22
|
|
|
23
|
+
Render `<StockCounter />` on a page that loads that stylesheet.
|
|
24
|
+
|
|
25
|
+
<!-- dads:check-example -->
|
|
26
|
+
|
|
16
27
|
```tsx
|
|
28
|
+
import { useState } from "react";
|
|
17
29
|
import { Button } from "@dads-framework/ui/elements";
|
|
18
30
|
|
|
19
|
-
export function
|
|
20
|
-
|
|
31
|
+
export function StockCounter() {
|
|
32
|
+
const [units, setUnits] = useState(0);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<>
|
|
36
|
+
<Button type="button" onClick={() => setUnits((count) => count + 1)}>
|
|
37
|
+
Add unit
|
|
38
|
+
</Button>
|
|
39
|
+
<p role="status">Units in stock: {units}</p>
|
|
40
|
+
</>
|
|
41
|
+
);
|
|
21
42
|
}
|
|
22
43
|
```
|
|
23
44
|
|
|
45
|
+
The page shows a themed **Add unit** button and a count of zero. Press Tab
|
|
46
|
+
to focus the button, then Enter to increment the count.
|
|
47
|
+
|
|
48
|
+
The [starter's note forms](../../../apps/kit-workbench/apps/web/note-forms.tsx)
|
|
49
|
+
use the shared `Button` and disable form submission while a request is pending.
|
|
50
|
+
|
|
24
51
|
## Use it
|
|
25
52
|
|
|
26
53
|
| Import path | Includes |
|
|
27
54
|
| --------------------------------------- | --------------------------------------------------------- |
|
|
28
55
|
| `@dads-framework/ui/elements` | Buttons, badges, calendar, and class name utilities |
|
|
29
56
|
| `@dads-framework/ui/forms` | Inputs, fields, switches, checkbox, and combobox |
|
|
30
|
-
| `@dads-framework/ui/display` |
|
|
57
|
+
| `@dads-framework/ui/display` | Alerts, empty states, tables, and permission decisions |
|
|
31
58
|
| `@dads-framework/ui/overlays` | Dialogs, menus, sheets, tooltips, and attachment previews |
|
|
32
59
|
| `@dads-framework/ui/data-table` | Responsive data table, toolbar, filters, and sorting |
|
|
33
60
|
| `@dads-framework/ui/data-table/routing` | Table search schemas and helpers for route files |
|
|
@@ -46,6 +73,9 @@ property types.
|
|
|
46
73
|
destination as `href` and the list search values separately as `search`.
|
|
47
74
|
- Pass a stable `tableId` to `useDataTable` to remember visible columns on the
|
|
48
75
|
device. Without an ID, column preferences last for the current visit.
|
|
76
|
+
- `PermissionDecisionTable` renders permission labels and decisions supplied by
|
|
77
|
+
the host. Provide a stable ID for each decision and localized column and
|
|
78
|
+
status labels. The host obtains decisions through its authorized API.
|
|
49
79
|
- `AttachmentViewer` accepts a URL or Blob from the caller's `loadSource`.
|
|
50
80
|
For PDFs, serve the PDF.js WASM decoders at `/pdfjs/wasm/`. The caller owns
|
|
51
81
|
the download handler.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type PermissionDecision = {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly label: string;
|
|
4
|
+
readonly allowed: boolean;
|
|
5
|
+
};
|
|
6
|
+
type PermissionDecisionTableProps = {
|
|
7
|
+
readonly caption: string;
|
|
8
|
+
readonly permissionHeading: string;
|
|
9
|
+
readonly decisionHeading: string;
|
|
10
|
+
readonly allowedLabel: string;
|
|
11
|
+
readonly deniedLabel: string;
|
|
12
|
+
readonly decisions: readonly PermissionDecision[];
|
|
13
|
+
};
|
|
14
|
+
/** Display authorization results supplied by the application. */
|
|
15
|
+
export declare function PermissionDecisionTable({ caption, permissionHeading, decisionHeading, allowedLabel, deniedLabel, decisions, }: PermissionDecisionTableProps): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=permission-decision-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-decision-table.d.ts","sourceRoot":"","sources":["../../../../src/display/components/ui/permission-decision-table.tsx"],"names":[],"mappings":"AAUA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,KAAK,4BAA4B,GAAG;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACnD,CAAC;AAEF,iEAAiE;AACjE,wBAAgB,uBAAuB,CAAC,EACtC,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,WAAW,EACX,SAAS,GACV,EAAE,4BAA4B,+BA0B9B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from "../../../elements/index.js";
|
|
3
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "./table.js";
|
|
4
|
+
/** Display authorization results supplied by the application. */
|
|
5
|
+
export function PermissionDecisionTable({ caption, permissionHeading, decisionHeading, allowedLabel, deniedLabel, decisions, }) {
|
|
6
|
+
return (_jsxs(Table, { children: [_jsx("caption", { className: "sr-only", children: caption }), _jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { scope: "col", children: permissionHeading }), _jsx(TableHead, { scope: "col", children: decisionHeading })] }) }), _jsx(TableBody, { children: decisions.map(({ id, label, allowed }) => (_jsxs(TableRow, { children: [_jsx("th", { scope: "row", className: "px-2 py-2 text-start font-medium", children: label }), _jsx(TableCell, { children: _jsx(Badge, { variant: allowed ? "secondary" : "outline", children: allowed ? allowedLabel : deniedLabel }) })] }, id))) })] }));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=permission-decision-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-decision-table.js","sourceRoot":"","sources":["../../../../src/display/components/ui/permission-decision-table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EACL,KAAK,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,GACT,MAAM,YAAY,CAAC;AAiBpB,iEAAiE;AACjE,MAAM,UAAU,uBAAuB,CAAC,EACtC,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,WAAW,EACX,SAAS,GACoB;IAC7B,OAAO,CACL,MAAC,KAAK,eACJ,kBAAS,SAAS,EAAC,SAAS,YAAE,OAAO,GAAW,EAChD,KAAC,WAAW,cACV,MAAC,QAAQ,eACP,KAAC,SAAS,IAAC,KAAK,EAAC,KAAK,YAAE,iBAAiB,GAAa,EACtD,KAAC,SAAS,IAAC,KAAK,EAAC,KAAK,YAAE,eAAe,GAAa,IAC3C,GACC,EACd,KAAC,SAAS,cACP,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CACzC,MAAC,QAAQ,eACP,aAAI,KAAK,EAAC,KAAK,EAAC,SAAS,EAAC,kCAAkC,YACzD,KAAK,GACH,EACL,KAAC,SAAS,cACR,KAAC,KAAK,IAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,YAC9C,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,GAC/B,GACE,KARC,EAAE,CASN,CACZ,CAAC,GACQ,IACN,CACT,CAAC;AACJ,CAAC"}
|
package/dist/display/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export * from "./components/ui/status-badge.js";
|
|
|
6
6
|
export * from "./components/ui/table.js";
|
|
7
7
|
export * from "./components/ui/tabs.js";
|
|
8
8
|
export * from "./components/ui/tone-bar.js";
|
|
9
|
+
export * from "./components/ui/permission-decision-table.js";
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/display/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/display/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8CAA8C,CAAC"}
|
package/dist/display/index.js
CHANGED
|
@@ -6,4 +6,5 @@ export * from "./components/ui/status-badge.js";
|
|
|
6
6
|
export * from "./components/ui/table.js";
|
|
7
7
|
export * from "./components/ui/tabs.js";
|
|
8
8
|
export * from "./components/ui/tone-bar.js";
|
|
9
|
+
export * from "./components/ui/permission-decision-table.js";
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/display/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/display/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8CAA8C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dads-framework/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
],
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@base-ui/react": "^1.6.0",
|
|
63
|
-
"@dads-framework/copy": "0.
|
|
63
|
+
"@dads-framework/copy": "0.2.0",
|
|
64
64
|
"@daypicker/react": "^10.0.1",
|
|
65
65
|
"@dnd-kit/core": "^6.3.1",
|
|
66
66
|
"@dnd-kit/modifiers": "^9.0.0",
|