@ainias42/react-bootstrap-mobile 0.2.9 → 0.2.11
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/bootstrapReactMobile.js +233 -214
- package/dist/bootstrapReactMobile.js.map +1 -1
- package/dist/src/Components/Dialog/DialogBackground.d.ts +2 -1
- package/dist/src/Components/FormElements/ColorInput/ColorInput.d.ts +2 -1
- package/dist/src/Components/FormElements/Select/Select.d.ts +12 -6
- package/package.json +8 -7
- package/src/Components/Dialog/DialogBackground.tsx +19 -7
- package/src/Components/FormElements/ColorInput/ColorInput.tsx +4 -1
- package/src/Components/FormElements/ColorInput/colorInput.scss +0 -2
- package/src/Components/FormElements/Select/Select.tsx +17 -6
- package/webpack.config.js +7 -0
|
@@ -2,5 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { RbmComponentProps } from '../RbmComponentProps';
|
|
3
3
|
export type DialogBackgroundProps = RbmComponentProps<{
|
|
4
4
|
title?: string;
|
|
5
|
+
onClose?: () => void;
|
|
5
6
|
}>;
|
|
6
|
-
export declare const DialogBackground: ({ children, className, style, title }: DialogBackgroundProps) => React.JSX.Element;
|
|
7
|
+
export declare const DialogBackground: ({ children, className, style, title, onClose }: DialogBackgroundProps) => React.JSX.Element;
|
|
@@ -13,7 +13,8 @@ export type ColorInputProps<OnChangeData> = {
|
|
|
13
13
|
sharedColorKey?: string;
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
error?: string;
|
|
16
|
+
className?: string;
|
|
16
17
|
} & OptionalListener<'onChange', OnChangeData>;
|
|
17
|
-
declare function ColorInput<OnChangeData>({ defaultValue, value, label, onChangeColor, onChangeColorComplete, onOpen, onClose, disableAlpha, presetColors, error, sharedColorKey, disabled, ...otherProps }: ColorInputProps<OnChangeData>): React.JSX.Element;
|
|
18
|
+
declare function ColorInput<OnChangeData>({ defaultValue, value, label, onChangeColor, onChangeColorComplete, onOpen, onClose, disableAlpha, presetColors, error, sharedColorKey, disabled, className, ...otherProps }: ColorInputProps<OnChangeData>): React.JSX.Element;
|
|
18
19
|
declare const ColorInputMemo: typeof ColorInput;
|
|
19
20
|
export { ColorInputMemo as ColorInput };
|
|
@@ -3,17 +3,23 @@ import { RbmComponentProps } from '../../RbmComponentProps';
|
|
|
3
3
|
import { Override } from '../../../TypeHelpers';
|
|
4
4
|
import { SelectHTMLAttributes } from 'react';
|
|
5
5
|
import { OptionalListener } from '../../Hooks/useListener';
|
|
6
|
-
export type SelectOption = {
|
|
6
|
+
export type SelectOption<ValueType = string> = {
|
|
7
7
|
label: string;
|
|
8
|
-
value:
|
|
8
|
+
value: ValueType;
|
|
9
9
|
key?: string;
|
|
10
10
|
};
|
|
11
11
|
export type SelectProps<OnChangeData> = RbmComponentProps<Override<SelectHTMLAttributes<HTMLSelectElement>, {
|
|
12
12
|
label?: string;
|
|
13
|
-
options: SelectOption[];
|
|
14
|
-
onChangeValue?: (newValue: string) => void;
|
|
15
13
|
inline?: boolean;
|
|
16
14
|
small?: boolean;
|
|
17
15
|
error?: string;
|
|
18
|
-
} &
|
|
19
|
-
|
|
16
|
+
} & ({
|
|
17
|
+
options: SelectOption[];
|
|
18
|
+
onChangeValue?: (newValue: string) => void;
|
|
19
|
+
useNumericValues?: false;
|
|
20
|
+
} | {
|
|
21
|
+
options: SelectOption<number>[];
|
|
22
|
+
onChangeValue?: (newValue: number) => void;
|
|
23
|
+
useNumericValues: true;
|
|
24
|
+
}) & OptionalListener<'onChange', OnChangeData>>>;
|
|
25
|
+
export declare const Select: <OnChangeData>({ label, options, className, style, onChangeValue, inline, small, error, useNumericValues, ...otherProps }: SelectProps<OnChangeData>) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ainias42/react-bootstrap-mobile",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "Mobile React Components using Bootstrap",
|
|
5
5
|
"main": "dist/bootstrapReactMobile",
|
|
6
6
|
"scripts": {
|
|
@@ -42,12 +42,6 @@
|
|
|
42
42
|
"react-hook-form": "^7.53.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"react-hook-form": "^7.53.0",
|
|
46
|
-
"ajv": "^8.14.0",
|
|
47
|
-
"bootstrap": "^5.3.3",
|
|
48
|
-
"react": ">=18.0.0",
|
|
49
|
-
"react-dom": ">=18.3.1",
|
|
50
|
-
"react-beautiful-dnd": "^13.1.1",
|
|
51
45
|
"@babel/core": "^7.24.6",
|
|
52
46
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
53
47
|
"@babel/plugin-transform-typescript": "^7.24.6",
|
|
@@ -67,7 +61,10 @@
|
|
|
67
61
|
"@types/react-window-infinite-loader": "^1.0.9",
|
|
68
62
|
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
|
69
63
|
"@typescript-eslint/parser": "^7.11.0",
|
|
64
|
+
"ajv": "^8.14.0",
|
|
70
65
|
"babel-loader": "^9.1.3",
|
|
66
|
+
"bootstrap": "^5.3.3",
|
|
67
|
+
"css-layering-webpack-plugin": "^0.3.0",
|
|
71
68
|
"css-loader": "^7.1.2",
|
|
72
69
|
"eslint": "^8.57.0",
|
|
73
70
|
"eslint-config-airbnb": "^19.0.4",
|
|
@@ -82,6 +79,10 @@
|
|
|
82
79
|
"loader-utils": "3.2.1",
|
|
83
80
|
"mini-css-extract-plugin": "^2.9.0",
|
|
84
81
|
"prettier": "^3.2.5",
|
|
82
|
+
"react": ">=18.0.0",
|
|
83
|
+
"react-beautiful-dnd": "^13.1.1",
|
|
84
|
+
"react-dom": ">=18.3.1",
|
|
85
|
+
"react-hook-form": "^7.53.0",
|
|
85
86
|
"sass": "^1.77.2",
|
|
86
87
|
"sass-loader": "^14.2.1",
|
|
87
88
|
"terser-webpack-plugin": "^5.3.10",
|
|
@@ -2,14 +2,24 @@ import * as React from 'react';
|
|
|
2
2
|
import { withMemo } from '../../helper/withMemo';
|
|
3
3
|
import { RbmComponentProps } from '../RbmComponentProps';
|
|
4
4
|
import { Block } from '../Layout/Block';
|
|
5
|
-
|
|
6
5
|
import styles from './dialogBackground.scss';
|
|
7
6
|
import classNames from 'classnames';
|
|
8
|
-
import {Heading} from "../Text/Heading";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import { Heading } from "../Text/Heading";
|
|
8
|
+
import { Flex } from "../Layout/Flex";
|
|
9
|
+
import { Grow } from "../Layout/Grow";
|
|
10
|
+
import { Clickable } from "../Clickable/Clickable";
|
|
11
|
+
import { Icon } from "../Icon/Icon";
|
|
12
|
+
import { faCircleXmark } from "@fortawesome/free-solid-svg-icons";
|
|
13
|
+
|
|
14
|
+
export type DialogBackgroundProps = RbmComponentProps<{ title?: string, onClose?: () => void }>;
|
|
15
|
+
|
|
16
|
+
export const DialogBackground = withMemo(function DialogBackground({
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
style,
|
|
20
|
+
title,
|
|
21
|
+
onClose
|
|
22
|
+
}: DialogBackgroundProps) {
|
|
13
23
|
// Variables
|
|
14
24
|
|
|
15
25
|
// Refs
|
|
@@ -28,7 +38,9 @@ export const DialogBackground = withMemo(function DialogBackground({ children, c
|
|
|
28
38
|
|
|
29
39
|
return (
|
|
30
40
|
<Block __allowChildren="all" className={classNames(styles.dialogBackground, className)} style={style}>
|
|
31
|
-
{!!title && <
|
|
41
|
+
{(!!title || !!onClose) && <Flex horizontal={true} className={styles.title}>{!!title &&
|
|
42
|
+
<Grow><Heading >{title}</Heading></Grow>}{!!onClose &&
|
|
43
|
+
<Clickable onClick={onClose}><Icon size={"lg"} icon={faCircleXmark}/></Clickable>}</Flex>}
|
|
32
44
|
{children}
|
|
33
45
|
</Block>
|
|
34
46
|
);
|
|
@@ -8,6 +8,7 @@ import { useSharedSelectedColor } from './sharedSelectedColor';
|
|
|
8
8
|
import { Menu } from "../../Menu/Menu";
|
|
9
9
|
import { useClientLayoutEffect } from "../../Hooks/useClientLayoutEffect";
|
|
10
10
|
import { FormError } from "../FormError";
|
|
11
|
+
import classNames from "classnames";
|
|
11
12
|
|
|
12
13
|
export type ColorInputProps<OnChangeData> = {
|
|
13
14
|
defaultValue?: string;
|
|
@@ -22,6 +23,7 @@ export type ColorInputProps<OnChangeData> = {
|
|
|
22
23
|
sharedColorKey?: string;
|
|
23
24
|
disabled?: boolean
|
|
24
25
|
error?: string;
|
|
26
|
+
className?: string;
|
|
25
27
|
} & OptionalListener<'onChange', OnChangeData>;
|
|
26
28
|
|
|
27
29
|
function convertToHex(color: { r: number; g: number; b: number; a?: number }, disableAlpha?: boolean) {
|
|
@@ -49,6 +51,7 @@ function ColorInput<OnChangeData>({
|
|
|
49
51
|
error,
|
|
50
52
|
sharedColorKey = "default",
|
|
51
53
|
disabled,
|
|
54
|
+
className,
|
|
52
55
|
...otherProps
|
|
53
56
|
}: ColorInputProps<OnChangeData>) {
|
|
54
57
|
// Variables
|
|
@@ -136,7 +139,7 @@ function ColorInput<OnChangeData>({
|
|
|
136
139
|
// Render Functions
|
|
137
140
|
return (
|
|
138
141
|
<>
|
|
139
|
-
<span className={styles.colorInput}>
|
|
142
|
+
<span className={classNames(styles.colorInput, className)}>
|
|
140
143
|
<Menu x={position.x} y={position.y} isOpen={realIsOpen} onClose={onMenuClose}>
|
|
141
144
|
<SketchPicker
|
|
142
145
|
color={colVal}
|
|
@@ -10,9 +10,9 @@ import classNames from 'classnames';
|
|
|
10
10
|
import { InlineBlock } from "../../Layout/InlineBlock";
|
|
11
11
|
import { Text } from "../../Text/Text";
|
|
12
12
|
|
|
13
|
-
export type SelectOption = {
|
|
13
|
+
export type SelectOption<ValueType=string> = {
|
|
14
14
|
label: string;
|
|
15
|
-
value:
|
|
15
|
+
value: ValueType;
|
|
16
16
|
key?: string;
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -21,12 +21,18 @@ export type SelectProps<OnChangeData> = RbmComponentProps<
|
|
|
21
21
|
SelectHTMLAttributes<HTMLSelectElement>,
|
|
22
22
|
{
|
|
23
23
|
label?: string;
|
|
24
|
-
options: SelectOption[];
|
|
25
|
-
onChangeValue?: (newValue: string) => void;
|
|
26
24
|
inline?: boolean;
|
|
27
25
|
small?: boolean;
|
|
28
26
|
error?: string;
|
|
29
|
-
} &
|
|
27
|
+
} & ({
|
|
28
|
+
options: SelectOption[];
|
|
29
|
+
onChangeValue?: (newValue: string) => void;
|
|
30
|
+
useNumericValues?: false;
|
|
31
|
+
}|{
|
|
32
|
+
options: SelectOption<number>[];
|
|
33
|
+
onChangeValue?: (newValue: number) => void;
|
|
34
|
+
useNumericValues: true;
|
|
35
|
+
})& OptionalListener<'onChange', OnChangeData>
|
|
30
36
|
>
|
|
31
37
|
>;
|
|
32
38
|
|
|
@@ -39,6 +45,7 @@ export const Select = withMemo(function Select<OnChangeData>({
|
|
|
39
45
|
inline = false,
|
|
40
46
|
small = false,
|
|
41
47
|
error,
|
|
48
|
+
useNumericValues,
|
|
42
49
|
...otherProps
|
|
43
50
|
}: SelectProps<OnChangeData>) {
|
|
44
51
|
// Variables
|
|
@@ -53,7 +60,11 @@ export const Select = withMemo(function Select<OnChangeData>({
|
|
|
53
60
|
const [onChangeWithData, propsWithoutData] = useListenerWithExtractedProps<'onChange', OnChangeData>('onChange', otherProps);
|
|
54
61
|
const onChange = useCallback<ChangeEventHandler<HTMLSelectElement>>(
|
|
55
62
|
(e) => {
|
|
56
|
-
|
|
63
|
+
if (useNumericValues) {
|
|
64
|
+
onChangeValue?.(Number(e.target.value));
|
|
65
|
+
} else {
|
|
66
|
+
onChangeValue?.(e.target.value);
|
|
67
|
+
}
|
|
57
68
|
onChangeWithData(e);
|
|
58
69
|
},
|
|
59
70
|
[onChangeWithData, onChangeValue]
|
package/webpack.config.js
CHANGED
|
@@ -3,6 +3,7 @@ const webpack = require('webpack');
|
|
|
3
3
|
// const PrettierPlugin = require('prettier-webpack-plugin');
|
|
4
4
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
5
5
|
const getPackageJson = require('./scripts/getPackageJson');
|
|
6
|
+
const CssLayeringPlugin = require('css-layering-webpack-plugin');
|
|
6
7
|
|
|
7
8
|
const { version, name, license, repository, author } = getPackageJson(
|
|
8
9
|
'version',
|
|
@@ -79,6 +80,12 @@ module.exports = (env) => {
|
|
|
79
80
|
// filename: 'css/index.css',
|
|
80
81
|
// }),
|
|
81
82
|
new webpack.BannerPlugin(banner),
|
|
83
|
+
new CssLayeringPlugin({
|
|
84
|
+
layers: [
|
|
85
|
+
{ path: "**/src/**/*.scss", name: "rbm" },
|
|
86
|
+
],
|
|
87
|
+
injectOrderAs: "none"
|
|
88
|
+
}),
|
|
82
89
|
],
|
|
83
90
|
resolve: {
|
|
84
91
|
extensions: ['.ts', '.tsx', '.js', '.json'],
|