@recursica/mantine-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/.storybook/commonArgTypes.ts +148 -0
- package/CHANGELOG.md +69 -0
- package/dist/mantine-adapter.cjs +1 -1
- package/dist/mantine-adapter.cjs.map +1 -1
- package/dist/mantine-adapter.css +1 -1
- package/dist/mantine-adapter.js +1076 -266
- package/dist/mantine-adapter.js.map +1 -1
- package/dist/src/components/Accordion/Accordion.d.ts +13 -28
- package/dist/src/components/AssistiveElement/AssistiveElement.d.ts +10 -0
- package/dist/src/components/Avatar/Avatar.d.ts +1 -1
- package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +6 -3
- package/dist/src/components/Button/Button.d.ts +1 -1
- package/dist/src/components/Card/Card.d.ts +38 -3
- package/dist/src/components/Checkbox/Checkbox.d.ts +11 -3
- package/dist/src/components/Checkbox/CheckboxGroup.d.ts +9 -0
- package/dist/src/components/Chip/Chip.d.ts +14 -2
- package/dist/src/components/FormControlWrapper/FormControlWrapper.d.ts +18 -0
- package/dist/src/components/Label/Label.d.ts +21 -0
- package/dist/src/components/Label/index.d.ts +1 -0
- package/dist/src/components/ReadOnlyField/ReadOnlyField.d.ts +19 -2
- package/dist/src/components/ReadOnlyField/ReadOnlyTextField.d.ts +8 -0
- package/dist/src/components/ReadOnlyField/WithReadOnlyWrapper.d.ts +22 -0
- package/dist/src/components/ReadOnlyField/index.d.ts +3 -0
- package/dist/src/components/Text/Text.d.ts +17 -0
- package/dist/src/components/TextField/TextField.d.ts +8 -2
- package/dist/src/components/Title/Title.d.ts +13 -0
- package/dist/src/components/index.d.ts +3 -1
- package/dist/src/utils/ColorSchemeWrapper.d.ts +3 -0
- package/dist/src/utils/filterStylingProps.d.ts +6 -2
- package/package.json +9 -5
- package/src/OverStyling.stories.tsx +174 -0
- package/src/Version.stories.tsx +56 -0
- package/src/components/Accordion/ACCORDION_IMPLEMENTATION_NOTES.md +48 -0
- package/src/components/Accordion/Accordion.module.css +261 -0
- package/src/components/Accordion/Accordion.stories.tsx +145 -0
- package/src/components/Accordion/Accordion.tsx +200 -0
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/AssistiveElement/AssistiveElement.module.css +111 -0
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +73 -0
- package/src/components/AssistiveElement/AssistiveElement.tsx +91 -0
- package/src/components/Avatar/AVATAR_IMPLEMENTATION_NOTES.md +24 -0
- package/src/components/Avatar/Avatar.module.css +340 -0
- package/src/components/Avatar/Avatar.stories.tsx +102 -0
- package/src/components/Avatar/Avatar.tsx +100 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Badge/BADGE_IMPLEMENTATION_NOTES.md +18 -0
- package/src/components/Badge/Badge.module.css +124 -0
- package/src/components/Badge/Badge.stories.tsx +77 -0
- package/src/components/Badge/Badge.tsx +66 -0
- package/src/components/Breadcrumb/BREADCRUMB_IMPLEMENTATION_NOTES.md +14 -0
- package/src/components/Breadcrumb/Breadcrumb.module.css +26 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +77 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +64 -0
- package/src/components/Button/Button.module.css +275 -0
- package/src/components/Button/Button.stories.tsx +105 -0
- package/src/components/Button/Button.tsx +122 -0
- package/src/components/Button/IMPLEMENTATION_NOTES.md +45 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Card/CARD_IMPLEMENTATION_NOTES.md +10 -0
- package/src/components/Card/Card.module.css +60 -0
- package/src/components/Card/Card.stories.tsx +141 -0
- package/src/components/Card/Card.tsx +176 -0
- package/src/components/Checkbox/CHECKBOX_IMPLEMENTATION_NOTES.md +25 -0
- package/src/components/Checkbox/Checkbox.module.css +204 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +73 -0
- package/src/components/Checkbox/Checkbox.tsx +111 -0
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +138 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +140 -0
- package/src/components/Chip/CHIP_IMPLEMENTATION_NOTES.md +35 -0
- package/src/components/Chip/Chip.module.css +218 -0
- package/src/components/Chip/Chip.stories.tsx +115 -0
- package/src/components/Chip/Chip.tsx +143 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +22 -0
- package/src/components/DatePicker/DatePicker.tsx +7 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +22 -0
- package/src/components/Dropdown/Dropdown.tsx +7 -0
- package/src/components/FileInput/FileInput.stories.tsx +22 -0
- package/src/components/FileInput/FileInput.tsx +7 -0
- package/src/components/FileUpload/FileUpload.stories.tsx +22 -0
- package/src/components/FileUpload/FileUpload.tsx +7 -0
- package/src/components/FormControlWrapper/FORMCONTROLWRAPPER_IMPLEMENTATION_NOTES.md +32 -0
- package/src/components/FormControlWrapper/FormControlWrapper.module.css +46 -0
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +116 -0
- package/src/components/FormControlWrapper/FormControlWrapper.tsx +170 -0
- package/src/components/HoverCard/HoverCard.stories.tsx +17 -0
- package/src/components/HoverCard/HoverCard.tsx +7 -0
- package/src/components/Label/LABEL_IMPLEMENTATION_NOTES.md +48 -0
- package/src/components/Label/Label.module.css +177 -0
- package/src/components/Label/Label.stories.tsx +123 -0
- package/src/components/Label/Label.tsx +132 -0
- package/src/components/Label/index.ts +1 -0
- package/src/components/Link/Link.stories.tsx +17 -0
- package/src/components/Link/Link.tsx +7 -0
- package/src/components/Loader/Loader.stories.tsx +17 -0
- package/src/components/Loader/Loader.tsx +7 -0
- package/src/components/Menu/Menu.stories.tsx +17 -0
- package/src/components/Menu/Menu.tsx +7 -0
- package/src/components/Modal/Modal.stories.tsx +17 -0
- package/src/components/Modal/Modal.tsx +7 -0
- package/src/components/NumberInput/NumberInput.stories.tsx +22 -0
- package/src/components/NumberInput/NumberInput.tsx +7 -0
- package/src/components/Pagination/Pagination.stories.tsx +17 -0
- package/src/components/Pagination/Pagination.tsx +7 -0
- package/src/components/Panel/Panel.stories.tsx +17 -0
- package/src/components/Panel/Panel.tsx +7 -0
- package/src/components/Popover/Popover.stories.tsx +17 -0
- package/src/components/Popover/Popover.tsx +7 -0
- package/src/components/Radio/Radio.stories.tsx +22 -0
- package/src/components/Radio/Radio.tsx +7 -0
- package/src/components/ReadOnlyField/READ_ONLY_FIELD_IMPLEMENTATION_NOTES.md +15 -0
- package/src/components/ReadOnlyField/ReadOnlyField.module.css +49 -0
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +120 -0
- package/src/components/ReadOnlyField/ReadOnlyField.tsx +75 -0
- package/src/components/ReadOnlyField/ReadOnlyTextField.tsx +46 -0
- package/src/components/ReadOnlyField/WithReadOnlyWrapper.tsx +85 -0
- package/src/components/ReadOnlyField/index.ts +3 -0
- package/src/components/Search/Search.stories.tsx +17 -0
- package/src/components/Search/Search.tsx +7 -0
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +22 -0
- package/src/components/SegmentedControl/SegmentedControl.tsx +7 -0
- package/src/components/Slider/Slider.stories.tsx +22 -0
- package/src/components/Slider/Slider.tsx +7 -0
- package/src/components/Stepper/Stepper.stories.tsx +17 -0
- package/src/components/Stepper/Stepper.tsx +7 -0
- package/src/components/Switch/Switch.stories.tsx +22 -0
- package/src/components/Switch/Switch.tsx +7 -0
- package/src/components/Table/Table.stories.tsx +17 -0
- package/src/components/Table/Table.tsx +7 -0
- package/src/components/Tabs/Tabs.stories.tsx +17 -0
- package/src/components/Tabs/Tabs.tsx +7 -0
- package/src/components/Text/Text.stories.tsx +88 -0
- package/src/components/Text/Text.tsx +54 -0
- package/src/components/TextArea/TextArea.stories.tsx +22 -0
- package/src/components/TextArea/TextArea.tsx +7 -0
- package/src/components/TextField/TEXTFIELD_IMPLEMENTATION_NOTES.md +19 -0
- package/src/components/TextField/TextField.module.css +225 -0
- package/src/components/TextField/TextField.stories.tsx +162 -0
- package/src/components/TextField/TextField.tsx +138 -0
- package/src/components/TimePicker/TimePicker.stories.tsx +22 -0
- package/src/components/TimePicker/TimePicker.tsx +7 -0
- package/src/components/Timeline/Timeline.stories.tsx +17 -0
- package/src/components/Timeline/Timeline.tsx +7 -0
- package/src/components/Title/Title.stories.tsx +63 -0
- package/src/components/Title/Title.tsx +45 -0
- package/src/components/Toast/Toast.stories.tsx +17 -0
- package/src/components/Toast/Toast.tsx +7 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +17 -0
- package/src/components/Tooltip/Tooltip.tsx +7 -0
- package/src/components/TransferList/TransferList.stories.tsx +17 -0
- package/src/components/TransferList/TransferList.tsx +7 -0
- package/src/components/index.ts +39 -0
- package/src/env.d.ts +7 -0
- package/src/index.ts +3 -0
- package/src/types/index.ts +9 -0
- package/src/types/mantine.d.ts +7 -0
- package/src/types/scss-modules.d.ts +9 -0
- package/src/utils/ColorSchemeWrapper.tsx +27 -0
- package/src/utils/copyToClipboard.ts +36 -0
- package/src/utils/filterStylingProps.ts +139 -0
- package/src/utils/index.ts +1 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { TextField } from "./TextField";
|
|
3
|
+
import { formControlArgTypes } from "../../../.storybook/commonArgTypes";
|
|
4
|
+
const meta: Meta<typeof TextField> = {
|
|
5
|
+
title: "UI-Kit/TextField",
|
|
6
|
+
component: TextField,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `
|
|
12
|
+
The \`TextField\` primitive functions as a universal text entry input natively integrated directly into the unified \`FormControlWrapper\` architecture.
|
|
13
|
+
|
|
14
|
+
### Architectural Decoupling
|
|
15
|
+
Recursica forcibly overrides the internal Mantine \`Input.Wrapper\` defaults injecting an untamed \`<Input>\` layout primitive perfectly mapped back into our rigid design systems. State modifiers (e.g. Focus, Errors) hook flawlessly back onto our CSS module mapping variable colors strictly accurately.
|
|
16
|
+
|
|
17
|
+
### Examples
|
|
18
|
+
Always structure horizontal architectures via the generic \`formLayout\` parameter.
|
|
19
|
+
\`\`\`tsx
|
|
20
|
+
<TextField
|
|
21
|
+
label="Primary Network Socket"
|
|
22
|
+
assistiveText="Ensure connections resolve seamlessly."
|
|
23
|
+
formLayout="stacked"
|
|
24
|
+
/>
|
|
25
|
+
\`\`\`
|
|
26
|
+
`,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
argTypes: {
|
|
31
|
+
...formControlArgTypes,
|
|
32
|
+
disabled: {
|
|
33
|
+
control: "boolean",
|
|
34
|
+
description:
|
|
35
|
+
"Maps the formal disabled variable states structurally to the input core.",
|
|
36
|
+
},
|
|
37
|
+
error: {
|
|
38
|
+
control: "text",
|
|
39
|
+
description:
|
|
40
|
+
"Applies the strict error string boundary rendering invalid structures seamlessly.",
|
|
41
|
+
},
|
|
42
|
+
required: {
|
|
43
|
+
control: "boolean",
|
|
44
|
+
},
|
|
45
|
+
label: {
|
|
46
|
+
control: "text",
|
|
47
|
+
},
|
|
48
|
+
assistiveText: {
|
|
49
|
+
control: "text",
|
|
50
|
+
},
|
|
51
|
+
readOnly: {
|
|
52
|
+
control: "boolean",
|
|
53
|
+
description:
|
|
54
|
+
"Toggles structural read-only data presentation explicitly blocking standard component bindings.",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default meta;
|
|
60
|
+
|
|
61
|
+
type Story = StoryObj<typeof TextField>;
|
|
62
|
+
|
|
63
|
+
export const Default: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
disabled: false,
|
|
66
|
+
label: "Authentication Token",
|
|
67
|
+
placeholder: "Enter validation hash...",
|
|
68
|
+
assistiveText:
|
|
69
|
+
"Tokens are stored identically locally and strictly ephemeral.",
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const FormsSideBySide: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
label: "Distributed Access Control",
|
|
76
|
+
placeholder: "admin@node.local",
|
|
77
|
+
assistiveText:
|
|
78
|
+
"Specify the exact cluster administrative credentials enforcing strict domain policies. This violently long string tests native textual wrapping safely mapping alongside inputs.",
|
|
79
|
+
formLayout: "side-by-side",
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const WithLeadingIcon: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
label: "Search Global Context",
|
|
86
|
+
placeholder: "Search for repositories...",
|
|
87
|
+
leftSection: (
|
|
88
|
+
<svg
|
|
89
|
+
width="24"
|
|
90
|
+
height="24"
|
|
91
|
+
viewBox="0 0 24 24"
|
|
92
|
+
fill="none"
|
|
93
|
+
stroke="currentColor"
|
|
94
|
+
strokeWidth="2"
|
|
95
|
+
strokeLinecap="round"
|
|
96
|
+
strokeLinejoin="round"
|
|
97
|
+
>
|
|
98
|
+
<circle cx="11" cy="11" r="8"></circle>
|
|
99
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
|
|
100
|
+
</svg>
|
|
101
|
+
),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const WithTrailingIcon: Story = {
|
|
106
|
+
args: {
|
|
107
|
+
label: "Validation URL",
|
|
108
|
+
placeholder: "https://recursica.dev",
|
|
109
|
+
rightSection: (
|
|
110
|
+
<svg
|
|
111
|
+
width="24"
|
|
112
|
+
height="24"
|
|
113
|
+
viewBox="0 0 24 24"
|
|
114
|
+
fill="none"
|
|
115
|
+
stroke="currentColor"
|
|
116
|
+
strokeWidth="2"
|
|
117
|
+
strokeLinecap="round"
|
|
118
|
+
strokeLinejoin="round"
|
|
119
|
+
>
|
|
120
|
+
<polyline points="20 6 9 17 4 12"></polyline>
|
|
121
|
+
</svg>
|
|
122
|
+
),
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const Disabled: Story = {
|
|
127
|
+
args: {
|
|
128
|
+
label: "Disabled Deployment Node",
|
|
129
|
+
placeholder: "Disabled primitive map...",
|
|
130
|
+
disabled: true,
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const ErrorState: Story = {
|
|
135
|
+
args: {
|
|
136
|
+
label: "Cluster Failure",
|
|
137
|
+
placeholder: "Failing component instance...",
|
|
138
|
+
defaultValue: "Invalid Execution Plan",
|
|
139
|
+
error:
|
|
140
|
+
"Critical runtime node disconnect detected traversing DOM architecture.",
|
|
141
|
+
required: true,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const StaticReadOnly: Story = {
|
|
146
|
+
args: {
|
|
147
|
+
label: "Static ReadOnly Review",
|
|
148
|
+
placeholder: "Ignored...",
|
|
149
|
+
value: "Explicitly Uneditable Bound Output",
|
|
150
|
+
readOnly: true,
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const EditableReadOnly: Story = {
|
|
155
|
+
args: {
|
|
156
|
+
label: "Editable ReadOnly Review",
|
|
157
|
+
placeholder: "Ignored until active...",
|
|
158
|
+
defaultValue: "Waiting for Edit Execution",
|
|
159
|
+
readOnly: true,
|
|
160
|
+
labelWithEditIcon: true,
|
|
161
|
+
},
|
|
162
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { Input, type InputProps, type InputWrapperProps } from "@mantine/core";
|
|
3
|
+
import { type ReadOnlyControlProps } from "@recursica/adapter-common";
|
|
4
|
+
import {
|
|
5
|
+
filterStylingProps,
|
|
6
|
+
type RecursicaOverStyled,
|
|
7
|
+
} from "../../utils/filterStylingProps";
|
|
8
|
+
import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/FormControlWrapper";
|
|
9
|
+
import { WithReadOnlyWrapper } from "../ReadOnlyField/WithReadOnlyWrapper";
|
|
10
|
+
import styles from "./TextField.module.css";
|
|
11
|
+
|
|
12
|
+
export interface RecursicaTextFieldProps
|
|
13
|
+
extends Omit<InputProps, "size" | "variant" | "radius" | "wrapperProps">,
|
|
14
|
+
Pick<
|
|
15
|
+
InputWrapperProps,
|
|
16
|
+
"label" | "error" | "required" | "withAsterisk" | "id"
|
|
17
|
+
>,
|
|
18
|
+
Omit<
|
|
19
|
+
React.ComponentPropsWithoutRef<"input">,
|
|
20
|
+
"size" | "style" | "className" | "id"
|
|
21
|
+
>,
|
|
22
|
+
Omit<
|
|
23
|
+
RecursicaFormControlWrapperProps,
|
|
24
|
+
"controlMaxWidth" | "controlMinWidth"
|
|
25
|
+
>,
|
|
26
|
+
ReadOnlyControlProps {}
|
|
27
|
+
|
|
28
|
+
export type TextFieldProps = RecursicaOverStyled<RecursicaTextFieldProps>;
|
|
29
|
+
|
|
30
|
+
export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
31
|
+
function TextField(
|
|
32
|
+
{
|
|
33
|
+
overStyled = false,
|
|
34
|
+
formLayout = "stacked",
|
|
35
|
+
|
|
36
|
+
// Label & Wrapper Maps
|
|
37
|
+
labelSize,
|
|
38
|
+
labelAlignment,
|
|
39
|
+
labelOptionalText,
|
|
40
|
+
labelWithEditIcon,
|
|
41
|
+
onLabelEditClick,
|
|
42
|
+
|
|
43
|
+
label,
|
|
44
|
+
assistiveText,
|
|
45
|
+
assistiveWithIcon,
|
|
46
|
+
error,
|
|
47
|
+
required,
|
|
48
|
+
withAsterisk,
|
|
49
|
+
id,
|
|
50
|
+
className,
|
|
51
|
+
style,
|
|
52
|
+
disabled,
|
|
53
|
+
readOnly,
|
|
54
|
+
readOnlyComponent,
|
|
55
|
+
value,
|
|
56
|
+
defaultValue,
|
|
57
|
+
...rest
|
|
58
|
+
},
|
|
59
|
+
ref,
|
|
60
|
+
) {
|
|
61
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
62
|
+
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
63
|
+
|
|
64
|
+
// Delete prohibited sizing hooks from bypassing variables natively
|
|
65
|
+
delete restRecord["size"];
|
|
66
|
+
delete restRecord["variant"];
|
|
67
|
+
delete restRecord["radius"];
|
|
68
|
+
|
|
69
|
+
// Securely map core native blocks down ensuring nested CSS modules map precisely
|
|
70
|
+
const mergedClassNames: Partial<Record<string, string>> = {
|
|
71
|
+
wrapper: styles.root, // The nested Input internal relative wrapper bounding box
|
|
72
|
+
input: styles.input,
|
|
73
|
+
section: styles.section,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const classNamesProp = restRecord.classNames;
|
|
77
|
+
if (
|
|
78
|
+
classNamesProp &&
|
|
79
|
+
typeof classNamesProp === "object" &&
|
|
80
|
+
!Array.isArray(classNamesProp)
|
|
81
|
+
) {
|
|
82
|
+
const o = classNamesProp as Partial<Record<string, string>>;
|
|
83
|
+
mergedClassNames.wrapper = o.wrapper
|
|
84
|
+
? `${styles.root} ${o.wrapper}`
|
|
85
|
+
: styles.root;
|
|
86
|
+
mergedClassNames.input = o.input
|
|
87
|
+
? `${styles.input} ${o.input}`
|
|
88
|
+
: styles.input;
|
|
89
|
+
mergedClassNames.section = o.section
|
|
90
|
+
? `${styles.section} ${o.section}`
|
|
91
|
+
: styles.section;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<WithReadOnlyWrapper
|
|
96
|
+
className={className}
|
|
97
|
+
style={style as React.CSSProperties}
|
|
98
|
+
controlMaxWidth="var(--recursica_ui-kit_components_text-field_properties_max-width)"
|
|
99
|
+
controlMinWidth="var(--recursica_ui-kit_components_text-field_properties_min-width)"
|
|
100
|
+
overStyled={overStyled as true}
|
|
101
|
+
formLayout={formLayout}
|
|
102
|
+
labelSize={labelSize}
|
|
103
|
+
labelAlignment={labelAlignment}
|
|
104
|
+
labelOptionalText={labelOptionalText}
|
|
105
|
+
labelWithEditIcon={labelWithEditIcon}
|
|
106
|
+
onLabelEditClick={onLabelEditClick}
|
|
107
|
+
label={label}
|
|
108
|
+
assistiveText={assistiveText}
|
|
109
|
+
assistiveWithIcon={assistiveWithIcon}
|
|
110
|
+
error={error}
|
|
111
|
+
required={required}
|
|
112
|
+
withAsterisk={withAsterisk}
|
|
113
|
+
id={id}
|
|
114
|
+
readOnly={readOnly}
|
|
115
|
+
readOnlyComponent={readOnlyComponent}
|
|
116
|
+
readOnlyType="text"
|
|
117
|
+
readOnlyValue={value !== undefined ? value : defaultValue}
|
|
118
|
+
activeComponent={
|
|
119
|
+
/* Naked Input execution safely decoupled from Mantine's macro Input.Wrapper DOM hooks */
|
|
120
|
+
<Input
|
|
121
|
+
ref={ref}
|
|
122
|
+
classNames={mergedClassNames}
|
|
123
|
+
disabled={disabled}
|
|
124
|
+
value={value}
|
|
125
|
+
defaultValue={defaultValue}
|
|
126
|
+
wrapperProps={{
|
|
127
|
+
"data-disabled": disabled ? "true" : undefined,
|
|
128
|
+
"data-error": error ? "true" : undefined,
|
|
129
|
+
}}
|
|
130
|
+
{...(sanitizedProps as unknown as InputProps)}
|
|
131
|
+
/>
|
|
132
|
+
}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
TextField.displayName = "TextField";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { TimePicker } from "./TimePicker";
|
|
3
|
+
import { ComingSoon } from "@recursica/storybook-template";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof TimePicker> = {
|
|
6
|
+
title: "UI-Kit/🚧 TimePicker",
|
|
7
|
+
component: TimePicker,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
argTypes: {
|
|
10
|
+
disabled: {
|
|
11
|
+
control: "boolean",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
|
|
18
|
+
type Story = StoryObj<typeof TimePicker>;
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
render: () => <ComingSoon componentName="TimePicker" />,
|
|
22
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Timeline } from "./Timeline";
|
|
3
|
+
import { ComingSoon } from "@recursica/storybook-template";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Timeline> = {
|
|
6
|
+
title: "UI-Kit/🚧 Timeline",
|
|
7
|
+
component: Timeline,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof Timeline>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
render: () => <ComingSoon componentName="Timeline" />,
|
|
17
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Title } from "./Title";
|
|
3
|
+
import { Layer } from "@recursica/adapter-common";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Title> = {
|
|
6
|
+
title: "UI-Kit/Title",
|
|
7
|
+
component: Title,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
"The semantic `<Title>` abstraction intrinsically links pure `h1-h6` tag generation with exact Recursica design boundaries to preserve SEO and screen reader trees uniformly globally.",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
order: {
|
|
19
|
+
control: "select",
|
|
20
|
+
options: [1, 2, 3, 4, 5, 6],
|
|
21
|
+
description:
|
|
22
|
+
"Controls the `h` tag and the resultant typographical weighting natively mapped to Recursica.",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<typeof Title>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
order: 1,
|
|
34
|
+
children: "Semantic H1 Document Boundary",
|
|
35
|
+
},
|
|
36
|
+
render: ({ ...args }) => (
|
|
37
|
+
<Layer layer={0} style={{ padding: "48px" }}>
|
|
38
|
+
<Title {...args} />
|
|
39
|
+
</Layer>
|
|
40
|
+
),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const StaticVariations: Story = {
|
|
44
|
+
args: {},
|
|
45
|
+
render: () => (
|
|
46
|
+
<Layer
|
|
47
|
+
layer={0}
|
|
48
|
+
style={{
|
|
49
|
+
padding: "48px",
|
|
50
|
+
display: "flex",
|
|
51
|
+
flexDirection: "column",
|
|
52
|
+
gap: "24px",
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
<Title order={1}>H1 Title</Title>
|
|
56
|
+
<Title order={2}>H2 Title</Title>
|
|
57
|
+
<Title order={3}>H3 Title</Title>
|
|
58
|
+
<Title order={4}>H4 Title</Title>
|
|
59
|
+
<Title order={5}>H5 Title</Title>
|
|
60
|
+
<Title order={6}>H6 Title</Title>
|
|
61
|
+
</Layer>
|
|
62
|
+
),
|
|
63
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Title as MantineTitle,
|
|
4
|
+
type TitleProps as MantineTitleProps,
|
|
5
|
+
} from "@mantine/core";
|
|
6
|
+
import {
|
|
7
|
+
filterStylingProps,
|
|
8
|
+
type RecursicaOverStyled,
|
|
9
|
+
} from "../../utils/filterStylingProps";
|
|
10
|
+
|
|
11
|
+
export type RecursicaTitleProps = Omit<MantineTitleProps, "order"> & {
|
|
12
|
+
/**
|
|
13
|
+
* Enforces semantic HTML headers (h1-h6) cleanly bound to native typographic scaling variables in the design system.
|
|
14
|
+
*/
|
|
15
|
+
order?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type TitleProps = RecursicaOverStyled<RecursicaTitleProps>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Enforces highly accessible structural markup utilizing semantic `<h1>` through `<h6>` tags securely bound directly to Recursica typographic scales.
|
|
22
|
+
*/
|
|
23
|
+
export const Title = forwardRef<HTMLHeadingElement, TitleProps>(function Title(
|
|
24
|
+
{ overStyled = false, order = 1, ...rest },
|
|
25
|
+
ref,
|
|
26
|
+
) {
|
|
27
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
28
|
+
const classNameProp = (sanitizedProps as Record<string, unknown>)
|
|
29
|
+
.className as string | undefined;
|
|
30
|
+
|
|
31
|
+
const typographyClass = `recursica_brand_typography_h${order}`;
|
|
32
|
+
const mergedClassName = classNameProp
|
|
33
|
+
? `${typographyClass} ${classNameProp}`
|
|
34
|
+
: typographyClass;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<MantineTitle
|
|
38
|
+
ref={ref}
|
|
39
|
+
order={order}
|
|
40
|
+
className={mergedClassName}
|
|
41
|
+
{...(sanitizedProps as unknown as MantineTitleProps)}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
Title.displayName = "Title";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Toast } from "./Toast";
|
|
3
|
+
import { ComingSoon } from "@recursica/storybook-template";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Toast> = {
|
|
6
|
+
title: "UI-Kit/🚧 Toast",
|
|
7
|
+
component: Toast,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof Toast>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
render: () => <ComingSoon componentName="Toast" />,
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Tooltip } from "./Tooltip";
|
|
3
|
+
import { ComingSoon } from "@recursica/storybook-template";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Tooltip> = {
|
|
6
|
+
title: "UI-Kit/🚧 Tooltip",
|
|
7
|
+
component: Tooltip,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof Tooltip>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
render: () => <ComingSoon componentName="Tooltip" />,
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { TransferList } from "./TransferList";
|
|
3
|
+
import { ComingSoon } from "@recursica/storybook-template";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof TransferList> = {
|
|
6
|
+
title: "UI-Kit/🚧 TransferList",
|
|
7
|
+
component: TransferList,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof TransferList>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
render: () => <ComingSoon componentName="TransferList" />,
|
|
17
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export * from "./Accordion";
|
|
2
|
+
export * from "./Avatar";
|
|
3
|
+
export * from "./Badge/Badge";
|
|
4
|
+
export * from "./Breadcrumb/Breadcrumb";
|
|
5
|
+
export * from "./Button";
|
|
6
|
+
export * from "./Card/Card";
|
|
7
|
+
export * from "./Checkbox/Checkbox";
|
|
8
|
+
export * from "./Checkbox/CheckboxGroup";
|
|
9
|
+
export * from "./Chip/Chip";
|
|
10
|
+
export * from "./DatePicker/DatePicker";
|
|
11
|
+
export * from "./Dropdown/Dropdown";
|
|
12
|
+
export * from "./FileInput/FileInput";
|
|
13
|
+
export * from "./FileUpload/FileUpload";
|
|
14
|
+
export * from "./HoverCard/HoverCard";
|
|
15
|
+
export * from "./Link/Link";
|
|
16
|
+
export * from "./Loader/Loader";
|
|
17
|
+
export * from "./Label";
|
|
18
|
+
export * from "./Menu/Menu";
|
|
19
|
+
export * from "./Modal/Modal";
|
|
20
|
+
export * from "./NumberInput/NumberInput";
|
|
21
|
+
export * from "./Pagination/Pagination";
|
|
22
|
+
export * from "./Panel/Panel";
|
|
23
|
+
export * from "./Popover/Popover";
|
|
24
|
+
export * from "./Radio/Radio";
|
|
25
|
+
export * from "./ReadOnlyField";
|
|
26
|
+
export * from "./Search/Search";
|
|
27
|
+
export * from "./SegmentedControl/SegmentedControl";
|
|
28
|
+
export * from "./Slider/Slider";
|
|
29
|
+
export * from "./Stepper/Stepper";
|
|
30
|
+
export * from "./Switch/Switch";
|
|
31
|
+
export * from "./Table/Table";
|
|
32
|
+
export * from "./Tabs/Tabs";
|
|
33
|
+
export * from "./TextArea/TextArea";
|
|
34
|
+
export * from "./TextField/TextField";
|
|
35
|
+
export * from "./TimePicker/TimePicker";
|
|
36
|
+
export * from "./Timeline/Timeline";
|
|
37
|
+
export * from "./Toast/Toast";
|
|
38
|
+
export * from "./Tooltip/Tooltip";
|
|
39
|
+
export * from "./TransferList/TransferList";
|
package/src/env.d.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComboboxItem as RecursicaComboboxItem } from "./index";
|
|
2
|
+
import "@mantine/core";
|
|
3
|
+
|
|
4
|
+
declare module "@mantine/core" {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
6
|
+
export interface ComboboxItem extends RecursicaComboboxItem {}
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useMantineColorScheme } from "@mantine/core";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { addons } from "storybook/internal/preview-api";
|
|
4
|
+
import { DARK_MODE_EVENT_NAME } from "storybook-dark-mode";
|
|
5
|
+
|
|
6
|
+
const channel = addons.getChannel();
|
|
7
|
+
|
|
8
|
+
export function ColorSchemeWrapper({
|
|
9
|
+
children,
|
|
10
|
+
}: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}) {
|
|
13
|
+
const { setColorScheme } = useMantineColorScheme();
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const handleColorScheme = (value: boolean) => {
|
|
17
|
+
const theme = value ? "dark" : "light";
|
|
18
|
+
setColorScheme(theme);
|
|
19
|
+
document.documentElement.setAttribute("data-recursica-theme", theme);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
channel.on(DARK_MODE_EVENT_NAME, handleColorScheme);
|
|
23
|
+
return () => channel.off(DARK_MODE_EVENT_NAME, handleColorScheme);
|
|
24
|
+
}, [setColorScheme]);
|
|
25
|
+
|
|
26
|
+
return <>{children}</>;
|
|
27
|
+
}
|