lupine.web 1.0.15 → 1.0.17

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 (78) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -5
  3. package/src/core/bind-lang.ts +6 -5
  4. package/src/core/bind-links.ts +2 -2
  5. package/src/core/bind-meta.tsx +52 -0
  6. package/src/core/bind-theme.ts +11 -9
  7. package/src/core/export-lupine.ts +64 -0
  8. package/src/core/index.ts +3 -1
  9. package/src/core/{core.ts → initialize.ts} +12 -79
  10. package/src/core/page-router.ts +3 -2
  11. package/src/core/server-cookie.ts +5 -3
  12. package/src/index.ts +2 -3
  13. package/src/lib/index.ts +2 -13
  14. package/src/lib/is-frontend.ts +3 -0
  15. package/src/models/index.ts +2 -0
  16. package/src/models/json-props.ts +8 -0
  17. package/src/models/theme-props.ts +7 -0
  18. package/src/{types → styles}/index.ts +0 -2
  19. package/src/assets/themes/base-themes.ts +0 -16
  20. package/src/assets/themes/dark-themes.ts +0 -85
  21. package/src/assets/themes/index.ts +0 -4
  22. package/src/assets/themes/light-themes.ts +0 -92
  23. package/src/assets/themes/shared-themes.ts +0 -50
  24. package/src/components/button-push-animation.tsx +0 -138
  25. package/src/components/button.tsx +0 -55
  26. package/src/components/drag-refresh.tsx +0 -110
  27. package/src/components/editable-label.tsx +0 -83
  28. package/src/components/float-window.tsx +0 -226
  29. package/src/components/grid.tsx +0 -18
  30. package/src/components/html-var.tsx +0 -41
  31. package/src/components/index.ts +0 -36
  32. package/src/components/input-with-title.tsx +0 -24
  33. package/src/components/link-item.tsx +0 -13
  34. package/src/components/link-list.tsx +0 -62
  35. package/src/components/menu-bar.tsx +0 -220
  36. package/src/components/menu-item-props.tsx +0 -10
  37. package/src/components/menu-sidebar.tsx +0 -289
  38. package/src/components/message-box.tsx +0 -44
  39. package/src/components/meta-data.tsx +0 -54
  40. package/src/components/meta-description.tsx +0 -19
  41. package/src/components/meta-title.tsx +0 -19
  42. package/src/components/modal.tsx +0 -29
  43. package/src/components/notice-message.tsx +0 -119
  44. package/src/components/paging-link.tsx +0 -100
  45. package/src/components/panel.tsx +0 -24
  46. package/src/components/popup-menu.tsx +0 -218
  47. package/src/components/progress.tsx +0 -91
  48. package/src/components/redirect.tsx +0 -19
  49. package/src/components/resizable-splitter.tsx +0 -129
  50. package/src/components/select-with-title.tsx +0 -37
  51. package/src/components/spinner.tsx +0 -100
  52. package/src/components/svg.tsx +0 -24
  53. package/src/components/tabs.tsx +0 -252
  54. package/src/components/text-glow.tsx +0 -36
  55. package/src/components/text-wave.tsx +0 -54
  56. package/src/components/theme-selector.tsx +0 -35
  57. package/src/components/toggle-base.tsx +0 -260
  58. package/src/components/toggle-switch.tsx +0 -156
  59. package/src/lib/date-utils.ts +0 -317
  60. package/src/lib/deep-merge.ts +0 -37
  61. package/src/lib/document-ready.ts +0 -36
  62. package/src/lib/dom/calculate-text-width.ts +0 -13
  63. package/src/lib/dom/download-stream.ts +0 -17
  64. package/src/lib/dom/download.ts +0 -12
  65. package/src/lib/dom/index.ts +0 -71
  66. package/src/lib/dynamical-load.ts +0 -138
  67. package/src/lib/format-bytes.ts +0 -11
  68. package/src/lib/lite-dom.ts +0 -227
  69. package/src/lib/message-hub.ts +0 -105
  70. package/src/lib/observable.ts +0 -188
  71. package/src/lib/promise-timeout.ts +0 -1
  72. package/src/lib/simple-storage.ts +0 -40
  73. package/src/lib/stop-propagation.ts +0 -7
  74. package/src/lib/upload-file.ts +0 -68
  75. package/src/types/css-types.ts +0 -17
  76. package/src/types/media-query.ts +0 -93
  77. /package/src/lib/{dom/cookie.ts → cookie.ts} +0 -0
  78. /package/src/{types → styles}/css-styles.ts +0 -0
@@ -1,24 +0,0 @@
1
- import { CssProps, JSXInternal } from '../jsx';
2
- import { ContentPosition, Position } from '../types';
3
-
4
- export type PanelProps = {
5
- children: any;
6
- className?: string;
7
- contentPosition?: ContentPosition;
8
- css?: CssProps;
9
- };
10
-
11
- export const Panel = ({ children, className, css }: PanelProps) => {
12
- const newCss: CssProps = {
13
- display: 'flex',
14
- flexDirection: 'column',
15
- // justifyContent: ContentPosition.center,
16
- ...css,
17
- };
18
-
19
- return (
20
- <div css={newCss} class={['panel-box', className].join(' ')}>
21
- {children}
22
- </div>
23
- );
24
- };
@@ -1,218 +0,0 @@
1
- import { RefProps, stopPropagation } from 'lupine.web';
2
-
3
- export type PopupMenuOpenMenuProps = { handle?: Function };
4
-
5
- export type PopupMenuProps = {
6
- list: string[];
7
- defaultValue: string;
8
- tips?: string;
9
- minWidth?: string;
10
- maxWidth?: string;
11
- maxHeight?: string;
12
- handleSelected?: Function;
13
- handleOpened?: Function;
14
- handleClosed?: Function;
15
- noUpdateValue?: boolean;
16
- refOpenMenu?: PopupMenuOpenMenuProps;
17
- };
18
-
19
- export type PopupMenuWithButtonProps = { label: string } & PopupMenuProps;
20
-
21
- export const PopupMenuWithButton = (props: PopupMenuWithButtonProps) => {
22
- const handle: PopupMenuOpenMenuProps = {};
23
- return (
24
- <button
25
- class='button-base'
26
- onClick={() => {
27
- handle.handle && handle.handle();
28
- }}
29
- css={{ '>div': { float: 'right', textAlign: 'left' } }}
30
- >
31
- {props.label}:{' '}
32
- <PopupMenu
33
- list={props.list}
34
- defaultValue={props.defaultValue}
35
- tips={props.tips}
36
- minWidth={props.minWidth}
37
- maxWidth={props.maxWidth}
38
- maxHeight={props.maxHeight}
39
- handleSelected={props.handleSelected}
40
- handleOpened={props.handleOpened}
41
- handleClosed={props.handleClosed}
42
- noUpdateValue={props.noUpdateValue}
43
- refOpenMenu={handle}
44
- ></PopupMenu>
45
- </button>
46
- );
47
- };
48
-
49
- export type PopupMenuWithLabelProps = { label: string } & PopupMenuProps;
50
-
51
- export const PopupMenuWithLabel = (props: PopupMenuWithLabelProps) => {
52
- const handle: PopupMenuOpenMenuProps = {};
53
- return (
54
- <div
55
- onClick={() => {
56
- handle.handle && handle.handle();
57
- }}
58
- css={{ cursor: 'pointer', '>div': { float: 'right', textAlign: 'left' } }}
59
- >
60
- {props.label}:{' '}
61
- <PopupMenu
62
- list={props.list}
63
- defaultValue={props.defaultValue}
64
- tips={props.tips}
65
- minWidth={props.minWidth}
66
- maxWidth={props.maxWidth}
67
- maxHeight={props.maxHeight}
68
- handleSelected={props.handleSelected}
69
- handleOpened={props.handleOpened}
70
- handleClosed={props.handleClosed}
71
- noUpdateValue={props.noUpdateValue}
72
- refOpenMenu={handle}
73
- ></PopupMenu>
74
- </div>
75
- );
76
- };
77
-
78
- export const PopupMenu = ({
79
- list,
80
- defaultValue,
81
- tips = '',
82
- minWidth,
83
- maxWidth,
84
- maxHeight,
85
- handleSelected,
86
- handleOpened,
87
- handleClosed,
88
- noUpdateValue,
89
- refOpenMenu,
90
- }: PopupMenuProps) => {
91
- const css: any = {
92
- '.popup-menu-item': {
93
- padding: '0 0 1px 0',
94
- display: 'inline-block',
95
- position: 'relative',
96
- '.popup-menu-text': {
97
- display: 'inline-block',
98
- cursor: 'pointer',
99
- whiteSpace: 'nowrap',
100
- marginRight: '15px',
101
- },
102
- // cover-box-shadow
103
- '.popup-menu-text::after': {
104
- content: '""',
105
- position: 'absolute',
106
- top: '50%',
107
- transform: 'translateY(-50%)',
108
- marginLeft: '3px',
109
- width: 0,
110
- height: 0,
111
- borderLeft: '5px solid transparent',
112
- borderRight: '5px solid transparent',
113
- borderTop: '5px solid var(--primary-color)',
114
- },
115
- },
116
- '.popup-menu-item:hover': {
117
- padding: '1px 0 0 0',
118
- },
119
- '.popup-menu-bottom': {
120
- position: 'relative',
121
- height: '1px',
122
- '.popup-menu-list': {
123
- display: 'none',
124
- position: 'absolute',
125
- fontSize: 'var(--menu-font-size)',
126
- top: 0,
127
- left: '2px',
128
- color: 'var(--activatable-color-normal)',
129
- backgroundColor: 'var(--activatable-bg-color-normal)',
130
- zIndex: 'var(--layer-menu)',
131
- borderRadius: '4px',
132
- border: '1px solid #ddd',
133
- padding: '5px 0px',
134
- overflow: 'auto',
135
- 'line-height': '1.2em',
136
- 'min-width': minWidth || 'auto',
137
- 'max-width': maxWidth || '200px',
138
- 'max-height': maxHeight || '300px',
139
- 'box-shadow': 'var(--cover-box-shadow)', //'#0000004c 0px 19px 38px, #00000038 0px 15px 12px',
140
- '.menu-focus': {
141
- position: 'absolute',
142
- height: '0px',
143
- },
144
- '.item': {
145
- padding: '2px 12px',
146
- },
147
- '.item:hover': {
148
- padding: '2px 11px 2px 13px',
149
- color: 'var(--activatable-color-hover)',
150
- backgroundColor: 'var(--activatable-bg-color-hover)',
151
- cursor: 'pointer',
152
- },
153
- },
154
- },
155
- };
156
-
157
- let ref: RefProps = { id: '' };
158
- let isShowing = false;
159
- const handleClick = (event: any) => {
160
- stopPropagation(event);
161
-
162
- handleOpened && handleOpened();
163
- // console.log('=======22', event);
164
- isShowing = !isShowing;
165
- ref.$('.popup-menu-list').style.display = isShowing ? 'inline-block' : 'none';
166
- ref.$('.popup-menu-list .menu-focus').focus();
167
- };
168
- if (refOpenMenu) {
169
- refOpenMenu.handle = handleClick;
170
- }
171
- const itemClick = (event: any) => {
172
- stopPropagation(event);
173
-
174
- // console.log('=======', event);
175
- isShowing = false;
176
- ref.$('.popup-menu-list').style.display = 'none';
177
- if (event.target) {
178
- if (noUpdateValue !== true) {
179
- ref.$('.popup-menu-item .popup-menu-text').innerText = event.target.innerText;
180
- }
181
- if (handleSelected) {
182
- handleSelected(event.target.innerText);
183
- }
184
- }
185
- handleClosed && handleClosed();
186
- };
187
- const onBlur = (event: any) => {
188
- setTimeout(() => {
189
- ref.$('.popup-menu-list').style.display = 'none';
190
- isShowing && handleClosed && handleClosed();
191
- isShowing = false;
192
- }, 300);
193
- };
194
-
195
- return (
196
- <div ref={ref} css={css} onClick={handleClick} title={tips}>
197
- <div class='popup-menu-item'>
198
- <span class='popup-menu-text'>{defaultValue || '&nbsp;'}</span>
199
- </div>
200
- <div class='popup-menu-bottom'>
201
- <div class='popup-menu-list'>
202
- <div>
203
- {list.map((item) => {
204
- return item === '' ? (
205
- <hr />
206
- ) : (
207
- <div class='item' onClick={itemClick}>
208
- {item}
209
- </div>
210
- );
211
- })}
212
- </div>
213
- <div class='menu-focus' onBlur={onBlur} tabIndex={0}></div>
214
- </div>
215
- </div>
216
- </div>
217
- );
218
- };
@@ -1,91 +0,0 @@
1
- import { RefProps } from '../jsx';
2
- import { HtmlVar } from './html-var';
3
-
4
- export type ProgressHookProps = {
5
- onProgress?: (percentage: number, chunkNumber: number, totalChunks: number) => void;
6
- onShow?: (show: boolean, title?: string) => void;
7
- };
8
- export type ProgressProps = {
9
- hook: ProgressHookProps;
10
- };
11
-
12
- export const Progress = (props: ProgressProps) => {
13
- const css: any = {
14
- position: 'fixed',
15
- display: 'flex',
16
- bottom: '0',
17
- left: '0',
18
- width: '100%',
19
- zIndex: 'var(--layer-modal-over)',
20
- flexDirection: 'column',
21
- backgroundColor: '#e6e6e6de',
22
- padding: '16px',
23
- '.progress-box': {
24
- display: 'flex',
25
- flexDirection: 'column',
26
- alignItems: 'center',
27
- justifyContent: 'center',
28
- width: '100%',
29
- height: 'auto',
30
- margin: 'auto',
31
- },
32
- '.progress-bar': {
33
- display: 'flex',
34
- width: '100%',
35
- height: '60px',
36
- borderRadius: '4px',
37
- overflow: 'hidden',
38
- },
39
- '.progress-bar1': {
40
- height: '100%',
41
- width: '0%',
42
- backgroundColor: '#49e57e',
43
- },
44
- '.progress-bar2': {
45
- height: '100%',
46
- width: '100%',
47
- backgroundColor: '#2bb8cd',
48
- },
49
- '.progress-tips': {
50
- marginTop: '10px',
51
- fontSize: '30px',
52
- color: '#49e57e',
53
- },
54
- };
55
-
56
- props.hook.onProgress = (percentage: number, chunkNumber: number, totalChunks: number) => {
57
- // console.log(`Upload progress: ${percentage}% (chunk ${chunkNumber} of ${totalChunks})`);
58
- percentage = Math.round(percentage * 100);
59
- const bar1 = document.querySelector('.progress-bar1') as HTMLElement;
60
- const bar2 = document.querySelector('.progress-bar2') as HTMLElement;
61
- bar1.style.width = `${percentage}%`;
62
- bar2.style.width = `${1 - percentage}%`;
63
- dom.value = `${percentage}%`;
64
- };
65
- props.hook.onShow = (show: boolean, title?: string) => {
66
- if (title) {
67
- domTitle.value = title;
68
- }
69
- if (show) {
70
- ref.current?.classList.remove('d-none');
71
- } else {
72
- ref.current?.classList.add('d-none');
73
- }
74
- };
75
-
76
- const ref: RefProps = {};
77
- const domTitle = HtmlVar('Progress');
78
- const dom = HtmlVar('0 %');
79
- return (
80
- <div ref={ref} css={css} class='progress-top d-none'>
81
- <div class='progress-box'>
82
- <div class='progress-title mb-m align-left w-100p'>{domTitle.node}</div>
83
- <div class='progress-bar'>
84
- <div class='progress-bar1'></div>
85
- <div class='progress-bar2'></div>
86
- </div>
87
- <div class='progress-tips'>{dom.node}</div>
88
- </div>
89
- </div>
90
- );
91
- };
@@ -1,19 +0,0 @@
1
- import { RefProps } from '../jsx';
2
-
3
- export type RedirectProps = {
4
- title?: string;
5
- url: string;
6
- delaySeconds?: number;
7
- };
8
- export const Redirect = ({ title = 'redirect...', url, delaySeconds = 0 }: RedirectProps) => {
9
- // if SSR is disabled, then MetaData will not be working
10
- // MetaData({ httpEquiv: 'refresh', content: delaySeconds + ';URL=' + url });
11
- const ref: RefProps = {
12
- onLoad: async (el: Element) => {
13
- setTimeout(() => {
14
- window.location.href = url;
15
- }, delaySeconds * 1000);
16
- },
17
- };
18
- return <div ref={ref}>{title}</div>;
19
- };
@@ -1,129 +0,0 @@
1
- import { bindGlobalStyles } from '../core';
2
- import { CssProps } from '../jsx';
3
- import { stopPropagation } from '../lib';
4
- /**
5
- How to use:
6
- // getSplitter's first parameter is the container's selector where the Splitter will be in.
7
- // the second parameter is whether it's Vertical
8
- // then the third parameter is it's RightOrTop or not
9
- const locationLeft = false;
10
- const splitter = ResizableSplitter.getSplitter('.body .side', true, locationLeft);
11
- const container = (
12
- <div class='body'>
13
- <div class='side'>
14
- {splitter}
15
- {designPanel}
16
- </div>
17
- ...
18
-
19
- */
20
- export class ResizableSplitter {
21
- static hostNode: HTMLElement;
22
- static isVertical = true;
23
- static isRightOrTop = true;
24
-
25
- private static initialized = false;
26
- private static startXorY = 0;
27
- private static startWidthOrHeight = 0;
28
- private static pressed = false;
29
-
30
- static init() {
31
- /* styles for resizable splitter */
32
- const css: CssProps = {
33
- '.resizable-splitter-v-left, .resizable-splitter-v-right': {
34
- position: 'absolute',
35
- top: 0,
36
- bottom: 0,
37
- left: 0,
38
- width: '2px',
39
- cursor: 'col-resize',
40
- },
41
- '.resizable-splitter-v-right': {
42
- left: 'unset',
43
- right: 0,
44
- },
45
- '.resizable-splitter-v-left:hover, .resizable-splitter-v-right:hover': {
46
- width: '4px',
47
- backgroundColor: '#ccc',
48
- },
49
-
50
- '.resizable-splitter-h-top, .resizable-splitter-h-bottom': {
51
- position: 'absolute',
52
- top: 0,
53
- left: 0,
54
- right: 0,
55
- height: '2px',
56
- cursor: 'row-resize',
57
- },
58
- '.resizable-splitter-h-bottom': {
59
- top: 'unset',
60
- bottom: 0,
61
- },
62
- '.resizable-splitter-h-top:hover, .resizable-splitter-h-bottom:hover': {
63
- height: '4px',
64
- backgroundColor: '#ccc',
65
- },
66
- };
67
- bindGlobalStyles('resizable-splitter', 'html', css);
68
-
69
- window.addEventListener('mousemove', ResizableSplitter.onMousemove.bind(ResizableSplitter), false);
70
- document.documentElement.addEventListener('mouseup', ResizableSplitter.onMouseup.bind(ResizableSplitter), false);
71
- }
72
-
73
- static getSplitterClassName(isVertical: boolean, isRightOrTop: boolean): string {
74
- const className =
75
- 'resizable-splitter-' +
76
- (isVertical ? (isRightOrTop ? 'v-right' : 'v-left') : isRightOrTop ? 'h-top' : 'h-bottom');
77
- return className;
78
- }
79
-
80
- static onMousedown(event: any) {
81
- if (event.buttons !== 1 || event.button !== 0) return;
82
- this.pressed = true;
83
- this.startXorY = this.isVertical ? event.clientX : event.clientY;
84
- const startPosition = document.defaultView!.getComputedStyle(this.hostNode)[this.isVertical ? 'width' : 'height'];
85
- this.startWidthOrHeight = parseInt(startPosition, 10);
86
- }
87
-
88
- static onMousemove(event: any) {
89
- if (!this.pressed || event.buttons !== 1 || event.button !== 0) {
90
- return;
91
- }
92
-
93
- // prevent text/element selection when drag
94
- stopPropagation(event);
95
- if (this.isVertical) {
96
- const movedXorY = this.startWidthOrHeight + (event.clientX - this.startXorY) * (this.isRightOrTop ? 1 : -1);
97
- this.hostNode.style.width = movedXorY + 'px';
98
- } else {
99
- const movedXorY = this.startWidthOrHeight + (event.clientY - this.startXorY) * (this.isRightOrTop ? -1 : 1);
100
- this.hostNode.style.height = movedXorY + 'px';
101
- }
102
- }
103
-
104
- static onMouseup() {
105
- if (this.pressed) this.pressed = false;
106
- }
107
-
108
- static getSplitter(selector: string, isVertical: boolean, isRightOrTop: boolean) {
109
- const className = this.getSplitterClassName(isVertical, isRightOrTop);
110
-
111
- const onMousedown = (event: any) => {
112
- if (!this.initialized) {
113
- this.initialized = true;
114
- this.init();
115
- }
116
-
117
- ResizableSplitter.hostNode = document.querySelector(selector)!;
118
- if (!ResizableSplitter.hostNode) {
119
- console.error(`Can't find element: ${selector}`);
120
- return;
121
- }
122
- ResizableSplitter.isVertical = isVertical;
123
- ResizableSplitter.isRightOrTop = isRightOrTop;
124
- ResizableSplitter.onMousedown.bind(ResizableSplitter)(event);
125
- };
126
-
127
- return <div onMouseDown={onMousedown} class={className}></div>;
128
- }
129
- }
@@ -1,37 +0,0 @@
1
- import { CssProps } from '../jsx';
2
-
3
- export type SelectOptionProps = {
4
- option: string;
5
- value: string;
6
- selected?: boolean;
7
- };
8
- export const SelectWithTitle = (
9
- title: string,
10
- options: SelectOptionProps[],
11
- onOptionChanged: (option: string) => void,
12
- size?: number,
13
- className = 'input-base',
14
- width = '100%',
15
- ) => {
16
- const css: CssProps = {
17
- select: {
18
- height: 'auto',
19
- overflowY: 'auto',
20
- width,
21
- },
22
- };
23
- return (
24
- <div css={css}>
25
- <div>{title}</div>
26
- <div>
27
- <select class={className} onChange={(e: any) => onOptionChanged(e?.target?.value)} size={size}>
28
- {options.map((option) => (
29
- <option value={option.value} selected={option.selected}>
30
- {option.option}
31
- </option>
32
- ))}
33
- </select>
34
- </div>
35
- </div>
36
- );
37
- };
@@ -1,100 +0,0 @@
1
- export enum SpinnerSize {
2
- Small = '22px',
3
- Medium = '30px',
4
- Large = '40px',
5
- LargeLarge = '60px',
6
- }
7
- export const Spinner01 = ({
8
- size = SpinnerSize.Medium,
9
- color = 'var(--primary-color)',
10
- }: {
11
- size?: SpinnerSize;
12
- color?: string;
13
- }) => {
14
- const borderWidth =
15
- size === SpinnerSize.Small || size === SpinnerSize.Medium ? '4px' : size === SpinnerSize.Large ? '6px' : '9px';
16
- const css: any = {
17
- width: size,
18
- aspectRatio: 1,
19
- borderRadius: '50%',
20
- background: `radial-gradient(farthest-side,${color} 94%,#0000) top/8px 8px no-repeat, conic-gradient(#0000 30%,${color})`,
21
- '-webkit-mask': `radial-gradient(farthest-side,#0000 calc(100% - ${borderWidth}),#000 0)`,
22
- animation: 'spinner01 1s infinite linear',
23
- '@keyframes spinner01': {
24
- '100%': { transform: 'rotate(1turn)' },
25
- },
26
- };
27
- return <div css={css}></div>;
28
- };
29
-
30
- export const Spinner02 = ({
31
- size = SpinnerSize.Medium,
32
- color = 'var(--primary-color)',
33
- }: {
34
- size?: SpinnerSize;
35
- color?: string;
36
- }) => {
37
- const base = parseInt(size.replace('px', ''));
38
- const ballSize = Array.from({ length: 7 }, (_, i) => `${i * base / 15 / 7}px`);
39
- const css: any = {
40
- width: size,
41
- height: size,
42
- display: 'flex',
43
- placeItems: 'center',
44
- justifyContent: 'center',
45
- '.spinner02-box': {
46
- '--spin02-w': `${base / 2 - 3}px`,
47
- width: '4px',
48
- height: '4px',
49
- borderRadius: '50%',
50
- color,
51
- boxShadow: `
52
- calc(1*var(--spin02-w)) calc(0*var(--spin02-w)) 0 0,
53
- calc(0.707*var(--spin02-w)) calc(0.707*var(--spin02-w)) 0 ${ballSize[1]},
54
- calc(0*var(--spin02-w)) calc(1*var(--spin02-w)) 0 ${ballSize[2]},
55
- calc(-0.707*var(--spin02-w)) calc(0.707*var(--spin02-w)) 0 ${ballSize[3]},
56
- calc(-1*var(--spin02-w)) calc(0*var(--spin02-w)) 0 ${ballSize[4]},
57
- calc(-0.707*var(--spin02-w)) calc(-0.707*var(--spin02-w)) 0 ${ballSize[5]},
58
- calc(0*var(--spin02-w)) calc(-1*var(--spin02-w)) 0 ${ballSize[6]}`,
59
- animation: 'spinner02 1s infinite steps(8)',
60
- },
61
- '@keyframes spinner02': {
62
- '100%': { transform: 'rotate(1turn)' },
63
- },
64
- };
65
- return (
66
- <div css={css}>
67
- <div class='spinner02-box'></div>
68
- </div>
69
- );
70
- };
71
-
72
- // color should be space splited RGB colors
73
- export const Spinner03 = ({ size = SpinnerSize.Medium, colorRGB = '55 55 55' }: { size?: SpinnerSize; colorRGB?: string }) => {
74
- const css: any = {
75
- width: size,
76
- height: size,
77
- aspectRatio: 1,
78
- display: 'grid',
79
- borderRadius: '50%',
80
- background: `linear-gradient(0deg, rgb(${colorRGB} / 50%) 30%, #0000 0 70%, rgb(${colorRGB} / 100%) 0) 50% / 8% 100%, linear-gradient(90deg, rgb(${colorRGB} / 25%) 30%, #0000 0 70%, rgb(${colorRGB} / 75%) 0) 50% / 100% 8%`,
81
- backgroundRepeat: 'no-repeat',
82
- animation: 'spinner03 1s infinite steps(12)',
83
- '&::before, &::after': {
84
- content: '""',
85
- gridArea: '1/1',
86
- borderRadius: '50%',
87
- background: 'inherit',
88
- opacity: 0.915,
89
- transform: 'rotate(30deg)',
90
- },
91
- '&::after': {
92
- opacity: 0.83,
93
- transform: 'rotate(60deg)',
94
- },
95
- '@keyframes spinner03': {
96
- '100%': { transform: 'rotate(1turn)' },
97
- },
98
- };
99
- return <div css={css}></div>;
100
- };
@@ -1,24 +0,0 @@
1
- // this is not a good approach because if one svg file is used in multiple places
2
- // then the svg string will be rendered multiple times.
3
- export const Svg = ({
4
- children,
5
- width,
6
- height,
7
- color,
8
- }: {
9
- children: string;
10
- width?: string;
11
- height?: string;
12
- color?: string;
13
- }) => {
14
- const css: any = {
15
- svg: {
16
- maxWidth: '100%',
17
- maxHeight: '100%',
18
- width,
19
- height,
20
- fill: color,
21
- },
22
- };
23
- return <div css={css}>{children}</div>;
24
- };