linear-react-components-ui 1.1.0-beta.4 → 1.1.0-beta.6

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.
@@ -79,6 +79,14 @@
79
79
  margin-top: 0;
80
80
  padding-left: 22px;
81
81
  }
82
+
83
+ > .errormessages {
84
+ width: 100%;
85
+ color: red;
86
+ font-size: 13px!important;
87
+ line-height: 13px;
88
+ margin-top: 0px;
89
+ }
82
90
 
83
91
  &.-skeletonized {
84
92
  > .inputcontent {
@@ -36,6 +36,10 @@ $dropdown-width: 38px;
36
36
  display: flex;
37
37
  flex: 1;
38
38
  overflow: hidden;
39
+
40
+ &.-firsttabident>.menuitem:first-child {
41
+ margin-left: 15px;
42
+ }
39
43
  }
40
44
  .menu>.menuitem {
41
45
  border-bottom: 0;
@@ -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, }: ICheckBoxProps) => JSX.Element | null;
11
+ declare const CheckBox: (props: ICheckBoxProps) => JSX.Element | null;
12
12
 
13
13
  export { CheckBox as default };
@@ -8,9 +8,10 @@ exports["default"] = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _gridlayout = _interopRequireDefault(require("../gridlayout"));
10
10
  var _Label = _interopRequireDefault(require("./Label"));
11
- require("../assets/styles/checkbox.scss");
12
- var _permissionValidations = require("../permissionValidations");
13
11
  var _hint = _interopRequireDefault(require("../hint"));
12
+ var helpers = _interopRequireWildcard(require("../inputs/base/helpers"));
13
+ var _permissionValidations = require("../permissionValidations");
14
+ require("../assets/styles/checkbox.scss");
14
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
17
  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 && Object.prototype.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; }
@@ -27,28 +28,29 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
27
28
  * componente para gerar propriedades customizadas.
28
29
  */
29
30
 
30
- var CheckBox = function CheckBox(_ref) {
31
- var name = _ref.name,
32
- required = _ref.required,
33
- value = _ref.value,
34
- label = _ref.label,
35
- onChange = _ref.onChange,
36
- autofocus = _ref.autofocus,
37
- hint = _ref.hint,
38
- _ref$id = _ref.id,
39
- id = _ref$id === void 0 ? '' : _ref$id,
40
- gridLayout = _ref.gridLayout,
41
- _ref$checked = _ref.checked,
42
- checked = _ref$checked === void 0 ? false : _ref$checked,
43
- disabled = _ref.disabled,
44
- permissionAttr = _ref.permissionAttr,
45
- tooltip = _ref.tooltip,
46
- _ref$tooltipPosition = _ref.tooltipPosition,
47
- tooltipPosition = _ref$tooltipPosition === void 0 ? 'top' : _ref$tooltipPosition,
48
- _ref$tooltipWidth = _ref.tooltipWidth,
49
- tooltipWidth = _ref$tooltipWidth === void 0 ? 'auto' : _ref$tooltipWidth,
50
- skeletonize = _ref.skeletonize,
51
- targetRef = _ref.targetRef;
31
+ var CheckBox = function CheckBox(props) {
32
+ var name = props.name,
33
+ required = props.required,
34
+ value = props.value,
35
+ label = props.label,
36
+ onChange = props.onChange,
37
+ autofocus = props.autofocus,
38
+ hint = props.hint,
39
+ _props$id = props.id,
40
+ id = _props$id === void 0 ? '' : _props$id,
41
+ gridLayout = props.gridLayout,
42
+ _props$checked = props.checked,
43
+ checked = _props$checked === void 0 ? false : _props$checked,
44
+ disabled = props.disabled,
45
+ permissionAttr = props.permissionAttr,
46
+ tooltip = props.tooltip,
47
+ _props$tooltipPositio = props.tooltipPosition,
48
+ tooltipPosition = _props$tooltipPositio === void 0 ? 'top' : _props$tooltipPositio,
49
+ _props$tooltipWidth = props.tooltipWidth,
50
+ tooltipWidth = _props$tooltipWidth === void 0 ? 'auto' : _props$tooltipWidth,
51
+ skeletonize = props.skeletonize,
52
+ targetRef = props.targetRef,
53
+ errorMessages = props.errorMessages;
52
54
  var _useState = (0, _react.useState)(checked),
53
55
  _useState2 = _slicedToArray(_useState, 2),
54
56
  isChecked = _useState2[0],
@@ -120,7 +122,7 @@ var CheckBox = function CheckBox(_ref) {
120
122
  visible: !!hint,
121
123
  description: hint,
122
124
  customClass: "hint"
123
- }));
125
+ }), errorMessages && helpers.getErrorMessages(errorMessages));
124
126
  };
125
127
  if (onDenied.unvisible) return null;
126
128
  return gridLayout ? /*#__PURE__*/_react["default"].createElement(_gridlayout["default"], {
@@ -37,6 +37,7 @@ interface ICheckBoxProps {
37
37
  skeletonize?: boolean;
38
38
  targetRef?: (ref: HTMLInputElement | null) => void;
39
39
  targetSpanRef?: (ref: HTMLSpanElement | null) => void;
40
+ errorMessages?: string[] | undefined;
40
41
  }
41
42
 
42
43
  export type { ChangeEvent, ICheckBoxProps };
@@ -180,6 +180,7 @@ var SimpleSelect = function SimpleSelect(props) {
180
180
  clearSelected();
181
181
  }
182
182
  }
183
+ setDataCombo(dataSourceWithAllOptions);
183
184
  }
184
185
  if (!insideComponent) {
185
186
  setOpened(false);
@@ -80,7 +80,6 @@ var MenuTabs = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
80
80
  }, tabs.map(function (tab) {
81
81
  return /*#__PURE__*/_react["default"].createElement(MenuTab, _extends({
82
82
  key: tab.id,
83
- menuTabsLength: tabs.length,
84
83
  tabMenuSize: tabMenuSize,
85
84
  tabWidth: tabWidth
86
85
  }, tab));
@@ -7,6 +7,6 @@ import '../@types/Icon.js';
7
7
  import '../icons/helper.js';
8
8
 
9
9
  declare const TabsContext: React__default.Context<TabsContextType>;
10
- declare function TabsProvider({ children, tabs: tabsProp, container, selectedTab, onTabChange, onTabClose, tabsWidth: tabsWidthProp, }: TabsProviderProps): JSX.Element;
10
+ declare function TabsProvider({ children, tabs: tabsProp, container, selectedTab, onTabChange, onTabClose, tabsWidth: tabsWidthProp, firstTabIdent, }: TabsProviderProps): JSX.Element;
11
11
 
12
12
  export { TabsContext, TabsProvider };
@@ -24,6 +24,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
24
24
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
25
  var TabsContext = exports.TabsContext = /*#__PURE__*/(0, _react.createContext)({});
26
26
  function TabsProvider(_ref) {
27
+ var _menuRef$current$clie, _menuRef$current;
27
28
  var children = _ref.children,
28
29
  tabsProp = _ref.tabs,
29
30
  container = _ref.container,
@@ -31,7 +32,9 @@ function TabsProvider(_ref) {
31
32
  selectedTab = _ref$selectedTab === void 0 ? null : _ref$selectedTab,
32
33
  onTabChange = _ref.onTabChange,
33
34
  onTabClose = _ref.onTabClose,
34
- tabsWidthProp = _ref.tabsWidth;
35
+ tabsWidthProp = _ref.tabsWidth,
36
+ _ref$firstTabIdent = _ref.firstTabIdent,
37
+ firstTabIdent = _ref$firstTabIdent === void 0 ? false : _ref$firstTabIdent;
35
38
  var _React$useState = _react["default"].useState(selectedTab),
36
39
  _React$useState2 = _slicedToArray(_React$useState, 2),
37
40
  selectedTabId = _React$useState2[0],
@@ -48,10 +51,12 @@ function TabsProvider(_ref) {
48
51
  tabs = _useState4[0],
49
52
  setTabs = _useState4[1];
50
53
  var menuRef = (0, _react.useRef)(null);
54
+ var menuSize = ((_menuRef$current$clie = (_menuRef$current = menuRef.current) === null || _menuRef$current === void 0 ? void 0 : _menuRef$current.clientWidth) !== null && _menuRef$current$clie !== void 0 ? _menuRef$current$clie : 0) - 38 - (firstTabIdent ? 15 : 0);
51
55
  var tabsWidth = (0, _react.useMemo)(function () {
52
56
  if (typeof tabsWidthProp === 'string') return tabsWidthProp === 'auto' ? 100 : parseInt(tabsWidthProp) || 100;
53
57
  return tabsWidthProp;
54
58
  }, [tabsWidthProp]);
59
+ var maxTabs = Math.round(menuSize / tabsWidth);
55
60
  if (selectedTab && selectedTab !== selectedTabId) {
56
61
  setSelectedTabId(selectedTab);
57
62
  }
@@ -60,18 +65,12 @@ function TabsProvider(_ref) {
60
65
  setSelectedTabId((_tabs$ = tabs[0]) === null || _tabs$ === void 0 ? void 0 : _tabs$.id);
61
66
  }
62
67
  var dropdownTabs = (0, _react.useMemo)(function () {
63
- var _menuRef$current$clie, _menuRef$current;
64
- var menuSize = ((_menuRef$current$clie = (_menuRef$current = menuRef.current) === null || _menuRef$current === void 0 ? void 0 : _menuRef$current.clientWidth) !== null && _menuRef$current$clie !== void 0 ? _menuRef$current$clie : 0) - 38;
65
68
  if (menuSize === 0) return [];
66
- var maxTabs = Math.floor(menuSize / tabsWidth);
67
69
  return tabs.slice(maxTabs);
68
- }, [tabs, tabsWidth, containerWidth]);
70
+ }, [tabs, maxTabs, containerWidth]);
69
71
  var menuTabs = (0, _react.useMemo)(function () {
70
- var _menuRef$current$clie2, _menuRef$current2;
71
- var menuSize = ((_menuRef$current$clie2 = (_menuRef$current2 = menuRef.current) === null || _menuRef$current2 === void 0 ? void 0 : _menuRef$current2.clientWidth) !== null && _menuRef$current$clie2 !== void 0 ? _menuRef$current$clie2 : 0) - 38;
72
- var maxTabs = Math.floor(menuSize / tabsWidth);
73
72
  return tabs.slice(0, maxTabs);
74
- }, [tabs, tabsWidth, containerWidth]);
73
+ }, [tabs, maxTabs, containerWidth]);
75
74
  var tabsCount = tabs.length;
76
75
  var updateTabs = (0, _react.useCallback)(function (tabId) {
77
76
  var tabInDropdownIndex = dropdownTabs.findIndex(function (tab) {
package/lib/tabs/index.js CHANGED
@@ -64,7 +64,8 @@ var Tabs = function Tabs(_ref) {
64
64
  container: containerRef,
65
65
  onTabChange: handlerTabClick,
66
66
  onTabClose: handlerCloseTab,
67
- tabsWidth: tabsWidth
67
+ tabsWidth: tabsWidth,
68
+ firstTabIdent: firstTabIdent
68
69
  }, props), /*#__PURE__*/_react["default"].createElement("div", {
69
70
  ref: containerRef,
70
71
  className: (0, _tabHelpers.tabsClass)(tabMenuPosition),
@@ -25,6 +25,7 @@ interface TabsProviderProps {
25
25
  selectedTab?: string | number | null;
26
26
  onTabChange?: (tabId: string) => void;
27
27
  onTabClose?: (tabId: string) => void;
28
+ firstTabIdent?: boolean;
28
29
  }
29
30
  interface ITabsPros {
30
31
  style?: CSSProperties;
@@ -40,7 +41,6 @@ interface ITabsPros {
40
41
  handlerCloseTab?: (id?: string, idx?: string) => void;
41
42
  customClassForToolBar?: string;
42
43
  tabsWidth?: string | number;
43
- tabsWidthOnExceedCount?: number;
44
44
  }
45
45
  interface TabProps {
46
46
  id: string | number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "1.1.0-beta.4",
3
+ "version": "1.1.0-beta.6",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",