@janbox/storefront-ui 6.0.4 → 6.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.
@@ -1,51 +1,38 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { getIconProps } from "./helpers.js";
3
- import { SvgLoader } from "../../components/svg-loader.js";
4
- import { useIsHydrated } from "../../hooks/use-is-hydrated/index.js";
5
- import { Stylesheet } from "../stylesheet/stylesheet.js";
3
+ import { Primitive } from "../primitive/primitive.js";
6
4
  const Icon = ({ children: _children, ref, ..._props }) => {
7
5
  var _a, _b, _c;
8
- const { size, md, sm, lg, ...props } = getIconProps(_props);
9
- const isHydrated = useIsHydrated();
10
- const sx = {
11
- ...createStyle({ size }),
12
- ...props.sx,
13
- sm: {
14
- ...createStyle(sm),
15
- ...(_a = props.sx) == null ? void 0 : _a.sm
16
- },
17
- md: {
18
- ...createStyle(md),
19
- ...(_b = props.sx) == null ? void 0 : _b.md
20
- },
21
- lg: {
22
- ...createStyle(lg),
23
- ...(_c = props.sx) == null ? void 0 : _c.lg
24
- }
25
- };
26
- if (!isHydrated) {
27
- const { source: _source, sx: _sx, ...rest } = props;
28
- return /* @__PURE__ */ jsx(Stylesheet, { children: ({ css, cx }) => /* @__PURE__ */ jsx(
29
- "svg",
30
- {
31
- ...rest,
32
- ref,
33
- className: cx(css(sx), rest.className),
34
- "aria-hidden": true,
35
- viewBox: "0 0 24 24",
36
- fill: "none",
37
- xmlns: "http://www.w3.org/2000/svg"
6
+ const { size, source, md, sm, lg, ...props } = getIconProps(_props);
7
+ return /* @__PURE__ */ jsx(
8
+ Primitive,
9
+ {
10
+ as: "span",
11
+ ...props,
12
+ ref,
13
+ dangerouslySetInnerHTML: { __html: source },
14
+ "aria-hidden": true,
15
+ sx: {
16
+ display: "inline-flex",
17
+ alignItems: "center",
18
+ justifyContent: "center",
19
+ verticalAlign: "middle",
20
+ flexShrink: 0,
21
+ lineHeight: 0,
22
+ "& svg": { width: "100%", height: "100%" },
23
+ ...createStyle({ size }),
24
+ ...props.sx,
25
+ sm: { ...createStyle(sm), ...(_a = props.sx) == null ? void 0 : _a.sm },
26
+ md: { ...createStyle(md), ...(_b = props.sx) == null ? void 0 : _b.md },
27
+ lg: { ...createStyle(lg), ...(_c = props.sx) == null ? void 0 : _c.lg }
38
28
  }
39
- ) });
40
- }
41
- return /* @__PURE__ */ jsx(SvgLoader, { ...props, width: void 0, height: void 0, sx, ref });
42
- };
43
- const createStyle = ({ size } = {}) => {
44
- return {
45
- width: size,
46
- height: size
47
- };
29
+ }
30
+ );
48
31
  };
32
+ const createStyle = ({ size } = {}) => ({
33
+ width: size,
34
+ height: size
35
+ });
49
36
  export {
50
37
  Icon
51
38
  };
@@ -1,11 +1,10 @@
1
1
  import { JSX } from 'react';
2
- import { PropsWithSx, ShallowMerge, ToResponsiveProps } from '../../types';
2
+ import { ShallowMerge, ToResponsiveProps } from '../../types';
3
+ import { PrimitiveProps } from '../primitive';
3
4
  export interface IconResponsiveProps {
4
5
  size?: number;
5
6
  }
6
- type IconHTMLProps = JSX.IntrinsicElements['svg'];
7
- export type IconExtendedProps = PropsWithSx<ToResponsiveProps<IconResponsiveProps> & {
7
+ export type IconExtendedProps = ToResponsiveProps<IconResponsiveProps> & {
8
8
  source: string;
9
- }>;
10
- export type IconProps = ShallowMerge<IconHTMLProps, IconExtendedProps>;
11
- export {};
9
+ };
10
+ export type IconProps = PrimitiveProps<ShallowMerge<JSX.IntrinsicElements['span'], IconExtendedProps>, 'span'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janbox/storefront-ui",
3
- "version": "6.0.4",
3
+ "version": "6.0.5",
4
4
  "description": "Storefront UI component library for Janbox",
5
5
  "author": "Janbox",
6
6
  "keywords": [