@recursica/mui-adapter 0.5.0 → 0.6.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.
Files changed (159) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/mui-adapter.cjs +74 -1
  3. package/dist/mui-adapter.cjs.map +1 -1
  4. package/dist/mui-adapter.css +1 -1
  5. package/dist/mui-adapter.js +6652 -204
  6. package/dist/mui-adapter.js.map +1 -1
  7. package/dist/src/components/Accordion/Accordion.d.ts +63 -2
  8. package/dist/src/components/AssistiveElement/AssistiveElement.d.ts +9 -2
  9. package/dist/src/components/Autocomplete/Autocomplete.d.ts +16 -2
  10. package/dist/src/components/Avatar/Avatar.d.ts +14 -2
  11. package/dist/src/components/Badge/Badge.d.ts +13 -3
  12. package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +10 -3
  13. package/dist/src/components/Button/Button.d.ts +1 -1
  14. package/dist/src/components/Card/Card.d.ts +40 -3
  15. package/dist/src/components/Checkbox/Checkbox.d.ts +15 -2
  16. package/dist/src/components/Checkbox/CheckboxGroup.d.ts +16 -0
  17. package/dist/src/components/Checkbox/index.d.ts +5 -1
  18. package/dist/src/components/Chip/Chip.d.ts +18 -2
  19. package/dist/src/components/Dropdown/Dropdown.d.ts +23 -3
  20. package/dist/src/components/FormControlLayout/FormControlLayout.d.ts +10 -2
  21. package/dist/src/components/FormControlWrapper/FormControlWrapper.d.ts +24 -2
  22. package/dist/src/components/HoverCard/HoverCard.d.ts +55 -3
  23. package/dist/src/components/Label/Label.d.ts +13 -2
  24. package/dist/src/components/Link/Link.d.ts +1 -1
  25. package/dist/src/components/Menu/Menu.d.ts +99 -3
  26. package/dist/src/components/Modal/Modal.d.ts +36 -2
  27. package/dist/src/components/NumberInput/NumberInput.d.ts +14 -2
  28. package/dist/src/components/Pagination/Pagination.d.ts +44 -2
  29. package/dist/src/components/Pagination/Pagination.icons.d.ts +8 -0
  30. package/dist/src/components/Panel/Panel.d.ts +65 -3
  31. package/dist/src/components/Radio/Radio.d.ts +13 -3
  32. package/dist/src/components/Radio/RadioGroup.d.ts +13 -0
  33. package/dist/src/components/ReadOnlyField/ReadOnlyBooleanField.d.ts +5 -0
  34. package/dist/src/components/ReadOnlyField/ReadOnlyField.d.ts +7 -2
  35. package/dist/src/components/ReadOnlyField/ReadOnlySwitchField.d.ts +5 -0
  36. package/dist/src/components/ReadOnlyField/ReadOnlyTextField.d.ts +8 -0
  37. package/dist/src/components/ReadOnlyField/WithReadOnlyWrapper.d.ts +28 -0
  38. package/dist/src/components/ReadOnlyField/index.d.ts +1 -0
  39. package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +31 -3
  40. package/dist/src/components/Slider/Slider.d.ts +28 -2
  41. package/dist/src/components/Stepper/Stepper.d.ts +21 -2
  42. package/dist/src/components/Switch/Switch.d.ts +10 -3
  43. package/dist/src/components/Switch/SwitchGroup.d.ts +13 -0
  44. package/dist/src/components/Tabs/Tabs.d.ts +35 -3
  45. package/dist/src/components/Text/Text.d.ts +1 -1
  46. package/dist/src/components/TextArea/TextArea.d.ts +18 -2
  47. package/dist/src/components/TextField/TextField.d.ts +16 -2
  48. package/dist/src/components/Timeline/Timeline.d.ts +14 -2
  49. package/dist/src/components/Timeline/TimelineItem.d.ts +29 -0
  50. package/dist/src/components/Title/Title.d.ts +1 -1
  51. package/dist/src/components/Toast/Toast.d.ts +25 -2
  52. package/dist/src/components/Tooltip/Tooltip.d.ts +42 -3
  53. package/dist/src/components/Typography/Typography.d.ts +1 -1
  54. package/package.json +9 -2
  55. package/src/components/Accordion/Accordion.module.css +295 -56
  56. package/src/components/Accordion/Accordion.stories.tsx +149 -21
  57. package/src/components/Accordion/Accordion.tsx +264 -5
  58. package/src/components/AssistiveElement/AssistiveElement.module.css +111 -20
  59. package/src/components/AssistiveElement/AssistiveElement.stories.tsx +76 -19
  60. package/src/components/AssistiveElement/AssistiveElement.tsx +85 -5
  61. package/src/components/Autocomplete/Autocomplete.module.css +320 -42
  62. package/src/components/Autocomplete/Autocomplete.stories.tsx +180 -19
  63. package/src/components/Autocomplete/Autocomplete.tsx +199 -6
  64. package/src/components/Avatar/Avatar.module.css +343 -73
  65. package/src/components/Avatar/Avatar.stories.tsx +94 -22
  66. package/src/components/Avatar/Avatar.tsx +110 -6
  67. package/src/components/Badge/Badge.module.css +127 -29
  68. package/src/components/Badge/Badge.stories.tsx +65 -22
  69. package/src/components/Badge/Badge.tsx +70 -6
  70. package/src/components/Breadcrumb/Breadcrumb.module.css +25 -5
  71. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +57 -22
  72. package/src/components/Breadcrumb/Breadcrumb.tsx +62 -6
  73. package/src/components/Button/Button.module.css +3 -3
  74. package/src/components/Card/Card.module.css +118 -38
  75. package/src/components/Card/Card.stories.tsx +117 -19
  76. package/src/components/Card/Card.tsx +179 -5
  77. package/src/components/Checkbox/Checkbox.module.css +232 -39
  78. package/src/components/Checkbox/Checkbox.stories.tsx +81 -19
  79. package/src/components/Checkbox/Checkbox.tsx +146 -5
  80. package/src/components/Checkbox/CheckboxGroup.tsx +117 -0
  81. package/src/components/Checkbox/index.ts +6 -1
  82. package/src/components/Chip/Chip.module.css +228 -43
  83. package/src/components/Chip/Chip.stories.tsx +101 -21
  84. package/src/components/Chip/Chip.tsx +138 -6
  85. package/src/components/Dropdown/Dropdown.module.css +291 -41
  86. package/src/components/Dropdown/Dropdown.stories.tsx +80 -21
  87. package/src/components/Dropdown/Dropdown.tsx +182 -6
  88. package/src/components/FormControlLayout/FormControlLayout.module.css +92 -0
  89. package/src/components/FormControlLayout/FormControlLayout.stories.tsx +74 -19
  90. package/src/components/FormControlLayout/FormControlLayout.tsx +58 -4
  91. package/src/components/FormControlWrapper/FormControlWrapper.module.css +96 -0
  92. package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +122 -19
  93. package/src/components/FormControlWrapper/FormControlWrapper.tsx +145 -6
  94. package/src/components/HoverCard/HoverCard.module.css +90 -22
  95. package/src/components/HoverCard/HoverCard.stories.tsx +158 -21
  96. package/src/components/HoverCard/HoverCard.tsx +150 -5
  97. package/src/components/Label/Label.module.css +136 -35
  98. package/src/components/Label/Label.stories.tsx +98 -17
  99. package/src/components/Label/Label.tsx +88 -5
  100. package/src/components/Menu/Menu.module.css +285 -51
  101. package/src/components/Menu/Menu.stories.tsx +307 -21
  102. package/src/components/Menu/Menu.tsx +318 -5
  103. package/src/components/Modal/Modal.module.css +171 -35
  104. package/src/components/Modal/Modal.stories.tsx +66 -22
  105. package/src/components/Modal/Modal.tsx +216 -4
  106. package/src/components/NumberInput/NumberInput.module.css +276 -42
  107. package/src/components/NumberInput/NumberInput.stories.tsx +83 -20
  108. package/src/components/NumberInput/NumberInput.tsx +148 -6
  109. package/src/components/Pagination/Pagination.icons.tsx +66 -0
  110. package/src/components/Pagination/Pagination.module.css +246 -20
  111. package/src/components/Pagination/Pagination.stories.tsx +42 -21
  112. package/src/components/Pagination/Pagination.tsx +193 -5
  113. package/src/components/Panel/Panel.module.css +206 -38
  114. package/src/components/Panel/Panel.stories.tsx +214 -22
  115. package/src/components/Panel/Panel.tsx +153 -5
  116. package/src/components/Radio/Radio.module.css +220 -37
  117. package/src/components/Radio/Radio.stories.tsx +77 -19
  118. package/src/components/Radio/Radio.tsx +178 -5
  119. package/src/components/Radio/RadioGroup.tsx +111 -0
  120. package/src/components/ReadOnlyField/ReadOnlyBooleanField.tsx +21 -0
  121. package/src/components/ReadOnlyField/ReadOnlyField.module.css +53 -15
  122. package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +175 -16
  123. package/src/components/ReadOnlyField/ReadOnlyField.tsx +109 -5
  124. package/src/components/ReadOnlyField/ReadOnlySwitchField.tsx +21 -0
  125. package/src/components/ReadOnlyField/ReadOnlyTextField.tsx +48 -0
  126. package/src/components/ReadOnlyField/WithReadOnlyWrapper.tsx +93 -0
  127. package/src/components/ReadOnlyField/index.ts +1 -0
  128. package/src/components/SegmentedControl/SegmentedControl.module.css +203 -47
  129. package/src/components/SegmentedControl/SegmentedControl.stories.tsx +102 -20
  130. package/src/components/SegmentedControl/SegmentedControl.tsx +110 -6
  131. package/src/components/Slider/Slider.module.css +542 -86
  132. package/src/components/Slider/Slider.stories.tsx +157 -19
  133. package/src/components/Slider/Slider.tsx +282 -5
  134. package/src/components/Stepper/Stepper.module.css +410 -71
  135. package/src/components/Stepper/Stepper.stories.tsx +132 -19
  136. package/src/components/Stepper/Stepper.tsx +145 -6
  137. package/src/components/Switch/Switch.module.css +238 -39
  138. package/src/components/Switch/Switch.stories.tsx +98 -19
  139. package/src/components/Switch/Switch.tsx +153 -6
  140. package/src/components/Switch/SwitchGroup.tsx +111 -0
  141. package/src/components/Tabs/Tabs.module.css +422 -79
  142. package/src/components/Tabs/Tabs.stories.tsx +138 -19
  143. package/src/components/Tabs/Tabs.tsx +103 -6
  144. package/src/components/TextArea/TextArea.module.css +155 -32
  145. package/src/components/TextArea/TextArea.stories.tsx +80 -21
  146. package/src/components/TextArea/TextArea.tsx +156 -6
  147. package/src/components/TextField/TextField.module.css +261 -42
  148. package/src/components/TextField/TextField.stories.tsx +168 -15
  149. package/src/components/TextField/TextField.tsx +171 -6
  150. package/src/components/Timeline/Timeline.module.css +365 -76
  151. package/src/components/Timeline/Timeline.stories.tsx +114 -21
  152. package/src/components/Timeline/Timeline.tsx +80 -5
  153. package/src/components/Timeline/TimelineItem.tsx +101 -0
  154. package/src/components/Toast/Toast.module.css +166 -28
  155. package/src/components/Toast/Toast.stories.tsx +54 -22
  156. package/src/components/Toast/Toast.tsx +90 -5
  157. package/src/components/Tooltip/Tooltip.module.css +89 -24
  158. package/src/components/Tooltip/Tooltip.stories.tsx +152 -22
  159. package/src/components/Tooltip/Tooltip.tsx +114 -5
@@ -1,8 +1,158 @@
1
- import React from "react";
2
- import "./TextArea.module.css";
1
+ import React, { forwardRef } from "react";
2
+ import {
3
+ TextField as MuiTextarea,
4
+ type TextFieldProps as MuiTextareaProps,
5
+ } from "@mui/material";
6
+ import { type ReadOnlyControlProps } from "@recursica/adapter-common";
7
+ import { TextField } from "@mui/material";
8
+ import {
9
+ filterStylingProps,
10
+ type RecursicaOverStyled,
11
+ } from "../../utils/filterStylingProps";
12
+ import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/FormControlWrapper";
13
+ import { WithReadOnlyWrapper } from "../ReadOnlyField/WithReadOnlyWrapper";
14
+ import styles from "./TextArea.module.css";
3
15
 
4
- export type TextAreaProps = React.HTMLAttributes<HTMLDivElement>;
16
+ export interface RecursicaTextAreaProps
17
+ extends Omit<
18
+ MuiTextareaProps,
19
+ "size" | "variant" | "radius" | "wrapperProps"
20
+ >,
21
+ Pick<
22
+ RecursicaFormControlWrapperProps,
23
+ | "assistiveText"
24
+ | "assistiveWithIcon"
25
+ | "formLayout"
26
+ | "labelSize"
27
+ | "labelAlignment"
28
+ | "labelOptionalText"
29
+ | "labelWithEditIcon"
30
+ | "onLabelEditClick"
31
+ >,
32
+ ReadOnlyControlProps {
33
+ /** Maximum rows for autosize textarea to grow */
34
+ maxRows?: number;
35
+ /** Minimum rows of autosize textarea */
36
+ minRows?: number;
37
+ /** If set, enables textarea height growing with its content */
38
+ autosize?: boolean;
39
+ }
5
40
 
6
- export const TextArea: React.FC<TextAreaProps> = (props) => {
7
- return <div {...props}>TextArea</div>;
8
- };
41
+ export type TextAreaProps = RecursicaOverStyled<RecursicaTextAreaProps>;
42
+
43
+ export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
44
+ function TextArea(props, ref) {
45
+ const {
46
+ overStyled = false,
47
+ formLayout = "stacked",
48
+
49
+ // Label & Wrapper Maps
50
+ labelSize,
51
+ labelAlignment,
52
+ labelOptionalText,
53
+ labelWithEditIcon,
54
+ onLabelEditClick,
55
+
56
+ label,
57
+ assistiveText,
58
+ assistiveWithIcon,
59
+ error,
60
+ required,
61
+ withAsterisk,
62
+ id,
63
+ className,
64
+ style,
65
+ disabled,
66
+ readOnly,
67
+ readOnlyComponent,
68
+ emptyValueComponent,
69
+ value,
70
+ defaultValue,
71
+ ...rest
72
+ } = props;
73
+ const sanitizedProps = filterStylingProps(rest, overStyled);
74
+ const restRecord = sanitizedProps as Record<string, unknown>;
75
+
76
+ // Delete prohibited sizing hooks from bypassing variables natively
77
+ delete restRecord["size"];
78
+ delete restRecord["variant"];
79
+ delete restRecord["radius"];
80
+
81
+ // Securely map core native blocks down ensuring nested CSS modules map precisely
82
+ const mergedClassNames: Partial<Record<string, string>> = {
83
+ wrapper: styles.root, // The nested Input internal relative wrapper bounding box
84
+ input: styles.input,
85
+ };
86
+
87
+ const classNamesProp = restRecord.classNames;
88
+ if (
89
+ classNamesProp &&
90
+ typeof classNamesProp === "object" &&
91
+ !Array.isArray(classNamesProp)
92
+ ) {
93
+ const o = classNamesProp as Partial<Record<string, string>>;
94
+ mergedClassNames.wrapper = o.wrapper
95
+ ? `${styles.root} ${o.wrapper}`
96
+ : styles.root;
97
+ mergedClassNames.input = o.input
98
+ ? `${styles.input} ${o.input}`
99
+ : styles.input;
100
+ }
101
+
102
+ const wrapperClass = className
103
+ ? `${styles.layoutOverride} ${className}`
104
+ : styles.layoutOverride;
105
+
106
+ return (
107
+ <WithReadOnlyWrapper
108
+ className={wrapperClass}
109
+ style={style as React.CSSProperties}
110
+ controlMaxWidth="var(--recursica_ui-kit_components_textarea_properties_max-width)"
111
+ controlMinWidth="var(--recursica_ui-kit_components_textarea_properties_min-width)"
112
+ overStyled={overStyled as true}
113
+ formLayout={formLayout}
114
+ labelSize={labelSize}
115
+ labelAlignment={labelAlignment}
116
+ labelOptionalText={labelOptionalText}
117
+ labelWithEditIcon={labelWithEditIcon}
118
+ onLabelEditClick={onLabelEditClick}
119
+ label={label}
120
+ assistiveText={assistiveText}
121
+ assistiveWithIcon={assistiveWithIcon}
122
+ error={error}
123
+ required={required}
124
+ withAsterisk={withAsterisk}
125
+ id={id}
126
+ readOnly={readOnly}
127
+ readOnlyComponent={readOnlyComponent}
128
+ emptyValueComponent={emptyValueComponent}
129
+ readOnlyType="text"
130
+ readOnlyValue={value !== undefined ? value : defaultValue}
131
+ readOnlyNativeProps={props}
132
+ activeComponent={
133
+ /* Naked Input execution safely decoupled from Mui's macro Input.Wrapper DOM hooks */
134
+ <MuiTextarea
135
+ multiline
136
+ ref={ref}
137
+ classes={mergedClassNames}
138
+ disabled={disabled}
139
+ value={value}
140
+ defaultValue={defaultValue}
141
+ label={undefined}
142
+ description={undefined}
143
+ error={undefined}
144
+ required={undefined}
145
+ withAsterisk={undefined}
146
+ wrapperProps={{
147
+ "data-disabled": disabled ? "true" : undefined,
148
+ "data-error": error ? "true" : undefined,
149
+ }}
150
+ {...(sanitizedProps as unknown as MuiTextareaProps)}
151
+ />
152
+ }
153
+ />
154
+ );
155
+ },
156
+ );
157
+
158
+ TextArea.displayName = "TextArea";
@@ -1,47 +1,266 @@
1
1
  /* EXEMPTIONS:
2
- This component is a placeholder stub. Once fully implemented, its specific
3
- tokens will be fully wired up to direct styles. */
4
-
5
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_border-radius */
6
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_horizontal-padding */
7
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_icon-size */
8
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_icon-text-gap */
9
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_max-width */
10
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_min-height */
11
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_min-width */
12
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_placeholder-opacity */
13
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_text_font-family */
14
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_text_font-size */
15
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_text_font-style */
16
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_text_font-weight */
17
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_text_letter-spacing */
18
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_text_line-height */
19
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_text_text-decoration */
20
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_text_text-transform */
21
- /* recursica-ignore: --recursica_ui-kit_components_text-field_properties_vertical-padding */
22
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_layouts_side-by-side_properties_top-bottom-margin */
23
- /* recursica-ignore: --recursica_ui-kit_components_text-field_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. */
24
4
  /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_default_properties_border-size */
25
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_default_properties_colors_background */
26
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_default_properties_colors_border-color */
27
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_default_properties_colors_leading-icon */
28
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_default_properties_colors_text */
29
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_default_properties_colors_trailing-icon */
30
5
  /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_disabled_properties_border-size */
31
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_disabled_properties_colors_background */
32
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_disabled_properties_colors_border-color */
33
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_disabled_properties_colors_leading-icon */
34
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_disabled_properties_colors_text */
35
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_disabled_properties_colors_trailing-icon */
36
6
  /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_error_properties_border-size */
37
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_error_properties_colors_background */
38
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_error_properties_colors_border-color */
39
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_error_properties_colors_leading-icon */
40
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_error_properties_colors_text */
41
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_error_properties_colors_trailing-icon */
42
7
  /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_focus_properties_border-size */
43
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_focus_properties_colors_background */
44
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_focus_properties_colors_border-color */
45
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_focus_properties_colors_leading-icon */
46
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_focus_properties_colors_text */
47
- /* recursica-ignore: --recursica_ui-kit_components_text-field_variants_states_focus_properties_colors_trailing-icon */
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_text-field_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_text-field_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
+ min-height: var(
35
+ --recursica_ui-kit_components_text-field_properties_min-height
36
+ );
37
+
38
+ /* Strict Typography Unification placed on root for MUI InputBase inheritance */
39
+ font-family: var(
40
+ --recursica_ui-kit_components_text-field_properties_text_font-family
41
+ );
42
+ font-size: var(
43
+ --recursica_ui-kit_components_text-field_properties_text_font-size
44
+ );
45
+ font-style: var(
46
+ --recursica_ui-kit_components_text-field_properties_text_font-style
47
+ );
48
+ font-weight: var(
49
+ --recursica_ui-kit_components_text-field_properties_text_font-weight
50
+ );
51
+ letter-spacing: var(
52
+ --recursica_ui-kit_components_text-field_properties_text_letter-spacing
53
+ );
54
+ line-height: var(
55
+ --recursica_ui-kit_components_text-field_properties_text_line-height
56
+ );
57
+ text-decoration: var(
58
+ --recursica_ui-kit_components_text-field_properties_text_text-decoration
59
+ );
60
+ text-transform: var(
61
+ --recursica_ui-kit_components_text-field_properties_text_text-transform
62
+ );
63
+
64
+ /* Box Geometry placed on root so MUI InputBase boundary executes */
65
+ border-radius: var(
66
+ --recursica_ui-kit_components_text-field_properties_border-radius
67
+ );
68
+ border-width: 1px;
69
+ border-style: solid;
70
+
71
+ /* Base State Default Execution */
72
+ background-color: var(
73
+ --recursica_ui-kit_components_text-field_variants_states_default_properties_colors_background
74
+ );
75
+ border-color: var(
76
+ --recursica_ui-kit_components_text-field_variants_states_default_properties_colors_border-color
77
+ );
78
+ color: var(
79
+ --recursica_ui-kit_components_text-field_variants_states_default_properties_colors_text
80
+ );
81
+
82
+ /* Override MUI/Mantine native Input variables governing section spacing padding mathematics safely */
83
+ --input-left-section-size: calc(
84
+ var(
85
+ --recursica_ui-kit_components_text-field_properties_horizontal-padding
86
+ ) +
87
+ var(--recursica_ui-kit_components_text-field_properties_icon-size) +
88
+ var(--recursica_ui-kit_components_text-field_properties_icon-text-gap)
89
+ );
90
+ --input-right-section-size: calc(
91
+ var(
92
+ --recursica_ui-kit_components_text-field_properties_horizontal-padding
93
+ ) +
94
+ var(--recursica_ui-kit_components_text-field_properties_icon-size) +
95
+ var(--recursica_ui-kit_components_text-field_properties_icon-text-gap)
96
+ );
97
+ }
98
+
99
+ .input {
100
+ /* Structural Overrides */
101
+ width: 100%;
102
+ box-sizing: border-box;
103
+ margin: 0;
104
+
105
+ /* Box Geometry Padding */
106
+ min-height: var(
107
+ --recursica_ui-kit_components_text-field_properties_min-height
108
+ );
109
+ padding-top: var(
110
+ --recursica_ui-kit_components_text-field_properties_vertical-padding
111
+ );
112
+ padding-bottom: var(
113
+ --recursica_ui-kit_components_text-field_properties_vertical-padding
114
+ );
115
+ padding-left: var(
116
+ --recursica_ui-kit_components_text-field_properties_horizontal-padding
117
+ );
118
+ padding-right: var(
119
+ --recursica_ui-kit_components_text-field_properties_horizontal-padding
120
+ );
121
+
122
+ outline: none;
123
+ border: none; /* Because root handles border in MUI */
124
+ background: transparent;
125
+ color: inherit;
126
+ height: auto; /* overrides MUI's 1.1876em */
127
+ }
128
+
129
+ .input::placeholder {
130
+ opacity: var(
131
+ --recursica_ui-kit_components_text-field_properties_placeholder-opacity
132
+ );
133
+ color: inherit;
134
+ }
135
+
136
+ /* Dynamic Padding Overrides */
137
+ .root[data-with-left-section="true"] .input {
138
+ padding-left: var(--input-left-section-size);
139
+ }
140
+
141
+ .root[data-with-right-section="true"] .input {
142
+ padding-right: var(--input-right-section-size);
143
+ }
144
+
145
+ /* Flexible End-Caps (Icons, actions) */
146
+ .section {
147
+ display: flex;
148
+ align-items: center;
149
+ height: 100%;
150
+ position: absolute;
151
+ }
152
+
153
+ .section[data-position="left"] {
154
+ justify-content: flex-start;
155
+ left: 0;
156
+ padding-left: var(
157
+ --recursica_ui-kit_components_text-field_properties_horizontal-padding
158
+ );
159
+ }
160
+
161
+ .section[data-position="right"] {
162
+ justify-content: flex-end;
163
+ right: 0;
164
+ padding-right: var(
165
+ --recursica_ui-kit_components_text-field_properties_horizontal-padding
166
+ );
167
+ }
168
+
169
+ .section :global(svg) {
170
+ width: var(--recursica_ui-kit_components_text-field_properties_icon-size);
171
+ height: var(--recursica_ui-kit_components_text-field_properties_icon-size);
172
+ color: var(
173
+ --recursica_ui-kit_components_text-field_variants_states_default_properties_colors_leading-icon
174
+ );
175
+ }
176
+
177
+ .section[data-position="right"] :global(svg) {
178
+ color: var(
179
+ --recursica_ui-kit_components_text-field_variants_states_default_properties_colors_trailing-icon
180
+ );
181
+ }
182
+
183
+ /* -------------------------------------
184
+ STATE CASCADE ARCHITECTURE
185
+ -------------------------------------- */
186
+
187
+ /* Focus State Mapping (Triggered internally via browser pseudo-pseudo-class) */
188
+ .root:focus-within,
189
+ .root:focus {
190
+ border-color: var(
191
+ --recursica_ui-kit_components_text-field_variants_states_focus_properties_colors_border-color
192
+ );
193
+ background-color: var(
194
+ --recursica_ui-kit_components_text-field_variants_states_focus_properties_colors_background
195
+ );
196
+ color: var(
197
+ --recursica_ui-kit_components_text-field_variants_states_focus_properties_colors_text
198
+ );
199
+ }
200
+
201
+ .root:focus-within .section[data-position="left"] :global(svg) {
202
+ color: var(
203
+ --recursica_ui-kit_components_text-field_variants_states_focus_properties_colors_leading-icon
204
+ );
205
+ }
206
+
207
+ .root:focus-within .section[data-position="right"] :global(svg) {
208
+ color: var(
209
+ --recursica_ui-kit_components_text-field_variants_states_focus_properties_colors_trailing-icon
210
+ );
211
+ }
212
+
213
+ /* Error State Mapping (Propagated strictly down from the wrapper DOM context) */
214
+ .root[data-error="true"] {
215
+ border-color: var(
216
+ --recursica_ui-kit_components_text-field_variants_states_error_properties_colors_border-color
217
+ );
218
+ background-color: var(
219
+ --recursica_ui-kit_components_text-field_variants_states_error_properties_colors_background
220
+ );
221
+ color: var(
222
+ --recursica_ui-kit_components_text-field_variants_states_error_properties_colors_text
223
+ );
224
+ }
225
+
226
+ .root[data-error="true"] .section[data-position="left"] :global(svg) {
227
+ color: var(
228
+ --recursica_ui-kit_components_text-field_variants_states_error_properties_colors_leading-icon
229
+ );
230
+ }
231
+
232
+ .root[data-error="true"] .section[data-position="right"] :global(svg) {
233
+ color: var(
234
+ --recursica_ui-kit_components_text-field_variants_states_error_properties_colors_trailing-icon
235
+ );
236
+ }
237
+
238
+ /* Disabled State Mapping (Propagated strictly down from the wrapper DOM context) */
239
+ .root[data-disabled="true"] {
240
+ border-color: var(
241
+ --recursica_ui-kit_components_text-field_variants_states_disabled_properties_colors_border-color
242
+ );
243
+ background-color: var(
244
+ --recursica_ui-kit_components_text-field_variants_states_disabled_properties_colors_background
245
+ );
246
+ color: var(
247
+ --recursica_ui-kit_components_text-field_variants_states_disabled_properties_colors_text
248
+ );
249
+ cursor: not-allowed;
250
+ }
251
+
252
+ .root[data-disabled="true"] .input {
253
+ cursor: not-allowed;
254
+ }
255
+
256
+ .root[data-disabled="true"] .section[data-position="left"] :global(svg) {
257
+ color: var(
258
+ --recursica_ui-kit_components_text-field_variants_states_disabled_properties_colors_leading-icon
259
+ );
260
+ }
261
+
262
+ .root[data-disabled="true"] .section[data-position="right"] :global(svg) {
263
+ color: var(
264
+ --recursica_ui-kit_components_text-field_variants_states_disabled_properties_colors_trailing-icon
265
+ );
266
+ }
@@ -1,35 +1,188 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import React from "react";
1
3
  import type { Meta, StoryObj } from "@storybook/react";
2
4
  import { TextField } from "./TextField";
3
- import { ComingSoon } from "@recursica/storybook-template";
5
+ import { formControlArgTypes } from "../../../.storybook/commonArgTypes";
4
6
 
5
7
  const meta: Meta<typeof TextField> = {
6
- title: "UI-Kit/🚧 TextField",
8
+ title: "UI-Kit/TextField",
7
9
  component: TextField,
8
10
  tags: ["autodocs"],
9
11
  parameters: {
12
+ docs: {
13
+ description: {
14
+ component: `
15
+ The \`TextField\` primitive functions as a universal text entry input natively integrated directly into the unified \`FormControlWrapper\` architecture.
16
+
17
+ ### Architectural Decoupling
18
+ Recursica forcibly overrides the internal MUI \`InputBase\` 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.
19
+
20
+ ### Examples
21
+ Always structure horizontal architectures via the generic \`formLayout\` parameter.
22
+ \`\`\`tsx
23
+ <TextField
24
+ label="Primary Network Socket"
25
+ assistiveText="Ensure connections resolve seamlessly."
26
+ formLayout="stacked"
27
+ />
28
+ \`\`\`
29
+ `,
30
+ },
31
+ },
10
32
  controls: {
11
33
  include: [
12
- "layer",
13
- "withLayer",
14
- "children",
15
- "component",
16
- "variant",
17
- "size",
18
- "icon",
19
34
  "disabled",
20
- "href",
21
- "onClick",
22
- "onChange",
23
- "value",
24
- "checked",
35
+ "error",
36
+ "required",
37
+ "label",
38
+ "assistiveText",
39
+ "readOnly",
40
+ "formLayout",
41
+ "labelSize",
42
+ "labelAlignment",
43
+ "labelOptionalText",
44
+ "labelWithEditIcon",
25
45
  ],
26
46
  },
27
47
  },
48
+ argTypes: {
49
+ ...formControlArgTypes,
50
+ disabled: {
51
+ control: "boolean",
52
+ description:
53
+ "Maps the formal disabled variable states structurally to the input core.",
54
+ },
55
+ error: {
56
+ control: "text",
57
+ description:
58
+ "Applies the strict error string boundary rendering invalid structures seamlessly.",
59
+ },
60
+ required: {
61
+ control: "boolean",
62
+ },
63
+ label: {
64
+ control: "text",
65
+ },
66
+ assistiveText: {
67
+ control: "text",
68
+ },
69
+ readOnly: {
70
+ control: "boolean",
71
+ description:
72
+ "Toggles structural read-only data presentation explicitly blocking standard component bindings.",
73
+ },
74
+ },
28
75
  };
29
76
 
30
77
  export default meta;
78
+
31
79
  type Story = StoryObj<typeof TextField>;
32
80
 
33
81
  export const Default: Story = {
34
- render: () => <ComingSoon componentName="TextField" />,
82
+ args: {
83
+ disabled: false,
84
+ label: "Authentication Token",
85
+ placeholder: "Enter validation hash...",
86
+ assistiveText:
87
+ "Tokens are stored identically locally and strictly ephemeral.",
88
+ },
89
+ render: ({ ...args }: any) => <TextField {...args} />,
90
+ };
91
+
92
+ export const FormsSideBySide: Story = {
93
+ args: {
94
+ label: "Distributed Access Control",
95
+ placeholder: "admin@node.local",
96
+ assistiveText:
97
+ "Specify the exact cluster administrative credentials enforcing strict domain policies. This violently long string tests native textual wrapping safely mapping alongside inputs.",
98
+ formLayout: "side-by-side",
99
+ },
100
+ render: ({ ...args }: any) => <TextField {...args} />,
101
+ };
102
+
103
+ export const WithLeadingIcon: Story = {
104
+ args: {
105
+ label: "Search Global Context",
106
+ placeholder: "Search for repositories...",
107
+ leftSection: (
108
+ <svg
109
+ width="24"
110
+ height="24"
111
+ viewBox="0 0 24 24"
112
+ fill="none"
113
+ stroke="currentColor"
114
+ strokeWidth="2"
115
+ strokeLinecap="round"
116
+ strokeLinejoin="round"
117
+ >
118
+ <circle cx="11" cy="11" r="8"></circle>
119
+ <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
120
+ </svg>
121
+ ),
122
+ },
123
+ render: ({ ...args }: any) => <TextField {...args} />,
124
+ };
125
+
126
+ export const WithTrailingIcon: Story = {
127
+ args: {
128
+ label: "Validation URL",
129
+ placeholder: "https://recursica.dev",
130
+ rightSection: (
131
+ <svg
132
+ width="24"
133
+ height="24"
134
+ viewBox="0 0 24 24"
135
+ fill="none"
136
+ stroke="currentColor"
137
+ strokeWidth="2"
138
+ strokeLinecap="round"
139
+ strokeLinejoin="round"
140
+ >
141
+ <polyline points="20 6 9 17 4 12"></polyline>
142
+ </svg>
143
+ ),
144
+ },
145
+ render: ({ ...args }: any) => <TextField {...args} />,
146
+ };
147
+
148
+ export const Disabled: Story = {
149
+ args: {
150
+ label: "Disabled Deployment Node",
151
+ placeholder: "Disabled primitive map...",
152
+ disabled: true,
153
+ },
154
+ render: ({ ...args }: any) => <TextField {...args} />,
155
+ };
156
+
157
+ export const ErrorState: Story = {
158
+ args: {
159
+ label: "Cluster Failure",
160
+ placeholder: "Failing component instance...",
161
+ defaultValue: "Invalid Execution Plan",
162
+ error:
163
+ "Critical runtime node disconnect detected traversing DOM architecture.",
164
+ required: true,
165
+ },
166
+ render: ({ ...args }: any) => <TextField {...args} />,
167
+ };
168
+
169
+ export const StaticReadOnly: Story = {
170
+ args: {
171
+ label: "Static ReadOnly Review",
172
+ placeholder: "Ignored...",
173
+ value: "Explicitly Uneditable Bound Output",
174
+ readOnly: true,
175
+ },
176
+ render: ({ ...args }: any) => <TextField {...args} />,
177
+ };
178
+
179
+ export const EditableReadOnly: Story = {
180
+ args: {
181
+ label: "Editable ReadOnly Review",
182
+ placeholder: "Ignored until active...",
183
+ defaultValue: "Waiting for Edit Execution",
184
+ readOnly: true,
185
+ labelWithEditIcon: true,
186
+ },
187
+ render: ({ ...args }: any) => <TextField {...args} />,
35
188
  };