@citygross/components_v2 0.0.53 → 0.0.55

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,17 +1,17 @@
1
1
  import React from 'react';
2
- import { TPaletteKeys, THardSpacingKeys, TSpacingKeys } from '@citygross/design-tokens_v2';
2
+ import { THardSpacingKeys, TPaletteKeys, TSpacingKeys } from '@citygross/design-tokens_v2';
3
3
 
4
4
  declare type TAlertBox = {
5
+ arrowPlacement?: 'left' | 'right';
6
+ arrowSpacing?: THardSpacingKeys;
5
7
  background?: TPaletteKeys;
6
8
  borderColor?: TPaletteKeys;
7
- icon?: JSX.Element;
8
9
  children: React.ReactNode;
10
+ icon?: JSX.Element;
9
11
  iconMinWidth?: THardSpacingKeys;
10
- withArrow?: boolean;
11
- arrowPlacement?: 'left' | 'right';
12
- arrowSpacing?: THardSpacingKeys;
13
12
  padding?: TSpacingKeys;
13
+ withArrow?: boolean;
14
14
  };
15
- declare function AlertBox({ background, borderColor, icon, iconMinWidth, withArrow, arrowSpacing, arrowPlacement, padding, children }: TAlertBox): JSX.Element;
15
+ declare function AlertBox({ arrowPlacement, arrowSpacing, background, borderColor, children, icon, iconMinWidth, padding, withArrow }: TAlertBox): JSX.Element;
16
16
 
17
17
  export { AlertBox, TAlertBox };
@@ -3,15 +3,15 @@ import { BoxArrow } from '../BoxArrow/BoxArrow.js';
3
3
  import { alertBox, iconContainer } from './AlertBox.css.vanilla.js';
4
4
 
5
5
  function AlertBox({
6
+ arrowPlacement,
7
+ arrowSpacing,
6
8
  background = "blueLight",
7
9
  borderColor = "alertBlue",
10
+ children,
8
11
  icon,
9
12
  iconMinWidth = 24,
10
- withArrow,
11
- arrowSpacing,
12
- arrowPlacement,
13
13
  padding = "sm",
14
- children
14
+ withArrow
15
15
  }) {
16
16
  return /* @__PURE__ */ React.createElement("div", null, withArrow ? /* @__PURE__ */ React.createElement(
17
17
  BoxArrow,
@@ -30,7 +30,7 @@ function AlertBox({
30
30
  padding
31
31
  })
32
32
  },
33
- icon ? /* @__PURE__ */ React.createElement("div", { className: iconContainer({ minWidth: `${iconMinWidth}` }) }, icon) : null,
33
+ icon ? /* @__PURE__ */ React.createElement("div", { className: iconContainer({ minWidth: iconMinWidth }) }, icon) : null,
34
34
  children
35
35
  ));
36
36
  }
@@ -1,21 +1,21 @@
1
1
  import React from 'react';
2
2
 
3
3
  declare type TCgButton = {
4
- size?: 'small' | 'medium' | 'icon' | 'large';
5
- variant?: 'primary' | 'secondary' | 'ghost' | 'tertiary' | 'prio' | 'dark';
6
- icon?: React.ReactNode;
7
- flexReverse?: boolean;
8
- loading?: boolean;
4
+ ariaLabel?: string;
5
+ buttonRef?: React.Ref<HTMLButtonElement>;
9
6
  children?: React.ReactNode;
7
+ className?: string;
10
8
  disabled?: boolean;
11
- onClick?: () => void;
9
+ flexReverse?: boolean;
12
10
  fullWidth?: boolean;
13
- buttonRef?: React.Ref<HTMLButtonElement>;
11
+ icon?: React.ReactNode;
12
+ loading?: boolean;
13
+ onClick?: () => void;
14
14
  round?: boolean;
15
- className?: string;
16
15
  shouldPreventDefault?: boolean;
17
- ariaLabel?: string;
16
+ size?: 'small' | 'medium' | 'icon' | 'large';
17
+ variant?: 'primary' | 'secondary' | 'ghost' | 'tertiary' | 'prio' | 'dark';
18
18
  };
19
- declare const Button: ({ size, variant, icon, flexReverse, disabled, onClick, children, loading, fullWidth, buttonRef, round, className, shouldPreventDefault, ariaLabel }: TCgButton) => JSX.Element;
19
+ declare const Button: ({ ariaLabel, buttonRef, children, className, disabled, flexReverse, fullWidth, icon, loading, onClick, round, shouldPreventDefault, size, variant }: TCgButton) => JSX.Element;
20
20
 
21
21
  export { Button, TCgButton };
@@ -3,43 +3,38 @@ import { button, buttonContent, buttonLoader } from './Button.css.vanilla.js';
3
3
  import { Spinner } from '../Spinner/Spinner.js';
4
4
 
5
5
  const Button = ({
6
- size,
7
- variant,
8
- icon,
9
- flexReverse,
10
- disabled,
11
- onClick,
6
+ ariaLabel,
7
+ buttonRef,
12
8
  children,
13
- loading,
9
+ className,
10
+ disabled,
11
+ flexReverse,
14
12
  fullWidth,
15
- buttonRef,
13
+ icon,
14
+ loading,
15
+ onClick,
16
16
  round,
17
- className,
18
17
  shouldPreventDefault = true,
19
- ariaLabel
18
+ size,
19
+ variant
20
20
  }) => {
21
21
  return /* @__PURE__ */ React.createElement(
22
22
  "button",
23
23
  {
24
- ref: buttonRef,
25
24
  "aria-label": ariaLabel,
26
25
  className: `${button({
27
26
  buttonPadding: size,
28
27
  buttonRadius: round ? "round" : "default",
28
+ buttonShadow: variant === "ghost" || variant === "secondary" ? "none" : size === "small" ? "small" : "default",
29
29
  buttonVariant: variant,
30
- fullWidth,
31
- buttonShadow: variant === "ghost" || variant === "secondary" ? "none" : size === "small" ? "small" : "default"
30
+ fullWidth
32
31
  })} ${className}`,
33
32
  disabled: disabled || loading,
34
- onKeyDown: (event) => {
35
- if (event.key === "Enter") {
36
- onClick && onClick();
37
- }
38
- },
39
33
  onClick: (e) => {
40
34
  shouldPreventDefault && e.preventDefault();
41
35
  onClick && onClick();
42
- }
36
+ },
37
+ ref: buttonRef
43
38
  },
44
39
  /* @__PURE__ */ React.createElement(
45
40
  "div",
@@ -2,16 +2,16 @@ import React from 'react';
2
2
  import { TPaletteKeys } from '@citygross/design-tokens_v2';
3
3
 
4
4
  declare type TModal = {
5
- onBackdropClick?: () => void;
5
+ background?: TPaletteKeys;
6
6
  children?: React.ReactNode;
7
- title?: string;
8
- subTitle?: string;
9
- hideCancel?: boolean;
10
- querySelector?: string;
7
+ className?: string;
11
8
  footer?: JSX.Element;
12
- background?: TPaletteKeys;
9
+ hideCancel?: boolean;
13
10
  isConfirm?: boolean;
14
- className?: string;
11
+ onBackdropClick?: () => void;
12
+ querySelector?: string;
13
+ subTitle?: string;
14
+ title?: string;
15
15
  };
16
16
  declare const Modal: React.ForwardRefExoticComponent<TModal & React.RefAttributes<HTMLDivElement>>;
17
17
 
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from 'react';
1
+ import React, { forwardRef, Fragment } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import { Icons } from '@citygross/icons_v2';
4
4
  import { Spacer } from '../Spacer/Spacer.js';
@@ -8,16 +8,16 @@ import { BodyText } from '../../typography/BodyText/BodyText.js';
8
8
 
9
9
  const Modal = forwardRef(
10
10
  ({
11
- onBackdropClick,
11
+ background = "white",
12
12
  children,
13
- title,
14
- subTitle,
13
+ className,
14
+ footer,
15
15
  hideCancel = true,
16
16
  isConfirm,
17
- background = "white",
17
+ onBackdropClick,
18
18
  querySelector = "#root",
19
- footer,
20
- className
19
+ subTitle,
20
+ title
21
21
  }, ref) => {
22
22
  const domSafe = typeof document !== "undefined";
23
23
  return domSafe ? createPortal(
@@ -31,11 +31,13 @@ const Modal = forwardRef(
31
31
  /* @__PURE__ */ React.createElement(
32
32
  "div",
33
33
  {
34
+ "aria-modal": "true",
34
35
  className: `${modalContainer({
35
36
  backgroundColor: background,
36
37
  maxWidth: isConfirm ? "confirm" : "regular"
37
38
  })} ${className}`,
38
- onClick: (e) => e.stopPropagation()
39
+ onClick: (e) => e.stopPropagation(),
40
+ role: "dialog"
39
41
  },
40
42
  title && /* @__PURE__ */ React.createElement("div", { className: modalHeaderContainer }, /* @__PURE__ */ React.createElement("div", { className: modalHeader }, /* @__PURE__ */ React.createElement(H2, null, title), !hideCancel && /* @__PURE__ */ React.createElement(
41
43
  "div",
@@ -46,7 +48,7 @@ const Modal = forwardRef(
46
48
  /* @__PURE__ */ React.createElement(Icons.Cross, null)
47
49
  )), /* @__PURE__ */ React.createElement(BodyText, null, subTitle)),
48
50
  children && /* @__PURE__ */ React.createElement("div", { className: childrenWrapper }, children),
49
- footer && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Spacer, null), /* @__PURE__ */ React.createElement("div", { className: footerWrapper }, footer))
51
+ footer && /* @__PURE__ */ React.createElement(Fragment, null, /* @__PURE__ */ React.createElement(Spacer, null), /* @__PURE__ */ React.createElement("div", { className: footerWrapper }, footer))
50
52
  )
51
53
  ),
52
54
  document.querySelector(querySelector) || document.body
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citygross/components_v2",
3
- "version": "0.0.53",
3
+ "version": "0.0.55",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -79,5 +79,5 @@
79
79
  "react-slick": "^0.30.1",
80
80
  "slick-carousel": "^1.8.1"
81
81
  },
82
- "gitHead": "c3ba222ac06cddf16f1ecd0f381f22bc13ff0c21"
82
+ "gitHead": "58ef69ddd64ea278231d5795b6a16f5169e9553f"
83
83
  }