@recursica/mui-adapter 0.6.0 → 0.7.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 +6 -0
- package/SETUP.md +77 -0
- package/USAGE.md +55 -0
- package/dist/mui-adapter.cjs +26 -26
- package/dist/mui-adapter.cjs.map +1 -1
- package/dist/mui-adapter.css +1 -1
- package/dist/mui-adapter.js +3721 -3511
- package/dist/mui-adapter.js.map +1 -1
- package/dist/src/components/Accordion/Accordion.d.ts +9 -29
- package/dist/src/components/AssistiveElement/AssistiveElement.d.ts +2 -5
- package/dist/src/components/Autocomplete/Autocomplete.d.ts +4 -8
- package/dist/src/components/Avatar/Avatar.d.ts +1 -6
- package/dist/src/components/Badge/Badge.d.ts +1 -4
- package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/dist/src/components/Button/Button.d.ts +2 -17
- package/dist/src/components/Card/Card.d.ts +2 -4
- package/dist/src/components/Checkbox/Checkbox.d.ts +4 -6
- package/dist/src/components/Checkbox/CheckboxGroup.d.ts +8 -6
- package/dist/src/components/Chip/Chip.d.ts +2 -11
- package/dist/src/components/Container/Container.d.ts +1 -5
- package/dist/src/components/DatePicker/DatePicker.d.ts +2 -1
- package/dist/src/components/Dropdown/Dropdown.d.ts +4 -14
- package/dist/src/components/Flex/Flex.d.ts +2 -22
- package/dist/src/components/FormControlLayout/FormControlLayout.d.ts +2 -7
- package/dist/src/components/FormControlWrapper/FormControlWrapper.d.ts +3 -18
- package/dist/src/components/Group/Group.d.ts +2 -7
- package/dist/src/components/HoverCard/HoverCard.d.ts +13 -39
- package/dist/src/components/Label/Label.d.ts +2 -9
- package/dist/src/components/Link/Link.d.ts +2 -6
- package/dist/src/components/Loader/Loader.d.ts +2 -7
- package/dist/src/components/Menu/Menu.d.ts +24 -98
- package/dist/src/components/Modal/Modal.d.ts +32 -31
- package/dist/src/components/NumberInput/NumberInput.d.ts +3 -5
- package/dist/src/components/Pagination/Pagination.d.ts +8 -41
- package/dist/src/components/Panel/Panel.d.ts +5 -18
- package/dist/src/components/Radio/Radio.d.ts +4 -4
- package/dist/src/components/Radio/RadioGroup.d.ts +3 -7
- package/dist/src/components/ReadOnlyField/ReadOnlyField.d.ts +2 -5
- package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +5 -15
- package/dist/src/components/Slider/Slider.d.ts +4 -14
- package/dist/src/components/Stack/Stack.d.ts +2 -5
- package/dist/src/components/Stepper/Stepper.d.ts +36 -16
- package/dist/src/components/Switch/Switch.d.ts +4 -4
- package/dist/src/components/Switch/SwitchGroup.d.ts +4 -4
- package/dist/src/components/Table/Table.d.ts +2 -1
- package/dist/src/components/Tabs/Tabs.d.ts +11 -26
- package/dist/src/components/Text/Text.d.ts +2 -16
- package/dist/src/components/TextArea/TextArea.d.ts +3 -9
- package/dist/src/components/TextField/TextField.d.ts +3 -7
- 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 +2 -13
- package/dist/src/components/Title/Title.d.ts +2 -15
- package/dist/src/components/Toast/Toast.d.ts +11 -16
- package/dist/src/components/Tooltip/Tooltip.d.ts +7 -21
- package/dist/src/components/TransferList/TransferList.d.ts +2 -1
- package/dist/src/components/Typography/Typography.d.ts +1 -1
- package/dist/src/utils/RequireAccessibleLabel.d.ts +1 -18
- package/dist/src/utils/filterStylingProps.d.ts +1 -11
- package/llms.txt +16 -0
- package/package.json +6 -2
- package/src/components/Accordion/Accordion.module.css +1 -2
- package/src/components/Accordion/Accordion.stories.tsx +0 -18
- package/src/components/Accordion/Accordion.tsx +19 -23
- package/src/components/AssistiveElement/AssistiveElement.module.css +32 -29
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +10 -27
- package/src/components/AssistiveElement/AssistiveElement.tsx +11 -15
- package/src/components/Autocomplete/Autocomplete.module.css +17 -18
- package/src/components/Autocomplete/Autocomplete.stories.tsx +7 -16
- package/src/components/Autocomplete/Autocomplete.tsx +27 -45
- package/src/components/Avatar/Avatar.tsx +2 -13
- package/src/components/Badge/Badge.tsx +2 -5
- package/src/components/Breadcrumb/Breadcrumb.tsx +1 -4
- package/src/components/Button/Button.module.css +19 -61
- package/src/components/Button/Button.stories.tsx +24 -23
- package/src/components/Button/Button.tsx +7 -18
- package/src/components/Card/Card.module.css +36 -0
- package/src/components/Card/Card.tsx +6 -4
- package/src/components/Checkbox/Checkbox.module.css +27 -10
- package/src/components/Checkbox/Checkbox.tsx +124 -24
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +139 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +43 -23
- package/src/components/Chip/Chip.module.css +52 -34
- package/src/components/Chip/Chip.tsx +45 -47
- package/src/components/Container/Container.stories.tsx +103 -20
- package/src/components/Container/Container.tsx +1 -13
- package/src/components/DatePicker/DatePicker.stories.tsx +125 -19
- package/src/components/DatePicker/DatePicker.tsx +3 -1
- package/src/components/Dropdown/Dropdown.tsx +7 -9
- package/src/components/FileInput/FileInput.stories.tsx +2 -19
- package/src/components/FileUpload/FileUpload.stories.tsx +2 -19
- package/src/components/Flex/Flex.stories.tsx +113 -20
- package/src/components/Flex/Flex.tsx +16 -26
- package/src/components/FormControlLayout/FormControlLayout.stories.tsx +0 -8
- package/src/components/FormControlLayout/FormControlLayout.tsx +18 -7
- package/src/components/FormControlWrapper/FormControlWrapper.module.css +1 -10
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +12 -21
- package/src/components/FormControlWrapper/FormControlWrapper.tsx +11 -30
- package/src/components/Group/Group.stories.tsx +6 -30
- package/src/components/Group/Group.tsx +14 -9
- package/src/components/HoverCard/HoverCard.tsx +72 -75
- package/src/components/Label/Label.module.css +4 -0
- package/src/components/Label/Label.stories.tsx +18 -12
- package/src/components/Label/Label.tsx +3 -9
- package/src/components/Link/Link.module.css +4 -3
- package/src/components/Link/Link.stories.tsx +2 -8
- package/src/components/Link/Link.tsx +1 -5
- package/src/components/Loader/Loader.module.css +1 -2
- package/src/components/Loader/Loader.tsx +1 -7
- package/src/components/Menu/IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Menu/Menu.stories.tsx +106 -188
- package/src/components/Menu/Menu.tsx +34 -280
- package/src/components/Modal/Modal.tsx +158 -160
- package/src/components/NumberInput/NumberInput.tsx +6 -18
- package/src/components/Pagination/IMPLEMENTATION_NOTES.md +3 -0
- package/src/components/Pagination/Pagination.module.css +12 -24
- package/src/components/Pagination/Pagination.stories.tsx +0 -8
- package/src/components/Pagination/Pagination.tsx +20 -140
- package/src/components/Panel/Panel.tsx +7 -30
- package/src/components/Radio/Radio.module.css +25 -10
- package/src/components/Radio/Radio.tsx +51 -19
- package/src/components/Radio/RadioGroup.stories.tsx +117 -0
- package/src/components/Radio/RadioGroup.tsx +26 -12
- package/src/components/ReadOnlyField/ReadOnlyField.module.css +6 -6
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +5 -36
- package/src/components/ReadOnlyField/ReadOnlyField.tsx +9 -13
- package/src/components/SegmentedControl/SegmentedControl.module.css +23 -47
- package/src/components/SegmentedControl/SegmentedControl.tsx +44 -14
- package/src/components/Slider/Slider.module.css +1 -4
- package/src/components/Slider/Slider.stories.tsx +3 -3
- package/src/components/Slider/Slider.tsx +26 -25
- package/src/components/Stack/Stack.stories.tsx +4 -25
- package/src/components/Stack/Stack.tsx +1 -5
- package/src/components/Stepper/IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Stepper/Stepper.stories.tsx +56 -43
- package/src/components/Stepper/Stepper.tsx +89 -87
- package/src/components/Switch/Switch.module.css +21 -0
- package/src/components/Switch/Switch.tsx +63 -16
- package/src/components/Switch/SwitchGroup.stories.tsx +132 -0
- package/src/components/Switch/SwitchGroup.tsx +27 -18
- package/src/components/Table/Table.stories.tsx +1 -19
- package/src/components/Table/Table.tsx +3 -1
- package/src/components/Tabs/IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Tabs/Tabs.stories.tsx +41 -24
- package/src/components/Tabs/Tabs.tsx +49 -66
- package/src/components/Text/Text.stories.tsx +5 -17
- package/src/components/Text/Text.tsx +1 -15
- package/src/components/TextArea/TextArea.tsx +7 -17
- package/src/components/TextField/TextField.stories.tsx +1 -27
- package/src/components/TextField/TextField.tsx +4 -6
- package/src/components/TimePicker/TimePicker.stories.tsx +2 -19
- 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.stories.tsx +0 -18
- package/src/components/Title/Title.tsx +1 -7
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Toast/Toast.tsx +62 -28
- package/src/components/Tooltip/Tooltip.tsx +11 -37
- package/src/components/TransferList/TransferList.stories.tsx +1 -19
- package/src/components/TransferList/TransferList.tsx +3 -1
- package/src/utils/RequireAccessibleLabel.ts +1 -12
- package/src/utils/filterStylingProps.ts +7 -20
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
2
|
import { AssistiveElement } from "./AssistiveElement";
|
|
3
|
+
import { Layer } from "@recursica/adapter-common";
|
|
4
4
|
|
|
5
5
|
const meta: Meta<typeof AssistiveElement> = {
|
|
6
6
|
title: "UI-Kit/AssistiveElement",
|
|
@@ -13,9 +13,6 @@ const meta: Meta<typeof AssistiveElement> = {
|
|
|
13
13
|
"The `AssistiveElement` is a semantic structural primitive designed to standardize Helper and Error descriptive blocks natively beneath form components globally. By explicitly wiring to the `--recursica_ui-kit_components_assistive-element` layout tokens, this component safely injects custom SVGs (Alerts vs Info circles) alongside constrained flex-wrapping typography strings, preserving flawless line-height and alignment logic entirely decoupled from underlying input engine frameworks.",
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
|
-
controls: {
|
|
17
|
-
include: ["assistiveVariant", "assistiveWithIcon", "children"],
|
|
18
|
-
},
|
|
19
16
|
},
|
|
20
17
|
argTypes: {
|
|
21
18
|
assistiveVariant: {
|
|
@@ -40,10 +37,10 @@ export const DefaultHelp: Story = {
|
|
|
40
37
|
assistiveWithIcon: true,
|
|
41
38
|
},
|
|
42
39
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
43
|
-
render: ({ ...args }: any) => (
|
|
44
|
-
<
|
|
40
|
+
render: ({ withLayer, layer, ...args }: any) => (
|
|
41
|
+
<Layer layer={0} style={{ padding: "48px" }}>
|
|
45
42
|
<AssistiveElement {...args} />
|
|
46
|
-
</
|
|
43
|
+
</Layer>
|
|
47
44
|
),
|
|
48
45
|
};
|
|
49
46
|
|
|
@@ -55,10 +52,10 @@ export const ErrorState: Story = {
|
|
|
55
52
|
assistiveWithIcon: true,
|
|
56
53
|
},
|
|
57
54
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
58
|
-
render: ({ ...args }: any) => (
|
|
59
|
-
<
|
|
55
|
+
render: ({ withLayer, layer, ...args }: any) => (
|
|
56
|
+
<Layer layer={0} style={{ padding: "48px" }}>
|
|
60
57
|
<AssistiveElement {...args} />
|
|
61
|
-
</
|
|
58
|
+
</Layer>
|
|
62
59
|
),
|
|
63
60
|
};
|
|
64
61
|
|
|
@@ -70,23 +67,9 @@ export const NoIconHelp: Story = {
|
|
|
70
67
|
assistiveWithIcon: false,
|
|
71
68
|
},
|
|
72
69
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
73
|
-
render: ({ ...args }: any) => (
|
|
74
|
-
<
|
|
75
|
-
<AssistiveElement {...args} />
|
|
76
|
-
</div>
|
|
77
|
-
),
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const Docs: Story = {
|
|
81
|
-
args: {
|
|
82
|
-
children: "Docs explicitly mapped configuration.",
|
|
83
|
-
assistiveVariant: "help",
|
|
84
|
-
assistiveWithIcon: true,
|
|
85
|
-
},
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
87
|
-
render: ({ ...args }: any) => (
|
|
88
|
-
<div style={{ padding: "48px" }}>
|
|
70
|
+
render: ({ withLayer, layer, ...args }: any) => (
|
|
71
|
+
<Layer layer={0} style={{ padding: "48px" }}>
|
|
89
72
|
<AssistiveElement {...args} />
|
|
90
|
-
</
|
|
73
|
+
</Layer>
|
|
91
74
|
),
|
|
92
75
|
};
|
|
@@ -3,11 +3,11 @@ import { FormHelperText, type FormHelperTextProps } from "@mui/material";
|
|
|
3
3
|
import { filterStylingProps } from "../../utils/filterStylingProps";
|
|
4
4
|
import styles from "./AssistiveElement.module.css";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
import { type RecursicaAssistiveElementProps } from "@recursica/adapter-common";
|
|
7
|
+
|
|
8
|
+
export interface AssistiveElementProps
|
|
9
|
+
extends FormHelperTextProps,
|
|
10
|
+
RecursicaAssistiveElementProps {
|
|
11
11
|
overStyled?: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -29,8 +29,6 @@ export const AssistiveElement = React.forwardRef<
|
|
|
29
29
|
const HelpIcon = () => (
|
|
30
30
|
<svg
|
|
31
31
|
xmlns="http://www.w3.org/2000/svg"
|
|
32
|
-
width="24"
|
|
33
|
-
height="24"
|
|
34
32
|
viewBox="0 0 24 24"
|
|
35
33
|
fill="none"
|
|
36
34
|
stroke="currentColor"
|
|
@@ -38,17 +36,15 @@ export const AssistiveElement = React.forwardRef<
|
|
|
38
36
|
strokeLinecap="round"
|
|
39
37
|
strokeLinejoin="round"
|
|
40
38
|
>
|
|
41
|
-
<circle cx="12" cy="12" r="10"
|
|
42
|
-
<
|
|
43
|
-
<
|
|
39
|
+
<circle cx="12" cy="12" r="10" />
|
|
40
|
+
<path d="M12 16v-4" />
|
|
41
|
+
<path d="M12 8h.01" />
|
|
44
42
|
</svg>
|
|
45
43
|
);
|
|
46
44
|
|
|
47
45
|
const ErrorIcon = () => (
|
|
48
46
|
<svg
|
|
49
47
|
xmlns="http://www.w3.org/2000/svg"
|
|
50
|
-
width="24"
|
|
51
|
-
height="24"
|
|
52
48
|
viewBox="0 0 24 24"
|
|
53
49
|
fill="none"
|
|
54
50
|
stroke="currentColor"
|
|
@@ -56,9 +52,9 @@ export const AssistiveElement = React.forwardRef<
|
|
|
56
52
|
strokeLinecap="round"
|
|
57
53
|
strokeLinejoin="round"
|
|
58
54
|
>
|
|
59
|
-
<
|
|
60
|
-
<
|
|
61
|
-
<
|
|
55
|
+
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" />
|
|
56
|
+
<path d="M12 9v4" />
|
|
57
|
+
<path d="M12 17h.01" />
|
|
62
58
|
</svg>
|
|
63
59
|
);
|
|
64
60
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
.root {
|
|
31
31
|
display: flex;
|
|
32
32
|
position: relative;
|
|
33
|
-
width: 100
|
|
33
|
+
width: 100% !important; /* Override MUI default 300px width */
|
|
34
34
|
min-height: var(
|
|
35
35
|
--recursica_ui-kit_components_autocomplete_properties_min-height
|
|
36
36
|
);
|
|
@@ -71,16 +71,16 @@
|
|
|
71
71
|
);
|
|
72
72
|
padding-top: var(
|
|
73
73
|
--recursica_ui-kit_components_autocomplete_properties_vertical-padding
|
|
74
|
-
);
|
|
74
|
+
) !important;
|
|
75
75
|
padding-bottom: var(
|
|
76
76
|
--recursica_ui-kit_components_autocomplete_properties_vertical-padding
|
|
77
|
-
);
|
|
77
|
+
) !important;
|
|
78
78
|
padding-left: var(
|
|
79
79
|
--recursica_ui-kit_components_autocomplete_properties_horizontal-padding
|
|
80
|
-
);
|
|
80
|
+
) !important;
|
|
81
81
|
padding-right: var(
|
|
82
82
|
--recursica_ui-kit_components_autocomplete_properties_horizontal-padding
|
|
83
|
-
);
|
|
83
|
+
) !important;
|
|
84
84
|
border-radius: var(
|
|
85
85
|
--recursica_ui-kit_components_autocomplete_properties_border-radius
|
|
86
86
|
);
|
|
@@ -129,10 +129,17 @@
|
|
|
129
129
|
|
|
130
130
|
/* Reset internal MUI <input> node padding to safely allow the wrapper to manage geometry */
|
|
131
131
|
.input :global(input.MuiInputBase-input) {
|
|
132
|
-
padding: 0;
|
|
132
|
+
padding: 0 !important;
|
|
133
133
|
height: 100%;
|
|
134
134
|
margin: 0;
|
|
135
135
|
box-sizing: border-box;
|
|
136
|
+
color: inherit;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Ensure MUI standard variant pseudo-elements (underlines) are destroyed completely */
|
|
140
|
+
.input::before,
|
|
141
|
+
.input::after {
|
|
142
|
+
display: none !important;
|
|
136
143
|
}
|
|
137
144
|
|
|
138
145
|
.input::placeholder {
|
|
@@ -143,12 +150,10 @@
|
|
|
143
150
|
}
|
|
144
151
|
|
|
145
152
|
/* Dynamic Padding Overrides */
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
.root[data-with-right-section] .input {
|
|
151
|
-
padding-right: var(--input-right-section-size);
|
|
153
|
+
/* MUI naturally flexes adornments, so we don't need absolute padding overrides for the wrapper.
|
|
154
|
+
Instead, we apply gap to the input wrapper to space out the adornments and the input natively. */
|
|
155
|
+
.input {
|
|
156
|
+
gap: var(--recursica_ui-kit_components_autocomplete_properties_icon-text-gap);
|
|
152
157
|
}
|
|
153
158
|
|
|
154
159
|
/* Flexible End-Caps (Icons, actions) */
|
|
@@ -160,16 +165,10 @@
|
|
|
160
165
|
|
|
161
166
|
.section[data-position="left"] {
|
|
162
167
|
justify-content: flex-start;
|
|
163
|
-
padding-left: var(
|
|
164
|
-
--recursica_ui-kit_components_autocomplete_properties_horizontal-padding
|
|
165
|
-
);
|
|
166
168
|
}
|
|
167
169
|
|
|
168
170
|
.section[data-position="right"] {
|
|
169
171
|
justify-content: flex-end;
|
|
170
|
-
padding-right: var(
|
|
171
|
-
--recursica_ui-kit_components_autocomplete_properties_horizontal-padding
|
|
172
|
-
);
|
|
173
172
|
}
|
|
174
173
|
|
|
175
174
|
.section :global(svg) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Autocomplete } from "./Autocomplete";
|
|
2
|
+
import { Autocomplete as AutoComplete } from "./Autocomplete";
|
|
3
3
|
import { formControlArgTypes } from "../../../.storybook/commonArgTypes";
|
|
4
4
|
|
|
5
|
-
const meta: Meta<typeof
|
|
6
|
-
title: "UI-Kit/
|
|
7
|
-
component:
|
|
5
|
+
const meta: Meta<typeof AutoComplete> = {
|
|
6
|
+
title: "UI-Kit/AutoComplete",
|
|
7
|
+
component: AutoComplete,
|
|
8
8
|
tags: ["autodocs"],
|
|
9
9
|
parameters: {
|
|
10
10
|
docs: {
|
|
11
11
|
description: {
|
|
12
12
|
component: `
|
|
13
|
-
The \`
|
|
13
|
+
The \`AutoComplete\` primitive provides a text input with a dropdown menu for displaying suggestions as the user types.
|
|
14
14
|
|
|
15
15
|
### Architectural Decoupling
|
|
16
16
|
Recursica wraps the internal Mantine \`<Autocomplete>\` component inside the \`WithReadOnlyWrapper\`, ensuring it integrates perfectly with the strict design system form architecture.
|
|
@@ -18,7 +18,7 @@ Recursica wraps the internal Mantine \`<Autocomplete>\` component inside the \`W
|
|
|
18
18
|
### Examples
|
|
19
19
|
Always structure horizontal architectures via the generic \`formLayout\` parameter.
|
|
20
20
|
\`\`\`tsx
|
|
21
|
-
<
|
|
21
|
+
<AutoComplete
|
|
22
22
|
label="Country"
|
|
23
23
|
assistiveText="Select your country of residence."
|
|
24
24
|
data={["United States", "Canada", "Mexico", "United Kingdom", "France"]}
|
|
@@ -60,7 +60,7 @@ Always structure horizontal architectures via the generic \`formLayout\` paramet
|
|
|
60
60
|
|
|
61
61
|
export default meta;
|
|
62
62
|
|
|
63
|
-
type Story = StoryObj<typeof
|
|
63
|
+
type Story = StoryObj<typeof AutoComplete>;
|
|
64
64
|
|
|
65
65
|
export const Default: Story = {
|
|
66
66
|
args: {
|
|
@@ -185,12 +185,3 @@ export const EditableReadOnly: Story = {
|
|
|
185
185
|
labelWithEditIcon: true,
|
|
186
186
|
},
|
|
187
187
|
};
|
|
188
|
-
|
|
189
|
-
export const Docs: Story = {
|
|
190
|
-
args: {
|
|
191
|
-
label: "Documentation Mode",
|
|
192
|
-
placeholder: "Docs layout validation...",
|
|
193
|
-
data: ["Doc A", "Doc B"],
|
|
194
|
-
assistiveText: "Explicitly requested docs story.",
|
|
195
|
-
},
|
|
196
|
-
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Autocomplete as MuiAutocomplete,
|
|
4
4
|
type AutocompleteProps as MuiAutocompleteProps,
|
|
5
5
|
TextField as MuiTextField,
|
|
6
|
-
|
|
6
|
+
// removed InputWrapperProps
|
|
7
7
|
} from "@mui/material";
|
|
8
8
|
import { type ReadOnlyControlProps } from "@recursica/adapter-common";
|
|
9
9
|
import {
|
|
@@ -14,25 +14,28 @@ import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/For
|
|
|
14
14
|
import { WithReadOnlyWrapper } from "../ReadOnlyField/WithReadOnlyWrapper";
|
|
15
15
|
import styles from "./Autocomplete.module.css";
|
|
16
16
|
|
|
17
|
+
import { type RecursicaAutocompleteProps as BaseRecursicaAutocompleteProps } from "@recursica/adapter-common";
|
|
18
|
+
|
|
17
19
|
export interface RecursicaAutocompleteProps
|
|
18
20
|
extends Omit<
|
|
19
|
-
MuiAutocompleteProps<any, any, any, any>,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
MuiAutocompleteProps<any, any, any, any, "div">,
|
|
22
|
+
| "variant"
|
|
23
|
+
| "size"
|
|
24
|
+
| "wrapperProps"
|
|
25
|
+
| "radius"
|
|
26
|
+
| "renderInput"
|
|
27
|
+
| "classes"
|
|
28
|
+
| "defaultValue"
|
|
25
29
|
>,
|
|
26
30
|
Omit<
|
|
27
31
|
RecursicaFormControlWrapperProps,
|
|
28
|
-
|
|
32
|
+
| "controlMaxWidth"
|
|
33
|
+
| "controlMinWidth"
|
|
34
|
+
| "error"
|
|
35
|
+
| keyof MuiAutocompleteProps<any, any, any, any, "div">
|
|
29
36
|
>,
|
|
30
|
-
ReadOnlyControlProps
|
|
31
|
-
|
|
32
|
-
leftSection?: React.ReactNode;
|
|
33
|
-
rightSection?: React.ReactNode;
|
|
34
|
-
placeholder?: string;
|
|
35
|
-
}
|
|
37
|
+
ReadOnlyControlProps,
|
|
38
|
+
BaseRecursicaAutocompleteProps {}
|
|
36
39
|
|
|
37
40
|
export type AutocompleteProps = RecursicaOverStyled<RecursicaAutocompleteProps>;
|
|
38
41
|
|
|
@@ -54,6 +57,7 @@ export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
|
|
|
54
57
|
assistiveWithIcon,
|
|
55
58
|
error,
|
|
56
59
|
required,
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
57
61
|
withAsterisk,
|
|
58
62
|
id,
|
|
59
63
|
className,
|
|
@@ -112,11 +116,6 @@ export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
|
|
|
112
116
|
? `${styles.layoutOverride} ${className}`
|
|
113
117
|
: styles.layoutOverride;
|
|
114
118
|
|
|
115
|
-
const sectionClass =
|
|
116
|
-
classNamesProp && (classNamesProp as any).section
|
|
117
|
-
? `${styles.section} ${(classNamesProp as any).section}`
|
|
118
|
-
: styles.section;
|
|
119
|
-
|
|
120
119
|
return (
|
|
121
120
|
<WithReadOnlyWrapper
|
|
122
121
|
className={wrapperClass}
|
|
@@ -133,10 +132,10 @@ export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
|
|
|
133
132
|
label={label}
|
|
134
133
|
assistiveText={assistiveText}
|
|
135
134
|
assistiveWithIcon={assistiveWithIcon}
|
|
136
|
-
error={error}
|
|
135
|
+
error={!!error}
|
|
137
136
|
required={required}
|
|
138
|
-
withAsterisk={withAsterisk}
|
|
139
137
|
id={id}
|
|
138
|
+
disabled={disabled}
|
|
140
139
|
readOnly={readOnly}
|
|
141
140
|
readOnlyComponent={readOnlyComponent}
|
|
142
141
|
emptyValueComponent={emptyValueComponent}
|
|
@@ -147,50 +146,33 @@ export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
|
|
|
147
146
|
/* Naked Input execution safely decoupled from Mui's macro Input.Wrapper DOM hooks */
|
|
148
147
|
<MuiAutocomplete
|
|
149
148
|
ref={ref}
|
|
149
|
+
freeSolo
|
|
150
|
+
disableClearable
|
|
150
151
|
classes={mergedClassNames}
|
|
151
152
|
disabled={disabled}
|
|
152
153
|
value={value}
|
|
153
154
|
defaultValue={defaultValue}
|
|
154
155
|
forcePopupIcon={false}
|
|
155
|
-
|
|
156
|
+
data-error={error ? "true" : undefined}
|
|
157
|
+
data-disabled={disabled ? "true" : undefined}
|
|
158
|
+
data-with-left-section={leftSection ? "true" : undefined}
|
|
159
|
+
data-with-right-section={rightSection ? "true" : undefined}
|
|
156
160
|
ListboxProps={{
|
|
157
161
|
...ListboxProps,
|
|
158
162
|
className: mergedClassNames.listbox,
|
|
159
163
|
}}
|
|
160
164
|
options={data || []}
|
|
161
165
|
renderInput={(params) => {
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
162
167
|
const { InputProps, ...restParams } = params;
|
|
163
168
|
return (
|
|
164
169
|
<MuiTextField
|
|
165
170
|
{...restParams}
|
|
166
171
|
placeholder={placeholder}
|
|
167
172
|
variant="standard"
|
|
168
|
-
InputProps={{
|
|
169
|
-
...InputProps,
|
|
170
|
-
disableUnderline: true,
|
|
171
|
-
startAdornment: leftSection ? (
|
|
172
|
-
<span className={sectionClass}>{leftSection}</span>
|
|
173
|
-
) : (
|
|
174
|
-
InputProps.startAdornment
|
|
175
|
-
),
|
|
176
|
-
endAdornment: rightSection ? (
|
|
177
|
-
<>
|
|
178
|
-
{InputProps.endAdornment}
|
|
179
|
-
<span className={sectionClass}>{rightSection}</span>
|
|
180
|
-
</>
|
|
181
|
-
) : (
|
|
182
|
-
InputProps.endAdornment
|
|
183
|
-
),
|
|
184
|
-
}}
|
|
185
173
|
/>
|
|
186
174
|
);
|
|
187
175
|
}}
|
|
188
|
-
{...(sanitizedProps as unknown as MuiAutocompleteProps<
|
|
189
|
-
any,
|
|
190
|
-
any,
|
|
191
|
-
any,
|
|
192
|
-
any
|
|
193
|
-
>)}
|
|
194
176
|
/>
|
|
195
177
|
}
|
|
196
178
|
/>
|
|
@@ -9,11 +9,7 @@ import {
|
|
|
9
9
|
} from "../../utils/filterStylingProps";
|
|
10
10
|
import styles from "./Avatar.module.css";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
size?: "small" | "default" | "large";
|
|
14
|
-
variant?: "solid" | "outline" | "ghost";
|
|
15
|
-
icon?: React.ReactNode;
|
|
16
|
-
}
|
|
12
|
+
import { type RecursicaAvatarProps } from "@recursica/adapter-common";
|
|
17
13
|
|
|
18
14
|
export type AvatarProps = RecursicaOverStyled<
|
|
19
15
|
Omit<MuiAvatarProps, "variant" | "size" | "color" | "radius"> &
|
|
@@ -38,12 +34,6 @@ const _Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(
|
|
|
38
34
|
ghost: "transparent",
|
|
39
35
|
} as const;
|
|
40
36
|
|
|
41
|
-
const mapSize = {
|
|
42
|
-
default: "md",
|
|
43
|
-
small: "sm",
|
|
44
|
-
large: "lg",
|
|
45
|
-
} as const;
|
|
46
|
-
|
|
47
37
|
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
48
38
|
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
49
39
|
|
|
@@ -84,8 +74,7 @@ const _Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(
|
|
|
84
74
|
ref={ref}
|
|
85
75
|
className={classNameProp}
|
|
86
76
|
classes={mergedClassNames}
|
|
87
|
-
variant={mapVariant[variant]}
|
|
88
|
-
size={mapSize[size]}
|
|
77
|
+
variant={mapVariant[variant] as any}
|
|
89
78
|
src={src}
|
|
90
79
|
data-variant={variant}
|
|
91
80
|
data-size={size}
|
|
@@ -9,10 +9,7 @@ import {
|
|
|
9
9
|
} from "../../utils/filterStylingProps";
|
|
10
10
|
import styles from "./Badge.module.css";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
/** Map to the component styles defined in variables */
|
|
14
|
-
variant?: "alert" | "primary-color" | "success" | "warning";
|
|
15
|
-
}
|
|
12
|
+
import { type RecursicaBadgeProps } from "@recursica/adapter-common";
|
|
16
13
|
|
|
17
14
|
export type BadgeProps = RecursicaOverStyled<
|
|
18
15
|
Omit<MuiBadgeProps, "variant" | "size" | "color" | "radius"> &
|
|
@@ -54,7 +51,7 @@ const _Badge = forwardRef<HTMLDivElement, BadgeProps>(function Badge(
|
|
|
54
51
|
return (
|
|
55
52
|
<MuiBadge
|
|
56
53
|
ref={ref}
|
|
57
|
-
variant="
|
|
54
|
+
variant="standard" // We manage visual style purely through our CSS variables mapping
|
|
58
55
|
data-variant={variant}
|
|
59
56
|
{...sanitizedProps}
|
|
60
57
|
className={finalClass}
|
|
@@ -9,10 +9,7 @@ import {
|
|
|
9
9
|
} from "../../utils/filterStylingProps";
|
|
10
10
|
import styles from "./Breadcrumb.module.css";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
// according to recursica_ui-kit.json
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
15
|
-
export interface RecursicaBreadcrumbProps {}
|
|
12
|
+
import { type RecursicaBreadcrumbProps } from "@recursica/adapter-common";
|
|
16
13
|
|
|
17
14
|
export type BreadcrumbProps = RecursicaOverStyled<
|
|
18
15
|
Omit<MuiBreadcrumbsProps, "variant" | "size"> & RecursicaBreadcrumbProps
|
|
@@ -66,49 +66,7 @@
|
|
|
66
66
|
font-size: inherit;
|
|
67
67
|
line-height: inherit;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
visibility: hidden;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/*
|
|
74
|
-
* Keep the loader fully opaque, but make the background transparent
|
|
75
|
-
* to create contrast for solid variants without changing the loader color.
|
|
76
|
-
*/
|
|
77
|
-
.root[data-loading="true"] {
|
|
78
|
-
opacity: 1;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.root[data-size="default"][data-variant="solid"][data-loading="true"] {
|
|
82
|
-
background-color: color-mix(
|
|
83
|
-
in srgb,
|
|
84
|
-
var(
|
|
85
|
-
--recursica_ui-kit_components_button_variants_styles_solid_properties_colors_background
|
|
86
|
-
)
|
|
87
|
-
calc(
|
|
88
|
-
var(
|
|
89
|
-
--recursica_ui-kit_components_button_variants_sizes_default_properties_disabled-opacity
|
|
90
|
-
) *
|
|
91
|
-
100%
|
|
92
|
-
),
|
|
93
|
-
transparent
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.root[data-size="small"][data-variant="solid"][data-loading="true"] {
|
|
98
|
-
background-color: color-mix(
|
|
99
|
-
in srgb,
|
|
100
|
-
var(
|
|
101
|
-
--recursica_ui-kit_components_button_variants_styles_solid_properties_colors_background
|
|
102
|
-
)
|
|
103
|
-
calc(
|
|
104
|
-
var(
|
|
105
|
-
--recursica_ui-kit_components_button_variants_sizes_small_properties_disabled-opacity
|
|
106
|
-
) *
|
|
107
|
-
100%
|
|
108
|
-
),
|
|
109
|
-
transparent
|
|
110
|
-
);
|
|
111
|
-
}
|
|
69
|
+
/* Removed data-loading background override to rely on native disabled opacities like Mantine */
|
|
112
70
|
|
|
113
71
|
/* ==== SIZES ==== */
|
|
114
72
|
.root[data-size="default"] {
|
|
@@ -164,22 +122,13 @@
|
|
|
164
122
|
|
|
165
123
|
/* Override specific typography for small */
|
|
166
124
|
font-family: var(
|
|
167
|
-
--recursica_ui-kit_components_button_variants_sizes_small_properties_text_font-family
|
|
168
|
-
var(
|
|
169
|
-
--recursica_ui-kit_components_button_variants_sizes_default_properties_text_font-family
|
|
170
|
-
)
|
|
125
|
+
--recursica_ui-kit_components_button_variants_sizes_small_properties_text_font-family
|
|
171
126
|
);
|
|
172
127
|
font-size: var(
|
|
173
|
-
--recursica_ui-kit_components_button_variants_sizes_small_properties_text_font-size
|
|
174
|
-
var(
|
|
175
|
-
--recursica_ui-kit_components_button_variants_sizes_default_properties_text_font-size
|
|
176
|
-
)
|
|
128
|
+
--recursica_ui-kit_components_button_variants_sizes_small_properties_text_font-size
|
|
177
129
|
);
|
|
178
130
|
font-weight: var(
|
|
179
|
-
--recursica_ui-kit_components_button_variants_sizes_small_properties_text_font-weight
|
|
180
|
-
var(
|
|
181
|
-
--recursica_ui-kit_components_button_variants_sizes_default_properties_text_font-weight
|
|
182
|
-
)
|
|
131
|
+
--recursica_ui-kit_components_button_variants_sizes_small_properties_text_font-weight
|
|
183
132
|
);
|
|
184
133
|
}
|
|
185
134
|
.root[data-size="small"][data-content="label"] {
|
|
@@ -254,20 +203,30 @@
|
|
|
254
203
|
}
|
|
255
204
|
|
|
256
205
|
/* MUI uses .MuiButton-startIcon and .MuiButton-endIcon */
|
|
257
|
-
.root[data-size="default"] .MuiButton-startIcon
|
|
258
|
-
.root[data-size="default"] .MuiButton-endIcon {
|
|
206
|
+
.root[data-size="default"] .MuiButton-startIcon {
|
|
259
207
|
margin-left: 0;
|
|
260
208
|
margin-right: var(
|
|
261
209
|
--recursica_ui-kit_components_button_variants_sizes_default_properties_icon-text-gap
|
|
262
210
|
);
|
|
263
211
|
}
|
|
264
|
-
.root[data-size="
|
|
265
|
-
|
|
212
|
+
.root[data-size="default"] .MuiButton-endIcon {
|
|
213
|
+
margin-right: 0;
|
|
214
|
+
margin-left: var(
|
|
215
|
+
--recursica_ui-kit_components_button_variants_sizes_default_properties_icon-text-gap
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
.root[data-size="small"] .MuiButton-startIcon {
|
|
266
219
|
margin-left: 0;
|
|
267
220
|
margin-right: var(
|
|
268
221
|
--recursica_ui-kit_components_button_variants_sizes_small_properties_icon-text-gap
|
|
269
222
|
);
|
|
270
223
|
}
|
|
224
|
+
.root[data-size="small"] .MuiButton-endIcon {
|
|
225
|
+
margin-right: 0;
|
|
226
|
+
margin-left: var(
|
|
227
|
+
--recursica_ui-kit_components_button_variants_sizes_small_properties_icon-text-gap
|
|
228
|
+
);
|
|
229
|
+
}
|
|
271
230
|
|
|
272
231
|
/* Icon-only logic overrides */
|
|
273
232
|
.root[data-content="icon-only"] .labelText {
|
|
@@ -318,8 +277,7 @@
|
|
|
318
277
|
}
|
|
319
278
|
.root:hover:not(:disabled):not(:global(.Mui-disabled))::after {
|
|
320
279
|
opacity: var(
|
|
321
|
-
--recursica_ui-kit_components_button_variants_sizes_default_properties_hover-opacity
|
|
322
|
-
0.1
|
|
280
|
+
--recursica_ui-kit_components_button_variants_sizes_default_properties_hover-opacity
|
|
323
281
|
);
|
|
324
282
|
}
|
|
325
283
|
|
|
@@ -48,29 +48,6 @@ const meta: Meta<ButtonStoryProps> = {
|
|
|
48
48
|
loaderVariant: "oval",
|
|
49
49
|
loaderSize: undefined,
|
|
50
50
|
},
|
|
51
|
-
parameters: {
|
|
52
|
-
controls: {
|
|
53
|
-
include: [
|
|
54
|
-
"layer",
|
|
55
|
-
"withLayer",
|
|
56
|
-
"variant",
|
|
57
|
-
"size",
|
|
58
|
-
"children",
|
|
59
|
-
"component",
|
|
60
|
-
"icon",
|
|
61
|
-
"disabled",
|
|
62
|
-
"href",
|
|
63
|
-
"onClick",
|
|
64
|
-
"onChange",
|
|
65
|
-
"value",
|
|
66
|
-
"checked",
|
|
67
|
-
"loading",
|
|
68
|
-
"useRecursicaLoader",
|
|
69
|
-
"loaderVariant",
|
|
70
|
-
"loaderSize",
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
51
|
};
|
|
75
52
|
|
|
76
53
|
export default meta;
|
|
@@ -130,6 +107,30 @@ export const TextWithIcon: Story = {
|
|
|
130
107
|
},
|
|
131
108
|
};
|
|
132
109
|
|
|
110
|
+
export const IconOnly: Story = {
|
|
111
|
+
args: {
|
|
112
|
+
variant: "solid",
|
|
113
|
+
size: "default",
|
|
114
|
+
"aria-label": "Search",
|
|
115
|
+
icon: (
|
|
116
|
+
<svg
|
|
117
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
118
|
+
width="24"
|
|
119
|
+
height="24"
|
|
120
|
+
viewBox="0 0 24 24"
|
|
121
|
+
fill="none"
|
|
122
|
+
stroke="currentColor"
|
|
123
|
+
strokeWidth="2"
|
|
124
|
+
strokeLinecap="round"
|
|
125
|
+
strokeLinejoin="round"
|
|
126
|
+
>
|
|
127
|
+
<circle cx="11" cy="11" r="8"></circle>
|
|
128
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
|
|
129
|
+
</svg>
|
|
130
|
+
),
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
133
134
|
export const LayerOneSolid: Story = {
|
|
134
135
|
args: {
|
|
135
136
|
children: "Layer 1 Solid",
|