@platformatic/ui-components 0.1.32 → 0.1.34

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.
Files changed (111) hide show
  1. package/.github/workflows/ci.yml +26 -26
  2. package/.nvmrc +1 -1
  3. package/LICENSE +201 -201
  4. package/README.md +30 -26
  5. package/dist/main.css +35 -23
  6. package/fonts/Montserrat/README.txt +81 -81
  7. package/index.html +12 -12
  8. package/index.js +62 -58
  9. package/package.json +76 -76
  10. package/postcss.config.cjs +8 -8
  11. package/public/api-icon-closed.svg +6 -6
  12. package/public/api-icon.svg +9 -9
  13. package/src/App.jsx +12 -12
  14. package/src/components/BorderedBox.jsx +16 -16
  15. package/src/components/BorderedBox.module.css +2 -2
  16. package/src/components/BorderedText.jsx +8 -8
  17. package/src/components/BorderedText.module.css +2 -2
  18. package/src/components/Box.jsx +14 -14
  19. package/src/components/Box.module.css +7 -7
  20. package/src/components/Button.jsx +23 -23
  21. package/src/components/Button.module.css +68 -21
  22. package/src/components/ButtonFullRounded.jsx +17 -0
  23. package/src/components/ButtonFullRounded.module.css +28 -0
  24. package/src/components/Checkbox.jsx +11 -0
  25. package/src/components/Checkbox.module.css +18 -0
  26. package/src/components/Common.module.css +7 -7
  27. package/src/components/DetailedMetric.jsx +32 -32
  28. package/src/components/DetailedMetric.module.css +2 -2
  29. package/src/components/DropDown.jsx +35 -35
  30. package/src/components/DropDown.module.css +22 -22
  31. package/src/components/FollowUs.jsx +35 -35
  32. package/src/components/FollowUs.module.css +11 -11
  33. package/src/components/GHLoginButton.jsx +14 -14
  34. package/src/components/HorizontalSeparator.jsx +10 -5
  35. package/src/components/HorizontalSeparator.module.css +23 -0
  36. package/src/components/Input.jsx +11 -11
  37. package/src/components/Input.module.css +7 -7
  38. package/src/components/List.jsx +20 -20
  39. package/src/components/List.module.css +11 -11
  40. package/src/components/ListElement.jsx +23 -23
  41. package/src/components/ListElement.module.css +23 -23
  42. package/src/components/Loadable.jsx +34 -34
  43. package/src/components/Loadable.module.css +13 -13
  44. package/src/components/LoginButton.jsx +17 -17
  45. package/src/components/LoginButton.module.css +7 -7
  46. package/src/components/LoginButton.test.jsx +25 -25
  47. package/src/components/Logo.jsx +58 -58
  48. package/src/components/Main.jsx +33 -33
  49. package/src/components/MetricValue.jsx +15 -15
  50. package/src/components/MetricValue.module.css +7 -7
  51. package/src/components/Modal.jsx +61 -29
  52. package/src/components/Modal.module.css +37 -25
  53. package/src/components/Playground.jsx +9 -9
  54. package/src/components/SearchBar.jsx +63 -63
  55. package/src/components/SearchBar.module.css +20 -20
  56. package/src/components/SimpleMetric.jsx +32 -32
  57. package/src/components/SimpleMetric.module.css +6 -6
  58. package/src/components/Status.jsx +26 -26
  59. package/src/components/TabbedWindow.jsx +34 -34
  60. package/src/components/TabbedWindow.module.css +16 -16
  61. package/src/components/TextWithLabel.jsx +11 -11
  62. package/src/components/TextWithLabel.module.css +8 -8
  63. package/src/components/Versions.jsx +9 -9
  64. package/src/components/VerticalSeparator.jsx +5 -5
  65. package/src/components/icons/ApiEmptyIcon.jsx +107 -107
  66. package/src/components/icons/ApiIcon.jsx +29 -29
  67. package/src/components/icons/ApiIconClosed.jsx +19 -19
  68. package/src/components/icons/CloseModalGreenHoverIcon.jsx +37 -0
  69. package/src/components/icons/CloseModalGreenIcon.jsx +27 -0
  70. package/src/components/icons/CloseModalIcon.jsx +26 -26
  71. package/src/components/icons/PullRequestIcon.jsx +31 -31
  72. package/src/components/icons/index.js +11 -9
  73. package/src/components/layouts/Layout.jsx +11 -11
  74. package/src/components/layouts/TwoColumnsLayout.jsx +12 -12
  75. package/src/components/layouts/TwoColumnsLayout.module.css +9 -9
  76. package/src/hooks/useEscapeKey.js +20 -20
  77. package/src/lib/utils.js +23 -23
  78. package/src/main.jsx +9 -9
  79. package/src/stories/BorderedBox.stories.jsx +33 -33
  80. package/src/stories/BorderedText.stories.jsx +24 -24
  81. package/src/stories/Button.stories.jsx +124 -107
  82. package/src/stories/ButtonFullRounded.stories.jsx +61 -0
  83. package/src/stories/Checkbox.stories.jsx +27 -0
  84. package/src/stories/DetailedMetric.stories.jsx +33 -33
  85. package/src/stories/DropDown.stories.jsx +62 -62
  86. package/src/stories/FollowUs.stories.jsx +14 -14
  87. package/src/stories/GHLoginButton.stories.jsx +14 -14
  88. package/src/stories/HorizontalSeparator.stories.jsx +12 -12
  89. package/src/stories/Input.stories.jsx +15 -15
  90. package/src/stories/Introduction.stories.mdx +211 -211
  91. package/src/stories/List.stories.jsx +29 -29
  92. package/src/stories/ListElement.stories.jsx +15 -15
  93. package/src/stories/Loadable.stories.jsx +75 -75
  94. package/src/stories/LoginButton.stories.jsx +15 -15
  95. package/src/stories/Logo.stories.jsx +17 -17
  96. package/src/stories/Modal.stories.jsx +94 -65
  97. package/src/stories/SearchBar.stories.jsx +28 -28
  98. package/src/stories/SimpleMetric.stories.jsx +41 -41
  99. package/src/stories/Status.stories.jsx +31 -31
  100. package/src/stories/TextWithLabel.stories.jsx +25 -25
  101. package/src/stories/TwoColumnsLayout.stories.jsx +42 -42
  102. package/src/styles/main.css +15 -15
  103. package/tailwind.config.cjs +42 -37
  104. package/vite.config.js +6 -6
  105. package/vitest.config.js +14 -14
  106. package/dist/api-icon-closed.svg +0 -6
  107. package/dist/api-icon.svg +0 -9
  108. package/dist/assets/index.5ac5acb7.js +0 -797
  109. package/dist/assets/index.d3f5882c.css +0 -1
  110. package/dist/index.html +0 -14
  111. package/dist/vite.svg +0 -1
package/src/lib/utils.js CHANGED
@@ -1,23 +1,23 @@
1
- 'use strict'
2
-
3
- function getColor (type, color) {
4
- let convertedColor
5
- switch (color) {
6
- case 'green':
7
- convertedColor = 'main-green'
8
- break
9
- case 'red':
10
- convertedColor = 'error-red'
11
- break
12
- case 'white':
13
- convertedColor = 'white'
14
- break
15
- default:
16
- convertedColor = 'main-green'
17
- break
18
- }
19
- return `${type}-${convertedColor}`
20
- }
21
- export {
22
- getColor
23
- }
1
+ 'use strict'
2
+
3
+ function getColor (type, color) {
4
+ let convertedColor
5
+ switch (color) {
6
+ case 'green':
7
+ convertedColor = 'main-green'
8
+ break
9
+ case 'red':
10
+ convertedColor = 'error-red'
11
+ break
12
+ case 'white':
13
+ convertedColor = 'white'
14
+ break
15
+ default:
16
+ convertedColor = 'main-green'
17
+ break
18
+ }
19
+ return `${type}-${convertedColor}`
20
+ }
21
+ export {
22
+ getColor
23
+ }
package/src/main.jsx CHANGED
@@ -1,9 +1,9 @@
1
- import React from 'react'
2
- import ReactDOM from 'react-dom/client'
3
- import App from './App'
4
- import './styles/main.css'
5
- ReactDOM.createRoot(document.getElementById('root')).render(
6
- <React.StrictMode>
7
- <App />
8
- </React.StrictMode>
9
- )
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom/client'
3
+ import App from './App'
4
+ import './styles/main.css'
5
+ ReactDOM.createRoot(document.getElementById('root')).render(
6
+ <React.StrictMode>
7
+ <App />
8
+ </React.StrictMode>
9
+ )
@@ -1,33 +1,33 @@
1
- 'use strict'
2
- import BorderedBox from '../components/BorderedBox'
3
- export default {
4
- title: 'Platformatic/BorderedBox',
5
- component: BorderedBox,
6
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
7
- argTypes: {
8
- color: {
9
- options: ['green', 'red', 'white'],
10
- control: { type: ' radio' }
11
- }
12
- }
13
- }
14
-
15
- // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
16
- const Template = (args) => <BorderedBox {...args}>Hello Platformatic</BorderedBox>
17
-
18
- export const Green = Template.bind({})
19
-
20
- Green.args = {
21
- color: 'green'
22
- }
23
- export const Red = Template.bind({})
24
-
25
- Red.args = {
26
- color: 'red'
27
- }
28
-
29
- export const White = Template.bind({})
30
-
31
- White.args = {
32
- color: 'white'
33
- }
1
+ 'use strict'
2
+ import BorderedBox from '../components/BorderedBox'
3
+ export default {
4
+ title: 'Platformatic/BorderedBox',
5
+ component: BorderedBox,
6
+ // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
7
+ argTypes: {
8
+ color: {
9
+ options: ['green', 'red', 'white'],
10
+ control: { type: ' radio' }
11
+ }
12
+ }
13
+ }
14
+
15
+ // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
16
+ const Template = (args) => <BorderedBox {...args}>Hello Platformatic</BorderedBox>
17
+
18
+ export const Green = Template.bind({})
19
+
20
+ Green.args = {
21
+ color: 'green'
22
+ }
23
+ export const Red = Template.bind({})
24
+
25
+ Red.args = {
26
+ color: 'red'
27
+ }
28
+
29
+ export const White = Template.bind({})
30
+
31
+ White.args = {
32
+ color: 'white'
33
+ }
@@ -1,24 +1,24 @@
1
- 'use strict'
2
- import BorderedText from '../components/BorderedText'
3
- export default {
4
- title: 'Platformatic/BorderedText',
5
- component: BorderedText,
6
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
7
- argTypes: {
8
- text: { control: 'string' }
9
- }
10
- }
11
-
12
- // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
13
- const Template = (args) => <BorderedText {...args} />
14
-
15
- export const Sample = Template.bind({})
16
- // More on args: https://storybook.js.org/docs/react/writing-stories/args
17
- Sample.args = {
18
- text: 'Hello Platformatic!'
19
- }
20
- export const Version = Template.bind({})
21
-
22
- Version.args = {
23
- text: 'v1.2.3'
24
- }
1
+ 'use strict'
2
+ import BorderedText from '../components/BorderedText'
3
+ export default {
4
+ title: 'Platformatic/BorderedText',
5
+ component: BorderedText,
6
+ // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
7
+ argTypes: {
8
+ text: { control: 'string' }
9
+ }
10
+ }
11
+
12
+ // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
13
+ const Template = (args) => <BorderedText {...args} />
14
+
15
+ export const Sample = Template.bind({})
16
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
17
+ Sample.args = {
18
+ text: 'Hello Platformatic!'
19
+ }
20
+ export const Version = Template.bind({})
21
+
22
+ Version.args = {
23
+ text: 'v1.2.3'
24
+ }
@@ -1,107 +1,124 @@
1
- 'use strict'
2
- import { faCheck } from '@fortawesome/free-solid-svg-icons'
3
- import { useState } from 'react'
4
- import Button from '../components/Button'
5
-
6
- export default {
7
- title: 'Platformatic/Button',
8
- component: Button,
9
- argTypes: {
10
- label: {
11
- type: 'string',
12
- control: 'text'
13
- },
14
- primary: {
15
- type: 'boolean'
16
- },
17
- color: {
18
- type: 'string',
19
- control: {
20
- type: 'radio',
21
- options: ['green', 'red']
22
- }
23
- }
24
- }
25
- }
26
-
27
- const Template = (args) => <Button {...args} />
28
-
29
- export const PrimaryGreen = Template.bind({})
30
- // More on args: https://storybook.js.org/docs/react/writing-stories/args
31
- PrimaryGreen.args = {
32
- primary: true,
33
- label: 'Primary Green',
34
- color: 'green'
35
- }
36
-
37
- export const SecondaryGreen = Template.bind({})
38
- SecondaryGreen.args = {
39
- primary: false,
40
- label: 'Secondary Green',
41
- color: 'green'
42
- }
43
-
44
- export const PrimaryWithIcon = Template.bind({})
45
- PrimaryWithIcon.args = {
46
- primary: true,
47
- label: 'Primary with Icon',
48
- icon: faCheck
49
- }
50
-
51
- export const SecondaryWithIcon = Template.bind({})
52
- SecondaryWithIcon.args = {
53
- primary: false,
54
- label: 'Secondary with Icon',
55
- icon: faCheck
56
-
57
- }
58
-
59
- export const PrimaryRed = Template.bind({})
60
- // More on args: https://storybook.js.org/docs/react/writing-stories/args
61
- PrimaryRed.args = {
62
- primary: true,
63
- label: 'Primary Red',
64
- color: 'red'
65
- }
66
-
67
- export const SecondaryRed = Template.bind({})
68
- SecondaryRed.args = {
69
- primary: false,
70
- label: 'Secondary Red',
71
- color: 'red'
72
- }
73
-
74
- const DisabledTemplate = (args) => {
75
- const [enabled, setEnabled] = useState(false)
76
- return (
77
- <div className='flex flex-col gap-y-6 text-white'>
78
- <div>
79
- <Button {...args} disabled={!enabled} onClick={() => alert('clicked')} />
80
- <span className='ml-4 text-xl'>👈 This button is {enabled ? 'enabled' : 'disabled'}</span>
81
- </div>
82
- <div>
83
- <Button label='Toggle Disabled' primary='true' onClick={() => setEnabled(!enabled)} />
84
- </div>
85
-
86
- </div>
87
-
88
- )
89
- }
90
-
91
- export const DisabledGreen = DisabledTemplate.bind({})
92
-
93
- DisabledGreen.args = {
94
- primary: true,
95
- label: 'A simple button',
96
- color: 'green',
97
- disabeld: true
98
- }
99
-
100
- export const DisabledRed = DisabledTemplate.bind({})
101
-
102
- DisabledRed.args = {
103
- primary: true,
104
- label: 'A simple button',
105
- color: 'red',
106
- disabeld: true
107
- }
1
+ 'use strict'
2
+ import { faCheck } from '@fortawesome/free-solid-svg-icons'
3
+ import { useState } from 'react'
4
+ import Button from '../components/Button'
5
+
6
+ export default {
7
+ title: 'Platformatic/Button',
8
+ component: Button,
9
+ argTypes: {
10
+ label: {
11
+ type: 'string',
12
+ control: 'text'
13
+ },
14
+ bold: {
15
+ type: 'boolean'
16
+ },
17
+ buttonClass: {
18
+ type: 'string',
19
+ control: {
20
+ type: 'radio',
21
+ options: ['primary', 'secondary', 'transparent']
22
+ }
23
+ },
24
+ color: {
25
+ type: 'string',
26
+ control: {
27
+ type: 'radio',
28
+ options: ['green', 'red', 'white']
29
+ }
30
+ },
31
+ disabled: {
32
+ type: 'boolean'
33
+ },
34
+ size: {
35
+ type: 'string',
36
+ control: {
37
+ type: 'radio',
38
+ options: ['small', 'medium', 'large', 'extra-large']
39
+ }
40
+ }
41
+ }
42
+ }
43
+
44
+ const Template = (args) => <Button {...args} />
45
+
46
+ export const PrimaryGreen = Template.bind({})
47
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
48
+ PrimaryGreen.args = {
49
+ buttonClass: 'primary',
50
+ label: 'Primary Green',
51
+ color: 'green',
52
+ bold: true
53
+ }
54
+
55
+ export const SecondaryRed = Template.bind({})
56
+ SecondaryRed.args = {
57
+ label: 'Secondary Green',
58
+ color: 'red'
59
+ }
60
+
61
+ export const TransparentWhite = Template.bind({})
62
+ TransparentWhite.args = {
63
+ buttonClass: 'transparent',
64
+ label: 'Secondary Green',
65
+ color: 'white'
66
+ }
67
+
68
+ export const PrimaryWithIcon = Template.bind({})
69
+ PrimaryWithIcon.args = {
70
+ buttonClass: 'primary',
71
+ label: 'Primary with Icon',
72
+ icon: faCheck
73
+ }
74
+
75
+ export const SecondaryWithIcon = Template.bind({})
76
+ SecondaryWithIcon.args = {
77
+ buttonClass: 'secondary',
78
+ label: 'Secondary with Icon',
79
+ icon: faCheck,
80
+ color: 'white'
81
+ }
82
+
83
+ export const PrimaryRed = Template.bind({})
84
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
85
+ PrimaryRed.args = {
86
+ buttonClass: 'primary',
87
+ label: 'Primary Red',
88
+ color: 'red'
89
+ }
90
+
91
+ const DisabledTemplate = (args) => {
92
+ const [enabled, setEnabled] = useState(false)
93
+ return (
94
+ <div className='flex flex-col gap-y-6 text-white'>
95
+ <div>
96
+ <Button {...args} disabled={!enabled} onClick={() => alert('clicked')} />
97
+ <span className='ml-4 text-xl'>👈 This button is {enabled ? 'enabled' : 'disabled'}</span>
98
+ </div>
99
+ <div>
100
+ <Button label='Toggle Disabled' primary='true' onClick={() => setEnabled(!enabled)} />
101
+ </div>
102
+
103
+ </div>
104
+
105
+ )
106
+ }
107
+
108
+ export const DisabledGreen = DisabledTemplate.bind({})
109
+
110
+ DisabledGreen.args = {
111
+ buttonClass: 'primary',
112
+ label: 'A simple button',
113
+ color: 'green',
114
+ disabled: true
115
+ }
116
+
117
+ export const DisabledRed = DisabledTemplate.bind({})
118
+
119
+ DisabledRed.args = {
120
+ buttonClass: 'primary',
121
+ label: 'A simple button',
122
+ color: 'red',
123
+ disabled: true
124
+ }
@@ -0,0 +1,61 @@
1
+ 'use strict'
2
+ import { faStop, faRefresh } from '@fortawesome/free-solid-svg-icons'
3
+ import ButtonFullRounded from '../components/ButtonFullRounded'
4
+
5
+ export default {
6
+ title: 'Platformatic/ButtonFullRounded',
7
+ component: ButtonFullRounded,
8
+ argTypes: {
9
+ label: {
10
+ type: 'string',
11
+ control: 'text'
12
+ },
13
+ bold: {
14
+ type: 'boolean'
15
+ },
16
+ color: {
17
+ type: 'string',
18
+ control: {
19
+ type: 'radio',
20
+ options: ['green', 'red', 'white']
21
+ }
22
+ },
23
+ size: {
24
+ type: 'string',
25
+ control: {
26
+ type: 'radio',
27
+ options: ['small', 'medium', 'large']
28
+ }
29
+ }
30
+ }
31
+ }
32
+
33
+ const Template = (args) => <ButtonFullRounded {...args} />
34
+
35
+ export const WhiteLarge = Template.bind({})
36
+ WhiteLarge.args = {
37
+ icon: faStop,
38
+ size: 'large'
39
+ }
40
+
41
+ export const GreenSmall = Template.bind({})
42
+ GreenSmall.args = {
43
+ icon: faStop,
44
+ color: 'green',
45
+ size: 'small'
46
+ }
47
+
48
+ export const Disabled = Template.bind({})
49
+
50
+ Disabled.args = {
51
+ icon: faRefresh,
52
+ disabled: true
53
+ }
54
+
55
+ export const DisabledRed = Template.bind({})
56
+
57
+ DisabledRed.args = {
58
+ icon: faRefresh,
59
+ color: 'red',
60
+ disabled: true
61
+ }
@@ -0,0 +1,27 @@
1
+ 'use strict'
2
+ import Checkbox from '../components/Checkbox'
3
+
4
+ export default {
5
+ title: 'Platformatic/Checkbox',
6
+ component: Checkbox,
7
+ argTypes: {
8
+ id: {
9
+ type: 'string',
10
+ control: 'text'
11
+ },
12
+ disabled: {
13
+ type: 'boolean'
14
+ }
15
+ }
16
+ }
17
+
18
+ const Template = (args) => <Checkbox {...args} />
19
+
20
+ export const CheckboxRegular = Template.bind({})
21
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
22
+ CheckboxRegular.args = {}
23
+
24
+ export const CheckboxDisabled = Template.bind({})
25
+ CheckboxDisabled.args = {
26
+ disabled: true
27
+ }
@@ -1,33 +1,33 @@
1
- 'use strict'
2
-
3
- import DetailedMetric from '../components/DetailedMetric'
4
-
5
- export default {
6
- title: 'Platformatic/DetailedMetric',
7
- component: DetailedMetric
8
- }
9
-
10
- const Template = (args) => <DetailedMetric {...args} />
11
-
12
- export const Default = Template.bind({})
13
-
14
- Default.args = {
15
- title: 'Requests',
16
- color: 'green',
17
- unit: 'ms',
18
- value: 120,
19
- pre: 'P90',
20
- tooltip: 'This is a tooltip for the metric',
21
- leftDetail: {
22
- value: 600,
23
- unit: 'ms',
24
- color: 'green',
25
- pre: 'P99'
26
- },
27
- rightDetail: {
28
- value: 4.42,
29
- unit: 's',
30
- color: 'green',
31
- pre: 'P95'
32
- }
33
- }
1
+ 'use strict'
2
+
3
+ import DetailedMetric from '../components/DetailedMetric'
4
+
5
+ export default {
6
+ title: 'Platformatic/DetailedMetric',
7
+ component: DetailedMetric
8
+ }
9
+
10
+ const Template = (args) => <DetailedMetric {...args} />
11
+
12
+ export const Default = Template.bind({})
13
+
14
+ Default.args = {
15
+ title: 'Requests',
16
+ color: 'green',
17
+ unit: 'ms',
18
+ value: 120,
19
+ pre: 'P90',
20
+ tooltip: 'This is a tooltip for the metric',
21
+ leftDetail: {
22
+ value: 600,
23
+ unit: 'ms',
24
+ color: 'green',
25
+ pre: 'P99'
26
+ },
27
+ rightDetail: {
28
+ value: 4.42,
29
+ unit: 's',
30
+ color: 'green',
31
+ pre: 'P95'
32
+ }
33
+ }