@infomaximum/ui-kit 0.13.5 → 0.14.1
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/components/Button/Button.styles.d.ts +8 -0
- package/dist/components/Checkbox/Checkbox.js +10 -8
- package/dist/components/Checkbox/Checkbox.types.d.ts +26 -11
- package/dist/components/Empty/Empty.d.ts +3 -0
- package/dist/components/Empty/Empty.js +47 -0
- package/dist/components/Empty/Empty.styles.d.ts +34 -0
- package/dist/components/Empty/Empty.styles.js +34 -0
- package/dist/components/Empty/Empty.tokens.d.ts +9 -0
- package/dist/components/Empty/Empty.tokens.js +10 -0
- package/dist/components/Empty/Empty.types.d.ts +15 -0
- package/dist/components/Empty/components/images/BookmarkImg.d.ts +2 -0
- package/dist/components/Empty/components/images/BookmarkImg.js +9 -0
- package/dist/components/Empty/components/images/DefaultImg.d.ts +2 -0
- package/dist/components/Empty/components/images/DefaultImg.js +9 -0
- package/dist/components/Empty/components/images/FilterImg.d.ts +2 -0
- package/dist/components/Empty/components/images/FilterImg.js +9 -0
- package/dist/components/Empty/components/images/LockedImg.d.ts +2 -0
- package/dist/components/Empty/components/images/LockedImg.js +9 -0
- package/dist/components/Empty/components/images/SearchImg.d.ts +2 -0
- package/dist/components/Empty/components/images/SearchImg.js +9 -0
- package/dist/components/Empty/components/images/TestingImg.d.ts +2 -0
- package/dist/components/Empty/components/images/TestingImg.js +9 -0
- package/dist/components/Empty/components/images/_404Img.d.ts +2 -0
- package/dist/components/Empty/components/images/_404Img.js +9 -0
- package/dist/components/Empty/components/images/index.d.ts +7 -0
- package/dist/components/Empty/index.d.ts +2 -0
- package/dist/components/InternalPicker/styles/DatePanel.styles.js +0 -1
- package/dist/components/Popconfirm/components/PopconfirmFloatingElement/PopconfirmFloatingElement.styles.d.ts +1 -1
- package/dist/components/Popconfirm/components/PopconfirmFloatingElement/PopconfirmFloatingElement.styles.js +1 -2
- package/dist/components/Popover/component/PopoverFloatingElement/PopoverFloatingElement.styles.d.ts +1 -1
- package/dist/components/Popover/component/PopoverFloatingElement/PopoverFloatingElement.styles.js +1 -2
- package/dist/components/Segmented/Segmented.d.ts +5 -0
- package/dist/components/Segmented/Segmented.js +41 -0
- package/dist/components/Segmented/Segmented.styles.d.ts +15 -0
- package/dist/components/Segmented/Segmented.styles.js +15 -0
- package/dist/components/Segmented/Segmented.tokens.d.ts +17 -0
- package/dist/components/Segmented/Segmented.tokens.js +19 -0
- package/dist/components/Segmented/Segmented.types.d.ts +20 -0
- package/dist/components/Segmented/Segmented.utils.d.ts +2 -0
- package/dist/components/Segmented/Segmented.utils.js +13 -0
- package/dist/components/Segmented/components/SegmentedItem/SegmentedItem.d.ts +2 -0
- package/dist/components/Segmented/components/SegmentedItem/SegmentedItem.js +36 -0
- package/dist/components/Segmented/components/SegmentedItem/SegmentedItem.styles.d.ts +47 -0
- package/dist/components/Segmented/components/SegmentedItem/SegmentedItem.styles.js +51 -0
- package/dist/components/Segmented/components/SegmentedItem/SegmentedItem.types.d.ts +6 -0
- package/dist/components/Segmented/index.d.ts +2 -0
- package/dist/contexts/themeContext.d.ts +4 -0
- package/dist/hooks/useControlledState/index.d.ts +1 -0
- package/dist/hooks/useControlledState/useControlledState.d.ts +1 -0
- package/dist/hooks/useControlledState/useControlledState.js +16 -0
- package/dist/hooks/useFirstMountLayoutEffect/index.d.ts +1 -0
- package/dist/hooks/useFirstMountLayoutEffect/useFirstMountLayoutEffect.d.ts +2 -0
- package/dist/hooks/useFirstMountLayoutEffect/useFirstMountLayoutEffect.js +15 -0
- package/dist/hooks/useIsomorphicLayoutEffect/index.d.ts +1 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +2 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +5 -0
- package/dist/hooks/useTheme/useTheme.d.ts +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/themes/baseTokens/baseTypographyTokens/baseTypographyTokens.d.ts +4 -0
- package/dist/themes/baseTokens/baseTypographyTokens/baseTypographyTokens.js +4 -0
- package/dist/themes/themes.d.ts +4 -0
- package/dist/themes/themes.utils.d.ts +8 -0
- package/package.json +1 -1
|
@@ -34,8 +34,8 @@ export declare const popconfirmFloatingElementStyle: {
|
|
|
34
34
|
readonly flexDirection: "column";
|
|
35
35
|
};
|
|
36
36
|
titleWrapper: (theme: Theme) => {
|
|
37
|
-
fontWeight: number;
|
|
38
37
|
fontFamily: "Roboto";
|
|
38
|
+
fontWeight: 500;
|
|
39
39
|
fontSize: 14;
|
|
40
40
|
lineHeight: "20px";
|
|
41
41
|
color: "#262626";
|
|
@@ -41,8 +41,7 @@ const popconfirmFloatingElementStyle = {
|
|
|
41
41
|
const tokens = getPopconfirmTokens(theme);
|
|
42
42
|
return {
|
|
43
43
|
color: tokens.popconfirmText,
|
|
44
|
-
...theme.typography.subheader1
|
|
45
|
-
fontWeight: 500
|
|
44
|
+
...theme.typography.subheader1
|
|
46
45
|
};
|
|
47
46
|
},
|
|
48
47
|
descriptionWrapper: (theme) => {
|
package/dist/components/Popover/component/PopoverFloatingElement/PopoverFloatingElement.styles.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ export declare const popoverFloatingElementDefaultStyle: {
|
|
|
17
17
|
readonly color: "#262626";
|
|
18
18
|
};
|
|
19
19
|
titleWrapper: (theme: Theme) => {
|
|
20
|
-
fontWeight: number;
|
|
21
20
|
fontFamily: "Roboto";
|
|
21
|
+
fontWeight: 500;
|
|
22
22
|
fontSize: 14;
|
|
23
23
|
lineHeight: "20px";
|
|
24
24
|
color: "#262626";
|
package/dist/components/Popover/component/PopoverFloatingElement/PopoverFloatingElement.styles.js
CHANGED
|
@@ -21,8 +21,7 @@ const popoverFloatingElementDefaultStyle = {
|
|
|
21
21
|
const popoverTokens = getPopoverTokens(theme);
|
|
22
22
|
return {
|
|
23
23
|
color: popoverTokens.popoverText,
|
|
24
|
-
...theme.typography.subheader1
|
|
25
|
-
fontWeight: 500
|
|
24
|
+
...theme.typography.subheader1
|
|
26
25
|
};
|
|
27
26
|
},
|
|
28
27
|
contentWrapper: (theme) => {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { SegmentedProps } from './Segmented.types';
|
|
3
|
+
declare const SegmentedComponent: FC<SegmentedProps>;
|
|
4
|
+
export declare const Segmented: <ValueType>(props: SegmentedProps<ValueType>) => ReturnType<typeof SegmentedComponent>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { memo, useId, useMemo, useCallback } from "react";
|
|
3
|
+
import { SegmentedItem } from "./components/SegmentedItem/SegmentedItem.js";
|
|
4
|
+
import { getSegmentedTokens } from "./Segmented.tokens.js";
|
|
5
|
+
import { normalizeOption } from "./Segmented.utils.js";
|
|
6
|
+
import { getSegmentedStyle, segmentedGroupStyle } from "./Segmented.styles.js";
|
|
7
|
+
import { useTheme } from "../../hooks/useTheme/useTheme.js";
|
|
8
|
+
import { useControlledState } from "../../hooks/useControlledState/useControlledState.js";
|
|
9
|
+
const SegmentedComponent = (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const defaultName = useId();
|
|
12
|
+
const {
|
|
13
|
+
defaultValue,
|
|
14
|
+
value: valueProp,
|
|
15
|
+
options: optionsProp,
|
|
16
|
+
name = defaultName,
|
|
17
|
+
disabled = false,
|
|
18
|
+
block = false,
|
|
19
|
+
onChange
|
|
20
|
+
} = props;
|
|
21
|
+
const theme = useTheme();
|
|
22
|
+
const segmentedTokens = getSegmentedTokens(theme);
|
|
23
|
+
const options = useMemo(() => optionsProp.map(normalizeOption), [optionsProp]);
|
|
24
|
+
const [value, setValue] = useControlledState(defaultValue ?? ((_a = options[0]) == null ? void 0 : _a.value), valueProp);
|
|
25
|
+
const handleChange = useCallback((value2) => {
|
|
26
|
+
setValue(value2);
|
|
27
|
+
onChange == null ? void 0 : onChange(value2);
|
|
28
|
+
}, [onChange, setValue]);
|
|
29
|
+
return /* @__PURE__ */ jsx("div", { role: "radiogroup", "aria-label": "segmented control", tabIndex: disabled ? void 0 : 0, css: getSegmentedStyle(segmentedTokens, block)(theme), children: /* @__PURE__ */ jsx("div", { css: segmentedGroupStyle, children: options.map((option) => {
|
|
30
|
+
const {
|
|
31
|
+
value: optionValue,
|
|
32
|
+
disabled: optionDisabled,
|
|
33
|
+
...restOption
|
|
34
|
+
} = option;
|
|
35
|
+
return /* @__PURE__ */ jsx(SegmentedItem, { name, block, value: optionValue, ...restOption, isSelected: optionValue === value, disabled: disabled || optionDisabled, onChange: handleChange }, optionValue);
|
|
36
|
+
}) }) });
|
|
37
|
+
};
|
|
38
|
+
const Segmented = memo(SegmentedComponent);
|
|
39
|
+
export {
|
|
40
|
+
Segmented
|
|
41
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Theme } from '../../themes';
|
|
2
|
+
import { SegmentedTokens } from './Segmented.tokens';
|
|
3
|
+
export declare const getSegmentedStyle: (segmentedTokens: SegmentedTokens, block: boolean) => (theme: Theme) => {
|
|
4
|
+
fontFamily: "Roboto";
|
|
5
|
+
fontSize: 14;
|
|
6
|
+
lineHeight: "20px";
|
|
7
|
+
display: string;
|
|
8
|
+
backgroundColor: "#F0F0F0";
|
|
9
|
+
borderRadius: 4;
|
|
10
|
+
padding: 2;
|
|
11
|
+
};
|
|
12
|
+
export declare const segmentedGroupStyle: {
|
|
13
|
+
display: string;
|
|
14
|
+
width: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const getSegmentedStyle = (segmentedTokens, block) => (theme) => ({
|
|
2
|
+
display: block ? "flex" : "inline-block",
|
|
3
|
+
backgroundColor: segmentedTokens.segmentedTrackBg,
|
|
4
|
+
borderRadius: theme.borderRadiusM,
|
|
5
|
+
padding: segmentedTokens.segmentedTrackPadding,
|
|
6
|
+
...theme.typography.body2
|
|
7
|
+
});
|
|
8
|
+
const segmentedGroupStyle = {
|
|
9
|
+
display: "flex",
|
|
10
|
+
width: "100%"
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
getSegmentedStyle,
|
|
14
|
+
segmentedGroupStyle
|
|
15
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Theme } from '../../themes';
|
|
2
|
+
export declare const getSegmentedTokens: (theme: Theme) => {
|
|
3
|
+
readonly segmentedItemText: "#8C8C8C";
|
|
4
|
+
readonly segmentedItemTextHover: "#595959";
|
|
5
|
+
readonly segmentedItemTextSelected: "#262626";
|
|
6
|
+
readonly segmentedItemTextDisabled: "#BFBFBF";
|
|
7
|
+
readonly segmentedItemBgHover: `rgba(${number}, ${number}, ${number}, 0.08)`;
|
|
8
|
+
readonly segmentedItemBgSelected: "#FFFFFF";
|
|
9
|
+
readonly segmentedTrackBg: "#F0F0F0";
|
|
10
|
+
readonly segmentedTrackPadding: 2;
|
|
11
|
+
readonly segmentedItemPaddingHorizontal: 8;
|
|
12
|
+
readonly segmentedItemHeight: 24;
|
|
13
|
+
readonly segmentedItemShadow: `0 1px 2px 0 rgba(${number}, ${number}, ${number}, 0.03),
|
|
14
|
+
0 1px 6px -1px rgba(${number}, ${number}, ${number}, 0.02),
|
|
15
|
+
0 2px 4px 0 rgba(${number}, ${number}, ${number}, 0.02)`;
|
|
16
|
+
};
|
|
17
|
+
export type SegmentedTokens = ReturnType<typeof getSegmentedTokens>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { black2Rgba } from "../../themes/baseTokens/const.js";
|
|
2
|
+
const getSegmentedTokens = (theme) => ({
|
|
3
|
+
segmentedItemText: theme.textSecondary,
|
|
4
|
+
segmentedItemTextHover: theme.textComplimentary,
|
|
5
|
+
segmentedItemTextSelected: theme.textPrimary,
|
|
6
|
+
segmentedItemTextDisabled: theme.textHint,
|
|
7
|
+
segmentedItemBgHover: theme.bgIconHover,
|
|
8
|
+
segmentedItemBgSelected: theme.bgContainer,
|
|
9
|
+
segmentedTrackBg: theme.bgSecondary,
|
|
10
|
+
segmentedTrackPadding: theme.x05,
|
|
11
|
+
segmentedItemPaddingHorizontal: theme.x2,
|
|
12
|
+
segmentedItemHeight: 24,
|
|
13
|
+
segmentedItemShadow: `0 1px 2px 0 ${black2Rgba(0.03)},
|
|
14
|
+
0 1px 6px -1px ${black2Rgba(0.02)},
|
|
15
|
+
0 2px 4px 0 ${black2Rgba(0.02)}`
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
getSegmentedTokens
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type SegmentedValue = string | number;
|
|
3
|
+
export type SegmentedOption<T = SegmentedValue> = T | SegmentedLabeledOption<T>;
|
|
4
|
+
type SegmentedOptions<T> = SegmentedOption<T>[];
|
|
5
|
+
export type SegmentedLabeledOption<T = SegmentedValue> = {
|
|
6
|
+
label?: ReactNode;
|
|
7
|
+
value: T;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export interface SegmentedProps<ValueType = SegmentedValue> {
|
|
12
|
+
block?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
options: SegmentedOptions<ValueType>;
|
|
15
|
+
defaultValue?: ValueType;
|
|
16
|
+
value?: ValueType;
|
|
17
|
+
name?: string;
|
|
18
|
+
onChange?: (value: ValueType) => void;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsxs, jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { getSegmentedTokens } from "../../Segmented.tokens.js";
|
|
4
|
+
import { getSegmentedItemStyle, segmentedItemInputStyle, segmentedItemLabelWrapperStyle, segmentedItemIconStyle, segmentedItemLabelStyle } from "./SegmentedItem.styles.js";
|
|
5
|
+
import { useTheme } from "../../../../hooks/useTheme/useTheme.js";
|
|
6
|
+
const SegmentedItemComponent = (props) => {
|
|
7
|
+
const {
|
|
8
|
+
block,
|
|
9
|
+
name,
|
|
10
|
+
value,
|
|
11
|
+
label,
|
|
12
|
+
icon,
|
|
13
|
+
isSelected,
|
|
14
|
+
disabled,
|
|
15
|
+
onChange
|
|
16
|
+
} = props;
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const segmentedTokens = getSegmentedTokens(theme);
|
|
19
|
+
const handleChange = (event) => {
|
|
20
|
+
if (disabled) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
onChange(value, event);
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ jsxs("label", { css: getSegmentedItemStyle(segmentedTokens, block, isSelected, disabled)(theme), children: [
|
|
26
|
+
/* @__PURE__ */ jsx("input", { type: "radio", name, checked: isSelected, disabled, onChange: handleChange, css: segmentedItemInputStyle }),
|
|
27
|
+
/* @__PURE__ */ jsxs("div", { "aria-selected": isSelected, css: segmentedItemLabelWrapperStyle(segmentedTokens)(theme), children: [
|
|
28
|
+
icon && /* @__PURE__ */ jsx("span", { css: segmentedItemIconStyle(theme), children: icon }),
|
|
29
|
+
label && /* @__PURE__ */ jsx("span", { css: segmentedItemLabelStyle, children: label })
|
|
30
|
+
] })
|
|
31
|
+
] });
|
|
32
|
+
};
|
|
33
|
+
const SegmentedItem = memo(SegmentedItemComponent);
|
|
34
|
+
export {
|
|
35
|
+
SegmentedItem
|
|
36
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Theme } from '../../../../themes';
|
|
2
|
+
import { SegmentedTokens } from '../../Segmented.tokens';
|
|
3
|
+
export declare const getSegmentedItemStyle: (segmentedTokens: SegmentedTokens, block: boolean, isSelected: boolean, disabled: boolean | undefined) => (theme: Theme) => {
|
|
4
|
+
readonly position: "relative";
|
|
5
|
+
readonly cursor: "pointer" | "not-allowed";
|
|
6
|
+
readonly display: "flex";
|
|
7
|
+
readonly justifyContent: "center";
|
|
8
|
+
readonly flex: 1 | undefined;
|
|
9
|
+
readonly minWidth: 0 | undefined;
|
|
10
|
+
readonly paddingInline: 8;
|
|
11
|
+
readonly borderRadius: 4;
|
|
12
|
+
readonly backgroundColor: "#FFFFFF" | undefined;
|
|
13
|
+
readonly color: "#262626" | "#8C8C8C" | "#BFBFBF";
|
|
14
|
+
readonly boxShadow: `0 1px 2px 0 rgba(${number}, ${number}, ${number}, 0.03),
|
|
15
|
+
0 1px 6px -1px rgba(${number}, ${number}, ${number}, 0.02),
|
|
16
|
+
0 2px 4px 0 rgba(${number}, ${number}, ${number}, 0.02)` | undefined;
|
|
17
|
+
readonly ":hover": {
|
|
18
|
+
readonly color: "#595959" | undefined;
|
|
19
|
+
readonly backgroundColor: `rgba(${number}, ${number}, ${number}, 0.08)` | undefined;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const segmentedItemInputStyle: {
|
|
23
|
+
readonly position: "absolute";
|
|
24
|
+
readonly width: 0;
|
|
25
|
+
readonly height: 0;
|
|
26
|
+
readonly top: 0;
|
|
27
|
+
readonly left: 0;
|
|
28
|
+
readonly margin: 0;
|
|
29
|
+
};
|
|
30
|
+
export declare const segmentedItemLabelWrapperStyle: (segmentedTokens: SegmentedTokens) => (theme: Theme) => {
|
|
31
|
+
overflow: string;
|
|
32
|
+
whiteSpace: string;
|
|
33
|
+
textOverflow: string;
|
|
34
|
+
display: string;
|
|
35
|
+
alignItems: string;
|
|
36
|
+
columnGap: 4;
|
|
37
|
+
minHeight: 24;
|
|
38
|
+
};
|
|
39
|
+
export declare const segmentedItemIconStyle: (theme: Theme) => {
|
|
40
|
+
display: string;
|
|
41
|
+
fontSize: 16;
|
|
42
|
+
};
|
|
43
|
+
export declare const segmentedItemLabelStyle: {
|
|
44
|
+
overflow: string;
|
|
45
|
+
whiteSpace: string;
|
|
46
|
+
textOverflow: string;
|
|
47
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const ellipsisStyle = {
|
|
2
|
+
overflow: "hidden",
|
|
3
|
+
whiteSpace: "nowrap",
|
|
4
|
+
textOverflow: "ellipsis"
|
|
5
|
+
};
|
|
6
|
+
const getSegmentedItemStyle = (segmentedTokens, block, isSelected, disabled) => (theme) => ({
|
|
7
|
+
position: "relative",
|
|
8
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
9
|
+
display: "flex",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
flex: block ? 1 : void 0,
|
|
12
|
+
minWidth: block ? 0 : void 0,
|
|
13
|
+
paddingInline: segmentedTokens.segmentedItemPaddingHorizontal,
|
|
14
|
+
borderRadius: theme.borderRadiusM,
|
|
15
|
+
backgroundColor: isSelected ? segmentedTokens.segmentedItemBgSelected : void 0,
|
|
16
|
+
color: disabled ? segmentedTokens.segmentedItemTextDisabled : isSelected ? segmentedTokens.segmentedItemTextSelected : segmentedTokens.segmentedItemText,
|
|
17
|
+
boxShadow: isSelected ? segmentedTokens.segmentedItemShadow : void 0,
|
|
18
|
+
":hover": {
|
|
19
|
+
color: isSelected || disabled ? void 0 : segmentedTokens.segmentedItemTextHover,
|
|
20
|
+
backgroundColor: isSelected || disabled ? void 0 : segmentedTokens.segmentedItemBgHover
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const segmentedItemInputStyle = {
|
|
24
|
+
position: "absolute",
|
|
25
|
+
width: 0,
|
|
26
|
+
height: 0,
|
|
27
|
+
top: 0,
|
|
28
|
+
left: 0,
|
|
29
|
+
margin: 0
|
|
30
|
+
};
|
|
31
|
+
const segmentedItemLabelWrapperStyle = (segmentedTokens) => (theme) => ({
|
|
32
|
+
display: "flex",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
columnGap: theme.spaceXS,
|
|
35
|
+
minHeight: segmentedTokens.segmentedItemHeight,
|
|
36
|
+
...ellipsisStyle
|
|
37
|
+
});
|
|
38
|
+
const segmentedItemIconStyle = (theme) => ({
|
|
39
|
+
display: "flex",
|
|
40
|
+
fontSize: theme.iconM
|
|
41
|
+
});
|
|
42
|
+
const segmentedItemLabelStyle = {
|
|
43
|
+
...ellipsisStyle
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
getSegmentedItemStyle,
|
|
47
|
+
segmentedItemIconStyle,
|
|
48
|
+
segmentedItemInputStyle,
|
|
49
|
+
segmentedItemLabelStyle,
|
|
50
|
+
segmentedItemLabelWrapperStyle
|
|
51
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
|
+
import { SegmentedLabeledOption, SegmentedProps, SegmentedValue } from '../../Segmented.types';
|
|
3
|
+
export interface SegmentedItemProps<T = SegmentedValue> extends SegmentedLabeledOption, Required<Pick<SegmentedProps, "name" | "block">> {
|
|
4
|
+
isSelected: boolean;
|
|
5
|
+
onChange: (value: T, event: ChangeEvent<HTMLInputElement>) => void;
|
|
6
|
+
}
|
|
@@ -139,21 +139,25 @@ export declare const ThemeContext: import('react').Context<{
|
|
|
139
139
|
typography: {
|
|
140
140
|
readonly header1: {
|
|
141
141
|
readonly fontFamily: "Roboto";
|
|
142
|
+
readonly fontWeight: 500;
|
|
142
143
|
readonly fontSize: 24;
|
|
143
144
|
readonly lineHeight: "32px";
|
|
144
145
|
};
|
|
145
146
|
readonly header2: {
|
|
146
147
|
readonly fontFamily: "Roboto";
|
|
148
|
+
readonly fontWeight: 500;
|
|
147
149
|
readonly fontSize: 16;
|
|
148
150
|
readonly lineHeight: "24px";
|
|
149
151
|
};
|
|
150
152
|
readonly subheader1: {
|
|
151
153
|
readonly fontFamily: "Roboto";
|
|
154
|
+
readonly fontWeight: 500;
|
|
152
155
|
readonly fontSize: 14;
|
|
153
156
|
readonly lineHeight: "20px";
|
|
154
157
|
};
|
|
155
158
|
readonly subheader2: {
|
|
156
159
|
readonly fontFamily: "Roboto";
|
|
160
|
+
readonly fontWeight: 500;
|
|
157
161
|
readonly fontSize: 12;
|
|
158
162
|
readonly lineHeight: "20px";
|
|
159
163
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useControlledState } from './useControlledState';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useControlledState: <T>(initialState: T | (() => T), value?: T) => readonly [T, import('react').Dispatch<import('react').SetStateAction<T>>];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { isUndefined } from "lodash-es";
|
|
3
|
+
import { useFirstMountLayoutEffect } from "../useFirstMountLayoutEffect/useFirstMountLayoutEffect.js";
|
|
4
|
+
const useControlledState = (initialState, value) => {
|
|
5
|
+
const [innerValue, setInnerValue] = useState(initialState);
|
|
6
|
+
const mergedValue = isUndefined(value) ? innerValue : value;
|
|
7
|
+
useFirstMountLayoutEffect((firstMount) => {
|
|
8
|
+
if (!firstMount) {
|
|
9
|
+
setInnerValue(value);
|
|
10
|
+
}
|
|
11
|
+
}, [value]);
|
|
12
|
+
return [mergedValue, setInnerValue];
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
useControlledState
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFirstMountLayoutEffect } from './useFirstMountLayoutEffect';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useRef } from "react";
|
|
2
|
+
import { useIsomorphicLayoutEffect } from "../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";
|
|
3
|
+
const useFirstMountLayoutEffect = (callback, deps) => {
|
|
4
|
+
const firstMountRef = useRef(true);
|
|
5
|
+
useIsomorphicLayoutEffect(() => callback(firstMountRef.current), deps);
|
|
6
|
+
useIsomorphicLayoutEffect(() => {
|
|
7
|
+
firstMountRef.current = false;
|
|
8
|
+
return () => {
|
|
9
|
+
firstMountRef.current = true;
|
|
10
|
+
};
|
|
11
|
+
}, []);
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
useFirstMountLayoutEffect
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
|
|
@@ -139,21 +139,25 @@ export declare const useTheme: () => {
|
|
|
139
139
|
typography: {
|
|
140
140
|
readonly header1: {
|
|
141
141
|
readonly fontFamily: "Roboto";
|
|
142
|
+
readonly fontWeight: 500;
|
|
142
143
|
readonly fontSize: 24;
|
|
143
144
|
readonly lineHeight: "32px";
|
|
144
145
|
};
|
|
145
146
|
readonly header2: {
|
|
146
147
|
readonly fontFamily: "Roboto";
|
|
148
|
+
readonly fontWeight: 500;
|
|
147
149
|
readonly fontSize: 16;
|
|
148
150
|
readonly lineHeight: "24px";
|
|
149
151
|
};
|
|
150
152
|
readonly subheader1: {
|
|
151
153
|
readonly fontFamily: "Roboto";
|
|
154
|
+
readonly fontWeight: 500;
|
|
152
155
|
readonly fontSize: 14;
|
|
153
156
|
readonly lineHeight: "20px";
|
|
154
157
|
};
|
|
155
158
|
readonly subheader2: {
|
|
156
159
|
readonly fontFamily: "Roboto";
|
|
160
|
+
readonly fontWeight: 500;
|
|
157
161
|
readonly fontSize: 12;
|
|
158
162
|
readonly lineHeight: "20px";
|
|
159
163
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -45,4 +45,6 @@ export { type FormProps, type FormItemProps, Form } from './components/Form';
|
|
|
45
45
|
export { type PopconfirmProps, Popconfirm } from './components/Popconfirm';
|
|
46
46
|
export { TreeSelect } from './components/TreeSelect';
|
|
47
47
|
export type { TreeSelectProps } from './components/TreeSelect';
|
|
48
|
+
export { type EmptyProps, Empty } from './components/Empty';
|
|
49
|
+
export { type SegmentedProps, type SegmentedLabeledOption, Segmented, } from './components/Segmented';
|
|
48
50
|
export * from 'react-intersection-observer/test-utils';
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,8 @@ import { useConfig } from "./components/ConfigProvider/hooks/useConfig/useConfig
|
|
|
33
33
|
import { Form } from "./components/Form/Form.js";
|
|
34
34
|
import { Popconfirm } from "./components/Popconfirm/Popconfirm.js";
|
|
35
35
|
import { TreeSelect } from "./components/TreeSelect/TreeSelect.js";
|
|
36
|
+
import { Empty } from "./components/Empty/Empty.js";
|
|
37
|
+
import { Segmented } from "./components/Segmented/Segmented.js";
|
|
36
38
|
export {
|
|
37
39
|
Alert,
|
|
38
40
|
Avatar,
|
|
@@ -42,6 +44,7 @@ export {
|
|
|
42
44
|
ConfigProvider,
|
|
43
45
|
DatePicker,
|
|
44
46
|
Dropdown,
|
|
47
|
+
Empty,
|
|
45
48
|
Form,
|
|
46
49
|
Input,
|
|
47
50
|
InputNumber,
|
|
@@ -50,6 +53,7 @@ export {
|
|
|
50
53
|
Popover,
|
|
51
54
|
Progress,
|
|
52
55
|
Radio,
|
|
56
|
+
Segmented,
|
|
53
57
|
Select,
|
|
54
58
|
Switch,
|
|
55
59
|
Tabs,
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
export declare const baseTypographyTokens: {
|
|
2
2
|
readonly header1: {
|
|
3
3
|
readonly fontFamily: "Roboto";
|
|
4
|
+
readonly fontWeight: 500;
|
|
4
5
|
readonly fontSize: 24;
|
|
5
6
|
readonly lineHeight: "32px";
|
|
6
7
|
};
|
|
7
8
|
readonly header2: {
|
|
8
9
|
readonly fontFamily: "Roboto";
|
|
10
|
+
readonly fontWeight: 500;
|
|
9
11
|
readonly fontSize: 16;
|
|
10
12
|
readonly lineHeight: "24px";
|
|
11
13
|
};
|
|
12
14
|
readonly subheader1: {
|
|
13
15
|
readonly fontFamily: "Roboto";
|
|
16
|
+
readonly fontWeight: 500;
|
|
14
17
|
readonly fontSize: 14;
|
|
15
18
|
readonly lineHeight: "20px";
|
|
16
19
|
};
|
|
17
20
|
readonly subheader2: {
|
|
18
21
|
readonly fontFamily: "Roboto";
|
|
22
|
+
readonly fontWeight: 500;
|
|
19
23
|
readonly fontSize: 12;
|
|
20
24
|
readonly lineHeight: "20px";
|
|
21
25
|
};
|
|
@@ -5,21 +5,25 @@ const fonts = {
|
|
|
5
5
|
const baseTypographyTokens = {
|
|
6
6
|
header1: {
|
|
7
7
|
fontFamily: fonts.mainFontFamily,
|
|
8
|
+
fontWeight: 500,
|
|
8
9
|
fontSize: 24,
|
|
9
10
|
lineHeight: "32px"
|
|
10
11
|
},
|
|
11
12
|
header2: {
|
|
12
13
|
fontFamily: fonts.mainFontFamily,
|
|
14
|
+
fontWeight: 500,
|
|
13
15
|
fontSize: 16,
|
|
14
16
|
lineHeight: "24px"
|
|
15
17
|
},
|
|
16
18
|
subheader1: {
|
|
17
19
|
fontFamily: fonts.mainFontFamily,
|
|
20
|
+
fontWeight: 500,
|
|
18
21
|
fontSize: 14,
|
|
19
22
|
lineHeight: "20px"
|
|
20
23
|
},
|
|
21
24
|
subheader2: {
|
|
22
25
|
fontFamily: fonts.mainFontFamily,
|
|
26
|
+
fontWeight: 500,
|
|
23
27
|
fontSize: 12,
|
|
24
28
|
lineHeight: "20px"
|
|
25
29
|
},
|
package/dist/themes/themes.d.ts
CHANGED
|
@@ -139,21 +139,25 @@ export declare const themeMap: Map<"light", {
|
|
|
139
139
|
typography: {
|
|
140
140
|
readonly header1: {
|
|
141
141
|
readonly fontFamily: "Roboto";
|
|
142
|
+
readonly fontWeight: 500;
|
|
142
143
|
readonly fontSize: 24;
|
|
143
144
|
readonly lineHeight: "32px";
|
|
144
145
|
};
|
|
145
146
|
readonly header2: {
|
|
146
147
|
readonly fontFamily: "Roboto";
|
|
148
|
+
readonly fontWeight: 500;
|
|
147
149
|
readonly fontSize: 16;
|
|
148
150
|
readonly lineHeight: "24px";
|
|
149
151
|
};
|
|
150
152
|
readonly subheader1: {
|
|
151
153
|
readonly fontFamily: "Roboto";
|
|
154
|
+
readonly fontWeight: 500;
|
|
152
155
|
readonly fontSize: 14;
|
|
153
156
|
readonly lineHeight: "20px";
|
|
154
157
|
};
|
|
155
158
|
readonly subheader2: {
|
|
156
159
|
readonly fontFamily: "Roboto";
|
|
160
|
+
readonly fontWeight: 500;
|
|
157
161
|
readonly fontSize: 12;
|
|
158
162
|
readonly lineHeight: "20px";
|
|
159
163
|
};
|
|
@@ -140,21 +140,25 @@ export declare const getTheme: (themeName: ThemeNames) => {
|
|
|
140
140
|
typography: {
|
|
141
141
|
readonly header1: {
|
|
142
142
|
readonly fontFamily: "Roboto";
|
|
143
|
+
readonly fontWeight: 500;
|
|
143
144
|
readonly fontSize: 24;
|
|
144
145
|
readonly lineHeight: "32px";
|
|
145
146
|
};
|
|
146
147
|
readonly header2: {
|
|
147
148
|
readonly fontFamily: "Roboto";
|
|
149
|
+
readonly fontWeight: 500;
|
|
148
150
|
readonly fontSize: 16;
|
|
149
151
|
readonly lineHeight: "24px";
|
|
150
152
|
};
|
|
151
153
|
readonly subheader1: {
|
|
152
154
|
readonly fontFamily: "Roboto";
|
|
155
|
+
readonly fontWeight: 500;
|
|
153
156
|
readonly fontSize: 14;
|
|
154
157
|
readonly lineHeight: "20px";
|
|
155
158
|
};
|
|
156
159
|
readonly subheader2: {
|
|
157
160
|
readonly fontFamily: "Roboto";
|
|
161
|
+
readonly fontWeight: 500;
|
|
158
162
|
readonly fontSize: 12;
|
|
159
163
|
readonly lineHeight: "20px";
|
|
160
164
|
};
|
|
@@ -501,21 +505,25 @@ export declare const lightTheme: {
|
|
|
501
505
|
typography: {
|
|
502
506
|
readonly header1: {
|
|
503
507
|
readonly fontFamily: "Roboto";
|
|
508
|
+
readonly fontWeight: 500;
|
|
504
509
|
readonly fontSize: 24;
|
|
505
510
|
readonly lineHeight: "32px";
|
|
506
511
|
};
|
|
507
512
|
readonly header2: {
|
|
508
513
|
readonly fontFamily: "Roboto";
|
|
514
|
+
readonly fontWeight: 500;
|
|
509
515
|
readonly fontSize: 16;
|
|
510
516
|
readonly lineHeight: "24px";
|
|
511
517
|
};
|
|
512
518
|
readonly subheader1: {
|
|
513
519
|
readonly fontFamily: "Roboto";
|
|
520
|
+
readonly fontWeight: 500;
|
|
514
521
|
readonly fontSize: 14;
|
|
515
522
|
readonly lineHeight: "20px";
|
|
516
523
|
};
|
|
517
524
|
readonly subheader2: {
|
|
518
525
|
readonly fontFamily: "Roboto";
|
|
526
|
+
readonly fontWeight: 500;
|
|
519
527
|
readonly fontSize: 12;
|
|
520
528
|
readonly lineHeight: "20px";
|
|
521
529
|
};
|