@cloud-ru/uikit-product-site-grid 0.1.3 → 0.1.5

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 CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 0.1.5 (2025-11-13)
7
+
8
+ ### Only dependencies have been changed
9
+ * [@cloud-ru/uikit-product-utils@7.0.2](https://gitverse.ru/cloud-ru-tech/uikit-product/-/blob/master/packages/utils/CHANGELOG.md)
10
+
11
+
12
+
13
+
14
+
15
+ ## 0.1.4 (2025-11-12)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **PD-3377:** contributors update to publish all packages ([719fd3e](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/719fd3e1249e247443b125c47ea408d92c8395c3))
21
+
22
+
23
+
24
+
25
+
6
26
  ## 0.1.3 (2025-11-12)
7
27
 
8
28
  ### Only dependencies have been changed
@@ -0,0 +1,2 @@
1
+ import { GridProps } from './types';
2
+ export declare function Grid({ children, columnsConfig, gap, layoutType, className, ...rest }: GridProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Grid = Grid;
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ const classnames_1 = __importDefault(require("classnames"));
20
+ const react_1 = require("react");
21
+ const uikit_product_utils_1 = require("@sbercloud/uikit-product-utils");
22
+ const helpers_1 = require("../helpers");
23
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
24
+ function Grid(_a) {
25
+ var { children, columnsConfig, gap = 'm', layoutType, className } = _a, rest = __rest(_a, ["children", "columnsConfig", "gap", "layoutType", "className"]);
26
+ const columnsStyles = (0, react_1.useMemo)(() => (0, helpers_1.getColumnsStyles)({ columnsConfig, layoutType }), [columnsConfig, layoutType]);
27
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.grid, className) }, (0, uikit_product_utils_1.extractSupportProps)(rest), { style: columnsStyles, "data-gap": gap, "data-layout-type": layoutType, children: children })));
28
+ }
@@ -0,0 +1,2 @@
1
+ export * from './Grid';
2
+ export * from './types';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Grid"), exports);
18
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,27 @@
1
+ .grid{
2
+ box-sizing:border-box;
3
+ display:grid;
4
+ --gap-count:calc(var(--grid-column-count) - 1);
5
+ --total-gap-width:calc(var(--gap-count) * var(--grid-layout-gap));
6
+ --grid-item--max-width:calc((100% - var(--total-gap-width)) / var(--grid-column-count));
7
+ grid-template-columns:repeat(auto-fill, minmax(max(var(--grid-item--min-width), var(--grid-item--max-width)), 1fr));
8
+ grid-gap:var(--grid-layout-gap);
9
+ }
10
+ .grid[data-gap=l]{
11
+ --grid-layout-gap:var(--dimension-4m, 32px);
12
+ }
13
+ .grid[data-gap=m]{
14
+ --grid-layout-gap:var(--dimension-2m, 16px);
15
+ }
16
+ .grid[data-gap=s]{
17
+ --grid-layout-gap:var(--dimension-1m, 8px);
18
+ }
19
+ .grid[data-gap=xs]{
20
+ --grid-layout-gap:var(--dimension-025m, 2px);
21
+ }
22
+ .grid[data-layout-type=tablet][data-gap=l], .grid[data-layout-type=mobile][data-gap=l]{
23
+ --grid-layout-gap:var(--dimension-2m, 16px);
24
+ }
25
+ .grid[data-layout-type=tablet][data-gap=m], .grid[data-layout-type=tablet][data-gap=s], .grid[data-layout-type=mobile][data-gap=m], .grid[data-layout-type=mobile][data-gap=s]{
26
+ --grid-layout-gap:var(--dimension-1m, 8px);
27
+ }
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ import { WithLayoutType, WithSupportProps } from '@sbercloud/uikit-product-utils';
3
+ type ColumnConfig = {
4
+ /** Количество колонок для текущего layout */
5
+ amount: number;
6
+ /** Минимальная ширина колонки */
7
+ minWidth: number;
8
+ };
9
+ type ColumnsConfig = {
10
+ desktop?: ColumnConfig;
11
+ desktopSmall?: ColumnConfig;
12
+ tablet?: ColumnConfig;
13
+ mobile?: ColumnConfig;
14
+ };
15
+ export type GridProps = WithSupportProps<WithLayoutType<{
16
+ /** Содержимое */
17
+ children: ReactNode;
18
+ /** Конфигурация настройки колонок для разных layoutType */
19
+ columnsConfig: ColumnsConfig;
20
+ /** Расстояние между колонками и рядами */
21
+ gap?: 'xs' | 's' | 'm' | 'l';
22
+ className?: string;
23
+ }>>;
24
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { GridProps } from '../components';
2
+ export declare const getColumnsStyles: ({ columnsConfig, layoutType }: Pick<GridProps, "columnsConfig" | "layoutType">) => {
3
+ '--grid-column-count': number;
4
+ '--grid-item--min-width': string;
5
+ } | undefined;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getColumnsStyles = void 0;
4
+ const getColumnsStyles = ({ columnsConfig, layoutType }) => {
5
+ switch (layoutType) {
6
+ case 'mobile':
7
+ if (columnsConfig.mobile) {
8
+ return {
9
+ '--grid-column-count': columnsConfig.mobile.amount,
10
+ '--grid-item--min-width': `${columnsConfig.mobile.minWidth}px`,
11
+ };
12
+ }
13
+ break;
14
+ case 'tablet':
15
+ if (columnsConfig.tablet) {
16
+ return {
17
+ '--grid-column-count': columnsConfig.tablet.amount,
18
+ '--grid-item--min-width': `${columnsConfig.tablet.minWidth}px`,
19
+ };
20
+ }
21
+ break;
22
+ case 'desktopSmall':
23
+ if (columnsConfig.desktopSmall) {
24
+ return {
25
+ '--grid-column-count': columnsConfig.desktopSmall.amount,
26
+ '--grid-item--min-width': `${columnsConfig.desktopSmall.minWidth}px`,
27
+ };
28
+ }
29
+ if (columnsConfig.desktop) {
30
+ return {
31
+ '--grid-column-count': columnsConfig.desktop.amount,
32
+ '--grid-item--min-width': `${columnsConfig.desktop.minWidth}px`,
33
+ };
34
+ }
35
+ break;
36
+ case 'desktop':
37
+ if (columnsConfig.desktop) {
38
+ return {
39
+ '--grid-column-count': columnsConfig.desktop.amount,
40
+ '--grid-item--min-width': `${columnsConfig.desktop.minWidth}px`,
41
+ };
42
+ }
43
+ break;
44
+ default:
45
+ return undefined;
46
+ }
47
+ };
48
+ exports.getColumnsStyles = getColumnsStyles;
@@ -0,0 +1 @@
1
+ export * from './getColumnsStyles';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./getColumnsStyles"), exports);
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./components"), exports);
@@ -0,0 +1,2 @@
1
+ import { GridProps } from './types';
2
+ export declare function Grid({ children, columnsConfig, gap, layoutType, className, ...rest }: GridProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import cn from 'classnames';
14
+ import { useMemo } from 'react';
15
+ import { extractSupportProps } from '@sbercloud/uikit-product-utils';
16
+ import { getColumnsStyles } from '../helpers';
17
+ import styles from './styles.module.css';
18
+ export function Grid(_a) {
19
+ var { children, columnsConfig, gap = 'm', layoutType, className } = _a, rest = __rest(_a, ["children", "columnsConfig", "gap", "layoutType", "className"]);
20
+ const columnsStyles = useMemo(() => getColumnsStyles({ columnsConfig, layoutType }), [columnsConfig, layoutType]);
21
+ return (_jsx("div", Object.assign({ className: cn(styles.grid, className) }, extractSupportProps(rest), { style: columnsStyles, "data-gap": gap, "data-layout-type": layoutType, children: children })));
22
+ }
@@ -0,0 +1,2 @@
1
+ export * from './Grid';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export * from './Grid';
2
+ export * from './types';
@@ -0,0 +1,27 @@
1
+ .grid{
2
+ box-sizing:border-box;
3
+ display:grid;
4
+ --gap-count:calc(var(--grid-column-count) - 1);
5
+ --total-gap-width:calc(var(--gap-count) * var(--grid-layout-gap));
6
+ --grid-item--max-width:calc((100% - var(--total-gap-width)) / var(--grid-column-count));
7
+ grid-template-columns:repeat(auto-fill, minmax(max(var(--grid-item--min-width), var(--grid-item--max-width)), 1fr));
8
+ grid-gap:var(--grid-layout-gap);
9
+ }
10
+ .grid[data-gap=l]{
11
+ --grid-layout-gap:var(--dimension-4m, 32px);
12
+ }
13
+ .grid[data-gap=m]{
14
+ --grid-layout-gap:var(--dimension-2m, 16px);
15
+ }
16
+ .grid[data-gap=s]{
17
+ --grid-layout-gap:var(--dimension-1m, 8px);
18
+ }
19
+ .grid[data-gap=xs]{
20
+ --grid-layout-gap:var(--dimension-025m, 2px);
21
+ }
22
+ .grid[data-layout-type=tablet][data-gap=l], .grid[data-layout-type=mobile][data-gap=l]{
23
+ --grid-layout-gap:var(--dimension-2m, 16px);
24
+ }
25
+ .grid[data-layout-type=tablet][data-gap=m], .grid[data-layout-type=tablet][data-gap=s], .grid[data-layout-type=mobile][data-gap=m], .grid[data-layout-type=mobile][data-gap=s]{
26
+ --grid-layout-gap:var(--dimension-1m, 8px);
27
+ }
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ import { WithLayoutType, WithSupportProps } from '@sbercloud/uikit-product-utils';
3
+ type ColumnConfig = {
4
+ /** Количество колонок для текущего layout */
5
+ amount: number;
6
+ /** Минимальная ширина колонки */
7
+ minWidth: number;
8
+ };
9
+ type ColumnsConfig = {
10
+ desktop?: ColumnConfig;
11
+ desktopSmall?: ColumnConfig;
12
+ tablet?: ColumnConfig;
13
+ mobile?: ColumnConfig;
14
+ };
15
+ export type GridProps = WithSupportProps<WithLayoutType<{
16
+ /** Содержимое */
17
+ children: ReactNode;
18
+ /** Конфигурация настройки колонок для разных layoutType */
19
+ columnsConfig: ColumnsConfig;
20
+ /** Расстояние между колонками и рядами */
21
+ gap?: 'xs' | 's' | 'm' | 'l';
22
+ className?: string;
23
+ }>>;
24
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { GridProps } from '../components';
2
+ export declare const getColumnsStyles: ({ columnsConfig, layoutType }: Pick<GridProps, "columnsConfig" | "layoutType">) => {
3
+ '--grid-column-count': number;
4
+ '--grid-item--min-width': string;
5
+ } | undefined;
@@ -0,0 +1,44 @@
1
+ export const getColumnsStyles = ({ columnsConfig, layoutType }) => {
2
+ switch (layoutType) {
3
+ case 'mobile':
4
+ if (columnsConfig.mobile) {
5
+ return {
6
+ '--grid-column-count': columnsConfig.mobile.amount,
7
+ '--grid-item--min-width': `${columnsConfig.mobile.minWidth}px`,
8
+ };
9
+ }
10
+ break;
11
+ case 'tablet':
12
+ if (columnsConfig.tablet) {
13
+ return {
14
+ '--grid-column-count': columnsConfig.tablet.amount,
15
+ '--grid-item--min-width': `${columnsConfig.tablet.minWidth}px`,
16
+ };
17
+ }
18
+ break;
19
+ case 'desktopSmall':
20
+ if (columnsConfig.desktopSmall) {
21
+ return {
22
+ '--grid-column-count': columnsConfig.desktopSmall.amount,
23
+ '--grid-item--min-width': `${columnsConfig.desktopSmall.minWidth}px`,
24
+ };
25
+ }
26
+ if (columnsConfig.desktop) {
27
+ return {
28
+ '--grid-column-count': columnsConfig.desktop.amount,
29
+ '--grid-item--min-width': `${columnsConfig.desktop.minWidth}px`,
30
+ };
31
+ }
32
+ break;
33
+ case 'desktop':
34
+ if (columnsConfig.desktop) {
35
+ return {
36
+ '--grid-column-count': columnsConfig.desktop.amount,
37
+ '--grid-item--min-width': `${columnsConfig.desktop.minWidth}px`,
38
+ };
39
+ }
40
+ break;
41
+ default:
42
+ return undefined;
43
+ }
44
+ };
@@ -0,0 +1 @@
1
+ export * from './getColumnsStyles';
@@ -0,0 +1 @@
1
+ export * from './getColumnsStyles';
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1 @@
1
+ export * from './components';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloud-ru/uikit-product-site-grid",
3
3
  "title": "Site Grid",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "sideEffects": [
6
6
  "*.css",
7
7
  "*.woff",
@@ -30,14 +30,15 @@
30
30
  "name": "Akhremenko Grigorii",
31
31
  "url": "https://github.com/AGrigorii"
32
32
  },
33
+ "contributors": [],
33
34
  "license": "Apache-2.0",
34
35
  "publishConfig": {
35
36
  "access": "public"
36
37
  },
37
38
  "scripts": {},
38
39
  "dependencies": {
39
- "@cloud-ru/uikit-product-utils": "7.0.0",
40
+ "@cloud-ru/uikit-product-utils": "7.0.2",
40
41
  "classnames": "2.5.1"
41
42
  },
42
- "gitHead": "e8bd79bc92b26a8f52611972eec98a867536ccd3"
43
+ "gitHead": "bf479ecf7238ef20b78f20acaef439efa535d1a1"
43
44
  }