@janbox/storefront-ui 4.0.6 → 4.0.8
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/components/scroll-view.d.ts +3 -2
- package/dist/components/scroll-view.js +5 -3
- package/dist/components/virtualized-list.d.ts +3 -3
- package/dist/lib/accordion/accordion-content/accordion-content.js +1 -1
- package/dist/lib/button/button.js +2 -2
- package/dist/lib/cascader/cascader-floating-content.d.ts +1 -1
- package/dist/lib/cascader/cascader-floating-content.js +52 -73
- package/dist/lib/cascader/cascader.d.ts +1 -1
- package/dist/lib/cascader/cascader.js +10 -12
- package/dist/lib/collapse/collapse.d.ts +1 -1
- package/dist/lib/collapse/collapse.js +12 -4
- package/dist/lib/collapse/types.d.ts +3 -3
- package/dist/lib/count-up/README.md +22 -0
- package/dist/lib/count-up/count-up.d.ts +1 -1
- package/dist/lib/count-up/count-up.js +22 -5
- package/dist/lib/count-up/types.d.ts +9 -3
- package/dist/lib/date-picker/date-picker.js +25 -10
- package/dist/lib/dialog/dialog/dialog.d.ts +1 -1
- package/dist/lib/dialog/dialog/dialog.js +25 -28
- package/dist/lib/dialog/dialog-body/dialog-body.d.ts +1 -1
- package/dist/lib/dialog/dialog-body/dialog-body.js +10 -11
- package/dist/lib/dialog/dialog-body/types.d.ts +2 -3
- package/dist/lib/dialog/dialog-close/dialog-close.d.ts +1 -1
- package/dist/lib/dialog/dialog-footer/dialog-footer.js +2 -3
- package/dist/lib/dialog/dialog-header/dialog-header.d.ts +1 -1
- package/dist/lib/dialog/dialog-header/dialog-header.js +24 -27
- package/dist/lib/drawer/drawer/drawer.d.ts +1 -1
- package/dist/lib/drawer/drawer/drawer.js +39 -26
- package/dist/lib/drawer/drawer-close/drawer-close.d.ts +1 -1
- package/dist/lib/filter-panel/checkbox-filter-panel.d.ts +1 -1
- package/dist/lib/filter-panel/checkbox-filter-panel.js +2 -2
- package/dist/lib/filter-panel/filter-panel.d.ts +1 -1
- package/dist/lib/filter-panel/filter-panel.js +30 -15
- package/dist/lib/filter-panel/radio-filter-panel.d.ts +1 -1
- package/dist/lib/filter-panel/radio-filter-panel.js +3 -3
- package/dist/lib/floating/floating-close/floating-close.d.ts +1 -1
- package/dist/lib/floating/floating-close/floating-close.js +3 -2
- package/dist/lib/floating/floating-content/floating-content.d.ts +1 -1
- package/dist/lib/floating/floating-content/floating-content.js +8 -6
- package/dist/lib/form-label/form-label.d.ts +4 -3
- package/dist/lib/form-label/form-label.js +10 -8
- package/dist/lib/highlight-words/highlight-words.d.ts +1 -1
- package/dist/lib/highlight-words/highlight-words.js +3 -2
- package/dist/lib/input/input.js +1 -3
- package/dist/lib/lightbox/lightbox.d.ts +1 -1
- package/dist/lib/lightbox/lightbox.js +44 -32
- package/dist/lib/linear-progress/linear-progress.d.ts +1 -1
- package/dist/lib/linear-progress/linear-progress.js +50 -51
- package/dist/lib/loading/image-skeleton/image-skeleton.d.ts +1 -1
- package/dist/lib/loading/image-skeleton/image-skeleton.js +9 -4
- package/dist/lib/loading/loading-overlay/loading-overlay.d.ts +1 -1
- package/dist/lib/loading/loading-overlay/loading-overlay.js +2 -2
- package/dist/lib/menu/menu-item/menu-item.d.ts +1 -1
- package/dist/lib/menu/menu-item/menu-item.js +2 -2
- package/dist/lib/multiple-select/multiple-select.d.ts +1 -1
- package/dist/lib/multiple-select/multiple-select.js +38 -39
- package/dist/lib/notifications/notifications.d.ts +1 -1
- package/dist/lib/notifications/notifications.js +7 -7
- package/dist/lib/otp-input/otp-input.d.ts +1 -1
- package/dist/lib/otp-input/otp-input.js +43 -30
- package/dist/lib/pagination/pagination.d.ts +1 -1
- package/dist/lib/pagination/pagination.js +60 -54
- package/dist/lib/phone-input/phone-input.js +12 -11
- package/dist/lib/popover/popover-close/popover-close.d.ts +1 -1
- package/dist/lib/progress/progress.d.ts +1 -1
- package/dist/lib/progress/progress.js +26 -29
- package/dist/lib/progress/types.d.ts +5 -4
- package/dist/lib/select/select.js +15 -11
- package/dist/lib/star-rating/README.md +11 -3
- package/dist/lib/star-rating/star-rating.d.ts +1 -1
- package/dist/lib/star-rating/star-rating.js +40 -28
- package/dist/lib/star-rating/types.d.ts +3 -4
- package/dist/lib/stepper/step.js +8 -6
- package/dist/lib/stepper/stepper.d.ts +1 -1
- package/dist/lib/stepper/stepper.js +10 -9
- package/dist/lib/stepper/types.d.ts +2 -1
- package/dist/lib/swiper/swiper/swiper.js +3 -3
- package/dist/lib/swiper/swiper-dots-paging/swiper-dots-paging.d.ts +1 -1
- package/dist/lib/swiper/swiper-dots-paging/swiper-dots-paging.js +8 -7
- package/dist/lib/tabs/tab-indicator/tab-indicator.js +1 -1
- package/dist/lib/tabs/tabs/tabs.d.ts +1 -1
- package/dist/lib/tabs/tabs/tabs.js +1 -1
- package/dist/lib/time-picker/time-picker.js +16 -22
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx } from "
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useEffect } from "react";
|
|
3
3
|
import { times } from "lodash-es";
|
|
4
4
|
import { useControllableState } from "../../hooks/use-controllable-state.js";
|
|
5
|
-
import { mediaQuery } from "../../theme/screens.js";
|
|
6
5
|
import "../../theme/palette.js";
|
|
7
6
|
import { getTypographyVar } from "../../theme/typography.js";
|
|
7
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
8
8
|
import { Input } from "../input/input.js";
|
|
9
9
|
const OtpInput = ({
|
|
10
10
|
length = 6,
|
|
@@ -102,37 +102,50 @@ const OtpInput = ({
|
|
|
102
102
|
const onFocus = (e) => {
|
|
103
103
|
e.target.select();
|
|
104
104
|
};
|
|
105
|
-
return /* @__PURE__ */ jsx(
|
|
106
|
-
|
|
105
|
+
return /* @__PURE__ */ jsx(
|
|
106
|
+
Primitive,
|
|
107
107
|
{
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
"data-index": index,
|
|
116
|
-
value: digit,
|
|
117
|
-
onChange: handleChange,
|
|
118
|
-
onFocus,
|
|
119
|
-
onKeyDown: handleKeyDown,
|
|
120
|
-
onPaste: index === 0 ? handlePaste : void 0,
|
|
121
|
-
disabled,
|
|
122
|
-
readOnly: isLoading,
|
|
123
|
-
css: {
|
|
124
|
-
textAlign: "center",
|
|
125
|
-
fontWeight: 500,
|
|
126
|
-
fontSize: getTypographyVar("lg").fontSize,
|
|
127
|
-
lineHeight: getTypographyVar("lg").lineHeight
|
|
108
|
+
sx: {
|
|
109
|
+
display: "flex",
|
|
110
|
+
width: "100%",
|
|
111
|
+
gap: 8,
|
|
112
|
+
sm: {
|
|
113
|
+
gap: 12
|
|
114
|
+
}
|
|
128
115
|
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
116
|
+
children: otp.map((digit, index) => /* @__PURE__ */ jsx(Primitive, { sx: { flex: "1 1 0%", position: "relative" }, children: /* @__PURE__ */ jsx(
|
|
117
|
+
Input,
|
|
118
|
+
{
|
|
119
|
+
ref: (el) => {
|
|
120
|
+
inputRefs.current[index] = el;
|
|
121
|
+
},
|
|
122
|
+
type: "text",
|
|
123
|
+
inputMode: "numeric",
|
|
124
|
+
pattern: "\\d*",
|
|
125
|
+
maxLength: 1,
|
|
126
|
+
"data-index": index,
|
|
127
|
+
value: digit,
|
|
128
|
+
onChange: handleChange,
|
|
129
|
+
onFocus,
|
|
130
|
+
onKeyDown: handleKeyDown,
|
|
131
|
+
onPaste: index === 0 ? handlePaste : void 0,
|
|
132
|
+
disabled,
|
|
133
|
+
readOnly: isLoading,
|
|
134
|
+
sx: {
|
|
135
|
+
textAlign: "center",
|
|
136
|
+
fontWeight: 500,
|
|
137
|
+
fontSize: getTypographyVar("lg").fontSize,
|
|
138
|
+
lineHeight: getTypographyVar("lg").lineHeight
|
|
139
|
+
},
|
|
140
|
+
size,
|
|
141
|
+
sm,
|
|
142
|
+
md,
|
|
143
|
+
lg,
|
|
144
|
+
error
|
|
145
|
+
}
|
|
146
|
+
) }, index))
|
|
134
147
|
}
|
|
135
|
-
)
|
|
148
|
+
);
|
|
136
149
|
};
|
|
137
150
|
export {
|
|
138
151
|
OtpInput
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PaginationProps } from './types';
|
|
2
|
-
export declare const Pagination: ({ ref, ..._props }: PaginationProps) => import("
|
|
2
|
+
export declare const Pagination: ({ ref, ..._props }: PaginationProps) => 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 { Fragment } from "react";
|
|
3
3
|
import { getPaginationProps, getPageRange } from "./helpers.js";
|
|
4
4
|
import ArrowLeftIcon from "../../assets/svg/arrow-left.svg.js";
|
|
@@ -10,6 +10,7 @@ import { getTypographyVar } from "../../theme/typography.js";
|
|
|
10
10
|
import { getSizeVariantState } from "../../utils/index.js";
|
|
11
11
|
import { Text } from "../text/text.js";
|
|
12
12
|
import { IconButton } from "../icon-button/icon-button.js";
|
|
13
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
13
14
|
import { Icon } from "../icon/icon.js";
|
|
14
15
|
const Pagination = ({ ref, ..._props }) => {
|
|
15
16
|
var _a, _b, _c, _d;
|
|
@@ -37,14 +38,6 @@ const Pagination = ({ ref, ..._props }) => {
|
|
|
37
38
|
lg: getSizeVariantState(lg == null ? void 0 : lg.size)
|
|
38
39
|
};
|
|
39
40
|
const pageRange = getPageRange(page, totalPages, siblingCount);
|
|
40
|
-
const css = [
|
|
41
|
-
{
|
|
42
|
-
display: "flex",
|
|
43
|
-
alignItems: "center",
|
|
44
|
-
justifyContent: "center",
|
|
45
|
-
gap: 4
|
|
46
|
-
}
|
|
47
|
-
];
|
|
48
41
|
const handlePageClick = (e) => {
|
|
49
42
|
const newPage = Number(e.currentTarget.value);
|
|
50
43
|
if (disabled || newPage === page) return;
|
|
@@ -93,54 +86,67 @@ const Pagination = ({ ref, ..._props }) => {
|
|
|
93
86
|
}
|
|
94
87
|
);
|
|
95
88
|
};
|
|
96
|
-
return /* @__PURE__ */ jsxs(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
89
|
+
return /* @__PURE__ */ jsxs(
|
|
90
|
+
Primitive,
|
|
91
|
+
{
|
|
92
|
+
sx: {
|
|
93
|
+
display: "flex",
|
|
94
|
+
alignItems: "center",
|
|
95
|
+
justifyContent: "center",
|
|
96
|
+
gap: 4
|
|
97
|
+
},
|
|
98
|
+
...rest,
|
|
99
|
+
ref,
|
|
100
|
+
children: [
|
|
101
|
+
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 }) }),
|
|
102
|
+
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 }) }),
|
|
103
|
+
pageRange.map((pageItem, index) => {
|
|
104
|
+
var _a2, _b2, _c2, _d2, _e;
|
|
105
|
+
const isActive = pageItem.type === "page" && pageItem.page === page;
|
|
106
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
107
|
+
pageItem.type === "ellipsis" && /* @__PURE__ */ jsx(PaginationButton, { color: (_a2 = states == null ? void 0 : states.normal) == null ? void 0 : _a2.color, children: "..." }),
|
|
108
|
+
pageItem.type === "page" && /* @__PURE__ */ jsx(
|
|
109
|
+
PaginationButton,
|
|
113
110
|
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
111
|
+
color: isActive ? (_b2 = states == null ? void 0 : states.active) == null ? void 0 : _b2.color : (_c2 = states == null ? void 0 : states.normal) == null ? void 0 : _c2.color,
|
|
112
|
+
value: pageItem.page,
|
|
113
|
+
variant: isActive ? (_d2 = states == null ? void 0 : states.active) == null ? void 0 : _d2.variant : (_e = states == null ? void 0 : states.normal) == null ? void 0 : _e.variant,
|
|
114
|
+
onClick: handlePageClick,
|
|
115
|
+
children: /* @__PURE__ */ jsx(
|
|
116
|
+
Text,
|
|
117
|
+
{
|
|
118
|
+
sx: {
|
|
119
|
+
paddingLeft: 2,
|
|
120
|
+
paddingRight: 2,
|
|
121
|
+
...sizeVariantState.xs.textVariant ? {
|
|
122
|
+
fontSize: getTypographyVar(sizeVariantState.xs.textVariant).fontSize,
|
|
123
|
+
lineHeight: getTypographyVar(sizeVariantState.xs.textVariant).lineHeight
|
|
124
|
+
} : {},
|
|
125
|
+
sm: sizeVariantState.sm.textVariant ? {
|
|
126
|
+
fontSize: getTypographyVar(sizeVariantState.sm.textVariant).fontSize,
|
|
127
|
+
lineHeight: getTypographyVar(sizeVariantState.sm.textVariant).lineHeight
|
|
128
|
+
} : {},
|
|
129
|
+
md: sizeVariantState.md.textVariant ? {
|
|
130
|
+
fontSize: getTypographyVar(sizeVariantState.md.textVariant).fontSize,
|
|
131
|
+
lineHeight: getTypographyVar(sizeVariantState.md.textVariant).lineHeight
|
|
132
|
+
} : {},
|
|
133
|
+
lg: sizeVariantState.lg.textVariant ? {
|
|
134
|
+
fontSize: getTypographyVar(sizeVariantState.lg.textVariant).fontSize,
|
|
135
|
+
lineHeight: getTypographyVar(sizeVariantState.lg.textVariant).lineHeight
|
|
136
|
+
} : {}
|
|
137
|
+
},
|
|
138
|
+
children: pageItem.page
|
|
139
|
+
}
|
|
140
|
+
)
|
|
135
141
|
}
|
|
136
142
|
)
|
|
137
|
-
}
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
] }, index);
|
|
144
|
+
}),
|
|
145
|
+
showNextPageButton && /* @__PURE__ */ jsx(PaginationButton, { "aria-disabled": page >= totalPages, color: (_c = states == null ? void 0 : states.normal) == null ? void 0 : _c.color, onClick: handleNextClick, children: /* @__PURE__ */ jsx(PaginationIcon, { source: ArrowRightIcon }) }),
|
|
146
|
+
showLastPageButton && /* @__PURE__ */ jsx(PaginationButton, { "aria-disabled": page >= totalPages, color: (_d = states == null ? void 0 : states.normal) == null ? void 0 : _d.color, onClick: handleLastClick, children: /* @__PURE__ */ jsx(PaginationIcon, { source: ArrowForwardIcon }) })
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
);
|
|
144
150
|
};
|
|
145
151
|
export {
|
|
146
152
|
Pagination
|
|
@@ -14,9 +14,9 @@ import { InputMask as ForwardRefInputMask } from "../input-mask/input-mask.js";
|
|
|
14
14
|
import { Input } from "../input/input.js";
|
|
15
15
|
import { FormHelperText } from "../form-helper-text/form-helper-text.js";
|
|
16
16
|
const CountryRowLabel = ({ code, name, dial_code }) => {
|
|
17
|
-
return /* @__PURE__ */ jsxs(
|
|
17
|
+
return /* @__PURE__ */ jsxs(Primitive, { sx: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
18
18
|
/* @__PURE__ */ jsx(Flag, { countryCode: code }),
|
|
19
|
-
/* @__PURE__ */ jsxs("span",
|
|
19
|
+
/* @__PURE__ */ jsxs(Primitive, { as: "span", sx: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
|
|
20
20
|
dial_code,
|
|
21
21
|
" (",
|
|
22
22
|
name,
|
|
@@ -25,9 +25,9 @@ const CountryRowLabel = ({ code, name, dial_code }) => {
|
|
|
25
25
|
] });
|
|
26
26
|
};
|
|
27
27
|
const SelectedRenderer = ({ code, dial_code }) => {
|
|
28
|
-
return /* @__PURE__ */ jsxs(
|
|
28
|
+
return /* @__PURE__ */ jsxs(Primitive, { sx: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
29
29
|
/* @__PURE__ */ jsx(Flag, { countryCode: code }),
|
|
30
|
-
/* @__PURE__ */ jsx("span",
|
|
30
|
+
/* @__PURE__ */ jsx(Primitive, { as: "span", sx: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: dial_code })
|
|
31
31
|
] });
|
|
32
32
|
};
|
|
33
33
|
const parsePhoneInputValue = (value) => {
|
|
@@ -138,7 +138,7 @@ const PhoneInput = ({
|
|
|
138
138
|
props.css
|
|
139
139
|
],
|
|
140
140
|
ref: mergedRefs,
|
|
141
|
-
children: /* @__PURE__ */ jsxs(
|
|
141
|
+
children: /* @__PURE__ */ jsxs(Primitive, { sx: { position: "absolute", inset: 0, display: "flex", alignItems: "center" }, children: [
|
|
142
142
|
/* @__PURE__ */ jsx(
|
|
143
143
|
Select,
|
|
144
144
|
{
|
|
@@ -148,7 +148,7 @@ const PhoneInput = ({
|
|
|
148
148
|
minWidth: 80
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
|
-
|
|
151
|
+
style: {
|
|
152
152
|
paddingRight: 0
|
|
153
153
|
},
|
|
154
154
|
outline: {
|
|
@@ -175,12 +175,12 @@ const PhoneInput = ({
|
|
|
175
175
|
}
|
|
176
176
|
),
|
|
177
177
|
/* @__PURE__ */ jsx(
|
|
178
|
-
|
|
178
|
+
Primitive,
|
|
179
179
|
{
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
sx: {
|
|
181
|
+
borderRightWidth: 1,
|
|
182
182
|
borderColor: getColorVar("border.default"),
|
|
183
|
-
height: "
|
|
183
|
+
height: "60%",
|
|
184
184
|
marginLeft: 8,
|
|
185
185
|
marginRight: 8
|
|
186
186
|
}
|
|
@@ -199,7 +199,8 @@ const PhoneInput = ({
|
|
|
199
199
|
mainProps: {
|
|
200
200
|
style: {
|
|
201
201
|
paddingLeft: 0,
|
|
202
|
-
boxShadow: "none"
|
|
202
|
+
boxShadow: "none",
|
|
203
|
+
borderWidth: 0
|
|
203
204
|
}
|
|
204
205
|
},
|
|
205
206
|
onChange: onNationalNumberChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PopoverClose: ({ event, reason, ref, ...props }: import('../../floating').FloatingCloseProps) => import("
|
|
1
|
+
export declare const PopoverClose: ({ event, reason, ref, ...props }: import('../../floating').FloatingCloseProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ProgressProps } from './types';
|
|
2
|
-
export declare const Progress: (props: ProgressProps) => import("
|
|
2
|
+
export declare const Progress: ({ value, direction, activeProps, children, ...props }: ProgressProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,38 +1,35 @@
|
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
const { style: activeStyle, ...activeRest } = activeProps;
|
|
4
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
5
|
+
const Progress = ({ value, direction = "horizontal", activeProps = {}, children, ...props }) => {
|
|
7
6
|
return /* @__PURE__ */ jsx(
|
|
8
|
-
|
|
7
|
+
Primitive,
|
|
9
8
|
{
|
|
10
|
-
...
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
],
|
|
9
|
+
...props,
|
|
10
|
+
sx: {
|
|
11
|
+
backgroundColor: getColorVar("neutral.200"),
|
|
12
|
+
overflow: "hidden",
|
|
13
|
+
borderRadius: 9999,
|
|
14
|
+
...direction === "horizontal" ? { width: "100%", height: 8 } : {},
|
|
15
|
+
...direction === "vertical" ? { height: "100%", width: 8 } : {},
|
|
16
|
+
...props.sx
|
|
17
|
+
},
|
|
20
18
|
children: /* @__PURE__ */ jsx(
|
|
21
|
-
|
|
19
|
+
Primitive,
|
|
22
20
|
{
|
|
23
|
-
...
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
],
|
|
35
|
-
style: { [direction === "horizontal" ? "width" : "height"]: `${value}%`, ...activeStyle },
|
|
21
|
+
...activeProps,
|
|
22
|
+
sx: {
|
|
23
|
+
overflow: "hidden",
|
|
24
|
+
overflowWrap: "break-word",
|
|
25
|
+
borderRadius: 9999,
|
|
26
|
+
backgroundColor: getColorVar("primary.600"),
|
|
27
|
+
transition: "width 300ms ease-in-out",
|
|
28
|
+
...direction === "horizontal" ? { height: "100%" } : {},
|
|
29
|
+
...direction === "vertical" ? { width: "100%" } : {},
|
|
30
|
+
...activeProps.sx
|
|
31
|
+
},
|
|
32
|
+
style: { [direction === "horizontal" ? "width" : "height"]: `${value}%`, ...activeProps.style },
|
|
36
33
|
children
|
|
37
34
|
}
|
|
38
35
|
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
1
|
+
import { ComponentProps, JSX } from 'react';
|
|
2
2
|
import { ProgressDirection } from '../../types';
|
|
3
|
-
|
|
3
|
+
import { PrimitiveProps } from '../primitive';
|
|
4
|
+
export type ProgressProps = PrimitiveProps<{
|
|
4
5
|
value: number;
|
|
5
6
|
direction?: ProgressDirection;
|
|
6
|
-
activeProps?:
|
|
7
|
-
} & ComponentProps<'div'
|
|
7
|
+
activeProps?: PrimitiveProps<JSX.IntrinsicElements['div']>;
|
|
8
|
+
} & ComponentProps<'div'>>;
|
|
@@ -162,8 +162,8 @@ const Select = ({
|
|
|
162
162
|
} : {}
|
|
163
163
|
},
|
|
164
164
|
children: [
|
|
165
|
-
/* @__PURE__ */ jsx(
|
|
166
|
-
isSelected && /* @__PURE__ */ jsx(SvgLoader, { source: CheckIcon, width: 24, height: 24,
|
|
165
|
+
/* @__PURE__ */ jsx(Primitive, { sx: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: getOptionLabel(rowData) }),
|
|
166
|
+
isSelected && /* @__PURE__ */ jsx(SvgLoader, { source: CheckIcon, width: 24, height: 24, sx: { color: getColorVar("primary.600") } })
|
|
167
167
|
]
|
|
168
168
|
}
|
|
169
169
|
);
|
|
@@ -250,7 +250,7 @@ const Select = ({
|
|
|
250
250
|
source: ArrowDownIcon,
|
|
251
251
|
width: 20,
|
|
252
252
|
height: 20,
|
|
253
|
-
|
|
253
|
+
sx: {
|
|
254
254
|
transition: "transform 150ms",
|
|
255
255
|
...isOpen ? { transform: "rotate(-180deg)" } : {}
|
|
256
256
|
}
|
|
@@ -271,13 +271,17 @@ const Select = ({
|
|
|
271
271
|
],
|
|
272
272
|
ref,
|
|
273
273
|
children: /* @__PURE__ */ jsx(
|
|
274
|
-
|
|
274
|
+
Primitive,
|
|
275
275
|
{
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
276
|
+
sx: {
|
|
277
|
+
flex: 1,
|
|
278
|
+
textAlign: "left",
|
|
279
|
+
overflow: "hidden",
|
|
280
|
+
textOverflow: "ellipsis",
|
|
281
|
+
whiteSpace: "nowrap",
|
|
282
|
+
...getTextCss(rest == null ? void 0 : rest.size)
|
|
283
|
+
},
|
|
284
|
+
children: selectedOption ? /* @__PURE__ */ jsx(Fragment, { children: selectedRenderer ? selectedRenderer(selectedOption) : getOptionLabel(selectedOption) }) : /* @__PURE__ */ jsx(Primitive, { sx: { color: getColorVar("neutral.400"), display: "block" }, as: "span", children: placeholder })
|
|
281
285
|
}
|
|
282
286
|
)
|
|
283
287
|
}
|
|
@@ -297,7 +301,7 @@ const Select = ({
|
|
|
297
301
|
backgroundColor: getColorVar("surface.default")
|
|
298
302
|
},
|
|
299
303
|
children: [
|
|
300
|
-
searchable && /* @__PURE__ */ jsx(Primitive, { sx: {
|
|
304
|
+
searchable && /* @__PURE__ */ jsx(Primitive, { sx: { paddingInline: 8, paddingBottom: 12, position: "relative" }, children: /* @__PURE__ */ jsx(
|
|
301
305
|
Input,
|
|
302
306
|
{
|
|
303
307
|
size: rest.size,
|
|
@@ -314,7 +318,7 @@ const Select = ({
|
|
|
314
318
|
VirtualizedList,
|
|
315
319
|
{
|
|
316
320
|
...listProps,
|
|
317
|
-
|
|
321
|
+
sx: { paddingInline: 4 },
|
|
318
322
|
options: {
|
|
319
323
|
count: displayOptions.length,
|
|
320
324
|
estimateSize,
|
|
@@ -15,8 +15,9 @@ import { StarRating } from '@janbox/storefront-ui';
|
|
|
15
15
|
| `rating*` | `number` | - | Giá trị rating hiện tại. Kiểm soát mức độ tô màu ngôi sao qua clip-path. Hỗ trợ giá trị thập phân (VD: 2.5). |
|
|
16
16
|
| `maxRating` | `number` | 5 | Giá trị rating tối đa. Dùng để tính phần trăm tô màu của ngôi sao. |
|
|
17
17
|
| `size` | `number` | 24 | Chiều rộng và chiều cao của SVG tính bằng pixel. ViewBox nội bộ luôn là 24x24 nên giá trị này scale output. |
|
|
18
|
-
| `color` | `ColorScale` | `"
|
|
19
|
-
| `
|
|
18
|
+
| `color` | `ColorScale` | `"orange"` | Color variant dùng cho cả stroke và fill của ngôi sao. Ánh xạ tới design token color shades qua `getColorShadesByVariant`. |
|
|
19
|
+
| `sx` | `ToResponsiveProps<StyledCSS>` | - | Custom style responsive (hỗ trợ `sm`, `md`, `lg`) áp dụng lên root SVG element. |
|
|
20
|
+
| `ref` | `React.Ref<SVGSVGElement>` | - | Ref tới phần tử SVG bên dưới. |
|
|
20
21
|
|
|
21
22
|
*Props bắt buộc
|
|
22
23
|
|
|
@@ -40,6 +41,12 @@ import { StarRating } from '@janbox/storefront-ui';
|
|
|
40
41
|
<StarRating rating={7} maxRating={10} color="primary" />
|
|
41
42
|
```
|
|
42
43
|
|
|
44
|
+
### Custom style responsive với `sx`
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<StarRating rating={4} sx={{ marginRight: 4, md: { marginRight: 8 } }} />
|
|
48
|
+
```
|
|
49
|
+
|
|
43
50
|
### Ngôi sao đầy và rỗng
|
|
44
51
|
|
|
45
52
|
```tsx
|
|
@@ -58,7 +65,8 @@ import { StarRating } from '@janbox/storefront-ui';
|
|
|
58
65
|
|
|
59
66
|
- react (useId)
|
|
60
67
|
- @/utils (getColorShadesByVariant)
|
|
61
|
-
- @/types (ColorScale)
|
|
68
|
+
- @/types (ColorScale, PropsWithSx)
|
|
69
|
+
- Stylesheet (../stylesheet)
|
|
62
70
|
|
|
63
71
|
## See Also
|
|
64
72
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { StarRatingProps } from './types';
|
|
2
|
-
export declare const StarRating: ({ rating, maxRating, size, ref, color }: StarRatingProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const StarRating: ({ rating, maxRating, size, ref, color, sx }: StarRatingProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,36 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
3
|
import { getColorShadesByVariant } from "../../utils/index.js";
|
|
4
|
-
|
|
4
|
+
import { Stylesheet } from "../stylesheet/stylesheet.js";
|
|
5
|
+
const StarRating = ({ rating, maxRating = 5, size = 24, ref, color = "orange", sx }) => {
|
|
5
6
|
const id = useId();
|
|
6
7
|
const percent = rating / maxRating * 24;
|
|
7
8
|
const { main } = getColorShadesByVariant(color);
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
9
|
+
return /* @__PURE__ */ jsx(Stylesheet, { children: ({ css, cx }) => /* @__PURE__ */ jsxs(
|
|
10
|
+
"svg",
|
|
11
|
+
{
|
|
12
|
+
className: cx(css(sx)),
|
|
13
|
+
width: size,
|
|
14
|
+
height: size,
|
|
15
|
+
viewBox: "0 0 24 24",
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
+
ref,
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id, children: /* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: percent, height: 24 }) }) }),
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
"path",
|
|
22
|
+
{
|
|
23
|
+
d: "M12 2.89648L14.935 8.88948L21.5 9.85648L16.75 14.5185L17.871 21.1045L12 17.9935L6.129 21.1045L7.25 14.5185L2.5 9.85648L9.064 8.88948L12 2.89648Z",
|
|
24
|
+
fill: "white",
|
|
25
|
+
stroke: main,
|
|
26
|
+
strokeWidth: "1.5",
|
|
27
|
+
strokeLinecap: "round",
|
|
28
|
+
strokeLinejoin: "round"
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
/* @__PURE__ */ jsx(
|
|
32
|
+
"path",
|
|
33
|
+
{
|
|
34
|
+
d: "M12 2.89648L14.935 8.88948L21.5 9.85648L16.75 14.5185L17.871 21.1045L12 17.9935L6.129 21.1045L7.25 14.5185L2.5 9.85648L9.064 8.88948L12 2.89648Z",
|
|
35
|
+
fill: main,
|
|
36
|
+
clipPath: `url(#${id})`,
|
|
37
|
+
strokeLinecap: "round",
|
|
38
|
+
strokeLinejoin: "round",
|
|
39
|
+
strokeWidth: "1.5",
|
|
40
|
+
stroke: main
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
34
46
|
};
|
|
35
47
|
export {
|
|
36
48
|
StarRating
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { ColorScale } from '../../types';
|
|
1
|
+
import { ColorScale, PropsWithSx } from '../../types';
|
|
2
2
|
import { Ref } from 'react';
|
|
3
|
-
export type StarRatingProps = {
|
|
3
|
+
export type StarRatingProps = PropsWithSx<{
|
|
4
4
|
rating: number;
|
|
5
5
|
maxRating?: number;
|
|
6
6
|
size?: number;
|
|
7
|
-
className?: string;
|
|
8
7
|
color?: ColorScale;
|
|
9
8
|
ref?: Ref<SVGSVGElement>;
|
|
10
|
-
}
|
|
9
|
+
}>;
|
package/dist/lib/stepper/step.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { jsx, jsxs } from "
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import "lodash-es";
|
|
4
4
|
import { getColorVar } from "../../theme/palette.js";
|
|
5
5
|
import CheckIcon from "../../assets/svg/check.svg.js";
|
|
6
|
+
import { Primitive } from "../primitive/primitive.js";
|
|
6
7
|
import { Icon } from "../icon/icon.js";
|
|
7
8
|
const stateStyles = {
|
|
8
9
|
done: {
|
|
@@ -35,11 +36,10 @@ const Step = forwardRef((props, ref) => {
|
|
|
35
36
|
const styles = stateStyles[state] ?? stateStyles.normal;
|
|
36
37
|
const checked = state === "done";
|
|
37
38
|
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
38
|
-
|
|
39
|
+
Primitive,
|
|
39
40
|
{
|
|
40
|
-
style: { width: `${size}px`, height: `${size}px` },
|
|
41
41
|
ref,
|
|
42
|
-
|
|
42
|
+
sx: {
|
|
43
43
|
borderRadius: "50%",
|
|
44
44
|
display: "flex",
|
|
45
45
|
alignItems: "center",
|
|
@@ -48,14 +48,16 @@ const Step = forwardRef((props, ref) => {
|
|
|
48
48
|
borderStyle: "solid",
|
|
49
49
|
transition: "border 500ms, background 500ms, color 500ms",
|
|
50
50
|
zIndex: 1,
|
|
51
|
+
width: size,
|
|
52
|
+
height: size,
|
|
51
53
|
...styles.bg
|
|
52
54
|
},
|
|
53
55
|
...rest,
|
|
54
56
|
children: [
|
|
55
57
|
/* @__PURE__ */ jsx(
|
|
56
|
-
|
|
58
|
+
Primitive,
|
|
57
59
|
{
|
|
58
|
-
|
|
60
|
+
sx: {
|
|
59
61
|
...styles.text,
|
|
60
62
|
display: "-webkit-box",
|
|
61
63
|
WebkitLineClamp: 2,
|