@janbox/storefront-ui 2.0.20 → 2.0.22

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.
@@ -1,6 +1,6 @@
1
1
  import { Screen } from '../../theme';
2
2
  export declare const useWindowScreen: () => {
3
- name: "xs" | "sm" | "md" | "lg" | undefined;
3
+ name: "xs" | "sm" | "lg" | "md" | undefined;
4
4
  isSmallerThan: (target: Screen) => boolean;
5
5
  isLargerThan: (target: Screen) => boolean;
6
6
  };
@@ -1,6 +1,5 @@
1
1
  import { default as en } from './locales/en.json';
2
2
  export declare const FALLBACK_LOCALE = "en";
3
- export declare const LocaleContext: import('react').Context<string>;
4
3
  export declare const useTranslation: () => {
5
4
  t: (key: keyof typeof en) => string;
6
5
  locale: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAQnC,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,eAAO,MAAM,aAAa,iCAAiC,CAAC;AAE5D,eAAO,MAAM,cAAc;aAKZ,MAAM,OAAO,EAAE;;CAI7B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,mBAAmB,CAAC;AASnC,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,eAAO,MAAM,cAAc;aAKZ,MAAM,OAAO,EAAE;;CAI7B,CAAC"}
@@ -1,14 +1,16 @@
1
- import { useContext, useMemo, createContext } from "react";
1
+ import { useMemo } from "react";
2
2
  import en from "./locales/en.json.js";
3
3
  import vi from "./locales/vi.json.js";
4
+ import "lodash-es";
5
+ import "../theme/palette.js";
6
+ import { useTheme } from "../theme/provider.js";
4
7
  const translations = {
5
8
  en,
6
9
  vi
7
10
  };
8
11
  const FALLBACK_LOCALE = "en";
9
- const LocaleContext = createContext(FALLBACK_LOCALE);
10
12
  const useTranslation = () => {
11
- const locale = useContext(LocaleContext);
13
+ const { locale = FALLBACK_LOCALE } = useTheme();
12
14
  return useMemo(() => {
13
15
  return {
14
16
  t: (key) => {
@@ -21,6 +23,5 @@ const useTranslation = () => {
21
23
  };
22
24
  export {
23
25
  FALLBACK_LOCALE,
24
- LocaleContext,
25
26
  useTranslation
26
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"cascader.d.ts","sourceRoot":"","sources":["../../../src/lib/cascader/cascader.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAiBxC,eAAO,MAAM,QAAQ,uBAAwB,aAAa,qDAqJzD,CAAC"}
1
+ {"version":3,"file":"cascader.d.ts","sourceRoot":"","sources":["../../../src/lib/cascader/cascader.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAiBxC,eAAO,MAAM,QAAQ,uBAAwB,aAAa,qDAqJzD,CAAC"}
@@ -19,13 +19,11 @@ const Flexbox = ({ children, container, ref, ..._props }) => {
19
19
  };
20
20
  const createStyle = (sx = {}) => {
21
21
  const { width, height, ...css } = sx;
22
- return [
23
- {
24
- width,
25
- height,
26
- "& > *": css
27
- }
28
- ];
22
+ return {
23
+ width,
24
+ height,
25
+ "& > *": css
26
+ };
29
27
  };
30
28
  export {
31
29
  Flexbox
@@ -15,7 +15,7 @@ const Pagination = ({ ref, ..._props }) => {
15
15
  var _a, _b, _c, _d;
16
16
  const {
17
17
  page = 1,
18
- count = 1,
18
+ totalPages = 1,
19
19
  onChange,
20
20
  disabled,
21
21
  showFirstPageButton,
@@ -36,7 +36,7 @@ const Pagination = ({ ref, ..._props }) => {
36
36
  md: getSizeVariantState(md == null ? void 0 : md.size),
37
37
  lg: getSizeVariantState(lg == null ? void 0 : lg.size)
38
38
  };
39
- const pageRange = getPageRange(page, count, siblingCount);
39
+ const pageRange = getPageRange(page, totalPages, siblingCount);
40
40
  const css = [
41
41
  {
42
42
  display: "flex",
@@ -55,7 +55,7 @@ const Pagination = ({ ref, ..._props }) => {
55
55
  if (onChange) onChange(page - 1);
56
56
  };
57
57
  const handleNextClick = (_e) => {
58
- if (disabled || page >= count) return;
58
+ if (disabled || page >= totalPages) return;
59
59
  if (onChange) onChange(page + 1);
60
60
  };
61
61
  const handleFirstClick = (_e) => {
@@ -63,8 +63,8 @@ const Pagination = ({ ref, ..._props }) => {
63
63
  if (onChange) onChange(1);
64
64
  };
65
65
  const handleLastClick = (_e) => {
66
- if (disabled || page >= count) return;
67
- if (onChange) onChange(count);
66
+ if (disabled || page >= totalPages) return;
67
+ if (onChange) onChange(totalPages);
68
68
  };
69
69
  const PaginationButton = (buttonProps) => {
70
70
  var _a2;
@@ -138,8 +138,8 @@ const Pagination = ({ ref, ..._props }) => {
138
138
  )
139
139
  ] }, index);
140
140
  }),
141
- showNextPageButton && /* @__PURE__ */ jsx(PaginationButton, { "aria-disabled": page >= count, 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 >= count, color: (_d = states == null ? void 0 : states.normal) == null ? void 0 : _d.color, onClick: handleLastClick, children: /* @__PURE__ */ jsx(PaginationIcon, { source: ArrowForwardIcon }) })
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
  ] });
144
144
  };
145
145
  export {
@@ -7,7 +7,7 @@ export interface PaginationResponsiveProps {
7
7
  }
8
8
  type PaginationExtendedProps = ToResponsiveProps<PaginationResponsiveProps> & {
9
9
  page?: number;
10
- count?: number;
10
+ totalPages?: number;
11
11
  onChange?: (page: number) => void;
12
12
  disabled?: boolean;
13
13
  showPrevPageButton?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/pagination/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,EAAE,WAAW,CAAC;CAKpB;AAED,KAAK,uBAAuB,GAAG,iBAAiB,CAAC,yBAAyB,CAAC,GAAG;IAE5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CACd,MAAM,CACJ,eAAe,EACf;QACE,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;QACjC,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;KACtC,CACF,CACF,CAAC;CAG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AC"}
@@ -1 +1 @@
1
- {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/lib/stepper/step.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAkCpC,eAAO,MAAM,IAAI,mHAsCf,CAAC"}
1
+ {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/lib/stepper/step.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAmCpC,eAAO,MAAM,IAAI,mHAsCf,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { TabListProps } from './types';
2
- export declare const TabList: ({ ref, children, ..._props }: TabListProps) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare const TabList: ({ ref, children, ..._props }: TabListProps) => import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=tab-list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tab-list.d.ts","sourceRoot":"","sources":["../../../../src/lib/tabs/tab-list/tab-list.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AASvC,eAAO,MAAM,OAAO,iCAAkC,YAAY,qDA6BjE,CAAC"}
1
+ {"version":3,"file":"tab-list.d.ts","sourceRoot":"","sources":["../../../../src/lib/tabs/tab-list/tab-list.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AASvC,eAAO,MAAM,OAAO,iCAAkC,YAAY,4CA8BjE,CAAC"}
@@ -1,31 +1,37 @@
1
- import { jsxs, jsx } from "@emotion/react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { getTabListProps } from "./helpers.js";
3
3
  import { TabIndexContext } from "../tab/helpers.js";
4
4
  import { flattenChildren } from "../../../utils/index.js";
5
5
  import { scrollbarNoneStyle } from "../../../constants/emotion.js";
6
- import { createSxInterpolation } from "../../../utils/stylesheet.js";
7
6
  import { TabIndicator } from "../tab-indicator/tab-indicator.js";
7
+ import { Primitive } from "../../primitive/primitive.js";
8
8
  const TabList = ({ ref, children, ..._props }) => {
9
9
  const { sx, ...props } = getTabListProps(_props);
10
- const css = [
10
+ return /* @__PURE__ */ jsxs(
11
+ Primitive,
11
12
  {
12
- display: "flex",
13
- width: "fit-content",
14
- maxWidth: "100%",
15
- alignItems: "center",
16
- gap: 16,
17
- position: "relative",
18
- overflow: "auto",
19
- "& > *": {
20
- flexShrink: 0
21
- }
22
- },
23
- createSxInterpolation(sx)
24
- ];
25
- return /* @__PURE__ */ jsxs("div", { css: [css, scrollbarNoneStyle], ...props, ref, children: [
26
- flattenChildren(children).map((child, index) => /* @__PURE__ */ jsx(TabIndexContext.Provider, { value: index, children: child }, index)),
27
- /* @__PURE__ */ jsx(TabIndicator, {})
28
- ] });
13
+ sx: {
14
+ display: "flex",
15
+ width: "fit-content",
16
+ maxWidth: "100%",
17
+ alignItems: "center",
18
+ gap: 16,
19
+ position: "relative",
20
+ overflow: "auto",
21
+ "& > *": {
22
+ flexShrink: 0
23
+ },
24
+ ...scrollbarNoneStyle,
25
+ ...sx
26
+ },
27
+ ...props,
28
+ ref,
29
+ children: [
30
+ flattenChildren(children).map((child, index) => /* @__PURE__ */ jsx(TabIndexContext.Provider, { value: index, children: child }, index)),
31
+ /* @__PURE__ */ jsx(TabIndicator, {})
32
+ ]
33
+ }
34
+ );
29
35
  };
30
36
  export {
31
37
  TabList
@@ -1,5 +1,4 @@
1
- import { PropsWithSx } from '../../../types';
1
+ import { PrimitiveProps } from '../../primitive';
2
2
  import { JSX } from 'react';
3
- export type TabListExtendedProps = PropsWithSx;
4
- export type TabListProps = JSX.IntrinsicElements['div'] & TabListExtendedProps;
3
+ export type TabListProps = PrimitiveProps<JSX.IntrinsicElements['div']>;
5
4
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/tabs/tab-list/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,oBAAoB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/tabs/tab-list/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { TextProps, TextVariant } from './types';
2
2
  import { Screen } from '../../theme';
3
- import { CSSObject } from '@emotion/react';
4
- export declare const getTextCssByVariant: (variant?: TextVariant) => Partial<Record<Screen, CSSObject>>;
3
+ import { StyledCSS } from '../../types';
4
+ export declare const getTextCssByVariant: (variant?: TextVariant) => Partial<Record<Screen, StyledCSS>>;
5
5
  export declare const getTextProps: (extended: TextProps) => TextProps;
6
6
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/text/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAoB,MAAM,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,eAAO,MAAM,mBAAmB,aAAc,WAAW,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CA2H5F,CAAC;AAEF,eAAO,MAAM,YAAY,aAAc,SAAS,cAO/C,CAAC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/text/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAoB,MAAM,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,eAAO,MAAM,mBAAmB,aAAc,WAAW,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CA2H5F,CAAC;AAEF,eAAO,MAAM,YAAY,aAAc,SAAS,cAO/C,CAAC"}
@@ -1,6 +1,13 @@
1
+ import { Palette } from './palette';
2
+ import { ThemeTypography } from './typography';
1
3
  export * from './screens';
2
4
  export * from './palette';
3
5
  export * from './typography';
4
6
  export * from './provider';
7
+ export interface Theme {
8
+ palette: Palette;
9
+ typography: ThemeTypography;
10
+ locale?: string;
11
+ }
5
12
  export declare const FLOATING_Z_INDEX = 9999;
6
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAE3B,eAAO,MAAM,gBAAgB,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAE3B,MAAM,WAAW,KAAK;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,eAAe,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,gBAAgB,OAAO,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { breakpoint, getSmallerScreens, mediaQuery, screens } from "./screens.js";
2
2
  import { getColorVar, groupedColors, paletteVars, parseColor } from "./palette.js";
3
3
  import { getSmallerTypographyVariants, getTypographyVar, typographyVars } from "./typography.js";
4
- import { ThemeProvider } from "./provider.js";
4
+ import { ThemeProvider, useTheme } from "./provider.js";
5
5
  const FLOATING_Z_INDEX = 9999;
6
6
  export {
7
7
  FLOATING_Z_INDEX,
@@ -16,5 +16,6 @@ export {
16
16
  paletteVars,
17
17
  parseColor,
18
18
  screens,
19
- typographyVars
19
+ typographyVars,
20
+ useTheme
20
21
  };
@@ -37,10 +37,5 @@ export type GroupedColor = {
37
37
  };
38
38
  export declare const groupedColors: GroupedColor[];
39
39
  export declare const parseColor: (text: string | undefined, palette: Palette) => import('color').ColorInstance | null;
40
- declare module '@emotion/react' {
41
- interface Theme {
42
- palette: Palette;
43
- }
44
- }
45
40
  export {};
46
41
  //# sourceMappingURL=palette.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/theme/palette.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,eAAO,MAAM,WAAW,QAAS,UAAU,8BAG1C,CAAC;AAIF,KAAK,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE3D,KAAK,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAExC,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,W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
@@ -1,8 +1,8 @@
1
- import { Theme } from '@emotion/react';
2
1
  import { PropsWithChildren } from 'react';
2
+ import { Theme } from '.';
3
3
  export type ThemeProviderProps = PropsWithChildren<{
4
4
  theme: Theme;
5
- locale?: string;
6
5
  }>;
7
- export declare const ThemeProvider: ({ theme, locale, children }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const useTheme: () => Theme;
7
+ export declare const ThemeProvider: ({ theme, children }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
8
8
  //# sourceMappingURL=provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/theme/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAwD,MAAM,gBAAgB,CAAC;AACrG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAQ/C,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;IACjD,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAEH,eAAO,MAAM,aAAa,gCAAmD,kBAAkB,4CAO9F,CAAC"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/theme/provider.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAM1E,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;AAE1B,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;IACjD,KAAK,EAAE,KAAK,CAAC;CACd,CAAC,CAAC;AAEH,eAAO,MAAM,QAAQ,aAMpB,CAAC;AAIF,eAAO,MAAM,aAAa,wBAAyB,kBAAkB,4CAOpE,CAAC"}
@@ -1,14 +1,22 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { ThemeProvider as ThemeProvider$1, Global } from "@emotion/react";
2
+ import { Global } from "@emotion/react";
3
+ import { useContext, createContext } from "react";
3
4
  import { getColorVar } from "./palette.js";
4
5
  import { flatten } from "flat";
5
6
  import { flatMap } from "lodash-es";
6
7
  import { getTypographyVar } from "./typography.js";
7
- import { LocaleContext, FALLBACK_LOCALE } from "../i18n/index.js";
8
- const ThemeProvider = ({ theme, locale = FALLBACK_LOCALE, children }) => {
9
- return /* @__PURE__ */ jsxs(ThemeProvider$1, { theme, children: [
8
+ const useTheme = () => {
9
+ const context = useContext(ThemeContext);
10
+ if (!context) {
11
+ throw new Error("Theme context is unavailable. Make sure the component is wrapped in ThemeProvider.");
12
+ }
13
+ return context;
14
+ };
15
+ const ThemeContext = createContext(null);
16
+ const ThemeProvider = ({ theme, children }) => {
17
+ return /* @__PURE__ */ jsxs(ThemeContext.Provider, { value: theme, children: [
10
18
  /* @__PURE__ */ jsx(Global, { styles: createGlobalStyle(theme) }),
11
- /* @__PURE__ */ jsx(LocaleContext.Provider, { value: locale, children })
19
+ children
12
20
  ] });
13
21
  };
14
22
  const createGlobalStyle = ({ palette, typography }) => {
@@ -294,5 +302,6 @@ const createGlobalStyle = ({ palette, typography }) => {
294
302
  };
295
303
  };
296
304
  export {
297
- ThemeProvider
305
+ ThemeProvider,
306
+ useTheme
298
307
  };
@@ -10,10 +10,5 @@ type TypographySizeVariantCSS = {
10
10
  lineHeight: string;
11
11
  };
12
12
  export type ThemeTypography = Record<TypographySizeVariant, TypographySizeVariantCSS>;
13
- declare module '@emotion/react' {
14
- interface Theme {
15
- typography: ThemeTypography;
16
- }
17
- }
18
13
  export {};
19
14
  //# sourceMappingURL=typography.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/theme/typography.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAC7B,IAAI,GACJ,IAAI,GACJ,MAAM,GACN,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAC;AAEV,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,qBAAqB,OAAO,CAAC;;;CASvE,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAW5B,CAAC;AAEF,eAAO,MAAM,4BAA4B,aAAc,qBAAqB,4BAQ3E,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,CAAC;AAEtF,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAiB,KAAK;QACpB,UAAU,EAAE,eAAe,CAAC;KAC7B;CACF"}
1
+ {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/theme/typography.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAC7B,IAAI,GACJ,IAAI,GACJ,MAAM,GACN,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAC;AAEV,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,qBAAqB,OAAO,CAAC;;;CASvE,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAW5B,CAAC;AAEF,eAAO,MAAM,4BAA4B,aAAc,qBAAqB,4BAQ3E,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janbox/storefront-ui",
3
- "version": "2.0.20",
3
+ "version": "2.0.22",
4
4
  "description": "Storefront UI component library for Janbox",
5
5
  "author": "Janbox",
6
6
  "keywords": [
@@ -1,4 +0,0 @@
1
- {
2
- "apply": "Apply",
3
- "updating": "Updating"
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "apply": "Áp dụng",
3
- "updating": "Đang cập nhật"
4
- }