@fto-consult/expo-ui 2.16.5 → 2.16.6

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.
@@ -1,148 +0,0 @@
1
- // Copyright 2022 @fto-consult/Boris Fouomene. All rights reserved.
2
- // Use of this source code is governed by a BSD-style
3
- // license that can be found in the LICENSE file.
4
-
5
- import { lightColors,darkColors,primary as defaultPrimary,secondary as defaultSecondary} from "$theme/defaultTheme";
6
- import {modesObject} from "$ecomponents/TextField/utils";
7
-
8
- export const fields = {
9
- name : {
10
- type : 'text',
11
- maxLength : 30,
12
- text : 'Nom du thème',
13
- required : true,
14
- upper : true,
15
- },
16
- dark : {
17
- type : 'switch',
18
- checkedValue : true,
19
- uncheckedValue : false,
20
- label : 'Mode Sombre',
21
- checkedTooltip : 'Mode sombre actif',
22
- uncheckedTooltip : 'Mode sombre inactif',
23
- onChange : ({value,checked,context})=>{
24
- if(checked === undefined) return;
25
- if(context && context.getField){
26
- const darkFields = checked ? darkColors : lightColors;
27
- Object.map(darkFields,(dF,i)=>{
28
- const dFContext = context.getField(i);
29
- if(dFContext && dFContext.setValue){
30
- dFContext.validate({value:dF});
31
- }
32
- })
33
- }
34
- }
35
- },
36
- profilAvatarPosition : {
37
- type : 'switch',
38
- checkedValue : "drawer",
39
- uncheckedValue : "appBar",
40
- label : "Profil affiché sur le drawer",
41
- checkedTooltip : "Votre profil avatar sera affiché sur la barre de navigation latéralle de l'application"
42
- },
43
- textFieldMode : {
44
- type : 'select',
45
- items : {...modesObject,none:{code:'',label:'Dynamique'}},
46
- text : 'Mode d\'affichage des champs de texte'
47
- },
48
- primary : {
49
- type : 'color',
50
- text : 'Couleur principale [primary]',
51
- required : true,
52
- onChange : ({value,context})=>{
53
- if(context && context.getField){
54
- const pOnSurface = context.getField("primaryOnSurface");
55
- if(pOnSurface){
56
- pOnSurface.setValue(value);
57
- }
58
- }
59
- }
60
- },
61
- primaryText : {
62
- type :'color',
63
- text :'Texte sur couleur principale [primaryText]',
64
- required : true,
65
- },
66
- secondary : {
67
- type : 'color',
68
- text : ' Couleur secondaire [secondary]',
69
- required : true,
70
- onChange : ({value,context})=>{
71
- if(context && context.getField){
72
- const sOnSurface = context.getField("secondaryOnSurface");
73
- if(sOnSurface){
74
- sOnSurface.setValue(value);
75
- }
76
- }
77
- }
78
- },
79
- secondaryText : {
80
- type :'color',
81
- text :'Texte sur couleur secondaire [secondaryText]',
82
- required : true,
83
- },
84
- text : {
85
- type :'color',
86
- text : 'Couleur de texte [text]',
87
- required : true,
88
- },
89
- disabled : {
90
- type :'color',
91
- text :'Texte Inactif [disabeld]'
92
- },
93
- divider : {
94
- type : 'color',
95
- text : 'Couleur|Soulignement [divider]'
96
- },
97
- background : {
98
- type : 'color',
99
- text : 'Couleur d\'arrière plan [background]',
100
- },
101
- surface : {
102
- type :'color',
103
- text :'Couleur de surface [surface]',
104
- },
105
- surfaceText : {
106
- type :'color',
107
- text :'Texte sur surface [surfaceText]',
108
- },
109
- primaryOnSurface : {
110
- type :'color',
111
- text :'Couleur principale sur surface [primaryOnSurface]',
112
- },
113
- secondaryOnSurface : {
114
- type :'color',
115
- text :'Couleur secondaire sur surface [secondaryOnSurface]',
116
- },
117
- info : {
118
- type :'color',
119
- text :'Notification|info [info]'
120
- },
121
- success : {
122
- type :'color',
123
- text :'Notification|Succès [success]'
124
- },
125
- warning : {
126
- type :'color',
127
- text :'Notification|Alerte [warning]'
128
- },
129
- error : {
130
- type :'color',
131
- text :'Notification|Erreur [error]'
132
- },
133
- };
134
- export const getThemeData = (value)=>{
135
- const theme = {name:value.name,colors:{}};
136
- const validValue = {};
137
- Object.map(fields,(f,i)=>{
138
- if(!f) return;
139
- if(f.type =='color'){
140
- const fText = i+"Color";
141
- theme.colors[i] = value[i] || value[fText];
142
- } else {
143
- theme[i] = value[i];
144
- }
145
- validValue[i] = value[i];
146
- });
147
- return {theme,value:validValue};
148
- }