@semcore/skeleton 2.3.0 → 3.1.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/lib/cjs/Charts/Area.js.map +1 -1
  3. package/lib/cjs/Charts/Bar.js.map +1 -1
  4. package/lib/cjs/Charts/Bubble.js +49 -0
  5. package/lib/cjs/Charts/Bubble.js.map +1 -0
  6. package/lib/cjs/Charts/Histogram.js.map +1 -1
  7. package/lib/cjs/Charts/Line.js.map +1 -1
  8. package/lib/cjs/Charts/Pie.js.map +1 -1
  9. package/lib/cjs/Charts/ScatterPlot.js +57 -0
  10. package/lib/cjs/Charts/ScatterPlot.js.map +1 -0
  11. package/lib/cjs/Charts/Venn.js.map +1 -1
  12. package/lib/cjs/Charts/index.js +19 -73
  13. package/lib/cjs/Charts/index.js.map +1 -1
  14. package/lib/cjs/Skeleton.js +3 -12
  15. package/lib/cjs/Skeleton.js.map +1 -1
  16. package/lib/cjs/index.js.map +1 -1
  17. package/lib/es6/Charts/Area.js.map +1 -1
  18. package/lib/es6/Charts/Bar.js.map +1 -1
  19. package/lib/es6/Charts/Bubble.js +37 -0
  20. package/lib/es6/Charts/Bubble.js.map +1 -0
  21. package/lib/es6/Charts/Histogram.js.map +1 -1
  22. package/lib/es6/Charts/Line.js.map +1 -1
  23. package/lib/es6/Charts/Pie.js.map +1 -1
  24. package/lib/es6/Charts/ScatterPlot.js +45 -0
  25. package/lib/es6/Charts/ScatterPlot.js.map +1 -0
  26. package/lib/es6/Charts/Venn.js.map +1 -1
  27. package/lib/es6/Charts/index.js +2 -5
  28. package/lib/es6/Charts/index.js.map +1 -1
  29. package/lib/es6/Skeleton.js +3 -8
  30. package/lib/es6/Skeleton.js.map +1 -1
  31. package/lib/es6/index.js.map +1 -1
  32. package/lib/types/index.d.ts +69 -3
  33. package/package.json +3 -5
  34. package/src/Charts/{Area.tsx → Area.js} +2 -8
  35. package/src/Charts/{Bar.tsx → Bar.js} +2 -8
  36. package/src/Charts/Bubble.js +40 -0
  37. package/src/Charts/{Histogram.tsx → Histogram.js} +2 -8
  38. package/src/Charts/{Line.tsx → Line.js} +2 -8
  39. package/src/Charts/{Pie.tsx → Pie.js} +2 -6
  40. package/src/Charts/ScatterPlot.js +50 -0
  41. package/src/Charts/{Venn.tsx → Venn.js} +2 -4
  42. package/{lib/types/Charts/index.d.ts → src/Charts/index.js} +2 -5
  43. package/src/Skeleton.js +83 -0
  44. package/src/index.d.ts +69 -0
  45. package/src/{index.tsx → index.js} +0 -0
  46. package/lib/types/Charts/Area.d.ts +0 -7
  47. package/lib/types/Charts/Bar.d.ts +0 -7
  48. package/lib/types/Charts/Histogram.d.ts +0 -7
  49. package/lib/types/Charts/Line.d.ts +0 -7
  50. package/lib/types/Charts/Pie.d.ts +0 -6
  51. package/lib/types/Charts/Venn.d.ts +0 -4
  52. package/lib/types/Skeleton.d.ts +0 -44
  53. package/src/Charts/index.tsx +0 -12
  54. package/src/Skeleton.tsx +0 -144
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { ISkeletonProps } from '../Skeleton';
3
- export interface HistogramChartSkeletonProps extends ISkeletonProps {
4
- layout?: 'horizontal' | 'vertical';
5
- }
6
- declare const HistogramChartSkeleton: React.FunctionComponent<HistogramChartSkeletonProps & React.SVGAttributes<SVGElement>>;
7
- export default HistogramChartSkeleton;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { ISkeletonProps } from '../Skeleton';
3
- export interface LineChartSkeletonSkeletonProps extends ISkeletonProps {
4
- type?: 'linear' | 'monotone';
5
- }
6
- declare const LineChartSkeleton: React.FunctionComponent<LineChartSkeletonSkeletonProps & React.SVGAttributes<SVGElement>>;
7
- export default LineChartSkeleton;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { ISkeletonProps } from '../Skeleton';
3
- export interface PieChartSkeletonProps extends ISkeletonProps {
4
- }
5
- declare const PieChartSkeleton: React.FunctionComponent<PieChartSkeletonProps & React.SVGAttributes<SVGElement>>;
6
- export default PieChartSkeleton;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { ISkeletonProps } from '../Skeleton';
3
- declare const VennChartSkeleton: React.FunctionComponent<ISkeletonProps & React.SVGAttributes<SVGElement>>;
4
- export default VennChartSkeleton;
@@ -1,44 +0,0 @@
1
- import React from 'react';
2
- import { Merge } from '@semcore/core';
3
- import { IBoxProps } from '@semcore/flex-box';
4
- import { IUniqueIDProps } from '@semcore/utils/lib/uniqueID';
5
- export interface ISkeletonTextProps extends IBoxProps {
6
- /**
7
- * Number of items to be returned
8
- * @default 1
9
- */
10
- amount?: string | number;
11
- }
12
- export interface ISkeletonProps extends IBoxProps, IUniqueIDProps {
13
- /**
14
- * Skeleton visibility control property
15
- */
16
- hidden?: boolean;
17
- /**
18
- * Animation speed in ms
19
- * @default 2000
20
- */
21
- duration?: string | number;
22
- /**
23
- * Skeleton theme
24
- * @default invert
25
- */
26
- theme?: 'dark' | 'invert';
27
- /** Skeleton visibility control property
28
- * @deprecated v2.0.0 {@link ISkeletonProps.hidden}
29
- * */
30
- visible?: boolean;
31
- /** Animation speed in ms
32
- * @deprecated v2.0.0 {@link ISkeletonProps.duration}
33
- * */
34
- speed?: string | number;
35
- }
36
- export interface ISkeletonCtx {
37
- gradientUrl: 'string';
38
- }
39
- declare const _default: import("@semcore/core").ComponentType<Merge<ISkeletonProps, React.SVGAttributes<SVGElement>>, {
40
- Text: Merge<ISkeletonTextProps, React.SVGAttributes<any>>;
41
- }, ISkeletonCtx, {
42
- [key: string]: (arg: unknown) => void;
43
- }, null>;
44
- export default _default;
@@ -1,12 +0,0 @@
1
- export { default as HistogramChartSkeleton } from './Histogram';
2
- export { default as PieChartSkeleton } from './Pie';
3
- export { default as BarChartSkeleton } from './Bar';
4
- export { default as AreaChartSkeleton } from './Area';
5
- export { default as LineChartSkeleton } from './Line';
6
- export { default as VennChartSkeleton } from './Venn';
7
-
8
- export * from './Histogram';
9
- export * from './Pie';
10
- export * from './Bar';
11
- export * from './Area';
12
- export * from './Line';
package/src/Skeleton.tsx DELETED
@@ -1,144 +0,0 @@
1
- import React from 'react';
2
- import createComponent, { Component, IFunctionProps, Merge, sstyled, Root } from '@semcore/core';
3
- import { Box, IBoxProps } from '@semcore/flex-box';
4
- import logger from '@semcore/utils/lib/logger';
5
- import uniqueIDEnhancement, { IUniqueIDProps } from '@semcore/utils/lib/uniqueID';
6
-
7
- import style from './style/skeleton.shadow.css';
8
-
9
- export interface ISkeletonTextProps extends IBoxProps {
10
- /**
11
- * Number of items to be returned
12
- * @default 1
13
- */
14
- amount?: string | number;
15
- }
16
-
17
- export interface ISkeletonProps extends IBoxProps, IUniqueIDProps {
18
- /**
19
- * Skeleton visibility control property
20
- */
21
- hidden?: boolean;
22
- /**
23
- * Animation speed in ms
24
- * @default 2000
25
- */
26
- duration?: string | number;
27
- /**
28
- * Skeleton theme
29
- * @default invert
30
- */
31
- theme?: 'dark' | 'invert';
32
- /** Skeleton visibility control property
33
- * @deprecated v2.0.0 {@link ISkeletonProps.hidden}
34
- * */
35
- visible?: boolean;
36
- /** Animation speed in ms
37
- * @deprecated v2.0.0 {@link ISkeletonProps.duration}
38
- * */
39
- speed?: string | number;
40
- }
41
-
42
- const MAP_COLOR_THEME = {
43
- dark: 'rgba(255,255,255,0.5)',
44
- invert: '#edeff0',
45
- };
46
-
47
- export interface ISkeletonCtx {
48
- gradientUrl: 'string';
49
- }
50
-
51
- class Skeleton extends Component<ISkeletonProps> {
52
- static displayName = 'Skeleton';
53
- static style = style;
54
- static defaultProps = {
55
- width: '100%',
56
- height: 100,
57
- theme: 'invert',
58
- duration: 2000,
59
- };
60
- static enhance = [uniqueIDEnhancement()];
61
-
62
- setContext() {
63
- const { theme } = this.asProps;
64
- return {
65
- gradientUrl: MAP_COLOR_THEME[theme],
66
- };
67
- }
68
-
69
- render() {
70
- const SSkeleton = Root;
71
- const { Children, styles, duration, speed, hidden, visible, uid, ...other } = this.asProps;
72
-
73
- logger.warn(
74
- visible !== undefined,
75
- "'visible' property is deprecated, use 'hidden'",
76
- other['data-ui-name'] || Skeleton.displayName,
77
- );
78
-
79
- logger.warn(
80
- speed !== undefined,
81
- "'speed' property is deprecated, use 'duration'",
82
- other['data-ui-name'] || Skeleton.displayName,
83
- );
84
-
85
- if (visible === false) return null;
86
- if (hidden) return null;
87
-
88
- return sstyled(styles)(
89
- <SSkeleton
90
- render={Box}
91
- tag="svg"
92
- preserveAspectRatio="none"
93
- durationAnim={`${duration || speed}ms`}
94
- >
95
- <defs>
96
- <mask id={uid}>
97
- <Children />
98
- </mask>
99
- </defs>
100
- <rect x="0" y="0" width="100%" height="100%" mask={`url(#${uid})`} />
101
- </SSkeleton>,
102
- );
103
- }
104
- }
105
-
106
- function Text(props: IFunctionProps<ISkeletonTextProps, ISkeletonCtx>) {
107
- const SText = Box;
108
- const { amount, y, x, styles, forwardRef, ...other } = props;
109
- const amountLine = Number(amount);
110
-
111
- const renderRect = (props) => {
112
- return sstyled(styles)(<SText tag="rect" rx="4" ry="4" height="8" {...props} />);
113
- };
114
-
115
- return (
116
- <React.Fragment>
117
- {[...Array(amountLine)].map((el, index) =>
118
- renderRect({
119
- key: index,
120
- y: y || 20 * index,
121
- x,
122
- ref: forwardRef,
123
- ...other,
124
- }),
125
- )}
126
- </React.Fragment>
127
- );
128
- }
129
- Text.defaultProps = {
130
- x: 0,
131
- y: 0,
132
- amount: 1,
133
- width: '100%',
134
- };
135
-
136
- export default createComponent<
137
- Merge<ISkeletonProps, React.SVGAttributes<SVGElement>>,
138
- {
139
- Text: Merge<ISkeletonTextProps, React.SVGAttributes<any>>;
140
- },
141
- ISkeletonCtx
142
- >(Skeleton, {
143
- Text,
144
- });