@tecsinapse/cortex-react 1.5.0-beta.0 → 1.5.0-beta.2

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.
@@ -2,10 +2,39 @@
2
2
 
3
3
  var cortexCore = require('@tecsinapse/cortex-core');
4
4
  var React = require('react');
5
+ var lia = require('react-icons/lia');
5
6
 
6
- const Tag = React.forwardRef((props, ref) => {
7
- const { label, variants, children } = props;
8
- return /* @__PURE__ */ React.createElement("div", { className: cortexCore.tag(variants), ref }, label ? /* @__PURE__ */ React.createElement("p", null, label) : /* @__PURE__ */ React.createElement(React.Fragment, null), children);
7
+ const Close = ({ onClick, className }) => {
8
+ return /* @__PURE__ */ React.createElement("button", { onClick, "data-testid": "tag-close-button" }, /* @__PURE__ */ React.createElement(lia.LiaTimesSolid, { className }));
9
+ };
10
+ const Label = ({ children, className }) => {
11
+ return /* @__PURE__ */ React.createElement("p", { className }, children);
12
+ };
13
+ const Face = React.forwardRef((props, ref) => {
14
+ const { variants, className, children } = props;
15
+ return /* @__PURE__ */ React.createElement(
16
+ "div",
17
+ {
18
+ className: cortexCore.tag({
19
+ ...variants,
20
+ className
21
+ }),
22
+ ref
23
+ },
24
+ children
25
+ );
9
26
  });
27
+ const Root = React.forwardRef(
28
+ (props, ref) => {
29
+ const { label, variants, className, onDismiss } = props;
30
+ return /* @__PURE__ */ React.createElement(Face, { variants, className, ref }, /* @__PURE__ */ React.createElement(Label, null, label), onDismiss ? /* @__PURE__ */ React.createElement(Close, { onClick: onDismiss }) : null);
31
+ }
32
+ );
33
+ const Tag = {
34
+ Root,
35
+ Close,
36
+ Label,
37
+ Face
38
+ };
10
39
 
11
40
  exports.Tag = Tag;
@@ -1,9 +1,38 @@
1
1
  import { tag } from '@tecsinapse/cortex-core';
2
2
  import React__default, { forwardRef } from 'react';
3
+ import { LiaTimesSolid } from 'react-icons/lia';
3
4
 
4
- const Tag = forwardRef((props, ref) => {
5
- const { label, variants, children } = props;
6
- return /* @__PURE__ */ React__default.createElement("div", { className: tag(variants), ref }, label ? /* @__PURE__ */ React__default.createElement("p", null, label) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null), children);
5
+ const Close = ({ onClick, className }) => {
6
+ return /* @__PURE__ */ React__default.createElement("button", { onClick, "data-testid": "tag-close-button" }, /* @__PURE__ */ React__default.createElement(LiaTimesSolid, { className }));
7
+ };
8
+ const Label = ({ children, className }) => {
9
+ return /* @__PURE__ */ React__default.createElement("p", { className }, children);
10
+ };
11
+ const Face = forwardRef((props, ref) => {
12
+ const { variants, className, children } = props;
13
+ return /* @__PURE__ */ React__default.createElement(
14
+ "div",
15
+ {
16
+ className: tag({
17
+ ...variants,
18
+ className
19
+ }),
20
+ ref
21
+ },
22
+ children
23
+ );
7
24
  });
25
+ const Root = forwardRef(
26
+ (props, ref) => {
27
+ const { label, variants, className, onDismiss } = props;
28
+ return /* @__PURE__ */ React__default.createElement(Face, { variants, className, ref }, /* @__PURE__ */ React__default.createElement(Label, null, label), onDismiss ? /* @__PURE__ */ React__default.createElement(Close, { onClick: onDismiss }) : null);
29
+ }
30
+ );
31
+ const Tag = {
32
+ Root,
33
+ Close,
34
+ Label,
35
+ Face
36
+ };
8
37
 
9
38
  export { Tag };
@@ -1,9 +1,14 @@
1
1
  import { TagVariants } from '@tecsinapse/cortex-core';
2
- import React from 'react';
2
+ import React, { HTMLProps } from 'react';
3
3
  interface TagProps {
4
4
  variants?: TagVariants;
5
- label?: string;
6
- children?: React.ReactNode;
5
+ label: string;
6
+ onDismiss?: () => void;
7
7
  }
8
- export declare const Tag: React.ForwardRefExoticComponent<Omit<TagProps & React.HTMLProps<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ export declare const Tag: {
9
+ Root: React.ForwardRefExoticComponent<Omit<TagProps & React.HTMLProps<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
+ Close: ({ onClick, className }: HTMLProps<HTMLButtonElement>) => JSX.Element;
11
+ Label: ({ children, className }: HTMLProps<HTMLParagraphElement>) => JSX.Element;
12
+ Face: React.ForwardRefExoticComponent<Omit<Pick<TagProps, "variants"> & React.HTMLProps<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
13
+ };
9
14
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-react",
3
- "version": "1.5.0-beta.0",
3
+ "version": "1.5.0-beta.2",
4
4
  "description": "React components based in @tecsinapse/cortex-core",
5
5
  "license": "MIT",
6
6
  "main": "dist/esm/index.js",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@floating-ui/react": "^0.26.18",
22
22
  "@internationalized/date": "*",
23
- "@tecsinapse/cortex-core": "0.3.2-beta.0",
23
+ "@tecsinapse/cortex-core": "0.3.2-beta.2",
24
24
  "clsx": "*",
25
25
  "react-aria": "^3.33.1",
26
26
  "react-icons": "^5.2.1",
@@ -45,5 +45,5 @@
45
45
  "react-dom": ">=18.0.0",
46
46
  "tailwind": ">=3.3.0"
47
47
  },
48
- "gitHead": "d558fba8fa0ad1dc1548648aba43f95c517b7e5d"
48
+ "gitHead": "07dee8a955d9e1d264c118de21f025cd9b1e5c3f"
49
49
  }