@capillarytech/blaze-ui 0.1.6-alpha.9 → 0.1.12

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 (103) hide show
  1. package/CapIcon/CapIcon.js +183 -0
  2. package/CapIcon/index.js +3 -0
  3. package/CapIcon/styles.js +76 -0
  4. package/CapInput/CapInput.js +2 -2
  5. package/CapInput/Number.js +1 -1
  6. package/CapInput/Search.js +1 -1
  7. package/CapInput/TextArea.js +1 -1
  8. package/CapInput/styles.js +2 -2
  9. package/CapLabel/CapLabel.js +58 -81
  10. package/CapLabel/index.js +3 -1
  11. package/CapLabel/styles.js +250 -212
  12. package/CapRow/CapRow.js +111 -10
  13. package/CapRow/index.js +3 -1
  14. package/CapRow/styles.js +47 -6
  15. package/CapSkeleton/CapSkeleton.js +17 -0
  16. package/CapSkeleton/index.js +1 -0
  17. package/CapSpin/CapSpin.js +23 -0
  18. package/CapSpin/index.js +1 -0
  19. package/CapTable/loadable.js +4 -4
  20. package/CapTable/styles.js +6 -6
  21. package/CapTestSelect/CapTestSelect.js +47 -0
  22. package/CapTestSelect/index.js +1 -0
  23. package/CapTooltip/CapTooltip.js +87 -25
  24. package/CapTooltip/index.js +3 -1
  25. package/CapTooltip/styles.js +19 -27
  26. package/CapTooltipWithInfo/CapTooltipWithInfo.js +74 -0
  27. package/CapTooltipWithInfo/index.js +3 -0
  28. package/CapTooltipWithInfo/styles.js +22 -0
  29. package/CapUnifiedSelect/CapUnifiedSelect.js +495 -77
  30. package/CapUnifiedSelect/index.js +1 -4
  31. package/CapUnifiedSelect/styles.js +376 -165
  32. package/assets/upload.svg +3 -0
  33. package/index.js +12 -1
  34. package/package.json +5 -11
  35. package/styled/variables.js +2 -0
  36. package/utils/index.js +1 -0
  37. package/utils/withMemo.js +33 -0
  38. package/utils/withStyles.js +24 -0
  39. package/CapHeading/CapHeading.js +0 -71
  40. package/CapHeading/index.js +0 -1
  41. package/CapHeading/styles.js +0 -125
  42. package/CapInfoNote/CapInfoNote.js +0 -54
  43. package/CapInfoNote/index.js +0 -1
  44. package/CapInfoNote/styles.js +0 -63
  45. package/CapInput/loadable.js +0 -9
  46. package/CapUnifiedSelect/loadable.js +0 -3
  47. package/dist/235.index.js +0 -2
  48. package/dist/235.index.js.LICENSE.txt +0 -29
  49. package/dist/603.index.js +0 -1
  50. package/dist/CapInput/CapInput.js +0 -66
  51. package/dist/CapInput/Number.js +0 -42
  52. package/dist/CapInput/Search.js +0 -35
  53. package/dist/CapInput/TextArea.js +0 -42
  54. package/dist/CapInput/index.js +0 -15
  55. package/dist/CapInput/messages.js +0 -32
  56. package/dist/CapInput/styles.js +0 -11
  57. package/dist/CapTable/CapTable.js +0 -148
  58. package/dist/CapTable/index.js +0 -9
  59. package/dist/CapTable/loadable.js +0 -23
  60. package/dist/CapTable/styles.js +0 -26
  61. package/dist/LocaleHoc/index.js +0 -40
  62. package/dist/esm/CapHeading/CapHeading.js +0 -41
  63. package/dist/esm/CapHeading/index.js +0 -1
  64. package/dist/esm/CapHeading/styles.js +0 -123
  65. package/dist/esm/CapInfoNote/CapInfoNote.js +0 -62
  66. package/dist/esm/CapInfoNote/index.js +0 -1
  67. package/dist/esm/CapInfoNote/styles.js +0 -6
  68. package/dist/esm/CapInput/CapInput.js +0 -57
  69. package/dist/esm/CapInput/Number.js +0 -35
  70. package/dist/esm/CapInput/Search.js +0 -28
  71. package/dist/esm/CapInput/TextArea.js +0 -35
  72. package/dist/esm/CapInput/index.js +0 -8
  73. package/dist/esm/CapInput/loadable.js +0 -9
  74. package/dist/esm/CapInput/messages.js +0 -25
  75. package/dist/esm/CapInput/styles.js +0 -3
  76. package/dist/esm/CapLabel/CapLabel.js +0 -50
  77. package/dist/esm/CapLabel/index.js +0 -1
  78. package/dist/esm/CapLabel/styles.js +0 -219
  79. package/dist/esm/CapRow/CapRow.js +0 -22
  80. package/dist/esm/CapRow/index.js +0 -1
  81. package/dist/esm/CapRow/styles.js +0 -5
  82. package/dist/esm/CapTable/CapTable.js +0 -140
  83. package/dist/esm/CapTable/index.js +0 -2
  84. package/dist/esm/CapTable/loadable.js +0 -12
  85. package/dist/esm/CapTable/styles.js +0 -17
  86. package/dist/esm/CapTooltip/CapTooltip.js +0 -34
  87. package/dist/esm/CapTooltip/index.js +0 -1
  88. package/dist/esm/CapTooltip/styles.js +0 -6
  89. package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +0 -101
  90. package/dist/esm/CapUnifiedSelect/index.js +0 -3
  91. package/dist/esm/CapUnifiedSelect/loadable.js +0 -4
  92. package/dist/esm/CapUnifiedSelect/messages.js +0 -23
  93. package/dist/esm/CapUnifiedSelect/styles.js +0 -15
  94. package/dist/esm/LocaleHoc/index.js +0 -31
  95. package/dist/esm/index.js +0 -11
  96. package/dist/esm/styled/index.js +0 -5
  97. package/dist/esm/styled/variables.js +0 -88
  98. package/dist/esm/translations/en.js +0 -329
  99. package/dist/index.js +0 -39
  100. package/dist/index.js.LICENSE.txt +0 -7
  101. package/dist/styled/index.js +0 -22
  102. package/dist/styled/variables.js +0 -94
  103. package/dist/translations/en.js +0 -335
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+
3
+ const withMemo = (Component, isEqual, log = false) => {
4
+ const defaultIsEqual = (prevProps, nextProps) => {
5
+ const prevKeys = Object.keys(prevProps).filter((key) => key !== 'intl');
6
+ const changedProps = [];
7
+ const isEqual = prevKeys.every((key) => {
8
+ const areEqual = prevProps[key] === nextProps[key];
9
+ if (!areEqual) {
10
+ changedProps.push({
11
+ key,
12
+ prevValue: prevProps[key],
13
+ nextValue: nextProps[key],
14
+ });
15
+ }
16
+ return areEqual;
17
+ });
18
+
19
+ if (log && changedProps.length > 0) {
20
+ // eslint-disable-next-line no-console
21
+ console.log('Props changed:', changedProps);
22
+ }
23
+
24
+ return isEqual;
25
+ };
26
+
27
+ if (typeof isEqual !== 'function') {
28
+ return React.memo(Component, defaultIsEqual);
29
+ }
30
+ return React.memo(Component, isEqual);
31
+ };
32
+
33
+ export default withMemo;
@@ -0,0 +1,24 @@
1
+ import styled from 'styled-components';
2
+
3
+ /**
4
+ * Enhances a React component with additional styles using styled-components.
5
+ * @param {React.ComponentType} WrappedComponent - The React component to enhance.
6
+ * @param {TemplateStringsArray} styles - CSS styles as a TemplateStringsArray.
7
+ * @returns {React.ComponentType} Returns the enhanced styled component.
8
+ */
9
+ const withStyledComponent = (WrappedComponent, styles) => {
10
+ /**
11
+ * A styled component generated by combining WrappedComponent with additional styles.
12
+ * @type {React.ComponentType}
13
+ */
14
+ const StyledComponent = styled(WrappedComponent)`
15
+ ${styles};
16
+ `;
17
+
18
+ // Set default props from the original component to the styled component
19
+ StyledComponent.defaultProps = WrappedComponent.defaultProps;
20
+
21
+ return StyledComponent;
22
+ };
23
+
24
+ export default withStyledComponent;
@@ -1,71 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { HeadingWrapper, HeadingSpan } from './styles';
4
-
5
- const CapHeading = ({ type = 'h5', children, as, ...rest }) => {
6
- return (
7
- <HeadingWrapper type={type} as={as || 'div'} {...rest}>
8
- {children}
9
- </HeadingWrapper>
10
- );
11
- };
12
-
13
- CapHeading.propTypes = {
14
- type: PropTypes.oneOf([
15
- 'h0',
16
- 'h1',
17
- 'h2',
18
- 'h3',
19
- 'h4',
20
- 'h5',
21
- 'h6',
22
- 'h7',
23
- 'h8',
24
- 'h9',
25
- 'h10',
26
- 'label1',
27
- 'label2',
28
- 'label3',
29
- 'label4',
30
- 'label5',
31
- 'label6',
32
- ]),
33
- children: PropTypes.node,
34
- as: PropTypes.string,
35
- };
36
-
37
- // Inline span version
38
- const CapHeadingSpan = ({ type = 'h5', children, ...rest }) => {
39
- return (
40
- <HeadingSpan type={type} {...rest}>
41
- {children}
42
- </HeadingSpan>
43
- );
44
- };
45
-
46
- CapHeadingSpan.propTypes = {
47
- type: PropTypes.oneOf([
48
- 'h0',
49
- 'h1',
50
- 'h2',
51
- 'h3',
52
- 'h4',
53
- 'h5',
54
- 'h6',
55
- 'h7',
56
- 'h8',
57
- 'h9',
58
- 'h10',
59
- 'label1',
60
- 'label2',
61
- 'label3',
62
- 'label4',
63
- 'label5',
64
- 'label6',
65
- ]),
66
- children: PropTypes.node,
67
- };
68
-
69
- CapHeading.Span = CapHeadingSpan;
70
-
71
- export default CapHeading;
@@ -1 +0,0 @@
1
- export { default } from './CapHeading';
@@ -1,125 +0,0 @@
1
- import styled, { css } from 'styled-components';
2
- import * as styledVars from '../styled/variables';
3
-
4
- const headings = {
5
- h0: {
6
- fontSize: '28px',
7
- fontWeight: '500',
8
- color: styledVars.CAP_G01,
9
- lineHeight: '36px',
10
- },
11
- h1: {
12
- fontSize: '24px',
13
- fontWeight: '500',
14
- color: styledVars.CAP_G01,
15
- lineHeight: '32px',
16
- },
17
- h2: {
18
- fontSize: '20px',
19
- fontWeight: '500',
20
- color: styledVars.CAP_G01,
21
- lineHeight: '28px',
22
- },
23
- h3: {
24
- fontSize: '16px',
25
- fontWeight: '500',
26
- color: styledVars.CAP_G01,
27
- lineHeight: '24px',
28
- },
29
- h4: {
30
- fontSize: '14px',
31
- fontWeight: '500',
32
- color: styledVars.CAP_G01,
33
- lineHeight: '20px',
34
- },
35
- h5: {
36
- fontSize: '14px',
37
- fontWeight: 'normal',
38
- color: styledVars.CAP_G01,
39
- lineHeight: '20px',
40
- },
41
- h6: {
42
- color: styledVars.CAP_G04,
43
- fontSize: '14px',
44
- fontWeight: 'normal',
45
- lineHeight: '20px',
46
- },
47
- h7: {
48
- fontSize: '20px',
49
- fontWeight: '500',
50
- color: styledVars.CAP_G04,
51
- lineHeight: '28px',
52
- },
53
- h8: {
54
- fontSize: '14px',
55
- fontWeight: '400',
56
- color: styledVars.CAP_G01,
57
- lineHeight: '20px',
58
- },
59
- h9: {
60
- fontSize: '14px',
61
- fontWeight: '500',
62
- color: styledVars.CAP_WHITE,
63
- lineHeight: '20px',
64
- },
65
- h10: {
66
- fontSize: '12px',
67
- fontWeight: '500',
68
- color: styledVars.CAP_G01,
69
- lineHeight: '16px',
70
- },
71
- label1: {
72
- color: styledVars.CAP_G04,
73
- fontSize: '12px',
74
- fontWeight: 'normal',
75
- lineHeight: '20px',
76
- },
77
- label2: {
78
- color: styledVars.CAP_G01,
79
- fontSize: '12px',
80
- fontWeight: 'normal',
81
- lineHeight: '20px',
82
- },
83
- label3: {
84
- color: styledVars.CAP_G05,
85
- fontSize: '12px',
86
- fontWeight: 'normal',
87
- lineHeight: '20px',
88
- },
89
- label4: {
90
- color: styledVars.CAP_G04,
91
- fontSize: '12px',
92
- fontWeight: 'normal',
93
- lineHeight: '16px',
94
- },
95
- label5: {
96
- color: styledVars.CAP_G04,
97
- fontSize: '16px',
98
- fontWeight: 'normal',
99
- lineHeight: '24px',
100
- },
101
- label6: {
102
- color: styledVars.CAP_G01,
103
- fontSize: '16px',
104
- fontWeight: 'normal',
105
- lineHeight: '24px',
106
- },
107
- };
108
-
109
- const headingStyles = css`
110
- font-size: ${props => headings[props.type].fontSize};
111
- font-weight: ${props => headings[props.type].fontWeight};
112
- color: ${props => headings[props.type].color};
113
- line-height: ${props => headings[props.type].lineHeight};
114
- margin: 0;
115
- padding: 0;
116
- `;
117
-
118
- export const HeadingWrapper = styled.div`
119
- ${headingStyles}
120
- `;
121
-
122
- export const HeadingSpan = styled.span`
123
- ${headingStyles}
124
- display: inline-block;
125
- `;
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Alert } from 'antd';
4
- import { InfoNoteWrapper } from './styles';
5
- import CapLabel from '../CapLabel';
6
- import CapRow from '../CapRow';
7
-
8
- const Note = ({ noteText }) => (
9
- <CapLabel.Inline type="label4" className="note-text">
10
- {noteText}
11
- </CapLabel.Inline>
12
- );
13
-
14
- Note.propTypes = {
15
- noteText: PropTypes.string,
16
- };
17
-
18
- const CapInfoNote = ({ message, style, noteText, type = 'info', className, ...rest }) => {
19
- return (
20
- <InfoNoteWrapper>
21
- <Alert
22
- message={(
23
- <CapRow className="note-message-container">
24
- <Note noteText={noteText} />:
25
- <CapRow className="message-text">{message}</CapRow>
26
- </CapRow>
27
- )}
28
- className={className}
29
- type={type}
30
- showIcon
31
- style={{
32
- marginTop: '0.857rem',
33
- marginBottom: '0.857rem',
34
- ...style,
35
- }}
36
- {...rest}
37
- />
38
- </InfoNoteWrapper>
39
- );
40
- };
41
-
42
- CapInfoNote.propTypes = {
43
- message: PropTypes.node,
44
- style: PropTypes.object,
45
- noteText: PropTypes.string,
46
- type: PropTypes.string,
47
- className: PropTypes.string,
48
- };
49
-
50
- CapInfoNote.defaultProps = {
51
- type: 'info',
52
- };
53
-
54
- export default CapInfoNote;
@@ -1 +0,0 @@
1
- export { default } from './CapInfoNote';
@@ -1,63 +0,0 @@
1
- import styled from 'styled-components';
2
- import * as styledVars from '../styled/variables';
3
-
4
- export const InfoNoteWrapper = styled.div`
5
- .note-text {
6
- padding-left: ${styledVars.CAP_SPACE_24};
7
- white-space: nowrap;
8
- line-height: inherit;
9
- }
10
-
11
- .note-message-container {
12
- display: flex;
13
- .message-text {
14
- margin-left: 0.22rem;
15
- }
16
- }
17
-
18
- .ant-alert {
19
- padding: 8px 12px;
20
- border-radius: ${styledVars.RADIUS_04};
21
-
22
- .ant-alert-icon {
23
- font-size: ${styledVars.ICON_SIZE_S};
24
- top: 9px;
25
- }
26
-
27
- &.ant-alert-info {
28
- background-color: ${styledVars.CAP_G09};
29
- border: 1px solid ${styledVars.CAP_G07};
30
-
31
- .ant-alert-icon {
32
- color: ${styledVars.CAP_G01};
33
- }
34
- }
35
-
36
- &.ant-alert-success {
37
- background-color: ${styledVars.CAP_COLOR_01};
38
- border: 1px solid ${styledVars.CAP_PRIMARY.base};
39
-
40
- .ant-alert-icon {
41
- color: ${styledVars.CAP_PRIMARY.base};
42
- }
43
- }
44
-
45
- &.ant-alert-warning {
46
- background-color: ${styledVars.CAP_COLOR_02};
47
- border: 1px solid ${styledVars.CAP_ORANGE};
48
-
49
- .ant-alert-icon {
50
- color: ${styledVars.CAP_ORANGE};
51
- }
52
- }
53
-
54
- &.ant-alert-error {
55
- background-color: ${styledVars.CAP_COLOR_05};
56
- border: 1px solid ${styledVars.CAP_RED};
57
-
58
- .ant-alert-icon {
59
- color: ${styledVars.CAP_RED};
60
- }
61
- }
62
- }
63
- `;
@@ -1,9 +0,0 @@
1
- /**
2
- * Asynchronously loads the CapInput component
3
- */
4
-
5
- import { loadable } from '@capillarytech/cap-ui-utils';
6
-
7
- const CapInputLoadable = loadable(() => import('./CapInput'));
8
-
9
- export default CapInputLoadable;
@@ -1,3 +0,0 @@
1
- import loadable from '@loadable/component';
2
-
3
- export default loadable(() => import('./CapUnifiedSelect'));