onekijs-ui 0.19.21 → 0.19.23
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/alert/components/AlertComponent.d.ts +4 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/style.d.ts +4 -0
- package/dist/components/alert/typings.d.ts +11 -0
- package/dist/components/card/typings.d.ts +1 -0
- package/dist/components/icon/CrossIcon.d.ts +2 -1
- package/dist/components/icon/typings.d.ts +3 -1
- package/dist/components/properties/typings.d.ts +2 -1
- package/dist/components/wizard/typings.d.ts +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +279 -114
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +277 -115
- package/dist/index.module.js.map +1 -1
- package/package.json +3 -3
- package/src/components/alert/components/AlertComponent.tsx +56 -0
- package/src/components/alert/index.tsx +9 -0
- package/src/components/alert/style.ts +57 -0
- package/src/components/alert/typings.ts +12 -0
- package/src/components/card/FormCard.tsx +8 -2
- package/src/components/card/typings.ts +1 -0
- package/src/components/icon/CloseAllIcon.tsx +4 -1
- package/src/components/icon/CloseIcon.tsx +4 -1
- package/src/components/icon/CrossIcon.tsx +4 -1
- package/src/components/icon/DebugIcon.tsx +4 -1
- package/src/components/icon/ErrorIcon.tsx +4 -1
- package/src/components/icon/FileIcon.tsx +4 -1
- package/src/components/icon/FilterIcon.tsx +4 -1
- package/src/components/icon/FolderIcon.tsx +4 -1
- package/src/components/icon/HelpIcon.tsx +4 -1
- package/src/components/icon/HideIcon.tsx +4 -1
- package/src/components/icon/InfoIcon.tsx +7 -3
- package/src/components/icon/LoadingIcon.tsx +5 -0
- package/src/components/icon/MenuIcon.tsx +4 -1
- package/src/components/icon/RefreshIcon.tsx +4 -1
- package/src/components/icon/RemoveIcon.tsx +4 -1
- package/src/components/icon/SearchIcon.tsx +4 -1
- package/src/components/icon/ShowIcon.tsx +4 -1
- package/src/components/icon/SuccessIcon.tsx +4 -1
- package/src/components/icon/TogglerIcon.tsx +5 -1
- package/src/components/icon/WarningIcon.tsx +4 -1
- package/src/components/icon/typings.ts +3 -1
- package/src/components/properties/components/PropertiesComponent.tsx +17 -5
- package/src/components/properties/components/Property.tsx +9 -2
- package/src/components/properties/style.ts +24 -2
- package/src/components/properties/typings.ts +2 -1
- package/src/components/table/style.ts +5 -0
- package/src/components/wizard/components/Step.tsx +3 -0
- package/src/components/wizard/typings.ts +1 -0
- package/src/index.ts +5 -0
|
@@ -4,6 +4,7 @@ import { alignItems } from '../../styles/alignment';
|
|
|
4
4
|
import { display } from '../../styles/display';
|
|
5
5
|
import { color } from '../../styles/typography';
|
|
6
6
|
import { IconProps } from './typings';
|
|
7
|
+
import { marginLeft, marginRight } from '../../styles/spacing';
|
|
7
8
|
|
|
8
9
|
const WarningIconComponent: FC<IconProps> = (props) => {
|
|
9
10
|
return (
|
|
@@ -20,12 +21,14 @@ const WarningIconComponent: FC<IconProps> = (props) => {
|
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export default styled(WarningIconComponent)`
|
|
23
|
-
${({ width = '16px', height = '16px', color: cssColor = 'warning' }) => css`
|
|
24
|
+
${({ width = '16px', height = '16px', color: cssColor = 'warning', marginLeft: ml = '0', marginRight: mr = '0' }) => css`
|
|
24
25
|
width: ${width};
|
|
25
26
|
height: ${height};
|
|
26
27
|
${display('flex')};
|
|
27
28
|
${alignItems('center')};
|
|
28
29
|
${color(cssColor)}
|
|
30
|
+
${marginLeft(ml)}
|
|
31
|
+
${marginRight(mr)}
|
|
29
32
|
.o-icon-warning-svg {
|
|
30
33
|
display: inline-block;
|
|
31
34
|
fill: currentColor;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Property } from 'csstype';
|
|
2
|
-
import { ColorPropertyTheme } from '../../styles/typings';
|
|
2
|
+
import { ColorPropertyTheme, SpacingPropertyTheme, TLength } from '../../styles/typings';
|
|
3
3
|
|
|
4
4
|
export type IconProps = React.InputHTMLAttributes<HTMLDivElement> & {
|
|
5
5
|
color?: ColorPropertyTheme | Property.Color;
|
|
6
|
+
marginRight?: SpacingPropertyTheme| Property.MarginRight<TLength>;
|
|
7
|
+
marginLeft?: SpacingPropertyTheme| Property.MarginLeft<TLength>;
|
|
6
8
|
};
|
|
7
9
|
|
|
8
10
|
export type TogglerIconProps = IconProps & {
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import React, { FC, useMemo } from 'react';
|
|
1
|
+
import React, { FC, ReactNode, useMemo } from 'react';
|
|
2
2
|
import { addClassname } from '../../../utils/style';
|
|
3
3
|
import { DefaultPropertiesContext } from '../hooks/usePropertiesContext';
|
|
4
|
-
import { PropertiesContext, PropertiesProps } from '../typings';
|
|
4
|
+
import { PropertiesContext, PropertiesProps, PropertyProps } from '../typings';
|
|
5
5
|
import Property from './Property';
|
|
6
6
|
|
|
7
|
+
const isReactNode = (value: ReactNode | Partial<PropertyProps>): value is ReactNode => {
|
|
8
|
+
if (value === null || value === undefined) return true;
|
|
9
|
+
if (Object.keys(value).includes('value')) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
7
15
|
const PropertiesComponent: FC<PropertiesProps> = ({
|
|
8
16
|
className,
|
|
9
17
|
properties,
|
|
@@ -34,9 +42,13 @@ const PropertiesComponent: FC<PropertiesProps> = ({
|
|
|
34
42
|
return (
|
|
35
43
|
<DefaultPropertiesContext.Provider value={context}>
|
|
36
44
|
<div className={classNames}>
|
|
37
|
-
{keys.map((key) =>
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
{keys.map((key) => {
|
|
46
|
+
const property = properties[key];
|
|
47
|
+
const value = isReactNode(property) ? property : property.value;
|
|
48
|
+
const help = isReactNode(property) ? undefined : property.help;
|
|
49
|
+
const name = isReactNode(property) ? key : property.name ?? key;
|
|
50
|
+
return <PropertyComponent key={key} name={name} value={value} help={help} ErrorBoundaryComponent={ErrorBoundaryComponent} />
|
|
51
|
+
})}
|
|
40
52
|
</div>
|
|
41
53
|
</DefaultPropertiesContext.Provider>
|
|
42
54
|
);
|
|
@@ -3,6 +3,8 @@ import React, { FC } from 'react';
|
|
|
3
3
|
import Col from '../../grid/Col';
|
|
4
4
|
import Row from '../../grid/Row';
|
|
5
5
|
import { GridSize } from '../../grid/typings';
|
|
6
|
+
import HelpIcon from '../../icon/HelpIcon';
|
|
7
|
+
import Tooltip from '../../tooltip';
|
|
6
8
|
import usePropertiesContext from '../hooks/usePropertiesContext';
|
|
7
9
|
import { PropertyProps } from '../typings';
|
|
8
10
|
|
|
@@ -19,8 +21,13 @@ const Property: FC<PropertyProps> = React.memo((props) => {
|
|
|
19
21
|
});
|
|
20
22
|
return (
|
|
21
23
|
<Row className="o-property" gapX="10px" gapY="0px">
|
|
22
|
-
<Col size={nameSize} sm={context.sm} md={context.md} lg={context.lg} xl={context.xl} className="o-property-
|
|
23
|
-
|
|
24
|
+
<Col size={nameSize} sm={context.sm} md={context.md} lg={context.lg} xl={context.xl} className="o-property-key">
|
|
25
|
+
<span className="o-property-name">{name}</span>
|
|
26
|
+
{props.help && (
|
|
27
|
+
<Tooltip content={props.help} placement="top">
|
|
28
|
+
<HelpIcon />
|
|
29
|
+
</Tooltip>
|
|
30
|
+
)}
|
|
24
31
|
</Col>
|
|
25
32
|
<Col
|
|
26
33
|
size={valueSize}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
|
-
import { paddingY } from '../../styles/spacing';
|
|
2
|
+
import { marginBottom, marginLeft, paddingY } from '../../styles/spacing';
|
|
3
3
|
import { ComponentStyle } from '../../styles/typings';
|
|
4
|
-
import { fontWeight } from '../../styles/typography';
|
|
4
|
+
import { color, fontWeight, textDecoration, textDecorationStyle, textUnderlineOffset } from '../../styles/typography';
|
|
5
5
|
import { PropertiesProps } from './typings';
|
|
6
6
|
import { flexWrap } from '../../styles/flex';
|
|
7
|
+
import { cursor } from '../../styles/interactivity';
|
|
8
|
+
import { display } from '../../styles/display';
|
|
9
|
+
import { alignItems } from '../../styles/alignment';
|
|
10
|
+
import { width } from '../../styles/size';
|
|
7
11
|
|
|
8
12
|
export const propertiesStyle: ComponentStyle<PropertiesProps> = ({ theme }) => {
|
|
9
13
|
const t = theme.properties;
|
|
@@ -15,5 +19,23 @@ export const propertiesStyle: ComponentStyle<PropertiesProps> = ({ theme }) => {
|
|
|
15
19
|
.o-property-name {
|
|
16
20
|
${fontWeight(t.fontWeight)}
|
|
17
21
|
}
|
|
22
|
+
.o-property-help {
|
|
23
|
+
${textDecoration('underline')}
|
|
24
|
+
${textDecorationStyle('dashed')}
|
|
25
|
+
${textUnderlineOffset('0.25rem')}
|
|
26
|
+
${cursor('help')}
|
|
27
|
+
}
|
|
28
|
+
.o-property-key {
|
|
29
|
+
${display('flex')}
|
|
30
|
+
${alignItems('center')}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.o-tooltip {
|
|
34
|
+
${cursor('pointer')}
|
|
35
|
+
${width(5)}
|
|
36
|
+
${marginBottom('2px')}
|
|
37
|
+
${color('pink')}
|
|
38
|
+
${marginLeft('xs')}
|
|
39
|
+
}
|
|
18
40
|
`;
|
|
19
41
|
};
|
|
@@ -18,6 +18,7 @@ export type PropertiesProps = {
|
|
|
18
18
|
export type PropertyProps = {
|
|
19
19
|
value: ReactNode;
|
|
20
20
|
name: string;
|
|
21
|
+
help?: ReactNode;
|
|
21
22
|
ErrorBoundaryComponent?: ComponentType<PropsWithChildren<PropertyProps>>;
|
|
22
23
|
};
|
|
23
24
|
|
|
@@ -29,4 +30,4 @@ export type PropertiesContext = {
|
|
|
29
30
|
xl?: GridSize;
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
export type PropertiesList = AnonymousObject<ReactNode
|
|
33
|
+
export type PropertiesList = AnonymousObject<ReactNode | Partial<PropertyProps>>;
|
|
@@ -181,7 +181,12 @@ export const tableStyle: ComponentStyle<TableProps<any>> = ({ theme, fit = true
|
|
|
181
181
|
.o-table-header-title-container {
|
|
182
182
|
${borderBottomWidth(0)}
|
|
183
183
|
${paddingBottom(0)}
|
|
184
|
+
.o-helper-icon {
|
|
185
|
+
${marginLeft('xs')}
|
|
186
|
+
${marginTop('-2px')}
|
|
187
|
+
}
|
|
184
188
|
}
|
|
189
|
+
|
|
185
190
|
}
|
|
186
191
|
|
|
187
192
|
.o-table-header-row-title, .o-table-header-row-filter {
|
|
@@ -5,6 +5,7 @@ import { addClassname } from '../../../utils/style';
|
|
|
5
5
|
import useStep from '../hooks/useStep';
|
|
6
6
|
import { useWizardState } from '../hooks/useWizardState';
|
|
7
7
|
import { StepProps } from '../typings';
|
|
8
|
+
import Alert from '../../alert';
|
|
8
9
|
|
|
9
10
|
const Step: FCC<StepProps> = ({
|
|
10
11
|
title,
|
|
@@ -19,6 +20,7 @@ const Step: FCC<StepProps> = ({
|
|
|
19
20
|
showTitle = true,
|
|
20
21
|
className,
|
|
21
22
|
onTouch,
|
|
23
|
+
help,
|
|
22
24
|
}) => {
|
|
23
25
|
const { animate, forwardOnly } = useWizardState();
|
|
24
26
|
|
|
@@ -63,6 +65,7 @@ const Step: FCC<StepProps> = ({
|
|
|
63
65
|
<CSSTransition in={true} timeout={animate} appear={true} onEnter={onEnter} onEntering={onEntering}>
|
|
64
66
|
<div className={addClassname('o-step-content', className)}>
|
|
65
67
|
{showTitle && <div className="o-step-content-title">{title}</div>}
|
|
68
|
+
{help && <Alert kind="info" marginBottom='lg'>{help}</Alert>}
|
|
66
69
|
{children}
|
|
67
70
|
</div>
|
|
68
71
|
</CSSTransition>
|
package/src/index.ts
CHANGED
|
@@ -252,6 +252,11 @@ export { default as useTableService } from './components/table/hooks/useTableSer
|
|
|
252
252
|
export { default as useTextColumn } from './components/table/hooks/useTextColumn';
|
|
253
253
|
export { default as useTextareaColumn } from './components/table/hooks/useTextareaColumn';
|
|
254
254
|
|
|
255
|
+
export { default as AlertComponent } from './components/alert/components/AlertComponent';
|
|
256
|
+
export { default as Alert } from './components/alert';
|
|
257
|
+
export { default as alertStyle } from './components/alert/style';
|
|
258
|
+
export { AlertProps } from './components/alert/typings';
|
|
259
|
+
|
|
255
260
|
export { default as FormCardDisplayer } from './components/card/FormCardDisplayer';
|
|
256
261
|
export { filterListStyle, tableStyle } from './components/table/style';
|
|
257
262
|
export {
|