@appdirect/design-system 0.0.14 → 0.0.15
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/dist/ComplexComponents/StatusGem/StatusGem.js +31 -0
- package/dist/ComplexComponents/StatusGem/StatusGem.tsx +58 -0
- package/dist/ComplexComponents/StatusGem/index.js +1 -0
- package/dist/ComplexComponents/StatusGem/index.ts +2 -0
- package/dist/contracts/index.json +1 -1
- package/dist/index.js +3 -0
- package/dist/index.ts +4 -0
- package/dist/stories/ComplexComponents/StatusGem/StatusGem.stories.tsx +59 -0
- package/dist/stories/index.json +17 -1
- package/package.json +2 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Indicator } from '../../DataDisplay/Indicator.js';
|
|
5
|
+
import { Inline } from '../../Layout/index.js';
|
|
6
|
+
import { Text } from '../../Typography/Text.js';
|
|
7
|
+
// Indicator dot size per step, matching Indicator's own Code Connect mapping (indicator.figma.tsx)
|
|
8
|
+
const DOT_SIZE_BY_SIZE = {
|
|
9
|
+
xs: 8,
|
|
10
|
+
sm: 12,
|
|
11
|
+
md: 16,
|
|
12
|
+
lg: 20,
|
|
13
|
+
xl: 24,
|
|
14
|
+
};
|
|
15
|
+
// ========================== COMPONENT ==========================
|
|
16
|
+
/**
|
|
17
|
+
* StatusGem Component
|
|
18
|
+
*
|
|
19
|
+
* A colored status dot with an adjacent label, used to call out a record's
|
|
20
|
+
* state inline (e.g. in a table cell or list row).
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* <StatusGem variant="success" label="Active" />
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <StatusGem variant="pending" label="Awaiting approval" size="md" />
|
|
27
|
+
*/
|
|
28
|
+
export function StatusGem({ variant = 'success', label, size = 'xs' }) {
|
|
29
|
+
const dotSize = DOT_SIZE_BY_SIZE[size];
|
|
30
|
+
return (_jsxs(Inline, { gap: 5, align: "center", children: [_jsx(Indicator, { type: variant, size: dotSize, position: "middle-center", offset: 0, inline: true, children: _jsx("div", { style: { width: dotSize, height: dotSize } }) }), _jsx(Text, { size: size, c: "dimmed", children: label })] }));
|
|
31
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Indicator } from '../../DataDisplay/Indicator';
|
|
5
|
+
import { Inline } from '../../Layout';
|
|
6
|
+
import { Text } from '../../Typography/Text';
|
|
7
|
+
|
|
8
|
+
// ========================== TYPES ==========================
|
|
9
|
+
|
|
10
|
+
export type StatusGemVariant = 'success' | 'danger' | 'pending' | 'info' | 'default';
|
|
11
|
+
export type StatusGemSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
|
|
13
|
+
export interface StatusGemProps {
|
|
14
|
+
/** Semantic status color */
|
|
15
|
+
variant?: StatusGemVariant;
|
|
16
|
+
/** Label text */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Overall size - scales the dot and label together */
|
|
19
|
+
size?: StatusGemSize;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Indicator dot size per step, matching Indicator's own Code Connect mapping (indicator.figma.tsx)
|
|
23
|
+
const DOT_SIZE_BY_SIZE: Record<StatusGemSize, number> = {
|
|
24
|
+
xs: 8,
|
|
25
|
+
sm: 12,
|
|
26
|
+
md: 16,
|
|
27
|
+
lg: 20,
|
|
28
|
+
xl: 24,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// ========================== COMPONENT ==========================
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* StatusGem Component
|
|
35
|
+
*
|
|
36
|
+
* A colored status dot with an adjacent label, used to call out a record's
|
|
37
|
+
* state inline (e.g. in a table cell or list row).
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* <StatusGem variant="success" label="Active" />
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* <StatusGem variant="pending" label="Awaiting approval" size="md" />
|
|
44
|
+
*/
|
|
45
|
+
export function StatusGem({ variant = 'success', label, size = 'xs' }: StatusGemProps) {
|
|
46
|
+
const dotSize = DOT_SIZE_BY_SIZE[size];
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Inline gap={5} align="center">
|
|
50
|
+
<Indicator type={variant} size={dotSize} position="middle-center" offset={0} inline>
|
|
51
|
+
<div style={{ width: dotSize, height: dotSize }} />
|
|
52
|
+
</Indicator>
|
|
53
|
+
<Text size={size} c="dimmed">
|
|
54
|
+
{label}
|
|
55
|
+
</Text>
|
|
56
|
+
</Inline>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StatusGem } from './StatusGem.js';
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ import { DataTable } from './ComplexComponents/DataTable/index.js';
|
|
|
32
32
|
import { DashboardWidget } from './ComplexComponents/DashboardWidget/index.js';
|
|
33
33
|
import { Placeholder } from './ComplexComponents/Placeholder/index.js';
|
|
34
34
|
import { Slat } from './ComplexComponents/Slat/index.js';
|
|
35
|
+
import { StatusGem } from './ComplexComponents/StatusGem/index.js';
|
|
35
36
|
// ========================== INPUTS ==========================
|
|
36
37
|
export { TextInput, TextArea, NumberInput, ColorInput, Slider, SliderWithLabel, Switch, SegmentedControl, Checkbox, Radio, RadioGroup, DropZone, FileInput } from './Inputs/index.js';
|
|
37
38
|
// ========================== BUTTONS ==========================
|
|
@@ -61,6 +62,7 @@ export { DataTable } from './ComplexComponents/DataTable/index.js';
|
|
|
61
62
|
export { DashboardWidget } from './ComplexComponents/DashboardWidget/index.js';
|
|
62
63
|
export { Placeholder } from './ComplexComponents/Placeholder/index.js';
|
|
63
64
|
export { Slat } from './ComplexComponents/Slat/index.js';
|
|
65
|
+
export { StatusGem } from './ComplexComponents/StatusGem/index.js';
|
|
64
66
|
// ========================== CATEGORY EXPORTS ==========================
|
|
65
67
|
// Export components grouped by category for convenient importing
|
|
66
68
|
export const Inputs = {
|
|
@@ -159,4 +161,5 @@ export const ComplexComponents = {
|
|
|
159
161
|
DashboardWidget,
|
|
160
162
|
Placeholder,
|
|
161
163
|
Slat,
|
|
164
|
+
StatusGem,
|
|
162
165
|
};
|
package/dist/index.ts
CHANGED
|
@@ -33,6 +33,7 @@ import { DataTable } from './ComplexComponents/DataTable';
|
|
|
33
33
|
import { DashboardWidget } from './ComplexComponents/DashboardWidget';
|
|
34
34
|
import { Placeholder } from './ComplexComponents/Placeholder';
|
|
35
35
|
import { Slat } from './ComplexComponents/Slat';
|
|
36
|
+
import { StatusGem } from './ComplexComponents/StatusGem';
|
|
36
37
|
|
|
37
38
|
// ========================== INPUTS ==========================
|
|
38
39
|
export { TextInput, TextArea, NumberInput, ColorInput, Slider, SliderWithLabel, Switch, SegmentedControl, Checkbox, Radio, RadioGroup, DropZone, FileInput } from './Inputs';
|
|
@@ -103,6 +104,8 @@ export { Placeholder } from './ComplexComponents/Placeholder';
|
|
|
103
104
|
export type { PlaceholderProps, PlaceholderAction, PlaceholderSize } from './ComplexComponents/Placeholder';
|
|
104
105
|
export { Slat } from './ComplexComponents/Slat';
|
|
105
106
|
export type { SlatProps, SlatSize, SlatIndicator, SlatBadge, SlatAction } from './ComplexComponents/Slat';
|
|
107
|
+
export { StatusGem } from './ComplexComponents/StatusGem';
|
|
108
|
+
export type { StatusGemProps, StatusGemVariant, StatusGemSize } from './ComplexComponents/StatusGem';
|
|
106
109
|
|
|
107
110
|
// ========================== CATEGORY EXPORTS ==========================
|
|
108
111
|
// Export components grouped by category for convenient importing
|
|
@@ -212,6 +215,7 @@ export const ComplexComponents = {
|
|
|
212
215
|
DashboardWidget,
|
|
213
216
|
Placeholder,
|
|
214
217
|
Slat,
|
|
218
|
+
StatusGem,
|
|
215
219
|
};
|
|
216
220
|
|
|
217
221
|
// Placeholder export to prevent empty module errors
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Stack, StatusGem } from '@appdirect/design-system';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof StatusGem> = {
|
|
5
|
+
title: 'Design System/Complex Components/StatusGem',
|
|
6
|
+
component: StatusGem,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'padded',
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: 'A colored status dot with an adjacent label, used to call out a record\'s state inline (e.g. in a table cell or list row).',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
tags: ['autodocs', 'needs-connect'],
|
|
16
|
+
argTypes: {
|
|
17
|
+
variant: {
|
|
18
|
+
control: 'select',
|
|
19
|
+
options: ['success', 'danger', 'pending', 'info', 'default'],
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
control: 'select',
|
|
23
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
variant: 'success',
|
|
34
|
+
label: 'This is a status gem label',
|
|
35
|
+
size: 'xs',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const AllVariants: Story = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<Stack gap="xs">
|
|
42
|
+
<StatusGem variant="success" label="Active" />
|
|
43
|
+
<StatusGem variant="danger" label="Failed" />
|
|
44
|
+
<StatusGem variant="pending" label="Awaiting approval" />
|
|
45
|
+
<StatusGem variant="info" label="In review" />
|
|
46
|
+
<StatusGem variant="default" label="Inactive" />
|
|
47
|
+
</Stack>
|
|
48
|
+
),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const AllSizes: Story = {
|
|
52
|
+
render: () => (
|
|
53
|
+
<Stack gap="md">
|
|
54
|
+
{(['xs', 'sm', 'md', 'lg', 'xl'] as const).map((size) => (
|
|
55
|
+
<StatusGem key={size} size={size} variant="success" label="This is a status gem label" />
|
|
56
|
+
))}
|
|
57
|
+
</Stack>
|
|
58
|
+
),
|
|
59
|
+
};
|
package/dist/stories/index.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.15",
|
|
3
3
|
"stories": [
|
|
4
4
|
{
|
|
5
5
|
"title": "Design System/Buttons/ActionIcon",
|
|
@@ -392,6 +392,22 @@
|
|
|
392
392
|
],
|
|
393
393
|
"mantine": []
|
|
394
394
|
},
|
|
395
|
+
{
|
|
396
|
+
"title": "Design System/Complex Components/StatusGem",
|
|
397
|
+
"component": "StatusGem",
|
|
398
|
+
"description": "A colored status dot with an adjacent label, used to call out a record\\",
|
|
399
|
+
"stories": [
|
|
400
|
+
"Default",
|
|
401
|
+
"AllVariants",
|
|
402
|
+
"AllSizes"
|
|
403
|
+
],
|
|
404
|
+
"file": "ComplexComponents/StatusGem/StatusGem.stories.tsx",
|
|
405
|
+
"designSystem": [
|
|
406
|
+
"Stack",
|
|
407
|
+
"StatusGem"
|
|
408
|
+
],
|
|
409
|
+
"mantine": []
|
|
410
|
+
},
|
|
395
411
|
{
|
|
396
412
|
"title": "Design System/Complex Components/Utilities/CopyButton",
|
|
397
413
|
"component": "CopyButton",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appdirect/design-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "AppDirect Design System components. Wraps Mantine v9 with standardized props, variants, and tokens.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"prepublishOnly": "npm run build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@appdirect/ad-design-tokens": "0.0.
|
|
47
|
+
"@appdirect/ad-design-tokens": "0.0.15",
|
|
48
48
|
"@mantine/dropzone": "^9.6.0",
|
|
49
49
|
"@remixicon/react": "^4.6.0",
|
|
50
50
|
"@tabler/icons-react": "^3.33.0",
|