@doist/reactist 29.1.1 → 29.1.2

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 (227) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/reactist.cjs.development.js +6749 -1832
  3. package/dist/reactist.cjs.development.js.map +1 -1
  4. package/dist/reactist.cjs.production.min.js +1 -1
  5. package/dist/reactist.cjs.production.min.js.map +1 -1
  6. package/es/avatar/avatar.js +106 -36
  7. package/es/avatar/avatar.js.map +1 -1
  8. package/es/avatar/utils.js +17 -19
  9. package/es/avatar/utils.js.map +1 -1
  10. package/es/badge/badge.js +50 -6
  11. package/es/badge/badge.js.map +1 -1
  12. package/es/banner/banner.js +384 -41
  13. package/es/banner/banner.js.map +1 -1
  14. package/es/base-field/base-field.js +367 -77
  15. package/es/base-field/base-field.js.map +1 -1
  16. package/es/box/box.js +139 -61
  17. package/es/box/box.js.map +1 -1
  18. package/es/button/button.js +346 -36
  19. package/es/button/button.js.map +1 -1
  20. package/es/checkbox-field/checkbox-field.js +71 -48
  21. package/es/checkbox-field/checkbox-field.js.map +1 -1
  22. package/es/checkbox-field/checkbox-icon.js +88 -28
  23. package/es/checkbox-field/checkbox-icon.js.map +1 -1
  24. package/es/checkbox-field/use-fork-ref.js +15 -20
  25. package/es/checkbox-field/use-fork-ref.js.map +1 -1
  26. package/es/columns/columns.js +46 -23
  27. package/es/columns/columns.js.map +1 -1
  28. package/es/components/color-picker/color-picker.js +190 -46
  29. package/es/components/color-picker/color-picker.js.map +1 -1
  30. package/es/components/deprecated-button/deprecated-button.js +102 -9
  31. package/es/components/deprecated-button/deprecated-button.js.map +1 -1
  32. package/es/components/deprecated-button/index.js +5 -2
  33. package/es/components/deprecated-button/index.js.map +1 -1
  34. package/es/components/deprecated-dropdown/dropdown.js +234 -134
  35. package/es/components/deprecated-dropdown/dropdown.js.map +1 -1
  36. package/es/components/deprecated-dropdown/index.js +4 -1
  37. package/es/components/deprecated-dropdown/index.js.map +1 -1
  38. package/es/components/deprecated-input/index.js +5 -2
  39. package/es/components/deprecated-input/index.js.map +1 -1
  40. package/es/components/deprecated-input/input.js +27 -4
  41. package/es/components/deprecated-input/input.js.map +1 -1
  42. package/es/components/deprecated-select/select.js +110 -7
  43. package/es/components/deprecated-select/select.js.map +1 -1
  44. package/es/components/key-capturer/key-capturer.js +190 -137
  45. package/es/components/key-capturer/key-capturer.js.map +1 -1
  46. package/es/components/keyboard-shortcut/keyboard-shortcut.js +65 -45
  47. package/es/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  48. package/es/components/progress-bar/progress-bar.js +61 -9
  49. package/es/components/progress-bar/progress-bar.js.map +1 -1
  50. package/es/components/time/index.js +5 -2
  51. package/es/components/time/index.js.map +1 -1
  52. package/es/components/time/time-utils.js +59 -53
  53. package/es/components/time/time-utils.js.map +1 -1
  54. package/es/components/time/time.js +94 -91
  55. package/es/components/time/time.js.map +1 -1
  56. package/es/divider/divider.js +44 -5
  57. package/es/divider/divider.js.map +1 -1
  58. package/es/heading/heading.js +122 -20
  59. package/es/heading/heading.js.map +1 -1
  60. package/es/hidden/hidden.js +36 -30
  61. package/es/hidden/hidden.js.map +1 -1
  62. package/es/hidden-visually/hidden-visually.js +9 -4
  63. package/es/hidden-visually/hidden-visually.js.map +1 -1
  64. package/es/icons/alert-icon.js +145 -18
  65. package/es/icons/alert-icon.js.map +1 -1
  66. package/es/icons/banner-icon.js +213 -25
  67. package/es/icons/banner-icon.js.map +1 -1
  68. package/es/icons/close-icon.js +26 -3
  69. package/es/icons/close-icon.js.map +1 -1
  70. package/es/icons/password-hidden-icon.js +40 -6
  71. package/es/icons/password-hidden-icon.js.map +1 -1
  72. package/es/icons/password-visible-icon.js +33 -5
  73. package/es/icons/password-visible-icon.js.map +1 -1
  74. package/es/index.js +9 -9
  75. package/es/inline/inline.js +24 -9
  76. package/es/inline/inline.js.map +1 -1
  77. package/es/loading/loading.js +63 -17
  78. package/es/loading/loading.js.map +1 -1
  79. package/es/menu/menu.js +469 -92
  80. package/es/menu/menu.js.map +1 -1
  81. package/es/modal/modal.js +675 -112
  82. package/es/modal/modal.js.map +1 -1
  83. package/es/notice/notice.js +77 -10
  84. package/es/notice/notice.js.map +1 -1
  85. package/es/password-field/password-field.js +89 -11
  86. package/es/password-field/password-field.js.map +1 -1
  87. package/es/prose/prose.js +48 -9
  88. package/es/prose/prose.js.map +1 -1
  89. package/es/select-field/select-field.js +150 -19
  90. package/es/select-field/select-field.js.map +1 -1
  91. package/es/spinner/spinner.js +39 -6
  92. package/es/spinner/spinner.js.map +1 -1
  93. package/es/stack/stack.js +29 -17
  94. package/es/stack/stack.js.map +1 -1
  95. package/es/switch-field/switch-field.js +225 -42
  96. package/es/switch-field/switch-field.js.map +1 -1
  97. package/es/tabs/tabs.js +207 -109
  98. package/es/tabs/tabs.js.map +1 -1
  99. package/es/text/text.js +27 -17
  100. package/es/text/text.js.map +1 -1
  101. package/es/text-area/text-area.js +264 -54
  102. package/es/text-area/text-area.js.map +1 -1
  103. package/es/text-field/text-field.js +204 -31
  104. package/es/text-field/text-field.js.map +1 -1
  105. package/es/text-link/text-link.js +21 -10
  106. package/es/text-link/text-link.js.map +1 -1
  107. package/es/toast/static-toast.js +143 -25
  108. package/es/toast/static-toast.js.map +1 -1
  109. package/es/toast/toast-animation.js +159 -109
  110. package/es/toast/toast-animation.js.map +1 -1
  111. package/es/toast/use-toasts.js +309 -84
  112. package/es/toast/use-toasts.js.map +1 -1
  113. package/es/tooltip/tooltip.js +88 -32
  114. package/es/tooltip/tooltip.js.map +1 -1
  115. package/es/utils/common-helpers.js +12 -11
  116. package/es/utils/common-helpers.js.map +1 -1
  117. package/es/utils/polymorphism.js +84 -1
  118. package/es/utils/polymorphism.js.map +1 -1
  119. package/es/utils/responsive-props.js +43 -32
  120. package/es/utils/responsive-props.js.map +1 -1
  121. package/lib/avatar/avatar.js +109 -35
  122. package/lib/avatar/avatar.js.map +1 -1
  123. package/lib/avatar/utils.js +17 -19
  124. package/lib/avatar/utils.js.map +1 -1
  125. package/lib/badge/badge.js +53 -5
  126. package/lib/badge/badge.js.map +1 -1
  127. package/lib/banner/banner.js +385 -38
  128. package/lib/banner/banner.js.map +1 -1
  129. package/lib/base-field/base-field.js +366 -73
  130. package/lib/base-field/base-field.js.map +1 -1
  131. package/lib/box/box.js +141 -61
  132. package/lib/box/box.js.map +1 -1
  133. package/lib/button/button.js +347 -35
  134. package/lib/button/button.js.map +1 -1
  135. package/lib/checkbox-field/checkbox-field.js +73 -46
  136. package/lib/checkbox-field/checkbox-field.js.map +1 -1
  137. package/lib/checkbox-field/checkbox-icon.js +92 -28
  138. package/lib/checkbox-field/checkbox-icon.js.map +1 -1
  139. package/lib/checkbox-field/use-fork-ref.js +15 -20
  140. package/lib/checkbox-field/use-fork-ref.js.map +1 -1
  141. package/lib/columns/columns.js +49 -22
  142. package/lib/columns/columns.js.map +1 -1
  143. package/lib/components/color-picker/color-picker.js +189 -45
  144. package/lib/components/color-picker/color-picker.js.map +1 -1
  145. package/lib/components/deprecated-button/deprecated-button.js +104 -9
  146. package/lib/components/deprecated-button/deprecated-button.js.map +1 -1
  147. package/lib/components/deprecated-dropdown/dropdown.js +235 -133
  148. package/lib/components/deprecated-dropdown/dropdown.js.map +1 -1
  149. package/lib/components/deprecated-input/input.js +28 -4
  150. package/lib/components/deprecated-input/input.js.map +1 -1
  151. package/lib/components/deprecated-select/select.js +112 -7
  152. package/lib/components/deprecated-select/select.js.map +1 -1
  153. package/lib/components/key-capturer/key-capturer.js +188 -135
  154. package/lib/components/key-capturer/key-capturer.js.map +1 -1
  155. package/lib/components/keyboard-shortcut/keyboard-shortcut.js +67 -45
  156. package/lib/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  157. package/lib/components/progress-bar/progress-bar.js +60 -8
  158. package/lib/components/progress-bar/progress-bar.js.map +1 -1
  159. package/lib/components/time/time-utils.js +59 -53
  160. package/lib/components/time/time-utils.js.map +1 -1
  161. package/lib/components/time/time.js +93 -90
  162. package/lib/components/time/time.js.map +1 -1
  163. package/lib/divider/divider.js +47 -4
  164. package/lib/divider/divider.js.map +1 -1
  165. package/lib/heading/heading.js +125 -19
  166. package/lib/heading/heading.js.map +1 -1
  167. package/lib/hidden/hidden.js +39 -29
  168. package/lib/hidden/hidden.js.map +1 -1
  169. package/lib/hidden-visually/hidden-visually.js +11 -3
  170. package/lib/hidden-visually/hidden-visually.js.map +1 -1
  171. package/lib/icons/alert-icon.js +149 -18
  172. package/lib/icons/alert-icon.js.map +1 -1
  173. package/lib/icons/banner-icon.js +217 -25
  174. package/lib/icons/banner-icon.js.map +1 -1
  175. package/lib/icons/close-icon.js +29 -3
  176. package/lib/icons/close-icon.js.map +1 -1
  177. package/lib/icons/password-hidden-icon.js +43 -6
  178. package/lib/icons/password-hidden-icon.js.map +1 -1
  179. package/lib/icons/password-visible-icon.js +36 -5
  180. package/lib/icons/password-visible-icon.js.map +1 -1
  181. package/lib/inline/inline.js +27 -8
  182. package/lib/inline/inline.js.map +1 -1
  183. package/lib/loading/loading.js +67 -17
  184. package/lib/loading/loading.js.map +1 -1
  185. package/lib/menu/menu.js +471 -91
  186. package/lib/menu/menu.js.map +1 -1
  187. package/lib/modal/modal.js +671 -106
  188. package/lib/modal/modal.js.map +1 -1
  189. package/lib/notice/notice.js +75 -8
  190. package/lib/notice/notice.js.map +1 -1
  191. package/lib/password-field/password-field.js +92 -10
  192. package/lib/password-field/password-field.js.map +1 -1
  193. package/lib/prose/prose.js +51 -8
  194. package/lib/prose/prose.js.map +1 -1
  195. package/lib/select-field/select-field.js +152 -17
  196. package/lib/select-field/select-field.js.map +1 -1
  197. package/lib/spinner/spinner.js +39 -6
  198. package/lib/spinner/spinner.js.map +1 -1
  199. package/lib/stack/stack.js +29 -15
  200. package/lib/stack/stack.js.map +1 -1
  201. package/lib/switch-field/switch-field.js +225 -38
  202. package/lib/switch-field/switch-field.js.map +1 -1
  203. package/lib/tabs/tabs.js +207 -107
  204. package/lib/tabs/tabs.js.map +1 -1
  205. package/lib/text/text.js +30 -16
  206. package/lib/text/text.js.map +1 -1
  207. package/lib/text-area/text-area.js +264 -52
  208. package/lib/text-area/text-area.js.map +1 -1
  209. package/lib/text-field/text-field.js +207 -30
  210. package/lib/text-field/text-field.js.map +1 -1
  211. package/lib/text-link/text-link.js +24 -9
  212. package/lib/text-link/text-link.js.map +1 -1
  213. package/lib/toast/static-toast.js +142 -22
  214. package/lib/toast/static-toast.js.map +1 -1
  215. package/lib/toast/toast-animation.js +158 -108
  216. package/lib/toast/toast-animation.js.map +1 -1
  217. package/lib/toast/use-toasts.js +310 -82
  218. package/lib/toast/use-toasts.js.map +1 -1
  219. package/lib/tooltip/tooltip.js +87 -31
  220. package/lib/tooltip/tooltip.js.map +1 -1
  221. package/lib/utils/common-helpers.js +12 -11
  222. package/lib/utils/common-helpers.js.map +1 -1
  223. package/lib/utils/polymorphism.js +84 -1
  224. package/lib/utils/polymorphism.js.map +1 -1
  225. package/lib/utils/responsive-props.js +43 -32
  226. package/lib/utils/responsive-props.js.map +1 -1
  227. package/package.json +10 -2
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var reactCompilerRuntime = require('react-compiler-runtime');
5
6
  var React = require('react');
6
7
  var react = require('@ariakit/react');
7
8
  var box = require('../box/box.js');
@@ -27,39 +28,94 @@ function _interopNamespace(e) {
27
28
 
28
29
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
30
 
30
- var defaultShowTimeout = 500;
31
- var defaultHideTimeout = 100;
32
- var TooltipContext = React__namespace.createContext({
33
- showTimeout: defaultShowTimeout,
34
- hideTimeout: defaultHideTimeout,
31
+ const defaultShowTimeout = 500;
32
+ const defaultHideTimeout = 100;
33
+ const TooltipContext = /*#__PURE__*/React__namespace.createContext({
34
+ showTimeout: defaultShowTimeout,
35
+ hideTimeout: defaultHideTimeout
35
36
  });
36
- function TooltipProvider(_a) {
37
- var _b = _a.showTimeout, showTimeout = _b === void 0 ? defaultShowTimeout : _b, _c = _a.hideTimeout, hideTimeout = _c === void 0 ? defaultHideTimeout : _c, children = _a.children;
38
- var value = React__namespace.useMemo(function () { return ({ showTimeout: showTimeout, hideTimeout: hideTimeout }); }, [showTimeout, hideTimeout]);
39
- return React__namespace.createElement(TooltipContext.Provider, { value: value }, children);
37
+ function TooltipProvider(t0) {
38
+ const $ = reactCompilerRuntime.c(6);
39
+ const {
40
+ showTimeout: t1,
41
+ hideTimeout: t2,
42
+ children
43
+ } = t0;
44
+ const showTimeout = t1 === undefined ? defaultShowTimeout : t1;
45
+ const hideTimeout = t2 === undefined ? defaultHideTimeout : t2;
46
+ let t3;
47
+ if ($[0] !== hideTimeout || $[1] !== showTimeout) {
48
+ t3 = {
49
+ showTimeout,
50
+ hideTimeout
51
+ };
52
+ $[0] = hideTimeout;
53
+ $[1] = showTimeout;
54
+ $[2] = t3;
55
+ } else {
56
+ t3 = $[2];
57
+ }
58
+ const value = t3;
59
+ let t4;
60
+ if ($[3] !== children || $[4] !== value) {
61
+ t4 = /*#__PURE__*/React__namespace.createElement(TooltipContext.Provider, {
62
+ value: value
63
+ }, children);
64
+ $[3] = children;
65
+ $[4] = value;
66
+ $[5] = t4;
67
+ } else {
68
+ t4 = $[5];
69
+ }
70
+ return t4;
40
71
  }
41
- var Tooltip = React__namespace.forwardRef(function (_a, ref) {
42
- var children = _a.children, content = _a.content, _b = _a.position, position = _b === void 0 ? 'top' : _b, _c = _a.gapSize, gapSize = _c === void 0 ? 3 : _c, _d = _a.withArrow, withArrow = _d === void 0 ? false : _d, showTimeout = _a.showTimeout, hideTimeout = _a.hideTimeout, exceptionallySetClassName = _a.exceptionallySetClassName;
43
- var _e = React__namespace.useContext(TooltipContext), globalShowTimeout = _e.showTimeout, globalHideTimeout = _e.hideTimeout;
44
- var tooltip = react.useTooltipStore({
45
- placement: position,
46
- showTimeout: showTimeout !== null && showTimeout !== void 0 ? showTimeout : globalShowTimeout,
47
- hideTimeout: hideTimeout !== null && hideTimeout !== void 0 ? hideTimeout : globalHideTimeout,
48
- });
49
- React__namespace.useImperativeHandle(ref, function () { return tooltip; }, [tooltip]);
50
- var isOpen = tooltip.useState('open');
51
- var child = React__namespace.Children.only(children);
52
- if (!child) {
53
- return child;
54
- }
55
- if (typeof child.ref === 'string') {
56
- throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded');
57
- }
58
- return (React__namespace.createElement(React__namespace.Fragment, null,
59
- React__namespace.createElement(react.TooltipAnchor, { render: child, store: tooltip, ref: child.ref }),
60
- isOpen && content ? (React__namespace.createElement(react.Tooltip, { store: tooltip, gutter: gapSize, render: React__namespace.createElement(box.Box, { className: [tooltip_module["default"].tooltip, exceptionallySetClassName], background: "toast", borderRadius: "standard", paddingX: "small", paddingY: "xsmall", maxWidth: "medium", width: "fitContent", overflow: "hidden", textAlign: "center" }) },
61
- withArrow ? React__namespace.createElement(react.TooltipArrow, null) : null,
62
- typeof content === 'function' ? content() : content)) : null));
72
+ const Tooltip = /*#__PURE__*/React__namespace.forwardRef(({
73
+ children,
74
+ content,
75
+ position = 'top',
76
+ gapSize = 3,
77
+ withArrow = false,
78
+ showTimeout,
79
+ hideTimeout,
80
+ exceptionallySetClassName
81
+ }, ref) => {
82
+ const {
83
+ showTimeout: globalShowTimeout,
84
+ hideTimeout: globalHideTimeout
85
+ } = React__namespace.useContext(TooltipContext);
86
+ const tooltip = react.useTooltipStore({
87
+ placement: position,
88
+ showTimeout: showTimeout ?? globalShowTimeout,
89
+ hideTimeout: hideTimeout ?? globalHideTimeout
90
+ });
91
+ React__namespace.useImperativeHandle(ref, () => tooltip, [tooltip]);
92
+ const isOpen = tooltip.useState('open');
93
+ const child = React__namespace.Children.only(children);
94
+ if (!child) {
95
+ return child;
96
+ }
97
+ if (typeof child.ref === 'string') {
98
+ throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded');
99
+ }
100
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(react.TooltipAnchor, {
101
+ render: child,
102
+ store: tooltip,
103
+ ref: child.ref
104
+ }), isOpen && content ? /*#__PURE__*/React__namespace.createElement(react.Tooltip, {
105
+ store: tooltip,
106
+ gutter: gapSize,
107
+ render: /*#__PURE__*/React__namespace.createElement(box.Box, {
108
+ className: [tooltip_module["default"].tooltip, exceptionallySetClassName],
109
+ background: "toast",
110
+ borderRadius: "standard",
111
+ paddingX: "small",
112
+ paddingY: "xsmall",
113
+ maxWidth: "medium",
114
+ width: "fitContent",
115
+ overflow: "hidden",
116
+ textAlign: "center"
117
+ })
118
+ }, withArrow ? /*#__PURE__*/React__namespace.createElement(react.TooltipArrow, null) : null, typeof content === 'function' ? content() : content) : null);
63
119
  });
64
120
  Tooltip.displayName = 'Tooltip';
65
121
 
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sources":["../../src/tooltip/tooltip.tsx"],"sourcesContent":[null],"names":["React","useTooltipStore","TooltipAnchor","AriakitTooltip","Box","styles","TooltipArrow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAM,kBAAkB,GAAG,GAAG,CAAA;AAC9B,IAAM,kBAAkB,GAAG,GAAG,CAAA;AAO9B,IAAM,cAAc,GAAGA,gBAAK,CAAC,aAAa,CAAsB;AAC5D,IAAA,WAAW,EAAE,kBAAkB;AAC/B,IAAA,WAAW,EAAE,kBAAkB;AAClC,CAAA,CAAC,CAAA;AAEF,SAAS,eAAe,CAAC,EAOvB,EAAA;AANE,IAAA,IAAA,EAAA,GAAA,EAAA,CAAA,WAAgC,EAAhC,WAAW,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,kBAAkB,KAAA,EAChC,EAAA,GAAA,EAAA,CAAA,WAAgC,EAAhC,WAAW,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,kBAAkB,GAAA,EAAA,EAChC,QAAQ,GAAA,EAAA,CAAA,QAAA,CAAA;IAKR,IAAM,KAAK,GAAGA,gBAAK,C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AA,GAAG,IAAI;YACnC,OAAO,OAAO,KAAK,UAAU,GAAG,OAAO,EAAE,GAAG,OAAO,CACvC,IACjB,IAAI,CACT,EACN;AACL,CAAC,EACJ;AAED,OAAO,CAAC,WAAW,GAAG,SAAS;;;;;"}
1
+ {"version":3,"file":"tooltip.js","sources":["../../src/tooltip/tooltip.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {\n Tooltip as AriakitTooltip,\n TooltipAnchor,\n TooltipArrow,\n useTooltipStore,\n} from '@ariakit/react'\n\nimport { Box } from '../box'\n\nimport styles from './tooltip.module.css'\n\nimport type { TooltipStore, TooltipStoreState } from '@ariakit/react'\nimport type { ObfuscatedClassName } from '../utils/common-types'\n\nconst defaultShowTimeout = 500\nconst defaultHideTimeout = 100\n\ntype TooltipContextState = {\n showTimeout: number\n hideTimeout: number\n}\n\nconst TooltipContext = React.createContext<TooltipContextState>({\n showTimeout: defaultShowTimeout,\n hideTimeout: defaultHideTimeout,\n})\n\nfunction TooltipProvider({\n showTimeout = defaultShowTimeout,\n hideTimeout = defaultHideTimeout,\n children,\n}: React.PropsWithChildren<{\n showTimeout?: number\n hideTimeout?: number\n}>) {\n const value = React.useMemo(() => ({ showTimeout, hideTimeout }), [showTimeout, hideTimeout])\n return <TooltipContext.Provider value={value}>{children}</TooltipContext.Provider>\n}\n\ninterface TooltipProps extends ObfuscatedClassName {\n /**\n * The element that triggers the tooltip. Generally a button or link.\n *\n * It should be an interactive element accessible both via mouse and keyboard interactions.\n */\n children: React.ReactNode\n\n /**\n * The content to show in the tooltip.\n *\n * It can be rich content provided via React elements, or string content. It should not include\n * interactive elements inside it. This includes links or buttons.\n *\n * You can provide a function instead of the content itself. In this case, the function should\n * return the desired content. This is useful if the content is expensive to generate. It can\n * also be useful if the content dynamically changes often, so every time you trigger the\n * tooltip the content may have changed (e.g. if you show a ticking time clock in the tooltip).\n *\n * The trigger element will be associated to this content via `aria-describedby`. This means\n * that the tooltip content will be read by assistive technologies such as screen readers. It\n * will likely read this content right after reading the trigger element label.\n */\n content: React.ReactNode | (() => React.ReactNode)\n\n /**\n * How to place the tooltip relative to its trigger element.\n *\n * The possible values are \"top\", \"bottom\", \"left\", \"right\". Additionally, any of these values\n * can be combined with `-start` or `-end` for even more control. For instance `top-start` will\n * place the tooltip at the top, but with the start (e.g. left) side of the toolip and the\n * trigger aligned. If neither `-start` or `-end` are provided, the tooltip is centered along\n * the vertical or horizontal axis with the trigger.\n *\n * The position is enforced whenever possible, but tooltips can appear in different positions\n * if the specified one would make the tooltip intersect with the viewport edges.\n *\n * @default 'top'\n */\n position?: TooltipStoreState['placement']\n\n /**\n * The separation (in pixels) between the trigger element and the tooltip.\n * @default 3\n */\n gapSize?: number\n\n /**\n * Whether to show an arrow-like element attached to the tooltip, and pointing towards the\n * trigger element.\n * @default false\n */\n withArrow?: boolean\n\n /**\n * The amount of time in milliseconds to wait before showing the tooltip\n * Use `<TooltipContext.Provider>` to set a global value for all tooltips\n * @default 500\n */\n showTimeout?: number\n\n /**\n * The amount of time in milliseconds to wait before hiding the tooltip\n * Use `<TooltipContext.Provider>` to set a global value for all tooltips\n * @default 100\n */\n hideTimeout?: number\n}\n\nconst Tooltip = React.forwardRef<TooltipStore, TooltipProps>(\n (\n {\n children,\n content,\n position = 'top',\n gapSize = 3,\n withArrow = false,\n showTimeout,\n hideTimeout,\n exceptionallySetClassName,\n },\n ref,\n ) => {\n const { showTimeout: globalShowTimeout, hideTimeout: globalHideTimeout } =\n React.useContext(TooltipContext)\n\n const tooltip = useTooltipStore({\n placement: position,\n showTimeout: showTimeout ?? globalShowTimeout,\n hideTimeout: hideTimeout ?? globalHideTimeout,\n })\n\n React.useImperativeHandle(ref, () => tooltip, [tooltip])\n\n const isOpen = tooltip.useState('open')\n\n const child = React.Children.only(\n children as React.FunctionComponentElement<JSX.IntrinsicElements['div']> | null,\n )\n\n if (!child) {\n return child\n }\n\n if (typeof child.ref === 'string') {\n throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded')\n }\n\n return (\n <>\n <TooltipAnchor render={child} store={tooltip} ref={child.ref} />\n {isOpen && content ? (\n <AriakitTooltip\n store={tooltip}\n gutter={gapSize}\n render={\n <Box\n className={[styles.tooltip, exceptionallySetClassName]}\n background=\"toast\"\n borderRadius=\"standard\"\n paddingX=\"small\"\n paddingY=\"xsmall\"\n maxWidth=\"medium\"\n width=\"fitContent\"\n overflow=\"hidden\"\n textAlign=\"center\"\n />\n }\n >\n {withArrow ? <TooltipArrow /> : null}\n {typeof content === 'function' ? content() : content}\n </AriakitTooltip>\n ) : null}\n </>\n )\n },\n)\n\nTooltip.displayName = 'Tooltip'\n\nexport type { TooltipProps }\nexport { Tooltip, TooltipProvider }\n"],"names":["defaultShowTimeout","defaultHideTimeout","TooltipContext","React","createContext","showTimeout","hideTimeout","TooltipProvider","t0","$","_c","t1","t2","children","undefined","t3","value","t4","createElement","Provider","Tooltip","forwardRef","content","position","gapSize","withArrow","exceptionallySetClassName","ref","globalShowTimeout","globalHideTimeout","useContext","tooltip","useTooltipStore","placement","useImperativeHandle","isOpen","useState","child","Children","only","Error","Fragment","TooltipAnchor","render","store","AriakitTooltip","gutter","Box","className","styles","background","borderRadius","paddingX","paddingY","maxWidth","width","overflow","textAlign","TooltipArrow","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,kBAAkB,GAAG,GAAG,CAAA;AAC9B,MAAMC,kBAAkB,GAAG,GAAG,CAAA;AAO9B,MAAMC,cAAc,gBAAGC,gBAAK,CAACC,aAAa,CAAsB;AAC5DC,EAAAA,WAAW,EAAEL,kBAAkB;AAC/BM,EAAAA,WAAW,EAAEL,kBAAAA;AACjB,CAAC,CAAC,CAAA;AAEF,SAAAM,gBAAAC,EAAA,EAAA;EAAA,MAAAC,CAAA,GAAAC,sBAAA,CAAA,CAAA,CAAA,CAAA;AAAyB,EAAA,MAAA;AAAAL,IAAAA,WAAA,EAAAM,EAAA;AAAAL,IAAAA,WAAA,EAAAM,EAAA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ACO,IAAAA,KAAK,EAAEb,OAAQ;IAACJ,GAAG,EAAEU,KAAK,CAACV,GAAAA;GAAM,CAAC,EAC/DQ,MAAM,IAAIb,OAAO,gBACdnB,gBAAA,CAAAe,aAAA,CAAC2B,aAAc,EAAA;AACXD,IAAAA,KAAK,EAAEb,OAAQ;AACfe,IAAAA,MAAM,EAAEtB,OAAQ;AAChBmB,IAAAA,MAAM,eACFxC,gBAAA,CAAAe,aAAA,CAAC6B,OAAG,EAAA;AACAC,MAAAA,SAAS,EAAE,CAACC,yBAAM,CAAClB,OAAO,EAAEL,yBAAyB,CAAE;AACvDwB,MAAAA,UAAU,EAAC,OAAO;AAClBC,MAAAA,YAAY,EAAC,UAAU;AACvBC,MAAAA,QAAQ,EAAC,OAAO;AAChBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,KAAK,EAAC,YAAY;AAClBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,SAAS,EAAC,QAAA;KACb,CAAA;GAGJhC,EAAAA,SAAS,gBAAGtB,gBAAA,CAAAe,aAAA,CAACwC,kBAAY,EAAA,IAAE,CAAC,GAAG,IAAI,EACnC,OAAOpC,OAAO,KAAK,UAAU,GAAGA,OAAO,EAAE,GAAGA,OACjC,CAAC,GACjB,IACN,CAAC,CAAA;AAEX,CACJ,EAAC;AAEDF,OAAO,CAACuC,WAAW,GAAG,SAAS;;;;;"}
@@ -24,25 +24,26 @@ function _interopNamespace(e) {
24
24
 
25
25
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
26
 
27
- var uid = 0;
27
+ let uid = 0;
28
28
  function uniqueId() {
29
- return uid++;
29
+ return uid++;
30
30
  }
31
31
  function generateElementId(prefix) {
32
- var num = uniqueId();
33
- return "".concat(prefix, "-").concat(num);
32
+ const num = uniqueId();
33
+ return `${prefix}-${num}`;
34
34
  }
35
+
35
36
  /**
36
37
  * @deprecated Use `useId` available from React 18 or above instead.
37
38
  */
38
39
  function useId(providedId) {
39
- var ref = React__namespace.useRef(providedId !== null && providedId !== void 0 ? providedId : null);
40
- // eslint-disable-next-line react-hooks/refs
41
- if (!ref.current) {
42
- ref.current = generateElementId('element');
43
- }
44
- // eslint-disable-next-line react-hooks/refs
45
- return ref.current;
40
+ const ref = React__namespace.useRef(providedId ?? null);
41
+ // eslint-disable-next-line react-hooks/refs
42
+ if (!ref.current) {
43
+ ref.current = generateElementId('element');
44
+ }
45
+ // eslint-disable-next-line react-hooks/refs
46
+ return ref.current;
46
47
  }
47
48
 
48
49
  exports.generateElementId = generateElementId;
@@ -1 +1 @@
1
- {"version":3,"file":"common-helpers.js","sources":["../../src/utils/common-helpers.ts"],"sourcesContent":[null],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAI,GAAG,GAAG,CAAC,CAAA;AACX,SAAS,QAAQ,GAAA;IACb,OAAO,GAAG,EAAE,CAAA;AAChB,CAAC;AAEK,SAAU,iBAAiB,CAAC,MAAc,EAAA;AAC5C,IAAA,IAAM,GAAG,GAAG,QAAQ,EAAE,CAAA;AACtB,IAAA,OAAO,EAAG,CAAA,MAAA,CAAA,MAAM,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,GAAG,CAAE,CAAA;AAC7B,CAAC;AAED;;AAEG;AACG,SAAU,KAAK,CAAC,UAAmB,EAAA;AACrC,IAAA,IAAM,GAAG,GAAGA,gBAAK,CAAC,MAAM,CAAgB,UAAU,KAAV,IAAA,IAAA,UAAU,KAAV,KAAA,CAAA,GAAA,UAAU,GAAI,IAAI,CAAC,CAAA;;AAE3D,IAAA,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;AACd,QAAA,GAAG,CAAC,OAAO,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAA;KAC7C;;IAED,OAAO,GAAG,CAAC,OAAO,CAAA;AACtB;;;;;"}
1
+ {"version":3,"file":"common-helpers.js","sources":["../../src/utils/common-helpers.ts"],"sourcesContent":["import * as React from 'react'\n\nlet uid = 0\nfunction uniqueId() {\n return uid++\n}\n\nexport function generateElementId(prefix: string): string {\n const num = uniqueId()\n return `${prefix}-${num}`\n}\n\n/**\n * @deprecated Use `useId` available from React 18 or above instead.\n */\nexport function useId(providedId?: string): string {\n const ref = React.useRef<string | null>(providedId ?? null)\n // eslint-disable-next-line react-hooks/refs\n if (!ref.current) {\n ref.current = generateElementId('element')\n }\n // eslint-disable-next-line react-hooks/refs\n return ref.current\n}\n"],"names":["uid","uniqueId","generateElementId","prefix","num","useId","providedId","ref","React","useRef","current"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAIA,GAAG,GAAG,CAAC,CAAA;AACX,SAASC,QAAQA,GAAG;AAChB,EAAA,OAAOD,GAAG,EAAE,CAAA;AAChB,CAAA;AAEO,SAASE,iBAAiBA,CAACC,MAAc,EAAU;AACtD,EAAA,MAAMC,GAAG,GAAGH,QAAQ,EAAE,CAAA;AACtB,EAAA,OAAO,CAAGE,EAAAA,MAAM,CAAIC,CAAAA,EAAAA,GAAG,CAAE,CAAA,CAAA;AAC7B,CAAA;;AAEA;AACA;AACA;AACO,SAASC,KAAKA,CAACC,UAAmB,EAAU;EAC/C,MAAMC,GAAG,GAAGC,gBAAK,CAACC,MAAM,CAAgBH,UAAU,IAAI,IAAI,CAAC,CAAA;AAC3D;AACA,EAAA,IAAI,CAACC,GAAG,CAACG,OAAO,EAAE;AACdH,IAAAA,GAAG,CAACG,OAAO,GAAGR,iBAAiB,CAAC,SAAS,CAAC,CAAA;AAC9C,GAAA;AACA;EACA,OAAOK,GAAG,CAACG,OAAO,CAAA;AACtB;;;;;"}
@@ -25,6 +25,89 @@ function _interopNamespace(e) {
25
25
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
26
 
27
27
  /* eslint-disable @typescript-eslint/no-explicit-any */
28
+
29
+ /**
30
+ * If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`
31
+ * prop instead.
32
+ *
33
+ * This can be customized via the second generic parameter, as there are cases where it may be
34
+ * needed to omit this behaviour and keep the `className`. You can also instruct it to remove the
35
+ * `className` prop while not replacing it with the `exceptionallySetClassName` one.
36
+ *
37
+ * @see ObfuscatedClassName['exceptionallySetClassName'] for details about this prop
38
+ * @see PolymorphicComponent for details about this feature
39
+ */
40
+
41
+ /**
42
+ * Given a component or element type, and a set of additional props, this builds the entire set of
43
+ * props for a polymorphic component.
44
+ *
45
+ * It does three things:
46
+ *
47
+ * 1. it merges the element type props with the `OwnProps`
48
+ * 2. it adds the `as` prop to allow for polymorphism to happen
49
+ * 3. it optionally obfuscates or omits the className prop if present
50
+ *
51
+ * @see PolymorphicProp
52
+ * @see WithObfuscatedClassName
53
+ */
54
+
55
+ /**
56
+ * The function passed to React.forwardRef, but typed in a way that's prepared for polymorphism via
57
+ * the `as` prop. It also allows to specify if the `className` prop should be obfuscated or omitted.
58
+ *
59
+ * @see PolymorphicComponentProps
60
+ * @see WithObfuscatedClassName
61
+ */
62
+
63
+ /**
64
+ * A component that can customize the React element type that it renders (a.k.a. a polymorphic
65
+ * component). This is achieved by passing a prop `as={ElementType}` or `as="html-tag-name"`.
66
+ *
67
+ * It transparently takes care of forwarding refs, and properly sets the ref type depending on the
68
+ * element type.
69
+ *
70
+ * ## Recognizing props based on the polymorphic type
71
+ *
72
+ * The `ComponentType` argument sets the default type for the `as` prop. Whatever the `as` prop
73
+ * component or HTML element is, the type system will automatically allow you to pass props that are
74
+ * not explicitly defined by you, but that are recognized as valid props to be passed to the
75
+ * component you are rendering.
76
+ *
77
+ * For instance, see the following example:
78
+ *
79
+ * ```jsx
80
+ * <Box as="label" htmlFor="field-id">Hello</Box>
81
+ * ```
82
+ *
83
+ * The `htmlFor` prop is exclusive to label elements. If you omit the `as="label"` prop, the type
84
+ * system will consider the `htmlFor` prop to be an error. The same happens if you pass a value of
85
+ * an incorrect type to such prop. For instance, the example below will issue a type error:
86
+ *
87
+ * ```jsx
88
+ * <Box as="label" htmlFor={123}>Hello</Box>
89
+ * ```
90
+ *
91
+ * ## Omitting or obfuscating the `className` prop
92
+ *
93
+ * If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`
94
+ * prop instead.
95
+ *
96
+ * This is to discourage customizing design system components via custom styling, while still
97
+ * leaving the door open to do it as an escape hatch when the design system still has shortcomings
98
+ * with respect to the product designs we want to achieve.
99
+ *
100
+ * The cumbersome name also serves the purpose of aiding in easily searching for the places in the
101
+ * code where this escape hatch was needed, in order to identify areas where the design system
102
+ * components need to improve to better match our needs.
103
+ *
104
+ * This behaviour can be customized via an optional second generic argument that allows to disable
105
+ * this feature, or to omit the `className` altogether without replacing it with the obfuscated prop
106
+ * name.
107
+ *
108
+ * @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)
109
+ */
110
+
28
111
  /**
29
112
  * A wrapper to use React.forwardRef with polymorphic components in a type-safe manner. This is a
30
113
  * convenience over merely using React.forwardRef directly, and then manually forcing the resulting
@@ -33,7 +116,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
33
116
  * @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)
34
117
  */
35
118
  function polymorphicComponent(render) {
36
- return React__namespace.forwardRef(render);
119
+ return /*#__PURE__*/React__namespace.forwardRef(render);
37
120
  }
38
121
 
39
122
  exports.polymorphicComponent = polymorphicComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"polymorphism.js","sources":["../../src/utils/polymorphism.ts"],"sourcesContent":[null],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAoLA;;;;;;AAMG;AACH,SAAS,oBAAoB,CAI3B,MAA6E,EAAA;AAC3E,IAAA,OAAOA,gBAAK,CAAC,UAAU,CAAC,MAAM,CAI7B,CAAA;AACL;;;;"}
1
+ {"version":3,"file":"polymorphism.js","sources":["../../src/utils/polymorphism.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport * as React from 'react'\n\nimport type { ObfuscatedClassName } from './common-types'\n\ntype Merge<P1, P2> = Omit<P1, keyof P2> & P2\n\ntype EmptyObject = {\n [K in any]: never\n}\n\ntype ObfuscateClassNameMode = 'keepClassName' | 'obfuscateClassName' | 'omitClassName'\n\n/**\n * If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`\n * prop instead.\n *\n * This can be customized via the second generic parameter, as there are cases where it may be\n * needed to omit this behaviour and keep the `className`. You can also instruct it to remove the\n * `className` prop while not replacing it with the `exceptionallySetClassName` one.\n *\n * @see ObfuscatedClassName['exceptionallySetClassName'] for details about this prop\n * @see PolymorphicComponent for details about this feature\n */\ntype WithObfuscatedClassName<\n Props,\n ShouldObfuscateClassName extends ObfuscateClassNameMode,\n> = 'className' extends keyof Props\n ? ShouldObfuscateClassName extends 'obfuscateClassName'\n ? Omit<Props, 'className'> & ObfuscatedClassName\n : ShouldObfuscateClassName extends 'omitClassName'\n ? Omit<Props, 'className'>\n : ShouldObfuscateClassName extends 'keepClassName'\n ? Props\n : never\n : Props\n\ntype PolymorphicProp<ComponentType extends React.ElementType> = {\n /**\n * Used to instruct this component what React element to render as. It can be both a string\n * representing a HTML tag name, or a React component.\n *\n * When using this prop, the component you apply it to will also recognize in its props types\n * all the props from the component or HTML element you are rendering it as.\n *\n * Some uses for this feature:\n *\n * - Using some of our layout components, while at the same time being able to set them to use\n * semantic HTML elements needed for accessibility purposes (e.g. `nav`, `main`, etc).\n * - Using a design system link component, but have it internally use a client-side router link\n * implemented via a React component (e.g. react-router's `Link`).\n *\n * Keep in mind that not all compositions of this kind may work well, especially when composing\n * with another React component and not with a HTML tag name. In particular, if the components\n * being composed have opposing concerns of clashing features (e.g. they have contradicting\n * styles applied to them) things may not go well. In those cases prefer to nest them instead.\n *\n * @see PolymorphicComponent\n */\n as?: ComponentType\n}\n\n/**\n * Given a component or element type, and a set of additional props, this builds the entire set of\n * props for a polymorphic component.\n *\n * It does three things:\n *\n * 1. it merges the element type props with the `OwnProps`\n * 2. it adds the `as` prop to allow for polymorphism to happen\n * 3. it optionally obfuscates or omits the className prop if present\n *\n * @see PolymorphicProp\n * @see WithObfuscatedClassName\n */\ntype PolymorphicComponentProps<\n ComponentType extends React.ElementType,\n OwnProps,\n ShouldObfuscateClassName extends ObfuscateClassNameMode,\n> = Merge<\n WithObfuscatedClassName<React.ComponentProps<ComponentType>, ShouldObfuscateClassName>,\n OwnProps & PolymorphicProp<ComponentType>\n>\n\ntype ElementTagNameMap = HTMLElementTagNameMap &\n Pick<SVGElementTagNameMap, Exclude<keyof SVGElementTagNameMap, keyof HTMLElementTagNameMap>>\n\ntype ElementByTag<TagName extends keyof ElementTagNameMap> = ElementTagNameMap[TagName]\n\ntype ElementByTagOrAny<ComponentType extends React.ElementType> =\n ComponentType extends keyof ElementTagNameMap ? ElementByTag<ComponentType> : any\n\n/**\n * The function passed to React.forwardRef, but typed in a way that's prepared for polymorphism via\n * the `as` prop. It also allows to specify if the `className` prop should be obfuscated or omitted.\n *\n * @see PolymorphicComponentProps\n * @see WithObfuscatedClassName\n */\ninterface ForwardRefFunction<\n ComponentType extends React.ElementType,\n OwnProps,\n ShouldObfuscateClassName extends ObfuscateClassNameMode,\n> {\n (\n props: PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>,\n ref:\n | ((instance: ElementByTagOrAny<ComponentType> | null) => void)\n | React.MutableRefObject<ElementByTagOrAny<ComponentType> | null>\n | null,\n ): React.ReactElement | null\n displayName?: string\n}\n\n/**\n * A component that can customize the React element type that it renders (a.k.a. a polymorphic\n * component). This is achieved by passing a prop `as={ElementType}` or `as=\"html-tag-name\"`.\n *\n * It transparently takes care of forwarding refs, and properly sets the ref type depending on the\n * element type.\n *\n * ## Recognizing props based on the polymorphic type\n *\n * The `ComponentType` argument sets the default type for the `as` prop. Whatever the `as` prop\n * component or HTML element is, the type system will automatically allow you to pass props that are\n * not explicitly defined by you, but that are recognized as valid props to be passed to the\n * component you are rendering.\n *\n * For instance, see the following example:\n *\n * ```jsx\n * <Box as=\"label\" htmlFor=\"field-id\">Hello</Box>\n * ```\n *\n * The `htmlFor` prop is exclusive to label elements. If you omit the `as=\"label\"` prop, the type\n * system will consider the `htmlFor` prop to be an error. The same happens if you pass a value of\n * an incorrect type to such prop. For instance, the example below will issue a type error:\n *\n * ```jsx\n * <Box as=\"label\" htmlFor={123}>Hello</Box>\n * ```\n *\n * ## Omitting or obfuscating the `className` prop\n *\n * If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`\n * prop instead.\n *\n * This is to discourage customizing design system components via custom styling, while still\n * leaving the door open to do it as an escape hatch when the design system still has shortcomings\n * with respect to the product designs we want to achieve.\n *\n * The cumbersome name also serves the purpose of aiding in easily searching for the places in the\n * code where this escape hatch was needed, in order to identify areas where the design system\n * components need to improve to better match our needs.\n *\n * This behaviour can be customized via an optional second generic argument that allows to disable\n * this feature, or to omit the `className` altogether without replacing it with the obfuscated prop\n * name.\n *\n * @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)\n */\ninterface PolymorphicComponent<\n ComponentType extends React.ElementType,\n OwnProps,\n ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName',\n> {\n <TT extends React.ElementType = ComponentType>(\n props: PolymorphicComponentProps<TT, OwnProps, ShouldObfuscateClassName>,\n ): React.ReactElement | null\n readonly $$typeof: symbol\n defaultProps?: Partial<\n PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>\n >\n propTypes?: React.WeakValidationMap<\n PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>\n >\n displayName?: string\n}\n\n/**\n * A wrapper to use React.forwardRef with polymorphic components in a type-safe manner. This is a\n * convenience over merely using React.forwardRef directly, and then manually forcing the resulting\n * value to be typed using `as PolymorphicComponent<…>`.\n *\n * @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)\n */\nfunction polymorphicComponent<\n ComponentType extends React.ElementType = 'div',\n OwnProps = EmptyObject,\n ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName',\n>(render: ForwardRefFunction<ComponentType, OwnProps, ShouldObfuscateClassName>) {\n return React.forwardRef(render) as PolymorphicComponent<\n ComponentType,\n OwnProps,\n ShouldObfuscateClassName\n >\n}\n\nexport type { PolymorphicComponent }\nexport { polymorphicComponent }\n"],"names":["polymorphicComponent","render","React","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,oBAAoBA,CAI3BC,MAA6E,EAAE;AAC7E,EAAA,oBAAOC,gBAAK,CAACC,UAAU,CAACF,MAAM,CAAC,CAAA;AAKnC;;;;"}
@@ -2,7 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var DEBUG = process.env.NODE_ENV === 'development';
5
+ /**
6
+ * A responsive prop supports receiving values of its given base type, or an object mapping a
7
+ * responsive breakpoint name to a value from the prop's base type.
8
+ *
9
+ * Some examples:
10
+ *
11
+ * - `align={{ mobile: 'left', tablet: 'center', desktop: 'right' }}`
12
+ */
13
+
14
+ const DEBUG = process.env.NODE_ENV === 'development';
15
+
6
16
  /**
7
17
  * Builds a css module class name for a given prop + prop-value combination.
8
18
  *
@@ -21,27 +31,28 @@ var DEBUG = process.env.NODE_ENV === 'development';
21
31
  * @param value the given prop's value
22
32
  */
23
33
  function getClassNames(styles, property, value) {
24
- if (!value) {
25
- return null;
26
- }
27
- var classList = [];
28
- if (typeof value === 'string') {
29
- classList.push(styles["".concat(property, "-").concat(value)]);
30
- }
31
- else {
32
- if (value.mobile)
33
- classList.push(styles["".concat(property, "-").concat(value.mobile)]);
34
- if (value.tablet)
35
- classList.push(styles["tablet-".concat(property, "-").concat(value.tablet)]);
36
- if (value.desktop)
37
- classList.push(styles["desktop-".concat(property, "-").concat(value.desktop)]);
38
- }
39
- if (DEBUG && !classList.every(Boolean)) {
40
- // eslint-disable-next-line no-console
41
- console.warn('Not all generated class names were found', { property: property, value: value, classList: classList });
42
- }
43
- return classList;
34
+ if (!value) {
35
+ return null;
36
+ }
37
+ const classList = [];
38
+ if (typeof value === 'string') {
39
+ classList.push(styles[`${property}-${value}`]);
40
+ } else {
41
+ if (value.mobile) classList.push(styles[`${property}-${value.mobile}`]);
42
+ if (value.tablet) classList.push(styles[`tablet-${property}-${value.tablet}`]);
43
+ if (value.desktop) classList.push(styles[`desktop-${property}-${value.desktop}`]);
44
+ }
45
+ if (DEBUG && !classList.every(Boolean)) {
46
+ // eslint-disable-next-line no-console
47
+ console.warn('Not all generated class names were found', {
48
+ property,
49
+ value,
50
+ classList
51
+ });
52
+ }
53
+ return classList;
44
54
  }
55
+
45
56
  /**
46
57
  * A mapping over a responsive prop value.
47
58
  *
@@ -53,17 +64,17 @@ function getClassNames(styles, property, value) {
53
64
  * @param mapper the mapping function
54
65
  */
55
66
  function mapResponsiveProp(fromValue, mapper) {
56
- if (!fromValue) {
57
- return undefined;
58
- }
59
- if (typeof fromValue !== 'object') {
60
- return mapper(fromValue);
61
- }
62
- return {
63
- mobile: fromValue.mobile ? mapper(fromValue.mobile) : undefined,
64
- tablet: fromValue.tablet ? mapper(fromValue.tablet) : undefined,
65
- desktop: fromValue.desktop ? mapper(fromValue.desktop) : undefined,
66
- };
67
+ if (!fromValue) {
68
+ return undefined;
69
+ }
70
+ if (typeof fromValue !== 'object') {
71
+ return mapper(fromValue);
72
+ }
73
+ return {
74
+ mobile: fromValue.mobile ? mapper(fromValue.mobile) : undefined,
75
+ tablet: fromValue.tablet ? mapper(fromValue.tablet) : undefined,
76
+ desktop: fromValue.desktop ? mapper(fromValue.desktop) : undefined
77
+ };
67
78
  }
68
79
 
69
80
  exports.getClassNames = getClassNames;
@@ -1 +1 @@
1
- {"version":3,"file":"responsive-props.js","sources":["../../src/utils/responsive-props.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAgBA,IAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAA;AAEpD;;;;;;;;;;;;;;;;AAgBG;AACH,SAAS,aAAa,CAClB,MAA8B,EAC9B,QAAgB,EAChB,KAAgD,EAAA;IAEhD,IAAI,CAAC,KAAK,EAAE;AACR,QAAA,OAAO,IAAI,CAAA;KACd;IAED,IAAM,SAAS,GAA8B,EAAE,CAAA;AAE/C,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC3B,QAAA,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAA,CAAA,MAAA,CAAG,QAAQ,EAAA,GAAA,CAAA,CAAA,MAAA,CAAI,KAAK,CAAE,CAAC,CAAC,CAAA;KACjD;SAAM;QACH,IAAI,KAAK,CAAC,MAAM;AAAE,YAAA,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAG,CAAA,MAAA,CAAA,QAAQ,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,KAAK,CAAC,MAAM,CAAE,CAAC,CAAC,CAAA;QACvE,IAAI,KAAK,CAAC,MAAM;AAAE,YAAA,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,SAAU,CAAA,MAAA,CAAA,QAAQ,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,KAAK,CAAC,MAAM,CAAE,CAAC,CAAC,CAAA;QAC9E,IAAI,KAAK,CAAC,OAAO;AAAE,YAAA,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,UAAW,CAAA,MAAA,CAAA,QAAQ,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,KAAK,CAAC,OAAO,CAAE,CAAC,CAAC,CAAA;KACpF;IAED,IAAI,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;;AAEpC,QAAA,OAAO,CAAC,IAAI,CAAC,0CAA0C,EAAE,EAAE,QAAQ,EAAA,QAAA,EAAE,KAAK,OAAA,EAAE,SAAS,EAAA,SAAA,EAAE,CAAC,CAAA;KAC3F;AAED,IAAA,OAAO,SAAS,CAAA;AACpB,CAAC;AAED;;;;;;;;;AASG;AACH,SAAS,iBAAiB,CACtB,SAA2C,EAC3C,MAA0B,EAAA;IAE1B,IAAI,CAAC,SAAS,EAAE;AACZ,QAAA,OAAO,SAAS,CAAA;KACnB;AAED,IAAA,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;AAC/B,QAAA,OAAO,MAAM,CAAC,SAAS,CAAC,CAAA;KAC3B;IAED,OAAO;AACH,QAAA,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS;AAC/D,QAAA,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS;AAC/D,QAAA,OAAO,EAAE,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS;KACrE,CAAA;AACL;;;;;"}
1
+ {"version":3,"file":"responsive-props.js","sources":["../../src/utils/responsive-props.ts"],"sourcesContent":["type ResponsiveBreakpoints = 'mobile' | 'tablet' | 'desktop'\n\ntype Atom = string | number | boolean\n\n/**\n * A responsive prop supports receiving values of its given base type, or an object mapping a\n * responsive breakpoint name to a value from the prop's base type.\n *\n * Some examples:\n *\n * - `align={{ mobile: 'left', tablet: 'center', desktop: 'right' }}`\n */\ntype ResponsiveProp<AtomType extends Atom> =\n | AtomType\n | Readonly<{ [key in ResponsiveBreakpoints]?: AtomType }>\n\nconst DEBUG = process.env.NODE_ENV === 'development'\n\n/**\n * Builds a css module class name for a given prop + prop-value combination.\n *\n * We have a convention of building the internal utility-based class names system in a way that\n * resembles the prop for which it is used and the value of the prop. For instance, in a component\n * with a prop `width` with possible values `narrow` and `wide`, we encode the styles for each of\n * these alternatives in the class-names `.width-narrow` and `.width-wide`.\n *\n * Furthermore, this helper is aware of responsive prop values. For instance, if you provide the\n * `width` prop above with the value `['narrow', 'wide']` this returns `['narrow', 'tablet-wide']`.\n * That is, it returns an array of class names, following the same convention above, but also\n * prefixing by the viewport width variant (`tablet-` or `desktop-`).\n *\n * @param styles the class names mapping imported from a css module\n * @param property the prop name\n * @param value the given prop's value\n */\nfunction getClassNames(\n styles: Record<string, string>,\n property: string,\n value: ResponsiveProp<string> | null | undefined,\n): Array<string | undefined> | null {\n if (!value) {\n return null\n }\n\n const classList: Array<string | undefined> = []\n\n if (typeof value === 'string') {\n classList.push(styles[`${property}-${value}`])\n } else {\n if (value.mobile) classList.push(styles[`${property}-${value.mobile}`])\n if (value.tablet) classList.push(styles[`tablet-${property}-${value.tablet}`])\n if (value.desktop) classList.push(styles[`desktop-${property}-${value.desktop}`])\n }\n\n if (DEBUG && !classList.every(Boolean)) {\n // eslint-disable-next-line no-console\n console.warn('Not all generated class names were found', { property, value, classList })\n }\n\n return classList\n}\n\n/**\n * A mapping over a responsive prop value.\n *\n * Since response values can be an object but also a scalar value, this helper makes it easier to\n * to map the values when it's an object but keeps it consistent for the case when it is a scalar\n * value as well.\n *\n * @param fromValue the responsive prop value\n * @param mapper the mapping function\n */\nfunction mapResponsiveProp<From extends Atom, To extends Atom>(\n fromValue: ResponsiveProp<From> | undefined,\n mapper: (from: From) => To,\n): ResponsiveProp<To> | undefined {\n if (!fromValue) {\n return undefined\n }\n\n if (typeof fromValue !== 'object') {\n return mapper(fromValue)\n }\n\n return {\n mobile: fromValue.mobile ? mapper(fromValue.mobile) : undefined,\n tablet: fromValue.tablet ? mapper(fromValue.tablet) : undefined,\n desktop: fromValue.desktop ? mapper(fromValue.desktop) : undefined,\n }\n}\n\nexport type { ResponsiveBreakpoints, ResponsiveProp }\nexport { getClassNames, mapResponsiveProp }\n"],"names":["DEBUG","process","env","NODE_ENV","getClassNames","styles","property","value","classList","push","mobile","tablet","desktop","every","Boolean","console","warn","mapResponsiveProp","fromValue","mapper","undefined"],"mappings":";;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,MAAMA,KAAK,GAAGC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,CAAA;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,aAAaA,CAClBC,MAA8B,EAC9BC,QAAgB,EAChBC,KAAgD,EAChB;EAChC,IAAI,CAACA,KAAK,EAAE;AACR,IAAA,OAAO,IAAI,CAAA;AACf,GAAA;EAEA,MAAMC,SAAoC,GAAG,EAAE,CAAA;AAE/C,EAAA,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;IAC3BC,SAAS,CAACC,IAAI,CAACJ,MAAM,CAAC,CAAGC,EAAAA,QAAQ,CAAIC,CAAAA,EAAAA,KAAK,CAAE,CAAA,CAAC,CAAC,CAAA;AAClD,GAAC,MAAM;AACH,IAAA,IAAIA,KAAK,CAACG,MAAM,EAAEF,SAAS,CAACC,IAAI,CAACJ,MAAM,CAAC,CAAA,EAAGC,QAAQ,CAAIC,CAAAA,EAAAA,KAAK,CAACG,MAAM,CAAA,CAAE,CAAC,CAAC,CAAA;AACvE,IAAA,IAAIH,KAAK,CAACI,MAAM,EAAEH,SAAS,CAACC,IAAI,CAACJ,MAAM,CAAC,CAAA,OAAA,EAAUC,QAAQ,CAAIC,CAAAA,EAAAA,KAAK,CAACI,MAAM,CAAA,CAAE,CAAC,CAAC,CAAA;AAC9E,IAAA,IAAIJ,KAAK,CAACK,OAAO,EAAEJ,SAAS,CAACC,IAAI,CAACJ,MAAM,CAAC,CAAA,QAAA,EAAWC,QAAQ,CAAIC,CAAAA,EAAAA,KAAK,CAACK,OAAO,CAAA,CAAE,CAAC,CAAC,CAAA;AACrF,GAAA;EAEA,IAAIZ,KAAK,IAAI,CAACQ,SAAS,CAACK,KAAK,CAACC,OAAO,CAAC,EAAE;AACpC;AACAC,IAAAA,OAAO,CAACC,IAAI,CAAC,0CAA0C,EAAE;MAAEV,QAAQ;MAAEC,KAAK;AAAEC,MAAAA,SAAAA;AAAU,KAAC,CAAC,CAAA;AAC5F,GAAA;AAEA,EAAA,OAAOA,SAAS,CAAA;AACpB,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,iBAAiBA,CACtBC,SAA2C,EAC3CC,MAA0B,EACI;EAC9B,IAAI,CAACD,SAAS,EAAE;AACZ,IAAA,OAAOE,SAAS,CAAA;AACpB,GAAA;AAEA,EAAA,IAAI,OAAOF,SAAS,KAAK,QAAQ,EAAE;IAC/B,OAAOC,MAAM,CAACD,SAAS,CAAC,CAAA;AAC5B,GAAA;EAEA,OAAO;AACHR,IAAAA,MAAM,EAAEQ,SAAS,CAACR,MAAM,GAAGS,MAAM,CAACD,SAAS,CAACR,MAAM,CAAC,GAAGU,SAAS;AAC/DT,IAAAA,MAAM,EAAEO,SAAS,CAACP,MAAM,GAAGQ,MAAM,CAACD,SAAS,CAACP,MAAM,CAAC,GAAGS,SAAS;IAC/DR,OAAO,EAAEM,SAAS,CAACN,OAAO,GAAGO,MAAM,CAACD,SAAS,CAACN,OAAO,CAAC,GAAGQ,SAAAA;GAC5D,CAAA;AACL;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@doist/reactist",
3
3
  "description": "Open source React components by Doist",
4
- "version": "29.1.1",
4
+ "version": "29.1.2",
5
5
  "repository": "https://github.com/Doist/reactist",
6
6
  "homepage": "https://github.com/Doist/reactist#readme",
7
7
  "bugs": {
@@ -65,17 +65,20 @@
65
65
  "classnames": "^2.2.5",
66
66
  "prop-types": "^15.6.2",
67
67
  "react": "^17.0.0 || ^18.0.0",
68
+ "react-compiler-runtime": "^1.0.0",
68
69
  "react-dom": "^17.0.0 || ^18.0.0"
69
70
  },
70
71
  "devDependencies": {
71
72
  "@ariakit/react": "0.4.19",
72
- "@babel/core": "^7.9.6",
73
+ "@babel/cli": "7.28.3",
74
+ "@babel/core": "7.28.5",
73
75
  "@babel/plugin-proposal-class-properties": "^7.10.1",
74
76
  "@babel/plugin-proposal-export-default-from": "^7.0.0",
75
77
  "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
76
78
  "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
77
79
  "@babel/plugin-proposal-object-rest-spread": "^7.10.1",
78
80
  "@babel/plugin-proposal-optional-chaining": "7.21.0",
81
+ "@babel/plugin-transform-runtime": "7.28.5",
79
82
  "@babel/plugin-transform-spread": "^7.0.0",
80
83
  "@babel/polyfill": "^7.0.0",
81
84
  "@babel/preset-env": "^7.0.0",
@@ -86,6 +89,7 @@
86
89
  "@doist/prettier-config": "4.0.0",
87
90
  "@doist/tsconfig": "2.0.0",
88
91
  "@geometricpanda/storybook-addon-badges": "^0.2.2",
92
+ "@rollup/plugin-babel": "6.1.0",
89
93
  "@rollup/plugin-commonjs": "28.0.9",
90
94
  "@rollup/plugin-node-resolve": "16.0.3",
91
95
  "@rollup/plugin-terser": "0.4.4",
@@ -118,6 +122,7 @@
118
122
  "autoprefixer": "^9.8.0",
119
123
  "babel-core": "^7.0.0-bridge.0",
120
124
  "babel-loader": "^8.1.0",
125
+ "babel-plugin-react-compiler": "1.0.0",
121
126
  "chromatic": "^6.11.4",
122
127
  "classnames": "^2.2.5",
123
128
  "css-loader": "^4.2.2",
@@ -147,6 +152,7 @@
147
152
  "prettier": "3.6.2",
148
153
  "raw-loader": "^4.0.1",
149
154
  "react": "^17.0.2",
155
+ "react-compiler-runtime": "1.0.0",
150
156
  "react-docgen-typescript-loader": "^3.7.2",
151
157
  "react-dom": "^17.0.2",
152
158
  "react-is": "^17.0.2",
@@ -155,6 +161,7 @@
155
161
  "rimraf": "^3.0.2",
156
162
  "rollup": "2.79.2",
157
163
  "rollup-plugin-styles": "4.0.0",
164
+ "rollup-plugin-visualizer": "6.0.5",
158
165
  "style-loader": "^0.23.1",
159
166
  "svg-url-loader": "^6.0.0",
160
167
  "ts-loader": "^8.0.2",
@@ -163,6 +170,7 @@
163
170
  "webpack": "^4.43.0"
164
171
  },
165
172
  "dependencies": {
173
+ "@babel/runtime": "^7.28.4",
166
174
  "aria-hidden": "^1.2.1",
167
175
  "dayjs": "^1.8.10",
168
176
  "patch-package": "^6.4.6",