@auldrant/ui 0.8.1 → 0.10.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.
@@ -0,0 +1,26 @@
1
+ import { IDialogAction } from './DialogBase';
2
+ import { IBaseProps } from '../scripts/types';
3
+ import { ComponentChildren, FunctionComponent } from 'preact';
4
+ /** Props for {@link Dialog}. */
5
+ interface IDialogProps extends IBaseProps {
6
+ /** Whether the dialog is open. */
7
+ open: boolean;
8
+ /** Dialog heading text. Rendered as h2, linked via aria-labelledby. */
9
+ title: string;
10
+ /** Called when the dialog is dismissed (Escape, backdrop click, or X button). */
11
+ onClose: () => void;
12
+ /** Simple text content. Rendered as a paragraph. */
13
+ message?: string;
14
+ /** Primary action button. Auto-focused on open. */
15
+ defaultAction?: IDialogAction;
16
+ /** Additional action buttons. */
17
+ actions?: IDialogAction[];
18
+ /** Rich body content. Renders below message if both provided. */
19
+ children?: ComponentChildren;
20
+ }
21
+ /**
22
+ * Dismissible dialog using native `<dialog>`.
23
+ * Escape, backdrop click, and X button all call `onClose`.
24
+ */
25
+ declare const Dialog: FunctionComponent<IDialogProps>;
26
+ export default Dialog;
@@ -0,0 +1,45 @@
1
+ import { IBaseProps } from '../scripts/types';
2
+ import { ComponentChildren, FunctionComponent } from 'preact';
3
+ /** Action button metadata. All fields required to enforce a11y-complete definitions. */
4
+ export interface IDialogAction {
5
+ /** Button label text. */
6
+ label: string;
7
+ /** Accessible description. Rendered as native `title` tooltip. */
8
+ description: string;
9
+ /** Click handler. */
10
+ onClick: () => void;
11
+ /** Keyboard shortcut string. Single key ('d') or combo ('Shift+D', 'Ctrl+Enter').
12
+ * Parsed internally and wired to a keydown listener while the dialog is open.
13
+ * Displayed visually on the button as a hint. */
14
+ shortcut: string;
15
+ }
16
+ /** Props for {@link DialogBase}. */
17
+ interface IDialogBaseProps extends IBaseProps {
18
+ /** Whether the dialog is open. */
19
+ open: boolean;
20
+ /** Dialog heading text. Rendered as h2, linked via aria-labelledby. */
21
+ title: string;
22
+ /** Whether this is an alert dialog (role="alertdialog"). */
23
+ alert?: boolean;
24
+ /** Called when the dialog is dismissed via Escape. */
25
+ onDismiss: () => void;
26
+ /** Called when the backdrop is clicked. Only Dialog wires this. */
27
+ onBackdropClick?: (() => void) | undefined;
28
+ /** Simple text content. Rendered as a paragraph. */
29
+ message?: string | undefined;
30
+ /** Primary action button. Auto-focused on open (unless focusCancel). */
31
+ defaultAction?: IDialogAction | undefined;
32
+ /** Additional action buttons. */
33
+ actions?: IDialogAction[] | undefined;
34
+ /** Cancel button label. Only used when onCancel is provided. */
35
+ cancelLabel?: string | undefined;
36
+ /** Cancel handler. When provided, renders a Cancel button. */
37
+ onCancel?: (() => void) | undefined;
38
+ /** Focus the Cancel button on open instead of defaultAction. */
39
+ focusCancel?: boolean | undefined;
40
+ /** Rich body content. Renders below message if both provided. */
41
+ children?: ComponentChildren;
42
+ }
43
+ /** Shared dialog/modal base. Not exported from the library. */
44
+ declare const DialogBase: FunctionComponent<IDialogBaseProps>;
45
+ export default DialogBase;
@@ -0,0 +1,31 @@
1
+ import { IDialogAction } from './DialogBase';
2
+ import { IBaseProps } from '../scripts/types';
3
+ import { ComponentChildren, FunctionComponent } from 'preact';
4
+ /** Props for {@link Modal}. */
5
+ interface IModalProps extends IBaseProps {
6
+ /** Whether the modal is open. */
7
+ open: boolean;
8
+ /** Modal heading text. Rendered as h2, linked via aria-labelledby. */
9
+ title: string;
10
+ /** Called when the user cancels (Escape key or Cancel button). */
11
+ onCancel: () => void;
12
+ /** Cancel button label. Defaults to "Cancel". */
13
+ cancelLabel?: string;
14
+ /** Simple text content. Rendered as a paragraph. */
15
+ message?: string;
16
+ /** Primary action button (required). Auto-focused on open (unless focusCancel). */
17
+ defaultAction: IDialogAction;
18
+ /** Additional action buttons beyond the default. */
19
+ actions?: IDialogAction[];
20
+ /** Focus the Cancel button on open instead of defaultAction.
21
+ * Use for destructive/dangerous actions to prevent accidental confirmation. */
22
+ focusCancel?: boolean;
23
+ /** Rich body content. Renders below message if both provided. */
24
+ children?: ComponentChildren;
25
+ }
26
+ /**
27
+ * Action-required modal using native `<dialog>` with `role="alertdialog"`.
28
+ * Escape maps to Cancel. Backdrop does not dismiss.
29
+ */
30
+ declare const Modal: FunctionComponent<IModalProps>;
31
+ export default Modal;
@@ -8,6 +8,14 @@ interface ITableProps extends IBaseProps {
8
8
  headers: string[];
9
9
  /** Row data as a 2D array of renderable content. */
10
10
  data: ComponentChildren[][];
11
+ /** Render the first column as `<th scope="row">` for row identification. */
12
+ rowHeader?: boolean;
13
+ /** Apply alternating row backgrounds for improved scanability. */
14
+ striped?: boolean;
15
+ /** Reduce cell padding for data-dense displays. */
16
+ dense?: boolean;
17
+ /** Visually hide the caption while keeping it accessible to screen readers. */
18
+ captionHidden?: boolean;
11
19
  }
12
20
  /**
13
21
  * Accessible data table with required headers.
@@ -1,5 +1,14 @@
1
1
  import { IBaseProps } from '../scripts/types';
2
2
  import { ComponentChildren, FunctionComponent } from 'preact';
3
+ /** Preset palette class names for `<Theme class={Palette.blue}>`. */
4
+ export declare const Palette: {
5
+ readonly blue: "aui-blue";
6
+ readonly purple: "aui-purple";
7
+ readonly teal: "aui-teal";
8
+ readonly red: "aui-red";
9
+ readonly orange: "aui-orange";
10
+ readonly yellow: "aui-yellow";
11
+ };
3
12
  /** Props for {@link Theme}. */
4
13
  interface IThemeProps extends IBaseProps {
5
14
  /** Content to theme. */
package/dist/index.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  export { default as Button } from './components/Button';
2
2
  export { default as Card } from './components/Card';
3
3
  export { default as Checkbox } from './components/Checkbox';
4
+ export { default as Dialog } from './components/Dialog';
5
+ export type { IDialogAction } from './components/DialogBase';
4
6
  export { default as DownloadLink } from './components/DownloadLink';
5
7
  export { default as Form } from './components/Form';
6
8
  export { default as Input } from './components/Input';
7
9
  export { default as Link } from './components/Link';
10
+ export { default as Modal } from './components/Modal';
8
11
  export { default as Nav } from './components/Nav';
9
12
  export { default as NumberInput } from './components/NumberInput';
10
13
  export { default as PasswordInput } from './components/PasswordInput';
@@ -17,7 +20,7 @@ export { default as Select } from './components/Select';
17
20
  export { default as SkipLink } from './components/SkipLink';
18
21
  export { default as Table } from './components/Table';
19
22
  export { default as Textarea } from './components/Textarea';
20
- export { default as Theme } from './components/Theme';
23
+ export { default as Theme, Palette } from './components/Theme';
21
24
  export { default as VisuallyHidden } from './components/VisuallyHidden';
22
25
  export { cx } from './scripts/utils';
23
26
  export { title } from './signals/head';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auldrant/ui",
3
- "version": "0.8.1",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "Accessible Preact component library with design tokens and CSS modules",
6
6
  "author": "Colonel Jade",
@@ -53,6 +53,8 @@
53
53
  "test": "bun test",
54
54
  "test:a11y": "bun test tests/a11y/",
55
55
  "test:watch": "bun test --watch",
56
+ "licenses": "bun run scripts/check-licenses.ts",
57
+ "licenses:fix": "bun run scripts/check-licenses.ts --fix",
56
58
  "typecheck": "tsc --noEmit",
57
59
  "prepublishOnly": "bun run build",
58
60
  "dev": "vite --host",
@@ -82,6 +84,6 @@
82
84
  "preact": "^10.28.4"
83
85
  },
84
86
  "dependencies": {
85
- "lucide-preact": "^0.575.0"
87
+ "lucide-preact": "^0.577.0"
86
88
  }
87
89
  }