@platformatic/ui-components 0.2.19 → 0.3.0

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.
@@ -0,0 +1,88 @@
1
+ /* Wrapping */
2
+ .tooltipWrapper {
3
+ display: inline-block;
4
+ position: relative;
5
+ }
6
+
7
+ /* Absolute positioning */
8
+ .tooltipTip {
9
+ position: absolute;
10
+ border-radius: 4px;
11
+ }
12
+
13
+ .tooltipTipBaseClass {
14
+ @apply text-rich-black bg-white p-2 font-sans text-sm z-20 rounded;
15
+ white-space: nowrap;
16
+ }
17
+
18
+ /* CSS border triangles */
19
+ .tooltipTip::before {
20
+ content: " ";
21
+ border: solid transparent;
22
+ height: 0;
23
+ width: 0;
24
+ position: absolute;
25
+ pointer-events: none;
26
+ border-width: 6px;
27
+ margin-left: calc(6px * -1);
28
+ }
29
+ .start {
30
+ left: 0%;
31
+ }
32
+ .start::before {
33
+ left: 12px;
34
+ }
35
+
36
+ .center {
37
+ left: 50%;
38
+ transform: translateX(-50%);
39
+ }
40
+ .end {
41
+ left: 100%;
42
+ transform: translateX(-100%);
43
+ }
44
+ .end::before {
45
+ right: 4px;
46
+ }
47
+
48
+
49
+ /* CSS border triangles */
50
+ .top::before {
51
+ top: 100%;
52
+ border-top-color: white;
53
+ }
54
+
55
+ /* Absolute positioning */
56
+ .right {
57
+ top: 50%;
58
+ transform: translateX(0) translateY(-50%);
59
+ }
60
+ /* CSS border triangles */
61
+ .right::before {
62
+ left: calc(6px * -1);
63
+ top: 50%;
64
+ transform: translateX(0) translateY(-50%);
65
+ border-right-color: white;
66
+ }
67
+
68
+ /* CSS border triangles */
69
+ .bottom::before {
70
+ bottom: 100%;
71
+ border-bottom-color: white;
72
+ }
73
+
74
+ /* Absolute positioning */
75
+ .left {
76
+ left: auto;
77
+ top: 50%;
78
+ transform: translateX(0) translateY(-50%);
79
+ }
80
+ /* CSS border triangles */
81
+ .left::before {
82
+ left: auto;
83
+ right: calc(6px * -2);
84
+ top: 50%;
85
+ transform: translateX(0) translateY(-50%);
86
+ border-left-color: white;
87
+ border-right-color: transparent;
88
+ }
@@ -70,7 +70,13 @@ export const OPACITY_30 = 30
70
70
  export const OPACITY_60 = 60
71
71
  export const OPACITY_100 = 100
72
72
 
73
- export const ALIGNMENT_LEFT = 'left'
74
- export const ALIGNMENT_RIGHT = 'rigth'
75
- export const ALIGNMENT_CENTER = 'center'
76
- export const ALIGNMENTS = [ALIGNMENT_LEFT, ALIGNMENT_CENTER, ALIGNMENT_RIGHT]
73
+ export const DIRECTION_BOTTOM = 'bottom'
74
+ export const DIRECTION_LEFT = 'left'
75
+ export const DIRECTION_RIGHT = 'right'
76
+ export const DIRECTION_TOP = 'top'
77
+ export const DIRECTIONS = [DIRECTION_BOTTOM, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_TOP]
78
+
79
+ export const POSITION_START = 'start'
80
+ export const POSITION_END = 'end'
81
+ export const POSITION_CENTER = 'center'
82
+ export const POSITIONS = [POSITION_START, POSITION_END, POSITION_CENTER]
@@ -1,11 +1,12 @@
1
1
  import React from 'react'
2
2
  import CopyAndPaste from '../components/CopyAndPaste'
3
+ import { WHITE } from '../components/constants'
3
4
 
4
5
  const divStyle = {
5
6
  width: '100%',
6
7
  height: 'auto',
7
8
  padding: '50px',
8
- backgroundColor: 'white'
9
+ backgroundColor: 'transparent'
9
10
  }
10
11
 
11
12
  export default {
@@ -24,5 +25,6 @@ const Template = (args) => <CopyAndPaste {...args} />
24
25
  export const CopyAndPasteDefault = Template.bind({})
25
26
  CopyAndPasteDefault.args = {
26
27
  value: 'copy this value',
27
- tooltipLabel: 'Tooltip show'
28
+ tooltipLabel: 'Tooltip show',
29
+ color: WHITE
28
30
  }
@@ -0,0 +1,85 @@
1
+ 'use strict'
2
+ import React from 'react'
3
+ import Tooltip from '../components/Tooltip'
4
+ import { ANTI_FLASH_WHITE, CHANGE_BACKGROUND_COLOR, COLORS_BUTTON, HOVER_EFFECTS_BUTTONS, RICH_BLACK, SIZES, WHITE } from '../components/constants'
5
+ import Button from '../components/Button'
6
+
7
+ const divStyle = {
8
+ width: '100%',
9
+ height: 'auto',
10
+ padding: '40px'
11
+ }
12
+
13
+ export default {
14
+ title: 'Platformatic/Tooltip',
15
+ component: Tooltip,
16
+ decorators: [
17
+ (Story) => (
18
+ <div style={divStyle}>
19
+ <Story />
20
+ </div>
21
+ )
22
+ ],
23
+ argTypes: {
24
+ label: {
25
+ type: 'string',
26
+ control: 'text'
27
+ },
28
+ bold: {
29
+ type: 'boolean'
30
+ },
31
+ backgroundColor: {
32
+ type: 'radio',
33
+ options: COLORS_BUTTON
34
+ },
35
+ color: {
36
+ type: 'radio',
37
+ options: COLORS_BUTTON
38
+ },
39
+ disabled: {
40
+ type: 'boolean'
41
+ },
42
+ size: {
43
+ type: 'string',
44
+ control: {
45
+ type: 'radio',
46
+ options: SIZES
47
+ }
48
+ },
49
+ hoverEffect: {
50
+ type: 'radio',
51
+ options: HOVER_EFFECTS_BUTTONS
52
+ },
53
+ bordered: {
54
+ type: 'boolean'
55
+ },
56
+ fullWidth: {
57
+ type: 'boolean'
58
+ },
59
+ selected: {
60
+ type: 'boolean'
61
+ }
62
+ }
63
+ }
64
+
65
+ const TemplateWithButton = (args) => (
66
+ <Tooltip {...args}>
67
+ <Button
68
+ color={RICH_BLACK}
69
+ backgroundColor={WHITE}
70
+ onClick={() => alert('clicked Disabled WHITE')}
71
+ bordered={false}
72
+ hoverEffect={CHANGE_BACKGROUND_COLOR}
73
+ hoverEffectProperties={{ changeBackgroundColor: ANTI_FLASH_WHITE }}
74
+ label='Test button'
75
+ />
76
+ </Tooltip>
77
+ )
78
+
79
+ export const TooltipBase = TemplateWithButton.bind({})
80
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
81
+ TooltipBase.args = {
82
+ content: (<span>I'm a tooltip over a button</span>),
83
+ delay: 100,
84
+ offset: 44
85
+ }