@appdirect/design-system 0.0.10 → 0.0.12
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/README.md +85 -5
- package/dist/Buttons/ActionIcon.js +14 -0
- package/dist/Buttons/Button.js +66 -0
- package/dist/Buttons/CloseButton.js +48 -0
- package/dist/Buttons/index.js +13 -0
- package/dist/Combobox/AutocompleteClearable.js +36 -0
- package/dist/Combobox/Combobox.js +28 -0
- package/dist/Combobox/Multiselect.js +31 -0
- package/dist/Combobox/SearchableSelect.js +43 -0
- package/dist/Combobox/Select.js +72 -0
- package/dist/Combobox/index.js +10 -0
- package/dist/ComplexComponents/DashboardWidget/DashboardWidget.js +96 -0
- package/dist/ComplexComponents/DashboardWidget/index.js +1 -0
- package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.js +82 -0
- package/dist/ComplexComponents/DataTable/CustomBottomToolbar/utils.js +23 -0
- package/dist/ComplexComponents/DataTable/CustomToolbarAlertBannerContent/index.js +23 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.js +230 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterChip.js +30 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/DateRangeFilter.js +12 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterRenderer.js +32 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterSystem.js +90 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/MultiSelectFilter.js +43 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/SingleSelectFilter.js +30 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/index.js +39 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/types.js +9 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/ResultCount/index.js +31 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.js +42 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/SelectFilter.js +21 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.js +410 -0
- package/dist/ComplexComponents/DataTable/DataTable.js +405 -0
- package/dist/ComplexComponents/DataTable/ErrorOverlay/index.js +9 -0
- package/dist/ComplexComponents/DataTable/SortableHeaderCell/index.js +27 -0
- package/dist/ComplexComponents/DataTable/index.js +1 -0
- package/dist/ComplexComponents/DataTable/translations/en.js +99 -0
- package/dist/ComplexComponents/DataTable/translations/index.js +17 -0
- package/dist/ComplexComponents/KeyInsight/KeyInsights.js +176 -0
- package/dist/ComplexComponents/KeyInsight/index.js +1 -0
- package/dist/ComplexComponents/NameValue/NameValue.js +94 -0
- package/dist/ComplexComponents/NameValue/NameValueItem.js +59 -0
- package/dist/ComplexComponents/NameValue/index.js +2 -0
- package/dist/ComplexComponents/PageContentHeader/PageContentHeader.js +92 -0
- package/dist/ComplexComponents/PageContentHeader/PageContentHeader.tsx +24 -34
- package/dist/ComplexComponents/PageContentHeader/index.js +1 -0
- package/dist/ComplexComponents/PageContentHeader/index.ts +0 -2
- package/dist/ComplexComponents/Placeholder/Placeholder.js +51 -0
- package/dist/ComplexComponents/Placeholder/index.js +1 -0
- package/dist/ComplexComponents/Slat/Slat.js +53 -0
- package/dist/ComplexComponents/Slat/index.js +1 -0
- package/dist/ComplexComponents/Utilities/CopyButton.js +45 -0
- package/dist/ComplexComponents/Utilities/index.js +1 -0
- package/dist/DataDisplay/Alert.js +77 -0
- package/dist/DataDisplay/Avatar.js +157 -0
- package/dist/DataDisplay/Badge.js +78 -0
- package/dist/DataDisplay/Card.js +100 -0
- package/dist/DataDisplay/Chip.js +36 -0
- package/dist/DataDisplay/Indicator.js +59 -0
- package/dist/DataDisplay/List.js +60 -0
- package/dist/DataDisplay/Pill.js +81 -0
- package/dist/DataDisplay/Progress.js +42 -0
- package/dist/DataDisplay/Table.js +38 -0
- package/dist/DataDisplay/ThemeIcon.js +31 -0
- package/dist/DataDisplay/index.js +18 -0
- package/dist/Inputs/Checkbox.js +62 -0
- package/dist/Inputs/ColorInput.js +48 -0
- package/dist/Inputs/DropZone.js +12 -0
- package/dist/Inputs/FileInput.js +77 -0
- package/dist/Inputs/NumberInput.js +49 -0
- package/dist/Inputs/Radio.js +55 -0
- package/dist/Inputs/RadioGroup.js +59 -0
- package/dist/Inputs/SegmentedControl.js +50 -0
- package/dist/Inputs/Slider.js +50 -0
- package/dist/Inputs/SliderWithLabel.js +32 -0
- package/dist/Inputs/Switch.js +47 -0
- package/dist/Inputs/TextArea.js +50 -0
- package/dist/Inputs/TextInput.js +87 -0
- package/dist/Inputs/index.js +27 -0
- package/dist/Layout/Box.js +39 -0
- package/dist/Layout/Center.js +11 -0
- package/dist/Layout/Container.js +11 -0
- package/dist/Layout/Flex.js +12 -0
- package/dist/Layout/Grid.js +13 -0
- package/dist/Layout/Group.js +14 -0
- package/dist/Layout/Inline.js +46 -0
- package/dist/Layout/SimpleGrid.js +14 -0
- package/dist/Layout/Stack.js +45 -0
- package/dist/Layout/index.js +10 -0
- package/dist/Misc/Divider.js +8 -0
- package/dist/Misc/Paper.js +24 -0
- package/dist/Misc/index.js +10 -0
- package/dist/Navigation/Breadcrumb.js +60 -0
- package/dist/Navigation/NavLink.js +28 -0
- package/dist/Navigation/Stepper.js +8 -0
- package/dist/Navigation/Tabs.js +22 -0
- package/dist/Navigation/index.js +9 -0
- package/dist/Overlays/Drawer.js +63 -0
- package/dist/Overlays/Menu.js +85 -0
- package/dist/Overlays/Modal.js +61 -0
- package/dist/Overlays/Popover.js +118 -0
- package/dist/Overlays/Tooltip.js +71 -0
- package/dist/Overlays/index.js +12 -0
- package/dist/Shell/AppShellLayout.js +13 -0
- package/dist/Shell/HeaderBar.js +8 -0
- package/dist/Shell/SidebarNav.js +9 -0
- package/dist/Shell/SidebarNavLink.js +17 -0
- package/dist/Shell/SingleColumnLayout.js +11 -0
- package/dist/Shell/TertiaryColumnLayout.js +12 -0
- package/dist/Shell/index.js +6 -0
- package/dist/Typography/Code.js +8 -0
- package/dist/Typography/Kbd.js +58 -0
- package/dist/Typography/Text.js +8 -0
- package/dist/Typography/Title.js +11 -0
- package/dist/Typography/index.js +12 -0
- package/dist/config.js +202 -0
- package/dist/contracts/PageContentHeader.json +10 -5
- package/dist/contracts/index.json +1 -1
- package/dist/hooks/useTableHandlers.js +136 -0
- package/dist/hooks/useTableRenderFunctions.js +164 -0
- package/dist/hooks/useTableState.js +70 -0
- package/dist/index.js +162 -0
- package/dist/index.ts +3 -4
- package/dist/stories/Buttons/ActionIcon.stories.tsx +159 -0
- package/dist/stories/Buttons/Button.stories.tsx +145 -0
- package/dist/stories/Buttons/CloseButton.stories.tsx +121 -0
- package/dist/stories/Combobox/AutocompleteClearable.stories.tsx +554 -0
- package/dist/stories/Combobox/Combobox.stories.tsx +106 -0
- package/dist/stories/Combobox/Multiselect.stories.tsx +664 -0
- package/dist/stories/Combobox/SearchableSelect.stories.tsx +640 -0
- package/dist/stories/Combobox/Select.stories.tsx +311 -0
- package/dist/stories/ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx +822 -0
- package/dist/stories/ComplexComponents/DataTable/DataTable.stories.tsx +502 -0
- package/dist/stories/ComplexComponents/KeyInsight/KeyInsights.stories.tsx +386 -0
- package/dist/stories/ComplexComponents/NameValue/NameValue.stories.tsx +405 -0
- package/dist/stories/ComplexComponents/PageContentHeader/PageContentHeader.stories.tsx +527 -0
- package/dist/stories/ComplexComponents/Placeholder/Placeholder.stories.tsx +76 -0
- package/dist/stories/ComplexComponents/Slat/Slat.stories.tsx +79 -0
- package/dist/stories/ComplexComponents/Utilities/CopyButton.stories.tsx +479 -0
- package/dist/stories/DataDisplay/Alert.stories.tsx +296 -0
- package/dist/stories/DataDisplay/Avatar.stories.tsx +251 -0
- package/dist/stories/DataDisplay/Badge.stories.tsx +176 -0
- package/dist/stories/DataDisplay/Card.stories.tsx +406 -0
- package/dist/stories/DataDisplay/Chip.stories.tsx +495 -0
- package/dist/stories/DataDisplay/Indicator.stories.tsx +571 -0
- package/dist/stories/DataDisplay/List.stories.tsx +376 -0
- package/dist/stories/DataDisplay/Pill.stories.tsx +506 -0
- package/dist/stories/DataDisplay/Progress.stories.tsx +352 -0
- package/dist/stories/DataDisplay/Table.stories.tsx +346 -0
- package/dist/stories/DataDisplay/ThemeIcon.stories.tsx +125 -0
- package/dist/stories/Inputs/Checkbox.stories.tsx +263 -0
- package/dist/stories/Inputs/ColorInput.stories.tsx +434 -0
- package/dist/stories/Inputs/DropZone.stories.tsx +401 -0
- package/dist/stories/Inputs/FileInput.stories.tsx +383 -0
- package/dist/stories/Inputs/NumberInput.stories.tsx +342 -0
- package/dist/stories/Inputs/Radio.stories.tsx +437 -0
- package/dist/stories/Inputs/RadioGroup.stories.tsx +526 -0
- package/dist/stories/Inputs/SegmentedControl.stories.tsx +60 -0
- package/dist/stories/Inputs/Slider.stories.tsx +22 -0
- package/dist/stories/Inputs/SliderWithLabel.stories.tsx +37 -0
- package/dist/stories/Inputs/Switch.stories.tsx +361 -0
- package/dist/stories/Inputs/TextArea.stories.tsx +355 -0
- package/dist/stories/Inputs/TextInput.stories.tsx +266 -0
- package/dist/stories/Misc/Divider.stories.tsx +581 -0
- package/dist/stories/Misc/Paper.stories.tsx +557 -0
- package/dist/stories/Navigation/Breadcrumb.stories.tsx +489 -0
- package/dist/stories/Navigation/NavLink.stories.tsx +601 -0
- package/dist/stories/Navigation/Stepper.stories.tsx +413 -0
- package/dist/stories/Navigation/Tabs.stories.tsx +528 -0
- package/dist/stories/Overlays/Drawer.stories.tsx +802 -0
- package/dist/stories/Overlays/Menu.stories.tsx +941 -0
- package/dist/stories/Overlays/Modal.stories.tsx +249 -0
- package/dist/stories/Overlays/Popover.stories.tsx +780 -0
- package/dist/stories/Overlays/Tooltip.stories.tsx +52 -0
- package/dist/stories/Typography/Code.stories.tsx +368 -0
- package/dist/stories/Typography/Kbd.stories.tsx +514 -0
- package/dist/stories/Typography/Text.stories.tsx +117 -0
- package/dist/stories/Typography/Title.stories.tsx +112 -0
- package/dist/stories/index.json +1435 -0
- package/dist/types.js +127 -0
- package/package.json +12 -7
- package/dist/ComplexComponents/PageContentHeader/DescriptionBlock.tsx +0 -65
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Slider as MantineSlider } from '@mantine/core';
|
|
5
|
+
/**
|
|
6
|
+
* Slider component with consistent design system styling.
|
|
7
|
+
* Built on top of Mantine's Slider component with enforced xl radius.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: Prefer using Mantine's built-in props over CSS overrides when possible.
|
|
10
|
+
* Only add CSS overrides as a last resort when built-in props don't achieve the desired result.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Basic slider
|
|
15
|
+
* <Slider label="Volume" defaultValue={50} />
|
|
16
|
+
*
|
|
17
|
+
* // Optional field (shows gray optional text)
|
|
18
|
+
* <Slider label="Opacity" showOptional min={0} max={100} />
|
|
19
|
+
*
|
|
20
|
+
* // With min/max and step
|
|
21
|
+
* <Slider
|
|
22
|
+
* label="Rating"
|
|
23
|
+
* min={1}
|
|
24
|
+
* max={10}
|
|
25
|
+
* step={0.5}
|
|
26
|
+
* defaultValue={5}
|
|
27
|
+
* marks={[
|
|
28
|
+
* { value: 1, label: '1' },
|
|
29
|
+
* { value: 5, label: '5' },
|
|
30
|
+
* { value: 10, label: '10' }
|
|
31
|
+
* ]}
|
|
32
|
+
* />
|
|
33
|
+
*
|
|
34
|
+
* // Range slider
|
|
35
|
+
* <Slider
|
|
36
|
+
* label="Price Range"
|
|
37
|
+
* min={0}
|
|
38
|
+
* max={1000}
|
|
39
|
+
* defaultValue={[200, 800]}
|
|
40
|
+
* />
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const Slider = ({ label, showOptional = false, ...props }) => {
|
|
44
|
+
// Create the label with optional indicator if needed
|
|
45
|
+
const labelWithOptional = showOptional && label
|
|
46
|
+
? `${label} (Optional)`
|
|
47
|
+
: label;
|
|
48
|
+
return (_jsx(MantineSlider, { label: labelWithOptional, radius: "xl", ...props }));
|
|
49
|
+
};
|
|
50
|
+
export default Slider;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { InputWrapper } from '@mantine/core';
|
|
5
|
+
import { Slider } from './Slider.js';
|
|
6
|
+
/**
|
|
7
|
+
* SliderWithLabel Component
|
|
8
|
+
*
|
|
9
|
+
* A Slider with a static field label above it (e.g. "Volume *"), matching
|
|
10
|
+
* the label treatment used by TextInput/NumberInput/etc. Uses Mantine's
|
|
11
|
+
* own Input.Wrapper so the label/required/error styling is identical to
|
|
12
|
+
* every other labeled input in the DS — not a bespoke label implementation.
|
|
13
|
+
*
|
|
14
|
+
* Not to be confused with Slider's own `label` prop, which is Mantine's
|
|
15
|
+
* floating value tooltip shown above the thumb while dragging — a
|
|
16
|
+
* different concept from this component's static field label.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <SliderWithLabel fieldLabel="Volume" required defaultValue={40} />
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <SliderWithLabel
|
|
23
|
+
* fieldLabel="Price Range"
|
|
24
|
+
* description="Set your budget"
|
|
25
|
+
* min={0}
|
|
26
|
+
* max={1000}
|
|
27
|
+
* defaultValue={[200, 800]}
|
|
28
|
+
* />
|
|
29
|
+
*/
|
|
30
|
+
export function SliderWithLabel({ fieldLabel, required, description, error, ...sliderProps }) {
|
|
31
|
+
return (_jsx(InputWrapper, { label: fieldLabel, description: description, error: error, required: required, withAsterisk: required, children: _jsx(Slider, { ...sliderProps }) }));
|
|
32
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Switch as MantineSwitch } from '@mantine/core';
|
|
5
|
+
/**
|
|
6
|
+
* Switch component with consistent design system styling.
|
|
7
|
+
* Built on top of Mantine's Switch component with enforced green color and xl radius.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: Prefer using Mantine's built-in props over CSS overrides when possible.
|
|
10
|
+
* Only add CSS overrides as a last resort when built-in props don't achieve the desired result.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Basic switch
|
|
15
|
+
* <Switch label="Enable notifications" />
|
|
16
|
+
*
|
|
17
|
+
* // Different sizes
|
|
18
|
+
* <Switch label="Small" size="sm" />
|
|
19
|
+
* <Switch label="Large" size="lg" />
|
|
20
|
+
*
|
|
21
|
+
* // Optional field (shows gray optional text)
|
|
22
|
+
* <Switch label="Auto-save" showOptional />
|
|
23
|
+
*
|
|
24
|
+
* // Controlled switch
|
|
25
|
+
* <Switch
|
|
26
|
+
* label="Dark mode"
|
|
27
|
+
* checked={darkMode}
|
|
28
|
+
* onChange={setDarkMode}
|
|
29
|
+
* />
|
|
30
|
+
*
|
|
31
|
+
* // Disabled states
|
|
32
|
+
* <Switch label="Disabled" disabled />
|
|
33
|
+
* <Switch label="Disabled Checked" disabled checked />
|
|
34
|
+
*
|
|
35
|
+
* // With on/off labels inside
|
|
36
|
+
* <Switch label="Power" onLabel="ON" offLabel="OFF" />
|
|
37
|
+
* <Switch label="WiFi" onLabel="CONNECTED" offLabel="DISCONNECTED" />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export const Switch = ({ label, showOptional = false, ...props }) => {
|
|
41
|
+
// Create the label with optional indicator if needed
|
|
42
|
+
const labelWithOptional = showOptional && label
|
|
43
|
+
? `${label} (Optional)`
|
|
44
|
+
: label;
|
|
45
|
+
return (_jsx(MantineSwitch, { label: labelWithOptional, color: "green", radius: "xl", ...props }));
|
|
46
|
+
};
|
|
47
|
+
export default Switch;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Textarea as MantineTextarea, ActionIcon, Group } from '@mantine/core';
|
|
5
|
+
import { IconInfoCircle } from '@tabler/icons-react';
|
|
6
|
+
import { Text } from '../Typography/Text.js';
|
|
7
|
+
import { Tooltip } from '../Overlays/Tooltip.js';
|
|
8
|
+
// ========================== COMPONENT ==========================
|
|
9
|
+
/**
|
|
10
|
+
* AppDirect Design System TextArea Component
|
|
11
|
+
*
|
|
12
|
+
* A multi-line text input built on top of Mantine's Textarea with
|
|
13
|
+
* consistent design system styling and enforced radius.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <TextArea label="Comments" placeholder="Enter your comments..." />
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <TextArea
|
|
23
|
+
* label="Description"
|
|
24
|
+
* placeholder="Add more details"
|
|
25
|
+
* minRows={3}
|
|
26
|
+
* maxRows={10}
|
|
27
|
+
* autosize
|
|
28
|
+
* showOptional
|
|
29
|
+
* hasHelpIcon
|
|
30
|
+
* helpIconLabel="Provide a detailed description"
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export const TextArea = forwardRef(({ size = 'md', showOptional = false, required, label, hasHelpIcon = false, helpIconLabel, onHelpIconClick, rightSection, error, errorCaption, ...props }, ref) => {
|
|
35
|
+
const effectiveError = error === true ? (errorCaption ?? true) : error;
|
|
36
|
+
const enhancedLabel = React.useMemo(() => {
|
|
37
|
+
if (!label)
|
|
38
|
+
return label;
|
|
39
|
+
if (showOptional && !required) {
|
|
40
|
+
return (_jsxs(_Fragment, { children: [label, " ", _jsx(Text, { span: true, c: "dimmed", fw: "normal", children: "(Optional)" })] }));
|
|
41
|
+
}
|
|
42
|
+
return label;
|
|
43
|
+
}, [label, showOptional, required]);
|
|
44
|
+
const helpIconElement = hasHelpIcon ? (_jsx(Tooltip, { label: helpIconLabel ?? 'Help', position: "top", withArrow: true, children: _jsx(ActionIcon, { variant: "transparent", size: "xs", "aria-label": helpIconLabel ?? 'Help', onClick: onHelpIconClick, color: "gray", style: { cursor: onHelpIconClick ? 'pointer' : 'default' }, children: _jsx(IconInfoCircle, { size: 14, "aria-hidden": true }) }) })) : null;
|
|
45
|
+
const composedRightSection = (helpIconElement && rightSection)
|
|
46
|
+
? _jsxs(Group, { gap: 4, wrap: "nowrap", children: [rightSection, helpIconElement] })
|
|
47
|
+
: helpIconElement || rightSection;
|
|
48
|
+
return (_jsx(MantineTextarea, { ref: ref, size: size, radius: "sm", required: required, label: enhancedLabel, rightSection: composedRightSection, error: effectiveError, ...props }));
|
|
49
|
+
});
|
|
50
|
+
TextArea.displayName = 'TextArea';
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { TextInput as MantineTextInput, ActionIcon, Group } from '@mantine/core';
|
|
5
|
+
import { IconInfoCircle } from '@tabler/icons-react';
|
|
6
|
+
import { Text } from '../Typography/Text.js';
|
|
7
|
+
import { Tooltip } from '../Overlays/Tooltip.js';
|
|
8
|
+
/**
|
|
9
|
+
* AppDirect Design System TextInput Component
|
|
10
|
+
*
|
|
11
|
+
* A clean text input component built on top of Mantine's TextInput with
|
|
12
|
+
* consistent design system styling and enforced radius.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Basic usage (no indication)
|
|
17
|
+
* <TextInput label="Name" placeholder="Enter your name" />
|
|
18
|
+
*
|
|
19
|
+
* // Required field (shows asterisk)
|
|
20
|
+
* <TextInput
|
|
21
|
+
* label="Email"
|
|
22
|
+
* placeholder="Enter email"
|
|
23
|
+
* required
|
|
24
|
+
* />
|
|
25
|
+
*
|
|
26
|
+
* // Optional field (shows "(Optional)")
|
|
27
|
+
* <TextInput
|
|
28
|
+
* label="Phone"
|
|
29
|
+
* placeholder="Enter phone"
|
|
30
|
+
* showOptional
|
|
31
|
+
* />
|
|
32
|
+
*
|
|
33
|
+
* // With error
|
|
34
|
+
* <TextInput
|
|
35
|
+
* label="Password"
|
|
36
|
+
* error="Password is required"
|
|
37
|
+
* />
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* // Different sizes
|
|
43
|
+
* <TextInput size="xs" placeholder="Extra small" />
|
|
44
|
+
* <TextInput size="sm" placeholder="Small" />
|
|
45
|
+
* <TextInput size="md" placeholder="Medium" />
|
|
46
|
+
* <TextInput size="lg" placeholder="Large" />
|
|
47
|
+
* <TextInput size="xl" placeholder="Extra large" />
|
|
48
|
+
*
|
|
49
|
+
* // With icons
|
|
50
|
+
* <TextInput
|
|
51
|
+
* leftSection={<IconUser />}
|
|
52
|
+
* placeholder="Username"
|
|
53
|
+
* />
|
|
54
|
+
*
|
|
55
|
+
* // With help icon tooltip (hover)
|
|
56
|
+
* <TextInput
|
|
57
|
+
* label="API Key"
|
|
58
|
+
* hasHelpIcon
|
|
59
|
+
* helpIconLabel="Your API key can be found in account settings"
|
|
60
|
+
* />
|
|
61
|
+
*
|
|
62
|
+
* // With help icon click handler
|
|
63
|
+
* <TextInput
|
|
64
|
+
* label="API Key"
|
|
65
|
+
* hasHelpIcon
|
|
66
|
+
* helpIconLabel="Learn more about API keys"
|
|
67
|
+
* onHelpIconClick={() => openHelpDrawer()}
|
|
68
|
+
* />
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export const TextInput = forwardRef(({ size = 'md', leftSection, rightSection, showOptional = false, required, label, hasHelpIcon = false, helpIconLabel, onHelpIconClick, error, errorCaption, ...props }, ref) => {
|
|
72
|
+
const effectiveError = error === true ? (errorCaption ?? true) : error;
|
|
73
|
+
const enhancedLabel = React.useMemo(() => {
|
|
74
|
+
if (!label)
|
|
75
|
+
return label;
|
|
76
|
+
if (showOptional && !required) {
|
|
77
|
+
return (_jsxs(_Fragment, { children: [label, " ", _jsx(Text, { span: true, c: "dimmed", fw: "normal", children: "(Optional)" })] }));
|
|
78
|
+
}
|
|
79
|
+
return label;
|
|
80
|
+
}, [label, showOptional, required]);
|
|
81
|
+
const helpIconElement = hasHelpIcon ? (_jsx(Tooltip, { label: helpIconLabel ?? 'Help', position: "top", withArrow: true, children: _jsx(ActionIcon, { variant: "transparent", size: "xs", "aria-label": helpIconLabel ?? 'Help', onClick: onHelpIconClick, color: "gray", style: { cursor: onHelpIconClick ? 'pointer' : 'default' }, children: _jsx(IconInfoCircle, { size: 14, "aria-hidden": true }) }) })) : null;
|
|
82
|
+
const composedRightSection = (helpIconElement && rightSection)
|
|
83
|
+
? _jsxs(Group, { gap: 4, wrap: "nowrap", children: [rightSection, helpIconElement] })
|
|
84
|
+
: helpIconElement || rightSection;
|
|
85
|
+
return (_jsx(MantineTextInput, { ref: ref, size: size, radius: "sm", required: required, leftSection: leftSection, rightSection: composedRightSection, label: enhancedLabel, error: effectiveError, ...props }));
|
|
86
|
+
});
|
|
87
|
+
TextInput.displayName = 'TextInput';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input Components
|
|
3
|
+
*
|
|
4
|
+
* Form input components with consistent styling and behavior.
|
|
5
|
+
*/
|
|
6
|
+
export { TextInput } from './TextInput.js';
|
|
7
|
+
export { TextArea } from './TextArea.js';
|
|
8
|
+
export { NumberInput } from './NumberInput.js';
|
|
9
|
+
export { ColorInput } from './ColorInput.js';
|
|
10
|
+
export { Slider } from './Slider.js';
|
|
11
|
+
export { SliderWithLabel } from './SliderWithLabel.js';
|
|
12
|
+
export { Switch } from './Switch.js';
|
|
13
|
+
export { SegmentedControl } from './SegmentedControl.js';
|
|
14
|
+
export { Checkbox } from './Checkbox.js';
|
|
15
|
+
export { Radio } from './Radio.js';
|
|
16
|
+
export { RadioGroup } from './RadioGroup.js';
|
|
17
|
+
export { DropZone } from './DropZone.js';
|
|
18
|
+
export { FileInput } from './FileInput.js';
|
|
19
|
+
// Future input component exports will go here:
|
|
20
|
+
// export { ADDSCheckbox } from './Checkbox.js';
|
|
21
|
+
// export { ADDSNumberInput } from './NumberInput.js';
|
|
22
|
+
// export { ADDSTextarea } from './Textarea';
|
|
23
|
+
// export { ADDSSwitch } from './Switch.js';
|
|
24
|
+
// export { ADDSSlider } from './Slider.js';
|
|
25
|
+
// export { ADDSRadio } from './Radio.js';
|
|
26
|
+
// export { ADDSSegmentedControl } from './SegmentedControl.js';
|
|
27
|
+
// export { ADDSChip } from './Chip';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Box as MantineBox } from '@mantine/core';
|
|
5
|
+
/**
|
|
6
|
+
* AppDirect Design System Box Component
|
|
7
|
+
*
|
|
8
|
+
* A flexible container primitive that provides easy access to design system tokens
|
|
9
|
+
* for spacing, colors, and other styling properties. Built on top of Mantine's Box.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // Basic container with padding
|
|
14
|
+
* <Box p="md">
|
|
15
|
+
* <Text>Content with medium padding</Text>
|
|
16
|
+
* </Box>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // Styled container with background and radius
|
|
22
|
+
* <Box p="lg" bg="gray.1" radius="md">
|
|
23
|
+
* <Title>Card-like container</Title>
|
|
24
|
+
* <Text>With background and rounded corners</Text>
|
|
25
|
+
* </Box>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // Polymorphic usage as different elements
|
|
31
|
+
* <Box component="section" p="xl" m="md">
|
|
32
|
+
* <Text>Semantic section element</Text>
|
|
33
|
+
* </Box>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export const Box = forwardRef(({ p, m, bg, c, children, ...props }, ref) => {
|
|
37
|
+
return (_jsx(MantineBox, { ref: ref, p: p, m: m, bg: bg, c: c, ...props, children: children }));
|
|
38
|
+
});
|
|
39
|
+
Box.displayName = 'Box';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Center as MantineCenter } from '@mantine/core';
|
|
5
|
+
/**
|
|
6
|
+
* AppDirect Design System Center Component
|
|
7
|
+
*
|
|
8
|
+
* Centers content horizontally and vertically using Mantine's Center API.
|
|
9
|
+
*/
|
|
10
|
+
export const Center = forwardRef(({ ...props }, ref) => _jsx(MantineCenter, { ref: ref, ...props }));
|
|
11
|
+
Center.displayName = 'Center';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Container as MantineContainer } from '@mantine/core';
|
|
5
|
+
/**
|
|
6
|
+
* AppDirect Design System Container Component
|
|
7
|
+
*
|
|
8
|
+
* Centers content and constrains max width using Mantine's Container API.
|
|
9
|
+
*/
|
|
10
|
+
export const Container = forwardRef(({ ...props }, ref) => _jsx(MantineContainer, { ref: ref, ...props }));
|
|
11
|
+
Container.displayName = 'Container';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Flex as MantineFlex } from '@mantine/core';
|
|
5
|
+
/**
|
|
6
|
+
* AppDirect Design System Flex Component
|
|
7
|
+
*
|
|
8
|
+
* A lower-level flexbox primitive aligned with Mantine's Flex API. Use it when
|
|
9
|
+
* Group or Stack are not expressive enough for the desired layout.
|
|
10
|
+
*/
|
|
11
|
+
export const Flex = forwardRef(({ ...props }, ref) => _jsx(MantineFlex, { ref: ref, ...props }));
|
|
12
|
+
Flex.displayName = 'Flex';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Grid as MantineGrid, } from '@mantine/core';
|
|
5
|
+
/**
|
|
6
|
+
* AppDirect Design System Grid Component
|
|
7
|
+
*
|
|
8
|
+
* A responsive 12-column grid aligned with Mantine's Grid API. Use `Grid.Col`
|
|
9
|
+
* when layouts need explicit spans instead of equal-width columns.
|
|
10
|
+
*/
|
|
11
|
+
export const Grid = forwardRef(({ ...props }, ref) => _jsx(MantineGrid, { ref: ref, ...props }));
|
|
12
|
+
Grid.displayName = 'Grid';
|
|
13
|
+
Grid.Col = MantineGrid.Col;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Group as MantineGroup } from '@mantine/core';
|
|
5
|
+
/**
|
|
6
|
+
* AppDirect Design System Group Component
|
|
7
|
+
*
|
|
8
|
+
* Mantine-named alias of `Inline`. Prefer `Inline` for new Figma-mapped and
|
|
9
|
+
* prototype code so agents have one horizontal primitive.
|
|
10
|
+
*/
|
|
11
|
+
export const Group = forwardRef(({ gap = 'md', align = 'center', justify = 'flex-start', wrap = 'wrap', children, ...props }, ref) => {
|
|
12
|
+
return (_jsx(MantineGroup, { ref: ref, gap: gap, align: align, justify: justify, wrap: wrap, ...props, children: children }));
|
|
13
|
+
});
|
|
14
|
+
Group.displayName = 'Group';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Group as MantineGroup } from '@mantine/core';
|
|
5
|
+
/**
|
|
6
|
+
* AppDirect Design System Inline Component
|
|
7
|
+
*
|
|
8
|
+
* Horizontal layout primitive for new Figma-mapped and prototype code
|
|
9
|
+
* (`flex-direction: row` → `Inline`). `Group` is the Mantine-named alias of this
|
|
10
|
+
* same primitive — do not mix both in new code.
|
|
11
|
+
*
|
|
12
|
+
* Arranges children horizontally with design-system spacing. Built on Mantine Group.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Basic horizontal layout
|
|
17
|
+
* <Inline gap="md">
|
|
18
|
+
* <Button>First</Button>
|
|
19
|
+
* <Button>Second</Button>
|
|
20
|
+
* <Button>Third</Button>
|
|
21
|
+
* </Inline>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // Inline with alignment and wrapping
|
|
27
|
+
* <Inline gap="sm" align="center" wrap="wrap">
|
|
28
|
+
* <Badge>Tag 1</Badge>
|
|
29
|
+
* <Badge>Tag 2</Badge>
|
|
30
|
+
* <Badge>Tag 3</Badge>
|
|
31
|
+
* </Inline>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* // Justified inline layout
|
|
37
|
+
* <Inline justify="space-between">
|
|
38
|
+
* <Text>Left content</Text>
|
|
39
|
+
* <Button>Right action</Button>
|
|
40
|
+
* </Inline>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const Inline = forwardRef(({ gap = 'md', align = 'center', justify = 'flex-start', wrap = 'wrap', children, ...props }, ref) => {
|
|
44
|
+
return (_jsx(MantineGroup, { ref: ref, gap: gap, align: align, justify: justify, wrap: wrap, ...props, children: children }));
|
|
45
|
+
});
|
|
46
|
+
Inline.displayName = 'Inline';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { SimpleGrid as MantineSimpleGrid } from '@mantine/core';
|
|
5
|
+
/**
|
|
6
|
+
* AppDirect Design System SimpleGrid Component
|
|
7
|
+
*
|
|
8
|
+
* A responsive equal-width grid primitive aligned with Mantine's SimpleGrid
|
|
9
|
+
* naming. Use it when all columns should have the same width.
|
|
10
|
+
*/
|
|
11
|
+
export const SimpleGrid = forwardRef(({ cols = 1, spacing = 'md', verticalSpacing, children, ...props }, ref) => {
|
|
12
|
+
return (_jsx(MantineSimpleGrid, { ref: ref, cols: cols, spacing: spacing, verticalSpacing: verticalSpacing, ...props, children: children }));
|
|
13
|
+
});
|
|
14
|
+
SimpleGrid.displayName = 'SimpleGrid';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Stack as MantineStack } from '@mantine/core';
|
|
5
|
+
/**
|
|
6
|
+
* AppDirect Design System Stack Component
|
|
7
|
+
*
|
|
8
|
+
* A layout primitive that stacks child elements vertically with consistent spacing
|
|
9
|
+
* using design system tokens. Built on top of Mantine's Stack component.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // Basic vertical stack
|
|
14
|
+
* <Stack gap="md">
|
|
15
|
+
* <Text>First item</Text>
|
|
16
|
+
* <Text>Second item</Text>
|
|
17
|
+
* <Text>Third item</Text>
|
|
18
|
+
* </Stack>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* // Stack with alignment
|
|
24
|
+
* <Stack gap="lg" align="center">
|
|
25
|
+
* <Button>Centered button</Button>
|
|
26
|
+
* <Text>Centered text</Text>
|
|
27
|
+
* </Stack>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // Nested stacks with different spacing
|
|
33
|
+
* <Stack gap="xl">
|
|
34
|
+
* <Title>Main Section</Title>
|
|
35
|
+
* <Stack gap="sm">
|
|
36
|
+
* <Text>Related item 1</Text>
|
|
37
|
+
* <Text>Related item 2</Text>
|
|
38
|
+
* </Stack>
|
|
39
|
+
* </Stack>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export const Stack = forwardRef(({ gap = 'md', align = 'stretch', justify = 'flex-start', children, ...props }, ref) => {
|
|
43
|
+
return (_jsx(MantineStack, { ref: ref, gap: gap, align: align, justify: justify, ...props, children: children }));
|
|
44
|
+
});
|
|
45
|
+
Stack.displayName = 'Stack';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Layout Primitives
|
|
2
|
+
export { Stack } from './Stack.js';
|
|
3
|
+
export { Group } from './Group.js';
|
|
4
|
+
export { Inline } from './Inline.js';
|
|
5
|
+
export { Box } from './Box.js';
|
|
6
|
+
export { SimpleGrid } from './SimpleGrid.js';
|
|
7
|
+
export { Grid } from './Grid.js';
|
|
8
|
+
export { Flex } from './Flex.js';
|
|
9
|
+
export { Container } from './Container.js';
|
|
10
|
+
export { Center } from './Center.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Divider as MantineDivider } from '@mantine/core';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
export const Divider = forwardRef(({ orientation = 'horizontal', size = 'sm', ...props }, ref) => {
|
|
6
|
+
return (_jsx(MantineDivider, { ref: ref, orientation: orientation, size: size, color: "gray.4", ...props }));
|
|
7
|
+
});
|
|
8
|
+
Divider.displayName = 'Divider';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Paper as MantinePaper } from '@mantine/core';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
export const Paper = forwardRef(({ variant, children, p, shadow, withBorder, ...props }, ref) => {
|
|
6
|
+
const getVariantProps = () => {
|
|
7
|
+
switch (variant) {
|
|
8
|
+
case 'shadow':
|
|
9
|
+
return { shadow: 'xs', withBorder: false };
|
|
10
|
+
case 'border':
|
|
11
|
+
return { withBorder: true, shadow: undefined };
|
|
12
|
+
case 'border-shadow':
|
|
13
|
+
return { withBorder: true, shadow: 'xs' };
|
|
14
|
+
case 'default':
|
|
15
|
+
default:
|
|
16
|
+
return { withBorder: false, shadow: undefined };
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const variantProps = getVariantProps();
|
|
20
|
+
const resolvedShadow = shadow ?? variantProps.shadow;
|
|
21
|
+
const resolvedWithBorder = withBorder ?? variantProps.withBorder;
|
|
22
|
+
return (_jsx(MantinePaper, { ref: ref, p: p, shadow: resolvedShadow, withBorder: resolvedWithBorder, ...props, children: children }));
|
|
23
|
+
});
|
|
24
|
+
Paper.displayName = 'Paper';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Miscellaneous Components
|
|
3
|
+
*
|
|
4
|
+
* Utility components for layout, spacing, and other miscellaneous purposes
|
|
5
|
+
*/
|
|
6
|
+
export { Divider } from './Divider.js';
|
|
7
|
+
export { Paper } from './Paper.js';
|
|
8
|
+
// Future misc component exports will go here:
|
|
9
|
+
// export { Portal } from './Portal';
|
|
10
|
+
// export { Transition } from './Transition';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Breadcrumbs as MantineBreadcrumbs, Anchor, Text, Group } from '@mantine/core';
|
|
5
|
+
import { IconChevronLeft } from '@tabler/icons-react';
|
|
6
|
+
// ========================== COMPONENTS ==========================
|
|
7
|
+
/**
|
|
8
|
+
* Standard Breadcrumb Component
|
|
9
|
+
*
|
|
10
|
+
* Built on top of Mantine's Breadcrumbs component with design system styling.
|
|
11
|
+
* Displays a navigation breadcrumb with clickable links and separators.
|
|
12
|
+
* The last item is rendered as plain text with `aria-current="page"` to
|
|
13
|
+
* represent the current page both visually and semantically.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <Breadcrumb
|
|
17
|
+
* items={[
|
|
18
|
+
* { label: 'Home', href: '/' },
|
|
19
|
+
* { label: 'Products', href: '/products' },
|
|
20
|
+
* { label: 'Details' }
|
|
21
|
+
* ]}
|
|
22
|
+
* />
|
|
23
|
+
*/
|
|
24
|
+
export const Breadcrumb = forwardRef(({ items, separator = '/', ...props }, ref) => {
|
|
25
|
+
if (!items || items.length === 0) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const breadcrumbItems = items.map((item, index) => {
|
|
29
|
+
const isLast = index === items.length - 1;
|
|
30
|
+
if (isLast) {
|
|
31
|
+
return (_jsx(Text, { component: "span", "aria-current": "page", children: item.label }, item.label));
|
|
32
|
+
}
|
|
33
|
+
if (item.href) {
|
|
34
|
+
return (_jsx(Anchor, { href: item.href, children: item.label }, item.label));
|
|
35
|
+
}
|
|
36
|
+
return (_jsx(Anchor, { component: "button", onClick: item.onClick, children: item.label }, item.label));
|
|
37
|
+
});
|
|
38
|
+
return (_jsx(MantineBreadcrumbs, { ref: ref, separator: separator, "aria-label": "breadcrumb", ...props, children: breadcrumbItems }));
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Back Breadcrumb Component
|
|
42
|
+
*
|
|
43
|
+
* Displays a simple back navigation with a chevron icon and label.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* <BackBreadcrumb
|
|
47
|
+
* label="Back to Products"
|
|
48
|
+
* onClick={() => router.back()}
|
|
49
|
+
* />
|
|
50
|
+
*/
|
|
51
|
+
export const BackBreadcrumb = forwardRef(({ label = 'Back', onClick, href, className, 'aria-label': ariaLabel }, ref) => {
|
|
52
|
+
const content = (_jsxs(Group, { gap: 4, wrap: "nowrap", children: [_jsx(IconChevronLeft, { size: 16 }), _jsx("span", { children: label })] }));
|
|
53
|
+
if (href) {
|
|
54
|
+
return (_jsx(Anchor, { ref: ref, href: href, className: className, "aria-label": ariaLabel, children: content }));
|
|
55
|
+
}
|
|
56
|
+
return (_jsx(Anchor, { ref: ref, component: "button", className: className, onClick: onClick, "aria-label": ariaLabel, children: content }));
|
|
57
|
+
});
|
|
58
|
+
Breadcrumb.displayName = 'Breadcrumb';
|
|
59
|
+
BackBreadcrumb.displayName = 'BackBreadcrumb';
|
|
60
|
+
export default Breadcrumb;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { NavLink as MantineNavLink } from '@mantine/core';
|
|
5
|
+
// ========================== COMPONENT ==========================
|
|
6
|
+
/**
|
|
7
|
+
* NavLink Component
|
|
8
|
+
*
|
|
9
|
+
* Thin wrapper around Mantine's NavLink. Used for navigation items
|
|
10
|
+
* in menus and sidebars.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <NavLink
|
|
14
|
+
* leftSection={<RiHomeLine size={18} />}
|
|
15
|
+
* label="Dashboard"
|
|
16
|
+
* onClick={() => navigate('/dashboard')}
|
|
17
|
+
* />
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <NavLink
|
|
21
|
+
* leftSection={<RiSettingsLine size={18} />}
|
|
22
|
+
* label="Settings"
|
|
23
|
+
* description="Manage your preferences"
|
|
24
|
+
* active
|
|
25
|
+
* />
|
|
26
|
+
*/
|
|
27
|
+
export const NavLink = forwardRef((props, ref) => _jsx(MantineNavLink, { ref: ref, ...props }));
|
|
28
|
+
NavLink.displayName = 'NavLink';
|