@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.
- package/dist/hooks/use-window-screen/index.d.ts +1 -1
- package/dist/i18n/index.d.ts +0 -1
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +5 -4
- package/dist/lib/cascader/cascader.d.ts.map +1 -1
- package/dist/lib/flexbox/flexbox/flexbox.js +5 -7
- package/dist/lib/pagination/pagination.js +7 -7
- package/dist/lib/pagination/types.d.ts +1 -1
- package/dist/lib/pagination/types.d.ts.map +1 -1
- package/dist/lib/stepper/step.d.ts.map +1 -1
- package/dist/lib/tabs/tab-list/tab-list.d.ts +1 -1
- package/dist/lib/tabs/tab-list/tab-list.d.ts.map +1 -1
- package/dist/lib/tabs/tab-list/tab-list.js +26 -20
- package/dist/lib/tabs/tab-list/types.d.ts +2 -3
- package/dist/lib/tabs/tab-list/types.d.ts.map +1 -1
- package/dist/lib/text/helpers.d.ts +2 -2
- package/dist/lib/text/helpers.d.ts.map +1 -1
- package/dist/theme/index.d.ts +7 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +3 -2
- package/dist/theme/palette.d.ts +0 -5
- package/dist/theme/palette.d.ts.map +1 -1
- package/dist/theme/provider.d.ts +3 -3
- package/dist/theme/provider.d.ts.map +1 -1
- package/dist/theme/provider.js +15 -6
- package/dist/theme/typography.d.ts +0 -5
- package/dist/theme/typography.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/locales/en/ui__translation.json +0 -4
- package/dist/locales/vi/ui__translation.json +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Screen } from '../../theme';
|
|
2
2
|
export declare const useWindowScreen: () => {
|
|
3
|
-
name: "xs" | "sm" | "
|
|
3
|
+
name: "xs" | "sm" | "lg" | "md" | undefined;
|
|
4
4
|
isSmallerThan: (target: Screen) => boolean;
|
|
5
5
|
isLargerThan: (target: Screen) => boolean;
|
|
6
6
|
};
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -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;
|
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;AASnC,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,eAAO,MAAM,cAAc;aAKZ,MAAM,OAAO,EAAE;;CAI7B,CAAC"}
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
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 =
|
|
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":"
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
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,
|
|
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 >=
|
|
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 >=
|
|
67
|
-
if (onChange) onChange(
|
|
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 >=
|
|
142
|
-
showLastPageButton && /* @__PURE__ */ jsx(PaginationButton, { "aria-disabled": page >=
|
|
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
|
-
|
|
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,
|
|
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,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,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;CAGH,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,uBAAuB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/lib/stepper/step.tsx"],"names":[],"mappings":"
|
|
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("
|
|
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":"
|
|
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 "
|
|
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
|
-
|
|
10
|
+
return /* @__PURE__ */ jsxs(
|
|
11
|
+
Primitive,
|
|
11
12
|
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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 {
|
|
1
|
+
import { PrimitiveProps } from '../../primitive';
|
|
2
2
|
import { JSX } from 'react';
|
|
3
|
-
export type
|
|
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,
|
|
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 {
|
|
4
|
-
export declare const getTextCssByVariant: (variant?: TextVariant) => Partial<Record<Screen,
|
|
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;
|
|
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"}
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -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"}
|
package/dist/theme/index.js
CHANGED
|
@@ -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
|
};
|
package/dist/theme/palette.d.ts
CHANGED
|
@@ -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,WAAW,EAAE,aAAa,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,UAAU,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,UAAU,CAAC;IACtB,GAAG,EAAE,UAAU,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;AAExC,eAAO,MAAM,WAAW,EAAE,OAoHzB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,YAAY,EA+IvC,CAAC;AAEF,eAAO,MAAM,UAAU,sCAAwB,OAAO,yCAiBrD,CAAC
|
|
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,WAAW,EAAE,aAAa,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,UAAU,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,UAAU,CAAC;IACtB,GAAG,EAAE,UAAU,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;AAExC,eAAO,MAAM,WAAW,EAAE,OAoHzB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,YAAY,EA+IvC,CAAC;AAEF,eAAO,MAAM,UAAU,sCAAwB,OAAO,yCAiBrD,CAAC"}
|
package/dist/theme/provider.d.ts
CHANGED
|
@@ -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
|
|
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":"
|
|
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"}
|
package/dist/theme/provider.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
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
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
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
|
-
|
|
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
|
|
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