@appdirect/design-system 0.0.2 → 0.0.4
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,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
|
+
}
|
package/dist/Inputs/index.ts
CHANGED
|
@@ -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
|
|
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';
|
|
@@ -33,8 +33,8 @@ import { DataTable } from './ComplexComponents/DataTable';
|
|
|
33
33
|
import { DashboardWidget } from './ComplexComponents/DashboardWidget';
|
|
34
34
|
|
|
35
35
|
// ========================== 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';
|
|
36
|
+
export { TextInput, TextArea, NumberInput, ColorInput, Slider, SliderWithLabel, Switch, SegmentedControl, Checkbox, Radio, RadioGroup, DropZone, FileInput } from './Inputs';
|
|
37
|
+
export type { DSTextInputProps, DSTextAreaProps, DSNumberInputProps, DSColorInputProps, DSSliderProps, SliderWithLabelProps, DSSwitchProps, DSSegmentedControlProps, DSCheckboxProps, DSRadioProps, DSRadioGroupProps, DropZoneProps, DSFileInputProps } from './Inputs';
|
|
38
38
|
|
|
39
39
|
// ========================== BUTTONS ==========================
|
|
40
40
|
export { Button, ActionIcon, CloseButton } from './Buttons';
|
|
@@ -106,6 +106,7 @@ export const Inputs = {
|
|
|
106
106
|
NumberInput,
|
|
107
107
|
ColorInput,
|
|
108
108
|
Slider,
|
|
109
|
+
SliderWithLabel,
|
|
109
110
|
Switch,
|
|
110
111
|
SegmentedControl,
|
|
111
112
|
Checkbox,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appdirect/design-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
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.
|
|
40
|
+
"@appdirect/ad-design-tokens": "0.0.4",
|
|
41
41
|
"@mantine/dropzone": "^9.6.0",
|
|
42
42
|
"@remixicon/react": "^4.6.0",
|
|
43
43
|
"@tabler/icons-react": "^3.33.0",
|