@recursica/mantine-adapter 0.9.4 → 0.11.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 +94 -0
- package/README.md +48 -332
- package/dist/index.d.ts +2 -8
- package/dist/mantine-adapter.cjs +2 -0
- package/dist/mantine-adapter.cjs.map +1 -0
- package/dist/mantine-adapter.css +1 -0
- package/dist/mantine-adapter.js +1963 -0
- package/dist/mantine-adapter.js.map +1 -0
- package/dist/src/components/Accordion/Accordion.d.ts +42 -0
- package/dist/src/components/Accordion/index.d.ts +1 -0
- package/dist/src/components/AssistiveElement/AssistiveElement.d.ts +10 -0
- package/dist/src/components/Avatar/Avatar.d.ts +9 -0
- package/dist/src/components/Avatar/index.d.ts +1 -0
- package/dist/src/components/Badge/Badge.d.ts +8 -0
- package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +6 -0
- package/dist/src/components/Button/Button.d.ts +10 -0
- package/dist/src/components/Button/index.d.ts +1 -0
- package/dist/src/components/Card/Card.d.ts +38 -0
- package/dist/src/components/Checkbox/Checkbox.d.ts +13 -0
- package/dist/src/components/Checkbox/CheckboxGroup.d.ts +9 -0
- package/dist/src/components/Chip/Chip.d.ts +15 -0
- package/dist/src/components/Container/Container.d.ts +18 -0
- package/dist/src/components/DatePicker/DatePicker.d.ts +3 -0
- package/dist/src/components/Dropdown/Dropdown.d.ts +11 -0
- package/dist/src/components/FileInput/FileInput.d.ts +3 -0
- package/dist/src/components/FileUpload/FileUpload.d.ts +3 -0
- package/dist/src/components/Flex/Flex.d.ts +17 -0
- package/dist/src/components/FormControlLayout/FormControlLayout.d.ts +21 -0
- package/dist/src/components/FormControlWrapper/FormControlWrapper.d.ts +20 -0
- package/dist/src/components/Group/Group.d.ts +17 -0
- package/dist/src/components/HoverCard/HoverCard.d.ts +3 -0
- package/dist/src/components/Label/Label.d.ts +19 -0
- package/dist/src/components/Label/index.d.ts +1 -0
- package/dist/src/components/Link/Link.d.ts +3 -0
- package/dist/src/components/Loader/Loader.d.ts +10 -0
- package/dist/src/components/Menu/Menu.d.ts +3 -0
- package/dist/src/components/Modal/Modal.d.ts +3 -0
- package/dist/src/components/NumberInput/NumberInput.d.ts +3 -0
- package/dist/src/components/Pagination/Pagination.d.ts +3 -0
- package/dist/src/components/Panel/Panel.d.ts +3 -0
- package/dist/src/components/Popover/Popover.d.ts +3 -0
- package/dist/src/components/Radio/Radio.d.ts +13 -0
- 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 +20 -0
- 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 +5 -0
- package/dist/src/components/Search/Search.d.ts +3 -0
- package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/dist/src/components/Slider/Slider.d.ts +3 -0
- package/dist/src/components/Stack/Stack.d.ts +15 -0
- package/dist/src/components/Stepper/Stepper.d.ts +3 -0
- package/dist/src/components/Switch/Switch.d.ts +13 -0
- package/dist/src/components/Switch/SwitchGroup.d.ts +9 -0
- package/dist/src/components/Table/Table.d.ts +3 -0
- package/dist/src/components/Tabs/Tabs.d.ts +3 -0
- package/dist/src/components/Text/Text.d.ts +17 -0
- package/dist/src/components/TextArea/TextArea.d.ts +15 -0
- package/dist/src/components/TextField/TextField.d.ts +9 -0
- package/dist/src/components/TimePicker/TimePicker.d.ts +3 -0
- package/dist/src/components/Timeline/Timeline.d.ts +3 -0
- package/dist/src/components/Title/Title.d.ts +13 -0
- package/dist/src/components/Toast/Toast.d.ts +3 -0
- package/dist/src/components/Tooltip/Tooltip.d.ts +3 -0
- package/dist/src/components/TransferList/TransferList.d.ts +3 -0
- package/dist/src/components/index.d.ts +48 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/types/index.d.ts +6 -0
- package/dist/src/utils/ColorSchemeWrapper.d.ts +3 -0
- package/dist/src/utils/RequireAccessibleLabel.d.ts +18 -0
- package/dist/src/utils/copyToClipboard.d.ts +8 -0
- package/dist/src/utils/filterStylingProps.d.ts +36 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vite.svg +1 -0
- package/dist/vitest.workspace.d.ts +2 -0
- package/package.json +74 -35
- 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 +282 -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 +75 -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 +107 -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 +78 -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 +103 -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 +94 -0
- package/src/components/Checkbox/Checkbox.tsx +159 -0
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +139 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +120 -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/Container/CONTAINER_IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Container/Container.module.css +7 -0
- package/src/components/Container/Container.stories.tsx +118 -0
- package/src/components/Container/Container.tsx +89 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +18 -0
- package/src/components/DatePicker/DatePicker.tsx +7 -0
- package/src/components/Dropdown/DROPDOWN_IMPLEMENTATION_NOTES.md +7 -0
- package/src/components/Dropdown/Dropdown.module.css +272 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +91 -0
- package/src/components/Dropdown/Dropdown.tsx +174 -0
- package/src/components/FileInput/FileInput.stories.tsx +18 -0
- package/src/components/FileInput/FileInput.tsx +7 -0
- package/src/components/FileUpload/FileUpload.stories.tsx +18 -0
- package/src/components/FileUpload/FileUpload.tsx +7 -0
- package/src/components/Flex/FLEX_IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Flex/Flex.module.css +7 -0
- package/src/components/Flex/Flex.stories.tsx +128 -0
- package/src/components/Flex/Flex.tsx +68 -0
- package/src/components/FormControlLayout/FormControlLayout.module.css +80 -0
- package/src/components/FormControlLayout/FormControlLayout.stories.tsx +82 -0
- package/src/components/FormControlLayout/FormControlLayout.tsx +78 -0
- package/src/components/FormControlWrapper/FORMCONTROLWRAPPER_IMPLEMENTATION_NOTES.md +32 -0
- package/src/components/FormControlWrapper/FormControlWrapper.module.css +8 -0
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +129 -0
- package/src/components/FormControlWrapper/FormControlWrapper.tsx +157 -0
- package/src/components/Group/GROUP_IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Group/Group.module.css +7 -0
- package/src/components/Group/Group.stories.tsx +120 -0
- package/src/components/Group/Group.tsx +68 -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 +140 -0
- package/src/components/Label/Label.stories.tsx +122 -0
- package/src/components/Label/Label.tsx +127 -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.module.css +60 -0
- package/src/components/Loader/Loader.stories.tsx +103 -0
- package/src/components/Loader/Loader.tsx +76 -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 +18 -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.module.css +207 -0
- package/src/components/Radio/Radio.stories.tsx +90 -0
- package/src/components/Radio/Radio.tsx +174 -0
- package/src/components/Radio/RadioGroup.stories.tsx +117 -0
- package/src/components/Radio/RadioGroup.tsx +118 -0
- package/src/components/ReadOnlyField/READ_ONLY_FIELD_IMPLEMENTATION_NOTES.md +15 -0
- package/src/components/ReadOnlyField/ReadOnlyBooleanField.tsx +21 -0
- package/src/components/ReadOnlyField/ReadOnlyField.module.css +49 -0
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +163 -0
- package/src/components/ReadOnlyField/ReadOnlyField.tsx +102 -0
- 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 +5 -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 +18 -0
- package/src/components/SegmentedControl/SegmentedControl.tsx +7 -0
- package/src/components/Slider/Slider.stories.tsx +18 -0
- package/src/components/Slider/Slider.tsx +7 -0
- package/src/components/Stack/STACK_IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Stack/Stack.module.css +7 -0
- package/src/components/Stack/Stack.stories.tsx +108 -0
- package/src/components/Stack/Stack.tsx +66 -0
- package/src/components/Stepper/Stepper.stories.tsx +17 -0
- package/src/components/Stepper/Stepper.tsx +7 -0
- package/src/components/Switch/SWITCH_IMPLEMENTATION_NOTES.md +28 -0
- package/src/components/Switch/Switch.module.css +199 -0
- package/src/components/Switch/Switch.stories.tsx +111 -0
- package/src/components/Switch/Switch.tsx +168 -0
- package/src/components/Switch/SwitchGroup.stories.tsx +132 -0
- package/src/components/Switch/SwitchGroup.tsx +118 -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_IMPLEMENTATION_NOTES.md +7 -0
- package/src/components/TextArea/TextArea.module.css +225 -0
- package/src/components/TextArea/TextArea.stories.tsx +91 -0
- package/src/components/TextArea/TextArea.tsx +152 -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 +139 -0
- package/src/components/TimePicker/TimePicker.stories.tsx +18 -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 +48 -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/RequireAccessibleLabel.ts +12 -0
- package/src/utils/copyToClipboard.ts +36 -0
- package/src/utils/filterStylingProps.ts +141 -0
- package/src/utils/index.ts +1 -0
- package/dist/adapter/generateBorderRadiusType.d.ts +0 -3
- package/dist/adapter/generateBorderRadiusType.d.ts.map +0 -1
- package/dist/adapter/generateColorTypes.d.ts +0 -6
- package/dist/adapter/generateColorTypes.d.ts.map +0 -1
- package/dist/adapter/generateIcons.d.ts +0 -8
- package/dist/adapter/generateIcons.d.ts.map +0 -1
- package/dist/adapter/generateMantineTheme.d.ts +0 -19
- package/dist/adapter/generateMantineTheme.d.ts.map +0 -1
- package/dist/adapter/generatePrettierignore.d.ts +0 -3
- package/dist/adapter/generatePrettierignore.d.ts.map +0 -1
- package/dist/adapter/generateRecursicaObject.d.ts +0 -7
- package/dist/adapter/generateRecursicaObject.d.ts.map +0 -1
- package/dist/adapter/generateRecursicaThemes.d.ts +0 -12
- package/dist/adapter/generateRecursicaThemes.d.ts.map +0 -1
- package/dist/adapter/generateRecursicaTokens.d.ts +0 -3
- package/dist/adapter/generateRecursicaTokens.d.ts.map +0 -1
- package/dist/adapter/generateSpacersType.d.ts +0 -3
- package/dist/adapter/generateSpacersType.d.ts.map +0 -1
- package/dist/adapter/generateUiKit.d.ts +0 -8
- package/dist/adapter/generateUiKit.d.ts.map +0 -1
- package/dist/adapter/generateVanillaExtractThemes.d.ts +0 -12
- package/dist/adapter/generateVanillaExtractThemes.d.ts.map +0 -1
- package/dist/adapter/index.d.ts +0 -44
- package/dist/adapter/index.d.ts.map +0 -1
- package/dist/cli.d.ts +0 -6
- package/dist/cli.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -921
- package/dist/index.js.map +0 -1
- package/dist/main.cjs +0 -928
- package/dist/main.cjs.map +0 -1
- package/dist/main.d.ts +0 -2
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js +0 -926
- package/dist/main.js.map +0 -1
- package/dist/shared/processTokens.d.ts +0 -22
- package/dist/shared/processTokens.d.ts.map +0 -1
- package/dist/types.d.ts +0 -62
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/fileCheck.d.ts +0 -8
- package/dist/utils/fileCheck.d.ts.map +0 -1
- package/dist/utils/loadConfig.d.ts +0 -24
- package/dist/utils/loadConfig.d.ts.map +0 -1
- package/dist/webworker.d.ts +0 -2
- package/dist/webworker.d.ts.map +0 -1
- package/dist/webworker.js +0 -791
|
@@ -0,0 +1,139 @@
|
|
|
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(props, ref) {
|
|
32
|
+
const {
|
|
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
|
+
emptyValueComponent,
|
|
56
|
+
value,
|
|
57
|
+
defaultValue,
|
|
58
|
+
...rest
|
|
59
|
+
} = props;
|
|
60
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
61
|
+
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
62
|
+
|
|
63
|
+
// Delete prohibited sizing hooks from bypassing variables natively
|
|
64
|
+
delete restRecord["size"];
|
|
65
|
+
delete restRecord["variant"];
|
|
66
|
+
delete restRecord["radius"];
|
|
67
|
+
|
|
68
|
+
// Securely map core native blocks down ensuring nested CSS modules map precisely
|
|
69
|
+
const mergedClassNames: Partial<Record<string, string>> = {
|
|
70
|
+
wrapper: styles.root, // The nested Input internal relative wrapper bounding box
|
|
71
|
+
input: styles.input,
|
|
72
|
+
section: styles.section,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const classNamesProp = restRecord.classNames;
|
|
76
|
+
if (
|
|
77
|
+
classNamesProp &&
|
|
78
|
+
typeof classNamesProp === "object" &&
|
|
79
|
+
!Array.isArray(classNamesProp)
|
|
80
|
+
) {
|
|
81
|
+
const o = classNamesProp as Partial<Record<string, string>>;
|
|
82
|
+
mergedClassNames.wrapper = o.wrapper
|
|
83
|
+
? `${styles.root} ${o.wrapper}`
|
|
84
|
+
: styles.root;
|
|
85
|
+
mergedClassNames.input = o.input
|
|
86
|
+
? `${styles.input} ${o.input}`
|
|
87
|
+
: styles.input;
|
|
88
|
+
mergedClassNames.section = o.section
|
|
89
|
+
? `${styles.section} ${o.section}`
|
|
90
|
+
: styles.section;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<WithReadOnlyWrapper
|
|
95
|
+
className={className}
|
|
96
|
+
style={style as React.CSSProperties}
|
|
97
|
+
controlMaxWidth="var(--recursica_ui-kit_components_text-field_properties_max-width)"
|
|
98
|
+
controlMinWidth="var(--recursica_ui-kit_components_text-field_properties_min-width)"
|
|
99
|
+
overStyled={overStyled as true}
|
|
100
|
+
formLayout={formLayout}
|
|
101
|
+
labelSize={labelSize}
|
|
102
|
+
labelAlignment={labelAlignment}
|
|
103
|
+
labelOptionalText={labelOptionalText}
|
|
104
|
+
labelWithEditIcon={labelWithEditIcon}
|
|
105
|
+
onLabelEditClick={onLabelEditClick}
|
|
106
|
+
label={label}
|
|
107
|
+
assistiveText={assistiveText}
|
|
108
|
+
assistiveWithIcon={assistiveWithIcon}
|
|
109
|
+
error={error}
|
|
110
|
+
required={required}
|
|
111
|
+
withAsterisk={withAsterisk}
|
|
112
|
+
id={id}
|
|
113
|
+
readOnly={readOnly}
|
|
114
|
+
readOnlyComponent={readOnlyComponent}
|
|
115
|
+
emptyValueComponent={emptyValueComponent}
|
|
116
|
+
readOnlyType="text"
|
|
117
|
+
readOnlyValue={value !== undefined ? value : defaultValue}
|
|
118
|
+
readOnlyNativeProps={props}
|
|
119
|
+
activeComponent={
|
|
120
|
+
/* Naked Input execution safely decoupled from Mantine's macro Input.Wrapper DOM hooks */
|
|
121
|
+
<Input
|
|
122
|
+
ref={ref}
|
|
123
|
+
classNames={mergedClassNames}
|
|
124
|
+
disabled={disabled}
|
|
125
|
+
value={value}
|
|
126
|
+
defaultValue={defaultValue}
|
|
127
|
+
wrapperProps={{
|
|
128
|
+
"data-disabled": disabled ? "true" : undefined,
|
|
129
|
+
"data-error": error ? "true" : undefined,
|
|
130
|
+
}}
|
|
131
|
+
{...(sanitizedProps as unknown as InputProps)}
|
|
132
|
+
/>
|
|
133
|
+
}
|
|
134
|
+
/>
|
|
135
|
+
);
|
|
136
|
+
},
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
TextField.displayName = "TextField";
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof TimePicker>;
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
render: () => <ComingSoon componentName="TimePicker" />,
|
|
18
|
+
};
|
|
@@ -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,48 @@
|
|
|
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 "./Container/Container";
|
|
11
|
+
export * from "./DatePicker/DatePicker";
|
|
12
|
+
export * from "./Dropdown/Dropdown";
|
|
13
|
+
export * from "./FileInput/FileInput";
|
|
14
|
+
export * from "./FileUpload/FileUpload";
|
|
15
|
+
export * from "./Flex/Flex";
|
|
16
|
+
export * from "./FormControlLayout/FormControlLayout";
|
|
17
|
+
export * from "./Group/Group";
|
|
18
|
+
export * from "./HoverCard/HoverCard";
|
|
19
|
+
export * from "./Link/Link";
|
|
20
|
+
export * from "./Loader/Loader";
|
|
21
|
+
export * from "./Label";
|
|
22
|
+
export * from "./Menu/Menu";
|
|
23
|
+
export * from "./Modal/Modal";
|
|
24
|
+
export * from "./NumberInput/NumberInput";
|
|
25
|
+
export * from "./Pagination/Pagination";
|
|
26
|
+
export * from "./Panel/Panel";
|
|
27
|
+
export * from "./Popover/Popover";
|
|
28
|
+
export * from "./Radio/Radio";
|
|
29
|
+
export * from "./Radio/RadioGroup";
|
|
30
|
+
export * from "./ReadOnlyField";
|
|
31
|
+
export * from "./Search/Search";
|
|
32
|
+
export * from "./SegmentedControl/SegmentedControl";
|
|
33
|
+
export * from "./Slider/Slider";
|
|
34
|
+
export * from "./Stack/Stack";
|
|
35
|
+
export * from "./Stepper/Stepper";
|
|
36
|
+
export * from "./Switch/Switch";
|
|
37
|
+
export * from "./Switch/SwitchGroup";
|
|
38
|
+
export * from "./Table/Table";
|
|
39
|
+
export * from "./Tabs/Tabs";
|
|
40
|
+
export * from "./Text/Text";
|
|
41
|
+
export * from "./TextArea/TextArea";
|
|
42
|
+
export * from "./TextField/TextField";
|
|
43
|
+
export * from "./TimePicker/TimePicker";
|
|
44
|
+
export * from "./Timeline/Timeline";
|
|
45
|
+
export * from "./Title/Title";
|
|
46
|
+
export * from "./Toast/Toast";
|
|
47
|
+
export * from "./Tooltip/Tooltip";
|
|
48
|
+
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
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enforces accessibility by strictly requiring at least one form of labeling:
|
|
5
|
+
* either a visual \`label\`, an \`aria-label\`, or an \`aria-labelledby\`.
|
|
6
|
+
*/
|
|
7
|
+
export type RequireAccessibleLabel<T> = T &
|
|
8
|
+
(
|
|
9
|
+
| { label: ReactNode; "aria-label"?: string; "aria-labelledby"?: string }
|
|
10
|
+
| { label?: ReactNode; "aria-label": string; "aria-labelledby"?: string }
|
|
11
|
+
| { label?: ReactNode; "aria-label"?: string; "aria-labelledby": string }
|
|
12
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Helper function for copy text to clipboard
|
|
5
|
+
* @param {string} textToCopy The text string for copying to the clipboard
|
|
6
|
+
* @param {element|node} componentRef The ref of the component that we want to trigger the copy
|
|
7
|
+
*/
|
|
8
|
+
const copyToClipboard = (
|
|
9
|
+
textToCopy: string,
|
|
10
|
+
componentRef: React.RefObject<HTMLElement | null>,
|
|
11
|
+
): Promise<void> => {
|
|
12
|
+
const currentFocus = document.activeElement as HTMLInputElement;
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
if (componentRef && componentRef.current) {
|
|
15
|
+
const textArea = document.createElement("textarea");
|
|
16
|
+
textArea.readOnly = true;
|
|
17
|
+
textArea.defaultValue = textToCopy;
|
|
18
|
+
componentRef.current.appendChild(textArea);
|
|
19
|
+
textArea.select();
|
|
20
|
+
const wasCopied = document.execCommand("copy");
|
|
21
|
+
componentRef.current.removeChild(textArea);
|
|
22
|
+
if (currentFocus) {
|
|
23
|
+
currentFocus.focus();
|
|
24
|
+
}
|
|
25
|
+
if (wasCopied) {
|
|
26
|
+
resolve();
|
|
27
|
+
} else {
|
|
28
|
+
reject(new Error("Failed to copy"));
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
reject(new Error("Copy area reference is not defined"));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { copyToClipboard };
|