amotify 0.0.13 → 0.0.14

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 (58) hide show
  1. package/@types/amot.tsx +48 -63
  2. package/@types/fn.tsx +10 -16
  3. package/dist/amotify.js +1 -1
  4. package/dist/amotify.min.css +8 -9
  5. package/dist/coreVender.js +14 -0
  6. package/package.json +27 -22
  7. package/src/@atoms.tsx +4 -2
  8. package/src/@global.tsx +5 -0
  9. package/src/@jsminAmotifyExtension/fetch.tsx +2 -0
  10. package/src/@jsminAmotifyExtension/variables.tsx +4 -0
  11. package/src/@organisms.tsx +1 -5
  12. package/src/@styles/init.scss +1 -1
  13. package/src/@variables.tsx +70 -0
  14. package/src/atoms/FAI/parts.tsx +134 -0
  15. package/src/config.tsx +31 -5
  16. package/src/functions/Button/_.tsx +0 -1
  17. package/src/functions/Cropper/parts.tsx +18 -10
  18. package/src/functions/Effects/Ripple.tsx +1 -1
  19. package/src/functions/Input/Chips/Selector.tsx +9 -9
  20. package/src/functions/Input/Chips/_.tsx +10 -3
  21. package/src/functions/Input/DigitCharacters.tsx +13 -15
  22. package/src/functions/Input/File/_.tsx +35 -63
  23. package/src/functions/Input/Hidden.tsx +3 -1
  24. package/src/functions/Input/List/_.tsx +8 -8
  25. package/src/functions/Input/Select/_.tsx +8 -7
  26. package/src/functions/Input/Slider/_.tsx +5 -5
  27. package/src/functions/Input/Switch/_.tsx +9 -8
  28. package/src/functions/Input/Text.tsx +3 -4
  29. package/src/functions/Input/TextArea.tsx +3 -3
  30. package/src/functions/Input/Time/Picker.tsx +10 -17
  31. package/src/functions/Input/Time/_.tsx +3 -2
  32. package/src/functions/Input/Time/style.module.scss +9 -2
  33. package/src/functions/Input/_.tsx +24 -12
  34. package/src/functions/Input/core.tsx +10 -10
  35. package/src/functions/Input/style.module.scss +16 -3
  36. package/src/functions/Layout/PageNotFound.tsx +2 -4
  37. package/src/functions/Layout/PageRouter.tsx +2 -3
  38. package/src/functions/Loader/parts.tsx +3 -1
  39. package/src/functions/Loader/style.module.scss +1 -1
  40. package/src/functions/Sheet/parts.tsx +45 -42
  41. package/src/functions/Sheet/style.module.scss +16 -23
  42. package/src/functions/SnackBar/parts.tsx +5 -3
  43. package/src/functions/SnackBar/style.module.scss +1 -1
  44. package/src/functions/Table/Data/parts.tsx +18 -12
  45. package/src/functions/Table/Drag/parts.tsx +7 -9
  46. package/src/functions/Table/_.tsx +2 -2
  47. package/src/global/LaunchReactApplication.tsx +16 -5
  48. package/src/launch.tsx +12 -5
  49. package/src/molecules/Accordion/parts.tsx +4 -1
  50. package/src/molecules/LinkifyText/parts.tsx +2 -3
  51. package/src/preload.tsx +19 -30
  52. package/tsconfig.json +19 -8
  53. package/webpack.config.js +16 -5
  54. package/src/atoms/FAIcon/parts.tsx +0 -118
  55. package/src/atoms/FAIcon/style.module.scss +0 -8
  56. package/src/organisms/DisplayStyleInput/_.tsx +0 -18
  57. package/src/organisms/DisplayStyleInput/darkmode.tsx +0 -107
  58. package/src/organisms/DisplayStyleInput/themeColor.tsx +0 -205
@@ -3,7 +3,7 @@ import {
3
3
  React
4
4
  } from '@global';
5
5
  import {
6
- FAIcon
6
+ FAI
7
7
  } from '@atoms';
8
8
  import {
9
9
  Buttons,
@@ -15,6 +15,8 @@ import {
15
15
  DefaultCellSystemStyles
16
16
  } from '../_';
17
17
 
18
+ import { faGripDotsVertical } from '@fortawesome/pro-solid-svg-icons/faGripDotsVertical';
19
+
18
20
  import style from '../style.module.scss';
19
21
 
20
22
  const HeadRow: React.FC<amotify.fn.Tables.Drag.Params> = ( props ) => {
@@ -141,9 +143,7 @@ const BodyRows: React.FC<amotify.fn.Tables.Drag.Params> = ( props ) => {
141
143
  } );
142
144
  } }
143
145
  >
144
- <FAIcon
145
- d='grip-dots-vertical'
146
- />
146
+ <FAI icon={ faGripDotsVertical } />
147
147
  </Buttons.Button.Clear.R>
148
148
  </Comps.TH> );
149
149
  }
@@ -205,7 +205,7 @@ const BodyRows: React.FC<amotify.fn.Tables.Drag.Params> = ( props ) => {
205
205
  cellClassName
206
206
  ].join( ' ' ) }
207
207
  >
208
- <FAIcon.ArrowRight
208
+ <FAI.ArrowRight
209
209
  fontColor='theme'
210
210
  />
211
211
  </Comps.TH> );
@@ -315,15 +315,13 @@ export const DragTable: React.FC<amotify.fn.Tables.Drag.Params> = ( params ) =>
315
315
  parent: event.currentTarget,
316
316
  padding: [ 0,1 ],
317
317
  content: <Tooltips.Comps.Body>
318
- <FAIcon
319
- d='grip-dots-vertical'
320
- />
318
+ <FAI icon={ faGripDotsVertical } />
321
319
  ボタンをドラッグして順序を変更
322
320
  </Tooltips.Comps.Body>
323
321
  } );
324
322
  } }
325
323
  >
326
- <FAIcon.QuestionCircle />
324
+ <FAI.QuestionCircle />
327
325
  </Buttons.Button.Plain>,
328
326
  padding: [ 0,1 ],
329
327
  unitWidth: 4
@@ -5,7 +5,7 @@ import {
5
5
 
6
6
  import {
7
7
  Box,
8
- FAIcon
8
+ FAI
9
9
  } from '@atoms';
10
10
 
11
11
  export const Comps: amotify.fn.Tables.CompsMethods = {
@@ -27,7 +27,7 @@ export const Comps: amotify.fn.Tables.CompsMethods = {
27
27
  type: 'td',
28
28
  unitWidth: 4,
29
29
  // data: '',
30
- children: <FAIcon.AngleRight
30
+ children: <FAI.AngleRight
31
31
  fontColor={ 'theme' }
32
32
  fontSize={ '4.thirdTitle' }
33
33
  />
@@ -1,16 +1,18 @@
1
+ import { baseElements } from '@global';
1
2
  import React from 'react';
2
3
  import ReactDOMCLient from 'react-dom/client';
3
4
  import * as ReactRouterDom from 'react-router-dom';
4
5
 
5
6
  export const LaunchReactApplication: amotify.global.LaunchReactApplicationParams = ( props ) => {
6
7
  let {
7
- baseElement = '#ROOT',
8
+ baseElement = '#' + baseElements.rootID,
8
9
  reactElement,
9
10
  nonRouter = false,
11
+ isRoot = true,
10
12
  appearances
11
13
  } = props;
12
- let Base = $( baseElement )[ 0 ];
13
- if ( !Base || !reactElement ) return;
14
+ let base = $( baseElement );
15
+ if ( !base[ 0 ] || !reactElement ) return;
14
16
  if ( appearances ) {
15
17
  let {
16
18
  roundness,
@@ -26,6 +28,15 @@ export const LaunchReactApplication: amotify.global.LaunchReactApplicationParams
26
28
  }
27
29
 
28
30
  let reactDom = nonRouter ? reactElement : <ReactRouterDom.BrowserRouter children={ reactElement } />;
29
- // ReactDOMCLient.createRoot( Base ).render( <React.StrictMode children={ reactDom } /> );
30
- ReactDOMCLient.createRoot( Base ).render( <>{ reactDom }</> );
31
+
32
+ if ( isRoot ) {
33
+ base.addClass( 'amotify_base_element_root' );
34
+ if ( base[ 0 ].id ) {
35
+ baseElements.rootID = base[ 0 ].id;
36
+ } else {
37
+ base.setAttribute( 'id',baseElements.rootID );
38
+ }
39
+ }
40
+
41
+ ReactDOMCLient.createRoot( base[ 0 ] ).render( <>{ reactDom }</> );
31
42
  }
package/src/launch.tsx CHANGED
@@ -1,8 +1,16 @@
1
- import 'jsmin-front/dist/@types';
1
+ import 'jsmin-front/@types';
2
+ import 'jsmin-front/dist/jsmin';
2
3
 
3
4
  import '../@types/_';
4
5
 
5
6
  if ( !global.$ ) console.log( `%c※can not find global.$,please read Jsmin to launch amotify.`,'color:orange;' );
7
+ import { launchID } from './@variables';
8
+ export const baseElements = {
9
+ rootID: 'ROOT_' + launchID,
10
+ loaderID: 'LOADER_' + launchID,
11
+ sheetID: 'SHEET_' + launchID,
12
+ snackbarID: 'SNACKBARS_' + launchID
13
+ }
6
14
 
7
15
  let publicURI = 'https://public.comun.jp/';
8
16
  export { publicURI }
@@ -22,7 +30,7 @@ import {
22
30
  import {
23
31
  Flex,
24
32
  FlexBr,
25
- FAIcon,
33
+ FAI,
26
34
  Placeholder,
27
35
  Grid,
28
36
  Logo,
@@ -40,7 +48,6 @@ import {
40
48
  Row
41
49
  } from '@mols';
42
50
  import {
43
- DisplayStyleInput
44
51
  } from '@orgs';
45
52
  import {
46
53
  PlayGround
@@ -73,9 +80,9 @@ const amotify: amotify = {
73
80
  ReactRouterDOM,
74
81
  pageTransit,useStore,useRecycle,StyleConverter,LaunchReactApplication
75
82
  },
76
- atoms: { Flex,FlexBr,FAIcon,Placeholder,Grid,Logo,Box,Span,Paragraph,Img },
83
+ atoms: { Flex,FlexBr,FAI,Placeholder,Grid,Logo,Box,Span,Paragraph,Img },
77
84
  mols: { List,Accordion,LinkifyText,Text,Column,Row },
78
- orgs: { DisplayStyleInput },
85
+ orgs: {},
79
86
  temps: { PlayGround },
80
87
  fn: { Buttons,Input,Table,Layout,Sheet,SnackBar,Loader,Tooltips,Effects,Cropper }
81
88
  }
@@ -14,6 +14,7 @@ const Component: React.FC<amotify.mols.Accordion.Params> = ( params ) => {
14
14
  accordionID = '',
15
15
  slideAnimation = 'fast',
16
16
  defaultOpen = false,
17
+ override = false,
17
18
  ...others
18
19
  } = params;
19
20
 
@@ -21,7 +22,9 @@ const Component: React.FC<amotify.mols.Accordion.Params> = ( params ) => {
21
22
  let [ val_contentID ] = React.useState( $.uuidGen() );
22
23
  let [ val_open,set_open ] = React.useState( defaultOpen );
23
24
 
24
- if ( val_open != defaultOpen ) set_open( defaultOpen );
25
+ if ( val_open != defaultOpen ) {
26
+ if ( override ) set_open( defaultOpen );
27
+ }
25
28
 
26
29
  let Query = '[data-accordion-content-id="' + val_contentID + '"]';
27
30
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import {
3
- FAIcon
3
+ FAI
4
4
  } from '@atoms';
5
5
  import {
6
6
  Buttons
@@ -10,7 +10,6 @@ const {
10
10
  Anchor
11
11
  } = Buttons;
12
12
 
13
-
14
13
  export const LinkifyText: React.FC<amotify.mols.LinkifyTextProps> = ( props ) => {
15
14
  let {
16
15
  text,
@@ -39,7 +38,7 @@ export const LinkifyText: React.FC<amotify.mols.LinkifyTextProps> = ( props ) =>
39
38
  href={ url }
40
39
  newTab
41
40
  >
42
- { url } <FAIcon d='arrow-up-right-from-square' />
41
+ { url }
43
42
  </Anchor.Link> );
44
43
  }
45
44
  }
package/src/preload.tsx CHANGED
@@ -1,3 +1,5 @@
1
+ import { baseElements } from './launch';
2
+
1
3
  let tags: Jsmin.CreateElement.Args[] = [
2
4
  {
3
5
  tag: 'meta',parent: document.head,attr: {
@@ -24,42 +26,29 @@ let tags: Jsmin.CreateElement.Args[] = [
24
26
  rel: 'stylesheet',
25
27
  async: true
26
28
  }
27
- },
28
- {
29
- tag: 'script',parent: document.head,attr: {
30
- src: 'https://kit.fontawesome.com/6745173b38.js',async: true
31
- }
32
- },
33
-
34
- // <script src="https://public.comun.jp/@env/react/v18.0.4/reactProduction.js" defer></script>
35
- // <script src="https://public.comun.jp/@env/react/v18.0.4/react-dom.js" defer></script>
36
- // <script src="https://public.comun.jp/@env/react/v18.0.4/react-router-dom@v5.3.0.js" defer></script>
37
- // {
38
- // tag: 'script',parent: document.head,attr: {
39
- // src: 'https://public.comun.jp/@env/react/v18.0.4/reactProduction.js',async: true
40
- // }
41
- // },{
42
- // tag: 'script',parent: document.head,attr: {
43
- // src: 'https://public.comun.jp/@env/react/v18.0.4/react-dom.js',async: true
44
- // }
45
- // },{
46
- // tag: 'script',parent: document.head,attr: {
47
- // src: 'https://public.comun.jp/@env/react/v18.0.4/react-router-dom@v5.3.0.js',async: true
48
- // }
49
- // },
50
-
51
- {
29
+ },{
52
30
  tag: 'meta',parent: document.head,attr: {
53
31
  name: 'theme-color',
54
32
  content: '#45515c',
55
33
  },
56
34
  id: 'ThemeColorMetaTag'
35
+ },{
36
+ parent: document.body,
37
+ id: baseElements.sheetID,
38
+ className: 'amotify_base_element_sheet',
39
+ },{
40
+ parent: document.body,
41
+ id: baseElements.snackbarID,
42
+ className: 'amotify_base_element_snackbar',
43
+ },{
44
+ parent: document.body,
45
+ id: baseElements.loaderID,
46
+ className: 'amotify_base_element_loader',
47
+ },{
48
+ parent: document.body,
49
+ id: baseElements.rootID,
50
+ className: 'amotify_base_element_root',
57
51
  },
58
- { parent: document.body,id: 'SHEET' },
59
- { parent: document.body,id: 'TOOLTIPS' },
60
- { parent: document.body,id: 'SNACKBARS' },
61
- { parent: document.body,id: 'LOADER' },
62
- { parent: document.body,id: 'ROOT' },
63
52
  ];
64
53
  for ( let tag of tags ) {
65
54
  let { id } = tag;
package/tsconfig.json CHANGED
@@ -24,13 +24,24 @@
24
24
  "@styleSet": [
25
25
  "src/@styles/styleSet"
26
26
  ],
27
-
28
- "@global": [ "src/@global" ],
29
- "@atoms": [ "src/@atoms" ],
30
- "@mols": [ "src/@molecules" ],
31
- "@orgs": [ "src/@organisms" ],
32
- "@temps": [ "src/@templates" ],
33
- "@fn": [ "src/@functions" ],
27
+ "@global": [
28
+ "src/@global"
29
+ ],
30
+ "@atoms": [
31
+ "src/@atoms"
32
+ ],
33
+ "@mols": [
34
+ "src/@molecules"
35
+ ],
36
+ "@orgs": [
37
+ "src/@organisms"
38
+ ],
39
+ "@temps": [
40
+ "src/@templates"
41
+ ],
42
+ "@fn": [
43
+ "src/@functions"
44
+ ],
34
45
  },
35
46
  "strict": true,
36
47
  "skipLibCheck": true,
@@ -47,7 +58,7 @@
47
58
  // "noUnusedParameters": true,
48
59
  "strictNullChecks": true,
49
60
  "esModuleInterop": true,
50
- "noEmitOnError": true,
61
+ "noEmitOnError": false
51
62
  },
52
63
  "exclude": [
53
64
  "node_modules",
package/webpack.config.js CHANGED
@@ -43,6 +43,16 @@ module.exports = ( () => {
43
43
  }
44
44
  } )
45
45
  ],
46
+ splitChunks: {
47
+ cacheGroups: {
48
+ vendor: {
49
+ test: /node_modules/,
50
+ filename: 'coreVender.js',
51
+ chunks: 'all',
52
+ enforce: true
53
+ }
54
+ }
55
+ }
46
56
  },
47
57
  externals: {
48
58
  // 'react': 'React',
@@ -51,10 +61,10 @@ module.exports = ( () => {
51
61
  },
52
62
  plugins: [
53
63
  // new BundleAnalyzerPlugin(),
54
- new BrowserSync(
55
- BrowserSync_option,
56
- { reload: true }
57
- ),
64
+ // new BrowserSync(
65
+ // BrowserSync_option,
66
+ // { reload: true }
67
+ // ),
58
68
  new MinCss( {
59
69
  filename: '[name].min.css'
60
70
  } ),
@@ -86,6 +96,7 @@ module.exports = ( () => {
86
96
  {
87
97
  loader: "ts-loader",
88
98
  options: {
99
+ allowTsInNodeModules: true,
89
100
  // transpileOnly:true,
90
101
  configFile: path.resolve( __dirname, 'tsconfig.json' )
91
102
  }
@@ -96,7 +107,7 @@ module.exports = ( () => {
96
107
  },
97
108
  resolve: {
98
109
  modules: [ 'node_modules' ],
99
- extensions: [ '.js', '.jsx', '.tsx', 'ts' ],
110
+ extensions: [ '.js', '.jsx', '.tsx', '.ts' ],
100
111
  alias: {
101
112
  '~': `${ __dirname }/src`,
102
113
 
@@ -1,118 +0,0 @@
1
- import React from 'react';
2
- import {
3
- Box
4
- } from '../Various/parts';
5
-
6
- import style from './style.module.scss';
7
-
8
- const FaIconComp: React.FC<amotify.atoms.FAIcon.FAIconFNC> = ( params ) => {
9
- let {
10
- iconAnimation = false,
11
- iconFamily,
12
-
13
- isSolidIcon,
14
- isRegularIcon,
15
- isLightIcon,
16
- isThinIcon,
17
- isDuotoneIcon,
18
-
19
- isBrandIcon = false,
20
- d = 'image-slash',
21
- ...others
22
- } = params;
23
-
24
- let ClassNames = [
25
- style.FAIcon,
26
- 'fa-' + d,
27
- 'fa-fw'
28
- ];
29
-
30
- if ( !isBrandIcon ) {
31
- let { tone } = amotify.config;
32
- if ( !isSolidIcon && !isRegularIcon && !isLightIcon && !isThinIcon && !isDuotoneIcon ) isRegularIcon = true;
33
- if ( tone == 'default' ) {
34
- } else if ( tone == 'sharp' ) {
35
- iconFamily = iconFamily || 'sharp';
36
- }
37
-
38
- let iconStyle =
39
- isSolidIcon ? 'solid' :
40
- isRegularIcon ? 'regular' :
41
- isLightIcon ? 'light' :
42
- isThinIcon ? 'thin' :
43
- isDuotoneIcon ? 'duotone' :
44
- 'regular';
45
-
46
- iconFamily = iconFamily || 'classic';
47
-
48
- if ( iconAnimation == 'spin-reverse' ) iconAnimation = 'spin fa-spin-reverse' as any;
49
-
50
- ClassNames = [
51
- 'fa-' + iconFamily,
52
- 'fa-' + iconStyle,
53
- ...ClassNames
54
- ];
55
- if ( iconAnimation ) ClassNames.push( 'fa-' + iconAnimation );
56
- } else {
57
- ClassNames = [
58
- 'fa-brands',
59
- ...ClassNames
60
- ];
61
- }
62
-
63
-
64
- return ( <Box
65
- verticalAlign='center'
66
- horizontalAlign='center'
67
- { ...others }
68
- freeCSS={ {
69
- display: 'inline-flex',
70
- ...others.freeCSS
71
- } }
72
- >
73
- <i className={ ClassNames.join( ' ' ) } />
74
- </Box> );
75
- }
76
-
77
-
78
- const FAIcon: amotify.atoms.FAIcon.Method = FaIconComp as any;
79
-
80
- let shortKeys = [
81
- 'user',
82
- 'times',
83
- 'descktop',
84
-
85
- 'angle-right','angle-left','angle-up','angle-down',
86
- 'chevron-left','chevron-right','chevron-up','chevron-down',
87
- 'caret-left','caretRight','caret-up','caret-down',
88
- 'arrow-left','arrow-right','arrow-up','arrow-down',
89
-
90
- 'rotate','rotate-left','rotate-right','redo',
91
-
92
- 'play','pause','stop','forward-step','backward-step',
93
- 'check','check-circle',
94
- 'question','question-circle','exclamation','exclamation-triangle',
95
- 'home','share','volume',
96
- 'search','yen-sign','heart','star',
97
-
98
- 'edit','pen','copy','files','file',
99
- 'backspace',
100
- 'trash-alt',
101
- 'bars',
102
- 'download',
103
- 'link','link-slash','external-link-alt',
104
- 'gear',
105
- 'plus','minus','equals','calculator',
106
- 'image',
107
- 'badge-percent'
108
- ];
109
- for ( let key of shortKeys ) {
110
- FAIcon[ key.toCapital() as 'User' ] = ( params: amotify.atoms.FAIcon.FAIconFNC ) => {
111
- return <FaIconComp
112
- d={ key }
113
- { ...params }
114
- />;
115
- };
116
- }
117
-
118
- export { FAIcon }
@@ -1,8 +0,0 @@
1
- @use '@props' as *;
2
-
3
- .FAIcon {
4
- &:global.fa-duotone {
5
- // --fa-primary-opacity: 1;
6
- // --fa-secondary-opacity: 0.30;
7
- }
8
- }
@@ -1,18 +0,0 @@
1
- import { Darkmode } from './darkmode';
2
- import {
3
- ThemeColorALL,
4
- ThemeColorBasic,
5
- ThemeColorOriginal,
6
- ThemeColorBrands,
7
- Colors
8
- } from './themeColor';
9
- export const DisplayStyleInput: amotify.orgs.DisplayStyleInput.Methods = {
10
- Darkmode,
11
- ThemeColor: {
12
- ALL: ThemeColorALL,
13
- Originals: ThemeColorOriginal,
14
- Brands: ThemeColorBrands,
15
- Basics: ThemeColorBasic,
16
- Keys: Colors,
17
- }
18
- }
@@ -1,107 +0,0 @@
1
- import {
2
- React
3
- } from '@global';
4
- import {
5
- Box,
6
- Flex,
7
- Img,
8
- FAIcon
9
- } from '@atoms';
10
- import {
11
- Column,
12
- Row,
13
- Text
14
- } from '@mols';
15
- import {
16
- Input
17
- } from '@fn';
18
-
19
- const ColorCell = ( params: {
20
- colorType: amotify.DarkModeTypes
21
- } ) => {
22
- if ( params.colorType == 'light' ) {
23
- return <Box
24
- freeCSS={ {
25
- backgroundColor: '#FFF'
26
- } }
27
- width={ 1 }
28
- height={ 1 }
29
- isRounded
30
- />
31
- } else if ( params.colorType == 'dark' ) {
32
- return <Box
33
- freeCSS={ {
34
- backgroundColor: '#333'
35
- } }
36
- width={ 1 }
37
- height={ 1 }
38
- isRounded
39
- />
40
- } else if ( params.colorType == 'dim' ) {
41
- return <Box
42
- freeCSS={ {
43
- backgroundColor: '#666'
44
- } }
45
- width={ 1 }
46
- height={ 1 }
47
- isRounded
48
- />
49
- }
50
- return <Column
51
- width={ 1 }
52
- height={ 1 }
53
- isRounded
54
- flexChilds='even'
55
- overflow={ 'hidden' }
56
- gap={ '1/6' }
57
- freeCSS={ {
58
- transform: 'rotate(-45deg)'
59
- } }
60
- >
61
- <Box
62
- freeCSS={ {
63
- backgroundColor: '#FFF'
64
- } }
65
- borderRadius={ 1 }
66
- />
67
- <Box
68
- freeCSS={ {
69
- backgroundColor: '#333'
70
- } }
71
- borderRadius={ 1 }
72
- />
73
- </Column>
74
- }
75
-
76
- export const Darkmode = ( params: amotify.orgs.DisplayStyleInput.DarkmodeInput ) => {
77
- let [ val_darkmode,set_darkmode ] = React.useState( amotify.config.darkMode || 'light' );
78
-
79
- const mounted = React.useRef( false );
80
- React.useEffect( () => {
81
- if ( mounted.current ) {
82
- params.onUpdate( val_darkmode );
83
- } else {
84
- mounted.current = true;
85
- }
86
- },[ val_darkmode ] );
87
-
88
- return <Input.Radio
89
- icon={ false }
90
- value={ val_darkmode }
91
- cellStyles={ {
92
- padding: '1/3',
93
- borderWidth: 2,
94
- ssSphere: 4,
95
- isRounded: true
96
- } }
97
- options={ [
98
- { value: 'light',label: <ColorCell colorType={ 'light' } /> },
99
- { value: 'dark',label: <ColorCell colorType={ 'dark' } /> },
100
- { value: 'dim',label: <ColorCell colorType={ 'dim' } /> },
101
- { value: 'auto',label: <ColorCell colorType={ 'auto' } /> },
102
- ] }
103
- onUpdateValidValue={ ( { value } ) => {
104
- set_darkmode( value[ 0 ] );
105
- } }
106
- />;
107
- }