amotify 0.0.65 → 0.0.66

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 (114) hide show
  1. package/dist/amotify.js +3 -2
  2. package/dist/amotify.min.css +2 -2
  3. package/dist/coreVender.js +14 -2
  4. package/package.json +10 -10
  5. package/tsconfig.json +13 -5
  6. package/@types/_.tsx +0 -7
  7. package/@types/amot.tsx +0 -355
  8. package/@types/fn.tsx +0 -1280
  9. package/@types/jsminAmotifyExtension.tsx +0 -137
  10. package/@types/module.tsx +0 -1
  11. package/@types/state.tsx +0 -231
  12. package/src/@atoms.tsx +0 -34
  13. package/src/@functions.tsx +0 -29
  14. package/src/@global.tsx +0 -145
  15. package/src/@jsminAmotifyExtension/_.tsx +0 -4
  16. package/src/@jsminAmotifyExtension/fetch.tsx +0 -110
  17. package/src/@jsminAmotifyExtension/formCollect.tsx +0 -94
  18. package/src/@jsminAmotifyExtension/spreadSheet.tsx +0 -165
  19. package/src/@jsminAmotifyExtension/variables.tsx +0 -137
  20. package/src/@molecules.tsx +0 -96
  21. package/src/@organisms.tsx +0 -1
  22. package/src/@reactPacks/reactProduction@18.2.0.js +0 -79
  23. package/src/@reactPacks/reactRouterDomProduction@18.2.0.js +0 -31
  24. package/src/@styles/@app.scss +0 -4
  25. package/src/@styles/UniStyling.scss +0 -1028
  26. package/src/@styles/init.scss +0 -94
  27. package/src/@styles/props.scss +0 -109
  28. package/src/@styles/styleSet.scss +0 -38
  29. package/src/@styles/themeColor.scss +0 -71
  30. package/src/@styles/var.scss +0 -182
  31. package/src/@templates.tsx +0 -7
  32. package/src/@variables.tsx +0 -74
  33. package/src/atoms/FAI/parts.tsx +0 -139
  34. package/src/atoms/Logo/parts.tsx +0 -335
  35. package/src/atoms/Logo/style.module.scss +0 -96
  36. package/src/atoms/Various/parts.tsx +0 -159
  37. package/src/atoms/Various/style.module.scss +0 -46
  38. package/src/config.tsx +0 -191
  39. package/src/functions/Button/_.tsx +0 -331
  40. package/src/functions/Button/style.module.scss +0 -157
  41. package/src/functions/Cropper/parts.tsx +0 -1084
  42. package/src/functions/Cropper/style.module.scss +0 -64
  43. package/src/functions/Effects/Fade.tsx +0 -76
  44. package/src/functions/Effects/Ripple.tsx +0 -141
  45. package/src/functions/Effects/_.tsx +0 -33
  46. package/src/functions/Effects/style.module.scss +0 -91
  47. package/src/functions/Input/Chips/Selector.tsx +0 -445
  48. package/src/functions/Input/Chips/_.tsx +0 -289
  49. package/src/functions/Input/Chips/style.module.scss +0 -6
  50. package/src/functions/Input/Contenteditable.tsx +0 -114
  51. package/src/functions/Input/DigitCharacters.tsx +0 -235
  52. package/src/functions/Input/File/_.tsx +0 -553
  53. package/src/functions/Input/File/style.module.scss +0 -34
  54. package/src/functions/Input/Hidden.tsx +0 -21
  55. package/src/functions/Input/List/_.tsx +0 -383
  56. package/src/functions/Input/List/style.module.scss +0 -84
  57. package/src/functions/Input/RichSelect/_.tsx +0 -230
  58. package/src/functions/Input/RichSelect/style.module.scss +0 -11
  59. package/src/functions/Input/Segmented/_.tsx +0 -246
  60. package/src/functions/Input/Segmented/style.module.scss +0 -81
  61. package/src/functions/Input/Select/_.tsx +0 -218
  62. package/src/functions/Input/Select/style.module.scss +0 -11
  63. package/src/functions/Input/Slider/_.tsx +0 -524
  64. package/src/functions/Input/Slider/style.module.scss +0 -67
  65. package/src/functions/Input/Switch/_.tsx +0 -176
  66. package/src/functions/Input/Switch/style.module.scss +0 -18
  67. package/src/functions/Input/Text.tsx +0 -487
  68. package/src/functions/Input/TextArea.tsx +0 -109
  69. package/src/functions/Input/Time/Picker.tsx +0 -1361
  70. package/src/functions/Input/Time/_.tsx +0 -749
  71. package/src/functions/Input/Time/style.module.scss +0 -79
  72. package/src/functions/Input/_.tsx +0 -881
  73. package/src/functions/Input/core.tsx +0 -473
  74. package/src/functions/Input/style.module.scss +0 -102
  75. package/src/functions/Inputs/_.tsx +0 -5
  76. package/src/functions/Inputs/style.module.scss +0 -15
  77. package/src/functions/Inputs/text.tsx +0 -53
  78. package/src/functions/Inputs/types.d.ts +0 -13
  79. package/src/functions/Layout/PageNotFound.tsx +0 -78
  80. package/src/functions/Layout/PageRouter.tsx +0 -89
  81. package/src/functions/Layout/PageViewController/parts.tsx +0 -27
  82. package/src/functions/Layout/Plate.tsx +0 -30
  83. package/src/functions/Layout/RootViewController/parts.tsx +0 -300
  84. package/src/functions/Layout/RootViewController/style.module.scss +0 -23
  85. package/src/functions/Layout/SwipeView/parts.tsx +0 -375
  86. package/src/functions/Layout/SwipeView/style.module.scss +0 -20
  87. package/src/functions/Layout/TabBar.tsx +0 -60
  88. package/src/functions/Layout/_.tsx +0 -20
  89. package/src/functions/Loader/corner.tsx +0 -74
  90. package/src/functions/Loader/mini.tsx +0 -114
  91. package/src/functions/Loader/parts.tsx +0 -103
  92. package/src/functions/Loader/style.module.scss +0 -223
  93. package/src/functions/Loader/top.tsx +0 -84
  94. package/src/functions/Sheet/parts.tsx +0 -994
  95. package/src/functions/Sheet/style.module.scss +0 -208
  96. package/src/functions/SnackBar/parts.tsx +0 -215
  97. package/src/functions/SnackBar/style.module.scss +0 -25
  98. package/src/functions/Table/Data/parts.tsx +0 -965
  99. package/src/functions/Table/Drag/parts.tsx +0 -442
  100. package/src/functions/Table/Normal/parts.tsx +0 -124
  101. package/src/functions/Table/_.tsx +0 -177
  102. package/src/functions/Table/style.module.scss +0 -93
  103. package/src/functions/Tooltips/parts.tsx +0 -53
  104. package/src/global/LaunchReactApplication.tsx +0 -40
  105. package/src/global/styleConverter.tsx +0 -465
  106. package/src/launch.tsx +0 -117
  107. package/src/molecules/Accordion/parts.tsx +0 -146
  108. package/src/molecules/Accordion/style.module.scss +0 -13
  109. package/src/molecules/LinkifyText/parts.tsx +0 -52
  110. package/src/molecules/List.tsx +0 -31
  111. package/src/preload.tsx +0 -31
  112. package/src/templates/PlayGround/parts.tsx +0 -96
  113. package/src/templates/PlayGround/style.module.scss +0 -38
  114. package/webpack.config.js +0 -146
@@ -1,375 +0,0 @@
1
- import {
2
- useStore,
3
- React
4
- } from '@global'
5
- import {
6
- Box,
7
- Flex
8
- } from '@atoms'
9
-
10
- import style from './style.module.scss'
11
-
12
- type SlideEventProps = {
13
- eventType: 'usr' | 'sys' | 'init' | 'adjustLoop'
14
- index: number
15
- }
16
- type SliderInfoProps = {
17
- x: number
18
- y: number
19
- effectStartAt: number
20
- process: boolean
21
- loop: boolean
22
- id: string
23
- index: number
24
- minIndex: number
25
- maxIndex: number
26
- width: number
27
- set_event: React.Dispatch<React.SetStateAction<SlideEventProps>>
28
- }
29
-
30
- export const SwipeView = ( params: amotify.fn.Layout.SwipeView.Params ) => {
31
- return <Core
32
- { ...params }
33
- slideIndex={ Math.max( Math.min( params.slideIndex!,params.slides.length - 1 ),0 ) }
34
- />
35
- }
36
- export const Core: React.FC<amotify.fn.Layout.SwipeView.Params> = ( params ) => {
37
- let {
38
- options: {
39
- onSlideCallback,
40
- visibilitySurroundSlide = true,
41
- autoSwipeSeconds = 0,
42
- loop = false,
43
- disableMousedrag = false,
44
- disableTouch = false,
45
- } = {},
46
- wrapper = ( slide ) => ( slide ),
47
- slides = [],
48
- ...others
49
- } = params
50
-
51
- let [ val_swipeID ] = React.useState( $.uuidGen() )
52
- let [ val_event,set_event ] = React.useState( {
53
- eventType: 'init',
54
- index: params.slideIndex
55
- } as SlideEventProps )
56
-
57
- React.useEffect( () => {
58
- useStore.set( {
59
- key: 'SwipeTimer-' + val_swipeID,
60
- value: null
61
- } )
62
- },[] )
63
-
64
- const mounted = React.useRef( false )
65
- React.useEffect( () => {
66
- set_event( {
67
- eventType: 'usr',
68
- index: params.slideIndex!
69
- } )
70
-
71
- if ( !mounted.current ) mounted.current = true
72
- },[ params.slideIndex ] )
73
-
74
- React.useEffect( () => {
75
- let Index = val_event.index + ( loop ? 1 : 0 )
76
- let CopyIndex = [ -1,slides.length ].includes( val_event.index )
77
-
78
- if ( !CopyIndex ) if ( onSlideCallback ) setTimeout( () => {
79
- onSlideCallback!( val_event.index )
80
- },300 )
81
-
82
- let Base = $( '#Swiper-' + val_swipeID )
83
- if ( val_event.eventType == 'adjustLoop' ) {
84
- Base
85
- .await( 250 )
86
- .css( {
87
- transition: '0s',
88
- transform: FNs.TrasformString( Index )
89
- } )
90
- .children()
91
- .removeClass( style.Display )
92
- .parent().children( Index )
93
- .addClass( [ style.Display,style.LoopAdjusting ] )
94
- .await( 100 ).removeClass( style.LoopAdjusting )
95
- } else if ( val_event.eventType == 'sys' ) {
96
- Base
97
- .await( 250 )
98
- .css( {
99
- transform: FNs.TrasformString( Index )
100
- } )
101
- .children()
102
- .removeClass( style.Display )
103
- .parent().children( Index )
104
- .addClass( style.Display )
105
- } else {
106
- Base
107
- .children()
108
- .removeClass( style.Display )
109
- .parent().children( Index )
110
- .addClass( style.Display )
111
- .parent()
112
- .css( {
113
- transition: '0.3s',
114
- transform: FNs.TrasformString( Index )
115
- } )
116
- .await( 250 ).css( { transition: '0s' } )
117
-
118
- if ( CopyIndex ) {
119
- let ajastIndex = val_event.index == -1 ? slides.length - 1 : 0
120
- set_event( {
121
- eventType: 'adjustLoop',
122
- index: ajastIndex
123
- } )
124
- }
125
- }
126
-
127
- if ( autoSwipeSeconds && !CopyIndex ) {
128
- $.interval.clear( 'SwipeTimer-' + val_swipeID )
129
- $.interval.standBy(
130
- 'SwipeTimer-' + val_swipeID,
131
- autoSwipeSeconds - ( val_event.eventType == 'sys' ? 310 : 0 ),
132
- () => {
133
- let newIndex = val_event.index + 1
134
-
135
- if ( !loop && newIndex > slides.length - 1 ) newIndex = 0
136
-
137
- set_event( {
138
- eventType: 'usr',
139
- index: newIndex
140
- } )
141
- }
142
- )
143
- }
144
- },[ val_event ] )
145
-
146
- let Slides = slides.map( ( slide,index ) => <Box
147
- key={ index }
148
- flexSizing={ 'none' }
149
- width={ 1 }
150
- height={ 0 }
151
- className={ style.Child }
152
- children={ wrapper( slide ) }
153
- /> )
154
-
155
- if ( loop ) {
156
- Slides.push( Slides[ 0 ] )
157
- Slides.unshift( Slides[ Slides.length - 2 ] )
158
- }
159
-
160
- let info: SliderInfoProps = {
161
- x: 0,
162
- y: 0,
163
- process: false,
164
- effectStartAt: 0,
165
- id: val_swipeID,
166
- loop,
167
- index: val_event.index,
168
- minIndex: loop ? -1 : 0,
169
- maxIndex: slides.length + ( loop ? 1 : -1 ),
170
- width: 0,
171
- set_event: set_event
172
- }
173
-
174
- let Index = val_event.index + ( loop ? 1 : 0 )
175
-
176
- return <Box
177
- overflow='hidden'
178
- position='relative'
179
- { ...others }
180
- freeCSS={ {
181
- zIndex: 1,
182
- ...others.freeCSS
183
- } }
184
- data-swipe-id={ val_swipeID }
185
- onMouseDown={ ( event ) => {
186
- if ( disableMousedrag ) return
187
- if ( event.buttons != 1 ) return
188
- FNs.EffectStart( event,info )
189
- } }
190
- onTouchStart={ ( event ) => {
191
- if ( disableTouch ) return
192
- if ( event.touches?.length != 1 ) return
193
- FNs.EffectStart( event as any,info )
194
- } }
195
- >
196
- <Flex
197
- flexWrap={ false }
198
- gap={ 1 }
199
- transition='long'
200
- className={ [
201
- style.Rail,
202
- style[ 'ShowOther_' + visibilitySurroundSlide ]
203
- ].join( ' ' ) }
204
- id={ 'Swiper-' + val_swipeID }
205
- freeCSS={ {
206
- ...!mounted.current ? {
207
- transform: FNs.TrasformString( Index )
208
- } : {}
209
- } }
210
- children={ Slides }
211
- />
212
- </Box>
213
- }
214
-
215
- const FNs = {
216
- TrasformString: ( Index: number ) => ( `translateX( calc( ${ -100 * Index }% - ${ 12 * ( Index ) }px ) )` ),
217
- EffectStart: ( event: React.MouseEvent<HTMLDivElement,MouseEvent>,info: SliderInfoProps ) => {
218
- let {
219
- x,y
220
- } = $.getCursor( event as any )
221
- let eventTarget = event.currentTarget
222
- let target = event.target as HTMLElement
223
- if ( [ 'SELECT','BUTTON','LABEL','INPUT' ].includes( target.tagName ) ) return
224
-
225
- info = {
226
- ...info,
227
- x: x - info.x + window.scrollX,
228
- y: y - info.y + window.scrollY,
229
- effectStartAt: new Date().getTime(),
230
- width: $( '#Swiper-' + info.id ).position().width
231
- }
232
-
233
- let { swipeId } = eventTarget.dataset
234
- if ( swipeId == info.id ) {
235
- $( document )
236
- .addEvent( {
237
- eventID: 'SwipeMouseMove',eventType: 'mousemove',
238
- callback: ( event ) => { FNs.EffectCheck( event,info ) },
239
- option: { passive: false }
240
- } )
241
- .addEvent( {
242
- eventID: 'SwipeTouchMove',eventType: 'touchmove',
243
- callback: ( event ) => { FNs.EffectCheck( event,info ) },
244
- option: { passive: false }
245
- } )
246
- .addEvent( {
247
- eventID: 'SwipeMouseUp',eventType: 'mouseup',
248
- callback: ( event ) => { FNs.EffectEnd( event,info ) },
249
- option: { passive: false }
250
- } )
251
- .addEvent( {
252
- eventID: 'SwipeTouchEnd',eventType: 'touchend',
253
- callback: ( event ) => { FNs.EffectEnd( event,info ) },
254
- option: { passive: false }
255
- } )
256
- }
257
- },
258
- EffectCheck: ( event: any,info: SliderInfoProps ) => {
259
- if ( info.process ) return
260
- let {
261
- x,y
262
- } = $.getCursor( event )
263
-
264
- let X = Math.abs( x - info.x + window.scrollX )
265
- let Y = Math.abs( y - info.y + window.scrollY )
266
-
267
- if ( event.touches && event.touches.length > 1 ) return
268
- if ( Y + X < 15 ) return
269
- if ( Y > X / 2 ) {
270
- $( document ).removeEvent( [
271
- 'SwipeMouseMove',
272
- 'SwipeTouchMove'
273
- ] )
274
- } else {
275
- info.process = true
276
-
277
- let Index = info.index + ( info.loop ? 1 : 0 )
278
- $( '#Swiper-' + info.id ).children( Index - 1 ).addClass( style.Display )
279
- $( '#Swiper-' + info.id ).children( Index + 1 ).addClass( style.Display )
280
-
281
- $( document )
282
- .addEvent( {
283
- eventID: 'SwipeCheckMouseMove',eventType: 'mousemove',
284
- callback: ( event ) => { FNs.EffectMove( event,info ) },
285
- option: { passive: false }
286
- } )
287
- .addEvent( {
288
- eventID: 'SwipeCheckTouchMove',eventType: 'touchmove',
289
- callback: ( event ) => { FNs.EffectMove( event,info ) },
290
- option: { passive: false }
291
- } )
292
-
293
- event.preventDefault()
294
- return
295
- }
296
- },
297
- EffectMove: ( event: any,info: SliderInfoProps ) => {
298
- if ( event.touches && event.touches.length > 1 ) return
299
-
300
- let {
301
- x
302
- } = $.getCursor( event )
303
-
304
- let X = x - info.x + window.scrollX
305
-
306
- let Index = info.index + ( info.loop ? 1 : 0 )
307
- let rate = Index - X / info.width
308
-
309
- if ( rate < 0 ) {
310
- rate /= 2
311
- } else if ( rate > info.maxIndex ) {
312
- let excess = rate - info.maxIndex
313
- rate = info.maxIndex + excess / 2
314
- }
315
-
316
- $( '#Swiper-' + info.id ).css( {
317
- transition: '0s',
318
- transform: FNs.TrasformString( rate )
319
- } )
320
-
321
- event.preventDefault()
322
- return
323
- },
324
- EffectEnd: ( event: Event,info: SliderInfoProps ) => {
325
- if ( info.process ) {
326
- let cursor = $.getCursor( event )
327
- let X = cursor.x - info.x + window.scrollX
328
-
329
- let current = new Date().getTime()
330
-
331
- let totalTime = current - info.effectStartAt
332
-
333
- let Index = info.index + ( info.loop ? 1 : 0 )
334
-
335
- let newIndex = 0
336
- if ( totalTime < 400 ) {
337
- newIndex = Index - ( Number( X > 0 ) * 2 - 1 )
338
- } else {
339
- newIndex = Math.round( Index - X / info.width )
340
- }
341
- newIndex = Math.max( Math.min( newIndex,info.maxIndex ),info.minIndex )
342
-
343
- info.process = false
344
- if ( Index === newIndex ) {
345
- info.effectStartAt = current
346
-
347
- $( '#Swiper-' + info.id )
348
- .css( {
349
- transition: '.2s',
350
- transform: FNs.TrasformString( newIndex )
351
- } )
352
- .await( 310 )
353
- .css( {
354
- transition: '0s'
355
- } )
356
- .children().removeClass( style.Display )
357
- .parent().children( Index ).addClass( style.Display )
358
- } else {
359
- info.set_event( {
360
- eventType: 'usr',
361
- index: newIndex + info.minIndex
362
- } )
363
- }
364
- }
365
-
366
- $( document ).removeEvent( [
367
- 'SwipeMouseMove',
368
- 'SwipeTouchMove',
369
- 'SwipeCheckMouseMove',
370
- 'SwipeCheckTouchMove',
371
- 'SwipeMouseUp',
372
- 'SwipeTouchEnd'
373
- ] )
374
- }
375
- }
@@ -1,20 +0,0 @@
1
- @use '@props' as *;
2
- .Rail {
3
- &.ShowOther_true {
4
- > .Child {
5
- opacity: 100% !important;
6
- }
7
- }
8
- .Child {
9
- opacity: 0%;
10
- transition: .3s;
11
- height: 0;
12
- &.Display {
13
- opacity: 100%;
14
- height: auto;
15
- }
16
- &.LoopAdjusting {
17
- transition: 0s !important;
18
- }
19
- }
20
- }
@@ -1,60 +0,0 @@
1
- import {
2
- React,
3
- } from '@global'
4
- import {
5
- Box,
6
- Flex
7
- } from '@atoms'
8
- import {
9
- Row
10
- } from '@mols'
11
- import {
12
- Input
13
- } from '@fn'
14
-
15
- export const TabBar: React.FC<amotify.fn.Layout.TabBar.Params> = ( params ) => {
16
- let {
17
- tabIndex,
18
- tabs,
19
- onTabChange,
20
- componentDidMount,
21
- ...others
22
- } = params
23
-
24
- React.useEffect( () => {
25
- if ( componentDidMount ) componentDidMount()
26
- },[] )
27
-
28
- return <Flex
29
- position='relative'
30
- overflow={ 'auto' }
31
- flexWrap={ false }
32
- { ...others }
33
- freeCSS={ {
34
- zIndex: 3,
35
- whiteSpace: 'nowrap',
36
- ...others.freeCSS
37
- } }
38
- >
39
- <Box
40
- margin={ [ 0,'auto' ] }
41
- >
42
- <Input.Segmented.BottomLine
43
- value={ tabIndex }
44
- fontColor='inherit'
45
- override='force'
46
- gap={ 0 }
47
- options={ tabs.map( ( tab,index ) => {
48
- return {
49
- value: index,
50
- label: tab
51
- }
52
- } ) }
53
- onUpdateValidValue={ ( args ) => {
54
- let value = args.value[ 0 ]
55
- if ( onTabChange ) onTabChange( value )
56
- } }
57
- />
58
- </Box>
59
- </Flex>
60
- }
@@ -1,20 +0,0 @@
1
- import { SwipeView } from './SwipeView/parts'
2
- import { PageViewController } from './PageViewController/parts'
3
- import { TabBar } from './TabBar'
4
- import { Plate } from './Plate'
5
- import { PageNotFound } from './PageNotFound'
6
- import { PageRouter } from './PageRouter'
7
-
8
- import { RootViewController } from './RootViewController/parts'
9
-
10
- const Layout: amotify.fn.Layout.Methods = {
11
- PageViewController,
12
- TabBar,
13
- Plate,
14
- SwipeView,
15
- PageRouter,
16
- PageNotFound,
17
- RootViewController
18
- }
19
-
20
- export { Layout }
@@ -1,74 +0,0 @@
1
- import {
2
- useStore,
3
- React
4
- } from '@global'
5
- import {
6
- Box,
7
- Flex
8
- } from '@atoms'
9
-
10
- import style from './style.module.scss'
11
-
12
- import { memoryID } from './parts'
13
-
14
- export const Corner = () => {
15
- let [ val_active,set_active ] = React.useState( false )
16
-
17
- React.useEffect( () => {
18
- useStore.set( {
19
- key: memoryID + '-corner',
20
- value: {
21
- active: () => {
22
- set_active( true )
23
- },
24
- stop: () => {
25
- set_active( false )
26
- }
27
- }
28
- } )
29
- },[] )
30
-
31
- return <Flex
32
- className={ [
33
- style.CornerLoader,
34
- style[ 'Active_' + val_active ]
35
- ].join( ' ' ) }
36
- gap={ '1/2' }
37
- padding={ [ '1/2','3/4' ] }
38
- borderRadius={ '2/3' }
39
- backgroundColor='dark'
40
- position='fixed'
41
- boxShadow={ '1.remark' }
42
- left={ '50%' }
43
- top={ 1 }
44
- opacity='trans'
45
- transition='short'
46
- isRounded
47
- freeCSS={ {
48
- pointerEvents: 'none',
49
- transform: 'translateX(-50%)'
50
- } }
51
- >
52
- <Flex
53
- className={ style.Wrap }
54
- flexWrap={ false }
55
- verticalAlign='center'
56
- horizontalAlign='center'
57
- >
58
- <Box className={ style.Ld4 } />
59
- <Box className={ style.Ld3 } />
60
- <Box className={ style.Ld2 } />
61
- <Box className={ style.Ld1 } />
62
- <Box className={ style.Ld2 } />
63
- <Box className={ style.Ld3 } />
64
- <Box className={ style.Ld4 } />
65
- </Flex>
66
- <Box
67
- fontColor='white'
68
- fontSize='0.xs'
69
- isSemiBoldFont
70
- >
71
- Loading
72
- </Box>
73
- </Flex>
74
- }
@@ -1,114 +0,0 @@
1
- import {
2
- useStore,
3
- React
4
- } from '@global'
5
- import {
6
- Row
7
- } from '@mols'
8
-
9
- import style from './style.module.scss'
10
-
11
- export const Mini = ( params: amotify.fn.Loader.CompInput & {
12
- color?: amotify.fn.Loader.Colors
13
- size?: amotify.fn.Loader.Sizes
14
- } ) => {
15
- let {
16
- color = 'theme',
17
- size = 'R',
18
- showInitial = false,
19
- loaderID = '',
20
- ...props
21
- } = params
22
- let [ val_key ] = React.useState( loaderID )
23
- let [ val_componentID ] = React.useState( $.uuidGen() )
24
- let [ val_active,set_active ] = React.useState( showInitial )
25
-
26
- let Size: amotify.UniStyles.Sizes.SizeParams = 0
27
- if ( size == 'S' ) {
28
- Size = 1
29
- } else if ( size == 'R' ) {
30
- Size = 1.5
31
- } else if ( size == 'L' ) {
32
- Size = 3
33
- } else if ( size == 'XL' ) {
34
- Size = 4
35
- } else if ( size == 'MAX' ) {
36
- Size = 6
37
- }
38
- let BorderColor = {
39
- 'theme': 'hsl( var( --color-theme-hsl ) )',
40
- 'posi': 'var( --color-positive )',
41
- 'nega': 'var( --color-negative )',
42
- 'warn': 'var( --color-warning )',
43
- 'cloud': 'hsl( var( --color-layer5-hsl ) )',
44
- 'white': 'white',
45
- }[ color as 'theme' ]
46
-
47
- let QuerySelector = '[data-component-id="' + val_componentID + '"]'
48
- React.useEffect( () => {
49
- if ( val_active ) {
50
- $( QuerySelector )
51
- .removeClass( style.Hide )
52
- .await( 10 )
53
- .addClass( style.Active )
54
- } else {
55
- $( QuerySelector )
56
- .removeClass( style.Active )
57
- .await( 210 )
58
- .addClass( style.Hide )
59
- }
60
- },[ val_active ] )
61
-
62
- React.useEffect( () => {
63
- useStore.set( {
64
- key: val_componentID,
65
- value: {
66
- active: ( keyCode: string ) => {
67
- if ( val_key != keyCode ) return
68
- set_active( true )
69
- },
70
- stop: ( keyCode: string ) => {
71
- if ( val_key != keyCode ) return
72
- set_active( false )
73
- },
74
- stopForce: () => {
75
- set_active( false )
76
- }
77
- }
78
- } )
79
- },[] )
80
-
81
- return <Row.Center
82
- ssSphere={ Size }
83
- className={ [
84
- style.MiniLoader,
85
- showInitial ? '' : style.Hide
86
- ].join( ' ' ) }
87
- componentID={ val_componentID }
88
- position='relative'
89
- { ...props }
90
- >
91
- <svg
92
- className={ style.SVG1 }
93
- width="100"
94
- height="100"
95
- viewBox="0 0 100 100"
96
- style={ {
97
- stroke: BorderColor
98
- } }
99
- >
100
- <circle cx="50" cy="50" r="40" />
101
- </svg>
102
- <svg
103
- className={ style.SVG2 }
104
- width="100"
105
- height="100"
106
- viewBox="0 0 100 100"
107
- style={ {
108
- stroke: BorderColor
109
- } }
110
- >
111
- <circle cx="50" cy="50" r="40" />
112
- </svg>
113
- </Row.Center>
114
- }