@uni-design-system/uni-react 0.0.12 → 0.0.13
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/dist/cjs/components/button/button.component.js +1 -2
- package/dist/cjs/core/flex/flex.component.d.ts +2 -0
- package/dist/cjs/core/flex/flex.component.js +2 -2
- package/dist/cjs/core/layout/layout.hook.d.ts +1 -1
- package/dist/cjs/core/layout/layout.hook.js +2 -1
- package/dist/esm/components/button/button.component.js +1 -2
- package/dist/esm/core/flex/flex.component.d.ts +2 -0
- package/dist/esm/core/flex/flex.component.js +2 -2
- package/dist/esm/core/layout/layout.hook.d.ts +1 -1
- package/dist/esm/core/layout/layout.hook.js +1 -1
- package/package.json +1 -1
|
@@ -41,11 +41,10 @@ exports.Button = void 0;
|
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
42
|
const core_1 = require("../../core");
|
|
43
43
|
const icon_text_row_1 = require("../icon-text-row");
|
|
44
|
-
const layout_hook_1 = __importDefault(require("../../core/layout/layout.hook"));
|
|
45
44
|
const use_ripple_hook_1 = __importDefault(require("use-ripple-hook"));
|
|
46
45
|
const Button = (_a) => {
|
|
47
46
|
var { text, children, buttonType = 'filled', disabled = false, iconName, onClick, disableRipple = false, style: userStyle } = _a, rest = __rest(_a, ["text", "children", "buttonType", "disabled", "iconName", "onClick", "disableRipple", "style"]);
|
|
48
|
-
const { deviceSize } = (0,
|
|
47
|
+
const { deviceSize } = (0, core_1.useLayout)();
|
|
49
48
|
const theme = (0, core_1.useTheme)();
|
|
50
49
|
const [ref, createRipple] = (0, use_ripple_hook_1.default)({ disabled: disableRipple || buttonType === 'elevated' });
|
|
51
50
|
const buttonProps = theme.buttons[buttonType];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { AlignContent, FlexDirection, FlexGrow, FlexShrink, FlexWrap, JustifyContent } from '@uni-design-system/uni-core';
|
|
3
|
+
import { Property } from 'csstype';
|
|
3
4
|
export interface FlexOptions extends HTMLAttributes<HTMLDivElement> {
|
|
4
5
|
/**
|
|
5
6
|
* Shorthand for `alignItems` style prop
|
|
@@ -37,6 +38,7 @@ export interface FlexOptions extends HTMLAttributes<HTMLDivElement> {
|
|
|
37
38
|
* @type FlexShrink
|
|
38
39
|
*/
|
|
39
40
|
shrink?: FlexShrink;
|
|
41
|
+
gap?: Property.Gap<number | string>;
|
|
40
42
|
}
|
|
41
43
|
export interface FlexProps extends FlexOptions {
|
|
42
44
|
children: ReactNode;
|
|
@@ -26,8 +26,8 @@ const react_2 = require("react");
|
|
|
26
26
|
* @see Docs
|
|
27
27
|
*/
|
|
28
28
|
exports.Flex = (0, react_2.forwardRef)((props, ref) => {
|
|
29
|
-
const { direction, align, justify, wrap, basis, grow, shrink, style } = props, rest = __rest(props, ["direction", "align", "justify", "wrap", "basis", "grow", "shrink", "style"]);
|
|
30
|
-
const styles = Object.assign({ display: 'flex', flexDirection: direction, alignItems: align, justifyContent: justify, flexWrap: wrap, flexBasis: basis, flexGrow: grow, flexShrink: shrink }, style);
|
|
29
|
+
const { direction, align, justify, wrap, basis, grow, shrink, gap, style } = props, rest = __rest(props, ["direction", "align", "justify", "wrap", "basis", "grow", "shrink", "gap", "style"]);
|
|
30
|
+
const styles = Object.assign({ display: 'flex', flexDirection: direction, alignItems: align, justifyContent: justify, flexWrap: wrap, flexBasis: basis, flexGrow: grow, flexShrink: shrink, gap }, style);
|
|
31
31
|
return react_1.default.createElement("div", Object.assign({ ref: ref, style: styles }, rest));
|
|
32
32
|
});
|
|
33
33
|
exports.Flex.displayName = 'Flex';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Layout } from '@uni-design-system/uni-core';
|
|
2
|
-
export
|
|
2
|
+
export declare function useLayout(): Layout;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useLayout = void 0;
|
|
6
7
|
const react_1 = __importDefault(require("react"));
|
|
7
8
|
const uni_core_1 = require("@uni-design-system/uni-core");
|
|
8
9
|
const layout_context_1 = __importDefault(require("./layout.context"));
|
|
@@ -12,4 +13,4 @@ function useLayout() {
|
|
|
12
13
|
const orientation = (0, uni_core_1.getDeviceOrientation)(height, width);
|
|
13
14
|
return { orientation, deviceSize };
|
|
14
15
|
}
|
|
15
|
-
exports.
|
|
16
|
+
exports.useLayout = useLayout;
|
|
@@ -10,9 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import React, { useEffect, useState } from 'react';
|
|
13
|
-
import { BoxShadow, Text, useTheme } from '../../core';
|
|
13
|
+
import { BoxShadow, Text, useLayout, useTheme } from '../../core';
|
|
14
14
|
import { IconTextRow } from '../icon-text-row';
|
|
15
|
-
import useLayout from '../../core/layout/layout.hook';
|
|
16
15
|
import useRipple from 'use-ripple-hook';
|
|
17
16
|
export const Button = (_a) => {
|
|
18
17
|
var { text, children, buttonType = 'filled', disabled = false, iconName, onClick, disableRipple = false, style: userStyle } = _a, rest = __rest(_a, ["text", "children", "buttonType", "disabled", "iconName", "onClick", "disableRipple", "style"]);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { AlignContent, FlexDirection, FlexGrow, FlexShrink, FlexWrap, JustifyContent } from '@uni-design-system/uni-core';
|
|
3
|
+
import { Property } from 'csstype';
|
|
3
4
|
export interface FlexOptions extends HTMLAttributes<HTMLDivElement> {
|
|
4
5
|
/**
|
|
5
6
|
* Shorthand for `alignItems` style prop
|
|
@@ -37,6 +38,7 @@ export interface FlexOptions extends HTMLAttributes<HTMLDivElement> {
|
|
|
37
38
|
* @type FlexShrink
|
|
38
39
|
*/
|
|
39
40
|
shrink?: FlexShrink;
|
|
41
|
+
gap?: Property.Gap<number | string>;
|
|
40
42
|
}
|
|
41
43
|
export interface FlexProps extends FlexOptions {
|
|
42
44
|
children: ReactNode;
|
|
@@ -20,8 +20,8 @@ import { forwardRef } from 'react';
|
|
|
20
20
|
* @see Docs
|
|
21
21
|
*/
|
|
22
22
|
export const Flex = forwardRef((props, ref) => {
|
|
23
|
-
const { direction, align, justify, wrap, basis, grow, shrink, style } = props, rest = __rest(props, ["direction", "align", "justify", "wrap", "basis", "grow", "shrink", "style"]);
|
|
24
|
-
const styles = Object.assign({ display: 'flex', flexDirection: direction, alignItems: align, justifyContent: justify, flexWrap: wrap, flexBasis: basis, flexGrow: grow, flexShrink: shrink }, style);
|
|
23
|
+
const { direction, align, justify, wrap, basis, grow, shrink, gap, style } = props, rest = __rest(props, ["direction", "align", "justify", "wrap", "basis", "grow", "shrink", "gap", "style"]);
|
|
24
|
+
const styles = Object.assign({ display: 'flex', flexDirection: direction, alignItems: align, justifyContent: justify, flexWrap: wrap, flexBasis: basis, flexGrow: grow, flexShrink: shrink, gap }, style);
|
|
25
25
|
return React.createElement("div", Object.assign({ ref: ref, style: styles }, rest));
|
|
26
26
|
});
|
|
27
27
|
Flex.displayName = 'Flex';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Layout } from '@uni-design-system/uni-core';
|
|
2
|
-
export
|
|
2
|
+
export declare function useLayout(): Layout;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { getDeviceOrientation, getDeviceSize } from '@uni-design-system/uni-core';
|
|
3
3
|
import LayoutContext from './layout.context';
|
|
4
|
-
export
|
|
4
|
+
export function useLayout() {
|
|
5
5
|
const { height, width } = React.useContext(LayoutContext);
|
|
6
6
|
const deviceSize = getDeviceSize(height, width);
|
|
7
7
|
const orientation = getDeviceOrientation(height, width);
|