@appdirect/design-system 0.0.3 → 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';
@@ -0,0 +1,60 @@
1
+ 'use client';
2
+
3
+ import React from 'react';
4
+ import { InputWrapper } from '@mantine/core';
5
+ import { Slider, DSSliderProps } from './Slider';
6
+
7
+ export interface SliderWithLabelProps extends DSSliderProps {
8
+ /** Field label shown above the slider (not Mantine's thumb-value tooltip — see Slider's own `label` prop for that) */
9
+ fieldLabel?: string;
10
+ /** Whether the field is required (shows asterisk) */
11
+ required?: boolean;
12
+ /** Description text displayed below the label */
13
+ description?: string;
14
+ /** Error message displayed below the slider */
15
+ error?: React.ReactNode;
16
+ }
17
+
18
+ /**
19
+ * SliderWithLabel Component
20
+ *
21
+ * A Slider with a static field label above it (e.g. "Volume *"), matching
22
+ * the label treatment used by TextInput/NumberInput/etc. Uses Mantine's
23
+ * own Input.Wrapper so the label/required/error styling is identical to
24
+ * every other labeled input in the DS — not a bespoke label implementation.
25
+ *
26
+ * Not to be confused with Slider's own `label` prop, which is Mantine's
27
+ * floating value tooltip shown above the thumb while dragging — a
28
+ * different concept from this component's static field label.
29
+ *
30
+ * @example
31
+ * <SliderWithLabel fieldLabel="Volume" required defaultValue={40} />
32
+ *
33
+ * @example
34
+ * <SliderWithLabel
35
+ * fieldLabel="Price Range"
36
+ * description="Set your budget"
37
+ * min={0}
38
+ * max={1000}
39
+ * defaultValue={[200, 800]}
40
+ * />
41
+ */
42
+ export function SliderWithLabel({
43
+ fieldLabel,
44
+ required,
45
+ description,
46
+ error,
47
+ ...sliderProps
48
+ }: SliderWithLabelProps) {
49
+ return (
50
+ <InputWrapper
51
+ label={fieldLabel}
52
+ description={description}
53
+ error={error}
54
+ required={required}
55
+ withAsterisk={required}
56
+ >
57
+ <Slider {...sliderProps} />
58
+ </InputWrapper>
59
+ );
60
+ }
@@ -19,6 +19,9 @@ export type { DSColorInputProps } from './ColorInput';
19
19
  export { Slider } from './Slider';
20
20
  export type { DSSliderProps } from './Slider';
21
21
 
22
+ export { SliderWithLabel } from './SliderWithLabel';
23
+ export type { SliderWithLabelProps } from './SliderWithLabel';
24
+
22
25
  export { Switch } from './Switch';
23
26
  export type { DSSwitchProps } from './Switch';
24
27
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.3",
2
+ "version": "0.0.5",
3
3
  "contracts": [
4
4
  {
5
5
  "id": "Alert",
package/dist/index.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  // Import components for category exports
18
- import { TextInput, TextArea, NumberInput, ColorInput, Slider, Switch, SegmentedControl, Checkbox, Radio, RadioGroup, DropZone, FileInput } from './Inputs';
18
+ import { TextInput, TextArea, NumberInput, ColorInput, Slider, SliderWithLabel, Switch, SegmentedControl, Checkbox, Radio, RadioGroup, DropZone, FileInput } from './Inputs';
19
19
  import { Button, ActionIcon, CloseButton } from './Buttons';
20
20
  import { Alert, Avatar, Badge, Card, CardSection, Chip, Pill, Indicator, Progress, ThemeIcon, List, Table } from './DataDisplay';
21
21
  import { SearchableSelect, AutocompleteClearable, Multiselect, Select, Combobox } from './Combobox';
@@ -31,10 +31,11 @@ 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
- export { TextInput, TextArea, NumberInput, ColorInput, Slider, Switch, SegmentedControl, Checkbox, Radio, RadioGroup, DropZone, FileInput } from './Inputs';
37
- export type { DSTextInputProps, DSTextAreaProps, DSNumberInputProps, DSColorInputProps, DSSliderProps, DSSwitchProps, DSSegmentedControlProps, DSCheckboxProps, DSRadioProps, DSRadioGroupProps, DropZoneProps, DSFileInputProps } from './Inputs';
37
+ export { TextInput, TextArea, NumberInput, ColorInput, Slider, SliderWithLabel, Switch, SegmentedControl, Checkbox, Radio, RadioGroup, DropZone, FileInput } from './Inputs';
38
+ export type { DSTextInputProps, DSTextAreaProps, DSNumberInputProps, DSColorInputProps, DSSliderProps, SliderWithLabelProps, DSSwitchProps, DSSegmentedControlProps, DSCheckboxProps, DSRadioProps, DSRadioGroupProps, DropZoneProps, DSFileInputProps } from './Inputs';
38
39
 
39
40
  // ========================== BUTTONS ==========================
40
41
  export { Button, ActionIcon, CloseButton } from './Buttons';
@@ -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
@@ -106,6 +109,7 @@ export const Inputs = {
106
109
  NumberInput,
107
110
  ColorInput,
108
111
  Slider,
112
+ SliderWithLabel,
109
113
  Switch,
110
114
  SegmentedControl,
111
115
  Checkbox,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appdirect/design-system",
3
- "version": "0.0.3",
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.3",
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",