@neko-os/ui 0.6.2 → 0.6.3
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,4 +1,4 @@
|
|
|
1
|
-
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/actions/menu/HorizontalMenu.js";var _excluded = ["item", "linkPaddingH", "handlePress", "linkProps", "activeIndex", "activeKey", "activeColor", "color", "sizeCode", "index"],_excluded2 = ["active", "key", "disabled"],_excluded3 = ["gap", "height", "items", "onChange", "onChangeIndex", "activeIndex"];function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}
|
|
1
|
+
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/actions/menu/HorizontalMenu.js";var _excluded = ["item", "linkPaddingH", "handlePress", "linkProps", "activeIndex", "activeKey", "activeColor", "color", "height", "sizeCode", "index"],_excluded2 = ["active", "key", "disabled"],_excluded3 = ["gap", "height", "items", "onChange", "onChangeIndex", "activeIndex"];function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}import { omit, pipe } from 'ramda';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import { IconText } from "../../presentation/IconLabel";
|
|
@@ -6,11 +6,19 @@ import { Link } from "../Link";
|
|
|
6
6
|
import { SubmenuWrapper } from "./SubmenuWrapper";
|
|
7
7
|
import { View } from "../../structure/View";
|
|
8
8
|
import { useColorConverter } from "../../../modifiers/colorConverter";
|
|
9
|
+
import { useDefaultModifier } from "../../../modifiers/default";
|
|
9
10
|
import { useSizeConverter } from "../../../modifiers/sizeConverter";
|
|
10
11
|
import { useThemeComponentModifier } from "../../../modifiers/themeComponent";import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
|
|
12
|
-
function
|
|
13
|
+
var DEFAULT_PROPS = function DEFAULT_PROPS(_ref) {var _ref2 = _slicedToArray(_ref, 1),sizeCode = _ref2[0].sizeCode;return {
|
|
14
|
+
gap: 'sm',
|
|
15
|
+
height: sizeCode,
|
|
16
|
+
size: sizeCode,
|
|
17
|
+
linkPaddingH: 'md',
|
|
18
|
+
activeColor: 'primary'
|
|
19
|
+
};};
|
|
13
20
|
|
|
21
|
+
function Item(_ref3)
|
|
14
22
|
|
|
15
23
|
|
|
16
24
|
|
|
@@ -21,7 +29,9 @@ function Item(_ref)
|
|
|
21
29
|
|
|
22
30
|
|
|
23
31
|
|
|
24
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
{var item = _ref3.item,_ref3$linkPaddingH = _ref3.linkPaddingH,linkPaddingH = _ref3$linkPaddingH === void 0 ? 'md' : _ref3$linkPaddingH,handlePress = _ref3.handlePress,linkProps = _ref3.linkProps,activeIndex = _ref3.activeIndex,activeKey = _ref3.activeKey,_ref3$activeColor = _ref3.activeColor,activeColor = _ref3$activeColor === void 0 ? 'primary' : _ref3$activeColor,color = _ref3.color,height = _ref3.height,sizeCode = _ref3.sizeCode,index = _ref3.index,props = _objectWithoutProperties(_ref3, _excluded);
|
|
25
35
|
activeColor = activeColor || 'primary';
|
|
26
36
|
var _omit = omit(['onClick', 'onPress'], item),active = _omit.active,key = _omit.key,disabled = _omit.disabled,childProps = _objectWithoutProperties(_omit, _excluded2);
|
|
27
37
|
if (!active && activeIndex >= 0) active = activeIndex === index;
|
|
@@ -34,25 +44,26 @@ function Item(_ref)
|
|
|
34
44
|
activeKey: activeKey,
|
|
35
45
|
color: color,
|
|
36
46
|
placement: "bottomRight",
|
|
37
|
-
hideIcon: true,
|
|
47
|
+
hideIcon: true,
|
|
48
|
+
height: height, children:
|
|
38
49
|
|
|
39
50
|
_jsx(Link, Object.assign({
|
|
40
51
|
|
|
41
|
-
fullH: true,
|
|
42
52
|
center: true,
|
|
43
53
|
paddingH: linkPaddingH,
|
|
44
|
-
disabled: disabled
|
|
54
|
+
disabled: disabled,
|
|
55
|
+
height: height },
|
|
45
56
|
linkProps, {
|
|
46
57
|
onPress: function onPress() {return handlePress(item, index);}, children:
|
|
47
58
|
|
|
48
59
|
_jsx(IconText, Object.assign({
|
|
49
60
|
color: active ? activeColor : color,
|
|
50
|
-
fullH: true,
|
|
51
61
|
marginT: 3,
|
|
52
62
|
borderB: 3,
|
|
53
63
|
borderColor: active ? activeColor : 'transparent',
|
|
54
64
|
transition: "border-color 0.6s ease",
|
|
55
|
-
size: sizeCode
|
|
65
|
+
size: sizeCode,
|
|
66
|
+
height: height },
|
|
56
67
|
childProps)
|
|
57
68
|
) }), key || index
|
|
58
69
|
) }
|
|
@@ -63,11 +74,12 @@ function Item(_ref)
|
|
|
63
74
|
export function HorizontalMenu(rootProps) {var _this = this;
|
|
64
75
|
var _pipe = pipe(
|
|
65
76
|
useColorConverter(),
|
|
66
|
-
useSizeConverter('
|
|
67
|
-
useThemeComponentModifier('HorizontalMenu')
|
|
77
|
+
useSizeConverter('elementHeights', 'md'),
|
|
78
|
+
useThemeComponentModifier('HorizontalMenu'),
|
|
79
|
+
useDefaultModifier(DEFAULT_PROPS)
|
|
68
80
|
)([{}, rootProps]),_pipe2 = _slicedToArray(_pipe, 2),_pipe2$ = _pipe2[0],sizeCode = _pipe2$.sizeCode,color = _pipe2$.color,formattedProps = _pipe2[1];
|
|
69
81
|
|
|
70
|
-
var
|
|
82
|
+
var gap = formattedProps.gap,height = formattedProps.height,items = formattedProps.items,onChange = formattedProps.onChange,onChangeIndex = formattedProps.onChangeIndex,activeIndex = formattedProps.activeIndex,props = _objectWithoutProperties(formattedProps, _excluded3);
|
|
71
83
|
|
|
72
84
|
var handlePress = React.useCallback(
|
|
73
85
|
function (item, index) {
|
|
@@ -88,6 +100,7 @@ export function HorizontalMenu(rootProps) {var _this = this;
|
|
|
88
100
|
handlePress: handlePress,
|
|
89
101
|
color: color,
|
|
90
102
|
sizeCode: sizeCode,
|
|
103
|
+
height: height,
|
|
91
104
|
index: index,
|
|
92
105
|
activeIndex: activeIndex },
|
|
93
106
|
props), item.key || index
|
package/dist/i18n/I18n.js
CHANGED
|
@@ -35,7 +35,6 @@ var _excluded = ["ns", "context", "default"];function _objectWithoutProperties(e
|
|
|
35
35
|
}
|
|
36
36
|
var langData = (_this$resources$this$2 = this.resources[this.language]) == null ? void 0 : _this$resources$this$2[ns];
|
|
37
37
|
var value = this._resolveKey(langData, key, count, context);
|
|
38
|
-
if (context) console.log(context, value);
|
|
39
38
|
|
|
40
39
|
if (!value) {var _this$resources$this$3, _ref, _this$_resolveKey;
|
|
41
40
|
var fallbackData = (_this$resources$this$3 = this.resources[this.fallback]) == null ? void 0 : _this$resources$this$3[ns];
|
package/package.json
CHANGED
|
@@ -6,9 +6,18 @@ import { Link } from '../Link'
|
|
|
6
6
|
import { SubmenuWrapper } from './SubmenuWrapper'
|
|
7
7
|
import { View } from '../../structure/View'
|
|
8
8
|
import { useColorConverter } from '../../../modifiers/colorConverter'
|
|
9
|
+
import { useDefaultModifier } from '../../../modifiers/default'
|
|
9
10
|
import { useSizeConverter } from '../../../modifiers/sizeConverter'
|
|
10
11
|
import { useThemeComponentModifier } from '../../../modifiers/themeComponent'
|
|
11
12
|
|
|
13
|
+
const DEFAULT_PROPS = ([{ sizeCode }]) => ({
|
|
14
|
+
gap: 'sm',
|
|
15
|
+
height: sizeCode,
|
|
16
|
+
size: sizeCode,
|
|
17
|
+
linkPaddingH: 'md',
|
|
18
|
+
activeColor: 'primary',
|
|
19
|
+
})
|
|
20
|
+
|
|
12
21
|
function Item({
|
|
13
22
|
item,
|
|
14
23
|
linkPaddingH = 'md',
|
|
@@ -18,6 +27,7 @@ function Item({
|
|
|
18
27
|
activeKey,
|
|
19
28
|
activeColor = 'primary',
|
|
20
29
|
color,
|
|
30
|
+
height,
|
|
21
31
|
sizeCode,
|
|
22
32
|
index,
|
|
23
33
|
...props
|
|
@@ -35,24 +45,25 @@ function Item({
|
|
|
35
45
|
color={color}
|
|
36
46
|
placement="bottomRight"
|
|
37
47
|
hideIcon
|
|
48
|
+
height={height}
|
|
38
49
|
>
|
|
39
50
|
<Link
|
|
40
51
|
key={key || index}
|
|
41
|
-
fullH
|
|
42
52
|
center
|
|
43
53
|
paddingH={linkPaddingH}
|
|
44
54
|
disabled={disabled}
|
|
55
|
+
height={height}
|
|
45
56
|
{...linkProps}
|
|
46
57
|
onPress={() => handlePress(item, index)}
|
|
47
58
|
>
|
|
48
59
|
<IconText
|
|
49
60
|
color={active ? activeColor : color}
|
|
50
|
-
fullH
|
|
51
61
|
marginT={3}
|
|
52
62
|
borderB={3}
|
|
53
63
|
borderColor={active ? activeColor : 'transparent'}
|
|
54
64
|
transition="border-color 0.6s ease"
|
|
55
65
|
size={sizeCode}
|
|
66
|
+
height={height}
|
|
56
67
|
{...childProps}
|
|
57
68
|
/>
|
|
58
69
|
</Link>
|
|
@@ -63,11 +74,12 @@ function Item({
|
|
|
63
74
|
export function HorizontalMenu(rootProps) {
|
|
64
75
|
const [{ sizeCode, color }, formattedProps] = pipe(
|
|
65
76
|
useColorConverter(),
|
|
66
|
-
useSizeConverter('
|
|
67
|
-
useThemeComponentModifier('HorizontalMenu')
|
|
77
|
+
useSizeConverter('elementHeights', 'md'),
|
|
78
|
+
useThemeComponentModifier('HorizontalMenu'),
|
|
79
|
+
useDefaultModifier(DEFAULT_PROPS)
|
|
68
80
|
)([{}, rootProps])
|
|
69
81
|
|
|
70
|
-
let { gap
|
|
82
|
+
let { gap, height, items, onChange, onChangeIndex, activeIndex, ...props } = formattedProps
|
|
71
83
|
|
|
72
84
|
const handlePress = React.useCallback(
|
|
73
85
|
(item, index) => {
|
|
@@ -88,6 +100,7 @@ export function HorizontalMenu(rootProps) {
|
|
|
88
100
|
handlePress={handlePress}
|
|
89
101
|
color={color}
|
|
90
102
|
sizeCode={sizeCode}
|
|
103
|
+
height={height}
|
|
91
104
|
index={index}
|
|
92
105
|
activeIndex={activeIndex}
|
|
93
106
|
{...props}
|
package/src/i18n/I18n.js
CHANGED
|
@@ -35,7 +35,6 @@ export class I18n {
|
|
|
35
35
|
}
|
|
36
36
|
const langData = this.resources[this.language]?.[ns]
|
|
37
37
|
let value = this._resolveKey(langData, key, count, context)
|
|
38
|
-
if (context) console.log(context, value)
|
|
39
38
|
|
|
40
39
|
if (!value) {
|
|
41
40
|
const fallbackData = this.resources[this.fallback]?.[ns]
|