@ainias42/react-bootstrap-mobile 1.0.6 → 1.0.7
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/.storybook/preview.ts +3 -1
- package/dist/Components/Flavor.d.ts +4 -4
- package/dist/Components/FlavorWithText.d.ts +19 -0
- package/dist/Components/Icon/BaseIcon.d.ts +4 -1
- package/dist/Components/Icon/DoubleIcon.d.ts +3 -2
- package/dist/Components/Icon/DoubleIcon.stories.d.ts +1 -1
- package/dist/Components/Icon/Icon.stories.d.ts +1 -1
- package/dist/Components/Image/Image.d.ts +1 -1
- package/dist/Components/Layout/Grow.d.ts +1 -1
- package/dist/Components/Menu/Menu.d.ts +2 -1
- package/dist/Components/Menu/MenuItem.d.ts +5 -3
- package/dist/Components/Menu/MenuItem.stories.d.ts +1 -1
- package/dist/Components/Menu/Submenu.d.ts +3 -2
- package/dist/Components/Menu/Submenu.stories.d.ts +1 -1
- package/dist/index.css +10 -10
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +48 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Components/ActionSheet/actionSheet.module.scss +3 -3
- package/src/Components/Card/card.module.scss +1 -0
- package/src/Components/Dialog/ButtonDialog.tsx +1 -1
- package/src/Components/Dialog/dialog.module.scss +1 -1
- package/src/Components/Flavor.ts +4 -4
- package/src/Components/FlavorWithText.ts +11 -0
- package/src/Components/FormElements/Button/Button.stories.tsx +4 -4
- package/src/Components/FormElements/Button/Button.tsx +1 -1
- package/src/Components/FormElements/ColorInput/colorInput.module.scss +2 -2
- package/src/Components/FormElements/SearchSelectInput/seachSelectInput.module.scss +1 -1
- package/src/Components/Icon/BaseIcon.tsx +7 -2
- package/src/Components/Icon/DoubleIcon.stories.tsx +3 -2
- package/src/Components/Icon/DoubleIcon.tsx +6 -5
- package/src/Components/Icon/Icon.stories.tsx +4 -2
- package/src/Components/Icon/icon.module.scss +6 -0
- package/src/Components/Image/Image.tsx +1 -1
- package/src/Components/Layout/Container.tsx +5 -5
- package/src/Components/Layout/Grid/grid.module.scss +8 -8
- package/src/Components/Layout/Grow.tsx +1 -1
- package/src/Components/Layout/container.module.scss +15 -14
- package/src/Components/Menu/Menu.stories.tsx +3 -2
- package/src/Components/Menu/Menu.tsx +7 -6
- package/src/Components/Menu/MenuItem.tsx +7 -4
- package/src/Components/Menu/Submenu.tsx +4 -3
- package/src/Components/Text/text.module.scss +1 -0
- package/src/Components/Title/Title.stories.tsx +3 -2
- package/src/Components/Toast/toast.module.scss +1 -1
- package/src/Components/TopBar/topBar.module.scss +1 -1
- package/src/index.ts +1 -0
- package/src/scss/_colors.scss +33 -0
- package/src/scss/_default.scss +1 -0
- package/src/scss/_firstUpper.scss +5 -0
- package/src/scss/_flavorMixin.scss +24 -4
- package/src/scss/_variables.scss +2 -2
- package/src/scss/breakpoints.scss +19 -18
- package/tsconfig.json +1 -0
package/package.json
CHANGED
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
transition-delay: 0s;
|
|
32
32
|
top: 0;
|
|
33
33
|
|
|
34
|
-
> :global(.
|
|
34
|
+
> :global(.fullHeight) {;
|
|
35
35
|
top: 0
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
> :global(.
|
|
39
|
+
> :global(.fullHeight) {
|
|
40
40
|
position: absolute;
|
|
41
41
|
inset: 100% 0 0;
|
|
42
42
|
}
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
@include mixin.design(variables.$material) {
|
|
93
|
-
> .
|
|
93
|
+
> .fullHeight {
|
|
94
94
|
padding: 0;
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -53,7 +53,7 @@ function ButtonDialog({ title, message, buttons, style, className, extraContent
|
|
|
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
|
-
<Text className={classNames(styles.buttonText, b.flavor ?? Flavor.
|
|
56
|
+
<Text className={classNames(styles.buttonText, b.flavor ?? Flavor.ACCENT)}>{b.text}</Text>
|
|
57
57
|
</Clickable>
|
|
58
58
|
))}
|
|
59
59
|
</BaseBlock>
|
package/src/Components/Flavor.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export enum Flavor {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
ACCENT = 'flavorAccent',
|
|
3
|
+
BASIC = 'flavorBasic',
|
|
4
|
+
DESTRUCTIVE = 'flavorDestructive',
|
|
5
|
+
CONSTRUCTIVE = 'flavorConstructive',
|
|
6
6
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Flavor } from "./Flavor";
|
|
2
|
+
|
|
3
|
+
enum TextValues {
|
|
4
|
+
PRIMARY = "textPrimary",
|
|
5
|
+
SECONDARY = "textSecondary",
|
|
6
|
+
TERTIARY = "textTertiary",
|
|
7
|
+
INVERSE = "textInverse"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type FlavorWithText = TextValues | Flavor
|
|
11
|
+
export const FlavorWithText = {...TextValues, ...Flavor}
|
|
@@ -44,7 +44,7 @@ type Story = StoryObj<ButtonProps<any>>;
|
|
|
44
44
|
export const Default: Story = {
|
|
45
45
|
args: {
|
|
46
46
|
fullWidth: false,
|
|
47
|
-
flavor: Flavor.
|
|
47
|
+
flavor: Flavor.BASIC,
|
|
48
48
|
type: ButtonType.Primary,
|
|
49
49
|
stopPropagation: false,
|
|
50
50
|
size: undefined,
|
|
@@ -54,7 +54,7 @@ export const Default: Story = {
|
|
|
54
54
|
export const Accent: Story = {
|
|
55
55
|
args: {
|
|
56
56
|
fullWidth: false,
|
|
57
|
-
flavor: Flavor.
|
|
57
|
+
flavor: Flavor.ACCENT,
|
|
58
58
|
type: ButtonType.Primary,
|
|
59
59
|
stopPropagation: false,
|
|
60
60
|
},
|
|
@@ -63,7 +63,7 @@ export const Accent: Story = {
|
|
|
63
63
|
export const Destructive: Story = {
|
|
64
64
|
args: {
|
|
65
65
|
fullWidth: false,
|
|
66
|
-
flavor: Flavor.
|
|
66
|
+
flavor: Flavor.DESTRUCTIVE,
|
|
67
67
|
type: ButtonType.Primary,
|
|
68
68
|
stopPropagation: false,
|
|
69
69
|
},
|
|
@@ -72,7 +72,7 @@ export const Destructive: Story = {
|
|
|
72
72
|
export const Constructive: Story = {
|
|
73
73
|
args: {
|
|
74
74
|
fullWidth: false,
|
|
75
|
-
flavor: Flavor.
|
|
75
|
+
flavor: Flavor.CONSTRUCTIVE,
|
|
76
76
|
type: ButtonType.Primary,
|
|
77
77
|
stopPropagation: false,
|
|
78
78
|
},
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
width: 1rem;
|
|
15
15
|
height: 1rem;
|
|
16
16
|
display: inline-block;
|
|
17
|
-
border: 1px solid
|
|
17
|
+
border: 1px solid var(--border-strong);
|
|
18
18
|
position: relative;
|
|
19
19
|
|
|
20
20
|
&::before {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
/* stylelint-disable-next-line selector-class-pattern */
|
|
53
53
|
:global(.w-color-swatch) {
|
|
54
54
|
z-index: 0;
|
|
55
55
|
|
|
@@ -9,6 +9,8 @@ import type { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
|
9
9
|
import type { Override } from '../../TypeHelpers';
|
|
10
10
|
import type { RbmComponentProps } from '../RbmComponentProps';
|
|
11
11
|
import type { Ref } from 'react';
|
|
12
|
+
import { Flavor } from '../Flavor';
|
|
13
|
+
import { FlavorWithText } from '../FlavorWithText';
|
|
12
14
|
|
|
13
15
|
export type IconSource = IconProp | string | IconDefinition;
|
|
14
16
|
|
|
@@ -20,6 +22,8 @@ export type IconProps = RbmComponentProps<
|
|
|
20
22
|
icon: IconSource;
|
|
21
23
|
alt?: string;
|
|
22
24
|
ref?: Ref<HTMLImageElement | null>;
|
|
25
|
+
flavor?: FlavorWithText;
|
|
26
|
+
color?: undefined
|
|
23
27
|
}
|
|
24
28
|
>
|
|
25
29
|
>;
|
|
@@ -31,6 +35,7 @@ export const BaseIcon = withMemo(function BaseIcon({
|
|
|
31
35
|
noMargin = true,
|
|
32
36
|
style,
|
|
33
37
|
ref,
|
|
38
|
+
flavor = FlavorWithText.PRIMARY,
|
|
34
39
|
...props
|
|
35
40
|
}: IconProps) {
|
|
36
41
|
// Variables
|
|
@@ -55,7 +60,7 @@ export const BaseIcon = withMemo(function BaseIcon({
|
|
|
55
60
|
<img
|
|
56
61
|
src={icon}
|
|
57
62
|
alt={alt}
|
|
58
|
-
className={classNames(styles.imgIcon, className, { [styles.margin]: !noMargin })}
|
|
63
|
+
className={classNames(styles.imgIcon, flavor, className, { [styles.margin]: !noMargin })}
|
|
59
64
|
style={style}
|
|
60
65
|
ref={ref}
|
|
61
66
|
/>
|
|
@@ -65,7 +70,7 @@ export const BaseIcon = withMemo(function BaseIcon({
|
|
|
65
70
|
<FontAwesomeIcon
|
|
66
71
|
{...props}
|
|
67
72
|
icon={icon as IconProp}
|
|
68
|
-
className={classNames(className, { [styles.margin]: !noMargin })}
|
|
73
|
+
className={classNames(styles.icon, flavor, className, { [styles.margin]: !noMargin })}
|
|
69
74
|
style={style}
|
|
70
75
|
ref={ref as Ref<SVGSVGElement>}
|
|
71
76
|
/>
|
|
@@ -2,6 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
|
|
3
3
|
import { DoubleIcon } from './DoubleIcon';
|
|
4
4
|
import { faHouse, faUser } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { FlavorWithText } from '../FlavorWithText';
|
|
5
6
|
|
|
6
7
|
const meta = {
|
|
7
8
|
component: DoubleIcon,
|
|
@@ -32,7 +33,7 @@ export const Default: Story = {
|
|
|
32
33
|
icon: faHouse,
|
|
33
34
|
secondIcon: faUser,
|
|
34
35
|
noMargin: false,
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
flavor: FlavorWithText.PRIMARY,
|
|
37
|
+
secondIconFlavor: FlavorWithText.SECONDARY,
|
|
37
38
|
},
|
|
38
39
|
};
|
|
@@ -4,16 +4,17 @@ import { withMemo } from '../../helper/withMemo';
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import styles from './icon.module.scss';
|
|
6
6
|
import type { IconProps, IconSource } from './BaseIcon';
|
|
7
|
+
import { FlavorWithText } from '../FlavorWithText';
|
|
7
8
|
|
|
8
9
|
export type DoubleIconProps = IconProps & {
|
|
9
10
|
secondIcon: IconSource;
|
|
10
|
-
|
|
11
|
+
secondIconFlavor?: FlavorWithText;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
export const DoubleIcon = withMemo(function DoubleIcon({
|
|
14
15
|
secondIcon,
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
secondIconFlavor,
|
|
17
|
+
flavor,
|
|
17
18
|
...otherProps
|
|
18
19
|
}: DoubleIconProps) {
|
|
19
20
|
// Refs
|
|
@@ -32,8 +33,8 @@ export const DoubleIcon = withMemo(function DoubleIcon({
|
|
|
32
33
|
|
|
33
34
|
return (
|
|
34
35
|
<BaseInlineBlock className={styles.doubleIconContainer}>
|
|
35
|
-
<BaseIcon {...otherProps}
|
|
36
|
-
<BaseIcon icon={secondIcon} size="xs" className={styles.secondIcon}
|
|
36
|
+
<BaseIcon {...otherProps} flavor={flavor} />
|
|
37
|
+
<BaseIcon icon={secondIcon} size="xs" className={styles.secondIcon} flavor={secondIconFlavor ?? flavor} />
|
|
37
38
|
</BaseInlineBlock>
|
|
38
39
|
);
|
|
39
40
|
});
|
|
@@ -2,6 +2,8 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
|
|
3
3
|
import { BaseIcon } from './BaseIcon';
|
|
4
4
|
import { faHouse, faUser } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { FlavorWithText } from '../FlavorWithText';
|
|
6
|
+
import { DoubleIcon } from './DoubleIcon';
|
|
5
7
|
|
|
6
8
|
const meta = {
|
|
7
9
|
component: BaseIcon,
|
|
@@ -24,7 +26,7 @@ export const Default: Story = {
|
|
|
24
26
|
args: {
|
|
25
27
|
icon: faHouse,
|
|
26
28
|
noMargin: false,
|
|
27
|
-
|
|
29
|
+
flavor: FlavorWithText.PRIMARY,
|
|
28
30
|
},
|
|
29
31
|
};
|
|
30
32
|
|
|
@@ -32,6 +34,6 @@ export const ImageIcon: Story = {
|
|
|
32
34
|
args: {
|
|
33
35
|
icon: 'https://church.tools/wp-content/uploads/2025/07/Favicon_CT-150x150.png',
|
|
34
36
|
noMargin: false,
|
|
35
|
-
|
|
37
|
+
flavor: FlavorWithText.PRIMARY,
|
|
36
38
|
},
|
|
37
39
|
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
@use "../../scss/flavorMixin" as *;
|
|
2
|
+
|
|
1
3
|
.margin {
|
|
2
4
|
margin-left: 0.3rem;
|
|
3
5
|
margin-right: 0.3rem;
|
|
4
6
|
}
|
|
5
7
|
|
|
8
|
+
.icon {
|
|
9
|
+
@include flavorWithTextSelection(--text-primary-default-color);
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
.imgIcon {
|
|
7
13
|
width: calc(1em + 4px);
|
|
8
14
|
height: calc(1em + 4px);
|
|
@@ -5,11 +5,11 @@ import styles from './container.module.scss';
|
|
|
5
5
|
import type { RbmComponentProps } from '../RbmComponentProps';
|
|
6
6
|
|
|
7
7
|
export const CONTAINER_CLASSES = {
|
|
8
|
-
sm: styles
|
|
9
|
-
md: styles
|
|
10
|
-
lg: styles
|
|
11
|
-
xl: styles
|
|
12
|
-
xxl: styles
|
|
8
|
+
sm: styles.containerSm,
|
|
9
|
+
md: styles.containerMd,
|
|
10
|
+
lg: styles.containerLg,
|
|
11
|
+
xl: styles.containerXl,
|
|
12
|
+
xxl: styles.containerXxl,
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export type ContainerProps = RbmComponentProps<{
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
@use "../../../scss/breakpoints" as *;
|
|
5
5
|
|
|
6
6
|
$columns: 12;
|
|
7
|
-
$breakpoints: $
|
|
8
|
-
$containerBreakpoints: $
|
|
7
|
+
$breakpoints: $gridBreakpoints;
|
|
8
|
+
$containerBreakpoints: $gridBreakpoints;
|
|
9
9
|
|
|
10
10
|
@mixin printClasses {
|
|
11
11
|
@media print {
|
|
@@ -66,7 +66,7 @@ $containerBreakpoints: $grid-breakpoints;
|
|
|
66
66
|
container-type: inline-size;
|
|
67
67
|
|
|
68
68
|
@each $breakpoint in map.keys($containerBreakpoints) {
|
|
69
|
-
$min:
|
|
69
|
+
$min: breakpointMin($breakpoint, $containerBreakpoints);
|
|
70
70
|
|
|
71
71
|
@if $min {
|
|
72
72
|
@container (min-width: #{$min}) {
|
|
@@ -77,9 +77,9 @@ $containerBreakpoints: $grid-breakpoints;
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// Add classes for reordering
|
|
80
|
-
$min:
|
|
81
|
-
$next:
|
|
82
|
-
$max:
|
|
80
|
+
$min: breakpointMin($breakpoint, $containerBreakpoints);
|
|
81
|
+
$next: breakpointNext($breakpoint, $containerBreakpoints);
|
|
82
|
+
$max: breakpointMax($next, $containerBreakpoints);
|
|
83
83
|
|
|
84
84
|
@if $min != null and $max != null {
|
|
85
85
|
@container (min-width: #{$min}) and (max-width: #{$max}) {
|
|
@@ -101,7 +101,7 @@ $containerBreakpoints: $grid-breakpoints;
|
|
|
101
101
|
|
|
102
102
|
&:not(.useContainerWidth) {
|
|
103
103
|
@each $breakpoint in map.keys($breakpoints) {
|
|
104
|
-
@include
|
|
104
|
+
@include mediaBreakpointUp($breakpoint, $breakpoints) {
|
|
105
105
|
@for $i from 1 through $columns {
|
|
106
106
|
> .item-#{$breakpoint}-#{$i} {
|
|
107
107
|
grid-column: auto / span $i;
|
|
@@ -118,7 +118,7 @@ $containerBreakpoints: $grid-breakpoints;
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
// Add classes for reordering
|
|
121
|
-
@include
|
|
121
|
+
@include mediaBreakpointOnly($breakpoint, $breakpoints) {
|
|
122
122
|
@for $i from -10 through 10 {
|
|
123
123
|
> .order-#{$breakpoint}-#{$i} {
|
|
124
124
|
order: $i;
|
|
@@ -8,7 +8,7 @@ import type { RbmComponentProps } from '../RbmComponentProps';
|
|
|
8
8
|
export type GrowProps = RbmComponentProps<{
|
|
9
9
|
center?: boolean;
|
|
10
10
|
weight?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
11
|
-
ref?: ForwardedRef<HTMLDivElement>;
|
|
11
|
+
ref?: ForwardedRef<HTMLDivElement | null>;
|
|
12
12
|
id?: string;
|
|
13
13
|
}>;
|
|
14
14
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
@use "sass:map";
|
|
2
|
+
@use "../../scss/firstUpper" as *;
|
|
2
3
|
@use "../../scss/variables" as *;
|
|
3
4
|
@use "../../scss/breakpoints" as *;
|
|
4
5
|
|
|
5
|
-
@mixin
|
|
6
|
+
@mixin makeContainer() {
|
|
6
7
|
--gutter-x: 1.5rem;
|
|
7
8
|
--gutter-y: 0;
|
|
8
9
|
|
|
@@ -14,33 +15,33 @@
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
.container,
|
|
17
|
-
.
|
|
18
|
-
@include
|
|
18
|
+
.containerFluid {
|
|
19
|
+
@include makeContainer;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
// Responsive containers that are 100% wide until a breakpoint
|
|
22
|
-
@each $breakpoint, $
|
|
23
|
-
.container
|
|
24
|
-
@include
|
|
23
|
+
@each $breakpoint, $containerMaxWidth in $containerMaxWidths {
|
|
24
|
+
.container#{firstUpper($breakpoint)} {
|
|
25
|
+
@include makeContainer;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
@include
|
|
28
|
+
@include mediaBreakpointUp($breakpoint, $gridBreakpoints) {
|
|
28
29
|
%responsive-container-#{$breakpoint} {
|
|
29
|
-
max-width: $
|
|
30
|
+
max-width: $containerMaxWidth;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
// Extend each breakpoint which is smaller or equal to the current breakpoint
|
|
33
|
-
$
|
|
34
|
+
$extendBreakpoint: true;
|
|
34
35
|
|
|
35
|
-
@each $name, $width in $
|
|
36
|
-
@if $
|
|
37
|
-
.container#{
|
|
36
|
+
@each $name, $width in $gridBreakpoints {
|
|
37
|
+
@if $extendBreakpoint {
|
|
38
|
+
.container#{breakpointInfix($name, $gridBreakpoints)} {
|
|
38
39
|
@extend %responsive-container-#{$breakpoint};
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
// Once the current breakpoint is reached, stop extending
|
|
42
43
|
@if $breakpoint == $name {
|
|
43
|
-
$
|
|
44
|
+
$extendBreakpoint: false;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
@media (width >= 1400px) {
|
|
51
|
-
.
|
|
52
|
+
.containerXxl {
|
|
52
53
|
max-width: 1400px;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -8,6 +8,7 @@ import { faCog, faCogs, faHome, faUser } from '@fortawesome/free-solid-svg-icons
|
|
|
8
8
|
import { fn } from 'storybook/test';
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import type { MenuProps } from './Menu';
|
|
11
|
+
import { FlavorWithText } from '../FlavorWithText';
|
|
11
12
|
|
|
12
13
|
const meta = {
|
|
13
14
|
component: Menu,
|
|
@@ -57,10 +58,10 @@ export const Default: Story = {
|
|
|
57
58
|
Five
|
|
58
59
|
</MenuItem>
|
|
59
60
|
<MenuDivider />
|
|
60
|
-
<MenuItem
|
|
61
|
+
<MenuItem iconFlavor={FlavorWithText.CONSTRUCTIVE} onClick={fn()} icon={faUser}>
|
|
61
62
|
Six
|
|
62
63
|
</MenuItem>
|
|
63
|
-
<MenuItem
|
|
64
|
+
<MenuItem iconFlavor={FlavorWithText.CONSTRUCTIVE} onClick={fn()} icon={faCog} disabled={true}>
|
|
64
65
|
Seven
|
|
65
66
|
</MenuItem>
|
|
66
67
|
</>
|
|
@@ -12,10 +12,11 @@ import classNames from 'classnames';
|
|
|
12
12
|
import styles from './menu.module.scss';
|
|
13
13
|
import type { IconSource } from '../Icon/BaseIcon';
|
|
14
14
|
import type { RbmComponentProps } from '../RbmComponentProps';
|
|
15
|
+
import { FlavorWithText } from '../FlavorWithText';
|
|
15
16
|
|
|
16
17
|
export type MenuItemType = {
|
|
17
18
|
label: string;
|
|
18
|
-
icon?: IconSource | { icon: IconSource;
|
|
19
|
+
icon?: IconSource | { icon: IconSource; flavor: FlavorWithText };
|
|
19
20
|
key: string;
|
|
20
21
|
className?: string;
|
|
21
22
|
callback: () => void;
|
|
@@ -148,12 +149,12 @@ export const Menu = withMemo(
|
|
|
148
149
|
>
|
|
149
150
|
{items?.map((item) => {
|
|
150
151
|
const icon =
|
|
151
|
-
!!item.icon && typeof item.icon === 'object' && '
|
|
152
|
+
!!item.icon && typeof item.icon === 'object' && 'flavor' in item.icon
|
|
152
153
|
? item.icon.icon
|
|
153
154
|
: item.icon;
|
|
154
|
-
const
|
|
155
|
-
!!item.icon && typeof item.icon === 'object' && '
|
|
156
|
-
? item.icon.
|
|
155
|
+
const iconFlavor =
|
|
156
|
+
!!item.icon && typeof item.icon === 'object' && 'flavor' in item.icon
|
|
157
|
+
? item.icon.flavor
|
|
157
158
|
: undefined;
|
|
158
159
|
|
|
159
160
|
return (
|
|
@@ -163,7 +164,7 @@ export const Menu = withMemo(
|
|
|
163
164
|
className={classNames(styles.item, item.className)}
|
|
164
165
|
onMouseEnter={item.onMouseEnter}
|
|
165
166
|
icon={icon}
|
|
166
|
-
|
|
167
|
+
iconFlavor={iconFlavor}
|
|
167
168
|
onMouseLeave={item.onMouseLeave}
|
|
168
169
|
>
|
|
169
170
|
{item.label}
|
|
@@ -9,14 +9,16 @@ import classNames from 'classnames';
|
|
|
9
9
|
import styles from './menu.module.scss';
|
|
10
10
|
import type { IconSource } from '../Icon/BaseIcon';
|
|
11
11
|
import type { RbmComponentProps, WithChildren } from '../RbmComponentProps';
|
|
12
|
-
import type { ReactNode } from 'react';
|
|
12
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
13
13
|
|
|
14
14
|
import Element = React.JSX.Element;
|
|
15
|
+
import { FlavorWithText } from '../FlavorWithText';
|
|
15
16
|
|
|
16
17
|
export type MenuItemProps<Item = undefined> = RbmComponentProps<
|
|
17
18
|
{
|
|
18
19
|
icon?: IconSource;
|
|
19
|
-
|
|
20
|
+
iconFlavor?: FlavorWithText;
|
|
21
|
+
iconStyle?: CSSProperties;
|
|
20
22
|
className?: string;
|
|
21
23
|
children: string | ReactNode;
|
|
22
24
|
disabled?: boolean;
|
|
@@ -41,7 +43,8 @@ export type MenuItemProps<Item = undefined> = RbmComponentProps<
|
|
|
41
43
|
export const MenuItem = withMemo(function MenuItem<Item>({
|
|
42
44
|
children,
|
|
43
45
|
icon,
|
|
44
|
-
|
|
46
|
+
iconFlavor,
|
|
47
|
+
iconStyle,
|
|
45
48
|
className,
|
|
46
49
|
onClick,
|
|
47
50
|
onMouseEnter,
|
|
@@ -98,7 +101,7 @@ export const MenuItem = withMemo(function MenuItem<Item>({
|
|
|
98
101
|
__allowChildren="all"
|
|
99
102
|
>
|
|
100
103
|
<BaseBlock className={classNames(styles.itemChildren)}>
|
|
101
|
-
{!!icon && <BaseIcon icon={icon}
|
|
104
|
+
{!!icon && <BaseIcon icon={icon} flavor={iconFlavor} className={styles.icon} style={iconStyle as any} />}
|
|
102
105
|
{childElements}
|
|
103
106
|
</BaseBlock>
|
|
104
107
|
</Clickable>
|
|
@@ -13,12 +13,13 @@ import classNames from 'classnames';
|
|
|
13
13
|
import styles from './menu.module.scss';
|
|
14
14
|
import type { IconSource } from '../Icon/BaseIcon';
|
|
15
15
|
import type { RbmComponentProps, WithNoStringAndChildrenProps } from '../RbmComponentProps';
|
|
16
|
+
import { FlavorWithText } from '../FlavorWithText';
|
|
16
17
|
|
|
17
18
|
export type SubmenuProps = RbmComponentProps<
|
|
18
19
|
{
|
|
19
20
|
label: string;
|
|
20
21
|
icon?: IconSource;
|
|
21
|
-
|
|
22
|
+
iconFlavor?: FlavorWithText;
|
|
22
23
|
disabled?: boolean;
|
|
23
24
|
onMouseEnter?: () => void;
|
|
24
25
|
onMouseLeave?: () => void;
|
|
@@ -30,7 +31,7 @@ export const Submenu = withMemo(function Submenu({
|
|
|
30
31
|
children,
|
|
31
32
|
label,
|
|
32
33
|
icon,
|
|
33
|
-
|
|
34
|
+
iconFlavor,
|
|
34
35
|
className,
|
|
35
36
|
style,
|
|
36
37
|
disabled = false,
|
|
@@ -100,7 +101,7 @@ export const Submenu = withMemo(function Submenu({
|
|
|
100
101
|
style={style}
|
|
101
102
|
>
|
|
102
103
|
<Flex ref={submenuRef} className={classNames(styles.itemChildren)} horizontal={true}>
|
|
103
|
-
{!!icon && <BaseIcon icon={icon}
|
|
104
|
+
{!!icon && <BaseIcon icon={icon} flavor={iconFlavor} className={styles.icon} />}
|
|
104
105
|
<Grow>
|
|
105
106
|
<Text>{label}</Text>
|
|
106
107
|
</Grow>
|
|
@@ -10,6 +10,7 @@ import { fn } from 'storybook/test';
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import type { HoverMenuProps } from '../Menu/HoverMenu';
|
|
12
12
|
import type { StoryObj } from '@storybook/react-vite';
|
|
13
|
+
import { Flavor } from '../Flavor';
|
|
13
14
|
|
|
14
15
|
const meta = {
|
|
15
16
|
args: {
|
|
@@ -82,10 +83,10 @@ export const HoverMenuWithTitle: Story = {
|
|
|
82
83
|
Five
|
|
83
84
|
</MenuItem>
|
|
84
85
|
<MenuDivider />
|
|
85
|
-
<MenuItem
|
|
86
|
+
<MenuItem iconFlavor={Flavor.CONSTRUCTIVE} onClick={fn()} icon={faUser}>
|
|
86
87
|
Six
|
|
87
88
|
</MenuItem>
|
|
88
|
-
<MenuItem
|
|
89
|
+
<MenuItem iconFlavor={Flavor.CONSTRUCTIVE} onClick={fn()} icon={faCog} disabled={true}>
|
|
89
90
|
Seven
|
|
90
91
|
</MenuItem>
|
|
91
92
|
</>
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
justify-content: flex-start;
|
|
120
120
|
flex-direction: column;
|
|
121
121
|
z-index: var(--top-bar-hidden-buttons-z-index);
|
|
122
|
-
background-color:
|
|
122
|
+
background-color: var(--foreground-primary);
|
|
123
123
|
border: 1px solid var(--top-bar-hidden-buttons-border-color);
|
|
124
124
|
}
|
|
125
125
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './TypeHelpers';
|
|
|
4
4
|
export * from './WrongChildError';
|
|
5
5
|
export * from './Components/ErrorBoundary';
|
|
6
6
|
export * from './Components/Flavor';
|
|
7
|
+
export * from './Components/FlavorWithText';
|
|
7
8
|
export * from './Components/RbmComponentProps';
|
|
8
9
|
export * from './helper/Characters';
|
|
9
10
|
export * from './helper/DistributiveOmit';
|