beem-component 2.1.22 → 2.1.23
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/dist/components/Card_v2/Card.js +38 -12
- package/package.json +1 -1
- package/src/App.js +34 -1
- package/src/lib/components/Card_v2/Card.js +29 -16
|
@@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.BmCardv2 = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
-
const _excluded = ["className", "children", "borderColor", "borderWidth"];
|
|
9
|
+
const _excluded = ["className", "children", "borderColor", "borderWidth", "contentHeight"];
|
|
10
10
|
/* eslint-disable func-style */
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
13
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
14
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
14
15
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
@@ -23,10 +24,11 @@ const hexToRgba = function (hex) {
|
|
|
23
24
|
const g = parseInt(normalizedHex.slice(2, 4), 16);
|
|
24
25
|
const b = parseInt(normalizedHex.slice(4, 6), 16);
|
|
25
26
|
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(opacity, ")");
|
|
26
|
-
} catch (
|
|
27
|
+
} catch (_unused) {
|
|
27
28
|
return "rgba(0, 0, 0, ".concat(opacity, ")");
|
|
28
29
|
}
|
|
29
30
|
};
|
|
31
|
+
const CardContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
30
32
|
const StyledCard = _styledComponents.default.div.withConfig({
|
|
31
33
|
displayName: "Card__StyledCard"
|
|
32
34
|
})(["background-color:var(--card,#fff);color:var(--card-foreground,#000);display:flex;flex-direction:column;gap:1.5rem;border-radius:0.75rem;border-style:solid;border-color:", ";border-width:", ";width:100%;"], _ref => {
|
|
@@ -49,25 +51,49 @@ const Title = _styledComponents.default.h4.withConfig({
|
|
|
49
51
|
const Description = _styledComponents.default.p.withConfig({
|
|
50
52
|
displayName: "Card__Description"
|
|
51
53
|
})(["color:var(--muted-foreground,#666);margin:0;"]);
|
|
52
|
-
const
|
|
53
|
-
displayName: "
|
|
54
|
-
})(["min-height:
|
|
54
|
+
const ContentWrapper = _styledComponents.default.div.withConfig({
|
|
55
|
+
displayName: "Card__ContentWrapper"
|
|
56
|
+
})(["min-height:", ";padding:0 1.5rem;max-height:calc(100vh - 28.5714rem);overflow-y:auto;scrollbar-width:thin;scrollbar-color:", " transparent;&::-webkit-scrollbar-thumb{background:", ";border-radius:0.6429rem;transition:background 0.2s ease;}&::-webkit-scrollbar-thumb:hover{background:", ";}&:last-child{padding-bottom:1.5rem;}@media (max-width:54.8571rem){max-height:calc(100vh - 17.8572rem);}"], _ref3 => {
|
|
57
|
+
let {
|
|
58
|
+
$contentHeight
|
|
59
|
+
} = _ref3;
|
|
60
|
+
return $contentHeight || '14.2857rem';
|
|
61
|
+
}, () => hexToRgba('#33b1ba', 0.2), () => hexToRgba('#33b1ba', 0.3), () => hexToRgba('#33b1ba', 0.4));
|
|
62
|
+
function Content(_ref4) {
|
|
63
|
+
let {
|
|
64
|
+
children,
|
|
65
|
+
style
|
|
66
|
+
} = _ref4;
|
|
67
|
+
const {
|
|
68
|
+
contentHeight
|
|
69
|
+
} = (0, _react.useContext)(CardContext);
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(ContentWrapper, {
|
|
71
|
+
$contentHeight: contentHeight,
|
|
72
|
+
style: style
|
|
73
|
+
}, children);
|
|
74
|
+
}
|
|
55
75
|
const Footer = _styledComponents.default.div.withConfig({
|
|
56
76
|
displayName: "Card__Footer"
|
|
57
77
|
})(["display:flex;justify-content:space-between;align-items:center;padding:0 1.5rem 1.5rem 1.5rem;gap:1rem;@media (max-width:42.8571rem){flex-direction:column;align-items:stretch;& > *{width:100%;}}"]);
|
|
58
|
-
function CardComponent(
|
|
78
|
+
function CardComponent(_ref5) {
|
|
59
79
|
let {
|
|
60
80
|
className,
|
|
61
81
|
children,
|
|
62
82
|
borderColor,
|
|
63
|
-
borderWidth
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
83
|
+
borderWidth,
|
|
84
|
+
contentHeight
|
|
85
|
+
} = _ref5,
|
|
86
|
+
props = _objectWithoutProperties(_ref5, _excluded);
|
|
87
|
+
const contextValue = {
|
|
88
|
+
contentHeight
|
|
89
|
+
};
|
|
90
|
+
return /*#__PURE__*/_react.default.createElement(CardContext.Provider, {
|
|
91
|
+
value: contextValue
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement(StyledCard, _extends({
|
|
67
93
|
className: className,
|
|
68
94
|
borderColor: borderColor,
|
|
69
95
|
borderWidth: borderWidth
|
|
70
|
-
}, props), children);
|
|
96
|
+
}, props), children));
|
|
71
97
|
}
|
|
72
98
|
const BmCardv2 = exports.BmCardv2 = Object.assign(CardComponent, {
|
|
73
99
|
Header,
|
package/package.json
CHANGED
package/src/App.js
CHANGED
|
@@ -17,7 +17,7 @@ import React from 'react';
|
|
|
17
17
|
// import PeopleIcon from '@mui/icons-material/People';
|
|
18
18
|
// import BusinessIcon from '@mui/icons-material/Business';
|
|
19
19
|
|
|
20
|
-
import { BmChat, GlobalStyle } from './lib/components';
|
|
20
|
+
import { BmChat, GlobalStyle, BmCardv2, BmButton } from './lib/components';
|
|
21
21
|
// import AlertBox from './lib/components/Alert/Alert';
|
|
22
22
|
|
|
23
23
|
// import ProgressIndicator from './lib/components/newProgress';
|
|
@@ -842,6 +842,39 @@ const Chat = () => {
|
|
|
842
842
|
</BmChat.Details>
|
|
843
843
|
)
|
|
844
844
|
)}
|
|
845
|
+
<BmCardv2 borderColor="#d62a2af" borderWidth="1.5px" contentHeight="0">
|
|
846
|
+
<BmCardv2.Header>
|
|
847
|
+
<BmCardv2.Title>Appointment Summary</BmCardv2.Title>
|
|
848
|
+
<BmCardv2.Description>
|
|
849
|
+
This BmCardv2 shows a quick overview of your booking.
|
|
850
|
+
</BmCardv2.Description>
|
|
851
|
+
</BmCardv2.Header>
|
|
852
|
+
<BmCardv2.Content>
|
|
853
|
+
<p>
|
|
854
|
+
<strong>Type:</strong> Consultation
|
|
855
|
+
</p>
|
|
856
|
+
<p>
|
|
857
|
+
<strong>Date:</strong> June 24, 2025
|
|
858
|
+
</p>
|
|
859
|
+
<p>
|
|
860
|
+
<strong>Doctor:</strong> Dr. Smith
|
|
861
|
+
</p>
|
|
862
|
+
</BmCardv2.Content>
|
|
863
|
+
<BmCardv2.Footer>
|
|
864
|
+
<BmButton width="100%" size="medium" variant="primary">
|
|
865
|
+
Edit
|
|
866
|
+
</BmButton>
|
|
867
|
+
<BmButton
|
|
868
|
+
borderColor="#000000"
|
|
869
|
+
width="100%"
|
|
870
|
+
size="medium"
|
|
871
|
+
variant="secondary"
|
|
872
|
+
color="#000000"
|
|
873
|
+
>
|
|
874
|
+
Cancel
|
|
875
|
+
</BmButton>
|
|
876
|
+
</BmCardv2.Footer>
|
|
877
|
+
</BmCardv2>
|
|
845
878
|
</>
|
|
846
879
|
);
|
|
847
880
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable func-style */
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { createContext, useContext } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
|
|
5
5
|
const hexToRgba = (hex, opacity = 0.6) => {
|
|
@@ -12,16 +12,17 @@ const hexToRgba = (hex, opacity = 0.6) => {
|
|
|
12
12
|
) {
|
|
13
13
|
throw new Error('Invalid hex');
|
|
14
14
|
}
|
|
15
|
-
|
|
16
15
|
const r = parseInt(normalizedHex.slice(0, 2), 16);
|
|
17
16
|
const g = parseInt(normalizedHex.slice(2, 4), 16);
|
|
18
17
|
const b = parseInt(normalizedHex.slice(4, 6), 16);
|
|
19
18
|
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
20
|
-
} catch
|
|
19
|
+
} catch {
|
|
21
20
|
return `rgba(0, 0, 0, ${opacity})`;
|
|
22
21
|
}
|
|
23
22
|
};
|
|
24
23
|
|
|
24
|
+
const CardContext = createContext({});
|
|
25
|
+
|
|
25
26
|
const StyledCard = styled.div`
|
|
26
27
|
background-color: var(--card, #fff);
|
|
27
28
|
color: var(--card-foreground, #000);
|
|
@@ -53,12 +54,11 @@ const Description = styled.p`
|
|
|
53
54
|
margin: 0;
|
|
54
55
|
`;
|
|
55
56
|
|
|
56
|
-
const
|
|
57
|
-
min-height:
|
|
57
|
+
const ContentWrapper = styled.div`
|
|
58
|
+
min-height: ${({ $contentHeight }) => $contentHeight || '14.2857rem'};
|
|
58
59
|
padding: 0 1.5rem;
|
|
59
60
|
max-height: calc(100vh - 28.5714rem);
|
|
60
61
|
overflow-y: auto;
|
|
61
|
-
|
|
62
62
|
scrollbar-width: thin;
|
|
63
63
|
scrollbar-color: ${() => hexToRgba('#33b1ba', 0.2)} transparent;
|
|
64
64
|
|
|
@@ -69,7 +69,7 @@ const Content = styled.div`
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
&::-webkit-scrollbar-thumb:hover {
|
|
72
|
-
background: ${() => hexToRgba('#33b1ba', 0.
|
|
72
|
+
background: ${() => hexToRgba('#33b1ba', 0.4)};
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
&:last-child {
|
|
@@ -81,6 +81,15 @@ const Content = styled.div`
|
|
|
81
81
|
}
|
|
82
82
|
`;
|
|
83
83
|
|
|
84
|
+
function Content({ children, style }) {
|
|
85
|
+
const { contentHeight } = useContext(CardContext);
|
|
86
|
+
return (
|
|
87
|
+
<ContentWrapper $contentHeight={contentHeight} style={style}>
|
|
88
|
+
{children}
|
|
89
|
+
</ContentWrapper>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
84
93
|
const Footer = styled.div`
|
|
85
94
|
display: flex;
|
|
86
95
|
justify-content: space-between;
|
|
@@ -91,7 +100,6 @@ const Footer = styled.div`
|
|
|
91
100
|
@media (max-width: 42.8571rem) {
|
|
92
101
|
flex-direction: column;
|
|
93
102
|
align-items: stretch;
|
|
94
|
-
|
|
95
103
|
& > * {
|
|
96
104
|
width: 100%;
|
|
97
105
|
}
|
|
@@ -103,17 +111,22 @@ function CardComponent({
|
|
|
103
111
|
children,
|
|
104
112
|
borderColor,
|
|
105
113
|
borderWidth,
|
|
114
|
+
contentHeight,
|
|
106
115
|
...props
|
|
107
116
|
}) {
|
|
117
|
+
const contextValue = { contentHeight };
|
|
118
|
+
|
|
108
119
|
return (
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
<CardContext.Provider value={contextValue}>
|
|
121
|
+
<StyledCard
|
|
122
|
+
className={className}
|
|
123
|
+
borderColor={borderColor}
|
|
124
|
+
borderWidth={borderWidth}
|
|
125
|
+
{...props}
|
|
126
|
+
>
|
|
127
|
+
{children}
|
|
128
|
+
</StyledCard>
|
|
129
|
+
</CardContext.Provider>
|
|
117
130
|
);
|
|
118
131
|
}
|
|
119
132
|
|