@onesy/ui-react 1.0.87 → 1.0.89

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/Tab/Tab.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ISurface } from '../Surface/Surface';
3
+ import { ITooltip } from '../Tooltip/Tooltip';
3
4
  import { IElement, IPropsAny } from '../types';
4
5
  export declare type ITab = Omit<ISurface, 'version' | 'onChange'> & {
5
6
  version?: 'primary' | 'secondary';
@@ -12,10 +13,12 @@ export declare type ITab = Omit<ISurface, 'version' | 'onChange'> & {
12
13
  label?: IElement;
13
14
  icon?: IElement;
14
15
  iconPosition?: 'start' | 'top' | 'bottom' | 'end';
16
+ tooltip?: any;
15
17
  activateOnFocus?: boolean;
16
18
  onBlur?: (event: React.FocusEvent<any>) => any;
17
19
  onFocus?: (event: React.FocusEvent<any>) => any;
18
20
  LineProps?: IPropsAny;
21
+ TooltipProps?: ITooltip;
19
22
  };
20
23
  declare const Tab: React.FC<ITab>;
21
24
  export default Tab;
package/Tab/Tab.js CHANGED
@@ -18,6 +18,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
18
18
  const react_1 = __importDefault(require("react"));
19
19
  const utils_1 = require("@onesy/utils");
20
20
  const style_react_1 = require("@onesy/style-react");
21
+ const Tooltip_1 = __importDefault(require("../Tooltip"));
21
22
  const Type_1 = __importDefault(require("../Type"));
22
23
  const Surface_1 = __importDefault(require("../Surface"));
23
24
  const Line_1 = __importDefault(require("../Line"));
@@ -87,7 +88,8 @@ const Tab = react_1.default.forwardRef((props_, ref) => {
87
88
  const Type = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Type) || Type_1.default; }, [theme]);
88
89
  const Surface = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Surface) || Surface_1.default; }, [theme]);
89
90
  const Interaction = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Interaction) || Interaction_1.default; }, [theme]);
90
- const { tonal = true, color = 'primary', version = 'primary', size = 'regular', value, onChange, active, index, name, label: label_, icon, iconPosition = 'start', activateOnFocus, disabled, onBlur: onBlur_, onFocus: onFocus_, LineProps = {}, Component = 'button', className, children } = props, other = __rest(props, ["tonal", "color", "version", "size", "value", "onChange", "active", "index", "name", "label", "icon", "iconPosition", "activateOnFocus", "disabled", "onBlur", "onFocus", "LineProps", "Component", "className", "children"]);
91
+ const Tooltip = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Tooltip) || Tooltip_1.default; }, [theme]);
92
+ const { tonal = true, color = 'primary', version = 'primary', size = 'regular', value, onChange, active, index, name, label: label_, icon, iconPosition = 'start', activateOnFocus, tooltip, disabled, onBlur: onBlur_, onFocus: onFocus_, LineProps = {}, TooltipProps, Component = 'button', className, children } = props, other = __rest(props, ["tonal", "color", "version", "size", "value", "onChange", "active", "index", "name", "label", "icon", "iconPosition", "activateOnFocus", "tooltip", "disabled", "onBlur", "onFocus", "LineProps", "TooltipProps", "Component", "className", "children"]);
91
93
  const { classes } = useStyle();
92
94
  const [focus, setFocus] = react_1.default.useState(false);
93
95
  const label = name !== undefined ? name : label_;
@@ -114,36 +116,38 @@ const Tab = react_1.default.forwardRef((props_, ref) => {
114
116
  typeVersion = 'l1';
115
117
  else if (size === 'small')
116
118
  typeVersion = 'l3';
117
- return ((0, jsx_runtime_1.jsxs)(Surface, Object.assign({ ref: ref, tabIndex: !disabled ? 0 : -1, tonal: tonal, color: color, onBlur: onBlur, onFocus: onFocus, role: 'tab', "aria-selected": active, "data-onesy-tab-value": value, Component: Component, className: (0, style_react_1.classNames)([
118
- (0, utils_2.staticClassName)('Tab', theme) && [
119
- 'onesy-Tab-root',
120
- `onesy-Tab-version-${version}`,
121
- `onesy-Tab-size-${size}`,
122
- active && `onesy-Tab-active`,
123
- disabled && `onesy-Tab-disabled`
124
- ],
125
- className,
126
- classes.root,
127
- classes[`size_${size}`],
128
- active && classes.active,
129
- disabled && classes.disabled
130
- ]) }, other, { children: [(0, jsx_runtime_1.jsx)(Interaction, { pulse: focus }), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'row', align: 'center', justify: 'center' }, LineProps, { className: (0, style_react_1.classNames)([
131
- (0, utils_2.staticClassName)('Tab', theme) && [
132
- 'onesy-Tab-line'
133
- ],
134
- LineProps === null || LineProps === void 0 ? void 0 : LineProps.className,
135
- classes.line
136
- ]) }, { children: [icon, label !== undefined && ((0, utils_1.is)('simple', label) ? ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: typeVersion, className: (0, style_react_1.classNames)([
137
- (0, utils_2.staticClassName)('Tab', theme) && [
138
- 'onesy-Tab-type'
139
- ],
140
- classes[`type_${size}`]
141
- ]) }, { children: label }))) : label), children !== undefined && ((0, utils_1.is)('simple', children) ? ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: typeVersion, className: (0, style_react_1.classNames)([
142
- (0, utils_2.staticClassName)('Tab', theme) && [
143
- 'onesy-Tab-type'
144
- ],
145
- classes[`type_${size}`]
146
- ]) }, { children: children }))) : children)] }))] })));
119
+ const Wrapper = tooltip !== undefined ? react_1.default.Fragment : Tooltip;
120
+ const wrapperProps = tooltip !== undefined ? Object.assign({ name: tooltip }, TooltipProps) : undefined;
121
+ return ((0, jsx_runtime_1.jsx)(Wrapper, Object.assign({}, wrapperProps, { children: (0, jsx_runtime_1.jsxs)(Surface, Object.assign({ ref: ref, tabIndex: !disabled ? 0 : -1, tonal: tonal, color: color, onBlur: onBlur, onFocus: onFocus, role: 'tab', "aria-selected": active, "data-onesy-tab-value": value, Component: Component, className: (0, style_react_1.classNames)([
122
+ (0, utils_2.staticClassName)('Tab', theme) && [
123
+ 'onesy-Tab-root',
124
+ `onesy-Tab-version-${version}`,
125
+ `onesy-Tab-size-${size}`,
126
+ active && `onesy-Tab-active`,
127
+ disabled && `onesy-Tab-disabled`
128
+ ],
129
+ className,
130
+ classes.root,
131
+ classes[`size_${size}`],
132
+ active && classes.active,
133
+ disabled && classes.disabled
134
+ ]) }, other, { children: [(0, jsx_runtime_1.jsx)(Interaction, { pulse: focus }), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'row', align: 'center', justify: 'center' }, LineProps, { className: (0, style_react_1.classNames)([
135
+ (0, utils_2.staticClassName)('Tab', theme) && [
136
+ 'onesy-Tab-line'
137
+ ],
138
+ LineProps === null || LineProps === void 0 ? void 0 : LineProps.className,
139
+ classes.line
140
+ ]) }, { children: [icon, label !== undefined && ((0, utils_1.is)('simple', label) ? ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: typeVersion, className: (0, style_react_1.classNames)([
141
+ (0, utils_2.staticClassName)('Tab', theme) && [
142
+ 'onesy-Tab-type'
143
+ ],
144
+ classes[`type_${size}`]
145
+ ]) }, { children: label }))) : label), children !== undefined && ((0, utils_1.is)('simple', children) ? ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: typeVersion, className: (0, style_react_1.classNames)([
146
+ (0, utils_2.staticClassName)('Tab', theme) && [
147
+ 'onesy-Tab-type'
148
+ ],
149
+ classes[`type_${size}`]
150
+ ]) }, { children: children }))) : children)] }))] })) })));
147
151
  });
148
152
  Tab.displayName = 'onesy-Tab';
149
153
  exports.default = Tab;
@@ -23,6 +23,8 @@ export declare type IWindowSplit = Omit<ILine, 'onChange'> & {
23
23
  IconButtonProps?: IPropsAny;
24
24
  DividerProps?: IPropsAny;
25
25
  SeparatorProps?: IPropsAny;
26
+ StartProps?: IPropsAny;
27
+ EndProps?: IPropsAny;
26
28
  };
27
29
  declare const WindowSplit: React.FC<IWindowSplit>;
28
30
  export default WindowSplit;
@@ -100,7 +100,7 @@ const WindowSplit = react_1.default.forwardRef((props_, ref) => {
100
100
  const { tonal = false, color = 'inverted', valueDefault, value: value_ = 50, onChange: onChange_, padding, paddingStart, paddingEnd, iconButton, orientation = 'horizontal', noKeyboard, noDivider, focus: focus_ = false, onFocus: onFocus_, onBlur: onBlur_, onMouseEnter: onMouseEnter_, onMouseLeave: onMouseLeave_, iconButtonComponent, iconOrientationHorizontal = (0, jsx_runtime_1.jsx)(IconMaterialSwapHorizW100_1.default, {}), iconOrientationVertical = (0, jsx_runtime_1.jsx)(IconMaterialSwapVertW100_1.default, {}), IconButtonProps = {
101
101
  version: 'filled',
102
102
  elevation: false
103
- }, SeparatorProps: SeparatorProps_, DividerProps = {}, className, children: children_ } = props, other = __rest(props, ["tonal", "color", "valueDefault", "value", "onChange", "padding", "paddingStart", "paddingEnd", "iconButton", "orientation", "noKeyboard", "noDivider", "focus", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "iconButtonComponent", "iconOrientationHorizontal", "iconOrientationVertical", "IconButtonProps", "SeparatorProps", "DividerProps", "className", "children"]);
103
+ }, SeparatorProps: SeparatorProps_, DividerProps = {}, StartProps, EndProps, className, children: children_ } = props, other = __rest(props, ["tonal", "color", "valueDefault", "value", "onChange", "padding", "paddingStart", "paddingEnd", "iconButton", "orientation", "noKeyboard", "noDivider", "focus", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "iconButtonComponent", "iconOrientationHorizontal", "iconOrientationVertical", "IconButtonProps", "SeparatorProps", "DividerProps", "StartProps", "EndProps", "className", "children"]);
104
104
  const { classes } = useStyle();
105
105
  const [init, setInit] = react_1.default.useState(false);
106
106
  const [focus, setFocus] = react_1.default.useState();
@@ -299,19 +299,21 @@ const WindowSplit = react_1.default.forwardRef((props_, ref) => {
299
299
  'onesy-WindowSplit-wrapper'
300
300
  ],
301
301
  classes.wrapper
302
- ]) }, { children: [children[0] && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ direction: 'row', align: 'unset', justify: 'unset', className: (0, style_react_1.classNames)([
302
+ ]) }, { children: [children[0] && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ direction: 'row', align: 'unset', justify: 'unset' }, StartProps, { className: (0, style_react_1.classNames)([
303
303
  (0, utils_2.staticClassName)('WindowSplit', theme) && [
304
304
  'onesy-WindowSplit-start'
305
305
  ],
306
+ StartProps === null || StartProps === void 0 ? void 0 : StartProps.className,
306
307
  classes.item,
307
308
  classes.start
308
- ]), style: Object.assign({}, styles.start) }, { children: children[0] }))), children[1] && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ direction: 'row', align: 'unset', justify: 'unset', className: (0, style_react_1.classNames)([
309
+ ]), style: Object.assign(Object.assign({}, styles.start), StartProps === null || StartProps === void 0 ? void 0 : StartProps.style) }, { children: children[0] }))), children[1] && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ direction: 'row', align: 'unset', justify: 'unset' }, EndProps, { className: (0, style_react_1.classNames)([
309
310
  (0, utils_2.staticClassName)('WindowSplit', theme) && [
310
311
  'onesy-WindowSplit-end'
311
312
  ],
313
+ EndProps === null || EndProps === void 0 ? void 0 : EndProps.className,
312
314
  classes.item,
313
315
  classes.end
314
- ]), style: Object.assign({}, styles.end) }, { children: children[1] })))] })), !noDivider && ((0, jsx_runtime_1.jsx)(Divider, Object.assign({ onTouchStart: onTouchStart, onMouseDown: (event) => {
316
+ ]), style: Object.assign(Object.assign({}, styles.end), EndProps === null || EndProps === void 0 ? void 0 : EndProps.style) }, { children: children[1] })))] })), !noDivider && ((0, jsx_runtime_1.jsx)(Divider, Object.assign({ onTouchStart: onTouchStart, onMouseDown: (event) => {
315
317
  onMouseDown();
316
318
  if ((0, utils_1.is)('function', DividerProps === null || DividerProps === void 0 ? void 0 : DividerProps.onMouseDown))
317
319
  IconButtonProps.onMouseDown(event);
package/esm/Tab/Tab.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- const _excluded = ["tonal", "color", "version", "size", "value", "onChange", "active", "index", "name", "label", "icon", "iconPosition", "activateOnFocus", "disabled", "onBlur", "onFocus", "LineProps", "Component", "className", "children"];
4
+ const _excluded = ["tonal", "color", "version", "size", "value", "onChange", "active", "index", "name", "label", "icon", "iconPosition", "activateOnFocus", "tooltip", "disabled", "onBlur", "onFocus", "LineProps", "TooltipProps", "Component", "className", "children"];
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  import React from 'react';
8
8
  import { is } from '@onesy/utils';
9
9
  import { classNames, style as styleMethod, useOnesyTheme } from '@onesy/style-react';
10
+ import TooltipElement from '../Tooltip';
10
11
  import TypeElement from '../Type';
11
12
  import SurfaceElement from '../Surface';
12
13
  import LineElement from '../Line';
@@ -78,6 +79,7 @@ const Tab = /*#__PURE__*/React.forwardRef((props_, ref) => {
78
79
  const Type = React.useMemo(() => theme?.elements?.Type || TypeElement, [theme]);
79
80
  const Surface = React.useMemo(() => theme?.elements?.Surface || SurfaceElement, [theme]);
80
81
  const Interaction = React.useMemo(() => theme?.elements?.Interaction || InteractionElement, [theme]);
82
+ const Tooltip = React.useMemo(() => theme?.elements?.Tooltip || TooltipElement, [theme]);
81
83
  const {
82
84
  tonal = true,
83
85
  color = 'primary',
@@ -92,10 +94,12 @@ const Tab = /*#__PURE__*/React.forwardRef((props_, ref) => {
92
94
  icon,
93
95
  iconPosition = 'start',
94
96
  activateOnFocus,
97
+ tooltip,
95
98
  disabled,
96
99
  onBlur: onBlur_,
97
100
  onFocus: onFocus_,
98
101
  LineProps = {},
102
+ TooltipProps,
99
103
  Component = 'button',
100
104
  className,
101
105
  children
@@ -122,7 +126,11 @@ const Tab = /*#__PURE__*/React.forwardRef((props_, ref) => {
122
126
  }
123
127
  let typeVersion = 'l2';
124
128
  if (size === 'large') typeVersion = 'l1';else if (size === 'small') typeVersion = 'l3';
125
- return /*#__PURE__*/React.createElement(Surface, _extends({
129
+ const Wrapper = tooltip !== undefined ? React.Fragment : Tooltip;
130
+ const wrapperProps = tooltip !== undefined ? _objectSpread({
131
+ name: tooltip
132
+ }, TooltipProps) : undefined;
133
+ return /*#__PURE__*/React.createElement(Wrapper, wrapperProps, /*#__PURE__*/React.createElement(Surface, _extends({
126
134
  ref: ref,
127
135
  tabIndex: !disabled ? 0 : -1,
128
136
  tonal: tonal,
@@ -149,7 +157,7 @@ const Tab = /*#__PURE__*/React.forwardRef((props_, ref) => {
149
157
  }, label) : label), children !== undefined && (is('simple', children) ? /*#__PURE__*/React.createElement(Type, {
150
158
  version: typeVersion,
151
159
  className: classNames([staticClassName('Tab', theme) && ['onesy-Tab-type'], classes[`type_${size}`]])
152
- }, children) : children)));
160
+ }, children) : children))));
153
161
  });
154
162
  Tab.displayName = 'onesy-Tab';
155
163
  export default Tab;
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- const _excluded = ["tonal", "color", "valueDefault", "value", "onChange", "padding", "paddingStart", "paddingEnd", "iconButton", "orientation", "noKeyboard", "noDivider", "focus", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "iconButtonComponent", "iconOrientationHorizontal", "iconOrientationVertical", "IconButtonProps", "SeparatorProps", "DividerProps", "className", "children"];
4
+ const _excluded = ["tonal", "color", "valueDefault", "value", "onChange", "padding", "paddingStart", "paddingEnd", "iconButton", "orientation", "noKeyboard", "noDivider", "focus", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "iconButtonComponent", "iconOrientationHorizontal", "iconOrientationVertical", "IconButtonProps", "SeparatorProps", "DividerProps", "StartProps", "EndProps", "className", "children"];
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  import React from 'react';
@@ -115,6 +115,8 @@ const WindowSplit = /*#__PURE__*/React.forwardRef((props_, ref) => {
115
115
  },
116
116
  SeparatorProps: SeparatorProps_,
117
117
  DividerProps = {},
118
+ StartProps,
119
+ EndProps,
118
120
  className,
119
121
  children: children_
120
122
  } = props,
@@ -329,19 +331,21 @@ const WindowSplit = /*#__PURE__*/React.forwardRef((props_, ref) => {
329
331
  align: "unset",
330
332
  justify: "unset",
331
333
  className: classNames([staticClassName('WindowSplit', theme) && ['onesy-WindowSplit-wrapper'], classes.wrapper])
332
- }, children[0] && /*#__PURE__*/React.createElement(Line, {
334
+ }, children[0] && /*#__PURE__*/React.createElement(Line, _extends({
333
335
  direction: "row",
334
336
  align: "unset",
335
- justify: "unset",
336
- className: classNames([staticClassName('WindowSplit', theme) && ['onesy-WindowSplit-start'], classes.item, classes.start]),
337
- style: _objectSpread({}, styles.start)
338
- }, children[0]), children[1] && /*#__PURE__*/React.createElement(Line, {
337
+ justify: "unset"
338
+ }, StartProps, {
339
+ className: classNames([staticClassName('WindowSplit', theme) && ['onesy-WindowSplit-start'], StartProps?.className, classes.item, classes.start]),
340
+ style: _objectSpread(_objectSpread({}, styles.start), StartProps?.style)
341
+ }), children[0]), children[1] && /*#__PURE__*/React.createElement(Line, _extends({
339
342
  direction: "row",
340
343
  align: "unset",
341
- justify: "unset",
342
- className: classNames([staticClassName('WindowSplit', theme) && ['onesy-WindowSplit-end'], classes.item, classes.end]),
343
- style: _objectSpread({}, styles.end)
344
- }, children[1])), !noDivider && /*#__PURE__*/React.createElement(Divider, _extends({
344
+ justify: "unset"
345
+ }, EndProps, {
346
+ className: classNames([staticClassName('WindowSplit', theme) && ['onesy-WindowSplit-end'], EndProps?.className, classes.item, classes.end]),
347
+ style: _objectSpread(_objectSpread({}, styles.end), EndProps?.style)
348
+ }), children[1])), !noDivider && /*#__PURE__*/React.createElement(Divider, _extends({
345
349
  onTouchStart: onTouchStart,
346
350
  onMouseDown: event => {
347
351
  onMouseDown();
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license UiReact v1.0.87
1
+ /** @license UiReact v1.0.89
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onesy/ui-react",
3
- "version": "1.0.87",
3
+ "version": "1.0.89",
4
4
  "description": "UI for React",
5
5
  "repository": "https://github.com/onesy-me/onesy.git",
6
6
  "author": "Lazar <lazareric2@gmail.com>",