@tecsinapse/cortex-react 1.10.1 → 1.11.1

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.
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ var clsx = require('clsx');
4
+ var React = require('react');
5
+
6
+ const Box = React.forwardRef((props, ref) => {
7
+ const { id, ...rest } = props;
8
+ return /* @__PURE__ */ React.createElement("div", { className: "w-tera h-kilo overflow-hidden relative" }, /* @__PURE__ */ React.createElement(
9
+ "input",
10
+ {
11
+ ...rest,
12
+ id,
13
+ type: "color",
14
+ className: "bg-transparent cursor-pointer disabled:opacity-50 disabled:cursor-default absolute -top-1.5 -right-1 w-peta h-giga",
15
+ ref
16
+ }
17
+ ));
18
+ });
19
+ const Face = ({ children }) => {
20
+ return /* @__PURE__ */ React.createElement("div", { className: "rounded-mili p-mili shadow-default bg-white flex flex-row items-center gap-2" }, children);
21
+ };
22
+ const Label = ({
23
+ children,
24
+ id,
25
+ className,
26
+ ...rest
27
+ }) => {
28
+ return /* @__PURE__ */ React.createElement("label", { ...rest, htmlFor: id, className: clsx("text-base", className) }, children);
29
+ };
30
+ const Root = React.forwardRef((props, ref) => {
31
+ const { id, value, ...rest } = props;
32
+ return /* @__PURE__ */ React.createElement(Face, null, /* @__PURE__ */ React.createElement(Box, { ...rest, ref, id, value }), value ? /* @__PURE__ */ React.createElement(Label, { id }, value) : null);
33
+ });
34
+ const ColorPicker = {
35
+ Box,
36
+ Face,
37
+ Label,
38
+ Root
39
+ };
40
+
41
+ exports.ColorPicker = ColorPicker;
package/dist/cjs/index.js CHANGED
@@ -11,6 +11,7 @@ var RangeCalendar = require('./components/Calendar/RangeCalendar.js');
11
11
  var Card = require('./components/Card.js');
12
12
  var Carousel = require('./components/Carousel/Carousel.js');
13
13
  var Checkbox = require('./components/Checkbox.js');
14
+ var ColorPicker = require('./components/ColorPicker.js');
14
15
  var DateField = require('./components/DatePicker/DateField.js');
15
16
  var DatePickerInput = require('./components/DatePicker/DatePickerInput.js');
16
17
  var DatePickerInputBase = require('./components/DatePicker/DatePickerInputBase.js');
@@ -81,6 +82,7 @@ exports.RangeCalendar = RangeCalendar.RangeCalendar;
81
82
  exports.Card = Card.Card;
82
83
  exports.Carousel = Carousel.Carousel;
83
84
  exports.Checkbox = Checkbox.Checkbox;
85
+ exports.ColorPicker = ColorPicker.ColorPicker;
84
86
  exports.DateField = DateField.DateField;
85
87
  exports.DatePickerInput = DatePickerInput.DatePickerInput;
86
88
  exports.DatePickerInputBase = DatePickerInputBase.DatePickerInputBase;
@@ -1,12 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const getNameInitials = (name) => {
4
- const nameSplit = name.split(" ");
5
- const length = nameSplit.length;
6
- if (length > 1) {
7
- return `${nameSplit[0][0]}${nameSplit[length - 1][0]}`;
8
- }
9
- return name[0];
4
+ const [firstName, ...rest] = name.split(" ");
5
+ return `${firstName?.charAt(0)}${rest?.[rest?.length - 1]?.charAt(0) ?? ""}`;
10
6
  };
11
7
 
12
8
  exports.getNameInitials = getNameInitials;
@@ -0,0 +1,39 @@
1
+ import clsx from 'clsx';
2
+ import React__default, { forwardRef } from 'react';
3
+
4
+ const Box = forwardRef((props, ref) => {
5
+ const { id, ...rest } = props;
6
+ return /* @__PURE__ */ React__default.createElement("div", { className: "w-tera h-kilo overflow-hidden relative" }, /* @__PURE__ */ React__default.createElement(
7
+ "input",
8
+ {
9
+ ...rest,
10
+ id,
11
+ type: "color",
12
+ className: "bg-transparent cursor-pointer disabled:opacity-50 disabled:cursor-default absolute -top-1.5 -right-1 w-peta h-giga",
13
+ ref
14
+ }
15
+ ));
16
+ });
17
+ const Face = ({ children }) => {
18
+ return /* @__PURE__ */ React__default.createElement("div", { className: "rounded-mili p-mili shadow-default bg-white flex flex-row items-center gap-2" }, children);
19
+ };
20
+ const Label = ({
21
+ children,
22
+ id,
23
+ className,
24
+ ...rest
25
+ }) => {
26
+ return /* @__PURE__ */ React__default.createElement("label", { ...rest, htmlFor: id, className: clsx("text-base", className) }, children);
27
+ };
28
+ const Root = forwardRef((props, ref) => {
29
+ const { id, value, ...rest } = props;
30
+ return /* @__PURE__ */ React__default.createElement(Face, null, /* @__PURE__ */ React__default.createElement(Box, { ...rest, ref, id, value }), value ? /* @__PURE__ */ React__default.createElement(Label, { id }, value) : null);
31
+ });
32
+ const ColorPicker = {
33
+ Box,
34
+ Face,
35
+ Label,
36
+ Root
37
+ };
38
+
39
+ export { ColorPicker };
package/dist/esm/index.js CHANGED
@@ -9,6 +9,7 @@ export { RangeCalendar } from './components/Calendar/RangeCalendar.js';
9
9
  export { Card } from './components/Card.js';
10
10
  export { Carousel } from './components/Carousel/Carousel.js';
11
11
  export { Checkbox } from './components/Checkbox.js';
12
+ export { ColorPicker } from './components/ColorPicker.js';
12
13
  export { DateField } from './components/DatePicker/DateField.js';
13
14
  export { DatePickerInput } from './components/DatePicker/DatePickerInput.js';
14
15
  export { DatePickerInputBase } from './components/DatePicker/DatePickerInputBase.js';
@@ -1,10 +1,6 @@
1
1
  const getNameInitials = (name) => {
2
- const nameSplit = name.split(" ");
3
- const length = nameSplit.length;
4
- if (length > 1) {
5
- return `${nameSplit[0][0]}${nameSplit[length - 1][0]}`;
6
- }
7
- return name[0];
2
+ const [firstName, ...rest] = name.split(" ");
3
+ return `${firstName?.charAt(0)}${rest?.[rest?.length - 1]?.charAt(0) ?? ""}`;
8
4
  };
9
5
 
10
6
  export { getNameInitials };
@@ -0,0 +1,11 @@
1
+ import React, { type HTMLAttributes, type InputHTMLAttributes } from 'react';
2
+ export interface ColorPickerProps extends InputHTMLAttributes<HTMLInputElement> {
3
+ }
4
+ export declare const ColorPicker: {
5
+ Box: React.ForwardRefExoticComponent<ColorPickerProps & React.RefAttributes<HTMLInputElement>>;
6
+ Face: ({ children }: {
7
+ children: any;
8
+ }) => React.JSX.Element;
9
+ Label: ({ children, id, className, ...rest }: HTMLAttributes<HTMLLabelElement>) => React.JSX.Element;
10
+ Root: React.ForwardRefExoticComponent<ColorPickerProps & React.RefAttributes<HTMLInputElement>>;
11
+ };
@@ -7,6 +7,7 @@ export * from './Calendar';
7
7
  export * from './Card';
8
8
  export * from './Carousel';
9
9
  export * from './Checkbox';
10
+ export * from './ColorPicker';
10
11
  export * from './DatePicker';
11
12
  export * from './Divider';
12
13
  export * from './Drawer';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-react",
3
- "version": "1.10.1",
3
+ "version": "1.11.1",
4
4
  "description": "React components based in @tecsinapse/cortex-core",
5
5
  "license": "MIT",
6
6
  "main": "dist/esm/index.js",
@@ -47,5 +47,5 @@
47
47
  "react-icons": ">=5.2.0",
48
48
  "tailwind": ">=3.3.0"
49
49
  },
50
- "gitHead": "0a687dd331d6aecdb8cb7ee10c7165e9f22fcbb8"
50
+ "gitHead": "925c051b43f24c3552cfea92d4f8db6cf4b919d0"
51
51
  }