@chayns-components/navigation 5.0.65 → 5.1.1

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 (186) hide show
  1. package/lib/cjs/components/navigation-layout/NavigationLayout.constants.js +14 -0
  2. package/lib/cjs/components/navigation-layout/NavigationLayout.constants.js.map +1 -0
  3. package/lib/cjs/components/navigation-layout/NavigationLayout.context.js +26 -0
  4. package/lib/cjs/components/navigation-layout/NavigationLayout.context.js.map +1 -0
  5. package/lib/cjs/components/navigation-layout/NavigationLayout.js +105 -0
  6. package/lib/cjs/components/navigation-layout/NavigationLayout.js.map +1 -0
  7. package/lib/cjs/components/navigation-layout/NavigationLayout.styles.js +74 -0
  8. package/lib/cjs/components/navigation-layout/NavigationLayout.styles.js.map +1 -0
  9. package/lib/cjs/components/navigation-layout/NavigationLayout.types.js +6 -0
  10. package/lib/cjs/components/navigation-layout/NavigationLayout.types.js.map +1 -0
  11. package/lib/cjs/components/navigation-layout/NavigationLayout.utils.js +261 -0
  12. package/lib/cjs/components/navigation-layout/NavigationLayout.utils.js.map +1 -0
  13. package/lib/cjs/components/navigation-layout/navigation-header/NavigationHeader.js +31 -0
  14. package/lib/cjs/components/navigation-layout/navigation-header/NavigationHeader.js.map +1 -0
  15. package/lib/cjs/components/navigation-layout/navigation-header/NavigationHeader.styles.js +30 -0
  16. package/lib/cjs/components/navigation-layout/navigation-header/NavigationHeader.styles.js.map +1 -0
  17. package/lib/cjs/components/navigation-layout/navigation-header/NavigationHeader.types.js +6 -0
  18. package/lib/cjs/components/navigation-layout/navigation-header/NavigationHeader.types.js.map +1 -0
  19. package/lib/cjs/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.js +71 -0
  20. package/lib/cjs/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.js.map +1 -0
  21. package/lib/cjs/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.js +19 -0
  22. package/lib/cjs/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.js.map +1 -0
  23. package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.js +26 -0
  24. package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.js.map +1 -0
  25. package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.js +140 -0
  26. package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.js.map +1 -0
  27. package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.styles.js +89 -0
  28. package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.styles.js.map +1 -0
  29. package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.types.js +6 -0
  30. package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.types.js.map +1 -0
  31. package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.utils.js +83 -0
  32. package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.utils.js.map +1 -0
  33. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.js +17 -0
  34. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.js.map +1 -0
  35. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.styles.js +19 -0
  36. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.styles.js.map +1 -0
  37. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.context.js +26 -0
  38. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.context.js.map +1 -0
  39. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.hooks.js +129 -0
  40. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.hooks.js.map +1 -0
  41. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.js +79 -0
  42. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.js.map +1 -0
  43. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.styles.js +69 -0
  44. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.styles.js.map +1 -0
  45. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.hooks.js +265 -0
  46. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.hooks.js.map +1 -0
  47. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.js +193 -0
  48. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.js.map +1 -0
  49. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.styles.js +132 -0
  50. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.styles.js.map +1 -0
  51. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.utils.js +78 -0
  52. package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.utils.js.map +1 -0
  53. package/lib/cjs/components/split-layout/SplitLayout.js +90 -0
  54. package/lib/cjs/components/split-layout/SplitLayout.js.map +1 -0
  55. package/lib/cjs/components/split-layout/SplitLayout.styles.js +44 -0
  56. package/lib/cjs/components/split-layout/SplitLayout.styles.js.map +1 -0
  57. package/lib/cjs/components/split-layout/SplitLayout.types.js +12 -0
  58. package/lib/cjs/components/split-layout/SplitLayout.types.js.map +1 -0
  59. package/lib/cjs/components/split-layout/SplitLayout.utils.js +25 -0
  60. package/lib/cjs/components/split-layout/SplitLayout.utils.js.map +1 -0
  61. package/lib/cjs/components/split-layout/resize-handle/ResizeHandle.hooks.js +63 -0
  62. package/lib/cjs/components/split-layout/resize-handle/ResizeHandle.hooks.js.map +1 -0
  63. package/lib/cjs/components/split-layout/resize-handle/ResizeHandle.js +34 -0
  64. package/lib/cjs/components/split-layout/resize-handle/ResizeHandle.js.map +1 -0
  65. package/lib/cjs/components/split-layout/resize-handle/ResizeHandle.styles.js +58 -0
  66. package/lib/cjs/components/split-layout/resize-handle/ResizeHandle.styles.js.map +1 -0
  67. package/lib/cjs/components/user-image/UserImage.js +38 -0
  68. package/lib/cjs/components/user-image/UserImage.js.map +1 -0
  69. package/lib/cjs/components/user-image/UserImage.types.js +6 -0
  70. package/lib/cjs/components/user-image/UserImage.types.js.map +1 -0
  71. package/lib/cjs/components/user-image/userImage.styles.js +27 -0
  72. package/lib/cjs/components/user-image/userImage.styles.js.map +1 -0
  73. package/lib/cjs/index.js +49 -1
  74. package/lib/cjs/index.js.map +1 -1
  75. package/lib/esm/components/navigation-layout/NavigationLayout.constants.js +8 -0
  76. package/lib/esm/components/navigation-layout/NavigationLayout.constants.js.map +1 -0
  77. package/lib/esm/components/navigation-layout/NavigationLayout.context.js +17 -0
  78. package/lib/esm/components/navigation-layout/NavigationLayout.context.js.map +1 -0
  79. package/lib/esm/components/navigation-layout/NavigationLayout.js +97 -0
  80. package/lib/esm/components/navigation-layout/NavigationLayout.js.map +1 -0
  81. package/lib/esm/components/navigation-layout/NavigationLayout.styles.js +67 -0
  82. package/lib/esm/components/navigation-layout/NavigationLayout.styles.js.map +1 -0
  83. package/lib/esm/components/navigation-layout/NavigationLayout.types.js +2 -0
  84. package/lib/esm/components/navigation-layout/NavigationLayout.types.js.map +1 -0
  85. package/lib/esm/components/navigation-layout/NavigationLayout.utils.js +251 -0
  86. package/lib/esm/components/navigation-layout/NavigationLayout.utils.js.map +1 -0
  87. package/lib/esm/components/navigation-layout/navigation-header/NavigationHeader.js +24 -0
  88. package/lib/esm/components/navigation-layout/navigation-header/NavigationHeader.js.map +1 -0
  89. package/lib/esm/components/navigation-layout/navigation-header/NavigationHeader.styles.js +23 -0
  90. package/lib/esm/components/navigation-layout/navigation-header/NavigationHeader.styles.js.map +1 -0
  91. package/lib/esm/components/navigation-layout/navigation-header/NavigationHeader.types.js +2 -0
  92. package/lib/esm/components/navigation-layout/navigation-header/NavigationHeader.types.js.map +1 -0
  93. package/lib/esm/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.js +64 -0
  94. package/lib/esm/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.js.map +1 -0
  95. package/lib/esm/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.js +12 -0
  96. package/lib/esm/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.js.map +1 -0
  97. package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.js +17 -0
  98. package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.js.map +1 -0
  99. package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.js +132 -0
  100. package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.js.map +1 -0
  101. package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.styles.js +82 -0
  102. package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.styles.js.map +1 -0
  103. package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.types.js +2 -0
  104. package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.types.js.map +1 -0
  105. package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.utils.js +73 -0
  106. package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.utils.js.map +1 -0
  107. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.js +10 -0
  108. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.js.map +1 -0
  109. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.styles.js +12 -0
  110. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.styles.js.map +1 -0
  111. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.context.js +17 -0
  112. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.context.js.map +1 -0
  113. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.hooks.js +119 -0
  114. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.hooks.js.map +1 -0
  115. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.js +71 -0
  116. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.js.map +1 -0
  117. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.styles.js +62 -0
  118. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.styles.js.map +1 -0
  119. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.hooks.js +257 -0
  120. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.hooks.js.map +1 -0
  121. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.js +186 -0
  122. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.js.map +1 -0
  123. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.styles.js +126 -0
  124. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.styles.js.map +1 -0
  125. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.utils.js +67 -0
  126. package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.utils.js.map +1 -0
  127. package/lib/esm/components/split-layout/SplitLayout.js +80 -0
  128. package/lib/esm/components/split-layout/SplitLayout.js.map +1 -0
  129. package/lib/esm/components/split-layout/SplitLayout.styles.js +37 -0
  130. package/lib/esm/components/split-layout/SplitLayout.styles.js.map +1 -0
  131. package/lib/esm/components/split-layout/SplitLayout.types.js +6 -0
  132. package/lib/esm/components/split-layout/SplitLayout.types.js.map +1 -0
  133. package/lib/esm/components/split-layout/SplitLayout.utils.js +17 -0
  134. package/lib/esm/components/split-layout/SplitLayout.utils.js.map +1 -0
  135. package/lib/esm/components/split-layout/resize-handle/ResizeHandle.hooks.js +54 -0
  136. package/lib/esm/components/split-layout/resize-handle/ResizeHandle.hooks.js.map +1 -0
  137. package/lib/esm/components/split-layout/resize-handle/ResizeHandle.js +27 -0
  138. package/lib/esm/components/split-layout/resize-handle/ResizeHandle.js.map +1 -0
  139. package/lib/esm/components/split-layout/resize-handle/ResizeHandle.styles.js +52 -0
  140. package/lib/esm/components/split-layout/resize-handle/ResizeHandle.styles.js.map +1 -0
  141. package/lib/esm/components/user-image/UserImage.js +31 -0
  142. package/lib/esm/components/user-image/UserImage.js.map +1 -0
  143. package/lib/esm/components/user-image/UserImage.types.js +2 -0
  144. package/lib/esm/components/user-image/UserImage.types.js.map +1 -0
  145. package/lib/esm/components/user-image/userImage.styles.js +20 -0
  146. package/lib/esm/components/user-image/userImage.styles.js.map +1 -0
  147. package/lib/esm/index.js +15 -1
  148. package/lib/esm/index.js.map +1 -1
  149. package/lib/types/components/navigation-layout/NavigationLayout.constants.d.ts +7 -0
  150. package/lib/types/components/navigation-layout/NavigationLayout.context.d.ts +15 -0
  151. package/lib/types/components/navigation-layout/NavigationLayout.d.ts +4 -0
  152. package/lib/types/components/navigation-layout/NavigationLayout.styles.d.ts +19 -0
  153. package/lib/types/components/navigation-layout/NavigationLayout.types.d.ts +125 -0
  154. package/lib/types/components/navigation-layout/NavigationLayout.utils.d.ts +22 -0
  155. package/lib/types/components/navigation-layout/navigation-header/NavigationHeader.d.ts +4 -0
  156. package/lib/types/components/navigation-layout/navigation-header/NavigationHeader.styles.d.ts +9 -0
  157. package/lib/types/components/navigation-layout/navigation-header/NavigationHeader.types.d.ts +10 -0
  158. package/lib/types/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.d.ts +8 -0
  159. package/lib/types/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.d.ts +3 -0
  160. package/lib/types/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.d.ts +19 -0
  161. package/lib/types/components/navigation-layout/navigation-sidebar/NavigationSidebar.d.ts +4 -0
  162. package/lib/types/components/navigation-layout/navigation-sidebar/NavigationSidebar.styles.d.ts +27 -0
  163. package/lib/types/components/navigation-layout/navigation-sidebar/NavigationSidebar.types.d.ts +54 -0
  164. package/lib/types/components/navigation-layout/navigation-sidebar/NavigationSidebar.utils.d.ts +22 -0
  165. package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.d.ts +6 -0
  166. package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.styles.d.ts +6 -0
  167. package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.context.d.ts +22 -0
  168. package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.d.ts +9 -0
  169. package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.hooks.d.ts +26 -0
  170. package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.styles.d.ts +9 -0
  171. package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.d.ts +10 -0
  172. package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.hooks.d.ts +51 -0
  173. package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.styles.d.ts +24 -0
  174. package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.utils.d.ts +23 -0
  175. package/lib/types/components/split-layout/SplitLayout.d.ts +4 -0
  176. package/lib/types/components/split-layout/SplitLayout.styles.d.ts +12 -0
  177. package/lib/types/components/split-layout/SplitLayout.types.d.ts +19 -0
  178. package/lib/types/components/split-layout/SplitLayout.utils.d.ts +8 -0
  179. package/lib/types/components/split-layout/resize-handle/ResizeHandle.d.ts +11 -0
  180. package/lib/types/components/split-layout/resize-handle/ResizeHandle.hooks.d.ts +9 -0
  181. package/lib/types/components/split-layout/resize-handle/ResizeHandle.styles.d.ts +15 -0
  182. package/lib/types/components/user-image/UserImage.d.ts +4 -0
  183. package/lib/types/components/user-image/UserImage.types.d.ts +8 -0
  184. package/lib/types/components/user-image/userImage.styles.d.ts +10 -0
  185. package/lib/types/index.d.ts +10 -2
  186. package/package.json +3 -3
@@ -0,0 +1,126 @@
1
+ import { css, styled } from 'styled-components';
2
+ import { motion } from 'motion/react';
3
+ export const StyledSidebarItem = styled.div`
4
+ position: relative;
5
+ width: 100%;
6
+ display: flex;
7
+ flex-direction: column;
8
+ `;
9
+ export const StyledSidebarItemHead = styled.div`
10
+ height: 42px;
11
+ width: 100%;
12
+
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: space-between;
16
+
17
+ opacity: ${({
18
+ $isDisabled
19
+ }) => $isDisabled ? 0.5 : 1};
20
+
21
+ ${({
22
+ $isDisabled,
23
+ $hasDisabledReason,
24
+ $isReorderable
25
+ }) => {
26
+ if ($isDisabled && $hasDisabledReason) {
27
+ return css`
28
+ cursor: help;
29
+ `;
30
+ }
31
+ if ($isDisabled) {
32
+ return css`
33
+ cursor: default;
34
+ `;
35
+ }
36
+ return css`
37
+ cursor: ${$isReorderable ? 'grab' : 'pointer'};
38
+ `;
39
+ }}
40
+
41
+ ${({
42
+ $isDragging
43
+ }) => $isDragging && css`
44
+ opacity: 0.55;
45
+ cursor: grabbing;
46
+ `}
47
+
48
+ ${({
49
+ $shouldHighlight
50
+ }) => $shouldHighlight && css`
51
+ background-color: rgba(30, 30, 30, 0.3);
52
+ `}
53
+ `;
54
+ export const StyledSidebarItemHeadContent = styled.div`
55
+ display: flex;
56
+ align-items: center;
57
+ height: 100%;
58
+ min-width: 0;
59
+ `;
60
+ export const StyledSidebarItemPopup = styled.div`
61
+ position: absolute;
62
+ pointer-events: none;
63
+ opacity: 1;
64
+ background-color: ${({
65
+ theme
66
+ }) => theme['000']};
67
+ color: ${({
68
+ theme
69
+ }) => theme.text};
70
+ border-radius: 4px;
71
+
72
+ min-height: 30px;
73
+ padding: 0 10px;
74
+ transition: opacity 0.3s;
75
+ display: flex;
76
+ align-items: center;
77
+ z-index: 2;
78
+ white-space: nowrap;
79
+
80
+ box-shadow: 1px 3px 8px rgb(0, 0, 0, 0.3);
81
+ border: 1px solid rgba(0, 0, 0, 0.15);
82
+
83
+ top: ${({
84
+ $coordinates
85
+ }) => $coordinates.y}px;
86
+ left: ${({
87
+ $coordinates
88
+ }) => $coordinates.x}px;
89
+ transform: translateY(-50%);
90
+ `;
91
+ export const StyledSidebarItemIcon = styled.div`
92
+ display: flex;
93
+ align-items: center;
94
+ justify-content: center;
95
+ aspect-ratio: 1;
96
+ height: 100%;
97
+ `;
98
+ export const StyledMotionSidebarOpenIcon = styled(motion.div)`
99
+ height: 30px;
100
+ width: 30px;
101
+ display: flex;
102
+ justify-content: center;
103
+ align-items: center;
104
+ flex-shrink: 0;
105
+ `;
106
+ export const StyledSidebarItemIconImage = styled.img`
107
+ width: 28px;
108
+ `;
109
+ export const StyledSidebarItemLabel = styled.div`
110
+ text-overflow: ellipsis;
111
+ overflow: hidden;
112
+ white-space: nowrap;
113
+
114
+ flex: 1;
115
+ min-width: 0;
116
+ `;
117
+ export const StyledSidebarItemChildren = styled.div`
118
+ position: relative;
119
+ display: flex;
120
+ flex-direction: column;
121
+ gap: 2px;
122
+ padding-top: 2px;
123
+
124
+ padding-left: 8px;
125
+ `;
126
+ //# sourceMappingURL=SidebarItem.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidebarItem.styles.js","names":["css","styled","motion","StyledSidebarItem","div","StyledSidebarItemHead","$isDisabled","$hasDisabledReason","$isReorderable","$isDragging","$shouldHighlight","StyledSidebarItemHeadContent","StyledSidebarItemPopup","theme","text","$coordinates","y","x","StyledSidebarItemIcon","StyledMotionSidebarOpenIcon","StyledSidebarItemIconImage","img","StyledSidebarItemLabel","StyledSidebarItemChildren"],"sources":["../../../../../../../src/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.styles.ts"],"sourcesContent":["import { css, styled } from 'styled-components';\nimport { motion } from 'motion/react';\nimport { WithTheme } from '@chayns-components/core';\nimport { Coordinates } from './SidebarItem.utils';\n\nexport const StyledSidebarItem = styled.div`\n position: relative;\n width: 100%;\n display: flex;\n flex-direction: column;\n`;\n\ntype StyledSidebarItemHeadProps = WithTheme<{\n $shouldHighlight: boolean;\n $hasDisabledReason: boolean;\n $isDisabled?: boolean;\n $isDragging?: boolean;\n $isReorderable?: boolean;\n}>;\n\nexport const StyledSidebarItemHead = styled.div<StyledSidebarItemHeadProps>`\n height: 42px;\n width: 100%;\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n\n ${({ $isDisabled, $hasDisabledReason, $isReorderable }) => {\n if ($isDisabled && $hasDisabledReason) {\n return css`\n cursor: help;\n `;\n }\n\n if ($isDisabled) {\n return css`\n cursor: default;\n `;\n }\n\n return css`\n cursor: ${$isReorderable ? 'grab' : 'pointer'};\n `;\n }}\n\n ${({ $isDragging }) =>\n $isDragging &&\n css`\n opacity: 0.55;\n cursor: grabbing;\n `}\n\n ${({ $shouldHighlight }) =>\n $shouldHighlight &&\n css`\n background-color: rgba(30, 30, 30, 0.3);\n `}\n`;\n\nexport const StyledSidebarItemHeadContent = styled.div`\n display: flex;\n align-items: center;\n height: 100%;\n min-width: 0;\n`;\n\ntype StyledSidebarItemPopupProps = WithTheme<{\n $coordinates: Coordinates;\n}>;\n\nexport const StyledSidebarItemPopup = styled.div<StyledSidebarItemPopupProps>`\n position: absolute;\n pointer-events: none;\n opacity: 1;\n background-color: ${({ theme }) => theme['000']};\n color: ${({ theme }) => theme.text};\n border-radius: 4px;\n\n min-height: 30px;\n padding: 0 10px;\n transition: opacity 0.3s;\n display: flex;\n align-items: center;\n z-index: 2;\n white-space: nowrap;\n\n box-shadow: 1px 3px 8px rgb(0, 0, 0, 0.3);\n border: 1px solid rgba(0, 0, 0, 0.15);\n\n top: ${({ $coordinates }) => $coordinates.y}px;\n left: ${({ $coordinates }) => $coordinates.x}px;\n transform: translateY(-50%);\n`;\n\nexport const StyledSidebarItemIcon = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n aspect-ratio: 1;\n height: 100%;\n`;\n\nexport const StyledMotionSidebarOpenIcon = styled(motion.div)`\n height: 30px;\n width: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n`;\n\nexport const StyledSidebarItemIconImage = styled.img`\n width: 28px;\n`;\n\nexport const StyledSidebarItemLabel = styled.div`\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n\n flex: 1;\n min-width: 0;\n`;\n\nexport const StyledSidebarItemChildren = styled.div`\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 2px;\n padding-top: 2px;\n\n padding-left: 8px;\n`;\n"],"mappings":"AAAA,SAASA,GAAG,EAAEC,MAAM,QAAQ,mBAAmB;AAC/C,SAASC,MAAM,QAAQ,cAAc;AAIrC,OAAO,MAAMC,iBAAiB,GAAGF,MAAM,CAACG,GAAG;AAC3C;AACA;AACA;AACA;AACA,CAAC;AAUD,OAAO,MAAMC,qBAAqB,GAAGJ,MAAM,CAACG,GAA+B;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,CAAC;EAAEE;AAAY,CAAC,KAAMA,WAAW,GAAG,GAAG,GAAG,CAAE;AAC3D;AACA,MAAM,CAAC;EAAEA,WAAW;EAAEC,kBAAkB;EAAEC;AAAe,CAAC,KAAK;EACvD,IAAIF,WAAW,IAAIC,kBAAkB,EAAE;IACnC,OAAOP,GAAG;AACtB;AACA,aAAa;EACL;EAEA,IAAIM,WAAW,EAAE;IACb,OAAON,GAAG;AACtB;AACA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;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,67 @@
1
+ const SCROLLABLE_OVERFLOW_VALUES = ['auto', 'scroll', 'overlay'];
2
+ const isScrollableElement = element => {
3
+ const {
4
+ overflowX,
5
+ overflowY
6
+ } = window.getComputedStyle(element);
7
+ return [overflowX, overflowY].some(value => SCROLLABLE_OVERFLOW_VALUES.includes(value));
8
+ };
9
+ export const areCoordinatesEqual = ({
10
+ coordinatesA,
11
+ coordinatesB
12
+ }) => {
13
+ if (!coordinatesA || !coordinatesB) {
14
+ return coordinatesA === coordinatesB;
15
+ }
16
+ return coordinatesA.x === coordinatesB.x && coordinatesA.y === coordinatesB.y;
17
+ };
18
+ export const getSidebarItemPopupCoordinates = ({
19
+ container,
20
+ item,
21
+ offset = 5
22
+ }) => {
23
+ const {
24
+ left: itemLeft,
25
+ top: itemTop,
26
+ width,
27
+ height
28
+ } = item.getBoundingClientRect();
29
+ const {
30
+ left: containerLeft,
31
+ top: containerTop
32
+ } = container.getBoundingClientRect();
33
+ return {
34
+ x: Math.round(itemLeft - containerLeft + width + offset),
35
+ y: Math.round(itemTop - containerTop + height / 2)
36
+ };
37
+ };
38
+ export const getScrollableAncestorElements = ({
39
+ element,
40
+ boundaryElement
41
+ }) => {
42
+ const scrollableElements = [];
43
+ let currentElement = element.parentElement;
44
+ while (currentElement) {
45
+ if (isScrollableElement(currentElement)) {
46
+ scrollableElements.push(currentElement);
47
+ }
48
+ if (currentElement === boundaryElement) {
49
+ break;
50
+ }
51
+ currentElement = currentElement.parentElement;
52
+ }
53
+ return scrollableElements;
54
+ };
55
+ export const isItemOrChildSelected = (item, selectedId) => {
56
+ if (!selectedId) {
57
+ return false;
58
+ }
59
+ if (item.id === selectedId) {
60
+ return true;
61
+ }
62
+ if (!item.children?.length) {
63
+ return false;
64
+ }
65
+ return item.children.some(child => isItemOrChildSelected(child, selectedId));
66
+ };
67
+ //# sourceMappingURL=SidebarItem.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidebarItem.utils.js","names":["SCROLLABLE_OVERFLOW_VALUES","isScrollableElement","element","overflowX","overflowY","window","getComputedStyle","some","value","includes","areCoordinatesEqual","coordinatesA","coordinatesB","x","y","getSidebarItemPopupCoordinates","container","item","offset","left","itemLeft","top","itemTop","width","height","getBoundingClientRect","containerLeft","containerTop","Math","round","getScrollableAncestorElements","boundaryElement","scrollableElements","currentElement","parentElement","push","isItemOrChildSelected","selectedId","id","children","length","child"],"sources":["../../../../../../../src/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.utils.ts"],"sourcesContent":["import { NavigationLayoutItem } from '../../../NavigationLayout.types';\n\nexport interface Coordinates {\n x: number;\n y: number;\n}\n\ninterface AreCoordinatesEqualOptions {\n coordinatesA: Coordinates | null;\n coordinatesB: Coordinates | null;\n}\n\ninterface GetSidebarItemPopupCoordinatesOptions {\n container: HTMLElement;\n item: HTMLElement;\n offset?: number;\n}\n\ninterface GetScrollableAncestorElementsOptions {\n element: HTMLElement;\n boundaryElement?: HTMLElement | null;\n}\n\nconst SCROLLABLE_OVERFLOW_VALUES = ['auto', 'scroll', 'overlay'];\n\nconst isScrollableElement = (element: HTMLElement): boolean => {\n const { overflowX, overflowY } = window.getComputedStyle(element);\n\n return [overflowX, overflowY].some((value) => SCROLLABLE_OVERFLOW_VALUES.includes(value));\n};\n\nexport const areCoordinatesEqual = ({\n coordinatesA,\n coordinatesB,\n}: AreCoordinatesEqualOptions): boolean => {\n if (!coordinatesA || !coordinatesB) {\n return coordinatesA === coordinatesB;\n }\n\n return coordinatesA.x === coordinatesB.x && coordinatesA.y === coordinatesB.y;\n};\n\nexport const getSidebarItemPopupCoordinates = ({\n container,\n item,\n offset = 5,\n}: GetSidebarItemPopupCoordinatesOptions): Coordinates => {\n const { left: itemLeft, top: itemTop, width, height } = item.getBoundingClientRect();\n const { left: containerLeft, top: containerTop } = container.getBoundingClientRect();\n\n return {\n x: Math.round(itemLeft - containerLeft + width + offset),\n y: Math.round(itemTop - containerTop + height / 2),\n };\n};\n\nexport const getScrollableAncestorElements = ({\n element,\n boundaryElement,\n}: GetScrollableAncestorElementsOptions): HTMLElement[] => {\n const scrollableElements: HTMLElement[] = [];\n let currentElement = element.parentElement;\n\n while (currentElement) {\n if (isScrollableElement(currentElement)) {\n scrollableElements.push(currentElement);\n }\n\n if (currentElement === boundaryElement) {\n break;\n }\n\n currentElement = currentElement.parentElement;\n }\n\n return scrollableElements;\n};\n\nexport const isItemOrChildSelected = (item: NavigationLayoutItem, selectedId?: string): boolean => {\n if (!selectedId) {\n return false;\n }\n\n if (item.id === selectedId) {\n return true;\n }\n\n if (!item.children?.length) {\n return false;\n }\n\n return item.children.some((child) => isItemOrChildSelected(child, selectedId));\n};\n"],"mappings":"AAuBA,MAAMA,0BAA0B,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC;AAEhE,MAAMC,mBAAmB,GAAIC,OAAoB,IAAc;EAC3D,MAAM;IAAEC,SAAS;IAAEC;EAAU,CAAC,GAAGC,MAAM,CAACC,gBAAgB,CAACJ,OAAO,CAAC;EAEjE,OAAO,CAACC,SAAS,EAAEC,SAAS,CAAC,CAACG,IAAI,CAAEC,KAAK,IAAKR,0BAA0B,CAACS,QAAQ,CAACD,KAAK,CAAC,CAAC;AAC7F,CAAC;AAED,OAAO,MAAME,mBAAmB,GAAGA,CAAC;EAChCC,YAAY;EACZC;AACwB,CAAC,KAAc;EACvC,IAAI,CAACD,YAAY,IAAI,CAACC,YAAY,EAAE;IAChC,OAAOD,YAAY,KAAKC,YAAY;EACxC;EAEA,OAAOD,YAAY,CAACE,CAAC,KAAKD,YAAY,CAACC,CAAC,IAAIF,YAAY,CAACG,CAAC,KAAKF,YAAY,CAACE,CAAC;AACjF,CAAC;AAED,OAAO,MAAMC,8BAA8B,GAAGA,CAAC;EAC3CC,SAAS;EACTC,IAAI;EACJC,MAAM,GAAG;AAC0B,CAAC,KAAkB;EACtD,MAAM;IAAEC,IAAI,EAAEC,QA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,EAAEJ,UAAU,CAAC,CAAC;AAClF,CAAC","ignoreList":[]}
@@ -0,0 +1,80 @@
1
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
+ import ResizeHandle from './resize-handle/ResizeHandle';
3
+ import { StyledSplitLayout, StyledSplitLayoutPane } from './SplitLayout.styles';
4
+ import { SplitLayoutDirection } from './SplitLayout.types';
5
+ import { getContainerSizeByDirection, getVisibleViewIds } from './SplitLayout.utils';
6
+ export const SplitLayout = ({
7
+ direction = SplitLayoutDirection.HORIZONTAL,
8
+ handleSize = 2,
9
+ views,
10
+ onChange,
11
+ fullScreenViewId
12
+ }) => {
13
+ const ref = useRef(null);
14
+ const [sizes, setSizes] = useState({});
15
+ const [containerSize, setContainerSize] = useState(0);
16
+ useEffect(() => {
17
+ if (!ref.current) {
18
+ return () => {};
19
+ }
20
+ const element = ref.current;
21
+ const updateSize = () => {
22
+ setContainerSize(getContainerSizeByDirection(element, direction));
23
+ };
24
+ updateSize();
25
+ const observer = new ResizeObserver(() => {
26
+ updateSize();
27
+ });
28
+ observer.observe(element);
29
+ return () => {
30
+ observer.disconnect();
31
+ };
32
+ }, [direction]);
33
+ const viewIdsToDisplay = useMemo(() => getVisibleViewIds({
34
+ views,
35
+ containerSize
36
+ }), [views, containerSize]);
37
+ const handleResize = useCallback((key, delta) => {
38
+ setSizes(prev => {
39
+ const nextSize = (prev[key] ?? views[key]?.defaultSize ?? 0) + delta;
40
+ const minSize = views[key]?.minSize ?? 0;
41
+ const maxSize = views[key]?.maxSize ?? Number.MAX_SAFE_INTEGER;
42
+ const clampedSize = Math.min(Math.max(nextSize, minSize), maxSize);
43
+ if (typeof onChange === 'function') {
44
+ onChange(key, clampedSize);
45
+ }
46
+ return {
47
+ ...prev,
48
+ [key]: clampedSize
49
+ };
50
+ });
51
+ }, [onChange, views]);
52
+ const content = useMemo(() => {
53
+ if (typeof fullScreenViewId === 'string' && views[fullScreenViewId]) {
54
+ return views[fullScreenViewId].component;
55
+ }
56
+ return viewIdsToDisplay.map((key, index) => {
57
+ const view = views[key];
58
+ if (!view) {
59
+ return null;
60
+ }
61
+ return /*#__PURE__*/React.createElement(React.Fragment, {
62
+ key: key
63
+ }, /*#__PURE__*/React.createElement(StyledSplitLayoutPane, {
64
+ $direction: direction,
65
+ $size: sizes[key] ?? view.defaultSize ?? view.minSize ?? view.maxSize
66
+ }, view.component), index < viewIdsToDisplay.length - 1 && /*#__PURE__*/React.createElement(ResizeHandle, {
67
+ size: handleSize,
68
+ direction: direction,
69
+ onDrag: delta => handleResize(key, delta)
70
+ }));
71
+ });
72
+ }, [direction, fullScreenViewId, handleResize, handleSize, sizes, viewIdsToDisplay, views]);
73
+ return /*#__PURE__*/React.createElement(StyledSplitLayout, {
74
+ ref: ref,
75
+ $direction: direction
76
+ }, content);
77
+ };
78
+ SplitLayout.displayName = 'SplitLayout';
79
+ export default SplitLayout;
80
+ //# sourceMappingURL=SplitLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplitLayout.js","names":["React","useCallback","useEffect","useMemo","useRef","useState","ResizeHandle","StyledSplitLayout","StyledSplitLayoutPane","SplitLayoutDirection","getContainerSizeByDirection","getVisibleViewIds","SplitLayout","direction","HORIZONTAL","handleSize","views","onChange","fullScreenViewId","ref","sizes","setSizes","containerSize","setContainerSize","current","element","updateSize","observer","ResizeObserver","observe","disconnect","viewIdsToDisplay","handleResize","key","delta","prev","nextSize","defaultSize","minSize","maxSize","Number","MAX_SAFE_INTEGER","clampedSize","Math","min","max","content","component","map","index","view","createElement","Fragment","$direction","$size","length","size","onDrag","displayName"],"sources":["../../../../src/components/split-layout/SplitLayout.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef, useState, type FC } from 'react';\nimport ResizeHandle from './resize-handle/ResizeHandle';\nimport { StyledSplitLayout, StyledSplitLayoutPane } from './SplitLayout.styles';\nimport { SplitLayoutDirection, type SplitLayoutProps } from './SplitLayout.types';\nimport { getContainerSizeByDirection, getVisibleViewIds } from './SplitLayout.utils';\n\nexport const SplitLayout: FC<SplitLayoutProps> = ({\n direction = SplitLayoutDirection.HORIZONTAL,\n handleSize = 2,\n views,\n onChange,\n fullScreenViewId,\n}) => {\n const ref = useRef<HTMLDivElement | null>(null);\n const [sizes, setSizes] = useState<Record<string, number>>({});\n const [containerSize, setContainerSize] = useState(0);\n\n useEffect(() => {\n if (!ref.current) {\n return () => {};\n }\n\n const element = ref.current;\n\n const updateSize = (): void => {\n setContainerSize(getContainerSizeByDirection(element, direction));\n };\n\n updateSize();\n\n const observer = new ResizeObserver(() => {\n updateSize();\n });\n\n observer.observe(element);\n\n return () => {\n observer.disconnect();\n };\n }, [direction]);\n\n const viewIdsToDisplay = useMemo(\n () =>\n getVisibleViewIds({\n views,\n containerSize,\n }),\n [views, containerSize],\n );\n\n const handleResize = useCallback(\n (key: string, delta: number) => {\n setSizes((prev) => {\n const nextSize = (prev[key] ?? views[key]?.defaultSize ?? 0) + delta;\n\n const minSize = views[key]?.minSize ?? 0;\n const maxSize = views[key]?.maxSize ?? Number.MAX_SAFE_INTEGER;\n\n const clampedSize = Math.min(Math.max(nextSize, minSize), maxSize);\n\n if (typeof onChange === 'function') {\n onChange(key, clampedSize);\n }\n\n return {\n ...prev,\n [key]: clampedSize,\n };\n });\n },\n [onChange, views],\n );\n\n const content = useMemo(() => {\n if (typeof fullScreenViewId === 'string' && views[fullScreenViewId]) {\n return views[fullScreenViewId].component;\n }\n\n return viewIdsToDisplay.map((key, index) => {\n const view = views[key];\n\n if (!view) {\n return null;\n }\n\n return (\n <React.Fragment key={key}>\n <StyledSplitLayoutPane\n $direction={direction}\n $size={sizes[key] ?? view.defaultSize ?? view.minSize ?? view.maxSize}\n >\n {view.component}\n </StyledSplitLayoutPane>\n\n {index < viewIdsToDisplay.length - 1 && (\n <ResizeHandle\n size={handleSize}\n direction={direction}\n onDrag={(delta) => handleResize(key, delta)}\n />\n )}\n </React.Fragment>\n );\n });\n }, [direction, fullScreenViewId, handleResize, handleSize, sizes, viewIdsToDisplay, views]);\n\n return (\n <StyledSplitLayout ref={ref} $direction={direction}>\n {content}\n </StyledSplitLayout>\n );\n};\n\nSplitLayout.displayName = 'SplitLayout';\n\nexport default SplitLayout;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAiB,OAAO;AACzF,OAAOC,YAAY,MAAM,8BAA8B;AACvD,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ,sBAAsB;AAC/E,SAASC,oBAAoB,QAA+B,qBAAqB;AACjF,SAASC,2BAA2B,EAAEC,iBAAiB,QAAQ,qBAAqB;AAEpF,OAAO,MAAMC,WAAiC,GAAGA,CAAC;EAC9CC,SAAS,GAAGJ,oBAAoB,CAACK,UAAU;EAC3CC,UAAU,GAAG,CAAC;EACdC,KAAK;EACLC,QAAQ;EACRC;AACJ,CAAC,KAAK;EACF,MAAMC,GAAG,GAAGf,MAAM,CAAwB,IAAI,CAAC;EAC/C,MAAM,CAACgB,KAAK,EAAEC,QAAQ,CAAC,GAAGhB,QAAQ,CAAyB,CAAC,CAAC,CAAC;EAC9D,MAAM,CAACiB,aAAa,EAAEC,gBAAgB,CAAC,GAAGlB,QAAQ,CAAC,CAAC,CAAC;EAErDH,SAAS,CAAC,MAAM;IACZ,IAAI,CAACiB,GAAG,CAACK,OAAO,EAAE;MACd,OAAO,MAAM,CAAC,CAAC;IACnB;IAEA,MAAMC,OAAO,GAAGN,GAAG,CAACK,OAAO;IAE3B,MAAME,UAAU,GAAGA,CAAA,KAAY;MAC3BH,gBAAgB,CAACb,2BAA2B,CAACe,OAAO,EAAEZ,SAAS,CAAC,CAAC;IACrE,CAAC;IAEDa,UAAU,CAAC,CAAC;IAEZ,MAAMC,QAAQ,GAAG,IAAIC,cAAc,CAAC,MAAM;MACtCF,UAAU,CAAC,CAAC;IAChB,CAAC,CAAC;IAEFC,QAAQ,CAACE,OAAO,CAACJ,OAAO,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AAgB,CAACiB,GAAG,CAAC,CAACf,GAAG,EAAEgB,KAAK,KAAK;MACxC,MAAMC,IAAI,GAAGlC,KAAK,CAACiB,GAAG,CAAC;MAEvB,IAAI,CAACiB,IAAI,EAAE;QACP,OAAO,IAAI;MACf;MAEA,oBACIlD,KAAA,CAAAmD,aAAA,CAACnD,KAAK,CAACoD,QAAQ;QAACnB,GAAG,EAAEA;MAAI,gBACrBjC,KAAA,CAAAmD,aAAA,CAAC3C,qBAAqB;QAClB6C,UAAU,EAAExC,SAAU;QACtByC,KAAK,EAAElC,KAAK,CAACa,GAAG,CAAC,IAAIiB,IAAI,CAACb,WAAW,IAAIa,IAAI,CAACZ,OAAO,IAAIY,IAAI,CAACX;MAAQ,GAErEW,IAAI,CAACH,SACa,CAAC,EAEvBE,KAAK,GAAGlB,gBAAgB,CAACwB,MAAM,GAAG,CAAC,iBAChCvD,KAAA,CAAAmD,aAAA,CAAC7C,YAAY;QACTkD,IAAI,EAAEzC,UAAW;QACjBF,SAAS,EAAEA,SAAU;QACrB4C,MAAM,EAAGvB,KAAK,IAAKF,YAAY,CAACC,GAAG,EAAEC,KAAK;MAAE,CAC/C,CAEO,CAAC;IAEzB,CAAC,CAAC;EACN,CAAC,EAAE,CAACrB,SAAS,EAAEK,gBAAgB,EAAEc,YAAY,EAAEjB,UAAU,EAAEK,KAAK,EAAEW,gBAAgB,EAAEf,KAAK,CAAC,CAAC;EAE3F,oBACIhB,KAAA,CAAAmD,aAAA,CAAC5C,iBAAiB;IAACY,GAAG,EAAEA,GAAI;IAACkC,UAAU,EAAExC;EAAU,GAC9CiC,OACc,CAAC;AAE5B,CAAC;AAEDlC,WAAW,CAAC8C,WAAW,GAAG,aAAa;AAEvC,eAAe9C,WAAW","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ import styled, { css } from 'styled-components';
2
+ import { SplitLayoutDirection } from './SplitLayout.types';
3
+ export const StyledSplitLayout = styled.div`
4
+ display: flex;
5
+ width: 100%;
6
+ height: 100%;
7
+ min-width: 0;
8
+ min-height: 0;
9
+ overflow: hidden;
10
+
11
+ ${({
12
+ $direction
13
+ }) => $direction === SplitLayoutDirection.HORIZONTAL ? css`
14
+ flex-direction: row;
15
+ ` : css`
16
+ flex-direction: column;
17
+ `}
18
+ `;
19
+ export const StyledSplitLayoutPane = styled.div`
20
+ position: relative;
21
+ flex: 0 0 auto;
22
+ overflow: hidden;
23
+
24
+ ${({
25
+ $direction,
26
+ $size
27
+ }) => $direction === SplitLayoutDirection.HORIZONTAL ? css`
28
+ min-width: 0;
29
+ height: 100%;
30
+ width: ${$size ? `${$size}px` : '100%'};
31
+ ` : css`
32
+ min-height: 0;
33
+ width: 100%;
34
+ height: ${$size ? `${$size}px` : '100%'};
35
+ `}
36
+ `;
37
+ //# sourceMappingURL=SplitLayout.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplitLayout.styles.js","names":["styled","css","SplitLayoutDirection","StyledSplitLayout","div","$direction","HORIZONTAL","StyledSplitLayoutPane","$size"],"sources":["../../../../src/components/split-layout/SplitLayout.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { SplitLayoutDirection } from './SplitLayout.types';\nimport { WithTheme } from '@chayns-components/core';\n\ntype StyledSplitLayoutProps = WithTheme<{\n $direction: SplitLayoutDirection;\n}>;\n\nexport const StyledSplitLayout = styled.div<StyledSplitLayoutProps>`\n display: flex;\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n overflow: hidden;\n\n ${({ $direction }) =>\n $direction === SplitLayoutDirection.HORIZONTAL\n ? css`\n flex-direction: row;\n `\n : css`\n flex-direction: column;\n `}\n`;\n\ntype StyledSplitLayoutPaneProps = WithTheme<{\n $direction: SplitLayoutDirection;\n $size?: number;\n}>;\n\nexport const StyledSplitLayoutPane = styled.div<StyledSplitLayoutPaneProps>`\n position: relative;\n flex: 0 0 auto;\n overflow: hidden;\n\n ${({ $direction, $size }) =>\n $direction === SplitLayoutDirection.HORIZONTAL\n ? css`\n min-width: 0;\n height: 100%;\n width: ${$size ? `${$size}px` : '100%'};\n `\n : css`\n min-height: 0;\n width: 100%;\n height: ${$size ? `${$size}px` : '100%'};\n `}\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAC/C,SAASC,oBAAoB,QAAQ,qBAAqB;AAO1D,OAAO,MAAMC,iBAAiB,GAAGH,MAAM,CAACI,GAA2B;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAW,CAAC,KACbA,UAAU,KAAKH,oBAAoB,CAACI,UAAU,GACxCL,GAAG;AACjB;AACA,eAAe,GACDA,GAAG;AACjB;AACA,eAAe;AACf,CAAC;AAOD,OAAO,MAAMM,qBAAqB,GAAGP,MAAM,CAACI,GAA+B;AAC3E;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC,UAAU;EAAEG;AAAM,CAAC,KACpBH,UAAU,KAAKH,oBAAoB,CAACI,UAAU,GACxCL,GAAG;AACjB;AACA;AACA,2BAA2BO,KAAK,GAAG,GAAGA,KAAK,IAAI,GAAG,MAAM;AACxD,eAAe,GACDP,GAAG;AACjB;AACA;AACA,4BAA4BO,KAAK,GAAG,GAAGA,KAAK,IAAI,GAAG,MAAM;AACzD,eAAe;AACf,CAAC","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ export let SplitLayoutDirection = /*#__PURE__*/function (SplitLayoutDirection) {
2
+ SplitLayoutDirection["HORIZONTAL"] = "HORIZONTAL";
3
+ SplitLayoutDirection["VERTICAL"] = "VERTICAL";
4
+ return SplitLayoutDirection;
5
+ }({});
6
+ //# sourceMappingURL=SplitLayout.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplitLayout.types.js","names":["SplitLayoutDirection"],"sources":["../../../../src/components/split-layout/SplitLayout.types.ts"],"sourcesContent":["import { ReactNode } from 'react';\n\nexport interface SplitLayoutProps {\n views: Record<string, SplitLayoutView>;\n direction?: SplitLayoutDirection;\n handleSize?: number;\n fullScreenViewId?: string;\n onChange?: (id: string, size: number) => void;\n}\n\nexport interface SplitLayoutView {\n component: ReactNode;\n minSize?: number;\n maxSize?: number;\n collapseBreakpoint?: number;\n defaultSize?: number;\n}\n\nexport enum SplitLayoutDirection {\n HORIZONTAL = 'HORIZONTAL',\n VERTICAL = 'VERTICAL',\n}\n"],"mappings":"AAkBA,WAAYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ import { SplitLayoutDirection } from './SplitLayout.types';
2
+ export const getVisibleViewIds = ({
3
+ views,
4
+ containerSize
5
+ }) => Object.entries(views).filter(([, view]) => {
6
+ if (typeof view.collapseBreakpoint !== 'number') {
7
+ return true;
8
+ }
9
+ return containerSize >= view.collapseBreakpoint;
10
+ }).map(([id]) => id);
11
+ export const getContainerSizeByDirection = (element, direction) => {
12
+ if (!element) {
13
+ return 0;
14
+ }
15
+ return direction === SplitLayoutDirection.HORIZONTAL ? element.clientWidth : element.clientHeight;
16
+ };
17
+ //# sourceMappingURL=SplitLayout.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplitLayout.utils.js","names":["SplitLayoutDirection","getVisibleViewIds","views","containerSize","Object","entries","filter","view","collapseBreakpoint","map","id","getContainerSizeByDirection","element","direction","HORIZONTAL","clientWidth","clientHeight"],"sources":["../../../../src/components/split-layout/SplitLayout.utils.ts"],"sourcesContent":["import { SplitLayoutDirection, SplitLayoutView } from './SplitLayout.types';\n\ninterface GetVisibleViewIdsOptions {\n views: Record<string, SplitLayoutView>;\n containerSize: number;\n}\n\nexport const getVisibleViewIds = ({ views, containerSize }: GetVisibleViewIdsOptions): string[] =>\n Object.entries(views)\n .filter(([, view]) => {\n if (typeof view.collapseBreakpoint !== 'number') {\n return true;\n }\n\n return containerSize >= view.collapseBreakpoint;\n })\n .map(([id]) => id);\n\nexport const getContainerSizeByDirection = (\n element: HTMLDivElement | null,\n direction: SplitLayoutDirection,\n): number => {\n if (!element) {\n return 0;\n }\n\n return direction === SplitLayoutDirection.HORIZONTAL\n ? element.clientWidth\n : element.clientHeight;\n};\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAyB,qBAAqB;AAO3E,OAAO,MAAMC,iBAAiB,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAwC,CAAC,KAChFC,MAAM,CAACC,OAAO,CAACH,KAAK,CAAC,CAChBI,MAAM,CAAC,CAAC,GAAGC,IAAI,CAAC,KAAK;EAClB,IAAI,OAAOA,IAAI,CAACC,kBAAkB,KAAK,QAAQ,EAAE;IAC7C,OAAO,IAAI;EACf;EAEA,OAAOL,aAAa,IAAII,IAAI,CAACC,kBAAkB;AACnD,CAAC,CAAC,CACDC,GAAG,CAAC,CAAC,CAACC,EAAE,CAAC,KAAKA,EAAE,CAAC;AAE1B,OAAO,MAAMC,2BAA2B,GAAGA,CACvCC,OAA8B,EAC9BC,SAA+B,KACtB;EACT,IAAI,CAACD,OAAO,EAAE;IACV,OAAO,CAAC;EACZ;EAEA,OAAOC,SAAS,KAAKb,oBAAoB,CAACc,UAAU,GAC9CF,OAAO,CAACG,WAAW,GACnBH,OAAO,CAACI,YAAY;AAC9B,CAAC","ignoreList":[]}
@@ -0,0 +1,54 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import { SplitLayoutDirection } from '../SplitLayout.types';
3
+ const getPointerPosition = (event, direction) => direction === SplitLayoutDirection.HORIZONTAL ? event.clientX : event.clientY;
4
+ export const useDragHandle = ({
5
+ direction,
6
+ onDrag,
7
+ onDragStart,
8
+ onDragEnd
9
+ }) => {
10
+ const startPositionRef = useRef(0);
11
+ const cleanupRef = useRef(null);
12
+ useEffect(() => () => {
13
+ cleanupRef.current?.();
14
+ cleanupRef.current = null;
15
+ }, []);
16
+ return useCallback(event => {
17
+ event.preventDefault();
18
+ startPositionRef.current = getPointerPosition(event, direction);
19
+ const originalUserSelect = document.body.style.userSelect;
20
+ const originalCursor = document.body.style.cursor;
21
+ document.body.style.userSelect = 'none';
22
+ document.body.style.cursor = direction === SplitLayoutDirection.HORIZONTAL ? 'col-resize' : 'row-resize';
23
+ event.currentTarget.setPointerCapture?.(event.pointerId);
24
+ if (typeof onDragStart === 'function') {
25
+ onDragStart();
26
+ }
27
+ const onMove = moveEvent => {
28
+ moveEvent.preventDefault();
29
+ const currentPosition = getPointerPosition(moveEvent, direction);
30
+ const delta = currentPosition - startPositionRef.current;
31
+ startPositionRef.current = currentPosition;
32
+ onDrag(delta);
33
+ };
34
+ const cleanup = () => {
35
+ document.body.style.userSelect = originalUserSelect;
36
+ document.body.style.cursor = originalCursor;
37
+ window.removeEventListener('pointermove', onMove);
38
+ window.removeEventListener('pointerup', onUp);
39
+ window.removeEventListener('pointercancel', onUp);
40
+ cleanupRef.current = null;
41
+ };
42
+ const onUp = () => {
43
+ cleanup();
44
+ if (typeof onDragEnd === 'function') {
45
+ onDragEnd();
46
+ }
47
+ };
48
+ cleanupRef.current = cleanup;
49
+ window.addEventListener('pointermove', onMove);
50
+ window.addEventListener('pointerup', onUp);
51
+ window.addEventListener('pointercancel', onUp);
52
+ }, [direction, onDrag, onDragEnd, onDragStart]);
53
+ };
54
+ //# sourceMappingURL=ResizeHandle.hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResizeHandle.hooks.js","names":["useCallback","useEffect","useRef","SplitLayoutDirection","getPointerPosition","event","direction","HORIZONTAL","clientX","clientY","useDragHandle","onDrag","onDragStart","onDragEnd","startPositionRef","cleanupRef","current","preventDefault","originalUserSelect","document","body","style","userSelect","originalCursor","cursor","currentTarget","setPointerCapture","pointerId","onMove","moveEvent","currentPosition","delta","cleanup","window","removeEventListener","onUp","addEventListener"],"sources":["../../../../../src/components/split-layout/resize-handle/ResizeHandle.hooks.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, type PointerEvent as ReactPointerEvent } from 'react';\nimport { SplitLayoutDirection } from '../SplitLayout.types';\n\nexport interface UseDragHandleOptions {\n direction: SplitLayoutDirection;\n onDrag: (delta: number) => void;\n onDragStart?: () => void;\n onDragEnd?: () => void;\n}\n\nconst getPointerPosition = (\n event: PointerEvent | ReactPointerEvent,\n direction: SplitLayoutDirection,\n): number => (direction === SplitLayoutDirection.HORIZONTAL ? event.clientX : event.clientY);\n\nexport const useDragHandle = ({\n direction,\n onDrag,\n onDragStart,\n onDragEnd,\n}: UseDragHandleOptions): ((e: ReactPointerEvent<HTMLElement>) => void) => {\n const startPositionRef = useRef(0);\n const cleanupRef = useRef<(() => void) | null>(null);\n\n useEffect(\n () => () => {\n cleanupRef.current?.();\n cleanupRef.current = null;\n },\n [],\n );\n\n return useCallback(\n (event: ReactPointerEvent<HTMLElement>) => {\n event.preventDefault();\n\n startPositionRef.current = getPointerPosition(event, direction);\n\n const originalUserSelect = document.body.style.userSelect;\n const originalCursor = document.body.style.cursor;\n\n document.body.style.userSelect = 'none';\n document.body.style.cursor =\n direction === SplitLayoutDirection.HORIZONTAL ? 'col-resize' : 'row-resize';\n\n event.currentTarget.setPointerCapture?.(event.pointerId);\n\n if (typeof onDragStart === 'function') {\n onDragStart();\n }\n\n const onMove = (moveEvent: PointerEvent) => {\n moveEvent.preventDefault();\n\n const currentPosition = getPointerPosition(moveEvent, direction);\n const delta = currentPosition - startPositionRef.current;\n\n startPositionRef.current = currentPosition;\n\n onDrag(delta);\n };\n\n const cleanup = () => {\n document.body.style.userSelect = originalUserSelect;\n document.body.style.cursor = originalCursor;\n\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n window.removeEventListener('pointercancel', onUp);\n\n cleanupRef.current = null;\n };\n\n const onUp = () => {\n cleanup();\n\n if (typeof onDragEnd === 'function') {\n onDragEnd();\n }\n };\n\n cleanupRef.current = cleanup;\n\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n window.addEventListener('pointercancel', onUp);\n },\n [direction, onDrag, onDragEnd,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izeHandle, StyledResizeHandleDrag, StyledResizeHandleLine } from './ResizeHandle.styles';
3
+ import { useDragHandle } from './ResizeHandle.hooks';
4
+ const ResizeHandle = ({
5
+ onDrag,
6
+ onDragStart,
7
+ onDragEnd,
8
+ direction,
9
+ size
10
+ }) => {
11
+ const handlePointerDown = useDragHandle({
12
+ direction,
13
+ onDrag,
14
+ onDragStart,
15
+ onDragEnd
16
+ });
17
+ return /*#__PURE__*/React.createElement(StyledResizeHandle, {
18
+ $direction: direction,
19
+ $size: size
20
+ }, /*#__PURE__*/React.createElement(StyledResizeHandleDrag, {
21
+ $direction: direction,
22
+ onPointerDown: handlePointerDown
23
+ }), /*#__PURE__*/React.createElement(StyledResizeHandleLine, null));
24
+ };
25
+ ResizeHandle.displayName = 'ResizeHandle';
26
+ export default ResizeHandle;
27
+ //# sourceMappingURL=ResizeHandle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResizeHandle.js","names":["React","StyledResizeHandle","StyledResizeHandleDrag","StyledResizeHandleLine","useDragHandle","ResizeHandle","onDrag","onDragStart","onDragEnd","direction","size","handlePointerDown","createElement","$direction","$size","onPointerDown","displayName"],"sources":["../../../../../src/components/split-layout/resize-handle/ResizeHandle.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport {\n StyledResizeHandle,\n StyledResizeHandleDrag,\n StyledResizeHandleLine,\n} from './ResizeHandle.styles';\nimport { useDragHandle } from './ResizeHandle.hooks';\nimport { SplitLayoutDirection } from '../SplitLayout.types';\n\ninterface ResizeHandleProps {\n onDrag: (delta: number) => void;\n onDragStart?: () => void;\n onDragEnd?: () => void;\n direction: SplitLayoutDirection;\n size: number;\n}\n\nconst ResizeHandle: FC<ResizeHandleProps> = ({\n onDrag,\n onDragStart,\n onDragEnd,\n direction,\n size,\n}) => {\n const handlePointerDown = useDragHandle({\n direction,\n onDrag,\n onDragStart,\n onDragEnd,\n });\n\n return (\n <StyledResizeHandle $direction={direction} $size={size}>\n <StyledResizeHandleDrag $direction={direction} onPointerDown={handlePointerDown} />\n <StyledResizeHandleLine />\n </StyledResizeHandle>\n );\n};\n\nResizeHandle.displayName = 'ResizeHandle';\n\nexport default ResizeHandle;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAc,OAAO;AACjC,SACIC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,QACnB,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,sBAAsB;AAWpD,MAAMC,YAAmC,GAAGA,CAAC;EACzCC,MAAM;EACNC,WAAW;EACXC,SAAS;EACTC,SAAS;EACTC;AACJ,CAAC,KAAK;EACF,MAAMC,iBAAiB,GAAGP,aAAa,CAAC;IACpCK,SAAS;IACTH,MAAM;IACNC,WAAW;IACXC;EACJ,CAAC,CAAC;EAEF,oBACIR,KAAA,CAAAY,aAAA,CAACX,kBAAkB;IAACY,UAAU,EAAEJ,SAAU;IAACK,KAAK,EAAEJ;EAAK,gBACnDV,KAAA,CAAAY,aAAA,CAACV,sBAAsB;IAACW,UAAU,EAAEJ,SAAU;IAACM,aAAa,EAAEJ;EAAkB,CAAE,CAAC,eACnFX,KAAA,CAAAY,aAAA,CAACT,sBAAsB,MAAE,CACT,CAAC;AAE7B,CAAC;AAEDE,YAAY,CAACW,WAAW,GAAG,cAAc;AAEzC,eAAeX,YAAY","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ import { css, styled } from 'styled-components';
2
+ import { SplitLayoutDirection } from '../SplitLayout.types';
3
+ export const StyledResizeHandle = styled.div`
4
+ position: relative;
5
+ flex-shrink: 0;
6
+ width: ${({
7
+ $direction,
8
+ $size
9
+ }) => $direction === SplitLayoutDirection.HORIZONTAL ? `${$size}px` : '100%'};
10
+ height: ${({
11
+ $direction,
12
+ $size
13
+ }) => $direction === SplitLayoutDirection.VERTICAL ? `${$size}px` : '100%'};
14
+ `;
15
+ export const StyledResizeHandleLine = styled.div`
16
+ width: 100%;
17
+ height: 100%;
18
+ background-color: ${({
19
+ theme
20
+ }) => theme['002']};
21
+ position: relative;
22
+ z-index: 10;
23
+ `;
24
+ export const StyledResizeHandleDrag = styled.div`
25
+ position: absolute;
26
+
27
+ opacity: 0;
28
+ z-index: 20;
29
+
30
+ ${({
31
+ $direction
32
+ }) => $direction === SplitLayoutDirection.HORIZONTAL ? css`
33
+ cursor: col-resize;
34
+
35
+ transform: translateX(-50%);
36
+ top: 0;
37
+ left: 50%;
38
+
39
+ width: 20px;
40
+ height: 100%;
41
+ ` : css`
42
+ cursor: row-resize;
43
+ transform: translateY(-50%);
44
+
45
+ top: 50%;
46
+ left: 0;
47
+
48
+ width: 100%;
49
+ height: 20px;
50
+ `}
51
+ `;
52
+ //# sourceMappingURL=ResizeHandle.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResizeHandle.styles.js","names":["css","styled","SplitLayoutDirection","StyledResizeHandle","div","$direction","$size","HORIZONTAL","VERTICAL","StyledResizeHandleLine","theme","StyledResizeHandleDrag"],"sources":["../../../../../src/components/split-layout/resize-handle/ResizeHandle.styles.ts"],"sourcesContent":["import { css, styled } from 'styled-components';\nimport { WithTheme } from '@chayns-components/core';\nimport { SplitLayoutDirection } from '../SplitLayout.types';\n\ntype StyledResizeHandleProps = WithTheme<{ $direction: SplitLayoutDirection; $size: number }>;\n\nexport const StyledResizeHandle = styled.div<StyledResizeHandleProps>`\n position: relative;\n flex-shrink: 0;\n width: ${({ $direction, $size }) =>\n $direction === SplitLayoutDirection.HORIZONTAL ? `${$size}px` : '100%'};\n height: ${({ $direction, $size }) =>\n $direction === SplitLayoutDirection.VERTICAL ? `${$size}px` : '100%'};\n`;\n\ntype StyledResizeHandleLineProps = WithTheme<unknown>;\n\nexport const StyledResizeHandleLine = styled.div<StyledResizeHandleLineProps>`\n width: 100%;\n height: 100%;\n background-color: ${({ theme }) => theme['002']};\n position: relative;\n z-index: 10;\n`;\n\ntype StyledResizeHandleDragProps = WithTheme<{ $direction: SplitLayoutDirection }>;\n\nexport const StyledResizeHandleDrag = styled.div<StyledResizeHandleDragProps>`\n position: absolute;\n\n opacity: 0;\n z-index: 20;\n\n ${({ $direction }) =>\n $direction === SplitLayoutDirection.HORIZONTAL\n ? css`\n cursor: col-resize;\n\n transform: translateX(-50%);\n top: 0;\n left: 50%;\n\n width: 20px;\n height: 100%;\n `\n : css`\n cursor: row-resize;\n transform: translateY(-50%);\n\n top: 50%;\n left: 0;\n\n width: 100%;\n height: 20px;\n `}\n`;\n"],"mappings":"AAAA,SAASA,GAAG,EAAEC,MAAM,QAAQ,mBAAmB;AAE/C,SAASC,oBAAoB,QAAQ,sBAAsB;AAI3D,OAAO,MAAMC,kBAAkB,GAAGF,MAAM,CAACG,GAA4B;AACrE;AACA;AACA,aAAa,CAAC;EAAEC,UAAU;EAAEC;AAAM,CAAC,KAC3BD,UAAU,KAAKH,oBAAoB,CAACK,UAAU,GAAG,GAAGD,KAAK,IAAI,GAAG,MAAM;AAC9E,cAAc,CAAC;EAAED,UAAU;EAAEC;AAAM,CAAC,KAC5BD,UAAU,KAAKH,oBAAoB,CAACM,QAAQ,GAAG,GAAGF,KAAK,IAAI,GAAG,MAAM;AAC5E,CAAC;AAID,OAAO,MAAMG,sBAAsB,GAAGR,MAAM,CAACG,GAAgC;AAC7E;AACA;AACA,wBAAwB,CAAC;EAAEM;AAAM,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACnD;AACA;AACA,CAAC;AAID,OAAO,MAAMC,sBAAsB,GAAGV,MAAM,CAACG,GAAgC;AAC7E;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAW,CAAC,KACbA,UAAU,KAAKH,oBAAoB,CAACK,UAAU,GACxCP,GAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,GACDA,GAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,CAAC","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ import React, { useMemo } from 'react';
2
+ import { StyledUserImage, StyledUserImageUser } from './userImage.styles';
3
+ import { Popup } from '@chayns-components/core';
4
+ import { useUser } from 'chayns-api';
5
+ const UserImage = ({
6
+ size = 35,
7
+ personId,
8
+ popupContent,
9
+ yOffset = -10,
10
+ onClick
11
+ }) => {
12
+ const user = useUser();
13
+ const src = useMemo(() => `https://tsimg.cloud/${personId || user.personId || ''}/profile_w200-h200.png`, [personId, user]);
14
+ return /*#__PURE__*/React.createElement(StyledUserImage, {
15
+ $size: size
16
+ }, popupContent ? /*#__PURE__*/React.createElement(Popup, {
17
+ content: popupContent,
18
+ yOffset: yOffset
19
+ }, /*#__PURE__*/React.createElement(StyledUserImageUser, {
20
+ $size: size,
21
+ src: src,
22
+ onClick: onClick
23
+ })) : /*#__PURE__*/React.createElement(StyledUserImageUser, {
24
+ $size: size,
25
+ src: src,
26
+ onClick: onClick
27
+ }));
28
+ };
29
+ UserImage.displayName = 'UserImage';
30
+ export default UserImage;
31
+ //# sourceMappingURL=UserImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserImage.js","names":["React","useMemo","StyledUserImage","StyledUserImageUser","Popup","useUser","UserImage","size","personId","popupContent","yOffset","onClick","user","src","createElement","$size","content","displayName"],"sources":["../../../../src/components/user-image/UserImage.tsx"],"sourcesContent":["import React, { FC, useMemo } from 'react';\nimport { StyledUserImage, StyledUserImageUser } from './userImage.styles';\nimport { UserImageProps } from './UserImage.types';\nimport { Popup } from '@chayns-components/core';\nimport { useUser } from 'chayns-api';\n\nconst UserImage: FC<UserImageProps> = ({\n size = 35,\n personId,\n popupContent,\n yOffset = -10,\n onClick,\n}) => {\n const user = useUser();\n\n const src = useMemo(\n () => `https://tsimg.cloud/${personId || user.personId || ''}/profile_w200-h200.png`,\n [personId, user],\n );\n\n return (\n <StyledUserImage $size={size}>\n {popupContent ? (\n <Popup content={popupContent} yOffset={yOffset}>\n <StyledUserImageUser $size={size} src={src} onClick={onClick} />\n </Popup>\n ) : (\n <StyledUserImageUser $size={size} src={src} onClick={onClick} />\n )}\n </StyledUserImage>\n );\n};\n\nUserImage.displayName = 'UserImage';\n\nexport default UserImage;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,OAAO,QAAQ,OAAO;AAC1C,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,oBAAoB;AAEzE,SAASC,KAAK,QAAQ,yBAAyB;AAC/C,SAASC,OAAO,QAAQ,YAAY;AAEpC,MAAMC,SAA6B,GAAGA,CAAC;EACnCC,IAAI,GAAG,EAAE;EACTC,QAAQ;EACRC,YAAY;EACZC,OAAO,GAAG,CAAC,EAAE;EACbC;AACJ,CAAC,KAAK;EACF,MAAMC,IAAI,GAAGP,OAAO,CAAC,CAAC;EAEtB,MAAMQ,GAAG,GAAGZ,OAAO,CACf,MAAM,uBAAuBO,QAAQ,IAAII,IAAI,CAACJ,QAAQ,IAAI,EAAE,wBAAwB,EACpF,CAACA,QAAQ,EAAEI,IAAI,CACnB,CAAC;EAED,oBACIZ,KAAA,CAAAc,aAAA,CAACZ,eAAe;IAACa,KAAK,EAAER;EAAK,GACxBE,YAAY,gBACTT,KAAA,CAAAc,aAAA,CAACV,KAAK;IAACY,OAAO,EAAEP,YAAa;IAACC,OAAO,EAAEA;EAAQ,gBAC3CV,KAAA,CAAAc,aAAA,CAACX,mBAAmB;IAACY,KAAK,EAAER,IAAK;IAACM,GAAG,EAAEA,GAAI;IAACF,OAAO,EAAEA;EAAQ,CAAE,CAC5D,CAAC,gBAERX,KAAA,CAAAc,aAAA,CAACX,mBAAmB;IAACY,KAAK,EAAER,IAAK;IAACM,GAAG,EAAEA,GAAI;IAACF,OAAO,EAAEA;EAAQ,CAAE,CAEtD,CAAC;AAE1B,CAAC;AAEDL,SAAS,CAACW,WAAW,GAAG,WAAW;AAEnC,eAAeX,SAAS","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=UserImage.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserImage.types.js","names":[],"sources":["../../../../src/components/user-image/UserImage.types.ts"],"sourcesContent":["import { ReactNode } from 'react';\n\nexport interface UserImageProps {\n personId?: string;\n size?: number;\n yOffset?: number;\n popupContent?: ReactNode;\n onClick?: () => void;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ import styled from 'styled-components';
2
+ export const StyledUserImage = styled.div`
3
+ height: ${({
4
+ $size
5
+ }) => $size}px;
6
+
7
+ aspect-ratio: 1;
8
+ `;
9
+ export const StyledUserImageUser = styled.img`
10
+ height: ${({
11
+ $size
12
+ }) => $size}px;
13
+
14
+ aspect-ratio: 1;
15
+
16
+ border-radius: 50%;
17
+ border: 1px solid rgba(0, 0, 0, 0.1);
18
+ cursor: pointer;
19
+ `;
20
+ //# sourceMappingURL=userImage.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userImage.styles.js","names":["styled","StyledUserImage","div","$size","StyledUserImageUser","img"],"sources":["../../../../src/components/user-image/userImage.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { WithTheme } from '@chayns-components/core';\n\ntype StyledUserImageProps = WithTheme<{ $size: number }>;\n\nexport const StyledUserImage = styled.div<StyledUserImageProps>`\n height: ${({ $size }) => $size}px;\n\n aspect-ratio: 1;\n`;\n\ntype StyledUserImageUserProps = WithTheme<{ $size: number }>;\n\nexport const StyledUserImageUser = styled.img<StyledUserImageUserProps>`\n height: ${({ $size }) => $size}px;\n\n aspect-ratio: 1;\n\n border-radius: 50%;\n border: 1px solid rgba(0, 0, 0, 0.1);\n cursor: pointer;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAKtC,OAAO,MAAMC,eAAe,GAAGD,MAAM,CAACE,GAAyB;AAC/D,cAAc,CAAC;EAAEC;AAAM,CAAC,KAAKA,KAAK;AAClC;AACA;AACA,CAAC;AAID,OAAO,MAAMC,mBAAmB,GAAGJ,MAAM,CAACK,GAA6B;AACvE,cAAc,CAAC;EAAEF;AAAM,CAAC,KAAKA,KAAK;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}