@recursica/mui-adapter 0.4.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 (177) hide show
  1. package/CHANGELOG.md +15 -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 +6651 -201
  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 +17 -0
  10. package/dist/src/components/Autocomplete/index.d.ts +1 -0
  11. package/dist/src/components/Avatar/Avatar.d.ts +14 -2
  12. package/dist/src/components/Badge/Badge.d.ts +13 -3
  13. package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +10 -3
  14. package/dist/src/components/Button/Button.d.ts +1 -1
  15. package/dist/src/components/Card/Card.d.ts +40 -3
  16. package/dist/src/components/Checkbox/Checkbox.d.ts +15 -2
  17. package/dist/src/components/Checkbox/CheckboxGroup.d.ts +16 -0
  18. package/dist/src/components/Checkbox/index.d.ts +5 -1
  19. package/dist/src/components/Chip/Chip.d.ts +18 -2
  20. package/dist/src/components/Dropdown/Dropdown.d.ts +23 -3
  21. package/dist/src/components/FormControlLayout/FormControlLayout.d.ts +10 -2
  22. package/dist/src/components/FormControlWrapper/FormControlWrapper.d.ts +24 -2
  23. package/dist/src/components/HoverCard/HoverCard.d.ts +55 -3
  24. package/dist/src/components/Label/Label.d.ts +13 -2
  25. package/dist/src/components/Link/Link.d.ts +1 -1
  26. package/dist/src/components/Menu/Menu.d.ts +99 -3
  27. package/dist/src/components/Modal/Modal.d.ts +36 -2
  28. package/dist/src/components/NumberInput/NumberInput.d.ts +14 -2
  29. package/dist/src/components/Pagination/Pagination.d.ts +44 -2
  30. package/dist/src/components/Pagination/Pagination.icons.d.ts +8 -0
  31. package/dist/src/components/Panel/Panel.d.ts +65 -3
  32. package/dist/src/components/Radio/Radio.d.ts +13 -3
  33. package/dist/src/components/Radio/RadioGroup.d.ts +13 -0
  34. package/dist/src/components/ReadOnlyField/ReadOnlyBooleanField.d.ts +5 -0
  35. package/dist/src/components/ReadOnlyField/ReadOnlyField.d.ts +7 -2
  36. package/dist/src/components/ReadOnlyField/ReadOnlySwitchField.d.ts +5 -0
  37. package/dist/src/components/ReadOnlyField/ReadOnlyTextField.d.ts +8 -0
  38. package/dist/src/components/ReadOnlyField/WithReadOnlyWrapper.d.ts +28 -0
  39. package/dist/src/components/ReadOnlyField/index.d.ts +1 -0
  40. package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +31 -3
  41. package/dist/src/components/Slider/Slider.d.ts +28 -2
  42. package/dist/src/components/Stepper/Stepper.d.ts +21 -2
  43. package/dist/src/components/Switch/Switch.d.ts +10 -3
  44. package/dist/src/components/Switch/SwitchGroup.d.ts +13 -0
  45. package/dist/src/components/Tabs/Tabs.d.ts +35 -3
  46. package/dist/src/components/Text/Text.d.ts +1 -1
  47. package/dist/src/components/TextArea/TextArea.d.ts +18 -2
  48. package/dist/src/components/TextField/TextField.d.ts +16 -2
  49. package/dist/src/components/Timeline/Timeline.d.ts +14 -2
  50. package/dist/src/components/Timeline/TimelineItem.d.ts +29 -0
  51. package/dist/src/components/Title/Title.d.ts +1 -1
  52. package/dist/src/components/Toast/Toast.d.ts +25 -2
  53. package/dist/src/components/Tooltip/Tooltip.d.ts +42 -3
  54. package/dist/src/components/Typography/Typography.d.ts +1 -1
  55. package/dist/src/components/index.d.ts +1 -0
  56. package/package.json +12 -2
  57. package/src/GlobalExemptions.modules.css +13 -0
  58. package/src/components/Accordion/Accordion.module.css +295 -0
  59. package/src/components/Accordion/Accordion.stories.tsx +149 -21
  60. package/src/components/Accordion/Accordion.tsx +264 -4
  61. package/src/components/AssistiveElement/AssistiveElement.module.css +111 -0
  62. package/src/components/AssistiveElement/AssistiveElement.stories.tsx +76 -19
  63. package/src/components/AssistiveElement/AssistiveElement.tsx +85 -4
  64. package/src/components/Autocomplete/Autocomplete.module.css +325 -0
  65. package/src/components/Autocomplete/Autocomplete.stories.tsx +196 -0
  66. package/src/components/Autocomplete/Autocomplete.tsx +201 -0
  67. package/src/components/Autocomplete/index.ts +1 -0
  68. package/src/components/Avatar/Avatar.module.css +344 -0
  69. package/src/components/Avatar/Avatar.stories.tsx +94 -22
  70. package/src/components/Avatar/Avatar.tsx +110 -5
  71. package/src/components/Badge/Badge.module.css +127 -0
  72. package/src/components/Badge/Badge.stories.tsx +65 -22
  73. package/src/components/Badge/Badge.tsx +70 -5
  74. package/src/components/Breadcrumb/Breadcrumb.module.css +26 -0
  75. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +57 -22
  76. package/src/components/Breadcrumb/Breadcrumb.tsx +62 -5
  77. package/src/components/Button/Button.module.css +113 -20
  78. package/src/components/Button/Button.stories.tsx +3 -0
  79. package/src/components/Button/Button.tsx +10 -3
  80. package/src/components/Card/Card.module.css +118 -0
  81. package/src/components/Card/Card.stories.tsx +117 -19
  82. package/src/components/Card/Card.tsx +179 -4
  83. package/src/components/Checkbox/Checkbox.module.css +232 -0
  84. package/src/components/Checkbox/Checkbox.stories.tsx +81 -19
  85. package/src/components/Checkbox/Checkbox.tsx +146 -4
  86. package/src/components/Checkbox/CheckboxGroup.tsx +117 -0
  87. package/src/components/Checkbox/index.ts +6 -1
  88. package/src/components/Chip/Chip.module.css +236 -0
  89. package/src/components/Chip/Chip.stories.tsx +101 -21
  90. package/src/components/Chip/Chip.tsx +138 -5
  91. package/src/components/DatePicker/DatePicker.module.css +42 -0
  92. package/src/components/DatePicker/DatePicker.tsx +1 -0
  93. package/src/components/Dropdown/Dropdown.module.css +296 -0
  94. package/src/components/Dropdown/Dropdown.stories.tsx +80 -21
  95. package/src/components/Dropdown/Dropdown.tsx +182 -5
  96. package/src/components/FileInput/FileInput.module.css +47 -0
  97. package/src/components/FileInput/FileInput.tsx +1 -0
  98. package/src/components/FileUpload/FileUpload.module.css +40 -0
  99. package/src/components/FileUpload/FileUpload.tsx +1 -0
  100. package/src/components/FormControlLayout/FormControlLayout.module.css +92 -0
  101. package/src/components/FormControlLayout/FormControlLayout.stories.tsx +74 -19
  102. package/src/components/FormControlLayout/FormControlLayout.tsx +58 -4
  103. package/src/components/FormControlWrapper/FormControlWrapper.module.css +96 -0
  104. package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +122 -19
  105. package/src/components/FormControlWrapper/FormControlWrapper.tsx +145 -6
  106. package/src/components/HoverCard/HoverCard.module.css +91 -0
  107. package/src/components/HoverCard/HoverCard.stories.tsx +158 -21
  108. package/src/components/HoverCard/HoverCard.tsx +150 -4
  109. package/src/components/Label/Label.module.css +136 -0
  110. package/src/components/Label/Label.stories.tsx +98 -17
  111. package/src/components/Label/Label.tsx +88 -4
  112. package/src/components/Link/Link.module.css +8 -0
  113. package/src/components/Menu/Menu.module.css +287 -0
  114. package/src/components/Menu/Menu.stories.tsx +307 -21
  115. package/src/components/Menu/Menu.tsx +318 -4
  116. package/src/components/Modal/Modal.module.css +172 -0
  117. package/src/components/Modal/Modal.stories.tsx +66 -22
  118. package/src/components/Modal/Modal.tsx +216 -3
  119. package/src/components/NumberInput/NumberInput.module.css +281 -0
  120. package/src/components/NumberInput/NumberInput.stories.tsx +83 -20
  121. package/src/components/NumberInput/NumberInput.tsx +148 -5
  122. package/src/components/Pagination/Pagination.icons.tsx +66 -0
  123. package/src/components/Pagination/Pagination.module.css +307 -0
  124. package/src/components/Pagination/Pagination.stories.tsx +42 -21
  125. package/src/components/Pagination/Pagination.tsx +193 -4
  126. package/src/components/Panel/Panel.module.css +206 -0
  127. package/src/components/Panel/Panel.stories.tsx +214 -22
  128. package/src/components/Panel/Panel.tsx +153 -4
  129. package/src/components/Radio/Radio.module.css +220 -0
  130. package/src/components/Radio/Radio.stories.tsx +77 -19
  131. package/src/components/Radio/Radio.tsx +178 -4
  132. package/src/components/Radio/RadioGroup.tsx +111 -0
  133. package/src/components/ReadOnlyField/ReadOnlyBooleanField.tsx +21 -0
  134. package/src/components/ReadOnlyField/ReadOnlyField.module.css +54 -0
  135. package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +175 -16
  136. package/src/components/ReadOnlyField/ReadOnlyField.tsx +109 -4
  137. package/src/components/ReadOnlyField/ReadOnlySwitchField.tsx +21 -0
  138. package/src/components/ReadOnlyField/ReadOnlyTextField.tsx +48 -0
  139. package/src/components/ReadOnlyField/WithReadOnlyWrapper.tsx +93 -0
  140. package/src/components/ReadOnlyField/index.ts +1 -0
  141. package/src/components/SegmentedControl/SegmentedControl.module.css +203 -0
  142. package/src/components/SegmentedControl/SegmentedControl.stories.tsx +102 -20
  143. package/src/components/SegmentedControl/SegmentedControl.tsx +110 -5
  144. package/src/components/Slider/Slider.module.css +542 -0
  145. package/src/components/Slider/Slider.stories.tsx +157 -19
  146. package/src/components/Slider/Slider.tsx +282 -4
  147. package/src/components/Stepper/Stepper.module.css +410 -0
  148. package/src/components/Stepper/Stepper.stories.tsx +132 -19
  149. package/src/components/Stepper/Stepper.tsx +145 -5
  150. package/src/components/Switch/Switch.module.css +238 -0
  151. package/src/components/Switch/Switch.stories.tsx +98 -19
  152. package/src/components/Switch/Switch.tsx +153 -5
  153. package/src/components/Switch/SwitchGroup.tsx +111 -0
  154. package/src/components/Tabs/Tabs.module.css +422 -0
  155. package/src/components/Tabs/Tabs.stories.tsx +138 -19
  156. package/src/components/Tabs/Tabs.tsx +103 -5
  157. package/src/components/TextArea/TextArea.module.css +160 -0
  158. package/src/components/TextArea/TextArea.stories.tsx +80 -21
  159. package/src/components/TextArea/TextArea.tsx +156 -5
  160. package/src/components/TextField/TextField.module.css +266 -0
  161. package/src/components/TextField/TextField.stories.tsx +168 -15
  162. package/src/components/TextField/TextField.tsx +171 -5
  163. package/src/components/TimePicker/TimePicker.module.css +41 -0
  164. package/src/components/TimePicker/TimePicker.tsx +1 -0
  165. package/src/components/Timeline/Timeline.module.css +367 -0
  166. package/src/components/Timeline/Timeline.stories.tsx +114 -21
  167. package/src/components/Timeline/Timeline.tsx +80 -4
  168. package/src/components/Timeline/TimelineItem.tsx +101 -0
  169. package/src/components/Toast/Toast.module.css +170 -0
  170. package/src/components/Toast/Toast.stories.tsx +54 -22
  171. package/src/components/Toast/Toast.tsx +90 -4
  172. package/src/components/Tooltip/Tooltip.module.css +90 -0
  173. package/src/components/Tooltip/Tooltip.stories.tsx +152 -22
  174. package/src/components/Tooltip/Tooltip.tsx +114 -4
  175. package/src/components/TransferList/TransferList.module.css +38 -0
  176. package/src/components/TransferList/TransferList.tsx +1 -0
  177. package/src/components/index.ts +1 -0
@@ -0,0 +1,281 @@
1
+ /* EXEMPTIONS:
2
+ - state-specific border-size variables are ignored because the input box uses a uniform static boundary to prevent
3
+ unexpected layout shifts or flickering when switching between active, focused, or error states. */
4
+ /* recursica-ignore: --recursica_ui-kit_components_number-input_variants_states_default_properties_border-size */
5
+ /* recursica-ignore: --recursica_ui-kit_components_number-input_variants_states_disabled_properties_border-size */
6
+ /* recursica-ignore: --recursica_ui-kit_components_number-input_variants_states_error_properties_border-size */
7
+ /* recursica-ignore: --recursica_ui-kit_components_number-input_variants_states_focus_properties_border-size */
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_number-input_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_number-input_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
+ - Controls: Hardcoded to bypass Mantine's default borders and backgrounds on the increment/decrement arrows.
29
+ */
30
+
31
+ .root {
32
+ display: flex;
33
+ position: relative;
34
+ width: 100%;
35
+ min-height: var(
36
+ --recursica_ui-kit_components_number-input_properties_min-height
37
+ );
38
+
39
+ /* Override Mantine native Input variables governing section spacing padding mathematics safely */
40
+ --input-left-section-size: calc(
41
+ var(
42
+ --recursica_ui-kit_components_number-input_properties_horizontal-padding
43
+ ) +
44
+ var(--recursica_ui-kit_components_number-input_properties_icon-size) +
45
+ var(--recursica_ui-kit_components_number-input_properties_icon-text-gap)
46
+ );
47
+ --input-right-section-size: calc(
48
+ var(
49
+ --recursica_ui-kit_components_number-input_properties_horizontal-padding
50
+ ) +
51
+ var(--recursica_ui-kit_components_number-input_properties_icon-size) +
52
+ var(--recursica_ui-kit_components_number-input_properties_icon-text-gap)
53
+ );
54
+ }
55
+
56
+ .input {
57
+ /* Structural Overrides */
58
+ width: 100%;
59
+ box-sizing: border-box;
60
+ margin: 0;
61
+
62
+ /* Box Geometry */
63
+ min-height: var(
64
+ --recursica_ui-kit_components_number-input_properties_min-height
65
+ );
66
+ padding-top: var(
67
+ --recursica_ui-kit_components_number-input_properties_vertical-padding
68
+ );
69
+ padding-bottom: var(
70
+ --recursica_ui-kit_components_number-input_properties_vertical-padding
71
+ );
72
+ padding-left: var(
73
+ --recursica_ui-kit_components_number-input_properties_horizontal-padding
74
+ );
75
+ padding-right: var(
76
+ --recursica_ui-kit_components_number-input_properties_horizontal-padding
77
+ );
78
+ border-radius: var(
79
+ --recursica_ui-kit_components_number-input_properties_border-radius
80
+ );
81
+ border-width: 1px;
82
+ border-style: solid;
83
+
84
+ /* Strict Typography Unification */
85
+ font-family: var(
86
+ --recursica_ui-kit_components_number-input_properties_text_font-family
87
+ );
88
+ font-size: var(
89
+ --recursica_ui-kit_components_number-input_properties_text_font-size
90
+ );
91
+ font-style: var(
92
+ --recursica_ui-kit_components_number-input_properties_text_font-style
93
+ );
94
+ font-weight: var(
95
+ --recursica_ui-kit_components_number-input_properties_text_font-weight
96
+ );
97
+ letter-spacing: var(
98
+ --recursica_ui-kit_components_number-input_properties_text_letter-spacing
99
+ );
100
+ line-height: var(
101
+ --recursica_ui-kit_components_number-input_properties_text_line-height
102
+ );
103
+ text-decoration: var(
104
+ --recursica_ui-kit_components_number-input_properties_text_text-decoration
105
+ );
106
+ text-transform: var(
107
+ --recursica_ui-kit_components_number-input_properties_text_text-transform
108
+ );
109
+
110
+ /* Base State Default Execution */
111
+ background-color: var(
112
+ --recursica_ui-kit_components_number-input_variants_states_default_properties_colors_background
113
+ );
114
+ border-color: var(
115
+ --recursica_ui-kit_components_number-input_variants_states_default_properties_colors_border-color
116
+ );
117
+ color: var(
118
+ --recursica_ui-kit_components_number-input_variants_states_default_properties_colors_text
119
+ );
120
+
121
+ outline: none;
122
+ }
123
+
124
+ .input::placeholder {
125
+ opacity: var(
126
+ --recursica_ui-kit_components_number-input_properties_placeholder-opacity
127
+ );
128
+ color: inherit;
129
+ }
130
+
131
+ /* Dynamic Padding Overrides */
132
+ .root[data-with-left-section] .input {
133
+ padding-left: var(--input-left-section-size);
134
+ }
135
+
136
+ .root[data-with-right-section] .input {
137
+ padding-right: var(--input-right-section-size);
138
+ }
139
+
140
+ /* Flexible End-Caps (Icons, actions) */
141
+ .section {
142
+ display: flex;
143
+ align-items: center;
144
+ height: 100%;
145
+ }
146
+
147
+ .section[data-position="left"] {
148
+ justify-content: flex-start;
149
+ padding-left: var(
150
+ --recursica_ui-kit_components_number-input_properties_horizontal-padding
151
+ );
152
+ }
153
+
154
+ .section[data-position="right"] {
155
+ justify-content: flex-end;
156
+ padding-right: var(
157
+ --recursica_ui-kit_components_number-input_properties_horizontal-padding
158
+ );
159
+ }
160
+
161
+ .section :global(svg) {
162
+ width: var(--recursica_ui-kit_components_number-input_properties_icon-size);
163
+ height: var(--recursica_ui-kit_components_number-input_properties_icon-size);
164
+ color: var(
165
+ --recursica_ui-kit_components_number-input_variants_states_default_properties_colors_leading-icon
166
+ );
167
+ }
168
+
169
+ .section[data-position="right"] :global(svg) {
170
+ color: var(
171
+ --recursica_ui-kit_components_number-input_variants_states_default_properties_colors_trailing-icon
172
+ );
173
+ }
174
+
175
+ /* -------------------------------------
176
+ CONTROLS (Mantine Specific Up/Down Arrows)
177
+ -------------------------------------- */
178
+
179
+ .controls {
180
+ /* Adjust right padding so controls do not overlap borders */
181
+ padding-right: var(
182
+ --recursica_ui-kit_components_number-input_properties_horizontal-padding
183
+ );
184
+ }
185
+
186
+ .control {
187
+ /* Override Mantine borders for the inner controls */
188
+ border: none;
189
+ background: transparent;
190
+ color: var(
191
+ --recursica_ui-kit_components_number-input_variants_states_default_properties_colors_trailing-icon
192
+ );
193
+ }
194
+
195
+ .control:hover {
196
+ background: transparent;
197
+ }
198
+
199
+ /* -------------------------------------
200
+ STATE CASCADE ARCHITECTURE
201
+ -------------------------------------- */
202
+
203
+ /* Focus State Mapping (Triggered internally via browser pseudo-pseudo-class) */
204
+ .input:focus-within,
205
+ .input:focus {
206
+ border-color: var(
207
+ --recursica_ui-kit_components_number-input_variants_states_focus_properties_colors_border-color
208
+ );
209
+ background-color: var(
210
+ --recursica_ui-kit_components_number-input_variants_states_focus_properties_colors_background
211
+ );
212
+ color: var(
213
+ --recursica_ui-kit_components_number-input_variants_states_focus_properties_colors_text
214
+ );
215
+ }
216
+
217
+ .root:focus-within .section[data-position="left"] :global(svg) {
218
+ color: var(
219
+ --recursica_ui-kit_components_number-input_variants_states_focus_properties_colors_leading-icon
220
+ );
221
+ }
222
+
223
+ .root:focus-within .section[data-position="right"] :global(svg),
224
+ .root:focus-within .control {
225
+ color: var(
226
+ --recursica_ui-kit_components_number-input_variants_states_focus_properties_colors_trailing-icon
227
+ );
228
+ }
229
+
230
+ /* Error State Mapping (Propagated strictly down from the wrapper DOM context) */
231
+ .root[data-error] .input {
232
+ border-color: var(
233
+ --recursica_ui-kit_components_number-input_variants_states_error_properties_colors_border-color
234
+ ) !important;
235
+ background-color: var(
236
+ --recursica_ui-kit_components_number-input_variants_states_error_properties_colors_background
237
+ ) !important;
238
+ color: var(
239
+ --recursica_ui-kit_components_number-input_variants_states_error_properties_colors_text
240
+ ) !important;
241
+ }
242
+
243
+ .root[data-error] .section[data-position="left"] :global(svg) {
244
+ color: var(
245
+ --recursica_ui-kit_components_number-input_variants_states_error_properties_colors_leading-icon
246
+ ) !important;
247
+ }
248
+
249
+ .root[data-error] .section[data-position="right"] :global(svg),
250
+ .root[data-error] .control {
251
+ color: var(
252
+ --recursica_ui-kit_components_number-input_variants_states_error_properties_colors_trailing-icon
253
+ ) !important;
254
+ }
255
+
256
+ /* Disabled State Mapping (Propagated strictly down from the wrapper DOM context) */
257
+ .root[data-disabled] .input {
258
+ border-color: var(
259
+ --recursica_ui-kit_components_number-input_variants_states_disabled_properties_colors_border-color
260
+ ) !important;
261
+ background-color: var(
262
+ --recursica_ui-kit_components_number-input_variants_states_disabled_properties_colors_background
263
+ ) !important;
264
+ color: var(
265
+ --recursica_ui-kit_components_number-input_variants_states_disabled_properties_colors_text
266
+ ) !important;
267
+ cursor: not-allowed;
268
+ }
269
+
270
+ .root[data-disabled] .section[data-position="left"] :global(svg) {
271
+ color: var(
272
+ --recursica_ui-kit_components_number-input_variants_states_disabled_properties_colors_leading-icon
273
+ ) !important;
274
+ }
275
+
276
+ .root[data-disabled] .section[data-position="right"] :global(svg),
277
+ .root[data-disabled] .control {
278
+ color: var(
279
+ --recursica_ui-kit_components_number-input_variants_states_disabled_properties_colors_trailing-icon
280
+ ) !important;
281
+ }
@@ -1,35 +1,98 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
2
  import { NumberInput } from "./NumberInput";
3
- import { ComingSoon } from "@recursica/storybook-template";
4
3
 
5
4
  const meta: Meta<typeof NumberInput> = {
6
- title: "UI-Kit/🚧 NumberInput",
5
+ title: "UI-Kit/NumberInput",
7
6
  component: NumberInput,
8
7
  tags: ["autodocs"],
9
- parameters: {
10
- controls: {
11
- include: [
12
- "layer",
13
- "withLayer",
14
- "children",
15
- "component",
16
- "variant",
17
- "size",
18
- "icon",
19
- "disabled",
20
- "href",
21
- "onClick",
22
- "onChange",
23
- "value",
24
- "checked",
25
- ],
8
+ argTypes: {
9
+ label: { control: "text" },
10
+ assistiveText: { control: "text" },
11
+ disabled: { control: "boolean" },
12
+ error: { control: "boolean" },
13
+ readOnly: { control: "boolean" },
14
+ required: { control: "boolean" },
15
+ hideControls: { control: "boolean" },
16
+ formLayout: {
17
+ control: "select",
18
+ options: ["stacked", "side-by-side"],
26
19
  },
20
+ labelSize: {
21
+ control: "select",
22
+ options: ["small", "default", "large"],
23
+ },
24
+ checked: { table: { disable: true } },
25
+ defaultChecked: { table: { disable: true } },
26
+ assistiveWithIcon: { table: { disable: true } },
27
+ labelOptionalText: { table: { disable: true } },
28
+ labelWithEditIcon: { table: { disable: true } },
29
+ onLabelEditClick: { table: { disable: true } },
30
+ emptyValueComponent: { table: { disable: true } },
27
31
  },
28
32
  };
29
33
 
30
34
  export default meta;
35
+
31
36
  type Story = StoryObj<typeof NumberInput>;
32
37
 
33
38
  export const Default: Story = {
34
- render: () => <ComingSoon componentName="NumberInput" />,
39
+ args: {
40
+ label: "Amount",
41
+ placeholder: "Enter an amount",
42
+ assistiveText: "Must be greater than 0",
43
+ defaultValue: 10,
44
+ min: 0,
45
+ max: 100,
46
+ },
47
+ };
48
+
49
+ export const SideBySideLayout: Story = {
50
+ args: {
51
+ ...Default.args,
52
+ formLayout: "side-by-side",
53
+ },
54
+ };
55
+
56
+ export const States: Story = {
57
+ render: () => (
58
+ <div
59
+ style={{
60
+ display: "flex",
61
+ flexDirection: "column",
62
+ gap: "1rem",
63
+ maxWidth: 400,
64
+ }}
65
+ >
66
+ <NumberInput label="Default" placeholder="Enter a number" />
67
+ <NumberInput label="Disabled" placeholder="Disabled input" disabled />
68
+ <NumberInput label="Error" placeholder="Error state" error />
69
+ <NumberInput label="Read Only" value={42} readOnly />
70
+ <NumberInput label="Required" required />
71
+ </div>
72
+ ),
73
+ };
74
+
75
+ export const WithLeftIcon: Story = {
76
+ args: {
77
+ label: "Price",
78
+ placeholder: "0.00",
79
+ leftSection: <span>$</span>,
80
+ },
81
+ };
82
+
83
+ export const WithRightIcon: Story = {
84
+ args: {
85
+ label: "Percentage",
86
+ placeholder: "0",
87
+ rightSection: <span>%</span>,
88
+ hideControls: true, // Typically hiding controls if rightSection is occupied
89
+ },
90
+ };
91
+
92
+ export const HiddenControls: Story = {
93
+ args: {
94
+ label: "Zip Code",
95
+ placeholder: "Enter zip code",
96
+ hideControls: true,
97
+ },
35
98
  };
@@ -1,7 +1,150 @@
1
- import React from "react";
1
+ import React, { forwardRef } from "react";
2
+ import {
3
+ TextField as MuiNumberInput,
4
+ type TextFieldProps as MuiNumberInputProps,
5
+ } from "@mui/material";
6
+ import { type ReadOnlyControlProps } from "@recursica/adapter-common";
7
+ import {
8
+ filterStylingProps,
9
+ type RecursicaOverStyled,
10
+ } from "../../utils/filterStylingProps";
11
+ import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/FormControlWrapper";
12
+ import { WithReadOnlyWrapper } from "../ReadOnlyField/WithReadOnlyWrapper";
13
+ import styles from "./NumberInput.module.css";
2
14
 
3
- export type NumberInputProps = React.HTMLAttributes<HTMLDivElement>;
15
+ export interface RecursicaNumberInputProps
16
+ extends Omit<
17
+ MuiNumberInputProps,
18
+ "size" | "variant" | "radius" | "wrapperProps" | "classNames" | "styles"
19
+ >,
20
+ Pick<
21
+ RecursicaFormControlWrapperProps,
22
+ | "assistiveText"
23
+ | "assistiveWithIcon"
24
+ | "formLayout"
25
+ | "labelSize"
26
+ | "labelAlignment"
27
+ | "labelOptionalText"
28
+ | "labelWithEditIcon"
29
+ | "onLabelEditClick"
30
+ >,
31
+ ReadOnlyControlProps {
32
+ /** Enables/disables the controls to increment and decrement the value */
33
+ hideControls?: boolean;
34
+ }
4
35
 
5
- export const NumberInput: React.FC<NumberInputProps> = (props) => {
6
- return <div {...props}>NumberInput</div>;
7
- };
36
+ export type NumberInputProps = RecursicaOverStyled<RecursicaNumberInputProps>;
37
+
38
+ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
39
+ function NumberInput(props, ref) {
40
+ const {
41
+ overStyled = false,
42
+ formLayout = "stacked",
43
+
44
+ // Label & Wrapper Maps
45
+ labelSize,
46
+ labelAlignment,
47
+ labelOptionalText,
48
+ labelWithEditIcon,
49
+ onLabelEditClick,
50
+
51
+ label,
52
+ assistiveText,
53
+ assistiveWithIcon,
54
+ error,
55
+ required,
56
+ withAsterisk,
57
+ id,
58
+ className,
59
+ style,
60
+ disabled,
61
+ readOnly,
62
+ readOnlyComponent,
63
+ emptyValueComponent,
64
+ value,
65
+ defaultValue,
66
+ hideControls = false,
67
+ ...rest
68
+ } = props;
69
+
70
+ const sanitizedProps = filterStylingProps(rest, overStyled);
71
+ const restRecord = sanitizedProps as Record<string, unknown>;
72
+
73
+ // Delete prohibited sizing hooks from bypassing variables natively
74
+ delete restRecord["size"];
75
+ delete restRecord["variant"];
76
+ delete restRecord["radius"];
77
+
78
+ // Securely map core native blocks down ensuring nested CSS modules map precisely
79
+ const mergedClassNames: Partial<Record<string, string>> = {
80
+ wrapper: styles.root, // The nested Input internal relative wrapper bounding box
81
+ input: styles.input,
82
+ section: styles.section,
83
+ controls: styles.controls,
84
+ control: styles.control,
85
+ };
86
+
87
+ const wrapperClass = className
88
+ ? `${styles.layoutOverride} ${className}`
89
+ : styles.layoutOverride;
90
+
91
+ return (
92
+ <WithReadOnlyWrapper
93
+ className={wrapperClass}
94
+ style={style as React.CSSProperties}
95
+ controlMaxWidth="var(--recursica_ui-kit_components_number-input_properties_max-width)"
96
+ controlMinWidth="var(--recursica_ui-kit_components_number-input_properties_min-width)"
97
+ overStyled={overStyled as true}
98
+ formLayout={formLayout}
99
+ labelSize={labelSize}
100
+ labelAlignment={labelAlignment}
101
+ labelOptionalText={labelOptionalText}
102
+ labelWithEditIcon={labelWithEditIcon}
103
+ onLabelEditClick={onLabelEditClick}
104
+ label={label}
105
+ assistiveText={assistiveText}
106
+ assistiveWithIcon={assistiveWithIcon}
107
+ error={error}
108
+ required={required}
109
+ withAsterisk={withAsterisk}
110
+ id={id}
111
+ readOnly={readOnly}
112
+ readOnlyComponent={readOnlyComponent}
113
+ emptyValueComponent={emptyValueComponent}
114
+ readOnlyType="text"
115
+ readOnlyValue={
116
+ value !== undefined ? value?.toString() : defaultValue?.toString()
117
+ }
118
+ readOnlyNativeProps={props}
119
+ activeComponent={
120
+ /* Naked Input execution safely decoupled from Mui's macro Input.Wrapper DOM hooks */
121
+ <MuiNumberInput
122
+ ref={ref}
123
+ classes={mergedClassNames}
124
+ disabled={disabled}
125
+ value={value}
126
+ defaultValue={defaultValue}
127
+ hideControls={hideControls}
128
+ label={undefined}
129
+ description={undefined}
130
+ error={undefined}
131
+ required={undefined}
132
+ withAsterisk={undefined}
133
+ wrapperProps={{
134
+ "data-disabled": disabled ? "true" : undefined,
135
+ "data-error": error ? "true" : undefined,
136
+ "data-with-left-section": restRecord.leftSection
137
+ ? "true"
138
+ : undefined,
139
+ "data-with-right-section":
140
+ restRecord.rightSection || !hideControls ? "true" : undefined,
141
+ }}
142
+ {...(sanitizedProps as unknown as MuiNumberInputProps)}
143
+ />
144
+ }
145
+ />
146
+ );
147
+ },
148
+ );
149
+
150
+ NumberInput.displayName = "NumberInput";
@@ -0,0 +1,66 @@
1
+ import styles from "./Pagination.module.css";
2
+
3
+ const NextPath =
4
+ "M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z";
5
+ const PrevPath =
6
+ "M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z";
7
+ const FirstPath =
8
+ "M6.85355 3.85355C7.04882 3.65829 7.04882 3.34171 6.85355 3.14645C6.65829 2.95118 6.34171 2.95118 6.14645 3.14645L2.14645 7.14645C1.95118 7.34171 1.95118 7.65829 2.14645 7.85355L6.14645 11.8536C6.34171 12.0488 6.65829 12.0488 6.85355 11.8536C7.04882 11.6583 7.04882 11.3417 6.85355 11.1464L3.20711 7.5L6.85355 3.85355ZM12.8536 3.85355C13.0488 3.65829 13.0488 3.34171 12.8536 3.14645C12.6583 2.95118 12.3417 2.95118 12.1464 3.14645L8.14645 7.14645C7.95118 7.34171 7.95118 7.65829 8.14645 7.85355L12.1464 11.8536C12.3417 12.0488 12.6583 12.0488 12.8536 11.8536C13.0488 11.6583 13.0488 11.3417 12.8536 11.1464L9.20711 7.5L12.8536 3.85355Z";
9
+ const LastPath =
10
+ "M2.14645 11.1464C1.95118 11.3417 1.95118 11.6583 2.14645 11.8536C2.34171 12.0488 2.65829 12.0488 2.85355 11.8536L6.85355 7.85355C7.04882 7.65829 7.04882 7.34171 6.85355 7.14645L2.85355 3.14645C2.65829 2.95118 2.34171 2.95118 2.14645 3.14645C1.95118 3.34171 1.95118 3.65829 2.14645 3.85355L5.79289 7.5L2.14645 11.1464ZM8.14645 11.1464C7.95118 11.3417 7.95118 11.6583 8.14645 11.8536C8.34171 12.0488 8.65829 12.0488 8.85355 11.8536L12.8536 7.85355C13.0488 7.65829 13.0488 7.34171 12.8536 7.14645L8.85355 3.14645C8.65829 2.95118 8.34171 2.95118 8.14645 3.14645C7.95118 3.34171 7.95118 3.65829 8.14645 3.85355L11.7929 7.5L8.14645 11.1464Z";
11
+
12
+ export type PaginationIconType = "next" | "prev" | "first" | "last";
13
+
14
+ const paths: Record<PaginationIconType, string> = {
15
+ next: NextPath,
16
+ prev: PrevPath,
17
+ first: FirstPath,
18
+ last: LastPath,
19
+ };
20
+
21
+ export const PaginationIcon = ({
22
+ type,
23
+ className,
24
+ ...props
25
+ }: React.ComponentProps<"svg"> & { type: PaginationIconType }) => (
26
+ <svg
27
+ viewBox="0 0 16 16"
28
+ xmlns="http://www.w3.org/2000/svg"
29
+ className={`${styles.baseIcon} ${className || ""}`.trim()}
30
+ {...props}
31
+ >
32
+ <path d={paths[type as PaginationIconType]} fill="currentColor" />
33
+ </svg>
34
+ );
35
+
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
+ export const NextWithLabel = (props: any) => (
38
+ <div className={styles.iconWithLabel}>
39
+ <span>Next</span>
40
+ <PaginationIcon type="next" {...props} />
41
+ </div>
42
+ );
43
+
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+ export const PrevWithLabel = (props: any) => (
46
+ <div className={styles.iconWithLabel}>
47
+ <PaginationIcon type="prev" {...props} />
48
+ <span>Prev</span>
49
+ </div>
50
+ );
51
+
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
+ export const FirstWithLabel = (props: any) => (
54
+ <div className={styles.iconWithLabel}>
55
+ <PaginationIcon type="first" {...props} />
56
+ <span>First</span>
57
+ </div>
58
+ );
59
+
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
+ export const LastWithLabel = (props: any) => (
62
+ <div className={styles.iconWithLabel}>
63
+ <span>Last</span>
64
+ <PaginationIcon type="last" {...props} />
65
+ </div>
66
+ );