@janbox/storefront-ui 2.0.31 → 3.0.0

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 CHANGED
@@ -59,11 +59,7 @@ pnpm add react-router
59
59
  import { ThemeProvider } from '@janbox/storefront-ui/theme';
60
60
 
61
61
  function App() {
62
- return (
63
- <ThemeProvider>
64
- {/* Your app */}
65
- </ThemeProvider>
66
- );
62
+ return <ThemeProvider>{/* Your app */}</ThemeProvider>;
67
63
  }
68
64
  ```
69
65
 
@@ -75,28 +71,15 @@ import { Button, Input, Box, Text } from '@janbox/storefront-ui';
75
71
  function LoginForm() {
76
72
  return (
77
73
  <Box sx={{ md: { maxWidth: 400 } }}>
78
- <Text size="2xl" sx={{ marginBottom: 16 }}>Đăng nhập</Text>
79
-
80
- <Input
81
- type="email"
82
- placeholder="Email"
83
- size="md"
84
- sx={{ marginBottom: 12 }}
85
- />
86
-
87
- <Input
88
- type="password"
89
- placeholder="Mật khẩu"
90
- size="md"
91
- sx={{ marginBottom: 16 }}
92
- />
93
-
94
- <Button
95
- variant="contained"
96
- color="primary"
97
- size="lg"
98
- fullWidth
99
- >
74
+ <Text size="2xl" sx={{ marginBottom: 16 }}>
75
+ Đăng nhập
76
+ </Text>
77
+
78
+ <Input type="email" placeholder="Email" size="md" sx={{ marginBottom: 12 }} />
79
+
80
+ <Input type="password" placeholder="Mật khẩu" size="md" sx={{ marginBottom: 16 }} />
81
+
82
+ <Button variant="contained" color="primary" size="lg" fullWidth>
100
83
  Đăng nhập
101
84
  </Button>
102
85
  </Box>
@@ -122,18 +105,10 @@ import { Flexbox, Box, Button } from '@janbox/storefront-ui';
122
105
 
123
106
  function ResponsiveLayout() {
124
107
  return (
125
- <Flexbox
126
- direction="column"
127
- md={{ direction: 'row' }}
128
- gap={16}
129
- >
130
- <Box sx={{ sm: { flex: 1 } }}>
131
- Nội dung chính
132
- </Box>
133
-
134
- <Box sx={{ sm: { width: 300 } }}>
135
- Sidebar
136
- </Box>
108
+ <Flexbox direction="column" md={{ direction: 'row' }} gap={16}>
109
+ <Box sx={{ sm: { flex: 1 } }}>Nội dung chính</Box>
110
+
111
+ <Box sx={{ sm: { width: 300 } }}>Sidebar</Box>
137
112
  </Flexbox>
138
113
  );
139
114
  }
@@ -163,7 +138,7 @@ src/lib/<component>/
163
138
  export const Button = ({ ref, ..._props }: ButtonProps) => {
164
139
  // 1. Merge với default props qua helper
165
140
  const { size, variant, color, children, ...rest } = getButtonProps(_props);
166
-
141
+
167
142
  // 2. Build CSS từ helpers
168
143
  const css = [
169
144
  getButtonCssBySize(size),
@@ -171,9 +146,13 @@ export const Button = ({ ref, ..._props }: ButtonProps) => {
171
146
  getButtonCssByColor(color),
172
147
  createSxInterpolation(sx),
173
148
  ];
174
-
149
+
175
150
  // 3. Render với Primitive hoặc native element
176
- return <button css={css} ref={ref} {...rest}>{children}</button>;
151
+ return (
152
+ <button css={css} ref={ref} {...rest}>
153
+ {children}
154
+ </button>
155
+ );
177
156
  };
178
157
  ```
179
158
 
@@ -195,12 +174,12 @@ import { Box } from '@janbox/storefront-ui';
195
174
 
196
175
  **Breakpoints:**
197
176
 
198
- | Screen | Min-width |
199
- |--------|-----------|
200
- | `xs` | 0px (default, không cần khai báo) |
201
- | `sm` | 768px (tablet) |
202
- | `md` | 1280px (desktop) |
203
- | `lg` | 1680px (large desktop) |
177
+ | Screen | Min-width |
178
+ | ------ | --------------------------------- |
179
+ | `xs` | 0px (default, không cần khai báo) |
180
+ | `sm` | 768px (tablet) |
181
+ | `md` | 1280px (desktop) |
182
+ | `lg` | 1680px (large desktop) |
204
183
 
205
184
  ### 3. Polymorphic Components
206
185
 
@@ -246,20 +225,20 @@ const responsiveStyle = {
246
225
 
247
226
  ```tsx
248
227
  import {
249
- cn, // Class names combiner
250
- mergeComponentProps, // Deep merge props
251
- getColorShadesByVariant, // Color utilities
252
- getSizeVariantState, // Size utilities
253
- formatNumber, // Number formatter
254
- formatPrice, // Price formatter
255
- formatDateTime, // DateTime formatter
228
+ cn, // Class names combiner
229
+ mergeComponentProps, // Deep merge props
230
+ getColorShadesByVariant, // Color utilities
231
+ getSizeVariantState, // Size utilities
232
+ formatNumber, // Number formatter
233
+ formatPrice, // Price formatter
234
+ formatDateTime, // DateTime formatter
256
235
  } from '@janbox/storefront-ui/utils';
257
236
 
258
237
  // Example: merge props
259
238
  const props = mergeComponentProps(defaultProps, userProps);
260
239
 
261
240
  // Example: get color shades
262
- const { main, dark, light, contrastText } = getColorShadesByVariant('primary');
241
+ const { main, dark, light, contrast } = getColorShadesByVariant('primary');
263
242
 
264
243
  // Example: format price
265
244
  const formatted = formatPrice(1000000, 'VND', 'vi-VN'); // "1.000.000 ₫"
@@ -274,30 +253,39 @@ const formatted = formatPrice(1000000, 'VND', 'vi-VN'); // "1.000.000 ₫"
274
253
  Thư viện cung cấp 60+ components được tổ chức theo các nhóm:
275
254
 
276
255
  #### Layout
256
+
277
257
  `Box`, `Flexbox`, `Grid`, `Container`
278
258
 
279
259
  #### Typography
260
+
280
261
  `Text`, `Link`, `HighlightWords`
281
262
 
282
263
  #### Form Controls
264
+
283
265
  `Input`, `InputNumber`, `InputRange`, `InputMask`, `Textarea`, `Select`, `MultipleSelect`, `Checkbox`, `RadioButton`, `Switch`, `DatePicker`, `TimePicker`, `PhoneInput`, `OtpInput`, `Cascader`
284
266
 
285
267
  #### Buttons
268
+
286
269
  `Button`, `IconButton`, `NavLink`
287
270
 
288
271
  #### Feedback
272
+
289
273
  `Loading`, `Progress`, `LinearProgress`, `Dialog`, `Drawer`, `Tooltip`, `Popover`, `Notifications`
290
274
 
291
275
  #### Data Display
276
+
292
277
  `Badge`, `Chip`, `Avatar`, `Table`, `Pagination`, `Stepper`, `Tabs`, `Accordion`, `Collapse`, `Breadcrumbs`, `StarRating`, `PriceLabel`, `CountUp`, `CountdownTimer`, `Flag`
293
278
 
294
279
  #### Media
280
+
295
281
  `Image`, `Video`, `Icon`, `Lightbox`, `Swiper`
296
282
 
297
283
  #### Navigation
284
+
298
285
  `Menu`, `FilterPanel`
299
286
 
300
287
  #### Utilities
288
+
301
289
  `Primitive`, `RippleEffect`, `SuspenseQuery`, `Marquee`, `Floating`
302
290
 
303
291
  ### Export Paths
@@ -320,7 +308,6 @@ import { cn, formatPrice } from '@janbox/storefront-ui/utils';
320
308
 
321
309
  // Constants
322
310
  import { HTMLDatasetAttributes } from '@janbox/storefront-ui/constants';
323
-
324
311
  ```
325
312
 
326
313
  ### Size Variants
@@ -337,11 +324,11 @@ Hầu hết components hỗ trợ 4 size variants:
337
324
  **Size mapping:**
338
325
 
339
326
  | size | iconSize | inputSize | inputPaddingX | textVariant |
340
- |------|----------|-----------|---------------|-------------|
341
- | `xs` | 20px | 24px | 8px | `xs` |
342
- | `sm` | 20px | 32px | 12px | `sm` |
343
- | `md` | 24px | 40px | 12px | `sm` |
344
- | `lg` | 24px | 48px | 16px | `base` |
327
+ | ---- | -------- | --------- | ------------- | ----------- |
328
+ | `xs` | 20px | 24px | 8px | `xs` |
329
+ | `sm` | 20px | 32px | 12px | `sm` |
330
+ | `md` | 24px | 40px | 12px | `sm` |
331
+ | `lg` | 24px | 48px | 16px | `base` |
345
332
 
346
333
  ### Color Variants
347
334
 
@@ -453,14 +440,14 @@ Storybook sẽ chạy tại **http://localhost:6006**
453
440
 
454
441
  ### Development Commands
455
442
 
456
- | Command | Description |
457
- |---------|-------------|
458
- | `pnpm storybook` | Dev server (port 6006) |
459
- | `pnpm build` | Build thư viện → `dist/` |
460
- | `pnpm dev` | Build với watch mode |
461
- | `pnpm type-check` | TypeScript type checking |
462
- | `pnpm lint` | ESLint |
463
- | `pnpm build-storybook` | Build Storybook static |
443
+ | Command | Description |
444
+ | ---------------------- | ------------------------ |
445
+ | `pnpm storybook` | Dev server (port 6006) |
446
+ | `pnpm build` | Build thư viện → `dist/` |
447
+ | `pnpm dev` | Build với watch mode |
448
+ | `pnpm type-check` | TypeScript type checking |
449
+ | `pnpm lint` | ESLint |
450
+ | `pnpm build-storybook` | Build Storybook static |
464
451
 
465
452
  ### Creating New Components
466
453
 
@@ -494,7 +481,11 @@ export const getXxxProps = (p: XxxProps) => mergeComponentProps(defaultProps, p)
494
481
  // xxx.tsx
495
482
  export const Xxx = ({ ref, ..._props }: XxxProps) => {
496
483
  const { size, children, ...rest } = getXxxProps(_props);
497
- return <Primitive ref={ref} {...rest}>{children}</Primitive>;
484
+ return (
485
+ <Primitive ref={ref} {...rest}>
486
+ {children}
487
+ </Primitive>
488
+ );
498
489
  };
499
490
  ```
500
491
 
@@ -62,7 +62,7 @@ const Avatar = ({ ref, ..._props }) => {
62
62
  alignItems: "center",
63
63
  justifyContent: "center",
64
64
  backgroundColor: getColorVar(`${color}.600`),
65
- color: getColorVar("white"),
65
+ color: getColorVar("common.white"),
66
66
  fontWeight: 600,
67
67
  lineHeight: 1,
68
68
  borderRadius: "inherit",
@@ -85,7 +85,7 @@ const Avatar = ({ ref, ..._props }) => {
85
85
  borderRadius: "50%",
86
86
  backgroundColor: getAvatarStatusColor(status),
87
87
  borderWidth: 2,
88
- borderColor: getColorVar("white"),
88
+ borderColor: getColorVar("common.white"),
89
89
  ...createStatusStyle({ size }),
90
90
  sm: createStatusStyle(sm),
91
91
  md: createStatusStyle(md),
@@ -39,7 +39,7 @@ const Button = ({ children, ref, ..._props }) => {
39
39
  dark,
40
40
  light,
41
41
  main,
42
- contrastText,
42
+ contrast,
43
43
  placeholder: placeholderColor,
44
44
  ariaDisabledSurface,
45
45
  ariaDisabledText
@@ -61,7 +61,7 @@ const Button = ({ children, ref, ..._props }) => {
61
61
  },
62
62
  variant === "contained" && {
63
63
  backgroundColor: isLoading ? placeholderColor : main,
64
- color: contrastText,
64
+ color: contrast,
65
65
  ":hover": {
66
66
  backgroundColor: dark
67
67
  },
@@ -88,7 +88,7 @@ const DatePicker = (_props, ref) => {
88
88
  justifyContent: "center",
89
89
  overflow: "hidden",
90
90
  borderRadius: 12,
91
- backgroundColor: getColorVar("white"),
91
+ backgroundColor: getColorVar("common.white"),
92
92
  fontSize: "0.875rem",
93
93
  lineHeight: "1.25rem",
94
94
  boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
@@ -15,7 +15,7 @@ const IconButton = ({ children, ref, ..._props }) => {
15
15
  dark,
16
16
  light,
17
17
  main,
18
- contrastText,
18
+ contrast,
19
19
  placeholder: placeholderColor,
20
20
  ariaDisabledSurface,
21
21
  ariaDisabledText
@@ -42,7 +42,7 @@ const IconButton = ({ children, ref, ..._props }) => {
42
42
  },
43
43
  variant === "contained" && {
44
44
  backgroundColor: isLoading ? placeholderColor : main,
45
- color: contrastText,
45
+ color: contrast,
46
46
  ":hover": {
47
47
  backgroundColor: dark
48
48
  },
@@ -6,32 +6,32 @@ import CheckIcon from "../../assets/svg/check.svg.js";
6
6
  import { Icon } from "../icon/icon.js";
7
7
  const stateStyles = {
8
8
  done: {
9
- text: { color: getColorVar("white") },
9
+ text: { color: getColorVar("common.white") },
10
10
  bg: {
11
11
  borderColor: getColorVar("primary.600"),
12
12
  backgroundColor: getColorVar("primary.600"),
13
- color: getColorVar("white")
13
+ color: getColorVar("common.white")
14
14
  }
15
15
  },
16
16
  active: {
17
17
  text: { color: getColorVar("primary.600") },
18
18
  bg: {
19
19
  borderColor: getColorVar("primary.600"),
20
- backgroundColor: getColorVar("white"),
20
+ backgroundColor: getColorVar("common.white"),
21
21
  color: getColorVar("primary.600")
22
22
  }
23
23
  },
24
24
  normal: {
25
- text: { color: getColorVar("white") },
25
+ text: { color: getColorVar("common.white") },
26
26
  bg: {
27
27
  borderColor: getColorVar("neutral.500"),
28
28
  backgroundColor: getColorVar("neutral.500"),
29
- color: getColorVar("white")
29
+ color: getColorVar("common.white")
30
30
  }
31
31
  }
32
32
  };
33
33
  const Step = forwardRef((props, ref) => {
34
- const { state = "normal", content, className, size = 32, children, ...rest } = props;
34
+ const { state = "normal", content, size = 32, children, ...rest } = props;
35
35
  const styles = stateStyles[state] ?? stateStyles.normal;
36
36
  const checked = state === "done";
37
37
  return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
@@ -124,7 +124,7 @@ const SwiperDotsPaging = ({
124
124
  ...inViewIndexes.includes(slideIndex) ? { visibility: "hidden" } : {},
125
125
  borderWidth: 1,
126
126
  borderColor: getColorVar(`${color}.600`),
127
- backgroundColor: getColorVar("white")
127
+ backgroundColor: getColorVar("common.white")
128
128
  },
129
129
  onClick: onDotClick,
130
130
  "data-index": slideIndex
@@ -217,7 +217,7 @@ const ArrowButton = ({
217
217
  borderStyle: "solid",
218
218
  borderColor: getColorVar(`${color}.600`),
219
219
  borderRadius: 9999,
220
- backgroundColor: getColorVar("white"),
220
+ backgroundColor: getColorVar("common.white"),
221
221
  ":disabled": {
222
222
  opacity: visible ? 0.5 : 0
223
223
  },
@@ -1,13 +1,14 @@
1
1
  import { Paths } from 'type-fest';
2
2
  export declare const getColorVar: (key: PaletteKey, fullVar?: boolean) => string;
3
3
  type Scale = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800;
4
- type ColorScale = Record<Scale, string>;
4
+ type ColorScale = Record<Scale, string> & {
5
+ contrast: string;
6
+ };
5
7
  export interface Palette {
6
- readonly inherit: 'inherit';
7
- readonly current: 'currentColor';
8
- readonly transparent: 'transparent';
9
- readonly black: '#000000';
10
- readonly white: '#FFFFFF';
8
+ readonly common: {
9
+ readonly black: '#000000';
10
+ readonly white: '#FFFFFF';
11
+ };
11
12
  background: {
12
13
  subtle: string;
13
14
  default: string;
@@ -6,11 +6,10 @@ const getColorVar = (key, fullVar = true) => {
6
6
  };
7
7
  const prefix = "color";
8
8
  const paletteVars = {
9
- inherit: "inherit",
10
- current: "currentColor",
11
- transparent: "transparent",
12
- black: "#000000",
13
- white: "#FFFFFF",
9
+ common: {
10
+ black: "#000000",
11
+ white: "#FFFFFF"
12
+ },
14
13
  background: {
15
14
  subtle: getColorVar("background.subtle"),
16
15
  default: getColorVar("background.default"),
@@ -30,7 +29,8 @@ const paletteVars = {
30
29
  500: getColorVar("primary.500"),
31
30
  600: getColorVar("primary.600"),
32
31
  700: getColorVar("primary.700"),
33
- 800: getColorVar("primary.800")
32
+ 800: getColorVar("primary.800"),
33
+ contrast: getColorVar("primary.contrast")
34
34
  // 900: getColorVar('primary.900'),
35
35
  },
36
36
  secondary: {
@@ -41,7 +41,8 @@ const paletteVars = {
41
41
  500: getColorVar("secondary.500"),
42
42
  600: getColorVar("secondary.600"),
43
43
  700: getColorVar("secondary.700"),
44
- 800: getColorVar("secondary.800")
44
+ 800: getColorVar("secondary.800"),
45
+ contrast: getColorVar("secondary.contrast")
45
46
  // 900: getColorVar('secondary.900'),
46
47
  },
47
48
  red: {
@@ -52,7 +53,8 @@ const paletteVars = {
52
53
  500: getColorVar("red.500"),
53
54
  600: getColorVar("red.600"),
54
55
  700: getColorVar("red.700"),
55
- 800: getColorVar("red.800")
56
+ 800: getColorVar("red.800"),
57
+ contrast: getColorVar("red.contrast")
56
58
  // 900: getColorVar('red.900'),
57
59
  },
58
60
  orange: {
@@ -63,7 +65,8 @@ const paletteVars = {
63
65
  500: getColorVar("orange.500"),
64
66
  600: getColorVar("orange.600"),
65
67
  700: getColorVar("orange.700"),
66
- 800: getColorVar("orange.800")
68
+ 800: getColorVar("orange.800"),
69
+ contrast: getColorVar("orange.contrast")
67
70
  // 900: getColorVar('orange.900'),
68
71
  },
69
72
  yellow: {
@@ -74,7 +77,8 @@ const paletteVars = {
74
77
  500: getColorVar("yellow.500"),
75
78
  600: getColorVar("yellow.600"),
76
79
  700: getColorVar("yellow.700"),
77
- 800: getColorVar("yellow.800")
80
+ 800: getColorVar("yellow.800"),
81
+ contrast: getColorVar("yellow.contrast")
78
82
  // 900: getColorVar('yellow.900'),
79
83
  },
80
84
  green: {
@@ -85,7 +89,8 @@ const paletteVars = {
85
89
  500: getColorVar("green.500"),
86
90
  600: getColorVar("green.600"),
87
91
  700: getColorVar("green.700"),
88
- 800: getColorVar("green.800")
92
+ 800: getColorVar("green.800"),
93
+ contrast: getColorVar("green.contrast")
89
94
  // 900: getColorVar('green.900'),
90
95
  },
91
96
  blue: {
@@ -96,7 +101,8 @@ const paletteVars = {
96
101
  500: getColorVar("blue.500"),
97
102
  600: getColorVar("blue.600"),
98
103
  700: getColorVar("blue.700"),
99
- 800: getColorVar("blue.800")
104
+ 800: getColorVar("blue.800"),
105
+ contrast: getColorVar("blue.contrast")
100
106
  // 900: getColorVar('blue.900'),
101
107
  },
102
108
  violet: {
@@ -107,7 +113,8 @@ const paletteVars = {
107
113
  500: getColorVar("violet.500"),
108
114
  600: getColorVar("violet.600"),
109
115
  700: getColorVar("violet.700"),
110
- 800: getColorVar("violet.800")
116
+ 800: getColorVar("violet.800"),
117
+ contrast: getColorVar("violet.contrast")
111
118
  // 900: getColorVar('violet.900'),
112
119
  },
113
120
  neutral: {
@@ -118,14 +125,15 @@ const paletteVars = {
118
125
  500: getColorVar("neutral.500"),
119
126
  600: getColorVar("neutral.600"),
120
127
  700: getColorVar("neutral.700"),
121
- 800: getColorVar("neutral.800")
128
+ 800: getColorVar("neutral.800"),
129
+ contrast: getColorVar("neutral.contrast")
122
130
  // 900: getColorVar('neutral.900'),
123
131
  }
124
132
  };
125
133
  const groupedColors = [
126
134
  {
127
135
  name: "Basic",
128
- colors: ["transparent", "black", "white"]
136
+ colors: ["common.white", "common.black"]
129
137
  },
130
138
  {
131
139
  name: "Background",
@@ -149,7 +157,8 @@ const groupedColors = [
149
157
  "primary.500",
150
158
  "primary.600",
151
159
  "primary.700",
152
- "primary.800"
160
+ "primary.800",
161
+ "primary.contrast"
153
162
  // 'primary.900',
154
163
  ]
155
164
  },
@@ -163,7 +172,8 @@ const groupedColors = [
163
172
  "secondary.500",
164
173
  "secondary.600",
165
174
  "secondary.700",
166
- "secondary.800"
175
+ "secondary.800",
176
+ "secondary.contrast"
167
177
  // 'secondary.900',
168
178
  ]
169
179
  },
@@ -177,7 +187,8 @@ const groupedColors = [
177
187
  "red.500",
178
188
  "red.600",
179
189
  "red.700",
180
- "red.800"
190
+ "red.800",
191
+ "red.contrast"
181
192
  // 'red.900'
182
193
  ]
183
194
  },
@@ -191,7 +202,8 @@ const groupedColors = [
191
202
  "orange.500",
192
203
  "orange.600",
193
204
  "orange.700",
194
- "orange.800"
205
+ "orange.800",
206
+ "orange.contrast"
195
207
  // 'orange.900',
196
208
  ]
197
209
  },
@@ -205,7 +217,8 @@ const groupedColors = [
205
217
  "yellow.500",
206
218
  "yellow.600",
207
219
  "yellow.700",
208
- "yellow.800"
220
+ "yellow.800",
221
+ "yellow.contrast"
209
222
  // 'yellow.900',
210
223
  ]
211
224
  },
@@ -219,7 +232,8 @@ const groupedColors = [
219
232
  "green.500",
220
233
  "green.600",
221
234
  "green.700",
222
- "green.800"
235
+ "green.800",
236
+ "green.contrast"
223
237
  // 'green.900',
224
238
  ]
225
239
  },
@@ -233,7 +247,8 @@ const groupedColors = [
233
247
  "blue.500",
234
248
  "blue.600",
235
249
  "blue.700",
236
- "blue.800"
250
+ "blue.800",
251
+ "blue.contrast"
237
252
  // 'blue.900',
238
253
  ]
239
254
  },
@@ -247,7 +262,8 @@ const groupedColors = [
247
262
  "violet.500",
248
263
  "violet.600",
249
264
  "violet.700",
250
- "violet.800"
265
+ "violet.800",
266
+ "violet.contrast"
251
267
  // 'violet.900',
252
268
  ]
253
269
  },
@@ -261,7 +277,8 @@ const groupedColors = [
261
277
  "neutral.500",
262
278
  "neutral.600",
263
279
  "neutral.700",
264
- "neutral.800"
280
+ "neutral.800",
281
+ "neutral.contrast"
265
282
  // 'neutral.900',
266
283
  ]
267
284
  }
@@ -7,7 +7,7 @@ export * from './query-params';
7
7
  export { createUnderlineEffect } from './stylesheet';
8
8
  export declare const getColorShadesByVariant: (variant?: ColorVariant) => {
9
9
  main: string;
10
- contrastText: string;
10
+ contrast: string;
11
11
  dark: string;
12
12
  light: string;
13
13
  placeholder: string;
@@ -15,10 +15,9 @@ export declare const getColorShadesByVariant: (variant?: ColorVariant) => {
15
15
  disabledText: string;
16
16
  ariaDisabledSurface: string;
17
17
  ariaDisabledText: string;
18
- contrast: string;
19
18
  } | {
20
19
  main?: undefined;
21
- contrastText?: undefined;
20
+ contrast?: undefined;
22
21
  dark?: undefined;
23
22
  light?: undefined;
24
23
  placeholder?: undefined;
@@ -26,7 +25,6 @@ export declare const getColorShadesByVariant: (variant?: ColorVariant) => {
26
25
  disabledText?: undefined;
27
26
  ariaDisabledSurface?: undefined;
28
27
  ariaDisabledText?: undefined;
29
- contrast?: undefined;
30
28
  };
31
29
  export declare const mergeComponentProps: <T extends object>(...args: Array<T | object | ((current: T) => T | object)>) => T;
32
30
  export declare const flattenChildren: (children: React.ReactNode) => ReactElement[];
@@ -10,93 +10,86 @@ const getColorShadesByVariant = (variant) => {
10
10
  case "primary":
11
11
  return {
12
12
  main: getColorVar("primary.600"),
13
- contrastText: getColorVar("white"),
13
+ contrast: getColorVar("primary.contrast"),
14
14
  dark: getColorVar("primary.700"),
15
15
  light: getColorVar("primary.100"),
16
16
  placeholder: getColorVar("primary.400"),
17
17
  disabledSurface: getColorVar("primary.300"),
18
18
  disabledText: getColorVar("primary.500"),
19
19
  ariaDisabledSurface: getColorVar("primary.300"),
20
- ariaDisabledText: getColorVar("primary.300"),
21
- contrast: getColorVar("white")
20
+ ariaDisabledText: getColorVar("primary.300")
22
21
  };
23
22
  case "secondary":
24
23
  return {
25
24
  main: getColorVar("secondary.600"),
26
- contrastText: getColorVar("white"),
25
+ contrast: getColorVar("secondary.contrast"),
27
26
  dark: getColorVar("secondary.700"),
28
27
  light: getColorVar("secondary.100"),
29
28
  placeholder: getColorVar("secondary.400"),
30
29
  disabledSurface: getColorVar("secondary.300"),
31
30
  disabledText: getColorVar("secondary.500"),
32
31
  ariaDisabledSurface: getColorVar("secondary.300"),
33
- ariaDisabledText: getColorVar("secondary.300"),
34
- contrast: getColorVar("white")
32
+ ariaDisabledText: getColorVar("secondary.300")
35
33
  };
36
34
  case "green":
37
35
  return {
38
36
  main: getColorVar("green.600"),
39
- contrastText: getColorVar("white"),
37
+ contrast: getColorVar("green.contrast"),
40
38
  dark: getColorVar("green.700"),
41
39
  light: getColorVar("green.100"),
42
40
  placeholder: getColorVar("green.400"),
43
41
  disabledSurface: getColorVar("green.300"),
44
42
  disabledText: getColorVar("green.500"),
45
43
  ariaDisabledSurface: getColorVar("green.300"),
46
- ariaDisabledText: getColorVar("green.300"),
47
- contrast: getColorVar("white")
44
+ ariaDisabledText: getColorVar("green.300")
48
45
  };
49
46
  case "orange":
50
47
  return {
51
48
  main: getColorVar("orange.600"),
52
- contrastText: getColorVar("white"),
49
+ contrast: getColorVar("orange.contrast"),
53
50
  dark: getColorVar("orange.700"),
54
51
  light: getColorVar("orange.100"),
55
52
  placeholder: getColorVar("orange.400"),
56
53
  disabledSurface: getColorVar("orange.300"),
57
54
  disabledText: getColorVar("orange.500"),
58
55
  ariaDisabledSurface: getColorVar("orange.300"),
59
- ariaDisabledText: getColorVar("orange.300"),
60
- contrast: getColorVar("white")
56
+ ariaDisabledText: getColorVar("orange.300")
61
57
  };
62
58
  case "red":
63
59
  return {
64
60
  main: getColorVar("red.600"),
65
- contrastText: getColorVar("white"),
61
+ contrast: getColorVar("red.contrast"),
66
62
  dark: getColorVar("red.700"),
67
63
  light: getColorVar("red.100"),
68
64
  placeholder: getColorVar("red.400"),
69
65
  disabledSurface: getColorVar("red.300"),
70
66
  disabledText: getColorVar("red.500"),
71
67
  ariaDisabledSurface: getColorVar("red.300"),
72
- ariaDisabledText: getColorVar("red.300"),
73
- contrast: getColorVar("white")
68
+ ariaDisabledText: getColorVar("red.300")
74
69
  };
75
70
  case "blue":
76
71
  return {
77
72
  main: getColorVar("blue.600"),
78
- contrastText: getColorVar("white"),
73
+ contrast: getColorVar("blue.contrast"),
79
74
  dark: getColorVar("blue.700"),
80
75
  light: getColorVar("blue.100"),
81
76
  placeholder: getColorVar("blue.400"),
82
77
  disabledSurface: getColorVar("blue.300"),
83
78
  disabledText: getColorVar("blue.500"),
84
79
  ariaDisabledSurface: getColorVar("blue.300"),
85
- ariaDisabledText: getColorVar("blue.300"),
86
- contrast: getColorVar("white")
80
+ ariaDisabledText: getColorVar("blue.300")
87
81
  };
88
82
  case "neutral":
89
83
  return {
90
84
  main: getColorVar("neutral.600"),
91
- contrastText: getColorVar("white"),
85
+ contrast: getColorVar("neutral.contrast"),
92
86
  dark: getColorVar("neutral.700"),
93
87
  light: getColorVar("neutral.100"),
94
88
  placeholder: getColorVar("neutral.400"),
95
89
  disabledSurface: getColorVar("neutral.300"),
96
90
  disabledText: getColorVar("neutral.500"),
97
91
  ariaDisabledSurface: getColorVar("neutral.300"),
98
- ariaDisabledText: getColorVar("neutral.300"),
99
- contrast: getColorVar("white")
92
+ ariaDisabledText: getColorVar("neutral.300")
100
93
  };
101
94
  default:
102
95
  return {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janbox/storefront-ui",
3
- "version": "2.0.31",
3
+ "version": "3.0.0",
4
4
  "description": "Storefront UI component library for Janbox",
5
5
  "author": "Janbox",
6
6
  "keywords": [
@@ -43,7 +43,7 @@
43
43
  "types": "./dist/components/index.d.ts",
44
44
  "default": "./dist/components/index.js"
45
45
  },
46
- "./locales/*": "./dist/locales/*"
46
+ "./style.css": "./dist/style.css"
47
47
  },
48
48
  "files": [
49
49
  "dist",