@plurid/plurid-ui-components-react 0.0.0-4 → 0.0.0-8

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.
@@ -17,6 +17,8 @@ declare const universal: {
17
17
  };
18
18
  inputs: {
19
19
  Dropdown: import("react").FC<import("./inputs/Dropdown").DropdownProperties>;
20
+ EntityPill: import("react").FC<import("./inputs/EntityPill").EntityPillProperties>;
21
+ EntityPillGroup: import("react").FC<import("./inputs/EntityPillGroup").EntityPillGroupProperties>;
20
22
  InputBox: import("react").FC<import("./inputs/InputBox").InputBoxProperties>;
21
23
  InputDescriptor: import("react").FC<import("./inputs/InputDescriptor").InputDescriptorProperties>;
22
24
  InputLine: import("react").FC<import("./inputs/InputLine").InputLineProperties>;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Theme } from '@plurid/plurid-themes';
3
+ export interface EntityPillProperties {
4
+ id: string;
5
+ remove: (id: string) => void;
6
+ text?: string;
7
+ theme?: Theme;
8
+ style?: React.CSSProperties;
9
+ }
10
+ declare const EntityPill: React.FC<EntityPillProperties>;
11
+ export default EntityPill;
@@ -0,0 +1,5 @@
1
+ import { Theme } from '@plurid/plurid-themes';
2
+ export interface IStyledEntityPill {
3
+ theme: Theme;
4
+ }
5
+ export declare const StyledEntityPill: import("styled-components").StyledComponent<"div", any, IStyledEntityPill, never>;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { Theme } from '@plurid/plurid-themes';
3
+ import { PluridUIEntityPillData } from "../../../../data/interfaces";
4
+ export interface EntityPillGroupProperties {
5
+ entities: (string | PluridUIEntityPillData)[];
6
+ remove: (id: string) => void;
7
+ keyFix?: string;
8
+ theme?: Theme;
9
+ style?: React.CSSProperties;
10
+ pillStyle?: React.CSSProperties;
11
+ }
12
+ declare const EntityPillGroup: React.FC<EntityPillGroupProperties>;
13
+ export default EntityPillGroup;
@@ -0,0 +1,5 @@
1
+ import { Theme } from '@plurid/plurid-themes';
2
+ export interface IStyledEntityPillGroup {
3
+ theme: Theme;
4
+ }
5
+ export declare const StyledEntityPillGroup: import("styled-components").StyledComponent<"div", any, IStyledEntityPillGroup, never>;
@@ -3,7 +3,9 @@ import { Theme } from '@plurid/plurid-themes';
3
3
  export interface InputDescriptorProperties {
4
4
  name: string;
5
5
  show: boolean;
6
- theme: Theme;
6
+ theme?: Theme;
7
+ style?: React.CSSProperties;
8
+ className?: string;
7
9
  }
8
10
  declare const InputDescriptor: React.FC<InputDescriptorProperties>;
9
11
  export default InputDescriptor;
@@ -1,10 +1,13 @@
1
1
  import React from 'react';
2
+ import { Theme } from '@plurid/plurid-themes';
2
3
  export interface InputSwitchProperties {
3
4
  name: string;
4
5
  checked: boolean;
5
- theme: any;
6
6
  atChange: () => void;
7
+ theme?: Theme;
7
8
  compact?: boolean;
9
+ style?: React.CSSProperties;
10
+ className?: string;
8
11
  }
9
12
  declare const InputSwitch: React.FC<InputSwitchProperties>;
10
13
  export default InputSwitch;
@@ -1,6 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  declare const inputs: {
3
3
  Dropdown: import("react").FC<import("./Dropdown").DropdownProperties>;
4
+ EntityPill: import("react").FC<import("./EntityPill").EntityPillProperties>;
5
+ EntityPillGroup: import("react").FC<import("./EntityPillGroup").EntityPillGroupProperties>;
4
6
  InputBox: import("react").FC<import("./InputBox").InputBoxProperties>;
5
7
  InputDescriptor: import("react").FC<import("./InputDescriptor").InputDescriptorProperties>;
6
8
  InputLine: import("react").FC<import("./InputLine").InputLineProperties>;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { Theme } from '@plurid/plurid-themes';
2
3
  export interface CopyableLineProperties {
3
4
  /**
4
5
  * Data to be copied.
@@ -7,6 +8,7 @@ export interface CopyableLineProperties {
7
8
  /**
8
9
  * Data to be shown.
9
10
  */
11
+ theme?: Theme;
10
12
  viewData?: string;
11
13
  copyMessage?: string;
12
14
  copyMessageTime?: number;
@@ -3,6 +3,10 @@ export interface PluridUIDropdownSelectable {
3
3
  id: string;
4
4
  value: string;
5
5
  }
6
+ export interface PluridUIEntityPillData {
7
+ id: string;
8
+ text?: string;
9
+ }
6
10
  export declare type Small = 'small';
7
11
  export declare type Normal = 'normal';
8
12
  export declare type Large = 'large';
@@ -4,7 +4,7 @@ import themes, { plurid } from "@plurid/plurid-themes";
4
4
 
5
5
  import styled, { createGlobalStyle, keyframes } from "styled-components";
6
6
 
7
- import { PluridIconReset, PluridIconObliterate, PluridIconCopy, PluridIconInfo, PluridIconDelete, PluridIconPlay, PluridIconBranch, PluridIconNewStateline, PluridIconStateShareImage, PluridIconCopyCurrentState, PluridIconCopyStateHistory, PluridIconSittings, PluridIconSpeak } from "@plurid/plurid-icons-react";
7
+ import { PluridIconReset, PluridIconObliterate, PluridIconDelete, PluridIconCopy, PluridIconInfo, PluridIconPlay, PluridIconBranch, PluridIconNewStateline, PluridIconStateShareImage, PluridIconCopyCurrentState, PluridIconCopyStateHistory, PluridIconSittings, PluridIconSpeak } from "@plurid/plurid-icons-react";
8
8
 
9
9
  import { mergeReferences, useMounted, useFalseAfterTimedTrue, createMarkup } from "@plurid/plurid-functions-react";
10
10
 
@@ -1452,9 +1452,65 @@ const Dropdown = properties => {
1452
1452
  })))));
1453
1453
  };
1454
1454
 
1455
+ const StyledEntityPill = styled.div`
1456
+ background-color: ${({theme: theme}) => theme.backgroundColorTertiary};
1457
+ box-shadow: ${({theme: theme}) => theme.boxShadowUmbra};
1458
+
1459
+ padding: 0.5rem 1rem;
1460
+ margin: 0.5rem;
1461
+ border-radius: 20px;
1462
+
1463
+ display: flex;
1464
+ align-items: center;
1465
+ `;
1466
+
1467
+ const EntityPill = properties => {
1468
+ const {id: id, remove: remove, text: text, theme: theme, style: style} = properties;
1469
+ const textValue = text || id;
1470
+ return React.createElement(StyledEntityPill, {
1471
+ theme: theme || plurid,
1472
+ style: Object.assign({}, style)
1473
+ }, React.createElement("div", {
1474
+ style: {
1475
+ marginRight: "0.5rem"
1476
+ }
1477
+ }, textValue), React.createElement(PluridIconDelete, {
1478
+ theme: theme,
1479
+ atClick: () => remove(id)
1480
+ }));
1481
+ };
1482
+
1483
+ const StyledEntityPillGroup = styled.div`
1484
+ display: flex;
1485
+ flex-flow: wrap;
1486
+ margin: 0 auto;
1487
+ justify-content: center;
1488
+ `;
1489
+
1490
+ const EntityPillGroup = properties => {
1491
+ const {entities: entities, remove: remove, keyFix: keyFix, theme: theme, style: style, pillStyle: pillStyle} = properties;
1492
+ return React.createElement(StyledEntityPillGroup, {
1493
+ theme: theme,
1494
+ style: Object.assign({}, style)
1495
+ }, entities.map((entity => {
1496
+ const stringEntity = typeof entity === "string";
1497
+ const id = stringEntity ? entity : entity.id;
1498
+ const text = stringEntity ? undefined : entity.text;
1499
+ return React.createElement(EntityPill, {
1500
+ key: `entity-pill-${id}${keyFix || ""}`,
1501
+ id: id,
1502
+ text: text,
1503
+ remove: remove,
1504
+ theme: theme || plurid,
1505
+ style: pillStyle
1506
+ });
1507
+ })));
1508
+ };
1509
+
1455
1510
  const StyledInputDescriptor = styled.div`
1456
1511
  text-align: left;
1457
1512
  font-size: 0.9rem;
1513
+ line-height: 1;
1458
1514
  min-height: 1.1rem;
1459
1515
  margin-top: 1.3rem;
1460
1516
  margin-bottom: 0.4rem;
@@ -1465,9 +1521,12 @@ const StyledInputDescriptor = styled.div`
1465
1521
  `;
1466
1522
 
1467
1523
  const InputDescriptor = properties => {
1468
- const {name: name, show: show, theme: theme} = properties;
1524
+ const {name: name, show: show, theme: themeProperty, style: style, className: className} = properties;
1525
+ const theme = themeProperty || plurid;
1469
1526
  return React.createElement(StyledInputDescriptor, {
1470
- theme: theme
1527
+ theme: theme,
1528
+ className: className,
1529
+ style: Object.assign({}, style)
1471
1530
  }, show && React.createElement(React.Fragment, null, name));
1472
1531
  };
1473
1532
 
@@ -1677,9 +1736,12 @@ const StyledInputSwitch = styled.div`
1677
1736
  `;
1678
1737
 
1679
1738
  const InputSwitch = properties => {
1680
- const {name: name, checked: checked, atChange: atChange, theme: theme, compact: compact} = properties;
1739
+ const {name: name, checked: checked, atChange: atChange, theme: themeProperty, compact: compact, style: style, className: className} = properties;
1740
+ const theme = themeProperty || plurid;
1681
1741
  return React.createElement(StyledInputSwitch, {
1682
- compact: compact
1742
+ compact: compact,
1743
+ style: Object.assign({}, style),
1744
+ className: className
1683
1745
  }, React.createElement(FormLeftRight, null, React.createElement("div", {
1684
1746
  style: {
1685
1747
  marginLeft: "0.9rem"
@@ -2027,6 +2089,8 @@ const Slider = properties => {
2027
2089
 
2028
2090
  const inputs = {
2029
2091
  Dropdown: Dropdown,
2092
+ EntityPill: EntityPill,
2093
+ EntityPillGroup: EntityPillGroup,
2030
2094
  InputBox: InputBox,
2031
2095
  InputDescriptor: InputDescriptor,
2032
2096
  InputLine: InputLine,
@@ -2371,7 +2435,7 @@ const StyledData = styled.div`
2371
2435
  `;
2372
2436
 
2373
2437
  const CopyableLine = properties => {
2374
- const {data: data, viewData: viewData, copyMessage: copyMessage, copyMessageTime: copyMessageTime, style: style, className: className} = properties;
2438
+ const {data: data, theme: theme, viewData: viewData, copyMessage: copyMessage, copyMessageTime: copyMessageTime, style: style, className: className} = properties;
2375
2439
  const viewDataText = viewData || data;
2376
2440
  const copyMessageText = copyMessage !== null && copyMessage !== void 0 ? copyMessage : "copied";
2377
2441
  const copyMessageTimeValue = copyMessageTime || 2e3;
@@ -2383,7 +2447,8 @@ const CopyableLine = properties => {
2383
2447
  atClick: () => {
2384
2448
  clipboard.copy(data);
2385
2449
  setShowCopyMessage(true);
2386
- }
2450
+ },
2451
+ theme: theme
2387
2452
  }), React.createElement(StyledData, null, showCopyMessage ? React.createElement(React.Fragment, null, copyMessageText) : React.createElement(React.Fragment, null, viewDataText)));
2388
2453
  };
2389
2454