@recursica/mantine-adapter 0.22.0 → 0.24.0
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/ARCHITECTURE.md +15 -0
- package/CHANGELOG.md +18 -0
- package/SETUP.md +78 -0
- package/USAGE.md +55 -0
- package/dist/mantine-adapter.cjs +1 -1
- package/dist/mantine-adapter.cjs.map +1 -1
- package/dist/mantine-adapter.css +1 -1
- package/dist/mantine-adapter.js +1897 -1575
- package/dist/mantine-adapter.js.map +1 -1
- package/dist/src/components/Accordion/Accordion.d.ts +4 -24
- package/dist/src/components/AssistiveElement/AssistiveElement.d.ts +1 -6
- package/dist/src/components/AutoComplete/AutoComplete.d.ts +7 -3
- package/dist/src/components/Avatar/Avatar.d.ts +2 -6
- package/dist/src/components/Badge/Badge.d.ts +2 -5
- package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +1 -2
- package/dist/src/components/Button/Button.d.ts +2 -16
- package/dist/src/components/Card/Card.d.ts +4 -6
- package/dist/src/components/Checkbox/Checkbox.d.ts +4 -4
- package/dist/src/components/Checkbox/CheckboxGroup.d.ts +7 -3
- package/dist/src/components/Chip/Chip.d.ts +1 -10
- package/dist/src/components/Container/Container.d.ts +1 -11
- package/dist/src/components/DatePicker/DatePicker.d.ts +12 -2
- package/dist/src/components/Dropdown/Dropdown.d.ts +2 -4
- package/dist/src/components/Flex/Flex.d.ts +2 -11
- package/dist/src/components/FormControlLayout/FormControlLayout.d.ts +2 -7
- package/dist/src/components/FormControlWrapper/FormControlWrapper.d.ts +1 -15
- package/dist/src/components/Group/Group.d.ts +1 -10
- package/dist/src/components/HoverCard/HoverCard.d.ts +1 -11
- package/dist/src/components/Label/Label.d.ts +1 -14
- package/dist/src/components/Link/Link.d.ts +2 -11
- package/dist/src/components/Loader/Loader.d.ts +2 -7
- package/dist/src/components/Menu/Menu.d.ts +4 -3
- package/dist/src/components/Modal/Modal.d.ts +2 -1
- package/dist/src/components/NumberInput/NumberInput.d.ts +2 -4
- package/dist/src/components/Pagination/Pagination.d.ts +2 -4
- package/dist/src/components/Panel/Panel.d.ts +2 -9
- package/dist/src/components/Popover/Popover.d.ts +1 -11
- package/dist/src/components/Radio/Radio.d.ts +4 -4
- package/dist/src/components/Radio/RadioGroup.d.ts +7 -3
- package/dist/src/components/ReadOnlyField/ReadOnlyField.d.ts +2 -10
- package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +1 -11
- package/dist/src/components/Slider/Slider.d.ts +18 -2
- package/dist/src/components/Stack/Stack.d.ts +2 -9
- package/dist/src/components/Stepper/Stepper.d.ts +2 -4
- package/dist/src/components/Switch/Switch.d.ts +4 -4
- package/dist/src/components/Switch/SwitchGroup.d.ts +7 -3
- package/dist/src/components/Table/Table.d.ts +2 -1
- package/dist/src/components/Tabs/Tabs.d.ts +2 -4
- package/dist/src/components/Text/Text.d.ts +2 -11
- package/dist/src/components/TextArea/TextArea.d.ts +2 -8
- package/dist/src/components/TextField/TextField.d.ts +7 -3
- package/dist/src/components/TimePicker/TimePicker.d.ts +2 -1
- package/dist/src/components/Timeline/Timeline.d.ts +2 -1
- package/dist/src/components/Timeline/TimelineItem.d.ts +1 -12
- package/dist/src/components/Title/Title.d.ts +1 -7
- package/dist/src/components/Toast/Toast.d.ts +1 -12
- package/dist/src/components/Tooltip/Tooltip.d.ts +1 -12
- package/dist/src/components/TransferList/TransferList.d.ts +2 -1
- package/dist/src/utils/RequireAccessibleLabel.d.ts +1 -18
- package/dist/src/utils/filterStylingProps.d.ts +1 -11
- package/dist/test.html +1 -0
- package/llms.txt +16 -0
- package/package.json +7 -3
- package/src/components/Accordion/Accordion.module.css +1 -2
- package/src/components/Accordion/Accordion.tsx +15 -28
- package/src/components/AssistiveElement/AssistiveElement.tsx +1 -6
- package/src/components/AutoComplete/AutoComplete.tsx +4 -1
- package/src/components/Avatar/Avatar.tsx +1 -5
- package/src/components/Badge/Badge.tsx +1 -4
- package/src/components/Breadcrumb/Breadcrumb.tsx +1 -2
- package/src/components/Button/Button.module.css +18 -45
- package/src/components/Button/Button.tsx +2 -16
- package/src/components/Card/Card.tsx +11 -6
- package/src/components/Checkbox/Checkbox.module.css +6 -10
- package/src/components/Checkbox/Checkbox.tsx +19 -14
- package/src/components/Checkbox/CheckboxGroup.tsx +4 -1
- package/src/components/Chip/CHIP_IMPLEMENTATION_NOTES.md +4 -1
- package/src/components/Chip/Chip.module.css +36 -28
- package/src/components/Chip/Chip.tsx +8 -15
- package/src/components/Container/Container.tsx +1 -19
- package/src/components/DatePicker/DATEPICKER_IMPLEMENTATION_NOTES.md +16 -0
- package/src/components/DatePicker/DatePicker.module.css +282 -41
- package/src/components/DatePicker/DatePicker.stories.tsx +127 -4
- package/src/components/DatePicker/DatePicker.tsx +169 -5
- package/src/components/Dropdown/Dropdown.tsx +4 -4
- package/src/components/Flex/Flex.tsx +2 -13
- package/src/components/FormControlLayout/FormControlLayout.module.css +6 -18
- package/src/components/FormControlLayout/FormControlLayout.tsx +4 -8
- package/src/components/FormControlWrapper/FormControlWrapper.module.css +1 -0
- package/src/components/FormControlWrapper/FormControlWrapper.tsx +2 -15
- package/src/components/Group/Group.tsx +2 -13
- package/src/components/HoverCard/HoverCard.tsx +1 -8
- package/src/components/Label/Label.module.css +5 -10
- package/src/components/Label/Label.tsx +1 -14
- package/src/components/Link/Link.module.css +4 -3
- package/src/components/Link/Link.stories.tsx +2 -3
- package/src/components/Link/Link.tsx +1 -10
- package/src/components/Loader/LOADER_IMPLEMENTATION_NOTES.md +1 -2
- package/src/components/Loader/Loader.module.css +4 -11
- package/src/components/Loader/Loader.tsx +1 -7
- package/src/components/Menu/Menu.tsx +5 -1
- package/src/components/Modal/Modal.tsx +3 -1
- package/src/components/NumberInput/NumberInput.tsx +4 -4
- package/src/components/Pagination/Pagination.module.css +12 -24
- package/src/components/Pagination/Pagination.stories.tsx +0 -8
- package/src/components/Pagination/Pagination.tsx +5 -4
- package/src/components/Panel/Panel.tsx +1 -8
- package/src/components/Popover/Popover.tsx +1 -8
- package/src/components/Radio/Radio.module.css +4 -10
- package/src/components/Radio/Radio.tsx +19 -14
- package/src/components/Radio/RadioGroup.tsx +4 -1
- package/src/components/ReadOnlyField/ReadOnlyField.module.css +9 -18
- package/src/components/ReadOnlyField/ReadOnlyField.tsx +4 -11
- package/src/components/SegmentedControl/SegmentedControl.module.css +20 -44
- package/src/components/SegmentedControl/SegmentedControl.tsx +1 -11
- package/src/components/Slider/IMPLEMENTATION_NOTES.md +49 -0
- package/src/components/Slider/Slider.module.css +492 -86
- package/src/components/Slider/Slider.stories.tsx +159 -4
- package/src/components/Slider/Slider.tsx +275 -4
- package/src/components/Stack/Stack.tsx +2 -11
- package/src/components/Stepper/Stepper.tsx +1 -7
- package/src/components/Switch/Switch.tsx +19 -11
- package/src/components/Switch/SwitchGroup.tsx +4 -1
- package/src/components/Table/Table.tsx +3 -1
- package/src/components/Tabs/Tabs.tsx +1 -7
- package/src/components/Text/Text.tsx +2 -16
- package/src/components/TextArea/TextArea.tsx +4 -8
- package/src/components/TextField/TextField.tsx +4 -1
- package/src/components/TimePicker/TimePicker.tsx +3 -1
- package/src/components/Timeline/Timeline.tsx +4 -1
- package/src/components/Timeline/TimelineItem.tsx +1 -12
- package/src/components/Title/Title.tsx +1 -6
- package/src/components/Toast/Toast.tsx +1 -13
- package/src/components/Tooltip/Tooltip.tsx +1 -9
- package/src/components/TransferList/TransferList.tsx +3 -1
- package/src/utils/RequireAccessibleLabel.ts +1 -12
- package/src/utils/filterStylingProps.ts +7 -20
|
@@ -1,12 +1,60 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import { Slider } from "./Slider";
|
|
3
|
-
import {
|
|
3
|
+
import { formControlArgTypes } from "../../../.storybook/commonArgTypes";
|
|
4
4
|
|
|
5
5
|
const meta: Meta<typeof Slider> = {
|
|
6
|
-
title: "UI-Kit
|
|
6
|
+
title: "UI-Kit/Slider",
|
|
7
7
|
component: Slider,
|
|
8
8
|
tags: ["autodocs"],
|
|
9
|
-
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: `
|
|
13
|
+
The \`Slider\` component wraps Mantine's Slider to support a premium design system, a bidirectional input state,
|
|
14
|
+
custom min/max labels, step indicators, and strict states like error, disabled, and read-only.
|
|
15
|
+
|
|
16
|
+
### Architecture
|
|
17
|
+
The component uses Recursica's unified \`FormControlWrapper\` and \`<WithReadOnlyWrapper>\` to render consistent form layouts (stacked, side-by-side) and read-only representations.
|
|
18
|
+
All visual properties map perfectly to token values inside \`Slider.module.css\`.
|
|
19
|
+
`,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
...formControlArgTypes,
|
|
25
|
+
disabled: {
|
|
26
|
+
control: "boolean",
|
|
27
|
+
description: "Disables both the slider track and the text input field.",
|
|
28
|
+
},
|
|
29
|
+
error: {
|
|
30
|
+
control: "text",
|
|
31
|
+
description:
|
|
32
|
+
"Places the slider in an error state with custom border/icon highlights.",
|
|
33
|
+
},
|
|
34
|
+
required: {
|
|
35
|
+
control: "boolean",
|
|
36
|
+
},
|
|
37
|
+
label: {
|
|
38
|
+
control: "text",
|
|
39
|
+
description: "Outer form control label.",
|
|
40
|
+
},
|
|
41
|
+
assistiveText: {
|
|
42
|
+
control: "text",
|
|
43
|
+
description: "Assistive text rendered below or beside the component.",
|
|
44
|
+
},
|
|
45
|
+
readOnly: {
|
|
46
|
+
control: "boolean",
|
|
47
|
+
description: "Puts the component in static read-only mode.",
|
|
48
|
+
},
|
|
49
|
+
showInput: {
|
|
50
|
+
control: "boolean",
|
|
51
|
+
description: "Controls whether the numeric input box is visible.",
|
|
52
|
+
},
|
|
53
|
+
showMinMaxLabels: {
|
|
54
|
+
control: "boolean",
|
|
55
|
+
description: "Toggles rendering of min/max labels below the track.",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
10
58
|
};
|
|
11
59
|
|
|
12
60
|
export default meta;
|
|
@@ -14,5 +62,112 @@ export default meta;
|
|
|
14
62
|
type Story = StoryObj<typeof Slider>;
|
|
15
63
|
|
|
16
64
|
export const Default: Story = {
|
|
17
|
-
|
|
65
|
+
args: {
|
|
66
|
+
label: "Auditory Threshold",
|
|
67
|
+
assistiveText: "Specify the maximum decibel frequency boundary.",
|
|
68
|
+
defaultValue: 60,
|
|
69
|
+
min: 10,
|
|
70
|
+
max: 100,
|
|
71
|
+
step: 1,
|
|
72
|
+
showMinMaxLabels: true,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const WithInputField: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
...Default.args,
|
|
79
|
+
showInput: true,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const SideBySideLayout: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
...Default.args,
|
|
86
|
+
formLayout: "side-by-side",
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const Disabled: Story = {
|
|
91
|
+
args: {
|
|
92
|
+
label: "Decommissioned Server Node",
|
|
93
|
+
assistiveText: "Modifications to this environment are frozen.",
|
|
94
|
+
defaultValue: 35,
|
|
95
|
+
disabled: false,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const ErrorState: Story = {
|
|
100
|
+
args: {
|
|
101
|
+
label: "Core Temperature Alert",
|
|
102
|
+
assistiveText:
|
|
103
|
+
"Severe core degradation across the hypervisor socket cluster.",
|
|
104
|
+
defaultValue: 85,
|
|
105
|
+
error: "Thermal overload threshold exceeded.",
|
|
106
|
+
required: true,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const StaticReadOnly: Story = {
|
|
111
|
+
args: {
|
|
112
|
+
label: "System Calibration Metrics",
|
|
113
|
+
assistiveText:
|
|
114
|
+
"Frozen baseline calibrations derived during initial staging.",
|
|
115
|
+
value: 65,
|
|
116
|
+
readOnly: true,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const EditableReadOnly: Story = {
|
|
121
|
+
args: {
|
|
122
|
+
label: "Adaptive Node Output",
|
|
123
|
+
assistiveText:
|
|
124
|
+
"Click edit to unlock bidirectional input parameter boundaries.",
|
|
125
|
+
defaultValue: 15,
|
|
126
|
+
readOnly: true,
|
|
127
|
+
labelWithEditIcon: true,
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const WithMarks: Story = {
|
|
132
|
+
args: {
|
|
133
|
+
label: "Interactive Marks Map",
|
|
134
|
+
defaultValue: 50,
|
|
135
|
+
min: 0,
|
|
136
|
+
max: 100,
|
|
137
|
+
step: 10,
|
|
138
|
+
marks: [
|
|
139
|
+
{ value: 0, label: "0%" },
|
|
140
|
+
{ value: 25, label: "25%" },
|
|
141
|
+
{ value: 50, label: "50%" },
|
|
142
|
+
{ value: 75, label: "75%" },
|
|
143
|
+
{ value: 100, label: "100%" },
|
|
144
|
+
],
|
|
145
|
+
showMinMaxLabels: false,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const FormLayouts: Story = {
|
|
150
|
+
render: () => (
|
|
151
|
+
<div
|
|
152
|
+
style={{
|
|
153
|
+
display: "flex",
|
|
154
|
+
flexDirection: "column",
|
|
155
|
+
gap: "2.5rem",
|
|
156
|
+
maxWidth: 600,
|
|
157
|
+
}}
|
|
158
|
+
>
|
|
159
|
+
<Slider
|
|
160
|
+
label="Stacked Layout"
|
|
161
|
+
assistiveText="This is the standard top-to-bottom stacked form layout."
|
|
162
|
+
defaultValue={40}
|
|
163
|
+
formLayout="stacked"
|
|
164
|
+
/>
|
|
165
|
+
<Slider
|
|
166
|
+
label="Side-by-Side Layout"
|
|
167
|
+
assistiveText="This is the side-by-side layout aligning label beside control."
|
|
168
|
+
defaultValue={60}
|
|
169
|
+
formLayout="side-by-side"
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
172
|
+
),
|
|
18
173
|
};
|
|
@@ -1,7 +1,278 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef, useState, useEffect } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Slider as MantineSlider,
|
|
4
|
+
type SliderProps as MantineSliderProps,
|
|
5
|
+
type InputWrapperProps,
|
|
6
|
+
} from "@mantine/core";
|
|
7
|
+
import { type ReadOnlyControlProps } from "@recursica/adapter-common";
|
|
8
|
+
import {
|
|
9
|
+
filterStylingProps,
|
|
10
|
+
type RecursicaOverStyled,
|
|
11
|
+
} from "../../utils/filterStylingProps";
|
|
12
|
+
import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/FormControlWrapper";
|
|
13
|
+
import { WithReadOnlyWrapper } from "../ReadOnlyField/WithReadOnlyWrapper";
|
|
2
14
|
|
|
3
|
-
|
|
15
|
+
import styles from "./Slider.module.css";
|
|
4
16
|
|
|
5
|
-
|
|
6
|
-
|
|
17
|
+
import { type RecursicaSliderProps as BaseRecursicaSliderProps } from "@recursica/adapter-common";
|
|
18
|
+
|
|
19
|
+
export interface RecursicaSliderProps
|
|
20
|
+
extends Omit<
|
|
21
|
+
MantineSliderProps,
|
|
22
|
+
| "size"
|
|
23
|
+
| "variant"
|
|
24
|
+
| "radius"
|
|
25
|
+
| "wrapperProps"
|
|
26
|
+
| "classNames"
|
|
27
|
+
| "styles"
|
|
28
|
+
| "label"
|
|
29
|
+
>,
|
|
30
|
+
Omit<
|
|
31
|
+
RecursicaFormControlWrapperProps,
|
|
32
|
+
"controlMaxWidth" | "controlMinWidth"
|
|
33
|
+
>,
|
|
34
|
+
Pick<InputWrapperProps, "error" | "required" | "withAsterisk">,
|
|
35
|
+
ReadOnlyControlProps,
|
|
36
|
+
BaseRecursicaSliderProps {}
|
|
37
|
+
|
|
38
|
+
export type SliderProps = RecursicaOverStyled<RecursicaSliderProps>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Custom Read-Only visual representation of the Slider value.
|
|
42
|
+
* Utilizes component-specific read-only typography variables.
|
|
43
|
+
*/
|
|
44
|
+
const SliderReadOnlyValue: React.FC<{ value: number }> = ({ value }) => {
|
|
45
|
+
return <div className={styles.readOnlyValue}>{value}</div>;
|
|
7
46
|
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Recursica Slider component wrapping Mantine's Slider.
|
|
50
|
+
*
|
|
51
|
+
* Implements a bidirectional text input field next to the slider track, responsive layouts,
|
|
52
|
+
* custom typography-bound min/max labels, an optional leading icon, and an explicit read-only layout.
|
|
53
|
+
*/
|
|
54
|
+
export const Slider = forwardRef<HTMLDivElement, SliderProps>(
|
|
55
|
+
function Slider(props, ref) {
|
|
56
|
+
const {
|
|
57
|
+
overStyled = false,
|
|
58
|
+
formLayout = "stacked",
|
|
59
|
+
|
|
60
|
+
// Label & Wrapper Maps
|
|
61
|
+
labelSize,
|
|
62
|
+
labelAlignment,
|
|
63
|
+
labelOptionalText,
|
|
64
|
+
labelWithEditIcon,
|
|
65
|
+
labelActionArea,
|
|
66
|
+
onLabelEditClick,
|
|
67
|
+
|
|
68
|
+
label,
|
|
69
|
+
tooltipLabel,
|
|
70
|
+
assistiveText,
|
|
71
|
+
assistiveWithIcon,
|
|
72
|
+
error,
|
|
73
|
+
required,
|
|
74
|
+
withAsterisk,
|
|
75
|
+
id,
|
|
76
|
+
className,
|
|
77
|
+
style,
|
|
78
|
+
disabled,
|
|
79
|
+
readOnly,
|
|
80
|
+
readOnlyComponent,
|
|
81
|
+
emptyValueComponent,
|
|
82
|
+
value,
|
|
83
|
+
defaultValue,
|
|
84
|
+
icon,
|
|
85
|
+
showInput = false,
|
|
86
|
+
showMinMaxLabels = true,
|
|
87
|
+
min = 0,
|
|
88
|
+
max = 100,
|
|
89
|
+
step = 1,
|
|
90
|
+
onChange,
|
|
91
|
+
onChangeEnd,
|
|
92
|
+
...rest
|
|
93
|
+
} = props;
|
|
94
|
+
|
|
95
|
+
// Bidirectional state linking the slider track value to the input field string representation
|
|
96
|
+
const [internalValue, setInternalValue] = useState<number>(() => {
|
|
97
|
+
if (value !== undefined) return value;
|
|
98
|
+
if (defaultValue !== undefined) return defaultValue;
|
|
99
|
+
return min;
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const resolvedValue = value !== undefined ? value : internalValue;
|
|
103
|
+
const [inputValue, setInputValue] = useState<string>(
|
|
104
|
+
resolvedValue.toString(),
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
// Synchronize text input whenever the slider value changes
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
setInputValue(resolvedValue.toString());
|
|
110
|
+
}, [resolvedValue]);
|
|
111
|
+
|
|
112
|
+
const handleValueChange = (val: number) => {
|
|
113
|
+
if (value === undefined) {
|
|
114
|
+
setInternalValue(val);
|
|
115
|
+
}
|
|
116
|
+
onChange?.(val);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
120
|
+
const valStr = e.target.value;
|
|
121
|
+
setInputValue(valStr);
|
|
122
|
+
|
|
123
|
+
const parsed = parseFloat(valStr);
|
|
124
|
+
if (!isNaN(parsed)) {
|
|
125
|
+
// Clamp input value to bounds
|
|
126
|
+
const clamped = Math.max(min, Math.min(max, parsed));
|
|
127
|
+
handleValueChange(clamped);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const handleInputBlur = () => {
|
|
132
|
+
// Clean up text field on blur to reflect the final clamped resolved value
|
|
133
|
+
setInputValue(resolvedValue.toString());
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
137
|
+
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
138
|
+
|
|
139
|
+
// Delete prohibited sizing hooks from bypassing variables natively
|
|
140
|
+
delete restRecord["size"];
|
|
141
|
+
delete restRecord["variant"];
|
|
142
|
+
delete restRecord["radius"];
|
|
143
|
+
delete restRecord["wrapperProps"];
|
|
144
|
+
|
|
145
|
+
// Securely map core native blocks down ensuring nested CSS modules map precisely
|
|
146
|
+
const mergedClassNames: Partial<Record<string, string>> = {
|
|
147
|
+
root: styles.sliderRoot,
|
|
148
|
+
track: styles.sliderTrack,
|
|
149
|
+
bar: styles.sliderBar,
|
|
150
|
+
thumb: styles.sliderThumb,
|
|
151
|
+
mark: styles.sliderMark,
|
|
152
|
+
markLabel: styles.sliderMarkLabel,
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const classNamesProp = restRecord.classNames;
|
|
156
|
+
if (
|
|
157
|
+
classNamesProp &&
|
|
158
|
+
typeof classNamesProp === "object" &&
|
|
159
|
+
!Array.isArray(classNamesProp)
|
|
160
|
+
) {
|
|
161
|
+
const o = classNamesProp as Partial<Record<string, string>>;
|
|
162
|
+
mergedClassNames.root = o.root
|
|
163
|
+
? `${styles.sliderRoot} ${o.root}`
|
|
164
|
+
: styles.sliderRoot;
|
|
165
|
+
mergedClassNames.track = o.track
|
|
166
|
+
? `${styles.sliderTrack} ${o.track}`
|
|
167
|
+
: styles.sliderTrack;
|
|
168
|
+
mergedClassNames.bar = o.bar
|
|
169
|
+
? `${styles.sliderBar} ${o.bar}`
|
|
170
|
+
: styles.sliderBar;
|
|
171
|
+
mergedClassNames.thumb = o.thumb
|
|
172
|
+
? `${styles.sliderThumb} ${o.thumb}`
|
|
173
|
+
: styles.sliderThumb;
|
|
174
|
+
mergedClassNames.mark = o.mark
|
|
175
|
+
? `${styles.sliderMark} ${o.mark}`
|
|
176
|
+
: styles.sliderMark;
|
|
177
|
+
mergedClassNames.markLabel = o.markLabel
|
|
178
|
+
? `${styles.sliderMarkLabel} ${o.markLabel}`
|
|
179
|
+
: styles.sliderMarkLabel;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const wrapperClass = className
|
|
183
|
+
? `${styles.layoutOverride} ${className}`
|
|
184
|
+
: styles.layoutOverride;
|
|
185
|
+
|
|
186
|
+
const leadingIcon = icon ? (
|
|
187
|
+
<span className={styles.iconWrapper} aria-hidden>
|
|
188
|
+
{icon}
|
|
189
|
+
</span>
|
|
190
|
+
) : null;
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<WithReadOnlyWrapper
|
|
194
|
+
ref={ref}
|
|
195
|
+
className={wrapperClass}
|
|
196
|
+
style={style as React.CSSProperties}
|
|
197
|
+
controlMaxWidth={undefined}
|
|
198
|
+
controlMinWidth={undefined}
|
|
199
|
+
overStyled={overStyled as true}
|
|
200
|
+
formLayout={formLayout}
|
|
201
|
+
labelSize={labelSize}
|
|
202
|
+
labelAlignment={labelAlignment}
|
|
203
|
+
labelOptionalText={labelOptionalText}
|
|
204
|
+
labelWithEditIcon={labelWithEditIcon}
|
|
205
|
+
labelActionArea={labelActionArea}
|
|
206
|
+
onLabelEditClick={onLabelEditClick}
|
|
207
|
+
label={label}
|
|
208
|
+
assistiveText={assistiveText}
|
|
209
|
+
assistiveWithIcon={assistiveWithIcon}
|
|
210
|
+
error={error}
|
|
211
|
+
required={required}
|
|
212
|
+
withAsterisk={withAsterisk}
|
|
213
|
+
id={id}
|
|
214
|
+
readOnly={readOnly}
|
|
215
|
+
readOnlyComponent={readOnlyComponent || SliderReadOnlyValue}
|
|
216
|
+
emptyValueComponent={emptyValueComponent}
|
|
217
|
+
readOnlyType="text"
|
|
218
|
+
readOnlyValue={resolvedValue}
|
|
219
|
+
readOnlyNativeProps={{ value: resolvedValue }}
|
|
220
|
+
activeComponent={
|
|
221
|
+
<div
|
|
222
|
+
className={styles.sliderContainer}
|
|
223
|
+
data-form-layout={formLayout}
|
|
224
|
+
data-disabled={disabled ? "true" : undefined}
|
|
225
|
+
data-error={error ? "true" : undefined}
|
|
226
|
+
>
|
|
227
|
+
{leadingIcon}
|
|
228
|
+
|
|
229
|
+
{showMinMaxLabels && (
|
|
230
|
+
<span className={styles.minMaxGuide}>{min}</span>
|
|
231
|
+
)}
|
|
232
|
+
|
|
233
|
+
<div className={styles.sliderTrackWrapper}>
|
|
234
|
+
<MantineSlider
|
|
235
|
+
classNames={mergedClassNames}
|
|
236
|
+
disabled={disabled}
|
|
237
|
+
value={resolvedValue}
|
|
238
|
+
onChange={handleValueChange}
|
|
239
|
+
onChangeEnd={onChangeEnd}
|
|
240
|
+
min={min}
|
|
241
|
+
max={max}
|
|
242
|
+
step={step}
|
|
243
|
+
label={tooltipLabel}
|
|
244
|
+
{...(sanitizedProps as unknown as MantineSliderProps)}
|
|
245
|
+
/>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<div className={styles.rightGuideContainer}>
|
|
249
|
+
{!showInput && (
|
|
250
|
+
<span className={styles.currentValue}>{resolvedValue}</span>
|
|
251
|
+
)}
|
|
252
|
+
{showMinMaxLabels && (
|
|
253
|
+
<span className={styles.minMaxGuide}>{max}</span>
|
|
254
|
+
)}
|
|
255
|
+
</div>
|
|
256
|
+
|
|
257
|
+
{showInput && (
|
|
258
|
+
<input
|
|
259
|
+
type="number"
|
|
260
|
+
className={styles.inputField}
|
|
261
|
+
value={inputValue}
|
|
262
|
+
onChange={handleInputChange}
|
|
263
|
+
onBlur={handleInputBlur}
|
|
264
|
+
min={min}
|
|
265
|
+
max={max}
|
|
266
|
+
step={step}
|
|
267
|
+
disabled={disabled}
|
|
268
|
+
data-error={error ? "true" : undefined}
|
|
269
|
+
/>
|
|
270
|
+
)}
|
|
271
|
+
</div>
|
|
272
|
+
}
|
|
273
|
+
/>
|
|
274
|
+
);
|
|
275
|
+
},
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
Slider.displayName = "Slider";
|
|
@@ -4,19 +4,10 @@ import {
|
|
|
4
4
|
type StackProps as MantineStackProps,
|
|
5
5
|
createPolymorphicComponent,
|
|
6
6
|
} from "@mantine/core";
|
|
7
|
-
import {
|
|
8
|
-
type RecursicaSpacing,
|
|
9
|
-
mapLayoutProps,
|
|
10
|
-
} from "../../utils/filterStylingProps";
|
|
7
|
+
import { mapLayoutProps } from "../../utils/filterStylingProps";
|
|
11
8
|
import styles from "./Stack.module.css";
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Children components inside the stack
|
|
16
|
-
*/
|
|
17
|
-
children?: React.ReactNode;
|
|
18
|
-
gap?: MantineStackProps["gap"] | RecursicaSpacing;
|
|
19
|
-
}
|
|
10
|
+
import { type RecursicaStackProps } from "@recursica/adapter-common";
|
|
20
11
|
|
|
21
12
|
/**
|
|
22
13
|
* Stack flex layout wrapper.
|
|
@@ -9,13 +9,7 @@ import {
|
|
|
9
9
|
} from "../../utils/filterStylingProps";
|
|
10
10
|
import styles from "./Stepper.module.css";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
extends Omit<
|
|
14
|
-
MantineStepperProps,
|
|
15
|
-
"size" | "color" | "radius" | "iconSize" | "contentPadding"
|
|
16
|
-
> {
|
|
17
|
-
size?: "small" | "large";
|
|
18
|
-
}
|
|
12
|
+
import { type RecursicaStepperProps } from "@recursica/adapter-common";
|
|
19
13
|
|
|
20
14
|
export type StepperProps = RecursicaOverStyled<RecursicaStepperProps>;
|
|
21
15
|
|
|
@@ -11,7 +11,10 @@ import {
|
|
|
11
11
|
filterStylingProps,
|
|
12
12
|
type RecursicaOverStyled,
|
|
13
13
|
} from "../../utils/filterStylingProps";
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
type RequireAccessibleLabel,
|
|
16
|
+
type RecursicaSwitchProps,
|
|
17
|
+
} from "@recursica/adapter-common";
|
|
15
18
|
import {
|
|
16
19
|
FormControlLayout,
|
|
17
20
|
type FormControlLayoutProps,
|
|
@@ -20,16 +23,21 @@ import styles from "./Switch.module.css";
|
|
|
20
23
|
|
|
21
24
|
import { SwitchGroup } from "./SwitchGroup";
|
|
22
25
|
|
|
23
|
-
export type
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
export type SwitchWrapperProps = Omit<
|
|
27
|
+
MantineSwitchProps,
|
|
28
|
+
"size" | "color" | "radius" | "variant"
|
|
29
|
+
> &
|
|
30
|
+
RecursicaSwitchProps &
|
|
31
|
+
ReadOnlyControlProps &
|
|
32
|
+
Pick<
|
|
33
|
+
FormControlLayoutProps,
|
|
34
|
+
"formLayout" | "labelSize" | "controlMaxWidth" | "controlMinWidth"
|
|
35
|
+
>;
|
|
36
|
+
|
|
37
|
+
export type RecursicaSwitchPropsAlias =
|
|
38
|
+
RequireAccessibleLabel<SwitchWrapperProps>;
|
|
39
|
+
|
|
40
|
+
export type SwitchProps = RecursicaOverStyled<RecursicaSwitchPropsAlias>;
|
|
33
41
|
|
|
34
42
|
type SwitchComponent = React.ForwardRefExoticComponent<
|
|
35
43
|
SwitchProps & React.RefAttributes<HTMLInputElement>
|
|
@@ -13,13 +13,16 @@ import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/For
|
|
|
13
13
|
import { WithReadOnlyWrapper } from "../ReadOnlyField/WithReadOnlyWrapper";
|
|
14
14
|
import styles from "./Switch.module.css";
|
|
15
15
|
|
|
16
|
+
import { type RecursicaSwitchGroupProps as BaseRecursicaSwitchGroupProps } from "@recursica/adapter-common";
|
|
17
|
+
|
|
16
18
|
export interface RecursicaSwitchGroupProps
|
|
17
19
|
extends Omit<MantineSwitchGroupProps, "size" | "labelProps">,
|
|
18
20
|
Omit<
|
|
19
21
|
RecursicaFormControlWrapperProps,
|
|
20
22
|
"controlMaxWidth" | "controlMinWidth"
|
|
21
23
|
>,
|
|
22
|
-
ReadOnlyControlProps
|
|
24
|
+
ReadOnlyControlProps,
|
|
25
|
+
BaseRecursicaSwitchGroupProps {}
|
|
23
26
|
|
|
24
27
|
export type SwitchGroupProps = RecursicaOverStyled<RecursicaSwitchGroupProps>;
|
|
25
28
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { type RecursicaTableProps } from "@recursica/adapter-common";
|
|
2
3
|
|
|
3
|
-
export type TableProps = React.HTMLAttributes<HTMLDivElement
|
|
4
|
+
export type TableProps = React.HTMLAttributes<HTMLDivElement> &
|
|
5
|
+
RecursicaTableProps;
|
|
4
6
|
|
|
5
7
|
export const Table: React.FC<TableProps> = (props) => {
|
|
6
8
|
return <div {...props}>Table</div>;
|
|
@@ -12,13 +12,7 @@ import {
|
|
|
12
12
|
} from "../../utils/filterStylingProps";
|
|
13
13
|
import styles from "./Tabs.module.css";
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
extends Omit<
|
|
17
|
-
MantineTabsProps,
|
|
18
|
-
"variant" | "classNames" | "color" | "radius"
|
|
19
|
-
> {
|
|
20
|
-
variant?: "default" | "outline" | "pills";
|
|
21
|
-
}
|
|
15
|
+
import { type RecursicaTabsProps } from "@recursica/adapter-common";
|
|
22
16
|
|
|
23
17
|
export type TabsProps = RecursicaOverStyled<RecursicaTabsProps>;
|
|
24
18
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
2
|
import {
|
|
3
3
|
Text as MantineText,
|
|
4
4
|
type TextProps as MantineTextProps,
|
|
@@ -9,21 +9,7 @@ import {
|
|
|
9
9
|
type RecursicaOverStyled,
|
|
10
10
|
} from "../../utils/filterStylingProps";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
| "body"
|
|
14
|
-
| "body-small"
|
|
15
|
-
| "caption"
|
|
16
|
-
| "overline"
|
|
17
|
-
| "subtitle"
|
|
18
|
-
| "subtitle-small";
|
|
19
|
-
|
|
20
|
-
export type RecursicaTextProps = Omit<MantineTextProps, "variant"> & {
|
|
21
|
-
/**
|
|
22
|
-
* The explicit typography hierarchy dictated by Recursica's global design tokens.
|
|
23
|
-
*/
|
|
24
|
-
variant?: TextVariant;
|
|
25
|
-
children?: ReactNode;
|
|
26
|
-
};
|
|
12
|
+
import { type RecursicaTextProps } from "@recursica/adapter-common";
|
|
27
13
|
|
|
28
14
|
export type TextProps = RecursicaOverStyled<RecursicaTextProps>;
|
|
29
15
|
|
|
@@ -12,6 +12,8 @@ import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/For
|
|
|
12
12
|
import { WithReadOnlyWrapper } from "../ReadOnlyField/WithReadOnlyWrapper";
|
|
13
13
|
import styles from "./TextArea.module.css";
|
|
14
14
|
|
|
15
|
+
import { type RecursicaTextAreaProps as BaseRecursicaTextAreaProps } from "@recursica/adapter-common";
|
|
16
|
+
|
|
15
17
|
export interface RecursicaTextAreaProps
|
|
16
18
|
extends Omit<
|
|
17
19
|
MantineTextareaProps,
|
|
@@ -28,14 +30,8 @@ export interface RecursicaTextAreaProps
|
|
|
28
30
|
| "labelWithEditIcon"
|
|
29
31
|
| "onLabelEditClick"
|
|
30
32
|
>,
|
|
31
|
-
ReadOnlyControlProps
|
|
32
|
-
|
|
33
|
-
maxRows?: number;
|
|
34
|
-
/** Minimum rows of autosize textarea */
|
|
35
|
-
minRows?: number;
|
|
36
|
-
/** If set, enables textarea height growing with its content */
|
|
37
|
-
autosize?: boolean;
|
|
38
|
-
}
|
|
33
|
+
ReadOnlyControlProps,
|
|
34
|
+
BaseRecursicaTextAreaProps {}
|
|
39
35
|
|
|
40
36
|
export type TextAreaProps = RecursicaOverStyled<RecursicaTextAreaProps>;
|
|
41
37
|
|
|
@@ -9,6 +9,8 @@ import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/For
|
|
|
9
9
|
import { WithReadOnlyWrapper } from "../ReadOnlyField/WithReadOnlyWrapper";
|
|
10
10
|
import styles from "./TextField.module.css";
|
|
11
11
|
|
|
12
|
+
import { type RecursicaTextFieldProps as BaseRecursicaTextFieldProps } from "@recursica/adapter-common";
|
|
13
|
+
|
|
12
14
|
export interface RecursicaTextFieldProps
|
|
13
15
|
extends Omit<InputProps, "size" | "variant" | "radius" | "wrapperProps">,
|
|
14
16
|
Pick<
|
|
@@ -23,7 +25,8 @@ export interface RecursicaTextFieldProps
|
|
|
23
25
|
RecursicaFormControlWrapperProps,
|
|
24
26
|
"controlMaxWidth" | "controlMinWidth"
|
|
25
27
|
>,
|
|
26
|
-
ReadOnlyControlProps
|
|
28
|
+
ReadOnlyControlProps,
|
|
29
|
+
BaseRecursicaTextFieldProps {}
|
|
27
30
|
|
|
28
31
|
export type TextFieldProps = RecursicaOverStyled<RecursicaTextFieldProps>;
|
|
29
32
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { type RecursicaTimePickerProps } from "@recursica/adapter-common";
|
|
2
3
|
|
|
3
|
-
export type TimePickerProps = React.HTMLAttributes<HTMLDivElement
|
|
4
|
+
export type TimePickerProps = React.HTMLAttributes<HTMLDivElement> &
|
|
5
|
+
RecursicaTimePickerProps;
|
|
4
6
|
|
|
5
7
|
export const TimePicker: React.FC<TimePickerProps> = (props) => {
|
|
6
8
|
return <div {...props}>TimePicker</div>;
|
|
@@ -10,13 +10,16 @@ import {
|
|
|
10
10
|
import styles from "./Timeline.module.css";
|
|
11
11
|
import { TimelineItem } from "./TimelineItem";
|
|
12
12
|
|
|
13
|
+
import { type RecursicaTimelineProps } from "@recursica/adapter-common";
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* Properties for the strictly-tokenized Timeline component.
|
|
15
17
|
* Native Mantine abstract properties like `color`, `radius`, `bulletSize`, and `lineWidth`
|
|
16
18
|
* have been stripped out to strictly enforce the structural mappings of the Recursica UI Kit.
|
|
17
19
|
*/
|
|
18
20
|
export type TimelineProps = RecursicaOverStyled<
|
|
19
|
-
Omit<MantineTimelineProps, "color" | "radius" | "bulletSize" | "lineWidth">
|
|
21
|
+
Omit<MantineTimelineProps, "color" | "radius" | "bulletSize" | "lineWidth"> &
|
|
22
|
+
RecursicaTimelineProps
|
|
20
23
|
>;
|
|
21
24
|
|
|
22
25
|
interface TimelineComponent
|