react-science 20.6.0 → 20.6.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,IAAI,0BAA0B,EAC/C,WAAW,IAAI,oBAAoB,EACnC,QAAQ,EACR,YAAY,EACb,MAAM,mBAAmB,CAAC;AAS3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,KAAK,cAAc,GAAG;KAElB,GAAG,IAAI,MAAM,oBAAoB,GAAG,MAAM,0BAA0B,CACrE,CAAC,EAAE,oBAAoB,CAAC,GAAG,CAAC,GAAG,0BAA0B,CAAC,GAAG,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG;IACzC,YAAY,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC;IACvE,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;CACvC,CAAC;AAmDF,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAmCxC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,IAAI,0BAA0B,EAC/C,WAAW,IAAI,oBAAoB,EACnC,QAAQ,EACR,YAAY,EACb,MAAM,mBAAmB,CAAC;AAS3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,KAAK,cAAc,GAAG;KAElB,GAAG,IAAI,MAAM,oBAAoB,GAAG,MAAM,0BAA0B,CACrE,CAAC,EAAE,oBAAoB,CAAC,GAAG,CAAC,GAAG,0BAA0B,CAAC,GAAG,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG;IACzC,YAAY,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC;IACvE,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;CACvC,CAAC;AAqDF,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAoCxC"}
@@ -17,19 +17,20 @@ const ButtonTag = styled(Tag) `
17
17
  /*
18
18
  Setting the line-height makes sure that when passing regular text in icons instead of an svg, they are vertically centered
19
19
  max-width makes sure buttons with tag or hoverability indicator (both implying absolutely positioned elements) keep their intended width
20
- When a button just has an icon, we override BP styles and remove the margin-right, because if it also has tag prop this is required to keep the layout correct.
20
+ When a button just has an icon with a tag, we override BP styles and remove the margin-right to keep the layout correct.
21
21
  */
22
- const buttonStyles = ({ isIconButton }) => `
22
+ const buttonStyles = ({ isIconButton, isTagButton }) => `
23
23
  line-height: 1em;
24
24
  position: relative;
25
25
  max-width: ${isIconButton ? '30px' : 'none'};
26
26
 
27
27
  & .${Classes.ICON} {
28
- ${isIconButton ? 'margin-right: 0px;' : ''}
28
+ ${isIconButton && isTagButton ? 'margin-right: 0px;' : ''}
29
29
  }
30
30
  `;
31
+ const propsToIgnore = new Set(['isIconButton', 'isTagButton']);
31
32
  function shouldForwardButtonProp(propName) {
32
- return propName !== 'isIconButton';
33
+ return !propsToIgnore.has(propName);
33
34
  }
34
35
  const TooltipAnchorButton = styled(AnchorButton, {
35
36
  shouldForwardProp: shouldForwardButtonProp,
@@ -47,6 +48,6 @@ export function Button(props) {
47
48
  const InnerButton = buttonProps.disabled
48
49
  ? TooltipAnchorButton
49
50
  : TooltipButton;
50
- return (_jsx(Tooltip, { fill: fill || buttonProps.fill, disabled: disabled, content: content, ...otherTooltipProps, renderTarget: ({ isOpen, ...targetProps }) => (_jsxs(InnerButton, { ...targetProps, ...buttonProps, isIconButton: !children && !buttonProps.text, children: [tag && (_jsx(ButtonTag, { round: true, intent: "success", ...tagProps, children: tag })), children] })) }));
51
+ return (_jsx(Tooltip, { fill: fill || buttonProps.fill, disabled: disabled, content: content, ...otherTooltipProps, renderTarget: ({ isOpen, ...targetProps }) => (_jsxs(InnerButton, { ...targetProps, ...buttonProps, isIconButton: !children && !buttonProps.text, isTagButton: Boolean(tag), children: [tag && (_jsx(ButtonTag, { round: true, intent: "success", ...tagProps, children: tag })), children] })) }));
51
52
  }
52
53
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":";AAMA,OAAO,EACL,YAAY,EACZ,MAAM,IAAI,eAAe,EACzB,OAAO,EACP,GAAG,EACH,OAAO,GACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAerC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;;;;;;;;;;;CAY5B,CAAC;AAMF;;;;EAIE;AACF,MAAM,YAAY,GAAG,CAAC,EAAE,YAAY,EAAoB,EAAE,EAAE,CAAC;;;eAG9C,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;;OAEtC,OAAO,CAAC,IAAI;MACb,YAAY,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE;;CAE7C,CAAC;AAEF,SAAS,uBAAuB,CAAC,QAAgB;IAC/C,OAAO,QAAQ,KAAK,cAAc,CAAC;AACrC,CAAC;AAED,MAAM,mBAAmB,GAAG,MAAM,CAAC,YAAY,EAAE;IAC/C,iBAAiB,EAAE,uBAAuB;CAC3C,CAAC,CAAkB;IAChB,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;CACjC,CAAC;AAEF,M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W,CAAC,QAAQ;QACtC,CAAC,CAAC,mBAAmB;QACrB,CAAC,CAAC,aAAa,CAAC;IAElB,OAAO,CACL,KAAC,OAAO,IACN,IAAI,EAAE,IAAI,IAAI,WAAW,CAAC,IAAI,EAC9B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,KACZ,iBAAiB,EACrB,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,EAAE,EAAE,CAAC,CAC5C,MAAC,WAAW,OACN,WAAW,KACX,WAAW,EACf,YAAY,EAAE,CAAC,QAAQ,IAAI,CAAC,WAAW,CAAC,IAAI,EAC5C,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,aAExB,GAAG,IAAI,CACN,KAAC,SAAS,IAAC,KAAK,QAAC,MAAM,EAAC,SAAS,KAAK,QAAQ,YAC3C,GAAG,GACM,CACb,EACA,QAAQ,IACG,CACf,GACD,CACH,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-science",
3
- "version": "20.6.0",
3
+ "version": "20.6.1",
4
4
  "description": "React components to build scientific applications UI",
5
5
  "type": "module",
6
6
  "exports": {
@@ -42,25 +42,27 @@ const ButtonTag = styled(Tag)`
42
42
 
43
43
  interface InnerButtonProps {
44
44
  isIconButton: boolean;
45
+ isTagButton: boolean;
45
46
  }
46
47
 
47
48
  /*
48
49
  Setting the line-height makes sure that when passing regular text in icons instead of an svg, they are vertically centered
49
50
  max-width makes sure buttons with tag or hoverability indicator (both implying absolutely positioned elements) keep their intended width
50
- When a button just has an icon, we override BP styles and remove the margin-right, because if it also has tag prop this is required to keep the layout correct.
51
+ When a button just has an icon with a tag, we override BP styles and remove the margin-right to keep the layout correct.
51
52
  */
52
- const buttonStyles = ({ isIconButton }: InnerButtonProps) => `
53
+ const buttonStyles = ({ isIconButton, isTagButton }: InnerButtonProps) => `
53
54
  line-height: 1em;
54
55
  position: relative;
55
56
  max-width: ${isIconButton ? '30px' : 'none'};
56
57
 
57
58
  & .${Classes.ICON} {
58
- ${isIconButton ? 'margin-right: 0px;' : ''}
59
+ ${isIconButton && isTagButton ? 'margin-right: 0px;' : ''}
59
60
  }
60
61
  `;
61
62
 
63
+ const propsToIgnore = new Set(['isIconButton', 'isTagButton']);
62
64
  function shouldForwardButtonProp(propName: string) {
63
- return propName !== 'isIconButton';
65
+ return !propsToIgnore.has(propName);
64
66
  }
65
67
 
66
68
  const TooltipAnchorButton = styled(AnchorButton, {
@@ -99,6 +101,7 @@ export function Button(props: ButtonProps) {
99
101
  {...targetProps}
100
102
  {...buttonProps}
101
103
  isIconButton={!children && !buttonProps.text}
104
+ isTagButton={Boolean(tag)}
102
105
  >
103
106
  {tag && (
104
107
  <ButtonTag round intent="success" {...tagProps}>