@ainias42/react-bootstrap-mobile 0.1.10 → 0.1.13

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.
Files changed (63) hide show
  1. package/bin/release.sh +3 -3
  2. package/bin/updateCopies.js +1 -1
  3. package/dist/bootstrapReactMobile.js +1013 -920
  4. package/dist/bootstrapReactMobile.js.map +1 -1
  5. package/dist/src/Components/Card/Card.d.ts +2 -1
  6. package/dist/src/Components/Dialog/AlertDialog.d.ts +2 -2
  7. package/dist/src/Components/Dialog/ButtonDialog.d.ts +2 -2
  8. package/dist/src/Components/Dialog/ConfirmDialog.d.ts +2 -2
  9. package/dist/src/Components/Dialog/Dialog.d.ts +2 -1
  10. package/dist/src/Components/Dialog/DialogBackground.d.ts +2 -2
  11. package/dist/src/Components/Dialog/DialogContainer.d.ts +2 -1
  12. package/dist/src/Components/DragAndDrop/DragItem.d.ts +2 -2
  13. package/dist/src/Components/DragAndDrop/DropArea.d.ts +2 -2
  14. package/dist/src/Components/FormElements/Button/Button.d.ts +2 -1
  15. package/dist/src/Components/FormElements/CheckBox/Checkbox.d.ts +2 -1
  16. package/dist/src/Components/FormElements/ColorInput/ColorInput.d.ts +2 -2
  17. package/dist/src/Components/FormElements/ImageInput/ImageInput.d.ts +2 -1
  18. package/dist/src/Components/FormElements/ImageInput/MultipleFileInput.d.ts +2 -1
  19. package/dist/src/Components/FormElements/Input/HiddenInput.d.ts +2 -2
  20. package/dist/src/Components/FormElements/SearchSelectInput/SearchSelectInput.d.ts +2 -1
  21. package/dist/src/Components/FormElements/Select/Select.d.ts +2 -1
  22. package/dist/src/Components/FormElements/Slider/Slider.d.ts +2 -1
  23. package/dist/src/Components/FormElements/Switch/Switch.d.ts +2 -1
  24. package/dist/src/Components/FormElements/Textarea/Textarea.d.ts +2 -1
  25. package/dist/src/Components/FullScreen/FullScreen.d.ts +4 -5
  26. package/dist/src/Components/Hooks/useOnMount.d.ts +1 -1
  27. package/dist/src/Components/Icon/Icon.d.ts +4 -3
  28. package/dist/src/Components/Image/Image.d.ts +1 -1
  29. package/dist/src/Components/InViewport/InViewport.d.ts +2 -2
  30. package/dist/src/Components/Layout/Container.d.ts +2 -1
  31. package/dist/src/Components/Layout/Grid/Grid.d.ts +2 -2
  32. package/dist/src/Components/Layout/Grid/GridItem.d.ts +2 -2
  33. package/dist/src/Components/Layout/Grow.d.ts +2 -2
  34. package/dist/src/Components/List/BulletList/BulletList.d.ts +2 -2
  35. package/dist/src/Components/List/BulletList/ListItem.d.ts +2 -2
  36. package/dist/src/Components/List/List.d.ts +2 -1
  37. package/dist/src/Components/LoadingArea/LoadingArea.d.ts +2 -2
  38. package/dist/src/Components/LoadingCircle/LoadingCircle.d.ts +2 -2
  39. package/dist/src/Components/Menu/Menu.d.ts +2 -1
  40. package/dist/src/Components/SizeCalculator/SizeCalculator.d.ts +2 -2
  41. package/dist/src/Components/SpoilerList/Spoiler/Spoiler.d.ts +5 -4
  42. package/dist/src/Components/SpoilerList/SpoilerList.d.ts +2 -1
  43. package/dist/src/Components/TabBar/TabBar.d.ts +2 -1
  44. package/dist/src/Components/TabBar/TabBarButton.d.ts +2 -2
  45. package/dist/src/Components/Table/Table.d.ts +1 -1
  46. package/dist/src/Components/Text/Heading.d.ts +2 -2
  47. package/dist/src/Components/Text/Text.d.ts +2 -2
  48. package/dist/src/Components/Toast/Toast.d.ts +2 -2
  49. package/dist/src/Components/Toast/ToastContainer.d.ts +2 -2
  50. package/dist/src/Components/TopBar/MoreButton.d.ts +2 -2
  51. package/dist/src/Components/TopBar/TopBar.d.ts +2 -1
  52. package/dist/src/Components/TopBar/TopBarButton.d.ts +2 -2
  53. package/package.json +2 -2
  54. package/src/Components/FormElements/CheckBox/checkbox.scss +2 -0
  55. package/src/Components/FormElements/Input/PasswordInput/passwordInput.scss +1 -0
  56. package/src/Components/FormElements/Input/input.scss +5 -0
  57. package/src/Components/FormElements/SearchSelectInput/SearchSelectInput.tsx +13 -7
  58. package/src/Components/FormElements/Textarea/Textarea.tsx +5 -5
  59. package/src/Components/FullScreen/FullScreen.tsx +5 -10
  60. package/src/Components/Hooks/useOnMount.ts +20 -2
  61. package/src/Components/Icon/Icon.tsx +2 -1
  62. package/src/Components/List/List.tsx +1 -1
  63. package/src/Components/SpoilerList/Spoiler/Spoiler.tsx +3 -3
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import { ComponentType } from 'react';
2
3
  import { RbmComponentProps } from '../RbmComponentProps';
3
4
  import { IconSource } from '../Icon/Icon';
@@ -20,6 +21,6 @@ export type TopBarProps = RbmComponentProps<{
20
21
  transparent?: boolean;
21
22
  drawBehind?: boolean;
22
23
  }>;
23
- declare function TopBar({ title, rightButtons, leftButtons, hiddenButtons, className, transparent, drawBehind, ...rbmProps }: TopBarProps): JSX.Element;
24
+ declare function TopBar({ title, rightButtons, leftButtons, hiddenButtons, className, transparent, drawBehind, ...rbmProps }: TopBarProps): React.JSX.Element;
24
25
  declare const TopBarMemo: typeof TopBar;
25
26
  export { TopBarMemo as TopBar };
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { RbmComponentProps } from '../RbmComponentProps';
3
3
  export type TopBarButtonProps = RbmComponentProps<{
4
4
  disabled?: boolean;
5
5
  onClick?: () => void;
6
6
  }>;
7
- declare function TopBarButton({ disabled, onClick, className, children, ...rbmProps }: TopBarButtonProps): JSX.Element;
7
+ declare function TopBarButton({ disabled, onClick, className, children, ...rbmProps }: TopBarButtonProps): React.JSX.Element;
8
8
  declare const TopBarButtonMemo: typeof TopBarButton;
9
9
  export { TopBarButtonMemo as TopBarButton };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainias42/react-bootstrap-mobile",
3
- "version": "0.1.10",
3
+ "version": "0.1.13",
4
4
  "description": "Mobile React Components using Bootstrap",
5
5
  "main": "dist/bootstrapReactMobile",
6
6
  "scripts": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/Ainias/Bootstrap-React-Mobile#readme",
30
30
  "peerDependencies": {
31
- "@fortawesome/fontawesome-svg-core": "^1.2.36",
31
+ "@fortawesome/fontawesome-svg-core": "^1.3.0",
32
32
  "@fortawesome/free-regular-svg-icons": "^5.15.4",
33
33
  "@fortawesome/free-solid-svg-icons": "^5.15.4",
34
34
  "@fortawesome/react-fontawesome": "^0.1.16",
@@ -39,6 +39,7 @@
39
39
 
40
40
  @include design($material) {
41
41
  width: 18px;
42
+ min-width: 18px;
42
43
  height: 18px;
43
44
  margin: 2px;
44
45
 
@@ -51,6 +52,7 @@
51
52
  }
52
53
  @include design($flat) {
53
54
  width: 22px;
55
+ min-width: 22px;
54
56
  height: 22px;
55
57
 
56
58
  &::before {
@@ -4,4 +4,5 @@
4
4
 
5
5
  .showButton {
6
6
  padding-left: 0.4rem;
7
+ min-width: calc(16px + 0.4rem);
7
8
  }
@@ -25,6 +25,11 @@
25
25
  background-position: center bottom;
26
26
  padding-bottom: 2px;
27
27
 
28
+ &:read-only, &:read-only:focus {
29
+ background-image: none;
30
+ border-bottom: 1px solid transparent;
31
+ }
32
+
28
33
  &:focus {
29
34
  background-image: linear-gradient(var(--flavor-focus), var(--flavor-focus)),
30
35
  linear-gradient(to top, transparent 1px, #afafaf 1px);
@@ -122,13 +122,19 @@ export const SearchSelectInput = withMemo(function SearchSelectInput<OnChangeDat
122
122
  // Other
123
123
 
124
124
  // Render Functions
125
- const renderOption = (value: string) => (
126
- <Clickable onClick={toggleOption} onClickData={value} key={indexedOptions[value].key}>
127
- <InlineBlock className={styles.tag}>
128
- <Text size={TEXT_SIZE.xSmall}>{indexedOptions[value].label}</Text>
129
- </InlineBlock>
130
- </Clickable>
131
- );
125
+ const renderOption = (value: string) => {
126
+ if (!indexedOptions[value]) {
127
+ return null;
128
+ }
129
+
130
+ return (
131
+ <Clickable onClick={toggleOption} onClickData={value} key={indexedOptions[value].key}>
132
+ <InlineBlock className={styles.tag}>
133
+ <Text size={TEXT_SIZE.xSmall}>{indexedOptions[value].label}</Text>
134
+ </InlineBlock>
135
+ </Clickable>
136
+ );
137
+ };
132
138
  const renderSelectableOption = (opt: SelectOption, index: number) => (
133
139
  <Clickable onClick={toggleOption} onClickData={opt.value} key={opt.key}>
134
140
  <Block className={classNames(styles.selectableOption, { [styles.active]: index === selectedIndex })}>
@@ -23,7 +23,7 @@ function Textarea<OnChangeData>({
23
23
  label,
24
24
  className,
25
25
  style,
26
- onKeyPress,
26
+ onKeyUp,
27
27
  onChangeText,
28
28
  onEnter,
29
29
  ...otherProps
@@ -48,14 +48,14 @@ function Textarea<OnChangeData>({
48
48
 
49
49
  const realOnKeyPress = useCallback(
50
50
  (e: KeyboardEvent<HTMLTextAreaElement>) => {
51
- if (onKeyPress) {
52
- onKeyPress(e);
51
+ if (onKeyUp) {
52
+ onKeyUp(e);
53
53
  }
54
54
  if (onEnter && e.key === 'Enter' && !e.defaultPrevented) {
55
55
  onEnter((e.target as HTMLTextAreaElement).value);
56
56
  }
57
57
  },
58
- [onEnter, onKeyPress]
58
+ [onEnter, onKeyUp]
59
59
  );
60
60
 
61
61
  // Effects
@@ -67,7 +67,7 @@ function Textarea<OnChangeData>({
67
67
  return (
68
68
  <label className={classNames(styles.container, className)} style={style}>
69
69
  {label ? <span className={styles.label}>{label}</span> : null}
70
- <textarea {...otherProps} onKeyPress={realOnKeyPress} className={styles.textarea} onChange={onChange} />
70
+ <textarea {...otherProps} onKeyUp={realOnKeyPress} className={styles.textarea} onChange={onChange} />
71
71
  </label>
72
72
  );
73
73
  }
@@ -1,18 +1,11 @@
1
1
  import * as React from 'react';
2
- import {
3
- ComponentPropsWithoutRef,
4
- ComponentRef,
5
- PropsWithChildren,
6
- useCallback,
7
- useEffect,
8
- useMemo,
9
- useRef,
10
- } from 'react';
2
+ import { ComponentPropsWithoutRef, ComponentRef, useCallback, useEffect, useMemo, useRef } from 'react';
11
3
  import { Override } from '../../TypeHelpers';
12
4
  import { withMemo } from '../../helper/withMemo';
13
5
  import { useWindow } from '../../WindowContext/WindowContext';
6
+ import { RbmComponentProps } from '../RbmComponentProps';
14
7
 
15
- export type FullScreenProps<AsType extends keyof JSX.IntrinsicElements> = PropsWithChildren<
8
+ export type FullScreenProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponentProps<
16
9
  Override<
17
10
  ComponentPropsWithoutRef<AsType>,
18
11
  { as?: AsType; fullscreenKey?: string; onEnterFullscreen?: () => void; onLeaveFullscreen?: () => void }
@@ -81,6 +74,8 @@ function FullScreen<AsTag extends keyof JSX.IntrinsicElements = 'span'>({
81
74
  // Render Functions
82
75
  const element = as ?? 'span';
83
76
  const props = useMemo(() => ({ ...otherProps, ref: containerRef }), [otherProps]);
77
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
78
+ // @ts-ignore
84
79
  return React.createElement(element, props, children);
85
80
  }
86
81
 
@@ -1,12 +1,30 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
 
3
- export function useOnMount(cb: () => void | Promise<void>) {
3
+ export function useOnMount(cb: () => void | Promise<void> | (() => any)) {
4
4
  const called = useRef(false);
5
+ const unmountTimeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
6
+ const unmountFunc = useRef<() => any | undefined>();
5
7
  useEffect(() => {
8
+ clearTimeout(unmountTimeout.current);
9
+ unmountTimeout.current = undefined;
10
+
6
11
  if (!called.current) {
7
12
  called.current = true;
8
- cb();
13
+ const returnVal = cb();
14
+ if (typeof returnVal === 'function') {
15
+ unmountFunc.current = returnVal;
16
+ }
9
17
  }
18
+
19
+ return () => {
20
+ if (unmountTimeout.current) {
21
+ return;
22
+ }
23
+ unmountTimeout.current = setTimeout(() => {
24
+ unmountTimeout.current = undefined;
25
+ unmountFunc.current?.();
26
+ }, 60);
27
+ };
10
28
  // eslint-disable-next-line react-hooks/exhaustive-deps
11
29
  }, []);
12
30
  }
@@ -4,8 +4,9 @@ import { RbmComponentProps } from '../RbmComponentProps';
4
4
  import { Override } from '../../TypeHelpers';
5
5
  import { IconProp } from '@fortawesome/fontawesome-svg-core';
6
6
  import { withMemo } from '../../helper/withMemo';
7
+ import { IconDefinition } from '@fortawesome/free-regular-svg-icons';
7
8
 
8
- export type IconSource = IconProp | string;
9
+ export type IconSource = IconProp | string | IconDefinition;
9
10
 
10
11
  export type IconProps = RbmComponentProps<
11
12
  Override<
@@ -46,7 +46,7 @@ export const List = withMemo(function List<ItemType>({
46
46
 
47
47
  return (
48
48
  <AutoSizer>
49
- {({ height, width }) => {
49
+ {({ height, width }: { height?: number; width?: number }) => {
50
50
  return (
51
51
  <>
52
52
  {initialItemHeight === 0 && items.length > 0 && (
@@ -11,7 +11,7 @@ import { Clickable } from '../../Clickable/Clickable';
11
11
  import styles from './spoiler.scss';
12
12
  import classNames from 'classnames';
13
13
  import { OptionalListener, useListener } from '../../Hooks/useListener';
14
- import { Icon } from '../../Icon/Icon';
14
+ import { Icon, IconSource } from '../../Icon/Icon';
15
15
  import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
16
16
  import { IconProp } from '@fortawesome/fontawesome-svg-core';
17
17
 
@@ -21,8 +21,8 @@ export type SpoilerProps<OnClickData> = RbmComponentProps<
21
21
  initialOpen?: boolean;
22
22
  open?: boolean;
23
23
  noClosingAnimation?: boolean;
24
- openIcon?: IconProp | null;
25
- closeIcon?: IconProp | null;
24
+ openIcon?: IconSource | null;
25
+ closeIcon?: IconSource | null;
26
26
  } & OptionalListener<'onClick', OnClickData>
27
27
  >;
28
28