@coorpacademy/components 11.6.1 → 11.7.3

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/es/atom/loader/index.native.d.ts +10 -0
  2. package/es/atom/loader/index.native.d.ts.map +1 -0
  3. package/es/atom/loader/index.native.js +192 -0
  4. package/es/atom/loader/index.native.js.map +1 -0
  5. package/es/atom/select/index.d.ts.map +1 -1
  6. package/es/atom/select/index.js +48 -11
  7. package/es/atom/select/index.js.map +1 -1
  8. package/es/molecule/answer/index.d.ts.map +1 -1
  9. package/es/molecule/answer/index.js +1 -9
  10. package/es/molecule/answer/index.js.map +1 -1
  11. package/es/molecule/empty-state-dashboard/index.d.ts +23 -0
  12. package/es/molecule/empty-state-dashboard/index.d.ts.map +1 -0
  13. package/es/molecule/empty-state-dashboard/index.js +31 -0
  14. package/es/molecule/empty-state-dashboard/index.js.map +1 -0
  15. package/es/molecule/empty-state-dashboard/style.css +55 -0
  16. package/es/molecule/empty-state-dashboard/types.d.ts +19 -0
  17. package/es/molecule/empty-state-dashboard/types.d.ts.map +1 -0
  18. package/es/molecule/empty-state-dashboard/types.js +19 -0
  19. package/es/molecule/empty-state-dashboard/types.js.map +1 -0
  20. package/es/organism/list-item/index.d.ts +8 -6
  21. package/es/organism/list-item/index.d.ts.map +1 -1
  22. package/es/organism/list-item/index.js +16 -2
  23. package/es/organism/list-item/index.js.map +1 -1
  24. package/es/organism/list-item/style.css +18 -0
  25. package/es/organism/list-items/index.d.ts +2 -0
  26. package/es/organism/list-items/index.js +5 -1
  27. package/es/organism/list-items/index.js.map +1 -1
  28. package/es/template/activity/index.d.ts +36 -40
  29. package/es/template/activity/index.d.ts.map +1 -1
  30. package/es/template/activity/index.js +89 -111
  31. package/es/template/activity/index.js.map +1 -1
  32. package/es/template/activity/stars-summary.d.ts +9 -18
  33. package/es/template/activity/stars-summary.d.ts.map +1 -1
  34. package/es/template/activity/stars-summary.js +94 -122
  35. package/es/template/activity/stars-summary.js.map +1 -1
  36. package/es/template/back-office/brand-update/index.d.ts +20 -0
  37. package/es/template/back-office/brand-update/index.d.ts.map +1 -1
  38. package/es/template/back-office/brand-update/index.js +12 -3
  39. package/es/template/back-office/brand-update/index.js.map +1 -1
  40. package/es/template/back-office/brand-update/style.css +5 -1
  41. package/es/util/button-icons.d.ts +1 -0
  42. package/es/util/button-icons.d.ts.map +1 -1
  43. package/es/util/button-icons.js +3 -2
  44. package/es/util/button-icons.js.map +1 -1
  45. package/lib/atom/loader/index.native.d.ts +10 -0
  46. package/lib/atom/loader/index.native.d.ts.map +1 -0
  47. package/lib/atom/loader/index.native.js +205 -0
  48. package/lib/atom/loader/index.native.js.map +1 -0
  49. package/lib/atom/select/index.d.ts.map +1 -1
  50. package/lib/atom/select/index.js +46 -9
  51. package/lib/atom/select/index.js.map +1 -1
  52. package/lib/molecule/answer/index.d.ts.map +1 -1
  53. package/lib/molecule/answer/index.js +1 -10
  54. package/lib/molecule/answer/index.js.map +1 -1
  55. package/lib/molecule/empty-state-dashboard/index.d.ts +23 -0
  56. package/lib/molecule/empty-state-dashboard/index.d.ts.map +1 -0
  57. package/lib/molecule/empty-state-dashboard/index.js +42 -0
  58. package/lib/molecule/empty-state-dashboard/index.js.map +1 -0
  59. package/lib/molecule/empty-state-dashboard/style.css +55 -0
  60. package/lib/molecule/empty-state-dashboard/types.d.ts +19 -0
  61. package/lib/molecule/empty-state-dashboard/types.d.ts.map +1 -0
  62. package/lib/molecule/empty-state-dashboard/types.js +29 -0
  63. package/lib/molecule/empty-state-dashboard/types.js.map +1 -0
  64. package/lib/organism/list-item/index.d.ts +8 -6
  65. package/lib/organism/list-item/index.d.ts.map +1 -1
  66. package/lib/organism/list-item/index.js +16 -2
  67. package/lib/organism/list-item/index.js.map +1 -1
  68. package/lib/organism/list-item/style.css +18 -0
  69. package/lib/organism/list-items/index.d.ts +2 -0
  70. package/lib/organism/list-items/index.js +5 -1
  71. package/lib/organism/list-items/index.js.map +1 -1
  72. package/lib/template/activity/index.d.ts +36 -40
  73. package/lib/template/activity/index.d.ts.map +1 -1
  74. package/lib/template/activity/index.js +95 -110
  75. package/lib/template/activity/index.js.map +1 -1
  76. package/lib/template/activity/stars-summary.d.ts +9 -18
  77. package/lib/template/activity/stars-summary.d.ts.map +1 -1
  78. package/lib/template/activity/stars-summary.js +90 -119
  79. package/lib/template/activity/stars-summary.js.map +1 -1
  80. package/lib/template/back-office/brand-update/index.d.ts +20 -0
  81. package/lib/template/back-office/brand-update/index.d.ts.map +1 -1
  82. package/lib/template/back-office/brand-update/index.js +13 -3
  83. package/lib/template/back-office/brand-update/index.js.map +1 -1
  84. package/lib/template/back-office/brand-update/style.css +5 -1
  85. package/lib/util/button-icons.d.ts +1 -0
  86. package/lib/util/button-icons.d.ts.map +1 -1
  87. package/lib/util/button-icons.js +2 -1
  88. package/lib/util/button-icons.js.map +1 -1
  89. package/locales/bs/global.json +8 -1
  90. package/locales/cs/global.json +8 -1
  91. package/locales/de/global.json +8 -1
  92. package/locales/en/global.json +0 -1
  93. package/locales/es/global.json +8 -1
  94. package/locales/et/global.json +8 -1
  95. package/locales/fr/global.json +0 -1
  96. package/locales/hr/global.json +8 -1
  97. package/locales/hu/global.json +8 -1
  98. package/locales/hy/global.json +0 -1
  99. package/locales/it/global.json +8 -1
  100. package/locales/ja/global.json +8 -1
  101. package/locales/ko/global.json +8 -1
  102. package/locales/nl/global.json +8 -1
  103. package/locales/pl/global.json +8 -1
  104. package/locales/pt/global.json +8 -1
  105. package/locales/ro/global.json +8 -1
  106. package/locales/ru/global.json +0 -1
  107. package/locales/sk/global.json +8 -1
  108. package/locales/tl/global.json +8 -1
  109. package/locales/tr/global.json +8 -1
  110. package/locales/uk/global.json +8 -1
  111. package/locales/vi/global.json +8 -1
  112. package/locales/zh/global.json +8 -1
  113. package/locales/zh_TW/global.json +8 -1
  114. package/package.json +3 -3
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { ColorValue } from 'react-native';
3
+ export declare type Props = {
4
+ color?: ColorValue;
5
+ height?: number;
6
+ readyToHide: boolean;
7
+ };
8
+ declare const Loader: (props: Props) => JSX.Element | null;
9
+ export default Loader;
10
+ //# sourceMappingURL=index.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/atom/loader/index.native.tsx"],"names":[],"mappings":";AAEA,OAAO,EAA0C,UAAU,EAAC,MAAM,cAAc,CAAC;AAoCjF,oBAAY,KAAK,GAAG;IAClB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAKF,QAAA,MAAM,MAAM,UAAW,KAAK,uBAqK3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,192 @@
1
+ import { useAnimateProp } from '@coorpacademy/react-native-animation';
2
+ import React, { useEffect, useRef, useState } from 'react';
3
+ import { Animated, StyleSheet, Easing } from 'react-native';
4
+ import { useTemplateContext } from '../../template/app-review/template-context';
5
+
6
+ const createStyleSheet = theme => StyleSheet.create({
7
+ container: {
8
+ alignItems: 'center',
9
+ justifyContent: 'center'
10
+ },
11
+ dot: {
12
+ position: 'absolute'
13
+ },
14
+ blue: {
15
+ backgroundColor: theme.colors.cta
16
+ },
17
+ red: {
18
+ backgroundColor: theme.colors.negative
19
+ },
20
+ green: {
21
+ backgroundColor: theme.colors.positive
22
+ },
23
+ yellow: {
24
+ backgroundColor: theme.colors.battle
25
+ }
26
+ });
27
+
28
+ const CYCLE_DURATION = 3000;
29
+ const MIN_TIME = 1000;
30
+
31
+ const Loader = props => {
32
+ const templateContext = useTemplateContext();
33
+ const {
34
+ theme
35
+ } = templateContext;
36
+ const [styleSheet, setStylesheet] = useState(null);
37
+ const [visible, setVisible] = useState(true);
38
+ const [minTimeIsSpent, setMinTimeSpent] = useState(false);
39
+ const rotation = useRef(new Animated.Value(0)).current;
40
+ const scale = useRef(new Animated.Value(0)).current;
41
+ const hideAnimation = useAnimateProp({
42
+ property: 'opacity',
43
+ fromValue: 1,
44
+ toValue: 0
45
+ });
46
+ const {
47
+ height = 60,
48
+ color,
49
+ readyToHide
50
+ } = props;
51
+ useEffect(() => {
52
+ const _stylesheet = createStyleSheet(theme);
53
+
54
+ setStylesheet(_stylesheet);
55
+ }, [theme]);
56
+ useEffect(() => {
57
+ if (readyToHide && minTimeIsSpent) {
58
+ setVisible(false);
59
+ }
60
+ }, [readyToHide, minTimeIsSpent]);
61
+ useEffect(() => {
62
+ if (!visible) {
63
+ hideAnimation.start();
64
+ }
65
+ }, [visible, hideAnimation]);
66
+ useEffect(() => {
67
+ setTimeout(() => {
68
+ setMinTimeSpent(true);
69
+ }, MIN_TIME);
70
+
71
+ const _animation = Animated.parallel([Animated.loop(Animated.sequence([Animated.timing(scale, {
72
+ toValue: 0,
73
+ duration: 0,
74
+ useNativeDriver: false
75
+ }), Animated.timing(scale, {
76
+ toValue: 1,
77
+ duration: CYCLE_DURATION,
78
+ useNativeDriver: false,
79
+ easing: Easing.inOut(Easing.sin)
80
+ }), Animated.timing(scale, {
81
+ toValue: 2,
82
+ duration: CYCLE_DURATION,
83
+ useNativeDriver: false,
84
+ easing: Easing.inOut(Easing.sin)
85
+ }), Animated.timing(scale, {
86
+ toValue: 3,
87
+ duration: CYCLE_DURATION,
88
+ useNativeDriver: false,
89
+ easing: Easing.inOut(Easing.sin)
90
+ })])), Animated.loop(Animated.sequence([Animated.timing(rotation, {
91
+ toValue: 0,
92
+ duration: 0,
93
+ useNativeDriver: false
94
+ }), Animated.timing(rotation, {
95
+ toValue: 1,
96
+ duration: CYCLE_DURATION,
97
+ useNativeDriver: false,
98
+ easing: Easing.inOut(Easing.sin)
99
+ })]))]);
100
+
101
+ _animation.start();
102
+
103
+ return () => {
104
+ _animation.stop();
105
+ }; // eslint bad warning --> effect only onmount
106
+ // eslint-disable-next-line react-hooks/exhaustive-deps
107
+ }, []);
108
+
109
+ if (!styleSheet) {
110
+ return null;
111
+ }
112
+
113
+ const interpolatedScale = scale.interpolate({
114
+ inputRange: [0, 0.45, 1, 1.32, 1.5, 2, 2.3, 2.64, 3],
115
+ outputRange: [0.5, 0.2, 0.5, 0.5, 0.8, 0.5, 0.5, 0.3, 0.5]
116
+ });
117
+ const interpolatedRotation = rotation.interpolate({
118
+ inputRange: [0, 1],
119
+ outputRange: ['0deg', '360deg']
120
+ });
121
+ const dotWidth = rotation.interpolate({
122
+ inputRange: [0, 0.5, 1],
123
+ outputRange: [height / 2, height / 6, height / 2]
124
+ });
125
+ const dotTranslate = rotation.interpolate({
126
+ inputRange: [0, 0.5, 1],
127
+ outputRange: [-25 * (height / 60), -35 * (height / 60), -25 * (height / 60)]
128
+ });
129
+ const dotStyle = {
130
+ width: dotWidth,
131
+ height: height / 6,
132
+ borderRadius: height / 12
133
+ };
134
+ return /*#__PURE__*/React.createElement(Animated.View, {
135
+ style: hideAnimation.animatedStyle
136
+ }, /*#__PURE__*/React.createElement(Animated.View, {
137
+ style: [styleSheet.container, {
138
+ height,
139
+ width: height,
140
+ transform: [{
141
+ scaleX: interpolatedScale
142
+ }, {
143
+ scaleY: interpolatedScale
144
+ }, {
145
+ rotateZ: interpolatedRotation
146
+ }]
147
+ }]
148
+ }, /*#__PURE__*/React.createElement(Animated.View, {
149
+ style: [styleSheet.dot, color ? {
150
+ backgroundColor: color
151
+ } : styleSheet.red, dotStyle, {
152
+ transform: [{
153
+ rotateZ: '45deg'
154
+ }, {
155
+ translateX: dotTranslate
156
+ }]
157
+ }]
158
+ }), /*#__PURE__*/React.createElement(Animated.View, {
159
+ style: [styleSheet.dot, color ? {
160
+ backgroundColor: color
161
+ } : styleSheet.green, dotStyle, {
162
+ transform: [{
163
+ rotateZ: '135deg'
164
+ }, {
165
+ translateX: dotTranslate
166
+ }]
167
+ }]
168
+ }), /*#__PURE__*/React.createElement(Animated.View, {
169
+ style: [styleSheet.dot, color ? {
170
+ backgroundColor: color
171
+ } : styleSheet.yellow, dotStyle, {
172
+ transform: [{
173
+ rotateZ: '225deg'
174
+ }, {
175
+ translateX: dotTranslate
176
+ }]
177
+ }]
178
+ }), /*#__PURE__*/React.createElement(Animated.View, {
179
+ style: [styleSheet.dot, color ? {
180
+ backgroundColor: color
181
+ } : styleSheet.blue, dotStyle, {
182
+ transform: [{
183
+ rotateZ: '315deg'
184
+ }, {
185
+ translateX: dotTranslate
186
+ }]
187
+ }]
188
+ })));
189
+ };
190
+
191
+ export default Loader;
192
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.js","names":["useAnimateProp","React","useEffect","useRef","useState","Animated","StyleSheet","Easing","useTemplateContext","createStyleSheet","theme","create","container","alignItems","justifyContent","dot","position","blue","backgroundColor","colors","cta","red","negative","green","positive","yellow","battle","CYCLE_DURATION","MIN_TIME","Loader","props","templateContext","styleSheet","setStylesheet","visible","setVisible","minTimeIsSpent","setMinTimeSpent","rotation","Value","current","scale","hideAnimation","property","fromValue","toValue","height","color","readyToHide","_stylesheet","start","setTimeout","_animation","parallel","loop","sequence","timing","duration","useNativeDriver","easing","inOut","sin","stop","interpolatedScale","interpolate","inputRange","outputRange","interpolatedRotation","dotWidth","dotTranslate","dotStyle","width","borderRadius","animatedStyle","transform","scaleX","scaleY","rotateZ","translateX"],"sources":["../../../src/atom/loader/index.native.tsx"],"sourcesContent":["import {useAnimateProp} from '@coorpacademy/react-native-animation';\nimport React, {useEffect, useRef, useState} from 'react';\nimport {Animated, StyleSheet, Easing, ViewStyle, ColorValue} from 'react-native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\n\ntype StyleSheetType = {\n container: ViewStyle;\n dot: ViewStyle;\n blue: ViewStyle;\n red: ViewStyle;\n green: ViewStyle;\n yellow: ViewStyle;\n};\n\nconst createStyleSheet = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n container: {\n alignItems: 'center',\n justifyContent: 'center'\n },\n dot: {\n position: 'absolute'\n },\n blue: {\n backgroundColor: theme.colors.cta\n },\n red: {\n backgroundColor: theme.colors.negative\n },\n green: {\n backgroundColor: theme.colors.positive\n },\n yellow: {\n backgroundColor: theme.colors.battle\n }\n });\n\nexport type Props = {\n color?: ColorValue;\n height?: number;\n readyToHide: boolean;\n};\n\nconst CYCLE_DURATION = 3000;\nconst MIN_TIME = 1000;\n\nconst Loader = (props: Props) => {\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n const [visible, setVisible] = useState<boolean>(true);\n const [minTimeIsSpent, setMinTimeSpent] = useState<boolean>(false);\n\n const rotation = useRef<Animated.Value>(new Animated.Value(0)).current;\n const scale = useRef<Animated.Value>(new Animated.Value(0)).current;\n\n const hideAnimation = useAnimateProp({\n property: 'opacity',\n fromValue: 1,\n toValue: 0\n });\n\n const {height = 60, color, readyToHide} = props;\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n useEffect(() => {\n if (readyToHide && minTimeIsSpent) {\n setVisible(false);\n }\n }, [readyToHide, minTimeIsSpent]);\n\n useEffect(() => {\n if (!visible) {\n hideAnimation.start();\n }\n }, [visible, hideAnimation]);\n\n useEffect(() => {\n setTimeout(() => {\n setMinTimeSpent(true);\n }, MIN_TIME);\n\n const _animation = Animated.parallel([\n Animated.loop(\n Animated.sequence([\n Animated.timing(scale, {toValue: 0, duration: 0, useNativeDriver: false}),\n Animated.timing(scale, {\n toValue: 1,\n duration: CYCLE_DURATION,\n useNativeDriver: false,\n easing: Easing.inOut(Easing.sin)\n }),\n Animated.timing(scale, {\n toValue: 2,\n duration: CYCLE_DURATION,\n useNativeDriver: false,\n easing: Easing.inOut(Easing.sin)\n }),\n Animated.timing(scale, {\n toValue: 3,\n duration: CYCLE_DURATION,\n useNativeDriver: false,\n easing: Easing.inOut(Easing.sin)\n })\n ])\n ),\n Animated.loop(\n Animated.sequence([\n Animated.timing(rotation, {toValue: 0, duration: 0, useNativeDriver: false}),\n Animated.timing(rotation, {\n toValue: 1,\n duration: CYCLE_DURATION,\n useNativeDriver: false,\n easing: Easing.inOut(Easing.sin)\n })\n ])\n )\n ]);\n\n _animation.start();\n\n return () => {\n _animation.stop();\n };\n // eslint bad warning --> effect only onmount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n if (!styleSheet) {\n return null;\n }\n\n const interpolatedScale = scale.interpolate({\n inputRange: [0, 0.45, 1, 1.32, 1.5, 2, 2.3, 2.64, 3],\n outputRange: [0.5, 0.2, 0.5, 0.5, 0.8, 0.5, 0.5, 0.3, 0.5]\n });\n\n const interpolatedRotation = rotation.interpolate({\n inputRange: [0, 1],\n outputRange: ['0deg', '360deg']\n });\n const dotWidth = rotation.interpolate({\n inputRange: [0, 0.5, 1],\n outputRange: [height / 2, height / 6, height / 2]\n });\n const dotTranslate = rotation.interpolate({\n inputRange: [0, 0.5, 1],\n outputRange: [-25 * (height / 60), -35 * (height / 60), -25 * (height / 60)]\n });\n const dotStyle = {\n width: dotWidth,\n height: height / 6,\n borderRadius: height / 12\n };\n\n return (\n <Animated.View style={hideAnimation.animatedStyle}>\n <Animated.View\n style={[\n styleSheet.container,\n {\n height,\n width: height,\n transform: [\n {scaleX: interpolatedScale},\n {scaleY: interpolatedScale},\n {rotateZ: interpolatedRotation}\n ]\n }\n ]}\n >\n <Animated.View\n style={[\n styleSheet.dot,\n color ? {backgroundColor: color} : styleSheet.red,\n dotStyle,\n {transform: [{rotateZ: '45deg'}, {translateX: dotTranslate}]}\n ]}\n />\n <Animated.View\n style={[\n styleSheet.dot,\n color ? {backgroundColor: color} : styleSheet.green,\n dotStyle,\n {transform: [{rotateZ: '135deg'}, {translateX: dotTranslate}]}\n ]}\n />\n <Animated.View\n style={[\n styleSheet.dot,\n color ? {backgroundColor: color} : styleSheet.yellow,\n dotStyle,\n {transform: [{rotateZ: '225deg'}, {translateX: dotTranslate}]}\n ]}\n />\n <Animated.View\n style={[\n styleSheet.dot,\n color ? {backgroundColor: color} : styleSheet.blue,\n dotStyle,\n {transform: [{rotateZ: '315deg'}, {translateX: dotTranslate}]}\n ]}\n />\n </Animated.View>\n </Animated.View>\n );\n};\n\nexport default Loader;\n"],"mappings":"AAAA,SAAQA,cAAR,QAA6B,sCAA7B;AACA,OAAOC,KAAP,IAAeC,SAAf,EAA0BC,MAA1B,EAAkCC,QAAlC,QAAiD,OAAjD;AACA,SAAQC,QAAR,EAAkBC,UAAlB,EAA8BC,MAA9B,QAAkE,cAAlE;AACA,SAAQC,kBAAR,QAAiC,4CAAjC;;AAYA,MAAMC,gBAAgB,GAAIC,KAAD,IACvBJ,UAAU,CAACK,MAAX,CAAkB;EAChBC,SAAS,EAAE;IACTC,UAAU,EAAE,QADH;IAETC,cAAc,EAAE;EAFP,CADK;EAKhBC,GAAG,EAAE;IACHC,QAAQ,EAAE;EADP,CALW;EAQhBC,IAAI,EAAE;IACJC,eAAe,EAAER,KAAK,CAACS,MAAN,CAAaC;EAD1B,CARU;EAWhBC,GAAG,EAAE;IACHH,eAAe,EAAER,KAAK,CAACS,MAAN,CAAaG;EAD3B,CAXW;EAchBC,KAAK,EAAE;IACLL,eAAe,EAAER,KAAK,CAACS,MAAN,CAAaK;EADzB,CAdS;EAiBhBC,MAAM,EAAE;IACNP,eAAe,EAAER,KAAK,CAACS,MAAN,CAAaO;EADxB;AAjBQ,CAAlB,CADF;;AA6BA,MAAMC,cAAc,GAAG,IAAvB;AACA,MAAMC,QAAQ,GAAG,IAAjB;;AAEA,MAAMC,MAAM,GAAIC,KAAD,IAAkB;EAC/B,MAAMC,eAAe,GAAGvB,kBAAkB,EAA1C;EACA,MAAM;IAACE;EAAD,IAAUqB,eAAhB;EAEA,MAAM,CAACC,UAAD,EAAaC,aAAb,IAA8B7B,QAAQ,CAAwB,IAAxB,CAA5C;EACA,MAAM,CAAC8B,OAAD,EAAUC,UAAV,IAAwB/B,QAAQ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,IAAV;IACE,KAAK,EAAE,CACLrC,UAAU,CAACjB,GADN,EAELgC,KAAK,GAAG;MAAC7B,eAAe,EAAE6B;IAAlB,CAAH,GAA8Bf,UAAU,CAACP,MAFzC,EAGL6C,QAHK,EAIL;MAACI,SAAS,EAAE,CAAC;QAACG,OAAO,EAAE;MAAV,CAAD,EAAsB;QAACC,UAAU,EAAET;MAAb,CAAtB;IAAZ,CAJK;EADT,EA9BF,eAsCE,oBAAC,QAAD,CAAU,IAAV;IACE,KAAK,EAAE,CACLrC,UAAU,CAACjB,GADN,EAELgC,KAAK,GAAG;MAAC7B,eAAe,EAAE6B;IAAlB,CAAH,GAA8Bf,UAAU,CAACf,IAFzC,EAGLqD,QAHK,EAIL;MAACI,SAAS,EAAE,CAAC;QAACG,OAAO,EAAE;MAAV,CAAD,EAAsB;QAACC,UAAU,EAAET;MAAb,CAAtB;IAAZ,CAJK;EADT,EAtCF,CADF,CADF;AAmDD,CArKD;;AAuKA,eAAexC,MAAf"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/select/index.js"],"names":[],"mappings":";;;;;;;;AA6BA,qEA6JC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/select/index.js"],"names":[],"mappings":";;;;;;;;AAwDA,qEA4KC"}
@@ -1,6 +1,6 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- import React, { useMemo } from 'react';
3
+ import React, { useCallback, useMemo, useState } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import classnames from 'classnames';
6
6
  import filter from 'lodash/fp/filter';
@@ -11,7 +11,7 @@ import includes from 'lodash/fp/includes';
11
11
  import keys from 'lodash/fp/keys';
12
12
  import map from 'lodash/fp/map';
13
13
  import size from 'lodash/fp/size';
14
- import { NovaCompositionNavigationArrowDown as ArrowDown } from '@coorpacademy/nova-icons';
14
+ import { NovaCompositionNavigationArrowDown as ArrowDown, NovaCompositionNavigationArrowTop as ArrowUp } from '@coorpacademy/nova-icons';
15
15
  import Provider, { GetSkinFromContext } from '../provider';
16
16
  import getClassState from '../../util/get-class-state';
17
17
  import style from './style.css';
@@ -28,6 +28,30 @@ const themeStyle = {
28
28
  coorpmanager: null
29
29
  };
30
30
 
31
+ const ArrowView = ({
32
+ shouldRender,
33
+ isArrowUp,
34
+ ariaLabel,
35
+ arrowClass,
36
+ arrowColor
37
+ }) => {
38
+ const props = useMemo(() => _extends({}, ariaLabel & {
39
+ 'aria-label': ariaLabel
40
+ }, arrowColor & {
41
+ color: arrowColor
42
+ }, {
43
+ className: arrowClass
44
+ }), [ariaLabel, arrowClass, arrowColor]);
45
+
46
+ if (shouldRender) {
47
+ return isArrowUp ? /*#__PURE__*/React.createElement(ArrowUp, _extends({}, props, {
48
+ "data-testid": "select-arrow-up-icon"
49
+ })) : /*#__PURE__*/React.createElement(ArrowDown, _extends({}, props, {
50
+ "data-testid": "select-arrow-down-icon"
51
+ }));
52
+ } else return null;
53
+ };
54
+
31
55
  const Select = (props, legacyContext) => {
32
56
  const {
33
57
  name,
@@ -47,6 +71,9 @@ const Select = (props, legacyContext) => {
47
71
  } = props;
48
72
  const skin = GetSkinFromContext(legacyContext);
49
73
  const title = useMemo(() => propTitle ? `${propTitle}${required ? '*' : ''}` : null, [propTitle, required]);
74
+ const [isArrowUp, setIsArrowUp] = useState(false);
75
+ const handleSelectOnFocus = useCallback(() => setIsArrowUp(true), []);
76
+ const handleSelectOnBlur = useCallback(() => setIsArrowUp(false), []);
50
77
  const optionList = options && options.map((option, index) => {
51
78
  return /*#__PURE__*/React.createElement("option", {
52
79
  key: index,
@@ -72,20 +99,17 @@ const Select = (props, legacyContext) => {
72
99
  selected: true
73
100
  }, options)), [options, theme]);
74
101
  const handleChange = useMemo(() => multiple ? e => {
102
+ setIsArrowUp(false);
75
103
  onChange(map(get('value'), e.target.selectedOptions));
76
104
  } : e => {
105
+ setIsArrowUp(false);
77
106
  onChange(e.target.value);
78
107
  }, [onChange, multiple]);
79
108
  const black = useMemo(() => getOr('#14171A', 'common.black', skin), [skin]);
80
109
  const color = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);
81
- const shouldUseSkinFontColor = useMemo(() => !isSelectedInValidOption && selected && includes(theme, ['question', 'template', 'player']), [isSelectedInValidOption, selected, theme]);
110
+ const isThemeOneOfQuestionTemplateOrPlayer = useMemo(() => includes(theme, ['question', 'template', 'player']), [theme]);
111
+ const shouldUseSkinFontColor = useMemo(() => !isSelectedInValidOption && selected && isThemeOneOfQuestionTemplateOrPlayer, [isSelectedInValidOption, selected, isThemeOneOfQuestionTemplateOrPlayer]);
82
112
  const arrowColor = selected ? color : undefined;
83
- const arrowView = !multiple ? /*#__PURE__*/React.createElement(ArrowDown, {
84
- color: includes(theme, ['question', 'template', 'player']) ? arrowColor : black,
85
- className: shouldUseSkinFontColor ? style.selectedArrow : style.arrow,
86
- "aria-label": ariaLabel,
87
- "data-testid": "select-arrow-down-icon"
88
- }) : null;
89
113
  const behaviorClassName = useMemo(() => getClassState(style.default, style.modified, style.error, modified, error), [error, modified]);
90
114
  const composedClassName = useMemo(() => classnames(theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName, selected ? style.selected : style.unselected, className), [behaviorClassName, className, selected, theme]);
91
115
  const labelSize = useMemo(() => size(selectedLabel), [selectedLabel]);
@@ -104,7 +128,13 @@ const Select = (props, legacyContext) => {
104
128
  style: _extends({}, shouldUseSkinFontColor && {
105
129
  color
106
130
  })
107
- }, selectedLabel), arrowView, /*#__PURE__*/React.createElement("select", {
131
+ }, selectedLabel), /*#__PURE__*/React.createElement(ArrowView, {
132
+ shouldRender: !multiple,
133
+ isArrowUp: isArrowUp,
134
+ ariaLabel: ariaLabel,
135
+ arrowClass: shouldUseSkinFontColor ? style.selectedArrow : style.arrow,
136
+ arrowColor: isThemeOneOfQuestionTemplateOrPlayer ? arrowColor : black
137
+ }), /*#__PURE__*/React.createElement("select", {
108
138
  "data-name": "native-select",
109
139
  className: style.selectBox,
110
140
  title: selectedLabel,
@@ -112,7 +142,14 @@ const Select = (props, legacyContext) => {
112
142
  onChange: handleChange,
113
143
  value: selected,
114
144
  multiple: multiple,
115
- disabled: disabled
145
+ disabled: disabled,
146
+ onClick: handleSelectOnFocus,
147
+ onBlur: handleSelectOnBlur // onBlur does not handle completely an out of bounds click
148
+ // ex: select is Opened and a click is done outside, cancelling the select
149
+ // that doesn't count as a Blur, so an onMouseLeave is needed
150
+ ,
151
+ onMouseLeave: handleSelectOnBlur,
152
+ "data-testid": "native-select"
116
153
  }, optionList)), /*#__PURE__*/React.createElement("div", {
117
154
  className: style.description
118
155
  }, description));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useMemo","PropTypes","classnames","filter","find","get","getOr","includes","keys","map","size","NovaCompositionNavigationArrowDown","ArrowDown","Provider","GetSkinFromContext","getClassState","style","themeStyle","invalid","header","mooc","question","sort","thematiques","player","template","coorpmanager","Select","props","legacyContext","name","options","className","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","ariaLabel","skin","optionList","option","index","value","selectOption","titleView","selected","selectedLabel","isSelectedInValidOption","validOption","handleChange","e","target","selectedOptions","black","color","shouldUseSkinFontColor","arrowColor","undefined","arrowView","selectedArrow","arrow","behaviorClassName","default","composedClassName","unselected","labelSize","isLongLabel","selectWrapper","selectSpan","noLabelCommon","longLabel","selectBox","SelectOptionPropTypes","string","isRequired","oneOfType","number","bool","contextTypes","childContextTypes","propTypes","func","oneOf","arrayOf","shape"],"sources":["../../../src/atom/select/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport filter from 'lodash/fp/filter';\nimport find from 'lodash/fp/find';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport includes from 'lodash/fp/includes';\nimport keys from 'lodash/fp/keys';\nimport map from 'lodash/fp/map';\nimport size from 'lodash/fp/size';\nimport {NovaCompositionNavigationArrowDown as ArrowDown} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../provider';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n filter: style.filter,\n invalid: style.invalid,\n header: style.header,\n mooc: style.mooc,\n question: style.question,\n sort: style.sort,\n thematiques: style.thematiques,\n player: style.player,\n template: style.template,\n coorpmanager: null\n};\n\nconst Select = (props, legacyContext) => {\n const {\n name,\n options = [],\n className,\n borderClassName,\n onChange,\n multiple = false,\n disabled,\n required,\n description,\n theme,\n modified = false,\n error = false,\n title: propTitle,\n 'aria-label': ariaLabel\n } = props;\n\n const skin = GetSkinFromContext(legacyContext);\n const title = useMemo(\n () => (propTitle ? `${propTitle}${required ? '*' : ''}` : null),\n [propTitle, required]\n );\n\n const optionList =\n options &&\n options.map((option, index) => {\n return (\n <option key={index} value={option.value} className={style.selectOption}>\n {option.name}\n </option>\n );\n });\n\n const titleView = title ? <span className={style.title}>{title} </span> : null;\n\n const selected = useMemo(\n () =>\n multiple\n ? map(get('value'), filter({selected: true}, options))\n : get('value', find({selected: true}, options)),\n [multiple, options]\n );\n const selectedLabel = useMemo(\n () =>\n multiple\n ? map(get('name'), filter({selected: true}, options))\n : get('name', find({selected: true}, options)),\n [multiple, options]\n );\n\n const isSelectedInValidOption = useMemo(\n () =>\n theme === 'player' &&\n getOr(false, 'name', find({validOption: false, selected: true}, options)),\n [options, theme]\n );\n\n const handleChange = useMemo(\n () =>\n multiple\n ? e => {\n onChange(map(get('value'), e.target.selectedOptions));\n }\n : e => {\n onChange(e.target.value);\n },\n [onChange, multiple]\n );\n\n const black = useMemo(() => getOr('#14171A', 'common.black', skin), [skin]);\n const color = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const shouldUseSkinFontColor = useMemo(\n () =>\n !isSelectedInValidOption && selected && includes(theme, ['question', 'template', 'player']),\n [isSelectedInValidOption, selected, theme]\n );\n const arrowColor = selected ? color : undefined;\n\n const arrowView = !multiple ? (\n <ArrowDown\n color={includes(theme, ['question', 'template', 'player']) ? arrowColor : black}\n className={shouldUseSkinFontColor ? style.selectedArrow : style.arrow}\n aria-label={ariaLabel}\n data-testid=\"select-arrow-down-icon\"\n />\n ) : null;\n const behaviorClassName = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [error, modified]\n );\n const composedClassName = useMemo(\n () =>\n classnames(\n theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName,\n selected ? style.selected : style.unselected,\n className\n ),\n [behaviorClassName, className, selected, theme]\n );\n\n const labelSize = useMemo(() => size(selectedLabel), [selectedLabel]);\n\n const isLongLabel = useMemo(() => labelSize >= 65, [labelSize]);\n\n return (\n <div\n className={classnames(\n composedClassName,\n theme === 'coorpmanager' ? style.coorpmanager : null\n )}\n >\n <label\n data-name=\"select-wrapper\"\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n className={style.selectWrapper}\n >\n {titleView}\n <span\n data-name=\"select-span\"\n className={classnames(\n style.selectSpan,\n includes(theme, ['player', 'invalid', 'question', 'thematiques', 'template'])\n ? style.noLabelCommon\n : null,\n borderClassName,\n isLongLabel ? style.longLabel : null\n )}\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n >\n {selectedLabel}\n </span>\n {arrowView}\n <select\n data-name=\"native-select\"\n className={style.selectBox}\n title={selectedLabel}\n name={name}\n onChange={handleChange}\n value={selected}\n multiple={multiple}\n disabled={disabled}\n >\n {optionList}\n </select>\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n};\n\nexport const SelectOptionPropTypes = {\n name: PropTypes.string.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n selected: PropTypes.bool,\n validOption: PropTypes.bool\n};\n\nSelect.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nSelect.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n className: PropTypes.string,\n borderClassName: PropTypes.string,\n disabled: PropTypes.bool,\n multiple: PropTypes.bool,\n description: PropTypes.string,\n required: PropTypes.bool,\n onChange: PropTypes.func,\n theme: PropTypes.oneOf(keys(themeStyle)),\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes)),\n modified: PropTypes.bool,\n error: PropTypes.bool,\n 'aria-label': PropTypes.string\n};\n\nexport default Select;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,MAAP,MAAmB,kBAAnB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,SAAQC,kCAAkC,IAAIC,SAA9C,QAA8D,0BAA9D;AACA,OAAOC,QAAP,IAAkBC,kBAAlB,QAA2C,aAA3C;AACA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,UAAU,GAAG;EACjBd,MAAM,EAAEa,KAAK,CAACb,MADG;EAEjBe,OAAO,EAAEF,KAAK,CAACE,OAFE;EAGjBC,MAAM,EAAEH,KAAK,CAACG,MAHG;EAIjBC,IAAI,EAAEJ,KAAK,CAACI,IAJK;EAKjBC,QAAQ,EAAEL,KAAK,CAACK,QALC;EAMjBC,IAAI,EAAEN,KAAK,CAACM,IANK;EAOjBC,WAAW,EAAEP,KAAK,CAACO,WAPF;EAQjBC,MAAM,EAAER,KAAK,CAACQ,MARG;EASjBC,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":3,"file":"index.js","names":["React","useCallback","useMemo","useState","PropTypes","classnames","filter","find","get","getOr","includes","keys","map","size","NovaCompositionNavigationArrowDown","ArrowDown","NovaCompositionNavigationArrowTop","ArrowUp","Provider","GetSkinFromContext","getClassState","style","themeStyle","invalid","header","mooc","question","sort","thematiques","player","template","coorpmanager","ArrowView","shouldRender","isArrowUp","ariaLabel","arrowClass","arrowColor","props","color","className","Select","legacyContext","name","options","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","skin","setIsArrowUp","handleSelectOnFocus","handleSelectOnBlur","optionList","option","index","value","selectOption","titleView","selected","selectedLabel","isSelectedInValidOption","validOption","handleChange","e","target","selectedOptions","black","isThemeOneOfQuestionTemplateOrPlayer","shouldUseSkinFontColor","undefined","behaviorClassName","default","composedClassName","unselected","labelSize","isLongLabel","selectWrapper","selectSpan","noLabelCommon","longLabel","selectedArrow","arrow","selectBox","SelectOptionPropTypes","string","isRequired","oneOfType","number","bool","contextTypes","childContextTypes","propTypes","func","oneOf","arrayOf","shape"],"sources":["../../../src/atom/select/index.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport filter from 'lodash/fp/filter';\nimport find from 'lodash/fp/find';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport includes from 'lodash/fp/includes';\nimport keys from 'lodash/fp/keys';\nimport map from 'lodash/fp/map';\nimport size from 'lodash/fp/size';\nimport {\n NovaCompositionNavigationArrowDown as ArrowDown,\n NovaCompositionNavigationArrowTop as ArrowUp\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../provider';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n filter: style.filter,\n invalid: style.invalid,\n header: style.header,\n mooc: style.mooc,\n question: style.question,\n sort: style.sort,\n thematiques: style.thematiques,\n player: style.player,\n template: style.template,\n coorpmanager: null\n};\n\nconst ArrowView = ({shouldRender, isArrowUp, ariaLabel, arrowClass, arrowColor}) => {\n const props = useMemo(\n () => ({\n ...(ariaLabel &\n {\n 'aria-label': ariaLabel\n }),\n ...(arrowColor &\n {\n color: arrowColor\n }),\n className: arrowClass\n }),\n [ariaLabel, arrowClass, arrowColor]\n );\n if (shouldRender) {\n return isArrowUp ? (\n <ArrowUp {...props} data-testid=\"select-arrow-up-icon\" />\n ) : (\n <ArrowDown {...props} data-testid=\"select-arrow-down-icon\" />\n );\n } else return null;\n};\n\nconst Select = (props, legacyContext) => {\n const {\n name,\n options = [],\n className,\n borderClassName,\n onChange,\n multiple = false,\n disabled,\n required,\n description,\n theme,\n modified = false,\n error = false,\n title: propTitle,\n 'aria-label': ariaLabel\n } = props;\n\n const skin = GetSkinFromContext(legacyContext);\n const title = useMemo(\n () => (propTitle ? `${propTitle}${required ? '*' : ''}` : null),\n [propTitle, required]\n );\n\n const [isArrowUp, setIsArrowUp] = useState(false);\n\n const handleSelectOnFocus = useCallback(() => setIsArrowUp(true), []);\n const handleSelectOnBlur = useCallback(() => setIsArrowUp(false), []);\n\n const optionList =\n options &&\n options.map((option, index) => {\n return (\n <option key={index} value={option.value} className={style.selectOption}>\n {option.name}\n </option>\n );\n });\n\n const titleView = title ? <span className={style.title}>{title} </span> : null;\n\n const selected = useMemo(\n () =>\n multiple\n ? map(get('value'), filter({selected: true}, options))\n : get('value', find({selected: true}, options)),\n [multiple, options]\n );\n const selectedLabel = useMemo(\n () =>\n multiple\n ? map(get('name'), filter({selected: true}, options))\n : get('name', find({selected: true}, options)),\n [multiple, options]\n );\n\n const isSelectedInValidOption = useMemo(\n () =>\n theme === 'player' &&\n getOr(false, 'name', find({validOption: false, selected: true}, options)),\n [options, theme]\n );\n\n const handleChange = useMemo(\n () =>\n multiple\n ? e => {\n setIsArrowUp(false);\n onChange(map(get('value'), e.target.selectedOptions));\n }\n : e => {\n setIsArrowUp(false);\n onChange(e.target.value);\n },\n [onChange, multiple]\n );\n\n const black = useMemo(() => getOr('#14171A', 'common.black', skin), [skin]);\n const color = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const isThemeOneOfQuestionTemplateOrPlayer = useMemo(\n () => includes(theme, ['question', 'template', 'player']),\n [theme]\n );\n const shouldUseSkinFontColor = useMemo(\n () => !isSelectedInValidOption && selected && isThemeOneOfQuestionTemplateOrPlayer,\n [isSelectedInValidOption, selected, isThemeOneOfQuestionTemplateOrPlayer]\n );\n const arrowColor = selected ? color : undefined;\n\n const behaviorClassName = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [error, modified]\n );\n const composedClassName = useMemo(\n () =>\n classnames(\n theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName,\n selected ? style.selected : style.unselected,\n className\n ),\n [behaviorClassName, className, selected, theme]\n );\n\n const labelSize = useMemo(() => size(selectedLabel), [selectedLabel]);\n\n const isLongLabel = useMemo(() => labelSize >= 65, [labelSize]);\n\n return (\n <div\n className={classnames(\n composedClassName,\n theme === 'coorpmanager' ? style.coorpmanager : null\n )}\n >\n <label\n data-name=\"select-wrapper\"\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n className={style.selectWrapper}\n >\n {titleView}\n <span\n data-name=\"select-span\"\n className={classnames(\n style.selectSpan,\n includes(theme, ['player', 'invalid', 'question', 'thematiques', 'template'])\n ? style.noLabelCommon\n : null,\n borderClassName,\n isLongLabel ? style.longLabel : null\n )}\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n >\n {selectedLabel}\n </span>\n <ArrowView\n shouldRender={!multiple}\n isArrowUp={isArrowUp}\n ariaLabel={ariaLabel}\n arrowClass={shouldUseSkinFontColor ? style.selectedArrow : style.arrow}\n arrowColor={isThemeOneOfQuestionTemplateOrPlayer ? arrowColor : black}\n />\n <select\n data-name=\"native-select\"\n className={style.selectBox}\n title={selectedLabel}\n name={name}\n onChange={handleChange}\n value={selected}\n multiple={multiple}\n disabled={disabled}\n onClick={handleSelectOnFocus}\n onBlur={handleSelectOnBlur}\n // onBlur does not handle completely an out of bounds click\n // ex: select is Opened and a click is done outside, cancelling the select\n // that doesn't count as a Blur, so an onMouseLeave is needed\n onMouseLeave={handleSelectOnBlur}\n data-testid=\"native-select\"\n >\n {optionList}\n </select>\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n};\n\nexport const SelectOptionPropTypes = {\n name: PropTypes.string.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n selected: PropTypes.bool,\n validOption: PropTypes.bool\n};\n\nSelect.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nSelect.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n className: PropTypes.string,\n borderClassName: PropTypes.string,\n disabled: PropTypes.bool,\n multiple: PropTypes.bool,\n description: PropTypes.string,\n required: PropTypes.bool,\n onChange: PropTypes.func,\n theme: PropTypes.oneOf(keys(themeStyle)),\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes)),\n modified: PropTypes.bool,\n error: PropTypes.bool,\n 'aria-label': PropTypes.string\n};\n\nexport default Select;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,EAAqCC,QAArC,QAAoD,OAApD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,MAAP,MAAmB,kBAAnB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,SACEC,kCAAkC,IAAIC,SADxC,EAEEC,iCAAiC,IAAIC,OAFvC,QAGO,0BAHP;AAIA,OAAOC,QAAP,IAAkBC,kBAAlB,QAA2C,aAA3C;AACA,OAAO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B,CAAlB,CAXQ;EAYjBvC,QAAQ,EAAEhD,SAAS,CAAC4F,IAZH;EAajB3C,KAAK,EAAEjD,SAAS,CAAC4F,IAbA;EAcjB,cAAc5F,SAAS,CAACwF;AAdP,CAAnB;AAiBA,eAAenD,MAAf"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/answer/index.js"],"names":[],"mappings":";AA4EA,iDASC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/answer/index.js"],"names":[],"mappings":";AAuEA,iDASC"}
@@ -14,7 +14,6 @@ import Qcm from '../questions/qcm';
14
14
  import QcmGraphic from '../questions/qcm-graphic';
15
15
  import QuestionRange from '../questions/question-range';
16
16
  import Template from '../questions/template';
17
- import Provider from '../../atom/provider';
18
17
  import Audio from '../audio';
19
18
  import style from './style.css';
20
19
  import propTypes, { MediaViewPropTypes, TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO } from './prop-types';
@@ -64,8 +63,6 @@ MediaView.propTypes = process.env.NODE_ENV !== "production" ? MediaViewPropTypes
64
63
  const Switch = ({
65
64
  model,
66
65
  help
67
- }, {
68
- translate
69
66
  }) => {
70
67
  const {
71
68
  type
@@ -87,9 +84,7 @@ const Switch = ({
87
84
  return /*#__PURE__*/React.createElement(FreeText, model);
88
85
 
89
86
  case 'dropDown':
90
- return /*#__PURE__*/React.createElement(DropDown, _extends({}, model, {
91
- "aria-label": translate('drop_down_icon')
92
- }));
87
+ return /*#__PURE__*/React.createElement(DropDown, model);
93
88
 
94
89
  case 'slider':
95
90
  return /*#__PURE__*/React.createElement(QuestionRange, model);
@@ -103,9 +98,6 @@ Switch.propTypes = process.env.NODE_ENV !== "production" ? {
103
98
  model: propTypes.model,
104
99
  help: propTypes.help
105
100
  } : {};
106
- Switch.contextTypes = {
107
- translate: Provider.childContextTypes.translate
108
- };
109
101
 
110
102
  const Answer = props => {
111
103
  const {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","VideoPlayer","DropDown","FreeText","QcmDrag","Qcm","QcmGraphic","QuestionRange","Template","Provider","Audio","style","propTypes","MediaViewPropTypes","TYPE_AUDIO","TYPE_IMAGE","TYPE_VIDEO","MediaView","media","videoId","type","childProps","backgroundImage","url","video","audio","Switch","model","help","translate","contextTypes","childContextTypes","Answer","props","wrapper"],"sources":["../../../src/molecule/answer/index.js"],"sourcesContent":["import React from 'react';\nimport {omit} from 'lodash/fp';\nimport VideoPlayer from '../video-player';\nimport DropDown from '../questions/drop-down';\nimport FreeText from '../questions/free-text';\nimport QcmDrag from '../questions/qcm-drag';\nimport Qcm from '../questions/qcm';\nimport QcmGraphic from '../questions/qcm-graphic';\nimport QuestionRange from '../questions/question-range';\nimport Template from '../questions/template';\nimport Provider from '../../atom/provider';\nimport Audio from '../audio';\nimport style from './style.css';\nimport propTypes, {MediaViewPropTypes, TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from './prop-types';\n\nconst MediaView = ({media}) => {\n const {videoId, type, ...childProps} = media;\n switch (type) {\n case TYPE_IMAGE:\n return (\n <div\n className={style.media}\n style={{\n backgroundImage: `url(${media.url})`\n }}\n />\n );\n case TYPE_VIDEO:\n return (\n <div className={style.video}>\n <VideoPlayer {...omit('id', childProps)} id={videoId} height=\"100%\" width=\"100%\" />\n </div>\n );\n case TYPE_AUDIO:\n return (\n <div className={style.audio}>\n <Audio {...omit('id', childProps)} height=\"100%\" width=\"100%\" />\n </div>\n );\n default:\n return null;\n }\n};\n\nMediaView.propTypes = MediaViewPropTypes;\n\nconst Switch = ({model, help}, {translate}) => {\n const {type} = model;\n\n switch (type) {\n case 'qcmDrag':\n return <QcmDrag {...model} help={help} />;\n case 'qcm':\n return <Qcm {...model} />;\n case 'qcmGraphic':\n return <QcmGraphic {...model} />;\n case 'freeText':\n return <FreeText {...model} />;\n case 'dropDown':\n return <DropDown {...model} aria-label={translate('drop_down_icon')} />;\n case 'slider':\n return <QuestionRange {...model} />;\n case 'template':\n return <Template {...model} />;\n }\n};\n\nSwitch.propTypes = {\n model: propTypes.model,\n help: propTypes.help\n};\n\nSwitch.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nconst Answer = props => {\n const {model, media, help} = props;\n\n return (\n <div data-name=\"answer\" className={style.wrapper}>\n {media ? <MediaView media={media} /> : null}\n <Switch model={model} help={help} />\n </div>\n );\n};\n\nAnswer.propTypes = propTypes;\n\nexport default Answer;\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,OAAP,MAAoB,uBAApB;AACA,OAAOC,GAAP,MAAgB,kBAAhB;AACA,OAAOC,UAAP,MAAuB,0BAAvB;AACA,OAAOC,aAAP,MAA0B,6BAA1B;AACA,OAAOC,QAAP,MAAqB,uBAArB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,SAAP,IAAmBC,kBAAnB,EAAuCC,UAAvC,EAAmDC,UAAnD,EAA+DC,UAA/D,QAAgF,cAAhF;;AAEA,MAAMC,SAAS,GAAG,CAAC;EAACC;AAAD,CAAD,KAAa;EAC7B,MAAM;IAACC,OAAD;IAAUC;EAAV,IAAiCF,KAAvC;EAAA,MAAyBG,UAAzB,iCAAuCH,KAAvC;;EACA,QAAQE,IAAR;IACE,KAAKL,UAAL;MACE,oBACE;QACE,SAAS,EAAEJ,KAAK,CAACO,KADnB;QAEE,KAAK,EAAE;UACLI,eAAe,EAAG,OAAMJ,KAAK,CAACK,GAAI;QAD7B;MAFT,EADF;;IAQF,KAAKP,UAAL;MACE,oBACE;QAAK,SAAS,EAAEL,KAAK,CAACa;MAAtB,gBACE,oBAAC,WAAD,eAAiB,MAAK,IAAL,EAAWH,UAAX,CAAjB;Q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pB,QAAQ,CAACsB,iBAAT,CAA2BF;AADlB,CAAtB;;AAIA,MAAMG,MAAM,GAAGC,KAAK,IAAI;EACtB,MAAM;IAACN,KAAD;IAAQT,KAAR;IAAeU;EAAf,IAAuBK,KAA7B;EAEA,oBACE;IAAK,aAAU,QAAf;IAAwB,SAAS,EAAEtB,KAAK,CAACuB;EAAzC,GACGhB,KAAK,gBAAG,oBAAC,SAAD;IAAW,KAAK,EAAEA;EAAlB,EAAH,GAAiC,IADzC,eAEE,oBAAC,MAAD;IAAQ,KAAK,EAAES,KAAf;IAAsB,IAAI,EAAEC;EAA5B,EAFF,CADF;AAMD,CATD;;AAWAI,MAAM,CAACpB,SAAP,2CAAmBA,SAAnB;AAEA,eAAeoB,MAAf"}
1
+ {"version":3,"file":"index.js","names":["React","VideoPlayer","DropDown","FreeText","QcmDrag","Qcm","QcmGraphic","QuestionRange","Template","Audio","style","propTypes","MediaViewPropTypes","TYPE_AUDIO","TYPE_IMAGE","TYPE_VIDEO","MediaView","media","videoId","type","childProps","backgroundImage","url","video","audio","Switch","model","help","Answer","props","wrapper"],"sources":["../../../src/molecule/answer/index.js"],"sourcesContent":["import React from 'react';\nimport {omit} from 'lodash/fp';\nimport VideoPlayer from '../video-player';\nimport DropDown from '../questions/drop-down';\nimport FreeText from '../questions/free-text';\nimport QcmDrag from '../questions/qcm-drag';\nimport Qcm from '../questions/qcm';\nimport QcmGraphic from '../questions/qcm-graphic';\nimport QuestionRange from '../questions/question-range';\nimport Template from '../questions/template';\nimport Audio from '../audio';\nimport style from './style.css';\nimport propTypes, {MediaViewPropTypes, TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from './prop-types';\n\nconst MediaView = ({media}) => {\n const {videoId, type, ...childProps} = media;\n switch (type) {\n case TYPE_IMAGE:\n return (\n <div\n className={style.media}\n style={{\n backgroundImage: `url(${media.url})`\n }}\n />\n );\n case TYPE_VIDEO:\n return (\n <div className={style.video}>\n <VideoPlayer {...omit('id', childProps)} id={videoId} height=\"100%\" width=\"100%\" />\n </div>\n );\n case TYPE_AUDIO:\n return (\n <div className={style.audio}>\n <Audio {...omit('id', childProps)} height=\"100%\" width=\"100%\" />\n </div>\n );\n default:\n return null;\n }\n};\n\nMediaView.propTypes = MediaViewPropTypes;\n\nconst Switch = ({model, help}) => {\n const {type} = model;\n\n switch (type) {\n case 'qcmDrag':\n return <QcmDrag {...model} help={help} />;\n case 'qcm':\n return <Qcm {...model} />;\n case 'qcmGraphic':\n return <QcmGraphic {...model} />;\n case 'freeText':\n return <FreeText {...model} />;\n case 'dropDown':\n return <DropDown {...model} />;\n case 'slider':\n return <QuestionRange {...model} />;\n case 'template':\n return <Template {...model} />;\n }\n};\n\nSwitch.propTypes = {\n model: propTypes.model,\n help: propTypes.help\n};\n\nconst Answer = props => {\n const {model, media, help} = props;\n\n return (\n <div data-name=\"answer\" className={style.wrapper}>\n {media ? <MediaView media={media} /> : null}\n <Switch model={model} help={help} />\n </div>\n );\n};\n\nAnswer.propTypes = propTypes;\n\nexport default Answer;\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,OAAP,MAAoB,uBAApB;AACA,OAAOC,GAAP,MAAgB,kBAAhB;AACA,OAAOC,UAAP,MAAuB,0BAAvB;AACA,OAAOC,aAAP,MAA0B,6BAA1B;AACA,OAAOC,QAAP,MAAqB,uBAArB;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,SAAP,IAAmBC,kBAAnB,EAAuCC,UAAvC,EAAmDC,UAAnD,EAA+DC,UAA/D,QAAgF,cAAhF;;AAEA,MAAMC,SAAS,GAAG,CAAC;EAACC;AAAD,CAAD,KAAa;EAC7B,MAAM;IAACC,OAAD;IAAUC;EAAV,IAAiCF,KAAvC;EAAA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AP;;IACF,KAAK,UAAL;MACE,oBAAO,oBAAC,QAAD,EAAcA,KAAd,CAAP;EAdJ;AAgBD,CAnBD;;AAqBAD,MAAM,CAACd,SAAP,2CAAmB;EACjBe,KAAK,EAAEf,SAAS,CAACe,KADA;EAEjBC,IAAI,EAAEhB,SAAS,CAACgB;AAFC,CAAnB;;AAKA,MAAMC,MAAM,GAAGC,KAAK,IAAI;EACtB,MAAM;IAACH,KAAD;IAAQT,KAAR;IAAeU;EAAf,IAAuBE,KAA7B;EAEA,oBACE;IAAK,aAAU,QAAf;IAAwB,SAAS,EAAEnB,KAAK,CAACoB;EAAzC,GACGb,KAAK,gBAAG,oBAAC,SAAD;IAAW,KAAK,EAAEA;EAAlB,EAAH,GAAiC,IADzC,eAEE,oBAAC,MAAD;IAAQ,KAAK,EAAES,KAAf;IAAsB,IAAI,EAAEC;EAA5B,EAFF,CADF;AAMD,CATD;;AAWAC,MAAM,CAACjB,SAAP,2CAAmBA,SAAnB;AAEA,eAAeiB,MAAf"}
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ import { Props } from './types';
3
+ declare const EmptyStateDashboard: {
4
+ ({ mainText, subText, imageUrl, buttonLink }: Props): JSX.Element;
5
+ propTypes: {
6
+ mainText: import("prop-types").Requireable<string>;
7
+ subText: import("prop-types").Requireable<string>;
8
+ imageUrl: import("prop-types").Requireable<any>;
9
+ buttonLink: import("prop-types").Requireable<import("prop-types").InferProps<{
10
+ type: import("prop-types").Requireable<string>;
11
+ label: import("prop-types").Requireable<string>;
12
+ ariaLabel: import("prop-types").Requireable<string>;
13
+ dataName: import("prop-types").Requireable<string>;
14
+ icon: import("prop-types").Requireable<import("prop-types").InferProps<{
15
+ position: import("prop-types").Requireable<string>;
16
+ type: import("prop-types").Requireable<string>;
17
+ }>>;
18
+ onClick: import("prop-types").Requireable<(...args: any[]) => any>;
19
+ }>>;
20
+ };
21
+ };
22
+ export default EmptyStateDashboard;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/empty-state-dashboard/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,KAAK,EAAY,MAAM,SAAS,CAAC;AAEzC,QAAA,MAAM,mBAAmB;kDAA+C,KAAK;;;;;;;;;;;;;;;;;CAW5E,CAAC;AAIF,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,31 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import React from 'react';
4
+ import ButtonLink from '../../atom/button-link';
5
+ import style from './style.css';
6
+ import { propTypes } from './types';
7
+
8
+ const EmptyStateDashboard = ({
9
+ mainText,
10
+ subText,
11
+ imageUrl,
12
+ buttonLink
13
+ }) => /*#__PURE__*/React.createElement("div", {
14
+ className: style.container
15
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("img", {
16
+ className: style.img,
17
+ src: imageUrl,
18
+ "aria-hidden": "true"
19
+ })), /*#__PURE__*/React.createElement("p", {
20
+ className: style.mainText
21
+ }, mainText), /*#__PURE__*/React.createElement("p", {
22
+ className: style.subText
23
+ }, subText), /*#__PURE__*/React.createElement("div", {
24
+ className: style.buttonContainer
25
+ }, /*#__PURE__*/React.createElement(ButtonLink, _extends({}, buttonLink, {
26
+ className: style.button
27
+ }))));
28
+
29
+ EmptyStateDashboard.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
30
+ export default EmptyStateDashboard;
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["React","ButtonLink","style","propTypes","EmptyStateDashboard","mainText","subText","imageUrl","buttonLink","container","img","buttonContainer","button"],"sources":["../../../src/molecule/empty-state-dashboard/index.tsx"],"sourcesContent":["import React from 'react';\nimport ButtonLink from '../../atom/button-link';\nimport style from './style.css';\nimport {Props, propTypes} from './types';\n\nconst EmptyStateDashboard = ({mainText, subText, imageUrl, buttonLink}: Props) => (\n <div className={style.container}>\n <div>\n <img className={style.img} src={imageUrl} aria-hidden=\"true\" />\n </div>\n <p className={style.mainText}>{mainText}</p>\n <p className={style.subText}>{subText}</p>\n <div className={style.buttonContainer}>\n <ButtonLink {...buttonLink} className={style.button} />\n </div>\n </div>\n);\n\nEmptyStateDashboard.propTypes = propTypes;\n\nexport default EmptyStateDashboard;\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,SAAeC,SAAf,QAA+B,SAA/B;;AAEA,MAAMC,mBAAmB,GAAG,CAAC;EAACC,QAAD;EAAWC,OAAX;EAAoBC,QAApB;EAA8BC;AAA9B,CAAD,kBAC1B;EAAK,SAAS,EAAEN,KAAK,CAACO;AAAtB,gBACE,8CACE;EAAK,SAAS,EAAEP,KAAK,CAACQ,GAAtB;EAA2B,GAAG,EAAEH,QAAhC;EAA0C,eAAY;AAAtD,EADF,CADF,eAIE;EAAG,SAAS,EAAEL,KAAK,CAACG;AAApB,GAA+BA,QAA/B,CAJF,eAKE;EAAG,SAAS,EAAEH,KAAK,CAACI;AAApB,GAA8BA,OAA9B,CALF,eAME;EAAK,SAAS,EAAEJ,KAAK,CAACS;AAAtB,gBACE,oBAAC,UAAD,eAAgBH,UAAhB;EAA4B,SAAS,EAAEN,KAAK,CAACU;AAA7C,GADF,CANF,CADF;;AAaAR,mBAAmB,CAACD,SAApB,2CAAgCA,SAAhC;AAEA,eAAeC,mBAAf"}
@@ -0,0 +1,55 @@
1
+ @value colors: "../../variables/colors.css";
2
+ @value cm_grey_500: from colors;
3
+ @value cm_grey_800: from colors;
4
+
5
+
6
+ .container {
7
+ display: flex;
8
+ flex-direction: column;
9
+ height: 100%;
10
+ justify-content: center;
11
+ overflow: hidden;
12
+ text-align: center;
13
+ width: 100%;
14
+ }
15
+
16
+ .img {
17
+ height: 170px;
18
+ width: 220px;
19
+ }
20
+
21
+ .text {
22
+ font-family: 'Gilroy';
23
+ margin: 0 auto 0 auto;
24
+ }
25
+
26
+ .mainText {
27
+ composes: text;
28
+ color: cm_grey_800;
29
+ font-weight: 600;
30
+ font-size: 24px;
31
+ line-height: 32px;
32
+ padding-top: 36px;
33
+ }
34
+
35
+ .subText {
36
+ composes: text;
37
+ color: cm_grey_500;
38
+ font-weight: 400;
39
+ font-size: 16px;
40
+ line-height: 24px;
41
+ padding-top: 4px;
42
+ ;
43
+ }
44
+
45
+ .buttonContainer {
46
+ display: flex;
47
+ justify-content: center;
48
+ padding-top: 32px;
49
+ width: 100%;
50
+ }
51
+
52
+ .button {
53
+ width: 152px;
54
+ height: 44px;
55
+ }
@@ -0,0 +1,19 @@
1
+ import PropTypes from 'prop-types';
2
+ export declare const propTypes: {
3
+ mainText: PropTypes.Requireable<string>;
4
+ subText: PropTypes.Requireable<string>;
5
+ imageUrl: PropTypes.Requireable<any>;
6
+ buttonLink: PropTypes.Requireable<PropTypes.InferProps<{
7
+ type: PropTypes.Requireable<string>;
8
+ label: PropTypes.Requireable<string>;
9
+ ariaLabel: PropTypes.Requireable<string>;
10
+ dataName: PropTypes.Requireable<string>;
11
+ icon: PropTypes.Requireable<PropTypes.InferProps<{
12
+ position: PropTypes.Requireable<string>;
13
+ type: PropTypes.Requireable<string>;
14
+ }>>;
15
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
16
+ }>>;
17
+ };
18
+ export declare type Props = PropTypes.InferProps<typeof propTypes>;
19
+ //# sourceMappingURL=types.d.ts.map