@dmitriikapustin/ui 0.2.12 → 0.3.0

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.
package/dist/index.cjs CHANGED
@@ -194,6 +194,31 @@ __styleInject(`@charset "UTF-8";
194
194
  background: var(--border-color);
195
195
  }
196
196
 
197
+ .Button-module_danger {
198
+ background: var(--color-error);
199
+ border: 1px solid var(--color-error);
200
+ color: #ffffff;
201
+ box-shadow: var(--shadow-sm);
202
+ }
203
+ .Button-module_danger:hover:not(:disabled) {
204
+ background: var(--color-error-dark);
205
+ border-color: var(--color-error-dark);
206
+ box-shadow: var(--shadow-md);
207
+ }
208
+ .Button-module_danger:active:not(:disabled) {
209
+ background: var(--color-error-dark);
210
+ border-color: var(--color-error-dark);
211
+ }
212
+ .Button-module_danger:focus-visible {
213
+ outline: 2px solid var(--color-error-light);
214
+ outline-offset: 2px;
215
+ }
216
+ .Button-module_danger:disabled {
217
+ background: var(--color-error-light);
218
+ border-color: var(--color-error-light);
219
+ color: rgba(255, 255, 255, 0.7);
220
+ }
221
+
197
222
  /* \u2500\u2500\u2500 Sizes \u2500\u2500\u2500 */
198
223
  .Button-module_sm {
199
224
  font-size: 13px;
@@ -228,9 +253,9 @@ __styleInject(`@charset "UTF-8";
228
253
  cursor: not-allowed;
229
254
  pointer-events: none;
230
255
  }`);
231
- var __default2 = { "root": "Button-module_root", "primary": "Button-module_primary", "ghost": "Button-module_ghost", "secondary": "Button-module_secondary", "outline": "Button-module_outline", "sm": "Button-module_sm", "md": "Button-module_md", "hero": "Button-module_hero", "disabled": "Button-module_disabled" };
232
- function Button(_a) {
233
- var _b = _a, {
256
+ var __default2 = { "root": "Button-module_root", "primary": "Button-module_primary", "ghost": "Button-module_ghost", "secondary": "Button-module_secondary", "outline": "Button-module_outline", "danger": "Button-module_danger", "sm": "Button-module_sm", "md": "Button-module_md", "hero": "Button-module_hero", "disabled": "Button-module_disabled" };
257
+ function Button(props) {
258
+ const {
234
259
  variant = "primary",
235
260
  size = "md",
236
261
  loading = false,
@@ -239,27 +264,38 @@ function Button(_a) {
239
264
  children,
240
265
  disabled,
241
266
  className = ""
242
- } = _b, props = __objRest(_b, [
243
- "variant",
244
- "size",
245
- "loading",
246
- "icon",
247
- "iconRight",
248
- "children",
249
- "disabled",
250
- "className"
251
- ]);
252
- return /* @__PURE__ */ jsxRuntime.jsxs(
267
+ } = props;
268
+ const rootClass = `${__default2.root} ${__default2[variant]} ${__default2[size]}${disabled || loading ? ` ${__default2.disabled}` : ""}${className ? ` ${className}` : ""}`;
269
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
270
+ loading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: "sm" }) : icon,
271
+ children,
272
+ iconRight
273
+ ] });
274
+ if (props.href !== void 0) {
275
+ const _a = props, { href, target, rel, onClick } = _a, rest = __objRest(_a, ["href", "target", "rel", "onClick"]);
276
+ const safeRel = target === "_blank" ? rel != null ? rel : "noopener noreferrer" : rel;
277
+ const handleClick = disabled || loading ? (e) => e.preventDefault() : onClick;
278
+ return /* @__PURE__ */ jsxRuntime.jsx(
279
+ "a",
280
+ __spreadProps(__spreadValues({}, rest), {
281
+ href,
282
+ target,
283
+ rel: safeRel,
284
+ className: rootClass,
285
+ "aria-disabled": disabled || loading || void 0,
286
+ tabIndex: disabled || loading ? -1 : rest.tabIndex,
287
+ onClick: handleClick,
288
+ children: content
289
+ })
290
+ );
291
+ }
292
+ const _b = props, { href: _href } = _b, buttonRest = __objRest(_b, ["href"]);
293
+ return /* @__PURE__ */ jsxRuntime.jsx(
253
294
  "button",
254
- __spreadProps(__spreadValues({
255
- className: `${__default2.root} ${__default2[variant]} ${__default2[size]}${disabled || loading ? ` ${__default2.disabled}` : ""}${className ? ` ${className}` : ""}`,
256
- disabled: disabled || loading
257
- }, props), {
258
- children: [
259
- loading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: "sm" }) : icon,
260
- children,
261
- iconRight
262
- ]
295
+ __spreadProps(__spreadValues({}, buttonRest), {
296
+ className: rootClass,
297
+ disabled: disabled || loading,
298
+ children: content
263
299
  })
264
300
  );
265
301
  }
@@ -900,15 +936,34 @@ __styleInject(`@charset "UTF-8";
900
936
  cursor: not-allowed;
901
937
  }`);
902
938
  var __default10 = { "root": "IconButton-module_root", "primary": "IconButton-module_primary", "secondary": "IconButton-module_secondary", "clear": "IconButton-module_clear", "disabled": "IconButton-module_disabled", "contrast": "IconButton-module_contrast", "isDisabled": "IconButton-module_isDisabled" };
903
- function IconButton(_a) {
904
- var _b = _a, { icon, variant = "primary", className = "", disabled } = _b, props = __objRest(_b, ["icon", "variant", "className", "disabled"]);
939
+ function IconButton(props) {
940
+ const { icon, variant = "primary", className = "", disabled } = props;
905
941
  const isDisabled = variant === "disabled" || disabled;
942
+ const rootClass = `${__default10.root} ${__default10[variant]}${isDisabled ? ` ${__default10.isDisabled}` : ""}${className ? ` ${className}` : ""}`;
943
+ if (props.href !== void 0) {
944
+ const _a = props, { href, target, rel, onClick } = _a, rest = __objRest(_a, ["href", "target", "rel", "onClick"]);
945
+ const safeRel = target === "_blank" ? rel != null ? rel : "noopener noreferrer" : rel;
946
+ const handleClick = isDisabled ? (e) => e.preventDefault() : onClick;
947
+ return /* @__PURE__ */ jsxRuntime.jsx(
948
+ "a",
949
+ __spreadProps(__spreadValues({}, rest), {
950
+ href,
951
+ target,
952
+ rel: safeRel,
953
+ className: rootClass,
954
+ "aria-disabled": isDisabled || void 0,
955
+ tabIndex: isDisabled ? -1 : rest.tabIndex,
956
+ onClick: handleClick,
957
+ children: icon
958
+ })
959
+ );
960
+ }
961
+ const _b = props, { href: _href } = _b, buttonRest = __objRest(_b, ["href"]);
906
962
  return /* @__PURE__ */ jsxRuntime.jsx(
907
963
  "button",
908
- __spreadProps(__spreadValues({
909
- className: `${__default10.root} ${__default10[variant]}${isDisabled ? ` ${__default10.isDisabled}` : ""}${className ? ` ${className}` : ""}`,
910
- disabled: isDisabled
911
- }, props), {
964
+ __spreadProps(__spreadValues({}, buttonRest), {
965
+ className: rootClass,
966
+ disabled: isDisabled,
912
967
  children: icon
913
968
  })
914
969
  );
@@ -1758,6 +1813,10 @@ __styleInject(`@charset "UTF-8";
1758
1813
  margin: 0;
1759
1814
  }
1760
1815
 
1816
+ .Card-module_danger .Card-module_title {
1817
+ color: var(--color-error);
1818
+ }
1819
+
1761
1820
  .Card-module_description {
1762
1821
  font-size: 13px;
1763
1822
  font-weight: 400;
@@ -1787,7 +1846,7 @@ __styleInject(`@charset "UTF-8";
1787
1846
  .Card-module_spacer {
1788
1847
  display: block;
1789
1848
  }`);
1790
- var __default21 = { "root": "Card-module_root", "imageWrapper": "Card-module_imageWrapper", "image": "Card-module_image", "body": "Card-module_body", "bodyWithImage": "Card-module_bodyWithImage", "bodyNoImage": "Card-module_bodyNoImage", "titleBlock": "Card-module_titleBlock", "title": "Card-module_title", "description": "Card-module_description", "footer": "Card-module_footer", "footerRow": "Card-module_footerRow", "badges": "Card-module_badges", "spacer": "Card-module_spacer" };
1849
+ var __default21 = { "root": "Card-module_root", "imageWrapper": "Card-module_imageWrapper", "image": "Card-module_image", "body": "Card-module_body", "bodyWithImage": "Card-module_bodyWithImage", "bodyNoImage": "Card-module_bodyNoImage", "titleBlock": "Card-module_titleBlock", "title": "Card-module_title", "danger": "Card-module_danger", "description": "Card-module_description", "footer": "Card-module_footer", "footerRow": "Card-module_footerRow", "badges": "Card-module_badges", "spacer": "Card-module_spacer" };
1791
1850
 
1792
1851
  // css-inject-scss:/Users/dimakozh/Desktop/projects/kapustin.cc/packages/ui/src/molecules/IconBadge.module.scss
1793
1852
  __styleInject(`@charset "UTF-8";
@@ -1815,16 +1874,19 @@ function Card({
1815
1874
  image,
1816
1875
  title,
1817
1876
  description,
1877
+ descriptionClassName = "",
1818
1878
  badges,
1819
1879
  action,
1820
1880
  footer,
1821
1881
  children,
1882
+ variant = "default",
1822
1883
  className = ""
1823
1884
  }) {
1824
1885
  const hasImage = !!image;
1825
1886
  const hasBadgesOrAction = !!(badges && badges.length > 0 || action);
1826
1887
  const showFooter = !!footer || hasBadgesOrAction;
1827
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${__default21.root}${className ? ` ${className}` : ""}`, children: [
1888
+ const variantClass = variant === "danger" ? ` ${__default21.danger}` : "";
1889
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${__default21.root}${variantClass}${className ? ` ${className}` : ""}`, children: [
1828
1890
  hasImage && /* @__PURE__ */ jsxRuntime.jsx("div", { className: __default21.imageWrapper, children: typeof image === "string" ? (
1829
1891
  // eslint-disable-next-line @next/next/no-img-element
1830
1892
  /* @__PURE__ */ jsxRuntime.jsx("img", { src: image, alt: title || "", className: __default21.image })
@@ -1832,7 +1894,7 @@ function Card({
1832
1894
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${__default21.body} ${hasImage ? __default21.bodyWithImage : __default21.bodyNoImage}`, children: [
1833
1895
  (title || description) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: __default21.titleBlock, children: [
1834
1896
  title && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: __default21.title, children: title }),
1835
- description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: __default21.description, children: description })
1897
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: `${__default21.description}${descriptionClassName ? ` ${descriptionClassName}` : ""}`, children: description })
1836
1898
  ] }),
1837
1899
  children,
1838
1900
  showFooter && /* @__PURE__ */ jsxRuntime.jsx("div", { className: __default21.footer, children: footer || /* @__PURE__ */ jsxRuntime.jsxs("div", { className: __default21.footerRow, children: [
@@ -5814,7 +5876,6 @@ __styleInject(`.PromoSplit-module_root {
5814
5876
  display: flex;
5815
5877
  align-items: center;
5816
5878
  justify-content: center;
5817
- padding: 1.5rem;
5818
5879
  }
5819
5880
 
5820
5881
  .PromoSplit-module_mediaPlaceholder {
package/dist/index.d.cts CHANGED
@@ -1,17 +1,29 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React$1, { ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, ImgHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, AnchorHTMLAttributes } from 'react';
2
+ import React$1, { ReactNode, ButtonHTMLAttributes, AnchorHTMLAttributes, InputHTMLAttributes, ImgHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes } from 'react';
3
3
 
4
- type ButtonVariant = 'primary' | 'ghost' | 'secondary' | 'outline';
4
+ type ButtonVariant = 'primary' | 'ghost' | 'secondary' | 'outline' | 'danger';
5
5
  type ButtonSize = 'sm' | 'md' | 'hero';
6
- interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
6
+ type AnchorTarget$1 = '_self' | '_blank' | '_parent' | '_top';
7
+ interface CommonProps$1 {
7
8
  variant?: ButtonVariant;
8
9
  size?: ButtonSize;
9
10
  loading?: boolean;
10
11
  icon?: ReactNode;
11
12
  iconRight?: ReactNode;
12
13
  children: ReactNode;
14
+ className?: string;
15
+ disabled?: boolean;
16
+ }
17
+ interface ButtonAsButton extends CommonProps$1, Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof CommonProps$1 | 'href'> {
18
+ href?: undefined;
19
+ }
20
+ interface ButtonAsAnchor extends CommonProps$1, Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof CommonProps$1 | 'href' | 'target' | 'rel'> {
21
+ href: string;
22
+ target?: AnchorTarget$1;
23
+ rel?: string;
13
24
  }
14
- declare function Button({ variant, size, loading, icon, iconRight, children, disabled, className, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
25
+ type ButtonProps = ButtonAsButton | ButtonAsAnchor;
26
+ declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
15
27
 
16
28
  interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
17
29
  label?: string;
@@ -82,12 +94,23 @@ interface MenuItemProps {
82
94
  declare function MenuItem({ text, active, onClick, className, icon }: MenuItemProps): react_jsx_runtime.JSX.Element;
83
95
 
84
96
  type IconButtonVariant = 'primary' | 'secondary' | 'clear' | 'disabled' | 'contrast';
85
- interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
97
+ type AnchorTarget = '_self' | '_blank' | '_parent' | '_top';
98
+ interface CommonProps {
86
99
  icon: ReactNode;
87
100
  variant?: IconButtonVariant;
88
101
  className?: string;
102
+ disabled?: boolean;
103
+ }
104
+ interface IconButtonAsButton extends CommonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof CommonProps | 'href'> {
105
+ href?: undefined;
106
+ }
107
+ interface IconButtonAsAnchor extends CommonProps, Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof CommonProps | 'href' | 'target' | 'rel'> {
108
+ href: string;
109
+ target?: AnchorTarget;
110
+ rel?: string;
89
111
  }
90
- declare function IconButton({ icon, variant, className, disabled, ...props }: IconButtonProps): react_jsx_runtime.JSX.Element;
112
+ type IconButtonProps = IconButtonAsButton | IconButtonAsAnchor;
113
+ declare function IconButton(props: IconButtonProps): react_jsx_runtime.JSX.Element;
91
114
 
92
115
  interface LogoProps {
93
116
  /** Полный override через произвольный JSX. Имеет приоритет над text/src. */
@@ -242,13 +265,17 @@ interface CardProps {
242
265
  image?: string | ReactNode;
243
266
  title?: string;
244
267
  description?: string;
268
+ /** Доп. класс для `<p class="description">` — для override (word-break, overflow-wrap, etc). */
269
+ descriptionClassName?: string;
245
270
  badges?: ReactNode[];
246
271
  action?: CardAction;
247
272
  footer?: ReactNode;
248
273
  children?: ReactNode;
274
+ /** Визуальный вариант. `'danger'` красит `.title` в `var(--color-error)`. Border остаётся default. */
275
+ variant?: 'default' | 'danger';
249
276
  className?: string;
250
277
  }
251
- declare function Card({ image, title, description, badges, action, footer, children, className, }: CardProps): react_jsx_runtime.JSX.Element;
278
+ declare function Card({ image, title, description, descriptionClassName, badges, action, footer, children, variant, className, }: CardProps): react_jsx_runtime.JSX.Element;
252
279
 
253
280
  interface IconBadgeProps {
254
281
  icon: ReactNode;
package/dist/index.d.ts CHANGED
@@ -1,17 +1,29 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React$1, { ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, ImgHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, AnchorHTMLAttributes } from 'react';
2
+ import React$1, { ReactNode, ButtonHTMLAttributes, AnchorHTMLAttributes, InputHTMLAttributes, ImgHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes } from 'react';
3
3
 
4
- type ButtonVariant = 'primary' | 'ghost' | 'secondary' | 'outline';
4
+ type ButtonVariant = 'primary' | 'ghost' | 'secondary' | 'outline' | 'danger';
5
5
  type ButtonSize = 'sm' | 'md' | 'hero';
6
- interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
6
+ type AnchorTarget$1 = '_self' | '_blank' | '_parent' | '_top';
7
+ interface CommonProps$1 {
7
8
  variant?: ButtonVariant;
8
9
  size?: ButtonSize;
9
10
  loading?: boolean;
10
11
  icon?: ReactNode;
11
12
  iconRight?: ReactNode;
12
13
  children: ReactNode;
14
+ className?: string;
15
+ disabled?: boolean;
16
+ }
17
+ interface ButtonAsButton extends CommonProps$1, Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof CommonProps$1 | 'href'> {
18
+ href?: undefined;
19
+ }
20
+ interface ButtonAsAnchor extends CommonProps$1, Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof CommonProps$1 | 'href' | 'target' | 'rel'> {
21
+ href: string;
22
+ target?: AnchorTarget$1;
23
+ rel?: string;
13
24
  }
14
- declare function Button({ variant, size, loading, icon, iconRight, children, disabled, className, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
25
+ type ButtonProps = ButtonAsButton | ButtonAsAnchor;
26
+ declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
15
27
 
16
28
  interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
17
29
  label?: string;
@@ -82,12 +94,23 @@ interface MenuItemProps {
82
94
  declare function MenuItem({ text, active, onClick, className, icon }: MenuItemProps): react_jsx_runtime.JSX.Element;
83
95
 
84
96
  type IconButtonVariant = 'primary' | 'secondary' | 'clear' | 'disabled' | 'contrast';
85
- interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
97
+ type AnchorTarget = '_self' | '_blank' | '_parent' | '_top';
98
+ interface CommonProps {
86
99
  icon: ReactNode;
87
100
  variant?: IconButtonVariant;
88
101
  className?: string;
102
+ disabled?: boolean;
103
+ }
104
+ interface IconButtonAsButton extends CommonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof CommonProps | 'href'> {
105
+ href?: undefined;
106
+ }
107
+ interface IconButtonAsAnchor extends CommonProps, Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof CommonProps | 'href' | 'target' | 'rel'> {
108
+ href: string;
109
+ target?: AnchorTarget;
110
+ rel?: string;
89
111
  }
90
- declare function IconButton({ icon, variant, className, disabled, ...props }: IconButtonProps): react_jsx_runtime.JSX.Element;
112
+ type IconButtonProps = IconButtonAsButton | IconButtonAsAnchor;
113
+ declare function IconButton(props: IconButtonProps): react_jsx_runtime.JSX.Element;
91
114
 
92
115
  interface LogoProps {
93
116
  /** Полный override через произвольный JSX. Имеет приоритет над text/src. */
@@ -242,13 +265,17 @@ interface CardProps {
242
265
  image?: string | ReactNode;
243
266
  title?: string;
244
267
  description?: string;
268
+ /** Доп. класс для `<p class="description">` — для override (word-break, overflow-wrap, etc). */
269
+ descriptionClassName?: string;
245
270
  badges?: ReactNode[];
246
271
  action?: CardAction;
247
272
  footer?: ReactNode;
248
273
  children?: ReactNode;
274
+ /** Визуальный вариант. `'danger'` красит `.title` в `var(--color-error)`. Border остаётся default. */
275
+ variant?: 'default' | 'danger';
249
276
  className?: string;
250
277
  }
251
- declare function Card({ image, title, description, badges, action, footer, children, className, }: CardProps): react_jsx_runtime.JSX.Element;
278
+ declare function Card({ image, title, description, descriptionClassName, badges, action, footer, children, variant, className, }: CardProps): react_jsx_runtime.JSX.Element;
252
279
 
253
280
  interface IconBadgeProps {
254
281
  icon: ReactNode;
package/dist/index.js CHANGED
@@ -188,6 +188,31 @@ __styleInject(`@charset "UTF-8";
188
188
  background: var(--border-color);
189
189
  }
190
190
 
191
+ .Button-module_danger {
192
+ background: var(--color-error);
193
+ border: 1px solid var(--color-error);
194
+ color: #ffffff;
195
+ box-shadow: var(--shadow-sm);
196
+ }
197
+ .Button-module_danger:hover:not(:disabled) {
198
+ background: var(--color-error-dark);
199
+ border-color: var(--color-error-dark);
200
+ box-shadow: var(--shadow-md);
201
+ }
202
+ .Button-module_danger:active:not(:disabled) {
203
+ background: var(--color-error-dark);
204
+ border-color: var(--color-error-dark);
205
+ }
206
+ .Button-module_danger:focus-visible {
207
+ outline: 2px solid var(--color-error-light);
208
+ outline-offset: 2px;
209
+ }
210
+ .Button-module_danger:disabled {
211
+ background: var(--color-error-light);
212
+ border-color: var(--color-error-light);
213
+ color: rgba(255, 255, 255, 0.7);
214
+ }
215
+
191
216
  /* \u2500\u2500\u2500 Sizes \u2500\u2500\u2500 */
192
217
  .Button-module_sm {
193
218
  font-size: 13px;
@@ -222,9 +247,9 @@ __styleInject(`@charset "UTF-8";
222
247
  cursor: not-allowed;
223
248
  pointer-events: none;
224
249
  }`);
225
- var __default2 = { "root": "Button-module_root", "primary": "Button-module_primary", "ghost": "Button-module_ghost", "secondary": "Button-module_secondary", "outline": "Button-module_outline", "sm": "Button-module_sm", "md": "Button-module_md", "hero": "Button-module_hero", "disabled": "Button-module_disabled" };
226
- function Button(_a) {
227
- var _b = _a, {
250
+ var __default2 = { "root": "Button-module_root", "primary": "Button-module_primary", "ghost": "Button-module_ghost", "secondary": "Button-module_secondary", "outline": "Button-module_outline", "danger": "Button-module_danger", "sm": "Button-module_sm", "md": "Button-module_md", "hero": "Button-module_hero", "disabled": "Button-module_disabled" };
251
+ function Button(props) {
252
+ const {
228
253
  variant = "primary",
229
254
  size = "md",
230
255
  loading = false,
@@ -233,27 +258,38 @@ function Button(_a) {
233
258
  children,
234
259
  disabled,
235
260
  className = ""
236
- } = _b, props = __objRest(_b, [
237
- "variant",
238
- "size",
239
- "loading",
240
- "icon",
241
- "iconRight",
242
- "children",
243
- "disabled",
244
- "className"
245
- ]);
246
- return /* @__PURE__ */ jsxs(
261
+ } = props;
262
+ const rootClass = `${__default2.root} ${__default2[variant]} ${__default2[size]}${disabled || loading ? ` ${__default2.disabled}` : ""}${className ? ` ${className}` : ""}`;
263
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
264
+ loading ? /* @__PURE__ */ jsx(Spinner, { size: "sm" }) : icon,
265
+ children,
266
+ iconRight
267
+ ] });
268
+ if (props.href !== void 0) {
269
+ const _a = props, { href, target, rel, onClick } = _a, rest = __objRest(_a, ["href", "target", "rel", "onClick"]);
270
+ const safeRel = target === "_blank" ? rel != null ? rel : "noopener noreferrer" : rel;
271
+ const handleClick = disabled || loading ? (e) => e.preventDefault() : onClick;
272
+ return /* @__PURE__ */ jsx(
273
+ "a",
274
+ __spreadProps(__spreadValues({}, rest), {
275
+ href,
276
+ target,
277
+ rel: safeRel,
278
+ className: rootClass,
279
+ "aria-disabled": disabled || loading || void 0,
280
+ tabIndex: disabled || loading ? -1 : rest.tabIndex,
281
+ onClick: handleClick,
282
+ children: content
283
+ })
284
+ );
285
+ }
286
+ const _b = props, { href: _href } = _b, buttonRest = __objRest(_b, ["href"]);
287
+ return /* @__PURE__ */ jsx(
247
288
  "button",
248
- __spreadProps(__spreadValues({
249
- className: `${__default2.root} ${__default2[variant]} ${__default2[size]}${disabled || loading ? ` ${__default2.disabled}` : ""}${className ? ` ${className}` : ""}`,
250
- disabled: disabled || loading
251
- }, props), {
252
- children: [
253
- loading ? /* @__PURE__ */ jsx(Spinner, { size: "sm" }) : icon,
254
- children,
255
- iconRight
256
- ]
289
+ __spreadProps(__spreadValues({}, buttonRest), {
290
+ className: rootClass,
291
+ disabled: disabled || loading,
292
+ children: content
257
293
  })
258
294
  );
259
295
  }
@@ -894,15 +930,34 @@ __styleInject(`@charset "UTF-8";
894
930
  cursor: not-allowed;
895
931
  }`);
896
932
  var __default10 = { "root": "IconButton-module_root", "primary": "IconButton-module_primary", "secondary": "IconButton-module_secondary", "clear": "IconButton-module_clear", "disabled": "IconButton-module_disabled", "contrast": "IconButton-module_contrast", "isDisabled": "IconButton-module_isDisabled" };
897
- function IconButton(_a) {
898
- var _b = _a, { icon, variant = "primary", className = "", disabled } = _b, props = __objRest(_b, ["icon", "variant", "className", "disabled"]);
933
+ function IconButton(props) {
934
+ const { icon, variant = "primary", className = "", disabled } = props;
899
935
  const isDisabled = variant === "disabled" || disabled;
936
+ const rootClass = `${__default10.root} ${__default10[variant]}${isDisabled ? ` ${__default10.isDisabled}` : ""}${className ? ` ${className}` : ""}`;
937
+ if (props.href !== void 0) {
938
+ const _a = props, { href, target, rel, onClick } = _a, rest = __objRest(_a, ["href", "target", "rel", "onClick"]);
939
+ const safeRel = target === "_blank" ? rel != null ? rel : "noopener noreferrer" : rel;
940
+ const handleClick = isDisabled ? (e) => e.preventDefault() : onClick;
941
+ return /* @__PURE__ */ jsx(
942
+ "a",
943
+ __spreadProps(__spreadValues({}, rest), {
944
+ href,
945
+ target,
946
+ rel: safeRel,
947
+ className: rootClass,
948
+ "aria-disabled": isDisabled || void 0,
949
+ tabIndex: isDisabled ? -1 : rest.tabIndex,
950
+ onClick: handleClick,
951
+ children: icon
952
+ })
953
+ );
954
+ }
955
+ const _b = props, { href: _href } = _b, buttonRest = __objRest(_b, ["href"]);
900
956
  return /* @__PURE__ */ jsx(
901
957
  "button",
902
- __spreadProps(__spreadValues({
903
- className: `${__default10.root} ${__default10[variant]}${isDisabled ? ` ${__default10.isDisabled}` : ""}${className ? ` ${className}` : ""}`,
904
- disabled: isDisabled
905
- }, props), {
958
+ __spreadProps(__spreadValues({}, buttonRest), {
959
+ className: rootClass,
960
+ disabled: isDisabled,
906
961
  children: icon
907
962
  })
908
963
  );
@@ -1752,6 +1807,10 @@ __styleInject(`@charset "UTF-8";
1752
1807
  margin: 0;
1753
1808
  }
1754
1809
 
1810
+ .Card-module_danger .Card-module_title {
1811
+ color: var(--color-error);
1812
+ }
1813
+
1755
1814
  .Card-module_description {
1756
1815
  font-size: 13px;
1757
1816
  font-weight: 400;
@@ -1781,7 +1840,7 @@ __styleInject(`@charset "UTF-8";
1781
1840
  .Card-module_spacer {
1782
1841
  display: block;
1783
1842
  }`);
1784
- var __default21 = { "root": "Card-module_root", "imageWrapper": "Card-module_imageWrapper", "image": "Card-module_image", "body": "Card-module_body", "bodyWithImage": "Card-module_bodyWithImage", "bodyNoImage": "Card-module_bodyNoImage", "titleBlock": "Card-module_titleBlock", "title": "Card-module_title", "description": "Card-module_description", "footer": "Card-module_footer", "footerRow": "Card-module_footerRow", "badges": "Card-module_badges", "spacer": "Card-module_spacer" };
1843
+ var __default21 = { "root": "Card-module_root", "imageWrapper": "Card-module_imageWrapper", "image": "Card-module_image", "body": "Card-module_body", "bodyWithImage": "Card-module_bodyWithImage", "bodyNoImage": "Card-module_bodyNoImage", "titleBlock": "Card-module_titleBlock", "title": "Card-module_title", "danger": "Card-module_danger", "description": "Card-module_description", "footer": "Card-module_footer", "footerRow": "Card-module_footerRow", "badges": "Card-module_badges", "spacer": "Card-module_spacer" };
1785
1844
 
1786
1845
  // css-inject-scss:/Users/dimakozh/Desktop/projects/kapustin.cc/packages/ui/src/molecules/IconBadge.module.scss
1787
1846
  __styleInject(`@charset "UTF-8";
@@ -1809,16 +1868,19 @@ function Card({
1809
1868
  image,
1810
1869
  title,
1811
1870
  description,
1871
+ descriptionClassName = "",
1812
1872
  badges,
1813
1873
  action,
1814
1874
  footer,
1815
1875
  children,
1876
+ variant = "default",
1816
1877
  className = ""
1817
1878
  }) {
1818
1879
  const hasImage = !!image;
1819
1880
  const hasBadgesOrAction = !!(badges && badges.length > 0 || action);
1820
1881
  const showFooter = !!footer || hasBadgesOrAction;
1821
- return /* @__PURE__ */ jsxs("div", { className: `${__default21.root}${className ? ` ${className}` : ""}`, children: [
1882
+ const variantClass = variant === "danger" ? ` ${__default21.danger}` : "";
1883
+ return /* @__PURE__ */ jsxs("div", { className: `${__default21.root}${variantClass}${className ? ` ${className}` : ""}`, children: [
1822
1884
  hasImage && /* @__PURE__ */ jsx("div", { className: __default21.imageWrapper, children: typeof image === "string" ? (
1823
1885
  // eslint-disable-next-line @next/next/no-img-element
1824
1886
  /* @__PURE__ */ jsx("img", { src: image, alt: title || "", className: __default21.image })
@@ -1826,7 +1888,7 @@ function Card({
1826
1888
  /* @__PURE__ */ jsxs("div", { className: `${__default21.body} ${hasImage ? __default21.bodyWithImage : __default21.bodyNoImage}`, children: [
1827
1889
  (title || description) && /* @__PURE__ */ jsxs("div", { className: __default21.titleBlock, children: [
1828
1890
  title && /* @__PURE__ */ jsx("h3", { className: __default21.title, children: title }),
1829
- description && /* @__PURE__ */ jsx("p", { className: __default21.description, children: description })
1891
+ description && /* @__PURE__ */ jsx("p", { className: `${__default21.description}${descriptionClassName ? ` ${descriptionClassName}` : ""}`, children: description })
1830
1892
  ] }),
1831
1893
  children,
1832
1894
  showFooter && /* @__PURE__ */ jsx("div", { className: __default21.footer, children: footer || /* @__PURE__ */ jsxs("div", { className: __default21.footerRow, children: [
@@ -5808,7 +5870,6 @@ __styleInject(`.PromoSplit-module_root {
5808
5870
  display: flex;
5809
5871
  align-items: center;
5810
5872
  justify-content: center;
5811
- padding: 1.5rem;
5812
5873
  }
5813
5874
 
5814
5875
  .PromoSplit-module_mediaPlaceholder {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmitriikapustin/ui",
3
- "version": "0.2.12",
3
+ "version": "0.3.0",
4
4
  "description": "Universal UI/UX Kit — React 19 component library with Atomic Design, CSS custom properties, and SCSS modules",
5
5
  "author": "Kapustin Team",
6
6
  "license": "MIT",