@cerberus-design/react 0.11.1-next-87d05b8 → 0.11.1-next-13ff008

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.
@@ -83,6 +83,7 @@ import { MeasuringStrategy } from '@dnd-kit/core';
83
83
  import { Modifier } from '@dnd-kit/core';
84
84
  import { Modifiers } from '@dnd-kit/core';
85
85
  import { MouseEvent as MouseEvent_2 } from 'react';
86
+ import type { MouseEventHandler } from 'react';
86
87
  import { MouseSensor } from '@dnd-kit/core';
87
88
  import { MouseSensorOptions } from '@dnd-kit/core';
88
89
  import { MutableRefObject } from 'react';
@@ -443,19 +444,19 @@ declare type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {
443
444
  /**
444
445
  * The action to be performed when the tag is clicked.
445
446
  */
446
- onClick: () => void;
447
+ onClick: MouseEventHandler<HTMLSpanElement>;
447
448
  /**
448
449
  * The shape of the tag. Not available when the onClick prop is provided.
449
450
  * @type 'pill' | 'rounded'
450
451
  * @default 'pill'
451
452
  */
452
- shape: 'pill';
453
+ shape?: never;
453
454
  /**
454
455
  * The usage of the tag. Not available when the onClick prop is provided.
455
456
  * @type 'filled' | 'outlined'
456
457
  * @default 'filled'
457
458
  */
458
- usage: 'filled';
459
+ usage?: never;
459
460
  };
460
461
  export { ClickableTagProps }
461
462
  export { ClickableTagProps as ClickableTagProps_alias_1 }
@@ -61,4 +61,4 @@ var closableCss = css({
61
61
  export {
62
62
  Tag
63
63
  };
64
- //# sourceMappingURL=chunk-243VUIA6.js.map
64
+ //# sourceMappingURL=chunk-BOCAJC3S.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Tag.tsx"],"sourcesContent":["import type {\n HTMLAttributes,\n MouseEventHandler,\n PropsWithChildren,\n} from 'react'\nimport { Show } from './Show'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport {\n iconButton,\n tag,\n type TagVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { $cerberusIcons } from '../config/defineIcons'\n\n/**\n * This module contains the tag component.\n * @module\n */\n\nexport type StaticTagProps = HTMLAttributes<HTMLSpanElement> &\n TagVariantProps & {\n /**\n * The action to be performed when the tag is clicked. Not available when\n * the palette or gradient props are provided.\n */\n onClick?: never\n }\n\nexport type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {\n /**\n * The gradient to apply to the tag. Not available when the onClick prop is\n * provided.\n */\n gradient?: never\n /**\n * The palette to use for the tag. Not available when the onClick prop is\n * provided.\n */\n palette?: never\n /**\n * The action to be performed when the tag is clicked.\n */\n onClick: MouseEventHandler<HTMLSpanElement>\n /**\n * The shape of the tag. Not available when the onClick prop is provided.\n * @type 'pill' | 'rounded'\n * @default 'pill'\n */\n shape?: never\n /**\n * The usage of the tag. Not available when the onClick prop is provided.\n * @type 'filled' | 'outlined'\n * @default 'filled'\n */\n usage?: never\n}\n\nexport type TagProps = StaticTagProps | ClickableTagProps\n\n/**\n * The Tag component is used to display a meta descriptions.\n * @see https://cerberus.digitalu.design/react/tag\n * @example\n * ```tsx\n * <Tag>Tag</Tag>\n * ```\n */\nexport function Tag(props: PropsWithChildren<TagProps>): JSX.Element {\n const { shape: initShape, gradient, onClick, usage, ...nativeProps } = props\n const palette = props?.palette ?? 'page'\n const isClosable = Boolean(onClick)\n const shape = isClosable ? 'pill' : initShape\n const closableStyles = isClosable ? closableCss : ''\n const { close: Close } = $cerberusIcons\n\n return (\n <span\n {...nativeProps}\n className={cx(\n nativeProps.className,\n tag({\n gradient,\n palette,\n shape,\n usage,\n }),\n closableStyles,\n )}\n >\n {props.children}\n\n <Show when={isClosable}>\n <button\n aria-label=\"Close\"\n className={iconButton({\n palette: 'action',\n usage: 'filled',\n size: 'sm',\n })}\n onClick={onClick}\n >\n <Close />\n </button>\n </Show>\n </span>\n )\n}\n\nconst closableCss = css({\n bgColor: 'action.bg.active',\n color: 'action.text.initial',\n paddingInlineEnd: '0',\n})\n"],"mappings":";;;;;;;;AAMA,SAAS,KAAK,UAAU;AACxB;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAiEH,SAyBM,KAzBN;AATG,SAAS,IAAI,OAAiD;AACnE,QAAM,EAAE,OAAO,WAAW,UAAU,SAAS,OAAO,GAAG,YAAY,IAAI;AACvE,QAAM,UAAU,OAAO,WAAW;AAClC,QAAM,aAAa,QAAQ,OAAO;AAClC,QAAM,QAAQ,aAAa,SAAS;AACpC,QAAM,iBAAiB,aAAa,cAAc;AAClD,QAAM,EAAE,OAAO,MAAM,IAAI;AAEzB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,IAAI;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,QACD;AAAA,MACF;AAAA,MAEC;AAAA,cAAM;AAAA,QAEP,oBAAC,QAAK,MAAM,YACV;AAAA,UAAC;AAAA;AAAA,YACC,cAAW;AAAA,YACX,WAAW,WAAW;AAAA,cACpB,SAAS;AAAA,cACT,OAAO;AAAA,cACP,MAAM;AAAA,YACR,CAAC;AAAA,YACD;AAAA,YAEA,8BAAC,SAAM;AAAA;AAAA,QACT,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAM,cAAc,IAAI;AAAA,EACtB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,kBAAkB;AACpB,CAAC;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Tag
3
- } from "../chunk-243VUIA6.js";
3
+ } from "../chunk-BOCAJC3S.js";
4
4
  import "../chunk-BUVVRQLZ.js";
5
5
  import "../chunk-FT7DFRHQ.js";
6
6
  import "../chunk-TMR7JGMP.js";
@@ -54,7 +54,7 @@ import {
54
54
  } from "./chunk-B4CVET74.js";
55
55
  import {
56
56
  Tag
57
- } from "./chunk-243VUIA6.js";
57
+ } from "./chunk-BOCAJC3S.js";
58
58
  import {
59
59
  NavMenuList,
60
60
  getPosition
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.11.1-next-87d05b8",
3
+ "version": "0.11.1-next-13ff008",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -25,8 +25,8 @@
25
25
  "react": "^18",
26
26
  "react-dom": "^18",
27
27
  "tsup": "^8.1.0",
28
- "@cerberus-design/styled-system": "0.11.1-next-87d05b8",
29
- "@cerberus-design/configs": "0.0.0"
28
+ "@cerberus-design/configs": "0.0.0",
29
+ "@cerberus-design/styled-system": "0.11.1-next-13ff008"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
@@ -1,4 +1,8 @@
1
- import type { HTMLAttributes, PropsWithChildren } from 'react'
1
+ import type {
2
+ HTMLAttributes,
3
+ MouseEventHandler,
4
+ PropsWithChildren,
5
+ } from 'react'
2
6
  import { Show } from './Show'
3
7
  import { css, cx } from '@cerberus/styled-system/css'
4
8
  import {
@@ -36,19 +40,19 @@ export type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {
36
40
  /**
37
41
  * The action to be performed when the tag is clicked.
38
42
  */
39
- onClick: () => void
43
+ onClick: MouseEventHandler<HTMLSpanElement>
40
44
  /**
41
45
  * The shape of the tag. Not available when the onClick prop is provided.
42
46
  * @type 'pill' | 'rounded'
43
47
  * @default 'pill'
44
48
  */
45
- shape: 'pill'
49
+ shape?: never
46
50
  /**
47
51
  * The usage of the tag. Not available when the onClick prop is provided.
48
52
  * @type 'filled' | 'outlined'
49
53
  * @default 'filled'
50
54
  */
51
- usage: 'filled'
55
+ usage?: never
52
56
  }
53
57
 
54
58
  export type TagProps = StaticTagProps | ClickableTagProps
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Tag.tsx"],"sourcesContent":["import type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { Show } from './Show'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport {\n iconButton,\n tag,\n type TagVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { $cerberusIcons } from '../config/defineIcons'\n\n/**\n * This module contains the tag component.\n * @module\n */\n\nexport type StaticTagProps = HTMLAttributes<HTMLSpanElement> &\n TagVariantProps & {\n /**\n * The action to be performed when the tag is clicked. Not available when\n * the palette or gradient props are provided.\n */\n onClick?: never\n }\n\nexport type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {\n /**\n * The gradient to apply to the tag. Not available when the onClick prop is\n * provided.\n */\n gradient?: never\n /**\n * The palette to use for the tag. Not available when the onClick prop is\n * provided.\n */\n palette?: never\n /**\n * The action to be performed when the tag is clicked.\n */\n onClick: () => void\n /**\n * The shape of the tag. Not available when the onClick prop is provided.\n * @type 'pill' | 'rounded'\n * @default 'pill'\n */\n shape: 'pill'\n /**\n * The usage of the tag. Not available when the onClick prop is provided.\n * @type 'filled' | 'outlined'\n * @default 'filled'\n */\n usage: 'filled'\n}\n\nexport type TagProps = StaticTagProps | ClickableTagProps\n\n/**\n * The Tag component is used to display a meta descriptions.\n * @see https://cerberus.digitalu.design/react/tag\n * @example\n * ```tsx\n * <Tag>Tag</Tag>\n * ```\n */\nexport function Tag(props: PropsWithChildren<TagProps>): JSX.Element {\n const { shape: initShape, gradient, onClick, usage, ...nativeProps } = props\n const palette = props?.palette ?? 'page'\n const isClosable = Boolean(onClick)\n const shape = isClosable ? 'pill' : initShape\n const closableStyles = isClosable ? closableCss : ''\n const { close: Close } = $cerberusIcons\n\n return (\n <span\n {...nativeProps}\n className={cx(\n nativeProps.className,\n tag({\n gradient,\n palette,\n shape,\n usage,\n }),\n closableStyles,\n )}\n >\n {props.children}\n\n <Show when={isClosable}>\n <button\n aria-label=\"Close\"\n className={iconButton({\n palette: 'action',\n usage: 'filled',\n size: 'sm',\n })}\n onClick={onClick}\n >\n <Close />\n </button>\n </Show>\n </span>\n )\n}\n\nconst closableCss = css({\n bgColor: 'action.bg.active',\n color: 'action.text.initial',\n paddingInlineEnd: '0',\n})\n"],"mappings":";;;;;;;;AAEA,SAAS,KAAK,UAAU;AACxB;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAiEH,SAyBM,KAzBN;AATG,SAAS,IAAI,OAAiD;AACnE,QAAM,EAAE,OAAO,WAAW,UAAU,SAAS,OAAO,GAAG,YAAY,IAAI;AACvE,QAAM,UAAU,OAAO,WAAW;AAClC,QAAM,aAAa,QAAQ,OAAO;AAClC,QAAM,QAAQ,aAAa,SAAS;AACpC,QAAM,iBAAiB,aAAa,cAAc;AAClD,QAAM,EAAE,OAAO,MAAM,IAAI;AAEzB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,IAAI;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,QACD;AAAA,MACF;AAAA,MAEC;AAAA,cAAM;AAAA,QAEP,oBAAC,QAAK,MAAM,YACV;AAAA,UAAC;AAAA;AAAA,YACC,cAAW;AAAA,YACX,WAAW,WAAW;AAAA,cACpB,SAAS;AAAA,cACT,OAAO;AAAA,cACP,MAAM;AAAA,YACR,CAAC;AAAA,YACD;AAAA,YAEA,8BAAC,SAAM;AAAA;AAAA,QACT,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAM,cAAc,IAAI;AAAA,EACtB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,kBAAkB;AACpB,CAAC;","names":[]}