@recursica/mui-adapter 0.37.0 → 0.39.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 (42) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/index.d.ts +17 -21
  3. package/dist/mui-adapter.cjs +50 -50
  4. package/dist/mui-adapter.cjs.map +1 -1
  5. package/dist/mui-adapter.css +1 -1
  6. package/dist/mui-adapter.js +3188 -3167
  7. package/dist/mui-adapter.js.map +1 -1
  8. package/package.json +5 -3
  9. package/src/Introduction.stories.tsx +2 -1
  10. package/src/OverStyling.tsx +1 -2
  11. package/src/Version.tsx +2 -2
  12. package/src/components/Accordion/Accordion.stories.tsx +36 -0
  13. package/src/components/{Autocomplete/Autocomplete.stories.tsx → AutoComplete/AutoComplete.stories.tsx} +2 -2
  14. package/src/components/{Autocomplete/Autocomplete.tsx → AutoComplete/AutoComplete.tsx} +5 -5
  15. package/src/components/AutoComplete/index.ts +1 -0
  16. package/src/components/FormControlLayout/FormControlLayout.stories.tsx +36 -0
  17. package/src/components/Label/Label.stories.tsx +63 -54
  18. package/src/components/Loader/Loader.animate.dom.test.tsx +72 -0
  19. package/src/components/Loader/Loader.module.css +10 -0
  20. package/src/components/Loader/Loader.stories.tsx +20 -0
  21. package/src/components/Loader/Loader.tsx +8 -1
  22. package/src/components/Table/TABLE_IMPLEMENTATION_NOTES.md +11 -0
  23. package/src/components/Table/Table.module.css +14 -0
  24. package/src/components/Table/Table.stories.tsx +1 -1
  25. package/src/components/Table/USAGE.md +2 -2
  26. package/src/components/TimePicker/TIMEPICKER_IMPLEMENTATION_NOTES.md +8 -1
  27. package/src/components/TimePicker/TimePicker.module.css +43 -0
  28. package/src/components/TimePicker/TimePicker.stories.tsx +22 -0
  29. package/src/components/TimePicker/TimePicker.tsx +24 -6
  30. package/src/components/index.ts +1 -2
  31. package/src/index.ts +3 -4
  32. package/src/components/Autocomplete/index.ts +0 -1
  33. package/src/components/Box/Box.stories.tsx +0 -68
  34. package/src/components/Box/Box.test.tsx +0 -1
  35. package/src/components/Box/Box.tsx +0 -24
  36. package/src/components/Box/IMPLEMENTATION_NOTES.md +0 -5
  37. package/src/components/Box/USAGE.md +0 -48
  38. package/src/components/Box/index.ts +0 -1
  39. /package/src/components/{Autocomplete/Autocomplete.module.css → AutoComplete/AutoComplete.module.css} +0 -0
  40. /package/src/components/{Autocomplete/Autocomplete.test.tsx → AutoComplete/AutoComplete.test.tsx} +0 -0
  41. /package/src/components/{Autocomplete/AUTOCOMPLETE_IMPLEMENTATION_NOTES.md → AutoComplete/IMPLEMENTATION_NOTES.md} +0 -0
  42. /package/src/components/{Autocomplete → AutoComplete}/USAGE.md +0 -0
@@ -32,7 +32,8 @@ Lowercase `hh` renders 12-hour digits (1–12) with no `a` (meridiem) token, so
32
32
  ## Design tokens
33
33
 
34
34
  - No dedicated `min-height` token exists for `time-picker` (unlike `text-field`/`date-picker`) — the field's height is derived from its own padding + line-height instead of a fixed token.
35
- - `icon-size`/`icon-color`/`icon-text-gap`/`placeholder-opacity` are exempted (`recursica-ignore`) — the time field has no icon slot and MUI X's field renders empty sections via its own internal placeholder styling, not a native `::placeholder` pseudo-element.
35
+ - `icon-size`/`icon-color`/`icon-text-gap` (plus the disabled/error `icon-color` variants) are wired via `leftSection` — see "Leading icon" below.
36
+ - `placeholder-opacity` remains exempted (`recursica-ignore`) — MUI X's field renders its empty-state "hh"/"mm" placeholder via its own internal `isFieldValueEmpty` styled-component variant (an inline opacity applied through emotion), not a native `::placeholder` pseudo-element this CSS module can target. Unlike mantine-adapter's `SpinInput` (a real `<input placeholder="--">`), there's no stable selector here to hook a token to without depending on MUI X's internal class names.
36
37
  - The AM/PM `BareDropdown` draws its own border/background/padding from `Dropdown`'s own tokens via `Dropdown.module.css` — it does not reuse any `time-picker` tokens.
37
38
 
38
39
  ## Known limitation — the popup clock/list view is unstyled
@@ -43,6 +44,12 @@ This pass covers the closed-state field and the AM/PM `BareDropdown` only. The o
43
44
 
44
45
  `readOnlyType="text"`, matching `DatePicker`'s convention.
45
46
 
47
+ ## Leading icon (Matt Massey, 2026-08-30)
48
+
49
+ Added `leftSection` (`RecursicaTimePickerProps`), matching `TextField`'s naming/convention: purely decorative, consumer-supplied, no default (unlike `DatePicker`'s fixed `CalendarIcon` — there's no single icon that fits every `TimePicker` use).
50
+
51
+ MUI X's `TimePicker` has no `leftSection` concept — wired via `slotProps.textField.slotProps.input.startAdornment` (the `textField`/`input` slots are exposed at the top level of `TimePicker`'s own `slotProps`, sibling to `field`, via `PickerFieldUISlotPropsFromContext` — confirmed by reading `useDesktopPicker.types.d.ts`/`PickerFieldUI.d.ts` directly, not just the top-level `TimePickerProps` surface). `startAdornment` renders as a plain sibling of `.MuiPickersInputBase-sectionsContainer` inside `PickersInputBase` (confirmed via `PickersInputBase.js`), so it's wrapped in the same `<div className={styles.section} data-position="left">` shape `TextField.tsx` already uses, rather than depending on MUI's own adornment styling. Also added `data-with-left-section` on `.root` so `.MuiPickersInputBase-sectionsContainer`'s own hardcoded `padding-left` (previously always the field's full `horizontal-padding`, structured for the no-icon case) collapses to just `icon-text-gap` once the icon itself is doing the border-inset job instead.
52
+
46
53
  ## Visual review fix (Matt Massey, 2026-08-07)
47
54
 
48
55
  **`BareDropdown`'s border color didn't match Mantine's version, despite both reading the same `Dropdown` tokens**: a real bug in `BareDropdown.tsx` — `className={styles.root}` was set explicitly on `<MuiSelect>`, then `{...sanitizedProps}` was spread _after_ it. Any caller passing its own `className` (like `TimePicker.tsx`'s `styles.amPmSelect`) silently overwrote `styles.root` entirely via that later spread, so `Dropdown.module.css`'s border-color/background/`width: 100%` never actually applied — MUI's own default border rendered instead. Fixed by extracting `className` explicitly and merging it (`` `${styles.root} ${className}` ``) before it reaches `<MuiSelect>`, the same pattern mantine-adapter's `BareDropdown` already used. This also explains why the AM/PM box's width had looked accidentally "correct" before: the competing `width: 100%` rule from `.root` was never actually being applied either.
@@ -128,6 +128,37 @@
128
128
  color: inherit;
129
129
  }
130
130
 
131
+ /* Leading icon (leftSection), rendered via slotProps.textField.slotProps.input.startAdornment —
132
+ a sibling of .MuiPickersInputBase-sectionsContainer inside .field, same shape as TextField's own
133
+ startAdornment wrapping. Only one icon-color token exists for time-picker (unlike text-field's
134
+ separate leading/trailing) — this field has no right-side icon slot. */
135
+ .section {
136
+ display: flex;
137
+ align-items: center;
138
+ padding-left: var(
139
+ --recursica_ui-kit_components_time-picker_properties_horizontal-padding
140
+ );
141
+ }
142
+
143
+ .section :global(svg) {
144
+ width: var(--recursica_ui-kit_components_time-picker_properties_icon-size);
145
+ height: var(--recursica_ui-kit_components_time-picker_properties_icon-size);
146
+ color: var(
147
+ --recursica_ui-kit_components_time-picker_properties_colors_icon-color
148
+ );
149
+ }
150
+
151
+ /* With a leftSection present, the icon (not .field's own border) now owns the inset from the left
152
+ edge — sectionsContainer's own padding-left collapses to just the icon-text-gap between icon and
153
+ digits. */
154
+ .root[data-with-left-section="true"]
155
+ .field
156
+ :global(.MuiPickersInputBase-sectionsContainer) {
157
+ padding-left: var(
158
+ --recursica_ui-kit_components_time-picker_properties_icon-text-gap
159
+ ) !important;
160
+ }
161
+
131
162
  /* The AM/PM BareDropdown reuses Dropdown.module.css's own border/background/padding entirely —
132
163
  this only controls its size/alignment within the flex row. */
133
164
  .amPmSelect {
@@ -191,6 +222,12 @@
191
222
  ) !important;
192
223
  }
193
224
 
225
+ .root[data-error="true"] .section :global(svg) {
226
+ color: var(
227
+ --recursica_ui-kit_components_time-picker_variants_states_error_properties_colors_icon-color
228
+ ) !important;
229
+ }
230
+
194
231
  /* Disabled State Mapping */
195
232
  .field:has(:global(.Mui-disabled)) {
196
233
  border-color: var(
@@ -207,3 +244,9 @@
207
244
  ) !important;
208
245
  cursor: not-allowed;
209
246
  }
247
+
248
+ .field:has(:global(.Mui-disabled)) .section :global(svg) {
249
+ color: var(
250
+ --recursica_ui-kit_components_time-picker_variants_states_disabled_properties_colors_icon-color
251
+ ) !important;
252
+ }
@@ -115,6 +115,28 @@ export const ErrorState: Story = {
115
115
  },
116
116
  };
117
117
 
118
+ export const WithLeadingIcon: Story = {
119
+ args: {
120
+ label: "Meeting Time",
121
+ assistiveText: "Choose the start time in your local timezone.",
122
+ leftSection: (
123
+ <svg
124
+ width="24"
125
+ height="24"
126
+ viewBox="0 0 24 24"
127
+ fill="none"
128
+ stroke="currentColor"
129
+ strokeWidth="2"
130
+ strokeLinecap="round"
131
+ strokeLinejoin="round"
132
+ >
133
+ <circle cx="12" cy="12" r="10"></circle>
134
+ <polyline points="12 6 12 12 16 14"></polyline>
135
+ </svg>
136
+ ),
137
+ },
138
+ };
139
+
118
140
  export const StaticReadOnly: Story = {
119
141
  args: {
120
142
  label: "Static ReadOnly Review",
@@ -124,6 +124,7 @@ export const TimePicker = forwardRef<HTMLDivElement, TimePickerProps>(
124
124
  withSeconds,
125
125
  minTime,
126
126
  maxTime,
127
+ leftSection,
127
128
  ...rest
128
129
  } = props;
129
130
 
@@ -148,6 +149,12 @@ export const TimePicker = forwardRef<HTMLDivElement, TimePickerProps>(
148
149
  ? `${styles.layoutOverride} ${className}`
149
150
  : styles.layoutOverride;
150
151
 
152
+ const startAdornment = leftSection ? (
153
+ <div className={styles.section} data-position="left">
154
+ {leftSection}
155
+ </div>
156
+ ) : undefined;
157
+
151
158
  const emitChange = (next: Dayjs | null) => {
152
159
  setInternalValue(next);
153
160
  onChange?.(
@@ -206,7 +213,11 @@ export const TimePicker = forwardRef<HTMLDivElement, TimePickerProps>(
206
213
  format="hh:mm" is always on (12-hour digits, no native meridiem section) — this is the
207
214
  only way this component operates, not a user choice. The AM/PM BareDropdown next to it
208
215
  is the only AM/PM control; see TIMEPICKER_IMPLEMENTATION_NOTES.md. */
209
- <div className={styles.root} data-error={error ? "true" : undefined}>
216
+ <div
217
+ className={styles.root}
218
+ data-error={error ? "true" : undefined}
219
+ data-with-left-section={leftSection ? "true" : undefined}
220
+ >
210
221
  <LocalizationProvider dateAdapter={AdapterDayjs}>
211
222
  <MuiTimePicker
212
223
  {...(sanitizedProps as unknown as Partial<MuiTimePickerProps>)}
@@ -221,16 +232,23 @@ export const TimePicker = forwardRef<HTMLDivElement, TimePickerProps>(
221
232
  }
222
233
  minTime={toDayjs(minTime)}
223
234
  maxTime={toDayjs(maxTime)}
224
- // No icon/open-picker button: time-picker's own token schema has no icon slot (see
225
- // EXEMPTIONS above), and the popup clock/list view this button opens isn't styled
226
- // to Recursica tokens anyway (see TIMEPICKER_IMPLEMENTATION_NOTES.md) — showing an
227
- // affordance to open an unstyled popup would be worse than not showing one. Typing
228
- // directly into the field's masked hour/minute segments is the only interaction.
235
+ // No open-picker button: the popup clock/list view it opens isn't styled to
236
+ // Recursica tokens (see TIMEPICKER_IMPLEMENTATION_NOTES.md) — showing an affordance
237
+ // to open an unstyled popup would be worse than not showing one. Typing directly
238
+ // into the field's masked hour/minute segments is the only interaction. leftSection
239
+ // (below) is purely decorative, unrelated to this button.
229
240
  slots={{ openPickerButton: () => null }}
230
241
  slotProps={{
231
242
  field: {
232
243
  className: styles.field,
233
244
  },
245
+ textField: {
246
+ slotProps: {
247
+ input: {
248
+ startAdornment,
249
+ },
250
+ },
251
+ },
234
252
  }}
235
253
  />
236
254
  </LocalizationProvider>
@@ -1,9 +1,8 @@
1
1
  export * from "./Accordion";
2
2
  export * from "./AssistiveElement";
3
- export * from "./Autocomplete";
3
+ export * from "./AutoComplete";
4
4
  export * from "./Avatar";
5
5
  export * from "./Badge";
6
- export * from "./Box";
7
6
  export * from "./Breadcrumb";
8
7
  export * from "./Button";
9
8
  export * from "./Card";
package/src/index.ts CHANGED
@@ -5,7 +5,6 @@ import { wrapComponent } from "@recursica/adapter-common";
5
5
  export * from "@recursica/adapter-common";
6
6
 
7
7
  // Expose unwrapped structural layout primitives to preserve their polymorphic types
8
- export const Box = rawComponents.Box;
9
8
  export const Flex = rawComponents.Flex;
10
9
  export const Grid = rawComponents.Grid;
11
10
  export const GridCol = rawComponents.GridCol;
@@ -30,9 +29,9 @@ export const AccordionPanel = wrapComponent(
30
29
  export const AssistiveElement = wrapComponent(
31
30
  rawComponents.AssistiveElement,
32
31
  ) as typeof rawComponents.AssistiveElement;
33
- export const Autocomplete = wrapComponent(
34
- rawComponents.Autocomplete,
35
- ) as typeof rawComponents.Autocomplete;
32
+ export const AutoComplete = wrapComponent(
33
+ rawComponents.AutoComplete,
34
+ ) as typeof rawComponents.AutoComplete;
36
35
  export const Avatar = wrapComponent(
37
36
  rawComponents.Avatar,
38
37
  ) as typeof rawComponents.Avatar;
@@ -1 +0,0 @@
1
- export * from "./Autocomplete";
@@ -1,68 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { Box } from "./Box";
3
-
4
- const meta: Meta<typeof Box> = {
5
- title: "UI-Kit/Box",
6
- component: Box,
7
- tags: ["autodocs"],
8
- parameters: {
9
- docs: {
10
- description: {
11
- component:
12
- "The `Box` component is the foundational layout primitive. It accepts all standard MUI layout properties (like `m`, `mt`, `p`, `px`, etc.), but natively intercepts **Recursica Spacing Tokens** (e.g., `rec-none`, `rec-sm`, `rec-default`, `rec-md`, `rec-lg`, `rec-xl`, `rec-2xl`). This allows developers to use Recursica's strict design tokens seamlessly alongside standard MUI spacing.",
13
- },
14
- },
15
- controls: {
16
- include: [
17
- "layer",
18
- "withLayer",
19
- "children",
20
- "component",
21
- "variant",
22
- "size",
23
- "icon",
24
- "disabled",
25
- "href",
26
- "onClick",
27
- "onChange",
28
- "value",
29
- "checked",
30
- ],
31
- },
32
- },
33
- };
34
-
35
- export default meta;
36
- type Story = StoryObj<typeof Box>;
37
-
38
- export const Default: Story = {
39
- args: {
40
- children: "This is a standard Box",
41
- m: "20px",
42
- },
43
- render: (args) => (
44
- <Box {...args} style={{ border: "1px solid gray", padding: "10px" }} />
45
- ),
46
- };
47
-
48
- export const WithRecursicaTokens: Story = {
49
- args: {
50
- children: "This Box uses Recursica layout tokens",
51
- m: "rec-xl",
52
- p: "rec-md",
53
- },
54
- render: (args) => (
55
- <div style={{ border: "1px dashed #ccc", display: "inline-block" }}>
56
- <Box {...args} style={{ backgroundColor: "rgba(0,0,0,0.1)" }} />
57
- </div>
58
- ),
59
- };
60
-
61
- export const Polymorphic: Story = {
62
- args: {
63
- component: "section",
64
- children: "This Box is rendered as a <section> element",
65
- m: "rec-default",
66
- p: "rec-lg",
67
- },
68
- };
@@ -1 +0,0 @@
1
- // Placeholder for future Box component tests. Add tests here if/when needed.
@@ -1,24 +0,0 @@
1
- /**
2
- * Box layout wrapper.
3
- *
4
- * NOTE: Box is the lowest-level primitive layout component. It explicitly ALLOWS
5
- * the `sx` prop as an escape hatch. It does not use the strict RecursicaOverStyled gatekeeper
6
- * or any style stripping utilities.
7
- */
8
- import React, { forwardRef } from "react";
9
- import { Box as MUIBox, type BoxProps as MUIBoxProps } from "@mui/material";
10
-
11
- export type BoxProps<C extends React.ElementType = "div"> = MUIBoxProps<
12
- C,
13
- { component?: C }
14
- >;
15
-
16
- export const Box = forwardRef(function Box<C extends React.ElementType = "div">(
17
- props: BoxProps<C>,
18
- ref: React.Ref<Element>,
19
- ) {
20
- return <MUIBox ref={ref} {...props} />;
21
- }) as <C extends React.ElementType = "div">(
22
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
- props: BoxProps<C> & { ref?: React.ForwardedRef<any> },
24
- ) => React.ReactElement | null;
@@ -1,5 +0,0 @@
1
- # Box Implementation Notes
2
-
3
- ## `sx` Prop Exemption
4
-
5
- By design, the `Box` component is the most permissive primitive in the UI kit. It explicitly allows the `sx` prop to pass through to the underlying MUI `Box`. It does not use any strict styling gatekeepers (`RecursicaOverStyled`, `filterSxProp`). It is intended to be used as a final escape hatch when the standard layout primitives or design system tokens cannot fulfill a unique layout requirement.
@@ -1,48 +0,0 @@
1
- # Box - Usage Guide
2
-
3
- This document describes how to integrate and use the `Box` component in your projects using `@recursica/mui-adapter`.
4
-
5
- ---
6
-
7
- ## 1. Import Reference
8
-
9
- ```tsx
10
- import { Box } from "@recursica/mui-adapter";
11
- ```
12
-
13
- ---
14
-
15
- ## 2. Basic Example
16
-
17
- ```tsx
18
- import React from "react";
19
- import { Box } from "@recursica/mui-adapter";
20
-
21
- export default function Demo() {
22
- return (
23
- <Box>
24
- <Text>This is a basic layout container.</Text>
25
- </Box>
26
- );
27
- }
28
- ```
29
-
30
- ---
31
-
32
- ## 3. Design System Integration
33
-
34
- All Recursica components in the `@recursica/mui-adapter` package adhere strictly to design system spacing, scaling, and behavior patterns.
35
-
36
- > [!IMPORTANT]
37
- >
38
- > - **Anti-override protection**: Rogues style injections (like inline `style` or arbitrary `className`) are automatically blocked by our prop layer unless `overStyled={true}` is explicitly provided.
39
- > - **No Direct Layers**: Do not pass a `layer` prop to this component. To place it on a specific visual layer, wrap it in a `<Layer layer={0|1|2|3}>` component natively.
40
- > - **Variables and Theming**: Styling is entirely determined by local CSS variables defined in `recursica_variables_scoped.css` and mapped in the component's CSS module.
41
-
42
- ---
43
-
44
- ## 4. Key Integration Features & Constraints
45
-
46
- ## `sx` Prop Exemption
47
-
48
- By design, the `Box` component is the most permissive primitive in the UI kit: it always allows the `sx` prop to pass through, without requiring `overStyled`. It is intended to be used as a final escape hatch when the standard layout primitives or design system tokens cannot fulfill a unique layout requirement.
@@ -1 +0,0 @@
1
- export * from "./Box";