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.
- package/lib/assets/styles/checkbox.scss +8 -0
- package/lib/assets/styles/tabs.scss +4 -0
- package/lib/checkbox/index.d.ts +1 -1
- package/lib/checkbox/index.js +27 -25
- package/lib/checkbox/types.d.ts +1 -0
- package/lib/inputs/select/simple/index.js +1 -0
- package/lib/tabs/MenuTabs.js +0 -1
- package/lib/tabs/context.d.ts +1 -1
- package/lib/tabs/context.js +8 -9
- package/lib/tabs/index.js +2 -1
- package/lib/tabs/types.d.ts +1 -1
- package/package.json +1 -1
package/lib/checkbox/index.d.ts
CHANGED
|
@@ -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: (
|
|
11
|
+
declare const CheckBox: (props: ICheckBoxProps) => JSX.Element | null;
|
|
12
12
|
|
|
13
13
|
export { CheckBox as default };
|
package/lib/checkbox/index.js
CHANGED
|
@@ -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(
|
|
31
|
-
var name =
|
|
32
|
-
required =
|
|
33
|
-
value =
|
|
34
|
-
label =
|
|
35
|
-
onChange =
|
|
36
|
-
autofocus =
|
|
37
|
-
hint =
|
|
38
|
-
|
|
39
|
-
id =
|
|
40
|
-
gridLayout =
|
|
41
|
-
|
|
42
|
-
checked =
|
|
43
|
-
disabled =
|
|
44
|
-
permissionAttr =
|
|
45
|
-
tooltip =
|
|
46
|
-
|
|
47
|
-
tooltipPosition =
|
|
48
|
-
|
|
49
|
-
tooltipWidth =
|
|
50
|
-
skeletonize =
|
|
51
|
-
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"], {
|
package/lib/checkbox/types.d.ts
CHANGED
|
@@ -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 };
|
package/lib/tabs/MenuTabs.js
CHANGED
|
@@ -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));
|
package/lib/tabs/context.d.ts
CHANGED
|
@@ -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 };
|
package/lib/tabs/context.js
CHANGED
|
@@ -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,
|
|
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,
|
|
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),
|
package/lib/tabs/types.d.ts
CHANGED
|
@@ -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;
|