@recursica/mui-adapter 0.5.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 +15 -0
- package/SETUP.md +77 -0
- package/USAGE.md +55 -0
- package/dist/mui-adapter.cjs +74 -1
- package/dist/mui-adapter.cjs.map +1 -1
- package/dist/mui-adapter.css +1 -1
- package/dist/mui-adapter.js +6863 -205
- package/dist/mui-adapter.js.map +1 -1
- package/dist/src/components/Accordion/Accordion.d.ts +43 -2
- package/dist/src/components/AssistiveElement/AssistiveElement.d.ts +6 -2
- package/dist/src/components/Autocomplete/Autocomplete.d.ts +12 -2
- package/dist/src/components/Avatar/Avatar.d.ts +10 -3
- package/dist/src/components/Badge/Badge.d.ts +10 -3
- package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +9 -3
- package/dist/src/components/Button/Button.d.ts +2 -17
- package/dist/src/components/Card/Card.d.ts +38 -3
- package/dist/src/components/Checkbox/Checkbox.d.ts +13 -2
- package/dist/src/components/Checkbox/CheckboxGroup.d.ts +18 -0
- package/dist/src/components/Checkbox/index.d.ts +5 -1
- package/dist/src/components/Chip/Chip.d.ts +9 -2
- 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 +12 -2
- package/dist/src/components/Flex/Flex.d.ts +2 -22
- package/dist/src/components/FormControlLayout/FormControlLayout.d.ts +5 -2
- package/dist/src/components/FormControlWrapper/FormControlWrapper.d.ts +9 -2
- package/dist/src/components/Group/Group.d.ts +2 -7
- package/dist/src/components/HoverCard/HoverCard.d.ts +28 -2
- package/dist/src/components/Label/Label.d.ts +6 -2
- 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 +25 -3
- package/dist/src/components/Modal/Modal.d.ts +37 -2
- package/dist/src/components/NumberInput/NumberInput.d.ts +12 -2
- package/dist/src/components/Pagination/Pagination.d.ts +12 -3
- package/dist/src/components/Pagination/Pagination.icons.d.ts +8 -0
- package/dist/src/components/Panel/Panel.d.ts +52 -3
- package/dist/src/components/Radio/Radio.d.ts +13 -3
- package/dist/src/components/Radio/RadioGroup.d.ts +9 -0
- package/dist/src/components/ReadOnlyField/ReadOnlyBooleanField.d.ts +5 -0
- package/dist/src/components/ReadOnlyField/ReadOnlyField.d.ts +4 -2
- package/dist/src/components/ReadOnlyField/ReadOnlySwitchField.d.ts +5 -0
- package/dist/src/components/ReadOnlyField/ReadOnlyTextField.d.ts +8 -0
- package/dist/src/components/ReadOnlyField/WithReadOnlyWrapper.d.ts +28 -0
- package/dist/src/components/ReadOnlyField/index.d.ts +1 -0
- package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +21 -3
- package/dist/src/components/Slider/Slider.d.ts +18 -2
- package/dist/src/components/Stack/Stack.d.ts +2 -5
- package/dist/src/components/Stepper/Stepper.d.ts +41 -2
- package/dist/src/components/Switch/Switch.d.ts +10 -3
- package/dist/src/components/Switch/SwitchGroup.d.ts +13 -0
- package/dist/src/components/Table/Table.d.ts +2 -1
- package/dist/src/components/Tabs/Tabs.d.ts +20 -3
- package/dist/src/components/Text/Text.d.ts +2 -16
- package/dist/src/components/TextArea/TextArea.d.ts +12 -2
- package/dist/src/components/TextField/TextField.d.ts +12 -2
- package/dist/src/components/TimePicker/TimePicker.d.ts +2 -1
- package/dist/src/components/Timeline/Timeline.d.ts +15 -2
- package/dist/src/components/Timeline/TimelineItem.d.ts +18 -0
- package/dist/src/components/Title/Title.d.ts +2 -15
- package/dist/src/components/Toast/Toast.d.ts +20 -2
- package/dist/src/components/Tooltip/Tooltip.d.ts +28 -3
- 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 +14 -3
- package/src/components/Accordion/Accordion.module.css +294 -56
- package/src/components/Accordion/Accordion.stories.tsx +131 -21
- package/src/components/Accordion/Accordion.tsx +260 -5
- package/src/components/AssistiveElement/AssistiveElement.module.css +114 -20
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +60 -20
- package/src/components/AssistiveElement/AssistiveElement.tsx +81 -5
- package/src/components/Autocomplete/Autocomplete.module.css +319 -42
- package/src/components/Autocomplete/Autocomplete.stories.tsx +175 -23
- package/src/components/Autocomplete/Autocomplete.tsx +181 -6
- package/src/components/Avatar/Avatar.module.css +343 -73
- package/src/components/Avatar/Avatar.stories.tsx +94 -22
- package/src/components/Avatar/Avatar.tsx +99 -6
- package/src/components/Badge/Badge.module.css +127 -29
- package/src/components/Badge/Badge.stories.tsx +65 -22
- package/src/components/Badge/Badge.tsx +67 -6
- package/src/components/Breadcrumb/Breadcrumb.module.css +25 -5
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +57 -22
- package/src/components/Breadcrumb/Breadcrumb.tsx +59 -6
- 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 +154 -38
- package/src/components/Card/Card.stories.tsx +117 -19
- package/src/components/Card/Card.tsx +181 -5
- package/src/components/Checkbox/Checkbox.module.css +249 -39
- package/src/components/Checkbox/Checkbox.stories.tsx +81 -19
- package/src/components/Checkbox/Checkbox.tsx +246 -5
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +139 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +137 -0
- package/src/components/Checkbox/index.ts +6 -1
- package/src/components/Chip/Chip.module.css +246 -43
- package/src/components/Chip/Chip.stories.tsx +101 -21
- package/src/components/Chip/Chip.tsx +136 -6
- 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.module.css +291 -41
- package/src/components/Dropdown/Dropdown.stories.tsx +80 -21
- package/src/components/Dropdown/Dropdown.tsx +180 -6
- 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.module.css +92 -0
- package/src/components/FormControlLayout/FormControlLayout.stories.tsx +67 -20
- package/src/components/FormControlLayout/FormControlLayout.tsx +69 -4
- package/src/components/FormControlWrapper/FormControlWrapper.module.css +87 -0
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +116 -22
- package/src/components/FormControlWrapper/FormControlWrapper.tsx +126 -6
- package/src/components/Group/Group.stories.tsx +6 -30
- package/src/components/Group/Group.tsx +14 -9
- package/src/components/HoverCard/HoverCard.module.css +90 -22
- package/src/components/HoverCard/HoverCard.stories.tsx +158 -21
- package/src/components/HoverCard/HoverCard.tsx +147 -5
- package/src/components/Label/Label.module.css +140 -35
- package/src/components/Label/Label.stories.tsx +108 -21
- package/src/components/Label/Label.tsx +82 -5
- 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.module.css +285 -51
- package/src/components/Menu/Menu.stories.tsx +229 -25
- package/src/components/Menu/Menu.tsx +73 -6
- package/src/components/Modal/Modal.module.css +171 -35
- package/src/components/Modal/Modal.stories.tsx +66 -22
- package/src/components/Modal/Modal.tsx +215 -5
- package/src/components/NumberInput/NumberInput.module.css +276 -42
- package/src/components/NumberInput/NumberInput.stories.tsx +83 -20
- package/src/components/NumberInput/NumberInput.tsx +136 -6
- package/src/components/Pagination/IMPLEMENTATION_NOTES.md +3 -0
- package/src/components/Pagination/Pagination.icons.tsx +66 -0
- package/src/components/Pagination/Pagination.module.css +234 -20
- package/src/components/Pagination/Pagination.stories.tsx +34 -21
- package/src/components/Pagination/Pagination.tsx +74 -6
- package/src/components/Panel/Panel.module.css +206 -38
- package/src/components/Panel/Panel.stories.tsx +214 -22
- package/src/components/Panel/Panel.tsx +130 -5
- package/src/components/Radio/Radio.module.css +235 -37
- package/src/components/Radio/Radio.stories.tsx +77 -19
- package/src/components/Radio/Radio.tsx +210 -5
- package/src/components/Radio/RadioGroup.stories.tsx +117 -0
- package/src/components/Radio/RadioGroup.tsx +125 -0
- package/src/components/ReadOnlyField/ReadOnlyBooleanField.tsx +21 -0
- package/src/components/ReadOnlyField/ReadOnlyField.module.css +53 -15
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +147 -19
- package/src/components/ReadOnlyField/ReadOnlyField.tsx +105 -5
- package/src/components/ReadOnlyField/ReadOnlySwitchField.tsx +21 -0
- package/src/components/ReadOnlyField/ReadOnlyTextField.tsx +48 -0
- package/src/components/ReadOnlyField/WithReadOnlyWrapper.tsx +93 -0
- package/src/components/ReadOnlyField/index.ts +1 -0
- package/src/components/SegmentedControl/SegmentedControl.module.css +179 -47
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +102 -20
- package/src/components/SegmentedControl/SegmentedControl.tsx +140 -6
- package/src/components/Slider/Slider.module.css +539 -86
- package/src/components/Slider/Slider.stories.tsx +157 -19
- package/src/components/Slider/Slider.tsx +283 -5
- 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.module.css +410 -71
- package/src/components/Stepper/Stepper.stories.tsx +146 -20
- package/src/components/Stepper/Stepper.tsx +147 -6
- package/src/components/Switch/Switch.module.css +259 -39
- package/src/components/Switch/Switch.stories.tsx +98 -19
- package/src/components/Switch/Switch.tsx +200 -6
- package/src/components/Switch/SwitchGroup.stories.tsx +132 -0
- package/src/components/Switch/SwitchGroup.tsx +120 -0
- 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.module.css +422 -79
- package/src/components/Tabs/Tabs.stories.tsx +156 -20
- package/src/components/Tabs/Tabs.tsx +86 -6
- package/src/components/Text/Text.stories.tsx +5 -17
- package/src/components/Text/Text.tsx +1 -15
- package/src/components/TextArea/TextArea.module.css +155 -32
- package/src/components/TextArea/TextArea.stories.tsx +80 -21
- package/src/components/TextArea/TextArea.tsx +146 -6
- package/src/components/TextField/TextField.module.css +261 -42
- package/src/components/TextField/TextField.stories.tsx +147 -20
- package/src/components/TextField/TextField.tsx +169 -6
- package/src/components/TimePicker/TimePicker.stories.tsx +2 -19
- package/src/components/TimePicker/TimePicker.tsx +3 -1
- package/src/components/Timeline/Timeline.module.css +365 -76
- package/src/components/Timeline/Timeline.stories.tsx +114 -21
- package/src/components/Timeline/Timeline.tsx +83 -5
- package/src/components/Timeline/TimelineItem.tsx +90 -0
- package/src/components/Title/Title.stories.tsx +0 -18
- package/src/components/Title/Title.tsx +1 -7
- package/src/components/Toast/Toast.module.css +166 -28
- package/src/components/Toast/Toast.stories.tsx +54 -22
- package/src/components/Toast/Toast.tsx +124 -5
- package/src/components/Tooltip/Tooltip.module.css +89 -24
- package/src/components/Tooltip/Tooltip.stories.tsx +152 -22
- package/src/components/Tooltip/Tooltip.tsx +88 -5
- 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,35 +1,70 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
3
|
import { Breadcrumb } from "./Breadcrumb";
|
|
3
|
-
import {
|
|
4
|
+
import { Link } from "../Link";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
type BreadcrumbStoryProps = React.ComponentProps<typeof Breadcrumb> & {
|
|
7
|
+
items?: string[];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const meta: Meta<BreadcrumbStoryProps> = {
|
|
11
|
+
title: "UI-Kit/Breadcrumb",
|
|
7
12
|
component: Breadcrumb,
|
|
8
13
|
tags: ["autodocs"],
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
argTypes: {
|
|
15
|
+
children: {
|
|
16
|
+
table: {
|
|
17
|
+
disable: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
items: {
|
|
21
|
+
control: "object",
|
|
22
|
+
description:
|
|
23
|
+
"Array of string labels used to dynamically generate the interactive Breadcrumb nodes.",
|
|
24
|
+
table: {
|
|
25
|
+
category: "Story Controls",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
separator: {
|
|
29
|
+
control: "text",
|
|
30
|
+
description: "Custom separator between items",
|
|
26
31
|
},
|
|
27
32
|
},
|
|
33
|
+
args: {
|
|
34
|
+
items: ["Home", "Components", "Breadcrumbs"],
|
|
35
|
+
},
|
|
36
|
+
render: ({ items, children, ...args }) => {
|
|
37
|
+
const mappedChildren = items
|
|
38
|
+
? items.map((label, index) => (
|
|
39
|
+
<Link href="#" key={index}>
|
|
40
|
+
{label}
|
|
41
|
+
</Link>
|
|
42
|
+
))
|
|
43
|
+
: children;
|
|
44
|
+
|
|
45
|
+
return <Breadcrumb children={mappedChildren} {...args} />;
|
|
46
|
+
},
|
|
28
47
|
};
|
|
29
48
|
|
|
30
49
|
export default meta;
|
|
31
|
-
|
|
50
|
+
|
|
51
|
+
type Story = StoryObj<BreadcrumbStoryProps>;
|
|
32
52
|
|
|
33
53
|
export const Default: Story = {
|
|
34
|
-
|
|
54
|
+
args: {
|
|
55
|
+
items: ["Dashboard", "Settings", "Security"],
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const StaticExample: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
items: ["Store", "Electronics", "Computers", "Laptops"],
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const CustomSeparator: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
items: ["Root", "Branch", "Leaf"],
|
|
68
|
+
separator: "→",
|
|
69
|
+
},
|
|
35
70
|
};
|
|
@@ -1,8 +1,61 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Breadcrumbs as MuiBreadcrumbs,
|
|
4
|
+
type BreadcrumbsProps as MuiBreadcrumbsProps,
|
|
5
|
+
} from "@mui/material";
|
|
6
|
+
import {
|
|
7
|
+
filterStylingProps,
|
|
8
|
+
type RecursicaOverStyled,
|
|
9
|
+
} from "../../utils/filterStylingProps";
|
|
10
|
+
import styles from "./Breadcrumb.module.css";
|
|
3
11
|
|
|
4
|
-
|
|
12
|
+
import { type RecursicaBreadcrumbProps } from "@recursica/adapter-common";
|
|
5
13
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
export type BreadcrumbProps = RecursicaOverStyled<
|
|
15
|
+
Omit<MuiBreadcrumbsProps, "variant" | "size"> & RecursicaBreadcrumbProps
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
export const Breadcrumb = forwardRef<HTMLDivElement, BreadcrumbProps>(
|
|
19
|
+
function Breadcrumb({ overStyled = false, separator = ">", ...rest }, ref) {
|
|
20
|
+
const sanitizedProps = filterStylingProps(
|
|
21
|
+
{ separator, ...rest },
|
|
22
|
+
overStyled,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const mergedClassNames: Partial<Record<string, string>> = {
|
|
26
|
+
root: styles.root,
|
|
27
|
+
separator: styles.separator,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const classNamesProp = (sanitizedProps as Record<string, unknown>)
|
|
31
|
+
.classNames;
|
|
32
|
+
if (
|
|
33
|
+
classNamesProp &&
|
|
34
|
+
typeof classNamesProp === "object" &&
|
|
35
|
+
!Array.isArray(classNamesProp)
|
|
36
|
+
) {
|
|
37
|
+
const o = classNamesProp as Partial<Record<string, string>>;
|
|
38
|
+
mergedClassNames.root = o.root ? `${styles.root} ${o.root}` : styles.root;
|
|
39
|
+
mergedClassNames.separator = o.separator
|
|
40
|
+
? `${styles.separator} ${o.separator}`
|
|
41
|
+
: styles.separator;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const classNameProp = (sanitizedProps as Record<string, unknown>)
|
|
45
|
+
.className as string | undefined;
|
|
46
|
+
const finalClass = classNameProp
|
|
47
|
+
? `${styles.root} ${classNameProp}`
|
|
48
|
+
: styles.root;
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<MuiBreadcrumbs
|
|
52
|
+
ref={ref}
|
|
53
|
+
{...(sanitizedProps as unknown as MuiBreadcrumbsProps)}
|
|
54
|
+
className={finalClass}
|
|
55
|
+
classes={mergedClassNames}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
@@ -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 !important;
|
|
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
|
-
) !important;
|
|
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
|
-
) !important;
|
|
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",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import { Loader } from "../Loader/Loader";
|
|
3
|
-
import type { RecursicaLoaderProps } from "../Loader/Loader";
|
|
4
3
|
import {
|
|
5
4
|
Button as MuiButton,
|
|
6
5
|
type ButtonProps as MuiButtonProps,
|
|
@@ -11,21 +10,7 @@ import {
|
|
|
11
10
|
} from "../../utils/filterStylingProps";
|
|
12
11
|
import styles from "./Button.module.css";
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
variant?: "solid" | "outline" | "text";
|
|
16
|
-
size?: "default" | "small";
|
|
17
|
-
icon?: React.ReactNode;
|
|
18
|
-
/**
|
|
19
|
-
* For polymorphic support (e.g., `component="a"`), native to MUI.
|
|
20
|
-
*/
|
|
21
|
-
component?: React.ElementType;
|
|
22
|
-
/** Which Recursica Loader variant to use */
|
|
23
|
-
loaderVariant?: RecursicaLoaderProps["variant"];
|
|
24
|
-
/** The size variant for the loader */
|
|
25
|
-
loaderSize?: RecursicaLoaderProps["size"];
|
|
26
|
-
/** Whether to use the Recursica loader or fallback to the Mantine loader */
|
|
27
|
-
useRecursicaLoader?: boolean;
|
|
28
|
-
}
|
|
13
|
+
import { type RecursicaButtonProps } from "@recursica/adapter-common";
|
|
29
14
|
|
|
30
15
|
export type ButtonProps = RecursicaOverStyled<
|
|
31
16
|
Omit<MuiButtonProps, "variant" | "size" | "color" | "fullWidth"> &
|
|
@@ -73,7 +58,6 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
73
58
|
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
74
59
|
|
|
75
60
|
// Explicitly delete blocked semantic expansion dimension props that MUI uses natively
|
|
76
|
-
delete restRecord["fullWidth"];
|
|
77
61
|
delete restRecord["color"]; // Recursica handles colors internally via tokens
|
|
78
62
|
|
|
79
63
|
const hasStartIcon = !!icon || !!restRecord["startIcon"];
|
|
@@ -127,8 +111,13 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
127
111
|
className={finalClass}
|
|
128
112
|
loading={!!restRecord.loading}
|
|
129
113
|
loadingIndicator={loadingIndicator}
|
|
114
|
+
fullWidth={!!restRecord.fullWidth}
|
|
130
115
|
startIcon={
|
|
131
|
-
|
|
116
|
+
restRecord.loading ? (
|
|
117
|
+
<span className={styles.iconWrapper} aria-hidden>
|
|
118
|
+
{loadingIndicator}
|
|
119
|
+
</span>
|
|
120
|
+
) : icon != null ? (
|
|
132
121
|
<span className={styles.iconWrapper} aria-hidden>
|
|
133
122
|
{icon}
|
|
134
123
|
</span>
|
|
@@ -1,38 +1,154 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
/* HARDCODED VALUES:
|
|
2
|
+
- display: flex on root
|
|
3
|
+
- flex-direction: column
|
|
4
|
+
- gap: section-gap
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.root {
|
|
8
|
+
/* HARDCODE: Map Recursica explicitly into Mantine's variable format so internal components know the margins */
|
|
9
|
+
--card-padding: var(--recursica_ui-kit_components_card_properties_padding);
|
|
10
|
+
|
|
11
|
+
background-color: var(
|
|
12
|
+
--recursica_ui-kit_components_card_properties_colors_background
|
|
13
|
+
);
|
|
14
|
+
border-radius: var(
|
|
15
|
+
--recursica_ui-kit_components_card_properties_borders_border-radius
|
|
16
|
+
);
|
|
17
|
+
border: var(--recursica_ui-kit_components_card_properties_borders_border-size)
|
|
18
|
+
solid var(--recursica_ui-kit_components_card_properties_colors_border-color);
|
|
19
|
+
box-shadow: var(
|
|
20
|
+
--recursica_ui-kit_components_card_properties_elevations_elevation
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
padding: var(--card-padding);
|
|
24
|
+
min-width: var(--recursica_ui-kit_components_card_properties_min-width);
|
|
25
|
+
max-width: var(--recursica_ui-kit_components_card_properties_max-width);
|
|
26
|
+
color: var(--recursica_ui-kit_components_card_properties_colors_content);
|
|
27
|
+
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
gap: var(--recursica_ui-kit_components_card_properties_section-gap);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.header {
|
|
34
|
+
background-color: var(
|
|
35
|
+
--recursica_ui-kit_components_card_properties_colors_header-background
|
|
36
|
+
);
|
|
37
|
+
padding: var(--recursica_ui-kit_components_card_properties_header-padding);
|
|
38
|
+
color: var(--recursica_ui-kit_components_card_properties_colors_title);
|
|
39
|
+
border-bottom: var(--recursica_ui-kit_components_card_properties_divider-size)
|
|
40
|
+
solid
|
|
41
|
+
var(--recursica_ui-kit_components_card_properties_colors_divider-color);
|
|
42
|
+
|
|
43
|
+
/* Direct Figma Typography Mapping */
|
|
44
|
+
font-family: var(
|
|
45
|
+
--recursica_ui-kit_components_card_properties_header-style_fontFamily
|
|
46
|
+
);
|
|
47
|
+
font-size: var(
|
|
48
|
+
--recursica_ui-kit_components_card_properties_header-style_fontSize
|
|
49
|
+
);
|
|
50
|
+
font-style: var(
|
|
51
|
+
--recursica_ui-kit_components_card_properties_header-style_fontStyle
|
|
52
|
+
);
|
|
53
|
+
font-weight: var(
|
|
54
|
+
--recursica_ui-kit_components_card_properties_header-style_fontWeight
|
|
55
|
+
);
|
|
56
|
+
letter-spacing: var(
|
|
57
|
+
--recursica_ui-kit_components_card_properties_header-style_letterSpacing
|
|
58
|
+
);
|
|
59
|
+
line-height: var(
|
|
60
|
+
--recursica_ui-kit_components_card_properties_header-style_lineHeight
|
|
61
|
+
);
|
|
62
|
+
text-transform: var(
|
|
63
|
+
--recursica_ui-kit_components_card_properties_header-style_textCase
|
|
64
|
+
);
|
|
65
|
+
text-decoration: var(
|
|
66
|
+
--recursica_ui-kit_components_card_properties_header-style_textDecoration
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
/* Edge-to-edge behavior */
|
|
70
|
+
margin-left: calc(var(--card-padding) * -1) !important;
|
|
71
|
+
margin-right: calc(var(--card-padding) * -1) !important;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.header:first-child {
|
|
75
|
+
margin-top: calc(var(--card-padding) * -1) !important;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.header:last-child {
|
|
79
|
+
margin-bottom: calc(var(--card-padding) * -1) !important;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.footer {
|
|
83
|
+
background-color: var(
|
|
84
|
+
--recursica_ui-kit_components_card_properties_colors_footer-background
|
|
85
|
+
);
|
|
86
|
+
padding: var(--recursica_ui-kit_components_card_properties_footer-padding);
|
|
87
|
+
border-top: var(--recursica_ui-kit_components_card_properties_divider-size)
|
|
88
|
+
solid
|
|
89
|
+
var(--recursica_ui-kit_components_card_properties_colors_divider-color);
|
|
90
|
+
|
|
91
|
+
/* Edge-to-edge behavior */
|
|
92
|
+
margin-left: calc(var(--card-padding) * -1) !important;
|
|
93
|
+
margin-right: calc(var(--card-padding) * -1) !important;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.footer:first-child {
|
|
97
|
+
margin-top: calc(var(--card-padding) * -1) !important;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.footer:last-child {
|
|
101
|
+
margin-bottom: calc(var(--card-padding) * -1) !important;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.section {
|
|
105
|
+
/* Just maps standard section spacing overrides if passed explicitly */
|
|
106
|
+
margin-top: var(
|
|
107
|
+
--recursica_ui-kit_components_card_properties_vertical-gutter
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
/* Edge-to-edge behavior */
|
|
111
|
+
margin-left: calc(var(--card-padding) * -1) !important;
|
|
112
|
+
margin-right: calc(var(--card-padding) * -1) !important;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.section:first-child {
|
|
116
|
+
margin-top: calc(var(--card-padding) * -1) !important;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.section:last-child {
|
|
120
|
+
margin-bottom: calc(var(--card-padding) * -1) !important;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.content {
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: var(--recursica_ui-kit_components_card_properties_vertical-gutter);
|
|
127
|
+
padding: 0;
|
|
128
|
+
|
|
129
|
+
/* Direct Figma Typography Mapping */
|
|
130
|
+
font-family: var(
|
|
131
|
+
--recursica_ui-kit_components_card_properties_content-style_fontFamily
|
|
132
|
+
);
|
|
133
|
+
font-size: var(
|
|
134
|
+
--recursica_ui-kit_components_card_properties_content-style_fontSize
|
|
135
|
+
);
|
|
136
|
+
font-style: var(
|
|
137
|
+
--recursica_ui-kit_components_card_properties_content-style_fontStyle
|
|
138
|
+
);
|
|
139
|
+
font-weight: var(
|
|
140
|
+
--recursica_ui-kit_components_card_properties_content-style_fontWeight
|
|
141
|
+
);
|
|
142
|
+
letter-spacing: var(
|
|
143
|
+
--recursica_ui-kit_components_card_properties_content-style_letterSpacing
|
|
144
|
+
);
|
|
145
|
+
line-height: var(
|
|
146
|
+
--recursica_ui-kit_components_card_properties_content-style_lineHeight
|
|
147
|
+
);
|
|
148
|
+
text-transform: var(
|
|
149
|
+
--recursica_ui-kit_components_card_properties_content-style_textCase
|
|
150
|
+
);
|
|
151
|
+
text-decoration: var(
|
|
152
|
+
--recursica_ui-kit_components_card_properties_content-style_textDecoration
|
|
153
|
+
);
|
|
154
|
+
}
|