@koslibs/components 1.9.0 → 1.10.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 +6 -0
- package/dist/components/Space/index.d.ts +2 -0
- package/dist/components/Space/index.js +1 -0
- package/dist/components/Space/index.module.js +14 -0
- package/dist/components/Space/index_module.css +46 -0
- package/dist/components/Space/space.d.ts +9 -0
- package/dist/components/Space/space.js +23 -0
- package/dist/components/Space/types.d.ts +40 -0
- package/dist/components/Space/types.js +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @koslibs/components
|
|
2
2
|
|
|
3
|
+
## 1.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#11](https://github.com/koslibs/components/pull/11) [`85e4c4b`](https://github.com/koslibs/components/commit/85e4c4b523847d339a773b63fcf7916098f28327) Thanks [@holypower777](https://github.com/holypower777)! - Добавлен Space для горизонтальной и вертикальной раскладки: обязательные size и children, единый положительный отступ из --size-\*, align, wrap и fullWidth. Компонент использует CSS gap, сохраняет прямые дочерние элементы и доступен через @koslibs/components/Space. Добавлены Storybook Docs и Playground.
|
|
8
|
+
|
|
3
9
|
## 1.9.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Space } from "./space.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./index_module.css";
|
|
2
|
+
const index_module = {
|
|
3
|
+
component: "component-DK13jr",
|
|
4
|
+
vertical: "vertical-MuaZ3s",
|
|
5
|
+
horizontal: "horizontal-GVxqs5",
|
|
6
|
+
start: "start-bYNz01",
|
|
7
|
+
center: "center-PS6vZJ",
|
|
8
|
+
end: "end-KbDlui",
|
|
9
|
+
stretch: "stretch-WhVrSc",
|
|
10
|
+
baseline: "baseline-mcTNmk",
|
|
11
|
+
wrap: "wrap-Ad0xGu",
|
|
12
|
+
fullWidth: "fullWidth-c7M8Hd"
|
|
13
|
+
};
|
|
14
|
+
export default index_module;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@import "../../styles/variables.css";
|
|
2
|
+
|
|
3
|
+
.component-DK13jr {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
gap: var(--space-gap);
|
|
6
|
+
min-width: 0;
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.vertical-MuaZ3s {
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.horizontal-GVxqs5 {
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.start-bYNz01 {
|
|
19
|
+
align-items: flex-start;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.center-PS6vZJ {
|
|
23
|
+
align-items: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.end-KbDlui {
|
|
27
|
+
align-items: flex-end;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.stretch-WhVrSc {
|
|
31
|
+
align-items: stretch;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.baseline-mcTNmk {
|
|
35
|
+
align-items: baseline;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.wrap-Ad0xGu {
|
|
39
|
+
flex-wrap: wrap;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.fullWidth-c7M8Hd {
|
|
43
|
+
width: 100%;
|
|
44
|
+
display: flex;
|
|
45
|
+
}
|
|
46
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const Space: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
2
|
+
children: import("react").ReactNode;
|
|
3
|
+
direction?: "horizontal" | "vertical";
|
|
4
|
+
size: import("./types.js").SpaceSize;
|
|
5
|
+
align?: "start" | "center" | "end" | "stretch" | "baseline";
|
|
6
|
+
wrap?: boolean;
|
|
7
|
+
fullWidth?: boolean;
|
|
8
|
+
dataTestId?: string;
|
|
9
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import { Children, forwardRef } from "react";
|
|
4
|
+
import index_module from "./index.module.js";
|
|
5
|
+
const Space = /*#__PURE__*/ forwardRef(({ children, direction = 'vertical', size, align = 'start', wrap = false, fullWidth = false, className, style, dataTestId, ...restProps }, ref)=>{
|
|
6
|
+
if (0 === Children.toArray(children).length) return null;
|
|
7
|
+
return /*#__PURE__*/ jsx("div", {
|
|
8
|
+
...restProps,
|
|
9
|
+
ref: ref,
|
|
10
|
+
className: classnames(index_module.component, index_module[direction], index_module[align], {
|
|
11
|
+
[index_module.wrap]: wrap,
|
|
12
|
+
[index_module.fullWidth]: fullWidth
|
|
13
|
+
}, className),
|
|
14
|
+
style: {
|
|
15
|
+
'--space-gap': `var(--size-${size})`,
|
|
16
|
+
...style
|
|
17
|
+
},
|
|
18
|
+
"data-test-id": dataTestId,
|
|
19
|
+
children: children
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
Space.displayName = 'Space';
|
|
23
|
+
export { Space };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Положительный отступ из общей шкалы --size-*.
|
|
4
|
+
*/
|
|
5
|
+
export type SpaceSize = 2 | 4 | 6 | 8 | 12 | 16 | 20 | 22 | 24 | 28 | 30 | 32 | 36 | 40 | 44 | 48 | 56 | 64 | 72 | 80 | 96 | 128;
|
|
6
|
+
export type SpaceProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
7
|
+
/**
|
|
8
|
+
* Элементы раскладки. Отображаются без дополнительных обёрток.
|
|
9
|
+
*/
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Направление раскладки.
|
|
13
|
+
* @default 'vertical'
|
|
14
|
+
*/
|
|
15
|
+
direction?: 'horizontal' | 'vertical';
|
|
16
|
+
/**
|
|
17
|
+
* Единый отступ между элементами и строками.
|
|
18
|
+
* Обязательное положительное значение из глобальной шкалы --size-*.
|
|
19
|
+
*/
|
|
20
|
+
size: SpaceSize;
|
|
21
|
+
/**
|
|
22
|
+
* Выравнивание по поперечной оси относительно direction.
|
|
23
|
+
* @default 'start'
|
|
24
|
+
*/
|
|
25
|
+
align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
26
|
+
/**
|
|
27
|
+
* Разрешает перенос элементов на следующую строку или колонку.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
wrap?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Растягивает контейнер на всю ширину родителя.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
fullWidth?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Идентификатор корневого элемента для тестов.
|
|
38
|
+
*/
|
|
39
|
+
dataTestId?: string;
|
|
40
|
+
};
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export { Spinner } from './components/Spinner/index.js';
|
|
|
12
12
|
export type { SpinnerProps } from './components/Spinner/index.js';
|
|
13
13
|
export { Status } from './components/Status/index.js';
|
|
14
14
|
export type { StatusProps } from './components/Status/index.js';
|
|
15
|
+
export { Space } from './components/Space/index.js';
|
|
16
|
+
export type { SpaceProps, SpaceSize } from './components/Space/index.js';
|
|
15
17
|
export { Typography, TypographyText, TypographyTitle, Text, Title } from './components/Typography/index.js';
|
|
16
18
|
export type { TextProps, TitleProps, TypographyColor, TypographyWeight, } from './components/Typography/index.js';
|
|
17
19
|
export { Popover } from './components/Popover/index.js';
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export { Textarea } from "./components/Textarea/index.js";
|
|
|
5
5
|
export { Tab, Tabs } from "./components/Tabs/index.js";
|
|
6
6
|
export { Spinner } from "./components/Spinner/index.js";
|
|
7
7
|
export { Status } from "./components/Status/index.js";
|
|
8
|
+
export { Space } from "./components/Space/index.js";
|
|
8
9
|
export { Text, Title, Typography, TypographyText, TypographyTitle } from "./components/Typography/index.js";
|
|
9
10
|
export { Popover } from "./components/Popover/index.js";
|
|
10
11
|
export { Collapse } from "./components/Collapse/index.js";
|