@janbox/storefront-ui 2.0.27 → 2.0.29
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/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.js +0 -2
- package/dist/index.js +2 -0
- package/dist/lib/box/box.js +5 -21
- package/dist/lib/button/button.js +69 -80
- package/dist/lib/flexbox/flexbox/flexbox.d.ts +1 -1
- package/dist/lib/flexbox/flexbox/flexbox.js +16 -20
- package/dist/lib/grid/grid/grid.d.ts +1 -1
- package/dist/lib/grid/grid/grid.js +20 -25
- package/dist/lib/icon-button/icon-button.js +5 -9
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/input/input.js +155 -101
- package/dist/lib/input-range/input-range.d.ts +1 -1
- package/dist/lib/input-range/input-range.js +119 -95
- package/dist/lib/input-range/types.d.ts +3 -2
- package/dist/lib/ripple-effect/index.d.ts +2 -0
- package/dist/lib/ripple-effect/ripple-effect.d.ts +3 -0
- package/dist/lib/ripple-effect/ripple-effect.js +75 -0
- package/dist/{hooks/use-ripple-effect/index.d.ts → lib/ripple-effect/types.d.ts} +1 -6
- package/dist/lib/table/table-row/table-row.d.ts +1 -1
- package/dist/lib/table/table-row/table-row.js +4 -4
- package/dist/lib/table/table-row/types.d.ts +2 -2
- package/dist/lib/unordered-list/list-item/list-item.d.ts +1 -1
- package/dist/lib/unordered-list/list-item/list-item.js +8 -10
- package/dist/lib/unordered-list/list-item/types.d.ts +2 -2
- package/dist/style.css +1 -96
- package/package.json +1 -1
- package/dist/hooks/use-ripple-effect/index.js +0 -69
- package/dist/hooks/use-ripple-effect/use-ripple-effect.module.scss.js +0 -11
- package/dist/lib/input/input.module.scss.js +0 -17
- package/dist/lib/input-range/input-range.module.scss.js +0 -8
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useWindowScreen } from "./use-window-screen/index.js";
|
|
2
|
-
import { useRippleEffect } from "./use-ripple-effect/index.js";
|
|
3
2
|
import { useControllableState } from "./use-controllable-state.js";
|
|
4
3
|
import { useCountdownTimer } from "./use-countdown-timer.js";
|
|
5
4
|
import { useQueryParams } from "./use-query-params.js";
|
|
@@ -14,7 +13,6 @@ export {
|
|
|
14
13
|
useFirstMountState,
|
|
15
14
|
useFormatter,
|
|
16
15
|
useQueryParams,
|
|
17
|
-
useRippleEffect,
|
|
18
16
|
useUpdateEffect,
|
|
19
17
|
useWindowScreen
|
|
20
18
|
};
|
package/dist/index.js
CHANGED
|
@@ -77,6 +77,7 @@ import { PriceLabel } from "./lib/price-label/price-label.js";
|
|
|
77
77
|
import { Primitive } from "./lib/primitive/primitive.js";
|
|
78
78
|
import { Progress } from "./lib/progress/progress.js";
|
|
79
79
|
import { RadioButton } from "./lib/radio-button/radio-button.js";
|
|
80
|
+
import { RippleEffect } from "./lib/ripple-effect/ripple-effect.js";
|
|
80
81
|
import { Select } from "./lib/select/select.js";
|
|
81
82
|
import { StarRating } from "./lib/star-rating/star-rating.js";
|
|
82
83
|
import { Step } from "./lib/stepper/step.js";
|
|
@@ -223,6 +224,7 @@ export {
|
|
|
223
224
|
Primitive,
|
|
224
225
|
Progress,
|
|
225
226
|
RadioButton,
|
|
227
|
+
RippleEffect,
|
|
226
228
|
Select,
|
|
227
229
|
StarRating,
|
|
228
230
|
Step,
|
package/dist/lib/box/box.js
CHANGED
|
@@ -10,32 +10,16 @@ const Box = ({ children, ref, ..._props }) => {
|
|
|
10
10
|
...rest,
|
|
11
11
|
sx: {
|
|
12
12
|
...container ? containerStyle : {},
|
|
13
|
-
...
|
|
14
|
-
sm:
|
|
15
|
-
md:
|
|
16
|
-
lg:
|
|
13
|
+
...sx,
|
|
14
|
+
sm: { ...sx.sm },
|
|
15
|
+
md: { ...sx.md },
|
|
16
|
+
lg: { ...sx.lg }
|
|
17
17
|
},
|
|
18
18
|
ref,
|
|
19
|
-
children
|
|
20
|
-
Primitive,
|
|
21
|
-
{
|
|
22
|
-
sx: {
|
|
23
|
-
width: "100%",
|
|
24
|
-
height: "100%"
|
|
25
|
-
},
|
|
26
|
-
children
|
|
27
|
-
}
|
|
28
|
-
)
|
|
19
|
+
children
|
|
29
20
|
}
|
|
30
21
|
);
|
|
31
22
|
};
|
|
32
|
-
const createStyle = ({ width, height, ...css } = {}) => {
|
|
33
|
-
return {
|
|
34
|
-
width,
|
|
35
|
-
height,
|
|
36
|
-
"& > *": css
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
23
|
export {
|
|
40
24
|
Box
|
|
41
25
|
};
|
|
@@ -4,19 +4,17 @@ import { useMergeRefs } from "@floating-ui/react";
|
|
|
4
4
|
import { isNil, isString } from "lodash-es";
|
|
5
5
|
import { useNavigate, createPath } from "react-router";
|
|
6
6
|
import { getButtonProps, getButtonCssBySize } from "./helpers.js";
|
|
7
|
-
import { useRippleEffect } from "../../hooks/use-ripple-effect/index.js";
|
|
8
7
|
import { truncateStyle, animateSpinStyle } from "../../constants/emotion.js";
|
|
9
8
|
import LoadingIcon from "../../assets/svg/loading-waiting.svg.js";
|
|
10
9
|
import { mediaQuery } from "../../theme/screens.js";
|
|
11
10
|
import { getColorVar } from "../../theme/palette.js";
|
|
12
11
|
import { getColorShadesByVariant, getSizeVariantState } from "../../utils/index.js";
|
|
13
12
|
import { createSxInterpolation } from "../../utils/stylesheet.js";
|
|
14
|
-
import {
|
|
13
|
+
import { RippleEffect } from "../ripple-effect/ripple-effect.js";
|
|
15
14
|
import { Icon } from "../icon/icon.js";
|
|
16
15
|
import { Primitive } from "../primitive/primitive.js";
|
|
17
16
|
const Button = ({ children, ref, ..._props }) => {
|
|
18
17
|
const buttonRef = useRef(null);
|
|
19
|
-
const { className } = useRippleEffect(buttonRef);
|
|
20
18
|
const mergedRef = useMergeRefs([ref, buttonRef]);
|
|
21
19
|
const {
|
|
22
20
|
color,
|
|
@@ -52,6 +50,7 @@ const Button = ({ children, ref, ..._props }) => {
|
|
|
52
50
|
maxWidth: "100%",
|
|
53
51
|
width: "fit-content",
|
|
54
52
|
position: "relative",
|
|
53
|
+
overflow: "hidden",
|
|
55
54
|
justifyContent: "center",
|
|
56
55
|
alignItems: "center",
|
|
57
56
|
whiteSpace: "nowrap",
|
|
@@ -142,83 +141,73 @@ const Button = ({ children, ref, ..._props }) => {
|
|
|
142
141
|
}
|
|
143
142
|
}
|
|
144
143
|
};
|
|
145
|
-
return /* @__PURE__ */ jsxs(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
alignItems: "center",
|
|
213
|
-
justifyContent: "center"
|
|
214
|
-
},
|
|
215
|
-
as: "span",
|
|
216
|
-
children: /* @__PURE__ */ jsx(Icon, { css: animateSpinStyle, source: LoadingIcon })
|
|
217
|
-
}
|
|
218
|
-
)
|
|
219
|
-
]
|
|
220
|
-
}
|
|
221
|
-
);
|
|
144
|
+
return /* @__PURE__ */ jsxs("button", { css, disabled, ...rest, onClick, ref: mergedRef, children: [
|
|
145
|
+
prefix,
|
|
146
|
+
!!startIcon && /* @__PURE__ */ jsx(
|
|
147
|
+
Icon,
|
|
148
|
+
{
|
|
149
|
+
size: getSizeVariantState(size).iconSize,
|
|
150
|
+
...startIcon,
|
|
151
|
+
sx: {
|
|
152
|
+
flexShrink: 0,
|
|
153
|
+
...startIcon.sx
|
|
154
|
+
},
|
|
155
|
+
sm: {
|
|
156
|
+
size: getSizeVariantState(sm == null ? void 0 : sm.size).iconSize,
|
|
157
|
+
...startIcon.sm
|
|
158
|
+
},
|
|
159
|
+
md: {
|
|
160
|
+
size: getSizeVariantState(md == null ? void 0 : md.size).iconSize,
|
|
161
|
+
...startIcon.md
|
|
162
|
+
},
|
|
163
|
+
lg: {
|
|
164
|
+
size: getSizeVariantState(lg == null ? void 0 : lg.size).iconSize,
|
|
165
|
+
...startIcon.lg
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
),
|
|
169
|
+
/* @__PURE__ */ jsx(Fragment, { children: isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML, css: truncateStyle, children }) }),
|
|
170
|
+
!!endIcon && /* @__PURE__ */ jsx(
|
|
171
|
+
Icon,
|
|
172
|
+
{
|
|
173
|
+
size: getSizeVariantState(size).iconSize,
|
|
174
|
+
...endIcon,
|
|
175
|
+
sx: {
|
|
176
|
+
flexShrink: 0,
|
|
177
|
+
...endIcon.sx
|
|
178
|
+
},
|
|
179
|
+
sm: {
|
|
180
|
+
size: getSizeVariantState(sm == null ? void 0 : sm.size).iconSize,
|
|
181
|
+
...endIcon.sm
|
|
182
|
+
},
|
|
183
|
+
md: {
|
|
184
|
+
size: getSizeVariantState(md == null ? void 0 : md.size).iconSize,
|
|
185
|
+
...endIcon.md
|
|
186
|
+
},
|
|
187
|
+
lg: {
|
|
188
|
+
size: getSizeVariantState(lg == null ? void 0 : lg.size).iconSize,
|
|
189
|
+
...endIcon.lg
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
suffix,
|
|
194
|
+
isLoading && /* @__PURE__ */ jsx(
|
|
195
|
+
Primitive,
|
|
196
|
+
{
|
|
197
|
+
"data-loading": true,
|
|
198
|
+
sx: {
|
|
199
|
+
position: "absolute",
|
|
200
|
+
inset: 0,
|
|
201
|
+
display: "flex",
|
|
202
|
+
alignItems: "center",
|
|
203
|
+
justifyContent: "center"
|
|
204
|
+
},
|
|
205
|
+
as: "span",
|
|
206
|
+
children: /* @__PURE__ */ jsx(Icon, { css: animateSpinStyle, source: LoadingIcon })
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
/* @__PURE__ */ jsx(RippleEffect, {})
|
|
210
|
+
] });
|
|
222
211
|
};
|
|
223
212
|
const createStyle = ({ size } = {}) => {
|
|
224
213
|
return [getButtonCssBySize(size)];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FlexboxProps } from './types';
|
|
2
|
-
export declare const Flexbox: ({ children, container, ref, ..._props }: FlexboxProps) => import("
|
|
2
|
+
export declare const Flexbox: ({ children, container, ref, ..._props }: FlexboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
import { jsx } from "
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getFlexboxProps } from "./helpers.js";
|
|
3
|
-
import { mediaQuery } from "../../../theme/screens.js";
|
|
4
|
-
import "../../../theme/palette.js";
|
|
5
3
|
import { containerStyle } from "../../../constants/emotion.js";
|
|
4
|
+
import { Primitive } from "../../primitive/primitive.js";
|
|
6
5
|
const Flexbox = ({ children, container, ref, ..._props }) => {
|
|
7
6
|
const { sx = {}, ...rest } = getFlexboxProps(_props);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
container && containerStyle,
|
|
11
|
-
createStyle(restSx),
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
Primitive,
|
|
12
9
|
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
...rest,
|
|
11
|
+
sx: {
|
|
12
|
+
display: "flex",
|
|
13
|
+
...container ? containerStyle : {},
|
|
14
|
+
...sx,
|
|
15
|
+
sm: { ...sx.sm },
|
|
16
|
+
md: { ...sx.md },
|
|
17
|
+
lg: { ...sx.lg }
|
|
18
|
+
},
|
|
19
|
+
ref,
|
|
20
|
+
children
|
|
16
21
|
}
|
|
17
|
-
|
|
18
|
-
return /* @__PURE__ */ jsx("div", { css, ...rest, ref, children: /* @__PURE__ */ jsx("div", { css: { display: "flex", width: "100%", height: "100%" }, children }) });
|
|
19
|
-
};
|
|
20
|
-
const createStyle = (sx = {}) => {
|
|
21
|
-
const { width, height, ...css } = sx;
|
|
22
|
-
return {
|
|
23
|
-
width,
|
|
24
|
-
height,
|
|
25
|
-
"& > *": css
|
|
26
|
-
};
|
|
22
|
+
);
|
|
27
23
|
};
|
|
28
24
|
export {
|
|
29
25
|
Flexbox
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { GridProps } from './types';
|
|
2
2
|
export declare const GRID_MINIMUM_COLS = 1;
|
|
3
3
|
export declare const GRID_MAXIMUM_COLS = 24;
|
|
4
|
-
export declare const Grid: ({ children, ref, ..._props }: GridProps) => import("
|
|
4
|
+
export declare const Grid: ({ children, ref, ..._props }: GridProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,38 +1,33 @@
|
|
|
1
|
-
import { jsx } from "
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isNil } from "lodash-es";
|
|
3
3
|
import { getGridProps } from "./helpers.js";
|
|
4
|
-
import { mediaQuery } from "../../../theme/screens.js";
|
|
5
|
-
import "../../../theme/palette.js";
|
|
6
4
|
import { containerStyle } from "../../../constants/emotion.js";
|
|
5
|
+
import { Primitive } from "../../primitive/primitive.js";
|
|
7
6
|
const GRID_MINIMUM_COLS = 1;
|
|
8
7
|
const GRID_MAXIMUM_COLS = 24;
|
|
9
8
|
const Grid = ({ children, ref, ..._props }) => {
|
|
10
9
|
const { cols, sm, md, lg, container, sx = {}, ...rest } = getGridProps(_props);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
container && containerStyle,
|
|
14
|
-
createStyle({ cols }, sxXs),
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
Primitive,
|
|
15
12
|
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
sx: {
|
|
14
|
+
display: "grid",
|
|
15
|
+
...container ? containerStyle : {},
|
|
16
|
+
...createStyle({ cols }),
|
|
17
|
+
...sx,
|
|
18
|
+
sm: { ...createStyle(sm), ...sx.sm },
|
|
19
|
+
md: { ...createStyle(md), ...sx.md },
|
|
20
|
+
lg: { ...createStyle(lg), ...sx.lg }
|
|
21
|
+
},
|
|
22
|
+
...rest,
|
|
23
|
+
ref,
|
|
24
|
+
children
|
|
19
25
|
}
|
|
20
|
-
|
|
21
|
-
return /* @__PURE__ */ jsx("div", { css, ...rest, ref, children: /* @__PURE__ */ jsx("div", { css: { display: "grid", width: "100%", height: "100%" }, children }) });
|
|
22
|
-
};
|
|
23
|
-
const createStyle = ({ cols } = {}, sx = {}) => {
|
|
24
|
-
const { width, height, ...css } = sx;
|
|
25
|
-
return [
|
|
26
|
-
{
|
|
27
|
-
width,
|
|
28
|
-
height,
|
|
29
|
-
"& > *": {
|
|
30
|
-
gridTemplateColumns: isNil(cols) ? void 0 : `repeat(${cols}, minmax(0, 1fr))`,
|
|
31
|
-
...css
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
];
|
|
26
|
+
);
|
|
35
27
|
};
|
|
28
|
+
const createStyle = ({ cols } = {}) => ({
|
|
29
|
+
gridTemplateColumns: isNil(cols) ? void 0 : `repeat(${cols}, minmax(0, 1fr))`
|
|
30
|
+
});
|
|
36
31
|
export {
|
|
37
32
|
GRID_MAXIMUM_COLS,
|
|
38
33
|
GRID_MINIMUM_COLS,
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { jsxs, jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { useRef } from "react";
|
|
3
|
-
import { useMergeRefs } from "@floating-ui/react";
|
|
4
2
|
import { getIconButtonProps } from "./helpers.js";
|
|
5
|
-
import { useRippleEffect } from "../../hooks/use-ripple-effect/index.js";
|
|
6
3
|
import { createSxInterpolation } from "../../utils/stylesheet.js";
|
|
7
4
|
import LoadingIcon from "../../assets/svg/loading-waiting.svg.js";
|
|
8
5
|
import { mediaQuery } from "../../theme/screens.js";
|
|
9
6
|
import { getColorVar } from "../../theme/palette.js";
|
|
10
7
|
import { getColorShadesByVariant, getSizeVariantState } from "../../utils/index.js";
|
|
11
8
|
import { animateSpinStyle } from "../../constants/emotion.js";
|
|
12
|
-
import clsx from "clsx";
|
|
13
9
|
import { ensureBoolean } from "../../utils/common.js";
|
|
14
10
|
import { Icon } from "../icon/icon.js";
|
|
11
|
+
import { RippleEffect } from "../ripple-effect/ripple-effect.js";
|
|
15
12
|
const IconButton = ({ children, ref, ..._props }) => {
|
|
16
13
|
const { size, color, variant, icon, isLoading, sx, sm, md, lg, ...rest } = getIconButtonProps(_props);
|
|
17
14
|
const {
|
|
@@ -23,15 +20,13 @@ const IconButton = ({ children, ref, ..._props }) => {
|
|
|
23
20
|
ariaDisabledSurface,
|
|
24
21
|
ariaDisabledText
|
|
25
22
|
} = getColorShadesByVariant(color);
|
|
26
|
-
const buttonRef = useRef(null);
|
|
27
|
-
const { className } = useRippleEffect(buttonRef);
|
|
28
|
-
const mergedRef = useMergeRefs([ref, buttonRef]);
|
|
29
23
|
const css = [
|
|
30
24
|
{
|
|
31
25
|
display: "flex",
|
|
32
26
|
width: "fit-content",
|
|
33
27
|
height: "fit-content",
|
|
34
28
|
position: "relative",
|
|
29
|
+
overflow: "hidden",
|
|
35
30
|
justifyContent: "center",
|
|
36
31
|
alignItems: "center",
|
|
37
32
|
pointerEvents: ensureBoolean(rest["aria-disabled"]) ? "none" : void 0,
|
|
@@ -102,7 +97,7 @@ const IconButton = ({ children, ref, ..._props }) => {
|
|
|
102
97
|
var _a;
|
|
103
98
|
(_a = rest.onClick) == null ? void 0 : _a.call(rest, e);
|
|
104
99
|
};
|
|
105
|
-
return /* @__PURE__ */ jsxs("button", { css, ...rest,
|
|
100
|
+
return /* @__PURE__ */ jsxs("button", { css, ...rest, onClick, ref, children: [
|
|
106
101
|
!!icon && /* @__PURE__ */ jsx(
|
|
107
102
|
Icon,
|
|
108
103
|
{
|
|
@@ -130,7 +125,8 @@ const IconButton = ({ children, ref, ..._props }) => {
|
|
|
130
125
|
css: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center" },
|
|
131
126
|
children: /* @__PURE__ */ jsx(Icon, { css: animateSpinStyle, source: LoadingIcon })
|
|
132
127
|
}
|
|
133
|
-
)
|
|
128
|
+
),
|
|
129
|
+
/* @__PURE__ */ jsx(RippleEffect, {})
|
|
134
130
|
] });
|
|
135
131
|
};
|
|
136
132
|
const createStyle = ({ size } = {}) => {
|
package/dist/lib/index.d.ts
CHANGED