@pagopa/io-app-design-system 3.0.0 → 3.1.0

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 (62) hide show
  1. package/lib/commonjs/components/codeInput/CodeInput.js +41 -21
  2. package/lib/commonjs/components/codeInput/CodeInput.js.map +1 -1
  3. package/lib/commonjs/components/index.js +11 -0
  4. package/lib/commonjs/components/index.js.map +1 -1
  5. package/lib/commonjs/components/layout/HeaderSecondLevel.js +2 -2
  6. package/lib/commonjs/components/layout/HeaderSecondLevel.js.map +1 -1
  7. package/lib/commonjs/components/tooltip/Arrows.js +49 -0
  8. package/lib/commonjs/components/tooltip/Arrows.js.map +1 -0
  9. package/lib/commonjs/components/tooltip/Tooltip.js +174 -0
  10. package/lib/commonjs/components/tooltip/Tooltip.js.map +1 -0
  11. package/lib/commonjs/components/tooltip/index.js +17 -0
  12. package/lib/commonjs/components/tooltip/index.js.map +1 -0
  13. package/lib/commonjs/components/tooltip/styles.js +50 -0
  14. package/lib/commonjs/components/tooltip/styles.js.map +1 -0
  15. package/lib/commonjs/components/tooltip/utils/index.js +180 -0
  16. package/lib/commonjs/components/tooltip/utils/index.js.map +1 -0
  17. package/lib/commonjs/components/tooltip/utils/types.js +2 -0
  18. package/lib/commonjs/components/tooltip/utils/types.js.map +1 -0
  19. package/lib/module/components/codeInput/CodeInput.js +43 -23
  20. package/lib/module/components/codeInput/CodeInput.js.map +1 -1
  21. package/lib/module/components/index.js +1 -0
  22. package/lib/module/components/index.js.map +1 -1
  23. package/lib/module/components/layout/HeaderSecondLevel.js +2 -2
  24. package/lib/module/components/layout/HeaderSecondLevel.js.map +1 -1
  25. package/lib/module/components/tooltip/Arrows.js +36 -0
  26. package/lib/module/components/tooltip/Arrows.js.map +1 -0
  27. package/lib/module/components/tooltip/Tooltip.js +165 -0
  28. package/lib/module/components/tooltip/Tooltip.js.map +1 -0
  29. package/lib/module/components/tooltip/index.js +2 -0
  30. package/lib/module/components/tooltip/index.js.map +1 -0
  31. package/lib/module/components/tooltip/styles.js +43 -0
  32. package/lib/module/components/tooltip/styles.js.map +1 -0
  33. package/lib/module/components/tooltip/utils/index.js +163 -0
  34. package/lib/module/components/tooltip/utils/index.js.map +1 -0
  35. package/lib/module/components/tooltip/utils/types.js +2 -0
  36. package/lib/module/components/tooltip/utils/types.js.map +1 -0
  37. package/lib/typescript/components/codeInput/CodeInput.d.ts.map +1 -1
  38. package/lib/typescript/components/index.d.ts +1 -0
  39. package/lib/typescript/components/index.d.ts.map +1 -1
  40. package/lib/typescript/components/layout/HeaderSecondLevel.d.ts.map +1 -1
  41. package/lib/typescript/components/tooltip/Arrows.d.ts +14 -0
  42. package/lib/typescript/components/tooltip/Arrows.d.ts.map +1 -0
  43. package/lib/typescript/components/tooltip/Tooltip.d.ts +64 -0
  44. package/lib/typescript/components/tooltip/Tooltip.d.ts.map +1 -0
  45. package/lib/typescript/components/tooltip/index.d.ts +2 -0
  46. package/lib/typescript/components/tooltip/index.d.ts.map +1 -0
  47. package/lib/typescript/components/tooltip/styles.d.ts +41 -0
  48. package/lib/typescript/components/tooltip/styles.d.ts.map +1 -0
  49. package/lib/typescript/components/tooltip/utils/index.d.ts +89 -0
  50. package/lib/typescript/components/tooltip/utils/index.d.ts.map +1 -0
  51. package/lib/typescript/components/tooltip/utils/types.d.ts +10 -0
  52. package/lib/typescript/components/tooltip/utils/types.d.ts.map +1 -0
  53. package/package.json +1 -1
  54. package/src/components/codeInput/CodeInput.tsx +53 -30
  55. package/src/components/index.tsx +1 -0
  56. package/src/components/layout/HeaderSecondLevel.tsx +6 -9
  57. package/src/components/tooltip/Arrows.tsx +36 -0
  58. package/src/components/tooltip/Tooltip.tsx +313 -0
  59. package/src/components/tooltip/index.ts +1 -0
  60. package/src/components/tooltip/styles.ts +44 -0
  61. package/src/components/tooltip/utils/index.ts +179 -0
  62. package/src/components/tooltip/utils/types.ts +9 -0
@@ -0,0 +1,43 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { IOColors } from '../../core';
3
+ export const tooltipStyles = StyleSheet.create({
4
+ overlay: {
5
+ position: "absolute",
6
+ width: "100%",
7
+ height: "100%",
8
+ backgroundColor: IOColors["grey-850"],
9
+ opacity: 0.6,
10
+ zIndex: 997
11
+ },
12
+ childrenContainer: {
13
+ position: "absolute",
14
+ zIndex: 1000
15
+ },
16
+ tooltipContainer: {
17
+ position: "absolute",
18
+ paddingHorizontal: 16,
19
+ paddingVertical: 16,
20
+ backgroundColor: IOColors.white,
21
+ borderRadius: 8,
22
+ zIndex: 2000,
23
+ overflow: "visible"
24
+ },
25
+ arrowContainer: {
26
+ position: "absolute",
27
+ display: 'flex',
28
+ zIndex: 3000
29
+ },
30
+ closeIcon: {
31
+ position: 'absolute',
32
+ right: 8,
33
+ top: 9 // It's been used `9` instead of `8` to fix accessibility focus order. In this way title is read before close icon.
34
+ }
35
+ });
36
+
37
+ export const getChildrenPosition = childrenCoords => ({
38
+ top: childrenCoords.y,
39
+ left: childrenCoords.x,
40
+ width: childrenCoords.width,
41
+ height: childrenCoords.height
42
+ });
43
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StyleSheet","IOColors","tooltipStyles","create","overlay","position","width","height","backgroundColor","opacity","zIndex","childrenContainer","tooltipContainer","paddingHorizontal","paddingVertical","white","borderRadius","overflow","arrowContainer","display","closeIcon","right","top","getChildrenPosition","childrenCoords","y","left","x"],"sourceRoot":"../../../../src","sources":["components/tooltip/styles.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,QAAQ,QAAQ,YAAY;AAGrC,OAAO,MAAMC,aAAa,GAAGF,UAAU,CAACG,MAAM,CAAC;EAC7CC,OAAO,EAAE;IACPC,QAAQ,EAAE,UAAU;IACpBC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdC,eAAe,EAAEP,QAAQ,CAAC,UAAU,CAAC;IACrCQ,OAAO,EAAE,GAAG;IACZC,MAAM,EAAE;EACV,CAAC;EACDC,iBAAiB,EAAE;IACjBN,QAAQ,EAAE,UAAU;IACpBK,MAAM,EAAE;EACV,CAAC;EACDE,gBAAgB,EAAE;IAChBP,QAAQ,EAAE,UAAU;IACpBQ,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBN,eAAe,EAAEP,QAAQ,CAACc,KAAK;IAC/BC,YAAY,EAAE,CAAC;IACfN,MAAM,EAAE,IAAI;IACZO,QAAQ,EAAE;EACZ,CAAC;EACDC,cAAc,EAAE;IACdb,QAAQ,EAAE,UAAU;IACpBc,OAAO,EAAE,MAAM;IACfT,MAAM,EAAE;EACV,CAAC;EACDU,SAAS,EAAE;IACTf,QAAQ,EAAE,UAAU;IACpBgB,KAAK,EAAE,CAAC;IACRC,GAAG,EAAE,CAAC,CAAC;EACT;AACF,CAAC,CAAC;;AAEF,OAAO,MAAMC,mBAAmB,GAAIC,cAA8B,KAAM;EACtEF,GAAG,EAAEE,cAAc,CAACC,CAAC;EACrBC,IAAI,EAAEF,cAAc,CAACG,CAAC;EACtBrB,KAAK,EAAEkB,cAAc,CAAClB,KAAK;EAC3BC,MAAM,EAAEiB,cAAc,CAACjB;AACzB,CAAC,CAAC"}
@@ -0,0 +1,163 @@
1
+ import { IOVisualCostants } from '../../../core';
2
+ export const ARROW_WIDTH = 24;
3
+ export const ARROW_HEIGHT = 14;
4
+ export const EMPTY_SPACE = 8;
5
+ const DEFAULT_INSETS = {
6
+ top: 0,
7
+ bottom: 0,
8
+ left: IOVisualCostants.appMarginDefault,
9
+ right: IOVisualCostants.appMarginDefault
10
+ };
11
+
12
+ /**
13
+ * @param displayInsets custom display insets
14
+ * @returns An `object` based on `DEFAULT_INSETS` and `displayInsets`
15
+ */
16
+ export const getDisplayInsets = displayInsets => ({
17
+ ...DEFAULT_INSETS,
18
+ ...displayInsets
19
+ });
20
+
21
+ /**
22
+ *
23
+ * @param placement The `Tooltip` placement
24
+ * @returns The `Arrow` box `width` and `height` based on `placement` value
25
+ */
26
+ export const getArrowBoxByPlacement = placement => {
27
+ switch (placement) {
28
+ case 'left':
29
+ case 'right':
30
+ return {
31
+ width: ARROW_HEIGHT,
32
+ height: ARROW_WIDTH
33
+ };
34
+ default:
35
+ return {
36
+ height: ARROW_HEIGHT,
37
+ width: ARROW_WIDTH
38
+ };
39
+ }
40
+ };
41
+
42
+ /**
43
+ * A utility function to calculate the `Tooltip` coordinates and dimensions
44
+ * @param placement The `Tooltip` placement in relation of its children
45
+ * @param childrenCoords The measures in screen of the `Tooltip` children
46
+ * @param displayInsets The active display insets
47
+ * @param screenDimensions The dimensions of the device screen
48
+ * @returns The `Tooltip` coordinates
49
+ */
50
+ export const getTooltipCoords = (placement, childrenCoords, displayInsets, screenDimensions) => {
51
+ const {
52
+ width: screenWidth,
53
+ height: screenHeight
54
+ } = screenDimensions;
55
+ switch (placement) {
56
+ case "top":
57
+ return {
58
+ bottom: screenHeight - childrenCoords.y + ARROW_HEIGHT + EMPTY_SPACE,
59
+ left: displayInsets.left,
60
+ width: screenWidth - displayInsets.left - displayInsets.right
61
+ };
62
+ case "bottom":
63
+ return {
64
+ top: childrenCoords.y + childrenCoords.height + ARROW_HEIGHT + EMPTY_SPACE,
65
+ left: displayInsets.left,
66
+ width: screenWidth - displayInsets.left - displayInsets.right
67
+ };
68
+ case "left":
69
+ return {
70
+ top: childrenCoords.y,
71
+ left: displayInsets.left,
72
+ width: screenWidth - (screenWidth - childrenCoords.x) - ARROW_HEIGHT - displayInsets.left - EMPTY_SPACE
73
+ };
74
+ case "right":
75
+ const elementSize = childrenCoords.width + childrenCoords.x + ARROW_HEIGHT + EMPTY_SPACE;
76
+ return {
77
+ top: childrenCoords.y,
78
+ left: elementSize,
79
+ width: screenWidth - (elementSize + displayInsets.right)
80
+ };
81
+ // TODO: provide a default center position in case of Tooltip without children
82
+ default:
83
+ return {};
84
+ }
85
+ };
86
+
87
+ /**
88
+ * A utility function to calculate the `Tooltip`'s `Arrow` coordinates
89
+ * @param placement The `Arrow` placement in relation of the `Tooltip` children
90
+ * @param childrenCoords The measures in screen of the `Tooltip` children
91
+ * @param screenDimensions The active display insets
92
+ * @returns The `Tooltip`'s Arrow coordinates
93
+ */
94
+ export const getArrowCoords = (placement, childrenCoords, screenDimensions) => {
95
+ const {
96
+ width: screenWidth,
97
+ height: screenHeight
98
+ } = screenDimensions;
99
+ switch (placement) {
100
+ case "top":
101
+ return {
102
+ bottom: screenHeight - childrenCoords.y + EMPTY_SPACE,
103
+ left: childrenCoords.x + childrenCoords.width / 2 - ARROW_WIDTH / 2
104
+ };
105
+ case "bottom":
106
+ return {
107
+ top: childrenCoords.y + childrenCoords.height + EMPTY_SPACE,
108
+ left: childrenCoords.x + childrenCoords.width / 2 - ARROW_WIDTH / 2
109
+ };
110
+ case "left":
111
+ return {
112
+ top: childrenCoords.y,
113
+ left: screenWidth - (screenWidth - childrenCoords.x) - ARROW_HEIGHT - EMPTY_SPACE - 1 // FIXME -> This `-1` is necessary because of the Svg size doesn't match the box size
114
+ };
115
+
116
+ case "right":
117
+ return {
118
+ top: childrenCoords.y,
119
+ left: childrenCoords.width + childrenCoords.x + EMPTY_SPACE
120
+ };
121
+ default:
122
+ // TODO: provide a default center position in case of Tooltip without children
123
+ return {};
124
+ }
125
+ };
126
+
127
+ /**
128
+ * A utility function to calculate the `Tooltip` vertical alignment
129
+ * @param placement The `Tooltip` placement in relation of its children
130
+ * @param childrenHeight The `Tooltip`'s children height
131
+ * @param tooltipHeight The `Tooltip`'s height
132
+ * @returns If placement is `left` or `right` it returns the vertical tranlsation to align the `Tooltip` center with its `children` center,
133
+ * otherwise `null` is returned
134
+ */
135
+ export const getTooltipVerticalAlignment = (placement, childrenHeight, tooltipHeight) => {
136
+ if ((placement === "left" || placement === "right") && tooltipHeight) {
137
+ return {
138
+ transform: [{
139
+ translateY: -tooltipHeight / 2 + childrenHeight / 2
140
+ }]
141
+ };
142
+ }
143
+ return null;
144
+ };
145
+
146
+ /**
147
+ * A utility function to calculate the `Arrow` vertical alignment
148
+ * @param placement The `Tooltip` placement in relation of its children
149
+ * @param childrenHeight The `Tooltip`'s children height
150
+ */
151
+ export const getArrowVerticalAlignment = (placement, childrenHeight) => {
152
+ if (placement === "left" || placement === "right") {
153
+ return {
154
+ transform: [{
155
+ translateY: -ARROW_WIDTH / 2 + childrenHeight / 2
156
+ }]
157
+ };
158
+ }
159
+ return null;
160
+ };
161
+ export const isDefined = v => v !== undefined;
162
+ export const isNotZero = v => v !== 0;
163
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IOVisualCostants","ARROW_WIDTH","ARROW_HEIGHT","EMPTY_SPACE","DEFAULT_INSETS","top","bottom","left","appMarginDefault","right","getDisplayInsets","displayInsets","getArrowBoxByPlacement","placement","width","height","getTooltipCoords","childrenCoords","screenDimensions","screenWidth","screenHeight","y","x","elementSize","getArrowCoords","getTooltipVerticalAlignment","childrenHeight","tooltipHeight","transform","translateY","getArrowVerticalAlignment","isDefined","v","undefined","isNotZero"],"sourceRoot":"../../../../../src","sources":["components/tooltip/utils/index.ts"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,eAAe;AAGhD,OAAO,MAAMC,WAAW,GAAG,EAAE;AAC7B,OAAO,MAAMC,YAAY,GAAG,EAAE;AAC9B,OAAO,MAAMC,WAAW,GAAG,CAAC;AAC5B,MAAMC,cAA6B,GAAG;EACpCC,GAAG,EAAE,CAAC;EACNC,MAAM,EAAE,CAAC;EACTC,IAAI,EAAEP,gBAAgB,CAACQ,gBAAgB;EACvCC,KAAK,EAAET,gBAAgB,CAACQ;AAC1B,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAME,gBAAgB,GAC3BC,aAAqC,KAClB;EAAE,GAAGP,cAAc;EAAE,GAAGO;AAAc,CAAC,CAAC;;AAE7D;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAIC,SAAoB,IAAK;EAC9D,QAAQA,SAAS;IACf,KAAK,M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AAC,CAAC;EACb;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMsB,2BAA2B,GAAGA,CAACZ,SAAoB,EAAEa,cAAsB,EAAEC,aAAsB,KAAK;EACnH,IAAI,CAACd,SAAS,KAAK,MAAM,IAAIA,SAAS,KAAK,OAAO,KAAKc,aAAa,EAAE;IACpE,OAAO;MACLC,SAAS,EAAE,CACT;QACEC,UAAU,EACR,CAACF,aAAa,GAAG,CAAC,GAAGD,cAAc,GAAG;MAC1C,CAAC;IAEL,CAAC;EACH;EACA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,yBAAyB,GAAGA,CAACjB,SAAoB,EAAEa,cAAsB,KAAK;EACzF,IAAIb,SAAS,KAAK,MAAM,IAAIA,SAAS,KAAK,OAAO,EAAE;IACjD,OAAO;MACLe,SAAS,EAAE,CACT;QACEC,UAAU,EACR,CAAC5B,WAAW,GAAG,CAAC,GAAGyB,cAAc,GAAG;MACxC,CAAC;IAEL,CAAC;EACH;EACA,OAAO,IAAI;AACb,CAAC;AAED,OAAO,MAAMK,SAAS,GAAOC,CAAI,IAAKA,CAAC,KAAKC,SAAS;AACrD,OAAO,MAAMC,SAAS,GAAIF,CAAS,IAAKA,CAAC,KAAK,CAAC"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["components/tooltip/utils/types.ts"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"CodeInput.d.ts","sourceRoot":"","sources":["../../../../src/components/codeInput/CodeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAQlD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B,CAAC;AA8BF,eAAO,MAAM,SAAS,0DAMnB,cAAc,sBA+ChB,CAAC"}
1
+ {"version":3,"file":"CodeInput.d.ts","sourceRoot":"","sources":["../../../../src/components/codeInput/CodeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B,CAAC;AA+BF,eAAO,MAAM,SAAS,0DAMnB,cAAc,sBAqEhB,CAAC"}
@@ -30,5 +30,6 @@ export * from "./tag";
30
30
  export * from "./textInput";
31
31
  export * from "./searchInput";
32
32
  export * from "./toast";
33
+ export * from "./tooltip";
33
34
  export * from "./typography";
34
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,a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AE,iBAAiB,CAAC;IAC/B,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB;AAED,UAAU,UAAW,SAAQ,WAAW;IACtC,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,YAAY,EAAE,iBAAiB,CAAC;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB;AAED,UAAU,YAAa,SAAQ,WAAW;IACxC,IAAI,EAAE,cAAc,CAAC;IACrB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,YAAY,EAAE,iBAAiB,CAAC;IAChC,WAAW,EAAE,iBAAiB,CAAC;CAChC;AAED,MAAM,MAAM,iBAAiB,GAAG,SAAS,GACvC,uBAAuB,GACvB,CAAC,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC,CAAC;AAoBjD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,kOAiB3B,iBAAiB,sBA0LnB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export declare const LeftArrow: ({ color }: {
3
+ color?: string;
4
+ }) => React.JSX.Element;
5
+ export declare const RightArrow: ({ color }: {
6
+ color?: string;
7
+ }) => React.JSX.Element;
8
+ export declare const BottomArrow: ({ color }: {
9
+ color?: string;
10
+ }) => React.JSX.Element;
11
+ export declare const TopArrow: ({ color }: {
12
+ color?: string;
13
+ }) => React.JSX.Element;
14
+ //# sourceMappingURL=Arrows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Arrows.d.ts","sourceRoot":"","sources":["../../../../src/components/tooltip/Arrows.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,SAAS,cAAgC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,sBAOvE,CAAC;AACF,eAAO,MAAM,UAAU,cAAgC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,sBAOxE,CAAC;AACF,eAAO,MAAM,WAAW,cAAgC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,sBAOzE,CAAC;AACF,eAAO,MAAM,QAAQ,cAAgC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,sBAOtE,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { PropsWithChildren, ReactElement } from "react";
2
+ import { DisplayInsets, Placement } from "./utils/types";
3
+ type CommonProps = {
4
+ /**
5
+ * The title text displayed at the top of the tooltip.
6
+ */
7
+ title: string;
8
+ /**
9
+ * The tooltip text content.
10
+ */
11
+ content: string;
12
+ /**
13
+ * Controls the visibility of the tooltip.
14
+ */
15
+ isVisible: boolean;
16
+ /**
17
+ * Initial tooltip position; can be 'top', 'bottom', 'left', or 'right'.
18
+ * @default top
19
+ */
20
+ placement?: Placement;
21
+ /**
22
+ * Insets for adjusting tooltip position within screen boundaries.
23
+ * @default {}
24
+ */
25
+ displayInsets?: Partial<DisplayInsets>;
26
+ /**
27
+ * Accessibility label for the close icon button.
28
+ */
29
+ closeIconAccessibilityLabel: string;
30
+ /**
31
+ * Determines whether interactions with the tooltip's children are allowed when `isVisible` is set to true.
32
+ * @default false
33
+ */
34
+ childrenInteractionsEnabled?: boolean;
35
+ /**
36
+ * Callback function triggered when the tooltip is closed.
37
+ */
38
+ onClose: () => void;
39
+ };
40
+ type CloseWithTapOnBackground = {
41
+ /**
42
+ * Allows closing the tooltip by tapping outside of it.
43
+ */
44
+ allowCloseOnBackgroundTap: true;
45
+ /**
46
+ * Accessibility label for the tooltip background mask.
47
+ */
48
+ backgroundAccessibilityLabel: string;
49
+ };
50
+ type CloseWithBackgroundTapDisabled = {
51
+ allowCloseOnBackgroundTap?: false;
52
+ };
53
+ type Props = CommonProps & (CloseWithTapOnBackground | CloseWithBackgroundTapDisabled);
54
+ /**
55
+ * Tooltip component that displays a contextual tooltip around its children.
56
+ * The tooltip position is controlled by the `placement` prop and can adjust
57
+ * dynamically if there is insufficient space.
58
+ * @param {Props} props - The component props
59
+ *
60
+ * @returns {ReactElement} A tooltip component rendered around the specified children.
61
+ */
62
+ export declare const Tooltip: ({ children, title, content, placement: initialPlacement, closeIconAccessibilityLabel, isVisible, displayInsets, allowCloseOnBackgroundTap, childrenInteractionsEnabled, onClose }: PropsWithChildren<Props>) => ReactElement;
63
+ export {};
64
+ //# sourceMappingURL=Tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAc,EAGZ,iBAAiB,EAKjB,YAAY,EACb,MAAM,OAAO,CAAC;AA2Bf,OAAO,EAEL,aAAa,EACb,SAAS,EAEV,MAAM,eAAe,CAAC;AAmBvB,KAAK,WAAW,GAAG;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACvC;;OAEG;IACH,2BAA2B,EAAE,MAAM,CAAC;IACpC;;;OAGG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AACF,KAAK,wBAAwB,GAAG;IAC9B;;OAEG;IACH,yBAAyB,EAAE,IAAI,CAAC;IAChC;;OAEG;IACH,4BAA4B,EAAE,MAAM,CAAC;CACtC,CAAC;AACF,KAAK,8BAA8B,GAAG;IACpC,yBAAyB,CAAC,EAAE,KAAK,CAAC;CACnC,CAAC;AACF,KAAK,KAAK,GAAG,WAAW,GAAG,CAAC,wBAAwB,GAAG,8BAA8B,CAAC,CAAC;AAEvF;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,sLAWjB,kBAAkB,KAAK,CAAC,KAAG,YAqL7B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./Tooltip";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tooltip/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { ChildrenCoords } from './utils/types';
2
+ export declare const tooltipStyles: {
3
+ overlay: {
4
+ position: "absolute";
5
+ width: string;
6
+ height: string;
7
+ backgroundColor: string;
8
+ opacity: number;
9
+ zIndex: number;
10
+ };
11
+ childrenContainer: {
12
+ position: "absolute";
13
+ zIndex: number;
14
+ };
15
+ tooltipContainer: {
16
+ position: "absolute";
17
+ paddingHorizontal: number;
18
+ paddingVertical: number;
19
+ backgroundColor: string;
20
+ borderRadius: number;
21
+ zIndex: number;
22
+ overflow: "visible";
23
+ };
24
+ arrowContainer: {
25
+ position: "absolute";
26
+ display: "flex";
27
+ zIndex: number;
28
+ };
29
+ closeIcon: {
30
+ position: "absolute";
31
+ right: number;
32
+ top: number;
33
+ };
34
+ };
35
+ export declare const getChildrenPosition: (childrenCoords: ChildrenCoords) => {
36
+ top: number;
37
+ left: number;
38
+ width: number;
39
+ height: number;
40
+ };
41
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/tooltip/styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCxB,CAAC;AAEH,eAAO,MAAM,mBAAmB,mBAAoB,cAAc;;;;;CAKhE,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { ScaledSize } from 'react-native';
2
+ import { ChildrenCoords, DisplayInsets, Placement } from './types';
3
+ export declare const ARROW_WIDTH = 24;
4
+ export declare const ARROW_HEIGHT = 14;
5
+ export declare const EMPTY_SPACE = 8;
6
+ /**
7
+ * @param displayInsets custom display insets
8
+ * @returns An `object` based on `DEFAULT_INSETS` and `displayInsets`
9
+ */
10
+ export declare const getDisplayInsets: (displayInsets: Partial<DisplayInsets>) => DisplayInsets;
11
+ /**
12
+ *
13
+ * @param placement The `Tooltip` placement
14
+ * @returns The `Arrow` box `width` and `height` based on `placement` value
15
+ */
16
+ export declare const getArrowBoxByPlacement: (placement: Placement) => {
17
+ width: number;
18
+ height: number;
19
+ };
20
+ /**
21
+ * A utility function to calculate the `Tooltip` coordinates and dimensions
22
+ * @param placement The `Tooltip` placement in relation of its children
23
+ * @param childrenCoords The measures in screen of the `Tooltip` children
24
+ * @param displayInsets The active display insets
25
+ * @param screenDimensions The dimensions of the device screen
26
+ * @returns The `Tooltip` coordinates
27
+ */
28
+ export declare const getTooltipCoords: (placement: Placement, childrenCoords: ChildrenCoords, displayInsets: DisplayInsets, screenDimensions: ScaledSize) => {
29
+ bottom: number;
30
+ left: number;
31
+ width: number;
32
+ top?: undefined;
33
+ } | {
34
+ top: number;
35
+ left: number;
36
+ width: number;
37
+ bottom?: undefined;
38
+ } | {
39
+ bottom?: undefined;
40
+ left?: undefined;
41
+ width?: undefined;
42
+ top?: undefined;
43
+ };
44
+ /**
45
+ * A utility function to calculate the `Tooltip`'s `Arrow` coordinates
46
+ * @param placement The `Arrow` placement in relation of the `Tooltip` children
47
+ * @param childrenCoords The measures in screen of the `Tooltip` children
48
+ * @param screenDimensions The active display insets
49
+ * @returns The `Tooltip`'s Arrow coordinates
50
+ */
51
+ export declare const getArrowCoords: (placement: Placement, childrenCoords: ChildrenCoords, screenDimensions: ScaledSize) => {
52
+ bottom: number;
53
+ left: number;
54
+ top?: undefined;
55
+ } | {
56
+ top: number;
57
+ left: number;
58
+ bottom?: undefined;
59
+ } | {
60
+ bottom?: undefined;
61
+ left?: undefined;
62
+ top?: undefined;
63
+ };
64
+ /**
65
+ * A utility function to calculate the `Tooltip` vertical alignment
66
+ * @param placement The `Tooltip` placement in relation of its children
67
+ * @param childrenHeight The `Tooltip`'s children height
68
+ * @param tooltipHeight The `Tooltip`'s height
69
+ * @returns If placement is `left` or `right` it returns the vertical tranlsation to align the `Tooltip` center with its `children` center,
70
+ * otherwise `null` is returned
71
+ */
72
+ export declare const getTooltipVerticalAlignment: (placement: Placement, childrenHeight: number, tooltipHeight?: number) => {
73
+ transform: {
74
+ translateY: number;
75
+ }[];
76
+ } | null;
77
+ /**
78
+ * A utility function to calculate the `Arrow` vertical alignment
79
+ * @param placement The `Tooltip` placement in relation of its children
80
+ * @param childrenHeight The `Tooltip`'s children height
81
+ */
82
+ export declare const getArrowVerticalAlignment: (placement: Placement, childrenHeight: number) => {
83
+ transform: {
84
+ translateY: number;
85
+ }[];
86
+ } | null;
87
+ export declare const isDefined: <T>(v: T) => boolean;
88
+ export declare const isNotZero: (v: number) => boolean;
89
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/tooltip/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnE,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,WAAW,IAAI,CAAC;AAQ7B;;;GAGG;AACH,eAAO,MAAM,gBAAgB,kBACZ,QAAQ,aAAa,CAAC,KACpC,aAA0D,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,cAAe,SAAS;;;CAc1D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,cAChB,SAAS,kBACJ,cAAc,iBACf,aAAa,oBACV,UAAU;;;;;;;;;;;;;;;CAsC7B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,cACd,SAAS,kBACJ,cAAc,oBACZ,UAAU;;;;;;;;;;;;CA6B7B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,cAAe,SAAS,kBAAkB,MAAM,kBAAkB,MAAM;;;;QAY/G,CAAC;AAEF;;;;EAIE;AACF,eAAO,MAAM,yBAAyB,cAAe,SAAS,kBAAkB,MAAM;;;;QAYrF,CAAC;AAEF,eAAO,MAAM,SAAS,SAAU,CAAC,YAAoB,CAAC;AACtD,eAAO,MAAM,SAAS,MAAO,MAAM,YAAY,CAAC"}
@@ -0,0 +1,10 @@
1
+ export type DisplayInsets = Record<Placement, number>;
2
+ export type Placement = "top" | "bottom" | "left" | "right";
3
+ export type ChildrenCoords = {
4
+ x: number;
5
+ y: number;
6
+ width: number;
7
+ height: number;
8
+ };
9
+ export type TooltipLayout = ChildrenCoords;
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/tooltip/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACtD,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAC5D,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-app-design-system",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "The library defining the core components of the design system of @pagopa/io-app",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,7 +1,7 @@
1
- import React, { useEffect, useMemo } from "react";
2
- import { StyleSheet, View } from "react-native";
1
+ import React, { useEffect, useState } from "react";
2
+ import { ColorValue, StyleSheet, View } from "react-native";
3
3
  import Animated from "react-native-reanimated";
4
- import { IOColors, IOStyles } from "../../core";
4
+ import { hexToRgba, IOColors, useIOThemeContext } from "../../core";
5
5
  import { triggerHaptic } from "../../functions";
6
6
  import { useErrorShakeAnimation } from "../../utils/hooks/useErrorShakeAnimation";
7
7
  import { HStack } from "../stack";
@@ -20,28 +20,29 @@ const styles = StyleSheet.create({
20
20
  dotShape: {
21
21
  width: DOT_SIZE,
22
22
  height: DOT_SIZE,
23
- borderRadius: 8,
23
+ borderRadius: DOT_SIZE / 2,
24
24
  borderWidth: 2
25
- },
26
- dotEmpty: {
27
- borderColor: IOColors["grey-650"]
28
- },
29
- wrapper: {
30
- justifyContent: "center"
31
25
  }
32
26
  });
33
27
 
34
- const EmptyDot = () => <View style={[styles.dotShape, styles.dotEmpty]} />;
35
-
36
- const FilletDot = ({ color }: { color: IOColors }) => (
28
+ const EmptyDot = ({ color: borderColor }: { color: ColorValue }) => (
37
29
  <View
38
30
  style={[
39
31
  styles.dotShape,
40
- { backgroundColor: IOColors[color], borderColor: IOColors[color] }
32
+ {
33
+ borderColor,
34
+ backgroundColor: hexToRgba(borderColor, 0)
35
+ }
41
36
  ]}
42
37
  />
43
38
  );
44
39
 
40
+ const FilledDot = ({ color: backgroundColor }: { color: ColorValue }) => (
41
+ <View
42
+ style={[styles.dotShape, { backgroundColor, borderColor: backgroundColor }]}
43
+ />
44
+ );
45
+
45
46
  export const CodeInput = ({
46
47
  length,
47
48
  value,
@@ -49,19 +50,34 @@ export const CodeInput = ({
49
50
  variant = "light",
50
51
  onValidate
51
52
  }: CodeInputProps) => {
52
- const [status, setStatus] = React.useState<"default" | "error">("default");
53
+ const [status, setStatus] = useState<"default" | "error">("default");
54
+ const { themeType } = useIOThemeContext();
53
55
 
54
56
  const { translate, animatedStyle, shakeAnimation } = useErrorShakeAnimation();
55
57
 
56
- const fillColor = useMemo(
57
- () =>
58
- status === "error"
59
- ? "error-600"
60
- : variant === "light"
61
- ? "white"
62
- : "black",
63
- [variant, status]
64
- );
58
+ /* Empty Dot
59
+ - Right color depending on both theme and variant */
60
+ const emptyDotColorLightBg = IOColors["grey-650"];
61
+ const emptyDotColorDarkBg = hexToRgba(IOColors.white, 0.75);
62
+ const emptyDotColorThemeBased =
63
+ themeType === "light" ? emptyDotColorLightBg : emptyDotColorDarkBg;
64
+
65
+ const emptyDotColor =
66
+ variant === "light" ? emptyDotColorDarkBg : emptyDotColorThemeBased;
67
+
68
+ /* Filled Dot
69
+ - Right color depending on theme, variant and status */
70
+ const filledDotColorLightBg = IOColors.black;
71
+ const filledDotColorDarkBg = IOColors.white;
72
+ const filledDotColorThemeBased =
73
+ themeType === "light" ? filledDotColorLightBg : filledDotColorDarkBg;
74
+
75
+ const filledDotColor =
76
+ status === "error"
77
+ ? IOColors["error-600"]
78
+ : variant === "light"
79
+ ? filledDotColorDarkBg
80
+ : filledDotColorThemeBased;
65
81
 
66
82
  useEffect(() => {
67
83
  if (onValidate && value.length === length) {
@@ -85,13 +101,20 @@ export const CodeInput = ({
85
101
  }, [value, onValidate, length, onValueChange, translate, shakeAnimation]);
86
102
 
87
103
  return (
88
- <Animated.View style={[IOStyles.row, styles.wrapper, animatedStyle]}>
104
+ <Animated.View
105
+ style={[
106
+ { flexDirection: "row", justifyContent: "center" },
107
+ animatedStyle
108
+ ]}
109
+ >
89
110
  <HStack space={DOT_SIZE}>
90
- {[...Array(length)].map((_, i) => (
91
- <React.Fragment key={i}>
92
- {value[i] ? <FilletDot color={fillColor} /> : <EmptyDot />}
93
- </React.Fragment>
94
- ))}
111
+ {[...Array(length)].map((_, i) =>
112
+ value[i] ? (
113
+ <FilledDot key={i} color={filledDotColor} />
114
+ ) : (
115
+ <EmptyDot key={i} color={emptyDotColor} />
116
+ )
117
+ )}
95
118
  </HStack>
96
119
  </Animated.View>
97
120
  );
@@ -30,4 +30,5 @@ export * from "./tag";
30
30
  export * from "./textInput";
31
31
  export * from "./searchInput";
32
32
  export * from "./toast";
33
+ export * from "./tooltip";
33
34
  export * from "./typography";