@janbox/storefront-ui 2.0.32 → 3.0.1
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/README.md +125 -99
- package/dist/constants/emotion.d.ts +0 -2
- package/dist/constants/emotion.js +0 -24
- package/dist/lib/accordion/accordion-summary/accordion-summary.d.ts +1 -1
- package/dist/lib/accordion/accordion-summary/accordion-summary.js +21 -13
- package/dist/lib/accordion/accordion-summary/types.d.ts +4 -3
- package/dist/lib/avatar/avatar.js +2 -2
- package/dist/lib/box/README.md +1 -11
- package/dist/lib/box/box.js +1 -3
- package/dist/lib/box/types.d.ts +1 -5
- package/dist/lib/button/button.js +2 -2
- package/dist/lib/cascader/cascader.js +9 -12
- package/dist/lib/cascader/types.d.ts +3 -2
- package/dist/lib/chip/chip.d.ts +1 -1
- package/dist/lib/chip/chip.js +35 -31
- package/dist/lib/chip/types.d.ts +5 -4
- package/dist/lib/container/README.md +7 -18
- package/dist/lib/container/container.d.ts +1 -1
- package/dist/lib/container/container.js +4 -88
- package/dist/lib/container/helpers.js +24 -1
- package/dist/lib/container/types.d.ts +2 -8
- package/dist/lib/date-picker/date-picker.js +1 -1
- package/dist/lib/flexbox/README.md +1 -2
- package/dist/lib/flexbox/flexbox/flexbox.d.ts +1 -1
- package/dist/lib/flexbox/flexbox/flexbox.js +1 -3
- package/dist/lib/flexbox/flexbox/types.d.ts +2 -6
- package/dist/lib/grid/cell/README.md +66 -0
- package/dist/lib/grid/{README.md → grid/README.md} +5 -6
- package/dist/lib/grid/grid/grid.js +1 -3
- package/dist/lib/grid/grid/types.d.ts +4 -5
- package/dist/lib/icon-button/icon-button.js +2 -2
- package/dist/lib/stepper/step.js +6 -6
- package/dist/lib/swiper/swiper-dots-paging/swiper-dots-paging.js +1 -1
- package/dist/lib/swiper/swiper-side-arrows-paging/swiper-side-arrows-paging.js +1 -1
- package/dist/lib/table/table/table.d.ts +1 -1
- package/dist/lib/table/table/table.js +7 -6
- package/dist/lib/table/table/types.d.ts +2 -2
- package/dist/lib/table/table-footer/table-footer.d.ts +1 -1
- package/dist/lib/table/table-footer/table-footer.js +4 -4
- package/dist/lib/table/table-footer/types.d.ts +2 -2
- package/dist/theme/palette.d.ts +7 -6
- package/dist/theme/palette.js +41 -24
- package/dist/utils/index.d.ts +2 -4
- package/dist/utils/index.js +14 -21
- package/package.json +1 -1
package/dist/lib/chip/chip.js
CHANGED
|
@@ -1,52 +1,56 @@
|
|
|
1
|
-
import { jsx } from "
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getChipProps, getChipSizeState } from "./helpers.js";
|
|
3
3
|
import { getColorShadesByVariant } from "../../utils/index.js";
|
|
4
|
-
import
|
|
4
|
+
import "lodash-es";
|
|
5
5
|
import "../../theme/palette.js";
|
|
6
6
|
import { getTypographyVar } from "../../theme/typography.js";
|
|
7
|
-
import {
|
|
7
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
8
8
|
const Chip = ({ children, ..._props }) => {
|
|
9
9
|
const { sx, size, sm, md, lg, color = "green", ...rest } = getChipProps(_props);
|
|
10
10
|
const { light, main } = getColorShadesByVariant(color);
|
|
11
11
|
return /* @__PURE__ */ jsx(
|
|
12
|
-
|
|
12
|
+
Primitive,
|
|
13
13
|
{
|
|
14
|
+
as: "div",
|
|
14
15
|
...rest,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
sx: {
|
|
17
|
+
width: "fit-content",
|
|
18
|
+
maxWidth: "100%",
|
|
19
|
+
display: "flex",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
backgroundColor: light,
|
|
22
|
+
borderWidth: 1,
|
|
23
|
+
borderColor: main,
|
|
24
|
+
color: main,
|
|
25
|
+
...createStyle({ size }),
|
|
26
|
+
...sx,
|
|
27
|
+
sm: {
|
|
28
|
+
...createStyle(sm),
|
|
29
|
+
...sx == null ? void 0 : sx.sm
|
|
25
30
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
[mediaQuery("md")]: createStyle(md),
|
|
30
|
-
[mediaQuery("lg")]: createStyle(lg)
|
|
31
|
+
md: {
|
|
32
|
+
...createStyle(md),
|
|
33
|
+
...sx == null ? void 0 : sx.md
|
|
31
34
|
},
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
lg: {
|
|
36
|
+
...createStyle(lg),
|
|
37
|
+
...sx == null ? void 0 : sx.lg
|
|
38
|
+
}
|
|
39
|
+
},
|
|
34
40
|
children
|
|
35
41
|
}
|
|
36
42
|
);
|
|
37
43
|
};
|
|
38
44
|
const createStyle = ({ size } = {}) => {
|
|
39
45
|
const { inputSize, inputPaddingX, textVariant, rounded } = getChipSizeState(size);
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
];
|
|
46
|
+
return {
|
|
47
|
+
paddingLeft: inputPaddingX,
|
|
48
|
+
paddingRight: inputPaddingX,
|
|
49
|
+
minHeight: inputSize,
|
|
50
|
+
fontSize: textVariant ? getTypographyVar(textVariant).fontSize : void 0,
|
|
51
|
+
lineHeight: textVariant ? getTypographyVar(textVariant).lineHeight : void 0,
|
|
52
|
+
borderRadius: rounded
|
|
53
|
+
};
|
|
50
54
|
};
|
|
51
55
|
export {
|
|
52
56
|
Chip
|
package/dist/lib/chip/types.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
|
-
import { ColorVariant,
|
|
2
|
+
import { ColorVariant, ShallowMerge, SizeVariant, ToResponsiveProps } from '../../types';
|
|
3
|
+
import { PrimitiveProps } from '../primitive';
|
|
3
4
|
export interface ChipResponsiveProps {
|
|
4
5
|
size?: SizeVariant;
|
|
5
6
|
}
|
|
6
|
-
type ChipExtendedProps =
|
|
7
|
+
type ChipExtendedProps = ToResponsiveProps<ChipResponsiveProps> & {
|
|
7
8
|
color?: ColorVariant;
|
|
8
|
-
}
|
|
9
|
-
export type ChipProps = ShallowMerge<JSX.IntrinsicElements['div'], ChipExtendedProps
|
|
9
|
+
};
|
|
10
|
+
export type ChipProps = PrimitiveProps<ShallowMerge<JSX.IntrinsicElements['div'], ChipExtendedProps>>;
|
|
10
11
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Container
|
|
2
2
|
|
|
3
|
-
Wrapper layout responsive giúp giới hạn chiều rộng nội dung theo breakpoint và tự động xử lý padding ngang. Component căn giữa nội dung trong viewport
|
|
3
|
+
Wrapper layout responsive giúp giới hạn chiều rộng nội dung theo breakpoint và tự động xử lý padding ngang. Component căn giữa nội dung trong viewport theo cấu hình layout nội bộ của design system.
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
@@ -12,13 +12,9 @@ import { Container } from '@janbox/storefront-ui';
|
|
|
12
12
|
|
|
13
13
|
| Prop | Type | Default | Description |
|
|
14
14
|
|------|------|---------|-------------|
|
|
15
|
-
| `
|
|
16
|
-
| `sm` | `{ position?: ContainerPosition }` | - | Responsive override tại breakpoint `sm` (min-width: 768px). Nhận giá trị `position` để thay đổi căn chỉnh ở màn hình tablet. |
|
|
17
|
-
| `md` | `{ position?: ContainerPosition }` | - | Responsive override tại breakpoint `md` (min-width: 1280px). Nhận giá trị `position` để thay đổi căn chỉnh ở màn hình desktop. |
|
|
18
|
-
| `lg` | `{ position?: ContainerPosition }` | - | Responsive override tại breakpoint `lg` (min-width: 1680px). Nhận giá trị `position` để thay đổi căn chỉnh ở màn hình large desktop. |
|
|
19
|
-
| `sx` | `ToResponsiveProps<StyledCSS>` | - | Escape hatch để truyền custom Emotion CSS vào wrapper div ngoài cùng. Hỗ trợ responsive keys (`sm`, `md`, `lg`). |
|
|
15
|
+
| `sx` | `ToResponsiveProps<StyledCSS>` | - | Custom Emotion CSS. Hỗ trợ responsive keys (`sm`, `md`, `lg`). **Không nên override** `width`, `max-width`, `margin-left`, `margin-right`, `padding-left`, `padding-right` — các thuộc tính này do Container quản lý nội bộ. |
|
|
20
16
|
| `children` | `React.ReactNode` | - | Nội dung render bên trong container. |
|
|
21
|
-
| `...rest` | `JSX.IntrinsicElements['div']` | - | Tất cả HTML div attributes tiêu chuẩn (`className`, `style`, `onClick`, v.v.)
|
|
17
|
+
| `...rest` | `JSX.IntrinsicElements['div']` | - | Tất cả HTML div attributes tiêu chuẩn (`className`, `style`, `onClick`, v.v.). |
|
|
22
18
|
|
|
23
19
|
## Examples
|
|
24
20
|
|
|
@@ -30,22 +26,15 @@ import { Container } from '@janbox/storefront-ui';
|
|
|
30
26
|
</Container>
|
|
31
27
|
```
|
|
32
28
|
|
|
33
|
-
###
|
|
29
|
+
### Custom style qua sx prop
|
|
34
30
|
|
|
35
31
|
```tsx
|
|
36
|
-
<Container
|
|
37
|
-
|
|
38
|
-
<HeroImage />
|
|
32
|
+
<Container sx={{ backgroundColor: '#f0f0f0', minHeight: 100 }}>
|
|
33
|
+
Page content with custom visual styles
|
|
39
34
|
</Container>
|
|
40
35
|
```
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```tsx
|
|
45
|
-
<Container position="center" md={{ position: 'start' }}>
|
|
46
|
-
<SidebarPanel />
|
|
47
|
-
</Container>
|
|
48
|
-
```
|
|
37
|
+
> Không dùng `sx` để override layout core của Container như `width`, `max-width`, `margin-left`, `margin-right`, `padding-left`, `padding-right`. Nếu cần layout khác, dùng wrapper component riêng thay vì thay đổi contract của Container.
|
|
49
38
|
|
|
50
39
|
## Dependencies
|
|
51
40
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ContainerProps } from './types';
|
|
2
|
-
export declare const Container: ({ children, ref, ..._props }: ContainerProps) => import("
|
|
2
|
+
export declare const Container: ({ children, ref, ..._props }: ContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,93 +1,9 @@
|
|
|
1
|
-
import { jsx } from "
|
|
2
|
-
import { isNil } from "lodash-es";
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import { getContainerProps } from "./helpers.js";
|
|
4
|
-
import {
|
|
5
|
-
import "../../theme/palette.js";
|
|
6
|
-
import { createSxInterpolation } from "../../utils/stylesheet.js";
|
|
7
|
-
const CONTAINER_PADDING_VAR_NAME = "--container-padding";
|
|
8
|
-
const CONTAINER_PADDING_VAR = `var(${CONTAINER_PADDING_VAR_NAME})`;
|
|
9
|
-
const getContainerPaddingCSS = (position) => {
|
|
10
|
-
return isNil(position) ? {} : {
|
|
11
|
-
paddingLeft: position === "start" ? 0 : CONTAINER_PADDING_VAR,
|
|
12
|
-
paddingRight: position === "end" ? 0 : CONTAINER_PADDING_VAR
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
const CONTAINER_CONTENT_PADDING_VAR_NAME = "--container-content-padding";
|
|
16
|
-
const CONTAINER_CONTENT_PADDING_VAR = `var(${CONTAINER_CONTENT_PADDING_VAR_NAME}, 0)`;
|
|
17
|
-
const getContainerContentPaddingCSS = (position) => {
|
|
18
|
-
return isNil(position) ? {} : {
|
|
19
|
-
paddingLeft: position === "start" ? 0 : CONTAINER_CONTENT_PADDING_VAR,
|
|
20
|
-
paddingRight: position === "end" ? 0 : CONTAINER_CONTENT_PADDING_VAR
|
|
21
|
-
};
|
|
22
|
-
};
|
|
3
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
23
4
|
const Container = ({ children, ref, ..._props }) => {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
width: "100%"
|
|
28
|
-
},
|
|
29
|
-
createSxInterpolation(sx)
|
|
30
|
-
];
|
|
31
|
-
return /* @__PURE__ */ jsx("div", { css, ...rest, ref, children: /* @__PURE__ */ jsx(
|
|
32
|
-
"div",
|
|
33
|
-
{
|
|
34
|
-
css: [
|
|
35
|
-
{
|
|
36
|
-
width: "100%",
|
|
37
|
-
[CONTAINER_PADDING_VAR_NAME]: "0px",
|
|
38
|
-
...getContainerPaddingCSS(position)
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
[mediaQuery("sm")]: {
|
|
42
|
-
width: "100%",
|
|
43
|
-
[CONTAINER_PADDING_VAR_NAME]: `calc((100% - ${breakpoint.sm.minWidth}px) / 2)`,
|
|
44
|
-
...getContainerPaddingCSS(sm == null ? void 0 : sm.position)
|
|
45
|
-
},
|
|
46
|
-
[mediaQuery("md")]: {
|
|
47
|
-
[CONTAINER_PADDING_VAR_NAME]: `calc((100% - ${breakpoint.md.minWidth}px) / 2)`,
|
|
48
|
-
...getContainerPaddingCSS(md == null ? void 0 : md.position)
|
|
49
|
-
},
|
|
50
|
-
[mediaQuery("lg")]: {
|
|
51
|
-
[CONTAINER_PADDING_VAR_NAME]: `calc((100% - ${breakpoint.lg.minWidth}px) / 2)`,
|
|
52
|
-
...getContainerPaddingCSS(lg == null ? void 0 : lg.position)
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
children: /* @__PURE__ */ jsx(
|
|
57
|
-
"div",
|
|
58
|
-
{
|
|
59
|
-
css: [
|
|
60
|
-
{
|
|
61
|
-
width: "100%",
|
|
62
|
-
[CONTAINER_CONTENT_PADDING_VAR_NAME]: `${breakpoint.xs.padding}px`,
|
|
63
|
-
...getContainerContentPaddingCSS(position)
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
[mediaQuery("sm")]: [
|
|
67
|
-
{
|
|
68
|
-
[CONTAINER_CONTENT_PADDING_VAR_NAME]: `${breakpoint.sm.padding}px`,
|
|
69
|
-
...getContainerContentPaddingCSS(sm == null ? void 0 : sm.position)
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
[mediaQuery("md")]: [
|
|
73
|
-
{
|
|
74
|
-
[CONTAINER_CONTENT_PADDING_VAR_NAME]: `${breakpoint.md.padding}px`,
|
|
75
|
-
...getContainerContentPaddingCSS(md == null ? void 0 : md.position)
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
[mediaQuery("lg")]: [
|
|
79
|
-
{
|
|
80
|
-
[CONTAINER_CONTENT_PADDING_VAR_NAME]: `${breakpoint.lg.padding}px`,
|
|
81
|
-
...getContainerContentPaddingCSS(lg == null ? void 0 : lg.position)
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
],
|
|
86
|
-
children
|
|
87
|
-
}
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
) });
|
|
5
|
+
const props = getContainerProps(_props);
|
|
6
|
+
return /* @__PURE__ */ jsx(Primitive, { ...props, ref, children });
|
|
91
7
|
};
|
|
92
8
|
export {
|
|
93
9
|
Container
|
|
@@ -1,6 +1,29 @@
|
|
|
1
|
+
import { breakpoint } from "../../theme/screens.js";
|
|
2
|
+
import "../../theme/palette.js";
|
|
1
3
|
import { mergeComponentProps } from "../../utils/index.js";
|
|
2
4
|
const defaultProps = {
|
|
3
|
-
|
|
5
|
+
sx: {
|
|
6
|
+
width: "100%",
|
|
7
|
+
marginLeft: "auto",
|
|
8
|
+
marginRight: "auto",
|
|
9
|
+
paddingLeft: breakpoint.xs.padding,
|
|
10
|
+
paddingRight: breakpoint.xs.padding,
|
|
11
|
+
sm: {
|
|
12
|
+
maxWidth: breakpoint.sm.minWidth,
|
|
13
|
+
paddingLeft: breakpoint.sm.padding,
|
|
14
|
+
paddingRight: breakpoint.sm.padding
|
|
15
|
+
},
|
|
16
|
+
md: {
|
|
17
|
+
maxWidth: breakpoint.md.minWidth,
|
|
18
|
+
paddingLeft: breakpoint.md.padding,
|
|
19
|
+
paddingRight: breakpoint.md.padding
|
|
20
|
+
},
|
|
21
|
+
lg: {
|
|
22
|
+
maxWidth: breakpoint.lg.minWidth,
|
|
23
|
+
paddingLeft: breakpoint.lg.padding,
|
|
24
|
+
paddingRight: breakpoint.lg.padding
|
|
25
|
+
}
|
|
26
|
+
}
|
|
4
27
|
};
|
|
5
28
|
const getContainerProps = (extended) => {
|
|
6
29
|
return mergeComponentProps(defaultProps, extended);
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export type
|
|
4
|
-
export type ContainerResponsiveProps = {
|
|
5
|
-
position?: ContainerPosition;
|
|
6
|
-
};
|
|
7
|
-
type ContainerExtendedProps = PropsWithSx<ToResponsiveProps<ContainerResponsiveProps>>;
|
|
8
|
-
export type ContainerProps = ShallowMerge<JSX.IntrinsicElements['div'], ContainerExtendedProps>;
|
|
9
|
-
export {};
|
|
2
|
+
import { PrimitiveProps } from '../primitive';
|
|
3
|
+
export type ContainerProps = PrimitiveProps<JSX.IntrinsicElements['div'], 'div'>;
|
|
@@ -88,7 +88,7 @@ const DatePicker = (_props, ref) => {
|
|
|
88
88
|
justifyContent: "center",
|
|
89
89
|
overflow: "hidden",
|
|
90
90
|
borderRadius: 12,
|
|
91
|
-
backgroundColor: getColorVar("white"),
|
|
91
|
+
backgroundColor: getColorVar("common.white"),
|
|
92
92
|
fontSize: "0.875rem",
|
|
93
93
|
lineHeight: "1.25rem",
|
|
94
94
|
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Flexbox
|
|
2
2
|
|
|
3
|
-
A layout component that renders a `div` with `display: flex` applied by default. It supports responsive `sx` prop overrides
|
|
3
|
+
A layout component that renders a `div` with `display: flex` applied by default. It supports responsive `sx` prop overrides.
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
@@ -12,7 +12,6 @@ import { Flexbox } from '@janbox/storefront-ui';
|
|
|
12
12
|
|
|
13
13
|
| Prop | Type | Default | Description |
|
|
14
14
|
|------|------|---------|-------------|
|
|
15
|
-
| `container` | `boolean` | undefined (false) | When true, applies the global `containerStyle` (responsive padding and max-width) on top of the flex display — useful for page-level section wrappers. |
|
|
16
15
|
| `sx` | `ToResponsiveProps<StyledCSS>` | { flexDirection: 'row', alignItems: 'flex-start', justifyContent: 'flex-start' } | Responsive style overrides via the Emotion-powered sx prop. Supports base styles plus `sm`, `md`, and `lg` breakpoint keys. Merged on top of the component defaults (`flexDirection: 'row'`, `alignItems: 'flex-start'`, `justifyContent: 'flex-start'`). |
|
|
17
16
|
| `children` | `React.ReactNode` | - | Child elements rendered inside the flex container — typically `FlexItem` components. |
|
|
18
17
|
| `ref` | `React.Ref<HTMLDivElement>` | - | Forwarded ref to the underlying `div` element. |
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FlexboxProps } from './types';
|
|
2
|
-
export declare const Flexbox: ({ children,
|
|
2
|
+
export declare const Flexbox: ({ children, ref, ..._props }: FlexboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getFlexboxProps } from "./helpers.js";
|
|
3
|
-
import { containerStyle } from "../../../constants/emotion.js";
|
|
4
3
|
import { Primitive } from "../../primitive/primitive.js";
|
|
5
|
-
const Flexbox = ({ children,
|
|
4
|
+
const Flexbox = ({ children, ref, ..._props }) => {
|
|
6
5
|
const { sx = {}, ...rest } = getFlexboxProps(_props);
|
|
7
6
|
return /* @__PURE__ */ jsx(
|
|
8
7
|
Primitive,
|
|
@@ -10,7 +9,6 @@ const Flexbox = ({ children, container, ref, ..._props }) => {
|
|
|
10
9
|
...rest,
|
|
11
10
|
sx: {
|
|
12
11
|
display: "flex",
|
|
13
|
-
...container ? containerStyle : {},
|
|
14
12
|
...sx,
|
|
15
13
|
sm: { ...sx.sm },
|
|
16
14
|
md: { ...sx.md },
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
container?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export type FlexboxProps = ShallowMerge<JSX.IntrinsicElements['div'], PropsWithSx<FlexboxExtendedProps>>;
|
|
7
|
-
export {};
|
|
2
|
+
import { PrimitiveProps } from '../../primitive';
|
|
3
|
+
export type FlexboxProps = PrimitiveProps<JSX.IntrinsicElements['div'], 'div'>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Cell
|
|
2
|
+
|
|
3
|
+
A CSS Grid child component that supports configurable column spans. It is intended to be used inside Grid.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Cell } from '@janbox/storefront-ui';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
|------|------|---------|-------------|
|
|
15
|
+
| `colSpan` | `number` | - | Number of grid columns the cell should span. Generates `grid-column: span colSpan`. Supports responsive variants via sm/md/lg. |
|
|
16
|
+
| `sm` | `CellResponsiveProps` | - | Responsive overrides applied at the sm breakpoint (≥768px). Accepts `{ colSpan?: number }`. |
|
|
17
|
+
| `md` | `CellResponsiveProps` | - | Responsive overrides applied at the md breakpoint (≥1280px). Accepts `{ colSpan?: number }`. |
|
|
18
|
+
| `lg` | `CellResponsiveProps` | - | Responsive overrides applied at the lg breakpoint (≥1680px). Accepts `{ colSpan?: number }`. |
|
|
19
|
+
| `sx` | `ToResponsiveProps<StyledCSS>` | - | Escape-hatch for inline Emotion styles. Supports responsive keys (sm, md, lg) alongside base styles. |
|
|
20
|
+
| `children` | `React.ReactNode` | - | Cell content. |
|
|
21
|
+
| `ref` | `React.Ref<HTMLDivElement>` | - | Forwarded ref to the underlying div element. |
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### Span two columns
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
<Grid cols={3}>
|
|
29
|
+
<Cell colSpan={2}>Span 2 columns</Cell>
|
|
30
|
+
<Cell>Cell 2</Cell>
|
|
31
|
+
<Cell>Cell 3</Cell>
|
|
32
|
+
</Grid>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Responsive spans
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<Grid cols={4}>
|
|
39
|
+
<Cell colSpan={4} sm={{ colSpan: 2 }} md={{ colSpan: 1 }}>
|
|
40
|
+
Responsive item
|
|
41
|
+
</Cell>
|
|
42
|
+
</Grid>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Custom styles
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
<Cell colSpan={2} sx={{ padding: 12, backgroundColor: 'var(--color-neutral-100)' }}>
|
|
49
|
+
Styled cell
|
|
50
|
+
</Cell>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Related Components
|
|
54
|
+
|
|
55
|
+
- [Grid](../grid/README.md)
|
|
56
|
+
- [Primitive](../../primitive/README.md)
|
|
57
|
+
|
|
58
|
+
## Dependencies
|
|
59
|
+
|
|
60
|
+
- lodash-es
|
|
61
|
+
|
|
62
|
+
## See Also
|
|
63
|
+
|
|
64
|
+
- [Component Source](./cell.tsx)
|
|
65
|
+
- [Storybook Stories](./cell.stories.tsx)
|
|
66
|
+
- [Main README](../../../README.md)
|
|
@@ -16,7 +16,6 @@ import { Grid } from '@janbox/storefront-ui';
|
|
|
16
16
|
| `sm` | `GridResponsiveProps` | - | Responsive overrides applied at the sm breakpoint (≥768px). Accepts `{ cols?: number }`. |
|
|
17
17
|
| `md` | `GridResponsiveProps` | - | Responsive overrides applied at the md breakpoint (≥1280px). Accepts `{ cols?: number }`. |
|
|
18
18
|
| `lg` | `GridResponsiveProps` | - | Responsive overrides applied at the lg breakpoint (≥1680px). Accepts `{ cols?: number }`. |
|
|
19
|
-
| `container` | `boolean` | false | When true, applies the shared responsive container styles (padding and max-width) from `containerStyle`. |
|
|
20
19
|
| `sx` | `ToResponsiveProps<StyledCSS>` | - | Escape-hatch for inline Emotion styles. Supports responsive keys (sm, md, lg) alongside base styles. |
|
|
21
20
|
| `children` | `React.ReactNode` | - | Grid children, typically Cell components. |
|
|
22
21
|
| `ref` | `React.Ref<HTMLDivElement>` | - | Forwarded ref to the underlying div element. |
|
|
@@ -48,7 +47,7 @@ import { Grid } from '@janbox/storefront-ui';
|
|
|
48
47
|
### Responsive columns (1 on mobile, 2 on tablet, 4 on desktop)
|
|
49
48
|
|
|
50
49
|
```tsx
|
|
51
|
-
<Grid cols={1} sm={{ cols: 2 }} md={{ cols: 4 }}
|
|
50
|
+
<Grid cols={1} sm={{ cols: 2 }} md={{ cols: 4 }}>
|
|
52
51
|
<Cell>Item 1</Cell>
|
|
53
52
|
<Cell>Item 2</Cell>
|
|
54
53
|
<Cell>Item 3</Cell>
|
|
@@ -58,8 +57,8 @@ import { Grid } from '@janbox/storefront-ui';
|
|
|
58
57
|
|
|
59
58
|
## Related Components
|
|
60
59
|
|
|
61
|
-
- [Cell](
|
|
62
|
-
- [Primitive](
|
|
60
|
+
- [Cell](../cell/README.md)
|
|
61
|
+
- [Primitive](../../primitive/README.md)
|
|
63
62
|
|
|
64
63
|
## Dependencies
|
|
65
64
|
|
|
@@ -67,6 +66,6 @@ import { Grid } from '@janbox/storefront-ui';
|
|
|
67
66
|
|
|
68
67
|
## See Also
|
|
69
68
|
|
|
70
|
-
- [Component Source](./
|
|
69
|
+
- [Component Source](./grid.tsx)
|
|
71
70
|
- [Storybook Stories](./grid.stories.tsx)
|
|
72
|
-
- [Main README](
|
|
71
|
+
- [Main README](../../../README.md)
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isNil } from "lodash-es";
|
|
3
3
|
import { getGridProps } from "./helpers.js";
|
|
4
|
-
import { containerStyle } from "../../../constants/emotion.js";
|
|
5
4
|
import { Primitive } from "../../primitive/primitive.js";
|
|
6
5
|
const GRID_MINIMUM_COLS = 1;
|
|
7
6
|
const GRID_MAXIMUM_COLS = 24;
|
|
8
7
|
const Grid = ({ children, ref, ..._props }) => {
|
|
9
|
-
const { cols, sm, md, lg,
|
|
8
|
+
const { cols, sm, md, lg, sx = {}, ...rest } = getGridProps(_props);
|
|
10
9
|
return /* @__PURE__ */ jsx(
|
|
11
10
|
Primitive,
|
|
12
11
|
{
|
|
13
12
|
sx: {
|
|
14
13
|
display: "grid",
|
|
15
|
-
...container ? containerStyle : {},
|
|
16
14
|
...createStyle({ cols }),
|
|
17
15
|
...sx,
|
|
18
16
|
sm: { ...createStyle(sm), ...sx.sm },
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ShallowMerge, ToResponsiveProps } from '../../../types';
|
|
3
|
+
import { PrimitiveProps } from '../../primitive';
|
|
3
4
|
export interface GridResponsiveProps {
|
|
4
5
|
cols?: number;
|
|
5
6
|
}
|
|
6
|
-
type GridExtendedProps =
|
|
7
|
-
|
|
8
|
-
}>;
|
|
9
|
-
export type GridProps = ShallowMerge<JSX.IntrinsicElements['div'], GridExtendedProps>;
|
|
7
|
+
type GridExtendedProps = ToResponsiveProps<GridResponsiveProps>;
|
|
8
|
+
export type GridProps = PrimitiveProps<ShallowMerge<JSX.IntrinsicElements['div'], GridExtendedProps>>;
|
|
10
9
|
export {};
|
|
@@ -15,7 +15,7 @@ const IconButton = ({ children, ref, ..._props }) => {
|
|
|
15
15
|
dark,
|
|
16
16
|
light,
|
|
17
17
|
main,
|
|
18
|
-
|
|
18
|
+
contrast,
|
|
19
19
|
placeholder: placeholderColor,
|
|
20
20
|
ariaDisabledSurface,
|
|
21
21
|
ariaDisabledText
|
|
@@ -42,7 +42,7 @@ const IconButton = ({ children, ref, ..._props }) => {
|
|
|
42
42
|
},
|
|
43
43
|
variant === "contained" && {
|
|
44
44
|
backgroundColor: isLoading ? placeholderColor : main,
|
|
45
|
-
color:
|
|
45
|
+
color: contrast,
|
|
46
46
|
":hover": {
|
|
47
47
|
backgroundColor: dark
|
|
48
48
|
},
|
package/dist/lib/stepper/step.js
CHANGED
|
@@ -6,32 +6,32 @@ import CheckIcon from "../../assets/svg/check.svg.js";
|
|
|
6
6
|
import { Icon } from "../icon/icon.js";
|
|
7
7
|
const stateStyles = {
|
|
8
8
|
done: {
|
|
9
|
-
text: { color: getColorVar("white") },
|
|
9
|
+
text: { color: getColorVar("common.white") },
|
|
10
10
|
bg: {
|
|
11
11
|
borderColor: getColorVar("primary.600"),
|
|
12
12
|
backgroundColor: getColorVar("primary.600"),
|
|
13
|
-
color: getColorVar("white")
|
|
13
|
+
color: getColorVar("common.white")
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
active: {
|
|
17
17
|
text: { color: getColorVar("primary.600") },
|
|
18
18
|
bg: {
|
|
19
19
|
borderColor: getColorVar("primary.600"),
|
|
20
|
-
backgroundColor: getColorVar("white"),
|
|
20
|
+
backgroundColor: getColorVar("common.white"),
|
|
21
21
|
color: getColorVar("primary.600")
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
normal: {
|
|
25
|
-
text: { color: getColorVar("white") },
|
|
25
|
+
text: { color: getColorVar("common.white") },
|
|
26
26
|
bg: {
|
|
27
27
|
borderColor: getColorVar("neutral.500"),
|
|
28
28
|
backgroundColor: getColorVar("neutral.500"),
|
|
29
|
-
color: getColorVar("white")
|
|
29
|
+
color: getColorVar("common.white")
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
const Step = forwardRef((props, ref) => {
|
|
34
|
-
const { state = "normal", content,
|
|
34
|
+
const { state = "normal", content, size = 32, children, ...rest } = props;
|
|
35
35
|
const styles = stateStyles[state] ?? stateStyles.normal;
|
|
36
36
|
const checked = state === "done";
|
|
37
37
|
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
@@ -124,7 +124,7 @@ const SwiperDotsPaging = ({
|
|
|
124
124
|
...inViewIndexes.includes(slideIndex) ? { visibility: "hidden" } : {},
|
|
125
125
|
borderWidth: 1,
|
|
126
126
|
borderColor: getColorVar(`${color}.600`),
|
|
127
|
-
backgroundColor: getColorVar("white")
|
|
127
|
+
backgroundColor: getColorVar("common.white")
|
|
128
128
|
},
|
|
129
129
|
onClick: onDotClick,
|
|
130
130
|
"data-index": slideIndex
|
|
@@ -217,7 +217,7 @@ const ArrowButton = ({
|
|
|
217
217
|
borderStyle: "solid",
|
|
218
218
|
borderColor: getColorVar(`${color}.600`),
|
|
219
219
|
borderRadius: 9999,
|
|
220
|
-
backgroundColor: getColorVar("white"),
|
|
220
|
+
backgroundColor: getColorVar("common.white"),
|
|
221
221
|
":disabled": {
|
|
222
222
|
opacity: visible ? 0.5 : 0
|
|
223
223
|
},
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TableProps } from './types';
|
|
2
|
-
export declare const Table: ({ children, sx, ...props }: TableProps) => import("
|
|
2
|
+
export declare const Table: ({ children, sx, ...props }: TableProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { jsx } from "
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import "lodash-es";
|
|
3
3
|
import { getColorVar } from "../../../theme/palette.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Primitive } from "../../primitive/primitive.js";
|
|
5
5
|
const Table = ({ children, sx, ...props }) => {
|
|
6
6
|
return /* @__PURE__ */ jsx(
|
|
7
|
-
|
|
7
|
+
Primitive,
|
|
8
8
|
{
|
|
9
|
-
|
|
9
|
+
...props,
|
|
10
|
+
sx: {
|
|
10
11
|
width: "100%",
|
|
11
12
|
borderTopLeftRadius: "0.5rem",
|
|
12
13
|
borderTopRightRadius: "0.5rem",
|
|
13
14
|
overflow: "hidden",
|
|
14
15
|
backgroundColor: getColorVar("surface.default"),
|
|
15
16
|
...sx
|
|
16
|
-
}
|
|
17
|
-
|
|
17
|
+
},
|
|
18
|
+
as: "table",
|
|
18
19
|
children
|
|
19
20
|
}
|
|
20
21
|
);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export type TableProps =
|
|
2
|
+
import { PrimitiveProps } from '../../primitive';
|
|
3
|
+
export type TableProps = PrimitiveProps<JSX.IntrinsicElements['table'], 'table'>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TableFooterProps } from './types';
|
|
2
|
-
export declare const TableFooter: ({
|
|
2
|
+
export declare const TableFooter: ({ children, ...props }: TableFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx } from "
|
|
2
|
-
import {
|
|
3
|
-
const TableFooter = ({
|
|
4
|
-
return /* @__PURE__ */ jsx(
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Primitive } from "../../primitive/primitive.js";
|
|
3
|
+
const TableFooter = ({ children, ...props }) => {
|
|
4
|
+
return /* @__PURE__ */ jsx(Primitive, { ...props, as: "tfoot", children });
|
|
5
5
|
};
|
|
6
6
|
export {
|
|
7
7
|
TableFooter
|