@ainias42/react-bootstrap-mobile 1.0.4 → 1.0.5
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/ActionSheet/ActionSheet.d.ts +1 -1
- package/dist/Components/FormElements/Button/Button.d.ts +4 -1
- package/dist/Components/FormElements/Button/Button.stories.d.ts +8 -2
- package/dist/Components/Icon/BaseIcon.d.ts +15 -0
- package/dist/Components/Icon/DoubleIcon.d.ts +1 -1
- package/dist/Components/Icon/Icon.d.ts +4 -13
- package/dist/Components/Icon/Icon.stories.d.ts +1 -1
- package/dist/Components/Layout/BaseBlock.d.ts +10 -0
- package/dist/Components/Layout/BaseInlineBlock.d.ts +10 -0
- package/dist/Components/Layout/Block.d.ts +4 -10
- package/dist/Components/Layout/Flex.d.ts +6 -1
- package/dist/Components/Layout/InlineBlock.d.ts +4 -10
- package/dist/Components/Menu/Menu.d.ts +1 -1
- package/dist/Components/Menu/MenuItem.d.ts +1 -1
- package/dist/Components/Menu/Submenu.d.ts +1 -1
- package/dist/Components/Menu/useHoverMenu.d.ts +17 -0
- package/dist/Components/SpoilerList/Spoiler/Spoiler.d.ts +1 -1
- package/dist/Components/TabBar/TabBar.d.ts +1 -1
- package/dist/Components/Title/HoverTitle.d.ts +9 -0
- package/dist/Components/Title/Title.stories.d.ts +11 -0
- package/dist/Components/Title/withTitle.d.ts +6 -0
- package/dist/Components/TopBar/TopBar.d.ts +1 -1
- package/dist/index.css +4 -3
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +422 -205
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Components/ActionSheet/ActionSheet.tsx +12 -10
- package/src/Components/Colors.stories.tsx +7 -7
- package/src/Components/Dialog/ButtonDialog.tsx +9 -9
- package/src/Components/Dialog/Dialog.tsx +6 -6
- package/src/Components/Dialog/DialogBackground.tsx +5 -5
- package/src/Components/Dialog/DialogContainer.tsx +3 -3
- package/src/Components/ErrorBoundary.tsx +3 -3
- package/src/Components/FormElements/Button/Button.tsx +2 -2
- package/src/Components/FormElements/Error/FormError.tsx +6 -6
- package/src/Components/FormElements/Input/FileInput/MultipleFileInput.tsx +7 -7
- package/src/Components/FormElements/Input/PasswordInput/PasswordInput.tsx +2 -2
- package/src/Components/FormElements/SearchSelectInput/SearchSelectInput.tsx +9 -9
- package/src/Components/Hooks/useDelayed.ts +5 -4
- package/src/Components/Icon/{Icon.tsx → BaseIcon.tsx} +6 -4
- package/src/Components/Icon/DoubleIcon.tsx +7 -7
- package/src/Components/Icon/Icon.stories.tsx +3 -3
- package/src/Components/Icon/Icon.ts +4 -0
- package/src/Components/Layout/{Block.tsx → BaseBlock.tsx} +2 -3
- package/src/Components/Layout/{InlineBlock.tsx → BaseInlineBlock.tsx} +2 -2
- package/src/Components/Layout/Block.ts +4 -0
- package/src/Components/Layout/Flex.tsx +16 -0
- package/src/Components/Layout/Grid/Grid.tsx +3 -3
- package/src/Components/Layout/Grid/GridItem.tsx +3 -3
- package/src/Components/Layout/InlineBlock.ts +4 -0
- package/src/Components/Layout/layout.module.scss +13 -0
- package/src/Components/LoadingArea/LoadingArea.stories.tsx +3 -3
- package/src/Components/Menu/HoverMenu.stories.tsx +3 -3
- package/src/Components/Menu/HoverMenu.tsx +8 -28
- package/src/Components/Menu/Menu.tsx +4 -4
- package/src/Components/Menu/MenuDivider.tsx +2 -2
- package/src/Components/Menu/MenuItem.tsx +6 -6
- package/src/Components/Menu/Submenu.tsx +7 -7
- package/src/Components/Menu/menu.module.scss +3 -2
- package/src/Components/Menu/useHoverMenu.ts +36 -0
- package/src/Components/SizeCalculator/SizeCalculator.tsx +3 -3
- package/src/Components/SpoilerList/Spoiler/Spoiler.tsx +9 -9
- package/src/Components/SpoilerList/SpoilerList.tsx +3 -3
- package/src/Components/TabBar/TabBar.tsx +3 -3
- package/src/Components/Title/HoverTitle.tsx +97 -0
- package/src/Components/Title/Title.stories.tsx +95 -0
- package/src/Components/Title/hoverTitle.module.scss +8 -0
- package/src/Components/Title/withTitle.module.scss +7 -0
- package/src/Components/Title/withTitle.tsx +48 -0
- package/src/Components/TopBar/MoreButton.tsx +3 -3
- package/src/Components/TopBar/TopBar.tsx +6 -6
- package/src/WrongChildError.ts +1 -0
- package/src/helper/withRestrictedChildren.tsx +3 -1
- package/src/index.ts +6 -0
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseBlock } from '@/Components/Layout/BaseBlock';
|
|
3
|
+
import { BaseIcon } from '@/Components/Icon/BaseIcon';
|
|
4
|
+
import { BaseInlineBlock } from '@/Components/Layout/BaseInlineBlock';
|
|
3
5
|
import { Clickable } from '@/Components/Clickable/Clickable';
|
|
4
6
|
import { Container } from '@/Components/Layout/Container';
|
|
5
7
|
import { Flex } from '@/Components/Layout/Flex';
|
|
6
|
-
import { Icon } from '@/Components/Icon/Icon';
|
|
7
|
-
import { InlineBlock } from '@/Components/Layout/InlineBlock';
|
|
8
8
|
import { Text } from '@/Components/Text/Text';
|
|
9
9
|
import { faTimes } from '@fortawesome/free-solid-svg-icons';
|
|
10
10
|
import { useCallback, useImperativeHandle, useState } from 'react';
|
|
@@ -13,7 +13,7 @@ import baseStyles from '@/scss/baseClasses.module.scss';
|
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import styles from '@/Components/ActionSheet/actionSheet.module.scss';
|
|
15
15
|
import type { ForwardedRef } from 'react';
|
|
16
|
-
import type { IconSource } from '@/Components/Icon/
|
|
16
|
+
import type { IconSource } from '@/Components/Icon/BaseIcon';
|
|
17
17
|
import type { RbmComponentProps } from '@/Components/RbmComponentProps';
|
|
18
18
|
|
|
19
19
|
export type ActionSheetAction<ActionData> = {
|
|
@@ -89,7 +89,9 @@ export const ActionSheet = withMemo(function ActionSheet({
|
|
|
89
89
|
onClick={onActionClick}
|
|
90
90
|
onClickData={action}
|
|
91
91
|
>
|
|
92
|
-
<
|
|
92
|
+
<BaseInlineBlock className={styles.actionIcon}>
|
|
93
|
+
{action.icon ? <BaseIcon icon={action.icon} /> : null}
|
|
94
|
+
</BaseInlineBlock>
|
|
93
95
|
<Text className={styles.actionName}>{action.name}</Text>
|
|
94
96
|
</Clickable>
|
|
95
97
|
);
|
|
@@ -103,9 +105,9 @@ export const ActionSheet = withMemo(function ActionSheet({
|
|
|
103
105
|
<Container fluid="xxl" className={baseStyles.fullHeight}>
|
|
104
106
|
<Flex className={styles.content}>
|
|
105
107
|
{title ? (
|
|
106
|
-
<
|
|
108
|
+
<BaseBlock className={styles.title}>
|
|
107
109
|
<Text>{title}</Text>
|
|
108
|
-
</
|
|
110
|
+
</BaseBlock>
|
|
109
111
|
) : null}
|
|
110
112
|
{actions.map(renderAction)}
|
|
111
113
|
<Clickable
|
|
@@ -113,9 +115,9 @@ export const ActionSheet = withMemo(function ActionSheet({
|
|
|
113
115
|
onClick={() => console.log('Cancel clicked')}
|
|
114
116
|
__allowChildren="all"
|
|
115
117
|
>
|
|
116
|
-
<
|
|
117
|
-
<
|
|
118
|
-
</
|
|
118
|
+
<BaseInlineBlock className={styles.actionIcon}>
|
|
119
|
+
<BaseIcon icon={faTimes} />
|
|
120
|
+
</BaseInlineBlock>
|
|
119
121
|
{cancelText}
|
|
120
122
|
</Clickable>
|
|
121
123
|
</Flex>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { BaseBlock } from '@/Components/Layout/BaseBlock';
|
|
4
4
|
import { Grid } from '@/Components/Layout/Grid/Grid';
|
|
5
5
|
import { GridItem } from '@/Components/Layout/Grid/GridItem';
|
|
6
6
|
import { ObjectHelper } from '@ainias42/js-helper';
|
|
@@ -40,7 +40,7 @@ export const Default: Story = {
|
|
|
40
40
|
return (
|
|
41
41
|
<div>
|
|
42
42
|
{ObjectHelper.entries(textColors).map(([category, colors]) => (
|
|
43
|
-
<
|
|
43
|
+
<BaseBlock>
|
|
44
44
|
<Text emphasized={true}>Text - {category}</Text>
|
|
45
45
|
<Grid>
|
|
46
46
|
{colors.map((color) => (
|
|
@@ -49,15 +49,15 @@ export const Default: Story = {
|
|
|
49
49
|
</GridItem>
|
|
50
50
|
))}
|
|
51
51
|
</Grid>
|
|
52
|
-
</
|
|
52
|
+
</BaseBlock>
|
|
53
53
|
))}
|
|
54
54
|
{ObjectHelper.entries(backgroundColors).map(([category, colors]) => (
|
|
55
|
-
<
|
|
55
|
+
<BaseBlock>
|
|
56
56
|
<Text emphasized={true}>Background - {category}</Text>
|
|
57
57
|
<Grid>
|
|
58
58
|
{colors.map((color) => (
|
|
59
59
|
<GridItem size={2}>
|
|
60
|
-
<
|
|
60
|
+
<BaseBlock
|
|
61
61
|
style={{
|
|
62
62
|
backgroundColor: `var(--${color})`,
|
|
63
63
|
padding: '0.5rem',
|
|
@@ -65,11 +65,11 @@ export const Default: Story = {
|
|
|
65
65
|
}}
|
|
66
66
|
>
|
|
67
67
|
<Text>{color}</Text>
|
|
68
|
-
</
|
|
68
|
+
</BaseBlock>
|
|
69
69
|
</GridItem>
|
|
70
70
|
))}
|
|
71
71
|
</Grid>
|
|
72
|
-
</
|
|
72
|
+
</BaseBlock>
|
|
73
73
|
))}
|
|
74
74
|
</div>
|
|
75
75
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseBlock } from '@/Components/Layout/BaseBlock';
|
|
3
3
|
import { Clickable } from '@/Components/Clickable/Clickable';
|
|
4
4
|
import { Flavor } from '@/Components/Flavor';
|
|
5
5
|
import { TEXT_SIZE, Text } from '@/Components/Text/Text';
|
|
@@ -37,27 +37,27 @@ function ButtonDialog({ title, message, buttons, style, className, extraContent
|
|
|
37
37
|
// Render Functions
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
|
-
<
|
|
40
|
+
<BaseBlock className={classNames(styles.buttonDialog, className)} style={style}>
|
|
41
41
|
{!!title && (
|
|
42
|
-
<
|
|
42
|
+
<BaseBlock>
|
|
43
43
|
<Text size={TEXT_SIZE.large} className={styles.title}>
|
|
44
44
|
{title}
|
|
45
45
|
</Text>
|
|
46
|
-
</
|
|
46
|
+
</BaseBlock>
|
|
47
47
|
)}
|
|
48
|
-
<
|
|
48
|
+
<BaseBlock>
|
|
49
49
|
<Text className={styles.message}>{message}</Text>
|
|
50
|
-
</
|
|
50
|
+
</BaseBlock>
|
|
51
51
|
{extraContent}
|
|
52
|
-
<
|
|
52
|
+
<BaseBlock className={styles.buttonContainer}>
|
|
53
53
|
{buttons.map((b, i) => (
|
|
54
54
|
// eslint-disable-next-line react/no-array-index-key
|
|
55
55
|
<Clickable onClick={b.callback} className={classNames(styles.button)} key={i + b.text}>
|
|
56
56
|
<Text className={classNames(styles.buttonText, b.flavor ?? Flavor.Accent)}>{b.text}</Text>
|
|
57
57
|
</Clickable>
|
|
58
58
|
))}
|
|
59
|
-
</
|
|
60
|
-
</
|
|
59
|
+
</BaseBlock>
|
|
60
|
+
</BaseBlock>
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseBlock } from '@/Components/Layout/BaseBlock';
|
|
3
|
+
import { BaseInlineBlock } from '@/Components/Layout/BaseInlineBlock';
|
|
3
4
|
import { Clickable } from '@/Components/Clickable/Clickable';
|
|
4
|
-
import { InlineBlock } from '@/Components/Layout/InlineBlock';
|
|
5
5
|
import { useCallback, useState } from 'react';
|
|
6
6
|
import { withMemo } from '@/helper/withMemo';
|
|
7
7
|
import classNames from 'classnames';
|
|
@@ -63,17 +63,17 @@ function Dialog<ReturnData>({
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return (
|
|
66
|
-
<
|
|
66
|
+
<BaseBlock className={classNames(styles.dialogContainer, className)} __allowChildren="all" style={style}>
|
|
67
67
|
<Clickable onClick={onCurtainClick} className={styles.closeCurtain} interactable={closable} />
|
|
68
|
-
<
|
|
68
|
+
<BaseInlineBlock __allowChildren="all" className={styles.dialog}>
|
|
69
69
|
{React.Children.map(children, (child) => {
|
|
70
70
|
if (React.isValidElement(child)) {
|
|
71
71
|
return React.cloneElement(child, { close });
|
|
72
72
|
}
|
|
73
73
|
return child;
|
|
74
74
|
})}
|
|
75
|
-
</
|
|
76
|
-
</
|
|
75
|
+
</BaseInlineBlock>
|
|
76
|
+
</BaseBlock>
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseBlock } from '@/Components/Layout/BaseBlock';
|
|
3
|
+
import { BaseIcon } from '@/Components/Icon/BaseIcon';
|
|
3
4
|
import { Clickable } from '@/Components/Clickable/Clickable';
|
|
4
5
|
import { Flex } from '@/Components/Layout/Flex';
|
|
5
6
|
import { Grow } from '@/Components/Layout/Grow';
|
|
6
7
|
import { Heading } from '@/Components/Text/Heading';
|
|
7
|
-
import { Icon } from '@/Components/Icon/Icon';
|
|
8
8
|
import { faCircleXmark } from '@fortawesome/free-solid-svg-icons';
|
|
9
9
|
import { withMemo } from '@/helper/withMemo';
|
|
10
10
|
import classNames from 'classnames';
|
|
@@ -37,7 +37,7 @@ export const DialogBackground = withMemo(function DialogBackground({
|
|
|
37
37
|
// Render Functions
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
|
-
<
|
|
40
|
+
<BaseBlock __allowChildren="all" className={classNames(styles.dialogBackground, className)} style={style}>
|
|
41
41
|
{(!!title || !!onClose) && (
|
|
42
42
|
<Flex horizontal={true} className={styles.title}>
|
|
43
43
|
{!!title && (
|
|
@@ -47,12 +47,12 @@ export const DialogBackground = withMemo(function DialogBackground({
|
|
|
47
47
|
)}
|
|
48
48
|
{!!onClose && (
|
|
49
49
|
<Clickable onClick={onClose}>
|
|
50
|
-
<
|
|
50
|
+
<BaseIcon size="lg" icon={faCircleXmark} />
|
|
51
51
|
</Clickable>
|
|
52
52
|
)}
|
|
53
53
|
</Flex>
|
|
54
54
|
)}
|
|
55
55
|
{children}
|
|
56
|
-
</
|
|
56
|
+
</BaseBlock>
|
|
57
57
|
);
|
|
58
58
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseBlock } from '@/Components/Layout/BaseBlock';
|
|
3
3
|
import { Dialog } from '@/Components/Dialog/Dialog';
|
|
4
4
|
import { DialogProvider } from '@/Components/Dialog/DialogContext';
|
|
5
5
|
import { PromiseWithHandlers } from '@ainias42/js-helper';
|
|
@@ -80,7 +80,7 @@ export const DialogContainer = withMemo(function DialogContainer({
|
|
|
80
80
|
return (
|
|
81
81
|
<DialogProvider value={showDialog}>
|
|
82
82
|
{children}
|
|
83
|
-
<
|
|
83
|
+
<BaseBlock className={dialogClassName}>
|
|
84
84
|
{dialogs.map((d) => {
|
|
85
85
|
const DialogComponent = d.component;
|
|
86
86
|
return (
|
|
@@ -89,7 +89,7 @@ export const DialogContainer = withMemo(function DialogContainer({
|
|
|
89
89
|
</Dialog>
|
|
90
90
|
);
|
|
91
91
|
})}
|
|
92
|
-
</
|
|
92
|
+
</BaseBlock>
|
|
93
93
|
</DialogProvider>
|
|
94
94
|
);
|
|
95
95
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseBlock } from '@/Components/Layout/BaseBlock';
|
|
2
2
|
import { Heading } from '@/Components/Text/Heading';
|
|
3
3
|
import { Text } from '@/Components/Text/Text';
|
|
4
4
|
import React, { Component } from 'react';
|
|
@@ -35,10 +35,10 @@ export class ErrorBoundary extends Component<ErrorBoundaryProps, State> {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
<
|
|
38
|
+
<BaseBlock>
|
|
39
39
|
<Heading>{message}</Heading>
|
|
40
40
|
{!!stack && showStack && <Text style={{ whiteSpace: 'pre' }}>{stack}</Text>}
|
|
41
|
-
</
|
|
41
|
+
</BaseBlock>
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
return children;
|
|
@@ -4,7 +4,7 @@ import { Flavor } from '@/Components/Flavor';
|
|
|
4
4
|
import { Size } from '@/Size';
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
6
|
import { useListenerWithExtractedProps } from '@/Components/Hooks/useListener';
|
|
7
|
-
import {
|
|
7
|
+
import { withTitle } from '@/Components/Title/withTitle';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import styles from '@/Components/FormElements/Button/button.module.scss';
|
|
10
10
|
import type { HTMLAttributes, MouseEvent } from 'react';
|
|
@@ -26,7 +26,7 @@ export type ButtonProps<ClickData> = RbmComponentProps<
|
|
|
26
26
|
>
|
|
27
27
|
>;
|
|
28
28
|
|
|
29
|
-
export const Button =
|
|
29
|
+
export const Button = withTitle(function Button<ClickData>({
|
|
30
30
|
children,
|
|
31
31
|
className,
|
|
32
32
|
disabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BaseBlock } from '@/Components/Layout/BaseBlock';
|
|
2
|
+
import { BaseInlineBlock } from '@/Components/Layout/BaseInlineBlock';
|
|
3
3
|
import { TEXT_SIZE, Text } from '@/Components/Text/Text';
|
|
4
4
|
import { withMemo } from '@/helper/withMemo';
|
|
5
5
|
import React from 'react';
|
|
@@ -28,15 +28,15 @@ export const FormError = withMemo(function FormError({ error, inline }: FormErro
|
|
|
28
28
|
|
|
29
29
|
if (inline) {
|
|
30
30
|
return (
|
|
31
|
-
<
|
|
31
|
+
<BaseInlineBlock className={styles.error}>
|
|
32
32
|
<Text size={TEXT_SIZE.small}>{error}</Text>
|
|
33
|
-
</
|
|
33
|
+
</BaseInlineBlock>
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
<
|
|
38
|
+
<BaseBlock className={styles.error}>
|
|
39
39
|
<Text size={TEXT_SIZE.small}>{error}</Text>
|
|
40
|
-
</
|
|
40
|
+
</BaseBlock>
|
|
41
41
|
);
|
|
42
42
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseBlock } from '@/Components/Layout/BaseBlock';
|
|
3
|
+
import { BaseIcon } from '@/Components/Icon/BaseIcon';
|
|
3
4
|
import { Clickable } from '@/Components/Clickable/Clickable';
|
|
4
5
|
import { Flex } from '@/Components/Layout/Flex';
|
|
5
6
|
import { FormError } from '@/Components/FormElements/Error/FormError';
|
|
6
7
|
import { Grow } from '@/Components/Layout/Grow';
|
|
7
|
-
import { Icon } from '@/Components/Icon/Icon';
|
|
8
8
|
import { Image } from '@/Components/Image/Image';
|
|
9
9
|
import { Inline } from '@/Components/Layout/Inline';
|
|
10
10
|
import { Text } from '@/Components/Text/Text';
|
|
@@ -211,10 +211,10 @@ export const MultipleFileInput = withMemo(function MultipleImageInput<OnChangeDa
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
return (
|
|
214
|
-
<
|
|
215
|
-
<
|
|
214
|
+
<BaseBlock className={styles.previewText}>
|
|
215
|
+
<BaseIcon icon={faFile} className={styles.previewTextIcon} />
|
|
216
216
|
<Text>{file.name}</Text>
|
|
217
|
-
</
|
|
217
|
+
</BaseBlock>
|
|
218
218
|
);
|
|
219
219
|
};
|
|
220
220
|
|
|
@@ -256,7 +256,7 @@ export const MultipleFileInput = withMemo(function MultipleImageInput<OnChangeDa
|
|
|
256
256
|
onClick={removeFile}
|
|
257
257
|
onClickData={index}
|
|
258
258
|
>
|
|
259
|
-
<
|
|
259
|
+
<BaseIcon icon={faTimesCircle} />
|
|
260
260
|
</Clickable>
|
|
261
261
|
)}
|
|
262
262
|
</Clickable>
|
|
@@ -275,7 +275,7 @@ export const MultipleFileInput = withMemo(function MultipleImageInput<OnChangeDa
|
|
|
275
275
|
onClick={clickOnFile}
|
|
276
276
|
__allowChildren="html"
|
|
277
277
|
>
|
|
278
|
-
<
|
|
278
|
+
<BaseIcon icon={faPlus} />
|
|
279
279
|
<input
|
|
280
280
|
{...props}
|
|
281
281
|
ref={inputRef}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { BaseIcon } from '@/Components/Icon/BaseIcon';
|
|
1
2
|
import { Clickable } from '@/Components/Clickable/Clickable';
|
|
2
3
|
import { Flex } from '@/Components/Layout/Flex';
|
|
3
4
|
import { Grow } from '@/Components/Layout/Grow';
|
|
4
|
-
import { Icon } from '@/Components/Icon/Icon';
|
|
5
5
|
import { Input } from '@/Components/FormElements/Input/Input';
|
|
6
6
|
import { faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
|
|
7
7
|
import { withMemo } from '@/helper/withMemo';
|
|
@@ -50,7 +50,7 @@ export const PasswordInput = withMemo(function PasswordInput<OnChangeData, OnBlu
|
|
|
50
50
|
<Input {...props} type={isVisible ? 'text' : 'password'} ref={ref} />
|
|
51
51
|
</Grow>
|
|
52
52
|
<Clickable onClick={toggleVisible} className={styles.showButton} interactable={false}>
|
|
53
|
-
<
|
|
53
|
+
<BaseIcon icon={isVisible ? faEye : faEyeSlash} />
|
|
54
54
|
</Clickable>
|
|
55
55
|
</Flex>
|
|
56
56
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ArrayHelper } from '@ainias42/js-helper';
|
|
3
|
-
import {
|
|
3
|
+
import { BaseBlock } from '@/Components/Layout/BaseBlock';
|
|
4
|
+
import { BaseInlineBlock } from '@/Components/Layout/BaseInlineBlock';
|
|
4
5
|
import { Clickable } from '@/Components/Clickable/Clickable';
|
|
5
6
|
import { Flex } from '@/Components/Layout/Flex';
|
|
6
7
|
import { Grow } from '@/Components/Layout/Grow';
|
|
7
|
-
import { InlineBlock } from '@/Components/Layout/InlineBlock';
|
|
8
8
|
import { TEXT_SIZE, Text } from '@/Components/Text/Text';
|
|
9
9
|
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
10
10
|
import { useWindow } from '@/WindowContext/WindowContext';
|
|
@@ -159,9 +159,9 @@ export const SearchSelectInput = withMemo(function SearchSelectInput<OnChangeDat
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
const element = renderSelectedOption?.(option) ?? (
|
|
162
|
-
<
|
|
162
|
+
<BaseInlineBlock className={styles.tag}>
|
|
163
163
|
<Text size={TEXT_SIZE.xSmall}>{indexedOptions[value]?.label}</Text>
|
|
164
|
-
</
|
|
164
|
+
</BaseInlineBlock>
|
|
165
165
|
);
|
|
166
166
|
|
|
167
167
|
const onClickProps = allowDeselect ? { onClick: toggleOption, onClickData: value } : {};
|
|
@@ -175,9 +175,9 @@ export const SearchSelectInput = withMemo(function SearchSelectInput<OnChangeDat
|
|
|
175
175
|
const renderSelectableOption = (opt: SelectOption, index: number) => {
|
|
176
176
|
const isActive = index === selectedIndex;
|
|
177
177
|
const element = renderSelectableOptions?.(opt, isActive, index, selectedIndex) ?? (
|
|
178
|
-
<
|
|
178
|
+
<BaseBlock className={classNames(styles.selectableOption, { [styles.active]: index === selectedIndex })}>
|
|
179
179
|
<Text>{opt.label}</Text>
|
|
180
|
-
</
|
|
180
|
+
</BaseBlock>
|
|
181
181
|
);
|
|
182
182
|
|
|
183
183
|
return (
|
|
@@ -192,7 +192,7 @@ export const SearchSelectInput = withMemo(function SearchSelectInput<OnChangeDat
|
|
|
192
192
|
<label className={classNames(styles.input, className)} style={style} ref={containerRef}>
|
|
193
193
|
{label ? <span className={styles.label}>{label}</span> : null}
|
|
194
194
|
<Flex className={styles.inputContainer} horizontal={true}>
|
|
195
|
-
<
|
|
195
|
+
<BaseInlineBlock>{values.map(renderOption)}</BaseInlineBlock>
|
|
196
196
|
<Grow __allowChildren="html">
|
|
197
197
|
<input
|
|
198
198
|
ref={inputRef}
|
|
@@ -204,9 +204,9 @@ export const SearchSelectInput = withMemo(function SearchSelectInput<OnChangeDat
|
|
|
204
204
|
/>
|
|
205
205
|
</Grow>
|
|
206
206
|
</Flex>
|
|
207
|
-
<
|
|
207
|
+
<BaseInlineBlock className={styles.selectableOptionContainer} style={suggestionsPosition}>
|
|
208
208
|
{selectableOptions.map(renderSelectableOption)}
|
|
209
|
-
</
|
|
209
|
+
</BaseInlineBlock>
|
|
210
210
|
</label>
|
|
211
211
|
);
|
|
212
212
|
});
|
|
@@ -13,7 +13,7 @@ export function useDelayed<Args extends any[]>(
|
|
|
13
13
|
|
|
14
14
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15
15
|
const realCB = useCallback(callback, dependencies);
|
|
16
|
-
|
|
16
|
+
return useCallback(
|
|
17
17
|
(...newArgs: Args) => {
|
|
18
18
|
argsRef.current = newArgs;
|
|
19
19
|
|
|
@@ -25,13 +25,16 @@ export function useDelayed<Args extends any[]>(
|
|
|
25
25
|
|
|
26
26
|
if (argsRef.current !== undefined) {
|
|
27
27
|
realCB(...argsRef.current);
|
|
28
|
+
argsRef.current = undefined;
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
if (timeoutRef.current) {
|
|
32
33
|
clearTimeout(timeoutRef.current);
|
|
33
34
|
}
|
|
34
|
-
timeoutRef.current = setTimeout(
|
|
35
|
+
timeoutRef.current = setTimeout(() => {
|
|
36
|
+
triggerFunc();
|
|
37
|
+
}, delay);
|
|
35
38
|
|
|
36
39
|
if (maxDelay && maxDelayTimeout.current === undefined) {
|
|
37
40
|
maxDelayTimeout.current = setTimeout(() => {
|
|
@@ -41,6 +44,4 @@ export function useDelayed<Args extends any[]>(
|
|
|
41
44
|
},
|
|
42
45
|
[delay, maxDelay, realCB],
|
|
43
46
|
);
|
|
44
|
-
|
|
45
|
-
return func;
|
|
46
47
|
}
|
|
@@ -8,6 +8,7 @@ import type { IconDefinition } from '@fortawesome/free-regular-svg-icons';
|
|
|
8
8
|
import type { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
9
9
|
import type { Override } from '@/TypeHelpers';
|
|
10
10
|
import type { RbmComponentProps } from '@/Components/RbmComponentProps';
|
|
11
|
+
import type { Ref } from 'react';
|
|
11
12
|
|
|
12
13
|
export type IconSource = IconProp | string | IconDefinition;
|
|
13
14
|
|
|
@@ -18,17 +19,18 @@ export type IconProps = RbmComponentProps<
|
|
|
18
19
|
noMargin?: boolean;
|
|
19
20
|
icon: IconSource;
|
|
20
21
|
alt?: string;
|
|
22
|
+
ref?: Ref<HTMLImageElement | null>;
|
|
21
23
|
}
|
|
22
24
|
>
|
|
23
25
|
>;
|
|
24
26
|
|
|
25
|
-
export const
|
|
27
|
+
export const BaseIcon = withMemo(function BaseIcon({
|
|
26
28
|
icon,
|
|
27
29
|
alt,
|
|
28
30
|
className,
|
|
29
31
|
noMargin = true,
|
|
30
32
|
style,
|
|
31
|
-
|
|
33
|
+
ref,
|
|
32
34
|
...props
|
|
33
35
|
}: IconProps) {
|
|
34
36
|
// Variables
|
|
@@ -55,7 +57,7 @@ export const Icon = withMemo(function Icon({
|
|
|
55
57
|
alt={alt}
|
|
56
58
|
className={classNames(styles.imgIcon, className, { [styles.margin]: !noMargin })}
|
|
57
59
|
style={style}
|
|
58
|
-
|
|
60
|
+
ref={ref}
|
|
59
61
|
/>
|
|
60
62
|
);
|
|
61
63
|
}
|
|
@@ -65,7 +67,7 @@ export const Icon = withMemo(function Icon({
|
|
|
65
67
|
icon={icon as IconProp}
|
|
66
68
|
className={classNames(className, { [styles.margin]: !noMargin })}
|
|
67
69
|
style={style}
|
|
68
|
-
|
|
70
|
+
ref={ref as Ref<SVGSVGElement>}
|
|
69
71
|
/>
|
|
70
72
|
);
|
|
71
73
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BaseIcon } from '@/Components/Icon/BaseIcon';
|
|
2
|
+
import { BaseInlineBlock } from '@/Components/Layout/BaseInlineBlock';
|
|
3
3
|
import { withMemo } from '@/helper/withMemo';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import styles from '@/Components/Icon/icon.module.scss';
|
|
6
|
-
import type { IconProps, IconSource } from '@/Components/Icon/
|
|
6
|
+
import type { IconProps, IconSource } from '@/Components/Icon/BaseIcon';
|
|
7
7
|
|
|
8
8
|
export type DoubleIconProps = IconProps & {
|
|
9
9
|
secondIcon: IconSource;
|
|
@@ -31,9 +31,9 @@ export const DoubleIcon = withMemo(function DoubleIcon({
|
|
|
31
31
|
// RenderFunctions
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
<
|
|
37
|
-
</
|
|
34
|
+
<BaseInlineBlock className={styles.doubleIconContainer}>
|
|
35
|
+
<BaseIcon {...otherProps} color={color} />
|
|
36
|
+
<BaseIcon icon={secondIcon} size="xs" className={styles.secondIcon} color={secondIconColor ?? color} />
|
|
37
|
+
</BaseInlineBlock>
|
|
38
38
|
);
|
|
39
39
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { BaseIcon } from '@/Components/Icon/BaseIcon';
|
|
4
4
|
import { faHouse, faUser } from '@fortawesome/free-solid-svg-icons';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
component:
|
|
7
|
+
component: BaseIcon,
|
|
8
8
|
argTypes: {
|
|
9
9
|
icon: {
|
|
10
10
|
options: ['house', 'user'],
|
|
@@ -14,7 +14,7 @@ const meta = {
|
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
-
} satisfies Meta<typeof
|
|
17
|
+
} satisfies Meta<typeof BaseIcon>;
|
|
18
18
|
|
|
19
19
|
export default meta;
|
|
20
20
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { JSX } from 'react/jsx-runtime';
|
|
3
3
|
import { ViewWithoutListeners } from '@/Components/Layout/ViewWithoutListeners';
|
|
4
|
-
import { withMemo } from '@/helper/withMemo';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
import styles from '@/Components/Layout/layout.module.scss';
|
|
7
6
|
import type { ComponentRef, ForwardedRef } from 'react';
|
|
8
7
|
import type { RbmComponentProps } from '@/Components/RbmComponentProps';
|
|
9
8
|
import type { ViewWithoutListenersProps } from '@/Components/Layout/ViewWithoutListeners';
|
|
10
|
-
|
|
11
9
|
import IntrinsicElements = JSX.IntrinsicElements;
|
|
10
|
+
import { withMemo } from '@/helper/withMemo';
|
|
12
11
|
|
|
13
12
|
export type BlockProps<AsType extends keyof IntrinsicElements> = RbmComponentProps<
|
|
14
13
|
ViewWithoutListenersProps<AsType> & {
|
|
@@ -16,7 +15,7 @@ export type BlockProps<AsType extends keyof IntrinsicElements> = RbmComponentPro
|
|
|
16
15
|
}
|
|
17
16
|
>;
|
|
18
17
|
|
|
19
|
-
export const
|
|
18
|
+
export const BaseBlock = withMemo(function Block<AsType extends keyof JSX.IntrinsicElements = 'div'>({
|
|
20
19
|
children,
|
|
21
20
|
as = 'div' as AsType,
|
|
22
21
|
className,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { JSX } from 'react/jsx-runtime';
|
|
3
3
|
import { ViewWithoutListeners } from '@/Components/Layout/ViewWithoutListeners';
|
|
4
|
-
import { withMemo } from '@/helper/withMemo';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
import styles from '@/Components/Layout/layout.module.scss';
|
|
7
6
|
import type { RbmComponentProps } from '@/Components/RbmComponentProps';
|
|
8
7
|
import type { ViewWithoutListenersProps } from '@/Components/Layout/ViewWithoutListeners';
|
|
9
8
|
|
|
10
9
|
import IntrinsicElements = JSX.IntrinsicElements;
|
|
10
|
+
import { withMemo } from '@/helper/withMemo';
|
|
11
11
|
|
|
12
12
|
export type InlineBlockProps<AsType extends keyof IntrinsicElements> = RbmComponentProps<
|
|
13
13
|
ViewWithoutListenersProps<AsType> & {
|
|
@@ -16,7 +16,7 @@ export type InlineBlockProps<AsType extends keyof IntrinsicElements> = RbmCompon
|
|
|
16
16
|
}
|
|
17
17
|
>;
|
|
18
18
|
|
|
19
|
-
export const
|
|
19
|
+
export const BaseInlineBlock = withMemo(function BaseInlineBlock<AsType extends keyof JSX.IntrinsicElements = 'span'>({
|
|
20
20
|
children,
|
|
21
21
|
as = 'span' as AsType,
|
|
22
22
|
className,
|