@instruments/materia-ui 0.4.5 → 0.4.6
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/agent-docs.md +4 -0
- package/dist/components/aspect-ratio/aspect-ratio-root.d.ts +7 -3
- package/dist/components/aspect-ratio/aspect-ratio-root.js +5 -3
- package/dist/components/media-frame/media-frame-root.d.ts +2 -0
- package/dist/components/media-frame/media-frame-root.js +2 -0
- package/dist/components/swatch/swatch-root.d.ts +2 -0
- package/dist/components/swatch/swatch-root.js +2 -0
- package/dist/compositions/product-card/product-card-root.d.ts +2 -0
- package/dist/compositions/product-card/product-card-root.js +2 -0
- package/dist/data/docs-manifest.js +29 -6
- package/package.json +2 -1
package/agent-docs.md
CHANGED
|
@@ -80,6 +80,7 @@ Constrains its content to a fixed width-to-height ratio, sizing itself to the av
|
|
|
80
80
|
|
|
81
81
|
- Give it exactly one child and let it fill - set the media to `size-full object-cover`; `AspectRatio` sizes to the available width and derives height from `ratio`.
|
|
82
82
|
- Use `as` to change the element (a tag); use `render` only to swap in a component (e.g. a router Link). Never `render={<Box as=…/>}` - pass `as` directly.
|
|
83
|
+
- Show a material, swatch or sample at the default 1:1 - never landscape. A sample is cut square, and a wide crop reads as room photography; set a wide `ratio` only for a scene, an interior or video.
|
|
83
84
|
|
|
84
85
|
## AttributeCard
|
|
85
86
|
|
|
@@ -1033,6 +1034,7 @@ Extracted from the product-card and editorial-card media frames; available to an
|
|
|
1033
1034
|
- Use `as` to change the element (a tag); use `render` only to swap in a component (e.g. a router Link). Never `render={<Box as=…/>}` - pass `as` directly.
|
|
1034
1035
|
- Set `edge` to frame photography with an inset hairline that stays above the media; do not fake it with a border or an inset shadow on the frame, which the media hides.
|
|
1035
1036
|
- Reach for `raised` only when the frame sits on the same fill as its surface; in a dense row the edge already separates it.
|
|
1037
|
+
- Frame a material, swatch or sample square: give the frame `aspect-square` (or wrap it in `AspectRatio`, which defaults to 1:1). Never crop a material landscape.
|
|
1036
1038
|
|
|
1037
1039
|
## MediaFrameEmbed
|
|
1038
1040
|
|
|
@@ -1244,6 +1246,7 @@ This is a presentational component that accepts handlers via props for app-speci
|
|
|
1244
1246
|
|
|
1245
1247
|
- In Next.js apps pass `renderImage` wrapping `next/image` and `linkAs={Link}` - the defaults are a plain `<img>` and `<a>`.
|
|
1246
1248
|
- Cart UI renders only when a `renderAddToCart` slot is provided; keep `dragAdapter` referentially stable (module-level constant).
|
|
1249
|
+
- Use ProductCard for a material in a grid or list; its image is square, which is how a material is always shown. Don't rebuild the card with a landscape image.
|
|
1247
1250
|
|
|
1248
1251
|
## ProductCardProvider
|
|
1249
1252
|
|
|
@@ -1833,6 +1836,7 @@ Chips paint the darkening overlay on every fill and draw the double-ring selecti
|
|
|
1833
1836
|
- Feed fills through `color`/`background`/`colors`, never a hex in `className`/`style` - the props drive the contrast-aware text colour, selection ring, and darkening overlay.
|
|
1834
1837
|
- Reach for `Swatch` for a selectable colour/gradient/material chip or tile; a tiny non-interactive status marker is `Dot`, and a display-only status/category label is `Badge`.
|
|
1835
1838
|
- For a gradient or image chip fill pass `light` - auto contrast detection (`isLightColor`) only reads solid colours, so overlaid icons/labels lose legibility without it.
|
|
1839
|
+
- A material swatch is always square, as Swatch draws it; never stretch a tile into a landscape crop, and in a grid let the column set the size.
|
|
1836
1840
|
|
|
1837
1841
|
## SwatchFan
|
|
1838
1842
|
|
|
@@ -14,7 +14,9 @@ interface AspectRatioProps extends useRender.ComponentProps<"div"> {
|
|
|
14
14
|
as?: LayoutElement;
|
|
15
15
|
/**
|
|
16
16
|
* Desired width-to-height ratio, expressed as a single number (width / height).
|
|
17
|
-
*
|
|
17
|
+
* Square unless asked: a material is shown at 1:1, and only scenes and
|
|
18
|
+
* video take a wide ratio.
|
|
19
|
+
* @default 1
|
|
18
20
|
*/
|
|
19
21
|
ratio?: number;
|
|
20
22
|
}
|
|
@@ -25,13 +27,15 @@ interface AspectRatioProps extends useRender.ComponentProps<"div"> {
|
|
|
25
27
|
*
|
|
26
28
|
* @example
|
|
27
29
|
* ```tsx
|
|
28
|
-
* <AspectRatio
|
|
29
|
-
* <img alt="" className="size-full object-cover" src="/
|
|
30
|
+
* <AspectRatio>
|
|
31
|
+
* <img alt="" className="size-full object-cover" src="/oak-plank.jpg" />
|
|
30
32
|
* </AspectRatio>
|
|
31
33
|
* ```
|
|
32
34
|
*
|
|
33
35
|
* @bestPractice Give it exactly one child and let it fill - set the media to `size-full object-cover`; `AspectRatio` sizes to the available width and derives height from `ratio`.
|
|
34
36
|
* @bestPractice Use `as` to change the element (a tag); use `render` only to swap in a component (e.g. a router Link). Never `render={<Box as=…/>}` - pass `as` directly.
|
|
37
|
+
* @bestPractice Show a material, swatch or sample at the default 1:1 - never landscape. A sample is cut square, and a wide crop reads as room photography; set a wide `ratio` only for a scene, an interior or video.
|
|
38
|
+
* @keywords material image, swatch image, sample image, thumbnail, square, image ratio
|
|
35
39
|
* @category layout
|
|
36
40
|
*/
|
|
37
41
|
declare const AspectRatio: ({ as, className, ratio, ref, render, style, ...props }: AspectRatioProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useRender } from "@base-ui/react/use-render";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
import { reportDevIssue } from "../../utils/dev-issue.js";
|
|
5
|
-
const DEFAULT_RATIO =
|
|
5
|
+
const DEFAULT_RATIO = 1;
|
|
6
6
|
/**
|
|
7
7
|
* Constrains its content to a fixed width-to-height ratio, sizing itself to the
|
|
8
8
|
* available width with CSS `aspect-ratio`; drop a single child (image, video,
|
|
@@ -10,13 +10,15 @@ const DEFAULT_RATIO = 16 / 9;
|
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```tsx
|
|
13
|
-
* <AspectRatio
|
|
14
|
-
* <img alt="" className="size-full object-cover" src="/
|
|
13
|
+
* <AspectRatio>
|
|
14
|
+
* <img alt="" className="size-full object-cover" src="/oak-plank.jpg" />
|
|
15
15
|
* </AspectRatio>
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
18
|
* @bestPractice Give it exactly one child and let it fill - set the media to `size-full object-cover`; `AspectRatio` sizes to the available width and derives height from `ratio`.
|
|
19
19
|
* @bestPractice Use `as` to change the element (a tag); use `render` only to swap in a component (e.g. a router Link). Never `render={<Box as=…/>}` - pass `as` directly.
|
|
20
|
+
* @bestPractice Show a material, swatch or sample at the default 1:1 - never landscape. A sample is cut square, and a wide crop reads as room photography; set a wide `ratio` only for a scene, an interior or video.
|
|
21
|
+
* @keywords material image, swatch image, sample image, thumbnail, square, image ratio
|
|
20
22
|
* @category layout
|
|
21
23
|
*/
|
|
22
24
|
const AspectRatio = ({ as, className, ratio = DEFAULT_RATIO, ref, render, style, ...props }) => {
|
|
@@ -51,6 +51,8 @@ export interface MediaFrameProps extends useRender.ComponentProps<"div"> {
|
|
|
51
51
|
* @bestPractice Use `as` to change the element (a tag); use `render` only to swap in a component (e.g. a router Link). Never `render={<Box as=…/>}` - pass `as` directly.
|
|
52
52
|
* @bestPractice Set `edge` to frame photography with an inset hairline that stays above the media; do not fake it with a border or an inset shadow on the frame, which the media hides.
|
|
53
53
|
* @bestPractice Reach for `raised` only when the frame sits on the same fill as its surface; in a dense row the edge already separates it.
|
|
54
|
+
* @bestPractice Frame a material, swatch or sample square: give the frame `aspect-square` (or wrap it in `AspectRatio`, which defaults to 1:1). Never crop a material landscape.
|
|
55
|
+
* @keywords material image, product image, photo frame, thumbnail
|
|
54
56
|
* @category layout
|
|
55
57
|
*/
|
|
56
58
|
export declare const MediaFrame: ({ as, className, children, edge, raised, ref, render, ...props }: MediaFrameProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -25,6 +25,8 @@ import { reportDevIssue } from "../../utils/dev-issue.js";
|
|
|
25
25
|
* @bestPractice Use `as` to change the element (a tag); use `render` only to swap in a component (e.g. a router Link). Never `render={<Box as=…/>}` - pass `as` directly.
|
|
26
26
|
* @bestPractice Set `edge` to frame photography with an inset hairline that stays above the media; do not fake it with a border or an inset shadow on the frame, which the media hides.
|
|
27
27
|
* @bestPractice Reach for `raised` only when the frame sits on the same fill as its surface; in a dense row the edge already separates it.
|
|
28
|
+
* @bestPractice Frame a material, swatch or sample square: give the frame `aspect-square` (or wrap it in `AspectRatio`, which defaults to 1:1). Never crop a material landscape.
|
|
29
|
+
* @keywords material image, product image, photo frame, thumbnail
|
|
28
30
|
* @category layout
|
|
29
31
|
*/
|
|
30
32
|
export const MediaFrame = ({ as, className, children, edge = false, raised = false, ref, render, ...props }) => {
|
|
@@ -38,6 +38,8 @@ type SwatchProps = ChipSwatchProps | TileSwatchProps;
|
|
|
38
38
|
* @bestPractice Feed fills through `color`/`background`/`colors`, never a hex in `className`/`style` - the props drive the contrast-aware text colour, selection ring, and darkening overlay.
|
|
39
39
|
* @bestPractice Reach for `Swatch` for a selectable colour/gradient/material chip or tile; a tiny non-interactive status marker is `Dot`, and a display-only status/category label is `Badge`.
|
|
40
40
|
* @bestPractice For a gradient or image chip fill pass `light` - auto contrast detection (`isLightColor`) only reads solid colours, so overlaid icons/labels lose legibility without it.
|
|
41
|
+
* @bestPractice A material swatch is always square, as Swatch draws it; never stretch a tile into a landscape crop, and in a grid let the column set the size.
|
|
42
|
+
* @keywords material swatch, material sample, finish, colourway, colour chip
|
|
41
43
|
* @category color
|
|
42
44
|
*/
|
|
43
45
|
declare const Swatch: (props: SwatchProps) => import("react").JSX.Element;
|
|
@@ -29,6 +29,8 @@ import { SwatchTile } from "./swatch-tile.js";
|
|
|
29
29
|
* @bestPractice Feed fills through `color`/`background`/`colors`, never a hex in `className`/`style` - the props drive the contrast-aware text colour, selection ring, and darkening overlay.
|
|
30
30
|
* @bestPractice Reach for `Swatch` for a selectable colour/gradient/material chip or tile; a tiny non-interactive status marker is `Dot`, and a display-only status/category label is `Badge`.
|
|
31
31
|
* @bestPractice For a gradient or image chip fill pass `light` - auto contrast detection (`isLightColor`) only reads solid colours, so overlaid icons/labels lose legibility without it.
|
|
32
|
+
* @bestPractice A material swatch is always square, as Swatch draws it; never stretch a tile into a landscape crop, and in a grid let the column set the size.
|
|
33
|
+
* @keywords material swatch, material sample, finish, colourway, colour chip
|
|
32
34
|
* @category color
|
|
33
35
|
*/
|
|
34
36
|
const Swatch = (props) => {
|
|
@@ -33,6 +33,8 @@ declare const ProductCardBase: ({ className, product, variantId, mode, width, ac
|
|
|
33
33
|
* `linkAs={Link}` - the defaults are a plain `<img>` and `<a>`.
|
|
34
34
|
* @bestPractice Cart UI renders only when a `renderAddToCart` slot is
|
|
35
35
|
* provided; keep `dragAdapter` referentially stable (module-level constant).
|
|
36
|
+
* @bestPractice Use ProductCard for a material in a grid or list; its image is square, which is how a material is always shown. Don't rebuild the card with a landscape image.
|
|
37
|
+
* @keywords material card, material tile, sample card, catalogue card, product tile
|
|
36
38
|
* @category catalogue
|
|
37
39
|
*/
|
|
38
40
|
export declare const ProductCard: import("react").MemoExoticComponent<typeof ProductCardBase>;
|
|
@@ -42,6 +42,8 @@ const ProductCardBase = ({ className, product, variantId, mode = "group", width,
|
|
|
42
42
|
* `linkAs={Link}` - the defaults are a plain `<img>` and `<a>`.
|
|
43
43
|
* @bestPractice Cart UI renders only when a `renderAddToCart` slot is
|
|
44
44
|
* provided; keep `dragAdapter` referentially stable (module-level constant).
|
|
45
|
+
* @bestPractice Use ProductCard for a material in a grid or list; its image is square, which is how a material is always shown. Don't rebuild the card with a landscape image.
|
|
46
|
+
* @keywords material card, material tile, sample card, catalogue card, product tile
|
|
45
47
|
* @category catalogue
|
|
46
48
|
*/
|
|
47
49
|
export const ProductCard = memo(ProductCardBase);
|
|
@@ -458,8 +458,8 @@ export const docsManifest = {
|
|
|
458
458
|
name: "ratio",
|
|
459
459
|
type: "number",
|
|
460
460
|
required: false,
|
|
461
|
-
defaultValue: "
|
|
462
|
-
description: "Desired width-to-height ratio, expressed as a single number (width / height).",
|
|
461
|
+
defaultValue: "1",
|
|
462
|
+
description: "Desired width-to-height ratio, expressed as a single number (width / height).\nSquare unless asked: a material is shown at 1:1, and only scenes and\nvideo take a wide ratio.",
|
|
463
463
|
},
|
|
464
464
|
],
|
|
465
465
|
},
|
|
@@ -472,8 +472,16 @@ export const docsManifest = {
|
|
|
472
472
|
bestPractices: [
|
|
473
473
|
"Give it exactly one child and let it fill - set the media to `size-full object-cover`; `AspectRatio` sizes to the available width and derives height from `ratio`.",
|
|
474
474
|
"Use `as` to change the element (a tag); use `render` only to swap in a component (e.g. a router Link). Never `render={<Box as=…/>}` - pass `as` directly.",
|
|
475
|
+
"Show a material, swatch or sample at the default 1:1 - never landscape. A sample is cut square, and a wide crop reads as room photography; set a wide `ratio` only for a scene, an interior or video.",
|
|
476
|
+
],
|
|
477
|
+
keywords: [
|
|
478
|
+
"material image",
|
|
479
|
+
"swatch image",
|
|
480
|
+
"sample image",
|
|
481
|
+
"thumbnail",
|
|
482
|
+
"square",
|
|
483
|
+
"image ratio",
|
|
475
484
|
],
|
|
476
|
-
keywords: [],
|
|
477
485
|
uses: [],
|
|
478
486
|
usedBy: [],
|
|
479
487
|
anatomy: {
|
|
@@ -6957,8 +6965,9 @@ export const docsManifest = {
|
|
|
6957
6965
|
"Use `as` to change the element (a tag); use `render` only to swap in a component (e.g. a router Link). Never `render={<Box as=…/>}` - pass `as` directly.",
|
|
6958
6966
|
"Set `edge` to frame photography with an inset hairline that stays above the media; do not fake it with a border or an inset shadow on the frame, which the media hides.",
|
|
6959
6967
|
"Reach for `raised` only when the frame sits on the same fill as its surface; in a dense row the edge already separates it.",
|
|
6968
|
+
"Frame a material, swatch or sample square: give the frame `aspect-square` (or wrap it in `AspectRatio`, which defaults to 1:1). Never crop a material landscape.",
|
|
6960
6969
|
],
|
|
6961
|
-
keywords: [],
|
|
6970
|
+
keywords: ["material image", "product image", "photo frame", "thumbnail"],
|
|
6962
6971
|
uses: [],
|
|
6963
6972
|
usedBy: ["editorial-card", "product-card"],
|
|
6964
6973
|
},
|
|
@@ -11704,8 +11713,15 @@ export const docsManifest = {
|
|
|
11704
11713
|
"Feed fills through `color`/`background`/`colors`, never a hex in `className`/`style` - the props drive the contrast-aware text colour, selection ring, and darkening overlay.",
|
|
11705
11714
|
"Reach for `Swatch` for a selectable colour/gradient/material chip or tile; a tiny non-interactive status marker is `Dot`, and a display-only status/category label is `Badge`.",
|
|
11706
11715
|
"For a gradient or image chip fill pass `light` - auto contrast detection (`isLightColor`) only reads solid colours, so overlaid icons/labels lose legibility without it.",
|
|
11716
|
+
"A material swatch is always square, as Swatch draws it; never stretch a tile into a landscape crop, and in a grid let the column set the size.",
|
|
11717
|
+
],
|
|
11718
|
+
keywords: [
|
|
11719
|
+
"material swatch",
|
|
11720
|
+
"material sample",
|
|
11721
|
+
"finish",
|
|
11722
|
+
"colourway",
|
|
11723
|
+
"colour chip",
|
|
11707
11724
|
],
|
|
11708
|
-
keywords: [],
|
|
11709
11725
|
uses: ["center", "flex", "icon"],
|
|
11710
11726
|
usedBy: [
|
|
11711
11727
|
"swatch-fan",
|
|
@@ -19657,10 +19673,17 @@ export const docsManifest = {
|
|
|
19657
19673
|
bestPractices: [
|
|
19658
19674
|
"In Next.js apps pass `renderImage` wrapping `next/image` and\n`linkAs={Link}` - the defaults are a plain `<img>` and `<a>`.",
|
|
19659
19675
|
"Cart UI renders only when a `renderAddToCart` slot is\nprovided; keep `dragAdapter` referentially stable (module-level constant).",
|
|
19676
|
+
"Use ProductCard for a material in a grid or list; its image is square, which is how a material is always shown. Don't rebuild the card with a landscape image.",
|
|
19660
19677
|
"Pass `renderImage` wrapping `next/image` in Next.js apps -\nthe default renderer is a plain `<img>` and skips Next's optimisation.",
|
|
19661
19678
|
"Keep `dragAdapter` referentially stable (a module-level\nconstant) - an inline factory remounts the image subtree and drops the\ndrag ref mid-drag.",
|
|
19662
19679
|
],
|
|
19663
|
-
keywords: [
|
|
19680
|
+
keywords: [
|
|
19681
|
+
"material card",
|
|
19682
|
+
"material tile",
|
|
19683
|
+
"sample card",
|
|
19684
|
+
"catalogue card",
|
|
19685
|
+
"product tile",
|
|
19686
|
+
],
|
|
19664
19687
|
uses: [
|
|
19665
19688
|
"badge",
|
|
19666
19689
|
"box",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instruments/materia-ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Materia design system: React components, tokens and Tailwind v4 styles.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -898,6 +898,7 @@
|
|
|
898
898
|
"scripts": {
|
|
899
899
|
"build": "rm -rf dist && tsc -p tsconfig.build.json && node scripts/finish-dist.ts",
|
|
900
900
|
"deploy:figma-connect": "tsx figma/connect-templates.ts --publish",
|
|
901
|
+
"deploy:figma-descriptions": "tsx figma/descriptions.ts push",
|
|
901
902
|
"deploy:figma-storybook-links": "tsx figma/storybook-links.ts --publish",
|
|
902
903
|
"deploy:figma-tokens": "tsx figma/deploy-tokens.ts",
|
|
903
904
|
"generate:agent-docs": "node scripts/generate-agent-docs.ts",
|