@plurid/plurid-ui-components-react 0.0.0-5 → 0.0.0-9
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/distribution/components/universal/inputs/InputDescriptor/index.d.ts +3 -1
- package/distribution/components/universal/inputs/InputSwitch/index.d.ts +4 -1
- package/distribution/components/universal/inputs/Switch/index.d.ts +1 -0
- package/distribution/components/universal/inputs/Switch/styled.d.ts +1 -0
- package/distribution/components/universal/varia/CopyableLine/index.d.ts +2 -0
- package/distribution/index.es.js +73 -40
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +73 -40
- package/distribution/index.js.map +1 -1
- package/package.json +30 -30
|
@@ -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
|
|
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,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;
|
package/distribution/index.es.js
CHANGED
|
@@ -1510,6 +1510,7 @@ const EntityPillGroup = properties => {
|
|
|
1510
1510
|
const StyledInputDescriptor = styled.div`
|
|
1511
1511
|
text-align: left;
|
|
1512
1512
|
font-size: 0.9rem;
|
|
1513
|
+
line-height: 1;
|
|
1513
1514
|
min-height: 1.1rem;
|
|
1514
1515
|
margin-top: 1.3rem;
|
|
1515
1516
|
margin-bottom: 0.4rem;
|
|
@@ -1520,9 +1521,12 @@ const StyledInputDescriptor = styled.div`
|
|
|
1520
1521
|
`;
|
|
1521
1522
|
|
|
1522
1523
|
const InputDescriptor = properties => {
|
|
1523
|
-
const {name: name, show: show, theme:
|
|
1524
|
+
const {name: name, show: show, theme: themeProperty, style: style, className: className} = properties;
|
|
1525
|
+
const theme = themeProperty || plurid;
|
|
1524
1526
|
return React.createElement(StyledInputDescriptor, {
|
|
1525
|
-
theme: theme
|
|
1527
|
+
theme: theme,
|
|
1528
|
+
className: className,
|
|
1529
|
+
style: Object.assign({}, style)
|
|
1526
1530
|
}, show && React.createElement(React.Fragment, null, name));
|
|
1527
1531
|
};
|
|
1528
1532
|
|
|
@@ -1618,17 +1622,26 @@ const StyledSwitch = styled.label`
|
|
|
1618
1622
|
}
|
|
1619
1623
|
`;
|
|
1620
1624
|
|
|
1621
|
-
const
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
left: 0;
|
|
1626
|
-
right: 0;
|
|
1627
|
-
bottom: 0;
|
|
1628
|
-
transition: .4s ease-in-out;
|
|
1629
|
-
box-shadow: inset 0 2px 3px black;
|
|
1625
|
+
const levelBackgroundColor = props => {
|
|
1626
|
+
switch (props.level) {
|
|
1627
|
+
case 0:
|
|
1628
|
+
return props.theme.backgroundColorPrimary;
|
|
1630
1629
|
|
|
1631
|
-
|
|
1630
|
+
case 1:
|
|
1631
|
+
return props.theme.backgroundColorSecondary;
|
|
1632
|
+
|
|
1633
|
+
case 2:
|
|
1634
|
+
return props.theme.backgroundColorTertiary;
|
|
1635
|
+
|
|
1636
|
+
case 3:
|
|
1637
|
+
return props.theme.backgroundColorQuaternary;
|
|
1638
|
+
|
|
1639
|
+
default:
|
|
1640
|
+
return props.theme.backgroundColorPrimary;
|
|
1641
|
+
}
|
|
1642
|
+
};
|
|
1643
|
+
|
|
1644
|
+
const backgroundColor = props => {
|
|
1632
1645
|
if (props.accent) {
|
|
1633
1646
|
return props.accent;
|
|
1634
1647
|
}
|
|
@@ -1650,23 +1663,20 @@ const StyledSwitchSlider = styled.span`
|
|
|
1650
1663
|
return props.theme.backgroundColorPrimaryAlpha;
|
|
1651
1664
|
}
|
|
1652
1665
|
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
return props.theme.backgroundColorPrimary;
|
|
1656
|
-
|
|
1657
|
-
case 1:
|
|
1658
|
-
return props.theme.backgroundColorSecondary;
|
|
1659
|
-
|
|
1660
|
-
case 2:
|
|
1661
|
-
return props.theme.backgroundColorTertiary;
|
|
1666
|
+
return levelBackgroundColor(props);
|
|
1667
|
+
};
|
|
1662
1668
|
|
|
1663
|
-
|
|
1664
|
-
|
|
1669
|
+
const StyledSwitchSlider = styled.span`
|
|
1670
|
+
position: absolute;
|
|
1671
|
+
cursor: pointer;
|
|
1672
|
+
top: 0;
|
|
1673
|
+
left: 0;
|
|
1674
|
+
right: 0;
|
|
1675
|
+
bottom: 0;
|
|
1676
|
+
transition: .4s ease-in-out;
|
|
1677
|
+
box-shadow: inset 0 2px 3px black;
|
|
1665
1678
|
|
|
1666
|
-
|
|
1667
|
-
return props.theme.backgroundColorPrimary;
|
|
1668
|
-
}
|
|
1669
|
-
}};
|
|
1679
|
+
background-color: ${props => backgroundColor(props)};
|
|
1670
1680
|
border-radius: ${props => {
|
|
1671
1681
|
if (props.round) {
|
|
1672
1682
|
return "34px";
|
|
@@ -1699,25 +1709,44 @@ const StyledSwitchSlider = styled.span`
|
|
|
1699
1709
|
}
|
|
1700
1710
|
`;
|
|
1701
1711
|
|
|
1712
|
+
const StyledSwitchIcon = styled.div`
|
|
1713
|
+
height: 100%;
|
|
1714
|
+
position: absolute;
|
|
1715
|
+
top: 0;
|
|
1716
|
+
display: flex;
|
|
1717
|
+
align-items: center;
|
|
1718
|
+
transition: .4s;
|
|
1719
|
+
|
|
1720
|
+
svg {
|
|
1721
|
+
fill: ${props => levelBackgroundColor(props)};
|
|
1722
|
+
}
|
|
1723
|
+
`;
|
|
1724
|
+
|
|
1702
1725
|
const Switch = properties => {
|
|
1703
|
-
const {checked: checked, theme: theme, level: level, round: round, exclusive: exclusive, accent: accent, atChange: atChange} = properties;
|
|
1726
|
+
const {checked: checked, theme: theme, level: level, round: round, exclusive: exclusive, accent: accent, Icon: Icon, atChange: atChange} = properties;
|
|
1704
1727
|
const _theme = theme || plurid;
|
|
1705
1728
|
const _level = level === undefined ? 0 : level;
|
|
1706
1729
|
const _round = round === undefined ? true : round;
|
|
1730
|
+
const commonProperties = {
|
|
1731
|
+
theme: _theme,
|
|
1732
|
+
level: _level,
|
|
1733
|
+
exclusive: exclusive,
|
|
1734
|
+
checked: checked,
|
|
1735
|
+
accent: accent
|
|
1736
|
+
};
|
|
1707
1737
|
return React.createElement(StyledSwitch, {
|
|
1708
1738
|
theme: _theme
|
|
1709
1739
|
}, React.createElement("input", {
|
|
1710
1740
|
type: "checkbox",
|
|
1711
1741
|
checked: checked,
|
|
1712
1742
|
onChange: () => atChange()
|
|
1713
|
-
}), React.createElement(StyledSwitchSlider, {
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
}));
|
|
1743
|
+
}), React.createElement(StyledSwitchSlider, Object.assign({
|
|
1744
|
+
round: _round
|
|
1745
|
+
}, commonProperties)), Icon && React.createElement(StyledSwitchIcon, Object.assign({}, commonProperties, {
|
|
1746
|
+
style: {
|
|
1747
|
+
left: checked ? "35px" : "9px"
|
|
1748
|
+
}
|
|
1749
|
+
}), React.createElement(Icon, null)));
|
|
1721
1750
|
};
|
|
1722
1751
|
|
|
1723
1752
|
const StyledInputSwitch = styled.div`
|
|
@@ -1732,9 +1761,12 @@ const StyledInputSwitch = styled.div`
|
|
|
1732
1761
|
`;
|
|
1733
1762
|
|
|
1734
1763
|
const InputSwitch = properties => {
|
|
1735
|
-
const {name: name, checked: checked, atChange: atChange, theme:
|
|
1764
|
+
const {name: name, checked: checked, atChange: atChange, theme: themeProperty, compact: compact, style: style, className: className} = properties;
|
|
1765
|
+
const theme = themeProperty || plurid;
|
|
1736
1766
|
return React.createElement(StyledInputSwitch, {
|
|
1737
|
-
compact: compact
|
|
1767
|
+
compact: compact,
|
|
1768
|
+
style: Object.assign({}, style),
|
|
1769
|
+
className: className
|
|
1738
1770
|
}, React.createElement(FormLeftRight, null, React.createElement("div", {
|
|
1739
1771
|
style: {
|
|
1740
1772
|
marginLeft: "0.9rem"
|
|
@@ -2428,7 +2460,7 @@ const StyledData = styled.div`
|
|
|
2428
2460
|
`;
|
|
2429
2461
|
|
|
2430
2462
|
const CopyableLine = properties => {
|
|
2431
|
-
const {data: data, viewData: viewData, copyMessage: copyMessage, copyMessageTime: copyMessageTime, style: style, className: className} = properties;
|
|
2463
|
+
const {data: data, theme: theme, viewData: viewData, copyMessage: copyMessage, copyMessageTime: copyMessageTime, style: style, className: className} = properties;
|
|
2432
2464
|
const viewDataText = viewData || data;
|
|
2433
2465
|
const copyMessageText = copyMessage !== null && copyMessage !== void 0 ? copyMessage : "copied";
|
|
2434
2466
|
const copyMessageTimeValue = copyMessageTime || 2e3;
|
|
@@ -2440,7 +2472,8 @@ const CopyableLine = properties => {
|
|
|
2440
2472
|
atClick: () => {
|
|
2441
2473
|
clipboard.copy(data);
|
|
2442
2474
|
setShowCopyMessage(true);
|
|
2443
|
-
}
|
|
2475
|
+
},
|
|
2476
|
+
theme: theme
|
|
2444
2477
|
}), React.createElement(StyledData, null, showCopyMessage ? React.createElement(React.Fragment, null, copyMessageText) : React.createElement(React.Fragment, null, viewDataText)));
|
|
2445
2478
|
};
|
|
2446
2479
|
|