@plurid/plurid-ui-components-react 0.0.0-12 → 0.0.0-15

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.
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { Theme } from '@plurid/plurid-themes';
3
- import { notifications } from '@plurid/plurid-ui-state-react';
3
+ import { DispatchAction, Notification, notifications } from '@plurid/plurid-ui-state-react';
4
4
  export interface NotificationOwnProperties {
5
- data: notifications.Types.Notification;
5
+ data: Notification;
6
6
  theme: Theme;
7
- remove: (payload: notifications.Types.RemoveNotificationPayload) => void;
7
+ remove: DispatchAction<typeof notifications.actions.removeNotification>;
8
8
  elements?: Record<string, JSX.Element>;
9
9
  style?: React.CSSProperties;
10
10
  className?: string;
@@ -3,5 +3,8 @@ export interface IStyledNotification {
3
3
  theme: Theme;
4
4
  }
5
5
  export declare const StyledNotification: import("styled-components").StyledComponent<"div", any, IStyledNotification, never>;
6
- export declare const StyledNotificationContent: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ export interface IStyledNotificationContent {
7
+ wordBreak: string;
8
+ }
9
+ export declare const StyledNotificationContent: import("styled-components").StyledComponent<"div", any, IStyledNotificationContent, never>;
7
10
  export declare const StyledNotificationClose: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { StateOfAny, themes as themesStateService, notifications as notificationsStateService } from '@plurid/plurid-ui-state-react';
3
2
  import { Theme } from '@plurid/plurid-themes';
3
+ import { DispatchAction, StateOfAny, themes as themesStateService, notifications as notificationsStateService, Notification as INotification } from '@plurid/plurid-ui-state-react';
4
4
  export declare type NotificationsState = StateOfAny & {
5
- themes: themesStateService.Types.State;
6
- notifications: notificationsStateService.Types.State;
5
+ themes: themesStateService.ThemesState;
6
+ notifications: notificationsStateService.NotificationsState;
7
7
  };
8
8
  export declare type NotificationsSelectors = StateOfAny & {
9
9
  themes: typeof themesStateService.selectors;
@@ -16,10 +16,10 @@ export interface NotificationsOwnProperties {
16
16
  }
17
17
  export interface NotificationsStateProperties {
18
18
  stateGeneralTheme: Theme;
19
- stateNotifications: notificationsStateService.Types.Notification[];
19
+ stateNotifications: INotification[];
20
20
  }
21
21
  export interface NotificationsDispatchProperties {
22
- dispatchRemoveNotification: typeof notificationsStateService.actions.removeNotification;
22
+ dispatchRemoveNotification: DispatchAction<typeof notificationsStateService.actions.removeNotification>;
23
23
  }
24
24
  export declare type NotificationsProperties = NotificationsOwnProperties & NotificationsStateProperties & NotificationsDispatchProperties;
25
25
  declare const ConnectedNotifications: import("react-redux").ConnectedComponent<React.FC<NotificationsProperties>, Omit<NotificationsProperties, "stateGeneralTheme" | "stateNotifications" | "dispatchRemoveNotification"> & NotificationsOwnProperties & import("react-redux").ConnectProps>;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { Theme } from '@plurid/plurid-themes';
3
3
  export interface SittingsOwnProperties {
4
4
  selectors: any;
5
+ context: React.Context<any>;
5
6
  }
6
7
  export interface SittingsStateProperties {
7
8
  stateInteractionTheme: Theme;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { Theme } from '@plurid/plurid-themes';
3
3
  export interface StateImageOwnProperties {
4
4
  selectors: any;
5
+ context: React.Context<any>;
5
6
  }
6
7
  export interface StateImageStateProperties {
7
8
  stateInteractionTheme: Theme;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  export interface StateLineProperties {
3
3
  theme: any;
4
+ context: React.Context<any>;
4
5
  }
5
6
  declare const ConnectedStateLine: import("react-redux").ConnectedComponent<React.FC<StateLineProperties>, any>;
6
7
  export default ConnectedStateLine;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  export interface StateLinkProperties {
3
3
  theme: any;
4
4
  currentLink: string;
5
+ context: React.Context<any>;
5
6
  }
6
7
  declare const ConnectedStateLink: import("react-redux").ConnectedComponent<React.FC<StateLinkProperties>, any>;
7
8
  export default ConnectedStateLink;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Theme } from '@plurid/plurid-themes';
3
3
  export interface SittingTrayOwnProperties {
4
4
  selectors: any;
5
- context: any;
5
+ context: React.Context<any>;
6
6
  }
7
7
  export interface SittingTrayStateProperties {
8
8
  stateInteractionTheme: Theme;
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { sitting } from '@plurid/plurid-ui-state-react';
3
2
  import { Theme } from '@plurid/plurid-themes';
3
+ import { DispatchAction, sitting } from '@plurid/plurid-ui-state-react';
4
4
  import { ToolbarButton } from "../../../../data/interfaces";
5
5
  export interface ToolbarGeneralOwnProperties {
6
6
  buttons: ToolbarButton[];
7
7
  selectors: any;
8
- context: any;
8
+ context: React.Context<any>;
9
9
  handleClick: (type: any) => void;
10
10
  speakButton?: boolean;
11
11
  sittingButton?: boolean;
@@ -17,7 +17,7 @@ export interface ToolbarGeneralStateProperties {
17
17
  stateInteractionTheme: Theme;
18
18
  }
19
19
  export interface ToolbarGeneralDispatchProperties {
20
- dispatchToggleSittingTray: typeof sitting.actions.toggleSittingTray;
20
+ dispatchToggleSittingTray: DispatchAction<typeof sitting.actions.toggleSittingTray>;
21
21
  }
22
22
  export declare type ToolbarGeneralProperties = ToolbarGeneralOwnProperties & ToolbarGeneralStateProperties & ToolbarGeneralDispatchProperties;
23
23
  declare const ConnectedToolbarGeneral: import("react-redux").ConnectedComponent<React.FC<ToolbarGeneralProperties>, any>;
@@ -7,6 +7,7 @@ export interface DropdownProperties {
7
7
  atSelect: (selection: PluridUIDropdownSelectable | string, kind?: string) => void;
8
8
  left?: boolean;
9
9
  kind?: string;
10
+ listTop?: string;
10
11
  dropdownToggled?: boolean;
11
12
  /**
12
13
  * Hide dropdown after click selection.
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Theme } from '@plurid/plurid-themes';
3
3
  export interface TextlineProperties {
4
4
  text: string;
5
- atChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
5
+ atChange: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void;
6
6
  atKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
7
7
  atFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
8
8
  atBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
@@ -30,12 +30,12 @@ export interface TextlineProperties {
30
30
  export declare type TextlineType = TextlineProperties & React.RefAttributes<any>;
31
31
  /**
32
32
  * @param text `string`
33
- * @param atChange `(event: React.ChangeEvent<HTMLInputElement>) => void`
33
+ * @param atChange `(event: React.ChangeEvent<HTMLInputElement>, value: string) => void`
34
34
  * @param atKeyDown `(event: React.KeyboardEvent<HTMLInputElement>) => void`
35
35
  * @param atFocus `(event: React.FocusEvent<HTMLInputElement>) => void`
36
36
  * @param atBlur `(event: React.FocusEvent<HTMLInputElement>) => void`
37
37
  *
38
- * @param type optional - `'text' | 'password'`
38
+ * @param type optional - `'text' | 'password' | 'number'`
39
39
  * @param placeholder optional - `string`
40
40
  * @param autoCapitalize optional - `string`
41
41
  * @param autoComplete optional - `string`
@@ -286,8 +286,9 @@ const StyledPureButton = styled.button`
286
286
  min-height: 40px;
287
287
  min-width: 160px;
288
288
 
289
- :hover {
290
- background-color: ${({theme: theme, level: level, isDisabled: isDisabled}) => {
289
+ @media (hover: hover) {
290
+ :hover {
291
+ background-color: ${({theme: theme, level: level, isDisabled: isDisabled}) => {
291
292
  if (isDisabled) {
292
293
  return theme.backgroundColorPrimaryAlpha;
293
294
  }
@@ -308,6 +309,7 @@ const StyledPureButton = styled.button`
308
309
  return theme.backgroundColorSecondary;
309
310
  }
310
311
  }};
312
+ }
311
313
  }
312
314
 
313
315
  :active {
@@ -1020,7 +1022,9 @@ const Textline = forwardRef(((properties, reference) => {
1020
1022
  }, React.createElement("input", {
1021
1023
  type: _type,
1022
1024
  value: text,
1023
- onChange: atChange,
1025
+ onChange: event => {
1026
+ atChange(event, event.target.value);
1027
+ },
1024
1028
  onKeyDown: handleKeyDown,
1025
1029
  onFocus: atFocus,
1026
1030
  onBlur: atBlur,
@@ -1089,6 +1093,7 @@ const StyledDropdownList = styled.div`
1089
1093
  }
1090
1094
  }};
1091
1095
  color: ${props => props.theme.colorPrimary};
1096
+ position: absolute;
1092
1097
  left: ${props => {
1093
1098
  if (props.left) {
1094
1099
  return "0px";
@@ -1100,6 +1105,12 @@ const StyledDropdownList = styled.div`
1100
1105
  return "auto";
1101
1106
  }
1102
1107
  return "0px";
1108
+ }};
1109
+ top: ${props => {
1110
+ if (props.listTop) {
1111
+ return props.listTop;
1112
+ }
1113
+ return "25px";
1103
1114
  }};
1104
1115
  height: ${props => {
1105
1116
  if (props.heightItems) {
@@ -1136,8 +1147,6 @@ const StyledDropdownList = styled.div`
1136
1147
  return "initial";
1137
1148
  }};
1138
1149
 
1139
- position: absolute;
1140
- top: 25px;
1141
1150
  border-radius: 10px;
1142
1151
  min-width: 60px;
1143
1152
 
@@ -1219,7 +1228,7 @@ const StyledFilterUpdate = styled.div`
1219
1228
  `;
1220
1229
 
1221
1230
  const Dropdown = properties => {
1222
- const {selected: selected, selectables: selectables, atSelect: atSelect, left: left, kind: kind, dropdownToggled: dropdownToggled, hideAtSelect: hideAtSelect, selectAtHover: selectAtHover, selectedColor: selectedColor, filterable: filterable, style: style, className: className, theme: themeProperty, generalTheme: generalThemeProperty, interactionTheme: interactionThemeProperty, level: level, heightItems: heightItems, width: width, setDropdownToggled: setDropdownToggled, filterUpdate: filterUpdate} = properties;
1231
+ const {selected: selected, selectables: selectables, atSelect: atSelect, left: left, kind: kind, listTop: listTop, dropdownToggled: dropdownToggled, hideAtSelect: hideAtSelect, selectAtHover: selectAtHover, selectedColor: selectedColor, filterable: filterable, style: style, className: className, theme: themeProperty, generalTheme: generalThemeProperty, interactionTheme: interactionThemeProperty, level: level, heightItems: heightItems, width: width, setDropdownToggled: setDropdownToggled, filterUpdate: filterUpdate} = properties;
1223
1232
  const _generalTheme = generalThemeProperty === undefined ? themeProperty === undefined ? plurid : themeProperty : generalThemeProperty;
1224
1233
  const _interactionTheme = interactionThemeProperty === undefined ? themeProperty === undefined ? plurid : themeProperty : interactionThemeProperty;
1225
1234
  const _level = level !== null && level !== void 0 ? level : 0;
@@ -1391,6 +1400,7 @@ const Dropdown = properties => {
1391
1400
  }, typeof selected === "string" ? selected : selected.value), showList && React.createElement(StyledDropdownList, {
1392
1401
  theme: interactionTheme,
1393
1402
  left: left,
1403
+ listTop: listTop,
1394
1404
  level: _level,
1395
1405
  heightItems: heightItems && filterable && filteredSelectables.length < heightItems ? filteredSelectables.length + 1 : heightItems,
1396
1406
  heightBeyond: filteredSelectables.length > (heightItems || 0),
@@ -1552,6 +1562,11 @@ const StyledInputBox = styled.div`
1552
1562
  color: ${({theme: theme}) => theme.colorPrimary};
1553
1563
  background-color: ${({theme: theme}) => theme.backgroundColorTertiary};
1554
1564
  box-shadow: inset 0px 4px 4px ${({theme: theme}) => theme.boxShadowUmbraColor};
1565
+
1566
+
1567
+ ::placeholder {
1568
+ color: ${({theme: theme}) => theme.colorSecondary};
1569
+ }
1555
1570
  }
1556
1571
  `;
1557
1572
 
@@ -2584,7 +2599,7 @@ const StyledNotification = styled.div`
2584
2599
  const StyledNotificationContent = styled.div`
2585
2600
  font-size: 0.9rem;
2586
2601
  padding: 32px 16px;
2587
- word-break: break-all;
2602
+ word-break: ${({wordBreak: wordBreak}) => wordBreak};
2588
2603
  `;
2589
2604
 
2590
2605
  const StyledNotificationClose = styled.div`
@@ -2601,14 +2616,13 @@ const StyledNotificationClose = styled.div`
2601
2616
 
2602
2617
  const Notification = properties => {
2603
2618
  const {data: data, theme: theme, remove: remove, elements: elements, style: style, className: className} = properties;
2604
- const {id: id, text: text, html: html, react: react, timeout: timeout} = data;
2619
+ const {id: id, text: text, html: html, react: react, timeout: timeout, wordBreak: wordBreak} = data;
2620
+ const resolvedWordBreak = wordBreak === false ? "normal" : "break-all";
2605
2621
  const notificationTimeout = useRef(null);
2606
2622
  useEffect((() => {
2607
2623
  if (timeout) {
2608
2624
  notificationTimeout.current = setTimeout((() => {
2609
- remove({
2610
- id: id
2611
- });
2625
+ remove(id);
2612
2626
  }), timeout);
2613
2627
  }
2614
2628
  return () => {
@@ -2617,17 +2631,27 @@ const Notification = properties => {
2617
2631
  }
2618
2632
  };
2619
2633
  }), [ id, timeout, remove ]);
2620
- const content = html ? React.createElement(StyledNotificationContent, {
2621
- dangerouslySetInnerHTML: createMarkup(text)
2622
- }) : react && elements && elements[text] ? React.createElement(StyledNotificationContent, null, elements[text]) : React.createElement(StyledNotificationContent, null, text);
2634
+ const resolveRender = () => {
2635
+ const contentProperties = {
2636
+ wordBreak: resolvedWordBreak
2637
+ };
2638
+ if (html) {
2639
+ return React.createElement(StyledNotificationContent, Object.assign({
2640
+ dangerouslySetInnerHTML: createMarkup(text)
2641
+ }, contentProperties));
2642
+ }
2643
+ if (react && elements && elements[text]) {
2644
+ return React.createElement(StyledNotificationContent, Object.assign({}, contentProperties), elements[text]);
2645
+ }
2646
+ return React.createElement(StyledNotificationContent, Object.assign({}, contentProperties), text);
2647
+ };
2648
+ const content = resolveRender();
2623
2649
  return React.createElement(StyledNotification, {
2624
2650
  theme: theme,
2625
2651
  style: Object.assign({}, style),
2626
2652
  className: className
2627
2653
  }, content, React.createElement(StyledNotificationClose, null, React.createElement(PluridIconDelete, {
2628
- atClick: () => remove({
2629
- id: id
2630
- })
2654
+ atClick: () => remove(id)
2631
2655
  })));
2632
2656
  };
2633
2657
 
@@ -3108,17 +3132,19 @@ const StyledHorizontalToolbarButton = styled.div`
3108
3132
  color: ${props => props.theme.colorPrimary};
3109
3133
  font-family: ${props => props.theme.fontFamilySansSerif};
3110
3134
 
3111
- :hover {
3112
- background: ${props => props.theme.backgroundColorTertiary};
3113
- }
3135
+ @media (hover: hover) {
3136
+ :hover {
3137
+ background: ${props => props.theme.backgroundColorTertiary};
3138
+ }
3114
3139
 
3115
- :hover svg {
3116
- transform: ${props => {
3140
+ :hover svg {
3141
+ transform: ${props => {
3117
3142
  if (props.scaleIcon) {
3118
3143
  return "scale(1.2)";
3119
3144
  }
3120
3145
  return "";
3121
3146
  }};
3147
+ }
3122
3148
  }
3123
3149
 
3124
3150
  svg {
@@ -3271,17 +3297,19 @@ const StyledVerticalToolbarButton = styled.div`
3271
3297
  return "transparent";
3272
3298
  }};
3273
3299
 
3274
- :hover {
3275
- background: ${props => props.theme.backgroundColorTertiary};
3276
- }
3300
+ @media (hover: hover) {
3301
+ :hover {
3302
+ background: ${props => props.theme.backgroundColorTertiary};
3303
+ }
3277
3304
 
3278
- :hover svg {
3279
- transform: ${props => {
3305
+ :hover svg {
3306
+ transform: ${props => {
3280
3307
  if (props.scaleIcon) {
3281
3308
  return "scale(1.2)";
3282
3309
  }
3283
3310
  return "";
3284
3311
  }};
3312
+ }
3285
3313
  }
3286
3314
 
3287
3315
  svg {