@appdirect/design-system 0.0.4 → 0.0.5

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,113 @@
1
+ 'use client';
2
+
3
+ import React from 'react';
4
+ import { ThemeIcon } from '../../DataDisplay/ThemeIcon';
5
+ import { Title } from '../../Typography/Title';
6
+ import { Text } from '../../Typography/Text';
7
+ import { Button } from '../../Buttons/Button';
8
+ import { Stack } from '../../Layout/Stack';
9
+ import { Inline } from '../../Layout/Inline';
10
+
11
+ export type PlaceholderSize = 'sm' | 'md' | 'lg';
12
+
13
+ export interface PlaceholderAction {
14
+ /** Button label */
15
+ label: string;
16
+ /** Click handler */
17
+ onClick: () => void;
18
+ }
19
+
20
+ export interface PlaceholderProps {
21
+ /** Icon shown above the title — the designer can assign any icon; this component just renders whichever one is given */
22
+ icon?: React.ReactNode;
23
+ /** Title text */
24
+ title: string;
25
+ /** Optional description text below the title */
26
+ description?: string;
27
+ /** Up to two link-style action buttons */
28
+ actions?: PlaceholderAction[];
29
+ /** Size of the placeholder — controls title/description typography and action button size */
30
+ size?: PlaceholderSize;
31
+ }
32
+
33
+ const titleOrderBySize: Record<PlaceholderSize, 3 | 4 | 5> = {
34
+ sm: 5, // h5, 16px
35
+ md: 4, // h4, 18px
36
+ lg: 3, // h3, 22px
37
+ };
38
+
39
+ const descriptionSizeBySize: Record<PlaceholderSize, 'sm' | 'md' | 'lg'> = {
40
+ sm: 'sm',
41
+ md: 'md',
42
+ lg: 'lg',
43
+ };
44
+
45
+ const actionSizeBySize: Record<PlaceholderSize, 'xs' | 'sm' | 'md'> = {
46
+ sm: 'xs',
47
+ md: 'sm',
48
+ lg: 'md',
49
+ };
50
+
51
+ /**
52
+ * Placeholder Component
53
+ *
54
+ * An empty-state message: icon, title, optional description, and up to two
55
+ * link-style actions. All typography reuses the existing heading/body scale
56
+ * directly (headings h3/h4/h5, Text sm/md/lg) — no new tokens needed. The
57
+ * icon is a fixed ThemeIcon size (lg, 34px) regardless of the placeholder's
58
+ * own size, matching the live Figma design.
59
+ *
60
+ * @example
61
+ * <Placeholder
62
+ * icon={<RiErrorWarningLine size={24} />}
63
+ * title="This is the Title"
64
+ * description="This is the optional description of the placeholder"
65
+ * actions={[
66
+ * { label: 'Button One', onClick: () => {} },
67
+ * { label: 'Button Two', onClick: () => {} },
68
+ * ]}
69
+ * />
70
+ *
71
+ * @example
72
+ * // Large size, no description or actions
73
+ * <Placeholder icon={<RiInboxLine size={24} />} title="No results found" size="lg" />
74
+ */
75
+ export function Placeholder({
76
+ icon,
77
+ title,
78
+ description,
79
+ actions = [],
80
+ size = 'sm',
81
+ }: PlaceholderProps) {
82
+ return (
83
+ <Stack align="center" gap="md" p="xl">
84
+ {icon && (
85
+ <ThemeIcon variant="default" size="lg">
86
+ {icon}
87
+ </ThemeIcon>
88
+ )}
89
+ <Stack align="center" gap={0} ta="center">
90
+ <Title order={titleOrderBySize[size]}>{title}</Title>
91
+ {description && (
92
+ <Text size={descriptionSizeBySize[size]} c="dimmed">
93
+ {description}
94
+ </Text>
95
+ )}
96
+ </Stack>
97
+ {actions.length > 0 && (
98
+ <Inline gap="xs" justify="center">
99
+ {actions.map((action, index) => (
100
+ <Button
101
+ key={index}
102
+ variant="link"
103
+ size={actionSizeBySize[size]}
104
+ onClick={action.onClick}
105
+ >
106
+ {action.label}
107
+ </Button>
108
+ ))}
109
+ </Inline>
110
+ )}
111
+ </Stack>
112
+ );
113
+ }
@@ -0,0 +1,2 @@
1
+ export { Placeholder } from './Placeholder';
2
+ export type { PlaceholderProps, PlaceholderAction, PlaceholderSize } from './Placeholder';
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.4",
2
+ "version": "0.0.5",
3
3
  "contracts": [
4
4
  {
5
5
  "id": "Alert",
package/dist/index.ts CHANGED
@@ -31,6 +31,7 @@ import { CopyButton } from './ComplexComponents/Utilities';
31
31
  import { PageContentHeader, DescriptionBlock } from './ComplexComponents/PageContentHeader';
32
32
  import { DataTable } from './ComplexComponents/DataTable';
33
33
  import { DashboardWidget } from './ComplexComponents/DashboardWidget';
34
+ import { Placeholder } from './ComplexComponents/Placeholder';
34
35
 
35
36
  // ========================== INPUTS ==========================
36
37
  export { TextInput, TextArea, NumberInput, ColorInput, Slider, SliderWithLabel, Switch, SegmentedControl, Checkbox, Radio, RadioGroup, DropZone, FileInput } from './Inputs';
@@ -97,6 +98,8 @@ export { DataTable } from './ComplexComponents/DataTable';
97
98
  export type { DataTableProps, DataTableColumn, PageInfo } from './ComplexComponents/DataTable';
98
99
  export { DashboardWidget } from './ComplexComponents/DashboardWidget';
99
100
  export type { DashboardWidgetProps, DashboardWidgetLink } from './ComplexComponents/DashboardWidget';
101
+ export { Placeholder } from './ComplexComponents/Placeholder';
102
+ export type { PlaceholderProps, PlaceholderAction, PlaceholderSize } from './ComplexComponents/Placeholder';
100
103
 
101
104
  // ========================== CATEGORY EXPORTS ==========================
102
105
  // Export components grouped by category for convenient importing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appdirect/design-system",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "AppDirect Design System components. Wraps Mantine v9 with standardized props, variants, and tokens.",
5
5
  "main": "./dist/index.ts",
6
6
  "types": "./dist/index.ts",
@@ -37,7 +37,7 @@
37
37
  "prepublishOnly": "npm run build"
38
38
  },
39
39
  "dependencies": {
40
- "@appdirect/ad-design-tokens": "0.0.4",
40
+ "@appdirect/ad-design-tokens": "0.0.5",
41
41
  "@mantine/dropzone": "^9.6.0",
42
42
  "@remixicon/react": "^4.6.0",
43
43
  "@tabler/icons-react": "^3.33.0",