@cerberus-design/react 0.3.2-next-3346cfc → 0.3.2-next-e98793a

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.
@@ -9,6 +9,7 @@ import { MutableRefObject } from 'react';
9
9
  import { PropsWithChildren } from 'react';
10
10
  import { ReactNode } from 'react';
11
11
  import { RefObject } from 'react';
12
+ import { Sentiment } from '@cerberus/panda-preset';
12
13
  import type { TextareaHTMLAttributes } from 'react';
13
14
 
14
15
  /**
@@ -31,6 +32,15 @@ declare interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
31
32
  export { ButtonProps }
32
33
  export { ButtonProps as ButtonProps_alias_1 }
33
34
 
35
+ declare interface ClickableTagProps extends HTMLAttributes<HTMLSpanElement> {
36
+ palette?: Sentiment;
37
+ shape?: 'pill';
38
+ onClick: () => void;
39
+ usage?: 'filled';
40
+ }
41
+ export { ClickableTagProps }
42
+ export { ClickableTagProps as ClickableTagProps_alias_1 }
43
+
34
44
  declare type ColorModes = 'light' | 'dark';
35
45
  export { ColorModes }
36
46
  export { ColorModes as ColorModes_alias_1 }
@@ -402,6 +412,29 @@ declare interface TabsProps {
402
412
  export { TabsProps }
403
413
  export { TabsProps as TabsProps_alias_1 }
404
414
 
415
+ /**
416
+ * The Tag component is used to display a meta descriptions.
417
+ * @example
418
+ * ```tsx
419
+ * <Tag>Tag</Tag>
420
+ * ```
421
+ */
422
+ declare function Tag(props: PropsWithChildren<TagProps | ClickableTagProps>): JSX.Element;
423
+ export { Tag }
424
+ export { Tag as Tag_alias_1 }
425
+
426
+ /**
427
+ * This module contains the tag component.
428
+ * @module
429
+ */
430
+ declare interface TagProps extends HTMLAttributes<HTMLSpanElement> {
431
+ palette?: Sentiment;
432
+ shape?: 'rounded' | 'pill';
433
+ usage?: 'filled' | 'outline';
434
+ }
435
+ export { TagProps }
436
+ export { TagProps as TagProps_alias_1 }
437
+
405
438
  /**
406
439
  * A component that allows the user to input large blocks of text.
407
440
  * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Textarea.tsx
@@ -0,0 +1,59 @@
1
+ import {
2
+ Show
3
+ } from "./chunk-R4H3352X.js";
4
+
5
+ // src/components/Tag.tsx
6
+ import { Close } from "@cerberus/icons";
7
+ import { css, cx } from "@cerberus/styled-system/css";
8
+ import { iconButton } from "@cerberus/styled-system/recipes";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ var tag = (_) => css({});
11
+ function Tag(props) {
12
+ const {
13
+ palette: initPalette,
14
+ shape: initShape,
15
+ onClick,
16
+ usage,
17
+ ...nativeProps
18
+ } = props;
19
+ const isClosable = Boolean(onClick);
20
+ const shape = isClosable ? "pill" : initShape;
21
+ const palette = isClosable ? "action" : initPalette;
22
+ const closableStyles = isClosable ? css({
23
+ paddingInlineEnd: "0"
24
+ }) : "";
25
+ return /* @__PURE__ */ jsxs(
26
+ "span",
27
+ {
28
+ ...nativeProps,
29
+ className: cx(
30
+ nativeProps.className,
31
+ tag({
32
+ palette,
33
+ shape,
34
+ usage
35
+ }),
36
+ closableStyles
37
+ ),
38
+ children: [
39
+ props.children,
40
+ /* @__PURE__ */ jsx(Show, { when: isClosable, children: /* @__PURE__ */ jsx(
41
+ "button",
42
+ {
43
+ "aria-label": "Close",
44
+ className: iconButton({
45
+ palette: "action"
46
+ }),
47
+ onClick,
48
+ children: /* @__PURE__ */ jsx(Close, {})
49
+ }
50
+ ) })
51
+ ]
52
+ }
53
+ );
54
+ }
55
+
56
+ export {
57
+ Tag
58
+ };
59
+ //# sourceMappingURL=chunk-BLKP2WFT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Tag.tsx"],"sourcesContent":["import type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { Close } from '@cerberus/icons'\nimport { type Sentiment } from '@cerberus/panda-preset'\nimport { Show } from './Show'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { iconButton } from '@cerberus/styled-system/recipes'\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst tag = (_: TagProps) => css({})\n\n/**\n * This module contains the tag component.\n * @module\n */\n\nexport interface TagProps extends HTMLAttributes<HTMLSpanElement> {\n palette?: Sentiment\n shape?: 'rounded' | 'pill'\n usage?: 'filled' | 'outline'\n}\nexport interface ClickableTagProps extends HTMLAttributes<HTMLSpanElement> {\n palette?: Sentiment\n shape?: 'pill'\n onClick: () => void\n usage?: 'filled'\n}\n\n/**\n * The Tag component is used to display a meta descriptions.\n * @example\n * ```tsx\n * <Tag>Tag</Tag>\n * ```\n */\nexport function Tag(\n props: PropsWithChildren<TagProps | ClickableTagProps>,\n): JSX.Element {\n const {\n palette: initPalette,\n shape: initShape,\n onClick,\n usage,\n ...nativeProps\n } = props\n const isClosable = Boolean(onClick)\n const shape = isClosable ? 'pill' : initShape\n const palette = isClosable ? 'action' : initPalette\n const closableStyles = isClosable\n ? css({\n paddingInlineEnd: '0',\n })\n : ''\n\n return (\n <span\n {...nativeProps}\n className={cx(\n nativeProps.className,\n tag({\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 })}\n onClick={onClick}\n >\n <Close />\n </button>\n </Show>\n </span>\n )\n}\n"],"mappings":";;;;;AACA,SAAS,aAAa;AAGtB,SAAS,KAAK,UAAU;AACxB,SAAS,kBAAkB;AAiDvB,SAsBM,KAtBN;AA9CJ,IAAM,MAAM,CAAC,MAAgB,IAAI,CAAC,CAAC;AA0B5B,SAAS,IACd,OACa;AACb,QAAM;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,aAAa,QAAQ,OAAO;AAClC,QAAM,QAAQ,aAAa,SAAS;AACpC,QAAM,UAAU,aAAa,WAAW;AACxC,QAAM,iBAAiB,aACnB,IAAI;AAAA,IACF,kBAAkB;AAAA,EACpB,CAAC,IACD;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,IAAI;AAAA,UACF;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,YACX,CAAC;AAAA,YACD;AAAA,YAEA,8BAAC,SAAM;AAAA;AAAA,QACT,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,3 @@
1
+ export { Tag_alias_1 as Tag } from '../_tsup-dts-rollup';
2
+ export { TagProps_alias_1 as TagProps } from '../_tsup-dts-rollup';
3
+ export { ClickableTagProps_alias_1 as ClickableTagProps } from '../_tsup-dts-rollup';
@@ -0,0 +1,8 @@
1
+ import {
2
+ Tag
3
+ } from "../chunk-BLKP2WFT.js";
4
+ import "../chunk-R4H3352X.js";
5
+ export {
6
+ Tag
7
+ };
8
+ //# sourceMappingURL=Tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -22,6 +22,9 @@ export { TabList } from './_tsup-dts-rollup';
22
22
  export { TabListProps } from './_tsup-dts-rollup';
23
23
  export { TabPanel } from './_tsup-dts-rollup';
24
24
  export { TabPanelProps } from './_tsup-dts-rollup';
25
+ export { Tag } from './_tsup-dts-rollup';
26
+ export { TagProps } from './_tsup-dts-rollup';
27
+ export { ClickableTagProps } from './_tsup-dts-rollup';
25
28
  export { Textarea } from './_tsup-dts-rollup';
26
29
  export { TextareaProps } from './_tsup-dts-rollup';
27
30
  export { Show } from './_tsup-dts-rollup';
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  TabPanel
3
3
  } from "./chunk-SVZU6LPF.js";
4
+ import {
5
+ Tag
6
+ } from "./chunk-BLKP2WFT.js";
4
7
  import {
5
8
  Textarea
6
9
  } from "./chunk-5TBINKAO.js";
@@ -84,6 +87,7 @@ export {
84
87
  TabPanel,
85
88
  Tabs,
86
89
  TabsContext,
90
+ Tag,
87
91
  Textarea,
88
92
  ThemeProvider,
89
93
  createNavTriggerProps,
@@ -9,6 +9,7 @@ import { MutableRefObject } from 'react';
9
9
  import { PropsWithChildren } from 'react';
10
10
  import { ReactNode } from 'react';
11
11
  import { RefObject } from 'react';
12
+ import { Sentiment } from '@cerberus/panda-preset';
12
13
  import type { TextareaHTMLAttributes } from 'react';
13
14
 
14
15
  /**
@@ -31,6 +32,15 @@ declare interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
31
32
  export { ButtonProps }
32
33
  export { ButtonProps as ButtonProps_alias_1 }
33
34
 
35
+ declare interface ClickableTagProps extends HTMLAttributes<HTMLSpanElement> {
36
+ palette?: Sentiment;
37
+ shape?: 'pill';
38
+ onClick: () => void;
39
+ usage?: 'filled';
40
+ }
41
+ export { ClickableTagProps }
42
+ export { ClickableTagProps as ClickableTagProps_alias_1 }
43
+
34
44
  declare type ColorModes = 'light' | 'dark';
35
45
  export { ColorModes }
36
46
  export { ColorModes as ColorModes_alias_1 }
@@ -402,6 +412,29 @@ declare interface TabsProps {
402
412
  export { TabsProps }
403
413
  export { TabsProps as TabsProps_alias_1 }
404
414
 
415
+ /**
416
+ * The Tag component is used to display a meta descriptions.
417
+ * @example
418
+ * ```tsx
419
+ * <Tag>Tag</Tag>
420
+ * ```
421
+ */
422
+ declare function Tag(props: PropsWithChildren<TagProps | ClickableTagProps>): JSX.Element;
423
+ export { Tag }
424
+ export { Tag as Tag_alias_1 }
425
+
426
+ /**
427
+ * This module contains the tag component.
428
+ * @module
429
+ */
430
+ declare interface TagProps extends HTMLAttributes<HTMLSpanElement> {
431
+ palette?: Sentiment;
432
+ shape?: 'rounded' | 'pill';
433
+ usage?: 'filled' | 'outline';
434
+ }
435
+ export { TagProps }
436
+ export { TagProps as TagProps_alias_1 }
437
+
405
438
  /**
406
439
  * A component that allows the user to input large blocks of text.
407
440
  * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Textarea.tsx
@@ -0,0 +1,59 @@
1
+ import {
2
+ Show
3
+ } from "./chunk-R4H3352X.js";
4
+
5
+ // src/components/Tag.tsx
6
+ import { Close } from "@cerberus/icons";
7
+ import { css, cx } from "@cerberus/styled-system/css";
8
+ import { iconButton } from "@cerberus/styled-system/recipes";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ var tag = (_) => css({});
11
+ function Tag(props) {
12
+ const {
13
+ palette: initPalette,
14
+ shape: initShape,
15
+ onClick,
16
+ usage,
17
+ ...nativeProps
18
+ } = props;
19
+ const isClosable = Boolean(onClick);
20
+ const shape = isClosable ? "pill" : initShape;
21
+ const palette = isClosable ? "action" : initPalette;
22
+ const closableStyles = isClosable ? css({
23
+ paddingInlineEnd: "0"
24
+ }) : "";
25
+ return /* @__PURE__ */ jsxs(
26
+ "span",
27
+ {
28
+ ...nativeProps,
29
+ className: cx(
30
+ nativeProps.className,
31
+ tag({
32
+ palette,
33
+ shape,
34
+ usage
35
+ }),
36
+ closableStyles
37
+ ),
38
+ children: [
39
+ props.children,
40
+ /* @__PURE__ */ jsx(Show, { when: isClosable, children: /* @__PURE__ */ jsx(
41
+ "button",
42
+ {
43
+ "aria-label": "Close",
44
+ className: iconButton({
45
+ palette: "action"
46
+ }),
47
+ onClick,
48
+ children: /* @__PURE__ */ jsx(Close, {})
49
+ }
50
+ ) })
51
+ ]
52
+ }
53
+ );
54
+ }
55
+
56
+ export {
57
+ Tag
58
+ };
59
+ //# sourceMappingURL=chunk-BLKP2WFT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Tag.tsx"],"sourcesContent":["import type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { Close } from '@cerberus/icons'\nimport { type Sentiment } from '@cerberus/panda-preset'\nimport { Show } from './Show'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { iconButton } from '@cerberus/styled-system/recipes'\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst tag = (_: TagProps) => css({})\n\n/**\n * This module contains the tag component.\n * @module\n */\n\nexport interface TagProps extends HTMLAttributes<HTMLSpanElement> {\n palette?: Sentiment\n shape?: 'rounded' | 'pill'\n usage?: 'filled' | 'outline'\n}\nexport interface ClickableTagProps extends HTMLAttributes<HTMLSpanElement> {\n palette?: Sentiment\n shape?: 'pill'\n onClick: () => void\n usage?: 'filled'\n}\n\n/**\n * The Tag component is used to display a meta descriptions.\n * @example\n * ```tsx\n * <Tag>Tag</Tag>\n * ```\n */\nexport function Tag(\n props: PropsWithChildren<TagProps | ClickableTagProps>,\n): JSX.Element {\n const {\n palette: initPalette,\n shape: initShape,\n onClick,\n usage,\n ...nativeProps\n } = props\n const isClosable = Boolean(onClick)\n const shape = isClosable ? 'pill' : initShape\n const palette = isClosable ? 'action' : initPalette\n const closableStyles = isClosable\n ? css({\n paddingInlineEnd: '0',\n })\n : ''\n\n return (\n <span\n {...nativeProps}\n className={cx(\n nativeProps.className,\n tag({\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 })}\n onClick={onClick}\n >\n <Close />\n </button>\n </Show>\n </span>\n )\n}\n"],"mappings":";;;;;AACA,SAAS,aAAa;AAGtB,SAAS,KAAK,UAAU;AACxB,SAAS,kBAAkB;AAiDvB,SAsBM,KAtBN;AA9CJ,IAAM,MAAM,CAAC,MAAgB,IAAI,CAAC,CAAC;AA0B5B,SAAS,IACd,OACa;AACb,QAAM;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,aAAa,QAAQ,OAAO;AAClC,QAAM,QAAQ,aAAa,SAAS;AACpC,QAAM,UAAU,aAAa,WAAW;AACxC,QAAM,iBAAiB,aACnB,IAAI;AAAA,IACF,kBAAkB;AAAA,EACpB,CAAC,IACD;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,IAAI;AAAA,UACF;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,YACX,CAAC;AAAA,YACD;AAAA,YAEA,8BAAC,SAAM;AAAA;AAAA,QACT,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,3 @@
1
+ export { Tag_alias_1 as Tag } from '../_tsup-dts-rollup';
2
+ export { TagProps_alias_1 as TagProps } from '../_tsup-dts-rollup';
3
+ export { ClickableTagProps_alias_1 as ClickableTagProps } from '../_tsup-dts-rollup';
@@ -0,0 +1,8 @@
1
+ import {
2
+ Tag
3
+ } from "../chunk-BLKP2WFT.js";
4
+ import "../chunk-R4H3352X.js";
5
+ export {
6
+ Tag
7
+ };
8
+ //# sourceMappingURL=Tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -22,6 +22,9 @@ export { TabList } from './_tsup-dts-rollup';
22
22
  export { TabListProps } from './_tsup-dts-rollup';
23
23
  export { TabPanel } from './_tsup-dts-rollup';
24
24
  export { TabPanelProps } from './_tsup-dts-rollup';
25
+ export { Tag } from './_tsup-dts-rollup';
26
+ export { TagProps } from './_tsup-dts-rollup';
27
+ export { ClickableTagProps } from './_tsup-dts-rollup';
25
28
  export { Textarea } from './_tsup-dts-rollup';
26
29
  export { TextareaProps } from './_tsup-dts-rollup';
27
30
  export { Show } from './_tsup-dts-rollup';
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  TabPanel
3
3
  } from "./chunk-SVZU6LPF.js";
4
+ import {
5
+ Tag
6
+ } from "./chunk-BLKP2WFT.js";
4
7
  import {
5
8
  Textarea
6
9
  } from "./chunk-5TBINKAO.js";
@@ -84,6 +87,7 @@ export {
84
87
  TabPanel,
85
88
  Tabs,
86
89
  TabsContext,
90
+ Tag,
87
91
  Textarea,
88
92
  ThemeProvider,
89
93
  createNavTriggerProps,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.3.2-next-3346cfc",
3
+ "version": "0.3.2-next-e98793a",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -0,0 +1,82 @@
1
+ import type { HTMLAttributes, PropsWithChildren } from 'react'
2
+ import { Close } from '@cerberus/icons'
3
+ import { type Sentiment } from '@cerberus/panda-preset'
4
+ import { Show } from './Show'
5
+ import { css, cx } from '@cerberus/styled-system/css'
6
+ import { iconButton } from '@cerberus/styled-system/recipes'
7
+
8
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
+ const tag = (_: TagProps) => css({})
10
+
11
+ /**
12
+ * This module contains the tag component.
13
+ * @module
14
+ */
15
+
16
+ export interface TagProps extends HTMLAttributes<HTMLSpanElement> {
17
+ palette?: Sentiment
18
+ shape?: 'rounded' | 'pill'
19
+ usage?: 'filled' | 'outline'
20
+ }
21
+ export interface ClickableTagProps extends HTMLAttributes<HTMLSpanElement> {
22
+ palette?: Sentiment
23
+ shape?: 'pill'
24
+ onClick: () => void
25
+ usage?: 'filled'
26
+ }
27
+
28
+ /**
29
+ * The Tag component is used to display a meta descriptions.
30
+ * @example
31
+ * ```tsx
32
+ * <Tag>Tag</Tag>
33
+ * ```
34
+ */
35
+ export function Tag(
36
+ props: PropsWithChildren<TagProps | ClickableTagProps>,
37
+ ): JSX.Element {
38
+ const {
39
+ palette: initPalette,
40
+ shape: initShape,
41
+ onClick,
42
+ usage,
43
+ ...nativeProps
44
+ } = props
45
+ const isClosable = Boolean(onClick)
46
+ const shape = isClosable ? 'pill' : initShape
47
+ const palette = isClosable ? 'action' : initPalette
48
+ const closableStyles = isClosable
49
+ ? css({
50
+ paddingInlineEnd: '0',
51
+ })
52
+ : ''
53
+
54
+ return (
55
+ <span
56
+ {...nativeProps}
57
+ className={cx(
58
+ nativeProps.className,
59
+ tag({
60
+ palette,
61
+ shape,
62
+ usage,
63
+ }),
64
+ closableStyles,
65
+ )}
66
+ >
67
+ {props.children}
68
+
69
+ <Show when={isClosable}>
70
+ <button
71
+ aria-label="Close"
72
+ className={iconButton({
73
+ palette: 'action',
74
+ })}
75
+ onClick={onClick}
76
+ >
77
+ <Close />
78
+ </button>
79
+ </Show>
80
+ </span>
81
+ )
82
+ }
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ export * from './components/NavMenuLink'
16
16
  export * from './components/Tab'
17
17
  export * from './components/TabList'
18
18
  export * from './components/TabPanel'
19
+ export * from './components/Tag'
19
20
  export * from './components/Textarea'
20
21
  export * from './components/Show'
21
22