@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
package/distribution/index.js
CHANGED
|
@@ -1528,6 +1528,7 @@ const EntityPillGroup = properties => {
|
|
|
1528
1528
|
const StyledInputDescriptor = styled__default["default"].div`
|
|
1529
1529
|
text-align: left;
|
|
1530
1530
|
font-size: 0.9rem;
|
|
1531
|
+
line-height: 1;
|
|
1531
1532
|
min-height: 1.1rem;
|
|
1532
1533
|
margin-top: 1.3rem;
|
|
1533
1534
|
margin-bottom: 0.4rem;
|
|
@@ -1538,9 +1539,12 @@ const StyledInputDescriptor = styled__default["default"].div`
|
|
|
1538
1539
|
`;
|
|
1539
1540
|
|
|
1540
1541
|
const InputDescriptor = properties => {
|
|
1541
|
-
const {name: name, show: show, theme:
|
|
1542
|
+
const {name: name, show: show, theme: themeProperty, style: style, className: className} = properties;
|
|
1543
|
+
const theme = themeProperty || themes.plurid;
|
|
1542
1544
|
return React__default["default"].createElement(StyledInputDescriptor, {
|
|
1543
|
-
theme: theme
|
|
1545
|
+
theme: theme,
|
|
1546
|
+
className: className,
|
|
1547
|
+
style: Object.assign({}, style)
|
|
1544
1548
|
}, show && React__default["default"].createElement(React__default["default"].Fragment, null, name));
|
|
1545
1549
|
};
|
|
1546
1550
|
|
|
@@ -1636,17 +1640,26 @@ const StyledSwitch = styled__default["default"].label`
|
|
|
1636
1640
|
}
|
|
1637
1641
|
`;
|
|
1638
1642
|
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
left: 0;
|
|
1644
|
-
right: 0;
|
|
1645
|
-
bottom: 0;
|
|
1646
|
-
transition: .4s ease-in-out;
|
|
1647
|
-
box-shadow: inset 0 2px 3px black;
|
|
1643
|
+
const levelBackgroundColor = props => {
|
|
1644
|
+
switch (props.level) {
|
|
1645
|
+
case 0:
|
|
1646
|
+
return props.theme.backgroundColorPrimary;
|
|
1648
1647
|
|
|
1649
|
-
|
|
1648
|
+
case 1:
|
|
1649
|
+
return props.theme.backgroundColorSecondary;
|
|
1650
|
+
|
|
1651
|
+
case 2:
|
|
1652
|
+
return props.theme.backgroundColorTertiary;
|
|
1653
|
+
|
|
1654
|
+
case 3:
|
|
1655
|
+
return props.theme.backgroundColorQuaternary;
|
|
1656
|
+
|
|
1657
|
+
default:
|
|
1658
|
+
return props.theme.backgroundColorPrimary;
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
|
|
1662
|
+
const backgroundColor = props => {
|
|
1650
1663
|
if (props.accent) {
|
|
1651
1664
|
return props.accent;
|
|
1652
1665
|
}
|
|
@@ -1668,23 +1681,20 @@ const StyledSwitchSlider = styled__default["default"].span`
|
|
|
1668
1681
|
return props.theme.backgroundColorPrimaryAlpha;
|
|
1669
1682
|
}
|
|
1670
1683
|
}
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
return props.theme.backgroundColorPrimary;
|
|
1674
|
-
|
|
1675
|
-
case 1:
|
|
1676
|
-
return props.theme.backgroundColorSecondary;
|
|
1677
|
-
|
|
1678
|
-
case 2:
|
|
1679
|
-
return props.theme.backgroundColorTertiary;
|
|
1684
|
+
return levelBackgroundColor(props);
|
|
1685
|
+
};
|
|
1680
1686
|
|
|
1681
|
-
|
|
1682
|
-
|
|
1687
|
+
const StyledSwitchSlider = styled__default["default"].span`
|
|
1688
|
+
position: absolute;
|
|
1689
|
+
cursor: pointer;
|
|
1690
|
+
top: 0;
|
|
1691
|
+
left: 0;
|
|
1692
|
+
right: 0;
|
|
1693
|
+
bottom: 0;
|
|
1694
|
+
transition: .4s ease-in-out;
|
|
1695
|
+
box-shadow: inset 0 2px 3px black;
|
|
1683
1696
|
|
|
1684
|
-
|
|
1685
|
-
return props.theme.backgroundColorPrimary;
|
|
1686
|
-
}
|
|
1687
|
-
}};
|
|
1697
|
+
background-color: ${props => backgroundColor(props)};
|
|
1688
1698
|
border-radius: ${props => {
|
|
1689
1699
|
if (props.round) {
|
|
1690
1700
|
return "34px";
|
|
@@ -1717,25 +1727,44 @@ const StyledSwitchSlider = styled__default["default"].span`
|
|
|
1717
1727
|
}
|
|
1718
1728
|
`;
|
|
1719
1729
|
|
|
1730
|
+
const StyledSwitchIcon = styled__default["default"].div`
|
|
1731
|
+
height: 100%;
|
|
1732
|
+
position: absolute;
|
|
1733
|
+
top: 0;
|
|
1734
|
+
display: flex;
|
|
1735
|
+
align-items: center;
|
|
1736
|
+
transition: .4s;
|
|
1737
|
+
|
|
1738
|
+
svg {
|
|
1739
|
+
fill: ${props => levelBackgroundColor(props)};
|
|
1740
|
+
}
|
|
1741
|
+
`;
|
|
1742
|
+
|
|
1720
1743
|
const Switch = properties => {
|
|
1721
|
-
const {checked: checked, theme: theme, level: level, round: round, exclusive: exclusive, accent: accent, atChange: atChange} = properties;
|
|
1744
|
+
const {checked: checked, theme: theme, level: level, round: round, exclusive: exclusive, accent: accent, Icon: Icon, atChange: atChange} = properties;
|
|
1722
1745
|
const _theme = theme || themes.plurid;
|
|
1723
1746
|
const _level = level === undefined ? 0 : level;
|
|
1724
1747
|
const _round = round === undefined ? true : round;
|
|
1748
|
+
const commonProperties = {
|
|
1749
|
+
theme: _theme,
|
|
1750
|
+
level: _level,
|
|
1751
|
+
exclusive: exclusive,
|
|
1752
|
+
checked: checked,
|
|
1753
|
+
accent: accent
|
|
1754
|
+
};
|
|
1725
1755
|
return React__default["default"].createElement(StyledSwitch, {
|
|
1726
1756
|
theme: _theme
|
|
1727
1757
|
}, React__default["default"].createElement("input", {
|
|
1728
1758
|
type: "checkbox",
|
|
1729
1759
|
checked: checked,
|
|
1730
1760
|
onChange: () => atChange()
|
|
1731
|
-
}), React__default["default"].createElement(StyledSwitchSlider, {
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
}));
|
|
1761
|
+
}), React__default["default"].createElement(StyledSwitchSlider, Object.assign({
|
|
1762
|
+
round: _round
|
|
1763
|
+
}, commonProperties)), Icon && React__default["default"].createElement(StyledSwitchIcon, Object.assign({}, commonProperties, {
|
|
1764
|
+
style: {
|
|
1765
|
+
left: checked ? "35px" : "9px"
|
|
1766
|
+
}
|
|
1767
|
+
}), React__default["default"].createElement(Icon, null)));
|
|
1739
1768
|
};
|
|
1740
1769
|
|
|
1741
1770
|
const StyledInputSwitch = styled__default["default"].div`
|
|
@@ -1750,9 +1779,12 @@ const StyledInputSwitch = styled__default["default"].div`
|
|
|
1750
1779
|
`;
|
|
1751
1780
|
|
|
1752
1781
|
const InputSwitch = properties => {
|
|
1753
|
-
const {name: name, checked: checked, atChange: atChange, theme:
|
|
1782
|
+
const {name: name, checked: checked, atChange: atChange, theme: themeProperty, compact: compact, style: style, className: className} = properties;
|
|
1783
|
+
const theme = themeProperty || themes.plurid;
|
|
1754
1784
|
return React__default["default"].createElement(StyledInputSwitch, {
|
|
1755
|
-
compact: compact
|
|
1785
|
+
compact: compact,
|
|
1786
|
+
style: Object.assign({}, style),
|
|
1787
|
+
className: className
|
|
1756
1788
|
}, React__default["default"].createElement(FormLeftRight, null, React__default["default"].createElement("div", {
|
|
1757
1789
|
style: {
|
|
1758
1790
|
marginLeft: "0.9rem"
|
|
@@ -2446,7 +2478,7 @@ const StyledData = styled__default["default"].div`
|
|
|
2446
2478
|
`;
|
|
2447
2479
|
|
|
2448
2480
|
const CopyableLine = properties => {
|
|
2449
|
-
const {data: data, viewData: viewData, copyMessage: copyMessage, copyMessageTime: copyMessageTime, style: style, className: className} = properties;
|
|
2481
|
+
const {data: data, theme: theme, viewData: viewData, copyMessage: copyMessage, copyMessageTime: copyMessageTime, style: style, className: className} = properties;
|
|
2450
2482
|
const viewDataText = viewData || data;
|
|
2451
2483
|
const copyMessageText = copyMessage !== null && copyMessage !== void 0 ? copyMessage : "copied";
|
|
2452
2484
|
const copyMessageTimeValue = copyMessageTime || 2e3;
|
|
@@ -2458,7 +2490,8 @@ const CopyableLine = properties => {
|
|
|
2458
2490
|
atClick: () => {
|
|
2459
2491
|
pluridFunctions.clipboard.copy(data);
|
|
2460
2492
|
setShowCopyMessage(true);
|
|
2461
|
-
}
|
|
2493
|
+
},
|
|
2494
|
+
theme: theme
|
|
2462
2495
|
}), React__default["default"].createElement(StyledData, null, showCopyMessage ? React__default["default"].createElement(React__default["default"].Fragment, null, copyMessageText) : React__default["default"].createElement(React__default["default"].Fragment, null, viewDataText)));
|
|
2463
2496
|
};
|
|
2464
2497
|
|