react-miui 0.35.0 → 0.36.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 (290) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/components/layout/header/HeaderIconAction.d.ts.map +1 -1
  3. package/dist/components/layout/header/HeaderIconAction.js +13 -3
  4. package/dist/components/layout/header/HeaderIconAction.js.map +1 -1
  5. package/dist/components/layout/header/HeaderIconAction.styled.d.ts.map +1 -1
  6. package/dist/components/layout/header/HeaderIconAction.styled.js +11 -17
  7. package/dist/components/layout/header/HeaderIconAction.styled.js.map +1 -1
  8. package/dist/components/layout/list/Item.d.ts.map +1 -1
  9. package/dist/components/layout/list/Item.js +17 -7
  10. package/dist/components/layout/list/Item.js.map +1 -1
  11. package/dist/components/layout/list/Item.styled.d.ts.map +1 -1
  12. package/dist/components/layout/list/Item.styled.js +2 -1
  13. package/dist/components/layout/list/Item.styled.js.map +1 -1
  14. package/dist/components/ui/button/Button.d.ts +94 -1
  15. package/dist/components/ui/button/Button.d.ts.map +1 -1
  16. package/dist/components/ui/button/Button.js +59 -2
  17. package/dist/components/ui/button/Button.js.map +1 -1
  18. package/dist/components/ui/button/Button.styled.d.ts +2 -2
  19. package/dist/components/ui/button/Button.styled.d.ts.map +1 -1
  20. package/dist/components/ui/button/Button.styled.js +4 -3
  21. package/dist/components/ui/button/Button.styled.js.map +1 -1
  22. package/dist/components/ui/directionPad/Button.d.ts.map +1 -1
  23. package/dist/components/ui/directionPad/Button.js +7 -2
  24. package/dist/components/ui/directionPad/Button.js.map +1 -1
  25. package/dist/components/ui/directionPad/Button.styled.d.ts.map +1 -1
  26. package/dist/components/ui/directionPad/Button.styled.js +2 -1
  27. package/dist/components/ui/directionPad/Button.styled.js.map +1 -1
  28. package/dist/components/ui/directionPad/Middle.d.ts.map +1 -1
  29. package/dist/components/ui/directionPad/Middle.js +7 -1
  30. package/dist/components/ui/directionPad/Middle.js.map +1 -1
  31. package/dist/components/ui/directionPad/Middle.styled.d.ts.map +1 -1
  32. package/dist/components/ui/directionPad/Middle.styled.js +2 -1
  33. package/dist/components/ui/directionPad/Middle.styled.js.map +1 -1
  34. package/dist/components/ui/modal/ModalButtons.d.ts +179 -1
  35. package/dist/components/ui/modal/ModalButtons.d.ts.map +1 -1
  36. package/dist/components/ui/modal/ModalButtons.js +63 -2
  37. package/dist/components/ui/modal/ModalButtons.js.map +1 -1
  38. package/dist/components/ui/modal/ModalButtons.styled.d.ts +90 -91
  39. package/dist/components/ui/modal/ModalButtons.styled.d.ts.map +1 -1
  40. package/dist/components/ui/modal/ModalButtons.styled.js +5 -7
  41. package/dist/components/ui/modal/ModalButtons.styled.js.map +1 -1
  42. package/dist/components/ui/pop/Pop.styled.d.ts.map +1 -1
  43. package/dist/components/ui/pop/Pop.styled.js +15 -17
  44. package/dist/components/ui/pop/Pop.styled.js.map +1 -1
  45. package/dist/components/ui/pop/PopOption.d.ts.map +1 -1
  46. package/dist/components/ui/pop/PopOption.js +7 -2
  47. package/dist/components/ui/pop/PopOption.js.map +1 -1
  48. package/dist/components/ui/toolButton/ToolButton.d.ts +94 -1
  49. package/dist/components/ui/toolButton/ToolButton.d.ts.map +1 -1
  50. package/dist/components/ui/toolButton/ToolButton.js +59 -2
  51. package/dist/components/ui/toolButton/ToolButton.js.map +1 -1
  52. package/dist/components/ui/toolButton/ToolButton.styled.d.ts +2 -2
  53. package/dist/components/ui/toolButton/ToolButton.styled.d.ts.map +1 -1
  54. package/dist/components/ui/toolButton/ToolButton.styled.js +20 -25
  55. package/dist/components/ui/toolButton/ToolButton.styled.js.map +1 -1
  56. package/dist/utils/useRipple.d.ts +15 -0
  57. package/dist/utils/useRipple.d.ts.map +1 -0
  58. package/dist/utils/useRipple.js +120 -0
  59. package/dist/utils/useRipple.js.map +1 -0
  60. package/dist/utils/useRipple.styled.d.ts +28 -0
  61. package/dist/utils/useRipple.styled.d.ts.map +1 -0
  62. package/dist/utils/useRipple.styled.js +36 -0
  63. package/dist/utils/useRipple.styled.js.map +1 -0
  64. package/docs/classes/index.Pop.html +7 -7
  65. package/docs/documents/Test.html +2 -2
  66. package/docs/enums/index.ICON.html +2 -2
  67. package/docs/functions/index.Action.html +3 -3
  68. package/docs/functions/index.Button.html +3 -9
  69. package/docs/functions/index.Card.html +2 -2
  70. package/docs/functions/index.Checkbox.html +3 -3
  71. package/docs/functions/index.Choice.html +2 -2
  72. package/docs/functions/index.ColorPicker.html +3 -3
  73. package/docs/functions/index.CoveringLoader.html +3 -3
  74. package/docs/functions/index.DirectionPad.html +2 -2
  75. package/docs/functions/index.Drawer.html +2 -2
  76. package/docs/functions/index.EqualActions.html +2 -2
  77. package/docs/functions/index.FullLoader.html +3 -3
  78. package/docs/functions/index.Gap.html +2 -2
  79. package/docs/functions/index.HandleEsc.html +3 -3
  80. package/docs/functions/index.Header.html +3 -3
  81. package/docs/functions/index.HeaderIconAction.html +3 -3
  82. package/docs/functions/index.Icon-1.html +2 -2
  83. package/docs/functions/index.If.html +3 -3
  84. package/docs/functions/index.Input.html +1 -1
  85. package/docs/functions/index.KeyValue.html +2 -2
  86. package/docs/functions/index.Label.html +2 -2
  87. package/docs/functions/index.Line.html +3 -3
  88. package/docs/functions/index.List.html +2 -2
  89. package/docs/functions/index.Loader.html +3 -3
  90. package/docs/functions/index.Loading.html +3 -3
  91. package/docs/functions/index.Message.html +3 -3
  92. package/docs/functions/index.Modal.html +2 -2
  93. package/docs/functions/index.ModalButtons.html +3 -3
  94. package/docs/functions/index.PopLoader.html +3 -3
  95. package/docs/functions/index.PopOption.html +2 -2
  96. package/docs/functions/index.Progress.html +2 -2
  97. package/docs/functions/index.SearchContainer.html +2 -2
  98. package/docs/functions/index.Section.html +4 -4
  99. package/docs/functions/index.Select.html +2 -2
  100. package/docs/functions/index.Selector.html +2 -2
  101. package/docs/functions/index.Spacer.html +2 -2
  102. package/docs/functions/index.Stats.html +2 -2
  103. package/docs/functions/index.StickyHeader.html +4 -4
  104. package/docs/functions/index.Table.html +2 -2
  105. package/docs/functions/index.TextArea.html +2 -2
  106. package/docs/functions/index.TimePicker.html +2 -2
  107. package/docs/functions/index.ToasterProvider.html +3 -3
  108. package/docs/functions/index.Toggle.html +3 -3
  109. package/docs/functions/index.ToolButton.html +3 -9
  110. package/docs/functions/index.Tooltip.html +3 -3
  111. package/docs/functions/index.TooltipProvider.html +2 -2
  112. package/docs/functions/index.borderPxToRem.html +1 -1
  113. package/docs/functions/index.createTheme.html +1 -1
  114. package/docs/functions/index.css.html +1 -1
  115. package/docs/functions/index.dimensionsPxToRem.html +1 -1
  116. package/docs/functions/index.fontPxToRem.html +1 -1
  117. package/docs/functions/index.getCssText.html +1 -1
  118. package/docs/functions/index.globalCss.html +2 -2
  119. package/docs/functions/index.injectGlobalStyles.html +1 -1
  120. package/docs/functions/index.keyframes.html +1 -1
  121. package/docs/functions/index.pxToRem.html +1 -1
  122. package/docs/functions/index.styled.html +1 -1
  123. package/docs/functions/index.toast.html +2 -2
  124. package/docs/functions/index.useToaster.html +1 -1
  125. package/docs/index.html +2 -2
  126. package/docs/interfaces/index.IconProps.html +2 -2
  127. package/docs/interfaces/index.InputCustomProps.html +3 -3
  128. package/docs/interfaces/index.LoaderProps.html +6 -6
  129. package/docs/interfaces/index.StickyHeaderProps.html +4 -4
  130. package/docs/interfaces/index.ToasterProviderProps.html +3 -3
  131. package/docs/interfaces/index.TooltipProps.html +14 -14
  132. package/docs/interfaces/index.TooltipProviderProps.html +5 -5
  133. package/docs/modules/index.html +1 -1
  134. package/docs/modules.html +1 -1
  135. package/docs/types/index.ActionProps.html +1 -1
  136. package/docs/types/index.CardProps.html +1 -1
  137. package/docs/types/index.CheckboxProps.html +2 -2
  138. package/docs/types/index.ChoiceProps.html +1 -1
  139. package/docs/types/index.ColorPickerProps.html +1 -1
  140. package/docs/types/index.DirectionPadProps.html +1 -1
  141. package/docs/types/index.DrawerFrom.html +1 -1
  142. package/docs/types/index.DrawerProps.html +2 -2
  143. package/docs/types/index.EqualActionsProps.html +1 -1
  144. package/docs/types/index.HeaderProps.html +1 -1
  145. package/docs/types/index.InputProps.html +1 -1
  146. package/docs/types/index.KeyValueProps.html +1 -1
  147. package/docs/types/index.LabelProps.html +1 -1
  148. package/docs/types/index.OverwriteProps.html +1 -1
  149. package/docs/types/index.ProgressProps.html +2 -2
  150. package/docs/types/index.SelectProps.html +1 -1
  151. package/docs/types/index.SelectorProps.html +1 -1
  152. package/docs/types/index.Stat.html +1 -1
  153. package/docs/types/index.StatsProps.html +1 -1
  154. package/docs/types/index.TextAreaProps.html +1 -1
  155. package/docs/types/index.ThemeCSS.html +1 -1
  156. package/docs/types/index.TimePickerProps.html +1 -1
  157. package/docs/types/index.ToggleProps.html +2 -2
  158. package/docs/variables/index.ActionBadgeSelector.html +1 -1
  159. package/docs/variables/index.ActionCircleSelector.html +1 -1
  160. package/docs/variables/index.CheckboxCheckmarkWrapperSelector.html +1 -1
  161. package/docs/variables/index.CheckboxTextLabelSelector.html +1 -1
  162. package/docs/variables/index.ChoiceItemSelector.html +1 -1
  163. package/docs/variables/index.ColorPickerColorDisplaySelector.html +1 -1
  164. package/docs/variables/index.DirectionPadButtonDotSelector.html +1 -1
  165. package/docs/variables/index.DirectionPadButtonSelector.html +1 -1
  166. package/docs/variables/index.DirectionPadLineSelector.html +1 -1
  167. package/docs/variables/index.DirectionPadMiddleSelector.html +1 -1
  168. package/docs/variables/index.DrawerContentSelector.html +1 -1
  169. package/docs/variables/index.HeaderAfterSelector.html +1 -1
  170. package/docs/variables/index.HeaderBeforeSelector.html +1 -1
  171. package/docs/variables/index.HeaderContentsSelector.html +1 -1
  172. package/docs/variables/index.HeaderIconActionIconSelector.html +1 -1
  173. package/docs/variables/index.InputContainerSelector.html +1 -1
  174. package/docs/variables/index.InputInputSelector.html +1 -1
  175. package/docs/variables/index.InputLabelSelector.html +1 -1
  176. package/docs/variables/index.InputPrefixSelector.html +1 -1
  177. package/docs/variables/index.InputSuffixSelector.html +1 -1
  178. package/docs/variables/index.KeyValueIconSelector.html +1 -1
  179. package/docs/variables/index.KeyValueItemSelector.html +1 -1
  180. package/docs/variables/index.KeyValueKeySelector.html +1 -1
  181. package/docs/variables/index.KeyValuePairSelector.html +1 -1
  182. package/docs/variables/index.KeyValueValueSelector.html +1 -1
  183. package/docs/variables/index.LabelTextSelector.html +1 -1
  184. package/docs/variables/index.ListItemInnerContainerClassNameSelector.html +1 -1
  185. package/docs/variables/index.ModalContainerSelector.html +1 -1
  186. package/docs/variables/index.ModalRemovePaddingSelector.html +1 -1
  187. package/docs/variables/index.ModalTitleSelector.html +1 -1
  188. package/docs/variables/index.PopListSelector.html +1 -1
  189. package/docs/variables/index.PopOptionButtonSelector.html +1 -1
  190. package/docs/variables/index.PopOptionIconSelector.html +1 -1
  191. package/docs/variables/index.PopOverlaySelector.html +1 -1
  192. package/docs/variables/index.ProgressBackgroundSelector.html +1 -1
  193. package/docs/variables/index.ProgressValueSelector.html +1 -1
  194. package/docs/variables/index.SelectorItemSelector.html +1 -1
  195. package/docs/variables/index.StatsItemSelector.html +1 -1
  196. package/docs/variables/index.StatsLabelSelector.html +1 -1
  197. package/docs/variables/index.StatsSeparatorSelector.html +1 -1
  198. package/docs/variables/index.StatsValueSelector.html +1 -1
  199. package/docs/variables/index.TextAreaLabelSelector.html +1 -1
  200. package/docs/variables/index.TextAreaTextAreaSelector.html +1 -1
  201. package/docs/variables/index.TextAreaWrapperSelector.html +1 -1
  202. package/docs/variables/index.ToggleStyledToggleSelector.html +1 -1
  203. package/docs/variables/index.TooltipContentSelector.html +1 -1
  204. package/docs/variables/index.config.html +1 -1
  205. package/docs/variables/index.cssReset.html +2 -2
  206. package/docs/variables/index.darkTheme.html +1 -1
  207. package/docs/variables/index.miuiScrollbars.html +1 -1
  208. package/docs/variables/index.theme.html +1 -1
  209. package/esm/components/layout/header/HeaderIconAction.d.ts.map +1 -1
  210. package/esm/components/layout/header/HeaderIconAction.js +13 -3
  211. package/esm/components/layout/header/HeaderIconAction.js.map +1 -1
  212. package/esm/components/layout/header/HeaderIconAction.styled.d.ts.map +1 -1
  213. package/esm/components/layout/header/HeaderIconAction.styled.js +11 -17
  214. package/esm/components/layout/header/HeaderIconAction.styled.js.map +1 -1
  215. package/esm/components/layout/list/Item.d.ts.map +1 -1
  216. package/esm/components/layout/list/Item.js +18 -8
  217. package/esm/components/layout/list/Item.js.map +1 -1
  218. package/esm/components/layout/list/Item.styled.d.ts.map +1 -1
  219. package/esm/components/layout/list/Item.styled.js +2 -1
  220. package/esm/components/layout/list/Item.styled.js.map +1 -1
  221. package/esm/components/ui/button/Button.d.ts +94 -1
  222. package/esm/components/ui/button/Button.d.ts.map +1 -1
  223. package/esm/components/ui/button/Button.js +15 -1
  224. package/esm/components/ui/button/Button.js.map +1 -1
  225. package/esm/components/ui/button/Button.styled.d.ts +2 -2
  226. package/esm/components/ui/button/Button.styled.d.ts.map +1 -1
  227. package/esm/components/ui/button/Button.styled.js +3 -2
  228. package/esm/components/ui/button/Button.styled.js.map +1 -1
  229. package/esm/components/ui/directionPad/Button.d.ts.map +1 -1
  230. package/esm/components/ui/directionPad/Button.js +7 -2
  231. package/esm/components/ui/directionPad/Button.js.map +1 -1
  232. package/esm/components/ui/directionPad/Button.styled.d.ts.map +1 -1
  233. package/esm/components/ui/directionPad/Button.styled.js +2 -1
  234. package/esm/components/ui/directionPad/Button.styled.js.map +1 -1
  235. package/esm/components/ui/directionPad/Middle.d.ts.map +1 -1
  236. package/esm/components/ui/directionPad/Middle.js +7 -1
  237. package/esm/components/ui/directionPad/Middle.js.map +1 -1
  238. package/esm/components/ui/directionPad/Middle.styled.d.ts.map +1 -1
  239. package/esm/components/ui/directionPad/Middle.styled.js +2 -1
  240. package/esm/components/ui/directionPad/Middle.styled.js.map +1 -1
  241. package/esm/components/ui/modal/ModalButtons.d.ts +179 -1
  242. package/esm/components/ui/modal/ModalButtons.d.ts.map +1 -1
  243. package/esm/components/ui/modal/ModalButtons.js +19 -1
  244. package/esm/components/ui/modal/ModalButtons.js.map +1 -1
  245. package/esm/components/ui/modal/ModalButtons.styled.d.ts +90 -91
  246. package/esm/components/ui/modal/ModalButtons.styled.d.ts.map +1 -1
  247. package/esm/components/ui/modal/ModalButtons.styled.js +3 -6
  248. package/esm/components/ui/modal/ModalButtons.styled.js.map +1 -1
  249. package/esm/components/ui/pop/Pop.styled.d.ts.map +1 -1
  250. package/esm/components/ui/pop/Pop.styled.js +15 -17
  251. package/esm/components/ui/pop/Pop.styled.js.map +1 -1
  252. package/esm/components/ui/pop/PopOption.d.ts.map +1 -1
  253. package/esm/components/ui/pop/PopOption.js +7 -2
  254. package/esm/components/ui/pop/PopOption.js.map +1 -1
  255. package/esm/components/ui/toolButton/ToolButton.d.ts +94 -1
  256. package/esm/components/ui/toolButton/ToolButton.d.ts.map +1 -1
  257. package/esm/components/ui/toolButton/ToolButton.js +15 -1
  258. package/esm/components/ui/toolButton/ToolButton.js.map +1 -1
  259. package/esm/components/ui/toolButton/ToolButton.styled.d.ts +2 -2
  260. package/esm/components/ui/toolButton/ToolButton.styled.d.ts.map +1 -1
  261. package/esm/components/ui/toolButton/ToolButton.styled.js +19 -24
  262. package/esm/components/ui/toolButton/ToolButton.styled.js.map +1 -1
  263. package/esm/utils/useRipple.d.ts +15 -0
  264. package/esm/utils/useRipple.d.ts.map +1 -0
  265. package/esm/utils/useRipple.js +84 -0
  266. package/esm/utils/useRipple.js.map +1 -0
  267. package/esm/utils/useRipple.styled.d.ts +28 -0
  268. package/esm/utils/useRipple.styled.d.ts.map +1 -0
  269. package/esm/utils/useRipple.styled.js +33 -0
  270. package/esm/utils/useRipple.styled.js.map +1 -0
  271. package/package.json +1 -1
  272. package/src/components/layout/header/HeaderIconAction.styled.ts +11 -18
  273. package/src/components/layout/header/HeaderIconAction.tsx +32 -5
  274. package/src/components/layout/list/Item.styled.ts +2 -1
  275. package/src/components/layout/list/Item.tsx +38 -5
  276. package/src/components/ui/button/Button.styled.ts +3 -2
  277. package/src/components/ui/button/Button.tsx +33 -1
  278. package/src/components/ui/directionPad/Button.styled.ts +2 -1
  279. package/src/components/ui/directionPad/Button.tsx +13 -1
  280. package/src/components/ui/directionPad/Middle.styled.ts +2 -1
  281. package/src/components/ui/directionPad/Middle.tsx +13 -1
  282. package/src/components/ui/modal/ModalButtons.styled.ts +4 -7
  283. package/src/components/ui/modal/ModalButtons.tsx +38 -1
  284. package/src/components/ui/pop/Pop.styled.ts +15 -18
  285. package/src/components/ui/pop/PopOption.tsx +15 -1
  286. package/src/components/ui/toolButton/ToolButton.styled.ts +20 -26
  287. package/src/components/ui/toolButton/ToolButton.tsx +33 -0
  288. package/src/utils/useRipple.styled.ts +56 -0
  289. package/src/utils/useRipple.tsx +139 -0
  290. package/src/components/ui/toolButton/ToolButton.ts +0 -1
@@ -1,2 +1,95 @@
1
- export { ToolButton } from "./ToolButton.styled";
1
+ import React from "react";
2
+ declare const ToolButton: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
3
+ ref?: ((instance: HTMLButtonElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLButtonElement> | null | undefined;
4
+ }, "css" | "inline" | "variant"> & import("../../../../node_modules/@stitches/react/types/styled-component").TransformProps<{
5
+ inline?: boolean | "true";
6
+ variant?: "secondary" | "secondaryOnLight";
7
+ }, {}> & {
8
+ css?: import("../../../../node_modules/@stitches/react/types/css-util").CSS<{}, {
9
+ colors: {
10
+ background: "white";
11
+ mainColor: "#008ad2";
12
+ mainColorAlt: "#006AA9";
13
+ activeBg: "#e7e7e7";
14
+ inactiveBg: "#d3d3de";
15
+ inactiveDarkBg: "#999";
16
+ toggleHandleBg: "#e0e0e0";
17
+ toggleHandleBorder: "#cdcdcd";
18
+ toggleBgDisabled: "#f0f0f0";
19
+ toggleHandleBorderDisabled: "#c29f7d";
20
+ toggleHandleBgDisabled: "#deae84";
21
+ icon: "#636363";
22
+ border: "#d5d5d5";
23
+ buttonBorder: "#bababa";
24
+ headerBorder: "#c8c8c9";
25
+ headerBg: "#efeff0";
26
+ headerText: "#484848";
27
+ text: "#323232";
28
+ text2: "#181818";
29
+ text3: "#000000";
30
+ sub: "#959595";
31
+ popText: "#666";
32
+ toolbarBorder: "#ababab";
33
+ toolbarBg: "#f8f8f8";
34
+ modalBg: "#f7f7f7";
35
+ modalButtonBg: "#f8f8f8";
36
+ modalButtonBorder: "#c2c2c2";
37
+ inputDisabledBg: "#f3f3f3";
38
+ inputDisabledText: "#959595";
39
+ choiceBg: "#ffffff";
40
+ choiceText: "#999999";
41
+ choiceActiveBg: "#f3f3f3";
42
+ choiceActiveText: "#313131";
43
+ choiceBorder: "#cfcfcf";
44
+ selectorText: "#606060";
45
+ selectorActive: "#008ad2";
46
+ blue1: "#038bf4";
47
+ blue2: "#b7d6f5";
48
+ blue3: "#dbe6ff";
49
+ blue4: "#33b4ff";
50
+ blue5: "#30a2e6";
51
+ orange1: "#ff7200";
52
+ orange1Darker: "#cc5b00";
53
+ purple1: "#7357e8";
54
+ green1: "#3ec234";
55
+ green1Darker: "#38af2f";
56
+ pink1: "#ff388f";
57
+ red1: "#ea2700";
58
+ yellow1: "#ffde9d";
59
+ yellow2: "#e4a429";
60
+ yellow3: "#fff5db";
61
+ pinky1: "#f5c0b7";
62
+ pinky2: "#e07b67";
63
+ pinky3: "#ffe1db";
64
+ grey1: "#737373";
65
+ focusColor: "#dcaf00";
66
+ scrollbarsThumb: "#737373";
67
+ scrollbarsBg: "transparent";
68
+ tableStripedBg: "#fafafa";
69
+ toolButtonText: "#666e80";
70
+ };
71
+ }, import("../../../../node_modules/@stitches/react/types/config").DefaultThemeMap, {
72
+ mx: (value: string | number) => {
73
+ marginLeft: string | number;
74
+ marginRight: string | number;
75
+ };
76
+ my: (value: string | number) => {
77
+ marginTop: string | number;
78
+ marginBottom: string | number;
79
+ };
80
+ px: (value: string | number) => {
81
+ paddingLeft: string | number;
82
+ paddingRight: string | number;
83
+ };
84
+ py: (value: string | number) => {
85
+ paddingTop: string | number;
86
+ paddingBottom: string | number;
87
+ };
88
+ size: (value: string | number) => {
89
+ width: string | number;
90
+ height: string | number;
91
+ };
92
+ }>;
93
+ }, "ref"> & React.RefAttributes<HTMLButtonElement>>;
94
+ export { ToolButton, };
2
95
  //# sourceMappingURL=ToolButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolButton.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/toolButton/ToolButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"ToolButton.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/toolButton/ToolButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAS1C,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mDAgBd,CAAC;AAKH,OAAO,EACH,UAAU,GACb,CAAC"}
@@ -1,6 +1,63 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __rest = (this && this.__rest) || function (s, e) {
36
+ var t = {};
37
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
+ t[p] = s[p];
39
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
40
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
42
+ t[p[i]] = s[p[i]];
43
+ }
44
+ return t;
45
+ };
2
46
  Object.defineProperty(exports, "__esModule", { value: true });
3
47
  exports.ToolButton = void 0;
4
- var ToolButton_styled_1 = require("./ToolButton.styled");
5
- Object.defineProperty(exports, "ToolButton", { enumerable: true, get: function () { return ToolButton_styled_1.ToolButton; } });
48
+ const react_1 = __importStar(require("react"));
49
+ const use_forwarded_ref_1 = require("@bedrock-layout/use-forwarded-ref");
50
+ const useRipple_1 = require("../../../utils/useRipple");
51
+ const ToolButton_styled_1 = require("./ToolButton.styled");
52
+ const ToolButton = (0, react_1.forwardRef)((props, ref) => {
53
+ const { children, onPointerDown, onKeyDown } = props, rest = __rest(props, ["children", "onPointerDown", "onKeyDown"]);
54
+ const innerRef = (0, use_forwarded_ref_1.useForwardedRef)(ref);
55
+ const ripple = (0, useRipple_1.useRipple)({ ref: innerRef, onPointerDown, onKeyDown });
56
+ return (react_1.default.createElement(ToolButton_styled_1.StyledToolButton, Object.assign({ ref: innerRef, onPointerDown: ripple.onPointerDown, onKeyDown: ripple.onKeyDown }, rest),
57
+ children,
58
+ ripple.ripples));
59
+ });
60
+ exports.ToolButton = ToolButton;
61
+ ToolButton.displayName = "ToolButton";
62
+ ToolButton.toString = () => ToolButton_styled_1.StyledToolButton.toString();
6
63
  //# sourceMappingURL=ToolButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolButton.js","sourceRoot":"","sources":["../../../../src/components/ui/toolButton/ToolButton.ts"],"names":[],"mappings":";;;AAAA,yDAAiD;AAAxC,+GAAA,UAAU,OAAA"}
1
+ {"version":3,"file":"ToolButton.js","sourceRoot":"","sources":["../../../../src/components/ui/toolButton/ToolButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,yEAAoE;AAEpE,wDAAqD;AACrD,2DAAuD;AAIvD,MAAM,UAAU,GAAG,IAAA,kBAAU,EAA2B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACnE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAAvD,0CAA+C,CAAQ,CAAC;IAC9D,MAAM,QAAQ,GAAG,IAAA,mCAAe,EAAC,GAAG,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC;IAEtE,OAAO,CACH,8BAAC,oCAAgB,kBACb,GAAG,EAAE,QAAQ,EACb,aAAa,EAAE,MAAM,CAAC,aAAa,EACnC,SAAS,EAAE,MAAM,CAAC,SAAS,IACvB,IAAI;QAEP,QAAQ;QACR,MAAM,CAAC,OAAO,CACA,CACtB,CAAC;AACN,CAAC,CAAC,CAAC;AAMC,gCAAU;AAJd,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AACtC,UAAU,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,oCAAgB,CAAC,QAAQ,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- declare const ToolButton: import("../../../../node_modules/@stitches/react/types/styled-component").StyledComponent<"button", {
1
+ declare const StyledToolButton: import("../../../../node_modules/@stitches/react/types/styled-component").StyledComponent<"button", {
2
2
  inline?: boolean | "true";
3
3
  variant?: "secondary" | "secondaryOnLight";
4
4
  }, {}, import("../../../../node_modules/@stitches/react/types/css-util").CSS<{}, {
@@ -86,5 +86,5 @@ declare const ToolButton: import("../../../../node_modules/@stitches/react/types
86
86
  height: string | number;
87
87
  };
88
88
  }>>;
89
- export { ToolButton, };
89
+ export { StyledToolButton, };
90
90
  //# sourceMappingURL=ToolButton.styled.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolButton.styled.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/toolButton/ToolButton.styled.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8Cd,CAAC;AAEH,OAAO,EACH,UAAU,GACb,CAAC"}
1
+ {"version":3,"file":"ToolButton.styled.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/toolButton/ToolButton.styled.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCpB,CAAC;AAEH,OAAO,EACH,gBAAgB,GACnB,CAAC"}
@@ -1,24 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ToolButton = void 0;
3
+ exports.StyledToolButton = void 0;
4
4
  const theme_1 = require("../../../theme");
5
- const ToolButton = (0, theme_1.styled)("button", {
6
- "height": (0, theme_1.dimensionsPxToRem)(79),
7
- "borderRadius": (0, theme_1.dimensionsPxToRem)(10),
8
- "fontWeight": "bold",
9
- "fontSize": (0, theme_1.fontPxToRem)(23),
10
- "display": "flex",
11
- "alignItems": "center",
12
- "justifyContent": "center",
13
- "paddingInline": (0, theme_1.dimensionsPxToRem)(16),
14
- "background": "white",
15
- "boxSizing": "border-box",
16
- "border": `${(0, theme_1.dimensionsPxToRem)(6)} solid transparent`,
17
- "color": "$toolButtonText",
18
- "&:hover": {
19
- background: "#ffffffcc",
20
- },
21
- "variants": {
5
+ const useRipple_styled_1 = require("../../../utils/useRipple.styled");
6
+ const StyledToolButton = (0, theme_1.styled)("button", useRipple_styled_1.rippleHostStyles, {
7
+ height: (0, theme_1.dimensionsPxToRem)(79),
8
+ borderRadius: (0, theme_1.dimensionsPxToRem)(10),
9
+ fontWeight: "bold",
10
+ fontSize: (0, theme_1.fontPxToRem)(23),
11
+ display: "flex",
12
+ alignItems: "center",
13
+ justifyContent: "center",
14
+ paddingInline: (0, theme_1.dimensionsPxToRem)(16),
15
+ background: "white",
16
+ boxSizing: "border-box",
17
+ border: `${(0, theme_1.dimensionsPxToRem)(6)} solid transparent`,
18
+ color: "$toolButtonText",
19
+ variants: {
22
20
  inline: {
23
21
  true: {
24
22
  width: "auto",
@@ -27,12 +25,9 @@ const ToolButton = (0, theme_1.styled)("button", {
27
25
  },
28
26
  variant: {
29
27
  secondary: {
30
- "border": `${(0, theme_1.dimensionsPxToRem)(6)} solid #ffffff42`,
31
- "background": "none",
32
- "&:hover": {
33
- background: "#ffffff22",
34
- },
35
- "color": "white",
28
+ border: `${(0, theme_1.dimensionsPxToRem)(6)} solid #ffffff42`,
29
+ background: "none",
30
+ color: "white",
36
31
  },
37
32
  secondaryOnLight: {
38
33
  "border": `${(0, theme_1.dimensionsPxToRem)(6)} solid $border`,
@@ -45,5 +40,5 @@ const ToolButton = (0, theme_1.styled)("button", {
45
40
  },
46
41
  },
47
42
  });
48
- exports.ToolButton = ToolButton;
43
+ exports.StyledToolButton = StyledToolButton;
49
44
  //# sourceMappingURL=ToolButton.styled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolButton.styled.js","sourceRoot":"","sources":["../../../../src/components/ui/toolButton/ToolButton.styled.ts"],"names":[],"mappings":";;;AAAA,0CAAwE;AAKxE,MAAM,UAAU,GAAG,IAAA,cAAM,EAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,IAAA,yBAAiB,EAAC,EAAE,CAAC;IAC/B,cAAc,EAAE,IAAA,yBAAiB,EAAC,EAAE,CAAC;IACrC,YAAY,EAAE,MAAM;IACpB,UAAU,EAAE,IAAA,mBAAW,EAAC,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM;IACjB,YAAY,EAAE,QAAQ;IACtB,gBAAgB,EAAE,QAAQ;IAC1B,eAAe,EAAE,IAAA,yBAAiB,EAAC,EAAE,CAAC;IACtC,YAAY,EAAE,OAAO;IACrB,WAAW,EAAE,YAAY;IACzB,QAAQ,EAAE,GAAG,IAAA,yBAAiB,EAAC,CAAC,CAAC,oBAAoB;IAErD,OAAO,EAAE,iBAAiB;IAC1B,SAAS,EAAE;QACP,UAAU,EAAE,WAAW;KAC1B;IAED,UAAU,EAAE;QACR,MAAM,EAAE;YACJ,IAAI,EAAE;gBACF,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,aAAa;aACzB;SACJ;QACD,OAAO,EAAE;YACL,SAAS,EAAE;gBACP,QAAQ,EAAE,GAAG,IAAA,yBAAiB,EAAC,CAAC,CAAC,kBAAkB;gBACnD,YAAY,EAAE,MAAM;gBAEpB,SAAS,EAAE;oBACP,UAAU,EAAE,WAAW;iBAC1B;gBACD,OAAO,EAAE,OAAO;aACnB;YACD,gBAAgB,EAAE;gBACd,QAAQ,EAAE,GAAG,IAAA,yBAAiB,EAAC,CAAC,CAAC,gBAAgB;gBACjD,YAAY,EAAE,MAAM;gBACpB,OAAO,EAAE,OAAO;gBAEhB,SAAS,EAAE;oBACP,WAAW,EAAE,eAAe;iBAC/B;aACJ;SACJ;KACJ;CACJ,CAAC,CAAC;AAGC,gCAAU"}
1
+ {"version":3,"file":"ToolButton.styled.js","sourceRoot":"","sources":["../../../../src/components/ui/toolButton/ToolButton.styled.ts"],"names":[],"mappings":";;;AAAA,0CAAwE;AACxE,sEAAmE;AAKnE,MAAM,gBAAgB,GAAG,IAAA,cAAM,EAAC,QAAQ,EAAE,mCAAgB,EAAE;IACxD,MAAM,EAAE,IAAA,yBAAiB,EAAC,EAAE,CAAC;IAC7B,YAAY,EAAE,IAAA,yBAAiB,EAAC,EAAE,CAAC;IACnC,UAAU,EAAE,MAAM;IAClB,QAAQ,EAAE,IAAA,mBAAW,EAAC,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,QAAQ;IACxB,aAAa,EAAE,IAAA,yBAAiB,EAAC,EAAE,CAAC;IACpC,UAAU,EAAE,OAAO;IACnB,SAAS,EAAE,YAAY;IACvB,MAAM,EAAE,GAAG,IAAA,yBAAiB,EAAC,CAAC,CAAC,oBAAoB;IACnD,KAAK,EAAE,iBAAiB;IAExB,QAAQ,EAAE;QACN,MAAM,EAAE;YACJ,IAAI,EAAE;gBACF,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,aAAa;aACzB;SACJ;QACD,OAAO,EAAE;YACL,SAAS,EAAE;gBACP,MAAM,EAAE,GAAG,IAAA,yBAAiB,EAAC,CAAC,CAAC,kBAAkB;gBACjD,UAAU,EAAE,MAAM;gBAClB,KAAK,EAAE,OAAO;aACjB;YACD,gBAAgB,EAAE;gBACd,QAAQ,EAAE,GAAG,IAAA,yBAAiB,EAAC,CAAC,CAAC,gBAAgB;gBACjD,YAAY,EAAE,MAAM;gBACpB,OAAO,EAAE,OAAO;gBAGhB,SAAS,EAAE;oBACP,WAAW,EAAE,eAAe;iBAC/B;aACJ;SACJ;KACJ;CACJ,CAAC,CAAC;AAGC,4CAAgB"}
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ type UseRippleArgs<T extends HTMLElement> = {
3
+ ref: React.RefObject<T | null>;
4
+ onPointerDown?: React.PointerEventHandler<T> | undefined;
5
+ onKeyDown?: React.KeyboardEventHandler<T> | undefined;
6
+ fromCenter?: boolean | undefined;
7
+ };
8
+ type UseRippleResult<T extends HTMLElement> = {
9
+ onPointerDown: React.PointerEventHandler<T>;
10
+ onKeyDown: React.KeyboardEventHandler<T>;
11
+ ripples: React.ReactNode;
12
+ };
13
+ declare const useRipple: <T extends HTMLElement>(args: UseRippleArgs<T>) => UseRippleResult<T>;
14
+ export { useRipple };
15
+ //# sourceMappingURL=useRipple.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRipple.d.ts","sourceRoot":"","sources":["../../src/utils/useRipple.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAmC7D,KAAK,aAAa,CAAC,CAAC,SAAS,WAAW,IAAI;IACxC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/B,aAAa,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACzD,SAAS,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAKtD,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACpC,CAAC;AAEF,KAAK,eAAe,CAAC,CAAC,SAAS,WAAW,IAAI;IAC1C,aAAa,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAC5C,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IACzC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAYF,QAAA,MAAM,SAAS,GAAI,CAAC,SAAS,WAAW,EAAE,MAAM,aAAa,CAAC,CAAC,CAAC,KAAG,eAAe,CAAC,CAAC,CA0EnF,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.useRipple = void 0;
37
+ const react_1 = __importStar(require("react"));
38
+ const HALF = 2;
39
+ const RIPPLE_SPEED_PX_PER_MS = 1.5;
40
+ const RIPPLE_MIN_DURATION_MS = 250;
41
+ const prefersReducedMotion = () => {
42
+ if (typeof window === "undefined") {
43
+ return false;
44
+ }
45
+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
46
+ };
47
+ const isDisabled = (el) => {
48
+ if ("disabled" in el && el.disabled) {
49
+ return true;
50
+ }
51
+ return el.getAttribute("aria-disabled") === "true";
52
+ };
53
+ const isRippleDisabledByCssVar = (el) => {
54
+ if (typeof window === "undefined") {
55
+ return false;
56
+ }
57
+ return window.getComputedStyle(el).getPropertyValue("--miui-ripple").trim() === "0";
58
+ };
59
+ const useRipple = (args) => {
60
+ const { ref, onPointerDown, onKeyDown, fromCenter = false } = args;
61
+ const [ripples, setRipples] = (0, react_1.useState)([]);
62
+ const idCounter = (0, react_1.useRef)(0);
63
+ const addRippleAt = (0, react_1.useCallback)((clientX, clientY) => {
64
+ const el = ref.current;
65
+ if (!el || isDisabled(el) || prefersReducedMotion() || isRippleDisabledByCssVar(el)) {
66
+ return;
67
+ }
68
+ const rect = el.getBoundingClientRect();
69
+ const x = clientX - rect.left;
70
+ const y = clientY - rect.top;
71
+ const maxX = Math.max(x, rect.width - x);
72
+ const maxY = Math.max(y, rect.height - y);
73
+ const size = Math.hypot(maxX, maxY) * HALF;
74
+ const duration = Math.max(RIPPLE_MIN_DURATION_MS, size / RIPPLE_SPEED_PX_PER_MS);
75
+ idCounter.current += 1;
76
+ const id = idCounter.current;
77
+ setRipples((arr) => [...arr, { id, x, y, size, duration }]);
78
+ }, [ref]);
79
+ const handlePointerDown = (0, react_1.useCallback)((evt) => {
80
+ if (fromCenter) {
81
+ const el = ref.current;
82
+ if (el) {
83
+ const rect = el.getBoundingClientRect();
84
+ addRippleAt(rect.left + (rect.width / HALF), rect.top + (rect.height / HALF));
85
+ }
86
+ }
87
+ else {
88
+ addRippleAt(evt.clientX, evt.clientY);
89
+ }
90
+ onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown(evt);
91
+ }, [addRippleAt, onPointerDown, fromCenter, ref]);
92
+ const handleKeyDown = (0, react_1.useCallback)((evt) => {
93
+ if (!evt.repeat && (evt.key === "Enter" || evt.key === " ")) {
94
+ const el = ref.current;
95
+ if (el) {
96
+ const rect = el.getBoundingClientRect();
97
+ addRippleAt(rect.left + (rect.width / HALF), rect.top + (rect.height / HALF));
98
+ }
99
+ }
100
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(evt);
101
+ }, [addRippleAt, ref, onKeyDown]);
102
+ const handleAnimationEnd = (0, react_1.useCallback)((evt) => {
103
+ const id = Number(evt.currentTarget.dataset.rippleId);
104
+ setRipples((arr) => arr.filter((r) => r.id !== id));
105
+ }, []);
106
+ const elements = ripples.map((r) => (react_1.default.createElement("span", { key: r.id, "data-miui-ripple": true, "data-ripple-id": r.id, "aria-hidden": true, style: {
107
+ left: `${String(r.x - (r.size / HALF))}px`,
108
+ top: `${String(r.y - (r.size / HALF))}px`,
109
+ width: `${String(r.size)}px`,
110
+ height: `${String(r.size)}px`,
111
+ animationDuration: `${String(r.duration)}ms`,
112
+ }, onAnimationEnd: handleAnimationEnd })));
113
+ return {
114
+ onPointerDown: handlePointerDown,
115
+ onKeyDown: handleKeyDown,
116
+ ripples: elements,
117
+ };
118
+ };
119
+ exports.useRipple = useRipple;
120
+ //# sourceMappingURL=useRipple.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRipple.js","sourceRoot":"","sources":["../../src/utils/useRipple.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA6D;AAU7D,MAAM,IAAI,GAAG,CAAC,CAAC;AACf,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC,MAAM,oBAAoB,GAAG,GAAY,EAAE;IACvC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC;AACzE,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,EAAe,EAAW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EAAE,sBACS,IAAI,oBACN,CAAC,CAAC,EAAE,iBACP,IAAI,EACjB,KAAK,EAAE;YACH,IAAI,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,IAAI;YAC1C,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,IAAI;YACzC,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;YAC5B,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;YAC7B,iBAAiB,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI;SAC/C,EACD,cAAc,EAAE,kBAAkB,GACpC,CACL,CAAC,CAAC;IAEH,OAAO;QACH,aAAa,EAAE,iBAAiB;QAChC,SAAS,EAAE,aAAa;QACxB,OAAO,EAAE,QAAQ;KACpB,CAAC;AACN,CAAC,CAAC;AAEO,8BAAS"}
@@ -0,0 +1,28 @@
1
+ declare const rippleHostStyles: {
2
+ position: string;
3
+ overflow: string;
4
+ WebkitTapHighlightColor: string;
5
+ transition: string;
6
+ "&:where(a, button):hover:not(:disabled):not([aria-disabled='true'])": {
7
+ boxShadow: string;
8
+ };
9
+ "&:where(a, button):active:not(:disabled):not([aria-disabled='true'])": {
10
+ boxShadow: string;
11
+ };
12
+ "@media (prefers-reduced-motion: reduce)": {
13
+ transition: string;
14
+ };
15
+ "& > span[data-miui-ripple]": {
16
+ position: string;
17
+ pointerEvents: string;
18
+ borderRadius: string;
19
+ backgroundColor: string;
20
+ transform: string;
21
+ opacity: number;
22
+ animationName: string;
23
+ animationTimingFunction: string;
24
+ animationFillMode: string;
25
+ };
26
+ };
27
+ export { rippleHostStyles, };
28
+ //# sourceMappingURL=useRipple.styled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRipple.styled.d.ts","sourceRoot":"","sources":["../../src/utils/useRipple.styled.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;CAiCrB,CAAC;AAEF,OAAO,EACH,gBAAgB,GACnB,CAAC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rippleHostStyles = void 0;
4
+ const theme_1 = require("../theme");
5
+ const rippleKeyframes = (0, theme_1.keyframes)({
6
+ "0%": { transform: "scale(0)", opacity: 0.35 },
7
+ "100%": { transform: "scale(1)", opacity: 0 },
8
+ });
9
+ const rippleHostStyles = {
10
+ "position": "relative",
11
+ "overflow": "hidden",
12
+ "WebkitTapHighlightColor": "transparent",
13
+ "transition": "box-shadow 150ms ease-out",
14
+ "&:where(a, button):hover:not(:disabled):not([aria-disabled='true'])": {
15
+ boxShadow: "inset 0 0 0 9999px color-mix(in srgb, currentColor calc(6% * var(--miui-ripple, 1)), transparent)",
16
+ },
17
+ "&:where(a, button):active:not(:disabled):not([aria-disabled='true'])": {
18
+ boxShadow: "inset 0 0 0 9999px color-mix(in srgb, currentColor calc(12% * var(--miui-ripple, 1)), transparent)",
19
+ },
20
+ "@media (prefers-reduced-motion: reduce)": {
21
+ transition: "none",
22
+ },
23
+ "& > span[data-miui-ripple]": {
24
+ position: "absolute",
25
+ pointerEvents: "none",
26
+ borderRadius: "50%",
27
+ backgroundColor: "currentColor",
28
+ transform: "scale(0)",
29
+ opacity: 0,
30
+ animationName: String(rippleKeyframes),
31
+ animationTimingFunction: "ease-out",
32
+ animationFillMode: "forwards",
33
+ },
34
+ };
35
+ exports.rippleHostStyles = rippleHostStyles;
36
+ //# sourceMappingURL=useRipple.styled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRipple.styled.js","sourceRoot":"","sources":["../../src/utils/useRipple.styled.ts"],"names":[],"mappings":";;;AAAA,oCAAqC;AAErC,MAAM,eAAe,GAAG,IAAA,iBAAS,EAAC;IAC9B,IAAI,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE;IAC9C,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE;CAChD,CAAC,CAAC;AAaH,MAAM,gBAAgB,GAAG;IACrB,UAAU,EAAE,UAAU;IACtB,UAAU,EAAE,QAAQ;IACpB,yBAAyB,EAAE,aAAa;IACxC,YAAY,EAAE,2BAA2B;IAOzC,qEAAqE,EAAE;QACnE,SAAS,EAAE,mGAAmG;KACjH;IACD,sEAAsE,EAAE;QACpE,SAAS,EAAE,oGAAoG;KAClH;IAED,yCAAyC,EAAE;QACvC,UAAU,EAAE,MAAM;KACrB;IAED,4BAA4B,EAAE;QAC1B,QAAQ,EAAE,UAAU;QACpB,aAAa,EAAE,MAAM;QACrB,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,cAAc;QAC/B,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,CAAC;QACV,aAAa,EAAE,MAAM,CAAC,eAAe,CAAC;QACtC,uBAAuB,EAAE,UAAU;QACnC,iBAAiB,EAAE,UAAU;KAChC;CACJ,CAAC;AAGE,4CAAgB"}