frst-components 0.22.87 → 0.22.88
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/index.js
CHANGED
|
@@ -3247,7 +3247,80 @@ gap: 10px;
|
|
|
3247
3247
|
${({ lastVote }) => lastVote === false && "border-bottom: solid 1px #ccc;"}
|
|
3248
3248
|
`;
|
|
3249
3249
|
|
|
3250
|
-
const
|
|
3250
|
+
const container = styled__default["default"].div `
|
|
3251
|
+
display: flex;
|
|
3252
|
+
justify-content: center;
|
|
3253
|
+
align-items: center;
|
|
3254
|
+
flex-direction: ${({ textPosition }) => textPosition === 'left' ? 'row-reverse'
|
|
3255
|
+
: textPosition === 'right' ? 'row'
|
|
3256
|
+
: textPosition === 'top' ? 'column-reverse'
|
|
3257
|
+
: textPosition === 'bottom' ? 'column'
|
|
3258
|
+
: null};
|
|
3259
|
+
position: relative;
|
|
3260
|
+
width: auto;
|
|
3261
|
+
gap: 8px;
|
|
3262
|
+
padding: 16px;
|
|
3263
|
+
`;
|
|
3264
|
+
const loader = styled__default["default"].div `
|
|
3265
|
+
|
|
3266
|
+
svg {
|
|
3267
|
+
animation: load 1.5s infinite linear;
|
|
3268
|
+
|
|
3269
|
+
@keyframes load {
|
|
3270
|
+
0% {
|
|
3271
|
+
transform: rotate(0deg);
|
|
3272
|
+
}
|
|
3273
|
+
100% {
|
|
3274
|
+
transform: rotate(360deg);
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
`;
|
|
3279
|
+
const loadText = styled__default["default"].p `
|
|
3280
|
+
font-family: 'Inter';
|
|
3281
|
+
font-size: 14px;
|
|
3282
|
+
font-weight: 400;
|
|
3283
|
+
line-height: 20px;
|
|
3284
|
+
`;
|
|
3285
|
+
|
|
3286
|
+
function Loading(props) {
|
|
3287
|
+
const [Size, setSize] = React.useState('24');
|
|
3288
|
+
const [Color, setColor] = React.useState(props.loadColor ? props.loadColor : '');
|
|
3289
|
+
const [PositionTextLoad, setPositionTextLoad] = React.useState(props.positionLoadingText ? props.positionLoadingText : 'bottom');
|
|
3290
|
+
const [LoadText, setLoadText] = React.useState(props.loadText ? props.loadText : '');
|
|
3291
|
+
React.useEffect(() => {
|
|
3292
|
+
setLoadText(props.loadText);
|
|
3293
|
+
}, [props.loadText]);
|
|
3294
|
+
React.useEffect(() => {
|
|
3295
|
+
setColor(props.loadColor);
|
|
3296
|
+
}, [props.loadColor]);
|
|
3297
|
+
React.useEffect(() => {
|
|
3298
|
+
setPositionTextLoad(props.positionLoadingText);
|
|
3299
|
+
}, [props.positionLoadingText]);
|
|
3300
|
+
React.useEffect(() => {
|
|
3301
|
+
if (props.sizeLoading === 'extra-small') {
|
|
3302
|
+
setSize('16');
|
|
3303
|
+
}
|
|
3304
|
+
else if (props.sizeLoading === 'small') {
|
|
3305
|
+
setSize('20');
|
|
3306
|
+
}
|
|
3307
|
+
else if (props.sizeLoading === 'medium') {
|
|
3308
|
+
setSize('24');
|
|
3309
|
+
}
|
|
3310
|
+
else if (props.sizeLoading === 'large') {
|
|
3311
|
+
setSize('32');
|
|
3312
|
+
}
|
|
3313
|
+
else if (props.sizeLoading === 'extra-large') {
|
|
3314
|
+
setSize('40');
|
|
3315
|
+
}
|
|
3316
|
+
else {
|
|
3317
|
+
setSize('24');
|
|
3318
|
+
}
|
|
3319
|
+
}, [props.sizeLoading]);
|
|
3320
|
+
return (jsxRuntime.jsx(styled.ThemeProvider, { theme: FRSTTheme, children: jsxRuntime.jsxs(container, { textPosition: PositionTextLoad, style: { ...props.style }, children: [jsxRuntime.jsx(loader, { children: jsxRuntime.jsx(Load, { width: Size, height: Size, fill: Color !== '' && Color }) }), jsxRuntime.jsx(loadText, { style: { color: props.loadTextColor ? props.loadTextColor : 'white' }, children: LoadText })] }) }));
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
const HypothesisComponent = ({ description, type, id, title, votes = [], onVote, canVote = false, canViewVote = false, userLoggedId, deleteVote, canViewListVotes, votesSingularText, votesPluralText, voteText, deleteVoteText, handleViewProfile, avatar, showAvatar, authorId, hasVoteGoal, loading }) => {
|
|
3251
3324
|
const [isHover, seIsHover] = React.useState(false);
|
|
3252
3325
|
const [hasVoteHypothesis, setHasVoteHypothesis] = React.useState(votes?.some((vote) => vote?.user_uuid === userLoggedId));
|
|
3253
3326
|
const [hypothesisVotes, setHypothesisVotes] = React.useState(votes);
|
|
@@ -3302,24 +3375,24 @@ const HypothesisComponent = ({ description, type, id, title, votes = [], onVote,
|
|
|
3302
3375
|
setHasVoteHypothesis(false);
|
|
3303
3376
|
}
|
|
3304
3377
|
};
|
|
3305
|
-
return (jsxRuntime.jsx(MainContainer, { children: jsxRuntime.jsxs(Container$l, { type: type, id: id, ref: ContainerRef, children: [jsxRuntime.jsxs(SplitContainer, { children: [showAvatar && (jsxRuntime.jsx(Avatar, { src: avatar, size: "24px", style: { marginRight: '8px', cursor: authorId ? 'pointer' : 'default' }, onClick: () => handleViewProfile(authorId) })), jsxRuntime.jsx(Title$6, { children: title }), jsxRuntime.jsx(Separator, { children: "|" }), jsxRuntime.jsx(Description$3, { children: description })] }), !canVote && canViewVote && hypothesisVotes?.length > 0 && (jsxRuntime.jsxs("div", { style: { position: 'relative', height: '100%' }, children: [jsxRuntime.jsx(SplitContainer, { children: jsxRuntime.jsx(VoteButtonContainer, { ref: viewVotesRef, height: heightContainer, style: { cursor: canViewListVotes ? 'pointer' : 'default' }, type: type, onClick: canViewListVotes ? toggleVotes : null, children: jsxRuntime.jsxs(VoteCount, { children: [jsxRuntime.jsxs(VoteContent, { children: [hypothesisVotes?.slice(0, 2)?.map((vote, index) => {
|
|
3378
|
+
return (jsxRuntime.jsx(MainContainer, { children: jsxRuntime.jsxs(Container$l, { type: type, id: id, ref: ContainerRef, children: [jsxRuntime.jsxs(SplitContainer, { children: [showAvatar && (jsxRuntime.jsx(Avatar, { src: avatar, size: "24px", style: { marginRight: '8px', cursor: authorId ? 'pointer' : 'default' }, onClick: () => handleViewProfile(authorId) })), jsxRuntime.jsx(Title$6, { children: title }), jsxRuntime.jsx(Separator, { children: "|" }), jsxRuntime.jsx(Description$3, { children: description })] }), loading && (jsxRuntime.jsx(SplitContainer, { children: jsxRuntime.jsx(VoteButtonContainer, { type: type, modeDelete: isHover, height: heightContainer, style: { cursor: 'default' }, children: jsxRuntime.jsx(Loading, {}) }) })), !loading && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!canVote && canViewVote && hypothesisVotes?.length > 0 && (jsxRuntime.jsxs("div", { style: { position: 'relative', height: '100%' }, children: [jsxRuntime.jsx(SplitContainer, { children: jsxRuntime.jsx(VoteButtonContainer, { ref: viewVotesRef, height: heightContainer, style: { cursor: canViewListVotes ? 'pointer' : 'default' }, type: type, onClick: canViewListVotes ? toggleVotes : null, children: jsxRuntime.jsxs(VoteCount, { children: [jsxRuntime.jsxs(VoteContent, { children: [hypothesisVotes?.slice(0, 2)?.map((vote, index) => {
|
|
3379
|
+
return (jsxRuntime.jsx(ImageContent$1, { style: { zIndex: 14 - index }, children: jsxRuntime.jsx("img", { src: vote?.user?.avatar || 'https://cdn-images.frstfalconi.cloud/path582.svg' }) }, vote?.id));
|
|
3380
|
+
}), hypothesisVotes?.length > 2 && (jsxRuntime.jsx(ImageContent$1, { style: { background: '#444444' }, children: jsxRuntime.jsxs("p", { style: {
|
|
3381
|
+
fontSize: hypothesisVotes?.length > 9 ? 10 : hypothesisVotes?.length > 99 ? 8 : 14
|
|
3382
|
+
}, children: ["+", hypothesisVotes?.length - 2] }) }))] }), hypothesisVotes?.length, " ", hypothesisVotes?.length > 1 ? votesPluralText : votesSingularText] }) }) }), jsxRuntime.jsx(VoteList, { hypothesisVotes: votes, showVotes: showVotesList, viewProfile: handleViewProfile })] })), canVote && hasVoteGoal && hypothesisVotes?.length > 0 && (jsxRuntime.jsx(SplitContainer, { children: jsxRuntime.jsx(VoteButtonContainer, { type: type, modeDelete: isHover, height: heightContainer, onMouseEnter: () => seIsHover(true), onMouseLeave: () => seIsHover(false), style: { cursor: hasVoteHypothesis ? 'pointer' : 'default' }, children: hasVoteHypothesis ? (isHover ? (jsxRuntime.jsxs("div", { style: {
|
|
3383
|
+
display: 'flex',
|
|
3384
|
+
alignItems: 'center',
|
|
3385
|
+
gap: '4px',
|
|
3386
|
+
justifyContent: 'center'
|
|
3387
|
+
}, onClick: () => handleDeleteVote(hypothesisVotes?.find((vote) => vote?.user_uuid === userLoggedId)?.id), children: [jsxRuntime.jsx(ExcludeVoteIcon, { width: "24", height: "24" }), jsxRuntime.jsx(VoteButton, { children: deleteVoteText })] })) : (jsxRuntime.jsxs(VoteCount, { children: [jsxRuntime.jsxs(VoteContent, { children: [hypothesisVotes?.slice(0, 2)?.map((vote, index) => {
|
|
3306
3388
|
return (jsxRuntime.jsx(ImageContent$1, { style: { zIndex: 14 - index }, children: jsxRuntime.jsx("img", { src: vote?.user?.avatar || 'https://cdn-images.frstfalconi.cloud/path582.svg' }) }, vote?.id));
|
|
3307
|
-
}), hypothesisVotes
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
}, onClick: () => handleDeleteVote(hypothesisVotes?.find((vote) => vote?.user_uuid === userLoggedId)?.id), children: [jsxRuntime.jsx(ExcludeVoteIcon, { width: "24", height: "24" }), jsxRuntime.jsx(VoteButton, { children: deleteVoteText })] })) : (jsxRuntime.jsxs(VoteCount, { children: [jsxRuntime.jsxs(VoteContent, { children: [hypothesisVotes?.slice(0, 2)?.map((vote, index) => {
|
|
3315
|
-
return (jsxRuntime.jsx(ImageContent$1, { style: { zIndex: 14 - index }, children: jsxRuntime.jsx("img", { src: vote?.user?.avatar || 'https://cdn-images.frstfalconi.cloud/path582.svg' }) }, vote?.id));
|
|
3316
|
-
}), hypothesisVotes.length > 2 && (jsxRuntime.jsx(ImageContent$1, { style: { background: '#444444' }, children: jsxRuntime.jsxs("p", { children: ["+", hypothesisVotes?.length - 2] }) }))] }), jsxRuntime.jsxs("p", { children: [hypothesisVotes?.length, " ", hypothesisVotes?.length > 1 ? votesPluralText : votesSingularText] })] }))) : (jsxRuntime.jsx(ViewVotes, { hypothesisVotes: hypothesisVotes, votesPluralText: votesPluralText, votesSingularText: votesSingularText })) }) })), canVote && !hasVoteGoal && (jsxRuntime.jsx(SplitContainer, { children: jsxRuntime.jsx(VoteButtonContainer, { type: type, modeDelete: isHover, height: heightContainer, onMouseEnter: () => seIsHover(true), onMouseLeave: () => seIsHover(false), children: jsxRuntime.jsxs("div", { style: {
|
|
3317
|
-
display: 'flex',
|
|
3318
|
-
alignItems: 'center',
|
|
3319
|
-
justifyContent: 'center',
|
|
3320
|
-
paddingLeft: '4px',
|
|
3321
|
-
height: '100%'
|
|
3322
|
-
}, onClick: () => handleVote(id), children: [jsxRuntime.jsx(VoteIcon, { width: "24", height: "24", style: { marginLeft: '4px', marginRight: '4px' } }), jsxRuntime.jsx(VoteButton, { children: voteText })] }) }) }))] }) }));
|
|
3389
|
+
}), hypothesisVotes.length > 2 && (jsxRuntime.jsx(ImageContent$1, { style: { background: '#444444' }, children: jsxRuntime.jsxs("p", { children: ["+", hypothesisVotes?.length - 2] }) }))] }), jsxRuntime.jsxs("p", { children: [hypothesisVotes?.length, " ", hypothesisVotes?.length > 1 ? votesPluralText : votesSingularText] })] }))) : (jsxRuntime.jsx(ViewVotes, { hypothesisVotes: hypothesisVotes, votesPluralText: votesPluralText, votesSingularText: votesSingularText })) }) })), canVote && !hasVoteGoal && (jsxRuntime.jsx(SplitContainer, { children: jsxRuntime.jsx(VoteButtonContainer, { type: type, modeDelete: isHover, height: heightContainer, onMouseEnter: () => seIsHover(true), onMouseLeave: () => seIsHover(false), children: jsxRuntime.jsxs("div", { style: {
|
|
3390
|
+
display: 'flex',
|
|
3391
|
+
alignItems: 'center',
|
|
3392
|
+
justifyContent: 'center',
|
|
3393
|
+
paddingLeft: '4px',
|
|
3394
|
+
height: '100%'
|
|
3395
|
+
}, onClick: () => handleVote(id), children: [jsxRuntime.jsx(VoteIcon, { width: "24", height: "24", style: { marginLeft: '4px', marginRight: '4px' } }), jsxRuntime.jsx(VoteButton, { children: voteText })] }) }) }))] }))] }) }));
|
|
3323
3396
|
};
|
|
3324
3397
|
const VoteList = ({ hypothesisVotes, showVotes, viewProfile }) => {
|
|
3325
3398
|
const sortedVotes = [...hypothesisVotes].sort((a, b) => a.user.name.localeCompare(b.user.name));
|
|
@@ -5169,79 +5242,6 @@ const createUUID = () => {
|
|
|
5169
5242
|
return uuid;
|
|
5170
5243
|
};
|
|
5171
5244
|
|
|
5172
|
-
const container = styled__default["default"].div `
|
|
5173
|
-
display: flex;
|
|
5174
|
-
justify-content: center;
|
|
5175
|
-
align-items: center;
|
|
5176
|
-
flex-direction: ${({ textPosition }) => textPosition === 'left' ? 'row-reverse'
|
|
5177
|
-
: textPosition === 'right' ? 'row'
|
|
5178
|
-
: textPosition === 'top' ? 'column-reverse'
|
|
5179
|
-
: textPosition === 'bottom' ? 'column'
|
|
5180
|
-
: null};
|
|
5181
|
-
position: relative;
|
|
5182
|
-
width: auto;
|
|
5183
|
-
gap: 8px;
|
|
5184
|
-
padding: 16px;
|
|
5185
|
-
`;
|
|
5186
|
-
const loader = styled__default["default"].div `
|
|
5187
|
-
|
|
5188
|
-
svg {
|
|
5189
|
-
animation: load 1.5s infinite linear;
|
|
5190
|
-
|
|
5191
|
-
@keyframes load {
|
|
5192
|
-
0% {
|
|
5193
|
-
transform: rotate(0deg);
|
|
5194
|
-
}
|
|
5195
|
-
100% {
|
|
5196
|
-
transform: rotate(360deg);
|
|
5197
|
-
}
|
|
5198
|
-
}
|
|
5199
|
-
}
|
|
5200
|
-
`;
|
|
5201
|
-
const loadText = styled__default["default"].p `
|
|
5202
|
-
font-family: 'Inter';
|
|
5203
|
-
font-size: 14px;
|
|
5204
|
-
font-weight: 400;
|
|
5205
|
-
line-height: 20px;
|
|
5206
|
-
`;
|
|
5207
|
-
|
|
5208
|
-
function Loading(props) {
|
|
5209
|
-
const [Size, setSize] = React.useState('24');
|
|
5210
|
-
const [Color, setColor] = React.useState(props.loadColor ? props.loadColor : '');
|
|
5211
|
-
const [PositionTextLoad, setPositionTextLoad] = React.useState(props.positionLoadingText ? props.positionLoadingText : 'bottom');
|
|
5212
|
-
const [LoadText, setLoadText] = React.useState(props.loadText ? props.loadText : '');
|
|
5213
|
-
React.useEffect(() => {
|
|
5214
|
-
setLoadText(props.loadText);
|
|
5215
|
-
}, [props.loadText]);
|
|
5216
|
-
React.useEffect(() => {
|
|
5217
|
-
setColor(props.loadColor);
|
|
5218
|
-
}, [props.loadColor]);
|
|
5219
|
-
React.useEffect(() => {
|
|
5220
|
-
setPositionTextLoad(props.positionLoadingText);
|
|
5221
|
-
}, [props.positionLoadingText]);
|
|
5222
|
-
React.useEffect(() => {
|
|
5223
|
-
if (props.sizeLoading === 'extra-small') {
|
|
5224
|
-
setSize('16');
|
|
5225
|
-
}
|
|
5226
|
-
else if (props.sizeLoading === 'small') {
|
|
5227
|
-
setSize('20');
|
|
5228
|
-
}
|
|
5229
|
-
else if (props.sizeLoading === 'medium') {
|
|
5230
|
-
setSize('24');
|
|
5231
|
-
}
|
|
5232
|
-
else if (props.sizeLoading === 'large') {
|
|
5233
|
-
setSize('32');
|
|
5234
|
-
}
|
|
5235
|
-
else if (props.sizeLoading === 'extra-large') {
|
|
5236
|
-
setSize('40');
|
|
5237
|
-
}
|
|
5238
|
-
else {
|
|
5239
|
-
setSize('24');
|
|
5240
|
-
}
|
|
5241
|
-
}, [props.sizeLoading]);
|
|
5242
|
-
return (jsxRuntime.jsx(styled.ThemeProvider, { theme: FRSTTheme, children: jsxRuntime.jsxs(container, { textPosition: PositionTextLoad, style: { ...props.style }, children: [jsxRuntime.jsx(loader, { children: jsxRuntime.jsx(Load, { width: Size, height: Size, fill: Color !== '' && Color }) }), jsxRuntime.jsx(loadText, { style: { color: props.loadTextColor ? props.loadTextColor : 'white' }, children: LoadText })] }) }));
|
|
5243
|
-
}
|
|
5244
|
-
|
|
5245
5245
|
const InputContainer$1 = styled__default["default"].div `
|
|
5246
5246
|
display:flex;
|
|
5247
5247
|
flex-direction:column;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Vote } from './types';
|
|
3
|
-
export declare const HypothesisComponent: ({ description, type, id, title, votes, onVote, canVote, canViewVote, userLoggedId, deleteVote, canViewListVotes, votesSingularText, votesPluralText, voteText, deleteVoteText, handleViewProfile, avatar, showAvatar, authorId, hasVoteGoal }: {
|
|
3
|
+
export declare const HypothesisComponent: ({ description, type, id, title, votes, onVote, canVote, canViewVote, userLoggedId, deleteVote, canViewListVotes, votesSingularText, votesPluralText, voteText, deleteVoteText, handleViewProfile, avatar, showAvatar, authorId, hasVoteGoal, loading }: {
|
|
4
4
|
description: string;
|
|
5
5
|
type: string;
|
|
6
6
|
id: string;
|
|
@@ -21,5 +21,6 @@ export declare const HypothesisComponent: ({ description, type, id, title, votes
|
|
|
21
21
|
avatar?: string;
|
|
22
22
|
showAvatar?: boolean;
|
|
23
23
|
authorId?: string;
|
|
24
|
+
loading?: boolean;
|
|
24
25
|
}) => JSX.Element;
|
|
25
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/hypothesisComponent/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/hypothesisComponent/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAK9B,eAAO,MAAM,mBAAmB;iBAuBjB,MAAM;UACb,MAAM;QACR,MAAM;WACH,MAAM;WACN,IAAI,EAAE;kBACC,MAAM;2BACG,MAAM,KAAK,GAAG;0BACf,MAAM,KAAK,GAAG;iCACP,MAAM,KAAK,GAAG;cACjC,OAAO;uBACE,OAAO;kBACZ,OAAO;kBACP,OAAO;wBACD,MAAM;sBACR,MAAM;eACb,MAAM;qBACA,MAAM;aACd,MAAM;iBACF,OAAO;eACT,MAAM;cACP,OAAO;iBA4NlB,CAAA"}
|