@doist/reactist 10.0.0-beta.7 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/dist/reactist.cjs.development.js +253 -411
  2. package/dist/reactist.cjs.development.js.map +1 -1
  3. package/dist/reactist.cjs.production.min.js +1 -1
  4. package/dist/reactist.cjs.production.min.js.map +1 -1
  5. package/es/_virtual/_rollupPluginBabelHelpers.js +34 -20
  6. package/es/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  7. package/es/components/deprecated-button/deprecated-button.js +2 -1
  8. package/es/components/deprecated-button/deprecated-button.js.map +1 -1
  9. package/es/components/deprecated-modal/deprecated-modal.js +1 -1
  10. package/es/components/deprecated-modal/deprecated-modal.js.map +1 -1
  11. package/es/components/dropdown/dropdown.js +3 -1
  12. package/es/components/dropdown/dropdown.js.map +1 -1
  13. package/es/components/key-capturer/key-capturer.js.map +1 -1
  14. package/es/components/keyboard-shortcut/keyboard-shortcut.js +2 -1
  15. package/es/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  16. package/es/components/menu/menu.js +32 -12
  17. package/es/components/menu/menu.js.map +1 -1
  18. package/es/components/notification/notification.js +8 -3
  19. package/es/components/notification/notification.js.map +1 -1
  20. package/es/components/popover/popover.js.map +1 -1
  21. package/es/components/popover/positioning-utils.js.map +1 -1
  22. package/es/components/progress-bar/progress-bar.js +8 -2
  23. package/es/components/progress-bar/progress-bar.js.map +1 -1
  24. package/es/components/select/select.js +3 -1
  25. package/es/components/select/select.js.map +1 -1
  26. package/es/components/time/time-utils.js.map +1 -1
  27. package/es/components/time/time.js.map +1 -1
  28. package/es/components/tooltip/tooltip.js +3 -1
  29. package/es/components/tooltip/tooltip.js.map +1 -1
  30. package/es/index.js +0 -4
  31. package/es/index.js.map +1 -1
  32. package/es/new-components/base-button/base-button.js +3 -1
  33. package/es/new-components/base-button/base-button.js.map +1 -1
  34. package/es/new-components/base-button/base-button.module.css.js +1 -1
  35. package/es/new-components/box/box.js +5 -3
  36. package/es/new-components/box/box.js.map +1 -1
  37. package/es/new-components/box/box.module.css.js +1 -1
  38. package/es/new-components/box/width.module.css.js +4 -0
  39. package/es/new-components/box/width.module.css.js.map +1 -0
  40. package/es/new-components/button/button.js +2 -1
  41. package/es/new-components/button/button.js.map +1 -1
  42. package/es/new-components/button-link/button-link.js +2 -1
  43. package/es/new-components/button-link/button-link.js.map +1 -1
  44. package/es/new-components/checkbox-field/checkbox-field.js +27 -10
  45. package/es/new-components/checkbox-field/checkbox-field.js.map +1 -1
  46. package/es/new-components/checkbox-field/checkbox-field.module.css.js +1 -1
  47. package/es/new-components/checkbox-field/checkbox-icon.js +2 -1
  48. package/es/new-components/checkbox-field/checkbox-icon.js.map +1 -1
  49. package/es/new-components/columns/columns.js +4 -2
  50. package/es/new-components/columns/columns.js.map +1 -1
  51. package/es/new-components/divider/divider.js +5 -3
  52. package/es/new-components/divider/divider.js.map +1 -1
  53. package/es/new-components/divider/divider.module.css.js +1 -1
  54. package/es/new-components/heading/heading.js +2 -1
  55. package/es/new-components/heading/heading.js.map +1 -1
  56. package/es/new-components/hidden/hidden.js +2 -1
  57. package/es/new-components/hidden/hidden.js.map +1 -1
  58. package/es/new-components/icons/alert-icon.js +2 -1
  59. package/es/new-components/icons/alert-icon.js.map +1 -1
  60. package/es/new-components/inline/inline.js +2 -1
  61. package/es/new-components/inline/inline.js.map +1 -1
  62. package/es/new-components/loading/loading.js +6 -2
  63. package/es/new-components/loading/loading.js.map +1 -1
  64. package/es/new-components/modal/modal.js +32 -9
  65. package/es/new-components/modal/modal.js.map +1 -1
  66. package/es/new-components/modal/modal.module.css.js +1 -1
  67. package/es/new-components/password-field/password-field.js +2 -1
  68. package/es/new-components/password-field/password-field.js.map +1 -1
  69. package/es/new-components/select-field/select-field.js +2 -1
  70. package/es/new-components/select-field/select-field.js.map +1 -1
  71. package/es/new-components/select-field/select-field.module.css.js +1 -1
  72. package/es/new-components/stack/stack.js +5 -4
  73. package/es/new-components/stack/stack.js.map +1 -1
  74. package/es/new-components/switch-field/switch-field.js +28 -5
  75. package/es/new-components/switch-field/switch-field.js.map +1 -1
  76. package/es/new-components/switch-field/switch-field.module.css.js +1 -1
  77. package/es/new-components/tabs/tabs.js +10 -5
  78. package/es/new-components/tabs/tabs.js.map +1 -1
  79. package/es/new-components/tabs/tabs.module.css.js +1 -1
  80. package/es/new-components/text/text.js +2 -1
  81. package/es/new-components/text/text.js.map +1 -1
  82. package/es/new-components/text-area/text-area.js +3 -1
  83. package/es/new-components/text-area/text-area.js.map +1 -1
  84. package/es/new-components/text-area/text-area.module.css.js +1 -1
  85. package/es/new-components/text-field/text-field.js +2 -1
  86. package/es/new-components/text-field/text-field.js.map +1 -1
  87. package/es/new-components/text-field/text-field.module.css.js +1 -1
  88. package/es/new-components/text-link/text-link.js +2 -1
  89. package/es/new-components/text-link/text-link.js.map +1 -1
  90. package/lib/_virtual/_rollupPluginBabelHelpers.js +1 -1
  91. package/lib/components/deprecated-button/deprecated-button.js +1 -1
  92. package/lib/components/deprecated-button/deprecated-button.js.map +1 -1
  93. package/lib/components/deprecated-modal/deprecated-modal.js +1 -1
  94. package/lib/components/deprecated-modal/deprecated-modal.js.map +1 -1
  95. package/lib/components/dropdown/dropdown.js +1 -1
  96. package/lib/components/dropdown/dropdown.js.map +1 -1
  97. package/lib/components/keyboard-shortcut/keyboard-shortcut.js +1 -1
  98. package/lib/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  99. package/lib/components/menu/menu.js +1 -1
  100. package/lib/components/menu/menu.js.map +1 -1
  101. package/lib/components/notification/notification.d.ts +4 -2
  102. package/lib/components/notification/notification.js +1 -1
  103. package/lib/components/notification/notification.js.map +1 -1
  104. package/lib/components/progress-bar/progress-bar.d.ts +3 -1
  105. package/lib/components/progress-bar/progress-bar.js +1 -1
  106. package/lib/components/progress-bar/progress-bar.js.map +1 -1
  107. package/lib/components/select/select.js +1 -1
  108. package/lib/components/select/select.js.map +1 -1
  109. package/lib/components/tooltip/tooltip.js +1 -1
  110. package/lib/components/tooltip/tooltip.js.map +1 -1
  111. package/lib/index.d.ts +0 -4
  112. package/lib/index.js +1 -1
  113. package/lib/new-components/base-button/base-button.js +1 -1
  114. package/lib/new-components/base-button/base-button.js.map +1 -1
  115. package/lib/new-components/base-button/base-button.module.css.js +1 -1
  116. package/lib/new-components/box/box.d.ts +10 -9
  117. package/lib/new-components/box/box.js +1 -1
  118. package/lib/new-components/box/box.js.map +1 -1
  119. package/lib/new-components/box/box.module.css.js +1 -1
  120. package/lib/new-components/box/width.module.css.js +2 -0
  121. package/lib/new-components/box/width.module.css.js.map +1 -0
  122. package/lib/new-components/button/button.js +1 -1
  123. package/lib/new-components/button/button.js.map +1 -1
  124. package/lib/new-components/button-link/button-link.js +1 -1
  125. package/lib/new-components/button-link/button-link.js.map +1 -1
  126. package/lib/new-components/checkbox-field/checkbox-field.d.ts +15 -2
  127. package/lib/new-components/checkbox-field/checkbox-field.js +1 -1
  128. package/lib/new-components/checkbox-field/checkbox-field.js.map +1 -1
  129. package/lib/new-components/checkbox-field/checkbox-field.module.css.js +1 -1
  130. package/lib/new-components/checkbox-field/checkbox-icon.js +1 -1
  131. package/lib/new-components/checkbox-field/checkbox-icon.js.map +1 -1
  132. package/lib/new-components/columns/columns.js +1 -1
  133. package/lib/new-components/columns/columns.js.map +1 -1
  134. package/lib/new-components/common-types.d.ts +1 -0
  135. package/lib/new-components/divider/divider.d.ts +2 -2
  136. package/lib/new-components/divider/divider.js +1 -1
  137. package/lib/new-components/divider/divider.js.map +1 -1
  138. package/lib/new-components/divider/divider.module.css.js +1 -1
  139. package/lib/new-components/heading/heading.js +1 -1
  140. package/lib/new-components/heading/heading.js.map +1 -1
  141. package/lib/new-components/hidden/hidden.js +1 -1
  142. package/lib/new-components/hidden/hidden.js.map +1 -1
  143. package/lib/new-components/icons/alert-icon.js +1 -1
  144. package/lib/new-components/icons/alert-icon.js.map +1 -1
  145. package/lib/new-components/inline/inline.js +1 -1
  146. package/lib/new-components/inline/inline.js.map +1 -1
  147. package/lib/new-components/loading/loading.d.ts +8 -7
  148. package/lib/new-components/loading/loading.js +1 -1
  149. package/lib/new-components/loading/loading.js.map +1 -1
  150. package/lib/new-components/modal/modal.d.ts +7 -3
  151. package/lib/new-components/modal/modal.js +1 -1
  152. package/lib/new-components/modal/modal.js.map +1 -1
  153. package/lib/new-components/modal/modal.module.css.js +1 -1
  154. package/lib/new-components/password-field/password-field.js +1 -1
  155. package/lib/new-components/password-field/password-field.js.map +1 -1
  156. package/lib/new-components/select-field/select-field.js +1 -1
  157. package/lib/new-components/select-field/select-field.js.map +1 -1
  158. package/lib/new-components/select-field/select-field.module.css.js +1 -1
  159. package/lib/new-components/stack/stack.d.ts +3 -4
  160. package/lib/new-components/stack/stack.js +1 -1
  161. package/lib/new-components/stack/stack.js.map +1 -1
  162. package/lib/new-components/switch-field/switch-field.d.ts +9 -2
  163. package/lib/new-components/switch-field/switch-field.js +1 -1
  164. package/lib/new-components/switch-field/switch-field.js.map +1 -1
  165. package/lib/new-components/switch-field/switch-field.module.css.js +1 -1
  166. package/lib/new-components/tabs/tabs.js +1 -1
  167. package/lib/new-components/tabs/tabs.js.map +1 -1
  168. package/lib/new-components/tabs/tabs.module.css.js +1 -1
  169. package/lib/new-components/text/text.js +1 -1
  170. package/lib/new-components/text/text.js.map +1 -1
  171. package/lib/new-components/text-area/text-area.js +1 -1
  172. package/lib/new-components/text-area/text-area.js.map +1 -1
  173. package/lib/new-components/text-area/text-area.module.css.js +1 -1
  174. package/lib/new-components/text-field/text-field.js +1 -1
  175. package/lib/new-components/text-field/text-field.js.map +1 -1
  176. package/lib/new-components/text-field/text-field.module.css.js +1 -1
  177. package/lib/new-components/text-link/text-link.js +1 -1
  178. package/lib/new-components/text-link/text-link.js.map +1 -1
  179. package/package.json +15 -12
  180. package/styles/alert.css +2 -1
  181. package/styles/base-button.css +4 -3
  182. package/styles/base-button.module.css.css +1 -1
  183. package/styles/base-field.css +3 -2
  184. package/styles/box.css +3 -2
  185. package/styles/box.module.css.css +1 -1
  186. package/styles/checkbox-field.css +3 -3
  187. package/styles/checkbox-field.module.css.css +1 -1
  188. package/styles/color-picker.css +1 -1
  189. package/styles/columns.css +2 -1
  190. package/styles/deprecated-button.css +1 -1
  191. package/styles/deprecated-loading.css +1 -1
  192. package/styles/deprecated-modal.css +1 -1
  193. package/styles/divider.css +3 -2
  194. package/styles/divider.module.css.css +1 -1
  195. package/styles/dropdown.css +1 -1
  196. package/styles/heading.css +2 -1
  197. package/styles/hidden-visually.css +2 -1
  198. package/styles/hidden.css +2 -1
  199. package/styles/inline.css +2 -1
  200. package/styles/loading.css +3 -2
  201. package/styles/modal.css +6 -5
  202. package/styles/modal.module.css.css +1 -1
  203. package/styles/notice.css +2 -1
  204. package/styles/password-field.css +4 -3
  205. package/styles/progress-bar.css +5 -0
  206. package/styles/reactist.css +16 -19
  207. package/styles/select-field.css +4 -3
  208. package/styles/select-field.module.css.css +1 -1
  209. package/styles/spinner.module.css.css +1 -1
  210. package/styles/stack.css +3 -2
  211. package/styles/switch-field.css +4 -3
  212. package/styles/switch-field.module.css.css +1 -1
  213. package/styles/tabs.css +3 -2
  214. package/styles/tabs.module.css.css +1 -1
  215. package/styles/text-area.css +4 -3
  216. package/styles/text-area.module.css.css +1 -1
  217. package/styles/text-field.css +4 -3
  218. package/styles/text-field.module.css.css +1 -1
  219. package/styles/text-link.css +2 -1
  220. package/styles/text.css +2 -1
  221. package/styles/width.module.css.css +1 -0
  222. package/es/components/error-message/error-message.js +0 -90
  223. package/es/components/error-message/error-message.js.map +0 -1
  224. package/es/components/error-message/index.js +0 -6
  225. package/es/components/error-message/index.js.map +0 -1
  226. package/es/components/icon/icon.js +0 -96
  227. package/es/components/icon/icon.js.map +0 -1
  228. package/es/components/icon/index.js +0 -6
  229. package/es/components/icon/index.js.map +0 -1
  230. package/es/components/icons/ThinQuestionMarkIcon.svg.js +0 -24
  231. package/es/components/icons/ThinQuestionMarkIcon.svg.js.map +0 -1
  232. package/es/components/icons/ThreeDotsIcon.svg.js +0 -40
  233. package/es/components/icons/ThreeDotsIcon.svg.js.map +0 -1
  234. package/es/components/range-input/index.js +0 -6
  235. package/es/components/range-input/index.js.map +0 -1
  236. package/es/components/range-input/range-input.js +0 -55
  237. package/es/components/range-input/range-input.js.map +0 -1
  238. package/es/components/tip/index.js +0 -6
  239. package/es/components/tip/index.js.map +0 -1
  240. package/es/components/tip/tip.js +0 -30
  241. package/es/components/tip/tip.js.map +0 -1
  242. package/lib/components/error-message/error-message.d.ts +0 -23
  243. package/lib/components/error-message/error-message.js +0 -2
  244. package/lib/components/error-message/error-message.js.map +0 -1
  245. package/lib/components/error-message/error-message.test.d.ts +0 -1
  246. package/lib/components/error-message/index.d.ts +0 -2
  247. package/lib/components/error-message/index.js +0 -2
  248. package/lib/components/error-message/index.js.map +0 -1
  249. package/lib/components/icon/icon.d.ts +0 -31
  250. package/lib/components/icon/icon.js +0 -2
  251. package/lib/components/icon/icon.js.map +0 -1
  252. package/lib/components/icon/icon.test.d.ts +0 -1
  253. package/lib/components/icon/index.d.ts +0 -2
  254. package/lib/components/icon/index.js +0 -2
  255. package/lib/components/icon/index.js.map +0 -1
  256. package/lib/components/icons/ThinQuestionMarkIcon.svg.js +0 -2
  257. package/lib/components/icons/ThinQuestionMarkIcon.svg.js.map +0 -1
  258. package/lib/components/icons/ThreeDotsIcon.svg.js +0 -2
  259. package/lib/components/icons/ThreeDotsIcon.svg.js.map +0 -1
  260. package/lib/components/range-input/index.d.ts +0 -2
  261. package/lib/components/range-input/index.js +0 -2
  262. package/lib/components/range-input/index.js.map +0 -1
  263. package/lib/components/range-input/range-input.d.ts +0 -25
  264. package/lib/components/range-input/range-input.js +0 -2
  265. package/lib/components/range-input/range-input.js.map +0 -1
  266. package/lib/components/range-input/range-input.test.d.ts +0 -1
  267. package/lib/components/tip/index.d.ts +0 -2
  268. package/lib/components/tip/index.js +0 -2
  269. package/lib/components/tip/index.js.map +0 -1
  270. package/lib/components/tip/tip.d.ts +0 -20
  271. package/lib/components/tip/tip.js +0 -2
  272. package/lib/components/tip/tip.js.map +0 -1
  273. package/lib/components/tip/tip.test.d.ts +0 -1
  274. package/styles/error-message.css +0 -1
  275. package/styles/icon.css +0 -2
  276. package/styles/range-input.css +0 -1
  277. package/styles/tip.css +0 -4
@@ -5,6 +5,7 @@ import { getClassNames, mapResponsiveProp } from '../responsive-props.js';
5
5
  import { Box } from '../box/box.js';
6
6
  import styles from './inline.module.css.js';
7
7
 
8
+ var _excluded = ["as", "space", "align", "alignY", "children", "exceptionallySetClassName"];
8
9
  var Inline = /*#__PURE__*/polymorphicComponent(function Inline(_ref, ref) {
9
10
  var as = _ref.as,
10
11
  space = _ref.space,
@@ -14,7 +15,7 @@ var Inline = /*#__PURE__*/polymorphicComponent(function Inline(_ref, ref) {
14
15
  alignY = _ref$alignY === void 0 ? 'center' : _ref$alignY,
15
16
  children = _ref.children,
16
17
  exceptionallySetClassName = _ref.exceptionallySetClassName,
17
- props = _objectWithoutPropertiesLoose(_ref, ["as", "space", "align", "alignY", "children", "exceptionallySetClassName"]);
18
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
18
19
 
19
20
  return /*#__PURE__*/createElement(Box, null, /*#__PURE__*/createElement(Box, Object.assign({}, props, {
20
21
  as: as,
@@ -1 +1 @@
1
- {"version":3,"file":"inline.js","sources":["../../../src/new-components/inline/inline.tsx"],"sourcesContent":["import * as React from 'react'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { getClassNames, mapResponsiveProp } from '../responsive-props'\nimport { Box } from '../box'\n\nimport type { ResponsiveProp } from '../responsive-props'\nimport type { Space } from '../common-types'\nimport type { ReusableBoxProps } from '../box'\n\nimport styles from './inline.module.css'\n\ntype InlineAlign = 'left' | 'center' | 'right'\n\ninterface InlineProps extends ReusableBoxProps {\n space?: ResponsiveProp<Space>\n align?: ResponsiveProp<InlineAlign>\n alignY?: ResponsiveProp<'top' | 'center' | 'bottom'>\n}\n\nconst Inline = polymorphicComponent<'div', InlineProps>(function Inline(\n { as, space, align = 'left', alignY = 'center', children, exceptionallySetClassName, ...props },\n ref,\n) {\n return (\n <Box>\n <Box\n {...props}\n as={as}\n display=\"flex\"\n flexWrap=\"wrap\"\n className={[exceptionallySetClassName, getClassNames(styles, 'space', space)]}\n ref={ref}\n alignItems={mapResponsiveProp(alignY, (alignY) =>\n alignY === 'top' ? 'flexStart' : alignY === 'bottom' ? 'flexEnd' : 'center',\n )}\n justifyContent={mapResponsiveProp(align, (align) =>\n align === 'left' ? 'flexStart' : align === 'right' ? 'flexEnd' : 'center',\n )}\n >\n {children}\n </Box>\n </Box>\n )\n})\n\nexport type { InlineProps, InlineAlign }\nexport { Inline }\n"],"names":["Inline","polymorphicComponent","ref","as","space","align","alignY","children","exceptionallySetClassName","props","React","Box","display","flexWrap","className","getClassNames","styles","alignItems","mapResponsiveProp","justifyContent"],"mappings":";;;;;;;IAmBMA,MAAM,gBAAGC,oBAAoB,CAAqB,SAASD,MAAT,OAEpDE,GAFoD;MAClDC,UAAAA;MAAIC,aAAAA;wBAAOC;MAAAA,gCAAQ;yBAAQC;MAAAA,kCAAS;MAAUC,gBAAAA;MAAUC,iCAAAA;MAA8BC;;AAGxF,sBACIC,aAAA,CAACC,GAAD,MAAA,eACID,aAAA,CAACC,GAAD,oBACQF;AACJN,IAAAA,EAAE,EAAEA;AACJS,IAAAA,OAAO,EAAC;AACRC,IAAAA,QAAQ,EAAC;AACTC,IAAAA,SAAS,EAAE,CAACN,yBAAD,EAA4BO,aAAa,CAACC,MAAD,EAAS,OAAT,EAAkBZ,KAAlB,CAAzC;AACXF,IAAAA,GAAG,EAAEA;AACLe,IAAAA,UAAU,EAAEC,iBAAiB,CAACZ,MAAD,EAAS,UAACA,MAAD;AAAA,aAClCA,MAAM,KAAK,KAAX,GAAmB,WAAnB,GAAiCA,MAAM,KAAK,QAAX,GAAsB,SAAtB,GAAkC,QADjC;AAAA,KAAT;AAG7Ba,IAAAA,cAAc,EAAED,iBAAiB,CAACb,KAAD,EAAQ,UAACA,KAAD;AAAA,aACrCA,KAAK,KAAK,MAAV,GAAmB,WAAnB,GAAiCA,KAAK,KAAK,OAAV,GAAoB,SAApB,GAAgC,QAD5B;AAAA,KAAR;IAVrC,EAcKE,QAdL,CADJ,CADJ;AAoBH,CAxBkC;;;;"}
1
+ {"version":3,"file":"inline.js","sources":["../../../src/new-components/inline/inline.tsx"],"sourcesContent":["import * as React from 'react'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { getClassNames, mapResponsiveProp } from '../responsive-props'\nimport { Box } from '../box'\n\nimport type { ResponsiveProp } from '../responsive-props'\nimport type { Space } from '../common-types'\nimport type { ReusableBoxProps } from '../box'\n\nimport styles from './inline.module.css'\n\ntype InlineAlign = 'left' | 'center' | 'right'\n\ninterface InlineProps extends ReusableBoxProps {\n space?: ResponsiveProp<Space>\n align?: ResponsiveProp<InlineAlign>\n alignY?: ResponsiveProp<'top' | 'center' | 'bottom'>\n}\n\nconst Inline = polymorphicComponent<'div', InlineProps>(function Inline(\n { as, space, align = 'left', alignY = 'center', children, exceptionallySetClassName, ...props },\n ref,\n) {\n return (\n <Box>\n <Box\n {...props}\n as={as}\n display=\"flex\"\n flexWrap=\"wrap\"\n className={[exceptionallySetClassName, getClassNames(styles, 'space', space)]}\n ref={ref}\n alignItems={mapResponsiveProp(alignY, (alignY) =>\n alignY === 'top' ? 'flexStart' : alignY === 'bottom' ? 'flexEnd' : 'center',\n )}\n justifyContent={mapResponsiveProp(align, (align) =>\n align === 'left' ? 'flexStart' : align === 'right' ? 'flexEnd' : 'center',\n )}\n >\n {children}\n </Box>\n </Box>\n )\n})\n\nexport type { InlineProps, InlineAlign }\nexport { Inline }\n"],"names":["Inline","polymorphicComponent","ref","as","space","align","alignY","children","exceptionallySetClassName","props","React","Box","display","flexWrap","className","getClassNames","styles","alignItems","mapResponsiveProp","justifyContent"],"mappings":";;;;;;;;IAmBMA,MAAM,gBAAGC,oBAAoB,CAAqB,SAASD,MAAT,OAEpDE,GAFoD;MAClDC,UAAAA;MAAIC,aAAAA;wBAAOC;MAAAA,gCAAQ;yBAAQC;MAAAA,kCAAS;MAAUC,gBAAAA;MAAUC,iCAAAA;MAA8BC;;AAGxF,sBACIC,aAAA,CAACC,GAAD,MAAA,eACID,aAAA,CAACC,GAAD,oBACQF;AACJN,IAAAA,EAAE,EAAEA;AACJS,IAAAA,OAAO,EAAC;AACRC,IAAAA,QAAQ,EAAC;AACTC,IAAAA,SAAS,EAAE,CAACN,yBAAD,EAA4BO,aAAa,CAACC,MAAD,EAAS,OAAT,EAAkBZ,KAAlB,CAAzC;AACXF,IAAAA,GAAG,EAAEA;AACLe,IAAAA,UAAU,EAAEC,iBAAiB,CAACZ,MAAD,EAAS,UAACA,MAAD;AAAA,aAClCA,MAAM,KAAK,KAAX,GAAmB,WAAnB,GAAiCA,MAAM,KAAK,QAAX,GAAsB,SAAtB,GAAkC,QADjC;AAAA,KAAT;AAG7Ba,IAAAA,cAAc,EAAED,iBAAiB,CAACb,KAAD,EAAQ,UAACA,KAAD;AAAA,aACrCA,KAAK,KAAK,MAAV,GAAmB,WAAnB,GAAiCA,KAAK,KAAK,OAAV,GAAoB,SAApB,GAAgC,QAD5B;AAAA,KAAR;IAVrC,EAcKE,QAdL,CADJ,CADJ;AAoBH,CAxBkC;;;;"}
@@ -3,6 +3,7 @@ import React__default from 'react';
3
3
  import { Box } from '../box/box.js';
4
4
  import { Spinner } from '../spinner/spinner.js';
5
5
 
6
+ var _excluded = ["size", "exceptionallySetClassName"];
6
7
  var sizeMapping = {
7
8
  small: 24,
8
9
  medium: 36,
@@ -15,17 +16,20 @@ function Loading(_ref) {
15
16
  var _ref$size = _ref.size,
16
17
  size = _ref$size === void 0 ? 'small' : _ref$size,
17
18
  exceptionallySetClassName = _ref.exceptionallySetClassName,
18
- props = _objectWithoutPropertiesLoose(_ref, ["size", "exceptionallySetClassName"]);
19
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
19
20
 
20
21
  var numericSize = (_sizeMapping$size = sizeMapping[size]) !== null && _sizeMapping$size !== void 0 ? _sizeMapping$size : sizeMapping.small;
22
+ var ariaLabel = props['aria-label'] ? props['aria-label'] : !props['aria-labelledby'] ? 'Loading…' : undefined;
21
23
  return /*#__PURE__*/React__default.createElement(Box, Object.assign({}, props, {
24
+ "aria-label": ariaLabel,
22
25
  className: exceptionallySetClassName,
23
26
  display: "flex",
24
27
  alignItems: "center",
25
28
  justifyContent: "center",
26
29
  role: "progressbar"
27
30
  }), /*#__PURE__*/React__default.createElement(Spinner, {
28
- size: numericSize
31
+ size: numericSize,
32
+ "aria-hidden": true
29
33
  }));
30
34
  }
31
35
 
@@ -1 +1 @@
1
- {"version":3,"file":"loading.js","sources":["../../../src/new-components/loading/loading.tsx"],"sourcesContent":["import React from 'react'\nimport { Box } from '../box'\nimport { Spinner } from '../spinner'\n\ntype Size = 'small' | 'medium' | 'large'\n\ntype NativeProps = Omit<\n JSX.IntrinsicElements['div'],\n 'className' | 'aria-label' | 'aria-labelledby' | 'role' | 'size'\n>\n\ntype LoadingProps = NativeProps & {\n /**\n * The size of the loading spinner.\n * @default 'small'\n */\n size?: Size\n exceptionallySetClassName?: string\n} & (\n | {\n /**\n * The non-visual label used for assistive technologies.\n */\n 'aria-label': string\n 'aria-labelledby'?: never\n }\n | {\n /**\n * The non-visual label used for assistive technologies.\n */\n 'aria-labelledby': string\n 'aria-label'?: never\n }\n )\n\nconst sizeMapping: Record<Size, number> = {\n small: 24,\n medium: 36,\n large: 48,\n}\n\nfunction Loading({ size = 'small', exceptionallySetClassName, ...props }: LoadingProps) {\n const numericSize = sizeMapping[size] ?? sizeMapping.small\n return (\n <Box\n {...props}\n className={exceptionallySetClassName}\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n role=\"progressbar\"\n >\n <Spinner size={numericSize} />\n </Box>\n )\n}\n\nexport { Loading }\nexport type { LoadingProps }\n"],"names":["sizeMapping","small","medium","large","Loading","size","exceptionallySetClassName","props","numericSize","React","Box","className","display","alignItems","justifyContent","role","Spinner"],"mappings":";;;;;AAmCA,IAAMA,WAAW,GAAyB;AACtCC,EAAAA,KAAK,EAAE,EAD+B;AAEtCC,EAAAA,MAAM,EAAE,EAF8B;AAGtCC,EAAAA,KAAK,EAAE;AAH+B,CAA1C;;AAMA,SAASC,OAAT;;;uBAAmBC;MAAAA,8BAAO;MAASC,iCAAAA;MAA8BC;;AAC7D,MAAMC,WAAW,wBAAGR,WAAW,CAACK,IAAD,CAAd,iEAAwBL,WAAW,CAACC,KAArD;AACA,sBACIQ,4BAAA,CAACC,GAAD,oBACQH;AACJI,IAAAA,SAAS,EAAEL;AACXM,IAAAA,OAAO,EAAC;AACRC,IAAAA,UAAU,EAAC;AACXC,IAAAA,cAAc,EAAC;AACfC,IAAAA,IAAI,EAAC;IANT,eAQIN,4BAAA,CAACO,OAAD;AAASX,IAAAA,IAAI,EAAEG;GAAf,CARJ,CADJ;AAYH;;;;"}
1
+ {"version":3,"file":"loading.js","sources":["../../../src/new-components/loading/loading.tsx"],"sourcesContent":["import React from 'react'\nimport { Box } from '../box'\nimport { Spinner } from '../spinner'\n\ntype Size = 'small' | 'medium' | 'large'\n\ntype NativeProps = Omit<\n JSX.IntrinsicElements['div'],\n 'className' | 'aria-describedby' | 'aria-label' | 'aria-labelledby' | 'role' | 'size'\n>\n\ntype LoadingProps = NativeProps & {\n /**\n * The size of the loading spinner.\n * @default 'small'\n */\n size?: Size\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n /** Identifies the element (or elements) that describes the loading component for assistive technologies. */\n 'aria-describedby'?: string\n} & (\n | {\n /** Defines a string value that labels the current loading component for assistive technologies. */\n 'aria-label': string\n 'aria-labelledby'?: never\n }\n | {\n /** Identifies the element (or elements) that labels the current loading component for assistive technologies. */\n 'aria-labelledby': string\n 'aria-label'?: never\n }\n )\n\nconst sizeMapping: Record<Size, number> = {\n small: 24,\n medium: 36,\n large: 48,\n}\n\nfunction Loading({ size = 'small', exceptionallySetClassName, ...props }: LoadingProps) {\n const numericSize = sizeMapping[size] ?? sizeMapping.small\n const ariaLabel = props['aria-label']\n ? props['aria-label']\n : !props['aria-labelledby']\n ? 'Loading…'\n : undefined\n\n return (\n <Box\n {...props}\n aria-label={ariaLabel}\n className={exceptionallySetClassName}\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n role=\"progressbar\"\n >\n <Spinner size={numericSize} aria-hidden />\n </Box>\n )\n}\n\nexport { Loading }\nexport type { LoadingProps }\n"],"names":["sizeMapping","small","medium","large","Loading","size","exceptionallySetClassName","props","numericSize","ariaLabel","undefined","React","Box","className","display","alignItems","justifyContent","role","Spinner"],"mappings":";;;;;;AAoCA,IAAMA,WAAW,GAAyB;AACtCC,EAAAA,KAAK,EAAE,EAD+B;AAEtCC,EAAAA,MAAM,EAAE,EAF8B;AAGtCC,EAAAA,KAAK,EAAE;AAH+B,CAA1C;;AAMA,SAASC,OAAT;;;uBAAmBC;MAAAA,8BAAO;MAASC,iCAAAA;MAA8BC;;AAC7D,MAAMC,WAAW,wBAAGR,WAAW,CAACK,IAAD,CAAd,iEAAwBL,WAAW,CAACC,KAArD;AACA,MAAMQ,SAAS,GAAGF,KAAK,CAAC,YAAD,CAAL,GACZA,KAAK,CAAC,YAAD,CADO,GAEZ,CAACA,KAAK,CAAC,iBAAD,CAAN,GACA,UADA,GAEAG,SAJN;AAMA,sBACIC,4BAAA,CAACC,GAAD,oBACQL;kBACQE;AACZI,IAAAA,SAAS,EAAEP;AACXQ,IAAAA,OAAO,EAAC;AACRC,IAAAA,UAAU,EAAC;AACXC,IAAAA,cAAc,EAAC;AACfC,IAAAA,IAAI,EAAC;IAPT,eASIN,4BAAA,CAACO,OAAD;AAASb,IAAAA,IAAI,EAAEG;;GAAf,CATJ,CADJ;AAaH;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { useMemo, createElement, useContext, Fragment, Children, createContext } from 'react';
2
+ import { useMemo, createElement, useContext, useState, useEffect, Fragment, Children, createContext } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { Box } from '../box/box.js';
5
5
  import { Columns, Column } from '../columns/columns.js';
@@ -11,6 +11,11 @@ import { DialogOverlay, DialogContent } from '@reach/dialog';
11
11
  import FocusLock from 'react-focus-lock';
12
12
  import styles from './modal.module.css.js';
13
13
 
14
+ var _excluded = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "autoFocus", "children"],
15
+ _excluded2 = ["children", "button", "withDivider", "exceptionallySetClassName"],
16
+ _excluded3 = ["exceptionallySetClassName", "children"],
17
+ _excluded4 = ["exceptionallySetClassName", "withDivider"],
18
+ _excluded5 = ["children"];
14
19
  var ModalContext = /*#__PURE__*/createContext({
15
20
  onDismiss: undefined,
16
21
  height: 'fitContent'
@@ -41,7 +46,7 @@ function Modal(_ref) {
41
46
  _ref$autoFocus = _ref.autoFocus,
42
47
  autoFocus = _ref$autoFocus === void 0 ? true : _ref$autoFocus,
43
48
  children = _ref.children,
44
- props = _objectWithoutPropertiesLoose(_ref, ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "autoFocus", "children"]);
49
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
45
50
 
46
51
  var contextValue = useMemo(function () {
47
52
  return {
@@ -58,7 +63,8 @@ function Modal(_ref) {
58
63
  "data-testid": "modal-overlay"
59
64
  }, /*#__PURE__*/createElement(FocusLock, {
60
65
  autoFocus: autoFocus,
61
- whiteList: isNotInternalFrame
66
+ whiteList: isNotInternalFrame,
67
+ returnFocus: true
62
68
  }, /*#__PURE__*/createElement(DialogContent, Object.assign({}, props, {
63
69
  as: Box,
64
70
  borderRadius: "full",
@@ -84,10 +90,26 @@ function ModalCloseButton(props) {
84
90
  var _React$useContext = useContext(ModalContext),
85
91
  onDismiss = _React$useContext.onDismiss;
86
92
 
93
+ var _React$useState = useState(false),
94
+ includeInTabOrder = _React$useState[0],
95
+ setincludeInTabOrder = _React$useState[1];
96
+
97
+ var _React$useState2 = useState(false),
98
+ isMounted = _React$useState2[0],
99
+ setIsMounted = _React$useState2[1];
100
+
101
+ useEffect(function skipAutoFocus() {
102
+ if (isMounted) {
103
+ setincludeInTabOrder(true);
104
+ } else {
105
+ setIsMounted(true);
106
+ }
107
+ }, [isMounted]);
87
108
  return /*#__PURE__*/createElement(Button, Object.assign({}, props, {
88
109
  variant: "quaternary",
89
110
  onClick: onDismiss,
90
- icon: /*#__PURE__*/createElement(CloseIcon, null)
111
+ icon: /*#__PURE__*/createElement(CloseIcon, null),
112
+ tabIndex: includeInTabOrder ? 0 : -1
91
113
  }));
92
114
  }
93
115
  /**
@@ -105,7 +127,7 @@ function ModalHeader(_ref2) {
105
127
  _ref2$withDivider = _ref2.withDivider,
106
128
  withDivider = _ref2$withDivider === void 0 ? false : _ref2$withDivider,
107
129
  exceptionallySetClassName = _ref2.exceptionallySetClassName,
108
- props = _objectWithoutPropertiesLoose(_ref2, ["children", "button", "withDivider", "exceptionallySetClassName"]);
130
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
109
131
 
110
132
  return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Box, Object.assign({}, props, {
111
133
  as: "header",
@@ -122,7 +144,8 @@ function ModalHeader(_ref2) {
122
144
  width: "content",
123
145
  exceptionallySetClassName: styles.buttonContainer
124
146
  }, typeof button !== 'boolean' ? button : button === true ? /*#__PURE__*/createElement(ModalCloseButton, {
125
- "aria-label": "Close modal"
147
+ "aria-label": "Close modal",
148
+ autoFocus: false
126
149
  }) : null))), withDivider ? /*#__PURE__*/createElement(Divider, null) : null);
127
150
  }
128
151
  /**
@@ -141,7 +164,7 @@ function ModalHeader(_ref2) {
141
164
  function ModalBody(_ref3) {
142
165
  var exceptionallySetClassName = _ref3.exceptionallySetClassName,
143
166
  children = _ref3.children,
144
- props = _objectWithoutPropertiesLoose(_ref3, ["exceptionallySetClassName", "children"]);
167
+ props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
145
168
 
146
169
  var _React$useContext2 = useContext(ModalContext),
147
170
  height = _React$useContext2.height;
@@ -168,7 +191,7 @@ function ModalFooter(_ref4) {
168
191
  var exceptionallySetClassName = _ref4.exceptionallySetClassName,
169
192
  _ref4$withDivider = _ref4.withDivider,
170
193
  withDivider = _ref4$withDivider === void 0 ? false : _ref4$withDivider,
171
- props = _objectWithoutPropertiesLoose(_ref4, ["exceptionallySetClassName", "withDivider"]);
194
+ props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
172
195
 
173
196
  return /*#__PURE__*/createElement(Fragment, null, withDivider ? /*#__PURE__*/createElement(Divider, null) : null, /*#__PURE__*/createElement(Box, Object.assign({
174
197
  as: "footer"
@@ -187,7 +210,7 @@ function ModalFooter(_ref4) {
187
210
 
188
211
  function ModalActions(_ref5) {
189
212
  var children = _ref5.children,
190
- props = _objectWithoutPropertiesLoose(_ref5, ["children"]);
213
+ props = _objectWithoutPropertiesLoose(_ref5, _excluded5);
191
214
 
192
215
  return /*#__PURE__*/createElement(ModalFooter, Object.assign({}, props), /*#__PURE__*/createElement(Inline, {
193
216
  align: "right",
@@ -1 +1 @@
1
- {"version":3,"file":"modal.js","sources":["../../../src/new-components/modal/modal.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\nimport { DialogOverlay, DialogContent } from '@reach/dialog'\nimport FocusLock from 'react-focus-lock'\n\nimport { CloseIcon } from '../icons/close-icon'\nimport { Column, Columns } from '../columns'\nimport { Inline } from '../inline'\nimport { Divider } from '../divider'\nimport { Box } from '../box'\nimport { Button, ButtonProps } from '../button'\n\nimport styles from './modal.module.css'\n\ntype ModalWidth = 'small' | 'medium' | 'large'\ntype ModalHeightMode = 'expand' | 'fitContent'\n\n//\n// ModalContext\n//\n\ntype ModalContextValue = {\n onDismiss?(this: void): void\n height: ModalHeightMode\n}\n\nconst ModalContext = React.createContext<ModalContextValue>({\n onDismiss: undefined,\n height: 'fitContent',\n})\n\n//\n// Modal container\n//\n\ntype DivProps = Omit<\n React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLDivElement>, HTMLDivElement>,\n 'className' | 'children'\n>\n\nexport type ModalProps = DivProps & {\n /**\n * The content of the modal.\n */\n children: React.ReactNode\n /**\n * Whether the modal is open and visible or not.\n */\n isOpen: boolean\n /**\n * Called when the user triggers closing the modal.\n */\n onDismiss?(): void\n /**\n * A descriptive setting for how wide the modal should aim to be, depending on how much space\n * it has on screen.\n * @default 'medium'\n */\n width?: ModalWidth\n /**\n * A descriptive setting for how tall the modal should aim to be.\n *\n * - 'expand': the modal aims to fill most of the available screen height, leaving only a small\n * padding above and below.\n * - 'fitContent': the modal shrinks to the smallest size that allow it to fit its content.\n *\n * In either case, if content does not fit, the content of the main body is set to scroll\n * (provided you use `ModalBody`) so that the modal never has to strech vertically beyond the\n * viewport boundaries.\n *\n * If you do not use `ModalBody`, the modal still prevents overflow, and you are in charge of\n * the inner layout to ensure scroll, or whatever other strategy you may want.\n */\n height?: ModalHeightMode\n /**\n * Whether to set or not the focus initially to the first focusable element inside the modal.\n */\n autoFocus?: boolean\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\nfunction isNotInternalFrame(element: HTMLElement) {\n return !(element.ownerDocument === document && element.tagName.toLowerCase() === 'iframe')\n}\n\n/**\n * Renders a modal that sits on top of the rest of the content in the entire page.\n *\n * Follows the WAI-ARIA Dialog (Modal) Pattern.\n *\n * @see ModalHeader\n * @see ModalFooter\n * @see ModalBody\n */\nexport function Modal({\n isOpen,\n onDismiss,\n height = 'fitContent',\n width = 'medium',\n exceptionallySetClassName,\n autoFocus = true,\n children,\n ...props\n}: ModalProps) {\n const contextValue: ModalContextValue = React.useMemo(() => ({ onDismiss, height }), [\n onDismiss,\n height,\n ])\n\n return (\n <DialogOverlay\n isOpen={isOpen}\n onDismiss={onDismiss}\n dangerouslyBypassFocusLock // We're setting up our own focus lock below\n className={classNames(styles.overlay, styles[height], styles[width])}\n data-testid=\"modal-overlay\"\n >\n <FocusLock autoFocus={autoFocus} whiteList={isNotInternalFrame}>\n <DialogContent\n {...props}\n as={Box}\n borderRadius=\"full\"\n background=\"default\"\n display=\"flex\"\n flexDirection=\"column\"\n overflow=\"hidden\"\n height={height === 'expand' ? 'full' : undefined}\n flexGrow={height === 'expand' ? 1 : 0}\n className={[exceptionallySetClassName, styles.container]}\n >\n <ModalContext.Provider value={contextValue}>{children}</ModalContext.Provider>\n </DialogContent>\n </FocusLock>\n </DialogOverlay>\n )\n}\n\n//\n// ModalCloseButton\n//\n\nexport type ModalCloseButtonProps = Omit<\n ButtonProps,\n 'type' | 'children' | 'variant' | 'icon' | 'startIcon' | 'endIcon' | 'disabled' | 'loading'\n> & {\n /**\n * The descriptive label of the button.\n */\n 'aria-label': string\n}\n\n/**\n * The close button rendered by ModalHeader. Provided independently so that consumers can customize\n * the button's label.\n *\n * @see ModalHeader\n */\nexport function ModalCloseButton(props: ModalCloseButtonProps) {\n const { onDismiss } = React.useContext(ModalContext)\n return <Button {...props} variant=\"quaternary\" onClick={onDismiss} icon={<CloseIcon />} />\n}\n\n//\n// ModalHeader\n//\n\nexport type ModalHeaderProps = DivProps & {\n /**\n * The content of the header.\n */\n children: React.ReactNode\n /**\n * Allows to provide a custom button element, or to omit the close button if set to false.\n * @see ModalCloseButton\n */\n button?: React.ReactNode | boolean\n /**\n * Whether to render a divider line below the header.\n * @default false\n */\n withDivider?: boolean\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\n/**\n * Renders a standard modal header area with an optional close button.\n *\n * @see Modal\n * @see ModalFooter\n * @see ModalBody\n */\nexport function ModalHeader({\n children,\n button = true,\n withDivider = false,\n exceptionallySetClassName,\n ...props\n}: ModalHeaderProps) {\n return (\n <>\n <Box\n {...props}\n as=\"header\"\n paddingLeft=\"large\"\n paddingRight=\"small\"\n paddingY=\"small\"\n className={exceptionallySetClassName}\n >\n <Columns space=\"large\" alignY=\"center\">\n <Column width=\"auto\">{children}</Column>\n <Column width=\"content\" exceptionallySetClassName={styles.buttonContainer}>\n {typeof button !== 'boolean' ? (\n button\n ) : button === true ? (\n <ModalCloseButton aria-label=\"Close modal\" />\n ) : null}\n </Column>\n </Columns>\n </Box>\n {withDivider ? <Divider /> : null}\n </>\n )\n}\n\n//\n// ModalBody\n//\n\nexport type ModalBodyProps = DivProps & {\n /**\n * The content of the modal body.\n */\n children: React.ReactNode\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\n/**\n * Renders the body of a modal.\n *\n * Convenient to use alongside ModalHeader and/or ModalFooter as needed. It ensures, among other\n * things, that the contet of the modal body expands or contracts depending on the modal height\n * setting or the size of the content. The body content also automatically scrolls when it's too\n * large to fit the available space.\n *\n * @see Modal\n * @see ModalHeader\n * @see ModalFooter\n */\nexport function ModalBody({ exceptionallySetClassName, children, ...props }: ModalBodyProps) {\n const { height } = React.useContext(ModalContext)\n return (\n <Box\n {...props}\n className={exceptionallySetClassName}\n flexGrow={height === 'expand' ? 1 : 0}\n height={height === 'expand' ? 'full' : undefined}\n overflow=\"auto\"\n >\n <Box padding=\"large\" paddingBottom=\"xxlarge\">\n {children}\n </Box>\n </Box>\n )\n}\n\n//\n// ModalFooter\n//\n\nexport type ModalFooterProps = DivProps & {\n /**\n * The contant of the modal footer.\n */\n children: React.ReactNode\n /**\n * Whether to render a divider line below the footer.\n * @default false\n */\n withDivider?: boolean\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\n/**\n * Renders a standard modal footer area.\n *\n * @see Modal\n * @see ModalHeader\n * @see ModalBody\n */\nexport function ModalFooter({\n exceptionallySetClassName,\n withDivider = false,\n ...props\n}: ModalFooterProps) {\n return (\n <>\n {withDivider ? <Divider /> : null}\n <Box as=\"footer\" {...props} className={exceptionallySetClassName} padding=\"large\" />\n </>\n )\n}\n\n//\n// ModalActions\n//\n\n/**\n * A specific version of the ModalFooter, tailored to showing an inline list of actions (buttons).\n * @see ModalFooter\n */\nexport function ModalActions({ children, ...props }: ModalFooterProps) {\n return (\n <ModalFooter {...props}>\n <Inline align=\"right\" space=\"large\">\n {React.Children.map(children, (child) => (\n <div>{child}</div>\n ))}\n </Inline>\n </ModalFooter>\n )\n}\n"],"names":["ModalContext","React","onDismiss","undefined","height","isNotInternalFrame","element","ownerDocument","document","tagName","toLowerCase","Modal","isOpen","width","exceptionallySetClassName","autoFocus","children","props","contextValue","DialogOverlay","dangerouslyBypassFocusLock","className","classNames","styles","overlay","FocusLock","whiteList","DialogContent","as","Box","borderRadius","background","display","flexDirection","overflow","flexGrow","container","Provider","value","ModalCloseButton","Button","variant","onClick","icon","CloseIcon","ModalHeader","button","withDivider","paddingLeft","paddingRight","paddingY","Columns","space","alignY","Column","buttonContainer","Divider","ModalBody","padding","paddingBottom","ModalFooter","ModalActions","Inline","align","map","child"],"mappings":";;;;;;;;;;;;;AA0BA,IAAMA,YAAY,gBAAGC,aAAA,CAAuC;AACxDC,EAAAA,SAAS,EAAEC,SAD6C;AAExDC,EAAAA,MAAM,EAAE;AAFgD,CAAvC,CAArB;;AA0DA,SAASC,kBAAT,CAA4BC,OAA5B;AACI,SAAO,EAAEA,OAAO,CAACC,aAAR,KAA0BC,QAA1B,IAAsCF,OAAO,CAACG,OAAR,CAAgBC,WAAhB,OAAkC,QAA1E,CAAP;AACH;AAED;;;;;;;;;;;SASgBC;MACZC,cAAAA;MACAV,iBAAAA;yBACAE;MAAAA,kCAAS;wBACTS;MAAAA,gCAAQ;MACRC,iCAAAA;4BACAC;MAAAA,wCAAY;MACZC,gBAAAA;MACGC;;AAEH,MAAMC,YAAY,GAAsBjB,OAAA,CAAc;AAAA,WAAO;AAAEC,MAAAA,SAAS,EAATA,SAAF;AAAaE,MAAAA,MAAM,EAANA;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nC,EACK3C,QADL,CAPJ,CADJ;AAaH;AAsBD;;;;;;;;SAOgB4C;MACZ9C,kCAAAA;gCACAiC;MAAAA,6CAAc;MACX9B;;AAEH,sBACIhB,aAAA,SAAA,MAAA,EACK8C,WAAW,gBAAG9C,aAAA,CAACuD,OAAD,MAAA,CAAH,GAAiB,IADjC,eAEIvD,aAAA,CAAC4B,GAAD;AAAKD,IAAAA,EAAE,EAAC;KAAaX;AAAOI,IAAAA,SAAS,EAAEP;AAA2B4C,IAAAA,OAAO,EAAC;IAA1E,CAFJ,CADJ;AAMH;AAGD;AACA;;AAEA;;;;;SAIgBG;MAAe7C,iBAAAA;MAAaC;;AACxC,sBACIhB,aAAA,CAAC2D,WAAD,oBAAiB3C,MAAjB,eACIhB,aAAA,CAAC6D,MAAD;AAAQC,IAAAA,KAAK,EAAC;AAAQX,IAAAA,KAAK,EAAC;GAA5B,EACKnD,QAAA,CAAe+D,GAAf,CAAmBhD,QAAnB,EAA6B,UAACiD,KAAD;AAAA,wBAC1BhE,aAAA,MAAA,MAAA,EAAMgE,KAAN,CAD0B;AAAA,GAA7B,CADL,CADJ,CADJ;AASH;;;;"}
1
+ {"version":3,"file":"modal.js","sources":["../../../src/new-components/modal/modal.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\nimport { DialogOverlay, DialogContent } from '@reach/dialog'\nimport FocusLock from 'react-focus-lock'\n\nimport { CloseIcon } from '../icons/close-icon'\nimport { Column, Columns } from '../columns'\nimport { Inline } from '../inline'\nimport { Divider } from '../divider'\nimport { Box } from '../box'\nimport { Button, ButtonProps } from '../button'\n\nimport styles from './modal.module.css'\n\ntype ModalWidth = 'small' | 'medium' | 'large' | 'xlarge' | 'full'\ntype ModalHeightMode = 'expand' | 'fitContent'\n\n//\n// ModalContext\n//\n\ntype ModalContextValue = {\n onDismiss?(this: void): void\n height: ModalHeightMode\n}\n\nconst ModalContext = React.createContext<ModalContextValue>({\n onDismiss: undefined,\n height: 'fitContent',\n})\n\n//\n// Modal container\n//\n\ntype DivProps = Omit<\n React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLDivElement>, HTMLDivElement>,\n 'className' | 'children' | `aria-label` | `aria-labelledby`\n>\n\nexport type ModalProps = DivProps & {\n /**\n * The content of the modal.\n */\n children: React.ReactNode\n /**\n * Whether the modal is open and visible or not.\n */\n isOpen: boolean\n /**\n * Called when the user triggers closing the modal.\n */\n onDismiss?(): void\n /**\n * A descriptive setting for how wide the modal should aim to be, depending on how much space\n * it has on screen.\n * @default 'medium'\n */\n width?: ModalWidth\n /**\n * A descriptive setting for how tall the modal should aim to be.\n *\n * - 'expand': the modal aims to fill most of the available screen height, leaving only a small\n * padding above and below.\n * - 'fitContent': the modal shrinks to the smallest size that allow it to fit its content.\n *\n * In either case, if content does not fit, the content of the main body is set to scroll\n * (provided you use `ModalBody`) so that the modal never has to strech vertically beyond the\n * viewport boundaries.\n *\n * If you do not use `ModalBody`, the modal still prevents overflow, and you are in charge of\n * the inner layout to ensure scroll, or whatever other strategy you may want.\n */\n height?: ModalHeightMode\n /**\n * Whether to set or not the focus initially to the first focusable element inside the modal.\n */\n autoFocus?: boolean\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n /** Defines a string value that labels the current modal for assistive technologies. */\n 'aria-label'?: string\n /** Identifies the element (or elements) that labels the current modal for assistive technologies. */\n 'aria-labelledby'?: string\n}\n\nfunction isNotInternalFrame(element: HTMLElement) {\n return !(element.ownerDocument === document && element.tagName.toLowerCase() === 'iframe')\n}\n\n/**\n * Renders a modal that sits on top of the rest of the content in the entire page.\n *\n * Follows the WAI-ARIA Dialog (Modal) Pattern.\n *\n * @see ModalHeader\n * @see ModalFooter\n * @see ModalBody\n */\nexport function Modal({\n isOpen,\n onDismiss,\n height = 'fitContent',\n width = 'medium',\n exceptionallySetClassName,\n autoFocus = true,\n children,\n ...props\n}: ModalProps) {\n const contextValue: ModalContextValue = React.useMemo(() => ({ onDismiss, height }), [\n onDismiss,\n height,\n ])\n\n return (\n <DialogOverlay\n isOpen={isOpen}\n onDismiss={onDismiss}\n dangerouslyBypassFocusLock // We're setting up our own focus lock below\n className={classNames(styles.overlay, styles[height], styles[width])}\n data-testid=\"modal-overlay\"\n >\n <FocusLock autoFocus={autoFocus} whiteList={isNotInternalFrame} returnFocus={true}>\n <DialogContent\n {...props}\n as={Box}\n borderRadius=\"full\"\n background=\"default\"\n display=\"flex\"\n flexDirection=\"column\"\n overflow=\"hidden\"\n height={height === 'expand' ? 'full' : undefined}\n flexGrow={height === 'expand' ? 1 : 0}\n className={[exceptionallySetClassName, styles.container]}\n >\n <ModalContext.Provider value={contextValue}>{children}</ModalContext.Provider>\n </DialogContent>\n </FocusLock>\n </DialogOverlay>\n )\n}\n\n//\n// ModalCloseButton\n//\n\nexport type ModalCloseButtonProps = Omit<\n ButtonProps,\n | 'type'\n | 'children'\n | 'variant'\n | 'icon'\n | 'startIcon'\n | 'endIcon'\n | 'disabled'\n | 'loading'\n | 'tabIndex'\n> & {\n /**\n * The descriptive label of the button.\n */\n 'aria-label': string\n}\n\n/**\n * The close button rendered by ModalHeader. Provided independently so that consumers can customize\n * the button's label.\n *\n * @see ModalHeader\n */\nexport function ModalCloseButton(props: ModalCloseButtonProps) {\n const { onDismiss } = React.useContext(ModalContext)\n const [includeInTabOrder, setincludeInTabOrder] = React.useState(false)\n const [isMounted, setIsMounted] = React.useState(false)\n\n React.useEffect(\n function skipAutoFocus() {\n if (isMounted) {\n setincludeInTabOrder(true)\n } else {\n setIsMounted(true)\n }\n },\n [isMounted],\n )\n\n return (\n <Button\n {...props}\n variant=\"quaternary\"\n onClick={onDismiss}\n icon={<CloseIcon />}\n tabIndex={includeInTabOrder ? 0 : -1}\n />\n )\n}\n\n//\n// ModalHeader\n//\n\nexport type ModalHeaderProps = DivProps & {\n /**\n * The content of the header.\n */\n children: React.ReactNode\n /**\n * Allows to provide a custom button element, or to omit the close button if set to false.\n * @see ModalCloseButton\n */\n button?: React.ReactNode | boolean\n /**\n * Whether to render a divider line below the header.\n * @default false\n */\n withDivider?: boolean\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\n/**\n * Renders a standard modal header area with an optional close button.\n *\n * @see Modal\n * @see ModalFooter\n * @see ModalBody\n */\nexport function ModalHeader({\n children,\n button = true,\n withDivider = false,\n exceptionallySetClassName,\n ...props\n}: ModalHeaderProps) {\n return (\n <>\n <Box\n {...props}\n as=\"header\"\n paddingLeft=\"large\"\n paddingRight=\"small\"\n paddingY=\"small\"\n className={exceptionallySetClassName}\n >\n <Columns space=\"large\" alignY=\"center\">\n <Column width=\"auto\">{children}</Column>\n <Column width=\"content\" exceptionallySetClassName={styles.buttonContainer}>\n {typeof button !== 'boolean' ? (\n button\n ) : button === true ? (\n <ModalCloseButton aria-label=\"Close modal\" autoFocus={false} />\n ) : null}\n </Column>\n </Columns>\n </Box>\n {withDivider ? <Divider /> : null}\n </>\n )\n}\n\n//\n// ModalBody\n//\n\nexport type ModalBodyProps = DivProps & {\n /**\n * The content of the modal body.\n */\n children: React.ReactNode\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\n/**\n * Renders the body of a modal.\n *\n * Convenient to use alongside ModalHeader and/or ModalFooter as needed. It ensures, among other\n * things, that the contet of the modal body expands or contracts depending on the modal height\n * setting or the size of the content. The body content also automatically scrolls when it's too\n * large to fit the available space.\n *\n * @see Modal\n * @see ModalHeader\n * @see ModalFooter\n */\nexport function ModalBody({ exceptionallySetClassName, children, ...props }: ModalBodyProps) {\n const { height } = React.useContext(ModalContext)\n return (\n <Box\n {...props}\n className={exceptionallySetClassName}\n flexGrow={height === 'expand' ? 1 : 0}\n height={height === 'expand' ? 'full' : undefined}\n overflow=\"auto\"\n >\n <Box padding=\"large\" paddingBottom=\"xxlarge\">\n {children}\n </Box>\n </Box>\n )\n}\n\n//\n// ModalFooter\n//\n\nexport type ModalFooterProps = DivProps & {\n /**\n * The contant of the modal footer.\n */\n children: React.ReactNode\n /**\n * Whether to render a divider line below the footer.\n * @default false\n */\n withDivider?: boolean\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n}\n\n/**\n * Renders a standard modal footer area.\n *\n * @see Modal\n * @see ModalHeader\n * @see ModalBody\n */\nexport function ModalFooter({\n exceptionallySetClassName,\n withDivider = false,\n ...props\n}: ModalFooterProps) {\n return (\n <>\n {withDivider ? <Divider /> : null}\n <Box as=\"footer\" {...props} className={exceptionallySetClassName} padding=\"large\" />\n </>\n )\n}\n\n//\n// ModalActions\n//\n\n/**\n * A specific version of the ModalFooter, tailored to showing an inline list of actions (buttons).\n * @see ModalFooter\n */\nexport function ModalActions({ children, ...props }: ModalFooterProps) {\n return (\n <ModalFooter {...props}>\n <Inline align=\"right\" space=\"large\">\n {React.Children.map(children, (child) => (\n <div>{child}</div>\n ))}\n </Inline>\n </ModalFooter>\n )\n}\n"],"names":["ModalContext","React","onDismiss","undefined","height","isNotInternalFrame","element","ownerDocument","document","tagName","toLowerCase","Modal","isOpen","width","exceptionallySetClassName","autoFocus","children","props","contextValue","DialogOverlay","dangerouslyBypassFocusLock","className","classNames","styles","overlay","FocusLock","whiteList","returnFocus","DialogContent","as","Box","borderRadius","background","display","flexDirection","overflow","flexGrow","container","Provider","value","ModalCloseButton","includeInTabOrder","setincludeInTabOrder","isMounted","setIsMounted","skipAutoFocus","Button","variant","onClick","icon","CloseIcon","tabIndex","ModalHeader","button","withDivider","paddingLeft","paddingRight","paddingY","Columns","space","alignY","Column","buttonContainer","Divider","ModalBody","padding","paddingBottom","ModalFooter","ModalActions","Inline","align","map","child"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,IAAMA,YAAY,gBAAGC,aAAA,CAAuC;AACxDC,EAAAA,SAAS,EAAEC,SAD6C;AAExDC,EAAAA,MAAM,EAAE;AAFgD,CAAvC,CAArB;;AA8DA,SAASC,kBAAT,CAA4BC,OAA5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AAEP;AAA2BmD,IAAAA,OAAO,EAAC;IAA1E,CAFJ,CADJ;AAMH;AAGD;AACA;;AAEA;;;;;SAIgBG;MAAepD,iBAAAA;MAAaC;;AACxC,sBACIhB,aAAA,CAACkE,WAAD,oBAAiBlD,MAAjB,eACIhB,aAAA,CAACoE,MAAD;AAAQC,IAAAA,KAAK,EAAC;AAAQX,IAAAA,KAAK,EAAC;GAA5B,EACK1D,QAAA,CAAesE,GAAf,CAAmBvD,QAAnB,EAA6B,UAACwD,KAAD;AAAA,wBAC1BvE,aAAA,MAAA,MAAA,EAAMuE,KAAN,CAD0B;AAAA,GAA7B,CADL,CADJ,CADJ;AASH;;;;"}
@@ -1,4 +1,4 @@
1
- var modules_8f59d13b = {"reach-portal":"_93b53b2b","fadein":"_0f743b56","fitContent":"_82046c6f","container":"_36546d47","medium":"_11db4229","small":"_1c6ba1b6","large":"b8e32cac","overlay":"_47aa5864","expand":"_898993b5","buttonContainer":"_7a6f51a1"};
1
+ var modules_8f59d13b = {"reach-portal":"dddb40c3","fadein":"_955f2d73","fitContent":"_95c7550e","container":"_88079712","full":"_4779d078","large":"_5fd86231","medium":"bdfb5931","small":"_4e848a11","xlarge":"d673fba2","overlay":"ea9ae0cc","expand":"a8bf8a4f","buttonContainer":"_44d6850e"};
2
2
 
3
3
  export default modules_8f59d13b;
4
4
  //# sourceMappingURL=modal.module.css.js.map
@@ -10,6 +10,7 @@ import { PasswordHiddenIcon } from '../icons/password-hidden-icon.js';
10
10
  import styles from './password-field.module.css.js';
11
11
  import styles$1 from '../text-field/text-field.module.css.js';
12
12
 
13
+ var _excluded = ["label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth", "togglePasswordLabel", "hidden", "aria-describedby"];
13
14
  var PasswordField = /*#__PURE__*/forwardRef(function PasswordField(_ref, ref) {
14
15
  var label = _ref.label,
15
16
  secondaryLabel = _ref.secondaryLabel,
@@ -20,7 +21,7 @@ var PasswordField = /*#__PURE__*/forwardRef(function PasswordField(_ref, ref) {
20
21
  togglePasswordLabel = _ref$togglePasswordLa === void 0 ? 'Toggle password visibility' : _ref$togglePasswordLa,
21
22
  hidden = _ref.hidden,
22
23
  ariaDescribedBy = _ref['aria-describedby'],
23
- props = _objectWithoutPropertiesLoose(_ref, ["label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth", "togglePasswordLabel", "hidden", "aria-describedby"]);
24
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
24
25
 
25
26
  var id = useId(props.id);
26
27
  var internalRef = useRef(null);
@@ -1 +1 @@
1
- {"version":3,"file":"password-field.js","sources":["../../../src/new-components/password-field/password-field.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useForkRef } from 'reakit-utils'\nimport { Tooltip } from '../../components/tooltip'\nimport { BaseField } from '../base-field'\nimport { Box } from '../box'\nimport { useId } from '../common-helpers'\n\nimport { PasswordVisibleIcon } from '../icons/password-visible-icon'\nimport { PasswordHiddenIcon } from '../icons/password-hidden-icon'\n\nimport styles from './password-field.module.css'\nimport textFieldStyles from '../text-field/text-field.module.css'\n\nimport type { TextFieldProps } from '../text-field'\n\ntype PasswordFieldProps = Omit<TextFieldProps, 'type'> & {\n togglePasswordLabel?: string\n}\n\nconst PasswordField = React.forwardRef<HTMLInputElement, PasswordFieldProps>(function PasswordField(\n {\n label,\n secondaryLabel,\n auxiliaryLabel,\n hint,\n maxWidth,\n togglePasswordLabel = 'Toggle password visibility',\n hidden,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref,\n) {\n const id = useId(props.id)\n const internalRef = React.useRef<HTMLInputElement>(null)\n const inputRef = useForkRef(internalRef, ref)\n\n const [isPasswordVisible, setPasswordVisible] = React.useState(false)\n\n function togglePasswordVisibility() {\n setPasswordVisible((v) => !v)\n internalRef.current?.focus()\n }\n\n return (\n <BaseField\n id={id}\n label={label}\n secondaryLabel={secondaryLabel}\n auxiliaryLabel={auxiliaryLabel}\n hint={hint}\n maxWidth={maxWidth}\n hidden={hidden}\n aria-describedby={ariaDescribedBy}\n >\n {(extraProps) => (\n <Box\n display=\"flex\"\n alignItems=\"center\"\n className={[styles.inputWrapper, textFieldStyles.inputWrapper]}\n >\n <input\n {...props}\n {...extraProps}\n ref={inputRef}\n type={isPasswordVisible ? 'text' : 'password'}\n />\n <Tooltip content={togglePasswordLabel}>\n <button\n type=\"button\"\n onClick={togglePasswordVisibility}\n aria-label={togglePasswordLabel}\n tabIndex={-1}\n >\n {isPasswordVisible ? (\n <PasswordVisibleIcon aria-hidden />\n ) : (\n <PasswordHiddenIcon aria-hidden />\n )}\n </button>\n </Tooltip>\n </Box>\n )}\n </BaseField>\n )\n})\n\nexport { PasswordField }\nexport type { PasswordFieldProps }\n"],"names":["PasswordField","React","ref","label","secondaryLabel","auxiliaryLabel","hint","maxWidth","togglePasswordLabel","hidden","ariaDescribedBy","props","id","useId","internalRef","inputRef","useForkRef","isPasswordVisible","setPasswordVisible","togglePasswordVisibility","v","current","focus","BaseField","extraProps","Box","display","alignItems","className","styles","inputWrapper","textFieldStyles","type","Tooltip","content","onClick","tabIndex","PasswordVisibleIcon","PasswordHiddenIcon"],"mappings":";;;;;;;;;;;;IAmBMA,aAAa,gBAAGC,UAAA,CAAuD,SAASD,aAAT,OAYzEE,GAZyE;MAErEC,aAAAA;MACAC,sBAAAA;MACAC,sBAAAA;MACAC,YAAAA;MACAC,gBAAAA;mCACAC;MAAAA,yDAAsB;MACtBC,cAAAA;MACoBC,uBAApB;MACGC;;AAIP,MAAMC,EAAE,GAAGC,KAAK,CAACF,KAAK,CAACC,EAAP,CAAhB;AACA,MAAME,WAAW,GAAGb,MAAA,CAA+B,IAA/B,CAApB;AACA,MAAMc,QAAQ,GAAGC,UAAU,CAACF,WAAD,EAAcZ,GAAd,CAA3B;;wBAEgDD,QAAA,CAAe,KAAf;MAAzCgB;MAAmBC;;AAE1B,WAASC,wBAAT;;;AACID,IAAAA,kBAAkB,CAAC,UAACE,CAAD;AAAA,aAAO,CAACA,CAAR;AAAA,KAAD,CAAlB;AACA,4BAAAN,WAAW,CAACO,OAAZ,8EAAqBC,KAArB;AACH;;AAED,sBACIrB,aAAA,CAACsB,SAAD;AACIX,IAAAA,EAAE,EAAEA;AACJT,IAAAA,KAAK,EAAEA;AACPC,IAAAA,cAAc,EAAEA;AAChBC,IAAAA,cAAc,EAAEA;AAChBC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,QAAQ,EAAEA;AACVE,IAAAA,MAAM,EAAEA;wBACUC;GARtB,EAUK,UAACc,UAAD;AAAA,wBACGvB,aAAA,CAACwB,GAAD;AACIC,MAAAA,OAAO,EAAC;AACRC,MAAAA,UAAU,EAAC;AACXC,MAAAA,SAAS,EAAE,CAACC,MAAM,CAACC,YAAR,EAAsBC,QAAe,CAACD,YAAtC;KAHf,eAKI7B,aAAA,QAAA,oBACQU,OACAa;AACJtB,MAAAA,GAAG,EAAEa;AACLiB,MAAAA,IAAI,EAAEf,iBAAiB,GAAG,MAAH,GAAY;MAJvC,CALJ,eAWIhB,aAAA,CAACgC,OAAD;AAASC,MAAAA,OAAO,EAAE1B;KAAlB,eACIP,aAAA,SAAA;AACI+B,MAAAA,IAAI,EAAC;AACLG,MAAAA,OAAO,EAAEhB;oBACGX;AACZ4B,MAAAA,QAAQ,EAAE,CAAC;KAJf,EAMKnB,iBAAiB,gBACdhB,aAAA,CAACoC,mBAAD;;KAAA,CADc,gBAGdpC,aAAA,CAACqC,kBAAD;;KAAA,CATR,CADJ,CAXJ,CADH;AAAA,GAVL,CADJ;AAyCH,CAlEqB;;;;"}
1
+ {"version":3,"file":"password-field.js","sources":["../../../src/new-components/password-field/password-field.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useForkRef } from 'reakit-utils'\nimport { Tooltip } from '../../components/tooltip'\nimport { BaseField } from '../base-field'\nimport { Box } from '../box'\nimport { useId } from '../common-helpers'\n\nimport { PasswordVisibleIcon } from '../icons/password-visible-icon'\nimport { PasswordHiddenIcon } from '../icons/password-hidden-icon'\n\nimport styles from './password-field.module.css'\nimport textFieldStyles from '../text-field/text-field.module.css'\n\nimport type { TextFieldProps } from '../text-field'\n\ntype PasswordFieldProps = Omit<TextFieldProps, 'type'> & {\n togglePasswordLabel?: string\n}\n\nconst PasswordField = React.forwardRef<HTMLInputElement, PasswordFieldProps>(function PasswordField(\n {\n label,\n secondaryLabel,\n auxiliaryLabel,\n hint,\n maxWidth,\n togglePasswordLabel = 'Toggle password visibility',\n hidden,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref,\n) {\n const id = useId(props.id)\n const internalRef = React.useRef<HTMLInputElement>(null)\n const inputRef = useForkRef(internalRef, ref)\n\n const [isPasswordVisible, setPasswordVisible] = React.useState(false)\n\n function togglePasswordVisibility() {\n setPasswordVisible((v) => !v)\n internalRef.current?.focus()\n }\n\n return (\n <BaseField\n id={id}\n label={label}\n secondaryLabel={secondaryLabel}\n auxiliaryLabel={auxiliaryLabel}\n hint={hint}\n maxWidth={maxWidth}\n hidden={hidden}\n aria-describedby={ariaDescribedBy}\n >\n {(extraProps) => (\n <Box\n display=\"flex\"\n alignItems=\"center\"\n className={[styles.inputWrapper, textFieldStyles.inputWrapper]}\n >\n <input\n {...props}\n {...extraProps}\n ref={inputRef}\n type={isPasswordVisible ? 'text' : 'password'}\n />\n <Tooltip content={togglePasswordLabel}>\n <button\n type=\"button\"\n onClick={togglePasswordVisibility}\n aria-label={togglePasswordLabel}\n tabIndex={-1}\n >\n {isPasswordVisible ? (\n <PasswordVisibleIcon aria-hidden />\n ) : (\n <PasswordHiddenIcon aria-hidden />\n )}\n </button>\n </Tooltip>\n </Box>\n )}\n </BaseField>\n )\n})\n\nexport { PasswordField }\nexport type { PasswordFieldProps }\n"],"names":["PasswordField","React","ref","label","secondaryLabel","auxiliaryLabel","hint","maxWidth","togglePasswordLabel","hidden","ariaDescribedBy","props","id","useId","internalRef","inputRef","useForkRef","isPasswordVisible","setPasswordVisible","togglePasswordVisibility","v","current","focus","BaseField","extraProps","Box","display","alignItems","className","styles","inputWrapper","textFieldStyles","type","Tooltip","content","onClick","tabIndex","PasswordVisibleIcon","PasswordHiddenIcon"],"mappings":";;;;;;;;;;;;;IAmBMA,aAAa,gBAAGC,UAAA,CAAuD,SAASD,aAAT,OAYzEE,GAZyE;MAErEC,aAAAA;MACAC,sBAAAA;MACAC,sBAAAA;MACAC,YAAAA;MACAC,gBAAAA;mCACAC;MAAAA,yDAAsB;MACtBC,cAAAA;MACoBC,uBAApB;MACGC;;AAIP,MAAMC,EAAE,GAAGC,KAAK,CAACF,KAAK,CAACC,EAAP,CAAhB;AACA,MAAME,WAAW,GAAGb,MAAA,CAA+B,IAA/B,CAApB;AACA,MAAMc,QAAQ,GAAGC,UAAU,CAACF,WAAD,EAAcZ,GAAd,CAA3B;;AAEA,wBAAgDD,QAAA,CAAe,KAAf,CAAhD;AAAA,MAAOgB,iBAAP;AAAA,MAA0BC,kBAA1B;;AAEA,WAASC,wBAAT;;;AACID,IAAAA,kBAAkB,CAAC,UAACE,CAAD;AAAA,aAAO,CAACA,CAAR;AAAA,KAAD,CAAlB;AACA,4BAAAN,WAAW,CAACO,OAAZ,8EAAqBC,KAArB;AACH;;AAED,sBACIrB,aAAA,CAACsB,SAAD;AACIX,IAAAA,EAAE,EAAEA;AACJT,IAAAA,KAAK,EAAEA;AACPC,IAAAA,cAAc,EAAEA;AAChBC,IAAAA,cAAc,EAAEA;AAChBC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,QAAQ,EAAEA;AACVE,IAAAA,MAAM,EAAEA;wBACUC;GARtB,EAUK,UAACc,UAAD;AAAA,wBACGvB,aAAA,CAACwB,GAAD;AACIC,MAAAA,OAAO,EAAC;AACRC,MAAAA,UAAU,EAAC;AACXC,MAAAA,SAAS,EAAE,CAACC,MAAM,CAACC,YAAR,EAAsBC,QAAe,CAACD,YAAtC;KAHf,eAKI7B,aAAA,QAAA,oBACQU,OACAa;AACJtB,MAAAA,GAAG,EAAEa;AACLiB,MAAAA,IAAI,EAAEf,iBAAiB,GAAG,MAAH,GAAY;MAJvC,CALJ,eAWIhB,aAAA,CAACgC,OAAD;AAASC,MAAAA,OAAO,EAAE1B;KAAlB,eACIP,aAAA,SAAA;AACI+B,MAAAA,IAAI,EAAC;AACLG,MAAAA,OAAO,EAAEhB;oBACGX;AACZ4B,MAAAA,QAAQ,EAAE,CAAC;KAJf,EAMKnB,iBAAiB,gBACdhB,aAAA,CAACoC,mBAAD;;KAAA,CADc,gBAGdpC,aAAA,CAACqC,kBAAD;;KAAA,CATR,CADJ,CAXJ,CADH;AAAA,GAVL,CADJ;AAyCH,CAlEqB;;;;"}
@@ -4,6 +4,7 @@ import { Box } from '../box/box.js';
4
4
  import { BaseField } from '../base-field/base-field.js';
5
5
  import styles from './select-field.module.css.js';
6
6
 
7
+ var _excluded = ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth", "children", "hidden", "aria-describedby"];
7
8
  var SelectField = /*#__PURE__*/forwardRef(function SelectField(_ref, ref) {
8
9
  var id = _ref.id,
9
10
  label = _ref.label,
@@ -14,7 +15,7 @@ var SelectField = /*#__PURE__*/forwardRef(function SelectField(_ref, ref) {
14
15
  children = _ref.children,
15
16
  hidden = _ref.hidden,
16
17
  ariaDescribedBy = _ref['aria-describedby'],
17
- props = _objectWithoutPropertiesLoose(_ref, ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth", "children", "hidden", "aria-describedby"]);
18
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
18
19
 
19
20
  return /*#__PURE__*/createElement(BaseField, {
20
21
  id: id,
@@ -1 +1 @@
1
- {"version":3,"file":"select-field.js","sources":["../../../src/new-components/select-field/select-field.tsx"],"sourcesContent":["import * as React from 'react'\nimport { BaseField, FieldComponentProps } from '../base-field'\nimport { Box } from '../box'\nimport styles from './select-field.module.css'\n\ntype SelectFieldProps = FieldComponentProps<HTMLSelectElement>\n\nconst SelectField = React.forwardRef<HTMLSelectElement, SelectFieldProps>(function SelectField(\n {\n id,\n label,\n secondaryLabel,\n auxiliaryLabel,\n hint,\n maxWidth,\n children,\n hidden,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref,\n) {\n return (\n <BaseField\n id={id}\n label={label}\n secondaryLabel={secondaryLabel}\n auxiliaryLabel={auxiliaryLabel}\n hint={hint}\n maxWidth={maxWidth}\n hidden={hidden}\n aria-describedby={ariaDescribedBy}\n >\n {(extraProps) => (\n <Box className={styles.selectWrapper}>\n <select {...props} {...extraProps} ref={ref}>\n {children}\n </select>\n <SelectChevron aria-hidden />\n </Box>\n )}\n </BaseField>\n )\n})\n\nfunction SelectChevron(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg width=\"16\" height=\"16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path\n d=\"M11.646 5.646a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 1 1 .708-.708L8 9.293l3.646-3.647z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nexport { SelectField }\nexport type { SelectFieldProps }\n"],"names":["SelectField","React","ref","id","label","secondaryLabel","auxiliaryLabel","hint","maxWidth","children","hidden","ariaDescribedBy","props","BaseField","extraProps","Box","className","styles","selectWrapper","SelectChevron","width","height","fill","xmlns","d"],"mappings":";;;;;;IAOMA,WAAW,gBAAGC,UAAA,CAAsD,SAASD,WAAT,OAatEE,GAbsE;MAElEC,UAAAA;MACAC,aAAAA;MACAC,sBAAAA;MACAC,sBAAAA;MACAC,YAAAA;MACAC,gBAAAA;MACAC,gBAAAA;MACAC,cAAAA;MACoBC,uBAApB;MACGC;;AAIP,sBACIX,aAAA,CAACY,SAAD;AACIV,IAAAA,EAAE,EAAEA;AACJC,IAAAA,KAAK,EAAEA;AACPC,IAAAA,cAAc,EAAEA;AAChBC,IAAAA,cAAc,EAAEA;AAChBC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,QAAQ,EAAEA;AACVE,IAAAA,MAAM,EAAEA;wBACUC;GARtB,EAUK,UAACG,UAAD;AAAA,wBACGb,aAAA,CAACc,GAAD;AAAKC,MAAAA,SAAS,EAAEC,MAAM,CAACC;KAAvB,eACIjB,aAAA,SAAA,oBAAYW,OAAWE;AAAYZ,MAAAA,GAAG,EAAEA;MAAxC,EACKO,QADL,CADJ,eAIIR,aAAA,CAACkB,aAAD;;KAAA,CAJJ,CADH;AAAA,GAVL,CADJ;AAqBH,CApCmB;;AAsCpB,SAASA,aAAT,CAAuBP,KAAvB;AACI,sBACIX,aAAA,MAAA;AAAKmB,IAAAA,KAAK,EAAC;AAAKC,IAAAA,MAAM,EAAC;AAAKC,IAAAA,IAAI,EAAC;AAAOC,IAAAA,KAAK,EAAC;KAAiCX,MAA/E,eACIX,aAAA,OAAA;AACIuB,IAAAA,CAAC,EAAC;AACFF,IAAAA,IAAI,EAAC;GAFT,CADJ,CADJ;AAQH;;;;"}
1
+ {"version":3,"file":"select-field.js","sources":["../../../src/new-components/select-field/select-field.tsx"],"sourcesContent":["import * as React from 'react'\nimport { BaseField, FieldComponentProps } from '../base-field'\nimport { Box } from '../box'\nimport styles from './select-field.module.css'\n\ntype SelectFieldProps = FieldComponentProps<HTMLSelectElement>\n\nconst SelectField = React.forwardRef<HTMLSelectElement, SelectFieldProps>(function SelectField(\n {\n id,\n label,\n secondaryLabel,\n auxiliaryLabel,\n hint,\n maxWidth,\n children,\n hidden,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref,\n) {\n return (\n <BaseField\n id={id}\n label={label}\n secondaryLabel={secondaryLabel}\n auxiliaryLabel={auxiliaryLabel}\n hint={hint}\n maxWidth={maxWidth}\n hidden={hidden}\n aria-describedby={ariaDescribedBy}\n >\n {(extraProps) => (\n <Box className={styles.selectWrapper}>\n <select {...props} {...extraProps} ref={ref}>\n {children}\n </select>\n <SelectChevron aria-hidden />\n </Box>\n )}\n </BaseField>\n )\n})\n\nfunction SelectChevron(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg width=\"16\" height=\"16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path\n d=\"M11.646 5.646a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 1 1 .708-.708L8 9.293l3.646-3.647z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nexport { SelectField }\nexport type { SelectFieldProps }\n"],"names":["SelectField","React","ref","id","label","secondaryLabel","auxiliaryLabel","hint","maxWidth","children","hidden","ariaDescribedBy","props","BaseField","extraProps","Box","className","styles","selectWrapper","SelectChevron","width","height","fill","xmlns","d"],"mappings":";;;;;;;IAOMA,WAAW,gBAAGC,UAAA,CAAsD,SAASD,WAAT,OAatEE,GAbsE;MAElEC,UAAAA;MACAC,aAAAA;MACAC,sBAAAA;MACAC,sBAAAA;MACAC,YAAAA;MACAC,gBAAAA;MACAC,gBAAAA;MACAC,cAAAA;MACoBC,uBAApB;MACGC;;AAIP,sBACIX,aAAA,CAACY,SAAD;AACIV,IAAAA,EAAE,EAAEA;AACJC,IAAAA,KAAK,EAAEA;AACPC,IAAAA,cAAc,EAAEA;AAChBC,IAAAA,cAAc,EAAEA;AAChBC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,QAAQ,EAAEA;AACVE,IAAAA,MAAM,EAAEA;wBACUC;GARtB,EAUK,UAACG,UAAD;AAAA,wBACGb,aAAA,CAACc,GAAD;AAAKC,MAAAA,SAAS,EAAEC,MAAM,CAACC;KAAvB,eACIjB,aAAA,SAAA,oBAAYW,OAAWE;AAAYZ,MAAAA,GAAG,EAAEA;MAAxC,EACKO,QADL,CADJ,eAIIR,aAAA,CAACkB,aAAD;;KAAA,CAJJ,CADH;AAAA,GAVL,CADJ;AAqBH,CApCmB;;AAsCpB,SAASA,aAAT,CAAuBP,KAAvB;AACI,sBACIX,aAAA,MAAA;AAAKmB,IAAAA,KAAK,EAAC;AAAKC,IAAAA,MAAM,EAAC;AAAKC,IAAAA,IAAI,EAAC;AAAOC,IAAAA,KAAK,EAAC;KAAiCX,MAA/E,eACIX,aAAA,OAAA;AACIuB,IAAAA,CAAC,EAAC;AACFF,IAAAA,IAAI,EAAC;GAFT,CADJ,CADJ;AAQH;;;;"}
@@ -1,4 +1,4 @@
1
- var modules_1fa9b208 = {"selectWrapper":"d259b5cb"};
1
+ var modules_1fa9b208 = {"selectWrapper":"_828e09c5"};
2
2
 
3
3
  export default modules_1fa9b208;
4
4
  //# sourceMappingURL=select-field.module.css.js.map
@@ -7,16 +7,17 @@ import { Divider } from '../divider/divider.js';
7
7
  import flattenChildren from 'react-keyed-flatten-children';
8
8
  import styles from './stack.module.css.js';
9
9
 
10
+ var _excluded = ["as", "space", "align", "dividers", "children", "exceptionallySetClassName"];
10
11
  var Stack = /*#__PURE__*/polymorphicComponent(function Stack(_ref, ref) {
11
12
  var as = _ref.as,
12
13
  space = _ref.space,
13
14
  _ref$align = _ref.align,
14
15
  align = _ref$align === void 0 ? 'start' : _ref$align,
15
16
  _ref$dividers = _ref.dividers,
16
- dividers = _ref$dividers === void 0 ? false : _ref$dividers,
17
+ dividers = _ref$dividers === void 0 ? 'none' : _ref$dividers,
17
18
  children = _ref.children,
18
19
  exceptionallySetClassName = _ref.exceptionallySetClassName,
19
- props = _objectWithoutPropertiesLoose(_ref, ["as", "space", "align", "dividers", "children", "exceptionallySetClassName"]);
20
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
20
21
 
21
22
  var alignProps = align === 'start' ? undefined : {
22
23
  width: 'full',
@@ -30,9 +31,9 @@ var Stack = /*#__PURE__*/polymorphicComponent(function Stack(_ref, ref) {
30
31
  as: as,
31
32
  className: [exceptionallySetClassName, getClassNames(styles, 'space', space)],
32
33
  ref: ref
33
- }), dividers ? Children.map(flattenChildren(children), function (child, index) {
34
+ }), dividers !== 'none' ? Children.map(flattenChildren(children), function (child, index) {
34
35
  return index > 0 ? /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Divider, {
35
- weight: typeof dividers === 'string' ? dividers : undefined
36
+ weight: dividers
36
37
  }), child) : child;
37
38
  }) : children);
38
39
  });
@@ -1 +1 @@
1
- {"version":3,"file":"stack.js","sources":["../../../src/new-components/stack/stack.tsx"],"sourcesContent":["import * as React from 'react'\nimport flattenChildren from 'react-keyed-flatten-children'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { getClassNames, mapResponsiveProp } from '../responsive-props'\nimport { Box } from '../box'\nimport { Divider } from '../divider'\n\nimport type { ResponsiveProp } from '../responsive-props'\nimport type { Space } from '../common-types'\nimport type { BoxProps, ReusableBoxProps } from '../box'\nimport type { DividerWeight } from '../divider'\n\nimport styles from './stack.module.css'\n\ntype Align = 'start' | 'center' | 'end'\n\ninterface StackProps extends ReusableBoxProps {\n /** Space between items */\n space?: ResponsiveProp<Space>\n /** Align items horizontally */\n align?: ResponsiveProp<Align>\n /** Add dividers if `true`, or specify the weight of the dividers to add */\n dividers?: boolean | DividerWeight\n}\n\nconst Stack = polymorphicComponent<'div', StackProps>(function Stack(\n { as, space, align = 'start', dividers = false, children, exceptionallySetClassName, ...props },\n ref,\n) {\n const alignProps: BoxProps | undefined =\n align === 'start'\n ? undefined\n : {\n width: 'full',\n flexDirection: 'column',\n display: 'flex',\n alignItems: mapResponsiveProp(align, (align) =>\n align === 'start' ? 'flexStart' : align === 'end' ? 'flexEnd' : 'center',\n ),\n }\n\n return (\n <Box\n {...props}\n {...alignProps}\n as={as}\n className={[exceptionallySetClassName, getClassNames(styles, 'space', space)]}\n ref={ref}\n >\n {dividers\n ? React.Children.map(flattenChildren(children), (child, index) =>\n index > 0 ? (\n <>\n <Divider\n weight={typeof dividers === 'string' ? dividers : undefined}\n />\n {child}\n </>\n ) : (\n child\n ),\n )\n : children}\n </Box>\n )\n})\n\nexport type { StackProps }\nexport { Stack }\n"],"names":["Stack","polymorphicComponent","ref","as","space","align","dividers","children","exceptionallySetClassName","props","alignProps","undefined","width","flexDirection","display","alignItems","mapResponsiveProp","React","Box","className","getClassNames","styles","map","flattenChildren","child","index","Divider","weight"],"mappings":";;;;;;;;;IAyBMA,KAAK,gBAAGC,oBAAoB,CAAoB,SAASD,KAAT,OAElDE,GAFkD;MAChDC,UAAAA;MAAIC,aAAAA;wBAAOC;MAAAA,gCAAQ;2BAASC;MAAAA,sCAAW;MAAOC,gBAAAA;MAAUC,iCAAAA;MAA8BC;;AAGxF,MAAMC,UAAU,GACZL,KAAK,KAAK,OAAV,GACMM,SADN,GAEM;AACIC,IAAAA,KAAK,EAAE,MADX;AAEIC,IAAAA,aAAa,EAAE,QAFnB;AAGIC,IAAAA,OAAO,EAAE,MAHb;AAIIC,IAAAA,UAAU,EAAEC,iBAAiB,CAACX,KAAD,EAAQ,UAACA,KAAD;AAAA,aACjCA,KAAK,KAAK,OAAV,GAAoB,WAApB,GAAkCA,KAAK,KAAK,KAAV,GAAkB,SAAlB,GAA8B,QAD/B;AAAA,KAAR;AAJjC,GAHV;AAYA,sBACIY,aAAA,CAACC,GAAD,oBACQT,OACAC;AACJP,IAAAA,EAAE,EAAEA;AACJgB,IAAAA,SAAS,EAAE,CAACX,yBAAD,EAA4BY,aAAa,CAACC,MAAD,EAAS,OAAT,EAAkBjB,KAAlB,CAAzC;AACXF,IAAAA,GAAG,EAAEA;IALT,EAOKI,QAAQ,GACHW,QAAA,CAAeK,GAAf,CAAmBC,eAAe,CAAChB,QAAD,CAAlC,EAA8C,UAACiB,KAAD,EAAQC,KAAR;AAAA,WAC1CA,KAAK,GAAG,CAAR,gBACIR,aAAA,SAAA,MAAA,eACIA,aAAA,CAACS,OAAD;AACIC,MAAAA,MAAM,EAAE,OAAOrB,QAAP,KAAoB,QAApB,GAA+BA,QAA/B,GAA0CK;KADtD,CADJ,EAIKa,KAJL,CADJ,GAQIA,KATsC;AAAA,GAA9C,CADG,GAaHjB,QApBV,CADJ;AAwBH,CAxCiC;;;;"}
1
+ {"version":3,"file":"stack.js","sources":["../../../src/new-components/stack/stack.tsx"],"sourcesContent":["import * as React from 'react'\nimport flattenChildren from 'react-keyed-flatten-children'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { getClassNames, mapResponsiveProp } from '../responsive-props'\nimport { Box } from '../box'\nimport { Divider } from '../divider'\n\nimport type { ResponsiveProp } from '../responsive-props'\nimport type { DividerWeight, Space } from '../common-types'\nimport type { BoxProps, ReusableBoxProps } from '../box'\n\nimport styles from './stack.module.css'\n\ntype Align = 'start' | 'center' | 'end'\n\ninterface StackProps extends ReusableBoxProps {\n /** Space between items */\n space?: ResponsiveProp<Space>\n /** Align items horizontally */\n align?: ResponsiveProp<Align>\n /** The weight of the dividers to add. Defaults to 'none', which means no dividers are added */\n dividers?: DividerWeight\n}\n\nconst Stack = polymorphicComponent<'div', StackProps>(function Stack(\n {\n as,\n space,\n align = 'start',\n dividers = 'none',\n children,\n exceptionallySetClassName,\n ...props\n },\n ref,\n) {\n const alignProps: BoxProps | undefined =\n align === 'start'\n ? undefined\n : {\n width: 'full',\n flexDirection: 'column',\n display: 'flex',\n alignItems: mapResponsiveProp(align, (align) =>\n align === 'start' ? 'flexStart' : align === 'end' ? 'flexEnd' : 'center',\n ),\n }\n\n return (\n <Box\n {...props}\n {...alignProps}\n as={as}\n className={[exceptionallySetClassName, getClassNames(styles, 'space', space)]}\n ref={ref}\n >\n {dividers !== 'none'\n ? React.Children.map(flattenChildren(children), (child, index) =>\n index > 0 ? (\n <>\n <Divider weight={dividers} />\n {child}\n </>\n ) : (\n child\n ),\n )\n : children}\n </Box>\n )\n})\n\nexport type { StackProps }\nexport { Stack }\n"],"names":["Stack","polymorphicComponent","ref","as","space","align","dividers","children","exceptionallySetClassName","props","alignProps","undefined","width","flexDirection","display","alignItems","mapResponsiveProp","React","Box","className","getClassNames","styles","map","flattenChildren","child","index","Divider","weight"],"mappings":";;;;;;;;;;IAwBMA,KAAK,gBAAGC,oBAAoB,CAAoB,SAASD,KAAT,OAUlDE,GAVkD;MAE9CC,UAAAA;MACAC,aAAAA;wBACAC;MAAAA,gCAAQ;2BACRC;MAAAA,sCAAW;MACXC,gBAAAA;MACAC,iCAAAA;MACGC;;AAIP,MAAMC,UAAU,GACZL,KAAK,KAAK,OAAV,GACMM,SADN,GAEM;AACIC,IAAAA,KAAK,EAAE,MADX;AAEIC,IAAAA,aAAa,EAAE,QAFnB;AAGIC,IAAAA,OAAO,EAAE,MAHb;AAIIC,IAAAA,UAAU,EAAEC,iBAAiB,CAACX,KAAD,EAAQ,UAACA,KAAD;AAAA,aACjCA,KAAK,KAAK,OAAV,GAAoB,WAApB,GAAkCA,KAAK,KAAK,KAAV,GAAkB,SAAlB,GAA8B,QAD/B;AAAA,KAAR;AAJjC,GAHV;AAYA,sBACIY,aAAA,CAACC,GAAD,oBACQT,OACAC;AACJP,IAAAA,EAAE,EAAEA;AACJgB,IAAAA,SAAS,EAAE,CAACX,yBAAD,EAA4BY,aAAa,CAACC,MAAD,EAAS,OAAT,EAAkBjB,KAAlB,CAAzC;AACXF,IAAAA,GAAG,EAAEA;IALT,EAOKI,QAAQ,KAAK,MAAb,GACKW,QAAA,CAAeK,GAAf,CAAmBC,eAAe,CAAChB,QAAD,CAAlC,EAA8C,UAACiB,KAAD,EAAQC,KAAR;AAAA,WAC1CA,KAAK,GAAG,CAAR,gBACIR,aAAA,SAAA,MAAA,eACIA,aAAA,CAACS,OAAD;AAASC,MAAAA,MAAM,EAAErB;KAAjB,CADJ,EAEKkB,KAFL,CADJ,GAMIA,KAPsC;AAAA,GAA9C,CADL,GAWKjB,QAlBV,CADJ;AAsBH,CA9CiC;;;;"}
@@ -8,6 +8,7 @@ import { useId } from '../common-helpers.js';
8
8
  import { FieldHint } from '../base-field/base-field.js';
9
9
  import styles from './switch-field.module.css.js';
10
10
 
11
+ var _excluded = ["label", "hint", "disabled", "hidden", "defaultChecked", "id", "aria-describedby", "aria-label", "aria-labelledby", "onChange"];
11
12
  var SwitchField = /*#__PURE__*/forwardRef(function SwitchField(_ref, ref) {
12
13
  var _ref2, _props$checked, _props$checked2;
13
14
 
@@ -19,23 +20,31 @@ var SwitchField = /*#__PURE__*/forwardRef(function SwitchField(_ref, ref) {
19
20
  defaultChecked = _ref.defaultChecked,
20
21
  originalId = _ref.id,
21
22
  originalAriaDescribedBy = _ref['aria-describedby'],
23
+ originalAriaLabel = _ref['aria-label'],
24
+ originalAriaLabelledby = _ref['aria-labelledby'],
22
25
  _onChange = _ref.onChange,
23
- props = _objectWithoutPropertiesLoose(_ref, ["label", "hint", "disabled", "hidden", "defaultChecked", "id", "aria-describedby", "onChange"]);
26
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
24
27
 
25
28
  var id = useId(originalId);
26
29
  var hintId = useId();
27
30
  var ariaDescribedBy = originalAriaDescribedBy !== null && originalAriaDescribedBy !== void 0 ? originalAriaDescribedBy : hint ? hintId : undefined;
31
+ var ariaLabel = originalAriaLabel !== null && originalAriaLabel !== void 0 ? originalAriaLabel : undefined;
32
+ var ariaLabelledBy = originalAriaLabelledby !== null && originalAriaLabelledby !== void 0 ? originalAriaLabelledby : undefined;
28
33
 
29
- var _React$useState = useState((_ref2 = (_props$checked = props.checked) !== null && _props$checked !== void 0 ? _props$checked : defaultChecked) !== null && _ref2 !== void 0 ? _ref2 : false),
30
- checkedState = _React$useState[0],
31
- setChecked = _React$useState[1];
34
+ var _React$useState = useState(false),
35
+ keyFocused = _React$useState[0],
36
+ setKeyFocused = _React$useState[1];
37
+
38
+ var _React$useState2 = useState((_ref2 = (_props$checked = props.checked) !== null && _props$checked !== void 0 ? _props$checked : defaultChecked) !== null && _ref2 !== void 0 ? _ref2 : false),
39
+ checkedState = _React$useState2[0],
40
+ setChecked = _React$useState2[1];
32
41
 
33
42
  var isChecked = (_props$checked2 = props.checked) !== null && _props$checked2 !== void 0 ? _props$checked2 : checkedState;
34
43
  return /*#__PURE__*/createElement(Stack, {
35
44
  space: "small",
36
45
  hidden: hidden
37
46
  }, /*#__PURE__*/createElement(Box, {
38
- className: [styles.container, disabled ? styles.disabled : null, isChecked ? styles.checked : null],
47
+ className: [styles.container, disabled ? styles.disabled : null, isChecked ? styles.checked : null, keyFocused ? styles.keyFocused : null],
39
48
  as: "label",
40
49
  display: "flex",
41
50
  alignItems: "center"
@@ -51,6 +60,8 @@ var SwitchField = /*#__PURE__*/forwardRef(function SwitchField(_ref, ref) {
51
60
  type: "checkbox",
52
61
  disabled: disabled,
53
62
  "aria-describedby": ariaDescribedBy,
63
+ "aria-label": ariaLabel,
64
+ "aria-labelledby": ariaLabelledBy,
54
65
  ref: ref,
55
66
  checked: isChecked,
56
67
  onChange: function onChange(event) {
@@ -59,6 +70,18 @@ var SwitchField = /*#__PURE__*/forwardRef(function SwitchField(_ref, ref) {
59
70
  if (!event.defaultPrevented) {
60
71
  setChecked(event.currentTarget.checked);
61
72
  }
73
+ },
74
+ onBlur: function onBlur(event) {
75
+ var _props$onBlur;
76
+
77
+ setKeyFocused(false);
78
+ props === null || props === void 0 ? void 0 : (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 ? void 0 : _props$onBlur.call(props, event);
79
+ },
80
+ onKeyUp: function onKeyUp(event) {
81
+ var _props$onKeyUp;
82
+
83
+ setKeyFocused(true);
84
+ props === null || props === void 0 ? void 0 : (_props$onKeyUp = props.onKeyUp) === null || _props$onKeyUp === void 0 ? void 0 : _props$onKeyUp.call(props, event);
62
85
  }
63
86
  }))), /*#__PURE__*/createElement("span", {
64
87
  className: styles.handle
@@ -1 +1 @@
1
- {"version":3,"file":"switch-field.js","sources":["../../../src/new-components/switch-field/switch-field.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box } from '../box'\nimport { Stack } from '../stack'\nimport { Text } from '../text'\nimport { HiddenVisually } from '../hidden-visually'\nimport { FieldComponentProps, FieldHint } from '../base-field'\nimport { useId } from '../common-helpers'\nimport styles from './switch-field.module.css'\n\ntype SwitchFieldProps = Omit<\n FieldComponentProps<HTMLInputElement>,\n 'type' | 'secondaryLabel' | 'auxiliaryLabel' | 'maxWidth'\n>\n\nconst SwitchField = React.forwardRef<HTMLInputElement, SwitchFieldProps>(function SwitchField(\n {\n label,\n hint,\n disabled = false,\n hidden,\n defaultChecked,\n id: originalId,\n 'aria-describedby': originalAriaDescribedBy,\n onChange,\n ...props\n },\n ref,\n) {\n const id = useId(originalId)\n const hintId = useId()\n const ariaDescribedBy = originalAriaDescribedBy ?? (hint ? hintId : undefined)\n const [checkedState, setChecked] = React.useState(props.checked ?? defaultChecked ?? false)\n const isChecked = props.checked ?? checkedState\n return (\n <Stack space=\"small\" hidden={hidden}>\n <Box\n className={[\n styles.container,\n disabled ? styles.disabled : null,\n isChecked ? styles.checked : null,\n ]}\n as=\"label\"\n display=\"flex\"\n alignItems=\"center\"\n >\n <Box\n position=\"relative\"\n display=\"inlineBlock\"\n overflow=\"visible\"\n marginRight=\"small\"\n flexShrink={0}\n className={styles.toggle}\n >\n <HiddenVisually>\n <input\n {...props}\n id={id}\n type=\"checkbox\"\n disabled={disabled}\n aria-describedby={ariaDescribedBy}\n ref={ref}\n checked={isChecked}\n onChange={(event) => {\n onChange?.(event)\n if (!event.defaultPrevented) {\n setChecked(event.currentTarget.checked)\n }\n }}\n />\n </HiddenVisually>\n <span className={styles.handle} />\n </Box>\n <Text exceptionallySetClassName={styles.label}>{label}</Text>\n </Box>\n {hint ? <FieldHint id={hintId}>{hint}</FieldHint> : null}\n </Stack>\n )\n})\n\nexport { SwitchField }\nexport type { SwitchFieldProps }\n"],"names":["SwitchField","React","ref","label","hint","disabled","hidden","defaultChecked","originalId","id","originalAriaDescribedBy","onChange","props","useId","hintId","ariaDescribedBy","undefined","checked","checkedState","setChecked","isChecked","Stack","space","Box","className","styles","container","as","display","alignItems","position","overflow","marginRight","flexShrink","toggle","HiddenVisually","type","event","defaultPrevented","currentTarget","handle","Text","exceptionallySetClassName","FieldHint"],"mappings":";;;;;;;;;;IAcMA,WAAW,gBAAGC,UAAA,CAAqD,SAASD,WAAT,OAYrEE,GAZqE;;;MAEjEC,aAAAA;MACAC,YAAAA;2BACAC;MAAAA,sCAAW;MACXC,cAAAA;MACAC,sBAAAA;MACIC,kBAAJC;MACo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,YAAAA,SAAQ,CAAG0B,KAAH,CAAR;;AACA,UAAI,CAACA,KAAK,CAACC,gBAAX,EAA6B;AACzBnB,QAAAA,UAAU,CAACkB,KAAK,CAACE,aAAN,CAAoBtB,OAArB,CAAV;AACH;AACJ;IAbL,CADJ,CARJ,eAyBIhB,aAAA,OAAA;AAAMuB,IAAAA,SAAS,EAAEC,MAAM,CAACe;GAAxB,CAzBJ,CAVJ,eAqCIvC,aAAA,CAACwC,IAAD;AAAMC,IAAAA,yBAAyB,EAAEjB,MAAM,CAACtB;GAAxC,EAAgDA,KAAhD,CArCJ,CADJ,EAwCKC,IAAI,gBAAGH,aAAA,CAAC0C,SAAD;AAAWlC,IAAAA,EAAE,EAAEK;GAAf,EAAwBV,IAAxB,CAAH,GAA+C,IAxCxD,CADJ;AA4CH,CA/DmB;;;;"}
1
+ {"version":3,"file":"switch-field.js","sources":["../../../src/new-components/switch-field/switch-field.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box } from '../box'\nimport { Stack } from '../stack'\nimport { Text } from '../text'\nimport { HiddenVisually } from '../hidden-visually'\nimport { FieldComponentProps, FieldHint } from '../base-field'\nimport { useId } from '../common-helpers'\nimport styles from './switch-field.module.css'\n\ntype SwitchFieldProps = Omit<\n FieldComponentProps<HTMLInputElement>,\n | 'type'\n | 'secondaryLabel'\n | 'auxiliaryLabel'\n | 'maxWidth'\n | 'aria-describedby'\n | 'aria-label'\n | 'aria-labelledby'\n> & {\n /** Identifies the element (or elements) that describes the switch for assistive technologies. */\n 'aria-describedby'?: string\n /** Defines a string value that labels the current switch for assistive technologies. */\n 'aria-label'?: string\n /** Identifies the element (or elements) that labels the current switch for assistive technologies. */\n 'aria-labelledby'?: string\n}\n\nconst SwitchField = React.forwardRef<HTMLInputElement, SwitchFieldProps>(function SwitchField(\n {\n label,\n hint,\n disabled = false,\n hidden,\n defaultChecked,\n id: originalId,\n 'aria-describedby': originalAriaDescribedBy,\n 'aria-label': originalAriaLabel,\n 'aria-labelledby': originalAriaLabelledby,\n onChange,\n ...props\n },\n ref,\n) {\n const id = useId(originalId)\n const hintId = useId()\n\n const ariaDescribedBy = originalAriaDescribedBy ?? (hint ? hintId : undefined)\n const ariaLabel = originalAriaLabel ?? undefined\n const ariaLabelledBy = originalAriaLabelledby ?? undefined\n\n const [keyFocused, setKeyFocused] = React.useState(false)\n const [checkedState, setChecked] = React.useState(props.checked ?? defaultChecked ?? false)\n const isChecked = props.checked ?? checkedState\n\n return (\n <Stack space=\"small\" hidden={hidden}>\n <Box\n className={[\n styles.container,\n disabled ? styles.disabled : null,\n isChecked ? styles.checked : null,\n keyFocused ? styles.keyFocused : null,\n ]}\n as=\"label\"\n display=\"flex\"\n alignItems=\"center\"\n >\n <Box\n position=\"relative\"\n display=\"inlineBlock\"\n overflow=\"visible\"\n marginRight=\"small\"\n flexShrink={0}\n className={styles.toggle}\n >\n <HiddenVisually>\n <input\n {...props}\n id={id}\n type=\"checkbox\"\n disabled={disabled}\n aria-describedby={ariaDescribedBy}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n ref={ref}\n checked={isChecked}\n onChange={(event) => {\n onChange?.(event)\n if (!event.defaultPrevented) {\n setChecked(event.currentTarget.checked)\n }\n }}\n onBlur={(event) => {\n setKeyFocused(false)\n props?.onBlur?.(event)\n }}\n onKeyUp={(event) => {\n setKeyFocused(true)\n props?.onKeyUp?.(event)\n }}\n />\n </HiddenVisually>\n <span className={styles.handle} />\n </Box>\n <Text exceptionallySetClassName={styles.label}>{label}</Text>\n </Box>\n {hint ? <FieldHint id={hintId}>{hint}</FieldHint> : null}\n </Stack>\n )\n})\n\nexport { SwitchField }\nexport type { SwitchFieldProps }\n"],"names":["SwitchField","React","ref","label","hint","disabled","hidden","defaultChecked","originalId","id","originalAriaDescribedBy","originalAriaLabel","originalAriaLabelledby","onChange","props","useId","hintId","ariaDescribedBy","undefined","ariaLabel","ariaLabelledBy","keyFocused","setKeyFocused","checked","checkedState","setChecked","isChecked","Stack","space","Box","className","styles","container","as","display","alignItems","position","overflow","marginRight","flexShrink","toggle","HiddenVisually","type","event","defaultPrevented","currentTarget","onBlur","onKeyUp","handle","Text","exceptionallySetClassName","FieldHint"],"mappings":";;;;;;;;;;;IA2BMA,WAAW,gBAAGC,UAAA,CAAqD,SAASD,WAAT,OAcrEE,GAdqE;;;MAEjEC,aAAAA;MACAC,YAAAA;2BACAC;MAAAA,sCAAW;MACXC,cAAAA;MACAC,sBAAAA;MACIC,kBAAJC;MACoBC,+BAApB;MACcC,yBAAd;MACmBC,8BAAnB;MACAC,iBAAAA;MACGC;;AAIP,MAAML,EAAE,GAAGM,KAAK,CAACP,UAAD,CAAhB;AACA,MAAMQ,MAAM,GAAGD,KAAK,EAApB;AAEA,MAAME,eAAe,GAAGP,uBAAH,aAAGA,uBAAH,cAAGA,uBAAH,GAA+BN,IAAI,GAAGY,MAAH,GAAYE,SAApE;AACA,MAAMC,SAAS,GAAGR,iBAAH,aAAGA,iBAAH,cAAGA,iBAAH,GAAwBO,SAAvC;AACA,MAAME,cAAc,GAAGR,sBAAH,aAAGA,sBAAH,cAAGA,sBAAH,GAA6BM,SAAjD;;AAEA,wBAAoCjB,QAAA,CAAe,KAAf,CAApC;AAAA,MAAOoB,UAAP;AAAA,MAAmBC,aAAnB;;AACA,yBAAmCrB,QAAA,4BAAea,KAAK,CAACS,OAArB,2DAAgChB,cAAhC,yCAAkD,KAAlD,CAAnC;AAAA,MAAOiB,YAAP;AAAA,MAAqBC,UAArB;;AACA,MAAMC,SAAS,sBAAGZ,KAAK,CAACS,OAAT,6DAAoBC,YAAnC;AAEA,sBACIvB,aAAA,CAAC0B,KAAD;AAAOC,IAAAA,KAAK,EAAC;AAAQtB,IAAAA,MAAM,EAAEA;GAA7B,eACIL,aAAA,CAAC4B,GAAD;AACIC,IAAAA,SAAS,EAAE,CACPC,MAAM,CAACC,SADA,EAEP3B,QAAQ,GAAG0B,MAAM,CAAC1B,QAAV,GAAqB,IAFtB,EAGPqB,SAAS,GAA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H;IAvBL,CADJ,CARJ,eAmCI1C,aAAA,OAAA;AAAM6B,IAAAA,SAAS,EAAEC,MAAM,CAACiB;GAAxB,CAnCJ,CAXJ,eAgDI/C,aAAA,CAACgD,IAAD;AAAMC,IAAAA,yBAAyB,EAAEnB,MAAM,CAAC5B;GAAxC,EAAgDA,KAAhD,CAhDJ,CADJ,EAmDKC,IAAI,gBAAGH,aAAA,CAACkD,SAAD;AAAW1C,IAAAA,EAAE,EAAEO;GAAf,EAAwBZ,IAAxB,CAAH,GAA+C,IAnDxD,CADJ;AAuDH,CAlFmB;;;;"}
@@ -1,4 +1,4 @@
1
- var modules_8e05f7c9 = {"container":"_99a80509","disabled":"b5cf26ef","checked":"a63c43a2","toggle":"f318ae83","label":"_427926b9","handle":"_9fcd994c"};
1
+ var modules_8e05f7c9 = {"container":"ec63c3f1","disabled":"_7de9c06d","checked":"a37981fc","toggle":"_2a17ac45","label":"_68cc9707","handle":"_91409c7f","keyFocused":"a6490371"};
2
2
 
3
3
  export default modules_8e05f7c9;
4
4
  //# sourceMappingURL=switch-field.module.css.js.map
@@ -7,6 +7,11 @@ import { useTabState, Tab as Tab$1, TabList as TabList$1, TabPanel as TabPanel$1
7
7
  import { usePrevious } from '../../hooks/use-previous/use-previous.js';
8
8
  import styles from './tabs.module.css.js';
9
9
 
10
+ var _excluded = ["color", "variant"],
11
+ _excluded2 = ["children", "space"],
12
+ _excluded3 = ["color", "variant"],
13
+ _excluded4 = ["children", "id", "as", "render"],
14
+ _excluded5 = ["color", "variant"];
10
15
  var TabsContext = /*#__PURE__*/createContext(null);
11
16
  /**
12
17
  * Used to group components that compose a set of tabs. There can only be one active tab within the same `<Tabs>` group.
@@ -58,7 +63,7 @@ function Tab(_ref2) {
58
63
 
59
64
  var color = tabContextValue.color,
60
65
  variant = tabContextValue.variant,
61
- tabState = _objectWithoutPropertiesLoose(tabContextValue, ["color", "variant"]);
66
+ tabState = _objectWithoutPropertiesLoose(tabContextValue, _excluded);
62
67
 
63
68
  return /*#__PURE__*/createElement(Tab$1, Object.assign({
64
69
  className: classNames(styles.tab, styles["tab-" + (variant !== null && variant !== void 0 ? variant : '')], styles["tab-" + (color !== null && color !== void 0 ? color : '')]),
@@ -73,7 +78,7 @@ function TabList(_ref3) {
73
78
  var children = _ref3.children,
74
79
  _ref3$space = _ref3.space,
75
80
  space = _ref3$space === void 0 ? 'medium' : _ref3$space,
76
- props = _objectWithoutPropertiesLoose(_ref3, ["children", "space"]);
81
+ props = _objectWithoutPropertiesLoose(_ref3, _excluded2);
77
82
 
78
83
  var tabContextValue = useContext(TabsContext);
79
84
 
@@ -81,7 +86,7 @@ function TabList(_ref3) {
81
86
  return null;
82
87
  }
83
88
 
84
- var tabState = _objectWithoutPropertiesLoose(tabContextValue, ["color", "variant"]);
89
+ var tabState = _objectWithoutPropertiesLoose(tabContextValue, _excluded3);
85
90
 
86
91
  return /*#__PURE__*/createElement(TabList$1, Object.assign({}, props, tabState), /*#__PURE__*/createElement(Inline, {
87
92
  space: space
@@ -97,7 +102,7 @@ var TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref4, ref) {
97
102
  as = _ref4.as,
98
103
  _ref4$render = _ref4.render,
99
104
  render = _ref4$render === void 0 ? 'always' : _ref4$render,
100
- props = _objectWithoutPropertiesLoose(_ref4, ["children", "id", "as", "render"]);
105
+ props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
101
106
 
102
107
  var tabContextValue = useContext(TabsContext);
103
108
 
@@ -116,7 +121,7 @@ var TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref4, ref) {
116
121
  return null;
117
122
  }
118
123
 
119
- var tabState = _objectWithoutPropertiesLoose(tabContextValue, ["color", "variant"]);
124
+ var tabState = _objectWithoutPropertiesLoose(tabContextValue, _excluded5);
120
125
 
121
126
  return /*#__PURE__*/createElement(TabPanel$1, Object.assign({
122
127
  tabId: id