@recursica/mui-adapter 0.25.0 → 0.26.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/CHANGELOG.md +10 -0
- package/dist/index.d.ts +23 -19
- package/dist/mui-adapter.cjs +85 -85
- package/dist/mui-adapter.cjs.map +1 -1
- package/dist/mui-adapter.css +1 -1
- package/dist/mui-adapter.js +30129 -25630
- package/dist/mui-adapter.js.map +1 -1
- package/package.json +1 -1
- package/src/GlobalExemptions.modules.css +0 -6
- package/src/components/Accordion/Accordion.module.css +0 -8
- package/src/components/Autocomplete/Autocomplete.module.css +0 -8
- package/src/components/Avatar/Avatar.module.css +0 -8
- package/src/components/Button/Button.module.css +0 -13
- package/src/components/Chip/Chip.module.css +0 -27
- package/src/components/DatePicker/DATEPICKER_IMPLEMENTATION_NOTES.md +29 -0
- package/src/components/DatePicker/DatePicker.icons.tsx +35 -0
- package/src/components/DatePicker/DatePicker.module.css +451 -42
- package/src/components/DatePicker/DatePicker.stories.tsx +23 -25
- package/src/components/DatePicker/DatePicker.tsx +229 -47
- package/src/components/DatePicker/USAGE.md +14 -1
- package/src/components/Dropdown/Dropdown.module.css +0 -7
- package/src/components/FileInput/FileInput.module.css +0 -21
- package/src/components/FileUpload/FileUpload.module.css +0 -11
- package/src/components/HoverCard/HoverCard.module.css +1 -7
- package/src/components/Label/Label.module.css +0 -6
- package/src/components/Link/Link.module.css +0 -13
- package/src/components/Menu/Menu.module.css +0 -5
- package/src/components/Modal/Modal.module.css +0 -11
- package/src/components/NumberInput/NumberInput.module.css +0 -7
- package/src/components/Pagination/Pagination.module.css +0 -81
- package/src/components/Popover/Popover.module.css +0 -5
- package/src/components/SegmentedControl/SegmentedControl.module.css +0 -8
- package/src/components/TextArea/TextArea.module.css +0 -7
- package/src/components/TextField/TextField.module.css +0 -8
- package/src/components/TimePicker/TimePicker.module.css +0 -16
- package/src/components/Timeline/Timeline.module.css +0 -6
- package/src/components/Toast/Toast.module.css +0 -7
- package/src/components/Tooltip/Tooltip.module.css +0 -9
- package/src/components/TransferList/TransferList.module.css +0 -8
package/package.json
CHANGED
|
@@ -5,9 +5,3 @@
|
|
|
5
5
|
* recursica_variables_scoped.css but are not used by any specific component.
|
|
6
6
|
* Isolating them here keeps individual component stylesheets clean and focused.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
/* ==== GLOBAL ICON STYLE ====
|
|
10
|
-
Global layout option specifying the overall SVG rendering style (solid/outline).
|
|
11
|
-
Note to Forge Devs: style is not a CSS property or variable type and cannot be applied in standard CSS stylesheets.
|
|
12
|
-
This variable is ignored in the UI adapters and should be reviewed by the Forge team. */
|
|
13
|
-
/* recursica-ignore: --recursica_ui-kit_globals_icon_style */
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/* EXEMPTIONS:
|
|
2
|
-
- accordion-header open-appearance background-color/border-color are ignored because Forge does
|
|
3
|
-
not apply a visual swap on expand, even though the token schema defines "open" appearance
|
|
4
|
-
colors distinct from "closed" (see .control below, which intentionally keeps a constant
|
|
5
|
-
background/border across collapsed/expanded). Mirrors the mantine-adapter reference. */
|
|
6
|
-
/* recursica-ignore: --recursica_ui-kit_components_accordion-header_variants_appearance_open_properties_colors_background-color */
|
|
7
|
-
/* recursica-ignore: --recursica_ui-kit_components_accordion-header_variants_appearance_open_properties_colors_border-color */
|
|
8
|
-
|
|
9
1
|
/* ==== ACCORDION CONTAINER ==== */
|
|
10
2
|
.root {
|
|
11
3
|
box-sizing: border-box;
|
|
@@ -1,11 +1,3 @@
|
|
|
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_autocomplete_variants_states_default_properties_border-size */
|
|
5
|
-
/* recursica-ignore: --recursica_ui-kit_components_autocomplete_variants_states_disabled_properties_border-size */
|
|
6
|
-
/* recursica-ignore: --recursica_ui-kit_components_autocomplete_variants_states_error_properties_border-size */
|
|
7
|
-
/* recursica-ignore: --recursica_ui-kit_components_autocomplete_variants_states_focus_properties_border-size */
|
|
8
|
-
|
|
9
1
|
/* LAYOUT SPACING OVERRIDES:
|
|
10
2
|
- Sets the --form-control-margin-bottom spacing hook to map component-specific layout tokens.
|
|
11
3
|
- Also sets the --autocomplete-control-{max,min}-width hooks consumed inline in Autocomplete.tsx,
|
|
@@ -7,14 +7,6 @@ HARDCODED VALUES:
|
|
|
7
7
|
- Image has no explicit size tokens other than root size, assume it scales 100%
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
/* EXEMPTIONS:
|
|
11
|
-
The generic size variables below are defined in Figma but unused.
|
|
12
|
-
We explicitly style the avatar's dimensions using the dedicated width and height tokens
|
|
13
|
-
(e.g., small_properties_width and small_properties_height) for precise component layout. */
|
|
14
|
-
/* recursica-ignore: --recursica_ui-kit_components_avatar_variants_sizes_default_properties_size */
|
|
15
|
-
/* recursica-ignore: --recursica_ui-kit_components_avatar_variants_sizes_large_properties_size */
|
|
16
|
-
/* recursica-ignore: --recursica_ui-kit_components_avatar_variants_sizes_small_properties_size */
|
|
17
|
-
|
|
18
10
|
.root {
|
|
19
11
|
box-sizing: border-box;
|
|
20
12
|
margin: 0;
|
|
@@ -378,16 +378,3 @@
|
|
|
378
378
|
var(--recursica_brand_states_focus_margin)
|
|
379
379
|
var(--recursica_brand_states_focus_color);
|
|
380
380
|
}
|
|
381
|
-
|
|
382
|
-
/* EXEMPTIONS:
|
|
383
|
-
These general button properties are redundant because visual mapping has been refactored
|
|
384
|
-
to content-specific variables (_content_label_sizes_... etc.) or are handled by design defaults. */
|
|
385
|
-
/* recursica-ignore: --recursica_ui-kit_components_button_variants_sizes_default_properties_horizontal-padding */
|
|
386
|
-
/* recursica-ignore: --recursica_ui-kit_components_button_variants_sizes_default_properties_min-width */
|
|
387
|
-
/* recursica-ignore: --recursica_ui-kit_components_button_variants_sizes_small_properties_horizontal-padding */
|
|
388
|
-
/* recursica-ignore: --recursica_ui-kit_components_button_variants_sizes_small_properties_hover-opacity */
|
|
389
|
-
/* recursica-ignore: --recursica_ui-kit_components_button_variants_sizes_small_properties_min-width */
|
|
390
|
-
/* recursica-ignore: --recursica_ui-kit_components_button_variants_sizes_small_properties_text_font-style */
|
|
391
|
-
/* recursica-ignore: --recursica_ui-kit_components_button_variants_sizes_small_properties_text_letter-spacing */
|
|
392
|
-
/* recursica-ignore: --recursica_ui-kit_components_button_variants_sizes_small_properties_text_text-decoration */
|
|
393
|
-
/* recursica-ignore: --recursica_ui-kit_components_button_variants_sizes_small_properties_text_text-transform */
|
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
/* EXEMPTIONS:
|
|
2
|
-
- close-icon-color, leading-icon-color, and select-specific state icon variables are ignored because
|
|
3
|
-
Chip uses explicit state color definitions (e.g. unselected, selected, error, error-selected variant colors)
|
|
4
|
-
to drive pixel-perfect hover and click transitions, rather than generic single-color overrides.
|
|
5
|
-
- text-size is ignored since actual chip sizing is dynamically driven by precise vertical padding and line-heights. */
|
|
6
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_close-icon-color */
|
|
7
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_leading-icon-color */
|
|
8
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_text-size */
|
|
9
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error_properties_colors_leading-icon-color */
|
|
10
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error_properties_colors_selected-icon-color */
|
|
11
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_icon */
|
|
12
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_leading-icon-color */
|
|
13
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_selected_properties_colors_leading-icon-color */
|
|
14
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_unselected_properties_colors_selected-icon-color */
|
|
15
|
-
|
|
16
|
-
/* Additional exemptions matching the reference mantine-adapter's Chip.module.css: per selection/error
|
|
17
|
-
state, Figma defines multiple icon-color slots (leading-icon-color, selected-icon-color, and for
|
|
18
|
-
error states also a generic icon-color), but each state only ever consumes ONE of them (leading
|
|
19
|
-
when unselected, selected when selected). The remaining "off" slots per state are intentionally
|
|
20
|
-
unused, same as in the mantine reference. */
|
|
21
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_selection-states_selected_properties_colors_leading-icon-color */
|
|
22
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_selection-states_selected_variants_states_error_properties_colors_icon-color */
|
|
23
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_selection-states_selected_variants_states_error_properties_colors_leading-icon-color */
|
|
24
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_selection-states_unselected_properties_colors_selected-icon-color */
|
|
25
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_selection-states_unselected_variants_states_error_properties_colors_icon-color */
|
|
26
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_selection-states_unselected_variants_states_error_properties_colors_selected-icon-color */
|
|
27
|
-
|
|
28
1
|
/* HARDCODED VALUES
|
|
29
2
|
border-style: solid; (Baseline reset)
|
|
30
3
|
box-sizing: border-box; (Baseline reset)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# DatePicker Implementation Notes
|
|
2
|
+
|
|
3
|
+
## Architecture Overview
|
|
4
|
+
|
|
5
|
+
The `DatePicker` component is a wrapper around MUI X's `@mui/x-date-pickers` `DatePicker`, implementing the `FormControlWrapper` macro structure for Recursica. This ensures that the component visually and structurally aligns with standard Recursica input primitives, and mirrors the mantine-adapter's own `DatePicker` behavior and token mapping wherever the two libraries' APIs allow it.
|
|
6
|
+
|
|
7
|
+
## Structural Constraints
|
|
8
|
+
|
|
9
|
+
1. **Naked Field Usage**: We intentionally pass `label={undefined}`/`description`/`error` through `WithReadOnlyWrapper` rather than MUI X's own field label/helper-text props, so only our `WithReadOnlyWrapper` > `FormControlWrapper` orchestrates labels, description text, and ARIA state error boundaries — same convention as TimePicker.tsx.
|
|
10
|
+
2. **Value Type**: MUI X's `DatePicker` only speaks `Dayjs` (via `AdapterDayjs`); the public API converts to/from plain `Date` internally so `value`/`defaultValue`/`onChange` match the mantine-adapter's convention exactly.
|
|
11
|
+
3. **Read-Only Rendering**: The selected date is displayed formatted as `MM/DD/YY` (via `dayjs(...).format(...)`), not a raw `String(value)` cast (unlike the mantine-adapter, which has no reason to reach for `dayjs` outside read-only formatting). Pass `readOnlyComponent` to override.
|
|
12
|
+
4. **Typing vs. Popover Entry**: Unlike the mantine-adapter (`DatePickerInput`, popover-only), MUI X's field natively supports typing directly into masked date segments in addition to the popup calendar — no adapter code needed to enable this, it's the library default.
|
|
13
|
+
5. **Calendar Popover (Figma Token Issue)**: Same root cause as the mantine-adapter — the UI Kit's `date-picker` component exports no calendar-specific tokens (surface, selected day, hover, today, in-range) — so the calendar reuses the closest existing tokens, mapped 1:1 to the mantine-adapter's choices:
|
|
14
|
+
- **Surface** (`.dropdown`, applied to `slotProps.desktopPaper`) & **selected day** (`.MuiPickerDay-root.Mui-selected`): `--recursica_ui-kit_components_hover-card-popover` tokens for elevation/padding/surface, `--recursica_ui-kit_components_button_variants_styles_solid` tokens for the selected day fill.
|
|
15
|
+
- **Header content, weekday row** (`.MuiPickersCalendarHeader-root`, `.MuiDayCalendar-weekDayLabel`): the hover-card-popover content-color token.
|
|
16
|
+
- **Header nav controls** (`.MuiPickersArrowSwitcher-button`, `.MuiPickersCalendarHeader-switchViewButton`) **& month/year label** (`.MuiPickersCalendarHeader-label`): styled with `--recursica_ui-kit_components_button_variants_styles_text` tokens (border/background/color/elevation) plus small-size `Button` sizing tokens — the same tokens the mantine-adapter's `.calendarHeaderControl`/`.calendarHeaderLevel` use. Note the DOM shape differs from mantine: MUI splits the month/year control into a plain, non-interactive `.label` text node (`role="none"` on its `labelContainer` parent) plus a separate small `.switchViewButton` that's the actual clickable control — only the label's _color/typography_ is recolored to match (no border/background chrome on a non-interactive element), while the switchViewButton gets the full button treatment.
|
|
17
|
+
- **Hover** (day cells, header nav, header level button): the generic `--recursica_brand_states_hover_color`/`_hover_opacity` pair via the same `::after`-overlay technique the mantine-adapter and `Button`/`Menu` use — a plain `background-color`+`opacity` change on the element itself would dim its icon/text along with the fill, not just tint the surface.
|
|
18
|
+
- **Disabled / outside-month days** (`.Mui-disabled`, `.MuiPickerDay-dayOutsideMonth`): the generic `--recursica_brand_states_disabled` opacity token, same convention used repo-wide. Disabled header nav/label controls use `Button`'s own text-variant disabled opacity/elevation tokens instead.
|
|
19
|
+
- **Today marker** (`.MuiPickerDay-today`): reuses the hover-card-popover border-size/color tokens already used for the dropdown surface's own border — same reasoning as mantine-adapter (no dedicated "today" token exists). MUI ships its own default light-primary-color background tint on this class, which is explicitly reset to `transparent` since the design system has no equivalent.
|
|
20
|
+
- **Range selection / weekend styling**: not mapped. MUI X's default `DatePicker` doesn't render range selection or weekend-specific styling at all (unlike Mantine, which colors weekends red by default and needed an explicit override), so neither state needed a Recursica mapping.
|
|
21
|
+
|
|
22
|
+
## Styling Quirks
|
|
23
|
+
|
|
24
|
+
- **Native field decoration suppression**: MUI X's field variant can't be forced to a bare/unstyled mode from this component's public API (same constraint TimePicker.module.css documents) — whichever native outline/underline decoration it renders by default is suppressed via `:global(...)` overrides, and `.field` draws the Recursica border/background/color instead.
|
|
25
|
+
- **Popover `slotProps` gotcha, same shape as mantine-adapter's `popoverProps` bug**: the calendar popup is portaled to `document.body`, entirely outside this component's own DOM subtree, so it can only be reached by handing MUI X's `slotProps.desktopPaper` a `className` directly — a descendant CSS selector from `.root` would never match it. `DatePicker.tsx` merges any consumer-supplied `slotProps.field`/`slotProps.desktopPaper` (and their `className`s) with our own defaults instead of overwriting them.
|
|
26
|
+
- **`.dropdown`'s `!important`s**: unlike the mantine-adapter's equivalent rule (plain CSS-module specificity, no `!important` needed — `@mantine/dates`' own stylesheet reliably loads first), MUI X injects its own `Paper`/`Popper` styles at runtime via emotion, with no guaranteed load-order relative to this CSS module. `!important` here just re-asserts token values against a same-specificity emotion rule that could otherwise win on source order alone.
|
|
27
|
+
- **Default display/entry format**: `format="MM/DD/YY"` (a `dayjs` format string, MUI X's own default is `"MM/DD/YYYY"`), matching the mantine-adapter's `valueFormat` default.
|
|
28
|
+
- **Default leading icon**: the calendar icon is MUI X's own built-in "open picker" button (`slots.openPickerIcon`, positioned via `openPickerButtonPosition="start"` on the field slot) rather than a separate decorative `InputAdornment` — clicking it opens the calendar, unlike the mantine-adapter's purely decorative `leftSection` icon (there, the whole field is the click target). Overridable via `slots={{ openPickerIcon: MyIcon }}`, following the same override-prop convention as `leftSection` elsewhere in this adapter.
|
|
29
|
+
- **No native `::placeholder`**: empty date segments ("MM", "DD", "YYYY") render via MUI X's own internal placeholder styling, not a native `::placeholder` pseudo-element — there's no selector to hook the `placeholder-opacity` token onto, same constraint TimePicker.module.css documents for its own empty sections.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default calendar icon rendered in the field's open-picker button (start position, see
|
|
5
|
+
* DatePicker.tsx). Consumers can override it by passing their own `slots.openPickerIcon`.
|
|
6
|
+
* Rendered by MUI X as an `SvgIcon`-like component and handed `className`/`style` only — sized/
|
|
7
|
+
* colored entirely via the generic `.section :global(svg)` rule in DatePicker.module.css, same
|
|
8
|
+
* convention as the mantine-adapter's CalendarIcon.
|
|
9
|
+
*/
|
|
10
|
+
export function CalendarIcon({
|
|
11
|
+
className,
|
|
12
|
+
style,
|
|
13
|
+
}: {
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
}) {
|
|
17
|
+
return (
|
|
18
|
+
<svg
|
|
19
|
+
className={className}
|
|
20
|
+
style={style}
|
|
21
|
+
viewBox="0 0 24 24"
|
|
22
|
+
fill="none"
|
|
23
|
+
stroke="currentColor"
|
|
24
|
+
strokeWidth="2"
|
|
25
|
+
strokeLinecap="round"
|
|
26
|
+
strokeLinejoin="round"
|
|
27
|
+
aria-hidden
|
|
28
|
+
>
|
|
29
|
+
<rect x="3" y="4" width="18" height="18" rx="2" ry="2" />
|
|
30
|
+
<line x1="16" y1="2" x2="16" y2="6" />
|
|
31
|
+
<line x1="8" y1="2" x2="8" y2="6" />
|
|
32
|
+
<line x1="3" y1="10" x2="21" y2="10" />
|
|
33
|
+
</svg>
|
|
34
|
+
);
|
|
35
|
+
}
|