@astral/ui 1.48.0 → 1.49.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/Grid/Grid.d.ts CHANGED
@@ -1,3 +1,8 @@
1
- /// <reference types="react" />
2
- import { GridProps } from './types';
3
- export declare const Grid: ({ container, templateColumns, templateRows, templateAreas, columnSpacing, rowSpacing, spacing, autoColumns, autoRows, autoFlow, column, row, area, component, children, ...props }: GridProps) => JSX.Element;
1
+ import { ReactNode } from 'react';
2
+ import { GridContainerProps, GridElementsProps } from './types';
3
+ export type GridProps = GridContainerProps & GridElementsProps & {
4
+ children?: ReactNode;
5
+ };
6
+ export declare const Grid: import("react").ForwardRefExoticComponent<GridContainerProps & GridElementsProps & {
7
+ children?: ReactNode;
8
+ } & import("react").RefAttributes<HTMLElement>>;
package/Grid/Grid.js CHANGED
@@ -13,9 +13,9 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.Grid = void 0;
15
15
  const jsx_runtime_1 = require("react/jsx-runtime");
16
+ const react_1 = require("react");
16
17
  const styled_1 = require("./styled");
17
- const Grid = (_a) => {
18
+ exports.Grid = (0, react_1.forwardRef)((_a, ref) => {
18
19
  var { container = false, templateColumns, templateRows, templateAreas, columnSpacing, rowSpacing, spacing, autoColumns, autoRows, autoFlow, column, row, area, component = 'div', children } = _a, props = __rest(_a, ["container", "templateColumns", "templateRows", "templateAreas", "columnSpacing", "rowSpacing", "spacing", "autoColumns", "autoRows", "autoFlow", "column", "row", "area", "component", "children"]);
19
- return ((0, jsx_runtime_1.jsx)(styled_1.StyledGrid, Object.assign({ container: container, gridTemplateColumns: templateColumns, gridTemplateRows: templateRows, gridTemplateAreas: templateAreas, columnGap: columnSpacing, rowGap: rowSpacing, gap: spacing, gridAutoColumns: autoColumns, gridAutoRows: autoRows, gridAutoFlow: autoFlow, gridColumn: column, gridRow: row, gridArea: area, component: component }, props, { children: children })));
20
- };
21
- exports.Grid = Grid;
20
+ return ((0, jsx_runtime_1.jsx)(styled_1.StyledGrid, Object.assign({ ref: ref, container: container, gridTemplateColumns: templateColumns, gridTemplateRows: templateRows, gridTemplateAreas: templateAreas, columnGap: columnSpacing, rowGap: rowSpacing, gap: spacing, gridAutoColumns: autoColumns, gridAutoRows: autoRows, gridAutoFlow: autoFlow, gridColumn: column, gridRow: row, gridArea: area, component: component }, props, { children: children })));
21
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const tests_1 = require("@astral/tests");
5
+ const vitest_1 = require("vitest");
6
+ const react_1 = require("react");
7
+ const Grid_1 = require("./Grid");
8
+ (0, vitest_1.describe)('Grid', () => {
9
+ (0, vitest_1.it)('Prop:ref: is present', () => {
10
+ const resultRef = { current: null };
11
+ const GridWithRef = () => {
12
+ const ref = (0, react_1.useRef)(null);
13
+ (0, react_1.useEffect)(() => {
14
+ resultRef.current = ref.current;
15
+ }, []);
16
+ return (0, jsx_runtime_1.jsx)(Grid_1.Grid, Object.assign({ ref: ref }, { children: "Grid" }));
17
+ };
18
+ (0, tests_1.renderWithTheme)((0, jsx_runtime_1.jsx)(GridWithRef, {}));
19
+ (0, vitest_1.expect)(resultRef === null || resultRef === void 0 ? void 0 : resultRef.current).not.toBeNull();
20
+ });
21
+ });
package/Grid/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CSSProperties, ElementType, ReactNode } from 'react';
1
+ import { CSSProperties, ElementType } from 'react';
2
2
  import { Breakpoint } from '@mui/material/styles';
3
3
  type StyleCSSType<Type extends keyof CSSProperties> = CSSProperties[Type] | Partial<Record<Breakpoint, CSSProperties[Type]>>;
4
4
  export type GridContainerProps = {
@@ -25,7 +25,4 @@ export type GridElementsProps = {
25
25
  justifySelf?: StyleCSSType<'justifySelf'>;
26
26
  alignSelf?: StyleCSSType<'alignSelf'>;
27
27
  };
28
- export type GridProps = GridContainerProps & GridElementsProps & {
29
- children?: ReactNode;
30
- };
31
28
  export {};
@@ -1,3 +1,8 @@
1
- /// <reference types="react" />
2
- import { GridProps } from './types';
3
- export declare const Grid: ({ container, templateColumns, templateRows, templateAreas, columnSpacing, rowSpacing, spacing, autoColumns, autoRows, autoFlow, column, row, area, component, children, ...props }: GridProps) => JSX.Element;
1
+ import { ReactNode } from 'react';
2
+ import { GridContainerProps, GridElementsProps } from './types';
3
+ export type GridProps = GridContainerProps & GridElementsProps & {
4
+ children?: ReactNode;
5
+ };
6
+ export declare const Grid: import("react").ForwardRefExoticComponent<GridContainerProps & GridElementsProps & {
7
+ children?: ReactNode;
8
+ } & import("react").RefAttributes<HTMLElement>>;
package/esm/Grid/Grid.js CHANGED
@@ -10,8 +10,9 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { forwardRef } from 'react';
13
14
  import { StyledGrid } from './styled';
14
- export const Grid = (_a) => {
15
+ export const Grid = forwardRef((_a, ref) => {
15
16
  var { container = false, templateColumns, templateRows, templateAreas, columnSpacing, rowSpacing, spacing, autoColumns, autoRows, autoFlow, column, row, area, component = 'div', children } = _a, props = __rest(_a, ["container", "templateColumns", "templateRows", "templateAreas", "columnSpacing", "rowSpacing", "spacing", "autoColumns", "autoRows", "autoFlow", "column", "row", "area", "component", "children"]);
16
- return (_jsx(StyledGrid, Object.assign({ container: container, gridTemplateColumns: templateColumns, gridTemplateRows: templateRows, gridTemplateAreas: templateAreas, columnGap: columnSpacing, rowGap: rowSpacing, gap: spacing, gridAutoColumns: autoColumns, gridAutoRows: autoRows, gridAutoFlow: autoFlow, gridColumn: column, gridRow: row, gridArea: area, component: component }, props, { children: children })));
17
- };
17
+ return (_jsx(StyledGrid, Object.assign({ ref: ref, container: container, gridTemplateColumns: templateColumns, gridTemplateRows: templateRows, gridTemplateAreas: templateAreas, columnGap: columnSpacing, rowGap: rowSpacing, gap: spacing, gridAutoColumns: autoColumns, gridAutoRows: autoRows, gridAutoFlow: autoFlow, gridColumn: column, gridRow: row, gridArea: area, component: component }, props, { children: children })));
18
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { renderWithTheme } from '@astral/tests';
3
+ import { describe, expect, it } from 'vitest';
4
+ import { useEffect, useRef } from 'react';
5
+ import { Grid } from './Grid';
6
+ describe('Grid', () => {
7
+ it('Prop:ref: is present', () => {
8
+ const resultRef = { current: null };
9
+ const GridWithRef = () => {
10
+ const ref = useRef(null);
11
+ useEffect(() => {
12
+ resultRef.current = ref.current;
13
+ }, []);
14
+ return _jsx(Grid, Object.assign({ ref: ref }, { children: "Grid" }));
15
+ };
16
+ renderWithTheme(_jsx(GridWithRef, {}));
17
+ expect(resultRef === null || resultRef === void 0 ? void 0 : resultRef.current).not.toBeNull();
18
+ });
19
+ });
@@ -1,4 +1,4 @@
1
- import { CSSProperties, ElementType, ReactNode } from 'react';
1
+ import { CSSProperties, ElementType } from 'react';
2
2
  import { Breakpoint } from '@mui/material/styles';
3
3
  type StyleCSSType<Type extends keyof CSSProperties> = CSSProperties[Type] | Partial<Record<Breakpoint, CSSProperties[Type]>>;
4
4
  export type GridContainerProps = {
@@ -25,7 +25,4 @@ export type GridElementsProps = {
25
25
  justifySelf?: StyleCSSType<'justifySelf'>;
26
26
  alignSelf?: StyleCSSType<'alignSelf'>;
27
27
  };
28
- export type GridProps = GridContainerProps & GridElementsProps & {
29
- children?: ReactNode;
30
- };
31
28
  export {};
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "1.48.0",
3
+ "version": "1.49.0",
4
4
  "browser": "./esm/index.js",
5
5
  "main": "./index.js",
6
6
  "dependencies": {
7
- "@astral/icons": "^1.48.0",
7
+ "@astral/icons": "^1.49.0",
8
8
  "@emotion/cache": "11.7.1",
9
9
  "@emotion/react": "11.9.0",
10
10
  "@emotion/server": "11.4.0",