frst-components 0.23.41 → 0.23.42

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
@@ -3619,7 +3619,7 @@ const ModalConfirme = ({ open, onClose, title, children, onConfirm }) => {
3619
3619
  return (jsxRuntime.jsx(material.Modal, { open: open, onClose: onClose, children: jsxRuntime.jsxs(ModalContainer, { children: [jsxRuntime.jsxs(ModalHeader$1, { children: [jsxRuntime.jsx(ModalTitle, { children: title }), jsxRuntime.jsx(CloseButton$1, { onClick: onClose, children: "X" })] }), jsxRuntime.jsx(HorizontalLine, {}), jsxRuntime.jsxs(ContainerContent, { children: [children, jsxRuntime.jsxs(ButtonContainer$1, { children: [jsxRuntime.jsx(Button$4, { variant: "link", style: { color: '#444444' }, handleClick: onClose, label: "N\u00E3o, cancelar" }), jsxRuntime.jsx(Button$4, { variant: "primary", label: "Sim, excluir", handleClick: onConfirm })] })] })] }) }));
3620
3620
  };
3621
3621
 
3622
- const HypothesisComponent = ({ description, type, id, title, votes = [], onVote, canVote = false, canViewVote = false, userLoggedId, deleteVote, canViewListVotes, votesSingularText, votesPluralText, voteText, deleteVoteText, handleViewProfile, avatar, hasEditHipotesis, onDeleteHipotesis, showAvatar, authorId, hasVoteGoal, loading, onChangeVote, authorGoalId, changeVoteText, onSaveEditHipotesis, }) => {
3622
+ const HypothesisComponent = ({ description, type, id, title, votes = [], onVote, canVote = false, canViewVote = false, userLoggedId, deleteVote, canViewListVotes, votesSingularText, votesPluralText, voteText, deleteVoteText, handleViewProfile, avatar, hasEditHipotesis, onDeleteHipotesis, showAvatar, authorId, hasVoteGoal, loading, onChangeVote, authorGoalId, changeVoteText, onSaveEditHipotesis }) => {
3623
3623
  const [isHover, seIsHover] = React.useState(false);
3624
3624
  const [hasVoteHypothesis, setHasVoteHypothesis] = React.useState(false);
3625
3625
  const [showVotesList, setShowVotesList] = React.useState(false);
@@ -3672,17 +3672,20 @@ const HypothesisComponent = ({ description, type, id, title, votes = [], onVote,
3672
3672
  onSaveEditHipotesis(editDescription);
3673
3673
  setIsEditing(false);
3674
3674
  };
3675
- const validHasEditHipotesis = typeof HypothesisEnum.PRIORITIZE
3676
- ? hasEditHipotesis && authorGoalId === userLoggedId
3677
- : hasEditHipotesis && (authorId === userLoggedId || authorGoalId === userLoggedId);
3675
+ const validHasEditHipotesis = React.useMemo(() => {
3676
+ if (!hasEditHipotesis)
3677
+ return false;
3678
+ if (authorGoalId === userLoggedId)
3679
+ return true;
3680
+ if (type !== HypothesisEnum.PRIORITIZE) {
3681
+ return authorId === userLoggedId;
3682
+ }
3683
+ return false;
3684
+ }, [type, hasEditHipotesis, authorGoalId, authorId, userLoggedId]);
3678
3685
  const handleDoubleClick = (e) => {
3679
- setIsEditing(true);
3680
- if (typeof HypothesisEnum.PRIORITIZE && authorGoalId === userLoggedId) {
3686
+ if (validHasEditHipotesis) {
3681
3687
  setIsEditing(true);
3682
3688
  }
3683
- else {
3684
- setIsEditing(false);
3685
- }
3686
3689
  };
3687
3690
  return (jsxRuntime.jsx(MainContainer, { children: jsxRuntime.jsxs(Container$m, { type: type, id: id, ref: ContainerRef, children: [jsxRuntime.jsxs(SplitContainerDescription, { 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$4, { children: isEditing ? (jsxRuntime.jsx("span", { style: { display: 'flex', width: '100%' }, children: jsxRuntime.jsx("div", { contentEditable: true, style: { width: '100%', background: 'white' }, onInput: (e) => setEditDescription(e.currentTarget.textContent), onBlur: handleSaveDescription, children: description }) })) : (jsxRuntime.jsx("div", { style: { width: '100%' }, onDoubleClick: handleDoubleClick, children: jsxRuntime.jsx("span", { children: editDescription }) })) }), validHasEditHipotesis && (jsxRuntime.jsx(MenuMore, { options: [
3688
3691
  {
@@ -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, hasEditHipotesis, onDeleteHipotesis, showAvatar, authorId, hasVoteGoal, loading, onChangeVote, authorGoalId, changeVoteText, onSaveEditHipotesis, }: {
3
+ export declare const HypothesisComponent: ({ description, type, id, title, votes, onVote, canVote, canViewVote, userLoggedId, deleteVote, canViewListVotes, votesSingularText, votesPluralText, voteText, deleteVoteText, handleViewProfile, avatar, hasEditHipotesis, onDeleteHipotesis, showAvatar, authorId, hasVoteGoal, loading, onChangeVote, authorGoalId, changeVoteText, onSaveEditHipotesis }: {
4
4
  description: string;
5
5
  type: string;
6
6
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/hypothesisComponent/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAkB,IAAI,EAAE,MAAM,SAAS,CAAA;AAO9C,eAAO,MAAM,mBAAmB;iBA8BjB,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;uBACF,OAAO;wBACN,MAAM;sBACR,MAAM;eACb,MAAM;qBACA,MAAM;aACd,MAAM;wBACK,MAAM,IAAI;iBACjB,OAAO;eACT,MAAM;mBACF,MAAM;cACX,OAAO;iCACY,MAAM,KAAK,GAAG;qBAC1B,MAAM;wCACa,MAAM,KAAK,IAAI;iBAsVpD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/hypothesisComponent/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAkB,IAAI,EAAE,MAAM,SAAS,CAAA;AAO9C,eAAO,MAAM,mBAAmB;iBA6BjB,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;uBACF,OAAO;wBACN,MAAM;sBACR,MAAM;eACb,MAAM;qBACA,MAAM;aACd,MAAM;wBACK,MAAM,IAAI;iBACjB,OAAO;eACT,MAAM;mBACF,MAAM;cACX,OAAO;iCACY,MAAM,KAAK,GAAG;qBAC1B,MAAM;wCACa,MAAM,KAAK,IAAI;iBA0VpD,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "frst-components",
3
3
  "homepage": "http://FRST-Falconi.github.io/storybook.frstfalconi.com",
4
- "version": "0.23.41",
4
+ "version": "0.23.42",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",