@janbox/storefront-ui 2.0.16 → 2.0.18

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,3 +1,3 @@
1
1
  import { BadgeProps } from './types';
2
- export declare const Badge: ({ children, ref, ..._props }: BadgeProps) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare const Badge: ({ color, content, offset, children }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=badge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/badge.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIrC,eAAO,MAAM,KAAK,iCAAkC,UAAU,qDAmC7D,CAAC"}
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/badge.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAOrC,eAAO,MAAM,KAAK,yCAAsD,UAAU,4CAgEjF,CAAC"}
@@ -1,39 +1,67 @@
1
- import { jsxs, jsx } from "@emotion/react/jsx-runtime";
2
- import { isNumber } from "lodash-es";
3
- import { getBadgeProps } from "./helpers.js";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { isNil, isNumber } from "lodash-es";
3
+ import { useFloating, autoUpdate, offset, useMergeRefs, FloatingPortal } from "@floating-ui/react";
4
4
  import { getColorShadesByVariant } from "../../utils/index.js";
5
- const Badge = ({ children, ref, ..._props }) => {
6
- const { badgeContent, color = "primary", ...rest } = getBadgeProps(_props);
7
- const { main } = getColorShadesByVariant(color);
8
- return /* @__PURE__ */ jsxs("div", { css: { position: "relative", display: "inline-block" }, ...rest, ref, children: [
9
- /* @__PURE__ */ jsx(
10
- "span",
5
+ import { cloneElement } from "react";
6
+ import { FLOATING_Z_INDEX } from "../../theme/index.js";
7
+ import { Primitive } from "../primitive/primitive.js";
8
+ import { getTypographyVar } from "../../theme/typography.js";
9
+ const Badge = ({ color = "red", content, offset: offset$1 = 0, children }) => {
10
+ const { main, contrast } = getColorShadesByVariant(color);
11
+ const {
12
+ floatingStyles,
13
+ refs: { setFloating, setReference },
14
+ context
15
+ } = useFloating({
16
+ placement: "top-end",
17
+ middleware: [
18
+ offset(({ rects }) => {
19
+ const offsetX = isNumber(offset$1) ? offset$1 : offset$1.x ?? 0;
20
+ const offsetY = isNumber(offset$1) ? offset$1 : offset$1.y ?? 0;
21
+ return {
22
+ crossAxis: Math.round(rects.floating.width / 2) + offsetX,
23
+ mainAxis: -Math.round(rects.floating.height / 2) + offsetY
24
+ };
25
+ })
26
+ ],
27
+ whileElementsMounted: autoUpdate,
28
+ open: !isNil(content)
29
+ });
30
+ const mergedRefs = useMergeRefs([setReference, children.props.ref]);
31
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
32
+ cloneElement(children, {
33
+ ...children.props,
34
+ ref: mergedRefs
35
+ }),
36
+ context.open && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
37
+ "div",
11
38
  {
12
- css: {
13
- backgroundColor: main,
14
- width: "1.25rem",
15
- height: "1.25rem",
16
- zIndex: 10,
17
- display: "flex",
18
- opacity: 1,
19
- alignItems: "center",
20
- justifyContent: "center",
21
- borderRadius: "9999px",
22
- borderWidth: "1px",
23
- borderStyle: "solid",
24
- borderColor: "#FFFFFF",
25
- color: "#FFFFFF",
26
- fontSize: "0.75rem",
27
- lineHeight: "1rem",
28
- fontWeight: 400,
29
- position: "absolute",
30
- top: 0,
31
- right: 0
39
+ style: {
40
+ zIndex: FLOATING_Z_INDEX,
41
+ ...floatingStyles
32
42
  },
33
- children: isNumber(badgeContent) ? badgeContent > 9 ? "9+" : badgeContent : badgeContent
43
+ ref: setFloating,
44
+ children: /* @__PURE__ */ jsx(
45
+ Primitive,
46
+ {
47
+ sx: {
48
+ display: "flex",
49
+ color: contrast,
50
+ alignItems: "center",
51
+ justifyContent: "center",
52
+ backgroundColor: main,
53
+ fontSize: getTypographyVar("xs").fontSize,
54
+ lineHeight: 1,
55
+ padding: 2,
56
+ minWidth: 20,
57
+ minHeight: 20,
58
+ borderRadius: 9999
59
+ },
60
+ children: content
61
+ }
62
+ )
34
63
  }
35
- ),
36
- children
64
+ ) })
37
65
  ] });
38
66
  };
39
67
  export {
@@ -1,7 +1,17 @@
1
- import { JSX } from 'react';
2
- import { ColorVariant, ShallowMerge } from '../../types';
3
- export type BadgeProps = ShallowMerge<JSX.IntrinsicElements['div'], {
4
- badgeContent?: number | string;
1
+ import { ReactElement, Ref } from 'react';
2
+ import { ColorVariant } from '../../types';
3
+ export type BadgeProps<T extends {
4
+ ref?: Ref<Element>;
5
+ } = {
6
+ ref?: Ref<Element>;
7
+ }> = {
8
+ content?: number | string;
5
9
  color?: ColorVariant;
6
- }>;
10
+ offset?: number | {
11
+ x?: number;
12
+ y?: number;
13
+ };
14
+ offsetY?: number;
15
+ children: ReactElement<T>;
16
+ };
7
17
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG,YAAY,CACnC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAC5B;IACE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,CACF,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CAAE,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CAAE,IAAI;IAClF,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EACH,MAAM,GACN;QACE,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ,CAAC;IACN,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;CAC3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"swiper-side-arrows-paging.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper-side-arrows-paging/swiper-side-arrows-paging.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,2BAA2B,EAAE,qCAAqC,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EAA8B,SAAS,EAAqB,MAAM,SAAS,CAAC;AAQnF,eAAO,MAAM,sBAAsB,oFAWhC,2BAA2B,4CA4L7B,CAAC;AA2IF,eAAO,MAAM,mBAAmB,kBAE7B,IAAI,CAAC,qCAAqC,EAAE,SAAS,CAAC,KAAQ,SAMhE,CAAC"}
1
+ {"version":3,"file":"swiper-side-arrows-paging.d.ts","sourceRoot":"","sources":["../../../../src/lib/swiper/swiper-side-arrows-paging/swiper-side-arrows-paging.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,2BAA2B,EAAE,qCAAqC,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EAA8B,SAAS,EAAqB,MAAM,SAAS,CAAC;AAQnF,eAAO,MAAM,sBAAsB,oFAWhC,2BAA2B,4CA0L7B,CAAC;AA2IF,eAAO,MAAM,mBAAmB,kBAE7B,IAAI,CAAC,qCAAqC,EAAE,SAAS,CAAC,KAAQ,SAMhE,CAAC"}
@@ -19,8 +19,8 @@ const SwiperSideArrowsPaging = ({
19
19
  md,
20
20
  lg
21
21
  }) => {
22
- const [canScrollPrev, setCanScrollPrev] = useState(false);
23
- const [canScrollNext, setCanScrollNext] = useState(false);
22
+ const [canScrollPrev, setCanScrollPrev] = useState(api.canScrollPrev());
23
+ const [canScrollNext, setCanScrollNext] = useState(api.canScrollNext());
24
24
  const [isVisible, setIsVisible] = useState(visibility === "always");
25
25
  const [referenceStyle, setReferenceStyle] = useState(anchorSelector ? {} : { top: 0, bottom: 0 });
26
26
  const hoverStateRef = useRef({ root: false, floating: false });
@@ -57,16 +57,15 @@ const SwiperSideArrowsPaging = ({
57
57
  setCanScrollPrev(emblaApi.canScrollPrev());
58
58
  setCanScrollNext(emblaApi.canScrollNext());
59
59
  };
60
- if (api) {
61
- updateScrollState(api);
62
- }
63
- api == null ? void 0 : api.on("select", updateScrollState);
60
+ api.on("select", updateScrollState);
61
+ api.on("slidesChanged", updateScrollState);
64
62
  return () => {
65
- api == null ? void 0 : api.off("select", updateScrollState);
63
+ api.off("select", updateScrollState);
64
+ api.off("slidesChanged", updateScrollState);
66
65
  };
67
66
  }, [api]);
68
67
  useEffect(() => {
69
- if (visibility === "always" || !api) return;
68
+ if (visibility === "always") return;
70
69
  const rootNode = api == null ? void 0 : api.rootNode();
71
70
  const onRootEnter = () => {
72
71
  hoverStateRef.current.root = true;
@@ -84,7 +83,7 @@ const SwiperSideArrowsPaging = ({
84
83
  };
85
84
  }, [api, updateVisibility, visibility]);
86
85
  useEffect(() => {
87
- if (!anchorSelector || !api) return;
86
+ if (!anchorSelector) return;
88
87
  const rootNode = api.rootNode();
89
88
  const update = () => {
90
89
  const anchorEl2 = rootNode.querySelector(anchorSelector);
@@ -109,9 +108,9 @@ const SwiperSideArrowsPaging = ({
109
108
  const onButtonClick = (e) => {
110
109
  const direction = e.currentTarget.dataset.direction;
111
110
  if (direction === "next") {
112
- api == null ? void 0 : api.scrollNext();
111
+ api.scrollNext();
113
112
  } else {
114
- api == null ? void 0 : api.scrollPrev();
113
+ api.scrollPrev();
115
114
  }
116
115
  };
117
116
  const onFloatingMouseEnter = (_e) => {
@@ -2,5 +2,5 @@ import { ReactNode } from 'react';
2
2
  import { TooltipOptions } from './types';
3
3
  export declare function Tooltip({ children, defaultOpen, placement, open, onOpenChange, content, contentWidth, enable, handleClose, arrowProps, }: {
4
4
  children: ReactNode;
5
- } & TooltipOptions): import("@emotion/react/jsx-runtime").JSX.Element;
5
+ } & TooltipOptions): import("react/jsx-runtime").JSX.Element;
6
6
  //# sourceMappingURL=tooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/lib/tooltip/tooltip.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAiB,SAAS,EAAwB,MAAM,OAAO,CAAC;AAuBvE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAKzC,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,WAAmB,EACnB,SAAiB,EACjB,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,MAAa,EACb,WAAW,EACX,UAAU,GACX,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,GAAG,cAAc,oDA2G1C"}
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/lib/tooltip/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAwB,MAAM,OAAO,CAAC;AAuBvE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAMzC,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,WAAmB,EACnB,SAAiB,EACjB,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,MAAa,EACb,WAAW,EACX,UAAU,GACX,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,GAAG,cAAc,2CA4G1C"}
@@ -1,10 +1,11 @@
1
- import { jsxs, jsx } from "@emotion/react/jsx-runtime";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { useRef, cloneElement } from "react";
3
3
  import { useFloating, autoUpdate, offset, flip, shift, arrow, size, useHover, safePolygon, useFocus, useDismiss, useRole, useInteractions, useMergeRefs, FloatingPortal, FloatingArrow } from "@floating-ui/react";
4
4
  import { isUndefined, get } from "lodash-es";
5
5
  import { useControllableState } from "../../hooks/use-controllable-state.js";
6
- import "../../theme/palette.js";
6
+ import { getColorVar } from "../../theme/palette.js";
7
7
  import { getTypographyVar } from "../../theme/typography.js";
8
+ import { Primitive } from "../primitive/primitive.js";
8
9
  function Tooltip({
9
10
  children,
10
11
  defaultOpen = false,
@@ -36,7 +37,6 @@ function Tooltip({
36
37
  };
37
38
  const { refs, floatingStyles, context } = useFloating({
38
39
  placement,
39
- open: visible,
40
40
  onOpenChange: handleOpenChange,
41
41
  whileElementsMounted: autoUpdate,
42
42
  middleware: [
@@ -58,7 +58,8 @@ function Tooltip({
58
58
  Object.assign(elements.floating.style, styles);
59
59
  }
60
60
  })
61
- ]
61
+ ],
62
+ open: visible
62
63
  });
63
64
  const hover = useHover(context, {
64
65
  move: false,
@@ -68,33 +69,31 @@ function Tooltip({
68
69
  const dismiss = useDismiss(context);
69
70
  const role = useRole(context, { role: "tooltip" });
70
71
  const { getReferenceProps, getFloatingProps } = useInteractions([hover, focus, dismiss, role]);
71
- const ref = useMergeRefs([refs.setReference, get(children, "ref"), triggerRef]);
72
- return /* @__PURE__ */ jsxs("div", { children: [
72
+ const mergedRefs = useMergeRefs([refs.setReference, get(children, "ref"), triggerRef]);
73
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
73
74
  cloneElement(
74
75
  children,
75
76
  getReferenceProps({
76
- ref,
77
- ...children == null ? void 0 : children.props,
78
- "data-state": visible ? "open" : "closed"
77
+ ...children.props,
78
+ ref: mergedRefs
79
79
  })
80
80
  ),
81
- /* @__PURE__ */ jsx(FloatingPortal, { children: visible && /* @__PURE__ */ jsxs(
82
- "div",
81
+ context.open && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsxs(
82
+ Primitive,
83
83
  {
84
84
  style: {
85
85
  ...floatingStyles
86
86
  },
87
87
  ref: refs.setFloating,
88
- css: {
89
- borderRadius: "0.5rem",
90
- backgroundColor: "var(--color-neutral-600)",
91
- paddingLeft: "0.75rem",
92
- paddingRight: "0.75rem",
93
- paddingTop: "0.5rem",
94
- paddingBottom: "0.5rem",
88
+ sx: {
89
+ borderRadius: 8,
90
+ backgroundColor: getColorVar("neutral.600"),
91
+ paddingLeft: 12,
92
+ paddingRight: 12,
93
+ paddingTop: 8,
94
+ paddingBottom: 8,
95
95
  fontSize: getTypographyVar("sm").fontSize,
96
96
  lineHeight: getTypographyVar("sm").lineHeight,
97
- fontWeight: 400,
98
97
  color: "white"
99
98
  },
100
99
  ...getFloatingProps(),
@@ -104,7 +103,10 @@ function Tooltip({
104
103
  FloatingArrow,
105
104
  {
106
105
  ...arrowProps,
107
- css: { fill: "var(--color-neutral-600)" },
106
+ style: {
107
+ ...arrowProps == null ? void 0 : arrowProps.style,
108
+ fill: getColorVar("neutral.600")
109
+ },
108
110
  ref: arrowRef,
109
111
  context
110
112
  }
@@ -1,6 +1,10 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactElement, ReactNode, Ref } from 'react';
2
2
  import { Placement, UseFloatingOptions, UseHoverProps, FloatingArrowProps } from '@floating-ui/react';
3
- export type TooltipOptions = {
3
+ export type TooltipOptions<T extends {
4
+ ref?: Ref<Element>;
5
+ } = {
6
+ ref?: Ref<Element>;
7
+ }> = {
4
8
  defaultOpen?: boolean;
5
9
  placement?: Placement;
6
10
  open?: boolean;
@@ -11,5 +15,6 @@ export type TooltipOptions = {
11
15
  enable?: true | 'truncated';
12
16
  handleClose?: UseHoverProps['handleClose'] | 'safe-polygon';
13
17
  arrowProps?: Partial<FloatingArrowProps>;
18
+ children: ReactElement<T>;
14
19
  };
15
20
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/tooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtG,MAAM,MAAM,cAAc,GAAG;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,MAAM,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IAC5B,WAAW,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,cAAc,CAAC;IAC5D,UAAU,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC1C,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/tooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtG,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CAAE,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CAAE,IAAI;IACtF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,MAAM,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IAC5B,WAAW,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,cAAc,CAAC;IAC5D,UAAU,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACzC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;CAC3B,CAAC"}
@@ -15,6 +15,7 @@ export declare const getColorShadesByVariant: (variant?: ColorVariant) => {
15
15
  disabledText: string;
16
16
  ariaDisabledSurface: string;
17
17
  ariaDisabledText: string;
18
+ contrast: string;
18
19
  } | {
19
20
  main?: undefined;
20
21
  contrastText?: undefined;
@@ -25,6 +26,7 @@ export declare const getColorShadesByVariant: (variant?: ColorVariant) => {
25
26
  disabledText?: undefined;
26
27
  ariaDisabledSurface?: undefined;
27
28
  ariaDisabledText?: undefined;
29
+ contrast?: undefined;
28
30
  };
29
31
  export declare const mergeComponentProps: <T extends object>(...args: Array<T | object | ((current: T) => T | object)>) => T;
30
32
  export declare const flattenChildren: (children: React.ReactNode) => ReactElement[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyD,YAAY,EAAE,MAAM,OAAO,CAAC;AAI5F,OAAO,EAAe,MAAM,EAAqB,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAA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IACtB,WAAW,EAAE,qBAAqB,CAAC;CACpC,CAAC,CAAC;AAEH,eAAO,MAAM,mBAAmB,UAAW,WAAW,KAAG,gBAiCxD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,2BAC/D,iBAAiB,CAAC,CAAC,CAAC,SACrB,CAAC,UACA,MAAM,YACJ;IACR,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;CACpC,KACA,CAgBF,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,GAAG;IAC3D,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,MAAM,uBAAuB,mBAAmB,WASnF,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,GAAG;IACnF,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,MAAM,uBAAuB,kBAAkB,WAWjF,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,GAAG;IAC/D,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,IAAI,GAAG,MAAM,GAAG,MAAM,uBAAuB,qBAAqB,WAyBvG,CAAC"}
@@ -17,7 +17,8 @@ const getColorShadesByVariant = (variant) => {
17
17
  disabledSurface: getColorVar("primary.300"),
18
18
  disabledText: getColorVar("primary.500"),
19
19
  ariaDisabledSurface: getColorVar("primary.300"),
20
- ariaDisabledText: getColorVar("primary.300")
20
+ ariaDisabledText: getColorVar("primary.300"),
21
+ contrast: getColorVar("white")
21
22
  };
22
23
  case "secondary":
23
24
  return {
@@ -29,7 +30,8 @@ const getColorShadesByVariant = (variant) => {
29
30
  disabledSurface: getColorVar("secondary.300"),
30
31
  disabledText: getColorVar("secondary.500"),
31
32
  ariaDisabledSurface: getColorVar("secondary.300"),
32
- ariaDisabledText: getColorVar("secondary.300")
33
+ ariaDisabledText: getColorVar("secondary.300"),
34
+ contrast: getColorVar("white")
33
35
  };
34
36
  case "green":
35
37
  return {
@@ -41,7 +43,8 @@ const getColorShadesByVariant = (variant) => {
41
43
  disabledSurface: getColorVar("green.300"),
42
44
  disabledText: getColorVar("green.500"),
43
45
  ariaDisabledSurface: getColorVar("green.300"),
44
- ariaDisabledText: getColorVar("green.300")
46
+ ariaDisabledText: getColorVar("green.300"),
47
+ contrast: getColorVar("white")
45
48
  };
46
49
  case "orange":
47
50
  return {
@@ -53,7 +56,8 @@ const getColorShadesByVariant = (variant) => {
53
56
  disabledSurface: getColorVar("orange.300"),
54
57
  disabledText: getColorVar("orange.500"),
55
58
  ariaDisabledSurface: getColorVar("orange.300"),
56
- ariaDisabledText: getColorVar("orange.300")
59
+ ariaDisabledText: getColorVar("orange.300"),
60
+ contrast: getColorVar("white")
57
61
  };
58
62
  case "red":
59
63
  return {
@@ -65,7 +69,8 @@ const getColorShadesByVariant = (variant) => {
65
69
  disabledSurface: getColorVar("red.300"),
66
70
  disabledText: getColorVar("red.500"),
67
71
  ariaDisabledSurface: getColorVar("red.300"),
68
- ariaDisabledText: getColorVar("red.300")
72
+ ariaDisabledText: getColorVar("red.300"),
73
+ contrast: getColorVar("white")
69
74
  };
70
75
  case "blue":
71
76
  return {
@@ -77,7 +82,8 @@ const getColorShadesByVariant = (variant) => {
77
82
  disabledSurface: getColorVar("blue.300"),
78
83
  disabledText: getColorVar("blue.500"),
79
84
  ariaDisabledSurface: getColorVar("blue.300"),
80
- ariaDisabledText: getColorVar("blue.300")
85
+ ariaDisabledText: getColorVar("blue.300"),
86
+ contrast: getColorVar("white")
81
87
  };
82
88
  case "neutral":
83
89
  return {
@@ -89,7 +95,8 @@ const getColorShadesByVariant = (variant) => {
89
95
  disabledSurface: getColorVar("neutral.300"),
90
96
  disabledText: getColorVar("neutral.500"),
91
97
  ariaDisabledSurface: getColorVar("neutral.300"),
92
- ariaDisabledText: getColorVar("neutral.300")
98
+ ariaDisabledText: getColorVar("neutral.300"),
99
+ contrast: getColorVar("white")
93
100
  };
94
101
  default:
95
102
  return {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janbox/storefront-ui",
3
- "version": "2.0.16",
3
+ "version": "2.0.18",
4
4
  "description": "Storefront UI component library for Janbox",
5
5
  "author": "Janbox",
6
6
  "keywords": [