@zohodesk/components 1.0.0-alpha-245 → 1.0.0-alpha-248

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 (337) hide show
  1. package/README.md +1071 -1061
  2. package/docs/external/active-line.js +72 -72
  3. package/docs/external/autorefresh.js +47 -47
  4. package/docs/external/codemirror.js +9681 -9681
  5. package/docs/external/css/hopscotch.css +576 -576
  6. package/docs/external/css/styleGuide.css +1100 -1100
  7. package/docs/external/css.js +466 -466
  8. package/docs/external/designTokens.js +1 -1
  9. package/docs/external/foldcode.js +151 -151
  10. package/docs/external/format.js +129 -129
  11. package/docs/external/htmlmixed.js +84 -84
  12. package/docs/external/index.html +127 -127
  13. package/docs/external/javascript.js +422 -422
  14. package/docs/external/jsx.js +147 -147
  15. package/docs/external/matchbrackets.js +145 -145
  16. package/docs/external/xml.js +322 -322
  17. package/docs/package.json +41 -41
  18. package/docs/src/index.js +1311 -1311
  19. package/es/AppContainer/AppContainer.module.css +18 -18
  20. package/es/Avatar/Avatar.js +9 -9
  21. package/es/Avatar/Avatar.module.css +117 -117
  22. package/es/Avatar/__tests__/__snapshots__/Avatar.spec.js.snap +288 -288
  23. package/es/AvatarTeam/AvatarTeam.js +7 -7
  24. package/es/AvatarTeam/AvatarTeam.module.css +161 -161
  25. package/es/AvatarTeam/__tests__/__snapshots__/AvatarTeam.spec.js.snap +226 -226
  26. package/es/AvatarTeam/docs/AvatarTeam__custom.docs.js +0 -0
  27. package/es/AvatarTeam/docs/AvatarTeam__default.docs.js +0 -0
  28. package/es/AvatarTeam/docs/AvatarTeam__palette.docs.js +0 -0
  29. package/es/AvatarTeam/docs/AvatarTeam__size.docs.js +0 -0
  30. package/es/Button/Button.js +4 -4
  31. package/es/Button/Button.module.css +521 -521
  32. package/es/Button/__tests__/__snapshots__/Button.spec.js.snap +191 -191
  33. package/es/Button/docs/Button__custom.docs.js +0 -0
  34. package/es/Button/docs/Button__default.docs.js +0 -0
  35. package/es/Buttongroup/Buttongroup.js +1 -1
  36. package/es/Buttongroup/Buttongroup.module.css +89 -89
  37. package/es/Buttongroup/__test__/__snapshots__/Buttongroup.spec.js.snap +146 -146
  38. package/es/Card/Card.js +12 -7
  39. package/es/Card/Card.module.css +20 -20
  40. package/es/Card/docs/Card__Custom.docs.js +0 -0
  41. package/es/Card/docs/Card__Default.docs.js +0 -0
  42. package/es/Card/docs/Card__Scroll.docs.js +0 -0
  43. package/es/CheckBox/CheckBox.js +0 -0
  44. package/es/CheckBox/CheckBox.module.css +157 -153
  45. package/es/CheckBox/docs/CheckBox__custom.docs.js +0 -0
  46. package/es/CheckBox/docs/CheckBox__default.docs.js +0 -0
  47. package/es/DateTime/CalendarView.js +0 -0
  48. package/es/DateTime/DateTime.js +0 -0
  49. package/es/DateTime/DateTime.module.css +187 -187
  50. package/es/DateTime/DateWidget.js +0 -0
  51. package/es/DateTime/DateWidget.module.css +38 -38
  52. package/es/DateTime/YearView.js +0 -0
  53. package/es/DateTime/YearView.module.css +81 -81
  54. package/es/DateTime/common.js +0 -0
  55. package/es/DateTime/docs/DateTime__default.docs.js +0 -0
  56. package/es/DateTime/docs/DateWidget__default.docs.js +0 -0
  57. package/es/DateTime/index.js +0 -0
  58. package/es/DateTime/objectUtils.js +0 -0
  59. package/es/DateTime/typeChecker.js +0 -0
  60. package/es/DateTime/validator.js +0 -0
  61. package/es/DropBox/DropBox.js +0 -0
  62. package/es/DropBox/DropBox.module.css +406 -406
  63. package/es/DropBox/DropBoxPositionMapping.json +144 -144
  64. package/es/DropDown/DropDown.js +0 -0
  65. package/es/DropDown/DropDown.module.css +5 -5
  66. package/es/DropDown/DropDownHeading.js +0 -0
  67. package/es/DropDown/DropDownHeading.module.css +53 -53
  68. package/es/DropDown/DropDownItem.js +0 -0
  69. package/es/DropDown/DropDownItem.module.css +94 -94
  70. package/es/DropDown/DropDownSearch.js +0 -0
  71. package/es/DropDown/DropDownSearch.module.css +14 -14
  72. package/es/DropDown/DropDownSeparator.js +0 -0
  73. package/es/DropDown/DropDownSeparator.module.css +7 -7
  74. package/es/Label/Label.js +2 -2
  75. package/es/Label/Label.module.css +52 -52
  76. package/es/Label/LabelColors.module.css +20 -20
  77. package/es/Label/__tests__/__snapshots__/Label.spec.js.snap +101 -101
  78. package/es/Label/docs/Label__clipped.docs.js +0 -0
  79. package/es/Label/docs/Label__custom.docs.js +0 -0
  80. package/es/Label/docs/Label__palette.docs.js +0 -0
  81. package/es/Label/docs/Label__size.docs.js +0 -0
  82. package/es/Label/docs/Label__type.docs.js +0 -0
  83. package/es/Layout/Box.js +15 -30
  84. package/es/Layout/Container.js +15 -27
  85. package/es/Layout/Layout.module.css +336 -324
  86. package/es/Layout/docs/Layout__default.docs.js +0 -0
  87. package/es/Layout/docs/Layout__four_Column.docs.js +16 -22
  88. package/es/Layout/props/defaultProps.js +12 -0
  89. package/es/Layout/props/propTypes.js +42 -0
  90. package/es/Layout/utils.js +0 -0
  91. package/es/LightNightMode/Colors.json +496 -496
  92. package/es/ListItem/ListItem.js +0 -0
  93. package/es/ListItem/ListItem.module.css +209 -205
  94. package/es/MultiSelect/AdvancedGroupMultiSelect.js +6 -6
  95. package/es/MultiSelect/MultiSelect.js +5 -5
  96. package/es/MultiSelect/MultiSelect.module.css +205 -205
  97. package/es/MultiSelect/MultiSelectWithAvatar.js +0 -0
  98. package/es/MultiSelect/SelectedOptions.module.css +15 -15
  99. package/es/MultiSelect/__tests__/MultiSelect.spec.js +0 -0
  100. package/es/PopOver/PopOver.module.css +8 -8
  101. package/es/Popup/Popup.js +0 -0
  102. package/es/Popup/PositionMapping.json +73 -73
  103. package/es/Radio/Radio.js +0 -0
  104. package/es/Radio/Radio.module.css +112 -110
  105. package/es/Radio/docs/Radio__custom.docs.js +0 -0
  106. package/es/Radio/docs/Radio__default.docs.js +0 -0
  107. package/es/Responsive/CustomResponsive.js +0 -0
  108. package/es/Responsive/docs/Responsive__Custom.docs.js +0 -0
  109. package/es/Responsive/docs/style.module.css +55 -55
  110. package/es/ResponsiveDropBox/ResponsiveDropBox.module.css +6 -6
  111. package/es/Ribbon/Ribbon.js +0 -0
  112. package/es/Ribbon/Ribbon.module.css +376 -376
  113. package/es/Ribbon/__tests__/__snapshots__/Ribbon.spec.js.snap +163 -163
  114. package/es/Ribbon/docs/Ribbon__custom.docs.js +0 -0
  115. package/es/Ribbon/docs/Ribbon__default.docs.js +0 -0
  116. package/es/RippleEffect/RippleEffect.module.css +92 -70
  117. package/es/Select/GroupSelect.js +0 -0
  118. package/es/Select/Select.js +0 -0
  119. package/es/Select/Select.module.css +106 -106
  120. package/es/Select/SelectWithAvatar.js +0 -0
  121. package/es/Select/SelectWithIcon.js +0 -0
  122. package/es/Select/__tests__/Select.spec.js +0 -0
  123. package/es/Select/docs/SelectWithIcon__default.docs.js +0 -0
  124. package/es/Select/docs/Select__default.docs.js +0 -0
  125. package/es/Stencils/Stencils.js +0 -0
  126. package/es/Stencils/Stencils.module.css +96 -96
  127. package/es/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +49 -49
  128. package/es/Switch/Switch.js +0 -0
  129. package/es/Switch/Switch.module.css +110 -109
  130. package/es/Switch/docs/Switch__custom.docs.js +0 -0
  131. package/es/Switch/docs/Switch__default.docs.js +0 -0
  132. package/es/Tab/Tab.module.css +101 -101
  133. package/es/Tab/TabContent.module.css +4 -4
  134. package/es/Tab/Tabs.js +17 -17
  135. package/es/Tab/Tabs.module.css +141 -141
  136. package/es/Tab/docs/tabdocs.module.css +29 -29
  137. package/es/Tag/Tag.js +8 -8
  138. package/es/Tag/Tag.module.css +254 -254
  139. package/es/Tag/docs/Tag__custom.docs.js +0 -0
  140. package/es/Tag/docs/Tag__default.docs.js +0 -0
  141. package/es/TextBox/TextBox.js +0 -0
  142. package/es/TextBox/TextBox.module.css +157 -157
  143. package/es/TextBox/__tests__/__snapshots__/TextBox.spec.js.snap +127 -127
  144. package/es/TextBox/docs/TextBox__custom.docs.js +0 -0
  145. package/es/TextBox/docs/TextBox__default.docs.js +0 -0
  146. package/es/TextBox/docs/TextBox__variant.docs.js +0 -0
  147. package/es/TextBoxIcon/TextBoxIcon.js +0 -0
  148. package/es/TextBoxIcon/TextBoxIcon.module.css +78 -78
  149. package/es/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +334 -334
  150. package/es/TextBoxIcon/docs/TextBoxIcon__custom.docs.js +0 -0
  151. package/es/TextBoxIcon/docs/TextBoxIcon__default.docs.js +0 -0
  152. package/es/Textarea/Textarea.js +0 -0
  153. package/es/Textarea/Textarea.module.css +139 -139
  154. package/es/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +97 -97
  155. package/es/Textarea/docs/Textarea__custom.docs.js +0 -0
  156. package/es/Textarea/docs/Textarea__default.docs.js +0 -0
  157. package/es/Textarea/docs/Textarea__disabled.docs.js +0 -0
  158. package/es/Tooltip/Tooltip.module.css +109 -109
  159. package/es/common/animation.module.css +624 -624
  160. package/es/common/avatarsizes.module.css +44 -44
  161. package/es/common/basic.module.css +33 -33
  162. package/es/common/basicReset.module.css +40 -40
  163. package/es/common/common.module.css +525 -502
  164. package/es/common/customscroll.module.css +89 -89
  165. package/es/common/docStyle.module.css +766 -766
  166. package/es/common/reset.module.css +12 -12
  167. package/es/common/transition.module.css +146 -146
  168. package/es/deprecated/AdvancedMultiSelect.module.css +126 -126
  169. package/es/index.js +0 -4
  170. package/es/semantic/Button/semanticButton.module.css +9 -9
  171. package/es/utils/Common.js +0 -0
  172. package/es/utils/dropDownUtils.js +0 -0
  173. package/lib/AppContainer/AppContainer.module.css +18 -18
  174. package/lib/Avatar/Avatar.js +9 -9
  175. package/lib/Avatar/Avatar.module.css +117 -117
  176. package/lib/Avatar/__tests__/__snapshots__/Avatar.spec.js.snap +288 -288
  177. package/lib/AvatarTeam/AvatarTeam.js +7 -7
  178. package/lib/AvatarTeam/AvatarTeam.module.css +161 -161
  179. package/lib/AvatarTeam/__tests__/__snapshots__/AvatarTeam.spec.js.snap +226 -226
  180. package/lib/AvatarTeam/docs/AvatarTeam__custom.docs.js +0 -0
  181. package/lib/AvatarTeam/docs/AvatarTeam__default.docs.js +0 -0
  182. package/lib/AvatarTeam/docs/AvatarTeam__palette.docs.js +0 -0
  183. package/lib/AvatarTeam/docs/AvatarTeam__size.docs.js +0 -0
  184. package/lib/Button/Button.js +4 -4
  185. package/lib/Button/Button.module.css +521 -521
  186. package/lib/Button/__tests__/__snapshots__/Button.spec.js.snap +191 -191
  187. package/lib/Button/docs/Button__custom.docs.js +0 -0
  188. package/lib/Button/docs/Button__default.docs.js +0 -0
  189. package/lib/Buttongroup/Buttongroup.js +1 -1
  190. package/lib/Buttongroup/Buttongroup.module.css +89 -89
  191. package/lib/Buttongroup/__test__/__snapshots__/Buttongroup.spec.js.snap +146 -146
  192. package/lib/Card/Card.js +12 -7
  193. package/lib/Card/Card.module.css +20 -20
  194. package/lib/Card/docs/Card__Custom.docs.js +0 -0
  195. package/lib/Card/docs/Card__Default.docs.js +0 -0
  196. package/lib/Card/docs/Card__Scroll.docs.js +0 -0
  197. package/lib/CheckBox/CheckBox.js +0 -0
  198. package/lib/CheckBox/CheckBox.module.css +157 -153
  199. package/lib/CheckBox/docs/CheckBox__custom.docs.js +0 -0
  200. package/lib/CheckBox/docs/CheckBox__default.docs.js +0 -0
  201. package/lib/DateTime/CalendarView.js +0 -0
  202. package/lib/DateTime/DateTime.js +0 -0
  203. package/lib/DateTime/DateTime.module.css +187 -187
  204. package/lib/DateTime/DateWidget.js +0 -0
  205. package/lib/DateTime/DateWidget.module.css +38 -38
  206. package/lib/DateTime/YearView.js +0 -0
  207. package/lib/DateTime/YearView.module.css +81 -81
  208. package/lib/DateTime/common.js +0 -0
  209. package/lib/DateTime/docs/DateTime__default.docs.js +0 -0
  210. package/lib/DateTime/docs/DateWidget__default.docs.js +0 -0
  211. package/lib/DateTime/index.js +0 -0
  212. package/lib/DateTime/objectUtils.js +0 -0
  213. package/lib/DateTime/typeChecker.js +0 -0
  214. package/lib/DateTime/validator.js +0 -0
  215. package/lib/DropBox/DropBox.js +0 -0
  216. package/lib/DropBox/DropBox.module.css +406 -406
  217. package/lib/DropBox/DropBoxPositionMapping.json +144 -144
  218. package/lib/DropDown/DropDown.js +0 -0
  219. package/lib/DropDown/DropDown.module.css +5 -5
  220. package/lib/DropDown/DropDownHeading.js +0 -0
  221. package/lib/DropDown/DropDownHeading.module.css +53 -53
  222. package/lib/DropDown/DropDownItem.js +0 -0
  223. package/lib/DropDown/DropDownItem.module.css +94 -94
  224. package/lib/DropDown/DropDownSearch.js +0 -0
  225. package/lib/DropDown/DropDownSearch.module.css +14 -14
  226. package/lib/DropDown/DropDownSeparator.js +0 -0
  227. package/lib/DropDown/DropDownSeparator.module.css +7 -7
  228. package/lib/Label/Label.js +0 -0
  229. package/lib/Label/Label.module.css +52 -52
  230. package/lib/Label/LabelColors.module.css +20 -20
  231. package/lib/Label/__tests__/__snapshots__/Label.spec.js.snap +101 -101
  232. package/lib/Label/docs/Label__clipped.docs.js +0 -0
  233. package/lib/Label/docs/Label__custom.docs.js +0 -0
  234. package/lib/Label/docs/Label__palette.docs.js +0 -0
  235. package/lib/Label/docs/Label__size.docs.js +0 -0
  236. package/lib/Label/docs/Label__type.docs.js +0 -0
  237. package/lib/Layout/Box.js +18 -32
  238. package/lib/Layout/Container.js +18 -29
  239. package/lib/Layout/Layout.module.css +336 -324
  240. package/lib/Layout/docs/Layout__default.docs.js +0 -0
  241. package/lib/Layout/docs/Layout__four_Column.docs.js +16 -22
  242. package/lib/Layout/props/defaultProps.js +20 -0
  243. package/lib/Layout/props/propTypes.js +54 -0
  244. package/lib/Layout/utils.js +0 -0
  245. package/lib/LightNightMode/Colors.json +496 -496
  246. package/lib/ListItem/ListItem.js +0 -0
  247. package/lib/ListItem/ListItem.module.css +209 -205
  248. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +6 -6
  249. package/lib/MultiSelect/MultiSelect.js +5 -5
  250. package/lib/MultiSelect/MultiSelect.module.css +205 -205
  251. package/lib/MultiSelect/MultiSelectWithAvatar.js +0 -0
  252. package/lib/MultiSelect/SelectedOptions.module.css +15 -15
  253. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +0 -0
  254. package/lib/PopOver/PopOver.module.css +8 -8
  255. package/lib/Popup/Popup.js +0 -0
  256. package/lib/Popup/PositionMapping.json +73 -73
  257. package/lib/Radio/Radio.js +0 -0
  258. package/lib/Radio/Radio.module.css +112 -110
  259. package/lib/Radio/docs/Radio__custom.docs.js +0 -0
  260. package/lib/Radio/docs/Radio__default.docs.js +0 -0
  261. package/lib/Responsive/CustomResponsive.js +0 -0
  262. package/lib/Responsive/docs/Responsive__Custom.docs.js +0 -0
  263. package/lib/Responsive/docs/style.module.css +55 -55
  264. package/lib/ResponsiveDropBox/ResponsiveDropBox.module.css +6 -6
  265. package/lib/Ribbon/Ribbon.js +0 -0
  266. package/lib/Ribbon/Ribbon.module.css +376 -376
  267. package/lib/Ribbon/__tests__/__snapshots__/Ribbon.spec.js.snap +163 -163
  268. package/lib/Ribbon/docs/Ribbon__custom.docs.js +0 -0
  269. package/lib/Ribbon/docs/Ribbon__default.docs.js +0 -0
  270. package/lib/RippleEffect/RippleEffect.module.css +92 -70
  271. package/lib/Select/GroupSelect.js +0 -0
  272. package/lib/Select/Select.js +0 -0
  273. package/lib/Select/Select.module.css +106 -106
  274. package/lib/Select/SelectWithAvatar.js +0 -0
  275. package/lib/Select/SelectWithIcon.js +0 -0
  276. package/lib/Select/__tests__/Select.spec.js +0 -0
  277. package/lib/Select/docs/SelectWithIcon__default.docs.js +0 -0
  278. package/lib/Select/docs/Select__default.docs.js +0 -0
  279. package/lib/Stencils/Stencils.js +0 -0
  280. package/lib/Stencils/Stencils.module.css +96 -96
  281. package/lib/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +49 -49
  282. package/lib/Switch/Switch.js +0 -0
  283. package/lib/Switch/Switch.module.css +110 -109
  284. package/lib/Switch/docs/Switch__custom.docs.js +0 -0
  285. package/lib/Switch/docs/Switch__default.docs.js +0 -0
  286. package/lib/Tab/Tab.module.css +101 -101
  287. package/lib/Tab/TabContent.module.css +4 -4
  288. package/lib/Tab/Tabs.js +11 -11
  289. package/lib/Tab/Tabs.module.css +141 -141
  290. package/lib/Tab/docs/tabdocs.module.css +29 -29
  291. package/lib/Tag/Tag.js +8 -8
  292. package/lib/Tag/Tag.module.css +254 -254
  293. package/lib/Tag/docs/Tag__custom.docs.js +0 -0
  294. package/lib/Tag/docs/Tag__default.docs.js +0 -0
  295. package/lib/TextBox/TextBox.js +0 -0
  296. package/lib/TextBox/TextBox.module.css +157 -157
  297. package/lib/TextBox/__tests__/__snapshots__/TextBox.spec.js.snap +127 -127
  298. package/lib/TextBox/docs/TextBox__custom.docs.js +0 -0
  299. package/lib/TextBox/docs/TextBox__default.docs.js +0 -0
  300. package/lib/TextBox/docs/TextBox__variant.docs.js +0 -0
  301. package/lib/TextBoxIcon/TextBoxIcon.js +0 -0
  302. package/lib/TextBoxIcon/TextBoxIcon.module.css +78 -78
  303. package/lib/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +334 -334
  304. package/lib/TextBoxIcon/docs/TextBoxIcon__custom.docs.js +0 -0
  305. package/lib/TextBoxIcon/docs/TextBoxIcon__default.docs.js +0 -0
  306. package/lib/Textarea/Textarea.js +0 -0
  307. package/lib/Textarea/Textarea.module.css +139 -139
  308. package/lib/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +97 -97
  309. package/lib/Textarea/docs/Textarea__custom.docs.js +0 -0
  310. package/lib/Textarea/docs/Textarea__default.docs.js +0 -0
  311. package/lib/Textarea/docs/Textarea__disabled.docs.js +0 -0
  312. package/lib/Tooltip/Tooltip.module.css +109 -109
  313. package/lib/common/animation.module.css +624 -624
  314. package/lib/common/avatarsizes.module.css +44 -44
  315. package/lib/common/basic.module.css +33 -33
  316. package/lib/common/basicReset.module.css +40 -40
  317. package/lib/common/common.module.css +525 -502
  318. package/lib/common/customscroll.module.css +89 -89
  319. package/lib/common/docStyle.module.css +766 -766
  320. package/lib/common/reset.module.css +12 -12
  321. package/lib/common/transition.module.css +146 -146
  322. package/lib/deprecated/AdvancedMultiSelect.module.css +126 -126
  323. package/lib/index.js +0 -36
  324. package/lib/semantic/Button/semanticButton.module.css +9 -9
  325. package/lib/utils/Common.js +0 -0
  326. package/lib/utils/dropDownUtils.js +0 -0
  327. package/package.json +76 -75
  328. package/es/a11y/FocusScope/FocusScope.js +0 -370
  329. package/es/a11y/FocusScope/docs/FocusScope__default.docs.js +0 -139
  330. package/es/beta/FocusRing/FocusRing.js +0 -281
  331. package/es/beta/FocusRing/FocusRing.module.css +0 -152
  332. package/es/beta/FocusRing/docs/FocusRing__default.docs.js +0 -48
  333. package/lib/a11y/FocusScope/FocusScope.js +0 -443
  334. package/lib/a11y/FocusScope/docs/FocusScope__default.docs.js +0 -191
  335. package/lib/beta/FocusRing/FocusRing.js +0 -338
  336. package/lib/beta/FocusRing/FocusRing.module.css +0 -152
  337. package/lib/beta/FocusRing/docs/FocusRing__default.docs.js +0 -101
@@ -1,281 +0,0 @@
1
- import React, { useState, useRef, useEffect } from 'react';
2
- const eventFrom = 'keyboard' | 'pointer' | 'virtual';
3
- const eventType = PointerEvent | MouseEvent | KeyboardEvent | FocusEvent; //const eventHandler = (evType=eventFrom, e=eventType) => {return eventFrom}
4
-
5
- let currentEventType = null;
6
- let changeHandlers = new Set();
7
- let hasSetupGlobalListeners = false;
8
- let hasEventBeforeFocus = false; // let onFocusWithin= props.onFocusWithin?props.onFocusWithin:(e)=>{return void};
9
- // let onBlurWithin = props.onBlurWithin?props.onBlurWithin:(e) =>void
10
- // eventHandler that is called when the the focus within state changes.
11
- // onFocusWithinChange(isFocusWithin)=> void
12
- // Only Tab or Esc keys will make focus visible on text input elements
13
-
14
- const FOCUS_VISIBLE_INPUT_KEYS = {
15
- Tab: true,
16
- Escape: false
17
- };
18
-
19
- function triggerChangeHandlers() {
20
- let evType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : eventFrom;
21
- let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : eventType;
22
-
23
- for (let handler of changeHandlers) {
24
- handler(evType, e);
25
- }
26
- } //Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.
27
-
28
-
29
- function isValidKey(e) {
30
- return !(e.metaKey || e.altKey || e.ctrlKey);
31
- }
32
-
33
- function handleKeyboardEvent(e) {
34
- hasEventBeforeFocus = true;
35
-
36
- if (isValidKey(e)) {
37
- currentEventType = 'keyboard';
38
- triggerChangeHandlers('keyboard', e);
39
- }
40
- }
41
-
42
- function handlePointerEvent(e) {
43
- currentEventType = 'pointer';
44
-
45
- if (e.type === 'mousedown' || e.type === 'pointerdown') {
46
- hasEventBeforeFocus = true;
47
- triggerChangeHandlers('pointer', e);
48
- }
49
- }
50
-
51
- function handleFocusEvent(e) {
52
- // Firefox fires two extra focus events when the user first clicks into an iframe:
53
- // first on the window, then on the document. We ignore these events so they don't
54
- // cause keyboard focus rings to appear.
55
- if (e.target === window || e.target === document) {
56
- return;
57
- } // If a focus event occurs without a preceding keyboard or pointer event, switch to keyboard evType.
58
- // This occurs, for example, when navigating a form with the next/previous buttons on iOS.
59
-
60
-
61
- if (!hasEventBeforeFocus) {
62
- currentEventType = 'keyboard';
63
- triggerChangeHandlers('keyboard', e);
64
- }
65
-
66
- hasEventBeforeFocus = false;
67
- }
68
-
69
- function handleWindowBlur() {
70
- // When the window is blurred, reset state. This is necessary when tabbing out of the window,
71
- // for example, since a subsequent focus event won't be fired.
72
- hasEventBeforeFocus = false;
73
- }
74
-
75
- function setupGlobalFocusEvents() {
76
- if (typeof window === 'undefined' || hasSetupGlobalListeners) {
77
- return;
78
- } // Programmatic focus() calls shouldn't affect the current input evType.
79
- // However, we need to detect other cases when a focus event occurs without
80
- // a preceding user event (e.g. screen reader focus). Overriding the focus
81
- // method on HTMLElement.prototype is a bit hacky, but works.
82
-
83
-
84
- let focus = HTMLElement.prototype.focus;
85
-
86
- HTMLElement.prototype.focus = function () {
87
- hasEventBeforeFocus = true;
88
- focus.apply(this, arguments);
89
- };
90
-
91
- document.addEventListener('keydown', handleKeyboardEvent, true);
92
- document.addEventListener('keyup', handleKeyboardEvent, true); // Register focus events on the window so they are sure to happen
93
- // before React's event listeners (registered on the document).
94
-
95
- window.addEventListener('focus', handleFocusEvent, true);
96
- window.addEventListener('blur', handleWindowBlur, false);
97
-
98
- if (typeof PointerEvent !== 'undefined') {
99
- document.addEventListener('pointerdown', handlePointerEvent, true);
100
- document.addEventListener('pointermove', handlePointerEvent, true);
101
- document.addEventListener('pointerup', handlePointerEvent, true);
102
- } else {
103
- document.addEventListener('mousedown', handlePointerEvent, true);
104
- document.addEventListener('mousemove', handlePointerEvent, true);
105
- document.addEventListener('mouseup', handlePointerEvent, true);
106
- }
107
-
108
- hasSetupGlobalListeners = true;
109
- }
110
-
111
- function isFocusVisible() {
112
- return currentEventType !== 'pointer';
113
- }
114
-
115
- function useFocusVisible(props) {
116
- setupGlobalFocusEvents();
117
- let [isFocusVisibleState, setFocusVisible] = useState(isFocusVisible());
118
- useEffect(() => {
119
- let handler = (evType, e) => {
120
- // If this is a text input component, don't update the focus visible style when
121
- // typing except for when the Tab and Escape keys are pressed.
122
- if (evType === 'keyboard' && e instanceof KeyboardEvent && !FOCUS_VISIBLE_INPUT_KEYS[e.key]) {
123
- return;
124
- }
125
-
126
- setFocusVisible(isFocusVisible());
127
- };
128
-
129
- changeHandlers.add(handler);
130
- return () => {
131
- changeHandlers.delete(handler);
132
- };
133
- });
134
- return {
135
- isFocusVisible: isFocusVisibleState
136
- };
137
- } //If true, keyboard focus is visible.
138
-
139
-
140
- function useFocusWithin(props) {
141
- let state = useRef({
142
- isFocusWithin: false
143
- }).current;
144
-
145
- if (props.isDisabled) {
146
- return {
147
- focusWithinProps: {}
148
- };
149
- }
150
-
151
- let onFocus = e => {
152
- if (!state.isFocusWithin) {
153
- if (props.onFocusWithin) {
154
- props.onFocusWithin(e);
155
- }
156
-
157
- if (props.onFocusWithinChange) {
158
- props.onFocusWithinChange(true);
159
- }
160
-
161
- state.isFocusWithin = true;
162
- }
163
- };
164
-
165
- let onBlur = e => {
166
- // We don't want to trigger onBlurWithin and then immediately onFocusWithin again
167
- // when moving focus inside the element. Only trigger if the currentTarget doesn't
168
- // include the relatedTarget (where focus is moving).
169
- if (state.isFocusWithin && !e.currentTarget.contains(e.relatedTarget)) {
170
- if (props.onBlurWithin) {
171
- props.onBlurWithin(e);
172
- }
173
-
174
- if (props.onFocusWithinChange) {
175
- props.onFocusWithinChange(false);
176
- }
177
-
178
- state.isFocusWithin = false;
179
- }
180
- };
181
-
182
- return {
183
- focusWithinProps: {
184
- onFocus: onFocus,
185
- onBlur: onBlur
186
- }
187
- };
188
- }
189
-
190
- function useFocus(props) {
191
- if (props.isDisabled) {
192
- return {
193
- focusProps: {}
194
- };
195
- }
196
-
197
- let onFocus, onBlur;
198
-
199
- if (props.onFocus || props.onFocusChange) {
200
- onFocus = e => {
201
- if (e.target === e.currentTarget) {
202
- if (props.onFocus) {
203
- props.onFocus(e);
204
- }
205
-
206
- if (props.onFocusChange) {
207
- props.onFocusChange(true);
208
- }
209
- }
210
- };
211
- }
212
-
213
- if (props.onBlur || props.onFocusChange) {
214
- onBlur = e => {
215
- if (e.target === e.currentTarget) {
216
- if (props.onBlur) {
217
- props.onBlur(e);
218
- }
219
-
220
- if (props.onFocusChange) {
221
- props.onFocusChange(false);
222
- }
223
- }
224
- };
225
- }
226
-
227
- return {
228
- focusProps: {
229
- onFocus,
230
- onBlur
231
- }
232
- };
233
- }
234
-
235
- function useFocusRing(props) {
236
- let {
237
- within
238
- } = props;
239
- let [isFocused, setFocused] = useState(false);
240
- let [isFocusWithin, setFocusWithin] = useState(false);
241
- let {
242
- isFocusVisible
243
- } = useFocusVisible(props);
244
- let {
245
- focusProps
246
- } = useFocus({
247
- isDisabled: within,
248
- onFocusChange: setFocused
249
- });
250
- let {
251
- focusWithinProps
252
- } = useFocusWithin({
253
- isDisabled: !within,
254
- onFocusWithinChange: setFocusWithin
255
- });
256
- return {
257
- isFocused: within ? isFocusWithin : isFocused,
258
- isFocusVisible: (within ? isFocusWithin : isFocused) && isFocusVisible,
259
- focusProps: within ? focusWithinProps : focusProps
260
- };
261
- }
262
-
263
- export default function FocusRing(props) {
264
- let {
265
- children,
266
- focusClass,
267
- focusRingClass
268
- } = props;
269
- let {
270
- isFocused,
271
- isFocusVisible,
272
- focusProps
273
- } = useFocusRing(props);
274
- let child = React.Children.only(children);
275
- return /*#__PURE__*/React.cloneElement(child, { ...focusProps,
276
- customClass: isFocusVisible ? focusRingClass : isFocused ? focusClass : ''
277
- });
278
- }
279
- FocusRing.docs = {
280
- componentGroup: 'Atom'
281
- };
@@ -1,152 +0,0 @@
1
- .input{
2
- width:100%;
3
- outline: 0;
4
- border: 1px;
5
- border-bottom: 1px solid #ddd
6
- }
7
- .badFocus {
8
- display: inline-block;
9
- margin-top: 10px;
10
- border-radius: 2px;
11
- box-shadow: 0 0 0 4px rgba(20,20,20,0.15);
12
- margin-bottom: 30px;
13
- padding: 2px;
14
- margin: 10px;
15
- }
16
- [dir=ltr] .badFocus {
17
- margin-right: 5px;
18
- }
19
- [dir=rtl] .badFocus {
20
- margin-left: 5px;
21
- }
22
- :focus{
23
- outline: 0;
24
- }
25
- .goodFocus {
26
- display: inline-block;
27
- border-radius: 2px;
28
- padding: 2px;
29
- box-shadow: 0 0 0 4px rgba(91,147,255,0.25);
30
- }
31
- .inpFocus{
32
- width: auto;
33
- padding: 5px;
34
- border-radius: 2px;
35
- margin: 10px;
36
- }
37
- .mouseFocus, .inpFocus:focus{
38
- box-shadow: 0 0 0 4px rgba(20,20,20,0.15);
39
- }
40
- .tabFocus, .tabFocus:focus{
41
- box-shadow: 0 0 0 4px rgba(24, 91, 226, 0.25);
42
- }
43
- .freezeLayer{
44
- position: fixed;
45
- top:0;
46
- bottom: 0;
47
- display: flex;
48
- justify-content: center;
49
- align-items: center;
50
- background-color: rgba(20,20,20,.5);
51
- }
52
- [dir=ltr] .freezeLayer{
53
- left:0;
54
- right: 0;
55
- }
56
- [dir=rtl] .freezeLayer{
57
- right:0;
58
- left: 0;
59
- }
60
- [dir=ltr] .element{
61
- margin:1rem 0 1rem .5rem;
62
- }
63
- [dir=rtl] .element{
64
- margin:1rem .5rem 1rem 0;
65
- }
66
- .container{
67
- min-width: 400px;
68
- transition: .3s ease-in-out;
69
- position: absolute;
70
- background-color: #fff;
71
- border-radius: 10px;
72
- padding: 20px;
73
- }
74
- .formContainer{
75
- display: flex;
76
- flex-direction: column;
77
- }
78
- label{
79
- font-weight: 400;
80
- font-size: 20px;
81
- }
82
- .sOpt:focus{
83
- background-color: red;
84
- }
85
- .button {
86
- -webkit-appearance: none;
87
- appearance: none;
88
- color: white;
89
- font-size: 14px;
90
- background: green;
91
- border: none;
92
- padding: 4px 8px;
93
- }
94
-
95
- .focus-ring {
96
- outline: 2px solid dodgerblue;
97
- outline-offset: 2px;
98
- }
99
- .box{
100
- display: flex;
101
- flex-direction: column;
102
- }
103
- .box1{
104
- transform: scale(1);
105
- }
106
- [dir=ltr] .manage{
107
- right: 0;
108
- }
109
- [dir=rtl] .manage{
110
- left: 0;
111
- }
112
- .primary{
113
- color: #fff;
114
- text-decoration: none;
115
- font-size: 13px;
116
- background: #00aefe;
117
- box-shadow: 0 2px 6px 0 rgba(209, 209, 209, 0.18);
118
- padding: 7px 12px;
119
- cursor: pointer;
120
- margin-top: 1px;
121
- border-radius: 3px;
122
- border: 1px solid #00aefe;
123
- margin:10px
124
- }
125
- .secondary{
126
- color: #8c8c8c;
127
- text-decoration: none;
128
- font-size: 13px;
129
- background: #fff;
130
- box-shadow: 0 2px 6px 0 rgba(209, 209, 209, 0.18);
131
- padding: 7px 12px;
132
- cursor: pointer;
133
- margin-top: 1px;
134
- border-radius: 3px;
135
- border: 1px solid #8c8c8c
136
- }
137
-
138
- [dir=ltr] .primary:focus{
139
- box-shadow: 2px 2px 6px 0 rgba(19, 173, 211, 0.493);
140
- }
141
-
142
- [dir=rtl] .primary:focus{
143
- box-shadow: -2px 2px 6px 0 rgba(19, 173, 211, 0.493);
144
- }
145
-
146
- [dir=ltr] .secondary:focus{
147
- box-shadow: 2px 2px 6px 0 rgba(39, 40, 41, 0.493)
148
- }
149
-
150
- [dir=rtl] .secondary:focus{
151
- box-shadow: -2px 2px 6px 0 rgba(39, 40, 41, 0.493)
152
- }
@@ -1,48 +0,0 @@
1
- import React from 'react';
2
- import Button from '../../../Button/Button';
3
- import TextBox from '../../../TextBox/TextBox';
4
- import FocusRing from '../FocusRing';
5
- import style from '../FocusRing.module.css';
6
- import { Box } from '../../../Layout';
7
- export default class FocusRing__default extends React.Component {
8
- render() {
9
- let styles = {
10
- margin: '30px',
11
- width: '50%',
12
- display: 'block'
13
- };
14
- return /*#__PURE__*/React.createElement(FocusRing, {
15
- focusClass: style.mouseFocus,
16
- focusRingClass: style.tabFocus,
17
- within: true
18
- }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement("span", {
19
- style: styles
20
- }, /*#__PURE__*/React.createElement(FocusRing, {
21
- focusClass: style.mouseFocus,
22
- focusRingClass: style.tabFocus
23
- }, /*#__PURE__*/React.createElement(TextBox, {
24
- type: "text",
25
- defaultValue: "Input a",
26
- id: "1"
27
- }))), /*#__PURE__*/React.createElement("span", {
28
- style: styles
29
- }, /*#__PURE__*/React.createElement(FocusRing, {
30
- focusClass: style.mouseFocus,
31
- focusRingClass: style.tabFocus
32
- }, /*#__PURE__*/React.createElement(TextBox, {
33
- type: "text",
34
- defaultValue: "Input b",
35
- id: "2"
36
- }))), /*#__PURE__*/React.createElement("span", {
37
- style: styles
38
- }, /*#__PURE__*/React.createElement(TextBox, {
39
- type: "text",
40
- defaultValue: "Input c",
41
- id: "3"
42
- }))));
43
- }
44
-
45
- }
46
- FocusRing__default.docs = {
47
- componentGroup: 'Atom'
48
- };