linear-react-components-ui 1.1.6-beta.0 → 1.1.6-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.
@@ -1,15 +1,42 @@
1
+ @import "colors.scss";
2
+
1
3
  /*
2
4
  * Caso altere o nome da classe, deverá pesquisar em todo projeto se existe
3
5
  * algum lugar que esta sobescrevendo
4
6
  */
5
- .icon-component {
6
- margin: 0px 2px;
7
- }
8
-
9
7
  .icon-component-container {
10
8
  display: inline-flex;
11
9
  place-self: center;
12
10
  padding: 2px;
13
11
  border-radius: 99999px;
14
12
  pointer-events: fill;
13
+
14
+ }
15
+
16
+ .icon-component {
17
+ margin: 0px 2px;
18
+ &:not([fill]) {
19
+ fill: #676464;
20
+ }
21
+
22
+ &[data-color-style="primary"] {
23
+ fill: $primary-color
24
+ }
25
+
26
+ &[data-color-style="success"] {
27
+ fill: $success-color
28
+ }
29
+
30
+ &[data-color-style="info"] {
31
+ fill: $info-color
32
+ }
33
+
34
+ &[data-color-style="warning"] {
35
+ fill: $warning-color
36
+ }
37
+
38
+ &[data-color-style="danger"] {
39
+ fill: $danger-color
40
+ }
15
41
  }
42
+
@@ -0,0 +1,9 @@
1
+ @import "colors.scss";
2
+ @import "fonts.scss";
3
+
4
+ .text-content-component {
5
+ @extend %component-fonts;
6
+ &[data-textcontent="strong"] {
7
+ font-weight: bold;
8
+ }
9
+ }
@@ -1,5 +1,5 @@
1
+ import React__default from 'react';
1
2
  import { ICheckBoxProps } from './types.js';
2
- import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../@types/Position.js';
5
5
 
@@ -8,6 +8,6 @@ import '../@types/Position.js';
8
8
  * o componente Field dentro do componente Form, pois o mesmo leva em consideração o tipo do
9
9
  * componente para gerar propriedades customizadas.
10
10
  */
11
- declare const CheckBox: ({ name, required, value, label, onChange, autofocus, hint, id, gridLayout, checked, disabled, permissionAttr, tooltip, tooltipPosition, tooltipWidth, skeletonize, targetRef, errorMessages, }: ICheckBoxProps) => JSX.Element | null;
11
+ declare const CheckBox: React__default.ForwardRefExoticComponent<ICheckBoxProps & React__default.RefAttributes<HTMLInputElement>>;
12
12
 
13
13
  export { CheckBox as default };
@@ -21,7 +21,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
21
21
  * componente para gerar propriedades customizadas.
22
22
  */
23
23
 
24
- const CheckBox = _ref => {
24
+ const CheckBox = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
25
25
  let {
26
26
  name,
27
27
  required,
@@ -30,7 +30,7 @@ const CheckBox = _ref => {
30
30
  onChange,
31
31
  autofocus,
32
32
  hint,
33
- id = '',
33
+ id = undefined,
34
34
  gridLayout,
35
35
  checked = false,
36
36
  disabled,
@@ -46,6 +46,7 @@ const CheckBox = _ref => {
46
46
  const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
47
47
  const [onDenied] = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr));
48
48
  const inputRef = (0, _react.useRef)(null);
49
+ (0, _react.useImperativeHandle)(ref, () => inputRef.current, [inputRef.current]);
49
50
  (0, _react.useEffect)(() => {
50
51
  setIsChecked(checked);
51
52
  }, [checked]);
@@ -78,8 +79,7 @@ const CheckBox = _ref => {
78
79
  onClick: !shouldDisable() && !skeletonize ? () => setIsChecked(!isChecked) : undefined,
79
80
  tabIndex: -1,
80
81
  role: "checkbox",
81
- "aria-checked": "false",
82
- onKeyPress: undefined
82
+ "aria-checked": "false"
83
83
  }, /*#__PURE__*/_react.default.createElement("input", {
84
84
  id: id || undefined,
85
85
  ref: r => {
@@ -113,5 +113,6 @@ const CheckBox = _ref => {
113
113
  customClass: "-withinput",
114
114
  cols: gridLayout
115
115
  }, renderInput()) : renderInput();
116
- };
116
+ });
117
+ CheckBox.displayName = 'CheckBox';
117
118
  var _default = exports.default = CheckBox;
@@ -4,7 +4,7 @@ import { Position } from '../@types/Position.js';
4
4
 
5
5
  type ChangeEvent = {
6
6
  checked: boolean;
7
- id: string;
7
+ id?: string;
8
8
  name?: string;
9
9
  value: boolean;
10
10
  };
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
7
+ var _react = _interopRequireDefault(require("react"));
8
8
  require("../../assets/styles/dialog.scss");
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
10
  const Content = _ref => {
12
11
  let {
13
12
  children,
@@ -17,6 +16,6 @@ const Content = _ref => {
17
16
  id: "modal-dialog-content",
18
17
  className: "dialog-content",
19
18
  style: styleForContent
20
- }, /*#__PURE__*/_react.default.createElement(_react.Suspense, null, children));
19
+ }, children);
21
20
  };
22
21
  var _default = exports.default = Content;
@@ -21,6 +21,6 @@ const Content = _ref => {
21
21
  return hideContent ? /*#__PURE__*/_react.default.createElement(_noPermission.default, null) : /*#__PURE__*/_react.default.createElement("div", {
22
22
  className: "drawerbody",
23
23
  style: style
24
- }, /*#__PURE__*/_react.default.createElement(_react.Suspense, null, children));
24
+ }, children);
25
25
  };
26
26
  var _default = exports.default = Content;
@@ -24,7 +24,7 @@ const getIcon = (titleIcon, icon) => {
24
24
  return /*#__PURE__*/_react.default.createElement("span", {
25
25
  "data-testid": "icon-header",
26
26
  className: "icon-header"
27
- }, icon || /*#__PURE__*/_react.default.createElement(_icons.default, {
27
+ }, icon || titleIcon && /*#__PURE__*/_react.default.createElement(_icons.default, {
28
28
  name: titleIcon,
29
29
  color: "#000",
30
30
  size: 24
@@ -575,7 +575,7 @@ var _default = exports.default = {
575
575
  },
576
576
  cash3: {
577
577
  viewbox: '0 0 17 16',
578
- paths: ['9h1v1h-1v-1z', 'M0 6v9h17v-9h-17zM3 14h-2v-2h1v1h1v1zM3 8h-1v1h-1v-2h2v1zM10.5 10c0.276 0 0.5 0.224 0.5 0.5v2c0 0.276-0.224 0.5-0.5 0.5h-1.5v0.5c0 0.276-0.224 0.5-0.5 0.5s-0.5-0.224-0.5-0.5v-0.5h-1.5c-0.276 0-0.5-0.224-0.5-0.5s0.224-0.5 0.5-0.5h1.5v-1h-1.5c-0.276 0-0.5-0.224-0.5-0.5v-2c0-0.276 0.224-0.5 0.5-0.5h1.5v-0.5c0-0.276 0.224-0.5 0.5-0.5s0.5 0.224 0.5 0.5v0.5h1.5c0.276 0 0.5 0.224 0.5 0.5s-0.224 0.5-0.5 0.5h-1.5v1h1.5zM16 14h-2v-1h1v-1h1v2zM16 9h-1v-1h-1v-1h2v2z', 'M9 11h1v1h-1v-1z', 'M1 4h15v1.5h-15v-1.5z', 'M2 2h13v1.5h-13v-1.5z']
578
+ paths: ['M7 9h1v1h-1v-1z', 'M0 6v9h17v-9h-17zM3 14h-2v-2h1v1h1v1zM3 8h-1v1h-1v-2h2v1zM10.5 10c0.276 0 0.5 0.224 0.5 0.5v2c0 0.276-0.224 0.5-0.5 0.5h-1.5v0.5c0 0.276-0.224 0.5-0.5 0.5s-0.5-0.224-0.5-0.5v-0.5h-1.5c-0.276 0-0.5-0.224-0.5-0.5s0.224-0.5 0.5-0.5h1.5v-1h-1.5c-0.276 0-0.5-0.224-0.5-0.5v-2c0-0.276 0.224-0.5 0.5-0.5h1.5v-0.5c0-0.276 0.224-0.5 0.5-0.5s0.5 0.224 0.5 0.5v0.5h1.5c0.276 0 0.5 0.224 0.5 0.5s-0.224 0.5-0.5 0.5h-1.5v1h1.5zM16 14h-2v-1h1v-1h1v2zM16 9h-1v-1h-1v-1h2v2z', 'M9 11h1v1h-1v-1z', 'M1 4h15v1.5h-15v-1.5z', 'M2 2h13v1.5h-13v-1.5z']
579
579
  },
580
580
  wallet: {
581
581
  viewbox: '0 0 17 16',
@@ -1,13 +1,14 @@
1
- import { IIconProps } from './types.js';
1
+ import { IconProps } from './types.js';
2
2
  import 'react';
3
3
  import '../@types/PointerEvents.js';
4
4
  import '../@types/SizePixels.js';
5
5
  import '../@types/Icon.js';
6
6
  import './helper.js';
7
7
  import '../@types/Position.js';
8
+ import '../@types/ColorStyles.js';
8
9
 
9
10
  declare const _default: {
10
- (props: IIconProps): JSX.Element;
11
+ (props: IconProps): JSX.Element;
11
12
  displayName: string;
12
13
  };
13
14
 
@@ -24,17 +24,23 @@ const Icon = _ref => {
24
24
  disabled = false,
25
25
  customClass = '',
26
26
  customClassForContainer = '',
27
- color = '#676464',
27
+ colorStyle = 'default',
28
+ color,
29
+ viewBox,
28
30
  pointerEvents = 'none',
29
31
  targetRef,
30
32
  tooltip
31
33
  } = _ref;
34
+ const isUsingColorStyle = colorStyle !== 'default';
35
+ const colorFromProp = isUsingColorStyle || !color ? undefined : color;
32
36
  const refSvg = (0, _react.useRef)(null);
37
+ const viewBoxFromIconOrSvgStrcut = name ? listIcon[name].viewbox : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.viewbox;
33
38
  const getPaths = () => name ? listIcon[name].paths : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.paths;
34
39
  const getSvg = () => {
35
40
  var _getPaths;
36
41
  return /*#__PURE__*/_react.default.createElement("svg", {
37
42
  "data-testid": "icon",
43
+ "data-color-style": colorStyle,
38
44
  onClick: () => {
39
45
  if (onClick && !disabled) onClick();
40
46
  },
@@ -43,8 +49,8 @@ const Icon = _ref => {
43
49
  },
44
50
  width: "".concat(size, "px"),
45
51
  height: "".concat(size, "px"),
46
- fill: disabled ? disabledIconColor : color,
47
- viewBox: name ? listIcon[name].viewbox : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.viewbox,
52
+ fill: disabled ? disabledIconColor : colorFromProp,
53
+ viewBox: viewBox || viewBoxFromIconOrSvgStrcut,
48
54
  className: "icon-component ".concat(customClass),
49
55
  pointerEvents: pointerEvents,
50
56
  style: style
@@ -54,6 +60,7 @@ const Icon = _ref => {
54
60
  key: value
55
61
  })));
56
62
  };
63
+ if (color && colorStyle !== 'default') throw new Error('Expected only one of the two properties: colorStyle or color');
57
64
  if (!name && !svgStruct) throw new Error('One of the "name" and "svgStruct" props must be filled');
58
65
  if (!visible) return null;
59
66
  if (!tooltip) return getSvg();
@@ -3,6 +3,7 @@ import { PointerEvents } from '../@types/PointerEvents.js';
3
3
  import { SizePixels } from '../@types/SizePixels.js';
4
4
  import { IconNames } from '../@types/Icon.js';
5
5
  import { Position } from '../@types/Position.js';
6
+ import { ColorStyles } from '../@types/ColorStyles.js';
6
7
  import './helper.js';
7
8
 
8
9
  type ListIconType = {
@@ -11,26 +12,38 @@ type ListIconType = {
11
12
  paths: Array<string>;
12
13
  };
13
14
  };
14
- interface IIconProps {
15
+ type SvgStruct = {
16
+ viewbox: string;
17
+ paths: Array<string>;
18
+ };
19
+ type BaseIconProps = {
15
20
  size?: SizePixels;
16
- color?: string;
17
21
  customClass?: string;
18
22
  customClassForContainer?: string;
19
23
  style?: CSSProperties;
20
24
  visible?: boolean;
21
25
  disabled?: boolean;
22
26
  pointerEvents?: PointerEvents;
23
- name?: IconNames;
24
27
  viewBox?: string;
25
- svgStruct?: {
26
- viewbox: string;
27
- paths: Array<string>;
28
- };
29
28
  onClick?: () => void;
30
29
  tooltipPosition?: Exclude<Position, 'center'>;
31
30
  tooltipWidth?: string | number;
32
31
  tooltip?: string;
33
32
  targetRef?: (ref: HTMLDivElement) => void;
34
- }
33
+ };
34
+ type ColorProps = ({
35
+ colorStyle?: ColorStyles | 'default';
36
+ color?: null;
37
+ } | {
38
+ color?: string;
39
+ colorStyle?: undefined;
40
+ });
41
+ type IconProps = BaseIconProps & ColorProps & ({
42
+ name: IconNames;
43
+ svgStruct?: null;
44
+ } | {
45
+ svgStruct: SvgStruct;
46
+ name?: null;
47
+ });
35
48
 
36
- export { IIconProps, ListIconType };
49
+ export { IconProps, ListIconType };
package/lib/index.d.ts CHANGED
@@ -27,6 +27,7 @@ import './labels/types.js';
27
27
  import './icons/types.js';
28
28
  import './@types/PointerEvents.js';
29
29
  import './@types/SizePixels.js';
30
+ import './@types/ColorStyles.js';
30
31
  import './list/Header.js';
31
32
  import './list/types.js';
32
33
  import './list/Item.js';
@@ -8,6 +8,6 @@ import '../../@types/PermissionAttr.js';
8
8
  import '../../internals/types.js';
9
9
  import '../../@types/Position.js';
10
10
 
11
- declare const File: ({ applyDragDrop, defaultFiles, gridLayout, ...rest }: IFileProps) => JSX.Element;
11
+ declare const File: ({ applyDragDrop, defaultFiles, gridLayout, onBtnClickRemove: onBtnClickRemoveProp, ...rest }: Omit<IFileProps, 'onBtnClickInsert'>) => JSX.Element;
12
12
 
13
13
  export { File as default };
@@ -9,7 +9,7 @@ var _DefaultFile = _interopRequireDefault(require("./DefaultFile"));
9
9
  var _DragDropFile = _interopRequireDefault(require("./DragDropFile"));
10
10
  var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
11
11
  var _helpers = require("./helpers");
12
- const _excluded = ["applyDragDrop", "defaultFiles", "gridLayout"];
12
+ const _excluded = ["applyDragDrop", "defaultFiles", "gridLayout", "onBtnClickRemove"];
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -20,7 +20,8 @@ const File = _ref => {
20
20
  let {
21
21
  applyDragDrop = false,
22
22
  defaultFiles,
23
- gridLayout
23
+ gridLayout,
24
+ onBtnClickRemove: onBtnClickRemoveProp
24
25
  } = _ref,
25
26
  rest = _objectWithoutProperties(_ref, _excluded);
26
27
  const inputFileRef = (0, _react.useRef)(null);
@@ -33,6 +34,7 @@ const File = _ref => {
33
34
  if (inputFileRef.current) {
34
35
  inputFileRef.current.value = '';
35
36
  }
37
+ if (onBtnClickRemoveProp) onBtnClickRemoveProp();
36
38
  };
37
39
  (0, _react.useEffect)(() => {
38
40
  if (inputFileRef !== null && inputFileRef !== void 0 && inputFileRef.current && defaultFiles) {
@@ -19,7 +19,7 @@ interface IFloatMenuItemProps {
19
19
  title?: string;
20
20
  url?: string;
21
21
  urlHref?: string;
22
- iconName?: IconNames;
22
+ iconName: IconNames;
23
23
  iconColor?: string;
24
24
  iconSize?: SizePixels;
25
25
  customClass?: string;
@@ -60,7 +60,7 @@ interface INavSubMenuItemProps {
60
60
  interface IExpandMenuProps {
61
61
  expandMenuCustomClass?: string;
62
62
  onExpandMenu?: () => void;
63
- iconName?: IconNames;
63
+ iconName: IconNames;
64
64
  }
65
65
  interface IEmptyListProps {
66
66
  info?: string;
@@ -0,0 +1,8 @@
1
+ import React__default from 'react';
2
+
3
+ interface TextContentProps extends React__default.HTMLAttributes<HTMLElement> {
4
+ as?: 'span' | 'strong' | 'p';
5
+ }
6
+ declare const TextContent: React__default.ForwardRefExoticComponent<TextContentProps & React__default.RefAttributes<HTMLElement>>;
7
+
8
+ export { TextContent as default };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ require("../assets/styles/textContent.scss");
9
+ const _excluded = ["as", "children", "className"];
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
13
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
14
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
15
+ const TextContent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
16
+ let {
17
+ as: Comp = 'span',
18
+ children,
19
+ className
20
+ } = _ref,
21
+ props = _objectWithoutProperties(_ref, _excluded);
22
+ const typedRef = ref;
23
+ return /*#__PURE__*/_react.default.createElement(Comp, _extends({
24
+ ref: typedRef,
25
+ className: "text-content-component ".concat(className),
26
+ "data-textcontent": Comp
27
+ }, props), children);
28
+ });
29
+ TextContent.displayName = 'TextContent';
30
+ var _default = exports.default = TextContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "1.1.6-beta.0",
3
+ "version": "1.1.6-beta.2",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",
@@ -44,6 +44,7 @@
44
44
  "@types/react-dom": "18.0.5",
45
45
  "attach-dom-events": "1.0.0",
46
46
  "browserslist": "4.23.0",
47
+ "esbuild": "0.21.5",
47
48
  "history": "5.0.0",
48
49
  "imask": "6.4.3",
49
50
  "init": "0.1.2",
@@ -72,7 +73,7 @@
72
73
  "@types/lodash": "4.14.191",
73
74
  "@types/node": "17.0.45",
74
75
  "@types/react": "18.0.26",
75
- "@types/react-dev-utils": "^9.0.11",
76
+ "@types/react-dev-utils": "9.0.11",
76
77
  "@types/react-dom": "18.0.5",
77
78
  "@types/react-router-dom": "5.3.3",
78
79
  "@types/react-syntax-highlighter": "15.5.6",
@@ -80,7 +81,7 @@
80
81
  "@types/uuid": "8.3.4",
81
82
  "@typescript-eslint/eslint-plugin": "6.21.0",
82
83
  "@typescript-eslint/parser": "6.21.0",
83
- "babel-eslint": "7.2.3",
84
+ "babel-eslint": "10.1.0",
84
85
  "babel-jest": "29.7.0",
85
86
  "babel-loader": "9.1.3",
86
87
  "babel-polyfill": "6.26.0",