@janbox/storefront-ui 2.0.22 → 2.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/use-formatter/index.d.ts.map +1 -1
- package/dist/hooks/use-formatter/index.js +3 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +4 -5
- package/dist/lib/marquee/marquee/helpers.d.ts.map +1 -1
- package/dist/theme/index.d.ts +0 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +2 -1
- package/dist/theme/provider.d.ts +2 -1
- package/dist/theme/provider.d.ts.map +1 -1
- package/dist/theme/provider.js +3 -2
- package/dist/theme/screens.d.ts +1 -0
- package/dist/theme/screens.d.ts.map +1 -1
- package/dist/theme/screens.js +4 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-formatter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAElB,qBAAqB,EAErB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,eAAO,MAAM,YAAY;0BAIb,MAAM,YAAY,OAAO,CAAC,mBAAmB,CAAC;4BAO9C,IAAI,GAAG,MAAM,GAAG,MAAM,WAAW,WAAW,CAAC,qBAAqB,EAAE,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-formatter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAElB,qBAAqB,EAErB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,eAAO,MAAM,YAAY;0BAIb,MAAM,YAAY,OAAO,CAAC,mBAAmB,CAAC;4BAO9C,IAAI,GAAG,MAAM,GAAG,MAAM,WAAW,WAAW,CAAC,qBAAqB,EAAE,KAAK,CAAC;yBAe1E,MAAM,WAAW,WAAW,CAAC,kBAAkB,EAAE,KAAK,CAAC;CAclE,CAAC"}
|
|
@@ -11,7 +11,10 @@ const useFormatter = () => {
|
|
|
11
11
|
);
|
|
12
12
|
const formatDateTimeFn = useCallback(
|
|
13
13
|
(value, options) => {
|
|
14
|
+
const hasStyleOption = options.dateStyle !== void 0 || options.timeStyle !== void 0;
|
|
15
|
+
const defaults = hasStyleOption ? {} : { day: "2-digit", month: "2-digit", year: "numeric", hour: "numeric", minute: "2-digit", hour12: false };
|
|
14
16
|
return formatDateTime(value, {
|
|
17
|
+
...defaults,
|
|
15
18
|
...options,
|
|
16
19
|
lng: options.lng ?? locale
|
|
17
20
|
});
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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>;
|
|
3
4
|
export declare const useTranslation: () => {
|
|
4
5
|
t: (key: keyof typeof en) => string;
|
|
5
6
|
locale: string;
|
package/dist/i18n/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
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"}
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
1
|
+
import { useContext, useMemo, createContext } 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";
|
|
7
4
|
const translations = {
|
|
8
5
|
en,
|
|
9
6
|
vi
|
|
10
7
|
};
|
|
11
8
|
const FALLBACK_LOCALE = "en";
|
|
9
|
+
const LocaleContext = createContext(FALLBACK_LOCALE);
|
|
12
10
|
const useTranslation = () => {
|
|
13
|
-
const
|
|
11
|
+
const locale = useContext(LocaleContext);
|
|
14
12
|
return useMemo(() => {
|
|
15
13
|
return {
|
|
16
14
|
t: (key) => {
|
|
@@ -23,5 +21,6 @@ const useTranslation = () => {
|
|
|
23
21
|
};
|
|
24
22
|
export {
|
|
25
23
|
FALLBACK_LOCALE,
|
|
24
|
+
LocaleContext,
|
|
26
25
|
useTranslation
|
|
27
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/lib/marquee/marquee/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/lib/marquee/marquee/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAWvC,eAAO,MAAM,eAAe,aAAc,YAAY,iBAErD,CAAC"}
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;CAC7B;AAED,eAAO,MAAM,gBAAgB,OAAO,CAAC"}
|
package/dist/theme/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { breakpoint, getSmallerScreens, mediaQuery, screens } from "./screens.js";
|
|
1
|
+
import { breakpoint, containerQuery, 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
4
|
import { ThemeProvider, useTheme } from "./provider.js";
|
|
@@ -7,6 +7,7 @@ export {
|
|
|
7
7
|
FLOATING_Z_INDEX,
|
|
8
8
|
ThemeProvider,
|
|
9
9
|
breakpoint,
|
|
10
|
+
containerQuery,
|
|
10
11
|
getColorVar,
|
|
11
12
|
getSmallerScreens,
|
|
12
13
|
getSmallerTypographyVariants,
|
package/dist/theme/provider.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { PropsWithChildren } from 'react';
|
|
|
2
2
|
import { Theme } from '.';
|
|
3
3
|
export type ThemeProviderProps = PropsWithChildren<{
|
|
4
4
|
theme: Theme;
|
|
5
|
+
locale?: string;
|
|
5
6
|
}>;
|
|
6
7
|
export declare const useTheme: () => Theme;
|
|
7
|
-
export declare const ThemeProvider: ({ theme, children }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const ThemeProvider: ({ theme, children, locale }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/theme/provider.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,KAAK,iBAAiB,EAAE,MAAM,OAAO,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;AAO1E,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;AAE1B,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;IACjD,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAEH,eAAO,MAAM,QAAQ,aAMpB,CAAC;AAIF,eAAO,MAAM,aAAa,gCAAmD,kBAAkB,4CAO9F,CAAC"}
|
package/dist/theme/provider.js
CHANGED
|
@@ -5,6 +5,7 @@ import { getColorVar } from "./palette.js";
|
|
|
5
5
|
import { flatten } from "flat";
|
|
6
6
|
import { flatMap } from "lodash-es";
|
|
7
7
|
import { getTypographyVar } from "./typography.js";
|
|
8
|
+
import { LocaleContext, FALLBACK_LOCALE } from "../i18n/index.js";
|
|
8
9
|
const useTheme = () => {
|
|
9
10
|
const context = useContext(ThemeContext);
|
|
10
11
|
if (!context) {
|
|
@@ -13,10 +14,10 @@ const useTheme = () => {
|
|
|
13
14
|
return context;
|
|
14
15
|
};
|
|
15
16
|
const ThemeContext = createContext(null);
|
|
16
|
-
const ThemeProvider = ({ theme, children }) => {
|
|
17
|
+
const ThemeProvider = ({ theme, children, locale = FALLBACK_LOCALE }) => {
|
|
17
18
|
return /* @__PURE__ */ jsxs(ThemeContext.Provider, { value: theme, children: [
|
|
18
19
|
/* @__PURE__ */ jsx(Global, { styles: createGlobalStyle(theme) }),
|
|
19
|
-
children
|
|
20
|
+
/* @__PURE__ */ jsx(LocaleContext.Provider, { value: locale, children })
|
|
20
21
|
] });
|
|
21
22
|
};
|
|
22
23
|
const createGlobalStyle = ({ palette, typography }) => {
|
package/dist/theme/screens.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export declare const breakpoint: Record<Screen, BreakpointConfig>;
|
|
|
7
7
|
export declare const screens: Screen[];
|
|
8
8
|
export declare const getSmallerScreens: (screen: Screen) => Screen[];
|
|
9
9
|
export declare const mediaQuery: (value: Screen | number) => string;
|
|
10
|
+
export declare const containerQuery: (value: Screen | number) => string;
|
|
10
11
|
export {};
|
|
11
12
|
//# sourceMappingURL=screens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screens.d.ts","sourceRoot":"","sources":["../../src/theme/screens.ts"],"names":[],"mappings":"AAEA,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/C,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAKvD,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAAM,EAA6B,CAAC;AAE1D,eAAO,MAAM,iBAAiB,WAAY,MAAM,aAE/C,CAAC;AAEF,eAAO,MAAM,UAAU,UAAW,MAAM,GAAG,MAAM,WAEhD,CAAC"}
|
|
1
|
+
{"version":3,"file":"screens.d.ts","sourceRoot":"","sources":["../../src/theme/screens.ts"],"names":[],"mappings":"AAEA,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/C,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAKvD,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAAM,EAA6B,CAAC;AAE1D,eAAO,MAAM,iBAAiB,WAAY,MAAM,aAE/C,CAAC;AAEF,eAAO,MAAM,UAAU,UAAW,MAAM,GAAG,MAAM,WAEhD,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,MAAM,GAAG,MAAM,WAEpD,CAAC"}
|
package/dist/theme/screens.js
CHANGED
|
@@ -16,8 +16,12 @@ const getSmallerScreens = (screen) => {
|
|
|
16
16
|
const mediaQuery = (value) => {
|
|
17
17
|
return `@media (min-width: ${isNumber(value) ? value : breakpoint[value].minWidth}px)`;
|
|
18
18
|
};
|
|
19
|
+
const containerQuery = (value) => {
|
|
20
|
+
return `@container (min-width: ${isNumber(value) ? value : breakpoint[value].minWidth}px)`;
|
|
21
|
+
};
|
|
19
22
|
export {
|
|
20
23
|
breakpoint,
|
|
24
|
+
containerQuery,
|
|
21
25
|
getSmallerScreens,
|
|
22
26
|
mediaQuery,
|
|
23
27
|
screens
|