@janbox/storefront-ui 3.0.0 → 3.0.2
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 +72 -37
- package/dist/components/svg-loader.d.ts +4 -3
- package/dist/components/svg-loader.js +12 -7
- package/dist/constants/emotion.d.ts +0 -2
- package/dist/constants/emotion.js +0 -24
- package/dist/index.js +2 -0
- package/dist/lib/accordion/accordion-content/accordion-content.d.ts +1 -1
- package/dist/lib/accordion/accordion-content/accordion-content.js +24 -13
- 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/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/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/filter-panel/checkbox-filter-panel.js +3 -2
- package/dist/lib/filter-panel/price-range-filter-panel.d.ts +1 -1
- package/dist/lib/filter-panel/price-range-filter-panel.js +4 -3
- package/dist/lib/filter-panel/radio-filter-panel.js +2 -1
- package/dist/lib/flexbox/README.md +1 -2
- package/dist/lib/flexbox/flex-item/flex-item.d.ts +1 -1
- package/dist/lib/flexbox/flex-item/flex-item.js +13 -8
- package/dist/lib/flexbox/flex-item/types.d.ts +2 -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/icon.d.ts +1 -1
- package/dist/lib/icon/icon.js +23 -21
- package/dist/lib/icon-button/icon-button.js +5 -3
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/lightbox/lightbox.js +2 -1
- package/dist/lib/pagination/pagination.js +1 -1
- package/dist/lib/popover/popover-content/popover-content.d.ts +1 -1
- package/dist/lib/popover/popover-content/popover-content.js +6 -5
- package/dist/lib/primitive/primitive.js +3 -4
- package/dist/lib/select/select.js +4 -4
- package/dist/lib/stepper/stepper.js +2 -1
- package/dist/lib/stylesheet/index.d.ts +2 -0
- package/dist/lib/stylesheet/stylesheet.d.ts +2 -0
- package/dist/lib/stylesheet/stylesheet.js +23 -0
- package/dist/lib/stylesheet/types.d.ts +9 -0
- 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-body/table-body.d.ts +1 -1
- package/dist/lib/table/table-body/table-body.js +21 -22
- package/dist/lib/table/table-body/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/lib/table/table-head/table-head.d.ts +1 -1
- package/dist/lib/table/table-head/table-head.js +19 -20
- package/dist/lib/table/table-head/types.d.ts +2 -2
- package/dist/lib/tabs/tab-indicator/tab-indicator.d.ts +1 -1
- package/dist/lib/tabs/tab-indicator/tab-indicator.js +12 -14
- package/dist/lib/tabs/tabs/tabs.js +2 -3
- package/dist/lib/time-picker/time-picker.js +15 -11
- package/dist/lib/video/video.d.ts +1 -1
- package/dist/lib/video/video.js +3 -3
- package/package.json +1 -1
|
@@ -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'>;
|
|
@@ -7,6 +7,7 @@ import "../../theme/palette.js";
|
|
|
7
7
|
import { matchSearch } from "../../utils/common.js";
|
|
8
8
|
import { ArrayParamParser } from "../../utils/query-params.js";
|
|
9
9
|
import { Checkbox } from "../checkbox/checkbox.js";
|
|
10
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
10
11
|
import { Input } from "../input/input.js";
|
|
11
12
|
const ROW_HEIGHT = 32;
|
|
12
13
|
const DISPLAY_ROW_COUNT = 5;
|
|
@@ -65,7 +66,7 @@ const CheckboxFilterPanel = ({
|
|
|
65
66
|
}
|
|
66
67
|
onChange == null ? void 0 : onChange(e);
|
|
67
68
|
};
|
|
68
|
-
return /* @__PURE__ */ jsx(
|
|
69
|
+
return /* @__PURE__ */ jsx(Primitive, { sx: { paddingTop: 4, paddingBottom: 4 }, children: /* @__PURE__ */ jsx(
|
|
69
70
|
Checkbox,
|
|
70
71
|
{
|
|
71
72
|
containerProps: {
|
|
@@ -82,7 +83,7 @@ const CheckboxFilterPanel = ({
|
|
|
82
83
|
) });
|
|
83
84
|
};
|
|
84
85
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
85
|
-
searchEnabled && /* @__PURE__ */ jsx(
|
|
86
|
+
searchEnabled && /* @__PURE__ */ jsx(Primitive, { sx: { marginBottom: 8 }, children: /* @__PURE__ */ jsx(Input, { value: inputValue, ...inputSearchProps, onChange: onSearchChange }) }),
|
|
86
87
|
/* @__PURE__ */ jsx(
|
|
87
88
|
VirtualizedList,
|
|
88
89
|
{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { InputRangeFilterPanelProps } from './types';
|
|
2
|
-
export declare const PriceRangeFilterPanel: ({ value, queryParam, placeholder, priceTypes, onPriceChange, onPriceTypeChange, }: InputRangeFilterPanelProps) => import("
|
|
2
|
+
export declare const PriceRangeFilterPanel: ({ value, queryParam, placeholder, priceTypes, onPriceChange, onPriceTypeChange, }: InputRangeFilterPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs, jsx } from "
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { TYPING_DEBOUNCE } from "../../constants/index.js";
|
|
3
3
|
import { useQueryParams } from "../../hooks/use-query-params.js";
|
|
4
4
|
import { useId } from "react";
|
|
@@ -7,6 +7,7 @@ import "../../theme/palette.js";
|
|
|
7
7
|
import { StringParamParser, NumberParamParser } from "../../utils/query-params.js";
|
|
8
8
|
import { RadioButton } from "../radio-button/radio-button.js";
|
|
9
9
|
import { InputRange } from "../input-range/input-range.js";
|
|
10
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
10
11
|
const PriceRangeFilterPanel = ({
|
|
11
12
|
value,
|
|
12
13
|
queryParam,
|
|
@@ -86,8 +87,8 @@ const PriceRangeFilterPanel = ({
|
|
|
86
87
|
}
|
|
87
88
|
onPriceTypeChange == null ? void 0 : onPriceTypeChange(event);
|
|
88
89
|
};
|
|
89
|
-
return /* @__PURE__ */ jsxs(
|
|
90
|
-
/* @__PURE__ */ jsx(
|
|
90
|
+
return /* @__PURE__ */ jsxs(Primitive, { sx: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
91
|
+
/* @__PURE__ */ jsx(Primitive, { sx: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }, children: priceTypes.map((priceType) => {
|
|
91
92
|
var _a2;
|
|
92
93
|
return /* @__PURE__ */ jsx(
|
|
93
94
|
RadioButton,
|
|
@@ -6,6 +6,7 @@ import { useQueryParams } from "../../hooks/use-query-params.js";
|
|
|
6
6
|
import "../../theme/palette.js";
|
|
7
7
|
import { matchSearch } from "../../utils/common.js";
|
|
8
8
|
import { StringParamParser } from "../../utils/query-params.js";
|
|
9
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
9
10
|
import { Input } from "../input/input.js";
|
|
10
11
|
import { RadioButton } from "../radio-button/radio-button.js";
|
|
11
12
|
const ROW_HEIGHT = 32;
|
|
@@ -72,7 +73,7 @@ const RadioFilterPanel = ({
|
|
|
72
73
|
) });
|
|
73
74
|
};
|
|
74
75
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
75
|
-
searchEnabled && /* @__PURE__ */ jsx(
|
|
76
|
+
searchEnabled && /* @__PURE__ */ jsx(Primitive, { sx: { marginBottom: "0.5rem" }, children: /* @__PURE__ */ jsx(Input, { value: inputValue, ...inputSearchProps, onChange: onInputChange }) }),
|
|
76
77
|
/* @__PURE__ */ jsx(
|
|
77
78
|
VirtualizedList,
|
|
78
79
|
{
|
|
@@ -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 { FlexItemProps } from './types';
|
|
2
|
-
export declare const FlexItem: ({ children, ref, ...rest }: FlexItemProps) => import("
|
|
2
|
+
export declare const FlexItem: ({ children, ref, ...rest }: FlexItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import { jsx } from "
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getFlexItemProps } from "./helpers.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Primitive } from "../../primitive/primitive.js";
|
|
4
4
|
const FlexItem = ({ children, ref, ...rest }) => {
|
|
5
5
|
const { sx, ...props } = getFlexItemProps(rest);
|
|
6
|
-
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
Primitive,
|
|
7
8
|
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
sx: {
|
|
10
|
+
maxWidth: "100%",
|
|
11
|
+
...sx
|
|
12
|
+
},
|
|
13
|
+
...props,
|
|
14
|
+
ref,
|
|
15
|
+
children
|
|
16
|
+
}
|
|
17
|
+
);
|
|
13
18
|
};
|
|
14
19
|
export {
|
|
15
20
|
FlexItem
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export type FlexItemProps =
|
|
2
|
+
import { PrimitiveProps } from '../../primitive';
|
|
3
|
+
export type FlexItemProps = PrimitiveProps<JSX.IntrinsicElements['div'], 'div'>;
|
|
@@ -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 {};
|
package/dist/lib/icon/icon.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IconProps } from './types';
|
|
2
|
-
export declare const Icon: ({ children: _children, ref, ..._props }: IconProps) => import("
|
|
2
|
+
export declare const Icon: ({ children: _children, ref, ..._props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/lib/icon/icon.js
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
import { jsx } from "
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getIconProps } from "./helpers.js";
|
|
3
3
|
import { SvgLoader } from "../../components/svg-loader.js";
|
|
4
|
-
import { mediaQuery } from "../../theme/screens.js";
|
|
5
|
-
import "../../theme/palette.js";
|
|
6
|
-
import { createSxInterpolation } from "../../utils/stylesheet.js";
|
|
7
4
|
const Icon = ({ children: _children, ref, ..._props }) => {
|
|
8
|
-
|
|
5
|
+
var _a, _b, _c;
|
|
6
|
+
const { size, md, sm, lg, ...props } = getIconProps(_props);
|
|
9
7
|
return /* @__PURE__ */ jsx(
|
|
10
8
|
SvgLoader,
|
|
11
9
|
{
|
|
12
|
-
source,
|
|
13
10
|
...props,
|
|
14
|
-
css: [
|
|
15
|
-
createStyle({ size }),
|
|
16
|
-
{
|
|
17
|
-
[mediaQuery("sm")]: createStyle(sm),
|
|
18
|
-
[mediaQuery("md")]: createStyle(md),
|
|
19
|
-
[mediaQuery("lg")]: createStyle(lg)
|
|
20
|
-
},
|
|
21
|
-
createSxInterpolation(sx)
|
|
22
|
-
],
|
|
23
11
|
width: void 0,
|
|
24
12
|
height: void 0,
|
|
13
|
+
sx: {
|
|
14
|
+
...createStyle({ size }),
|
|
15
|
+
...props.sx,
|
|
16
|
+
sm: {
|
|
17
|
+
...createStyle(sm),
|
|
18
|
+
...(_a = props.sx) == null ? void 0 : _a.sm
|
|
19
|
+
},
|
|
20
|
+
md: {
|
|
21
|
+
...createStyle(md),
|
|
22
|
+
...(_b = props.sx) == null ? void 0 : _b.md
|
|
23
|
+
},
|
|
24
|
+
lg: {
|
|
25
|
+
...createStyle(lg),
|
|
26
|
+
...(_c = props.sx) == null ? void 0 : _c.lg
|
|
27
|
+
}
|
|
28
|
+
},
|
|
25
29
|
ref
|
|
26
30
|
}
|
|
27
31
|
);
|
|
28
32
|
};
|
|
29
33
|
const createStyle = ({ size } = {}) => {
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
];
|
|
34
|
+
return {
|
|
35
|
+
width: size,
|
|
36
|
+
height: size
|
|
37
|
+
};
|
|
36
38
|
};
|
|
37
39
|
export {
|
|
38
40
|
Icon
|
|
@@ -8,6 +8,7 @@ import { getColorShadesByVariant, getSizeVariantState } from "../../utils/index.
|
|
|
8
8
|
import { animateSpinStyle } from "../../constants/emotion.js";
|
|
9
9
|
import { ensureBoolean } from "../../utils/common.js";
|
|
10
10
|
import { Icon } from "../icon/icon.js";
|
|
11
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
11
12
|
import { RippleEffect } from "../ripple-effect/ripple-effect.js";
|
|
12
13
|
const IconButton = ({ children, ref, ..._props }) => {
|
|
13
14
|
const { size, color, variant, icon, isLoading, sx, sm, md, lg, ...rest } = getIconButtonProps(_props);
|
|
@@ -119,11 +120,12 @@ const IconButton = ({ children, ref, ..._props }) => {
|
|
|
119
120
|
),
|
|
120
121
|
children,
|
|
121
122
|
isLoading && /* @__PURE__ */ jsx(
|
|
122
|
-
|
|
123
|
+
Primitive,
|
|
123
124
|
{
|
|
124
125
|
"data-loading": true,
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
sx: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center" },
|
|
127
|
+
as: "span",
|
|
128
|
+
children: /* @__PURE__ */ jsx(Icon, { sx: animateSpinStyle, source: LoadingIcon })
|
|
127
129
|
}
|
|
128
130
|
),
|
|
129
131
|
/* @__PURE__ */ jsx(RippleEffect, {})
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { Swiper } from "../swiper/swiper/swiper.js";
|
|
|
14
14
|
import { SwiperSlide } from "../swiper/swiper-slide/swiper-slide.js";
|
|
15
15
|
import { Floating } from "../floating/floating/floating.js";
|
|
16
16
|
import { FloatingContent } from "../floating/floating-content/floating-content.js";
|
|
17
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
17
18
|
import { Image } from "../image/image.js";
|
|
18
19
|
import { mediaQuery } from "../../theme/screens.js";
|
|
19
20
|
import { FloatingClose } from "../floating/floating-close/floating-close.js";
|
|
@@ -57,7 +58,7 @@ const LightboxContent = ({ slides, defaultActiveIndex = 0 }) => {
|
|
|
57
58
|
mainApi == null ? void 0 : mainApi.off("select", onSelect);
|
|
58
59
|
};
|
|
59
60
|
}, [mainApi]);
|
|
60
|
-
return /* @__PURE__ */ jsx(
|
|
61
|
+
return /* @__PURE__ */ jsx(Primitive, { sx: { width: "100%", height: "100%", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsx(
|
|
61
62
|
"div",
|
|
62
63
|
{
|
|
63
64
|
css: {
|
|
@@ -94,7 +94,7 @@ const Pagination = ({ ref, ..._props }) => {
|
|
|
94
94
|
);
|
|
95
95
|
};
|
|
96
96
|
return /* @__PURE__ */ jsxs("div", { css, ...rest, ref, children: [
|
|
97
|
-
showFirstPageButton && /* @__PURE__ */ jsx(PaginationButton, { "aria-disabled": page <= 1, color: (_a = states == null ? void 0 : states.normal) == null ? void 0 : _a.color, onClick: handleFirstClick, children: /* @__PURE__ */ jsx(PaginationIcon, {
|
|
97
|
+
showFirstPageButton && /* @__PURE__ */ jsx(PaginationButton, { "aria-disabled": page <= 1, color: (_a = states == null ? void 0 : states.normal) == null ? void 0 : _a.color, onClick: handleFirstClick, children: /* @__PURE__ */ jsx(PaginationIcon, { sx: { transform: "rotate(180deg)" }, source: ArrowForwardIcon }) }),
|
|
98
98
|
showPrevPageButton && /* @__PURE__ */ jsx(PaginationButton, { "aria-disabled": page <= 1, color: (_b = states == null ? void 0 : states.normal) == null ? void 0 : _b.color, onClick: handlePrevClick, children: /* @__PURE__ */ jsx(PaginationIcon, { source: ArrowLeftIcon }) }),
|
|
99
99
|
pageRange.map((pageItem, index) => {
|
|
100
100
|
var _a2, _b2, _c2, _d2, _e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PopoverContentProps } from './types';
|
|
2
|
-
export declare const PopoverContent: (props: PopoverContentProps) => import("
|
|
2
|
+
export declare const PopoverContent: (props: PopoverContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
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
4
|
import { FloatingContent } from "../../floating/floating-content/floating-content.js";
|
|
@@ -6,16 +6,17 @@ const PopoverContent = (props) => {
|
|
|
6
6
|
return /* @__PURE__ */ jsx(
|
|
7
7
|
FloatingContent,
|
|
8
8
|
{
|
|
9
|
-
|
|
9
|
+
...props,
|
|
10
|
+
sx: {
|
|
10
11
|
backgroundColor: getColorVar("surface.default"),
|
|
11
12
|
padding: "0.75rem",
|
|
12
13
|
borderRadius: "0.75rem",
|
|
13
14
|
borderWidth: "1px",
|
|
14
15
|
borderStyle: "solid",
|
|
15
16
|
borderColor: getColorVar("neutral.100"),
|
|
16
|
-
boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)"
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",
|
|
18
|
+
...props.sx
|
|
19
|
+
}
|
|
19
20
|
}
|
|
20
21
|
);
|
|
21
22
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createElement } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { createSxInterpolation } from "../../utils/stylesheet.js";
|
|
3
|
+
import { Stylesheet } from "../stylesheet/stylesheet.js";
|
|
5
4
|
const Primitive = ({ as = "div", sx, ...rest }) => {
|
|
6
|
-
return /* @__PURE__ */ jsx(
|
|
5
|
+
return /* @__PURE__ */ jsx(Stylesheet, { children: ({ css, cx }) => {
|
|
7
6
|
return createElement(as, {
|
|
8
7
|
...rest,
|
|
9
|
-
className: cx(css(
|
|
8
|
+
className: cx(css(sx), rest.className)
|
|
10
9
|
});
|
|
11
10
|
} });
|
|
12
11
|
};
|