@cerberus-design/react 0.3.2-next-a65ca8e → 0.3.2-next-bdab9b9

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,14 @@ 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
+ shape?: 'pill';
37
+ onClick: () => void;
38
+ usage?: 'filled';
39
+ }
40
+ export { ClickableTagProps }
41
+ export { ClickableTagProps as ClickableTagProps_alias_1 }
42
+
34
43
  declare type ColorModes = 'light' | 'dark';
35
44
  export { ColorModes }
36
45
  export { ColorModes as ColorModes_alias_1 }
@@ -402,6 +411,18 @@ declare interface TabsProps {
402
411
  export { TabsProps }
403
412
  export { TabsProps as TabsProps_alias_1 }
404
413
 
414
+ declare function Tag(props: PropsWithChildren<TagProps | ClickableTagProps>): JSX.Element;
415
+ export { Tag }
416
+ export { Tag as Tag_alias_1 }
417
+
418
+ declare interface TagProps extends HTMLAttributes<HTMLSpanElement> {
419
+ palette?: Sentiment;
420
+ shape?: 'rounded' | 'pill';
421
+ usage?: 'filled' | 'outline';
422
+ }
423
+ export { TagProps }
424
+ export { TagProps as TagProps_alias_1 }
425
+
405
426
  /**
406
427
  * A component that allows the user to input large blocks of text.
407
428
  * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Textarea.tsx
@@ -0,0 +1,34 @@
1
+ import {
2
+ Show
3
+ } from "./chunk-R4H3352X.js";
4
+ import {
5
+ IconButton
6
+ } from "./chunk-MRJ3KCHK.js";
7
+
8
+ // src/components/Tag.tsx
9
+ import { Close } from "@cerberus/icons";
10
+ import { cx } from "@cerberus/styled-system/css";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ function Tag(props) {
13
+ const { shape, onClick, usage, ...nativeProps } = props;
14
+ const isClosable = Boolean(onClick);
15
+ const finalShape = isClosable ? "pill" : shape;
16
+ return /* @__PURE__ */ jsxs(
17
+ "span",
18
+ {
19
+ ...nativeProps,
20
+ className: cx(nativeProps.className, "tag"),
21
+ "data-temp-shape": finalShape,
22
+ "data-temp-usage": usage,
23
+ children: [
24
+ props.children,
25
+ /* @__PURE__ */ jsx(Show, { when: isClosable, children: /* @__PURE__ */ jsx(IconButton, { ariaLabel: "Close", onClick, children: /* @__PURE__ */ jsx(Close, {}) }) })
26
+ ]
27
+ }
28
+ );
29
+ }
30
+
31
+ export {
32
+ Tag
33
+ };
34
+ //# sourceMappingURL=chunk-YZO3DYQU.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 { IconButton } from './IconButton'\nimport { cx } from '@cerberus/styled-system/css'\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 shape?: 'pill'\n onClick: () => void\n usage?: 'filled'\n}\n\nexport function Tag(\n props: PropsWithChildren<TagProps | ClickableTagProps>,\n): JSX.Element {\n const { shape, onClick, usage, ...nativeProps } = props\n const isClosable = Boolean(onClick)\n const finalShape = isClosable ? 'pill' : shape\n\n return (\n <span\n {...nativeProps}\n className={cx(nativeProps.className, 'tag')}\n data-temp-shape={finalShape}\n data-temp-usage={usage}\n >\n {props.children}\n\n <Show when={isClosable}>\n <IconButton ariaLabel=\"Close\" onClick={onClick}>\n <Close />\n </IconButton>\n </Show>\n </span>\n )\n}\n"],"mappings":";;;;;;;;AACA,SAAS,aAAa;AAItB,SAAS,UAAU;AAqBf,SAUM,KAVN;AARG,SAAS,IACd,OACa;AACb,QAAM,EAAE,OAAO,SAAS,OAAO,GAAG,YAAY,IAAI;AAClD,QAAM,aAAa,QAAQ,OAAO;AAClC,QAAM,aAAa,aAAa,SAAS;AAEzC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,GAAG,YAAY,WAAW,KAAK;AAAA,MAC1C,mBAAiB;AAAA,MACjB,mBAAiB;AAAA,MAEhB;AAAA,cAAM;AAAA,QAEP,oBAAC,QAAK,MAAM,YACV,8BAAC,cAAW,WAAU,SAAQ,SAC5B,8BAAC,SAAM,GACT,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,9 @@
1
+ import {
2
+ Tag
3
+ } from "../chunk-YZO3DYQU.js";
4
+ import "../chunk-R4H3352X.js";
5
+ import "../chunk-MRJ3KCHK.js";
6
+ export {
7
+ Tag
8
+ };
9
+ //# 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-YZO3DYQU.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,14 @@ 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
+ shape?: 'pill';
37
+ onClick: () => void;
38
+ usage?: 'filled';
39
+ }
40
+ export { ClickableTagProps }
41
+ export { ClickableTagProps as ClickableTagProps_alias_1 }
42
+
34
43
  declare type ColorModes = 'light' | 'dark';
35
44
  export { ColorModes }
36
45
  export { ColorModes as ColorModes_alias_1 }
@@ -402,6 +411,18 @@ declare interface TabsProps {
402
411
  export { TabsProps }
403
412
  export { TabsProps as TabsProps_alias_1 }
404
413
 
414
+ declare function Tag(props: PropsWithChildren<TagProps | ClickableTagProps>): JSX.Element;
415
+ export { Tag }
416
+ export { Tag as Tag_alias_1 }
417
+
418
+ declare interface TagProps extends HTMLAttributes<HTMLSpanElement> {
419
+ palette?: Sentiment;
420
+ shape?: 'rounded' | 'pill';
421
+ usage?: 'filled' | 'outline';
422
+ }
423
+ export { TagProps }
424
+ export { TagProps as TagProps_alias_1 }
425
+
405
426
  /**
406
427
  * A component that allows the user to input large blocks of text.
407
428
  * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Textarea.tsx
@@ -0,0 +1,34 @@
1
+ import {
2
+ Show
3
+ } from "./chunk-R4H3352X.js";
4
+ import {
5
+ IconButton
6
+ } from "./chunk-MRJ3KCHK.js";
7
+
8
+ // src/components/Tag.tsx
9
+ import { Close } from "@cerberus/icons";
10
+ import { cx } from "@cerberus/styled-system/css";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ function Tag(props) {
13
+ const { shape, onClick, usage, ...nativeProps } = props;
14
+ const isClosable = Boolean(onClick);
15
+ const finalShape = isClosable ? "pill" : shape;
16
+ return /* @__PURE__ */ jsxs(
17
+ "span",
18
+ {
19
+ ...nativeProps,
20
+ className: cx(nativeProps.className, "tag"),
21
+ "data-temp-shape": finalShape,
22
+ "data-temp-usage": usage,
23
+ children: [
24
+ props.children,
25
+ /* @__PURE__ */ jsx(Show, { when: isClosable, children: /* @__PURE__ */ jsx(IconButton, { ariaLabel: "Close", onClick, children: /* @__PURE__ */ jsx(Close, {}) }) })
26
+ ]
27
+ }
28
+ );
29
+ }
30
+
31
+ export {
32
+ Tag
33
+ };
34
+ //# sourceMappingURL=chunk-YZO3DYQU.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 { IconButton } from './IconButton'\nimport { cx } from '@cerberus/styled-system/css'\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 shape?: 'pill'\n onClick: () => void\n usage?: 'filled'\n}\n\nexport function Tag(\n props: PropsWithChildren<TagProps | ClickableTagProps>,\n): JSX.Element {\n const { shape, onClick, usage, ...nativeProps } = props\n const isClosable = Boolean(onClick)\n const finalShape = isClosable ? 'pill' : shape\n\n return (\n <span\n {...nativeProps}\n className={cx(nativeProps.className, 'tag')}\n data-temp-shape={finalShape}\n data-temp-usage={usage}\n >\n {props.children}\n\n <Show when={isClosable}>\n <IconButton ariaLabel=\"Close\" onClick={onClick}>\n <Close />\n </IconButton>\n </Show>\n </span>\n )\n}\n"],"mappings":";;;;;;;;AACA,SAAS,aAAa;AAItB,SAAS,UAAU;AAqBf,SAUM,KAVN;AARG,SAAS,IACd,OACa;AACb,QAAM,EAAE,OAAO,SAAS,OAAO,GAAG,YAAY,IAAI;AAClD,QAAM,aAAa,QAAQ,OAAO;AAClC,QAAM,aAAa,aAAa,SAAS;AAEzC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,GAAG,YAAY,WAAW,KAAK;AAAA,MAC1C,mBAAiB;AAAA,MACjB,mBAAiB;AAAA,MAEhB;AAAA,cAAM;AAAA,QAEP,oBAAC,QAAK,MAAM,YACV,8BAAC,cAAW,WAAU,SAAQ,SAC5B,8BAAC,SAAM,GACT,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,9 @@
1
+ import {
2
+ Tag
3
+ } from "../chunk-YZO3DYQU.js";
4
+ import "../chunk-R4H3352X.js";
5
+ import "../chunk-MRJ3KCHK.js";
6
+ export {
7
+ Tag
8
+ };
9
+ //# 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-YZO3DYQU.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-a65ca8e",
3
+ "version": "0.3.2-next-bdab9b9",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -0,0 +1,42 @@
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 { IconButton } from './IconButton'
6
+ import { cx } from '@cerberus/styled-system/css'
7
+
8
+ export interface TagProps extends HTMLAttributes<HTMLSpanElement> {
9
+ palette?: Sentiment
10
+ shape?: 'rounded' | 'pill'
11
+ usage?: 'filled' | 'outline'
12
+ }
13
+ export interface ClickableTagProps extends HTMLAttributes<HTMLSpanElement> {
14
+ shape?: 'pill'
15
+ onClick: () => void
16
+ usage?: 'filled'
17
+ }
18
+
19
+ export function Tag(
20
+ props: PropsWithChildren<TagProps | ClickableTagProps>,
21
+ ): JSX.Element {
22
+ const { shape, onClick, usage, ...nativeProps } = props
23
+ const isClosable = Boolean(onClick)
24
+ const finalShape = isClosable ? 'pill' : shape
25
+
26
+ return (
27
+ <span
28
+ {...nativeProps}
29
+ className={cx(nativeProps.className, 'tag')}
30
+ data-temp-shape={finalShape}
31
+ data-temp-usage={usage}
32
+ >
33
+ {props.children}
34
+
35
+ <Show when={isClosable}>
36
+ <IconButton ariaLabel="Close" onClick={onClick}>
37
+ <Close />
38
+ </IconButton>
39
+ </Show>
40
+ </span>
41
+ )
42
+ }
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