react-ui-basics 0.0.248 → 0.0.250

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-ui-basics",
3
- "version": "0.0.248",
3
+ "version": "0.0.250",
4
4
  "description": "",
5
5
  "module": "index.js",
6
6
  "_main": "index.cjs.js",
@@ -2,8 +2,8 @@ declare const history: History;
2
2
  export type HistoryAction = 'pushState' | 'replaceState';
3
3
  export type HistoryActionArgs = Parameters<typeof history[HistoryAction]>;
4
4
  export type HistoryMiddleware = (action: HistoryAction, args: HistoryActionArgs) => HistoryActionArgs;
5
- export declare const pushLocation: (path: string) => void;
6
- export declare const replaceLocation: (path: string) => void;
5
+ export declare const pushLocation: (path: string | URL) => void;
6
+ export declare const replaceLocation: (path: string | URL) => void;
7
7
  export declare const addMiddleware: (middleware: HistoryMiddleware) => void;
8
8
  export declare const removeMiddleware: (middleware: HistoryMiddleware) => void;
9
9
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"HistoryTools.js","sources":["../src/router/HistoryTools.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;AAM/B,MAAM,WAAW,GAAwB,EAAE,CAAA;AAE3C,MAAM,MAAM,GAAoB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAC9D,MAAM,CAAC,OAAO,CAAC,CAAC,IAAG;AACf,IAAA,IAAI,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO,CAAC,CAAC,CAAC,GAAG,YAAA;QACT,IAAI,IAAI,GAAG,SAAqC,CAAC;AACjD,QAAA,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;AAClC,YAAA,IAAI,GAAG,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;AAC1B,YAAA,IAAI,CAAC,IAAI;gBAAE,MAAK;AACnB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a,GAAG,CAAC,UAA6B,KAAI;AAC3D,IAAA,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACjC,EAAE;AACW,MAAA,gBAAgB,GAAG,CAAC,UAA6B,KAAI;IAC9D,IAAI,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAC5C,IAAA,KAAK,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACjD,EAAE;AAEF,IAAI,MAAM,CAAC,4BAA4B,CAAC,EAAE;;;IAGtC,MAAM,CAAC,eAAe,CAAC,GAAG;QACtB,eAAe;QACf,aAAa;QACb,gBAAgB;KACnB,CAAA;AACJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, {CSSProperties} from 'react';
2
2
  import ReactCreateElement from './ReactCreateElement';
3
3
  import {classNames} from "./Tools";
4
4
 
@@ -13,6 +13,7 @@ export interface MaterialIconProps {
13
13
  icon: MaterialIconType
14
14
  className?: string
15
15
  type?: 'Outlined' | 'Filled' | 'Rounded' | 'Sharp' | 'TwoTone'
16
+ style?: CSSProperties
16
17
  }
17
18
 
18
19
  let DEFAULT_CLASS_NAME = 'material-icons';
@@ -24,7 +25,7 @@ const typeToClass = {
24
25
  'TwoTone': DEFAULT_CLASS_NAME + '-two-tone',
25
26
  }
26
27
 
27
- const MaterialIcon = ({icon, className, type = 'Filled'}: MaterialIconProps) => (
28
- <i className={classNames('MaterialIcon', typeToClass[type] || DEFAULT_CLASS_NAME, className)} translate="no">{icon}</i>
28
+ const MaterialIcon = ({icon, className, type = 'Filled', style}: MaterialIconProps) => (
29
+ <i className={classNames('MaterialIcon', typeToClass[type] || DEFAULT_CLASS_NAME, className)} style={style} translate="no">{icon}</i>
29
30
  );
30
31
  export default MaterialIcon;
package/src/ModalMenu.tsx CHANGED
@@ -5,10 +5,9 @@ import {PureComponent, stateGS, render} from "./ReactConstants";
5
5
  import {classNames} from "./Tools";
6
6
  import Animated from "./Animated";
7
7
  import Button from "./Button";
8
- import MaterialIcon, {MaterialIconType} from "./MaterialIcon";
8
+ import MaterialIcon, {MaterialIconProps} from "./MaterialIcon";
9
9
 
10
- export interface ModalMenuItem {
11
- icon: MaterialIconType,
10
+ export interface ModalMenuItem extends MaterialIconProps {
12
11
  action: MouseEventHandler
13
12
  }
14
13
 
@@ -45,7 +44,7 @@ class ModalMenu extends PureComponent<ModalMenuProps> {
45
44
  }}
46
45
  >
47
46
  <Button flat={true} round={true} onClick={it.action}>
48
- <MaterialIcon icon={it.icon}/>
47
+ <MaterialIcon {...it}/>
49
48
  </Button>
50
49
  </Animated>)}
51
50
 
package/src/Tools.ts CHANGED
@@ -2,6 +2,9 @@ var global = global || window;
2
2
  export const WINDOW: Window = global as Window;
3
3
  export const DOCUMENT = WINDOW.document;
4
4
 
5
+ export const UNDEFINED = undefined;
6
+ export const isUndefined = a => a === UNDEFINED;
7
+
5
8
  export function classNames(...classes: Array<string | number | boolean | null | void>) {
6
9
  const filtered = [];
7
10
  const length = classes.length;
@@ -27,14 +30,14 @@ export const ref = (name, component) => {
27
30
  export const createRef = <T>(initialValue?: T) => {
28
31
  let v = initialValue;
29
32
  return (value?: any) => {
30
- if (value != UNDEFINED)
33
+ if (!isUndefined(value))
31
34
  v = value
32
35
  return v;
33
36
  };
34
37
  };
35
38
 
36
39
  export const createAccessor = (field: string) => (o: any, value?: any) => {
37
- return !o ? null : value != UNDEFINED ? o[field] = value : o[field]
40
+ return !o ? null : isUndefined(value) ? o[field] : o[field] = value
38
41
  }
39
42
 
40
43
  export const setOf = (list) => (list || []).reduce((map, key) => {
@@ -167,9 +170,6 @@ export const removeEventListener = (el, type, listener, options?) => {
167
170
  el && el.removeEventListener(type, listener, options);
168
171
  };
169
172
 
170
- export const UNDEFINED = undefined;
171
- export const isUndefined = a => a === UNDEFINED;
172
-
173
173
  export type ComparatorFunction<T> = (a: T, b: T) => number;
174
174
  export interface Comparator<T> extends ComparatorFunction<T>{
175
175
  inverse : <T>() => Comparator<T>
@@ -27,9 +27,9 @@ const fireEvent = (name) => {
27
27
  WINDOW.dispatchEvent(event);
28
28
  };
29
29
 
30
- export const pushLocation = (path: string) => path !== WINDOW.location.pathname && history[events[0]](null, null, path);
30
+ export const pushLocation = (path: string | URL) => path !== WINDOW.location.pathname && history[events[0]](null, null, path);
31
31
 
32
- export const replaceLocation = (path: string) => history[events[1]](null, null, path);
32
+ export const replaceLocation = (path: string | URL) => history[events[1]](null, null, path);
33
33
 
34
34
  export const addMiddleware = (middleware: HistoryMiddleware) => {
35
35
  middlewares.push(middleware);