index.tsx 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // Copyright (c) Jupyter Development Team.
  2. // Distributed under the terms of the Modified BSD License.
  3. import * as React from 'react';
  4. import {
  5. Button as BPButton,
  6. IButtonProps as IBPButtonProps
  7. } from '@blueprintjs/core/lib/cjs/components/button/buttons';
  8. import {
  9. Icon as BPIcon,
  10. IIconProps
  11. } from '@blueprintjs/core/lib/cjs/components/icon/icon';
  12. import {
  13. Collapse as BPCollapse,
  14. ICollapseProps
  15. } from '@blueprintjs/core/lib/cjs/components/collapse/collapse';
  16. import {
  17. InputGroup as BPInputGroup,
  18. IInputGroupProps as IBPInputGroupProps
  19. } from '@blueprintjs/core/lib/cjs/components/forms/inputGroup';
  20. import {
  21. HTMLSelect as BPHTMLSelect,
  22. IHTMLSelectProps
  23. } from '@blueprintjs/core/lib/cjs/components/html-select/htmlSelect';
  24. import {
  25. Select as BPSelect,
  26. ISelectProps
  27. } from '@blueprintjs/select/lib/cjs/components/select/select';
  28. import '@blueprintjs/icons/lib/css/blueprint-icons.css';
  29. import '@blueprintjs/core/lib/css/blueprint.css';
  30. import '../style/index.css';
  31. import { combineClassNames } from './utils';
  32. export { Intent } from '@blueprintjs/core/lib/cjs/common/intent';
  33. interface IButtonProps extends IBPButtonProps {
  34. title?: string;
  35. }
  36. interface IInputGroupProps extends IBPInputGroupProps {
  37. rightIcon?: IIconProps['icon'];
  38. }
  39. export const Button = (props: IButtonProps) => (
  40. <BPButton
  41. {...props}
  42. className={combineClassNames(
  43. props.className,
  44. props.minimal && 'minimal',
  45. 'jp-Button'
  46. )}
  47. />
  48. );
  49. export const InputGroup = (props: IInputGroupProps) => {
  50. if (props.rightIcon) {
  51. return (
  52. <BPInputGroup
  53. {...props}
  54. className={combineClassNames(props.className, 'jp-InputGroup')}
  55. rightElement={
  56. <div className="jp-InputGroupAction">
  57. <Icon className="jp-Icon" icon={props.rightIcon} />
  58. </div>
  59. }
  60. />
  61. );
  62. }
  63. return (
  64. <BPInputGroup
  65. {...props}
  66. className={combineClassNames(props.className, 'jp-InputGroup')}
  67. />
  68. );
  69. };
  70. export const Icon = (props: IIconProps) => (
  71. <BPIcon
  72. {...props}
  73. className={combineClassNames(props.className, 'jp-Icon')}
  74. />
  75. );
  76. export const Collapse = (props: ICollapseProps) => <BPCollapse {...props} />;
  77. export const HTMLSelect = (props: IHTMLSelectProps) => (
  78. <BPHTMLSelect
  79. {...props}
  80. className={combineClassNames(props.className, 'jp-HTMLSelect')}
  81. />
  82. );
  83. export const Select = (props: ISelectProps<any>) => (
  84. <BPSelect
  85. {...props}
  86. className={combineClassNames(props.className, 'jp-Select')}
  87. />
  88. );