@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,28 +1,33 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Tabs } from "./Tabs";
|
|
3
|
-
import {
|
|
3
|
+
import { Tabs, Tab, TabPanel } from "./Tabs";
|
|
4
|
+
import { TabContext } from "@mui/lab";
|
|
5
|
+
import { Flex } from "../Flex/Flex";
|
|
4
6
|
|
|
5
7
|
const meta: Meta<typeof Tabs> = {
|
|
6
|
-
title: "UI-Kit
|
|
8
|
+
title: "UI-Kit/Tabs",
|
|
7
9
|
component: Tabs,
|
|
8
10
|
tags: ["autodocs"],
|
|
9
11
|
parameters: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
layout: "centered",
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
variant: {
|
|
16
|
+
control: "radio",
|
|
17
|
+
options: ["default", "outline", "pills"],
|
|
18
|
+
},
|
|
19
|
+
orientation: {
|
|
20
|
+
control: "radio",
|
|
21
|
+
options: ["horizontal", "vertical"],
|
|
22
|
+
},
|
|
23
|
+
// @ts-expect-error Custom prop not in native TabsProps
|
|
24
|
+
disabled: {
|
|
25
|
+
control: "boolean",
|
|
26
|
+
},
|
|
27
|
+
defaultChecked: {
|
|
28
|
+
table: {
|
|
29
|
+
disable: true,
|
|
30
|
+
},
|
|
26
31
|
},
|
|
27
32
|
},
|
|
28
33
|
};
|
|
@@ -30,6 +35,137 @@ const meta: Meta<typeof Tabs> = {
|
|
|
30
35
|
export default meta;
|
|
31
36
|
type Story = StoryObj<typeof Tabs>;
|
|
32
37
|
|
|
38
|
+
const InteractiveTabs = (
|
|
39
|
+
args: React.ComponentProps<typeof Tabs> & {
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
inverted?: boolean;
|
|
42
|
+
},
|
|
43
|
+
) => {
|
|
44
|
+
const [value, setValue] = useState("gallery");
|
|
45
|
+
|
|
46
|
+
const handleChange = (event: React.SyntheticEvent, newValue: string) => {
|
|
47
|
+
setValue(newValue);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Flex w={600} h={300}>
|
|
52
|
+
<TabContext value={value}>
|
|
53
|
+
<Tabs onChange={handleChange} {...args}>
|
|
54
|
+
<Tab
|
|
55
|
+
value="gallery"
|
|
56
|
+
label="Gallery"
|
|
57
|
+
disabled={args.disabled}
|
|
58
|
+
icon={
|
|
59
|
+
<svg
|
|
60
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
61
|
+
viewBox="0 0 24 24"
|
|
62
|
+
fill="none"
|
|
63
|
+
stroke="currentColor"
|
|
64
|
+
strokeWidth="2"
|
|
65
|
+
strokeLinecap="round"
|
|
66
|
+
strokeLinejoin="round"
|
|
67
|
+
width={16}
|
|
68
|
+
height={16}
|
|
69
|
+
>
|
|
70
|
+
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
71
|
+
<circle cx="8.5" cy="8.5" r="1.5"></circle>
|
|
72
|
+
<polyline points="21 15 16 10 5 21"></polyline>
|
|
73
|
+
</svg>
|
|
74
|
+
}
|
|
75
|
+
iconPosition="start"
|
|
76
|
+
/>
|
|
77
|
+
<Tab
|
|
78
|
+
value="messages"
|
|
79
|
+
label="Messages"
|
|
80
|
+
disabled={args.disabled}
|
|
81
|
+
icon={
|
|
82
|
+
<svg
|
|
83
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
84
|
+
viewBox="0 0 24 24"
|
|
85
|
+
fill="none"
|
|
86
|
+
stroke="currentColor"
|
|
87
|
+
strokeWidth="2"
|
|
88
|
+
strokeLinecap="round"
|
|
89
|
+
strokeLinejoin="round"
|
|
90
|
+
width={16}
|
|
91
|
+
height={16}
|
|
92
|
+
>
|
|
93
|
+
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
|
|
94
|
+
</svg>
|
|
95
|
+
}
|
|
96
|
+
iconPosition="start"
|
|
97
|
+
/>
|
|
98
|
+
<Tab
|
|
99
|
+
value="settings"
|
|
100
|
+
label="Settings"
|
|
101
|
+
disabled={args.disabled}
|
|
102
|
+
icon={
|
|
103
|
+
<svg
|
|
104
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
105
|
+
viewBox="0 0 24 24"
|
|
106
|
+
fill="none"
|
|
107
|
+
stroke="currentColor"
|
|
108
|
+
strokeWidth="2"
|
|
109
|
+
strokeLinecap="round"
|
|
110
|
+
strokeLinejoin="round"
|
|
111
|
+
width={16}
|
|
112
|
+
height={16}
|
|
113
|
+
>
|
|
114
|
+
<circle cx="12" cy="12" r="3"></circle>
|
|
115
|
+
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
|
|
116
|
+
</svg>
|
|
117
|
+
}
|
|
118
|
+
iconPosition="start"
|
|
119
|
+
/>
|
|
120
|
+
</Tabs>
|
|
121
|
+
|
|
122
|
+
<TabPanel value="gallery">Gallery tab content</TabPanel>
|
|
123
|
+
|
|
124
|
+
<TabPanel value="messages">Messages tab content</TabPanel>
|
|
125
|
+
|
|
126
|
+
<TabPanel value="settings">Settings tab content</TabPanel>
|
|
127
|
+
</TabContext>
|
|
128
|
+
</Flex>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
|
|
33
132
|
export const Default: Story = {
|
|
34
|
-
render: () => <
|
|
133
|
+
render: (args) => <InteractiveTabs {...args} />,
|
|
134
|
+
args: {
|
|
135
|
+
variant: "default",
|
|
136
|
+
orientation: "horizontal",
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const Outline: Story = {
|
|
141
|
+
render: (args) => <InteractiveTabs {...args} />,
|
|
142
|
+
args: {
|
|
143
|
+
variant: "outline",
|
|
144
|
+
orientation: "horizontal",
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const Pills: Story = {
|
|
149
|
+
render: (args) => <InteractiveTabs {...args} />,
|
|
150
|
+
args: {
|
|
151
|
+
variant: "pills",
|
|
152
|
+
orientation: "horizontal",
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const Vertical: Story = {
|
|
157
|
+
render: (args) => <InteractiveTabs {...args} />,
|
|
158
|
+
args: {
|
|
159
|
+
variant: "default",
|
|
160
|
+
orientation: "vertical",
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const Inverted: Story = {
|
|
165
|
+
render: (args) => <InteractiveTabs {...args} />,
|
|
166
|
+
args: {
|
|
167
|
+
variant: "default",
|
|
168
|
+
orientation: "horizontal",
|
|
169
|
+
inverted: true,
|
|
170
|
+
},
|
|
35
171
|
};
|
|
@@ -1,8 +1,88 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Tabs as MuiTabs,
|
|
4
|
+
type TabsProps as MuiTabsProps,
|
|
5
|
+
Tab as MuiTab,
|
|
6
|
+
type TabProps as MuiTabProps,
|
|
7
|
+
} from "@mui/material";
|
|
8
|
+
import {
|
|
9
|
+
filterStylingProps,
|
|
10
|
+
type RecursicaOverStyled,
|
|
11
|
+
} from "../../utils/filterStylingProps";
|
|
12
|
+
import styles from "./Tabs.module.css";
|
|
3
13
|
|
|
4
|
-
|
|
14
|
+
import { type RecursicaTabsProps } from "@recursica/adapter-common";
|
|
5
15
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
16
|
+
export type TabsProps = RecursicaOverStyled<RecursicaTabsProps>;
|
|
17
|
+
|
|
18
|
+
export const Tabs = forwardRef<HTMLDivElement, TabsProps>(
|
|
19
|
+
function Tabs(props, ref) {
|
|
20
|
+
const {
|
|
21
|
+
variant = "default",
|
|
22
|
+
orientation = "horizontal",
|
|
23
|
+
overStyled = false,
|
|
24
|
+
className,
|
|
25
|
+
...rest
|
|
26
|
+
} = props;
|
|
27
|
+
|
|
28
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<MuiTabs
|
|
32
|
+
ref={ref}
|
|
33
|
+
orientation={orientation}
|
|
34
|
+
className={`${styles.root} ${className || ""}`}
|
|
35
|
+
data-variant={variant}
|
|
36
|
+
data-orientation={orientation}
|
|
37
|
+
classes={{
|
|
38
|
+
flexContainer: styles.list,
|
|
39
|
+
indicator: styles.indicator,
|
|
40
|
+
}}
|
|
41
|
+
{...(sanitizedProps as MuiTabsProps)}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
Tabs.displayName = "Tabs";
|
|
48
|
+
|
|
49
|
+
export type TabProps = RecursicaOverStyled<MuiTabProps>;
|
|
50
|
+
|
|
51
|
+
export const Tab = forwardRef<HTMLDivElement, TabProps>(
|
|
52
|
+
function Tab(props, ref) {
|
|
53
|
+
const { overStyled = false, className, ...rest } = props;
|
|
54
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<MuiTab
|
|
58
|
+
ref={ref}
|
|
59
|
+
className={`${styles.tab} ${className || ""}`}
|
|
60
|
+
{...(sanitizedProps as MuiTabProps)}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
Tab.displayName = "Tab";
|
|
67
|
+
|
|
68
|
+
import { TabPanel as MuiTabPanel } from "@mui/lab";
|
|
69
|
+
import type { TabPanelProps as MuiTabPanelProps } from "@mui/lab";
|
|
70
|
+
|
|
71
|
+
export type TabPanelProps = RecursicaOverStyled<MuiTabPanelProps>;
|
|
72
|
+
|
|
73
|
+
export const TabPanel = forwardRef<HTMLDivElement, TabPanelProps>(
|
|
74
|
+
function TabPanel(props, ref) {
|
|
75
|
+
const { overStyled = false, className, ...rest } = props;
|
|
76
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<MuiTabPanel
|
|
80
|
+
ref={ref}
|
|
81
|
+
className={`${styles.panel} ${className || ""}`}
|
|
82
|
+
{...(sanitizedProps as MuiTabPanelProps)}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
TabPanel.displayName = "TabPanel";
|
|
@@ -13,23 +13,6 @@ const meta: Meta<typeof Text> = {
|
|
|
13
13
|
"The standard `<Text>` component controls common body sizing scales and implicit paragraphs governed by the active theme layer. For semantic headings (`h1` through `h6`), use `<Title>` instead.",
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
|
-
controls: {
|
|
17
|
-
include: [
|
|
18
|
-
"layer",
|
|
19
|
-
"withLayer",
|
|
20
|
-
"variant",
|
|
21
|
-
"children",
|
|
22
|
-
"component",
|
|
23
|
-
"size",
|
|
24
|
-
"icon",
|
|
25
|
-
"disabled",
|
|
26
|
-
"href",
|
|
27
|
-
"onClick",
|
|
28
|
-
"onChange",
|
|
29
|
-
"value",
|
|
30
|
-
"checked",
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
16
|
},
|
|
34
17
|
argTypes: {
|
|
35
18
|
variant: {
|
|
@@ -45,6 +28,11 @@ const meta: Meta<typeof Text> = {
|
|
|
45
28
|
description:
|
|
46
29
|
"Controls the standard logical boundary definitions natively extracted from Figma.",
|
|
47
30
|
},
|
|
31
|
+
c: {
|
|
32
|
+
control: "text",
|
|
33
|
+
description:
|
|
34
|
+
"Standard Mantine color string mapped via internal boundaries. Example: `dimmed`",
|
|
35
|
+
},
|
|
48
36
|
},
|
|
49
37
|
};
|
|
50
38
|
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import { Typography } from "../Typography/Typography";
|
|
3
3
|
import { type RecursicaOverStyled } from "../../utils/filterStylingProps";
|
|
4
|
-
import { type
|
|
5
|
-
|
|
6
|
-
export type TextVariant =
|
|
7
|
-
| "body"
|
|
8
|
-
| "body-small"
|
|
9
|
-
| "caption"
|
|
10
|
-
| "overline"
|
|
11
|
-
| "subtitle"
|
|
12
|
-
| "subtitle-small";
|
|
13
|
-
|
|
14
|
-
export type RecursicaTextProps = Omit<MuiTypographyProps, "variant"> & {
|
|
15
|
-
variant?: TextVariant;
|
|
16
|
-
children?: React.ReactNode;
|
|
17
|
-
component?: React.ElementType;
|
|
18
|
-
};
|
|
4
|
+
import { type RecursicaTextProps } from "@recursica/adapter-common";
|
|
19
5
|
|
|
20
6
|
export type TextProps = RecursicaOverStyled<RecursicaTextProps>;
|
|
21
7
|
|
|
@@ -1,37 +1,160 @@
|
|
|
1
1
|
/* EXEMPTIONS:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_border-radius */
|
|
6
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_horizontal-padding */
|
|
7
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_max-width */
|
|
8
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_min-width */
|
|
9
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_placeholder-opacity */
|
|
10
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_rows */
|
|
11
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_text_font-family */
|
|
12
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_text_font-size */
|
|
13
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_text_font-style */
|
|
14
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_text_font-weight */
|
|
15
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_text_letter-spacing */
|
|
16
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_text_line-height */
|
|
17
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_text_text-decoration */
|
|
18
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_text_text-transform */
|
|
19
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_properties_vertical-padding */
|
|
20
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_layouts_side-by-side_properties_top-bottom-margin */
|
|
21
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_layouts_stacked_properties_top-bottom-margin */
|
|
2
|
+
- state-specific border-size variables are ignored because a uniform 1px border is applied globally to prevent
|
|
3
|
+
unexpected layout shift or flickering during focus, disabled, or error state transitions. */
|
|
22
4
|
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_default_properties_border-size */
|
|
23
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_default_properties_colors_background */
|
|
24
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_default_properties_colors_border-color */
|
|
25
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_default_properties_colors_text */
|
|
26
5
|
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_disabled_properties_border-size */
|
|
27
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_disabled_properties_colors_background */
|
|
28
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_disabled_properties_colors_border-color */
|
|
29
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_disabled_properties_colors_text */
|
|
30
6
|
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_error_properties_border-size */
|
|
31
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_error_properties_colors_background */
|
|
32
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_error_properties_colors_border-color */
|
|
33
|
-
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_error_properties_colors_text */
|
|
34
7
|
/* recursica-ignore: --recursica_ui-kit_components_textarea_variants_states_focus_properties_border-size */
|
|
35
|
-
|
|
36
|
-
/*
|
|
37
|
-
|
|
8
|
+
|
|
9
|
+
/* LAYOUT SPACING OVERRIDES:
|
|
10
|
+
- Sets the --form-control-margin-bottom spacing hook to map component-specific layout tokens. */
|
|
11
|
+
.layoutOverride {
|
|
12
|
+
--form-control-margin-bottom: var(
|
|
13
|
+
--recursica_ui-kit_components_textarea_variants_layouts_stacked_properties_top-bottom-margin
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.layoutOverride[data-form-layout="side-by-side"] {
|
|
18
|
+
--form-control-margin-bottom: var(
|
|
19
|
+
--recursica_ui-kit_components_textarea_variants_layouts_side-by-side_properties_top-bottom-margin
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* HARDCODED VALUES:
|
|
24
|
+
- border-width: 1px. Native geometric boundary for the input box.
|
|
25
|
+
- border-style: solid. Native structural rendering rule.
|
|
26
|
+
- outline: none. Bypassing browser focus rings to rely strictly on Recursica focus states natively.
|
|
27
|
+
- flex/layout: display: flex on the root wrapper safely encapsulating internal section rendering.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
.root {
|
|
31
|
+
display: flex;
|
|
32
|
+
position: relative;
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.input {
|
|
37
|
+
/* Structural Overrides */
|
|
38
|
+
width: 100%;
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
margin: 0;
|
|
41
|
+
|
|
42
|
+
/* Sizing driven by rows token */
|
|
43
|
+
min-height: calc(
|
|
44
|
+
var(--recursica_ui-kit_components_textarea_properties_rows) *
|
|
45
|
+
var(--recursica_ui-kit_components_textarea_properties_text_line-height) +
|
|
46
|
+
2 *
|
|
47
|
+
var(--recursica_ui-kit_components_textarea_properties_vertical-padding) +
|
|
48
|
+
2px
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
/* Box Geometry */
|
|
52
|
+
padding-top: var(
|
|
53
|
+
--recursica_ui-kit_components_textarea_properties_vertical-padding
|
|
54
|
+
);
|
|
55
|
+
padding-bottom: var(
|
|
56
|
+
--recursica_ui-kit_components_textarea_properties_vertical-padding
|
|
57
|
+
);
|
|
58
|
+
padding-left: var(
|
|
59
|
+
--recursica_ui-kit_components_textarea_properties_horizontal-padding
|
|
60
|
+
);
|
|
61
|
+
padding-right: var(
|
|
62
|
+
--recursica_ui-kit_components_textarea_properties_horizontal-padding
|
|
63
|
+
);
|
|
64
|
+
border-radius: var(
|
|
65
|
+
--recursica_ui-kit_components_textarea_properties_border-radius
|
|
66
|
+
);
|
|
67
|
+
border-width: 1px;
|
|
68
|
+
border-style: solid;
|
|
69
|
+
|
|
70
|
+
/* Strict Typography Unification */
|
|
71
|
+
font-family: var(
|
|
72
|
+
--recursica_ui-kit_components_textarea_properties_text_font-family
|
|
73
|
+
);
|
|
74
|
+
font-size: var(
|
|
75
|
+
--recursica_ui-kit_components_textarea_properties_text_font-size
|
|
76
|
+
);
|
|
77
|
+
font-style: var(
|
|
78
|
+
--recursica_ui-kit_components_textarea_properties_text_font-style
|
|
79
|
+
);
|
|
80
|
+
font-weight: var(
|
|
81
|
+
--recursica_ui-kit_components_textarea_properties_text_font-weight
|
|
82
|
+
);
|
|
83
|
+
letter-spacing: var(
|
|
84
|
+
--recursica_ui-kit_components_textarea_properties_text_letter-spacing
|
|
85
|
+
);
|
|
86
|
+
line-height: var(
|
|
87
|
+
--recursica_ui-kit_components_textarea_properties_text_line-height
|
|
88
|
+
);
|
|
89
|
+
text-decoration: var(
|
|
90
|
+
--recursica_ui-kit_components_textarea_properties_text_text-decoration
|
|
91
|
+
);
|
|
92
|
+
text-transform: var(
|
|
93
|
+
--recursica_ui-kit_components_textarea_properties_text_text-transform
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
/* Base State Default Execution */
|
|
97
|
+
background-color: var(
|
|
98
|
+
--recursica_ui-kit_components_textarea_variants_states_default_properties_colors_background
|
|
99
|
+
);
|
|
100
|
+
border-color: var(
|
|
101
|
+
--recursica_ui-kit_components_textarea_variants_states_default_properties_colors_border-color
|
|
102
|
+
);
|
|
103
|
+
color: var(
|
|
104
|
+
--recursica_ui-kit_components_textarea_variants_states_default_properties_colors_text
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
outline: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.input::placeholder {
|
|
111
|
+
opacity: var(
|
|
112
|
+
--recursica_ui-kit_components_textarea_properties_placeholder-opacity
|
|
113
|
+
);
|
|
114
|
+
color: inherit;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* -------------------------------------
|
|
118
|
+
STATE CASCADE ARCHITECTURE
|
|
119
|
+
-------------------------------------- */
|
|
120
|
+
|
|
121
|
+
/* Focus State Mapping (Triggered internally via browser focus rules) */
|
|
122
|
+
.input:focus-within,
|
|
123
|
+
.input:focus {
|
|
124
|
+
border-color: var(
|
|
125
|
+
--recursica_ui-kit_components_textarea_variants_states_focus_properties_colors_border-color
|
|
126
|
+
);
|
|
127
|
+
background-color: var(
|
|
128
|
+
--recursica_ui-kit_components_textarea_variants_states_focus_properties_colors_background
|
|
129
|
+
);
|
|
130
|
+
color: var(
|
|
131
|
+
--recursica_ui-kit_components_textarea_variants_states_focus_properties_colors_text
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Error State Mapping (Propagated strictly down from the wrapper DOM context) */
|
|
136
|
+
.root[data-error] .input {
|
|
137
|
+
border-color: var(
|
|
138
|
+
--recursica_ui-kit_components_textarea_variants_states_error_properties_colors_border-color
|
|
139
|
+
) !important;
|
|
140
|
+
background-color: var(
|
|
141
|
+
--recursica_ui-kit_components_textarea_variants_states_error_properties_colors_background
|
|
142
|
+
) !important;
|
|
143
|
+
color: var(
|
|
144
|
+
--recursica_ui-kit_components_textarea_variants_states_error_properties_colors_text
|
|
145
|
+
) !important;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Disabled State Mapping (Propagated strictly down from the wrapper DOM context) */
|
|
149
|
+
.root[data-disabled] .input {
|
|
150
|
+
border-color: var(
|
|
151
|
+
--recursica_ui-kit_components_textarea_variants_states_disabled_properties_colors_border-color
|
|
152
|
+
) !important;
|
|
153
|
+
background-color: var(
|
|
154
|
+
--recursica_ui-kit_components_textarea_variants_states_disabled_properties_colors_background
|
|
155
|
+
) !important;
|
|
156
|
+
color: var(
|
|
157
|
+
--recursica_ui-kit_components_textarea_variants_states_disabled_properties_colors_text
|
|
158
|
+
) !important;
|
|
159
|
+
cursor: not-allowed;
|
|
160
|
+
}
|
|
@@ -1,35 +1,94 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
3
|
import { TextArea } from "./TextArea";
|
|
3
|
-
import {
|
|
4
|
+
import { formControlArgTypes } from "../../../.storybook/commonArgTypes";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
type TextAreaStoryProps = React.ComponentProps<typeof TextArea>;
|
|
7
|
+
|
|
8
|
+
const meta: Meta<TextAreaStoryProps> = {
|
|
9
|
+
title: "UI-Kit/TextArea",
|
|
7
10
|
component: TextArea,
|
|
8
11
|
tags: ["autodocs"],
|
|
9
12
|
parameters: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
docs: {
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
"TextArea provides a multi-line input field, mapping layout explicitly over the standardized FormControlWrapper.",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
args: {
|
|
21
|
+
label: "Description",
|
|
22
|
+
assistiveText: "Enter your full description here.",
|
|
23
|
+
disabled: false,
|
|
24
|
+
required: false,
|
|
25
|
+
readOnly: false,
|
|
26
|
+
autosize: false,
|
|
27
|
+
},
|
|
28
|
+
argTypes: {
|
|
29
|
+
disabled: {
|
|
30
|
+
control: "boolean",
|
|
31
|
+
},
|
|
32
|
+
...formControlArgTypes,
|
|
33
|
+
readOnly: {
|
|
34
|
+
control: "boolean",
|
|
35
|
+
},
|
|
36
|
+
autosize: {
|
|
37
|
+
control: "boolean",
|
|
38
|
+
},
|
|
39
|
+
minRows: {
|
|
40
|
+
control: "number",
|
|
41
|
+
},
|
|
42
|
+
maxRows: {
|
|
43
|
+
control: "number",
|
|
44
|
+
},
|
|
45
|
+
value: {
|
|
46
|
+
control: "text",
|
|
47
|
+
},
|
|
48
|
+
placeholder: {
|
|
49
|
+
control: "text",
|
|
26
50
|
},
|
|
27
51
|
},
|
|
28
52
|
};
|
|
29
53
|
|
|
30
54
|
export default meta;
|
|
31
|
-
|
|
55
|
+
|
|
56
|
+
type Story = StoryObj<TextAreaStoryProps>;
|
|
32
57
|
|
|
33
58
|
export const Default: Story = {
|
|
34
|
-
|
|
59
|
+
args: {
|
|
60
|
+
placeholder: "Type something long...",
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const Autosize: Story = {
|
|
65
|
+
args: {
|
|
66
|
+
label: "Auto-sizing TextArea",
|
|
67
|
+
autosize: true,
|
|
68
|
+
minRows: 2,
|
|
69
|
+
maxRows: 6,
|
|
70
|
+
placeholder: "Type multiple lines here. Watch it grow!",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const StaticError: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
error: "This field requires a detailed explanation.",
|
|
77
|
+
value: "Some bad input.",
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const StaticDisabled: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
disabled: true,
|
|
84
|
+
value: "This content is locked.",
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const StaticReadOnly: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
label: "Read Only View",
|
|
91
|
+
readOnly: true,
|
|
92
|
+
value: "This text is safely frozen in read-only form.",
|
|
93
|
+
},
|
|
35
94
|
};
|