@janbox/storefront-ui 4.0.3 → 4.0.5

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.
@@ -3,8 +3,8 @@ import { useRef } from "react";
3
3
  import { motion } from "motion/react";
4
4
  import { getAccordionContentProps } from "./helpers.js";
5
5
  import { useAccordionContext } from "../accordion/helpers.js";
6
- import { useAccordionGroupContext } from "../accordion-group/helpers.js";
7
6
  import { Stylesheet } from "../../stylesheet/stylesheet.js";
7
+ import { useAccordionGroupContext } from "../accordion-group/helpers.js";
8
8
  import { Primitive } from "../../primitive/primitive.js";
9
9
  const AccordionContent = ({ children, ref, ..._props }) => {
10
10
  const { accordionContentProps: accordionContentPropsByGroup = {} } = useAccordionGroupContext();
@@ -213,7 +213,7 @@ const CascaderFloatingContent = ({
213
213
  css: {
214
214
  color: getColorVar("neutral.500"),
215
215
  transition: "color 150ms",
216
- "&:hover": { color: getColorVar("primary.600") }
216
+ ":hover": { color: getColorVar("primary.600") }
217
217
  },
218
218
  children: "All"
219
219
  }
@@ -234,7 +234,7 @@ const CascaderFloatingContent = ({
234
234
  color: idx === expandedOptions.length - 1 ? getColorVar("primary.600") : getColorVar("neutral.600"),
235
235
  fontWeight: idx === expandedOptions.length - 1 ? 500 : void 0,
236
236
  transition: "color 150ms",
237
- "&:hover": { color: getColorVar("primary.600") }
237
+ ":hover": { color: getColorVar("primary.600") }
238
238
  },
239
239
  children: opt.breadcrumbLabel ?? opt.label
240
240
  }
@@ -1,2 +1,2 @@
1
1
  import { DialogFooterProps } from './types';
2
- export declare const DialogFooter: (props: DialogFooterProps) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare const DialogFooter: ({ sx, ...props }: DialogFooterProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,20 +1,20 @@
1
- import { jsx } from "@emotion/react/jsx-runtime";
2
- import { mediaQuery } from "../../../theme/screens.js";
3
- import "../../../theme/palette.js";
4
- const DialogFooter = (props) => {
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Primitive } from "../../primitive/primitive.js";
3
+ const DialogFooter = ({ sx, ...props }) => {
5
4
  return /* @__PURE__ */ jsx(
6
- "div",
5
+ Primitive,
7
6
  {
8
- css: {
7
+ sx: {
9
8
  display: "flex",
10
9
  justifyContent: "flex-end",
11
- gap: "0.5rem",
12
- paddingTop: "0.5rem",
13
- paddingBottom: "0.5rem",
14
- paddingLeft: "1rem",
15
- paddingRight: "1rem",
10
+ gap: 8,
11
+ paddingTop: 8,
12
+ paddingBottom: 8,
13
+ paddingLeft: 16,
14
+ paddingRight: 16,
16
15
  position: "relative",
17
- [mediaQuery("sm")]: { paddingLeft: "1.25rem", paddingRight: "1.25rem" }
16
+ ...sx,
17
+ sm: { paddingLeft: 20, paddingRight: 20, ...sx == null ? void 0 : sx.sm }
18
18
  },
19
19
  ...props
20
20
  }
@@ -1,3 +1,3 @@
1
- import { HTMLAttributes } from 'react';
2
- export interface DialogFooterProps extends HTMLAttributes<HTMLDivElement> {
3
- }
1
+ import { PrimitiveProps } from '../../primitive';
2
+ import { JSX } from 'react';
3
+ export type DialogFooterProps = PrimitiveProps<JSX.IntrinsicElements['div'], 'div'>;
@@ -1,14 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { ClassNames } from "@emotion/react";
3
2
  import { isNil } from "lodash-es";
4
3
  import { Link as Link$1 } from "react-router";
5
4
  import { getLinkProps } from "./helpers.js";
6
5
  import { Booleanish } from "../../constants/index.js";
7
6
  import "react";
8
- import { mediaQuery } from "../../theme/screens.js";
9
7
  import "../../theme/palette.js";
10
8
  import { getTypographyVar } from "../../theme/typography.js";
11
9
  import { createUnderlineEffect } from "../../utils/stylesheet.js";
10
+ import { Stylesheet } from "../stylesheet/stylesheet.js";
12
11
  const Link = ({ children, ref, ..._props }) => {
13
12
  const { sx, textVariant, sm, md, lg, to, underline = false, className, ...rest } = getLinkProps(_props);
14
13
  const onClick = (e) => {
@@ -21,10 +20,10 @@ const Link = ({ children, ref, ..._props }) => {
21
20
  }
22
21
  (_a = rest.onClick) == null ? void 0 : _a.call(rest, e);
23
22
  };
24
- return /* @__PURE__ */ jsx(ClassNames, { children: ({ cx, css }) => /* @__PURE__ */ jsx(
23
+ return /* @__PURE__ */ jsx(Stylesheet, { children: ({ cx, css }) => /* @__PURE__ */ jsx(
25
24
  Link$1,
26
25
  {
27
- to: to ?? "#",
26
+ to: to ?? "",
28
27
  className: cx(
29
28
  className,
30
29
  css({
@@ -34,15 +33,15 @@ const Link = ({ children, ref, ..._props }) => {
34
33
  ...underline ? createUnderlineEffect() : {},
35
34
  ...createStyle({ textVariant }),
36
35
  ...sx,
37
- [mediaQuery("sm")]: {
36
+ sm: {
38
37
  ...createStyle(sm),
39
38
  ...sx == null ? void 0 : sx.sm
40
39
  },
41
- [mediaQuery("md")]: {
40
+ md: {
42
41
  ...createStyle(md),
43
42
  ...sx == null ? void 0 : sx.md
44
43
  },
45
- [mediaQuery("lg")]: {
44
+ lg: {
46
45
  ...createStyle(lg),
47
46
  ...sx == null ? void 0 : sx.lg
48
47
  }
@@ -1,5 +1,4 @@
1
1
  import { JSX } from 'react';
2
- import { EmblaCarouselType } from 'embla-carousel';
3
2
  import { AutoplayOptionsType } from 'embla-carousel-autoplay';
4
3
  import { default as useEmblaCarousel } from 'embla-carousel-react';
5
4
  import { ShallowMerge, ToResponsiveProps } from '../../../types';
@@ -7,7 +6,7 @@ import { SwiperDotsPagingProps } from '../swiper-dots-paging';
7
6
  import { SwiperSideArrowsPagingProps } from '../swiper-side-arrows-paging';
8
7
  import { PrimitiveProps } from '../../primitive';
9
8
  export type SwiperOptions = Parameters<typeof useEmblaCarousel>[0];
10
- export type SwiperApi = EmblaCarouselType;
9
+ export type SwiperApi = NonNullable<ReturnType<typeof useEmblaCarousel>[1]>;
11
10
  export type SwiperResponsiveProps = {
12
11
  slidesPerView?: number | 'auto';
13
12
  spaceBetween?: number;
@@ -1,8 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useRef, useState, useEffect } from "react";
3
3
  import { motion } from "motion/react";
4
- import { useTabsContext } from "../tabs/helpers.js";
5
4
  import { Stylesheet } from "../../stylesheet/stylesheet.js";
5
+ import { useTabsContext } from "../tabs/helpers.js";
6
6
  const TabIndicator = () => {
7
7
  const { activeIndex, tabIndicatorProps } = useTabsContext();
8
8
  const indicatorEl = useRef(null);
@@ -1,13 +1,10 @@
1
- import { FloatingPortal } from '@floating-ui/react';
2
- import { ComponentProps, PropsWithChildren } from 'react';
1
+ import { PropsWithChildren } from 'react';
3
2
  import { Theme } from '.';
4
- type PortalContainer = ComponentProps<typeof FloatingPortal>['root'];
5
3
  export type ThemeProviderProps = PropsWithChildren<{
6
4
  theme: Theme;
7
5
  locale?: string;
8
- root?: PortalContainer;
6
+ root?: HTMLElement;
9
7
  }>;
10
- export declare const usePortalContainer: () => HTMLElement | ShadowRoot | import('react').MutableRefObject<HTMLElement | ShadowRoot | null> | null | undefined;
8
+ export declare const usePortalContainer: () => HTMLElement | null;
11
9
  export declare const useTheme: () => Theme;
12
10
  export declare const ThemeProvider: ({ theme, children, locale, root }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
13
- export {};
@@ -1,9 +1,11 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Global } from "@emotion/react";
3
- import { useContext, createContext } from "react";
2
+ import { CacheProvider, Global } from "@emotion/react";
3
+ import createCache from "@emotion/cache";
4
+ import { useState, useContext, createContext } from "react";
4
5
  import { getColorVar } from "./palette.js";
5
6
  import { flatten } from "flat";
6
7
  import { flatMap } from "lodash-es";
8
+ import { prefixer } from "stylis";
7
9
  import { getTypographyVar } from "./typography.js";
8
10
  import { LocaleContext, FALLBACK_LOCALE } from "../i18n/index.js";
9
11
  const usePortalContainer = () => {
@@ -19,10 +21,11 @@ const useTheme = () => {
19
21
  const ThemeContext = createContext(null);
20
22
  const PortalContainerContext = createContext(null);
21
23
  const ThemeProvider = ({ theme, children, locale = FALLBACK_LOCALE, root }) => {
22
- return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsxs(PortalContainerContext.Provider, { value: root ?? null, children: [
24
+ const [emotionCache] = useState(() => createCache({ key: "jb", container: root, stylisPlugins: [prefixer] }));
25
+ return /* @__PURE__ */ jsx(CacheProvider, { value: emotionCache, children: /* @__PURE__ */ jsx(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsxs(PortalContainerContext.Provider, { value: root ?? null, children: [
23
26
  /* @__PURE__ */ jsx(Global, { styles: createGlobalStyle(theme) }),
24
27
  /* @__PURE__ */ jsx(LocaleContext.Provider, { value: locale, children })
25
- ] }) });
28
+ ] }) }) });
26
29
  };
27
30
  const createGlobalStyle = ({ palette, typography }) => {
28
31
  const flattenPalette = flatten(palette);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janbox/storefront-ui",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
4
4
  "description": "Storefront UI component library for Janbox",
5
5
  "author": "Janbox",
6
6
  "keywords": [
@@ -53,12 +53,13 @@
53
53
  "access": "restricted"
54
54
  },
55
55
  "peerDependencies": {
56
- "@emotion/react": "*",
57
56
  "react": ">=19.0.0",
58
57
  "react-dom": ">=19.0.0",
59
58
  "react-router": ">=7.0.0"
60
59
  },
61
60
  "dependencies": {
61
+ "@emotion/cache": "^11.14.0",
62
+ "@emotion/react": "^11.14.0",
62
63
  "@floating-ui/react": "^0.27.13",
63
64
  "@floating-ui/react-dom": "^2.1.8",
64
65
  "@tanstack/react-virtual": "^3.10.9",
@@ -78,7 +79,8 @@
78
79
  "react-date-range": "^2.0.1",
79
80
  "react-error-boundary": "^6.1.2",
80
81
  "react-player": "^3.3.3",
81
- "react-zoom-pan-pinch": "^3.7.0"
82
+ "react-zoom-pan-pinch": "^3.7.0",
83
+ "stylis": "^4.4.0"
82
84
  },
83
85
  "devDependencies": {
84
86
  "@eslint/js": "^9.24.0",
@@ -90,6 +92,7 @@
90
92
  "@types/react": "^19.1.8",
91
93
  "@types/react-date-range": "^1.4.10",
92
94
  "@types/react-dom": "^19.1.6",
95
+ "@types/stylis": "^4.2.7",
93
96
  "csstype": "^3.1.3",
94
97
  "eslint": "^9.24.0",
95
98
  "eslint-config-prettier": "^10.1.8",