@appdirect/design-system 0.0.0-stage → 0.0.1

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.
Files changed (130) hide show
  1. package/README.md +12 -2
  2. package/dist/Buttons/ActionIcon.tsx +37 -0
  3. package/dist/Buttons/Button.module.css +5 -0
  4. package/dist/Buttons/Button.tsx +124 -0
  5. package/dist/Buttons/CloseButton.tsx +83 -0
  6. package/dist/Buttons/index.ts +20 -0
  7. package/dist/Combobox/AutocompleteClearable.tsx +128 -0
  8. package/dist/Combobox/Combobox.tsx +37 -0
  9. package/dist/Combobox/Multiselect.tsx +158 -0
  10. package/dist/Combobox/SearchableSelect.tsx +131 -0
  11. package/dist/Combobox/Select.tsx +154 -0
  12. package/dist/Combobox/index.ts +20 -0
  13. package/dist/ComplexComponents/DashboardWidget/DashboardWidget.tsx +280 -0
  14. package/dist/ComplexComponents/DashboardWidget/index.ts +2 -0
  15. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.tsx +177 -0
  16. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/utils.ts +35 -0
  17. package/dist/ComplexComponents/DataTable/CustomToolbarAlertBannerContent/index.tsx +74 -0
  18. package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.tsx +358 -0
  19. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterChip.tsx +48 -0
  20. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/DateRangeFilter.tsx +26 -0
  21. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterRenderer.tsx +71 -0
  22. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterSystem.tsx +158 -0
  23. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/MultiSelectFilter.tsx +79 -0
  24. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/SingleSelectFilter.tsx +65 -0
  25. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/index.ts +70 -0
  26. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/types.ts +140 -0
  27. package/dist/ComplexComponents/DataTable/CustomTopToolbar/ResultCount/index.tsx +76 -0
  28. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.tsx +73 -0
  29. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SelectFilter.tsx +50 -0
  30. package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.tsx +788 -0
  31. package/dist/ComplexComponents/DataTable/DataTable.tsx +582 -0
  32. package/dist/ComplexComponents/DataTable/ErrorOverlay/index.tsx +29 -0
  33. package/dist/ComplexComponents/DataTable/SortableHeaderCell/index.tsx +57 -0
  34. package/dist/ComplexComponents/DataTable/index.ts +2 -0
  35. package/dist/ComplexComponents/DataTable/translations/en.ts +115 -0
  36. package/dist/ComplexComponents/DataTable/translations/index.ts +23 -0
  37. package/dist/ComplexComponents/KeyInsight/KeyInsights.tsx +221 -0
  38. package/dist/ComplexComponents/KeyInsight/index.ts +2 -0
  39. package/dist/ComplexComponents/NameValue/NameValue.tsx +175 -0
  40. package/dist/ComplexComponents/NameValue/NameValueItem.tsx +100 -0
  41. package/dist/ComplexComponents/NameValue/index.ts +4 -0
  42. package/dist/ComplexComponents/PageContentHeader/DescriptionBlock.tsx +65 -0
  43. package/dist/ComplexComponents/PageContentHeader/PageContentHeader.tsx +383 -0
  44. package/dist/ComplexComponents/PageContentHeader/index.ts +4 -0
  45. package/dist/ComplexComponents/Utilities/CopyButton.tsx +82 -0
  46. package/dist/ComplexComponents/Utilities/index.ts +2 -0
  47. package/dist/DataDisplay/Alert.tsx +130 -0
  48. package/dist/DataDisplay/Avatar.tsx +216 -0
  49. package/dist/DataDisplay/Badge.tsx +119 -0
  50. package/dist/DataDisplay/Card.module.css +26 -0
  51. package/dist/DataDisplay/Card.tsx +163 -0
  52. package/dist/DataDisplay/Chip.tsx +66 -0
  53. package/dist/DataDisplay/Indicator.tsx +122 -0
  54. package/dist/DataDisplay/List.tsx +90 -0
  55. package/dist/DataDisplay/Pill.tsx +125 -0
  56. package/dist/DataDisplay/Progress.tsx +77 -0
  57. package/dist/DataDisplay/Table.tsx +57 -0
  58. package/dist/DataDisplay/ThemeIcon.tsx +67 -0
  59. package/dist/DataDisplay/index.ts +41 -0
  60. package/dist/Inputs/Checkbox.tsx +94 -0
  61. package/dist/Inputs/ColorInput.tsx +124 -0
  62. package/dist/Inputs/DropZone.tsx +78 -0
  63. package/dist/Inputs/FileInput.tsx +120 -0
  64. package/dist/Inputs/NumberInput.tsx +125 -0
  65. package/dist/Inputs/Radio.tsx +86 -0
  66. package/dist/Inputs/RadioGroup.tsx +90 -0
  67. package/dist/Inputs/SegmentedControl.tsx +64 -0
  68. package/dist/Inputs/Slider.tsx +69 -0
  69. package/dist/Inputs/Switch.tsx +67 -0
  70. package/dist/Inputs/TextArea.tsx +126 -0
  71. package/dist/Inputs/TextInput.tsx +167 -0
  72. package/dist/Inputs/index.ts +51 -0
  73. package/dist/Layout/Box.tsx +82 -0
  74. package/dist/Layout/Center.tsx +17 -0
  75. package/dist/Layout/Container.tsx +17 -0
  76. package/dist/Layout/Flex.tsx +18 -0
  77. package/dist/Layout/Grid.tsx +31 -0
  78. package/dist/Layout/Group.tsx +54 -0
  79. package/dist/Layout/Inline.tsx +86 -0
  80. package/dist/Layout/SimpleGrid.tsx +50 -0
  81. package/dist/Layout/Stack.tsx +86 -0
  82. package/dist/Layout/index.ts +29 -0
  83. package/dist/Misc/Divider.tsx +27 -0
  84. package/dist/Misc/Paper.tsx +47 -0
  85. package/dist/Misc/index.ts +15 -0
  86. package/dist/Navigation/Breadcrumb.tsx +138 -0
  87. package/dist/Navigation/NavLink.tsx +37 -0
  88. package/dist/Navigation/Stepper.tsx +17 -0
  89. package/dist/Navigation/Tabs.tsx +29 -0
  90. package/dist/Navigation/index.ts +17 -0
  91. package/dist/Overlays/Drawer.tsx +123 -0
  92. package/dist/Overlays/Menu.tsx +192 -0
  93. package/dist/Overlays/Modal.tsx +159 -0
  94. package/dist/Overlays/Popover.tsx +319 -0
  95. package/dist/Overlays/Tooltip.tsx +131 -0
  96. package/dist/Overlays/index.ts +19 -0
  97. package/dist/Shell/AppShellLayout.tsx +56 -0
  98. package/dist/Shell/HeaderBar.tsx +26 -0
  99. package/dist/Shell/SidebarNav.tsx +47 -0
  100. package/dist/Shell/SidebarNavLink.tsx +50 -0
  101. package/dist/Shell/SingleColumnLayout.tsx +22 -0
  102. package/dist/Shell/TertiaryColumnLayout.tsx +32 -0
  103. package/dist/Shell/index.ts +17 -0
  104. package/dist/Typography/Code.tsx +27 -0
  105. package/dist/Typography/Kbd.tsx +87 -0
  106. package/dist/Typography/Text.tsx +27 -0
  107. package/dist/Typography/Title.tsx +34 -0
  108. package/dist/Typography/index.ts +21 -0
  109. package/dist/bin/ds-audit.js +521 -0
  110. package/dist/config.ts +226 -0
  111. package/dist/contracts/Alert.json +80 -0
  112. package/dist/contracts/Badge.json +78 -0
  113. package/dist/contracts/Box.json +52 -0
  114. package/dist/contracts/Button.json +111 -0
  115. package/dist/contracts/DataTable.json +68 -0
  116. package/dist/contracts/Grid.json +35 -0
  117. package/dist/contracts/Group.json +44 -0
  118. package/dist/contracts/Inline.json +73 -0
  119. package/dist/contracts/PageContentHeader.json +107 -0
  120. package/dist/contracts/Stack.json +62 -0
  121. package/dist/contracts/ds-component-contract.v1.json +23 -0
  122. package/dist/contracts/index.json +55 -0
  123. package/dist/css/foundations.css +703 -0
  124. package/dist/css/mantine.css +1797 -0
  125. package/dist/hooks/useTableHandlers.ts +179 -0
  126. package/dist/hooks/useTableRenderFunctions.tsx +283 -0
  127. package/dist/hooks/useTableState.ts +81 -0
  128. package/dist/index.ts +210 -0
  129. package/dist/types.ts +202 -0
  130. package/package.json +56 -4
@@ -0,0 +1,124 @@
1
+ 'use client';
2
+
3
+ import React, { forwardRef } from 'react';
4
+ import { ColorInput as MantineColorInput, ColorInputProps as MantineColorInputProps, ActionIcon, Group } from '@mantine/core';
5
+ import { IconInfoCircle } from '@tabler/icons-react';
6
+ import { ComponentSize } from '../config';
7
+ import { Text } from '../Typography/Text';
8
+ import { Tooltip } from '../Overlays/Tooltip';
9
+
10
+ // ========================== TYPES ==========================
11
+
12
+ export interface DSColorInputProps extends Omit<MantineColorInputProps, 'size' | 'radius'> {
13
+ /** Input size from design system scale */
14
+ size?: ComponentSize;
15
+ /** Whether to show "(Optional)" text after label */
16
+ showOptional?: boolean;
17
+ /** Whether to show a help icon with a tooltip in the right section */
18
+ hasHelpIcon?: boolean;
19
+ /** Tooltip label shown when hovering the help icon. Also used as aria-label for a11y */
20
+ helpIconLabel?: string;
21
+ /** Optional click handler for the help icon */
22
+ onHelpIconClick?: React.MouseEventHandler<HTMLButtonElement>;
23
+ /**
24
+ * Optional error message text shown below the input when in error state.
25
+ * Used with error={true} (from state) for red border + message; omit for red border only.
26
+ */
27
+ errorCaption?: string;
28
+ }
29
+
30
+ // ========================== COMPONENT ==========================
31
+
32
+ /**
33
+ * AppDirect Design System ColorInput Component
34
+ *
35
+ * A color picker input built on top of Mantine's ColorInput with
36
+ * consistent design system styling and enforced radius.
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * <ColorInput label="Brand Color" placeholder="#000000" format="hex" />
41
+ * ```
42
+ *
43
+ * @example
44
+ * ```tsx
45
+ * <ColorInput
46
+ * label="Theme Color"
47
+ * format="hex"
48
+ * swatches={['#FF0000', '#00FF00', '#0000FF']}
49
+ * showOptional
50
+ * hasHelpIcon
51
+ * helpIconLabel="Choose the primary brand color"
52
+ * />
53
+ * ```
54
+ */
55
+ export const ColorInput = forwardRef<HTMLInputElement, DSColorInputProps>(
56
+ (
57
+ {
58
+ size = 'md',
59
+ showOptional = false,
60
+ required,
61
+ label,
62
+ hasHelpIcon = false,
63
+ helpIconLabel,
64
+ onHelpIconClick,
65
+ rightSection,
66
+ error,
67
+ errorCaption,
68
+ ...props
69
+ },
70
+ ref
71
+ ) => {
72
+ const effectiveError = error === true ? (errorCaption ?? true) : error;
73
+
74
+ const enhancedLabel = React.useMemo(() => {
75
+ if (!label) return label;
76
+ if (showOptional && !required) {
77
+ return (
78
+ <>
79
+ {label} <Text span c="dimmed" fw="normal">(Optional)</Text>
80
+ </>
81
+ );
82
+ }
83
+ return label;
84
+ }, [label, showOptional, required]);
85
+
86
+ const helpIconElement = hasHelpIcon ? (
87
+ <Tooltip
88
+ label={helpIconLabel ?? 'Help'}
89
+ position="top"
90
+ withArrow
91
+ >
92
+ <ActionIcon
93
+ variant="transparent"
94
+ size="xs"
95
+ aria-label={helpIconLabel ?? 'Help'}
96
+ onClick={onHelpIconClick}
97
+ color="gray"
98
+ style={{ cursor: onHelpIconClick ? 'pointer' : 'default' }}
99
+ >
100
+ <IconInfoCircle size={14} aria-hidden />
101
+ </ActionIcon>
102
+ </Tooltip>
103
+ ) : null;
104
+
105
+ const composedRightSection = (helpIconElement && rightSection)
106
+ ? <Group gap={4} wrap="nowrap">{rightSection}{helpIconElement}</Group>
107
+ : helpIconElement || rightSection;
108
+
109
+ return (
110
+ <MantineColorInput
111
+ ref={ref}
112
+ size={size}
113
+ radius="sm"
114
+ required={required}
115
+ label={enhancedLabel}
116
+ rightSection={composedRightSection}
117
+ error={effectiveError}
118
+ {...props}
119
+ />
120
+ );
121
+ }
122
+ );
123
+
124
+ ColorInput.displayName = 'ColorInput';
@@ -0,0 +1,78 @@
1
+ 'use client';
2
+
3
+ import { Dropzone, DropzoneProps, IMAGE_MIME_TYPE } from '@mantine/dropzone';
4
+ import { Text, rem } from '@mantine/core';
5
+ import { Inline } from '../Layout/Inline';
6
+ import { IconUpload, IconX, IconPhoto } from '@tabler/icons-react';
7
+ import { forwardRef } from 'react';
8
+
9
+ export interface DropZoneProps extends Omit<DropzoneProps, 'children' | 'onDrop'> {
10
+ /** Title text displayed in the dropzone */
11
+ title?: string;
12
+ /** Description text displayed below the title */
13
+ description?: string;
14
+ /** Maximum file size in bytes (default: 5MB) */
15
+ maxSize?: number;
16
+ /** Accepted file types (default: images) */
17
+ accept?: string[] | Record<string, string[]>;
18
+ /** Callback when files are dropped/selected */
19
+ onDrop?: (files: File[]) => void;
20
+ }
21
+
22
+ export const DropZone = forwardRef<HTMLDivElement, DropZoneProps>(
23
+ ({
24
+ title = "This is the title",
25
+ description = "This is the description for the Dropzone component",
26
+ maxSize = 5 * 1024 ** 2, // 5MB
27
+ accept = IMAGE_MIME_TYPE,
28
+ onDrop,
29
+ onReject,
30
+ ...props
31
+ }, ref) => {
32
+ return (
33
+ <Dropzone
34
+ ref={ref}
35
+ onDrop={onDrop || ((files) => console.log('accepted files', files))}
36
+ onReject={onReject || ((files) => console.log('rejected files', files))}
37
+ maxSize={maxSize}
38
+ accept={accept}
39
+ {...props}
40
+ >
41
+ <Inline justify="flex-start" gap="md" mih={80} style={{ pointerEvents: 'none' }}>
42
+ <Dropzone.Accept>
43
+ <IconUpload
44
+ size={32}
45
+ color="var(--ad-color-brand-primary)"
46
+ stroke={1.5}
47
+ />
48
+ </Dropzone.Accept>
49
+ <Dropzone.Reject>
50
+ <IconX
51
+ size={32}
52
+ color="var(--ad-color-status-error)"
53
+ stroke={1.5}
54
+ />
55
+ </Dropzone.Reject>
56
+ <Dropzone.Idle>
57
+ <IconUpload
58
+ size={32}
59
+ color="var(--ad-color-text-dimmed)"
60
+ stroke={1.5}
61
+ />
62
+ </Dropzone.Idle>
63
+
64
+ <div>
65
+ <Text size="md" fw={500} mb={4}>
66
+ {title}
67
+ </Text>
68
+ <Text size="sm" c="dimmed">
69
+ {description}
70
+ </Text>
71
+ </div>
72
+ </Inline>
73
+ </Dropzone>
74
+ );
75
+ }
76
+ );
77
+
78
+ DropZone.displayName = 'DropZone';
@@ -0,0 +1,120 @@
1
+ 'use client';
2
+
3
+ import React, { forwardRef } from 'react';
4
+ import { FileInput as MantineFileInput, FileInputProps as MantineFileInputProps } from '@mantine/core';
5
+ import { ComponentSize } from '../config';
6
+
7
+ /**
8
+ * Enhanced FileInput props extending Mantine's FileInputProps
9
+ */
10
+ export interface DSFileInputProps extends Omit<MantineFileInputProps<any>, 'size' | 'radius'> {
11
+ /** Input size from design system scale */
12
+ size?: ComponentSize;
13
+ /** Whether input is required (shows asterisk) */
14
+ required?: boolean;
15
+ /** Whether to show "(Optional)" text after label */
16
+ showOptional?: boolean;
17
+ }
18
+
19
+ /**
20
+ * AppDirect Design System FileInput Component
21
+ *
22
+ * A clean file input component built on top of Mantine's FileInput with
23
+ * consistent design system styling and enforced radius.
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * // Basic usage (no indication)
28
+ * <FileInput label="Upload File" placeholder="Choose file" />
29
+ *
30
+ * // Required field (shows asterisk)
31
+ * <FileInput
32
+ * label="Resume"
33
+ * placeholder="Upload your resume"
34
+ * required
35
+ * />
36
+ *
37
+ * // Optional field (shows "(Optional)")
38
+ * <FileInput
39
+ * label="Profile Picture"
40
+ * placeholder="Upload image"
41
+ * showOptional
42
+ * />
43
+ *
44
+ * // With error
45
+ * <FileInput
46
+ * label="Document"
47
+ * error="File is required"
48
+ * />
49
+ * ```
50
+ *
51
+ * @example
52
+ * ```tsx
53
+ * // Different sizes
54
+ * <FileInput size="xs" placeholder="Extra small" />
55
+ * <FileInput size="sm" placeholder="Small" />
56
+ * <FileInput size="md" placeholder="Medium" />
57
+ * <FileInput size="lg" placeholder="Large" />
58
+ * <FileInput size="xl" placeholder="Extra large" />
59
+ *
60
+ * // With file type restrictions
61
+ * <FileInput
62
+ * accept="image/png,image/jpeg"
63
+ * placeholder="Upload image"
64
+ * />
65
+ *
66
+ * // Multiple files
67
+ * <FileInput
68
+ * multiple
69
+ * placeholder="Upload multiple files"
70
+ * />
71
+ *
72
+ * // With clearable option
73
+ * <FileInput
74
+ * clearable
75
+ * placeholder="Upload file (clearable)"
76
+ * />
77
+ * ```
78
+ */
79
+ export const FileInput = forwardRef<HTMLButtonElement, DSFileInputProps>(
80
+ (
81
+ {
82
+ size = 'md',
83
+ className,
84
+ leftSection,
85
+ rightSection,
86
+ showOptional = false,
87
+ label,
88
+ ...props
89
+ },
90
+ ref
91
+ ) => {
92
+ // Construct label with optional text if needed
93
+ const enhancedLabel = React.useMemo(() => {
94
+ if (!label) return label;
95
+ if (showOptional && !props.required) {
96
+ return (
97
+ <>
98
+ {label} <span style={{ fontWeight: 'normal', color: 'var(--ad-color-text-dimmed)' }}>(Optional)</span>
99
+ </>
100
+ );
101
+ }
102
+ return label;
103
+ }, [label, showOptional, props.required]);
104
+
105
+ return (
106
+ <MantineFileInput
107
+ ref={ref}
108
+ size={size}
109
+ radius="sm"
110
+ className={className}
111
+ leftSection={leftSection}
112
+ rightSection={rightSection}
113
+ label={enhancedLabel}
114
+ {...props}
115
+ />
116
+ );
117
+ }
118
+ );
119
+
120
+ FileInput.displayName = 'FileInput';
@@ -0,0 +1,125 @@
1
+ 'use client';
2
+
3
+ import React, { forwardRef } from 'react';
4
+ import { NumberInput as MantineNumberInput, NumberInputProps as MantineNumberInputProps, ActionIcon, Group } from '@mantine/core';
5
+ import { IconInfoCircle } from '@tabler/icons-react';
6
+ import { ComponentSize } from '../config';
7
+ import { Text } from '../Typography/Text';
8
+ import { Tooltip } from '../Overlays/Tooltip';
9
+
10
+ // ========================== TYPES ==========================
11
+
12
+ export interface DSNumberInputProps extends Omit<MantineNumberInputProps, 'size' | 'radius'> {
13
+ /** Input size from design system scale */
14
+ size?: ComponentSize;
15
+ /** Whether to show "(Optional)" text after label */
16
+ showOptional?: boolean;
17
+ /** Whether to show a help icon with a tooltip in the right section */
18
+ hasHelpIcon?: boolean;
19
+ /** Tooltip label shown when hovering the help icon. Also used as aria-label for a11y */
20
+ helpIconLabel?: string;
21
+ /** Optional click handler for the help icon */
22
+ onHelpIconClick?: React.MouseEventHandler<HTMLButtonElement>;
23
+ /**
24
+ * Optional error message text shown below the input when in error state.
25
+ * Used with error={true} (from state) for red border + message; omit for red border only.
26
+ */
27
+ errorCaption?: string;
28
+ }
29
+
30
+ // ========================== COMPONENT ==========================
31
+
32
+ /**
33
+ * AppDirect Design System NumberInput Component
34
+ *
35
+ * A numeric input built on top of Mantine's NumberInput with
36
+ * consistent design system styling and enforced radius.
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * <NumberInput label="Quantity" placeholder="Enter a number" />
41
+ * ```
42
+ *
43
+ * @example
44
+ * ```tsx
45
+ * <NumberInput
46
+ * label="Price"
47
+ * prefix="$"
48
+ * decimalScale={2}
49
+ * fixedDecimalScale
50
+ * showOptional
51
+ * hasHelpIcon
52
+ * helpIconLabel="Enter the item price"
53
+ * />
54
+ * ```
55
+ */
56
+ export const NumberInput = forwardRef<HTMLInputElement, DSNumberInputProps>(
57
+ (
58
+ {
59
+ size = 'md',
60
+ showOptional = false,
61
+ required,
62
+ label,
63
+ hasHelpIcon = false,
64
+ helpIconLabel,
65
+ onHelpIconClick,
66
+ rightSection,
67
+ error,
68
+ errorCaption,
69
+ ...props
70
+ },
71
+ ref
72
+ ) => {
73
+ const effectiveError = error === true ? (errorCaption ?? true) : error;
74
+
75
+ const enhancedLabel = React.useMemo(() => {
76
+ if (!label) return label;
77
+ if (showOptional && !required) {
78
+ return (
79
+ <>
80
+ {label} <Text span c="dimmed" fw="normal">(Optional)</Text>
81
+ </>
82
+ );
83
+ }
84
+ return label;
85
+ }, [label, showOptional, required]);
86
+
87
+ const helpIconElement = hasHelpIcon ? (
88
+ <Tooltip
89
+ label={helpIconLabel ?? 'Help'}
90
+ position="top"
91
+ withArrow
92
+ >
93
+ <ActionIcon
94
+ variant="transparent"
95
+ size="xs"
96
+ aria-label={helpIconLabel ?? 'Help'}
97
+ onClick={onHelpIconClick}
98
+ color="gray"
99
+ style={{ cursor: onHelpIconClick ? 'pointer' : 'default' }}
100
+ >
101
+ <IconInfoCircle size={14} aria-hidden />
102
+ </ActionIcon>
103
+ </Tooltip>
104
+ ) : null;
105
+
106
+ const composedRightSection = (helpIconElement && rightSection)
107
+ ? <Group gap={4} wrap="nowrap">{rightSection}{helpIconElement}</Group>
108
+ : helpIconElement || rightSection;
109
+
110
+ return (
111
+ <MantineNumberInput
112
+ ref={ref}
113
+ size={size}
114
+ radius="sm"
115
+ required={required}
116
+ label={enhancedLabel}
117
+ rightSection={composedRightSection}
118
+ error={effectiveError}
119
+ {...props}
120
+ />
121
+ );
122
+ }
123
+ );
124
+
125
+ NumberInput.displayName = 'NumberInput';
@@ -0,0 +1,86 @@
1
+ 'use client';
2
+
3
+ import React, { forwardRef } from 'react';
4
+ import { Radio as MantineRadio, RadioProps as MantineRadioProps } from '@mantine/core';
5
+ import { ComponentSize } from '../config';
6
+
7
+ /**
8
+ * Enhanced Radio props extending Mantine's RadioProps
9
+ */
10
+ export interface DSRadioProps extends Omit<MantineRadioProps, 'size'> {
11
+ /** Radio size from design system scale */
12
+ size?: ComponentSize;
13
+ }
14
+
15
+ /**
16
+ * AppDirect Design System Radio Component
17
+ *
18
+ * A clean radio button component built on top of Mantine's Radio with
19
+ * consistent design system styling and enforced radius.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * // Basic usage
24
+ * <Radio label="Option 1" value="option1" />
25
+ *
26
+ * // In a Radio.Group
27
+ * <Radio.Group label="Choose an option" value={value} onChange={setValue}>
28
+ * <Radio value="option1" label="First option" />
29
+ * <Radio value="option2" label="Second option" />
30
+ * <Radio value="option3" label="Third option" />
31
+ * </Radio.Group>
32
+ * ```
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * // Different sizes
37
+ * <Radio size="xs" label="Extra small" value="xs" />
38
+ * <Radio size="sm" label="Small" value="sm" />
39
+ * <Radio size="md" label="Medium" value="md" />
40
+ * <Radio size="lg" label="Large" value="lg" />
41
+ * <Radio size="xl" label="Extra large" value="xl" />
42
+ * ```
43
+ *
44
+ * @example
45
+ * ```tsx
46
+ * // States
47
+ * <Radio label="Default radio" value="default" />
48
+ * <Radio label="Checked radio" value="checked" defaultChecked />
49
+ * <Radio label="Disabled radio" value="disabled" disabled />
50
+ * <Radio label="Required radio" value="required" required />
51
+ * ```
52
+ */
53
+ export const Radio = forwardRef<HTMLInputElement, DSRadioProps>(
54
+ (
55
+ {
56
+ size = 'md',
57
+ label,
58
+ ...props
59
+ },
60
+ ref
61
+ ) => {
62
+ // Construct label with required asterisk if needed
63
+ const enhancedLabel = React.useMemo(() => {
64
+ if (!label) return label;
65
+ if (props.required) {
66
+ return (
67
+ <>
68
+ {label} <span style={{ color: 'var(--ad-color-status-error)' }}>*</span>
69
+ </>
70
+ );
71
+ }
72
+ return label;
73
+ }, [label, props.required]);
74
+
75
+ return (
76
+ <MantineRadio
77
+ ref={ref}
78
+ size={size}
79
+ label={enhancedLabel}
80
+ {...props}
81
+ />
82
+ );
83
+ }
84
+ );
85
+
86
+ Radio.displayName = 'Radio';
@@ -0,0 +1,90 @@
1
+ 'use client';
2
+
3
+ import React, { forwardRef } from 'react';
4
+ import { Radio as MantineRadio } from '@mantine/core';
5
+ import { ComponentSize } from '../config';
6
+
7
+ /**
8
+ * Enhanced RadioGroup props extending Mantine's RadioGroupProps
9
+ */
10
+ export interface DSRadioGroupProps extends Omit<React.ComponentPropsWithoutRef<typeof MantineRadio.Group>, 'size'> {
11
+ /** RadioGroup size from design system scale */
12
+ size?: ComponentSize;
13
+ }
14
+
15
+ /**
16
+ * AppDirect Design System RadioGroup Component
17
+ *
18
+ * A radio group component built on top of Mantine's Radio.Group with
19
+ * consistent design system styling and required asterisk support.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * // Basic usage
24
+ * <RadioGroup label="Choose an option" value={value} onChange={setValue}>
25
+ * <Radio value="option1" label="First option" />
26
+ * <Radio value="option2" label="Second option" />
27
+ * <Radio value="option3" label="Third option" />
28
+ * </RadioGroup>
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * // Required group
34
+ * <RadioGroup label="Payment method" required value={payment} onChange={setPayment}>
35
+ * <Radio value="card" label="Credit Card" />
36
+ * <Radio value="paypal" label="PayPal" />
37
+ * <Radio value="bank" label="Bank Transfer" />
38
+ * </RadioGroup>
39
+ * ```
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * // With description and error
44
+ * <RadioGroup
45
+ * label="Subscription plan"
46
+ * description="Choose your preferred plan"
47
+ * error="Please select a plan"
48
+ * value={plan}
49
+ * onChange={setPlan}
50
+ * >
51
+ * <Radio value="basic" label="Basic - $9/month" />
52
+ * <Radio value="pro" label="Pro - $29/month" />
53
+ * <Radio value="enterprise" label="Enterprise - $99/month" />
54
+ * </RadioGroup>
55
+ * ```
56
+ */
57
+ export const RadioGroup = forwardRef<HTMLDivElement, DSRadioGroupProps>(
58
+ (
59
+ {
60
+ size = 'md',
61
+ label,
62
+ ...props
63
+ },
64
+ ref
65
+ ) => {
66
+ // Construct label with required asterisk if needed
67
+ const enhancedLabel = React.useMemo(() => {
68
+ if (!label) return label;
69
+ if (props.required) {
70
+ return (
71
+ <>
72
+ {label} <span style={{ color: 'var(--ad-color-status-error)' }}>*</span>
73
+ </>
74
+ );
75
+ }
76
+ return label;
77
+ }, [label, props.required]);
78
+
79
+ return (
80
+ <MantineRadio.Group
81
+ ref={ref}
82
+ size={size}
83
+ label={enhancedLabel}
84
+ {...props}
85
+ />
86
+ );
87
+ }
88
+ );
89
+
90
+ RadioGroup.displayName = 'RadioGroup';
@@ -0,0 +1,64 @@
1
+ 'use client';
2
+
3
+ import React from 'react';
4
+ import { SegmentedControl as MantineSegmentedControl, SegmentedControlProps as MantineSegmentedControlProps } from '@mantine/core';
5
+
6
+ // Define the DS SegmentedControl props interface
7
+ export interface DSSegmentedControlProps extends Omit<MantineSegmentedControlProps, 'radius'> {
8
+ // All standard Mantine props are supported except radius which is enforced
9
+ }
10
+
11
+ /**
12
+ * SegmentedControl component with consistent design system styling.
13
+ * Built on top of Mantine's SegmentedControl component with enforced radius.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * // Basic segmented control
18
+ * <SegmentedControl
19
+ * data={['Segment 1', 'Segment 2', 'Segment 3']}
20
+ * defaultValue="Segment 1"
21
+ * />
22
+ *
23
+ * // With different sizes
24
+ * <SegmentedControl
25
+ * size="sm"
26
+ * data={['Small', 'Medium', 'Large']}
27
+ * />
28
+ *
29
+ * // With custom data structure
30
+ * <SegmentedControl
31
+ * data={[
32
+ * { label: 'React', value: 'react' },
33
+ * { label: 'Vue', value: 'vue' },
34
+ * { label: 'Angular', value: 'angular' }
35
+ * ]}
36
+ * defaultValue="react"
37
+ * />
38
+ *
39
+ * // Controlled component
40
+ * <SegmentedControl
41
+ * value={value}
42
+ * onChange={setValue}
43
+ * data={['Option 1', 'Option 2', 'Option 3']}
44
+ * />
45
+ *
46
+ * // Disabled state
47
+ * <SegmentedControl
48
+ * disabled
49
+ * data={['Disabled', 'Control']}
50
+ * />
51
+ * ```
52
+ */
53
+ export const SegmentedControl: React.FC<DSSegmentedControlProps> = ({
54
+ ...props
55
+ }) => {
56
+ return (
57
+ <MantineSegmentedControl
58
+ radius="sm"
59
+ {...props}
60
+ />
61
+ );
62
+ };
63
+
64
+ export default SegmentedControl;