@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.
Files changed (84) hide show
  1. package/dist/components/scroll-view.d.ts +3 -2
  2. package/dist/components/scroll-view.js +5 -3
  3. package/dist/components/virtualized-list.d.ts +3 -3
  4. package/dist/lib/accordion/accordion-content/accordion-content.js +1 -1
  5. package/dist/lib/button/button.js +2 -2
  6. package/dist/lib/cascader/cascader-floating-content.d.ts +1 -1
  7. package/dist/lib/cascader/cascader-floating-content.js +52 -73
  8. package/dist/lib/cascader/cascader.d.ts +1 -1
  9. package/dist/lib/cascader/cascader.js +10 -12
  10. package/dist/lib/collapse/collapse.d.ts +1 -1
  11. package/dist/lib/collapse/collapse.js +12 -4
  12. package/dist/lib/collapse/types.d.ts +3 -3
  13. package/dist/lib/count-up/README.md +22 -0
  14. package/dist/lib/count-up/count-up.d.ts +1 -1
  15. package/dist/lib/count-up/count-up.js +22 -5
  16. package/dist/lib/count-up/types.d.ts +9 -3
  17. package/dist/lib/date-picker/date-picker.js +25 -10
  18. package/dist/lib/dialog/dialog/dialog.d.ts +1 -1
  19. package/dist/lib/dialog/dialog/dialog.js +25 -28
  20. package/dist/lib/dialog/dialog-body/dialog-body.d.ts +1 -1
  21. package/dist/lib/dialog/dialog-body/dialog-body.js +10 -11
  22. package/dist/lib/dialog/dialog-body/types.d.ts +2 -3
  23. package/dist/lib/dialog/dialog-close/dialog-close.d.ts +1 -1
  24. package/dist/lib/dialog/dialog-footer/dialog-footer.js +2 -3
  25. package/dist/lib/dialog/dialog-header/dialog-header.d.ts +1 -1
  26. package/dist/lib/dialog/dialog-header/dialog-header.js +24 -27
  27. package/dist/lib/drawer/drawer/drawer.d.ts +1 -1
  28. package/dist/lib/drawer/drawer/drawer.js +39 -26
  29. package/dist/lib/drawer/drawer-close/drawer-close.d.ts +1 -1
  30. package/dist/lib/filter-panel/checkbox-filter-panel.d.ts +1 -1
  31. package/dist/lib/filter-panel/checkbox-filter-panel.js +2 -2
  32. package/dist/lib/filter-panel/filter-panel.d.ts +1 -1
  33. package/dist/lib/filter-panel/filter-panel.js +30 -15
  34. package/dist/lib/filter-panel/radio-filter-panel.d.ts +1 -1
  35. package/dist/lib/filter-panel/radio-filter-panel.js +3 -3
  36. package/dist/lib/floating/floating-close/floating-close.d.ts +1 -1
  37. package/dist/lib/floating/floating-close/floating-close.js +3 -2
  38. package/dist/lib/floating/floating-content/floating-content.d.ts +1 -1
  39. package/dist/lib/floating/floating-content/floating-content.js +8 -6
  40. package/dist/lib/form-label/form-label.d.ts +4 -3
  41. package/dist/lib/form-label/form-label.js +10 -8
  42. package/dist/lib/highlight-words/highlight-words.d.ts +1 -1
  43. package/dist/lib/highlight-words/highlight-words.js +3 -2
  44. package/dist/lib/input/input.js +1 -3
  45. package/dist/lib/lightbox/lightbox.d.ts +1 -1
  46. package/dist/lib/lightbox/lightbox.js +44 -32
  47. package/dist/lib/linear-progress/linear-progress.d.ts +1 -1
  48. package/dist/lib/linear-progress/linear-progress.js +50 -51
  49. package/dist/lib/loading/image-skeleton/image-skeleton.d.ts +1 -1
  50. package/dist/lib/loading/image-skeleton/image-skeleton.js +9 -4
  51. package/dist/lib/loading/loading-overlay/loading-overlay.d.ts +1 -1
  52. package/dist/lib/loading/loading-overlay/loading-overlay.js +2 -2
  53. package/dist/lib/menu/menu-item/menu-item.d.ts +1 -1
  54. package/dist/lib/menu/menu-item/menu-item.js +2 -2
  55. package/dist/lib/multiple-select/multiple-select.d.ts +1 -1
  56. package/dist/lib/multiple-select/multiple-select.js +38 -39
  57. package/dist/lib/notifications/notifications.d.ts +1 -1
  58. package/dist/lib/notifications/notifications.js +7 -7
  59. package/dist/lib/otp-input/otp-input.d.ts +1 -1
  60. package/dist/lib/otp-input/otp-input.js +43 -30
  61. package/dist/lib/pagination/pagination.d.ts +1 -1
  62. package/dist/lib/pagination/pagination.js +60 -54
  63. package/dist/lib/phone-input/phone-input.js +12 -11
  64. package/dist/lib/popover/popover-close/popover-close.d.ts +1 -1
  65. package/dist/lib/progress/progress.d.ts +1 -1
  66. package/dist/lib/progress/progress.js +26 -29
  67. package/dist/lib/progress/types.d.ts +5 -4
  68. package/dist/lib/select/select.js +15 -11
  69. package/dist/lib/star-rating/README.md +11 -3
  70. package/dist/lib/star-rating/star-rating.d.ts +1 -1
  71. package/dist/lib/star-rating/star-rating.js +40 -28
  72. package/dist/lib/star-rating/types.d.ts +3 -4
  73. package/dist/lib/stepper/step.js +8 -6
  74. package/dist/lib/stepper/stepper.d.ts +1 -1
  75. package/dist/lib/stepper/stepper.js +10 -9
  76. package/dist/lib/stepper/types.d.ts +2 -1
  77. package/dist/lib/swiper/swiper/swiper.js +3 -3
  78. package/dist/lib/swiper/swiper-dots-paging/swiper-dots-paging.d.ts +1 -1
  79. package/dist/lib/swiper/swiper-dots-paging/swiper-dots-paging.js +8 -7
  80. package/dist/lib/tabs/tab-indicator/tab-indicator.js +1 -1
  81. package/dist/lib/tabs/tabs/tabs.d.ts +1 -1
  82. package/dist/lib/tabs/tabs/tabs.js +1 -1
  83. package/dist/lib/time-picker/time-picker.js +16 -22
  84. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- import { jsx } from "@emotion/react/jsx-runtime";
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("div", { css: { display: "flex", width: "100%", gap: "0.5rem", [mediaQuery("sm")]: { gap: "0.75rem" } }, children: otp.map((digit, index) => /* @__PURE__ */ jsx("div", { css: { flex: "1 1 0%", position: "relative" }, children: /* @__PURE__ */ jsx(
106
- Input,
105
+ return /* @__PURE__ */ jsx(
106
+ Primitive,
107
107
  {
108
- ref: (el) => {
109
- inputRefs.current[index] = el;
110
- },
111
- type: "text",
112
- inputMode: "numeric",
113
- pattern: "\\d*",
114
- maxLength: 1,
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
- size,
130
- sm,
131
- md,
132
- lg,
133
- error
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
- ) }, index)) });
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("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare const Pagination: ({ ref, ..._props }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { jsxs, jsx } from "@emotion/react/jsx-runtime";
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("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, { sx: { transform: "rotate(180deg)" }, source: ArrowForwardIcon }) }),
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
- pageRange.map((pageItem, index) => {
100
- var _a2, _b2, _c2, _d2, _e;
101
- const isActive = pageItem.type === "page" && pageItem.page === page;
102
- return /* @__PURE__ */ jsxs(Fragment, { children: [
103
- pageItem.type === "ellipsis" && /* @__PURE__ */ jsx(PaginationButton, { color: (_a2 = states == null ? void 0 : states.normal) == null ? void 0 : _a2.color, children: "..." }),
104
- pageItem.type === "page" && /* @__PURE__ */ jsx(
105
- PaginationButton,
106
- {
107
- 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,
108
- value: pageItem.page,
109
- 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,
110
- onClick: handlePageClick,
111
- children: /* @__PURE__ */ jsx(
112
- Text,
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
- sx: {
115
- paddingLeft: 2,
116
- paddingRight: 2,
117
- ...sizeVariantState.xs.textVariant ? {
118
- fontSize: getTypographyVar(sizeVariantState.xs.textVariant).fontSize,
119
- lineHeight: getTypographyVar(sizeVariantState.xs.textVariant).lineHeight
120
- } : {},
121
- sm: sizeVariantState.sm.textVariant ? {
122
- fontSize: getTypographyVar(sizeVariantState.sm.textVariant).fontSize,
123
- lineHeight: getTypographyVar(sizeVariantState.sm.textVariant).lineHeight
124
- } : {},
125
- md: sizeVariantState.md.textVariant ? {
126
- fontSize: getTypographyVar(sizeVariantState.md.textVariant).fontSize,
127
- lineHeight: getTypographyVar(sizeVariantState.md.textVariant).lineHeight
128
- } : {},
129
- lg: sizeVariantState.lg.textVariant ? {
130
- fontSize: getTypographyVar(sizeVariantState.lg.textVariant).fontSize,
131
- lineHeight: getTypographyVar(sizeVariantState.lg.textVariant).lineHeight
132
- } : {}
133
- },
134
- children: pageItem.page
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
- ] }, index);
140
- }),
141
- 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 }) }),
142
- 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 }) })
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("div", { css: { display: "flex", alignItems: "center", gap: 8 }, children: [
17
+ return /* @__PURE__ */ jsxs(Primitive, { sx: { display: "flex", alignItems: "center", gap: 8 }, children: [
18
18
  /* @__PURE__ */ jsx(Flag, { countryCode: code }),
19
- /* @__PURE__ */ jsxs("span", { css: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
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("div", { css: { display: "flex", alignItems: "center", gap: 6 }, children: [
28
+ return /* @__PURE__ */ jsxs(Primitive, { sx: { display: "flex", alignItems: "center", gap: 6 }, children: [
29
29
  /* @__PURE__ */ jsx(Flag, { countryCode: code }),
30
- /* @__PURE__ */ jsx("span", { css: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: dial_code })
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("div", { css: { position: "absolute", inset: 0, display: "flex", alignItems: "center" }, children: [
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
- css: {
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
- "div",
178
+ Primitive,
179
179
  {
180
- css: {
181
- borderRight: "1px solid",
180
+ sx: {
181
+ borderRightWidth: 1,
182
182
  borderColor: getColorVar("border.default"),
183
- height: "66.666667%",
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("@emotion/react/jsx-runtime").JSX.Element;
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("@emotion/react/jsx-runtime").JSX.Element;
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 "@emotion/react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import "lodash-es";
3
3
  import { getColorVar } from "../../theme/palette.js";
4
- const Progress = (props) => {
5
- const { value, direction = "horizontal", activeProps = {}, children, ...rest } = props;
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
- "div",
7
+ Primitive,
9
8
  {
10
- ...rest,
11
- css: [
12
- {
13
- backgroundColor: getColorVar("neutral.200"),
14
- overflow: "hidden",
15
- borderRadius: "9999px"
16
- },
17
- direction === "horizontal" && { width: "100%", height: "0.5rem" },
18
- direction === "vertical" && { height: "100%", width: "0.5rem" }
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
- "div",
19
+ Primitive,
22
20
  {
23
- ...activeRest,
24
- css: [
25
- {
26
- overflow: "hidden",
27
- overflowWrap: "break-word",
28
- borderRadius: "9999px",
29
- backgroundColor: getColorVar("primary.600"),
30
- transition: "width 300ms ease-in-out"
31
- },
32
- direction === "horizontal" && { height: "100%" },
33
- direction === "vertical" && { width: "100%" }
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
- export type ProgressProps = {
3
+ import { PrimitiveProps } from '../primitive';
4
+ export type ProgressProps = PrimitiveProps<{
4
5
  value: number;
5
6
  direction?: ProgressDirection;
6
- activeProps?: ComponentProps<'div'>;
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("div", { css: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: getOptionLabel(rowData) }),
166
- isSelected && /* @__PURE__ */ jsx(SvgLoader, { source: CheckIcon, width: 24, height: 24, css: { color: getColorVar("primary.600") } })
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
- css: {
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
- "div",
274
+ Primitive,
275
275
  {
276
- css: [
277
- { flex: 1, textAlign: "left", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
278
- getTextCss(rest == null ? void 0 : rest.size)
279
- ],
280
- children: selectedOption ? /* @__PURE__ */ jsx(Fragment, { children: selectedRenderer ? selectedRenderer(selectedOption) : getOptionLabel(selectedOption) }) : /* @__PURE__ */ jsx(Primitive, { css: { color: getColorVar("neutral.400"), display: "block" }, as: "span", children: placeholder })
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: { paddingLeft: 8, paddingRight: 8, paddingBottom: 12, position: "relative" }, children: /* @__PURE__ */ jsx(
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
- css: { paddingLeft: 4, paddingRight: 4 },
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` | `"secondary"` | 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
- | `className` | `string` | - | CSS class name tùy chọn áp dụng lên root SVG element. |
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 { jsxs, jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useId } from "react";
3
3
  import { getColorShadesByVariant } from "../../utils/index.js";
4
- const StarRating = ({ rating, maxRating = 5, size = 24, ref, color = "primary" }) => {
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__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ref, children: [
9
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id, children: /* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: percent, height: 24 }) }) }),
10
- /* @__PURE__ */ jsx(
11
- "path",
12
- {
13
- 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",
14
- fill: "white",
15
- stroke: main,
16
- strokeWidth: "1.5",
17
- strokeLinecap: "round",
18
- strokeLinejoin: "round"
19
- }
20
- ),
21
- /* @__PURE__ */ jsx(
22
- "path",
23
- {
24
- 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",
25
- fill: main,
26
- clipPath: `url(#${id})`,
27
- strokeLinecap: "round",
28
- strokeLinejoin: "round",
29
- strokeWidth: "1.5",
30
- stroke: main
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
+ }>;
@@ -1,8 +1,9 @@
1
- import { jsx, jsxs } from "@emotion/react/jsx-runtime";
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
- "div",
39
+ Primitive,
39
40
  {
40
- style: { width: `${size}px`, height: `${size}px` },
41
41
  ref,
42
- css: {
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
- "p",
58
+ Primitive,
57
59
  {
58
- css: {
60
+ sx: {
59
61
  ...styles.text,
60
62
  display: "-webkit-box",
61
63
  WebkitLineClamp: 2,