@janbox/storefront-ui 2.0.19 → 2.0.20

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 +1 @@
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
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/badge.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAOrC,eAAO,MAAM,KAAK,yCAAsD,UAAU,4CAkEjF,CAAC"}
@@ -1,12 +1,13 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { isNil, isNumber } from "lodash-es";
3
- import { useFloating, autoUpdate, offset, useMergeRefs, FloatingPortal } from "@floating-ui/react";
3
+ import { useFloating, autoUpdate, offset, hide, useMergeRefs, FloatingPortal } from "@floating-ui/react";
4
4
  import { getColorShadesByVariant } from "../../utils/index.js";
5
5
  import { cloneElement } from "react";
6
6
  import { FLOATING_Z_INDEX } from "../../theme/index.js";
7
7
  import { Primitive } from "../primitive/primitive.js";
8
8
  import { getTypographyVar } from "../../theme/typography.js";
9
9
  const Badge = ({ color = "red", content, offset: offset$1 = 0, children }) => {
10
+ var _a;
10
11
  const { main, contrast } = getColorShadesByVariant(color);
11
12
  const {
12
13
  floatingStyles,
@@ -22,7 +23,8 @@ const Badge = ({ color = "red", content, offset: offset$1 = 0, children }) => {
22
23
  crossAxis: Math.round(rects.floating.width / 2) + offsetX,
23
24
  mainAxis: -Math.round(rects.floating.height / 2) + offsetY
24
25
  };
25
- })
26
+ }),
27
+ hide({ strategy: "referenceHidden" })
26
28
  ],
27
29
  whileElementsMounted: autoUpdate,
28
30
  open: !isNil(content)
@@ -38,7 +40,8 @@ const Badge = ({ color = "red", content, offset: offset$1 = 0, children }) => {
38
40
  {
39
41
  style: {
40
42
  zIndex: FLOATING_Z_INDEX,
41
- ...floatingStyles
43
+ ...floatingStyles,
44
+ visibility: ((_a = context.middlewareData.hide) == null ? void 0 : _a.referenceHidden) ? "hidden" : "visible"
42
45
  },
43
46
  ref: setFloating,
44
47
  children: /* @__PURE__ */ jsx(
@@ -1,3 +1,3 @@
1
1
  import { BoxProps } from './types';
2
- export declare const Box: ({ children, ref, ..._props }: BoxProps) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare const Box: ({ children, ref, ..._props }: BoxProps) => import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=box.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../src/lib/box/box.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAMnC,eAAO,MAAM,GAAG,iCAAkC,QAAQ,qDA0BzD,CAAC"}
1
+ {"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../src/lib/box/box.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAMnC,eAAO,MAAM,GAAG,iCAAkC,QAAQ,4CAyBzD,CAAC"}
@@ -1,39 +1,40 @@
1
- import { jsx } from "@emotion/react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { getBoxProps } from "./helpers.js";
3
3
  import { containerStyle } from "../../constants/emotion.js";
4
- import { mediaQuery } from "../../theme/screens.js";
5
- import "../../theme/palette.js";
4
+ import { Primitive } from "../primitive/primitive.js";
6
5
  const Box = ({ children, ref, ..._props }) => {
7
6
  const { sx = {}, container, ...rest } = getBoxProps(_props);
8
- const { sm: sxSm, md: sxMd, lg: sxLg, ...sxXs } = sx;
9
- const css = [
10
- container && containerStyle,
11
- createStyle(sxXs),
7
+ return /* @__PURE__ */ jsx(
8
+ Primitive,
12
9
  {
13
- [mediaQuery("sm")]: createStyle(sxSm),
14
- [mediaQuery("md")]: createStyle(sxMd),
15
- [mediaQuery("lg")]: createStyle(sxLg)
16
- }
17
- ];
18
- return /* @__PURE__ */ jsx("div", { css, ...rest, ref, children: /* @__PURE__ */ jsx(
19
- "div",
20
- {
21
- css: {
22
- width: "100%",
23
- height: "100%"
10
+ ...rest,
11
+ sx: {
12
+ ...container ? containerStyle : {},
13
+ ...createStyle(sx),
14
+ sm: createStyle(sx.sm),
15
+ md: createStyle(sx.md),
16
+ lg: createStyle(sx.lg)
24
17
  },
25
- children
18
+ ref,
19
+ children: /* @__PURE__ */ jsx(
20
+ Primitive,
21
+ {
22
+ sx: {
23
+ width: "100%",
24
+ height: "100%"
25
+ },
26
+ children
27
+ }
28
+ )
26
29
  }
27
- ) });
30
+ );
28
31
  };
29
32
  const createStyle = ({ width, height, ...css } = {}) => {
30
- return [
31
- {
32
- width,
33
- height,
34
- "& > *": css
35
- }
36
- ];
33
+ return {
34
+ width,
35
+ height,
36
+ "& > *": css
37
+ };
37
38
  };
38
39
  export {
39
40
  Box
@@ -1,8 +1,8 @@
1
1
  import { JSX } from 'react';
2
- import { PropsWithSx } from '../../types';
2
+ import { PrimitiveProps } from '../primitive';
3
3
  type BoxExtendedProps = {
4
4
  container?: boolean;
5
5
  };
6
- export type BoxProps = PropsWithSx<JSX.IntrinsicElements['div'] & BoxExtendedProps>;
6
+ export type BoxProps = PrimitiveProps<JSX.IntrinsicElements['div']> & BoxExtendedProps;
7
7
  export {};
8
8
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/box/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,KAAK,gBAAgB,GAAG;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/box/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,KAAK,gBAAgB,GAAG;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,GAAG,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/lib/notifications/notifications.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,aAAa,wDAgCzB,CAAC"}
1
+ {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/lib/notifications/notifications.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,aAAa,wDAgCzB,CAAC"}
@@ -6,8 +6,11 @@ import { AnimatePresence, useAnimation, motion } from "motion/react";
6
6
  import { notificationStore } from "./helpers.js";
7
7
  import { getColorShadesByVariant } from "../../utils/index.js";
8
8
  import { FLOATING_Z_INDEX } from "../../theme/index.js";
9
- import { mediaQuery } from "../../theme/screens.js";
9
+ import CloseIcon from "../../assets/svg/times-close-delete.svg.js";
10
+ import { Primitive } from "../primitive/primitive.js";
10
11
  import { getTypographyVar } from "../../theme/typography.js";
12
+ import { IconButton } from "../icon-button/icon-button.js";
13
+ import { mediaQuery } from "../../theme/screens.js";
11
14
  const Notifications = () => {
12
15
  const { entries } = useSyncExternalStore(
13
16
  notificationStore.subscribe,
@@ -15,9 +18,9 @@ const Notifications = () => {
15
18
  notificationStore.getServerSnapshot
16
19
  );
17
20
  return /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
18
- "div",
21
+ Primitive,
19
22
  {
20
- css: {
23
+ sx: {
21
24
  zIndex: FLOATING_Z_INDEX + 1,
22
25
  position: "fixed",
23
26
  top: 0,
@@ -105,7 +108,7 @@ const Notification = ({ notification }) => {
105
108
  css: {
106
109
  backgroundColor: light,
107
110
  outlineColor: main,
108
- width: 440,
111
+ width: 400,
109
112
  borderRadius: 12,
110
113
  outlineWidth: 1,
111
114
  outlineOffset: -1,
@@ -116,9 +119,13 @@ const Notification = ({ notification }) => {
116
119
  maxWidth: "100%",
117
120
  pointerEvents: "auto",
118
121
  cursor: "grab",
119
- padding: 16,
122
+ padding: 12,
120
123
  overflow: "hidden",
121
- position: "relative"
124
+ position: "relative",
125
+ [mediaQuery("md")]: {
126
+ padding: 16,
127
+ width: 440
128
+ }
122
129
  },
123
130
  drag: "x",
124
131
  dragConstraints: { left: 0, right: 0 },
@@ -132,28 +139,54 @@ const Notification = ({ notification }) => {
132
139
  }
133
140
  },
134
141
  children: [
135
- /* @__PURE__ */ jsx(
136
- "div",
142
+ /* @__PURE__ */ jsxs(
143
+ Primitive,
137
144
  {
138
- css: {
139
- fontSize: getTypographyVar("sm").fontSize,
140
- lineHeight: getTypographyVar("sm").lineHeight,
141
- fontWeight: 500,
142
- [mediaQuery("md")]: {
143
- fontSize: getTypographyVar("base").fontSize,
144
- lineHeight: getTypographyVar("base").lineHeight
145
- }
145
+ sx: {
146
+ display: "flex",
147
+ alignItems: "flex-start",
148
+ gap: 8
146
149
  },
147
- children: notification.title ?? /* @__PURE__ */ jsx(Fragment, { children: " " })
150
+ children: [
151
+ /* @__PURE__ */ jsx(
152
+ Primitive,
153
+ {
154
+ sx: {
155
+ flex: 1,
156
+ minWidth: 0,
157
+ fontSize: getTypographyVar("sm").fontSize,
158
+ lineHeight: getTypographyVar("sm").lineHeight,
159
+ fontWeight: 500,
160
+ md: {
161
+ fontSize: getTypographyVar("base").fontSize,
162
+ lineHeight: getTypographyVar("base").lineHeight
163
+ }
164
+ },
165
+ children: notification.title ?? /* @__PURE__ */ jsx(Fragment, { children: " " })
166
+ }
167
+ ),
168
+ /* @__PURE__ */ jsx(
169
+ IconButton,
170
+ {
171
+ size: "xs",
172
+ color: "neutral",
173
+ icon: { source: CloseIcon },
174
+ onClick: removeNotification,
175
+ sx: {
176
+ flexShrink: 0
177
+ }
178
+ }
179
+ )
180
+ ]
148
181
  }
149
182
  ),
150
183
  /* @__PURE__ */ jsx(
151
- "div",
184
+ Primitive,
152
185
  {
153
- css: {
186
+ sx: {
154
187
  fontSize: getTypographyVar("xs").fontSize,
155
188
  lineHeight: getTypographyVar("xs").lineHeight,
156
- [mediaQuery("md")]: {
189
+ md: {
157
190
  fontSize: getTypographyVar("sm").fontSize,
158
191
  lineHeight: getTypographyVar("sm").lineHeight
159
192
  }
@@ -162,9 +195,9 @@ const Notification = ({ notification }) => {
162
195
  }
163
196
  ),
164
197
  /* @__PURE__ */ jsx(
165
- "div",
198
+ Primitive,
166
199
  {
167
- css: {
200
+ sx: {
168
201
  position: "absolute",
169
202
  left: 0,
170
203
  right: 0,
@@ -177,15 +210,13 @@ const Notification = ({ notification }) => {
177
210
  children: /* @__PURE__ */ jsx(
178
211
  motion.div,
179
212
  {
180
- css: {
213
+ style: {
214
+ backgroundImage: `linear-gradient(to right, ${light}, ${main})`,
215
+ transformOrigin: "left",
181
216
  height: 4,
182
217
  width: "100%",
183
218
  borderRadius: 9999
184
219
  },
185
- style: {
186
- backgroundImage: `linear-gradient(to right, ${light}, ${main})`,
187
- transformOrigin: "left"
188
- },
189
220
  initial: { scaleX: 0 },
190
221
  animate: progressControls
191
222
  }
@@ -1,6 +1,3 @@
1
- import { ReactNode } from 'react';
2
- import { TooltipOptions } from './types';
3
- export declare function Tooltip({ children, defaultOpen, placement, open, onOpenChange, content, contentWidth, enable, handleClose, arrowProps, }: {
4
- children: ReactNode;
5
- } & TooltipOptions): import("react/jsx-runtime").JSX.Element;
1
+ import { TooltipProps } from './types';
2
+ export declare function Tooltip({ children, defaultOpen, placement, open, onOpenChange, content, contentWidth, enable, handleClose, arrowProps, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
6
3
  //# sourceMappingURL=tooltip.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/lib/tooltip/tooltip.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,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,YAAY,2CA4Gd"}
@@ -1,6 +1,6 @@
1
1
  import { ReactElement, ReactNode, Ref } from 'react';
2
2
  import { Placement, UseFloatingOptions, UseHoverProps, FloatingArrowProps } from '@floating-ui/react';
3
- export type TooltipOptions<T extends {
3
+ export type TooltipProps<T extends {
4
4
  ref?: Ref<Element>;
5
5
  } = {
6
6
  ref?: Ref<Element>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/tooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,E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C,CAAA;CAAE,IAAI;IACpF,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janbox/storefront-ui",
3
- "version": "2.0.19",
3
+ "version": "2.0.20",
4
4
  "description": "Storefront UI component library for Janbox",
5
5
  "author": "Janbox",
6
6
  "keywords": [