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

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>;
@@ -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>;
@@ -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,6 +1452,61 @@ 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;
@@ -2027,6 +2082,8 @@ const Slider = properties => {
2027
2082
 
2028
2083
  const inputs = {
2029
2084
  Dropdown: Dropdown,
2085
+ EntityPill: EntityPill,
2086
+ EntityPillGroup: EntityPillGroup,
2030
2087
  InputBox: InputBox,
2031
2088
  InputDescriptor: InputDescriptor,
2032
2089
  InputLine: InputLine,