amotify 0.0.6 → 0.0.8

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 (160) hide show
  1. package/dist/@jsminAmotifyExtension/formCollect.js +2 -2
  2. package/dist/Atoms/Logo/parts.js +11 -11
  3. package/dist/Atoms/Various/parts.js +5 -5
  4. package/dist/Functions/Button/_.js +5 -5
  5. package/dist/Functions/Cropper/parts.js +47 -47
  6. package/dist/Functions/Effects/Fade.js +5 -5
  7. package/dist/Functions/Input/Chips/Selector.js +32 -32
  8. package/dist/Functions/Input/Chips/_.js +10 -10
  9. package/dist/Functions/Input/DigitCharacters.js +8 -8
  10. package/dist/Functions/Input/File/_.js +33 -33
  11. package/dist/Functions/Input/List/_.js +17 -17
  12. package/dist/Functions/Input/Segmented/_.js +13 -13
  13. package/dist/Functions/Input/Select/_.js +12 -12
  14. package/dist/Functions/Input/Slider/_.js +16 -16
  15. package/dist/Functions/Input/Switch/_.js +12 -12
  16. package/dist/Functions/Input/Text.js +12 -12
  17. package/dist/Functions/Input/TextArea.js +4 -4
  18. package/dist/Functions/Input/Time/Picker.js +65 -65
  19. package/dist/Functions/Input/Time/_.js +10 -10
  20. package/dist/Functions/Input/_.js +31 -31
  21. package/dist/Functions/Input/core.js +27 -27
  22. package/dist/Functions/Inputs/text.js +2 -2
  23. package/dist/Functions/Layout/PageNotFound.js +15 -15
  24. package/dist/Functions/Layout/PageRouter.js +5 -5
  25. package/dist/Functions/Layout/PageViewController/parts.js +5 -5
  26. package/dist/Functions/Layout/Plate.js +2 -2
  27. package/dist/Functions/Layout/RootViewController/parts.js +22 -22
  28. package/dist/Functions/Layout/SwipeView/parts.js +6 -6
  29. package/dist/Functions/Layout/TabBar.js +7 -7
  30. package/dist/Functions/Loader/corner.js +13 -13
  31. package/dist/Functions/Loader/mini.js +4 -4
  32. package/dist/Functions/Loader/parts.js +9 -9
  33. package/dist/Functions/Loader/top.js +22 -22
  34. package/dist/Functions/Sheet/parts.js +46 -46
  35. package/dist/Functions/SnackBar/parts.js +16 -16
  36. package/dist/Functions/Table/Data/parts.js +72 -72
  37. package/dist/Functions/Table/Drag/parts.js +15 -15
  38. package/dist/Functions/Table/_.js +11 -11
  39. package/dist/Functions/Tooltips/parts.js +6 -6
  40. package/dist/Molecules/@export.js +14 -14
  41. package/dist/Molecules/Accordion/parts.js +10 -10
  42. package/dist/Molecules/LinkifyText/parts.js +4 -4
  43. package/dist/Molecules/List.js +3 -3
  44. package/dist/Organisms/DisplayStyleInput/darkmode.js +17 -17
  45. package/dist/Organisms/DisplayStyleInput/themeColor.js +25 -25
  46. package/dist/Templates/PlayGround/parts.js +22 -22
  47. package/dist/launch.js +12 -12
  48. package/package.json +1 -1
  49. package/public/amotify.js +47 -47
  50. package/src/@jsminAmotifyExtension/_.tsx +4 -0
  51. package/src/@jsminAmotifyExtension/fetch.tsx +107 -0
  52. package/src/@jsminAmotifyExtension/formCollect.tsx +89 -0
  53. package/src/@jsminAmotifyExtension/spreadSheet.tsx +159 -0
  54. package/src/@jsminAmotifyExtension/variables.tsx +130 -0
  55. package/src/@styles/@app.scss +4 -0
  56. package/src/@styles/UniStyling.scss +996 -0
  57. package/src/@styles/init.scss +154 -0
  58. package/src/@styles/props.scss +109 -0
  59. package/src/@styles/styleSet.scss +38 -0
  60. package/src/@styles/themeColor.scss +71 -0
  61. package/src/@styles/var.scss +171 -0
  62. package/src/@types/_.tsx +6 -0
  63. package/src/@types/amot.tsx +323 -0
  64. package/src/@types/fn.tsx +1210 -0
  65. package/src/@types/index.tsx +74 -0
  66. package/src/@types/jsminAmotifyExtension.tsx +143 -0
  67. package/src/@types/module.tsx +2 -0
  68. package/src/@types/state.tsx +199 -0
  69. package/src/Atoms/@export.tsx +32 -0
  70. package/src/Atoms/FAIcon/parts.tsx +117 -0
  71. package/src/Atoms/FAIcon/style.module.scss +9 -0
  72. package/src/Atoms/Logo/parts.tsx +335 -0
  73. package/src/Atoms/Logo/style.module.scss +96 -0
  74. package/src/Atoms/Various/parts.tsx +157 -0
  75. package/src/Atoms/Various/style.module.scss +40 -0
  76. package/src/Functions/@export.tsx +29 -0
  77. package/src/Functions/Button/_.tsx +305 -0
  78. package/src/Functions/Button/style.module.scss +183 -0
  79. package/src/Functions/Cropper/parts.tsx +1061 -0
  80. package/src/Functions/Cropper/style.module.scss +62 -0
  81. package/src/Functions/Effects/Fade.tsx +81 -0
  82. package/src/Functions/Effects/Ripple.tsx +141 -0
  83. package/src/Functions/Effects/_.tsx +33 -0
  84. package/src/Functions/Effects/style.module.scss +83 -0
  85. package/src/Functions/Input/Chips/Selector.tsx +451 -0
  86. package/src/Functions/Input/Chips/_.tsx +286 -0
  87. package/src/Functions/Input/Chips/style.module.scss +6 -0
  88. package/src/Functions/Input/DigitCharacters.tsx +241 -0
  89. package/src/Functions/Input/File/_.tsx +596 -0
  90. package/src/Functions/Input/File/style.module.scss +34 -0
  91. package/src/Functions/Input/Hidden.tsx +18 -0
  92. package/src/Functions/Input/List/_.tsx +383 -0
  93. package/src/Functions/Input/List/style.module.scss +84 -0
  94. package/src/Functions/Input/Segmented/_.tsx +238 -0
  95. package/src/Functions/Input/Segmented/style.module.scss +81 -0
  96. package/src/Functions/Input/Select/_.tsx +225 -0
  97. package/src/Functions/Input/Select/style.module.scss +10 -0
  98. package/src/Functions/Input/Slider/_.tsx +519 -0
  99. package/src/Functions/Input/Slider/style.module.scss +67 -0
  100. package/src/Functions/Input/Switch/_.tsx +177 -0
  101. package/src/Functions/Input/Switch/style.module.scss +18 -0
  102. package/src/Functions/Input/Text.tsx +437 -0
  103. package/src/Functions/Input/TextArea.tsx +115 -0
  104. package/src/Functions/Input/Time/Picker.tsx +950 -0
  105. package/src/Functions/Input/Time/_.tsx +736 -0
  106. package/src/Functions/Input/Time/style.module.scss +72 -0
  107. package/src/Functions/Input/_.tsx +793 -0
  108. package/src/Functions/Input/core.tsx +461 -0
  109. package/src/Functions/Input/style.module.scss +43 -0
  110. package/src/Functions/Inputs/_.tsx +5 -0
  111. package/src/Functions/Inputs/style.module.scss +15 -0
  112. package/src/Functions/Inputs/text.tsx +67 -0
  113. package/src/Functions/Inputs/types.d.ts +1 -0
  114. package/src/Functions/Layout/PageNotFound.tsx +81 -0
  115. package/src/Functions/Layout/PageRouter.tsx +107 -0
  116. package/src/Functions/Layout/PageViewController/parts.tsx +32 -0
  117. package/src/Functions/Layout/Plate.tsx +30 -0
  118. package/src/Functions/Layout/RootViewController/parts.tsx +290 -0
  119. package/src/Functions/Layout/RootViewController/style.module.scss +24 -0
  120. package/src/Functions/Layout/SwipeView/parts.tsx +380 -0
  121. package/src/Functions/Layout/SwipeView/style.module.scss +19 -0
  122. package/src/Functions/Layout/TabBar.tsx +64 -0
  123. package/src/Functions/Layout/_.tsx +20 -0
  124. package/src/Functions/Loader/corner.tsx +78 -0
  125. package/src/Functions/Loader/mini.tsx +117 -0
  126. package/src/Functions/Loader/parts.tsx +105 -0
  127. package/src/Functions/Loader/style.module.scss +222 -0
  128. package/src/Functions/Loader/top.tsx +90 -0
  129. package/src/Functions/Sheet/parts.tsx +972 -0
  130. package/src/Functions/Sheet/style.module.scss +235 -0
  131. package/src/Functions/SnackBar/parts.tsx +215 -0
  132. package/src/Functions/SnackBar/style.module.scss +25 -0
  133. package/src/Functions/Table/Data/parts.tsx +955 -0
  134. package/src/Functions/Table/Drag/parts.tsx +448 -0
  135. package/src/Functions/Table/Normal/parts.tsx +123 -0
  136. package/src/Functions/Table/_.tsx +170 -0
  137. package/src/Functions/Table/style.module.scss +92 -0
  138. package/src/Functions/Tooltips/parts.tsx +52 -0
  139. package/src/Global/@export.tsx +138 -0
  140. package/src/Global/LaunchReactApplication.tsx +30 -0
  141. package/src/Global/exe.tsx +0 -0
  142. package/src/Global/styleConverter.tsx +435 -0
  143. package/src/Molecules/@export.tsx +95 -0
  144. package/src/Molecules/Accordion/parts.tsx +146 -0
  145. package/src/Molecules/Accordion/style.module.scss +13 -0
  146. package/src/Molecules/LinkifyText/parts.tsx +54 -0
  147. package/src/Molecules/List.tsx +30 -0
  148. package/src/Organisms/@export.tsx +5 -0
  149. package/src/Organisms/DisplayStyleInput/_.tsx +18 -0
  150. package/src/Organisms/DisplayStyleInput/darkmode.tsx +112 -0
  151. package/src/Organisms/DisplayStyleInput/themeColor.tsx +210 -0
  152. package/src/Templates/@export.tsx +7 -0
  153. package/src/Templates/PlayGround/parts.tsx +116 -0
  154. package/src/Templates/PlayGround/style.module.scss +38 -0
  155. package/src/config.tsx +132 -0
  156. package/src/index.js +0 -0
  157. package/src/launch.tsx +100 -0
  158. package/src/preload.tsx +49 -0
  159. package/tsconfig.json +4 -22
  160. package/webpack.config.js +105 -0
@@ -0,0 +1,383 @@
1
+ import {
2
+ React
3
+ } from '~/Global/@export';
4
+ const {
5
+ useState
6
+ } = React;
7
+
8
+ import {
9
+ Box,
10
+ Flex,
11
+ FAIcon
12
+ } from '~/Atoms/@export';
13
+ import {
14
+ Input,
15
+ Buttons
16
+ } from '~/Functions/@export';
17
+ import {
18
+ BoxWrapper,
19
+ CommonEffects,
20
+ SubmitForm
21
+ } from '../core';
22
+ import style from './style.module.scss';
23
+
24
+ function DefaultValidation( props: {
25
+ value: any
26
+ params: any
27
+ } ): amotify.fn.Input.Validation.Result {
28
+ let { value,params } = props;
29
+ let {
30
+ type,
31
+ required,
32
+ minSelect = 0
33
+ } = params as amotify.fn.Input.List.OriginParams;
34
+ let notice: amotify.fn.Input.Validation.NoticeTypes[] = [];
35
+
36
+ if ( required ) {
37
+ if ( !value.length ) {
38
+ if ( type == 'radio' ) {
39
+ notice.push( { type: 'invalid',label: '選択されていません' } );
40
+ }
41
+ }
42
+ }
43
+
44
+ if ( minSelect ) {
45
+ if ( value.length < minSelect ) {
46
+ notice.push( { type: 'invalid',label: `${ minSelect }個以上選択してください` } );
47
+ }
48
+ }
49
+
50
+ return {
51
+ ok: !notice.filter( ( { type } ) => type == 'invalid' ).length,
52
+ notice: notice
53
+ }
54
+ }
55
+
56
+ export const ListInput: FNC<amotify.fn.Input.List.OriginParams> = ( props ) => {
57
+ let { value,options = [] } = props;
58
+ let Values = $.is.exist( value ) ? $.flatArray( value ) : [];
59
+ let DefaultOptions = options.map( ( option ) => {
60
+ let { value,label } = option;
61
+
62
+ return {
63
+ ...option,
64
+ value: JSON.stringify( value ),
65
+ label
66
+ }
67
+ } );
68
+ let DefaultValues: string[] = [];
69
+ Values.forEach( ( value ) => {
70
+ let Val = JSON.stringify( value );
71
+ let Index = DefaultOptions.findIndex( ( option ) => option.value == Val );
72
+ if ( Index == -1 ) return;
73
+ DefaultValues.push( Val );
74
+ } );
75
+
76
+ return <Core
77
+ { ...props }
78
+ value={ DefaultValues }
79
+ options={ DefaultOptions }
80
+ />;
81
+ }
82
+
83
+ const Core: FNC<amotify.fn.Input.List.OriginParams> = ( params ) => {
84
+ let {
85
+ type,
86
+ tone,
87
+ required,
88
+ componentID = '',
89
+ form,
90
+ override,
91
+ statusID,
92
+ freeCSS,
93
+
94
+ enableFormSubmit,
95
+
96
+ checkValidationAtFirst,
97
+ onValidate,
98
+ onUpdateValue,onUpdateValidValue,
99
+ value,
100
+ options,
101
+ leftIndicator,rightIndicator,
102
+
103
+ className,
104
+
105
+ cellStyles,cellClassName,
106
+ cellCheckedStyles,cellCheckedClassName,
107
+
108
+ ...others
109
+ } = params;
110
+
111
+ let Default_Status: amotify.fn.Input.Status.Plain = {
112
+ componentID,
113
+ dataValue: value,
114
+ eventType: 'init',
115
+ eventID: $.uuidGen()
116
+ }
117
+ let [ val_status,set_status ] = useState( Default_Status );
118
+ let [ val_validate,set_validate ] = useState( {
119
+ ok: false,
120
+ notice: []
121
+ } as amotify.fn.Input.Validation.Result );
122
+
123
+ CommonEffects( {
124
+ type: 'list',
125
+ params,
126
+ val_status,
127
+ set_status,
128
+ val_validate,
129
+ set_validate,
130
+ onUpdateValue,onUpdateValidValue,
131
+ DefaultValidation
132
+ } );
133
+
134
+ return ( <BoxWrapper
135
+ val_status={ val_status }
136
+ set_status={ set_status }
137
+ val_validate={ val_validate }
138
+ params={ params }
139
+ >
140
+ <Input.Hidden
141
+ data-value={ JSON.stringify( val_status.dataValue ) }
142
+ form={ form }
143
+ data-input-type={ type }
144
+ data-validation={ val_validate.ok }
145
+ { ...others }
146
+ componentID={ val_status.componentID }
147
+ />
148
+ <CellList
149
+ params={ params }
150
+ val_status={ val_status }
151
+ set_status={ set_status }
152
+ />
153
+ </BoxWrapper> );
154
+ }
155
+
156
+ const CellList: FNC<{
157
+ params: amotify.fn.Input.List.OriginParams
158
+ val_status: amotify.fn.Input.Status.Plain
159
+ set_status: React.Dispatch<React.SetStateAction<amotify.fn.Input.Status.Plain>>
160
+ }> = ( props ) => {
161
+ let {
162
+ params,
163
+ val_status,
164
+ set_status
165
+ } = props;
166
+
167
+ let {
168
+ componentID,
169
+ type,
170
+ tone,
171
+ icon = true,
172
+ options,
173
+ name,
174
+ form,
175
+ tabIndex,
176
+ hideInput,
177
+ disabled: DefaultDisabled,
178
+ className: ListClassName,
179
+
180
+ cellStyles: DefaultCellStyles,
181
+ cellClassName: DefaultCellClassName = '',
182
+ cellCheckedStyles: DefaultCellCheckedStyles,
183
+ cellCheckedClassName: DefaultCellCheckedClassName = '',
184
+
185
+ enableFormSubmit,
186
+ defaultActiveStyling = true
187
+ } = params;
188
+ let {
189
+ dataValue
190
+ } = val_status;
191
+
192
+ let IconBox = icon ? <Box
193
+ flexSizing={ 'none' }
194
+ children={ params.iconType == 'radio' ? <Comps.RadioIcon /> :
195
+ params.iconType == 'checkbox' ? <Comps.CheckboxIcon /> : null }
196
+ /> : null;
197
+
198
+ let Cells = options.map( ( option,index ) => {
199
+ let {
200
+ value,
201
+ label,
202
+ disabled = DefaultDisabled,
203
+ className = '',
204
+ checkedStyles,
205
+ checkedClassName = '',
206
+ ...styles
207
+ } = option;
208
+
209
+ let CellID = $.uuidGen();
210
+ let Checked = dataValue.findIndex( ( v: string ) => v === value ) != -1;
211
+
212
+ let Styles = {
213
+ ...DefaultCellStyles,
214
+ ...styles
215
+ } as amotifyUniStyleParams
216
+ let ClassName = [
217
+ style.Label,
218
+ style[ 'defaultActiveStyling_' + !!defaultActiveStyling ],
219
+ DefaultCellClassName,
220
+ className
221
+ ];
222
+
223
+ if ( Checked ) {
224
+ Styles = {
225
+ ...Styles,
226
+ ...DefaultCellCheckedStyles,
227
+ ...checkedStyles,
228
+ activeStyles: checkedStyles,
229
+ freeCSS: {
230
+ ...Styles.freeCSS,
231
+ ...DefaultCellCheckedStyles?.freeCSS,
232
+ ...checkedStyles?.freeCSS
233
+ }
234
+ }
235
+
236
+ ClassName = [
237
+ ...ClassName,
238
+ DefaultCellCheckedClassName,
239
+ checkedClassName
240
+ ];
241
+ }
242
+
243
+ return [
244
+ <input
245
+ type={ type == 'radio' ? 'radio' : 'checkbox' }
246
+ className={ [
247
+ style.Input,
248
+ style[ 'defaultActiveStyling_' + !!defaultActiveStyling ]
249
+ ].join( ' ' ) }
250
+ name={ 'RadioCheckbox-' + name }
251
+ data-list-index={ componentID + '-' + index }
252
+ id={ CellID }
253
+ value={ String( value ) }
254
+ data-form-name={ form }
255
+ disabled={ disabled }
256
+ checked={ Checked }
257
+ onFocus={ ( event ) => {
258
+ if ( disabled ) return;
259
+ if ( type != 'radio' ) return;
260
+ if ( val_status.dataValue.length ) return;
261
+ let { value,checked } = event.target;
262
+ let nextValue: any = [ value ];
263
+
264
+ set_status( {
265
+ ...val_status,
266
+ dataValue: nextValue,
267
+ eventType: 'update',
268
+ eventID: $.uuidGen()
269
+ } );
270
+ } }
271
+ onChange={ ( event ) => {
272
+ if ( disabled ) return;
273
+ let { value,checked } = event.target;
274
+ let nextValue = [];
275
+ if ( type == 'radio' ) {
276
+ nextValue = [ value ];
277
+ } else if ( type == 'checkbox' || type == 'checker' ) {
278
+ if ( checked ) {
279
+ nextValue = [ ...val_status.dataValue,value ];
280
+ } else {
281
+ let prevValue = [ ...val_status.dataValue ];
282
+ prevValue.splice( val_status.dataValue.findIndex( ( v: any ) => v == value ),1 );
283
+ nextValue = prevValue;
284
+ }
285
+ }
286
+
287
+ set_status( {
288
+ ...val_status,
289
+ dataValue: nextValue,
290
+ eventType: 'update',
291
+ eventID: $.uuidGen()
292
+ } );
293
+ } }
294
+ onKeyDown={ ( event ) => {
295
+ let { key,shiftKey } = event;
296
+ if ( type == 'checkbox' || type == 'checker' ) {
297
+ if ( key == 'Tab' ) {
298
+ if ( shiftKey ) { } else { }
299
+ } else if ( key.match( /Arrow/ ) ) {
300
+ event.preventDefault();
301
+
302
+ let dir = [ 'ArrowLeft','ArrowUp' ].includes( key ) ? -1 : 1;
303
+ let nextIndex = index + dir;
304
+
305
+ if ( nextIndex < 0 ) {
306
+ nextIndex = options.length - 1;
307
+ } else if ( nextIndex >= options.length ) {
308
+ nextIndex = 0;
309
+ }
310
+ $( `input[data-list-index="${ componentID }-${ nextIndex }"]` ).focus();
311
+ }
312
+ }
313
+
314
+ if ( enableFormSubmit ) SubmitForm( event );
315
+ } }
316
+ tabIndex={ tabIndex }
317
+ />,
318
+ <Buttons.Label.Plain
319
+ htmlFor={ CellID }
320
+ className={ ClassName.join( ' ' ) }
321
+ tabIndex={ -1 }
322
+ display='flex'
323
+ ssEffectsOnActive={ false }
324
+ verticalAlign='center'
325
+ gap={ '1/3' }
326
+ flexWrap={ false }
327
+ { ...Styles }
328
+ >
329
+ { IconBox }
330
+ { $.is.string( label ) ? <Box children={ label } /> : label }
331
+ </Buttons.Label.Plain>
332
+ ];
333
+ } );
334
+
335
+ return ( <Flex
336
+ flexSizing={ 'auto' }
337
+ freeCSS={ {
338
+ ...params.freeCSS
339
+ } }
340
+ className={ [
341
+ ListClassName,
342
+ style.CellBase,
343
+ style[ 'HideInput_' + hideInput ],
344
+ style[ 'IconIndicator_' + !!icon ],
345
+ style[ 'Tone_' + tone ]
346
+ ].join( ' ' ) }
347
+ children={ Cells }
348
+ /> );
349
+ }
350
+
351
+ const Comps = {
352
+ RadioIcon: () => ( <Box
353
+ className={ style.Icon }
354
+ backgroundColor={ '1.layer.base' }
355
+ border
356
+ transition='middle'
357
+ position='relative'
358
+ borderRadius={ 'sphere' }
359
+ flexCenter
360
+ /> ),
361
+ CheckboxIcon: () => ( <Box
362
+ className={ [
363
+ style.Icon,
364
+ style.CheckboxIcon
365
+ ].join( ' ' ) }
366
+ borderRadius={ '3.tone.tertiary' }
367
+ backgroundColor={ '1.layer.base' }
368
+ border
369
+ transition='middle'
370
+ fontColor={ 'white' }
371
+ position='relative'
372
+ flexCenter
373
+ >
374
+ <FAIcon.Check
375
+ className={ style.I }
376
+ transition='middle'
377
+ opacity='trans'
378
+ freeCSS={ {
379
+ zIndex: 8
380
+ } }
381
+ />
382
+ </Box> )
383
+ }
@@ -0,0 +1,84 @@
1
+ @use 'src/@styles/props' as *;
2
+ .CellBase {
3
+ &.HideInput_true .Input {
4
+ display: none;
5
+ }
6
+ }
7
+ .Input {
8
+ &:checked + .Label .Icon {
9
+ border-color: transparent;
10
+ &:after, > * {
11
+ transform: scale(1) !important;
12
+ opacity: 1 !important;
13
+ }
14
+ }
15
+ &.defaultActiveStyling_true {
16
+ &:checked {
17
+ &:focus + .Label {
18
+ opacity: 1 !important;
19
+ box-shadow:
20
+ 0 0 0 transparent inset,
21
+ 0 0 0 1px $color-theme-opacity-middle,
22
+ 0 0 0 $unit1_3 $color-theme-opacity-low !important;
23
+ }
24
+ }
25
+ &:focus + .Label {
26
+ box-shadow:
27
+ 0 0 0 transparent inset,
28
+ 0 0 0 $unit1_3 $color-layer3 !important;
29
+ }
30
+ &:active + .Label {
31
+ opacity: 1 !important;
32
+ }
33
+ }
34
+ }
35
+ .Label {
36
+ -webkit-user-select: none;
37
+ user-select: none;
38
+ * {
39
+ pointer-events: none;
40
+ }
41
+ &.defaultActiveStyling_true {
42
+ &:hover {
43
+ opacity: .6;
44
+ }
45
+ }
46
+ }
47
+ .Icon {
48
+ width: 20px;
49
+ height: 20px;
50
+ &.CheckboxIcon {
51
+ &:after {
52
+ background-color: $color-theme;
53
+ }
54
+ .I {
55
+ transform: scale(.3);
56
+ }
57
+ }
58
+ &:before, &:after {
59
+ content: "";
60
+ position: absolute;
61
+ opacity: 0;
62
+ transition: $animation-time-middle;
63
+ }
64
+ &:before {
65
+ width: 100%;
66
+ height: 100%;
67
+ border-radius: inherit;
68
+ opacity: 1;
69
+ transition: 0s;
70
+ transition-timing-function: $animation-style1;
71
+ }
72
+ &:after {
73
+ top: 0;
74
+ left: 0;
75
+ width: 100%;
76
+ height: 100%;
77
+ transform: scale(0.3);
78
+ border-radius: inherit;
79
+ background-color: $color-layer1;
80
+ border: 5.5px solid $color-theme;
81
+ box-shadow: 0 0 0 transparent inset, $shadow1;
82
+ background-color: white;
83
+ }
84
+ }
@@ -0,0 +1,238 @@
1
+ import {
2
+ React
3
+ } from '~/Global/@export';
4
+
5
+ import { ListInputs } from '../_';
6
+
7
+ import style from './style.module.scss';
8
+
9
+ export const Segmented: amotify.fn.Input.Segmented.Types = {
10
+ Auto: ( params ) => {
11
+ params = {
12
+ padding: '1/3',
13
+ gap: '1/3',
14
+ ssCardBox: true,
15
+ ...params,
16
+ cellStyles: {
17
+ borderRadius: 'inherit',
18
+ position: 'relative',
19
+ ...params.cellStyles
20
+ },
21
+ cellCheckedStyles: {
22
+ backgroundColor: 'theme',
23
+ fontColor: 'white',
24
+ ...params.cellCheckedStyles
25
+ },
26
+ }
27
+
28
+ return ( <Core appearance={ ( params as any ).tone || 'Auto' } { ...params } /> );
29
+ },
30
+ Normal: ( params ) => {
31
+ params = {
32
+ border: true,
33
+ borderColor: 'theme',
34
+ overflow: 'hidden',
35
+ gap: 0,
36
+ ssLastChildLossBorder: 'right',
37
+ fontColor: '3.blur',
38
+ ...params,
39
+ cellStyles: {
40
+ borderRadius: 0,
41
+ borderRight: true,
42
+ borderColor: 'theme',
43
+ ...params.cellStyles
44
+ },
45
+ cellCheckedStyles: {
46
+ backgroundColor: 'theme',
47
+ fontColor: 'white',
48
+ ...params.cellCheckedStyles
49
+ }
50
+ };
51
+ ( params as any ).tone = 'ThemeBorder';
52
+
53
+ return ( <Core appearance={ 'Border' } { ...params } /> );
54
+ },
55
+ Cloud: ( params ) => {
56
+ params = {
57
+ padding: '1/3',
58
+ gap: '1/3',
59
+ backgroundColor: 'cloud',
60
+ ...params,
61
+ cellStyles: {
62
+ borderRadius: 'inherit',
63
+ position: 'relative',
64
+ ...params.cellStyles
65
+ },
66
+ cellCheckedStyles: {
67
+ backgroundColor: 'theme',
68
+ fontColor: 'white',
69
+ ...params.cellCheckedStyles
70
+ },
71
+ }
72
+
73
+ return ( <Core appearance={ ( params as any ).tone || 'Cloud' } { ...params } /> );
74
+ },
75
+ Cloud2: ( params ) => {
76
+ ( params as any ).tone = 'WhiteCloud';
77
+ return ( <Segmented.Cloud
78
+ fontColor='3.blur'
79
+ { ...params }
80
+ cellCheckedStyles={ {
81
+ fontColor: '1.clear',
82
+ ...params.cellCheckedStyles
83
+ } }
84
+ /> );
85
+ },
86
+ Cloud3: ( params ) => {
87
+ ( params as any ).tone = 'ThemeCloud';
88
+ return ( <Segmented.Cloud
89
+ backgroundColor='tcOpFew'
90
+ fontColor='theme'
91
+ { ...params }
92
+ cellStyles={ {
93
+ ...params.cellStyles
94
+ } }
95
+ /> );
96
+ },
97
+ Border: ( params ) => {
98
+ params = {
99
+ backgroundColor: '1.layer.base',
100
+ border: '2.normal',
101
+ overflow: 'hidden',
102
+ gap: 0,
103
+ ssLastChildLossBorder: 'right',
104
+ boxShadow: 0,
105
+ ...params,
106
+ cellStyles: {
107
+ borderRadius: 0,
108
+ borderRight: '2.normal',
109
+ ...params.cellStyles
110
+ },
111
+ cellCheckedStyles: {
112
+ backgroundColor: 'tcOpFew',
113
+ fontColor: 'theme',
114
+ ...params.cellCheckedStyles
115
+ },
116
+ }
117
+
118
+ return ( <Core appearance={ ( params as any ).tone || 'Border' } { ...params } /> );
119
+ },
120
+ Border2: ( params ) => {
121
+ params = {
122
+ border: true,
123
+ borderColor: 'theme',
124
+ overflow: 'hidden',
125
+ gap: 0,
126
+ ssLastChildLossBorder: 'right',
127
+ boxShadow: 0,
128
+ fontColor: '3.blur',
129
+ ...params,
130
+ cellStyles: {
131
+ borderRadius: 0,
132
+ borderRight: true,
133
+ borderColor: 'theme',
134
+ ...params.cellStyles
135
+ },
136
+ cellCheckedStyles: {
137
+ backgroundColor: 'theme',
138
+ fontColor: 'white',
139
+ ...params.cellCheckedStyles
140
+ }
141
+ };
142
+ ( params as any ).tone = 'ThemeBorder';
143
+
144
+ return ( <Core appearance={ 'Border' } { ...params } /> );
145
+ },
146
+ BottomLine: ( params ) => {
147
+ params = {
148
+ gap: 0,
149
+ fontColor: '3.blur',
150
+ ...params,
151
+ cellStyles: {
152
+ ssEffectsOnActive: 'ripple.theme',
153
+ borderRadius: 0,
154
+ padding: 1,
155
+ ...params.cellStyles
156
+ },
157
+ cellCheckedStyles: {
158
+ fontColor: 'theme',
159
+ ...params.cellCheckedStyles
160
+ }
161
+ }
162
+
163
+ return ( <Core appearance={ 'BottomLine' } { ...params } /> );
164
+ },
165
+ }
166
+
167
+ type CoreParams = amotify.fn.Input.Segmented.Params & {
168
+ appearance: amotify.fn.Input.Segmented.Tones
169
+ }
170
+
171
+ const Core: FNC<CoreParams> = ( params ) => {
172
+ let {
173
+ tone,
174
+ appearance,
175
+ value,
176
+ options,
177
+ onUpdateValue,onUpdateValidValue,
178
+ freeCSS,
179
+ cellStyles,
180
+ cellClassName,
181
+ cellCheckedClassName,
182
+ cellCheckedStyles,
183
+ ...others
184
+ } = params;
185
+
186
+ let [ val_componentID ] = React.useState( $.uuidGen() );
187
+
188
+ let [ val_defValue,set_defValue ] = React.useState( value );
189
+ let [ val_value,set_value ] = React.useState( val_defValue );
190
+ if ( val_defValue != value ) {
191
+ set_defValue( value );
192
+ set_value( value );
193
+ }
194
+
195
+ return ( <ListInputs.Radio
196
+ // hideInput
197
+ defaultActiveStyling={ false }
198
+ flexWrap={ false }
199
+ borderRadius={ '2.tone.secondary' }
200
+ position='relative'
201
+ options={ options }
202
+ value={ val_value }
203
+ componentID={ val_componentID }
204
+ icon={ false }
205
+ { ...others }
206
+ freeCSS={ {
207
+ whiteSpace: 'nowrap',
208
+ ...freeCSS
209
+ } }
210
+ cellStyles={ {
211
+ flexCenter: true,
212
+ ssPushable: true,
213
+ boxShadow: 'none',
214
+ ...cellStyles
215
+ } }
216
+ cellClassName={ [
217
+ cellClassName,
218
+ style.Label,
219
+ style[ 'Tone_' + appearance ]
220
+ ].join( ' ' ) }
221
+ cellCheckedStyles={ {
222
+ isBoldFont: true,
223
+ ...cellCheckedStyles,
224
+ } }
225
+ cellCheckedClassName={ [
226
+ cellCheckedClassName,
227
+ style.Checked
228
+ ].join( ' ' ) }
229
+ tone={ 'custom' as any }
230
+ onUpdateValue={ onUpdateValue }
231
+ onUpdateValidValue={ ( args ) => {
232
+ if ( onUpdateValidValue ) onUpdateValidValue( args );
233
+ if ( appearance == 'BottomLine' ) {
234
+ set_value( args.value[ 0 ] );
235
+ }
236
+ } }
237
+ /> );
238
+ }