@ainias42/react-bootstrap-mobile 1.0.9 → 1.0.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/Components/Clickable/Clickable.d.ts +2 -1
- package/dist/Components/Icon/BaseIcon.d.ts +1 -1
- package/dist/Components/Icon/DoubleIcon.d.ts +1 -1
- package/dist/Components/List/BulletList/BulletList.d.ts +8 -0
- package/dist/Components/List/BulletList/ListItem.d.ts +7 -0
- package/dist/Components/Menu/Menu.d.ts +1 -1
- package/dist/Components/Menu/MenuItem.d.ts +2 -2
- package/dist/Components/Menu/Submenu.d.ts +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +85 -12
- package/dist/index.js.map +1 -1
- package/package.json +54 -56
- package/src/Components/Clickable/Clickable.tsx +3 -1
- package/src/Components/Clickable/clickable.module.scss +7 -0
- package/src/Components/DesignProvider/DesignContext.ts +1 -1
- package/src/Components/Dialog/dialog.module.scss +2 -1
- package/src/Components/FlavorWithText.ts +1 -1
- package/src/Components/FormElements/Controller/withHookController.tsx +19 -4
- package/src/Components/Icon/BaseIcon.tsx +2 -3
- package/src/Components/Icon/DoubleIcon.stories.tsx +1 -1
- package/src/Components/Icon/DoubleIcon.tsx +1 -1
- package/src/Components/Icon/Icon.stories.tsx +1 -2
- package/src/Components/List/BulletList/BulletList.tsx +33 -0
- package/src/Components/List/BulletList/ListItem.tsx +34 -0
- package/src/Components/Menu/Menu.stories.tsx +1 -1
- package/src/Components/Menu/Menu.tsx +1 -1
- package/src/Components/Menu/MenuItem.tsx +2 -2
- package/src/Components/Menu/Submenu.tsx +1 -1
- package/src/Components/Title/Title.stories.tsx +1 -1
- package/src/index.ts +2 -0
package/package.json
CHANGED
|
@@ -1,58 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"vite-tsconfig-paths": "^5.1.4"
|
|
57
|
-
}
|
|
2
|
+
"name": "@ainias42/react-bootstrap-mobile",
|
|
3
|
+
"version": "1.0.11",
|
|
4
|
+
"description": "Mobile React Components",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build-postinstall": "npm run build",
|
|
12
|
+
"build": "ctix build && webpack --env production",
|
|
13
|
+
"lint:noCache": "eslint \"{src,.storybook}/{**/*,*}.{js,jsx,tsx,ts}\" --max-warnings 0",
|
|
14
|
+
"lint": "npm run lint:noCache -- --cache",
|
|
15
|
+
"lint:fix": "npm run lint -- --fix",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"prettier": "npm run prettier:list -- --write",
|
|
18
|
+
"prettier:list": "prettier --list-different \"{src,.storybook}/**/*.{ts,tsx,js,jsx,json}\"",
|
|
19
|
+
"stylelint": "stylelint --allow-empty-input \"{src,.storybook}/**/*.{css,scss}\"",
|
|
20
|
+
"stylelint:fix": "npm run stylelint -- --fix",
|
|
21
|
+
"storybook": "storybook dev -p 6006",
|
|
22
|
+
"build-storybook": "storybook build"
|
|
23
|
+
},
|
|
24
|
+
"author": "",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "gitea@git.silas.link:Ainias/libraries.git"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
|
31
|
+
"@fortawesome/free-regular-svg-icons": "^6.7.2",
|
|
32
|
+
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
|
33
|
+
"@fortawesome/react-fontawesome": "^3.0.2",
|
|
34
|
+
"react": "^19.2.3",
|
|
35
|
+
"react-dom": "^19.2.3",
|
|
36
|
+
"react-hook-form": "^7.62.0"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@ainias42/config": "*",
|
|
40
|
+
"@ainias42/js-helper": ">=0.8.19",
|
|
41
|
+
"@hello-pangea/dnd": "^18.0.1",
|
|
42
|
+
"@uiw/react-color": "^2.5.5",
|
|
43
|
+
"classnames": "^2.5.1",
|
|
44
|
+
"react-table": "^7.8.0",
|
|
45
|
+
"yup": "^1.7.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@ainias42/webpack-config": "*",
|
|
49
|
+
"@storybook/addon-docs": "^9.1.5",
|
|
50
|
+
"@storybook/addon-onboarding": "^9.1.5",
|
|
51
|
+
"@storybook/react-vite": "^9.1.5",
|
|
52
|
+
"@storybook/addon-themes": "^9.1.5",
|
|
53
|
+
"eslint-plugin-storybook": "^9.1.5",
|
|
54
|
+
"storybook": "^9.1.5"
|
|
55
|
+
}
|
|
58
56
|
}
|
|
@@ -43,6 +43,7 @@ export type ClickableProps<
|
|
|
43
43
|
draggable?: boolean;
|
|
44
44
|
title?: string;
|
|
45
45
|
ref?: ForwardedRef<HrefType extends string ? HTMLAnchorElement : HTMLSpanElement>;
|
|
46
|
+
hiddenLink?: boolean;
|
|
46
47
|
} & OnClickListener<OnClickData> &
|
|
47
48
|
OnPointerDownListener<OnMouseDownData> &
|
|
48
49
|
OnPointerMoveListener<OnMouseMoveData> &
|
|
@@ -84,6 +85,7 @@ export const Clickable = withMemo(function Clickable<
|
|
|
84
85
|
draggable,
|
|
85
86
|
title,
|
|
86
87
|
ref,
|
|
88
|
+
hiddenLink,
|
|
87
89
|
...clickData
|
|
88
90
|
}: ClickableProps<
|
|
89
91
|
OnClickData,
|
|
@@ -305,7 +307,7 @@ export const Clickable = withMemo(function Clickable<
|
|
|
305
307
|
id,
|
|
306
308
|
role: interactable ? 'button' : undefined,
|
|
307
309
|
'aria-hidden': interactable ? undefined : true,
|
|
308
|
-
className: classNames(styles.clickable, className),
|
|
310
|
+
className: classNames(styles.clickable, { [styles.hiddenLink]: hiddenLink }, className),
|
|
309
311
|
onClick: realOnClick,
|
|
310
312
|
onPointerDown: realOnPointerDown,
|
|
311
313
|
onPointerMove: realOnPointerMove,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ObjectHelper } from '@ainias42/js-helper';
|
|
1
2
|
import { useComposedRef } from '../../Hooks/useComposedRef';
|
|
2
3
|
import { useController, useFormContext } from 'react-hook-form';
|
|
3
4
|
import { withMemo } from '../../../helper/withMemo';
|
|
@@ -25,17 +26,31 @@ export function withHookController<C extends ComponentType<any>, OnChangeProp ex
|
|
|
25
26
|
}: Props<Values, Name> & { ref?: ForwardedRef<RefType> }) {
|
|
26
27
|
const children = 'children' in otherProps ? otherProps.children : undefined;
|
|
27
28
|
|
|
28
|
-
const { field, fieldState } = useController({ name });
|
|
29
|
+
const { field, fieldState, formState } = useController({ name });
|
|
29
30
|
const { clearErrors } = useFormContext();
|
|
30
31
|
const composedRef = useComposedRef(ref, field.ref);
|
|
31
|
-
|
|
32
|
+
let errorMessage = fieldState.error?.message;
|
|
33
|
+
if (Array.isArray(fieldState.error)) {
|
|
34
|
+
errorMessage = fieldState.error.map((error) => error?.message).join('\n');
|
|
35
|
+
}
|
|
36
|
+
let clearErrorName: string = name;
|
|
37
|
+
|
|
38
|
+
if (!errorMessage) {
|
|
39
|
+
for (const [key, error] of ObjectHelper.entries(formState.errors)) {
|
|
40
|
+
if (key.startsWith(`${name}.`) || key.startsWith(`${name}[`)) {
|
|
41
|
+
errorMessage = error.message?.toString();
|
|
42
|
+
clearErrorName = key;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
32
47
|
|
|
33
48
|
const internalOnChange = useCallback(
|
|
34
49
|
(arg: any) => {
|
|
35
|
-
clearErrors(
|
|
50
|
+
clearErrors(clearErrorName);
|
|
36
51
|
field.onChange(arg);
|
|
37
52
|
},
|
|
38
|
-
[clearErrors, field
|
|
53
|
+
[clearErrorName, clearErrors, field],
|
|
39
54
|
);
|
|
40
55
|
const onChangeProps = {
|
|
41
56
|
[onChangeProp]: internalOnChange,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { FlavorWithText } from '../FlavorWithText';
|
|
2
3
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
4
|
import { withMemo } from '../../helper/withMemo';
|
|
4
5
|
import classNames from 'classnames';
|
|
@@ -9,8 +10,6 @@ import type { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
|
9
10
|
import type { Override } from '../../TypeHelpers';
|
|
10
11
|
import type { RbmComponentProps } from '../RbmComponentProps';
|
|
11
12
|
import type { Ref } from 'react';
|
|
12
|
-
import { Flavor } from '../Flavor';
|
|
13
|
-
import { FlavorWithText } from '../FlavorWithText';
|
|
14
13
|
|
|
15
14
|
export type IconSource = IconProp | string | IconDefinition;
|
|
16
15
|
|
|
@@ -23,7 +22,7 @@ export type IconProps = RbmComponentProps<
|
|
|
23
22
|
alt?: string;
|
|
24
23
|
ref?: Ref<HTMLImageElement | null>;
|
|
25
24
|
flavor?: FlavorWithText;
|
|
26
|
-
color?: undefined
|
|
25
|
+
color?: undefined;
|
|
27
26
|
}
|
|
28
27
|
>
|
|
29
28
|
>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
3
|
import { DoubleIcon } from './DoubleIcon';
|
|
4
|
-
import { faHouse, faUser } from '@fortawesome/free-solid-svg-icons';
|
|
5
4
|
import { FlavorWithText } from '../FlavorWithText';
|
|
5
|
+
import { faHouse, faUser } from '@fortawesome/free-solid-svg-icons';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
8
|
component: DoubleIcon,
|
|
@@ -3,8 +3,8 @@ import { BaseInlineBlock } from '../Layout/BaseInlineBlock';
|
|
|
3
3
|
import { withMemo } from '../../helper/withMemo';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import styles from './icon.module.scss';
|
|
6
|
+
import type { FlavorWithText } from '../FlavorWithText';
|
|
6
7
|
import type { IconProps, IconSource } from './BaseIcon';
|
|
7
|
-
import { FlavorWithText } from '../FlavorWithText';
|
|
8
8
|
|
|
9
9
|
export type DoubleIconProps = IconProps & {
|
|
10
10
|
secondIcon: IconSource;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
3
|
import { BaseIcon } from './BaseIcon';
|
|
4
|
-
import { faHouse, faUser } from '@fortawesome/free-solid-svg-icons';
|
|
5
4
|
import { FlavorWithText } from '../FlavorWithText';
|
|
6
|
-
import {
|
|
5
|
+
import { faHouse, faUser } from '@fortawesome/free-solid-svg-icons';
|
|
7
6
|
|
|
8
7
|
const meta = {
|
|
9
8
|
component: BaseIcon,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../../helper/withMemo';
|
|
3
|
+
import type { RbmComponentProps } from '../../RbmComponentProps';
|
|
4
|
+
|
|
5
|
+
export type BulletListProps = RbmComponentProps<{ numbered?: boolean }>;
|
|
6
|
+
|
|
7
|
+
function BulletList({ numbered = false, className, children, style }: BulletListProps) {
|
|
8
|
+
// Variables
|
|
9
|
+
|
|
10
|
+
// Refs
|
|
11
|
+
|
|
12
|
+
// States
|
|
13
|
+
|
|
14
|
+
// Selectors
|
|
15
|
+
|
|
16
|
+
// Callbacks
|
|
17
|
+
|
|
18
|
+
// Effects
|
|
19
|
+
|
|
20
|
+
// Other
|
|
21
|
+
const props = { className, style };
|
|
22
|
+
|
|
23
|
+
// Render Functions
|
|
24
|
+
if (numbered) {
|
|
25
|
+
return <ol {...props}>{children}</ol>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return <ul {...props}>{children}</ul>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Need BulletListMemo for autocompletion of phpstorm
|
|
32
|
+
const BulletListMemo = withMemo(BulletList);
|
|
33
|
+
export { BulletListMemo as BulletList };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../../helper/withMemo';
|
|
3
|
+
import type { EmptyProps } from '../../../helper/EmptyProps';
|
|
4
|
+
import type { RbmComponentProps } from '../../RbmComponentProps';
|
|
5
|
+
|
|
6
|
+
export type ListItemProps = RbmComponentProps<EmptyProps>;
|
|
7
|
+
|
|
8
|
+
function ListItem({ className, children, style }: ListItemProps) {
|
|
9
|
+
// Variables
|
|
10
|
+
|
|
11
|
+
// Refs
|
|
12
|
+
|
|
13
|
+
// States
|
|
14
|
+
|
|
15
|
+
// Selectors
|
|
16
|
+
|
|
17
|
+
// Callbacks
|
|
18
|
+
|
|
19
|
+
// Effects
|
|
20
|
+
|
|
21
|
+
// Other
|
|
22
|
+
|
|
23
|
+
// Render Functions
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<li className={className} style={style}>
|
|
27
|
+
{children}
|
|
28
|
+
</li>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Need ListItemMemo for autocompletion of phpstorm
|
|
33
|
+
const ListItemMemo = withMemo(ListItem);
|
|
34
|
+
export { ListItemMemo as ListItem };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
|
+
import { FlavorWithText } from '../FlavorWithText';
|
|
3
4
|
import { Menu } from './Menu';
|
|
4
5
|
import { MenuDivider } from './MenuDivider';
|
|
5
6
|
import { MenuItem } from './MenuItem';
|
|
@@ -8,7 +9,6 @@ import { faCog, faCogs, faHome, faUser } from '@fortawesome/free-solid-svg-icons
|
|
|
8
9
|
import { fn } from 'storybook/test';
|
|
9
10
|
import React from 'react';
|
|
10
11
|
import type { MenuProps } from './Menu';
|
|
11
|
-
import { FlavorWithText } from '../FlavorWithText';
|
|
12
12
|
|
|
13
13
|
const meta = {
|
|
14
14
|
component: Menu,
|
|
@@ -10,9 +10,9 @@ import { withMemo } from '../../helper/withMemo';
|
|
|
10
10
|
import { withRenderBrowserOnly } from '../../helper/withRenderBrowserOnly';
|
|
11
11
|
import classNames from 'classnames';
|
|
12
12
|
import styles from './menu.module.scss';
|
|
13
|
+
import type { FlavorWithText } from '../FlavorWithText';
|
|
13
14
|
import type { IconSource } from '../Icon/BaseIcon';
|
|
14
15
|
import type { RbmComponentProps } from '../RbmComponentProps';
|
|
15
|
-
import { FlavorWithText } from '../FlavorWithText';
|
|
16
16
|
|
|
17
17
|
export type MenuItemType = {
|
|
18
18
|
label: string;
|
|
@@ -7,12 +7,12 @@ import { withMemo } from '../../helper/withMemo';
|
|
|
7
7
|
import React, { useCallback } from 'react';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import styles from './menu.module.scss';
|
|
10
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
10
11
|
import type { IconSource } from '../Icon/BaseIcon';
|
|
11
12
|
import type { RbmComponentProps, WithChildren } from '../RbmComponentProps';
|
|
12
|
-
import type { CSSProperties, ReactNode } from 'react';
|
|
13
13
|
|
|
14
14
|
import Element = React.JSX.Element;
|
|
15
|
-
import { FlavorWithText } from '../FlavorWithText';
|
|
15
|
+
import type { FlavorWithText } from '../FlavorWithText';
|
|
16
16
|
|
|
17
17
|
export type MenuItemProps<Item = undefined> = RbmComponentProps<
|
|
18
18
|
{
|
|
@@ -11,9 +11,9 @@ import { withMemo } from '../../helper/withMemo';
|
|
|
11
11
|
import React, { useCallback, useRef, useState } from 'react';
|
|
12
12
|
import classNames from 'classnames';
|
|
13
13
|
import styles from './menu.module.scss';
|
|
14
|
+
import type { FlavorWithText } from '../FlavorWithText';
|
|
14
15
|
import type { IconSource } from '../Icon/BaseIcon';
|
|
15
16
|
import type { RbmComponentProps, WithNoStringAndChildrenProps } from '../RbmComponentProps';
|
|
16
|
-
import { FlavorWithText } from '../FlavorWithText';
|
|
17
17
|
|
|
18
18
|
export type SubmenuProps = RbmComponentProps<
|
|
19
19
|
{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseIcon } from '../Icon/BaseIcon';
|
|
2
2
|
import { Block } from '../Layout/Block';
|
|
3
|
+
import { Flavor } from '../Flavor';
|
|
3
4
|
import { HoverMenu } from '../Menu/HoverMenu';
|
|
4
5
|
import { MenuDivider } from '../Menu/MenuDivider';
|
|
5
6
|
import { MenuItem } from '../Menu/MenuItem';
|
|
@@ -10,7 +11,6 @@ import { fn } from 'storybook/test';
|
|
|
10
11
|
import React from 'react';
|
|
11
12
|
import type { HoverMenuProps } from '../Menu/HoverMenu';
|
|
12
13
|
import type { StoryObj } from '@storybook/react-vite';
|
|
13
|
-
import { Flavor } from '../Flavor';
|
|
14
14
|
|
|
15
15
|
const meta = {
|
|
16
16
|
args: {
|
package/src/index.ts
CHANGED
|
@@ -122,6 +122,8 @@ export * from './Components/FormElements/Switch/Switch';
|
|
|
122
122
|
export * from './Components/FormElements/Textarea/Textarea';
|
|
123
123
|
export * from './Components/Layout/Grid/Grid';
|
|
124
124
|
export * from './Components/Layout/Grid/GridItem';
|
|
125
|
+
export * from './Components/List/BulletList/BulletList';
|
|
126
|
+
export * from './Components/List/BulletList/ListItem';
|
|
125
127
|
export * from './Components/SpoilerList/Spoiler/Spoiler';
|
|
126
128
|
export * from './Components/FormElements/Input/FileInput/FileInput';
|
|
127
129
|
export * from './Components/FormElements/Input/FileInput/FileType';
|